diff --git a/src/profiles/server/routes/config.py b/src/profiles/server/routes/config.py index 6da3034..db6a4c6 100644 --- a/src/profiles/server/routes/config.py +++ b/src/profiles/server/routes/config.py @@ -170,6 +170,7 @@ def _apply_config_from_disk(state: ServerState, config_path: Path) -> dict: loaded = ConfigReader(config_path).load() state.config = loaded state.session_trial = False + state.trial_content = None state.config_path = config_path state.active_directory = _choose_active_directory(loaded, config_path) return _config_response(state) @@ -264,6 +265,9 @@ async def load_content_endpoint(payload: LoadContentRequest, request: Request) - state.config = loaded state.session_trial = True + # Remember the raw payload (issue #97): parsing discards it, and it is + # the only record GET /content can echo for a path-less trial. + state.trial_content = payload.content state.active_directory = _choose_active_directory(loaded, None) response = _config_response(state) response["session_trial"] = True @@ -341,6 +345,7 @@ async def reload_config_endpoint(request: Request) -> dict: loaded.config_path = config_path state.config = loaded state.session_trial = False + state.trial_content = None state.config_path = config_path state.active_directory = _choose_active_directory(loaded, config_path) response = _config_response(state) @@ -364,17 +369,18 @@ async def get_config_content(request: Request) -> dict: """Return the active configuration file's text for the YAML editor. Responds ``{"filename", "content", "config_path", "session_trial"}``. - A session trial (config applied from dropped content) answers an - empty body flagged ``session_trial=True`` — ``config_path`` stays - ``None`` so the stale CWD-resolved path never leaks, and ``filename`` - carries the config's display name — instead of file text; a + A session trial (config applied from dropped content) answers the + text that was applied (``ServerState.trial_content``, issue #97) with + ``session_trial=True`` and ``config_path=None`` — ``config_path`` + stays ``None`` so the stale CWD-resolved path never leaks, and + ``filename`` carries the config's display name. A recorded-but-missing file answers 404. """ state: ServerState = request.app.state.server_state if not has_disk_path(state): return { "filename": state.config.title or "session-trial", - "content": "", + "content": state.trial_content or "", "config_path": None, "session_trial": True, } diff --git a/src/profiles/server/state.py b/src/profiles/server/state.py index 45f8be4..efc4e32 100644 --- a/src/profiles/server/state.py +++ b/src/profiles/server/state.py @@ -39,6 +39,12 @@ class ServerState: # True while the active config is an in-memory trial from a # dropped/loaded content payload (no disk anchor). session_trial: bool = False + # Raw YAML text behind ``session_trial`` trials (issue #97): the ONLY + # record of what was applied, since parsing discards the payload. + # GET /content echoes it so a reopened editor shows the live trial + # configuration. Cleared by every disk-anchoring path — it belongs to + # no real file, so anchoring invalidates it. + trial_content: str | None = None # Shared secret verifying handoff requests from a second ProFiles # launch (issue #4); None disables the identity/handoff endpoints. instance_token: str | None = None diff --git a/src/profiles/web/dist/.web-build-marker b/src/profiles/web/dist/.web-build-marker deleted file mode 100644 index e69de29..0000000 diff --git a/src/profiles/web/dist/assets/index-CVDj4KUe.js b/src/profiles/web/dist/assets/index-CVDj4KUe.js new file mode 100644 index 0000000..8b0c53f --- /dev/null +++ b/src/profiles/web/dist/assets/index-CVDj4KUe.js @@ -0,0 +1,445 @@ +var rM=Object.defineProperty;var lM=(n,e,t)=>e in n?rM(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t;var hh=(n,e,t)=>lM(n,typeof e!="symbol"?e+"":e,t);(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const l of document.querySelectorAll('link[rel="modulepreload"]'))i(l);new MutationObserver(l=>{for(const o of l)if(o.type==="childList")for(const a of o.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&i(a)}).observe(document,{childList:!0,subtree:!0});function t(l){const o={};return l.integrity&&(o.integrity=l.integrity),l.referrerPolicy&&(o.referrerPolicy=l.referrerPolicy),l.crossOrigin==="use-credentials"?o.credentials="include":l.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function i(l){if(l.ep)return;l.ep=!0;const o=t(l);fetch(l.href,o)}})();function my(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var Vg={exports:{}},_c={};/** + * @license React + * react-jsx-runtime.production.js + * + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var Ck;function sM(){if(Ck)return _c;Ck=1;var n=Symbol.for("react.transitional.element"),e=Symbol.for("react.fragment");function t(i,l,o){var a=null;if(o!==void 0&&(a=""+o),l.key!==void 0&&(a=""+l.key),"key"in l){o={};for(var u in l)u!=="key"&&(o[u]=l[u])}else o=l;return l=o.ref,{$$typeof:n,type:i,key:a,ref:l!==void 0?l:null,props:o}}return _c.Fragment=e,_c.jsx=t,_c.jsxs=t,_c}var Ok;function oM(){return Ok||(Ok=1,Vg.exports=sM()),Vg.exports}var y=oM(),Qg={exports:{}},Ue={};/** + * @license React + * react.production.js + * + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var Nk;function aM(){if(Nk)return Ue;Nk=1;var n=Symbol.for("react.transitional.element"),e=Symbol.for("react.portal"),t=Symbol.for("react.fragment"),i=Symbol.for("react.strict_mode"),l=Symbol.for("react.profiler"),o=Symbol.for("react.consumer"),a=Symbol.for("react.context"),u=Symbol.for("react.forward_ref"),f=Symbol.for("react.suspense"),d=Symbol.for("react.memo"),m=Symbol.for("react.lazy"),g=Symbol.for("react.activity"),b=Symbol.for("react.view_transition"),v=Symbol.iterator;function w(j){return j===null||typeof j!="object"?null:(j=v&&j[v]||j["@@iterator"],typeof j=="function"?j:null)}var S={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},C=Object.assign,N={};function R(j,$,fe){this.props=j,this.context=$,this.refs=N,this.updater=fe||S}R.prototype.isReactComponent={},R.prototype.setState=function(j,$){if(typeof j!="object"&&typeof j!="function"&&j!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,j,$,"setState")},R.prototype.forceUpdate=function(j){this.updater.enqueueForceUpdate(this,j,"forceUpdate")};function M(){}M.prototype=R.prototype;function I(j,$,fe){this.props=j,this.context=$,this.refs=N,this.updater=fe||S}var U=I.prototype=new M;U.constructor=I,C(U,R.prototype),U.isPureReactComponent=!0;var E=Array.isArray;function T(){}var z={H:null,A:null,T:null,S:null},ie=Object.prototype.hasOwnProperty;function q(j,$,fe){var me=fe.ref;return{$$typeof:n,type:j,key:$,ref:me!==void 0?me:null,props:fe}}function J(j,$){return q(j.type,$,j.props)}function F(j){return typeof j=="object"&&j!==null&&j.$$typeof===n}function se(j){var $={"=":"=0",":":"=2"};return"$"+j.replace(/[=:]/g,function(fe){return $[fe]})}var he=/\/+/g;function ne(j,$){return typeof j=="object"&&j!==null&&j.key!=null?se(""+j.key):$.toString(36)}function L(j){switch(j.status){case"fulfilled":return j.value;case"rejected":throw j.reason;default:switch(typeof j.status=="string"?j.then(T,T):(j.status="pending",j.then(function($){j.status==="pending"&&(j.status="fulfilled",j.value=$)},function($){j.status==="pending"&&(j.status="rejected",j.reason=$)})),j.status){case"fulfilled":return j.value;case"rejected":throw j.reason}}throw j}function ee(j,$,fe,me,Ne){var Te=typeof j;(Te==="undefined"||Te==="boolean")&&(j=null);var ze=!1;if(j===null)ze=!0;else switch(Te){case"bigint":case"string":case"number":ze=!0;break;case"object":switch(j.$$typeof){case n:case e:ze=!0;break;case m:return ze=j._init,ee(ze(j._payload),$,fe,me,Ne)}}if(ze)return Ne=Ne(j),ze=me===""?"."+ne(j,0):me,E(Ne)?(fe="",ze!=null&&(fe=ze.replace(he,"$&/")+"/"),ee(Ne,$,fe,"",function(It){return It})):Ne!=null&&(F(Ne)&&(Ne=J(Ne,fe+(Ne.key==null||j&&j.key===Ne.key?"":(""+Ne.key).replace(he,"$&/")+"/")+ze)),$.push(Ne)),1;ze=0;var ve=me===""?".":me+":";if(E(j))for(var je=0;je>>1,A=L[le];if(0>>1;lel(B,oe))jl($,B)?(L[le]=$,L[j]=oe,le=j):(L[le]=B,L[_e]=oe,le=_e);else if(jl($,oe))L[le]=$,L[j]=oe,le=j;else break e}}return ee}function l(L,ee){var oe=L.sortIndex-ee.sortIndex;return oe!==0?oe:L.id-ee.id}if(n.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var o=performance;n.unstable_now=function(){return o.now()}}else{var a=Date,u=a.now();n.unstable_now=function(){return a.now()-u}}var f=[],d=[],m=1,g=null,b=3,v=!1,w=!1,S=!1,C=!1,N=typeof setTimeout=="function"?setTimeout:null,R=typeof clearTimeout=="function"?clearTimeout:null,M=typeof setImmediate<"u"?setImmediate:null;function I(L){for(var ee=t(d);ee!==null;){if(ee.callback===null)i(d);else if(ee.startTime<=L)i(d),ee.sortIndex=ee.expirationTime,e(f,ee);else break;ee=t(d)}}function U(L){if(S=!1,I(L),!w)if(t(f)!==null)w=!0,E||(E=!0,F());else{var ee=t(d);ee!==null&&ne(U,ee.startTime-L)}}var E=!1,T=-1,z=5,ie=-1;function q(){return C?!0:!(n.unstable_now()-ieL&&q());){var le=g.callback;if(typeof le=="function"){g.callback=null,b=g.priorityLevel;var A=le(g.expirationTime<=L);if(L=n.unstable_now(),typeof A=="function"){g.callback=A,I(L),ee=!0;break t}g===t(f)&&i(f),I(L)}else i(f);g=t(f)}if(g!==null)ee=!0;else{var Le=t(d);Le!==null&&ne(U,Le.startTime-L),ee=!1}}break e}finally{g=null,b=oe,v=!1}ee=void 0}}finally{ee?F():E=!1}}}var F;if(typeof M=="function")F=function(){M(J)};else if(typeof MessageChannel<"u"){var se=new MessageChannel,he=se.port2;se.port1.onmessage=J,F=function(){he.postMessage(null)}}else F=function(){N(J,0)};function ne(L,ee){T=N(function(){L(n.unstable_now())},ee)}n.unstable_IdlePriority=5,n.unstable_ImmediatePriority=1,n.unstable_LowPriority=4,n.unstable_NormalPriority=3,n.unstable_Profiling=null,n.unstable_UserBlockingPriority=2,n.unstable_cancelCallback=function(L){L.callback=null},n.unstable_forceFrameRate=function(L){0>L||125le?(L.sortIndex=oe,e(d,L),t(f)===null&&L===t(d)&&(S?(R(T),T=-1):S=!0,ne(U,oe-le))):(L.sortIndex=A,e(f,L),w||v||(w=!0,E||(E=!0,F()))),L},n.unstable_shouldYield=q,n.unstable_wrapCallback=function(L){var ee=b;return function(){var oe=b;b=ee;try{return L.apply(this,arguments)}finally{b=oe}}}})(Yg)),Yg}var Ek;function fM(){return Ek||(Ek=1,$g.exports=uM()),$g.exports}var Gg={exports:{}},Mn={};/** + * @license React + * react-dom.production.js + * + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var Mk;function hM(){if(Mk)return Mn;Mk=1;var n=py();function e(m){var g="https://react.dev/errors/"+m;if(1"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}return n(),Gg.exports=hM(),Gg.exports}/** + * @license React + * react-dom-client.production.js + * + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var jk;function dM(){if(jk)return Lc;jk=1;var n=fM(),e=py(),t=XC();function i(r){var s="https://react.dev/errors/"+r;if(1un||(r.current=Gt[un],Gt[un]=null,un--)}function rt(r,s){un++,Gt[un]=r.current,r.current=s}var Ut=_t(null),zn=_t(null),Ft=_t(null),en=_t(null);function ke(r,s){switch(rt(Ft,s),rt(zn,r),rt(Ut,null),s.nodeType){case 9:case 11:r=(r=s.documentElement)&&(r=r.namespaceURI)?Rw(r):0;break;default:if(r=s.tagName,s=s.namespaceURI)s=Rw(s),r=_w(s,r);else switch(r){case"svg":r=1;break;case"math":r=2;break;default:r=0}}yt(Ut),rt(Ut,r)}function qe(){yt(Ut),yt(zn),yt(Ft)}function Ie(r){var s=r.memoizedState;s!==null&&(Wo._currentValue=s.memoizedState,rt(en,r)),s=Ut.current;var c=_w(s,r.type);s!==c&&(rt(zn,r),rt(Ut,c))}function at(r){zn.current===r&&(yt(Ut),yt(zn)),en.current===r&&(yt(en),Wo._currentValue=It)}var V,K;function de(r){if(V===void 0)try{throw Error()}catch(c){var s=c.stack.trim().match(/\n( *(at )?)/);V=s&&s[1]||"",K=-1)":-1p||_[h]!==G[p]){var te=` +`+_[h].replace(" at new "," at ");return r.displayName&&te.includes("")&&(te=te.replace("",r.displayName)),te}while(1<=h&&0<=p);break}}}finally{Se=!1,Error.prepareStackTrace=c}return(c=r?r.displayName||r.name:"")?de(c):""}function ot(r,s){switch(r.tag){case 26:case 27:case 5:return de(r.type);case 16:return de("Lazy");case 13:return r.child!==s&&s!==null?de("Suspense Fallback"):de("Suspense");case 19:return de("SuspenseList");case 0:case 15:return We(r.type,!1);case 11:return We(r.type.render,!1);case 1:return We(r.type,!0);case 31:return de("Activity");case 30:return de("ViewTransition");default:return""}}function gt(r){try{var s="",c=null;do s+=ot(r,c),c=r,r=r.return;while(r);return s}catch(h){return` +Error generating stack: `+h.message+` +`+h.stack}}var qt=Object.prototype.hasOwnProperty,mn=n.unstable_scheduleCallback,Mi=n.unstable_cancelCallback,or=n.unstable_shouldYield,ao=n.unstable_requestPaint,tn=n.unstable_now,pn=n.unstable_getCurrentPriorityLevel,Jn=n.unstable_ImmediatePriority,gn=n.unstable_UserBlockingPriority,hl=n.unstable_NormalPriority,ms=n.unstable_LowPriority,Lu=n.unstable_IdlePriority,co=n.log,ps=n.unstable_setDisableYieldValue,xe=null,qn=null;function ar(r){if(typeof co=="function"&&ps(r),qn&&typeof qn.setStrictMode=="function")try{qn.setStrictMode(xe,r)}catch{}}var Lt=Math.clz32?Math.clz32:ti,Vt=Math.log,ei=Math.LN2;function ti(r){return r>>>=0,r===0?32:31-(Vt(r)/ei|0)|0}var Nt=256,uo=262144,gs=4194304;function xn(r){var s=r&42;if(s!==0)return s;switch(r&-r){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:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return r&-r;case 262144:case 524288:case 1048576:case 2097152:return r&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return r&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return r}}function fo(r,s,c){var h=r.pendingLanes;if(h===0)return 0;var p=0,x=r.suspendedLanes,k=r.pingedLanes;r=r.warmLanes;var O=h&134217727;return O!==0?(h=O&~x,h!==0?p=xn(h):(k&=O,k!==0?p=xn(k):c||(c=O&~r,c!==0&&(p=xn(c))))):(O=h&~x,O!==0?p=xn(O):k!==0?p=xn(k):c||(c=h&~r,c!==0&&(p=xn(c)))),p===0?0:s!==0&&s!==p&&(s&x)===0&&(x=p&-p,c=s&-s,x>=c||x===32&&(c&4194048)!==0)?s:p}function dl(r,s){return(r.pendingLanes&~(r.suspendedLanes&~r.pingedLanes)&s)===0}function xs(r,s){(s&8)!==0&&(s|=s&32);var c=r.entangledLanes;if(c!==0)for(r=r.entanglements,c&=s;0c;c++)s.push(r);return s}function cr(r,s){r.pendingLanes|=s,s!==268435456&&(r.suspendedLanes=0,r.pingedLanes=0,r.warmLanes=0)}function Pa(r,s,c,h,p,x){var k=r.pendingLanes;r.pendingLanes=c,r.suspendedLanes=0,r.pingedLanes=0,r.warmLanes=0,r.expiredLanes&=c,r.entangledLanes&=c,r.errorRecoveryDisabledLanes&=c,r.shellSuspendCounter=0;var O=r.entanglements,_=r.expirationTimes,G=r.hiddenUpdates;for(c=k&~c;0"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Tm=!1;if(Fr)try{var $a={};Object.defineProperty($a,"passive",{get:function(){Tm=!0}}),window.addEventListener("test",$a,$a),window.removeEventListener("test",$a,$a)}catch{Tm=!1}var bl=null,Am=null,Yu=null;function Eb(){if(Yu)return Yu;var r,s=Am,c=s.length,h,p="value"in bl?bl.value:bl.textContent,x=p.length;for(r=0;r=Ka),Lb=" ",zb=!1;function Bb(r,s){switch(r){case"keyup":return t5.indexOf(s.keyCode)!==-1;case"keydown":return s.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Pb(r){return r=r.detail,typeof r=="object"&&"data"in r?r.data:null}var bo=!1;function i5(r,s){switch(r){case"compositionend":return Pb(s);case"keypress":return s.which!==32?null:(zb=!0,Lb);case"textInput":return r=s.data,r===Lb&&zb?null:r;default:return null}}function r5(r,s){if(bo)return r==="compositionend"||!Rm&&Bb(r,s)?(r=Eb(),Yu=Am=bl=null,bo=!1,r):null;switch(r){case"paste":return null;case"keypress":if(!(s.ctrlKey||s.altKey||s.metaKey)||s.ctrlKey&&s.altKey){if(s.char&&1"u")return null;try{return r.activeElement||r.body}catch{return r.body}}function Xb(r){for(;r&&r.firstChild;)r=r.firstChild;return r}function $b(r,s){var c=Xb(r);r=0;for(var h;c;){if(c.nodeType===3){if(h=r+c.textContent.length,r<=s&&h>=s)return{node:c,offset:s-r};r=h}e:{for(;c;){if(c.nextSibling){c=c.nextSibling;break e}c=c.parentNode}c=void 0}c=Xb(c)}}function Yb(r,s){return r&&s?r===s?!0:r&&r.nodeType===3?!1:s&&s.nodeType===3?Yb(r,s.parentNode):"contains"in r?r.contains(s):r.compareDocumentPosition?!!(r.compareDocumentPosition(s)&16):!1:!1}function Gb(r){r=r!=null&&r.ownerDocument!=null&&r.ownerDocument.defaultView!=null?r.ownerDocument.defaultView:window;for(var s=zm(r.document);s instanceof r.HTMLIFrameElement;){try{var c=typeof s.contentWindow.location.href=="string"}catch{c=!1}if(c)r=s.contentWindow;else break;s=zm(r.document)}return s}function Bm(r){var s=r&&r.nodeName&&r.nodeName.toLowerCase();return s&&(s==="input"&&(r.type==="text"||r.type==="search"||r.type==="tel"||r.type==="url"||r.type==="password")||s==="textarea"||r.contentEditable==="true")}var h5=Fr&&"documentMode"in document&&11>=document.documentMode,vo=null,Pm=null,ec=null,Hm=!1;function Kb(r,s,c){var h=c.window===c?c.document:c.nodeType===9?c:c.ownerDocument;Hm||vo==null||vo!==zm(h)||(h=vo,"selectionStart"in h&&Bm(h)?h={start:h.selectionStart,end:h.selectionEnd}:(h=(h.ownerDocument&&h.ownerDocument.defaultView||window).getSelection(),h={anchorNode:h.anchorNode,anchorOffset:h.anchorOffset,focusNode:h.focusNode,focusOffset:h.focusOffset}),ec&&Ja(ec,h)||(ec=h,h=eh(Pm,"onSelect"),0>=k,p-=k,hr=1<<32-Lt(s)+p|c<Pe?(on=Re,Re=null):on=Re.sibling;var ut=X(Y,Re,W[Pe],ce);if(ut===null){Re===null&&(Re=on);break}r&&Re&&ut.alternate===null&&s(Y,Re),Q=x(ut,Q,Pe),st===null?Ae=ut:st.sibling=ut,st=ut,Re=on}if(Pe===W.length)return c(Y,Re),Ge&&Xr(Y,Pe),Ae;if(Re===null){for(;PePe?(on=Re,Re=null):on=Re.sibling;var Vl=X(Y,Re,ut.value,ce);if(Vl===null){Re===null&&(Re=on);break}r&&Re&&Vl.alternate===null&&s(Y,Re),Q=x(Vl,Q,Pe),st===null?Ae=Vl:st.sibling=Vl,st=Vl,Re=on}if(ut.done)return c(Y,Re),Ge&&Xr(Y,Pe),Ae;if(Re===null){for(;!ut.done;Pe++,ut=W.next())ut=ue(Y,ut.value,ce),ut!==null&&(Q=x(ut,Q,Pe),st===null?Ae=ut:st.sibling=ut,st=ut);return Ge&&Xr(Y,Pe),Ae}for(Re=h(Re);!ut.done;Pe++,ut=W.next())ut=Z(Re,Y,Pe,ut.value,ce),ut!==null&&(r&&(on=ut.alternate,on!==null&&Re.delete(on.key===null?Pe:on.key)),Q=x(ut,Q,Pe),st===null?Ae=ut:st.sibling=ut,st=ut);return r&&Re.forEach(function(iM){return s(Y,iM)}),Ge&&Xr(Y,Pe),Ae}function $e(Y,Q,W,ce){if(typeof W=="object"&&W!==null&&W.type===J&&W.key===null&&W.props.ref===void 0&&(W=W.props.children),typeof W=="object"&&W!==null){switch(W.$$typeof){case ie:e:{for(var Ae=W.key;Q!==null;){if(Q.key===Ae){if(Ae=W.type,Ae===J){if(Q.tag===7){c(Y,Q.sibling),ce=p(Q,W.props.children),Ol(ce,W),ce.return=Y,Y=ce;break e}}else if(Q.elementType===Ae||typeof Ae=="object"&&Ae!==null&&Ae.$$typeof===A&&Ds(Ae)===Q.type){c(Y,Q.sibling),ce=p(Q,W.props),Ol(ce,W),ce.return=Y,Y=ce;break e}c(Y,Q);break}else s(Y,Q);Q=Q.sibling}W.type===J?(ce=Cs(W.props.children,Y.mode,ce,W.key),Ol(ce,W),ce.return=Y,Y=ce):(ce=lf(W.type,W.key,W.props,null,Y.mode,ce),Ol(ce,W),ce.return=Y,Y=ce)}return k(Y);case q:e:{for(Ae=W.key;Q!==null;){if(Q.key===Ae)if(Q.tag===4&&Q.stateNode.containerInfo===W.containerInfo&&Q.stateNode.implementation===W.implementation){c(Y,Q.sibling),ce=p(Q,W.children||[]),ce.return=Y,Y=ce;break e}else{c(Y,Q);break}else s(Y,Q);Q=Q.sibling}ce=Xm(W,Y.mode,ce),ce.return=Y,Y=ce}return k(Y);case A:return W=Ds(W),$e(Y,Q,W,ce)}if(ze(W))return ye(Y,Q,W,ce);if(me(W)){if(Ae=me(W),typeof Ae!="function")throw Error(i(150));return W=Ae.call(W),Ee(Y,Q,W,ce)}if(typeof W.then=="function")return $e(Y,Q,pf(W),ce);if(W.$$typeof===ne)return $e(Y,Q,ff(Y,W),ce);gf(Y,W)}return typeof W=="string"&&W!==""||typeof W=="number"||typeof W=="bigint"?(W=""+W,Q!==null&&Q.tag===6?(c(Y,Q.sibling),ce=p(Q,W),ce.return=Y,Y=ce):(c(Y,Q),ce=Qm(W,Y.mode,ce),ce.return=Y,Y=ce),k(Y)):c(Y,Q)}return function(Y,Q,W,ce){try{sc=0;var Ae=$e(Y,Q,W,ce);return Eo=null,Ae}catch(Re){if(Re===Ao||Re===df)throw Re;var st=ii(29,Re,null,Y.mode);return st.lanes=ce,st.return=Y,st}finally{}}}var Rs=v1(!0),w1=v1(!1),Nl=!1;function np(r){r.updateQueue={baseState:r.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function ip(r,s){r=r.updateQueue,s.updateQueue===r&&(s.updateQueue={baseState:r.baseState,firstBaseUpdate:r.firstBaseUpdate,lastBaseUpdate:r.lastBaseUpdate,shared:r.shared,callbacks:null})}function Tl(r){return{lane:r,tag:0,payload:null,callback:null,next:null}}function Al(r,s,c){var h=r.updateQueue;if(h===null)return null;if(h=h.shared,(pt&2)!==0){var p=h.pending;return p===null?s.next=s:(s.next=p.next,p.next=s),h.pending=s,s=rf(r),r1(r,null,c),s}return nf(r,h,s,c),rf(r)}function oc(r,s,c){if(s=s.updateQueue,s!==null&&(s=s.shared,(c&4194048)!==0)){var h=s.lanes;h&=r.pendingLanes,c|=h,s.lanes=c,ho(r,c)}}function rp(r,s){var c=r.updateQueue,h=r.alternate;if(h!==null&&(h=h.updateQueue,c===h)){var p=null,x=null;if(c=c.firstBaseUpdate,c!==null){do{var k={lane:c.lane,tag:c.tag,payload:c.payload,callback:null,next:null};x===null?p=x=k:x=x.next=k,c=c.next}while(c!==null);x===null?p=x=s:x=x.next=s}else p=x=s;c={baseState:h.baseState,firstBaseUpdate:p,lastBaseUpdate:x,shared:h.shared,callbacks:h.callbacks},r.updateQueue=c;return}r=c.lastBaseUpdate,r===null?c.firstBaseUpdate=s:r.next=s,c.lastBaseUpdate=s}var lp=!1;function ac(){if(lp){var r=To;if(r!==null)throw r}}function cc(r,s,c,h){lp=!1;var p=r.updateQueue;Nl=!1;var x=p.firstBaseUpdate,k=p.lastBaseUpdate,O=p.shared.pending;if(O!==null){p.shared.pending=null;var _=O,G=_.next;_.next=null,k===null?x=G:k.next=G,k=_;var te=r.alternate;te!==null&&(te=te.updateQueue,O=te.lastBaseUpdate,O!==k&&(O===null?te.firstBaseUpdate=G:O.next=G,te.lastBaseUpdate=_))}if(x!==null){var ue=p.baseState;k=0,te=G=_=null,O=x;do{var X=O.lane&-536870913,Z=X!==O.lane;if(Z?(lt&X)===X:(h&X)===X){X!==0&&X===Es&&(lp=!0),te!==null&&(te=te.next={lane:0,tag:O.tag,payload:O.payload,callback:null,next:null});e:{var ye=r,Ee=O;X=s;var $e=c;switch(Ee.tag){case 1:if(ye=Ee.payload,typeof ye=="function"){ue=ye.call($e,ue,X);break e}ue=ye;break e;case 3:ye.flags=ye.flags&-65537|128;case 0:if(ye=Ee.payload,X=typeof ye=="function"?ye.call($e,ue,X):ye,X==null)break e;ue=T({},ue,X);break e;case 2:Nl=!0}}X=O.callback,X!==null&&(r.flags|=64,Z&&(r.flags|=8192),Z=p.callbacks,Z===null?p.callbacks=[X]:Z.push(X))}else Z={lane:X,tag:O.tag,payload:O.payload,callback:O.callback,next:null},te===null?(G=te=Z,_=ue):te=te.next=Z,k|=X;if(O=O.next,O===null){if(O=p.shared.pending,O===null)break;Z=O,O=Z.next,Z.next=null,p.lastBaseUpdate=Z,p.shared.pending=null}}while(!0);te===null&&(_=ue),p.baseState=_,p.firstBaseUpdate=G,p.lastBaseUpdate=te,x===null&&(p.shared.lanes=0),Ll|=k,r.lanes=k,r.memoizedState=ue}}function k1(r,s){if(typeof r!="function")throw Error(i(191,r));r.call(s)}function S1(r,s){var c=r.callbacks;if(c!==null)for(r.callbacks=null,r=0;rx?x:8;var k=ve.T,O={};O.types=k!==null?k.types:null,ve.T=O,Op(r,!1,s,c);try{var _=p(),G=ve.S;if(G!==null&&G(O,_),_!==null&&typeof _=="object"&&typeof _.then=="function"){var te=S5(_,h);dc(r,s,te,ki(r))}else dc(r,s,h,ki(r))}catch(ue){dc(r,s,{then:function(){},status:"rejected",reason:ue},ki())}finally{je.p=x,k!==null&&O.types!==null&&(k.types=O.types),ve.T=k}}function E5(){}function Sp(r,s,c,h){if(r.tag!==5)throw Error(i(476));var p=tv(r).queue;ev(r,p,s,It,c===null?E5:function(){return nv(r),c(h)})}function tv(r){var s=r.memoizedState;if(s!==null)return s;s={memoizedState:It,baseState:It,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Kr,lastRenderedState:It},next:null};var c={};return s.next={memoizedState:c,baseState:c,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Kr,lastRenderedState:c},next:null},r.memoizedState=s,r=r.alternate,r!==null&&(r.memoizedState=s),s}function nv(r){var s=tv(r);s.next===null&&(s=r.alternate.memoizedState),dc(r,s.next.queue,{},ki())}function Cp(){return On(Wo)}function iv(){return Wt().memoizedState}function rv(){return Wt().memoizedState}function M5(r){for(var s=r.return;s!==null;){switch(s.tag){case 24:case 3:var c=ki();r=Tl(c);var h=Al(s,r,c);h!==null&&(oi(h,s,c),oc(h,s,c)),s={cache:Zm()},r.payload=s;return}s=s.return}}function D5(r,s,c){var h=ki();c={lane:h,revertLane:0,gesture:null,action:c,hasEagerState:!1,eagerState:null,next:null},Nf(r)?sv(s,c):(c=qm(r,s,c,h),c!==null&&(oi(c,r,h),ov(c,s,h)))}function lv(r,s,c){var h=ki();dc(r,s,c,h)}function dc(r,s,c,h){var p={lane:h,revertLane:0,gesture:null,action:c,hasEagerState:!1,eagerState:null,next:null};if(Nf(r))sv(s,p);else{var x=r.alternate;if(r.lanes===0&&(x===null||x.lanes===0)&&(x=s.lastRenderedReducer,x!==null))try{var k=s.lastRenderedState,O=x(k,c);if(p.hasEagerState=!0,p.eagerState=O,xi(O,k))return nf(r,s,p,0),Tt===null&&tf(),!1}catch{}finally{}if(c=qm(r,s,p,h),c!==null)return oi(c,r,h),ov(c,s,h),!0}return!1}function Op(r,s,c,h){if(h={lane:2,revertLane:pg(),gesture:null,action:h,hasEagerState:!1,eagerState:null,next:null},Nf(r)){if(s)throw Error(i(479))}else s=qm(r,c,h,2),s!==null&&oi(s,r,2)}function Nf(r){var s=r.alternate;return r===Xe||s!==null&&s===Xe}function sv(r,s){Mo=bf=!0;var c=r.pending;c===null?s.next=s:(s.next=c.next,c.next=s),r.pending=s}function ov(r,s,c){if((c&4194048)!==0){var h=s.lanes;h&=r.pendingLanes,c|=h,s.lanes=c,ho(r,c)}}var Tf={readContext:On,use:kf,useCallback:Qt,useContext:Qt,useEffect:Qt,useImperativeHandle:Qt,useLayoutEffect:Qt,useInsertionEffect:Qt,useMemo:Qt,useReducer:Qt,useRef:Qt,useState:Qt,useDebugValue:Qt,useDeferredValue:Qt,useTransition:Qt,useSyncExternalStore:Qt,useId:Qt,useHostTransitionStatus:Qt,useFormState:Qt,useActionState:Qt,useOptimistic:Qt,useMemoCache:Qt,useCacheRefresh:Qt,useEffectEvent:Qt},av={readContext:On,use:kf,useCallback:function(r,s){return Xn().memoizedState=[r,s===void 0?null:s],r},useContext:On,useEffect:Q1,useImperativeHandle:function(r,s,c){c=c!=null?c.concat([r]):null,Cf(4194308,4,G1.bind(null,s,r),c)},useLayoutEffect:function(r,s){return Cf(4194308,4,r,s)},useInsertionEffect:function(r,s){Cf(4,2,r,s)},useMemo:function(r,s){var c=Xn();s=s===void 0?null:s;var h=r();if(_s){ar(!0);try{r()}finally{ar(!1)}}return c.memoizedState=[h,s],h},useReducer:function(r,s,c){var h=Xn();if(c!==void 0){var p=c(s);if(_s){ar(!0);try{c(s)}finally{ar(!1)}}}else p=s;return h.memoizedState=h.baseState=p,r={pending:null,lanes:0,dispatch:null,lastRenderedReducer:r,lastRenderedState:p},h.queue=r,r=r.dispatch=D5.bind(null,Xe,r),[h.memoizedState,r]},useRef:function(r){var s=Xn();return r={current:r},s.memoizedState=r},useState:function(r){r=yp(r);var s=r.queue,c=lv.bind(null,Xe,s);return s.dispatch=c,[r.memoizedState,c]},useDebugValue:wp,useDeferredValue:function(r,s){var c=Xn();return kp(c,r,s)},useTransition:function(){var r=yp(!1);return r=ev.bind(null,Xe,r.queue,!0,!1),Xn().memoizedState=r,[!1,r]},useSyncExternalStore:function(r,s,c){var h=Xe,p=Xn();if(Ge){if(c===void 0)throw Error(i(407));c=c()}else{if(c=s(),Tt===null)throw Error(i(349));(lt&127)!==0||E1(h,s,c)}p.memoizedState=c;var x={value:c,getSnapshot:s};return p.queue=x,Q1(D1.bind(null,h,x,r),[r]),h.flags|=2048,jo(9,{destroy:void 0},M1.bind(null,h,x,c,s),null),c},useId:function(){var r=Xn(),s=Tt.identifierPrefix;if(Ge){var c=dr,h=hr;c=(h&~(1<<32-Lt(h)-1)).toString(32)+c,s="_"+s+"R_"+c,c=vf++,0<\/script>",x=x.removeChild(x.firstChild);break;case"select":x=typeof h.is=="string"?k.createElement("select",{is:h.is}):k.createElement("select"),h.multiple?x.multiple=!0:h.size&&(x.size=h.size);break;default:x=typeof h.is=="string"?k.createElement(p,{is:h.is}):k.createElement(p)}}x[zt]=s,x[Kt]=h;e:for(k=s.child;k!==null;){if(k.tag===5||k.tag===6)x.appendChild(k.stateNode);else if(k.tag!==4&&k.tag!==27&&k.child!==null){k.child.return=k,k=k.child;continue}if(k===s)break e;for(;k.sibling===null;){if(k.return===null||k.return===s)break e;k=k.return}k.sibling.return=k.return,k=k.sibling}s.stateNode=x;e:switch(En(x,p,h),p){case"button":case"input":case"select":case"textarea":h=!!h.autoFocus;break e;case"img":h=!0;break e;default:h=!1}h&&Zr(s)}}return jt(s),s.subtreeFlags&=-33554433,Pp(s,s.type,r===null?null:r.memoizedProps,s.pendingProps,c),null;case 6:if(r&&s.stateNode!=null)r.memoizedProps!==h&&Zr(s);else{if(typeof h!="string"&&s.stateNode===null)throw Error(i(166));if(r=Ft.current,No(s)){if(r=s.stateNode,c=s.memoizedProps,h=null,p=bn,p!==null)switch(p.tag){case 27:case 5:h=p.memoizedProps}r[zt]=s,r=!!(r.nodeValue===c||h!==null&&h.suppressHydrationWarning===!0||Dw(r.nodeValue,c)),r||Sl(s,!0)}else r=Nc(r).createTextNode(h),r[zt]=s,s.stateNode=r}return jt(s),null;case 31:if(c=s.memoizedState,r===null||r.memoizedState!==null){if(h=No(s),c!==null){if(r===null){if(!h)throw Error(i(318));if(r=s.memoizedState,r=r!==null?r.dehydrated:null,!r)throw Error(i(557));r[zt]=s}else Os(),(s.flags&128)===0&&(s.memoizedState=null),s.flags|=4;jt(s),r=!1}else c=Gm(),r!==null&&r.memoizedState!==null&&(r.memoizedState.hydrationErrors=c),r=!0;if(!r)return s.flags&256?(yi(s),s):(yi(s),null);if((s.flags&128)!==0)throw Error(i(558))}return jt(s),null;case 13:if(h=s.memoizedState,r===null||r.memoizedState!==null&&r.memoizedState.dehydrated!==null){if(p=No(s),h!==null&&h.dehydrated!==null){if(r===null){if(!p)throw Error(i(318));if(p=s.memoizedState,p=p!==null?p.dehydrated:null,!p)throw Error(i(317));p[zt]=s}else Os(),(s.flags&128)===0&&(s.memoizedState=null),s.flags|=4;jt(s),p=!1}else p=Gm(),r!==null&&r.memoizedState!==null&&(r.memoizedState.hydrationErrors=p),p=!0;if(!p)return s.flags&256?(yi(s),s):(yi(s),null)}return yi(s),(s.flags&128)!==0?(s.lanes=c,s):(c=h!==null,r=r!==null&&r.memoizedState!==null,c&&(h=s.child,p=null,h.alternate!==null&&h.alternate.memoizedState!==null&&h.alternate.memoizedState.cachePool!==null&&(p=h.alternate.memoizedState.cachePool.pool),x=null,h.memoizedState!==null&&h.memoizedState.cachePool!==null&&(x=h.memoizedState.cachePool.pool),x!==p&&(h.flags|=2048)),c!==r&&c&&(s.child.flags|=8192),Rf(s,s.updateQueue),jt(s),null);case 4:return qe(),r===null&&bg(s.stateNode.containerInfo),s.flags|=67108864,jt(s),null;case 10:return Yr(s.type),jt(s),null;case 19:if(cp(s),h=s.memoizedState,h===null)return jt(s),null;if(p=(s.flags&128)!==0,x=h.rendering,x===null)if(p)pc(h,!1);else{if(Xt!==0||r!==null&&(r.flags&128)!==0)for(r=s.child;r!==null;){if(x=yf(r),x!==null){for(s.flags|=128,pc(h,!1),r=x.updateQueue,s.updateQueue=r,Rf(s,r),s.subtreeFlags=0,r=c,c=s.child;c!==null;)l1(c,r),c=c.sibling;return uc(s,Tn.current&1|2),Ge&&Xr(s,h.treeForkCount),s.child}r=r.sibling}h.tail!==null&&tn()>Qf&&(s.flags|=128,p=!0,pc(h,!1),s.lanes=4194304)}else{if(!p)if(r=yf(x),r!==null){if(s.flags|=128,p=!0,r=r.updateQueue,s.updateQueue=r,Rf(s,r),pc(h,!0),h.tail===null&&h.tailMode!=="collapsed"&&h.tailMode!=="visible"&&!x.alternate&&!Ge)return jt(s),null}else 2*tn()-h.renderingStartTime>Qf&&c!==536870912&&(s.flags|=128,p=!0,pc(h,!1),s.lanes=4194304);h.isBackwards?(x.sibling=s.child,s.child=x):(r=h.last,r!==null?r.sibling=x:s.child=x,h.last=x)}if(h.tail!==null){r=h.tail;e:{for(c=r;c!==null;){if(c.alternate!==null){c=!1;break e}c=c.sibling}c=!0}return h.rendering=r,h.tail=r.sibling,h.renderingStartTime=tn(),r.sibling=null,x=Tn.current,x=p?x&1|2:x&1,h.tailMode==="visible"||h.tailMode==="collapsed"||!c||Ge?uc(s,x):(c=x,rt(Nn,s),rt(Tn,c),Bn===null&&(Bn=s)),Ge&&Xr(s,h.treeForkCount),r}return jt(s),null;case 22:case 23:return yi(s),op(),h=s.memoizedState!==null,r!==null?r.memoizedState!==null!==h&&(s.flags|=8192):h&&(s.flags|=8192),h?(c&536870912)!==0&&(s.flags&128)===0&&(jt(s),s.subtreeFlags&6&&(s.flags|=8192)):jt(s),c=s.updateQueue,c!==null&&Rf(s,c.retryQueue),c=null,r!==null&&r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(c=r.memoizedState.cachePool.pool),h=null,s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(h=s.memoizedState.cachePool.pool),h!==c&&(s.flags|=2048),r!==null&&yt(Ms),null;case 24:return c=null,r!==null&&(c=r.memoizedState.cache),s.memoizedState.cache!==c&&(s.flags|=2048),Yr(rn),jt(s),null;case 25:return null;case 30:return s.flags|=33554432,jt(s),null}throw Error(i(156,s.tag))}function P5(r,s){switch($m(s),s.tag){case 1:return r=s.flags,r&65536?(s.flags=r&-65537|128,s):null;case 3:return Yr(rn),qe(),r=s.flags,(r&65536)!==0&&(r&128)===0?(s.flags=r&-65537|128,s):null;case 26:case 27:case 5:return at(s),null;case 31:if(s.memoizedState!==null){if(yi(s),s.alternate===null)throw Error(i(340));Os()}return r=s.flags,r&65536?(s.flags=r&-65537|128,s):null;case 13:if(yi(s),r=s.memoizedState,r!==null&&r.dehydrated!==null){if(s.alternate===null)throw Error(i(340));Os()}return r=s.flags,r&65536?(s.flags=r&-65537|128,s):null;case 19:return cp(s),r=s.flags,r&65536?(s.flags=r&-65537|128,r=s.memoizedState,r!==null&&(r.rendering=null,r.tail=null),s.flags|=4,s):null;case 4:return qe(),null;case 10:return Yr(s.type),null;case 22:case 23:return yi(s),op(),r!==null&&yt(Ms),r=s.flags,r&65536?(s.flags=r&-65537|128,s):null;case 24:return Yr(rn),null;case 25:return null;default:return null}}function Rv(r,s){switch($m(s),s.tag){case 3:Yr(rn),qe();break;case 26:case 27:case 5:at(s);break;case 4:qe();break;case 31:s.memoizedState!==null&&yi(s);break;case 13:yi(s);break;case 19:cp(s);break;case 10:Yr(s.type);break;case 22:case 23:yi(s),op(),r!==null&&yt(Ms);break;case 24:Yr(rn)}}function gc(r,s){try{var c=s.updateQueue,h=c!==null?c.lastEffect:null;if(h!==null){var p=h.next;c=p;do{if((c.tag&r)===r){h=void 0;var x=c.create,k=c.inst;h=x(),k.destroy=h}c=c.next}while(c!==p)}}catch(O){wt(s,s.return,O)}}function jl(r,s,c){try{var h=s.updateQueue,p=h!==null?h.lastEffect:null;if(p!==null){var x=p.next;h=x;do{if((h.tag&r)===r){var k=h.inst,O=k.destroy;if(O!==void 0){k.destroy=void 0,p=s;var _=c,G=O;try{G()}catch(te){wt(p,_,te)}}}h=h.next}while(h!==x)}}catch(te){wt(s,s.return,te)}}function _v(r){var s=r.updateQueue;if(s!==null){var c=r.stateNode;try{S1(s,c)}catch(h){wt(r,r.return,h)}}}function Lv(r,s,c){c.props=Ls(r.type,r.memoizedProps),c.state=r.memoizedState;try{c.componentWillUnmount()}catch(h){wt(r,s,h)}}function mr(r,s){try{var c=r.ref;if(c!==null){switch(r.tag){case 26:case 27:case 5:var h=r.stateNode;break;case 30:var p=r.stateNode,x=qr(r.memoizedProps,p);(p.ref===null||p.ref.name!==x)&&(p.ref=Fw(x)),h=p.ref;break;case 7:if(r.stateNode===null){var k=new Si(r);g(r.child,!1,A3,k,void 0,void 0),r.stateNode=k}h=r.stateNode;break;default:h=r.stateNode}typeof c=="function"?r.refCleanup=c(h):c.current=h}}catch(O){wt(r,s,O)}}function An(r,s){var c=r.ref,h=r.refCleanup;if(c!==null)if(typeof h=="function")try{h()}catch(p){wt(r,s,p)}finally{r.refCleanup=null,r=r.alternate,r!=null&&(r.refCleanup=null)}else if(typeof c=="function")try{c(null)}catch(p){wt(r,s,p)}else c.current=null}function _f(r,s){if((r.tag===5||r.tag===27||r.tag===6)&&r.alternate===null&&s!==null)for(var c=0;c title"))),En(h,s,c),h[zt]=r,nn(h),s=h;break e;case"link":if(x=lk("link","href",p).get(s+(c.href||""))){for(k=0;k$e&&(k=$e,$e=Ee,Ee=k);var Y=$b(O,Ee),Q=$b(O,$e);if(Y&&Q&&(Z.rangeCount!==1||Z.anchorNode!==Y.node||Z.anchorOffset!==Y.offset||Z.focusNode!==Q.node||Z.focusOffset!==Q.offset)){var W=ue.createRange();W.setStart(Y.node,Y.offset),Z.removeAllRanges(),Ee>$e?(Z.addRange(W),Z.extend(Q.node,Q.offset)):(W.setEnd(Q.node,Q.offset),Z.addRange(W))}}}}for(ue=[],Z=O;Z=Z.parentNode;)Z.nodeType===1&&ue.push({element:Z,left:Z.scrollLeft,top:Z.scrollTop});for(typeof O.focus=="function"&&O.focus(),O=0;Oc?32:c,ve.T=null,c=lg,lg=null;var x=Ki,k=vr;if(Ht=0,Hs=Ki=null,vr=0,(pt&6)!==0)throw Error(i(331));var O=pt;if(pt|=4,rw(x.current),tw(x,x.current,k,c),pt=O,Sc(0,!1),qn&&typeof qn.onPostCommitFiberRoot=="function")try{qn.onPostCommitFiberRoot(xe,x)}catch{}return!0}finally{je.p=p,ve.T=h,bw(r,s)}}function vw(r,s,c){s=ji(c,s),s=Ap(r.stateNode,s,2),r=Al(r,s,2),r!==null&&(cr(r,2),wr(r))}function wt(r,s,c){if(r.tag===3)vw(r,r,c);else for(;s!==null;){if(s.tag===3){vw(s,r,c);break}else if(s.tag===1){var h=s.stateNode;if(typeof s.type.getDerivedStateFromError=="function"||typeof h.componentDidCatch=="function"&&(zl===null||!zl.has(h))){r=ji(c,r),c=gv(2),h=Al(s,c,2),h!==null&&(xv(c,h,s,r),cr(h,2),wr(h));break}}s=s.return}}function hg(r,s,c){var h=r.pingCache;if(h===null){h=r.pingCache=new F5;var p=new Set;h.set(s,p)}else p=h.get(s),p===void 0&&(p=new Set,h.set(s,p));p.has(c)||(ng=!0,p.add(c),r=K5.bind(null,r,s,c),s.then(r,r))}function K5(r,s,c){var h=r.pingCache;h!==null&&h.delete(s),r.pingedLanes|=r.suspendedLanes&c,r.warmLanes&=~c,Tt===r&&(lt&c)===c&&((Xt===4||Xt===3&&(lt&62914560)===lt&&300>tn()-Vf)&&(pt&2)===0?qo(r,0):qf|=c,Po===lt&&(Po=0)),wr(r)}function ww(r,s){s===0&&(s=zu()),r=Ss(r,s),r!==null&&(cr(r,s),wr(r))}function W5(r){var s=r.memoizedState,c=0;s!==null&&(c=s.retryLane),ww(r,c)}function Z5(r,s){var c=0;switch(r.tag){case 31:case 13:var h=r.stateNode,p=r.memoizedState;p!==null&&(c=p.retryLane);break;case 19:h=r.stateNode;break;case 22:h=r.stateNode._retryCache;break;default:throw Error(i(314))}h!==null&&h.delete(s),ww(r,c)}function J5(r,s){return mn(r,s)}var Qo=null,Xo=null,dg=!1,Zf=!1,mg=!1,Pl=0;function wr(r){r!==Xo&&r.next===null&&(Xo===null?Qo=Xo=r:Xo=Xo.next=r),Zf=!0,dg||(dg=!0,t3())}function Sc(r,s){if(!mg&&Zf){mg=!0;do for(var c=!1,h=Qo;h!==null;){if(r!==0){var p=h.pendingLanes;if(p===0)var x=0;else{var k=h.suspendedLanes,O=h.pingedLanes;x=(1<<31-Lt(42|r)+1)-1,x&=p&~(k&~O),x=x&201326741?x&201326741|1:x?x|2:0}x!==0&&(c=!0,Ow(h,x))}else x=lt,x=fo(h,h===Tt?x:0,h.cancelPendingCommit!==null||h.timeoutHandle!==-1),(x&3)===0||dl(h,x)||(c=!0,Ow(h,x));h=h.next}while(c);mg=!1}}function e3(){kw()}function kw(){Zf=dg=!1;var r=0;Pl!==0&&h3()&&(r=Pl);for(var s=tn(),c=null,h=Qo;h!==null;){var p=h.next,x=Sw(h,s);x===0?(h.next=null,c===null?Qo=p:c.next=p,p===null&&(Xo=c)):(c=h,(r!==0||(x&3)!==0)&&(Zf=!0)),h=p}Ht!==0&&Ht!==5||Sc(r),Pl!==0&&(Pl=0)}function Sw(r,s){for(var c=r.suspendedLanes,h=r.pingedLanes,p=r.expirationTimes,x=r.pendingLanes&-62914561;0O)break;var te=_.transferSize,ue=_.initiatorType;te&&jw(ue)&&(_=_.responseEnd,k+=te*(_ih){Ee.length=ye;break}W=new Promise(y3.bind(W)),Ee.push(W)}}}if(0"u"?null:document;function tk(r,s,c){var h=Yo;if(h&&typeof s=="string"&&s){var p=H(s);p='link[rel="'+r+'"][href="'+p+'"]',typeof c=="string"&&(p+='[crossorigin="'+c+'"]'),ek.has(p)||(ek.add(p),r={rel:r,crossOrigin:c,href:s},h.querySelector(p)===null&&(s=h.createElement("link"),En(s,"link",r),nn(s),h.head.appendChild(s)))}}function B3(r){el.D(r),tk("dns-prefetch",r,null)}function P3(r,s){el.C(r,s),tk("preconnect",r,s)}function H3(r,s,c){el.L(r,s,c);var h=Yo;if(h&&r&&s){var p='link[rel="preload"][as="'+H(s)+'"]';s==="image"&&c&&c.imageSrcSet?(p+='[imagesrcset="'+H(c.imageSrcSet)+'"]',typeof c.imageSizes=="string"&&(p+='[imagesizes="'+H(c.imageSizes)+'"]')):p+='[href="'+H(r)+'"]';var x=p;switch(s){case"style":x=Go(r);break;case"script":x=Ko(r)}if(!(Pi.has(x)||(r=T({rel:"preload",href:s==="image"&&c&&c.imageSrcSet?void 0:r,as:s},c),Pi.set(x,r),h.querySelector(p)!==null||s==="style"&&h.querySelector(Ac(x))||s==="script"&&h.querySelector(Ec(x))))){var k=h.createElement("link");En(k,"link",r),s==="style"&&(k[mo]=!0,k.onload=k.onerror=function(){Iu(k)}),nn(k),h.head.appendChild(k)}}}function I3(r,s){el.m(r,s);var c=Yo;if(c&&r){var h=s&&typeof s.as=="string"?s.as:"script",p='link[rel="modulepreload"][as="'+H(h)+'"][href="'+H(r)+'"]',x=p;switch(h){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":x=Ko(r)}if(!Pi.has(x)&&(r=T({rel:"modulepreload",href:r},s),Pi.set(x,r),c.querySelector(p)===null)){switch(h){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(c.querySelector(Ec(x)))return}h=c.createElement("link"),En(h,"link",r),nn(h),c.head.appendChild(h)}}}function U3(r,s,c){el.S(r,s,c);var h=Yo;if(h&&r){var p=xl(h).hoistableStyles,x=Go(r);s=s||"default";var k=p.get(x);if(!k){var O={loading:0,preload:null};if(k=h.querySelector(Ac(x)))O.loading=5;else{r=T({rel:"stylesheet",href:r,"data-precedence":s},c),(c=Pi.get(x))&&Lg(r,c);var _=k=h.createElement("link");nn(_),En(_,"link",r),_._p=new Promise(function(G,te){_.onload=G,_.onerror=te}),_.addEventListener("load",function(){O.loading|=1}),_.addEventListener("error",function(){O.loading|=2}),O.loading|=4,th(k,s,h)}k={type:"stylesheet",instance:k,count:1,state:O},p.set(x,k)}}}function F3(r,s){el.X(r,s);var c=Yo;if(c&&r){var h=xl(c).hoistableScripts,p=Ko(r),x=h.get(p);x||(x=c.querySelector(Ec(p)),x||(r=T({src:r,async:!0},s),(s=Pi.get(p))&&zg(r,s),x=c.createElement("script"),nn(x),En(x,"link",r),c.head.appendChild(x)),x={type:"script",instance:x,count:1,state:null},h.set(p,x))}}function q3(r,s){el.M(r,s);var c=Yo;if(c&&r){var h=xl(c).hoistableScripts,p=Ko(r),x=h.get(p);x||(x=c.querySelector(Ec(p)),x||(r=T({src:r,async:!0,type:"module"},s),(s=Pi.get(p))&&zg(r,s),x=c.createElement("script"),nn(x),En(x,"link",r),c.head.appendChild(x)),x={type:"script",instance:x,count:1,state:null},h.set(p,x))}}function nk(r,s,c,h){var p=(p=Ft.current)?Tc(p):null;if(!p)throw Error(i(446));switch(r){case"meta":case"title":return null;case"style":return typeof c.precedence=="string"&&typeof c.href=="string"?(c=Go(c.href),s=xl(p).hoistableStyles,h=s.get(c),h||(h={type:"style",instance:null,count:0,state:null},s.set(c,h)),h):{type:"void",instance:null,count:0,state:null};case"link":if(c.rel==="stylesheet"&&typeof c.href=="string"&&typeof c.precedence=="string"){r=Go(c.href);var x=xl(p).hoistableStyles,k=x.get(r);if(k||(p=p.ownerDocument||p,k={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},x.set(r,k),(x=p.querySelector(Ac(r)))?x._p||(k.instance=x,k.state.loading=5):(x=Pi.get(r),x||(x={rel:"preload",as:"style",href:c.href,crossOrigin:c.crossOrigin,integrity:c.integrity,media:c.media,hrefLang:c.hrefLang,referrerPolicy:c.referrerPolicy},Pi.set(r,x)),V3(p,r,x,k.state))),s&&h===null)throw Error(i(528,""));return k}if(s&&h!==null)throw Error(i(529,""));return null;case"script":return s=c.async,c=c.src,typeof c=="string"&&s&&typeof s!="function"&&typeof s!="symbol"?(c=Ko(c),s=xl(p).hoistableScripts,h=s.get(c),h||(h={type:"script",instance:null,count:0,state:null},s.set(c,h)),h):{type:"void",instance:null,count:0,state:null};default:throw Error(i(444,r))}}function Go(r){return'href="'+H(r)+'"'}function Ac(r){return'link[rel="stylesheet"]['+r+"]"}function ik(r){return T({},r,{"data-precedence":r.precedence,precedence:null})}function V3(r,s,c,h){if(s=r.querySelector('link[rel="preload"][as="style"]['+s+"]")){if(s[mo]!==!0){h.loading=1;return}}else s=r.createElement("link"),s[mo]=!0,s.onload=s.onerror=Iu.bind(null,s),En(s,"link",c),nn(s),r.head.appendChild(s);h.preload=s,s.addEventListener("load",function(){return h.loading|=1}),s.addEventListener("error",function(){return h.loading|=2})}function Ko(r){return'[src="'+H(r)+'"]'}function Ec(r){return"script[async]"+r}function rk(r,s,c){if(s.count++,s.instance===null)switch(s.type){case"style":var h=r.querySelector('style[data-href~="'+H(c.href)+'"]');if(h)return s.instance=h,nn(h),h;var p=T({},c,{"data-href":c.href,"data-precedence":c.precedence,href:null,precedence:null});return h=(r.ownerDocument||r).createElement("style"),nn(h),En(h,"style",p),th(h,c.precedence,r),s.instance=h;case"stylesheet":p=Go(c.href);var x=r.querySelector(Ac(p));if(x)return s.state.loading|=4,s.instance=x,nn(x),x;h=ik(c),(p=Pi.get(p))&&Lg(h,p),x=(r.ownerDocument||r).createElement("link"),nn(x);var k=x;return k._p=new Promise(function(O,_){k.onload=O,k.onerror=_}),En(x,"link",h),s.state.loading|=4,th(x,c.precedence,r),s.instance=x;case"script":return x=Ko(c.src),(p=r.querySelector(Ec(x)))?(s.instance=p,nn(p),p):(h=c,(p=Pi.get(x))&&(h=T({},c),zg(h,p)),r=r.ownerDocument||r,p=r.createElement("script"),nn(p),En(p,"link",h),r.head.appendChild(p),s.instance=p);case"void":return null;default:throw Error(i(443,s.type))}else s.type==="stylesheet"&&(s.state.loading&4)===0&&(h=s.instance,s.state.loading|=4,th(h,c.precedence,r));return s.instance}function th(r,s,c){for(var h=c.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),p=h.length?h[h.length-1]:null,x=p,k=0;k title"):null)}function Q3(r,s,c){if(c===1||s.itemProp!=null)return!1;switch(r){case"meta":case"title":return!0;case"style":if(typeof s.precedence!="string"||typeof s.href!="string"||s.href==="")break;return!0;case"link":if(typeof s.rel!="string"||typeof s.href!="string"||s.href===""||s.onLoad||s.onError)break;switch(s.rel){case"stylesheet":return r=s.disabled,typeof s.precedence=="string"&&r==null;default:return!0}case"script":if(s.async&&typeof s.async!="function"&&typeof s.async!="symbol"&&!s.onLoad&&!s.onError&&s.src&&typeof s.src=="string")return!0}return!1}function sk(r,s){return r==="img"&&s.src!=null&&s.src!==""&&s.onLoad==null&&s.loading!=="lazy"}function ok(r){return!(r.type==="stylesheet"&&(r.state.loading&3)===0)}function ak(r){return(r.width||100)*(r.height||100)*(typeof devicePixelRatio=="number"?devicePixelRatio:1)*.25}function ck(r,s){typeof s.decode=="function"&&(r.imgCount++,s.complete||(r.imgBytes+=ak(s),r.suspenseyImages.push(s)),r=Y3.bind(r),s.decode().then(r,r))}function X3(r,s,c,h){if(c.type==="stylesheet"&&(typeof h.media!="string"||matchMedia(h.media).matches!==!1)&&(c.state.loading&4)===0){if(c.instance===null){var p=Go(h.href),x=s.querySelector(Ac(p));if(x){s=x._p,s!==null&&typeof s=="object"&&typeof s.then=="function"&&(r.count++,r=Mc.bind(r),s.then(r,r)),c.state.loading|=4,c.instance=x,nn(x);return}x=s.ownerDocument||s,h=ik(h),(p=Pi.get(p))&&Lg(h,p),x=x.createElement("link"),nn(x);var k=x;k._p=new Promise(function(O,_){k.onload=O,k.onerror=_}),En(x,"link",h),c.instance=x}r.stylesheets===null&&(r.stylesheets=new Map),r.stylesheets.set(c,s),(s=c.state.preload)&&(c.state.loading&3)===0&&(r.count++,c=Mc.bind(r),s.addEventListener("load",c),s.addEventListener("error",c))}}var ih=0;function $3(r,s){return r.stylesheets&&r.count===0&&lh(r,r.stylesheets),0ih?50:800)+s);return r.unsuspend=c,function(){r.unsuspend=null,clearTimeout(h),clearTimeout(p)}}:null}function uk(r){if(r.count===0&&(r.imgCount===0||!r.waitingForImages)){if(r.stylesheets)lh(r,r.stylesheets);else if(r.unsuspend){var s=r.unsuspend;r.unsuspend=null,s()}}}function Mc(){this.count--,uk(this)}function Y3(){this.imgCount--,uk(this)}var rh=null;function lh(r,s){r.stylesheets=null,r.unsuspend!==null&&(r.count++,rh=new Map,s.forEach(G3,r),rh=null,Mc.call(r))}function G3(r,s){if(!(s.state.loading&4)){var c=rh.get(r);if(c)var h=c.get(null);else{c=new Map,rh.set(r,c);for(var p=r.querySelectorAll("link[data-precedence],style[data-precedence]"),x=0;x"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}return n(),Xg.exports=dM(),Xg.exports}var pM=mM();const gM=my(pM);class $C extends Error{constructor(t,i,l){super(t);hh(this,"status");hh(this,"detail");this.name="ApiError",this.status=i,this.detail=l}}async function us(n,e){let t=e,i;try{const l=await n.json();typeof(l==null?void 0:l.detail)=="string"&&l.detail?(t=l.detail,i=l.detail):Array.isArray(l==null?void 0:l.detail)&&(i=l.detail)}catch{}return new $C(t,n.status,i)}async function xM(n){const e=await fetch(`/api/notifications?after=${n}`);if(!e.ok)throw new Error("Failed to fetch notifications");return e.json()}async function yM(){const n=await fetch("/api/actions/open-log",{method:"POST"});if(!n.ok)throw new Error("Failed to open log file");return n.json()}async function bM(n){const e=new URLSearchParams;e.set("limit",String(n.limit)),n!=null&&n.level&&e.set("level",n.level),n!=null&&n.search&&e.set("search",n.search);const t=await fetch(`/api/logs?${e.toString()}`);if(!t.ok)throw new Error("Failed to fetch log entries");return t.json()}async function Yh(){const n=await fetch("/api/system");if(!n.ok)throw new Error("Failed to fetch system info");return n.json()}async function vM(n){const e=await fetch("/api/system/bind",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({lan:n})});if(!e.ok){let t="Failed to update LAN binding";try{const i=await e.json();i!=null&&i.detail&&(t=i.detail)}catch{}throw new Error(t)}return e.json()}async function wM(n,e=1e4){const t=Date.now()+e;let i=null;for(;Date.now()setTimeout(l,500))}return i}async function _k(){const n=await fetch("/api/config");if(!n.ok)throw new Error("Failed to fetch app configuration");return n.json()}async function Lk(n){const e=await fetch("/api/config/select-directory",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({directory:n})});if(!e.ok)throw new Error("Failed to select directory");return e.json()}async function kM(n){const e=await fetch("/api/config/load",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({config_path:n})});if(!e.ok)throw new Error("Failed to load config file");return e.json()}async function YC(n,e){const t=await fetch("/api/config/load-content",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({filename:n,content:e})});if(!t.ok){let i=`Failed to apply dropped config (${n})`;try{const l=await t.json();l!=null&&l.detail&&(i=l.detail)}catch{}throw new Error(i)}return t.json()}async function SM(){const n=await fetch("/api/config/reload",{method:"POST"});if(!n.ok){let e="Failed to reload configuration";try{const t=await n.json();t!=null&&t.detail&&(e=t.detail)}catch{}throw new Error(e)}return n.json()}async function CM(n){const e=await fetch("/api/config/create",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({directory:n})});if(!e.ok)throw new Error("Failed to create config file");return e.json()}async function zk(){const n=await fetch("/api/config/content");if(!n.ok)throw await us(n,"Failed to fetch config content");return n.json()}async function Bk(n,e){const t=await fetch("/api/config/validate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({filename:n,content:e})});if(!t.ok)throw await us(t,"Failed to validate config content");return t.json()}async function OM(){const n=await fetch("/api/config/template",{method:"POST"});if(!n.ok)throw await us(n,"Failed to fetch config template");return n.json()}async function NM(n,e){const t=await fetch("/api/config/save",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:n,force:e})});if(!t.ok)throw await us(t,"Failed to save configuration");return(await t.json()).config}async function TM(n){const e=await fetch("/api/config/save-as",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)});if(!e.ok)throw await us(e,"Failed to save configuration as");return(await e.json()).config}async function AM(n){const e=`/api/fs/browse?path=${encodeURIComponent(n)}&include_hidden=true`,t=await fetch(e);if(!t.ok)throw new Error("Failed to browse config files");return t.json()}async function GC(n){const e=`/api/fs/browse?path=${encodeURIComponent(n)}`,t=await fetch(e);if(!t.ok)throw new Error("Failed to browse directory");return t.json()}async function Pk(n,e){const t=await fetch("/api/scan",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n),signal:e});if(!t.ok)throw new Error("Failed to execute scan");return t.json()}async function Kg(n){const e=new URLSearchParams;(n==null?void 0:n.offset)!=null&&e.set("offset",String(n.offset)),(n==null?void 0:n.limit)!=null&&e.set("limit",String(n.limit)),n!=null&&n.sort_by&&e.set("sort_by",n.sort_by),n!=null&&n.sort_dir&&e.set("sort_dir",n.sort_dir);const t=e.toString(),i=`/api/scan/results${t?`?${t}`:""}`,l=await fetch(i,{signal:n==null?void 0:n.signal});if(!l.ok)throw new Error("Failed to fetch scan results");return l.json()}async function EM(n){const e=await fetch("/api/actions/launch",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)});if(!e.ok)throw new Error("Failed to launch file");return e.json()}async function KC(n){const e=await fetch("/api/actions/reveal",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({file_path:n})});if(!e.ok)throw new Error("Failed to reveal file");return e.json()}async function Y0(n){const e=await fetch("/api/actions/open-folder",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({file_path:n})});if(!e.ok)throw new Error("Failed to open folder");return e.json()}async function Hk(n){const e=await fetch("/api/actions/open-terminal",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({file_path:n})});if(!e.ok)throw new Error("Failed to open terminal");return e.json()}async function Ik(n,e){const t=await fetch("/api/actions/hash",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({file_path:n,algorithm:e})});if(!t.ok)throw new Error("Failed to compute hash");return t.json()}async function MM(){const n=await fetch("/api/actions/open-config",{method:"POST"});if(!n.ok)throw new Error("Failed to open config file");return n.json()}async function Uk(n){const e={file_path:n.file_path||n.filePath,content:n.content},t=await fetch("/api/actions/barcode",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!t.ok)throw new Error("Failed to generate barcode");return t.json()}async function DM(n){const e=await fetch("/api/actions/barcode/decode",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({image_base64:n.imageBase64,formats:n.formats})});if(!e.ok)throw e.status===503?new Error("Server-side barcode decoding is unavailable"):new Error(`Failed to decode frame (HTTP ${e.status})`);return e.json()}async function jM(n,e){const t=await fetch("/api/actions/metadata",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({file_path:n}),signal:e});if(!t.ok)throw new Error("Failed to fetch metadata");return t.json()}async function RM(n,e){const t=await fetch("/api/actions/export-csv",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:n,filename:e})});if(!t.ok)throw new Error("Failed to export CSV");return t.json()}async function _M(n,e){const t=await fetch("/api/actions/save-image",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({image_base64:n,filename:e})});if(!t.ok)throw new Error("Failed to save image");return t.json()}async function LM(n){const e=await fetch("/api/workflow/start",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)});if(!e.ok)throw await us(e,"Failed to start workflow session");return e.json()}async function zM(n,e){const t=await fetch(`/api/workflow/${n}/respond`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:e})});if(!t.ok)throw await us(t,"Failed to respond to workflow prompt");return t.json()}async function BM(n){const e=await fetch(`/api/workflow/${n}/abort`,{method:"POST"});if(!e.ok)throw await us(e,"Failed to abort workflow session");return e.json()}const PM=[".profiles",".profiles.yaml",".profiles.yml",".yaml",".yml"];function HM(n){const e=n.toLowerCase();return PM.some(t=>e.endsWith(t))}function IM(n){for(const e of n)if(HM(e.name))return e;return null}function Gh(){return{depth:0,overlayVisible:!1}}function Fk(n,e,t){switch(e){case"enter":return t?{depth:n.depth+1,overlayVisible:!0}:n;case"leave":{const i=Math.max(0,n.depth-1);return{depth:i,overlayVisible:n.depth>0&&i>0}}case"drop":return Gh()}}function qk(n){return n==="light"?"light":"dark"}/** + * @license lucide-react v0.477.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const UM=n=>n.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),WC=(...n)=>n.filter((e,t,i)=>!!e&&e.trim()!==""&&i.indexOf(e)===t).join(" ").trim();/** + * @license lucide-react v0.477.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */var FM={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"};/** + * @license lucide-react v0.477.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const qM=D.forwardRef(({color:n="currentColor",size:e=24,strokeWidth:t=2,absoluteStrokeWidth:i,className:l="",children:o,iconNode:a,...u},f)=>D.createElement("svg",{ref:f,...FM,width:e,height:e,stroke:n,strokeWidth:i?Number(t)*24/Number(e):t,className:WC("lucide",l),...u},[...a.map(([d,m])=>D.createElement(d,m)),...Array.isArray(o)?o:[o]]));/** + * @license lucide-react v0.477.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Me=(n,e)=>{const t=D.forwardRef(({className:i,...l},o)=>D.createElement(qM,{ref:o,iconNode:e,className:WC(`lucide-${UM(n)}`,i),...l}));return t.displayName=`${n}`,t};/** + * @license lucide-react v0.477.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const VM=[["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"}]],QM=Me("Activity",VM);/** + * @license lucide-react v0.477.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const XM=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],ZC=Me("ArrowDown",XM);/** + * @license lucide-react v0.477.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const $M=[["path",{d:"M8 3 4 7l4 4",key:"9rb6wj"}],["path",{d:"M4 7h16",key:"6tx8e3"}],["path",{d:"m16 21 4-4-4-4",key:"siv7j2"}],["path",{d:"M20 17H4",key:"h6l3hr"}]],YM=Me("ArrowLeftRight",$M);/** + * @license lucide-react v0.477.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const GM=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],KM=Me("ArrowRight",GM);/** + * @license lucide-react v0.477.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const WM=[["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"}]],Vk=Me("ArrowUpDown",WM);/** + * @license lucide-react v0.477.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const ZM=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],JM=Me("ArrowUp",ZM);/** + * @license lucide-react v0.477.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const e4=[["path",{d:"m8 2 1.88 1.88",key:"fmnt4t"}],["path",{d:"M14.12 3.88 16 2",key:"qol33r"}],["path",{d:"M9 7.13v-1a3.003 3.003 0 1 1 6 0v1",key:"d7y7pr"}],["path",{d:"M12 20c-3.3 0-6-2.7-6-6v-3a4 4 0 0 1 4-4h4a4 4 0 0 1 4 4v3c0 3.3-2.7 6-6 6",key:"xs1cw7"}],["path",{d:"M12 20v-9",key:"1qisl0"}],["path",{d:"M6.53 9C4.6 8.8 3 7.1 3 5",key:"32zzws"}],["path",{d:"M6 13H2",key:"82j7cp"}],["path",{d:"M3 21c0-2.1 1.7-3.9 3.8-4",key:"4p0ekp"}],["path",{d:"M20.97 5c0 2.1-1.6 3.8-3.5 4",key:"18gb23"}],["path",{d:"M22 13h-4",key:"1jl80f"}],["path",{d:"M17.2 17c2.1.1 3.8 1.9 3.8 4",key:"k3fwyw"}]],t4=Me("Bug",e4);/** + * @license lucide-react v0.477.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const n4=[["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"}]],i4=Me("Calendar",n4);/** + * @license lucide-react v0.477.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const r4=[["path",{d:"M14.5 4h-5L7 7H4a2 2 0 0 0-2 2v9a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2h-3l-2.5-3z",key:"1tc9qg"}],["circle",{cx:"12",cy:"13",r:"3",key:"1vg3eu"}]],JC=Me("Camera",r4);/** + * @license lucide-react v0.477.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const l4=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],_r=Me("Check",l4);/** + * @license lucide-react v0.477.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const s4=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],o4=Me("ChevronDown",s4);/** + * @license lucide-react v0.477.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const a4=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],Qd=Me("ChevronRight",a4);/** + * @license lucide-react v0.477.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const c4=[["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"}]],Gc=Me("CircleAlert",c4);/** + * @license lucide-react v0.477.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const u4=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],Qk=Me("CircleCheck",u4);/** + * @license lucide-react v0.477.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const f4=[["path",{d:"M10.1 2.182a10 10 0 0 1 3.8 0",key:"5ilxe3"}],["path",{d:"M13.9 21.818a10 10 0 0 1-3.8 0",key:"11zvb9"}],["path",{d:"M17.609 3.721a10 10 0 0 1 2.69 2.7",key:"1iw5b2"}],["path",{d:"M2.182 13.9a10 10 0 0 1 0-3.8",key:"c0bmvh"}],["path",{d:"M20.279 17.609a10 10 0 0 1-2.7 2.69",key:"1ruxm7"}],["path",{d:"M21.818 10.1a10 10 0 0 1 0 3.8",key:"qkgqxc"}],["path",{d:"M3.721 6.391a10 10 0 0 1 2.7-2.69",key:"1mcia2"}],["path",{d:"M6.391 20.279a10 10 0 0 1-2.69-2.7",key:"1fvljs"}]],h4=Me("CircleDashed",f4);/** + * @license lucide-react v0.477.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const d4=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}]],m4=Me("CircleDot",d4);/** + * @license lucide-react v0.477.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const p4=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"10",x2:"10",y1:"15",y2:"9",key:"c1nkhi"}],["line",{x1:"14",x2:"14",y1:"15",y2:"9",key:"h65svq"}]],g4=Me("CirclePause",p4);/** + * @license lucide-react v0.477.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const x4=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polygon",{points:"10 8 16 12 10 16 10 8",key:"1cimsy"}]],y4=Me("CirclePlay",x4);/** + * @license lucide-react v0.477.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const b4=[["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"}]],ou=Me("CircleX",b4);/** + * @license lucide-react v0.477.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const v4=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]],w4=Me("Clock",v4);/** + * @license lucide-react v0.477.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const k4=[["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"}]],ci=Me("Copy",k4);/** + * @license lucide-react v0.477.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const S4=[["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"}]],eO=Me("Download",S4);/** + * @license lucide-react v0.477.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const C4=[["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"}]],tO=Me("ExternalLink",C4);/** + * @license lucide-react v0.477.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const O4=[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]],N4=Me("EyeOff",O4);/** + * @license lucide-react v0.477.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const T4=[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],G0=Me("Eye",T4);/** + * @license lucide-react v0.477.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const A4=[["polygon",{points:"13 19 22 12 13 5 13 19",key:"587y9g"}],["polygon",{points:"2 19 11 12 2 5 2 19",key:"3pweh0"}]],E4=Me("FastForward",A4);/** + * @license lucide-react v0.477.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const M4=[["path",{d:"M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4",key:"1pf5j1"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"m5 12-3 3 3 3",key:"oke12k"}],["path",{d:"m9 18 3-3-3-3",key:"112psh"}]],D4=Me("FileCode2",M4);/** + * @license lucide-react v0.477.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const j4=[["path",{d:"M10 12.5 8 15l2 2.5",key:"1tg20x"}],["path",{d:"m14 12.5 2 2.5-2 2.5",key:"yinavb"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7z",key:"1mlx9k"}]],K0=Me("FileCode",j4);/** + * @license lucide-react v0.477.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const R4=[["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"m3.2 12.9-.9-.4",key:"1i3dj5"}],["path",{d:"m3.2 15.1-.9.4",key:"1fvgj0"}],["path",{d:"M4.677 21.5a2 2 0 0 0 1.313.5H18a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v2.5",key:"1yo3oz"}],["path",{d:"m4.9 11.2-.4-.9",key:"otmhb9"}],["path",{d:"m4.9 16.8-.4.9",key:"1b8z07"}],["path",{d:"m7.5 10.3-.4.9",key:"11k65u"}],["path",{d:"m7.5 17.7-.4-.9",key:"431x55"}],["path",{d:"m9.7 12.5-.9.4",key:"87sjan"}],["path",{d:"m9.7 15.5-.9-.4",key:"khqm91"}],["circle",{cx:"6",cy:"14",r:"3",key:"a1xfv6"}]],sa=Me("FileCog",R4);/** + * @license lucide-react v0.477.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const _4=[["path",{d:"M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4",key:"1pf5j1"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M3 15h6",key:"4e2qda"}],["path",{d:"M6 12v6",key:"1u72j0"}]],L4=Me("FilePlus2",_4);/** + * @license lucide-react v0.477.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const z4=[["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"}]],ka=Me("FileText",z4);/** + * @license lucide-react v0.477.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const B4=[["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"}]],Wg=Me("File",B4);/** + * @license lucide-react v0.477.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const P4=[["path",{d:"M14 2v6a2 2 0 0 0 .245.96l5.51 10.08A2 2 0 0 1 18 22H6a2 2 0 0 1-1.755-2.96l5.51-10.08A2 2 0 0 0 10 8V2",key:"18mbvz"}],["path",{d:"M6.453 15h11.094",key:"3shlmq"}],["path",{d:"M8.5 2h7",key:"csnxdl"}]],H4=Me("FlaskConical",P4);/** + * @license lucide-react v0.477.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const I4=[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]],Jl=Me("FolderOpen",I4);/** + * @license lucide-react v0.477.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const U4=[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]],Ou=Me("Folder",U4);/** + * @license lucide-react v0.477.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const F4=[["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"}]],q4=Me("Globe",F4);/** + * @license lucide-react v0.477.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const V4=[["line",{x1:"4",x2:"20",y1:"9",y2:"9",key:"4lhtct"}],["line",{x1:"4",x2:"20",y1:"15",y2:"15",key:"vyu0kd"}],["line",{x1:"10",x2:"8",y1:"3",y2:"21",key:"1ggp8o"}],["line",{x1:"16",x2:"14",y1:"3",y2:"21",key:"weycgp"}]],oa=Me("Hash",V4);/** + * @license lucide-react v0.477.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Q4=[["path",{d:"M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8",key:"5wwlr5"}],["path",{d:"M3 10a2 2 0 0 1 .709-1.528l7-5.999a2 2 0 0 1 2.582 0l7 5.999A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"1d0kgt"}]],Xd=Me("House",Q4);/** + * @license lucide-react v0.477.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const X4=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],gy=Me("Info",X4);/** + * @license lucide-react v0.477.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const $4=[["path",{d:"M10 8h.01",key:"1r9ogq"}],["path",{d:"M12 12h.01",key:"1mp3jc"}],["path",{d:"M14 8h.01",key:"1primd"}],["path",{d:"M16 12h.01",key:"1l6xoz"}],["path",{d:"M18 8h.01",key:"emo2bl"}],["path",{d:"M6 8h.01",key:"x9i8wu"}],["path",{d:"M7 16h10",key:"wp8him"}],["path",{d:"M8 12h.01",key:"czm47f"}],["rect",{width:"20",height:"16",x:"2",y:"4",rx:"2",key:"18n3k1"}]],nO=Me("Keyboard",$4);/** + * @license lucide-react v0.477.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Y4=[["path",{d:"M9 17H7A5 5 0 0 1 7 7h2",key:"8i5ue5"}],["path",{d:"M15 7h2a5 5 0 1 1 0 10h-2",key:"1b9ql8"}],["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}]],G4=Me("Link2",Y4);/** + * @license lucide-react v0.477.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const K4=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],ll=Me("LoaderCircle",K4);/** + * @license lucide-react v0.477.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const W4=[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]],Z4=Me("Lock",W4);/** + * @license lucide-react v0.477.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const J4=[["path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z",key:"a7tn18"}]],eD=Me("Moon",J4);/** + * @license lucide-react v0.477.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const tD=[["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"}]],nD=Me("Network",tD);/** + * @license lucide-react v0.477.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const iD=[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]],ts=Me("Play",iD);/** + * @license lucide-react v0.477.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const rD=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],lD=Me("Plus",rD);/** + * @license lucide-react v0.477.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const sD=[["rect",{width:"5",height:"5",x:"3",y:"3",rx:"1",key:"1tu5fj"}],["rect",{width:"5",height:"5",x:"16",y:"3",rx:"1",key:"1v8r4q"}],["rect",{width:"5",height:"5",x:"3",y:"16",rx:"1",key:"1x03jg"}],["path",{d:"M21 16h-3a2 2 0 0 0-2 2v3",key:"177gqh"}],["path",{d:"M21 21v.01",key:"ents32"}],["path",{d:"M12 7v3a2 2 0 0 1-2 2H7",key:"8crl2c"}],["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M12 3h.01",key:"n36tog"}],["path",{d:"M12 16v.01",key:"133mhm"}],["path",{d:"M16 12h1",key:"1slzba"}],["path",{d:"M21 12v.01",key:"1lwtk9"}],["path",{d:"M12 21v-1",key:"1880an"}]],xy=Me("QrCode",sD);/** + * @license lucide-react v0.477.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const oD=[["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"}]],$d=Me("RefreshCw",oD);/** + * @license lucide-react v0.477.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const aD=[["path",{d:"M4.5 16.5c-1.5 1.26-2 5-2 5s3.74-.5 5-2c.71-.84.7-2.13-.09-2.91a2.18 2.18 0 0 0-2.91-.09z",key:"m3kijz"}],["path",{d:"m12 15-3-3a22 22 0 0 1 2-3.95A12.88 12.88 0 0 1 22 2c0 2.72-.78 7.5-6 11a22.35 22.35 0 0 1-4 2z",key:"1fmvmk"}],["path",{d:"M9 12H4s.55-3.03 2-4c1.62-1.08 5 0 5 0",key:"1f8sc4"}],["path",{d:"M12 15v5s3.03-.55 4-2c1.08-1.62 0-5 0-5",key:"qeys4"}]],cD=Me("Rocket",aD);/** + * @license lucide-react v0.477.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const uD=[["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"}]],fD=Me("RotateCcw",uD);/** + * @license lucide-react v0.477.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const hD=[["path",{d:"M10 2v3a1 1 0 0 0 1 1h5",key:"1xspal"}],["path",{d:"M18 18v-6a1 1 0 0 0-1-1h-6a1 1 0 0 0-1 1v6",key:"1ra60u"}],["path",{d:"M18 22H4a2 2 0 0 1-2-2V6",key:"pblm9e"}],["path",{d:"M8 18a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9.172a2 2 0 0 1 1.414.586l2.828 2.828A2 2 0 0 1 22 6.828V16a2 2 0 0 1-2.01 2z",key:"1yve0x"}]],dD=Me("SaveAll",hD);/** + * @license lucide-react v0.477.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const mD=[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]],iO=Me("Save",mD);/** + * @license lucide-react v0.477.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const pD=[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]],rO=Me("Search",pD);/** + * @license lucide-react v0.477.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const gD=[["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"}]],xD=Me("Settings",gD);/** + * @license lucide-react v0.477.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const yD=[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]],bD=Me("Sun",yD);/** + * @license lucide-react v0.477.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const vD=[["polyline",{points:"4 17 10 11 4 5",key:"akl6gq"}],["line",{x1:"12",x2:"20",y1:"19",y2:"19",key:"q2wloq"}]],W0=Me("Terminal",vD);/** + * @license lucide-react v0.477.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const wD=[["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"}]],lO=Me("Timer",wD);/** + * @license lucide-react v0.477.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const kD=[["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"}]],sO=Me("Trash2",kD);/** + * @license lucide-react v0.477.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const SD=[["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"}]],yy=Me("TriangleAlert",SD);/** + * @license lucide-react v0.477.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const CD=[["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"}]],OD=Me("User",CD);/** + * @license lucide-react v0.477.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const ND=[["path",{d:"M18 16.98h-5.99c-1.1 0-1.95.94-2.48 1.9A4 4 0 0 1 2 17c.01-.7.2-1.4.57-2",key:"q3hayz"}],["path",{d:"m6 17 3.13-5.78c.53-.97.1-2.18-.5-3.1a4 4 0 1 1 6.89-4.06",key:"1go1hn"}],["path",{d:"m12 6 3.13 5.73C15.66 12.7 16.9 13 18 13a4 4 0 0 1 0 8",key:"qlwsc0"}]],oO=Me("Webhook",ND);/** + * @license lucide-react v0.477.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const TD=[["rect",{width:"8",height:"8",x:"3",y:"3",rx:"2",key:"by2w9f"}],["path",{d:"M7 11v4a2 2 0 0 0 2 2h4",key:"xkn7yn"}],["rect",{width:"8",height:"8",x:"13",y:"13",rx:"2",key:"1cgmvn"}]],AD=Me("Workflow",TD);/** + * @license lucide-react v0.477.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const ED=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Ei=Me("X",ED);function MD(n){if(n<60)return`${n}s`;const e=Math.floor(n/60),t=n%60;return`${e}m${t.toString().padStart(2,"0")}s`}function DD(n){if(!n)return{label:"",cut:!1};const e=n.replace(/\\/g,"/").split("/").filter(Boolean);return e.length===0?{label:n,cut:!1}:{label:e[e.length-1],cut:e.length>1}}function jD({directory:n}){const[e,t]=D.useState(0);D.useEffect(()=>{t(0);const o=window.setInterval(()=>{t(a=>a+1)},1e3);return()=>window.clearInterval(o)},[]);const{label:i,cut:l}=DD(n);return y.jsxs("div",{"data-testid":"scan-status-strip",className:"flex min-w-0 items-center gap-1.5 text-[11px] text-ink-muted",children:[y.jsx(ll,{className:"h-3 w-3 shrink-0 animate-spin text-chip-indigo-text motion-reduce:animate-none","aria-hidden":"true"}),y.jsxs("span",{className:"min-w-0 truncate",children:["Scanning",n&&y.jsxs(y.Fragment,{children:[" ",y.jsxs("span",{className:"font-mono text-ink-secondary",title:n,children:[l?"…/":"",i]})]})," — ",y.jsx("span",{className:"font-mono tabular-nums text-ink-secondary",children:MD(e)})]})]})}function RD({onExecute:n,scanning:e,hasSelection:t,fileCount:i,totalCount:l,scanningDirectory:o="",toastMessage:a,onToastDismiss:u}){const f=(a==null?void 0:a.kind)==="error";return y.jsxs("div",{className:"relative flex items-center justify-between border-t border-line bg-surface-glass px-4 py-2.5 text-xs transition-colors duration-200",children:[a&&y.jsx("div",{role:"status","aria-live":f?"assertive":"polite","aria-atomic":"true",className:`animate-toast-in absolute left-1/2 top-1/2 z-[var(--z-toast)] max-w-[min(80vw,640px)] -translate-x-1/2 -translate-y-1/2 rounded-xl border px-4 py-2 text-xs font-medium glass-panel-strong ${f?"pointer-events-auto flex max-w-[min(70vw,560px)] items-center gap-2.5 border-status-danger-border text-left text-ink":"pointer-events-none max-w-[min(70vw,560px)] text-center text-ink"}`,children:f?y.jsxs(y.Fragment,{children:[y.jsx(ou,{className:"h-3.5 w-3.5 shrink-0 text-status-danger-text/80","aria-hidden":"true"}),y.jsx("span",{className:"min-w-0 flex-1",children:a.message}),u&&y.jsx("button",{type:"button",onClick:u,"aria-label":"Dismiss error",className:"shrink-0 rounded-md p-0.5 text-status-danger-text/60 hover:bg-elevated hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-status-danger-border transition-colors",children:y.jsx(Ei,{className:"h-3.5 w-3.5"})})]}):a.message}),y.jsxs("div",{className:"flex min-w-0 items-center gap-3",children:[e&&y.jsx(jD,{directory:o}),l!==void 0&&l!==i&&y.jsxs("span",{"data-testid":"action-bar-count",className:"text-ink-muted",children:["Showing ",i," of ",l]})]}),y.jsxs("button",{onClick:n,disabled:!t||e,className:"flex shrink-0 items-center gap-2 rounded-xl border border-emerald-300/50 bg-gradient-to-b from-emerald-400/90 to-emerald-600/90 px-5 py-2 font-semibold text-white shadow-[inset_0_1px_0_rgb(255_255_255/0.35),0_8px_24px_-6px_rgb(16_185_129/0.55)] transition-[filter,box-shadow,transform] hover:-translate-y-px hover:brightness-110 hover:shadow-[inset_0_1px_0_rgb(255_255_255/0.35),0_12px_30px_-6px_rgb(16_185_129/0.7)] disabled:opacity-40 disabled:hover:translate-y-0 disabled:hover:brightness-100 disabled:hover:shadow-[inset_0_1px_0_rgb(255_255_255/0.35),0_8px_24px_-6px_rgb(16_185_129/0.55)] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-emerald-400",children:[y.jsx(ts,{className:"h-3.5 w-3.5 fill-current"}),y.jsx("span",{children:"Execute"}),y.jsx("kbd",{className:"rounded bg-emerald-800/60 px-1.5 py-0.5 text-[10px] text-emerald-200 shadow-[inset_0_1px_0_rgb(255_255_255/0.12)]",children:"↵"})]})]})}let Z0=[],aO=[];(()=>{let n="lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,1n,9,16,o,,x,1i,3,,i,,7,a,2,t,3,1k,,,7,2,2,2,3,9,,a,2,q,,2,3,1k,,,5,4,2,2,3,3,,u,2,3,,b,3,1k,,,8,,3,,3,k,2,m,6,,3,1k,,,7,2,2,2,3,7,3,a,2,u,,1n,5,3,3,,4,9,,14,5,1j,,,7,,3,,4,7,2,b,2,t,3,1k,,,7,,3,,4,7,2,b,2,f,,c,4,1j,2,,7,,3,,4,9,,a,2,t,3,1y,,4,6,,,,8,i,2,1p,,,8,c,8,2q,,,a,b,7,21,2,r,,,,,,4,2,1d,k,,2,5,b,,10,9,,2u,b,,6,n,4,4,3,g,4,d,,,3,6,,f,,jj,3,qa,4,s,3,t,2,u,2,1s,w,9,,19,3,,,39,2,y,,3a,c,4,c,63,5,1l,a,,,,,2,o,2,,1c,1a,2,c,k,5,1b,h,12,9,c,3,u,d,1k,e,1c,k,48,3,,l,4,,6,,2,3,5i,1s,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,n,5,4,,2b,2,1e,i,q,i,d,,12,8,p,d,18,4,1b,e,10,,1v,e,c,,8,2,1a,,1f,,,3,2,2,5,2,,,15,5,5,2,6k,8,,2,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,1t,5,8t,2,25,6,1y,b,1d,4,3e,3,1h,f,15,,2,2,a,4,19,b,7,,1p,3,10,e,g,2,18,,c,3,1c,e,8,4,,2,2k,c,6,,2,,4d,c,l,4,1j,2,,7,2,2,2,3,9,,a,2,2,7,3,5,1v,9,,,2,,,4,,5,,,e,2,2a,i,n,,29,k,6j,7,2,9,r,2,2a,h,2y,d,2t,3,2,a,74,f,6t,6,,2,2,4,,,,2,3x,7,2,7,3,,s,a,14,7,,4,8,,9,b,1a,g,5i,8,5j,8,,8,2a,m,,e,3e,6,3,,,2,,7,,,1u,5,,2,,5,9n,4,9,2,,,1c,7,3,5,n,,44l,,6,f,8ug,i,1xc,5,1n,7,t4,,,1j,7,4,29,,b,2,f57,2,3mp,1a,2,n,f2,5,3,6,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,2s,,4g,7,af,,1p,4,e4,4,72,2,6r,,2,,7,2,5,,d6,7,31,7,240,5".split(",").map(e=>e?parseInt(e,36):1);for(let e=0,t=0;e>1;if(n=aO[i])e=i+1;else return!0;if(e==t)return!1}}function Xk(n){return n>=127462&&n<=127487}const $k=8205;function LD(n,e,t=!0,i=!0){return(t?cO:zD)(n,e,i)}function cO(n,e,t){if(e==n.length)return e;e&&uO(n.charCodeAt(e))&&fO(n.charCodeAt(e-1))&&e--;let i=Zg(n,e);for(e+=Yk(i);e=0&&Xk(Zg(n,a));)o++,a-=2;if(o%2==0)break;e+=2}else break}return e}function zD(n,e,t){for(;e>1;){let i=cO(n,e-2,t);if(i=56320&&n<57344}function fO(n){return n>=55296&&n<56320}function Yk(n){return n<65536?1:2}class ft{lineAt(e){if(e<0||e>this.length)throw new RangeError(`Invalid position ${e} in document of length ${this.length}`);return this.lineInner(e,!1,1,0)}line(e){if(e<1||e>this.lines)throw new RangeError(`Invalid line number ${e} in ${this.lines}-line document`);return this.lineInner(e,!0,1,0)}replace(e,t,i){[e,t]=Sa(this,e,t);let l=[];return this.decompose(0,e,l,2),i.length&&i.decompose(0,i.length,l,3),this.decompose(t,this.length,l,1),Ar.from(l,this.length-(t-e)+i.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,t=this.length){[e,t]=Sa(this,e,t);let i=[];return this.decompose(e,t,i,0),Ar.from(i,t-e)}eq(e){if(e==this)return!0;if(e.length!=this.length||e.lines!=this.lines)return!1;let t=this.scanIdentical(e,1),i=this.length-this.scanIdentical(e,-1),l=new Kc(this),o=new Kc(e);for(let a=t,u=t;;){if(l.next(a),o.next(a),a=0,l.lineBreak!=o.lineBreak||l.done!=o.done||l.value!=o.value)return!1;if(u+=l.value.length,l.done||u>=i)return!0}}iter(e=1){return new Kc(this,e)}iterRange(e,t=this.length){return new hO(this,e,t)}iterLines(e,t){let i;if(e==null)i=this.iter();else{t==null&&(t=this.lines+1);let l=this.line(e).from;i=this.iterRange(l,Math.max(l,t==this.lines+1?this.length:t<=1?0:this.line(t-1).to))}return new dO(i)}toString(){return this.sliceString(0)}toJSON(){let e=[];return this.flatten(e),e}constructor(){}static of(e){if(e.length==0)throw new RangeError("A document must have at least one line");return e.length==1&&!e[0]?ft.empty:e.length<=32?new Zt(e):Ar.from(Zt.split(e,[]))}}class Zt extends ft{constructor(e,t=BD(e)){super(),this.text=e,this.length=t}get lines(){return this.text.length}get children(){return null}lineInner(e,t,i,l){for(let o=0;;o++){let a=this.text[o],u=l+a.length;if((t?i:u)>=e)return new PD(l,u,i,a);l=u+1,i++}}decompose(e,t,i,l){let o=e<=0&&t>=this.length?this:new Zt(Gk(this.text,e,t),Math.min(t,this.length)-Math.max(0,e));if(l&1){let a=i.pop(),u=Kh(o.text,a.text.slice(),0,o.length);if(u.length<=32)i.push(new Zt(u,a.length+o.length));else{let f=u.length>>1;i.push(new Zt(u.slice(0,f)),new Zt(u.slice(f)))}}else i.push(o)}replace(e,t,i){if(!(i instanceof Zt))return super.replace(e,t,i);[e,t]=Sa(this,e,t);let l=Kh(this.text,Kh(i.text,Gk(this.text,0,e)),t),o=this.length+i.length-(t-e);return l.length<=32?new Zt(l,o):Ar.from(Zt.split(l,[]),o)}sliceString(e,t=this.length,i=` +`){[e,t]=Sa(this,e,t);let l="";for(let o=0,a=0;o<=t&&ae&&a&&(l+=i),eo&&(l+=u.slice(Math.max(0,e-o),t-o)),o=f+1}return l}flatten(e){for(let t of this.text)e.push(t)}scanIdentical(){return 0}static split(e,t){let i=[],l=-1;for(let o of e)i.push(o),l+=o.length+1,i.length==32&&(t.push(new Zt(i,l)),i=[],l=-1);return l>-1&&t.push(new Zt(i,l)),t}}class Ar extends ft{constructor(e,t){super(),this.children=e,this.length=t,this.lines=0;for(let i of e)this.lines+=i.lines}lineInner(e,t,i,l){for(let o=0;;o++){let a=this.children[o],u=l+a.length,f=i+a.lines-1;if((t?f:u)>=e)return a.lineInner(e,t,i,l);l=u+1,i=f+1}}decompose(e,t,i,l){for(let o=0,a=0;a<=t&&o=a){let d=l&((a<=e?1:0)|(f>=t?2:0));a>=e&&f<=t&&!d?i.push(u):u.decompose(e-a,t-a,i,d)}a=f+1}}replace(e,t,i){if([e,t]=Sa(this,e,t),i.lines=o&&t<=u){let f=a.replace(e-o,t-o,i),d=this.lines-a.lines+f.lines;if(f.lines>4&&f.lines>d>>6){let m=this.children.slice();return m[l]=f,new Ar(m,this.length-(t-e)+i.length)}return super.replace(o,u,f)}o=u+1}return super.replace(e,t,i)}sliceString(e,t=this.length,i=` +`){[e,t]=Sa(this,e,t);let l="";for(let o=0,a=0;oe&&o&&(l+=i),ea&&(l+=u.sliceString(e-a,t-a,i)),a=f+1}return l}flatten(e){for(let t of this.children)t.flatten(e)}scanIdentical(e,t){if(!(e instanceof Ar))return 0;let i=0,[l,o,a,u]=t>0?[0,0,this.children.length,e.children.length]:[this.children.length-1,e.children.length-1,-1,-1];for(;;l+=t,o+=t){if(l==a||o==u)return i;let f=this.children[l],d=e.children[o];if(f!=d)return i+f.scanIdentical(d,t);i+=f.length+1}}static from(e,t=e.reduce((i,l)=>i+l.length+1,-1)){let i=0;for(let v of e)i+=v.lines;if(i<32){let v=[];for(let w of e)w.flatten(v);return new Zt(v,t)}let l=Math.max(32,i>>5),o=l<<1,a=l>>1,u=[],f=0,d=-1,m=[];function g(v){let w;if(v.lines>o&&v instanceof Ar)for(let S of v.children)g(S);else v.lines>a&&(f>a||!f)?(b(),u.push(v)):v instanceof Zt&&f&&(w=m[m.length-1])instanceof Zt&&v.lines+w.lines<=32?(f+=v.lines,d+=v.length+1,m[m.length-1]=new Zt(w.text.concat(v.text),w.length+1+v.length)):(f+v.lines>l&&b(),f+=v.lines,d+=v.length+1,m.push(v))}function b(){f!=0&&(u.push(m.length==1?m[0]:Ar.from(m,d)),d=-1,f=m.length=0)}for(let v of e)g(v);return b(),u.length==1?u[0]:new Ar(u,t)}}ft.empty=new Zt([""],0);function BD(n){let e=-1;for(let t of n)e+=t.length+1;return e}function Kh(n,e,t=0,i=1e9){for(let l=0,o=0,a=!0;o=t&&(f>i&&(u=u.slice(0,i-l)),l0?1:(e instanceof Zt?e.text.length:e.children.length)<<1]}nextInner(e,t){for(this.done=this.lineBreak=!1;;){let i=this.nodes.length-1,l=this.nodes[i],o=this.offsets[i],a=o>>1,u=l instanceof Zt?l.text.length:l.children.length;if(a==(t>0?u:0)){if(i==0)return this.done=!0,this.value="",this;t>0&&this.offsets[i-1]++,this.nodes.pop(),this.offsets.pop()}else if((o&1)==(t>0?0:1)){if(this.offsets[i]+=t,e==0)return this.lineBreak=!0,this.value=` +`,this;e--}else if(l instanceof Zt){let f=l.text[a+(t<0?-1:0)];if(this.offsets[i]+=t,f.length>Math.max(0,e))return this.value=e==0?f:t>0?f.slice(e):f.slice(0,f.length-e),this;e-=f.length}else{let f=l.children[a+(t<0?-1:0)];e>f.length?(e-=f.length,this.offsets[i]+=t):(t<0&&this.offsets[i]--,this.nodes.push(f),this.offsets.push(t>0?1:(f instanceof Zt?f.text.length:f.children.length)<<1))}}}next(e=0){return e<0&&(this.nextInner(-e,-this.dir),e=this.value.length),this.nextInner(e,this.dir)}}class hO{constructor(e,t,i){this.value="",this.done=!1,this.cursor=new Kc(e,t>i?-1:1),this.pos=t>i?e.length:0,this.from=Math.min(t,i),this.to=Math.max(t,i)}nextInner(e,t){if(t<0?this.pos<=this.from:this.pos>=this.to)return this.value="",this.done=!0,this;e+=Math.max(0,t<0?this.pos-this.to:this.from-this.pos);let i=t<0?this.pos-this.from:this.to-this.pos;e>i&&(e=i),i-=e;let{value:l}=this.cursor.next(e);return this.pos+=(l.length+e)*t,this.value=l.length<=i?l:t<0?l.slice(l.length-i):l.slice(0,i),this.done=!this.value,this}next(e=0){return e<0?e=Math.max(e,this.from-this.pos):e>0&&(e=Math.min(e,this.to-this.pos)),this.nextInner(e,this.cursor.dir)}get lineBreak(){return this.cursor.lineBreak&&this.value!=""}}class dO{constructor(e){this.inner=e,this.afterBreak=!0,this.value="",this.done=!1}next(e=0){let{done:t,lineBreak:i,value:l}=this.inner.next(e);return t&&this.afterBreak?(this.value="",this.afterBreak=!1):t?(this.done=!0,this.value=""):i?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=l,this.afterBreak=!1),this}get lineBreak(){return!1}}typeof Symbol<"u"&&(ft.prototype[Symbol.iterator]=function(){return this.iter()},Kc.prototype[Symbol.iterator]=hO.prototype[Symbol.iterator]=dO.prototype[Symbol.iterator]=function(){return this});class PD{constructor(e,t,i,l){this.from=e,this.to=t,this.number=i,this.text=l}get length(){return this.to-this.from}}function Sa(n,e,t){return e=Math.max(0,Math.min(n.length,e)),[e,Math.max(e,Math.min(n.length,t))]}function Sn(n,e,t=!0,i=!0){return LD(n,e,t,i)}function HD(n){return n>=56320&&n<57344}function ID(n){return n>=55296&&n<56320}function ui(n,e){let t=n.charCodeAt(e);if(!ID(t)||e+1==n.length)return t;let i=n.charCodeAt(e+1);return HD(i)?(t-55296<<10)+(i-56320)+65536:t}function by(n){return n<=65535?String.fromCharCode(n):(n-=65536,String.fromCharCode((n>>10)+55296,(n&1023)+56320))}function Er(n){return n<65536?1:2}const J0=/\r\n?|\n/;var Kn=(function(n){return n[n.Simple=0]="Simple",n[n.TrackDel=1]="TrackDel",n[n.TrackBefore=2]="TrackBefore",n[n.TrackAfter=3]="TrackAfter",n})(Kn||(Kn={}));class Lr{constructor(e){this.sections=e}get length(){let e=0;for(let t=0;te)return o+(e-l);o+=u}else{if(i!=Kn.Simple&&d>=e&&(i==Kn.TrackDel&&le||i==Kn.TrackBefore&&le))return null;if(d>e||d==e&&t<0&&!u)return e==l||t<0?o:o+f;o+=f}l=d}if(e>l)throw new RangeError(`Position ${e} is out of range for changeset of length ${l}`);return o}touchesRange(e,t=e){for(let i=0,l=0;i=0&&l<=t&&u>=e)return lt?"cover":!0;l=u}return!1}toString(){let e="";for(let t=0;t=0?":"+l:"")}return e}toJSON(){return this.sections}static fromJSON(e){if(!Array.isArray(e)||e.length%2||e.some(t=>typeof t!="number"))throw new RangeError("Invalid JSON representation of ChangeDesc");return new Lr(e)}static create(e){return new Lr(e)}}class hn extends Lr{constructor(e,t){super(e),this.inserted=t}apply(e){if(this.length!=e.length)throw new RangeError("Applying change set to a document with the wrong length");return ex(this,(t,i,l,o,a)=>e=e.replace(l,l+(i-t),a),!1),e}mapDesc(e,t=!1){return tx(this,e,t,!0)}invert(e){let t=this.sections.slice(),i=[];for(let l=0,o=0;l=0){t[l]=u,t[l+1]=a;let f=l>>1;for(;i.length0&&Kl(i,t,o.text),o.forward(m),u+=m}let d=e[a++];for(;u>1].toJSON()))}return e}static of(e,t,i){let l=[],o=[],a=0,u=null;function f(m=!1){if(!m&&!l.length)return;ab||g<0||b>t)throw new RangeError(`Invalid change range ${g} to ${b} (in doc of length ${t})`);let w=v?typeof v=="string"?ft.of(v.split(i||J0)):v:ft.empty,S=w.length;if(g==b&&S==0)return;ga&&Pn(l,g-a,-1),Pn(l,b-g,S),Kl(o,l,w),a=b}}return d(e),f(!u),u}static empty(e){return new hn(e?[e,-1]:[],[])}static fromJSON(e){if(!Array.isArray(e))throw new RangeError("Invalid JSON representation of ChangeSet");let t=[],i=[];for(let l=0;lu&&typeof a!="string"))throw new RangeError("Invalid JSON representation of ChangeSet");if(o.length==1)t.push(o[0],0);else{for(;i.length=0&&t<=0&&t==n[l+1]?n[l]+=e:l>=0&&e==0&&n[l]==0?n[l+1]+=t:i?(n[l]+=e,n[l+1]+=t):n.push(e,t)}function Kl(n,e,t){if(t.length==0)return;let i=e.length-2>>1;if(i>1])),!(t||a==n.sections.length||n.sections[a+1]<0);)u=n.sections[a++],f=n.sections[a++];e(l,d,o,m,g),l=d,o=m}}}function tx(n,e,t,i=!1){let l=[],o=i?[]:null,a=new au(n),u=new au(e);for(let f=-1;;){if(a.done&&u.len||u.done&&a.len)throw new Error("Mismatched change set lengths");if(a.ins==-1&&u.ins==-1){let d=Math.min(a.len,u.len);Pn(l,d,-1),a.forward(d),u.forward(d)}else if(u.ins>=0&&(a.ins<0||f==a.i||a.off==0&&(u.len=0&&f=0){let d=0,m=a.len;for(;m;)if(u.ins==-1){let g=Math.min(m,u.len);d+=g,m-=g,u.forward(g)}else if(u.ins==0&&u.lenf||a.ins>=0&&a.len>f)&&(u||i.length>d),o.forward2(f),a.forward(f)}}}}class au{constructor(e){this.set=e,this.i=0,this.next()}next(){let{sections:e}=this.set;this.i>1;return t>=e.length?ft.empty:e[t]}textBit(e){let{inserted:t}=this.set,i=this.i-2>>1;return i>=t.length&&!e?ft.empty:t[i].slice(this.off,e==null?void 0:this.off+e)}forward(e){e==this.len?this.next():(this.len-=e,this.off+=e)}forward2(e){this.ins==-1?this.forward(e):e==this.ins?this.next():(this.ins-=e,this.off+=e)}}class Yl{constructor(e,t,i,l){this.from=e,this.to=t,this.flags=i,this.goalColumn=l}get anchor(){return this.flags&32?this.to:this.from}get head(){return this.flags&32?this.from:this.to}get empty(){return this.from==this.to}get assoc(){return this.flags&8?-1:this.flags&16?1:0}get undirectional(){return(this.flags&64)>0}get bidiLevel(){let e=this.flags&7;return e==7?null:e}map(e,t=-1){let i,l;return this.empty?i=l=e.mapPos(this.from,t):(i=e.mapPos(this.from,1),l=e.mapPos(this.to,-1)),i==this.from&&l==this.to?this:new Yl(i,l,this.flags,this.goalColumn)}extend(e,t=e,i=0){if(e<=this.anchor&&t>=this.anchor)return ae.range(e,t,void 0,void 0,i);let l=Math.abs(e-this.anchor)>Math.abs(t-this.anchor)?e:t;return ae.range(this.anchor,l,void 0,void 0,i)}eq(e,t=!1){return this.anchor==e.anchor&&this.head==e.head&&this.goalColumn==e.goalColumn&&(!t||!this.empty||this.assoc==e.assoc)}toJSON(){return{anchor:this.anchor,head:this.head}}static fromJSON(e){if(!e||typeof e.anchor!="number"||typeof e.head!="number")throw new RangeError("Invalid JSON representation for SelectionRange");return ae.range(e.anchor,e.head)}static create(e,t,i,l){return new Yl(e,t,i,l)}}class ae{constructor(e,t){this.ranges=e,this.mainIndex=t}map(e,t=-1){return e.empty?this:ae.create(this.ranges.map(i=>i.map(e,t)),this.mainIndex)}eq(e,t=!1){if(this.ranges.length!=e.ranges.length||this.mainIndex!=e.mainIndex)return!1;for(let i=0;ie.toJSON()),main:this.mainIndex}}static fromJSON(e){if(!e||!Array.isArray(e.ranges)||typeof e.main!="number"||e.main>=e.ranges.length)throw new RangeError("Invalid JSON representation for EditorSelection");return new ae(e.ranges.map(t=>Yl.fromJSON(t)),e.main)}static single(e,t=e){return new ae([ae.range(e,t)],0)}static create(e,t=0){if(e.length==0)throw new RangeError("A selection needs at least one range");for(let i=0,l=0;ll.from-o.from),t=e.indexOf(i);for(let l=1;lo.head?ae.range(f,u):ae.range(u,f))}}return new ae(e,t)}}function pO(n,e){for(let t of n.ranges)if(t.to>e)throw new RangeError("Selection points outside of document")}let vy=0;class Ce{constructor(e,t,i,l,o){this.combine=e,this.compareInput=t,this.compare=i,this.isStatic=l,this.id=vy++,this.default=e([]),this.extensions=typeof o=="function"?o(this):o}get reader(){return this}static define(e={}){return new Ce(e.combine||(t=>t),e.compareInput||((t,i)=>t===i),e.compare||(e.combine?(t,i)=>t===i:wy),!!e.static,e.enables)}of(e){return new Wh([],this,0,e)}compute(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new Wh(e,this,1,t)}computeN(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new Wh(e,this,2,t)}from(e,t){return t||(t=i=>i),this.compute([e],i=>t(i.field(e)))}}function wy(n,e){return n==e||n.length==e.length&&n.every((t,i)=>t===e[i])}class Wh{constructor(e,t,i,l){this.dependencies=e,this.facet=t,this.type=i,this.value=l,this.id=vy++}dynamicSlot(e){var t;let i=this.value,l=this.facet.compareInput,o=this.id,a=e[o]>>1,u=this.type==2,f=!1,d=!1,m=[];for(let g of this.dependencies)g=="doc"?f=!0:g=="selection"?d=!0:(((t=e[g.id])!==null&&t!==void 0?t:1)&1)==0&&m.push(e[g.id]);return{create(g){return g.values[a]=i(g),1},update(g,b){if(f&&b.docChanged||d&&(b.docChanged||b.selection)||nx(g,m)){let v=i(g);if(u?!Kk(v,g.values[a],l):!l(v,g.values[a]))return g.values[a]=v,1}return 0},reconfigure:(g,b)=>{let v,w=b.config.address[o];if(w!=null){let S=ud(b,w);if(this.dependencies.every(C=>C instanceof Ce?b.facet(C)===g.facet(C):C instanceof In?b.field(C,!1)==g.field(C,!1):!0)||(u?Kk(v=i(g),S,l):l(v=i(g),S)))return g.values[a]=S,0}else v=i(g);return g.values[a]=v,1}}}get extension(){return this}}function Kk(n,e,t){if(n.length!=e.length)return!1;for(let i=0;in[f.id]),l=t.map(f=>f.type),o=i.filter(f=>!(f&1)),a=n[e.id]>>1;function u(f){let d=[];for(let m=0;mi===l),e);return e.provide&&(t.provides=e.provide(t)),t}create(e){let t=e.facet(dh).find(i=>i.field==this);return((t==null?void 0:t.create)||this.createF)(e)}slot(e){let t=e[this.id]>>1;return{create:i=>(i.values[t]=this.create(i),1),update:(i,l)=>{let o=i.values[t],a=this.updateF(o,l);return this.compareF(o,a)?0:(i.values[t]=a,1)},reconfigure:(i,l)=>{let o=i.facet(dh),a=l.facet(dh),u;return(u=o.find(f=>f.field==this))&&u!=a.find(f=>f.field==this)?(i.values[t]=u.create(i),1):l.config.address[this.id]!=null?(i.values[t]=l.field(this),0):(i.values[t]=this.create(i),1)}}}init(e){return[this,dh.of({field:this,create:e})]}get extension(){return this}}const Xs={lowest:4,low:3,default:2,high:1,highest:0};function zc(n){return e=>new gO(e,n)}const so={highest:zc(Xs.highest),high:zc(Xs.high),default:zc(Xs.default),low:zc(Xs.low),lowest:zc(Xs.lowest)};class gO{constructor(e,t){this.inner=e,this.prec=t}get extension(){return this}}class Yd{of(e){return new ix(this,e)}reconfigure(e){return Yd.reconfigure.of({compartment:this,extension:e})}get(e){return e.config.compartments.get(this)}}class ix{constructor(e,t){this.compartment=e,this.inner=t}get extension(){return this}}class cd{constructor(e,t,i,l,o,a){for(this.base=e,this.compartments=t,this.dynamicSlots=i,this.address=l,this.staticValues=o,this.facets=a,this.statusTemplate=[];this.statusTemplate.length>1]}static resolve(e,t,i){let l=[],o=Object.create(null),a=new Map;for(let b of FD(e,t,a))b instanceof In?l.push(b):(o[b.facet.id]||(o[b.facet.id]=[])).push(b);let u=Object.create(null),f=[],d=[];for(let b of l)u[b.id]=d.length<<1,d.push(v=>b.slot(v));let m=i==null?void 0:i.config.facets;for(let b in o){let v=o[b],w=v[0].facet,S=m&&m[b]||[];if(v.every(C=>C.type==0))if(u[w.id]=f.length<<1|1,wy(S,v))f.push(i.facet(w));else{let C=w.combine(v.map(N=>N.value));f.push(i&&w.compare(C,i.facet(w))?i.facet(w):C)}else{for(let C of v)C.type==0?(u[C.id]=f.length<<1|1,f.push(C.value)):(u[C.id]=d.length<<1,d.push(N=>C.dynamicSlot(N)));u[w.id]=d.length<<1,d.push(C=>UD(C,w,v))}}let g=d.map(b=>b(u));return new cd(e,a,g,u,f,o)}}function FD(n,e,t){let i=[[],[],[],[],[]],l=new Map;function o(a,u){let f=l.get(a);if(f!=null){if(f<=u)return;let d=i[f].indexOf(a);d>-1&&i[f].splice(d,1),a instanceof ix&&t.delete(a.compartment)}if(l.set(a,u),Array.isArray(a))for(let d of a)o(d,u);else if(a instanceof ix){if(t.has(a.compartment))throw new RangeError("Duplicate use of compartment in extensions");let d=e.get(a.compartment)||a.inner;t.set(a.compartment,d),o(d,u)}else if(a instanceof gO)o(a.inner,a.prec);else if(a instanceof In)i[u].push(a),a.provides&&o(a.provides,u);else if(a instanceof Wh)i[u].push(a),a.facet.extensions&&o(a.facet.extensions,Xs.default);else{let d=a.extension;if(!d)throw new Error(`Unrecognized extension value in extension set (${a}).`);if(d==a)throw new Error(`Unrecognized extension value in extension set (${a}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);o(d,u)}}return o(n,Xs.default),i.reduce((a,u)=>a.concat(u))}function Wc(n,e){if(e&1)return 2;let t=e>>1,i=n.status[t];if(i==4)throw new Error("Cyclic dependency between fields and/or facets");if(i&2)return i;n.status[t]=4;let l=n.computeSlot(n,n.config.dynamicSlots[t]);return n.status[t]=2|l}function ud(n,e){return e&1?n.config.staticValues[e>>1]:n.values[e>>1]}const xO=Ce.define(),rx=Ce.define({combine:n=>n.some(e=>e),static:!0}),yO=Ce.define({combine:n=>n.length?n[0]:void 0,static:!0}),bO=Ce.define(),vO=Ce.define(),wO=Ce.define(),kO=Ce.define({combine:n=>n.length?n[0]:!1});class cl{constructor(e,t){this.type=e,this.value=t}static define(){return new qD}}class qD{of(e){return new cl(this,e)}}class VD{constructor(e){this.map=e}of(e){return new Ye(this,e)}}class Ye{constructor(e,t){this.type=e,this.value=t}map(e){let t=this.type.map(this.value,e);return t===void 0?void 0:t==this.value?this:new Ye(this.type,t)}is(e){return this.type==e}static define(e={}){return new VD(e.map||(t=>t))}static mapEffects(e,t){if(!e.length)return e;let i=[];for(let l of e){let o=l.map(t);o&&i.push(o)}return i}}Ye.reconfigure=Ye.define();Ye.appendConfig=Ye.define();class dn{constructor(e,t,i,l,o,a){this.startState=e,this.changes=t,this.selection=i,this.effects=l,this.annotations=o,this.scrollIntoView=a,this._doc=null,this._state=null,i&&pO(i,t.newLength),o.some(u=>u.type==dn.time)||(this.annotations=o.concat(dn.time.of(Date.now())))}static create(e,t,i,l,o,a){return new dn(e,t,i,l,o,a)}get newDoc(){return this._doc||(this._doc=this.changes.apply(this.startState.doc))}get newSelection(){return this.selection||this.startState.selection.map(this.changes)}get state(){return this._state||this.startState.applyTransaction(this),this._state}annotation(e){for(let t of this.annotations)if(t.type==e)return t.value}get docChanged(){return!this.changes.empty}get reconfigured(){return this.startState.config!=this.state.config}isUserEvent(e){let t=this.annotation(dn.userEvent);return!!(t&&(t==e||t.length>e.length&&t.slice(0,e.length)==e&&t[e.length]=="."))}}dn.time=cl.define();dn.userEvent=cl.define();dn.addToHistory=cl.define();dn.remote=cl.define();function QD(n,e){let t=[];for(let i=0,l=0;;){let o,a;if(i=n[i]))o=n[i++],a=n[i++];else if(l=0;l--){let o=i[l](n);o instanceof dn?n=o:Array.isArray(o)&&o.length==1&&o[0]instanceof dn?n=o[0]:n=CO(e,da(o),!1)}return n}function $D(n){let e=n.startState,t=e.facet(wO),i=n;for(let l=t.length-1;l>=0;l--){let o=t[l](n);o&&Object.keys(o).length&&(i=SO(i,lx(e,o,n.changes.newLength),!0))}return i==n?n:dn.create(e,n.changes,n.selection,i.effects,i.annotations,i.scrollIntoView)}const YD=[];function da(n){return n==null?YD:Array.isArray(n)?n:[n]}var Pt=(function(n){return n[n.Word=0]="Word",n[n.Space=1]="Space",n[n.Other=2]="Other",n})(Pt||(Pt={}));const GD=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;let sx;try{sx=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch{}function KD(n){if(sx)return sx.test(n);for(let e=0;e"€"&&(t.toUpperCase()!=t.toLowerCase()||GD.test(t)))return!0}return!1}function WD(n){return e=>{if(!/\S/.test(e))return Pt.Space;if(KD(e))return Pt.Word;for(let t=0;t-1)return Pt.Word;return Pt.Other}}class dt{constructor(e,t,i,l,o,a){this.config=e,this.doc=t,this.selection=i,this.values=l,this.status=e.statusTemplate.slice(),this.computeSlot=o,a&&(a._state=this);for(let u=0;ul.set(d,f)),t=null),l.set(u.value.compartment,u.value.extension)):u.is(Ye.reconfigure)?(t=null,i=u.value):u.is(Ye.appendConfig)&&(t=null,i=da(i).concat(u.value));let o;t?o=e.startState.values.slice():(t=cd.resolve(i,l,this),o=new dt(t,this.doc,this.selection,t.dynamicSlots.map(()=>null),(f,d)=>d.reconfigure(f,this),null).values);let a=e.startState.facet(rx)?e.newSelection:e.newSelection.asSingle();new dt(t,e.newDoc,a,o,(u,f)=>f.update(u,e),e)}replaceSelection(e){return typeof e=="string"&&(e=this.toText(e)),this.changeByRange(t=>({changes:{from:t.from,to:t.to,insert:e},range:ae.cursor(t.from+e.length,-1)}))}changeByRange(e){let t=this.selection,i=e(t.ranges[0]),l=this.changes(i.changes),o=[i.range],a=da(i.effects);for(let u=1;ua.spec.fromJSON(u,f)))}}return dt.create({doc:e.doc,selection:ae.fromJSON(e.selection),extensions:t.extensions?l.concat([t.extensions]):l})}static create(e={}){let t=cd.resolve(e.extensions||[],new Map),i=e.doc instanceof ft?e.doc:ft.of((e.doc||"").split(t.staticFacet(dt.lineSeparator)||J0)),l=e.selection?e.selection instanceof ae?e.selection:ae.single(e.selection.anchor,e.selection.head):ae.single(0);return pO(l,i.length),t.staticFacet(rx)||(l=l.asSingle()),new dt(t,i,l,t.dynamicSlots.map(()=>null),(o,a)=>a.create(o),null)}get tabSize(){return this.facet(dt.tabSize)}get lineBreak(){return this.facet(dt.lineSeparator)||` +`}get readOnly(){return this.facet(kO)}phrase(e,...t){for(let i of this.facet(dt.phrases))if(Object.prototype.hasOwnProperty.call(i,e)){e=i[e];break}return t.length&&(e=e.replace(/\$(\$|\d*)/g,(i,l)=>{if(l=="$")return"$";let o=+(l||1);return!o||o>t.length?i:t[o-1]})),e}languageDataAt(e,t,i=-1){let l=[];for(let o of this.facet(xO))for(let a of o(this,t,i))Object.prototype.hasOwnProperty.call(a,e)&&l.push(a[e]);return l}charCategorizer(e){let t=this.languageDataAt("wordChars",e);return WD(t.length?t[0]:"")}wordAt(e){let{text:t,from:i,length:l}=this.doc.lineAt(e),o=this.charCategorizer(e),a=e-i,u=e-i;for(;a>0;){let f=Sn(t,a,!1);if(o(t.slice(f,a))!=Pt.Word)break;a=f}for(;un.length?n[0]:4});dt.lineSeparator=yO;dt.readOnly=kO;dt.phrases=Ce.define({compare(n,e){let t=Object.keys(n),i=Object.keys(e);return t.length==i.length&&t.every(l=>n[l]==e[l])}});dt.languageData=xO;dt.changeFilter=bO;dt.transactionFilter=vO;dt.transactionExtender=wO;Yd.reconfigure=Ye.define();function Br(n,e,t={}){let i={};for(let l of n)for(let o of Object.keys(l)){let a=l[o],u=i[o];if(u===void 0)i[o]=a;else if(!(u===a||a===void 0))if(Object.hasOwnProperty.call(t,o))i[o]=t[o](u,a);else throw new Error("Config merge conflict for field "+o)}for(let l in e)i[l]===void 0&&(i[l]=e[l]);return i}class ns{eq(e){return this==e}range(e,t=e){return ox.create(e,t,this)}}ns.prototype.startSide=ns.prototype.endSide=0;ns.prototype.point=!1;ns.prototype.mapMode=Kn.TrackDel;function ky(n,e){return n==e||n.constructor==e.constructor&&n.eq(e)}let ox=class OO{constructor(e,t,i){this.from=e,this.to=t,this.value=i}static create(e,t,i){return new OO(e,t,i)}};function ax(n,e){return n.from-e.from||n.value.startSide-e.value.startSide}class Sy{constructor(e,t,i,l){this.from=e,this.to=t,this.value=i,this.maxPoint=l}get length(){return ea(this.to)}findIndex(e,t,i,l=0){let o=i?this.to:this.from;for(let a=l,u=o.length;;){if(a==u)return a;let f=a+u>>1,d=o[f]-e||(i?this.value[f].endSide:this.value[f].startSide)-t;if(f==a)return d>=0?a:u;d>=0?u=f:a=f+1}}between(e,t,i,l){for(let o=this.findIndex(t,-1e9,!0),a=this.findIndex(i,1e9,!1,o);oC||S==C&&b.startSide>0&&b.endSide<=0)continue;if(!((C-S||b.endSide-b.startSide)<0))if(d<0&&(d=S),b.point&&(m=Math.max(m,C-S)),(S-i||b.startSide-l)>=0)a.push(b),u.push(S-d),f.push(C-d),i=C,l=b.endSide;else{if(S==C)for(let N=a.length;N>0;N--){if((S-(f[N-1]+d)||b.startSide-a[N-1].endSide)>=0){a.splice(N,0,b),u.splice(N,0,S-d),f.splice(N,0,C-d);continue e}if((S-(u[N-1]+d)||b.endSide-a[N-1].startSide)>0)break}o(S,C,b)}}return{mapped:a.length?new Sy(u,f,a,m):null,pos:d}}}class it{constructor(e,t,i,l){this.chunkPos=e,this.chunk=t,this.nextLayer=i,this.maxPoint=l}static create(e,t,i,l){return new it(e,t,i,l)}get length(){let e=this.chunk.length-1;return e<0?0:Math.max(this.chunkEnd(e),this.nextLayer.length)}get size(){if(this.isEmpty)return 0;let e=this.nextLayer.size;for(let t of this.chunk)e+=t.value.length;return e}chunkEnd(e){return this.chunkPos[e]+this.chunk[e].length}update(e){let{add:t=[],sort:i=!1,filterFrom:l=0,filterTo:o=this.length}=e,a=e.filter;if(t.length==0&&!a)return this;if(i&&(t=t.slice().sort(ax)),this.isEmpty)return t.length?it.of(t):this;let u=new NO(this,null,-1).goto(0),f=0,d=[],m=new zr;for(;u.value||f=0){let g=t[f++];m.addInner(g.from,g.to,g.value,!1)||d.push(g)}else u.rangeIndex==1&&u.chunkIndexthis.chunkEnd(u.chunkIndex)||ou.to||o{o||(o=new zr),o.addRange(f,d,m,!1)};for(let f=0;f=o&&e<=o+a.length&&a.between(o,e-o,t-o,i)===!1)return}this.nextLayer.between(e,t,i)}}iter(e=0){return cu.from([this]).goto(e)}get isEmpty(){return this.nextLayer==this}static iter(e,t=0){return cu.from(e).goto(t)}static compare(e,t,i,l,o=-1){let a=e.filter(g=>g.maxPoint>0||!g.isEmpty&&g.maxPoint>=o),u=t.filter(g=>g.maxPoint>0||!g.isEmpty&&g.maxPoint>=o),f=Wk(a,u,i),d=new Bc(a,f,o),m=new Bc(u,f,o);i.iterGaps((g,b,v)=>Zk(d,g,m,b,v,l)),i.empty&&i.length==0&&Zk(d,0,m,0,0,l)}static eq(e,t,i=0,l){l==null&&(l=999999999);let o=e.filter(m=>!m.isEmpty&&t.indexOf(m)<0),a=t.filter(m=>!m.isEmpty&&e.indexOf(m)<0);if(o.length!=a.length)return!1;if(!o.length)return!0;let u=Wk(o,a),f=new Bc(o,u,0).goto(i),d=new Bc(a,u,0).goto(i);for(;;){if(f.to!=d.to||!cx(f.active,d.active)||f.point&&(!d.point||!ky(f.point,d.point)))return!1;if(f.to>l)return!0;f.next(),d.next()}}static spans(e,t,i,l,o=-1){let a=new Bc(e,null,o).goto(t),u=t,f=a.openStart;for(;;){let d=Math.min(a.to,i);if(a.point){let m=a.activeForPoint(a.to),g=a.pointFromu&&(l.span(u,d,a.active,f),f=a.openEnd(d));if(a.to>i)return f+(a.point&&a.to>i?1:0);u=a.to,a.next()}}static of(e,t=!1){let i=new zr;for(let l of e instanceof ox?[e]:t?ZD(e):e)i.add(l.from,l.to,l.value);return i.finish()}static join(e){if(!e.length)return it.empty;let t=ea(e);for(let i=e.length-2;i>=0;i--)for(let l=e[i];l!=it.empty;l=l.nextLayer)t=new it(l.chunkPos,l.chunk,t,Math.max(l.maxPoint,t.maxPoint));return t}}it.empty=new it([],[],null,-1);function ea(n){return n[n.length-1]}function ZD(n){if(n.length>1)for(let e=n[0],t=1;t0)return n.slice().sort(ax);e=i}return n}it.empty.nextLayer=it.empty;class zr{finishChunk(e){this.chunks.push(new Sy(this.from,this.to,this.value,this.maxPoint)),this.chunkPos.push(this.chunkStart),this.chunkStart=-1,this.setMaxPoint=Math.max(this.setMaxPoint,this.maxPoint),this.maxPoint=-1,e&&(this.from=[],this.to=[],this.value=[])}constructor(){this.chunks=[],this.chunkPos=[],this.chunkStart=-1,this.last=null,this.lastFrom=-1e9,this.lastTo=-1e9,this.from=[],this.to=[],this.value=[],this.maxPoint=-1,this.setMaxPoint=-1,this.nextLayer=null}add(e,t,i){this.addRange(e,t,i,!0)}addRange(e,t,i,l){this.addInner(e,t,i,l)||(this.nextLayer||(this.nextLayer=new zr)).addRange(e,t,i,l)}addInner(e,t,i,l){let o=e-this.lastTo||i.startSide-this.last.endSide;if(l&&o<=0&&(e-this.lastFrom||i.startSide-this.last.startSide)<0)throw new Error("Ranges must be added sorted by `from` position and `startSide`");return o<0?!1:(this.from.length==250&&this.finishChunk(!0),this.chunkStart<0&&(this.chunkStart=e),this.from.push(e-this.chunkStart),this.to.push(t-this.chunkStart),this.last=i,this.lastFrom=e,this.lastTo=t,this.value.push(i),i.point&&(this.maxPoint=Math.max(this.maxPoint,t-e)),!0)}addChunk(e,t){if((e-this.lastTo||t.value[0].startSide-this.last.endSide)<0)return!1;this.from.length&&this.finishChunk(!0),this.setMaxPoint=Math.max(this.setMaxPoint,t.maxPoint),this.chunks.push(t),this.chunkPos.push(e);let i=t.value.length-1;return this.last=t.value[i],this.lastFrom=t.from[i]+e,this.lastTo=t.to[i]+e,!0}finish(){return this.finishInner(it.empty)}finishInner(e){if(this.from.length&&this.finishChunk(!1),this.chunks.length==0)return e;let t=it.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(e):e,this.setMaxPoint);return this.from=null,t}}function Wk(n,e,t){let i=new Map;for(let o of n)for(let a=0;a=this.minPoint)break}}setRangeIndex(e){if(e==this.layer.chunk[this.chunkIndex].value.length){if(this.chunkIndex++,this.skip)for(;this.chunkIndex=i&&l.push(new NO(a,t,i,o));return l.length==1?l[0]:new cu(l)}get startSide(){return this.value?this.value.startSide:0}goto(e,t=-1e9){for(let i of this.heap)i.goto(e,t);for(let i=this.heap.length>>1;i>=0;i--)Jg(this.heap,i);return this.next(),this}forward(e,t){for(let i of this.heap)i.forward(e,t);for(let i=this.heap.length>>1;i>=0;i--)Jg(this.heap,i);(this.to-e||this.value.endSide-t)<0&&this.next()}next(){if(this.heap.length==0)this.from=this.to=1e9,this.value=null,this.rank=-1;else{let e=this.heap[0];this.from=e.from,this.to=e.to,this.value=e.value,this.rank=e.rank,e.value&&e.next(),Jg(this.heap,0)}}}function Jg(n,e){for(let t=n[e];;){let i=(e<<1)+1;if(i>=n.length)break;let l=n[i];if(i+1=0&&(l=n[i+1],i++),t.compare(l)<0)break;n[i]=t,n[e]=l,e=i}}class Bc{constructor(e,t,i){this.minPoint=i,this.active=[],this.activeTo=[],this.activeRank=[],this.minActive=-1,this.point=null,this.pointFrom=0,this.pointRank=0,this.to=-1e9,this.endSide=0,this.openStart=-1,this.cursor=cu.from(e,t,i)}goto(e,t=-1e9){return this.cursor.goto(e,t),this.active.length=this.activeTo.length=this.activeRank.length=0,this.minActive=-1,this.to=e,this.endSide=t,this.openStart=-1,this.next(),this}forward(e,t){for(;this.minActive>-1&&(this.activeTo[this.minActive]-e||this.active[this.minActive].endSide-t)<0;)this.removeActive(this.minActive);this.cursor.forward(e,t)}removeActive(e){mh(this.active,e),mh(this.activeTo,e),mh(this.activeRank,e),this.minActive=Jk(this.active,this.activeTo)}addActive(e){let t=0,{value:i,to:l,rank:o}=this.cursor;for(;t0;)t++;ph(this.active,t,i),ph(this.activeTo,t,l),ph(this.activeRank,t,o),e&&ph(e,t,this.cursor.from),this.minActive=Jk(this.active,this.activeTo)}next(){let e=this.to,t=this.point;this.point=null;let i=this.openStart<0?[]:null;for(;;){let l=this.minActive;if(l>-1&&(this.activeTo[l]-this.cursor.from||this.active[l].endSide-this.cursor.startSide)<0){if(this.activeTo[l]>e){this.to=this.activeTo[l],this.endSide=this.active[l].endSide;break}this.removeActive(l),i&&mh(i,l)}else if(this.cursor.value)if(this.cursor.from>e){this.to=this.cursor.from,this.endSide=this.cursor.startSide;break}else{let o=this.cursor.value;if(!o.point)this.addActive(i),this.cursor.next();else if(t&&this.cursor.to==this.to&&this.cursor.from=0&&i[l]=0&&!(this.activeRank[i]e||this.activeTo[i]==e&&this.active[i].endSide>=this.point.endSide)&&t.push(this.active[i]);return t.reverse()}openEnd(e){let t=0;for(let i=this.activeTo.length-1;i>=0&&this.activeTo[i]>e;i--)t++;return t}}function Zk(n,e,t,i,l,o){n.goto(e),t.goto(i);let a=i+l,u=i,f=i-e,d=!!o.boundChange;for(let m=!1;;){let g=n.to+f-t.to,b=g||n.endSide-t.endSide,v=b<0?n.to+f:t.to,w=Math.min(v,a);if(n.point||t.point?(n.point&&t.point&&ky(n.point,t.point)&&cx(n.activeForPoint(n.to),t.activeForPoint(t.to))||o.comparePoint(u,w,n.point,t.point),m=!1):(m&&(o.boundChange(u),m=!1),w>u&&!cx(n.active,t.active)&&o.compareRange(u,w,n.active,t.active),d&&wa)break;u=v,b<=0&&n.next(),b>=0&&t.next()}}function cx(n,e){if(n.length!=e.length)return!1;for(let t=0;t=e;i--)n[i+1]=n[i];n[e]=t}function Jk(n,e){let t=-1,i=1e9;for(let l=0;l=e)return l;if(l==n.length)break;o+=n.charCodeAt(l)==9?t-o%t:1,l=Sn(n,l)}return i===!0?-1:n.length}const fx="ͼ",eS=typeof Symbol>"u"?"__"+fx:Symbol.for(fx),hx=typeof Symbol>"u"?"__styleSet"+Math.floor(Math.random()*1e8):Symbol("styleSet"),tS=typeof globalThis<"u"?globalThis:typeof window<"u"?window:{};class is{constructor(e,t){this.rules=[];let{finish:i}=t||{};function l(a){return/^@/.test(a)?[a]:a.split(/,\s*/)}function o(a,u,f,d){let m=[],g=/^@(\w+)\b/.exec(a[0]),b=g&&g[1]=="keyframes";if(g&&u==null)return f.push(a[0]+";");for(let v in u){let w=u[v];if(/&/.test(v))o(v.split(/,\s*/).map(S=>a.map(C=>S.replace(/&/,C))).reduce((S,C)=>S.concat(C)),w,f);else if(w&&typeof w=="object"){if(!g)throw new RangeError("The value of a property ("+v+") should be a primitive value.");o(l(v),w,m,b)}else w!=null&&m.push(v.replace(/_.*/,"").replace(/[A-Z]/g,S=>"-"+S.toLowerCase())+": "+w+";")}(m.length||b)&&f.push((i&&!g&&!d?a.map(i):a).join(", ")+" {"+m.join(" ")+"}")}for(let a in e)o(l(a),e[a],this.rules)}getRules(){return this.rules.join(` +`)}static newName(){let e=tS[eS]||1;return tS[eS]=e+1,fx+e.toString(36)}static mount(e,t,i){let l=e[hx],o=i&&i.nonce;l?o&&l.setNonce(o):l=new JD(e,o),l.mount(Array.isArray(t)?t:[t],e)}}let nS=new Map;class JD{constructor(e,t){let i=e.ownerDocument||e,l=i.defaultView;if(!e.head&&e.adoptedStyleSheets&&l.CSSStyleSheet){let o=nS.get(i);if(o)return e[hx]=o;this.sheet=new l.CSSStyleSheet,nS.set(i,this)}else this.styleTag=i.createElement("style"),t&&this.styleTag.setAttribute("nonce",t);this.modules=[],e[hx]=this}mount(e,t){let i=this.sheet,l=0,o=0,a=!1;for(let u=0;u-1&&(this.modules.splice(d,1),a=!0,o--,d=-1),d==-1){if(this.modules.splice(o++,0,f),a=!0,i)for(let m=0;m",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},ej=typeof navigator<"u"&&/Mac/.test(navigator.platform),tj=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var jn=0;jn<10;jn++)rs[48+jn]=rs[96+jn]=String(jn);for(var jn=1;jn<=24;jn++)rs[jn+111]="F"+jn;for(var jn=65;jn<=90;jn++)rs[jn]=String.fromCharCode(jn+32),uu[jn]=String.fromCharCode(jn);for(var e0 in rs)uu.hasOwnProperty(e0)||(uu[e0]=rs[e0]);function nj(n){var e=ej&&n.metaKey&&n.shiftKey&&!n.ctrlKey&&!n.altKey||tj&&n.shiftKey&&n.key&&n.key.length==1||n.key=="Unidentified",t=!e&&n.key||(n.shiftKey?uu:rs)[n.keyCode]||n.key||"Unidentified";return t=="Esc"&&(t="Escape"),t=="Del"&&(t="Delete"),t=="Left"&&(t="ArrowLeft"),t=="Up"&&(t="ArrowUp"),t=="Right"&&(t="ArrowRight"),t=="Down"&&(t="ArrowDown"),t}function Ct(){var n=arguments[0];typeof n=="string"&&(n=document.createElement(n));var e=1,t=arguments[1];if(t&&typeof t=="object"&&t.nodeType==null&&!Array.isArray(t)){for(var i in t)if(Object.prototype.hasOwnProperty.call(t,i)){var l=t[i];typeof l=="string"?n.setAttribute(i,l):l!=null&&(n[i]=l)}e++}for(;e2);var we={mac:lS||/Mac/.test(Gn.platform),windows:/Win/.test(Gn.platform),linux:/Linux|X11/.test(Gn.platform),ie:Gd,ie_version:AO?dx.documentMode||6:px?+px[1]:mx?+mx[1]:0,gecko:iS,gecko_version:iS?+(/Firefox\/(\d+)/.exec(Gn.userAgent)||[0,0])[1]:0,chrome:!!t0,chrome_version:t0?+t0[1]:0,ios:lS,android:/Android\b/.test(Gn.userAgent),webkit:rS,webkit_version:rS?+(/\bAppleWebKit\/(\d+)/.exec(Gn.userAgent)||[0,0])[1]:0,safari:gx,safari_version:gx?+(/\bVersion\/(\d+(\.\d+)?)/.exec(Gn.userAgent)||[0,0])[1]:0,tabSize:dx.documentElement.style.tabSize!=null?"tab-size":"-moz-tab-size"};function Cy(n,e){for(let t in n)t=="class"&&e.class?e.class+=" "+n.class:t=="style"&&e.style?e.style+=";"+n.style:e[t]=n[t];return e}const fd=Object.create(null);function Oy(n,e,t){if(n==e)return!0;n||(n=fd),e||(e=fd);let i=Object.keys(n),l=Object.keys(e);if(i.length-0!=l.length-0)return!1;for(let o of i)if(o!=t&&(l.indexOf(o)==-1||n[o]!==e[o]))return!1;return!0}function ij(n,e){for(let t=n.attributes.length-1;t>=0;t--){let i=n.attributes[t].name;e[i]==null&&n.removeAttribute(i)}for(let t in e){let i=e[t];t=="style"?n.style.cssText=i:n.getAttribute(t)!=i&&n.setAttribute(t,i)}}function sS(n,e,t){let i=!1;if(e)for(let l in e)t&&l in t||(i=!0,l=="style"?n.style.cssText="":n.removeAttribute(l));if(t)for(let l in t)e&&e[l]==t[l]||(i=!0,l=="style"?n.style.cssText=t[l]:n.setAttribute(l,t[l]));return i}function rj(n){let e=Object.create(null);for(let t=0;t0?3e8:-4e8:t>0?1e8:-1e8,new no(e,t,t,i,e.widget||null,!1)}static replace(e){let t=!!e.block,i,l;if(e.isBlockGap)i=-5e8,l=4e8;else{let{start:o,end:a}=EO(e,t);i=(o?t?-3e8:-1:5e8)-1,l=(a?t?2e8:1:-6e8)+1}return new no(e,i,l,t,e.widget||null,!0)}static line(e){return new Tu(e)}static set(e,t=!1){return it.of(e,t)}hasHeight(){return this.widget?this.widget.estimatedHeight>-1:!1}}He.none=it.empty;class Nu extends He{constructor(e){let{start:t,end:i}=EO(e);super(t?-1:5e8,i?1:-6e8,null,e),this.tagName=e.tagName||"span",this.attrs=e.class&&e.attributes?Cy(e.attributes,{class:e.class}):e.class?{class:e.class}:e.attributes||fd}eq(e){return this==e||e instanceof Nu&&this.tagName==e.tagName&&Oy(this.attrs,e.attrs)}range(e,t=e){if(e>=t)throw new RangeError("Mark decorations may not be empty");return super.range(e,t)}}Nu.prototype.point=!1;class Tu extends He{constructor(e){super(-2e8,-2e8,null,e)}eq(e){return e instanceof Tu&&this.spec.class==e.spec.class&&Oy(this.spec.attributes,e.spec.attributes)}range(e,t=e){if(t!=e)throw new RangeError("Line decoration ranges must be zero-length");return super.range(e,t)}}Tu.prototype.mapMode=Kn.TrackBefore;Tu.prototype.point=!0;class no extends He{constructor(e,t,i,l,o,a){super(t,i,o,e),this.block=l,this.isReplace=a,this.mapMode=l?t<=0?Kn.TrackBefore:Kn.TrackAfter:Kn.TrackDel}get type(){return this.startSide!=this.endSide?Ln.WidgetRange:this.startSide<=0?Ln.WidgetBefore:Ln.WidgetAfter}get heightRelevant(){return this.block||!!this.widget&&(this.widget.estimatedHeight>=5||this.widget.lineBreaks>0)}eq(e){return e instanceof no&&lj(this.widget,e.widget)&&this.block==e.block&&this.startSide==e.startSide&&this.endSide==e.endSide}range(e,t=e){if(this.isReplace&&(e>t||e==t&&this.startSide>0&&this.endSide<=0))throw new RangeError("Invalid range for replacement decoration");if(!this.isReplace&&t!=e)throw new RangeError("Widget decorations can only have zero-length ranges");return super.range(e,t)}}no.prototype.point=!0;function EO(n,e=!1){let{inclusiveStart:t,inclusiveEnd:i}=n;return t==null&&(t=n.inclusive),i==null&&(i=n.inclusive),{start:t??e,end:i??e}}function lj(n,e){return n==e||!!(n&&e&&n.compare(e))}function ma(n,e,t,i=0){let l=t.length-1;l>=0&&t[l]+i>=n?t[l]=Math.max(t[l],e):t.push(n,e)}class fu extends ns{constructor(e,t,i){super(),this.tagName=e,this.attributes=t,this.rank=i}eq(e){return e==this||e instanceof fu&&this.tagName==e.tagName&&Oy(this.attributes,e.attributes)}static create(e){return new fu(e.tagName,e.attributes||fd,e.rank==null?50:Math.max(0,Math.min(e.rank,100)))}static set(e,t=!1){return it.of(e,t)}}fu.prototype.startSide=fu.prototype.endSide=-1;const Cn=n=>n.nodeType==1,Ca=n=>n.nodeType==3;function hu(n){let e;return n.nodeType==11?e=n.getSelection?n:n.ownerDocument:e=n,e.getSelection()}function xx(n,e){return e?n==e||n.contains(e.nodeType!=1?e.parentNode:e):!1}function Zc(n,e){if(!e.anchorNode)return!1;try{return xx(n,e.anchorNode)}catch{return!1}}function Zh(n){return Ca(n)?du(n,0,n.nodeValue.length).getClientRects():Cn(n)?n.getClientRects():[]}function Jc(n,e,t,i){return t?oS(n,e,t,i,-1)||oS(n,e,t,i,1):!1}function ls(n){for(var e=0;;e++)if(n=n.previousSibling,!n)return e}function hd(n){return Cn(n)&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(n.nodeName)}function oS(n,e,t,i,l){for(;;){if(n==t&&e==i)return!0;if(e==(l<0?0:sl(n))){if(n.nodeName=="DIV")return!1;let o=n.parentNode;if(!o||!Cn(o))return!1;e=ls(n)+(l<0?0:1),n=o}else if(Cn(n)){if(n=n.childNodes[e+(l<0?-1:0)],Cn(n)&&(n.nodeName=="IMG"||n.nodeName=="BR"||n.contentEditable=="false"))return!1;e=l<0?sl(n):0}else return!1}}function sl(n){return Ca(n)?n.nodeValue.length:n.childNodes.length}function dd(n,e){let{left:t,right:i}=n;if(t==i)return n;let l=e?t:i;return{left:l,right:l,top:n.top,bottom:n.bottom}}function sj(n){let e=n.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:n.innerWidth,top:0,bottom:n.innerHeight}}function MO(n,e){let t=e.width/n.offsetWidth,i=e.height/n.offsetHeight;return(t>.995&&t<1.005||!isFinite(t)||Math.abs(e.width-n.offsetWidth)<1)&&(t=1),(i>.995&&i<1.005||!isFinite(i)||Math.abs(e.height-n.offsetHeight)<1)&&(i=1),{scaleX:t,scaleY:i}}function oj(n,e,t,i,l,o,a,u){let f=n.ownerDocument,d=f.defaultView||window;for(let m=n,g=!1;m&&!g;)if(Cn(m)){let b,v=m==f.body,w=1,S=1,C=!0,N=!0;if(v)b=sj(d);else{let I=getComputedStyle(m);if(/^(fixed|sticky)$/.test(I.position)&&(g=!0),(m.scrollHeight<=m.clientHeight||!/auto|scroll/.test(I.overflowY))&&(N=!1),(m.scrollWidth<=m.clientWidth||!/auto|scroll/.test(I.overflowX))&&(C=!1),!C&&!N){m=m.assignedSlot||m.parentNode;continue}let U=m.getBoundingClientRect();({scaleX:w,scaleY:S}=MO(m,U)),b={left:U.left,right:U.left+m.clientWidth*w,top:U.top,bottom:U.top+m.clientHeight*S}}let R=0,M=0;if(N)if(l=="nearest")e.top0&&e.bottom>b.bottom+M&&(M=e.bottom-b.bottom+a)):e.bottom>b.bottom-a&&(M=e.bottom-b.bottom+a,t<0&&e.top-M0&&e.right>b.right+R&&(R=e.right-b.right+o)):e.right>b.right-o&&(R=e.right-b.right+o,t<0&&e.leftb.bottom||e.leftb.right)&&(e={left:Math.max(e.left,b.left),right:Math.min(e.right,b.right),top:Math.max(e.top,b.top),bottom:Math.min(e.bottom,b.bottom)}),m=m.assignedSlot||m.parentNode}else if(m.nodeType==11)m=m.host;else break}function DO(n,e=!0){let t=n.ownerDocument,i=null,l=null;for(let o=n.parentNode;o&&!(o==t.body||(!e||i)&&l);)if(Cn(o))!l&&o.scrollHeight>o.clientHeight&&/scroll|auto/.test(getComputedStyle(o).overflowY)&&(l=o),e&&!i&&o.scrollWidth>o.clientWidth&&/scroll|auto/.test(getComputedStyle(o).overflowX)&&(i=o),o=o.assignedSlot||o.parentNode;else if(o.nodeType==11)o=o.host;else break;return{x:i,y:l}}class aj{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}eq(e){return this.anchorNode==e.anchorNode&&this.anchorOffset==e.anchorOffset&&this.focusNode==e.focusNode&&this.focusOffset==e.focusOffset}setRange(e){let{anchorNode:t,focusNode:i}=e;this.set(t,Math.min(e.anchorOffset,t?sl(t):0),i,Math.min(e.focusOffset,i?sl(i):0))}set(e,t,i,l){this.anchorNode=e,this.anchorOffset=t,this.focusNode=i,this.focusOffset=l}}function jO(n){let e=[];for(let t=n;t;t=t.nodeType==11?t.host:t.parentNode)Cn(t)&&e.push({node:t,left:t.scrollLeft,top:t.scrollTop});return e}function RO(n,e=!0){for(let{node:t,left:i,top:l}of n)e&&t.scrollTop!=l&&(t.scrollTop=l),t.scrollLeft!=i&&(t.scrollLeft=i)}let Vs=null;we.safari&&we.safari_version>=26&&(Vs=!1);function _O(n){if(n.setActive)return n.setActive();if(Vs)return n.focus(Vs);let e=jO(n);n.focus(Vs==null?{get preventScroll(){return Vs={preventScroll:!0},!0}}:void 0),Vs||(Vs=!1,RO(e))}let aS;function du(n,e,t=e){let i=aS||(aS=document.createRange());return i.setEnd(n,t),i.setStart(n,e),i}function pa(n,e,t,i){let l={key:e,code:e,keyCode:t,which:t,cancelable:!0};i&&({altKey:l.altKey,ctrlKey:l.ctrlKey,shiftKey:l.shiftKey,metaKey:l.metaKey}=i);let o=new KeyboardEvent("keydown",l);o.synthetic=!0,n.dispatchEvent(o);let a=new KeyboardEvent("keyup",l);return a.synthetic=!0,n.dispatchEvent(a),o.defaultPrevented||a.defaultPrevented}function cj(n){for(;n;){if(n&&(n.nodeType==9||n.nodeType==11&&n.host))return n;n=n.assignedSlot||n.parentNode}return null}function uj(n,e){let t=e.focusNode,i=e.focusOffset;if(!t||e.anchorNode!=t||e.anchorOffset!=i)return!1;for(i=Math.min(i,sl(t));;)if(i){if(!Cn(t))return!1;let l=t.childNodes[i-1];l.contentEditable=="false"?i--:(t=l,i=sl(t))}else{if(t==n)return!0;i=ls(t),t=t.parentNode}}function LO(n){return n instanceof Window?n.pageYOffset>Math.max(0,n.document.documentElement.scrollHeight-n.innerHeight-4):n.scrollTop>Math.max(1,n.scrollHeight-n.clientHeight-4)}function zO(n,e){for(let t=n,i=e;;){if(Ca(t)&&i>0)return{node:t,offset:i};if(Cn(t)&&i>0){if(t.contentEditable=="false")return null;t=t.childNodes[i-1],i=sl(t)}else if(t.parentNode&&!hd(t))i=ls(t),t=t.parentNode;else return null}}function BO(n,e){for(let t=n,i=e;;){if(Ca(t)&&i=t){if(u.level==i)return a;(o<0||(l!=0?l<0?u.fromt:e[o].level>u.level))&&(o=a)}}if(o<0)throw new RangeError("Index out of range");return o}}function IO(n,e){if(n.length!=e.length)return!1;for(let t=0;t=0;S-=3)if(kr[S+1]==-v){let C=kr[S+2],N=C&2?l:C&4?C&1?o:l:0;N&&(Et[g]=Et[kr[S]]=N),u=S;break}}else{if(kr.length==189)break;kr[u++]=g,kr[u++]=b,kr[u++]=f}else if((w=Et[g])==2||w==1){let S=w==l;f=S?0:1;for(let C=u-3;C>=0;C-=3){let N=kr[C+2];if(N&2)break;if(S)kr[C+2]|=2;else{if(N&4)break;kr[C+2]|=4}}}}}function gj(n,e,t,i){for(let l=0,o=i;l<=t.length;l++){let a=l?t[l-1].to:n,u=lf;)w==C&&(w=t[--S].from,C=S?t[S-1].to:n),Et[--w]=v;f=m}else o=d,f++}}}function bx(n,e,t,i,l,o,a){let u=i%2?2:1;if(i%2==l%2)for(let f=e,d=0;ff&&a.push(new Dr(f,S.from,v));let C=S.direction==Oa!=!(v%2);vx(n,C?i+1:i,l,S.inner,S.from,S.to,a),f=S.to}w=S.to}else{if(w==t||(m?Et[w]!=u:Et[w]==u))break;w++}b?bx(n,f,w,i+1,l,b,a):fe;){let m=!0,g=!1;if(!d||f>o[d-1].to){let S=Et[f-1];S!=u&&(m=!1,g=S==16)}let b=!m&&u==1?[]:null,v=m?i:i+1,w=f;e:for(;;)if(d&&w==o[d-1].to){if(g)break e;let S=o[--d];if(!m)for(let C=S.from,N=d;;){if(C==e)break e;if(N&&o[N-1].to==C)C=o[--N].from;else{if(Et[C-1]==u)break e;break}}if(b)b.push(S);else{S.toEt.length;)Et[Et.length]=256;let i=[],l=e==Oa?0:1;return vx(n,l,l,t,0,n.length,i),i}function UO(n){return[new Dr(0,n,0)]}let FO="";function yj(n,e,t,i,l){var o;if(!n.length)return null;let a=i.head-n.from,u;if(i.head==n.from&&i.assoc<0){if(!l)return null;a=e[u=0].side(!1,t)}else if(i.head==n.to&&i.assoc>0){if(l)return null;a=e[u=e.length-1].side(!0,t)}else u=Dr.find(e,a,(o=i.bidiLevel)!==null&&o!==void 0?o:-1,i.assoc);let f=e[u],d=f.side(l,t);if(a==d){let b=u+=l?1:-1;if(b<0||b>=e.length)return null;f=e[u=b],a=f.side(!l,t),d=f.side(l,t)}let m=Sn(n.text,a,f.forward(l,t));(mf.to)&&(m=d),FO=n.text.slice(Math.min(a,m),Math.max(a,m));let g=u==(l?e.length-1:0)?null:e[u+(l?1:-1)];if(m==d){if(!g)return l?ae.cursor(n.to,1):ae.cursor(n.from,-1);if(g.level+(l?0:1)n.some(e=>e)}),KO=Ce.define({combine:n=>n.some(e=>e)}),WO=Ce.define();class ga{constructor(e,t,i,l,o,a=!1){this.range=e,this.y=t,this.x=i,this.yMargin=l,this.xMargin=o,this.isSnapshot=a}map(e){return e.empty?this:new ga(this.range.map(e),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}clip(e){return this.range.to<=e.doc.length?this:new ga(ae.cursor(e.doc.length),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}}const gh=Ye.define({map:(n,e)=>n.map(e)}),ZO=Ye.define();function di(n,e,t){let i=n.facet(XO);i.length?i[0](e):window.onerror&&window.onerror(String(e),t,void 0,void 0,e)||(t?console.error(t+":",e):console.error(e))}const il=Ce.define({combine:n=>n.length?n[0]:!0});let vj=0;const aa=Ce.define({combine(n){return n.filter((e,t)=>{for(let i=0;i{let f=[];return a&&f.push(Kd.of(d=>{let m=d.plugin(u);return m?a(m):He.none})),o&&f.push(o(u)),f})}static fromClass(e,t){return Jt.define((i,l)=>new e(i,l),t)}}class n0{constructor(e){this.spec=e,this.mustUpdate=null,this.value=null}get plugin(){return this.spec&&this.spec.plugin}update(e){if(this.value){if(this.mustUpdate){let t=this.mustUpdate;if(this.mustUpdate=null,this.value.update)try{this.value.update(t)}catch(i){if(di(t.state,i,"CodeMirror plugin crashed"),this.value.destroy)try{this.value.destroy()}catch{}this.deactivate()}}}else if(this.spec)try{this.value=this.spec.plugin.create(e,this.spec.arg)}catch(t){di(e.state,t,"CodeMirror plugin crashed"),this.deactivate()}return this}destroy(e){var t;if(!((t=this.value)===null||t===void 0)&&t.destroy)try{this.value.destroy()}catch(i){di(e.state,i,"CodeMirror plugin crashed")}}deactivate(){this.spec=this.value=null}}const JO=Ce.define(),Ey=Ce.define(),Kd=Ce.define(),eN=Ce.define(),My=Ce.define(),Au=Ce.define(),tN=Ce.define();function cS(n,e){let t=n.state.facet(tN);if(!t.length)return t;let i=t.map(o=>o instanceof Function?o(n):o),l=[];return it.spans(i,e.from,e.to,{point(){},span(o,a,u,f){let d=o-e.from,m=a-e.from,g=l;for(let b=u.length-1;b>=0;b--,f--){let v=u[b].spec.bidiIsolate,w;if(f>0&&g.length&&(w=g[g.length-1]).to==d&&w.direction==v)w.to=m,g=w.inner;else{let S={from:d,to:m,direction:v,inner:[]};g.push(S),g=S.inner}}}}),nN(e.text,l)}function nN(n,e){for(let t of e){if(t.direction==null){for(let i=t.from,l=0;i0;t--){let l=e[t-1];if(!(l.fromA>i.toA)){if(l.toAl.push(new Ii(o,a,u,f))),this.changedRanges=l}static create(e,t,i){return new md(e,t,i)}get viewportChanged(){return(this.flags&4)>0}get viewportMoved(){return(this.flags&8)>0}get heightChanged(){return(this.flags&2)>0}get geometryChanged(){return this.docChanged||(this.flags&18)>0}get focusChanged(){return(this.flags&1)>0}get docChanged(){return!this.changes.empty}get selectionSet(){return this.transactions.some(e=>e.selection)}get empty(){return this.flags==0&&this.transactions.length==0}}const wj=[];class Yt{constructor(e,t,i=0){this.dom=e,this.length=t,this.flags=i,this.parent=null,e.cmTile=this}get breakAfter(){return this.flags&1}get children(){return wj}isWidget(){return!1}get isHidden(){return!1}isComposite(){return!1}isLine(){return!1}isText(){return!1}isBlock(){return!1}get domAttrs(){return null}sync(e){if(this.flags|=2,this.flags&4){this.flags&=-5;let t=this.domAttrs;t&&ij(this.dom,t)}}toString(){return this.constructor.name+(this.children.length?`(${this.children})`:"")+(this.breakAfter?"#":"")}destroy(){this.parent=null}setDOM(e){this.dom=e,e.cmTile=this}get posAtStart(){return this.parent?this.parent.posBefore(this):0}get posAtEnd(){return this.posAtStart+this.length}posBefore(e,t=this.posAtStart){let i=t;for(let l of this.children){if(l==e)return i;i+=l.length+l.breakAfter}throw new RangeError("Invalid child in posBefore")}posAfter(e){return this.posBefore(e)+e.length}covers(e){return!0}coordsIn(e,t,i){return null}domPosFor(e,t){let i=ls(this.dom),l=this.length?e>0:t>0;return new er(this.parent.dom,i+(l?1:0),e==0||e==this.length)}markDirty(e){this.flags&=-3,e&&(this.flags|=4),this.parent&&this.parent.flags&2&&this.parent.markDirty(!1)}get overrideDOMText(){return null}get root(){for(let e=this;e;e=e.parent)if(e instanceof Zd)return e;return null}static get(e){return e.cmTile}}class Wd extends Yt{constructor(e){super(e,0),this._children=[]}isComposite(){return!0}get children(){return this._children}get lastChild(){return this.children.length?this.children[this.children.length-1]:null}append(e){this.children.push(e),e.parent=this}sync(e){if(this.flags&2)return;super.sync(e);let t=this.dom,i=null,l,o=(e==null?void 0:e.node)==t?e:null,a=0;for(let u of this.children){if(u.sync(e),a+=u.length+u.breakAfter,l=i?i.nextSibling:t.firstChild,o&&l!=u.dom&&(o.written=!0),u.dom.parentNode==t)for(;l&&l!=u.dom;)l=uS(l);else t.insertBefore(u.dom,l);i=u.dom}for(l=i?i.nextSibling:t.firstChild,o&&l&&(o.written=!0);l;)l=uS(l);this.length=a}}function uS(n){let e=n.nextSibling;return n.parentNode.removeChild(n),e}class Zd extends Wd{constructor(e,t){super(t),this.view=e}owns(e){for(;e;e=e.parent)if(e==this)return!0;return!1}isBlock(){return!0}nearest(e){for(;;){if(!e)return null;let t=Yt.get(e);if(t&&this.owns(t))return t;e=e.parentNode}}blockTiles(e){for(let t=[],i=this,l=0,o=0;;)if(l==i.children.length){if(!t.length)return;i=i.parent,i.breakAfter&&o++,l=t.pop()}else{let a=i.children[l++];if(a instanceof rl)t.push(l),i=a,l=0;else{let u=o+a.length,f=e(a,o);if(f!==void 0)return f;o=u+a.breakAfter}}}resolveBlock(e,t){let i,l=-1,o,a=-1;if(this.blockTiles((u,f)=>{let d=f+u.length;if(e>=f&&e<=d){if(u.isWidget()&&t>=-1&&t<=1){if(u.flags&32)return!0;u.flags&16&&(i=void 0)}(fe||e==f&&(t>1?u.length:u.covers(-1)))&&(!o||!u.isWidget()&&o.isWidget())&&(o=u,a=e-f)}}),!i&&!o)throw new Error("No tile at position "+e);return i&&t<0||!o?{tile:i,offset:l}:{tile:o,offset:a}}}class rl extends Wd{constructor(e,t){super(e),this.wrapper=t}isBlock(){return!0}covers(e){return this.children.length?e<0?this.children[0].covers(-1):this.lastChild.covers(1):!1}get domAttrs(){return this.wrapper.attributes}static of(e,t){let i=new rl(t||document.createElement(e.tagName),e);return t||(i.flags|=4),i}}class Na extends Wd{constructor(e,t){super(e),this.attrs=t}isLine(){return!0}static start(e,t,i){let l=new Na(t||document.createElement("div"),e);return(!t||!i)&&(l.flags|=4),l}get domAttrs(){return this.attrs}resolveInline(e,t,i=!1){let l=null,o=-1,a=null,u=-1;function f(m,g){for(let b=0,v=0;b=g&&(w.isComposite()?f(w,g-v):(!a||i&&a.isHidden&&(t>0&&!(a.flags&32)||i&&Sj(a,w)))&&(S>g||w.flags&32&&t<=1)?(a=w,u=g-v):(v=-1)&&(l=w,o=g-v)),v=S}}f(this,e);let d=(t<0?l:a)||l||a;return d?{tile:d,offset:d==l?o:u}:null}coordsIn(e,t,i){let l=this.resolveInline(e,t,!0);return l?l.tile.coordsIn(Math.max(0,l.offset),t,i):kj(this)}domIn(e,t){let i=this.resolveInline(e,t);if(i){let{tile:l,offset:o}=i;if(this.dom.contains(l.dom))return l.isText()?new er(l.dom,Math.min(l.dom.nodeValue.length,o)):l.domPosFor(o,l.flags&16?1:l.flags&32?-1:t);let a=i.tile.parent,u=!1;for(let f of a.children){if(u)return new er(f.dom,0);f==i.tile&&(u=!0)}}return new er(this.dom,0)}}function kj(n){let e=n.dom.lastChild;if(!e)return n.dom.getBoundingClientRect();let t=Zh(e);return t[t.length-1]||null}function Sj(n,e){let t=n.coordsIn(0,1),i=e.coordsIn(0,1);return t&&i&&i.topl&&(e=l);let o=e,a=e,u=0;e==0&&t<0||e==l&&t>=0?we.chrome||we.gecko||(e?(o--,u=1):a=0)?0:f.length-1];return we.safari&&!u&&d.width==0&&(d=Array.prototype.find.call(f,m=>m.width)||d),i==null?d:dd(d,(u?u>0:t<0)==i)}static of(e,t){let i=new Gs(t||document.createTextNode(e),e);return t||(i.flags|=2),i}}class io extends Yt{constructor(e,t,i,l){super(e,t,l),this.widget=i}isWidget(){return!0}get isHidden(){return this.widget.isHidden}covers(e){return this.flags&48?!1:(this.flags&(e<0?64:128))>0}coordsIn(e,t){return this.coordsInWidget(e,t,!1)}coordsInWidget(e,t,i){let l=this.widget.coordsAt(this.dom,e,t);if(l)return l;if(i)return dd(this.dom.getBoundingClientRect(),this.length?e==0:t<=0);{let o=this.dom.getClientRects(),a=null;if(!o.length)return null;let u=this.flags&16?!0:this.flags&32?!1:e>0;for(let f=u?o.length-1:0;a=o[f],!(e>0?f==0:f==o.length-1||a.top0==i)}}class Cj{constructor(e){this.index=0,this.beforeBreak=!1,this.parents=[],this.tile=e}advance(e,t,i){let{tile:l,index:o,beforeBreak:a,parents:u}=this;for(;e||t>0;)if(l.isComposite())if(a){if(!e)break;i&&i.break(),e--,a=!1}else if(o==l.children.length){if(!e&&!u.length)break;i&&i.leave(l),a=!!l.breakAfter,{tile:l,index:o}=u.pop(),o++}else{let f=l.children[o],d=f.breakAfter;(t>0?f.length<=e:f.length=0;u--){let f=t.marks[u],d=l.lastChild;if(d instanceof hi&&d.mark.eq(f.mark))d.dom!=f.dom&&d.setDOM(i0(f.dom)),l=d;else{let{dom:m}=f;this.cache.reused.get(f)&&Yt.get(f.dom)&&(m=i0(f.dom));let g=hi.of(f.mark,m);l.append(g),l=g}this.cache.reused.set(f,2)}let o=Yt.get(e.text);o&&this.cache.reused.set(o,2);let a=new Gs(e.text,e.text.nodeValue);a.flags|=8,this.pos=e.range.toB,l.append(a)}addInlineWidget(e,t,i){let l=this.afterWidget&&e.flags&48&&(this.afterWidget.flags&48)==(e.flags&48);l||this.flushBuffer();let o=this.ensureMarks(t,i);!l&&!(e.flags&16)&&o.append(this.getBuffer(1)),o.append(e),this.pos+=e.length,this.afterWidget=e}addMark(e,t,i){this.flushBuffer(),this.ensureMarks(t,i).append(e),this.pos+=e.length,this.afterWidget=null}addBlockWidget(e){this.getBlockPos().append(e),this.pos+=e.length,this.lastBlock=e,this.endLine()}continueWidget(e){let t=this.afterWidget||this.lastBlock;t.length+=e,this.pos+=e}addLineStart(e,t){var i;e||(e=rN);let l=Na.start(e,t||((i=this.cache.find(Na))===null||i===void 0?void 0:i.dom),!!t);this.getBlockPos().append(this.lastBlock=this.curLine=l)}addLine(e){this.getBlockPos().append(e),this.pos+=e.length,this.lastBlock=e,this.endLine()}addBreak(){this.lastBlock.flags|=1,this.endLine(),this.pos++}addLineStartIfNotCovered(e){this.blockPosCovered()||this.addLineStart(e)}ensureLine(e){this.curLine||this.addLineStart(e)}ensureMarks(e,t){var i;let l=this.curLine;for(let o=e.length-1;o>=0;o--){let a=e[o],u;if(t>0&&(u=l.lastChild)&&u instanceof hi&&u.mark.eq(a))l=u,t--;else{let f=hi.of(a,(i=this.cache.find(hi,d=>d.mark.eq(a)))===null||i===void 0?void 0:i.dom);l.append(f),l=f,t=0}}return l}endLine(){if(this.curLine){this.flushBuffer();let e=this.curLine.lastChild;(!e||!fS(this.curLine,!1)||e.dom.nodeName!="BR"&&e.isWidget()&&!(we.ios&&fS(this.curLine,!0)))&&this.curLine.append(this.cache.findWidget(r0,0,32)||new io(r0.toDOM(),0,r0,32)),this.curLine=this.afterWidget=null}}updateBlockWrappers(){this.wrapperPos>this.pos+1e4&&(this.blockWrappers.goto(this.pos),this.wrappers.length=0);for(let e=this.wrappers.length-1;e>=0;e--)this.wrappers[e].to=this.pos){let t=e.rank*102+e.value.rank,i=new Oj(e.from,e.to,e.value,t),l=this.wrappers.length;for(;l>0&&(this.wrappers[l-1].rank-i.rank||this.wrappers[l-1].to-i.to)<0;)l--;this.wrappers.splice(l,0,i)}this.wrapperPos=this.pos}getBlockPos(){var e;this.updateBlockWrappers();let t=this.root;for(let i of this.wrappers){let l=t.lastChild;if(i.froma.wrapper.eq(i.wrapper)))===null||e===void 0?void 0:e.dom);t.append(o),t=o}}return t}blockPosCovered(){let e=this.lastBlock;return e!=null&&!e.breakAfter&&(!e.isWidget()||(e.flags&160)>0)}getBuffer(e){let t=2|(e<0?16:32),i=this.cache.find(pd,void 0,1);return i&&(i.flags=t),i||new pd(t)}flushBuffer(){this.afterWidget&&!(this.afterWidget.flags&32)&&(this.afterWidget.parent.append(this.getBuffer(-1)),this.afterWidget=null)}}class Tj{constructor(e){this.skipCount=0,this.text="",this.textOff=0,this.cursor=e.iter()}skip(e){this.textOff+e<=this.text.length?this.textOff+=e:(this.skipCount+=e-(this.text.length-this.textOff),this.text="",this.textOff=0)}next(e){if(this.textOff==this.text.length){let{value:l,lineBreak:o,done:a}=this.cursor.next(this.skipCount);if(this.skipCount=0,a)throw new Error("Ran out of text content when drawing inline views");this.text=l;let u=this.textOff=Math.min(e,l.length);return o?null:l.slice(0,u)}let t=Math.min(this.text.length,this.textOff+e),i=this.text.slice(this.textOff,t);return this.textOff=t,i}}const gd=[io,Na,Gs,hi,pd,rl,Zd];for(let n=0;n[]),this.index=gd.map(()=>0),this.reused=new Map}add(e){let t=e.constructor.bucket,i=this.buckets[t];i.length<6?i.push(e):i[this.index[t]=(this.index[t]+1)%6]=e}find(e,t,i=2){let l=e.bucket,o=this.buckets[l],a=this.index[l];for(let u=0;u{if(this.cache.add(a),a.isComposite())return!1},enter:a=>this.cache.add(a),leave:()=>{},break:()=>{}}}run(e,t){let i=t&&this.getCompositionContext(t.text);for(let l=0,o=0,a=0;;){let u=al){let d=f-l;this.preserve(d,!a,!u),l=f,o+=d}if(!u)break;t&&u.fromA<=t.range.fromA&&u.toA>=t.range.toA?(this.forward(u.fromA,t.range.fromA,t.range.fromA{if(a.isWidget())if(this.openWidget)this.builder.continueWidget(f-u);else{let d=f>0||u{a.isLine()?this.builder.addLineStart(a.attrs,this.cache.maybeReuse(a)):(this.cache.add(a),a instanceof hi&&l.unshift(a.mark)),this.openWidget=!1},leave:a=>{a.isLine()?l.length&&(l.length=o=0):a instanceof hi&&(l.shift(),o=Math.min(o,l.length))},break:()=>{this.builder.addBreak(),this.openWidget=!1}}),this.text.skip(e)}emit(e,t){let i=null,l=this.builder,o=-1,a=it.spans(this.decorations,e,t,{point:(u,f,d,m,g,b)=>{if(d instanceof no){if(this.disallowBlockEffectsFor[b]){if(d.block)throw new RangeError("Block decorations may not be specified via plugins");if(f>this.view.state.doc.lineAt(u).to)throw new RangeError("Decorations that replace line breaks may not be specified via plugins")}if(o=m.length,g>m.length)l.continueWidget(f-u);else{let v=d.widget||(d.block?Ta.block:Ta.inline),w=Mj(d),S=this.cache.findWidget(v,f-u,w)||io.of(v,this.view,f-u,w);d.block?(d.startSide>0&&l.addLineStartIfNotCovered(i),l.addBlockWidget(S)):(l.ensureLine(i),l.addInlineWidget(S,m,g))}i=null}else i=Dj(i,d);f>u&&this.text.skip(f-u)},span:(u,f,d,m)=>{for(let g=u;g-1&&(this.openWidget=a>o),this.openWidget||l.addLineStartIfNotCovered(i),this.openMarks=a}forward(e,t,i=1){t-e<=10?this.old.advance(t-e,i,this.reuseWalker):(this.old.advance(5,-1,this.reuseWalker),this.old.advance(t-e-10,-1),this.old.advance(5,i,this.reuseWalker))}getCompositionContext(e){let t=[],i=null;for(let l=e.parentNode;;l=l.parentNode){let o=Yt.get(l);if(l==this.view.contentDOM)break;o instanceof hi?t.push(o):o!=null&&o.isLine()?i=o:o instanceof rl||(l.nodeName=="DIV"&&!i?i=new Na(l,rN):i||t.push(hi.of(new Nu({tagName:l.nodeName.toLowerCase(),attributes:rj(l)}),l)))}return i?{line:i,marks:t}:null}}function fS(n,e){let t=i=>{for(let l of i.children)if((e?l.isText():l.length)||t(l))return!0;return!1};return t(n)}function Mj(n){let e=n.isReplace?(n.startSide<0?64:0)|(n.endSide>0?128:0):n.startSide>0?32:16;return n.block&&(e|=256),e}const rN={class:"cm-line"};function Dj(n,e){let t=e.spec.attributes,i=e.spec.class;return!t&&!i||(n||(n={class:"cm-line"}),t&&Cy(t,n),i&&(n.class+=" "+i)),n}function jj(n){let e=[];for(let t=n.parents.length;t>1;t--){let i=t==n.parents.length?n.tile:n.parents[t].tile;i instanceof hi&&e.push(i.mark)}return e}function i0(n){let e=Yt.get(n);return e&&e.setDOM(n.cloneNode()),n}class Ta extends ul{constructor(e){super(),this.tag=e}eq(e){return e.tag==this.tag}toDOM(){return document.createElement(this.tag)}updateDOM(e){return e.nodeName.toLowerCase()==this.tag}get isHidden(){return!0}}Ta.inline=new Ta("span");Ta.block=new Ta("div");const r0=new class extends ul{toDOM(){return document.createElement("br")}get isHidden(){return!0}get editable(){return!0}};class hS{constructor(e){this.view=e,this.decorations=[],this.blockWrappers=[],this.dynamicDecorationMap=[!1],this.domChanged=null,this.hasComposition=null,this.editContextFormatting=He.none,this.lastCompositionAfterCursor=!1,this.minWidth=0,this.minWidthFrom=0,this.minWidthTo=0,this.impreciseAnchor=null,this.impreciseHead=null,this.forceSelection=!1,this.lastUpdate=Date.now(),this.updateDeco(),this.tile=new Zd(e,e.contentDOM),this.updateInner([new Ii(0,0,0,e.state.doc.length)],null)}update(e){var t;let i=e.changedRanges;this.minWidth>0&&i.length&&(i.every(({fromA:m,toA:g})=>gthis.minWidthTo)?(this.minWidthFrom=e.changes.mapPos(this.minWidthFrom,1),this.minWidthTo=e.changes.mapPos(this.minWidthTo,1)):this.minWidth=this.minWidthFrom=this.minWidthTo=0),this.updateEditContextFormatting(e);let l=-1;this.view.inputState.composing>=0&&!this.view.observer.editContext&&(!((t=this.domChanged)===null||t===void 0)&&t.newSel?l=this.domChanged.newSel.head:!Uj(e.changes,this.hasComposition)&&!e.selectionSet&&(l=e.state.selection.main.head));let o=l>-1?_j(this.view,e.changes,l):null;if(this.domChanged=null,this.hasComposition){let{from:m,to:g}=this.hasComposition;i=new Ii(m,g,e.changes.mapPos(m,-1),e.changes.mapPos(g,1)).addToSet(i.slice())}this.hasComposition=o?{from:o.range.fromB,to:o.range.toB}:null,(we.ie||we.chrome)&&!o&&e&&e.state.doc.lines!=e.startState.doc.lines&&(this.forceSelection=!0);let a=this.decorations,u=this.blockWrappers;this.updateDeco();let f=Bj(a,this.decorations,e.changes);f.length&&(i=Ii.extendWithRanges(i,f));let d=Hj(u,this.blockWrappers,e.changes);return d.length&&(i=Ii.extendWithRanges(i,d)),o&&!i.some(m=>m.fromA<=o.range.fromA&&m.toA>=o.range.toA)&&(i=o.range.addToSet(i.slice())),this.tile.flags&2&&i.length==0?!1:(this.updateInner(i,o),e.transactions.length&&(this.lastUpdate=Date.now()),!0)}updateInner(e,t){this.view.viewState.mustMeasureContent=!0;let{observer:i}=this.view;i.ignore(()=>{if(t||e.length){let a=this.tile,u=new Ej(this.view,a,this.blockWrappers,this.decorations,this.dynamicDecorationMap);t&&Yt.get(t.text)&&u.cache.reused.set(Yt.get(t.text),2),this.tile=u.run(e,t),kx(a,u.cache.reused)}this.tile.dom.style.height=this.view.viewState.contentHeight/this.view.scaleY+"px",this.tile.dom.style.flexBasis=this.minWidth?this.minWidth+"px":"";let o=we.chrome||we.ios?{node:i.selectionRange.focusNode,written:!1}:void 0;this.tile.sync(o),o&&(o.written||i.selectionRange.focusNode!=o.node||!this.tile.dom.contains(o.node))&&(this.forceSelection=!0),this.tile.dom.style.height=""});let l=[];if(this.view.viewport.from||this.view.viewport.to-1)&&Zc(i,this.view.observer.selectionRange)&&!(l&&i.contains(l));if(!(o||t||a))return;let u=this.forceSelection;this.forceSelection=!1;let f=this.view.state.selection.main,d,m;if(f.empty?m=d=this.inlineDOMNearPos(f.anchor,f.assoc||1):(m=this.inlineDOMNearPos(f.head,f.head==f.from?1:-1),d=this.inlineDOMNearPos(f.anchor,f.anchor==f.from?1:-1)),we.gecko&&f.empty&&!this.hasComposition&&Rj(d)){let b=document.createTextNode("");this.view.observer.ignore(()=>d.node.insertBefore(b,d.node.childNodes[d.offset]||null)),d=m=new er(b,0),u=!0}let g=this.view.observer.selectionRange;(u||!g.focusNode||(!Jc(d.node,d.offset,g.anchorNode,g.anchorOffset)||!Jc(m.node,m.offset,g.focusNode,g.focusOffset))&&!this.suppressWidgetCursorChange(g,f))&&(this.view.observer.ignore(()=>{we.android&&we.chrome&&i.contains(g.focusNode)&&Ij(g.focusNode,i)&&(i.blur(),i.focus({preventScroll:!0}));let b=hu(this.view.root);if(b)if(f.empty){if(we.gecko){let v=Lj(d.node,d.offset);if(v&&v!=3){let w=(v==1?zO:BO)(d.node,d.offset);w&&(d=new er(w.node,w.offset))}}b.collapse(d.node,d.offset),f.bidiLevel!=null&&b.caretBidiLevel!==void 0&&(b.caretBidiLevel=f.bidiLevel)}else if(b.extend){b.collapse(d.node,d.offset);try{b.extend(m.node,m.offset)}catch{}}else{let v=document.createRange();f.anchor>f.head&&([d,m]=[m,d]),v.setEnd(m.node,m.offset),v.setStart(d.node,d.offset),b.removeAllRanges(),b.addRange(v)}a&&this.view.root.activeElement==i&&(i.blur(),l&&l.focus())}),this.view.observer.setSelectionRange(d,m)),this.impreciseAnchor=d.precise?null:new er(g.anchorNode,g.anchorOffset),this.impreciseHead=m.precise?null:new er(g.focusNode,g.focusOffset)}suppressWidgetCursorChange(e,t){return this.hasComposition&&t.empty&&Jc(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset)&&this.posFromDOM(e.focusNode,e.focusOffset)==t.head}enforceCursorAssoc(){if(this.hasComposition)return;let{view:e}=this,t=e.state.selection.main,i=hu(e.root),{anchorNode:l,anchorOffset:o}=e.observer.selectionRange;if(!i||!t.empty||!t.assoc||!i.modify)return;let a=this.lineAt(t.head,t.assoc);if(!a)return;let u=a.posAtStart;if(t.head==u||t.head==u+a.length)return;let f=this.coordsAt(t.head,-1),d=this.coordsAt(t.head,1);if(!f||!d||f.bottom>d.top)return;let m=this.domAtPos(t.head+t.assoc,t.assoc);i.collapse(m.node,m.offset),i.modify("move",t.assoc<0?"forward":"backward","lineboundary"),e.observer.readSelectionRange();let g=e.observer.selectionRange;e.docView.posFromDOM(g.anchorNode,g.anchorOffset)!=t.from&&i.collapse(l,o)}posFromDOM(e,t){let i=this.tile.nearest(e);if(!i)return this.tile.dom.compareDocumentPosition(e)&2?0:this.view.state.doc.length;let l=i.posAtStart;if(i.isComposite()){let o;if(e==i.dom)o=i.dom.childNodes[t];else{let a=sl(e)==0?0:t==0?-1:1;for(;;){let u=e.parentNode;if(u==i.dom)break;a==0&&u.firstChild!=u.lastChild&&(e==u.firstChild?a=-1:a=1),e=u}a<0?o=e:o=e.nextSibling}if(o==i.dom.firstChild)return l;for(;o&&!Yt.get(o);)o=o.nextSibling;if(!o)return l+i.length;for(let a=0,u=l;;a++){let f=i.children[a];if(f.dom==o)return u;u+=f.length+f.breakAfter}}else return i.isText()?e==i.dom?l+t:l+(t?i.length:0):l}domAtPos(e,t){let{tile:i,offset:l}=this.tile.resolveBlock(e,t);return i.isWidget()?i.domPosFor(l,t):i.domIn(l,t)}inlineDOMNearPos(e,t){let i,l=-1,o=!1,a,u=-1,f=!1;return this.tile.blockTiles((d,m)=>{if(d.isWidget()){if(d.flags&32&&m>=e)return!0;d.flags&16&&(o=!0)}else{let g=m+d.length;if(m<=e&&(i=d,l=e-m,o=g=e&&!a&&(a=d,u=e-m,f=m>e),m>e&&a)return!0}}),!i&&!a?this.domAtPos(e,t):(o&&a?i=null:f&&i&&(a=null),i&&t<0||!a?i.domIn(l,t):a.domIn(u,t))}coordsAt(e,t,i){let{tile:l,offset:o}=this.tile.resolveBlock(e,t);return l.isWidget()?l.widget instanceof l0?null:l.coordsInWidget(o,t,!0):l.coordsIn(o,t,i)}lineAt(e,t){let{tile:i}=this.tile.resolveBlock(e,t);return i.isLine()?i:null}coordsForChar(e){let{tile:t,offset:i}=this.tile.resolveBlock(e,1);if(!t.isLine())return null;function l(o,a){if(o.isComposite())for(let u of o.children){if(u.length>=a){let f=l(u,a);if(f)return f}if(a-=u.length,a<0)break}else if(o.isText()&&aMath.max(this.view.scrollDOM.clientWidth,this.minWidth)+1,u=-1,f=this.view.textDirection==Ot.LTR,d=0,m=(g,b,v)=>{for(let w=0;wl);w++){let S=g.children[w],C=b+S.length,N=S.dom.getBoundingClientRect(),{height:R}=N;if(v&&!w&&(d+=N.top-v.top),S instanceof rl)C>i&&m(S,b,N);else if(b>=i&&(d>0&&t.push(-d),t.push(R+d),d=0,a)){let M=S.dom.lastChild,I=M?Zh(M):[];if(I.length){let U=I[I.length-1],E=f?U.right-N.left:N.right-U.left;E>u&&(u=E,this.minWidth=o,this.minWidthFrom=b,this.minWidthTo=C)}}v&&w==g.children.length-1&&(d+=v.bottom-N.bottom),b=C+S.breakAfter}};return m(this.tile,0,null),t}textDirectionAt(e){let{tile:t}=this.tile.resolveBlock(e,1);return getComputedStyle(t.dom).direction=="rtl"?Ot.RTL:Ot.LTR}measureTextSize(){let e=this.tile.blockTiles(a=>{if(a.isLine()&&a.children.length&&a.length<=20){let u=0,f;for(let d of a.children){if(!d.isText()||/[^ -~]/.test(d.text))return;let m=Zh(d.dom);if(m.length!=1)return;u+=m[0].width,f=m[0].height}if(u)return{lineHeight:a.dom.getBoundingClientRect().height,charWidth:u/a.length,textHeight:f}}});if(e)return e;let t=document.createElement("div"),i,l,o;return t.className="cm-line",t.style.width="99999px",t.style.position="absolute",t.textContent="abc def ghi jkl mno pqr stu",this.view.observer.ignore(()=>{this.tile.dom.appendChild(t);let a=Zh(t.firstChild)[0];i=t.getBoundingClientRect().height,l=a&&a.width?a.width/27:7,o=a&&a.height?a.height:i,t.remove()}),{lineHeight:i,charWidth:l,textHeight:o}}computeBlockGapDeco(){let e=[],t=this.view.viewState;for(let i=0,l=0;;l++){let o=l==t.viewports.length?null:t.viewports[l],a=o?o.from-1:this.view.state.doc.length;if(a>i){let u=(t.lineBlockAt(a).bottom-t.lineBlockAt(i).top)/this.view.scaleY;e.push(He.replace({widget:new l0(u),block:!0,inclusive:!0,isBlockGap:!0}).range(i,a))}if(!o)break;i=o.to+1}return He.set(e)}updateDeco(){let e=1,t=this.view.state.facet(Kd).map(o=>(this.dynamicDecorationMap[e++]=typeof o=="function")?o(this.view):o),i=!1,l=this.view.state.facet(My).map((o,a)=>{let u=typeof o=="function";return u&&(i=!0),u?o(this.view):o});for(l.length&&(this.dynamicDecorationMap[e++]=i,t.push(it.join(l))),this.decorations=[this.editContextFormatting,...t,this.computeBlockGapDeco(),this.view.viewState.lineGapDeco];etypeof o=="function"?o(this.view):o)}scrollIntoView(e){if(e.isSnapshot){let d=this.view.viewState.lineBlockAt(e.range.head);this.view.scrollDOM.scrollTop=d.top-e.yMargin,this.view.scrollDOM.scrollLeft=e.xMargin;return}for(let d of this.view.state.facet(WO))try{if(d(this.view,e.range,e))return!0}catch(m){di(this.view.state,m,"scroll handler")}let{range:t}=e,i=this.coordsAt(t.head,t.assoc||(t.head>t.anchor?-1:1)),l;if(!i)return;!t.empty&&(l=this.coordsAt(t.anchor,t.anchor>t.head?-1:1))&&(i={left:Math.min(i.left,l.left),top:Math.min(i.top,l.top),right:Math.max(i.right,l.right),bottom:Math.max(i.bottom,l.bottom)});let o=Dy(this.view),a={left:i.left-o.left,top:i.top-o.top,right:i.right+o.right,bottom:i.bottom+o.bottom},{offsetWidth:u,offsetHeight:f}=this.view.scrollDOM;if(oj(this.view.scrollDOM,a,t.head1&&(i.top>window.visualViewport.offsetTop+window.visualViewport.height||i.bottomi.isWidget()||i.children.some(t);return t(this.tile.resolveBlock(e,1).tile)}destroy(){kx(this.tile)}}function kx(n,e){let t=e==null?void 0:e.get(n);if(t!=1){t==null&&n.destroy();for(let i of n.children)kx(i,e)}}function Rj(n){return Cn(n.node)&&n.node.firstChild&&(n.offset==0||n.node.childNodes[n.offset-1].contentEditable=="false")&&(n.offset==n.node.childNodes.length||n.node.childNodes[n.offset].contentEditable=="false")}function lN(n,e){let t=n.observer.selectionRange;if(!t.focusNode)return null;let i=zO(t.focusNode,t.focusOffset),l=BO(t.focusNode,t.focusOffset),o=i||l;if(l&&i&&l.node!=i.node){let u=Yt.get(l.node);if(!u||u.isText()&&u.text!=l.node.nodeValue)o=l;else if(n.docView.lastCompositionAfterCursor){let f=Yt.get(i.node);!f||f.isText()&&f.text!=i.node.nodeValue||(o=l)}}if(n.docView.lastCompositionAfterCursor=o!=i,!o)return null;let a=e-o.offset;return{from:a,to:a+o.node.nodeValue.length,node:o.node}}function _j(n,e,t){let i=lN(n,t);if(!i)return null;let{node:l,from:o,to:a}=i,u=l.nodeValue;if(/[\n\r]/.test(u)||n.state.doc.sliceString(i.from,i.to)!=u)return null;let f=e.invertedDesc;return{range:new Ii(f.mapPos(o),f.mapPos(a),o,a),text:l}}function Lj(n,e){return Cn(n)?(e&&n.childNodes[e-1].contentEditable=="false"?1:0)|(e{ie.from&&(t=!0)}),t}class l0 extends ul{constructor(e){super(),this.height=e}toDOM(){let e=document.createElement("div");return e.className="cm-gap",this.updateDOM(e),e}eq(e){return e.height==this.height}updateDOM(e){return e.style.height=this.height+"px",!0}get editable(){return!0}get estimatedHeight(){return this.height}ignoreEvent(){return!1}}function Fj(n,e,t=1){let i=n.charCategorizer(e),l=n.doc.lineAt(e),o=e-l.from;if(l.length==0)return ae.cursor(e);o==0?t=1:o==l.length&&(t=-1);let a=o,u=o;t<0?a=Sn(l.text,o,!1):u=Sn(l.text,o);let f=i(l.text.slice(a,u));for(;a>0;){let d=Sn(l.text,a,!1);if(i(l.text.slice(d,a))!=f)break;a=d}for(;un.defaultLineHeight*1.5){let u=n.viewState.heightOracle.textHeight,f=Math.floor((l-t.top-(n.defaultLineHeight-u)*.5)/u);o+=f*n.viewState.heightOracle.lineLength}let a=n.state.sliceDoc(t.from,t.to);return t.from+ux(a,o,n.state.tabSize)}function Sx(n,e,t){let i=n.lineBlockAt(e);if(Array.isArray(i.type)){let l;for(let o of i.type){if(o.from>e)break;if(!(o.toe)return o;(!l||o.type==Ln.Text&&(l.type!=o.type||(t<0?o.frome)))&&(l=o)}}return l||i}return i}function Vj(n,e,t,i){let l=Sx(n,e.head,e.assoc||-1),o=!i||l.type!=Ln.Text||!(n.lineWrapping||l.widgetLineBreaks)?null:n.coordsAtPos(e.assoc<0&&e.head>l.from?e.head-1:e.head);if(o){let a=n.dom.getBoundingClientRect(),u=n.textDirectionAt(l.from),f=n.posAndSideAtCoords({x:t==(u==Ot.LTR)?a.right-1:a.left+1,y:(o.top+o.bottom)/2});if(f)return ae.cursor(f.pos,f.assoc)}return ae.cursor(t?l.to:l.from,t?1:-1)}function dS(n,e,t,i){let l=n.state.doc.lineAt(e.head),o=n.bidiSpans(l),a=n.textDirectionAt(l.from);for(let u=e,f=null;;){let d=yj(l,o,a,u,t),m=FO;if(!d){if(l.number==(t?n.state.doc.lines:1))return u;m=` +`,l=n.state.doc.line(l.number+(t?1:-1)),o=n.bidiSpans(l),d=t?ae.cursor(l.from,-1):ae.cursor(l.to,1)}if(f){if(!f(m))return u}else{if(!i)return d;f=i(m)}u=d}}function Qj(n,e,t){let i=n.state.charCategorizer(e),l=i(t);return o=>{let a=i(o);return l==Pt.Space&&(l=a),l==a}}function Xj(n,e,t,i){let l=e.head,o=t?1:-1;if(l==(t?n.state.doc.length:0))return ae.cursor(l,e.assoc);let a=e.goalColumn,u,f=n.contentDOM.getBoundingClientRect(),d=n.coordsAtPos(l,e.assoc||((e.empty?t:e.head==e.from)?1:-1)),m=n.documentTop;if(d)a==null&&(a=d.left-f.left),u=o<0?d.top:d.bottom;else{let w=n.viewState.lineBlockAt(l);a==null&&(a=Math.min(f.right-f.left,n.defaultCharacterWidth*(l-w.from))),u=(o<0?w.top:w.bottom)+m}let g=f.left+a,b=n.viewState.heightOracle.textHeight>>1,v=i??b;for(let w=0;;w+=b){let S=u+(v+w)*o,C=Cx(n,{x:g,y:S},!1,o);if(t?S>f.bottom:Su:R{if(e>o&&el(n)),t.from,e.head>t.from?-1:1);return i==t.from?t:ae.cursor(i,in.viewState.docHeight)return new Mr(n.state.doc.length,-1);if(d=n.elementAtHeight(f),i==null)break;if(d.type==Ln.Text){if(i<0?d.ton.viewport.to)break;let b=n.docView.coordsAt(i<0?d.from:d.to,i>0?-1:1);if(b&&(i<0?b.top<=f+o:b.bottom>=f+o))break}let g=n.viewState.heightOracle.textHeight/2;f=i>0?d.bottom+g:d.top-g}if(n.viewport.from>=d.to||n.viewport.to<=d.from){if(t)return null;if(d.type==Ln.Text){let g=qj(n,l,d,a,u);return new Mr(g,g==d.from?1:-1)}}if(d.type!=Ln.Text)return f<(d.top+d.bottom)/2?new Mr(d.from,1):new Mr(d.to,-1);let m=n.docView.lineAt(d.from,2);return(!m||m.length!=d.length)&&(m=n.docView.lineAt(d.from,-2)),new $j(n,a,u,n.textDirectionAt(d.from)).scanTile(m,d.from)}class $j{constructor(e,t,i,l){this.view=e,this.x=t,this.y=i,this.baseDir=l,this.line=null,this.spans=null}bidiSpansAt(e){return(!this.line||this.line.from>e||this.line.to1||i.length&&(i[0].level!=this.baseDir||i[0].to+l.from>1;t:if(a.has(S)){for(let R=1;R=o&&(M-=w),!a.has(M)){S=M;break t}}break e}a.add(S);let C=t(S),N=0;if(C)for(let R=0;R1))if(M.bottomthis.y)(!d||d.top>M.top)&&(d=M),N=-1;else{let I=M.left>this.x?this.x-M.left:M.right(w+w+S)/3)return this.y=f.bottom-1,this.scan(e,t,!0);if(d&&d.top<(w+S+S)/3)return this.y=d.top+1,this.scan(e,t,!0)}let v=(u?this.dirAt(e[m],1):this.baseDir)==Ot.LTR;return{i:m,after:this.x>(b.left+b.right)/2==v}}scanText(e,t){let i=[];for(let o=0;o{let a=i[o]-t,u=i[o+1]-t;return du(e.dom,a,u).getClientRects()});return l.after?new Mr(i[l.i+1],-1):new Mr(i[l.i],1)}scanTile(e,t){if(!e.length)return new Mr(t,1);if(e.children.length==1){let u=e.children[0];if(u.isText())return this.scanText(u,t);if(u.isComposite())return this.scanTile(u,t)}let i=[t];for(let u=0,f=t;u{let f=e.children[u];return f.flags&48?null:(Cn(f.dom)?f.dom:du(f.dom,0,f.length)).getClientRects()}),o=e.children[l.i],a=i[l.i];return o.isText()?this.scanText(o,a):o.isComposite()?this.scanTile(o,a):l.after?new Mr(i[l.i+1],-1):new Mr(a,1)}}const ta="￿";class Yj{constructor(e,t){this.points=e,this.view=t,this.text="",this.lineSeparator=t.state.facet(dt.lineSeparator)}append(e){this.text+=e}lineBreak(){this.text+=ta}readRange(e,t){if(!e)return this;let i=e.parentNode;for(let l=e;;){this.findPointBefore(i,l);let o=this.text.length;this.readNode(l);let a=Yt.get(l),u=l.nextSibling;if(u==t){a!=null&&a.breakAfter&&!u&&i!=this.view.contentDOM&&this.lineBreak();break}let f=Yt.get(u);(a&&f?a.breakAfter:(a?a.breakAfter:hd(l))||hd(u)&&(l.nodeName!="BR"||a!=null&&a.isWidget())&&this.text.length>o)&&!Kj(u,t)&&this.lineBreak(),l=u}return this.findPointBefore(i,t),this}readTextNode(e){let t=e.nodeValue;for(let i of this.points)i.node==e&&(i.pos=this.text.length+Math.min(i.offset,t.length));for(let i=0,l=this.lineSeparator?null:/\r\n?|\n/g;;){let o=-1,a=1,u;if(this.lineSeparator?(o=t.indexOf(this.lineSeparator,i),a=this.lineSeparator.length):(u=l.exec(t))&&(o=u.index,a=u[0].length),this.append(t.slice(i,o<0?t.length:o)),o<0)break;if(this.lineBreak(),a>1)for(let f of this.points)f.node==e&&f.pos>this.text.length&&(f.pos-=a-1);i=o+a}}readNode(e){let t=Yt.get(e),i=t&&t.overrideDOMText;if(i!=null){this.findPointInside(e,i.length);for(let l=i.iter();!l.next().done;)l.lineBreak?this.lineBreak():this.append(l.value)}else Ca(e)?this.readTextNode(e):e.nodeName=="BR"?e.nextSibling&&this.lineBreak():Cn(e)&&this.readRange(e.firstChild,null)}findPointBefore(e,t){for(let i of this.points)i.node==e&&e.childNodes[i.offset]==t&&(i.pos=this.text.length)}findPointInside(e,t){for(let i of this.points)(Ca(e)?i.node==e:e.contains(i.node))&&(i.pos=this.text.length+(Gj(e,i.node,i.offset)?t:0))}}function Gj(n,e,t){for(;;){if(!e||t-1;let{impreciseHead:o,impreciseAnchor:a}=e.docView,u=e.state.selection;if(e.state.readOnly&&t>-1)this.newSel=null;else if(t>-1&&(this.bounds=oN(e.docView.tile,t,i,0))){let f=o||a?[]:Jj(e),d=new Yj(f,e);d.readRange(this.bounds.startDOM,this.bounds.endDOM),this.text=d.text,this.newSel=eR(f,this.bounds.from)}else{let f=e.observer.selectionRange,d=o&&o.node==f.focusNode&&o.offset==f.focusOffset||!xx(e.contentDOM,f.focusNode)?u.main.head:e.docView.posFromDOM(f.focusNode,f.focusOffset),m=a&&a.node==f.anchorNode&&a.offset==f.anchorOffset||!xx(e.contentDOM,f.anchorNode)?u.main.anchor:e.docView.posFromDOM(f.anchorNode,f.anchorOffset),g=e.viewport;if((we.ios||we.chrome)&&d!=m&&Math.min(d,m)<=u.main.from&&Math.max(d,m)>=u.main.to&&(g.from>0||g.to-1&&u.ranges.length>1)this.newSel=u.replaceRange(ae.range(m,d));else if(e.lineWrapping&&m==d&&!(u.main.empty&&u.main.head==d)&&e.inputState.lastTouchTime>Date.now()-100){let b=e.coordsAtPos(d,-1),v=0;b&&(v=e.inputState.lastTouchY<=b.bottom?-1:1),this.newSel=ae.create([ae.cursor(d,v)])}else this.newSel=ae.single(m,d)}}}function oN(n,e,t,i){if(n.isComposite()){let l=-1,o=-1,a=-1,u=-1;for(let f=0,d=i,m=i;ft)return oN(g,e,t,d);if(b>=e&&l==-1&&(l=f,o=d),d>t&&g.dom.parentNode==n.dom){a=f,u=m;break}m=b,d=b+g.breakAfter}return{from:o,to:u<0?i+n.length:u,startDOM:(l?n.children[l-1].dom.nextSibling:null)||n.dom.firstChild,endDOM:a=0?n.children[a].dom:null}}else return n.isText()?{from:i,to:i+n.length,startDOM:n.dom,endDOM:n.dom.nextSibling}:null}function aN(n,e){let t,{newSel:i}=e,{state:l}=n,o=l.selection.main,a=n.inputState.lastKeyTime>Date.now()-100?n.inputState.lastKeyCode:-1;if(e.bounds){let{from:u,to:f}=e.bounds,d=o.from,m=null;(a===8||we.android&&e.text.length=u&&o.to<=f&&(e.typeOver||g!=e.text)&&g.slice(0,o.from-u)==e.text.slice(0,o.from-u)&&g.slice(o.to-u)==e.text.slice(b=e.text.length-(g.length-(o.to-u)))?t={from:o.from,to:o.to,insert:ft.of(e.text.slice(o.from-u,b).split(ta))}:(v=cN(g,e.text,d-u,m))&&(we.chrome&&a==13&&v.toB==v.from+2&&e.text.slice(v.from,v.toB)==ta+ta&&v.toB--,t={from:u+v.from,to:u+v.toA,insert:ft.of(e.text.slice(v.from,v.toB).split(ta))})}else i&&(!n.hasFocus&&l.facet(il)||Ox(i,o))&&(i=null);if(!t&&!i)return!1;if((we.mac||we.android)&&t&&t.from==t.to&&t.from==o.head-1&&/^\. ?$/.test(t.insert.toString())&&n.contentDOM.getAttribute("autocorrect")=="off"?(i&&t.insert.length==2&&(i=ae.single(i.main.anchor-1,i.main.head-1)),t={from:t.from,to:t.to,insert:ft.of([t.insert.toString().replace("."," ")])}):l.doc.lineAt(o.from).toDate.now()-50?t={from:o.from,to:o.to,insert:l.toText(n.inputState.insertingText)}:we.chrome&&t&&t.from==t.to&&t.from==o.head&&t.insert.toString()==` + `&&n.lineWrapping&&(i&&(i=ae.single(i.main.anchor-1,i.main.head-1)),t={from:o.from,to:o.to,insert:ft.of([" "])}),t)return jy(n,t,i,a);if(i&&!Ox(i,o)){let u=!1,f="select";return n.inputState.lastSelectionTime>Date.now()-50&&(n.inputState.lastSelectionOrigin=="select"&&(u=!0),f=n.inputState.lastSelectionOrigin,f=="select.pointer"&&(i=sN(l.facet(Au).map(d=>d(n)),i))),n.dispatch({selection:i,scrollIntoView:u,userEvent:f}),!0}else return!1}function jy(n,e,t,i=-1){if(we.ios&&n.inputState.flushIOSKey(e))return!0;let l=n.state.selection.main;if(we.android&&(e.to==l.to&&(e.from==l.from||e.from==l.from-1&&n.state.sliceDoc(e.from,l.from)==" ")&&e.insert.length==1&&e.insert.lines==2&&pa(n.contentDOM,"Enter",13)||(e.from==l.from-1&&e.to==l.to&&e.insert.length==0||i==8&&e.insert.lengthl.head)&&pa(n.contentDOM,"Backspace",8)||e.from==l.from&&e.to==l.to+1&&e.insert.length==0&&pa(n.contentDOM,"Delete",46)))return!0;let o=e.insert.toString();n.inputState.composing>=0&&n.inputState.composing++;let a,u=()=>a||(a=Zj(n,e,t));return n.state.facet($O).some(f=>f(n,e.from,e.to,o,u))||n.dispatch(u()),!0}function Zj(n,e,t){let i,l=n.state,o=l.selection.main,a=-1;if(e.from==e.to&&e.fromo.to){let f=e.fromg(n)),d,f);e.from==m&&(a=m)}if(a>-1)i={changes:e,selection:ae.cursor(e.from+e.insert.length,-1)};else if(e.from>=o.from&&e.to<=o.to&&e.to-e.from>=(o.to-o.from)/3&&(!t||t.main.empty&&t.main.from==e.from+e.insert.length)&&n.inputState.composing<0){let f=o.frome.to?l.sliceDoc(e.to,o.to):"";i=l.replaceSelection(n.state.toText(f+e.insert.sliceString(0,void 0,n.state.lineBreak)+d))}else{let f=l.changes(e),d=t&&t.main.to<=f.newLength?t.main:void 0;if(l.selection.ranges.length>1&&(n.inputState.composing>=0||n.inputState.compositionPendingChange)&&e.to<=o.to+10&&e.to>=o.to-10){let m=n.state.sliceDoc(e.from,e.to),g,b=t&&lN(n,t.main.head);if(b){let w=e.insert.length-(e.to-e.from);g={from:b.from,to:b.to-w}}else g=n.state.doc.lineAt(o.head);let v=o.to-e.to;i=l.changeByRange(w=>{if(w.from==o.from&&w.to==o.to)return{changes:f,range:d||w.map(f)};let S=w.to-v,C=S-m.length;if(n.state.sliceDoc(C,S)!=m||S>=g.from&&C<=g.to)return{range:w};let N=l.changes({from:C,to:S,insert:e.insert}),R=w.to-o.to;return{changes:N,range:d?ae.range(Math.max(0,d.anchor+R),Math.max(0,d.head+R)):w.map(N)}})}else i={changes:f,selection:d&&l.selection.replaceRange(d)}}let u="input.type";return(n.composing||n.inputState.compositionPendingChange&&n.inputState.compositionEndedAt>Date.now()-50)&&(n.inputState.compositionPendingChange=!1,u+=".compose",n.inputState.compositionFirstChange&&(u+=".start",n.inputState.compositionFirstChange=!1)),l.update(i,{userEvent:u,scrollIntoView:!0})}function cN(n,e,t,i){let l=Math.min(n.length,e.length),o=0;for(;o0&&u>0&&n.charCodeAt(a-1)==e.charCodeAt(u-1);)a--,u--;if(i=="end"){let f=Math.max(0,o-Math.min(a,u));t-=a+f-o}if(a=a?o-t:0;o-=f,u=o+(u-a),a=o}else if(u=u?o-t:0;o-=f,a=o+(a-u),u=o}return{from:o,toA:a,toB:u}}function Jj(n){let e=[];if(n.root.activeElement!=n.contentDOM)return e;let{anchorNode:t,anchorOffset:i,focusNode:l,focusOffset:o}=n.observer.selectionRange;return t&&(e.push(new mS(t,i)),(l!=t||o!=i)&&e.push(new mS(l,o))),e}function eR(n,e){if(n.length==0)return null;let t=n[0].pos,i=n.length==2?n[1].pos:t;return t<0||i<0?null:t==i?ae.create([ae.cursor(i+e,-1)]):ae.single(t+e,i+e)}function Ox(n,e){return e.head==n.main.head&&e.anchor==n.main.anchor}class tR{setSelectionOrigin(e){this.lastSelectionOrigin=e,this.lastSelectionTime=Date.now()}constructor(e){this.view=e,this.lastKeyCode=0,this.lastKeyTime=0,this.touchActive=!1,this.lastTouchTime=0,this.lastTouchX=0,this.lastTouchY=0,this.lastFocusTime=0,this.lastScrollTop=0,this.lastScrollLeft=0,this.lastWheelEvent=0,this.pendingIOSKey=void 0,this.lastIOSMomentumScroll=0,this.tabFocusMode=-1,this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastContextMenu=0,this.scrollHandlers=[],this.handlers=Object.create(null),this.composing=-1,this.compositionFirstChange=null,this.compositionEndedAt=0,this.compositionPendingKey=!1,this.compositionPendingChange=!1,this.insertingText="",this.insertingTextAt=0,this.mouseSelection=null,this.draggedContent=null,this.handleEvent=this.handleEvent.bind(this),this.notifiedFocused=e.hasFocus,we.safari&&e.contentDOM.addEventListener("input",()=>null),we.gecko&&xR(e.contentDOM.ownerDocument)}handleEvent(e){!uR(this.view,e)||this.ignoreDuringComposition(e)||e.type=="keydown"&&this.keydown(e)||(this.view.updateState!=0?Promise.resolve().then(()=>this.runHandlers(e.type,e)):this.runHandlers(e.type,e))}runHandlers(e,t){let i=this.handlers[e];if(i){for(let l of i.observers)l(this.view,t);for(let l of i.handlers){if(t.defaultPrevented)break;if(l(this.view,t)){t.preventDefault();break}}}}ensureHandlers(e){let t=iR(e),i=this.handlers,l=this.view.contentDOM;for(let o in t)if(o!="scroll"){let a=!t[o].handlers.length,u=i[o];u&&a!=!u.handlers.length&&(l.removeEventListener(o,this.handleEvent),u=null),u||l.addEventListener(o,this.handleEvent,{passive:a})}for(let o in i)o!="scroll"&&!t[o]&&l.removeEventListener(o,this.handleEvent);this.handlers=t}keydown(e){if(this.lastKeyCode=e.keyCode,this.lastKeyTime=Date.now(),e.keyCode==9&&this.tabFocusMode>-1&&(!this.tabFocusMode||Date.now()<=this.tabFocusMode))return!0;if(this.tabFocusMode>0&&e.keyCode!=27&&fN.indexOf(e.keyCode)<0&&(this.tabFocusMode=-1),we.android&&we.chrome&&!e.synthetic&&(e.keyCode==13||e.keyCode==8))return this.view.observer.delayAndroidKey(e.key,e.keyCode),!0;if(we.ios&&!e.synthetic&&!e.altKey&&!e.metaKey&&(uN.some(t=>t.keyCode==e.keyCode)&&!e.ctrlKey||rR.indexOf(e.key)>-1&&e.ctrlKey)){let t={ctrlKey:e.ctrlKey,altKey:e.altKey,metaKey:e.metaKey,shiftKey:e.shiftKey};t.shiftKey&&we.ios&&!/^(off|none)$/.test(this.view.contentDOM.autocapitalize)&&nR(this.view.win)&&(t.shiftKey=!1);let i=this.pendingIOSKey={key:e.key,keyCode:e.keyCode,mods:t};return setTimeout(()=>{this.pendingIOSKey==i&&this.flushIOSKey()},50),!0}return e.keyCode!=229&&this.view.observer.forceFlush(),!1}flushIOSKey(e){let t=this.pendingIOSKey;return!t||this.view.observer.pendingRecords().length||t.key=="Enter"&&e&&e.from0?!0:we.safari&&!we.ios&&this.compositionPendingKey&&Date.now()-this.compositionEndedAt<100?(this.compositionPendingKey=!1,!0):!1}startMouseSelection(e){this.mouseSelection&&this.mouseSelection.destroy(),this.mouseSelection=e}update(e){this.view.observer.update(e),this.mouseSelection&&this.mouseSelection.update(e),this.draggedContent&&e.docChanged&&(this.draggedContent=this.draggedContent.map(e.changes)),e.transactions.length&&(this.lastKeyCode=this.lastSelectionTime=0)}destroy(){this.mouseSelection&&this.mouseSelection.destroy()}}function nR(n){return n.visualViewport?n.visualViewport.height*n.visualViewport.scale/n.document.documentElement.clientHeight<.85:!1}function pS(n,e){return(t,i)=>{try{return e.call(n,i,t)}catch(l){di(t.state,l)}}}function iR(n){let e=Object.create(null);function t(i){return e[i]||(e[i]={observers:[],handlers:[]})}for(let i of n){let l=i.spec,o=l&&l.plugin.domEventHandlers,a=l&&l.plugin.domEventObservers;if(o)for(let u in o){let f=o[u];f&&t(u).handlers.push(pS(i.value,f))}if(a)for(let u in a){let f=a[u];f&&t(u).observers.push(pS(i.value,f))}}for(let i in rr)t(i).handlers.push(rr[i]);for(let i in Zn)t(i).observers.push(Zn[i]);return e}const uN=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Enter",keyCode:13,inputType:"insertLineBreak"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],rR="dthko",fN=[16,17,18,20,91,92,224,225],xh=6;function yh(n){return Math.max(0,n)*.7+8}function lR(n,e){return Math.max(Math.abs(n.clientX-e.clientX),Math.abs(n.clientY-e.clientY))}class sR{constructor(e,t,i,l){this.view=e,this.startEvent=t,this.style=i,this.mustSelect=l,this.scrollSpeed={x:0,y:0},this.scrolling=-1,this.lastEvent=t,this.scrollParents=DO(e.contentDOM),this.atoms=e.state.facet(Au).map(a=>a(e));let o=e.contentDOM.ownerDocument;o.addEventListener("mousemove",this.move=this.move.bind(this)),o.addEventListener("mouseup",this.up=this.up.bind(this)),this.extend=t.shiftKey,this.multiple=e.state.facet(dt.allowMultipleSelections)&&oR(e,t),this.dragging=cR(e,t)&&mN(t)==1?null:!1}start(e){this.dragging===!1&&this.select(e)}move(e){if(e.buttons==0)return this.destroy();if(this.dragging||this.dragging==null&&lR(this.startEvent,e)<10)return;this.select(this.lastEvent=e);let t=0,i=0,l=0,o=0,a=this.view.win.innerWidth,u=this.view.win.innerHeight;this.scrollParents.x&&({left:l,right:a}=this.scrollParents.x.getBoundingClientRect()),this.scrollParents.y&&({top:o,bottom:u}=this.scrollParents.y.getBoundingClientRect());let f=Dy(this.view);e.clientX-f.left<=l+xh?t=-yh(l-e.clientX):e.clientX+f.right>=a-xh&&(t=yh(e.clientX-a)),e.clientY-f.top<=o+xh?i=-yh(o-e.clientY):e.clientY+f.bottom>=u-xh&&(i=yh(e.clientY-u)),this.setScrollSpeed(t,i)}up(e){this.dragging==null&&this.select(this.lastEvent),this.dragging||e.preventDefault(),this.destroy()}destroy(){this.setScrollSpeed(0,0);let e=this.view.contentDOM.ownerDocument;e.removeEventListener("mousemove",this.move),e.removeEventListener("mouseup",this.up),this.view.inputState.mouseSelection=this.view.inputState.draggedContent=null}setScrollSpeed(e,t){this.scrollSpeed={x:e,y:t},e||t?this.scrolling<0&&(this.scrolling=setInterval(()=>this.scroll(),50)):this.scrolling>-1&&(clearInterval(this.scrolling),this.scrolling=-1)}scroll(){let{x:e,y:t}=this.scrollSpeed;e&&this.scrollParents.x&&(this.scrollParents.x.scrollLeft+=e,e=0),t&&this.scrollParents.y&&(this.scrollParents.y.scrollTop+=t,t=0),(e||t)&&this.view.win.scrollBy(e,t),this.dragging===!1&&this.select(this.lastEvent)}select(e){let{view:t}=this,i=sN(this.atoms,this.style.get(e,this.extend,this.multiple));(this.mustSelect||!i.eq(t.state.selection,this.dragging===!1))&&this.view.dispatch({selection:i,userEvent:"select.pointer"}),this.mustSelect=!1}update(e){e.transactions.some(t=>t.isUserEvent("input.type"))?this.destroy():this.style.update(e)&&setTimeout(()=>this.select(this.lastEvent),20)}}function oR(n,e){let t=n.state.facet(qO);return t.length?t[0](e):we.mac?e.metaKey:e.ctrlKey}function aR(n,e){let t=n.state.facet(VO);return t.length?t[0](e):we.mac?!e.altKey:!e.ctrlKey}function cR(n,e){let{main:t}=n.state.selection;if(t.empty)return!1;let i=hu(n.root);if(!i||i.rangeCount==0)return!0;let l=i.getRangeAt(0).getClientRects();for(let o=0;o=e.clientX&&a.top<=e.clientY&&a.bottom>=e.clientY)return!0}return!1}function uR(n,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let t=e.target,i;t!=n.contentDOM;t=t.parentNode)if(!t||t.nodeType==11||(i=Yt.get(t))&&i.isWidget()&&!i.isHidden&&i.widget.ignoreEvent(e))return!1;return!0}const rr=Object.create(null),Zn=Object.create(null),hN=we.ie&&we.ie_version<15||we.ios&&we.webkit_version<604;function fR(n){let e=n.dom.parentNode;if(!e)return;let t=e.appendChild(document.createElement("textarea"));t.style.cssText="position: fixed; left: -10000px; top: 10px",t.focus(),setTimeout(()=>{n.focus(),t.remove(),dN(n,t.value)},50)}function Jd(n,e,t){for(let i of n.facet(e))t=i(t,n);return t}function dN(n,e){e=Jd(n.state,Ty,e);let{state:t}=n,i,l=1,o=t.toText(e),a=o.lines==t.selection.ranges.length;if(Nx!=null&&t.selection.ranges.every(f=>f.empty)&&Nx==o.toString()){let f=-1;i=t.changeByRange(d=>{let m=t.doc.lineAt(d.from);if(m.from==f)return{range:d};f=m.from;let g=t.toText((a?o.line(l++).text:e)+t.lineBreak);return{changes:{from:m.from,insert:g},range:ae.cursor(d.from+g.length,-1)}})}else a?i=t.changeByRange(f=>{let d=o.line(l++);return{changes:{from:f.from,to:f.to,insert:d.text},range:ae.cursor(f.from+d.length,-1)}}):i=t.replaceSelection(o);n.dispatch(i,{userEvent:"input.paste",scrollIntoView:!0})}Zn.scroll=n=>{let e=n.inputState;e.lastScrollTop=n.scrollDOM.scrollTop,e.lastScrollLeft=n.scrollDOM.scrollLeft,we.ios&&!e.touchActive&&(e.lastIOSMomentumScroll=Date.now())};Zn.wheel=Zn.mousewheel=n=>{n.inputState.lastWheelEvent=Date.now()};rr.keydown=(n,e)=>(n.inputState.setSelectionOrigin("select"),e.keyCode==27&&n.inputState.tabFocusMode!=0&&(n.inputState.tabFocusMode=Date.now()+2e3),!1);Zn.touchstart=(n,e)=>{let t=n.inputState,i=e.targetTouches[0];t.touchActive=!0,t.lastTouchTime=Date.now(),i&&(t.lastTouchX=i.clientX,t.lastTouchY=i.clientY),t.setSelectionOrigin("select.pointer")};Zn.touchmove=n=>{n.inputState.setSelectionOrigin("select.pointer")};Zn.touchend=(n,e)=>{n.inputState.touchActive=!1};rr.mousedown=(n,e)=>{if(n.observer.flush(),n.inputState.lastTouchTime>Date.now()-2e3)return!1;let t=null;for(let i of n.state.facet(QO))if(t=i(n,e),t)break;if(!t&&e.button==0&&(t=dR(n,e)),t){let i=!n.hasFocus;n.inputState.startMouseSelection(new sR(n,e,t,i)),i&&n.observer.ignore(()=>{_O(n.contentDOM);let o=n.root.activeElement;o&&!o.contains(n.contentDOM)&&o.blur()});let l=n.inputState.mouseSelection;if(l)return l.start(e),l.dragging===!1}else n.inputState.setSelectionOrigin("select.pointer");return!1};function gS(n,e,t,i){if(i==1)return ae.cursor(e,t);if(i==2)return Fj(n.state,e,t);{let l=n.docView.lineAt(e,t),o=n.state.doc.lineAt(l?l.posAtEnd:e),a=l?l.posAtStart:o.from,u=l?l.posAtEnd:o.to;return uDate.now()-400&&Math.abs(e.clientX-n.clientX)<2&&Math.abs(e.clientY-n.clientY)<2?(yS+1)%3:1}function dR(n,e){let t=n.posAndSideAtCoords({x:e.clientX,y:e.clientY},!1),i=mN(e),l=n.state.selection;return{update(o){o.docChanged&&(t.pos=o.changes.mapPos(t.pos),l=l.map(o.changes))},get(o,a,u){let f=n.posAndSideAtCoords({x:o.clientX,y:o.clientY},!1),d,m=gS(n,f.pos,f.assoc,i);if(t.pos!=f.pos&&!a){let g=gS(n,t.pos,t.assoc,i),b=Math.min(g.from,m.from),v=Math.max(g.to,m.to);m=b1&&(d=mR(l,f.pos))?d:u?l.addRange(m):ae.create([m])}}}function mR(n,e){for(let t=0;t=e)return ae.create(n.ranges.slice(0,t).concat(n.ranges.slice(t+1)),n.mainIndex==t?0:n.mainIndex-(n.mainIndex>t?1:0))}return null}rr.dragstart=(n,e)=>{let{selection:{main:t}}=n.state;if(e.target.draggable){let l=n.docView.tile.nearest(e.target);if(l&&l.isWidget()){let o=l.posAtStart,a=o+l.length;(o>=t.to||a<=t.from)&&(t=ae.undirectionalRange(o,a))}}let{inputState:i}=n;return i.mouseSelection&&(i.mouseSelection.dragging=!0),i.draggedContent=t,e.dataTransfer&&(e.dataTransfer.setData("Text",Jd(n.state,Ay,n.state.sliceDoc(t.from,t.to))),e.dataTransfer.effectAllowed="copyMove"),!1};rr.dragend=n=>(n.inputState.draggedContent=null,!1);function vS(n,e,t,i){if(t=Jd(n.state,Ty,t),!t)return;let l=n.posAtCoords({x:e.clientX,y:e.clientY},!1),{draggedContent:o}=n.inputState,a=i&&o&&aR(n,e)?{from:o.from,to:o.to}:null,u={from:l,insert:t},f=n.state.changes(a?[a,u]:u);n.focus(),n.dispatch({changes:f,selection:{anchor:f.mapPos(l,-1),head:f.mapPos(l,1)},userEvent:a?"move.drop":"input.drop"}),n.inputState.draggedContent=null}rr.drop=(n,e)=>{if(!e.dataTransfer)return!1;if(n.state.readOnly)return!0;let t=e.dataTransfer.files;if(t&&t.length){let i=Array(t.length),l=0,o=()=>{++l==t.length&&vS(n,e,i.filter(a=>a!=null).join(n.state.lineBreak),!1)};for(let a=0;a{/[\x00-\x08\x0e-\x1f]{2}/.test(u.result)||(i[a]=u.result),o()},u.readAsText(t[a])}return!0}else{let i=e.dataTransfer.getData("Text");if(i)return vS(n,e,i,!0),!0}return!1};rr.paste=(n,e)=>{if(n.state.readOnly)return!0;n.observer.flush();let t=hN?null:e.clipboardData;return t?(dN(n,t.getData("text/plain")||t.getData("text/uri-list")),!0):(fR(n),!1)};function pR(n,e){let t=n.dom.parentNode;if(!t)return;let i=t.appendChild(document.createElement("textarea"));i.style.cssText="position: fixed; left: -10000px; top: 10px",i.value=e,i.focus(),i.selectionEnd=e.length,i.selectionStart=0,setTimeout(()=>{i.remove(),n.focus()},50)}function gR(n){let e=[],t=[],i=!1;for(let l of n.selection.ranges)l.empty||(e.push(n.sliceDoc(l.from,l.to)),t.push(l));if(!e.length){let l=-1;for(let{from:o}of n.selection.ranges){let a=n.doc.lineAt(o);a.number>l&&(e.push(a.text),t.push({from:a.from,to:Math.min(n.doc.length,a.to+1)})),l=a.number}i=!0}return{text:Jd(n,Ay,e.join(n.lineBreak)),ranges:t,linewise:i}}let Nx=null;rr.copy=rr.cut=(n,e)=>{if(!Zc(n.contentDOM,n.observer.selectionRange))return!1;let{text:t,ranges:i,linewise:l}=gR(n.state);if(!t&&!l)return!1;Nx=l?t:null,e.type=="cut"&&!n.state.readOnly&&n.dispatch({changes:i,scrollIntoView:!0,userEvent:"delete.cut"});let o=hN?null:e.clipboardData;return o?(o.clearData(),o.setData("text/plain",t),!0):(pR(n,t),!1)};const pN=cl.define();function gN(n,e){let t=[];for(let i of n.facet(YO)){let l=i(n,e);l&&t.push(l)}return t.length?n.update({effects:t,annotations:pN.of(!0)}):null}function xN(n){setTimeout(()=>{let e=n.hasFocus;if(e!=n.inputState.notifiedFocused){let t=gN(n.state,e);t?n.dispatch(t):n.update([])}},10)}Zn.focus=n=>{n.inputState.lastFocusTime=Date.now(),!n.scrollDOM.scrollTop&&(n.inputState.lastScrollTop||n.inputState.lastScrollLeft)&&(n.scrollDOM.scrollTop=n.inputState.lastScrollTop,n.scrollDOM.scrollLeft=n.inputState.lastScrollLeft),xN(n)};Zn.blur=n=>{n.observer.clearSelectionRange(),xN(n)};Zn.compositionstart=Zn.compositionupdate=(n,e)=>{if(!n.observer.editContext&&(n.inputState.compositionFirstChange==null&&(n.inputState.compositionFirstChange=!0),n.inputState.composing<0)){let{main:t}=n.state.selection;!t.empty&&n.lineBlockAt(t.from).from!=n.lineBlockAt(t.to).from&&!n.state.readOnly&&n.dispatch({changes:n.state.selection.ranges.filter(i=>!i.empty).map(i=>({from:i.from,to:i.to})),userEvent:"input"}),n.inputState.composing=0}};Zn.compositionend=n=>{n.observer.editContext||(n.inputState.composing=-1,n.inputState.compositionEndedAt=Date.now(),n.inputState.compositionPendingKey=!0,n.inputState.compositionPendingChange=n.observer.pendingRecords().length>0,n.inputState.compositionFirstChange=null,we.chrome&&we.android?n.observer.flushSoon():n.inputState.compositionPendingChange?Promise.resolve().then(()=>n.observer.flush()):setTimeout(()=>{n.inputState.composing<0&&n.docView.hasComposition&&n.update([])},50))};Zn.contextmenu=n=>{n.inputState.lastContextMenu=Date.now()};rr.beforeinput=(n,e)=>{var t,i;if((e.inputType=="insertText"||e.inputType=="insertCompositionText")&&(n.inputState.insertingText=e.data,n.inputState.insertingTextAt=Date.now()),e.inputType=="insertReplacementText"&&n.observer.editContext){let o=(t=e.dataTransfer)===null||t===void 0?void 0:t.getData("text/plain"),a=e.getTargetRanges();if(o&&a.length){let u=a[0],f=n.posAtDOM(u.startContainer,u.startOffset),d=n.posAtDOM(u.endContainer,u.endOffset);return jy(n,{from:f,to:d,insert:n.state.toText(o)},null),!0}}let l;if(we.chrome&&we.android&&(l=uN.find(o=>o.inputType==e.inputType))&&(n.observer.delayAndroidKey(l.key,l.keyCode),l.key=="Backspace"||l.key=="Delete")){let o=((i=window.visualViewport)===null||i===void 0?void 0:i.height)||0;setTimeout(()=>{var a;(((a=window.visualViewport)===null||a===void 0?void 0:a.height)||0)>o+10&&n.hasFocus&&(n.contentDOM.blur(),n.focus())},100)}return we.ios&&e.inputType=="deleteContentForward"&&n.observer.flushSoon(),we.safari&&e.inputType=="insertText"&&n.inputState.composing>=0&&setTimeout(()=>Zn.compositionend(n,e),20),!1};const wS=new Set;function xR(n){wS.has(n)||(wS.add(n),n.addEventListener("copy",()=>{}),n.addEventListener("cut",()=>{}))}const kS=["pre-wrap","normal","pre-line","break-spaces"];let Aa=!1;function SS(){Aa=!1}class yR{constructor(e){this.lineWrapping=e,this.doc=ft.empty,this.heightSamples={},this.lineHeight=14,this.charWidth=7,this.textHeight=14,this.lineLength=30}heightForGap(e,t){let i=this.doc.lineAt(t).number-this.doc.lineAt(e).number+1;return this.lineWrapping&&(i+=Math.max(0,Math.ceil((t-e-i*this.lineLength*.5)/this.lineLength))),this.lineHeight*i}heightForLine(e){return this.lineWrapping?(1+Math.max(0,Math.ceil((e-this.lineLength)/Math.max(1,this.lineLength-5))))*this.lineHeight:this.lineHeight}setDoc(e){return this.doc=e,this}mustRefreshForWrapping(e){return kS.indexOf(e)>-1!=this.lineWrapping}mustRefreshForHeights(e){let t=!1;for(let i=0;i-1,f=Math.abs(t-this.lineHeight)>.3||this.lineWrapping!=u;if(this.lineWrapping=u,this.lineHeight=t,this.charWidth=i,this.textHeight=l,this.lineLength=o,f){this.heightSamples={};for(let d=0;d0}set outdated(e){this.flags=(e?2:0)|this.flags&-3}setHeight(e){this.height!=e&&(Math.abs(this.height-e)>Jh&&(Aa=!0),this.height=e)}replace(e,t,i){return Wn.of(i)}decomposeLeft(e,t){t.push(this)}decomposeRight(e,t){t.push(this)}applyChanges(e,t,i,l){let o=this,a=i.doc;for(let u=l.length-1;u>=0;u--){let{fromA:f,toA:d,fromB:m,toB:g}=l[u],b=o.lineAt(f,Rt.ByPosNoHeight,i.setDoc(t),0,0),v=b.to>=d?b:o.lineAt(d,Rt.ByPosNoHeight,i,0,0);for(g+=v.to-d,d=v.to;u>0&&b.from<=l[u-1].toA;)f=l[u-1].fromA,m=l[u-1].fromB,u--,fo*2){let u=e[t-1];u.break?e.splice(--t,1,u.left,null,u.right):e.splice(--t,1,u.left,u.right),i+=1+u.break,l-=u.size}else if(o>l*2){let u=e[i];u.break?e.splice(i,1,u.left,null,u.right):e.splice(i,1,u.left,u.right),i+=2+u.break,o-=u.size}else break;else if(l=o&&a(this.lineAt(0,Rt.ByPos,i,l,o))}setMeasuredHeight(e){let t=e.heights[e.index++];t<0?(this.spaceAbove=-t,t=e.heights[e.index++]):this.spaceAbove=0,this.setHeight(t)}updateHeight(e,t=0,i=!1,l){return l&&l.from<=t&&l.more&&this.setMeasuredHeight(l),this.outdated=!1,this}toString(){return`block(${this.length})`}}class Ti extends yN{constructor(e,t,i){super(e,t,null),this.collapsed=0,this.widgetHeight=0,this.breaks=0,this.spaceAbove=i}mainBlock(e,t){return new Ji(t,this.length,e+this.spaceAbove,this.height-this.spaceAbove,this.breaks)}replace(e,t,i){let l=i[0];return i.length==1&&(l instanceof Ti||l instanceof Dn&&l.flags&4)&&Math.abs(this.length-l.length)<10?(l instanceof Dn?l=new Ti(l.length,this.height,this.spaceAbove):l.height=this.height,this.outdated||(l.outdated=!1),l):Wn.of(i)}updateHeight(e,t=0,i=!1,l){return l&&l.from<=t&&l.more?this.setMeasuredHeight(l):(i||this.outdated)&&(this.spaceAbove=0,this.setHeight(Math.max(this.widgetHeight,e.heightForLine(this.length-this.collapsed))+this.breaks*e.lineHeight)),this.outdated=!1,this}toString(){return`line(${this.length}${this.collapsed?-this.collapsed:""}${this.widgetHeight?":"+this.widgetHeight:""})`}}class Dn extends Wn{constructor(e){super(e,0)}heightMetrics(e,t){let i=e.doc.lineAt(t).number,l=e.doc.lineAt(t+this.length).number,o=l-i+1,a,u=0;if(e.lineWrapping){let f=Math.min(this.height,e.lineHeight*o);a=f/o,this.length>o+1&&(u=(this.height-f)/(this.length-o-1))}else a=this.height/o;return{firstLine:i,lastLine:l,perLine:a,perChar:u}}blockAt(e,t,i,l){let{firstLine:o,lastLine:a,perLine:u,perChar:f}=this.heightMetrics(t,l);if(t.lineWrapping){let d=l+(e0){let o=i[i.length-1];o instanceof Dn?i[i.length-1]=new Dn(o.length+l):i.push(null,new Dn(l-1))}if(e>0){let o=i[0];o instanceof Dn?i[0]=new Dn(e+o.length):i.unshift(new Dn(e-1),null)}return Wn.of(i)}decomposeLeft(e,t){t.push(new Dn(e-1),null)}decomposeRight(e,t){t.push(null,new Dn(this.length-e-1))}updateHeight(e,t=0,i=!1,l){let o=t+this.length;if(l&&l.from<=t+this.length&&l.more){let a=[],u=Math.max(t,l.from),f=-1;for(l.from>t&&a.push(new Dn(l.from-t-1).updateHeight(e,t));u<=o&&l.more;){let m=e.doc.lineAt(u).length;a.length&&a.push(null);let g=l.heights[l.index++],b=0;g<0&&(b=-g,g=l.heights[l.index++]),f==-1?f=g:Math.abs(g-f)>=Jh&&(f=-2);let v=new Ti(m,g,b);v.outdated=!1,a.push(v),u+=m+1}u<=o&&a.push(null,new Dn(o-u).updateHeight(e,u));let d=Wn.of(a);return(f<0||Math.abs(d.height-this.height)>=Jh||Math.abs(f-this.heightMetrics(e,t).perLine)>=Jh)&&(Aa=!0),xd(this,d)}else(i||this.outdated)&&(this.setHeight(e.heightForGap(t,t+this.length)),this.outdated=!1);return this}toString(){return`gap(${this.length})`}}class wR extends Wn{constructor(e,t,i){super(e.length+(t?1:0)+i.length,e.height+i.height,(t?1:0)|(e.outdated||i.outdated?2:0)),this.left=e,this.right=i,this.size=e.size+i.size}get break(){return this.flags&1}blockAt(e,t,i,l){let o=i+this.left.height;return eu))return d;let m=t==Rt.ByPosNoHeight?Rt.ByPosNoHeight:Rt.ByPos;return f?d.join(this.right.lineAt(u,m,i,a,u)):this.left.lineAt(u,m,i,l,o).join(d)}forEachLine(e,t,i,l,o,a){let u=l+this.left.height,f=o+this.left.length+this.break;if(this.break)e=f&&this.right.forEachLine(e,t,i,u,f,a);else{let d=this.lineAt(f,Rt.ByPos,i,l,o);e=e&&d.from<=t&&a(d),t>d.to&&this.right.forEachLine(Math.max(e,d.to+1),t,i,u,f,a)}}replace(e,t,i){let l=this.left.length+this.break;if(tthis.left.length)return this.balanced(this.left,this.right.replace(e-l,t-l,i));let o=[];e>0&&this.decomposeLeft(e,o);let a=o.length;for(let u of i)o.push(u);if(e>0&&CS(o,a-1),t=i&&t.push(null)),e>i&&this.right.decomposeLeft(e-i,t)}decomposeRight(e,t){let i=this.left.length,l=i+this.break;if(e>=l)return this.right.decomposeRight(e-l,t);e2*t.size||t.size>2*e.size?Wn.of(this.break?[e,null,t]:[e,t]):(this.left=xd(this.left,e),this.right=xd(this.right,t),this.setHeight(e.height+t.height),this.outdated=e.outdated||t.outdated,this.size=e.size+t.size,this.length=e.length+this.break+t.length,this)}updateHeight(e,t=0,i=!1,l){let{left:o,right:a}=this,u=t+o.length+this.break,f=null;return l&&l.from<=t+o.length&&l.more?f=o=o.updateHeight(e,t,i,l):o.updateHeight(e,t,i),l&&l.from<=u+a.length&&l.more?f=a=a.updateHeight(e,u,i,l):a.updateHeight(e,u,i),f?this.balanced(o,a):(this.height=this.left.height+this.right.height,this.outdated=!1,this)}toString(){return this.left+(this.break?" ":"-")+this.right}}function CS(n,e){let t,i;n[e]==null&&(t=n[e-1])instanceof Dn&&(i=n[e+1])instanceof Dn&&n.splice(e-1,3,new Dn(t.length+1+i.length))}const kR=5;class Ry{constructor(e,t){this.pos=e,this.oracle=t,this.nodes=[],this.lineStart=-1,this.lineEnd=-1,this.covering=null,this.writtenTo=e}get isCovered(){return this.covering&&this.nodes[this.nodes.length-1]==this.covering}span(e,t){if(this.lineStart>-1){let i=Math.min(t,this.lineEnd),l=this.nodes[this.nodes.length-1];l instanceof Ti?l.length+=i-this.pos:(i>this.pos||!this.isCovered)&&this.nodes.push(new Ti(i-this.pos,-1,0)),this.writtenTo=i,t>i&&(this.nodes.push(null),this.writtenTo++,this.lineStart=-1)}this.pos=t}point(e,t,i){if(e=kR)&&this.addLineDeco(l,o,a)}else t>e&&this.span(e,t);this.lineEnd>-1&&this.lineEnd-1)return;let{from:e,to:t}=this.oracle.doc.lineAt(this.pos);this.lineStart=e,this.lineEnd=t,this.writtenToe&&this.nodes.push(new Ti(this.pos-e,-1,0)),this.writtenTo=this.pos}blankContent(e,t){let i=new Dn(t-e);return this.oracle.doc.lineAt(e).to==t&&(i.flags|=4),i}ensureLine(){this.enterLine();let e=this.nodes.length?this.nodes[this.nodes.length-1]:null;if(e instanceof Ti)return e;let t=new Ti(0,-1,0);return this.nodes.push(t),t}addBlock(e){this.enterLine();let t=e.deco;t&&t.startSide>0&&!this.isCovered&&this.ensureLine(),this.nodes.push(e),this.writtenTo=this.pos=this.pos+e.length,t&&t.endSide>0&&(this.covering=e)}addLineDeco(e,t,i){let l=this.ensureLine();l.length+=i,l.collapsed+=i,l.widgetHeight=Math.max(l.widgetHeight,e),l.breaks+=t,this.writtenTo=this.pos=this.pos+i}finish(e){let t=this.nodes.length==0?null:this.nodes[this.nodes.length-1];this.lineStart>-1&&!(t instanceof Ti)&&!this.isCovered?this.nodes.push(new Ti(0,-1,0)):(this.writtenTod.clientHeight||d.scrollWidth>d.clientWidth)&&m.overflow!="visible"){let g=d.getBoundingClientRect();o=Math.max(o,g.left),a=Math.min(a,g.right),u=Math.max(u,g.top),f=Math.min(d==n.parentNode?l.innerHeight:f,g.bottom)}d=m.position=="absolute"||m.position=="fixed"?d.offsetParent:d.parentNode}else if(d.nodeType==11)d=d.host;else break;return{left:o-t.left,right:Math.max(o,a)-t.left,top:u-(t.top+e),bottom:Math.max(u,f)-(t.top+e)}}function NR(n){let e=n.getBoundingClientRect(),t=n.ownerDocument.defaultView||window;return e.left0&&e.top0}function TR(n,e){let t=n.getBoundingClientRect();return{left:0,right:t.right-t.left,top:e,bottom:t.bottom-(t.top+e)}}class o0{constructor(e,t,i,l){this.from=e,this.to=t,this.size=i,this.displaySize=l}static same(e,t){if(e.length!=t.length)return!1;for(let i=0;itypeof l!="function"&&l.class=="cm-lineWrapping");this.heightOracle=new yR(i),this.stateDeco=NS(t),this.heightMap=Wn.empty().applyChanges(this.stateDeco,ft.empty,this.heightOracle.setDoc(t.doc),[new Ii(0,0,0,t.doc.length)]);for(let l=0;l<2&&(this.viewport=this.getViewport(0,null),!!this.updateForViewport());l++);this.updateViewportLines(),this.lineGaps=this.ensureLineGaps([]),this.lineGapDeco=He.set(this.lineGaps.map(l=>l.draw(this,!1))),this.scrollParent=e.scrollDOM,this.computeVisibleRanges()}updateForViewport(){let e=[this.viewport],{main:t}=this.state.selection;for(let i=0;i<=1;i++){let l=i?t.head:t.anchor;if(!e.some(({from:o,to:a})=>l>=o&&l<=a)){let{from:o,to:a}=this.lineBlockAt(l);e.push(new bh(o,a))}}return this.viewports=e.sort((i,l)=>i.from-l.from),this.updateScaler()}updateScaler(){let e=this.scaler;return this.scaler=this.heightMap.height<=7e6?Tx:yd.get(this.heightOracle,this.heightMap,this.viewports),e.eq(this.scaler)?0:2}updateViewportLines(){this.viewportLines=[],this.heightMap.forEachLine(this.viewport.from,this.viewport.to,this.heightOracle.setDoc(this.state.doc),0,0,e=>{this.viewportLines.push($c(e,this.scaler))})}update(e,t=null){this.state=e.state;let i=this.stateDeco;this.stateDeco=NS(this.state);let l=e.changedRanges,o=Ii.extendWithRanges(l,SR(i,this.stateDeco,e?e.changes:hn.empty(this.state.doc.length))),a=this.heightMap.height,u=this.scrolledToBottom?null:this.scrollAnchorAt(this.scrollOffset);SS(),this.heightMap=this.heightMap.applyChanges(this.stateDeco,e.startState.doc,this.heightOracle.setDoc(this.state.doc),o),(this.heightMap.height!=a||Aa)&&(e.flags|=2),u?(this.scrollAnchorPos=e.changes.mapPos(u.from,-1),this.scrollAnchorHeight=u.top):(this.scrollAnchorPos=-1,this.scrollAnchorHeight=a);let f=o.length?this.mapViewport(this.viewport,e.changes):this.viewport;(t&&(t.range.headf.to)||!this.viewportIsAppropriate(f))&&(f=this.getViewport(0,t));let d=f.from!=this.viewport.from||f.to!=this.viewport.to;this.viewport=f,e.flags|=this.updateForViewport(),(d||!e.changes.empty||e.flags&2)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(this.mapLineGaps(this.lineGaps,e.changes))),e.flags|=this.computeVisibleRanges(e.changes),t&&(this.scrollTarget=t),!this.mustEnforceCursorAssoc&&(e.selectionSet||e.focusChanged)&&e.view.lineWrapping&&e.state.selection.main.empty&&e.state.selection.main.assoc&&!e.state.facet(KO)&&(this.mustEnforceCursorAssoc=!0)}measure(){let{view:e}=this,t=e.contentDOM,i=window.getComputedStyle(t),l=this.heightOracle,o=i.whiteSpace;this.defaultTextDirection=i.direction=="rtl"?Ot.RTL:Ot.LTR;let a=this.heightOracle.mustRefreshForWrapping(o)||this.mustMeasureContent==="refresh",u=t.getBoundingClientRect(),f=a||this.mustMeasureContent||this.contentDOMHeight!=u.height;this.contentDOMHeight=u.height,this.mustMeasureContent=!1;let d=0,m=0;if(u.width&&u.height){let{scaleX:U,scaleY:E}=MO(t,u);(U>.005&&Math.abs(this.scaleX-U)>.005||E>.005&&Math.abs(this.scaleY-E)>.005)&&(this.scaleX=U,this.scaleY=E,d|=16,a=f=!0)}let g=(parseInt(i.paddingTop)||0)*this.scaleY,b=(parseInt(i.paddingBottom)||0)*this.scaleY;(this.paddingTop!=g||this.paddingBottom!=b)&&(this.paddingTop=g,this.paddingBottom=b,d|=18),this.editorWidth!=e.scrollDOM.clientWidth&&(l.lineWrapping&&(f=!0),this.editorWidth=e.scrollDOM.clientWidth,d|=16);let v=DO(this.view.contentDOM,!1).y;v!=this.scrollParent&&(this.scrollParent=v,this.scrollAnchorHeight=-1,this.scrollOffset=0);let w=this.getScrollOffset();this.scrollOffset!=w&&(this.scrollAnchorHeight=-1,this.scrollOffset=w),this.scrolledToBottom=LO(this.scrollParent||e.win);let S=(this.printing?TR:OR)(t,this.paddingTop),C=S.top-this.pixelViewport.top,N=S.bottom-this.pixelViewport.bottom;this.pixelViewport=S;let R=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left;if(R!=this.inView&&(this.inView=R,R&&(f=!0)),!this.inView&&!this.scrollTarget&&!NR(e.dom))return 0;let M=u.width;if((this.contentDOMWidth!=M||this.editorHeight!=e.scrollDOM.clientHeight)&&(this.contentDOMWidth=u.width,this.editorHeight=e.scrollDOM.clientHeight,d|=16),f){let U=e.docView.measureVisibleLineHeights(this.viewport);if(l.mustRefreshForHeights(U)&&(a=!0),a||l.lineWrapping&&Math.abs(M-this.contentDOMWidth)>l.charWidth){let{lineHeight:E,charWidth:T,textHeight:z}=e.docView.measureTextSize();a=E>0&&l.refresh(o,E,T,z,Math.max(5,M/T),U),a&&(e.docView.minWidth=0,d|=16)}C>0&&N>0?m=Math.max(C,N):C<0&&N<0&&(m=Math.min(C,N)),SS();for(let E of this.viewports){let T=E.from==this.viewport.from?U:e.docView.measureVisibleLineHeights(E);this.heightMap=(a?Wn.empty().applyChanges(this.stateDeco,ft.empty,this.heightOracle,[new Ii(0,0,0,e.state.doc.length)]):this.heightMap).updateHeight(l,0,a,new bR(E.from,T))}Aa&&(d|=2)}let I=!this.viewportIsAppropriate(this.viewport,m)||this.scrollTarget&&(this.scrollTarget.range.headthis.viewport.to);return I&&(d&2&&(d|=this.updateScaler()),this.viewport=this.getViewport(m,this.scrollTarget),d|=this.updateForViewport()),(d&2||I)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(a?[]:this.lineGaps,e)),d|=this.computeVisibleRanges(),this.mustEnforceCursorAssoc&&(this.mustEnforceCursorAssoc=!1,e.docView.enforceCursorAssoc()),d}get visibleTop(){return this.scaler.fromDOM(this.pixelViewport.top)}get visibleBottom(){return this.scaler.fromDOM(this.pixelViewport.bottom)}getViewport(e,t){let i=.5-Math.max(-.5,Math.min(.5,e/1e3/2)),l=this.heightMap,o=this.heightOracle,{visibleTop:a,visibleBottom:u}=this,f=new bh(l.lineAt(a-i*1e3,Rt.ByHeight,o,0,0).from,l.lineAt(u+(1-i)*1e3,Rt.ByHeight,o,0,0).to);if(t){let{head:d}=t.range;if(df.to){let m=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),g=l.lineAt(d,Rt.ByPos,o,0,0),b;t.y=="center"?b=(g.top+g.bottom)/2-m/2:t.y=="start"||t.y=="nearest"&&d=u+Math.max(10,Math.min(i,250)))&&l>a-2*1e3&&o>1,a=l<<1;if(this.defaultTextDirection!=Ot.LTR&&!i)return[];let u=[],f=(m,g,b,v)=>{if(g-mm&&NN.from>=b.from&&N.to<=b.to&&Math.abs(N.from-m)N.fromR));if(!C){if(gM.from<=g&&M.to>=g)){let M=t.moveToLineBoundary(ae.cursor(g),!1,!0).head;M>m&&(g=M)}let N=this.gapSize(b,m,g,v),R=i||N<2e6?N:2e6;C=new o0(m,g,N,R)}u.push(C)},d=m=>{if(m.length2e6)for(let E of e)E.from>=m.from&&E.fromm.from&&f(m.from,v,m,g),wt.draw(this,this.heightOracle.lineWrapping))))}computeVisibleRanges(e){let t=this.stateDeco;this.lineGaps.length&&(t=t.concat(this.lineGapDeco));let i=[];it.spans(t,this.viewport.from,this.viewport.to,{span(o,a){i.push({from:o,to:a})},point(){}},20);let l=0;if(i.length!=this.visibleRanges.length)l=12;else for(let o=0;o=this.viewport.from&&e<=this.viewport.to&&this.viewportLines.find(t=>t.from<=e&&t.to>=e)||$c(this.heightMap.lineAt(e,Rt.ByPos,this.heightOracle,0,0),this.scaler)}lineBlockAtHeight(e){return e>=this.viewportLines[0].top&&e<=this.viewportLines[this.viewportLines.length-1].bottom&&this.viewportLines.find(t=>t.top<=e&&t.bottom>=e)||$c(this.heightMap.lineAt(this.scaler.fromDOM(e),Rt.ByHeight,this.heightOracle,0,0),this.scaler)}getScrollOffset(){return this.scrollParent==this.view.scrollDOM?this.scrollParent.scrollTop*this.scaleY:(this.scrollParent?this.scrollParent.getBoundingClientRect().top:0)-this.view.contentDOM.getBoundingClientRect().top}scrollAnchorAt(e){let t=this.lineBlockAtHeight(e+12-this.paddingTop);return t.from>=this.viewport.from||this.viewportLines[0].top-e>200?t:this.viewportLines[0]}elementAtHeight(e){return $c(this.heightMap.blockAt(this.scaler.fromDOM(e),this.heightOracle,0,0),this.scaler)}get docHeight(){return this.scaler.toDOM(this.heightMap.height)}get contentHeight(){return this.docHeight+this.paddingTop+this.paddingBottom}}class bh{constructor(e,t){this.from=e,this.to=t}}function ER(n,e,t){let i=[],l=n,o=0;return it.spans(t,n,e,{span(){},point(a,u){a>l&&(i.push({from:l,to:a}),o+=a-l),l=u}},20),l=1)return e[e.length-1].to;let i=Math.floor(n*t);for(let l=0;;l++){let{from:o,to:a}=e[l],u=a-o;if(i<=u)return o+i;i-=u}}function wh(n,e){let t=0;for(let{from:i,to:l}of n.ranges){if(e<=l){t+=e-i;break}t+=l-i}return t/n.total}function MR(n,e){for(let t of n)if(e(t))return t}const Tx={toDOM(n){return n},fromDOM(n){return n},scale:1,eq(n){return n==this}};function NS(n){let e=n.facet(Kd).filter(i=>typeof i!="function"),t=n.facet(My).filter(i=>typeof i!="function");return t.length&&e.push(it.join(t)),e}class yd{constructor(e,t){this.scale=e,this.viewports=t}static get(e,t,i){let l=0,o=0,a=0,u=i.map(({from:d,to:m})=>{let g=t.lineAt(d,Rt.ByPos,e,0,0).top,b=t.lineAt(m,Rt.ByPos,e,0,0).bottom;return l+=b-g,{from:d,to:m,top:g,bottom:b,domTop:0,domBottom:0}});if(t.height-l<10)return Tx;let f=(7e6-l)/(t.height-l);for(let d of u)d.domTop=a+(d.top-o)*f,a=d.domBottom=d.domTop+(d.bottom-d.top),o=d.bottom;return new yd(f,u)}toDOM(e){for(let t=0,i=0,l=0;;t++){let o=tt.from==e.viewports[i].from&&t.to==e.viewports[i].to):!1}}function $c(n,e){if(e.scale==1)return n;let t=e.toDOM(n.top),i=e.toDOM(n.bottom);return new Ji(n.from,n.length,t,i-t,Array.isArray(n._content)?n._content.map(l=>$c(l,e)):n._content)}const kh=Ce.define({combine:n=>n.join(" ")}),Ax=Ce.define({combine:n=>n.indexOf(!0)>-1}),Ex=is.newName(),bN=is.newName(),vN=is.newName(),wN={"&light":"."+bN,"&dark":"."+vN};function Mx(n,e,t){return new is(e,{finish(i){return/&/.test(i)?i.replace(/&\w*/,l=>{if(l=="&")return n;if(!t||!t[l])throw new RangeError(`Unsupported selector: ${l}`);return t[l]}):n+" "+i}})}const DR=Mx("."+Ex,{"&":{position:"relative !important",boxSizing:"border-box","&.cm-focused":{outline:"1px dotted #212121"},display:"flex !important",flexDirection:"column"},".cm-scroller":{display:"flex !important",alignItems:"flex-start !important",fontFamily:"monospace",lineHeight:1.4,height:"100%",overflowX:"auto",position:"relative",zIndex:0,overflowAnchor:"none"},".cm-content":{margin:0,flexGrow:2,flexShrink:0,display:"block",whiteSpace:"pre",wordWrap:"normal",boxSizing:"border-box",minHeight:"100%",padding:"4px 0",outline:"none","&[contenteditable=true]":{WebkitUserModify:"read-write-plaintext-only"}},".cm-lineWrapping":{whiteSpace_fallback:"pre-wrap",whiteSpace:"break-spaces",wordBreak:"break-word",overflowWrap:"anywhere",flexShrink:1},"&light .cm-content":{caretColor:"black"},"&dark .cm-content":{caretColor:"white"},".cm-line":{display:"block",padding:"0 2px 0 6px"},".cm-layer":{userSelect:"none",position:"absolute",left:0,top:0,contain:"size style","& > *":{position:"absolute"}},"&light .cm-selectionBackground":{background:"#d9d9d9"},"&dark .cm-selectionBackground":{background:"#222"},"&light.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#d7d4f0"},"&dark.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#233"},".cm-cursorLayer":{pointerEvents:"none"},"&.cm-focused > .cm-scroller > .cm-cursorLayer":{animation:"steps(1) cm-blink 1.2s infinite"},"@keyframes cm-blink":{"0%":{},"50%":{opacity:0},"100%":{}},"@keyframes cm-blink2":{"0%":{},"50%":{opacity:0},"100%":{}},".cm-cursor, .cm-dropCursor":{borderLeft:"1.2px solid black",marginLeft:"-0.6px",pointerEvents:"none"},".cm-cursor":{display:"none"},"&dark .cm-cursor":{borderLeftColor:"#ddd"},".cm-selectionHandle":{backgroundColor:"currentColor",width:"1.5px"},".cm-selectionHandle-start::before, .cm-selectionHandle-end::before":{content:'""',backgroundColor:"inherit",borderRadius:"50%",width:"8px",height:"8px",position:"absolute",left:"-3.25px"},".cm-selectionHandle-start::before":{top:"-8px"},".cm-selectionHandle-end::before":{bottom:"-8px"},".cm-dropCursor":{position:"absolute"},"&.cm-focused > .cm-scroller > .cm-cursorLayer .cm-cursor":{display:"block"},".cm-iso":{unicodeBidi:"isolate"},".cm-announced":{position:"fixed",top:"-10000px"},"@media print":{".cm-announced":{display:"none"}},"&light .cm-activeLine":{backgroundColor:"#cceeff44"},"&dark .cm-activeLine":{backgroundColor:"#99eeff33"},"&light .cm-specialChar":{color:"red"},"&dark .cm-specialChar":{color:"#f78"},".cm-gutters":{flexShrink:0,display:"flex",height:"100%",boxSizing:"border-box",zIndex:200},".cm-gutters-before":{insetInlineStart:0},".cm-gutters-after":{insetInlineEnd:0},"&light .cm-gutters":{backgroundColor:"#f5f5f5",color:"#6c6c6c",border:"0px solid #ddd","&.cm-gutters-before":{borderRightWidth:"1px"},"&.cm-gutters-after":{borderLeftWidth:"1px"}},"&dark .cm-gutters":{backgroundColor:"#333338",color:"#ccc"},".cm-gutter":{display:"flex !important",flexDirection:"column",flexShrink:0,boxSizing:"border-box",minHeight:"100%",overflow:"hidden"},".cm-gutterElement":{boxSizing:"border-box"},".cm-lineNumbers .cm-gutterElement":{padding:"0 3px 0 5px",minWidth:"20px",textAlign:"right",whiteSpace:"nowrap"},"&light .cm-activeLineGutter":{backgroundColor:"#e2f2ff"},"&dark .cm-activeLineGutter":{backgroundColor:"#222227"},".cm-panels":{boxSizing:"border-box",position:"sticky",left:0,right:0,zIndex:300},"&light .cm-panels":{backgroundColor:"#f5f5f5",color:"black"},".cm-panels-top":{top:"0"},".cm-panels-bottom":{bottom:"0"},"&light .cm-panels-top":{borderBottom:"1px solid #ddd"},"&light .cm-panels-bottom":{borderTop:"1px solid #ddd"},"&dark .cm-panels":{backgroundColor:"#333338",color:"white"},".cm-dialog":{padding:"2px 19px 4px 6px",position:"relative","& label":{fontSize:"80%"}},".cm-dialog-close":{position:"absolute",top:"3px",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",fontSize:"14px",padding:"0"},".cm-tab":{display:"inline-block",overflow:"hidden",verticalAlign:"bottom"},".cm-widgetBuffer":{verticalAlign:"baseline",height:"1em",width:0,display:"inline"},".cm-placeholder":{color:"#888",display:"inline-block",verticalAlign:"top",userSelect:"none"},".cm-highlightSpace":{background:"radial-gradient(circle at 50% 55%, #aaa 20%, transparent 0) no-repeat",backgroundSize:".4em",backgroundPosition:"calc(min(50%, 0px)) center"},".cm-highlightTab":{backgroundImage:`url('data:image/svg+xml,')`,backgroundSize:"auto 100%",backgroundPosition:"right 90%",backgroundRepeat:"no-repeat"},".cm-trailingSpace":{backgroundColor:"#ff332255"},".cm-button":{verticalAlign:"middle",color:"inherit",fontSize:"70%",padding:".2em 1em",borderRadius:"1px"},"&light .cm-button":{backgroundImage:"linear-gradient(#eff1f5, #d9d9df)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#b4b4b4, #d0d3d6)"}},"&dark .cm-button":{backgroundImage:"linear-gradient(#393939, #111)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#111, #333)"}},".cm-textfield":{verticalAlign:"middle",color:"inherit",fontSize:"70%",border:"1px solid silver",padding:".2em .5em"},"&light .cm-textfield":{backgroundColor:"white"},"&dark .cm-textfield":{border:"1px solid #555",backgroundColor:"inherit"}},wN),jR={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},a0=we.ie&&we.ie_version<=11;class RR{constructor(e){this.view=e,this.active=!1,this.editContext=null,this.selectionRange=new aj,this.selectionChanged=!1,this.delayedFlush=-1,this.resizeTimeout=-1,this.queue=[],this.delayedAndroidKey=null,this.flushingAndroidKey=-1,this.lastChange=0,this.scrollTargets=[],this.intersection=null,this.resizeScroll=null,this.intersecting=!1,this.gapIntersection=null,this.gaps=[],this.printQuery=null,this.parentCheck=-1,this.dom=e.contentDOM,this.observer=new MutationObserver(t=>{for(let i of t)this.queue.push(i);(we.ie&&we.ie_version<=11||we.ios&&e.composing)&&t.some(i=>i.type=="childList"&&i.removedNodes.length||i.type=="characterData"&&i.oldValue.length>i.target.nodeValue.length)?this.flushSoon():this.flush()}),window.EditContext&&we.android&&e.constructor.EDIT_CONTEXT!==!1&&!(we.chrome&&we.chrome_version<126)&&(this.editContext=new LR(e),e.state.facet(il)&&(e.contentDOM.editContext=this.editContext.editContext)),a0&&(this.onCharData=t=>{this.queue.push({target:t.target,type:"characterData",oldValue:t.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this),this.onResize=this.onResize.bind(this),this.onPrint=this.onPrint.bind(this),this.onScroll=this.onScroll.bind(this),window.matchMedia&&(this.printQuery=window.matchMedia("print")),typeof ResizeObserver=="function"&&(this.resizeScroll=new ResizeObserver(()=>{var t;((t=this.view.docView)===null||t===void 0?void 0:t.lastUpdate){this.parentCheck<0&&(this.parentCheck=setTimeout(this.listenForScroll.bind(this),1e3)),t.length>0&&t[t.length-1].intersectionRatio>0!=this.intersecting&&(this.intersecting=!this.intersecting,this.intersecting!=this.view.inView&&this.onScrollChanged(document.createEvent("Event")))},{threshold:[0,.001]}),this.intersection.observe(this.dom),this.gapIntersection=new IntersectionObserver(t=>{t.length>0&&t[t.length-1].intersectionRatio>0&&this.onScrollChanged(document.createEvent("Event"))},{})),this.listenForScroll(),this.readSelectionRange()}onScrollChanged(e){this.view.inputState.runHandlers("scroll",e),this.intersecting&&this.view.measure()}onScroll(e){this.intersecting&&this.flush(this.pendingRecords().length>0),this.editContext&&this.view.requestMeasure(this.editContext.measureReq),this.onScrollChanged(e)}onResize(){this.resizeTimeout<0&&(this.resizeTimeout=setTimeout(()=>{this.resizeTimeout=-1,this.view.requestMeasure()},50))}onPrint(e){(e.type=="change"||!e.type)&&!e.matches||(this.view.viewState.printing=!0,this.view.measure(),setTimeout(()=>{this.view.viewState.printing=!1,this.view.requestMeasure()},500))}updateGaps(e){if(this.gapIntersection&&(e.length!=this.gaps.length||this.gaps.some((t,i)=>t!=e[i]))){this.gapIntersection.disconnect();for(let t of e)this.gapIntersection.observe(t);this.gaps=e}}onSelectionChange(e){let t=this.selectionChanged;if(!this.readSelectionRange()||this.delayedAndroidKey)return;let{view:i}=this,l=this.selectionRange;if(i.state.facet(il)?i.root.activeElement!=this.dom:!Zc(this.dom,l))return;let o=l.anchorNode&&i.docView.tile.nearest(l.anchorNode);if(o&&o.isWidget()&&o.widget.ignoreEvent(e)){t||(this.selectionChanged=!1);return}(we.ie&&we.ie_version<=11||we.android&&we.chrome)&&!i.state.selection.main.empty&&l.focusNode&&Jc(l.focusNode,l.focusOffset,l.anchorNode,l.anchorOffset)?this.flushSoon():this.flush(!1)}readSelectionRange(){let{view:e}=this,t=hu(e.root);if(!t)return!1;let i=we.safari&&e.root.nodeType==11&&e.root.activeElement==this.dom&&_R(this.view,t)||t;if(!i||this.selectionRange.eq(i))return!1;let l=Zc(this.dom,i);return l&&!this.selectionChanged&&e.inputState.lastFocusTime>Date.now()-200&&e.inputState.lastTouchTime{let o=this.delayedAndroidKey;o&&(this.clearDelayedAndroidKey(),this.view.inputState.lastKeyCode=o.keyCode,this.view.inputState.lastKeyTime=Date.now(),!this.flush()&&o.force&&pa(this.dom,o.key,o.keyCode))};this.flushingAndroidKey=this.view.win.requestAnimationFrame(l)}(!this.delayedAndroidKey||e=="Enter")&&(this.delayedAndroidKey={key:e,keyCode:t,force:this.lastChange{this.delayedFlush=-1,this.flush()}))}forceFlush(){this.delayedFlush>=0&&(this.view.win.cancelAnimationFrame(this.delayedFlush),this.delayedFlush=-1),this.flush()}pendingRecords(){for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}processRecords(){let e=this.pendingRecords();e.length&&(this.queue=[]);let t=-1,i=-1,l=!1;for(let o of e){let a=this.readMutation(o);a&&(a.typeOver&&(l=!0),t==-1?{from:t,to:i}=a:(t=Math.min(a.from,t),i=Math.max(a.to,i)))}return{from:t,to:i,typeOver:l}}readChange(){let{from:e,to:t,typeOver:i}=this.processRecords(),l=this.selectionChanged&&Zc(this.dom,this.selectionRange);if(e<0&&!l)return null;e>-1&&(this.lastChange=Date.now()),this.view.inputState.lastFocusTime=0,this.selectionChanged=!1;let o=new Wj(this.view,e,t,i);return this.view.docView.domChanged={newSel:o.newSel?o.newSel.main:null},o}flush(e=!0){if(this.delayedFlush>=0||this.delayedAndroidKey)return!1;e&&this.readSelectionRange();let t=this.selectionChanged,i=this.readChange();if(!i)return this.view.requestMeasure(),!1;let l=this.view.state,o=aN(this.view,i);return this.view.state==l&&(i.domChanged||t)&&this.view.update([]),o}readMutation(e){let t=this.view.docView.tile.nearest(e.target);if(!t||t.isWidget())return null;if(t.markDirty(e.type=="attributes"),e.type=="childList"){let i=TS(t,e.previousSibling||e.target.previousSibling,-1),l=TS(t,e.nextSibling||e.target.nextSibling,1);return{from:i?t.posAfter(i):t.posAtStart,to:l?t.posBefore(l):t.posAtEnd,typeOver:!1}}else return e.type=="characterData"?{from:t.posAtStart,to:t.posAtEnd,typeOver:e.target.nodeValue==e.oldValue}:null}setWindow(e){e!=this.win&&(this.removeWindowListeners(this.win),this.win=e,this.addWindowListeners(this.win))}addWindowListeners(e){e.addEventListener("resize",this.onResize),this.printQuery?this.printQuery.addEventListener?this.printQuery.addEventListener("change",this.onPrint):this.printQuery.addListener(this.onPrint):e.addEventListener("beforeprint",this.onPrint),e.addEventListener("scroll",this.onScroll),e.document.addEventListener("selectionchange",this.onSelectionChange)}removeWindowListeners(e){e.removeEventListener("scroll",this.onScroll),e.removeEventListener("resize",this.onResize),this.printQuery?this.printQuery.removeEventListener?this.printQuery.removeEventListener("change",this.onPrint):this.printQuery.removeListener(this.onPrint):e.removeEventListener("beforeprint",this.onPrint),e.document.removeEventListener("selectionchange",this.onSelectionChange)}update(e){this.editContext&&(this.editContext.update(e),e.startState.facet(il)!=e.state.facet(il)&&(e.view.contentDOM.editContext=e.state.facet(il)?this.editContext.editContext:null))}destroy(){var e,t,i;this.stop(),(e=this.intersection)===null||e===void 0||e.disconnect(),(t=this.gapIntersection)===null||t===void 0||t.disconnect(),(i=this.resizeScroll)===null||i===void 0||i.disconnect();for(let l of this.scrollTargets)l.removeEventListener("scroll",this.onScroll);this.removeWindowListeners(this.win),clearTimeout(this.parentCheck),clearTimeout(this.resizeTimeout),this.win.cancelAnimationFrame(this.delayedFlush),this.win.cancelAnimationFrame(this.flushingAndroidKey),this.editContext&&(this.view.contentDOM.editContext=null,this.editContext.destroy())}}function TS(n,e,t){for(;e;){let i=Yt.get(e);if(i&&i.parent==n)return i;let l=e.parentNode;e=l!=n.dom?l:t>0?e.nextSibling:e.previousSibling}return null}function AS(n,e){let t=e.startContainer,i=e.startOffset,l=e.endContainer,o=e.endOffset,a=n.docView.domAtPos(n.state.selection.main.anchor,1);return Jc(a.node,a.offset,l,o)&&([t,i,l,o]=[l,o,t,i]),{anchorNode:t,anchorOffset:i,focusNode:l,focusOffset:o}}function _R(n,e){if(e.getComposedRanges){let l=e.getComposedRanges(n.root)[0];if(l)return AS(n,l)}let t=null;function i(l){l.preventDefault(),l.stopImmediatePropagation(),t=l.getTargetRanges()[0]}return n.contentDOM.addEventListener("beforeinput",i,!0),n.dom.ownerDocument.execCommand("indent"),n.contentDOM.removeEventListener("beforeinput",i,!0),t?AS(n,t):null}class LR{constructor(e){this.from=0,this.to=0,this.pendingContextChange=null,this.handlers=Object.create(null),this.composing=null,this.resetRange(e.state);let t=this.editContext=new window.EditContext({text:e.state.doc.sliceString(this.from,this.to),selectionStart:this.toContextPos(Math.max(this.from,Math.min(this.to,e.state.selection.main.anchor))),selectionEnd:this.toContextPos(e.state.selection.main.head)});this.handlers.textupdate=i=>{let l=e.state.selection.main,{anchor:o,head:a}=l,u=this.toEditorPos(i.updateRangeStart),f=this.toEditorPos(i.updateRangeEnd);e.inputState.composing>=0&&!this.composing&&(this.composing={contextBase:i.updateRangeStart,editorBase:u,drifted:!1});let d=f-u>i.text.length;u==this.from&&othis.to&&(f=o);let m=cN(e.state.sliceDoc(u,f),i.text,(d?l.from:l.to)-u,d?"end":null);if(!m){let b=ae.single(this.toEditorPos(i.selectionStart),this.toEditorPos(i.selectionEnd));Ox(b,l)||e.dispatch({selection:b,userEvent:"select"});return}let g={from:m.from+u,to:m.toA+u,insert:ft.of(i.text.slice(m.from,m.toB).split(` +`))};if((we.mac||we.android)&&g.from==a-1&&/^\. ?$/.test(i.text)&&e.contentDOM.getAttribute("autocorrect")=="off"&&(g={from:u,to:f,insert:ft.of([i.text.replace("."," ")])}),this.pendingContextChange=g,!e.state.readOnly){let b=this.to-this.from+(g.to-g.from+g.insert.length);jy(e,g,ae.single(this.toEditorPos(i.selectionStart,b),this.toEditorPos(i.selectionEnd,b)))}this.pendingContextChange&&(this.revertPending(e.state),this.setSelection(e.state)),g.from=0&&!/[\\p{Alphabetic}\\p{Number}_]/.test(t.text.slice(Math.max(0,i.updateRangeStart-1),Math.min(t.text.length,i.updateRangeStart+1)))&&this.handlers.compositionend(i)},this.handlers.characterboundsupdate=i=>{let l=[],o=null;for(let a=this.toEditorPos(i.rangeStart),u=this.toEditorPos(i.rangeEnd);a{let l=[];for(let o of i.getTextFormats()){let a=o.underlineStyle,u=o.underlineThickness;if(!/none/i.test(a)&&!/none/i.test(u)){let f=this.toEditorPos(o.rangeStart),d=this.toEditorPos(o.rangeEnd);if(f{e.inputState.composing<0&&(e.inputState.composing=0,e.inputState.compositionFirstChange=!0)},this.handlers.compositionend=()=>{if(e.inputState.composing=-1,e.inputState.compositionFirstChange=null,this.composing){let{drifted:i}=this.composing;this.composing=null,i&&this.reset(e.state)}};for(let i in this.handlers)t.addEventListener(i,this.handlers[i]);this.measureReq={read:i=>{let l=hu(i.root);l&&l.rangeCount&&this.editContext.updateSelectionBounds(l.getRangeAt(0).getBoundingClientRect())}}}applyEdits(e){let t=0,i=!1,l=this.pendingContextChange;return e.changes.iterChanges((o,a,u,f,d)=>{if(i)return;let m=d.length-(a-o);if(l&&a>=l.to)if(l.from==o&&l.to==a&&l.insert.eq(d)){l=this.pendingContextChange=null,t+=m,this.to+=m;return}else l=null,this.revertPending(e.state);if(o+=t,a+=t,a<=this.from)this.from+=m,this.to+=m;else if(othis.to||this.to-this.from+d.length>3e4){i=!0;return}this.editContext.updateText(this.toContextPos(o),this.toContextPos(a),d.toString()),this.to+=m}t+=m}),l&&!i&&this.revertPending(e.state),!i}update(e){let t=this.pendingContextChange,i=e.startState.selection.main;this.composing&&(this.composing.drifted||!e.changes.touchesRange(i.from,i.to)&&e.transactions.some(l=>!l.isUserEvent("input.type")&&l.changes.touchesRange(this.from,this.to)))?(this.composing.drifted=!0,this.composing.editorBase=e.changes.mapPos(this.composing.editorBase)):!this.applyEdits(e)||!this.rangeIsValid(e.state)?(this.pendingContextChange=null,this.reset(e.state)):(e.docChanged||e.selectionSet||t)&&this.setSelection(e.state),(e.geometryChanged||e.docChanged||e.selectionSet)&&e.view.requestMeasure(this.measureReq)}resetRange(e){let{head:t}=e.selection.main;this.from=Math.max(0,t-1e4),this.to=Math.min(e.doc.length,t+1e4)}reset(e){this.resetRange(e),this.editContext.updateText(0,this.editContext.text.length,e.doc.sliceString(this.from,this.to)),this.setSelection(e)}revertPending(e){let t=this.pendingContextChange;this.pendingContextChange=null,this.editContext.updateText(this.toContextPos(t.from),this.toContextPos(t.from+t.insert.length),e.doc.sliceString(t.from,t.to))}setSelection(e){let{main:t}=e.selection,i=this.toContextPos(Math.max(this.from,Math.min(this.to,t.anchor))),l=this.toContextPos(t.head);(this.editContext.selectionStart!=i||this.editContext.selectionEnd!=l)&&this.editContext.updateSelection(i,l)}rangeIsValid(e){let{head:t}=e.selection.main;return!(this.from>0&&t-this.from<500||this.to1e4*3)}toEditorPos(e,t=this.to-this.from){e=Math.min(e,t);let i=this.composing;return i&&i.drifted?i.editorBase+(e-i.contextBase):e+this.from}toContextPos(e){let t=this.composing;return t&&t.drifted?t.contextBase+(e-t.editorBase):e-this.from}destroy(){for(let e in this.handlers)this.editContext.removeEventListener(e,this.handlers[e])}}class Oe{get state(){return this.viewState.state}get viewport(){return this.viewState.viewport}get visibleRanges(){return this.viewState.visibleRanges}get inView(){return this.viewState.inView}get composing(){return!!this.inputState&&this.inputState.composing>0}get compositionStarted(){return!!this.inputState&&this.inputState.composing>=0}get root(){return this._root}get win(){return this.dom.ownerDocument.defaultView||window}constructor(e={}){var t;this.plugins=[],this.pluginMap=new Map,this.editorAttrs={},this.contentAttrs={},this.bidiCache=[],this.destroyed=!1,this.updateState=2,this.measureScheduled=-1,this.measureRequests=[],this.clearAnnouncement=-1,this.contentDOM=document.createElement("div"),this.scrollDOM=document.createElement("div"),this.scrollDOM.tabIndex=-1,this.scrollDOM.className="cm-scroller",this.scrollDOM.appendChild(this.contentDOM),this.announceDOM=document.createElement("div"),this.announceDOM.className="cm-announced",this.announceDOM.setAttribute("aria-live","polite"),this.dom=document.createElement("div"),this.dom.appendChild(this.announceDOM),this.dom.appendChild(this.scrollDOM),e.parent&&e.parent.appendChild(this.dom);let{dispatch:i}=e;this.dispatchTransactions=e.dispatchTransactions||i&&(l=>l.forEach(o=>i(o,this)))||(l=>this.update(l)),this.dispatch=this.dispatch.bind(this),this._root=e.root||cj(e.parent)||document,this.viewState=new OS(this,e.state||dt.create(e)),e.scrollTo&&e.scrollTo.is(gh)&&(this.viewState.scrollTarget=e.scrollTo.value.clip(this.viewState.state)),this.plugins=this.state.facet(aa).map(l=>new n0(l));for(let l of this.plugins)l.update(this);this.observer=new RR(this),this.inputState=new tR(this),this.inputState.ensureHandlers(this.plugins),this.docView=new hS(this),this.mountStyles(),this.updateAttrs(),this.updateState=0,this.requestMeasure(),!((t=document.fonts)===null||t===void 0)&&t.ready&&document.fonts.ready.then(()=>{this.viewState.mustMeasureContent="refresh",this.requestMeasure()})}dispatch(...e){let t=e.length==1&&e[0]instanceof dn?e:e.length==1&&Array.isArray(e[0])?e[0]:[this.state.update(...e)];this.dispatchTransactions(t,this)}update(e){if(this.updateState!=0)throw new Error("Calls to EditorView.update are not allowed while an update is in progress");let t=!1,i=!1,l,o=this.state;for(let b of e){if(b.startState!=o)throw new RangeError("Trying to update state with a transaction that doesn't start from the previous state.");o=b.state}if(this.destroyed){this.viewState.state=o;return}let a=this.hasFocus,u=0,f=null;e.some(b=>b.annotation(pN))?(this.inputState.notifiedFocused=a,u=1):a!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=a,f=gN(o,a),f||(u=1));let d=this.observer.delayedAndroidKey,m=null;if(d?(this.observer.clearDelayedAndroidKey(),m=this.observer.readChange(),(m&&!this.state.doc.eq(o.doc)||!this.state.selection.eq(o.selection))&&(m=null)):this.observer.clear(),o.facet(dt.phrases)!=this.state.facet(dt.phrases))return this.setState(o);l=md.create(this,o,e),l.flags|=u;let g=this.viewState.scrollTarget;try{this.updateState=2;for(let b of e){if(g&&(g=g.map(b.changes)),b.scrollIntoView){let{main:v}=b.state.selection,{x:w,y:S}=this.state.facet(Oe.cursorScrollMargin);g=new ga(v.empty?v:ae.cursor(v.head,v.head>v.anchor?-1:1),"nearest","nearest",S,w)}for(let v of b.effects)v.is(gh)&&(g=v.value.clip(this.state))}this.viewState.update(l,g),this.bidiCache=bd.update(this.bidiCache,l.changes),l.empty||(this.updatePlugins(l),this.inputState.update(l)),t=this.docView.update(l),this.state.facet(Xc)!=this.styleModules&&this.mountStyles(),i=this.updateAttrs(),this.showAnnouncements(e),this.docView.updateSelection(t,e.some(b=>b.isUserEvent("select.pointer")))}finally{this.updateState=0}if(l.startState.facet(kh)!=l.state.facet(kh)&&(this.viewState.mustMeasureContent=!0),(t||i||g||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),t&&this.docViewUpdate(),!l.empty)for(let b of this.state.facet(wx))try{b(l)}catch(v){di(this.state,v,"update listener")}(f||m)&&Promise.resolve().then(()=>{f&&this.state==f.startState&&this.dispatch(f),m&&!aN(this,m)&&d.force&&pa(this.contentDOM,d.key,d.keyCode)})}setState(e){if(this.updateState!=0)throw new Error("Calls to EditorView.setState are not allowed while an update is in progress");if(this.destroyed){this.viewState.state=e;return}this.updateState=2;let t=this.hasFocus;try{for(let i of this.plugins)i.destroy(this);this.viewState=new OS(this,e),this.plugins=e.facet(aa).map(i=>new n0(i)),this.pluginMap.clear();for(let i of this.plugins)i.update(this);this.docView.destroy(),this.docView=new hS(this),this.inputState.ensureHandlers(this.plugins),this.mountStyles(),this.updateAttrs(),this.bidiCache=[]}finally{this.updateState=0}t&&this.focus(),this.requestMeasure()}updatePlugins(e){let t=e.startState.facet(aa),i=e.state.facet(aa);if(t!=i){let l=[];for(let o of i){let a=t.indexOf(o);if(a<0)l.push(new n0(o));else{let u=this.plugins[a];u.mustUpdate=e,l.push(u)}}for(let o of this.plugins)o.mustUpdate!=e&&o.destroy(this);this.plugins=l,this.pluginMap.clear()}else for(let l of this.plugins)l.mustUpdate=e;for(let l=0;l-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.observer.delayedAndroidKey){this.measureScheduled=-1,this.requestMeasure();return}this.measureScheduled=0,e&&this.observer.forceFlush();let t=null,i=this.viewState.scrollParent,l=this.viewState.getScrollOffset(),{scrollAnchorPos:o,scrollAnchorHeight:a,scaleY:u}=this.viewState;Math.abs(l-this.viewState.scrollOffset)>1&&(a=-1),this.viewState.scrollAnchorHeight=-1;try{for(let f=0;;f++){if(a<0){if(LO(i||this.win))o=-1,a=this.viewState.heightMap.height/this.viewState.scaleY;else{let w=this.viewState.scrollAnchorAt(l);o=w.from,a=w.top}u=this.viewState.scaleY}this.updateState=1;let d=this.viewState.measure();if(!d&&!this.measureRequests.length&&this.viewState.scrollTarget==null)break;if(f>5){console.warn(this.measureRequests.length?"Measure loop restarted more than 5 times":"Viewport failed to stabilize");break}let m=[];d&4||([this.measureRequests,m]=[m,this.measureRequests]);let g=m.map(w=>{try{return w.read(this)}catch(S){return di(this.state,S),ES}}),b=md.create(this,this.state,[]),v=!1;b.flags|=d,t?t.flags|=d:t=b,this.updateState=2,b.empty||(this.updatePlugins(b),this.inputState.update(b),this.updateAttrs(),v=this.docView.update(b),v&&this.docViewUpdate());for(let w=0;w1||S<-1)&&!(we.ios&&this.inputState.lastIOSMomentumScroll>Date.now()-100)&&(i==this.scrollDOM||this.hasFocus||Math.max(this.inputState.lastWheelEvent,this.inputState.lastTouchTime)>Date.now()-100)){l=l+S,i?o<0?i.scrollTop=i.scrollHeight:i.scrollTop+=S:this.win.scrollBy(0,S),a=-1;continue}}break}}}finally{this.updateState=0,this.measureScheduled=-1}if(t&&!t.empty)for(let f of this.state.facet(wx))f(t)}get themeClasses(){return Ex+" "+(this.state.facet(Ax)?vN:bN)+" "+this.state.facet(kh)}updateAttrs(){let e=MS(this,JO,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),t={spellcheck:"false",autocorrect:"off",autocapitalize:"off",writingsuggestions:"false",translate:"no",contenteditable:this.state.facet(il)?"true":"false",class:"cm-content",style:`${we.tabSize}: ${this.state.tabSize}`,role:"textbox","aria-multiline":"true"};this.state.readOnly&&(t["aria-readonly"]="true"),MS(this,Ey,t);let i=this.observer.ignore(()=>{let l=sS(this.contentDOM,this.contentAttrs,t),o=sS(this.dom,this.editorAttrs,e);return l||o});return this.editorAttrs=e,this.contentAttrs=t,i}showAnnouncements(e){let t=!0;for(let i of e)for(let l of i.effects)if(l.is(Oe.announce)){t&&(this.announceDOM.textContent="",this.win.clearTimeout(this.clearAnnouncement),this.clearAnnouncement=this.win.setTimeout(()=>{this.announceDOM.textContent=" "},200),t=!1);let o=this.announceDOM.appendChild(document.createElement("div"));o.textContent=l.value}}mountStyles(){this.styleModules=this.state.facet(Xc);let e=this.state.facet(Oe.cspNonce);is.mount(this.root,this.styleModules.concat(DR).reverse(),e?{nonce:e}:void 0)}readMeasured(){if(this.updateState==2)throw new Error("Reading the editor layout isn't allowed during an update");this.updateState==0&&this.measureScheduled>-1&&this.measure(!1)}requestMeasure(e){if(this.measureScheduled<0&&(this.measureScheduled=this.win.requestAnimationFrame(()=>this.measure())),e){if(this.measureRequests.indexOf(e)>-1)return;if(e.key!=null){for(let t=0;ti.plugin==e)||null),t&&t.update(this).value}get documentTop(){return this.contentDOM.getBoundingClientRect().top+this.viewState.paddingTop}get documentPadding(){return{top:this.viewState.paddingTop,bottom:this.viewState.paddingBottom}}get scaleX(){return this.viewState.scaleX}get scaleY(){return this.viewState.scaleY}elementAtHeight(e){return this.readMeasured(),this.viewState.elementAtHeight(e)}lineBlockAtHeight(e){return this.readMeasured(),this.viewState.lineBlockAtHeight(e)}get viewportLineBlocks(){return this.viewState.viewportLines}lineBlockAt(e){return this.viewState.lineBlockAt(e)}get contentHeight(){return this.viewState.contentHeight}moveByChar(e,t,i){return s0(this,e,dS(this,e,t,i))}moveByGroup(e,t){return s0(this,e,dS(this,e,t,i=>Qj(this,e.head,i)))}visualLineSide(e,t){return t?ae.cursor(e.to,1):ae.cursor(e.from,-1)}moveToLineBoundary(e,t,i=!0){return Vj(this,e,t,i)}moveVertically(e,t,i){return s0(this,e,Xj(this,e,t,i))}domAtPos(e,t=1){return this.docView.domAtPos(e,t)}posAtDOM(e,t=0){return this.docView.posFromDOM(e,t)}posAtCoords(e,t=!0){this.readMeasured();let i=Cx(this,e,t);return i&&i.pos}posAndSideAtCoords(e,t=!0){return this.readMeasured(),Cx(this,e,t)}coordsAtPos(e,t=1){this.readMeasured();let i=this.state.doc.lineAt(e),l=this.bidiSpans(i),o=l[Dr.find(l,e-i.from,-1,t)];return i.length&&(e==i.from&&t<0||e==i.to&&t>0)&&o.dir!=this.textDirectionAt(i.from)&&(e==i.to?(e=i.from+o.from,t=1):(e=i.from+o.to,t=-1)),this.docView.coordsAt(e,t,o.dir==Ot.RTL)}coordsForChar(e){return this.readMeasured(),this.docView.coordsForChar(e)}get defaultCharacterWidth(){return this.viewState.heightOracle.charWidth}get defaultLineHeight(){return this.viewState.heightOracle.lineHeight}get textDirection(){return this.viewState.defaultTextDirection}textDirectionAt(e){return!this.state.facet(GO)||ethis.viewport.to?this.textDirection:(this.readMeasured(),this.docView.textDirectionAt(e))}get lineWrapping(){return this.viewState.heightOracle.lineWrapping}bidiSpans(e){if(e.length>zR)return UO(e.length);let t=this.textDirectionAt(e.from),i;for(let o of this.bidiCache)if(o.from==e.from&&o.dir==t&&(o.fresh||IO(o.isolates,i=cS(this,e))))return o.order;i||(i=cS(this,e));let l=xj(e.text,t,i);return this.bidiCache.push(new bd(e.from,e.to,t,i,!0,l)),l}get hasFocus(){var e;return(this.dom.ownerDocument.hasFocus()||we.safari&&((e=this.inputState)===null||e===void 0?void 0:e.lastContextMenu)>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore(()=>{_O(this.contentDOM),this.docView.updateSelection()})}setRoot(e){this._root!=e&&(this._root=e,this.observer.setWindow((e.nodeType==9?e:e.ownerDocument).defaultView||window),this.mountStyles())}destroy(){this.root.activeElement==this.contentDOM&&this.contentDOM.blur();for(let e of this.plugins)e.destroy(this);this.plugins=[],this.inputState.destroy(),this.docView.destroy(),this.dom.remove(),this.observer.destroy(),this.win.clearTimeout(this.clearAnnouncement),this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.destroyed=!0}static scrollIntoView(e,t={}){var i,l,o,a;return gh.of(new ga(typeof e=="number"?ae.cursor(e):e,(i=t.y)!==null&&i!==void 0?i:"nearest",(l=t.x)!==null&&l!==void 0?l:"nearest",(o=t.yMargin)!==null&&o!==void 0?o:5,(a=t.xMargin)!==null&&a!==void 0?a:5))}scrollSnapshot(){let{scrollTop:e,scrollLeft:t}=this.scrollDOM,i=this.viewState.scrollAnchorAt(e);return gh.of(new ga(ae.cursor(i.from),"start","start",i.top-e,t,!0))}setTabFocusMode(e){e==null?this.inputState.tabFocusMode=this.inputState.tabFocusMode<0?0:-1:typeof e=="boolean"?this.inputState.tabFocusMode=e?0:-1:this.inputState.tabFocusMode!=0&&(this.inputState.tabFocusMode=Date.now()+e)}static domEventHandlers(e){return Jt.define(()=>({}),{eventHandlers:e})}static domEventObservers(e){return Jt.define(()=>({}),{eventObservers:e})}static theme(e,t){let i=is.newName(),l=[kh.of(i),Xc.of(Mx(`.${i}`,e))];return t&&t.dark&&l.push(Ax.of(!0)),l}static baseTheme(e){return so.lowest(Xc.of(Mx("."+Ex,e,wN)))}static findFromDOM(e){var t;let i=e.querySelector(".cm-content"),l=i&&Yt.get(i)||Yt.get(e);return((t=l==null?void 0:l.root)===null||t===void 0?void 0:t.view)||null}}Oe.styleModule=Xc;Oe.inputHandler=$O;Oe.clipboardInputFilter=Ty;Oe.clipboardOutputFilter=Ay;Oe.scrollHandler=WO;Oe.focusChangeEffect=YO;Oe.perLineTextDirection=GO;Oe.exceptionSink=XO;Oe.updateListener=wx;Oe.editable=il;Oe.mouseSelectionStyle=QO;Oe.dragMovesSelection=VO;Oe.clickAddsSelectionRange=qO;Oe.decorations=Kd;Oe.blockWrappers=eN;Oe.outerDecorations=My;Oe.atomicRanges=Au;Oe.bidiIsolatedRanges=tN;Oe.cursorScrollMargin=Ce.define({combine:n=>{let e=5,t=5;for(let i of n)typeof i=="number"?e=t=i:{x:e,y:t}=i;return{x:e,y:t}}});Oe.scrollMargins=iN;Oe.darkTheme=Ax;Oe.cspNonce=Ce.define({combine:n=>n.length?n[0]:""});Oe.contentAttributes=Ey;Oe.editorAttributes=JO;Oe.lineWrapping=Oe.contentAttributes.of({class:"cm-lineWrapping"});Oe.announce=Ye.define();const zR=4096,ES={};class bd{constructor(e,t,i,l,o,a){this.from=e,this.to=t,this.dir=i,this.isolates=l,this.fresh=o,this.order=a}static update(e,t){if(t.empty&&!e.some(o=>o.fresh))return e;let i=[],l=e.length?e[e.length-1].dir:Ot.LTR;for(let o=Math.max(0,e.length-10);o=0;l--){let o=i[l],a=typeof o=="function"?o(n):o;a&&Cy(a,t)}return t}const BR=we.mac?"mac":we.windows?"win":we.linux?"linux":"key";function PR(n,e){const t=n.split(/-(?!$)/);let i=t[t.length-1];i=="Space"&&(i=" ");let l,o,a,u;for(let f=0;fi.concat(l),[]))),t}function IR(n,e,t){return SN(kN(n.state),e,n,t)}let Gl=null;const UR=4e3;function FR(n,e=BR){let t=Object.create(null),i=Object.create(null),l=(a,u)=>{let f=i[a];if(f==null)i[a]=u;else if(f!=u)throw new Error("Key binding "+a+" is used both as a regular binding and as a multi-stroke prefix")},o=(a,u,f,d,m)=>{var g,b;let v=t[a]||(t[a]=Object.create(null)),w=u.split(/ (?!$)/).map(N=>PR(N,e));for(let N=1;N{let I=Gl={view:M,prefix:R,scope:a};return setTimeout(()=>{Gl==I&&(Gl=null)},UR),!0}]})}let S=w.join(" ");l(S,!1);let C=v[S]||(v[S]={preventDefault:!1,stopPropagation:!1,run:((b=(g=v._any)===null||g===void 0?void 0:g.run)===null||b===void 0?void 0:b.slice())||[]});f&&C.run.push(f),d&&(C.preventDefault=!0),m&&(C.stopPropagation=!0)};for(let a of n){let u=a.scope?a.scope.split(" "):["editor"];if(a.any)for(let d of u){let m=t[d]||(t[d]=Object.create(null));m._any||(m._any={preventDefault:!1,stopPropagation:!1,run:[]});let{any:g}=a;for(let b in m)m[b].run.push(v=>g(v,Dx))}let f=a[e]||a.key;if(f)for(let d of u)o(d,f,a.run,a.preventDefault,a.stopPropagation),a.shift&&o(d,"Shift-"+f,a.shift,a.preventDefault,a.stopPropagation)}return t}let Dx=null;function SN(n,e,t,i){Dx=e;let l=nj(e),o=ui(l,0),a=Er(o)==l.length&&l!=" ",u="",f=!1,d=!1,m=!1;Gl&&Gl.view==t&&Gl.scope==i&&(u=Gl.prefix+" ",fN.indexOf(e.keyCode)<0&&(d=!0,Gl=null));let g=new Set,b=C=>{if(C){for(let N of C.run)if(!g.has(N)&&(g.add(N),N(t)))return C.stopPropagation&&(m=!0),!0;C.preventDefault&&(C.stopPropagation&&(m=!0),d=!0)}return!1},v=n[i],w,S;return v&&(b(v[u+Sh(l,e,!a)])?f=!0:a&&(e.altKey||e.metaKey||e.ctrlKey)&&!(we.windows&&e.ctrlKey&&e.altKey)&&!(we.mac&&e.altKey&&!(e.ctrlKey||e.metaKey))&&(w=rs[e.keyCode])&&w!=l?(b(v[u+Sh(w,e,!0)])||e.shiftKey&&(S=uu[e.keyCode])!=l&&S!=w&&b(v[u+Sh(S,e,!1)]))&&(f=!0):a&&e.shiftKey&&b(v[u+Sh(l,e,!0)])&&(f=!0),!f&&b(v._any)&&(f=!0)),d&&(f=!0),f&&m&&e.stopPropagation(),Dx=null,f}class Zs{constructor(e,t,i,l,o){this.className=e,this.left=t,this.top=i,this.width=l,this.height=o}draw(){let e=document.createElement("div");return e.className=this.className,this.adjust(e),e}update(e,t){return t.className!=this.className?!1:(this.adjust(e),!0)}adjust(e){e.style.left=this.left+"px",e.style.top=this.top+"px",this.width!=null&&(e.style.width=this.width+"px"),e.style.height=this.height+"px"}eq(e){return this.left==e.left&&this.top==e.top&&this.width==e.width&&this.height==e.height&&this.className==e.className}static forRange(e,t,i){if(i.empty){let l=e.coordsAtPos(i.head,i.assoc||1);if(!l)return[];let o=CN(e);return[new Zs(t,l.left-o.left,l.top-o.top,null,l.bottom-l.top)]}else return qR(e,t,i)}}function CN(n){let e=n.scrollDOM.getBoundingClientRect();return{left:(n.textDirection==Ot.LTR?e.left:e.right-n.scrollDOM.clientWidth*n.scaleX)-n.scrollDOM.scrollLeft*n.scaleX,top:e.top-n.scrollDOM.scrollTop*n.scaleY}}function jS(n,e,t,i){let l=n.coordsAtPos(e,t*2);if(!l)return i;let o=n.dom.getBoundingClientRect(),a=(l.top+l.bottom)/2,u=n.posAtCoords({x:o.left+1,y:a}),f=n.posAtCoords({x:o.right-1,y:a});return u==null||f==null?i:{from:Math.max(i.from,Math.min(u,f)),to:Math.min(i.to,Math.max(u,f))}}function qR(n,e,t){if(t.to<=n.viewport.from||t.from>=n.viewport.to)return[];let i=Math.max(t.from,n.viewport.from),l=Math.min(t.to,n.viewport.to),o=n.textDirection==Ot.LTR,a=n.contentDOM,u=a.getBoundingClientRect(),f=CN(n),d=a.querySelector(".cm-line"),m=d&&window.getComputedStyle(d),g=u.left+(m?parseInt(m.paddingLeft)+Math.min(0,parseInt(m.textIndent)):0),b=u.right-(m?parseInt(m.paddingRight):0),v=Sx(n,i,1),w=Sx(n,l,-1),S=v.type==Ln.Text?v:null,C=w.type==Ln.Text?w:null;if(S&&(n.lineWrapping||v.widgetLineBreaks)&&(S=jS(n,i,1,S)),C&&(n.lineWrapping||w.widgetLineBreaks)&&(C=jS(n,l,-1,C)),S&&C&&S.from==C.from&&S.to==C.to)return R(M(t.from,t.to,S));{let U=S?M(t.from,null,S):I(v,!1),E=C?M(null,t.to,C):I(w,!0),T=[];return(S||v).to<(C||w).from-(S&&C?1:0)||v.widgetLineBreaks>1&&U.bottom+n.defaultLineHeight/2F&&he.from=L)break;A>ne&&J(Math.max(le,ne),U==null&&le<=F,Math.min(A,L),E==null&&A>=se,oe.dir)}if(ne=ee.to+1,ne>=L)break}return q.length==0&&J(F,U==null,se,E==null,n.textDirection),{top:z,bottom:ie,horizontal:q}}function I(U,E){let T=u.top+(E?U.top:U.bottom);return{top:T,bottom:T,horizontal:[]}}}function VR(n,e){return n.constructor==e.constructor&&n.eq(e)}class QR{constructor(e,t){this.view=e,this.layer=t,this.drawn=[],this.scaleX=1,this.scaleY=1,this.measureReq={read:this.measure.bind(this),write:this.draw.bind(this)},this.dom=e.scrollDOM.appendChild(document.createElement("div")),this.dom.classList.add("cm-layer"),t.above&&this.dom.classList.add("cm-layer-above"),t.class&&this.dom.classList.add(t.class),this.scale(),this.dom.setAttribute("aria-hidden","true"),this.setOrder(e.state),e.requestMeasure(this.measureReq),t.mount&&t.mount(this.dom,e)}update(e){e.startState.facet(ed)!=e.state.facet(ed)&&this.setOrder(e.state),(this.layer.update(e,this.dom)||e.geometryChanged)&&(this.scale(),e.view.requestMeasure(this.measureReq))}docViewUpdate(e){this.layer.updateOnDocViewUpdate!==!1&&e.requestMeasure(this.measureReq)}setOrder(e){let t=0,i=e.facet(ed);for(;t!VR(t,this.drawn[i]))){let t=this.dom.firstChild,i=0;for(let l of e)l.update&&t&&l.constructor&&this.drawn[i].constructor&&l.update(t,this.drawn[i])?(t=t.nextSibling,i++):this.dom.insertBefore(l.draw(),t);for(;t;){let l=t.nextSibling;t.remove(),t=l}this.drawn=e,we.webkit&&(this.dom.style.display=this.dom.firstChild?"":"none")}}destroy(){this.layer.destroy&&this.layer.destroy(this.dom,this.view),this.dom.remove()}}const ed=Ce.define();function ON(n){return[Jt.define(e=>new QR(e,n)),ed.of(n)]}const jx=!we.ios,Ea=Ce.define({combine(n){return Br(n,{cursorBlinkRate:1200,drawRangeCursor:!0,iosSelectionHandles:!0},{cursorBlinkRate:(e,t)=>Math.min(e,t),drawRangeCursor:(e,t)=>e||t})}});function XR(n={}){return[Ea.of(n),$R,YR,KR,KO.of(!0)]}function NN(n){return n.startState.facet(Ea)!=n.state.facet(Ea)}const $R=ON({above:!0,markers(n){let{state:e}=n,t=e.facet(Ea),i=[];for(let l of e.selection.ranges){let o=l==e.selection.main;if(l.empty||t.drawRangeCursor&&!(o&&we.ios&&t.iosSelectionHandles)){let a=o?"cm-cursor cm-cursor-primary":"cm-cursor cm-cursor-secondary",u=l.empty?l:ae.cursor(l.head,l.assoc);for(let f of Zs.forRange(n,a,u))i.push(f)}}return i},update(n,e){n.transactions.some(i=>i.selection)&&(e.style.animationName=e.style.animationName=="cm-blink"?"cm-blink2":"cm-blink");let t=NN(n);return t&&RS(n.state,e),n.docChanged||n.selectionSet||t},mount(n,e){RS(e.state,n)},class:"cm-cursorLayer"});function RS(n,e){e.style.animationDuration=n.facet(Ea).cursorBlinkRate+"ms"}const YR=ON({above:!1,markers(n){let e=[],{main:t,ranges:i}=n.state.selection;for(let l of i)if(!l.empty&&(jx||l!=t))for(let o of Zs.forRange(n,"cm-selectionBackground",l))e.push(o);if(we.ios&&!t.empty&&n.state.facet(Ea).iosSelectionHandles){for(let l of Zs.forRange(n,"cm-selectionHandle cm-selectionHandle-start",ae.cursor(t.from,1)))e.push(l);for(let l of Zs.forRange(n,"cm-selectionHandle cm-selectionHandle-end",ae.cursor(t.to,1)))e.push(l)}return e},update(n,e){return n.docChanged||n.selectionSet||n.viewportChanged||NN(n)},class:"cm-selectionLayer"}),GR=we.gecko&&we.gecko_version==153?"#ffffff01":"transparent",KR=so.highest(Oe.theme({".cm-line":{...jx?{"& ::selection, &::selection":{backgroundColor:`${GR} !important`}}:{},caretColor:"transparent !important"},".cm-content":{caretColor:"transparent !important","& :focus":{caretColor:"initial !important",...jx?{"&::selection, & ::selection":{backgroundColor:"Highlight !important"}}:{}}}})),TN=Ye.define({map(n,e){return n==null?null:e.mapPos(n)}}),Yc=In.define({create(){return null},update(n,e){return n!=null&&(n=e.changes.mapPos(n)),e.effects.reduce((t,i)=>i.is(TN)?i.value:t,n)}}),WR=Jt.fromClass(class{constructor(n){this.view=n,this.cursor=null,this.measureReq={read:this.readPos.bind(this),write:this.drawCursor.bind(this)}}update(n){var e;let t=n.state.field(Yc);t==null?this.cursor!=null&&((e=this.cursor)===null||e===void 0||e.remove(),this.cursor=null):(this.cursor||(this.cursor=this.view.scrollDOM.appendChild(document.createElement("div")),this.cursor.className="cm-dropCursor"),(n.startState.field(Yc)!=t||n.docChanged||n.geometryChanged)&&this.view.requestMeasure(this.measureReq))}readPos(){let{view:n}=this,e=n.state.field(Yc),t=e!=null&&n.coordsAtPos(e);if(!t)return null;let i=n.scrollDOM.getBoundingClientRect();return{left:t.left-i.left+n.scrollDOM.scrollLeft*n.scaleX,top:t.top-i.top+n.scrollDOM.scrollTop*n.scaleY,height:t.bottom-t.top}}drawCursor(n){if(this.cursor){let{scaleX:e,scaleY:t}=this.view;n?(this.cursor.style.left=n.left/e+"px",this.cursor.style.top=n.top/t+"px",this.cursor.style.height=n.height/t+"px"):this.cursor.style.left="-100000px"}}destroy(){this.cursor&&this.cursor.remove()}setDropPos(n){this.view.state.field(Yc)!=n&&this.view.dispatch({effects:TN.of(n)})}},{eventObservers:{dragover(n){this.setDropPos(this.view.posAtCoords({x:n.clientX,y:n.clientY}))},dragleave(n){(n.target==this.view.contentDOM||!this.view.contentDOM.contains(n.relatedTarget))&&this.setDropPos(null)},dragend(){this.setDropPos(null)},drop(){this.setDropPos(null)}}});function ZR(){return[Yc,WR]}function _S(n,e,t,i,l){e.lastIndex=0;for(let o=n.iterRange(t,i),a=t,u;!o.next().done;a+=o.value.length)if(!o.lineBreak)for(;u=e.exec(o.value);)l(a+u.index,u)}function JR(n,e){let t=n.visibleRanges;if(t.length==1&&t[0].from==n.viewport.from&&t[0].to==n.viewport.to)return t;let i=[];for(let{from:l,to:o}of t)l=Math.max(n.state.doc.lineAt(l).from,l-e),o=Math.min(n.state.doc.lineAt(o).to,o+e),i.length&&i[i.length-1].to>=l?i[i.length-1].to=o:i.push({from:l,to:o});return i}class e_{constructor(e){const{regexp:t,decoration:i,decorate:l,boundary:o,maxLength:a=1e3}=e;if(!t.global)throw new RangeError("The regular expression given to MatchDecorator should have its 'g' flag set");if(this.regexp=t,l)this.addMatch=(u,f,d,m)=>l(m,d,d+u[0].length,u,f);else if(typeof i=="function")this.addMatch=(u,f,d,m)=>{let g=i(u,f,d);g&&m(d,d+u[0].length,g)};else if(i)this.addMatch=(u,f,d,m)=>m(d,d+u[0].length,i);else throw new RangeError("Either 'decorate' or 'decoration' should be provided to MatchDecorator");this.boundary=o,this.maxLength=a}createDeco(e){let t=new zr,i=t.add.bind(t);for(let{from:l,to:o}of JR(e,this.maxLength))_S(e.state.doc,this.regexp,l,o,(a,u)=>this.addMatch(u,e,a,i));return t.finish()}updateDeco(e,t){let i=1e9,l=-1;return e.docChanged&&e.changes.iterChanges((o,a,u,f)=>{f>=e.view.viewport.from&&u<=e.view.viewport.to&&(i=Math.min(u,i),l=Math.max(f,l))}),e.viewportMoved||l-i>1e3?this.createDeco(e.view):l>-1?this.updateRange(e.view,t.map(e.changes),i,l):t}updateRange(e,t,i,l){for(let o of e.visibleRanges){let a=Math.max(o.from,i),u=Math.min(o.to,l);if(u>=a){let f=e.state.doc.lineAt(a),d=f.tof.from;a--)if(this.boundary.test(f.text[a-1-f.from])){m=a;break}for(;ub.push(N.range(S,C));if(f==d)for(this.regexp.lastIndex=m-f.from;(v=this.regexp.exec(f.text))&&v.indexthis.addMatch(C,e,S,w));t=t.update({filterFrom:m,filterTo:g,filter:(S,C)=>Sg,add:b})}}return t}}const Rx=/x/.unicode!=null?"gu":"g",t_=new RegExp(`[\0-\b +--Ÿ­؜​‎‏\u2028\u2029‭‮⁦⁧⁩\uFEFF-]`,Rx),n_={0:"null",7:"bell",8:"backspace",10:"newline",11:"vertical tab",13:"carriage return",27:"escape",8203:"zero width space",8204:"zero width non-joiner",8205:"zero width joiner",8206:"left-to-right mark",8207:"right-to-left mark",8232:"line separator",8237:"left-to-right override",8238:"right-to-left override",8294:"left-to-right isolate",8295:"right-to-left isolate",8297:"pop directional isolate",8233:"paragraph separator",65279:"zero width no-break space",65532:"object replacement"};let c0=null;function i_(){var n;if(c0==null&&typeof document<"u"&&document.body){let e=document.body.style;c0=((n=e.tabSize)!==null&&n!==void 0?n:e.MozTabSize)!=null}return c0||!1}const td=Ce.define({combine(n){let e=Br(n,{render:null,specialChars:t_,addSpecialChars:null});return(e.replaceTabs=!i_())&&(e.specialChars=new RegExp(" |"+e.specialChars.source,Rx)),e.addSpecialChars&&(e.specialChars=new RegExp(e.specialChars.source+"|"+e.addSpecialChars.source,Rx)),e}});function r_(n={}){return[td.of(n),l_()]}let LS=null;function l_(){return LS||(LS=Jt.fromClass(class{constructor(n){this.view=n,this.decorations=He.none,this.decorationCache=Object.create(null),this.decorator=this.makeDecorator(n.state.facet(td)),this.decorations=this.decorator.createDeco(n)}makeDecorator(n){return new e_({regexp:n.specialChars,decoration:(e,t,i)=>{let{doc:l}=t.state,o=ui(e[0],0);if(o==9){let a=l.lineAt(i),u=t.state.tabSize,f=Ra(a.text,u,i-a.from);return He.replace({widget:new c_((u-f%u)*this.view.defaultCharacterWidth/this.view.scaleX)})}return this.decorationCache[o]||(this.decorationCache[o]=He.replace({widget:new a_(n,o)}))},boundary:n.replaceTabs?void 0:/[^]/})}update(n){let e=n.state.facet(td);n.startState.facet(td)!=e?(this.decorator=this.makeDecorator(e),this.decorations=this.decorator.createDeco(n.view)):this.decorations=this.decorator.updateDeco(n,this.decorations)}},{decorations:n=>n.decorations}))}const s_="•";function o_(n){return n>=32?s_:n==10?"␤":String.fromCharCode(9216+n)}class a_ extends ul{constructor(e,t){super(),this.options=e,this.code=t}eq(e){return e.code==this.code}toDOM(e){let t=o_(this.code),i=e.state.phrase("Control character")+" "+(n_[this.code]||"0x"+this.code.toString(16)),l=this.options.render&&this.options.render(this.code,i,t);if(l)return l;let o=document.createElement("span");return o.textContent=t,o.title=i,o.setAttribute("aria-label",i),o.className="cm-specialChar",o}ignoreEvent(){return!1}}class c_ extends ul{constructor(e){super(),this.width=e}eq(e){return e.width==this.width}toDOM(){let e=document.createElement("span");return e.textContent=" ",e.className="cm-tab",e.style.width=this.width+"px",e}ignoreEvent(){return!1}}function u_(){return h_}const f_=He.line({class:"cm-activeLine"}),h_=Jt.fromClass(class{constructor(n){this.decorations=this.getDeco(n)}update(n){(n.docChanged||n.selectionSet)&&(this.decorations=this.getDeco(n.view))}getDeco(n){let e=-1,t=[];for(let i of n.state.selection.ranges){let l=n.lineBlockAt(i.head);l.from>e&&(t.push(f_.range(l.from)),e=l.from)}return He.set(t)}},{decorations:n=>n.decorations}),_x=2e3;function d_(n,e,t){let i=Math.min(e.line,t.line),l=Math.max(e.line,t.line),o=[];if(e.off>_x||t.off>_x||e.col<0||t.col<0){let a=Math.min(e.off,t.off),u=Math.max(e.off,t.off);for(let f=i;f<=l;f++){let d=n.doc.line(f);d.length<=u&&o.push(ae.range(d.from+a,d.to+u))}}else{let a=Math.min(e.col,t.col),u=Math.max(e.col,t.col);for(let f=i;f<=l;f++){let d=n.doc.line(f),m=ux(d.text,a,n.tabSize,!0);if(m<0)o.push(ae.cursor(d.to));else{let g=ux(d.text,u,n.tabSize);o.push(ae.range(d.from+m,d.from+g))}}}return o}function m_(n,e){let t=n.coordsAtPos(n.viewport.from);return t?Math.round(Math.abs((t.left-e)/n.defaultCharacterWidth)):-1}function zS(n,e){let t=n.posAtCoords({x:e.clientX,y:e.clientY},!1),i=n.state.doc.lineAt(t),l=t-i.from,o=l>_x?-1:l==i.length?m_(n,e.clientX):Ra(i.text,n.state.tabSize,t-i.from);return{line:i.number,col:o,off:l}}function p_(n,e){let t=zS(n,e),i=n.state.selection;return t?{update(l){if(l.docChanged){let o=l.changes.mapPos(l.startState.doc.line(t.line).from),a=l.state.doc.lineAt(o);t={line:a.number,col:t.col,off:Math.min(t.off,a.length)},i=i.map(l.changes)}},get(l,o,a){let u=zS(n,l);if(!u)return i;let f=d_(n.state,t,u);return f.length?a?ae.create(f.concat(i.ranges)):ae.create(f):i}}:null}function g_(n){let e=(t=>t.altKey&&t.button==0);return Oe.mouseSelectionStyle.of((t,i)=>e(i)?p_(t,i):null)}const x_={Alt:[18,n=>!!n.altKey],Control:[17,n=>!!n.ctrlKey],Shift:[16,n=>!!n.shiftKey],Meta:[91,n=>!!n.metaKey]},y_={style:"cursor: crosshair"};function b_(n={}){let[e,t]=x_[n.key||"Alt"],i=Jt.fromClass(class{constructor(l){this.view=l,this.isDown=!1}set(l){this.isDown!=l&&(this.isDown=l,this.view.update([]))}},{eventObservers:{keydown(l){this.set(l.keyCode==e||t(l))},keyup(l){(l.keyCode==e||!t(l))&&this.set(!1)},mousemove(l){this.set(t(l))}}});return[i,Oe.contentAttributes.of(l=>{var o;return!((o=l.plugin(i))===null||o===void 0)&&o.isDown?y_:null})]}const Ch="-10000px";class AN{constructor(e,t,i,l){this.facet=t,this.createTooltipView=i,this.removeTooltipView=l,this.input=e.state.facet(t),this.tooltips=this.input.filter(a=>a);let o=null;this.tooltipViews=this.tooltips.map(a=>o=i(a,o))}update(e,t){var i;let l=e.state.facet(this.facet),o=l.filter(f=>f);if(l===this.input){for(let f of this.tooltipViews)f.update&&f.update(e);return!1}let a=[],u=t?[]:null;for(let f=0;ft[d]=f),t.length=u.length),this.input=l,this.tooltips=o,this.tooltipViews=a,!0}}function EN(n){let e=n.dom.ownerDocument.documentElement,t=e.clientWidth,i=getComputedStyle(e);if(!/stable/.test(i.scrollbarGutter||""))return{left:0,right:t};let l=e.getBoundingClientRect(),o=n.win.scrollX;return{left:Math.max(0,l.left+o-parseFloat(i.marginLeft)),right:Math.min(t,l.right+o+parseFloat(i.marginRight))}}function v_(n){let{left:e,right:t}=EN(n);return{top:0,left:e,right:t,bottom:n.dom.ownerDocument.documentElement.clientHeight}}const u0=Ce.define({combine:n=>{var e,t,i;return{position:we.ios?"absolute":((e=n.find(l=>l.position))===null||e===void 0?void 0:e.position)||"fixed",parent:((t=n.find(l=>l.parent))===null||t===void 0?void 0:t.parent)||null,tooltipSpace:((i=n.find(l=>l.tooltipSpace))===null||i===void 0?void 0:i.tooltipSpace)||v_}}}),BS=new WeakMap,Ly=Jt.fromClass(class{constructor(n){this.view=n,this.above=[],this.inView=!0,this.madeAbsolute=!1,this.lastTransaction=0,this.measureTimeout=-1;let e=n.state.facet(u0);this.position=e.position,this.parent=e.parent,this.classes=n.themeClasses,this.createContainer(),this.measureReq={read:this.readMeasure.bind(this),write:this.writeMeasure.bind(this),key:this},this.resizeObserver=typeof ResizeObserver=="function"?new ResizeObserver(()=>this.measureSoon()):null,this.manager=new AN(n,zy,(t,i)=>this.createTooltip(t,i),t=>{this.resizeObserver&&this.resizeObserver.unobserve(t.dom),t.dom.remove()}),this.above=this.manager.tooltips.map(t=>!!t.above),this.intersectionObserver=typeof IntersectionObserver=="function"?new IntersectionObserver(t=>{Date.now()>this.lastTransaction-50&&t.length>0&&t[t.length-1].intersectionRatio<1&&this.measureSoon()},{threshold:[1]}):null,this.observeIntersection(),n.win.addEventListener("resize",this.measureSoon=this.measureSoon.bind(this)),this.maybeMeasure()}createContainer(){this.parent?(this.container=document.createElement("div"),this.container.style.position="relative",this.container.className=this.view.themeClasses,this.parent.appendChild(this.container)):this.container=this.view.dom}observeIntersection(){if(this.intersectionObserver){this.intersectionObserver.disconnect();for(let n of this.manager.tooltipViews)this.intersectionObserver.observe(n.dom)}}measureSoon(){this.measureTimeout<0&&(this.measureTimeout=setTimeout(()=>{this.measureTimeout=-1,this.maybeMeasure()},50))}update(n){n.transactions.length&&(this.lastTransaction=Date.now());let e=this.manager.update(n,this.above);e&&this.observeIntersection();let t=e||n.geometryChanged,i=n.state.facet(u0);if(i.position!=this.position&&!this.madeAbsolute){this.position=i.position;for(let l of this.manager.tooltipViews)l.dom.style.position=this.position;t=!0}if(i.parent!=this.parent){this.parent&&this.container.remove(),this.parent=i.parent,this.createContainer();for(let l of this.manager.tooltipViews)this.container.appendChild(l.dom);t=!0}else this.parent&&this.view.themeClasses!=this.classes&&(this.classes=this.container.className=this.view.themeClasses);t&&this.maybeMeasure()}createTooltip(n,e){let t=n.create(this.view),i=e?e.dom:null;if(t.dom.classList.add("cm-tooltip"),n.arrow&&!t.dom.querySelector(".cm-tooltip > .cm-tooltip-arrow")){let l=document.createElement("div");l.className="cm-tooltip-arrow",t.dom.appendChild(l)}return t.dom.style.position=this.position,t.dom.style.top=Ch,t.dom.style.left="0px",this.container.insertBefore(t.dom,i),t.mount&&t.mount(this.view),this.resizeObserver&&this.resizeObserver.observe(t.dom),t}destroy(){var n,e,t;this.view.win.removeEventListener("resize",this.measureSoon);for(let i of this.manager.tooltipViews)i.dom.remove(),(n=i.destroy)===null||n===void 0||n.call(i);this.parent&&this.container.remove(),(e=this.resizeObserver)===null||e===void 0||e.disconnect(),(t=this.intersectionObserver)===null||t===void 0||t.disconnect(),clearTimeout(this.measureTimeout)}readMeasure(){let n=1,e=1,t=!1,i=0;if(this.position=="fixed"&&this.manager.tooltipViews.length){let{dom:a}=this.manager.tooltipViews[0];if(we.safari){let u=a.getBoundingClientRect();t=Math.abs(u.top+1e4)>1||Math.abs(u.left)>1}else t=!!a.offsetParent&&a.offsetParent!=this.container.ownerDocument.body}if(t||this.position=="absolute")if(this.parent){let a=this.parent.getBoundingClientRect();a.width&&a.height&&(n=a.width/this.parent.offsetWidth,e=a.height/this.parent.offsetHeight)}else({scaleX:n,scaleY:e}=this.view.viewState);else i=EN(this.view).left;let l=this.view.scrollDOM.getBoundingClientRect(),o=Dy(this.view);return{visible:{left:l.left+o.left,top:l.top+o.top,right:l.right-o.right,bottom:l.bottom-o.bottom},parent:this.parent?this.container.getBoundingClientRect():this.view.dom.getBoundingClientRect(),pos:this.manager.tooltips.map((a,u)=>{let f=this.manager.tooltipViews[u];return f.getCoords?f.getCoords(a.pos):this.view.coordsAtPos(a.pos)}),size:this.manager.tooltipViews.map(({dom:a})=>a.getBoundingClientRect()),space:this.view.state.facet(u0).tooltipSpace(this.view),scaleX:n,scaleY:e,makeAbsolute:t,fixedLeft:i}}writeMeasure(n){var e;if(n.makeAbsolute){this.madeAbsolute=!0,this.position="absolute";for(let u of this.manager.tooltipViews)u.dom.style.position="absolute"}let{visible:t,space:i,scaleX:l,scaleY:o}=n,a=[];for(let u=0;u=Math.min(t.bottom,i.bottom)||g.rightMath.min(t.right,i.right)+.1)){m.style.top=Ch;continue}let v=f.arrow?d.dom.querySelector(".cm-tooltip-arrow"):null,w=v?7:0,S=b.right-b.left,C=(e=BS.get(d))!==null&&e!==void 0?e:b.bottom-b.top,N=d.offset||k_,R=this.view.textDirection==Ot.LTR,M=b.width>i.right-i.left?R?i.left:i.right-b.width:R?Math.max(i.left,Math.min(g.left-(v?14:0)+N.x,i.right-S)):Math.min(Math.max(i.left,g.left-S+(v?14:0)-N.x),i.right-S),I=this.above[u];!f.strictSide&&(I?g.top-C-w-N.yi.bottom)&&I==i.bottom-g.bottom>g.top-i.top&&(I=this.above[u]=!I);let U=(I?g.top-i.top:i.bottom-g.bottom)-w;if(UM&&z.topE&&(E=I?z.top-C-2-w:z.bottom+w+2);if(this.position=="absolute"?(m.style.top=(E-n.parent.top)/o+"px",PS(m,(M-n.parent.left)/l)):(m.style.top=E/o+"px",PS(m,(M-n.fixedLeft)/l)),v){let z=g.left+(R?N.x:-N.x)-(M+14-7);v.style.left=z/l+"px"}d.overlap!==!0&&a.push({left:M,top:E,right:T,bottom:E+C}),m.classList.toggle("cm-tooltip-above",I),m.classList.toggle("cm-tooltip-below",!I),d.positioned&&d.positioned(n.space)}}maybeMeasure(){if(this.manager.tooltips.length&&(this.view.inView&&this.view.requestMeasure(this.measureReq),this.inView!=this.view.inView&&(this.inView=this.view.inView,!this.inView)))for(let n of this.manager.tooltipViews)n.dom.style.top=Ch}},{eventObservers:{scroll(){this.maybeMeasure()}}});function PS(n,e){let t=parseInt(n.style.left,10);(isNaN(t)||Math.abs(e-t)>1)&&(n.style.left=e+"px")}const w_=Oe.baseTheme({".cm-tooltip":{zIndex:500,boxSizing:"border-box"},"&light .cm-tooltip":{border:"1px solid #bbb",backgroundColor:"#f5f5f5"},"&light .cm-tooltip-section:not(:first-child)":{borderTop:"1px solid #bbb"},"&dark .cm-tooltip":{backgroundColor:"#333338",color:"white"},".cm-tooltip-arrow":{height:"7px",width:"14px",position:"absolute",zIndex:-1,overflow:"hidden","&:before, &:after":{content:"''",position:"absolute",width:0,height:0,borderLeft:"7px solid transparent",borderRight:"7px solid transparent"},".cm-tooltip-above &":{bottom:"-7px","&:before":{borderTop:"7px solid #bbb"},"&:after":{borderTop:"7px solid #f5f5f5",bottom:"1px"}},".cm-tooltip-below &":{top:"-7px","&:before":{borderBottom:"7px solid #bbb"},"&:after":{borderBottom:"7px solid #f5f5f5",top:"1px"}}},"&dark .cm-tooltip .cm-tooltip-arrow":{"&:before":{borderTopColor:"#333338",borderBottomColor:"#333338"},"&:after":{borderTopColor:"transparent",borderBottomColor:"transparent"}}}),k_={x:0,y:0},zy=Ce.define({enables:[Ly,w_]}),vd=Ce.define({combine:n=>n.reduce((e,t)=>e.concat(t),[])});class em{static create(e){return new em(e)}constructor(e){this.view=e,this.mounted=!1,this.dom=document.createElement("div"),this.dom.classList.add("cm-tooltip-hover"),this.manager=new AN(e,vd,(t,i)=>this.createHostedView(t,i),t=>t.dom.remove())}createHostedView(e,t){let i=e.create(this.view);return i.dom.classList.add("cm-tooltip-section"),this.dom.insertBefore(i.dom,t?t.dom.nextSibling:this.dom.firstChild),this.mounted&&i.mount&&i.mount(this.view),i}mount(e){for(let t of this.manager.tooltipViews)t.mount&&t.mount(e);this.mounted=!0}positioned(e){for(let t of this.manager.tooltipViews)t.positioned&&t.positioned(e)}update(e){this.manager.update(e)}destroy(){var e;for(let t of this.manager.tooltipViews)(e=t.destroy)===null||e===void 0||e.call(t)}passProp(e){let t;for(let i of this.manager.tooltipViews){let l=i[e];if(l!==void 0){if(t===void 0)t=l;else if(t!==l)return}}return t}get offset(){return this.passProp("offset")}get getCoords(){return this.passProp("getCoords")}get overlap(){return this.passProp("overlap")}get resize(){return this.passProp("resize")}}const S_=zy.compute([vd],n=>{let e=n.facet(vd);return e.length===0?null:{pos:Math.min(...e.map(t=>t.pos)),end:Math.max(...e.map(t=>{var i;return(i=t.end)!==null&&i!==void 0?i:t.pos})),create:em.create,above:e[0].above,arrow:e.some(t=>t.arrow)}}),MN=Ce.define();class C_{constructor(e,t,i,l,o,a){this.view=e,this.source=t,this.field=i,this.locked=l,this.setHover=o,this.hoverTime=a,this.hoverTimeout=-1,this.restartTimeout=-1,this.pending=null,this.lastMove={x:0,y:0,target:e.dom,time:0},this.checkHover=this.checkHover.bind(this),e.dom.addEventListener("mouseleave",this.mouseleave=this.mouseleave.bind(this)),e.dom.addEventListener("mousemove",this.mousemove=this.mousemove.bind(this))}update(e){this.pending&&(this.pending=null,clearTimeout(this.restartTimeout),this.restartTimeout=setTimeout(()=>this.startHover(),20))}get active(){return this.view.state.field(this.field)}checkHover(){if(this.hoverTimeout=-1,this.active.length)return;let e=Date.now()-this.lastMove.time;ea.bottom||t.xa.right+e.defaultCharacterWidth)return;let u=e.bidiSpans(e.state.doc.lineAt(l)).find(d=>d.from<=l&&d.to>=l),f=u&&u.dir==Ot.RTL?-1:1;o=t.x{if(u&&!(Array.isArray(u)&&!u.length)){let f=Array.isArray(u)?u:[u];l&&this.locked.set(f,l),e.dispatch({effects:this.setHover.of(f)})}};if(o&&"then"in o){let u=this.pending={pos:t};o.then(f=>{this.pending==u&&(this.pending=null,a(f))},f=>di(e.state,f,"hover tooltip"))}else a(o)}get tooltip(){let e=this.view.plugin(Ly),t=e?e.manager.tooltips.findIndex(i=>i.create==em.create):-1;return t>-1?e.manager.tooltipViews[t]:null}mousemove(e){var t,i;this.lastMove={x:e.clientX,y:e.clientY,target:e.target,time:Date.now()},this.hoverTimeout<0&&(this.hoverTimeout=setTimeout(this.checkHover,this.hoverTime));let{active:l,tooltip:o}=this;if(l.length&&!this.locked.has(l)&&o&&!O_(o.dom,e)||this.pending){let{pos:a}=l[0]||this.pending,u=(i=(t=l[0])===null||t===void 0?void 0:t.end)!==null&&i!==void 0?i:a;(a==u?this.view.posAtCoords(this.lastMove)!=a:!N_(this.view,a,u,e.clientX,e.clientY))&&(this.view.dispatch({effects:this.setHover.of([])}),this.pending=null)}}mouseleave(e){clearTimeout(this.hoverTimeout),this.hoverTimeout=-1;let{active:t}=this;if(t.length&&!this.locked.has(t)){let{tooltip:i}=this;i&&i.dom.contains(e.relatedTarget)?this.watchTooltipLeave(i.dom):this.view.dispatch({effects:this.setHover.of([])})}}watchTooltipLeave(e){let t=i=>{e.removeEventListener("mouseleave",t);let{active:l}=this;l.length&&!this.locked.has(l)&&!this.view.dom.contains(i.relatedTarget)&&this.view.dispatch({effects:this.setHover.of([])})};e.addEventListener("mouseleave",t)}destroy(){clearTimeout(this.hoverTimeout),clearTimeout(this.restartTimeout),this.view.dom.removeEventListener("mouseleave",this.mouseleave),this.view.dom.removeEventListener("mousemove",this.mousemove)}}const Oh=4;function O_(n,e){let{left:t,right:i,top:l,bottom:o}=n.getBoundingClientRect(),a;if(a=n.querySelector(".cm-tooltip-arrow")){let u=a.getBoundingClientRect();l=Math.min(u.top,l),o=Math.max(u.bottom,o)}return e.clientX>=t-Oh&&e.clientX<=i+Oh&&e.clientY>=l-Oh&&e.clientY<=o+Oh}function N_(n,e,t,i,l,o){let a=n.scrollDOM.getBoundingClientRect(),u=n.documentTop+n.documentPadding.top+n.contentHeight;if(a.left>i||a.rightl||Math.min(a.bottom,u)=e&&f<=t}function T_(n,e={}){let t=Ye.define(),i=new WeakMap,l=In.define({create(){return[]},update(a,u){let f=i.get(a);if(a.length&&(e.hideOnChange&&(u.docChanged||u.selection)?a=[]:f&&f(u)?a=[]:e.hideOn&&(a=a.filter(d=>!e.hideOn(u,d)))),u.docChanged&&a.length){let d=[];for(let m of a){let g=u.changes.mapPos(m.pos,-1,Kn.TrackDel);if(g!=null){let b=Object.assign(Object.create(null),m);b.pos=g,b.end!=null&&(b.end=u.changes.mapPos(b.end)),d.push(b)}}a=d}for(let d of u.effects)d.is(t)&&(a=d.value,f=void 0),(d.is(E_)&&!d.value||d.value==l)&&(a=[]);return a.length&&f&&i.set(a,f),a},provide:a=>vd.from(a)});const o=Jt.define(a=>new C_(a,n,l,i,t,e.hoverTime||300));return{active:l,extension:[l,o,MN.of(o),S_]}}function A_(n,e,t,i={}){var l;let o=n.state.facet(MN).map(a=>n.plugin(a)).filter(a=>!!a);if(i.tooltip&&i.tooltip.active){let a=o.find(u=>u.field==i.tooltip.active);a&&(o=[a])}for(let a of o)a.activateHover(n,e,t,(l=i.until)!==null&&l!==void 0?l:(()=>!1))}function DN(n,e){let t=n.plugin(Ly);if(!t)return null;let i=t.manager.tooltips.indexOf(e);return i<0?null:t.manager.tooltipViews[i]}const E_=Ye.define(),HS=Ce.define({combine(n){let e,t;for(let i of n)e=e||i.topContainer,t=t||i.bottomContainer;return{topContainer:e,bottomContainer:t}}});function tm(n,e){let t=n.plugin(jN),i=t?t.specs.indexOf(e):-1;return i>-1?t.panels[i]:null}const jN=Jt.fromClass(class{constructor(n){this.input=n.state.facet(mu),this.specs=this.input.filter(t=>t),this.panels=this.specs.map(t=>t(n));let e=n.state.facet(HS);this.top=new Nh(n,!0,e.topContainer),this.bottom=new Nh(n,!1,e.bottomContainer),this.top.sync(this.panels.filter(t=>t.top)),this.bottom.sync(this.panels.filter(t=>!t.top));for(let t of this.panels)t.dom.classList.add("cm-panel"),t.mount&&t.mount()}update(n){let e=n.state.facet(HS);this.top.container!=e.topContainer&&(this.top.sync([]),this.top=new Nh(n.view,!0,e.topContainer)),this.bottom.container!=e.bottomContainer&&(this.bottom.sync([]),this.bottom=new Nh(n.view,!1,e.bottomContainer)),this.top.syncClasses(),this.bottom.syncClasses();let t=n.state.facet(mu);if(t!=this.input){let i=t.filter(f=>f),l=[],o=[],a=[],u=[];for(let f of i){let d=this.specs.indexOf(f),m;d<0?(m=f(n.view),u.push(m)):(m=this.panels[d],m.update&&m.update(n)),l.push(m),(m.top?o:a).push(m)}this.specs=i,this.panels=l,this.top.sync(o),this.bottom.sync(a);for(let f of u)f.dom.classList.add("cm-panel"),f.mount&&f.mount()}else for(let i of this.panels)i.update&&i.update(n)}destroy(){this.top.sync([]),this.bottom.sync([])}},{provide:n=>Oe.scrollMargins.of(e=>{let t=e.plugin(n);return t&&{top:t.top.scrollMargin(),bottom:t.bottom.scrollMargin()}})});class Nh{constructor(e,t,i){this.view=e,this.top=t,this.container=i,this.dom=void 0,this.classes="",this.panels=[],this.syncClasses()}sync(e){for(let t of this.panels)t.destroy&&e.indexOf(t)<0&&t.destroy();this.panels=e,this.syncDOM()}syncDOM(){if(this.panels.length==0){this.dom&&(this.dom.remove(),this.dom=void 0);return}if(!this.dom){this.dom=document.createElement("div"),this.dom.className=this.top?"cm-panels cm-panels-top":"cm-panels cm-panels-bottom";let t=this.container||this.view.dom;t.insertBefore(this.dom,this.top?t.firstChild:null)}let e=this.dom.firstChild;for(let t of this.panels)if(t.dom.parentNode==this.dom){for(;e!=t.dom;)e=IS(e);e=e.nextSibling}else this.dom.insertBefore(t.dom,e);for(;e;)e=IS(e)}scrollMargin(){return!this.dom||this.container?0:Math.max(0,this.top?this.dom.getBoundingClientRect().bottom-Math.max(0,this.view.scrollDOM.getBoundingClientRect().top):Math.min(innerHeight,this.view.scrollDOM.getBoundingClientRect().bottom)-this.dom.getBoundingClientRect().top)}syncClasses(){if(!(!this.container||this.classes==this.view.themeClasses)){for(let e of this.classes.split(" "))e&&this.container.classList.remove(e);for(let e of(this.classes=this.view.themeClasses).split(" "))e&&this.container.classList.add(e)}}}function IS(n){let e=n.nextSibling;return n.remove(),e}const mu=Ce.define({enables:jN});function M_(n,e){let t,i=new Promise(a=>t=a),l=a=>j_(a,e,t);n.state.field(nd,!1)?n.dispatch({effects:RN.of(l)}):n.dispatch({effects:Ye.appendConfig.of(nd.init(()=>[l]))});let o=_N.of(l);return{close:o,result:i.then(a=>((n.win.queueMicrotask||(f=>n.win.setTimeout(f,10)))(()=>{n.state.field(nd).indexOf(l)>-1&&n.dispatch({effects:o})}),a))}}function D_(n,e){let t=n.state.field(nd,!1)||[];for(let i of t){let l=tm(n,i);if(l&&l.dom.classList.contains(e))return l}return null}const nd=In.define({create(){return[]},update(n,e){for(let t of e.effects)t.is(RN)?n=[t.value].concat(n):t.is(_N)&&(n=n.filter(i=>i!=t.value));return n},provide:n=>mu.computeN([n],e=>e.field(n))}),RN=Ye.define(),_N=Ye.define();function j_(n,e,t){let i=e.content?e.content(n,()=>u(null)):null;if(!i){if(i=Ct("form"),e.input){let f=Ct("input",e.input);/^(text|password|number|email|tel|url)$/.test(f.type)&&f.classList.add("cm-textfield"),f.name||(f.name="input"),i.appendChild(Ct("label",(e.label||"")+": ",f))}else i.appendChild(document.createTextNode(e.label||""));i.appendChild(document.createTextNode(" ")),i.appendChild(Ct("button",{class:"cm-button",type:"submit"},e.submitLabel||"OK"))}let l=i.nodeName=="FORM"?[i]:i.querySelectorAll("form");for(let f=0;f{m.keyCode==27?(m.preventDefault(),u(null)):m.keyCode==13&&(m.preventDefault(),u(d))}),d.addEventListener("submit",m=>{m.preventDefault(),u(d)})}let o=Ct("div",i,Ct("button",{onclick:()=>u(null),"aria-label":n.state.phrase("close"),class:"cm-dialog-close",type:"button"},["×"]));e.class&&(o.className=e.class),o.classList.add("cm-dialog");let a=typeof e.focus=="string"?i.querySelector(e.focus):e.focus?i.querySelector("input")||i.querySelector("button"):null;function u(f){o.contains(o.ownerDocument.activeElement)&&n.focus(),t(f)}return{dom:o,top:e.top,mount:()=>{a&&("select"in a?a.select():"focus"in a&&a.focus())},destroy:()=>t(null)}}class ol extends ns{compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}eq(e){return!1}destroy(e){}}ol.prototype.elementClass="";ol.prototype.toDOM=void 0;ol.prototype.mapMode=Kn.TrackBefore;ol.prototype.startSide=ol.prototype.endSide=-1;ol.prototype.point=!0;const id=Ce.define(),R_=Ce.define(),__={class:"",renderEmptyElements:!1,elementStyle:"",markers:()=>it.empty,lineMarker:()=>null,widgetMarker:()=>null,lineMarkerChange:null,initialSpacer:null,updateSpacer:null,domEventHandlers:{},side:"before"},tu=Ce.define();function L_(n){return[LN(),tu.of({...__,...n})]}const US=Ce.define({combine:n=>n.some(e=>e)});function LN(n){return[z_]}const z_=Jt.fromClass(class{constructor(n){this.view=n,this.domAfter=null,this.prevViewport=n.viewport,this.dom=document.createElement("div"),this.dom.className="cm-gutters cm-gutters-before",this.dom.setAttribute("aria-hidden","true"),this.dom.style.minHeight=this.view.contentHeight/this.view.scaleY+"px",this.gutters=n.state.facet(tu).map(e=>new qS(n,e)),this.fixed=!n.state.facet(US);for(let e of this.gutters)e.config.side=="after"?this.getDOMAfter().appendChild(e.dom):this.dom.appendChild(e.dom);this.fixed&&(this.dom.style.position="sticky"),this.syncGutters(!1),n.scrollDOM.insertBefore(this.dom,n.contentDOM)}getDOMAfter(){return this.domAfter||(this.domAfter=document.createElement("div"),this.domAfter.className="cm-gutters cm-gutters-after",this.domAfter.setAttribute("aria-hidden","true"),this.domAfter.style.minHeight=this.view.contentHeight/this.view.scaleY+"px",this.domAfter.style.position=this.fixed?"sticky":"",this.view.scrollDOM.appendChild(this.domAfter)),this.domAfter}update(n){if(this.updateGutters(n)){let e=this.prevViewport,t=n.view.viewport,i=Math.min(e.to,t.to)-Math.max(e.from,t.from);this.syncGutters(i<(t.to-t.from)*.8)}if(n.geometryChanged){let e=this.view.contentHeight/this.view.scaleY+"px";this.dom.style.minHeight=e,this.domAfter&&(this.domAfter.style.minHeight=e)}this.view.state.facet(US)!=!this.fixed&&(this.fixed=!this.fixed,this.dom.style.position=this.fixed?"sticky":"",this.domAfter&&(this.domAfter.style.position=this.fixed?"sticky":"")),this.prevViewport=n.view.viewport}syncGutters(n){let e=this.dom.nextSibling;n&&(this.dom.remove(),this.domAfter&&this.domAfter.remove());let t=it.iter(this.view.state.facet(id),this.view.viewport.from),i=[],l=this.gutters.map(o=>new B_(o,this.view.viewport,-this.view.documentPadding.top));for(let o of this.view.viewportLineBlocks)if(i.length&&(i=[]),Array.isArray(o.type)){let a=!0;for(let u of o.type)if(u.type==Ln.Text&&a){Lx(t,i,u.from);for(let f of l)f.line(this.view,u,i);a=!1}else if(u.widget)for(let f of l)f.widget(this.view,u)}else if(o.type==Ln.Text){Lx(t,i,o.from);for(let a of l)a.line(this.view,o,i)}else if(o.widget)for(let a of l)a.widget(this.view,o);for(let o of l)o.finish();n&&(this.view.scrollDOM.insertBefore(this.dom,e),this.domAfter&&this.view.scrollDOM.appendChild(this.domAfter))}updateGutters(n){let e=n.startState.facet(tu),t=n.state.facet(tu),i=n.docChanged||n.heightChanged||n.viewportChanged||!it.eq(n.startState.facet(id),n.state.facet(id),n.view.viewport.from,n.view.viewport.to);if(e==t)for(let l of this.gutters)l.update(n)&&(i=!0);else{i=!0;let l=[];for(let o of t){let a=e.indexOf(o);a<0?l.push(new qS(this.view,o)):(this.gutters[a].update(n),l.push(this.gutters[a]))}for(let o of this.gutters)o.dom.remove(),l.indexOf(o)<0&&o.destroy();for(let o of l)o.config.side=="after"?this.getDOMAfter().appendChild(o.dom):this.dom.appendChild(o.dom);this.gutters=l}return i}destroy(){for(let n of this.gutters)n.destroy();this.dom.remove(),this.domAfter&&this.domAfter.remove()}},{provide:n=>Oe.scrollMargins.of(e=>{let t=e.plugin(n);if(!t||t.gutters.length==0||!t.fixed)return null;let i=t.dom.offsetWidth*e.scaleX,l=t.domAfter?t.domAfter.offsetWidth*e.scaleX:0;return e.textDirection==Ot.LTR?{left:i,right:l}:{right:i,left:l}})});function FS(n){return Array.isArray(n)?n:[n]}function Lx(n,e,t){for(;n.value&&n.from<=t;)n.from==t&&e.push(n.value),n.next()}class B_{constructor(e,t,i){this.gutter=e,this.height=i,this.i=0,this.cursor=it.iter(e.markers,t.from)}addElement(e,t,i){let{gutter:l}=this,o=(t.top-this.height)/e.scaleY,a=t.height/e.scaleY;if(this.i==l.elements.length){let u=new zN(e,a,o,i);l.elements.push(u),l.dom.appendChild(u.dom)}else l.elements[this.i].update(e,a,o,i);this.height=t.bottom,this.i++}line(e,t,i){let l=[];Lx(this.cursor,l,t.from),i.length&&(l=l.concat(i));let o=this.gutter.config.lineMarker(e,t,l);o&&l.unshift(o);let a=this.gutter;l.length==0&&!a.config.renderEmptyElements||this.addElement(e,t,l)}widget(e,t){let i=this.gutter.config.widgetMarker(e,t.widget,t),l=i?[i]:null;for(let o of e.state.facet(R_)){let a=o(e,t.widget,t);a&&(l||(l=[])).push(a)}l&&this.addElement(e,t,l)}finish(){let e=this.gutter;for(;e.elements.length>this.i;){let t=e.elements.pop();e.dom.removeChild(t.dom),t.destroy()}}}class qS{constructor(e,t){this.view=e,this.config=t,this.elements=[],this.spacer=null,this.dom=document.createElement("div"),this.dom.className="cm-gutter"+(this.config.class?" "+this.config.class:"");for(let i in t.domEventHandlers)this.dom.addEventListener(i,l=>{let o=l.target,a;if(o!=this.dom&&this.dom.contains(o)){for(;o.parentNode!=this.dom;)o=o.parentNode;let f=o.getBoundingClientRect();a=(f.top+f.bottom)/2}else a=l.clientY;let u=e.lineBlockAtHeight(a-e.documentTop);t.domEventHandlers[i](e,u,l)&&l.preventDefault()});this.markers=FS(t.markers(e)),t.initialSpacer&&(this.spacer=new zN(e,0,0,[t.initialSpacer(e)]),this.dom.appendChild(this.spacer.dom),this.spacer.dom.style.cssText+="visibility: hidden; pointer-events: none")}update(e){let t=this.markers;if(this.markers=FS(this.config.markers(e.view)),this.spacer&&this.config.updateSpacer){let l=this.config.updateSpacer(this.spacer.markers[0],e);l!=this.spacer.markers[0]&&this.spacer.update(e.view,0,0,[l])}let i=e.view.viewport;return!it.eq(this.markers,t,i.from,i.to)||(this.config.lineMarkerChange?this.config.lineMarkerChange(e):!1)}destroy(){for(let e of this.elements)e.destroy()}}class zN{constructor(e,t,i,l){this.height=-1,this.above=0,this.markers=[],this.dom=document.createElement("div"),this.dom.className="cm-gutterElement",this.update(e,t,i,l)}update(e,t,i,l){this.height!=t&&(this.height=t,this.dom.style.height=t+"px"),this.above!=i&&(this.dom.style.marginTop=(this.above=i)?i+"px":""),P_(this.markers,l)||this.setMarkers(e,l)}setMarkers(e,t){let i="cm-gutterElement",l=this.dom.firstChild;for(let o=0,a=0;;){let u=a,f=oo(u,f,d)||a(u,f,d):a}return i}})}});class f0 extends ol{constructor(e){super(),this.number=e}eq(e){return this.number==e.number}toDOM(){return document.createTextNode(this.number)}}function h0(n,e){return n.state.facet(ca).formatNumber(e,n.state)}const U_=tu.compute([ca],n=>({class:"cm-lineNumbers",renderEmptyElements:!1,markers(e){return e.state.facet(H_)},lineMarker(e,t,i){return i.some(l=>l.toDOM)?null:new f0(h0(e,e.state.doc.lineAt(t.from).number))},widgetMarker:(e,t,i)=>{for(let l of e.state.facet(I_)){let o=l(e,t,i);if(o)return o}return null},lineMarkerChange:e=>e.startState.facet(ca)!=e.state.facet(ca),initialSpacer(e){return new f0(h0(e,VS(e.state.doc.lines)))},updateSpacer(e,t){let i=h0(t.view,VS(t.view.state.doc.lines));return i==e.number?e:new f0(i)},domEventHandlers:n.facet(ca).domEventHandlers,side:"before"}));function F_(n={}){return[ca.of(n),LN(),U_]}function VS(n){let e=9;for(;e{let e=[],t=-1;for(let i of n.selection.ranges){let l=n.doc.lineAt(i.head).from;l>t&&(t=l,e.push(q_.range(l)))}return it.of(e)});function Q_(){return V_}const BN=1024;let X_=0;class d0{constructor(e,t){this.from=e,this.to=t}}class Je{constructor(e={}){this.id=X_++,this.perNode=!!e.perNode,this.deserialize=e.deserialize||(()=>{throw new Error("This node type doesn't define a deserialize function")}),this.combine=e.combine||null}add(e){if(this.perNode)throw new RangeError("Can't add per-node props to node types");return typeof e!="function"&&(e=pi.match(e)),t=>{let i=e(t);return i===void 0?null:[this,i]}}}Je.closedBy=new Je({deserialize:n=>n.split(" ")});Je.openedBy=new Je({deserialize:n=>n.split(" ")});Je.group=new Je({deserialize:n=>n.split(" ")});Je.isolate=new Je({deserialize:n=>{if(n&&n!="rtl"&&n!="ltr"&&n!="auto")throw new RangeError("Invalid value for isolate: "+n);return n||"auto"}});Je.contextHash=new Je({perNode:!0});Je.lookAhead=new Je({perNode:!0});Je.mounted=new Je({perNode:!0});class nu{constructor(e,t,i,l=!1){this.tree=e,this.overlay=t,this.parser=i,this.bracketed=l}static get(e){return e&&e.props&&e.props[Je.mounted.id]}}const $_=Object.create(null);class pi{constructor(e,t,i,l=0){this.name=e,this.props=t,this.id=i,this.flags=l}static define(e){let t=e.props&&e.props.length?Object.create(null):$_,i=(e.top?1:0)|(e.skipped?2:0)|(e.error?4:0)|(e.name==null?8:0),l=new pi(e.name||"",t,e.id,i);if(e.props){for(let o of e.props)if(Array.isArray(o)||(o=o(l)),o){if(o[0].perNode)throw new RangeError("Can't store a per-node prop on a node type");t[o[0].id]=o[1]}}return l}prop(e){return this.props[e.id]}get isTop(){return(this.flags&1)>0}get isSkipped(){return(this.flags&2)>0}get isError(){return(this.flags&4)>0}get isAnonymous(){return(this.flags&8)>0}is(e){if(typeof e=="string"){if(this.name==e)return!0;let t=this.prop(Je.group);return t?t.indexOf(e)>-1:!1}return this.id==e}static match(e){let t=Object.create(null);for(let i in e)for(let l of i.split(" "))t[l]=e[i];return i=>{for(let l=i.prop(Je.group),o=-1;o<(l?l.length:0);o++){let a=t[o<0?i.name:l[o]];if(a)return a}}}}pi.none=new pi("",Object.create(null),0,8);class By{constructor(e){this.types=e;for(let t=0;t0;for(let f=this.cursor(a|$t.IncludeAnonymous);;){let d=!1;if(f.from<=o&&f.to>=l&&(!u&&f.type.isAnonymous||t(f)!==!1)){if(f.firstChild())continue;d=!0}for(;d&&i&&(u||!f.type.isAnonymous)&&i(f),!f.nextSibling();){if(!f.parent())return;d=!0}}}prop(e){return e.perNode?this.props?this.props[e.id]:void 0:this.type.prop(e)}get propValues(){let e=[];if(this.props)for(let t in this.props)e.push([+t,this.props[t]]);return e}balance(e={}){return this.children.length<=8?this:Iy(pi.none,this.children,this.positions,0,this.children.length,0,this.length,(t,i,l)=>new cn(this.type,t,i,l,this.propValues),e.makeTree||((t,i,l)=>new cn(pi.none,t,i,l)))}static build(e){return W_(e)}}cn.empty=new cn(pi.none,[],[],0);class Py{constructor(e,t){this.buffer=e,this.index=t}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}get pos(){return this.index}next(){this.index-=4}fork(){return new Py(this.buffer,this.index)}}class ss{constructor(e,t,i){this.buffer=e,this.length=t,this.set=i}get type(){return pi.none}toString(){let e=[];for(let t=0;t0));f=a[f+3]);return u}slice(e,t,i){let l=this.buffer,o=new Uint16Array(t-e),a=0;for(let u=e,f=0;u=e&&te;case 1:return t<=e&&i>e;case 2:return i>e;case 4:return!0}}function pu(n,e,t,i){for(var l;n.from==n.to||(t<1?n.from>=e:n.from>e)||(t>-1?n.to<=e:n.to0?u.length:-1;e!=d;e+=t){let m=u[e],g=f[e]+a.from,b;if(!(!(o&$t.EnterBracketed&&m instanceof cn&&(b=nu.get(m))&&!b.overlay&&b.bracketed&&i>=g&&i<=g+m.length)&&!PN(l,i,g,g+m.length))){if(m instanceof ss){if(o&$t.ExcludeBuffers)continue;let v=m.findChild(0,m.buffer.length,t,i-g,l);if(v>-1)return new Wl(new Y_(a,m,e,g),null,v)}else if(o&$t.IncludeAnonymous||!m.type.isAnonymous||Hy(m)){let v;if(!(o&$t.IgnoreMounts)&&(v=nu.get(m))&&!v.overlay)return new qi(v.tree,g,e,a);let w=new qi(m,g,e,a);return o&$t.IncludeAnonymous||!w.type.isAnonymous?w:w.nextChild(t<0?m.children.length-1:0,t,i,l,o)}}}if(o&$t.IncludeAnonymous||!a.type.isAnonymous||(a.index>=0?e=a.index+t:e=t<0?-1:a._parent._tree.children.length,a=a._parent,!a))return null}}get firstChild(){return this.nextChild(0,1,0,4)}get lastChild(){return this.nextChild(this._tree.children.length-1,-1,0,4)}childAfter(e){return this.nextChild(0,1,e,2)}childBefore(e){return this.nextChild(this._tree.children.length-1,-1,e,-2)}prop(e){return this._tree.prop(e)}enter(e,t,i=0){let l;if(!(i&$t.IgnoreOverlays)&&(l=nu.get(this._tree))&&l.overlay){let o=e-this.from,a=i&$t.EnterBracketed&&l.bracketed;for(let{from:u,to:f}of l.overlay)if((t>0||a?u<=o:u=o:f>o))return new qi(l.tree,l.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,e,t,i)}nextSignificantParent(){let e=this;for(;e.type.isAnonymous&&e._parent;)e=e._parent;return e}get parent(){return this._parent?this._parent.nextSignificantParent():null}get nextSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index+1,1,0,4):null}get prevSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index-1,-1,0,4):null}get tree(){return this._tree}toTree(){return this._tree}toString(){return this._tree.toString()}}function XS(n,e,t,i){let l=n.cursor(),o=[];if(!l.firstChild())return o;if(t!=null){for(let a=!1;!a;)if(a=l.type.is(t),!l.nextSibling())return o}for(;;){if(i!=null&&l.type.is(i))return o;if(l.type.is(e)&&o.push(l.node),!l.nextSibling())return i==null?o:[]}}function zx(n,e,t=e.length-1){for(let i=n;t>=0;i=i.parent){if(!i)return!1;if(!i.type.isAnonymous){if(e[t]&&e[t]!=i.name)return!1;t--}}return!0}class Y_{constructor(e,t,i,l){this.parent=e,this.buffer=t,this.index=i,this.start=l}}class Wl extends HN{get name(){return this.type.name}get from(){return this.context.start+this.context.buffer.buffer[this.index+1]}get to(){return this.context.start+this.context.buffer.buffer[this.index+2]}constructor(e,t,i){super(),this.context=e,this._parent=t,this.index=i,this.type=e.buffer.set.types[e.buffer.buffer[i]]}child(e,t,i){let{buffer:l}=this.context,o=l.findChild(this.index+4,l.buffer[this.index+3],e,t-this.context.start,i);return o<0?null:new Wl(this.context,this,o)}get firstChild(){return this.child(1,0,4)}get lastChild(){return this.child(-1,0,4)}childAfter(e){return this.child(1,e,2)}childBefore(e){return this.child(-1,e,-2)}prop(e){return this.type.prop(e)}enter(e,t,i=0){if(i&$t.ExcludeBuffers)return null;let{buffer:l}=this.context,o=l.findChild(this.index+4,l.buffer[this.index+3],t>0?1:-1,e-this.context.start,t);return o<0?null:new Wl(this.context,this,o)}get parent(){return this._parent||this.context.parent.nextSignificantParent()}externalSibling(e){return this._parent?null:this.context.parent.nextChild(this.context.index+e,e,0,4)}get nextSibling(){let{buffer:e}=this.context,t=e.buffer[this.index+3];return t<(this._parent?e.buffer[this._parent.index+3]:e.buffer.length)?new Wl(this.context,this._parent,t):this.externalSibling(1)}get prevSibling(){let{buffer:e}=this.context,t=this._parent?this._parent.index+4:0;return this.index==t?this.externalSibling(-1):new Wl(this.context,this._parent,e.findChild(t,this.index,-1,0,4))}get tree(){return null}toTree(){let e=[],t=[],{buffer:i}=this.context,l=this.index+4,o=i.buffer[this.index+3];if(o>l){let a=i.buffer[this.index+1];e.push(i.slice(l,o,a)),t.push(0)}return new cn(this.type,e,t,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function IN(n){if(!n.length)return null;let e=0,t=n[0];for(let o=1;ot.from||a.to=e){let u=new qi(a.tree,a.overlay[0].from+o.from,-1,o);(l||(l=[i])).push(pu(u,e,t,!1))}}return l?IN(l):i}class Bx{get name(){return this.type.name}constructor(e,t=0){if(this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,this.mode=t&~$t.EnterBracketed,e instanceof qi)this.yieldNode(e);else{this._tree=e.context.parent,this.buffer=e.context;for(let i=e._parent;i;i=i._parent)this.stack.unshift(i.index);this.bufferNode=e,this.yieldBuf(e.index)}}yieldNode(e){return e?(this._tree=e,this.type=e.type,this.from=e.from,this.to=e.to,!0):!1}yieldBuf(e,t){this.index=e;let{start:i,buffer:l}=this.buffer;return this.type=t||l.set.types[l.buffer[e]],this.from=i+l.buffer[e+1],this.to=i+l.buffer[e+2],!0}yield(e){return e?e instanceof qi?(this.buffer=null,this.yieldNode(e)):(this.buffer=e.context,this.yieldBuf(e.index,e.type)):!1}toString(){return this.buffer?this.buffer.buffer.childString(this.index):this._tree.toString()}enterChild(e,t,i){if(!this.buffer)return this.yield(this._tree.nextChild(e<0?this._tree._tree.children.length-1:0,e,t,i,this.mode));let{buffer:l}=this.buffer,o=l.findChild(this.index+4,l.buffer[this.index+3],e,t-this.buffer.start,i);return o<0?!1:(this.stack.push(this.index),this.yieldBuf(o))}firstChild(){return this.enterChild(1,0,4)}lastChild(){return this.enterChild(-1,0,4)}childAfter(e){return this.enterChild(1,e,2)}childBefore(e){return this.enterChild(-1,e,-2)}enter(e,t,i=this.mode){return this.buffer?i&$t.ExcludeBuffers?!1:this.enterChild(1,e,t):this.yield(this._tree.enter(e,t,i))}parent(){if(!this.buffer)return this.yieldNode(this.mode&$t.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let e=this.mode&$t.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent();return this.buffer=null,this.yieldNode(e)}sibling(e){if(!this.buffer)return this._tree._parent?this.yield(this._tree.index<0?null:this._tree._parent.nextChild(this._tree.index+e,e,0,4,this.mode)):!1;let{buffer:t}=this.buffer,i=this.stack.length-1;if(e<0){let l=i<0?0:this.stack[i]+4;if(this.index!=l)return this.yieldBuf(t.findChild(l,this.index,-1,0,4))}else{let l=t.buffer[this.index+3];if(l<(i<0?t.buffer.length:t.buffer[this.stack[i]+3]))return this.yieldBuf(l)}return i<0?this.yield(this.buffer.parent.nextChild(this.buffer.index+e,e,0,4,this.mode)):!1}nextSibling(){return this.sibling(1)}prevSibling(){return this.sibling(-1)}atLastNode(e){let t,i,{buffer:l}=this;if(l){if(e>0){if(this.index-1)for(let o=t+e,a=e<0?-1:i._tree.children.length;o!=a;o+=e){let u=i._tree.children[o];if(this.mode&$t.IncludeAnonymous||u instanceof ss||!u.type.isAnonymous||Hy(u))return!1}return!0}move(e,t){if(t&&this.enterChild(e,0,4))return!0;for(;;){if(this.sibling(e))return!0;if(this.atLastNode(e)||!this.parent())return!1}}next(e=!0){return this.move(1,e)}prev(e=!0){return this.move(-1,e)}moveTo(e,t=0){for(;(this.from==this.to||(t<1?this.from>=e:this.from>e)||(t>-1?this.to<=e:this.to=0;){for(let a=e;a;a=a._parent)if(a.index==l){if(l==this.index)return a;t=a,i=o+1;break e}l=this.stack[--o]}for(let l=i;l=0;o--){if(o<0)return zx(this._tree,e,l);let a=i[t.buffer[this.stack[o]]];if(!a.isAnonymous){if(e[l]&&e[l]!=a.name)return!1;l--}}return!0}}function Hy(n){return n.children.some(e=>e instanceof ss||!e.type.isAnonymous||Hy(e))}function W_(n){var e;let{buffer:t,nodeSet:i,maxBufferLength:l=BN,reused:o=[],minRepeatType:a=i.types.length}=n,u=Array.isArray(t)?new Py(t,t.length):t,f=i.types,d=0,m=0;function g(U,E,T,z,ie,q){let{id:J,start:F,end:se,size:he}=u,ne=m,L=d;if(he<0)if(u.next(),he==-1){let Le=o[J];T.push(Le),z.push(F-U);return}else if(he==-3){d=J;return}else if(he==-4){m=J;return}else throw new RangeError(`Unrecognized record size: ${he}`);let ee=f[J],oe,le,A=F-U;if(se-F<=l&&(le=C(u.pos-E,ie))){let Le=new Uint16Array(le.size-le.skip),_e=u.pos-le.size,B=Le.length;for(;u.pos>_e;)B=N(le.start,Le,B);oe=new ss(Le,se-le.start,i),A=le.start-U}else{let Le=u.pos-he;u.next();let _e=[],B=[],j=J>=a?J:-1,$=0,fe=se,me=ne;for(;u.pos>Le;)j>=0&&u.id==j&&u.size>=0?(u.end<=fe-l&&(w(_e,B,F,$,u.end,fe,j,me,L),$=_e.length,fe=u.end,me=m),u.next()):q>2500?b(F,Le,_e,B):(j>=0&&u.size==-1&&o[u.id].type==i.types[j]&&($<_e.length&&w(_e,B,F,$,u.end,fe,j,me,L),$=_e.length+1,fe=u.start,me=m),g(F,Le,_e,B,j,q+1));if(j>=0&&$>0&&$<_e.length&&w(_e,B,F,$,F,fe,j,me,L),_e.reverse(),B.reverse(),j>-1&&$>0){let Ne=v(ee,L);oe=Iy(ee,_e,B,0,_e.length,0,se-F,Ne,Ne)}else oe=S(ee,_e,B,se-F,ne-se,L)}T.push(oe),z.push(A)}function b(U,E,T,z){let ie=[],q=0,J=-1;for(;u.pos>E;){let{id:F,start:se,end:he,size:ne}=u;if(ne>4)u.next();else{if(J>-1&&se=0;he-=3)F[ne++]=ie[he],F[ne++]=ie[he+1]-se,F[ne++]=ie[he+2]-se,F[ne++]=ne;T.push(new ss(F,ie[2]-se,i)),z.push(se-U)}}function v(U,E){return(T,z,ie)=>{let q=0,J=T.length-1,F,se;if(J>=0&&(F=T[J])instanceof cn){if(!J&&F.type==U&&F.length==ie)return F;(se=F.prop(Je.lookAhead))&&(q=z[J]+F.length+se-ie)}return S(U,T,z,ie,q,E)}}function w(U,E,T,z,ie,q,J,F,se){let he=[],ne=[];for(;U.length>z;)he.push(U.pop()),ne.push(E.pop()+T-ie);U.push(S(i.types[J],he,ne,q-ie,F-q,se)),E.push(ie-T)}function S(U,E,T,z,ie,q,J){if(q){let F=[Je.contextHash,q];J=J?[F].concat(J):[F]}if(ie>25){let F=[Je.lookAhead,ie];J=J?[F].concat(J):[F]}return new cn(U,E,T,z,J)}function C(U,E){let T=u.fork(),z=0,ie=0,q=0,J=T.end-l,F={size:0,start:0,skip:0};e:for(let se=T.pos-U;T.pos>se;){let he=T.size;if(T.id==E&&he>=0){F.size=z,F.start=ie,F.skip=q,q+=4,z+=4,T.next();continue}let ne=T.pos-he;if(he<0||ne=a?4:0,ee=T.start;for(T.next();T.pos>ne;){if(T.size<0)if(T.size==-3||T.size==-4)L+=4;else break e;else T.id>=a&&(L+=4);T.next()}ie=ee,z+=he,q+=L}return(E<0||z==U)&&(F.size=z,F.start=ie,F.skip=q),F.size>4?F:void 0}function N(U,E,T){let{id:z,start:ie,end:q,size:J}=u;if(u.next(),J>=0&&z4){let se=u.pos-(J-4);for(;u.pos>se;)T=N(U,E,T)}E[--T]=F,E[--T]=q-U,E[--T]=ie-U,E[--T]=z}else J==-3?d=z:J==-4&&(m=z);return T}let R=[],M=[];for(;u.pos>0;)g(n.start||0,n.bufferStart||0,R,M,-1,0);let I=(e=n.length)!==null&&e!==void 0?e:R.length?M[0]+R[0].length:0;return new cn(f[n.topID],R.reverse(),M.reverse(),I)}const $S=new WeakMap;function rd(n,e){if(!n.isAnonymous||e instanceof ss||e.type!=n)return 1;let t=$S.get(e);if(t==null){t=1;for(let i of e.children){if(i.type!=n||!(i instanceof cn)){t=1;break}t+=rd(n,i)}$S.set(e,t)}return t}function Iy(n,e,t,i,l,o,a,u,f){let d=0;for(let w=i;w=m)break;E+=T}if(M==I+1){if(E>m){let T=w[I];v(T.children,T.positions,0,T.children.length,S[I]+R);continue}g.push(w[I])}else{let T=S[M-1]+w[M-1].length-U;g.push(Iy(n,w,S,I,M,U,T,null,f))}b.push(U+R-o)}}return v(e,t,i,l,0),(u||f)(g,b,a)}class Js{constructor(e,t,i,l,o=!1,a=!1){this.from=e,this.to=t,this.tree=i,this.offset=l,this.open=(o?1:0)|(a?2:0)}get openStart(){return(this.open&1)>0}get openEnd(){return(this.open&2)>0}static addTree(e,t=[],i=!1){let l=[new Js(0,e.length,e,0,!1,i)];for(let o of t)o.to>e.length&&l.push(o);return l}static applyChanges(e,t,i=128){if(!t.length)return e;let l=[],o=1,a=e.length?e[0]:null;for(let u=0,f=0,d=0;;u++){let m=u=i)for(;a&&a.from=b.from||g<=b.to||d){let v=Math.max(b.from,f)-d,w=Math.min(b.to,g)-d;b=v>=w?null:new Js(v,w,b.tree,b.offset+d,u>0,!!m)}if(b&&l.push(b),a.to>g)break;a=onew d0(l.from,l.to)):[new d0(0,0)]:[new d0(0,e.length)],this.createParse(e,t||[],i)}parse(e,t,i){let l=this.startParse(e,t,i);for(;;){let o=l.advance();if(o)return o}}}class Z_{constructor(e){this.string=e}get length(){return this.string.length}chunk(e){return this.string.slice(e)}get lineChunks(){return!1}read(e,t){return this.string.slice(e,t)}}new Je({perNode:!0});let J_=0,tl=class Px{constructor(e,t,i,l){this.name=e,this.set=t,this.base=i,this.modified=l,this.id=J_++}toString(){let{name:e}=this;for(let t of this.modified)t.name&&(e=`${t.name}(${e})`);return e}static define(e,t){let i=typeof e=="string"?e:"?";if(e instanceof Px&&(t=e),t!=null&&t.base)throw new Error("Can not derive from a modified tag");let l=new Px(i,[],null,[]);if(l.set.push(l),t)for(let o of t.set)l.set.push(o);return l}static defineModifier(e){let t=new wd(e);return i=>i.modified.indexOf(t)>-1?i:wd.get(i.base||i,i.modified.concat(t).sort((l,o)=>l.id-o.id))}},eL=0;class wd{constructor(e){this.name=e,this.instances=[],this.id=eL++}static get(e,t){if(!t.length)return e;let i=t[0].instances.find(u=>u.base==e&&tL(t,u.modified));if(i)return i;let l=[],o=new tl(e.name,l,e,t);for(let u of t)u.instances.push(o);let a=nL(t);for(let u of e.set)if(!u.modified.length)for(let f of a)l.push(wd.get(u,f));return o}}function tL(n,e){return n.length==e.length&&n.every((t,i)=>t==e[i])}function nL(n){let e=[[]];for(let t=0;ti.length-t.length)}function FN(n){let e=Object.create(null);for(let t in n){let i=n[t];Array.isArray(i)||(i=[i]);for(let l of t.split(" "))if(l){let o=[],a=2,u=l;for(let g=0;;){if(u=="..."&&g>0&&g+3==l.length){a=1;break}let b=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(u);if(!b)throw new RangeError("Invalid path: "+l);if(o.push(b[0]=="*"?"":b[0][0]=='"'?JSON.parse(b[0]):b[0]),g+=b[0].length,g==l.length)break;let v=l[g++];if(g==l.length&&v=="!"){a=0;break}if(v!="/")throw new RangeError("Invalid path: "+l);u=l.slice(g)}let f=o.length-1,d=o[f];if(!d)throw new RangeError("Invalid path: "+l);let m=new gu(i,a,f>0?o.slice(0,f):null);e[d]=m.sort(e[d])}}return qN.add(e)}const qN=new Je({combine(n,e){let t,i,l;for(;n||e;){if(!n||e&&n.depth<=e.depth?(l=e,e=e.next):(l=n,n=n.next),t&&t.mode==l.mode&&!l.context&&!t.context)continue;let o=new gu(l.tags,l.mode,l.context);t?t.next=o:i=o,t=o}return i}});class gu{constructor(e,t,i,l){this.tags=e,this.mode=t,this.context=i,this.next=l}get opaque(){return this.mode==0}get inherit(){return this.mode==1}sort(e){return!e||e.depth{let a=l;for(let u of o)for(let f of u.set){let d=t[f.id];if(d){a=a?a+" "+d:d;break}}return a},scope:i}}function iL(n,e){let t=null;for(let i of n){let l=i.style(e);l&&(t=t?t+" "+l:l)}return t}function rL(n,e,t,i=0,l=n.length){let o=new lL(i,Array.isArray(e)?e:[e],t);o.highlightRange(n.cursor(),i,l,"",o.highlighters),o.flush(l)}class lL{constructor(e,t,i){this.at=e,this.highlighters=t,this.span=i,this.class=""}startSpan(e,t){t!=this.class&&(this.flush(e),e>this.at&&(this.at=e),this.class=t)}flush(e){e>this.at&&this.class&&this.span(this.at,e,this.class)}highlightRange(e,t,i,l,o){let{type:a,from:u,to:f}=e;if(u>=i||f<=t)return;a.isTop&&(o=this.highlighters.filter(v=>!v.scope||v.scope(a)));let d=l,m=sL(e)||gu.empty,g=iL(o,m.tags);if(g&&(d&&(d+=" "),d+=g,m.mode==1&&(l+=(l?" ":"")+g)),this.startSpan(Math.max(t,u),d),m.opaque)return;let b=e.tree&&e.tree.prop(Je.mounted);if(b&&b.overlay){let v=e.node.enter(b.overlay[0].from+u,1),w=this.highlighters.filter(C=>!C.scope||C.scope(b.tree.type)),S=e.firstChild();for(let C=0,N=u;;C++){let R=C=M||!e.nextSibling())););if(!R||M>i)break;N=R.to+u,N>t&&(this.highlightRange(v.cursor(),Math.max(t,R.from+u),Math.min(i,N),"",w),this.startSpan(Math.min(i,N),d))}S&&e.parent()}else if(e.firstChild()){b&&(l="");do if(!(e.to<=t)){if(e.from>=i)break;this.highlightRange(e,t,i,l,o),this.startSpan(Math.min(i,e.to),d)}while(e.nextSibling());e.parent()}}}function sL(n){let e=n.type.prop(qN);for(;e&&e.context&&!n.matchContext(e.context);)e=e.next;return e||null}const be=tl.define,Ah=be(),Xl=be(),YS=be(Xl),GS=be(Xl),$l=be(),Eh=be($l),m0=be($l),Or=be(),Us=be(Or),Sr=be(),Cr=be(),Hx=be(),Pc=be(Hx),Mh=be(),ge={comment:Ah,lineComment:be(Ah),blockComment:be(Ah),docComment:be(Ah),name:Xl,variableName:be(Xl),typeName:YS,tagName:be(YS),propertyName:GS,attributeName:be(GS),className:be(Xl),labelName:be(Xl),namespace:be(Xl),macroName:be(Xl),literal:$l,string:Eh,docString:be(Eh),character:be(Eh),attributeValue:be(Eh),number:m0,integer:be(m0),float:be(m0),bool:be($l),regexp:be($l),escape:be($l),color:be($l),url:be($l),keyword:Sr,self:be(Sr),null:be(Sr),atom:be(Sr),unit:be(Sr),modifier:be(Sr),operatorKeyword:be(Sr),controlKeyword:be(Sr),definitionKeyword:be(Sr),moduleKeyword:be(Sr),operator:Cr,derefOperator:be(Cr),arithmeticOperator:be(Cr),logicOperator:be(Cr),bitwiseOperator:be(Cr),compareOperator:be(Cr),updateOperator:be(Cr),definitionOperator:be(Cr),typeOperator:be(Cr),controlOperator:be(Cr),punctuation:Hx,separator:be(Hx),bracket:Pc,angleBracket:be(Pc),squareBracket:be(Pc),paren:be(Pc),brace:be(Pc),content:Or,heading:Us,heading1:be(Us),heading2:be(Us),heading3:be(Us),heading4:be(Us),heading5:be(Us),heading6:be(Us),contentSeparator:be(Or),list:be(Or),quote:be(Or),emphasis:be(Or),strong:be(Or),link:be(Or),monospace:be(Or),strikethrough:be(Or),inserted:be(),deleted:be(),changed:be(),invalid:be(),meta:Mh,documentMeta:be(Mh),annotation:be(Mh),processingInstruction:be(Mh),definition:tl.defineModifier("definition"),constant:tl.defineModifier("constant"),function:tl.defineModifier("function"),standard:tl.defineModifier("standard"),local:tl.defineModifier("local"),special:tl.defineModifier("special")};for(let n in ge){let e=ge[n];e instanceof tl&&(e.name=n)}VN([{tag:ge.link,class:"tok-link"},{tag:ge.heading,class:"tok-heading"},{tag:ge.emphasis,class:"tok-emphasis"},{tag:ge.strong,class:"tok-strong"},{tag:ge.keyword,class:"tok-keyword"},{tag:ge.atom,class:"tok-atom"},{tag:ge.bool,class:"tok-bool"},{tag:ge.url,class:"tok-url"},{tag:ge.labelName,class:"tok-labelName"},{tag:ge.inserted,class:"tok-inserted"},{tag:ge.deleted,class:"tok-deleted"},{tag:ge.literal,class:"tok-literal"},{tag:ge.string,class:"tok-string"},{tag:ge.number,class:"tok-number"},{tag:[ge.regexp,ge.escape,ge.special(ge.string)],class:"tok-string2"},{tag:ge.variableName,class:"tok-variableName"},{tag:ge.local(ge.variableName),class:"tok-variableName tok-local"},{tag:ge.definition(ge.variableName),class:"tok-variableName tok-definition"},{tag:ge.special(ge.variableName),class:"tok-variableName2"},{tag:ge.definition(ge.propertyName),class:"tok-propertyName tok-definition"},{tag:ge.typeName,class:"tok-typeName"},{tag:ge.namespace,class:"tok-namespace"},{tag:ge.className,class:"tok-className"},{tag:ge.macroName,class:"tok-macroName"},{tag:ge.propertyName,class:"tok-propertyName"},{tag:ge.operator,class:"tok-operator"},{tag:ge.comment,class:"tok-comment"},{tag:ge.meta,class:"tok-meta"},{tag:ge.invalid,class:"tok-invalid"},{tag:ge.punctuation,class:"tok-punctuation"}]);var p0;const ua=new Je;function oL(n){return Ce.define({combine:n?e=>e.concat(n):void 0})}const aL=new Je;class tr{constructor(e,t,i=[],l=""){this.data=e,this.name=l,dt.prototype.hasOwnProperty("tree")||Object.defineProperty(dt.prototype,"tree",{get(){return Hn(this)}}),this.parser=t,this.extension=[os.of(this),dt.languageData.of((o,a,u)=>{let f=KS(o,a,u),d=f.type.prop(ua);if(!d)return[];let m=o.facet(d),g=f.type.prop(aL);if(g){let b=f.resolve(a-f.from,u);for(let v of g)if(v.test(b,o)){let w=o.facet(v.facet);return v.type=="replace"?w:w.concat(m)}}return m})].concat(i)}isActiveAt(e,t,i=-1){return KS(e,t,i).type.prop(ua)==this.data}findRegions(e){let t=e.facet(os);if((t==null?void 0:t.data)==this.data)return[{from:0,to:e.doc.length}];if(!t||!t.allowsNesting)return[];let i=[],l=(o,a)=>{if(o.prop(ua)==this.data){i.push({from:a,to:a+o.length});return}let u=o.prop(Je.mounted);if(u){if(u.tree.prop(ua)==this.data){if(u.overlay)for(let f of u.overlay)i.push({from:f.from+a,to:f.to+a});else i.push({from:a,to:a+o.length});return}else if(u.overlay){let f=i.length;if(l(u.tree,u.overlay[0].from+a),i.length>f)return}}for(let f=0;fi.isTop?t:void 0)]}),e.name)}configure(e,t){return new kd(this.data,this.parser.configure(e),t||this.name)}get allowsNesting(){return this.parser.hasWrappers()}}function Hn(n){let e=n.field(tr.state,!1);return e?e.tree:cn.empty}class cL{constructor(e){this.doc=e,this.cursorPos=0,this.string="",this.cursor=e.iter()}get length(){return this.doc.length}syncTo(e){return this.string=this.cursor.next(e-this.cursorPos).value,this.cursorPos=e+this.string.length,this.cursorPos-this.string.length}chunk(e){return this.syncTo(e),this.string}get lineChunks(){return!0}read(e,t){let i=this.cursorPos-this.string.length;return e=this.cursorPos?this.doc.sliceString(e,t):this.string.slice(e-i,t-i)}}let Hc=null;class Sd{constructor(e,t,i=[],l,o,a,u,f){this.parser=e,this.state=t,this.fragments=i,this.tree=l,this.treeLen=o,this.viewport=a,this.skipped=u,this.scheduleOn=f,this.parse=null,this.tempSkipped=[]}static create(e,t,i){return new Sd(e,t,[],cn.empty,0,i,[],null)}startParse(){return this.parser.startParse(new cL(this.state.doc),this.fragments)}work(e,t){return t!=null&&t>=this.state.doc.length&&(t=void 0),this.tree!=cn.empty&&this.isDone(t??this.state.doc.length)?(this.takeTree(),!0):this.withContext(()=>{var i;if(typeof e=="number"){let l=Date.now()+e;e=()=>Date.now()>l}for(this.parse||(this.parse=this.startParse()),t!=null&&(this.parse.stoppedAt==null||this.parse.stoppedAt>t)&&t=this.treeLen&&((this.parse.stoppedAt==null||this.parse.stoppedAt>e)&&this.parse.stopAt(e),this.withContext(()=>{for(;!(t=this.parse.advance()););}),this.treeLen=e,this.tree=t,this.fragments=this.withoutTempSkipped(Js.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(e){let t=Hc;Hc=this;try{return e()}finally{Hc=t}}withoutTempSkipped(e){for(let t;t=this.tempSkipped.pop();)e=WS(e,t.from,t.to);return e}changes(e,t){let{fragments:i,tree:l,treeLen:o,viewport:a,skipped:u}=this;if(this.takeTree(),!e.empty){let f=[];if(e.iterChangedRanges((d,m,g,b)=>f.push({fromA:d,toA:m,fromB:g,toB:b})),i=Js.applyChanges(i,f),l=cn.empty,o=0,a={from:e.mapPos(a.from,-1),to:e.mapPos(a.to,1)},this.skipped.length){u=[];for(let d of this.skipped){let m=e.mapPos(d.from,1),g=e.mapPos(d.to,-1);me.from&&(this.fragments=WS(this.fragments,l,o),this.skipped.splice(i--,1))}return this.skipped.length>=t?!1:(this.reset(),!0)}reset(){this.parse&&(this.takeTree(),this.parse=null)}skipUntilInView(e,t){this.skipped.push({from:e,to:t})}static getSkippingParser(e){return new class extends UN{createParse(t,i,l){let o=l[0].from,a=l[l.length-1].to;return{parsedPos:o,advance(){let f=Hc;if(f){for(let d of l)f.tempSkipped.push(d);e&&(f.scheduleOn=f.scheduleOn?Promise.all([f.scheduleOn,e]):e)}return this.parsedPos=a,new cn(pi.none,[],[],a-o)},stoppedAt:null,stopAt(){}}}}}isDone(e){e=Math.min(e,this.state.doc.length);let t=this.fragments;return this.treeLen>=e&&t.length&&t[0].from==0&&t[0].to>=e}static get(){return Hc}}function WS(n,e,t){return Js.applyChanges(n,[{fromA:e,toA:t,fromB:e,toB:t}])}class Ma{constructor(e){this.context=e,this.tree=e.tree}apply(e){if(!e.docChanged&&this.tree==this.context.tree)return this;let t=this.context.changes(e.changes,e.state),i=this.context.treeLen==e.startState.doc.length?void 0:Math.max(e.changes.mapPos(this.context.treeLen),t.viewport.to);return t.work(20,i)||t.takeTree(),new Ma(t)}static init(e){let t=Math.min(3e3,e.doc.length),i=Sd.create(e.facet(os).parser,e,{from:0,to:t});return i.work(20,t)||i.takeTree(),new Ma(i)}}tr.state=In.define({create:Ma.init,update(n,e){for(let t of e.effects)if(t.is(tr.setState))return t.value;return e.startState.facet(os)!=e.state.facet(os)?Ma.init(e.state):n.apply(e)}});let QN=n=>{let e=setTimeout(()=>n(),500);return()=>clearTimeout(e)};typeof requestIdleCallback<"u"&&(QN=n=>{let e=-1,t=setTimeout(()=>{e=requestIdleCallback(n,{timeout:400})},100);return()=>e<0?clearTimeout(t):cancelIdleCallback(e)});const g0=typeof navigator<"u"&&(!((p0=navigator.scheduling)===null||p0===void 0)&&p0.isInputPending)?()=>navigator.scheduling.isInputPending():null,uL=Jt.fromClass(class{constructor(e){this.view=e,this.working=null,this.workScheduled=0,this.chunkEnd=-1,this.chunkBudget=-1,this.work=this.work.bind(this),this.scheduleWork()}update(e){let t=this.view.state.field(tr.state).context;(t.updateViewport(e.view.viewport)||this.view.viewport.to>t.treeLen)&&this.scheduleWork(),(e.docChanged||e.selectionSet)&&(this.view.hasFocus&&(this.chunkBudget+=50),this.scheduleWork()),this.checkAsyncSchedule(t)}scheduleWork(){if(this.working)return;let{state:e}=this.view,t=e.field(tr.state);(t.tree!=t.context.tree||!t.context.isDone(e.doc.length))&&(this.working=QN(this.work))}work(e){this.working=null;let t=Date.now();if(this.chunkEndl+1e3,f=o.context.work(()=>g0&&g0()||Date.now()>a,l+(u?0:1e5));this.chunkBudget-=Date.now()-t,(f||this.chunkBudget<=0)&&(o.context.takeTree(),this.view.dispatch({effects:tr.setState.of(new Ma(o.context))})),this.chunkBudget>0&&!(f&&!u)&&this.scheduleWork(),this.checkAsyncSchedule(o.context)}checkAsyncSchedule(e){e.scheduleOn&&(this.workScheduled++,e.scheduleOn.then(()=>this.scheduleWork()).catch(t=>di(this.view.state,t)).then(()=>this.workScheduled--),e.scheduleOn=null)}destroy(){this.working&&this.working()}isWorking(){return!!(this.working||this.workScheduled>0)}},{eventHandlers:{focus(){this.scheduleWork()}}}),os=Ce.define({combine(n){return n.length?n[0]:null},enables:n=>[tr.state,uL,Oe.contentAttributes.compute([n],e=>{let t=e.facet(n);return t&&t.name?{"data-language":t.name}:{}})]});class fL{constructor(e,t=[]){this.language=e,this.support=t,this.extension=[e,t]}}const hL=Ce.define(),Uy=Ce.define({combine:n=>{if(!n.length)return" ";let e=n[0];if(!e||/\S/.test(e)||Array.from(e).some(t=>t!=e[0]))throw new Error("Invalid indent unit: "+JSON.stringify(n[0]));return e}});function Cd(n){let e=n.facet(Uy);return e.charCodeAt(0)==9?n.tabSize*e.length:e.length}function xu(n,e){let t="",i=n.tabSize,l=n.facet(Uy)[0];if(l==" "){for(;e>=i;)t+=" ",e-=i;l=" "}for(let o=0;o=e?dL(n,t,e):null}class nm{constructor(e,t={}){this.state=e,this.options=t,this.unit=Cd(e)}lineAt(e,t=1){let i=this.state.doc.lineAt(e),{simulateBreak:l,simulateDoubleBreak:o}=this.options;return l!=null&&l>=i.from&&l<=i.to?o&&l==e?{text:"",from:e}:(t<0?l-1&&(o+=a-this.countColumn(i,i.search(/\S|$/))),o}countColumn(e,t=e.length){return Ra(e,this.state.tabSize,t)}lineIndent(e,t=1){let{text:i,from:l}=this.lineAt(e,t),o=this.options.overrideIndentation;if(o){let a=o(l);if(a>-1)return a}return this.countColumn(i,i.search(/\S|$/))}get simulatedBreak(){return this.options.simulateBreak||null}}const XN=new Je;function dL(n,e,t){let i=e.resolveStack(t),l=e.resolveInner(t,-1).resolve(t,0).enterUnfinishedNodesBefore(t);if(l!=i.node){let o=[];for(let a=l;a&&!(a.fromi.node.to||a.from==i.node.from&&a.type==i.node.type);a=a.parent)o.push(a);for(let a=o.length-1;a>=0;a--)i={node:o[a],next:i}}return $N(i,n,t)}function $N(n,e,t){for(let i=n;i;i=i.next){let l=pL(i.node);if(l)return l(qy.create(e,t,i))}return 0}function mL(n){return n.pos==n.options.simulateBreak&&n.options.simulateDoubleBreak}function pL(n){let e=n.type.prop(XN);if(e)return e;let t=n.firstChild,i;if(t&&(i=t.type.prop(Je.closedBy))){let l=n.lastChild,o=l&&i.indexOf(l.name)>-1;return a=>YN(a,!0,1,void 0,o&&!mL(a)?l.from:void 0)}return n.parent==null?gL:null}function gL(){return 0}class qy extends nm{constructor(e,t,i){super(e.state,e.options),this.base=e,this.pos=t,this.context=i}get node(){return this.context.node}static create(e,t,i){return new qy(e,t,i)}get textAfter(){return this.textAfterPos(this.pos)}get baseIndent(){return this.baseIndentFor(this.node)}baseIndentFor(e){let t=this.state.doc.lineAt(e.from);for(;;){let i=e.resolve(t.from);for(;i.parent&&i.parent.from==i.from;)i=i.parent;if(xL(i,e))break;t=this.state.doc.lineAt(i.from)}return this.lineIndent(t.from)}continue(){return $N(this.context.next,this.base,this.pos)}}function xL(n,e){for(let t=e;t;t=t.parent)if(n==t)return!0;return!1}function yL(n){let e=n.node,t=e.childAfter(e.from),i=e.lastChild;if(!t)return null;let l=n.options.simulateBreak,o=n.state.doc.lineAt(t.from),a=l==null||l<=o.from?o.to:Math.min(o.to,l);for(let u=t.to;;){let f=e.childAfter(u);if(!f||f==i)return null;if(!f.type.isSkipped){if(f.from>=a)return null;let d=/^ */.exec(o.text.slice(t.to-o.from))[0].length;return{from:t.from,to:t.to+d}}u=f.to}}function ZS({closing:n,align:e=!0,units:t=1}){return i=>YN(i,e,t,n)}function YN(n,e,t,i,l){let o=n.textAfter,a=o.match(/^\s*/)[0].length,u=i&&o.slice(a,a+i.length)==i||l==n.pos+a,f=e?yL(n):null;return f?u?n.column(f.from):n.column(f.to):n.baseIndent+(u?0:n.unit*t)}const bL=200;function vL(){return dt.transactionFilter.of(n=>{if(!n.docChanged||!n.isUserEvent("input.type")&&!n.isUserEvent("input.complete"))return n;let e=n.startState.languageDataAt("indentOnInput",n.startState.selection.main.head);if(!e.length)return n;let t=n.newDoc,{head:i}=n.newSelection.main,l=t.lineAt(i);if(i>l.from+bL)return n;let o=t.sliceString(l.from,i);if(!e.some(d=>d.test(o)))return n;let{state:a}=n,u=-1,f=[];for(let{head:d}of a.selection.ranges){let m=a.doc.lineAt(d);if(m.from==u)continue;u=m.from;let g=Fy(a,m.from);if(g==null)continue;let b=/^\s*/.exec(m.text)[0],v=xu(a,g);b!=v&&f.push({from:m.from,to:m.from+b.length,insert:v})}return f.length?[n,{changes:f,sequential:!0}]:n})}const wL=Ce.define(),GN=new Je;function kL(n){let e=n.firstChild,t=n.lastChild;return e&&e.tot)continue;if(o&&u.from=e&&d.to>t&&(o=d)}}return o}function CL(n){let e=n.lastChild;return e&&e.to==n.to&&e.type.isError}function Od(n,e,t){for(let i of n.facet(wL)){let l=i(n,e,t);if(l)return l}return SL(n,e,t)}function KN(n,e){let t=e.mapPos(n.from,1),i=e.mapPos(n.to,-1);return t>=i?void 0:{from:t,to:i}}const im=Ye.define({map:KN}),Eu=Ye.define({map:KN});function WN(n){let e=[];for(let{head:t}of n.state.selection.ranges)e.some(i=>i.from<=t&&i.to>=t)||e.push(n.lineBlockAt(t));return e}const ro=In.define({create(){return He.none},update(n,e){e.isUserEvent("delete")&&e.changes.iterChangedRanges((i,l)=>n=JS(n,i,l)),n=n.map(e.changes);let t=[];for(let i of e.effects)i.is(im)&&!OL(n,i.value.from,i.value.to)?t.push(i.value):i.is(Eu)&&(n=n.update({filter:(l,o)=>i.value.from!=l||i.value.to!=o,filterFrom:i.value.from,filterTo:i.value.to}));if(t.length){let{preparePlaceholder:i}=e.state.facet(eT),l=t.map(o=>(i?He.replace({widget:new jL(i(e.state,o))}):e2).range(o.from,o.to));n=n.update({add:l})}return e.selection&&(n=JS(n,e.selection.main.head)),n},provide:n=>Oe.decorations.from(n),toJSON(n,e){let t=[];return n.between(0,e.doc.length,(i,l)=>{t.push(i,l)}),t},fromJSON(n){if(!Array.isArray(n)||n.length%2)throw new RangeError("Invalid JSON for fold state");let e=[];for(let t=0;t{le&&(i=!0)}),i?n.update({filterFrom:e,filterTo:t,filter:(l,o)=>l>=t||o<=e}):n}function Nd(n,e,t){var i;let l=null;return(i=n.field(ro,!1))===null||i===void 0||i.between(e,t,(o,a)=>{(!l||l.from>o)&&(l={from:o,to:a})}),l}function OL(n,e,t){let i=!1;return n.between(e,e,(l,o)=>{l==e&&o==t&&(i=!0)}),i}function ZN(n,e){return n.field(ro,!1)?e:e.concat(Ye.appendConfig.of(tT()))}const NL=n=>{for(let e of WN(n)){let t=Od(n.state,e.from,e.to);if(t)return n.dispatch({effects:ZN(n.state,[im.of(t),JN(n,t)])}),!0}return!1},TL=n=>{if(!n.state.field(ro,!1))return!1;let e=[];for(let t of WN(n)){let i=Nd(n.state,t.from,t.to);i&&e.push(Eu.of(i),JN(n,i,!1))}return e.length&&n.dispatch({effects:e}),e.length>0};function JN(n,e,t=!0){let i=n.state.doc.lineAt(e.from).number,l=n.state.doc.lineAt(e.to).number;return Oe.announce.of(`${n.state.phrase(t?"Folded lines":"Unfolded lines")} ${i} ${n.state.phrase("to")} ${l}.`)}const AL=n=>{let{state:e}=n,t=[];for(let i=0;i{let e=n.state.field(ro,!1);if(!e||!e.size)return!1;let t=[];return e.between(0,n.state.doc.length,(i,l)=>{t.push(Eu.of({from:i,to:l}))}),n.dispatch({effects:t}),!0},ML=[{key:"Ctrl-Shift-[",mac:"Cmd-Alt-[",run:NL},{key:"Ctrl-Shift-]",mac:"Cmd-Alt-]",run:TL},{key:"Ctrl-Alt-[",run:AL},{key:"Ctrl-Alt-]",run:EL}],DL={placeholderDOM:null,preparePlaceholder:null,placeholderText:"…"},eT=Ce.define({combine(n){return Br(n,DL)}});function tT(n){return[ro,LL]}function nT(n,e){let{state:t}=n,i=t.facet(eT),l=a=>{let u=n.lineBlockAt(n.posAtDOM(a.target)),f=Nd(n.state,u.from,u.to);f&&n.dispatch({effects:Eu.of(f)}),a.preventDefault()};if(i.placeholderDOM)return i.placeholderDOM(n,l,e);let o=document.createElement("span");return o.textContent=i.placeholderText,o.setAttribute("aria-label",t.phrase("folded code")),o.title=t.phrase("unfold"),o.className="cm-foldPlaceholder",o.onclick=l,o}const e2=He.replace({widget:new class extends ul{toDOM(n){return nT(n,null)}}});class jL extends ul{constructor(e){super(),this.value=e}eq(e){return this.value==e.value}toDOM(e){return nT(e,this.value)}}const RL={openText:"⌄",closedText:"›",markerDOM:null,domEventHandlers:{},foldingChanged:()=>!1};class x0 extends ol{constructor(e,t){super(),this.config=e,this.open=t}eq(e){return this.config==e.config&&this.open==e.open}toDOM(e){if(this.config.markerDOM)return this.config.markerDOM(this.open);let t=document.createElement("span");return t.textContent=this.open?this.config.openText:this.config.closedText,t.title=e.state.phrase(this.open?"Fold line":"Unfold line"),t}}function _L(n={}){let e={...RL,...n},t=new x0(e,!0),i=new x0(e,!1),l=Jt.fromClass(class{constructor(a){this.from=a.viewport.from,this.markers=this.buildMarkers(a)}update(a){(a.docChanged||a.viewportChanged||a.startState.facet(os)!=a.state.facet(os)||a.startState.field(ro,!1)!=a.state.field(ro,!1)||Hn(a.startState)!=Hn(a.state)||e.foldingChanged(a))&&(this.markers=this.buildMarkers(a.view))}buildMarkers(a){let u=new zr;for(let f of a.viewportLineBlocks){let d=Nd(a.state,f.from,f.to)?i:Od(a.state,f.from,f.to)?t:null;d&&u.add(f.from,f.from,d)}return u.finish()}}),{domEventHandlers:o}=e;return[l,L_({class:"cm-foldGutter",markers(a){var u;return((u=a.plugin(l))===null||u===void 0?void 0:u.markers)||it.empty},initialSpacer(){return new x0(e,!1)},domEventHandlers:{...o,click:(a,u,f)=>{if(o.click&&o.click(a,u,f))return!0;let d=Nd(a.state,u.from,u.to);if(d)return a.dispatch({effects:Eu.of(d)}),!0;let m=Od(a.state,u.from,u.to);return m?(a.dispatch({effects:im.of(m)}),!0):!1}}}),tT()]}const LL=Oe.baseTheme({".cm-foldPlaceholder":{backgroundColor:"#eee",border:"1px solid #ddd",color:"#888",borderRadius:".2em",margin:"0 1px",padding:"0 1px",cursor:"pointer"},".cm-foldGutter span":{padding:"0 1px",cursor:"pointer"}});class rm{constructor(e,t){this.specs=e;let i;function l(u){let f=is.newName();return(i||(i=Object.create(null)))["."+f]=u,f}const o=typeof t.all=="string"?t.all:t.all?l(t.all):void 0,a=t.scope;this.scope=a instanceof tr?u=>u.prop(ua)==a.data:a?u=>u==a:void 0,this.style=VN(e.map(u=>({tag:u.tag,class:u.class||l(Object.assign({},u,{tag:null}))})),{all:o}).style,this.module=i?new is(i):null,this.themeType=t.themeType}static define(e,t){return new rm(e,t||{})}}const Ix=Ce.define(),iT=Ce.define({combine(n){return n.length?[n[0]]:null}});function y0(n){let e=n.facet(Ix);return e.length?e:n.facet(iT)}function zL(n,e){let t=[PL],i;return n instanceof rm&&(n.module&&t.push(Oe.styleModule.of(n.module)),i=n.themeType),e!=null&&e.fallback?t.push(iT.of(n)):i?t.push(Ix.computeN([Oe.darkTheme],l=>l.facet(Oe.darkTheme)==(i=="dark")?[n]:[])):t.push(Ix.of(n)),t}class BL{constructor(e){this.markCache=Object.create(null),this.tree=Hn(e.state),this.decorations=this.buildDeco(e,y0(e.state)),this.decoratedTo=e.viewport.to}update(e){let t=Hn(e.state),i=y0(e.state),l=i!=y0(e.startState),{viewport:o}=e.view,a=e.changes.mapPos(this.decoratedTo,1);t.length=o.to?(this.decorations=this.decorations.map(e.changes),this.decoratedTo=a):(t!=this.tree||e.viewportChanged||l)&&(this.tree=t,this.decorations=this.buildDeco(e.view,i),this.decoratedTo=o.to)}buildDeco(e,t){if(!t||!this.tree.length)return He.none;let i=new zr;for(let{from:l,to:o}of e.visibleRanges)rL(this.tree,t,(a,u,f)=>{i.add(a,u,this.markCache[f]||(this.markCache[f]=He.mark({class:f})))},l,o);return i.finish()}}const PL=so.high(Jt.fromClass(BL,{decorations:n=>n.decorations})),HL=rm.define([{tag:ge.meta,color:"#404740"},{tag:ge.link,textDecoration:"underline"},{tag:ge.heading,textDecoration:"underline",fontWeight:"bold"},{tag:ge.emphasis,fontStyle:"italic"},{tag:ge.strong,fontWeight:"bold"},{tag:ge.strikethrough,textDecoration:"line-through"},{tag:ge.keyword,color:"#708"},{tag:[ge.atom,ge.bool,ge.url,ge.contentSeparator,ge.labelName],color:"#219"},{tag:[ge.literal,ge.inserted],color:"#164"},{tag:[ge.string,ge.deleted],color:"#a11"},{tag:[ge.regexp,ge.escape,ge.special(ge.string)],color:"#e40"},{tag:ge.definition(ge.variableName),color:"#00f"},{tag:ge.local(ge.variableName),color:"#30a"},{tag:[ge.typeName,ge.namespace],color:"#085"},{tag:ge.className,color:"#167"},{tag:[ge.special(ge.variableName),ge.macroName],color:"#256"},{tag:ge.definition(ge.propertyName),color:"#00c"},{tag:ge.comment,color:"#940"},{tag:ge.invalid,color:"#f00"}]),IL=Oe.baseTheme({"&.cm-focused .cm-matchingBracket":{backgroundColor:"#328c8252"},"&.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bb555544"}}),rT=1e4,lT="()[]{}",sT=Ce.define({combine(n){return Br(n,{afterCursor:!0,brackets:lT,maxScanDistance:rT,renderMatch:qL})}}),UL=He.mark({class:"cm-matchingBracket"}),FL=He.mark({class:"cm-nonmatchingBracket"});function qL(n){let e=[],t=n.matched?UL:FL;return e.push(t.range(n.start.from,n.start.to)),n.end&&e.push(t.range(n.end.from,n.end.to)),e}function t2(n){let e=[],t=n.facet(sT);for(let i of n.selection.ranges){if(!i.empty)continue;let l=jr(n,i.head,-1,t)||i.head>0&&jr(n,i.head-1,1,t)||t.afterCursor&&(jr(n,i.head,1,t)||i.headn.decorations}),QL=[VL,IL];function XL(n={}){return[sT.of(n),QL]}const $L=new Je;function Ux(n,e,t){let i=n.prop(e<0?Je.openedBy:Je.closedBy);if(i)return i;if(n.name.length==1){let l=t.indexOf(n.name);if(l>-1&&l%2==(e<0?1:0))return[t[l+e]]}return null}function Fx(n){let e=n.type.prop($L);return e?e(n.node):n}function jr(n,e,t,i={}){let l=i.maxScanDistance||rT,o=i.brackets||lT,a=Hn(n),u=a.resolveInner(e,t);for(let f=u;f;f=f.parent){let d=Ux(f.type,t,o);if(d&&f.from0?e>=m.from&&em.from&&e<=m.to))return YL(n,e,t,f,m,d,o)}}return GL(n,e,t,a,u.type,l,o)}function YL(n,e,t,i,l,o,a){let u=i.parent,f={from:l.from,to:l.to},d=0,m=u==null?void 0:u.cursor();if(m&&(t<0?m.childBefore(i.from):m.childAfter(i.to)))do if(t<0?m.to<=i.from:m.from>=i.to){if(d==0&&o.indexOf(m.type.name)>-1&&m.from0)return null;let d={from:t<0?e-1:e,to:t>0?e+1:e},m=n.doc.iterRange(e,t>0?n.doc.length:0),g=0;for(let b=0;!m.next().done&&b<=o;){let v=m.value;t<0&&(b+=v.length);let w=e+b*t;for(let S=t>0?0:v.length-1,C=t>0?v.length:-1;S!=C;S+=t){let N=a.indexOf(v[S]);if(!(N<0||i.resolveInner(w+S,1).type!=l))if(N%2==0==t>0)g++;else{if(g==1)return{start:d,end:{from:w+S,to:w+S+1},matched:N>>1==f>>1};g--}}t>0&&(b+=v.length)}return m.done?{start:d,matched:!1}:null}const KL=Object.create(null),n2=[pi.none],i2=[],r2=Object.create(null),WL=Object.create(null);for(let[n,e]of[["variable","variableName"],["variable-2","variableName.special"],["string-2","string.special"],["def","variableName.definition"],["tag","tagName"],["attribute","attributeName"],["type","typeName"],["builtin","variableName.standard"],["qualifier","modifier"],["error","invalid"],["header","heading"],["property","propertyName"]])WL[n]=ZL(KL,e);function b0(n,e){i2.indexOf(n)>-1||(i2.push(n),console.warn(e))}function ZL(n,e){let t=[];for(let u of e.split(" ")){let f=[];for(let d of u.split(".")){let m=n[d]||ge[d];m?typeof m=="function"?f.length?f=f.map(m):b0(d,`Modifier ${d} used at start of tag`):f.length?b0(d,`Tag ${d} used as modifier`):f=Array.isArray(m)?m:[m]:b0(d,`Unknown highlighting tag ${d}`)}for(let d of f)t.push(d)}if(!t.length)return 0;let i=e.replace(/ /g,"_"),l=i+" "+t.map(u=>u.id),o=r2[l];if(o)return o.id;let a=r2[l]=pi.define({id:n2.length,name:i,props:[FN({[i]:t})]});return n2.push(a),a.id}Ot.RTL,Ot.LTR;const JL=n=>{let{state:e}=n,t=e.doc.lineAt(e.selection.main.from),i=Qy(n.state,t.from);return i.line?ez(n):i.block?nz(n):!1};function Vy(n,e){return({state:t,dispatch:i})=>{if(t.readOnly)return!1;let l=n(e,t);return l?(i(t.update(l)),!0):!1}}const ez=Vy(lz,0),tz=Vy(oT,0),nz=Vy((n,e)=>oT(n,e,rz(e)),0);function Qy(n,e){let t=n.languageDataAt("commentTokens",e,1);return t.length?t[0]:{}}const Ic=50;function iz(n,{open:e,close:t},i,l){let o=n.sliceDoc(i-Ic,i),a=n.sliceDoc(l,l+Ic),u=/\s*$/.exec(o)[0].length,f=/^\s*/.exec(a)[0].length,d=o.length-u;if(o.slice(d-e.length,d)==e&&a.slice(f,f+t.length)==t)return{open:{pos:i-u,margin:u&&1},close:{pos:l+f,margin:f&&1}};let m,g;l-i<=2*Ic?m=g=n.sliceDoc(i,l):(m=n.sliceDoc(i,i+Ic),g=n.sliceDoc(l-Ic,l));let b=/^\s*/.exec(m)[0].length,v=/\s*$/.exec(g)[0].length,w=g.length-v-t.length;return m.slice(b,b+e.length)==e&&g.slice(w,w+t.length)==t?{open:{pos:i+b+e.length,margin:/\s/.test(m.charAt(b+e.length))?1:0},close:{pos:l-v-t.length,margin:/\s/.test(g.charAt(w-1))?1:0}}:null}function rz(n){let e=[];for(let t of n.selection.ranges){let i=n.doc.lineAt(t.from),l=t.to<=i.to?i:n.doc.lineAt(t.to);l.from>i.from&&l.from==t.to&&(l=t.to==i.to+1?i:n.doc.lineAt(t.to-1));let o=e.length-1;o>=0&&e[o].to>i.from?e[o].to=l.to:e.push({from:i.from+/^\s*/.exec(i.text)[0].length,to:l.to})}return e}function oT(n,e,t=e.selection.ranges){let i=t.map(o=>Qy(e,o.from).block);if(!i.every(o=>o))return null;let l=t.map((o,a)=>iz(e,i[a],o.from,o.to));if(n!=2&&!l.every(o=>o))return{changes:e.changes(t.map((o,a)=>l[a]?[]:[{from:o.from,insert:i[a].open+" "},{from:o.to,insert:" "+i[a].close}]))};if(n!=1&&l.some(o=>o)){let o=[];for(let a=0,u;al&&(o==a||a>g.from)){l=g.from;let b=/^\s*/.exec(g.text)[0].length,v=b==g.length,w=g.text.slice(b,b+d.length)==d?b:-1;bo.comment<0&&(!o.empty||o.single))){let o=[];for(let{line:u,token:f,indent:d,empty:m,single:g}of i)(g||!m)&&o.push({from:u.from+d,insert:f+" "});let a=e.changes(o);return{changes:a,selection:e.selection.map(a,1)}}else if(n!=1&&i.some(o=>o.comment>=0)){let o=[];for(let{line:a,comment:u,token:f}of i)if(u>=0){let d=a.from+u,m=d+f.length;a.text[m-a.from]==" "&&m++,o.push({from:d,to:m})}return{changes:o}}return null}const qx=cl.define(),sz=cl.define(),oz=Ce.define(),aT=Ce.define({combine(n){return Br(n,{minDepth:100,newGroupDelay:500,joinToEvent:(e,t)=>t},{minDepth:Math.max,newGroupDelay:Math.min,joinToEvent:(e,t)=>(i,l)=>e(i,l)||t(i,l)})}}),cT=In.define({create(){return Rr.empty},update(n,e){let t=e.state.facet(aT),i=e.annotation(qx);if(i){let f=mi.fromTransaction(e,i.selection),d=i.side,m=d==0?n.undone:n.done;return f?m=Td(m,m.length,t.minDepth,f):m=hT(m,e.startState.selection),new Rr(d==0?i.rest:m,d==0?m:i.rest)}let l=e.annotation(sz);if((l=="full"||l=="before")&&(n=n.isolate()),e.annotation(dn.addToHistory)===!1)return e.changes.empty?n:n.addMapping(e.changes.desc);let o=mi.fromTransaction(e),a=e.annotation(dn.time),u=e.annotation(dn.userEvent);return o?n=n.addChanges(o,a,u,t,e):e.selection&&(n=n.addSelection(e.startState.selection,a,u,t.newGroupDelay)),(l=="full"||l=="after")&&(n=n.isolate()),n},toJSON(n){return{done:n.done.map(e=>e.toJSON()),undone:n.undone.map(e=>e.toJSON())}},fromJSON(n){return new Rr(n.done.map(mi.fromJSON),n.undone.map(mi.fromJSON))}});function az(n={}){return[cT,aT.of(n),Oe.domEventHandlers({beforeinput(e,t){let i=e.inputType=="historyUndo"?uT:e.inputType=="historyRedo"?Vx:null;return i?(e.preventDefault(),i(t)):!1}})]}function lm(n,e){return function({state:t,dispatch:i}){if(!e&&t.readOnly)return!1;let l=t.field(cT,!1);if(!l)return!1;let o=l.pop(n,t,e);return o?(i(o),!0):!1}}const uT=lm(0,!1),Vx=lm(1,!1),cz=lm(0,!0),uz=lm(1,!0);class mi{constructor(e,t,i,l,o){this.changes=e,this.effects=t,this.mapped=i,this.startSelection=l,this.selectionsAfter=o}setSelAfter(e){return new mi(this.changes,this.effects,this.mapped,this.startSelection,e)}toJSON(){var e,t,i;return{changes:(e=this.changes)===null||e===void 0?void 0:e.toJSON(),mapped:(t=this.mapped)===null||t===void 0?void 0:t.toJSON(),startSelection:(i=this.startSelection)===null||i===void 0?void 0:i.toJSON(),selectionsAfter:this.selectionsAfter.map(l=>l.toJSON())}}static fromJSON(e){return new mi(e.changes&&hn.fromJSON(e.changes),[],e.mapped&&Lr.fromJSON(e.mapped),e.startSelection&&ae.fromJSON(e.startSelection),e.selectionsAfter.map(ae.fromJSON))}static fromTransaction(e,t){let i=Ui;for(let l of e.startState.facet(oz)){let o=l(e);o.length&&(i=i.concat(o))}return!i.length&&e.changes.empty?null:new mi(e.changes.invert(e.startState.doc),i,void 0,t||e.startState.selection,Ui)}static selection(e){return new mi(void 0,Ui,void 0,void 0,e)}}function Td(n,e,t,i){let l=e+1>t+20?e-t-1:0,o=n.slice(l,e);return o.push(i),o}function fz(n,e){let t=[],i=!1;return n.iterChangedRanges((l,o)=>t.push(l,o)),e.iterChangedRanges((l,o,a,u)=>{for(let f=0;f=d&&a<=m&&(i=!0)}}),i}function hz(n,e){return n.ranges.length==e.ranges.length&&n.ranges.filter((t,i)=>t.empty!=e.ranges[i].empty).length===0}function fT(n,e){return n.length?e.length?n.concat(e):n:e}const Ui=[],dz=200;function hT(n,e){if(n.length){let t=n[n.length-1],i=t.selectionsAfter.slice(Math.max(0,t.selectionsAfter.length-dz));return i.length&&i[i.length-1].eq(e)?n:(i.push(e),Td(n,n.length-1,1e9,t.setSelAfter(i)))}else return[mi.selection([e])]}function mz(n){let e=n[n.length-1],t=n.slice();return t[n.length-1]=e.setSelAfter(e.selectionsAfter.slice(0,e.selectionsAfter.length-1)),t}function v0(n,e){if(!n.length)return n;let t=n.length,i=Ui;for(;t;){let l=pz(n[t-1],e,i);if(l.changes&&!l.changes.empty||l.effects.length){let o=n.slice(0,t);return o[t-1]=l,o}else e=l.mapped,t--,i=l.selectionsAfter}return i.length?[mi.selection(i)]:Ui}function pz(n,e,t){let i=fT(n.selectionsAfter.length?n.selectionsAfter.map(u=>u.map(e)):Ui,t);if(!n.changes)return mi.selection(i);let l=n.changes.map(e),o=e.mapDesc(n.changes,!0),a=n.mapped?n.mapped.composeDesc(o):o;return new mi(l,Ye.mapEffects(n.effects,e),a,n.startSelection.map(o),i)}const gz=/^(input\.type|delete)($|\.)/;class Rr{constructor(e,t,i=0,l=void 0){this.done=e,this.undone=t,this.prevTime=i,this.prevUserEvent=l}isolate(){return this.prevTime?new Rr(this.done,this.undone):this}addChanges(e,t,i,l,o){let a=this.done,u=a[a.length-1];return u&&u.changes&&!u.changes.empty&&e.changes&&(!i||gz.test(i))&&(!u.selectionsAfter.length&&t-this.prevTime0&&t-this.prevTimet.empty?n.moveByChar(t,e):sm(t,e))}function Un(n){return n.textDirectionAt(n.state.selection.main.head)==Ot.LTR}const mT=n=>dT(n,!Un(n)),pT=n=>dT(n,Un(n));function gT(n,e){return sr(n,t=>t.empty?n.moveByGroup(t,e):sm(t,e))}const yz=n=>gT(n,!Un(n)),bz=n=>gT(n,Un(n));function vz(n,e,t){if(e.type.prop(t))return!0;let i=e.to-e.from;return i&&(i>2||/[^\s,.;:]/.test(n.sliceDoc(e.from,e.to)))||e.firstChild}function om(n,e,t){let i=Hn(n).resolveInner(e.head),l=t?Je.closedBy:Je.openedBy;for(let f=e.head;;){let d=t?i.childAfter(f):i.childBefore(f);if(!d)break;vz(n,d,l)?i=d:f=t?d.to:d.from}let o=i.type.prop(l),a,u;return o&&(a=t?jr(n,i.from,1):jr(n,i.to,-1))&&a.matched?u=t?a.end.to:a.end.from:u=t?i.to:i.from,ae.cursor(u,t?-1:1)}const wz=n=>sr(n,e=>om(n.state,e,!Un(n))),kz=n=>sr(n,e=>om(n.state,e,Un(n)));function xT(n,e){return sr(n,t=>{if(!t.empty)return sm(t,e);let i=n.moveVertically(t,e);return i.head!=t.head?i:n.moveToLineBoundary(t,e)})}const yT=n=>xT(n,!1),bT=n=>xT(n,!0);function vT(n){let e=n.scrollDOM.clientHeighta.empty?n.moveVertically(a,e,t.height):sm(a,e));if(l.eq(i.selection))return!1;let o;if(t.selfScroll){let a=n.coordsAtPos(i.selection.main.head),u=n.scrollDOM.getBoundingClientRect(),f=u.top+t.marginTop,d=u.bottom-t.marginBottom;a&&a.top>f&&a.bottomwT(n,!1),Qx=n=>wT(n,!0);function fs(n,e,t){let i=n.lineBlockAt(e.head),l=n.moveToLineBoundary(e,t);if(l.head==e.head&&l.head!=(t?i.to:i.from)&&(l=n.moveToLineBoundary(e,t,!1)),!t&&l.head==i.from&&i.length){let o=/^\s*/.exec(n.state.sliceDoc(i.from,Math.min(i.from+100,i.to)))[0].length;o&&e.head!=i.from+o&&(l=ae.cursor(i.from+o))}return l}const Sz=n=>sr(n,e=>fs(n,e,!0)),Cz=n=>sr(n,e=>fs(n,e,!1)),Oz=n=>sr(n,e=>fs(n,e,!Un(n))),Nz=n=>sr(n,e=>fs(n,e,Un(n))),Tz=n=>sr(n,e=>n.moveToLineBoundary(e,!1,!1)),Az=n=>sr(n,e=>n.moveToLineBoundary(e,!0,!1));function Ez(n,e,t){let i=!1,l=_a(n.selection,o=>{let a=jr(n,o.head,-1)||jr(n,o.head,1)||o.head>0&&jr(n,o.head-1,1)||o.headEz(n,e);function Vi(n,e,t){let i=_a(n.state.selection,l=>{l.undirectional&&l.head>=l.anchor!=e&&(l=ae.range(l.head,l.anchor));let o=t(l);return ae.range(l.anchor,o.head,o.goalColumn,o.bidiLevel||void 0,o.assoc)});return i.eq(n.state.selection)?!1:(n.dispatch(lr(n.state,i)),!0)}function kT(n,e){return Vi(n,e,t=>n.moveByChar(t,e))}const ST=n=>kT(n,!Un(n)),CT=n=>kT(n,Un(n));function OT(n,e){return Vi(n,e,t=>n.moveByGroup(t,e))}const Dz=n=>OT(n,!Un(n)),jz=n=>OT(n,Un(n)),Rz=n=>{let e=!Un(n);return Vi(n,e,t=>om(n.state,t,e))},_z=n=>{let e=Un(n);return Vi(n,e,t=>om(n.state,t,e))};function NT(n,e){return Vi(n,e,t=>n.moveVertically(t,e))}const TT=n=>NT(n,!1),AT=n=>NT(n,!0);function ET(n,e){return Vi(n,e,t=>n.moveVertically(t,e,vT(n).height))}const s2=n=>ET(n,!1),o2=n=>ET(n,!0),Lz=n=>Vi(n,!0,e=>fs(n,e,!0)),zz=n=>Vi(n,!1,e=>fs(n,e,!1)),Bz=n=>{let e=!Un(n);return Vi(n,e,t=>fs(n,t,e))},Pz=n=>{let e=Un(n);return Vi(n,e,t=>fs(n,t,e))},Hz=n=>Vi(n,!1,e=>ae.cursor(n.lineBlockAt(e.head).from)),Iz=n=>Vi(n,!0,e=>ae.cursor(n.lineBlockAt(e.head).to)),a2=({state:n,dispatch:e})=>(e(lr(n,{anchor:0})),!0),c2=({state:n,dispatch:e})=>(e(lr(n,{anchor:n.doc.length})),!0),u2=({state:n,dispatch:e})=>(e(lr(n,{anchor:n.selection.main.anchor,head:0})),!0),f2=({state:n,dispatch:e})=>(e(lr(n,{anchor:n.selection.main.anchor,head:n.doc.length})),!0),Uz=({state:n,dispatch:e})=>(e(n.update({selection:{anchor:0,head:n.doc.length},userEvent:"select"})),!0),Fz=({state:n,dispatch:e})=>{let t=am(n).map(({from:i,to:l})=>ae.undirectionalRange(i,Math.min(l+1,n.doc.length)));return e(n.update({selection:ae.create(t),userEvent:"select"})),!0},qz=({state:n,dispatch:e})=>{let t=_a(n.selection,i=>{let l=Hn(n),o=l.resolveStack(i.from,1);if(i.empty){let a=l.resolveStack(i.from,-1);a.node.from>=o.node.from&&a.node.to<=o.node.to&&(o=a)}for(let a=o;a;a=a.next){let{node:u}=a;if((u.from=i.to||u.to>i.to&&u.from<=i.from)&&a.next)return ae.undirectionalRange(u.from,u.to)}return i});return t.eq(n.selection)?!1:(e(lr(n,t)),!0)};function MT(n,e){let{state:t}=n,i=t.selection,l=t.selection.ranges.slice();for(let o of t.selection.ranges){let a=t.doc.lineAt(o.head);if(e?a.to0)for(let u=o;;){let f=n.moveVertically(u,e);if(f.heada.to){l.some(d=>d.head==f.head)||l.push(f);break}else{if(f.head==u.head)break;u=f}}}return l.length==i.ranges.length?!1:(n.dispatch(lr(t,ae.create(l,l.length-1))),!0)}const Vz=n=>MT(n,!1),Qz=n=>MT(n,!0),Xz=({state:n,dispatch:e})=>{let t=n.selection,i=null;return t.ranges.length>1?i=ae.create([t.main]):t.main.empty||(i=ae.create([ae.cursor(t.main.head)])),i?(e(lr(n,i)),!0):!1};function Mu(n,e){if(n.state.readOnly)return!1;let t="delete.selection",{state:i}=n,l=i.changeByRange(o=>{let{from:a,to:u}=o;if(a==u){let f=e(o);fa&&(t="delete.forward",f=Dh(n,f,!0)),a=Math.min(a,f),u=Math.max(u,f)}else a=Dh(n,a,!1),u=Dh(n,u,!0);return a==u?{range:o}:{changes:{from:a,to:u},range:ae.cursor(a,al(n)))i.between(e,e,(l,o)=>{le&&(e=t?o:l)});return e}const DT=(n,e,t)=>Mu(n,i=>{let l=i.from,{state:o}=n,a=o.doc.lineAt(l),u,f;if(t&&!e&&l>a.from&&lDT(n,!1,!0),jT=n=>DT(n,!0,!1),RT=(n,e)=>Mu(n,t=>{let i=t.head,{state:l}=n,o=l.doc.lineAt(i),a=l.charCategorizer(i);for(let u=null;;){if(i==(e?o.to:o.from)){i==t.head&&o.number!=(e?l.doc.lines:1)&&(i+=e?1:-1);break}let f=Sn(o.text,i-o.from,e)+o.from,d=o.text.slice(Math.min(i,f)-o.from,Math.max(i,f)-o.from),m=a(d);if(u!=null&&m!=u)break;(d!=" "||i!=t.head)&&(u=m),i=f}return i}),_T=n=>RT(n,!1),$z=n=>RT(n,!0),Yz=n=>Mu(n,e=>{let t=n.lineBlockAt(e.head).to;return e.headMu(n,e=>{let t=n.moveToLineBoundary(e,!1).head;return e.head>t?t:Math.max(0,e.head-1)}),Kz=n=>Mu(n,e=>{let t=n.moveToLineBoundary(e,!0).head;return e.head{if(n.readOnly)return!1;let t=n.changeByRange(i=>({changes:{from:i.from,to:i.to,insert:ft.of(["",""])},range:ae.cursor(i.from)}));return e(n.update(t,{scrollIntoView:!0,userEvent:"input"})),!0},Zz=({state:n,dispatch:e})=>{if(n.readOnly)return!1;let t=n.changeByRange(i=>{if(!i.empty||i.from==0||i.from==n.doc.length)return{range:i};let l=i.from,o=n.doc.lineAt(l),a=l==o.from?l-1:Sn(o.text,l-o.from,!1)+o.from,u=l==o.to?l+1:Sn(o.text,l-o.from,!0)+o.from;return{changes:{from:a,to:u,insert:n.doc.slice(l,u).append(n.doc.slice(a,l))},range:ae.cursor(u)}});return t.changes.empty?!1:(e(n.update(t,{scrollIntoView:!0,userEvent:"move.character"})),!0)};function am(n){let e=[],t=-1;for(let i of n.selection.ranges){let l=n.doc.lineAt(i.from),o=n.doc.lineAt(i.to);if(!i.empty&&i.to==o.from&&(o=n.doc.lineAt(i.to-1)),t>=l.number){let a=e[e.length-1];a.to=o.to,a.ranges.push(i)}else e.push({from:l.from,to:o.to,ranges:[i]});t=o.number+1}return e}function LT(n,e,t){if(n.readOnly)return!1;let i=[],l=[];for(let o of am(n)){if(t?o.to==n.doc.length:o.from==0)continue;let a=n.doc.lineAt(t?o.to+1:o.from-1),u=a.length+1;if(t){i.push({from:o.to,to:a.to},{from:o.from,insert:a.text+n.lineBreak});for(let f of o.ranges)l.push(ae.range(Math.min(n.doc.length,f.anchor+u),Math.min(n.doc.length,f.head+u)))}else{i.push({from:a.from,to:o.from},{from:o.to,insert:n.lineBreak+a.text});for(let f of o.ranges)l.push(ae.range(f.anchor-u,f.head-u))}}return i.length?(e(n.update({changes:i,scrollIntoView:!0,selection:ae.create(l,n.selection.mainIndex),userEvent:"move.line"})),!0):!1}const Jz=({state:n,dispatch:e})=>LT(n,e,!1),e6=({state:n,dispatch:e})=>LT(n,e,!0);function zT(n,e,t){if(n.readOnly)return!1;let i=[];for(let o of am(n))t?i.push({from:o.from,insert:n.doc.slice(o.from,o.to)+n.lineBreak}):i.push({from:o.to,insert:n.lineBreak+n.doc.slice(o.from,o.to)});let l=n.changes(i);return e(n.update({changes:l,selection:n.selection.map(l,t?1:-1),scrollIntoView:!0,userEvent:"input.copyline"})),!0}const t6=({state:n,dispatch:e})=>zT(n,e,!1),n6=({state:n,dispatch:e})=>zT(n,e,!0),i6=n=>{if(n.state.readOnly)return!1;let{state:e}=n,t=e.changes(am(e).map(({from:l,to:o})=>(l>0?l--:o{let o;if(n.lineWrapping){let a=n.lineBlockAt(l.head),u=n.coordsAtPos(l.head,l.assoc||1);u&&(o=a.bottom+n.documentTop-u.bottom+n.defaultLineHeight/2)}return n.moveVertically(l,!0,o)}).map(t);return n.dispatch({changes:t,selection:i,scrollIntoView:!0,userEvent:"delete.line"}),!0};function r6(n,e){if(/\(\)|\[\]|\{\}/.test(n.sliceDoc(e-1,e+1)))return{from:e,to:e};let t=Hn(n).resolveInner(e),i=t.childBefore(e),l=t.childAfter(e),o;return i&&l&&i.to<=e&&l.from>=e&&(o=i.type.prop(Je.closedBy))&&o.indexOf(l.name)>-1&&n.doc.lineAt(i.to).from==n.doc.lineAt(l.from).from&&!/\S/.test(n.sliceDoc(i.to,l.from))?{from:i.to,to:l.from}:null}const h2=BT(!1),l6=BT(!0);function BT(n){return({state:e,dispatch:t})=>{if(e.readOnly)return!1;let i=e.changeByRange(l=>{let{from:o,to:a}=l,u=e.doc.lineAt(o),f=!n&&o==a&&r6(e,o);n&&(o=a=(a<=u.to?u:e.doc.lineAt(a)).to);let d=new nm(e,{simulateBreak:o,simulateDoubleBreak:!!f}),m=Fy(d,o);for(m==null&&(m=Ra(/^\s*/.exec(e.doc.lineAt(o).text)[0],e.tabSize));au.from&&o{let l=[];for(let a=i.from;a<=i.to;){let u=n.doc.lineAt(a);u.number>t&&(i.empty||i.to>u.from)&&(e(u,l,i),t=u.number),a=u.to+1}let o=n.changes(l);return{changes:l,range:ae.range(o.mapPos(i.anchor,1),o.mapPos(i.head,1))}})}const s6=({state:n,dispatch:e})=>{if(n.readOnly)return!1;let t=Object.create(null),i=new nm(n,{overrideIndentation:o=>{let a=t[o];return a??-1}}),l=Xy(n,(o,a,u)=>{let f=Fy(i,o.from);if(f==null)return;/\S/.test(o.text)||(f=0);let d=/^\s*/.exec(o.text)[0],m=xu(n,f);(d!=m||u.fromn.readOnly?!1:(e(n.update(Xy(n,(t,i)=>{i.push({from:t.from,insert:n.facet(Uy)})}),{userEvent:"input.indent"})),!0),a6=({state:n,dispatch:e})=>n.readOnly?!1:(e(n.update(Xy(n,(t,i)=>{let l=/^\s*/.exec(t.text)[0];if(!l)return;let o=Ra(l,n.tabSize),a=0,u=xu(n,Math.max(0,o-Cd(n)));for(;a(n.setTabFocusMode(),!0),u6=[{key:"Ctrl-b",run:mT,shift:ST,preventDefault:!0},{key:"Ctrl-f",run:pT,shift:CT},{key:"Ctrl-p",run:yT,shift:TT},{key:"Ctrl-n",run:bT,shift:AT},{key:"Ctrl-a",run:Tz,shift:Hz},{key:"Ctrl-e",run:Az,shift:Iz},{key:"Ctrl-d",run:jT},{key:"Ctrl-h",run:Xx},{key:"Ctrl-k",run:Yz},{key:"Ctrl-Alt-h",run:_T},{key:"Ctrl-o",run:Wz},{key:"Ctrl-t",run:Zz},{key:"Ctrl-v",run:Qx}],f6=[{key:"ArrowLeft",run:mT,shift:ST,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:yz,shift:Dz,preventDefault:!0},{mac:"Cmd-ArrowLeft",run:Oz,shift:Bz,preventDefault:!0},{key:"ArrowRight",run:pT,shift:CT,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:bz,shift:jz,preventDefault:!0},{mac:"Cmd-ArrowRight",run:Nz,shift:Pz,preventDefault:!0},{key:"ArrowUp",run:yT,shift:TT,preventDefault:!0},{mac:"Cmd-ArrowUp",run:a2,shift:u2},{mac:"Ctrl-ArrowUp",run:l2,shift:s2},{key:"ArrowDown",run:bT,shift:AT,preventDefault:!0},{mac:"Cmd-ArrowDown",run:c2,shift:f2},{mac:"Ctrl-ArrowDown",run:Qx,shift:o2},{key:"PageUp",run:l2,shift:s2},{key:"PageDown",run:Qx,shift:o2},{key:"Home",run:Cz,shift:zz,preventDefault:!0},{key:"Mod-Home",run:a2,shift:u2},{key:"End",run:Sz,shift:Lz,preventDefault:!0},{key:"Mod-End",run:c2,shift:f2},{key:"Enter",run:h2,shift:h2},{key:"Mod-a",run:Uz},{key:"Backspace",run:Xx,shift:Xx,preventDefault:!0},{key:"Delete",run:jT,preventDefault:!0},{key:"Mod-Backspace",mac:"Alt-Backspace",run:_T,preventDefault:!0},{key:"Mod-Delete",mac:"Alt-Delete",run:$z,preventDefault:!0},{mac:"Mod-Backspace",run:Gz,preventDefault:!0},{mac:"Mod-Delete",run:Kz,preventDefault:!0}].concat(u6.map(n=>({mac:n.key,run:n.run,shift:n.shift}))),h6=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:wz,shift:Rz},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:kz,shift:_z},{key:"Alt-ArrowUp",run:Jz},{key:"Shift-Alt-ArrowUp",run:t6},{key:"Alt-ArrowDown",run:e6},{key:"Shift-Alt-ArrowDown",run:n6},{key:"Mod-Alt-ArrowUp",run:Vz},{key:"Mod-Alt-ArrowDown",run:Qz},{key:"Escape",run:Xz},{key:"Mod-Enter",run:l6},{key:"Alt-l",mac:"Ctrl-l",run:Fz},{key:"Mod-i",run:qz,preventDefault:!0},{key:"Mod-[",run:a6},{key:"Mod-]",run:o6},{key:"Mod-Alt-\\",run:s6},{key:"Shift-Mod-k",run:i6},{key:"Shift-Mod-\\",run:Mz},{key:"Mod-/",run:JL},{key:"Alt-A",mac:"Ctrl-A",run:tz},{key:"Ctrl-m",mac:"Shift-Alt-m",run:c6}].concat(f6),d2=typeof String.prototype.normalize=="function"?n=>n.normalize("NFKD"):n=>n;class Da{constructor(e,t,i=0,l=e.length,o,a){this.test=a,this.value={from:0,to:0,precise:!1},this.done=!1,this.matches=[],this.buffer="",this.bufferPos=0,this.iter=e.iterRange(i,l),this.bufferStart=i,this.normalize=o?u=>o(d2(u)):d2,this.query=this.normalize(t)}peek(){if(this.bufferPos==this.buffer.length){if(this.bufferStart+=this.buffer.length,this.iter.next(),this.iter.done)return-1;this.bufferPos=0,this.buffer=this.iter.value}return ui(this.buffer,this.bufferPos)}next(){for(;this.matches.length;)this.matches.pop();return this.nextOverlapping()}nextOverlapping(){for(;;){let e=this.peek();if(e<0)return this.done=!0,this;let t=by(e),i=this.bufferStart+this.bufferPos;this.bufferPos+=Er(e);let l=this.normalize(t);if(l.length)for(let o=0,a=i,u=!0;;o++){let f=l.charCodeAt(o),d=this.match(f,a,u,this.bufferPos+this.bufferStart,o==l.length-1);if(d)return this.value=d,this;if(o==l.length-1)break;u&&othis.to&&(this.curLine=this.curLine.slice(0,this.to-this.curLineStart)),this.iter.next())}nextLine(){this.curLineStart=this.curLineStart+this.curLine.length+1,this.curLineStart>this.to?this.curLine="":this.getLine(0)}next(){for(let e=this.matchPos-this.curLineStart;;){this.re.lastIndex=e;let t=this.matchPos<=this.to&&this.re.exec(this.curLine);if(t){let i=this.curLineStart+t.index,l=i+t[0].length;if(this.matchPos=Ad(this.text,l+(i==l?1:0)),i==this.curLineStart+this.curLine.length&&this.nextLine(),(ithis.value.to)&&(!this.test||this.test(i,l,t)))return this.value={from:i,to:l,precise:!0,match:t},this;e=this.matchPos-this.curLineStart}else if(this.curLineStart+this.curLine.length=i||l.to<=t){let u=new xa(t,e.sliceString(t,i));return w0.set(e,u),u}if(l.from==t&&l.to==i)return l;let{text:o,from:a}=l;return a>t&&(o=e.sliceString(t,a)+o,a=t),l.to=this.to?this.to:this.text.lineAt(e).to}next(){for(;;){let e=this.re.lastIndex=this.matchPos-this.flat.from,t=this.re.exec(this.flat.text);if(t&&!t[0]&&t.index==e&&(this.re.lastIndex=e+1,t=this.re.exec(this.flat.text)),t){let i=this.flat.from+t.index,l=i+t[0].length;if((this.flat.to>=this.to||t.index+t[0].length<=this.flat.text.length-10)&&(!this.test||this.test(i,l,t)))return this.value={from:i,to:l,precise:!0,match:t},this.matchPos=Ad(this.text,l+(i==l?1:0)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=xa.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+this.flat.text.length*2))}}}typeof Symbol<"u"&&(HT.prototype[Symbol.iterator]=IT.prototype[Symbol.iterator]=function(){return this});function d6(n){try{return new RegExp(n,$y),!0}catch{return!1}}function Ad(n,e){if(e>=n.length)return e;let t=n.lineAt(e),i;for(;e=56320&&i<57344;)e++;return e}const m6=n=>{let e=D_(n,"cm-goto-line");if(e){let a=e.dom.querySelector("input[type=text]");return a&&a.select(),!0}let{state:t}=n,i=String(t.doc.lineAt(n.state.selection.main.head).number),{close:l,result:o}=M_(n,{class:"cm-goto-line",label:t.phrase("Go to line"),input:{type:"text",name:"line",value:i},focus:!0,submitLabel:t.phrase("go")});return o.then(a=>{let u=a&&/^([+-])?(\d+)?(:\d+)?(%)?$/.exec(a.elements.line.value);if(!u){n.dispatch({effects:l});return}let f=t.doc.lineAt(t.selection.main.head),[,d,m,g,b]=u,v=g?+g.slice(1):0,w=m?+m:f.number;if(m&&b){let N=w/100;d&&(N=N*(d=="-"?-1:1)+f.number/t.doc.lines),w=Math.round(t.doc.lines*N)}else m&&d&&(w=w*(d=="-"?-1:1)+f.number);let S=t.doc.line(Math.max(1,Math.min(t.doc.lines,w))),C=ae.cursor(S.from+Math.max(0,Math.min(v,S.length)));n.dispatch({effects:[l,Oe.scrollIntoView(C.from,{y:"center"})],selection:C})}),!0},p6={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},g6=Ce.define({combine(n){return Br(n,p6,{highlightWordAroundCursor:(e,t)=>e||t,minSelectionLength:Math.min,maxMatches:Math.min})}});function x6(n){return[k6,w6]}const y6=He.mark({class:"cm-selectionMatch"}),b6=He.mark({class:"cm-selectionMatch cm-selectionMatch-main"});function m2(n,e,t,i){return(t==0||n(e.sliceDoc(t-1,t))!=Pt.Word)&&(i==e.doc.length||n(e.sliceDoc(i,i+1))!=Pt.Word)}function v6(n,e,t,i){return n(e.sliceDoc(t,t+1))==Pt.Word&&n(e.sliceDoc(i-1,i))==Pt.Word}const w6=Jt.fromClass(class{constructor(n){this.decorations=this.getDeco(n)}update(n){(n.selectionSet||n.docChanged||n.viewportChanged)&&(this.decorations=this.getDeco(n.view))}getDeco(n){let e=n.state.facet(g6),{state:t}=n,i=t.selection;if(i.ranges.length>1)return He.none;let l=i.main,o,a=null;if(l.empty){if(!e.highlightWordAroundCursor)return He.none;let f=t.wordAt(l.head);if(!f)return He.none;a=t.charCategorizer(l.head),o=t.sliceDoc(f.from,f.to)}else{let f=l.to-l.from;if(f200)return He.none;if(e.wholeWords){if(o=t.sliceDoc(l.from,l.to),a=t.charCategorizer(l.head),!(m2(a,t,l.from,l.to)&&v6(a,t,l.from,l.to)))return He.none}else if(o=t.sliceDoc(l.from,l.to),!o)return He.none}let u=[];for(let f of n.visibleRanges){let d=new Da(t.doc,o,f.from,f.to);for(;!d.next().done;){let{from:m,to:g}=d.value;if((!a||m2(a,t,m,g))&&(l.empty&&m<=l.from&&g>=l.to?u.push(b6.range(m,g)):(m>=l.to||g<=l.from)&&u.push(y6.range(m,g)),u.length>e.maxMatches))return He.none}}return He.set(u)}},{decorations:n=>n.decorations}),k6=Oe.baseTheme({".cm-selectionMatch":{backgroundColor:"#99ff7780"},".cm-searchMatch .cm-selectionMatch":{backgroundColor:"transparent"}}),S6=({state:n,dispatch:e})=>{let{selection:t}=n,i=ae.create(t.ranges.map(l=>n.wordAt(l.head)||ae.cursor(l.head)),t.mainIndex);return i.eq(t)?!1:(e(n.update({selection:i})),!0)};function C6(n,e){let{main:t,ranges:i}=n.selection,l=n.wordAt(t.head),o=l&&l.from==t.from&&l.to==t.to;for(let a=!1,u=new Da(n.doc,e,i[i.length-1].to);;)if(u.next(),u.done){if(a)return null;u=new Da(n.doc,e,0,Math.max(0,i[i.length-1].from-1)),a=!0}else{if(a&&i.some(f=>f.from==u.value.from))continue;if(o){let f=n.wordAt(u.value.from);if(!f||f.from!=u.value.from||f.to!=u.value.to)continue}return u.value}}const O6=({state:n,dispatch:e})=>{let{ranges:t}=n.selection;if(t.some(o=>o.from===o.to))return S6({state:n,dispatch:e});let i=n.sliceDoc(t[0].from,t[0].to);if(n.selection.ranges.some(o=>n.sliceDoc(o.from,o.to)!=i))return!1;let l=C6(n,i);return l?(e(n.update({selection:n.selection.addRange(ae.range(l.from,l.to),!1),effects:Oe.scrollIntoView(l.to)})),!0):!1},La=Ce.define({combine(n){return Br(n,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:e=>new H6(e),scrollToMatch:e=>Oe.scrollIntoView(e)})}});class UT{constructor(e){this.search=e.search,this.caseSensitive=!!e.caseSensitive,this.literal=!!e.literal,this.regexp=!!e.regexp,this.replace=e.replace||"",this.valid=!!this.search&&(!this.regexp||d6(this.search)),this.unquoted=this.unquote(this.search),this.wholeWord=!!e.wholeWord,this.test=e.test}unquote(e){return this.literal?e:e.replace(/\\([nrt\\])/g,(t,i)=>i=="n"?` +`:i=="r"?"\r":i=="t"?" ":"\\")}eq(e){return this.search==e.search&&this.replace==e.replace&&this.caseSensitive==e.caseSensitive&&this.regexp==e.regexp&&this.wholeWord==e.wholeWord&&this.test==e.test}create(){return this.regexp?new D6(this):new A6(this)}getCursor(e,t=0,i){let l=e.doc?e:dt.create({doc:e});return i==null&&(i=l.doc.length),this.regexp?ia(this,l,t,i):na(this,l,t,i)}}class FT{constructor(e){this.spec=e}}function N6(n,e,t){return(i,l,o,a)=>{if(t&&!t(i,l,o,a))return!1;let u=i>=a&&l<=a+o.length?o.slice(i-a,l-a):e.doc.sliceString(i,l);return n(u,e,i,l)}}function na(n,e,t,i){let l;return n.wholeWord&&(l=T6(e.doc,e.charCategorizer(e.selection.main.head))),n.test&&(l=N6(n.test,e,l)),new Da(e.doc,n.unquoted,t,i,n.caseSensitive?void 0:o=>o.toLowerCase(),l)}function T6(n,e){return(t,i,l,o)=>((o>t||o+l.length=t)return null;l.push(i.value)}return l}highlight(e,t,i,l){let o=na(this.spec,e,Math.max(0,t-this.spec.unquoted.length),Math.min(i+this.spec.unquoted.length,e.doc.length));for(;!o.next().done;)l(o.value.from,o.value.to)}}function E6(n,e,t){return(i,l,o)=>(!t||t(i,l,o))&&n(o[0],e,i,l)}function ia(n,e,t,i){let l;return n.wholeWord&&(l=M6(e.charCategorizer(e.selection.main.head))),n.test&&(l=E6(n.test,e,l)),new HT(e.doc,n.search,{ignoreCase:!n.caseSensitive,test:l},t,i)}function Ed(n,e){return n.slice(Sn(n,e,!1),e)}function Md(n,e){return n.slice(e,Sn(n,e))}function M6(n){return(e,t,i)=>!i[0].length||(n(Ed(i.input,i.index))!=Pt.Word||n(Md(i.input,i.index))!=Pt.Word)&&(n(Md(i.input,i.index+i[0].length))!=Pt.Word||n(Ed(i.input,i.index+i[0].length))!=Pt.Word)}class D6 extends FT{nextMatch(e,t,i){let l=ia(this.spec,e,i,e.doc.length).next();return l.done&&(l=ia(this.spec,e,0,t).next()),l.done?null:l.value}prevMatchInRange(e,t,i){for(let l=1;;l++){let o=Math.max(t,i-l*1e4),a=ia(this.spec,e,o,i),u=null;for(;!a.next().done;)u=a.value;if(u&&(o==t||u.from>o+10))return u;if(o==t)return null}}prevMatch(e,t,i){return this.prevMatchInRange(e,0,t)||this.prevMatchInRange(e,i,e.doc.length)}getReplacement(e){return this.spec.unquote(this.spec.replace).replace(/\$([$&]|\d+)/g,(t,i)=>{if(i=="&")return e.match[0];if(i=="$")return"$";for(let l=i.length;l>0;l--){let o=+i.slice(0,l);if(o>0&&o=t)return null;l.push(i.value)}return l}highlight(e,t,i,l){let o=ia(this.spec,e,Math.max(0,t-250),Math.min(i+250,e.doc.length));for(;!o.next().done;)l(o.value.from,o.value.to)}}const yu=Ye.define(),Yy=Ye.define(),es=In.define({create(n){return new k0($x(n).create(),null)},update(n,e){for(let t of e.effects)t.is(yu)?n=new k0(t.value.create(),n.panel):t.is(Yy)&&(n=new k0(n.query,t.value?Gy:null));return n},provide:n=>mu.from(n,e=>e.panel)});class k0{constructor(e,t){this.query=e,this.panel=t}}const j6=He.mark({class:"cm-searchMatch"}),R6=He.mark({class:"cm-searchMatch cm-searchMatch-selected"}),_6=Jt.fromClass(class{constructor(n){this.view=n,this.decorations=this.highlight(n.state.field(es))}update(n){let e=n.state.field(es);(e!=n.startState.field(es)||n.docChanged||n.selectionSet||n.viewportChanged)&&(this.decorations=this.highlight(e))}highlight({query:n,panel:e}){if(!e||!n.spec.valid)return He.none;let{view:t}=this,i=new zr;for(let l=0,o=t.visibleRanges,a=o.length;lo[l+1].from-500;)f=o[++l].to;n.highlight(t.state,u,f,(d,m)=>{let g=t.state.selection.ranges.some(b=>b.from==d&&b.to==m);i.add(d,m,g?R6:j6)})}return i.finish()}},{decorations:n=>n.decorations});function Du(n){return e=>{let t=e.state.field(es,!1);return t&&t.query.spec.valid?n(e,t):QT(e)}}const Dd=Du((n,{query:e})=>{let{to:t}=n.state.selection.main,i=e.nextMatch(n.state,t,t);if(!i)return!1;let l=ae.single(i.from,i.to),o=n.state.facet(La);return n.dispatch({selection:l,effects:[Ky(n,i),o.scrollToMatch(l.main,n)],userEvent:"select.search"}),VT(n),!0}),jd=Du((n,{query:e})=>{let{state:t}=n,{from:i}=t.selection.main,l=e.prevMatch(t,i,i);if(!l)return!1;let o=ae.single(l.from,l.to),a=n.state.facet(La);return n.dispatch({selection:o,effects:[Ky(n,l),a.scrollToMatch(o.main,n)],userEvent:"select.search"}),VT(n),!0}),L6=Du((n,{query:e})=>{let t=e.matchAll(n.state,1e3);return!t||!t.length?!1:(n.dispatch({selection:ae.create(t.map(i=>ae.range(i.from,i.to))),userEvent:"select.search.matches"}),!0)}),z6=({state:n,dispatch:e})=>{let t=n.selection;if(t.ranges.length>1||t.main.empty)return!1;let{from:i,to:l}=t.main,o=[],a=0;for(let u=new Da(n.doc,n.sliceDoc(i,l));!u.next().done;){if(o.length>1e3)return!1;u.value.from==i&&(a=o.length),o.push(ae.range(u.value.from,u.value.to))}return e(n.update({selection:ae.create(o,a),userEvent:"select.search.matches"})),!0},p2=Du((n,{query:e})=>{let{state:t}=n,{from:i,to:l}=t.selection.main;if(t.readOnly)return!1;let o=e.nextMatch(t,i,i);if(!o)return!1;let a=o,u=[],f,d,m=[];a.precise?a.from==i&&a.to==l&&(d=t.toText(e.getReplacement(a)),u.push({from:a.from,to:a.to,insert:d}),a=e.nextMatch(t,a.from,a.to),m.push(Oe.announce.of(t.phrase("replaced match on line $",t.doc.lineAt(i).number)+"."))):a=e.nextMatch(t,a.from,a.to);let g=n.state.changes(u);return a&&(f=ae.single(a.from,a.to).map(g),m.push(Ky(n,a)),m.push(t.facet(La).scrollToMatch(f.main,n))),n.dispatch({changes:g,selection:f,effects:m,userEvent:"input.replace"}),!0}),B6=Du((n,{query:e})=>{if(n.state.readOnly)return!1;let t=[];for(let l of e.matchAll(n.state,1e9)){let{from:o,to:a,precise:u}=l;u&&t.push({from:o,to:a,insert:e.getReplacement(l)})}if(!t.length)return!1;let i=n.state.phrase("replaced $ matches",t.length)+".";return n.dispatch({changes:t,effects:Oe.announce.of(i),userEvent:"input.replace.all"}),!0});function Gy(n){return n.state.facet(La).createPanel(n)}function $x(n,e){var t,i,l,o,a;let u=n.selection.main,f=u.empty||u.to>u.from+100?"":n.sliceDoc(u.from,u.to);if(e&&!f)return e;let d=n.facet(La);return new UT({search:((t=e==null?void 0:e.literal)!==null&&t!==void 0?t:d.literal)?f:f.replace(/\n/g,"\\n"),caseSensitive:(i=e==null?void 0:e.caseSensitive)!==null&&i!==void 0?i:d.caseSensitive,literal:(l=e==null?void 0:e.literal)!==null&&l!==void 0?l:d.literal,regexp:(o=e==null?void 0:e.regexp)!==null&&o!==void 0?o:d.regexp,wholeWord:(a=e==null?void 0:e.wholeWord)!==null&&a!==void 0?a:d.wholeWord})}function qT(n){let e=tm(n,Gy);return e&&e.dom.querySelector("[main-field]")}function VT(n){let e=qT(n);e&&e==n.root.activeElement&&e.select()}const QT=n=>{let e=n.state.field(es,!1);if(e&&e.panel){let t=qT(n);if(t&&t!=n.root.activeElement){let i=$x(n.state,e.query.spec);i.valid&&n.dispatch({effects:yu.of(i)}),t.focus(),t.select()}}else n.dispatch({effects:[Yy.of(!0),e?yu.of($x(n.state,e.query.spec)):Ye.appendConfig.of(U6)]});return!0},XT=n=>{let e=n.state.field(es,!1);if(!e||!e.panel)return!1;let t=tm(n,Gy);return t&&t.dom.contains(n.root.activeElement)&&n.focus(),n.dispatch({effects:Yy.of(!1)}),!0},P6=[{key:"Mod-f",run:QT,scope:"editor search-panel"},{key:"F3",run:Dd,shift:jd,scope:"editor search-panel",preventDefault:!0},{key:"Mod-g",run:Dd,shift:jd,scope:"editor search-panel",preventDefault:!0},{key:"Escape",run:XT,scope:"editor search-panel"},{key:"Mod-Shift-l",run:z6},{key:"Mod-Alt-g",run:m6},{key:"Mod-d",run:O6,preventDefault:!0}];class H6{constructor(e){this.view=e;let t=this.query=e.state.field(es).query.spec;this.commit=this.commit.bind(this),this.searchField=Ct("input",{value:t.search,placeholder:Ci(e,"Find"),"aria-label":Ci(e,"Find"),class:"cm-textfield",name:"search",form:"","main-field":"true",onchange:this.commit,onkeyup:this.commit}),this.replaceField=Ct("input",{value:t.replace,placeholder:Ci(e,"Replace"),"aria-label":Ci(e,"Replace"),class:"cm-textfield",name:"replace",form:"",onchange:this.commit,onkeyup:this.commit}),this.caseField=Ct("input",{type:"checkbox",name:"case",form:"",checked:t.caseSensitive,onchange:this.commit}),this.reField=Ct("input",{type:"checkbox",name:"re",form:"",checked:t.regexp,onchange:this.commit}),this.wordField=Ct("input",{type:"checkbox",name:"word",form:"",checked:t.wholeWord,onchange:this.commit});function i(l,o,a){return Ct("button",{class:"cm-button",name:l,onclick:o,type:"button"},a)}this.dom=Ct("div",{onkeydown:l=>this.keydown(l),class:"cm-search"},[this.searchField,i("next",()=>Dd(e),[Ci(e,"next")]),i("prev",()=>jd(e),[Ci(e,"previous")]),i("select",()=>L6(e),[Ci(e,"all")]),Ct("label",null,[this.caseField,Ci(e,"match case")]),Ct("label",null,[this.reField,Ci(e,"regexp")]),Ct("label",null,[this.wordField,Ci(e,"by word")]),...e.state.readOnly?[]:[Ct("br"),this.replaceField,i("replace",()=>p2(e),[Ci(e,"replace")]),i("replaceAll",()=>B6(e),[Ci(e,"replace all")])],Ct("button",{name:"close",onclick:()=>XT(e),"aria-label":Ci(e,"close"),type:"button"},["×"])])}commit(){let e=new UT({search:this.searchField.value,caseSensitive:this.caseField.checked,regexp:this.reField.checked,wholeWord:this.wordField.checked,replace:this.replaceField.value});e.eq(this.query)||(this.query=e,this.view.dispatch({effects:yu.of(e)}))}keydown(e){IR(this.view,e,"search-panel")?e.preventDefault():e.keyCode==13&&e.target==this.searchField?(e.preventDefault(),(e.shiftKey?jd:Dd)(this.view)):e.keyCode==13&&e.target==this.replaceField&&(e.preventDefault(),p2(this.view))}update(e){for(let t of e.transactions)for(let i of t.effects)i.is(yu)&&!i.value.eq(this.query)&&this.setQuery(i.value)}setQuery(e){this.query=e,this.searchField.value=e.search,this.replaceField.value=e.replace,this.caseField.checked=e.caseSensitive,this.reField.checked=e.regexp,this.wordField.checked=e.wholeWord}mount(){this.searchField.select()}get pos(){return 80}get top(){return this.view.state.facet(La).top}}function Ci(n,e){return n.state.phrase(e)}const jh=30,Rh=/[\s\.,:;?!]/;function Ky(n,{from:e,to:t}){let i=n.state.doc.lineAt(e),l=n.state.doc.lineAt(t).to,o=Math.max(i.from,e-jh),a=Math.min(l,t+jh),u=n.state.sliceDoc(o,a);if(o!=i.from){for(let f=0;fu.length-jh;f--)if(!Rh.test(u[f-1])&&Rh.test(u[f])){u=u.slice(0,f);break}}return Oe.announce.of(`${n.state.phrase("current match")}. ${u} ${n.state.phrase("on line")} ${i.number}.`)}const I6=Oe.baseTheme({".cm-panel.cm-search":{padding:"2px 6px 4px",position:"relative","& [name=close]":{position:"absolute",top:"0",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",padding:0,margin:0},"& input, & button, & label":{margin:".2em .6em .2em 0"},"& input[type=checkbox]":{marginRight:".2em"},"& label":{fontSize:"80%",whiteSpace:"pre"}},"&light .cm-searchMatch":{backgroundColor:"#ffff0054"},"&dark .cm-searchMatch":{backgroundColor:"#00ffff8a"},"&light .cm-searchMatch-selected":{backgroundColor:"#ff6a0054"},"&dark .cm-searchMatch-selected":{backgroundColor:"#ff00ff8a"}}),U6=[es,so.low(_6),I6];class $T{constructor(e,t,i,l){this.state=e,this.pos=t,this.explicit=i,this.view=l,this.abortListeners=[],this.abortOnDocChange=!1}tokenBefore(e){let t=Hn(this.state).resolveInner(this.pos,-1);for(;t&&e.indexOf(t.name)<0;)t=t.parent;return t?{from:t.from,to:this.pos,text:this.state.sliceDoc(t.from,this.pos),type:t.type}:null}matchBefore(e){let t=this.state.doc.lineAt(this.pos),i=Math.max(t.from,this.pos-250),l=t.text.slice(i-t.from,this.pos-t.from),o=l.search(YT(e,!1));return o<0?null:{from:i+o,to:this.pos,text:l.slice(o)}}get aborted(){return this.abortListeners==null}addEventListener(e,t,i){e=="abort"&&this.abortListeners&&(this.abortListeners.push(t),i&&i.onDocChange&&(this.abortOnDocChange=!0))}}function g2(n){let e=Object.keys(n).join(""),t=/\w/.test(e);return t&&(e=e.replace(/\w/g,"")),`[${t?"\\w":""}${e.replace(/[^\w\s]/g,"\\$&")}]`}function F6(n){let e=Object.create(null),t=Object.create(null);for(let{label:l}of n){e[l[0]]=!0;for(let o=1;otypeof l=="string"?{label:l}:l),[t,i]=e.every(l=>/^\w+$/.test(l.label))?[/\w*$/,/\w+$/]:F6(e);return l=>{let o=l.matchBefore(i);return o||l.explicit?{from:o?o.from:l.pos,options:e,validFor:t}:null}}class x2{constructor(e,t,i,l){this.completion=e,this.source=t,this.match=i,this.score=l}}function eo(n){return n.selection.main.from}function YT(n,e){var t;let{source:i}=n,l=e&&i[0]!="^",o=i[i.length-1]!="$";return!l&&!o?n:new RegExp(`${l?"^":""}(?:${i})${o?"$":""}`,(t=n.flags)!==null&&t!==void 0?t:n.ignoreCase?"i":"")}const GT=cl.define();function V6(n,e,t,i){let{main:l}=n.selection,o=t-l.from,a=i-l.from;return{...n.changeByRange(u=>{if(u!=l&&t!=i&&n.sliceDoc(u.from+o,u.from+a)!=n.sliceDoc(t,i))return{range:u};let f=n.toText(e);return{changes:{from:u.from+o,to:i==l.from?u.to:u.from+a,insert:f},range:ae.cursor(u.from+o+f.length)}}),scrollIntoView:!0,userEvent:"input.complete"}}const y2=new WeakMap;function Q6(n){if(!Array.isArray(n))return n;let e=y2.get(n);return e||y2.set(n,e=q6(n)),e}const Rd=Ye.define(),bu=Ye.define();class X6{constructor(e){this.pattern=e,this.chars=[],this.folded=[],this.any=[],this.precise=[],this.byWord=[],this.score=0,this.matched=[];for(let t=0;t=48&&U<=57||U>=97&&U<=122?2:U>=65&&U<=90?1:0:(E=by(U))!=E.toLowerCase()?1:E!=E.toUpperCase()?2:0;(!R||T==1&&C||I==0&&T!=0)&&(t[g]==U||i[g]==U&&(b=!0)?a[g++]=R:a.length&&(N=!1)),I=T,R+=Er(U)}return g==f&&a[0]==0&&N?this.result(-100+(b?-200:0),a,e):v==f&&w==0?this.ret(-200-e.length+(S==e.length?0:-100),[0,S]):u>-1?this.ret(-700-e.length,[u,u+this.pattern.length]):v==f?this.ret(-900-e.length,[w,S]):g==f?this.result(-100+(b?-200:0)+-700+(N?0:-1100),a,e):t.length==2?null:this.result((l[0]?-700:0)+-200+-1100,l,e)}result(e,t,i){let l=[],o=0;for(let a of t){let u=a+(this.astral?Er(ui(i,a)):1);o&&l[o-1]==a?l[o-1]=u:(l[o++]=a,l[o++]=u)}return this.ret(e-i.length,l)}}class $6{constructor(e){this.pattern=e,this.matched=[],this.score=0,this.folded=e.toLowerCase()}match(e){if(e.length!1,activateOnTypingDelay:100,selectOnOpen:!0,override:null,closeOnBlur:!0,maxRenderedOptions:100,defaultKeymap:!0,tooltipClass:()=>"",optionClass:()=>"",aboveCursor:!1,icons:!0,addToOptions:[],positionInfo:Y6,filterStrict:!1,compareCompletions:(e,t)=>(e.sortText||e.label).localeCompare(t.sortText||t.label),interactionDelay:75,updateSyncTime:100},{defaultKeymap:(e,t)=>e&&t,closeOnBlur:(e,t)=>e&&t,icons:(e,t)=>e&&t,tooltipClass:(e,t)=>i=>b2(e(i),t(i)),optionClass:(e,t)=>i=>b2(e(i),t(i)),addToOptions:(e,t)=>e.concat(t),filterStrict:(e,t)=>e||t})}});function b2(n,e){return n?e?n+" "+e:n:e}function Y6(n,e,t,i,l,o){let a=n.textDirection==Ot.RTL,u=a,f=!1,d="top",m,g,b=e.left-l.left,v=l.right-e.right,w=i.right-i.left,S=i.bottom-i.top;if(u&&b=S||R>e.top?m=t.bottom-e.top:(d="bottom",m=e.bottom-t.top)}let C=(e.bottom-e.top)/o.offsetHeight,N=(e.right-e.left)/o.offsetWidth;return{style:`${d}: ${m/C}px; max-width: ${g/N}px`,class:"cm-completionInfo-"+(f?a?"left-narrow":"right-narrow":u?"left":"right")}}const Wy=Ye.define();function G6(n){let e=n.addToOptions.slice();return n.icons&&e.push({render(t){let i=document.createElement("div");return i.classList.add("cm-completionIcon"),t.type&&i.classList.add(...t.type.split(/\s+/g).map(l=>"cm-completionIcon-"+l)),i.setAttribute("aria-hidden","true"),i},position:20}),e.push({render(t,i,l,o){let a=document.createElement("span");a.className="cm-completionLabel";let u=t.displayLabel||t.label,f=0;for(let d=0;df&&a.appendChild(document.createTextNode(u.slice(f,m)));let b=a.appendChild(document.createElement("span"));b.appendChild(document.createTextNode(u.slice(m,g))),b.className="cm-completionMatchedText",f=g}return ft.position-i.position).map(t=>t.render)}function S0(n,e,t){if(n<=t)return{from:0,to:n};if(e<0&&(e=0),e<=n>>1){let l=Math.floor(e/t);return{from:l*t,to:(l+1)*t}}let i=Math.ceil((n-e)/t);return{from:n-i*t,to:n-(i-1)*t}}class K6{constructor(e,t,i){this.view=e,this.stateField=t,this.applyCompletion=i,this.info=null,this.infoDestroy=null,this.placeInfoReq={read:()=>this.measureInfo(),write:f=>this.placeInfo(f),key:this},this.space=null,this.currentClass="";let l=e.state.field(t),{options:o,selected:a}=l.open,u=e.state.facet(kn);this.optionContent=G6(u),this.optionClass=u.optionClass,this.tooltipClass=u.tooltipClass,this.range=S0(o.length,a,u.maxRenderedOptions),this.dom=document.createElement("div"),this.dom.className="cm-tooltip-autocomplete",this.updateTooltipClass(e.state),this.dom.addEventListener("mousedown",f=>{let{options:d}=e.state.field(t).open;for(let m=f.target,g;m&&m!=this.dom;m=m.parentNode)if(m.nodeName=="LI"&&(g=/-(\d+)$/.exec(m.id))&&+g[1]this.list.lastChild.getBoundingClientRect().bottom?this.range.to:null;m!=null&&(e.dispatch({effects:Wy.of(m)}),f.preventDefault())}}),this.dom.addEventListener("focusout",f=>{let d=e.state.field(this.stateField,!1);d&&d.tooltip&&e.state.facet(kn).closeOnBlur&&f.relatedTarget!=e.contentDOM&&e.dispatch({effects:bu.of(null)})}),this.showOptions(o,l.id)}mount(){this.updateSel()}showOptions(e,t){this.list&&this.list.remove(),this.list=this.dom.appendChild(this.createListBox(e,t,this.range)),this.list.addEventListener("scroll",()=>{this.info&&this.view.requestMeasure(this.placeInfoReq)})}update(e){var t;let i=e.state.field(this.stateField),l=e.startState.field(this.stateField);if(this.updateTooltipClass(e.state),i!=l){let{options:o,selected:a,disabled:u}=i.open;(!l.open||l.open.options!=o)&&(this.range=S0(o.length,a,e.state.facet(kn).maxRenderedOptions),this.showOptions(o,i.id)),this.updateSel(),u!=((t=l.open)===null||t===void 0?void 0:t.disabled)&&this.dom.classList.toggle("cm-tooltip-autocomplete-disabled",!!u)}}updateTooltipClass(e){let t=this.tooltipClass(e);if(t!=this.currentClass){for(let i of this.currentClass.split(" "))i&&this.dom.classList.remove(i);for(let i of t.split(" "))i&&this.dom.classList.add(i);this.currentClass=t}}positioned(e){this.space=e,this.info&&this.view.requestMeasure(this.placeInfoReq)}updateSel(){let e=this.view.state.field(this.stateField),t=e.open;(t.selected>-1&&t.selected=this.range.to)&&(this.range=S0(t.options.length,t.selected,this.view.state.facet(kn).maxRenderedOptions),this.showOptions(t.options,e.id));let i=this.updateSelectedOption(t.selected);if(i){this.destroyInfo();let{completion:l}=t.options[t.selected],{info:o}=l;if(!o)return;let a=typeof o=="string"?document.createTextNode(o):o(l);if(!a)return;"then"in a?a.then(u=>{u&&this.view.state.field(this.stateField,!1)==e&&this.addInfoPane(u,l)}).catch(u=>di(this.view.state,u,"completion info")):(this.addInfoPane(a,l),i.setAttribute("aria-describedby",this.info.id))}}addInfoPane(e,t){this.destroyInfo();let i=this.info=document.createElement("div");if(i.className="cm-tooltip cm-completionInfo",i.id="cm-completionInfo-"+Math.floor(Math.random()*65535).toString(16),e.nodeType!=null)i.appendChild(e),this.infoDestroy=null;else{let{dom:l,destroy:o}=e;i.appendChild(l),this.infoDestroy=o||null}this.dom.appendChild(i),this.view.requestMeasure(this.placeInfoReq)}updateSelectedOption(e){let t=null;for(let i=this.list.firstChild,l=this.range.from;i;i=i.nextSibling,l++)i.nodeName!="LI"||!i.id?l--:l==e?i.hasAttribute("aria-selected")||(i.setAttribute("aria-selected","true"),t=i):i.hasAttribute("aria-selected")&&(i.removeAttribute("aria-selected"),i.removeAttribute("aria-describedby"));return t&&Z6(this.list,t),t}measureInfo(){let e=this.dom.querySelector("[aria-selected]");if(!e||!this.info)return null;let t=this.dom.getBoundingClientRect(),i=this.info.getBoundingClientRect(),l=e.getBoundingClientRect(),o=this.space;if(!o){let a=this.dom.ownerDocument.documentElement;o={left:0,top:0,right:a.clientWidth,bottom:a.clientHeight}}return l.top>Math.min(o.bottom,t.bottom)-10||l.bottom{a.target==l&&a.preventDefault()});let o=null;for(let a=i.from;ai.from||i.from==0))if(o=b,typeof d!="string"&&d.header)l.appendChild(d.header(d));else{let v=l.appendChild(document.createElement("completion-section"));v.textContent=b}}const m=l.appendChild(document.createElement("li"));m.id=t+"-"+a,m.setAttribute("role","option");let g=this.optionClass(u);g&&(m.className=g);for(let b of this.optionContent){let v=b(u,this.view.state,this.view,f);v&&m.appendChild(v)}}return i.from&&l.classList.add("cm-completionListIncompleteTop"),i.tonew K6(t,n,e)}function Z6(n,e){let t=n.getBoundingClientRect(),i=e.getBoundingClientRect(),l=t.height/n.offsetHeight;i.topt.bottom&&(n.scrollTop+=(i.bottom-t.bottom)/l)}function v2(n){return(n.boost||0)*100+(n.apply?10:0)+(n.info?5:0)+(n.type?1:0)}function J6(n,e){let t=[],i=null,l=null,o=m=>{t.push(m);let{section:g}=m.completion;if(g){i||(i=[]);let b=typeof g=="string"?g:g.name;i.some(v=>v.name==b)||i.push(typeof g=="string"?{name:b}:g)}},a=e.facet(kn);for(let m of n)if(m.hasResult()){let g=m.result.getMatch;if(m.result.filter===!1)for(let b of m.result.options)o(new x2(b,m.source,g?g(b):[],1e9-t.length));else{let b=e.sliceDoc(m.from,m.to),v,w=a.filterStrict?new $6(b):new X6(b);for(let S of m.result.options)if(v=w.match(S.label)){let C=S.displayLabel?g?g(S,v.matched):[]:v.matched,N=v.score+(S.boost||0);if(o(new x2(S,m.source,C,N)),typeof S.section=="object"&&S.section.rank==="dynamic"){let{name:R}=S.section;l||(l=Object.create(null)),l[R]=Math.max(N,l[R]||-1e9)}}}}if(i){let m=Object.create(null),g=0,b=(v,w)=>(v.rank==="dynamic"&&w.rank==="dynamic"?l[w.name]-l[v.name]:0)||(typeof v.rank=="number"?v.rank:1e9)-(typeof w.rank=="number"?w.rank:1e9)||(v.nameb.score-g.score||d(g.completion,b.completion))){let g=m.completion;!f||f.label!=g.label||f.detail!=g.detail||f.type!=null&&g.type!=null&&f.type!=g.type||f.apply!=g.apply||f.boost!=g.boost?u.push(m):v2(m.completion)>v2(f)&&(u[u.length-1]=m),f=m.completion}return u}class fa{constructor(e,t,i,l,o,a){this.options=e,this.attrs=t,this.tooltip=i,this.timestamp=l,this.selected=o,this.disabled=a}setSelected(e,t){return e==this.selected||e>=this.options.length?this:new fa(this.options,w2(t,e),this.tooltip,this.timestamp,e,this.disabled)}static build(e,t,i,l,o,a){if(l&&!a&&e.some(d=>d.isPending))return l.setDisabled();let u=J6(e,t);if(!u.length)return l&&e.some(d=>d.isPending)?l.setDisabled():null;let f=t.facet(kn).selectOnOpen?0:-1;if(l&&l.selected!=f&&l.selected!=-1){let d=l.options[l.selected].completion;for(let m=0;mm.hasResult()?Math.min(d,m.from):d,1e8),create:lB,above:o.aboveCursor},l?l.timestamp:Date.now(),f,!1)}map(e){return new fa(this.options,this.attrs,{...this.tooltip,pos:e.mapPos(this.tooltip.pos)},this.timestamp,this.selected,this.disabled)}setDisabled(){return new fa(this.options,this.attrs,this.tooltip,this.timestamp,this.selected,!0)}}class _d{constructor(e,t,i){this.active=e,this.id=t,this.open=i}static start(){return new _d(iB,"cm-ac-"+Math.floor(Math.random()*2e6).toString(36),null)}update(e){let{state:t}=e,i=t.facet(kn),o=(i.override||t.languageDataAt("autocomplete",eo(t)).map(Q6)).map(f=>(this.active.find(m=>m.source==f)||new Fi(f,this.active.some(m=>m.state!=0)?1:0)).update(e,i));o.length==this.active.length&&o.every((f,d)=>f==this.active[d])&&(o=this.active);let a=this.open,u=e.effects.some(f=>f.is(Zy));a&&e.docChanged&&(a=a.map(e.changes)),e.selection||o.some(f=>f.hasResult()&&e.changes.touchesRange(f.from,f.to))||!eB(o,this.active)||u?a=fa.build(o,t,this.id,a,i,u):a&&a.disabled&&!o.some(f=>f.isPending)&&(a=null),!a&&o.every(f=>!f.isPending)&&o.some(f=>f.hasResult())&&(o=o.map(f=>f.hasResult()?new Fi(f.source,0):f));for(let f of e.effects)f.is(Wy)&&(a=a&&a.setSelected(f.value,this.id));return o==this.active&&a==this.open?this:new _d(o,this.id,a)}get tooltip(){return this.open?this.open.tooltip:null}get attrs(){return this.open?this.open.attrs:this.active.length?tB:nB}}function eB(n,e){if(n==e)return!0;for(let t=0,i=0;;){for(;t-1&&(t["aria-activedescendant"]=n+"-"+e),t}const iB=[];function KT(n,e){if(n.isUserEvent("input.complete")){let i=n.annotation(GT);if(i&&e.activateOnCompletion(i))return 12}let t=n.isUserEvent("input.type");return t&&e.activateOnTyping?5:t?1:n.isUserEvent("delete.backward")?2:n.selection?8:n.docChanged?16:0}class Fi{constructor(e,t,i=!1){this.source=e,this.state=t,this.explicit=i}hasResult(){return!1}get isPending(){return this.state==1}update(e,t){let i=KT(e,t),l=this;(i&8||i&16&&this.touches(e))&&(l=new Fi(l.source,0)),i&4&&l.state==0&&(l=new Fi(this.source,1)),l=l.updateFor(e,i);for(let o of e.effects)if(o.is(Rd))l=new Fi(l.source,1,o.value);else if(o.is(bu))l=new Fi(l.source,0);else if(o.is(Zy))for(let a of o.value)a.source==l.source&&(l=a);return l}updateFor(e,t){return this.map(e.changes)}map(e){return this}touches(e){return e.changes.touchesRange(eo(e.state))}}class ya extends Fi{constructor(e,t,i,l,o,a){super(e,3,t),this.limit=i,this.result=l,this.from=o,this.to=a}hasResult(){return!0}updateFor(e,t){var i;if(!(t&3))return this.map(e.changes);let l=this.result;l.map&&!e.changes.empty&&(l=l.map(l,e.changes));let o=e.changes.mapPos(this.from),a=e.changes.mapPos(this.to,1),u=eo(e.state);if(u>a||!l||t&2&&(eo(e.startState)==this.from||ut.map(e))}}),fi=In.define({create(){return _d.start()},update(n,e){return n.update(e)},provide:n=>[zy.from(n,e=>e.tooltip),Oe.contentAttributes.from(n,e=>e.attrs)]});function Jy(n,e){const t=e.completion.apply||e.completion.label;let i=n.state.field(fi).active.find(l=>l.source==e.source);return i instanceof ya?(typeof t=="string"?n.dispatch({...V6(n.state,t,i.from,i.to),annotations:GT.of(e.completion)}):t(n,e.completion,i.from,i.to),!0):!1}const lB=W6(fi,Jy);function _h(n,e="option"){return t=>{let i=t.state.field(fi,!1);if(!i||!i.open||i.open.disabled||Date.now()-i.open.timestamp-1?i.open.selected+l*(n?1:-1):n?0:a-1;return u<0?u=e=="page"?0:a-1:u>=a&&(u=e=="page"?a-1:0),t.dispatch({effects:Wy.of(u)}),!0}}const sB=n=>{let e=n.state.field(fi,!1);return n.state.readOnly||!e||!e.open||e.open.selected<0||e.open.disabled||Date.now()-e.open.timestampn.state.field(fi,!1)?(n.dispatch({effects:Rd.of(!0)}),!0):!1,oB=n=>{let e=n.state.field(fi,!1);return!e||!e.active.some(t=>t.state!=0)?!1:(n.dispatch({effects:bu.of(null)}),!0)};class aB{constructor(e,t){this.active=e,this.context=t,this.time=Date.now(),this.updates=[],this.done=void 0}}const cB=50,uB=1e3,fB=Jt.fromClass(class{constructor(n){this.view=n,this.debounceUpdate=-1,this.running=[],this.debounceAccept=-1,this.pendingStart=!1,this.composing=0;for(let e of n.state.field(fi).active)e.isPending&&this.startQuery(e)}update(n){let e=n.state.field(fi),t=n.state.facet(kn);if(!n.selectionSet&&!n.docChanged&&n.startState.field(fi)==e)return;let i=n.transactions.some(o=>{let a=KT(o,t);return a&8||(o.selection||o.docChanged)&&!(a&3)});for(let o=0;ocB&&Date.now()-a.time>uB){for(let u of a.context.abortListeners)try{u()}catch(f){di(this.view.state,f)}a.context.abortListeners=null,this.running.splice(o--,1)}else a.updates.push(...n.transactions)}this.debounceUpdate>-1&&clearTimeout(this.debounceUpdate),n.transactions.some(o=>o.effects.some(a=>a.is(Rd)))&&(this.pendingStart=!0);let l=this.pendingStart?50:t.activateOnTypingDelay;if(this.debounceUpdate=e.active.some(o=>o.isPending&&!this.running.some(a=>a.active.source==o.source))?setTimeout(()=>this.startUpdate(),l):-1,this.composing!=0)for(let o of n.transactions)o.isUserEvent("input.type")?this.composing=2:this.composing==2&&o.selection&&(this.composing=3)}startUpdate(){this.debounceUpdate=-1,this.pendingStart=!1;let{state:n}=this.view,e=n.field(fi);for(let t of e.active)t.isPending&&!this.running.some(i=>i.active.source==t.source)&&this.startQuery(t);this.running.length&&e.open&&e.open.disabled&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(kn).updateSyncTime))}startQuery(n){let{state:e}=this.view,t=eo(e),i=new $T(e,t,n.explicit,this.view),l=new aB(n,i);this.running.push(l),Promise.resolve(n.source(i)).then(o=>{l.context.aborted||(l.done=o||null,this.scheduleAccept())},o=>{this.view.dispatch({effects:bu.of(null)}),di(this.view.state,o)})}scheduleAccept(){this.running.every(n=>n.done!==void 0)?this.accept():this.debounceAccept<0&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(kn).updateSyncTime))}accept(){var n;this.debounceAccept>-1&&clearTimeout(this.debounceAccept),this.debounceAccept=-1;let e=[],t=this.view.state.facet(kn),i=this.view.state.field(fi);for(let l=0;lu.source==o.active.source);if(a&&a.isPending)if(o.done==null){let u=new Fi(o.active.source,0);for(let f of o.updates)u=u.update(f,t);u.isPending||e.push(u)}else this.startQuery(a)}(e.length||i.open&&i.open.disabled)&&this.view.dispatch({effects:Zy.of(e)})}},{eventHandlers:{blur(n){let e=this.view.state.field(fi,!1);if(e&&e.tooltip&&this.view.state.facet(kn).closeOnBlur){let t=e.open&&DN(this.view,e.open.tooltip);(!t||!t.dom.contains(n.relatedTarget))&&setTimeout(()=>this.view.dispatch({effects:bu.of(null)}),10)}},compositionstart(){this.composing=1},compositionend(){this.composing==3&&setTimeout(()=>this.view.dispatch({effects:Rd.of(!1)}),20),this.composing=0}}}),hB=typeof navigator=="object"&&/Win/.test(navigator.platform),dB=so.highest(Oe.domEventHandlers({keydown(n,e){let t=e.state.field(fi,!1);if(!t||!t.open||t.open.disabled||t.open.selected<0||!n.key||n.key.length>1||n.ctrlKey&&!(hB&&n.altKey)||n.metaKey)return!1;let i=t.open.options[t.open.selected],l=t.active.find(a=>a.source==i.source),o=i.completion.commitCharacters||l.result.commitCharacters;return o&&o.indexOf(n.key)>-1&&Jy(e,i),!1}})),mB=Oe.baseTheme({".cm-tooltip.cm-tooltip-autocomplete":{"& > ul":{fontFamily:"monospace",whiteSpace:"nowrap",overflow:"hidden auto",maxWidth_fallback:"700px",maxWidth:"min(700px, 95vw)",minWidth:"250px",maxHeight:"10em",height:"100%",listStyle:"none",margin:0,padding:0,"& > li, & > completion-section":{padding:"1px 3px",lineHeight:1.2},"& > li":{overflowX:"hidden",textOverflow:"ellipsis",cursor:"pointer"},"& > completion-section":{display:"list-item",borderBottom:"1px solid silver",paddingLeft:"0.5em",opacity:.7}}},"&light .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#17c",color:"white"},"&light .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#777"},"&dark .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#347",color:"white"},"&dark .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#444"},".cm-completionListIncompleteTop:before, .cm-completionListIncompleteBottom:after":{content:'"···"',opacity:.5,display:"block",textAlign:"center",cursor:"pointer"},".cm-tooltip.cm-completionInfo":{position:"absolute",padding:"3px 9px",width:"max-content",maxWidth:"400px",boxSizing:"border-box",whiteSpace:"pre-line"},".cm-completionInfo.cm-completionInfo-left":{right:"100%"},".cm-completionInfo.cm-completionInfo-right":{left:"100%"},".cm-completionInfo.cm-completionInfo-left-narrow":{right:"30px"},".cm-completionInfo.cm-completionInfo-right-narrow":{left:"30px"},"&light .cm-snippetField":{backgroundColor:"#00000022"},"&dark .cm-snippetField":{backgroundColor:"#ffffff22"},".cm-snippetFieldPosition":{verticalAlign:"text-top",width:0,height:"1.15em",display:"inline-block",margin:"0 -0.7px -.7em",borderLeft:"1.4px dotted #888"},".cm-completionMatchedText":{textDecoration:"underline"},".cm-completionDetail":{marginLeft:"0.5em",fontStyle:"italic"},".cm-completionIcon":{fontSize:"90%",width:".8em",display:"inline-block",textAlign:"center",paddingRight:".6em",opacity:"0.6",boxSizing:"content-box"},".cm-completionIcon-function, .cm-completionIcon-method":{"&:after":{content:"'ƒ'"}},".cm-completionIcon-class":{"&:after":{content:"'○'"}},".cm-completionIcon-interface":{"&:after":{content:"'◌'"}},".cm-completionIcon-variable":{"&:after":{content:"'𝑥'"}},".cm-completionIcon-constant":{"&:after":{content:"'𝐶'"}},".cm-completionIcon-type":{"&:after":{content:"'𝑡'"}},".cm-completionIcon-enum":{"&:after":{content:"'∪'"}},".cm-completionIcon-property":{"&:after":{content:"'□'"}},".cm-completionIcon-keyword":{"&:after":{content:"'🔑︎'"}},".cm-completionIcon-namespace":{"&:after":{content:"'▢'"}},".cm-completionIcon-text":{"&:after":{content:"'abc'",fontSize:"50%",verticalAlign:"middle"}}}),vu={brackets:["(","[","{","'",'"'],before:")]}:;>",stringPrefixes:[]},Ks=Ye.define({map(n,e){let t=e.mapPos(n,-1,Kn.TrackAfter);return t??void 0}}),eb=new class extends ns{};eb.startSide=1;eb.endSide=-1;const WT=In.define({create(){return it.empty},update(n,e){if(n=n.map(e.changes),e.selection){let t=e.state.doc.lineAt(e.selection.main.head);n=n.update({filter:i=>i>=t.from&&i<=t.to})}for(let t of e.effects)t.is(Ks)&&(n=n.update({add:[eb.range(t.value,t.value+1)]}));return n}});function pB(){return[xB,WT]}const O0="()[]{}<>«»»«[]{}";function ZT(n){for(let e=0;e{if((gB?n.composing:n.compositionStarted)||n.state.readOnly)return!1;let l=n.state.selection.main;if(i.length>2||i.length==2&&Er(ui(i,0))==1||e!=l.from||t!=l.to)return!1;let o=vB(n.state,i);return o?(n.dispatch(o),!0):!1}),yB=({state:n,dispatch:e})=>{if(n.readOnly)return!1;let i=JT(n,n.selection.main.head).brackets||vu.brackets,l=null,o=n.changeByRange(a=>{if(a.empty){let u=wB(n.doc,a.head);for(let f of i)if(f==u&&cm(n.doc,a.head)==ZT(ui(f,0)))return{changes:{from:a.head-f.length,to:a.head+f.length},range:ae.cursor(a.head-f.length)}}return{range:l=a}});return l||e(n.update(o,{scrollIntoView:!0,userEvent:"delete.backward"})),!l},bB=[{key:"Backspace",run:yB}];function vB(n,e){let t=JT(n,n.selection.main.head),i=t.brackets||vu.brackets;for(let l of i){let o=ZT(ui(l,0));if(e==l)return o==l?CB(n,l,i.indexOf(l+l+l)>-1,t):kB(n,l,o,t.before||vu.before);if(e==o&&eA(n,n.selection.main.from))return SB(n,l,o)}return null}function eA(n,e){let t=!1;return n.field(WT).between(0,n.doc.length,i=>{i==e&&(t=!0)}),t}function cm(n,e){let t=n.sliceString(e,e+2);return t.slice(0,Er(ui(t,0)))}function wB(n,e){let t=n.sliceString(e-2,e);return Er(ui(t,0))==t.length?t:t.slice(1)}function kB(n,e,t,i){let l=null,o=n.changeByRange(a=>{if(!a.empty)return{changes:[{insert:e,from:a.from},{insert:t,from:a.to}],effects:Ks.of(a.to+e.length),range:ae.range(a.anchor+e.length,a.head+e.length)};let u=cm(n.doc,a.head);return!u||/\s/.test(u)||i.indexOf(u)>-1?{changes:{insert:e+t,from:a.head},effects:Ks.of(a.head+e.length),range:ae.cursor(a.head+e.length)}:{range:l=a}});return l?null:n.update(o,{scrollIntoView:!0,userEvent:"input.type"})}function SB(n,e,t){let i=null,l=n.changeByRange(o=>o.empty&&cm(n.doc,o.head)==t?{changes:{from:o.head,to:o.head+t.length,insert:t},range:ae.cursor(o.head+t.length)}:i={range:o});return i?null:n.update(l,{scrollIntoView:!0,userEvent:"input.type"})}function CB(n,e,t,i){let l=i.stringPrefixes||vu.stringPrefixes,o=null,a=n.changeByRange(u=>{if(!u.empty)return{changes:[{insert:e,from:u.from},{insert:e,from:u.to}],effects:Ks.of(u.to+e.length),range:ae.range(u.anchor+e.length,u.head+e.length)};let f=u.head,d=cm(n.doc,f),m;if(d==e){if(k2(n,f))return{changes:{insert:e+e,from:f},effects:Ks.of(f+e.length),range:ae.cursor(f+e.length)};if(eA(n,f)){let b=t&&n.sliceDoc(f,f+e.length*3)==e+e+e?e+e+e:e;return{changes:{from:f,to:f+b.length,insert:b},range:ae.cursor(f+b.length)}}}else{if(t&&n.sliceDoc(f-2*e.length,f)==e+e&&(m=S2(n,f-2*e.length,l))>-1&&k2(n,m))return{changes:{insert:e+e+e+e,from:f},effects:Ks.of(f+e.length),range:ae.cursor(f+e.length)};if(n.charCategorizer(f)(d)!=Pt.Word&&S2(n,f,l)>-1&&!OB(n,f,e,l))return{changes:{insert:e+e,from:f},effects:Ks.of(f+e.length),range:ae.cursor(f+e.length)}}return{range:o=u}});return o?null:n.update(a,{scrollIntoView:!0,userEvent:"input.type"})}function k2(n,e){let t=Hn(n).resolveInner(e+1);return t.parent&&t.from==e}function OB(n,e,t,i){let l=Hn(n).resolveInner(e,-1),o=i.reduce((a,u)=>Math.max(a,u.length),0);for(let a=0;a<5;a++){let u=n.sliceDoc(l.from,Math.min(l.to,l.from+t.length+o)),f=u.indexOf(t);if(!f||f>-1&&i.indexOf(u.slice(0,f))>-1){let m=l.firstChild;for(;m&&m.from==l.from&&m.to-m.from>t.length+f;){if(n.sliceDoc(m.to-t.length,m.to)==t)return!1;m=m.firstChild}return!0}let d=l.to==e&&l.parent;if(!d)break;l=d}return!1}function S2(n,e,t){let i=n.charCategorizer(e);if(i(n.sliceDoc(e-1,e))!=Pt.Word)return e;for(let l of t){let o=e-l.length;if(n.sliceDoc(o,e)==l&&i(n.sliceDoc(o-1,o))!=Pt.Word)return o}return-1}function NB(n={}){return[dB,fi,kn.of(n),fB,TB,mB]}const tA=[{key:"Ctrl-Space",run:C0},{mac:"Alt-`",run:C0},{mac:"Alt-i",run:C0},{key:"Escape",run:oB},{key:"ArrowDown",run:_h(!0)},{key:"ArrowUp",run:_h(!1)},{key:"PageDown",run:_h(!0,"page")},{key:"PageUp",run:_h(!1,"page")},{key:"Enter",run:sB}],TB=so.highest(_y.computeN([kn],n=>n.facet(kn).defaultKeymap?[tA]:[]));class C2{constructor(e,t,i){this.from=e,this.to=t,this.diagnostic=i}}class $s{constructor(e,t,i){this.diagnostics=e,this.panel=t,this.selected=i}static init(e,t,i){let l=i.facet(wu).markerFilter;l&&(e=l(e,i));let o=e.slice().sort((v,w)=>v.from-w.from||v.to-w.to),a=new zr,u=[],f=0,d=i.doc.iter(),m=0,g=i.doc.length;for(let v=0;;){let w=v==o.length?null:o[v];if(!w&&!u.length)break;let S,C;if(u.length)S=f,C=u.reduce((M,I)=>Math.min(M,I.to),w&&w.from>S?w.from:1e8);else{if(S=w.from,S>g)break;C=w.to,u.push(w),v++}for(;vM.from||M.to==S))u.push(M),v++,C=Math.min(M.to,C);else{C=Math.min(M.from,C);break}}C=Math.min(C,g);let N=!1;if(u.some(M=>M.from==S&&(M.to==C||C==g))&&(N=S==C,!N&&C-S<10)){let M=S-(m+d.value.length);M>0&&(d.next(M),m=S);for(let I=S;;){if(I>=C){N=!0;break}if(!d.lineBreak&&m+d.value.length>I)break;I=m+d.value.length,m+=d.value.length,d.next()}}let R=IB(u);if(N)a.add(S,S,He.widget({widget:new zB(R),diagnostics:u.slice()}));else{let M=u.reduce((I,U)=>U.markClass?I+" "+U.markClass:I,"");a.add(S,C,He.mark({class:"cm-lintRange cm-lintRange-"+R+M,diagnostics:u.slice(),inclusiveEnd:u.some(I=>I.to>C)}))}if(f=C,f==g)break;for(let M=0;M{if(!(e&&a.diagnostics.indexOf(e)<0))if(!i)i=new C2(l,o,e||a.diagnostics[0]);else{if(a.diagnostics.indexOf(i.diagnostic)<0)return!1;i=new C2(i.from,o,i.diagnostic)}}),i}function AB(n,e){let t=e.pos,i=e.end||t,l=n.state.facet(wu).hideOn(n,t,i);if(l!=null)return l;let o=n.startState.doc.lineAt(e.pos);return!!(n.effects.some(a=>a.is(nA))||n.changes.touchesRange(o.from,Math.max(o.to,i)))}function EB(n,e){return n.field(Ai,!1)?e:e.concat(Ye.appendConfig.of(UB))}const nA=Ye.define(),tb=Ye.define(),iA=Ye.define(),Ai=In.define({create(){return new $s(He.none,null,null)},update(n,e){if(e.docChanged&&n.diagnostics.size){let t=n.diagnostics.map(e.changes),i=null,l=n.panel;if(n.selected){let o=e.changes.mapPos(n.selected.from,1);i=as(t,n.selected.diagnostic,o)||as(t,null,o)}!t.size&&l&&e.state.facet(wu).autoPanel&&(l=null),n=new $s(t,l,i)}for(let t of e.effects)if(t.is(nA)){let i=e.state.facet(wu).autoPanel?t.value.length?ku.open:null:n.panel;n=$s.init(t.value,i,e.state)}else t.is(tb)?n=new $s(n.diagnostics,t.value?ku.open:null,n.selected):t.is(iA)&&(n=new $s(n.diagnostics,n.panel,t.value));return n},provide:n=>[mu.from(n,e=>e.panel),Oe.decorations.from(n,e=>e.diagnostics)]}),MB=He.mark({class:"cm-lintRange cm-lintRange-active"});function DB(n,e,t){let{diagnostics:i}=n.state.field(Ai),l,o=-1,a=-1;i.between(e-(t<0?1:0),e+(t>0?1:0),(f,d,{spec:m})=>{if(e>=f&&e<=d&&(f==d||(e>f||t>0)&&(elA(n,t,!1)))}const RB=n=>{let e=n.state.field(Ai,!1);(!e||!e.panel)&&n.dispatch({effects:EB(n.state,[tb.of(!0)])});let t=tm(n,ku.open);return t&&t.dom.querySelector(".cm-panel-lint ul").focus(),!0},O2=n=>{let e=n.state.field(Ai,!1);return!e||!e.panel?!1:(n.dispatch({effects:tb.of(!1)}),!0)},_B=n=>{let e=n.state.field(Ai,!1);if(!e)return!1;let t=n.state.selection.main,i=as(e.diagnostics,null,t.to+1);return!i&&(i=as(e.diagnostics,null,0),!i||i.from==t.from&&i.to==t.to)?!1:(n.dispatch({selection:{anchor:i.from,head:i.to},scrollIntoView:!0}),A_(n,i.from,1,{tooltip:sA,until:l=>l.docChanged||l.newSelection.main.headi.to}),!0)},LB=[{key:"Mod-Shift-m",run:RB,preventDefault:!0},{key:"F8",run:_B}],wu=Ce.define({combine(n){return{sources:n.map(e=>e.source).filter(e=>e!=null),...Br(n.map(e=>e.config),{delay:750,markerFilter:null,tooltipFilter:null,needsRefresh:null,hideOn:()=>null},{delay:Math.max,markerFilter:N2,tooltipFilter:N2,needsRefresh:(e,t)=>e?t?i=>e(i)||t(i):e:t,hideOn:(e,t)=>e?t?(i,l,o)=>e(i,l,o)||t(i,l,o):e:t,autoPanel:(e,t)=>e||t})}}});function N2(n,e){return n?e?(t,i)=>e(n(t,i),i):n:e}function rA(n){let e=[];if(n)e:for(let{name:t}of n){for(let i=0;io.toLowerCase()==l.toLowerCase())){e.push(l);continue e}}e.push("")}return e}function lA(n,e,t){var i;let l=t?rA(e.actions):[];return Ct("li",{class:"cm-diagnostic cm-diagnostic-"+e.severity},Ct("span",{class:"cm-diagnosticText"},e.renderMessage?e.renderMessage(n):e.message),(i=e.actions)===null||i===void 0?void 0:i.map((o,a)=>{let u=!1,f=v=>{if(v.preventDefault(),u)return;u=!0;let w=as(n.state.field(Ai).diagnostics,e);w&&o.apply(n,w.from,w.to)},{name:d}=o,m=l[a]?d.indexOf(l[a]):-1,g=m<0?d:[d.slice(0,m),Ct("u",d.slice(m,m+1)),d.slice(m+1)],b=o.markClass?" "+o.markClass:"";return Ct("button",{type:"button",class:"cm-diagnosticAction"+b,onclick:f,onmousedown:f,"aria-label":` Action: ${d}${m<0?"":` (access key "${l[a]})"`}.`},g)}),e.source&&Ct("div",{class:"cm-diagnosticSource"},e.source))}class zB extends ul{constructor(e){super(),this.sev=e}eq(e){return e.sev==this.sev}toDOM(){return Ct("span",{class:"cm-lintPoint cm-lintPoint-"+this.sev})}}class T2{constructor(e,t){this.diagnostic=t,this.id="item_"+Math.floor(Math.random()*4294967295).toString(16),this.dom=lA(e,t,!0),this.dom.id=this.id,this.dom.setAttribute("role","option")}}class ku{constructor(e){this.view=e,this.items=[];let t=l=>{if(!(l.ctrlKey||l.altKey||l.metaKey)){if(l.keyCode==27)O2(this.view),this.view.focus();else if(l.keyCode==38||l.keyCode==33)this.moveSelection((this.selectedIndex-1+this.items.length)%this.items.length);else if(l.keyCode==40||l.keyCode==34)this.moveSelection((this.selectedIndex+1)%this.items.length);else if(l.keyCode==36)this.moveSelection(0);else if(l.keyCode==35)this.moveSelection(this.items.length-1);else if(l.keyCode==13)this.view.focus();else if(l.keyCode>=65&&l.keyCode<=90&&this.selectedIndex>=0){let{diagnostic:o}=this.items[this.selectedIndex],a=rA(o.actions);for(let u=0;u{for(let o=0;oO2(this.view)},"×")),this.update()}get selectedIndex(){let e=this.view.state.field(Ai).selected;if(!e)return-1;for(let t=0;t{for(let m of d.diagnostics){if(a.has(m))continue;a.add(m);let g=-1,b;for(let v=i;vi&&(this.items.splice(i,g-i),l=!0)),t&&b.diagnostic==t.diagnostic?b.dom.hasAttribute("aria-selected")||(b.dom.setAttribute("aria-selected","true"),o=b):b.dom.hasAttribute("aria-selected")&&b.dom.removeAttribute("aria-selected"),i++}});i({sel:o.dom.getBoundingClientRect(),panel:this.list.getBoundingClientRect()}),write:({sel:u,panel:f})=>{let d=f.height/this.list.offsetHeight;u.topf.bottom&&(this.list.scrollTop+=(u.bottom-f.bottom)/d)}})):this.selectedIndex<0&&this.list.removeAttribute("aria-activedescendant"),l&&this.sync()}sync(){let e=this.list.firstChild;function t(){let i=e;e=i.nextSibling,i.remove()}for(let i of this.items)if(i.dom.parentNode==this.list){for(;e!=i.dom;)t();e=i.dom.nextSibling}else this.list.insertBefore(i.dom,e);for(;e;)t()}moveSelection(e){if(this.selectedIndex<0)return;let t=this.view.state.field(Ai),i=as(t.diagnostics,this.items[e].diagnostic);i&&this.view.dispatch({selection:{anchor:i.from,head:i.to},scrollIntoView:!0,effects:iA.of(i)})}static open(e){return new ku(e)}}function BB(n,e='viewBox="0 0 40 40"'){return`url('data:image/svg+xml,${encodeURIComponent(n)}')`}function Lh(n){return BB(``,'width="6" height="3"')}const PB=Oe.baseTheme({".cm-diagnostic":{padding:"3px 6px 3px 8px",marginLeft:"-1px",display:"block",whiteSpace:"pre-wrap"},".cm-diagnostic-error":{borderLeft:"5px solid #d11"},".cm-diagnostic-warning":{borderLeft:"5px solid orange"},".cm-diagnostic-info":{borderLeft:"5px solid #999"},".cm-diagnostic-hint":{borderLeft:"5px solid #66d"},".cm-diagnosticAction":{font:"inherit",border:"none",padding:"2px 4px",backgroundColor:"#444",color:"white",borderRadius:"3px",marginLeft:"8px",cursor:"pointer"},".cm-diagnosticSource":{fontSize:"70%",opacity:.7},".cm-lintRange":{backgroundPosition:"left bottom",backgroundRepeat:"repeat-x",paddingBottom:"0.7px"},".cm-lintRange-error":{backgroundImage:Lh("#f11")},".cm-lintRange-warning":{backgroundImage:Lh("orange")},".cm-lintRange-info":{backgroundImage:Lh("#999")},".cm-lintRange-hint":{backgroundImage:Lh("#66d")},".cm-lintRange-active":{backgroundColor:"#ffdd9980"},".cm-tooltip-lint":{padding:0,margin:0},".cm-lintPoint":{position:"relative","&:after":{content:'""',position:"absolute",bottom:0,left:"-2px",borderLeft:"3px solid transparent",borderRight:"3px solid transparent",borderBottom:"4px solid #d11"}},".cm-lintPoint-warning":{"&:after":{borderBottomColor:"orange"}},".cm-lintPoint-info":{"&:after":{borderBottomColor:"#999"}},".cm-lintPoint-hint":{"&:after":{borderBottomColor:"#66d"}},".cm-panel.cm-panel-lint":{position:"relative","& ul":{maxHeight:"100px",overflowY:"auto","& [aria-selected]":{backgroundColor:"#ddd","& u":{textDecoration:"underline"}},"&:focus [aria-selected]":{background_fallback:"#bdf",backgroundColor:"Highlight",color_fallback:"white",color:"HighlightText"},"& u":{textDecoration:"none"},padding:0,margin:0},"& [name=close]":{position:"absolute",top:"0",right:"2px",background:"inherit",border:"none",font:"inherit",padding:0,margin:0}},"&dark .cm-lintRange-active":{backgroundColor:"#86714a80"},"&dark .cm-panel.cm-panel-lint ul":{"& [aria-selected]":{backgroundColor:"#2e343e"}}});function HB(n){return n=="error"?4:n=="warning"?3:n=="info"?2:1}function IB(n){let e="hint",t=1;for(let i of n){let l=HB(i.severity);l>t&&(t=l,e=i.severity)}return e}const sA=T_(DB,{hideOn:AB}),UB=[Ai,Oe.decorations.compute([Ai],n=>{let{selected:e,panel:t}=n.field(Ai);return!e||!t||e.from==e.to?He.none:He.set([MB.range(e.from,e.to)])}),sA,PB],FB=[F_(),Q_(),r_(),az(),_L(),XR(),ZR(),dt.allowMultipleSelections.of(!0),vL(),zL(HL,{fallback:!0}),XL(),pB(),NB(),g_(),b_(),u_(),x6(),_y.of([...bB,...h6,...P6,...xz,...ML,...tA,...LB])];var A2={};class Ld{constructor(e,t,i,l,o,a,u,f,d,m=0,g){this.p=e,this.stack=t,this.state=i,this.reducePos=l,this.pos=o,this.score=a,this.buffer=u,this.bufferBase=f,this.curContext=d,this.lookAhead=m,this.parent=g}toString(){return`[${this.stack.filter((e,t)=>t%3==0).concat(this.state)}]@${this.pos}${this.score?"!"+this.score:""}`}static start(e,t,i=0){let l=e.parser.context;return new Ld(e,[],t,i,i,0,[],0,l?new E2(l,l.start):null,0,null)}get context(){return this.curContext?this.curContext.context:null}pushState(e,t){this.stack.push(this.state,t,this.bufferBase+this.buffer.length),this.state=e}reduce(e){var t;let i=e>>19,l=e&65535,{parser:o}=this.p,a=this.reducePos=2e3&&!(!((t=this.p.parser.nodeSet.types[l])===null||t===void 0)&&t.isAnonymous)&&(d==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=m):this.p.lastBigReductionSizef;)this.stack.pop();this.reduceContext(l,d)}storeNode(e,t,i,l=4,o=!1){if(e==0&&(!this.stack.length||this.stack[this.stack.length-1]0&&this.buffer[a-4]==0&&this.buffer[a-1]>-1){if(t==i)return;if(this.buffer[a-2]>=t){this.buffer[a-2]=i;return}}}if(!o||this.pos==i)this.buffer.push(e,t,i,l);else{let a=this.buffer.length;if(a>0&&(this.buffer[a-4]!=0||this.buffer[a-1]<0)){let u=!1;for(let f=a;f>0&&this.buffer[f-2]>i;f-=4)if(this.buffer[f-1]>=0){u=!0;break}if(u)for(;a>0&&this.buffer[a-2]>i;)this.buffer[a]=this.buffer[a-4],this.buffer[a+1]=this.buffer[a-3],this.buffer[a+2]=this.buffer[a-2],this.buffer[a+3]=this.buffer[a-1],a-=4,l>4&&(l-=4)}this.buffer[a]=e,this.buffer[a+1]=t,this.buffer[a+2]=i,this.buffer[a+3]=l}}shift(e,t,i,l){if(e&131072)this.pushState(e&65535,this.pos);else if((e&262144)==0){let o=e,{parser:a}=this.p;this.pos=l;let u=a.stateFlag(o,1);!u&&(l>i||t<=a.maxNode)&&(this.reducePos=l),this.pushState(o,u?i:Math.min(i,this.reducePos)),this.shiftContext(t,i),t<=a.maxNode&&this.buffer.push(t,i,l,4)}else this.pos=l,this.shiftContext(t,i),t<=this.p.parser.maxNode&&this.buffer.push(t,i,l,4)}apply(e,t,i,l){e&65536?this.reduce(e):this.shift(e,t,i,l)}useNode(e,t,i){let l=this.p.reused.length-1;(l<0||this.p.reused[l]!=e)&&(this.p.reused.push(e),l++);let o=this.reducePos=this.pos=i+e.length;this.pushState(t,i),this.buffer.push(l,i,o,-1),this.curContext&&this.updateContext(this.curContext.tracker.reuse(this.curContext.context,e,this,this.p.stream.reset(this.pos-e.length)))}split(){let e=this,t=e.buffer.length;for(t&&e.buffer[t-4]==0&&(t-=4);t>0&&e.buffer[t-2]>e.reducePos;)t-=4;let i=e.buffer.slice(t),l=e.bufferBase+t;for(;e&&l==e.bufferBase;)e=e.parent;return new Ld(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,i,l,this.curContext,this.lookAhead,e)}recoverByDelete(e,t){let i=e<=this.p.parser.maxNode;i&&this.storeNode(e,this.pos,t,4),this.storeNode(0,this.pos,t,i?8:4),this.pos=this.reducePos=t,this.score-=190}canShift(e){for(let t=new qB(this);;){let i=this.p.parser.stateSlot(t.state,4)||this.p.parser.hasAction(t.state,e);if(i==0)return!1;if((i&65536)==0)return!0;t.reduce(i)}}recoverByInsert(e){if(this.stack.length>=300)return[];let t=this.p.parser.nextStates(this.state);if(t.length>8||this.stack.length>=120){let l=[];for(let o=0,a;of&1&&u==a)||l.push(t[o],a)}t=l}let i=[];for(let l=0;l>19,l=t&65535,o=this.stack.length-i*3;if(o<0||e.getGoto(this.stack[o],l,!1)<0){let a=this.findForcedReduction();if(a==null)return!1;t=a}this.storeNode(0,this.pos,this.pos,4,!0),this.score-=100}return this.reducePos=this.pos,this.reduce(t),!0}findForcedReduction(){let{parser:e}=this.p,t=[],i=(l,o)=>{if(!t.includes(l))return t.push(l),e.allActions(l,a=>{if(!(a&393216))if(a&65536){let u=(a>>19)-o;if(u>1){let f=a&65535,d=this.stack.length-u*3;if(d>=0&&e.getGoto(this.stack[d],f,!1)>=0)return u<<19|65536|f}}else{let u=i(a,o+1);if(u!=null)return u}})};return i(this.state,0)}forceAll(){for(;!this.p.parser.stateFlag(this.state,2);)if(!this.forceReduce()){this.storeNode(0,this.pos,this.pos,4,!0);break}return this}get deadEnd(){if(this.stack.length!=3)return!1;let{parser:e}=this.p;return e.data[e.stateSlot(this.state,1)]==65535&&!e.stateSlot(this.state,4)}restart(){this.storeNode(0,this.pos,this.pos,4,!0),this.state=this.stack[0],this.stack.length=0}sameState(e){if(this.state!=e.state||this.stack.length!=e.stack.length)return!1;for(let t=0;t0&&this.emitLookAhead()}}class E2{constructor(e,t){this.tracker=e,this.context=t,this.hash=e.strict?e.hash(t):0}}class qB{constructor(e){this.start=e,this.state=e.state,this.stack=e.stack,this.base=this.stack.length}reduce(e){let t=e&65535,i=e>>19;i==0?(this.stack==this.start.stack&&(this.stack=this.stack.slice()),this.stack.push(this.state,0,0),this.base+=3):this.base-=(i-1)*3;let l=this.start.p.parser.getGoto(this.stack[this.base-3],t,!0);this.state=l}}class zd{constructor(e,t,i){this.stack=e,this.pos=t,this.index=i,this.buffer=e.buffer,this.index==0&&this.maybeNext()}static create(e,t=e.bufferBase+e.buffer.length){return new zd(e,t,t-e.bufferBase)}maybeNext(){let e=this.stack.parent;e!=null&&(this.index=this.stack.bufferBase-e.bufferBase,this.stack=e,this.buffer=e.buffer)}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}next(){this.index-=4,this.pos-=4,this.index==0&&this.maybeNext()}fork(){return new zd(this.stack,this.pos,this.index)}}function zh(n,e=Uint16Array){if(typeof n!="string")return n;let t=null;for(let i=0,l=0;i=92&&a--,a>=34&&a--;let f=a-32;if(f>=46&&(f-=46,u=!0),o+=f,u)break;o*=46}t?t[l++]=o:t=new e(o)}return t}class ld{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}}const M2=new ld;class VB{constructor(e,t){this.input=e,this.ranges=t,this.chunk="",this.chunkOff=0,this.chunk2="",this.chunk2Pos=0,this.next=-1,this.token=M2,this.rangeIndex=0,this.pos=this.chunkPos=t[0].from,this.range=t[0],this.end=t[t.length-1].to,this.readNext()}resolveOffset(e,t){let i=this.range,l=this.rangeIndex,o=this.pos+e;for(;oi.to:o>=i.to;){if(l==this.ranges.length-1)return null;let a=this.ranges[++l];o+=a.from-i.to,i=a}return o}clipPos(e){if(e>=this.range.from&&ee)return Math.max(e,t.from);return this.end}peek(e){let t=this.chunkOff+e,i,l;if(t>=0&&t=this.chunk2Pos&&iu.to&&(this.chunk2=this.chunk2.slice(0,u.to-i)),l=this.chunk2.charCodeAt(0)}}return i>=this.token.lookAhead&&(this.token.lookAhead=i+1),l}acceptToken(e,t=0){let i=t?this.resolveOffset(t,-1):this.pos;if(i==null||i=this.chunk2Pos&&this.posthis.range.to?e.slice(0,this.range.to-this.pos):e,this.chunkPos=this.pos,this.chunkOff=0}}readNext(){return this.chunkOff>=this.chunk.length&&(this.getChunk(),this.chunkOff==this.chunk.length)?this.next=-1:this.next=this.chunk.charCodeAt(this.chunkOff)}advance(e=1){for(this.chunkOff+=e;this.pos+e>=this.range.to;){if(this.rangeIndex==this.ranges.length-1)return this.setDone();e-=this.range.to-this.pos,this.range=this.ranges[++this.rangeIndex],this.pos=this.range.from}return this.pos+=e,this.pos>=this.token.lookAhead&&(this.token.lookAhead=this.pos+1),this.readNext()}setDone(){return this.pos=this.chunkPos=this.end,this.range=this.ranges[this.rangeIndex=this.ranges.length-1],this.chunk="",this.next=-1}reset(e,t){if(t?(this.token=t,t.start=e,t.lookAhead=e+1,t.value=t.extended=-1):this.token=M2,this.pos!=e){if(this.pos=e,e==this.end)return this.setDone(),this;for(;e=this.range.to;)this.range=this.ranges[++this.rangeIndex];e>=this.chunkPos&&e=this.chunkPos&&t<=this.chunkPos+this.chunk.length)return this.chunk.slice(e-this.chunkPos,t-this.chunkPos);if(e>=this.chunk2Pos&&t<=this.chunk2Pos+this.chunk2.length)return this.chunk2.slice(e-this.chunk2Pos,t-this.chunk2Pos);if(e>=this.range.from&&t<=this.range.to)return this.input.read(e,t);let i="";for(let l of this.ranges){if(l.from>=t)break;l.to>e&&(i+=this.input.read(Math.max(l.from,e),Math.min(l.to,t)))}return i}}class ba{constructor(e,t){this.data=e,this.id=t}token(e,t){let{parser:i}=t.p;QB(this.data,e,t,this.id,i.data,i.tokenPrecTable)}}ba.prototype.contextual=ba.prototype.fallback=ba.prototype.extend=!1;ba.prototype.fallback=ba.prototype.extend=!1;class um{constructor(e,t={}){this.token=e,this.contextual=!!t.contextual,this.fallback=!!t.fallback,this.extend=!!t.extend}}function QB(n,e,t,i,l,o){let a=0,u=1<0){let w=n[v];if(f.allows(w)&&(e.token.value==-1||e.token.value==w||XB(w,e.token.value,l,o))){e.acceptToken(w);break}}let m=e.next,g=0,b=n[a+2];if(e.next<0&&b>g&&n[d+b*3-3]==65535){a=n[d+b*3-1];continue e}for(;g>1,w=d+v+(v<<1),S=n[w],C=n[w+1]||65536;if(m=C)g=v+1;else{a=n[w+2],e.advance();continue e}}break}}function D2(n,e,t){for(let i=e,l;(l=n[i])!=65535;i++)if(l==t)return i-e;return-1}function XB(n,e,t,i){let l=D2(t,i,e);return l<0||D2(t,i,n)e)&&!i.type.isError)return t<0?Math.max(0,Math.min(i.to-1,e-25)):Math.min(n.length,Math.max(i.from+1,e+25));if(t<0?i.prevSibling():i.nextSibling())break;if(!i.parent())return t<0?0:n.length}}class $B{constructor(e,t){this.fragments=e,this.minRepeat=t,this.i=0,this.fragment=null,this.safeFrom=-1,this.safeTo=-1,this.trees=[],this.start=[],this.index=[],this.lastRepeat=null,this.lastRepeatPos=-1,this.nextFragment()}nextFragment(){let e=this.fragment=this.i==this.fragments.length?null:this.fragments[this.i++];if(e){for(this.safeFrom=e.openStart?j2(e.tree,e.from+e.offset,1)-e.offset:e.from,this.safeTo=e.openEnd?j2(e.tree,e.to+e.offset,-1)-e.offset:e.to;this.trees.length;)this.trees.pop(),this.start.pop(),this.index.pop();this.trees.push(e.tree),this.start.push(-e.offset),this.index.push(0),this.nextStart=this.safeFrom}else this.nextStart=1e9}nodeAt(e){if(ee)return this.nextStart=a,null;if(o instanceof cn){let u=a>this.lastRepeatPos&&o.type.id>=this.minRepeat;if(a==e||u){let f=a+o.length,d;if(a>=this.safeFrom&&f<=this.safeTo&&(!(d=o.prop(Je.lookAhead))||f+d=Math.max(this.safeFrom,e)&&(this.trees.push(o),this.start.push(a),this.index.push(0))}else this.index[t]++,this.nextStart=a+o.length}}}class YB{constructor(e,t){this.stream=t,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=e.tokenizers.map(i=>new ld)}getActions(e){let t=0,i=null,{parser:l}=e.p,{tokenizers:o}=l,a=l.stateSlot(e.state,3),u=e.curContext?e.curContext.hash:0,f=0;for(let d=0;dg.end+25&&(f=Math.max(g.lookAhead,f)),g.value!=0)){let b=t;if(g.extended>-1&&(t=this.addActions(e,g.extended,g.end,t)),t=this.addActions(e,g.value,g.end,t),!m.extend&&(i=g,t>b))break}}for(;this.actions.length>t;)this.actions.pop();return f&&e.setLookAhead(f),!i&&e.pos==this.stream.end&&(i=new ld,i.value=e.p.parser.eofTerm,i.start=i.end=e.pos,t=this.addActions(e,i.value,i.end,t)),this.mainToken=i,this.actions}getMainToken(e){if(this.mainToken)return this.mainToken;let t=new ld,{pos:i,p:l}=e;return t.start=i,t.end=Math.min(i+1,l.stream.end),t.value=i==l.stream.end?l.parser.eofTerm:0,t}updateCachedToken(e,t,i){let l=this.stream.clipPos(i.pos);if(t.token(this.stream.reset(l,e),i),e.value>-1){let{parser:o}=i.p;for(let a=0;a=0&&i.p.parser.dialect.allows(u>>1)){(u&1)==0?e.value=u>>1:e.extended=u>>1;break}}}else e.value=0,e.end=this.stream.clipPos(l+1)}putAction(e,t,i,l){for(let o=0;oe.bufferLength*4?new $B(i,e.minRepeatTerm):null}get parsedPos(){return this.minStackPos}advance(){let e=this.stacks,t=this.minStackPos,i=this.stacks=[],l,o;if(this.bigReductionCount>300&&e.length==1){let[a]=e;for(;a.forceReduce()&&a.stack.length&&a.stack[a.stack.length-2]>=this.lastBigReductionStart;);this.bigReductionCount=this.lastBigReductionSize=0}for(let a=0;at)i.push(u);else{if(this.advanceStack(u,i,e))continue;{l||(l=[],o=[]),l.push(u);let f=this.tokens.getMainToken(u);o.push(f.value,f.end)}}break}}if(!i.length){let a=l&&ZB(l);if(a)return Oi&&console.log("Finish with "+this.stackID(a)),this.stackToTree(a);if(this.parser.strict)throw Oi&&l&&console.log("Stuck with token "+(this.tokens.mainToken?this.parser.getName(this.tokens.mainToken.value):"none")),new SyntaxError("No parse at "+t);this.recovering||(this.recovering=5)}if(this.recovering&&l){let a=this.stoppedAt!=null&&l[0].pos>this.stoppedAt?l[0]:this.runRecovery(l,o,i);if(a)return Oi&&console.log("Force-finish "+this.stackID(a)),this.stackToTree(a.forceAll())}if(this.recovering){let a=this.recovering==1?1:this.recovering*3;if(i.length>a)for(i.sort((u,f)=>f.score-u.score);i.length>a;)i.pop();i.some(u=>u.reducePos>t)&&this.recovering--}else if(i.length>1){e:for(let a=0;a500&&d.buffer.length>500)if((u.score-d.score||u.buffer.length-d.buffer.length)>0)i.splice(f--,1);else{i.splice(a--,1);continue e}}}i.length>12&&(i.sort((a,u)=>u.score-a.score),i.splice(12,i.length-12))}this.minStackPos=i[0].pos;for(let a=1;a-1&&i.length&&(!o||(i.prop(Je.contextHash)||0)==a))return e.useNode(i,u,t),i;if(i.children.length==0||i.positions[0]>0)break;let f=i.children[0];if(f instanceof cn&&(!l||f.type.id>=this.parser.minRepeatTerm))i=f;else break}return null}advanceStack(e,t,i){let l=e.pos,{parser:o}=this,a=Oi?this.stackID(e)+" -> ":"";if(this.stoppedAt!=null&&l>this.stoppedAt)return e.forceReduce()?e:null;if(this.fragments){let d=e.reducePos0)return e.reduce(u),Oi&&console.log(a+this.stackID(e)+` (via always-reduce ${o.getName(u&65535)})`),!0;if(e.stack.length>=8400)for(;e.stack.length>6e3&&e.forceReduce(););let f=this.tokens.getActions(e);for(let d=0;dl?t.push(w):i.push(w)}return!1}advanceFully(e,t){let i=e.pos;for(;;){if(!this.advanceStack(e,null,null))return!1;if(e.pos>i)return R2(e,t),!0}}runRecovery(e,t,i){let l=null,o=!1;for(let a=0;a ":"";if(u.deadEnd&&(o||(o=!0,u.restart(),Oi&&console.log(m+this.stackID(u)+" (restarted)"),this.advanceFully(u,i))))continue;let g=u.split(),b=m;for(let v=0;v<10&&g.forceReduce()&&(Oi&&console.log(b+this.stackID(g)+" (via force-reduce)"),!this.advanceFully(g,i));v++)Oi&&(b=this.stackID(g)+" -> ");for(let v of u.recoverByInsert(f))Oi&&console.log(m+this.stackID(v)+" (via recover-insert)"),this.advanceFully(v,i);this.stream.end>u.pos?(d==u.pos&&(d++,f=0),u.recoverByDelete(f,d),Oi&&console.log(m+this.stackID(u)+` (via recover-delete ${this.parser.getName(f)})`),R2(u,i)):(!l||l.scoren;class WB{constructor(e){this.start=e.start,this.shift=e.shift||T0,this.reduce=e.reduce||T0,this.reuse=e.reuse||T0,this.hash=e.hash||(()=>0),this.strict=e.strict!==!1}}class Bd extends UN{constructor(e){if(super(),this.wrappers=[],e.version!=14)throw new RangeError(`Parser version (${e.version}) doesn't match runtime version (14)`);let t=e.nodeNames.split(" ");this.minRepeatTerm=t.length;for(let u=0;ue.topRules[u][1]),l=[];for(let u=0;u=0)o(m,f,u[d++]);else{let g=u[d+-m];for(let b=-m;b>0;b--)o(u[d++],f,g);d++}}}this.nodeSet=new By(t.map((u,f)=>pi.define({name:f>=this.minRepeatTerm?void 0:u,id:f,props:l[f],top:i.indexOf(f)>-1,error:f==0,skipped:e.skippedNodes&&e.skippedNodes.indexOf(f)>-1}))),e.propSources&&(this.nodeSet=this.nodeSet.extend(...e.propSources)),this.strict=!1,this.bufferLength=BN;let a=zh(e.tokenData);this.context=e.context,this.specializerSpecs=e.specialized||[],this.specialized=new Uint16Array(this.specializerSpecs.length);for(let u=0;utypeof u=="number"?new ba(a,u):u),this.topRules=e.topRules,this.dialects=e.dialects||{},this.dynamicPrecedences=e.dynamicPrecedences||null,this.tokenPrecTable=e.tokenPrec,this.termNames=e.termNames||null,this.maxNode=this.nodeSet.types.length-1,this.dialect=this.parseDialect(),this.top=this.topRules[Object.keys(this.topRules)[0]]}createParse(e,t,i){let l=new GB(this,e,t,i);for(let o of this.wrappers)l=o(l,e,t,i);return l}getGoto(e,t,i=!1){let l=this.goto;if(t>=l[0])return-1;for(let o=l[t+1];;){let a=l[o++],u=a&1,f=l[o++];if(u&&i)return f;for(let d=o+(a>>1);o0}validAction(e,t){return!!this.allActions(e,i=>i==t?!0:null)}allActions(e,t){let i=this.stateSlot(e,4),l=i?t(i):void 0;for(let o=this.stateSlot(e,1);l==null;o+=3){if(this.data[o]==65535)if(this.data[o+1]==1)o=nl(this.data,o+2);else break;l=t(nl(this.data,o+1))}return l}nextStates(e){let t=[];for(let i=this.stateSlot(e,1);;i+=3){if(this.data[i]==65535)if(this.data[i+1]==1)i=nl(this.data,i+2);else break;if((this.data[i+2]&1)==0){let l=this.data[i+1];t.some((o,a)=>a&1&&o==l)||t.push(this.data[i],l)}}return t}configure(e){let t=Object.assign(Object.create(Bd.prototype),this);if(e.props&&(t.nodeSet=this.nodeSet.extend(...e.props)),e.top){let i=this.topRules[e.top];if(!i)throw new RangeError(`Invalid top rule name ${e.top}`);t.top=i}return e.tokenizers&&(t.tokenizers=this.tokenizers.map(i=>{let l=e.tokenizers.find(o=>o.from==i);return l?l.to:i})),e.specializers&&(t.specializers=this.specializers.slice(),t.specializerSpecs=this.specializerSpecs.map((i,l)=>{let o=e.specializers.find(u=>u.from==i.external);if(!o)return i;let a=Object.assign(Object.assign({},i),{external:o.to});return t.specializers[l]=_2(a),a})),e.contextTracker&&(t.context=e.contextTracker),e.dialect&&(t.dialect=this.parseDialect(e.dialect)),e.strict!=null&&(t.strict=e.strict),e.wrap&&(t.wrappers=t.wrappers.concat(e.wrap)),e.bufferLength!=null&&(t.bufferLength=e.bufferLength),t}hasWrappers(){return this.wrappers.length>0}getName(e){return this.termNames?this.termNames[e]:String(e<=this.maxNode&&this.nodeSet.types[e].name||e)}get eofTerm(){return this.maxNode+1}get topNode(){return this.nodeSet.types[this.top[1]]}dynamicPrecedence(e){let t=this.dynamicPrecedences;return t==null?0:t[e]||0}parseDialect(e){let t=Object.keys(this.dialects),i=t.map(()=>!1);if(e)for(let o of e.split(" ")){let a=t.indexOf(o);a>=0&&(i[a]=!0)}let l=null;for(let o=0;oi)&&t.p.parser.stateFlag(t.state,2)&&(!e||e.scoren.external(t,i)<<1|e}return n.get}const ra=63,L2=64,JB=1,e9=2,oA=3,t9=4,aA=5,n9=6,i9=7,cA=65,r9=66,l9=8,s9=9,o9=10,a9=11,c9=12,uA=13,u9=19,f9=20,h9=29,d9=33,m9=34,p9=47,g9=0,nb=1,Yx=2,Su=3,Gx=4;class Ys{constructor(e,t,i){this.parent=e,this.depth=t,this.type=i,this.hash=(e?e.hash+e.hash<<8:0)+t+(t<<4)+i}}Ys.top=new Ys(null,-1,g9);function iu(n,e){for(let t=0,i=e-n.pos-1;;i--,t++){let l=n.peek(i);if(al(l)||l==-1)return t}}function Kx(n){return n==32||n==9}function al(n){return n==10||n==13}function fA(n){return Kx(n)||al(n)}function Ws(n){return n<0||fA(n)}const x9=new WB({start:Ys.top,reduce(n,e){return n.type==Su&&(e==f9||e==m9)?n.parent:n},shift(n,e,t,i){if(e==oA)return new Ys(n,iu(i,i.pos),nb);if(e==cA||e==aA)return new Ys(n,iu(i,i.pos),Yx);if(e==ra)return n.parent;if(e==u9||e==d9)return new Ys(n,0,Su);if(e==uA&&n.type==Gx)return n.parent;if(e==p9){let l=/[1-9]/.exec(i.read(i.pos,t.pos));if(l)return new Ys(n,n.depth+ +l[0],Gx)}return n},hash(n){return n.hash}});function ja(n,e,t=0){return n.peek(t)==e&&n.peek(t+1)==e&&n.peek(t+2)==e&&Ws(n.peek(t+3))}const y9=new um((n,e)=>{if(n.next==-1&&e.canShift(L2))return n.acceptToken(L2);let t=n.peek(-1);if((al(t)||t<0)&&e.context.type!=Su){if(ja(n,45))if(e.canShift(ra))n.acceptToken(ra);else return n.acceptToken(JB,3);if(ja(n,46))if(e.canShift(ra))n.acceptToken(ra);else return n.acceptToken(e9,3);let i=0;for(;n.next==32;)i++,n.advance();(i{if(e.context.type==Su){n.next==63&&(n.advance(),Ws(n.next)&&n.acceptToken(i9));return}if(n.next==45)n.advance(),Ws(n.next)&&n.acceptToken(e.context.type==nb&&e.context.depth==iu(n,n.pos-1)?t9:oA);else if(n.next==63)n.advance(),Ws(n.next)&&n.acceptToken(e.context.type==Yx&&e.context.depth==iu(n,n.pos-1)?n9:aA);else{let t=n.pos;for(;;)if(Kx(n.next)){if(n.pos==t)return;n.advance()}else if(n.next==33)hA(n);else if(n.next==38)Wx(n);else if(n.next==42){Wx(n);break}else if(n.next==39||n.next==34){if(ib(n,!0))break;return}else if(n.next==91||n.next==123){if(!w9(n))return;break}else{dA(n,!0,!1,0);break}for(;Kx(n.next);)n.advance();if(n.next==58){if(n.pos==t&&e.canShift(h9))return;let i=n.peek(1);Ws(i)&&n.acceptTokenTo(e.context.type==Yx&&e.context.depth==iu(n,t)?r9:cA,t)}}},{contextual:!0});function v9(n){return n>32&&n<127&&n!=34&&n!=37&&n!=44&&n!=60&&n!=62&&n!=92&&n!=94&&n!=96&&n!=123&&n!=124&&n!=125}function z2(n){return n>=48&&n<=57||n>=97&&n<=102||n>=65&&n<=70}function B2(n,e){return n.next==37?(n.advance(),z2(n.next)&&n.advance(),z2(n.next)&&n.advance(),!0):v9(n.next)||e&&n.next==44?(n.advance(),!0):!1}function hA(n){if(n.advance(),n.next==60){for(n.advance();;)if(!B2(n,!0)){n.next==62&&n.advance();break}}else for(;B2(n,!1););}function Wx(n){for(n.advance();!Ws(n.next)&&Pd(n.next)!="f";)n.advance()}function ib(n,e){let t=n.next,i=!1,l=n.pos;for(n.advance();;){let o=n.next;if(o<0)break;if(n.advance(),o==t)if(o==39)if(n.next==39)n.advance();else break;else break;else if(o==92&&t==34)n.next>=0&&n.advance();else if(al(o)){if(e)return!1;i=!0}else if(e&&n.pos>=l+1024)return!1}return!i}function w9(n){for(let e=[],t=n.pos+1024;;)if(n.next==91||n.next==123)e.push(n.next),n.advance();else if(n.next==39||n.next==34){if(!ib(n,!0))return!1}else if(n.next==93||n.next==125){if(e[e.length-1]!=n.next-2)return!1;if(e.pop(),n.advance(),!e.length)return!0}else{if(n.next<0||n.pos>t||al(n.next))return!1;n.advance()}}const k9="iiisiiissisfissssssssssssisssiiissssssssssssssssssssssssssfsfssissssssssssssssssssssssssssfif";function Pd(n){return n<33?"u":n>125?"s":k9[n-33]}function A0(n,e){let t=Pd(n);return t!="u"&&!(e&&t=="f")}function dA(n,e,t,i){if(Pd(n.next)=="s"||(n.next==63||n.next==58||n.next==45)&&A0(n.peek(1),t))n.advance();else return!1;let l=n.pos;for(;;){let o=n.next,a=0,u=i+1;for(;fA(o);){if(al(o)){if(e)return!1;u=0}else u++;o=n.peek(++a)}if(!(o>=0&&(o==58?A0(n.peek(a+1),t):o==35?n.peek(a-1)!=32:A0(o,t)))||!t&&u<=i||u==0&&!t&&(ja(n,45,a)||ja(n,46,a)))break;if(e&&Pd(o)=="f")return!1;for(let d=a;d>=0;d--)n.advance();if(e&&n.pos>l+1024)return!1}return!0}const S9=new um((n,e)=>{if(n.next==33)hA(n),n.acceptToken(c9);else if(n.next==38||n.next==42){let t=n.next==38?o9:a9;Wx(n),n.acceptToken(t)}else n.next==39||n.next==34?(ib(n,!1),n.acceptToken(s9)):dA(n,!1,e.context.type==Su,e.context.depth)&&n.acceptToken(l9)}),C9=new um((n,e)=>{let t=e.context.type==Gx?e.context.depth:-1,i=n.pos;e:for(;;){let l=0,o=n.next;for(;o==32;)o=n.peek(++l);if(!l&&(ja(n,45,l)||ja(n,46,l))||!al(o)&&(t<0&&(t=Math.max(e.context.depth+1,l)),lYAN>Y",stateData:";S~O!fOS!gOS^OS~OP_OQbORSOTUOWROXROYYOZZO[XOcPOqQO!PVO!V[O!cTO~O`cO~P]OVkOWROXROYeOZfO[dOcPOmhOqQO~OboO~P!bOVtOWROXROYeOZfO[dOcPOmrOqQO~OpwO~P#WORSOTUOWROXROYYOZZO[XOcPOqQO!PVO!cTO~OSvP!avP!bvP~P#|OWROXROYeOZfO[dOcPOqQO~OmzO~P%OOm!OOUzP!azP!bzP!dzP~P#|O^!SO!b!QO!f!TO!g!RO~ORSOTUOWROXROcPOqQO!PVO!cTO~OY!UOP!QXQ!QX!V!QX!`!QXS!QX!a!QX!b!QXU!QXm!QX!d!QX~P&aO[!WOP!SXQ!SX!V!SX!`!SXS!SX!a!SX!b!SXU!SXm!SX!d!SX~P&aO^!ZO!W![O!b!YO!f!]O!g!YO~OP!_O!V[OQaX!`aX~OPaXQaX!VaX!`aX~P#|OP!bOQ!cO!V[O~OP_O!V[O~P#|OWROXROY!fOcPOqQObfXmfXofXpfX~OWROXRO[!hOcPOqQObhXmhXohXphX~ObeXmlXoeX~ObkXokX~P%OOm!kO~Om!lObnPonP~P%OOb!pOo!oO~Ob!pO~P!bOm!sOosXpsX~OosXpsX~P%OOm!uOotPptP~P%OOo!xOp!yO~Op!yO~P#WOS!|O!a#OO!b#OO~OUyX!ayX!byX!dyX~P#|Om#QO~OU#SO!a#UO!b#UO!d#RO~Om#WOUzX!azX!bzX!dzX~O]#XO~O!b#XO!g#YO~O^#ZO!b#XO!g#YO~OP!RXQ!RX!V!RX!`!RXS!RX!a!RX!b!RXU!RXm!RX!d!RX~P&aOP!TXQ!TX!V!TX!`!TXS!TX!a!TX!b!TXU!TXm!TX!d!TX~P&aO!b#^O!g#^O~O^#_O!b#^O!f#`O!g#^O~O^#_O!W#aO!b#^O!g#^O~OPaaQaa!Vaa!`aa~P#|OP#cO!V[OQ!XX!`!XX~OP!XXQ!XX!V!XX!`!XX~P#|OP_O!V[OQ!_X!`!_X~P#|OWROXROcPOqQObgXmgXogXpgX~OWROXROcPOqQObiXmiXoiXpiX~Obkaoka~P%OObnXonX~P%OOm#kO~Ob#lOo!oO~Oosapsa~P%OOotXptX~P%OOm#pO~Oo!xOp#qO~OSwP!awP!bwP~P#|OS!|O!a#vO!b#vO~OUya!aya!bya!dya~P#|Om#xO~P%OOm#{OU}P!a}P!b}P!d}P~P#|OU#SO!a$OO!b$OO!d#RO~O]$QO~O!b$QO!g$RO~O!b$SO!g$SO~O^$TO!b$SO!g$SO~O^$TO!b$SO!f$UO!g$SO~OP!XaQ!Xa!V!Xa!`!Xa~P#|Obnaona~P%OOotapta~P%OOo!xO~OU|X!a|X!b|X!d|X~P#|Om$ZO~Om$]OU}X!a}X!b}X!d}X~O]$^O~O!b$_O!g$_O~O^$`O!b$_O!g$_O~OU|a!a|a!b|a!d|a~P#|O!b$cO!g$cO~O",goto:",]!mPPPPPPPPPPPPPPPPP!nPP!v#v#|$`#|$c$f$j$nP%VPPP!v%Y%^%a%{&O%a&R&U&X&_&b%aP&e&{&e'O'RPP']'a'g'm's'y(XPPPPPPPP(_)e*X+c,VUaObcR#e!c!{ROPQSTUXY_bcdehknrtvz!O!U!W!_!b!c!f!h!k!l!s!u!|#Q#R#S#W#c#k#p#x#{$Z$]QmPR!qnqfPQThknrtv!k!l!s!u#R#k#pR!gdR!ieTlPnTjPnSiPnSqQvQ{TQ!mkQ!trQ!vtR#y#RR!nkTsQvR!wt!RWOSUXY_bcz!O!U!W!_!b!c!|#Q#S#W#c#x#{$Z$]RySR#t!|R|TR|UQ!PUR#|#SR#z#RR#z#SyZOSU_bcz!O!_!b!c!|#Q#S#W#c#x#{$Z$]R!VXR!XYa]O^abc!a!c!eT!da!eQnPR!rnQvQR!{vQ!}yR#u!}Q#T|R#}#TW^Obc!cS!^^!aT!aa!eQ!eaR#f!eW`Obc!cQxSS}U#SQ!`_Q#PzQ#V!OQ#b!_Q#d!bQ#s!|Q#w#QQ$P#WQ$V#cQ$Y#xQ$[#{Q$a$ZR$b$]xZOSU_bcz!O!_!b!c!|#Q#S#W#c#x#{$Z$]Q!VXQ!XYQ#[!UR#]!W!QWOSUXY_bcz!O!U!W!_!b!c!|#Q#S#W#c#x#{$Z$]pfPQThknrtv!k!l!s!u#R#k#pQ!gdQ!ieQ#g!fR#h!hSgPn^pQTkrtv#RQ!jhQ#i!kQ#j!lQ#n!sQ#o!uQ$W#kR$X#pQuQR!zv",nodeNames:"⚠ DirectiveEnd DocEnd - - ? ? ? Literal QuotedLiteral Anchor Alias Tag BlockLiteralContent Comment Stream BOM Document ] [ FlowSequence Item Tagged Anchored Anchored Tagged FlowMapping Pair Key : Pair , } { FlowMapping Pair Pair BlockSequence Item Item BlockMapping Pair Pair Key Pair Pair BlockLiteral BlockLiteralHeader Tagged Anchored Anchored Tagged Directive DirectiveName DirectiveContent Document",maxTerm:74,context:x9,nodeProps:[["isolate",-3,8,9,14,""],["openedBy",18,"[",32,"{"],["closedBy",19,"]",33,"}"]],propSources:[O9],skippedNodes:[0],repeatNodeCount:6,tokenData:"-Y~RnOX#PXY$QYZ$]Z]#P]^$]^p#Ppq$Qqs#Pst$btu#Puv$yv|#P|}&e}![#P![!]'O!]!`#P!`!a'i!a!}#P!}#O*g#O#P#P#P#Q+Q#Q#o#P#o#p+k#p#q'i#q#r,U#r;'S#P;'S;=`#z<%l?HT#P?HT?HU,o?HUO#PQ#UU!WQOY#PZp#Ppq#hq;'S#P;'S;=`#z<%lO#PQ#kTOY#PZs#Pt;'S#P;'S;=`#z<%lO#PQ#}P;=`<%l#P~$VQ!f~XY$Qpq$Q~$bO!g~~$gS^~OY$bZ;'S$b;'S;=`$s<%lO$b~$vP;=`<%l$bR%OX!WQOX%kXY#PZ]%k]^#P^p%kpq#hq;'S%k;'S;=`&_<%lO%kR%rX!WQ!VPOX%kXY#PZ]%k]^#P^p%kpq#hq;'S%k;'S;=`&_<%lO%kR&bP;=`<%l%kR&lUoP!WQOY#PZp#Ppq#hq;'S#P;'S;=`#z<%lO#PR'VUmP!WQOY#PZp#Ppq#hq;'S#P;'S;=`#z<%lO#PR'p[!PP!WQOY#PZp#Ppq#hq{#P{|(f|}#P}!O(f!O!R#P!R![)p![;'S#P;'S;=`#z<%lO#PR(mW!PP!WQOY#PZp#Ppq#hq!R#P!R![)V![;'S#P;'S;=`#z<%lO#PR)^U!PP!WQOY#PZp#Ppq#hq;'S#P;'S;=`#z<%lO#PR)wY!PP!WQOY#PZp#Ppq#hq{#P{|)V|}#P}!O)V!O;'S#P;'S;=`#z<%lO#PR*nUcP!WQOY#PZp#Ppq#hq;'S#P;'S;=`#z<%lO#PR+XUbP!WQOY#PZp#Ppq#hq;'S#P;'S;=`#z<%lO#PR+rUqP!WQOY#PZp#Ppq#hq;'S#P;'S;=`#z<%lO#PR,]UpP!WQOY#PZp#Ppq#hq;'S#P;'S;=`#z<%lO#PR,vU`P!WQOY#PZp#Ppq#hq;'S#P;'S;=`#z<%lO#P",tokenizers:[y9,b9,S9,C9,0,1],topRules:{Stream:[0,15]},tokenPrec:0}),T9=kd.define({name:"yaml",parser:N9.configure({props:[XN.add({Stream:n=>{for(let e=n.node.resolve(n.pos,-1);e&&e.to>=n.pos;e=e.parent){if(e.name=="BlockLiteralContent"&&e.fromn.pos)return null}}return null},FlowMapping:ZS({closing:"}"}),FlowSequence:ZS({closing:"]"})}),GN.add({"FlowMapping FlowSequence":kL,"Item Pair BlockLiteral":(n,e)=>({from:e.doc.lineAt(n.from).to,to:n.to})})]}),languageData:{commentTokens:{line:"#"},indentOnInput:/^\s*[\]\}]$/}});function A9(){return new fL(T9)}const P2='button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), a[href], video[tabindex], [tabindex]:not([tabindex="-1"])';function hs({isOpen:n,onClose:e,dialogRef:t,initialFocusRef:i}){return D.useEffect(()=>{if(!n)return;const l=document.activeElement instanceof HTMLElement?document.activeElement:null,o=requestAnimationFrame(()=>{var f;const u=(i==null?void 0:i.current)??((f=t.current)==null?void 0:f.querySelector(P2))??t.current;u==null||u.focus()}),a=u=>{if(u.key!=="Tab")return;const f=t.current;if(!f)return;const d=Array.from(f.querySelectorAll(P2));if(!d.length)return;const m=d[0],g=d[d.length-1],b=document.activeElement;if(!(b instanceof Node&&f.contains(b))){u.preventDefault(),(u.shiftKey?g:m).focus();return}u.shiftKey&&(b===m||b===f)?(u.preventDefault(),g.focus()):!u.shiftKey&&(b===g||b===f)&&(u.preventDefault(),m.focus())};return window.addEventListener("keydown",a,!0),()=>{cancelAnimationFrame(o),l==null||l.focus(),window.removeEventListener("keydown",a,!0)}},[n]),l=>{l.key==="Escape"&&(l.preventDefault(),l.stopPropagation(),e())}}function va({isOpen:n,title:e,message:t,confirmLabel:i="Confirm",cancelLabel:l="Cancel",danger:o=!1,onConfirm:a,onCancel:u}){const f=D.useRef(null),d=D.useRef(null),m=hs({isOpen:n,onClose:u,dialogRef:f,initialFocusRef:d});return n?y.jsx("div",{className:"animate-overlay-in fixed inset-0 z-[var(--z-modal)] flex items-center justify-center bg-black/60 p-4 backdrop-blur-sm",onClick:u,children:y.jsxs("div",{ref:f,role:"dialog","aria-modal":"true","aria-labelledby":"confirm-dialog-title",onKeyDown:m,onClick:g=>g.stopPropagation(),className:"animate-modal-in w-[400px] max-w-full rounded-2xl border border-frame-line glass-panel p-5",children:[y.jsxs("div",{className:"mb-3 flex items-center gap-2.5",children:[y.jsx("span",{className:`grid h-9 w-9 shrink-0 place-items-center rounded-lg ${o?"bg-status-danger-bg text-status-danger-text":"bg-chip-indigo-bg text-chip-indigo-text"}`,children:y.jsx(yy,{className:"h-5 w-5"})}),y.jsx("h2",{id:"confirm-dialog-title",className:"text-sm font-semibold text-ink",children:e})]}),y.jsx("div",{className:"mb-5 whitespace-pre-line text-xs text-ink-secondary",children:t}),y.jsxs("div",{className:"flex justify-end gap-2",children:[y.jsx("button",{ref:d,type:"button",onClick:u,className:"min-h-9 rounded-lg border border-line bg-elevated px-3.5 text-sm text-ink-secondary transition-colors hover:bg-surface-strong hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-indigo-400",children:l}),y.jsx("button",{type:"button",onClick:a,className:`min-h-9 rounded-lg border px-4 text-sm font-semibold transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-indigo-400 ${o?"border-status-danger-border bg-status-danger-bg/30 text-status-danger-text hover:bg-status-danger-bg/60":"btn-primary border-transparent bg-indigo-600 text-white hover:bg-indigo-500"}`,children:i})]})]})}):null}var E9=XC();const Tr=8,Zl=8,M9=400,H2={top:"bottom",bottom:"top",left:"right",right:"left"},D9={top:"-bottom-1 left-1/2 -translate-x-1/2",bottom:"-top-1 left-1/2 -translate-x-1/2",left:"-right-1 top-1/2 -translate-y-1/2",right:"-left-1 top-1/2 -translate-y-1/2"},j9={top:"border-b border-r",bottom:"border-t border-l",left:"border-t border-r",right:"border-b border-l"},I2=(n,e,t)=>{switch(n){case"top":return e.top-Zl-t.h>=Tr;case"bottom":return e.bottom+Zl+t.h<=window.innerHeight-Tr;case"left":return e.left-Zl-t.w>=Tr;default:return e.right+Zl+t.w<=window.innerWidth-Tr}},R9=(n,e,t)=>{if(n==="top"||n==="bottom"){const a=e.left+e.width/2-t.w/2,u=window.innerWidth-t.w-Tr;return{x:Math.min(Math.max(a,Tr),Math.max(Tr,u))-a,y:0}}const i=e.top+e.height/2-t.h/2,l=window.innerHeight-t.h-Tr;return{x:0,y:Math.min(Math.max(i,Tr),Math.max(Tr,l))-i}},Qe=({text:n,children:e,block:t=!0,placement:i="top",suppress:l=!1})=>{const o=D.useRef(null),a=D.useRef(null),u=D.useId(),f=D.useRef(null),[d,m]=D.useState(!1),[g,b]=D.useState(i),[v,w]=D.useState({x:0,y:0}),[S,C]=D.useState({left:-9999,top:-9999}),N=()=>{f.current!==null&&(window.clearTimeout(f.current),f.current=null)};D.useEffect(()=>{l&&(N(),m(!1))},[l]),D.useEffect(()=>()=>N(),[]);const R=D.useCallback(()=>{const E=o.current,T=a.current;if(!E||!T)return;const z=E.getBoundingClientRect(),ie={w:T.offsetWidth,h:T.offsetHeight},q=I2(i,z,ie)?i:I2(H2[i],z,ie)?H2[i]:i,J=R9(q,z,ie);b(q),w(J);const F=z.left+z.width/2,se=z.top+z.height/2;C(q==="top"?{left:F,top:z.top-Zl-ie.h}:q==="bottom"?{left:F,top:z.bottom+Zl}:q==="left"?{left:z.left-Zl-ie.w,top:se}:{left:z.right+Zl,top:se})},[i]);D.useEffect(()=>{if(!d)return;const E=()=>m(!1);return window.addEventListener("resize",E),window.addEventListener("scroll",E,!0),()=>{window.removeEventListener("resize",E),window.removeEventListener("scroll",E,!0)}},[d]);const M=E=>{if(l)return;N();const T=()=>{R(),m(!0)};E?T():f.current=window.setTimeout(T,M9)},I=()=>{N(),m(!1)};D.useEffect(()=>{if(!d)return;const E=T=>{T.key==="Escape"&&m(!1)};return document.addEventListener("keydown",E,!0),()=>document.removeEventListener("keydown",E,!0)},[d]),D.useEffect(()=>{if(!d)return;const E=()=>!!document.querySelector('[role="dialog"][aria-modal="true"], dialog[open]');if(E()){m(!1);return}const T=new MutationObserver(()=>{E()&&m(!1)});return T.observe(document.body,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["role","aria-modal","open","class"]}),()=>T.disconnect()},[d]);const U={onMouseEnter:()=>M(!1),onMouseLeave:I,onFocus:()=>M(!0),onBlur:I,"aria-describedby":u};return y.jsxs("div",{ref:o,className:`group relative ${t?"flex min-w-0 flex-1 items-center":"inline-flex shrink-0 items-center"}`,onMouseEnter:()=>M(!1),onMouseLeave:I,onFocus:()=>M(!0),onBlur:I,children:[D.cloneElement(e,U),E9.createPortal(y.jsxs("span",{ref:a,id:u,role:"tooltip",className:`pointer-events-none invisible fixed z-[var(--z-tooltip)] w-max max-w-[calc(100vw-16px)] rounded-md border border-line bg-elevated px-2 py-1 text-left text-[11px] leading-relaxed text-ink shadow-lg ${d?"visible opacity-100":"opacity-0"}`,style:{left:S.left,top:S.top,transform:g==="top"||g==="bottom"?`translateX(calc(-50% + ${v.x}px))`:`translateY(calc(-50% + ${v.y}px))`},children:[n,y.jsx("span",{className:`absolute h-2 w-2 rotate-45 border-line bg-elevated ${D9[g]} ${j9[g]}`,style:g==="top"||g==="bottom"?{left:`calc(50% - ${v.x}px)`}:void 0})]}),document.body)]})},_9=[".profiles",".profiles.yaml"];function L9(n){const e=n.trim();if(!e)return null;const t=e.toLowerCase(),i=_9.find(l=>t.endsWith(l));if(i!==void 0){const l=e.slice(0,e.length-i.length);return!l.trim()||l!==l.trimEnd()?null:e}return t.includes(".")?null:`${e}.profiles`}function z9({open:n,onCancel:e,onConfirm:t}){const[i,l]=D.useState(null),[o,a]=D.useState(""),[u,f]=D.useState(""),[d,m]=D.useState(null),[g,b]=D.useState(!1),[v,w]=D.useState(null),[S,C]=D.useState(null),N=D.useRef(null),R=D.useRef(null),M=D.useRef(null),I=D.useCallback(async z=>{b(!0),w(null);try{const ie=await GC(z);l(ie),a(ie.current_path)}catch(ie){w(ie instanceof Error?ie.message:String(ie))}finally{b(!1)}},[]);D.useEffect(()=>{if(!n)return;f(""),m(null),C(null),I(o);const z=requestAnimationFrame(()=>{var ie;return(ie=R.current)==null?void 0:ie.focus()});return()=>cancelAnimationFrame(z)},[n]);const U=hs({isOpen:n,onClose:e,dialogRef:N,initialFocusRef:R});function E(){if(!i)return;const z=L9(u);if(z===null){m("Not a ProFiles configuration file. Allowed extensions: .profiles, .profiles.yaml");return}m(null);const ie=o.trim()||i.current_path;if(o.trim()===i.current_path&&i.items.some(F=>!F.is_dir&&F.name===z)){C({filename:z,directory:ie});return}t({filename:z,directory:ie,overwrite:!1})}if(!n)return null;const T=(i==null?void 0:i.items.filter(z=>z.is_dir))??[];return y.jsxs(y.Fragment,{children:[y.jsx("div",{className:"animate-overlay-in fixed inset-0 z-[var(--z-modal)] flex items-center justify-center bg-black/65 p-4 backdrop-blur-sm",onClick:e,children:y.jsxs("div",{ref:N,role:"dialog","aria-modal":"true","aria-labelledby":"save-as-dialog-title",onKeyDown:U,onClick:z=>z.stopPropagation(),className:"animate-modal-in flex max-h-[calc(100dvh-2rem)] w-[min(94vw,560px)] flex-col overflow-hidden rounded-xl border border-frame-line glass-panel sm:rounded-2xl",children:[y.jsx("div",{className:"flex shrink-0 items-center justify-between gap-3 border-b border-line px-5 py-3",children:y.jsxs("div",{className:"flex min-w-0 items-center gap-2.5",children:[y.jsx("span",{className:"grid h-8 w-8 shrink-0 place-items-center rounded-lg bg-chip-indigo-bg",children:y.jsx(iO,{className:"h-4 w-4 text-chip-indigo-text"})}),y.jsxs("div",{className:"min-w-0",children:[y.jsx("h2",{id:"save-as-dialog-title",className:"text-sm font-semibold text-ink",children:"Save configuration as"}),y.jsx("p",{className:"truncate font-mono text-xs text-ink-muted",children:(i==null?void 0:i.current_path)||"…"})]})]})}),y.jsxs("div",{className:"border-b border-line px-5 py-3",children:[y.jsx("label",{htmlFor:"save-as-path",className:"mb-1.5 block text-xs font-medium text-ink-secondary",children:"Location"}),y.jsxs("div",{className:"flex min-w-0 items-center gap-1.5",children:[y.jsx("input",{ref:M,id:"save-as-path",type:"text",value:o,onChange:z=>a(z.target.value),onKeyDown:z=>{z.key==="Enter"&&I(o.trim())},placeholder:"/path/to/directory",className:"h-9 min-w-0 flex-1 rounded-lg border border-line bg-elevated px-2.5 font-mono text-sm text-ink outline-none placeholder:text-ink-faint transition-colors hover:bg-surface-strong focus-visible:border-indigo-500 focus-visible:ring-2 focus-visible:ring-indigo-500/30"}),y.jsx("button",{type:"button",onClick:()=>void I(o.trim()),className:"inline-flex h-9 shrink-0 items-center rounded-lg border border-line bg-elevated px-3 text-sm font-medium text-ink-secondary transition-colors hover:bg-surface-strong hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-indigo-400",children:"Go"}),y.jsx(Qe,{text:"Home directory",block:!1,children:y.jsx("button",{type:"button",onClick:()=>void I(""),"aria-label":"Home directory",className:"grid h-9 w-9 shrink-0 place-items-center rounded-lg border border-line bg-elevated text-ink-secondary transition-colors hover:bg-surface-strong hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-indigo-400",children:y.jsx(Xd,{className:"h-4 w-4"})})}),(i==null?void 0:i.parent_path)&&y.jsx(Qe,{text:"Parent directory",block:!1,children:y.jsx("button",{type:"button",onClick:()=>void I(i.parent_path),"aria-label":"Parent directory",className:"grid h-9 w-9 shrink-0 place-items-center rounded-lg border border-line bg-elevated text-ink-secondary transition-colors hover:bg-surface-strong hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-indigo-400",children:y.jsx(Qd,{className:"h-4 w-4 rotate-180"})})})]})]}),y.jsx("div",{className:"min-h-24 flex-1 overflow-y-auto px-2 py-2 sm:px-3","aria-busy":g,children:g?y.jsxs("div",{className:"flex h-full items-center justify-center gap-2.5 text-sm text-ink-muted",children:[y.jsx(ll,{className:"h-5 w-5 animate-spin text-chip-indigo-text"}),y.jsx("span",{role:"status",children:"Loading directories…"})]}):v?y.jsxs("div",{role:"alert",className:"flex h-full flex-col items-center justify-center gap-2.5 text-center",children:[y.jsx("p",{className:"text-sm text-status-danger-text",children:v}),y.jsx("button",{type:"button",onClick:()=>void I(o||(i==null?void 0:i.current_path)||""),className:"min-h-9 rounded-lg border border-line bg-elevated px-3.5 text-sm text-ink-secondary hover:bg-surface-strong hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-indigo-400",children:"Retry"})]}):y.jsxs("ul",{className:"space-y-0.5",children:[T.map(z=>y.jsx("li",{children:y.jsxs("button",{type:"button",onClick:()=>void I(z.path),className:"flex min-h-9 w-full items-center gap-2.5 rounded-lg px-3 py-1.5 text-left text-sm text-ink-secondary transition-colors hover:bg-elevated hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-indigo-400",children:[y.jsx(Ou,{className:"h-4 w-4 shrink-0 text-chip-indigo-text"}),y.jsx("span",{className:"truncate",children:z.name})]})},z.path)),T.length===0&&y.jsxs("li",{className:"flex min-h-16 flex-col items-center justify-center gap-2 text-center text-sm text-ink-muted",children:[y.jsx(Jl,{className:"h-6 w-6 text-ink-faint"}),"No subdirectories found"]})]})}),y.jsxs("div",{className:"shrink-0 border-t border-line px-5 py-3",children:[y.jsx("label",{htmlFor:"save-as-filename",className:"mb-1.5 block text-xs font-medium text-ink-secondary",children:"File name"}),y.jsx("input",{ref:R,id:"save-as-filename",type:"text",value:u,onChange:z=>{f(z.target.value),m(null)},onKeyDown:z=>{z.key==="Enter"&&u.trim()&&E()},placeholder:"machine.profiles",className:"h-9 w-full rounded-lg border border-line bg-elevated px-2.5 font-mono text-sm text-ink outline-none placeholder:text-ink-faint transition-colors hover:bg-surface-strong focus-visible:border-indigo-500 focus-visible:ring-2 focus-visible:ring-indigo-500/30"}),d&&y.jsx("p",{role:"alert","data-testid":"save-as-error",className:"mt-1.5 text-xs text-status-danger-text",children:d}),y.jsxs("div",{className:"mt-3 flex justify-end gap-1.5",children:[y.jsx("button",{type:"button",onClick:e,className:"min-h-9 rounded-lg border border-line bg-elevated px-3.5 text-sm text-ink-secondary transition-colors hover:bg-surface-strong hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-indigo-400",children:"Cancel"}),y.jsxs("button",{type:"button",onClick:E,disabled:!u.trim()||!i||g,title:"Save the configuration to the selected folder",className:"btn btn-primary min-h-9 rounded-lg px-4 text-sm font-semibold",children:[y.jsx(_r,{className:"h-4 w-4"}),"Save"]})]})]})]})}),y.jsx(va,{isOpen:S!==null,title:"Replace configuration?",message:`A configuration named "${S==null?void 0:S.filename}" already exists in this folder. +Saving will replace it.`,confirmLabel:"Replace",cancelLabel:"Keep existing",danger:!0,onConfirm:()=>{const z=S;C(null),z&&t({...z,overwrite:!0})},onCancel:()=>C(null)})]})}const B9=800,P9=Oe.theme({"&":{height:"100%",fontSize:"12.5px",color:"var(--app-text-primary)",backgroundColor:"var(--app-editor-bg)"},".cm-scroller":{fontFamily:"'JetBrains Mono', 'Fira Code', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace",lineHeight:"1.6"},".cm-content":{caretColor:"var(--color-indigo-500, #6366f1)"},".cm-cursor, .cm-dropCursor":{borderLeftColor:"var(--color-indigo-500, #6366f1)"},"&.cm-focused":{outline:"none"},".cm-selectionBackground, &.cm-focused .cm-selectionBackground":{backgroundColor:"var(--app-editor-selection)"},".cm-activeLine":{backgroundColor:"var(--app-editor-active-line)"},".cm-matchingBracket":{color:"inherit",backgroundColor:"var(--app-editor-selection)",outline:"1px solid var(--app-editor-border)"},".cm-nonmatchingBracket":{color:"inherit",outline:"1px solid var(--status-danger-border, #fb7185)"},".cm-gutters":{backgroundColor:"var(--app-editor-gutter-bg)",color:"var(--app-text-faint)",border:"none",borderRight:"1px solid var(--app-editor-border)"},".cm-activeLineGutter":{backgroundColor:"var(--app-editor-active-line)",color:"var(--app-text-secondary)"},".cm-panels":{backgroundColor:"var(--app-editor-bg)",color:"var(--app-text-primary)"},".cm-tooltip":{border:"1px solid var(--app-border)",backgroundColor:"var(--app-glass-panel-strong)",color:"var(--app-text-primary)"}});function E0(n){return n.replace(/\r\n?/g,` +`)}function Bh(n,e){return n!==null&&n.state.doc.toString()!==e}function H9(n){return n instanceof $C&&Array.isArray(n.detail)?{text:n.message,issues:n.detail}:{text:n instanceof Error?n.message:String(n),issues:[]}}function I9({open:n,onClose:e,onApplied:t,onLoadConfig:i,reloadKey:l=0}){const[o,a]=D.useState({status:"loading"}),[u,f]=D.useState(!1),[d,m]=D.useState(!1),[g,b]=D.useState(null),[v,w]=D.useState([]),[S,C]=D.useState({kind:"unknown"}),[N,R]=D.useState(!1),[M,I]=D.useState({line:1,col:1}),[U,E]=D.useState(null),[T,z]=D.useState(null),[ie,q]=D.useState(null),J=D.useRef(null),F=D.useRef(null),se=D.useRef(null),he=D.useRef(""),ne=D.useRef(0),L=D.useRef(new Map),ee=D.useRef(null),oe=D.useRef(null),le=D.useRef(!1),A=D.useRef(()=>{}),Le=D.useRef(()=>{});le.current=T!==null||ie!==null;const _e=hs({isOpen:n,onClose:$,dialogRef:J});D.useEffect(()=>{if(!n){he.current="",se.current=null,a({status:"loading"}),f(!1),m(!1),b(null),w([]),C({kind:"unknown"}),R(!1),I({line:1,col:1}),E(null),z(null),q(null),ee.current!==null&&(clearTimeout(ee.current),ee.current=null),oe.current=null,ne.current+=1,L.current.clear();return}let V=!1;return zk().then(K=>{if(V)return;const de=E0(K.content);he.current=de,oe.current=de,a({status:"ready",data:{...K,content:de}})}).catch(K=>{V||(he.current="",a({status:"error",message:K instanceof Error?K.message:String(K)}))}),()=>{V=!0}},[n,l]);const B=D.useCallback(()=>{ee.current!==null&&(clearTimeout(ee.current),ee.current=null)},[]),j=D.useCallback(V=>{le.current||V!==oe.current&&(B(),ee.current=window.setTimeout(()=>{if(ee.current=null,L.current.has("test")){Le.current(V);return}A.current()},B9))},[B]);D.useEffect(()=>{if(!n||o.status!=="ready")return;const V=F.current;if(!V)return;const K=new Oe({doc:o.data.content,extensions:[FB,A9(),P9,Oe.updateListener.of(de=>{if(de.selectionSet||de.docChanged){const Se=de.state.selection.main.head,We=de.state.doc.lineAt(Se);I({line:We.number,col:Se-We.from+1})}de.docChanged&&(f(Bh(de.view,he.current)),b(null),w([]),C({kind:"unknown"}),R(!1),j(de.state.doc.toString()))})],parent:V});return se.current=K,()=>{K.destroy(),se.current=null,B()}},[n,o]);function $(){if(Bh(se.current,he.current)){m(!0);return}e()}const fe=D.useCallback(()=>{MM().catch(V=>{console.error("Failed to open config file in OS editor:",V)})},[]);function me(){var V;return((V=se.current)==null?void 0:V.state.doc.toString())??he.current}const Ne=D.useCallback(async(V,K)=>{if(L.current.has(V))return;const de=++ne.current;L.current.set(V,de);try{await K(de)}finally{L.current.get(V)===de&&L.current.delete(V)}},[]),Te=D.useCallback(()=>Ne("new",async V=>{b(null),w([]);try{const K=await OM();if(V!==ne.current)return;const de=E0(K.content);he.current=de,f(!1),a(Se=>Se.status==="ready"?{status:"ready",data:{...Se.data,filename:K.filename,content:de,config_path:null}}:Se),b({kind:"ok",text:"New configuration template loaded."})}catch(K){if(V!==ne.current)return;b({kind:"error",text:K instanceof Error?K.message:String(K)})}}),[Ne]),ze=D.useCallback(()=>Ne("revert",async V=>{b(null),w([]);try{const K=await zk();if(V!==ne.current)return;const de=E0(K.content);he.current=de,f(!1),a({status:"ready",data:{...K,content:de}}),b({kind:"ok",text:"Configuration reloaded from disk."})}catch(K){if(V!==ne.current)return;b({kind:"error",text:K instanceof Error?K.message:String(K)})}}),[Ne]);function ve(){if(Bh(se.current,he.current)){E("new");return}Te()}function je(){if(Bh(se.current,he.current)){E("revert");return}ze()}const It=D.useCallback(()=>Ne("test",async V=>{if(o.status!=="ready")return;B();const K=me();oe.current=K,C({kind:"validating"});try{const de=await Bk(o.data.filename,K);if(V!==ne.current)return;w(de.issues),de.valid?(C({kind:"valid"}),b({kind:"ok",text:"Configuration is valid."})):(C({kind:"invalid",count:de.issues.length}),R(!0),b({kind:"error",text:`Validation failed with ${de.issues.length} issue${de.issues.length===1?"":"s"}.`}))}catch(de){if(V!==ne.current)return;w([]),C({kind:"unknown"}),b({kind:"error",text:de instanceof Error?de.message:String(de)})}}),[o,Ne]);A.current=()=>void It(),Le.current=j;const Gt=D.useCallback(()=>Ne("apply",async V=>{if(o.status==="ready")try{const K=await YC(o.data.filename,me());if(V!==ne.current)return;b({kind:"ok",text:"Configuration applied (session trial)."}),t==null||t(K)}catch(K){if(V!==ne.current)return;b({kind:"error",text:K instanceof Error?K.message:String(K)})}}),[o,t,Ne]),un=D.useCallback(V=>new Promise(K=>{z({issues:V,resolve:de=>{z(null),K(de)}})}),[]),_t=D.useCallback(()=>new Promise(V=>{q({resolve:K=>{q(null),V(K)}})}),[]),yt=D.useCallback((V,K)=>{if(he.current=K,f(!1),w([]),C({kind:"unknown"}),z(null),q(null),V.config_path){const de=V.config_path.split(/[\\/]/).pop()||V.title||"configuration";a(Se=>Se.status!=="ready"||!(Se.data.filename!==de||Se.data.config_path!==V.config_path||Se.data.session_trial)?Se:{status:"ready",data:{...Se.data,filename:de,config_path:V.config_path,session_trial:!1,content:K}})}t==null||t(V)},[t]),rt=D.useCallback(V=>{const K=H9(V);z(null),q(null),w(K.issues),K.issues.length>0?(C({kind:"invalid",count:K.issues.length}),R(!0)):C({kind:"unknown"}),b({kind:"error",text:K.text})},[]),Ut=D.useCallback((V,K)=>Ne(V,async de=>{if(o.status!=="ready")return;const Se=me();b(null),w([]),C({kind:"validating"});try{const We=await Bk(K,Se);if(de!==ne.current)return;let ot=!1;if(We.valid)C({kind:"valid"});else{if(C({kind:"invalid",count:We.issues.length}),w(We.issues),R(!0),ot=await un(We.issues),de!==ne.current)return;if(!ot){b({kind:"error",text:"Save cancelled — fix the listed issues, or force-save anyway."});return}}if(V==="save-as"){const gt=await _t();if(de!==ne.current||gt===null)return;const qt=await TM({content:Se,filename:gt.filename,directory:gt.directory,force:ot,overwrite:gt.overwrite});if(de!==ne.current)return;yt(qt,Se),b({kind:"ok",text:`Configuration saved as ${gt.filename}.`})}else{const gt=await NM(Se,ot);if(de!==ne.current)return;yt(gt,Se),b({kind:"ok",text:`Configuration saved to ${K}.`})}}catch(We){if(de!==ne.current)return;rt(We)}}),[un,_t,o,yt,rt,Ne]),zn=D.useCallback(()=>Ut("save",o.status==="ready"?o.data.filename:""),[o,Ut]),Ft=D.useCallback(()=>Ut("save-as",o.status==="ready"?o.data.filename:""),[o,Ut]),en=D.useRef(()=>{});if(en.current=()=>{o.status==="ready"&&(T!==null||ie!==null||d||U!==null||(o.data.config_path!==null?zn():Gt()))},D.useEffect(()=>{if(!n)return;const V=K=>{(K.metaKey||K.ctrlKey)&&!K.altKey&&!K.shiftKey&&K.key.toLowerCase()==="s"&&(K.preventDefault(),K.stopPropagation(),en.current())};return window.addEventListener("keydown",V,!0),()=>window.removeEventListener("keydown",V,!0)},[n]),!n)return null;const ke=o.status==="ready"?o.data.filename:"",qe=o.status==="ready"?o.data.session_trial:!1,Ie=o.status!=="ready",at=o.status==="ready"&&o.data.config_path!==null;return y.jsxs(y.Fragment,{children:[y.jsx("div",{ref:J,role:"dialog","aria-modal":"true","aria-labelledby":"config-editor-title",onKeyDown:_e,onClick:$,className:"animate-overlay-in fixed inset-0 z-[var(--z-modal)] flex items-center justify-center bg-black/65 p-3 backdrop-blur-sm sm:p-6",children:y.jsxs("div",{className:"animate-modal-in flex h-[90vh] w-full max-w-6xl flex-col overflow-hidden rounded-xl border border-frame-line glass-panel",onClick:V=>V.stopPropagation(),children:[y.jsxs("div",{"data-testid":"editor-header",className:"flex shrink-0 items-center justify-between gap-3 border-b border-line px-5 py-3",children:[y.jsxs("div",{className:"flex min-w-0 items-center gap-2.5",children:[y.jsx("span",{className:"flex h-8 w-8 shrink-0 items-center justify-center rounded-lg bg-chip-indigo-bg text-chip-indigo-text",children:y.jsx(D4,{className:"h-4 w-4"})}),y.jsxs("div",{className:"min-w-0",children:[y.jsx("h2",{id:"config-editor-title",className:"text-sm font-semibold text-ink",children:"Configuration Editor"}),y.jsxs("p",{className:"truncate text-xs text-ink-muted",children:[ke||"…",qe?" • session trial (not anchored to disk)":""]})]})]}),y.jsxs("div",{className:"flex shrink-0 items-center gap-1.5",children:[y.jsxs("button",{type:"button",onClick:ve,disabled:Ie,title:"Load the starter configuration template",className:"btn btn-secondary px-2.5 py-1.5",children:[y.jsx(L4,{className:"h-3.5 w-3.5"}),"New"]}),y.jsxs("button",{type:"button",onClick:()=>void It(),disabled:Ie,title:"Validate the editor content in memory",className:"btn btn-secondary px-2.5 py-1.5",children:[y.jsx(H4,{className:"h-3.5 w-3.5"}),"Test"]}),y.jsxs("button",{type:"button",onClick:je,disabled:Ie,title:"Discard edits and reload the file from disk",className:"btn btn-secondary px-2.5 py-1.5",children:[y.jsx(fD,{className:"h-3.5 w-3.5"}),"Revert"]}),at&&y.jsxs("button",{type:"button",onClick:()=>void zn(),disabled:Ie,title:"Save to the configuration file on disk (Ctrl/Cmd+S)",className:"btn btn-secondary px-2.5 py-1.5",children:[y.jsx(iO,{className:"h-3.5 w-3.5"}),"Save"]}),y.jsxs("button",{type:"button",onClick:()=>void Ft(),disabled:Ie,title:"Save the configuration to a new file — also anchors a session trial onto disk",className:"btn btn-secondary px-2.5 py-1.5",children:[y.jsx(dD,{className:"h-3.5 w-3.5"}),"Save As"]}),y.jsxs("button",{type:"button",onClick:()=>void Gt(),disabled:Ie,title:"Trial the editor content as the session configuration",className:"btn btn-primary px-2.5 py-1.5 font-semibold",children:[y.jsx(ts,{className:"h-3.5 w-3.5"}),"Apply"]}),i&&y.jsxs("button",{type:"button",onClick:i,title:"Load a different .profiles file",className:"btn btn-secondary px-2.5 py-1.5",children:[y.jsx(sa,{className:"h-3.5 w-3.5"}),"Load config file…"]}),at&&y.jsxs("button",{type:"button",onClick:fe,title:"Open the configuration file with the OS default editor",className:"btn inline-flex items-center gap-1.5 rounded-md border border-line bg-surface px-2.5 py-1.5 text-xs font-medium text-ink-secondary hover:bg-elevated hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-indigo-500",children:[y.jsx(tO,{className:"h-3.5 w-3.5"}),"Open in OS"]}),y.jsx("button",{type:"button",onClick:$,"aria-label":"Close editor",className:"rounded-md p-1.5 text-ink-muted hover:bg-elevated hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-indigo-500",children:y.jsx(Ei,{className:"h-4 w-4"})})]})]}),y.jsxs("div",{className:"flex min-h-0 flex-1 gap-2 p-3 sm:p-4",children:[y.jsx("div",{"data-testid":"editor-card",className:"min-w-0 flex-1 overflow-hidden rounded-lg border border-[var(--app-editor-border)] bg-[var(--app-editor-bg)]",children:o.status==="loading"?y.jsx("div",{className:"flex h-full items-center justify-center",children:y.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-2 border-indigo-600 border-t-transparent"})}):o.status==="error"?y.jsx("div",{className:"flex h-full items-center justify-center p-6",children:y.jsx("div",{className:"max-w-md rounded-md border border-status-danger-border bg-status-danger-bg p-4 text-center text-xs text-status-danger-text",children:o.message})}):y.jsx("div",{ref:F,className:"h-full"})}),o.status==="ready"&&N&&y.jsxs("aside",{"data-testid":"problems-panel","aria-live":"polite",className:"flex w-[280px] shrink-0 flex-col overflow-hidden rounded-lg border border-line bg-surface",children:[y.jsxs("div",{className:"flex shrink-0 items-center justify-between border-b border-line px-3 py-1.5",children:[y.jsx("span",{className:"text-xs font-semibold text-ink-secondary",children:"Problems"}),y.jsx("button",{type:"button",onClick:()=>R(!1),"aria-label":"Close problems",className:"rounded-md p-1 text-ink-muted hover:bg-elevated hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-indigo-500",children:y.jsx(Ei,{className:"h-3.5 w-3.5"})})]}),y.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto p-2",children:v.length===0?y.jsx("p",{className:"px-2 py-1 text-xs text-ink-faint",children:"No problems detected."}):y.jsx("ul",{"data-testid":"editor-issues",className:"space-y-1",children:v.map((V,K)=>y.jsxs("li",{tabIndex:0,className:`flex items-start gap-2 rounded-md border px-2.5 py-1.5 text-xs ${V.severity==="error"?"border-status-danger-border bg-status-danger-bg text-status-danger-text":V.severity==="warning"?"border-chip-amber-border bg-chip-amber-bg text-chip-amber-text":"border-line bg-surface text-ink-secondary"}`,children:[V.severity==="error"?y.jsx(ou,{className:"mt-0.5 h-3.5 w-3.5 shrink-0"}):V.severity==="warning"?y.jsx(yy,{className:"mt-0.5 h-3.5 w-3.5 shrink-0"}):y.jsx(gy,{className:"mt-0.5 h-3.5 w-3.5 shrink-0"}),y.jsx("span",{className:"min-w-0",children:V.message})]},`${V.severity}-${K}`))})})]})]}),o.status==="ready"&&y.jsxs("footer",{"data-testid":"editor-footer",className:"flex shrink-0 items-center justify-between gap-3 border-t border-line px-5 py-1.5 text-xs",children:[y.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[y.jsxs("button",{type:"button","data-testid":"validity-chip",onClick:()=>R(V=>!V),title:"Toggle the problems panel","aria-pressed":N,className:`inline-flex shrink-0 items-center gap-1 rounded-full border px-2 py-0.5 text-[10px] font-bold focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-indigo-500 ${S.kind==="valid"?"border-status-success-border bg-status-success-bg text-status-success-text":S.kind==="invalid"?"border-status-danger-border bg-status-danger-bg text-status-danger-text":"border-line bg-surface text-ink-muted"}`,children:[S.kind==="valid"?y.jsx(_r,{className:"h-3 w-3"}):S.kind==="invalid"?y.jsx(ou,{className:"h-3 w-3"}):S.kind==="validating"?y.jsx(ll,{className:"h-3 w-3 animate-spin"}):y.jsx(h4,{className:"h-3 w-3"}),S.kind==="valid"?"Valid":S.kind==="invalid"?`${S.count} issue${S.count===1?"":"s"}`:S.kind==="validating"?"Validating…":"Not validated"]}),u&&y.jsxs("span",{role:"status",className:"inline-flex shrink-0 items-center gap-1 rounded-full border border-chip-amber-border bg-chip-amber-bg px-2 py-0.5 text-[10px] font-bold text-chip-amber-text",children:[y.jsx(m4,{className:"h-3 w-3"}),"Unsaved changes"]}),g!==null&&y.jsx("div",{"data-testid":"editor-status","aria-live":"polite",className:`min-w-0 truncate rounded-md border px-2 py-0.5 font-medium ${g.kind==="ok"?"border-status-success-border bg-status-success-bg text-status-success-text":"border-status-danger-border bg-status-danger-bg text-status-danger-text"}`,children:g.text})]}),y.jsxs("div",{className:"flex shrink-0 items-center gap-3 text-ink-muted",children:[y.jsxs("span",{className:"font-mono",children:["Ln ",M.line,", Col ",M.col]}),y.jsx("span",{className:"text-ink-faint",children:"YAML"}),y.jsx("span",{className:"max-w-[220px] truncate font-mono",children:ke})]})]})]})}),y.jsx(va,{isOpen:d,title:"Discard changes?",message:`The editor contains unsaved changes. +Closing now will discard them.`,confirmLabel:"Discard",cancelLabel:"Keep editing",danger:!0,onConfirm:()=>{m(!1),e()},onCancel:()=>m(!1)}),y.jsx(va,{isOpen:U!==null,title:"Replace current edits?",message:U==="revert"?`The editor contains unsaved changes. +Reverting will discard them and reload the file from disk.`:`The editor contains unsaved changes. +Loading the starter template will discard them.`,confirmLabel:"Replace",cancelLabel:"Keep editing",danger:!0,onConfirm:()=>{const V=U;E(null),V==="new"?Te():V==="revert"&&ze()},onCancel:()=>E(null)}),y.jsx(va,{isOpen:T!==null,title:"Save with validation issues?",danger:!0,message:y.jsxs(y.Fragment,{children:[y.jsx("p",{children:"Saving will write these issues to disk; the file may fail to load until they are fixed."}),y.jsx("ul",{className:"mt-2 space-y-1",children:T==null?void 0:T.issues.map((V,K)=>y.jsx("li",{className:`rounded-md border px-3 py-1.5 text-xs ${V.severity==="error"?"border-status-danger-border bg-status-danger-bg text-status-danger-text":"border-chip-amber-border bg-chip-amber-bg text-chip-amber-text"}`,children:V.message},`${V.severity}-${K}`))})]}),confirmLabel:"Force save anyway",cancelLabel:"Go back and fix",onConfirm:()=>T==null?void 0:T.resolve(!0),onCancel:()=>T==null?void 0:T.resolve(!1)}),y.jsx(z9,{open:ie!==null,onCancel:()=>ie==null?void 0:ie.resolve(null),onConfirm:V=>ie==null?void 0:ie.resolve(V)})]})}function U9({position:n,onClose:e,onLaunch:t,onLaunchWithArgs:i,onReveal:l,onOpenFolder:o,onOpenTerminal:a,onScanDirectory:u,onFilterFolder:f,onFilterExtension:d,onCopyPath:m,onCopyFilename:g,onCopyUri:b,onComputeHash:v,onVerifyHash:w,onProperties:S,onClearFile:C,onGenerateBarcode:N,showToast:R}){const[M,I]=D.useState(!1),[U,E]=D.useState(""),T=D.useRef(null),z=D.useRef(null),ie=D.useRef(null),[q,J]=D.useState(null);if(D.useEffect(()=>{var le;M&&((le=z.current)==null||le.showModal())},[M]),D.useLayoutEffect(()=>{if(!n){J(null);return}const le=()=>{const A=T.current;if(!A)return;const Le=A.getBoundingClientRect(),_e=8;J({left:Math.max(_e,Math.min(n.x,window.innerWidth-Le.width-_e)),top:Math.max(_e,Math.min(n.y,window.innerHeight-Le.height-_e))})};return le(),window.addEventListener("resize",le),()=>window.removeEventListener("resize",le)},[n]),D.useEffect(()=>{if(!n)return;ie.current=document.activeElement instanceof HTMLElement?document.activeElement:null;const le=window.requestAnimationFrame(()=>{var A,Le;(Le=(A=T.current)==null?void 0:A.querySelector("[role='menuitem']"))==null||Le.focus()});return()=>{var A;window.cancelAnimationFrame(le),(A=ie.current)==null||A.focus()}},[n]),!n)return null;const{file:F,x:se,y:he}=n,ne=()=>{i(F,U),I(!1),e()},L=le=>{const A=le.lastIndexOf(".");return A!==-1?le.slice(A):""},ee=le=>{const A=Math.max(le.lastIndexOf("/"),le.lastIndexOf("\\"));return A!==-1?le.slice(0,A):le},oe=le=>{const A=Math.max(le.lastIndexOf("/"),le.lastIndexOf("\\"));return A!==-1?le.slice(0,A):""};return y.jsxs(y.Fragment,{children:[y.jsx("div",{className:"fixed inset-0 z-[calc(var(--z-context-menu)-1)]",onClick:e,onContextMenu:le=>{le.preventDefault(),e()},"aria-hidden":"true"}),y.jsxs("div",{ref:T,role:"menu","aria-label":`Actions for ${F.filename}`,tabIndex:0,onKeyDown:le=>{var _e,B,j,$;["Escape","ArrowDown","ArrowUp","Home","End"].includes(le.key)&&le.stopPropagation();const A=Array.from(((_e=T.current)==null?void 0:_e.querySelectorAll("[role='menuitem']"))??[]),Le=A.indexOf(document.activeElement);if(le.key==="Escape")le.preventDefault(),e();else if(le.key==="ArrowDown"||le.key==="ArrowUp"){le.preventDefault();const fe=le.key==="ArrowDown"?1:-1;(B=A[(Le+fe+A.length)%A.length])==null||B.focus()}else le.key==="Home"?(le.preventDefault(),(j=A[0])==null||j.focus()):le.key==="End"&&(le.preventDefault(),($=A.at(-1))==null||$.focus())},className:"animate-modal-in fixed z-[var(--z-context-menu)] max-h-[calc(100dvh-16px)] w-56 max-w-[calc(100vw-16px)] overflow-y-auto rounded-lg border border-line bg-surface-glass py-1 text-xs text-ink shadow-2xl backdrop-blur-md",style:q??{left:se,top:he,visibility:"hidden"},children:[y.jsx("div",{className:"border-b border-line px-3 py-2 font-medium text-ink-muted truncate",children:F.filename}),y.jsxs("button",{role:"menuitem",onClick:()=>{t(F),e()},className:"flex w-full items-center gap-2 px-3 py-3 min-h-[44px] hover:bg-indigo-600 hover:text-white focus:outline-none focus:ring-2 focus:ring-indigo-500 active:scale-95 transition-transform group","aria-label":`Launch ${F.filename}`,children:[y.jsx(ts,{className:"h-3.5 w-3.5 fill-current text-status-success-text group-hover:text-white"}),y.jsx("span",{children:"Launch"})]}),y.jsxs("button",{role:"menuitem",onClick:()=>{I(!0)},className:"flex w-full items-center gap-2 px-3 py-3 min-h-[44px] hover:bg-indigo-600 hover:text-white focus:outline-none focus:ring-2 focus:ring-indigo-500 active:scale-95 transition-transform group","aria-label":`Launch ${F.filename} with arguments`,children:[y.jsx(ts,{className:"h-3.5 w-3.5 text-chip-indigo-text group-hover:text-white"}),y.jsx("span",{children:"Launch with arguments..."})]}),y.jsx("div",{className:"my-1 border-t border-line"}),y.jsxs("button",{role:"menuitem",onClick:()=>{l(F),e()},className:"flex w-full items-center gap-2 px-3 py-1.5 hover:bg-indigo-600 hover:text-white focus:outline-none focus:ring-2 focus:ring-indigo-500 active:scale-95 transition-transform group","aria-label":`Reveal ${F.filename} in file manager`,children:[y.jsx(G0,{className:"h-3.5 w-3.5 text-chip-sky-text group-hover:text-white"}),y.jsx("span",{children:"Reveal in File Manager"})]}),y.jsxs("button",{role:"menuitem",onClick:()=>{o(F),e()},className:"flex w-full items-center gap-2 px-3 py-1.5 hover:bg-indigo-600 hover:text-white focus:outline-none focus:ring-2 focus:ring-indigo-500 active:scale-95 transition-transform group","aria-label":`Open folder containing ${F.filename}`,children:[y.jsx(Jl,{className:"h-3.5 w-3.5 text-chip-amber-text group-hover:text-white"}),y.jsx("span",{children:"Open Folder"})]}),y.jsxs("button",{role:"menuitem",onClick:()=>{a(F),e()},className:"flex w-full items-center gap-2 px-3 py-1.5 hover:bg-indigo-600 hover:text-white focus:outline-none focus:ring-2 focus:ring-indigo-500 active:scale-95 transition-transform group","aria-label":`Open terminal in directory containing ${F.filename}`,children:[y.jsx(W0,{className:"h-3.5 w-3.5 text-status-success-text group-hover:text-white"}),y.jsx("span",{children:"Open Terminal in Directory"})]}),y.jsxs("button",{role:"menuitem",onClick:()=>{N(F),e()},className:"flex w-full items-center gap-2 px-3 py-1.5 hover:bg-indigo-600 hover:text-white focus:outline-none focus:ring-2 focus:ring-indigo-500 active:scale-95 transition-transform group","aria-label":"Generate QR Code",children:[y.jsx(xy,{className:"h-3.5 w-3.5 text-chip-fuchsia-text group-hover:text-white"}),y.jsx("span",{children:"Generate QR Code"})]}),y.jsx("div",{className:"my-1 border-t border-line"}),y.jsxs("button",{role:"menuitem",onClick:()=>{const le=ee(F.path);u(le),e()},className:"flex w-full items-center gap-2 px-3 py-1.5 hover:bg-indigo-600 hover:text-white focus:outline-none focus:ring-2 focus:ring-indigo-500 active:scale-95 transition-transform group","aria-label":"Scan to Directory",children:[y.jsx(Jl,{className:"h-3.5 w-3.5 text-chip-indigo-text group-hover:text-white"}),y.jsx("span",{children:"Scan to Directory"})]}),y.jsxs("button",{role:"menuitem",onClick:()=>{const le=oe(F.rel_path);le&&f(le),e()},className:"flex w-full items-center gap-2 px-3 py-1.5 hover:bg-indigo-600 hover:text-white focus:outline-none focus:ring-2 focus:ring-indigo-500 active:scale-95 transition-transform group","aria-label":`Filter view to folder ${F.filename} is in`,children:[y.jsx(K0,{className:"h-3.5 w-3.5 text-chip-indigo-text group-hover:text-white"}),y.jsx("span",{children:"Filter to Folder"})]}),y.jsxs("button",{role:"menuitem",onClick:()=>{const le=L(F.filename);le&&d(le),e()},className:"flex w-full items-center gap-2 px-3 py-1.5 hover:bg-indigo-600 hover:text-white focus:outline-none focus:ring-2 focus:ring-indigo-500 active:scale-95 transition-transform group","aria-label":`Filter view by extension ${L(F.filename)}`,children:[y.jsx(K0,{className:"h-3.5 w-3.5 text-chip-indigo-text group-hover:text-white"}),y.jsx("span",{children:"Filter by Extension"})]}),y.jsx("div",{className:"my-1 border-t border-line"}),y.jsxs("button",{role:"menuitem",onClick:()=>{m(F,!1),e()},className:"flex w-full items-center gap-2 px-3 py-1.5 hover:bg-indigo-600 hover:text-white focus:outline-none focus:ring-2 focus:ring-indigo-500 active:scale-95 transition-transform group","aria-label":`Copy full path of ${F.filename}`,children:[y.jsx(ci,{className:"h-3.5 w-3.5 text-ink-muted group-hover:text-white"}),y.jsx("span",{className:"truncate",children:"Copy Full Path"})]}),y.jsxs("button",{role:"menuitem",onClick:()=>{m(F,!0),e()},className:"flex w-full items-center gap-2 px-3 py-1.5 hover:bg-indigo-600 hover:text-white focus:outline-none focus:ring-2 focus:ring-indigo-500 active:scale-95 transition-transform group","aria-label":`Copy path of ${F.filename} with forward slashes`,children:[y.jsx(ci,{className:"h-3.5 w-3.5 text-ink-muted group-hover:text-white"}),y.jsx("span",{className:"truncate",children:"Copy Path (Forward Slashes)"})]}),y.jsxs("button",{role:"menuitem",onClick:()=>{g(F,!1),e()},className:"flex w-full items-center gap-2 px-3 py-1.5 hover:bg-indigo-600 hover:text-white focus:outline-none focus:ring-2 focus:ring-indigo-500 active:scale-95 transition-transform group","aria-label":`Copy filename of ${F.filename}`,children:[y.jsx(ci,{className:"h-3.5 w-3.5 text-ink-muted group-hover:text-white"}),y.jsx("span",{className:"truncate",children:"Copy Filename"})]}),y.jsxs("button",{role:"menuitem",onClick:()=>{g(F,!0),e()},className:"flex w-full items-center gap-2 px-3 py-1.5 hover:bg-indigo-600 hover:text-white focus:outline-none focus:ring-2 focus:ring-indigo-500 active:scale-95 transition-transform group","aria-label":`Copy filename of ${F.filename} without extension`,children:[y.jsx(ci,{className:"h-3.5 w-3.5 text-ink-muted group-hover:text-white"}),y.jsx("span",{className:"truncate",children:"Copy Filename (no ext)"})]}),y.jsxs("button",{role:"menuitem",onClick:async()=>{const le=ee(F.path);e();try{await navigator.clipboard.writeText(le),R==null||R(`Copied: ${le}`)}catch(A){R==null||R(`Copy failed: ${(A==null?void 0:A.message)??A}`,"error")}},className:"flex w-full items-center gap-2 px-3 py-1.5 hover:bg-indigo-600 hover:text-white focus:outline-none focus:ring-2 focus:ring-indigo-500 active:scale-95 transition-transform group","aria-label":"Copy Directory",children:[y.jsx(ci,{className:"h-3.5 w-3.5 text-ink-muted group-hover:text-white"}),y.jsx("span",{className:"truncate",children:"Copy Directory"})]}),y.jsxs("button",{role:"menuitem",onClick:()=>{b(F),e()},className:"flex w-full items-center gap-2 px-3 py-1.5 hover:bg-indigo-600 hover:text-white focus:outline-none focus:ring-2 focus:ring-indigo-500 active:scale-95 transition-transform group","aria-label":`Copy URI of ${F.filename}`,children:[y.jsx(ci,{className:"h-3.5 w-3.5 text-ink-muted group-hover:text-white"}),y.jsx("span",{className:"truncate",children:"Copy URI"})]}),y.jsx("div",{className:"my-1 border-t border-line"}),y.jsxs("button",{role:"menuitem",onClick:()=>{v(F,"md5"),e()},className:"flex w-full items-center gap-2 px-3 py-1.5 hover:bg-indigo-600 hover:text-white focus:outline-none focus:ring-2 focus:ring-indigo-500 active:scale-95 transition-transform group","aria-label":`Compute MD5 hash of ${F.filename}`,children:[y.jsx(oa,{className:"h-3.5 w-3.5 text-chip-purple-text group-hover:text-white"}),y.jsx("span",{children:"Compute MD5 Hash"})]}),y.jsxs("button",{role:"menuitem",onClick:()=>{v(F,"sha256"),e()},className:"flex w-full items-center gap-2 px-3 py-1.5 hover:bg-indigo-600 hover:text-white focus:outline-none focus:ring-2 focus:ring-indigo-500 active:scale-95 transition-transform group","aria-label":`Compute SHA256 hash of ${F.filename}`,children:[y.jsx(oa,{className:"h-3.5 w-3.5 text-chip-purple-text group-hover:text-white"}),y.jsx("span",{children:"Compute SHA256 Hash"})]}),y.jsxs("button",{role:"menuitem",onClick:()=>{w(F,"md5"),e()},className:"flex w-full items-center gap-2 px-3 py-1.5 hover:bg-indigo-600 hover:text-white focus:outline-none focus:ring-2 focus:ring-indigo-500 active:scale-95 transition-transform group","aria-label":`Verify MD5 hash of ${F.filename}`,children:[y.jsx(oa,{className:"h-3.5 w-3.5 text-chip-purple-text group-hover:text-white"}),y.jsx("span",{children:"Verify MD5 Hash"})]}),y.jsxs("button",{role:"menuitem",onClick:()=>{w(F,"sha256"),e()},className:"flex w-full items-center gap-2 px-3 py-1.5 hover:bg-indigo-600 hover:text-white focus:outline-none focus:ring-2 focus:ring-indigo-500 active:scale-95 transition-transform group","aria-label":`Verify SHA256 hash of ${F.filename}`,children:[y.jsx(oa,{className:"h-3.5 w-3.5 text-chip-purple-text group-hover:text-white"}),y.jsx("span",{children:"Verify SHA256 Hash"})]}),y.jsx("div",{className:"my-1 border-t border-line"}),y.jsxs("button",{role:"menuitem",onClick:()=>{S(F),e()},className:"flex w-full items-center gap-2 px-3 py-1.5 hover:bg-indigo-600 hover:text-white focus:outline-none focus:ring-2 focus:ring-indigo-500 active:scale-95 transition-transform group","aria-label":`View properties of ${F.filename}`,children:[y.jsx(G0,{className:"h-3.5 w-3.5 text-chip-sky-text group-hover:text-white"}),y.jsx("span",{children:"Properties"})]}),y.jsxs("button",{role:"menuitem",onClick:()=>{C(F),e()},className:"flex w-full items-center gap-2 px-3 py-1.5 hover:bg-indigo-600 hover:text-white focus:outline-none focus:ring-2 focus:ring-indigo-500 active:scale-95 transition-transform group","aria-label":`Remove ${F.filename} from list`,children:[y.jsx(sO,{className:"h-3.5 w-3.5 text-status-danger-text group-hover:text-white"}),y.jsx("span",{children:"Delete"})]})]}),M&&y.jsx("dialog",{ref:z,className:"animate-overlay-in fixed inset-0 z-[var(--z-modal)] flex items-center justify-center bg-black/60 p-4 rounded-xl","aria-labelledby":"args-modal-title",onClick:le=>{le.target===z.current&&I(!1)},onCancel:le=>{le.preventDefault(),I(!1)},children:y.jsxs("div",{className:"animate-modal-in w-96 rounded-xl border border-frame-line glass-panel p-4",children:[y.jsx("h3",{id:"args-modal-title",className:"mb-2 text-sm font-semibold text-ink",children:"Launch with Arguments"}),y.jsx("p",{className:"mb-3 text-xs text-ink-muted truncate",children:F.filename}),y.jsx("input",{type:"text",autoFocus:!0,placeholder:"Arguments (e.g. --verbose --port 80)",value:U,onChange:le=>E(le.target.value),onKeyDown:le=>{le.key==="Enter"&&ne(),le.key==="Escape"&&I(!1)},className:"mb-4 w-full rounded-md border border-line bg-elevated px-3 py-2 text-xs text-ink outline-none focus:border-indigo-500 focus:ring-2 focus:ring-indigo-500","aria-label":"Command line arguments"}),y.jsxs("div",{className:"flex justify-end gap-2",children:[y.jsx("button",{onClick:()=>I(!1),className:"rounded-md px-3 py-1.5 text-xs text-ink-muted hover:bg-elevated hover:text-ink focus:outline-none focus:ring-2 focus:ring-indigo-500","aria-label":"Cancel launch",children:"Cancel"}),y.jsx("button",{onClick:ne,className:"btn btn-primary px-3 py-1.5","aria-label":`Launch ${F.filename} with arguments`,children:"Launch"})]})]})})]})}function F9({isOpen:n,initialPath:e,onClose:t,onSelect:i}){const[l,o]=D.useState(null),[a,u]=D.useState(null),[f,d]=D.useState(""),[m,g]=D.useState(!1),[b,v]=D.useState(null),w=D.useRef(null),S=D.useRef(null),C=D.useRef(null);D.useEffect(()=>{var U;if(!n){(U=C.current)==null||U.focus();return}C.current=document.activeElement instanceof HTMLElement?document.activeElement:null,v(null),N(e||"");const I=requestAnimationFrame(()=>{var E;return(E=S.current)==null?void 0:E.focus()});return()=>{var E;cancelAnimationFrame(I),(E=C.current)==null||E.focus()}},[n]);const N=async I=>{g(!0),v(null);try{const U=await fetch(`/api/fs/browse?path=${encodeURIComponent(I)}`);if(!U.ok)throw new Error("Failed to browse directory");const E=await U.json();o(E),u(E.current_path),d(E.current_path)}catch(U){v(U.message||"Navigation failed")}finally{g(!1)}},R=()=>{const I=f.trim()||a;I&&(i(I),t())},M=I=>{var z;if(I.key==="Escape"){I.preventDefault(),t();return}if(I.key!=="Tab")return;const U=(z=w.current)==null?void 0:z.querySelectorAll('button:not([disabled]), input:not([disabled]), [tabindex]:not([tabindex="-1"])');if(!(U!=null&&U.length))return;const E=U[0],T=U[U.length-1];I.shiftKey&&document.activeElement===E?(I.preventDefault(),T.focus()):!I.shiftKey&&document.activeElement===T&&(I.preventDefault(),E.focus())};return n?y.jsx("div",{className:"animate-overlay-in fixed inset-0 z-[var(--z-modal)] flex items-center justify-center bg-black/65 p-3 backdrop-blur-sm sm:p-6",onClick:t,children:y.jsxs("div",{ref:w,role:"dialog","aria-modal":"true","aria-labelledby":"directory-picker-title",onKeyDown:M,className:"animate-modal-in flex h-[min(84dvh,760px)] max-h-[calc(100dvh-1.5rem)] w-[min(94vw,960px)] min-h-0 flex-col overflow-hidden rounded-xl border border-frame-line glass-panel sm:rounded-2xl",onClick:I=>I.stopPropagation(),children:[y.jsxs("div",{className:"flex items-center justify-between gap-3 border-b border-line px-4 py-3 sm:px-5",children:[y.jsxs("div",{className:"flex min-w-0 items-center gap-2.5",children:[y.jsx("span",{className:"grid h-9 w-9 shrink-0 place-items-center rounded-lg bg-chip-indigo-bg",children:y.jsx(Jl,{className:"h-5 w-5 text-chip-indigo-text"})}),y.jsxs("div",{className:"min-w-0",children:[y.jsx("h2",{id:"directory-picker-title",className:"text-sm font-semibold text-ink",children:"Select a directory"}),y.jsx("p",{className:"truncate font-mono text-xs text-ink-muted",children:(l==null?void 0:l.current_path)||""})]})]}),y.jsx(Qe,{text:"Close",block:!1,children:y.jsx("button",{type:"button",onClick:t,"aria-label":"Close directory picker",className:"grid h-9 w-9 shrink-0 place-items-center rounded-lg text-ink-muted transition-colors hover:bg-elevated hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-indigo-400",children:y.jsx(Ei,{className:"h-4 w-4"})})})]}),y.jsxs("div",{className:"border-b border-line px-4 py-3 sm:px-5",children:[y.jsx("label",{htmlFor:"directory-picker-path",className:"mb-1.5 block text-xs font-medium text-ink-secondary",children:"Location"}),y.jsxs("div",{className:"flex min-w-0 items-center gap-1.5",children:[y.jsx("input",{ref:S,id:"directory-picker-path",type:"text",value:f,onChange:I=>d(I.target.value),onKeyDown:I=>{I.key==="Enter"&&N(f.trim())},placeholder:"/path/to/directory",className:"h-10 min-w-0 flex-1 rounded-lg border border-line bg-elevated px-2.5 font-mono text-sm text-ink outline-none placeholder:text-ink-faint transition-colors hover:bg-surface-strong focus-visible:border-indigo-500 focus-visible:ring-2 focus-visible:ring-indigo-500/30"}),y.jsx("button",{type:"button",onClick:()=>N(f.trim()),className:"inline-flex h-10 shrink-0 items-center gap-1.5 rounded-lg border border-line bg-elevated px-3.5 text-sm font-medium text-ink-secondary transition-colors hover:bg-surface-strong hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-indigo-400",children:"Go"}),y.jsx(Qe,{text:"Home directory",block:!1,children:y.jsx("button",{type:"button",onClick:()=>N(""),"aria-label":"Home directory",className:"grid h-10 w-10 shrink-0 place-items-center rounded-lg border border-line bg-elevated text-ink-secondary transition-colors hover:bg-surface-strong hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-indigo-400",children:y.jsx(Xd,{className:"h-4 w-4"})})}),(l==null?void 0:l.parent_path)&&y.jsx(Qe,{text:"Parent directory",block:!1,children:y.jsx("button",{type:"button",onClick:()=>N(l.parent_path),"aria-label":"Parent directory",className:"grid h-10 w-10 shrink-0 place-items-center rounded-lg border border-line bg-elevated text-ink-secondary transition-colors hover:bg-surface-strong hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-indigo-400",children:y.jsx(Qd,{className:"h-4 w-4 rotate-180"})})})]})]}),y.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto px-2 py-2 sm:px-3 sm:py-3","aria-busy":m,children:m?y.jsxs("div",{className:"flex h-full items-center justify-center gap-2.5 text-sm text-ink-muted",children:[y.jsx(ll,{className:"h-5 w-5 animate-spin text-chip-indigo-text"}),y.jsx("span",{role:"status",children:"Loading directories…"})]}):b?y.jsxs("div",{role:"alert",className:"flex h-full flex-col items-center justify-center gap-2.5 text-center",children:[y.jsx("p",{className:"text-sm text-status-danger-text",children:b}),y.jsx("button",{type:"button",onClick:()=>N(f||(l==null?void 0:l.current_path)||""),className:"min-h-10 rounded-lg border border-line bg-elevated px-3.5 text-sm text-ink-secondary hover:bg-surface-strong hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-indigo-400",children:"Retry"})]}):y.jsxs("ul",{className:"space-y-0.5",children:[l==null?void 0:l.items.filter(I=>I.is_dir).map(I=>y.jsx("li",{children:y.jsxs("button",{type:"button",onClick:()=>N(I.path),onDoubleClick:()=>{d(I.path),i(I.path),t()},className:`flex min-h-10 w-full items-center justify-between rounded-lg px-3 py-1.5 text-left text-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-indigo-400 ${a===I.path?"bg-chip-indigo-bg text-chip-indigo-text":"text-ink-secondary hover:bg-elevated hover:text-ink"}`,children:[y.jsxs("span",{className:"flex min-w-0 items-center gap-2.5",children:[y.jsx(Ou,{className:"h-5 w-5 shrink-0 text-chip-indigo-text"}),y.jsx("span",{className:"truncate",children:I.name})]}),a===I.path&&y.jsx(_r,{className:"h-4 w-4 shrink-0 text-chip-indigo-text"})]})},I.path)),(l==null?void 0:l.items.filter(I=>I.is_dir).length)===0&&y.jsxs("li",{className:"flex h-full min-h-36 flex-col items-center justify-center gap-2.5 text-center text-sm text-ink-muted",children:[y.jsx(Jl,{className:"h-7 w-7 text-ink-faint"}),"No subdirectories found"]})]})}),y.jsxs("div",{className:"flex flex-col gap-2 border-t border-line px-4 py-3 sm:flex-row sm:items-center sm:justify-between sm:px-5",children:[y.jsxs("div",{className:"min-w-0 flex-1",children:[y.jsx("p",{className:"mb-0.5 text-xs font-medium text-ink-muted",children:"Selected folder"}),y.jsx("p",{className:"truncate font-mono text-sm text-ink",title:a||f,children:a||f||"—"})]}),y.jsxs("div",{className:"flex shrink-0 justify-end gap-1.5",children:[y.jsx("button",{type:"button",onClick:t,className:"min-h-10 rounded-lg border border-line bg-elevated px-3.5 text-sm text-ink-secondary transition-colors hover:bg-surface-strong hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-indigo-400",children:"Cancel"}),y.jsxs("button",{type:"button",onClick:R,disabled:!f.trim(),className:"btn btn-primary min-h-10 rounded-lg px-4 text-sm font-semibold",children:[y.jsx(Jl,{className:"h-4 w-4"}),"Select folder"]})]})]})]})}):null}function q9({visible:n,onFileSelected:e}){const t=D.useRef(null);return n?y.jsxs("div",{className:"animate-overlay-in fixed inset-0 z-[var(--z-drop-overlay)] flex items-center justify-center bg-black/65 backdrop-blur-sm",onClick:()=>{var i;return(i=t.current)==null?void 0:i.click()},"data-testid":"drop-config-overlay",children:[y.jsx("input",{ref:t,type:"file",accept:".profiles,.profiles.yaml,.profiles.yml,.yaml,.yml",className:"hidden",onChange:i=>{var o;const l=(o=i.target.files)==null?void 0:o[0];l&&e(l),i.target.value=""}}),y.jsxs("div",{className:"rounded-xl border-2 border-dashed border-chip-indigo-border bg-surface px-8 py-6 text-center shadow-2xl",children:[y.jsx("span",{className:"mx-auto mb-3 grid h-9 w-9 place-items-center rounded-lg bg-chip-indigo-bg",children:y.jsx(sa,{className:"h-5 w-5 text-chip-indigo-text"})}),y.jsx("p",{className:"text-sm font-semibold text-ink",children:"Drop configuration file"}),y.jsx("p",{className:"mt-1 text-xs text-ink-muted",children:".profiles, .profiles.yaml, .yml, .yaml — session-only preview"})]})]}):null}function V9({items:n,columnTemplate:e,resizePointerRef:t,resizeMovedRef:i}){return y.jsx("div",{className:"grid select-none items-center border-b border-l-2 border-l-transparent border-line/40 bg-surface/60 font-medium text-ink-muted shadow-sm backdrop-blur-md",role:"row","aria-rowindex":1,"data-file-list-header":!0,style:{gridTemplateColumns:e},children:n.map((l,o)=>{const a=!!(l.onSort&&l.sortKey),u=l.active?l.direction==="asc"?"ascending":"descending":"none";return y.jsxs("div",{role:"columnheader","data-column-key":l.sortKey,className:`group relative flex items-center gap-1.5 truncate px-3 py-2 ${a?"cursor-pointer hover:text-ink transition-colors":""} ${l.active?"text-ink":""}`,...a?{"aria-sort":u,tabIndex:0,onClick:l.onSort,onKeyDown:f=>{var d;(f.key==="Enter"||f.key===" ")&&(f.preventDefault(),(d=l.onSort)==null||d.call(l))}}:{},children:[l.icon,y.jsx("span",{className:"truncate",children:l.label}),a?l.active?l.direction==="asc"?y.jsx(JM,{className:"ml-auto h-3 w-3 shrink-0 text-chip-indigo-text"}):y.jsx(ZC,{className:"ml-auto h-3 w-3 shrink-0 text-chip-indigo-text"}):y.jsx(Vk,{className:"ml-auto h-3 w-3 shrink-0 opacity-0 transition-opacity group-hover:opacity-40 hover:opacity-40"}):o>0&&y.jsx(Vk,{className:"ml-auto h-3 w-3 shrink-0 opacity-40"}),l.canResize&&l.onResizeBy&&y.jsx("div",{role:"separator","aria-orientation":"vertical","aria-label":`Resize ${l.label} column`,"aria-valuemin":ha,"aria-valuemax":Hd,"aria-valuenow":l.width??l.defaultWidth??sd,"aria-valuetext":`${l.width??l.defaultWidth??sd} pixels wide`,title:"Drag to resize; use arrow keys or click either side to adjust",tabIndex:0,onClick:f=>{var g;f.preventDefault(),f.stopPropagation();const d=i.current;if(i.current=!1,d)return;const m=f.currentTarget.getBoundingClientRect();(g=l.onResizeBy)==null||g.call(l,f.clientX{f.preventDefault(),f.stopPropagation();const d=f.currentTarget.parentElement;i.current=!1,t.current={pointerId:f.pointerId,startX:f.clientX,startWidth:l.width??(d==null?void 0:d.getBoundingClientRect().width)??l.defaultWidth??sd,resizeTo:l.onResizeTo},f.currentTarget.setPointerCapture(f.pointerId)},onPointerMove:f=>{const d=t.current;if(!d||d.pointerId!==f.pointerId)return;const m=f.clientX-d.startX;Math.abs(m)>2&&(i.current=!0),d.resizeTo(d.startWidth+m)},onPointerUp:f=>{var d;((d=t.current)==null?void 0:d.pointerId)===f.pointerId&&(f.currentTarget.releasePointerCapture(f.pointerId),t.current=null,window.setTimeout(()=>{i.current=!1},0))},onPointerCancel:()=>{t.current=null,i.current=!1},onKeyDown:f=>{var d,m;f.stopPropagation(),f.key==="ArrowLeft"||f.key==="ArrowRight"?(f.preventDefault(),(d=l.onResizeBy)==null||d.call(l,f.key==="ArrowLeft"?-Hh:Hh)):(f.key==="Home"||f.key==="End")&&(f.preventDefault(),(m=l.onResizeTo)==null||m.call(l,f.key==="Home"?ha:Hd))},className:"absolute inset-y-0 right-0 z-10 w-3 cursor-col-resize touch-none border-r border-transparent transition-colors hover:border-indigo-400 focus-visible:border-indigo-400 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-indigo-500"})]},o)})})}const Zi=28,Ph=12,M0=500,ha=80,Hd=960,sd=160,Hh=24,U2=44,Ih={File:2,Path:3,FileName:1,Type:1,Version:1};function Q9({files:n,totalCount:e,rawLoadedCount:t,onLoadMore:i,loadingMore:l=!1,scanning:o=!1,hasScanned:a=!1,activeDirectory:u="",recursive:f=!1,onDisableRecursive:d,onOpenDirectory:m,onLoadConfig:g,filterText:b,onClearFilter:v,prefilterNote:w,columnHeaders:S,columnNames:C,selectedIndex:N,onSelectIndex:R,onLaunch:M,onContextMenu:I,rowColors:U,sort:E,onSortChange:T}){const z=["File"],ie=C.length>0?C:z,q=S.length>0?S:ie,J=Array.from({length:Math.max(ie.length,q.length)},(ke,qe)=>({key:ie[qe]??z[0],header:q[qe]??ie[qe]??z[0]})),F=D.useRef(null),[se,he]=D.useState(0),[ne,L]=D.useState(600),[ee,oe]=D.useState(0),[le,A]=D.useState({}),Le=D.useRef(null),_e=D.useRef(!1),B=ie.reduce((ke,qe)=>ke+(Ih[qe]??1),1),j=(ke,qe)=>{const Ie=Math.min(Hd,Math.max(ha,Math.round(qe)));A(at=>({...at,[ke]:Ie}))},$=(ke,qe)=>{var V;const Ie=Array.from(((V=F.current)==null?void 0:V.querySelectorAll("[data-column-key]"))??[]).find(K=>K.dataset.columnKey===ke),at=le[ke]??(Ie==null?void 0:Ie.getBoundingClientRect().width)??sd;j(ke,at+qe)},fe=[`${U2}px`,...ie.map(ke=>le[ke]?`${le[ke]}px`:`minmax(${ha}px, ${Ih[ke]??1}fr)`)].join(" "),me=D.useRef(!1),Ne=D.useRef(null),Te=n.length,ze=t??Te,ve=e??ze,je=ze{const ke=F.current;if(!ke)return;const qe=new ResizeObserver(Ie=>{for(const at of Ie)L(at.contentRect.height),oe(at.contentRect.width)});return qe.observe(ke),L(ke.clientHeight||600),oe(ke.clientWidth||0),()=>qe.disconnect()},[]),D.useEffect(()=>{var K;const ke=F.current;if(!ke||N<0||N>=Te)return;const qe=((K=ke.querySelector("[data-file-list-header]"))==null?void 0:K.offsetHeight)??0,Ie=qe+N*Zi,at=Ie+Zi;let V=ke.scrollTop;Ieke.scrollTop+ke.clientHeight&&(V=at-ke.clientHeight),V!==ke.scrollTop&&(ke.scrollTop=V,he(V))},[N,Te]),D.useEffect(()=>{const ke=F.current;if(!ke)return;const qe=()=>{if(me.current||!Gt||!i)return;const Ie=ke.scrollTop+ke.clientHeight,at=Te*Zi;at-IeIe&&(me.current=!0,window.setTimeout(()=>{me.current=!1},200),i())};return ke.addEventListener("scroll",qe,{passive:!0}),window.addEventListener("scroll",qe,{passive:!0}),()=>{ke.removeEventListener("scroll",qe),window.removeEventListener("scroll",qe)}},[n,Gt,i,Te]),D.useEffect(()=>{if(me.current||!Gt||!i)return;const ke=Te*Zi,qe=se+ne;if(!(ke-qeqe))return;const at=`${Te}:${ze}:${ve}`;Ne.current=at,i()});const un=D.useCallback(ke=>{he(ke.currentTarget.scrollTop)},[]),_t=Math.max(0,Math.floor(se/Zi)-Ph),yt=Math.ceil(ne/Zi)+Ph*2,rt=Math.min(Te,_t+yt),Ut=_t*Zi,zn=(ke,qe)=>{if(qe)return{className:"bg-chip-indigo-bg border-l-4 border-chip-indigo-border text-ink",style:{}};for(const[Ie,at]of U)if(ke.toLowerCase().includes(Ie.toLowerCase()))return{className:"hover:bg-elevated border-l-4 text-ink",style:{borderLeftColor:at,borderLeftWidth:"4px"}};return{className:"border-l-4 border-transparent text-ink-secondary hover:bg-elevated/60",style:{borderLeftColor:"transparent",borderLeftWidth:"4px"}}},Ft=(Gt?Te+yt:Te)*Zi,en="btn btn-secondary px-3 py-1.5";return y.jsxs("div",{ref:F,onScroll:un,className:"flex-1 overflow-auto bg-app text-xs transition-colors duration-200 focus-visible:outline focus-visible:outline-2 focus-visible:outline-indigo-500 focus-visible:outline-offset-[-2px]","data-testid":"file-list","data-loaded-count":ze,"aria-busy":o,role:"grid","aria-label":"Discovered files","aria-rowcount":Math.max(ve,Te===0?1:0)+1,"aria-colcount":ie.length+1,"aria-activedescendant":Te>0?`file-row-${N}`:void 0,tabIndex:0,children:[y.jsx("div",{className:"sticky top-0 z-10",role:"presentation",children:y.jsx(V9,{columnTemplate:fe,resizePointerRef:Le,resizeMovedRef:_e,items:[{label:"#",icon:y.jsx(K0,{className:"h-3.5 w-3.5"})},...J.map(({key:ke,header:qe})=>({label:qe,weight:Ih[ke]??1,width:le[ke],defaultWidth:Math.min(Hd,Math.max(ha,Math.round((ee-U2)*(Ih[ke]??1)/B))),canResize:!0,onResizeBy:Ie=>$(ke,Ie),onResizeTo:Ie=>j(ke,Ie),sortKey:ke,active:(E==null?void 0:E.column)===ke,direction:E==null?void 0:E.direction,onSort:()=>{(E==null?void 0:E.column)!==ke?T({column:ke,direction:"asc"}):E.direction==="asc"?T({column:ke,direction:"desc"}):T(null)}}))]})}),w&&Te>0&&y.jsxs("div",{role:"note","data-testid":"prefilter-note",className:"flex items-center gap-1.5 border-b border-line/40 bg-surface px-3 py-1 text-[11px] text-ink-faint",children:[y.jsx(gy,{className:"h-3 w-3 shrink-0 text-ink-faint","aria-hidden":"true"}),y.jsx("span",{className:"min-w-0 truncate",children:w})]}),Te===0?y.jsx("div",{role:"row","aria-rowindex":2,"data-testid":"file-list-empty",children:y.jsx("div",{role:"gridcell","aria-colspan":ie.length+1,className:"p-8 text-center text-ink-faint",children:o?y.jsxs("div",{className:"flex flex-col items-center gap-2",children:[y.jsx(ll,{className:"h-5 w-5 animate-spin text-chip-indigo-text motion-reduce:animate-none"}),y.jsx("span",{children:"Scanning files..."})]}):!u.trim()&&g?y.jsxs("div",{className:"flex flex-col items-center gap-3",children:[y.jsx("span",{children:"Select a directory first."}),y.jsx("button",{type:"button",onClick:g,className:en,children:"Choose configuration"})]}):a?b.trim()?y.jsxs("div",{className:"flex flex-col items-center gap-3",children:[y.jsxs("span",{children:["No files match “",b,"”."]}),y.jsxs("div",{className:"flex flex-wrap items-center justify-center gap-2",children:[y.jsx("button",{type:"button",onClick:v,className:en,children:"Clear filter"}),f&&d&&y.jsx("button",{type:"button",onClick:d,className:en,children:"Turn off recursive"}),m&&y.jsx("button",{type:"button",onClick:m,className:en,children:"Open directory"})]})]}):y.jsxs("div",{className:"flex flex-col items-center gap-3",children:[y.jsx("span",{children:"No files found for the current directory and extension."}),y.jsxs("div",{className:"flex flex-wrap items-center justify-center gap-2",children:[f&&d&&y.jsx("button",{type:"button",onClick:d,className:en,children:"Turn off recursive"}),m&&y.jsx("button",{type:"button",onClick:m,className:en,children:"Open directory"})]})]}):y.jsx("span",{children:"Select a directory and scan to find files."})})}):y.jsxs("div",{className:"relative",style:{height:Ft},role:"rowgroup",children:[l&&y.jsx("div",{className:"pointer-events-none absolute left-1/2 top-2 z-20 -translate-x-1/2","aria-hidden":"true",children:y.jsx(ll,{className:"h-4 w-4 animate-spin text-chip-indigo-text"})}),y.jsx("div",{style:{transform:`translateY(${Ut}px)`},"data-testid":"file-list-window",role:"presentation",children:n.slice(_t,rt).map((ke,qe)=>{const Ie=_t+qe,at=Ie===N,V=zn(ke.filename,at);return y.jsxs("div",{id:`file-row-${Ie}`,"data-row-index":Ie,role:"row","aria-rowindex":Ie+2,"aria-selected":at,onClick:()=>{var K;R(Ie),(K=F.current)==null||K.focus()},onDoubleClick:()=>M(ke),onContextMenu:K=>I(K,ke,Ie),className:`grid cursor-pointer items-center transition-colors ${V.className}`,style:{...V.style,height:Zi,gridTemplateColumns:fe},children:[y.jsxs("div",{className:"flex items-center justify-end gap-1 px-3 font-mono text-ink-faint",children:[ke.has_hook&&y.jsx("span",{title:ke.hook_pattern?`Launch workflow: ${ke.hook_pattern}`:"Launch workflow configured","aria-label":"Workflow hook attached",className:"inline-flex items-center text-status-warning-text hover:brightness-95",children:y.jsx(oO,{className:"h-3 w-3 shrink-0"})}),y.jsx("span",{className:"hidden sm:inline",children:Ie+1})]}),ie.map((K,de)=>{const Se=ke.column_values[K]||(K==="File"?ke.filename:"-");return y.jsx("div",{role:"gridcell","data-column-key":K,className:"truncate px-3 font-mono",style:{minWidth:ha},title:K==="Path"?ke.path:Se,children:Se},de)})]},ke.path||Ie)})}),je&&y.jsxs("div",{className:"pointer-events-none absolute bottom-2 left-1/2 -translate-x-1/2 rounded-full border border-line bg-surface-strong px-3 py-1 text-[11px] text-ink-muted shadow","data-testid":"file-list-paging",children:[l?y.jsx(YM,{className:"mr-1.5 h-4 w-4 animate-spin motion-reduce:animate-none text-ink-muted"}):null,"(",ze," of ",ve," loaded)"]})]})]})}function Zx({id:n,ariaLabel:e,value:t,options:i,onChange:l,placeholder:o,className:a="",inputClassName:u="",optionLabel:f=m=>m,onOpenChange:d}){const m=D.useId(),g=D.useRef(null),[b,v]=D.useState(!1),[w,S]=D.useState(""),[C,N]=D.useState(-1),R=i.filter(T=>f(T).toLocaleLowerCase().includes(w.toLocaleLowerCase())),M=C>=0&&R[C]?`${m}-option-${C}`:void 0;D.useEffect(()=>{const T=z=>{var ie;(ie=g.current)!=null&&ie.contains(z.target)||v(!1)};return document.addEventListener("mousedown",T),()=>document.removeEventListener("mousedown",T)},[]),D.useEffect(()=>{d==null||d(b)},[b,d]),D.useEffect(()=>{var T;C<0||(T=document.getElementById(`${m}-option-${C}`))==null||T.scrollIntoView({block:"nearest"})},[C,m]);const I=()=>{S(""),N(-1),v(!0)},U=T=>{l(T),S(""),N(-1),v(!1)},E=T=>{if(T.key==="ArrowDown"){if(T.preventDefault(),!b){I(),N(0);return}N(z=>Math.min(z+1,R.length-1))}else if(T.key==="ArrowUp"){if(T.preventDefault(),!b){I(),N(R.length-1);return}N(z=>z<=0?R.length-1:z-1)}else T.key==="Enter"&&b&&R[C]!==void 0?(T.preventDefault(),U(R[C])):T.key==="Escape"&&v(!1)};return y.jsxs("div",{ref:g,onBlur:T=>{var z;(z=g.current)!=null&&z.contains(T.relatedTarget)||v(!1)},className:`relative flex min-w-0 ${a}`,children:[y.jsx("input",{id:n,type:"text",role:"combobox","aria-label":e,"aria-autocomplete":"list","aria-expanded":b,"aria-controls":m,"aria-activedescendant":M,value:t,placeholder:o,onChange:T=>{l(T.target.value),S(T.target.value),N(-1),v(!0)},onKeyDown:E,className:`min-w-0 flex-1 rounded-l-md border border-line bg-elevated px-3 py-1.5 text-ink outline-none transition-colors hover:bg-surface-strong focus:border-indigo-500 ${u}`}),y.jsx("button",{type:"button","aria-label":`Show ${e.toLowerCase()} options`,"aria-expanded":b,title:`Show ${e.toLowerCase()} options`,onMouseDown:T=>T.preventDefault(),onClick:()=>b?v(!1):I(),className:"shrink-0 rounded-r-md border border-l-0 border-line bg-elevated px-2 text-ink-muted hover:bg-surface-strong hover:text-ink focus-visible:z-10 focus-visible:outline focus-visible:outline-2 focus-visible:outline-indigo-500 transition-colors",children:y.jsx(o4,{className:`h-3.5 w-3.5 transition-transform ${b?"rotate-180":""}`})}),b&&y.jsx("ul",{id:m,role:"listbox","aria-label":`${e} options`,className:"absolute left-0 top-full z-[var(--z-combobox-list)] mt-1 max-h-60 w-full min-w-48 overflow-y-auto rounded-md border border-line bg-surface py-1 text-ink shadow-xl",children:R.length>0?R.map((T,z)=>{const ie=f(T),q=z===C,J=T===t;return y.jsx("li",{id:`${m}-option-${z}`,role:"option","aria-selected":J,title:ie||void 0,onMouseEnter:()=>N(z),onMouseDown:F=>F.preventDefault(),onClick:()=>U(T),className:`cursor-pointer truncate px-3 py-1.5 ${q?"bg-elevated text-ink":"text-ink-secondary"} ${J?"font-semibold":""}`,children:ie||"(No filter)"},`${T}-${z}`)}):y.jsx("li",{className:"px-3 py-1.5 text-ink-muted",children:"No matching presets"})})]})}function X9({title:n,release:e,directories:t,activeDirectory:i,onDirectoryChange:l,onBrowseDirectory:o,onGoToParentDirectory:a,onGoToHomeDirectory:u,onOpenActiveDirectory:f,onOpenTerminal:d}){const[m,g]=D.useState(!1);return y.jsxs("header",{className:"relative z-30 flex flex-wrap items-center gap-3 border-b border-line bg-app/90 px-5 py-2 text-xs backdrop-blur-xl shadow-xs transition-all duration-200",children:[y.jsx("div",{className:"flex shrink-0 items-center gap-3",children:y.jsxs("div",{className:"flex items-center gap-3.5",children:[y.jsxs("div",{className:"relative flex h-9 w-9 items-center justify-center rounded-xl bg-gradient-to-br from-chip-indigo-bg to-chip-purple-bg text-chip-indigo-text border border-chip-indigo-border shadow-xs",children:[y.jsx(W0,{className:"h-4 w-4"}),y.jsx("span",{className:"absolute -bottom-0.5 -right-0.5 flex h-2.5 w-2.5 items-center justify-center rounded-full bg-emerald-500 ring-2 ring-app"})]}),y.jsxs("div",{children:[y.jsxs("div",{className:"flex items-center gap-2",children:[y.jsx("h1",{className:"text-sm font-bold tracking-tight text-ink font-heading",children:"ProFiles"}),n&&y.jsxs(y.Fragment,{children:[y.jsx("span",{className:"text-ink-faint",children:"/"}),y.jsx("span",{className:"text-xs font-medium text-chip-indigo-text bg-chip-indigo-bg px-2 py-0.5 rounded-md border border-chip-indigo-border/50",children:n})]})]}),y.jsxs("p",{className:"text-[11px] font-medium text-ink-muted tracking-wide mt-0.5",children:["Crafted by ",y.jsx("span",{className:"text-ink font-semibold",children:"Florent ALBANY"})," • ",y.jsxs("span",{className:"font-mono text-chip-indigo-text",children:["v",e||"0.11.0-rc.2"]})]})]})]})}),y.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-2",children:[y.jsxs("label",{className:"flex shrink-0 items-center gap-1.5 font-medium text-ink-secondary text-xs",children:[y.jsx(Ou,{className:"h-3.5 w-3.5 text-chip-indigo-text"}),y.jsx("span",{children:"Directory:"})]}),y.jsx(Qe,{text:"Select or type a directory path to scan files from.",suppress:m,children:y.jsx(Zx,{id:"directory-combobox",ariaLabel:"Directory",value:i,options:t,onChange:l,onOpenChange:g,placeholder:"/path/to/directory",className:"w-full",inputClassName:"font-mono"})}),f&&y.jsx(Qe,{text:"Open the active directory in the OS file manager",block:!1,children:y.jsx("button",{type:"button",onClick:f,"aria-label":"Open active directory",className:"btn btn-secondary shrink-0 p-1.5",children:y.jsx(KM,{className:"h-3.5 w-3.5"})})}),a&&y.jsx(Qe,{text:"Go to parent directory",block:!1,children:y.jsx("button",{type:"button",onClick:a,"aria-label":"Go to parent directory",className:"btn btn-secondary shrink-0 p-1.5",children:y.jsx(Qd,{className:"h-3.5 w-3.5 rotate-180"})})}),o&&y.jsx(Qe,{text:"Browse for a folder on this system",block:!1,children:y.jsx("button",{type:"button",onClick:o,"aria-label":"Browse directory",className:"btn btn-secondary shrink-0 p-1.5",children:y.jsx(Jl,{className:"h-3.5 w-3.5"})})}),d&&y.jsx(Qe,{text:"Open the active directory in a terminal",block:!1,children:y.jsx("button",{type:"button",onClick:()=>d(i),"aria-label":"Open directory in terminal",className:"btn btn-secondary shrink-0 p-1.5",children:y.jsx(W0,{className:"h-3.5 w-3.5"})})}),u&&y.jsx(Qe,{text:"Set directory to your home folder",block:!1,children:y.jsx("button",{type:"button",onClick:u,"aria-label":"Go to home directory",className:"btn btn-secondary shrink-0 p-1.5",children:y.jsx(Xd,{className:"h-3.5 w-3.5"})})})]})]})}function $9({message:n,onRetry:e,retrying:t=!1}){return y.jsx("div",{className:"flex flex-1 items-center justify-center p-8",role:"alert","data-testid":"init-error-panel",children:y.jsxs("div",{className:"w-full max-w-sm rounded-xl border border-line bg-surface p-6 text-center shadow-xl",children:[y.jsx("div",{className:"mx-auto mb-3 flex h-10 w-10 items-center justify-center rounded-full border border-status-danger-border bg-status-danger-bg",children:y.jsx(Gc,{className:"h-5 w-5 text-status-danger-text/80"})}),y.jsx("h3",{className:"text-sm font-semibold text-ink",children:"Couldn't load the app"}),y.jsx("p",{className:"mt-1 break-words text-xs text-ink-secondary",children:n}),y.jsxs("button",{type:"button",onClick:e,disabled:t,className:"btn btn-primary mx-auto mt-4 px-3.5 py-1.5 font-semibold shadow-sm",children:[y.jsx($d,{className:`h-3.5 w-3.5 ${t?"animate-spin motion-reduce:animate-none":""}`}),y.jsx("span",{children:t?"Retrying...":"Retry"})]})]})})}const F2=/"([^"]*)"|(\S+)/g,q2=/"([^"]*)"/g,Y9="Unmatched quote";function G9(n){const e=[];let t;for(F2.lastIndex=0;(t=F2.exec(n))!==null;){const a=t[1]!==void 0?t[1]:t[2];a&&a.trim()&&e.push(a)}let i="",l=0;q2.lastIndex=0;let o;for(;(o=q2.exec(n))!==null;)i+=n.slice(l,o.index),l=o.index+o[0].length;return i+=n.slice(l),{terms:e,error:i.includes('"')?Y9:null}}function mA(n){const e=n.trim();if(!e)return{error:null,groups:[]};const{terms:t,error:i}=G9(e);if(t.length===0)return{error:i,groups:[]};const l=[];let o={includes:[],excludes:[]};for(const a of t){if(a.toUpperCase()==="OR"){l.push(o),o={includes:[],excludes:[]};continue}a==="-"||a==="+"||(a.startsWith("-")&&a.length>1?o.excludes.push(a.slice(1)):a.startsWith("+")&&a.length>1?o.includes.push(a.slice(1)):o.includes.push(a))}return l.push(o),{error:i,groups:l}}const K9=256,Fs=new Map;function V2(n){return n.toLowerCase()}function W9(n){const e=Fs.get(n);if(e)return Fs.delete(n),Fs.set(n,e),e;const{groups:t}=mA(n),i={groups:t.map(l=>({includes:l.includes.map(V2),excludes:l.excludes.map(V2)}))};if(Fs.size>=K9){const l=Fs.keys().next().value;l!==void 0&&Fs.delete(l)}return Fs.set(n,i),i}function Z9(n,e){return e.includes.every(t=>n.includes(t))&&!e.excludes.some(t=>n.includes(t))}function J9(n,e){const{groups:t}=W9(e);if(t.length===0)return!0;const i=n.toLowerCase();return t.some(l=>Z9(i,l))}function e8({query:n,visible:e}){if(!e)return null;const t=mA(n);return t.error?y.jsx("div",{"data-testid":"filter-syntax-helper",className:"pointer-events-none absolute left-0 right-0 top-full z-[var(--z-syntax-helper)] mt-1 rounded-md border border-status-danger-border bg-surface-strong px-3 py-2 text-[11px] leading-5 text-status-danger-text/90 shadow-xl",children:t.error}):t.groups.length===0?null:y.jsxs("div",{"data-testid":"filter-syntax-helper",className:"pointer-events-none absolute left-0 right-0 top-full z-[var(--z-syntax-helper)] mt-1 rounded-md border border-line bg-surface-strong px-3 py-2 text-[11px] leading-5 text-ink-secondary shadow-xl",children:[y.jsx("span",{className:"mr-1.5 align-[1px] text-[10px] uppercase tracking-wide text-ink-muted",children:"reads as"}),t.groups.map((i,l)=>y.jsxs("span",{"data-testid":"filter-syntax-group",children:[l>0&&y.jsx("span",{className:"mx-1 font-mono text-chip-indigo-text",children:"OR"}),i.includes.map((o,a)=>y.jsxs("span",{children:[a>0&&y.jsx("span",{className:"text-ink-muted",children:" · "}),y.jsx("span",{className:"font-mono text-chip-indigo-text",children:o})]},`i-${a}`)),i.includes.length>0&&i.excludes.length>0&&y.jsx("span",{className:"text-ink-muted",children:" · "}),i.excludes.map((o,a)=>y.jsxs("span",{children:[a>0&&y.jsx("span",{className:"text-ink-muted",children:" · "}),y.jsx("span",{className:"text-ink-muted",children:"✕ "}),y.jsx("span",{className:"font-mono text-status-danger-text/70 line-through",children:o})]},`x-${a}`))]},l))]})}const Q2=y.jsxs("span",{className:"flex flex-col gap-1 whitespace-nowrap text-left",children:[y.jsx("span",{className:"font-semibold",children:"Supported operators"}),y.jsxs("span",{children:[y.jsx("code",{className:"font-mono text-chip-indigo-text",children:"a b"})," — AND (both terms)"]}),y.jsxs("span",{children:[y.jsx("code",{className:"font-mono text-chip-indigo-text",children:"a OR b"})," — either term"]}),y.jsxs("span",{children:[y.jsx("code",{className:"font-mono text-chip-indigo-text",children:"-a"})," — NOT (exclude)"]}),y.jsxs("span",{children:[y.jsx("code",{className:"font-mono text-chip-indigo-text",children:"+a"})," — force include"]}),y.jsxs("span",{children:[y.jsx("code",{className:"font-mono text-chip-indigo-text",children:'"a b"'})," — exact phrase"]})]});function t8({extensions:n,activeExtension:e,onExtensionChange:t,filterOptions:i,filterText:l,onFilterTextChange:o,recursive:a,onRecursiveChange:u,onScan:f,scanning:d,barcodeMode:m,onBarcodeToggle:g,onCameraBarcodeClick:b,autoRescanActive:v,onTimerClick:w}){const[S,C]=D.useState(!1),[N,R]=D.useState(!1),[M,I]=D.useState(!1);return y.jsxs("div",{className:"flex w-full flex-wrap items-center gap-3 border-b border-line bg-surface-glass p-3 text-xs",children:[y.jsx(Qe,{text:Q2,suppress:N,children:y.jsxs("div",{className:"relative min-w-0 flex-1 basis-64",onFocusCapture:U=>{U.target.tagName==="INPUT"&&C(!0)},onBlurCapture:U=>{U.target.tagName==="INPUT"&&C(!1)},children:[y.jsx(rO,{className:"pointer-events-none absolute left-3 top-1/2 z-10 h-4 w-4 -translate-y-1/2 text-ink-secondary"}),y.jsx(Zx,{id:"filter-combobox",ariaLabel:"File filter",value:l,options:i||[],onChange:o,onOpenChange:R,placeholder:"Filter files: keyword, a OR b, -tag, exact phrase...",className:"w-full",inputClassName:"pl-9 pr-3",optionLabel:U=>U||"(No filter)"}),y.jsx(e8,{query:l,visible:S&&!N&&l.trim().length>0})]})}),y.jsx(Qe,{text:Q2,block:!1,suppress:M,children:y.jsxs("div",{className:"flex shrink-0 items-center gap-1.5",children:[y.jsx("span",{className:"text-ink-muted",children:"Ext:"}),y.jsx(Zx,{id:"extension-combobox",ariaLabel:"Extension filter",value:e,options:n,onChange:t,onOpenChange:I,placeholder:".py OR .toml",className:"w-44",inputClassName:"font-mono px-2.5"})]})}),y.jsx(Qe,{text:"Include subdirectories when scanning",block:!1,children:y.jsxs("label",{className:"flex shrink-0 cursor-pointer select-none items-center gap-1.5 text-ink-secondary",children:[y.jsx("input",{type:"checkbox",checked:a,onChange:U=>u(U.target.checked),className:"rounded border-line text-chip-indigo-text focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-indigo-500 focus-visible:ring-offset-1 focus-visible:ring-offset-app"}),y.jsx("span",{children:"Recursive"})]})}),y.jsx(Qe,{text:"Run the scan with the current criteria (Enter)",block:!1,children:y.jsxs("button",{onClick:f,disabled:d,className:"btn btn-primary shrink-0 px-3.5 py-1.5 font-semibold shadow-sm",children:[d?y.jsx($d,{className:"h-3.5 w-3.5 animate-spin motion-reduce:animate-none"}):y.jsx(ts,{className:"h-3.5 w-3.5 fill-current"}),y.jsx("span",{children:d?"Scanning...":"Scan"})]})}),y.jsx(Qe,{text:v?"Auto-rescan is active. Click to configure.":"Configure periodic auto-rescan (hot-folder mode)",block:!1,children:y.jsx("button",{type:"button",onClick:w,"aria-label":"Configure timer / auto-rescan",className:`flex shrink-0 items-center justify-center rounded-md border p-1.5 text-ink-secondary hover:border-indigo-500 hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-indigo-500 transition-colors ${v?"border-chip-indigo-border bg-chip-indigo-bg text-chip-indigo-text":"border-line bg-elevated"}`,children:y.jsx(lO,{className:`h-3.5 w-3.5 ${v?"animate-pulse":""}`})})}),y.jsx(Qe,{text:"Toggle barcode scanner mode (USB HID). When active, scan a barcode to auto-fill controls and trigger a scan.",block:!1,children:y.jsx("button",{type:"button",onClick:g,"aria-label":m?"Disable barcode mode":"Enable barcode mode",className:`flex shrink-0 items-center justify-center rounded-md border p-1.5 text-ink-secondary hover:border-indigo-500 hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-indigo-500 transition-colors ${m?"border-chip-indigo-border bg-chip-indigo-bg text-chip-indigo-text":"border-line bg-elevated"}`,children:y.jsx(xy,{className:`h-3.5 w-3.5 ${m?"animate-pulse":""}`})})}),b&&y.jsx(Qe,{text:"Scan barcode or QR code using webcam / camera (Ctrl + Shift + B)",block:!1,children:y.jsx("button",{type:"button",onClick:b,"aria-label":"Scan barcode with camera",className:"btn btn-secondary shrink-0 p-1.5",children:y.jsx(JC,{className:"h-3.5 w-3.5"})})})]})}const n8=2e3,i8=500,r8=[{value:null,label:"ALL"},{value:"DEBUG",label:"DEBUG"},{value:"INFO",label:"INFO"},{value:"WARNING",label:"WARNING"},{value:"ERROR",label:"ERROR"},{value:"CRITICAL",label:"CRITICAL"}],X2={DEBUG:{icon:t4,className:"text-chip-sky-text"},INFO:{icon:gy,className:"text-status-success-text"},WARNING:{icon:yy,className:"text-status-warning-text"},ERROR:{icon:ou,className:"text-status-danger-text"},CRITICAL:{icon:ou,className:"text-status-danger-text"},UNKNOWN:{icon:ka,className:"text-ink-faint"}};function l8({isOpen:n,onClose:e,onOpenExternally:t}){const[i,l]=D.useState([]),[o,a]=D.useState("profiles.log"),[u,f]=D.useState(0),[d,m]=D.useState(null),[g,b]=D.useState(""),[v,w]=D.useState(!1),[S,C]=D.useState(!0),[N,R]=D.useState(null),[M,I]=D.useState(!0),U=D.useRef(null),E=D.useRef(null),T=D.useRef(null),z=D.useRef(null),ie=D.useRef(S),q=D.useRef({level:d,search:g});ie.current=S,q.current={level:d,search:g};const J=D.useCallback(async()=>{const{level:L,search:ee}=q.current;w(!0);try{const oe=await bM({limit:i8,level:L,search:ee});l(oe.entries),a(oe.path),f(oe.size_bytes),R(null)}catch(oe){R((oe==null?void 0:oe.message)||"Failed to read the log file")}finally{w(!1)}},[]);D.useEffect(()=>{n&&J()},[n,J]),D.useEffect(()=>{if(!n||!S)return;const L=window.setInterval(()=>{J()},n8);return()=>window.clearInterval(L)},[n,S,J]),D.useEffect(()=>{if(!n)return;const L=window.setTimeout(()=>void J(),250);return()=>window.clearTimeout(L)},[n,d,g,J]),D.useEffect(()=>{if(!M)return;const L=T.current;L&&(L.scrollTop=L.scrollHeight)},[i,M]),D.useEffect(()=>{if(!n)return;const L=document.activeElement instanceof HTMLElement?document.activeElement:null,ee=requestAnimationFrame(()=>{var oe;return(oe=E.current)==null?void 0:oe.focus()});return()=>{cancelAnimationFrame(ee),L==null||L.focus()}},[n]);const F=L=>{var A;if(L.key==="Escape"){L.preventDefault(),e();return}if(L.key!=="Tab")return;const ee=(A=U.current)==null?void 0:A.querySelectorAll('button:not([disabled]), input:not([disabled]), [tabindex]:not([tabindex="-1"])');if(!(ee!=null&&ee.length))return;const oe=ee[0],le=ee[ee.length-1];L.shiftKey&&document.activeElement===oe?(L.preventDefault(),le.focus()):!L.shiftKey&&document.activeElement===le&&(L.preventDefault(),oe.focus())},se=()=>{const L=T.current;if(!L)return;const ee=L.scrollHeight-L.scrollTop-L.clientHeight<24;I(ee)},he=async()=>{try{await navigator.clipboard.writeText(i.map(L=>L.raw).join(` +`))}catch{}},ne=D.useMemo(()=>{const L=new Map;for(const ee of i)L.set(ee.level,(L.get(ee.level)??0)+1);return L},[i]);return n?y.jsx("div",{className:"animate-overlay-in fixed inset-0 z-[var(--z-modal)] flex items-center justify-center bg-black/65 p-3 backdrop-blur-sm sm:p-6",onClick:e,children:y.jsxs("div",{ref:U,role:"dialog","aria-modal":"true","aria-labelledby":"log-viewer-title",onKeyDown:F,className:"animate-modal-in flex h-[min(84dvh,760px)] w-[clamp(560px,85vw,1500px)] min-h-0 flex-col overflow-hidden rounded-xl border border-frame-line glass-panel sm:rounded-2xl",onClick:L=>L.stopPropagation(),children:[y.jsxs("div",{className:"flex flex-wrap items-center gap-3 border-b border-line px-5 py-4 sm:px-6",children:[y.jsxs("div",{className:"flex min-w-0 items-center gap-3",children:[y.jsx("span",{className:"grid h-10 w-10 shrink-0 place-items-center rounded-lg bg-chip-indigo-bg",children:y.jsx(ka,{className:"h-5 w-5 text-chip-indigo-text","aria-hidden":"true"})}),y.jsxs("div",{className:"min-w-0",children:[y.jsx("h2",{id:"log-viewer-title",className:"text-base font-semibold text-ink",children:"Application logs"}),y.jsxs("p",{className:"truncate font-mono text-xs text-ink-muted",children:[o,y.jsxs("span",{className:"text-ink-faint",children:[" · ",$2(u)]})]})]})]}),y.jsxs("div",{className:"relative min-w-[220px] flex-1",children:[y.jsx(rO,{className:"pointer-events-none absolute left-2.5 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-ink-faint","aria-hidden":"true"}),y.jsx("input",{ref:z,type:"search",value:g,onChange:L=>b(L.target.value),placeholder:"Filter log lines…","aria-label":"Filter log lines",className:"w-full rounded-lg border border-line bg-elevated py-1.5 pl-8 pr-2.5 font-mono text-xs text-ink placeholder:text-ink-faint focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-indigo-400"})]}),y.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[y.jsx(Qe,{text:S?"Pause live tail":"Resume live tail",block:!1,children:y.jsxs("button",{type:"button",onClick:()=>C(L=>!L),"aria-pressed":S,className:`flex items-center gap-1.5 rounded-lg border px-2.5 py-1.5 text-xs font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-indigo-400 ${S?"border-status-success-border bg-status-success-bg text-status-success-text":"border-line bg-elevated text-ink-muted hover:text-ink"}`,children:[y.jsx("span",{className:`h-2 w-2 rounded-full ${S?"bg-emerald-400":"bg-ink-faint"}`,"aria-hidden":"true"}),S?"Live":"Paused"]})}),y.jsx(Qe,{text:"Refresh now",block:!1,children:y.jsx("button",{type:"button",onClick:()=>void J(),disabled:v,className:"rounded-lg border border-line bg-elevated p-2 text-ink-muted hover:text-ink disabled:opacity-50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-indigo-400",children:y.jsx($d,{className:`h-4 w-4 ${v?"animate-spin":""}`,"aria-hidden":"true"})})}),y.jsx(Qe,{text:"Copy visible lines",block:!1,children:y.jsx("button",{type:"button",onClick:()=>void he(),disabled:i.length===0,className:"rounded-lg border border-line bg-elevated p-2 text-ink-muted hover:text-ink disabled:opacity-50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-indigo-400",children:y.jsx(ci,{className:"h-4 w-4","aria-hidden":"true"})})}),y.jsx(Qe,{text:"Open log file in the default application",block:!1,children:y.jsx("button",{type:"button",onClick:()=>{t==null||t(),e()},className:"rounded-lg border border-line bg-elevated p-2 text-ink-muted hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-indigo-400",children:y.jsx(tO,{className:"h-4 w-4","aria-hidden":"true"})})}),y.jsx(Qe,{text:"Close",block:!1,children:y.jsx("button",{ref:E,type:"button",onClick:e,className:"rounded-lg p-2 text-ink-muted hover:bg-hover-surface hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-indigo-400",children:y.jsx(Ei,{className:"h-4 w-4","aria-hidden":"true"})})})]})]}),y.jsxs("div",{ref:T,onScroll:se,className:"min-h-0 flex-1 overflow-y-auto overscroll-contain bg-app px-2 py-2 font-mono text-xs leading-relaxed sm:px-3",children:[y.jsxs("div",{className:"sticky top-0 z-10 mb-1 flex items-center gap-2 rounded-md border border-line/40 bg-surface/60 px-2 py-1 text-[10px] font-bold uppercase tracking-wider text-ink-muted shadow-sm backdrop-blur-md",role:"row",children:[y.jsx("span",{className:"h-3.5 w-3.5 shrink-0","aria-hidden":"true"}),y.jsx("span",{className:"w-[138px] shrink-0 text-ink/70",children:"Time"}),y.jsx("span",{className:"w-[52px] shrink-0 text-ink/70",children:"Level"}),y.jsx("span",{className:"w-[150px] shrink-0 text-ink/70",children:"Source"}),y.jsx("span",{className:"min-w-0 flex-1 text-ink/70",children:"Message"})]}),N&&y.jsx("p",{role:"alert",className:"px-3 py-6 text-center text-xs text-status-danger-text",children:N}),!N&&i.length===0&&!v&&y.jsx("p",{className:"px-3 py-6 text-center text-xs text-ink-faint",children:"No log entries match the current filters."}),y.jsx("ul",{className:"space-y-0.5",children:i.map((L,ee)=>{const oe=X2[L.level]??X2.UNKNOWN,le=oe.icon,A=L.level==="ERROR"||L.level==="CRITICAL";return y.jsxs("li",{className:`group flex items-start gap-2 rounded px-2 py-1 ${A?"bg-status-danger-bg/40":"hover:bg-elevated/50"}`,children:[y.jsx("span",{className:oe.className,children:y.jsx(le,{className:"mt-0.5 h-3.5 w-3.5","aria-hidden":"true"})}),y.jsx("span",{className:"w-[138px] shrink-0 text-ink-faint",children:L.timestamp}),y.jsx("span",{className:`w-[52px] shrink-0 text-[10px] font-semibold ${oe.className}`,children:L.level}),y.jsx("span",{className:"w-[150px] shrink-0 truncate text-ink-faint",title:L.source,children:L.source}),y.jsx("span",{className:"min-w-0 flex-1 break-words text-ink-secondary",children:L.message})]},`${ee}-${L.raw}`)})})]}),y.jsx("div",{className:"border-t border-line/60 bg-elevated/50 px-5 py-2.5 text-[11px] text-ink-faint shadow-sm backdrop-blur-md sm:px-6",children:y.jsxs("div",{className:"flex flex-wrap items-center gap-x-4 gap-y-2",children:[y.jsx("span",{className:"mr-auto min-w-0 max-w-full basis-full truncate sm:basis-auto",role:"status","aria-atomic":"true",children:v&&i.length===0?"Loading log entries…":`${i.length} of ${$2(u)} shown`}),y.jsxs("div",{className:"flex items-center gap-2",children:[y.jsx("div",{className:"flex overflow-hidden rounded-lg border border-line/60 text-[11px] backdrop-blur-sm",role:"group","aria-label":"Filter by log level",children:r8.map(L=>{const ee=d===L.value,oe=L.value?ne.get(L.value)??0:i.length;return y.jsxs("button",{type:"button",onClick:()=>m(L.value),"aria-pressed":ee,title:L.value?`Show ${L.value} and above`:"Show all levels",className:`flex items-center gap-1 px-2.5 py-1 font-semibold transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-indigo-400 ${ee?"bg-indigo-600 text-white":"text-ink-muted hover:bg-elevated hover:text-ink"}`,children:[L.label,y.jsx("span",{className:ee?"text-chip-indigo-text":"text-ink-faint",children:oe})]},L.label)})}),y.jsx(Qe,{text:"Scroll to the newest entry",block:!1,children:y.jsxs("button",{type:"button",onClick:()=>I(!0),"aria-pressed":M,className:`flex items-center gap-1.5 rounded-lg border px-2.5 py-1 text-xs font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-indigo-400 ${M?"border-chip-indigo-border bg-chip-indigo-bg text-chip-indigo-text":"border-line bg-elevated text-ink-muted hover:text-ink"}`,children:[y.jsx(ZC,{className:"h-3.5 w-3.5","aria-hidden":"true"}),y.jsx("span",{className:"hidden sm:inline",children:"Follow tail"})]})})]}),y.jsxs("span",{className:"hidden items-center gap-1.5 lg:flex",children:[y.jsx("span",{className:"hidden sm:inline",children:"Ctrl + Shift + L"}),y.jsx("span",{children:"opens externally"})]})]})})]})}):null}function $2(n){return n<1024?`${n} B`:n<1024*1024?`${(n/1024).toFixed(1)} KB`:`${(n/(1024*1024)).toFixed(1)} MB`}function s8({isOpen:n,onClose:e}){const t=D.useRef(null),i=hs({isOpen:n,onClose:e,dialogRef:t});if(!n)return null;const l=[{key:"F5",desc:"Refresh / re-scan file list"},{key:"Ctrl + R",desc:"Reload configuration & scan"},{key:"Enter",desc:"Execute / launch selected file"},{key:"P",desc:"Open properties for selected file"},{key:"↑ / ↓",desc:"Navigate file list"},{key:"Home / End",desc:"Jump to first / last file"},{key:"PageUp / PageDown",desc:"Page through the file list"},{key:"Ctrl + D",desc:"Focus Directory field"},{key:"Ctrl + E",desc:"Focus Extension field"},{key:"Ctrl + F",desc:"Focus Filter / Search field"},{key:"Ctrl + L",desc:"Focus File List"},{key:"Ctrl + Shift + L",desc:"Open the log viewer"},{key:"Ctrl + ,",desc:"Open the config editor"},{key:"Ctrl + Shift + T",desc:"Toggle theme (Dark / Light)"},{key:"Ctrl + B",desc:"Toggle barcode scanner mode"},{key:"Ctrl + Shift + B",desc:"Open webcam / camera barcode scanner"},{key:"Ctrl + T",desc:"Open auto-rescan timer modal"},{key:"Ctrl + H",desc:"Set directory to home folder"},{key:"? or Ctrl + /",desc:"Show keyboard shortcuts"},{key:"Y / S / N",desc:"Answer workflow guard: Yes / Skip / No (prompt open)"},{key:"Enter",desc:"Confirm active workflow prompt (prompt open)"},{key:"Escape",desc:"Close dialogs / context menu"}];return y.jsx("div",{className:"animate-overlay-in fixed inset-0 z-[var(--z-modal)] flex items-center justify-center bg-black/60 p-4 backdrop-blur-sm",children:y.jsxs("div",{ref:t,role:"dialog","aria-modal":"true","aria-label":"Keyboard Shortcuts",onKeyDown:i,className:"animate-modal-in w-[450px] max-w-full rounded-2xl border border-frame-line glass-panel p-5",children:[y.jsxs("div",{className:"mb-4 flex items-center justify-between border-b border-line pb-3",children:[y.jsxs("div",{className:"flex items-center gap-2 font-semibold text-ink",children:[y.jsx(nO,{className:"h-5 w-5 text-chip-indigo-text"}),y.jsx("span",{children:"Keyboard Shortcuts"})]}),y.jsx("button",{onClick:e,className:"focus-ring rounded-lg p-1 text-ink-muted hover:bg-elevated hover:text-ink",children:y.jsx(Ei,{className:"h-4 w-4"})})]}),y.jsx("div",{className:"max-h-[60vh] space-y-2 overflow-y-auto pr-1 text-xs",children:l.map(({key:o,desc:a})=>y.jsxs("div",{className:"flex items-center justify-between rounded-lg bg-elevated/50 px-3 py-2",children:[y.jsx("span",{className:"text-ink-secondary",children:a}),y.jsx("kbd",{className:"rounded bg-app px-2 py-0.5 font-mono text-[11px] font-semibold text-chip-indigo-text border border-line",children:o})]},o))}),y.jsx("div",{className:"mt-5 flex justify-end",children:y.jsx("button",{onClick:e,className:"btn btn-primary rounded-lg px-4 py-2 font-semibold",children:"Close"})})]})})}function o8({isOpen:n,activeConfigPath:e,configExists:t=!0,onClose:i,onLoaded:l}){const[o,a]=D.useState(null),[u,f]=D.useState(""),[d,m]=D.useState(null),[g,b]=D.useState(!1),[v,w]=D.useState(null),S=D.useRef(null),C=D.useRef(null),N=D.useRef(null),R=t===!1;D.useEffect(()=>{var J;if(!n){(J=N.current)==null||J.focus();return}N.current=document.activeElement instanceof HTMLElement?document.activeElement:null,w(null);const T=e??"",z=Math.max(T.lastIndexOf("/"),T.lastIndexOf("\\")),ie=z>0?T.slice(0,z):"";M(ie);const q=requestAnimationFrame(()=>{var F;return(F=C.current)==null?void 0:F.focus()});return()=>{var F;cancelAnimationFrame(q),(F=N.current)==null||F.focus()}},[n,e]);const M=async T=>{b(!0),w(null);try{const z=await AM(T);a(z),f(z.current_path),e&&z.items.some(ie=>ie.path===e)?m(e):m(null)}catch(z){w(z.message||"Navigation failed")}finally{b(!1)}},I=T=>{var J;if(T.key==="Escape"){T.preventDefault(),i();return}if(T.key!=="Tab")return;const z=(J=S.current)==null?void 0:J.querySelectorAll('button:not([disabled]), input:not([disabled]), [tabindex]:not([tabindex="-1"])');if(!(z!=null&&z.length))return;const ie=z[0],q=z[z.length-1];T.shiftKey&&document.activeElement===ie?(T.preventDefault(),q.focus()):!T.shiftKey&&document.activeElement===q&&(T.preventDefault(),ie.focus())},U=async()=>{var z;const T=d||(((z=o==null?void 0:o.items.find(ie=>ie.is_config))==null?void 0:z.path)??null);if(!T){w("Select a configuration file to load.");return}try{b(!0);const ie=await kM(T);l(ie),i()}catch(ie){w(ie.message||"Unable to load configuration")}finally{b(!1)}},E=async()=>{const T=(u||(o==null?void 0:o.current_path)||"").trim();if(!T){w("Choose a directory before creating a configuration.");return}try{b(!0);const z=await CM(T);l(z),i()}catch(z){w(z.message||"Unable to create configuration")}finally{b(!1)}};return n?y.jsx("div",{className:"animate-overlay-in fixed inset-0 z-[var(--z-modal)] flex items-center justify-center bg-black/65 p-3 backdrop-blur-sm sm:p-6",onClick:i,children:y.jsxs("div",{ref:S,role:"dialog","aria-modal":"true","aria-labelledby":"load-config-title",onKeyDown:I,className:"animate-modal-in flex h-[min(84dvh,760px)] max-h-[calc(100dvh-1.5rem)] w-[min(94vw,960px)] min-h-0 flex-col overflow-hidden rounded-xl border border-frame-line glass-panel sm:rounded-2xl",onClick:T=>T.stopPropagation(),children:[y.jsxs("div",{className:"flex items-center justify-between gap-3 border-b border-line px-4 py-3 sm:px-5",children:[y.jsxs("div",{className:"flex min-w-0 items-center gap-2.5",children:[y.jsx("span",{className:"grid h-9 w-9 shrink-0 place-items-center rounded-lg bg-chip-indigo-bg",children:y.jsx(sa,{className:"h-5 w-5 text-chip-indigo-text"})}),y.jsxs("div",{className:"min-w-0",children:[y.jsx("h2",{id:"load-config-title",className:"text-sm font-semibold text-ink",children:R?"Create configuration":"Load configuration"}),y.jsx("p",{className:"truncate font-mono text-xs text-ink-muted",children:(o==null?void 0:o.current_path)||""})]})]}),y.jsx(Qe,{text:"Close",block:!1,children:y.jsx("button",{type:"button",onClick:i,"aria-label":"Close configuration modal",className:"grid h-9 w-9 shrink-0 place-items-center rounded-lg text-ink-muted transition-colors hover:bg-elevated hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-indigo-400",children:y.jsx(Ei,{className:"h-4 w-4"})})})]}),R&&y.jsx("div",{className:"border-b border-line bg-chip-indigo-bg/20 px-4 py-3 text-xs text-ink-secondary",children:"No configuration file was found. Create one here?"}),y.jsxs("div",{className:"border-b border-line px-4 py-3 sm:px-5",children:[y.jsx("label",{htmlFor:"config-path-input",className:"mb-1.5 block text-xs font-medium text-ink-secondary",children:"Configuration directory"}),y.jsxs("div",{className:"flex min-w-0 items-center gap-1.5",children:[y.jsx("input",{ref:C,id:"config-path-input",type:"text",value:u,onChange:T=>f(T.target.value),onKeyDown:T=>{T.key==="Enter"&&M(u.trim())},placeholder:"/path/to/directory",className:"h-10 min-w-0 flex-1 rounded-lg border border-line bg-elevated px-2.5 font-mono text-sm text-ink outline-none placeholder:text-ink-faint transition-colors hover:bg-surface-strong focus-visible:border-indigo-500 focus-visible:ring-2 focus-visible:ring-indigo-500/30"}),y.jsx("button",{type:"button",onClick:()=>M(u.trim()),className:"inline-flex h-10 shrink-0 items-center gap-1.5 rounded-lg border border-line bg-elevated px-3.5 text-sm font-medium text-ink-secondary transition-colors hover:bg-surface-strong hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-indigo-400",children:"Go"}),y.jsx(Qe,{text:"Home directory",block:!1,children:y.jsx("button",{type:"button",onClick:()=>M(""),"aria-label":"Home directory",className:"grid h-10 w-10 shrink-0 place-items-center rounded-lg border border-line bg-elevated text-ink-secondary transition-colors hover:bg-surface-strong hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-indigo-400",children:y.jsx(Xd,{className:"h-4 w-4"})})}),(o==null?void 0:o.parent_path)&&y.jsx(Qe,{text:"Parent directory",block:!1,children:y.jsx("button",{type:"button",onClick:()=>M(o.parent_path),"aria-label":"Parent directory",className:"grid h-10 w-10 shrink-0 place-items-center rounded-lg border border-line bg-elevated text-ink-secondary transition-colors hover:bg-surface-strong hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-indigo-400",children:y.jsx(Qd,{className:"h-4 w-4 rotate-180"})})})]})]}),y.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto px-2 py-2 sm:px-3 sm:py-3","aria-busy":g,children:g?y.jsxs("div",{className:"flex h-full items-center justify-center gap-2.5 text-sm text-ink-muted",children:[y.jsx(ll,{className:"h-5 w-5 animate-spin text-chip-indigo-text"}),y.jsx("span",{role:"status",children:"Loading configuration files…"})]}):v?y.jsxs("div",{role:"alert",className:"flex h-full flex-col items-center justify-center gap-2.5 text-center",children:[y.jsx("p",{className:"text-sm text-status-danger-text",children:v}),y.jsx("button",{type:"button",onClick:()=>M(u||(o==null?void 0:o.current_path)||""),className:"min-h-10 rounded-lg border border-line bg-elevated px-3.5 text-sm text-ink-secondary hover:bg-surface-strong hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-indigo-400",children:"Retry"})]}):y.jsxs("ul",{className:"space-y-1",children:[o==null?void 0:o.items.map(T=>{if(T.is_dir)return y.jsx("li",{children:y.jsx("button",{onClick:()=>M(T.path),onDoubleClick:()=>M(T.path),className:"flex w-full items-center justify-between rounded-md px-3 py-1.5 text-left text-xs text-ink-secondary hover:bg-elevated",children:y.jsxs("span",{className:"flex items-center gap-2",children:[y.jsx(Ou,{className:"h-3.5 w-3.5 text-chip-indigo-text"}),T.name]})})},T.path);const z=d===T.path;return y.jsx("li",{children:y.jsxs("button",{type:"button",onClick:()=>m(T.path),"aria-pressed":z,className:`flex w-full items-center justify-between rounded-lg px-3 py-1.5 text-left text-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-indigo-400 ${z?"bg-chip-indigo-bg text-chip-indigo-text":"text-ink-secondary hover:bg-elevated hover:text-ink"}`,children:[y.jsxs("span",{className:"flex min-w-0 items-center gap-2.5",children:[y.jsx(ka,{className:"h-5 w-5 shrink-0 text-chip-amber-text"}),y.jsx("span",{className:"truncate",children:T.name})]}),T.is_config&&y.jsx(sa,{className:"h-4 w-4 shrink-0 text-chip-indigo-text"}),z&&y.jsx(_r,{className:"h-4 w-4 shrink-0 text-chip-indigo-text"})]})},T.path)}),(o==null?void 0:o.items.filter(T=>T.is_config).length)===0&&y.jsxs("li",{className:"flex h-full min-h-36 flex-col items-center justify-center gap-2.5 text-center text-sm text-ink-muted",children:[y.jsx(ka,{className:"h-7 w-7 text-ink-faint"}),"No configuration files found"]})]})}),y.jsxs("div",{className:"flex flex-col gap-2 border-t border-line px-4 py-3 sm:flex-row sm:items-center sm:justify-between sm:px-5",children:[y.jsxs("div",{className:"min-w-0 flex-1",children:[y.jsx("p",{className:"mb-0.5 text-xs font-medium text-ink-muted",children:"Selected file"}),y.jsx("p",{className:"truncate font-mono text-sm text-ink",title:d||u,children:d||u||"—"})]}),y.jsxs("div",{className:"flex shrink-0 justify-end gap-1.5",children:[y.jsx("button",{type:"button",onClick:i,className:"min-h-10 rounded-lg border border-line bg-elevated px-3.5 text-sm text-ink-secondary transition-colors hover:bg-surface-strong hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-indigo-400",children:"Cancel"}),R?y.jsxs("button",{type:"button",onClick:E,disabled:!u.trim(),className:"btn btn-primary min-h-10 rounded-lg px-4 text-sm font-semibold",children:[y.jsx(sa,{className:"h-4 w-4"}),"Create configuration"]}):y.jsxs("button",{type:"button",onClick:U,disabled:!d,className:"btn btn-primary min-h-10 rounded-lg px-4 text-sm font-semibold",children:[y.jsx(sa,{className:"h-4 w-4"}),"Load configuration"]})]})]})]})}):null}function pA({isOpen:n,onClose:e,initialFilePath:t,md5:i}){const[l,o]=D.useState(null),[a,u]=D.useState(""),[f,d]=D.useState([]),[m,g]=D.useState(!1),[b,v]=D.useState(null),[w,S]=D.useState(!1),[C,N]=D.useState(!1),[R,M]=D.useState(null),I=D.useRef(null),U=hs({isOpen:n,onClose:e,dialogRef:I});D.useEffect(()=>{if(!n)return;async function ne(){if(t){g(!0);try{const L=await Uk({filePath:t});o(L.image),u(L.content),E(L.content)}catch(L){v(L.message)}finally{g(!1)}}}ne()},[n,t]);const E=ne=>{const L=ne.split(";").map(ee=>{const oe=ee.split("=");return{key:oe[0]||"",value:oe[1]||""}}).filter(ee=>ee.key||ee.value);d(L)},T=async ne=>{const L=ne.filter(ee=>ee.key.trim()).map(ee=>`${ee.key.trim()}=${ee.value.trim()}`).join(";");if(u(L),!L){o(null);return}try{const ee=await Uk({content:L});o(ee.image)}catch(ee){console.error("Failed to re-generate barcode:",ee)}},z=(ne,L,ee)=>{const oe=[...f];oe[ne][L]=ee,d(oe),T(oe)},ie=()=>{const ne=[...f,{key:"",value:""}];d(ne)},q=ne=>{const L=f.filter((ee,oe)=>oe!==ne);d(L),T(L)},J=()=>{if(!i||f.some(L=>L.key.toLowerCase()==="md5"))return;const ne=[...f,{key:"md5",value:i}];d(ne),T(ne)},F=async()=>{if(l){M("Saving…");try{const ne=await _M(l,`profiles-qr-${Date.now()}.png`);M(ne.path||ne.message)}catch(ne){M(`Save failed: ${(ne==null?void 0:ne.message)??ne}`)}finally{setTimeout(()=>M(null),6e3)}}},se=async()=>{try{await navigator.clipboard.writeText(a),S(!0),setTimeout(()=>S(!1),2e3)}catch(ne){console.error("Copy failed",ne)}},he=async()=>{if(l)try{const L=await(await fetch(l)).blob();await navigator.clipboard.write([new ClipboardItem({[L.type]:L})]),N(!0),setTimeout(()=>N(!1),2e3)}catch(ne){console.error("Image copy failed",ne)}};return n?y.jsx("div",{className:"animate-overlay-in fixed inset-0 z-[var(--z-modal)] flex items-center justify-center bg-black/60 p-4",onClick:e,children:y.jsxs("div",{ref:I,role:"dialog","aria-modal":"true","aria-label":"QR Code Settings",onKeyDown:U,className:"animate-modal-in w-full max-w-md rounded-xl border border-frame-line glass-panel p-6",onClick:ne=>ne.stopPropagation(),children:[y.jsxs("div",{className:"mb-4 flex items-center justify-between",children:[y.jsx("h3",{className:"text-sm font-semibold text-ink",children:"QR Code Settings"}),y.jsx("button",{onClick:e,className:"focus-ring rounded-md p-1 text-ink-muted hover:bg-elevated hover:text-ink",children:y.jsx(Ei,{className:"h-4 w-4"})})]}),m?y.jsx("div",{className:"flex h-48 items-center justify-center",children:y.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-2 border-indigo-600 border-t-transparent"})}):b?y.jsx("div",{className:"rounded-md border border-status-danger-border bg-status-danger-bg p-4 text-center text-xs text-status-danger-text",children:b}):y.jsxs("div",{className:"space-y-6",children:[y.jsxs("div",{className:"flex flex-col items-center gap-4",children:[y.jsxs("div",{className:"relative group",children:[y.jsx("div",{className:"h-48 w-48 overflow-hidden rounded-lg border border-line bg-white p-2",children:l?y.jsx("img",{src:l,alt:"QR Code",className:"h-full w-full object-contain"}):y.jsx("div",{className:"flex h-full items-center justify-center text-xs text-slate-400",children:"No content"})}),l&&y.jsx("div",{className:"absolute inset-0 flex items-center justify-center opacity-0 group-hover:opacity-100 transition-opacity bg-black/20 rounded-lg",children:y.jsxs("button",{onClick:he,className:"focus-ring flex items-center gap-2 rounded-md bg-white/90 p-2 text-xs font-medium text-slate-900 shadow-sm hover:bg-white",children:[C?y.jsx(_r,{className:"h-3.5 w-3.5"}):y.jsx(ci,{className:"h-3.5 w-3.5"}),C?"Copied":"Copy Image"]})})]}),y.jsxs("div",{className:"flex w-full gap-2",children:[y.jsxs("button",{onClick:se,className:"btn btn-secondary flex-1 px-3 py-1.5",children:[w?y.jsx(_r,{className:"h-3.5 w-3.5 text-status-success-text"}):y.jsx(ci,{className:"h-3.5 w-3.5"}),"Copy Content"]}),y.jsxs("button",{onClick:F,disabled:!l,className:"btn btn-primary flex-1 px-3 py-1.5",children:[y.jsx(eO,{className:"h-3.5 w-3.5"}),"Save Image"]})]}),R&&y.jsx("p",{className:"break-all text-center text-[11px] text-ink-muted",role:"status",children:R})]}),y.jsxs("div",{className:"space-y-3",children:[y.jsxs("div",{className:"flex items-center justify-between",children:[y.jsx("label",{className:"text-xs font-medium text-ink-muted uppercase tracking-wider",children:"Payload Fields"}),y.jsxs("div",{className:"flex gap-2",children:[i&&!f.some(ne=>ne.key==="md5")&&y.jsxs("button",{onClick:J,className:"btn-chip flex items-center gap-1 rounded px-2 py-0.5 text-[10px] font-bold text-chip-purple-text border border-chip-purple-border",children:[y.jsx(oa,{className:"h-3 w-3"})," Inc. MD5"]}),y.jsxs("button",{onClick:ie,className:"btn-chip flex items-center gap-1 rounded px-2 py-0.5 text-[10px] font-bold text-chip-indigo-text border border-chip-indigo-border",children:[y.jsx(lD,{className:"h-3 w-3"})," Add Field"]})]})]}),y.jsxs("div",{className:"max-h-48 space-y-2 overflow-y-auto pr-1 custom-scrollbar",children:[f.map((ne,L)=>y.jsxs("div",{className:"flex gap-2 items-center slide-in",children:[y.jsx("input",{type:"text",placeholder:"key",value:ne.key,onChange:ee=>z(L,"key",ee.target.value),className:"w-1/3 rounded border border-line bg-elevated px-2 py-1 text-xs text-ink focus:border-indigo-500 focus:outline-none"}),y.jsx("input",{type:"text",placeholder:"value",value:ne.value,onChange:ee=>z(L,"value",ee.target.value),className:"flex-1 rounded border border-line bg-elevated px-2 py-1 text-xs text-ink focus:border-indigo-500 focus:outline-none"}),y.jsx("button",{onClick:()=>q(L),className:"p-1 text-ink-muted hover:text-status-danger-text transition-colors","aria-label":"Remove field",children:y.jsx(sO,{className:"h-3.5 w-3.5"})})]},L)),f.length===0&&y.jsx("p",{className:"text-center py-4 text-xs text-ink-muted italic",children:"No fields defined"})]})]}),y.jsxs("div",{className:"pt-2 border-t border-line",children:[y.jsx("label",{className:"text-[10px] font-medium text-ink-muted uppercase tracking-wider block mb-1.5",children:"Raw Preview"}),y.jsx("div",{className:"rounded bg-elevated p-2 font-mono text-[10px] text-ink-secondary break-all border border-line",children:a||y.jsx("span",{className:"italic text-ink-muted/50",children:"empty"})})]})]})]})}):null}const Y2=["Bytes","KB","MB","GB","TB"];function gA(n){if(n===0)return"0 Bytes";const e=1024,t=Math.max(0,Math.min(Y2.length-1,Math.floor(Math.log(n)/Math.log(e))));return parseFloat((n/Math.pow(e,t)).toFixed(2))+" "+Y2[t]}function a8(n){const e=Math.max(n.lastIndexOf("\\"),n.lastIndexOf("/"));return e===-1?"":n.slice(0,e)}function c8(n){const e=[`File Properties: ${n.name}`,`Path: ${n.path}`,`Type: ${n.type}`,`Size: ${gA(n.size_bytes)}`,`Created: ${n.created}`,`Modified: ${n.modified}`];return n.md5&&e.push(`MD5: ${n.md5}`),n.sha256&&e.push(`SHA256: ${n.sha256}`),e.join(` +`)}function D0(n,e,t){return n.length<=e+t+1?n:`${n.slice(0,e)}…${n.slice(-t)}`}function u8(n){const e=n.includes("\\")?"\\":"/",t=n.split(/[\\/]/);return t.length<=5?n:[t[0],t[1],"…",t[t.length-2],t[t.length-1]].join(e)}const f8=[{ms:1e3*60,unit:"minute"},{ms:1e3*60*60,unit:"hour"},{ms:1e3*60*60*24,unit:"day"},{ms:1e3*60*60*24*30,unit:"month"},{ms:1e3*60*60*24*365,unit:"year"}];function G2(n,e=new Date){const t=new Date(n.replace(" ","T"));if(Number.isNaN(t.getTime()))return"just now";const i=e.getTime()-t.getTime();if(i<6e4)return"just now";let l="just now";for(const{ms:o,unit:a}of f8){if(i{var F;n||((F=M.current)==null||F.focus(),v(!1))},[n]),D.useEffect(()=>{if(!n||!e)return;const F=new AbortController;return I.current=F,o(null),N(null),u(!0),d(null),(async()=>{try{const se=await jM(e.path,F.signal);if(I.current!==F)return;o(se)}catch(se){if(I.current!==F||se instanceof DOMException&&se.name==="AbortError")return;d(se instanceof Error?se.message:"Failed to load properties")}finally{I.current===F&&u(!1)}})(),()=>{I.current=null,F.abort()}},[n,e]),D.useEffect(()=>{if(!n)return;const F=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=F}},[n]),D.useEffect(()=>{if(!n)return;const F=se=>{if(se.key==="Escape"){if(b)return;t();return}if(se.key!=="Tab")return;const he=R.current;if(!he)return;const ne=Array.from(he.querySelectorAll('button:not([disabled]), [href], input, select, textarea, [tabindex]:not([tabindex="-1"])')).filter(le=>le.offsetParent!==null);if(ne.length===0)return;const L=ne[0],ee=ne[ne.length-1],oe=document.activeElement instanceof HTMLElement?document.activeElement:null;se.shiftKey?(oe===L||!he.contains(oe))&&(se.preventDefault(),ee.focus()):oe===ee&&(se.preventDefault(),L.focus())};return window.addEventListener("keydown",F),()=>window.removeEventListener("keydown",F)},[n,b,t]),D.useEffect(()=>{if(!n)return;const F=document.activeElement instanceof HTMLElement?document.activeElement:null;M.current=F;const se=requestAnimationFrame(()=>{var he,ne;(ne=(he=R.current)==null?void 0:he.querySelector("button"))==null||ne.focus()});return()=>cancelAnimationFrame(se)},[n]);const U=async(F,se)=>{try{await navigator.clipboard.writeText(F),g(se),setTimeout(()=>g(null),2e3)}catch(he){console.error("Failed to copy:",he)}},E=async(F,se,he)=>{S(F),N(null);try{await he(),N(se)}catch{N("Action failed")}finally{S(null)}},T=F=>`btn btn-chip rounded-md border px-3 py-2 text-xs ${{reveal:"bg-chip-sky-bg text-chip-sky-text border-chip-sky-border",launch:"border-emerald-500/30 bg-emerald-600 font-semibold text-white hover:bg-emerald-500",folder:"bg-chip-amber-bg text-chip-amber-text border-chip-amber-border"}[F]??"bg-chip-indigo-bg text-chip-indigo-text border-chip-indigo-border"}`,z=(F,se,he,ne=!1,L)=>y.jsxs("div",{className:"flex items-start gap-2 py-1.5 group",children:[y.jsxs("span",{className:"text-ink-muted min-w-[100px] text-xs",children:[F,":"]}),y.jsx("div",{className:"flex-1 min-w-0",children:y.jsx("span",{className:`text-ink text-xs break-all ${ne?"font-mono":""}`,children:L??se})}),y.jsx(Qe,{text:"Copy to clipboard",block:!1,children:y.jsx("button",{onClick:()=>U(se,he),className:"opacity-0 group-hover:opacity-100 transition-opacity p-1 rounded hover:bg-elevated","aria-label":`Copy ${F}`,children:m===he?y.jsx(_r,{className:"h-3.5 w-3.5 text-status-success-text"}):y.jsx(ci,{className:"h-3.5 w-3.5 text-ink-muted"})})})]}),ie=(F,se,he)=>y.jsxs("div",{className:"rounded-lg border border-line bg-elevated p-4",children:[y.jsxs("div",{className:"mb-1 flex items-center gap-2",children:[se,y.jsx("span",{className:"text-xs font-semibold uppercase tracking-wide text-ink-muted",children:F})]}),he]}),q=()=>y.jsx(Qe,{text:"Click to copy full path",children:y.jsxs("button",{onClick:()=>void U(l.path,"path"),className:"group mb-3 flex w-full items-center gap-2 rounded-lg border border-line bg-elevated px-3 py-2 text-left hover:bg-surface",children:[y.jsx(Ou,{className:"text-chip-amber-text h-4 w-4 flex-shrink-0"}),y.jsx("span",{className:"text-ink min-w-0 flex-1 truncate font-mono text-xs",children:u8(l.path)}),m==="path"?y.jsx(_r,{className:"text-status-success-text h-3.5 w-3.5"}):y.jsx(ci,{className:"text-ink-muted h-3.5 w-3.5"})]})});if(!n||!e)return null;const J=e;return y.jsxs("div",{className:"animate-overlay-in fixed inset-0 z-[var(--z-modal)] flex items-center justify-center bg-black/60 backdrop-blur-md p-4",role:"dialog","aria-modal":"true","aria-labelledby":"properties-modal-title",children:[y.jsx("div",{className:"absolute inset-0",onClick:t,onContextMenu:F=>{F.preventDefault(),t()}}),y.jsxs("div",{ref:R,className:"animate-modal-in relative w-full max-w-4xl max-h-[90vh] overflow-hidden rounded-xl border border-frame-line glass-panel flex flex-col",children:[y.jsx("div",{className:"flex-shrink-0 border-b border-line px-6 py-4",children:y.jsxs("div",{className:"flex items-start justify-between gap-4",children:[y.jsxs("div",{className:"flex items-center gap-3 flex-1 min-w-0",children:[y.jsx("div",{className:"rounded-lg bg-indigo-600 p-2 flex-shrink-0",children:y.jsx(Wg,{className:"h-5 w-5 text-white"})}),y.jsxs("div",{className:"min-w-0 flex-1",children:[y.jsx("h3",{id:"properties-modal-title",className:"text-base font-semibold text-ink truncate",children:"File Properties"}),y.jsx("p",{className:"text-xs text-ink-muted truncate",children:e.filename})]}),y.jsx(Qe,{text:"Copy all properties to clipboard",block:!1,children:y.jsx("button",{onClick:()=>{l&&U(c8(l),"all")},disabled:!l||a||f!==null,className:"btn-chip ml-2 flex items-center gap-1 rounded-md border border-chip-indigo-border bg-chip-indigo-bg p-1.5 text-chip-indigo-text","aria-label":"Copy all properties",children:m==="all"?y.jsx(_r,{className:"h-4 w-4 text-status-success-text"}):y.jsx(ci,{className:"h-4 w-4"})})}),y.jsx(Qe,{text:"Generate Barcode/QR Code",block:!1,children:y.jsx("button",{onClick:()=>v(!0),className:"btn-chip rounded-md border border-chip-indigo-border bg-chip-indigo-bg p-1.5 text-chip-indigo-text",children:y.jsx(xy,{className:"h-4 w-4"})})})]}),y.jsx("button",{onClick:t,className:"focus-ring rounded-md p-1 text-ink-muted hover:bg-elevated hover:text-ink flex-shrink-0","aria-label":"Close",children:y.jsx(Ei,{className:"h-4 w-4"})})]})}),y.jsxs("div",{className:"flex-1 overflow-y-auto px-6 py-4",children:[a&&y.jsx("div",{className:"flex items-center justify-center py-8",children:y.jsxs("div",{className:"flex flex-col items-center gap-2",children:[y.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-2 border-indigo-600 border-t-transparent"}),y.jsx("p",{className:"text-xs text-ink-muted",children:"Loading properties..."})]})}),f&&y.jsx("div",{className:"rounded-lg border border-status-danger-border bg-status-danger-bg p-4 text-center",children:y.jsx("p",{className:"text-xs text-status-danger-text",children:f})}),l&&!a&&!f&&y.jsxs("div",{children:[y.jsxs("div",{className:"mb-2 flex flex-wrap items-center gap-x-4 gap-y-1.5 rounded-lg border border-line bg-elevated px-4 py-2.5",children:[y.jsx("span",{className:"inline-flex items-center gap-1 rounded-md border border-chip-indigo-border bg-chip-indigo-bg px-2 py-0.5 text-xs font-semibold text-chip-indigo-text",children:l.type}),l.attributes.extension&&y.jsx("span",{className:"inline-flex items-center rounded-md border border-line bg-surface px-2 py-0.5 text-xs font-medium text-ink-muted",children:l.attributes.extension}),y.jsxs("span",{className:"text-xs text-ink-muted",title:`${l.size_bytes} bytes`,children:["Size ",y.jsx("strong",{className:"text-ink font-medium",children:gA(l.size_bytes)})]}),y.jsxs("span",{className:"text-xs text-ink-muted",title:l.created,children:["Created ",y.jsx("strong",{className:"text-ink font-medium",children:G2(l.created)})]}),y.jsxs("span",{className:"text-xs text-ink-muted",title:l.modified,children:["Modified ",y.jsx("strong",{className:"text-ink font-medium",children:G2(l.modified)})]}),l.md5&&y.jsx("span",{className:"inline-flex items-center rounded-md border border-chip-purple-border bg-chip-purple-bg px-2 py-0.5 font-mono text-xs font-medium text-chip-purple-text",title:`MD5 ${l.md5}`,children:D0(l.md5,4,4)}),l.attributes.is_symlink&&y.jsxs("span",{className:"inline-flex items-center gap-1 rounded-md border border-chip-fuchsia-border bg-chip-fuchsia-bg px-2 py-0.5 text-xs font-medium text-chip-fuchsia-text",children:[y.jsx(G4,{className:"h-3 w-3"})," Symlink"]})]}),q(),y.jsxs("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2",children:[ie("Hashes",y.jsx(oa,{className:"text-chip-purple-text h-3.5 w-3.5"}),y.jsxs("div",{className:"space-y-0.5",children:[z("MD5",l.md5,"md5",!0,D0(l.md5,10,6)),z("SHA256",l.sha256,"sha256",!0,D0(l.sha256,10,6))]})),ie("Timestamps",y.jsx(i4,{className:"text-chip-sky-text h-3.5 w-3.5"}),y.jsxs("div",{className:"space-y-0.5",children:[z("Created",l.created,"created",!0),z("Modified",l.modified,"modified",!0)]})),ie("Identity",y.jsx(Wg,{className:"text-chip-indigo-text h-3.5 w-3.5"}),y.jsxs("div",{className:"space-y-0.5",children:[z("Type",l.type,"type"),l.attributes.stem&&z("Stem",l.attributes.stem,"attrStem"),z("Extension",l.name.includes(".")?l.name.slice(l.name.lastIndexOf(".")):"None","extension"),z("Directory",a8(l.path)||"None","directory",!0)]})),ie("System",y.jsx(Wg,{className:"text-status-success-text h-3.5 w-3.5"}),y.jsxs("div",{children:[y.jsxs("div",{className:"mb-1 flex min-h-[24px] flex-wrap items-center gap-1.5",children:[l.attributes.is_readonly&&y.jsxs("span",{className:"inline-flex items-center gap-1 rounded-md border border-status-danger-border bg-status-danger-bg px-2 py-0.5 text-xs text-status-danger-text",children:[y.jsx(Z4,{className:"h-3 w-3"})," Read-only"]}),l.attributes.is_hidden&&y.jsxs("span",{className:"inline-flex items-center gap-1 rounded-md border border-slate-500/30 bg-slate-600/20 px-2 py-0.5 text-xs text-slate-300",children:[y.jsx(N4,{className:"h-3 w-3"})," Hidden"]}),!l.attributes.is_readonly&&!l.attributes.is_hidden&&!l.attributes.is_symlink&&y.jsx("span",{className:"text-xs text-ink-muted",children:"No special flags"})]}),y.jsxs("div",{className:"space-y-0.5",children:[z("File Type",l.attributes.is_file?"Regular File":l.attributes.is_dir?"Directory":"Other","fileType"),l.attributes.permissions&&z("Permissions",l.attributes.permissions,"permissions",!0),l.attributes.owner_uid!==void 0&&z("Owner UID",String(l.attributes.owner_uid),"ownerUid"),l.attributes.group_gid!==void 0&&z("Group GID",String(l.attributes.group_gid),"groupGid")]})]}))]})]})]}),y.jsx("div",{className:"flex-shrink-0 border-t border-line px-6 py-3",children:y.jsxs("div",{className:"flex justify-between items-center gap-2",children:[y.jsx("p",{className:"min-w-0 text-xs text-ink-muted truncate",children:C??"Click the copy icon next to any field to copy its value"}),y.jsxs("div",{className:"flex items-center gap-2 whitespace-nowrap",children:[y.jsx(Qe,{text:"Show file in Explorer",block:!1,children:y.jsxs("button",{onClick:()=>void E("reveal","Revealed in Explorer",()=>KC(J.path)),disabled:w!==null,className:T("reveal"),children:[y.jsx(G0,{className:"h-3.5 w-3.5"})," Reveal"]})}),y.jsx(Qe,{text:"Launch file with default association",block:!1,children:y.jsxs("button",{onClick:()=>{i&&(S("launch"),Promise.resolve(i(J)).finally(()=>S(null)))},disabled:w!==null||!i,className:T("launch"),children:[y.jsx(ts,{className:"h-3.5 w-3.5"})," Launch"]})}),y.jsx(Qe,{text:"Open containing folder",block:!1,children:y.jsxs("button",{onClick:()=>void E("folder","Opened folder",()=>Y0(J.path)),disabled:w!==null,className:T("folder"),children:[y.jsx(Jl,{className:"h-3.5 w-3.5"})," Open Folder"]})}),y.jsx("button",{onClick:t,className:"btn btn-primary px-4 py-2",children:"Close"})]})]})})]}),y.jsx(pA,{isOpen:b,onClose:()=>v(!1),initialFilePath:e.path,md5:l==null?void 0:l.md5})]})}const d8=["qr_code","code_128","code_39","ean_13","ean_8","upc_a","upc_e","data_matrix"],m8=250,p8=400,g8=.7;function x8(n,e=p8,t=g8){const i=n.videoWidth,l=n.videoHeight;if(!i||!l)return null;const o=Math.min(i,l),a=document.createElement("canvas");a.width=Math.min(e,o),a.height=a.width;const u=a.getContext("2d");if(!u)return null;u.drawImage(n,(i-o)/2,(l-o)/2,o,o,0,0,a.width,a.height);const f=a.toDataURL("image/jpeg",t);return f.slice(f.indexOf(",")+1)}function y8(n,e){const t=n.intervalMs??m8;let i=!1,l=!1;const o=()=>{i=!0,clearInterval(a)},a=setInterval(()=>{if(i||l)return;const u=n.capture();u&&(l=!0,n.decode(u).then(f=>{i||f.decoded&&(o(),e.onDetected(f.decoded))}).catch(f=>{i||(o(),e.onError(f instanceof Error?f.message:"Frame decoding failed"))}).finally(()=>{l=!1}))},t);return o}const b8=8e3;function v8({isOpen:n,onClose:e,onDetected:t}){const i=D.useRef(null),l=D.useRef(null),o=hs({isOpen:n,onClose:e,dialogRef:l}),a=D.useRef(null),u=D.useRef(null),f=D.useRef(null),[d,m]=D.useState(null),[g,b]=D.useState(!1),v=()=>{f.current&&(f.current(),f.current=null),u.current&&(cancelAnimationFrame(u.current),u.current=null),a.current&&(a.current.getTracks().forEach(C=>C.stop()),a.current=null),i.current&&(i.current.srcObject=null)};D.useEffect(()=>{if(!n){v(),m(null);return}let C=!0;async function N(){var M,I,U,E,T;if(m(null),b(!1),typeof window<"u"&&!window.isSecureContext&&window.location.hostname!=="localhost"&&window.location.hostname!=="127.0.0.1"){m("Camera access requires HTTPS or localhost. If connecting across a local network IP (e.g. 192.168.x.x), modern browsers disable camera access for insecure HTTP.");return}const R=((I=(M=navigator.mediaDevices)==null?void 0:M.getUserMedia)==null?void 0:I.bind(navigator.mediaDevices))||((U=navigator.getUserMedia)==null?void 0:U.bind(navigator))||((E=navigator.webkitGetUserMedia)==null?void 0:E.bind(navigator))||((T=navigator.mozGetUserMedia)==null?void 0:T.bind(navigator));if(!R){m(window.isSecureContext?"Camera access is not supported by your browser or environment.":"Camera access is blocked because the page is not served over a secure origin (HTTPS or localhost/127.0.0.1).");return}try{let z;const ie=await Promise.race([R({video:{facingMode:"environment",width:{ideal:1280},height:{ideal:720}}}),new Promise((q,J)=>{z=window.setTimeout(()=>J(new DOMException("Camera did not start in time","TimeoutError")),b8)})]).finally(()=>{z!==void 0&&window.clearTimeout(z)});if(!C){ie.getTracks().forEach(q=>q.stop());return}a.current=ie,i.current&&(i.current.srcObject=ie,await i.current.play()),"BarcodeDetector"in window?S():w()}catch(z){if(!C)return;console.error("Camera access error:",z),m(z.name==="NotAllowedError"||z.name==="PermissionDeniedError"?"Camera permission denied. Please allow camera access in your browser settings.":z.name==="TimeoutError"?"The camera did not start in time. On macOS, camera capture needs the packaged desktop app — a bare Python process cannot access the camera. Alternatively, open ProFiles in Chrome, Edge or Safari.":`Could not access camera: ${z.message||"Unknown error"}`)}}return N(),()=>{C=!1,v()}},[n]);const w=()=>{b(!0),f.current=y8({capture:()=>i.current?x8(i.current):null,decode:C=>DM({imageBase64:C,formats:[...d8]})},{onDetected:C=>{v(),t(C)},onError:C=>{v(),m(C)}})},S=()=>{const C=["qr_code","code_128","code_39","ean_13","ean_8","upc_a","upc_e","data_matrix"];let N;try{N=new window.BarcodeDetector({formats:C})}catch(M){console.warn("BarcodeDetector formats unsupported:",M),N=new window.BarcodeDetector}const R=async()=>{if(!i.current||i.current.readyState<2){u.current=requestAnimationFrame(R);return}try{const M=await N.detect(i.current);if(M&&M.length>0){const I=M[0].rawValue;if(I){v(),t(I);return}}}catch(M){console.debug("Frame detection error:",M)}u.current=requestAnimationFrame(R)};u.current=requestAnimationFrame(R)};return n?y.jsx("div",{className:"animate-overlay-in fixed inset-0 z-[var(--z-modal)] flex items-center justify-center bg-black/70 p-4 backdrop-blur-sm",onClick:e,children:y.jsxs("div",{ref:l,role:"dialog","aria-modal":"true","aria-label":"Camera barcode scanner",onKeyDown:o,className:"relative w-full max-w-lg rounded-2xl border border-frame-line glass-panel p-6 flex flex-col",onClick:C=>C.stopPropagation(),children:[y.jsxs("div",{className:"mb-4 flex items-center justify-between border-b border-line pb-3",children:[y.jsxs("div",{className:"flex items-center gap-2 font-semibold text-ink",children:[y.jsx(JC,{className:"h-5 w-5 text-chip-indigo-text"}),y.jsx("span",{children:"Scan with Camera"})]}),y.jsx("button",{onClick:e,className:"focus-ring rounded-lg p-1 text-ink-muted hover:bg-elevated hover:text-ink transition-colors","aria-label":"Close",children:y.jsx(Ei,{className:"h-4 w-4"})})]}),d?y.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-center",children:[y.jsx("div",{className:"rounded-full bg-status-danger-bg p-3 text-status-danger-text mb-3",children:y.jsx(Gc,{className:"h-6 w-6"})}),y.jsx("p",{className:"text-xs text-status-danger-text max-w-xs",children:d}),y.jsx("button",{onClick:e,className:"btn btn-secondary mt-6 px-4 py-2",children:"Close"})]}):y.jsxs("div",{className:"flex flex-col items-center",children:[y.jsxs("div",{className:"relative aspect-video w-full overflow-hidden rounded-xl bg-black border border-line flex items-center justify-center",children:[y.jsx("video",{ref:i,playsInline:!0,muted:!0,className:"h-full w-full object-cover"}),y.jsx("div",{className:"pointer-events-none absolute inset-0 flex items-center justify-center",children:y.jsxs("div",{className:"relative h-48 w-48 rounded-lg border-2 border-dashed border-indigo-400/80 bg-indigo-500/5 shadow-[0_0_0_9999px_rgba(0,0,0,0.45)]",children:[y.jsx("div",{className:"absolute top-0 left-0 h-4 w-4 border-t-2 border-l-2 border-indigo-400"}),y.jsx("div",{className:"absolute top-0 right-0 h-4 w-4 border-t-2 border-r-2 border-indigo-400"}),y.jsx("div",{className:"absolute bottom-0 left-0 h-4 w-4 border-b-2 border-l-2 border-indigo-400"}),y.jsx("div",{className:"absolute bottom-0 right-0 h-4 w-4 border-b-2 border-r-2 border-indigo-400"})]})})]}),y.jsx("p",{className:"mt-4 text-center text-xs text-ink-muted",children:g?"Hold a QR code or barcode steady in front of your camera — frames are decoded by the local ProFiles server (no native Barcode Detector in this browser).":"Hold a QR code or barcode steady in front of your camera to auto-scan."})]})]})}):null}function w8({isOpen:n,file:e,onConfirm:t,onDismiss:i}){const l=D.useRef(null);return D.useEffect(()=>{var o;if(n){const a=u=>{u.key==="Enter"?(u.preventDefault(),t()):u.key==="Escape"&&(u.preventDefault(),i())};return window.addEventListener("keydown",a),(o=l.current)==null||o.focus(),()=>window.removeEventListener("keydown",a)}},[n,t,i]),!n||!e?null:y.jsx("div",{className:"animate-overlay-in fixed inset-0 z-[var(--z-modal)] flex items-center justify-center bg-black/60 p-4 backdrop-blur-sm",onClick:i,children:y.jsxs("div",{role:"dialog","aria-modal":"true","aria-label":`1 file matched: ${e.filename}`,className:"animate-modal-in w-full max-w-sm rounded-xl border border-frame-line glass-panel p-5 flex flex-col gap-4",onClick:o=>o.stopPropagation(),children:[y.jsxs("div",{className:"flex items-center justify-between border-b border-line pb-3",children:[y.jsxs("div",{className:"flex items-center gap-2 font-semibold text-ink text-sm",children:[e.has_hook?y.jsx(AD,{className:"h-4 w-4 text-chip-purple-text"}):y.jsx(ts,{className:"h-4 w-4 text-status-success-text"}),y.jsx("span",{children:"1 File Matched"})]}),y.jsx("button",{onClick:i,className:"focus-ring rounded p-1 text-ink-muted hover:bg-elevated hover:text-ink","aria-label":"Dismiss",children:y.jsx(Ei,{className:"h-4 w-4"})})]}),y.jsxs("div",{className:"flex items-start gap-3 rounded-lg border border-line bg-elevated/50 p-3",children:[y.jsx(ka,{className:"h-5 w-5 text-chip-indigo-text shrink-0 mt-0.5"}),y.jsxs("div",{className:"min-w-0 flex-1",children:[y.jsx("h4",{className:"text-xs font-semibold text-ink truncate",children:e.filename}),y.jsx("p",{className:"text-[11px] text-ink-muted truncate mt-0.5",children:e.rel_path||e.path}),e.has_hook&&y.jsx("span",{className:"inline-block mt-1 text-[10px] text-chip-purple-text bg-chip-purple-bg px-1.5 py-0.5 rounded border border-chip-purple-border/50 font-medium",children:"Workflow Hook Configured"})]})]}),y.jsx("p",{className:"text-xs text-ink-muted text-center",children:"Launch this file now?"}),y.jsxs("div",{className:"flex gap-2",children:[y.jsx("button",{type:"button",onClick:i,className:"btn btn-secondary flex-1 px-3 py-1.5",children:"Dismiss (Esc)"}),y.jsxs("button",{ref:l,type:"button",onClick:t,className:"btn btn-primary flex-1 px-3 py-1.5 shadow-md",children:[y.jsx(ts,{className:"h-3 w-3 fill-current"}),"Launch (Enter)"]})]})]})})}function k8({systemInfo:n,fileCount:e,theme:t,onToggleTheme:i,onOpenLog:l,onOpenConfig:o,onShowShortcuts:a,onReloadConfig:u,onExport:f,exportDisabled:d=!1,language:m="en",onLanguageChange:g,lanEnabled:b,onToggleLan:v}){return y.jsxs("footer",{className:"flex items-center justify-between border-t border-line bg-app px-4 py-2 text-[11px] text-ink-muted transition-colors duration-200",children:[y.jsx("div",{className:"flex items-center gap-4",children:n&&y.jsxs("div",{className:"flex items-center gap-1.5 rounded-full border border-line bg-surface px-2.5 py-0.5 text-ink-secondary",children:[y.jsx(QM,{className:"h-3 w-3 text-status-success-text"}),y.jsx("a",{href:`http://${n.hostname}:${window.location.port}`,target:"_blank",rel:"noopener noreferrer","aria-label":`Open ProFiles on ${n.hostname}`,className:"font-mono hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-indigo-500 rounded px-1 py-0.5",children:n.hostname}),y.jsx("span",{className:"text-ink-faint",children:"|"}),y.jsx("a",{href:`http://${n.ip}:${window.location.port}`,target:"_blank",rel:"noopener noreferrer","aria-label":`Open ProFiles on ${n.ip}`,className:"font-mono hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-indigo-500 rounded px-1 py-0.5",children:n.ip}),y.jsx("span",{className:"text-ink-faint",children:"|"}),y.jsxs("span",{className:"flex items-center gap-1",title:"Session user",children:[y.jsx(OD,{className:"h-3 w-3 text-ink-faint"}),y.jsx("span",{children:n.username||"operator"})]}),v!==void 0&&y.jsxs(y.Fragment,{children:[y.jsx("span",{className:"text-ink-faint",children:"|"}),y.jsx(Qe,{text:"LAN access",block:!1,children:y.jsxs("button",{onClick:()=>v(b!==!0),disabled:b===null,"aria-pressed":b===!0,className:`focus-ring flex items-center gap-1 rounded px-1 py-0.5 text-[10px] ${b===null?"text-ink-faint cursor-not-allowed":b===!0?"text-status-success-text":"text-ink-muted hover:text-ink"}`,children:[y.jsx(nD,{className:"h-3 w-3"}),y.jsx("span",{children:"LAN"})]})})]})]})}),y.jsxs("div",{className:"flex items-center gap-3",children:[y.jsxs("span",{children:[y.jsx("strong",{className:"text-ink",children:e})," files found"]}),y.jsx("span",{className:"text-ink-faint",children:"|"}),y.jsx(Qe,{text:"Keyboard shortcuts (?)",block:!1,children:y.jsxs("button",{onClick:a,className:"focus-ring flex items-center gap-1 text-ink-muted hover:text-ink",children:[y.jsx(nO,{className:"h-3 w-3"}),y.jsx("span",{children:"Shortcuts"})]})}),y.jsx(Qe,{text:"Open the application log viewer",block:!1,children:y.jsxs("button",{onClick:l,className:"focus-ring flex items-center gap-1 text-ink-muted hover:text-ink",children:[y.jsx(ka,{className:"h-3 w-3"}),y.jsx("span",{children:"Logs"})]})}),y.jsx("span",{className:"text-ink-faint",children:"|"}),u&&y.jsx(Qe,{text:"Reload configuration from disk",block:!1,children:y.jsxs("button",{onClick:u,className:"focus-ring flex items-center gap-1 text-ink-muted hover:text-ink",children:[y.jsx($d,{className:"h-3 w-3"}),y.jsx("span",{children:"Reload"})]})}),f&&y.jsx(Qe,{text:"Export the current results as CSV",block:!1,children:y.jsxs("button",{onClick:f,disabled:d,className:"focus-ring flex items-center gap-1 rounded text-ink-muted hover:text-ink disabled:opacity-40 disabled:hover:text-ink-muted",children:[y.jsx(eO,{className:"h-3 w-3"}),y.jsx("span",{children:"Export CSV"})]})}),g&&y.jsxs("div",{className:"flex items-center overflow-hidden rounded border border-line text-[10px]",children:[y.jsx(Qe,{text:"English",block:!1,children:y.jsxs("button",{onClick:()=>g("en"),className:`flex items-center gap-1 px-1.5 py-0.5 transition-colors ${m==="en"?"bg-indigo-600 text-white focus-ring":"text-ink-muted hover:text-ink focus-ring"}`,children:[y.jsx(q4,{className:"h-3 w-3"}),y.jsx("span",{children:"EN"})]})}),y.jsx(Qe,{text:"Français",block:!1,children:y.jsx("button",{onClick:()=>g("fr"),className:`flex items-center gap-1 px-1.5 py-0.5 transition-colors ${m==="fr"?"bg-indigo-600 text-white focus-ring":"text-ink-muted hover:text-ink focus-ring"}`,children:y.jsx("span",{children:"FR"})})})]}),y.jsx(Qe,{text:"Open the configuration editor",block:!1,children:y.jsxs("button",{onClick:o,className:"focus-ring flex items-center gap-1 text-ink-muted hover:text-ink",children:[y.jsx(xD,{className:"h-3 w-3"}),y.jsx("span",{children:"Config"})]})}),y.jsx(Qe,{text:`Switch to ${t==="dark"?"light":"dark"} mode`,block:!1,children:y.jsxs("button",{onClick:i,className:"focus-ring flex items-center gap-1 rounded px-1.5 py-0.5 text-ink-muted hover:bg-elevated hover:text-status-warning-text",children:[t==="dark"?y.jsx(bD,{className:"h-3 w-3 text-status-warning-text"}):y.jsx(eD,{className:"h-3 w-3 text-chip-indigo-text"}),y.jsx("span",{children:t==="dark"?"Light":"Dark"})]})})]})]})}const S8=[{label:"5 seconds",seconds:5},{label:"10 seconds",seconds:10},{label:"30 seconds",seconds:30},{label:"1 minute",seconds:60},{label:"5 minutes",seconds:300}];function C8({isOpen:n,currentInterval:e,onClose:t,onSetInterval:i}){const l=D.useRef(null),o=hs({isOpen:n,onClose:t,dialogRef:l});if(!n)return null;const a=e>0,u=m=>{i(m)},f=m=>{m.preventDefault();const b=m.currentTarget.elements.namedItem("custom-interval"),v=parseInt(b.value,10);!isNaN(v)&&v>0&&i(v)},d=()=>{i(0)};return y.jsx("div",{className:"animate-overlay-in fixed inset-0 z-[var(--z-modal)] flex items-center justify-center bg-black/60 p-4 backdrop-blur-sm",children:y.jsxs("div",{ref:l,role:"dialog","aria-modal":"true","aria-label":"Auto-Rescan Timer",onKeyDown:o,className:"animate-modal-in w-[420px] max-w-full rounded-2xl border border-frame-line glass-panel p-5",children:[y.jsxs("div",{className:"mb-4 flex items-center justify-between border-b border-line pb-3",children:[y.jsxs("div",{className:"flex items-center gap-2 font-semibold text-ink",children:[y.jsx(lO,{className:"h-5 w-5 text-chip-indigo-text"}),y.jsx("span",{children:"Auto-Rescan Timer"})]}),y.jsx("button",{onClick:t,className:"focus-ring rounded-lg p-1 text-ink-muted hover:bg-elevated hover:text-ink",children:y.jsx(Ei,{className:"h-4 w-4"})})]}),y.jsx("div",{className:"mb-4 rounded-lg bg-elevated/50 px-3 py-2 text-xs",children:a?y.jsxs("div",{className:"flex items-center gap-2 text-status-success-text",children:[y.jsx(y4,{className:"h-4 w-4 animate-pulse"}),y.jsxs("span",{children:["Auto-rescan every ",e,"s"]})]}):y.jsxs("div",{className:"flex items-center gap-2 text-ink-secondary",children:[y.jsx(g4,{className:"h-4 w-4"}),y.jsx("span",{children:"Auto-rescan is disabled"})]})}),y.jsxs("div",{className:"mb-4 space-y-1 text-xs",children:[y.jsx("p",{className:"text-ink-muted",children:"Presets:"}),y.jsx("div",{className:"grid grid-cols-2 gap-2",children:S8.map(m=>y.jsx("button",{onClick:()=>u(m.seconds),className:"rounded-lg border border-line bg-elevated/50 px-3 py-1.5 text-left font-medium text-ink-secondary hover:border-chip-indigo-border hover:bg-chip-indigo-bg/40 hover:text-chip-indigo-text focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-indigo-500",children:m.label},m.seconds))})]}),y.jsxs("form",{onSubmit:f,className:"mb-4",children:[y.jsxs("label",{className:"flex items-center gap-2 text-xs font-medium text-ink-secondary",children:[y.jsx(w4,{className:"h-3.5 w-3.5"}),y.jsx("span",{children:"Custom interval (seconds):"})]}),y.jsxs("div",{className:"mt-1 flex gap-2",children:[y.jsx("input",{type:"number",name:"custom-interval",min:"1",placeholder:"e.g. 45",className:"flex-1 rounded-lg border border-line bg-app px-2 py-1 text-xs text-ink placeholder-ink-faint focus:border-indigo-500 focus:outline-none"}),y.jsx("button",{type:"submit",className:"btn btn-primary rounded-lg px-3 py-1 font-semibold",children:"Set"})]})]}),a&&y.jsx("button",{onClick:d,className:"btn w-full rounded-lg border-line bg-elevated/50 px-3 py-2 text-status-warning-text hover:border-status-warning-border hover:bg-status-warning-bg/40",children:"Stop Auto-Rescan"}),y.jsx("div",{className:"flex justify-end gap-2 border-t border-line pt-3",children:y.jsx("button",{onClick:t,className:"rounded-lg border border-line bg-elevated px-4 py-2 text-xs font-semibold text-ink-secondary hover:bg-elevated/70 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-indigo-500",children:"Close"})})]})})}function O8(n,e){const t={};return(n[n.length-1]===""?[...n,""]:n).join((t.padRight?" ":"")+","+(t.padLeft===!1?"":" ")).trim()}const N8=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,T8=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,A8={};function K2(n,e){return(A8.jsx?T8:N8).test(n)}const E8=/[ \t\n\f\r]/g;function M8(n){return typeof n=="object"?n.type==="text"?W2(n.value):!1:W2(n)}function W2(n){return n.replace(E8,"")===""}class ju{constructor(e,t,i){this.normal=t,this.property=e,i&&(this.space=i)}}ju.prototype.normal={};ju.prototype.property={};ju.prototype.space=void 0;function xA(n,e){const t={},i={};for(const l of n)Object.assign(t,l.property),Object.assign(i,l.normal);return new ju(t,i,e)}function Jx(n){return n.toLowerCase()}class gi{constructor(e,t){this.attribute=t,this.property=e}}gi.prototype.attribute="";gi.prototype.booleanish=!1;gi.prototype.boolean=!1;gi.prototype.commaOrSpaceSeparated=!1;gi.prototype.commaSeparated=!1;gi.prototype.defined=!1;gi.prototype.mustUseProperty=!1;gi.prototype.number=!1;gi.prototype.overloadedBoolean=!1;gi.prototype.property="";gi.prototype.spaceSeparated=!1;gi.prototype.space=void 0;let D8=0;const Fe=oo(),an=oo(),ey=oo(),pe=oo(),At=oo(),to=oo(),Ni=oo();function oo(){return 2**++D8}const ty=Object.freeze(Object.defineProperty({__proto__:null,boolean:Fe,booleanish:an,commaOrSpaceSeparated:Ni,commaSeparated:to,number:pe,overloadedBoolean:ey,spaceSeparated:At},Symbol.toStringTag,{value:"Module"})),j0=Object.keys(ty);class rb extends gi{constructor(e,t,i,l){let o=-1;if(super(e,t),Z2(this,"space",l),typeof i=="number")for(;++o4&&t.slice(0,4)==="data"&&z8.test(e)){if(e.charAt(4)==="-"){const o=e.slice(5).replace(J2,H8);i="data"+o.charAt(0).toUpperCase()+o.slice(1)}else{const o=e.slice(4);if(!J2.test(o)){let a=o.replace(L8,P8);a.charAt(0)!=="-"&&(a="-"+a),e="data"+a}}l=rb}return new l(i,e)}function P8(n){return"-"+n.toLowerCase()}function H8(n){return n.charAt(1).toUpperCase()}const I8=xA([yA,j8,wA,kA,SA],"html"),lb=xA([yA,R8,wA,kA,SA],"svg");function U8(n){return n.join(" ").trim()}var eC=/\/\*(?:[^*]|\*(?!\/))*\*\//g,F8=/\n/g,q8=/^\s*/,V8=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,Q8=/^:\s*/,X8=/^((?:'(?:\\.|[^'\\])*'|"(?:\\.|[^"\\])*"|url\((?:'(?:\\.|[^'\\])*'|"(?:\\.|[^"\\])*"|[^)]*)\)|[^};])+)/,$8=/^[;\s]*/,Y8=` +`,tC="/",nC="*",Uc="",G8="comment",K8="declaration";function W8(n,e){if(typeof n!="string")throw new TypeError("First argument must be a string");if(!n)return[];e=e||{};var t=1,i=1;function l(w){var S=w.match(F8);S&&(t+=S.length);var C=w.lastIndexOf(Y8);i=~C?w.length-C:i+w.length}function o(){var w={line:t,column:i};return function(S){return S.position=new a(w),d(),S}}function a(w){this.start=w,this.end={line:t,column:i},this.source=e.source}a.prototype.content=n;function u(w){var S=new Error(e.source+":"+t+":"+i+": "+w);if(S.reason=w,S.filename=e.source,S.line=t,S.column=i,S.source=n,!e.silent)throw S}function f(w){var S=w.exec(n);if(S){var C=S[0];return l(C),n=n.slice(C.length),S}}function d(){f(q8)}function m(w){for(var S;S=g();)w.push(S);return w}function g(){var w=o();if(!(tC!=n.charAt(0)||nC!=n.charAt(1))){for(var S=2;Uc!=n.charAt(S)&&(nC!=n.charAt(S)||tC!=n.charAt(S+1));)++S;if(S+=2,Uc===n.charAt(S-1))return u("End of comment missing");var C=n.slice(2,S-2);return i+=2,l(C),n=n.slice(S),i+=2,w({type:G8,comment:C})}}function b(){var w=o(),S=f(V8);if(S){if(g(),!f(Q8))return u("property missing ':'");var C=f(X8),N=w({type:K8,property:S[0].replace(eC,Uc).trim(),value:C?C[0].replace(eC,Uc).trim():Uc});return f($8),N}}function v(){var w=[];m(w);for(var S;S=b();)w.push(S),m(w);return w}return d(),v()}function Z8(n,e){let t=null;if(!n||typeof n!="string")return t;const i=W8(n),l=typeof e=="function";return i.forEach(o=>{if(o.type!=="declaration")return;const{property:a,value:u}=o;l?e(a,u,o):u&&(t=t??{},t[a]=u)}),t}const CA=OA("end"),sb=OA("start");function OA(n){return e;function e(t){const i=t&&t.position&&t.position[n]||{};if(typeof i.line=="number"&&i.line>0&&typeof i.column=="number"&&i.column>0)return{line:i.line,column:i.column,offset:typeof i.offset=="number"&&i.offset>-1?i.offset:void 0}}}function J8(n){const e=sb(n),t=CA(n);if(e&&t)return{start:e,end:t}}function ru(n){return!n||typeof n!="object"?"":"position"in n||"type"in n?iC(n.position):"start"in n||"end"in n?iC(n):"line"in n||"column"in n?ny(n):""}function ny(n){return rC(n&&n.line)+":"+rC(n&&n.column)}function iC(n){return ny(n&&n.start)+"-"+ny(n&&n.end)}function rC(n){return n&&typeof n=="number"?n:1}class Fn extends Error{constructor(e,t,i){super(),typeof t=="string"&&(i=t,t=void 0);let l="",o={},a=!1;if(t&&("line"in t&&"column"in t?o={place:t}:"start"in t&&"end"in t?o={place:t}:"type"in t?o={ancestors:[t],place:t.position}:o={...t}),typeof e=="string"?l=e:!o.cause&&e&&(a=!0,l=e.message,o.cause=e),!o.ruleId&&!o.source&&typeof i=="string"){const f=i.indexOf(":");f===-1?o.ruleId=i:(o.source=i.slice(0,f),o.ruleId=i.slice(f+1))}if(!o.place&&o.ancestors&&o.ancestors){const f=o.ancestors[o.ancestors.length-1];f&&(o.place=f.position)}const u=o.place&&"start"in o.place?o.place.start:o.place;this.ancestors=o.ancestors||void 0,this.cause=o.cause||void 0,this.column=u?u.column:void 0,this.fatal=void 0,this.file="",this.message=l,this.line=u?u.line:void 0,this.name=ru(o.place)||"1:1",this.place=o.place||void 0,this.reason=this.message,this.ruleId=o.ruleId||void 0,this.source=o.source||void 0,this.stack=a&&o.cause&&typeof o.cause.stack=="string"?o.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}Fn.prototype.file="";Fn.prototype.name="";Fn.prototype.reason="";Fn.prototype.message="";Fn.prototype.stack="";Fn.prototype.column=void 0;Fn.prototype.line=void 0;Fn.prototype.ancestors=void 0;Fn.prototype.cause=void 0;Fn.prototype.fatal=void 0;Fn.prototype.place=void 0;Fn.prototype.ruleId=void 0;Fn.prototype.source=void 0;const ob={}.hasOwnProperty,eP=new Map,tP=/[A-Z]/g,nP=/-([a-z])/g,iP=new Set(["table","tbody","thead","tfoot","tr"]),rP=new Set(["td","th"]),NA="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function lP(n,e){if(!e||e.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const t=e.filePath||void 0;let i;if(e.development){if(typeof e.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");i=dP(t,e.jsxDEV)}else{if(typeof e.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof e.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");i=hP(t,e.jsx,e.jsxs)}const l={Fragment:e.Fragment,ancestors:[],components:e.components||{},create:i,elementAttributeNameCase:e.elementAttributeNameCase||"react",evaluater:e.createEvaluater?e.createEvaluater():void 0,filePath:t,ignoreInvalidStyle:e.ignoreInvalidStyle||!1,passKeys:e.passKeys!==!1,passNode:e.passNode||!1,schema:e.space==="svg"?lb:I8,stylePropertyNameCase:e.stylePropertyNameCase||"dom",tableCellAlignToStyle:e.tableCellAlignToStyle!==!1},o=TA(l,n,void 0);return o&&typeof o!="string"?o:l.create(n,l.Fragment,{children:o||void 0},void 0)}function TA(n,e,t){if(e.type==="element")return sP(n,e,t);if(e.type==="mdxFlowExpression"||e.type==="mdxTextExpression")return oP(n,e);if(e.type==="mdxJsxFlowElement"||e.type==="mdxJsxTextElement")return cP(n,e,t);if(e.type==="mdxjsEsm")return aP(n,e);if(e.type==="root")return uP(n,e,t);if(e.type==="text")return fP(n,e)}function sP(n,e,t){const i=n.schema;let l=i;e.tagName.toLowerCase()==="svg"&&i.space==="html"&&(l=lb,n.schema=l),n.ancestors.push(e);const o=EA(n,e.tagName,!1),a=mP(n,e);let u=cb(n,e);return iP.has(e.tagName)&&(u=u.filter(function(f){return typeof f=="string"?!M8(f):!0})),AA(n,a,o,e),ab(a,u),n.ancestors.pop(),n.schema=i,n.create(e,o,a,t)}function oP(n,e){if(e.data&&e.data.estree&&n.evaluater){const i=e.data.estree.body[0];return i.type,n.evaluater.evaluateExpression(i.expression)}Cu(n,e.position)}function aP(n,e){if(e.data&&e.data.estree&&n.evaluater)return n.evaluater.evaluateProgram(e.data.estree);Cu(n,e.position)}function cP(n,e,t){const i=n.schema;let l=i;e.name==="svg"&&i.space==="html"&&(l=lb,n.schema=l),n.ancestors.push(e);const o=e.name===null?n.Fragment:EA(n,e.name,!0),a=pP(n,e),u=cb(n,e);return AA(n,a,o,e),ab(a,u),n.ancestors.pop(),n.schema=i,n.create(e,o,a,t)}function uP(n,e,t){const i={};return ab(i,cb(n,e)),n.create(e,n.Fragment,i,t)}function fP(n,e){return e.value}function AA(n,e,t,i){typeof t!="string"&&t!==n.Fragment&&n.passNode&&(e.node=i)}function ab(n,e){if(e.length>0){const t=e.length>1?e:e[0];t&&(n.children=t)}}function hP(n,e,t){return i;function i(l,o,a,u){const d=Array.isArray(a.children)?t:e;return u?d(o,a,u):d(o,a)}}function dP(n,e){return t;function t(i,l,o,a){const u=Array.isArray(o.children),f=sb(i);return e(l,o,a,u,{columnNumber:f?f.column-1:void 0,fileName:n,lineNumber:f?f.line:void 0},void 0)}}function mP(n,e){const t={};let i,l;for(l in e.properties)if(l!=="children"&&ob.call(e.properties,l)){const o=gP(n,l,e.properties[l]);if(o){const[a,u]=o;n.tableCellAlignToStyle&&a==="align"&&typeof u=="string"&&rP.has(e.tagName)?i=u:t[a]=u}}if(i){const o=t.style||(t.style={});o[n.stylePropertyNameCase==="css"?"text-align":"textAlign"]=i}return t}function pP(n,e){const t={};for(const i of e.attributes)if(i.type==="mdxJsxExpressionAttribute")if(i.data&&i.data.estree&&n.evaluater){const o=i.data.estree.body[0];o.type;const a=o.expression;a.type;const u=a.properties[0];u.type,Object.assign(t,n.evaluater.evaluateExpression(u.argument))}else Cu(n,e.position);else{const{name:l}=i;let o;if(i.value&&typeof i.value=="object")if(i.value.data&&i.value.data.estree&&n.evaluater){const u=i.value.data.estree.body[0];u.type,o=n.evaluater.evaluateExpression(u.expression)}else Cu(n,e.position);else o=i.value===null?!0:i.value;t[l]=o}return t}function cb(n,e){const t=[];let i=-1;const l=n.passKeys?new Map:eP;for(;++il?0:l+e:e=e>l?l:e,t=t>0?t:0,i.length<1e4)a=Array.from(i),a.unshift(e,t),n.splice(...a);else for(t&&n.splice(e,t);o0?(nr(n,n.length,0,e),n):e}const oC={}.hasOwnProperty;function DA(n){const e={};let t=-1;for(;++t13&&t<32||t>126&&t<160||t>55295&&t<57344||t>64975&&t<65008||(t&65535)===65535||(t&65535)===65534||t>1114111?"�":String.fromCodePoint(t)}function ir(n){return n.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const Rn=ds(/[A-Za-z]/),_n=ds(/[\dA-Za-z]/),NP=ds(/[#-'*+\--9=?A-Z^-~]/);function Id(n){return n!==null&&(n<32||n===127)}const iy=ds(/\d/),TP=ds(/[\dA-Fa-f]/),RA=ds(/[!-/:-@[-`{-~]/);function Be(n){return n!==null&&n<-2}function Mt(n){return n!==null&&(n<0||n===32)}function Ke(n){return n===-2||n===-1||n===32}const fm=ds(new RegExp("\\p{P}|\\p{S}","u")),lo=ds(/\s/);function ds(n){return e;function e(t){return t!==null&&t>-1&&n.test(String.fromCharCode(t))}}function Ba(n){const e=[];let t=-1,i=0,l=0;for(;++t55295&&o<57344){const u=n.charCodeAt(t+1);o<56320&&u>56319&&u<57344?(a=String.fromCharCode(o,u),l=1):a="�"}else a=String.fromCharCode(o);a&&(e.push(n.slice(i,t),encodeURIComponent(a)),i=t+l+1,a=""),l&&(t+=l,l=0)}return e.join("")+n.slice(i)}function mt(n,e,t,i){const l=i?i-1:1/0;let o=0;return a;function a(f){return Ke(f)?(n.enter(t),u(f)):e(f)}function u(f){return Ke(f)&&o++=l?e(m):t(m)}}const AP={tokenize:EP};function EP(n){const e=n.attempt(this.parser.constructs.contentInitial,i,l);let t;return e;function i(u){if(u===null){n.consume(u);return}return n.enter("lineEnding"),n.consume(u),n.exit("lineEnding"),mt(n,e,"linePrefix")}function l(u){return n.enter("paragraph"),o(u)}function o(u){const f=n.enter("chunkText",{contentType:"text",previous:t});return t&&(t.next=f),t=f,a(u)}function a(u){if(u===null){n.exit("chunkText"),n.exit("paragraph"),n.consume(u);return}return Be(u)?(n.consume(u),n.exit("chunkText"),o):(n.consume(u),a)}}let Ud=class{constructor(){this.index=new Map,this.map=[]}add(e,t,i){aC(this,e,t,i,!1)}addBefore(e,t,i){aC(this,e,t,i,!0)}consume(e){if(this.map.sort(function(o,a){return o[0]-a[0]}),this.map.length===0)return;let t=this.map.length;const i=[];for(;t>0;)t-=1,i.push(e.slice(this.map[t][0]+this.map[t][1]),this.map[t][2]),e.length=this.map[t][0];i.push(e.slice()),e.length=0;let l=i.pop();for(;l;){for(const o of l)e.push(o);l=i.pop()}this.map.length=0,this.index.clear()}};function aC(n,e,t,i,l){if(t===0&&i.length===0)return;const o=n.index.get(e);if(o){o[1]+=t,l?(i.push(...o[2]),o[2]=i):o[2].push(...i);return}const a=[e,t,i];n.map.push(a),n.index.set(e,a)}const MP={tokenize:DP},cC={tokenize:jP};function DP(n){const e=this,t=[];let i=0,l,o,a;return u;function u(M){if(ia))return;const T=e.events.length;let z=T,ie,q;for(;z--;)if(e.events[z][0]==="exit"&&e.events[z][1].type==="chunkFlow"){if(ie){q=e.events[z][1].end;break}ie=!0}for(N(i),E=T;EM;){const U=t[I];e.containerState=U[1],U[0].exit.call(e,n)}t.length=M}function R(){l.write([null]),o=void 0,l=void 0,e.containerState._closeFlow=void 0}}function jP(n,e,t){return mt(n,n.attempt(this.parser.constructs.document,e,t),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function cs(n){if(n===null||Mt(n)||lo(n))return 1;if(fm(n))return 2}function hm(n,e,t){const i=[];let l=-1;for(;++l1&&n[t][1].end.offset-n[t][1].start.offset>1?2:1,a={...n[l][1].end},u={...n[t][1].start};uC(a,-o),uC(u,o);const f={type:o>1?"strongSequence":"emphasisSequence",start:a,end:{...n[l][1].end}},d={type:o>1?"strongSequence":"emphasisSequence",start:{...n[t][1].start},end:u},m={type:o>1?"strongText":"emphasisText",start:{...n[l][1].end},end:{...n[t][1].start}},g={type:o>1?"strong":"emphasis",start:{...f.start},end:{...d.end}};n[l][1].end={...f.start},n[t][1].start={...d.end},i=[],n[l][1].end.offset-n[l][1].start.offset&&(i=Hi(i,[["enter",n[l][1],e],["exit",n[l][1],e]])),i=Hi(i,[["enter",g,e],["enter",f,e],["exit",f,e],["enter",m,e]]),i=Hi(i,hm(e.parser.constructs.insideSpan.null,n.slice(l+1,t),e)),i=Hi(i,[["exit",m,e],["enter",d,e],["exit",d,e],["exit",g,e]]);let b=0;n[t][1].end.offset-n[t][1].start.offset&&(b=2,i=Hi(i,[["enter",n[t][1],e],["exit",n[t][1],e]])),nr(n,l-1,t-l+3,i),t=l+i.length-b-2;break}}for(t=-1;++t0&&Ke(E)?mt(n,R,"linePrefix",o+1)(E):R(E)}function R(E){return E===null||Be(E)?n.check(ly,S,I)(E):(n.enter("codeFlowValue"),M(E))}function M(E){return E===null||Be(E)?(n.exit("codeFlowValue"),R(E)):(n.consume(E),M)}function I(E){return n.exit("codeFenced"),e(E)}function U(E,T,z){let ie=0;return q;function q(ne){return E.enter("lineEnding"),E.consume(ne),E.exit("lineEnding"),J}function J(ne){return E.enter("codeFencedFence"),Ke(ne)?mt(E,F,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(ne):F(ne)}function F(ne){return ne===u?(E.enter("codeFencedFenceSequence"),se(ne)):z(ne)}function se(ne){return ne===u?(ie++,E.consume(ne),se):ie>=a?(E.exit("codeFencedFenceSequence"),Ke(ne)?mt(E,he,"whitespace")(ne):he(ne)):z(ne)}function he(ne){return ne===null||Be(ne)?(E.exit("codeFencedFence"),T(ne)):z(ne)}}}const _0={name:"codeIndented",tokenize:XP},QP={partial:!0,tokenize:$P};function XP(n,e,t){return i;function i(u){return n.enter("codeIndented"),_A(n,l,t,"linePrefix",4,4)(u)}function l(u){return u===null?a(u):Be(u)?n.attempt(QP,l,a)(u):(n.enter("codeFlowValue"),o(u))}function o(u){return u===null||Be(u)?(n.exit("codeFlowValue"),l(u)):(n.consume(u),o)}function a(u){return n.exit("codeIndented"),e(u)}}function $P(n,e,t){const i=this;return l;function l(a){return i.parser.lazy[i.now().line]?t(a):Be(a)?(n.enter("lineEnding"),n.consume(a),n.exit("lineEnding"),l):_A(n,e,o,"linePrefix",4,4)(a)}function o(a){return Be(a)?l(a):t(a)}}const YP={name:"codeText",previous:KP,resolve:GP,tokenize:WP};function GP(n){let e=n.length-4,t=3,i,l;if((n[t][1].type==="lineEnding"||n[t][1].type==="space")&&(n[e][1].type==="lineEnding"||n[e][1].type==="space")){for(i=t;++i=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+e+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return ethis.left.length?this.right.slice(this.right.length-i+this.left.length,this.right.length-e+this.left.length).reverse():this.left.slice(e).concat(this.right.slice(this.right.length-i+this.left.length).reverse())}splice(e,t,i){const l=t||0;this.setCursor(Math.trunc(e));const o=this.right.splice(this.right.length-l,Number.POSITIVE_INFINITY);return i&&Fc(this.left,i),o.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(e){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(e)}pushMany(e){this.setCursor(Number.POSITIVE_INFINITY),Fc(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),Fc(this.right,e.reverse())}setCursor(e){if(!(e===this.left.length||e>this.left.length&&this.right.length===0||e<0&&this.left.length===0))if(e=4?e(a):n.interrupt(i.parser.constructs.flow,t,e)(a)}}function HA(n,e,t,i,l,o,a,u,f){const d=f||Number.POSITIVE_INFINITY;let m=0;return g;function g(N){return N===60?(n.enter(i),n.enter(l),n.enter(o),n.consume(N),n.exit(o),b):N===null||N===32||N===41||Id(N)?t(N):(n.enter(i),n.enter(a),n.enter(u),n.enter("chunkString",{contentType:"string"}),S(N))}function b(N){return N===62?(n.enter(o),n.consume(N),n.exit(o),n.exit(l),n.exit(i),e):(n.enter(u),n.enter("chunkString",{contentType:"string"}),v(N))}function v(N){return N===62?(n.exit("chunkString"),n.exit(u),b(N)):N===null||N===60||Be(N)?t(N):(n.consume(N),N===92?w:v)}function w(N){return N===60||N===62||N===92?(n.consume(N),v):v(N)}function S(N){return!m&&(N===null||N===41||Mt(N))?(n.exit("chunkString"),n.exit(u),n.exit(a),n.exit(i),e(N)):m999||v===null||v===91||v===93&&!f||v===94&&!u&&"_hiddenFootnoteSupport"in a.parser.constructs?t(v):v===93?(n.exit(o),n.enter(l),n.consume(v),n.exit(l),n.exit(i),e):Be(v)?(n.enter("lineEnding"),n.consume(v),n.exit("lineEnding"),m):(n.enter("chunkString",{contentType:"string"}),g(v))}function g(v){return v===null||v===91||v===93||Be(v)||u++>999?(n.exit("chunkString"),m(v)):(n.consume(v),f||(f=!Ke(v)),v===92?b:g)}function b(v){return v===91||v===92||v===93?(n.consume(v),u++,g):g(v)}}function UA(n,e,t,i,l,o){let a;return u;function u(b){return b===34||b===39||b===40?(n.enter(i),n.enter(l),n.consume(b),n.exit(l),a=b===40?41:b,f):t(b)}function f(b){return b===a?(n.enter(l),n.consume(b),n.exit(l),n.exit(i),e):(n.enter(o),d(b))}function d(b){return b===a?(n.exit(o),f(a)):b===null?t(b):Be(b)?(n.enter("lineEnding"),n.consume(b),n.exit("lineEnding"),mt(n,d,"linePrefix")):(n.enter("chunkString",{contentType:"string"}),m(b))}function m(b){return b===a||b===null||Be(b)?(n.exit("chunkString"),d(b)):(n.consume(b),b===92?g:m)}function g(b){return b===a||b===92?(n.consume(b),m):m(b)}}function lu(n,e){let t;return i;function i(l){return Be(l)?(n.enter("lineEnding"),n.consume(l),n.exit("lineEnding"),t=!0,i):Ke(l)?mt(n,i,t?"linePrefix":"lineSuffix")(l):e(l)}}const lH={name:"definition",tokenize:oH},sH={partial:!0,tokenize:aH};function oH(n,e,t){const i=this;let l;return o;function o(v){return n.enter("definition"),a(v)}function a(v){return IA.call(i,n,u,t,"definitionLabel","definitionLabelMarker","definitionLabelString")(v)}function u(v){return l=ir(i.sliceSerialize(i.events[i.events.length-1][1]).slice(1,-1)),v===58?(n.enter("definitionMarker"),n.consume(v),n.exit("definitionMarker"),f):t(v)}function f(v){return Mt(v)?lu(n,d)(v):d(v)}function d(v){return HA(n,m,t,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(v)}function m(v){return n.attempt(sH,g,g)(v)}function g(v){return Ke(v)?mt(n,b,"whitespace")(v):b(v)}function b(v){return v===null||Be(v)?(n.exit("definition"),i.parser.defined.push(l),e(v)):t(v)}}function aH(n,e,t){return i;function i(u){return Mt(u)?lu(n,l)(u):t(u)}function l(u){return UA(n,o,t,"definitionTitle","definitionTitleMarker","definitionTitleString")(u)}function o(u){return Ke(u)?mt(n,a,"whitespace")(u):a(u)}function a(u){return u===null||Be(u)?e(u):t(u)}}const cH={name:"hardBreakEscape",tokenize:uH};function uH(n,e,t){return i;function i(o){return n.enter("hardBreakEscape"),n.consume(o),l}function l(o){return Be(o)?(n.exit("hardBreakEscape"),e(o)):t(o)}}const fH={name:"headingAtx",resolve:hH,tokenize:dH};function hH(n,e){let t=n.length-2,i=3;if(n[i][1].type==="whitespace"&&(i+=2),t-2>i&&n[t][1].type==="whitespace"&&(t-=2),n[t][1].type==="atxHeadingSequence"&&(i===t-1||t-4>i&&n[t-2][1].type==="whitespace")&&(t-=i+1===t?2:4),t>i){const l={type:"atxHeadingText",start:n[i][1].start,end:n[t][1].end},o={type:"chunkText",start:n[i][1].start,end:n[t][1].end,contentType:"text"};nr(n,i,t-i+1,[["enter",l,e],["enter",o,e],["exit",o,e],["exit",l,e]])}return n}function dH(n,e,t){let i=0;return l;function l(m){return n.enter("atxHeading"),o(m)}function o(m){return n.enter("atxHeadingSequence"),a(m)}function a(m){return m===35&&i++<6?(n.consume(m),a):m===null||Mt(m)?(n.exit("atxHeadingSequence"),u(m)):t(m)}function u(m){return m===35?(n.enter("atxHeadingSequence"),f(m)):m===null||Be(m)?(n.exit("atxHeading"),e(m)):Ke(m)?mt(n,u,"whitespace")(m):(n.enter("atxHeadingText"),d(m))}function f(m){return m===35?(n.consume(m),f):(n.exit("atxHeadingSequence"),u(m))}function d(m){return m===null||m===35||Mt(m)?(n.exit("atxHeadingText"),u(m)):(n.consume(m),d)}}const FA=["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"],sy=["pre","script","style","textarea"],mH={concrete:!0,name:"htmlFlow",resolveTo:gH,tokenize:xH},pH={partial:!0,tokenize:yH};function gH(n){let e=n.length;for(;e--&&!(n[e][0]==="enter"&&n[e][1].type==="htmlFlow"););return e>1&&n[e-2][1].type==="linePrefix"&&(n[e][1].start=n[e-2][1].start,n[e+1][1].start=n[e-2][1].start,n.splice(e-2,2)),n}function xH(n,e,t){const i=this;let l,o,a,u,f;return d;function d(B){return m(B)}function m(B){return n.enter("htmlFlow"),n.enter("htmlFlowData"),n.consume(B),g}function g(B){return B===33?(n.consume(B),b):B===47?(n.consume(B),o=!0,S):B===63?(n.consume(B),l=3,i.interrupt?e:A):Rn(B)?(n.consume(B),a=String.fromCharCode(B),C):t(B)}function b(B){return B===45?(n.consume(B),l=2,v):B===91?(n.consume(B),l=5,u=0,w):Rn(B)?(n.consume(B),l=4,i.interrupt?e:A):t(B)}function v(B){return B===45?(n.consume(B),i.interrupt?e:A):t(B)}function w(B){const j="CDATA[";return B===j.charCodeAt(u++)?(n.consume(B),u===j.length?i.interrupt?e:F:w):t(B)}function S(B){return Rn(B)?(n.consume(B),a=String.fromCharCode(B),C):t(B)}function C(B){if(B===null||B===47||B===62||Mt(B)){const j=B===47,$=a.toLowerCase();return!j&&!o&&sy.includes($)?(l=1,i.interrupt?e(B):F(B)):FA.includes(a.toLowerCase())?(l=6,j?(n.consume(B),N):i.interrupt?e(B):F(B)):(l=7,i.interrupt&&!i.parser.lazy[i.now().line]?t(B):o?R(B):M(B))}return B===45||_n(B)?(n.consume(B),a+=String.fromCharCode(B),C):t(B)}function N(B){return B===62?(n.consume(B),i.interrupt?e:F):t(B)}function R(B){return Ke(B)?(n.consume(B),R):q(B)}function M(B){return B===47?(n.consume(B),q):B===58||B===95||Rn(B)?(n.consume(B),I):Ke(B)?(n.consume(B),M):q(B)}function I(B){return B===45||B===46||B===58||B===95||_n(B)?(n.consume(B),I):U(B)}function U(B){return B===61?(n.consume(B),E):Ke(B)?(n.consume(B),U):M(B)}function E(B){return B===null||B===60||B===61||B===62||B===96?t(B):B===34||B===39?(n.consume(B),f=B,T):Ke(B)?(n.consume(B),E):z(B)}function T(B){return B===f?(n.consume(B),f=null,ie):B===null||Be(B)?t(B):(n.consume(B),T)}function z(B){return B===null||B===34||B===39||B===47||B===60||B===61||B===62||B===96||Mt(B)?U(B):(n.consume(B),z)}function ie(B){return B===47||B===62||Ke(B)?M(B):t(B)}function q(B){return B===62?(n.consume(B),J):t(B)}function J(B){return B===null||Be(B)?F(B):Ke(B)?(n.consume(B),J):t(B)}function F(B){return B===45&&l===2?(n.consume(B),L):B===60&&l===1?(n.consume(B),ee):B===62&&l===4?(n.consume(B),Le):B===63&&l===3?(n.consume(B),A):B===93&&l===5?(n.consume(B),le):Be(B)&&(l===6||l===7)?(n.exit("htmlFlowData"),n.check(pH,_e,se)(B)):B===null||Be(B)?(n.exit("htmlFlowData"),se(B)):(n.consume(B),F)}function se(B){return n.check(ly,he,_e)(B)}function he(B){return n.enter("lineEnding"),n.consume(B),n.exit("lineEnding"),ne}function ne(B){return B===null||Be(B)?se(B):(n.enter("htmlFlowData"),F(B))}function L(B){return B===45?(n.consume(B),A):F(B)}function ee(B){return B===47?(n.consume(B),a="",oe):F(B)}function oe(B){if(B===62){const j=a.toLowerCase();return sy.includes(j)?(n.consume(B),Le):F(B)}return Rn(B)&&a.length<8?(n.consume(B),a+=String.fromCharCode(B),oe):F(B)}function le(B){return B===93?(n.consume(B),A):F(B)}function A(B){return B===62?(n.consume(B),Le):B===45&&l===2?(n.consume(B),A):F(B)}function Le(B){return B===null||Be(B)?(n.exit("htmlFlowData"),_e(B)):(n.consume(B),Le)}function _e(B){return n.exit("htmlFlow"),e(B)}}function yH(n,e,t){return i;function i(l){return n.enter("lineEnding"),n.consume(l),n.exit("lineEnding"),n.attempt(Ru,e,t)}}const bH={name:"htmlText",tokenize:vH};function vH(n,e,t){const i=this;let l,o,a;return u;function u(A){return n.enter("htmlText"),n.enter("htmlTextData"),n.consume(A),f}function f(A){return A===33?(n.consume(A),d):A===47?(n.consume(A),U):A===63?(n.consume(A),M):Rn(A)?(n.consume(A),z):t(A)}function d(A){return A===45?(n.consume(A),m):A===91?(n.consume(A),o=0,w):Rn(A)?(n.consume(A),R):t(A)}function m(A){return A===45?(n.consume(A),v):t(A)}function g(A){return A===null?t(A):A===45?(n.consume(A),b):Be(A)?(a=g,ee(A)):(n.consume(A),g)}function b(A){return A===45?(n.consume(A),v):g(A)}function v(A){return A===62?L(A):A===45?b(A):g(A)}function w(A){const Le="CDATA[";return A===Le.charCodeAt(o++)?(n.consume(A),o===Le.length?S:w):t(A)}function S(A){return A===null?t(A):A===93?(n.consume(A),C):Be(A)?(a=S,ee(A)):(n.consume(A),S)}function C(A){return A===93?(n.consume(A),N):S(A)}function N(A){return A===62?L(A):A===93?(n.consume(A),N):S(A)}function R(A){return A===null||A===62?L(A):Be(A)?(a=R,ee(A)):(n.consume(A),R)}function M(A){return A===null?t(A):A===63?(n.consume(A),I):Be(A)?(a=M,ee(A)):(n.consume(A),M)}function I(A){return A===62?L(A):M(A)}function U(A){return Rn(A)?(n.consume(A),E):t(A)}function E(A){return A===45||_n(A)?(n.consume(A),E):T(A)}function T(A){return Be(A)?(a=T,ee(A)):Ke(A)?(n.consume(A),T):L(A)}function z(A){return A===45||_n(A)?(n.consume(A),z):A===47||A===62||Mt(A)?ie(A):t(A)}function ie(A){return A===47?(n.consume(A),L):A===58||A===95||Rn(A)?(n.consume(A),q):Be(A)?(a=ie,ee(A)):Ke(A)?(n.consume(A),ie):L(A)}function q(A){return A===45||A===46||A===58||A===95||_n(A)?(n.consume(A),q):J(A)}function J(A){return A===61?(n.consume(A),F):Be(A)?(a=J,ee(A)):Ke(A)?(n.consume(A),J):ie(A)}function F(A){return A===null||A===60||A===61||A===62||A===96?t(A):A===34||A===39?(n.consume(A),l=A,se):Be(A)?(a=F,ee(A)):Ke(A)?(n.consume(A),F):(n.consume(A),he)}function se(A){return A===l?(n.consume(A),l=void 0,ne):A===null?t(A):Be(A)?(a=se,ee(A)):(n.consume(A),se)}function he(A){return A===null||A===34||A===39||A===60||A===61||A===96?t(A):A===47||A===62||Mt(A)?ie(A):(n.consume(A),he)}function ne(A){return A===47||A===62||Mt(A)?ie(A):t(A)}function L(A){return A===62?(n.consume(A),n.exit("htmlTextData"),n.exit("htmlText"),e):t(A)}function ee(A){return n.exit("htmlTextData"),n.enter("lineEnding"),n.consume(A),n.exit("lineEnding"),oe}function oe(A){return Ke(A)?mt(n,le,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(A):le(A)}function le(A){return n.enter("htmlTextData"),a(A)}}const hb={name:"labelEnd",resolveAll:CH,resolveTo:OH,tokenize:NH},wH={tokenize:TH},kH={tokenize:AH},SH={tokenize:EH};function CH(n){let e=-1;const t=[];for(;++e0&&l[l.length-1]._balanced;)l.pop();o=l[l.length-1]}return u;function u(b){return o?o._inactive?g(b):(a=i.parser.defined.includes(ir(i.sliceSerialize({start:o.end,end:i.now()}))),n.enter("labelEnd"),n.enter("labelMarker"),n.consume(b),n.exit("labelMarker"),n.exit("labelEnd"),f):t(b)}function f(b){return b===40?n.attempt(wH,m,a?m:g)(b):b===91?n.attempt(kH,m,a?d:g)(b):a?m(b):g(b)}function d(b){return n.attempt(SH,m,g)(b)}function m(b){return l.pop(),e(b)}function g(b){return o._balanced=!0,t(b)}}function TH(n,e,t){return i;function i(g){return n.enter("resource"),n.enter("resourceMarker"),n.consume(g),n.exit("resourceMarker"),l}function l(g){return Mt(g)?lu(n,o)(g):o(g)}function o(g){return g===41?m(g):HA(n,a,u,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(g)}function a(g){return Mt(g)?lu(n,f)(g):m(g)}function u(g){return t(g)}function f(g){return g===34||g===39||g===40?UA(n,d,t,"resourceTitle","resourceTitleMarker","resourceTitleString")(g):m(g)}function d(g){return Mt(g)?lu(n,m)(g):m(g)}function m(g){return g===41?(n.enter("resourceMarker"),n.consume(g),n.exit("resourceMarker"),n.exit("resource"),e):t(g)}}function AH(n,e,t){const i=this;return l;function l(u){return IA.call(i,n,o,a,"reference","referenceMarker","referenceString")(u)}function o(u){return i.parser.defined.includes(ir(i.sliceSerialize(i.events[i.events.length-1][1]).slice(1,-1)))?e(u):t(u)}function a(u){return t(u)}}function EH(n,e,t){return i;function i(o){return n.enter("reference"),n.enter("referenceMarker"),n.consume(o),n.exit("referenceMarker"),l}function l(o){return o===93?(n.enter("referenceMarker"),n.consume(o),n.exit("referenceMarker"),n.exit("reference"),e):t(o)}}const MH={name:"labelStartImage",resolveAll:hb.resolveAll,tokenize:DH};function DH(n,e,t){const i=this;let l;return o;function o(f){return n.enter("labelImage"),n.enter("labelImageMarker"),n.consume(f),n.exit("labelImageMarker"),a}function a(f){return f===91?(n.enter("labelMarker"),n.consume(f),n.exit("labelMarker"),l=n.exit("labelImage"),u):t(f)}function u(f){return f===94&&"_hiddenFootnoteSupport"in i.parser.constructs?t(f):(i._labelStarts=i._labelStarts||[],i._labelStarts.push(l),e(f))}}const jH={name:"labelStartLink",resolveAll:hb.resolveAll,tokenize:RH};function RH(n,e,t){const i=this;let l;return o;function o(u){return n.enter("labelLink"),n.enter("labelMarker"),n.consume(u),n.exit("labelMarker"),l=n.exit("labelLink"),a}function a(u){return u===94&&"_hiddenFootnoteSupport"in i.parser.constructs?t(u):(i._labelStarts=i._labelStarts||[],i._labelStarts.push(l),e(u))}}const L0={name:"lineEnding",tokenize:_H};function _H(n,e){return t;function t(i){return n.enter("lineEnding"),n.consume(i),n.exit("lineEnding"),mt(n,e,"linePrefix")}}const od={name:"thematicBreak",tokenize:LH};function LH(n,e,t){let i=0,l;return o;function o(d){return n.enter("thematicBreak"),a(d)}function a(d){return l=d,u(d)}function u(d){return d===l?(n.enter("thematicBreakSequence"),f(d)):i>=3&&(d===null||Be(d))?(n.exit("thematicBreak"),e(d)):t(d)}function f(d){return d===l?(n.consume(d),i++,f):(n.exit("thematicBreakSequence"),Ke(d)?mt(n,u,"whitespace")(d):u(d))}}const ai={continuation:{tokenize:HH},exit:UH,name:"list",tokenize:PH},zH={partial:!0,tokenize:FH},BH={partial:!0,tokenize:IH};function PH(n,e,t){const i=this,l=i.events[i.events.length-1];let o=l&&l[1].type==="linePrefix"?l[2].sliceSerialize(l[1],!0).length:0,a=0;return u;function u(v){const w=i.containerState.type||(v===42||v===43||v===45?"listUnordered":"listOrdered");if(w==="listUnordered"?!i.containerState.marker||v===i.containerState.marker:iy(v)){if(i.containerState.type||(i.containerState.type=w,n.enter(w,{_container:!0})),w==="listUnordered")return n.enter("listItemPrefix"),v===42||v===45?n.check(od,t,d)(v):d(v);if(!i.interrupt||v===49)return n.enter("listItemPrefix"),n.enter("listItemValue"),f(v)}return t(v)}function f(v){return iy(v)&&++a<10?(n.consume(v),f):(!i.interrupt||a<2)&&(i.containerState.marker?v===i.containerState.marker:v===41||v===46)?(n.exit("listItemValue"),d(v)):t(v)}function d(v){return n.enter("listItemMarker"),n.consume(v),n.exit("listItemMarker"),i.containerState.marker=i.containerState.marker||v,n.check(Ru,i.interrupt?t:m,n.attempt(zH,b,g))}function m(v){return i.containerState.initialBlankLine=!0,o++,b(v)}function g(v){return Ke(v)?(n.enter("listItemPrefixWhitespace"),n.consume(v),n.exit("listItemPrefixWhitespace"),b):t(v)}function b(v){return i.containerState.size=o+i.sliceSerialize(n.exit("listItemPrefix"),!0).length,e(v)}}function HH(n,e,t){const i=this;return i.containerState._closeFlow=void 0,n.check(Ru,l,o);function l(u){return i.containerState.furtherBlankLines=i.containerState.furtherBlankLines||i.containerState.initialBlankLine,mt(n,e,"listItemIndent",i.containerState.size+1)(u)}function o(u){return i.containerState.furtherBlankLines||!Ke(u)?(i.containerState.furtherBlankLines=void 0,i.containerState.initialBlankLine=void 0,a(u)):(i.containerState.furtherBlankLines=void 0,i.containerState.initialBlankLine=void 0,n.attempt(BH,e,a)(u))}function a(u){return i.containerState._closeFlow=!0,i.interrupt=void 0,mt(n,n.attempt(ai,e,t),"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(u)}}function IH(n,e,t){const i=this;return mt(n,l,"listItemIndent",i.containerState.size+1);function l(o){const a=i.events[i.events.length-1];return a&&a[1].type==="listItemIndent"&&a[2].sliceSerialize(a[1],!0).length===i.containerState.size?e(o):t(o)}}function UH(n){n.exit(this.containerState.type)}function FH(n,e,t){const i=this;return mt(n,l,"listItemPrefixWhitespace",i.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function l(o){const a=i.events[i.events.length-1];return!Ke(o)&&a&&a[1].type==="listItemPrefixWhitespace"?e(o):t(o)}}const hC={name:"setextUnderline",resolveTo:qH,tokenize:VH};function qH(n,e){const t=new Ud;let i=n.length,l,o,a;for(;i--;)if(n[i][0]==="enter"){if(n[i][1].type==="content"){l=i;break}n[i][1].type==="paragraph"&&(o=i)}else n[i][1].type==="content"&&t.add(i,1,[]),!a&&n[i][1].type==="definition"&&(a=i);const u={type:"setextHeading",start:{...n[l][1].start},end:{...n[n.length-1][1].end}};return n[o][1].type="setextHeadingText",a?(t.add(o,0,[["enter",u,e]]),t.add(a+1,0,[["exit",n[l][1],e]]),n[l][1].end={...n[a][1].end}):n[l][1]=u,t.add(n.length,0,[["exit",u,e]]),t.consume(n),n}function VH(n,e,t){const i=this;let l;return o;function o(d){let m=i.events.length,g;for(;m--;)if(i.events[m][1].type!=="lineEnding"&&i.events[m][1].type!=="linePrefix"&&i.events[m][1].type!=="content"){g=i.events[m][1].type==="paragraph";break}return!i.parser.lazy[i.now().line]&&(i.interrupt||g)?(n.enter("setextHeadingLine"),l=d,a(d)):t(d)}function a(d){return n.enter("setextHeadingLineSequence"),u(d)}function u(d){return d===l?(n.consume(d),u):(n.exit("setextHeadingLineSequence"),Ke(d)?mt(n,f,"lineSuffix")(d):f(d))}function f(d){return d===null||Be(d)?(n.exit("setextHeadingLine"),e(d)):t(d)}}const QH={tokenize:XH};function XH(n){const e=this,t=n.attempt(Ru,i,n.attempt(this.parser.constructs.flowInitial,l,mt(n,n.attempt(this.parser.constructs.flow,l,n.attempt(eH,l)),"linePrefix")));return t;function i(o){if(o===null){n.consume(o);return}return n.enter("lineEndingBlank"),n.consume(o),n.exit("lineEndingBlank"),e.currentConstruct=void 0,t}function l(o){if(o===null){n.consume(o);return}return n.enter("lineEnding"),n.consume(o),n.exit("lineEnding"),e.currentConstruct=void 0,t}}const $H={resolveAll:VA()},YH=qA("string"),GH=qA("text");function qA(n){return{resolveAll:VA(n==="text"?KH:void 0),tokenize:e};function e(t){const i=this,l=this.parser.constructs[n],o=t.attempt(l,a,u);return a;function a(m){return d(m)?o(m):u(m)}function u(m){if(m===null){t.consume(m);return}return t.enter("data"),t.consume(m),f}function f(m){return d(m)?(t.exit("data"),o(m)):(t.consume(m),f)}function d(m){if(m===null)return!0;const g=l[m];let b=-1;if(g)for(;++b-1){const u=a[0];typeof u=="string"?a[0]=u.slice(i):a.shift()}o>0&&a.push(n[l].slice(0,o))}return a}function c7(n,e){let t=-1;const i=[];let l;for(;++t0&&l(e.beforeEnter,{...de,sliceSerialize:V[ot][2].sliceSerialize},V[ot][1]),QA.call(gt,V[ot][1].type)&>[V[ot][1].type].call({...de,sliceSerialize:V[ot][2].sliceSerialize},V[ot][1]),V[ot][0]==="exit"&&e.afterExit.length>0&&l(e.afterExit,{...de,sliceSerialize:V[ot][2].sliceSerialize},V[ot][1])}if(de.tokenStack.length>0){const gt=de.tokenStack[de.tokenStack.length-1];(gt[1]||mC).call(de,void 0,gt[0])}for(K.position={start:Ql(V.length>0?V[0][1].start:{line:1,column:1,offset:0}),end:Ql(V.length>0?V[V.length-2][1].end:{line:1,column:1,offset:0})},ot=-1;++ot0&&(i.className=["language-"+l[0]]);let o={type:"element",tagName:"code",properties:i,children:[{type:"text",value:t}]};return e.meta&&(o.data={meta:e.meta}),n.patch(e,o),o=n.applyData(e,o),o={type:"element",tagName:"pre",properties:{},children:[o]},n.patch(e,o),o}function S7(n,e){const t={type:"element",tagName:"del",properties:{},children:n.all(e)};return n.patch(e,t),n.applyData(e,t)}function C7(n,e){const t={type:"element",tagName:"em",properties:{},children:n.all(e)};return n.patch(e,t),n.applyData(e,t)}function O7(n,e){const t=typeof n.options.clobberPrefix=="string"?n.options.clobberPrefix:"user-content-",i=String(e.identifier).toUpperCase(),l=Ba(i.toLowerCase()),o=n.footnoteOrder.indexOf(i);let a,u=n.footnoteCounts.get(i);u===void 0?(u=0,n.footnoteOrder.push(i),a=n.footnoteOrder.length):a=o+1,u+=1,n.footnoteCounts.set(i,u);const f={type:"element",tagName:"a",properties:{href:"#"+t+"fn-"+l,id:t+"fnref-"+l+(u>1?"-"+u:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(a)}]};n.patch(e,f);const d={type:"element",tagName:"sup",properties:{},children:[f]};return n.patch(e,d),n.applyData(e,d)}function N7(n,e){const t={type:"element",tagName:"h"+e.depth,properties:{},children:n.all(e)};return n.patch(e,t),n.applyData(e,t)}function T7(n,e){if(n.options.allowDangerousHtml){const t={type:"raw",value:e.value};return n.patch(e,t),n.applyData(e,t)}}function $A(n,e){const t=e.referenceType;let i="]";if(t==="collapsed"?i+="[]":t==="full"&&(i+="["+(e.label||e.identifier)+"]"),e.type==="imageReference")return[{type:"text",value:"!["+e.alt+i}];const l=n.all(e),o=l[0];o&&o.type==="text"?o.value="["+o.value:l.unshift({type:"text",value:"["});const a=l[l.length-1];return a&&a.type==="text"?a.value+=i:l.push({type:"text",value:i}),l}function A7(n,e){const t=String(e.identifier).toUpperCase(),i=n.definitionById.get(t);if(!i)return $A(n,e);const l={src:Ba(i.url||""),alt:e.alt};i.title!==null&&i.title!==void 0&&(l.title=i.title);const o={type:"element",tagName:"img",properties:l,children:[]};return n.patch(e,o),n.applyData(e,o)}function E7(n,e){const t={src:Ba(e.url)};e.alt!==null&&e.alt!==void 0&&(t.alt=e.alt),e.title!==null&&e.title!==void 0&&(t.title=e.title);const i={type:"element",tagName:"img",properties:t,children:[]};return n.patch(e,i),n.applyData(e,i)}function M7(n,e){const t={type:"text",value:e.value.replace(/\r?\n|\r/g," ")};n.patch(e,t);const i={type:"element",tagName:"code",properties:{},children:[t]};return n.patch(e,i),n.applyData(e,i)}function D7(n,e){const t=String(e.identifier).toUpperCase(),i=n.definitionById.get(t);if(!i)return $A(n,e);const l={href:Ba(i.url||"")};i.title!==null&&i.title!==void 0&&(l.title=i.title);const o={type:"element",tagName:"a",properties:l,children:n.all(e)};return n.patch(e,o),n.applyData(e,o)}function j7(n,e){const t={href:Ba(e.url)};e.title!==null&&e.title!==void 0&&(t.title=e.title);const i={type:"element",tagName:"a",properties:t,children:n.all(e)};return n.patch(e,i),n.applyData(e,i)}function R7(n,e,t){const i=n.all(e),l=t?_7(t):YA(e),o={},a=[];if(typeof e.checked=="boolean"){const m=i[0];let g;m&&m.type==="element"&&m.tagName==="p"?g=m:(g={type:"element",tagName:"p",properties:{},children:[]},i.unshift(g)),g.children.length>0&&g.children.unshift({type:"text",value:" "}),g.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:e.checked,disabled:!0},children:[]}),o.className=["task-list-item"]}let u=-1;for(;++u1}function L7(n,e){const t={},i=n.all(e);let l=-1;for(typeof e.start=="number"&&e.start!==1&&(t.start=e.start);++l0){const a={type:"element",tagName:"tbody",properties:{},children:n.wrap(t,!0)},u=sb(e.children[1]),f=CA(e.children[e.children.length-1]);u&&f&&(a.position={start:u,end:f}),l.push(a)}const o={type:"element",tagName:"table",properties:{},children:n.wrap(l,!0)};return n.patch(e,o),n.applyData(e,o)}function I7(n,e,t){const i=t?t.children:void 0,o=(i?i.indexOf(e):1)===0?"th":"td",a=t&&t.type==="table"?t.align:void 0,u=a?a.length:e.children.length;let f=-1;const d=[];for(;++f0,!0),i[0]),l=i.index+i[0].length,i=t.exec(e);return o.push(xC(e.slice(l),l>0,!1)),o.join("")}function xC(n,e,t){let i=0,l=n.length;if(e){let o=n.codePointAt(i);for(;o===pC||o===gC;)i++,o=n.codePointAt(i)}if(t){let o=n.codePointAt(l-1);for(;o===pC||o===gC;)l--,o=n.codePointAt(l-1)}return l>i?n.slice(i,l):""}function q7(n,e){const t={type:"text",value:F7(String(e.value))};return n.patch(e,t),n.applyData(e,t)}function V7(n,e){const t={type:"element",tagName:"hr",properties:{},children:[]};return n.patch(e,t),n.applyData(e,t)}const Q7={blockquote:v7,break:w7,code:k7,delete:S7,emphasis:C7,footnoteReference:O7,heading:N7,html:T7,imageReference:A7,image:E7,inlineCode:M7,linkReference:D7,link:j7,listItem:R7,list:L7,paragraph:z7,root:B7,strong:P7,table:H7,tableCell:U7,tableRow:I7,text:q7,thematicBreak:V7,toml:Uh,yaml:Uh,definition:Uh,footnoteDefinition:Uh};function Uh(){}const GA=-1,dm=0,su=1,Fd=2,db=3,mb=4,pb=5,gb=6,KA=7,WA=8,{defineProperty:X7}=Object,ZA=typeof self=="object"?self:globalThis,yC=(n,e)=>{switch(n){case"Function":case"SharedWorker":case"Worker":case"eval":case"setInterval":case"setTimeout":throw new TypeError("unable to deserialize "+n)}return new ZA[n](e)},$7=(n,e)=>{const t=(l,o)=>(n.set(o,l),l),i=l=>{if(n.has(l))return n.get(l);const[o,a]=e[l];switch(o){case dm:case GA:return t(a,l);case su:{const u=t([],l);for(const f of a)u.push(i(f));return u}case Fd:{const u=t({},l);for(const[f,d]of a){const m=i(f),g=i(d);m==="__proto__"?X7(u,m,{value:g,configurable:!0,enumerable:!0,writable:!0}):u[m]=g}return u}case db:return t(new Date(a),l);case mb:{const{source:u,flags:f}=a;return t(new RegExp(u,f),l)}case pb:{const u=t(new Map,l);for(const[f,d]of a)u.set(i(f),i(d));return u}case gb:{const u=t(new Set,l);for(const f of a)u.add(i(f));return u}case KA:{const{name:u,message:f}=a;return t(typeof ZA[u]=="function"?yC(u,f):new Error(f),l)}case WA:return t(BigInt(a),l);case"BigInt":return t(Object(BigInt(a)),l);case"ArrayBuffer":return t(new Uint8Array(a).buffer,a);case"DataView":{const{buffer:u}=new Uint8Array(a);return t(new DataView(u),a)}case"-0":return-0}return t(yC(o,a),l)};return i},bC=n=>$7(new Map,n)(0),Qs="",{toString:Y7}={},{keys:G7,is:K7}=Object,qc=n=>{const e=typeof n;if(e!=="object"||!n)return[dm,e];const t=Y7.call(n).slice(8,-1);switch(t){case"Array":return[su,Qs];case"Object":return[Fd,Qs];case"Date":return[db,Qs];case"RegExp":return[mb,Qs];case"Map":return[pb,Qs];case"Set":return[gb,Qs];case"DataView":return[su,t]}return t.includes("Array")?[su,t]:n instanceof Error?[KA,n.name||"Error"]:[Fd,t]},Fh=([n,e])=>n===dm&&(e==="function"||e==="symbol"),W7=(n,e,t,i)=>{const l=(a,u)=>{const f=i.push(a)-1;return t.set(u,f),f},o=a=>{if(t.has(a))return t.get(a);let[u,f]=qc(a);switch(u){case dm:{let m=a;switch(f){case"bigint":u=WA,m=a.toString();break;case"number":if(!a&&K7(a,-0))return i.push(["-0"])-1;break;case"function":case"symbol":if(n)throw new TypeError("unable to serialize "+f);m=null;break;case"undefined":return l([GA],a)}return l([u,m],a)}case su:{if(f){let b=a;return f==="DataView"?b=new Uint8Array(a.buffer):f==="ArrayBuffer"&&(b=new Uint8Array(a)),l([f,[...b]],a)}const m=[],g=l([u,m],a);for(const b of a)m.push(o(b));return g}case Fd:{if(f)switch(f){case"BigInt":return l([f,a.toString()],a);case"Boolean":case"Number":case"String":return l([f,a.valueOf()],a)}if(e&&"toJSON"in a)return o(a.toJSON());const m=[],g=l([u,m],a);for(const b of G7(a))(n||!Fh(qc(a[b])))&&m.push([o(b),o(a[b])]);return g}case db:return l([u,isNaN(a.getTime())?Qs:a.toISOString()],a);case mb:{const{source:m,flags:g}=a;return l([u,{source:m,flags:g}],a)}case pb:{const m=[],g=l([u,m],a);for(const[b,v]of a)(n||!(Fh(qc(b))||Fh(qc(v))))&&m.push([o(b),o(v)]);return g}case gb:{const m=[],g=l([u,m],a);for(const b of a)(n||!Fh(qc(b)))&&m.push(o(b));return g}}const{message:d}=a;return l([u,{name:f,message:d}],a)};return o},vC=(n,{json:e,lossy:t}={})=>{const i=[];return W7(!(e||t),!!e,new Map,i)(n),i},qd=typeof structuredClone=="function"?(n,e)=>e&&("json"in e||"lossy"in e)?bC(vC(n,e)):structuredClone(n):(n,e)=>bC(vC(n,e));function Z7(n,e){const t=[{type:"text",value:"↩"}];return e>1&&t.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(e)}]}),t}function J7(n,e){return"Back to reference "+(n+1)+(e>1?"-"+e:"")}function eI(n){const e=typeof n.options.clobberPrefix=="string"?n.options.clobberPrefix:"user-content-",t=n.options.footnoteBackContent||Z7,i=n.options.footnoteBackLabel||J7,l=n.options.footnoteLabel||"Footnotes",o=n.options.footnoteLabelTagName||"h2",a=n.options.footnoteLabelProperties||{className:["sr-only"]},u=[];let f=-1;for(;++f0&&w.push({type:"text",value:" "});let R=typeof t=="string"?t:t(f,v);typeof R=="string"&&(R={type:"text",value:R}),w.push({type:"element",tagName:"a",properties:{href:"#"+e+"fnref-"+b+(v>1?"-"+v:""),dataFootnoteBackref:"",ariaLabel:typeof i=="string"?i:i(f,v),className:["data-footnote-backref"]},children:Array.isArray(R)?R:[R]})}const C=m[m.length-1];if(C&&C.type==="element"&&C.tagName==="p"){const R=C.children[C.children.length-1];R&&R.type==="text"?R.value+=" ":C.children.push({type:"text",value:" "}),C.children.push(...w)}else m.push(...w);const N={type:"element",tagName:"li",properties:{id:e+"fn-"+b},children:n.wrap(m,!0)};n.patch(d,N),u.push(N)}if(u.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:o,properties:{...qd(a),id:"footnote-label"},children:[{type:"text",value:l}]},{type:"text",value:` +`},{type:"element",tagName:"ol",properties:{},children:n.wrap(u,!0)},{type:"text",value:` +`}]}}const mm=(function(n){if(n==null)return rI;if(typeof n=="function")return pm(n);if(typeof n=="object")return Array.isArray(n)?tI(n):nI(n);if(typeof n=="string")return iI(n);throw new Error("Expected function, string, or object as test")});function tI(n){const e=[];let t=-1;for(;++t":""))+")"})}return C;function C(){const N=!o||d(b,v,w[w.length-1]||void 0);let R=JA;if(u&&N&&(R=wC(u(b,w,v)),R[0]===ad))return R;if("children"in b&&b.children){const M=b;if(M.children&&R[0]!==oy){let I=(l?-1:M.children.length)+m;const U=[...w,M];for(;I>-1&&I0&&t.push({type:"text",value:` +`}),t}function kC(n){let e=0,t=n.charCodeAt(e);for(;t===9||t===32;)e++,t=n.charCodeAt(e);return n.slice(e)}function SC(n,e){const t=cI(n,e),i=t.one(n,void 0),l=eI(t),o=Array.isArray(i)?{type:"root",children:i}:i||{type:"root",children:[]};return l&&o.children.push({type:"text",value:` +`},l),o}function mI(n,e){return n&&"run"in n?async function(t,i){const l=SC(t,{file:i,...e});await n.run(l,i)}:function(t,i){return SC(t,{file:i,...n||e})}}function CC(n){if(n)throw n}var z0,OC;function pI(){if(OC)return z0;OC=1;var n=Object.prototype.hasOwnProperty,e=Object.prototype.toString,t=Object.defineProperty,i=Object.getOwnPropertyDescriptor,l=function(d){return typeof Array.isArray=="function"?Array.isArray(d):e.call(d)==="[object Array]"},o=function(d){if(!d||e.call(d)!=="[object Object]")return!1;var m=n.call(d,"constructor"),g=d.constructor&&d.constructor.prototype&&n.call(d.constructor.prototype,"isPrototypeOf");if(d.constructor&&!m&&!g)return!1;var b;for(b in d);return typeof b>"u"||n.call(d,b)},a=function(d,m){t&&m.name==="__proto__"?t(d,m.name,{enumerable:!0,configurable:!0,value:m.newValue,writable:!0}):d[m.name]=m.newValue},u=function(d,m){if(m==="__proto__")if(n.call(d,m)){if(i)return i(d,m).value}else return;return d[m]};return z0=function f(){var d,m,g,b,v,w,S=arguments[0],C=1,N=arguments.length,R=!1;for(typeof S=="boolean"&&(R=S,S=arguments[1]||{},C=2),(S==null||typeof S!="object"&&typeof S!="function")&&(S={});Ca.length;let f;u&&a.push(l);try{f=n.apply(this,a)}catch(d){const m=d;if(u&&t)throw m;return l(m)}u||(f&&f.then&&typeof f.then=="function"?f.then(o,l):f instanceof Error?l(f):o(f))}function l(a,...u){t||(t=!0,e(a,...u))}function o(a){l(null,a)}}const Nr={basename:bI,dirname:vI,extname:wI,join:kI,sep:"/"};function bI(n,e){if(e!==void 0&&typeof e!="string")throw new TypeError('"ext" argument must be a string');_u(n);let t=0,i=-1,l=n.length,o;if(e===void 0||e.length===0||e.length>n.length){for(;l--;)if(n.codePointAt(l)===47){if(o){t=l+1;break}}else i<0&&(o=!0,i=l+1);return i<0?"":n.slice(t,i)}if(e===n)return"";let a=-1,u=e.length-1;for(;l--;)if(n.codePointAt(l)===47){if(o){t=l+1;break}}else a<0&&(o=!0,a=l+1),u>-1&&(n.codePointAt(l)===e.codePointAt(u--)?u<0&&(i=l):(u=-1,i=a));return t===i?i=a:i<0&&(i=n.length),n.slice(t,i)}function vI(n){if(_u(n),n.length===0)return".";let e=-1,t=n.length,i;for(;--t;)if(n.codePointAt(t)===47){if(i){e=t;break}}else i||(i=!0);return e<0?n.codePointAt(0)===47?"/":".":e===1&&n.codePointAt(0)===47?"//":n.slice(0,e)}function wI(n){_u(n);let e=n.length,t=-1,i=0,l=-1,o=0,a;for(;e--;){const u=n.codePointAt(e);if(u===47){if(a){i=e+1;break}continue}t<0&&(a=!0,t=e+1),u===46?l<0?l=e:o!==1&&(o=1):l>-1&&(o=-1)}return l<0||t<0||o===0||o===1&&l===t-1&&l===i+1?"":n.slice(l,t)}function kI(...n){let e=-1,t;for(;++e0&&n.codePointAt(n.length-1)===47&&(t+="/"),e?"/"+t:t}function CI(n,e){let t="",i=0,l=-1,o=0,a=-1,u,f;for(;++a<=n.length;){if(a2){if(f=t.lastIndexOf("/"),f!==t.length-1){f<0?(t="",i=0):(t=t.slice(0,f),i=t.length-1-t.lastIndexOf("/")),l=a,o=0;continue}}else if(t.length>0){t="",i=0,l=a,o=0;continue}}e&&(t=t.length>0?t+"/..":"..",i=2)}else t.length>0?t+="/"+n.slice(l+1,a):t=n.slice(l+1,a),i=a-l-1;l=a,o=0}else u===46&&o>-1?o++:o=-1}return t}function _u(n){if(typeof n!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(n))}const OI={cwd:NI};function NI(){return"/"}function hy(n){return!!(n!==null&&typeof n=="object"&&"href"in n&&n.href&&"protocol"in n&&n.protocol&&n.auth===void 0)}function TI(n){if(typeof n=="string")n=new URL(n);else if(!hy(n)){const e=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+n+"`");throw e.code="ERR_INVALID_ARG_TYPE",e}if(n.protocol!=="file:"){const e=new TypeError("The URL must be of scheme file");throw e.code="ERR_INVALID_URL_SCHEME",e}return AI(n)}function AI(n){if(n.hostname!==""){const i=new TypeError('File URL host must be "localhost" or empty on darwin');throw i.code="ERR_INVALID_FILE_URL_HOST",i}const e=n.pathname;let t=-1;for(;++t0){let[v,...w]=m;const S=i[b][1];fy(S)&&fy(v)&&(v=B0(!0,S,v)),i[b]=[d,v,...w]}}}}const jI=new yb().freeze();function U0(n,e){if(typeof e!="function")throw new TypeError("Cannot `"+n+"` without `parser`")}function F0(n,e){if(typeof e!="function")throw new TypeError("Cannot `"+n+"` without `compiler`")}function q0(n,e){if(e)throw new Error("Cannot call `"+n+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function TC(n){if(!fy(n)||typeof n.type!="string")throw new TypeError("Expected node, got `"+n+"`")}function AC(n,e,t){if(!t)throw new Error("`"+n+"` finished async. Use `"+e+"` instead")}function qh(n){return RI(n)?n:new eE(n)}function RI(n){return!!(n&&typeof n=="object"&&"message"in n&&"messages"in n)}function _I(n){return typeof n=="string"||LI(n)}function LI(n){return!!(n&&typeof n=="object"&&"byteLength"in n&&"byteOffset"in n)}const zI="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",EC=[],MC={allowDangerousHtml:!0},BI=/^(https?|ircs?|mailto|xmpp)$/i,PI=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"className",id:"remove-classname"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function HI(n){const e=II(n),t=UI(n);return FI(e.runSync(e.parse(t),t),n)}function II(n){const e=n.rehypePlugins||EC,t=n.remarkPlugins||EC,i=n.remarkRehypeOptions?{...n.remarkRehypeOptions,...MC}:MC;return jI().use(b7).use(t).use(mI,i).use(e)}function UI(n){const e=n.children||"",t=new eE;return typeof e=="string"&&(t.value=e),t}function FI(n,e){const t=e.allowedElements,i=e.allowElement,l=e.components,o=e.disallowedElements,a=e.skipHtml,u=e.unwrapDisallowed,f=e.urlTransform||qI;for(const m of PI)Object.hasOwn(e,m.from)&&(""+m.from+(m.to?"use `"+m.to+"` instead":"remove it")+zI+m.id,void 0);return xb(n,d),lP(n,{Fragment:y.Fragment,components:l,ignoreInvalidStyle:!0,jsx:y.jsx,jsxs:y.jsxs,passKeys:!0,passNode:!0});function d(m,g,b){if(m.type==="raw"&&b&&typeof g=="number")return a?b.children.splice(g,1):b.children[g]={type:"text",value:m.value},g;if(m.type==="element"){let v;for(v in R0)if(Object.hasOwn(R0,v)&&Object.hasOwn(m.properties,v)){const w=m.properties[v],S=R0[v];(S===null||S.includes(m.tagName))&&(m.properties[v]=f(String(w||""),v,m))}}if(m.type==="element"){let v=t?!t.includes(m.tagName):o?o.includes(m.tagName):!1;if(!v&&i&&typeof g=="number"&&(v=!i(m,g,b)),v&&b&&typeof g=="number")return u&&m.children?b.children.splice(g,1,...m.children):b.children.splice(g,1),g}}}function qI(n){const e=n.indexOf(":"),t=n.indexOf("?"),i=n.indexOf("#"),l=n.indexOf("/");return e===-1||l!==-1&&e>l||t!==-1&&e>t||i!==-1&&e>i||BI.test(n.slice(0,e))?n:""}function VI(n){if(typeof n!="string")throw new TypeError("Expected a string");return n.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function tE(n,e,t){const l=mm((t||{}).ignore||[]),o=QI(e);let a=-1;for(;++a0?{type:"text",value:E}:void 0),E===!1)v.lastIndex=I+1;else{if(S!==I&&M({type:"text",value:d.value.slice(S,I)}),Array.isArray(E))for(const T of E)M(T);else E&&M(E);S=I+R[0].length,C=!0}if(!v.global)break;R=v.exec(d.value)}return C?(S?\]}]+$/.exec(n);if(!e)return[n,void 0];n=n.slice(0,e.index);let t=e[0],i=t.indexOf(")");const l=DC(n,"(");let o=DC(n,")");for(;i!==-1&&l>o;)n+=t.slice(0,i+1),t=t.slice(i+1),i=t.indexOf(")"),o++;return[n,t]}function nE(n,e){const t=n.input.charCodeAt(n.index-1);return(n.index===0||lo(t)||fm(t))&&(!e||t!==47)}iE.peek=xU;function cU(){this.buffer()}function uU(n){this.enter({type:"footnoteReference",identifier:"",label:""},n)}function fU(){this.buffer()}function hU(n){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},n)}function dU(n){const e=this.resume(),t=this.stack[this.stack.length-1];t.type,t.identifier=ir(this.sliceSerialize(n)).toLowerCase(),t.label=e}function mU(n){this.exit(n)}function pU(n){const e=this.resume(),t=this.stack[this.stack.length-1];t.type,t.identifier=ir(this.sliceSerialize(n)).toLowerCase(),t.label=e}function gU(n){this.exit(n)}function xU(){return"["}function iE(n,e,t,i){const l=t.createTracker(i);let o=l.move("[^");const a=t.enter("footnoteReference"),u=t.enter("reference");return o+=l.move(t.safe(t.associationId(n),{after:"]",before:o})),u(),a(),o+=l.move("]"),o}function yU(){return{enter:{gfmFootnoteCallString:cU,gfmFootnoteCall:uU,gfmFootnoteDefinitionLabelString:fU,gfmFootnoteDefinition:hU},exit:{gfmFootnoteCallString:dU,gfmFootnoteCall:mU,gfmFootnoteDefinitionLabelString:pU,gfmFootnoteDefinition:gU}}}function bU(n){let e=!1;return n&&n.firstLineBlank&&(e=!0),{handlers:{footnoteDefinition:t,footnoteReference:iE},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function t(i,l,o,a){const u=o.createTracker(a);let f=u.move("[^");const d=o.enter("footnoteDefinition"),m=o.enter("label");return f+=u.move(o.safe(o.associationId(i),{before:f,after:"]"})),m(),f+=u.move("]:"),i.children&&i.children.length>0&&(u.shift(4),f+=u.move((e?` +`:" ")+o.indentLines(o.containerFlow(i,u.current()),e?rE:vU))),d(),f}}function vU(n,e,t){return e===0?n:rE(n,e,t)}function rE(n,e,t){return(t?"":" ")+n}const wU=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];bb.attention=NU;bb.peek=TU;function kU(){return{canContainEols:["delete"],enter:{strikethrough:CU},exit:{strikethrough:OU}}}function SU(){return{handlers:{delete:bb},unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:wU}]}}function CU(n){this.enter({type:"delete",children:[],position:void 0},n)}function OU(n){this.exit(n)}function bb(n,e,t,i){const l=t.createTracker(i),o=t.stack.includes("strikethrough")?"~":"~~",a=t.enter("strikethrough");let u=l.move(o);return u+=t.containerPhrasing(n,{...l.current(),before:u,after:"~"}),u+=l.move(o),a(),u}function NU(){return{construct:"strikethrough",markers:["~"],sizes:[2,1]}}function TU(){return"~"}function AU(n){return n.length}function EU(n,e){const t=e||{},i=(t.align||[]).concat(),l=t.stringLength||AU,o=[],a=[],u=[],f=[];let d=0,m=-1;for(;++md&&(d=n[m].length);++Nf[N])&&(f[N]=M)}S.push(R)}a[m]=S,u[m]=C}let g=-1;if(typeof i=="object"&&"length"in i)for(;++gf[g]&&(f[g]=R),v[g]=R),b[g]=M}a.splice(1,0,b),u.splice(1,0,v),m=-1;const w=[];for(;++m "),o.shift(2);const a=t.indentLines(t.containerFlow(n,o.current()),RU);return l(),a}function RU(n,e,t){return">"+(t?"":" ")+n}function _U(n,e){return RC(n,e.inConstruct,!0)&&!RC(n,e.notInConstruct,!1)}function RC(n,e,t){if(typeof e=="string"&&(e=[e]),!e||e.length===0)return t;let i=-1;for(;++ia&&(a=o):o=1,l=i+e.length,i=t.indexOf(e,l);return a}function zU(n,e){return!!(e.options.fences===!1&&n.value&&!n.lang&&/[^\n\r ]/.test(n.value)&&!/^[\t ]*(?:[\n\r]|$)|(?:^|[\n\r])[\t ]*$/.test(n.value))}function BU(n){const e=n.options.fence||"`";if(e!=="`"&&e!=="~")throw new Error("Cannot serialize code with `"+e+"` for `options.fence`, expected `` ` `` or `~`");return e}function PU(n,e,t,i){const l=BU(t),o=n.value||"";if(zU(n,t)){const g=t.enter("codeIndented"),b=t.indentLines(o,HU);return g(),b}const a=t.createTracker(i),u=l.repeat(Math.max(LU(o,l)+1,3)),f=t.enter("codeFenced"),d=l==="`"?"GraveAccent":"Tilde";let m=a.move(u);if(n.lang){const g=t.enter(`codeFencedLang${d}`);m+=a.move(t.safe(n.lang,{before:m,after:" ",encode:["`"],...a.current()})),g()}if(n.lang&&n.meta){const g=t.enter(`codeFencedMeta${d}`);m+=a.move(" "),m+=a.move(t.safe(n.meta,{before:m,after:` +`,encode:["`"],...a.current()})),g()}return m+=a.move(` +`),o&&(m+=a.move(o+` +`)),m+=a.move(u),f(),m}function HU(n,e,t){return(t?"":" ")+n}function vb(n){const e=n.options.quote||'"';if(e!=='"'&&e!=="'")throw new Error("Cannot serialize title with `"+e+"` for `options.quote`, expected `\"`, or `'`");return e}function IU(n,e,t,i){const l=vb(t),o=l==='"'?"Quote":"Apostrophe",a=t.enter("definition");let u=t.enter("label");const f=t.createTracker(i);let d=f.move("[");return d+=f.move(t.safe(t.associationId(n),{before:d,after:"]",...f.current()})),d+=f.move("]: "),u(),!n.url||/[\0- \u007F]/.test(n.url)?(u=t.enter("destinationLiteral"),d+=f.move("<"),d+=f.move(t.safe(n.url,{before:d,after:">",...f.current()})),d+=f.move(">")):(u=t.enter("destinationRaw"),d+=f.move(t.safe(n.url,{before:d,after:n.title?" ":` +`,...f.current()}))),u(),n.title&&(u=t.enter(`title${o}`),d+=f.move(" "+l),d+=f.move(t.safe(n.title,{before:d,after:l,...f.current()})),d+=f.move(l),u()),a(),d}function UU(n){const e=n.options.emphasis||"*";if(e!=="*"&&e!=="_")throw new Error("Cannot serialize emphasis with `"+e+"` for `options.emphasis`, expected `*`, or `_`");return e}function Vd(n){const e=n.codePointAt(0);return e===void 0?"":String.fromCodePoint(e)}function wa(n){const e=n.codePointAt(n.length-2);return e!==void 0&&e>65535?n.slice(-2):n.slice(-1)}function lE(n){return"&#x"+n.toString(16).toUpperCase()+";"}function LC(n,e,t){const i=cs(n),l=cs(e);return i===void 0?l===void 0?t==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:l===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:i===1?l===void 0?{inside:!1,outside:!1}:l===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:l===void 0?{inside:!1,outside:!1}:l===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}function FU(n){if(n.charCodeAt(0)!==60)return;const e=n.charCodeAt(1);if(e===33){const u=n.charCodeAt(2);return u===45?2:u===91?5:Rn(u)?4:void 0}if(e===63)return 3;const t=e===47,i=t?2:1;let l=i,o=n.charCodeAt(l);if(!Rn(o))return;for(;o===45||_n(o);)o=n.charCodeAt(++l);const a=n.slice(i,l).toLowerCase();return!t&&o!==47&&sy.includes(a)?1:FA.includes(a)?6:7}const qU=new Map([["*",!1],["_",!0]]);function VU(n,e,t){const i=new Set;for(const o of n){const a=t.get(o);if(a&&o.attention&&e.some(u=>u.attention===o.attention))for(const u of a.tokens)i.add(u.attention)}const l=[];for(const o of n)o.attention&&i.delete(o.attention)&&l.push(o.attention);return l.reverse(),l}function sE(n,e,t){const i=[],l=new Map,o=new Map;let a=0;for(;at.index)return{chosen:f,mistake:m,tokens:d}}}}function XU(n,e){const t=new Map;for(const i of n){const l=i.tokens[0].value.charAt(0);let o=t.get(l);o||(o=[],t.set(l,o));let a=i.close?o.length:0;for(;a--&&i.start1&&d>1?2:1:d,g=u.markers.slice(u.end-m,u.end),b=i.markers.slice(i.start,i.start+m),v=g[0],w=b[0];if(v===g[m-1]&&v.value.length===m&&w===b[m-1]&&w.value.length===m&&v.attention===w.attention)e.delete(v),e.delete(w);else{const S=[...new Set([...g,...b])];for(const C of S){const N=e.get(C);N&&N.push(...S)}}u.end-=m,i.start+=m,u.start===u.end&&o.splice(a,1),a=o.length}i.open&&i.start0?w[0].value:"",C=LC(b.charCodeAt(b.length-1),S.charCodeAt(0),m);C.inside&&Vh(w,!0);const N=w.length>0?wa(w[w.length-1].value):"",R=LC(v.charCodeAt(0),N.charCodeAt(N.length-1),m);R.inside&&Vh(w,!1),C.outside&&b!==` +`&&b!=="\r"&&Vh(l,!1),R.outside&&(o=v),l.push({value:d,attention:f},...w,{value:d,attention:f}),a=d.charAt(d.length-1)}return l}function gm(n,e,t){let i=new Map;const l=kb(n,i,e,t);let o=l,a=sE(o,e,t);for(;a;){const f=QU(n,i,a,e,t);if(!f){o=l;break}i=f.chosen,o=f.tokens,a=f.mistake}let u="";for(const f of o)u+=f.value;return u}Sb.attention=oE;Sb.peek=GU;function Sb(n,e,t,i){const l=t.enter("phrasing"),o=wb(n,oE,t,t.createTracker(i)),a=gm([o],i.before,i.after);return l(),a}function oE(n,e){return{construct:"emphasis",markers:UU(e)==="*"?["*","_"]:["_","*"],sizes:[1]}}function GU(n,e,t){return t.options.emphasis||"*"}function KU(n,e){let t=!1;return xb(n,function(i){if("value"in i&&/\r?\n|\r/.test(i.value)||i.type==="break")return t=!0,ad}),!!((!n.depth||n.depth<3)&&ub(n)&&(e.options.setext||t))}function WU(n,e,t,i){const l=Math.max(Math.min(6,n.depth||1),1),o=t.createTracker(i);if(KU(n,t)){const g=t.enter("headingSetext"),b=t.enter("phrasing"),v=t.containerPhrasing(n,{...o.current(),before:` +`,after:` +`});return b(),g(),v+` +`+(l===1?"=":"-").repeat(v.length-(Math.max(v.lastIndexOf("\r"),v.lastIndexOf(` +`))+1))}const a="#".repeat(l),u=t.enter("headingAtx"),f=t.enter("phrasing");o.move(a+" ");let d=t.containerPhrasing(n,{before:"# ",after:` +`,...o.current()});const m=d.charCodeAt(0);return(m===9||m===32)&&(d=lE(m)+d.slice(1)),d=d?a+" "+d:a,t.options.closeAtx&&(d+=" "+a),f(),u(),d}aE.peek=ZU;function aE(n){return n.value||""}function ZU(){return"<"}cE.peek=JU;function cE(n,e,t,i){const l=vb(t),o=l==='"'?"Quote":"Apostrophe",a=t.enter("image");let u=t.enter("label");const f=t.createTracker(i);let d=f.move("![");return d+=f.move(t.safe(n.alt,{before:d,after:"]",...f.current()})),d+=f.move("]("),u(),!n.url&&n.title||/[\0- \u007F]/.test(n.url)?(u=t.enter("destinationLiteral"),d+=f.move("<"),d+=f.move(t.safe(n.url,{before:d,after:">",...f.current()})),d+=f.move(">")):(u=t.enter("destinationRaw"),d+=f.move(t.safe(n.url,{before:d,after:n.title?" ":")",...f.current()}))),u(),n.title&&(u=t.enter(`title${o}`),d+=f.move(" "+l),d+=f.move(t.safe(n.title,{before:d,after:l,...f.current()})),d+=f.move(l),u()),d+=f.move(")"),a(),d}function JU(){return"!"}uE.peek=eF;function uE(n,e,t,i){const l=n.referenceType,o=t.enter("imageReference");let a=t.enter("label");const u=t.createTracker(i);let f=u.move("![");const d=t.safe(n.alt,{before:f,after:"]",...u.current()});f+=u.move(d+"]["),a();const m=t.stack;t.stack=m.filter(function(b){return b!=="phrasing"}),a=t.enter("reference");const g=t.safe(t.associationId(n),{before:f,after:"]",...u.current()});return a(),t.stack=m,o(),l==="full"||!d||d!==g?f+=u.move(g+"]"):l==="shortcut"?f=f.slice(0,-1):f+=u.move("]"),f}function eF(){return"!"}fE.peek=tF;function fE(n,e,t){let i=n.value||"",l="`",o=-1;for(;new RegExp("(^|[^`])"+l+"([^`]|$)").test(i);)l+="`";for(/[^\n\r ]/.test(i)&&(/^[\n\r ]/.test(i)&&/[\n\r ]$/.test(i)||/^`|`$/.test(i))&&(i=" "+i+" ");++o\u007F]/.test(n.url))}dE.peek=nF;function dE(n,e,t,i){const l=vb(t),o=l==='"'?"Quote":"Apostrophe",a=t.createTracker(i);if(hE(n,t)){const w=t.stack;t.stack=w.filter(function(N){return N!=="phrasing"});const S=t.enter("autolink");let C=a.move("<");return C+=a.move(t.containerPhrasing(n,{before:C,after:">",...a.current()})),C+=a.move(">"),S(),t.stack=w,C}const u=t.enter("link");let f=t.enter("label"),d=a.move("[");const m=t.containerPhrasing(n,{before:d,after:"](",...a.current()});d+=a.move(m),f(),d+=a.move("](");const g=/[\0- \u007F]/.test(n.url),b=i.before.charAt(i.before.length-1);let v=n.title||void 0;if(!v&&!g&&(b===` +`||b==="\r")){let w=0;for(;w",...a.current()})),d+=a.move(">")):(f=t.enter("destinationRaw"),d+=a.move(t.safe(n.url,{before:d,after:typeof v=="string"?" ":")",...a.current()}))),f(),typeof v=="string"&&(f=t.enter(`title${o}`),d+=a.move(" "+l),d+=a.move(t.safe(v,{before:d,after:l,...a.current()})),d+=a.move(l),f()),d+=a.move(")"),u(),d}function nF(n,e,t){return hE(n,t)?"<":"["}mE.peek=iF;function mE(n,e,t,i){const l=n.referenceType,o=t.enter("linkReference");let a=t.enter("label");const u=t.createTracker(i);let f=u.move("[");const d=t.containerPhrasing(n,{before:f,after:"]",...u.current()});f+=u.move(d+"]["),a();const m=t.stack;t.stack=m.filter(function(b){return b!=="phrasing"}),a=t.enter("reference");const g=t.safe(t.associationId(n),{before:f,after:"]",...u.current()});return a(),t.stack=m,o(),l==="full"||!d||d!==g?f+=u.move(g+"]"):l==="shortcut"?f=f.slice(0,-1):f+=u.move("]"),f}function iF(){return"["}function Cb(n){const e=n.options.bullet||"*";if(e!=="*"&&e!=="+"&&e!=="-")throw new Error("Cannot serialize items with `"+e+"` for `options.bullet`, expected `*`, `+`, or `-`");return e}function rF(n){const e=Cb(n),t=n.options.bulletOther;if(!t)return e==="*"?"-":"*";if(t!=="*"&&t!=="+"&&t!=="-")throw new Error("Cannot serialize items with `"+t+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(t===e)throw new Error("Expected `bullet` (`"+e+"`) and `bulletOther` (`"+t+"`) to be different");return t}function lF(n){const e=n.options.bulletOrdered||".";if(e!=="."&&e!==")")throw new Error("Cannot serialize items with `"+e+"` for `options.bulletOrdered`, expected `.` or `)`");return e}function pE(n){const e=n.options.rule||"*";if(e!=="*"&&e!=="-"&&e!=="_")throw new Error("Cannot serialize rules with `"+e+"` for `options.rule`, expected `*`, `-`, or `_`");return e}function sF(n,e,t,i){const l=t.enter("list"),o=t.bulletCurrent;let a=n.ordered?lF(t):Cb(t);const u=n.ordered?a==="."?")":".":rF(t);let f=e&&t.bulletLastUsed?a===t.bulletLastUsed:!1;if(!n.ordered){const m=n.children?n.children[0]:void 0;if((a==="*"||a==="-")&&m&&(!m.children||!m.children[0])&&t.stack[t.stack.length-1]==="list"&&t.stack[t.stack.length-2]==="listItem"&&t.stack[t.stack.length-3]==="list"&&t.stack[t.stack.length-4]==="listItem"&&t.indexStack[t.indexStack.length-1]===0&&t.indexStack[t.indexStack.length-2]===0&&t.indexStack[t.indexStack.length-3]===0&&(f=!0),pE(t)===a&&m){let g=-1;for(;++g-1?e.start:1)+(t.options.incrementListMarker===!1?0:e.children.indexOf(n))+o);let a=o.length+1;(l==="tab"||l==="mixed"&&(e&&e.type==="list"&&e.spread||n.spread))&&(a=Math.ceil(a/4)*4);const u=t.createTracker(i);u.move(o+" ".repeat(a-o.length)),u.shift(a);const f=t.enter("listItem"),d=t.indentLines(t.containerFlow(n,u.current()),m);return f(),d;function m(g,b,v){return b?(v?"":" ".repeat(a))+g:(v?o:o+" ".repeat(a-o.length))+g}}function cF(n,e,t,i){const l=t.enter("paragraph"),o=t.enter("phrasing"),a=t.containerPhrasing(n,i);return o(),l(),a}function uF(n,e,t,i){if(!n.children.some(function(u){return DU(u)}))return t.containerFlow(n,i);const o=t.enter("phrasing"),a=t.containerPhrasing(n,i);return o(),a}function fF(n){const e=n.options.strong||"*";if(e!=="*"&&e!=="_")throw new Error("Cannot serialize strong with `"+e+"` for `options.strong`, expected `*`, or `_`");return e}Ob.attention=gE;Ob.peek=hF;function Ob(n,e,t,i){const l=t.enter("phrasing"),o=wb(n,gE,t,t.createTracker(i)),a=gm([o],i.before,i.after);return l(),a}function gE(n,e){return{construct:"strong",markers:fF(e)==="*"?["*","_"]:["_","*"],sizes:[2]}}function hF(n,e,t){return t.options.strong||"*"}function dF(n,e,t,i){const l=e?e.children:[],o=t.indexStack[t.indexStack.length-1];return t.safe(n.value,{...i,afterNode:l[o+1],beforeNode:l[o-1]})}function mF(n){const e=n.options.ruleRepetition||3;if(e<3)throw new Error("Cannot serialize rules with repetition `"+e+"` for `options.ruleRepetition`, expected `3` or more");return e}function pF(n,e,t){const i=(pE(t)+(t.options.ruleSpaces?" ":"")).repeat(mF(t));return t.options.ruleSpaces?i.slice(0,-1):i}const xE={blockquote:jU,break:_C,code:PU,definition:IU,emphasis:Sb,hardBreak:_C,heading:WU,html:aE,image:cE,imageReference:uE,inlineCode:fE,link:dE,linkReference:mE,list:sF,listItem:aF,paragraph:cF,root:uF,strong:Ob,text:dF,thematicBreak:pF};function gF(){return{enter:{table:xF,tableData:zC,tableHeader:zC,tableRow:bF},exit:{codeText:vF,table:yF,tableData:$0,tableHeader:$0,tableRow:$0}}}function xF(n){const e=n._align;this.enter({type:"table",align:e.map(function(t){return t==="none"?null:t}),children:[]},n),this.data.inTable=!0}function yF(n){this.exit(n),this.data.inTable=void 0}function bF(n){this.enter({type:"tableRow",children:[]},n)}function $0(n){this.exit(n)}function zC(n){this.enter({type:"tableCell",children:[]},n)}function vF(n){let e=this.resume();this.data.inTable&&(e=e.replace(/\\([\\|])/g,wF));const t=this.stack[this.stack.length-1];t.type,t.value=e,this.exit(n)}function wF(n,e){return e==="|"?e:n}function kF(n){const e=n||{},t=e.tableCellPadding,i=e.tablePipeAlign,l=e.stringLength,o=t?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:` +`,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:b,table:a,tableCell:f,tableRow:u}};function a(v,w,S,C){return d(m(v,S,C),v.align)}function u(v,w,S,C){const N=g(v,S,C),R=d([N]);return R.slice(0,R.indexOf(` +`))}function f(v,w,S,C){const N=S.enter("tableCell"),R=S.enter("phrasing"),M=S.containerPhrasing(v,{...C,before:o,after:o});return R(),N(),M}function d(v,w){return EU(v,{align:w,alignDelimiters:i,padding:t,stringLength:l})}function m(v,w,S){const C=v.children;let N=-1;const R=[],M=w.enter("table");for(;++N0&&!t&&(n[n.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),t}const IF={tokenize:YF,partial:!0};function UF(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:QF,continuation:{tokenize:XF},exit:$F}},text:{91:{name:"gfmFootnoteCall",tokenize:VF},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:FF,resolveTo:qF}}}}function FF(n,e,t){const i=this;let l=i.events.length;const o=i.parser.gfmFootnotes||(i.parser.gfmFootnotes=[]);let a;for(;l--;){const f=i.events[l][1];if(f.type==="labelImage"){a=f;break}if(f.type==="gfmFootnoteCall"||f.type==="labelLink"||f.type==="label"||f.type==="image"||f.type==="link")break}return u;function u(f){if(!a||!a._balanced)return t(f);const d=ir(i.sliceSerialize({start:a.end,end:i.now()}));return d.codePointAt(0)!==94||!o.includes(d.slice(1))?t(f):(n.enter("gfmFootnoteCallLabelMarker"),n.consume(f),n.exit("gfmFootnoteCallLabelMarker"),e(f))}}function qF(n,e){let t=n.length;for(;t--;)if(n[t][1].type==="labelImage"&&n[t][0]==="enter"){n[t][1];break}n[t+1][1].type="data",n[t+3][1].type="gfmFootnoteCallLabelMarker";const i={type:"gfmFootnoteCall",start:Object.assign({},n[t+3][1].start),end:Object.assign({},n[n.length-1][1].end)},l={type:"gfmFootnoteCallMarker",start:Object.assign({},n[t+3][1].end),end:Object.assign({},n[t+3][1].end)};l.end.column++,l.end.offset++,l.end._bufferIndex++;const o={type:"gfmFootnoteCallString",start:Object.assign({},l.end),end:Object.assign({},n[n.length-1][1].start)},a={type:"chunkString",contentType:"string",start:Object.assign({},o.start),end:Object.assign({},o.end)},u=[n[t+1],n[t+2],["enter",i,e],n[t+3],n[t+4],["enter",l,e],["exit",l,e],["enter",o,e],["enter",a,e],["exit",a,e],["exit",o,e],n[n.length-2],n[n.length-1],["exit",i,e]];return n.splice(t,n.length-t+1,...u),n}function VF(n,e,t){const i=this,l=i.parser.gfmFootnotes||(i.parser.gfmFootnotes=[]);let o=0,a;return u;function u(g){return n.enter("gfmFootnoteCall"),n.enter("gfmFootnoteCallLabelMarker"),n.consume(g),n.exit("gfmFootnoteCallLabelMarker"),f}function f(g){return g!==94?t(g):(n.enter("gfmFootnoteCallMarker"),n.consume(g),n.exit("gfmFootnoteCallMarker"),n.enter("gfmFootnoteCallString"),n.enter("chunkString").contentType="string",d)}function d(g){if(o>999||g===93&&!a||g===null||g===91||Mt(g))return t(g);if(g===93){n.exit("chunkString");const b=n.exit("gfmFootnoteCallString");return l.includes(ir(i.sliceSerialize(b)))?(n.enter("gfmFootnoteCallLabelMarker"),n.consume(g),n.exit("gfmFootnoteCallLabelMarker"),n.exit("gfmFootnoteCall"),e):t(g)}return Mt(g)||(a=!0),o++,n.consume(g),g===92?m:d}function m(g){return g===91||g===92||g===93?(n.consume(g),o++,d):d(g)}}function QF(n,e,t){const i=this,l=i.parser.gfmFootnotes||(i.parser.gfmFootnotes=[]);let o,a=0,u;return f;function f(w){return n.enter("gfmFootnoteDefinition")._container=!0,n.enter("gfmFootnoteDefinitionLabel"),n.enter("gfmFootnoteDefinitionLabelMarker"),n.consume(w),n.exit("gfmFootnoteDefinitionLabelMarker"),d}function d(w){return w===94?(n.enter("gfmFootnoteDefinitionMarker"),n.consume(w),n.exit("gfmFootnoteDefinitionMarker"),n.enter("gfmFootnoteDefinitionLabelString"),n.enter("chunkString").contentType="string",m):t(w)}function m(w){if(a>999||w===93&&!u||w===null||w===91||Mt(w))return t(w);if(w===93){n.exit("chunkString");const S=n.exit("gfmFootnoteDefinitionLabelString");return o=ir(i.sliceSerialize(S)),n.enter("gfmFootnoteDefinitionLabelMarker"),n.consume(w),n.exit("gfmFootnoteDefinitionLabelMarker"),n.exit("gfmFootnoteDefinitionLabel"),b}return Mt(w)||(u=!0),a++,n.consume(w),w===92?g:m}function g(w){return w===91||w===92||w===93?(n.consume(w),a++,m):m(w)}function b(w){return w===58?(n.enter("definitionMarker"),n.consume(w),n.exit("definitionMarker"),l.includes(o)||l.push(o),mt(n,v,"gfmFootnoteDefinitionWhitespace")):t(w)}function v(w){return e(w)}}function XF(n,e,t){return n.check(Ru,e,n.attempt(IF,e,t))}function $F(n){n.exit("gfmFootnoteDefinition")}function YF(n,e,t){const i=this;return mt(n,l,"gfmFootnoteDefinitionIndent",5);function l(o){const a=i.events[i.events.length-1];return a&&a[1].type==="gfmFootnoteDefinitionIndent"&&a[2].sliceSerialize(a[1],!0).length===4?e(o):t(o)}}function GF(n){let t=(n||{}).singleTilde;const i={name:"strikethrough",tokenize:o,resolveAll:l};return t==null&&(t=!0),{text:{126:i},insideSpan:{null:[i]},attentionMarkers:{null:[126]}};function l(a,u){let f=-1;for(;++f1?f(w):(a.consume(w),g++,v);if(g<2&&!t)return f(w);const C=a.exit("strikethroughSequenceTemporary"),N=cs(w);return C._open=!N||N===2&&!!S,C._close=!S||S===2&&!!N,u(w)}}}class KF{constructor(){this.map=[],this.index=new Map}add(e,t,i){WF(this,e,t,i)}consume(e){if(this.map.sort(function(o,a){return o[0]-a[0]}),this.map.length===0)return;let t=this.map.length;const i=[];for(;t>0;)t-=1,i.push(e.slice(this.map[t][0]+this.map[t][1]),this.map[t][2]),e.length=this.map[t][0];i.push(e.slice()),e.length=0;let l=i.pop();for(;l;){for(const o of l)e.push(o);l=i.pop()}this.map.length=0,this.index.clear()}}function WF(n,e,t,i){if(t===0&&i.length===0)return;const l=n.index.get(e);if(l){l[1]+=t,l[2].push(...i);return}const o=[e,t,i];n.map.push(o),n.index.set(e,o)}function ZF(n,e){let t=!1;const i=[];for(;e-1;){const{type:he}=i.events[J][1];if(he==="lineEnding"||he==="linePrefix")J--;else break}const F=J>-1?i.events[J][1].type:null,se=F==="tableHead"||F==="tableRow"?E:f;return se===E&&i.parser.lazy[i.now().line]?t(q):se(q)}function f(q){return n.enter("tableHead"),n.enter("tableRow"),d(q)}function d(q){return q===124||(a=!0,o+=1),m(q)}function m(q){return q===null?t(q):Be(q)?o>1?(o=0,i.interrupt=!0,n.exit("tableRow"),n.enter("lineEnding"),n.consume(q),n.exit("lineEnding"),v):t(q):Ke(q)?mt(n,m,"whitespace")(q):(o+=1,a&&(a=!1,l+=1),q===124?(n.enter("tableCellDivider"),n.consume(q),n.exit("tableCellDivider"),a=!0,m):(n.enter("data"),g(q)))}function g(q){return q===null||q===124||Mt(q)?(n.exit("data"),m(q)):(n.consume(q),q===92?b:g)}function b(q){return q===92||q===124?(n.consume(q),g):g(q)}function v(q){return i.interrupt=!1,i.parser.lazy[i.now().line]?t(q):(n.enter("tableDelimiterRow"),a=!1,Ke(q)?mt(n,w,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(q):w(q))}function w(q){return q===45||q===58?C(q):q===124?(a=!0,n.enter("tableCellDivider"),n.consume(q),n.exit("tableCellDivider"),S):U(q)}function S(q){return Ke(q)?mt(n,C,"whitespace")(q):C(q)}function C(q){return q===58?(o+=1,a=!0,n.enter("tableDelimiterMarker"),n.consume(q),n.exit("tableDelimiterMarker"),N):q===45?(o+=1,N(q)):q===null||Be(q)?I(q):U(q)}function N(q){return q===45?(n.enter("tableDelimiterFiller"),R(q)):U(q)}function R(q){return q===45?(n.consume(q),R):q===58?(a=!0,n.exit("tableDelimiterFiller"),n.enter("tableDelimiterMarker"),n.consume(q),n.exit("tableDelimiterMarker"),M):(n.exit("tableDelimiterFiller"),M(q))}function M(q){return Ke(q)?mt(n,I,"whitespace")(q):I(q)}function I(q){return q===124?w(q):q===null||Be(q)?!a||l!==o?U(q):(n.exit("tableDelimiterRow"),n.exit("tableHead"),e(q)):U(q)}function U(q){return t(q)}function E(q){return n.enter("tableRow"),T(q)}function T(q){return q===124?(n.enter("tableCellDivider"),n.consume(q),n.exit("tableCellDivider"),T):q===null||Be(q)?(n.exit("tableRow"),e(q)):Ke(q)?mt(n,T,"whitespace")(q):(n.enter("data"),z(q))}function z(q){return q===null||q===124||Mt(q)?(n.exit("data"),T(q)):(n.consume(q),q===92?ie:z)}function ie(q){return q===92||q===124?(n.consume(q),z):z(q)}}function tq(n,e){let t=-1,i=!0,l=0,o=[0,0,0,0],a=[0,0,0,0],u=!1,f=0,d,m,g;const b=new KF;for(;++tt[2]+1){const w=t[2]+1,S=t[3]-t[2]-1;n.add(w,S,[])}}n.add(t[3]+1,0,[["exit",g,e]])}return l!==void 0&&(o.end=Object.assign({},la(e.events,l)),n.add(l,0,[["exit",o,e]]),o=void 0),o}function PC(n,e,t,i,l){const o=[],a=la(e.events,t);l&&(l.end=Object.assign({},a),o.push(["exit",l,e])),i.end=Object.assign({},a),o.push(["exit",i,e]),n.add(t+1,0,o)}function la(n,e){const t=n[e],i=t[0]==="enter"?"start":"end";return t[1][i]}const nq={name:"tasklistCheck",tokenize:rq};function iq(){return{text:{91:nq}}}function rq(n,e,t){const i=this;return l;function l(f){return i.previous!==null||!i._gfmTasklistFirstContentOfListItem?t(f):(n.enter("taskListCheck"),n.enter("taskListCheckMarker"),n.consume(f),n.exit("taskListCheckMarker"),o)}function o(f){return Mt(f)?(n.enter("taskListCheckValueUnchecked"),n.consume(f),n.exit("taskListCheckValueUnchecked"),a):f===88||f===120?(n.enter("taskListCheckValueChecked"),n.consume(f),n.exit("taskListCheckValueChecked"),a):t(f)}function a(f){return f===93?(n.enter("taskListCheckMarker"),n.consume(f),n.exit("taskListCheckMarker"),n.exit("taskListCheck"),u):t(f)}function u(f){return Be(f)?e(f):Ke(f)?n.check({tokenize:lq},e,t)(f):t(f)}}function lq(n,e,t){return mt(n,i,"whitespace");function i(l){return l===null?t(l):e(l)}}function sq(n){return DA([DF(),UF(),GF(n),JF(),iq()])}const oq={};function aq(n){const e=this,t=n||oq,i=e.data(),l=i.micromarkExtensions||(i.micromarkExtensions=[]),o=i.fromMarkdownExtensions||(i.fromMarkdownExtensions=[]),a=i.toMarkdownExtensions||(i.toMarkdownExtensions=[]);l.push(sq(t)),o.push(TF()),a.push(AF(t))}function cq(n){return n.replace(/\\n/g,` +`).replace(/\\t/g," ").replace(/\\"/g,'"').replace(/\\'/g,"'").replace(/\\\\/g,"\\")}const uq={h1:({children:n})=>y.jsx("h3",{className:"mt-3 mb-1.5 text-base font-bold text-ink first:mt-0",children:n}),h2:({children:n})=>y.jsx("h4",{className:"mt-3 mb-1 text-sm font-semibold text-ink first:mt-0",children:n}),h3:({children:n})=>y.jsx("h5",{className:"mt-2 mb-1 text-xs font-semibold text-ink first:mt-0",children:n}),p:({children:n})=>y.jsx("p",{className:"my-1.5 leading-relaxed first:mt-0 last:mb-0",children:n}),strong:({children:n})=>y.jsx("strong",{className:"font-semibold text-ink",children:n}),em:({children:n})=>y.jsx("em",{className:"italic text-ink-secondary",children:n}),del:({children:n})=>y.jsx("del",{className:"text-ink-muted line-through",children:n}),a:({children:n,href:e})=>y.jsx("a",{href:e,target:"_blank",rel:"noopener noreferrer",className:"text-chip-indigo-text underline underline-offset-2 hover:text-ink",children:n}),code:({children:n,className:e})=>y.jsx("code",{className:`break-words rounded bg-elevated px-1 py-0.5 font-mono text-chip-indigo-text whitespace-pre-wrap ${e??""}`,children:n}),pre:({children:n})=>y.jsx("pre",{className:"my-2 overflow-x-auto rounded-lg border border-line bg-elevated p-3 font-mono text-xs text-ink [&_code]:bg-transparent [&_code]:px-0 [&_code]:py-0 [&_code]:text-inherit",children:n}),ul:({children:n})=>y.jsx("ul",{className:"my-1.5 list-disc space-y-0.5 pl-5",children:n}),ol:({children:n})=>y.jsx("ol",{className:"my-1.5 list-decimal space-y-0.5 pl-5",children:n}),li:({children:n})=>y.jsx("li",{className:"leading-relaxed",children:n}),blockquote:({children:n})=>y.jsx("blockquote",{className:"my-2 border-l-2 border-line-strong pl-3 text-ink-secondary italic",children:n}),table:({children:n})=>y.jsx("div",{className:"my-2 overflow-x-auto",children:y.jsx("table",{className:"w-full border-collapse text-xs",children:n})}),th:({children:n})=>y.jsx("th",{className:"border border-line bg-elevated px-2 py-1 text-left font-semibold",children:n}),td:({children:n})=>y.jsx("td",{className:"border border-line px-2 py-1 align-top",children:n}),hr:()=>y.jsx("hr",{className:"my-3 border-line"}),img:({alt:n,src:e,title:t})=>y.jsx("img",{src:e,alt:n,title:t,loading:"lazy",referrerPolicy:"no-referrer",className:"my-2 max-w-full rounded-lg border border-line"})};function Xh({text:n}){return n?y.jsx(HI,{remarkPlugins:[aq,KI],components:uq,children:cq(n)}):null}function NE(n){return n==="completed"||n==="aborted"||n==="failed"}function Vc({label:n}){return y.jsx("kbd",{"aria-hidden":"true",className:"ml-1.5 inline-block rounded border border-line/60 bg-elevated/60 px-1 py-px font-mono text-[10px] font-normal leading-none opacity-90",children:n})}function HC(n){!n||NE(n.status)||BM(n.session_id).catch(()=>{})}const fq={running:"running",completed:"done",skipped:"skipped",failed:"failed",pending:"pending"};function $h({text:n}){const[e,t]=D.useState(!1),i=D.useRef(void 0);D.useEffect(()=>()=>window.clearTimeout(i.current),[]);const l=async()=>{try{await navigator.clipboard.writeText(n),t(!0),window.clearTimeout(i.current),i.current=window.setTimeout(()=>t(!1),1500)}catch{}};return y.jsx("button",{type:"button",onClick:l,"aria-label":e?"Copied":"Copy content",title:e?"Copied!":"Copy content",className:"absolute right-2 top-2 rounded-md p-1.5 text-ink-muted hover:bg-elevated hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-indigo-500",children:e?y.jsx(_r,{className:"h-3.5 w-3.5"}):y.jsx(ci,{className:"h-3.5 w-3.5"})})}function hq({isOpen:n,onClose:e,directory:t,filename:i,release:l,args:o,onFinished:a}){var _e,B;const[u,f]=D.useState(null),[d,m]=D.useState(!1),[g,b]=D.useState(null),[v,w]=D.useState(null),[S,C]=D.useState(!1),[N,R]=D.useState(0),M=D.useRef(null),I=D.useRef(!1),U=D.useRef(null),E=D.useRef(!1);D.useEffect(()=>{if(!n||!t||!i){f(null),b(null),C(!1),w(null),E.current=!1;return}let j=!0;return m(!0),b(null),C(!1),w(null),LM({directory:t,filename:i,release:l,args:o}).then($=>{j&&(f($),m(!1),($.status==="completed"||$.status==="aborted"||$.status==="failed")&&(a==null||a($.status,$.final_message||"")))}).catch($=>{j&&(($==null?void 0:$.status)===404&&C(!0),b($.message||"Failed to start workflow"),m(!1))}),()=>{j=!1}},[n,t,i,l,o,N]);const T=async j=>{if(!(!u||I.current)){I.current=!0,m(!0);try{const $=await zM(u.session_id,j);f($),($.status==="completed"||$.status==="aborted"||$.status==="failed")&&(a==null||a($.status,$.final_message||""))}catch($){($==null?void 0:$.status)===404?(C(!0),b($.message||"Workflow session on the server has expired.")):b($.message||"Failed to process workflow response")}finally{I.current=!1,m(!1)}}},z=D.useRef(u);z.current=u;const ie=D.useRef(T);ie.current=T;const q=D.useRef(v);q.current=v;const J=D.useRef([]),F=(j,$)=>{var Ne,Te;if(j.key!=="ArrowDown"&&j.key!=="ArrowUp"&&j.key!=="Home"&&j.key!=="End")return;j.preventDefault();const fe=((Ne=z.current)==null?void 0:Ne.steps.length)??0;if(fe===0)return;const me=j.key==="ArrowDown"?($+1)%fe:j.key==="ArrowUp"?($-1+fe)%fe:j.key==="Home"?0:fe-1;w(me),(Te=J.current[me])==null||Te.focus()};D.useEffect(()=>()=>HC(z.current),[]);const se=()=>{E.current||(E.current=!0,HC(z.current),e())},he=()=>{f(null),b(null),C(!1),w(null),E.current=!1,R(j=>j+1)},ne=hs({isOpen:n,onClose:se,dialogRef:M,initialFocusRef:U});if(D.useEffect(()=>{if(!n)return;const j=$=>{var je,It,Gt;if($.key==="Escape"){$.preventDefault(),se();return}const fe=z.current;if(!fe)return;if(NE(fe.status)){$.key==="Enter"&&!$.repeat&&!$.ctrlKey&&!$.metaKey&&!$.altKey&&!I.current&&((je=$.target)==null?void 0:je.tagName)!=="BUTTON"&&((It=document.activeElement)==null?void 0:It.tagName)!=="BUTTON"&&($.preventDefault(),se());return}if(I.current||$.repeat||$.ctrlKey||$.metaKey||$.altKey)return;const me=$.target;if((me==null?void 0:me.tagName)==="INPUT"||(me==null?void 0:me.tagName)==="TEXTAREA"||me!=null&&me.isContentEditable)return;const Ne=q.current,Te=Ne===null||Ne===fe.current_index,ze=fe.status==="waiting_ask"?"yes":fe.status==="waiting_notify"||fe.status==="waiting_notice"?"ack":null;if(!Te||ze===null)return;if($.key==="Enter"){const un=$.target;if((un==null?void 0:un.tagName)==="BUTTON"||((Gt=document.activeElement)==null?void 0:Gt.tagName)==="BUTTON")return;$.preventDefault(),ie.current(ze);return}if(fe.status!=="waiting_ask")return;const ve=$.key.toLowerCase();ve==="y"?($.preventDefault(),ie.current("yes")):ve==="s"?($.preventDefault(),ie.current("skip")):ve==="n"&&($.preventDefault(),ie.current("no"))};return window.addEventListener("keydown",j),()=>window.removeEventListener("keydown",j)},[n,e]),D.useEffect(()=>{if(!n||!u)return;const j=requestAnimationFrame(()=>{var $;return($=U.current)==null?void 0:$.focus()});return()=>cancelAnimationFrame(j)},[n,u==null?void 0:u.status]),!n)return null;const L=v!==null?u==null?void 0:u.steps[v]:u==null?void 0:u.steps[u.current_index],ee=(u==null?void 0:u.status)==="completed"||(u==null?void 0:u.status)==="aborted"||(u==null?void 0:u.status)==="failed",oe=!!u&&!ee&&!S&&(((_e=u.status)==null?void 0:_e.startsWith("waiting"))??!1),le=(((B=u==null?void 0:u.steps[(u==null?void 0:u.current_index)??-1])==null?void 0:B.phase)??"pre")==="post",Le=!S&&(v===null||v===(u==null?void 0:u.current_index))&&(L!=null&&L.command)&&((u==null?void 0:u.status)==="waiting_notify"||(u==null?void 0:u.status)==="waiting_notice"||(u==null?void 0:u.status)==="waiting_ask")?y.jsxs("div",{className:"space-y-2",children:[y.jsx("p",{className:"text-[11px] font-medium uppercase tracking-wider text-ink-muted",children:"Command:"}),y.jsxs("div",{className:"relative rounded-lg border border-line bg-surface-strong p-4 pr-10 font-mono text-xs text-ink leading-relaxed",children:[y.jsx($h,{text:L.command}),L.command]})]}):null;return y.jsx("div",{ref:M,role:"dialog","aria-modal":"true","aria-labelledby":"workflow-runner-title",onKeyDown:ne,className:"animate-overlay-in fixed inset-0 z-[var(--z-modal)] flex items-center justify-center bg-black/60 p-4 backdrop-blur-xs",children:y.jsxs("div",{className:"animate-modal-in flex h-[80vh] w-full max-w-5xl flex-col rounded-xl border border-frame-line glass-panel overflow-hidden",children:[y.jsxs("div",{className:"flex items-center justify-between border-b border-line px-5 py-3.5 bg-surface-strong/30 shrink-0",children:[y.jsxs("div",{className:"flex items-center gap-2.5",children:[y.jsx("span",{className:"flex h-8 w-8 items-center justify-center rounded-lg bg-chip-indigo-bg text-chip-indigo-text",children:y.jsx(oO,{className:"h-4 w-4"})}),y.jsxs("div",{children:[y.jsx("h2",{id:"workflow-runner-title",className:"text-sm font-semibold text-ink",children:"Launch Workflow Engine"}),y.jsxs("p",{className:"text-xs text-ink-muted",children:[i," ",u!=null&&u.pattern?`• Pattern: ${u.pattern}`:""]})]})]}),y.jsxs("div",{className:"flex items-center gap-1.5",children:[u&&!ee&&!S&&y.jsxs("button",{type:"button",disabled:!oe||d,onClick:()=>T("bypass"),title:le?"Skip the remaining post-launch steps":"Skip the remaining steps and launch with the OS default app",className:"btn inline-flex items-center gap-1.5 rounded-md border border-line bg-surface px-3 py-1.5 text-xs font-medium text-status-warning-text hover:bg-status-warning-bg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-indigo-500 disabled:cursor-not-allowed disabled:opacity-40",children:[y.jsx(cD,{className:"h-3.5 w-3.5"}),le?"Skip rest":"Launch now"]}),y.jsx("button",{type:"button",onClick:se,className:"rounded-md p-1.5 text-ink-muted hover:bg-elevated hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-indigo-500",children:y.jsx(Ei,{className:"h-4 w-4"})})]})]}),y.jsxs("div",{className:"flex flex-1 overflow-hidden",children:[y.jsxs("div",{className:"w-72 border-r border-line bg-surface-strong/20 p-4 overflow-y-auto flex flex-col gap-2 shrink-0",children:[y.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wider text-ink-muted px-1 mb-1",children:"Workflow Steps (Click to inspect)"}),u&&u.steps.length>0?y.jsx("ul",{role:"list",className:"flex flex-col gap-2",children:u.steps.map((j,$)=>{const fe=u.current_index===$&&!ee,me=v===$||v===null&&fe,Ne=fq[j.status];return y.jsx("li",{children:y.jsxs("button",{ref:Te=>{J.current[$]=Te},type:"button",tabIndex:me?0:-1,"aria-current":me?"step":void 0,onKeyDown:Te=>F(Te,$),onClick:()=>w($),className:`flex items-start text-left gap-2.5 rounded-lg border px-3 py-2.5 transition-colors cursor-pointer w-full ${me?"border-chip-indigo-border bg-chip-indigo-bg shadow-xs ring-1 ring-chip-indigo-border/40":"border-line/60 bg-surface/60 hover:bg-elevated/80"}`,children:[y.jsxs("div",{className:"mt-0.5 shrink-0",children:[j.status==="running"&&y.jsx(ll,{className:"h-4 w-4 animate-spin text-chip-indigo-text"}),j.status==="completed"&&y.jsx(Qk,{className:"h-4 w-4 text-status-success-text"}),j.status==="skipped"&&y.jsx(E4,{className:"h-4 w-4 text-status-warning-text"}),j.status==="failed"&&y.jsx(Gc,{className:"h-4 w-4 text-status-danger-text"}),j.status==="pending"&&y.jsx("div",{className:"h-4 w-4 rounded-full border border-line-strong flex items-center justify-center text-[10px] text-ink-faint font-mono",children:j.index})]}),y.jsxs("div",{className:"min-w-0 flex-1",children:[y.jsxs("div",{className:"flex items-center justify-between",children:[y.jsx("span",{className:"font-mono text-[11px] font-bold uppercase text-chip-indigo-text",children:j.action}),y.jsxs("span",{className:"text-[10px] font-mono text-ink-faint",children:["#",j.index," · ",Ne]})]}),y.jsx("p",{className:"truncate font-mono text-[11px] text-ink-secondary mt-0.5",title:j.command,children:j.message?j.message.split(` +`)[0]:j.command}),j.note&&y.jsx("p",{className:"mt-1 text-[10px] text-ink-faint italic",children:j.note})]})]})},j.index)})}):y.jsx("div",{className:"p-4 text-center text-xs text-ink-faint",children:g||S?"Session unavailable — see the error panel.":"Loading steps..."})]}),y.jsxs("div",{className:"flex-1 flex flex-col bg-app",children:[y.jsx("div",{className:"flex-1 min-h-0 overflow-y-auto p-6",children:y.jsx("div",{className:"space-y-6",children:y.jsxs("div",{className:"rounded-xl border border-line bg-surface p-5 shadow-xs space-y-4",children:[y.jsxs("div",{className:"flex items-center justify-between border-b border-line pb-3",children:[y.jsxs("div",{className:"flex items-center gap-2",children:[y.jsx("span",{className:"rounded bg-chip-indigo-bg px-2 py-0.5 font-mono text-xs font-semibold uppercase text-chip-indigo-text",children:(L==null?void 0:L.action)||(u==null?void 0:u.status)}),y.jsx("span",{className:"text-xs text-ink-muted",children:L?`Step ${L.index} of ${u==null?void 0:u.steps.length}`:"Status"}),v!==null&&v!==(u==null?void 0:u.current_index)&&y.jsx("button",{type:"button",onClick:()=>w(null),className:"text-[11px] text-chip-indigo-text hover:underline ml-2",children:"(Return to active step)"})]}),d&&y.jsx(ll,{className:"h-4 w-4 animate-spin text-chip-indigo-text"})]}),y.jsxs("div",{className:"space-y-3 text-xs text-ink font-sans leading-relaxed",children:[(v===null||v===(u==null?void 0:u.current_index))&&(u==null?void 0:u.status)==="waiting_notify"&&u.notify_message&&y.jsxs("div",{className:"space-y-2",children:[y.jsx("p",{className:"text-[11px] font-medium uppercase tracking-wider text-ink-muted",children:"Notification Message:"}),y.jsx("div",{className:"rounded-lg border border-line bg-surface-strong p-4 text-ink",children:y.jsx(Xh,{text:u.notify_message})}),Le]}),(v===null||v===(u==null?void 0:u.current_index))&&(u==null?void 0:u.status)==="waiting_notice"&&u.notice_message&&y.jsxs("div",{className:"space-y-2",children:[y.jsx("p",{className:"text-[11px] font-medium uppercase tracking-wider text-ink-muted",children:"Notice:"}),y.jsx("div",{className:"rounded-lg border border-line bg-surface-strong p-4 text-ink",children:y.jsx(Xh,{text:u.notice_message})}),Le,y.jsx("p",{className:"text-[11px] text-ink-faint",children:"The command will run when you continue."})]}),(v===null||v===(u==null?void 0:u.current_index))&&(u==null?void 0:u.status)==="waiting_ask"&&u.ask_prompt&&y.jsxs("div",{className:"space-y-2",children:[u.ask_message&&y.jsx("div",{className:"rounded-lg border border-line bg-surface-strong p-4 text-ink",children:y.jsx(Xh,{text:u.ask_message})}),y.jsx("p",{className:"text-[11px] font-medium uppercase tracking-wider text-status-warning-text",children:"Confirmation Prompt:"}),y.jsx("div",{className:"rounded-lg border border-status-warning-border bg-status-warning-bg p-4 text-sm font-medium text-ink",children:u.ask_prompt}),Le]}),ee&&v===null&&y.jsxs("div",{className:`rounded-xl border p-8 text-center space-y-4 ${(u==null?void 0:u.status)==="completed"?"border-status-success-border bg-status-success-bg text-status-success-text":"border-status-danger-border bg-status-danger-bg text-status-danger-text"}`,children:[y.jsx("div",{className:"inline-flex h-12 w-12 items-center justify-center rounded-full bg-surface/50 mx-auto",children:(u==null?void 0:u.status)==="completed"?y.jsx(Qk,{className:"h-6 w-6 text-status-success-text"}):y.jsx(Gc,{className:"h-6 w-6 text-status-danger-text"})}),y.jsxs("div",{className:"space-y-1",children:[y.jsx("h3",{className:"text-base font-bold",children:(u==null?void 0:u.status)==="completed"?"Workflow Finished":"Workflow Terminated"}),y.jsx("p",{className:"text-xs text-ink-secondary max-w-md mx-auto",children:(u==null?void 0:u.final_message)||"The launch sequence has ended."})]}),y.jsx("div",{className:"pt-2",children:y.jsx("button",{type:"button",onClick:e,className:"btn btn-primary px-8 py-2.5 font-bold shadow-lg",children:"Close Engine Runner"})})]}),ee&&v===null&&(u==null?void 0:u.last_output)&&y.jsxs("div",{className:"space-y-2",children:[y.jsx("p",{className:"text-[11px] font-medium uppercase tracking-wider text-ink-muted",children:"Command Output:"}),y.jsxs("div",{className:"relative",children:[y.jsx($h,{text:u.last_output}),y.jsx("pre",{className:"max-h-48 overflow-y-auto whitespace-pre-wrap break-words rounded-lg border border-line bg-surface-strong p-4 font-mono text-xs text-ink",children:u.last_output})]})]}),!S&&!(ee&&v===null)&&!((v===null||v===(u==null?void 0:u.current_index))&&((u==null?void 0:u.status)==="waiting_notify"||(u==null?void 0:u.status)==="waiting_ask"||(u==null?void 0:u.status)==="waiting_notice"))&&y.jsxs("div",{className:"space-y-4",children:[(L==null?void 0:L.message)&&y.jsxs("div",{className:"space-y-2",children:[y.jsx("p",{className:"text-[11px] font-medium uppercase tracking-wider text-ink-muted",children:"Message:"}),y.jsx("div",{className:"rounded-lg border border-line bg-surface-strong p-4 text-xs text-ink",children:y.jsx(Xh,{text:L.message})})]}),y.jsxs("div",{className:"space-y-2",children:[y.jsx("p",{className:"text-[11px] font-medium uppercase tracking-wider text-ink-muted",children:"Command:"}),y.jsx("div",{className:"relative rounded-lg border border-line bg-surface-strong p-4 font-mono text-xs text-ink leading-relaxed",children:L!=null&&L.command?y.jsxs(y.Fragment,{children:[y.jsx($h,{text:L.command}),y.jsx("span",{className:"block pr-8",children:L.command})]}):"Waiting..."})]}),(L==null?void 0:L.output)&&y.jsxs("div",{className:"space-y-2",children:[y.jsx("p",{className:"text-[11px] font-medium uppercase tracking-wider text-ink-muted",children:"Output:"}),y.jsxs("div",{className:"relative",children:[y.jsx($h,{text:L.output}),y.jsx("pre",{className:"max-h-48 overflow-y-auto whitespace-pre-wrap break-words rounded-lg border border-line bg-surface-strong p-4 font-mono text-xs text-ink",children:L.output})]})]}),(L==null?void 0:L.ask)&&y.jsxs("div",{className:"rounded-lg border border-status-warning-border bg-status-warning-bg p-3 text-xs text-status-warning-text",children:[y.jsx("span",{className:"font-semibold",children:"Workflow Guard:"})," ",L.ask]}),(L==null?void 0:L.note)&&y.jsxs("div",{className:"rounded-lg border border-line bg-surface-strong p-3 text-xs text-ink-muted italic",children:[y.jsx("span",{className:"font-semibold text-ink-secondary not-italic uppercase text-[10px]",children:"Log:"})," ",L.note]})]})]})]})})}),(g||S)&&y.jsx("div",{className:"shrink-0 px-6 pt-3",children:y.jsxs("div",{className:"flex items-start gap-2 rounded-lg border border-status-danger-border bg-status-danger-bg p-3 text-xs text-status-danger-text",children:[y.jsx(Gc,{className:"mt-0.5 h-4 w-4 shrink-0"}),y.jsxs("div",{className:"min-w-0 flex-1 space-y-1.5",children:[y.jsx("p",{children:S?"Workflow session on the server has expired or ended.":g}),S?y.jsxs("div",{className:"space-y-2",children:[g&&y.jsxs("details",{className:"text-ink-muted",children:[y.jsx("summary",{className:"cursor-pointer select-none text-[11px] underline",children:"Raw error (for bug reports)"}),y.jsx("pre",{className:"mt-1 overflow-x-auto whitespace-pre-wrap break-words font-mono text-[11px]",children:g})]}),y.jsxs("div",{className:"flex items-center gap-2",children:[y.jsx("button",{type:"button",onClick:he,className:"btn btn-primary px-4 py-1.5 text-xs font-semibold",children:"Restart workflow"}),y.jsx("button",{type:"button",onClick:se,className:"btn rounded-md border-line bg-surface px-4 py-1.5 text-xs",children:"Close"})]})]}):null]})]})}),y.jsxs("div",{className:"shrink-0 px-6 pt-4 pb-4 border-t border-line flex items-center justify-between bg-app",children:[y.jsx("div",{className:"text-xs text-ink-muted","aria-live":"polite",children:S?"Session unavailable — restart or close above.":(u==null?void 0:u.status)==="waiting_ask"&&(v===null||v===u.current_index)?"Action required to proceed:":(u==null?void 0:u.status)==="waiting_notify"&&(v===null||v===u.current_index)?"Acknowledge message to proceed:":(u==null?void 0:u.status)==="waiting_notice"&&(v===null||v===u.current_index)?"Continue to run the command:":ee?"Session terminated.":"Step in progress..."}),y.jsxs("div",{className:"flex items-center gap-2",children:[!S&&(u==null?void 0:u.status)==="waiting_notice"&&(v===null||v===u.current_index)&&y.jsxs("button",{type:"button",ref:U,disabled:d,onClick:()=>T("ack"),className:"btn btn-primary px-5 py-2 font-semibold shadow-sm",children:["Run Command",y.jsx(Vc,{label:"↵"})]}),!S&&(u==null?void 0:u.status)==="waiting_notify"&&(v===null||v===u.current_index)&&y.jsxs("button",{type:"button",ref:U,disabled:d,onClick:()=>T("ack"),className:"btn btn-primary px-5 py-2 font-semibold shadow-sm",children:["Continue Workflow",y.jsx(Vc,{label:"↵"})]}),!S&&(u==null?void 0:u.status)==="waiting_ask"&&(v===null||v===u.current_index)&&y.jsxs(y.Fragment,{children:[y.jsxs("button",{type:"button",disabled:d,onClick:()=>T("no"),className:"btn rounded-md border-line bg-surface px-4 py-2 text-status-danger-text hover:bg-status-danger-bg",children:["Abort Launch",y.jsx(Vc,{label:"N"})]}),y.jsxs("button",{type:"button",disabled:d,onClick:()=>T("skip"),className:"btn rounded-md border-line bg-surface px-4 py-2 text-status-warning-text hover:bg-status-warning-bg",children:["Skip Step",y.jsx(Vc,{label:"S"})]}),y.jsxs("button",{type:"button",ref:U,disabled:d,onClick:()=>T("yes"),className:"btn btn-primary px-5 py-2 font-semibold shadow-sm",children:["Execute Step",y.jsx(Vc,{label:"Y"})]})]}),ee&&y.jsx("button",{type:"button",ref:U,onClick:e,className:"btn btn-primary px-5 py-2 font-semibold shadow-sm",children:"Close Runner"})]})]})]})]})]})})}function IC({url:n,label:e,className:t="",onCopied:i,onCopyError:l}){const o=async()=>{try{await navigator.clipboard.writeText(n),i==null||i(n)}catch{l==null||l(n)}};return y.jsxs("span",{className:`flex items-center justify-between gap-2 ${t}`.trim(),children:[y.jsx("code",{className:"truncate font-mono text-[11px] text-ink",children:n}),y.jsx("button",{type:"button",onClick:o,"aria-label":e??`Copy ${n}`,title:e??"Copy",className:"focus-ring shrink-0 rounded p-1 text-ink-faint transition-colors hover:bg-elevated hover:text-ink",children:y.jsx(ci,{className:"h-3.5 w-3.5"})})]})}const dq=";",UC="=";function mq(n){const e=n.trim().toLowerCase();return e==="extension"||e==="file_ext"||e==="filetype"?"ext":e==="directory"||e==="path"||e==="folder"?"dir":e==="recurse"||e==="recursive_search"?"recursive":e==="filter_text"||e==="query"||e==="search"?"filter":e}function FC(n){const e=n.trim();if(!e.includes(UC))return{values:{filter:e},isPlainFilter:!0};const t={};for(const i of e.split(dq)){const l=i.trim();if(!l)continue;const o=l.indexOf(UC);if(o===-1)continue;const a=mq(l.slice(0,o)),u=l.slice(o+1).trim();switch(a){case"filter":t.filter=u;break;case"ext":t.ext=u;break;case"recursive":t.recursive=qC(u,!0);break;case"dir":t.dir=u;break;case"scan":t.scan=qC(u,!1);break}}return{values:t,isPlainFilter:!1}}function qC(n,e){const t=n.toLowerCase();return["0","false","no","off"].includes(t)?!1:["1","true","yes","on"].includes(t)?!0:e}function Qc(n){return/[",\n\r]/.test(n)?`"${n.replace(/"/g,'""')}"`:n}function pq(n,e,t,i){var f,d;const l=[],a=[["Exported",new Date().toISOString()],["App Version",(t==null?void 0:t.release)??"unknown"],["Config File",(t==null?void 0:t.config_path)??"none"],["Config Exists",String((t==null?void 0:t.config_exists)??!1)],["Directory",(t==null?void 0:t.active_directory)??""],["Extensions",((f=t==null?void 0:t.extensions)==null?void 0:f.join(" | "))??""],["Filter Text",i??((d=t==null?void 0:t.filters)==null?void 0:d[0])??""],["Recursive",String((t==null?void 0:t.recursive_search)??!0)],["Title",(t==null?void 0:t.title)??""],["Release",(t==null?void 0:t.release)??""]];for(const[m,g]of a)l.push(`${Qc(m)},${Qc(g)}`);l.push("");const u=e.length>0?e:["filename","path","rel_path"];l.push(u.map(Qc).join(","));for(const m of n){const g=u.map(b=>b in m?Qc(String(m[b]??"")):Qc(m.column_values[b]??""));l.push(g.join(","))}return l.join(`\r +`)}const gq=120,VC=800,xq=4e3,QC=20;function yq(){const[n,e]=D.useState("dark"),[t,i]=D.useState(null),[l,o]=D.useState(null),[a,u]=D.useState(""),[f,d]=D.useState(""),[m,g]=D.useState(""),[b,v]=D.useState(!0),[w,S]=D.useState([]),[C,N]=D.useState(0),[R,M]=D.useState(!1),[I,U]=D.useState(!1),[E,T]=D.useState(null),[z,ie]=D.useState(!1),[q,J]=D.useState(null),[F,se]=D.useState(0),[he,ne]=D.useState(!1),L=D.useRef(0),ee=D.useRef(null),oe=D.useRef(null),[le,A]=D.useState(""),[Le,_e]=D.useState(null),[B,j]=D.useState(!1),[$,fe]=D.useState(null),[me,Ne]=D.useState(!1),[Te,ze]=D.useState("en"),[ve,je]=D.useState(!1),[It,Gt]=D.useState(!1),[un,_t]=D.useState(!1),[yt,rt]=D.useState(0),[Ut,zn]=D.useState(!1),[Ft,en]=D.useState(null),[ke,qe]=D.useState(null),[Ie,at]=D.useState(!1),[V,K]=D.useState(!1),[de,Se]=D.useState(null),[We,ot]=D.useState(null),[gt,qt]=D.useState(!1),mn=D.useRef(""),[Mi,or]=D.useState(!1),[ao,tn]=D.useState(void 0),[pn,Jn]=D.useState(!1),[gn,hl]=D.useState(null),[ms,Lu]=D.useState(0),co=D.useRef(null),ps=D.useRef(null),xe=(H,P="info")=>{H&&(fe({message:H,kind:P}),ps.current&&clearTimeout(ps.current),ps.current=setTimeout(()=>fe(null),P==="error"?1e4:3500))},qn=()=>{ps.current&&clearTimeout(ps.current),fe(null)},ar=H=>{Se(H)},Lt=()=>{var P;oe.current&&(clearTimeout(oe.current),oe.current=null),(P=ee.current)==null||P.abort(),ee.current=new AbortController;const H=++L.current;return ne(!0),U(!1),H},Vt=H=>H===L.current,ei=H=>{Vt(H)&&ne(!1)},ti=D.useRef(null);D.useEffect(()=>{if(!m.trim()){A("");return}const H=window.setTimeout(()=>A(m),gq);return()=>window.clearTimeout(H)},[m]);const Nt=D.useMemo(()=>le.trim()===""?w:w.filter(H=>J9(H.rel_path,le)),[w,le]),uo=m.trim()&&w.length{const H=ti.current,P=H?Nt.findIndex(re=>re.path===H):-1;if(P>=0){se(re=>P!==re?P:re);return}se(re=>Math.min(re,Math.max(0,Nt.length-1)))},[Nt]);const gs=async(H,P=q)=>{var De;const re=await Kg({offset:0,limit:M0,sort_by:P==null?void 0:P.column,sort_dir:P==null?void 0:P.direction,signal:(De=ee.current)==null?void 0:De.signal});return Vt(H)?(S(re.items),N(re.count),M(!0),!0):!1},xn=async(H,P)=>{var re;return!Vt(H)||(await Pk(P,(re=ee.current)==null?void 0:re.signal),!Vt(H)||!await gs(H))?!1:(ti.current=null,se(0),!0)},fo=async()=>{if(I||w.length>=C)return;const H=L.current;U(!0);try{const P=await Kg({offset:w.length,limit:M0,sort_by:q==null?void 0:q.column,sort_dir:q==null?void 0:q.direction});if(!Vt(H))return;const re=new Set(w.map(De=>De.path||De.filename));S(De=>[...De,...P.items.filter(Ze=>!re.has(Ze.path||Ze.filename))]),N(P.count)}catch{xe("Couldn't load more results — scroll to try again.","error")}finally{Vt(H)&&U(!1)}},dl=async()=>{if(me)return;Ne(!0),xe("Reloading configuration...");const H=Lt();try{const P=await Yh();i(P);const re=await SM();o(re),e(qk(re.theme));const De=re.active_directory||a,Ze=re.extensions[0]??"",et=re.filters[0]??"";De&&u(De),d(Ze),g(et),v(re.recursive_search),re.reloaded===!1?xe(`Config file not found: ${re.config_path||"(unknown path)"} — kept current configuration.`,"error"):xe("Configuration reloaded."),De&&await xn(H,{directory:De,extension:Ze,filter_text:et,recursive:re.recursive_search})}catch(P){xe(`Failed to reload configuration: ${P.message}`,"error")}finally{Ne(!1),ei(H)}},xs=async H=>{const P=Lt();o(H),e(qk(H.theme));const re=H.active_directory||a||(H.directories[0]??""),De=H.extensions[0]??"",Ze=H.filters[0]??"";if(re&&u(re),d(De),g(Ze),v(H.recursive_search),H.session_trial||xe(H.config_exists?`Loaded config: ${H.config_path}`:"Starter configuration created."),re)try{await xn(P,{directory:re,extension:De,filter_text:Ze,recursive:H.recursive_search})}catch(et){xe(`Scan failed after config load: ${et.message}`,"error")}finally{ei(P)}else ei(P)},[xm,zu]=D.useState(!1),ys=D.useRef(Gh()),cr=H=>{ys.current=H,zu(H.overlayVisible)},Pa=D.useRef(()=>{}),Bu=async H=>{try{const P=await H.text(),re=await YC(H.name,P);await xs(re),xe(`Session config applied: ${H.name}`)}catch(P){xe(P.message||"Failed to apply dropped configuration","error")}};Pa.current=H=>{Bu(H)};const ho=D.useRef(0),Ha=D.useRef(async()=>{});D.useEffect(()=>{Ha.current=async()=>{const H=await _k();await xs(H)}}),D.useEffect(()=>{const H=async()=>{let re=[];try{re=(await xM(ho.current)).events}catch{return}for(const De of re){if(ho.current=Math.max(ho.current,De.id),De.config_applied)try{await Ha.current()}catch{}xe(De.message)}},P=setInterval(()=>void H(),xq);return()=>clearInterval(P)},[]),D.useEffect(()=>{const H=et=>{var yn;return Array.from(((yn=et.dataTransfer)==null?void 0:yn.types)??[]).includes("Files")},P=et=>{cr(Fk(ys.current,"enter",H(et)))},re=et=>{H(et)&&et.preventDefault()},De=et=>{cr(Fk(ys.current,"leave",H(et)))},Ze=et=>{var ht;et.preventDefault(),cr(Gh());const yn=Array.from(((ht=et.dataTransfer)==null?void 0:ht.files)??[]),Ve=IM(yn);if(!Ve){yn.length>0&&xe("Not a ProFiles configuration file.","error");return}Pa.current(Ve)};return window.addEventListener("dragenter",P),window.addEventListener("dragover",re),window.addEventListener("dragleave",De),window.addEventListener("drop",Ze),()=>{window.removeEventListener("dragenter",P),window.removeEventListener("dragover",re),window.removeEventListener("dragleave",De),window.removeEventListener("drop",Ze)}},[]);const Ia=()=>{je(!0)},Ua=async H=>{const P=Lt();je(!1),u(H),xe(`Directory selected: ${H}`);let re;try{re=await Lk(H),o(re)}catch(et){console.error("select-directory failed:",et)}if(!Vt(P))return;const De=re!=null&&re.extensions.includes(f)?f:(re==null?void 0:re.extensions[0])??f,Ze=re!=null&&re.filters.includes(m)?m:(re==null?void 0:re.filters[0])??m;d(De),g(Ze);try{await xn(P,{directory:H,extension:De,filter_text:Ze,recursive:b})}catch(et){Vt(P)&&xe(`Scan failed: ${et.message}`,"error")}finally{ei(P)}},Pu=async(H,P)=>{if(!Vt(P))return;const re=H.theme==="auto"?"dark":H.theme==="light"?"light":"dark";e(re);try{localStorage.setItem("profiles-theme",re)}catch{}o(H);const De=H.active_directory||(H.directories.length>0?H.directories[0]:""),Ze=H.extensions.length>0?H.extensions[0]:"",et=H.filters.length>0?H.filters[0]:"";if(De&&u(De),Ze&&d(Ze),H.recursive_search!==void 0&&v(H.recursive_search),et&&g(et),H.config_exists||Gt(!0),De)try{await xn(P,{directory:De,extension:Ze,filter_text:et,recursive:H.recursive_search})}catch(yn){Vt(P)&&xe(`Initial scan failed: ${yn.message}`,"error")}},Fa=async()=>{var P;(P=ee.current)==null||P.abort(),ee.current=new AbortController;const H=++L.current;T(null),ie(!0);try{const re=await Yh();i(re);const De=await _k();await Pu(De,H)}catch(re){T((re==null?void 0:re.message)||"Couldn't fetch system info or configuration.")}finally{ie(!1)}};D.useEffect(()=>{Fa()},[]),D.useEffect(()=>()=>{var H;oe.current&&(clearTimeout(oe.current),oe.current=null),(H=ee.current)==null||H.abort()},[]);const ni=async H=>{const P=Lt();u(H);try{const re=await Lk(H);if(!Vt(P))return;o(re);const De=re.extensions.includes(f)?f:re.extensions[0]??"",Ze=re.filters.includes(m)?m:re.filters[0]??"";d(De),g(Ze),await xn(P,{directory:H,extension:De,filter_text:Ze,recursive:b})}catch(re){Vt(P)&&xe(`Directory change failed: ${re.message}`,"error")}finally{ei(P)}},zt=async()=>{if(!a)return;const H=Lt();try{await xn(H,{directory:a,extension:f,filter_text:m,recursive:b})}catch(P){Vt(H)&&xe(`Scan failed: ${(P==null?void 0:P.message)??P}`,"error")}finally{ei(H)}},Kt=D.useRef(zt);D.useEffect(()=>{Kt.current=zt});const ml=H=>{g(H),oe.current&&clearTimeout(oe.current),oe.current=setTimeout(()=>{oe.current=null,Kt.current()},VC)},Hu=H=>{v(H),oe.current&&clearTimeout(oe.current),oe.current=setTimeout(()=>{oe.current=null,Kt.current()},VC)},ym=async()=>{if(g(""),!a)return;const H=Lt();try{await xn(H,{directory:a,extension:f,filter_text:"",recursive:b})}catch(P){Vt(H)&&xe(`Scan failed: ${(P==null?void 0:P.message)??P}`,"error")}finally{ei(H)}},bm=async()=>{if(v(!1),!a)return;const H=Lt();try{await xn(H,{directory:a,extension:f,filter_text:m,recursive:!1})}catch(P){Vt(H)&&xe(`Scan failed: ${P.message}`,"error")}finally{ei(H)}},Hr=async(H,P)=>{if(H.has_hook){ot({file:H,args:P});return}try{await EM({directory:a,filename:H.rel_path,release:l==null?void 0:l.release,args:P}),xe(`Launched ${H.filename}`)}catch(re){xe(`Launch error: ${re.message}`,"error")}},pl=()=>{Nt.length>0&&Nt[F]&&Hr(Nt[F])},mo=H=>{var P;ti.current=((P=Nt[H])==null?void 0:P.path)??null,se(H)},po=async(H,P)=>{Hr(H,P)},Ir=async H=>{try{await KC(H.path),xe("Revealed in file manager.")}catch(P){xe(`Error: ${P.message}`,"error")}},gl=async H=>{try{await Y0(H.path),xe("Folder opened in file manager.")}catch(P){xe(`Error: ${P.message}`,"error")}},bs=async H=>{try{const P=await Hk(H.path);xe(P.message||"Terminal opened.")}catch(P){xe(`Error: ${P.message}`,"error")}},xl=async H=>{try{await ni(H),xe(`Scanned directory: ${H}`)}catch(P){xe(`Error: ${P.message}`,"error")}},nn=H=>{g(H);const P=Lt();xn(P,{directory:a,extension:f,filter_text:H,recursive:b}).catch(re=>{Vt(P)&&xe(`Scan failed: ${(re==null?void 0:re.message)??re}`,"error")}).finally(()=>ei(P))},Iu=H=>{d(H);const P=Lt();xn(P,{directory:a,extension:H,filter_text:m,recursive:b}).catch(re=>{Vt(P)&&xe(`Scan failed: ${(re==null?void 0:re.message)??re}`,"error")}).finally(()=>ei(P))},Uu=async(H,P)=>{const re=P?H.path.replace(/\\/g,"/"):H.path;try{await navigator.clipboard.writeText(re),xe("Path copied to clipboard.")}catch(De){xe(`Copy failed: ${(De==null?void 0:De.message)??De}`,"error")}},Fu=async(H,P)=>{let re=H.filename;if(P){const De=re.lastIndexOf(".");De!==-1&&(re=re.slice(0,De))}try{await navigator.clipboard.writeText(re),xe("Filename copied to clipboard.")}catch(De){xe(`Copy failed: ${(De==null?void 0:De.message)??De}`,"error")}},Ur=async(H,P)=>{try{xe(`Computing ${P.toUpperCase()}...`);const re=await Ik(H.path,P);await navigator.clipboard.writeText(re.hash),xe(`${P.toUpperCase()} hash copied: ${re.hash.slice(0,12)}...`)}catch(re){xe(`Hash computation failed: ${re.message}`,"error")}},yl=async H=>{try{const P=new URL("file:///").href+H.path.replace(/\\/g,"/");await navigator.clipboard.writeText(P),xe("File URI copied to clipboard.")}catch(P){xe(`URI copy failed: ${P.message}`,"error")}},vm=async(H,P)=>{try{const re=await navigator.clipboard.readText();if(!re.trim()){xe("Clipboard is empty — copy a hash first, then try again.");return}xe(`Computing ${P.toUpperCase()}...`);const Ze=(await Ik(H.path,P)).hash.toLowerCase()===re.trim().toLowerCase();xe(Ze?`✅ ${P.toUpperCase()} matches!`:`❌ ${P.toUpperCase()} mismatch`)}catch(re){xe(`Verification failed: ${re.message}`,"error")}},qa=H=>{qe(H),zn(!0)},qu=H=>{en(H)},wm=async()=>{const H=Ft;if(en(null),!!H)try{if(xe("Deleting file..."),!(await fetch("/api/actions/delete",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({file_path:H.path})})).ok)throw new Error("Failed to delete file");xe("File deleted successfully."),zt()}catch(P){xe(`Delete failed: ${P.message}`,"error")}},ct=H=>{tn(H.path),or(!0)},Va=async()=>{if(a)try{await Y0(a),xe("Directory opened in file manager.")}catch(H){xe(`Error: ${H.message}`,"error")}},go=async H=>{if(H)try{await Hk(H),xe("Terminal opened in directory.")}catch(P){xe(`Error: ${P.message}`,"error")}},vs=async()=>{try{await ni("~"),xe("Directory set to home folder.")}catch(H){xe(`Error: ${H.message}`,"error")}},Qi=async()=>{if(a)try{const H=await GC(a);H.parent_path?(await ni(H.parent_path),xe("Moved to parent directory.")):xe("Already at root directory.")}catch(H){xe(`Error: ${H.message}`,"error")}},Vn=async()=>{if(w.length===0){xe("No files to export.");return}try{const H=pq(w,(l==null?void 0:l.column_names)||[],l??void 0,m),P=`profiles-export-${new Date().toISOString().slice(0,19).replace(/[:.]/g,"-")}.csv`,re=await RM(H,P);xe(`Exported ${w.length} loaded row${w.length===1?"":"s"}${m?` matching "${m}"`:""} — ${re.message}`)}catch(H){xe(`Export failed: ${H.message}`,"error")}},Vu=async H=>{var Ve,ht;Jn(!1),xe("Barcode detected!");const re=FC(H).values,De=re.dir!==void 0?re.dir:a,Ze=re.ext!==void 0?re.ext:f,et=re.filter!==void 0?re.filter:m,yn=re.recursive!==void 0?re.recursive:b;if(re.dir!==void 0&&u(re.dir),re.ext!==void 0&&d(re.ext),re.filter!==void 0&&g(re.filter),re.recursive!==void 0&&v(re.recursive),De){const bt=Lt();try{await Pk({directory:De,extension:Ze,filter_text:et,recursive:yn},(Ve=ee.current)==null?void 0:Ve.signal);const ur=await Kg({offset:0,limit:M0,sort_by:q==null?void 0:q.column,sort_dir:q==null?void 0:q.direction,signal:(ht=ee.current)==null?void 0:ht.signal});if(!Vt(bt))return;S(ur.items),N(ur.count),M(!0),ti.current=null,se(0),ur.count===1&&ur.items.length===1&&hl(ur.items[0])}catch(ur){Vt(bt)&&xe(`Scan error: ${ur.message}`,"error")}finally{ei(bt)}}},km=()=>{qt(H=>{const P=!H;return P?(mn.current="",xe("Barcode mode ON — scan a barcode now.")):(mn.current="",xe("Barcode mode OFF.")),P})},Qa=H=>{H.filter!==void 0&&g(H.filter),H.ext!==void 0&&d(H.ext),H.recursive!==void 0&&v(H.recursive),H.dir!==void 0&&u(H.dir),(H.scan===!0||H.filter!==void 0||H.ext!==void 0||H.recursive!==void 0||H.dir!==void 0)&&(qt(!1),mn.current="",setTimeout(()=>{Kt.current()},50))};D.useEffect(()=>{if(!gt)return;const H=P=>{const re=P.target;if(!(re instanceof HTMLElement&&(re.isContentEditable||re instanceof HTMLInputElement||re instanceof HTMLTextAreaElement||re instanceof HTMLSelectElement)))if(P.key==="Enter"){const Ze=mn.current;if(!Ze){mn.current="";return}P.preventDefault(),mn.current="";const et=FC(Ze);if(et.isPlainFilter)xe(`Barcode filter: ${et.values.filter}`),g(et.values.filter||""),qt(!1),setTimeout(()=>void Kt.current(),50);else{const yn=et.values,Ve=Object.entries(yn).map(([ht,bt])=>`${ht}=${bt}`).join(", ");xe(`Barcode applied: ${Ve}`),Qa(yn)}}else P.key==="Escape"?(qt(!1),mn.current="",xe("Barcode mode cancelled.")):P.key.length===1&&!P.ctrlKey&&!P.metaKey&&!P.altKey&&(mn.current+=P.key)};return document.addEventListener("keydown",H,!0),()=>document.removeEventListener("keydown",H,!0)},[gt]),D.useEffect(()=>(ms>0&&(co.current=setInterval(()=>{Kt.current()},ms*1e3)),()=>{co.current&&(clearInterval(co.current),co.current=null)}),[ms]);const Qu=H=>{Lu(H),H>0?xe(`Auto-rescan every ${H}s.`):xe("Auto-rescan disabled.")},Xu=!!(Le||B||ve||It||Ut||Ie||V||Mi||pn||gn||We||Ft);return D.useEffect(()=>{const H=P=>{var De,Ze,et,yn;if(P.key==="Escape"){_e(null),j(!1),at(!1),K(!1),cr(Gh());return}if(Xu)return;if(P.ctrlKey&&!P.shiftKey&&P.key.toLowerCase()==="l"){P.preventDefault(),(De=document.querySelector("[data-testid='file-list']"))==null||De.focus();return}const re=P.target;if(!(re instanceof HTMLElement&&re.closest("button, a, [role='menuitem'], [role='option'], [role='columnheader'], [role='separator']"))){if(re instanceof HTMLInputElement||re instanceof HTMLSelectElement){P.key==="Enter"&&zt();return}if(P.key==="ContextMenu"||P.shiftKey&&P.key==="F10"){const Ve=Nt[F];if(!Ve)return;P.preventDefault();const ht=document.querySelector(`[data-row-index="${F}"]`),bt=ht==null?void 0:ht.getBoundingClientRect();_e({x:bt?bt.left+24:24,y:bt?bt.top+bt.height/2:24,file:Ve});return}if(P.key==="F5"){P.preventDefault(),zt();return}if(P.ctrlKey&&P.key.toLowerCase()==="r"){P.preventDefault(),dl();return}if(P.ctrlKey&&P.key.toLowerCase()==="d"){P.preventDefault(),(Ze=document.querySelector("#directory-combobox"))==null||Ze.focus();return}if(P.ctrlKey&&P.key.toLowerCase()==="e"){P.preventDefault(),(et=document.querySelector("#extension-combobox"))==null||et.focus();return}if(P.ctrlKey&&P.key.toLowerCase()==="f"){P.preventDefault(),(yn=document.querySelector("#filter-combobox"))==null||yn.focus();return}if(P.ctrlKey&&P.shiftKey&&P.key.toLowerCase()==="l"){P.preventDefault(),at(Ve=>!Ve);return}if(P.ctrlKey&&P.key===","){P.preventDefault(),_t(!0);return}if(P.ctrlKey&&P.shiftKey&&P.key.toLowerCase()==="t"){P.preventDefault(),e(Ve=>Ve==="dark"?"light":"dark");return}if(P.ctrlKey&&!P.shiftKey&&P.key.toLowerCase()==="b"){P.preventDefault(),qt(Ve=>!Ve);return}if(P.ctrlKey&&P.shiftKey&&P.key.toLowerCase()==="b"){P.preventDefault(),Jn(Ve=>!Ve);return}if(P.ctrlKey&&!P.shiftKey&&P.key.toLowerCase()==="t"){P.preventDefault(),K(!0);return}if(P.ctrlKey&&!P.shiftKey&&P.key.toLowerCase()==="h"){P.preventDefault(),vs();return}if(P.key==="?"||P.ctrlKey&&P.key==="/"){P.preventDefault(),j(Ve=>!Ve);return}if(P.key.toLowerCase()==="p"&&!P.ctrlKey&&!P.shiftKey&&!P.altKey){const Ve=Nt[F];Ve&&(P.preventDefault(),qa(Ve));return}P.key==="ArrowDown"?(P.preventDefault(),se(Ve=>{var bt;const ht=Math.min(Ve+1,Math.max(0,Nt.length-1));return ti.current=((bt=Nt[ht])==null?void 0:bt.path)??null,ht})):P.key==="ArrowUp"?(P.preventDefault(),se(Ve=>{var bt;const ht=Math.max(Ve-1,0);return ti.current=((bt=Nt[ht])==null?void 0:bt.path)??null,ht})):P.key==="Home"?(P.preventDefault(),se(Ve=>{var ht;return ti.current=((ht=Nt[0])==null?void 0:ht.path)??null,Ve===0?Ve:0})):P.key==="End"?(P.preventDefault(),se(Ve=>{var bt;const ht=Math.max(0,Nt.length-1);return ti.current=((bt=Nt[ht])==null?void 0:bt.path)??null,Ve===ht?Ve:ht})):P.key==="PageUp"?(P.preventDefault(),se(Ve=>{var bt;const ht=Math.max(Ve-QC,0);return ti.current=((bt=Nt[ht])==null?void 0:bt.path)??null,ht})):P.key==="PageDown"?(P.preventDefault(),se(Ve=>{var bt;const ht=Math.min(Ve+QC,Math.max(0,Nt.length-1));return ti.current=((bt=Nt[ht])==null?void 0:bt.path)??null,ht})):P.key==="Enter"&&(P.preventDefault(),pl())}};return window.addEventListener("keydown",H),()=>window.removeEventListener("keydown",H)},[Xu,Nt,F,a,f,m,b,gt]),D.useEffect(()=>{document.documentElement.setAttribute("data-theme",n);try{localStorage.setItem("profiles-theme",n)}catch{}},[n]),y.jsxs("div",{className:"flex h-dvh flex-col bg-elevated/30 p-1 font-sans text-ink transition-colors duration-200 sm:p-1.5",children:[y.jsxs("div",{className:"flex min-h-0 flex-1 flex-col overflow-hidden rounded-lg border border-frame-line bg-app shadow-[0_2px_6px_rgb(0_0_0/0.35)] transition-colors duration-200 sm:rounded-xl",children:[y.jsx(X9,{title:(l==null?void 0:l.title)||"",release:(l==null?void 0:l.release)||"",directories:(l==null?void 0:l.directories)||[],activeDirectory:a,onDirectoryChange:ni,onBrowseDirectory:Ia,onGoToParentDirectory:Qi,onGoToHomeDirectory:vs,onOpenActiveDirectory:Va,onOpenTerminal:go}),y.jsx(t8,{extensions:(l==null?void 0:l.extensions)||[],activeExtension:f,onExtensionChange:d,filterOptions:(l==null?void 0:l.filters)||[],filterText:m,onFilterTextChange:ml,recursive:b,onRecursiveChange:Hu,onScan:zt,scanning:he,barcodeMode:gt,onBarcodeToggle:km,onCameraBarcodeClick:()=>Jn(!0),autoRescanActive:ms>0,onTimerClick:()=>K(!0)}),E?y.jsx($9,{message:E,onRetry:()=>void Fa(),retrying:z}):y.jsx(Q9,{files:Nt,totalCount:C,rawLoadedCount:w.length,onLoadMore:fo,loadingMore:I,scanning:he,hasScanned:R,activeDirectory:a,recursive:b,onDisableRecursive:bm,onOpenDirectory:Va,onLoadConfig:()=>Gt(!0),filterText:m,onClearFilter:ym,columnHeaders:(l==null?void 0:l.column_headers)||[],columnNames:(l==null?void 0:l.column_names)||[],selectedIndex:F,onSelectIndex:mo,prefilterNote:uo,onLaunch:Hr,onContextMenu:(H,P,re)=>{H.preventDefault(),ti.current=P.path,se(re),_e({x:H.clientX,y:H.clientY,file:P})},rowColors:(l==null?void 0:l.row_colors)||[],sort:q,onSortChange:H=>{J(H),ti.current=null,se(0);const P=Lt();gs(P,H).catch(re=>{Vt(P)&&xe(`Sort failed: ${re.message}`,"error")}).finally(()=>ei(P))}}),y.jsx(RD,{onExecute:pl,scanning:he,scanningDirectory:a,hasSelection:Nt.length>0,fileCount:Nt.length,totalCount:C,toastMessage:$,onToastDismiss:qn}),y.jsx(k8,{systemInfo:t,fileCount:C,theme:n,onToggleTheme:()=>e(H=>H==="dark"?"light":"dark"),onOpenLog:()=>at(!0),onOpenConfig:()=>_t(!0),onShowShortcuts:()=>j(!0),onReloadConfig:dl,onExport:Vn,exportDisabled:w.length===0||he,language:Te,onLanguageChange:ze,lanEnabled:(t==null?void 0:t.lan_enabled)??null,onToggleLan:ar})]}),y.jsx(I9,{open:un,onClose:()=>_t(!1),onApplied:xs,onLoadConfig:()=>Gt(!0),reloadKey:yt}),y.jsx(o8,{isOpen:It,activeConfigPath:l==null?void 0:l.config_path,configExists:l==null?void 0:l.config_exists,onClose:()=>Gt(!1),onLoaded:H=>{xs(H),rt(P=>P+1)}}),y.jsx(q9,{visible:xm,onFileSelected:H=>Pa.current(H)}),y.jsx(F9,{isOpen:ve,initialPath:a,onClose:()=>je(!1),onSelect:Ua}),y.jsx(U9,{position:Le,onClose:()=>_e(null),onLaunch:Hr,onLaunchWithArgs:po,onReveal:Ir,onOpenFolder:gl,onOpenTerminal:bs,onScanDirectory:xl,onFilterFolder:nn,onFilterExtension:Iu,onCopyPath:Uu,onCopyFilename:Fu,onCopyUri:yl,onComputeHash:Ur,onVerifyHash:vm,onProperties:qa,onClearFile:qu,onGenerateBarcode:ct,showToast:xe}),y.jsx(s8,{isOpen:B,onClose:()=>j(!1)}),y.jsx(h8,{isOpen:Ut,file:ke,onLaunch:Hr,onClose:()=>{zn(!1),qe(null)}}),y.jsx(C8,{isOpen:V,currentInterval:ms,onClose:()=>K(!1),onSetInterval:Qu}),y.jsx(l8,{isOpen:Ie,onClose:()=>at(!1),onOpenExternally:()=>{yM().then(H=>xe(H.message))}}),y.jsx(hq,{isOpen:!!We,onClose:()=>ot(null),directory:a,filename:(We==null?void 0:We.file.rel_path)||"",release:l==null?void 0:l.release,args:We==null?void 0:We.args,onFinished:(H,P)=>{H==="completed"?xe(P||"Workflow launched successfully."):(H==="aborted"||H==="failed")&&xe(`Workflow stopped: ${P}`,"error")}}),y.jsx(pA,{isOpen:Mi,onClose:()=>{or(!1),tn(void 0)},initialFilePath:ao}),y.jsx(v8,{isOpen:pn,onClose:()=>Jn(!1),onDetected:Vu}),y.jsx(va,{isOpen:!!Ft,title:"Delete file",message:`Delete this file? + +${(Ft==null?void 0:Ft.path)??""} + +This action cannot be undone.`,confirmLabel:"Delete",danger:!0,onConfirm:wm,onCancel:()=>en(null)}),y.jsx(va,{isOpen:de!==null,title:de?"Enable LAN access?":"Restrict to this machine?",message:de?y.jsxs("span",{className:"block",children:["ProFiles will be reachable by anyone on this network:",y.jsx(IC,{url:`http://${t==null?void 0:t.hostname}:${window.location.port}`,label:"Copy hostname URL",className:"mt-1.5",onCopied:()=>xe("URL copied to clipboard."),onCopyError:()=>xe("Failed to copy URL.","error")}),y.jsx(IC,{url:`http://${t==null?void 0:t.ip}:${window.location.port}`,label:"Copy IP URL",className:"mt-1.5",onCopied:()=>xe("URL copied to clipboard."),onCopyError:()=>xe("Failed to copy URL.","error")})]}):"ProFiles will be reachable only on this machine.",confirmLabel:de?"Enable LAN":"Restrict",onConfirm:async()=>{const H=de;Se(null);try{await vM(H),xe(H?"Updating LAN binding…":"Restricting ProFiles to this machine…","info");const P=await wM(H);P&&i(P),(P==null?void 0:P.lan_enabled)===H?xe(H?"ProFiles is now reachable on the local network.":"ProFiles is restricted to this machine.","info"):xe("Failed to update LAN binding — the previous address is still active.","error")}catch(P){const re=P instanceof Error?P.message:"Failed to update LAN binding";xe(`Failed to update LAN binding: ${re}`,"error");const De=await Yh();i(De)}},onCancel:()=>Se(null)}),y.jsx(w8,{isOpen:!!gn,file:gn,onConfirm:()=>{if(gn){const H=gn;hl(null),Hr(H)}},onDismiss:()=>hl(null)})]})}class bq extends D.Component{constructor(){super(...arguments);hh(this,"state",{error:null})}static getDerivedStateFromError(t){return{error:t}}componentDidCatch(t,i){console.error("Application render error:",t,i.componentStack)}render(){return this.state.error?y.jsx("main",{className:"flex min-h-screen items-center justify-center bg-app p-6 text-ink",children:y.jsxs("section",{className:"w-full max-w-lg rounded-lg border border-line bg-surface p-6",children:[y.jsx("h1",{className:"text-base font-semibold",children:"ProFiles encountered an error"}),y.jsx("p",{className:"mt-2 text-sm text-ink-secondary",children:"The interface could not continue. Reload the application to try again."}),y.jsxs("details",{className:"mt-4 text-xs text-ink-muted",children:[y.jsx("summary",{className:"cursor-pointer",children:"Error details"}),y.jsx("pre",{className:"mt-2 max-h-40 overflow-auto whitespace-pre-wrap",children:this.state.error.message})]}),y.jsx("button",{type:"button",onClick:()=>window.location.reload(),className:"btn btn-primary mt-5 px-4 py-2 text-sm font-semibold",children:"Reload application"})]})}):this.props.children}}gM.createRoot(document.getElementById("root")).render(y.jsx(cM.StrictMode,{children:y.jsx(bq,{children:y.jsx(yq,{})})})); diff --git a/src/profiles/web/dist/assets/index-D1PFxxdY.css b/src/profiles/web/dist/assets/index-D1PFxxdY.css new file mode 100644 index 0000000..f98c515 --- /dev/null +++ b/src/profiles/web/dist/assets/index-D1PFxxdY.css @@ -0,0 +1 @@ +/*! tailwindcss v4.3.3 | MIT License | https://tailwindcss.com */@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-translate-x:0;--tw-translate-y:0;--tw-translate-z:0;--tw-rotate-x:initial;--tw-rotate-y:initial;--tw-rotate-z:initial;--tw-skew-x:initial;--tw-skew-y:initial;--tw-space-y-reverse:0;--tw-border-style:solid;--tw-gradient-position:initial;--tw-gradient-from:#0000;--tw-gradient-via:#0000;--tw-gradient-to:#0000;--tw-gradient-stops:initial;--tw-gradient-via-stops:initial;--tw-gradient-from-position:0%;--tw-gradient-via-position:50%;--tw-gradient-to-position:100%;--tw-leading:initial;--tw-font-weight:initial;--tw-tracking:initial;--tw-ordinal:initial;--tw-slashed-zero:initial;--tw-numeric-figure:initial;--tw-numeric-spacing:initial;--tw-numeric-fraction:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-outline-style:solid;--tw-blur:initial;--tw-brightness:initial;--tw-contrast:initial;--tw-grayscale:initial;--tw-hue-rotate:initial;--tw-invert:initial;--tw-opacity:initial;--tw-saturate:initial;--tw-sepia:initial;--tw-drop-shadow:initial;--tw-drop-shadow-color:initial;--tw-drop-shadow-alpha:100%;--tw-drop-shadow-size:initial;--tw-backdrop-blur:initial;--tw-backdrop-brightness:initial;--tw-backdrop-contrast:initial;--tw-backdrop-grayscale:initial;--tw-backdrop-hue-rotate:initial;--tw-backdrop-invert:initial;--tw-backdrop-opacity:initial;--tw-backdrop-saturate:initial;--tw-backdrop-sepia:initial;--tw-duration:initial;--tw-scale-x:1;--tw-scale-y:1;--tw-scale-z:1}}}@layer theme{:root,:host{--font-sans:-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", "Noto Sans", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";--font-mono:ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;--color-emerald-200:oklch(90.5% .093 164.15);--color-emerald-300:oklch(84.5% .143 164.978);--color-emerald-400:oklch(76.5% .177 163.223);--color-emerald-500:oklch(69.6% .17 162.48);--color-emerald-600:oklch(59.6% .145 163.225);--color-emerald-800:oklch(43.2% .095 166.913);--color-indigo-400:oklch(67.3% .182 276.935);--color-indigo-500:oklch(58.5% .233 277.117);--color-indigo-600:oklch(51.1% .262 276.966);--color-slate-300:oklch(86.9% .022 252.894);--color-slate-400:oklch(70.4% .04 256.788);--color-slate-500:oklch(55.4% .046 257.417);--color-slate-600:oklch(44.6% .043 257.281);--color-slate-900:oklch(20.8% .042 265.755);--color-black:#000;--color-white:#fff;--spacing:.25rem;--container-xs:20rem;--container-sm:24rem;--container-md:28rem;--container-lg:32rem;--container-4xl:56rem;--container-5xl:64rem;--container-6xl:72rem;--text-xs:.75rem;--text-xs--line-height:calc(1 / .75);--text-sm:.875rem;--text-sm--line-height:calc(1.25 / .875);--text-base:1rem;--text-base--line-height: 1.5 ;--font-weight-normal:400;--font-weight-medium:500;--font-weight-semibold:600;--font-weight-bold:700;--tracking-tight:-.025em;--tracking-wide:.025em;--tracking-wider:.05em;--leading-relaxed:1.625;--radius-md:.375rem;--radius-lg:.5rem;--radius-xl:.75rem;--radius-2xl:1rem;--animate-spin:spin 1s linear infinite;--animate-pulse:pulse 2s cubic-bezier(.4, 0, .6, 1) infinite;--blur-xs:4px;--blur-sm:8px;--blur-md:12px;--blur-xl:24px;--aspect-video:16 / 9;--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4, 0, .2, 1);--default-font-family:var(--font-sans);--default-mono-font-family:var(--font-mono)}}@layer base{*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;-moz-tab-size:4;tab-size:4;line-height:1.5;font-family:var(--default-font-family,-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", "Noto Sans", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--default-mono-font-family,ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-variation-settings:var(--default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring:where(:not(iframe)){outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab,red,red)){::placeholder{color:color-mix(in oklab,currentcolor 50%,transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){-webkit-appearance:button;-moz-appearance:button;appearance:button}::file-selector-button{-webkit-appearance:button;-moz-appearance:button;appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}}@layer components{.glass-panel{background:var(--app-glass-panel);-webkit-backdrop-filter:blur(24px)saturate(160%);backdrop-filter:blur(24px)saturate(160%);box-shadow:var(--app-panel-shadow),inset 0 1px 0 var(--app-glass-highlight)}.glass-panel-strong{background:var(--app-glass-panel-strong);-webkit-backdrop-filter:blur(28px)saturate(180%);backdrop-filter:blur(28px)saturate(180%);box-shadow:var(--app-panel-shadow),inset 0 1px 0 var(--app-glass-highlight)}.btn{justify-content:center;align-items:center;gap:calc(var(--spacing) * 1.5);border-radius:var(--radius-md);border-style:var(--tw-border-style);font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height));--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium);transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration));border-width:1px;display:inline-flex}.btn:focus-visible{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow);--tw-ring-color:#625fffb3}@supports (color:color-mix(in lab,red,red)){.btn:focus-visible{--tw-ring-color:color-mix(in oklab, var(--color-indigo-500) 70%, transparent)}}.btn:focus-visible{--tw-outline-style:none;outline-style:none}.btn:disabled{cursor:not-allowed;opacity:.4}.btn-primary{background-color:var(--color-indigo-600);color:var(--color-white);border-color:#0000}@media(hover:hover){.btn-primary:hover{background-color:var(--color-indigo-500)}}.btn-secondary{border-color:var(--app-border);background-color:var(--app-elevated);color:var(--app-text-secondary)}@media(hover:hover){.btn-secondary:hover{border-color:var(--color-indigo-500);color:var(--app-text-primary)}.btn-chip:hover{--tw-brightness:brightness(95%);filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}}.btn-chip:focus-visible{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow);--tw-ring-color:#625fffb3}@supports (color:color-mix(in lab,red,red)){.btn-chip:focus-visible{--tw-ring-color:color-mix(in oklab, var(--color-indigo-500) 70%, transparent)}}.btn-chip:focus-visible{--tw-outline-style:none;outline-style:none}.btn-chip:disabled{cursor:not-allowed;opacity:.4}.focus-ring:focus-visible{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow);--tw-ring-color:#625fffb3}@supports (color:color-mix(in lab,red,red)){.focus-ring:focus-visible{--tw-ring-color:color-mix(in oklab, var(--color-indigo-500) 70%, transparent)}}.focus-ring:focus-visible{--tw-outline-style:none;outline-style:none}}@layer utilities{.pointer-events-auto{pointer-events:auto}.pointer-events-none{pointer-events:none}.invisible{visibility:hidden}.visible{visibility:visible}.sr-only{clip-path:inset(50%);white-space:nowrap;border-width:0;width:1px;height:1px;margin:-1px;padding:0;position:absolute;overflow:hidden}.absolute{position:absolute}.fixed{position:fixed}.relative{position:relative}.static{position:static}.sticky{position:sticky}.inset-0{top:0;right:0;bottom:0;left:0}.inset-y-0{inset-block:0}.-top-1{top:calc(var(--spacing) * -1)}.top-0{top:0}.top-1\/2{top:50%}.top-2{top:calc(var(--spacing) * 2)}.top-full{top:100%}.-right-0\.5{right:calc(var(--spacing) * -.5)}.-right-1{right:calc(var(--spacing) * -1)}.right-0{right:0}.right-2{right:calc(var(--spacing) * 2)}.-bottom-0\.5{bottom:calc(var(--spacing) * -.5)}.-bottom-1{bottom:calc(var(--spacing) * -1)}.bottom-0{bottom:0}.bottom-2{bottom:calc(var(--spacing) * 2)}.-left-1{left:calc(var(--spacing) * -1)}.left-0{left:0}.left-1\/2{left:50%}.left-2\.5{left:calc(var(--spacing) * 2.5)}.left-3{left:calc(var(--spacing) * 3)}.isolate{isolation:isolate}.z-10{z-index:10}.z-20{z-index:20}.z-30{z-index:30}.z-\[calc\(var\(--z-context-menu\)-1\)\]{z-index:calc(var(--z-context-menu) - 1)}.z-\[var\(--z-combobox-list\)\]{z-index:var(--z-combobox-list)}.z-\[var\(--z-context-menu\)\]{z-index:var(--z-context-menu)}.z-\[var\(--z-drop-overlay\)\]{z-index:var(--z-drop-overlay)}.z-\[var\(--z-modal\)\]{z-index:var(--z-modal)}.z-\[var\(--z-syntax-helper\)\]{z-index:var(--z-syntax-helper)}.z-\[var\(--z-toast\)\]{z-index:var(--z-toast)}.z-\[var\(--z-tooltip\)\]{z-index:var(--z-tooltip)}.container{width:100%}@media(min-width:40rem){.container{max-width:40rem}}@media(min-width:48rem){.container{max-width:48rem}}@media(min-width:64rem){.container{max-width:64rem}}@media(min-width:80rem){.container{max-width:80rem}}@media(min-width:96rem){.container{max-width:96rem}}.container\!{width:100%!important}@media(min-width:40rem){.container\!{max-width:40rem!important}}@media(min-width:48rem){.container\!{max-width:48rem!important}}@media(min-width:64rem){.container\!{max-width:64rem!important}}@media(min-width:80rem){.container\!{max-width:80rem!important}}@media(min-width:96rem){.container\!{max-width:96rem!important}}.mx-1{margin-inline:var(--spacing)}.mx-auto{margin-inline:auto}.my-1{margin-block:var(--spacing)}.my-1\.5{margin-block:calc(var(--spacing) * 1.5)}.my-2{margin-block:calc(var(--spacing) * 2)}.my-3{margin-block:calc(var(--spacing) * 3)}.mt-0\.5{margin-top:calc(var(--spacing) * .5)}.mt-1{margin-top:var(--spacing)}.mt-1\.5{margin-top:calc(var(--spacing) * 1.5)}.mt-2{margin-top:calc(var(--spacing) * 2)}.mt-3{margin-top:calc(var(--spacing) * 3)}.mt-4{margin-top:calc(var(--spacing) * 4)}.mt-5{margin-top:calc(var(--spacing) * 5)}.mt-6{margin-top:calc(var(--spacing) * 6)}.mr-1\.5{margin-right:calc(var(--spacing) * 1.5)}.mr-auto{margin-right:auto}.mb-0\.5{margin-bottom:calc(var(--spacing) * .5)}.mb-1{margin-bottom:var(--spacing)}.mb-1\.5{margin-bottom:calc(var(--spacing) * 1.5)}.mb-2{margin-bottom:calc(var(--spacing) * 2)}.mb-3{margin-bottom:calc(var(--spacing) * 3)}.mb-4{margin-bottom:calc(var(--spacing) * 4)}.mb-5{margin-bottom:calc(var(--spacing) * 5)}.ml-1\.5{margin-left:calc(var(--spacing) * 1.5)}.ml-2{margin-left:calc(var(--spacing) * 2)}.ml-auto{margin-left:auto}.block{display:block}.contents{display:contents}.flex{display:flex}.grid{display:grid}.hidden{display:none}.inline{display:inline}.inline-block{display:inline-block}.inline-flex{display:inline-flex}.list-item{display:list-item}.table{display:table}.aspect-video{aspect-ratio:var(--aspect-video)}.h-2{height:calc(var(--spacing) * 2)}.h-2\.5{height:calc(var(--spacing) * 2.5)}.h-3{height:calc(var(--spacing) * 3)}.h-3\.5{height:calc(var(--spacing) * 3.5)}.h-4{height:calc(var(--spacing) * 4)}.h-5{height:calc(var(--spacing) * 5)}.h-6{height:calc(var(--spacing) * 6)}.h-7{height:calc(var(--spacing) * 7)}.h-8{height:calc(var(--spacing) * 8)}.h-9{height:calc(var(--spacing) * 9)}.h-10{height:calc(var(--spacing) * 10)}.h-12{height:calc(var(--spacing) * 12)}.h-48{height:calc(var(--spacing) * 48)}.h-\[80vh\]{height:80vh}.h-\[90vh\]{height:90vh}.h-\[min\(84dvh\,760px\)\]{height:min(84dvh,760px)}.h-dvh{height:100dvh}.h-full{height:100%}.max-h-40{max-height:calc(var(--spacing) * 40)}.max-h-48{max-height:calc(var(--spacing) * 48)}.max-h-60{max-height:calc(var(--spacing) * 60)}.max-h-\[60vh\]{max-height:60vh}.max-h-\[90vh\]{max-height:90vh}.max-h-\[calc\(100dvh-1\.5rem\)\]{max-height:calc(100dvh - 1.5rem)}.max-h-\[calc\(100dvh-2rem\)\]{max-height:calc(100dvh - 2rem)}.max-h-\[calc\(100dvh-16px\)\]{max-height:calc(100dvh - 16px)}.min-h-0{min-height:0}.min-h-9{min-height:calc(var(--spacing) * 9)}.min-h-10{min-height:calc(var(--spacing) * 10)}.min-h-16{min-height:calc(var(--spacing) * 16)}.min-h-24{min-height:calc(var(--spacing) * 24)}.min-h-36{min-height:calc(var(--spacing) * 36)}.min-h-\[24px\]{min-height:24px}.min-h-\[44px\]{min-height:44px}.min-h-screen{min-height:100vh}.w-1\/3{width:33.3333%}.w-2{width:calc(var(--spacing) * 2)}.w-2\.5{width:calc(var(--spacing) * 2.5)}.w-3{width:calc(var(--spacing) * 3)}.w-3\.5{width:calc(var(--spacing) * 3.5)}.w-4{width:calc(var(--spacing) * 4)}.w-5{width:calc(var(--spacing) * 5)}.w-6{width:calc(var(--spacing) * 6)}.w-7{width:calc(var(--spacing) * 7)}.w-8{width:calc(var(--spacing) * 8)}.w-9{width:calc(var(--spacing) * 9)}.w-10{width:calc(var(--spacing) * 10)}.w-12{width:calc(var(--spacing) * 12)}.w-44{width:calc(var(--spacing) * 44)}.w-48{width:calc(var(--spacing) * 48)}.w-56{width:calc(var(--spacing) * 56)}.w-72{width:calc(var(--spacing) * 72)}.w-96{width:calc(var(--spacing) * 96)}.w-\[52px\]{width:52px}.w-\[138px\]{width:138px}.w-\[150px\]{width:150px}.w-\[280px\]{width:280px}.w-\[400px\]{width:400px}.w-\[420px\]{width:420px}.w-\[450px\]{width:450px}.w-\[clamp\(560px\,85vw\,1500px\)\]{width:clamp(560px,85vw,1500px)}.w-\[min\(94vw\,560px\)\]{width:min(94vw,560px)}.w-\[min\(94vw\,960px\)\]{width:min(94vw,960px)}.w-full{width:100%}.w-max{width:max-content}.max-w-4xl{max-width:var(--container-4xl)}.max-w-5xl{max-width:var(--container-5xl)}.max-w-6xl{max-width:var(--container-6xl)}.max-w-\[220px\]{max-width:220px}.max-w-\[calc\(100vw-16px\)\]{max-width:calc(100vw - 16px)}.max-w-\[min\(70vw\,560px\)\]{max-width:min(70vw,560px)}.max-w-\[min\(80vw\,640px\)\]{max-width:min(80vw,640px)}.max-w-full{max-width:100%}.max-w-lg{max-width:var(--container-lg)}.max-w-md{max-width:var(--container-md)}.max-w-sm{max-width:var(--container-sm)}.max-w-xs{max-width:var(--container-xs)}.min-w-0{min-width:0}.min-w-48{min-width:calc(var(--spacing) * 48)}.min-w-\[100px\]{min-width:100px}.min-w-\[220px\]{min-width:220px}.flex-1{flex:1}.flex-shrink-0,.shrink-0{flex-shrink:0}.flex-grow,.grow{flex-grow:1}.basis-64{flex-basis:calc(var(--spacing) * 64)}.basis-full{flex-basis:100%}.border-collapse{border-collapse:collapse}.-translate-x-1\/2{--tw-translate-x: -50% ;translate:var(--tw-translate-x) var(--tw-translate-y)}.-translate-y-1\/2{--tw-translate-y: -50% ;translate:var(--tw-translate-x) var(--tw-translate-y)}.rotate-45{rotate:45deg}.rotate-180{rotate:180deg}.transform{transform:var(--tw-rotate-x,) var(--tw-rotate-y,) var(--tw-rotate-z,) var(--tw-skew-x,) var(--tw-skew-y,)}.animate-pulse{animation:var(--animate-pulse)}.animate-spin{animation:var(--animate-spin)}.cursor-col-resize{cursor:col-resize}.cursor-not-allowed{cursor:not-allowed}.cursor-pointer{cursor:pointer}.touch-none{touch-action:none}.resize{resize:both}.resize\!{resize:both!important}.list-decimal{list-style-type:decimal}.list-disc{list-style-type:disc}.grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.place-items-center{place-items:center}.items-center{align-items:center}.items-start{align-items:flex-start}.justify-between{justify-content:space-between}.justify-center{justify-content:center}.justify-end{justify-content:flex-end}.gap-1{gap:var(--spacing)}.gap-1\.5{gap:calc(var(--spacing) * 1.5)}.gap-2{gap:calc(var(--spacing) * 2)}.gap-2\.5{gap:calc(var(--spacing) * 2.5)}.gap-3{gap:calc(var(--spacing) * 3)}.gap-3\.5{gap:calc(var(--spacing) * 3.5)}.gap-4{gap:calc(var(--spacing) * 4)}:where(.space-y-0\.5>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * .5) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * .5) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-1>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(var(--spacing) * var(--tw-space-y-reverse));margin-block-end:calc(var(--spacing) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-1\.5>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 1.5) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 1.5) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-2>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 2) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 2) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-3>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 3) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 3) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-4>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 4) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 4) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-6>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 6) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 6) * calc(1 - var(--tw-space-y-reverse)))}.gap-x-4{column-gap:calc(var(--spacing) * 4)}.gap-y-1\.5{row-gap:calc(var(--spacing) * 1.5)}.gap-y-2{row-gap:calc(var(--spacing) * 2)}.truncate{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.overflow-auto{overflow:auto}.overflow-hidden{overflow:hidden}.overflow-x-auto{overflow-x:auto}.overflow-y-auto{overflow-y:auto}.overscroll-contain{overscroll-behavior:contain}.rounded{border-radius:.25rem}.rounded-2xl{border-radius:var(--radius-2xl)}.rounded-full{border-radius:3.40282e38px}.rounded-lg{border-radius:var(--radius-lg)}.rounded-md{border-radius:var(--radius-md)}.rounded-xl{border-radius:var(--radius-xl)}.rounded-l-md{border-top-left-radius:var(--radius-md);border-bottom-left-radius:var(--radius-md)}.rounded-r-md{border-top-right-radius:var(--radius-md);border-bottom-right-radius:var(--radius-md)}.border{border-style:var(--tw-border-style);border-width:1px}.border-2{border-style:var(--tw-border-style);border-width:2px}.border-t{border-top-style:var(--tw-border-style);border-top-width:1px}.border-t-2{border-top-style:var(--tw-border-style);border-top-width:2px}.border-r{border-right-style:var(--tw-border-style);border-right-width:1px}.border-r-2{border-right-style:var(--tw-border-style);border-right-width:2px}.border-b{border-bottom-style:var(--tw-border-style);border-bottom-width:1px}.border-b-2{border-bottom-style:var(--tw-border-style);border-bottom-width:2px}.border-l{border-left-style:var(--tw-border-style);border-left-width:1px}.border-l-0{border-left-style:var(--tw-border-style);border-left-width:0}.border-l-2{border-left-style:var(--tw-border-style);border-left-width:2px}.border-l-4{border-left-style:var(--tw-border-style);border-left-width:4px}.border-dashed{--tw-border-style:dashed;border-style:dashed}.border-\[var\(--app-editor-border\)\]{border-color:var(--app-editor-border)}.border-chip-amber-border{border-color:var(--chip-amber-border)}.border-chip-fuchsia-border{border-color:var(--chip-fuchsia-border)}.border-chip-indigo-border,.border-chip-indigo-border\/50{border-color:var(--chip-indigo-border)}@supports (color:color-mix(in lab,red,red)){.border-chip-indigo-border\/50{border-color:color-mix(in oklab,var(--chip-indigo-border) 50%,transparent)}}.border-chip-purple-border,.border-chip-purple-border\/50{border-color:var(--chip-purple-border)}@supports (color:color-mix(in lab,red,red)){.border-chip-purple-border\/50{border-color:color-mix(in oklab,var(--chip-purple-border) 50%,transparent)}}.border-chip-sky-border{border-color:var(--chip-sky-border)}.border-emerald-300\/50{border-color:#5ee9b580}@supports (color:color-mix(in lab,red,red)){.border-emerald-300\/50{border-color:color-mix(in oklab,var(--color-emerald-300) 50%,transparent)}}.border-emerald-500\/30{border-color:#00bb7f4d}@supports (color:color-mix(in lab,red,red)){.border-emerald-500\/30{border-color:color-mix(in oklab,var(--color-emerald-500) 30%,transparent)}}.border-frame-line{border-color:var(--app-frame-border)}.border-indigo-400{border-color:var(--color-indigo-400)}.border-indigo-400\/80{border-color:#7d87ffcc}@supports (color:color-mix(in lab,red,red)){.border-indigo-400\/80{border-color:color-mix(in oklab,var(--color-indigo-400) 80%,transparent)}}.border-indigo-600{border-color:var(--color-indigo-600)}.border-line,.border-line\/40{border-color:var(--app-border)}@supports (color:color-mix(in lab,red,red)){.border-line\/40{border-color:color-mix(in oklab,var(--app-border) 40%,transparent)}}.border-line\/60{border-color:var(--app-border)}@supports (color:color-mix(in lab,red,red)){.border-line\/60{border-color:color-mix(in oklab,var(--app-border) 60%,transparent)}}.border-slate-500\/30{border-color:#62748e4d}@supports (color:color-mix(in lab,red,red)){.border-slate-500\/30{border-color:color-mix(in oklab,var(--color-slate-500) 30%,transparent)}}.border-status-danger-border{border-color:var(--status-danger-border)}.border-status-success-border{border-color:var(--status-success-border)}.border-status-warning-border{border-color:var(--status-warning-border)}.border-transparent{border-color:#0000}.border-t-transparent{border-top-color:#0000}.border-l-transparent{border-left-color:#0000}.bg-\[var\(--app-editor-bg\)\]{background-color:var(--app-editor-bg)}.bg-app,.bg-app\/90{background-color:var(--app-bg)}@supports (color:color-mix(in lab,red,red)){.bg-app\/90{background-color:color-mix(in oklab,var(--app-bg) 90%,transparent)}}.bg-black{background-color:var(--color-black)}.bg-black\/20{background-color:#0003}@supports (color:color-mix(in lab,red,red)){.bg-black\/20{background-color:color-mix(in oklab,var(--color-black) 20%,transparent)}}.bg-black\/60{background-color:#0009}@supports (color:color-mix(in lab,red,red)){.bg-black\/60{background-color:color-mix(in oklab,var(--color-black) 60%,transparent)}}.bg-black\/65{background-color:#000000a6}@supports (color:color-mix(in lab,red,red)){.bg-black\/65{background-color:color-mix(in oklab,var(--color-black) 65%,transparent)}}.bg-black\/70{background-color:#000000b3}@supports (color:color-mix(in lab,red,red)){.bg-black\/70{background-color:color-mix(in oklab,var(--color-black) 70%,transparent)}}.bg-chip-amber-bg{background-color:var(--chip-amber-bg)}.bg-chip-fuchsia-bg{background-color:var(--chip-fuchsia-bg)}.bg-chip-indigo-bg,.bg-chip-indigo-bg\/20{background-color:var(--chip-indigo-bg)}@supports (color:color-mix(in lab,red,red)){.bg-chip-indigo-bg\/20{background-color:color-mix(in oklab,var(--chip-indigo-bg) 20%,transparent)}}.bg-chip-purple-bg{background-color:var(--chip-purple-bg)}.bg-chip-sky-bg{background-color:var(--chip-sky-bg)}.bg-elevated,.bg-elevated\/30{background-color:var(--app-elevated)}@supports (color:color-mix(in lab,red,red)){.bg-elevated\/30{background-color:color-mix(in oklab,var(--app-elevated) 30%,transparent)}}.bg-elevated\/50{background-color:var(--app-elevated)}@supports (color:color-mix(in lab,red,red)){.bg-elevated\/50{background-color:color-mix(in oklab,var(--app-elevated) 50%,transparent)}}.bg-elevated\/60{background-color:var(--app-elevated)}@supports (color:color-mix(in lab,red,red)){.bg-elevated\/60{background-color:color-mix(in oklab,var(--app-elevated) 60%,transparent)}}.bg-emerald-400{background-color:var(--color-emerald-400)}.bg-emerald-500{background-color:var(--color-emerald-500)}.bg-emerald-600{background-color:var(--color-emerald-600)}.bg-emerald-800\/60{background-color:#005f4699}@supports (color:color-mix(in lab,red,red)){.bg-emerald-800\/60{background-color:color-mix(in oklab,var(--color-emerald-800) 60%,transparent)}}.bg-indigo-500\/5{background-color:#625fff0d}@supports (color:color-mix(in lab,red,red)){.bg-indigo-500\/5{background-color:color-mix(in oklab,var(--color-indigo-500) 5%,transparent)}}.bg-indigo-600{background-color:var(--color-indigo-600)}.bg-ink-faint{background-color:var(--app-text-faint)}.bg-slate-600\/20{background-color:#45556c33}@supports (color:color-mix(in lab,red,red)){.bg-slate-600\/20{background-color:color-mix(in oklab,var(--color-slate-600) 20%,transparent)}}.bg-status-danger-bg,.bg-status-danger-bg\/30{background-color:var(--status-danger-bg)}@supports (color:color-mix(in lab,red,red)){.bg-status-danger-bg\/30{background-color:color-mix(in oklab,var(--status-danger-bg) 30%,transparent)}}.bg-status-danger-bg\/40{background-color:var(--status-danger-bg)}@supports (color:color-mix(in lab,red,red)){.bg-status-danger-bg\/40{background-color:color-mix(in oklab,var(--status-danger-bg) 40%,transparent)}}.bg-status-success-bg{background-color:var(--status-success-bg)}.bg-status-warning-bg{background-color:var(--status-warning-bg)}.bg-surface{background-color:var(--app-surface)}.bg-surface-glass{background-color:var(--app-glass)}.bg-surface-strong,.bg-surface-strong\/20{background-color:var(--app-glass-strong)}@supports (color:color-mix(in lab,red,red)){.bg-surface-strong\/20{background-color:color-mix(in oklab,var(--app-glass-strong) 20%,transparent)}}.bg-surface-strong\/30{background-color:var(--app-glass-strong)}@supports (color:color-mix(in lab,red,red)){.bg-surface-strong\/30{background-color:color-mix(in oklab,var(--app-glass-strong) 30%,transparent)}}.bg-surface\/50{background-color:var(--app-surface)}@supports (color:color-mix(in lab,red,red)){.bg-surface\/50{background-color:color-mix(in oklab,var(--app-surface) 50%,transparent)}}.bg-surface\/60{background-color:var(--app-surface)}@supports (color:color-mix(in lab,red,red)){.bg-surface\/60{background-color:color-mix(in oklab,var(--app-surface) 60%,transparent)}}.bg-white{background-color:var(--color-white)}.bg-white\/90{background-color:#ffffffe6}@supports (color:color-mix(in lab,red,red)){.bg-white\/90{background-color:color-mix(in oklab,var(--color-white) 90%,transparent)}}.bg-gradient-to-b{--tw-gradient-position:to bottom in oklab;background-image:linear-gradient(var(--tw-gradient-stops))}.bg-gradient-to-br{--tw-gradient-position:to bottom right in oklab;background-image:linear-gradient(var(--tw-gradient-stops))}.from-chip-indigo-bg{--tw-gradient-from:var(--chip-indigo-bg);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-emerald-400\/90{--tw-gradient-from:#00d294e6}@supports (color:color-mix(in lab,red,red)){.from-emerald-400\/90{--tw-gradient-from:color-mix(in oklab, var(--color-emerald-400) 90%, transparent)}}.from-emerald-400\/90{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-chip-purple-bg{--tw-gradient-to:var(--chip-purple-bg);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-emerald-600\/90{--tw-gradient-to:#009767e6}@supports (color:color-mix(in lab,red,red)){.to-emerald-600\/90{--tw-gradient-to:color-mix(in oklab, var(--color-emerald-600) 90%, transparent)}}.to-emerald-600\/90{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.fill-current{fill:currentColor}.object-contain{object-fit:contain}.object-cover{object-fit:cover}.p-0\.5{padding:calc(var(--spacing) * .5)}.p-1{padding:var(--spacing)}.p-1\.5{padding:calc(var(--spacing) * 1.5)}.p-2{padding:calc(var(--spacing) * 2)}.p-3{padding:calc(var(--spacing) * 3)}.p-4{padding:calc(var(--spacing) * 4)}.p-5{padding:calc(var(--spacing) * 5)}.p-6{padding:calc(var(--spacing) * 6)}.p-8{padding:calc(var(--spacing) * 8)}.px-1{padding-inline:var(--spacing)}.px-1\.5{padding-inline:calc(var(--spacing) * 1.5)}.px-2{padding-inline:calc(var(--spacing) * 2)}.px-2\.5{padding-inline:calc(var(--spacing) * 2.5)}.px-3{padding-inline:calc(var(--spacing) * 3)}.px-3\.5{padding-inline:calc(var(--spacing) * 3.5)}.px-4{padding-inline:calc(var(--spacing) * 4)}.px-5{padding-inline:calc(var(--spacing) * 5)}.px-6{padding-inline:calc(var(--spacing) * 6)}.px-8{padding-inline:calc(var(--spacing) * 8)}.py-0\.5{padding-block:calc(var(--spacing) * .5)}.py-1{padding-block:var(--spacing)}.py-1\.5{padding-block:calc(var(--spacing) * 1.5)}.py-2{padding-block:calc(var(--spacing) * 2)}.py-2\.5{padding-block:calc(var(--spacing) * 2.5)}.py-3{padding-block:calc(var(--spacing) * 3)}.py-3\.5{padding-block:calc(var(--spacing) * 3.5)}.py-4{padding-block:calc(var(--spacing) * 4)}.py-6{padding-block:calc(var(--spacing) * 6)}.py-8{padding-block:calc(var(--spacing) * 8)}.py-px{padding-block:1px}.pt-2{padding-top:calc(var(--spacing) * 2)}.pt-3{padding-top:calc(var(--spacing) * 3)}.pt-4{padding-top:calc(var(--spacing) * 4)}.pr-1{padding-right:var(--spacing)}.pr-2\.5{padding-right:calc(var(--spacing) * 2.5)}.pr-3{padding-right:calc(var(--spacing) * 3)}.pr-8{padding-right:calc(var(--spacing) * 8)}.pr-10{padding-right:calc(var(--spacing) * 10)}.pb-3{padding-bottom:calc(var(--spacing) * 3)}.pb-4{padding-bottom:calc(var(--spacing) * 4)}.pl-3{padding-left:calc(var(--spacing) * 3)}.pl-5{padding-left:calc(var(--spacing) * 5)}.pl-8{padding-left:calc(var(--spacing) * 8)}.pl-9{padding-left:calc(var(--spacing) * 9)}.text-center{text-align:center}.text-left{text-align:left}.align-\[1px\]{vertical-align:1px}.align-top{vertical-align:top}.font-mono{font-family:var(--font-mono)}.font-sans{font-family:var(--font-sans)}.text-base{font-size:var(--text-base);line-height:var(--tw-leading,var(--text-base--line-height))}.text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.text-xs{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.text-\[10px\]{font-size:10px}.text-\[11px\]{font-size:11px}.leading-5{--tw-leading:calc(var(--spacing) * 5);line-height:calc(var(--spacing) * 5)}.leading-none{--tw-leading:1;line-height:1}.leading-relaxed{--tw-leading:var(--leading-relaxed);line-height:var(--leading-relaxed)}.font-bold{--tw-font-weight:var(--font-weight-bold);font-weight:var(--font-weight-bold)}.font-medium{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.font-normal{--tw-font-weight:var(--font-weight-normal);font-weight:var(--font-weight-normal)}.font-semibold{--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.tracking-tight{--tw-tracking:var(--tracking-tight);letter-spacing:var(--tracking-tight)}.tracking-wide{--tw-tracking:var(--tracking-wide);letter-spacing:var(--tracking-wide)}.tracking-wider{--tw-tracking:var(--tracking-wider);letter-spacing:var(--tracking-wider)}.break-words{overflow-wrap:break-word}.break-all{word-break:break-all}.whitespace-nowrap{white-space:nowrap}.whitespace-pre-line{white-space:pre-line}.whitespace-pre-wrap{white-space:pre-wrap}.text-chip-amber-text{color:var(--chip-amber-text)}.text-chip-fuchsia-text{color:var(--chip-fuchsia-text)}.text-chip-indigo-text{color:var(--chip-indigo-text)}.text-chip-purple-text{color:var(--chip-purple-text)}.text-chip-sky-text{color:var(--chip-sky-text)}.text-emerald-200{color:var(--color-emerald-200)}.text-ink{color:var(--app-text-primary)}.text-ink-faint{color:var(--app-text-faint)}.text-ink-muted,.text-ink-muted\/50{color:var(--app-text-muted)}@supports (color:color-mix(in lab,red,red)){.text-ink-muted\/50{color:color-mix(in oklab,var(--app-text-muted) 50%,transparent)}}.text-ink-secondary{color:var(--app-text-secondary)}.text-ink\/70{color:var(--app-text-primary)}@supports (color:color-mix(in lab,red,red)){.text-ink\/70{color:color-mix(in oklab,var(--app-text-primary) 70%,transparent)}}.text-slate-300{color:var(--color-slate-300)}.text-slate-400{color:var(--color-slate-400)}.text-slate-900{color:var(--color-slate-900)}.text-status-danger-text,.text-status-danger-text\/60{color:var(--status-danger-text)}@supports (color:color-mix(in lab,red,red)){.text-status-danger-text\/60{color:color-mix(in oklab,var(--status-danger-text) 60%,transparent)}}.text-status-danger-text\/70{color:var(--status-danger-text)}@supports (color:color-mix(in lab,red,red)){.text-status-danger-text\/70{color:color-mix(in oklab,var(--status-danger-text) 70%,transparent)}}.text-status-danger-text\/80{color:var(--status-danger-text)}@supports (color:color-mix(in lab,red,red)){.text-status-danger-text\/80{color:color-mix(in oklab,var(--status-danger-text) 80%,transparent)}}.text-status-danger-text\/90{color:var(--status-danger-text)}@supports (color:color-mix(in lab,red,red)){.text-status-danger-text\/90{color:color-mix(in oklab,var(--status-danger-text) 90%,transparent)}}.text-status-success-text{color:var(--status-success-text)}.text-status-warning-text{color:var(--status-warning-text)}.text-white{color:var(--color-white)}.lowercase{text-transform:lowercase}.uppercase{text-transform:uppercase}.italic{font-style:italic}.not-italic{font-style:normal}.tabular-nums{--tw-numeric-spacing:tabular-nums;font-variant-numeric:var(--tw-ordinal,) var(--tw-slashed-zero,) var(--tw-numeric-figure,) var(--tw-numeric-spacing,) var(--tw-numeric-fraction,)}.line-through{text-decoration-line:line-through}.underline{text-decoration-line:underline}.underline-offset-2{text-underline-offset:2px}.antialiased{-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.placeholder-ink-faint::placeholder{color:var(--app-text-faint)}.opacity-0{opacity:0}.opacity-40{opacity:.4}.opacity-90{opacity:.9}.opacity-100{opacity:1}.shadow{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a), 0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-2xl{--tw-shadow:0 25px 50px -12px var(--tw-shadow-color,#00000040);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-\[0_0_0_9999px_rgba\(0\,0\,0\,0\.45\)\]{--tw-shadow:0 0 0 9999px var(--tw-shadow-color,#00000073);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-\[0_2px_6px_rgb\(0_0_0\/0\.35\)\]{--tw-shadow:0 2px 6px var(--tw-shadow-color,#00000059);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-\[inset_0_1px_0_rgb\(255_255_255\/0\.12\)\]{--tw-shadow:inset 0 1px 0 var(--tw-shadow-color,#ffffff1f);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-\[inset_0_1px_0_rgb\(255_255_255\/0\.35\)\,0_8px_24px_-6px_rgb\(16_185_129\/0\.55\)\]{--tw-shadow:inset 0 1px 0 var(--tw-shadow-color,#ffffff59), 0 8px 24px -6px var(--tw-shadow-color,#10b9818c);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-lg{--tw-shadow:0 10px 15px -3px var(--tw-shadow-color,#0000001a), 0 4px 6px -4px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-md{--tw-shadow:0 4px 6px -1px var(--tw-shadow-color,#0000001a), 0 2px 4px -2px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-sm{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a), 0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-xl{--tw-shadow:0 20px 25px -5px var(--tw-shadow-color,#0000001a), 0 8px 10px -6px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-xs{--tw-shadow:0 1px 2px 0 var(--tw-shadow-color,#0000000d);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.ring-1{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.ring-2{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.ring-app{--tw-ring-color:var(--app-bg)}.ring-chip-indigo-border\/40{--tw-ring-color:var(--chip-indigo-border)}@supports (color:color-mix(in lab,red,red)){.ring-chip-indigo-border\/40{--tw-ring-color:color-mix(in oklab, var(--chip-indigo-border) 40%, transparent)}}.outline{outline-style:var(--tw-outline-style);outline-width:1px}.blur{--tw-blur:blur(8px);filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.filter{filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.filter\!{filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)!important}.backdrop-blur-md{--tw-backdrop-blur:blur(var(--blur-md));-webkit-backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,)}.backdrop-blur-sm{--tw-backdrop-blur:blur(var(--blur-sm));-webkit-backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,)}.backdrop-blur-xl{--tw-backdrop-blur:blur(var(--blur-xl));-webkit-backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,)}.backdrop-blur-xs{--tw-backdrop-blur:blur(var(--blur-xs));-webkit-backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,)}.transition{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to,opacity,box-shadow,transform,translate,scale,rotate,filter,-webkit-backdrop-filter,backdrop-filter,display,content-visibility,overlay,pointer-events;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-\[filter\,box-shadow\,transform\]{transition-property:filter,box-shadow,transform;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-all{transition-property:all;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-colors{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-opacity{transition-property:opacity;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-transform{transition-property:transform,translate,scale,rotate;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.duration-200{--tw-duration:.2s;transition-duration:.2s}.outline-none{--tw-outline-style:none;outline-style:none}.select-none{-webkit-user-select:none;user-select:none}@media(hover:hover){.group-hover\:text-white:is(:where(.group):hover *){color:var(--color-white)}.group-hover\:opacity-40:is(:where(.group):hover *){opacity:.4}.group-hover\:opacity-100:is(:where(.group):hover *){opacity:1}}.selection\:bg-indigo-500 ::selection{background-color:var(--color-indigo-500)}.selection\:bg-indigo-500::selection{background-color:var(--color-indigo-500)}.selection\:text-white ::selection{color:var(--color-white)}.selection\:text-white::selection{color:var(--color-white)}.placeholder\:text-ink-faint::placeholder{color:var(--app-text-faint)}.first\:mt-0:first-child{margin-top:0}.last\:mb-0:last-child{margin-bottom:0}@media(hover:hover){.hover\:-translate-y-px:hover{--tw-translate-y:-1px;translate:var(--tw-translate-x) var(--tw-translate-y)}.hover\:border-chip-indigo-border:hover{border-color:var(--chip-indigo-border)}.hover\:border-indigo-400:hover{border-color:var(--color-indigo-400)}.hover\:border-indigo-500:hover{border-color:var(--color-indigo-500)}.hover\:border-status-warning-border:hover{border-color:var(--status-warning-border)}.hover\:bg-chip-indigo-bg\/40:hover{background-color:var(--chip-indigo-bg)}@supports (color:color-mix(in lab,red,red)){.hover\:bg-chip-indigo-bg\/40:hover{background-color:color-mix(in oklab,var(--chip-indigo-bg) 40%,transparent)}}.hover\:bg-elevated:hover,.hover\:bg-elevated\/50:hover{background-color:var(--app-elevated)}@supports (color:color-mix(in lab,red,red)){.hover\:bg-elevated\/50:hover{background-color:color-mix(in oklab,var(--app-elevated) 50%,transparent)}}.hover\:bg-elevated\/60:hover{background-color:var(--app-elevated)}@supports (color:color-mix(in lab,red,red)){.hover\:bg-elevated\/60:hover{background-color:color-mix(in oklab,var(--app-elevated) 60%,transparent)}}.hover\:bg-elevated\/70:hover{background-color:var(--app-elevated)}@supports (color:color-mix(in lab,red,red)){.hover\:bg-elevated\/70:hover{background-color:color-mix(in oklab,var(--app-elevated) 70%,transparent)}}.hover\:bg-elevated\/80:hover{background-color:var(--app-elevated)}@supports (color:color-mix(in lab,red,red)){.hover\:bg-elevated\/80:hover{background-color:color-mix(in oklab,var(--app-elevated) 80%,transparent)}}.hover\:bg-emerald-500:hover{background-color:var(--color-emerald-500)}.hover\:bg-hover-surface:hover{background-color:var(--app-hover)}.hover\:bg-indigo-500:hover{background-color:var(--color-indigo-500)}.hover\:bg-indigo-600:hover{background-color:var(--color-indigo-600)}.hover\:bg-status-danger-bg:hover,.hover\:bg-status-danger-bg\/60:hover{background-color:var(--status-danger-bg)}@supports (color:color-mix(in lab,red,red)){.hover\:bg-status-danger-bg\/60:hover{background-color:color-mix(in oklab,var(--status-danger-bg) 60%,transparent)}}.hover\:bg-status-warning-bg:hover,.hover\:bg-status-warning-bg\/40:hover{background-color:var(--status-warning-bg)}@supports (color:color-mix(in lab,red,red)){.hover\:bg-status-warning-bg\/40:hover{background-color:color-mix(in oklab,var(--status-warning-bg) 40%,transparent)}}.hover\:bg-surface:hover{background-color:var(--app-surface)}.hover\:bg-surface-strong:hover{background-color:var(--app-glass-strong)}.hover\:bg-white:hover{background-color:var(--color-white)}.hover\:text-chip-indigo-text:hover{color:var(--chip-indigo-text)}.hover\:text-ink:hover{color:var(--app-text-primary)}.hover\:text-status-danger-text:hover{color:var(--status-danger-text)}.hover\:text-status-warning-text:hover{color:var(--status-warning-text)}.hover\:text-white:hover{color:var(--color-white)}.hover\:underline:hover{text-decoration-line:underline}.hover\:opacity-40:hover{opacity:.4}.hover\:shadow-\[inset_0_1px_0_rgb\(255_255_255\/0\.35\)\,0_12px_30px_-6px_rgb\(16_185_129\/0\.7\)\]:hover{--tw-shadow:inset 0 1px 0 var(--tw-shadow-color,#ffffff59), 0 12px 30px -6px var(--tw-shadow-color,#10b981b3);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.hover\:brightness-95:hover{--tw-brightness:brightness(95%);filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.hover\:brightness-110:hover{--tw-brightness:brightness(110%);filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}}.focus\:border-indigo-500:focus{border-color:var(--color-indigo-500)}.focus\:ring-2:focus{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.focus\:ring-indigo-500:focus{--tw-ring-color:var(--color-indigo-500)}.focus\:outline-none:focus{--tw-outline-style:none;outline-style:none}.focus-visible\:z-10:focus-visible{z-index:10}.focus-visible\:border-indigo-400:focus-visible{border-color:var(--color-indigo-400)}.focus-visible\:border-indigo-500:focus-visible{border-color:var(--color-indigo-500)}.focus-visible\:ring-2:focus-visible{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.focus-visible\:ring-emerald-400:focus-visible{--tw-ring-color:var(--color-emerald-400)}.focus-visible\:ring-indigo-400:focus-visible{--tw-ring-color:var(--color-indigo-400)}.focus-visible\:ring-indigo-500:focus-visible{--tw-ring-color:var(--color-indigo-500)}.focus-visible\:ring-indigo-500\/30:focus-visible{--tw-ring-color:#625fff4d}@supports (color:color-mix(in lab,red,red)){.focus-visible\:ring-indigo-500\/30:focus-visible{--tw-ring-color:color-mix(in oklab, var(--color-indigo-500) 30%, transparent)}}.focus-visible\:ring-status-danger-border:focus-visible{--tw-ring-color:var(--status-danger-border)}.focus-visible\:ring-offset-1:focus-visible{--tw-ring-offset-width:1px;--tw-ring-offset-shadow:var(--tw-ring-inset,) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color)}.focus-visible\:ring-offset-app:focus-visible{--tw-ring-offset-color:var(--app-bg)}.focus-visible\:outline:focus-visible{outline-style:var(--tw-outline-style);outline-width:1px}.focus-visible\:outline-2:focus-visible{outline-style:var(--tw-outline-style);outline-width:2px}.focus-visible\:outline-offset-\[-2px\]:focus-visible{outline-offset:-2px}.focus-visible\:outline-indigo-500:focus-visible{outline-color:var(--color-indigo-500)}.focus-visible\:outline-none:focus-visible{--tw-outline-style:none;outline-style:none}.focus-visible\:ring-inset:focus-visible{--tw-ring-inset:inset}.active\:scale-95:active{--tw-scale-x:95%;--tw-scale-y:95%;--tw-scale-z:95%;scale:var(--tw-scale-x) var(--tw-scale-y)}.disabled\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\:opacity-40:disabled{opacity:.4}.disabled\:opacity-50:disabled{opacity:.5}@media(hover:hover){.disabled\:hover\:translate-y-0:disabled:hover{--tw-translate-y:0px;translate:var(--tw-translate-x) var(--tw-translate-y)}.disabled\:hover\:text-ink-muted:disabled:hover{color:var(--app-text-muted)}.disabled\:hover\:shadow-\[inset_0_1px_0_rgb\(255_255_255\/0\.35\)\,0_8px_24px_-6px_rgb\(16_185_129\/0\.55\)\]:disabled:hover{--tw-shadow:inset 0 1px 0 var(--tw-shadow-color,#ffffff59), 0 8px 24px -6px var(--tw-shadow-color,#10b9818c);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.disabled\:hover\:brightness-100:disabled:hover{--tw-brightness:brightness(100%);filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}}@media(prefers-reduced-motion:reduce){.motion-reduce\:animate-none{animation:none}}@media(min-width:40rem){.sm\:inline{display:inline}.sm\:basis-auto{flex-basis:auto}.sm\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.sm\:flex-row{flex-direction:row}.sm\:items-center{align-items:center}.sm\:justify-between{justify-content:space-between}.sm\:rounded-2xl{border-radius:var(--radius-2xl)}.sm\:rounded-xl{border-radius:var(--radius-xl)}.sm\:p-1\.5{padding:calc(var(--spacing) * 1.5)}.sm\:p-4{padding:calc(var(--spacing) * 4)}.sm\:p-6{padding:calc(var(--spacing) * 6)}.sm\:px-3{padding-inline:calc(var(--spacing) * 3)}.sm\:px-5{padding-inline:calc(var(--spacing) * 5)}.sm\:px-6{padding-inline:calc(var(--spacing) * 6)}.sm\:py-3{padding-block:calc(var(--spacing) * 3)}}@media(min-width:64rem){.lg\:flex{display:flex}}.\[\&_code\]\:bg-transparent code{background-color:#0000}.\[\&_code\]\:px-0 code{padding-inline:0}.\[\&_code\]\:py-0 code{padding-block:0}.\[\&_code\]\:text-inherit code{color:inherit}.animate-modal-in{animation:.15s cubic-bezier(.2,.8,.2,1) modal-in}.animate-overlay-in{animation:.15s ease-out overlay-in}.animate-toast-in{animation:.12s ease-out toast-in}}:where(button,[role=button],input,select,textarea,a,summary,video[tabindex],[tabindex]):focus-visible{outline:2px solid var(--color-indigo-500,#6366f1);outline-offset:2px}:root{color-scheme:light dark;--z-combobox-list:60;--z-syntax-helper:65;--z-context-menu:70;--z-modal:80;--z-drop-overlay:85;--z-toast:90;--z-tooltip:100}:root,[data-theme=dark]{--app-bg:#020617;--app-surface:#0f172a;--app-elevated:#1e293b;--app-hover:#334155;--app-border:#334155;--app-frame-border:#94a3b84d;--app-text-primary:#f8fafc;--app-text-secondary:#cbd5e1;--app-text-muted:#94a3b8;--app-text-faint:#94a3b8;--app-glass:#0f172a99;--app-glass-strong:#020617e6;--app-glass-panel:#0f172ac7;--app-glass-panel-strong:#020617e0;--app-glass-highlight:#ffffff17;--app-panel-shadow:0 24px 60px -12px #0206178c;--app-editor-bg:#1e1e1e;--app-editor-gutter-bg:#181818;--app-editor-active-line:#282828;--app-editor-selection:#6366f14d;--app-editor-border:#34343e;color-scheme:dark;--chip-indigo-bg:#6366f140;--chip-indigo-border:#818cf880;--chip-indigo-text:#c7d2fe;--chip-purple-bg:#a855f740;--chip-purple-border:#c084fc80;--chip-purple-text:#f3e8ff;--chip-fuchsia-bg:#c026d340;--chip-fuchsia-border:#e879f980;--chip-fuchsia-text:#f5d0fe;--chip-sky-bg:#0ea5e940;--chip-sky-border:#38bdf880;--chip-sky-text:#bae6fd;--chip-amber-bg:#f59e0b40;--chip-amber-border:#fbbf2480;--chip-amber-text:#fde68a;--status-success-bg:#10b98140;--status-success-border:#34d39980;--status-success-text:#a7f3d0;--status-warning-bg:#f59e0b40;--status-warning-border:#fbbf2480;--status-warning-text:#fde68a;--status-danger-bg:#f43f5e40;--status-danger-border:#fb718580;--status-danger-text:#fecdd3}[data-theme=light]{--chip-indigo-bg:#e0e7ff;--chip-indigo-border:#a5b4fc;--chip-indigo-text:#3730a3;--chip-purple-bg:#f3e8ff;--chip-purple-border:#d8b4fe;--chip-purple-text:#6b21a8;--chip-fuchsia-bg:#fae8ff;--chip-fuchsia-border:#f0abfc;--chip-fuchsia-text:#86198f;--chip-sky-bg:#e0f2fe;--chip-sky-border:#7dd3fc;--chip-sky-text:#0369a1;--chip-amber-bg:#fef3c7;--chip-amber-border:#fcd34d;--chip-amber-text:#92400e;--status-success-bg:#d1fae5;--status-success-border:#6ee7b7;--status-success-text:#065f46;--status-warning-bg:#fef3c7;--status-warning-border:#fcd34d;--status-warning-text:#92400e;--status-danger-bg:#ffe4e6;--status-danger-border:#fda4af;--status-danger-text:#9f1239;--app-bg:#f8fafc;--app-surface:#fff;--app-elevated:#f1f5f9;--app-hover:#e2e8f0;--app-border:#cbd5e1;--app-frame-border:#0f172a29;--app-text-primary:#0f172a;--app-text-secondary:#334155;--app-text-muted:#475569;--app-text-faint:#475569;--app-glass:#ffffffb3;--app-glass-strong:#f8fafcf2;--app-glass-panel:#fffc;--app-glass-panel-strong:#f8fafceb;--app-glass-highlight:#ffffffe6;--app-panel-shadow:0 24px 60px -18px #0f172a47;--app-editor-bg:#fff;--app-editor-gutter-bg:#f8fafc;--app-editor-active-line:#f1f5f9;--app-editor-selection:#6366f129;--app-editor-border:#e2e8f0;color-scheme:light}body{background-color:var(--app-bg);min-height:100vh;color:var(--app-text-primary);margin:0;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica,Arial,sans-serif;transition:background-color .2s,color .2s}@media(prefers-reduced-motion:reduce){*,:before,:after{scroll-behavior:auto!important;transition-duration:.01ms!important;animation-duration:.01ms!important;animation-iteration-count:1!important}}@keyframes modal-in{0%{opacity:0;transform:translateY(4px)scale(.995)}to{opacity:1;transform:none}}@keyframes overlay-in{0%{opacity:0}to{opacity:1}}@keyframes toast-in{0%{opacity:0;translate:-50% calc(6px - 50%)}to{opacity:1;translate:-50% -50%}}*{scrollbar-color:var(--app-border) transparent;scrollbar-width:thin}::-webkit-scrollbar{width:10px;height:10px}::-webkit-scrollbar-track{background:0 0}::-webkit-scrollbar-thumb{background-color:var(--app-border);background-clip:content-box;border:2px solid #0000;border-radius:9999px}::-webkit-scrollbar-thumb:hover{background-color:var(--app-text-faint)}@property --tw-translate-x{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-y{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-z{syntax:"*";inherits:false;initial-value:0}@property --tw-rotate-x{syntax:"*";inherits:false}@property --tw-rotate-y{syntax:"*";inherits:false}@property --tw-rotate-z{syntax:"*";inherits:false}@property --tw-skew-x{syntax:"*";inherits:false}@property --tw-skew-y{syntax:"*";inherits:false}@property --tw-space-y-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-gradient-position{syntax:"*";inherits:false}@property --tw-gradient-from{syntax:"";inherits:false;initial-value:#0000}@property --tw-gradient-via{syntax:"";inherits:false;initial-value:#0000}@property --tw-gradient-to{syntax:"";inherits:false;initial-value:#0000}@property --tw-gradient-stops{syntax:"*";inherits:false}@property --tw-gradient-via-stops{syntax:"*";inherits:false}@property --tw-gradient-from-position{syntax:"";inherits:false;initial-value:0%}@property --tw-gradient-via-position{syntax:"";inherits:false;initial-value:50%}@property --tw-gradient-to-position{syntax:"";inherits:false;initial-value:100%}@property --tw-leading{syntax:"*";inherits:false}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-tracking{syntax:"*";inherits:false}@property --tw-ordinal{syntax:"*";inherits:false}@property --tw-slashed-zero{syntax:"*";inherits:false}@property --tw-numeric-figure{syntax:"*";inherits:false}@property --tw-numeric-spacing{syntax:"*";inherits:false}@property --tw-numeric-fraction{syntax:"*";inherits:false}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-outline-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-blur{syntax:"*";inherits:false}@property --tw-brightness{syntax:"*";inherits:false}@property --tw-contrast{syntax:"*";inherits:false}@property --tw-grayscale{syntax:"*";inherits:false}@property --tw-hue-rotate{syntax:"*";inherits:false}@property --tw-invert{syntax:"*";inherits:false}@property --tw-opacity{syntax:"*";inherits:false}@property --tw-saturate{syntax:"*";inherits:false}@property --tw-sepia{syntax:"*";inherits:false}@property --tw-drop-shadow{syntax:"*";inherits:false}@property --tw-drop-shadow-color{syntax:"*";inherits:false}@property --tw-drop-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-drop-shadow-size{syntax:"*";inherits:false}@property --tw-backdrop-blur{syntax:"*";inherits:false}@property --tw-backdrop-brightness{syntax:"*";inherits:false}@property --tw-backdrop-contrast{syntax:"*";inherits:false}@property --tw-backdrop-grayscale{syntax:"*";inherits:false}@property --tw-backdrop-hue-rotate{syntax:"*";inherits:false}@property --tw-backdrop-invert{syntax:"*";inherits:false}@property --tw-backdrop-opacity{syntax:"*";inherits:false}@property --tw-backdrop-saturate{syntax:"*";inherits:false}@property --tw-backdrop-sepia{syntax:"*";inherits:false}@property --tw-duration{syntax:"*";inherits:false}@property --tw-scale-x{syntax:"*";inherits:false;initial-value:1}@property --tw-scale-y{syntax:"*";inherits:false;initial-value:1}@property --tw-scale-z{syntax:"*";inherits:false;initial-value:1}@keyframes spin{to{transform:rotate(360deg)}}@keyframes pulse{50%{opacity:.5}} diff --git a/src/profiles/web/dist/assets/index-D7fUv0zM.js b/src/profiles/web/dist/assets/index-D7fUv0zM.js deleted file mode 100644 index e8a600f..0000000 --- a/src/profiles/web/dist/assets/index-D7fUv0zM.js +++ /dev/null @@ -1,440 +0,0 @@ -var rM=Object.defineProperty;var lM=(n,e,t)=>e in n?rM(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t;var fh=(n,e,t)=>lM(n,typeof e!="symbol"?e+"":e,t);(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const l of document.querySelectorAll('link[rel="modulepreload"]'))i(l);new MutationObserver(l=>{for(const o of l)if(o.type==="childList")for(const a of o.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&i(a)}).observe(document,{childList:!0,subtree:!0});function t(l){const o={};return l.integrity&&(o.integrity=l.integrity),l.referrerPolicy&&(o.referrerPolicy=l.referrerPolicy),l.crossOrigin==="use-credentials"?o.credentials="include":l.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function i(l){if(l.ep)return;l.ep=!0;const o=t(l);fetch(l.href,o)}})();function hy(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var Ug={exports:{}},ju={};/** - * @license React - * react-jsx-runtime.production.js - * - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */var kk;function sM(){if(kk)return ju;kk=1;var n=Symbol.for("react.transitional.element"),e=Symbol.for("react.fragment");function t(i,l,o){var a=null;if(o!==void 0&&(a=""+o),l.key!==void 0&&(a=""+l.key),"key"in l){o={};for(var c in l)c!=="key"&&(o[c]=l[c])}else o=l;return l=o.ref,{$$typeof:n,type:i,key:a,ref:l!==void 0?l:null,props:o}}return ju.Fragment=e,ju.jsx=t,ju.jsxs=t,ju}var Sk;function oM(){return Sk||(Sk=1,Ug.exports=sM()),Ug.exports}var y=oM(),Fg={exports:{}},Fe={};/** - * @license React - * react.production.js - * - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */var Ck;function aM(){if(Ck)return Fe;Ck=1;var n=Symbol.for("react.transitional.element"),e=Symbol.for("react.portal"),t=Symbol.for("react.fragment"),i=Symbol.for("react.strict_mode"),l=Symbol.for("react.profiler"),o=Symbol.for("react.consumer"),a=Symbol.for("react.context"),c=Symbol.for("react.forward_ref"),f=Symbol.for("react.suspense"),d=Symbol.for("react.memo"),p=Symbol.for("react.lazy"),g=Symbol.for("react.activity"),b=Symbol.for("react.view_transition"),v=Symbol.iterator;function w(D){return D===null||typeof D!="object"?null:(D=v&&D[v]||D["@@iterator"],typeof D=="function"?D:null)}var S={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},C=Object.assign,O={};function j(D,X,fe){this.props=D,this.context=X,this.refs=O,this.updater=fe||S}j.prototype.isReactComponent={},j.prototype.setState=function(D,X){if(typeof D!="object"&&typeof D!="function"&&D!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,D,X,"setState")},j.prototype.forceUpdate=function(D){this.updater.enqueueForceUpdate(this,D,"forceUpdate")};function M(){}M.prototype=j.prototype;function H(D,X,fe){this.props=D,this.context=X,this.refs=O,this.updater=fe||S}var P=H.prototype=new M;P.constructor=H,C(P,j.prototype),P.isPureReactComponent=!0;var A=Array.isArray;function T(){}var z={H:null,A:null,T:null,S:null},ne=Object.prototype.hasOwnProperty;function F(D,X,fe){var pe=fe.ref;return{$$typeof:n,type:D,key:X,ref:pe!==void 0?pe:null,props:fe}}function W(D,X){return F(D.type,X,D.props)}function U(D){return typeof D=="object"&&D!==null&&D.$$typeof===n}function re(D){var X={"=":"=0",":":"=2"};return"$"+D.replace(/[=:]/g,function(fe){return X[fe]})}var de=/\/+/g;function ie(D,X){return typeof D=="object"&&D!==null&&D.key!=null?re(""+D.key):X.toString(36)}function L(D){switch(D.status){case"fulfilled":return D.value;case"rejected":throw D.reason;default:switch(typeof D.status=="string"?D.then(T,T):(D.status="pending",D.then(function(X){D.status==="pending"&&(D.status="fulfilled",D.value=X)},function(X){D.status==="pending"&&(D.status="rejected",D.reason=X)})),D.status){case"fulfilled":return D.value;case"rejected":throw D.reason}}throw D}function ee(D,X,fe,pe,Re){var Ne=typeof D;(Ne==="undefined"||Ne==="boolean")&&(D=null);var _e=!1;if(D===null)_e=!0;else switch(Ne){case"bigint":case"string":case"number":_e=!0;break;case"object":switch(D.$$typeof){case n:case e:_e=!0;break;case p:return _e=D._init,ee(_e(D._payload),X,fe,pe,Re)}}if(_e)return Re=Re(D),_e=pe===""?"."+ie(D,0):pe,A(Re)?(fe="",_e!=null&&(fe=_e.replace(de,"$&/")+"/"),ee(Re,X,fe,"",function(xe){return xe})):Re!=null&&(U(Re)&&(Re=W(Re,fe+(Re.key==null||D&&D.key===Re.key?"":(""+Re.key).replace(de,"$&/")+"/")+_e)),X.push(Re)),1;_e=0;var ve=pe===""?".":pe+":";if(A(D))for(var ce=0;ce>>1,E=L[le];if(0>>1;lel(B,se))Dl(X,B)?(L[le]=X,L[D]=se,le=D):(L[le]=B,L[je]=se,le=je);else if(Dl(X,se))L[le]=X,L[D]=se,le=D;else break e}}return ee}function l(L,ee){var se=L.sortIndex-ee.sortIndex;return se!==0?se:L.id-ee.id}if(n.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var o=performance;n.unstable_now=function(){return o.now()}}else{var a=Date,c=a.now();n.unstable_now=function(){return a.now()-c}}var f=[],d=[],p=1,g=null,b=3,v=!1,w=!1,S=!1,C=!1,O=typeof setTimeout=="function"?setTimeout:null,j=typeof clearTimeout=="function"?clearTimeout:null,M=typeof setImmediate<"u"?setImmediate:null;function H(L){for(var ee=t(d);ee!==null;){if(ee.callback===null)i(d);else if(ee.startTime<=L)i(d),ee.sortIndex=ee.expirationTime,e(f,ee);else break;ee=t(d)}}function P(L){if(S=!1,H(L),!w)if(t(f)!==null)w=!0,A||(A=!0,U());else{var ee=t(d);ee!==null&&ie(P,ee.startTime-L)}}var A=!1,T=-1,z=5,ne=-1;function F(){return C?!0:!(n.unstable_now()-neL&&F());){var le=g.callback;if(typeof le=="function"){g.callback=null,b=g.priorityLevel;var E=le(g.expirationTime<=L);if(L=n.unstable_now(),typeof E=="function"){g.callback=E,H(L),ee=!0;break t}g===t(f)&&i(f),H(L)}else i(f);g=t(f)}if(g!==null)ee=!0;else{var ze=t(d);ze!==null&&ie(P,ze.startTime-L),ee=!1}}break e}finally{g=null,b=se,v=!1}ee=void 0}}finally{ee?U():A=!1}}}var U;if(typeof M=="function")U=function(){M(W)};else if(typeof MessageChannel<"u"){var re=new MessageChannel,de=re.port2;re.port1.onmessage=W,U=function(){de.postMessage(null)}}else U=function(){O(W,0)};function ie(L,ee){T=O(function(){L(n.unstable_now())},ee)}n.unstable_IdlePriority=5,n.unstable_ImmediatePriority=1,n.unstable_LowPriority=4,n.unstable_NormalPriority=3,n.unstable_Profiling=null,n.unstable_UserBlockingPriority=2,n.unstable_cancelCallback=function(L){L.callback=null},n.unstable_forceFrameRate=function(L){0>L||125le?(L.sortIndex=se,e(d,L),t(f)===null&&L===t(d)&&(S?(j(T),T=-1):S=!0,ie(P,se-le))):(L.sortIndex=E,e(f,L),w||v||(w=!0,A||(A=!0,U()))),L},n.unstable_shouldYield=F,n.unstable_wrapCallback=function(L){var ee=b;return function(){var se=b;b=ee;try{return L.apply(this,arguments)}finally{b=se}}}})(Qg)),Qg}var Tk;function fM(){return Tk||(Tk=1,Vg.exports=cM()),Vg.exports}var Xg={exports:{}},Nn={};/** - * @license React - * react-dom.production.js - * - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */var Ak;function hM(){if(Ak)return Nn;Ak=1;var n=dy();function e(p){var g="https://react.dev/errors/"+p;if(1"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}return n(),Xg.exports=hM(),Xg.exports}/** - * @license React - * react-dom-client.production.js - * - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */var Mk;function dM(){if(Mk)return _u;Mk=1;var n=fM(),e=dy(),t=VC();function i(r){var s="https://react.dev/errors/"+r;if(1ot||(r.current=Ue[ot],Ue[ot]=null,ot--)}function Xe(r,s){ot++,Ue[ot]=r.current,r.current=s}var Ft=wt(null),Zn=wt(null),Un=wt(null),Rn=wt(null);function Se(r,s){switch(Xe(Un,s),Xe(Zn,r),Xe(Ft,null),s.nodeType){case 9:case 11:r=(r=s.documentElement)&&(r=r.namespaceURI)?Dw(r):0;break;default:if(r=s.tagName,s=s.namespaceURI)s=Dw(s),r=Rw(s,r);else switch(r){case"svg":r=1;break;case"math":r=2;break;default:r=0}}xt(Ft),Xe(Ft,r)}function Ve(){xt(Ft),xt(Zn),xt(Un)}function We(r){var s=r.memoizedState;s!==null&&(Jo._currentValue=s.memoizedState,Xe(Rn,r)),s=Ft.current;var u=Rw(s,r.type);s!==u&&(Xe(Zn,r),Xe(Ft,u))}function yt(r){Zn.current===r&&(xt(Ft),xt(Zn)),Rn.current===r&&(xt(Rn),Jo._currentValue=xe)}var J,he;function Ae(r){if(J===void 0)try{throw Error()}catch(u){var s=u.stack.trim().match(/\n( *(at )?)/);J=s&&s[1]||"",he=-1)":-1m||_[h]!==G[m]){var Z=` -`+_[h].replace(" at new "," at ");return r.displayName&&Z.includes("")&&(Z=Z.replace("",r.displayName)),Z}while(1<=h&&0<=m);break}}}finally{Pe=!1,Error.prepareStackTrace=u}return(u=r?r.displayName||r.name:"")?Ae(u):""}function ft(r,s){switch(r.tag){case 26:case 27:case 5:return Ae(r.type);case 16:return Ae("Lazy");case 13:return r.child!==s&&s!==null?Ae("Suspense Fallback"):Ae("Suspense");case 19:return Ae("SuspenseList");case 0:case 15:return qt(r.type,!1);case 11:return qt(r.type.render,!1);case 1:return qt(r.type,!0);case 31:return Ae("Activity");case 30:return Ae("ViewTransition");default:return""}}function jt(r){try{var s="",u=null;do s+=ft(r,u),u=r,r=r.return;while(r);return s}catch(h){return` -Error generating stack: `+h.message+` -`+h.stack}}var vn=Object.prototype.hasOwnProperty,Ti=n.unstable_scheduleCallback,qi=n.unstable_cancelCallback,sr=n.unstable_shouldYield,hs=n.unstable_requestPaint,Qt=n.unstable_now,Wt=n.unstable_getCurrentPriorityLevel,pi=n.unstable_ImmediatePriority,dn=n.unstable_UserBlockingPriority,uo=n.unstable_NormalPriority,co=n.unstable_LowPriority,fl=n.unstable_IdlePriority,ye=n.log,gp=n.unstable_setDisableYieldValue,ds=null,Pt=null;function kt(r){if(typeof ye=="function"&&gp(r),Pt&&typeof Pt.setStrictMode=="function")try{Pt.setStrictMode(ds,r)}catch{}}var _t=Math.clz32?Math.clz32:xp,Jn=Math.log,Ht=Math.LN2;function xp(r){return r>>>=0,r===0?32:31-(Jn(r)/Ht|0)|0}var ps=256,Fn=262144,fo=4194304;function or(r){var s=r&42;if(s!==0)return s;switch(r&-r){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:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return r&-r;case 262144:case 524288:case 1048576:case 2097152:return r&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return r&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return r}}function Lr(r,s,u){var h=r.pendingLanes;if(h===0)return 0;var m=0,x=r.suspendedLanes,k=r.pingedLanes;r=r.warmLanes;var N=h&134217727;return N!==0?(h=N&~x,h!==0?m=or(h):(k&=N,k!==0?m=or(k):u||(u=N&~r,u!==0&&(m=or(u))))):(N=h&~x,N!==0?m=or(N):k!==0?m=or(k):u||(u=h&~r,u!==0&&(m=or(u)))),m===0?0:s!==0&&s!==m&&(s&x)===0&&(x=m&-m,u=s&-s,x>=u||x===32&&(u&4194048)!==0)?s:m}function ms(r,s){return(r.pendingLanes&~(r.suspendedLanes&~r.pingedLanes)&s)===0}function jc(r,s){(s&8)!==0&&(s|=s&32);var u=r.entangledLanes;if(u!==0)for(r=r.entanglements,u&=s;0u;u++)s.push(r);return s}function ys(r,s){r.pendingLanes|=s,s!==268435456&&(r.suspendedLanes=0,r.pingedLanes=0,r.warmLanes=0)}function Ua(r,s,u,h,m,x){var k=r.pendingLanes;r.pendingLanes=u,r.suspendedLanes=0,r.pingedLanes=0,r.warmLanes=0,r.expiredLanes&=u,r.entangledLanes&=u,r.errorRecoveryDisabledLanes&=u,r.shellSuspendCounter=0;var N=r.entanglements,_=r.expirationTimes,G=r.hiddenUpdates;for(u=k&~u;0"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Cp=!1;if(Ur)try{var Xa={};Object.defineProperty(Xa,"passive",{get:function(){Cp=!0}}),window.addEventListener("test",Xa,Xa),window.removeEventListener("test",Xa,Xa)}catch{Cp=!1}var gl=null,Op=null,$c=null;function Tb(){if($c)return $c;var r,s=Op,u=s.length,h,m="value"in gl?gl.value:gl.textContent,x=m.length;for(r=0;r=Ya),jb=" ",_b=!1;function Lb(r,s){switch(r){case"keyup":return t5.indexOf(s.keyCode)!==-1;case"keydown":return s.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function zb(r){return r=r.detail,typeof r=="object"&&"data"in r?r.data:null}var wo=!1;function i5(r,s){switch(r){case"compositionend":return zb(s);case"keypress":return s.which!==32?null:(_b=!0,jb);case"textInput":return r=s.data,r===jb&&_b?null:r;default:return null}}function r5(r,s){if(wo)return r==="compositionend"||!Mp&&Lb(r,s)?(r=Tb(),$c=Op=gl=null,wo=!1,r):null;switch(r){case"paste":return null;case"keypress":if(!(s.ctrlKey||s.altKey||s.metaKey)||s.ctrlKey&&s.altKey){if(s.char&&1"u")return null;try{return r.activeElement||r.body}catch{return r.body}}function Vb(r){for(;r&&r.firstChild;)r=r.firstChild;return r}function Qb(r,s){var u=Vb(r);r=0;for(var h;u;){if(u.nodeType===3){if(h=r+u.textContent.length,r<=s&&h>=s)return{node:u,offset:s-r};r=h}e:{for(;u;){if(u.nextSibling){u=u.nextSibling;break e}u=u.parentNode}u=void 0}u=Vb(u)}}function Xb(r,s){return r&&s?r===s?!0:r&&r.nodeType===3?!1:s&&s.nodeType===3?Xb(r,s.parentNode):"contains"in r?r.contains(s):r.compareDocumentPosition?!!(r.compareDocumentPosition(s)&16):!1:!1}function $b(r){r=r!=null&&r.ownerDocument!=null&&r.ownerDocument.defaultView!=null?r.ownerDocument.defaultView:window;for(var s=jp(r.document);s instanceof r.HTMLIFrameElement;){try{var u=typeof s.contentWindow.location.href=="string"}catch{u=!1}if(u)r=s.contentWindow;else break;s=jp(r.document)}return s}function _p(r){var s=r&&r.nodeName&&r.nodeName.toLowerCase();return s&&(s==="input"&&(r.type==="text"||r.type==="search"||r.type==="tel"||r.type==="url"||r.type==="password")||s==="textarea"||r.contentEditable==="true")}var h5=Ur&&"documentMode"in document&&11>=document.documentMode,ko=null,Lp=null,Ja=null,zp=!1;function Gb(r,s,u){var h=u.window===u?u.document:u.nodeType===9?u:u.ownerDocument;zp||ko==null||ko!==jp(h)||(h=ko,"selectionStart"in h&&_p(h)?h={start:h.selectionStart,end:h.selectionEnd}:(h=(h.ownerDocument&&h.ownerDocument.defaultView||window).getSelection(),h={anchorNode:h.anchorNode,anchorOffset:h.anchorOffset,focusNode:h.focusNode,focusOffset:h.focusOffset}),Ja&&Za(Ja,h)||(Ja=h,h=Jf(Lp,"onSelect"),0>=k,m-=k,ur=1<<32-_t(s)+m|u<He?(sn=Le,Le=null):sn=Le.sibling;var ct=Q($,Le,Y[He],ae);if(ct===null){Le===null&&(Le=sn);break}r&&Le&&ct.alternate===null&&s($,Le),V=x(ct,V,He),st===null?Te=ct:st.sibling=ct,st=ct,Le=sn}if(He===Y.length)return u($,Le),Ze&&Qr($,He),Te;if(Le===null){for(;HeHe?(sn=Le,Le=null):sn=Le.sibling;var Ul=Q($,Le,ct.value,ae);if(Ul===null){Le===null&&(Le=sn);break}r&&Le&&Ul.alternate===null&&s($,Le),V=x(Ul,V,He),st===null?Te=Ul:st.sibling=Ul,st=Ul,Le=sn}if(ct.done)return u($,Le),Ze&&Qr($,He),Te;if(Le===null){for(;!ct.done;He++,ct=Y.next())ct=ue($,ct.value,ae),ct!==null&&(V=x(ct,V,He),st===null?Te=ct:st.sibling=ct,st=ct);return Ze&&Qr($,He),Te}for(Le=h(Le);!ct.done;He++,ct=Y.next())ct=K(Le,$,He,ct.value,ae),ct!==null&&(r&&(sn=ct.alternate,sn!==null&&Le.delete(sn.key===null?He:sn.key)),V=x(ct,V,He),st===null?Te=ct:st.sibling=ct,st=ct);return r&&Le.forEach(function(iM){return s($,iM)}),Ze&&Qr($,He),Te}function Ge($,V,Y,ae){if(typeof Y=="object"&&Y!==null&&Y.type===W&&Y.key===null&&Y.props.ref===void 0&&(Y=Y.props.children),typeof Y=="object"&&Y!==null){switch(Y.$$typeof){case ne:e:{for(var Te=Y.key;V!==null;){if(V.key===Te){if(Te=Y.type,Te===W){if(V.tag===7){u($,V.sibling),ae=m(V,Y.props.children),kl(ae,Y),ae.return=$,$=ae;break e}}else if(V.elementType===Te||typeof Te=="object"&&Te!==null&&Te.$$typeof===E&&Rs(Te)===V.type){u($,V.sibling),ae=m(V,Y.props),kl(ae,Y),ae.return=$,$=ae;break e}u($,V);break}else s($,V);V=V.sibling}Y.type===W?(ae=Os(Y.props.children,$.mode,ae,Y.key),kl(ae,Y),ae.return=$,$=ae):(ae=rf(Y.type,Y.key,Y.props,null,$.mode,ae),kl(ae,Y),ae.return=$,$=ae)}return k($);case F:e:{for(Te=Y.key;V!==null;){if(V.key===Te)if(V.tag===4&&V.stateNode.containerInfo===Y.containerInfo&&V.stateNode.implementation===Y.implementation){u($,V.sibling),ae=m(V,Y.children||[]),ae.return=$,$=ae;break e}else{u($,V);break}else s($,V);V=V.sibling}ae=qp(Y,$.mode,ae),ae.return=$,$=ae}return k($);case E:return Y=Rs(Y),Ge($,V,Y,ae)}if(_e(Y))return be($,V,Y,ae);if(pe(Y)){if(Te=pe(Y),typeof Te!="function")throw Error(i(150));return Y=Te.call(Y),Ee($,V,Y,ae)}if(typeof Y.then=="function")return Ge($,V,pf(Y),ae);if(Y.$$typeof===ie)return Ge($,V,cf($,Y),ae);mf($,Y)}return typeof Y=="string"&&Y!==""||typeof Y=="number"||typeof Y=="bigint"?(Y=""+Y,V!==null&&V.tag===6?(u($,V.sibling),ae=m(V,Y),ae.return=$,$=ae):(u($,V),ae=Fp(Y,$.mode,ae),ae.return=$,$=ae),k($)):u($,V)}return function($,V,Y,ae){try{lu=0;var Te=Ge($,V,Y,ae);return Do=null,Te}catch(Le){if(Le===Mo||Le===hf)throw Le;var st=ei(29,Le,null,$.mode);return st.lanes=ae,st.return=$,st}finally{}}}var _s=y1(!0),b1=y1(!1),Sl=!1;function Jp(r){r.updateQueue={baseState:r.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function em(r,s){r=r.updateQueue,s.updateQueue===r&&(s.updateQueue={baseState:r.baseState,firstBaseUpdate:r.firstBaseUpdate,lastBaseUpdate:r.lastBaseUpdate,shared:r.shared,callbacks:null})}function Cl(r){return{lane:r,tag:0,payload:null,callback:null,next:null}}function Ol(r,s,u){var h=r.updateQueue;if(h===null)return null;if(h=h.shared,(bt&2)!==0){var m=h.pending;return m===null?s.next=s:(s.next=m.next,m.next=s),h.pending=s,s=nf(r),n1(r,null,u),s}return tf(r,h,s,u),nf(r)}function su(r,s,u){if(s=s.updateQueue,s!==null&&(s=s.shared,(u&4194048)!==0)){var h=s.lanes;h&=r.pendingLanes,u|=h,s.lanes=u,_c(r,u)}}function tm(r,s){var u=r.updateQueue,h=r.alternate;if(h!==null&&(h=h.updateQueue,u===h)){var m=null,x=null;if(u=u.firstBaseUpdate,u!==null){do{var k={lane:u.lane,tag:u.tag,payload:u.payload,callback:null,next:null};x===null?m=x=k:x=x.next=k,u=u.next}while(u!==null);x===null?m=x=s:x=x.next=s}else m=x=s;u={baseState:h.baseState,firstBaseUpdate:m,lastBaseUpdate:x,shared:h.shared,callbacks:h.callbacks},r.updateQueue=u;return}r=u.lastBaseUpdate,r===null?u.firstBaseUpdate=s:r.next=s,u.lastBaseUpdate=s}var nm=!1;function ou(){if(nm){var r=Eo;if(r!==null)throw r}}function au(r,s,u,h){nm=!1;var m=r.updateQueue;Sl=!1;var x=m.firstBaseUpdate,k=m.lastBaseUpdate,N=m.shared.pending;if(N!==null){m.shared.pending=null;var _=N,G=_.next;_.next=null,k===null?x=G:k.next=G,k=_;var Z=r.alternate;Z!==null&&(Z=Z.updateQueue,N=Z.lastBaseUpdate,N!==k&&(N===null?Z.firstBaseUpdate=G:N.next=G,Z.lastBaseUpdate=_))}if(x!==null){var ue=m.baseState;k=0,Z=G=_=null,N=x;do{var Q=N.lane&-536870913,K=Q!==N.lane;if(K?(lt&Q)===Q:(h&Q)===Q){Q!==0&&Q===Ms&&(nm=!0),Z!==null&&(Z=Z.next={lane:0,tag:N.tag,payload:N.payload,callback:null,next:null});e:{var be=r,Ee=N;Q=s;var Ge=u;switch(Ee.tag){case 1:if(be=Ee.payload,typeof be=="function"){ue=be.call(Ge,ue,Q);break e}ue=be;break e;case 3:be.flags=be.flags&-65537|128;case 0:if(be=Ee.payload,Q=typeof be=="function"?be.call(Ge,ue,Q):be,Q==null)break e;ue=T({},ue,Q);break e;case 2:Sl=!0}}Q=N.callback,Q!==null&&(r.flags|=64,K&&(r.flags|=8192),K=m.callbacks,K===null?m.callbacks=[Q]:K.push(Q))}else K={lane:Q,tag:N.tag,payload:N.payload,callback:N.callback,next:null},Z===null?(G=Z=K,_=ue):Z=Z.next=K,k|=Q;if(N=N.next,N===null){if(N=m.shared.pending,N===null)break;K=N,N=K.next,K.next=null,m.lastBaseUpdate=K,m.shared.pending=null}}while(!0);Z===null&&(_=ue),m.baseState=_,m.firstBaseUpdate=G,m.lastBaseUpdate=Z,x===null&&(m.shared.lanes=0),Rl|=k,r.lanes=k,r.memoizedState=ue}}function v1(r,s){if(typeof r!="function")throw Error(i(191,r));r.call(s)}function w1(r,s){var u=r.callbacks;if(u!==null)for(r.callbacks=null,r=0;rx?x:8;var k=ve.T,N={};N.types=k!==null?k.types:null,ve.T=N,km(r,!1,s,u);try{var _=m(),G=ve.S;if(G!==null&&G(N,_),_!==null&&typeof _=="object"&&typeof _.then=="function"){var Z=S5(_,h);hu(r,s,Z,vi(r))}else hu(r,s,h,vi(r))}catch(ue){hu(r,s,{then:function(){},status:"rejected",reason:ue},vi())}finally{ce.p=x,k!==null&&N.types!==null&&(k.types=N.types),ve.T=k}}function E5(){}function vm(r,s,u,h){if(r.tag!==5)throw Error(i(476));var m=J1(r).queue;Z1(r,m,s,xe,u===null?E5:function(){return ev(r),u(h)})}function J1(r){var s=r.memoizedState;if(s!==null)return s;s={memoizedState:xe,baseState:xe,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Yr,lastRenderedState:xe},next:null};var u={};return s.next={memoizedState:u,baseState:u,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Yr,lastRenderedState:u},next:null},r.memoizedState=s,r=r.alternate,r!==null&&(r.memoizedState=s),s}function ev(r){var s=J1(r);s.next===null&&(s=r.alternate.memoizedState),hu(r,s.next.queue,{},vi())}function wm(){return wn(Jo)}function tv(){return Zt().memoizedState}function nv(){return Zt().memoizedState}function M5(r){for(var s=r.return;s!==null;){switch(s.tag){case 24:case 3:var u=vi();r=Cl(u);var h=Ol(s,r,u);h!==null&&(ri(h,s,u),su(h,s,u)),s={cache:Yp()},r.payload=s;return}s=s.return}}function D5(r,s,u){var h=vi();u={lane:h,revertLane:0,gesture:null,action:u,hasEagerState:!1,eagerState:null,next:null},Of(r)?rv(s,u):(u=Ip(r,s,u,h),u!==null&&(ri(u,r,h),lv(u,s,h)))}function iv(r,s,u){var h=vi();hu(r,s,u,h)}function hu(r,s,u,h){var m={lane:h,revertLane:0,gesture:null,action:u,hasEagerState:!1,eagerState:null,next:null};if(Of(r))rv(s,m);else{var x=r.alternate;if(r.lanes===0&&(x===null||x.lanes===0)&&(x=s.lastRenderedReducer,x!==null))try{var k=s.lastRenderedState,N=x(k,u);if(m.hasEagerState=!0,m.eagerState=N,mi(N,k))return tf(r,s,m,0),Et===null&&ef(),!1}catch{}finally{}if(u=Ip(r,s,m,h),u!==null)return ri(u,r,h),lv(u,s,h),!0}return!1}function km(r,s,u,h){if(h={lane:2,revertLane:hg(),gesture:null,action:h,hasEagerState:!1,eagerState:null,next:null},Of(r)){if(s)throw Error(i(479))}else s=Ip(r,u,h,2),s!==null&&ri(s,r,2)}function Of(r){var s=r.alternate;return r===$e||s!==null&&s===$e}function rv(r,s){Ro=yf=!0;var u=r.pending;u===null?s.next=s:(s.next=u.next,u.next=s),r.pending=s}function lv(r,s,u){if((u&4194048)!==0){var h=s.lanes;h&=r.pendingLanes,u|=h,s.lanes=u,_c(r,u)}}var Nf={readContext:wn,use:wf,useCallback:$t,useContext:$t,useEffect:$t,useImperativeHandle:$t,useLayoutEffect:$t,useInsertionEffect:$t,useMemo:$t,useReducer:$t,useRef:$t,useState:$t,useDebugValue:$t,useDeferredValue:$t,useTransition:$t,useSyncExternalStore:$t,useId:$t,useHostTransitionStatus:$t,useFormState:$t,useActionState:$t,useOptimistic:$t,useMemoCache:$t,useCacheRefresh:$t,useEffectEvent:$t},sv={readContext:wn,use:wf,useCallback:function(r,s){return Qn().memoizedState=[r,s===void 0?null:s],r},useContext:wn,useEffect:q1,useImperativeHandle:function(r,s,u){u=u!=null?u.concat([r]):null,Sf(4194308,4,$1.bind(null,s,r),u)},useLayoutEffect:function(r,s){return Sf(4194308,4,r,s)},useInsertionEffect:function(r,s){Sf(4,2,r,s)},useMemo:function(r,s){var u=Qn();s=s===void 0?null:s;var h=r();if(Ls){kt(!0);try{r()}finally{kt(!1)}}return u.memoizedState=[h,s],h},useReducer:function(r,s,u){var h=Qn();if(u!==void 0){var m=u(s);if(Ls){kt(!0);try{u(s)}finally{kt(!1)}}}else m=s;return h.memoizedState=h.baseState=m,r={pending:null,lanes:0,dispatch:null,lastRenderedReducer:r,lastRenderedState:m},h.queue=r,r=r.dispatch=D5.bind(null,$e,r),[h.memoizedState,r]},useRef:function(r){var s=Qn();return r={current:r},s.memoizedState=r},useState:function(r){r=mm(r);var s=r.queue,u=iv.bind(null,$e,s);return s.dispatch=u,[r.memoizedState,u]},useDebugValue:ym,useDeferredValue:function(r,s){var u=Qn();return bm(u,r,s)},useTransition:function(){var r=mm(!1);return r=Z1.bind(null,$e,r.queue,!0,!1),Qn().memoizedState=r,[!1,r]},useSyncExternalStore:function(r,s,u){var h=$e,m=Qn();if(Ze){if(u===void 0)throw Error(i(407));u=u()}else{if(u=s(),Et===null)throw Error(i(349));(lt&127)!==0||T1(h,s,u)}m.memoizedState=u;var x={value:u,getSnapshot:s};return m.queue=x,q1(E1.bind(null,h,x,r),[r]),h.flags|=2048,_o(9,{destroy:void 0},A1.bind(null,h,x,u,s),null),u},useId:function(){var r=Qn(),s=Et.identifierPrefix;if(Ze){var u=cr,h=ur;u=(h&~(1<<32-_t(h)-1)).toString(32)+u,s="_"+s+"R_"+u,u=bf++,0<\/script>",x=x.removeChild(x.firstChild);break;case"select":x=typeof h.is=="string"?k.createElement("select",{is:h.is}):k.createElement("select"),h.multiple?x.multiple=!0:h.size&&(x.size=h.size);break;default:x=typeof h.is=="string"?k.createElement(m,{is:h.is}):k.createElement(m)}}x[un]=s,x[_n]=h;e:for(k=s.child;k!==null;){if(k.tag===5||k.tag===6)x.appendChild(k.stateNode);else if(k.tag!==4&&k.tag!==27&&k.child!==null){k.child.return=k,k=k.child;continue}if(k===s)break e;for(;k.sibling===null;){if(k.return===null||k.return===s)break e;k=k.return}k.sibling.return=k.return,k=k.sibling}s.stateNode=x;e:switch(On(x,m,h),m){case"button":case"input":case"select":case"textarea":h=!!h.autoFocus;break e;case"img":h=!0;break e;default:h=!1}h&&Wr(s)}}return zt(s),s.subtreeFlags&=-33554433,Lm(s,s.type,r===null?null:r.memoizedProps,s.pendingProps,u),null;case 6:if(r&&s.stateNode!=null)r.memoizedProps!==h&&Wr(s);else{if(typeof h!="string"&&s.stateNode===null)throw Error(i(166));if(r=Un.current,Ao(s)){if(r=s.stateNode,u=s.memoizedProps,h=null,m=pn,m!==null)switch(m.tag){case 27:case 5:h=m.memoizedProps}r[un]=s,r=!!(r.nodeValue===u||h!==null&&h.suppressHydrationWarning===!0||Ew(r.nodeValue,u)),r||vl(s,!0)}else r=Ou(r).createTextNode(h),r[un]=s,s.stateNode=r}return zt(s),null;case 31:if(u=s.memoizedState,r===null||r.memoizedState!==null){if(h=Ao(s),u!==null){if(r===null){if(!h)throw Error(i(318));if(r=s.memoizedState,r=r!==null?r.dehydrated:null,!r)throw Error(i(557));r[un]=s}else Ns(),(s.flags&128)===0&&(s.memoizedState=null),s.flags|=4;zt(s),r=!1}else u=Xp(),r!==null&&r.memoizedState!==null&&(r.memoizedState.hydrationErrors=u),r=!0;if(!r)return s.flags&256?(gi(s),s):(gi(s),null);if((s.flags&128)!==0)throw Error(i(558))}return zt(s),null;case 13:if(h=s.memoizedState,r===null||r.memoizedState!==null&&r.memoizedState.dehydrated!==null){if(m=Ao(s),h!==null&&h.dehydrated!==null){if(r===null){if(!m)throw Error(i(318));if(m=s.memoizedState,m=m!==null?m.dehydrated:null,!m)throw Error(i(317));m[un]=s}else Ns(),(s.flags&128)===0&&(s.memoizedState=null),s.flags|=4;zt(s),m=!1}else m=Xp(),r!==null&&r.memoizedState!==null&&(r.memoizedState.hydrationErrors=m),m=!0;if(!m)return s.flags&256?(gi(s),s):(gi(s),null)}return gi(s),(s.flags&128)!==0?(s.lanes=u,s):(u=h!==null,r=r!==null&&r.memoizedState!==null,u&&(h=s.child,m=null,h.alternate!==null&&h.alternate.memoizedState!==null&&h.alternate.memoizedState.cachePool!==null&&(m=h.alternate.memoizedState.cachePool.pool),x=null,h.memoizedState!==null&&h.memoizedState.cachePool!==null&&(x=h.memoizedState.cachePool.pool),x!==m&&(h.flags|=2048)),u!==r&&u&&(s.child.flags|=8192),Rf(s,s.updateQueue),zt(s),null);case 4:return Ve(),r===null&&gg(s.stateNode.containerInfo),s.flags|=67108864,zt(s),null;case 10:return $r(s.type),zt(s),null;case 19:if(sm(s),h=s.memoizedState,h===null)return zt(s),null;if(m=(s.flags&128)!==0,x=h.rendering,x===null)if(m)pu(h,!1);else{if(Gt!==0||r!==null&&(r.flags&128)!==0)for(r=s.child;r!==null;){if(x=xf(r),x!==null){for(s.flags|=128,pu(h,!1),r=x.updateQueue,s.updateQueue=r,Rf(s,r),s.subtreeFlags=0,r=u,u=s.child;u!==null;)i1(u,r),u=u.sibling;return uu(s,Sn.current&1|2),Ze&&Qr(s,h.treeForkCount),s.child}r=r.sibling}h.tail!==null&&Qt()>Vf&&(s.flags|=128,m=!0,pu(h,!1),s.lanes=4194304)}else{if(!m)if(r=xf(x),r!==null){if(s.flags|=128,m=!0,r=r.updateQueue,s.updateQueue=r,Rf(s,r),pu(h,!0),h.tail===null&&h.tailMode!=="collapsed"&&h.tailMode!=="visible"&&!x.alternate&&!Ze)return zt(s),null}else 2*Qt()-h.renderingStartTime>Vf&&u!==536870912&&(s.flags|=128,m=!0,pu(h,!1),s.lanes=4194304);h.isBackwards?(x.sibling=s.child,s.child=x):(r=h.last,r!==null?r.sibling=x:s.child=x,h.last=x)}if(h.tail!==null){r=h.tail;e:{for(u=r;u!==null;){if(u.alternate!==null){u=!1;break e}u=u.sibling}u=!0}return h.rendering=r,h.tail=r.sibling,h.renderingStartTime=Qt(),r.sibling=null,x=Sn.current,x=m?x&1|2:x&1,h.tailMode==="visible"||h.tailMode==="collapsed"||!u||Ze?uu(s,x):(u=x,Xe(kn,s),Xe(Sn,u),Ln===null&&(Ln=s)),Ze&&Qr(s,h.treeForkCount),r}return zt(s),null;case 22:case 23:return gi(s),rm(),h=s.memoizedState!==null,r!==null?r.memoizedState!==null!==h&&(s.flags|=8192):h&&(s.flags|=8192),h?(u&536870912)!==0&&(s.flags&128)===0&&(zt(s),s.subtreeFlags&6&&(s.flags|=8192)):zt(s),u=s.updateQueue,u!==null&&Rf(s,u.retryQueue),u=null,r!==null&&r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(u=r.memoizedState.cachePool.pool),h=null,s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(h=s.memoizedState.cachePool.pool),h!==u&&(s.flags|=2048),r!==null&&xt(Ds),null;case 24:return u=null,r!==null&&(u=r.memoizedState.cache),s.memoizedState.cache!==u&&(s.flags|=2048),$r(nn),zt(s),null;case 25:return null;case 30:return s.flags|=33554432,zt(s),null}throw Error(i(156,s.tag))}function P5(r,s){switch(Vp(s),s.tag){case 1:return r=s.flags,r&65536?(s.flags=r&-65537|128,s):null;case 3:return $r(nn),Ve(),r=s.flags,(r&65536)!==0&&(r&128)===0?(s.flags=r&-65537|128,s):null;case 26:case 27:case 5:return yt(s),null;case 31:if(s.memoizedState!==null){if(gi(s),s.alternate===null)throw Error(i(340));Ns()}return r=s.flags,r&65536?(s.flags=r&-65537|128,s):null;case 13:if(gi(s),r=s.memoizedState,r!==null&&r.dehydrated!==null){if(s.alternate===null)throw Error(i(340));Ns()}return r=s.flags,r&65536?(s.flags=r&-65537|128,s):null;case 19:return sm(s),r=s.flags,r&65536?(s.flags=r&-65537|128,r=s.memoizedState,r!==null&&(r.rendering=null,r.tail=null),s.flags|=4,s):null;case 4:return Ve(),null;case 10:return $r(s.type),null;case 22:case 23:return gi(s),rm(),r!==null&&xt(Ds),r=s.flags,r&65536?(s.flags=r&-65537|128,s):null;case 24:return $r(nn),null;case 25:return null;default:return null}}function Dv(r,s){switch(Vp(s),s.tag){case 3:$r(nn),Ve();break;case 26:case 27:case 5:yt(s);break;case 4:Ve();break;case 31:s.memoizedState!==null&&gi(s);break;case 13:gi(s);break;case 19:sm(s);break;case 10:$r(s.type);break;case 22:case 23:gi(s),rm(),r!==null&&xt(Ds);break;case 24:$r(nn)}}function mu(r,s){try{var u=s.updateQueue,h=u!==null?u.lastEffect:null;if(h!==null){var m=h.next;u=m;do{if((u.tag&r)===r){h=void 0;var x=u.create,k=u.inst;h=x(),k.destroy=h}u=u.next}while(u!==m)}}catch(N){Ct(s,s.return,N)}}function El(r,s,u){try{var h=s.updateQueue,m=h!==null?h.lastEffect:null;if(m!==null){var x=m.next;h=x;do{if((h.tag&r)===r){var k=h.inst,N=k.destroy;if(N!==void 0){k.destroy=void 0,m=s;var _=u,G=N;try{G()}catch(Z){Ct(m,_,Z)}}}h=h.next}while(h!==x)}}catch(Z){Ct(s,s.return,Z)}}function Rv(r){var s=r.updateQueue;if(s!==null){var u=r.stateNode;try{w1(s,u)}catch(h){Ct(r,r.return,h)}}}function jv(r,s,u){u.props=zs(r.type,r.memoizedProps),u.state=r.memoizedState;try{u.componentWillUnmount()}catch(h){Ct(r,s,h)}}function fr(r,s){try{var u=r.ref;if(u!==null){switch(r.tag){case 26:case 27:case 5:var h=r.stateNode;break;case 30:var m=r.stateNode,x=Fr(r.memoizedProps,m);(m.ref===null||m.ref.name!==x)&&(m.ref=Iw(x)),h=m.ref;break;case 7:if(r.stateNode===null){var k=new wi(r);g(r.child,!1,A3,k,void 0,void 0),r.stateNode=k}h=r.stateNode;break;default:h=r.stateNode}typeof u=="function"?r.refCleanup=u(h):u.current=h}}catch(N){Ct(r,s,N)}}function Cn(r,s){var u=r.ref,h=r.refCleanup;if(u!==null)if(typeof h=="function")try{h()}catch(m){Ct(r,s,m)}finally{r.refCleanup=null,r=r.alternate,r!=null&&(r.refCleanup=null)}else if(typeof u=="function")try{u(null)}catch(m){Ct(r,s,m)}else u.current=null}function jf(r,s){if((r.tag===5||r.tag===27||r.tag===6)&&r.alternate===null&&s!==null)for(var u=0;u title"))),On(h,s,u),h[un]=r,tn(h),s=h;break e;case"link":if(x=ik("link","href",m).get(s+(u.href||""))){for(k=0;kGe&&(k=Ge,Ge=Ee,Ee=k);var $=Qb(N,Ee),V=Qb(N,Ge);if($&&V&&(K.rangeCount!==1||K.anchorNode!==$.node||K.anchorOffset!==$.offset||K.focusNode!==V.node||K.focusOffset!==V.offset)){var Y=ue.createRange();Y.setStart($.node,$.offset),K.removeAllRanges(),Ee>Ge?(K.addRange(Y),K.extend(V.node,V.offset)):(Y.setEnd(V.node,V.offset),K.addRange(Y))}}}}for(ue=[],K=N;K=K.parentNode;)K.nodeType===1&&ue.push({element:K,left:K.scrollLeft,top:K.scrollTop});for(typeof N.focus=="function"&&N.focus(),N=0;Nu?32:u,ve.T=null,u=ng,ng=null;var x=Yi,k=xr;if(Vt=0,Is=Yi=null,xr=0,(bt&6)!==0)throw Error(i(331));var N=bt;if(bt|=4,nw(x.current),Jv(x,x.current,k,u),bt=N,ku(0,!1),Pt&&typeof Pt.onPostCommitFiberRoot=="function")try{Pt.onPostCommitFiberRoot(ds,x)}catch{}return!0}finally{ce.p=m,ve.T=h,xw(r,s)}}function yw(r,s,u){s=Ei(u,s),s=Om(r.stateNode,s,2),r=Ol(r,s,2),r!==null&&(ys(r,2),yr(r))}function Ct(r,s,u){if(r.tag===3)yw(r,r,u);else for(;s!==null;){if(s.tag===3){yw(s,r,u);break}else if(s.tag===1){var h=s.stateNode;if(typeof s.type.getDerivedStateFromError=="function"||typeof h.componentDidCatch=="function"&&(jl===null||!jl.has(h))){r=Ei(u,r),u=pv(2),h=Ol(s,u,2),h!==null&&(mv(u,h,s,r),ys(h,2),yr(h));break}}s=s.return}}function ug(r,s,u){var h=r.pingCache;if(h===null){h=r.pingCache=new F5;var m=new Set;h.set(s,m)}else m=h.get(s),m===void 0&&(m=new Set,h.set(s,m));m.has(u)||(Jm=!0,m.add(u),r=K5.bind(null,r,s,u),s.then(r,r))}function K5(r,s,u){var h=r.pingCache;h!==null&&h.delete(s),r.pingedLanes|=r.suspendedLanes&u,r.warmLanes&=~u,Et===r&&(lt&u)===u&&((Gt===4||Gt===3&&(lt&62914560)===lt&&300>Qt()-qf)&&(bt&2)===0?Qo(r,0):Ff|=u,Io===lt&&(Io=0)),yr(r)}function bw(r,s){s===0&&(s=gs()),r=Cs(r,s),r!==null&&(ys(r,s),yr(r))}function W5(r){var s=r.memoizedState,u=0;s!==null&&(u=s.retryLane),bw(r,u)}function Z5(r,s){var u=0;switch(r.tag){case 31:case 13:var h=r.stateNode,m=r.memoizedState;m!==null&&(u=m.retryLane);break;case 19:h=r.stateNode;break;case 22:h=r.stateNode._retryCache;break;default:throw Error(i(314))}h!==null&&h.delete(s),bw(r,u)}function J5(r,s){return Ti(r,s)}var $o=null,Go=null,cg=!1,Wf=!1,fg=!1,Ll=0;function yr(r){r!==Go&&r.next===null&&(Go===null?$o=Go=r:Go=Go.next=r),Wf=!0,cg||(cg=!0,t3())}function ku(r,s){if(!fg&&Wf){fg=!0;do for(var u=!1,h=$o;h!==null;){if(r!==0){var m=h.pendingLanes;if(m===0)var x=0;else{var k=h.suspendedLanes,N=h.pingedLanes;x=(1<<31-_t(42|r)+1)-1,x&=m&~(k&~N),x=x&201326741?x&201326741|1:x?x|2:0}x!==0&&(u=!0,Sw(h,x))}else x=lt,x=Lr(h,h===Et?x:0,h.cancelPendingCommit!==null||h.timeoutHandle!==-1),(x&3)===0||ms(h,x)||(u=!0,Sw(h,x));h=h.next}while(u);fg=!1}}function e3(){vw()}function vw(){Wf=cg=!1;var r=0;Ll!==0&&h3()&&(r=Ll);for(var s=Qt(),u=null,h=$o;h!==null;){var m=h.next,x=ww(h,s);x===0?(h.next=null,u===null?$o=m:u.next=m,m===null&&(Go=u)):(u=h,(r!==0||(x&3)!==0)&&(Wf=!0)),h=m}Vt!==0&&Vt!==5||ku(r),Ll!==0&&(Ll=0)}function ww(r,s){for(var u=r.suspendedLanes,h=r.pingedLanes,m=r.expirationTimes,x=r.pendingLanes&-62914561;0N)break;var Z=_.transferSize,ue=_.initiatorType;Z&&Mw(ue)&&(_=_.responseEnd,k+=Z*(_nh){Ee.length=be;break}Y=new Promise(y3.bind(Y)),Ee.push(Y)}}}if(0"u"?null:document;function Jw(r,s,u){var h=Ko;if(h&&typeof s=="string"&&s){var m=te(s);m='link[rel="'+r+'"][href="'+m+'"]',typeof u=="string"&&(m+='[crossorigin="'+u+'"]'),Zw.has(m)||(Zw.add(m),r={rel:r,crossOrigin:u,href:s},h.querySelector(m)===null&&(s=h.createElement("link"),On(s,"link",r),tn(s),h.head.appendChild(s)))}}function B3(r){Jr.D(r),Jw("dns-prefetch",r,null)}function P3(r,s){Jr.C(r,s),Jw("preconnect",r,s)}function H3(r,s,u){Jr.L(r,s,u);var h=Ko;if(h&&r&&s){var m='link[rel="preload"][as="'+te(s)+'"]';s==="image"&&u&&u.imageSrcSet?(m+='[imagesrcset="'+te(u.imageSrcSet)+'"]',typeof u.imageSizes=="string"&&(m+='[imagesizes="'+te(u.imageSizes)+'"]')):m+='[href="'+te(r)+'"]';var x=m;switch(s){case"style":x=Wo(r);break;case"script":x=Zo(r)}if(!(Li.has(x)||(r=T({rel:"preload",href:s==="image"&&u&&u.imageSrcSet?void 0:r,as:s},u),Li.set(x,r),h.querySelector(m)!==null||s==="style"&&h.querySelector(Tu(x))||s==="script"&&h.querySelector(Au(x))))){var k=h.createElement("link");On(k,"link",r),s==="style"&&(k[po]=!0,k.onload=k.onerror=function(){Hc(k)}),tn(k),h.head.appendChild(k)}}}function I3(r,s){Jr.m(r,s);var u=Ko;if(u&&r){var h=s&&typeof s.as=="string"?s.as:"script",m='link[rel="modulepreload"][as="'+te(h)+'"][href="'+te(r)+'"]',x=m;switch(h){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":x=Zo(r)}if(!Li.has(x)&&(r=T({rel:"modulepreload",href:r},s),Li.set(x,r),u.querySelector(m)===null)){switch(h){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(u.querySelector(Au(x)))return}h=u.createElement("link"),On(h,"link",r),tn(h),u.head.appendChild(h)}}}function U3(r,s,u){Jr.S(r,s,u);var h=Ko;if(h&&r){var m=ml(h).hoistableStyles,x=Wo(r);s=s||"default";var k=m.get(x);if(!k){var N={loading:0,preload:null};if(k=h.querySelector(Tu(x)))N.loading=5;else{r=T({rel:"stylesheet",href:r,"data-precedence":s},u),(u=Li.get(x))&&Rg(r,u);var _=k=h.createElement("link");tn(_),On(_,"link",r),_._p=new Promise(function(G,Z){_.onload=G,_.onerror=Z}),_.addEventListener("load",function(){N.loading|=1}),_.addEventListener("error",function(){N.loading|=2}),N.loading|=4,eh(k,s,h)}k={type:"stylesheet",instance:k,count:1,state:N},m.set(x,k)}}}function F3(r,s){Jr.X(r,s);var u=Ko;if(u&&r){var h=ml(u).hoistableScripts,m=Zo(r),x=h.get(m);x||(x=u.querySelector(Au(m)),x||(r=T({src:r,async:!0},s),(s=Li.get(m))&&jg(r,s),x=u.createElement("script"),tn(x),On(x,"link",r),u.head.appendChild(x)),x={type:"script",instance:x,count:1,state:null},h.set(m,x))}}function q3(r,s){Jr.M(r,s);var u=Ko;if(u&&r){var h=ml(u).hoistableScripts,m=Zo(r),x=h.get(m);x||(x=u.querySelector(Au(m)),x||(r=T({src:r,async:!0,type:"module"},s),(s=Li.get(m))&&jg(r,s),x=u.createElement("script"),tn(x),On(x,"link",r),u.head.appendChild(x)),x={type:"script",instance:x,count:1,state:null},h.set(m,x))}}function ek(r,s,u,h){var m=(m=Un.current)?Nu(m):null;if(!m)throw Error(i(446));switch(r){case"meta":case"title":return null;case"style":return typeof u.precedence=="string"&&typeof u.href=="string"?(u=Wo(u.href),s=ml(m).hoistableStyles,h=s.get(u),h||(h={type:"style",instance:null,count:0,state:null},s.set(u,h)),h):{type:"void",instance:null,count:0,state:null};case"link":if(u.rel==="stylesheet"&&typeof u.href=="string"&&typeof u.precedence=="string"){r=Wo(u.href);var x=ml(m).hoistableStyles,k=x.get(r);if(k||(m=m.ownerDocument||m,k={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},x.set(r,k),(x=m.querySelector(Tu(r)))?x._p||(k.instance=x,k.state.loading=5):(x=Li.get(r),x||(x={rel:"preload",as:"style",href:u.href,crossOrigin:u.crossOrigin,integrity:u.integrity,media:u.media,hrefLang:u.hrefLang,referrerPolicy:u.referrerPolicy},Li.set(r,x)),V3(m,r,x,k.state))),s&&h===null)throw Error(i(528,""));return k}if(s&&h!==null)throw Error(i(529,""));return null;case"script":return s=u.async,u=u.src,typeof u=="string"&&s&&typeof s!="function"&&typeof s!="symbol"?(u=Zo(u),s=ml(m).hoistableScripts,h=s.get(u),h||(h={type:"script",instance:null,count:0,state:null},s.set(u,h)),h):{type:"void",instance:null,count:0,state:null};default:throw Error(i(444,r))}}function Wo(r){return'href="'+te(r)+'"'}function Tu(r){return'link[rel="stylesheet"]['+r+"]"}function tk(r){return T({},r,{"data-precedence":r.precedence,precedence:null})}function V3(r,s,u,h){if(s=r.querySelector('link[rel="preload"][as="style"]['+s+"]")){if(s[po]!==!0){h.loading=1;return}}else s=r.createElement("link"),s[po]=!0,s.onload=s.onerror=Hc.bind(null,s),On(s,"link",u),tn(s),r.head.appendChild(s);h.preload=s,s.addEventListener("load",function(){return h.loading|=1}),s.addEventListener("error",function(){return h.loading|=2})}function Zo(r){return'[src="'+te(r)+'"]'}function Au(r){return"script[async]"+r}function nk(r,s,u){if(s.count++,s.instance===null)switch(s.type){case"style":var h=r.querySelector('style[data-href~="'+te(u.href)+'"]');if(h)return s.instance=h,tn(h),h;var m=T({},u,{"data-href":u.href,"data-precedence":u.precedence,href:null,precedence:null});return h=(r.ownerDocument||r).createElement("style"),tn(h),On(h,"style",m),eh(h,u.precedence,r),s.instance=h;case"stylesheet":m=Wo(u.href);var x=r.querySelector(Tu(m));if(x)return s.state.loading|=4,s.instance=x,tn(x),x;h=tk(u),(m=Li.get(m))&&Rg(h,m),x=(r.ownerDocument||r).createElement("link"),tn(x);var k=x;return k._p=new Promise(function(N,_){k.onload=N,k.onerror=_}),On(x,"link",h),s.state.loading|=4,eh(x,u.precedence,r),s.instance=x;case"script":return x=Zo(u.src),(m=r.querySelector(Au(x)))?(s.instance=m,tn(m),m):(h=u,(m=Li.get(x))&&(h=T({},u),jg(h,m)),r=r.ownerDocument||r,m=r.createElement("script"),tn(m),On(m,"link",h),r.head.appendChild(m),s.instance=m);case"void":return null;default:throw Error(i(443,s.type))}else s.type==="stylesheet"&&(s.state.loading&4)===0&&(h=s.instance,s.state.loading|=4,eh(h,u.precedence,r));return s.instance}function eh(r,s,u){for(var h=u.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),m=h.length?h[h.length-1]:null,x=m,k=0;k title"):null)}function Q3(r,s,u){if(u===1||s.itemProp!=null)return!1;switch(r){case"meta":case"title":return!0;case"style":if(typeof s.precedence!="string"||typeof s.href!="string"||s.href==="")break;return!0;case"link":if(typeof s.rel!="string"||typeof s.href!="string"||s.href===""||s.onLoad||s.onError)break;switch(s.rel){case"stylesheet":return r=s.disabled,typeof s.precedence=="string"&&r==null;default:return!0}case"script":if(s.async&&typeof s.async!="function"&&typeof s.async!="symbol"&&!s.onLoad&&!s.onError&&s.src&&typeof s.src=="string")return!0}return!1}function rk(r,s){return r==="img"&&s.src!=null&&s.src!==""&&s.onLoad==null&&s.loading!=="lazy"}function lk(r){return!(r.type==="stylesheet"&&(r.state.loading&3)===0)}function sk(r){return(r.width||100)*(r.height||100)*(typeof devicePixelRatio=="number"?devicePixelRatio:1)*.25}function ok(r,s){typeof s.decode=="function"&&(r.imgCount++,s.complete||(r.imgBytes+=sk(s),r.suspenseyImages.push(s)),r=G3.bind(r),s.decode().then(r,r))}function X3(r,s,u,h){if(u.type==="stylesheet"&&(typeof h.media!="string"||matchMedia(h.media).matches!==!1)&&(u.state.loading&4)===0){if(u.instance===null){var m=Wo(h.href),x=s.querySelector(Tu(m));if(x){s=x._p,s!==null&&typeof s=="object"&&typeof s.then=="function"&&(r.count++,r=Eu.bind(r),s.then(r,r)),u.state.loading|=4,u.instance=x,tn(x);return}x=s.ownerDocument||s,h=tk(h),(m=Li.get(m))&&Rg(h,m),x=x.createElement("link"),tn(x);var k=x;k._p=new Promise(function(N,_){k.onload=N,k.onerror=_}),On(x,"link",h),u.instance=x}r.stylesheets===null&&(r.stylesheets=new Map),r.stylesheets.set(u,s),(s=u.state.preload)&&(u.state.loading&3)===0&&(r.count++,u=Eu.bind(r),s.addEventListener("load",u),s.addEventListener("error",u))}}var nh=0;function $3(r,s){return r.stylesheets&&r.count===0&&rh(r,r.stylesheets),0nh?50:800)+s);return r.unsuspend=u,function(){r.unsuspend=null,clearTimeout(h),clearTimeout(m)}}:null}function ak(r){if(r.count===0&&(r.imgCount===0||!r.waitingForImages)){if(r.stylesheets)rh(r,r.stylesheets);else if(r.unsuspend){var s=r.unsuspend;r.unsuspend=null,s()}}}function Eu(){this.count--,ak(this)}function G3(){this.imgCount--,ak(this)}var ih=null;function rh(r,s){r.stylesheets=null,r.unsuspend!==null&&(r.count++,ih=new Map,s.forEach(Y3,r),ih=null,Eu.call(r))}function Y3(r,s){if(!(s.state.loading&4)){var u=ih.get(r);if(u)var h=u.get(null);else{u=new Map,ih.set(r,u);for(var m=r.querySelectorAll("link[data-precedence],style[data-precedence]"),x=0;x"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}return n(),qg.exports=dM(),qg.exports}var mM=pM();const gM=hy(mM);class QC extends Error{constructor(t,i,l){super(t);fh(this,"status");fh(this,"detail");this.name="ApiError",this.status=i,this.detail=l}}async function as(n,e){let t=e,i;try{const l=await n.json();typeof(l==null?void 0:l.detail)=="string"&&l.detail?(t=l.detail,i=l.detail):Array.isArray(l==null?void 0:l.detail)&&(i=l.detail)}catch{}return new QC(t,n.status,i)}async function xM(n){const e=await fetch(`/api/notifications?after=${n}`);if(!e.ok)throw new Error("Failed to fetch notifications");return e.json()}async function yM(){const n=await fetch("/api/actions/open-log",{method:"POST"});if(!n.ok)throw new Error("Failed to open log file");return n.json()}async function bM(n){const e=new URLSearchParams;e.set("limit",String(n.limit)),n!=null&&n.level&&e.set("level",n.level),n!=null&&n.search&&e.set("search",n.search);const t=await fetch(`/api/logs?${e.toString()}`);if(!t.ok)throw new Error("Failed to fetch log entries");return t.json()}async function $h(){const n=await fetch("/api/system");if(!n.ok)throw new Error("Failed to fetch system info");return n.json()}async function vM(n){const e=await fetch("/api/system/bind",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({lan:n})});if(!e.ok){let t="Failed to update LAN binding";try{const i=await e.json();i!=null&&i.detail&&(t=i.detail)}catch{}throw new Error(t)}return e.json()}async function wM(n,e=1e4){const t=Date.now()+e;let i=null;for(;Date.now()setTimeout(l,500))}return i}async function Rk(){const n=await fetch("/api/config");if(!n.ok)throw new Error("Failed to fetch app configuration");return n.json()}async function jk(n){const e=await fetch("/api/config/select-directory",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({directory:n})});if(!e.ok)throw new Error("Failed to select directory");return e.json()}async function kM(n){const e=await fetch("/api/config/load",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({config_path:n})});if(!e.ok)throw new Error("Failed to load config file");return e.json()}async function XC(n,e){const t=await fetch("/api/config/load-content",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({filename:n,content:e})});if(!t.ok){let i=`Failed to apply dropped config (${n})`;try{const l=await t.json();l!=null&&l.detail&&(i=l.detail)}catch{}throw new Error(i)}return t.json()}async function SM(){const n=await fetch("/api/config/reload",{method:"POST"});if(!n.ok){let e="Failed to reload configuration";try{const t=await n.json();t!=null&&t.detail&&(e=t.detail)}catch{}throw new Error(e)}return n.json()}async function CM(n){const e=await fetch("/api/config/create",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({directory:n})});if(!e.ok)throw new Error("Failed to create config file");return e.json()}async function _k(){const n=await fetch("/api/config/content");if(!n.ok)throw await as(n,"Failed to fetch config content");return n.json()}async function Lk(n,e){const t=await fetch("/api/config/validate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({filename:n,content:e})});if(!t.ok)throw await as(t,"Failed to validate config content");return t.json()}async function OM(){const n=await fetch("/api/config/template",{method:"POST"});if(!n.ok)throw await as(n,"Failed to fetch config template");return n.json()}async function NM(n,e){const t=await fetch("/api/config/save",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:n,force:e})});if(!t.ok)throw await as(t,"Failed to save configuration");return(await t.json()).config}async function TM(n){const e=await fetch("/api/config/save-as",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)});if(!e.ok)throw await as(e,"Failed to save configuration as");return(await e.json()).config}async function AM(n){const e=`/api/fs/browse?path=${encodeURIComponent(n)}&include_hidden=true`,t=await fetch(e);if(!t.ok)throw new Error("Failed to browse config files");return t.json()}async function $C(n){const e=`/api/fs/browse?path=${encodeURIComponent(n)}`,t=await fetch(e);if(!t.ok)throw new Error("Failed to browse directory");return t.json()}async function zk(n,e){const t=await fetch("/api/scan",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n),signal:e});if(!t.ok)throw new Error("Failed to execute scan");return t.json()}async function $g(n){const e=new URLSearchParams;(n==null?void 0:n.offset)!=null&&e.set("offset",String(n.offset)),(n==null?void 0:n.limit)!=null&&e.set("limit",String(n.limit)),n!=null&&n.sort_by&&e.set("sort_by",n.sort_by),n!=null&&n.sort_dir&&e.set("sort_dir",n.sort_dir);const t=e.toString(),i=`/api/scan/results${t?`?${t}`:""}`,l=await fetch(i,{signal:n==null?void 0:n.signal});if(!l.ok)throw new Error("Failed to fetch scan results");return l.json()}async function EM(n){const e=await fetch("/api/actions/launch",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)});if(!e.ok)throw new Error("Failed to launch file");return e.json()}async function GC(n){const e=await fetch("/api/actions/reveal",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({file_path:n})});if(!e.ok)throw new Error("Failed to reveal file");return e.json()}async function Q0(n){const e=await fetch("/api/actions/open-folder",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({file_path:n})});if(!e.ok)throw new Error("Failed to open folder");return e.json()}async function Bk(n){const e=await fetch("/api/actions/open-terminal",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({file_path:n})});if(!e.ok)throw new Error("Failed to open terminal");return e.json()}async function Pk(n,e){const t=await fetch("/api/actions/hash",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({file_path:n,algorithm:e})});if(!t.ok)throw new Error("Failed to compute hash");return t.json()}async function MM(){const n=await fetch("/api/actions/open-config",{method:"POST"});if(!n.ok)throw new Error("Failed to open config file");return n.json()}async function Hk(n){const e={file_path:n.file_path||n.filePath,content:n.content},t=await fetch("/api/actions/barcode",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!t.ok)throw new Error("Failed to generate barcode");return t.json()}async function DM(n){const e=await fetch("/api/actions/barcode/decode",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({image_base64:n.imageBase64,formats:n.formats})});if(!e.ok)throw e.status===503?new Error("Server-side barcode decoding is unavailable"):new Error(`Failed to decode frame (HTTP ${e.status})`);return e.json()}async function RM(n,e){const t=await fetch("/api/actions/metadata",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({file_path:n}),signal:e});if(!t.ok)throw new Error("Failed to fetch metadata");return t.json()}async function jM(n,e){const t=await fetch("/api/actions/export-csv",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:n,filename:e})});if(!t.ok)throw new Error("Failed to export CSV");return t.json()}async function _M(n,e){const t=await fetch("/api/actions/save-image",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({image_base64:n,filename:e})});if(!t.ok)throw new Error("Failed to save image");return t.json()}async function LM(n){const e=await fetch("/api/workflow/start",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)});if(!e.ok)throw await as(e,"Failed to start workflow session");return e.json()}async function zM(n,e){const t=await fetch(`/api/workflow/${n}/respond`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:e})});if(!t.ok)throw await as(t,"Failed to respond to workflow prompt");return t.json()}async function BM(n){const e=await fetch(`/api/workflow/${n}/abort`,{method:"POST"});if(!e.ok)throw await as(e,"Failed to abort workflow session");return e.json()}const PM=[".profiles",".profiles.yaml",".profiles.yml",".yaml",".yml"];function HM(n){const e=n.toLowerCase();return PM.some(t=>e.endsWith(t))}function IM(n){for(const e of n)if(HM(e.name))return e;return null}function Gh(){return{depth:0,overlayVisible:!1}}function Ik(n,e,t){switch(e){case"enter":return t?{depth:n.depth+1,overlayVisible:!0}:n;case"leave":{const i=Math.max(0,n.depth-1);return{depth:i,overlayVisible:n.depth>0&&i>0}}case"drop":return Gh()}}function Uk(n){return n==="light"?"light":"dark"}/** - * @license lucide-react v0.477.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const UM=n=>n.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),YC=(...n)=>n.filter((e,t,i)=>!!e&&e.trim()!==""&&i.indexOf(e)===t).join(" ").trim();/** - * @license lucide-react v0.477.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */var FM={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"};/** - * @license lucide-react v0.477.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const qM=R.forwardRef(({color:n="currentColor",size:e=24,strokeWidth:t=2,absoluteStrokeWidth:i,className:l="",children:o,iconNode:a,...c},f)=>R.createElement("svg",{ref:f,...FM,width:e,height:e,stroke:n,strokeWidth:i?Number(t)*24/Number(e):t,className:YC("lucide",l),...c},[...a.map(([d,p])=>R.createElement(d,p)),...Array.isArray(o)?o:[o]]));/** - * @license lucide-react v0.477.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const De=(n,e)=>{const t=R.forwardRef(({className:i,...l},o)=>R.createElement(qM,{ref:o,iconNode:e,className:YC(`lucide-${UM(n)}`,i),...l}));return t.displayName=`${n}`,t};/** - * @license lucide-react v0.477.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const VM=[["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"}]],QM=De("Activity",VM);/** - * @license lucide-react v0.477.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const XM=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],KC=De("ArrowDown",XM);/** - * @license lucide-react v0.477.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const $M=[["path",{d:"M8 3 4 7l4 4",key:"9rb6wj"}],["path",{d:"M4 7h16",key:"6tx8e3"}],["path",{d:"m16 21 4-4-4-4",key:"siv7j2"}],["path",{d:"M20 17H4",key:"h6l3hr"}]],GM=De("ArrowLeftRight",$M);/** - * @license lucide-react v0.477.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const YM=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],KM=De("ArrowRight",YM);/** - * @license lucide-react v0.477.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const WM=[["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"}]],Fk=De("ArrowUpDown",WM);/** - * @license lucide-react v0.477.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const ZM=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],JM=De("ArrowUp",ZM);/** - * @license lucide-react v0.477.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const e4=[["path",{d:"m8 2 1.88 1.88",key:"fmnt4t"}],["path",{d:"M14.12 3.88 16 2",key:"qol33r"}],["path",{d:"M9 7.13v-1a3.003 3.003 0 1 1 6 0v1",key:"d7y7pr"}],["path",{d:"M12 20c-3.3 0-6-2.7-6-6v-3a4 4 0 0 1 4-4h4a4 4 0 0 1 4 4v3c0 3.3-2.7 6-6 6",key:"xs1cw7"}],["path",{d:"M12 20v-9",key:"1qisl0"}],["path",{d:"M6.53 9C4.6 8.8 3 7.1 3 5",key:"32zzws"}],["path",{d:"M6 13H2",key:"82j7cp"}],["path",{d:"M3 21c0-2.1 1.7-3.9 3.8-4",key:"4p0ekp"}],["path",{d:"M20.97 5c0 2.1-1.6 3.8-3.5 4",key:"18gb23"}],["path",{d:"M22 13h-4",key:"1jl80f"}],["path",{d:"M17.2 17c2.1.1 3.8 1.9 3.8 4",key:"k3fwyw"}]],t4=De("Bug",e4);/** - * @license lucide-react v0.477.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const n4=[["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"}]],i4=De("Calendar",n4);/** - * @license lucide-react v0.477.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const r4=[["path",{d:"M14.5 4h-5L7 7H4a2 2 0 0 0-2 2v9a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2h-3l-2.5-3z",key:"1tc9qg"}],["circle",{cx:"12",cy:"13",r:"3",key:"1vg3eu"}]],WC=De("Camera",r4);/** - * @license lucide-react v0.477.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const l4=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],il=De("Check",l4);/** - * @license lucide-react v0.477.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const s4=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],o4=De("ChevronDown",s4);/** - * @license lucide-react v0.477.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const a4=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],Vd=De("ChevronRight",a4);/** - * @license lucide-react v0.477.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const u4=[["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"}]],Gu=De("CircleAlert",u4);/** - * @license lucide-react v0.477.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const c4=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],qk=De("CircleCheck",c4);/** - * @license lucide-react v0.477.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const f4=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}]],h4=De("CircleDot",f4);/** - * @license lucide-react v0.477.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const d4=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"10",x2:"10",y1:"15",y2:"9",key:"c1nkhi"}],["line",{x1:"14",x2:"14",y1:"15",y2:"9",key:"h65svq"}]],p4=De("CirclePause",d4);/** - * @license lucide-react v0.477.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const m4=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polygon",{points:"10 8 16 12 10 16 10 8",key:"1cimsy"}]],g4=De("CirclePlay",m4);/** - * @license lucide-react v0.477.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const x4=[["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"}]],X0=De("CircleX",x4);/** - * @license lucide-react v0.477.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const y4=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]],b4=De("Clock",y4);/** - * @license lucide-react v0.477.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const v4=[["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"}]],si=De("Copy",v4);/** - * @license lucide-react v0.477.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const w4=[["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"}]],ZC=De("Download",w4);/** - * @license lucide-react v0.477.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const k4=[["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"}]],JC=De("ExternalLink",k4);/** - * @license lucide-react v0.477.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const S4=[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]],C4=De("EyeOff",S4);/** - * @license lucide-react v0.477.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const O4=[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],$0=De("Eye",O4);/** - * @license lucide-react v0.477.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const N4=[["polygon",{points:"13 19 22 12 13 5 13 19",key:"587y9g"}],["polygon",{points:"2 19 11 12 2 5 2 19",key:"3pweh0"}]],T4=De("FastForward",N4);/** - * @license lucide-react v0.477.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const A4=[["path",{d:"M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4",key:"1pf5j1"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"m5 12-3 3 3 3",key:"oke12k"}],["path",{d:"m9 18 3-3-3-3",key:"112psh"}]],E4=De("FileCode2",A4);/** - * @license lucide-react v0.477.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const M4=[["path",{d:"M10 12.5 8 15l2 2.5",key:"1tg20x"}],["path",{d:"m14 12.5 2 2.5-2 2.5",key:"yinavb"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7z",key:"1mlx9k"}]],G0=De("FileCode",M4);/** - * @license lucide-react v0.477.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const D4=[["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"m3.2 12.9-.9-.4",key:"1i3dj5"}],["path",{d:"m3.2 15.1-.9.4",key:"1fvgj0"}],["path",{d:"M4.677 21.5a2 2 0 0 0 1.313.5H18a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v2.5",key:"1yo3oz"}],["path",{d:"m4.9 11.2-.4-.9",key:"otmhb9"}],["path",{d:"m4.9 16.8-.4.9",key:"1b8z07"}],["path",{d:"m7.5 10.3-.4.9",key:"11k65u"}],["path",{d:"m7.5 17.7-.4-.9",key:"431x55"}],["path",{d:"m9.7 12.5-.9.4",key:"87sjan"}],["path",{d:"m9.7 15.5-.9-.4",key:"khqm91"}],["circle",{cx:"6",cy:"14",r:"3",key:"a1xfv6"}]],aa=De("FileCog",D4);/** - * @license lucide-react v0.477.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const R4=[["path",{d:"M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4",key:"1pf5j1"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M3 15h6",key:"4e2qda"}],["path",{d:"M6 12v6",key:"1u72j0"}]],j4=De("FilePlus2",R4);/** - * @license lucide-react v0.477.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const _4=[["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"}]],Ca=De("FileText",_4);/** - * @license lucide-react v0.477.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const L4=[["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"}]],Gg=De("File",L4);/** - * @license lucide-react v0.477.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const z4=[["path",{d:"M14 2v6a2 2 0 0 0 .245.96l5.51 10.08A2 2 0 0 1 18 22H6a2 2 0 0 1-1.755-2.96l5.51-10.08A2 2 0 0 0 10 8V2",key:"18mbvz"}],["path",{d:"M6.453 15h11.094",key:"3shlmq"}],["path",{d:"M8.5 2h7",key:"csnxdl"}]],B4=De("FlaskConical",z4);/** - * @license lucide-react v0.477.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const P4=[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]],Kl=De("FolderOpen",P4);/** - * @license lucide-react v0.477.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const H4=[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]],Sc=De("Folder",H4);/** - * @license lucide-react v0.477.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const I4=[["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"}]],U4=De("Globe",I4);/** - * @license lucide-react v0.477.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const F4=[["line",{x1:"4",x2:"20",y1:"9",y2:"9",key:"4lhtct"}],["line",{x1:"4",x2:"20",y1:"15",y2:"15",key:"vyu0kd"}],["line",{x1:"10",x2:"8",y1:"3",y2:"21",key:"1ggp8o"}],["line",{x1:"16",x2:"14",y1:"3",y2:"21",key:"weycgp"}]],ua=De("Hash",F4);/** - * @license lucide-react v0.477.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const q4=[["path",{d:"M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8",key:"5wwlr5"}],["path",{d:"M3 10a2 2 0 0 1 .709-1.528l7-5.999a2 2 0 0 1 2.582 0l7 5.999A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"1d0kgt"}]],Qd=De("House",q4);/** - * @license lucide-react v0.477.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const V4=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],eO=De("Info",V4);/** - * @license lucide-react v0.477.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Q4=[["path",{d:"M10 8h.01",key:"1r9ogq"}],["path",{d:"M12 12h.01",key:"1mp3jc"}],["path",{d:"M14 8h.01",key:"1primd"}],["path",{d:"M16 12h.01",key:"1l6xoz"}],["path",{d:"M18 8h.01",key:"emo2bl"}],["path",{d:"M6 8h.01",key:"x9i8wu"}],["path",{d:"M7 16h10",key:"wp8him"}],["path",{d:"M8 12h.01",key:"czm47f"}],["rect",{width:"20",height:"16",x:"2",y:"4",rx:"2",key:"18n3k1"}]],tO=De("Keyboard",Q4);/** - * @license lucide-react v0.477.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const X4=[["path",{d:"M9 17H7A5 5 0 0 1 7 7h2",key:"8i5ue5"}],["path",{d:"M15 7h2a5 5 0 1 1 0 10h-2",key:"1b9ql8"}],["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}]],$4=De("Link2",X4);/** - * @license lucide-react v0.477.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const G4=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],Zl=De("LoaderCircle",G4);/** - * @license lucide-react v0.477.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Y4=[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]],K4=De("Lock",Y4);/** - * @license lucide-react v0.477.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const W4=[["path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z",key:"a7tn18"}]],Z4=De("Moon",W4);/** - * @license lucide-react v0.477.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const J4=[["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"}]],eD=De("Network",J4);/** - * @license lucide-react v0.477.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const tD=[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]],Jl=De("Play",tD);/** - * @license lucide-react v0.477.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const nD=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],iD=De("Plus",nD);/** - * @license lucide-react v0.477.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const rD=[["rect",{width:"5",height:"5",x:"3",y:"3",rx:"1",key:"1tu5fj"}],["rect",{width:"5",height:"5",x:"16",y:"3",rx:"1",key:"1v8r4q"}],["rect",{width:"5",height:"5",x:"3",y:"16",rx:"1",key:"1x03jg"}],["path",{d:"M21 16h-3a2 2 0 0 0-2 2v3",key:"177gqh"}],["path",{d:"M21 21v.01",key:"ents32"}],["path",{d:"M12 7v3a2 2 0 0 1-2 2H7",key:"8crl2c"}],["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M12 3h.01",key:"n36tog"}],["path",{d:"M12 16v.01",key:"133mhm"}],["path",{d:"M16 12h1",key:"1slzba"}],["path",{d:"M21 12v.01",key:"1lwtk9"}],["path",{d:"M12 21v-1",key:"1880an"}]],py=De("QrCode",rD);/** - * @license lucide-react v0.477.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const lD=[["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"}]],Xd=De("RefreshCw",lD);/** - * @license lucide-react v0.477.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const sD=[["path",{d:"M4.5 16.5c-1.5 1.26-2 5-2 5s3.74-.5 5-2c.71-.84.7-2.13-.09-2.91a2.18 2.18 0 0 0-2.91-.09z",key:"m3kijz"}],["path",{d:"m12 15-3-3a22 22 0 0 1 2-3.95A12.88 12.88 0 0 1 22 2c0 2.72-.78 7.5-6 11a22.35 22.35 0 0 1-4 2z",key:"1fmvmk"}],["path",{d:"M9 12H4s.55-3.03 2-4c1.62-1.08 5 0 5 0",key:"1f8sc4"}],["path",{d:"M12 15v5s3.03-.55 4-2c1.08-1.62 0-5 0-5",key:"qeys4"}]],oD=De("Rocket",sD);/** - * @license lucide-react v0.477.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const aD=[["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"}]],uD=De("RotateCcw",aD);/** - * @license lucide-react v0.477.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const cD=[["path",{d:"M10 2v3a1 1 0 0 0 1 1h5",key:"1xspal"}],["path",{d:"M18 18v-6a1 1 0 0 0-1-1h-6a1 1 0 0 0-1 1v6",key:"1ra60u"}],["path",{d:"M18 22H4a2 2 0 0 1-2-2V6",key:"pblm9e"}],["path",{d:"M8 18a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9.172a2 2 0 0 1 1.414.586l2.828 2.828A2 2 0 0 1 22 6.828V16a2 2 0 0 1-2.01 2z",key:"1yve0x"}]],fD=De("SaveAll",cD);/** - * @license lucide-react v0.477.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const hD=[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]],nO=De("Save",hD);/** - * @license lucide-react v0.477.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const dD=[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]],iO=De("Search",dD);/** - * @license lucide-react v0.477.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const pD=[["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"}]],mD=De("Settings",pD);/** - * @license lucide-react v0.477.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const gD=[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]],xD=De("Sun",gD);/** - * @license lucide-react v0.477.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const yD=[["polyline",{points:"4 17 10 11 4 5",key:"akl6gq"}],["line",{x1:"12",x2:"20",y1:"19",y2:"19",key:"q2wloq"}]],Y0=De("Terminal",yD);/** - * @license lucide-react v0.477.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const bD=[["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"}]],rO=De("Timer",bD);/** - * @license lucide-react v0.477.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const vD=[["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"}]],lO=De("Trash2",vD);/** - * @license lucide-react v0.477.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const wD=[["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"}]],sO=De("TriangleAlert",wD);/** - * @license lucide-react v0.477.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const kD=[["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"}]],SD=De("User",kD);/** - * @license lucide-react v0.477.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const CD=[["path",{d:"M18 16.98h-5.99c-1.1 0-1.95.94-2.48 1.9A4 4 0 0 1 2 17c.01-.7.2-1.4.57-2",key:"q3hayz"}],["path",{d:"m6 17 3.13-5.78c.53-.97.1-2.18-.5-3.1a4 4 0 1 1 6.89-4.06",key:"1go1hn"}],["path",{d:"m12 6 3.13 5.73C15.66 12.7 16.9 13 18 13a4 4 0 0 1 0 8",key:"qlwsc0"}]],oO=De("Webhook",CD);/** - * @license lucide-react v0.477.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const OD=[["rect",{width:"8",height:"8",x:"3",y:"3",rx:"2",key:"by2w9f"}],["path",{d:"M7 11v4a2 2 0 0 0 2 2h4",key:"xkn7yn"}],["rect",{width:"8",height:"8",x:"13",y:"13",rx:"2",key:"1cgmvn"}]],ND=De("Workflow",OD);/** - * @license lucide-react v0.477.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const TD=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Ui=De("X",TD);function AD(n){if(n<60)return`${n}s`;const e=Math.floor(n/60),t=n%60;return`${e}m${t.toString().padStart(2,"0")}s`}function ED(n){if(!n)return{label:"",cut:!1};const e=n.replace(/\\/g,"/").split("/").filter(Boolean);return e.length===0?{label:n,cut:!1}:{label:e[e.length-1],cut:e.length>1}}function MD({directory:n}){const[e,t]=R.useState(0);R.useEffect(()=>{t(0);const o=window.setInterval(()=>{t(a=>a+1)},1e3);return()=>window.clearInterval(o)},[]);const{label:i,cut:l}=ED(n);return y.jsxs("div",{"data-testid":"scan-status-strip",className:"flex min-w-0 items-center gap-1.5 text-[11px] text-ink-muted",children:[y.jsx(Zl,{className:"h-3 w-3 shrink-0 animate-spin text-chip-indigo-text motion-reduce:animate-none","aria-hidden":"true"}),y.jsxs("span",{className:"min-w-0 truncate",children:["Scanning",n&&y.jsxs(y.Fragment,{children:[" ",y.jsxs("span",{className:"font-mono text-ink-secondary",title:n,children:[l?"…/":"",i]})]})," — ",y.jsx("span",{className:"font-mono tabular-nums text-ink-secondary",children:AD(e)})]})]})}function DD({onExecute:n,scanning:e,hasSelection:t,fileCount:i,totalCount:l,scanningDirectory:o="",toastMessage:a,onToastDismiss:c}){const f=(a==null?void 0:a.kind)==="error";return y.jsxs("div",{className:"relative flex items-center justify-between border-t border-line bg-surface-glass px-4 py-2.5 text-xs transition-colors duration-200",children:[a&&y.jsx("div",{role:"status","aria-live":f?"assertive":"polite","aria-atomic":"true",className:`animate-toast-in absolute left-1/2 top-1/2 z-[var(--z-toast)] max-w-[min(80vw,640px)] -translate-x-1/2 -translate-y-1/2 rounded-xl border px-4 py-2 text-xs font-medium glass-panel-strong ${f?"pointer-events-auto flex max-w-[min(70vw,560px)] items-center gap-2.5 border-status-danger-border text-left text-ink":"pointer-events-none max-w-[min(70vw,560px)] text-center text-ink"}`,children:f?y.jsxs(y.Fragment,{children:[y.jsx(X0,{className:"h-3.5 w-3.5 shrink-0 text-status-danger-text/80","aria-hidden":"true"}),y.jsx("span",{className:"min-w-0 flex-1",children:a.message}),c&&y.jsx("button",{type:"button",onClick:c,"aria-label":"Dismiss error",className:"shrink-0 rounded-md p-0.5 text-status-danger-text/60 hover:bg-elevated hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-status-danger-border transition-colors",children:y.jsx(Ui,{className:"h-3.5 w-3.5"})})]}):a.message}),y.jsxs("div",{className:"flex min-w-0 items-center gap-3",children:[e&&y.jsx(MD,{directory:o}),l!==void 0&&l!==i&&y.jsxs("span",{"data-testid":"action-bar-count",className:"text-ink-muted",children:["Showing ",i," of ",l]})]}),y.jsxs("button",{onClick:n,disabled:!t||e,className:"flex shrink-0 items-center gap-2 rounded-xl border border-emerald-300/50 bg-gradient-to-b from-emerald-400/90 to-emerald-600/90 px-5 py-2 font-semibold text-white shadow-[inset_0_1px_0_rgb(255_255_255/0.35),0_8px_24px_-6px_rgb(16_185_129/0.55)] transition-[filter,box-shadow,transform] hover:-translate-y-px hover:brightness-110 hover:shadow-[inset_0_1px_0_rgb(255_255_255/0.35),0_12px_30px_-6px_rgb(16_185_129/0.7)] disabled:opacity-40 disabled:hover:translate-y-0 disabled:hover:brightness-100 disabled:hover:shadow-[inset_0_1px_0_rgb(255_255_255/0.35),0_8px_24px_-6px_rgb(16_185_129/0.55)] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-emerald-400",children:[y.jsx(Jl,{className:"h-3.5 w-3.5 fill-current"}),y.jsx("span",{children:"Execute"}),y.jsx("kbd",{className:"rounded bg-emerald-800/60 px-1.5 py-0.5 text-[10px] text-emerald-200 shadow-[inset_0_1px_0_rgb(255_255_255/0.12)]",children:"↵"})]})]})}let K0=[],aO=[];(()=>{let n="lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,1n,9,16,o,,x,1i,3,,i,,7,a,2,t,3,1k,,,7,2,2,2,3,9,,a,2,q,,2,3,1k,,,5,4,2,2,3,3,,u,2,3,,b,3,1k,,,8,,3,,3,k,2,m,6,,3,1k,,,7,2,2,2,3,7,3,a,2,u,,1n,5,3,3,,4,9,,14,5,1j,,,7,,3,,4,7,2,b,2,t,3,1k,,,7,,3,,4,7,2,b,2,f,,c,4,1j,2,,7,,3,,4,9,,a,2,t,3,1y,,4,6,,,,8,i,2,1p,,,8,c,8,2q,,,a,b,7,21,2,r,,,,,,4,2,1d,k,,2,5,b,,10,9,,2u,b,,6,n,4,4,3,g,4,d,,,3,6,,f,,jj,3,qa,4,s,3,t,2,u,2,1s,w,9,,19,3,,,39,2,y,,3a,c,4,c,63,5,1l,a,,,,,2,o,2,,1c,1a,2,c,k,5,1b,h,12,9,c,3,u,d,1k,e,1c,k,48,3,,l,4,,6,,2,3,5i,1s,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,n,5,4,,2b,2,1e,i,q,i,d,,12,8,p,d,18,4,1b,e,10,,1v,e,c,,8,2,1a,,1f,,,3,2,2,5,2,,,15,5,5,2,6k,8,,2,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,1t,5,8t,2,25,6,1y,b,1d,4,3e,3,1h,f,15,,2,2,a,4,19,b,7,,1p,3,10,e,g,2,18,,c,3,1c,e,8,4,,2,2k,c,6,,2,,4d,c,l,4,1j,2,,7,2,2,2,3,9,,a,2,2,7,3,5,1v,9,,,2,,,4,,5,,,e,2,2a,i,n,,29,k,6j,7,2,9,r,2,2a,h,2y,d,2t,3,2,a,74,f,6t,6,,2,2,4,,,,2,3x,7,2,7,3,,s,a,14,7,,4,8,,9,b,1a,g,5i,8,5j,8,,8,2a,m,,e,3e,6,3,,,2,,7,,,1u,5,,2,,5,9n,4,9,2,,,1c,7,3,5,n,,44l,,6,f,8ug,i,1xc,5,1n,7,t4,,,1j,7,4,29,,b,2,f57,2,3mp,1a,2,n,f2,5,3,6,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,2s,,4g,7,af,,1p,4,e4,4,72,2,6r,,2,,7,2,5,,d6,7,31,7,240,5".split(",").map(e=>e?parseInt(e,36):1);for(let e=0,t=0;e>1;if(n=aO[i])e=i+1;else return!0;if(e==t)return!1}}function Vk(n){return n>=127462&&n<=127487}const Qk=8205;function jD(n,e,t=!0,i=!0){return(t?uO:_D)(n,e,i)}function uO(n,e,t){if(e==n.length)return e;e&&cO(n.charCodeAt(e))&&fO(n.charCodeAt(e-1))&&e--;let i=Yg(n,e);for(e+=Xk(i);e=0&&Vk(Yg(n,a));)o++,a-=2;if(o%2==0)break;e+=2}else break}return e}function _D(n,e,t){for(;e>1;){let i=uO(n,e-2,t);if(i=56320&&n<57344}function fO(n){return n>=55296&&n<56320}function Xk(n){return n<65536?1:2}class pt{lineAt(e){if(e<0||e>this.length)throw new RangeError(`Invalid position ${e} in document of length ${this.length}`);return this.lineInner(e,!1,1,0)}line(e){if(e<1||e>this.lines)throw new RangeError(`Invalid line number ${e} in ${this.lines}-line document`);return this.lineInner(e,!0,1,0)}replace(e,t,i){[e,t]=Oa(this,e,t);let l=[];return this.decompose(0,e,l,2),i.length&&i.decompose(0,i.length,l,3),this.decompose(t,this.length,l,1),Or.from(l,this.length-(t-e)+i.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,t=this.length){[e,t]=Oa(this,e,t);let i=[];return this.decompose(e,t,i,0),Or.from(i,t-e)}eq(e){if(e==this)return!0;if(e.length!=this.length||e.lines!=this.lines)return!1;let t=this.scanIdentical(e,1),i=this.length-this.scanIdentical(e,-1),l=new Yu(this),o=new Yu(e);for(let a=t,c=t;;){if(l.next(a),o.next(a),a=0,l.lineBreak!=o.lineBreak||l.done!=o.done||l.value!=o.value)return!1;if(c+=l.value.length,l.done||c>=i)return!0}}iter(e=1){return new Yu(this,e)}iterRange(e,t=this.length){return new hO(this,e,t)}iterLines(e,t){let i;if(e==null)i=this.iter();else{t==null&&(t=this.lines+1);let l=this.line(e).from;i=this.iterRange(l,Math.max(l,t==this.lines+1?this.length:t<=1?0:this.line(t-1).to))}return new dO(i)}toString(){return this.sliceString(0)}toJSON(){let e=[];return this.flatten(e),e}constructor(){}static of(e){if(e.length==0)throw new RangeError("A document must have at least one line");return e.length==1&&!e[0]?pt.empty:e.length<=32?new Jt(e):Or.from(Jt.split(e,[]))}}class Jt extends pt{constructor(e,t=LD(e)){super(),this.text=e,this.length=t}get lines(){return this.text.length}get children(){return null}lineInner(e,t,i,l){for(let o=0;;o++){let a=this.text[o],c=l+a.length;if((t?i:c)>=e)return new zD(l,c,i,a);l=c+1,i++}}decompose(e,t,i,l){let o=e<=0&&t>=this.length?this:new Jt($k(this.text,e,t),Math.min(t,this.length)-Math.max(0,e));if(l&1){let a=i.pop(),c=Yh(o.text,a.text.slice(),0,o.length);if(c.length<=32)i.push(new Jt(c,a.length+o.length));else{let f=c.length>>1;i.push(new Jt(c.slice(0,f)),new Jt(c.slice(f)))}}else i.push(o)}replace(e,t,i){if(!(i instanceof Jt))return super.replace(e,t,i);[e,t]=Oa(this,e,t);let l=Yh(this.text,Yh(i.text,$k(this.text,0,e)),t),o=this.length+i.length-(t-e);return l.length<=32?new Jt(l,o):Or.from(Jt.split(l,[]),o)}sliceString(e,t=this.length,i=` -`){[e,t]=Oa(this,e,t);let l="";for(let o=0,a=0;o<=t&&ae&&a&&(l+=i),eo&&(l+=c.slice(Math.max(0,e-o),t-o)),o=f+1}return l}flatten(e){for(let t of this.text)e.push(t)}scanIdentical(){return 0}static split(e,t){let i=[],l=-1;for(let o of e)i.push(o),l+=o.length+1,i.length==32&&(t.push(new Jt(i,l)),i=[],l=-1);return l>-1&&t.push(new Jt(i,l)),t}}class Or extends pt{constructor(e,t){super(),this.children=e,this.length=t,this.lines=0;for(let i of e)this.lines+=i.lines}lineInner(e,t,i,l){for(let o=0;;o++){let a=this.children[o],c=l+a.length,f=i+a.lines-1;if((t?f:c)>=e)return a.lineInner(e,t,i,l);l=c+1,i=f+1}}decompose(e,t,i,l){for(let o=0,a=0;a<=t&&o=a){let d=l&((a<=e?1:0)|(f>=t?2:0));a>=e&&f<=t&&!d?i.push(c):c.decompose(e-a,t-a,i,d)}a=f+1}}replace(e,t,i){if([e,t]=Oa(this,e,t),i.lines=o&&t<=c){let f=a.replace(e-o,t-o,i),d=this.lines-a.lines+f.lines;if(f.lines>4&&f.lines>d>>6){let p=this.children.slice();return p[l]=f,new Or(p,this.length-(t-e)+i.length)}return super.replace(o,c,f)}o=c+1}return super.replace(e,t,i)}sliceString(e,t=this.length,i=` -`){[e,t]=Oa(this,e,t);let l="";for(let o=0,a=0;oe&&o&&(l+=i),ea&&(l+=c.sliceString(e-a,t-a,i)),a=f+1}return l}flatten(e){for(let t of this.children)t.flatten(e)}scanIdentical(e,t){if(!(e instanceof Or))return 0;let i=0,[l,o,a,c]=t>0?[0,0,this.children.length,e.children.length]:[this.children.length-1,e.children.length-1,-1,-1];for(;;l+=t,o+=t){if(l==a||o==c)return i;let f=this.children[l],d=e.children[o];if(f!=d)return i+f.scanIdentical(d,t);i+=f.length+1}}static from(e,t=e.reduce((i,l)=>i+l.length+1,-1)){let i=0;for(let v of e)i+=v.lines;if(i<32){let v=[];for(let w of e)w.flatten(v);return new Jt(v,t)}let l=Math.max(32,i>>5),o=l<<1,a=l>>1,c=[],f=0,d=-1,p=[];function g(v){let w;if(v.lines>o&&v instanceof Or)for(let S of v.children)g(S);else v.lines>a&&(f>a||!f)?(b(),c.push(v)):v instanceof Jt&&f&&(w=p[p.length-1])instanceof Jt&&v.lines+w.lines<=32?(f+=v.lines,d+=v.length+1,p[p.length-1]=new Jt(w.text.concat(v.text),w.length+1+v.length)):(f+v.lines>l&&b(),f+=v.lines,d+=v.length+1,p.push(v))}function b(){f!=0&&(c.push(p.length==1?p[0]:Or.from(p,d)),d=-1,f=p.length=0)}for(let v of e)g(v);return b(),c.length==1?c[0]:new Or(c,t)}}pt.empty=new Jt([""],0);function LD(n){let e=-1;for(let t of n)e+=t.length+1;return e}function Yh(n,e,t=0,i=1e9){for(let l=0,o=0,a=!0;o=t&&(f>i&&(c=c.slice(0,i-l)),l0?1:(e instanceof Jt?e.text.length:e.children.length)<<1]}nextInner(e,t){for(this.done=this.lineBreak=!1;;){let i=this.nodes.length-1,l=this.nodes[i],o=this.offsets[i],a=o>>1,c=l instanceof Jt?l.text.length:l.children.length;if(a==(t>0?c:0)){if(i==0)return this.done=!0,this.value="",this;t>0&&this.offsets[i-1]++,this.nodes.pop(),this.offsets.pop()}else if((o&1)==(t>0?0:1)){if(this.offsets[i]+=t,e==0)return this.lineBreak=!0,this.value=` -`,this;e--}else if(l instanceof Jt){let f=l.text[a+(t<0?-1:0)];if(this.offsets[i]+=t,f.length>Math.max(0,e))return this.value=e==0?f:t>0?f.slice(e):f.slice(0,f.length-e),this;e-=f.length}else{let f=l.children[a+(t<0?-1:0)];e>f.length?(e-=f.length,this.offsets[i]+=t):(t<0&&this.offsets[i]--,this.nodes.push(f),this.offsets.push(t>0?1:(f instanceof Jt?f.text.length:f.children.length)<<1))}}}next(e=0){return e<0&&(this.nextInner(-e,-this.dir),e=this.value.length),this.nextInner(e,this.dir)}}class hO{constructor(e,t,i){this.value="",this.done=!1,this.cursor=new Yu(e,t>i?-1:1),this.pos=t>i?e.length:0,this.from=Math.min(t,i),this.to=Math.max(t,i)}nextInner(e,t){if(t<0?this.pos<=this.from:this.pos>=this.to)return this.value="",this.done=!0,this;e+=Math.max(0,t<0?this.pos-this.to:this.from-this.pos);let i=t<0?this.pos-this.from:this.to-this.pos;e>i&&(e=i),i-=e;let{value:l}=this.cursor.next(e);return this.pos+=(l.length+e)*t,this.value=l.length<=i?l:t<0?l.slice(l.length-i):l.slice(0,i),this.done=!this.value,this}next(e=0){return e<0?e=Math.max(e,this.from-this.pos):e>0&&(e=Math.min(e,this.to-this.pos)),this.nextInner(e,this.cursor.dir)}get lineBreak(){return this.cursor.lineBreak&&this.value!=""}}class dO{constructor(e){this.inner=e,this.afterBreak=!0,this.value="",this.done=!1}next(e=0){let{done:t,lineBreak:i,value:l}=this.inner.next(e);return t&&this.afterBreak?(this.value="",this.afterBreak=!1):t?(this.done=!0,this.value=""):i?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=l,this.afterBreak=!1),this}get lineBreak(){return!1}}typeof Symbol<"u"&&(pt.prototype[Symbol.iterator]=function(){return this.iter()},Yu.prototype[Symbol.iterator]=hO.prototype[Symbol.iterator]=dO.prototype[Symbol.iterator]=function(){return this});class zD{constructor(e,t,i,l){this.from=e,this.to=t,this.number=i,this.text=l}get length(){return this.to-this.from}}function Oa(n,e,t){return e=Math.max(0,Math.min(n.length,e)),[e,Math.max(e,Math.min(n.length,t))]}function yn(n,e,t=!0,i=!0){return jD(n,e,t,i)}function BD(n){return n>=56320&&n<57344}function PD(n){return n>=55296&&n<56320}function oi(n,e){let t=n.charCodeAt(e);if(!PD(t)||e+1==n.length)return t;let i=n.charCodeAt(e+1);return BD(i)?(t-55296<<10)+(i-56320)+65536:t}function my(n){return n<=65535?String.fromCharCode(n):(n-=65536,String.fromCharCode((n>>10)+55296,(n&1023)+56320))}function Nr(n){return n<65536?1:2}const W0=/\r\n?|\n/;var Yn=(function(n){return n[n.Simple=0]="Simple",n[n.TrackDel=1]="TrackDel",n[n.TrackBefore=2]="TrackBefore",n[n.TrackAfter=3]="TrackAfter",n})(Yn||(Yn={}));class Dr{constructor(e){this.sections=e}get length(){let e=0;for(let t=0;te)return o+(e-l);o+=c}else{if(i!=Yn.Simple&&d>=e&&(i==Yn.TrackDel&&le||i==Yn.TrackBefore&&le))return null;if(d>e||d==e&&t<0&&!c)return e==l||t<0?o:o+f;o+=f}l=d}if(e>l)throw new RangeError(`Position ${e} is out of range for changeset of length ${l}`);return o}touchesRange(e,t=e){for(let i=0,l=0;i=0&&l<=t&&c>=e)return lt?"cover":!0;l=c}return!1}toString(){let e="";for(let t=0;t=0?":"+l:"")}return e}toJSON(){return this.sections}static fromJSON(e){if(!Array.isArray(e)||e.length%2||e.some(t=>typeof t!="number"))throw new RangeError("Invalid JSON representation of ChangeDesc");return new Dr(e)}static create(e){return new Dr(e)}}class fn extends Dr{constructor(e,t){super(e),this.inserted=t}apply(e){if(this.length!=e.length)throw new RangeError("Applying change set to a document with the wrong length");return Z0(this,(t,i,l,o,a)=>e=e.replace(l,l+(i-t),a),!1),e}mapDesc(e,t=!1){return J0(this,e,t,!0)}invert(e){let t=this.sections.slice(),i=[];for(let l=0,o=0;l=0){t[l]=c,t[l+1]=a;let f=l>>1;for(;i.length0&&$l(i,t,o.text),o.forward(p),c+=p}let d=e[a++];for(;c>1].toJSON()))}return e}static of(e,t,i){let l=[],o=[],a=0,c=null;function f(p=!1){if(!p&&!l.length)return;ab||g<0||b>t)throw new RangeError(`Invalid change range ${g} to ${b} (in doc of length ${t})`);let w=v?typeof v=="string"?pt.of(v.split(i||W0)):v:pt.empty,S=w.length;if(g==b&&S==0)return;ga&&zn(l,g-a,-1),zn(l,b-g,S),$l(o,l,w),a=b}}return d(e),f(!c),c}static empty(e){return new fn(e?[e,-1]:[],[])}static fromJSON(e){if(!Array.isArray(e))throw new RangeError("Invalid JSON representation of ChangeSet");let t=[],i=[];for(let l=0;lc&&typeof a!="string"))throw new RangeError("Invalid JSON representation of ChangeSet");if(o.length==1)t.push(o[0],0);else{for(;i.length=0&&t<=0&&t==n[l+1]?n[l]+=e:l>=0&&e==0&&n[l]==0?n[l+1]+=t:i?(n[l]+=e,n[l+1]+=t):n.push(e,t)}function $l(n,e,t){if(t.length==0)return;let i=e.length-2>>1;if(i>1])),!(t||a==n.sections.length||n.sections[a+1]<0);)c=n.sections[a++],f=n.sections[a++];e(l,d,o,p,g),l=d,o=p}}}function J0(n,e,t,i=!1){let l=[],o=i?[]:null,a=new sc(n),c=new sc(e);for(let f=-1;;){if(a.done&&c.len||c.done&&a.len)throw new Error("Mismatched change set lengths");if(a.ins==-1&&c.ins==-1){let d=Math.min(a.len,c.len);zn(l,d,-1),a.forward(d),c.forward(d)}else if(c.ins>=0&&(a.ins<0||f==a.i||a.off==0&&(c.len=0&&f=0){let d=0,p=a.len;for(;p;)if(c.ins==-1){let g=Math.min(p,c.len);d+=g,p-=g,c.forward(g)}else if(c.ins==0&&c.lenf||a.ins>=0&&a.len>f)&&(c||i.length>d),o.forward2(f),a.forward(f)}}}}class sc{constructor(e){this.set=e,this.i=0,this.next()}next(){let{sections:e}=this.set;this.i>1;return t>=e.length?pt.empty:e[t]}textBit(e){let{inserted:t}=this.set,i=this.i-2>>1;return i>=t.length&&!e?pt.empty:t[i].slice(this.off,e==null?void 0:this.off+e)}forward(e){e==this.len?this.next():(this.len-=e,this.off+=e)}forward2(e){this.ins==-1?this.forward(e):e==this.ins?this.next():(this.ins-=e,this.off+=e)}}class Ql{constructor(e,t,i,l){this.from=e,this.to=t,this.flags=i,this.goalColumn=l}get anchor(){return this.flags&32?this.to:this.from}get head(){return this.flags&32?this.from:this.to}get empty(){return this.from==this.to}get assoc(){return this.flags&8?-1:this.flags&16?1:0}get undirectional(){return(this.flags&64)>0}get bidiLevel(){let e=this.flags&7;return e==7?null:e}map(e,t=-1){let i,l;return this.empty?i=l=e.mapPos(this.from,t):(i=e.mapPos(this.from,1),l=e.mapPos(this.to,-1)),i==this.from&&l==this.to?this:new Ql(i,l,this.flags,this.goalColumn)}extend(e,t=e,i=0){if(e<=this.anchor&&t>=this.anchor)return oe.range(e,t,void 0,void 0,i);let l=Math.abs(e-this.anchor)>Math.abs(t-this.anchor)?e:t;return oe.range(this.anchor,l,void 0,void 0,i)}eq(e,t=!1){return this.anchor==e.anchor&&this.head==e.head&&this.goalColumn==e.goalColumn&&(!t||!this.empty||this.assoc==e.assoc)}toJSON(){return{anchor:this.anchor,head:this.head}}static fromJSON(e){if(!e||typeof e.anchor!="number"||typeof e.head!="number")throw new RangeError("Invalid JSON representation for SelectionRange");return oe.range(e.anchor,e.head)}static create(e,t,i,l){return new Ql(e,t,i,l)}}class oe{constructor(e,t){this.ranges=e,this.mainIndex=t}map(e,t=-1){return e.empty?this:oe.create(this.ranges.map(i=>i.map(e,t)),this.mainIndex)}eq(e,t=!1){if(this.ranges.length!=e.ranges.length||this.mainIndex!=e.mainIndex)return!1;for(let i=0;ie.toJSON()),main:this.mainIndex}}static fromJSON(e){if(!e||!Array.isArray(e.ranges)||typeof e.main!="number"||e.main>=e.ranges.length)throw new RangeError("Invalid JSON representation for EditorSelection");return new oe(e.ranges.map(t=>Ql.fromJSON(t)),e.main)}static single(e,t=e){return new oe([oe.range(e,t)],0)}static create(e,t=0){if(e.length==0)throw new RangeError("A selection needs at least one range");for(let i=0,l=0;ll.from-o.from),t=e.indexOf(i);for(let l=1;lo.head?oe.range(f,c):oe.range(c,f))}}return new oe(e,t)}}function mO(n,e){for(let t of n.ranges)if(t.to>e)throw new RangeError("Selection points outside of document")}let gy=0;class Ce{constructor(e,t,i,l,o){this.combine=e,this.compareInput=t,this.compare=i,this.isStatic=l,this.id=gy++,this.default=e([]),this.extensions=typeof o=="function"?o(this):o}get reader(){return this}static define(e={}){return new Ce(e.combine||(t=>t),e.compareInput||((t,i)=>t===i),e.compare||(e.combine?(t,i)=>t===i:xy),!!e.static,e.enables)}of(e){return new Kh([],this,0,e)}compute(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new Kh(e,this,1,t)}computeN(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new Kh(e,this,2,t)}from(e,t){return t||(t=i=>i),this.compute([e],i=>t(i.field(e)))}}function xy(n,e){return n==e||n.length==e.length&&n.every((t,i)=>t===e[i])}class Kh{constructor(e,t,i,l){this.dependencies=e,this.facet=t,this.type=i,this.value=l,this.id=gy++}dynamicSlot(e){var t;let i=this.value,l=this.facet.compareInput,o=this.id,a=e[o]>>1,c=this.type==2,f=!1,d=!1,p=[];for(let g of this.dependencies)g=="doc"?f=!0:g=="selection"?d=!0:(((t=e[g.id])!==null&&t!==void 0?t:1)&1)==0&&p.push(e[g.id]);return{create(g){return g.values[a]=i(g),1},update(g,b){if(f&&b.docChanged||d&&(b.docChanged||b.selection)||ex(g,p)){let v=i(g);if(c?!Gk(v,g.values[a],l):!l(v,g.values[a]))return g.values[a]=v,1}return 0},reconfigure:(g,b)=>{let v,w=b.config.address[o];if(w!=null){let S=ud(b,w);if(this.dependencies.every(C=>C instanceof Ce?b.facet(C)===g.facet(C):C instanceof Pn?b.field(C,!1)==g.field(C,!1):!0)||(c?Gk(v=i(g),S,l):l(v=i(g),S)))return g.values[a]=S,0}else v=i(g);return g.values[a]=v,1}}}get extension(){return this}}function Gk(n,e,t){if(n.length!=e.length)return!1;for(let i=0;in[f.id]),l=t.map(f=>f.type),o=i.filter(f=>!(f&1)),a=n[e.id]>>1;function c(f){let d=[];for(let p=0;pi===l),e);return e.provide&&(t.provides=e.provide(t)),t}create(e){let t=e.facet(hh).find(i=>i.field==this);return((t==null?void 0:t.create)||this.createF)(e)}slot(e){let t=e[this.id]>>1;return{create:i=>(i.values[t]=this.create(i),1),update:(i,l)=>{let o=i.values[t],a=this.updateF(o,l);return this.compareF(o,a)?0:(i.values[t]=a,1)},reconfigure:(i,l)=>{let o=i.facet(hh),a=l.facet(hh),c;return(c=o.find(f=>f.field==this))&&c!=a.find(f=>f.field==this)?(i.values[t]=c.create(i),1):l.config.address[this.id]!=null?(i.values[t]=l.field(this),0):(i.values[t]=this.create(i),1)}}}init(e){return[this,hh.of({field:this,create:e})]}get extension(){return this}}const $s={lowest:4,low:3,default:2,high:1,highest:0};function Lu(n){return e=>new gO(e,n)}const oo={highest:Lu($s.highest),high:Lu($s.high),default:Lu($s.default),low:Lu($s.low),lowest:Lu($s.lowest)};class gO{constructor(e,t){this.inner=e,this.prec=t}get extension(){return this}}class $d{of(e){return new tx(this,e)}reconfigure(e){return $d.reconfigure.of({compartment:this,extension:e})}get(e){return e.config.compartments.get(this)}}class tx{constructor(e,t){this.compartment=e,this.inner=t}get extension(){return this}}class ad{constructor(e,t,i,l,o,a){for(this.base=e,this.compartments=t,this.dynamicSlots=i,this.address=l,this.staticValues=o,this.facets=a,this.statusTemplate=[];this.statusTemplate.length>1]}static resolve(e,t,i){let l=[],o=Object.create(null),a=new Map;for(let b of ID(e,t,a))b instanceof Pn?l.push(b):(o[b.facet.id]||(o[b.facet.id]=[])).push(b);let c=Object.create(null),f=[],d=[];for(let b of l)c[b.id]=d.length<<1,d.push(v=>b.slot(v));let p=i==null?void 0:i.config.facets;for(let b in o){let v=o[b],w=v[0].facet,S=p&&p[b]||[];if(v.every(C=>C.type==0))if(c[w.id]=f.length<<1|1,xy(S,v))f.push(i.facet(w));else{let C=w.combine(v.map(O=>O.value));f.push(i&&w.compare(C,i.facet(w))?i.facet(w):C)}else{for(let C of v)C.type==0?(c[C.id]=f.length<<1|1,f.push(C.value)):(c[C.id]=d.length<<1,d.push(O=>C.dynamicSlot(O)));c[w.id]=d.length<<1,d.push(C=>HD(C,w,v))}}let g=d.map(b=>b(c));return new ad(e,a,g,c,f,o)}}function ID(n,e,t){let i=[[],[],[],[],[]],l=new Map;function o(a,c){let f=l.get(a);if(f!=null){if(f<=c)return;let d=i[f].indexOf(a);d>-1&&i[f].splice(d,1),a instanceof tx&&t.delete(a.compartment)}if(l.set(a,c),Array.isArray(a))for(let d of a)o(d,c);else if(a instanceof tx){if(t.has(a.compartment))throw new RangeError("Duplicate use of compartment in extensions");let d=e.get(a.compartment)||a.inner;t.set(a.compartment,d),o(d,c)}else if(a instanceof gO)o(a.inner,a.prec);else if(a instanceof Pn)i[c].push(a),a.provides&&o(a.provides,c);else if(a instanceof Kh)i[c].push(a),a.facet.extensions&&o(a.facet.extensions,$s.default);else{let d=a.extension;if(!d)throw new Error(`Unrecognized extension value in extension set (${a}).`);if(d==a)throw new Error(`Unrecognized extension value in extension set (${a}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);o(d,c)}}return o(n,$s.default),i.reduce((a,c)=>a.concat(c))}function Ku(n,e){if(e&1)return 2;let t=e>>1,i=n.status[t];if(i==4)throw new Error("Cyclic dependency between fields and/or facets");if(i&2)return i;n.status[t]=4;let l=n.computeSlot(n,n.config.dynamicSlots[t]);return n.status[t]=2|l}function ud(n,e){return e&1?n.config.staticValues[e>>1]:n.values[e>>1]}const xO=Ce.define(),nx=Ce.define({combine:n=>n.some(e=>e),static:!0}),yO=Ce.define({combine:n=>n.length?n[0]:void 0,static:!0}),bO=Ce.define(),vO=Ce.define(),wO=Ce.define(),kO=Ce.define({combine:n=>n.length?n[0]:!1});class al{constructor(e,t){this.type=e,this.value=t}static define(){return new UD}}class UD{of(e){return new al(this,e)}}class FD{constructor(e){this.map=e}of(e){return new Ye(this,e)}}class Ye{constructor(e,t){this.type=e,this.value=t}map(e){let t=this.type.map(this.value,e);return t===void 0?void 0:t==this.value?this:new Ye(this.type,t)}is(e){return this.type==e}static define(e={}){return new FD(e.map||(t=>t))}static mapEffects(e,t){if(!e.length)return e;let i=[];for(let l of e){let o=l.map(t);o&&i.push(o)}return i}}Ye.reconfigure=Ye.define();Ye.appendConfig=Ye.define();class hn{constructor(e,t,i,l,o,a){this.startState=e,this.changes=t,this.selection=i,this.effects=l,this.annotations=o,this.scrollIntoView=a,this._doc=null,this._state=null,i&&mO(i,t.newLength),o.some(c=>c.type==hn.time)||(this.annotations=o.concat(hn.time.of(Date.now())))}static create(e,t,i,l,o,a){return new hn(e,t,i,l,o,a)}get newDoc(){return this._doc||(this._doc=this.changes.apply(this.startState.doc))}get newSelection(){return this.selection||this.startState.selection.map(this.changes)}get state(){return this._state||this.startState.applyTransaction(this),this._state}annotation(e){for(let t of this.annotations)if(t.type==e)return t.value}get docChanged(){return!this.changes.empty}get reconfigured(){return this.startState.config!=this.state.config}isUserEvent(e){let t=this.annotation(hn.userEvent);return!!(t&&(t==e||t.length>e.length&&t.slice(0,e.length)==e&&t[e.length]=="."))}}hn.time=al.define();hn.userEvent=al.define();hn.addToHistory=al.define();hn.remote=al.define();function qD(n,e){let t=[];for(let i=0,l=0;;){let o,a;if(i=n[i]))o=n[i++],a=n[i++];else if(l=0;l--){let o=i[l](n);o instanceof hn?n=o:Array.isArray(o)&&o.length==1&&o[0]instanceof hn?n=o[0]:n=CO(e,ma(o),!1)}return n}function QD(n){let e=n.startState,t=e.facet(wO),i=n;for(let l=t.length-1;l>=0;l--){let o=t[l](n);o&&Object.keys(o).length&&(i=SO(i,ix(e,o,n.changes.newLength),!0))}return i==n?n:hn.create(e,n.changes,n.selection,i.effects,i.annotations,i.scrollIntoView)}const XD=[];function ma(n){return n==null?XD:Array.isArray(n)?n:[n]}var Ut=(function(n){return n[n.Word=0]="Word",n[n.Space=1]="Space",n[n.Other=2]="Other",n})(Ut||(Ut={}));const $D=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;let rx;try{rx=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch{}function GD(n){if(rx)return rx.test(n);for(let e=0;e"€"&&(t.toUpperCase()!=t.toLowerCase()||$D.test(t)))return!0}return!1}function YD(n){return e=>{if(!/\S/.test(e))return Ut.Space;if(GD(e))return Ut.Word;for(let t=0;t-1)return Ut.Word;return Ut.Other}}class mt{constructor(e,t,i,l,o,a){this.config=e,this.doc=t,this.selection=i,this.values=l,this.status=e.statusTemplate.slice(),this.computeSlot=o,a&&(a._state=this);for(let c=0;cl.set(d,f)),t=null),l.set(c.value.compartment,c.value.extension)):c.is(Ye.reconfigure)?(t=null,i=c.value):c.is(Ye.appendConfig)&&(t=null,i=ma(i).concat(c.value));let o;t?o=e.startState.values.slice():(t=ad.resolve(i,l,this),o=new mt(t,this.doc,this.selection,t.dynamicSlots.map(()=>null),(f,d)=>d.reconfigure(f,this),null).values);let a=e.startState.facet(nx)?e.newSelection:e.newSelection.asSingle();new mt(t,e.newDoc,a,o,(c,f)=>f.update(c,e),e)}replaceSelection(e){return typeof e=="string"&&(e=this.toText(e)),this.changeByRange(t=>({changes:{from:t.from,to:t.to,insert:e},range:oe.cursor(t.from+e.length,-1)}))}changeByRange(e){let t=this.selection,i=e(t.ranges[0]),l=this.changes(i.changes),o=[i.range],a=ma(i.effects);for(let c=1;ca.spec.fromJSON(c,f)))}}return mt.create({doc:e.doc,selection:oe.fromJSON(e.selection),extensions:t.extensions?l.concat([t.extensions]):l})}static create(e={}){let t=ad.resolve(e.extensions||[],new Map),i=e.doc instanceof pt?e.doc:pt.of((e.doc||"").split(t.staticFacet(mt.lineSeparator)||W0)),l=e.selection?e.selection instanceof oe?e.selection:oe.single(e.selection.anchor,e.selection.head):oe.single(0);return mO(l,i.length),t.staticFacet(nx)||(l=l.asSingle()),new mt(t,i,l,t.dynamicSlots.map(()=>null),(o,a)=>a.create(o),null)}get tabSize(){return this.facet(mt.tabSize)}get lineBreak(){return this.facet(mt.lineSeparator)||` -`}get readOnly(){return this.facet(kO)}phrase(e,...t){for(let i of this.facet(mt.phrases))if(Object.prototype.hasOwnProperty.call(i,e)){e=i[e];break}return t.length&&(e=e.replace(/\$(\$|\d*)/g,(i,l)=>{if(l=="$")return"$";let o=+(l||1);return!o||o>t.length?i:t[o-1]})),e}languageDataAt(e,t,i=-1){let l=[];for(let o of this.facet(xO))for(let a of o(this,t,i))Object.prototype.hasOwnProperty.call(a,e)&&l.push(a[e]);return l}charCategorizer(e){let t=this.languageDataAt("wordChars",e);return YD(t.length?t[0]:"")}wordAt(e){let{text:t,from:i,length:l}=this.doc.lineAt(e),o=this.charCategorizer(e),a=e-i,c=e-i;for(;a>0;){let f=yn(t,a,!1);if(o(t.slice(f,a))!=Ut.Word)break;a=f}for(;cn.length?n[0]:4});mt.lineSeparator=yO;mt.readOnly=kO;mt.phrases=Ce.define({compare(n,e){let t=Object.keys(n),i=Object.keys(e);return t.length==i.length&&t.every(l=>n[l]==e[l])}});mt.languageData=xO;mt.changeFilter=bO;mt.transactionFilter=vO;mt.transactionExtender=wO;$d.reconfigure=Ye.define();function jr(n,e,t={}){let i={};for(let l of n)for(let o of Object.keys(l)){let a=l[o],c=i[o];if(c===void 0)i[o]=a;else if(!(c===a||a===void 0))if(Object.hasOwnProperty.call(t,o))i[o]=t[o](c,a);else throw new Error("Config merge conflict for field "+o)}for(let l in e)i[l]===void 0&&(i[l]=e[l]);return i}class es{eq(e){return this==e}range(e,t=e){return lx.create(e,t,this)}}es.prototype.startSide=es.prototype.endSide=0;es.prototype.point=!1;es.prototype.mapMode=Yn.TrackDel;function yy(n,e){return n==e||n.constructor==e.constructor&&n.eq(e)}let lx=class OO{constructor(e,t,i){this.from=e,this.to=t,this.value=i}static create(e,t,i){return new OO(e,t,i)}};function sx(n,e){return n.from-e.from||n.value.startSide-e.value.startSide}class by{constructor(e,t,i,l){this.from=e,this.to=t,this.value=i,this.maxPoint=l}get length(){return na(this.to)}findIndex(e,t,i,l=0){let o=i?this.to:this.from;for(let a=l,c=o.length;;){if(a==c)return a;let f=a+c>>1,d=o[f]-e||(i?this.value[f].endSide:this.value[f].startSide)-t;if(f==a)return d>=0?a:c;d>=0?c=f:a=f+1}}between(e,t,i,l){for(let o=this.findIndex(t,-1e9,!0),a=this.findIndex(i,1e9,!1,o);oC||S==C&&b.startSide>0&&b.endSide<=0)continue;if(!((C-S||b.endSide-b.startSide)<0))if(d<0&&(d=S),b.point&&(p=Math.max(p,C-S)),(S-i||b.startSide-l)>=0)a.push(b),c.push(S-d),f.push(C-d),i=C,l=b.endSide;else{if(S==C)for(let O=a.length;O>0;O--){if((S-(f[O-1]+d)||b.startSide-a[O-1].endSide)>=0){a.splice(O,0,b),c.splice(O,0,S-d),f.splice(O,0,C-d);continue e}if((S-(c[O-1]+d)||b.endSide-a[O-1].startSide)>0)break}o(S,C,b)}}return{mapped:a.length?new by(c,f,a,p):null,pos:d}}}class rt{constructor(e,t,i,l){this.chunkPos=e,this.chunk=t,this.nextLayer=i,this.maxPoint=l}static create(e,t,i,l){return new rt(e,t,i,l)}get length(){let e=this.chunk.length-1;return e<0?0:Math.max(this.chunkEnd(e),this.nextLayer.length)}get size(){if(this.isEmpty)return 0;let e=this.nextLayer.size;for(let t of this.chunk)e+=t.value.length;return e}chunkEnd(e){return this.chunkPos[e]+this.chunk[e].length}update(e){let{add:t=[],sort:i=!1,filterFrom:l=0,filterTo:o=this.length}=e,a=e.filter;if(t.length==0&&!a)return this;if(i&&(t=t.slice().sort(sx)),this.isEmpty)return t.length?rt.of(t):this;let c=new NO(this,null,-1).goto(0),f=0,d=[],p=new Rr;for(;c.value||f=0){let g=t[f++];p.addInner(g.from,g.to,g.value,!1)||d.push(g)}else c.rangeIndex==1&&c.chunkIndexthis.chunkEnd(c.chunkIndex)||oc.to||o{o||(o=new Rr),o.addRange(f,d,p,!1)};for(let f=0;f=o&&e<=o+a.length&&a.between(o,e-o,t-o,i)===!1)return}this.nextLayer.between(e,t,i)}}iter(e=0){return oc.from([this]).goto(e)}get isEmpty(){return this.nextLayer==this}static iter(e,t=0){return oc.from(e).goto(t)}static compare(e,t,i,l,o=-1){let a=e.filter(g=>g.maxPoint>0||!g.isEmpty&&g.maxPoint>=o),c=t.filter(g=>g.maxPoint>0||!g.isEmpty&&g.maxPoint>=o),f=Yk(a,c,i),d=new zu(a,f,o),p=new zu(c,f,o);i.iterGaps((g,b,v)=>Kk(d,g,p,b,v,l)),i.empty&&i.length==0&&Kk(d,0,p,0,0,l)}static eq(e,t,i=0,l){l==null&&(l=999999999);let o=e.filter(p=>!p.isEmpty&&t.indexOf(p)<0),a=t.filter(p=>!p.isEmpty&&e.indexOf(p)<0);if(o.length!=a.length)return!1;if(!o.length)return!0;let c=Yk(o,a),f=new zu(o,c,0).goto(i),d=new zu(a,c,0).goto(i);for(;;){if(f.to!=d.to||!ox(f.active,d.active)||f.point&&(!d.point||!yy(f.point,d.point)))return!1;if(f.to>l)return!0;f.next(),d.next()}}static spans(e,t,i,l,o=-1){let a=new zu(e,null,o).goto(t),c=t,f=a.openStart;for(;;){let d=Math.min(a.to,i);if(a.point){let p=a.activeForPoint(a.to),g=a.pointFromc&&(l.span(c,d,a.active,f),f=a.openEnd(d));if(a.to>i)return f+(a.point&&a.to>i?1:0);c=a.to,a.next()}}static of(e,t=!1){let i=new Rr;for(let l of e instanceof lx?[e]:t?KD(e):e)i.add(l.from,l.to,l.value);return i.finish()}static join(e){if(!e.length)return rt.empty;let t=na(e);for(let i=e.length-2;i>=0;i--)for(let l=e[i];l!=rt.empty;l=l.nextLayer)t=new rt(l.chunkPos,l.chunk,t,Math.max(l.maxPoint,t.maxPoint));return t}}rt.empty=new rt([],[],null,-1);function na(n){return n[n.length-1]}function KD(n){if(n.length>1)for(let e=n[0],t=1;t0)return n.slice().sort(sx);e=i}return n}rt.empty.nextLayer=rt.empty;class Rr{finishChunk(e){this.chunks.push(new by(this.from,this.to,this.value,this.maxPoint)),this.chunkPos.push(this.chunkStart),this.chunkStart=-1,this.setMaxPoint=Math.max(this.setMaxPoint,this.maxPoint),this.maxPoint=-1,e&&(this.from=[],this.to=[],this.value=[])}constructor(){this.chunks=[],this.chunkPos=[],this.chunkStart=-1,this.last=null,this.lastFrom=-1e9,this.lastTo=-1e9,this.from=[],this.to=[],this.value=[],this.maxPoint=-1,this.setMaxPoint=-1,this.nextLayer=null}add(e,t,i){this.addRange(e,t,i,!0)}addRange(e,t,i,l){this.addInner(e,t,i,l)||(this.nextLayer||(this.nextLayer=new Rr)).addRange(e,t,i,l)}addInner(e,t,i,l){let o=e-this.lastTo||i.startSide-this.last.endSide;if(l&&o<=0&&(e-this.lastFrom||i.startSide-this.last.startSide)<0)throw new Error("Ranges must be added sorted by `from` position and `startSide`");return o<0?!1:(this.from.length==250&&this.finishChunk(!0),this.chunkStart<0&&(this.chunkStart=e),this.from.push(e-this.chunkStart),this.to.push(t-this.chunkStart),this.last=i,this.lastFrom=e,this.lastTo=t,this.value.push(i),i.point&&(this.maxPoint=Math.max(this.maxPoint,t-e)),!0)}addChunk(e,t){if((e-this.lastTo||t.value[0].startSide-this.last.endSide)<0)return!1;this.from.length&&this.finishChunk(!0),this.setMaxPoint=Math.max(this.setMaxPoint,t.maxPoint),this.chunks.push(t),this.chunkPos.push(e);let i=t.value.length-1;return this.last=t.value[i],this.lastFrom=t.from[i]+e,this.lastTo=t.to[i]+e,!0}finish(){return this.finishInner(rt.empty)}finishInner(e){if(this.from.length&&this.finishChunk(!1),this.chunks.length==0)return e;let t=rt.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(e):e,this.setMaxPoint);return this.from=null,t}}function Yk(n,e,t){let i=new Map;for(let o of n)for(let a=0;a=this.minPoint)break}}setRangeIndex(e){if(e==this.layer.chunk[this.chunkIndex].value.length){if(this.chunkIndex++,this.skip)for(;this.chunkIndex=i&&l.push(new NO(a,t,i,o));return l.length==1?l[0]:new oc(l)}get startSide(){return this.value?this.value.startSide:0}goto(e,t=-1e9){for(let i of this.heap)i.goto(e,t);for(let i=this.heap.length>>1;i>=0;i--)Kg(this.heap,i);return this.next(),this}forward(e,t){for(let i of this.heap)i.forward(e,t);for(let i=this.heap.length>>1;i>=0;i--)Kg(this.heap,i);(this.to-e||this.value.endSide-t)<0&&this.next()}next(){if(this.heap.length==0)this.from=this.to=1e9,this.value=null,this.rank=-1;else{let e=this.heap[0];this.from=e.from,this.to=e.to,this.value=e.value,this.rank=e.rank,e.value&&e.next(),Kg(this.heap,0)}}}function Kg(n,e){for(let t=n[e];;){let i=(e<<1)+1;if(i>=n.length)break;let l=n[i];if(i+1=0&&(l=n[i+1],i++),t.compare(l)<0)break;n[i]=t,n[e]=l,e=i}}class zu{constructor(e,t,i){this.minPoint=i,this.active=[],this.activeTo=[],this.activeRank=[],this.minActive=-1,this.point=null,this.pointFrom=0,this.pointRank=0,this.to=-1e9,this.endSide=0,this.openStart=-1,this.cursor=oc.from(e,t,i)}goto(e,t=-1e9){return this.cursor.goto(e,t),this.active.length=this.activeTo.length=this.activeRank.length=0,this.minActive=-1,this.to=e,this.endSide=t,this.openStart=-1,this.next(),this}forward(e,t){for(;this.minActive>-1&&(this.activeTo[this.minActive]-e||this.active[this.minActive].endSide-t)<0;)this.removeActive(this.minActive);this.cursor.forward(e,t)}removeActive(e){dh(this.active,e),dh(this.activeTo,e),dh(this.activeRank,e),this.minActive=Wk(this.active,this.activeTo)}addActive(e){let t=0,{value:i,to:l,rank:o}=this.cursor;for(;t0;)t++;ph(this.active,t,i),ph(this.activeTo,t,l),ph(this.activeRank,t,o),e&&ph(e,t,this.cursor.from),this.minActive=Wk(this.active,this.activeTo)}next(){let e=this.to,t=this.point;this.point=null;let i=this.openStart<0?[]:null;for(;;){let l=this.minActive;if(l>-1&&(this.activeTo[l]-this.cursor.from||this.active[l].endSide-this.cursor.startSide)<0){if(this.activeTo[l]>e){this.to=this.activeTo[l],this.endSide=this.active[l].endSide;break}this.removeActive(l),i&&dh(i,l)}else if(this.cursor.value)if(this.cursor.from>e){this.to=this.cursor.from,this.endSide=this.cursor.startSide;break}else{let o=this.cursor.value;if(!o.point)this.addActive(i),this.cursor.next();else if(t&&this.cursor.to==this.to&&this.cursor.from=0&&i[l]=0&&!(this.activeRank[i]e||this.activeTo[i]==e&&this.active[i].endSide>=this.point.endSide)&&t.push(this.active[i]);return t.reverse()}openEnd(e){let t=0;for(let i=this.activeTo.length-1;i>=0&&this.activeTo[i]>e;i--)t++;return t}}function Kk(n,e,t,i,l,o){n.goto(e),t.goto(i);let a=i+l,c=i,f=i-e,d=!!o.boundChange;for(let p=!1;;){let g=n.to+f-t.to,b=g||n.endSide-t.endSide,v=b<0?n.to+f:t.to,w=Math.min(v,a);if(n.point||t.point?(n.point&&t.point&&yy(n.point,t.point)&&ox(n.activeForPoint(n.to),t.activeForPoint(t.to))||o.comparePoint(c,w,n.point,t.point),p=!1):(p&&(o.boundChange(c),p=!1),w>c&&!ox(n.active,t.active)&&o.compareRange(c,w,n.active,t.active),d&&wa)break;c=v,b<=0&&n.next(),b>=0&&t.next()}}function ox(n,e){if(n.length!=e.length)return!1;for(let t=0;t=e;i--)n[i+1]=n[i];n[e]=t}function Wk(n,e){let t=-1,i=1e9;for(let l=0;l=e)return l;if(l==n.length)break;o+=n.charCodeAt(l)==9?t-o%t:1,l=yn(n,l)}return i===!0?-1:n.length}const ux="ͼ",Zk=typeof Symbol>"u"?"__"+ux:Symbol.for(ux),cx=typeof Symbol>"u"?"__styleSet"+Math.floor(Math.random()*1e8):Symbol("styleSet"),Jk=typeof globalThis<"u"?globalThis:typeof window<"u"?window:{};class ts{constructor(e,t){this.rules=[];let{finish:i}=t||{};function l(a){return/^@/.test(a)?[a]:a.split(/,\s*/)}function o(a,c,f,d){let p=[],g=/^@(\w+)\b/.exec(a[0]),b=g&&g[1]=="keyframes";if(g&&c==null)return f.push(a[0]+";");for(let v in c){let w=c[v];if(/&/.test(v))o(v.split(/,\s*/).map(S=>a.map(C=>S.replace(/&/,C))).reduce((S,C)=>S.concat(C)),w,f);else if(w&&typeof w=="object"){if(!g)throw new RangeError("The value of a property ("+v+") should be a primitive value.");o(l(v),w,p,b)}else w!=null&&p.push(v.replace(/_.*/,"").replace(/[A-Z]/g,S=>"-"+S.toLowerCase())+": "+w+";")}(p.length||b)&&f.push((i&&!g&&!d?a.map(i):a).join(", ")+" {"+p.join(" ")+"}")}for(let a in e)o(l(a),e[a],this.rules)}getRules(){return this.rules.join(` -`)}static newName(){let e=Jk[Zk]||1;return Jk[Zk]=e+1,ux+e.toString(36)}static mount(e,t,i){let l=e[cx],o=i&&i.nonce;l?o&&l.setNonce(o):l=new WD(e,o),l.mount(Array.isArray(t)?t:[t],e)}}let eS=new Map;class WD{constructor(e,t){let i=e.ownerDocument||e,l=i.defaultView;if(!e.head&&e.adoptedStyleSheets&&l.CSSStyleSheet){let o=eS.get(i);if(o)return e[cx]=o;this.sheet=new l.CSSStyleSheet,eS.set(i,this)}else this.styleTag=i.createElement("style"),t&&this.styleTag.setAttribute("nonce",t);this.modules=[],e[cx]=this}mount(e,t){let i=this.sheet,l=0,o=0,a=!1;for(let c=0;c-1&&(this.modules.splice(d,1),a=!0,o--,d=-1),d==-1){if(this.modules.splice(o++,0,f),a=!0,i)for(let p=0;p",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},ZD=typeof navigator<"u"&&/Mac/.test(navigator.platform),JD=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var An=0;An<10;An++)ns[48+An]=ns[96+An]=String(An);for(var An=1;An<=24;An++)ns[An+111]="F"+An;for(var An=65;An<=90;An++)ns[An]=String.fromCharCode(An+32),ac[An]=String.fromCharCode(An);for(var Wg in ns)ac.hasOwnProperty(Wg)||(ac[Wg]=ns[Wg]);function eR(n){var e=ZD&&n.metaKey&&n.shiftKey&&!n.ctrlKey&&!n.altKey||JD&&n.shiftKey&&n.key&&n.key.length==1||n.key=="Unidentified",t=!e&&n.key||(n.shiftKey?ac:ns)[n.keyCode]||n.key||"Unidentified";return t=="Esc"&&(t="Escape"),t=="Del"&&(t="Delete"),t=="Left"&&(t="ArrowLeft"),t=="Up"&&(t="ArrowUp"),t=="Right"&&(t="ArrowRight"),t=="Down"&&(t="ArrowDown"),t}function Tt(){var n=arguments[0];typeof n=="string"&&(n=document.createElement(n));var e=1,t=arguments[1];if(t&&typeof t=="object"&&t.nodeType==null&&!Array.isArray(t)){for(var i in t)if(Object.prototype.hasOwnProperty.call(t,i)){var l=t[i];typeof l=="string"?n.setAttribute(i,l):l!=null&&(n[i]=l)}e++}for(;e2);var ke={mac:iS||/Mac/.test(Gn.platform),windows:/Win/.test(Gn.platform),linux:/Linux|X11/.test(Gn.platform),ie:Gd,ie_version:AO?fx.documentMode||6:dx?+dx[1]:hx?+hx[1]:0,gecko:tS,gecko_version:tS?+(/Firefox\/(\d+)/.exec(Gn.userAgent)||[0,0])[1]:0,chrome:!!Zg,chrome_version:Zg?+Zg[1]:0,ios:iS,android:/Android\b/.test(Gn.userAgent),webkit:nS,webkit_version:nS?+(/\bAppleWebKit\/(\d+)/.exec(Gn.userAgent)||[0,0])[1]:0,safari:px,safari_version:px?+(/\bVersion\/(\d+(\.\d+)?)/.exec(Gn.userAgent)||[0,0])[1]:0,tabSize:fx.documentElement.style.tabSize!=null?"tab-size":"-moz-tab-size"};function vy(n,e){for(let t in n)t=="class"&&e.class?e.class+=" "+n.class:t=="style"&&e.style?e.style+=";"+n.style:e[t]=n[t];return e}const cd=Object.create(null);function wy(n,e,t){if(n==e)return!0;n||(n=cd),e||(e=cd);let i=Object.keys(n),l=Object.keys(e);if(i.length-0!=l.length-0)return!1;for(let o of i)if(o!=t&&(l.indexOf(o)==-1||n[o]!==e[o]))return!1;return!0}function tR(n,e){for(let t=n.attributes.length-1;t>=0;t--){let i=n.attributes[t].name;e[i]==null&&n.removeAttribute(i)}for(let t in e){let i=e[t];t=="style"?n.style.cssText=i:n.getAttribute(t)!=i&&n.setAttribute(t,i)}}function rS(n,e,t){let i=!1;if(e)for(let l in e)t&&l in t||(i=!0,l=="style"?n.style.cssText="":n.removeAttribute(l));if(t)for(let l in t)e&&e[l]==t[l]||(i=!0,l=="style"?n.style.cssText=t[l]:n.setAttribute(l,t[l]));return i}function nR(n){let e=Object.create(null);for(let t=0;t0?3e8:-4e8:t>0?1e8:-1e8,new io(e,t,t,i,e.widget||null,!1)}static replace(e){let t=!!e.block,i,l;if(e.isBlockGap)i=-5e8,l=4e8;else{let{start:o,end:a}=EO(e,t);i=(o?t?-3e8:-1:5e8)-1,l=(a?t?2e8:1:-6e8)+1}return new io(e,i,l,t,e.widget||null,!0)}static line(e){return new Oc(e)}static set(e,t=!1){return rt.of(e,t)}hasHeight(){return this.widget?this.widget.estimatedHeight>-1:!1}}Ie.none=rt.empty;class Cc extends Ie{constructor(e){let{start:t,end:i}=EO(e);super(t?-1:5e8,i?1:-6e8,null,e),this.tagName=e.tagName||"span",this.attrs=e.class&&e.attributes?vy(e.attributes,{class:e.class}):e.class?{class:e.class}:e.attributes||cd}eq(e){return this==e||e instanceof Cc&&this.tagName==e.tagName&&wy(this.attrs,e.attrs)}range(e,t=e){if(e>=t)throw new RangeError("Mark decorations may not be empty");return super.range(e,t)}}Cc.prototype.point=!1;class Oc extends Ie{constructor(e){super(-2e8,-2e8,null,e)}eq(e){return e instanceof Oc&&this.spec.class==e.spec.class&&wy(this.spec.attributes,e.spec.attributes)}range(e,t=e){if(t!=e)throw new RangeError("Line decoration ranges must be zero-length");return super.range(e,t)}}Oc.prototype.mapMode=Yn.TrackBefore;Oc.prototype.point=!0;class io extends Ie{constructor(e,t,i,l,o,a){super(t,i,o,e),this.block=l,this.isReplace=a,this.mapMode=l?t<=0?Yn.TrackBefore:Yn.TrackAfter:Yn.TrackDel}get type(){return this.startSide!=this.endSide?Dn.WidgetRange:this.startSide<=0?Dn.WidgetBefore:Dn.WidgetAfter}get heightRelevant(){return this.block||!!this.widget&&(this.widget.estimatedHeight>=5||this.widget.lineBreaks>0)}eq(e){return e instanceof io&&iR(this.widget,e.widget)&&this.block==e.block&&this.startSide==e.startSide&&this.endSide==e.endSide}range(e,t=e){if(this.isReplace&&(e>t||e==t&&this.startSide>0&&this.endSide<=0))throw new RangeError("Invalid range for replacement decoration");if(!this.isReplace&&t!=e)throw new RangeError("Widget decorations can only have zero-length ranges");return super.range(e,t)}}io.prototype.point=!0;function EO(n,e=!1){let{inclusiveStart:t,inclusiveEnd:i}=n;return t==null&&(t=n.inclusive),i==null&&(i=n.inclusive),{start:t??e,end:i??e}}function iR(n,e){return n==e||!!(n&&e&&n.compare(e))}function ga(n,e,t,i=0){let l=t.length-1;l>=0&&t[l]+i>=n?t[l]=Math.max(t[l],e):t.push(n,e)}class uc extends es{constructor(e,t,i){super(),this.tagName=e,this.attributes=t,this.rank=i}eq(e){return e==this||e instanceof uc&&this.tagName==e.tagName&&wy(this.attributes,e.attributes)}static create(e){return new uc(e.tagName,e.attributes||cd,e.rank==null?50:Math.max(0,Math.min(e.rank,100)))}static set(e,t=!1){return rt.of(e,t)}}uc.prototype.startSide=uc.prototype.endSide=-1;const bn=n=>n.nodeType==1,Na=n=>n.nodeType==3;function cc(n){let e;return n.nodeType==11?e=n.getSelection?n:n.ownerDocument:e=n,e.getSelection()}function mx(n,e){return e?n==e||n.contains(e.nodeType!=1?e.parentNode:e):!1}function Wu(n,e){if(!e.anchorNode)return!1;try{return mx(n,e.anchorNode)}catch{return!1}}function Wh(n){return Na(n)?fc(n,0,n.nodeValue.length).getClientRects():bn(n)?n.getClientRects():[]}function Zu(n,e,t,i){return t?lS(n,e,t,i,-1)||lS(n,e,t,i,1):!1}function is(n){for(var e=0;;e++)if(n=n.previousSibling,!n)return e}function fd(n){return bn(n)&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(n.nodeName)}function lS(n,e,t,i,l){for(;;){if(n==t&&e==i)return!0;if(e==(l<0?0:ll(n))){if(n.nodeName=="DIV")return!1;let o=n.parentNode;if(!o||!bn(o))return!1;e=is(n)+(l<0?0:1),n=o}else if(bn(n)){if(n=n.childNodes[e+(l<0?-1:0)],bn(n)&&(n.nodeName=="IMG"||n.nodeName=="BR"||n.contentEditable=="false"))return!1;e=l<0?ll(n):0}else return!1}}function ll(n){return Na(n)?n.nodeValue.length:n.childNodes.length}function hd(n,e){let{left:t,right:i}=n;if(t==i)return n;let l=e?t:i;return{left:l,right:l,top:n.top,bottom:n.bottom}}function rR(n){let e=n.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:n.innerWidth,top:0,bottom:n.innerHeight}}function MO(n,e){let t=e.width/n.offsetWidth,i=e.height/n.offsetHeight;return(t>.995&&t<1.005||!isFinite(t)||Math.abs(e.width-n.offsetWidth)<1)&&(t=1),(i>.995&&i<1.005||!isFinite(i)||Math.abs(e.height-n.offsetHeight)<1)&&(i=1),{scaleX:t,scaleY:i}}function lR(n,e,t,i,l,o,a,c){let f=n.ownerDocument,d=f.defaultView||window;for(let p=n,g=!1;p&&!g;)if(bn(p)){let b,v=p==f.body,w=1,S=1,C=!0,O=!0;if(v)b=rR(d);else{let H=getComputedStyle(p);if(/^(fixed|sticky)$/.test(H.position)&&(g=!0),(p.scrollHeight<=p.clientHeight||!/auto|scroll/.test(H.overflowY))&&(O=!1),(p.scrollWidth<=p.clientWidth||!/auto|scroll/.test(H.overflowX))&&(C=!1),!C&&!O){p=p.assignedSlot||p.parentNode;continue}let P=p.getBoundingClientRect();({scaleX:w,scaleY:S}=MO(p,P)),b={left:P.left,right:P.left+p.clientWidth*w,top:P.top,bottom:P.top+p.clientHeight*S}}let j=0,M=0;if(O)if(l=="nearest")e.top0&&e.bottom>b.bottom+M&&(M=e.bottom-b.bottom+a)):e.bottom>b.bottom-a&&(M=e.bottom-b.bottom+a,t<0&&e.top-M0&&e.right>b.right+j&&(j=e.right-b.right+o)):e.right>b.right-o&&(j=e.right-b.right+o,t<0&&e.leftb.bottom||e.leftb.right)&&(e={left:Math.max(e.left,b.left),right:Math.min(e.right,b.right),top:Math.max(e.top,b.top),bottom:Math.min(e.bottom,b.bottom)}),p=p.assignedSlot||p.parentNode}else if(p.nodeType==11)p=p.host;else break}function DO(n,e=!0){let t=n.ownerDocument,i=null,l=null;for(let o=n.parentNode;o&&!(o==t.body||(!e||i)&&l);)if(bn(o))!l&&o.scrollHeight>o.clientHeight&&/scroll|auto/.test(getComputedStyle(o).overflowY)&&(l=o),e&&!i&&o.scrollWidth>o.clientWidth&&/scroll|auto/.test(getComputedStyle(o).overflowX)&&(i=o),o=o.assignedSlot||o.parentNode;else if(o.nodeType==11)o=o.host;else break;return{x:i,y:l}}class sR{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}eq(e){return this.anchorNode==e.anchorNode&&this.anchorOffset==e.anchorOffset&&this.focusNode==e.focusNode&&this.focusOffset==e.focusOffset}setRange(e){let{anchorNode:t,focusNode:i}=e;this.set(t,Math.min(e.anchorOffset,t?ll(t):0),i,Math.min(e.focusOffset,i?ll(i):0))}set(e,t,i,l){this.anchorNode=e,this.anchorOffset=t,this.focusNode=i,this.focusOffset=l}}function RO(n){let e=[];for(let t=n;t;t=t.nodeType==11?t.host:t.parentNode)bn(t)&&e.push({node:t,left:t.scrollLeft,top:t.scrollTop});return e}function jO(n,e=!0){for(let{node:t,left:i,top:l}of n)e&&t.scrollTop!=l&&(t.scrollTop=l),t.scrollLeft!=i&&(t.scrollLeft=i)}let Qs=null;ke.safari&&ke.safari_version>=26&&(Qs=!1);function _O(n){if(n.setActive)return n.setActive();if(Qs)return n.focus(Qs);let e=RO(n);n.focus(Qs==null?{get preventScroll(){return Qs={preventScroll:!0},!0}}:void 0),Qs||(Qs=!1,jO(e))}let sS;function fc(n,e,t=e){let i=sS||(sS=document.createRange());return i.setEnd(n,t),i.setStart(n,e),i}function xa(n,e,t,i){let l={key:e,code:e,keyCode:t,which:t,cancelable:!0};i&&({altKey:l.altKey,ctrlKey:l.ctrlKey,shiftKey:l.shiftKey,metaKey:l.metaKey}=i);let o=new KeyboardEvent("keydown",l);o.synthetic=!0,n.dispatchEvent(o);let a=new KeyboardEvent("keyup",l);return a.synthetic=!0,n.dispatchEvent(a),o.defaultPrevented||a.defaultPrevented}function oR(n){for(;n;){if(n&&(n.nodeType==9||n.nodeType==11&&n.host))return n;n=n.assignedSlot||n.parentNode}return null}function aR(n,e){let t=e.focusNode,i=e.focusOffset;if(!t||e.anchorNode!=t||e.anchorOffset!=i)return!1;for(i=Math.min(i,ll(t));;)if(i){if(!bn(t))return!1;let l=t.childNodes[i-1];l.contentEditable=="false"?i--:(t=l,i=ll(t))}else{if(t==n)return!0;i=is(t),t=t.parentNode}}function LO(n){return n instanceof Window?n.pageYOffset>Math.max(0,n.document.documentElement.scrollHeight-n.innerHeight-4):n.scrollTop>Math.max(1,n.scrollHeight-n.clientHeight-4)}function zO(n,e){for(let t=n,i=e;;){if(Na(t)&&i>0)return{node:t,offset:i};if(bn(t)&&i>0){if(t.contentEditable=="false")return null;t=t.childNodes[i-1],i=ll(t)}else if(t.parentNode&&!fd(t))i=is(t),t=t.parentNode;else return null}}function BO(n,e){for(let t=n,i=e;;){if(Na(t)&&i=t){if(c.level==i)return a;(o<0||(l!=0?l<0?c.fromt:e[o].level>c.level))&&(o=a)}}if(o<0)throw new RangeError("Index out of range");return o}}function IO(n,e){if(n.length!=e.length)return!1;for(let t=0;t=0;S-=3)if(br[S+1]==-v){let C=br[S+2],O=C&2?l:C&4?C&1?o:l:0;O&&(Dt[g]=Dt[br[S]]=O),c=S;break}}else{if(br.length==189)break;br[c++]=g,br[c++]=b,br[c++]=f}else if((w=Dt[g])==2||w==1){let S=w==l;f=S?0:1;for(let C=c-3;C>=0;C-=3){let O=br[C+2];if(O&2)break;if(S)br[C+2]|=2;else{if(O&4)break;br[C+2]|=4}}}}}function pR(n,e,t,i){for(let l=0,o=i;l<=t.length;l++){let a=l?t[l-1].to:n,c=lf;)w==C&&(w=t[--S].from,C=S?t[S-1].to:n),Dt[--w]=v;f=p}else o=d,f++}}}function xx(n,e,t,i,l,o,a){let c=i%2?2:1;if(i%2==l%2)for(let f=e,d=0;ff&&a.push(new Ar(f,S.from,v));let C=S.direction==Ta!=!(v%2);yx(n,C?i+1:i,l,S.inner,S.from,S.to,a),f=S.to}w=S.to}else{if(w==t||(p?Dt[w]!=c:Dt[w]==c))break;w++}b?xx(n,f,w,i+1,l,b,a):fe;){let p=!0,g=!1;if(!d||f>o[d-1].to){let S=Dt[f-1];S!=c&&(p=!1,g=S==16)}let b=!p&&c==1?[]:null,v=p?i:i+1,w=f;e:for(;;)if(d&&w==o[d-1].to){if(g)break e;let S=o[--d];if(!p)for(let C=S.from,O=d;;){if(C==e)break e;if(O&&o[O-1].to==C)C=o[--O].from;else{if(Dt[C-1]==c)break e;break}}if(b)b.push(S);else{S.toDt.length;)Dt[Dt.length]=256;let i=[],l=e==Ta?0:1;return yx(n,l,l,t,0,n.length,i),i}function UO(n){return[new Ar(0,n,0)]}let FO="";function gR(n,e,t,i,l){var o;if(!n.length)return null;let a=i.head-n.from,c;if(i.head==n.from&&i.assoc<0){if(!l)return null;a=e[c=0].side(!1,t)}else if(i.head==n.to&&i.assoc>0){if(l)return null;a=e[c=e.length-1].side(!0,t)}else c=Ar.find(e,a,(o=i.bidiLevel)!==null&&o!==void 0?o:-1,i.assoc);let f=e[c],d=f.side(l,t);if(a==d){let b=c+=l?1:-1;if(b<0||b>=e.length)return null;f=e[c=b],a=f.side(!l,t),d=f.side(l,t)}let p=yn(n.text,a,f.forward(l,t));(pf.to)&&(p=d),FO=n.text.slice(Math.min(a,p),Math.max(a,p));let g=c==(l?e.length-1:0)?null:e[c+(l?1:-1)];if(p==d){if(!g)return l?oe.cursor(n.to,1):oe.cursor(n.from,-1);if(g.level+(l?0:1)n.some(e=>e)}),KO=Ce.define({combine:n=>n.some(e=>e)}),WO=Ce.define();class ya{constructor(e,t,i,l,o,a=!1){this.range=e,this.y=t,this.x=i,this.yMargin=l,this.xMargin=o,this.isSnapshot=a}map(e){return e.empty?this:new ya(this.range.map(e),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}clip(e){return this.range.to<=e.doc.length?this:new ya(oe.cursor(e.doc.length),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}}const mh=Ye.define({map:(n,e)=>n.map(e)}),ZO=Ye.define();function ci(n,e,t){let i=n.facet(XO);i.length?i[0](e):window.onerror&&window.onerror(String(e),t,void 0,void 0,e)||(t?console.error(t+":",e):console.error(e))}const nl=Ce.define({combine:n=>n.length?n[0]:!0});let yR=0;const ca=Ce.define({combine(n){return n.filter((e,t)=>{for(let i=0;i{let f=[];return a&&f.push(Yd.of(d=>{let p=d.plugin(c);return p?a(p):Ie.none})),o&&f.push(o(c)),f})}static fromClass(e,t){return en.define((i,l)=>new e(i,l),t)}}class Jg{constructor(e){this.spec=e,this.mustUpdate=null,this.value=null}get plugin(){return this.spec&&this.spec.plugin}update(e){if(this.value){if(this.mustUpdate){let t=this.mustUpdate;if(this.mustUpdate=null,this.value.update)try{this.value.update(t)}catch(i){if(ci(t.state,i,"CodeMirror plugin crashed"),this.value.destroy)try{this.value.destroy()}catch{}this.deactivate()}}}else if(this.spec)try{this.value=this.spec.plugin.create(e,this.spec.arg)}catch(t){ci(e.state,t,"CodeMirror plugin crashed"),this.deactivate()}return this}destroy(e){var t;if(!((t=this.value)===null||t===void 0)&&t.destroy)try{this.value.destroy()}catch(i){ci(e.state,i,"CodeMirror plugin crashed")}}deactivate(){this.spec=this.value=null}}const JO=Ce.define(),Oy=Ce.define(),Yd=Ce.define(),eN=Ce.define(),Ny=Ce.define(),Nc=Ce.define(),tN=Ce.define();function oS(n,e){let t=n.state.facet(tN);if(!t.length)return t;let i=t.map(o=>o instanceof Function?o(n):o),l=[];return rt.spans(i,e.from,e.to,{point(){},span(o,a,c,f){let d=o-e.from,p=a-e.from,g=l;for(let b=c.length-1;b>=0;b--,f--){let v=c[b].spec.bidiIsolate,w;if(f>0&&g.length&&(w=g[g.length-1]).to==d&&w.direction==v)w.to=p,g=w.inner;else{let S={from:d,to:p,direction:v,inner:[]};g.push(S),g=S.inner}}}}),nN(e.text,l)}function nN(n,e){for(let t of e){if(t.direction==null){for(let i=t.from,l=0;i0;t--){let l=e[t-1];if(!(l.fromA>i.toA)){if(l.toAl.push(new Bi(o,a,c,f))),this.changedRanges=l}static create(e,t,i){return new dd(e,t,i)}get viewportChanged(){return(this.flags&4)>0}get viewportMoved(){return(this.flags&8)>0}get heightChanged(){return(this.flags&2)>0}get geometryChanged(){return this.docChanged||(this.flags&18)>0}get focusChanged(){return(this.flags&1)>0}get docChanged(){return!this.changes.empty}get selectionSet(){return this.transactions.some(e=>e.selection)}get empty(){return this.flags==0&&this.transactions.length==0}}const bR=[];class Kt{constructor(e,t,i=0){this.dom=e,this.length=t,this.flags=i,this.parent=null,e.cmTile=this}get breakAfter(){return this.flags&1}get children(){return bR}isWidget(){return!1}get isHidden(){return!1}isComposite(){return!1}isLine(){return!1}isText(){return!1}isBlock(){return!1}get domAttrs(){return null}sync(e){if(this.flags|=2,this.flags&4){this.flags&=-5;let t=this.domAttrs;t&&tR(this.dom,t)}}toString(){return this.constructor.name+(this.children.length?`(${this.children})`:"")+(this.breakAfter?"#":"")}destroy(){this.parent=null}setDOM(e){this.dom=e,e.cmTile=this}get posAtStart(){return this.parent?this.parent.posBefore(this):0}get posAtEnd(){return this.posAtStart+this.length}posBefore(e,t=this.posAtStart){let i=t;for(let l of this.children){if(l==e)return i;i+=l.length+l.breakAfter}throw new RangeError("Invalid child in posBefore")}posAfter(e){return this.posBefore(e)+e.length}covers(e){return!0}coordsIn(e,t,i){return null}domPosFor(e,t){let i=is(this.dom),l=this.length?e>0:t>0;return new Ji(this.parent.dom,i+(l?1:0),e==0||e==this.length)}markDirty(e){this.flags&=-3,e&&(this.flags|=4),this.parent&&this.parent.flags&2&&this.parent.markDirty(!1)}get overrideDOMText(){return null}get root(){for(let e=this;e;e=e.parent)if(e instanceof Wd)return e;return null}static get(e){return e.cmTile}}class Kd extends Kt{constructor(e){super(e,0),this._children=[]}isComposite(){return!0}get children(){return this._children}get lastChild(){return this.children.length?this.children[this.children.length-1]:null}append(e){this.children.push(e),e.parent=this}sync(e){if(this.flags&2)return;super.sync(e);let t=this.dom,i=null,l,o=(e==null?void 0:e.node)==t?e:null,a=0;for(let c of this.children){if(c.sync(e),a+=c.length+c.breakAfter,l=i?i.nextSibling:t.firstChild,o&&l!=c.dom&&(o.written=!0),c.dom.parentNode==t)for(;l&&l!=c.dom;)l=aS(l);else t.insertBefore(c.dom,l);i=c.dom}for(l=i?i.nextSibling:t.firstChild,o&&l&&(o.written=!0);l;)l=aS(l);this.length=a}}function aS(n){let e=n.nextSibling;return n.parentNode.removeChild(n),e}class Wd extends Kd{constructor(e,t){super(t),this.view=e}owns(e){for(;e;e=e.parent)if(e==this)return!0;return!1}isBlock(){return!0}nearest(e){for(;;){if(!e)return null;let t=Kt.get(e);if(t&&this.owns(t))return t;e=e.parentNode}}blockTiles(e){for(let t=[],i=this,l=0,o=0;;)if(l==i.children.length){if(!t.length)return;i=i.parent,i.breakAfter&&o++,l=t.pop()}else{let a=i.children[l++];if(a instanceof rl)t.push(l),i=a,l=0;else{let c=o+a.length,f=e(a,o);if(f!==void 0)return f;o=c+a.breakAfter}}}resolveBlock(e,t){let i,l=-1,o,a=-1;if(this.blockTiles((c,f)=>{let d=f+c.length;if(e>=f&&e<=d){if(c.isWidget()&&t>=-1&&t<=1){if(c.flags&32)return!0;c.flags&16&&(i=void 0)}(fe||e==f&&(t>1?c.length:c.covers(-1)))&&(!o||!c.isWidget()&&o.isWidget())&&(o=c,a=e-f)}}),!i&&!o)throw new Error("No tile at position "+e);return i&&t<0||!o?{tile:i,offset:l}:{tile:o,offset:a}}}class rl extends Kd{constructor(e,t){super(e),this.wrapper=t}isBlock(){return!0}covers(e){return this.children.length?e<0?this.children[0].covers(-1):this.lastChild.covers(1):!1}get domAttrs(){return this.wrapper.attributes}static of(e,t){let i=new rl(t||document.createElement(e.tagName),e);return t||(i.flags|=4),i}}class Aa extends Kd{constructor(e,t){super(e),this.attrs=t}isLine(){return!0}static start(e,t,i){let l=new Aa(t||document.createElement("div"),e);return(!t||!i)&&(l.flags|=4),l}get domAttrs(){return this.attrs}resolveInline(e,t,i=!1){let l=null,o=-1,a=null,c=-1;function f(p,g){for(let b=0,v=0;b=g&&(w.isComposite()?f(w,g-v):(!a||i&&a.isHidden&&(t>0&&!(a.flags&32)||i&&wR(a,w)))&&(S>g||w.flags&32&&t<=1)?(a=w,c=g-v):(v=-1)&&(l=w,o=g-v)),v=S}}f(this,e);let d=(t<0?l:a)||l||a;return d?{tile:d,offset:d==l?o:c}:null}coordsIn(e,t,i){let l=this.resolveInline(e,t,!0);return l?l.tile.coordsIn(Math.max(0,l.offset),t,i):vR(this)}domIn(e,t){let i=this.resolveInline(e,t);if(i){let{tile:l,offset:o}=i;if(this.dom.contains(l.dom))return l.isText()?new Ji(l.dom,Math.min(l.dom.nodeValue.length,o)):l.domPosFor(o,l.flags&16?1:l.flags&32?-1:t);let a=i.tile.parent,c=!1;for(let f of a.children){if(c)return new Ji(f.dom,0);f==i.tile&&(c=!0)}}return new Ji(this.dom,0)}}function vR(n){let e=n.dom.lastChild;if(!e)return n.dom.getBoundingClientRect();let t=Wh(e);return t[t.length-1]||null}function wR(n,e){let t=n.coordsIn(0,1),i=e.coordsIn(0,1);return t&&i&&i.topl&&(e=l);let o=e,a=e,c=0;e==0&&t<0||e==l&&t>=0?ke.chrome||ke.gecko||(e?(o--,c=1):a=0)?0:f.length-1];return ke.safari&&!c&&d.width==0&&(d=Array.prototype.find.call(f,p=>p.width)||d),i==null?d:hd(d,(c?c>0:t<0)==i)}static of(e,t){let i=new Ks(t||document.createTextNode(e),e);return t||(i.flags|=2),i}}class ro extends Kt{constructor(e,t,i,l){super(e,t,l),this.widget=i}isWidget(){return!0}get isHidden(){return this.widget.isHidden}covers(e){return this.flags&48?!1:(this.flags&(e<0?64:128))>0}coordsIn(e,t){return this.coordsInWidget(e,t,!1)}coordsInWidget(e,t,i){let l=this.widget.coordsAt(this.dom,e,t);if(l)return l;if(i)return hd(this.dom.getBoundingClientRect(),this.length?e==0:t<=0);{let o=this.dom.getClientRects(),a=null;if(!o.length)return null;let c=this.flags&16?!0:this.flags&32?!1:e>0;for(let f=c?o.length-1:0;a=o[f],!(e>0?f==0:f==o.length-1||a.top0==i)}}class kR{constructor(e){this.index=0,this.beforeBreak=!1,this.parents=[],this.tile=e}advance(e,t,i){let{tile:l,index:o,beforeBreak:a,parents:c}=this;for(;e||t>0;)if(l.isComposite())if(a){if(!e)break;i&&i.break(),e--,a=!1}else if(o==l.children.length){if(!e&&!c.length)break;i&&i.leave(l),a=!!l.breakAfter,{tile:l,index:o}=c.pop(),o++}else{let f=l.children[o],d=f.breakAfter;(t>0?f.length<=e:f.length=0;c--){let f=t.marks[c],d=l.lastChild;if(d instanceof ui&&d.mark.eq(f.mark))d.dom!=f.dom&&d.setDOM(e0(f.dom)),l=d;else{let{dom:p}=f;this.cache.reused.get(f)&&Kt.get(f.dom)&&(p=e0(f.dom));let g=ui.of(f.mark,p);l.append(g),l=g}this.cache.reused.set(f,2)}let o=Kt.get(e.text);o&&this.cache.reused.set(o,2);let a=new Ks(e.text,e.text.nodeValue);a.flags|=8,this.pos=e.range.toB,l.append(a)}addInlineWidget(e,t,i){let l=this.afterWidget&&e.flags&48&&(this.afterWidget.flags&48)==(e.flags&48);l||this.flushBuffer();let o=this.ensureMarks(t,i);!l&&!(e.flags&16)&&o.append(this.getBuffer(1)),o.append(e),this.pos+=e.length,this.afterWidget=e}addMark(e,t,i){this.flushBuffer(),this.ensureMarks(t,i).append(e),this.pos+=e.length,this.afterWidget=null}addBlockWidget(e){this.getBlockPos().append(e),this.pos+=e.length,this.lastBlock=e,this.endLine()}continueWidget(e){let t=this.afterWidget||this.lastBlock;t.length+=e,this.pos+=e}addLineStart(e,t){var i;e||(e=rN);let l=Aa.start(e,t||((i=this.cache.find(Aa))===null||i===void 0?void 0:i.dom),!!t);this.getBlockPos().append(this.lastBlock=this.curLine=l)}addLine(e){this.getBlockPos().append(e),this.pos+=e.length,this.lastBlock=e,this.endLine()}addBreak(){this.lastBlock.flags|=1,this.endLine(),this.pos++}addLineStartIfNotCovered(e){this.blockPosCovered()||this.addLineStart(e)}ensureLine(e){this.curLine||this.addLineStart(e)}ensureMarks(e,t){var i;let l=this.curLine;for(let o=e.length-1;o>=0;o--){let a=e[o],c;if(t>0&&(c=l.lastChild)&&c instanceof ui&&c.mark.eq(a))l=c,t--;else{let f=ui.of(a,(i=this.cache.find(ui,d=>d.mark.eq(a)))===null||i===void 0?void 0:i.dom);l.append(f),l=f,t=0}}return l}endLine(){if(this.curLine){this.flushBuffer();let e=this.curLine.lastChild;(!e||!uS(this.curLine,!1)||e.dom.nodeName!="BR"&&e.isWidget()&&!(ke.ios&&uS(this.curLine,!0)))&&this.curLine.append(this.cache.findWidget(t0,0,32)||new ro(t0.toDOM(),0,t0,32)),this.curLine=this.afterWidget=null}}updateBlockWrappers(){this.wrapperPos>this.pos+1e4&&(this.blockWrappers.goto(this.pos),this.wrappers.length=0);for(let e=this.wrappers.length-1;e>=0;e--)this.wrappers[e].to=this.pos){let t=e.rank*102+e.value.rank,i=new SR(e.from,e.to,e.value,t),l=this.wrappers.length;for(;l>0&&(this.wrappers[l-1].rank-i.rank||this.wrappers[l-1].to-i.to)<0;)l--;this.wrappers.splice(l,0,i)}this.wrapperPos=this.pos}getBlockPos(){var e;this.updateBlockWrappers();let t=this.root;for(let i of this.wrappers){let l=t.lastChild;if(i.froma.wrapper.eq(i.wrapper)))===null||e===void 0?void 0:e.dom);t.append(o),t=o}}return t}blockPosCovered(){let e=this.lastBlock;return e!=null&&!e.breakAfter&&(!e.isWidget()||(e.flags&160)>0)}getBuffer(e){let t=2|(e<0?16:32),i=this.cache.find(pd,void 0,1);return i&&(i.flags=t),i||new pd(t)}flushBuffer(){this.afterWidget&&!(this.afterWidget.flags&32)&&(this.afterWidget.parent.append(this.getBuffer(-1)),this.afterWidget=null)}}class OR{constructor(e){this.skipCount=0,this.text="",this.textOff=0,this.cursor=e.iter()}skip(e){this.textOff+e<=this.text.length?this.textOff+=e:(this.skipCount+=e-(this.text.length-this.textOff),this.text="",this.textOff=0)}next(e){if(this.textOff==this.text.length){let{value:l,lineBreak:o,done:a}=this.cursor.next(this.skipCount);if(this.skipCount=0,a)throw new Error("Ran out of text content when drawing inline views");this.text=l;let c=this.textOff=Math.min(e,l.length);return o?null:l.slice(0,c)}let t=Math.min(this.text.length,this.textOff+e),i=this.text.slice(this.textOff,t);return this.textOff=t,i}}const md=[ro,Aa,Ks,ui,pd,rl,Wd];for(let n=0;n[]),this.index=md.map(()=>0),this.reused=new Map}add(e){let t=e.constructor.bucket,i=this.buckets[t];i.length<6?i.push(e):i[this.index[t]=(this.index[t]+1)%6]=e}find(e,t,i=2){let l=e.bucket,o=this.buckets[l],a=this.index[l];for(let c=0;c{if(this.cache.add(a),a.isComposite())return!1},enter:a=>this.cache.add(a),leave:()=>{},break:()=>{}}}run(e,t){let i=t&&this.getCompositionContext(t.text);for(let l=0,o=0,a=0;;){let c=al){let d=f-l;this.preserve(d,!a,!c),l=f,o+=d}if(!c)break;t&&c.fromA<=t.range.fromA&&c.toA>=t.range.toA?(this.forward(c.fromA,t.range.fromA,t.range.fromA{if(a.isWidget())if(this.openWidget)this.builder.continueWidget(f-c);else{let d=f>0||c{a.isLine()?this.builder.addLineStart(a.attrs,this.cache.maybeReuse(a)):(this.cache.add(a),a instanceof ui&&l.unshift(a.mark)),this.openWidget=!1},leave:a=>{a.isLine()?l.length&&(l.length=o=0):a instanceof ui&&(l.shift(),o=Math.min(o,l.length))},break:()=>{this.builder.addBreak(),this.openWidget=!1}}),this.text.skip(e)}emit(e,t){let i=null,l=this.builder,o=-1,a=rt.spans(this.decorations,e,t,{point:(c,f,d,p,g,b)=>{if(d instanceof io){if(this.disallowBlockEffectsFor[b]){if(d.block)throw new RangeError("Block decorations may not be specified via plugins");if(f>this.view.state.doc.lineAt(c).to)throw new RangeError("Decorations that replace line breaks may not be specified via plugins")}if(o=p.length,g>p.length)l.continueWidget(f-c);else{let v=d.widget||(d.block?Ea.block:Ea.inline),w=AR(d),S=this.cache.findWidget(v,f-c,w)||ro.of(v,this.view,f-c,w);d.block?(d.startSide>0&&l.addLineStartIfNotCovered(i),l.addBlockWidget(S)):(l.ensureLine(i),l.addInlineWidget(S,p,g))}i=null}else i=ER(i,d);f>c&&this.text.skip(f-c)},span:(c,f,d,p)=>{for(let g=c;g-1&&(this.openWidget=a>o),this.openWidget||l.addLineStartIfNotCovered(i),this.openMarks=a}forward(e,t,i=1){t-e<=10?this.old.advance(t-e,i,this.reuseWalker):(this.old.advance(5,-1,this.reuseWalker),this.old.advance(t-e-10,-1),this.old.advance(5,i,this.reuseWalker))}getCompositionContext(e){let t=[],i=null;for(let l=e.parentNode;;l=l.parentNode){let o=Kt.get(l);if(l==this.view.contentDOM)break;o instanceof ui?t.push(o):o!=null&&o.isLine()?i=o:o instanceof rl||(l.nodeName=="DIV"&&!i?i=new Aa(l,rN):i||t.push(ui.of(new Cc({tagName:l.nodeName.toLowerCase(),attributes:nR(l)}),l)))}return i?{line:i,marks:t}:null}}function uS(n,e){let t=i=>{for(let l of i.children)if((e?l.isText():l.length)||t(l))return!0;return!1};return t(n)}function AR(n){let e=n.isReplace?(n.startSide<0?64:0)|(n.endSide>0?128:0):n.startSide>0?32:16;return n.block&&(e|=256),e}const rN={class:"cm-line"};function ER(n,e){let t=e.spec.attributes,i=e.spec.class;return!t&&!i||(n||(n={class:"cm-line"}),t&&vy(t,n),i&&(n.class+=" "+i)),n}function MR(n){let e=[];for(let t=n.parents.length;t>1;t--){let i=t==n.parents.length?n.tile:n.parents[t].tile;i instanceof ui&&e.push(i.mark)}return e}function e0(n){let e=Kt.get(n);return e&&e.setDOM(n.cloneNode()),n}class Ea extends ul{constructor(e){super(),this.tag=e}eq(e){return e.tag==this.tag}toDOM(){return document.createElement(this.tag)}updateDOM(e){return e.nodeName.toLowerCase()==this.tag}get isHidden(){return!0}}Ea.inline=new Ea("span");Ea.block=new Ea("div");const t0=new class extends ul{toDOM(){return document.createElement("br")}get isHidden(){return!0}get editable(){return!0}};class cS{constructor(e){this.view=e,this.decorations=[],this.blockWrappers=[],this.dynamicDecorationMap=[!1],this.domChanged=null,this.hasComposition=null,this.editContextFormatting=Ie.none,this.lastCompositionAfterCursor=!1,this.minWidth=0,this.minWidthFrom=0,this.minWidthTo=0,this.impreciseAnchor=null,this.impreciseHead=null,this.forceSelection=!1,this.lastUpdate=Date.now(),this.updateDeco(),this.tile=new Wd(e,e.contentDOM),this.updateInner([new Bi(0,0,0,e.state.doc.length)],null)}update(e){var t;let i=e.changedRanges;this.minWidth>0&&i.length&&(i.every(({fromA:p,toA:g})=>gthis.minWidthTo)?(this.minWidthFrom=e.changes.mapPos(this.minWidthFrom,1),this.minWidthTo=e.changes.mapPos(this.minWidthTo,1)):this.minWidth=this.minWidthFrom=this.minWidthTo=0),this.updateEditContextFormatting(e);let l=-1;this.view.inputState.composing>=0&&!this.view.observer.editContext&&(!((t=this.domChanged)===null||t===void 0)&&t.newSel?l=this.domChanged.newSel.head:!HR(e.changes,this.hasComposition)&&!e.selectionSet&&(l=e.state.selection.main.head));let o=l>-1?RR(this.view,e.changes,l):null;if(this.domChanged=null,this.hasComposition){let{from:p,to:g}=this.hasComposition;i=new Bi(p,g,e.changes.mapPos(p,-1),e.changes.mapPos(g,1)).addToSet(i.slice())}this.hasComposition=o?{from:o.range.fromB,to:o.range.toB}:null,(ke.ie||ke.chrome)&&!o&&e&&e.state.doc.lines!=e.startState.doc.lines&&(this.forceSelection=!0);let a=this.decorations,c=this.blockWrappers;this.updateDeco();let f=LR(a,this.decorations,e.changes);f.length&&(i=Bi.extendWithRanges(i,f));let d=BR(c,this.blockWrappers,e.changes);return d.length&&(i=Bi.extendWithRanges(i,d)),o&&!i.some(p=>p.fromA<=o.range.fromA&&p.toA>=o.range.toA)&&(i=o.range.addToSet(i.slice())),this.tile.flags&2&&i.length==0?!1:(this.updateInner(i,o),e.transactions.length&&(this.lastUpdate=Date.now()),!0)}updateInner(e,t){this.view.viewState.mustMeasureContent=!0;let{observer:i}=this.view;i.ignore(()=>{if(t||e.length){let a=this.tile,c=new TR(this.view,a,this.blockWrappers,this.decorations,this.dynamicDecorationMap);t&&Kt.get(t.text)&&c.cache.reused.set(Kt.get(t.text),2),this.tile=c.run(e,t),vx(a,c.cache.reused)}this.tile.dom.style.height=this.view.viewState.contentHeight/this.view.scaleY+"px",this.tile.dom.style.flexBasis=this.minWidth?this.minWidth+"px":"";let o=ke.chrome||ke.ios?{node:i.selectionRange.focusNode,written:!1}:void 0;this.tile.sync(o),o&&(o.written||i.selectionRange.focusNode!=o.node||!this.tile.dom.contains(o.node))&&(this.forceSelection=!0),this.tile.dom.style.height=""});let l=[];if(this.view.viewport.from||this.view.viewport.to-1)&&Wu(i,this.view.observer.selectionRange)&&!(l&&i.contains(l));if(!(o||t||a))return;let c=this.forceSelection;this.forceSelection=!1;let f=this.view.state.selection.main,d,p;if(f.empty?p=d=this.inlineDOMNearPos(f.anchor,f.assoc||1):(p=this.inlineDOMNearPos(f.head,f.head==f.from?1:-1),d=this.inlineDOMNearPos(f.anchor,f.anchor==f.from?1:-1)),ke.gecko&&f.empty&&!this.hasComposition&&DR(d)){let b=document.createTextNode("");this.view.observer.ignore(()=>d.node.insertBefore(b,d.node.childNodes[d.offset]||null)),d=p=new Ji(b,0),c=!0}let g=this.view.observer.selectionRange;(c||!g.focusNode||(!Zu(d.node,d.offset,g.anchorNode,g.anchorOffset)||!Zu(p.node,p.offset,g.focusNode,g.focusOffset))&&!this.suppressWidgetCursorChange(g,f))&&(this.view.observer.ignore(()=>{ke.android&&ke.chrome&&i.contains(g.focusNode)&&PR(g.focusNode,i)&&(i.blur(),i.focus({preventScroll:!0}));let b=cc(this.view.root);if(b)if(f.empty){if(ke.gecko){let v=jR(d.node,d.offset);if(v&&v!=3){let w=(v==1?zO:BO)(d.node,d.offset);w&&(d=new Ji(w.node,w.offset))}}b.collapse(d.node,d.offset),f.bidiLevel!=null&&b.caretBidiLevel!==void 0&&(b.caretBidiLevel=f.bidiLevel)}else if(b.extend){b.collapse(d.node,d.offset);try{b.extend(p.node,p.offset)}catch{}}else{let v=document.createRange();f.anchor>f.head&&([d,p]=[p,d]),v.setEnd(p.node,p.offset),v.setStart(d.node,d.offset),b.removeAllRanges(),b.addRange(v)}a&&this.view.root.activeElement==i&&(i.blur(),l&&l.focus())}),this.view.observer.setSelectionRange(d,p)),this.impreciseAnchor=d.precise?null:new Ji(g.anchorNode,g.anchorOffset),this.impreciseHead=p.precise?null:new Ji(g.focusNode,g.focusOffset)}suppressWidgetCursorChange(e,t){return this.hasComposition&&t.empty&&Zu(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset)&&this.posFromDOM(e.focusNode,e.focusOffset)==t.head}enforceCursorAssoc(){if(this.hasComposition)return;let{view:e}=this,t=e.state.selection.main,i=cc(e.root),{anchorNode:l,anchorOffset:o}=e.observer.selectionRange;if(!i||!t.empty||!t.assoc||!i.modify)return;let a=this.lineAt(t.head,t.assoc);if(!a)return;let c=a.posAtStart;if(t.head==c||t.head==c+a.length)return;let f=this.coordsAt(t.head,-1),d=this.coordsAt(t.head,1);if(!f||!d||f.bottom>d.top)return;let p=this.domAtPos(t.head+t.assoc,t.assoc);i.collapse(p.node,p.offset),i.modify("move",t.assoc<0?"forward":"backward","lineboundary"),e.observer.readSelectionRange();let g=e.observer.selectionRange;e.docView.posFromDOM(g.anchorNode,g.anchorOffset)!=t.from&&i.collapse(l,o)}posFromDOM(e,t){let i=this.tile.nearest(e);if(!i)return this.tile.dom.compareDocumentPosition(e)&2?0:this.view.state.doc.length;let l=i.posAtStart;if(i.isComposite()){let o;if(e==i.dom)o=i.dom.childNodes[t];else{let a=ll(e)==0?0:t==0?-1:1;for(;;){let c=e.parentNode;if(c==i.dom)break;a==0&&c.firstChild!=c.lastChild&&(e==c.firstChild?a=-1:a=1),e=c}a<0?o=e:o=e.nextSibling}if(o==i.dom.firstChild)return l;for(;o&&!Kt.get(o);)o=o.nextSibling;if(!o)return l+i.length;for(let a=0,c=l;;a++){let f=i.children[a];if(f.dom==o)return c;c+=f.length+f.breakAfter}}else return i.isText()?e==i.dom?l+t:l+(t?i.length:0):l}domAtPos(e,t){let{tile:i,offset:l}=this.tile.resolveBlock(e,t);return i.isWidget()?i.domPosFor(l,t):i.domIn(l,t)}inlineDOMNearPos(e,t){let i,l=-1,o=!1,a,c=-1,f=!1;return this.tile.blockTiles((d,p)=>{if(d.isWidget()){if(d.flags&32&&p>=e)return!0;d.flags&16&&(o=!0)}else{let g=p+d.length;if(p<=e&&(i=d,l=e-p,o=g=e&&!a&&(a=d,c=e-p,f=p>e),p>e&&a)return!0}}),!i&&!a?this.domAtPos(e,t):(o&&a?i=null:f&&i&&(a=null),i&&t<0||!a?i.domIn(l,t):a.domIn(c,t))}coordsAt(e,t,i){let{tile:l,offset:o}=this.tile.resolveBlock(e,t);return l.isWidget()?l.widget instanceof n0?null:l.coordsInWidget(o,t,!0):l.coordsIn(o,t,i)}lineAt(e,t){let{tile:i}=this.tile.resolveBlock(e,t);return i.isLine()?i:null}coordsForChar(e){let{tile:t,offset:i}=this.tile.resolveBlock(e,1);if(!t.isLine())return null;function l(o,a){if(o.isComposite())for(let c of o.children){if(c.length>=a){let f=l(c,a);if(f)return f}if(a-=c.length,a<0)break}else if(o.isText()&&aMath.max(this.view.scrollDOM.clientWidth,this.minWidth)+1,c=-1,f=this.view.textDirection==At.LTR,d=0,p=(g,b,v)=>{for(let w=0;wl);w++){let S=g.children[w],C=b+S.length,O=S.dom.getBoundingClientRect(),{height:j}=O;if(v&&!w&&(d+=O.top-v.top),S instanceof rl)C>i&&p(S,b,O);else if(b>=i&&(d>0&&t.push(-d),t.push(j+d),d=0,a)){let M=S.dom.lastChild,H=M?Wh(M):[];if(H.length){let P=H[H.length-1],A=f?P.right-O.left:O.right-P.left;A>c&&(c=A,this.minWidth=o,this.minWidthFrom=b,this.minWidthTo=C)}}v&&w==g.children.length-1&&(d+=v.bottom-O.bottom),b=C+S.breakAfter}};return p(this.tile,0,null),t}textDirectionAt(e){let{tile:t}=this.tile.resolveBlock(e,1);return getComputedStyle(t.dom).direction=="rtl"?At.RTL:At.LTR}measureTextSize(){let e=this.tile.blockTiles(a=>{if(a.isLine()&&a.children.length&&a.length<=20){let c=0,f;for(let d of a.children){if(!d.isText()||/[^ -~]/.test(d.text))return;let p=Wh(d.dom);if(p.length!=1)return;c+=p[0].width,f=p[0].height}if(c)return{lineHeight:a.dom.getBoundingClientRect().height,charWidth:c/a.length,textHeight:f}}});if(e)return e;let t=document.createElement("div"),i,l,o;return t.className="cm-line",t.style.width="99999px",t.style.position="absolute",t.textContent="abc def ghi jkl mno pqr stu",this.view.observer.ignore(()=>{this.tile.dom.appendChild(t);let a=Wh(t.firstChild)[0];i=t.getBoundingClientRect().height,l=a&&a.width?a.width/27:7,o=a&&a.height?a.height:i,t.remove()}),{lineHeight:i,charWidth:l,textHeight:o}}computeBlockGapDeco(){let e=[],t=this.view.viewState;for(let i=0,l=0;;l++){let o=l==t.viewports.length?null:t.viewports[l],a=o?o.from-1:this.view.state.doc.length;if(a>i){let c=(t.lineBlockAt(a).bottom-t.lineBlockAt(i).top)/this.view.scaleY;e.push(Ie.replace({widget:new n0(c),block:!0,inclusive:!0,isBlockGap:!0}).range(i,a))}if(!o)break;i=o.to+1}return Ie.set(e)}updateDeco(){let e=1,t=this.view.state.facet(Yd).map(o=>(this.dynamicDecorationMap[e++]=typeof o=="function")?o(this.view):o),i=!1,l=this.view.state.facet(Ny).map((o,a)=>{let c=typeof o=="function";return c&&(i=!0),c?o(this.view):o});for(l.length&&(this.dynamicDecorationMap[e++]=i,t.push(rt.join(l))),this.decorations=[this.editContextFormatting,...t,this.computeBlockGapDeco(),this.view.viewState.lineGapDeco];etypeof o=="function"?o(this.view):o)}scrollIntoView(e){if(e.isSnapshot){let d=this.view.viewState.lineBlockAt(e.range.head);this.view.scrollDOM.scrollTop=d.top-e.yMargin,this.view.scrollDOM.scrollLeft=e.xMargin;return}for(let d of this.view.state.facet(WO))try{if(d(this.view,e.range,e))return!0}catch(p){ci(this.view.state,p,"scroll handler")}let{range:t}=e,i=this.coordsAt(t.head,t.assoc||(t.head>t.anchor?-1:1)),l;if(!i)return;!t.empty&&(l=this.coordsAt(t.anchor,t.anchor>t.head?-1:1))&&(i={left:Math.min(i.left,l.left),top:Math.min(i.top,l.top),right:Math.max(i.right,l.right),bottom:Math.max(i.bottom,l.bottom)});let o=Ty(this.view),a={left:i.left-o.left,top:i.top-o.top,right:i.right+o.right,bottom:i.bottom+o.bottom},{offsetWidth:c,offsetHeight:f}=this.view.scrollDOM;if(lR(this.view.scrollDOM,a,t.head1&&(i.top>window.visualViewport.offsetTop+window.visualViewport.height||i.bottomi.isWidget()||i.children.some(t);return t(this.tile.resolveBlock(e,1).tile)}destroy(){vx(this.tile)}}function vx(n,e){let t=e==null?void 0:e.get(n);if(t!=1){t==null&&n.destroy();for(let i of n.children)vx(i,e)}}function DR(n){return bn(n.node)&&n.node.firstChild&&(n.offset==0||n.node.childNodes[n.offset-1].contentEditable=="false")&&(n.offset==n.node.childNodes.length||n.node.childNodes[n.offset].contentEditable=="false")}function lN(n,e){let t=n.observer.selectionRange;if(!t.focusNode)return null;let i=zO(t.focusNode,t.focusOffset),l=BO(t.focusNode,t.focusOffset),o=i||l;if(l&&i&&l.node!=i.node){let c=Kt.get(l.node);if(!c||c.isText()&&c.text!=l.node.nodeValue)o=l;else if(n.docView.lastCompositionAfterCursor){let f=Kt.get(i.node);!f||f.isText()&&f.text!=i.node.nodeValue||(o=l)}}if(n.docView.lastCompositionAfterCursor=o!=i,!o)return null;let a=e-o.offset;return{from:a,to:a+o.node.nodeValue.length,node:o.node}}function RR(n,e,t){let i=lN(n,t);if(!i)return null;let{node:l,from:o,to:a}=i,c=l.nodeValue;if(/[\n\r]/.test(c)||n.state.doc.sliceString(i.from,i.to)!=c)return null;let f=e.invertedDesc;return{range:new Bi(f.mapPos(o),f.mapPos(a),o,a),text:l}}function jR(n,e){return bn(n)?(e&&n.childNodes[e-1].contentEditable=="false"?1:0)|(e{ie.from&&(t=!0)}),t}class n0 extends ul{constructor(e){super(),this.height=e}toDOM(){let e=document.createElement("div");return e.className="cm-gap",this.updateDOM(e),e}eq(e){return e.height==this.height}updateDOM(e){return e.style.height=this.height+"px",!0}get editable(){return!0}get estimatedHeight(){return this.height}ignoreEvent(){return!1}}function IR(n,e,t=1){let i=n.charCategorizer(e),l=n.doc.lineAt(e),o=e-l.from;if(l.length==0)return oe.cursor(e);o==0?t=1:o==l.length&&(t=-1);let a=o,c=o;t<0?a=yn(l.text,o,!1):c=yn(l.text,o);let f=i(l.text.slice(a,c));for(;a>0;){let d=yn(l.text,a,!1);if(i(l.text.slice(d,a))!=f)break;a=d}for(;cn.defaultLineHeight*1.5){let c=n.viewState.heightOracle.textHeight,f=Math.floor((l-t.top-(n.defaultLineHeight-c)*.5)/c);o+=f*n.viewState.heightOracle.lineLength}let a=n.state.sliceDoc(t.from,t.to);return t.from+ax(a,o,n.state.tabSize)}function wx(n,e,t){let i=n.lineBlockAt(e);if(Array.isArray(i.type)){let l;for(let o of i.type){if(o.from>e)break;if(!(o.toe)return o;(!l||o.type==Dn.Text&&(l.type!=o.type||(t<0?o.frome)))&&(l=o)}}return l||i}return i}function FR(n,e,t,i){let l=wx(n,e.head,e.assoc||-1),o=!i||l.type!=Dn.Text||!(n.lineWrapping||l.widgetLineBreaks)?null:n.coordsAtPos(e.assoc<0&&e.head>l.from?e.head-1:e.head);if(o){let a=n.dom.getBoundingClientRect(),c=n.textDirectionAt(l.from),f=n.posAndSideAtCoords({x:t==(c==At.LTR)?a.right-1:a.left+1,y:(o.top+o.bottom)/2});if(f)return oe.cursor(f.pos,f.assoc)}return oe.cursor(t?l.to:l.from,t?1:-1)}function fS(n,e,t,i){let l=n.state.doc.lineAt(e.head),o=n.bidiSpans(l),a=n.textDirectionAt(l.from);for(let c=e,f=null;;){let d=gR(l,o,a,c,t),p=FO;if(!d){if(l.number==(t?n.state.doc.lines:1))return c;p=` -`,l=n.state.doc.line(l.number+(t?1:-1)),o=n.bidiSpans(l),d=t?oe.cursor(l.from,-1):oe.cursor(l.to,1)}if(f){if(!f(p))return c}else{if(!i)return d;f=i(p)}c=d}}function qR(n,e,t){let i=n.state.charCategorizer(e),l=i(t);return o=>{let a=i(o);return l==Ut.Space&&(l=a),l==a}}function VR(n,e,t,i){let l=e.head,o=t?1:-1;if(l==(t?n.state.doc.length:0))return oe.cursor(l,e.assoc);let a=e.goalColumn,c,f=n.contentDOM.getBoundingClientRect(),d=n.coordsAtPos(l,e.assoc||((e.empty?t:e.head==e.from)?1:-1)),p=n.documentTop;if(d)a==null&&(a=d.left-f.left),c=o<0?d.top:d.bottom;else{let w=n.viewState.lineBlockAt(l);a==null&&(a=Math.min(f.right-f.left,n.defaultCharacterWidth*(l-w.from))),c=(o<0?w.top:w.bottom)+p}let g=f.left+a,b=n.viewState.heightOracle.textHeight>>1,v=i??b;for(let w=0;;w+=b){let S=c+(v+w)*o,C=kx(n,{x:g,y:S},!1,o);if(t?S>f.bottom:Sc:j{if(e>o&&el(n)),t.from,e.head>t.from?-1:1);return i==t.from?t:oe.cursor(i,in.viewState.docHeight)return new Tr(n.state.doc.length,-1);if(d=n.elementAtHeight(f),i==null)break;if(d.type==Dn.Text){if(i<0?d.ton.viewport.to)break;let b=n.docView.coordsAt(i<0?d.from:d.to,i>0?-1:1);if(b&&(i<0?b.top<=f+o:b.bottom>=f+o))break}let g=n.viewState.heightOracle.textHeight/2;f=i>0?d.bottom+g:d.top-g}if(n.viewport.from>=d.to||n.viewport.to<=d.from){if(t)return null;if(d.type==Dn.Text){let g=UR(n,l,d,a,c);return new Tr(g,g==d.from?1:-1)}}if(d.type!=Dn.Text)return f<(d.top+d.bottom)/2?new Tr(d.from,1):new Tr(d.to,-1);let p=n.docView.lineAt(d.from,2);return(!p||p.length!=d.length)&&(p=n.docView.lineAt(d.from,-2)),new QR(n,a,c,n.textDirectionAt(d.from)).scanTile(p,d.from)}class QR{constructor(e,t,i,l){this.view=e,this.x=t,this.y=i,this.baseDir=l,this.line=null,this.spans=null}bidiSpansAt(e){return(!this.line||this.line.from>e||this.line.to1||i.length&&(i[0].level!=this.baseDir||i[0].to+l.from>1;t:if(a.has(S)){for(let j=1;j=o&&(M-=w),!a.has(M)){S=M;break t}}break e}a.add(S);let C=t(S),O=0;if(C)for(let j=0;j1))if(M.bottomthis.y)(!d||d.top>M.top)&&(d=M),O=-1;else{let H=M.left>this.x?this.x-M.left:M.right(w+w+S)/3)return this.y=f.bottom-1,this.scan(e,t,!0);if(d&&d.top<(w+S+S)/3)return this.y=d.top+1,this.scan(e,t,!0)}let v=(c?this.dirAt(e[p],1):this.baseDir)==At.LTR;return{i:p,after:this.x>(b.left+b.right)/2==v}}scanText(e,t){let i=[];for(let o=0;o{let a=i[o]-t,c=i[o+1]-t;return fc(e.dom,a,c).getClientRects()});return l.after?new Tr(i[l.i+1],-1):new Tr(i[l.i],1)}scanTile(e,t){if(!e.length)return new Tr(t,1);if(e.children.length==1){let c=e.children[0];if(c.isText())return this.scanText(c,t);if(c.isComposite())return this.scanTile(c,t)}let i=[t];for(let c=0,f=t;c{let f=e.children[c];return f.flags&48?null:(bn(f.dom)?f.dom:fc(f.dom,0,f.length)).getClientRects()}),o=e.children[l.i],a=i[l.i];return o.isText()?this.scanText(o,a):o.isComposite()?this.scanTile(o,a):l.after?new Tr(i[l.i+1],-1):new Tr(a,1)}}const ia="￿";class XR{constructor(e,t){this.points=e,this.view=t,this.text="",this.lineSeparator=t.state.facet(mt.lineSeparator)}append(e){this.text+=e}lineBreak(){this.text+=ia}readRange(e,t){if(!e)return this;let i=e.parentNode;for(let l=e;;){this.findPointBefore(i,l);let o=this.text.length;this.readNode(l);let a=Kt.get(l),c=l.nextSibling;if(c==t){a!=null&&a.breakAfter&&!c&&i!=this.view.contentDOM&&this.lineBreak();break}let f=Kt.get(c);(a&&f?a.breakAfter:(a?a.breakAfter:fd(l))||fd(c)&&(l.nodeName!="BR"||a!=null&&a.isWidget())&&this.text.length>o)&&!GR(c,t)&&this.lineBreak(),l=c}return this.findPointBefore(i,t),this}readTextNode(e){let t=e.nodeValue;for(let i of this.points)i.node==e&&(i.pos=this.text.length+Math.min(i.offset,t.length));for(let i=0,l=this.lineSeparator?null:/\r\n?|\n/g;;){let o=-1,a=1,c;if(this.lineSeparator?(o=t.indexOf(this.lineSeparator,i),a=this.lineSeparator.length):(c=l.exec(t))&&(o=c.index,a=c[0].length),this.append(t.slice(i,o<0?t.length:o)),o<0)break;if(this.lineBreak(),a>1)for(let f of this.points)f.node==e&&f.pos>this.text.length&&(f.pos-=a-1);i=o+a}}readNode(e){let t=Kt.get(e),i=t&&t.overrideDOMText;if(i!=null){this.findPointInside(e,i.length);for(let l=i.iter();!l.next().done;)l.lineBreak?this.lineBreak():this.append(l.value)}else Na(e)?this.readTextNode(e):e.nodeName=="BR"?e.nextSibling&&this.lineBreak():bn(e)&&this.readRange(e.firstChild,null)}findPointBefore(e,t){for(let i of this.points)i.node==e&&e.childNodes[i.offset]==t&&(i.pos=this.text.length)}findPointInside(e,t){for(let i of this.points)(Na(e)?i.node==e:e.contains(i.node))&&(i.pos=this.text.length+($R(e,i.node,i.offset)?t:0))}}function $R(n,e,t){for(;;){if(!e||t-1;let{impreciseHead:o,impreciseAnchor:a}=e.docView,c=e.state.selection;if(e.state.readOnly&&t>-1)this.newSel=null;else if(t>-1&&(this.bounds=oN(e.docView.tile,t,i,0))){let f=o||a?[]:WR(e),d=new XR(f,e);d.readRange(this.bounds.startDOM,this.bounds.endDOM),this.text=d.text,this.newSel=ZR(f,this.bounds.from)}else{let f=e.observer.selectionRange,d=o&&o.node==f.focusNode&&o.offset==f.focusOffset||!mx(e.contentDOM,f.focusNode)?c.main.head:e.docView.posFromDOM(f.focusNode,f.focusOffset),p=a&&a.node==f.anchorNode&&a.offset==f.anchorOffset||!mx(e.contentDOM,f.anchorNode)?c.main.anchor:e.docView.posFromDOM(f.anchorNode,f.anchorOffset),g=e.viewport;if((ke.ios||ke.chrome)&&d!=p&&Math.min(d,p)<=c.main.from&&Math.max(d,p)>=c.main.to&&(g.from>0||g.to-1&&c.ranges.length>1)this.newSel=c.replaceRange(oe.range(p,d));else if(e.lineWrapping&&p==d&&!(c.main.empty&&c.main.head==d)&&e.inputState.lastTouchTime>Date.now()-100){let b=e.coordsAtPos(d,-1),v=0;b&&(v=e.inputState.lastTouchY<=b.bottom?-1:1),this.newSel=oe.create([oe.cursor(d,v)])}else this.newSel=oe.single(p,d)}}}function oN(n,e,t,i){if(n.isComposite()){let l=-1,o=-1,a=-1,c=-1;for(let f=0,d=i,p=i;ft)return oN(g,e,t,d);if(b>=e&&l==-1&&(l=f,o=d),d>t&&g.dom.parentNode==n.dom){a=f,c=p;break}p=b,d=b+g.breakAfter}return{from:o,to:c<0?i+n.length:c,startDOM:(l?n.children[l-1].dom.nextSibling:null)||n.dom.firstChild,endDOM:a=0?n.children[a].dom:null}}else return n.isText()?{from:i,to:i+n.length,startDOM:n.dom,endDOM:n.dom.nextSibling}:null}function aN(n,e){let t,{newSel:i}=e,{state:l}=n,o=l.selection.main,a=n.inputState.lastKeyTime>Date.now()-100?n.inputState.lastKeyCode:-1;if(e.bounds){let{from:c,to:f}=e.bounds,d=o.from,p=null;(a===8||ke.android&&e.text.length=c&&o.to<=f&&(e.typeOver||g!=e.text)&&g.slice(0,o.from-c)==e.text.slice(0,o.from-c)&&g.slice(o.to-c)==e.text.slice(b=e.text.length-(g.length-(o.to-c)))?t={from:o.from,to:o.to,insert:pt.of(e.text.slice(o.from-c,b).split(ia))}:(v=uN(g,e.text,d-c,p))&&(ke.chrome&&a==13&&v.toB==v.from+2&&e.text.slice(v.from,v.toB)==ia+ia&&v.toB--,t={from:c+v.from,to:c+v.toA,insert:pt.of(e.text.slice(v.from,v.toB).split(ia))})}else i&&(!n.hasFocus&&l.facet(nl)||Sx(i,o))&&(i=null);if(!t&&!i)return!1;if((ke.mac||ke.android)&&t&&t.from==t.to&&t.from==o.head-1&&/^\. ?$/.test(t.insert.toString())&&n.contentDOM.getAttribute("autocorrect")=="off"?(i&&t.insert.length==2&&(i=oe.single(i.main.anchor-1,i.main.head-1)),t={from:t.from,to:t.to,insert:pt.of([t.insert.toString().replace("."," ")])}):l.doc.lineAt(o.from).toDate.now()-50?t={from:o.from,to:o.to,insert:l.toText(n.inputState.insertingText)}:ke.chrome&&t&&t.from==t.to&&t.from==o.head&&t.insert.toString()==` - `&&n.lineWrapping&&(i&&(i=oe.single(i.main.anchor-1,i.main.head-1)),t={from:o.from,to:o.to,insert:pt.of([" "])}),t)return Ay(n,t,i,a);if(i&&!Sx(i,o)){let c=!1,f="select";return n.inputState.lastSelectionTime>Date.now()-50&&(n.inputState.lastSelectionOrigin=="select"&&(c=!0),f=n.inputState.lastSelectionOrigin,f=="select.pointer"&&(i=sN(l.facet(Nc).map(d=>d(n)),i))),n.dispatch({selection:i,scrollIntoView:c,userEvent:f}),!0}else return!1}function Ay(n,e,t,i=-1){if(ke.ios&&n.inputState.flushIOSKey(e))return!0;let l=n.state.selection.main;if(ke.android&&(e.to==l.to&&(e.from==l.from||e.from==l.from-1&&n.state.sliceDoc(e.from,l.from)==" ")&&e.insert.length==1&&e.insert.lines==2&&xa(n.contentDOM,"Enter",13)||(e.from==l.from-1&&e.to==l.to&&e.insert.length==0||i==8&&e.insert.lengthl.head)&&xa(n.contentDOM,"Backspace",8)||e.from==l.from&&e.to==l.to+1&&e.insert.length==0&&xa(n.contentDOM,"Delete",46)))return!0;let o=e.insert.toString();n.inputState.composing>=0&&n.inputState.composing++;let a,c=()=>a||(a=KR(n,e,t));return n.state.facet($O).some(f=>f(n,e.from,e.to,o,c))||n.dispatch(c()),!0}function KR(n,e,t){let i,l=n.state,o=l.selection.main,a=-1;if(e.from==e.to&&e.fromo.to){let f=e.fromg(n)),d,f);e.from==p&&(a=p)}if(a>-1)i={changes:e,selection:oe.cursor(e.from+e.insert.length,-1)};else if(e.from>=o.from&&e.to<=o.to&&e.to-e.from>=(o.to-o.from)/3&&(!t||t.main.empty&&t.main.from==e.from+e.insert.length)&&n.inputState.composing<0){let f=o.frome.to?l.sliceDoc(e.to,o.to):"";i=l.replaceSelection(n.state.toText(f+e.insert.sliceString(0,void 0,n.state.lineBreak)+d))}else{let f=l.changes(e),d=t&&t.main.to<=f.newLength?t.main:void 0;if(l.selection.ranges.length>1&&(n.inputState.composing>=0||n.inputState.compositionPendingChange)&&e.to<=o.to+10&&e.to>=o.to-10){let p=n.state.sliceDoc(e.from,e.to),g,b=t&&lN(n,t.main.head);if(b){let w=e.insert.length-(e.to-e.from);g={from:b.from,to:b.to-w}}else g=n.state.doc.lineAt(o.head);let v=o.to-e.to;i=l.changeByRange(w=>{if(w.from==o.from&&w.to==o.to)return{changes:f,range:d||w.map(f)};let S=w.to-v,C=S-p.length;if(n.state.sliceDoc(C,S)!=p||S>=g.from&&C<=g.to)return{range:w};let O=l.changes({from:C,to:S,insert:e.insert}),j=w.to-o.to;return{changes:O,range:d?oe.range(Math.max(0,d.anchor+j),Math.max(0,d.head+j)):w.map(O)}})}else i={changes:f,selection:d&&l.selection.replaceRange(d)}}let c="input.type";return(n.composing||n.inputState.compositionPendingChange&&n.inputState.compositionEndedAt>Date.now()-50)&&(n.inputState.compositionPendingChange=!1,c+=".compose",n.inputState.compositionFirstChange&&(c+=".start",n.inputState.compositionFirstChange=!1)),l.update(i,{userEvent:c,scrollIntoView:!0})}function uN(n,e,t,i){let l=Math.min(n.length,e.length),o=0;for(;o0&&c>0&&n.charCodeAt(a-1)==e.charCodeAt(c-1);)a--,c--;if(i=="end"){let f=Math.max(0,o-Math.min(a,c));t-=a+f-o}if(a=a?o-t:0;o-=f,c=o+(c-a),a=o}else if(c=c?o-t:0;o-=f,a=o+(a-c),c=o}return{from:o,toA:a,toB:c}}function WR(n){let e=[];if(n.root.activeElement!=n.contentDOM)return e;let{anchorNode:t,anchorOffset:i,focusNode:l,focusOffset:o}=n.observer.selectionRange;return t&&(e.push(new hS(t,i)),(l!=t||o!=i)&&e.push(new hS(l,o))),e}function ZR(n,e){if(n.length==0)return null;let t=n[0].pos,i=n.length==2?n[1].pos:t;return t<0||i<0?null:t==i?oe.create([oe.cursor(i+e,-1)]):oe.single(t+e,i+e)}function Sx(n,e){return e.head==n.main.head&&e.anchor==n.main.anchor}class JR{setSelectionOrigin(e){this.lastSelectionOrigin=e,this.lastSelectionTime=Date.now()}constructor(e){this.view=e,this.lastKeyCode=0,this.lastKeyTime=0,this.touchActive=!1,this.lastTouchTime=0,this.lastTouchX=0,this.lastTouchY=0,this.lastFocusTime=0,this.lastScrollTop=0,this.lastScrollLeft=0,this.lastWheelEvent=0,this.pendingIOSKey=void 0,this.lastIOSMomentumScroll=0,this.tabFocusMode=-1,this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastContextMenu=0,this.scrollHandlers=[],this.handlers=Object.create(null),this.composing=-1,this.compositionFirstChange=null,this.compositionEndedAt=0,this.compositionPendingKey=!1,this.compositionPendingChange=!1,this.insertingText="",this.insertingTextAt=0,this.mouseSelection=null,this.draggedContent=null,this.handleEvent=this.handleEvent.bind(this),this.notifiedFocused=e.hasFocus,ke.safari&&e.contentDOM.addEventListener("input",()=>null),ke.gecko&&mj(e.contentDOM.ownerDocument)}handleEvent(e){!aj(this.view,e)||this.ignoreDuringComposition(e)||e.type=="keydown"&&this.keydown(e)||(this.view.updateState!=0?Promise.resolve().then(()=>this.runHandlers(e.type,e)):this.runHandlers(e.type,e))}runHandlers(e,t){let i=this.handlers[e];if(i){for(let l of i.observers)l(this.view,t);for(let l of i.handlers){if(t.defaultPrevented)break;if(l(this.view,t)){t.preventDefault();break}}}}ensureHandlers(e){let t=tj(e),i=this.handlers,l=this.view.contentDOM;for(let o in t)if(o!="scroll"){let a=!t[o].handlers.length,c=i[o];c&&a!=!c.handlers.length&&(l.removeEventListener(o,this.handleEvent),c=null),c||l.addEventListener(o,this.handleEvent,{passive:a})}for(let o in i)o!="scroll"&&!t[o]&&l.removeEventListener(o,this.handleEvent);this.handlers=t}keydown(e){if(this.lastKeyCode=e.keyCode,this.lastKeyTime=Date.now(),e.keyCode==9&&this.tabFocusMode>-1&&(!this.tabFocusMode||Date.now()<=this.tabFocusMode))return!0;if(this.tabFocusMode>0&&e.keyCode!=27&&fN.indexOf(e.keyCode)<0&&(this.tabFocusMode=-1),ke.android&&ke.chrome&&!e.synthetic&&(e.keyCode==13||e.keyCode==8))return this.view.observer.delayAndroidKey(e.key,e.keyCode),!0;if(ke.ios&&!e.synthetic&&!e.altKey&&!e.metaKey&&(cN.some(t=>t.keyCode==e.keyCode)&&!e.ctrlKey||nj.indexOf(e.key)>-1&&e.ctrlKey)){let t={ctrlKey:e.ctrlKey,altKey:e.altKey,metaKey:e.metaKey,shiftKey:e.shiftKey};t.shiftKey&&ke.ios&&!/^(off|none)$/.test(this.view.contentDOM.autocapitalize)&&ej(this.view.win)&&(t.shiftKey=!1);let i=this.pendingIOSKey={key:e.key,keyCode:e.keyCode,mods:t};return setTimeout(()=>{this.pendingIOSKey==i&&this.flushIOSKey()},50),!0}return e.keyCode!=229&&this.view.observer.forceFlush(),!1}flushIOSKey(e){let t=this.pendingIOSKey;return!t||this.view.observer.pendingRecords().length||t.key=="Enter"&&e&&e.from0?!0:ke.safari&&!ke.ios&&this.compositionPendingKey&&Date.now()-this.compositionEndedAt<100?(this.compositionPendingKey=!1,!0):!1}startMouseSelection(e){this.mouseSelection&&this.mouseSelection.destroy(),this.mouseSelection=e}update(e){this.view.observer.update(e),this.mouseSelection&&this.mouseSelection.update(e),this.draggedContent&&e.docChanged&&(this.draggedContent=this.draggedContent.map(e.changes)),e.transactions.length&&(this.lastKeyCode=this.lastSelectionTime=0)}destroy(){this.mouseSelection&&this.mouseSelection.destroy()}}function ej(n){return n.visualViewport?n.visualViewport.height*n.visualViewport.scale/n.document.documentElement.clientHeight<.85:!1}function dS(n,e){return(t,i)=>{try{return e.call(n,i,t)}catch(l){ci(t.state,l)}}}function tj(n){let e=Object.create(null);function t(i){return e[i]||(e[i]={observers:[],handlers:[]})}for(let i of n){let l=i.spec,o=l&&l.plugin.domEventHandlers,a=l&&l.plugin.domEventObservers;if(o)for(let c in o){let f=o[c];f&&t(c).handlers.push(dS(i.value,f))}if(a)for(let c in a){let f=a[c];f&&t(c).observers.push(dS(i.value,f))}}for(let i in ir)t(i).handlers.push(ir[i]);for(let i in Wn)t(i).observers.push(Wn[i]);return e}const cN=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Enter",keyCode:13,inputType:"insertLineBreak"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],nj="dthko",fN=[16,17,18,20,91,92,224,225],gh=6;function xh(n){return Math.max(0,n)*.7+8}function ij(n,e){return Math.max(Math.abs(n.clientX-e.clientX),Math.abs(n.clientY-e.clientY))}class rj{constructor(e,t,i,l){this.view=e,this.startEvent=t,this.style=i,this.mustSelect=l,this.scrollSpeed={x:0,y:0},this.scrolling=-1,this.lastEvent=t,this.scrollParents=DO(e.contentDOM),this.atoms=e.state.facet(Nc).map(a=>a(e));let o=e.contentDOM.ownerDocument;o.addEventListener("mousemove",this.move=this.move.bind(this)),o.addEventListener("mouseup",this.up=this.up.bind(this)),this.extend=t.shiftKey,this.multiple=e.state.facet(mt.allowMultipleSelections)&&lj(e,t),this.dragging=oj(e,t)&&pN(t)==1?null:!1}start(e){this.dragging===!1&&this.select(e)}move(e){if(e.buttons==0)return this.destroy();if(this.dragging||this.dragging==null&&ij(this.startEvent,e)<10)return;this.select(this.lastEvent=e);let t=0,i=0,l=0,o=0,a=this.view.win.innerWidth,c=this.view.win.innerHeight;this.scrollParents.x&&({left:l,right:a}=this.scrollParents.x.getBoundingClientRect()),this.scrollParents.y&&({top:o,bottom:c}=this.scrollParents.y.getBoundingClientRect());let f=Ty(this.view);e.clientX-f.left<=l+gh?t=-xh(l-e.clientX):e.clientX+f.right>=a-gh&&(t=xh(e.clientX-a)),e.clientY-f.top<=o+gh?i=-xh(o-e.clientY):e.clientY+f.bottom>=c-gh&&(i=xh(e.clientY-c)),this.setScrollSpeed(t,i)}up(e){this.dragging==null&&this.select(this.lastEvent),this.dragging||e.preventDefault(),this.destroy()}destroy(){this.setScrollSpeed(0,0);let e=this.view.contentDOM.ownerDocument;e.removeEventListener("mousemove",this.move),e.removeEventListener("mouseup",this.up),this.view.inputState.mouseSelection=this.view.inputState.draggedContent=null}setScrollSpeed(e,t){this.scrollSpeed={x:e,y:t},e||t?this.scrolling<0&&(this.scrolling=setInterval(()=>this.scroll(),50)):this.scrolling>-1&&(clearInterval(this.scrolling),this.scrolling=-1)}scroll(){let{x:e,y:t}=this.scrollSpeed;e&&this.scrollParents.x&&(this.scrollParents.x.scrollLeft+=e,e=0),t&&this.scrollParents.y&&(this.scrollParents.y.scrollTop+=t,t=0),(e||t)&&this.view.win.scrollBy(e,t),this.dragging===!1&&this.select(this.lastEvent)}select(e){let{view:t}=this,i=sN(this.atoms,this.style.get(e,this.extend,this.multiple));(this.mustSelect||!i.eq(t.state.selection,this.dragging===!1))&&this.view.dispatch({selection:i,userEvent:"select.pointer"}),this.mustSelect=!1}update(e){e.transactions.some(t=>t.isUserEvent("input.type"))?this.destroy():this.style.update(e)&&setTimeout(()=>this.select(this.lastEvent),20)}}function lj(n,e){let t=n.state.facet(qO);return t.length?t[0](e):ke.mac?e.metaKey:e.ctrlKey}function sj(n,e){let t=n.state.facet(VO);return t.length?t[0](e):ke.mac?!e.altKey:!e.ctrlKey}function oj(n,e){let{main:t}=n.state.selection;if(t.empty)return!1;let i=cc(n.root);if(!i||i.rangeCount==0)return!0;let l=i.getRangeAt(0).getClientRects();for(let o=0;o=e.clientX&&a.top<=e.clientY&&a.bottom>=e.clientY)return!0}return!1}function aj(n,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let t=e.target,i;t!=n.contentDOM;t=t.parentNode)if(!t||t.nodeType==11||(i=Kt.get(t))&&i.isWidget()&&!i.isHidden&&i.widget.ignoreEvent(e))return!1;return!0}const ir=Object.create(null),Wn=Object.create(null),hN=ke.ie&&ke.ie_version<15||ke.ios&&ke.webkit_version<604;function uj(n){let e=n.dom.parentNode;if(!e)return;let t=e.appendChild(document.createElement("textarea"));t.style.cssText="position: fixed; left: -10000px; top: 10px",t.focus(),setTimeout(()=>{n.focus(),t.remove(),dN(n,t.value)},50)}function Zd(n,e,t){for(let i of n.facet(e))t=i(t,n);return t}function dN(n,e){e=Zd(n.state,Sy,e);let{state:t}=n,i,l=1,o=t.toText(e),a=o.lines==t.selection.ranges.length;if(Cx!=null&&t.selection.ranges.every(f=>f.empty)&&Cx==o.toString()){let f=-1;i=t.changeByRange(d=>{let p=t.doc.lineAt(d.from);if(p.from==f)return{range:d};f=p.from;let g=t.toText((a?o.line(l++).text:e)+t.lineBreak);return{changes:{from:p.from,insert:g},range:oe.cursor(d.from+g.length,-1)}})}else a?i=t.changeByRange(f=>{let d=o.line(l++);return{changes:{from:f.from,to:f.to,insert:d.text},range:oe.cursor(f.from+d.length,-1)}}):i=t.replaceSelection(o);n.dispatch(i,{userEvent:"input.paste",scrollIntoView:!0})}Wn.scroll=n=>{let e=n.inputState;e.lastScrollTop=n.scrollDOM.scrollTop,e.lastScrollLeft=n.scrollDOM.scrollLeft,ke.ios&&!e.touchActive&&(e.lastIOSMomentumScroll=Date.now())};Wn.wheel=Wn.mousewheel=n=>{n.inputState.lastWheelEvent=Date.now()};ir.keydown=(n,e)=>(n.inputState.setSelectionOrigin("select"),e.keyCode==27&&n.inputState.tabFocusMode!=0&&(n.inputState.tabFocusMode=Date.now()+2e3),!1);Wn.touchstart=(n,e)=>{let t=n.inputState,i=e.targetTouches[0];t.touchActive=!0,t.lastTouchTime=Date.now(),i&&(t.lastTouchX=i.clientX,t.lastTouchY=i.clientY),t.setSelectionOrigin("select.pointer")};Wn.touchmove=n=>{n.inputState.setSelectionOrigin("select.pointer")};Wn.touchend=(n,e)=>{n.inputState.touchActive=!1};ir.mousedown=(n,e)=>{if(n.observer.flush(),n.inputState.lastTouchTime>Date.now()-2e3)return!1;let t=null;for(let i of n.state.facet(QO))if(t=i(n,e),t)break;if(!t&&e.button==0&&(t=fj(n,e)),t){let i=!n.hasFocus;n.inputState.startMouseSelection(new rj(n,e,t,i)),i&&n.observer.ignore(()=>{_O(n.contentDOM);let o=n.root.activeElement;o&&!o.contains(n.contentDOM)&&o.blur()});let l=n.inputState.mouseSelection;if(l)return l.start(e),l.dragging===!1}else n.inputState.setSelectionOrigin("select.pointer");return!1};function pS(n,e,t,i){if(i==1)return oe.cursor(e,t);if(i==2)return IR(n.state,e,t);{let l=n.docView.lineAt(e,t),o=n.state.doc.lineAt(l?l.posAtEnd:e),a=l?l.posAtStart:o.from,c=l?l.posAtEnd:o.to;return cDate.now()-400&&Math.abs(e.clientX-n.clientX)<2&&Math.abs(e.clientY-n.clientY)<2?(gS+1)%3:1}function fj(n,e){let t=n.posAndSideAtCoords({x:e.clientX,y:e.clientY},!1),i=pN(e),l=n.state.selection;return{update(o){o.docChanged&&(t.pos=o.changes.mapPos(t.pos),l=l.map(o.changes))},get(o,a,c){let f=n.posAndSideAtCoords({x:o.clientX,y:o.clientY},!1),d,p=pS(n,f.pos,f.assoc,i);if(t.pos!=f.pos&&!a){let g=pS(n,t.pos,t.assoc,i),b=Math.min(g.from,p.from),v=Math.max(g.to,p.to);p=b1&&(d=hj(l,f.pos))?d:c?l.addRange(p):oe.create([p])}}}function hj(n,e){for(let t=0;t=e)return oe.create(n.ranges.slice(0,t).concat(n.ranges.slice(t+1)),n.mainIndex==t?0:n.mainIndex-(n.mainIndex>t?1:0))}return null}ir.dragstart=(n,e)=>{let{selection:{main:t}}=n.state;if(e.target.draggable){let l=n.docView.tile.nearest(e.target);if(l&&l.isWidget()){let o=l.posAtStart,a=o+l.length;(o>=t.to||a<=t.from)&&(t=oe.undirectionalRange(o,a))}}let{inputState:i}=n;return i.mouseSelection&&(i.mouseSelection.dragging=!0),i.draggedContent=t,e.dataTransfer&&(e.dataTransfer.setData("Text",Zd(n.state,Cy,n.state.sliceDoc(t.from,t.to))),e.dataTransfer.effectAllowed="copyMove"),!1};ir.dragend=n=>(n.inputState.draggedContent=null,!1);function yS(n,e,t,i){if(t=Zd(n.state,Sy,t),!t)return;let l=n.posAtCoords({x:e.clientX,y:e.clientY},!1),{draggedContent:o}=n.inputState,a=i&&o&&sj(n,e)?{from:o.from,to:o.to}:null,c={from:l,insert:t},f=n.state.changes(a?[a,c]:c);n.focus(),n.dispatch({changes:f,selection:{anchor:f.mapPos(l,-1),head:f.mapPos(l,1)},userEvent:a?"move.drop":"input.drop"}),n.inputState.draggedContent=null}ir.drop=(n,e)=>{if(!e.dataTransfer)return!1;if(n.state.readOnly)return!0;let t=e.dataTransfer.files;if(t&&t.length){let i=Array(t.length),l=0,o=()=>{++l==t.length&&yS(n,e,i.filter(a=>a!=null).join(n.state.lineBreak),!1)};for(let a=0;a{/[\x00-\x08\x0e-\x1f]{2}/.test(c.result)||(i[a]=c.result),o()},c.readAsText(t[a])}return!0}else{let i=e.dataTransfer.getData("Text");if(i)return yS(n,e,i,!0),!0}return!1};ir.paste=(n,e)=>{if(n.state.readOnly)return!0;n.observer.flush();let t=hN?null:e.clipboardData;return t?(dN(n,t.getData("text/plain")||t.getData("text/uri-list")),!0):(uj(n),!1)};function dj(n,e){let t=n.dom.parentNode;if(!t)return;let i=t.appendChild(document.createElement("textarea"));i.style.cssText="position: fixed; left: -10000px; top: 10px",i.value=e,i.focus(),i.selectionEnd=e.length,i.selectionStart=0,setTimeout(()=>{i.remove(),n.focus()},50)}function pj(n){let e=[],t=[],i=!1;for(let l of n.selection.ranges)l.empty||(e.push(n.sliceDoc(l.from,l.to)),t.push(l));if(!e.length){let l=-1;for(let{from:o}of n.selection.ranges){let a=n.doc.lineAt(o);a.number>l&&(e.push(a.text),t.push({from:a.from,to:Math.min(n.doc.length,a.to+1)})),l=a.number}i=!0}return{text:Zd(n,Cy,e.join(n.lineBreak)),ranges:t,linewise:i}}let Cx=null;ir.copy=ir.cut=(n,e)=>{if(!Wu(n.contentDOM,n.observer.selectionRange))return!1;let{text:t,ranges:i,linewise:l}=pj(n.state);if(!t&&!l)return!1;Cx=l?t:null,e.type=="cut"&&!n.state.readOnly&&n.dispatch({changes:i,scrollIntoView:!0,userEvent:"delete.cut"});let o=hN?null:e.clipboardData;return o?(o.clearData(),o.setData("text/plain",t),!0):(dj(n,t),!1)};const mN=al.define();function gN(n,e){let t=[];for(let i of n.facet(GO)){let l=i(n,e);l&&t.push(l)}return t.length?n.update({effects:t,annotations:mN.of(!0)}):null}function xN(n){setTimeout(()=>{let e=n.hasFocus;if(e!=n.inputState.notifiedFocused){let t=gN(n.state,e);t?n.dispatch(t):n.update([])}},10)}Wn.focus=n=>{n.inputState.lastFocusTime=Date.now(),!n.scrollDOM.scrollTop&&(n.inputState.lastScrollTop||n.inputState.lastScrollLeft)&&(n.scrollDOM.scrollTop=n.inputState.lastScrollTop,n.scrollDOM.scrollLeft=n.inputState.lastScrollLeft),xN(n)};Wn.blur=n=>{n.observer.clearSelectionRange(),xN(n)};Wn.compositionstart=Wn.compositionupdate=(n,e)=>{if(!n.observer.editContext&&(n.inputState.compositionFirstChange==null&&(n.inputState.compositionFirstChange=!0),n.inputState.composing<0)){let{main:t}=n.state.selection;!t.empty&&n.lineBlockAt(t.from).from!=n.lineBlockAt(t.to).from&&!n.state.readOnly&&n.dispatch({changes:n.state.selection.ranges.filter(i=>!i.empty).map(i=>({from:i.from,to:i.to})),userEvent:"input"}),n.inputState.composing=0}};Wn.compositionend=n=>{n.observer.editContext||(n.inputState.composing=-1,n.inputState.compositionEndedAt=Date.now(),n.inputState.compositionPendingKey=!0,n.inputState.compositionPendingChange=n.observer.pendingRecords().length>0,n.inputState.compositionFirstChange=null,ke.chrome&&ke.android?n.observer.flushSoon():n.inputState.compositionPendingChange?Promise.resolve().then(()=>n.observer.flush()):setTimeout(()=>{n.inputState.composing<0&&n.docView.hasComposition&&n.update([])},50))};Wn.contextmenu=n=>{n.inputState.lastContextMenu=Date.now()};ir.beforeinput=(n,e)=>{var t,i;if((e.inputType=="insertText"||e.inputType=="insertCompositionText")&&(n.inputState.insertingText=e.data,n.inputState.insertingTextAt=Date.now()),e.inputType=="insertReplacementText"&&n.observer.editContext){let o=(t=e.dataTransfer)===null||t===void 0?void 0:t.getData("text/plain"),a=e.getTargetRanges();if(o&&a.length){let c=a[0],f=n.posAtDOM(c.startContainer,c.startOffset),d=n.posAtDOM(c.endContainer,c.endOffset);return Ay(n,{from:f,to:d,insert:n.state.toText(o)},null),!0}}let l;if(ke.chrome&&ke.android&&(l=cN.find(o=>o.inputType==e.inputType))&&(n.observer.delayAndroidKey(l.key,l.keyCode),l.key=="Backspace"||l.key=="Delete")){let o=((i=window.visualViewport)===null||i===void 0?void 0:i.height)||0;setTimeout(()=>{var a;(((a=window.visualViewport)===null||a===void 0?void 0:a.height)||0)>o+10&&n.hasFocus&&(n.contentDOM.blur(),n.focus())},100)}return ke.ios&&e.inputType=="deleteContentForward"&&n.observer.flushSoon(),ke.safari&&e.inputType=="insertText"&&n.inputState.composing>=0&&setTimeout(()=>Wn.compositionend(n,e),20),!1};const bS=new Set;function mj(n){bS.has(n)||(bS.add(n),n.addEventListener("copy",()=>{}),n.addEventListener("cut",()=>{}))}const vS=["pre-wrap","normal","pre-line","break-spaces"];let Ma=!1;function wS(){Ma=!1}class gj{constructor(e){this.lineWrapping=e,this.doc=pt.empty,this.heightSamples={},this.lineHeight=14,this.charWidth=7,this.textHeight=14,this.lineLength=30}heightForGap(e,t){let i=this.doc.lineAt(t).number-this.doc.lineAt(e).number+1;return this.lineWrapping&&(i+=Math.max(0,Math.ceil((t-e-i*this.lineLength*.5)/this.lineLength))),this.lineHeight*i}heightForLine(e){return this.lineWrapping?(1+Math.max(0,Math.ceil((e-this.lineLength)/Math.max(1,this.lineLength-5))))*this.lineHeight:this.lineHeight}setDoc(e){return this.doc=e,this}mustRefreshForWrapping(e){return vS.indexOf(e)>-1!=this.lineWrapping}mustRefreshForHeights(e){let t=!1;for(let i=0;i-1,f=Math.abs(t-this.lineHeight)>.3||this.lineWrapping!=c;if(this.lineWrapping=c,this.lineHeight=t,this.charWidth=i,this.textHeight=l,this.lineLength=o,f){this.heightSamples={};for(let d=0;d0}set outdated(e){this.flags=(e?2:0)|this.flags&-3}setHeight(e){this.height!=e&&(Math.abs(this.height-e)>Zh&&(Ma=!0),this.height=e)}replace(e,t,i){return Kn.of(i)}decomposeLeft(e,t){t.push(this)}decomposeRight(e,t){t.push(this)}applyChanges(e,t,i,l){let o=this,a=i.doc;for(let c=l.length-1;c>=0;c--){let{fromA:f,toA:d,fromB:p,toB:g}=l[c],b=o.lineAt(f,Bt.ByPosNoHeight,i.setDoc(t),0,0),v=b.to>=d?b:o.lineAt(d,Bt.ByPosNoHeight,i,0,0);for(g+=v.to-d,d=v.to;c>0&&b.from<=l[c-1].toA;)f=l[c-1].fromA,p=l[c-1].fromB,c--,fo*2){let c=e[t-1];c.break?e.splice(--t,1,c.left,null,c.right):e.splice(--t,1,c.left,c.right),i+=1+c.break,l-=c.size}else if(o>l*2){let c=e[i];c.break?e.splice(i,1,c.left,null,c.right):e.splice(i,1,c.left,c.right),i+=2+c.break,o-=c.size}else break;else if(l=o&&a(this.lineAt(0,Bt.ByPos,i,l,o))}setMeasuredHeight(e){let t=e.heights[e.index++];t<0?(this.spaceAbove=-t,t=e.heights[e.index++]):this.spaceAbove=0,this.setHeight(t)}updateHeight(e,t=0,i=!1,l){return l&&l.from<=t&&l.more&&this.setMeasuredHeight(l),this.outdated=!1,this}toString(){return`block(${this.length})`}}class Oi extends yN{constructor(e,t,i){super(e,t,null),this.collapsed=0,this.widgetHeight=0,this.breaks=0,this.spaceAbove=i}mainBlock(e,t){return new Zi(t,this.length,e+this.spaceAbove,this.height-this.spaceAbove,this.breaks)}replace(e,t,i){let l=i[0];return i.length==1&&(l instanceof Oi||l instanceof Tn&&l.flags&4)&&Math.abs(this.length-l.length)<10?(l instanceof Tn?l=new Oi(l.length,this.height,this.spaceAbove):l.height=this.height,this.outdated||(l.outdated=!1),l):Kn.of(i)}updateHeight(e,t=0,i=!1,l){return l&&l.from<=t&&l.more?this.setMeasuredHeight(l):(i||this.outdated)&&(this.spaceAbove=0,this.setHeight(Math.max(this.widgetHeight,e.heightForLine(this.length-this.collapsed))+this.breaks*e.lineHeight)),this.outdated=!1,this}toString(){return`line(${this.length}${this.collapsed?-this.collapsed:""}${this.widgetHeight?":"+this.widgetHeight:""})`}}class Tn extends Kn{constructor(e){super(e,0)}heightMetrics(e,t){let i=e.doc.lineAt(t).number,l=e.doc.lineAt(t+this.length).number,o=l-i+1,a,c=0;if(e.lineWrapping){let f=Math.min(this.height,e.lineHeight*o);a=f/o,this.length>o+1&&(c=(this.height-f)/(this.length-o-1))}else a=this.height/o;return{firstLine:i,lastLine:l,perLine:a,perChar:c}}blockAt(e,t,i,l){let{firstLine:o,lastLine:a,perLine:c,perChar:f}=this.heightMetrics(t,l);if(t.lineWrapping){let d=l+(e0){let o=i[i.length-1];o instanceof Tn?i[i.length-1]=new Tn(o.length+l):i.push(null,new Tn(l-1))}if(e>0){let o=i[0];o instanceof Tn?i[0]=new Tn(e+o.length):i.unshift(new Tn(e-1),null)}return Kn.of(i)}decomposeLeft(e,t){t.push(new Tn(e-1),null)}decomposeRight(e,t){t.push(null,new Tn(this.length-e-1))}updateHeight(e,t=0,i=!1,l){let o=t+this.length;if(l&&l.from<=t+this.length&&l.more){let a=[],c=Math.max(t,l.from),f=-1;for(l.from>t&&a.push(new Tn(l.from-t-1).updateHeight(e,t));c<=o&&l.more;){let p=e.doc.lineAt(c).length;a.length&&a.push(null);let g=l.heights[l.index++],b=0;g<0&&(b=-g,g=l.heights[l.index++]),f==-1?f=g:Math.abs(g-f)>=Zh&&(f=-2);let v=new Oi(p,g,b);v.outdated=!1,a.push(v),c+=p+1}c<=o&&a.push(null,new Tn(o-c).updateHeight(e,c));let d=Kn.of(a);return(f<0||Math.abs(d.height-this.height)>=Zh||Math.abs(f-this.heightMetrics(e,t).perLine)>=Zh)&&(Ma=!0),gd(this,d)}else(i||this.outdated)&&(this.setHeight(e.heightForGap(t,t+this.length)),this.outdated=!1);return this}toString(){return`gap(${this.length})`}}class bj extends Kn{constructor(e,t,i){super(e.length+(t?1:0)+i.length,e.height+i.height,(t?1:0)|(e.outdated||i.outdated?2:0)),this.left=e,this.right=i,this.size=e.size+i.size}get break(){return this.flags&1}blockAt(e,t,i,l){let o=i+this.left.height;return ec))return d;let p=t==Bt.ByPosNoHeight?Bt.ByPosNoHeight:Bt.ByPos;return f?d.join(this.right.lineAt(c,p,i,a,c)):this.left.lineAt(c,p,i,l,o).join(d)}forEachLine(e,t,i,l,o,a){let c=l+this.left.height,f=o+this.left.length+this.break;if(this.break)e=f&&this.right.forEachLine(e,t,i,c,f,a);else{let d=this.lineAt(f,Bt.ByPos,i,l,o);e=e&&d.from<=t&&a(d),t>d.to&&this.right.forEachLine(Math.max(e,d.to+1),t,i,c,f,a)}}replace(e,t,i){let l=this.left.length+this.break;if(tthis.left.length)return this.balanced(this.left,this.right.replace(e-l,t-l,i));let o=[];e>0&&this.decomposeLeft(e,o);let a=o.length;for(let c of i)o.push(c);if(e>0&&kS(o,a-1),t=i&&t.push(null)),e>i&&this.right.decomposeLeft(e-i,t)}decomposeRight(e,t){let i=this.left.length,l=i+this.break;if(e>=l)return this.right.decomposeRight(e-l,t);e2*t.size||t.size>2*e.size?Kn.of(this.break?[e,null,t]:[e,t]):(this.left=gd(this.left,e),this.right=gd(this.right,t),this.setHeight(e.height+t.height),this.outdated=e.outdated||t.outdated,this.size=e.size+t.size,this.length=e.length+this.break+t.length,this)}updateHeight(e,t=0,i=!1,l){let{left:o,right:a}=this,c=t+o.length+this.break,f=null;return l&&l.from<=t+o.length&&l.more?f=o=o.updateHeight(e,t,i,l):o.updateHeight(e,t,i),l&&l.from<=c+a.length&&l.more?f=a=a.updateHeight(e,c,i,l):a.updateHeight(e,c,i),f?this.balanced(o,a):(this.height=this.left.height+this.right.height,this.outdated=!1,this)}toString(){return this.left+(this.break?" ":"-")+this.right}}function kS(n,e){let t,i;n[e]==null&&(t=n[e-1])instanceof Tn&&(i=n[e+1])instanceof Tn&&n.splice(e-1,3,new Tn(t.length+1+i.length))}const vj=5;class Ey{constructor(e,t){this.pos=e,this.oracle=t,this.nodes=[],this.lineStart=-1,this.lineEnd=-1,this.covering=null,this.writtenTo=e}get isCovered(){return this.covering&&this.nodes[this.nodes.length-1]==this.covering}span(e,t){if(this.lineStart>-1){let i=Math.min(t,this.lineEnd),l=this.nodes[this.nodes.length-1];l instanceof Oi?l.length+=i-this.pos:(i>this.pos||!this.isCovered)&&this.nodes.push(new Oi(i-this.pos,-1,0)),this.writtenTo=i,t>i&&(this.nodes.push(null),this.writtenTo++,this.lineStart=-1)}this.pos=t}point(e,t,i){if(e=vj)&&this.addLineDeco(l,o,a)}else t>e&&this.span(e,t);this.lineEnd>-1&&this.lineEnd-1)return;let{from:e,to:t}=this.oracle.doc.lineAt(this.pos);this.lineStart=e,this.lineEnd=t,this.writtenToe&&this.nodes.push(new Oi(this.pos-e,-1,0)),this.writtenTo=this.pos}blankContent(e,t){let i=new Tn(t-e);return this.oracle.doc.lineAt(e).to==t&&(i.flags|=4),i}ensureLine(){this.enterLine();let e=this.nodes.length?this.nodes[this.nodes.length-1]:null;if(e instanceof Oi)return e;let t=new Oi(0,-1,0);return this.nodes.push(t),t}addBlock(e){this.enterLine();let t=e.deco;t&&t.startSide>0&&!this.isCovered&&this.ensureLine(),this.nodes.push(e),this.writtenTo=this.pos=this.pos+e.length,t&&t.endSide>0&&(this.covering=e)}addLineDeco(e,t,i){let l=this.ensureLine();l.length+=i,l.collapsed+=i,l.widgetHeight=Math.max(l.widgetHeight,e),l.breaks+=t,this.writtenTo=this.pos=this.pos+i}finish(e){let t=this.nodes.length==0?null:this.nodes[this.nodes.length-1];this.lineStart>-1&&!(t instanceof Oi)&&!this.isCovered?this.nodes.push(new Oi(0,-1,0)):(this.writtenTod.clientHeight||d.scrollWidth>d.clientWidth)&&p.overflow!="visible"){let g=d.getBoundingClientRect();o=Math.max(o,g.left),a=Math.min(a,g.right),c=Math.max(c,g.top),f=Math.min(d==n.parentNode?l.innerHeight:f,g.bottom)}d=p.position=="absolute"||p.position=="fixed"?d.offsetParent:d.parentNode}else if(d.nodeType==11)d=d.host;else break;return{left:o-t.left,right:Math.max(o,a)-t.left,top:c-(t.top+e),bottom:Math.max(c,f)-(t.top+e)}}function Cj(n){let e=n.getBoundingClientRect(),t=n.ownerDocument.defaultView||window;return e.left0&&e.top0}function Oj(n,e){let t=n.getBoundingClientRect();return{left:0,right:t.right-t.left,top:e,bottom:t.bottom-(t.top+e)}}class r0{constructor(e,t,i,l){this.from=e,this.to=t,this.size=i,this.displaySize=l}static same(e,t){if(e.length!=t.length)return!1;for(let i=0;itypeof l!="function"&&l.class=="cm-lineWrapping");this.heightOracle=new gj(i),this.stateDeco=CS(t),this.heightMap=Kn.empty().applyChanges(this.stateDeco,pt.empty,this.heightOracle.setDoc(t.doc),[new Bi(0,0,0,t.doc.length)]);for(let l=0;l<2&&(this.viewport=this.getViewport(0,null),!!this.updateForViewport());l++);this.updateViewportLines(),this.lineGaps=this.ensureLineGaps([]),this.lineGapDeco=Ie.set(this.lineGaps.map(l=>l.draw(this,!1))),this.scrollParent=e.scrollDOM,this.computeVisibleRanges()}updateForViewport(){let e=[this.viewport],{main:t}=this.state.selection;for(let i=0;i<=1;i++){let l=i?t.head:t.anchor;if(!e.some(({from:o,to:a})=>l>=o&&l<=a)){let{from:o,to:a}=this.lineBlockAt(l);e.push(new yh(o,a))}}return this.viewports=e.sort((i,l)=>i.from-l.from),this.updateScaler()}updateScaler(){let e=this.scaler;return this.scaler=this.heightMap.height<=7e6?Ox:xd.get(this.heightOracle,this.heightMap,this.viewports),e.eq(this.scaler)?0:2}updateViewportLines(){this.viewportLines=[],this.heightMap.forEachLine(this.viewport.from,this.viewport.to,this.heightOracle.setDoc(this.state.doc),0,0,e=>{this.viewportLines.push(Xu(e,this.scaler))})}update(e,t=null){this.state=e.state;let i=this.stateDeco;this.stateDeco=CS(this.state);let l=e.changedRanges,o=Bi.extendWithRanges(l,wj(i,this.stateDeco,e?e.changes:fn.empty(this.state.doc.length))),a=this.heightMap.height,c=this.scrolledToBottom?null:this.scrollAnchorAt(this.scrollOffset);wS(),this.heightMap=this.heightMap.applyChanges(this.stateDeco,e.startState.doc,this.heightOracle.setDoc(this.state.doc),o),(this.heightMap.height!=a||Ma)&&(e.flags|=2),c?(this.scrollAnchorPos=e.changes.mapPos(c.from,-1),this.scrollAnchorHeight=c.top):(this.scrollAnchorPos=-1,this.scrollAnchorHeight=a);let f=o.length?this.mapViewport(this.viewport,e.changes):this.viewport;(t&&(t.range.headf.to)||!this.viewportIsAppropriate(f))&&(f=this.getViewport(0,t));let d=f.from!=this.viewport.from||f.to!=this.viewport.to;this.viewport=f,e.flags|=this.updateForViewport(),(d||!e.changes.empty||e.flags&2)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(this.mapLineGaps(this.lineGaps,e.changes))),e.flags|=this.computeVisibleRanges(e.changes),t&&(this.scrollTarget=t),!this.mustEnforceCursorAssoc&&(e.selectionSet||e.focusChanged)&&e.view.lineWrapping&&e.state.selection.main.empty&&e.state.selection.main.assoc&&!e.state.facet(KO)&&(this.mustEnforceCursorAssoc=!0)}measure(){let{view:e}=this,t=e.contentDOM,i=window.getComputedStyle(t),l=this.heightOracle,o=i.whiteSpace;this.defaultTextDirection=i.direction=="rtl"?At.RTL:At.LTR;let a=this.heightOracle.mustRefreshForWrapping(o)||this.mustMeasureContent==="refresh",c=t.getBoundingClientRect(),f=a||this.mustMeasureContent||this.contentDOMHeight!=c.height;this.contentDOMHeight=c.height,this.mustMeasureContent=!1;let d=0,p=0;if(c.width&&c.height){let{scaleX:P,scaleY:A}=MO(t,c);(P>.005&&Math.abs(this.scaleX-P)>.005||A>.005&&Math.abs(this.scaleY-A)>.005)&&(this.scaleX=P,this.scaleY=A,d|=16,a=f=!0)}let g=(parseInt(i.paddingTop)||0)*this.scaleY,b=(parseInt(i.paddingBottom)||0)*this.scaleY;(this.paddingTop!=g||this.paddingBottom!=b)&&(this.paddingTop=g,this.paddingBottom=b,d|=18),this.editorWidth!=e.scrollDOM.clientWidth&&(l.lineWrapping&&(f=!0),this.editorWidth=e.scrollDOM.clientWidth,d|=16);let v=DO(this.view.contentDOM,!1).y;v!=this.scrollParent&&(this.scrollParent=v,this.scrollAnchorHeight=-1,this.scrollOffset=0);let w=this.getScrollOffset();this.scrollOffset!=w&&(this.scrollAnchorHeight=-1,this.scrollOffset=w),this.scrolledToBottom=LO(this.scrollParent||e.win);let S=(this.printing?Oj:Sj)(t,this.paddingTop),C=S.top-this.pixelViewport.top,O=S.bottom-this.pixelViewport.bottom;this.pixelViewport=S;let j=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left;if(j!=this.inView&&(this.inView=j,j&&(f=!0)),!this.inView&&!this.scrollTarget&&!Cj(e.dom))return 0;let M=c.width;if((this.contentDOMWidth!=M||this.editorHeight!=e.scrollDOM.clientHeight)&&(this.contentDOMWidth=c.width,this.editorHeight=e.scrollDOM.clientHeight,d|=16),f){let P=e.docView.measureVisibleLineHeights(this.viewport);if(l.mustRefreshForHeights(P)&&(a=!0),a||l.lineWrapping&&Math.abs(M-this.contentDOMWidth)>l.charWidth){let{lineHeight:A,charWidth:T,textHeight:z}=e.docView.measureTextSize();a=A>0&&l.refresh(o,A,T,z,Math.max(5,M/T),P),a&&(e.docView.minWidth=0,d|=16)}C>0&&O>0?p=Math.max(C,O):C<0&&O<0&&(p=Math.min(C,O)),wS();for(let A of this.viewports){let T=A.from==this.viewport.from?P:e.docView.measureVisibleLineHeights(A);this.heightMap=(a?Kn.empty().applyChanges(this.stateDeco,pt.empty,this.heightOracle,[new Bi(0,0,0,e.state.doc.length)]):this.heightMap).updateHeight(l,0,a,new xj(A.from,T))}Ma&&(d|=2)}let H=!this.viewportIsAppropriate(this.viewport,p)||this.scrollTarget&&(this.scrollTarget.range.headthis.viewport.to);return H&&(d&2&&(d|=this.updateScaler()),this.viewport=this.getViewport(p,this.scrollTarget),d|=this.updateForViewport()),(d&2||H)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(a?[]:this.lineGaps,e)),d|=this.computeVisibleRanges(),this.mustEnforceCursorAssoc&&(this.mustEnforceCursorAssoc=!1,e.docView.enforceCursorAssoc()),d}get visibleTop(){return this.scaler.fromDOM(this.pixelViewport.top)}get visibleBottom(){return this.scaler.fromDOM(this.pixelViewport.bottom)}getViewport(e,t){let i=.5-Math.max(-.5,Math.min(.5,e/1e3/2)),l=this.heightMap,o=this.heightOracle,{visibleTop:a,visibleBottom:c}=this,f=new yh(l.lineAt(a-i*1e3,Bt.ByHeight,o,0,0).from,l.lineAt(c+(1-i)*1e3,Bt.ByHeight,o,0,0).to);if(t){let{head:d}=t.range;if(df.to){let p=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),g=l.lineAt(d,Bt.ByPos,o,0,0),b;t.y=="center"?b=(g.top+g.bottom)/2-p/2:t.y=="start"||t.y=="nearest"&&d=c+Math.max(10,Math.min(i,250)))&&l>a-2*1e3&&o>1,a=l<<1;if(this.defaultTextDirection!=At.LTR&&!i)return[];let c=[],f=(p,g,b,v)=>{if(g-pp&&OO.from>=b.from&&O.to<=b.to&&Math.abs(O.from-p)O.fromj));if(!C){if(gM.from<=g&&M.to>=g)){let M=t.moveToLineBoundary(oe.cursor(g),!1,!0).head;M>p&&(g=M)}let O=this.gapSize(b,p,g,v),j=i||O<2e6?O:2e6;C=new r0(p,g,O,j)}c.push(C)},d=p=>{if(p.length2e6)for(let A of e)A.from>=p.from&&A.fromp.from&&f(p.from,v,p,g),wt.draw(this,this.heightOracle.lineWrapping))))}computeVisibleRanges(e){let t=this.stateDeco;this.lineGaps.length&&(t=t.concat(this.lineGapDeco));let i=[];rt.spans(t,this.viewport.from,this.viewport.to,{span(o,a){i.push({from:o,to:a})},point(){}},20);let l=0;if(i.length!=this.visibleRanges.length)l=12;else for(let o=0;o=this.viewport.from&&e<=this.viewport.to&&this.viewportLines.find(t=>t.from<=e&&t.to>=e)||Xu(this.heightMap.lineAt(e,Bt.ByPos,this.heightOracle,0,0),this.scaler)}lineBlockAtHeight(e){return e>=this.viewportLines[0].top&&e<=this.viewportLines[this.viewportLines.length-1].bottom&&this.viewportLines.find(t=>t.top<=e&&t.bottom>=e)||Xu(this.heightMap.lineAt(this.scaler.fromDOM(e),Bt.ByHeight,this.heightOracle,0,0),this.scaler)}getScrollOffset(){return this.scrollParent==this.view.scrollDOM?this.scrollParent.scrollTop*this.scaleY:(this.scrollParent?this.scrollParent.getBoundingClientRect().top:0)-this.view.contentDOM.getBoundingClientRect().top}scrollAnchorAt(e){let t=this.lineBlockAtHeight(e+12-this.paddingTop);return t.from>=this.viewport.from||this.viewportLines[0].top-e>200?t:this.viewportLines[0]}elementAtHeight(e){return Xu(this.heightMap.blockAt(this.scaler.fromDOM(e),this.heightOracle,0,0),this.scaler)}get docHeight(){return this.scaler.toDOM(this.heightMap.height)}get contentHeight(){return this.docHeight+this.paddingTop+this.paddingBottom}}class yh{constructor(e,t){this.from=e,this.to=t}}function Tj(n,e,t){let i=[],l=n,o=0;return rt.spans(t,n,e,{span(){},point(a,c){a>l&&(i.push({from:l,to:a}),o+=a-l),l=c}},20),l=1)return e[e.length-1].to;let i=Math.floor(n*t);for(let l=0;;l++){let{from:o,to:a}=e[l],c=a-o;if(i<=c)return o+i;i-=c}}function vh(n,e){let t=0;for(let{from:i,to:l}of n.ranges){if(e<=l){t+=e-i;break}t+=l-i}return t/n.total}function Aj(n,e){for(let t of n)if(e(t))return t}const Ox={toDOM(n){return n},fromDOM(n){return n},scale:1,eq(n){return n==this}};function CS(n){let e=n.facet(Yd).filter(i=>typeof i!="function"),t=n.facet(Ny).filter(i=>typeof i!="function");return t.length&&e.push(rt.join(t)),e}class xd{constructor(e,t){this.scale=e,this.viewports=t}static get(e,t,i){let l=0,o=0,a=0,c=i.map(({from:d,to:p})=>{let g=t.lineAt(d,Bt.ByPos,e,0,0).top,b=t.lineAt(p,Bt.ByPos,e,0,0).bottom;return l+=b-g,{from:d,to:p,top:g,bottom:b,domTop:0,domBottom:0}});if(t.height-l<10)return Ox;let f=(7e6-l)/(t.height-l);for(let d of c)d.domTop=a+(d.top-o)*f,a=d.domBottom=d.domTop+(d.bottom-d.top),o=d.bottom;return new xd(f,c)}toDOM(e){for(let t=0,i=0,l=0;;t++){let o=tt.from==e.viewports[i].from&&t.to==e.viewports[i].to):!1}}function Xu(n,e){if(e.scale==1)return n;let t=e.toDOM(n.top),i=e.toDOM(n.bottom);return new Zi(n.from,n.length,t,i-t,Array.isArray(n._content)?n._content.map(l=>Xu(l,e)):n._content)}const wh=Ce.define({combine:n=>n.join(" ")}),Nx=Ce.define({combine:n=>n.indexOf(!0)>-1}),Tx=ts.newName(),bN=ts.newName(),vN=ts.newName(),wN={"&light":"."+bN,"&dark":"."+vN};function Ax(n,e,t){return new ts(e,{finish(i){return/&/.test(i)?i.replace(/&\w*/,l=>{if(l=="&")return n;if(!t||!t[l])throw new RangeError(`Unsupported selector: ${l}`);return t[l]}):n+" "+i}})}const Ej=Ax("."+Tx,{"&":{position:"relative !important",boxSizing:"border-box","&.cm-focused":{outline:"1px dotted #212121"},display:"flex !important",flexDirection:"column"},".cm-scroller":{display:"flex !important",alignItems:"flex-start !important",fontFamily:"monospace",lineHeight:1.4,height:"100%",overflowX:"auto",position:"relative",zIndex:0,overflowAnchor:"none"},".cm-content":{margin:0,flexGrow:2,flexShrink:0,display:"block",whiteSpace:"pre",wordWrap:"normal",boxSizing:"border-box",minHeight:"100%",padding:"4px 0",outline:"none","&[contenteditable=true]":{WebkitUserModify:"read-write-plaintext-only"}},".cm-lineWrapping":{whiteSpace_fallback:"pre-wrap",whiteSpace:"break-spaces",wordBreak:"break-word",overflowWrap:"anywhere",flexShrink:1},"&light .cm-content":{caretColor:"black"},"&dark .cm-content":{caretColor:"white"},".cm-line":{display:"block",padding:"0 2px 0 6px"},".cm-layer":{userSelect:"none",position:"absolute",left:0,top:0,contain:"size style","& > *":{position:"absolute"}},"&light .cm-selectionBackground":{background:"#d9d9d9"},"&dark .cm-selectionBackground":{background:"#222"},"&light.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#d7d4f0"},"&dark.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#233"},".cm-cursorLayer":{pointerEvents:"none"},"&.cm-focused > .cm-scroller > .cm-cursorLayer":{animation:"steps(1) cm-blink 1.2s infinite"},"@keyframes cm-blink":{"0%":{},"50%":{opacity:0},"100%":{}},"@keyframes cm-blink2":{"0%":{},"50%":{opacity:0},"100%":{}},".cm-cursor, .cm-dropCursor":{borderLeft:"1.2px solid black",marginLeft:"-0.6px",pointerEvents:"none"},".cm-cursor":{display:"none"},"&dark .cm-cursor":{borderLeftColor:"#ddd"},".cm-selectionHandle":{backgroundColor:"currentColor",width:"1.5px"},".cm-selectionHandle-start::before, .cm-selectionHandle-end::before":{content:'""',backgroundColor:"inherit",borderRadius:"50%",width:"8px",height:"8px",position:"absolute",left:"-3.25px"},".cm-selectionHandle-start::before":{top:"-8px"},".cm-selectionHandle-end::before":{bottom:"-8px"},".cm-dropCursor":{position:"absolute"},"&.cm-focused > .cm-scroller > .cm-cursorLayer .cm-cursor":{display:"block"},".cm-iso":{unicodeBidi:"isolate"},".cm-announced":{position:"fixed",top:"-10000px"},"@media print":{".cm-announced":{display:"none"}},"&light .cm-activeLine":{backgroundColor:"#cceeff44"},"&dark .cm-activeLine":{backgroundColor:"#99eeff33"},"&light .cm-specialChar":{color:"red"},"&dark .cm-specialChar":{color:"#f78"},".cm-gutters":{flexShrink:0,display:"flex",height:"100%",boxSizing:"border-box",zIndex:200},".cm-gutters-before":{insetInlineStart:0},".cm-gutters-after":{insetInlineEnd:0},"&light .cm-gutters":{backgroundColor:"#f5f5f5",color:"#6c6c6c",border:"0px solid #ddd","&.cm-gutters-before":{borderRightWidth:"1px"},"&.cm-gutters-after":{borderLeftWidth:"1px"}},"&dark .cm-gutters":{backgroundColor:"#333338",color:"#ccc"},".cm-gutter":{display:"flex !important",flexDirection:"column",flexShrink:0,boxSizing:"border-box",minHeight:"100%",overflow:"hidden"},".cm-gutterElement":{boxSizing:"border-box"},".cm-lineNumbers .cm-gutterElement":{padding:"0 3px 0 5px",minWidth:"20px",textAlign:"right",whiteSpace:"nowrap"},"&light .cm-activeLineGutter":{backgroundColor:"#e2f2ff"},"&dark .cm-activeLineGutter":{backgroundColor:"#222227"},".cm-panels":{boxSizing:"border-box",position:"sticky",left:0,right:0,zIndex:300},"&light .cm-panels":{backgroundColor:"#f5f5f5",color:"black"},".cm-panels-top":{top:"0"},".cm-panels-bottom":{bottom:"0"},"&light .cm-panels-top":{borderBottom:"1px solid #ddd"},"&light .cm-panels-bottom":{borderTop:"1px solid #ddd"},"&dark .cm-panels":{backgroundColor:"#333338",color:"white"},".cm-dialog":{padding:"2px 19px 4px 6px",position:"relative","& label":{fontSize:"80%"}},".cm-dialog-close":{position:"absolute",top:"3px",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",fontSize:"14px",padding:"0"},".cm-tab":{display:"inline-block",overflow:"hidden",verticalAlign:"bottom"},".cm-widgetBuffer":{verticalAlign:"baseline",height:"1em",width:0,display:"inline"},".cm-placeholder":{color:"#888",display:"inline-block",verticalAlign:"top",userSelect:"none"},".cm-highlightSpace":{background:"radial-gradient(circle at 50% 55%, #aaa 20%, transparent 0) no-repeat",backgroundSize:".4em",backgroundPosition:"calc(min(50%, 0px)) center"},".cm-highlightTab":{backgroundImage:`url('data:image/svg+xml,')`,backgroundSize:"auto 100%",backgroundPosition:"right 90%",backgroundRepeat:"no-repeat"},".cm-trailingSpace":{backgroundColor:"#ff332255"},".cm-button":{verticalAlign:"middle",color:"inherit",fontSize:"70%",padding:".2em 1em",borderRadius:"1px"},"&light .cm-button":{backgroundImage:"linear-gradient(#eff1f5, #d9d9df)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#b4b4b4, #d0d3d6)"}},"&dark .cm-button":{backgroundImage:"linear-gradient(#393939, #111)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#111, #333)"}},".cm-textfield":{verticalAlign:"middle",color:"inherit",fontSize:"70%",border:"1px solid silver",padding:".2em .5em"},"&light .cm-textfield":{backgroundColor:"white"},"&dark .cm-textfield":{border:"1px solid #555",backgroundColor:"inherit"}},wN),Mj={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},l0=ke.ie&&ke.ie_version<=11;class Dj{constructor(e){this.view=e,this.active=!1,this.editContext=null,this.selectionRange=new sR,this.selectionChanged=!1,this.delayedFlush=-1,this.resizeTimeout=-1,this.queue=[],this.delayedAndroidKey=null,this.flushingAndroidKey=-1,this.lastChange=0,this.scrollTargets=[],this.intersection=null,this.resizeScroll=null,this.intersecting=!1,this.gapIntersection=null,this.gaps=[],this.printQuery=null,this.parentCheck=-1,this.dom=e.contentDOM,this.observer=new MutationObserver(t=>{for(let i of t)this.queue.push(i);(ke.ie&&ke.ie_version<=11||ke.ios&&e.composing)&&t.some(i=>i.type=="childList"&&i.removedNodes.length||i.type=="characterData"&&i.oldValue.length>i.target.nodeValue.length)?this.flushSoon():this.flush()}),window.EditContext&&ke.android&&e.constructor.EDIT_CONTEXT!==!1&&!(ke.chrome&&ke.chrome_version<126)&&(this.editContext=new jj(e),e.state.facet(nl)&&(e.contentDOM.editContext=this.editContext.editContext)),l0&&(this.onCharData=t=>{this.queue.push({target:t.target,type:"characterData",oldValue:t.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this),this.onResize=this.onResize.bind(this),this.onPrint=this.onPrint.bind(this),this.onScroll=this.onScroll.bind(this),window.matchMedia&&(this.printQuery=window.matchMedia("print")),typeof ResizeObserver=="function"&&(this.resizeScroll=new ResizeObserver(()=>{var t;((t=this.view.docView)===null||t===void 0?void 0:t.lastUpdate){this.parentCheck<0&&(this.parentCheck=setTimeout(this.listenForScroll.bind(this),1e3)),t.length>0&&t[t.length-1].intersectionRatio>0!=this.intersecting&&(this.intersecting=!this.intersecting,this.intersecting!=this.view.inView&&this.onScrollChanged(document.createEvent("Event")))},{threshold:[0,.001]}),this.intersection.observe(this.dom),this.gapIntersection=new IntersectionObserver(t=>{t.length>0&&t[t.length-1].intersectionRatio>0&&this.onScrollChanged(document.createEvent("Event"))},{})),this.listenForScroll(),this.readSelectionRange()}onScrollChanged(e){this.view.inputState.runHandlers("scroll",e),this.intersecting&&this.view.measure()}onScroll(e){this.intersecting&&this.flush(this.pendingRecords().length>0),this.editContext&&this.view.requestMeasure(this.editContext.measureReq),this.onScrollChanged(e)}onResize(){this.resizeTimeout<0&&(this.resizeTimeout=setTimeout(()=>{this.resizeTimeout=-1,this.view.requestMeasure()},50))}onPrint(e){(e.type=="change"||!e.type)&&!e.matches||(this.view.viewState.printing=!0,this.view.measure(),setTimeout(()=>{this.view.viewState.printing=!1,this.view.requestMeasure()},500))}updateGaps(e){if(this.gapIntersection&&(e.length!=this.gaps.length||this.gaps.some((t,i)=>t!=e[i]))){this.gapIntersection.disconnect();for(let t of e)this.gapIntersection.observe(t);this.gaps=e}}onSelectionChange(e){let t=this.selectionChanged;if(!this.readSelectionRange()||this.delayedAndroidKey)return;let{view:i}=this,l=this.selectionRange;if(i.state.facet(nl)?i.root.activeElement!=this.dom:!Wu(this.dom,l))return;let o=l.anchorNode&&i.docView.tile.nearest(l.anchorNode);if(o&&o.isWidget()&&o.widget.ignoreEvent(e)){t||(this.selectionChanged=!1);return}(ke.ie&&ke.ie_version<=11||ke.android&&ke.chrome)&&!i.state.selection.main.empty&&l.focusNode&&Zu(l.focusNode,l.focusOffset,l.anchorNode,l.anchorOffset)?this.flushSoon():this.flush(!1)}readSelectionRange(){let{view:e}=this,t=cc(e.root);if(!t)return!1;let i=ke.safari&&e.root.nodeType==11&&e.root.activeElement==this.dom&&Rj(this.view,t)||t;if(!i||this.selectionRange.eq(i))return!1;let l=Wu(this.dom,i);return l&&!this.selectionChanged&&e.inputState.lastFocusTime>Date.now()-200&&e.inputState.lastTouchTime{let o=this.delayedAndroidKey;o&&(this.clearDelayedAndroidKey(),this.view.inputState.lastKeyCode=o.keyCode,this.view.inputState.lastKeyTime=Date.now(),!this.flush()&&o.force&&xa(this.dom,o.key,o.keyCode))};this.flushingAndroidKey=this.view.win.requestAnimationFrame(l)}(!this.delayedAndroidKey||e=="Enter")&&(this.delayedAndroidKey={key:e,keyCode:t,force:this.lastChange{this.delayedFlush=-1,this.flush()}))}forceFlush(){this.delayedFlush>=0&&(this.view.win.cancelAnimationFrame(this.delayedFlush),this.delayedFlush=-1),this.flush()}pendingRecords(){for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}processRecords(){let e=this.pendingRecords();e.length&&(this.queue=[]);let t=-1,i=-1,l=!1;for(let o of e){let a=this.readMutation(o);a&&(a.typeOver&&(l=!0),t==-1?{from:t,to:i}=a:(t=Math.min(a.from,t),i=Math.max(a.to,i)))}return{from:t,to:i,typeOver:l}}readChange(){let{from:e,to:t,typeOver:i}=this.processRecords(),l=this.selectionChanged&&Wu(this.dom,this.selectionRange);if(e<0&&!l)return null;e>-1&&(this.lastChange=Date.now()),this.view.inputState.lastFocusTime=0,this.selectionChanged=!1;let o=new YR(this.view,e,t,i);return this.view.docView.domChanged={newSel:o.newSel?o.newSel.main:null},o}flush(e=!0){if(this.delayedFlush>=0||this.delayedAndroidKey)return!1;e&&this.readSelectionRange();let t=this.selectionChanged,i=this.readChange();if(!i)return this.view.requestMeasure(),!1;let l=this.view.state,o=aN(this.view,i);return this.view.state==l&&(i.domChanged||t)&&this.view.update([]),o}readMutation(e){let t=this.view.docView.tile.nearest(e.target);if(!t||t.isWidget())return null;if(t.markDirty(e.type=="attributes"),e.type=="childList"){let i=OS(t,e.previousSibling||e.target.previousSibling,-1),l=OS(t,e.nextSibling||e.target.nextSibling,1);return{from:i?t.posAfter(i):t.posAtStart,to:l?t.posBefore(l):t.posAtEnd,typeOver:!1}}else return e.type=="characterData"?{from:t.posAtStart,to:t.posAtEnd,typeOver:e.target.nodeValue==e.oldValue}:null}setWindow(e){e!=this.win&&(this.removeWindowListeners(this.win),this.win=e,this.addWindowListeners(this.win))}addWindowListeners(e){e.addEventListener("resize",this.onResize),this.printQuery?this.printQuery.addEventListener?this.printQuery.addEventListener("change",this.onPrint):this.printQuery.addListener(this.onPrint):e.addEventListener("beforeprint",this.onPrint),e.addEventListener("scroll",this.onScroll),e.document.addEventListener("selectionchange",this.onSelectionChange)}removeWindowListeners(e){e.removeEventListener("scroll",this.onScroll),e.removeEventListener("resize",this.onResize),this.printQuery?this.printQuery.removeEventListener?this.printQuery.removeEventListener("change",this.onPrint):this.printQuery.removeListener(this.onPrint):e.removeEventListener("beforeprint",this.onPrint),e.document.removeEventListener("selectionchange",this.onSelectionChange)}update(e){this.editContext&&(this.editContext.update(e),e.startState.facet(nl)!=e.state.facet(nl)&&(e.view.contentDOM.editContext=e.state.facet(nl)?this.editContext.editContext:null))}destroy(){var e,t,i;this.stop(),(e=this.intersection)===null||e===void 0||e.disconnect(),(t=this.gapIntersection)===null||t===void 0||t.disconnect(),(i=this.resizeScroll)===null||i===void 0||i.disconnect();for(let l of this.scrollTargets)l.removeEventListener("scroll",this.onScroll);this.removeWindowListeners(this.win),clearTimeout(this.parentCheck),clearTimeout(this.resizeTimeout),this.win.cancelAnimationFrame(this.delayedFlush),this.win.cancelAnimationFrame(this.flushingAndroidKey),this.editContext&&(this.view.contentDOM.editContext=null,this.editContext.destroy())}}function OS(n,e,t){for(;e;){let i=Kt.get(e);if(i&&i.parent==n)return i;let l=e.parentNode;e=l!=n.dom?l:t>0?e.nextSibling:e.previousSibling}return null}function NS(n,e){let t=e.startContainer,i=e.startOffset,l=e.endContainer,o=e.endOffset,a=n.docView.domAtPos(n.state.selection.main.anchor,1);return Zu(a.node,a.offset,l,o)&&([t,i,l,o]=[l,o,t,i]),{anchorNode:t,anchorOffset:i,focusNode:l,focusOffset:o}}function Rj(n,e){if(e.getComposedRanges){let l=e.getComposedRanges(n.root)[0];if(l)return NS(n,l)}let t=null;function i(l){l.preventDefault(),l.stopImmediatePropagation(),t=l.getTargetRanges()[0]}return n.contentDOM.addEventListener("beforeinput",i,!0),n.dom.ownerDocument.execCommand("indent"),n.contentDOM.removeEventListener("beforeinput",i,!0),t?NS(n,t):null}class jj{constructor(e){this.from=0,this.to=0,this.pendingContextChange=null,this.handlers=Object.create(null),this.composing=null,this.resetRange(e.state);let t=this.editContext=new window.EditContext({text:e.state.doc.sliceString(this.from,this.to),selectionStart:this.toContextPos(Math.max(this.from,Math.min(this.to,e.state.selection.main.anchor))),selectionEnd:this.toContextPos(e.state.selection.main.head)});this.handlers.textupdate=i=>{let l=e.state.selection.main,{anchor:o,head:a}=l,c=this.toEditorPos(i.updateRangeStart),f=this.toEditorPos(i.updateRangeEnd);e.inputState.composing>=0&&!this.composing&&(this.composing={contextBase:i.updateRangeStart,editorBase:c,drifted:!1});let d=f-c>i.text.length;c==this.from&&othis.to&&(f=o);let p=uN(e.state.sliceDoc(c,f),i.text,(d?l.from:l.to)-c,d?"end":null);if(!p){let b=oe.single(this.toEditorPos(i.selectionStart),this.toEditorPos(i.selectionEnd));Sx(b,l)||e.dispatch({selection:b,userEvent:"select"});return}let g={from:p.from+c,to:p.toA+c,insert:pt.of(i.text.slice(p.from,p.toB).split(` -`))};if((ke.mac||ke.android)&&g.from==a-1&&/^\. ?$/.test(i.text)&&e.contentDOM.getAttribute("autocorrect")=="off"&&(g={from:c,to:f,insert:pt.of([i.text.replace("."," ")])}),this.pendingContextChange=g,!e.state.readOnly){let b=this.to-this.from+(g.to-g.from+g.insert.length);Ay(e,g,oe.single(this.toEditorPos(i.selectionStart,b),this.toEditorPos(i.selectionEnd,b)))}this.pendingContextChange&&(this.revertPending(e.state),this.setSelection(e.state)),g.from=0&&!/[\\p{Alphabetic}\\p{Number}_]/.test(t.text.slice(Math.max(0,i.updateRangeStart-1),Math.min(t.text.length,i.updateRangeStart+1)))&&this.handlers.compositionend(i)},this.handlers.characterboundsupdate=i=>{let l=[],o=null;for(let a=this.toEditorPos(i.rangeStart),c=this.toEditorPos(i.rangeEnd);a{let l=[];for(let o of i.getTextFormats()){let a=o.underlineStyle,c=o.underlineThickness;if(!/none/i.test(a)&&!/none/i.test(c)){let f=this.toEditorPos(o.rangeStart),d=this.toEditorPos(o.rangeEnd);if(f{e.inputState.composing<0&&(e.inputState.composing=0,e.inputState.compositionFirstChange=!0)},this.handlers.compositionend=()=>{if(e.inputState.composing=-1,e.inputState.compositionFirstChange=null,this.composing){let{drifted:i}=this.composing;this.composing=null,i&&this.reset(e.state)}};for(let i in this.handlers)t.addEventListener(i,this.handlers[i]);this.measureReq={read:i=>{let l=cc(i.root);l&&l.rangeCount&&this.editContext.updateSelectionBounds(l.getRangeAt(0).getBoundingClientRect())}}}applyEdits(e){let t=0,i=!1,l=this.pendingContextChange;return e.changes.iterChanges((o,a,c,f,d)=>{if(i)return;let p=d.length-(a-o);if(l&&a>=l.to)if(l.from==o&&l.to==a&&l.insert.eq(d)){l=this.pendingContextChange=null,t+=p,this.to+=p;return}else l=null,this.revertPending(e.state);if(o+=t,a+=t,a<=this.from)this.from+=p,this.to+=p;else if(othis.to||this.to-this.from+d.length>3e4){i=!0;return}this.editContext.updateText(this.toContextPos(o),this.toContextPos(a),d.toString()),this.to+=p}t+=p}),l&&!i&&this.revertPending(e.state),!i}update(e){let t=this.pendingContextChange,i=e.startState.selection.main;this.composing&&(this.composing.drifted||!e.changes.touchesRange(i.from,i.to)&&e.transactions.some(l=>!l.isUserEvent("input.type")&&l.changes.touchesRange(this.from,this.to)))?(this.composing.drifted=!0,this.composing.editorBase=e.changes.mapPos(this.composing.editorBase)):!this.applyEdits(e)||!this.rangeIsValid(e.state)?(this.pendingContextChange=null,this.reset(e.state)):(e.docChanged||e.selectionSet||t)&&this.setSelection(e.state),(e.geometryChanged||e.docChanged||e.selectionSet)&&e.view.requestMeasure(this.measureReq)}resetRange(e){let{head:t}=e.selection.main;this.from=Math.max(0,t-1e4),this.to=Math.min(e.doc.length,t+1e4)}reset(e){this.resetRange(e),this.editContext.updateText(0,this.editContext.text.length,e.doc.sliceString(this.from,this.to)),this.setSelection(e)}revertPending(e){let t=this.pendingContextChange;this.pendingContextChange=null,this.editContext.updateText(this.toContextPos(t.from),this.toContextPos(t.from+t.insert.length),e.doc.sliceString(t.from,t.to))}setSelection(e){let{main:t}=e.selection,i=this.toContextPos(Math.max(this.from,Math.min(this.to,t.anchor))),l=this.toContextPos(t.head);(this.editContext.selectionStart!=i||this.editContext.selectionEnd!=l)&&this.editContext.updateSelection(i,l)}rangeIsValid(e){let{head:t}=e.selection.main;return!(this.from>0&&t-this.from<500||this.to1e4*3)}toEditorPos(e,t=this.to-this.from){e=Math.min(e,t);let i=this.composing;return i&&i.drifted?i.editorBase+(e-i.contextBase):e+this.from}toContextPos(e){let t=this.composing;return t&&t.drifted?t.contextBase+(e-t.editorBase):e-this.from}destroy(){for(let e in this.handlers)this.editContext.removeEventListener(e,this.handlers[e])}}class Oe{get state(){return this.viewState.state}get viewport(){return this.viewState.viewport}get visibleRanges(){return this.viewState.visibleRanges}get inView(){return this.viewState.inView}get composing(){return!!this.inputState&&this.inputState.composing>0}get compositionStarted(){return!!this.inputState&&this.inputState.composing>=0}get root(){return this._root}get win(){return this.dom.ownerDocument.defaultView||window}constructor(e={}){var t;this.plugins=[],this.pluginMap=new Map,this.editorAttrs={},this.contentAttrs={},this.bidiCache=[],this.destroyed=!1,this.updateState=2,this.measureScheduled=-1,this.measureRequests=[],this.clearAnnouncement=-1,this.contentDOM=document.createElement("div"),this.scrollDOM=document.createElement("div"),this.scrollDOM.tabIndex=-1,this.scrollDOM.className="cm-scroller",this.scrollDOM.appendChild(this.contentDOM),this.announceDOM=document.createElement("div"),this.announceDOM.className="cm-announced",this.announceDOM.setAttribute("aria-live","polite"),this.dom=document.createElement("div"),this.dom.appendChild(this.announceDOM),this.dom.appendChild(this.scrollDOM),e.parent&&e.parent.appendChild(this.dom);let{dispatch:i}=e;this.dispatchTransactions=e.dispatchTransactions||i&&(l=>l.forEach(o=>i(o,this)))||(l=>this.update(l)),this.dispatch=this.dispatch.bind(this),this._root=e.root||oR(e.parent)||document,this.viewState=new SS(this,e.state||mt.create(e)),e.scrollTo&&e.scrollTo.is(mh)&&(this.viewState.scrollTarget=e.scrollTo.value.clip(this.viewState.state)),this.plugins=this.state.facet(ca).map(l=>new Jg(l));for(let l of this.plugins)l.update(this);this.observer=new Dj(this),this.inputState=new JR(this),this.inputState.ensureHandlers(this.plugins),this.docView=new cS(this),this.mountStyles(),this.updateAttrs(),this.updateState=0,this.requestMeasure(),!((t=document.fonts)===null||t===void 0)&&t.ready&&document.fonts.ready.then(()=>{this.viewState.mustMeasureContent="refresh",this.requestMeasure()})}dispatch(...e){let t=e.length==1&&e[0]instanceof hn?e:e.length==1&&Array.isArray(e[0])?e[0]:[this.state.update(...e)];this.dispatchTransactions(t,this)}update(e){if(this.updateState!=0)throw new Error("Calls to EditorView.update are not allowed while an update is in progress");let t=!1,i=!1,l,o=this.state;for(let b of e){if(b.startState!=o)throw new RangeError("Trying to update state with a transaction that doesn't start from the previous state.");o=b.state}if(this.destroyed){this.viewState.state=o;return}let a=this.hasFocus,c=0,f=null;e.some(b=>b.annotation(mN))?(this.inputState.notifiedFocused=a,c=1):a!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=a,f=gN(o,a),f||(c=1));let d=this.observer.delayedAndroidKey,p=null;if(d?(this.observer.clearDelayedAndroidKey(),p=this.observer.readChange(),(p&&!this.state.doc.eq(o.doc)||!this.state.selection.eq(o.selection))&&(p=null)):this.observer.clear(),o.facet(mt.phrases)!=this.state.facet(mt.phrases))return this.setState(o);l=dd.create(this,o,e),l.flags|=c;let g=this.viewState.scrollTarget;try{this.updateState=2;for(let b of e){if(g&&(g=g.map(b.changes)),b.scrollIntoView){let{main:v}=b.state.selection,{x:w,y:S}=this.state.facet(Oe.cursorScrollMargin);g=new ya(v.empty?v:oe.cursor(v.head,v.head>v.anchor?-1:1),"nearest","nearest",S,w)}for(let v of b.effects)v.is(mh)&&(g=v.value.clip(this.state))}this.viewState.update(l,g),this.bidiCache=yd.update(this.bidiCache,l.changes),l.empty||(this.updatePlugins(l),this.inputState.update(l)),t=this.docView.update(l),this.state.facet(Qu)!=this.styleModules&&this.mountStyles(),i=this.updateAttrs(),this.showAnnouncements(e),this.docView.updateSelection(t,e.some(b=>b.isUserEvent("select.pointer")))}finally{this.updateState=0}if(l.startState.facet(wh)!=l.state.facet(wh)&&(this.viewState.mustMeasureContent=!0),(t||i||g||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),t&&this.docViewUpdate(),!l.empty)for(let b of this.state.facet(bx))try{b(l)}catch(v){ci(this.state,v,"update listener")}(f||p)&&Promise.resolve().then(()=>{f&&this.state==f.startState&&this.dispatch(f),p&&!aN(this,p)&&d.force&&xa(this.contentDOM,d.key,d.keyCode)})}setState(e){if(this.updateState!=0)throw new Error("Calls to EditorView.setState are not allowed while an update is in progress");if(this.destroyed){this.viewState.state=e;return}this.updateState=2;let t=this.hasFocus;try{for(let i of this.plugins)i.destroy(this);this.viewState=new SS(this,e),this.plugins=e.facet(ca).map(i=>new Jg(i)),this.pluginMap.clear();for(let i of this.plugins)i.update(this);this.docView.destroy(),this.docView=new cS(this),this.inputState.ensureHandlers(this.plugins),this.mountStyles(),this.updateAttrs(),this.bidiCache=[]}finally{this.updateState=0}t&&this.focus(),this.requestMeasure()}updatePlugins(e){let t=e.startState.facet(ca),i=e.state.facet(ca);if(t!=i){let l=[];for(let o of i){let a=t.indexOf(o);if(a<0)l.push(new Jg(o));else{let c=this.plugins[a];c.mustUpdate=e,l.push(c)}}for(let o of this.plugins)o.mustUpdate!=e&&o.destroy(this);this.plugins=l,this.pluginMap.clear()}else for(let l of this.plugins)l.mustUpdate=e;for(let l=0;l-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.observer.delayedAndroidKey){this.measureScheduled=-1,this.requestMeasure();return}this.measureScheduled=0,e&&this.observer.forceFlush();let t=null,i=this.viewState.scrollParent,l=this.viewState.getScrollOffset(),{scrollAnchorPos:o,scrollAnchorHeight:a,scaleY:c}=this.viewState;Math.abs(l-this.viewState.scrollOffset)>1&&(a=-1),this.viewState.scrollAnchorHeight=-1;try{for(let f=0;;f++){if(a<0){if(LO(i||this.win))o=-1,a=this.viewState.heightMap.height/this.viewState.scaleY;else{let w=this.viewState.scrollAnchorAt(l);o=w.from,a=w.top}c=this.viewState.scaleY}this.updateState=1;let d=this.viewState.measure();if(!d&&!this.measureRequests.length&&this.viewState.scrollTarget==null)break;if(f>5){console.warn(this.measureRequests.length?"Measure loop restarted more than 5 times":"Viewport failed to stabilize");break}let p=[];d&4||([this.measureRequests,p]=[p,this.measureRequests]);let g=p.map(w=>{try{return w.read(this)}catch(S){return ci(this.state,S),TS}}),b=dd.create(this,this.state,[]),v=!1;b.flags|=d,t?t.flags|=d:t=b,this.updateState=2,b.empty||(this.updatePlugins(b),this.inputState.update(b),this.updateAttrs(),v=this.docView.update(b),v&&this.docViewUpdate());for(let w=0;w1||S<-1)&&!(ke.ios&&this.inputState.lastIOSMomentumScroll>Date.now()-100)&&(i==this.scrollDOM||this.hasFocus||Math.max(this.inputState.lastWheelEvent,this.inputState.lastTouchTime)>Date.now()-100)){l=l+S,i?o<0?i.scrollTop=i.scrollHeight:i.scrollTop+=S:this.win.scrollBy(0,S),a=-1;continue}}break}}}finally{this.updateState=0,this.measureScheduled=-1}if(t&&!t.empty)for(let f of this.state.facet(bx))f(t)}get themeClasses(){return Tx+" "+(this.state.facet(Nx)?vN:bN)+" "+this.state.facet(wh)}updateAttrs(){let e=AS(this,JO,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),t={spellcheck:"false",autocorrect:"off",autocapitalize:"off",writingsuggestions:"false",translate:"no",contenteditable:this.state.facet(nl)?"true":"false",class:"cm-content",style:`${ke.tabSize}: ${this.state.tabSize}`,role:"textbox","aria-multiline":"true"};this.state.readOnly&&(t["aria-readonly"]="true"),AS(this,Oy,t);let i=this.observer.ignore(()=>{let l=rS(this.contentDOM,this.contentAttrs,t),o=rS(this.dom,this.editorAttrs,e);return l||o});return this.editorAttrs=e,this.contentAttrs=t,i}showAnnouncements(e){let t=!0;for(let i of e)for(let l of i.effects)if(l.is(Oe.announce)){t&&(this.announceDOM.textContent="",this.win.clearTimeout(this.clearAnnouncement),this.clearAnnouncement=this.win.setTimeout(()=>{this.announceDOM.textContent=" "},200),t=!1);let o=this.announceDOM.appendChild(document.createElement("div"));o.textContent=l.value}}mountStyles(){this.styleModules=this.state.facet(Qu);let e=this.state.facet(Oe.cspNonce);ts.mount(this.root,this.styleModules.concat(Ej).reverse(),e?{nonce:e}:void 0)}readMeasured(){if(this.updateState==2)throw new Error("Reading the editor layout isn't allowed during an update");this.updateState==0&&this.measureScheduled>-1&&this.measure(!1)}requestMeasure(e){if(this.measureScheduled<0&&(this.measureScheduled=this.win.requestAnimationFrame(()=>this.measure())),e){if(this.measureRequests.indexOf(e)>-1)return;if(e.key!=null){for(let t=0;ti.plugin==e)||null),t&&t.update(this).value}get documentTop(){return this.contentDOM.getBoundingClientRect().top+this.viewState.paddingTop}get documentPadding(){return{top:this.viewState.paddingTop,bottom:this.viewState.paddingBottom}}get scaleX(){return this.viewState.scaleX}get scaleY(){return this.viewState.scaleY}elementAtHeight(e){return this.readMeasured(),this.viewState.elementAtHeight(e)}lineBlockAtHeight(e){return this.readMeasured(),this.viewState.lineBlockAtHeight(e)}get viewportLineBlocks(){return this.viewState.viewportLines}lineBlockAt(e){return this.viewState.lineBlockAt(e)}get contentHeight(){return this.viewState.contentHeight}moveByChar(e,t,i){return i0(this,e,fS(this,e,t,i))}moveByGroup(e,t){return i0(this,e,fS(this,e,t,i=>qR(this,e.head,i)))}visualLineSide(e,t){return t?oe.cursor(e.to,1):oe.cursor(e.from,-1)}moveToLineBoundary(e,t,i=!0){return FR(this,e,t,i)}moveVertically(e,t,i){return i0(this,e,VR(this,e,t,i))}domAtPos(e,t=1){return this.docView.domAtPos(e,t)}posAtDOM(e,t=0){return this.docView.posFromDOM(e,t)}posAtCoords(e,t=!0){this.readMeasured();let i=kx(this,e,t);return i&&i.pos}posAndSideAtCoords(e,t=!0){return this.readMeasured(),kx(this,e,t)}coordsAtPos(e,t=1){this.readMeasured();let i=this.state.doc.lineAt(e),l=this.bidiSpans(i),o=l[Ar.find(l,e-i.from,-1,t)];return i.length&&(e==i.from&&t<0||e==i.to&&t>0)&&o.dir!=this.textDirectionAt(i.from)&&(e==i.to?(e=i.from+o.from,t=1):(e=i.from+o.to,t=-1)),this.docView.coordsAt(e,t,o.dir==At.RTL)}coordsForChar(e){return this.readMeasured(),this.docView.coordsForChar(e)}get defaultCharacterWidth(){return this.viewState.heightOracle.charWidth}get defaultLineHeight(){return this.viewState.heightOracle.lineHeight}get textDirection(){return this.viewState.defaultTextDirection}textDirectionAt(e){return!this.state.facet(YO)||ethis.viewport.to?this.textDirection:(this.readMeasured(),this.docView.textDirectionAt(e))}get lineWrapping(){return this.viewState.heightOracle.lineWrapping}bidiSpans(e){if(e.length>_j)return UO(e.length);let t=this.textDirectionAt(e.from),i;for(let o of this.bidiCache)if(o.from==e.from&&o.dir==t&&(o.fresh||IO(o.isolates,i=oS(this,e))))return o.order;i||(i=oS(this,e));let l=mR(e.text,t,i);return this.bidiCache.push(new yd(e.from,e.to,t,i,!0,l)),l}get hasFocus(){var e;return(this.dom.ownerDocument.hasFocus()||ke.safari&&((e=this.inputState)===null||e===void 0?void 0:e.lastContextMenu)>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore(()=>{_O(this.contentDOM),this.docView.updateSelection()})}setRoot(e){this._root!=e&&(this._root=e,this.observer.setWindow((e.nodeType==9?e:e.ownerDocument).defaultView||window),this.mountStyles())}destroy(){this.root.activeElement==this.contentDOM&&this.contentDOM.blur();for(let e of this.plugins)e.destroy(this);this.plugins=[],this.inputState.destroy(),this.docView.destroy(),this.dom.remove(),this.observer.destroy(),this.win.clearTimeout(this.clearAnnouncement),this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.destroyed=!0}static scrollIntoView(e,t={}){var i,l,o,a;return mh.of(new ya(typeof e=="number"?oe.cursor(e):e,(i=t.y)!==null&&i!==void 0?i:"nearest",(l=t.x)!==null&&l!==void 0?l:"nearest",(o=t.yMargin)!==null&&o!==void 0?o:5,(a=t.xMargin)!==null&&a!==void 0?a:5))}scrollSnapshot(){let{scrollTop:e,scrollLeft:t}=this.scrollDOM,i=this.viewState.scrollAnchorAt(e);return mh.of(new ya(oe.cursor(i.from),"start","start",i.top-e,t,!0))}setTabFocusMode(e){e==null?this.inputState.tabFocusMode=this.inputState.tabFocusMode<0?0:-1:typeof e=="boolean"?this.inputState.tabFocusMode=e?0:-1:this.inputState.tabFocusMode!=0&&(this.inputState.tabFocusMode=Date.now()+e)}static domEventHandlers(e){return en.define(()=>({}),{eventHandlers:e})}static domEventObservers(e){return en.define(()=>({}),{eventObservers:e})}static theme(e,t){let i=ts.newName(),l=[wh.of(i),Qu.of(Ax(`.${i}`,e))];return t&&t.dark&&l.push(Nx.of(!0)),l}static baseTheme(e){return oo.lowest(Qu.of(Ax("."+Tx,e,wN)))}static findFromDOM(e){var t;let i=e.querySelector(".cm-content"),l=i&&Kt.get(i)||Kt.get(e);return((t=l==null?void 0:l.root)===null||t===void 0?void 0:t.view)||null}}Oe.styleModule=Qu;Oe.inputHandler=$O;Oe.clipboardInputFilter=Sy;Oe.clipboardOutputFilter=Cy;Oe.scrollHandler=WO;Oe.focusChangeEffect=GO;Oe.perLineTextDirection=YO;Oe.exceptionSink=XO;Oe.updateListener=bx;Oe.editable=nl;Oe.mouseSelectionStyle=QO;Oe.dragMovesSelection=VO;Oe.clickAddsSelectionRange=qO;Oe.decorations=Yd;Oe.blockWrappers=eN;Oe.outerDecorations=Ny;Oe.atomicRanges=Nc;Oe.bidiIsolatedRanges=tN;Oe.cursorScrollMargin=Ce.define({combine:n=>{let e=5,t=5;for(let i of n)typeof i=="number"?e=t=i:{x:e,y:t}=i;return{x:e,y:t}}});Oe.scrollMargins=iN;Oe.darkTheme=Nx;Oe.cspNonce=Ce.define({combine:n=>n.length?n[0]:""});Oe.contentAttributes=Oy;Oe.editorAttributes=JO;Oe.lineWrapping=Oe.contentAttributes.of({class:"cm-lineWrapping"});Oe.announce=Ye.define();const _j=4096,TS={};class yd{constructor(e,t,i,l,o,a){this.from=e,this.to=t,this.dir=i,this.isolates=l,this.fresh=o,this.order=a}static update(e,t){if(t.empty&&!e.some(o=>o.fresh))return e;let i=[],l=e.length?e[e.length-1].dir:At.LTR;for(let o=Math.max(0,e.length-10);o=0;l--){let o=i[l],a=typeof o=="function"?o(n):o;a&&vy(a,t)}return t}const Lj=ke.mac?"mac":ke.windows?"win":ke.linux?"linux":"key";function zj(n,e){const t=n.split(/-(?!$)/);let i=t[t.length-1];i=="Space"&&(i=" ");let l,o,a,c;for(let f=0;fi.concat(l),[]))),t}function Pj(n,e,t){return SN(kN(n.state),e,n,t)}let Xl=null;const Hj=4e3;function Ij(n,e=Lj){let t=Object.create(null),i=Object.create(null),l=(a,c)=>{let f=i[a];if(f==null)i[a]=c;else if(f!=c)throw new Error("Key binding "+a+" is used both as a regular binding and as a multi-stroke prefix")},o=(a,c,f,d,p)=>{var g,b;let v=t[a]||(t[a]=Object.create(null)),w=c.split(/ (?!$)/).map(O=>zj(O,e));for(let O=1;O{let H=Xl={view:M,prefix:j,scope:a};return setTimeout(()=>{Xl==H&&(Xl=null)},Hj),!0}]})}let S=w.join(" ");l(S,!1);let C=v[S]||(v[S]={preventDefault:!1,stopPropagation:!1,run:((b=(g=v._any)===null||g===void 0?void 0:g.run)===null||b===void 0?void 0:b.slice())||[]});f&&C.run.push(f),d&&(C.preventDefault=!0),p&&(C.stopPropagation=!0)};for(let a of n){let c=a.scope?a.scope.split(" "):["editor"];if(a.any)for(let d of c){let p=t[d]||(t[d]=Object.create(null));p._any||(p._any={preventDefault:!1,stopPropagation:!1,run:[]});let{any:g}=a;for(let b in p)p[b].run.push(v=>g(v,Ex))}let f=a[e]||a.key;if(f)for(let d of c)o(d,f,a.run,a.preventDefault,a.stopPropagation),a.shift&&o(d,"Shift-"+f,a.shift,a.preventDefault,a.stopPropagation)}return t}let Ex=null;function SN(n,e,t,i){Ex=e;let l=eR(e),o=oi(l,0),a=Nr(o)==l.length&&l!=" ",c="",f=!1,d=!1,p=!1;Xl&&Xl.view==t&&Xl.scope==i&&(c=Xl.prefix+" ",fN.indexOf(e.keyCode)<0&&(d=!0,Xl=null));let g=new Set,b=C=>{if(C){for(let O of C.run)if(!g.has(O)&&(g.add(O),O(t)))return C.stopPropagation&&(p=!0),!0;C.preventDefault&&(C.stopPropagation&&(p=!0),d=!0)}return!1},v=n[i],w,S;return v&&(b(v[c+kh(l,e,!a)])?f=!0:a&&(e.altKey||e.metaKey||e.ctrlKey)&&!(ke.windows&&e.ctrlKey&&e.altKey)&&!(ke.mac&&e.altKey&&!(e.ctrlKey||e.metaKey))&&(w=ns[e.keyCode])&&w!=l?(b(v[c+kh(w,e,!0)])||e.shiftKey&&(S=ac[e.keyCode])!=l&&S!=w&&b(v[c+kh(S,e,!1)]))&&(f=!0):a&&e.shiftKey&&b(v[c+kh(l,e,!0)])&&(f=!0),!f&&b(v._any)&&(f=!0)),d&&(f=!0),f&&p&&e.stopPropagation(),Ex=null,f}class Js{constructor(e,t,i,l,o){this.className=e,this.left=t,this.top=i,this.width=l,this.height=o}draw(){let e=document.createElement("div");return e.className=this.className,this.adjust(e),e}update(e,t){return t.className!=this.className?!1:(this.adjust(e),!0)}adjust(e){e.style.left=this.left+"px",e.style.top=this.top+"px",this.width!=null&&(e.style.width=this.width+"px"),e.style.height=this.height+"px"}eq(e){return this.left==e.left&&this.top==e.top&&this.width==e.width&&this.height==e.height&&this.className==e.className}static forRange(e,t,i){if(i.empty){let l=e.coordsAtPos(i.head,i.assoc||1);if(!l)return[];let o=CN(e);return[new Js(t,l.left-o.left,l.top-o.top,null,l.bottom-l.top)]}else return Uj(e,t,i)}}function CN(n){let e=n.scrollDOM.getBoundingClientRect();return{left:(n.textDirection==At.LTR?e.left:e.right-n.scrollDOM.clientWidth*n.scaleX)-n.scrollDOM.scrollLeft*n.scaleX,top:e.top-n.scrollDOM.scrollTop*n.scaleY}}function MS(n,e,t,i){let l=n.coordsAtPos(e,t*2);if(!l)return i;let o=n.dom.getBoundingClientRect(),a=(l.top+l.bottom)/2,c=n.posAtCoords({x:o.left+1,y:a}),f=n.posAtCoords({x:o.right-1,y:a});return c==null||f==null?i:{from:Math.max(i.from,Math.min(c,f)),to:Math.min(i.to,Math.max(c,f))}}function Uj(n,e,t){if(t.to<=n.viewport.from||t.from>=n.viewport.to)return[];let i=Math.max(t.from,n.viewport.from),l=Math.min(t.to,n.viewport.to),o=n.textDirection==At.LTR,a=n.contentDOM,c=a.getBoundingClientRect(),f=CN(n),d=a.querySelector(".cm-line"),p=d&&window.getComputedStyle(d),g=c.left+(p?parseInt(p.paddingLeft)+Math.min(0,parseInt(p.textIndent)):0),b=c.right-(p?parseInt(p.paddingRight):0),v=wx(n,i,1),w=wx(n,l,-1),S=v.type==Dn.Text?v:null,C=w.type==Dn.Text?w:null;if(S&&(n.lineWrapping||v.widgetLineBreaks)&&(S=MS(n,i,1,S)),C&&(n.lineWrapping||w.widgetLineBreaks)&&(C=MS(n,l,-1,C)),S&&C&&S.from==C.from&&S.to==C.to)return j(M(t.from,t.to,S));{let P=S?M(t.from,null,S):H(v,!1),A=C?M(null,t.to,C):H(w,!0),T=[];return(S||v).to<(C||w).from-(S&&C?1:0)||v.widgetLineBreaks>1&&P.bottom+n.defaultLineHeight/2U&&de.from=L)break;E>ie&&W(Math.max(le,ie),P==null&&le<=U,Math.min(E,L),A==null&&E>=re,se.dir)}if(ie=ee.to+1,ie>=L)break}return F.length==0&&W(U,P==null,re,A==null,n.textDirection),{top:z,bottom:ne,horizontal:F}}function H(P,A){let T=c.top+(A?P.top:P.bottom);return{top:T,bottom:T,horizontal:[]}}}function Fj(n,e){return n.constructor==e.constructor&&n.eq(e)}class qj{constructor(e,t){this.view=e,this.layer=t,this.drawn=[],this.scaleX=1,this.scaleY=1,this.measureReq={read:this.measure.bind(this),write:this.draw.bind(this)},this.dom=e.scrollDOM.appendChild(document.createElement("div")),this.dom.classList.add("cm-layer"),t.above&&this.dom.classList.add("cm-layer-above"),t.class&&this.dom.classList.add(t.class),this.scale(),this.dom.setAttribute("aria-hidden","true"),this.setOrder(e.state),e.requestMeasure(this.measureReq),t.mount&&t.mount(this.dom,e)}update(e){e.startState.facet(Jh)!=e.state.facet(Jh)&&this.setOrder(e.state),(this.layer.update(e,this.dom)||e.geometryChanged)&&(this.scale(),e.view.requestMeasure(this.measureReq))}docViewUpdate(e){this.layer.updateOnDocViewUpdate!==!1&&e.requestMeasure(this.measureReq)}setOrder(e){let t=0,i=e.facet(Jh);for(;t!Fj(t,this.drawn[i]))){let t=this.dom.firstChild,i=0;for(let l of e)l.update&&t&&l.constructor&&this.drawn[i].constructor&&l.update(t,this.drawn[i])?(t=t.nextSibling,i++):this.dom.insertBefore(l.draw(),t);for(;t;){let l=t.nextSibling;t.remove(),t=l}this.drawn=e,ke.webkit&&(this.dom.style.display=this.dom.firstChild?"":"none")}}destroy(){this.layer.destroy&&this.layer.destroy(this.dom,this.view),this.dom.remove()}}const Jh=Ce.define();function ON(n){return[en.define(e=>new qj(e,n)),Jh.of(n)]}const Mx=!ke.ios,Da=Ce.define({combine(n){return jr(n,{cursorBlinkRate:1200,drawRangeCursor:!0,iosSelectionHandles:!0},{cursorBlinkRate:(e,t)=>Math.min(e,t),drawRangeCursor:(e,t)=>e||t})}});function Vj(n={}){return[Da.of(n),Qj,Xj,Gj,KO.of(!0)]}function NN(n){return n.startState.facet(Da)!=n.state.facet(Da)}const Qj=ON({above:!0,markers(n){let{state:e}=n,t=e.facet(Da),i=[];for(let l of e.selection.ranges){let o=l==e.selection.main;if(l.empty||t.drawRangeCursor&&!(o&&ke.ios&&t.iosSelectionHandles)){let a=o?"cm-cursor cm-cursor-primary":"cm-cursor cm-cursor-secondary",c=l.empty?l:oe.cursor(l.head,l.assoc);for(let f of Js.forRange(n,a,c))i.push(f)}}return i},update(n,e){n.transactions.some(i=>i.selection)&&(e.style.animationName=e.style.animationName=="cm-blink"?"cm-blink2":"cm-blink");let t=NN(n);return t&&DS(n.state,e),n.docChanged||n.selectionSet||t},mount(n,e){DS(e.state,n)},class:"cm-cursorLayer"});function DS(n,e){e.style.animationDuration=n.facet(Da).cursorBlinkRate+"ms"}const Xj=ON({above:!1,markers(n){let e=[],{main:t,ranges:i}=n.state.selection;for(let l of i)if(!l.empty&&(Mx||l!=t))for(let o of Js.forRange(n,"cm-selectionBackground",l))e.push(o);if(ke.ios&&!t.empty&&n.state.facet(Da).iosSelectionHandles){for(let l of Js.forRange(n,"cm-selectionHandle cm-selectionHandle-start",oe.cursor(t.from,1)))e.push(l);for(let l of Js.forRange(n,"cm-selectionHandle cm-selectionHandle-end",oe.cursor(t.to,1)))e.push(l)}return e},update(n,e){return n.docChanged||n.selectionSet||n.viewportChanged||NN(n)},class:"cm-selectionLayer"}),$j=ke.gecko&&ke.gecko_version==153?"#ffffff01":"transparent",Gj=oo.highest(Oe.theme({".cm-line":{...Mx?{"& ::selection, &::selection":{backgroundColor:`${$j} !important`}}:{},caretColor:"transparent !important"},".cm-content":{caretColor:"transparent !important","& :focus":{caretColor:"initial !important",...Mx?{"&::selection, & ::selection":{backgroundColor:"Highlight !important"}}:{}}}})),TN=Ye.define({map(n,e){return n==null?null:e.mapPos(n)}}),$u=Pn.define({create(){return null},update(n,e){return n!=null&&(n=e.changes.mapPos(n)),e.effects.reduce((t,i)=>i.is(TN)?i.value:t,n)}}),Yj=en.fromClass(class{constructor(n){this.view=n,this.cursor=null,this.measureReq={read:this.readPos.bind(this),write:this.drawCursor.bind(this)}}update(n){var e;let t=n.state.field($u);t==null?this.cursor!=null&&((e=this.cursor)===null||e===void 0||e.remove(),this.cursor=null):(this.cursor||(this.cursor=this.view.scrollDOM.appendChild(document.createElement("div")),this.cursor.className="cm-dropCursor"),(n.startState.field($u)!=t||n.docChanged||n.geometryChanged)&&this.view.requestMeasure(this.measureReq))}readPos(){let{view:n}=this,e=n.state.field($u),t=e!=null&&n.coordsAtPos(e);if(!t)return null;let i=n.scrollDOM.getBoundingClientRect();return{left:t.left-i.left+n.scrollDOM.scrollLeft*n.scaleX,top:t.top-i.top+n.scrollDOM.scrollTop*n.scaleY,height:t.bottom-t.top}}drawCursor(n){if(this.cursor){let{scaleX:e,scaleY:t}=this.view;n?(this.cursor.style.left=n.left/e+"px",this.cursor.style.top=n.top/t+"px",this.cursor.style.height=n.height/t+"px"):this.cursor.style.left="-100000px"}}destroy(){this.cursor&&this.cursor.remove()}setDropPos(n){this.view.state.field($u)!=n&&this.view.dispatch({effects:TN.of(n)})}},{eventObservers:{dragover(n){this.setDropPos(this.view.posAtCoords({x:n.clientX,y:n.clientY}))},dragleave(n){(n.target==this.view.contentDOM||!this.view.contentDOM.contains(n.relatedTarget))&&this.setDropPos(null)},dragend(){this.setDropPos(null)},drop(){this.setDropPos(null)}}});function Kj(){return[$u,Yj]}function RS(n,e,t,i,l){e.lastIndex=0;for(let o=n.iterRange(t,i),a=t,c;!o.next().done;a+=o.value.length)if(!o.lineBreak)for(;c=e.exec(o.value);)l(a+c.index,c)}function Wj(n,e){let t=n.visibleRanges;if(t.length==1&&t[0].from==n.viewport.from&&t[0].to==n.viewport.to)return t;let i=[];for(let{from:l,to:o}of t)l=Math.max(n.state.doc.lineAt(l).from,l-e),o=Math.min(n.state.doc.lineAt(o).to,o+e),i.length&&i[i.length-1].to>=l?i[i.length-1].to=o:i.push({from:l,to:o});return i}class Zj{constructor(e){const{regexp:t,decoration:i,decorate:l,boundary:o,maxLength:a=1e3}=e;if(!t.global)throw new RangeError("The regular expression given to MatchDecorator should have its 'g' flag set");if(this.regexp=t,l)this.addMatch=(c,f,d,p)=>l(p,d,d+c[0].length,c,f);else if(typeof i=="function")this.addMatch=(c,f,d,p)=>{let g=i(c,f,d);g&&p(d,d+c[0].length,g)};else if(i)this.addMatch=(c,f,d,p)=>p(d,d+c[0].length,i);else throw new RangeError("Either 'decorate' or 'decoration' should be provided to MatchDecorator");this.boundary=o,this.maxLength=a}createDeco(e){let t=new Rr,i=t.add.bind(t);for(let{from:l,to:o}of Wj(e,this.maxLength))RS(e.state.doc,this.regexp,l,o,(a,c)=>this.addMatch(c,e,a,i));return t.finish()}updateDeco(e,t){let i=1e9,l=-1;return e.docChanged&&e.changes.iterChanges((o,a,c,f)=>{f>=e.view.viewport.from&&c<=e.view.viewport.to&&(i=Math.min(c,i),l=Math.max(f,l))}),e.viewportMoved||l-i>1e3?this.createDeco(e.view):l>-1?this.updateRange(e.view,t.map(e.changes),i,l):t}updateRange(e,t,i,l){for(let o of e.visibleRanges){let a=Math.max(o.from,i),c=Math.min(o.to,l);if(c>=a){let f=e.state.doc.lineAt(a),d=f.tof.from;a--)if(this.boundary.test(f.text[a-1-f.from])){p=a;break}for(;cb.push(O.range(S,C));if(f==d)for(this.regexp.lastIndex=p-f.from;(v=this.regexp.exec(f.text))&&v.indexthis.addMatch(C,e,S,w));t=t.update({filterFrom:p,filterTo:g,filter:(S,C)=>Sg,add:b})}}return t}}const Dx=/x/.unicode!=null?"gu":"g",Jj=new RegExp(`[\0-\b ---Ÿ­؜​‎‏\u2028\u2029‭‮⁦⁧⁩\uFEFF-]`,Dx),e_={0:"null",7:"bell",8:"backspace",10:"newline",11:"vertical tab",13:"carriage return",27:"escape",8203:"zero width space",8204:"zero width non-joiner",8205:"zero width joiner",8206:"left-to-right mark",8207:"right-to-left mark",8232:"line separator",8237:"left-to-right override",8238:"right-to-left override",8294:"left-to-right isolate",8295:"right-to-left isolate",8297:"pop directional isolate",8233:"paragraph separator",65279:"zero width no-break space",65532:"object replacement"};let s0=null;function t_(){var n;if(s0==null&&typeof document<"u"&&document.body){let e=document.body.style;s0=((n=e.tabSize)!==null&&n!==void 0?n:e.MozTabSize)!=null}return s0||!1}const ed=Ce.define({combine(n){let e=jr(n,{render:null,specialChars:Jj,addSpecialChars:null});return(e.replaceTabs=!t_())&&(e.specialChars=new RegExp(" |"+e.specialChars.source,Dx)),e.addSpecialChars&&(e.specialChars=new RegExp(e.specialChars.source+"|"+e.addSpecialChars.source,Dx)),e}});function n_(n={}){return[ed.of(n),i_()]}let jS=null;function i_(){return jS||(jS=en.fromClass(class{constructor(n){this.view=n,this.decorations=Ie.none,this.decorationCache=Object.create(null),this.decorator=this.makeDecorator(n.state.facet(ed)),this.decorations=this.decorator.createDeco(n)}makeDecorator(n){return new Zj({regexp:n.specialChars,decoration:(e,t,i)=>{let{doc:l}=t.state,o=oi(e[0],0);if(o==9){let a=l.lineAt(i),c=t.state.tabSize,f=La(a.text,c,i-a.from);return Ie.replace({widget:new o_((c-f%c)*this.view.defaultCharacterWidth/this.view.scaleX)})}return this.decorationCache[o]||(this.decorationCache[o]=Ie.replace({widget:new s_(n,o)}))},boundary:n.replaceTabs?void 0:/[^]/})}update(n){let e=n.state.facet(ed);n.startState.facet(ed)!=e?(this.decorator=this.makeDecorator(e),this.decorations=this.decorator.createDeco(n.view)):this.decorations=this.decorator.updateDeco(n,this.decorations)}},{decorations:n=>n.decorations}))}const r_="•";function l_(n){return n>=32?r_:n==10?"␤":String.fromCharCode(9216+n)}class s_ extends ul{constructor(e,t){super(),this.options=e,this.code=t}eq(e){return e.code==this.code}toDOM(e){let t=l_(this.code),i=e.state.phrase("Control character")+" "+(e_[this.code]||"0x"+this.code.toString(16)),l=this.options.render&&this.options.render(this.code,i,t);if(l)return l;let o=document.createElement("span");return o.textContent=t,o.title=i,o.setAttribute("aria-label",i),o.className="cm-specialChar",o}ignoreEvent(){return!1}}class o_ extends ul{constructor(e){super(),this.width=e}eq(e){return e.width==this.width}toDOM(){let e=document.createElement("span");return e.textContent=" ",e.className="cm-tab",e.style.width=this.width+"px",e}ignoreEvent(){return!1}}function a_(){return c_}const u_=Ie.line({class:"cm-activeLine"}),c_=en.fromClass(class{constructor(n){this.decorations=this.getDeco(n)}update(n){(n.docChanged||n.selectionSet)&&(this.decorations=this.getDeco(n.view))}getDeco(n){let e=-1,t=[];for(let i of n.state.selection.ranges){let l=n.lineBlockAt(i.head);l.from>e&&(t.push(u_.range(l.from)),e=l.from)}return Ie.set(t)}},{decorations:n=>n.decorations}),Rx=2e3;function f_(n,e,t){let i=Math.min(e.line,t.line),l=Math.max(e.line,t.line),o=[];if(e.off>Rx||t.off>Rx||e.col<0||t.col<0){let a=Math.min(e.off,t.off),c=Math.max(e.off,t.off);for(let f=i;f<=l;f++){let d=n.doc.line(f);d.length<=c&&o.push(oe.range(d.from+a,d.to+c))}}else{let a=Math.min(e.col,t.col),c=Math.max(e.col,t.col);for(let f=i;f<=l;f++){let d=n.doc.line(f),p=ax(d.text,a,n.tabSize,!0);if(p<0)o.push(oe.cursor(d.to));else{let g=ax(d.text,c,n.tabSize);o.push(oe.range(d.from+p,d.from+g))}}}return o}function h_(n,e){let t=n.coordsAtPos(n.viewport.from);return t?Math.round(Math.abs((t.left-e)/n.defaultCharacterWidth)):-1}function _S(n,e){let t=n.posAtCoords({x:e.clientX,y:e.clientY},!1),i=n.state.doc.lineAt(t),l=t-i.from,o=l>Rx?-1:l==i.length?h_(n,e.clientX):La(i.text,n.state.tabSize,t-i.from);return{line:i.number,col:o,off:l}}function d_(n,e){let t=_S(n,e),i=n.state.selection;return t?{update(l){if(l.docChanged){let o=l.changes.mapPos(l.startState.doc.line(t.line).from),a=l.state.doc.lineAt(o);t={line:a.number,col:t.col,off:Math.min(t.off,a.length)},i=i.map(l.changes)}},get(l,o,a){let c=_S(n,l);if(!c)return i;let f=f_(n.state,t,c);return f.length?a?oe.create(f.concat(i.ranges)):oe.create(f):i}}:null}function p_(n){let e=(t=>t.altKey&&t.button==0);return Oe.mouseSelectionStyle.of((t,i)=>e(i)?d_(t,i):null)}const m_={Alt:[18,n=>!!n.altKey],Control:[17,n=>!!n.ctrlKey],Shift:[16,n=>!!n.shiftKey],Meta:[91,n=>!!n.metaKey]},g_={style:"cursor: crosshair"};function x_(n={}){let[e,t]=m_[n.key||"Alt"],i=en.fromClass(class{constructor(l){this.view=l,this.isDown=!1}set(l){this.isDown!=l&&(this.isDown=l,this.view.update([]))}},{eventObservers:{keydown(l){this.set(l.keyCode==e||t(l))},keyup(l){(l.keyCode==e||!t(l))&&this.set(!1)},mousemove(l){this.set(t(l))}}});return[i,Oe.contentAttributes.of(l=>{var o;return!((o=l.plugin(i))===null||o===void 0)&&o.isDown?g_:null})]}const Sh="-10000px";class AN{constructor(e,t,i,l){this.facet=t,this.createTooltipView=i,this.removeTooltipView=l,this.input=e.state.facet(t),this.tooltips=this.input.filter(a=>a);let o=null;this.tooltipViews=this.tooltips.map(a=>o=i(a,o))}update(e,t){var i;let l=e.state.facet(this.facet),o=l.filter(f=>f);if(l===this.input){for(let f of this.tooltipViews)f.update&&f.update(e);return!1}let a=[],c=t?[]:null;for(let f=0;ft[d]=f),t.length=c.length),this.input=l,this.tooltips=o,this.tooltipViews=a,!0}}function EN(n){let e=n.dom.ownerDocument.documentElement,t=e.clientWidth,i=getComputedStyle(e);if(!/stable/.test(i.scrollbarGutter||""))return{left:0,right:t};let l=e.getBoundingClientRect(),o=n.win.scrollX;return{left:Math.max(0,l.left+o-parseFloat(i.marginLeft)),right:Math.min(t,l.right+o+parseFloat(i.marginRight))}}function y_(n){let{left:e,right:t}=EN(n);return{top:0,left:e,right:t,bottom:n.dom.ownerDocument.documentElement.clientHeight}}const o0=Ce.define({combine:n=>{var e,t,i;return{position:ke.ios?"absolute":((e=n.find(l=>l.position))===null||e===void 0?void 0:e.position)||"fixed",parent:((t=n.find(l=>l.parent))===null||t===void 0?void 0:t.parent)||null,tooltipSpace:((i=n.find(l=>l.tooltipSpace))===null||i===void 0?void 0:i.tooltipSpace)||y_}}}),LS=new WeakMap,Dy=en.fromClass(class{constructor(n){this.view=n,this.above=[],this.inView=!0,this.madeAbsolute=!1,this.lastTransaction=0,this.measureTimeout=-1;let e=n.state.facet(o0);this.position=e.position,this.parent=e.parent,this.classes=n.themeClasses,this.createContainer(),this.measureReq={read:this.readMeasure.bind(this),write:this.writeMeasure.bind(this),key:this},this.resizeObserver=typeof ResizeObserver=="function"?new ResizeObserver(()=>this.measureSoon()):null,this.manager=new AN(n,Ry,(t,i)=>this.createTooltip(t,i),t=>{this.resizeObserver&&this.resizeObserver.unobserve(t.dom),t.dom.remove()}),this.above=this.manager.tooltips.map(t=>!!t.above),this.intersectionObserver=typeof IntersectionObserver=="function"?new IntersectionObserver(t=>{Date.now()>this.lastTransaction-50&&t.length>0&&t[t.length-1].intersectionRatio<1&&this.measureSoon()},{threshold:[1]}):null,this.observeIntersection(),n.win.addEventListener("resize",this.measureSoon=this.measureSoon.bind(this)),this.maybeMeasure()}createContainer(){this.parent?(this.container=document.createElement("div"),this.container.style.position="relative",this.container.className=this.view.themeClasses,this.parent.appendChild(this.container)):this.container=this.view.dom}observeIntersection(){if(this.intersectionObserver){this.intersectionObserver.disconnect();for(let n of this.manager.tooltipViews)this.intersectionObserver.observe(n.dom)}}measureSoon(){this.measureTimeout<0&&(this.measureTimeout=setTimeout(()=>{this.measureTimeout=-1,this.maybeMeasure()},50))}update(n){n.transactions.length&&(this.lastTransaction=Date.now());let e=this.manager.update(n,this.above);e&&this.observeIntersection();let t=e||n.geometryChanged,i=n.state.facet(o0);if(i.position!=this.position&&!this.madeAbsolute){this.position=i.position;for(let l of this.manager.tooltipViews)l.dom.style.position=this.position;t=!0}if(i.parent!=this.parent){this.parent&&this.container.remove(),this.parent=i.parent,this.createContainer();for(let l of this.manager.tooltipViews)this.container.appendChild(l.dom);t=!0}else this.parent&&this.view.themeClasses!=this.classes&&(this.classes=this.container.className=this.view.themeClasses);t&&this.maybeMeasure()}createTooltip(n,e){let t=n.create(this.view),i=e?e.dom:null;if(t.dom.classList.add("cm-tooltip"),n.arrow&&!t.dom.querySelector(".cm-tooltip > .cm-tooltip-arrow")){let l=document.createElement("div");l.className="cm-tooltip-arrow",t.dom.appendChild(l)}return t.dom.style.position=this.position,t.dom.style.top=Sh,t.dom.style.left="0px",this.container.insertBefore(t.dom,i),t.mount&&t.mount(this.view),this.resizeObserver&&this.resizeObserver.observe(t.dom),t}destroy(){var n,e,t;this.view.win.removeEventListener("resize",this.measureSoon);for(let i of this.manager.tooltipViews)i.dom.remove(),(n=i.destroy)===null||n===void 0||n.call(i);this.parent&&this.container.remove(),(e=this.resizeObserver)===null||e===void 0||e.disconnect(),(t=this.intersectionObserver)===null||t===void 0||t.disconnect(),clearTimeout(this.measureTimeout)}readMeasure(){let n=1,e=1,t=!1,i=0;if(this.position=="fixed"&&this.manager.tooltipViews.length){let{dom:a}=this.manager.tooltipViews[0];if(ke.safari){let c=a.getBoundingClientRect();t=Math.abs(c.top+1e4)>1||Math.abs(c.left)>1}else t=!!a.offsetParent&&a.offsetParent!=this.container.ownerDocument.body}if(t||this.position=="absolute")if(this.parent){let a=this.parent.getBoundingClientRect();a.width&&a.height&&(n=a.width/this.parent.offsetWidth,e=a.height/this.parent.offsetHeight)}else({scaleX:n,scaleY:e}=this.view.viewState);else i=EN(this.view).left;let l=this.view.scrollDOM.getBoundingClientRect(),o=Ty(this.view);return{visible:{left:l.left+o.left,top:l.top+o.top,right:l.right-o.right,bottom:l.bottom-o.bottom},parent:this.parent?this.container.getBoundingClientRect():this.view.dom.getBoundingClientRect(),pos:this.manager.tooltips.map((a,c)=>{let f=this.manager.tooltipViews[c];return f.getCoords?f.getCoords(a.pos):this.view.coordsAtPos(a.pos)}),size:this.manager.tooltipViews.map(({dom:a})=>a.getBoundingClientRect()),space:this.view.state.facet(o0).tooltipSpace(this.view),scaleX:n,scaleY:e,makeAbsolute:t,fixedLeft:i}}writeMeasure(n){var e;if(n.makeAbsolute){this.madeAbsolute=!0,this.position="absolute";for(let c of this.manager.tooltipViews)c.dom.style.position="absolute"}let{visible:t,space:i,scaleX:l,scaleY:o}=n,a=[];for(let c=0;c=Math.min(t.bottom,i.bottom)||g.rightMath.min(t.right,i.right)+.1)){p.style.top=Sh;continue}let v=f.arrow?d.dom.querySelector(".cm-tooltip-arrow"):null,w=v?7:0,S=b.right-b.left,C=(e=LS.get(d))!==null&&e!==void 0?e:b.bottom-b.top,O=d.offset||v_,j=this.view.textDirection==At.LTR,M=b.width>i.right-i.left?j?i.left:i.right-b.width:j?Math.max(i.left,Math.min(g.left-(v?14:0)+O.x,i.right-S)):Math.min(Math.max(i.left,g.left-S+(v?14:0)-O.x),i.right-S),H=this.above[c];!f.strictSide&&(H?g.top-C-w-O.yi.bottom)&&H==i.bottom-g.bottom>g.top-i.top&&(H=this.above[c]=!H);let P=(H?g.top-i.top:i.bottom-g.bottom)-w;if(PM&&z.topA&&(A=H?z.top-C-2-w:z.bottom+w+2);if(this.position=="absolute"?(p.style.top=(A-n.parent.top)/o+"px",zS(p,(M-n.parent.left)/l)):(p.style.top=A/o+"px",zS(p,(M-n.fixedLeft)/l)),v){let z=g.left+(j?O.x:-O.x)-(M+14-7);v.style.left=z/l+"px"}d.overlap!==!0&&a.push({left:M,top:A,right:T,bottom:A+C}),p.classList.toggle("cm-tooltip-above",H),p.classList.toggle("cm-tooltip-below",!H),d.positioned&&d.positioned(n.space)}}maybeMeasure(){if(this.manager.tooltips.length&&(this.view.inView&&this.view.requestMeasure(this.measureReq),this.inView!=this.view.inView&&(this.inView=this.view.inView,!this.inView)))for(let n of this.manager.tooltipViews)n.dom.style.top=Sh}},{eventObservers:{scroll(){this.maybeMeasure()}}});function zS(n,e){let t=parseInt(n.style.left,10);(isNaN(t)||Math.abs(e-t)>1)&&(n.style.left=e+"px")}const b_=Oe.baseTheme({".cm-tooltip":{zIndex:500,boxSizing:"border-box"},"&light .cm-tooltip":{border:"1px solid #bbb",backgroundColor:"#f5f5f5"},"&light .cm-tooltip-section:not(:first-child)":{borderTop:"1px solid #bbb"},"&dark .cm-tooltip":{backgroundColor:"#333338",color:"white"},".cm-tooltip-arrow":{height:"7px",width:"14px",position:"absolute",zIndex:-1,overflow:"hidden","&:before, &:after":{content:"''",position:"absolute",width:0,height:0,borderLeft:"7px solid transparent",borderRight:"7px solid transparent"},".cm-tooltip-above &":{bottom:"-7px","&:before":{borderTop:"7px solid #bbb"},"&:after":{borderTop:"7px solid #f5f5f5",bottom:"1px"}},".cm-tooltip-below &":{top:"-7px","&:before":{borderBottom:"7px solid #bbb"},"&:after":{borderBottom:"7px solid #f5f5f5",top:"1px"}}},"&dark .cm-tooltip .cm-tooltip-arrow":{"&:before":{borderTopColor:"#333338",borderBottomColor:"#333338"},"&:after":{borderTopColor:"transparent",borderBottomColor:"transparent"}}}),v_={x:0,y:0},Ry=Ce.define({enables:[Dy,b_]}),bd=Ce.define({combine:n=>n.reduce((e,t)=>e.concat(t),[])});class Jd{static create(e){return new Jd(e)}constructor(e){this.view=e,this.mounted=!1,this.dom=document.createElement("div"),this.dom.classList.add("cm-tooltip-hover"),this.manager=new AN(e,bd,(t,i)=>this.createHostedView(t,i),t=>t.dom.remove())}createHostedView(e,t){let i=e.create(this.view);return i.dom.classList.add("cm-tooltip-section"),this.dom.insertBefore(i.dom,t?t.dom.nextSibling:this.dom.firstChild),this.mounted&&i.mount&&i.mount(this.view),i}mount(e){for(let t of this.manager.tooltipViews)t.mount&&t.mount(e);this.mounted=!0}positioned(e){for(let t of this.manager.tooltipViews)t.positioned&&t.positioned(e)}update(e){this.manager.update(e)}destroy(){var e;for(let t of this.manager.tooltipViews)(e=t.destroy)===null||e===void 0||e.call(t)}passProp(e){let t;for(let i of this.manager.tooltipViews){let l=i[e];if(l!==void 0){if(t===void 0)t=l;else if(t!==l)return}}return t}get offset(){return this.passProp("offset")}get getCoords(){return this.passProp("getCoords")}get overlap(){return this.passProp("overlap")}get resize(){return this.passProp("resize")}}const w_=Ry.compute([bd],n=>{let e=n.facet(bd);return e.length===0?null:{pos:Math.min(...e.map(t=>t.pos)),end:Math.max(...e.map(t=>{var i;return(i=t.end)!==null&&i!==void 0?i:t.pos})),create:Jd.create,above:e[0].above,arrow:e.some(t=>t.arrow)}}),MN=Ce.define();class k_{constructor(e,t,i,l,o,a){this.view=e,this.source=t,this.field=i,this.locked=l,this.setHover=o,this.hoverTime=a,this.hoverTimeout=-1,this.restartTimeout=-1,this.pending=null,this.lastMove={x:0,y:0,target:e.dom,time:0},this.checkHover=this.checkHover.bind(this),e.dom.addEventListener("mouseleave",this.mouseleave=this.mouseleave.bind(this)),e.dom.addEventListener("mousemove",this.mousemove=this.mousemove.bind(this))}update(e){this.pending&&(this.pending=null,clearTimeout(this.restartTimeout),this.restartTimeout=setTimeout(()=>this.startHover(),20))}get active(){return this.view.state.field(this.field)}checkHover(){if(this.hoverTimeout=-1,this.active.length)return;let e=Date.now()-this.lastMove.time;ea.bottom||t.xa.right+e.defaultCharacterWidth)return;let c=e.bidiSpans(e.state.doc.lineAt(l)).find(d=>d.from<=l&&d.to>=l),f=c&&c.dir==At.RTL?-1:1;o=t.x{if(c&&!(Array.isArray(c)&&!c.length)){let f=Array.isArray(c)?c:[c];l&&this.locked.set(f,l),e.dispatch({effects:this.setHover.of(f)})}};if(o&&"then"in o){let c=this.pending={pos:t};o.then(f=>{this.pending==c&&(this.pending=null,a(f))},f=>ci(e.state,f,"hover tooltip"))}else a(o)}get tooltip(){let e=this.view.plugin(Dy),t=e?e.manager.tooltips.findIndex(i=>i.create==Jd.create):-1;return t>-1?e.manager.tooltipViews[t]:null}mousemove(e){var t,i;this.lastMove={x:e.clientX,y:e.clientY,target:e.target,time:Date.now()},this.hoverTimeout<0&&(this.hoverTimeout=setTimeout(this.checkHover,this.hoverTime));let{active:l,tooltip:o}=this;if(l.length&&!this.locked.has(l)&&o&&!S_(o.dom,e)||this.pending){let{pos:a}=l[0]||this.pending,c=(i=(t=l[0])===null||t===void 0?void 0:t.end)!==null&&i!==void 0?i:a;(a==c?this.view.posAtCoords(this.lastMove)!=a:!C_(this.view,a,c,e.clientX,e.clientY))&&(this.view.dispatch({effects:this.setHover.of([])}),this.pending=null)}}mouseleave(e){clearTimeout(this.hoverTimeout),this.hoverTimeout=-1;let{active:t}=this;if(t.length&&!this.locked.has(t)){let{tooltip:i}=this;i&&i.dom.contains(e.relatedTarget)?this.watchTooltipLeave(i.dom):this.view.dispatch({effects:this.setHover.of([])})}}watchTooltipLeave(e){let t=i=>{e.removeEventListener("mouseleave",t);let{active:l}=this;l.length&&!this.locked.has(l)&&!this.view.dom.contains(i.relatedTarget)&&this.view.dispatch({effects:this.setHover.of([])})};e.addEventListener("mouseleave",t)}destroy(){clearTimeout(this.hoverTimeout),clearTimeout(this.restartTimeout),this.view.dom.removeEventListener("mouseleave",this.mouseleave),this.view.dom.removeEventListener("mousemove",this.mousemove)}}const Ch=4;function S_(n,e){let{left:t,right:i,top:l,bottom:o}=n.getBoundingClientRect(),a;if(a=n.querySelector(".cm-tooltip-arrow")){let c=a.getBoundingClientRect();l=Math.min(c.top,l),o=Math.max(c.bottom,o)}return e.clientX>=t-Ch&&e.clientX<=i+Ch&&e.clientY>=l-Ch&&e.clientY<=o+Ch}function C_(n,e,t,i,l,o){let a=n.scrollDOM.getBoundingClientRect(),c=n.documentTop+n.documentPadding.top+n.contentHeight;if(a.left>i||a.rightl||Math.min(a.bottom,c)=e&&f<=t}function O_(n,e={}){let t=Ye.define(),i=new WeakMap,l=Pn.define({create(){return[]},update(a,c){let f=i.get(a);if(a.length&&(e.hideOnChange&&(c.docChanged||c.selection)?a=[]:f&&f(c)?a=[]:e.hideOn&&(a=a.filter(d=>!e.hideOn(c,d)))),c.docChanged&&a.length){let d=[];for(let p of a){let g=c.changes.mapPos(p.pos,-1,Yn.TrackDel);if(g!=null){let b=Object.assign(Object.create(null),p);b.pos=g,b.end!=null&&(b.end=c.changes.mapPos(b.end)),d.push(b)}}a=d}for(let d of c.effects)d.is(t)&&(a=d.value,f=void 0),(d.is(T_)&&!d.value||d.value==l)&&(a=[]);return a.length&&f&&i.set(a,f),a},provide:a=>bd.from(a)});const o=en.define(a=>new k_(a,n,l,i,t,e.hoverTime||300));return{active:l,extension:[l,o,MN.of(o),w_]}}function N_(n,e,t,i={}){var l;let o=n.state.facet(MN).map(a=>n.plugin(a)).filter(a=>!!a);if(i.tooltip&&i.tooltip.active){let a=o.find(c=>c.field==i.tooltip.active);a&&(o=[a])}for(let a of o)a.activateHover(n,e,t,(l=i.until)!==null&&l!==void 0?l:(()=>!1))}function DN(n,e){let t=n.plugin(Dy);if(!t)return null;let i=t.manager.tooltips.indexOf(e);return i<0?null:t.manager.tooltipViews[i]}const T_=Ye.define(),BS=Ce.define({combine(n){let e,t;for(let i of n)e=e||i.topContainer,t=t||i.bottomContainer;return{topContainer:e,bottomContainer:t}}});function ep(n,e){let t=n.plugin(RN),i=t?t.specs.indexOf(e):-1;return i>-1?t.panels[i]:null}const RN=en.fromClass(class{constructor(n){this.input=n.state.facet(hc),this.specs=this.input.filter(t=>t),this.panels=this.specs.map(t=>t(n));let e=n.state.facet(BS);this.top=new Oh(n,!0,e.topContainer),this.bottom=new Oh(n,!1,e.bottomContainer),this.top.sync(this.panels.filter(t=>t.top)),this.bottom.sync(this.panels.filter(t=>!t.top));for(let t of this.panels)t.dom.classList.add("cm-panel"),t.mount&&t.mount()}update(n){let e=n.state.facet(BS);this.top.container!=e.topContainer&&(this.top.sync([]),this.top=new Oh(n.view,!0,e.topContainer)),this.bottom.container!=e.bottomContainer&&(this.bottom.sync([]),this.bottom=new Oh(n.view,!1,e.bottomContainer)),this.top.syncClasses(),this.bottom.syncClasses();let t=n.state.facet(hc);if(t!=this.input){let i=t.filter(f=>f),l=[],o=[],a=[],c=[];for(let f of i){let d=this.specs.indexOf(f),p;d<0?(p=f(n.view),c.push(p)):(p=this.panels[d],p.update&&p.update(n)),l.push(p),(p.top?o:a).push(p)}this.specs=i,this.panels=l,this.top.sync(o),this.bottom.sync(a);for(let f of c)f.dom.classList.add("cm-panel"),f.mount&&f.mount()}else for(let i of this.panels)i.update&&i.update(n)}destroy(){this.top.sync([]),this.bottom.sync([])}},{provide:n=>Oe.scrollMargins.of(e=>{let t=e.plugin(n);return t&&{top:t.top.scrollMargin(),bottom:t.bottom.scrollMargin()}})});class Oh{constructor(e,t,i){this.view=e,this.top=t,this.container=i,this.dom=void 0,this.classes="",this.panels=[],this.syncClasses()}sync(e){for(let t of this.panels)t.destroy&&e.indexOf(t)<0&&t.destroy();this.panels=e,this.syncDOM()}syncDOM(){if(this.panels.length==0){this.dom&&(this.dom.remove(),this.dom=void 0);return}if(!this.dom){this.dom=document.createElement("div"),this.dom.className=this.top?"cm-panels cm-panels-top":"cm-panels cm-panels-bottom";let t=this.container||this.view.dom;t.insertBefore(this.dom,this.top?t.firstChild:null)}let e=this.dom.firstChild;for(let t of this.panels)if(t.dom.parentNode==this.dom){for(;e!=t.dom;)e=PS(e);e=e.nextSibling}else this.dom.insertBefore(t.dom,e);for(;e;)e=PS(e)}scrollMargin(){return!this.dom||this.container?0:Math.max(0,this.top?this.dom.getBoundingClientRect().bottom-Math.max(0,this.view.scrollDOM.getBoundingClientRect().top):Math.min(innerHeight,this.view.scrollDOM.getBoundingClientRect().bottom)-this.dom.getBoundingClientRect().top)}syncClasses(){if(!(!this.container||this.classes==this.view.themeClasses)){for(let e of this.classes.split(" "))e&&this.container.classList.remove(e);for(let e of(this.classes=this.view.themeClasses).split(" "))e&&this.container.classList.add(e)}}}function PS(n){let e=n.nextSibling;return n.remove(),e}const hc=Ce.define({enables:RN});function A_(n,e){let t,i=new Promise(a=>t=a),l=a=>M_(a,e,t);n.state.field(td,!1)?n.dispatch({effects:jN.of(l)}):n.dispatch({effects:Ye.appendConfig.of(td.init(()=>[l]))});let o=_N.of(l);return{close:o,result:i.then(a=>((n.win.queueMicrotask||(f=>n.win.setTimeout(f,10)))(()=>{n.state.field(td).indexOf(l)>-1&&n.dispatch({effects:o})}),a))}}function E_(n,e){let t=n.state.field(td,!1)||[];for(let i of t){let l=ep(n,i);if(l&&l.dom.classList.contains(e))return l}return null}const td=Pn.define({create(){return[]},update(n,e){for(let t of e.effects)t.is(jN)?n=[t.value].concat(n):t.is(_N)&&(n=n.filter(i=>i!=t.value));return n},provide:n=>hc.computeN([n],e=>e.field(n))}),jN=Ye.define(),_N=Ye.define();function M_(n,e,t){let i=e.content?e.content(n,()=>c(null)):null;if(!i){if(i=Tt("form"),e.input){let f=Tt("input",e.input);/^(text|password|number|email|tel|url)$/.test(f.type)&&f.classList.add("cm-textfield"),f.name||(f.name="input"),i.appendChild(Tt("label",(e.label||"")+": ",f))}else i.appendChild(document.createTextNode(e.label||""));i.appendChild(document.createTextNode(" ")),i.appendChild(Tt("button",{class:"cm-button",type:"submit"},e.submitLabel||"OK"))}let l=i.nodeName=="FORM"?[i]:i.querySelectorAll("form");for(let f=0;f{p.keyCode==27?(p.preventDefault(),c(null)):p.keyCode==13&&(p.preventDefault(),c(d))}),d.addEventListener("submit",p=>{p.preventDefault(),c(d)})}let o=Tt("div",i,Tt("button",{onclick:()=>c(null),"aria-label":n.state.phrase("close"),class:"cm-dialog-close",type:"button"},["×"]));e.class&&(o.className=e.class),o.classList.add("cm-dialog");let a=typeof e.focus=="string"?i.querySelector(e.focus):e.focus?i.querySelector("input")||i.querySelector("button"):null;function c(f){o.contains(o.ownerDocument.activeElement)&&n.focus(),t(f)}return{dom:o,top:e.top,mount:()=>{a&&("select"in a?a.select():"focus"in a&&a.focus())},destroy:()=>t(null)}}class sl extends es{compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}eq(e){return!1}destroy(e){}}sl.prototype.elementClass="";sl.prototype.toDOM=void 0;sl.prototype.mapMode=Yn.TrackBefore;sl.prototype.startSide=sl.prototype.endSide=-1;sl.prototype.point=!0;const nd=Ce.define(),D_=Ce.define(),R_={class:"",renderEmptyElements:!1,elementStyle:"",markers:()=>rt.empty,lineMarker:()=>null,widgetMarker:()=>null,lineMarkerChange:null,initialSpacer:null,updateSpacer:null,domEventHandlers:{},side:"before"},ec=Ce.define();function j_(n){return[LN(),ec.of({...R_,...n})]}const HS=Ce.define({combine:n=>n.some(e=>e)});function LN(n){return[__]}const __=en.fromClass(class{constructor(n){this.view=n,this.domAfter=null,this.prevViewport=n.viewport,this.dom=document.createElement("div"),this.dom.className="cm-gutters cm-gutters-before",this.dom.setAttribute("aria-hidden","true"),this.dom.style.minHeight=this.view.contentHeight/this.view.scaleY+"px",this.gutters=n.state.facet(ec).map(e=>new US(n,e)),this.fixed=!n.state.facet(HS);for(let e of this.gutters)e.config.side=="after"?this.getDOMAfter().appendChild(e.dom):this.dom.appendChild(e.dom);this.fixed&&(this.dom.style.position="sticky"),this.syncGutters(!1),n.scrollDOM.insertBefore(this.dom,n.contentDOM)}getDOMAfter(){return this.domAfter||(this.domAfter=document.createElement("div"),this.domAfter.className="cm-gutters cm-gutters-after",this.domAfter.setAttribute("aria-hidden","true"),this.domAfter.style.minHeight=this.view.contentHeight/this.view.scaleY+"px",this.domAfter.style.position=this.fixed?"sticky":"",this.view.scrollDOM.appendChild(this.domAfter)),this.domAfter}update(n){if(this.updateGutters(n)){let e=this.prevViewport,t=n.view.viewport,i=Math.min(e.to,t.to)-Math.max(e.from,t.from);this.syncGutters(i<(t.to-t.from)*.8)}if(n.geometryChanged){let e=this.view.contentHeight/this.view.scaleY+"px";this.dom.style.minHeight=e,this.domAfter&&(this.domAfter.style.minHeight=e)}this.view.state.facet(HS)!=!this.fixed&&(this.fixed=!this.fixed,this.dom.style.position=this.fixed?"sticky":"",this.domAfter&&(this.domAfter.style.position=this.fixed?"sticky":"")),this.prevViewport=n.view.viewport}syncGutters(n){let e=this.dom.nextSibling;n&&(this.dom.remove(),this.domAfter&&this.domAfter.remove());let t=rt.iter(this.view.state.facet(nd),this.view.viewport.from),i=[],l=this.gutters.map(o=>new L_(o,this.view.viewport,-this.view.documentPadding.top));for(let o of this.view.viewportLineBlocks)if(i.length&&(i=[]),Array.isArray(o.type)){let a=!0;for(let c of o.type)if(c.type==Dn.Text&&a){jx(t,i,c.from);for(let f of l)f.line(this.view,c,i);a=!1}else if(c.widget)for(let f of l)f.widget(this.view,c)}else if(o.type==Dn.Text){jx(t,i,o.from);for(let a of l)a.line(this.view,o,i)}else if(o.widget)for(let a of l)a.widget(this.view,o);for(let o of l)o.finish();n&&(this.view.scrollDOM.insertBefore(this.dom,e),this.domAfter&&this.view.scrollDOM.appendChild(this.domAfter))}updateGutters(n){let e=n.startState.facet(ec),t=n.state.facet(ec),i=n.docChanged||n.heightChanged||n.viewportChanged||!rt.eq(n.startState.facet(nd),n.state.facet(nd),n.view.viewport.from,n.view.viewport.to);if(e==t)for(let l of this.gutters)l.update(n)&&(i=!0);else{i=!0;let l=[];for(let o of t){let a=e.indexOf(o);a<0?l.push(new US(this.view,o)):(this.gutters[a].update(n),l.push(this.gutters[a]))}for(let o of this.gutters)o.dom.remove(),l.indexOf(o)<0&&o.destroy();for(let o of l)o.config.side=="after"?this.getDOMAfter().appendChild(o.dom):this.dom.appendChild(o.dom);this.gutters=l}return i}destroy(){for(let n of this.gutters)n.destroy();this.dom.remove(),this.domAfter&&this.domAfter.remove()}},{provide:n=>Oe.scrollMargins.of(e=>{let t=e.plugin(n);if(!t||t.gutters.length==0||!t.fixed)return null;let i=t.dom.offsetWidth*e.scaleX,l=t.domAfter?t.domAfter.offsetWidth*e.scaleX:0;return e.textDirection==At.LTR?{left:i,right:l}:{right:i,left:l}})});function IS(n){return Array.isArray(n)?n:[n]}function jx(n,e,t){for(;n.value&&n.from<=t;)n.from==t&&e.push(n.value),n.next()}class L_{constructor(e,t,i){this.gutter=e,this.height=i,this.i=0,this.cursor=rt.iter(e.markers,t.from)}addElement(e,t,i){let{gutter:l}=this,o=(t.top-this.height)/e.scaleY,a=t.height/e.scaleY;if(this.i==l.elements.length){let c=new zN(e,a,o,i);l.elements.push(c),l.dom.appendChild(c.dom)}else l.elements[this.i].update(e,a,o,i);this.height=t.bottom,this.i++}line(e,t,i){let l=[];jx(this.cursor,l,t.from),i.length&&(l=l.concat(i));let o=this.gutter.config.lineMarker(e,t,l);o&&l.unshift(o);let a=this.gutter;l.length==0&&!a.config.renderEmptyElements||this.addElement(e,t,l)}widget(e,t){let i=this.gutter.config.widgetMarker(e,t.widget,t),l=i?[i]:null;for(let o of e.state.facet(D_)){let a=o(e,t.widget,t);a&&(l||(l=[])).push(a)}l&&this.addElement(e,t,l)}finish(){let e=this.gutter;for(;e.elements.length>this.i;){let t=e.elements.pop();e.dom.removeChild(t.dom),t.destroy()}}}class US{constructor(e,t){this.view=e,this.config=t,this.elements=[],this.spacer=null,this.dom=document.createElement("div"),this.dom.className="cm-gutter"+(this.config.class?" "+this.config.class:"");for(let i in t.domEventHandlers)this.dom.addEventListener(i,l=>{let o=l.target,a;if(o!=this.dom&&this.dom.contains(o)){for(;o.parentNode!=this.dom;)o=o.parentNode;let f=o.getBoundingClientRect();a=(f.top+f.bottom)/2}else a=l.clientY;let c=e.lineBlockAtHeight(a-e.documentTop);t.domEventHandlers[i](e,c,l)&&l.preventDefault()});this.markers=IS(t.markers(e)),t.initialSpacer&&(this.spacer=new zN(e,0,0,[t.initialSpacer(e)]),this.dom.appendChild(this.spacer.dom),this.spacer.dom.style.cssText+="visibility: hidden; pointer-events: none")}update(e){let t=this.markers;if(this.markers=IS(this.config.markers(e.view)),this.spacer&&this.config.updateSpacer){let l=this.config.updateSpacer(this.spacer.markers[0],e);l!=this.spacer.markers[0]&&this.spacer.update(e.view,0,0,[l])}let i=e.view.viewport;return!rt.eq(this.markers,t,i.from,i.to)||(this.config.lineMarkerChange?this.config.lineMarkerChange(e):!1)}destroy(){for(let e of this.elements)e.destroy()}}class zN{constructor(e,t,i,l){this.height=-1,this.above=0,this.markers=[],this.dom=document.createElement("div"),this.dom.className="cm-gutterElement",this.update(e,t,i,l)}update(e,t,i,l){this.height!=t&&(this.height=t,this.dom.style.height=t+"px"),this.above!=i&&(this.dom.style.marginTop=(this.above=i)?i+"px":""),z_(this.markers,l)||this.setMarkers(e,l)}setMarkers(e,t){let i="cm-gutterElement",l=this.dom.firstChild;for(let o=0,a=0;;){let c=a,f=oo(c,f,d)||a(c,f,d):a}return i}})}});class a0 extends sl{constructor(e){super(),this.number=e}eq(e){return this.number==e.number}toDOM(){return document.createTextNode(this.number)}}function u0(n,e){return n.state.facet(fa).formatNumber(e,n.state)}const H_=ec.compute([fa],n=>({class:"cm-lineNumbers",renderEmptyElements:!1,markers(e){return e.state.facet(B_)},lineMarker(e,t,i){return i.some(l=>l.toDOM)?null:new a0(u0(e,e.state.doc.lineAt(t.from).number))},widgetMarker:(e,t,i)=>{for(let l of e.state.facet(P_)){let o=l(e,t,i);if(o)return o}return null},lineMarkerChange:e=>e.startState.facet(fa)!=e.state.facet(fa),initialSpacer(e){return new a0(u0(e,FS(e.state.doc.lines)))},updateSpacer(e,t){let i=u0(t.view,FS(t.view.state.doc.lines));return i==e.number?e:new a0(i)},domEventHandlers:n.facet(fa).domEventHandlers,side:"before"}));function I_(n={}){return[fa.of(n),LN(),H_]}function FS(n){let e=9;for(;e{let e=[],t=-1;for(let i of n.selection.ranges){let l=n.doc.lineAt(i.head).from;l>t&&(t=l,e.push(U_.range(l)))}return rt.of(e)});function q_(){return F_}const BN=1024;let V_=0;class c0{constructor(e,t){this.from=e,this.to=t}}class tt{constructor(e={}){this.id=V_++,this.perNode=!!e.perNode,this.deserialize=e.deserialize||(()=>{throw new Error("This node type doesn't define a deserialize function")}),this.combine=e.combine||null}add(e){if(this.perNode)throw new RangeError("Can't add per-node props to node types");return typeof e!="function"&&(e=hi.match(e)),t=>{let i=e(t);return i===void 0?null:[this,i]}}}tt.closedBy=new tt({deserialize:n=>n.split(" ")});tt.openedBy=new tt({deserialize:n=>n.split(" ")});tt.group=new tt({deserialize:n=>n.split(" ")});tt.isolate=new tt({deserialize:n=>{if(n&&n!="rtl"&&n!="ltr"&&n!="auto")throw new RangeError("Invalid value for isolate: "+n);return n||"auto"}});tt.contextHash=new tt({perNode:!0});tt.lookAhead=new tt({perNode:!0});tt.mounted=new tt({perNode:!0});class tc{constructor(e,t,i,l=!1){this.tree=e,this.overlay=t,this.parser=i,this.bracketed=l}static get(e){return e&&e.props&&e.props[tt.mounted.id]}}const Q_=Object.create(null);class hi{constructor(e,t,i,l=0){this.name=e,this.props=t,this.id=i,this.flags=l}static define(e){let t=e.props&&e.props.length?Object.create(null):Q_,i=(e.top?1:0)|(e.skipped?2:0)|(e.error?4:0)|(e.name==null?8:0),l=new hi(e.name||"",t,e.id,i);if(e.props){for(let o of e.props)if(Array.isArray(o)||(o=o(l)),o){if(o[0].perNode)throw new RangeError("Can't store a per-node prop on a node type");t[o[0].id]=o[1]}}return l}prop(e){return this.props[e.id]}get isTop(){return(this.flags&1)>0}get isSkipped(){return(this.flags&2)>0}get isError(){return(this.flags&4)>0}get isAnonymous(){return(this.flags&8)>0}is(e){if(typeof e=="string"){if(this.name==e)return!0;let t=this.prop(tt.group);return t?t.indexOf(e)>-1:!1}return this.id==e}static match(e){let t=Object.create(null);for(let i in e)for(let l of i.split(" "))t[l]=e[i];return i=>{for(let l=i.prop(tt.group),o=-1;o<(l?l.length:0);o++){let a=t[o<0?i.name:l[o]];if(a)return a}}}}hi.none=new hi("",Object.create(null),0,8);class jy{constructor(e){this.types=e;for(let t=0;t0;for(let f=this.cursor(a|Yt.IncludeAnonymous);;){let d=!1;if(f.from<=o&&f.to>=l&&(!c&&f.type.isAnonymous||t(f)!==!1)){if(f.firstChild())continue;d=!0}for(;d&&i&&(c||!f.type.isAnonymous)&&i(f),!f.nextSibling();){if(!f.parent())return;d=!0}}}prop(e){return e.perNode?this.props?this.props[e.id]:void 0:this.type.prop(e)}get propValues(){let e=[];if(this.props)for(let t in this.props)e.push([+t,this.props[t]]);return e}balance(e={}){return this.children.length<=8?this:zy(hi.none,this.children,this.positions,0,this.children.length,0,this.length,(t,i,l)=>new an(this.type,t,i,l,this.propValues),e.makeTree||((t,i,l)=>new an(hi.none,t,i,l)))}static build(e){return Y_(e)}}an.empty=new an(hi.none,[],[],0);class _y{constructor(e,t){this.buffer=e,this.index=t}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}get pos(){return this.index}next(){this.index-=4}fork(){return new _y(this.buffer,this.index)}}class rs{constructor(e,t,i){this.buffer=e,this.length=t,this.set=i}get type(){return hi.none}toString(){let e=[];for(let t=0;t0));f=a[f+3]);return c}slice(e,t,i){let l=this.buffer,o=new Uint16Array(t-e),a=0;for(let c=e,f=0;c=e&&te;case 1:return t<=e&&i>e;case 2:return i>e;case 4:return!0}}function dc(n,e,t,i){for(var l;n.from==n.to||(t<1?n.from>=e:n.from>e)||(t>-1?n.to<=e:n.to0?c.length:-1;e!=d;e+=t){let p=c[e],g=f[e]+a.from,b;if(!(!(o&Yt.EnterBracketed&&p instanceof an&&(b=tc.get(p))&&!b.overlay&&b.bracketed&&i>=g&&i<=g+p.length)&&!PN(l,i,g,g+p.length))){if(p instanceof rs){if(o&Yt.ExcludeBuffers)continue;let v=p.findChild(0,p.buffer.length,t,i-g,l);if(v>-1)return new Gl(new X_(a,p,e,g),null,v)}else if(o&Yt.IncludeAnonymous||!p.type.isAnonymous||Ly(p)){let v;if(!(o&Yt.IgnoreMounts)&&(v=tc.get(p))&&!v.overlay)return new Ii(v.tree,g,e,a);let w=new Ii(p,g,e,a);return o&Yt.IncludeAnonymous||!w.type.isAnonymous?w:w.nextChild(t<0?p.children.length-1:0,t,i,l,o)}}}if(o&Yt.IncludeAnonymous||!a.type.isAnonymous||(a.index>=0?e=a.index+t:e=t<0?-1:a._parent._tree.children.length,a=a._parent,!a))return null}}get firstChild(){return this.nextChild(0,1,0,4)}get lastChild(){return this.nextChild(this._tree.children.length-1,-1,0,4)}childAfter(e){return this.nextChild(0,1,e,2)}childBefore(e){return this.nextChild(this._tree.children.length-1,-1,e,-2)}prop(e){return this._tree.prop(e)}enter(e,t,i=0){let l;if(!(i&Yt.IgnoreOverlays)&&(l=tc.get(this._tree))&&l.overlay){let o=e-this.from,a=i&Yt.EnterBracketed&&l.bracketed;for(let{from:c,to:f}of l.overlay)if((t>0||a?c<=o:c=o:f>o))return new Ii(l.tree,l.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,e,t,i)}nextSignificantParent(){let e=this;for(;e.type.isAnonymous&&e._parent;)e=e._parent;return e}get parent(){return this._parent?this._parent.nextSignificantParent():null}get nextSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index+1,1,0,4):null}get prevSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index-1,-1,0,4):null}get tree(){return this._tree}toTree(){return this._tree}toString(){return this._tree.toString()}}function VS(n,e,t,i){let l=n.cursor(),o=[];if(!l.firstChild())return o;if(t!=null){for(let a=!1;!a;)if(a=l.type.is(t),!l.nextSibling())return o}for(;;){if(i!=null&&l.type.is(i))return o;if(l.type.is(e)&&o.push(l.node),!l.nextSibling())return i==null?o:[]}}function _x(n,e,t=e.length-1){for(let i=n;t>=0;i=i.parent){if(!i)return!1;if(!i.type.isAnonymous){if(e[t]&&e[t]!=i.name)return!1;t--}}return!0}class X_{constructor(e,t,i,l){this.parent=e,this.buffer=t,this.index=i,this.start=l}}class Gl extends HN{get name(){return this.type.name}get from(){return this.context.start+this.context.buffer.buffer[this.index+1]}get to(){return this.context.start+this.context.buffer.buffer[this.index+2]}constructor(e,t,i){super(),this.context=e,this._parent=t,this.index=i,this.type=e.buffer.set.types[e.buffer.buffer[i]]}child(e,t,i){let{buffer:l}=this.context,o=l.findChild(this.index+4,l.buffer[this.index+3],e,t-this.context.start,i);return o<0?null:new Gl(this.context,this,o)}get firstChild(){return this.child(1,0,4)}get lastChild(){return this.child(-1,0,4)}childAfter(e){return this.child(1,e,2)}childBefore(e){return this.child(-1,e,-2)}prop(e){return this.type.prop(e)}enter(e,t,i=0){if(i&Yt.ExcludeBuffers)return null;let{buffer:l}=this.context,o=l.findChild(this.index+4,l.buffer[this.index+3],t>0?1:-1,e-this.context.start,t);return o<0?null:new Gl(this.context,this,o)}get parent(){return this._parent||this.context.parent.nextSignificantParent()}externalSibling(e){return this._parent?null:this.context.parent.nextChild(this.context.index+e,e,0,4)}get nextSibling(){let{buffer:e}=this.context,t=e.buffer[this.index+3];return t<(this._parent?e.buffer[this._parent.index+3]:e.buffer.length)?new Gl(this.context,this._parent,t):this.externalSibling(1)}get prevSibling(){let{buffer:e}=this.context,t=this._parent?this._parent.index+4:0;return this.index==t?this.externalSibling(-1):new Gl(this.context,this._parent,e.findChild(t,this.index,-1,0,4))}get tree(){return null}toTree(){let e=[],t=[],{buffer:i}=this.context,l=this.index+4,o=i.buffer[this.index+3];if(o>l){let a=i.buffer[this.index+1];e.push(i.slice(l,o,a)),t.push(0)}return new an(this.type,e,t,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function IN(n){if(!n.length)return null;let e=0,t=n[0];for(let o=1;ot.from||a.to=e){let c=new Ii(a.tree,a.overlay[0].from+o.from,-1,o);(l||(l=[i])).push(dc(c,e,t,!1))}}return l?IN(l):i}class Lx{get name(){return this.type.name}constructor(e,t=0){if(this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,this.mode=t&~Yt.EnterBracketed,e instanceof Ii)this.yieldNode(e);else{this._tree=e.context.parent,this.buffer=e.context;for(let i=e._parent;i;i=i._parent)this.stack.unshift(i.index);this.bufferNode=e,this.yieldBuf(e.index)}}yieldNode(e){return e?(this._tree=e,this.type=e.type,this.from=e.from,this.to=e.to,!0):!1}yieldBuf(e,t){this.index=e;let{start:i,buffer:l}=this.buffer;return this.type=t||l.set.types[l.buffer[e]],this.from=i+l.buffer[e+1],this.to=i+l.buffer[e+2],!0}yield(e){return e?e instanceof Ii?(this.buffer=null,this.yieldNode(e)):(this.buffer=e.context,this.yieldBuf(e.index,e.type)):!1}toString(){return this.buffer?this.buffer.buffer.childString(this.index):this._tree.toString()}enterChild(e,t,i){if(!this.buffer)return this.yield(this._tree.nextChild(e<0?this._tree._tree.children.length-1:0,e,t,i,this.mode));let{buffer:l}=this.buffer,o=l.findChild(this.index+4,l.buffer[this.index+3],e,t-this.buffer.start,i);return o<0?!1:(this.stack.push(this.index),this.yieldBuf(o))}firstChild(){return this.enterChild(1,0,4)}lastChild(){return this.enterChild(-1,0,4)}childAfter(e){return this.enterChild(1,e,2)}childBefore(e){return this.enterChild(-1,e,-2)}enter(e,t,i=this.mode){return this.buffer?i&Yt.ExcludeBuffers?!1:this.enterChild(1,e,t):this.yield(this._tree.enter(e,t,i))}parent(){if(!this.buffer)return this.yieldNode(this.mode&Yt.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let e=this.mode&Yt.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent();return this.buffer=null,this.yieldNode(e)}sibling(e){if(!this.buffer)return this._tree._parent?this.yield(this._tree.index<0?null:this._tree._parent.nextChild(this._tree.index+e,e,0,4,this.mode)):!1;let{buffer:t}=this.buffer,i=this.stack.length-1;if(e<0){let l=i<0?0:this.stack[i]+4;if(this.index!=l)return this.yieldBuf(t.findChild(l,this.index,-1,0,4))}else{let l=t.buffer[this.index+3];if(l<(i<0?t.buffer.length:t.buffer[this.stack[i]+3]))return this.yieldBuf(l)}return i<0?this.yield(this.buffer.parent.nextChild(this.buffer.index+e,e,0,4,this.mode)):!1}nextSibling(){return this.sibling(1)}prevSibling(){return this.sibling(-1)}atLastNode(e){let t,i,{buffer:l}=this;if(l){if(e>0){if(this.index-1)for(let o=t+e,a=e<0?-1:i._tree.children.length;o!=a;o+=e){let c=i._tree.children[o];if(this.mode&Yt.IncludeAnonymous||c instanceof rs||!c.type.isAnonymous||Ly(c))return!1}return!0}move(e,t){if(t&&this.enterChild(e,0,4))return!0;for(;;){if(this.sibling(e))return!0;if(this.atLastNode(e)||!this.parent())return!1}}next(e=!0){return this.move(1,e)}prev(e=!0){return this.move(-1,e)}moveTo(e,t=0){for(;(this.from==this.to||(t<1?this.from>=e:this.from>e)||(t>-1?this.to<=e:this.to=0;){for(let a=e;a;a=a._parent)if(a.index==l){if(l==this.index)return a;t=a,i=o+1;break e}l=this.stack[--o]}for(let l=i;l=0;o--){if(o<0)return _x(this._tree,e,l);let a=i[t.buffer[this.stack[o]]];if(!a.isAnonymous){if(e[l]&&e[l]!=a.name)return!1;l--}}return!0}}function Ly(n){return n.children.some(e=>e instanceof rs||!e.type.isAnonymous||Ly(e))}function Y_(n){var e;let{buffer:t,nodeSet:i,maxBufferLength:l=BN,reused:o=[],minRepeatType:a=i.types.length}=n,c=Array.isArray(t)?new _y(t,t.length):t,f=i.types,d=0,p=0;function g(P,A,T,z,ne,F){let{id:W,start:U,end:re,size:de}=c,ie=p,L=d;if(de<0)if(c.next(),de==-1){let ze=o[W];T.push(ze),z.push(U-P);return}else if(de==-3){d=W;return}else if(de==-4){p=W;return}else throw new RangeError(`Unrecognized record size: ${de}`);let ee=f[W],se,le,E=U-P;if(re-U<=l&&(le=C(c.pos-A,ne))){let ze=new Uint16Array(le.size-le.skip),je=c.pos-le.size,B=ze.length;for(;c.pos>je;)B=O(le.start,ze,B);se=new rs(ze,re-le.start,i),E=le.start-P}else{let ze=c.pos-de;c.next();let je=[],B=[],D=W>=a?W:-1,X=0,fe=re,pe=ie;for(;c.pos>ze;)D>=0&&c.id==D&&c.size>=0?(c.end<=fe-l&&(w(je,B,U,X,c.end,fe,D,pe,L),X=je.length,fe=c.end,pe=p),c.next()):F>2500?b(U,ze,je,B):(D>=0&&c.size==-1&&o[c.id].type==i.types[D]&&(X=0&&X>0&&X-1&&X>0){let Re=v(ee,L);se=zy(ee,je,B,0,je.length,0,re-U,Re,Re)}else se=S(ee,je,B,re-U,ie-re,L)}T.push(se),z.push(E)}function b(P,A,T,z){let ne=[],F=0,W=-1;for(;c.pos>A;){let{id:U,start:re,end:de,size:ie}=c;if(ie>4)c.next();else{if(W>-1&&re=0;de-=3)U[ie++]=ne[de],U[ie++]=ne[de+1]-re,U[ie++]=ne[de+2]-re,U[ie++]=ie;T.push(new rs(U,ne[2]-re,i)),z.push(re-P)}}function v(P,A){return(T,z,ne)=>{let F=0,W=T.length-1,U,re;if(W>=0&&(U=T[W])instanceof an){if(!W&&U.type==P&&U.length==ne)return U;(re=U.prop(tt.lookAhead))&&(F=z[W]+U.length+re-ne)}return S(P,T,z,ne,F,A)}}function w(P,A,T,z,ne,F,W,U,re){let de=[],ie=[];for(;P.length>z;)de.push(P.pop()),ie.push(A.pop()+T-ne);P.push(S(i.types[W],de,ie,F-ne,U-F,re)),A.push(ne-T)}function S(P,A,T,z,ne,F,W){if(F){let U=[tt.contextHash,F];W=W?[U].concat(W):[U]}if(ne>25){let U=[tt.lookAhead,ne];W=W?[U].concat(W):[U]}return new an(P,A,T,z,W)}function C(P,A){let T=c.fork(),z=0,ne=0,F=0,W=T.end-l,U={size:0,start:0,skip:0};e:for(let re=T.pos-P;T.pos>re;){let de=T.size;if(T.id==A&&de>=0){U.size=z,U.start=ne,U.skip=F,F+=4,z+=4,T.next();continue}let ie=T.pos-de;if(de<0||ie=a?4:0,ee=T.start;for(T.next();T.pos>ie;){if(T.size<0)if(T.size==-3||T.size==-4)L+=4;else break e;else T.id>=a&&(L+=4);T.next()}ne=ee,z+=de,F+=L}return(A<0||z==P)&&(U.size=z,U.start=ne,U.skip=F),U.size>4?U:void 0}function O(P,A,T){let{id:z,start:ne,end:F,size:W}=c;if(c.next(),W>=0&&z4){let re=c.pos-(W-4);for(;c.pos>re;)T=O(P,A,T)}A[--T]=U,A[--T]=F-P,A[--T]=ne-P,A[--T]=z}else W==-3?d=z:W==-4&&(p=z);return T}let j=[],M=[];for(;c.pos>0;)g(n.start||0,n.bufferStart||0,j,M,-1,0);let H=(e=n.length)!==null&&e!==void 0?e:j.length?M[0]+j[0].length:0;return new an(f[n.topID],j.reverse(),M.reverse(),H)}const QS=new WeakMap;function id(n,e){if(!n.isAnonymous||e instanceof rs||e.type!=n)return 1;let t=QS.get(e);if(t==null){t=1;for(let i of e.children){if(i.type!=n||!(i instanceof an)){t=1;break}t+=id(n,i)}QS.set(e,t)}return t}function zy(n,e,t,i,l,o,a,c,f){let d=0;for(let w=i;w=p)break;A+=T}if(M==H+1){if(A>p){let T=w[H];v(T.children,T.positions,0,T.children.length,S[H]+j);continue}g.push(w[H])}else{let T=S[M-1]+w[M-1].length-P;g.push(zy(n,w,S,H,M,P,T,null,f))}b.push(P+j-o)}}return v(e,t,i,l,0),(c||f)(g,b,a)}class eo{constructor(e,t,i,l,o=!1,a=!1){this.from=e,this.to=t,this.tree=i,this.offset=l,this.open=(o?1:0)|(a?2:0)}get openStart(){return(this.open&1)>0}get openEnd(){return(this.open&2)>0}static addTree(e,t=[],i=!1){let l=[new eo(0,e.length,e,0,!1,i)];for(let o of t)o.to>e.length&&l.push(o);return l}static applyChanges(e,t,i=128){if(!t.length)return e;let l=[],o=1,a=e.length?e[0]:null;for(let c=0,f=0,d=0;;c++){let p=c=i)for(;a&&a.from=b.from||g<=b.to||d){let v=Math.max(b.from,f)-d,w=Math.min(b.to,g)-d;b=v>=w?null:new eo(v,w,b.tree,b.offset+d,c>0,!!p)}if(b&&l.push(b),a.to>g)break;a=onew c0(l.from,l.to)):[new c0(0,0)]:[new c0(0,e.length)],this.createParse(e,t||[],i)}parse(e,t,i){let l=this.startParse(e,t,i);for(;;){let o=l.advance();if(o)return o}}}class K_{constructor(e){this.string=e}get length(){return this.string.length}chunk(e){return this.string.slice(e)}get lineChunks(){return!1}read(e,t){return this.string.slice(e,t)}}new tt({perNode:!0});let W_=0,el=class zx{constructor(e,t,i,l){this.name=e,this.set=t,this.base=i,this.modified=l,this.id=W_++}toString(){let{name:e}=this;for(let t of this.modified)t.name&&(e=`${t.name}(${e})`);return e}static define(e,t){let i=typeof e=="string"?e:"?";if(e instanceof zx&&(t=e),t!=null&&t.base)throw new Error("Can not derive from a modified tag");let l=new zx(i,[],null,[]);if(l.set.push(l),t)for(let o of t.set)l.set.push(o);return l}static defineModifier(e){let t=new vd(e);return i=>i.modified.indexOf(t)>-1?i:vd.get(i.base||i,i.modified.concat(t).sort((l,o)=>l.id-o.id))}},Z_=0;class vd{constructor(e){this.name=e,this.instances=[],this.id=Z_++}static get(e,t){if(!t.length)return e;let i=t[0].instances.find(c=>c.base==e&&J_(t,c.modified));if(i)return i;let l=[],o=new el(e.name,l,e,t);for(let c of t)c.instances.push(o);let a=eL(t);for(let c of e.set)if(!c.modified.length)for(let f of a)l.push(vd.get(c,f));return o}}function J_(n,e){return n.length==e.length&&n.every((t,i)=>t==e[i])}function eL(n){let e=[[]];for(let t=0;ti.length-t.length)}function FN(n){let e=Object.create(null);for(let t in n){let i=n[t];Array.isArray(i)||(i=[i]);for(let l of t.split(" "))if(l){let o=[],a=2,c=l;for(let g=0;;){if(c=="..."&&g>0&&g+3==l.length){a=1;break}let b=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(c);if(!b)throw new RangeError("Invalid path: "+l);if(o.push(b[0]=="*"?"":b[0][0]=='"'?JSON.parse(b[0]):b[0]),g+=b[0].length,g==l.length)break;let v=l[g++];if(g==l.length&&v=="!"){a=0;break}if(v!="/")throw new RangeError("Invalid path: "+l);c=l.slice(g)}let f=o.length-1,d=o[f];if(!d)throw new RangeError("Invalid path: "+l);let p=new pc(i,a,f>0?o.slice(0,f):null);e[d]=p.sort(e[d])}}return qN.add(e)}const qN=new tt({combine(n,e){let t,i,l;for(;n||e;){if(!n||e&&n.depth<=e.depth?(l=e,e=e.next):(l=n,n=n.next),t&&t.mode==l.mode&&!l.context&&!t.context)continue;let o=new pc(l.tags,l.mode,l.context);t?t.next=o:i=o,t=o}return i}});class pc{constructor(e,t,i,l){this.tags=e,this.mode=t,this.context=i,this.next=l}get opaque(){return this.mode==0}get inherit(){return this.mode==1}sort(e){return!e||e.depth{let a=l;for(let c of o)for(let f of c.set){let d=t[f.id];if(d){a=a?a+" "+d:d;break}}return a},scope:i}}function tL(n,e){let t=null;for(let i of n){let l=i.style(e);l&&(t=t?t+" "+l:l)}return t}function nL(n,e,t,i=0,l=n.length){let o=new iL(i,Array.isArray(e)?e:[e],t);o.highlightRange(n.cursor(),i,l,"",o.highlighters),o.flush(l)}class iL{constructor(e,t,i){this.at=e,this.highlighters=t,this.span=i,this.class=""}startSpan(e,t){t!=this.class&&(this.flush(e),e>this.at&&(this.at=e),this.class=t)}flush(e){e>this.at&&this.class&&this.span(this.at,e,this.class)}highlightRange(e,t,i,l,o){let{type:a,from:c,to:f}=e;if(c>=i||f<=t)return;a.isTop&&(o=this.highlighters.filter(v=>!v.scope||v.scope(a)));let d=l,p=rL(e)||pc.empty,g=tL(o,p.tags);if(g&&(d&&(d+=" "),d+=g,p.mode==1&&(l+=(l?" ":"")+g)),this.startSpan(Math.max(t,c),d),p.opaque)return;let b=e.tree&&e.tree.prop(tt.mounted);if(b&&b.overlay){let v=e.node.enter(b.overlay[0].from+c,1),w=this.highlighters.filter(C=>!C.scope||C.scope(b.tree.type)),S=e.firstChild();for(let C=0,O=c;;C++){let j=C=M||!e.nextSibling())););if(!j||M>i)break;O=j.to+c,O>t&&(this.highlightRange(v.cursor(),Math.max(t,j.from+c),Math.min(i,O),"",w),this.startSpan(Math.min(i,O),d))}S&&e.parent()}else if(e.firstChild()){b&&(l="");do if(!(e.to<=t)){if(e.from>=i)break;this.highlightRange(e,t,i,l,o),this.startSpan(Math.min(i,e.to),d)}while(e.nextSibling());e.parent()}}}function rL(n){let e=n.type.prop(qN);for(;e&&e.context&&!n.matchContext(e.context);)e=e.next;return e||null}const we=el.define,Th=we(),ql=we(),XS=we(ql),$S=we(ql),Vl=we(),Ah=we(Vl),f0=we(Vl),kr=we(),Fs=we(kr),vr=we(),wr=we(),Bx=we(),Bu=we(Bx),Eh=we(),ge={comment:Th,lineComment:we(Th),blockComment:we(Th),docComment:we(Th),name:ql,variableName:we(ql),typeName:XS,tagName:we(XS),propertyName:$S,attributeName:we($S),className:we(ql),labelName:we(ql),namespace:we(ql),macroName:we(ql),literal:Vl,string:Ah,docString:we(Ah),character:we(Ah),attributeValue:we(Ah),number:f0,integer:we(f0),float:we(f0),bool:we(Vl),regexp:we(Vl),escape:we(Vl),color:we(Vl),url:we(Vl),keyword:vr,self:we(vr),null:we(vr),atom:we(vr),unit:we(vr),modifier:we(vr),operatorKeyword:we(vr),controlKeyword:we(vr),definitionKeyword:we(vr),moduleKeyword:we(vr),operator:wr,derefOperator:we(wr),arithmeticOperator:we(wr),logicOperator:we(wr),bitwiseOperator:we(wr),compareOperator:we(wr),updateOperator:we(wr),definitionOperator:we(wr),typeOperator:we(wr),controlOperator:we(wr),punctuation:Bx,separator:we(Bx),bracket:Bu,angleBracket:we(Bu),squareBracket:we(Bu),paren:we(Bu),brace:we(Bu),content:kr,heading:Fs,heading1:we(Fs),heading2:we(Fs),heading3:we(Fs),heading4:we(Fs),heading5:we(Fs),heading6:we(Fs),contentSeparator:we(kr),list:we(kr),quote:we(kr),emphasis:we(kr),strong:we(kr),link:we(kr),monospace:we(kr),strikethrough:we(kr),inserted:we(),deleted:we(),changed:we(),invalid:we(),meta:Eh,documentMeta:we(Eh),annotation:we(Eh),processingInstruction:we(Eh),definition:el.defineModifier("definition"),constant:el.defineModifier("constant"),function:el.defineModifier("function"),standard:el.defineModifier("standard"),local:el.defineModifier("local"),special:el.defineModifier("special")};for(let n in ge){let e=ge[n];e instanceof el&&(e.name=n)}VN([{tag:ge.link,class:"tok-link"},{tag:ge.heading,class:"tok-heading"},{tag:ge.emphasis,class:"tok-emphasis"},{tag:ge.strong,class:"tok-strong"},{tag:ge.keyword,class:"tok-keyword"},{tag:ge.atom,class:"tok-atom"},{tag:ge.bool,class:"tok-bool"},{tag:ge.url,class:"tok-url"},{tag:ge.labelName,class:"tok-labelName"},{tag:ge.inserted,class:"tok-inserted"},{tag:ge.deleted,class:"tok-deleted"},{tag:ge.literal,class:"tok-literal"},{tag:ge.string,class:"tok-string"},{tag:ge.number,class:"tok-number"},{tag:[ge.regexp,ge.escape,ge.special(ge.string)],class:"tok-string2"},{tag:ge.variableName,class:"tok-variableName"},{tag:ge.local(ge.variableName),class:"tok-variableName tok-local"},{tag:ge.definition(ge.variableName),class:"tok-variableName tok-definition"},{tag:ge.special(ge.variableName),class:"tok-variableName2"},{tag:ge.definition(ge.propertyName),class:"tok-propertyName tok-definition"},{tag:ge.typeName,class:"tok-typeName"},{tag:ge.namespace,class:"tok-namespace"},{tag:ge.className,class:"tok-className"},{tag:ge.macroName,class:"tok-macroName"},{tag:ge.propertyName,class:"tok-propertyName"},{tag:ge.operator,class:"tok-operator"},{tag:ge.comment,class:"tok-comment"},{tag:ge.meta,class:"tok-meta"},{tag:ge.invalid,class:"tok-invalid"},{tag:ge.punctuation,class:"tok-punctuation"}]);var h0;const ha=new tt;function lL(n){return Ce.define({combine:n?e=>e.concat(n):void 0})}const sL=new tt;class er{constructor(e,t,i=[],l=""){this.data=e,this.name=l,mt.prototype.hasOwnProperty("tree")||Object.defineProperty(mt.prototype,"tree",{get(){return Bn(this)}}),this.parser=t,this.extension=[ls.of(this),mt.languageData.of((o,a,c)=>{let f=GS(o,a,c),d=f.type.prop(ha);if(!d)return[];let p=o.facet(d),g=f.type.prop(sL);if(g){let b=f.resolve(a-f.from,c);for(let v of g)if(v.test(b,o)){let w=o.facet(v.facet);return v.type=="replace"?w:w.concat(p)}}return p})].concat(i)}isActiveAt(e,t,i=-1){return GS(e,t,i).type.prop(ha)==this.data}findRegions(e){let t=e.facet(ls);if((t==null?void 0:t.data)==this.data)return[{from:0,to:e.doc.length}];if(!t||!t.allowsNesting)return[];let i=[],l=(o,a)=>{if(o.prop(ha)==this.data){i.push({from:a,to:a+o.length});return}let c=o.prop(tt.mounted);if(c){if(c.tree.prop(ha)==this.data){if(c.overlay)for(let f of c.overlay)i.push({from:f.from+a,to:f.to+a});else i.push({from:a,to:a+o.length});return}else if(c.overlay){let f=i.length;if(l(c.tree,c.overlay[0].from+a),i.length>f)return}}for(let f=0;fi.isTop?t:void 0)]}),e.name)}configure(e,t){return new wd(this.data,this.parser.configure(e),t||this.name)}get allowsNesting(){return this.parser.hasWrappers()}}function Bn(n){let e=n.field(er.state,!1);return e?e.tree:an.empty}class oL{constructor(e){this.doc=e,this.cursorPos=0,this.string="",this.cursor=e.iter()}get length(){return this.doc.length}syncTo(e){return this.string=this.cursor.next(e-this.cursorPos).value,this.cursorPos=e+this.string.length,this.cursorPos-this.string.length}chunk(e){return this.syncTo(e),this.string}get lineChunks(){return!0}read(e,t){let i=this.cursorPos-this.string.length;return e=this.cursorPos?this.doc.sliceString(e,t):this.string.slice(e-i,t-i)}}let Pu=null;class kd{constructor(e,t,i=[],l,o,a,c,f){this.parser=e,this.state=t,this.fragments=i,this.tree=l,this.treeLen=o,this.viewport=a,this.skipped=c,this.scheduleOn=f,this.parse=null,this.tempSkipped=[]}static create(e,t,i){return new kd(e,t,[],an.empty,0,i,[],null)}startParse(){return this.parser.startParse(new oL(this.state.doc),this.fragments)}work(e,t){return t!=null&&t>=this.state.doc.length&&(t=void 0),this.tree!=an.empty&&this.isDone(t??this.state.doc.length)?(this.takeTree(),!0):this.withContext(()=>{var i;if(typeof e=="number"){let l=Date.now()+e;e=()=>Date.now()>l}for(this.parse||(this.parse=this.startParse()),t!=null&&(this.parse.stoppedAt==null||this.parse.stoppedAt>t)&&t=this.treeLen&&((this.parse.stoppedAt==null||this.parse.stoppedAt>e)&&this.parse.stopAt(e),this.withContext(()=>{for(;!(t=this.parse.advance()););}),this.treeLen=e,this.tree=t,this.fragments=this.withoutTempSkipped(eo.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(e){let t=Pu;Pu=this;try{return e()}finally{Pu=t}}withoutTempSkipped(e){for(let t;t=this.tempSkipped.pop();)e=YS(e,t.from,t.to);return e}changes(e,t){let{fragments:i,tree:l,treeLen:o,viewport:a,skipped:c}=this;if(this.takeTree(),!e.empty){let f=[];if(e.iterChangedRanges((d,p,g,b)=>f.push({fromA:d,toA:p,fromB:g,toB:b})),i=eo.applyChanges(i,f),l=an.empty,o=0,a={from:e.mapPos(a.from,-1),to:e.mapPos(a.to,1)},this.skipped.length){c=[];for(let d of this.skipped){let p=e.mapPos(d.from,1),g=e.mapPos(d.to,-1);pe.from&&(this.fragments=YS(this.fragments,l,o),this.skipped.splice(i--,1))}return this.skipped.length>=t?!1:(this.reset(),!0)}reset(){this.parse&&(this.takeTree(),this.parse=null)}skipUntilInView(e,t){this.skipped.push({from:e,to:t})}static getSkippingParser(e){return new class extends UN{createParse(t,i,l){let o=l[0].from,a=l[l.length-1].to;return{parsedPos:o,advance(){let f=Pu;if(f){for(let d of l)f.tempSkipped.push(d);e&&(f.scheduleOn=f.scheduleOn?Promise.all([f.scheduleOn,e]):e)}return this.parsedPos=a,new an(hi.none,[],[],a-o)},stoppedAt:null,stopAt(){}}}}}isDone(e){e=Math.min(e,this.state.doc.length);let t=this.fragments;return this.treeLen>=e&&t.length&&t[0].from==0&&t[0].to>=e}static get(){return Pu}}function YS(n,e,t){return eo.applyChanges(n,[{fromA:e,toA:t,fromB:e,toB:t}])}class Ra{constructor(e){this.context=e,this.tree=e.tree}apply(e){if(!e.docChanged&&this.tree==this.context.tree)return this;let t=this.context.changes(e.changes,e.state),i=this.context.treeLen==e.startState.doc.length?void 0:Math.max(e.changes.mapPos(this.context.treeLen),t.viewport.to);return t.work(20,i)||t.takeTree(),new Ra(t)}static init(e){let t=Math.min(3e3,e.doc.length),i=kd.create(e.facet(ls).parser,e,{from:0,to:t});return i.work(20,t)||i.takeTree(),new Ra(i)}}er.state=Pn.define({create:Ra.init,update(n,e){for(let t of e.effects)if(t.is(er.setState))return t.value;return e.startState.facet(ls)!=e.state.facet(ls)?Ra.init(e.state):n.apply(e)}});let QN=n=>{let e=setTimeout(()=>n(),500);return()=>clearTimeout(e)};typeof requestIdleCallback<"u"&&(QN=n=>{let e=-1,t=setTimeout(()=>{e=requestIdleCallback(n,{timeout:400})},100);return()=>e<0?clearTimeout(t):cancelIdleCallback(e)});const d0=typeof navigator<"u"&&(!((h0=navigator.scheduling)===null||h0===void 0)&&h0.isInputPending)?()=>navigator.scheduling.isInputPending():null,aL=en.fromClass(class{constructor(e){this.view=e,this.working=null,this.workScheduled=0,this.chunkEnd=-1,this.chunkBudget=-1,this.work=this.work.bind(this),this.scheduleWork()}update(e){let t=this.view.state.field(er.state).context;(t.updateViewport(e.view.viewport)||this.view.viewport.to>t.treeLen)&&this.scheduleWork(),(e.docChanged||e.selectionSet)&&(this.view.hasFocus&&(this.chunkBudget+=50),this.scheduleWork()),this.checkAsyncSchedule(t)}scheduleWork(){if(this.working)return;let{state:e}=this.view,t=e.field(er.state);(t.tree!=t.context.tree||!t.context.isDone(e.doc.length))&&(this.working=QN(this.work))}work(e){this.working=null;let t=Date.now();if(this.chunkEndl+1e3,f=o.context.work(()=>d0&&d0()||Date.now()>a,l+(c?0:1e5));this.chunkBudget-=Date.now()-t,(f||this.chunkBudget<=0)&&(o.context.takeTree(),this.view.dispatch({effects:er.setState.of(new Ra(o.context))})),this.chunkBudget>0&&!(f&&!c)&&this.scheduleWork(),this.checkAsyncSchedule(o.context)}checkAsyncSchedule(e){e.scheduleOn&&(this.workScheduled++,e.scheduleOn.then(()=>this.scheduleWork()).catch(t=>ci(this.view.state,t)).then(()=>this.workScheduled--),e.scheduleOn=null)}destroy(){this.working&&this.working()}isWorking(){return!!(this.working||this.workScheduled>0)}},{eventHandlers:{focus(){this.scheduleWork()}}}),ls=Ce.define({combine(n){return n.length?n[0]:null},enables:n=>[er.state,aL,Oe.contentAttributes.compute([n],e=>{let t=e.facet(n);return t&&t.name?{"data-language":t.name}:{}})]});class uL{constructor(e,t=[]){this.language=e,this.support=t,this.extension=[e,t]}}const cL=Ce.define(),By=Ce.define({combine:n=>{if(!n.length)return" ";let e=n[0];if(!e||/\S/.test(e)||Array.from(e).some(t=>t!=e[0]))throw new Error("Invalid indent unit: "+JSON.stringify(n[0]));return e}});function Sd(n){let e=n.facet(By);return e.charCodeAt(0)==9?n.tabSize*e.length:e.length}function mc(n,e){let t="",i=n.tabSize,l=n.facet(By)[0];if(l==" "){for(;e>=i;)t+=" ",e-=i;l=" "}for(let o=0;o=e?fL(n,t,e):null}class tp{constructor(e,t={}){this.state=e,this.options=t,this.unit=Sd(e)}lineAt(e,t=1){let i=this.state.doc.lineAt(e),{simulateBreak:l,simulateDoubleBreak:o}=this.options;return l!=null&&l>=i.from&&l<=i.to?o&&l==e?{text:"",from:e}:(t<0?l-1&&(o+=a-this.countColumn(i,i.search(/\S|$/))),o}countColumn(e,t=e.length){return La(e,this.state.tabSize,t)}lineIndent(e,t=1){let{text:i,from:l}=this.lineAt(e,t),o=this.options.overrideIndentation;if(o){let a=o(l);if(a>-1)return a}return this.countColumn(i,i.search(/\S|$/))}get simulatedBreak(){return this.options.simulateBreak||null}}const XN=new tt;function fL(n,e,t){let i=e.resolveStack(t),l=e.resolveInner(t,-1).resolve(t,0).enterUnfinishedNodesBefore(t);if(l!=i.node){let o=[];for(let a=l;a&&!(a.fromi.node.to||a.from==i.node.from&&a.type==i.node.type);a=a.parent)o.push(a);for(let a=o.length-1;a>=0;a--)i={node:o[a],next:i}}return $N(i,n,t)}function $N(n,e,t){for(let i=n;i;i=i.next){let l=dL(i.node);if(l)return l(Hy.create(e,t,i))}return 0}function hL(n){return n.pos==n.options.simulateBreak&&n.options.simulateDoubleBreak}function dL(n){let e=n.type.prop(XN);if(e)return e;let t=n.firstChild,i;if(t&&(i=t.type.prop(tt.closedBy))){let l=n.lastChild,o=l&&i.indexOf(l.name)>-1;return a=>GN(a,!0,1,void 0,o&&!hL(a)?l.from:void 0)}return n.parent==null?pL:null}function pL(){return 0}class Hy extends tp{constructor(e,t,i){super(e.state,e.options),this.base=e,this.pos=t,this.context=i}get node(){return this.context.node}static create(e,t,i){return new Hy(e,t,i)}get textAfter(){return this.textAfterPos(this.pos)}get baseIndent(){return this.baseIndentFor(this.node)}baseIndentFor(e){let t=this.state.doc.lineAt(e.from);for(;;){let i=e.resolve(t.from);for(;i.parent&&i.parent.from==i.from;)i=i.parent;if(mL(i,e))break;t=this.state.doc.lineAt(i.from)}return this.lineIndent(t.from)}continue(){return $N(this.context.next,this.base,this.pos)}}function mL(n,e){for(let t=e;t;t=t.parent)if(n==t)return!0;return!1}function gL(n){let e=n.node,t=e.childAfter(e.from),i=e.lastChild;if(!t)return null;let l=n.options.simulateBreak,o=n.state.doc.lineAt(t.from),a=l==null||l<=o.from?o.to:Math.min(o.to,l);for(let c=t.to;;){let f=e.childAfter(c);if(!f||f==i)return null;if(!f.type.isSkipped){if(f.from>=a)return null;let d=/^ */.exec(o.text.slice(t.to-o.from))[0].length;return{from:t.from,to:t.to+d}}c=f.to}}function KS({closing:n,align:e=!0,units:t=1}){return i=>GN(i,e,t,n)}function GN(n,e,t,i,l){let o=n.textAfter,a=o.match(/^\s*/)[0].length,c=i&&o.slice(a,a+i.length)==i||l==n.pos+a,f=e?gL(n):null;return f?c?n.column(f.from):n.column(f.to):n.baseIndent+(c?0:n.unit*t)}const xL=200;function yL(){return mt.transactionFilter.of(n=>{if(!n.docChanged||!n.isUserEvent("input.type")&&!n.isUserEvent("input.complete"))return n;let e=n.startState.languageDataAt("indentOnInput",n.startState.selection.main.head);if(!e.length)return n;let t=n.newDoc,{head:i}=n.newSelection.main,l=t.lineAt(i);if(i>l.from+xL)return n;let o=t.sliceString(l.from,i);if(!e.some(d=>d.test(o)))return n;let{state:a}=n,c=-1,f=[];for(let{head:d}of a.selection.ranges){let p=a.doc.lineAt(d);if(p.from==c)continue;c=p.from;let g=Py(a,p.from);if(g==null)continue;let b=/^\s*/.exec(p.text)[0],v=mc(a,g);b!=v&&f.push({from:p.from,to:p.from+b.length,insert:v})}return f.length?[n,{changes:f,sequential:!0}]:n})}const bL=Ce.define(),YN=new tt;function vL(n){let e=n.firstChild,t=n.lastChild;return e&&e.tot)continue;if(o&&c.from=e&&d.to>t&&(o=d)}}return o}function kL(n){let e=n.lastChild;return e&&e.to==n.to&&e.type.isError}function Cd(n,e,t){for(let i of n.facet(bL)){let l=i(n,e,t);if(l)return l}return wL(n,e,t)}function KN(n,e){let t=e.mapPos(n.from,1),i=e.mapPos(n.to,-1);return t>=i?void 0:{from:t,to:i}}const np=Ye.define({map:KN}),Tc=Ye.define({map:KN});function WN(n){let e=[];for(let{head:t}of n.state.selection.ranges)e.some(i=>i.from<=t&&i.to>=t)||e.push(n.lineBlockAt(t));return e}const lo=Pn.define({create(){return Ie.none},update(n,e){e.isUserEvent("delete")&&e.changes.iterChangedRanges((i,l)=>n=WS(n,i,l)),n=n.map(e.changes);let t=[];for(let i of e.effects)i.is(np)&&!SL(n,i.value.from,i.value.to)?t.push(i.value):i.is(Tc)&&(n=n.update({filter:(l,o)=>i.value.from!=l||i.value.to!=o,filterFrom:i.value.from,filterTo:i.value.to}));if(t.length){let{preparePlaceholder:i}=e.state.facet(eT),l=t.map(o=>(i?Ie.replace({widget:new ML(i(e.state,o))}):ZS).range(o.from,o.to));n=n.update({add:l})}return e.selection&&(n=WS(n,e.selection.main.head)),n},provide:n=>Oe.decorations.from(n),toJSON(n,e){let t=[];return n.between(0,e.doc.length,(i,l)=>{t.push(i,l)}),t},fromJSON(n){if(!Array.isArray(n)||n.length%2)throw new RangeError("Invalid JSON for fold state");let e=[];for(let t=0;t{le&&(i=!0)}),i?n.update({filterFrom:e,filterTo:t,filter:(l,o)=>l>=t||o<=e}):n}function Od(n,e,t){var i;let l=null;return(i=n.field(lo,!1))===null||i===void 0||i.between(e,t,(o,a)=>{(!l||l.from>o)&&(l={from:o,to:a})}),l}function SL(n,e,t){let i=!1;return n.between(e,e,(l,o)=>{l==e&&o==t&&(i=!0)}),i}function ZN(n,e){return n.field(lo,!1)?e:e.concat(Ye.appendConfig.of(tT()))}const CL=n=>{for(let e of WN(n)){let t=Cd(n.state,e.from,e.to);if(t)return n.dispatch({effects:ZN(n.state,[np.of(t),JN(n,t)])}),!0}return!1},OL=n=>{if(!n.state.field(lo,!1))return!1;let e=[];for(let t of WN(n)){let i=Od(n.state,t.from,t.to);i&&e.push(Tc.of(i),JN(n,i,!1))}return e.length&&n.dispatch({effects:e}),e.length>0};function JN(n,e,t=!0){let i=n.state.doc.lineAt(e.from).number,l=n.state.doc.lineAt(e.to).number;return Oe.announce.of(`${n.state.phrase(t?"Folded lines":"Unfolded lines")} ${i} ${n.state.phrase("to")} ${l}.`)}const NL=n=>{let{state:e}=n,t=[];for(let i=0;i{let e=n.state.field(lo,!1);if(!e||!e.size)return!1;let t=[];return e.between(0,n.state.doc.length,(i,l)=>{t.push(Tc.of({from:i,to:l}))}),n.dispatch({effects:t}),!0},AL=[{key:"Ctrl-Shift-[",mac:"Cmd-Alt-[",run:CL},{key:"Ctrl-Shift-]",mac:"Cmd-Alt-]",run:OL},{key:"Ctrl-Alt-[",run:NL},{key:"Ctrl-Alt-]",run:TL}],EL={placeholderDOM:null,preparePlaceholder:null,placeholderText:"…"},eT=Ce.define({combine(n){return jr(n,EL)}});function tT(n){return[lo,jL]}function nT(n,e){let{state:t}=n,i=t.facet(eT),l=a=>{let c=n.lineBlockAt(n.posAtDOM(a.target)),f=Od(n.state,c.from,c.to);f&&n.dispatch({effects:Tc.of(f)}),a.preventDefault()};if(i.placeholderDOM)return i.placeholderDOM(n,l,e);let o=document.createElement("span");return o.textContent=i.placeholderText,o.setAttribute("aria-label",t.phrase("folded code")),o.title=t.phrase("unfold"),o.className="cm-foldPlaceholder",o.onclick=l,o}const ZS=Ie.replace({widget:new class extends ul{toDOM(n){return nT(n,null)}}});class ML extends ul{constructor(e){super(),this.value=e}eq(e){return this.value==e.value}toDOM(e){return nT(e,this.value)}}const DL={openText:"⌄",closedText:"›",markerDOM:null,domEventHandlers:{},foldingChanged:()=>!1};class p0 extends sl{constructor(e,t){super(),this.config=e,this.open=t}eq(e){return this.config==e.config&&this.open==e.open}toDOM(e){if(this.config.markerDOM)return this.config.markerDOM(this.open);let t=document.createElement("span");return t.textContent=this.open?this.config.openText:this.config.closedText,t.title=e.state.phrase(this.open?"Fold line":"Unfold line"),t}}function RL(n={}){let e={...DL,...n},t=new p0(e,!0),i=new p0(e,!1),l=en.fromClass(class{constructor(a){this.from=a.viewport.from,this.markers=this.buildMarkers(a)}update(a){(a.docChanged||a.viewportChanged||a.startState.facet(ls)!=a.state.facet(ls)||a.startState.field(lo,!1)!=a.state.field(lo,!1)||Bn(a.startState)!=Bn(a.state)||e.foldingChanged(a))&&(this.markers=this.buildMarkers(a.view))}buildMarkers(a){let c=new Rr;for(let f of a.viewportLineBlocks){let d=Od(a.state,f.from,f.to)?i:Cd(a.state,f.from,f.to)?t:null;d&&c.add(f.from,f.from,d)}return c.finish()}}),{domEventHandlers:o}=e;return[l,j_({class:"cm-foldGutter",markers(a){var c;return((c=a.plugin(l))===null||c===void 0?void 0:c.markers)||rt.empty},initialSpacer(){return new p0(e,!1)},domEventHandlers:{...o,click:(a,c,f)=>{if(o.click&&o.click(a,c,f))return!0;let d=Od(a.state,c.from,c.to);if(d)return a.dispatch({effects:Tc.of(d)}),!0;let p=Cd(a.state,c.from,c.to);return p?(a.dispatch({effects:np.of(p)}),!0):!1}}}),tT()]}const jL=Oe.baseTheme({".cm-foldPlaceholder":{backgroundColor:"#eee",border:"1px solid #ddd",color:"#888",borderRadius:".2em",margin:"0 1px",padding:"0 1px",cursor:"pointer"},".cm-foldGutter span":{padding:"0 1px",cursor:"pointer"}});class ip{constructor(e,t){this.specs=e;let i;function l(c){let f=ts.newName();return(i||(i=Object.create(null)))["."+f]=c,f}const o=typeof t.all=="string"?t.all:t.all?l(t.all):void 0,a=t.scope;this.scope=a instanceof er?c=>c.prop(ha)==a.data:a?c=>c==a:void 0,this.style=VN(e.map(c=>({tag:c.tag,class:c.class||l(Object.assign({},c,{tag:null}))})),{all:o}).style,this.module=i?new ts(i):null,this.themeType=t.themeType}static define(e,t){return new ip(e,t||{})}}const Px=Ce.define(),iT=Ce.define({combine(n){return n.length?[n[0]]:null}});function m0(n){let e=n.facet(Px);return e.length?e:n.facet(iT)}function _L(n,e){let t=[zL],i;return n instanceof ip&&(n.module&&t.push(Oe.styleModule.of(n.module)),i=n.themeType),e!=null&&e.fallback?t.push(iT.of(n)):i?t.push(Px.computeN([Oe.darkTheme],l=>l.facet(Oe.darkTheme)==(i=="dark")?[n]:[])):t.push(Px.of(n)),t}class LL{constructor(e){this.markCache=Object.create(null),this.tree=Bn(e.state),this.decorations=this.buildDeco(e,m0(e.state)),this.decoratedTo=e.viewport.to}update(e){let t=Bn(e.state),i=m0(e.state),l=i!=m0(e.startState),{viewport:o}=e.view,a=e.changes.mapPos(this.decoratedTo,1);t.length=o.to?(this.decorations=this.decorations.map(e.changes),this.decoratedTo=a):(t!=this.tree||e.viewportChanged||l)&&(this.tree=t,this.decorations=this.buildDeco(e.view,i),this.decoratedTo=o.to)}buildDeco(e,t){if(!t||!this.tree.length)return Ie.none;let i=new Rr;for(let{from:l,to:o}of e.visibleRanges)nL(this.tree,t,(a,c,f)=>{i.add(a,c,this.markCache[f]||(this.markCache[f]=Ie.mark({class:f})))},l,o);return i.finish()}}const zL=oo.high(en.fromClass(LL,{decorations:n=>n.decorations})),BL=ip.define([{tag:ge.meta,color:"#404740"},{tag:ge.link,textDecoration:"underline"},{tag:ge.heading,textDecoration:"underline",fontWeight:"bold"},{tag:ge.emphasis,fontStyle:"italic"},{tag:ge.strong,fontWeight:"bold"},{tag:ge.strikethrough,textDecoration:"line-through"},{tag:ge.keyword,color:"#708"},{tag:[ge.atom,ge.bool,ge.url,ge.contentSeparator,ge.labelName],color:"#219"},{tag:[ge.literal,ge.inserted],color:"#164"},{tag:[ge.string,ge.deleted],color:"#a11"},{tag:[ge.regexp,ge.escape,ge.special(ge.string)],color:"#e40"},{tag:ge.definition(ge.variableName),color:"#00f"},{tag:ge.local(ge.variableName),color:"#30a"},{tag:[ge.typeName,ge.namespace],color:"#085"},{tag:ge.className,color:"#167"},{tag:[ge.special(ge.variableName),ge.macroName],color:"#256"},{tag:ge.definition(ge.propertyName),color:"#00c"},{tag:ge.comment,color:"#940"},{tag:ge.invalid,color:"#f00"}]),PL=Oe.baseTheme({"&.cm-focused .cm-matchingBracket":{backgroundColor:"#328c8252"},"&.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bb555544"}}),rT=1e4,lT="()[]{}",sT=Ce.define({combine(n){return jr(n,{afterCursor:!0,brackets:lT,maxScanDistance:rT,renderMatch:UL})}}),HL=Ie.mark({class:"cm-matchingBracket"}),IL=Ie.mark({class:"cm-nonmatchingBracket"});function UL(n){let e=[],t=n.matched?HL:IL;return e.push(t.range(n.start.from,n.start.to)),n.end&&e.push(t.range(n.end.from,n.end.to)),e}function JS(n){let e=[],t=n.facet(sT);for(let i of n.selection.ranges){if(!i.empty)continue;let l=Er(n,i.head,-1,t)||i.head>0&&Er(n,i.head-1,1,t)||t.afterCursor&&(Er(n,i.head,1,t)||i.headn.decorations}),qL=[FL,PL];function VL(n={}){return[sT.of(n),qL]}const QL=new tt;function Hx(n,e,t){let i=n.prop(e<0?tt.openedBy:tt.closedBy);if(i)return i;if(n.name.length==1){let l=t.indexOf(n.name);if(l>-1&&l%2==(e<0?1:0))return[t[l+e]]}return null}function Ix(n){let e=n.type.prop(QL);return e?e(n.node):n}function Er(n,e,t,i={}){let l=i.maxScanDistance||rT,o=i.brackets||lT,a=Bn(n),c=a.resolveInner(e,t);for(let f=c;f;f=f.parent){let d=Hx(f.type,t,o);if(d&&f.from0?e>=p.from&&ep.from&&e<=p.to))return XL(n,e,t,f,p,d,o)}}return $L(n,e,t,a,c.type,l,o)}function XL(n,e,t,i,l,o,a){let c=i.parent,f={from:l.from,to:l.to},d=0,p=c==null?void 0:c.cursor();if(p&&(t<0?p.childBefore(i.from):p.childAfter(i.to)))do if(t<0?p.to<=i.from:p.from>=i.to){if(d==0&&o.indexOf(p.type.name)>-1&&p.from0)return null;let d={from:t<0?e-1:e,to:t>0?e+1:e},p=n.doc.iterRange(e,t>0?n.doc.length:0),g=0;for(let b=0;!p.next().done&&b<=o;){let v=p.value;t<0&&(b+=v.length);let w=e+b*t;for(let S=t>0?0:v.length-1,C=t>0?v.length:-1;S!=C;S+=t){let O=a.indexOf(v[S]);if(!(O<0||i.resolveInner(w+S,1).type!=l))if(O%2==0==t>0)g++;else{if(g==1)return{start:d,end:{from:w+S,to:w+S+1},matched:O>>1==f>>1};g--}}t>0&&(b+=v.length)}return p.done?{start:d,matched:!1}:null}const GL=Object.create(null),e2=[hi.none],t2=[],n2=Object.create(null),YL=Object.create(null);for(let[n,e]of[["variable","variableName"],["variable-2","variableName.special"],["string-2","string.special"],["def","variableName.definition"],["tag","tagName"],["attribute","attributeName"],["type","typeName"],["builtin","variableName.standard"],["qualifier","modifier"],["error","invalid"],["header","heading"],["property","propertyName"]])YL[n]=KL(GL,e);function g0(n,e){t2.indexOf(n)>-1||(t2.push(n),console.warn(e))}function KL(n,e){let t=[];for(let c of e.split(" ")){let f=[];for(let d of c.split(".")){let p=n[d]||ge[d];p?typeof p=="function"?f.length?f=f.map(p):g0(d,`Modifier ${d} used at start of tag`):f.length?g0(d,`Tag ${d} used as modifier`):f=Array.isArray(p)?p:[p]:g0(d,`Unknown highlighting tag ${d}`)}for(let d of f)t.push(d)}if(!t.length)return 0;let i=e.replace(/ /g,"_"),l=i+" "+t.map(c=>c.id),o=n2[l];if(o)return o.id;let a=n2[l]=hi.define({id:e2.length,name:i,props:[FN({[i]:t})]});return e2.push(a),a.id}At.RTL,At.LTR;const WL=n=>{let{state:e}=n,t=e.doc.lineAt(e.selection.main.from),i=Uy(n.state,t.from);return i.line?ZL(n):i.block?ez(n):!1};function Iy(n,e){return({state:t,dispatch:i})=>{if(t.readOnly)return!1;let l=n(e,t);return l?(i(t.update(l)),!0):!1}}const ZL=Iy(iz,0),JL=Iy(oT,0),ez=Iy((n,e)=>oT(n,e,nz(e)),0);function Uy(n,e){let t=n.languageDataAt("commentTokens",e,1);return t.length?t[0]:{}}const Hu=50;function tz(n,{open:e,close:t},i,l){let o=n.sliceDoc(i-Hu,i),a=n.sliceDoc(l,l+Hu),c=/\s*$/.exec(o)[0].length,f=/^\s*/.exec(a)[0].length,d=o.length-c;if(o.slice(d-e.length,d)==e&&a.slice(f,f+t.length)==t)return{open:{pos:i-c,margin:c&&1},close:{pos:l+f,margin:f&&1}};let p,g;l-i<=2*Hu?p=g=n.sliceDoc(i,l):(p=n.sliceDoc(i,i+Hu),g=n.sliceDoc(l-Hu,l));let b=/^\s*/.exec(p)[0].length,v=/\s*$/.exec(g)[0].length,w=g.length-v-t.length;return p.slice(b,b+e.length)==e&&g.slice(w,w+t.length)==t?{open:{pos:i+b+e.length,margin:/\s/.test(p.charAt(b+e.length))?1:0},close:{pos:l-v-t.length,margin:/\s/.test(g.charAt(w-1))?1:0}}:null}function nz(n){let e=[];for(let t of n.selection.ranges){let i=n.doc.lineAt(t.from),l=t.to<=i.to?i:n.doc.lineAt(t.to);l.from>i.from&&l.from==t.to&&(l=t.to==i.to+1?i:n.doc.lineAt(t.to-1));let o=e.length-1;o>=0&&e[o].to>i.from?e[o].to=l.to:e.push({from:i.from+/^\s*/.exec(i.text)[0].length,to:l.to})}return e}function oT(n,e,t=e.selection.ranges){let i=t.map(o=>Uy(e,o.from).block);if(!i.every(o=>o))return null;let l=t.map((o,a)=>tz(e,i[a],o.from,o.to));if(n!=2&&!l.every(o=>o))return{changes:e.changes(t.map((o,a)=>l[a]?[]:[{from:o.from,insert:i[a].open+" "},{from:o.to,insert:" "+i[a].close}]))};if(n!=1&&l.some(o=>o)){let o=[];for(let a=0,c;al&&(o==a||a>g.from)){l=g.from;let b=/^\s*/.exec(g.text)[0].length,v=b==g.length,w=g.text.slice(b,b+d.length)==d?b:-1;bo.comment<0&&(!o.empty||o.single))){let o=[];for(let{line:c,token:f,indent:d,empty:p,single:g}of i)(g||!p)&&o.push({from:c.from+d,insert:f+" "});let a=e.changes(o);return{changes:a,selection:e.selection.map(a,1)}}else if(n!=1&&i.some(o=>o.comment>=0)){let o=[];for(let{line:a,comment:c,token:f}of i)if(c>=0){let d=a.from+c,p=d+f.length;a.text[p-a.from]==" "&&p++,o.push({from:d,to:p})}return{changes:o}}return null}const Ux=al.define(),rz=al.define(),lz=Ce.define(),aT=Ce.define({combine(n){return jr(n,{minDepth:100,newGroupDelay:500,joinToEvent:(e,t)=>t},{minDepth:Math.max,newGroupDelay:Math.min,joinToEvent:(e,t)=>(i,l)=>e(i,l)||t(i,l)})}}),uT=Pn.define({create(){return Mr.empty},update(n,e){let t=e.state.facet(aT),i=e.annotation(Ux);if(i){let f=fi.fromTransaction(e,i.selection),d=i.side,p=d==0?n.undone:n.done;return f?p=Nd(p,p.length,t.minDepth,f):p=hT(p,e.startState.selection),new Mr(d==0?i.rest:p,d==0?p:i.rest)}let l=e.annotation(rz);if((l=="full"||l=="before")&&(n=n.isolate()),e.annotation(hn.addToHistory)===!1)return e.changes.empty?n:n.addMapping(e.changes.desc);let o=fi.fromTransaction(e),a=e.annotation(hn.time),c=e.annotation(hn.userEvent);return o?n=n.addChanges(o,a,c,t,e):e.selection&&(n=n.addSelection(e.startState.selection,a,c,t.newGroupDelay)),(l=="full"||l=="after")&&(n=n.isolate()),n},toJSON(n){return{done:n.done.map(e=>e.toJSON()),undone:n.undone.map(e=>e.toJSON())}},fromJSON(n){return new Mr(n.done.map(fi.fromJSON),n.undone.map(fi.fromJSON))}});function sz(n={}){return[uT,aT.of(n),Oe.domEventHandlers({beforeinput(e,t){let i=e.inputType=="historyUndo"?cT:e.inputType=="historyRedo"?Fx:null;return i?(e.preventDefault(),i(t)):!1}})]}function rp(n,e){return function({state:t,dispatch:i}){if(!e&&t.readOnly)return!1;let l=t.field(uT,!1);if(!l)return!1;let o=l.pop(n,t,e);return o?(i(o),!0):!1}}const cT=rp(0,!1),Fx=rp(1,!1),oz=rp(0,!0),az=rp(1,!0);class fi{constructor(e,t,i,l,o){this.changes=e,this.effects=t,this.mapped=i,this.startSelection=l,this.selectionsAfter=o}setSelAfter(e){return new fi(this.changes,this.effects,this.mapped,this.startSelection,e)}toJSON(){var e,t,i;return{changes:(e=this.changes)===null||e===void 0?void 0:e.toJSON(),mapped:(t=this.mapped)===null||t===void 0?void 0:t.toJSON(),startSelection:(i=this.startSelection)===null||i===void 0?void 0:i.toJSON(),selectionsAfter:this.selectionsAfter.map(l=>l.toJSON())}}static fromJSON(e){return new fi(e.changes&&fn.fromJSON(e.changes),[],e.mapped&&Dr.fromJSON(e.mapped),e.startSelection&&oe.fromJSON(e.startSelection),e.selectionsAfter.map(oe.fromJSON))}static fromTransaction(e,t){let i=Pi;for(let l of e.startState.facet(lz)){let o=l(e);o.length&&(i=i.concat(o))}return!i.length&&e.changes.empty?null:new fi(e.changes.invert(e.startState.doc),i,void 0,t||e.startState.selection,Pi)}static selection(e){return new fi(void 0,Pi,void 0,void 0,e)}}function Nd(n,e,t,i){let l=e+1>t+20?e-t-1:0,o=n.slice(l,e);return o.push(i),o}function uz(n,e){let t=[],i=!1;return n.iterChangedRanges((l,o)=>t.push(l,o)),e.iterChangedRanges((l,o,a,c)=>{for(let f=0;f=d&&a<=p&&(i=!0)}}),i}function cz(n,e){return n.ranges.length==e.ranges.length&&n.ranges.filter((t,i)=>t.empty!=e.ranges[i].empty).length===0}function fT(n,e){return n.length?e.length?n.concat(e):n:e}const Pi=[],fz=200;function hT(n,e){if(n.length){let t=n[n.length-1],i=t.selectionsAfter.slice(Math.max(0,t.selectionsAfter.length-fz));return i.length&&i[i.length-1].eq(e)?n:(i.push(e),Nd(n,n.length-1,1e9,t.setSelAfter(i)))}else return[fi.selection([e])]}function hz(n){let e=n[n.length-1],t=n.slice();return t[n.length-1]=e.setSelAfter(e.selectionsAfter.slice(0,e.selectionsAfter.length-1)),t}function x0(n,e){if(!n.length)return n;let t=n.length,i=Pi;for(;t;){let l=dz(n[t-1],e,i);if(l.changes&&!l.changes.empty||l.effects.length){let o=n.slice(0,t);return o[t-1]=l,o}else e=l.mapped,t--,i=l.selectionsAfter}return i.length?[fi.selection(i)]:Pi}function dz(n,e,t){let i=fT(n.selectionsAfter.length?n.selectionsAfter.map(c=>c.map(e)):Pi,t);if(!n.changes)return fi.selection(i);let l=n.changes.map(e),o=e.mapDesc(n.changes,!0),a=n.mapped?n.mapped.composeDesc(o):o;return new fi(l,Ye.mapEffects(n.effects,e),a,n.startSelection.map(o),i)}const pz=/^(input\.type|delete)($|\.)/;class Mr{constructor(e,t,i=0,l=void 0){this.done=e,this.undone=t,this.prevTime=i,this.prevUserEvent=l}isolate(){return this.prevTime?new Mr(this.done,this.undone):this}addChanges(e,t,i,l,o){let a=this.done,c=a[a.length-1];return c&&c.changes&&!c.changes.empty&&e.changes&&(!i||pz.test(i))&&(!c.selectionsAfter.length&&t-this.prevTime0&&t-this.prevTimet.empty?n.moveByChar(t,e):lp(t,e))}function Hn(n){return n.textDirectionAt(n.state.selection.main.head)==At.LTR}const pT=n=>dT(n,!Hn(n)),mT=n=>dT(n,Hn(n));function gT(n,e){return lr(n,t=>t.empty?n.moveByGroup(t,e):lp(t,e))}const gz=n=>gT(n,!Hn(n)),xz=n=>gT(n,Hn(n));function yz(n,e,t){if(e.type.prop(t))return!0;let i=e.to-e.from;return i&&(i>2||/[^\s,.;:]/.test(n.sliceDoc(e.from,e.to)))||e.firstChild}function sp(n,e,t){let i=Bn(n).resolveInner(e.head),l=t?tt.closedBy:tt.openedBy;for(let f=e.head;;){let d=t?i.childAfter(f):i.childBefore(f);if(!d)break;yz(n,d,l)?i=d:f=t?d.to:d.from}let o=i.type.prop(l),a,c;return o&&(a=t?Er(n,i.from,1):Er(n,i.to,-1))&&a.matched?c=t?a.end.to:a.end.from:c=t?i.to:i.from,oe.cursor(c,t?-1:1)}const bz=n=>lr(n,e=>sp(n.state,e,!Hn(n))),vz=n=>lr(n,e=>sp(n.state,e,Hn(n)));function xT(n,e){return lr(n,t=>{if(!t.empty)return lp(t,e);let i=n.moveVertically(t,e);return i.head!=t.head?i:n.moveToLineBoundary(t,e)})}const yT=n=>xT(n,!1),bT=n=>xT(n,!0);function vT(n){let e=n.scrollDOM.clientHeighta.empty?n.moveVertically(a,e,t.height):lp(a,e));if(l.eq(i.selection))return!1;let o;if(t.selfScroll){let a=n.coordsAtPos(i.selection.main.head),c=n.scrollDOM.getBoundingClientRect(),f=c.top+t.marginTop,d=c.bottom-t.marginBottom;a&&a.top>f&&a.bottomwT(n,!1),qx=n=>wT(n,!0);function us(n,e,t){let i=n.lineBlockAt(e.head),l=n.moveToLineBoundary(e,t);if(l.head==e.head&&l.head!=(t?i.to:i.from)&&(l=n.moveToLineBoundary(e,t,!1)),!t&&l.head==i.from&&i.length){let o=/^\s*/.exec(n.state.sliceDoc(i.from,Math.min(i.from+100,i.to)))[0].length;o&&e.head!=i.from+o&&(l=oe.cursor(i.from+o))}return l}const wz=n=>lr(n,e=>us(n,e,!0)),kz=n=>lr(n,e=>us(n,e,!1)),Sz=n=>lr(n,e=>us(n,e,!Hn(n))),Cz=n=>lr(n,e=>us(n,e,Hn(n))),Oz=n=>lr(n,e=>n.moveToLineBoundary(e,!1,!1)),Nz=n=>lr(n,e=>n.moveToLineBoundary(e,!0,!1));function Tz(n,e,t){let i=!1,l=za(n.selection,o=>{let a=Er(n,o.head,-1)||Er(n,o.head,1)||o.head>0&&Er(n,o.head-1,1)||o.headTz(n,e);function Fi(n,e,t){let i=za(n.state.selection,l=>{l.undirectional&&l.head>=l.anchor!=e&&(l=oe.range(l.head,l.anchor));let o=t(l);return oe.range(l.anchor,o.head,o.goalColumn,o.bidiLevel||void 0,o.assoc)});return i.eq(n.state.selection)?!1:(n.dispatch(rr(n.state,i)),!0)}function kT(n,e){return Fi(n,e,t=>n.moveByChar(t,e))}const ST=n=>kT(n,!Hn(n)),CT=n=>kT(n,Hn(n));function OT(n,e){return Fi(n,e,t=>n.moveByGroup(t,e))}const Ez=n=>OT(n,!Hn(n)),Mz=n=>OT(n,Hn(n)),Dz=n=>{let e=!Hn(n);return Fi(n,e,t=>sp(n.state,t,e))},Rz=n=>{let e=Hn(n);return Fi(n,e,t=>sp(n.state,t,e))};function NT(n,e){return Fi(n,e,t=>n.moveVertically(t,e))}const TT=n=>NT(n,!1),AT=n=>NT(n,!0);function ET(n,e){return Fi(n,e,t=>n.moveVertically(t,e,vT(n).height))}const r2=n=>ET(n,!1),l2=n=>ET(n,!0),jz=n=>Fi(n,!0,e=>us(n,e,!0)),_z=n=>Fi(n,!1,e=>us(n,e,!1)),Lz=n=>{let e=!Hn(n);return Fi(n,e,t=>us(n,t,e))},zz=n=>{let e=Hn(n);return Fi(n,e,t=>us(n,t,e))},Bz=n=>Fi(n,!1,e=>oe.cursor(n.lineBlockAt(e.head).from)),Pz=n=>Fi(n,!0,e=>oe.cursor(n.lineBlockAt(e.head).to)),s2=({state:n,dispatch:e})=>(e(rr(n,{anchor:0})),!0),o2=({state:n,dispatch:e})=>(e(rr(n,{anchor:n.doc.length})),!0),a2=({state:n,dispatch:e})=>(e(rr(n,{anchor:n.selection.main.anchor,head:0})),!0),u2=({state:n,dispatch:e})=>(e(rr(n,{anchor:n.selection.main.anchor,head:n.doc.length})),!0),Hz=({state:n,dispatch:e})=>(e(n.update({selection:{anchor:0,head:n.doc.length},userEvent:"select"})),!0),Iz=({state:n,dispatch:e})=>{let t=op(n).map(({from:i,to:l})=>oe.undirectionalRange(i,Math.min(l+1,n.doc.length)));return e(n.update({selection:oe.create(t),userEvent:"select"})),!0},Uz=({state:n,dispatch:e})=>{let t=za(n.selection,i=>{let l=Bn(n),o=l.resolveStack(i.from,1);if(i.empty){let a=l.resolveStack(i.from,-1);a.node.from>=o.node.from&&a.node.to<=o.node.to&&(o=a)}for(let a=o;a;a=a.next){let{node:c}=a;if((c.from=i.to||c.to>i.to&&c.from<=i.from)&&a.next)return oe.undirectionalRange(c.from,c.to)}return i});return t.eq(n.selection)?!1:(e(rr(n,t)),!0)};function MT(n,e){let{state:t}=n,i=t.selection,l=t.selection.ranges.slice();for(let o of t.selection.ranges){let a=t.doc.lineAt(o.head);if(e?a.to0)for(let c=o;;){let f=n.moveVertically(c,e);if(f.heada.to){l.some(d=>d.head==f.head)||l.push(f);break}else{if(f.head==c.head)break;c=f}}}return l.length==i.ranges.length?!1:(n.dispatch(rr(t,oe.create(l,l.length-1))),!0)}const Fz=n=>MT(n,!1),qz=n=>MT(n,!0),Vz=({state:n,dispatch:e})=>{let t=n.selection,i=null;return t.ranges.length>1?i=oe.create([t.main]):t.main.empty||(i=oe.create([oe.cursor(t.main.head)])),i?(e(rr(n,i)),!0):!1};function Ac(n,e){if(n.state.readOnly)return!1;let t="delete.selection",{state:i}=n,l=i.changeByRange(o=>{let{from:a,to:c}=o;if(a==c){let f=e(o);fa&&(t="delete.forward",f=Mh(n,f,!0)),a=Math.min(a,f),c=Math.max(c,f)}else a=Mh(n,a,!1),c=Mh(n,c,!0);return a==c?{range:o}:{changes:{from:a,to:c},range:oe.cursor(a,al(n)))i.between(e,e,(l,o)=>{le&&(e=t?o:l)});return e}const DT=(n,e,t)=>Ac(n,i=>{let l=i.from,{state:o}=n,a=o.doc.lineAt(l),c,f;if(t&&!e&&l>a.from&&lDT(n,!1,!0),RT=n=>DT(n,!0,!1),jT=(n,e)=>Ac(n,t=>{let i=t.head,{state:l}=n,o=l.doc.lineAt(i),a=l.charCategorizer(i);for(let c=null;;){if(i==(e?o.to:o.from)){i==t.head&&o.number!=(e?l.doc.lines:1)&&(i+=e?1:-1);break}let f=yn(o.text,i-o.from,e)+o.from,d=o.text.slice(Math.min(i,f)-o.from,Math.max(i,f)-o.from),p=a(d);if(c!=null&&p!=c)break;(d!=" "||i!=t.head)&&(c=p),i=f}return i}),_T=n=>jT(n,!1),Qz=n=>jT(n,!0),Xz=n=>Ac(n,e=>{let t=n.lineBlockAt(e.head).to;return e.headAc(n,e=>{let t=n.moveToLineBoundary(e,!1).head;return e.head>t?t:Math.max(0,e.head-1)}),Gz=n=>Ac(n,e=>{let t=n.moveToLineBoundary(e,!0).head;return e.head{if(n.readOnly)return!1;let t=n.changeByRange(i=>({changes:{from:i.from,to:i.to,insert:pt.of(["",""])},range:oe.cursor(i.from)}));return e(n.update(t,{scrollIntoView:!0,userEvent:"input"})),!0},Kz=({state:n,dispatch:e})=>{if(n.readOnly)return!1;let t=n.changeByRange(i=>{if(!i.empty||i.from==0||i.from==n.doc.length)return{range:i};let l=i.from,o=n.doc.lineAt(l),a=l==o.from?l-1:yn(o.text,l-o.from,!1)+o.from,c=l==o.to?l+1:yn(o.text,l-o.from,!0)+o.from;return{changes:{from:a,to:c,insert:n.doc.slice(l,c).append(n.doc.slice(a,l))},range:oe.cursor(c)}});return t.changes.empty?!1:(e(n.update(t,{scrollIntoView:!0,userEvent:"move.character"})),!0)};function op(n){let e=[],t=-1;for(let i of n.selection.ranges){let l=n.doc.lineAt(i.from),o=n.doc.lineAt(i.to);if(!i.empty&&i.to==o.from&&(o=n.doc.lineAt(i.to-1)),t>=l.number){let a=e[e.length-1];a.to=o.to,a.ranges.push(i)}else e.push({from:l.from,to:o.to,ranges:[i]});t=o.number+1}return e}function LT(n,e,t){if(n.readOnly)return!1;let i=[],l=[];for(let o of op(n)){if(t?o.to==n.doc.length:o.from==0)continue;let a=n.doc.lineAt(t?o.to+1:o.from-1),c=a.length+1;if(t){i.push({from:o.to,to:a.to},{from:o.from,insert:a.text+n.lineBreak});for(let f of o.ranges)l.push(oe.range(Math.min(n.doc.length,f.anchor+c),Math.min(n.doc.length,f.head+c)))}else{i.push({from:a.from,to:o.from},{from:o.to,insert:n.lineBreak+a.text});for(let f of o.ranges)l.push(oe.range(f.anchor-c,f.head-c))}}return i.length?(e(n.update({changes:i,scrollIntoView:!0,selection:oe.create(l,n.selection.mainIndex),userEvent:"move.line"})),!0):!1}const Wz=({state:n,dispatch:e})=>LT(n,e,!1),Zz=({state:n,dispatch:e})=>LT(n,e,!0);function zT(n,e,t){if(n.readOnly)return!1;let i=[];for(let o of op(n))t?i.push({from:o.from,insert:n.doc.slice(o.from,o.to)+n.lineBreak}):i.push({from:o.to,insert:n.lineBreak+n.doc.slice(o.from,o.to)});let l=n.changes(i);return e(n.update({changes:l,selection:n.selection.map(l,t?1:-1),scrollIntoView:!0,userEvent:"input.copyline"})),!0}const Jz=({state:n,dispatch:e})=>zT(n,e,!1),e6=({state:n,dispatch:e})=>zT(n,e,!0),t6=n=>{if(n.state.readOnly)return!1;let{state:e}=n,t=e.changes(op(e).map(({from:l,to:o})=>(l>0?l--:o{let o;if(n.lineWrapping){let a=n.lineBlockAt(l.head),c=n.coordsAtPos(l.head,l.assoc||1);c&&(o=a.bottom+n.documentTop-c.bottom+n.defaultLineHeight/2)}return n.moveVertically(l,!0,o)}).map(t);return n.dispatch({changes:t,selection:i,scrollIntoView:!0,userEvent:"delete.line"}),!0};function n6(n,e){if(/\(\)|\[\]|\{\}/.test(n.sliceDoc(e-1,e+1)))return{from:e,to:e};let t=Bn(n).resolveInner(e),i=t.childBefore(e),l=t.childAfter(e),o;return i&&l&&i.to<=e&&l.from>=e&&(o=i.type.prop(tt.closedBy))&&o.indexOf(l.name)>-1&&n.doc.lineAt(i.to).from==n.doc.lineAt(l.from).from&&!/\S/.test(n.sliceDoc(i.to,l.from))?{from:i.to,to:l.from}:null}const c2=BT(!1),i6=BT(!0);function BT(n){return({state:e,dispatch:t})=>{if(e.readOnly)return!1;let i=e.changeByRange(l=>{let{from:o,to:a}=l,c=e.doc.lineAt(o),f=!n&&o==a&&n6(e,o);n&&(o=a=(a<=c.to?c:e.doc.lineAt(a)).to);let d=new tp(e,{simulateBreak:o,simulateDoubleBreak:!!f}),p=Py(d,o);for(p==null&&(p=La(/^\s*/.exec(e.doc.lineAt(o).text)[0],e.tabSize));ac.from&&o{let l=[];for(let a=i.from;a<=i.to;){let c=n.doc.lineAt(a);c.number>t&&(i.empty||i.to>c.from)&&(e(c,l,i),t=c.number),a=c.to+1}let o=n.changes(l);return{changes:l,range:oe.range(o.mapPos(i.anchor,1),o.mapPos(i.head,1))}})}const r6=({state:n,dispatch:e})=>{if(n.readOnly)return!1;let t=Object.create(null),i=new tp(n,{overrideIndentation:o=>{let a=t[o];return a??-1}}),l=Fy(n,(o,a,c)=>{let f=Py(i,o.from);if(f==null)return;/\S/.test(o.text)||(f=0);let d=/^\s*/.exec(o.text)[0],p=mc(n,f);(d!=p||c.fromn.readOnly?!1:(e(n.update(Fy(n,(t,i)=>{i.push({from:t.from,insert:n.facet(By)})}),{userEvent:"input.indent"})),!0),s6=({state:n,dispatch:e})=>n.readOnly?!1:(e(n.update(Fy(n,(t,i)=>{let l=/^\s*/.exec(t.text)[0];if(!l)return;let o=La(l,n.tabSize),a=0,c=mc(n,Math.max(0,o-Sd(n)));for(;a(n.setTabFocusMode(),!0),a6=[{key:"Ctrl-b",run:pT,shift:ST,preventDefault:!0},{key:"Ctrl-f",run:mT,shift:CT},{key:"Ctrl-p",run:yT,shift:TT},{key:"Ctrl-n",run:bT,shift:AT},{key:"Ctrl-a",run:Oz,shift:Bz},{key:"Ctrl-e",run:Nz,shift:Pz},{key:"Ctrl-d",run:RT},{key:"Ctrl-h",run:Vx},{key:"Ctrl-k",run:Xz},{key:"Ctrl-Alt-h",run:_T},{key:"Ctrl-o",run:Yz},{key:"Ctrl-t",run:Kz},{key:"Ctrl-v",run:qx}],u6=[{key:"ArrowLeft",run:pT,shift:ST,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:gz,shift:Ez,preventDefault:!0},{mac:"Cmd-ArrowLeft",run:Sz,shift:Lz,preventDefault:!0},{key:"ArrowRight",run:mT,shift:CT,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:xz,shift:Mz,preventDefault:!0},{mac:"Cmd-ArrowRight",run:Cz,shift:zz,preventDefault:!0},{key:"ArrowUp",run:yT,shift:TT,preventDefault:!0},{mac:"Cmd-ArrowUp",run:s2,shift:a2},{mac:"Ctrl-ArrowUp",run:i2,shift:r2},{key:"ArrowDown",run:bT,shift:AT,preventDefault:!0},{mac:"Cmd-ArrowDown",run:o2,shift:u2},{mac:"Ctrl-ArrowDown",run:qx,shift:l2},{key:"PageUp",run:i2,shift:r2},{key:"PageDown",run:qx,shift:l2},{key:"Home",run:kz,shift:_z,preventDefault:!0},{key:"Mod-Home",run:s2,shift:a2},{key:"End",run:wz,shift:jz,preventDefault:!0},{key:"Mod-End",run:o2,shift:u2},{key:"Enter",run:c2,shift:c2},{key:"Mod-a",run:Hz},{key:"Backspace",run:Vx,shift:Vx,preventDefault:!0},{key:"Delete",run:RT,preventDefault:!0},{key:"Mod-Backspace",mac:"Alt-Backspace",run:_T,preventDefault:!0},{key:"Mod-Delete",mac:"Alt-Delete",run:Qz,preventDefault:!0},{mac:"Mod-Backspace",run:$z,preventDefault:!0},{mac:"Mod-Delete",run:Gz,preventDefault:!0}].concat(a6.map(n=>({mac:n.key,run:n.run,shift:n.shift}))),c6=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:bz,shift:Dz},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:vz,shift:Rz},{key:"Alt-ArrowUp",run:Wz},{key:"Shift-Alt-ArrowUp",run:Jz},{key:"Alt-ArrowDown",run:Zz},{key:"Shift-Alt-ArrowDown",run:e6},{key:"Mod-Alt-ArrowUp",run:Fz},{key:"Mod-Alt-ArrowDown",run:qz},{key:"Escape",run:Vz},{key:"Mod-Enter",run:i6},{key:"Alt-l",mac:"Ctrl-l",run:Iz},{key:"Mod-i",run:Uz,preventDefault:!0},{key:"Mod-[",run:s6},{key:"Mod-]",run:l6},{key:"Mod-Alt-\\",run:r6},{key:"Shift-Mod-k",run:t6},{key:"Shift-Mod-\\",run:Az},{key:"Mod-/",run:WL},{key:"Alt-A",mac:"Ctrl-A",run:JL},{key:"Ctrl-m",mac:"Shift-Alt-m",run:o6}].concat(u6),f2=typeof String.prototype.normalize=="function"?n=>n.normalize("NFKD"):n=>n;class ja{constructor(e,t,i=0,l=e.length,o,a){this.test=a,this.value={from:0,to:0,precise:!1},this.done=!1,this.matches=[],this.buffer="",this.bufferPos=0,this.iter=e.iterRange(i,l),this.bufferStart=i,this.normalize=o?c=>o(f2(c)):f2,this.query=this.normalize(t)}peek(){if(this.bufferPos==this.buffer.length){if(this.bufferStart+=this.buffer.length,this.iter.next(),this.iter.done)return-1;this.bufferPos=0,this.buffer=this.iter.value}return oi(this.buffer,this.bufferPos)}next(){for(;this.matches.length;)this.matches.pop();return this.nextOverlapping()}nextOverlapping(){for(;;){let e=this.peek();if(e<0)return this.done=!0,this;let t=my(e),i=this.bufferStart+this.bufferPos;this.bufferPos+=Nr(e);let l=this.normalize(t);if(l.length)for(let o=0,a=i,c=!0;;o++){let f=l.charCodeAt(o),d=this.match(f,a,c,this.bufferPos+this.bufferStart,o==l.length-1);if(d)return this.value=d,this;if(o==l.length-1)break;c&&othis.to&&(this.curLine=this.curLine.slice(0,this.to-this.curLineStart)),this.iter.next())}nextLine(){this.curLineStart=this.curLineStart+this.curLine.length+1,this.curLineStart>this.to?this.curLine="":this.getLine(0)}next(){for(let e=this.matchPos-this.curLineStart;;){this.re.lastIndex=e;let t=this.matchPos<=this.to&&this.re.exec(this.curLine);if(t){let i=this.curLineStart+t.index,l=i+t[0].length;if(this.matchPos=Td(this.text,l+(i==l?1:0)),i==this.curLineStart+this.curLine.length&&this.nextLine(),(ithis.value.to)&&(!this.test||this.test(i,l,t)))return this.value={from:i,to:l,precise:!0,match:t},this;e=this.matchPos-this.curLineStart}else if(this.curLineStart+this.curLine.length=i||l.to<=t){let c=new ba(t,e.sliceString(t,i));return y0.set(e,c),c}if(l.from==t&&l.to==i)return l;let{text:o,from:a}=l;return a>t&&(o=e.sliceString(t,a)+o,a=t),l.to=this.to?this.to:this.text.lineAt(e).to}next(){for(;;){let e=this.re.lastIndex=this.matchPos-this.flat.from,t=this.re.exec(this.flat.text);if(t&&!t[0]&&t.index==e&&(this.re.lastIndex=e+1,t=this.re.exec(this.flat.text)),t){let i=this.flat.from+t.index,l=i+t[0].length;if((this.flat.to>=this.to||t.index+t[0].length<=this.flat.text.length-10)&&(!this.test||this.test(i,l,t)))return this.value={from:i,to:l,precise:!0,match:t},this.matchPos=Td(this.text,l+(i==l?1:0)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=ba.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+this.flat.text.length*2))}}}typeof Symbol<"u"&&(HT.prototype[Symbol.iterator]=IT.prototype[Symbol.iterator]=function(){return this});function f6(n){try{return new RegExp(n,qy),!0}catch{return!1}}function Td(n,e){if(e>=n.length)return e;let t=n.lineAt(e),i;for(;e=56320&&i<57344;)e++;return e}const h6=n=>{let e=E_(n,"cm-goto-line");if(e){let a=e.dom.querySelector("input[type=text]");return a&&a.select(),!0}let{state:t}=n,i=String(t.doc.lineAt(n.state.selection.main.head).number),{close:l,result:o}=A_(n,{class:"cm-goto-line",label:t.phrase("Go to line"),input:{type:"text",name:"line",value:i},focus:!0,submitLabel:t.phrase("go")});return o.then(a=>{let c=a&&/^([+-])?(\d+)?(:\d+)?(%)?$/.exec(a.elements.line.value);if(!c){n.dispatch({effects:l});return}let f=t.doc.lineAt(t.selection.main.head),[,d,p,g,b]=c,v=g?+g.slice(1):0,w=p?+p:f.number;if(p&&b){let O=w/100;d&&(O=O*(d=="-"?-1:1)+f.number/t.doc.lines),w=Math.round(t.doc.lines*O)}else p&&d&&(w=w*(d=="-"?-1:1)+f.number);let S=t.doc.line(Math.max(1,Math.min(t.doc.lines,w))),C=oe.cursor(S.from+Math.max(0,Math.min(v,S.length)));n.dispatch({effects:[l,Oe.scrollIntoView(C.from,{y:"center"})],selection:C})}),!0},d6={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},p6=Ce.define({combine(n){return jr(n,d6,{highlightWordAroundCursor:(e,t)=>e||t,minSelectionLength:Math.min,maxMatches:Math.min})}});function m6(n){return[v6,b6]}const g6=Ie.mark({class:"cm-selectionMatch"}),x6=Ie.mark({class:"cm-selectionMatch cm-selectionMatch-main"});function h2(n,e,t,i){return(t==0||n(e.sliceDoc(t-1,t))!=Ut.Word)&&(i==e.doc.length||n(e.sliceDoc(i,i+1))!=Ut.Word)}function y6(n,e,t,i){return n(e.sliceDoc(t,t+1))==Ut.Word&&n(e.sliceDoc(i-1,i))==Ut.Word}const b6=en.fromClass(class{constructor(n){this.decorations=this.getDeco(n)}update(n){(n.selectionSet||n.docChanged||n.viewportChanged)&&(this.decorations=this.getDeco(n.view))}getDeco(n){let e=n.state.facet(p6),{state:t}=n,i=t.selection;if(i.ranges.length>1)return Ie.none;let l=i.main,o,a=null;if(l.empty){if(!e.highlightWordAroundCursor)return Ie.none;let f=t.wordAt(l.head);if(!f)return Ie.none;a=t.charCategorizer(l.head),o=t.sliceDoc(f.from,f.to)}else{let f=l.to-l.from;if(f200)return Ie.none;if(e.wholeWords){if(o=t.sliceDoc(l.from,l.to),a=t.charCategorizer(l.head),!(h2(a,t,l.from,l.to)&&y6(a,t,l.from,l.to)))return Ie.none}else if(o=t.sliceDoc(l.from,l.to),!o)return Ie.none}let c=[];for(let f of n.visibleRanges){let d=new ja(t.doc,o,f.from,f.to);for(;!d.next().done;){let{from:p,to:g}=d.value;if((!a||h2(a,t,p,g))&&(l.empty&&p<=l.from&&g>=l.to?c.push(x6.range(p,g)):(p>=l.to||g<=l.from)&&c.push(g6.range(p,g)),c.length>e.maxMatches))return Ie.none}}return Ie.set(c)}},{decorations:n=>n.decorations}),v6=Oe.baseTheme({".cm-selectionMatch":{backgroundColor:"#99ff7780"},".cm-searchMatch .cm-selectionMatch":{backgroundColor:"transparent"}}),w6=({state:n,dispatch:e})=>{let{selection:t}=n,i=oe.create(t.ranges.map(l=>n.wordAt(l.head)||oe.cursor(l.head)),t.mainIndex);return i.eq(t)?!1:(e(n.update({selection:i})),!0)};function k6(n,e){let{main:t,ranges:i}=n.selection,l=n.wordAt(t.head),o=l&&l.from==t.from&&l.to==t.to;for(let a=!1,c=new ja(n.doc,e,i[i.length-1].to);;)if(c.next(),c.done){if(a)return null;c=new ja(n.doc,e,0,Math.max(0,i[i.length-1].from-1)),a=!0}else{if(a&&i.some(f=>f.from==c.value.from))continue;if(o){let f=n.wordAt(c.value.from);if(!f||f.from!=c.value.from||f.to!=c.value.to)continue}return c.value}}const S6=({state:n,dispatch:e})=>{let{ranges:t}=n.selection;if(t.some(o=>o.from===o.to))return w6({state:n,dispatch:e});let i=n.sliceDoc(t[0].from,t[0].to);if(n.selection.ranges.some(o=>n.sliceDoc(o.from,o.to)!=i))return!1;let l=k6(n,i);return l?(e(n.update({selection:n.selection.addRange(oe.range(l.from,l.to),!1),effects:Oe.scrollIntoView(l.to)})),!0):!1},Ba=Ce.define({combine(n){return jr(n,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:e=>new B6(e),scrollToMatch:e=>Oe.scrollIntoView(e)})}});class UT{constructor(e){this.search=e.search,this.caseSensitive=!!e.caseSensitive,this.literal=!!e.literal,this.regexp=!!e.regexp,this.replace=e.replace||"",this.valid=!!this.search&&(!this.regexp||f6(this.search)),this.unquoted=this.unquote(this.search),this.wholeWord=!!e.wholeWord,this.test=e.test}unquote(e){return this.literal?e:e.replace(/\\([nrt\\])/g,(t,i)=>i=="n"?` -`:i=="r"?"\r":i=="t"?" ":"\\")}eq(e){return this.search==e.search&&this.replace==e.replace&&this.caseSensitive==e.caseSensitive&&this.regexp==e.regexp&&this.wholeWord==e.wholeWord&&this.test==e.test}create(){return this.regexp?new E6(this):new N6(this)}getCursor(e,t=0,i){let l=e.doc?e:mt.create({doc:e});return i==null&&(i=l.doc.length),this.regexp?la(this,l,t,i):ra(this,l,t,i)}}class FT{constructor(e){this.spec=e}}function C6(n,e,t){return(i,l,o,a)=>{if(t&&!t(i,l,o,a))return!1;let c=i>=a&&l<=a+o.length?o.slice(i-a,l-a):e.doc.sliceString(i,l);return n(c,e,i,l)}}function ra(n,e,t,i){let l;return n.wholeWord&&(l=O6(e.doc,e.charCategorizer(e.selection.main.head))),n.test&&(l=C6(n.test,e,l)),new ja(e.doc,n.unquoted,t,i,n.caseSensitive?void 0:o=>o.toLowerCase(),l)}function O6(n,e){return(t,i,l,o)=>((o>t||o+l.length=t)return null;l.push(i.value)}return l}highlight(e,t,i,l){let o=ra(this.spec,e,Math.max(0,t-this.spec.unquoted.length),Math.min(i+this.spec.unquoted.length,e.doc.length));for(;!o.next().done;)l(o.value.from,o.value.to)}}function T6(n,e,t){return(i,l,o)=>(!t||t(i,l,o))&&n(o[0],e,i,l)}function la(n,e,t,i){let l;return n.wholeWord&&(l=A6(e.charCategorizer(e.selection.main.head))),n.test&&(l=T6(n.test,e,l)),new HT(e.doc,n.search,{ignoreCase:!n.caseSensitive,test:l},t,i)}function Ad(n,e){return n.slice(yn(n,e,!1),e)}function Ed(n,e){return n.slice(e,yn(n,e))}function A6(n){return(e,t,i)=>!i[0].length||(n(Ad(i.input,i.index))!=Ut.Word||n(Ed(i.input,i.index))!=Ut.Word)&&(n(Ed(i.input,i.index+i[0].length))!=Ut.Word||n(Ad(i.input,i.index+i[0].length))!=Ut.Word)}class E6 extends FT{nextMatch(e,t,i){let l=la(this.spec,e,i,e.doc.length).next();return l.done&&(l=la(this.spec,e,0,t).next()),l.done?null:l.value}prevMatchInRange(e,t,i){for(let l=1;;l++){let o=Math.max(t,i-l*1e4),a=la(this.spec,e,o,i),c=null;for(;!a.next().done;)c=a.value;if(c&&(o==t||c.from>o+10))return c;if(o==t)return null}}prevMatch(e,t,i){return this.prevMatchInRange(e,0,t)||this.prevMatchInRange(e,i,e.doc.length)}getReplacement(e){return this.spec.unquote(this.spec.replace).replace(/\$([$&]|\d+)/g,(t,i)=>{if(i=="&")return e.match[0];if(i=="$")return"$";for(let l=i.length;l>0;l--){let o=+i.slice(0,l);if(o>0&&o=t)return null;l.push(i.value)}return l}highlight(e,t,i,l){let o=la(this.spec,e,Math.max(0,t-250),Math.min(i+250,e.doc.length));for(;!o.next().done;)l(o.value.from,o.value.to)}}const gc=Ye.define(),Vy=Ye.define(),Wl=Pn.define({create(n){return new b0(Qx(n).create(),null)},update(n,e){for(let t of e.effects)t.is(gc)?n=new b0(t.value.create(),n.panel):t.is(Vy)&&(n=new b0(n.query,t.value?Qy:null));return n},provide:n=>hc.from(n,e=>e.panel)});class b0{constructor(e,t){this.query=e,this.panel=t}}const M6=Ie.mark({class:"cm-searchMatch"}),D6=Ie.mark({class:"cm-searchMatch cm-searchMatch-selected"}),R6=en.fromClass(class{constructor(n){this.view=n,this.decorations=this.highlight(n.state.field(Wl))}update(n){let e=n.state.field(Wl);(e!=n.startState.field(Wl)||n.docChanged||n.selectionSet||n.viewportChanged)&&(this.decorations=this.highlight(e))}highlight({query:n,panel:e}){if(!e||!n.spec.valid)return Ie.none;let{view:t}=this,i=new Rr;for(let l=0,o=t.visibleRanges,a=o.length;lo[l+1].from-500;)f=o[++l].to;n.highlight(t.state,c,f,(d,p)=>{let g=t.state.selection.ranges.some(b=>b.from==d&&b.to==p);i.add(d,p,g?D6:M6)})}return i.finish()}},{decorations:n=>n.decorations});function Ec(n){return e=>{let t=e.state.field(Wl,!1);return t&&t.query.spec.valid?n(e,t):QT(e)}}const Md=Ec((n,{query:e})=>{let{to:t}=n.state.selection.main,i=e.nextMatch(n.state,t,t);if(!i)return!1;let l=oe.single(i.from,i.to),o=n.state.facet(Ba);return n.dispatch({selection:l,effects:[Xy(n,i),o.scrollToMatch(l.main,n)],userEvent:"select.search"}),VT(n),!0}),Dd=Ec((n,{query:e})=>{let{state:t}=n,{from:i}=t.selection.main,l=e.prevMatch(t,i,i);if(!l)return!1;let o=oe.single(l.from,l.to),a=n.state.facet(Ba);return n.dispatch({selection:o,effects:[Xy(n,l),a.scrollToMatch(o.main,n)],userEvent:"select.search"}),VT(n),!0}),j6=Ec((n,{query:e})=>{let t=e.matchAll(n.state,1e3);return!t||!t.length?!1:(n.dispatch({selection:oe.create(t.map(i=>oe.range(i.from,i.to))),userEvent:"select.search.matches"}),!0)}),_6=({state:n,dispatch:e})=>{let t=n.selection;if(t.ranges.length>1||t.main.empty)return!1;let{from:i,to:l}=t.main,o=[],a=0;for(let c=new ja(n.doc,n.sliceDoc(i,l));!c.next().done;){if(o.length>1e3)return!1;c.value.from==i&&(a=o.length),o.push(oe.range(c.value.from,c.value.to))}return e(n.update({selection:oe.create(o,a),userEvent:"select.search.matches"})),!0},d2=Ec((n,{query:e})=>{let{state:t}=n,{from:i,to:l}=t.selection.main;if(t.readOnly)return!1;let o=e.nextMatch(t,i,i);if(!o)return!1;let a=o,c=[],f,d,p=[];a.precise?a.from==i&&a.to==l&&(d=t.toText(e.getReplacement(a)),c.push({from:a.from,to:a.to,insert:d}),a=e.nextMatch(t,a.from,a.to),p.push(Oe.announce.of(t.phrase("replaced match on line $",t.doc.lineAt(i).number)+"."))):a=e.nextMatch(t,a.from,a.to);let g=n.state.changes(c);return a&&(f=oe.single(a.from,a.to).map(g),p.push(Xy(n,a)),p.push(t.facet(Ba).scrollToMatch(f.main,n))),n.dispatch({changes:g,selection:f,effects:p,userEvent:"input.replace"}),!0}),L6=Ec((n,{query:e})=>{if(n.state.readOnly)return!1;let t=[];for(let l of e.matchAll(n.state,1e9)){let{from:o,to:a,precise:c}=l;c&&t.push({from:o,to:a,insert:e.getReplacement(l)})}if(!t.length)return!1;let i=n.state.phrase("replaced $ matches",t.length)+".";return n.dispatch({changes:t,effects:Oe.announce.of(i),userEvent:"input.replace.all"}),!0});function Qy(n){return n.state.facet(Ba).createPanel(n)}function Qx(n,e){var t,i,l,o,a;let c=n.selection.main,f=c.empty||c.to>c.from+100?"":n.sliceDoc(c.from,c.to);if(e&&!f)return e;let d=n.facet(Ba);return new UT({search:((t=e==null?void 0:e.literal)!==null&&t!==void 0?t:d.literal)?f:f.replace(/\n/g,"\\n"),caseSensitive:(i=e==null?void 0:e.caseSensitive)!==null&&i!==void 0?i:d.caseSensitive,literal:(l=e==null?void 0:e.literal)!==null&&l!==void 0?l:d.literal,regexp:(o=e==null?void 0:e.regexp)!==null&&o!==void 0?o:d.regexp,wholeWord:(a=e==null?void 0:e.wholeWord)!==null&&a!==void 0?a:d.wholeWord})}function qT(n){let e=ep(n,Qy);return e&&e.dom.querySelector("[main-field]")}function VT(n){let e=qT(n);e&&e==n.root.activeElement&&e.select()}const QT=n=>{let e=n.state.field(Wl,!1);if(e&&e.panel){let t=qT(n);if(t&&t!=n.root.activeElement){let i=Qx(n.state,e.query.spec);i.valid&&n.dispatch({effects:gc.of(i)}),t.focus(),t.select()}}else n.dispatch({effects:[Vy.of(!0),e?gc.of(Qx(n.state,e.query.spec)):Ye.appendConfig.of(H6)]});return!0},XT=n=>{let e=n.state.field(Wl,!1);if(!e||!e.panel)return!1;let t=ep(n,Qy);return t&&t.dom.contains(n.root.activeElement)&&n.focus(),n.dispatch({effects:Vy.of(!1)}),!0},z6=[{key:"Mod-f",run:QT,scope:"editor search-panel"},{key:"F3",run:Md,shift:Dd,scope:"editor search-panel",preventDefault:!0},{key:"Mod-g",run:Md,shift:Dd,scope:"editor search-panel",preventDefault:!0},{key:"Escape",run:XT,scope:"editor search-panel"},{key:"Mod-Shift-l",run:_6},{key:"Mod-Alt-g",run:h6},{key:"Mod-d",run:S6,preventDefault:!0}];class B6{constructor(e){this.view=e;let t=this.query=e.state.field(Wl).query.spec;this.commit=this.commit.bind(this),this.searchField=Tt("input",{value:t.search,placeholder:ki(e,"Find"),"aria-label":ki(e,"Find"),class:"cm-textfield",name:"search",form:"","main-field":"true",onchange:this.commit,onkeyup:this.commit}),this.replaceField=Tt("input",{value:t.replace,placeholder:ki(e,"Replace"),"aria-label":ki(e,"Replace"),class:"cm-textfield",name:"replace",form:"",onchange:this.commit,onkeyup:this.commit}),this.caseField=Tt("input",{type:"checkbox",name:"case",form:"",checked:t.caseSensitive,onchange:this.commit}),this.reField=Tt("input",{type:"checkbox",name:"re",form:"",checked:t.regexp,onchange:this.commit}),this.wordField=Tt("input",{type:"checkbox",name:"word",form:"",checked:t.wholeWord,onchange:this.commit});function i(l,o,a){return Tt("button",{class:"cm-button",name:l,onclick:o,type:"button"},a)}this.dom=Tt("div",{onkeydown:l=>this.keydown(l),class:"cm-search"},[this.searchField,i("next",()=>Md(e),[ki(e,"next")]),i("prev",()=>Dd(e),[ki(e,"previous")]),i("select",()=>j6(e),[ki(e,"all")]),Tt("label",null,[this.caseField,ki(e,"match case")]),Tt("label",null,[this.reField,ki(e,"regexp")]),Tt("label",null,[this.wordField,ki(e,"by word")]),...e.state.readOnly?[]:[Tt("br"),this.replaceField,i("replace",()=>d2(e),[ki(e,"replace")]),i("replaceAll",()=>L6(e),[ki(e,"replace all")])],Tt("button",{name:"close",onclick:()=>XT(e),"aria-label":ki(e,"close"),type:"button"},["×"])])}commit(){let e=new UT({search:this.searchField.value,caseSensitive:this.caseField.checked,regexp:this.reField.checked,wholeWord:this.wordField.checked,replace:this.replaceField.value});e.eq(this.query)||(this.query=e,this.view.dispatch({effects:gc.of(e)}))}keydown(e){Pj(this.view,e,"search-panel")?e.preventDefault():e.keyCode==13&&e.target==this.searchField?(e.preventDefault(),(e.shiftKey?Dd:Md)(this.view)):e.keyCode==13&&e.target==this.replaceField&&(e.preventDefault(),d2(this.view))}update(e){for(let t of e.transactions)for(let i of t.effects)i.is(gc)&&!i.value.eq(this.query)&&this.setQuery(i.value)}setQuery(e){this.query=e,this.searchField.value=e.search,this.replaceField.value=e.replace,this.caseField.checked=e.caseSensitive,this.reField.checked=e.regexp,this.wordField.checked=e.wholeWord}mount(){this.searchField.select()}get pos(){return 80}get top(){return this.view.state.facet(Ba).top}}function ki(n,e){return n.state.phrase(e)}const Dh=30,Rh=/[\s\.,:;?!]/;function Xy(n,{from:e,to:t}){let i=n.state.doc.lineAt(e),l=n.state.doc.lineAt(t).to,o=Math.max(i.from,e-Dh),a=Math.min(l,t+Dh),c=n.state.sliceDoc(o,a);if(o!=i.from){for(let f=0;fc.length-Dh;f--)if(!Rh.test(c[f-1])&&Rh.test(c[f])){c=c.slice(0,f);break}}return Oe.announce.of(`${n.state.phrase("current match")}. ${c} ${n.state.phrase("on line")} ${i.number}.`)}const P6=Oe.baseTheme({".cm-panel.cm-search":{padding:"2px 6px 4px",position:"relative","& [name=close]":{position:"absolute",top:"0",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",padding:0,margin:0},"& input, & button, & label":{margin:".2em .6em .2em 0"},"& input[type=checkbox]":{marginRight:".2em"},"& label":{fontSize:"80%",whiteSpace:"pre"}},"&light .cm-searchMatch":{backgroundColor:"#ffff0054"},"&dark .cm-searchMatch":{backgroundColor:"#00ffff8a"},"&light .cm-searchMatch-selected":{backgroundColor:"#ff6a0054"},"&dark .cm-searchMatch-selected":{backgroundColor:"#ff00ff8a"}}),H6=[Wl,oo.low(R6),P6];class $T{constructor(e,t,i,l){this.state=e,this.pos=t,this.explicit=i,this.view=l,this.abortListeners=[],this.abortOnDocChange=!1}tokenBefore(e){let t=Bn(this.state).resolveInner(this.pos,-1);for(;t&&e.indexOf(t.name)<0;)t=t.parent;return t?{from:t.from,to:this.pos,text:this.state.sliceDoc(t.from,this.pos),type:t.type}:null}matchBefore(e){let t=this.state.doc.lineAt(this.pos),i=Math.max(t.from,this.pos-250),l=t.text.slice(i-t.from,this.pos-t.from),o=l.search(GT(e,!1));return o<0?null:{from:i+o,to:this.pos,text:l.slice(o)}}get aborted(){return this.abortListeners==null}addEventListener(e,t,i){e=="abort"&&this.abortListeners&&(this.abortListeners.push(t),i&&i.onDocChange&&(this.abortOnDocChange=!0))}}function p2(n){let e=Object.keys(n).join(""),t=/\w/.test(e);return t&&(e=e.replace(/\w/g,"")),`[${t?"\\w":""}${e.replace(/[^\w\s]/g,"\\$&")}]`}function I6(n){let e=Object.create(null),t=Object.create(null);for(let{label:l}of n){e[l[0]]=!0;for(let o=1;otypeof l=="string"?{label:l}:l),[t,i]=e.every(l=>/^\w+$/.test(l.label))?[/\w*$/,/\w+$/]:I6(e);return l=>{let o=l.matchBefore(i);return o||l.explicit?{from:o?o.from:l.pos,options:e,validFor:t}:null}}class m2{constructor(e,t,i,l){this.completion=e,this.source=t,this.match=i,this.score=l}}function to(n){return n.selection.main.from}function GT(n,e){var t;let{source:i}=n,l=e&&i[0]!="^",o=i[i.length-1]!="$";return!l&&!o?n:new RegExp(`${l?"^":""}(?:${i})${o?"$":""}`,(t=n.flags)!==null&&t!==void 0?t:n.ignoreCase?"i":"")}const YT=al.define();function F6(n,e,t,i){let{main:l}=n.selection,o=t-l.from,a=i-l.from;return{...n.changeByRange(c=>{if(c!=l&&t!=i&&n.sliceDoc(c.from+o,c.from+a)!=n.sliceDoc(t,i))return{range:c};let f=n.toText(e);return{changes:{from:c.from+o,to:i==l.from?c.to:c.from+a,insert:f},range:oe.cursor(c.from+o+f.length)}}),scrollIntoView:!0,userEvent:"input.complete"}}const g2=new WeakMap;function q6(n){if(!Array.isArray(n))return n;let e=g2.get(n);return e||g2.set(n,e=U6(n)),e}const Rd=Ye.define(),xc=Ye.define();class V6{constructor(e){this.pattern=e,this.chars=[],this.folded=[],this.any=[],this.precise=[],this.byWord=[],this.score=0,this.matched=[];for(let t=0;t=48&&P<=57||P>=97&&P<=122?2:P>=65&&P<=90?1:0:(A=my(P))!=A.toLowerCase()?1:A!=A.toUpperCase()?2:0;(!j||T==1&&C||H==0&&T!=0)&&(t[g]==P||i[g]==P&&(b=!0)?a[g++]=j:a.length&&(O=!1)),H=T,j+=Nr(P)}return g==f&&a[0]==0&&O?this.result(-100+(b?-200:0),a,e):v==f&&w==0?this.ret(-200-e.length+(S==e.length?0:-100),[0,S]):c>-1?this.ret(-700-e.length,[c,c+this.pattern.length]):v==f?this.ret(-900-e.length,[w,S]):g==f?this.result(-100+(b?-200:0)+-700+(O?0:-1100),a,e):t.length==2?null:this.result((l[0]?-700:0)+-200+-1100,l,e)}result(e,t,i){let l=[],o=0;for(let a of t){let c=a+(this.astral?Nr(oi(i,a)):1);o&&l[o-1]==a?l[o-1]=c:(l[o++]=a,l[o++]=c)}return this.ret(e-i.length,l)}}class Q6{constructor(e){this.pattern=e,this.matched=[],this.score=0,this.folded=e.toLowerCase()}match(e){if(e.length!1,activateOnTypingDelay:100,selectOnOpen:!0,override:null,closeOnBlur:!0,maxRenderedOptions:100,defaultKeymap:!0,tooltipClass:()=>"",optionClass:()=>"",aboveCursor:!1,icons:!0,addToOptions:[],positionInfo:X6,filterStrict:!1,compareCompletions:(e,t)=>(e.sortText||e.label).localeCompare(t.sortText||t.label),interactionDelay:75,updateSyncTime:100},{defaultKeymap:(e,t)=>e&&t,closeOnBlur:(e,t)=>e&&t,icons:(e,t)=>e&&t,tooltipClass:(e,t)=>i=>x2(e(i),t(i)),optionClass:(e,t)=>i=>x2(e(i),t(i)),addToOptions:(e,t)=>e.concat(t),filterStrict:(e,t)=>e||t})}});function x2(n,e){return n?e?n+" "+e:n:e}function X6(n,e,t,i,l,o){let a=n.textDirection==At.RTL,c=a,f=!1,d="top",p,g,b=e.left-l.left,v=l.right-e.right,w=i.right-i.left,S=i.bottom-i.top;if(c&&b=S||j>e.top?p=t.bottom-e.top:(d="bottom",p=e.bottom-t.top)}let C=(e.bottom-e.top)/o.offsetHeight,O=(e.right-e.left)/o.offsetWidth;return{style:`${d}: ${p/C}px; max-width: ${g/O}px`,class:"cm-completionInfo-"+(f?a?"left-narrow":"right-narrow":c?"left":"right")}}const $y=Ye.define();function $6(n){let e=n.addToOptions.slice();return n.icons&&e.push({render(t){let i=document.createElement("div");return i.classList.add("cm-completionIcon"),t.type&&i.classList.add(...t.type.split(/\s+/g).map(l=>"cm-completionIcon-"+l)),i.setAttribute("aria-hidden","true"),i},position:20}),e.push({render(t,i,l,o){let a=document.createElement("span");a.className="cm-completionLabel";let c=t.displayLabel||t.label,f=0;for(let d=0;df&&a.appendChild(document.createTextNode(c.slice(f,p)));let b=a.appendChild(document.createElement("span"));b.appendChild(document.createTextNode(c.slice(p,g))),b.className="cm-completionMatchedText",f=g}return ft.position-i.position).map(t=>t.render)}function v0(n,e,t){if(n<=t)return{from:0,to:n};if(e<0&&(e=0),e<=n>>1){let l=Math.floor(e/t);return{from:l*t,to:(l+1)*t}}let i=Math.ceil((n-e)/t);return{from:n-i*t,to:n-(i-1)*t}}class G6{constructor(e,t,i){this.view=e,this.stateField=t,this.applyCompletion=i,this.info=null,this.infoDestroy=null,this.placeInfoReq={read:()=>this.measureInfo(),write:f=>this.placeInfo(f),key:this},this.space=null,this.currentClass="";let l=e.state.field(t),{options:o,selected:a}=l.open,c=e.state.facet(xn);this.optionContent=$6(c),this.optionClass=c.optionClass,this.tooltipClass=c.tooltipClass,this.range=v0(o.length,a,c.maxRenderedOptions),this.dom=document.createElement("div"),this.dom.className="cm-tooltip-autocomplete",this.updateTooltipClass(e.state),this.dom.addEventListener("mousedown",f=>{let{options:d}=e.state.field(t).open;for(let p=f.target,g;p&&p!=this.dom;p=p.parentNode)if(p.nodeName=="LI"&&(g=/-(\d+)$/.exec(p.id))&&+g[1]this.list.lastChild.getBoundingClientRect().bottom?this.range.to:null;p!=null&&(e.dispatch({effects:$y.of(p)}),f.preventDefault())}}),this.dom.addEventListener("focusout",f=>{let d=e.state.field(this.stateField,!1);d&&d.tooltip&&e.state.facet(xn).closeOnBlur&&f.relatedTarget!=e.contentDOM&&e.dispatch({effects:xc.of(null)})}),this.showOptions(o,l.id)}mount(){this.updateSel()}showOptions(e,t){this.list&&this.list.remove(),this.list=this.dom.appendChild(this.createListBox(e,t,this.range)),this.list.addEventListener("scroll",()=>{this.info&&this.view.requestMeasure(this.placeInfoReq)})}update(e){var t;let i=e.state.field(this.stateField),l=e.startState.field(this.stateField);if(this.updateTooltipClass(e.state),i!=l){let{options:o,selected:a,disabled:c}=i.open;(!l.open||l.open.options!=o)&&(this.range=v0(o.length,a,e.state.facet(xn).maxRenderedOptions),this.showOptions(o,i.id)),this.updateSel(),c!=((t=l.open)===null||t===void 0?void 0:t.disabled)&&this.dom.classList.toggle("cm-tooltip-autocomplete-disabled",!!c)}}updateTooltipClass(e){let t=this.tooltipClass(e);if(t!=this.currentClass){for(let i of this.currentClass.split(" "))i&&this.dom.classList.remove(i);for(let i of t.split(" "))i&&this.dom.classList.add(i);this.currentClass=t}}positioned(e){this.space=e,this.info&&this.view.requestMeasure(this.placeInfoReq)}updateSel(){let e=this.view.state.field(this.stateField),t=e.open;(t.selected>-1&&t.selected=this.range.to)&&(this.range=v0(t.options.length,t.selected,this.view.state.facet(xn).maxRenderedOptions),this.showOptions(t.options,e.id));let i=this.updateSelectedOption(t.selected);if(i){this.destroyInfo();let{completion:l}=t.options[t.selected],{info:o}=l;if(!o)return;let a=typeof o=="string"?document.createTextNode(o):o(l);if(!a)return;"then"in a?a.then(c=>{c&&this.view.state.field(this.stateField,!1)==e&&this.addInfoPane(c,l)}).catch(c=>ci(this.view.state,c,"completion info")):(this.addInfoPane(a,l),i.setAttribute("aria-describedby",this.info.id))}}addInfoPane(e,t){this.destroyInfo();let i=this.info=document.createElement("div");if(i.className="cm-tooltip cm-completionInfo",i.id="cm-completionInfo-"+Math.floor(Math.random()*65535).toString(16),e.nodeType!=null)i.appendChild(e),this.infoDestroy=null;else{let{dom:l,destroy:o}=e;i.appendChild(l),this.infoDestroy=o||null}this.dom.appendChild(i),this.view.requestMeasure(this.placeInfoReq)}updateSelectedOption(e){let t=null;for(let i=this.list.firstChild,l=this.range.from;i;i=i.nextSibling,l++)i.nodeName!="LI"||!i.id?l--:l==e?i.hasAttribute("aria-selected")||(i.setAttribute("aria-selected","true"),t=i):i.hasAttribute("aria-selected")&&(i.removeAttribute("aria-selected"),i.removeAttribute("aria-describedby"));return t&&K6(this.list,t),t}measureInfo(){let e=this.dom.querySelector("[aria-selected]");if(!e||!this.info)return null;let t=this.dom.getBoundingClientRect(),i=this.info.getBoundingClientRect(),l=e.getBoundingClientRect(),o=this.space;if(!o){let a=this.dom.ownerDocument.documentElement;o={left:0,top:0,right:a.clientWidth,bottom:a.clientHeight}}return l.top>Math.min(o.bottom,t.bottom)-10||l.bottom{a.target==l&&a.preventDefault()});let o=null;for(let a=i.from;ai.from||i.from==0))if(o=b,typeof d!="string"&&d.header)l.appendChild(d.header(d));else{let v=l.appendChild(document.createElement("completion-section"));v.textContent=b}}const p=l.appendChild(document.createElement("li"));p.id=t+"-"+a,p.setAttribute("role","option");let g=this.optionClass(c);g&&(p.className=g);for(let b of this.optionContent){let v=b(c,this.view.state,this.view,f);v&&p.appendChild(v)}}return i.from&&l.classList.add("cm-completionListIncompleteTop"),i.tonew G6(t,n,e)}function K6(n,e){let t=n.getBoundingClientRect(),i=e.getBoundingClientRect(),l=t.height/n.offsetHeight;i.topt.bottom&&(n.scrollTop+=(i.bottom-t.bottom)/l)}function y2(n){return(n.boost||0)*100+(n.apply?10:0)+(n.info?5:0)+(n.type?1:0)}function W6(n,e){let t=[],i=null,l=null,o=p=>{t.push(p);let{section:g}=p.completion;if(g){i||(i=[]);let b=typeof g=="string"?g:g.name;i.some(v=>v.name==b)||i.push(typeof g=="string"?{name:b}:g)}},a=e.facet(xn);for(let p of n)if(p.hasResult()){let g=p.result.getMatch;if(p.result.filter===!1)for(let b of p.result.options)o(new m2(b,p.source,g?g(b):[],1e9-t.length));else{let b=e.sliceDoc(p.from,p.to),v,w=a.filterStrict?new Q6(b):new V6(b);for(let S of p.result.options)if(v=w.match(S.label)){let C=S.displayLabel?g?g(S,v.matched):[]:v.matched,O=v.score+(S.boost||0);if(o(new m2(S,p.source,C,O)),typeof S.section=="object"&&S.section.rank==="dynamic"){let{name:j}=S.section;l||(l=Object.create(null)),l[j]=Math.max(O,l[j]||-1e9)}}}}if(i){let p=Object.create(null),g=0,b=(v,w)=>(v.rank==="dynamic"&&w.rank==="dynamic"?l[w.name]-l[v.name]:0)||(typeof v.rank=="number"?v.rank:1e9)-(typeof w.rank=="number"?w.rank:1e9)||(v.nameb.score-g.score||d(g.completion,b.completion))){let g=p.completion;!f||f.label!=g.label||f.detail!=g.detail||f.type!=null&&g.type!=null&&f.type!=g.type||f.apply!=g.apply||f.boost!=g.boost?c.push(p):y2(p.completion)>y2(f)&&(c[c.length-1]=p),f=p.completion}return c}class da{constructor(e,t,i,l,o,a){this.options=e,this.attrs=t,this.tooltip=i,this.timestamp=l,this.selected=o,this.disabled=a}setSelected(e,t){return e==this.selected||e>=this.options.length?this:new da(this.options,b2(t,e),this.tooltip,this.timestamp,e,this.disabled)}static build(e,t,i,l,o,a){if(l&&!a&&e.some(d=>d.isPending))return l.setDisabled();let c=W6(e,t);if(!c.length)return l&&e.some(d=>d.isPending)?l.setDisabled():null;let f=t.facet(xn).selectOnOpen?0:-1;if(l&&l.selected!=f&&l.selected!=-1){let d=l.options[l.selected].completion;for(let p=0;pp.hasResult()?Math.min(d,p.from):d,1e8),create:iB,above:o.aboveCursor},l?l.timestamp:Date.now(),f,!1)}map(e){return new da(this.options,this.attrs,{...this.tooltip,pos:e.mapPos(this.tooltip.pos)},this.timestamp,this.selected,this.disabled)}setDisabled(){return new da(this.options,this.attrs,this.tooltip,this.timestamp,this.selected,!0)}}class jd{constructor(e,t,i){this.active=e,this.id=t,this.open=i}static start(){return new jd(tB,"cm-ac-"+Math.floor(Math.random()*2e6).toString(36),null)}update(e){let{state:t}=e,i=t.facet(xn),o=(i.override||t.languageDataAt("autocomplete",to(t)).map(q6)).map(f=>(this.active.find(p=>p.source==f)||new Hi(f,this.active.some(p=>p.state!=0)?1:0)).update(e,i));o.length==this.active.length&&o.every((f,d)=>f==this.active[d])&&(o=this.active);let a=this.open,c=e.effects.some(f=>f.is(Gy));a&&e.docChanged&&(a=a.map(e.changes)),e.selection||o.some(f=>f.hasResult()&&e.changes.touchesRange(f.from,f.to))||!Z6(o,this.active)||c?a=da.build(o,t,this.id,a,i,c):a&&a.disabled&&!o.some(f=>f.isPending)&&(a=null),!a&&o.every(f=>!f.isPending)&&o.some(f=>f.hasResult())&&(o=o.map(f=>f.hasResult()?new Hi(f.source,0):f));for(let f of e.effects)f.is($y)&&(a=a&&a.setSelected(f.value,this.id));return o==this.active&&a==this.open?this:new jd(o,this.id,a)}get tooltip(){return this.open?this.open.tooltip:null}get attrs(){return this.open?this.open.attrs:this.active.length?J6:eB}}function Z6(n,e){if(n==e)return!0;for(let t=0,i=0;;){for(;t-1&&(t["aria-activedescendant"]=n+"-"+e),t}const tB=[];function KT(n,e){if(n.isUserEvent("input.complete")){let i=n.annotation(YT);if(i&&e.activateOnCompletion(i))return 12}let t=n.isUserEvent("input.type");return t&&e.activateOnTyping?5:t?1:n.isUserEvent("delete.backward")?2:n.selection?8:n.docChanged?16:0}class Hi{constructor(e,t,i=!1){this.source=e,this.state=t,this.explicit=i}hasResult(){return!1}get isPending(){return this.state==1}update(e,t){let i=KT(e,t),l=this;(i&8||i&16&&this.touches(e))&&(l=new Hi(l.source,0)),i&4&&l.state==0&&(l=new Hi(this.source,1)),l=l.updateFor(e,i);for(let o of e.effects)if(o.is(Rd))l=new Hi(l.source,1,o.value);else if(o.is(xc))l=new Hi(l.source,0);else if(o.is(Gy))for(let a of o.value)a.source==l.source&&(l=a);return l}updateFor(e,t){return this.map(e.changes)}map(e){return this}touches(e){return e.changes.touchesRange(to(e.state))}}class va extends Hi{constructor(e,t,i,l,o,a){super(e,3,t),this.limit=i,this.result=l,this.from=o,this.to=a}hasResult(){return!0}updateFor(e,t){var i;if(!(t&3))return this.map(e.changes);let l=this.result;l.map&&!e.changes.empty&&(l=l.map(l,e.changes));let o=e.changes.mapPos(this.from),a=e.changes.mapPos(this.to,1),c=to(e.state);if(c>a||!l||t&2&&(to(e.startState)==this.from||ct.map(e))}}),ai=Pn.define({create(){return jd.start()},update(n,e){return n.update(e)},provide:n=>[Ry.from(n,e=>e.tooltip),Oe.contentAttributes.from(n,e=>e.attrs)]});function Yy(n,e){const t=e.completion.apply||e.completion.label;let i=n.state.field(ai).active.find(l=>l.source==e.source);return i instanceof va?(typeof t=="string"?n.dispatch({...F6(n.state,t,i.from,i.to),annotations:YT.of(e.completion)}):t(n,e.completion,i.from,i.to),!0):!1}const iB=Y6(ai,Yy);function jh(n,e="option"){return t=>{let i=t.state.field(ai,!1);if(!i||!i.open||i.open.disabled||Date.now()-i.open.timestamp-1?i.open.selected+l*(n?1:-1):n?0:a-1;return c<0?c=e=="page"?0:a-1:c>=a&&(c=e=="page"?a-1:0),t.dispatch({effects:$y.of(c)}),!0}}const rB=n=>{let e=n.state.field(ai,!1);return n.state.readOnly||!e||!e.open||e.open.selected<0||e.open.disabled||Date.now()-e.open.timestampn.state.field(ai,!1)?(n.dispatch({effects:Rd.of(!0)}),!0):!1,lB=n=>{let e=n.state.field(ai,!1);return!e||!e.active.some(t=>t.state!=0)?!1:(n.dispatch({effects:xc.of(null)}),!0)};class sB{constructor(e,t){this.active=e,this.context=t,this.time=Date.now(),this.updates=[],this.done=void 0}}const oB=50,aB=1e3,uB=en.fromClass(class{constructor(n){this.view=n,this.debounceUpdate=-1,this.running=[],this.debounceAccept=-1,this.pendingStart=!1,this.composing=0;for(let e of n.state.field(ai).active)e.isPending&&this.startQuery(e)}update(n){let e=n.state.field(ai),t=n.state.facet(xn);if(!n.selectionSet&&!n.docChanged&&n.startState.field(ai)==e)return;let i=n.transactions.some(o=>{let a=KT(o,t);return a&8||(o.selection||o.docChanged)&&!(a&3)});for(let o=0;ooB&&Date.now()-a.time>aB){for(let c of a.context.abortListeners)try{c()}catch(f){ci(this.view.state,f)}a.context.abortListeners=null,this.running.splice(o--,1)}else a.updates.push(...n.transactions)}this.debounceUpdate>-1&&clearTimeout(this.debounceUpdate),n.transactions.some(o=>o.effects.some(a=>a.is(Rd)))&&(this.pendingStart=!0);let l=this.pendingStart?50:t.activateOnTypingDelay;if(this.debounceUpdate=e.active.some(o=>o.isPending&&!this.running.some(a=>a.active.source==o.source))?setTimeout(()=>this.startUpdate(),l):-1,this.composing!=0)for(let o of n.transactions)o.isUserEvent("input.type")?this.composing=2:this.composing==2&&o.selection&&(this.composing=3)}startUpdate(){this.debounceUpdate=-1,this.pendingStart=!1;let{state:n}=this.view,e=n.field(ai);for(let t of e.active)t.isPending&&!this.running.some(i=>i.active.source==t.source)&&this.startQuery(t);this.running.length&&e.open&&e.open.disabled&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(xn).updateSyncTime))}startQuery(n){let{state:e}=this.view,t=to(e),i=new $T(e,t,n.explicit,this.view),l=new sB(n,i);this.running.push(l),Promise.resolve(n.source(i)).then(o=>{l.context.aborted||(l.done=o||null,this.scheduleAccept())},o=>{this.view.dispatch({effects:xc.of(null)}),ci(this.view.state,o)})}scheduleAccept(){this.running.every(n=>n.done!==void 0)?this.accept():this.debounceAccept<0&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(xn).updateSyncTime))}accept(){var n;this.debounceAccept>-1&&clearTimeout(this.debounceAccept),this.debounceAccept=-1;let e=[],t=this.view.state.facet(xn),i=this.view.state.field(ai);for(let l=0;lc.source==o.active.source);if(a&&a.isPending)if(o.done==null){let c=new Hi(o.active.source,0);for(let f of o.updates)c=c.update(f,t);c.isPending||e.push(c)}else this.startQuery(a)}(e.length||i.open&&i.open.disabled)&&this.view.dispatch({effects:Gy.of(e)})}},{eventHandlers:{blur(n){let e=this.view.state.field(ai,!1);if(e&&e.tooltip&&this.view.state.facet(xn).closeOnBlur){let t=e.open&&DN(this.view,e.open.tooltip);(!t||!t.dom.contains(n.relatedTarget))&&setTimeout(()=>this.view.dispatch({effects:xc.of(null)}),10)}},compositionstart(){this.composing=1},compositionend(){this.composing==3&&setTimeout(()=>this.view.dispatch({effects:Rd.of(!1)}),20),this.composing=0}}}),cB=typeof navigator=="object"&&/Win/.test(navigator.platform),fB=oo.highest(Oe.domEventHandlers({keydown(n,e){let t=e.state.field(ai,!1);if(!t||!t.open||t.open.disabled||t.open.selected<0||!n.key||n.key.length>1||n.ctrlKey&&!(cB&&n.altKey)||n.metaKey)return!1;let i=t.open.options[t.open.selected],l=t.active.find(a=>a.source==i.source),o=i.completion.commitCharacters||l.result.commitCharacters;return o&&o.indexOf(n.key)>-1&&Yy(e,i),!1}})),hB=Oe.baseTheme({".cm-tooltip.cm-tooltip-autocomplete":{"& > ul":{fontFamily:"monospace",whiteSpace:"nowrap",overflow:"hidden auto",maxWidth_fallback:"700px",maxWidth:"min(700px, 95vw)",minWidth:"250px",maxHeight:"10em",height:"100%",listStyle:"none",margin:0,padding:0,"& > li, & > completion-section":{padding:"1px 3px",lineHeight:1.2},"& > li":{overflowX:"hidden",textOverflow:"ellipsis",cursor:"pointer"},"& > completion-section":{display:"list-item",borderBottom:"1px solid silver",paddingLeft:"0.5em",opacity:.7}}},"&light .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#17c",color:"white"},"&light .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#777"},"&dark .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#347",color:"white"},"&dark .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#444"},".cm-completionListIncompleteTop:before, .cm-completionListIncompleteBottom:after":{content:'"···"',opacity:.5,display:"block",textAlign:"center",cursor:"pointer"},".cm-tooltip.cm-completionInfo":{position:"absolute",padding:"3px 9px",width:"max-content",maxWidth:"400px",boxSizing:"border-box",whiteSpace:"pre-line"},".cm-completionInfo.cm-completionInfo-left":{right:"100%"},".cm-completionInfo.cm-completionInfo-right":{left:"100%"},".cm-completionInfo.cm-completionInfo-left-narrow":{right:"30px"},".cm-completionInfo.cm-completionInfo-right-narrow":{left:"30px"},"&light .cm-snippetField":{backgroundColor:"#00000022"},"&dark .cm-snippetField":{backgroundColor:"#ffffff22"},".cm-snippetFieldPosition":{verticalAlign:"text-top",width:0,height:"1.15em",display:"inline-block",margin:"0 -0.7px -.7em",borderLeft:"1.4px dotted #888"},".cm-completionMatchedText":{textDecoration:"underline"},".cm-completionDetail":{marginLeft:"0.5em",fontStyle:"italic"},".cm-completionIcon":{fontSize:"90%",width:".8em",display:"inline-block",textAlign:"center",paddingRight:".6em",opacity:"0.6",boxSizing:"content-box"},".cm-completionIcon-function, .cm-completionIcon-method":{"&:after":{content:"'ƒ'"}},".cm-completionIcon-class":{"&:after":{content:"'○'"}},".cm-completionIcon-interface":{"&:after":{content:"'◌'"}},".cm-completionIcon-variable":{"&:after":{content:"'𝑥'"}},".cm-completionIcon-constant":{"&:after":{content:"'𝐶'"}},".cm-completionIcon-type":{"&:after":{content:"'𝑡'"}},".cm-completionIcon-enum":{"&:after":{content:"'∪'"}},".cm-completionIcon-property":{"&:after":{content:"'□'"}},".cm-completionIcon-keyword":{"&:after":{content:"'🔑︎'"}},".cm-completionIcon-namespace":{"&:after":{content:"'▢'"}},".cm-completionIcon-text":{"&:after":{content:"'abc'",fontSize:"50%",verticalAlign:"middle"}}}),yc={brackets:["(","[","{","'",'"'],before:")]}:;>",stringPrefixes:[]},Ws=Ye.define({map(n,e){let t=e.mapPos(n,-1,Yn.TrackAfter);return t??void 0}}),Ky=new class extends es{};Ky.startSide=1;Ky.endSide=-1;const WT=Pn.define({create(){return rt.empty},update(n,e){if(n=n.map(e.changes),e.selection){let t=e.state.doc.lineAt(e.selection.main.head);n=n.update({filter:i=>i>=t.from&&i<=t.to})}for(let t of e.effects)t.is(Ws)&&(n=n.update({add:[Ky.range(t.value,t.value+1)]}));return n}});function dB(){return[mB,WT]}const k0="()[]{}<>«»»«[]{}";function ZT(n){for(let e=0;e{if((pB?n.composing:n.compositionStarted)||n.state.readOnly)return!1;let l=n.state.selection.main;if(i.length>2||i.length==2&&Nr(oi(i,0))==1||e!=l.from||t!=l.to)return!1;let o=yB(n.state,i);return o?(n.dispatch(o),!0):!1}),gB=({state:n,dispatch:e})=>{if(n.readOnly)return!1;let i=JT(n,n.selection.main.head).brackets||yc.brackets,l=null,o=n.changeByRange(a=>{if(a.empty){let c=bB(n.doc,a.head);for(let f of i)if(f==c&&ap(n.doc,a.head)==ZT(oi(f,0)))return{changes:{from:a.head-f.length,to:a.head+f.length},range:oe.cursor(a.head-f.length)}}return{range:l=a}});return l||e(n.update(o,{scrollIntoView:!0,userEvent:"delete.backward"})),!l},xB=[{key:"Backspace",run:gB}];function yB(n,e){let t=JT(n,n.selection.main.head),i=t.brackets||yc.brackets;for(let l of i){let o=ZT(oi(l,0));if(e==l)return o==l?kB(n,l,i.indexOf(l+l+l)>-1,t):vB(n,l,o,t.before||yc.before);if(e==o&&eA(n,n.selection.main.from))return wB(n,l,o)}return null}function eA(n,e){let t=!1;return n.field(WT).between(0,n.doc.length,i=>{i==e&&(t=!0)}),t}function ap(n,e){let t=n.sliceString(e,e+2);return t.slice(0,Nr(oi(t,0)))}function bB(n,e){let t=n.sliceString(e-2,e);return Nr(oi(t,0))==t.length?t:t.slice(1)}function vB(n,e,t,i){let l=null,o=n.changeByRange(a=>{if(!a.empty)return{changes:[{insert:e,from:a.from},{insert:t,from:a.to}],effects:Ws.of(a.to+e.length),range:oe.range(a.anchor+e.length,a.head+e.length)};let c=ap(n.doc,a.head);return!c||/\s/.test(c)||i.indexOf(c)>-1?{changes:{insert:e+t,from:a.head},effects:Ws.of(a.head+e.length),range:oe.cursor(a.head+e.length)}:{range:l=a}});return l?null:n.update(o,{scrollIntoView:!0,userEvent:"input.type"})}function wB(n,e,t){let i=null,l=n.changeByRange(o=>o.empty&&ap(n.doc,o.head)==t?{changes:{from:o.head,to:o.head+t.length,insert:t},range:oe.cursor(o.head+t.length)}:i={range:o});return i?null:n.update(l,{scrollIntoView:!0,userEvent:"input.type"})}function kB(n,e,t,i){let l=i.stringPrefixes||yc.stringPrefixes,o=null,a=n.changeByRange(c=>{if(!c.empty)return{changes:[{insert:e,from:c.from},{insert:e,from:c.to}],effects:Ws.of(c.to+e.length),range:oe.range(c.anchor+e.length,c.head+e.length)};let f=c.head,d=ap(n.doc,f),p;if(d==e){if(v2(n,f))return{changes:{insert:e+e,from:f},effects:Ws.of(f+e.length),range:oe.cursor(f+e.length)};if(eA(n,f)){let b=t&&n.sliceDoc(f,f+e.length*3)==e+e+e?e+e+e:e;return{changes:{from:f,to:f+b.length,insert:b},range:oe.cursor(f+b.length)}}}else{if(t&&n.sliceDoc(f-2*e.length,f)==e+e&&(p=w2(n,f-2*e.length,l))>-1&&v2(n,p))return{changes:{insert:e+e+e+e,from:f},effects:Ws.of(f+e.length),range:oe.cursor(f+e.length)};if(n.charCategorizer(f)(d)!=Ut.Word&&w2(n,f,l)>-1&&!SB(n,f,e,l))return{changes:{insert:e+e,from:f},effects:Ws.of(f+e.length),range:oe.cursor(f+e.length)}}return{range:o=c}});return o?null:n.update(a,{scrollIntoView:!0,userEvent:"input.type"})}function v2(n,e){let t=Bn(n).resolveInner(e+1);return t.parent&&t.from==e}function SB(n,e,t,i){let l=Bn(n).resolveInner(e,-1),o=i.reduce((a,c)=>Math.max(a,c.length),0);for(let a=0;a<5;a++){let c=n.sliceDoc(l.from,Math.min(l.to,l.from+t.length+o)),f=c.indexOf(t);if(!f||f>-1&&i.indexOf(c.slice(0,f))>-1){let p=l.firstChild;for(;p&&p.from==l.from&&p.to-p.from>t.length+f;){if(n.sliceDoc(p.to-t.length,p.to)==t)return!1;p=p.firstChild}return!0}let d=l.to==e&&l.parent;if(!d)break;l=d}return!1}function w2(n,e,t){let i=n.charCategorizer(e);if(i(n.sliceDoc(e-1,e))!=Ut.Word)return e;for(let l of t){let o=e-l.length;if(n.sliceDoc(o,e)==l&&i(n.sliceDoc(o-1,o))!=Ut.Word)return o}return-1}function CB(n={}){return[fB,ai,xn.of(n),uB,OB,hB]}const tA=[{key:"Ctrl-Space",run:w0},{mac:"Alt-`",run:w0},{mac:"Alt-i",run:w0},{key:"Escape",run:lB},{key:"ArrowDown",run:jh(!0)},{key:"ArrowUp",run:jh(!1)},{key:"PageDown",run:jh(!0,"page")},{key:"PageUp",run:jh(!1,"page")},{key:"Enter",run:rB}],OB=oo.highest(My.computeN([xn],n=>n.facet(xn).defaultKeymap?[tA]:[]));class k2{constructor(e,t,i){this.from=e,this.to=t,this.diagnostic=i}}class Gs{constructor(e,t,i){this.diagnostics=e,this.panel=t,this.selected=i}static init(e,t,i){let l=i.facet(bc).markerFilter;l&&(e=l(e,i));let o=e.slice().sort((v,w)=>v.from-w.from||v.to-w.to),a=new Rr,c=[],f=0,d=i.doc.iter(),p=0,g=i.doc.length;for(let v=0;;){let w=v==o.length?null:o[v];if(!w&&!c.length)break;let S,C;if(c.length)S=f,C=c.reduce((M,H)=>Math.min(M,H.to),w&&w.from>S?w.from:1e8);else{if(S=w.from,S>g)break;C=w.to,c.push(w),v++}for(;vM.from||M.to==S))c.push(M),v++,C=Math.min(M.to,C);else{C=Math.min(M.from,C);break}}C=Math.min(C,g);let O=!1;if(c.some(M=>M.from==S&&(M.to==C||C==g))&&(O=S==C,!O&&C-S<10)){let M=S-(p+d.value.length);M>0&&(d.next(M),p=S);for(let H=S;;){if(H>=C){O=!0;break}if(!d.lineBreak&&p+d.value.length>H)break;H=p+d.value.length,p+=d.value.length,d.next()}}let j=PB(c);if(O)a.add(S,S,Ie.widget({widget:new _B(j),diagnostics:c.slice()}));else{let M=c.reduce((H,P)=>P.markClass?H+" "+P.markClass:H,"");a.add(S,C,Ie.mark({class:"cm-lintRange cm-lintRange-"+j+M,diagnostics:c.slice(),inclusiveEnd:c.some(H=>H.to>C)}))}if(f=C,f==g)break;for(let M=0;M{if(!(e&&a.diagnostics.indexOf(e)<0))if(!i)i=new k2(l,o,e||a.diagnostics[0]);else{if(a.diagnostics.indexOf(i.diagnostic)<0)return!1;i=new k2(i.from,o,i.diagnostic)}}),i}function NB(n,e){let t=e.pos,i=e.end||t,l=n.state.facet(bc).hideOn(n,t,i);if(l!=null)return l;let o=n.startState.doc.lineAt(e.pos);return!!(n.effects.some(a=>a.is(nA))||n.changes.touchesRange(o.from,Math.max(o.to,i)))}function TB(n,e){return n.field(Ni,!1)?e:e.concat(Ye.appendConfig.of(HB))}const nA=Ye.define(),Wy=Ye.define(),iA=Ye.define(),Ni=Pn.define({create(){return new Gs(Ie.none,null,null)},update(n,e){if(e.docChanged&&n.diagnostics.size){let t=n.diagnostics.map(e.changes),i=null,l=n.panel;if(n.selected){let o=e.changes.mapPos(n.selected.from,1);i=ss(t,n.selected.diagnostic,o)||ss(t,null,o)}!t.size&&l&&e.state.facet(bc).autoPanel&&(l=null),n=new Gs(t,l,i)}for(let t of e.effects)if(t.is(nA)){let i=e.state.facet(bc).autoPanel?t.value.length?vc.open:null:n.panel;n=Gs.init(t.value,i,e.state)}else t.is(Wy)?n=new Gs(n.diagnostics,t.value?vc.open:null,n.selected):t.is(iA)&&(n=new Gs(n.diagnostics,n.panel,t.value));return n},provide:n=>[hc.from(n,e=>e.panel),Oe.decorations.from(n,e=>e.diagnostics)]}),AB=Ie.mark({class:"cm-lintRange cm-lintRange-active"});function EB(n,e,t){let{diagnostics:i}=n.state.field(Ni),l,o=-1,a=-1;i.between(e-(t<0?1:0),e+(t>0?1:0),(f,d,{spec:p})=>{if(e>=f&&e<=d&&(f==d||(e>f||t>0)&&(elA(n,t,!1)))}const DB=n=>{let e=n.state.field(Ni,!1);(!e||!e.panel)&&n.dispatch({effects:TB(n.state,[Wy.of(!0)])});let t=ep(n,vc.open);return t&&t.dom.querySelector(".cm-panel-lint ul").focus(),!0},S2=n=>{let e=n.state.field(Ni,!1);return!e||!e.panel?!1:(n.dispatch({effects:Wy.of(!1)}),!0)},RB=n=>{let e=n.state.field(Ni,!1);if(!e)return!1;let t=n.state.selection.main,i=ss(e.diagnostics,null,t.to+1);return!i&&(i=ss(e.diagnostics,null,0),!i||i.from==t.from&&i.to==t.to)?!1:(n.dispatch({selection:{anchor:i.from,head:i.to},scrollIntoView:!0}),N_(n,i.from,1,{tooltip:sA,until:l=>l.docChanged||l.newSelection.main.headi.to}),!0)},jB=[{key:"Mod-Shift-m",run:DB,preventDefault:!0},{key:"F8",run:RB}],bc=Ce.define({combine(n){return{sources:n.map(e=>e.source).filter(e=>e!=null),...jr(n.map(e=>e.config),{delay:750,markerFilter:null,tooltipFilter:null,needsRefresh:null,hideOn:()=>null},{delay:Math.max,markerFilter:C2,tooltipFilter:C2,needsRefresh:(e,t)=>e?t?i=>e(i)||t(i):e:t,hideOn:(e,t)=>e?t?(i,l,o)=>e(i,l,o)||t(i,l,o):e:t,autoPanel:(e,t)=>e||t})}}});function C2(n,e){return n?e?(t,i)=>e(n(t,i),i):n:e}function rA(n){let e=[];if(n)e:for(let{name:t}of n){for(let i=0;io.toLowerCase()==l.toLowerCase())){e.push(l);continue e}}e.push("")}return e}function lA(n,e,t){var i;let l=t?rA(e.actions):[];return Tt("li",{class:"cm-diagnostic cm-diagnostic-"+e.severity},Tt("span",{class:"cm-diagnosticText"},e.renderMessage?e.renderMessage(n):e.message),(i=e.actions)===null||i===void 0?void 0:i.map((o,a)=>{let c=!1,f=v=>{if(v.preventDefault(),c)return;c=!0;let w=ss(n.state.field(Ni).diagnostics,e);w&&o.apply(n,w.from,w.to)},{name:d}=o,p=l[a]?d.indexOf(l[a]):-1,g=p<0?d:[d.slice(0,p),Tt("u",d.slice(p,p+1)),d.slice(p+1)],b=o.markClass?" "+o.markClass:"";return Tt("button",{type:"button",class:"cm-diagnosticAction"+b,onclick:f,onmousedown:f,"aria-label":` Action: ${d}${p<0?"":` (access key "${l[a]})"`}.`},g)}),e.source&&Tt("div",{class:"cm-diagnosticSource"},e.source))}class _B extends ul{constructor(e){super(),this.sev=e}eq(e){return e.sev==this.sev}toDOM(){return Tt("span",{class:"cm-lintPoint cm-lintPoint-"+this.sev})}}class O2{constructor(e,t){this.diagnostic=t,this.id="item_"+Math.floor(Math.random()*4294967295).toString(16),this.dom=lA(e,t,!0),this.dom.id=this.id,this.dom.setAttribute("role","option")}}class vc{constructor(e){this.view=e,this.items=[];let t=l=>{if(!(l.ctrlKey||l.altKey||l.metaKey)){if(l.keyCode==27)S2(this.view),this.view.focus();else if(l.keyCode==38||l.keyCode==33)this.moveSelection((this.selectedIndex-1+this.items.length)%this.items.length);else if(l.keyCode==40||l.keyCode==34)this.moveSelection((this.selectedIndex+1)%this.items.length);else if(l.keyCode==36)this.moveSelection(0);else if(l.keyCode==35)this.moveSelection(this.items.length-1);else if(l.keyCode==13)this.view.focus();else if(l.keyCode>=65&&l.keyCode<=90&&this.selectedIndex>=0){let{diagnostic:o}=this.items[this.selectedIndex],a=rA(o.actions);for(let c=0;c{for(let o=0;oS2(this.view)},"×")),this.update()}get selectedIndex(){let e=this.view.state.field(Ni).selected;if(!e)return-1;for(let t=0;t{for(let p of d.diagnostics){if(a.has(p))continue;a.add(p);let g=-1,b;for(let v=i;vi&&(this.items.splice(i,g-i),l=!0)),t&&b.diagnostic==t.diagnostic?b.dom.hasAttribute("aria-selected")||(b.dom.setAttribute("aria-selected","true"),o=b):b.dom.hasAttribute("aria-selected")&&b.dom.removeAttribute("aria-selected"),i++}});i({sel:o.dom.getBoundingClientRect(),panel:this.list.getBoundingClientRect()}),write:({sel:c,panel:f})=>{let d=f.height/this.list.offsetHeight;c.topf.bottom&&(this.list.scrollTop+=(c.bottom-f.bottom)/d)}})):this.selectedIndex<0&&this.list.removeAttribute("aria-activedescendant"),l&&this.sync()}sync(){let e=this.list.firstChild;function t(){let i=e;e=i.nextSibling,i.remove()}for(let i of this.items)if(i.dom.parentNode==this.list){for(;e!=i.dom;)t();e=i.dom.nextSibling}else this.list.insertBefore(i.dom,e);for(;e;)t()}moveSelection(e){if(this.selectedIndex<0)return;let t=this.view.state.field(Ni),i=ss(t.diagnostics,this.items[e].diagnostic);i&&this.view.dispatch({selection:{anchor:i.from,head:i.to},scrollIntoView:!0,effects:iA.of(i)})}static open(e){return new vc(e)}}function LB(n,e='viewBox="0 0 40 40"'){return`url('data:image/svg+xml,${encodeURIComponent(n)}')`}function _h(n){return LB(``,'width="6" height="3"')}const zB=Oe.baseTheme({".cm-diagnostic":{padding:"3px 6px 3px 8px",marginLeft:"-1px",display:"block",whiteSpace:"pre-wrap"},".cm-diagnostic-error":{borderLeft:"5px solid #d11"},".cm-diagnostic-warning":{borderLeft:"5px solid orange"},".cm-diagnostic-info":{borderLeft:"5px solid #999"},".cm-diagnostic-hint":{borderLeft:"5px solid #66d"},".cm-diagnosticAction":{font:"inherit",border:"none",padding:"2px 4px",backgroundColor:"#444",color:"white",borderRadius:"3px",marginLeft:"8px",cursor:"pointer"},".cm-diagnosticSource":{fontSize:"70%",opacity:.7},".cm-lintRange":{backgroundPosition:"left bottom",backgroundRepeat:"repeat-x",paddingBottom:"0.7px"},".cm-lintRange-error":{backgroundImage:_h("#f11")},".cm-lintRange-warning":{backgroundImage:_h("orange")},".cm-lintRange-info":{backgroundImage:_h("#999")},".cm-lintRange-hint":{backgroundImage:_h("#66d")},".cm-lintRange-active":{backgroundColor:"#ffdd9980"},".cm-tooltip-lint":{padding:0,margin:0},".cm-lintPoint":{position:"relative","&:after":{content:'""',position:"absolute",bottom:0,left:"-2px",borderLeft:"3px solid transparent",borderRight:"3px solid transparent",borderBottom:"4px solid #d11"}},".cm-lintPoint-warning":{"&:after":{borderBottomColor:"orange"}},".cm-lintPoint-info":{"&:after":{borderBottomColor:"#999"}},".cm-lintPoint-hint":{"&:after":{borderBottomColor:"#66d"}},".cm-panel.cm-panel-lint":{position:"relative","& ul":{maxHeight:"100px",overflowY:"auto","& [aria-selected]":{backgroundColor:"#ddd","& u":{textDecoration:"underline"}},"&:focus [aria-selected]":{background_fallback:"#bdf",backgroundColor:"Highlight",color_fallback:"white",color:"HighlightText"},"& u":{textDecoration:"none"},padding:0,margin:0},"& [name=close]":{position:"absolute",top:"0",right:"2px",background:"inherit",border:"none",font:"inherit",padding:0,margin:0}},"&dark .cm-lintRange-active":{backgroundColor:"#86714a80"},"&dark .cm-panel.cm-panel-lint ul":{"& [aria-selected]":{backgroundColor:"#2e343e"}}});function BB(n){return n=="error"?4:n=="warning"?3:n=="info"?2:1}function PB(n){let e="hint",t=1;for(let i of n){let l=BB(i.severity);l>t&&(t=l,e=i.severity)}return e}const sA=O_(EB,{hideOn:NB}),HB=[Ni,Oe.decorations.compute([Ni],n=>{let{selected:e,panel:t}=n.field(Ni);return!e||!t||e.from==e.to?Ie.none:Ie.set([AB.range(e.from,e.to)])}),sA,zB],IB=[I_(),q_(),n_(),sz(),RL(),Vj(),Kj(),mt.allowMultipleSelections.of(!0),yL(),_L(BL,{fallback:!0}),VL(),dB(),CB(),p_(),x_(),a_(),m6(),My.of([...xB,...c6,...z6,...mz,...AL,...tA,...jB])];var N2={};class _d{constructor(e,t,i,l,o,a,c,f,d,p=0,g){this.p=e,this.stack=t,this.state=i,this.reducePos=l,this.pos=o,this.score=a,this.buffer=c,this.bufferBase=f,this.curContext=d,this.lookAhead=p,this.parent=g}toString(){return`[${this.stack.filter((e,t)=>t%3==0).concat(this.state)}]@${this.pos}${this.score?"!"+this.score:""}`}static start(e,t,i=0){let l=e.parser.context;return new _d(e,[],t,i,i,0,[],0,l?new T2(l,l.start):null,0,null)}get context(){return this.curContext?this.curContext.context:null}pushState(e,t){this.stack.push(this.state,t,this.bufferBase+this.buffer.length),this.state=e}reduce(e){var t;let i=e>>19,l=e&65535,{parser:o}=this.p,a=this.reducePos=2e3&&!(!((t=this.p.parser.nodeSet.types[l])===null||t===void 0)&&t.isAnonymous)&&(d==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=p):this.p.lastBigReductionSizef;)this.stack.pop();this.reduceContext(l,d)}storeNode(e,t,i,l=4,o=!1){if(e==0&&(!this.stack.length||this.stack[this.stack.length-1]0&&this.buffer[a-4]==0&&this.buffer[a-1]>-1){if(t==i)return;if(this.buffer[a-2]>=t){this.buffer[a-2]=i;return}}}if(!o||this.pos==i)this.buffer.push(e,t,i,l);else{let a=this.buffer.length;if(a>0&&(this.buffer[a-4]!=0||this.buffer[a-1]<0)){let c=!1;for(let f=a;f>0&&this.buffer[f-2]>i;f-=4)if(this.buffer[f-1]>=0){c=!0;break}if(c)for(;a>0&&this.buffer[a-2]>i;)this.buffer[a]=this.buffer[a-4],this.buffer[a+1]=this.buffer[a-3],this.buffer[a+2]=this.buffer[a-2],this.buffer[a+3]=this.buffer[a-1],a-=4,l>4&&(l-=4)}this.buffer[a]=e,this.buffer[a+1]=t,this.buffer[a+2]=i,this.buffer[a+3]=l}}shift(e,t,i,l){if(e&131072)this.pushState(e&65535,this.pos);else if((e&262144)==0){let o=e,{parser:a}=this.p;this.pos=l;let c=a.stateFlag(o,1);!c&&(l>i||t<=a.maxNode)&&(this.reducePos=l),this.pushState(o,c?i:Math.min(i,this.reducePos)),this.shiftContext(t,i),t<=a.maxNode&&this.buffer.push(t,i,l,4)}else this.pos=l,this.shiftContext(t,i),t<=this.p.parser.maxNode&&this.buffer.push(t,i,l,4)}apply(e,t,i,l){e&65536?this.reduce(e):this.shift(e,t,i,l)}useNode(e,t,i){let l=this.p.reused.length-1;(l<0||this.p.reused[l]!=e)&&(this.p.reused.push(e),l++);let o=this.reducePos=this.pos=i+e.length;this.pushState(t,i),this.buffer.push(l,i,o,-1),this.curContext&&this.updateContext(this.curContext.tracker.reuse(this.curContext.context,e,this,this.p.stream.reset(this.pos-e.length)))}split(){let e=this,t=e.buffer.length;for(t&&e.buffer[t-4]==0&&(t-=4);t>0&&e.buffer[t-2]>e.reducePos;)t-=4;let i=e.buffer.slice(t),l=e.bufferBase+t;for(;e&&l==e.bufferBase;)e=e.parent;return new _d(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,i,l,this.curContext,this.lookAhead,e)}recoverByDelete(e,t){let i=e<=this.p.parser.maxNode;i&&this.storeNode(e,this.pos,t,4),this.storeNode(0,this.pos,t,i?8:4),this.pos=this.reducePos=t,this.score-=190}canShift(e){for(let t=new UB(this);;){let i=this.p.parser.stateSlot(t.state,4)||this.p.parser.hasAction(t.state,e);if(i==0)return!1;if((i&65536)==0)return!0;t.reduce(i)}}recoverByInsert(e){if(this.stack.length>=300)return[];let t=this.p.parser.nextStates(this.state);if(t.length>8||this.stack.length>=120){let l=[];for(let o=0,a;of&1&&c==a)||l.push(t[o],a)}t=l}let i=[];for(let l=0;l>19,l=t&65535,o=this.stack.length-i*3;if(o<0||e.getGoto(this.stack[o],l,!1)<0){let a=this.findForcedReduction();if(a==null)return!1;t=a}this.storeNode(0,this.pos,this.pos,4,!0),this.score-=100}return this.reducePos=this.pos,this.reduce(t),!0}findForcedReduction(){let{parser:e}=this.p,t=[],i=(l,o)=>{if(!t.includes(l))return t.push(l),e.allActions(l,a=>{if(!(a&393216))if(a&65536){let c=(a>>19)-o;if(c>1){let f=a&65535,d=this.stack.length-c*3;if(d>=0&&e.getGoto(this.stack[d],f,!1)>=0)return c<<19|65536|f}}else{let c=i(a,o+1);if(c!=null)return c}})};return i(this.state,0)}forceAll(){for(;!this.p.parser.stateFlag(this.state,2);)if(!this.forceReduce()){this.storeNode(0,this.pos,this.pos,4,!0);break}return this}get deadEnd(){if(this.stack.length!=3)return!1;let{parser:e}=this.p;return e.data[e.stateSlot(this.state,1)]==65535&&!e.stateSlot(this.state,4)}restart(){this.storeNode(0,this.pos,this.pos,4,!0),this.state=this.stack[0],this.stack.length=0}sameState(e){if(this.state!=e.state||this.stack.length!=e.stack.length)return!1;for(let t=0;t0&&this.emitLookAhead()}}class T2{constructor(e,t){this.tracker=e,this.context=t,this.hash=e.strict?e.hash(t):0}}class UB{constructor(e){this.start=e,this.state=e.state,this.stack=e.stack,this.base=this.stack.length}reduce(e){let t=e&65535,i=e>>19;i==0?(this.stack==this.start.stack&&(this.stack=this.stack.slice()),this.stack.push(this.state,0,0),this.base+=3):this.base-=(i-1)*3;let l=this.start.p.parser.getGoto(this.stack[this.base-3],t,!0);this.state=l}}class Ld{constructor(e,t,i){this.stack=e,this.pos=t,this.index=i,this.buffer=e.buffer,this.index==0&&this.maybeNext()}static create(e,t=e.bufferBase+e.buffer.length){return new Ld(e,t,t-e.bufferBase)}maybeNext(){let e=this.stack.parent;e!=null&&(this.index=this.stack.bufferBase-e.bufferBase,this.stack=e,this.buffer=e.buffer)}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}next(){this.index-=4,this.pos-=4,this.index==0&&this.maybeNext()}fork(){return new Ld(this.stack,this.pos,this.index)}}function Lh(n,e=Uint16Array){if(typeof n!="string")return n;let t=null;for(let i=0,l=0;i=92&&a--,a>=34&&a--;let f=a-32;if(f>=46&&(f-=46,c=!0),o+=f,c)break;o*=46}t?t[l++]=o:t=new e(o)}return t}class rd{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}}const A2=new rd;class FB{constructor(e,t){this.input=e,this.ranges=t,this.chunk="",this.chunkOff=0,this.chunk2="",this.chunk2Pos=0,this.next=-1,this.token=A2,this.rangeIndex=0,this.pos=this.chunkPos=t[0].from,this.range=t[0],this.end=t[t.length-1].to,this.readNext()}resolveOffset(e,t){let i=this.range,l=this.rangeIndex,o=this.pos+e;for(;oi.to:o>=i.to;){if(l==this.ranges.length-1)return null;let a=this.ranges[++l];o+=a.from-i.to,i=a}return o}clipPos(e){if(e>=this.range.from&&ee)return Math.max(e,t.from);return this.end}peek(e){let t=this.chunkOff+e,i,l;if(t>=0&&t=this.chunk2Pos&&ic.to&&(this.chunk2=this.chunk2.slice(0,c.to-i)),l=this.chunk2.charCodeAt(0)}}return i>=this.token.lookAhead&&(this.token.lookAhead=i+1),l}acceptToken(e,t=0){let i=t?this.resolveOffset(t,-1):this.pos;if(i==null||i=this.chunk2Pos&&this.posthis.range.to?e.slice(0,this.range.to-this.pos):e,this.chunkPos=this.pos,this.chunkOff=0}}readNext(){return this.chunkOff>=this.chunk.length&&(this.getChunk(),this.chunkOff==this.chunk.length)?this.next=-1:this.next=this.chunk.charCodeAt(this.chunkOff)}advance(e=1){for(this.chunkOff+=e;this.pos+e>=this.range.to;){if(this.rangeIndex==this.ranges.length-1)return this.setDone();e-=this.range.to-this.pos,this.range=this.ranges[++this.rangeIndex],this.pos=this.range.from}return this.pos+=e,this.pos>=this.token.lookAhead&&(this.token.lookAhead=this.pos+1),this.readNext()}setDone(){return this.pos=this.chunkPos=this.end,this.range=this.ranges[this.rangeIndex=this.ranges.length-1],this.chunk="",this.next=-1}reset(e,t){if(t?(this.token=t,t.start=e,t.lookAhead=e+1,t.value=t.extended=-1):this.token=A2,this.pos!=e){if(this.pos=e,e==this.end)return this.setDone(),this;for(;e=this.range.to;)this.range=this.ranges[++this.rangeIndex];e>=this.chunkPos&&e=this.chunkPos&&t<=this.chunkPos+this.chunk.length)return this.chunk.slice(e-this.chunkPos,t-this.chunkPos);if(e>=this.chunk2Pos&&t<=this.chunk2Pos+this.chunk2.length)return this.chunk2.slice(e-this.chunk2Pos,t-this.chunk2Pos);if(e>=this.range.from&&t<=this.range.to)return this.input.read(e,t);let i="";for(let l of this.ranges){if(l.from>=t)break;l.to>e&&(i+=this.input.read(Math.max(l.from,e),Math.min(l.to,t)))}return i}}class wa{constructor(e,t){this.data=e,this.id=t}token(e,t){let{parser:i}=t.p;qB(this.data,e,t,this.id,i.data,i.tokenPrecTable)}}wa.prototype.contextual=wa.prototype.fallback=wa.prototype.extend=!1;wa.prototype.fallback=wa.prototype.extend=!1;class up{constructor(e,t={}){this.token=e,this.contextual=!!t.contextual,this.fallback=!!t.fallback,this.extend=!!t.extend}}function qB(n,e,t,i,l,o){let a=0,c=1<0){let w=n[v];if(f.allows(w)&&(e.token.value==-1||e.token.value==w||VB(w,e.token.value,l,o))){e.acceptToken(w);break}}let p=e.next,g=0,b=n[a+2];if(e.next<0&&b>g&&n[d+b*3-3]==65535){a=n[d+b*3-1];continue e}for(;g>1,w=d+v+(v<<1),S=n[w],C=n[w+1]||65536;if(p=C)g=v+1;else{a=n[w+2],e.advance();continue e}}break}}function E2(n,e,t){for(let i=e,l;(l=n[i])!=65535;i++)if(l==t)return i-e;return-1}function VB(n,e,t,i){let l=E2(t,i,e);return l<0||E2(t,i,n)e)&&!i.type.isError)return t<0?Math.max(0,Math.min(i.to-1,e-25)):Math.min(n.length,Math.max(i.from+1,e+25));if(t<0?i.prevSibling():i.nextSibling())break;if(!i.parent())return t<0?0:n.length}}class QB{constructor(e,t){this.fragments=e,this.minRepeat=t,this.i=0,this.fragment=null,this.safeFrom=-1,this.safeTo=-1,this.trees=[],this.start=[],this.index=[],this.lastRepeat=null,this.lastRepeatPos=-1,this.nextFragment()}nextFragment(){let e=this.fragment=this.i==this.fragments.length?null:this.fragments[this.i++];if(e){for(this.safeFrom=e.openStart?M2(e.tree,e.from+e.offset,1)-e.offset:e.from,this.safeTo=e.openEnd?M2(e.tree,e.to+e.offset,-1)-e.offset:e.to;this.trees.length;)this.trees.pop(),this.start.pop(),this.index.pop();this.trees.push(e.tree),this.start.push(-e.offset),this.index.push(0),this.nextStart=this.safeFrom}else this.nextStart=1e9}nodeAt(e){if(ee)return this.nextStart=a,null;if(o instanceof an){let c=a>this.lastRepeatPos&&o.type.id>=this.minRepeat;if(a==e||c){let f=a+o.length,d;if(a>=this.safeFrom&&f<=this.safeTo&&(!(d=o.prop(tt.lookAhead))||f+d=Math.max(this.safeFrom,e)&&(this.trees.push(o),this.start.push(a),this.index.push(0))}else this.index[t]++,this.nextStart=a+o.length}}}class XB{constructor(e,t){this.stream=t,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=e.tokenizers.map(i=>new rd)}getActions(e){let t=0,i=null,{parser:l}=e.p,{tokenizers:o}=l,a=l.stateSlot(e.state,3),c=e.curContext?e.curContext.hash:0,f=0;for(let d=0;dg.end+25&&(f=Math.max(g.lookAhead,f)),g.value!=0)){let b=t;if(g.extended>-1&&(t=this.addActions(e,g.extended,g.end,t)),t=this.addActions(e,g.value,g.end,t),!p.extend&&(i=g,t>b))break}}for(;this.actions.length>t;)this.actions.pop();return f&&e.setLookAhead(f),!i&&e.pos==this.stream.end&&(i=new rd,i.value=e.p.parser.eofTerm,i.start=i.end=e.pos,t=this.addActions(e,i.value,i.end,t)),this.mainToken=i,this.actions}getMainToken(e){if(this.mainToken)return this.mainToken;let t=new rd,{pos:i,p:l}=e;return t.start=i,t.end=Math.min(i+1,l.stream.end),t.value=i==l.stream.end?l.parser.eofTerm:0,t}updateCachedToken(e,t,i){let l=this.stream.clipPos(i.pos);if(t.token(this.stream.reset(l,e),i),e.value>-1){let{parser:o}=i.p;for(let a=0;a=0&&i.p.parser.dialect.allows(c>>1)){(c&1)==0?e.value=c>>1:e.extended=c>>1;break}}}else e.value=0,e.end=this.stream.clipPos(l+1)}putAction(e,t,i,l){for(let o=0;oe.bufferLength*4?new QB(i,e.minRepeatTerm):null}get parsedPos(){return this.minStackPos}advance(){let e=this.stacks,t=this.minStackPos,i=this.stacks=[],l,o;if(this.bigReductionCount>300&&e.length==1){let[a]=e;for(;a.forceReduce()&&a.stack.length&&a.stack[a.stack.length-2]>=this.lastBigReductionStart;);this.bigReductionCount=this.lastBigReductionSize=0}for(let a=0;at)i.push(c);else{if(this.advanceStack(c,i,e))continue;{l||(l=[],o=[]),l.push(c);let f=this.tokens.getMainToken(c);o.push(f.value,f.end)}}break}}if(!i.length){let a=l&&KB(l);if(a)return Si&&console.log("Finish with "+this.stackID(a)),this.stackToTree(a);if(this.parser.strict)throw Si&&l&&console.log("Stuck with token "+(this.tokens.mainToken?this.parser.getName(this.tokens.mainToken.value):"none")),new SyntaxError("No parse at "+t);this.recovering||(this.recovering=5)}if(this.recovering&&l){let a=this.stoppedAt!=null&&l[0].pos>this.stoppedAt?l[0]:this.runRecovery(l,o,i);if(a)return Si&&console.log("Force-finish "+this.stackID(a)),this.stackToTree(a.forceAll())}if(this.recovering){let a=this.recovering==1?1:this.recovering*3;if(i.length>a)for(i.sort((c,f)=>f.score-c.score);i.length>a;)i.pop();i.some(c=>c.reducePos>t)&&this.recovering--}else if(i.length>1){e:for(let a=0;a500&&d.buffer.length>500)if((c.score-d.score||c.buffer.length-d.buffer.length)>0)i.splice(f--,1);else{i.splice(a--,1);continue e}}}i.length>12&&(i.sort((a,c)=>c.score-a.score),i.splice(12,i.length-12))}this.minStackPos=i[0].pos;for(let a=1;a-1&&i.length&&(!o||(i.prop(tt.contextHash)||0)==a))return e.useNode(i,c,t),i;if(i.children.length==0||i.positions[0]>0)break;let f=i.children[0];if(f instanceof an&&(!l||f.type.id>=this.parser.minRepeatTerm))i=f;else break}return null}advanceStack(e,t,i){let l=e.pos,{parser:o}=this,a=Si?this.stackID(e)+" -> ":"";if(this.stoppedAt!=null&&l>this.stoppedAt)return e.forceReduce()?e:null;if(this.fragments){let d=e.reducePos0)return e.reduce(c),Si&&console.log(a+this.stackID(e)+` (via always-reduce ${o.getName(c&65535)})`),!0;if(e.stack.length>=8400)for(;e.stack.length>6e3&&e.forceReduce(););let f=this.tokens.getActions(e);for(let d=0;dl?t.push(w):i.push(w)}return!1}advanceFully(e,t){let i=e.pos;for(;;){if(!this.advanceStack(e,null,null))return!1;if(e.pos>i)return D2(e,t),!0}}runRecovery(e,t,i){let l=null,o=!1;for(let a=0;a ":"";if(c.deadEnd&&(o||(o=!0,c.restart(),Si&&console.log(p+this.stackID(c)+" (restarted)"),this.advanceFully(c,i))))continue;let g=c.split(),b=p;for(let v=0;v<10&&g.forceReduce()&&(Si&&console.log(b+this.stackID(g)+" (via force-reduce)"),!this.advanceFully(g,i));v++)Si&&(b=this.stackID(g)+" -> ");for(let v of c.recoverByInsert(f))Si&&console.log(p+this.stackID(v)+" (via recover-insert)"),this.advanceFully(v,i);this.stream.end>c.pos?(d==c.pos&&(d++,f=0),c.recoverByDelete(f,d),Si&&console.log(p+this.stackID(c)+` (via recover-delete ${this.parser.getName(f)})`),D2(c,i)):(!l||l.scoren;class YB{constructor(e){this.start=e.start,this.shift=e.shift||C0,this.reduce=e.reduce||C0,this.reuse=e.reuse||C0,this.hash=e.hash||(()=>0),this.strict=e.strict!==!1}}class zd extends UN{constructor(e){if(super(),this.wrappers=[],e.version!=14)throw new RangeError(`Parser version (${e.version}) doesn't match runtime version (14)`);let t=e.nodeNames.split(" ");this.minRepeatTerm=t.length;for(let c=0;ce.topRules[c][1]),l=[];for(let c=0;c=0)o(p,f,c[d++]);else{let g=c[d+-p];for(let b=-p;b>0;b--)o(c[d++],f,g);d++}}}this.nodeSet=new jy(t.map((c,f)=>hi.define({name:f>=this.minRepeatTerm?void 0:c,id:f,props:l[f],top:i.indexOf(f)>-1,error:f==0,skipped:e.skippedNodes&&e.skippedNodes.indexOf(f)>-1}))),e.propSources&&(this.nodeSet=this.nodeSet.extend(...e.propSources)),this.strict=!1,this.bufferLength=BN;let a=Lh(e.tokenData);this.context=e.context,this.specializerSpecs=e.specialized||[],this.specialized=new Uint16Array(this.specializerSpecs.length);for(let c=0;ctypeof c=="number"?new wa(a,c):c),this.topRules=e.topRules,this.dialects=e.dialects||{},this.dynamicPrecedences=e.dynamicPrecedences||null,this.tokenPrecTable=e.tokenPrec,this.termNames=e.termNames||null,this.maxNode=this.nodeSet.types.length-1,this.dialect=this.parseDialect(),this.top=this.topRules[Object.keys(this.topRules)[0]]}createParse(e,t,i){let l=new $B(this,e,t,i);for(let o of this.wrappers)l=o(l,e,t,i);return l}getGoto(e,t,i=!1){let l=this.goto;if(t>=l[0])return-1;for(let o=l[t+1];;){let a=l[o++],c=a&1,f=l[o++];if(c&&i)return f;for(let d=o+(a>>1);o0}validAction(e,t){return!!this.allActions(e,i=>i==t?!0:null)}allActions(e,t){let i=this.stateSlot(e,4),l=i?t(i):void 0;for(let o=this.stateSlot(e,1);l==null;o+=3){if(this.data[o]==65535)if(this.data[o+1]==1)o=tl(this.data,o+2);else break;l=t(tl(this.data,o+1))}return l}nextStates(e){let t=[];for(let i=this.stateSlot(e,1);;i+=3){if(this.data[i]==65535)if(this.data[i+1]==1)i=tl(this.data,i+2);else break;if((this.data[i+2]&1)==0){let l=this.data[i+1];t.some((o,a)=>a&1&&o==l)||t.push(this.data[i],l)}}return t}configure(e){let t=Object.assign(Object.create(zd.prototype),this);if(e.props&&(t.nodeSet=this.nodeSet.extend(...e.props)),e.top){let i=this.topRules[e.top];if(!i)throw new RangeError(`Invalid top rule name ${e.top}`);t.top=i}return e.tokenizers&&(t.tokenizers=this.tokenizers.map(i=>{let l=e.tokenizers.find(o=>o.from==i);return l?l.to:i})),e.specializers&&(t.specializers=this.specializers.slice(),t.specializerSpecs=this.specializerSpecs.map((i,l)=>{let o=e.specializers.find(c=>c.from==i.external);if(!o)return i;let a=Object.assign(Object.assign({},i),{external:o.to});return t.specializers[l]=R2(a),a})),e.contextTracker&&(t.context=e.contextTracker),e.dialect&&(t.dialect=this.parseDialect(e.dialect)),e.strict!=null&&(t.strict=e.strict),e.wrap&&(t.wrappers=t.wrappers.concat(e.wrap)),e.bufferLength!=null&&(t.bufferLength=e.bufferLength),t}hasWrappers(){return this.wrappers.length>0}getName(e){return this.termNames?this.termNames[e]:String(e<=this.maxNode&&this.nodeSet.types[e].name||e)}get eofTerm(){return this.maxNode+1}get topNode(){return this.nodeSet.types[this.top[1]]}dynamicPrecedence(e){let t=this.dynamicPrecedences;return t==null?0:t[e]||0}parseDialect(e){let t=Object.keys(this.dialects),i=t.map(()=>!1);if(e)for(let o of e.split(" ")){let a=t.indexOf(o);a>=0&&(i[a]=!0)}let l=null;for(let o=0;oi)&&t.p.parser.stateFlag(t.state,2)&&(!e||e.scoren.external(t,i)<<1|e}return n.get}const sa=63,j2=64,WB=1,ZB=2,oA=3,JB=4,aA=5,e9=6,t9=7,uA=65,n9=66,i9=8,r9=9,l9=10,s9=11,o9=12,cA=13,a9=19,u9=20,c9=29,f9=33,h9=34,d9=47,p9=0,Zy=1,Xx=2,wc=3,$x=4;class Ys{constructor(e,t,i){this.parent=e,this.depth=t,this.type=i,this.hash=(e?e.hash+e.hash<<8:0)+t+(t<<4)+i}}Ys.top=new Ys(null,-1,p9);function nc(n,e){for(let t=0,i=e-n.pos-1;;i--,t++){let l=n.peek(i);if(ol(l)||l==-1)return t}}function Gx(n){return n==32||n==9}function ol(n){return n==10||n==13}function fA(n){return Gx(n)||ol(n)}function Zs(n){return n<0||fA(n)}const m9=new YB({start:Ys.top,reduce(n,e){return n.type==wc&&(e==u9||e==h9)?n.parent:n},shift(n,e,t,i){if(e==oA)return new Ys(n,nc(i,i.pos),Zy);if(e==uA||e==aA)return new Ys(n,nc(i,i.pos),Xx);if(e==sa)return n.parent;if(e==a9||e==f9)return new Ys(n,0,wc);if(e==cA&&n.type==$x)return n.parent;if(e==d9){let l=/[1-9]/.exec(i.read(i.pos,t.pos));if(l)return new Ys(n,n.depth+ +l[0],$x)}return n},hash(n){return n.hash}});function _a(n,e,t=0){return n.peek(t)==e&&n.peek(t+1)==e&&n.peek(t+2)==e&&Zs(n.peek(t+3))}const g9=new up((n,e)=>{if(n.next==-1&&e.canShift(j2))return n.acceptToken(j2);let t=n.peek(-1);if((ol(t)||t<0)&&e.context.type!=wc){if(_a(n,45))if(e.canShift(sa))n.acceptToken(sa);else return n.acceptToken(WB,3);if(_a(n,46))if(e.canShift(sa))n.acceptToken(sa);else return n.acceptToken(ZB,3);let i=0;for(;n.next==32;)i++,n.advance();(i{if(e.context.type==wc){n.next==63&&(n.advance(),Zs(n.next)&&n.acceptToken(t9));return}if(n.next==45)n.advance(),Zs(n.next)&&n.acceptToken(e.context.type==Zy&&e.context.depth==nc(n,n.pos-1)?JB:oA);else if(n.next==63)n.advance(),Zs(n.next)&&n.acceptToken(e.context.type==Xx&&e.context.depth==nc(n,n.pos-1)?e9:aA);else{let t=n.pos;for(;;)if(Gx(n.next)){if(n.pos==t)return;n.advance()}else if(n.next==33)hA(n);else if(n.next==38)Yx(n);else if(n.next==42){Yx(n);break}else if(n.next==39||n.next==34){if(Jy(n,!0))break;return}else if(n.next==91||n.next==123){if(!b9(n))return;break}else{dA(n,!0,!1,0);break}for(;Gx(n.next);)n.advance();if(n.next==58){if(n.pos==t&&e.canShift(c9))return;let i=n.peek(1);Zs(i)&&n.acceptTokenTo(e.context.type==Xx&&e.context.depth==nc(n,t)?n9:uA,t)}}},{contextual:!0});function y9(n){return n>32&&n<127&&n!=34&&n!=37&&n!=44&&n!=60&&n!=62&&n!=92&&n!=94&&n!=96&&n!=123&&n!=124&&n!=125}function _2(n){return n>=48&&n<=57||n>=97&&n<=102||n>=65&&n<=70}function L2(n,e){return n.next==37?(n.advance(),_2(n.next)&&n.advance(),_2(n.next)&&n.advance(),!0):y9(n.next)||e&&n.next==44?(n.advance(),!0):!1}function hA(n){if(n.advance(),n.next==60){for(n.advance();;)if(!L2(n,!0)){n.next==62&&n.advance();break}}else for(;L2(n,!1););}function Yx(n){for(n.advance();!Zs(n.next)&&Bd(n.next)!="f";)n.advance()}function Jy(n,e){let t=n.next,i=!1,l=n.pos;for(n.advance();;){let o=n.next;if(o<0)break;if(n.advance(),o==t)if(o==39)if(n.next==39)n.advance();else break;else break;else if(o==92&&t==34)n.next>=0&&n.advance();else if(ol(o)){if(e)return!1;i=!0}else if(e&&n.pos>=l+1024)return!1}return!i}function b9(n){for(let e=[],t=n.pos+1024;;)if(n.next==91||n.next==123)e.push(n.next),n.advance();else if(n.next==39||n.next==34){if(!Jy(n,!0))return!1}else if(n.next==93||n.next==125){if(e[e.length-1]!=n.next-2)return!1;if(e.pop(),n.advance(),!e.length)return!0}else{if(n.next<0||n.pos>t||ol(n.next))return!1;n.advance()}}const v9="iiisiiissisfissssssssssssisssiiissssssssssssssssssssssssssfsfssissssssssssssssssssssssssssfif";function Bd(n){return n<33?"u":n>125?"s":v9[n-33]}function O0(n,e){let t=Bd(n);return t!="u"&&!(e&&t=="f")}function dA(n,e,t,i){if(Bd(n.next)=="s"||(n.next==63||n.next==58||n.next==45)&&O0(n.peek(1),t))n.advance();else return!1;let l=n.pos;for(;;){let o=n.next,a=0,c=i+1;for(;fA(o);){if(ol(o)){if(e)return!1;c=0}else c++;o=n.peek(++a)}if(!(o>=0&&(o==58?O0(n.peek(a+1),t):o==35?n.peek(a-1)!=32:O0(o,t)))||!t&&c<=i||c==0&&!t&&(_a(n,45,a)||_a(n,46,a)))break;if(e&&Bd(o)=="f")return!1;for(let d=a;d>=0;d--)n.advance();if(e&&n.pos>l+1024)return!1}return!0}const w9=new up((n,e)=>{if(n.next==33)hA(n),n.acceptToken(o9);else if(n.next==38||n.next==42){let t=n.next==38?l9:s9;Yx(n),n.acceptToken(t)}else n.next==39||n.next==34?(Jy(n,!1),n.acceptToken(r9)):dA(n,!1,e.context.type==wc,e.context.depth)&&n.acceptToken(i9)}),k9=new up((n,e)=>{let t=e.context.type==$x?e.context.depth:-1,i=n.pos;e:for(;;){let l=0,o=n.next;for(;o==32;)o=n.peek(++l);if(!l&&(_a(n,45,l)||_a(n,46,l))||!ol(o)&&(t<0&&(t=Math.max(e.context.depth+1,l)),lYAN>Y",stateData:";S~O!fOS!gOS^OS~OP_OQbORSOTUOWROXROYYOZZO[XOcPOqQO!PVO!V[O!cTO~O`cO~P]OVkOWROXROYeOZfO[dOcPOmhOqQO~OboO~P!bOVtOWROXROYeOZfO[dOcPOmrOqQO~OpwO~P#WORSOTUOWROXROYYOZZO[XOcPOqQO!PVO!cTO~OSvP!avP!bvP~P#|OWROXROYeOZfO[dOcPOqQO~OmzO~P%OOm!OOUzP!azP!bzP!dzP~P#|O^!SO!b!QO!f!TO!g!RO~ORSOTUOWROXROcPOqQO!PVO!cTO~OY!UOP!QXQ!QX!V!QX!`!QXS!QX!a!QX!b!QXU!QXm!QX!d!QX~P&aO[!WOP!SXQ!SX!V!SX!`!SXS!SX!a!SX!b!SXU!SXm!SX!d!SX~P&aO^!ZO!W![O!b!YO!f!]O!g!YO~OP!_O!V[OQaX!`aX~OPaXQaX!VaX!`aX~P#|OP!bOQ!cO!V[O~OP_O!V[O~P#|OWROXROY!fOcPOqQObfXmfXofXpfX~OWROXRO[!hOcPOqQObhXmhXohXphX~ObeXmlXoeX~ObkXokX~P%OOm!kO~Om!lObnPonP~P%OOb!pOo!oO~Ob!pO~P!bOm!sOosXpsX~OosXpsX~P%OOm!uOotPptP~P%OOo!xOp!yO~Op!yO~P#WOS!|O!a#OO!b#OO~OUyX!ayX!byX!dyX~P#|Om#QO~OU#SO!a#UO!b#UO!d#RO~Om#WOUzX!azX!bzX!dzX~O]#XO~O!b#XO!g#YO~O^#ZO!b#XO!g#YO~OP!RXQ!RX!V!RX!`!RXS!RX!a!RX!b!RXU!RXm!RX!d!RX~P&aOP!TXQ!TX!V!TX!`!TXS!TX!a!TX!b!TXU!TXm!TX!d!TX~P&aO!b#^O!g#^O~O^#_O!b#^O!f#`O!g#^O~O^#_O!W#aO!b#^O!g#^O~OPaaQaa!Vaa!`aa~P#|OP#cO!V[OQ!XX!`!XX~OP!XXQ!XX!V!XX!`!XX~P#|OP_O!V[OQ!_X!`!_X~P#|OWROXROcPOqQObgXmgXogXpgX~OWROXROcPOqQObiXmiXoiXpiX~Obkaoka~P%OObnXonX~P%OOm#kO~Ob#lOo!oO~Oosapsa~P%OOotXptX~P%OOm#pO~Oo!xOp#qO~OSwP!awP!bwP~P#|OS!|O!a#vO!b#vO~OUya!aya!bya!dya~P#|Om#xO~P%OOm#{OU}P!a}P!b}P!d}P~P#|OU#SO!a$OO!b$OO!d#RO~O]$QO~O!b$QO!g$RO~O!b$SO!g$SO~O^$TO!b$SO!g$SO~O^$TO!b$SO!f$UO!g$SO~OP!XaQ!Xa!V!Xa!`!Xa~P#|Obnaona~P%OOotapta~P%OOo!xO~OU|X!a|X!b|X!d|X~P#|Om$ZO~Om$]OU}X!a}X!b}X!d}X~O]$^O~O!b$_O!g$_O~O^$`O!b$_O!g$_O~OU|a!a|a!b|a!d|a~P#|O!b$cO!g$cO~O",goto:",]!mPPPPPPPPPPPPPPPPP!nPP!v#v#|$`#|$c$f$j$nP%VPPP!v%Y%^%a%{&O%a&R&U&X&_&b%aP&e&{&e'O'RPP']'a'g'm's'y(XPPPPPPPP(_)e*X+c,VUaObcR#e!c!{ROPQSTUXY_bcdehknrtvz!O!U!W!_!b!c!f!h!k!l!s!u!|#Q#R#S#W#c#k#p#x#{$Z$]QmPR!qnqfPQThknrtv!k!l!s!u#R#k#pR!gdR!ieTlPnTjPnSiPnSqQvQ{TQ!mkQ!trQ!vtR#y#RR!nkTsQvR!wt!RWOSUXY_bcz!O!U!W!_!b!c!|#Q#S#W#c#x#{$Z$]RySR#t!|R|TR|UQ!PUR#|#SR#z#RR#z#SyZOSU_bcz!O!_!b!c!|#Q#S#W#c#x#{$Z$]R!VXR!XYa]O^abc!a!c!eT!da!eQnPR!rnQvQR!{vQ!}yR#u!}Q#T|R#}#TW^Obc!cS!^^!aT!aa!eQ!eaR#f!eW`Obc!cQxSS}U#SQ!`_Q#PzQ#V!OQ#b!_Q#d!bQ#s!|Q#w#QQ$P#WQ$V#cQ$Y#xQ$[#{Q$a$ZR$b$]xZOSU_bcz!O!_!b!c!|#Q#S#W#c#x#{$Z$]Q!VXQ!XYQ#[!UR#]!W!QWOSUXY_bcz!O!U!W!_!b!c!|#Q#S#W#c#x#{$Z$]pfPQThknrtv!k!l!s!u#R#k#pQ!gdQ!ieQ#g!fR#h!hSgPn^pQTkrtv#RQ!jhQ#i!kQ#j!lQ#n!sQ#o!uQ$W#kR$X#pQuQR!zv",nodeNames:"⚠ DirectiveEnd DocEnd - - ? ? ? Literal QuotedLiteral Anchor Alias Tag BlockLiteralContent Comment Stream BOM Document ] [ FlowSequence Item Tagged Anchored Anchored Tagged FlowMapping Pair Key : Pair , } { FlowMapping Pair Pair BlockSequence Item Item BlockMapping Pair Pair Key Pair Pair BlockLiteral BlockLiteralHeader Tagged Anchored Anchored Tagged Directive DirectiveName DirectiveContent Document",maxTerm:74,context:m9,nodeProps:[["isolate",-3,8,9,14,""],["openedBy",18,"[",32,"{"],["closedBy",19,"]",33,"}"]],propSources:[S9],skippedNodes:[0],repeatNodeCount:6,tokenData:"-Y~RnOX#PXY$QYZ$]Z]#P]^$]^p#Ppq$Qqs#Pst$btu#Puv$yv|#P|}&e}![#P![!]'O!]!`#P!`!a'i!a!}#P!}#O*g#O#P#P#P#Q+Q#Q#o#P#o#p+k#p#q'i#q#r,U#r;'S#P;'S;=`#z<%l?HT#P?HT?HU,o?HUO#PQ#UU!WQOY#PZp#Ppq#hq;'S#P;'S;=`#z<%lO#PQ#kTOY#PZs#Pt;'S#P;'S;=`#z<%lO#PQ#}P;=`<%l#P~$VQ!f~XY$Qpq$Q~$bO!g~~$gS^~OY$bZ;'S$b;'S;=`$s<%lO$b~$vP;=`<%l$bR%OX!WQOX%kXY#PZ]%k]^#P^p%kpq#hq;'S%k;'S;=`&_<%lO%kR%rX!WQ!VPOX%kXY#PZ]%k]^#P^p%kpq#hq;'S%k;'S;=`&_<%lO%kR&bP;=`<%l%kR&lUoP!WQOY#PZp#Ppq#hq;'S#P;'S;=`#z<%lO#PR'VUmP!WQOY#PZp#Ppq#hq;'S#P;'S;=`#z<%lO#PR'p[!PP!WQOY#PZp#Ppq#hq{#P{|(f|}#P}!O(f!O!R#P!R![)p![;'S#P;'S;=`#z<%lO#PR(mW!PP!WQOY#PZp#Ppq#hq!R#P!R![)V![;'S#P;'S;=`#z<%lO#PR)^U!PP!WQOY#PZp#Ppq#hq;'S#P;'S;=`#z<%lO#PR)wY!PP!WQOY#PZp#Ppq#hq{#P{|)V|}#P}!O)V!O;'S#P;'S;=`#z<%lO#PR*nUcP!WQOY#PZp#Ppq#hq;'S#P;'S;=`#z<%lO#PR+XUbP!WQOY#PZp#Ppq#hq;'S#P;'S;=`#z<%lO#PR+rUqP!WQOY#PZp#Ppq#hq;'S#P;'S;=`#z<%lO#PR,]UpP!WQOY#PZp#Ppq#hq;'S#P;'S;=`#z<%lO#PR,vU`P!WQOY#PZp#Ppq#hq;'S#P;'S;=`#z<%lO#P",tokenizers:[g9,x9,w9,k9,0,1],topRules:{Stream:[0,15]},tokenPrec:0}),O9=wd.define({name:"yaml",parser:C9.configure({props:[XN.add({Stream:n=>{for(let e=n.node.resolve(n.pos,-1);e&&e.to>=n.pos;e=e.parent){if(e.name=="BlockLiteralContent"&&e.fromn.pos)return null}}return null},FlowMapping:KS({closing:"}"}),FlowSequence:KS({closing:"]"})}),YN.add({"FlowMapping FlowSequence":vL,"Item Pair BlockLiteral":(n,e)=>({from:e.doc.lineAt(n.from).to,to:n.to})})]}),languageData:{commentTokens:{line:"#"},indentOnInput:/^\s*[\]\}]$/}});function N9(){return new uL(O9)}const z2='button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), a[href], video[tabindex], [tabindex]:not([tabindex="-1"])';function cs({isOpen:n,onClose:e,dialogRef:t,initialFocusRef:i}){return R.useEffect(()=>{if(!n)return;const l=document.activeElement instanceof HTMLElement?document.activeElement:null,o=requestAnimationFrame(()=>{var f;const c=(i==null?void 0:i.current)??((f=t.current)==null?void 0:f.querySelector(z2))??t.current;c==null||c.focus()}),a=c=>{if(c.key!=="Tab")return;const f=t.current;if(!f)return;const d=Array.from(f.querySelectorAll(z2));if(!d.length)return;const p=d[0],g=d[d.length-1],b=document.activeElement;if(!(b instanceof Node&&f.contains(b))){c.preventDefault(),(c.shiftKey?g:p).focus();return}c.shiftKey&&(b===p||b===f)?(c.preventDefault(),g.focus()):!c.shiftKey&&(b===g||b===f)&&(c.preventDefault(),p.focus())};return window.addEventListener("keydown",a,!0),()=>{cancelAnimationFrame(o),l==null||l.focus(),window.removeEventListener("keydown",a,!0)}},[n]),l=>{l.key==="Escape"&&(l.preventDefault(),l.stopPropagation(),e())}}function ka({isOpen:n,title:e,message:t,confirmLabel:i="Confirm",cancelLabel:l="Cancel",danger:o=!1,onConfirm:a,onCancel:c}){const f=R.useRef(null),d=R.useRef(null),p=cs({isOpen:n,onClose:c,dialogRef:f,initialFocusRef:d});return n?y.jsx("div",{className:"animate-overlay-in fixed inset-0 z-[var(--z-modal)] flex items-center justify-center bg-black/60 p-4 backdrop-blur-sm",onClick:c,children:y.jsxs("div",{ref:f,role:"dialog","aria-modal":"true","aria-labelledby":"confirm-dialog-title",onKeyDown:p,onClick:g=>g.stopPropagation(),className:"animate-modal-in w-[400px] max-w-full rounded-2xl border border-frame-line glass-panel p-5",children:[y.jsxs("div",{className:"mb-3 flex items-center gap-2.5",children:[y.jsx("span",{className:`grid h-9 w-9 shrink-0 place-items-center rounded-lg ${o?"bg-status-danger-bg text-status-danger-text":"bg-chip-indigo-bg text-chip-indigo-text"}`,children:y.jsx(sO,{className:"h-5 w-5"})}),y.jsx("h2",{id:"confirm-dialog-title",className:"text-sm font-semibold text-ink",children:e})]}),y.jsx("div",{className:"mb-5 whitespace-pre-line text-xs text-ink-secondary",children:t}),y.jsxs("div",{className:"flex justify-end gap-2",children:[y.jsx("button",{ref:d,type:"button",onClick:c,className:"min-h-9 rounded-lg border border-line bg-elevated px-3.5 text-sm text-ink-secondary transition-colors hover:bg-surface-strong hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-indigo-400",children:l}),y.jsx("button",{type:"button",onClick:a,className:`min-h-9 rounded-lg border px-4 text-sm font-semibold transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-indigo-400 ${o?"border-status-danger-border bg-status-danger-bg/30 text-status-danger-text hover:bg-status-danger-bg/60":"btn-primary border-transparent bg-indigo-600 text-white hover:bg-indigo-500"}`,children:i})]})]})}):null}var T9=VC();const Cr=8,Yl=8,A9=400,B2={top:"bottom",bottom:"top",left:"right",right:"left"},E9={top:"-bottom-1 left-1/2 -translate-x-1/2",bottom:"-top-1 left-1/2 -translate-x-1/2",left:"-right-1 top-1/2 -translate-y-1/2",right:"-left-1 top-1/2 -translate-y-1/2"},M9={top:"border-b border-r",bottom:"border-t border-l",left:"border-t border-r",right:"border-b border-l"},P2=(n,e,t)=>{switch(n){case"top":return e.top-Yl-t.h>=Cr;case"bottom":return e.bottom+Yl+t.h<=window.innerHeight-Cr;case"left":return e.left-Yl-t.w>=Cr;default:return e.right+Yl+t.w<=window.innerWidth-Cr}},D9=(n,e,t)=>{if(n==="top"||n==="bottom"){const a=e.left+e.width/2-t.w/2,c=window.innerWidth-t.w-Cr;return{x:Math.min(Math.max(a,Cr),Math.max(Cr,c))-a,y:0}}const i=e.top+e.height/2-t.h/2,l=window.innerHeight-t.h-Cr;return{x:0,y:Math.min(Math.max(i,Cr),Math.max(Cr,l))-i}},Qe=({text:n,children:e,block:t=!0,placement:i="top",suppress:l=!1})=>{const o=R.useRef(null),a=R.useRef(null),c=R.useId(),f=R.useRef(null),[d,p]=R.useState(!1),[g,b]=R.useState(i),[v,w]=R.useState({x:0,y:0}),[S,C]=R.useState({left:-9999,top:-9999}),O=()=>{f.current!==null&&(window.clearTimeout(f.current),f.current=null)};R.useEffect(()=>{l&&(O(),p(!1))},[l]),R.useEffect(()=>()=>O(),[]);const j=R.useCallback(()=>{const A=o.current,T=a.current;if(!A||!T)return;const z=A.getBoundingClientRect(),ne={w:T.offsetWidth,h:T.offsetHeight},F=P2(i,z,ne)?i:P2(B2[i],z,ne)?B2[i]:i,W=D9(F,z,ne);b(F),w(W);const U=z.left+z.width/2,re=z.top+z.height/2;C(F==="top"?{left:U,top:z.top-Yl-ne.h}:F==="bottom"?{left:U,top:z.bottom+Yl}:F==="left"?{left:z.left-Yl-ne.w,top:re}:{left:z.right+Yl,top:re})},[i]);R.useEffect(()=>{if(!d)return;const A=()=>p(!1);return window.addEventListener("resize",A),window.addEventListener("scroll",A,!0),()=>{window.removeEventListener("resize",A),window.removeEventListener("scroll",A,!0)}},[d]);const M=A=>{if(l)return;O();const T=()=>{j(),p(!0)};A?T():f.current=window.setTimeout(T,A9)},H=()=>{O(),p(!1)};R.useEffect(()=>{if(!d)return;const A=T=>{T.key==="Escape"&&p(!1)};return document.addEventListener("keydown",A,!0),()=>document.removeEventListener("keydown",A,!0)},[d]),R.useEffect(()=>{if(!d)return;const A=()=>!!document.querySelector('[role="dialog"][aria-modal="true"], dialog[open]');if(A()){p(!1);return}const T=new MutationObserver(()=>{A()&&p(!1)});return T.observe(document.body,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["role","aria-modal","open","class"]}),()=>T.disconnect()},[d]);const P={onMouseEnter:()=>M(!1),onMouseLeave:H,onFocus:()=>M(!0),onBlur:H,"aria-describedby":c};return y.jsxs("div",{ref:o,className:`group relative ${t?"flex min-w-0 flex-1 items-center":"inline-flex shrink-0 items-center"}`,onMouseEnter:()=>M(!1),onMouseLeave:H,onFocus:()=>M(!0),onBlur:H,children:[R.cloneElement(e,P),T9.createPortal(y.jsxs("span",{ref:a,id:c,role:"tooltip",className:`pointer-events-none invisible fixed z-[var(--z-tooltip)] w-max max-w-[calc(100vw-16px)] rounded-md border border-line bg-elevated px-2 py-1 text-left text-[11px] leading-relaxed text-ink shadow-lg ${d?"visible opacity-100":"opacity-0"}`,style:{left:S.left,top:S.top,transform:g==="top"||g==="bottom"?`translateX(calc(-50% + ${v.x}px))`:`translateY(calc(-50% + ${v.y}px))`},children:[n,y.jsx("span",{className:`absolute h-2 w-2 rotate-45 border-line bg-elevated ${E9[g]} ${M9[g]}`,style:g==="top"||g==="bottom"?{left:`calc(50% - ${v.x}px)`}:void 0})]}),document.body)]})},R9=[".profiles",".profiles.yaml"];function j9(n){const e=n.trim();if(!e)return null;const t=e.toLowerCase(),i=R9.find(l=>t.endsWith(l));if(i!==void 0){const l=e.slice(0,e.length-i.length);return!l.trim()||l!==l.trimEnd()?null:e}return t.includes(".")?null:`${e}.profiles`}function _9({open:n,onCancel:e,onConfirm:t}){const[i,l]=R.useState(null),[o,a]=R.useState(""),[c,f]=R.useState(""),[d,p]=R.useState(null),[g,b]=R.useState(!1),[v,w]=R.useState(null),[S,C]=R.useState(null),O=R.useRef(null),j=R.useRef(null),M=R.useRef(null),H=R.useCallback(async z=>{b(!0),w(null);try{const ne=await $C(z);l(ne),a(ne.current_path)}catch(ne){w(ne instanceof Error?ne.message:String(ne))}finally{b(!1)}},[]);R.useEffect(()=>{if(!n)return;f(""),p(null),C(null),H(o);const z=requestAnimationFrame(()=>{var ne;return(ne=j.current)==null?void 0:ne.focus()});return()=>cancelAnimationFrame(z)},[n]);const P=cs({isOpen:n,onClose:e,dialogRef:O,initialFocusRef:j});function A(){if(!i)return;const z=j9(c);if(z===null){p("Not a ProFiles configuration file. Allowed extensions: .profiles, .profiles.yaml");return}p(null);const ne=o.trim()||i.current_path;if(o.trim()===i.current_path&&i.items.some(U=>!U.is_dir&&U.name===z)){C({filename:z,directory:ne});return}t({filename:z,directory:ne,overwrite:!1})}if(!n)return null;const T=(i==null?void 0:i.items.filter(z=>z.is_dir))??[];return y.jsxs(y.Fragment,{children:[y.jsx("div",{className:"animate-overlay-in fixed inset-0 z-[var(--z-modal)] flex items-center justify-center bg-black/65 p-4 backdrop-blur-sm",onClick:e,children:y.jsxs("div",{ref:O,role:"dialog","aria-modal":"true","aria-labelledby":"save-as-dialog-title",onKeyDown:P,onClick:z=>z.stopPropagation(),className:"animate-modal-in flex max-h-[calc(100dvh-2rem)] w-[min(94vw,560px)] flex-col overflow-hidden rounded-xl border border-frame-line glass-panel sm:rounded-2xl",children:[y.jsx("div",{className:"flex shrink-0 items-center justify-between gap-3 border-b border-line px-5 py-3",children:y.jsxs("div",{className:"flex min-w-0 items-center gap-2.5",children:[y.jsx("span",{className:"grid h-8 w-8 shrink-0 place-items-center rounded-lg bg-chip-indigo-bg",children:y.jsx(nO,{className:"h-4 w-4 text-chip-indigo-text"})}),y.jsxs("div",{className:"min-w-0",children:[y.jsx("h2",{id:"save-as-dialog-title",className:"text-sm font-semibold text-ink",children:"Save configuration as"}),y.jsx("p",{className:"truncate font-mono text-xs text-ink-muted",children:(i==null?void 0:i.current_path)||"…"})]})]})}),y.jsxs("div",{className:"border-b border-line px-5 py-3",children:[y.jsx("label",{htmlFor:"save-as-path",className:"mb-1.5 block text-xs font-medium text-ink-secondary",children:"Location"}),y.jsxs("div",{className:"flex min-w-0 items-center gap-1.5",children:[y.jsx("input",{ref:M,id:"save-as-path",type:"text",value:o,onChange:z=>a(z.target.value),onKeyDown:z=>{z.key==="Enter"&&H(o.trim())},placeholder:"/path/to/directory",className:"h-9 min-w-0 flex-1 rounded-lg border border-line bg-elevated px-2.5 font-mono text-sm text-ink outline-none placeholder:text-ink-faint transition-colors hover:bg-surface-strong focus-visible:border-indigo-500 focus-visible:ring-2 focus-visible:ring-indigo-500/30"}),y.jsx("button",{type:"button",onClick:()=>void H(o.trim()),className:"inline-flex h-9 shrink-0 items-center rounded-lg border border-line bg-elevated px-3 text-sm font-medium text-ink-secondary transition-colors hover:bg-surface-strong hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-indigo-400",children:"Go"}),y.jsx(Qe,{text:"Home directory",block:!1,children:y.jsx("button",{type:"button",onClick:()=>void H(""),"aria-label":"Home directory",className:"grid h-9 w-9 shrink-0 place-items-center rounded-lg border border-line bg-elevated text-ink-secondary transition-colors hover:bg-surface-strong hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-indigo-400",children:y.jsx(Qd,{className:"h-4 w-4"})})}),(i==null?void 0:i.parent_path)&&y.jsx(Qe,{text:"Parent directory",block:!1,children:y.jsx("button",{type:"button",onClick:()=>void H(i.parent_path),"aria-label":"Parent directory",className:"grid h-9 w-9 shrink-0 place-items-center rounded-lg border border-line bg-elevated text-ink-secondary transition-colors hover:bg-surface-strong hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-indigo-400",children:y.jsx(Vd,{className:"h-4 w-4 rotate-180"})})})]})]}),y.jsx("div",{className:"min-h-24 flex-1 overflow-y-auto px-2 py-2 sm:px-3","aria-busy":g,children:g?y.jsxs("div",{className:"flex h-full items-center justify-center gap-2.5 text-sm text-ink-muted",children:[y.jsx(Zl,{className:"h-5 w-5 animate-spin text-chip-indigo-text"}),y.jsx("span",{role:"status",children:"Loading directories…"})]}):v?y.jsxs("div",{role:"alert",className:"flex h-full flex-col items-center justify-center gap-2.5 text-center",children:[y.jsx("p",{className:"text-sm text-status-danger-text",children:v}),y.jsx("button",{type:"button",onClick:()=>void H(o||(i==null?void 0:i.current_path)||""),className:"min-h-9 rounded-lg border border-line bg-elevated px-3.5 text-sm text-ink-secondary hover:bg-surface-strong hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-indigo-400",children:"Retry"})]}):y.jsxs("ul",{className:"space-y-0.5",children:[T.map(z=>y.jsx("li",{children:y.jsxs("button",{type:"button",onClick:()=>void H(z.path),className:"flex min-h-9 w-full items-center gap-2.5 rounded-lg px-3 py-1.5 text-left text-sm text-ink-secondary transition-colors hover:bg-elevated hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-indigo-400",children:[y.jsx(Sc,{className:"h-4 w-4 shrink-0 text-chip-indigo-text"}),y.jsx("span",{className:"truncate",children:z.name})]})},z.path)),T.length===0&&y.jsxs("li",{className:"flex min-h-16 flex-col items-center justify-center gap-2 text-center text-sm text-ink-muted",children:[y.jsx(Kl,{className:"h-6 w-6 text-ink-faint"}),"No subdirectories found"]})]})}),y.jsxs("div",{className:"shrink-0 border-t border-line px-5 py-3",children:[y.jsx("label",{htmlFor:"save-as-filename",className:"mb-1.5 block text-xs font-medium text-ink-secondary",children:"File name"}),y.jsx("input",{ref:j,id:"save-as-filename",type:"text",value:c,onChange:z=>{f(z.target.value),p(null)},onKeyDown:z=>{z.key==="Enter"&&c.trim()&&A()},placeholder:"machine.profiles",className:"h-9 w-full rounded-lg border border-line bg-elevated px-2.5 font-mono text-sm text-ink outline-none placeholder:text-ink-faint transition-colors hover:bg-surface-strong focus-visible:border-indigo-500 focus-visible:ring-2 focus-visible:ring-indigo-500/30"}),d&&y.jsx("p",{role:"alert","data-testid":"save-as-error",className:"mt-1.5 text-xs text-status-danger-text",children:d}),y.jsxs("div",{className:"mt-3 flex justify-end gap-1.5",children:[y.jsx("button",{type:"button",onClick:e,className:"min-h-9 rounded-lg border border-line bg-elevated px-3.5 text-sm text-ink-secondary transition-colors hover:bg-surface-strong hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-indigo-400",children:"Cancel"}),y.jsxs("button",{type:"button",onClick:A,disabled:!c.trim()||!i||g,title:"Save the configuration to the selected folder",className:"btn btn-primary min-h-9 rounded-lg px-4 text-sm font-semibold",children:[y.jsx(il,{className:"h-4 w-4"}),"Save"]})]})]})]})}),y.jsx(ka,{isOpen:S!==null,title:"Replace configuration?",message:`A configuration named "${S==null?void 0:S.filename}" already exists in this folder. -Saving will replace it.`,confirmLabel:"Replace",cancelLabel:"Keep existing",danger:!0,onConfirm:()=>{const z=S;C(null),z&&t({...z,overwrite:!0})},onCancel:()=>C(null)})]})}const L9=Oe.theme({"&":{height:"100%",fontSize:"12.5px",color:"var(--app-text-primary)",backgroundColor:"transparent"},".cm-scroller":{fontFamily:"'JetBrains Mono', 'Fira Code', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace",lineHeight:"1.6"},".cm-content":{caretColor:"var(--color-indigo-500, #6366f1)"},".cm-cursor, .cm-dropCursor":{borderLeftColor:"var(--color-indigo-500, #6366f1)"},"&.cm-focused":{outline:"none"},".cm-selectionBackground, &.cm-focused .cm-selectionBackground":{backgroundColor:"var(--app-hover)"},".cm-activeLine":{backgroundColor:"var(--app-elevated)"},".cm-gutters":{backgroundColor:"transparent",color:"var(--app-text-faint)",border:"none",borderRight:"1px solid var(--app-border)"},".cm-activeLineGutter":{backgroundColor:"var(--app-elevated)",color:"var(--app-text-secondary)"},".cm-panels":{backgroundColor:"var(--app-glass-panel-strong)",color:"var(--app-text-primary)"},".cm-tooltip":{border:"1px solid var(--app-border)",backgroundColor:"var(--app-glass-panel-strong)",color:"var(--app-text-primary)"}});function N0(n){return n.replace(/\r\n?/g,` -`)}function zh(n,e){return n!==null&&n.state.doc.toString()!==e}function z9(n){return n instanceof QC&&Array.isArray(n.detail)?{text:n.message,issues:n.detail}:{text:n instanceof Error?n.message:String(n),issues:[]}}function B9({open:n,onClose:e,onApplied:t}){const[i,l]=R.useState({status:"loading"}),[o,a]=R.useState(!1),[c,f]=R.useState(!1),[d,p]=R.useState(null),[g,b]=R.useState([]),[v,w]=R.useState(null),[S,C]=R.useState(null),[O,j]=R.useState(null),M=R.useRef(null),H=R.useRef(null),P=R.useRef(null),A=R.useRef(""),T=R.useRef(0),z=R.useRef(new Map),ne=cs({isOpen:n,onClose:F,dialogRef:M});R.useEffect(()=>{if(!n){A.current="",P.current=null,l({status:"loading"}),a(!1),f(!1),p(null),b([]),w(null),C(null),j(null),T.current+=1,z.current.clear();return}let ce=!1;return _k().then(xe=>{if(ce)return;const Ue=N0(xe.content);A.current=Ue,l({status:"ready",data:{...xe,content:Ue}})}).catch(xe=>{ce||(A.current="",l({status:"error",message:xe instanceof Error?xe.message:String(xe)}))}),()=>{ce=!0}},[n]),R.useEffect(()=>{if(!n||i.status!=="ready")return;const ce=H.current;if(!ce)return;const xe=new Oe({doc:i.data.content,extensions:[IB,N9(),L9,Oe.updateListener.of(Ue=>{Ue.docChanged&&a(zh(Ue.view,A.current))})],parent:ce});return P.current=xe,()=>{xe.destroy(),P.current=null}},[n,i]);function F(){if(zh(P.current,A.current)){f(!0);return}e()}const W=R.useCallback(()=>{MM().catch(ce=>{console.error("Failed to open config file in OS editor:",ce)})},[]);function U(){var ce;return((ce=P.current)==null?void 0:ce.state.doc.toString())??A.current}const re=R.useCallback(async(ce,xe)=>{if(z.current.has(ce))return;const Ue=++T.current;z.current.set(ce,Ue);try{await xe(Ue)}finally{z.current.get(ce)===Ue&&z.current.delete(ce)}},[]),de=R.useCallback(()=>re("new",async ce=>{p(null),b([]);try{const xe=await OM();if(ce!==T.current)return;const Ue=N0(xe.content);A.current=Ue,a(!1),l(ot=>ot.status==="ready"?{status:"ready",data:{...ot.data,filename:xe.filename,content:Ue,config_path:null}}:ot),p({kind:"ok",text:"New configuration template loaded."})}catch(xe){if(ce!==T.current)return;p({kind:"error",text:xe instanceof Error?xe.message:String(xe)})}}),[re]),ie=R.useCallback(()=>re("revert",async ce=>{p(null),b([]);try{const xe=await _k();if(ce!==T.current)return;const Ue=N0(xe.content);A.current=Ue,a(!1),l({status:"ready",data:{...xe,content:Ue}}),p({kind:"ok",text:"Configuration reloaded from disk."})}catch(xe){if(ce!==T.current)return;p({kind:"error",text:xe instanceof Error?xe.message:String(xe)})}}),[re]);function L(){if(zh(P.current,A.current)){w("new");return}de()}function ee(){if(zh(P.current,A.current)){w("revert");return}ie()}const se=R.useCallback(()=>re("test",async ce=>{if(i.status==="ready")try{const xe=await Lk(i.data.filename,U());if(ce!==T.current)return;b(xe.issues),p(xe.valid?{kind:"ok",text:"Configuration is valid."}:{kind:"error",text:`Validation failed with ${xe.issues.length} issue${xe.issues.length===1?"":"s"}.`})}catch(xe){if(ce!==T.current)return;b([]),p({kind:"error",text:xe instanceof Error?xe.message:String(xe)})}}),[i,re]),le=R.useCallback(()=>re("apply",async ce=>{if(i.status==="ready")try{const xe=await XC(i.data.filename,U());if(ce!==T.current)return;p({kind:"ok",text:"Configuration applied (session trial)."}),t==null||t(xe)}catch(xe){if(ce!==T.current)return;p({kind:"error",text:xe instanceof Error?xe.message:String(xe)})}}),[i,t,re]),E=R.useCallback(ce=>new Promise(xe=>{C({issues:ce,resolve:Ue=>{C(null),xe(Ue)}})}),[]),ze=R.useCallback(()=>new Promise(ce=>{j({resolve:xe=>{j(null),ce(xe)}})}),[]),je=R.useCallback((ce,xe)=>{if(A.current=xe,a(!1),b([]),C(null),j(null),ce.config_path){const Ue=ce.config_path.split(/[\\/]/).pop()||ce.title||"configuration";l(ot=>ot.status!=="ready"||!(ot.data.filename!==Ue||ot.data.config_path!==ce.config_path||ot.data.session_trial)?ot:{status:"ready",data:{...ot.data,filename:Ue,config_path:ce.config_path,session_trial:!1,content:xe}})}t==null||t(ce)},[t]),B=R.useCallback(ce=>{const xe=z9(ce);C(null),j(null),b(xe.issues),p({kind:"error",text:xe.text})},[]),D=R.useCallback((ce,xe)=>re(ce,async Ue=>{if(i.status!=="ready")return;const ot=U();p(null),b([]);try{const wt=await Lk(xe,ot);if(Ue!==T.current)return;let xt=!1;if(!wt.valid){if(b(wt.issues),xt=await E(wt.issues),Ue!==T.current)return;if(!xt){p({kind:"error",text:"Save cancelled — fix the listed issues, or force-save anyway."});return}}if(ce==="save-as"){const Xe=await ze();if(Ue!==T.current||Xe===null)return;const Ft=await TM({content:ot,filename:Xe.filename,directory:Xe.directory,force:xt,overwrite:Xe.overwrite});if(Ue!==T.current)return;je(Ft,ot),p({kind:"ok",text:`Configuration saved as ${Xe.filename}.`})}else{const Xe=await NM(ot,xt);if(Ue!==T.current)return;je(Xe,ot),p({kind:"ok",text:`Configuration saved to ${xe}.`})}}catch(wt){if(Ue!==T.current)return;B(wt)}}),[E,ze,i,je,B,re]),X=R.useCallback(()=>D("save",i.status==="ready"?i.data.filename:""),[i,D]),fe=R.useCallback(()=>D("save-as",i.status==="ready"?i.data.filename:""),[i,D]),pe=R.useRef(()=>{});if(pe.current=()=>{i.status==="ready"&&(S!==null||O!==null||c||v!==null||(i.data.config_path!==null?X():le()))},R.useEffect(()=>{if(!n)return;const ce=xe=>{(xe.metaKey||xe.ctrlKey)&&!xe.altKey&&!xe.shiftKey&&xe.key.toLowerCase()==="s"&&(xe.preventDefault(),xe.stopPropagation(),pe.current())};return window.addEventListener("keydown",ce,!0),()=>window.removeEventListener("keydown",ce,!0)},[n]),!n)return null;const Re=i.status==="ready"?i.data.filename:"",Ne=i.status==="ready"?i.data.session_trial:!1,_e=i.status!=="ready",ve=i.status==="ready"&&i.data.config_path!==null;return y.jsxs(y.Fragment,{children:[y.jsx("div",{ref:M,role:"dialog","aria-modal":"true","aria-labelledby":"config-editor-title",onKeyDown:ne,onClick:F,className:"animate-overlay-in fixed inset-0 z-[var(--z-modal)] flex items-center justify-center bg-black/65 p-3 backdrop-blur-sm sm:p-6",children:y.jsxs("div",{className:"animate-modal-in flex h-[90vh] w-full max-w-6xl flex-col overflow-hidden rounded-xl border border-frame-line glass-panel",onClick:ce=>ce.stopPropagation(),children:[y.jsxs("div",{className:"flex shrink-0 items-center justify-between gap-3 border-b border-line px-5 py-3",children:[y.jsxs("div",{className:"flex min-w-0 items-center gap-2.5",children:[y.jsx("span",{className:"flex h-8 w-8 shrink-0 items-center justify-center rounded-lg bg-chip-indigo-bg text-chip-indigo-text",children:y.jsx(E4,{className:"h-4 w-4"})}),y.jsxs("div",{className:"min-w-0",children:[y.jsx("h2",{id:"config-editor-title",className:"text-sm font-semibold text-ink",children:"Configuration Editor"}),y.jsxs("p",{className:"truncate text-xs text-ink-muted",children:[Re||"…",Ne?" • session trial (not anchored to disk)":""]})]})]}),y.jsxs("div",{className:"flex shrink-0 items-center gap-1.5",children:[ve&&y.jsxs("button",{type:"button",onClick:W,title:"Open the configuration file with the OS default editor",className:"btn inline-flex items-center gap-1.5 rounded-md border border-line bg-surface px-3 py-1.5 text-xs font-medium text-ink-secondary hover:bg-elevated hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-indigo-500",children:[y.jsx(JC,{className:"h-3.5 w-3.5"}),"Open in OS"]}),y.jsx("button",{type:"button",onClick:F,"aria-label":"Close editor",className:"rounded-md p-1.5 text-ink-muted hover:bg-elevated hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-indigo-500",children:y.jsx(Ui,{className:"h-4 w-4"})})]})]}),y.jsxs("div",{"data-testid":"editor-toolbar",className:"flex shrink-0 items-center gap-2 border-b border-line px-5 py-2",children:[y.jsxs("div",{className:"flex items-center gap-1.5",children:[y.jsxs("button",{type:"button",onClick:L,disabled:_e,title:"Load the starter configuration template",className:"btn btn-secondary px-3 py-1.5",children:[y.jsx(j4,{className:"h-3.5 w-3.5"}),"New"]}),y.jsxs("button",{type:"button",onClick:()=>void se(),disabled:_e,title:"Validate the editor content in memory",className:"btn btn-secondary px-3 py-1.5",children:[y.jsx(B4,{className:"h-3.5 w-3.5"}),"Test"]}),y.jsxs("button",{type:"button",onClick:ee,disabled:_e,title:"Discard edits and reload the file from disk",className:"btn btn-secondary px-3 py-1.5",children:[y.jsx(uD,{className:"h-3.5 w-3.5"}),"Revert"]}),ve&&y.jsxs("button",{type:"button",onClick:()=>void X(),disabled:_e,title:"Save to the configuration file on disk (Ctrl/Cmd+S)",className:"btn btn-secondary px-3 py-1.5",children:[y.jsx(nO,{className:"h-3.5 w-3.5"}),"Save"]}),y.jsxs("button",{type:"button",onClick:()=>void fe(),disabled:_e,title:"Save the configuration to a new file — also anchors a session trial onto disk",className:"btn btn-secondary px-3 py-1.5",children:[y.jsx(fD,{className:"h-3.5 w-3.5"}),"Save As"]}),y.jsxs("button",{type:"button",onClick:()=>void le(),disabled:_e,title:"Trial the editor content as the session configuration",className:"btn btn-primary px-3 py-1.5 font-semibold",children:[y.jsx(Jl,{className:"h-3.5 w-3.5"}),"Apply"]})]}),o&&y.jsxs("span",{role:"status",className:"inline-flex items-center gap-1 rounded-full border border-chip-amber-border bg-chip-amber-bg px-2 py-0.5 text-[10px] font-bold text-chip-amber-text",children:[y.jsx(h4,{className:"h-3 w-3"}),"Unsaved changes"]})]}),(d!==null||g.length>0)&&y.jsxs("div",{className:"shrink-0 border-b border-line px-5 py-2",children:[d!==null&&y.jsx("div",{"data-testid":"editor-status","aria-live":"polite",className:`rounded-md border px-3 py-1.5 text-xs font-medium ${d.kind==="ok"?"border-status-success-border bg-status-success-bg text-status-success-text":"border-status-danger-border bg-status-danger-bg text-status-danger-text"}`,children:d.text}),g.length>0&&y.jsx("ul",{"data-testid":"editor-issues",className:"mt-1 space-y-1",children:g.map((ce,xe)=>y.jsx("li",{className:`rounded-md border px-3 py-1.5 text-xs ${ce.severity==="error"?"border-status-danger-border bg-status-danger-bg text-status-danger-text":"border-chip-amber-border bg-chip-amber-bg text-chip-amber-text"}`,children:ce.message},`${ce.severity}-${xe}`))})]}),y.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:i.status==="loading"?y.jsx("div",{className:"flex h-full items-center justify-center",children:y.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-2 border-indigo-600 border-t-transparent"})}):i.status==="error"?y.jsx("div",{className:"flex h-full items-center justify-center p-6",children:y.jsx("div",{className:"max-w-md rounded-md border border-status-danger-border bg-status-danger-bg p-4 text-center text-xs text-status-danger-text",children:i.message})}):y.jsx("div",{ref:H,className:"h-full"})})]})}),y.jsx(ka,{isOpen:c,title:"Discard changes?",message:`The editor contains unsaved changes. -Closing now will discard them.`,confirmLabel:"Discard",cancelLabel:"Keep editing",danger:!0,onConfirm:()=>{f(!1),e()},onCancel:()=>f(!1)}),y.jsx(ka,{isOpen:v!==null,title:"Replace current edits?",message:v==="revert"?`The editor contains unsaved changes. -Reverting will discard them and reload the file from disk.`:`The editor contains unsaved changes. -Loading the starter template will discard them.`,confirmLabel:"Replace",cancelLabel:"Keep editing",danger:!0,onConfirm:()=>{const ce=v;w(null),ce==="new"?de():ce==="revert"&&ie()},onCancel:()=>w(null)}),y.jsx(ka,{isOpen:S!==null,title:"Save with validation issues?",danger:!0,message:y.jsxs(y.Fragment,{children:[y.jsx("p",{children:"Saving will write these issues to disk; the file may fail to load until they are fixed."}),y.jsx("ul",{className:"mt-2 space-y-1",children:S==null?void 0:S.issues.map((ce,xe)=>y.jsx("li",{className:`rounded-md border px-3 py-1.5 text-xs ${ce.severity==="error"?"border-status-danger-border bg-status-danger-bg text-status-danger-text":"border-chip-amber-border bg-chip-amber-bg text-chip-amber-text"}`,children:ce.message},`${ce.severity}-${xe}`))})]}),confirmLabel:"Force save anyway",cancelLabel:"Go back and fix",onConfirm:()=>S==null?void 0:S.resolve(!0),onCancel:()=>S==null?void 0:S.resolve(!1)}),y.jsx(_9,{open:O!==null,onCancel:()=>O==null?void 0:O.resolve(null),onConfirm:ce=>O==null?void 0:O.resolve(ce)})]})}function P9({position:n,onClose:e,onLaunch:t,onLaunchWithArgs:i,onReveal:l,onOpenFolder:o,onOpenTerminal:a,onScanDirectory:c,onFilterFolder:f,onFilterExtension:d,onCopyPath:p,onCopyFilename:g,onCopyUri:b,onComputeHash:v,onVerifyHash:w,onProperties:S,onClearFile:C,onGenerateBarcode:O,showToast:j}){const[M,H]=R.useState(!1),[P,A]=R.useState(""),T=R.useRef(null),z=R.useRef(null),ne=R.useRef(null),[F,W]=R.useState(null);if(R.useEffect(()=>{var le;M&&((le=z.current)==null||le.showModal())},[M]),R.useLayoutEffect(()=>{if(!n){W(null);return}const le=()=>{const E=T.current;if(!E)return;const ze=E.getBoundingClientRect(),je=8;W({left:Math.max(je,Math.min(n.x,window.innerWidth-ze.width-je)),top:Math.max(je,Math.min(n.y,window.innerHeight-ze.height-je))})};return le(),window.addEventListener("resize",le),()=>window.removeEventListener("resize",le)},[n]),R.useEffect(()=>{if(!n)return;ne.current=document.activeElement instanceof HTMLElement?document.activeElement:null;const le=window.requestAnimationFrame(()=>{var E,ze;(ze=(E=T.current)==null?void 0:E.querySelector("[role='menuitem']"))==null||ze.focus()});return()=>{var E;window.cancelAnimationFrame(le),(E=ne.current)==null||E.focus()}},[n]),!n)return null;const{file:U,x:re,y:de}=n,ie=()=>{i(U,P),H(!1),e()},L=le=>{const E=le.lastIndexOf(".");return E!==-1?le.slice(E):""},ee=le=>{const E=Math.max(le.lastIndexOf("/"),le.lastIndexOf("\\"));return E!==-1?le.slice(0,E):le},se=le=>{const E=Math.max(le.lastIndexOf("/"),le.lastIndexOf("\\"));return E!==-1?le.slice(0,E):""};return y.jsxs(y.Fragment,{children:[y.jsx("div",{className:"fixed inset-0 z-[calc(var(--z-context-menu)-1)]",onClick:e,onContextMenu:le=>{le.preventDefault(),e()},"aria-hidden":"true"}),y.jsxs("div",{ref:T,role:"menu","aria-label":`Actions for ${U.filename}`,tabIndex:0,onKeyDown:le=>{var je,B,D,X;["Escape","ArrowDown","ArrowUp","Home","End"].includes(le.key)&&le.stopPropagation();const E=Array.from(((je=T.current)==null?void 0:je.querySelectorAll("[role='menuitem']"))??[]),ze=E.indexOf(document.activeElement);if(le.key==="Escape")le.preventDefault(),e();else if(le.key==="ArrowDown"||le.key==="ArrowUp"){le.preventDefault();const fe=le.key==="ArrowDown"?1:-1;(B=E[(ze+fe+E.length)%E.length])==null||B.focus()}else le.key==="Home"?(le.preventDefault(),(D=E[0])==null||D.focus()):le.key==="End"&&(le.preventDefault(),(X=E.at(-1))==null||X.focus())},className:"animate-modal-in fixed z-[var(--z-context-menu)] max-h-[calc(100dvh-16px)] w-56 max-w-[calc(100vw-16px)] overflow-y-auto rounded-lg border border-line bg-surface-glass py-1 text-xs text-ink shadow-2xl backdrop-blur-md",style:F??{left:re,top:de,visibility:"hidden"},children:[y.jsx("div",{className:"border-b border-line px-3 py-2 font-medium text-ink-muted truncate",children:U.filename}),y.jsxs("button",{role:"menuitem",onClick:()=>{t(U),e()},className:"flex w-full items-center gap-2 px-3 py-3 min-h-[44px] hover:bg-indigo-600 hover:text-white focus:outline-none focus:ring-2 focus:ring-indigo-500 active:scale-95 transition-transform group","aria-label":`Launch ${U.filename}`,children:[y.jsx(Jl,{className:"h-3.5 w-3.5 fill-current text-status-success-text group-hover:text-white"}),y.jsx("span",{children:"Launch"})]}),y.jsxs("button",{role:"menuitem",onClick:()=>{H(!0)},className:"flex w-full items-center gap-2 px-3 py-3 min-h-[44px] hover:bg-indigo-600 hover:text-white focus:outline-none focus:ring-2 focus:ring-indigo-500 active:scale-95 transition-transform group","aria-label":`Launch ${U.filename} with arguments`,children:[y.jsx(Jl,{className:"h-3.5 w-3.5 text-chip-indigo-text group-hover:text-white"}),y.jsx("span",{children:"Launch with arguments..."})]}),y.jsx("div",{className:"my-1 border-t border-line"}),y.jsxs("button",{role:"menuitem",onClick:()=>{l(U),e()},className:"flex w-full items-center gap-2 px-3 py-1.5 hover:bg-indigo-600 hover:text-white focus:outline-none focus:ring-2 focus:ring-indigo-500 active:scale-95 transition-transform group","aria-label":`Reveal ${U.filename} in file manager`,children:[y.jsx($0,{className:"h-3.5 w-3.5 text-chip-sky-text group-hover:text-white"}),y.jsx("span",{children:"Reveal in File Manager"})]}),y.jsxs("button",{role:"menuitem",onClick:()=>{o(U),e()},className:"flex w-full items-center gap-2 px-3 py-1.5 hover:bg-indigo-600 hover:text-white focus:outline-none focus:ring-2 focus:ring-indigo-500 active:scale-95 transition-transform group","aria-label":`Open folder containing ${U.filename}`,children:[y.jsx(Kl,{className:"h-3.5 w-3.5 text-chip-amber-text group-hover:text-white"}),y.jsx("span",{children:"Open Folder"})]}),y.jsxs("button",{role:"menuitem",onClick:()=>{a(U),e()},className:"flex w-full items-center gap-2 px-3 py-1.5 hover:bg-indigo-600 hover:text-white focus:outline-none focus:ring-2 focus:ring-indigo-500 active:scale-95 transition-transform group","aria-label":`Open terminal in directory containing ${U.filename}`,children:[y.jsx(Y0,{className:"h-3.5 w-3.5 text-status-success-text group-hover:text-white"}),y.jsx("span",{children:"Open Terminal in Directory"})]}),y.jsxs("button",{role:"menuitem",onClick:()=>{O(U),e()},className:"flex w-full items-center gap-2 px-3 py-1.5 hover:bg-indigo-600 hover:text-white focus:outline-none focus:ring-2 focus:ring-indigo-500 active:scale-95 transition-transform group","aria-label":"Generate QR Code",children:[y.jsx(py,{className:"h-3.5 w-3.5 text-chip-fuchsia-text group-hover:text-white"}),y.jsx("span",{children:"Generate QR Code"})]}),y.jsx("div",{className:"my-1 border-t border-line"}),y.jsxs("button",{role:"menuitem",onClick:()=>{const le=ee(U.path);c(le),e()},className:"flex w-full items-center gap-2 px-3 py-1.5 hover:bg-indigo-600 hover:text-white focus:outline-none focus:ring-2 focus:ring-indigo-500 active:scale-95 transition-transform group","aria-label":"Scan to Directory",children:[y.jsx(Kl,{className:"h-3.5 w-3.5 text-chip-indigo-text group-hover:text-white"}),y.jsx("span",{children:"Scan to Directory"})]}),y.jsxs("button",{role:"menuitem",onClick:()=>{const le=se(U.rel_path);le&&f(le),e()},className:"flex w-full items-center gap-2 px-3 py-1.5 hover:bg-indigo-600 hover:text-white focus:outline-none focus:ring-2 focus:ring-indigo-500 active:scale-95 transition-transform group","aria-label":`Filter view to folder ${U.filename} is in`,children:[y.jsx(G0,{className:"h-3.5 w-3.5 text-chip-indigo-text group-hover:text-white"}),y.jsx("span",{children:"Filter to Folder"})]}),y.jsxs("button",{role:"menuitem",onClick:()=>{const le=L(U.filename);le&&d(le),e()},className:"flex w-full items-center gap-2 px-3 py-1.5 hover:bg-indigo-600 hover:text-white focus:outline-none focus:ring-2 focus:ring-indigo-500 active:scale-95 transition-transform group","aria-label":`Filter view by extension ${L(U.filename)}`,children:[y.jsx(G0,{className:"h-3.5 w-3.5 text-chip-indigo-text group-hover:text-white"}),y.jsx("span",{children:"Filter by Extension"})]}),y.jsx("div",{className:"my-1 border-t border-line"}),y.jsxs("button",{role:"menuitem",onClick:()=>{p(U,!1),e()},className:"flex w-full items-center gap-2 px-3 py-1.5 hover:bg-indigo-600 hover:text-white focus:outline-none focus:ring-2 focus:ring-indigo-500 active:scale-95 transition-transform group","aria-label":`Copy full path of ${U.filename}`,children:[y.jsx(si,{className:"h-3.5 w-3.5 text-ink-muted group-hover:text-white"}),y.jsx("span",{className:"truncate",children:"Copy Full Path"})]}),y.jsxs("button",{role:"menuitem",onClick:()=>{p(U,!0),e()},className:"flex w-full items-center gap-2 px-3 py-1.5 hover:bg-indigo-600 hover:text-white focus:outline-none focus:ring-2 focus:ring-indigo-500 active:scale-95 transition-transform group","aria-label":`Copy path of ${U.filename} with forward slashes`,children:[y.jsx(si,{className:"h-3.5 w-3.5 text-ink-muted group-hover:text-white"}),y.jsx("span",{className:"truncate",children:"Copy Path (Forward Slashes)"})]}),y.jsxs("button",{role:"menuitem",onClick:()=>{g(U,!1),e()},className:"flex w-full items-center gap-2 px-3 py-1.5 hover:bg-indigo-600 hover:text-white focus:outline-none focus:ring-2 focus:ring-indigo-500 active:scale-95 transition-transform group","aria-label":`Copy filename of ${U.filename}`,children:[y.jsx(si,{className:"h-3.5 w-3.5 text-ink-muted group-hover:text-white"}),y.jsx("span",{className:"truncate",children:"Copy Filename"})]}),y.jsxs("button",{role:"menuitem",onClick:()=>{g(U,!0),e()},className:"flex w-full items-center gap-2 px-3 py-1.5 hover:bg-indigo-600 hover:text-white focus:outline-none focus:ring-2 focus:ring-indigo-500 active:scale-95 transition-transform group","aria-label":`Copy filename of ${U.filename} without extension`,children:[y.jsx(si,{className:"h-3.5 w-3.5 text-ink-muted group-hover:text-white"}),y.jsx("span",{className:"truncate",children:"Copy Filename (no ext)"})]}),y.jsxs("button",{role:"menuitem",onClick:async()=>{const le=ee(U.path);e();try{await navigator.clipboard.writeText(le),j==null||j(`Copied: ${le}`)}catch(E){j==null||j(`Copy failed: ${(E==null?void 0:E.message)??E}`,"error")}},className:"flex w-full items-center gap-2 px-3 py-1.5 hover:bg-indigo-600 hover:text-white focus:outline-none focus:ring-2 focus:ring-indigo-500 active:scale-95 transition-transform group","aria-label":"Copy Directory",children:[y.jsx(si,{className:"h-3.5 w-3.5 text-ink-muted group-hover:text-white"}),y.jsx("span",{className:"truncate",children:"Copy Directory"})]}),y.jsxs("button",{role:"menuitem",onClick:()=>{b(U),e()},className:"flex w-full items-center gap-2 px-3 py-1.5 hover:bg-indigo-600 hover:text-white focus:outline-none focus:ring-2 focus:ring-indigo-500 active:scale-95 transition-transform group","aria-label":`Copy URI of ${U.filename}`,children:[y.jsx(si,{className:"h-3.5 w-3.5 text-ink-muted group-hover:text-white"}),y.jsx("span",{className:"truncate",children:"Copy URI"})]}),y.jsx("div",{className:"my-1 border-t border-line"}),y.jsxs("button",{role:"menuitem",onClick:()=>{v(U,"md5"),e()},className:"flex w-full items-center gap-2 px-3 py-1.5 hover:bg-indigo-600 hover:text-white focus:outline-none focus:ring-2 focus:ring-indigo-500 active:scale-95 transition-transform group","aria-label":`Compute MD5 hash of ${U.filename}`,children:[y.jsx(ua,{className:"h-3.5 w-3.5 text-chip-purple-text group-hover:text-white"}),y.jsx("span",{children:"Compute MD5 Hash"})]}),y.jsxs("button",{role:"menuitem",onClick:()=>{v(U,"sha256"),e()},className:"flex w-full items-center gap-2 px-3 py-1.5 hover:bg-indigo-600 hover:text-white focus:outline-none focus:ring-2 focus:ring-indigo-500 active:scale-95 transition-transform group","aria-label":`Compute SHA256 hash of ${U.filename}`,children:[y.jsx(ua,{className:"h-3.5 w-3.5 text-chip-purple-text group-hover:text-white"}),y.jsx("span",{children:"Compute SHA256 Hash"})]}),y.jsxs("button",{role:"menuitem",onClick:()=>{w(U,"md5"),e()},className:"flex w-full items-center gap-2 px-3 py-1.5 hover:bg-indigo-600 hover:text-white focus:outline-none focus:ring-2 focus:ring-indigo-500 active:scale-95 transition-transform group","aria-label":`Verify MD5 hash of ${U.filename}`,children:[y.jsx(ua,{className:"h-3.5 w-3.5 text-chip-purple-text group-hover:text-white"}),y.jsx("span",{children:"Verify MD5 Hash"})]}),y.jsxs("button",{role:"menuitem",onClick:()=>{w(U,"sha256"),e()},className:"flex w-full items-center gap-2 px-3 py-1.5 hover:bg-indigo-600 hover:text-white focus:outline-none focus:ring-2 focus:ring-indigo-500 active:scale-95 transition-transform group","aria-label":`Verify SHA256 hash of ${U.filename}`,children:[y.jsx(ua,{className:"h-3.5 w-3.5 text-chip-purple-text group-hover:text-white"}),y.jsx("span",{children:"Verify SHA256 Hash"})]}),y.jsx("div",{className:"my-1 border-t border-line"}),y.jsxs("button",{role:"menuitem",onClick:()=>{S(U),e()},className:"flex w-full items-center gap-2 px-3 py-1.5 hover:bg-indigo-600 hover:text-white focus:outline-none focus:ring-2 focus:ring-indigo-500 active:scale-95 transition-transform group","aria-label":`View properties of ${U.filename}`,children:[y.jsx($0,{className:"h-3.5 w-3.5 text-chip-sky-text group-hover:text-white"}),y.jsx("span",{children:"Properties"})]}),y.jsxs("button",{role:"menuitem",onClick:()=>{C(U),e()},className:"flex w-full items-center gap-2 px-3 py-1.5 hover:bg-indigo-600 hover:text-white focus:outline-none focus:ring-2 focus:ring-indigo-500 active:scale-95 transition-transform group","aria-label":`Remove ${U.filename} from list`,children:[y.jsx(lO,{className:"h-3.5 w-3.5 text-status-danger-text group-hover:text-white"}),y.jsx("span",{children:"Delete"})]})]}),M&&y.jsx("dialog",{ref:z,className:"animate-overlay-in fixed inset-0 z-[var(--z-modal)] flex items-center justify-center bg-black/60 p-4 rounded-xl","aria-labelledby":"args-modal-title",onClick:le=>{le.target===z.current&&H(!1)},onCancel:le=>{le.preventDefault(),H(!1)},children:y.jsxs("div",{className:"animate-modal-in w-96 rounded-xl border border-frame-line glass-panel p-4",children:[y.jsx("h3",{id:"args-modal-title",className:"mb-2 text-sm font-semibold text-ink",children:"Launch with Arguments"}),y.jsx("p",{className:"mb-3 text-xs text-ink-muted truncate",children:U.filename}),y.jsx("input",{type:"text",autoFocus:!0,placeholder:"Arguments (e.g. --verbose --port 80)",value:P,onChange:le=>A(le.target.value),onKeyDown:le=>{le.key==="Enter"&&ie(),le.key==="Escape"&&H(!1)},className:"mb-4 w-full rounded-md border border-line bg-elevated px-3 py-2 text-xs text-ink outline-none focus:border-indigo-500 focus:ring-2 focus:ring-indigo-500","aria-label":"Command line arguments"}),y.jsxs("div",{className:"flex justify-end gap-2",children:[y.jsx("button",{onClick:()=>H(!1),className:"rounded-md px-3 py-1.5 text-xs text-ink-muted hover:bg-elevated hover:text-ink focus:outline-none focus:ring-2 focus:ring-indigo-500","aria-label":"Cancel launch",children:"Cancel"}),y.jsx("button",{onClick:ie,className:"btn btn-primary px-3 py-1.5","aria-label":`Launch ${U.filename} with arguments`,children:"Launch"})]})]})})]})}function H9({isOpen:n,initialPath:e,onClose:t,onSelect:i}){const[l,o]=R.useState(null),[a,c]=R.useState(null),[f,d]=R.useState(""),[p,g]=R.useState(!1),[b,v]=R.useState(null),w=R.useRef(null),S=R.useRef(null),C=R.useRef(null);R.useEffect(()=>{var P;if(!n){(P=C.current)==null||P.focus();return}C.current=document.activeElement instanceof HTMLElement?document.activeElement:null,v(null),O(e||"");const H=requestAnimationFrame(()=>{var A;return(A=S.current)==null?void 0:A.focus()});return()=>{var A;cancelAnimationFrame(H),(A=C.current)==null||A.focus()}},[n]);const O=async H=>{g(!0),v(null);try{const P=await fetch(`/api/fs/browse?path=${encodeURIComponent(H)}`);if(!P.ok)throw new Error("Failed to browse directory");const A=await P.json();o(A),c(A.current_path),d(A.current_path)}catch(P){v(P.message||"Navigation failed")}finally{g(!1)}},j=()=>{const H=f.trim()||a;H&&(i(H),t())},M=H=>{var z;if(H.key==="Escape"){H.preventDefault(),t();return}if(H.key!=="Tab")return;const P=(z=w.current)==null?void 0:z.querySelectorAll('button:not([disabled]), input:not([disabled]), [tabindex]:not([tabindex="-1"])');if(!(P!=null&&P.length))return;const A=P[0],T=P[P.length-1];H.shiftKey&&document.activeElement===A?(H.preventDefault(),T.focus()):!H.shiftKey&&document.activeElement===T&&(H.preventDefault(),A.focus())};return n?y.jsx("div",{className:"animate-overlay-in fixed inset-0 z-[var(--z-modal)] flex items-center justify-center bg-black/65 p-3 backdrop-blur-sm sm:p-6",onClick:t,children:y.jsxs("div",{ref:w,role:"dialog","aria-modal":"true","aria-labelledby":"directory-picker-title",onKeyDown:M,className:"animate-modal-in flex h-[min(84dvh,760px)] max-h-[calc(100dvh-1.5rem)] w-[min(94vw,960px)] min-h-0 flex-col overflow-hidden rounded-xl border border-frame-line glass-panel sm:rounded-2xl",onClick:H=>H.stopPropagation(),children:[y.jsxs("div",{className:"flex items-center justify-between gap-3 border-b border-line px-4 py-3 sm:px-5",children:[y.jsxs("div",{className:"flex min-w-0 items-center gap-2.5",children:[y.jsx("span",{className:"grid h-9 w-9 shrink-0 place-items-center rounded-lg bg-chip-indigo-bg",children:y.jsx(Kl,{className:"h-5 w-5 text-chip-indigo-text"})}),y.jsxs("div",{className:"min-w-0",children:[y.jsx("h2",{id:"directory-picker-title",className:"text-sm font-semibold text-ink",children:"Select a directory"}),y.jsx("p",{className:"truncate font-mono text-xs text-ink-muted",children:(l==null?void 0:l.current_path)||""})]})]}),y.jsx(Qe,{text:"Close",block:!1,children:y.jsx("button",{type:"button",onClick:t,"aria-label":"Close directory picker",className:"grid h-9 w-9 shrink-0 place-items-center rounded-lg text-ink-muted transition-colors hover:bg-elevated hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-indigo-400",children:y.jsx(Ui,{className:"h-4 w-4"})})})]}),y.jsxs("div",{className:"border-b border-line px-4 py-3 sm:px-5",children:[y.jsx("label",{htmlFor:"directory-picker-path",className:"mb-1.5 block text-xs font-medium text-ink-secondary",children:"Location"}),y.jsxs("div",{className:"flex min-w-0 items-center gap-1.5",children:[y.jsx("input",{ref:S,id:"directory-picker-path",type:"text",value:f,onChange:H=>d(H.target.value),onKeyDown:H=>{H.key==="Enter"&&O(f.trim())},placeholder:"/path/to/directory",className:"h-10 min-w-0 flex-1 rounded-lg border border-line bg-elevated px-2.5 font-mono text-sm text-ink outline-none placeholder:text-ink-faint transition-colors hover:bg-surface-strong focus-visible:border-indigo-500 focus-visible:ring-2 focus-visible:ring-indigo-500/30"}),y.jsx("button",{type:"button",onClick:()=>O(f.trim()),className:"inline-flex h-10 shrink-0 items-center gap-1.5 rounded-lg border border-line bg-elevated px-3.5 text-sm font-medium text-ink-secondary transition-colors hover:bg-surface-strong hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-indigo-400",children:"Go"}),y.jsx(Qe,{text:"Home directory",block:!1,children:y.jsx("button",{type:"button",onClick:()=>O(""),"aria-label":"Home directory",className:"grid h-10 w-10 shrink-0 place-items-center rounded-lg border border-line bg-elevated text-ink-secondary transition-colors hover:bg-surface-strong hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-indigo-400",children:y.jsx(Qd,{className:"h-4 w-4"})})}),(l==null?void 0:l.parent_path)&&y.jsx(Qe,{text:"Parent directory",block:!1,children:y.jsx("button",{type:"button",onClick:()=>O(l.parent_path),"aria-label":"Parent directory",className:"grid h-10 w-10 shrink-0 place-items-center rounded-lg border border-line bg-elevated text-ink-secondary transition-colors hover:bg-surface-strong hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-indigo-400",children:y.jsx(Vd,{className:"h-4 w-4 rotate-180"})})})]})]}),y.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto px-2 py-2 sm:px-3 sm:py-3","aria-busy":p,children:p?y.jsxs("div",{className:"flex h-full items-center justify-center gap-2.5 text-sm text-ink-muted",children:[y.jsx(Zl,{className:"h-5 w-5 animate-spin text-chip-indigo-text"}),y.jsx("span",{role:"status",children:"Loading directories…"})]}):b?y.jsxs("div",{role:"alert",className:"flex h-full flex-col items-center justify-center gap-2.5 text-center",children:[y.jsx("p",{className:"text-sm text-status-danger-text",children:b}),y.jsx("button",{type:"button",onClick:()=>O(f||(l==null?void 0:l.current_path)||""),className:"min-h-10 rounded-lg border border-line bg-elevated px-3.5 text-sm text-ink-secondary hover:bg-surface-strong hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-indigo-400",children:"Retry"})]}):y.jsxs("ul",{className:"space-y-0.5",children:[l==null?void 0:l.items.filter(H=>H.is_dir).map(H=>y.jsx("li",{children:y.jsxs("button",{type:"button",onClick:()=>O(H.path),onDoubleClick:()=>{d(H.path),i(H.path),t()},className:`flex min-h-10 w-full items-center justify-between rounded-lg px-3 py-1.5 text-left text-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-indigo-400 ${a===H.path?"bg-chip-indigo-bg text-chip-indigo-text":"text-ink-secondary hover:bg-elevated hover:text-ink"}`,children:[y.jsxs("span",{className:"flex min-w-0 items-center gap-2.5",children:[y.jsx(Sc,{className:"h-5 w-5 shrink-0 text-chip-indigo-text"}),y.jsx("span",{className:"truncate",children:H.name})]}),a===H.path&&y.jsx(il,{className:"h-4 w-4 shrink-0 text-chip-indigo-text"})]})},H.path)),(l==null?void 0:l.items.filter(H=>H.is_dir).length)===0&&y.jsxs("li",{className:"flex h-full min-h-36 flex-col items-center justify-center gap-2.5 text-center text-sm text-ink-muted",children:[y.jsx(Kl,{className:"h-7 w-7 text-ink-faint"}),"No subdirectories found"]})]})}),y.jsxs("div",{className:"flex flex-col gap-2 border-t border-line px-4 py-3 sm:flex-row sm:items-center sm:justify-between sm:px-5",children:[y.jsxs("div",{className:"min-w-0 flex-1",children:[y.jsx("p",{className:"mb-0.5 text-xs font-medium text-ink-muted",children:"Selected folder"}),y.jsx("p",{className:"truncate font-mono text-sm text-ink",title:a||f,children:a||f||"—"})]}),y.jsxs("div",{className:"flex shrink-0 justify-end gap-1.5",children:[y.jsx("button",{type:"button",onClick:t,className:"min-h-10 rounded-lg border border-line bg-elevated px-3.5 text-sm text-ink-secondary transition-colors hover:bg-surface-strong hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-indigo-400",children:"Cancel"}),y.jsxs("button",{type:"button",onClick:j,disabled:!f.trim(),className:"btn btn-primary min-h-10 rounded-lg px-4 text-sm font-semibold",children:[y.jsx(Kl,{className:"h-4 w-4"}),"Select folder"]})]})]})]})}):null}function I9({visible:n,onFileSelected:e}){const t=R.useRef(null);return n?y.jsxs("div",{className:"animate-overlay-in fixed inset-0 z-[var(--z-drop-overlay)] flex items-center justify-center bg-black/65 backdrop-blur-sm",onClick:()=>{var i;return(i=t.current)==null?void 0:i.click()},"data-testid":"drop-config-overlay",children:[y.jsx("input",{ref:t,type:"file",accept:".profiles,.profiles.yaml,.profiles.yml,.yaml,.yml",className:"hidden",onChange:i=>{var o;const l=(o=i.target.files)==null?void 0:o[0];l&&e(l),i.target.value=""}}),y.jsxs("div",{className:"rounded-xl border-2 border-dashed border-chip-indigo-border bg-surface px-8 py-6 text-center shadow-2xl",children:[y.jsx("span",{className:"mx-auto mb-3 grid h-9 w-9 place-items-center rounded-lg bg-chip-indigo-bg",children:y.jsx(aa,{className:"h-5 w-5 text-chip-indigo-text"})}),y.jsx("p",{className:"text-sm font-semibold text-ink",children:"Drop configuration file"}),y.jsx("p",{className:"mt-1 text-xs text-ink-muted",children:".profiles, .profiles.yaml, .yml, .yaml — session-only preview"})]})]}):null}function U9({items:n,columnTemplate:e,resizePointerRef:t,resizeMovedRef:i}){return y.jsx("div",{className:"grid select-none items-center border-b border-l-2 border-l-transparent border-line/40 bg-surface/60 font-medium text-ink-muted shadow-sm backdrop-blur-md",role:"row","aria-rowindex":1,"data-file-list-header":!0,style:{gridTemplateColumns:e},children:n.map((l,o)=>{const a=!!(l.onSort&&l.sortKey),c=l.active?l.direction==="asc"?"ascending":"descending":"none";return y.jsxs("div",{role:"columnheader","data-column-key":l.sortKey,className:`group relative flex items-center gap-1.5 truncate px-3 py-2 ${a?"cursor-pointer hover:text-ink transition-colors":""} ${l.active?"text-ink":""}`,...a?{"aria-sort":c,tabIndex:0,onClick:l.onSort,onKeyDown:f=>{var d;(f.key==="Enter"||f.key===" ")&&(f.preventDefault(),(d=l.onSort)==null||d.call(l))}}:{},children:[l.icon,y.jsx("span",{className:"truncate",children:l.label}),a?l.active?l.direction==="asc"?y.jsx(JM,{className:"ml-auto h-3 w-3 shrink-0 text-chip-indigo-text"}):y.jsx(KC,{className:"ml-auto h-3 w-3 shrink-0 text-chip-indigo-text"}):y.jsx(Fk,{className:"ml-auto h-3 w-3 shrink-0 opacity-0 transition-opacity group-hover:opacity-40 hover:opacity-40"}):o>0&&y.jsx(Fk,{className:"ml-auto h-3 w-3 shrink-0 opacity-40"}),l.canResize&&l.onResizeBy&&y.jsx("div",{role:"separator","aria-orientation":"vertical","aria-label":`Resize ${l.label} column`,"aria-valuemin":pa,"aria-valuemax":Pd,"aria-valuenow":l.width??l.defaultWidth??ld,"aria-valuetext":`${l.width??l.defaultWidth??ld} pixels wide`,title:"Drag to resize; use arrow keys or click either side to adjust",tabIndex:0,onClick:f=>{var g;f.preventDefault(),f.stopPropagation();const d=i.current;if(i.current=!1,d)return;const p=f.currentTarget.getBoundingClientRect();(g=l.onResizeBy)==null||g.call(l,f.clientX{f.preventDefault(),f.stopPropagation();const d=f.currentTarget.parentElement;i.current=!1,t.current={pointerId:f.pointerId,startX:f.clientX,startWidth:l.width??(d==null?void 0:d.getBoundingClientRect().width)??l.defaultWidth??ld,resizeTo:l.onResizeTo},f.currentTarget.setPointerCapture(f.pointerId)},onPointerMove:f=>{const d=t.current;if(!d||d.pointerId!==f.pointerId)return;const p=f.clientX-d.startX;Math.abs(p)>2&&(i.current=!0),d.resizeTo(d.startWidth+p)},onPointerUp:f=>{var d;((d=t.current)==null?void 0:d.pointerId)===f.pointerId&&(f.currentTarget.releasePointerCapture(f.pointerId),t.current=null,window.setTimeout(()=>{i.current=!1},0))},onPointerCancel:()=>{t.current=null,i.current=!1},onKeyDown:f=>{var d,p;f.stopPropagation(),f.key==="ArrowLeft"||f.key==="ArrowRight"?(f.preventDefault(),(d=l.onResizeBy)==null||d.call(l,f.key==="ArrowLeft"?-Ph:Ph)):(f.key==="Home"||f.key==="End")&&(f.preventDefault(),(p=l.onResizeTo)==null||p.call(l,f.key==="Home"?pa:Pd))},className:"absolute inset-y-0 right-0 z-10 w-3 cursor-col-resize touch-none border-r border-transparent transition-colors hover:border-indigo-400 focus-visible:border-indigo-400 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-indigo-500"})]},o)})})}const Wi=28,Bh=12,T0=500,pa=80,Pd=960,ld=160,Ph=24,H2=44,Hh={File:2,Path:3,FileName:1,Type:1,Version:1};function F9({files:n,totalCount:e,rawLoadedCount:t,onLoadMore:i,loadingMore:l=!1,scanning:o=!1,hasScanned:a=!1,activeDirectory:c="",recursive:f=!1,onDisableRecursive:d,onOpenDirectory:p,onOpenConfig:g,filterText:b,onClearFilter:v,prefilterNote:w,columnHeaders:S,columnNames:C,selectedIndex:O,onSelectIndex:j,onLaunch:M,onContextMenu:H,rowColors:P,sort:A,onSortChange:T}){const z=["File"],ne=C.length>0?C:z,F=S.length>0?S:ne,W=Array.from({length:Math.max(ne.length,F.length)},(Se,Ve)=>({key:ne[Ve]??z[0],header:F[Ve]??ne[Ve]??z[0]})),U=R.useRef(null),[re,de]=R.useState(0),[ie,L]=R.useState(600),[ee,se]=R.useState(0),[le,E]=R.useState({}),ze=R.useRef(null),je=R.useRef(!1),B=ne.reduce((Se,Ve)=>Se+(Hh[Ve]??1),1),D=(Se,Ve)=>{const We=Math.min(Pd,Math.max(pa,Math.round(Ve)));E(yt=>({...yt,[Se]:We}))},X=(Se,Ve)=>{var J;const We=Array.from(((J=U.current)==null?void 0:J.querySelectorAll("[data-column-key]"))??[]).find(he=>he.dataset.columnKey===Se),yt=le[Se]??(We==null?void 0:We.getBoundingClientRect().width)??ld;D(Se,yt+Ve)},fe=[`${H2}px`,...ne.map(Se=>le[Se]?`${le[Se]}px`:`minmax(${pa}px, ${Hh[Se]??1}fr)`)].join(" "),pe=R.useRef(!1),Re=R.useRef(null),Ne=n.length,_e=t??Ne,ve=e??_e,ce=_e{const Se=U.current;if(!Se)return;const Ve=new ResizeObserver(We=>{for(const yt of We)L(yt.contentRect.height),se(yt.contentRect.width)});return Ve.observe(Se),L(Se.clientHeight||600),se(Se.clientWidth||0),()=>Ve.disconnect()},[]),R.useEffect(()=>{var he;const Se=U.current;if(!Se||O<0||O>=Ne)return;const Ve=((he=Se.querySelector("[data-file-list-header]"))==null?void 0:he.offsetHeight)??0,We=Ve+O*Wi,yt=We+Wi;let J=Se.scrollTop;WeSe.scrollTop+Se.clientHeight&&(J=yt-Se.clientHeight),J!==Se.scrollTop&&(Se.scrollTop=J,de(J))},[O,Ne]),R.useEffect(()=>{const Se=U.current;if(!Se)return;const Ve=()=>{if(pe.current||!Ue||!i)return;const We=Se.scrollTop+Se.clientHeight,yt=Ne*Wi;yt-WeWe&&(pe.current=!0,window.setTimeout(()=>{pe.current=!1},200),i())};return Se.addEventListener("scroll",Ve,{passive:!0}),window.addEventListener("scroll",Ve,{passive:!0}),()=>{Se.removeEventListener("scroll",Ve),window.removeEventListener("scroll",Ve)}},[n,Ue,i,Ne]),R.useEffect(()=>{if(pe.current||!Ue||!i)return;const Se=Ne*Wi,Ve=re+ie;if(!(Se-VeVe))return;const yt=`${Ne}:${_e}:${ve}`;Re.current=yt,i()});const ot=R.useCallback(Se=>{de(Se.currentTarget.scrollTop)},[]),wt=Math.max(0,Math.floor(re/Wi)-Bh),xt=Math.ceil(ie/Wi)+Bh*2,Xe=Math.min(Ne,wt+xt),Ft=wt*Wi,Zn=(Se,Ve)=>{if(Ve)return{className:"bg-chip-indigo-bg border-l-4 border-chip-indigo-border text-ink",style:{}};for(const[We,yt]of P)if(Se.toLowerCase().includes(We.toLowerCase()))return{className:"hover:bg-elevated border-l-4 text-ink",style:{borderLeftColor:yt,borderLeftWidth:"4px"}};return{className:"border-l-4 border-transparent text-ink-secondary hover:bg-elevated/60",style:{borderLeftColor:"transparent",borderLeftWidth:"4px"}}},Un=(Ue?Ne+xt:Ne)*Wi,Rn="btn btn-secondary px-3 py-1.5";return y.jsxs("div",{ref:U,onScroll:ot,className:"flex-1 overflow-auto bg-app text-xs transition-colors duration-200 focus-visible:outline focus-visible:outline-2 focus-visible:outline-indigo-500 focus-visible:outline-offset-[-2px]","data-testid":"file-list","data-loaded-count":_e,"aria-busy":o,role:"grid","aria-label":"Discovered files","aria-rowcount":Math.max(ve,Ne===0?1:0)+1,"aria-colcount":ne.length+1,"aria-activedescendant":Ne>0?`file-row-${O}`:void 0,tabIndex:0,children:[y.jsx("div",{className:"sticky top-0 z-10",role:"presentation",children:y.jsx(U9,{columnTemplate:fe,resizePointerRef:ze,resizeMovedRef:je,items:[{label:"#",icon:y.jsx(G0,{className:"h-3.5 w-3.5"})},...W.map(({key:Se,header:Ve})=>({label:Ve,weight:Hh[Se]??1,width:le[Se],defaultWidth:Math.min(Pd,Math.max(pa,Math.round((ee-H2)*(Hh[Se]??1)/B))),canResize:!0,onResizeBy:We=>X(Se,We),onResizeTo:We=>D(Se,We),sortKey:Se,active:(A==null?void 0:A.column)===Se,direction:A==null?void 0:A.direction,onSort:()=>{(A==null?void 0:A.column)!==Se?T({column:Se,direction:"asc"}):A.direction==="asc"?T({column:Se,direction:"desc"}):T(null)}}))]})}),w&&Ne>0&&y.jsxs("div",{role:"note","data-testid":"prefilter-note",className:"flex items-center gap-1.5 border-b border-line/40 bg-surface px-3 py-1 text-[11px] text-ink-faint",children:[y.jsx(eO,{className:"h-3 w-3 shrink-0 text-ink-faint","aria-hidden":"true"}),y.jsx("span",{className:"min-w-0 truncate",children:w})]}),Ne===0?y.jsx("div",{role:"row","aria-rowindex":2,"data-testid":"file-list-empty",children:y.jsx("div",{role:"gridcell","aria-colspan":ne.length+1,className:"p-8 text-center text-ink-faint",children:o?y.jsxs("div",{className:"flex flex-col items-center gap-2",children:[y.jsx(Zl,{className:"h-5 w-5 animate-spin text-chip-indigo-text motion-reduce:animate-none"}),y.jsx("span",{children:"Scanning files..."})]}):!c.trim()&&g?y.jsxs("div",{className:"flex flex-col items-center gap-3",children:[y.jsx("span",{children:"Select a directory first."}),y.jsx("button",{type:"button",onClick:g,className:Rn,children:"Choose configuration"})]}):a?b.trim()?y.jsxs("div",{className:"flex flex-col items-center gap-3",children:[y.jsxs("span",{children:["No files match “",b,"”."]}),y.jsxs("div",{className:"flex flex-wrap items-center justify-center gap-2",children:[y.jsx("button",{type:"button",onClick:v,className:Rn,children:"Clear filter"}),f&&d&&y.jsx("button",{type:"button",onClick:d,className:Rn,children:"Turn off recursive"}),p&&y.jsx("button",{type:"button",onClick:p,className:Rn,children:"Open directory"})]})]}):y.jsxs("div",{className:"flex flex-col items-center gap-3",children:[y.jsx("span",{children:"No files found for the current directory and extension."}),y.jsxs("div",{className:"flex flex-wrap items-center justify-center gap-2",children:[f&&d&&y.jsx("button",{type:"button",onClick:d,className:Rn,children:"Turn off recursive"}),p&&y.jsx("button",{type:"button",onClick:p,className:Rn,children:"Open directory"})]})]}):y.jsx("span",{children:"Select a directory and scan to find files."})})}):y.jsxs("div",{className:"relative",style:{height:Un},role:"rowgroup",children:[l&&y.jsx("div",{className:"pointer-events-none absolute left-1/2 top-2 z-20 -translate-x-1/2","aria-hidden":"true",children:y.jsx(Zl,{className:"h-4 w-4 animate-spin text-chip-indigo-text"})}),y.jsx("div",{style:{transform:`translateY(${Ft}px)`},"data-testid":"file-list-window",role:"presentation",children:n.slice(wt,Xe).map((Se,Ve)=>{const We=wt+Ve,yt=We===O,J=Zn(Se.filename,yt);return y.jsxs("div",{id:`file-row-${We}`,"data-row-index":We,role:"row","aria-rowindex":We+2,"aria-selected":yt,onClick:()=>{var he;j(We),(he=U.current)==null||he.focus()},onDoubleClick:()=>M(Se),onContextMenu:he=>H(he,Se,We),className:`grid cursor-pointer items-center transition-colors ${J.className}`,style:{...J.style,height:Wi,gridTemplateColumns:fe},children:[y.jsxs("div",{className:"flex items-center justify-end gap-1 px-3 font-mono text-ink-faint",children:[Se.has_hook&&y.jsx("span",{title:Se.hook_pattern?`Launch workflow: ${Se.hook_pattern}`:"Launch workflow configured","aria-label":"Workflow hook attached",className:"inline-flex items-center text-status-warning-text hover:brightness-95",children:y.jsx(oO,{className:"h-3 w-3 shrink-0"})}),y.jsx("span",{className:"hidden sm:inline",children:We+1})]}),ne.map((he,Ae)=>{const Pe=Se.column_values[he]||(he==="File"?Se.filename:"-");return y.jsx("div",{role:"gridcell","data-column-key":he,className:"truncate px-3 font-mono",style:{minWidth:pa},title:he==="Path"?Se.path:Pe,children:Pe},Ae)})]},Se.path||We)})}),ce&&y.jsxs("div",{className:"pointer-events-none absolute bottom-2 left-1/2 -translate-x-1/2 rounded-full border border-line bg-surface-strong px-3 py-1 text-[11px] text-ink-muted shadow","data-testid":"file-list-paging",children:[l?y.jsx(GM,{className:"mr-1.5 h-4 w-4 animate-spin motion-reduce:animate-none text-ink-muted"}):null,"(",_e," of ",ve," loaded)"]})]})]})}function Kx({id:n,ariaLabel:e,value:t,options:i,onChange:l,placeholder:o,className:a="",inputClassName:c="",optionLabel:f=p=>p,onOpenChange:d}){const p=R.useId(),g=R.useRef(null),[b,v]=R.useState(!1),[w,S]=R.useState(""),[C,O]=R.useState(-1),j=i.filter(T=>f(T).toLocaleLowerCase().includes(w.toLocaleLowerCase())),M=C>=0&&j[C]?`${p}-option-${C}`:void 0;R.useEffect(()=>{const T=z=>{var ne;(ne=g.current)!=null&&ne.contains(z.target)||v(!1)};return document.addEventListener("mousedown",T),()=>document.removeEventListener("mousedown",T)},[]),R.useEffect(()=>{d==null||d(b)},[b,d]),R.useEffect(()=>{var T;C<0||(T=document.getElementById(`${p}-option-${C}`))==null||T.scrollIntoView({block:"nearest"})},[C,p]);const H=()=>{S(""),O(-1),v(!0)},P=T=>{l(T),S(""),O(-1),v(!1)},A=T=>{if(T.key==="ArrowDown"){if(T.preventDefault(),!b){H(),O(0);return}O(z=>Math.min(z+1,j.length-1))}else if(T.key==="ArrowUp"){if(T.preventDefault(),!b){H(),O(j.length-1);return}O(z=>z<=0?j.length-1:z-1)}else T.key==="Enter"&&b&&j[C]!==void 0?(T.preventDefault(),P(j[C])):T.key==="Escape"&&v(!1)};return y.jsxs("div",{ref:g,onBlur:T=>{var z;(z=g.current)!=null&&z.contains(T.relatedTarget)||v(!1)},className:`relative flex min-w-0 ${a}`,children:[y.jsx("input",{id:n,type:"text",role:"combobox","aria-label":e,"aria-autocomplete":"list","aria-expanded":b,"aria-controls":p,"aria-activedescendant":M,value:t,placeholder:o,onChange:T=>{l(T.target.value),S(T.target.value),O(-1),v(!0)},onKeyDown:A,className:`min-w-0 flex-1 rounded-l-md border border-line bg-elevated px-3 py-1.5 text-ink outline-none transition-colors hover:bg-surface-strong focus:border-indigo-500 ${c}`}),y.jsx("button",{type:"button","aria-label":`Show ${e.toLowerCase()} options`,"aria-expanded":b,title:`Show ${e.toLowerCase()} options`,onMouseDown:T=>T.preventDefault(),onClick:()=>b?v(!1):H(),className:"shrink-0 rounded-r-md border border-l-0 border-line bg-elevated px-2 text-ink-muted hover:bg-surface-strong hover:text-ink focus-visible:z-10 focus-visible:outline focus-visible:outline-2 focus-visible:outline-indigo-500 transition-colors",children:y.jsx(o4,{className:`h-3.5 w-3.5 transition-transform ${b?"rotate-180":""}`})}),b&&y.jsx("ul",{id:p,role:"listbox","aria-label":`${e} options`,className:"absolute left-0 top-full z-[var(--z-combobox-list)] mt-1 max-h-60 w-full min-w-48 overflow-y-auto rounded-md border border-line bg-surface py-1 text-ink shadow-xl",children:j.length>0?j.map((T,z)=>{const ne=f(T),F=z===C,W=T===t;return y.jsx("li",{id:`${p}-option-${z}`,role:"option","aria-selected":W,title:ne||void 0,onMouseEnter:()=>O(z),onMouseDown:U=>U.preventDefault(),onClick:()=>P(T),className:`cursor-pointer truncate px-3 py-1.5 ${F?"bg-elevated text-ink":"text-ink-secondary"} ${W?"font-semibold":""}`,children:ne||"(No filter)"},`${T}-${z}`)}):y.jsx("li",{className:"px-3 py-1.5 text-ink-muted",children:"No matching presets"})})]})}function q9({title:n,release:e,directories:t,activeDirectory:i,onDirectoryChange:l,onBrowseDirectory:o,onGoToParentDirectory:a,onGoToHomeDirectory:c,onOpenActiveDirectory:f,onOpenTerminal:d}){const[p,g]=R.useState(!1);return y.jsxs("header",{className:"relative z-30 flex flex-wrap items-center gap-3 border-b border-line bg-app/90 px-5 py-2 text-xs backdrop-blur-xl shadow-xs transition-all duration-200",children:[y.jsx("div",{className:"flex shrink-0 items-center gap-3",children:y.jsxs("div",{className:"flex items-center gap-3.5",children:[y.jsxs("div",{className:"relative flex h-9 w-9 items-center justify-center rounded-xl bg-gradient-to-br from-chip-indigo-bg to-chip-purple-bg text-chip-indigo-text border border-chip-indigo-border shadow-xs",children:[y.jsx(Y0,{className:"h-4 w-4"}),y.jsx("span",{className:"absolute -bottom-0.5 -right-0.5 flex h-2.5 w-2.5 items-center justify-center rounded-full bg-emerald-500 ring-2 ring-app"})]}),y.jsxs("div",{children:[y.jsxs("div",{className:"flex items-center gap-2",children:[y.jsx("h1",{className:"text-sm font-bold tracking-tight text-ink font-heading",children:"ProFiles"}),n&&y.jsxs(y.Fragment,{children:[y.jsx("span",{className:"text-ink-faint",children:"/"}),y.jsx("span",{className:"text-xs font-medium text-chip-indigo-text bg-chip-indigo-bg px-2 py-0.5 rounded-md border border-chip-indigo-border/50",children:n})]})]}),y.jsxs("p",{className:"text-[11px] font-medium text-ink-muted tracking-wide mt-0.5",children:["Crafted by ",y.jsx("span",{className:"text-ink font-semibold",children:"Florent ALBANY"})," • ",y.jsxs("span",{className:"font-mono text-chip-indigo-text",children:["v",e||"0.11.0-rc.2"]})]})]})]})}),y.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-2",children:[y.jsxs("label",{className:"flex shrink-0 items-center gap-1.5 font-medium text-ink-secondary text-xs",children:[y.jsx(Sc,{className:"h-3.5 w-3.5 text-chip-indigo-text"}),y.jsx("span",{children:"Directory:"})]}),y.jsx(Qe,{text:"Select or type a directory path to scan files from.",suppress:p,children:y.jsx(Kx,{id:"directory-combobox",ariaLabel:"Directory",value:i,options:t,onChange:l,onOpenChange:g,placeholder:"/path/to/directory",className:"w-full",inputClassName:"font-mono"})}),f&&y.jsx(Qe,{text:"Open the active directory in the OS file manager",block:!1,children:y.jsx("button",{type:"button",onClick:f,"aria-label":"Open active directory",className:"btn btn-secondary shrink-0 p-1.5",children:y.jsx(KM,{className:"h-3.5 w-3.5"})})}),a&&y.jsx(Qe,{text:"Go to parent directory",block:!1,children:y.jsx("button",{type:"button",onClick:a,"aria-label":"Go to parent directory",className:"btn btn-secondary shrink-0 p-1.5",children:y.jsx(Vd,{className:"h-3.5 w-3.5 rotate-180"})})}),o&&y.jsx(Qe,{text:"Browse for a folder on this system",block:!1,children:y.jsx("button",{type:"button",onClick:o,"aria-label":"Browse directory",className:"btn btn-secondary shrink-0 p-1.5",children:y.jsx(Kl,{className:"h-3.5 w-3.5"})})}),d&&y.jsx(Qe,{text:"Open the active directory in a terminal",block:!1,children:y.jsx("button",{type:"button",onClick:()=>d(i),"aria-label":"Open directory in terminal",className:"btn btn-secondary shrink-0 p-1.5",children:y.jsx(Y0,{className:"h-3.5 w-3.5"})})}),c&&y.jsx(Qe,{text:"Set directory to your home folder",block:!1,children:y.jsx("button",{type:"button",onClick:c,"aria-label":"Go to home directory",className:"btn btn-secondary shrink-0 p-1.5",children:y.jsx(Qd,{className:"h-3.5 w-3.5"})})})]})]})}function V9({message:n,onRetry:e,retrying:t=!1}){return y.jsx("div",{className:"flex flex-1 items-center justify-center p-8",role:"alert","data-testid":"init-error-panel",children:y.jsxs("div",{className:"w-full max-w-sm rounded-xl border border-line bg-surface p-6 text-center shadow-xl",children:[y.jsx("div",{className:"mx-auto mb-3 flex h-10 w-10 items-center justify-center rounded-full border border-status-danger-border bg-status-danger-bg",children:y.jsx(Gu,{className:"h-5 w-5 text-status-danger-text/80"})}),y.jsx("h3",{className:"text-sm font-semibold text-ink",children:"Couldn't load the app"}),y.jsx("p",{className:"mt-1 break-words text-xs text-ink-secondary",children:n}),y.jsxs("button",{type:"button",onClick:e,disabled:t,className:"btn btn-primary mx-auto mt-4 px-3.5 py-1.5 font-semibold shadow-sm",children:[y.jsx(Xd,{className:`h-3.5 w-3.5 ${t?"animate-spin motion-reduce:animate-none":""}`}),y.jsx("span",{children:t?"Retrying...":"Retry"})]})]})})}const I2=/"([^"]*)"|(\S+)/g,U2=/"([^"]*)"/g,Q9="Unmatched quote";function X9(n){const e=[];let t;for(I2.lastIndex=0;(t=I2.exec(n))!==null;){const a=t[1]!==void 0?t[1]:t[2];a&&a.trim()&&e.push(a)}let i="",l=0;U2.lastIndex=0;let o;for(;(o=U2.exec(n))!==null;)i+=n.slice(l,o.index),l=o.index+o[0].length;return i+=n.slice(l),{terms:e,error:i.includes('"')?Q9:null}}function pA(n){const e=n.trim();if(!e)return{error:null,groups:[]};const{terms:t,error:i}=X9(e);if(t.length===0)return{error:i,groups:[]};const l=[];let o={includes:[],excludes:[]};for(const a of t){if(a.toUpperCase()==="OR"){l.push(o),o={includes:[],excludes:[]};continue}a==="-"||a==="+"||(a.startsWith("-")&&a.length>1?o.excludes.push(a.slice(1)):a.startsWith("+")&&a.length>1?o.includes.push(a.slice(1)):o.includes.push(a))}return l.push(o),{error:i,groups:l}}const $9=256,qs=new Map;function F2(n){return n.toLowerCase()}function G9(n){const e=qs.get(n);if(e)return qs.delete(n),qs.set(n,e),e;const{groups:t}=pA(n),i={groups:t.map(l=>({includes:l.includes.map(F2),excludes:l.excludes.map(F2)}))};if(qs.size>=$9){const l=qs.keys().next().value;l!==void 0&&qs.delete(l)}return qs.set(n,i),i}function Y9(n,e){return e.includes.every(t=>n.includes(t))&&!e.excludes.some(t=>n.includes(t))}function K9(n,e){const{groups:t}=G9(e);if(t.length===0)return!0;const i=n.toLowerCase();return t.some(l=>Y9(i,l))}function W9({query:n,visible:e}){if(!e)return null;const t=pA(n);return t.error?y.jsx("div",{"data-testid":"filter-syntax-helper",className:"pointer-events-none absolute left-0 right-0 top-full z-[var(--z-syntax-helper)] mt-1 rounded-md border border-status-danger-border bg-surface-strong px-3 py-2 text-[11px] leading-5 text-status-danger-text/90 shadow-xl",children:t.error}):t.groups.length===0?null:y.jsxs("div",{"data-testid":"filter-syntax-helper",className:"pointer-events-none absolute left-0 right-0 top-full z-[var(--z-syntax-helper)] mt-1 rounded-md border border-line bg-surface-strong px-3 py-2 text-[11px] leading-5 text-ink-secondary shadow-xl",children:[y.jsx("span",{className:"mr-1.5 align-[1px] text-[10px] uppercase tracking-wide text-ink-muted",children:"reads as"}),t.groups.map((i,l)=>y.jsxs("span",{"data-testid":"filter-syntax-group",children:[l>0&&y.jsx("span",{className:"mx-1 font-mono text-chip-indigo-text",children:"OR"}),i.includes.map((o,a)=>y.jsxs("span",{children:[a>0&&y.jsx("span",{className:"text-ink-muted",children:" · "}),y.jsx("span",{className:"font-mono text-chip-indigo-text",children:o})]},`i-${a}`)),i.includes.length>0&&i.excludes.length>0&&y.jsx("span",{className:"text-ink-muted",children:" · "}),i.excludes.map((o,a)=>y.jsxs("span",{children:[a>0&&y.jsx("span",{className:"text-ink-muted",children:" · "}),y.jsx("span",{className:"text-ink-muted",children:"✕ "}),y.jsx("span",{className:"font-mono text-status-danger-text/70 line-through",children:o})]},`x-${a}`))]},l))]})}const q2=y.jsxs("span",{className:"flex flex-col gap-1 whitespace-nowrap text-left",children:[y.jsx("span",{className:"font-semibold",children:"Supported operators"}),y.jsxs("span",{children:[y.jsx("code",{className:"font-mono text-chip-indigo-text",children:"a b"})," — AND (both terms)"]}),y.jsxs("span",{children:[y.jsx("code",{className:"font-mono text-chip-indigo-text",children:"a OR b"})," — either term"]}),y.jsxs("span",{children:[y.jsx("code",{className:"font-mono text-chip-indigo-text",children:"-a"})," — NOT (exclude)"]}),y.jsxs("span",{children:[y.jsx("code",{className:"font-mono text-chip-indigo-text",children:"+a"})," — force include"]}),y.jsxs("span",{children:[y.jsx("code",{className:"font-mono text-chip-indigo-text",children:'"a b"'})," — exact phrase"]})]});function Z9({extensions:n,activeExtension:e,onExtensionChange:t,filterOptions:i,filterText:l,onFilterTextChange:o,recursive:a,onRecursiveChange:c,onScan:f,scanning:d,barcodeMode:p,onBarcodeToggle:g,onCameraBarcodeClick:b,autoRescanActive:v,onTimerClick:w}){const[S,C]=R.useState(!1),[O,j]=R.useState(!1),[M,H]=R.useState(!1);return y.jsxs("div",{className:"flex w-full flex-wrap items-center gap-3 border-b border-line bg-surface-glass p-3 text-xs",children:[y.jsx(Qe,{text:q2,suppress:O,children:y.jsxs("div",{className:"relative min-w-0 flex-1 basis-64",onFocusCapture:P=>{P.target.tagName==="INPUT"&&C(!0)},onBlurCapture:P=>{P.target.tagName==="INPUT"&&C(!1)},children:[y.jsx(iO,{className:"pointer-events-none absolute left-3 top-1/2 z-10 h-4 w-4 -translate-y-1/2 text-ink-secondary"}),y.jsx(Kx,{id:"filter-combobox",ariaLabel:"File filter",value:l,options:i||[],onChange:o,onOpenChange:j,placeholder:"Filter files: keyword, a OR b, -tag, exact phrase...",className:"w-full",inputClassName:"pl-9 pr-3",optionLabel:P=>P||"(No filter)"}),y.jsx(W9,{query:l,visible:S&&!O&&l.trim().length>0})]})}),y.jsx(Qe,{text:q2,block:!1,suppress:M,children:y.jsxs("div",{className:"flex shrink-0 items-center gap-1.5",children:[y.jsx("span",{className:"text-ink-muted",children:"Ext:"}),y.jsx(Kx,{id:"extension-combobox",ariaLabel:"Extension filter",value:e,options:n,onChange:t,onOpenChange:H,placeholder:".py OR .toml",className:"w-44",inputClassName:"font-mono px-2.5"})]})}),y.jsx(Qe,{text:"Include subdirectories when scanning",block:!1,children:y.jsxs("label",{className:"flex shrink-0 cursor-pointer select-none items-center gap-1.5 text-ink-secondary",children:[y.jsx("input",{type:"checkbox",checked:a,onChange:P=>c(P.target.checked),className:"rounded border-line text-chip-indigo-text focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-indigo-500 focus-visible:ring-offset-1 focus-visible:ring-offset-app"}),y.jsx("span",{children:"Recursive"})]})}),y.jsx(Qe,{text:"Run the scan with the current criteria (Enter)",block:!1,children:y.jsxs("button",{onClick:f,disabled:d,className:"btn btn-primary shrink-0 px-3.5 py-1.5 font-semibold shadow-sm",children:[d?y.jsx(Xd,{className:"h-3.5 w-3.5 animate-spin motion-reduce:animate-none"}):y.jsx(Jl,{className:"h-3.5 w-3.5 fill-current"}),y.jsx("span",{children:d?"Scanning...":"Scan"})]})}),y.jsx(Qe,{text:v?"Auto-rescan is active. Click to configure.":"Configure periodic auto-rescan (hot-folder mode)",block:!1,children:y.jsx("button",{type:"button",onClick:w,"aria-label":"Configure timer / auto-rescan",className:`flex shrink-0 items-center justify-center rounded-md border p-1.5 text-ink-secondary hover:border-indigo-500 hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-indigo-500 transition-colors ${v?"border-chip-indigo-border bg-chip-indigo-bg text-chip-indigo-text":"border-line bg-elevated"}`,children:y.jsx(rO,{className:`h-3.5 w-3.5 ${v?"animate-pulse":""}`})})}),y.jsx(Qe,{text:"Toggle barcode scanner mode (USB HID). When active, scan a barcode to auto-fill controls and trigger a scan.",block:!1,children:y.jsx("button",{type:"button",onClick:g,"aria-label":p?"Disable barcode mode":"Enable barcode mode",className:`flex shrink-0 items-center justify-center rounded-md border p-1.5 text-ink-secondary hover:border-indigo-500 hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-indigo-500 transition-colors ${p?"border-chip-indigo-border bg-chip-indigo-bg text-chip-indigo-text":"border-line bg-elevated"}`,children:y.jsx(py,{className:`h-3.5 w-3.5 ${p?"animate-pulse":""}`})})}),b&&y.jsx(Qe,{text:"Scan barcode or QR code using webcam / camera (Ctrl + Shift + B)",block:!1,children:y.jsx("button",{type:"button",onClick:b,"aria-label":"Scan barcode with camera",className:"btn btn-secondary shrink-0 p-1.5",children:y.jsx(WC,{className:"h-3.5 w-3.5"})})})]})}const J9=2e3,e8=500,t8=[{value:null,label:"ALL"},{value:"DEBUG",label:"DEBUG"},{value:"INFO",label:"INFO"},{value:"WARNING",label:"WARNING"},{value:"ERROR",label:"ERROR"},{value:"CRITICAL",label:"CRITICAL"}],V2={DEBUG:{icon:t4,className:"text-chip-sky-text"},INFO:{icon:eO,className:"text-status-success-text"},WARNING:{icon:sO,className:"text-status-warning-text"},ERROR:{icon:X0,className:"text-status-danger-text"},CRITICAL:{icon:X0,className:"text-status-danger-text"},UNKNOWN:{icon:Ca,className:"text-ink-faint"}};function n8({isOpen:n,onClose:e,onOpenExternally:t}){const[i,l]=R.useState([]),[o,a]=R.useState("profiles.log"),[c,f]=R.useState(0),[d,p]=R.useState(null),[g,b]=R.useState(""),[v,w]=R.useState(!1),[S,C]=R.useState(!0),[O,j]=R.useState(null),[M,H]=R.useState(!0),P=R.useRef(null),A=R.useRef(null),T=R.useRef(null),z=R.useRef(null),ne=R.useRef(S),F=R.useRef({level:d,search:g});ne.current=S,F.current={level:d,search:g};const W=R.useCallback(async()=>{const{level:L,search:ee}=F.current;w(!0);try{const se=await bM({limit:e8,level:L,search:ee});l(se.entries),a(se.path),f(se.size_bytes),j(null)}catch(se){j((se==null?void 0:se.message)||"Failed to read the log file")}finally{w(!1)}},[]);R.useEffect(()=>{n&&W()},[n,W]),R.useEffect(()=>{if(!n||!S)return;const L=window.setInterval(()=>{W()},J9);return()=>window.clearInterval(L)},[n,S,W]),R.useEffect(()=>{if(!n)return;const L=window.setTimeout(()=>void W(),250);return()=>window.clearTimeout(L)},[n,d,g,W]),R.useEffect(()=>{if(!M)return;const L=T.current;L&&(L.scrollTop=L.scrollHeight)},[i,M]),R.useEffect(()=>{if(!n)return;const L=document.activeElement instanceof HTMLElement?document.activeElement:null,ee=requestAnimationFrame(()=>{var se;return(se=A.current)==null?void 0:se.focus()});return()=>{cancelAnimationFrame(ee),L==null||L.focus()}},[n]);const U=L=>{var E;if(L.key==="Escape"){L.preventDefault(),e();return}if(L.key!=="Tab")return;const ee=(E=P.current)==null?void 0:E.querySelectorAll('button:not([disabled]), input:not([disabled]), [tabindex]:not([tabindex="-1"])');if(!(ee!=null&&ee.length))return;const se=ee[0],le=ee[ee.length-1];L.shiftKey&&document.activeElement===se?(L.preventDefault(),le.focus()):!L.shiftKey&&document.activeElement===le&&(L.preventDefault(),se.focus())},re=()=>{const L=T.current;if(!L)return;const ee=L.scrollHeight-L.scrollTop-L.clientHeight<24;H(ee)},de=async()=>{try{await navigator.clipboard.writeText(i.map(L=>L.raw).join(` -`))}catch{}},ie=R.useMemo(()=>{const L=new Map;for(const ee of i)L.set(ee.level,(L.get(ee.level)??0)+1);return L},[i]);return n?y.jsx("div",{className:"animate-overlay-in fixed inset-0 z-[var(--z-modal)] flex items-center justify-center bg-black/65 p-3 backdrop-blur-sm sm:p-6",onClick:e,children:y.jsxs("div",{ref:P,role:"dialog","aria-modal":"true","aria-labelledby":"log-viewer-title",onKeyDown:U,className:"animate-modal-in flex h-[min(84dvh,760px)] w-[clamp(560px,85vw,1500px)] min-h-0 flex-col overflow-hidden rounded-xl border border-frame-line glass-panel sm:rounded-2xl",onClick:L=>L.stopPropagation(),children:[y.jsxs("div",{className:"flex flex-wrap items-center gap-3 border-b border-line px-5 py-4 sm:px-6",children:[y.jsxs("div",{className:"flex min-w-0 items-center gap-3",children:[y.jsx("span",{className:"grid h-10 w-10 shrink-0 place-items-center rounded-lg bg-chip-indigo-bg",children:y.jsx(Ca,{className:"h-5 w-5 text-chip-indigo-text","aria-hidden":"true"})}),y.jsxs("div",{className:"min-w-0",children:[y.jsx("h2",{id:"log-viewer-title",className:"text-base font-semibold text-ink",children:"Application logs"}),y.jsxs("p",{className:"truncate font-mono text-xs text-ink-muted",children:[o,y.jsxs("span",{className:"text-ink-faint",children:[" · ",Q2(c)]})]})]})]}),y.jsxs("div",{className:"relative min-w-[220px] flex-1",children:[y.jsx(iO,{className:"pointer-events-none absolute left-2.5 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-ink-faint","aria-hidden":"true"}),y.jsx("input",{ref:z,type:"search",value:g,onChange:L=>b(L.target.value),placeholder:"Filter log lines…","aria-label":"Filter log lines",className:"w-full rounded-lg border border-line bg-elevated py-1.5 pl-8 pr-2.5 font-mono text-xs text-ink placeholder:text-ink-faint focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-indigo-400"})]}),y.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[y.jsx(Qe,{text:S?"Pause live tail":"Resume live tail",block:!1,children:y.jsxs("button",{type:"button",onClick:()=>C(L=>!L),"aria-pressed":S,className:`flex items-center gap-1.5 rounded-lg border px-2.5 py-1.5 text-xs font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-indigo-400 ${S?"border-status-success-border bg-status-success-bg text-status-success-text":"border-line bg-elevated text-ink-muted hover:text-ink"}`,children:[y.jsx("span",{className:`h-2 w-2 rounded-full ${S?"bg-emerald-400":"bg-ink-faint"}`,"aria-hidden":"true"}),S?"Live":"Paused"]})}),y.jsx(Qe,{text:"Refresh now",block:!1,children:y.jsx("button",{type:"button",onClick:()=>void W(),disabled:v,className:"rounded-lg border border-line bg-elevated p-2 text-ink-muted hover:text-ink disabled:opacity-50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-indigo-400",children:y.jsx(Xd,{className:`h-4 w-4 ${v?"animate-spin":""}`,"aria-hidden":"true"})})}),y.jsx(Qe,{text:"Copy visible lines",block:!1,children:y.jsx("button",{type:"button",onClick:()=>void de(),disabled:i.length===0,className:"rounded-lg border border-line bg-elevated p-2 text-ink-muted hover:text-ink disabled:opacity-50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-indigo-400",children:y.jsx(si,{className:"h-4 w-4","aria-hidden":"true"})})}),y.jsx(Qe,{text:"Open log file in the default application",block:!1,children:y.jsx("button",{type:"button",onClick:()=>{t==null||t(),e()},className:"rounded-lg border border-line bg-elevated p-2 text-ink-muted hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-indigo-400",children:y.jsx(JC,{className:"h-4 w-4","aria-hidden":"true"})})}),y.jsx(Qe,{text:"Close",block:!1,children:y.jsx("button",{ref:A,type:"button",onClick:e,className:"rounded-lg p-2 text-ink-muted hover:bg-hover-surface hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-indigo-400",children:y.jsx(Ui,{className:"h-4 w-4","aria-hidden":"true"})})})]})]}),y.jsxs("div",{ref:T,onScroll:re,className:"min-h-0 flex-1 overflow-y-auto overscroll-contain bg-app px-2 py-2 font-mono text-xs leading-relaxed sm:px-3",children:[y.jsxs("div",{className:"sticky top-0 z-10 mb-1 flex items-center gap-2 rounded-md border border-line/40 bg-surface/60 px-2 py-1 text-[10px] font-bold uppercase tracking-wider text-ink-muted shadow-sm backdrop-blur-md",role:"row",children:[y.jsx("span",{className:"h-3.5 w-3.5 shrink-0","aria-hidden":"true"}),y.jsx("span",{className:"w-[138px] shrink-0 text-ink/70",children:"Time"}),y.jsx("span",{className:"w-[52px] shrink-0 text-ink/70",children:"Level"}),y.jsx("span",{className:"w-[150px] shrink-0 text-ink/70",children:"Source"}),y.jsx("span",{className:"min-w-0 flex-1 text-ink/70",children:"Message"})]}),O&&y.jsx("p",{role:"alert",className:"px-3 py-6 text-center text-xs text-status-danger-text",children:O}),!O&&i.length===0&&!v&&y.jsx("p",{className:"px-3 py-6 text-center text-xs text-ink-faint",children:"No log entries match the current filters."}),y.jsx("ul",{className:"space-y-0.5",children:i.map((L,ee)=>{const se=V2[L.level]??V2.UNKNOWN,le=se.icon,E=L.level==="ERROR"||L.level==="CRITICAL";return y.jsxs("li",{className:`group flex items-start gap-2 rounded px-2 py-1 ${E?"bg-status-danger-bg/40":"hover:bg-elevated/50"}`,children:[y.jsx("span",{className:se.className,children:y.jsx(le,{className:"mt-0.5 h-3.5 w-3.5","aria-hidden":"true"})}),y.jsx("span",{className:"w-[138px] shrink-0 text-ink-faint",children:L.timestamp}),y.jsx("span",{className:`w-[52px] shrink-0 text-[10px] font-semibold ${se.className}`,children:L.level}),y.jsx("span",{className:"w-[150px] shrink-0 truncate text-ink-faint",title:L.source,children:L.source}),y.jsx("span",{className:"min-w-0 flex-1 break-words text-ink-secondary",children:L.message})]},`${ee}-${L.raw}`)})})]}),y.jsx("div",{className:"border-t border-line/60 bg-elevated/50 px-5 py-2.5 text-[11px] text-ink-faint shadow-sm backdrop-blur-md sm:px-6",children:y.jsxs("div",{className:"flex flex-wrap items-center gap-x-4 gap-y-2",children:[y.jsx("span",{className:"mr-auto min-w-0 max-w-full basis-full truncate sm:basis-auto",role:"status","aria-atomic":"true",children:v&&i.length===0?"Loading log entries…":`${i.length} of ${Q2(c)} shown`}),y.jsxs("div",{className:"flex items-center gap-2",children:[y.jsx("div",{className:"flex overflow-hidden rounded-lg border border-line/60 text-[11px] backdrop-blur-sm",role:"group","aria-label":"Filter by log level",children:t8.map(L=>{const ee=d===L.value,se=L.value?ie.get(L.value)??0:i.length;return y.jsxs("button",{type:"button",onClick:()=>p(L.value),"aria-pressed":ee,title:L.value?`Show ${L.value} and above`:"Show all levels",className:`flex items-center gap-1 px-2.5 py-1 font-semibold transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-indigo-400 ${ee?"bg-indigo-600 text-white":"text-ink-muted hover:bg-elevated hover:text-ink"}`,children:[L.label,y.jsx("span",{className:ee?"text-chip-indigo-text":"text-ink-faint",children:se})]},L.label)})}),y.jsx(Qe,{text:"Scroll to the newest entry",block:!1,children:y.jsxs("button",{type:"button",onClick:()=>H(!0),"aria-pressed":M,className:`flex items-center gap-1.5 rounded-lg border px-2.5 py-1 text-xs font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-indigo-400 ${M?"border-chip-indigo-border bg-chip-indigo-bg text-chip-indigo-text":"border-line bg-elevated text-ink-muted hover:text-ink"}`,children:[y.jsx(KC,{className:"h-3.5 w-3.5","aria-hidden":"true"}),y.jsx("span",{className:"hidden sm:inline",children:"Follow tail"})]})})]}),y.jsxs("span",{className:"hidden items-center gap-1.5 lg:flex",children:[y.jsx("span",{className:"hidden sm:inline",children:"Ctrl + Shift + L"}),y.jsx("span",{children:"opens externally"})]})]})})]})}):null}function Q2(n){return n<1024?`${n} B`:n<1024*1024?`${(n/1024).toFixed(1)} KB`:`${(n/(1024*1024)).toFixed(1)} MB`}function i8({isOpen:n,onClose:e}){const t=R.useRef(null),i=cs({isOpen:n,onClose:e,dialogRef:t});if(!n)return null;const l=[{key:"F5",desc:"Refresh / re-scan file list"},{key:"Ctrl + R",desc:"Reload configuration & scan"},{key:"Enter",desc:"Execute / launch selected file"},{key:"P",desc:"Open properties for selected file"},{key:"↑ / ↓",desc:"Navigate file list"},{key:"Home / End",desc:"Jump to first / last file"},{key:"PageUp / PageDown",desc:"Page through the file list"},{key:"Ctrl + D",desc:"Focus Directory field"},{key:"Ctrl + E",desc:"Focus Extension field"},{key:"Ctrl + F",desc:"Focus Filter / Search field"},{key:"Ctrl + L",desc:"Focus File List"},{key:"Ctrl + Shift + L",desc:"Open the log viewer"},{key:"Ctrl + ,",desc:"Open the config editor"},{key:"Ctrl + Shift + T",desc:"Toggle theme (Dark / Light)"},{key:"Ctrl + B",desc:"Toggle barcode scanner mode"},{key:"Ctrl + Shift + B",desc:"Open webcam / camera barcode scanner"},{key:"Ctrl + T",desc:"Open auto-rescan timer modal"},{key:"Ctrl + H",desc:"Set directory to home folder"},{key:"? or Ctrl + /",desc:"Show keyboard shortcuts"},{key:"Y / S / N",desc:"Answer workflow guard: Yes / Skip / No (prompt open)"},{key:"Enter",desc:"Confirm active workflow prompt (prompt open)"},{key:"Escape",desc:"Close dialogs / context menu"}];return y.jsx("div",{className:"animate-overlay-in fixed inset-0 z-[var(--z-modal)] flex items-center justify-center bg-black/60 p-4 backdrop-blur-sm",children:y.jsxs("div",{ref:t,role:"dialog","aria-modal":"true","aria-label":"Keyboard Shortcuts",onKeyDown:i,className:"animate-modal-in w-[450px] max-w-full rounded-2xl border border-frame-line glass-panel p-5",children:[y.jsxs("div",{className:"mb-4 flex items-center justify-between border-b border-line pb-3",children:[y.jsxs("div",{className:"flex items-center gap-2 font-semibold text-ink",children:[y.jsx(tO,{className:"h-5 w-5 text-chip-indigo-text"}),y.jsx("span",{children:"Keyboard Shortcuts"})]}),y.jsx("button",{onClick:e,className:"focus-ring rounded-lg p-1 text-ink-muted hover:bg-elevated hover:text-ink",children:y.jsx(Ui,{className:"h-4 w-4"})})]}),y.jsx("div",{className:"max-h-[60vh] space-y-2 overflow-y-auto pr-1 text-xs",children:l.map(({key:o,desc:a})=>y.jsxs("div",{className:"flex items-center justify-between rounded-lg bg-elevated/50 px-3 py-2",children:[y.jsx("span",{className:"text-ink-secondary",children:a}),y.jsx("kbd",{className:"rounded bg-app px-2 py-0.5 font-mono text-[11px] font-semibold text-chip-indigo-text border border-line",children:o})]},o))}),y.jsx("div",{className:"mt-5 flex justify-end",children:y.jsx("button",{onClick:e,className:"btn btn-primary rounded-lg px-4 py-2 font-semibold",children:"Close"})})]})})}function r8({isOpen:n,activeConfigPath:e,configExists:t=!0,onClose:i,onLoaded:l}){const[o,a]=R.useState(null),[c,f]=R.useState(""),[d,p]=R.useState(null),[g,b]=R.useState(!1),[v,w]=R.useState(null),S=R.useRef(null),C=R.useRef(null),O=R.useRef(null),j=t===!1;R.useEffect(()=>{var W;if(!n){(W=O.current)==null||W.focus();return}O.current=document.activeElement instanceof HTMLElement?document.activeElement:null,w(null);const T=e??"",z=Math.max(T.lastIndexOf("/"),T.lastIndexOf("\\")),ne=z>0?T.slice(0,z):"";M(ne);const F=requestAnimationFrame(()=>{var U;return(U=C.current)==null?void 0:U.focus()});return()=>{var U;cancelAnimationFrame(F),(U=O.current)==null||U.focus()}},[n,e]);const M=async T=>{b(!0),w(null);try{const z=await AM(T);a(z),f(z.current_path),e&&z.items.some(ne=>ne.path===e)?p(e):p(null)}catch(z){w(z.message||"Navigation failed")}finally{b(!1)}},H=T=>{var W;if(T.key==="Escape"){T.preventDefault(),i();return}if(T.key!=="Tab")return;const z=(W=S.current)==null?void 0:W.querySelectorAll('button:not([disabled]), input:not([disabled]), [tabindex]:not([tabindex="-1"])');if(!(z!=null&&z.length))return;const ne=z[0],F=z[z.length-1];T.shiftKey&&document.activeElement===ne?(T.preventDefault(),F.focus()):!T.shiftKey&&document.activeElement===F&&(T.preventDefault(),ne.focus())},P=async()=>{var z;const T=d||(((z=o==null?void 0:o.items.find(ne=>ne.is_config))==null?void 0:z.path)??null);if(!T){w("Select a configuration file to load.");return}try{b(!0);const ne=await kM(T);l(ne),i()}catch(ne){w(ne.message||"Unable to load configuration")}finally{b(!1)}},A=async()=>{const T=(c||(o==null?void 0:o.current_path)||"").trim();if(!T){w("Choose a directory before creating a configuration.");return}try{b(!0);const z=await CM(T);l(z),i()}catch(z){w(z.message||"Unable to create configuration")}finally{b(!1)}};return n?y.jsx("div",{className:"animate-overlay-in fixed inset-0 z-[var(--z-modal)] flex items-center justify-center bg-black/65 p-3 backdrop-blur-sm sm:p-6",onClick:i,children:y.jsxs("div",{ref:S,role:"dialog","aria-modal":"true","aria-labelledby":"load-config-title",onKeyDown:H,className:"animate-modal-in flex h-[min(84dvh,760px)] max-h-[calc(100dvh-1.5rem)] w-[min(94vw,960px)] min-h-0 flex-col overflow-hidden rounded-xl border border-frame-line glass-panel sm:rounded-2xl",onClick:T=>T.stopPropagation(),children:[y.jsxs("div",{className:"flex items-center justify-between gap-3 border-b border-line px-4 py-3 sm:px-5",children:[y.jsxs("div",{className:"flex min-w-0 items-center gap-2.5",children:[y.jsx("span",{className:"grid h-9 w-9 shrink-0 place-items-center rounded-lg bg-chip-indigo-bg",children:y.jsx(aa,{className:"h-5 w-5 text-chip-indigo-text"})}),y.jsxs("div",{className:"min-w-0",children:[y.jsx("h2",{id:"load-config-title",className:"text-sm font-semibold text-ink",children:j?"Create configuration":"Load configuration"}),y.jsx("p",{className:"truncate font-mono text-xs text-ink-muted",children:(o==null?void 0:o.current_path)||""})]})]}),y.jsx(Qe,{text:"Close",block:!1,children:y.jsx("button",{type:"button",onClick:i,"aria-label":"Close configuration modal",className:"grid h-9 w-9 shrink-0 place-items-center rounded-lg text-ink-muted transition-colors hover:bg-elevated hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-indigo-400",children:y.jsx(Ui,{className:"h-4 w-4"})})})]}),j&&y.jsx("div",{className:"border-b border-line bg-chip-indigo-bg/20 px-4 py-3 text-xs text-ink-secondary",children:"No configuration file was found. Create one here?"}),y.jsxs("div",{className:"border-b border-line px-4 py-3 sm:px-5",children:[y.jsx("label",{htmlFor:"config-path-input",className:"mb-1.5 block text-xs font-medium text-ink-secondary",children:"Configuration directory"}),y.jsxs("div",{className:"flex min-w-0 items-center gap-1.5",children:[y.jsx("input",{ref:C,id:"config-path-input",type:"text",value:c,onChange:T=>f(T.target.value),onKeyDown:T=>{T.key==="Enter"&&M(c.trim())},placeholder:"/path/to/directory",className:"h-10 min-w-0 flex-1 rounded-lg border border-line bg-elevated px-2.5 font-mono text-sm text-ink outline-none placeholder:text-ink-faint transition-colors hover:bg-surface-strong focus-visible:border-indigo-500 focus-visible:ring-2 focus-visible:ring-indigo-500/30"}),y.jsx("button",{type:"button",onClick:()=>M(c.trim()),className:"inline-flex h-10 shrink-0 items-center gap-1.5 rounded-lg border border-line bg-elevated px-3.5 text-sm font-medium text-ink-secondary transition-colors hover:bg-surface-strong hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-indigo-400",children:"Go"}),y.jsx(Qe,{text:"Home directory",block:!1,children:y.jsx("button",{type:"button",onClick:()=>M(""),"aria-label":"Home directory",className:"grid h-10 w-10 shrink-0 place-items-center rounded-lg border border-line bg-elevated text-ink-secondary transition-colors hover:bg-surface-strong hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-indigo-400",children:y.jsx(Qd,{className:"h-4 w-4"})})}),(o==null?void 0:o.parent_path)&&y.jsx(Qe,{text:"Parent directory",block:!1,children:y.jsx("button",{type:"button",onClick:()=>M(o.parent_path),"aria-label":"Parent directory",className:"grid h-10 w-10 shrink-0 place-items-center rounded-lg border border-line bg-elevated text-ink-secondary transition-colors hover:bg-surface-strong hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-indigo-400",children:y.jsx(Vd,{className:"h-4 w-4 rotate-180"})})})]})]}),y.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto px-2 py-2 sm:px-3 sm:py-3","aria-busy":g,children:g?y.jsxs("div",{className:"flex h-full items-center justify-center gap-2.5 text-sm text-ink-muted",children:[y.jsx(Zl,{className:"h-5 w-5 animate-spin text-chip-indigo-text"}),y.jsx("span",{role:"status",children:"Loading configuration files…"})]}):v?y.jsxs("div",{role:"alert",className:"flex h-full flex-col items-center justify-center gap-2.5 text-center",children:[y.jsx("p",{className:"text-sm text-status-danger-text",children:v}),y.jsx("button",{type:"button",onClick:()=>M(c||(o==null?void 0:o.current_path)||""),className:"min-h-10 rounded-lg border border-line bg-elevated px-3.5 text-sm text-ink-secondary hover:bg-surface-strong hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-indigo-400",children:"Retry"})]}):y.jsxs("ul",{className:"space-y-1",children:[o==null?void 0:o.items.map(T=>{if(T.is_dir)return y.jsx("li",{children:y.jsx("button",{onClick:()=>M(T.path),onDoubleClick:()=>M(T.path),className:"flex w-full items-center justify-between rounded-md px-3 py-1.5 text-left text-xs text-ink-secondary hover:bg-elevated",children:y.jsxs("span",{className:"flex items-center gap-2",children:[y.jsx(Sc,{className:"h-3.5 w-3.5 text-chip-indigo-text"}),T.name]})})},T.path);const z=d===T.path;return y.jsx("li",{children:y.jsxs("button",{type:"button",onClick:()=>p(T.path),"aria-pressed":z,className:`flex w-full items-center justify-between rounded-lg px-3 py-1.5 text-left text-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-indigo-400 ${z?"bg-chip-indigo-bg text-chip-indigo-text":"text-ink-secondary hover:bg-elevated hover:text-ink"}`,children:[y.jsxs("span",{className:"flex min-w-0 items-center gap-2.5",children:[y.jsx(Ca,{className:"h-5 w-5 shrink-0 text-chip-amber-text"}),y.jsx("span",{className:"truncate",children:T.name})]}),T.is_config&&y.jsx(aa,{className:"h-4 w-4 shrink-0 text-chip-indigo-text"}),z&&y.jsx(il,{className:"h-4 w-4 shrink-0 text-chip-indigo-text"})]})},T.path)}),(o==null?void 0:o.items.filter(T=>T.is_config).length)===0&&y.jsxs("li",{className:"flex h-full min-h-36 flex-col items-center justify-center gap-2.5 text-center text-sm text-ink-muted",children:[y.jsx(Ca,{className:"h-7 w-7 text-ink-faint"}),"No configuration files found"]})]})}),y.jsxs("div",{className:"flex flex-col gap-2 border-t border-line px-4 py-3 sm:flex-row sm:items-center sm:justify-between sm:px-5",children:[y.jsxs("div",{className:"min-w-0 flex-1",children:[y.jsx("p",{className:"mb-0.5 text-xs font-medium text-ink-muted",children:"Selected file"}),y.jsx("p",{className:"truncate font-mono text-sm text-ink",title:d||c,children:d||c||"—"})]}),y.jsxs("div",{className:"flex shrink-0 justify-end gap-1.5",children:[y.jsx("button",{type:"button",onClick:i,className:"min-h-10 rounded-lg border border-line bg-elevated px-3.5 text-sm text-ink-secondary transition-colors hover:bg-surface-strong hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-indigo-400",children:"Cancel"}),j?y.jsxs("button",{type:"button",onClick:A,disabled:!c.trim(),className:"btn btn-primary min-h-10 rounded-lg px-4 text-sm font-semibold",children:[y.jsx(aa,{className:"h-4 w-4"}),"Create configuration"]}):y.jsxs("button",{type:"button",onClick:P,disabled:!d,className:"btn btn-primary min-h-10 rounded-lg px-4 text-sm font-semibold",children:[y.jsx(aa,{className:"h-4 w-4"}),"Load configuration"]})]})]})]})}):null}function mA({isOpen:n,onClose:e,initialFilePath:t,md5:i}){const[l,o]=R.useState(null),[a,c]=R.useState(""),[f,d]=R.useState([]),[p,g]=R.useState(!1),[b,v]=R.useState(null),[w,S]=R.useState(!1),[C,O]=R.useState(!1),[j,M]=R.useState(null),H=R.useRef(null),P=cs({isOpen:n,onClose:e,dialogRef:H});R.useEffect(()=>{if(!n)return;async function ie(){if(t){g(!0);try{const L=await Hk({filePath:t});o(L.image),c(L.content),A(L.content)}catch(L){v(L.message)}finally{g(!1)}}}ie()},[n,t]);const A=ie=>{const L=ie.split(";").map(ee=>{const se=ee.split("=");return{key:se[0]||"",value:se[1]||""}}).filter(ee=>ee.key||ee.value);d(L)},T=async ie=>{const L=ie.filter(ee=>ee.key.trim()).map(ee=>`${ee.key.trim()}=${ee.value.trim()}`).join(";");if(c(L),!L){o(null);return}try{const ee=await Hk({content:L});o(ee.image)}catch(ee){console.error("Failed to re-generate barcode:",ee)}},z=(ie,L,ee)=>{const se=[...f];se[ie][L]=ee,d(se),T(se)},ne=()=>{const ie=[...f,{key:"",value:""}];d(ie)},F=ie=>{const L=f.filter((ee,se)=>se!==ie);d(L),T(L)},W=()=>{if(!i||f.some(L=>L.key.toLowerCase()==="md5"))return;const ie=[...f,{key:"md5",value:i}];d(ie),T(ie)},U=async()=>{if(l){M("Saving…");try{const ie=await _M(l,`profiles-qr-${Date.now()}.png`);M(ie.path||ie.message)}catch(ie){M(`Save failed: ${(ie==null?void 0:ie.message)??ie}`)}finally{setTimeout(()=>M(null),6e3)}}},re=async()=>{try{await navigator.clipboard.writeText(a),S(!0),setTimeout(()=>S(!1),2e3)}catch(ie){console.error("Copy failed",ie)}},de=async()=>{if(l)try{const L=await(await fetch(l)).blob();await navigator.clipboard.write([new ClipboardItem({[L.type]:L})]),O(!0),setTimeout(()=>O(!1),2e3)}catch(ie){console.error("Image copy failed",ie)}};return n?y.jsx("div",{className:"animate-overlay-in fixed inset-0 z-[var(--z-modal)] flex items-center justify-center bg-black/60 p-4",onClick:e,children:y.jsxs("div",{ref:H,role:"dialog","aria-modal":"true","aria-label":"QR Code Settings",onKeyDown:P,className:"animate-modal-in w-full max-w-md rounded-xl border border-frame-line glass-panel p-6",onClick:ie=>ie.stopPropagation(),children:[y.jsxs("div",{className:"mb-4 flex items-center justify-between",children:[y.jsx("h3",{className:"text-sm font-semibold text-ink",children:"QR Code Settings"}),y.jsx("button",{onClick:e,className:"focus-ring rounded-md p-1 text-ink-muted hover:bg-elevated hover:text-ink",children:y.jsx(Ui,{className:"h-4 w-4"})})]}),p?y.jsx("div",{className:"flex h-48 items-center justify-center",children:y.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-2 border-indigo-600 border-t-transparent"})}):b?y.jsx("div",{className:"rounded-md border border-status-danger-border bg-status-danger-bg p-4 text-center text-xs text-status-danger-text",children:b}):y.jsxs("div",{className:"space-y-6",children:[y.jsxs("div",{className:"flex flex-col items-center gap-4",children:[y.jsxs("div",{className:"relative group",children:[y.jsx("div",{className:"h-48 w-48 overflow-hidden rounded-lg border border-line bg-white p-2",children:l?y.jsx("img",{src:l,alt:"QR Code",className:"h-full w-full object-contain"}):y.jsx("div",{className:"flex h-full items-center justify-center text-xs text-slate-400",children:"No content"})}),l&&y.jsx("div",{className:"absolute inset-0 flex items-center justify-center opacity-0 group-hover:opacity-100 transition-opacity bg-black/20 rounded-lg",children:y.jsxs("button",{onClick:de,className:"focus-ring flex items-center gap-2 rounded-md bg-white/90 p-2 text-xs font-medium text-slate-900 shadow-sm hover:bg-white",children:[C?y.jsx(il,{className:"h-3.5 w-3.5"}):y.jsx(si,{className:"h-3.5 w-3.5"}),C?"Copied":"Copy Image"]})})]}),y.jsxs("div",{className:"flex w-full gap-2",children:[y.jsxs("button",{onClick:re,className:"btn btn-secondary flex-1 px-3 py-1.5",children:[w?y.jsx(il,{className:"h-3.5 w-3.5 text-status-success-text"}):y.jsx(si,{className:"h-3.5 w-3.5"}),"Copy Content"]}),y.jsxs("button",{onClick:U,disabled:!l,className:"btn btn-primary flex-1 px-3 py-1.5",children:[y.jsx(ZC,{className:"h-3.5 w-3.5"}),"Save Image"]})]}),j&&y.jsx("p",{className:"break-all text-center text-[11px] text-ink-muted",role:"status",children:j})]}),y.jsxs("div",{className:"space-y-3",children:[y.jsxs("div",{className:"flex items-center justify-between",children:[y.jsx("label",{className:"text-xs font-medium text-ink-muted uppercase tracking-wider",children:"Payload Fields"}),y.jsxs("div",{className:"flex gap-2",children:[i&&!f.some(ie=>ie.key==="md5")&&y.jsxs("button",{onClick:W,className:"btn-chip flex items-center gap-1 rounded px-2 py-0.5 text-[10px] font-bold text-chip-purple-text border border-chip-purple-border",children:[y.jsx(ua,{className:"h-3 w-3"})," Inc. MD5"]}),y.jsxs("button",{onClick:ne,className:"btn-chip flex items-center gap-1 rounded px-2 py-0.5 text-[10px] font-bold text-chip-indigo-text border border-chip-indigo-border",children:[y.jsx(iD,{className:"h-3 w-3"})," Add Field"]})]})]}),y.jsxs("div",{className:"max-h-48 space-y-2 overflow-y-auto pr-1 custom-scrollbar",children:[f.map((ie,L)=>y.jsxs("div",{className:"flex gap-2 items-center slide-in",children:[y.jsx("input",{type:"text",placeholder:"key",value:ie.key,onChange:ee=>z(L,"key",ee.target.value),className:"w-1/3 rounded border border-line bg-elevated px-2 py-1 text-xs text-ink focus:border-indigo-500 focus:outline-none"}),y.jsx("input",{type:"text",placeholder:"value",value:ie.value,onChange:ee=>z(L,"value",ee.target.value),className:"flex-1 rounded border border-line bg-elevated px-2 py-1 text-xs text-ink focus:border-indigo-500 focus:outline-none"}),y.jsx("button",{onClick:()=>F(L),className:"p-1 text-ink-muted hover:text-status-danger-text transition-colors","aria-label":"Remove field",children:y.jsx(lO,{className:"h-3.5 w-3.5"})})]},L)),f.length===0&&y.jsx("p",{className:"text-center py-4 text-xs text-ink-muted italic",children:"No fields defined"})]})]}),y.jsxs("div",{className:"pt-2 border-t border-line",children:[y.jsx("label",{className:"text-[10px] font-medium text-ink-muted uppercase tracking-wider block mb-1.5",children:"Raw Preview"}),y.jsx("div",{className:"rounded bg-elevated p-2 font-mono text-[10px] text-ink-secondary break-all border border-line",children:a||y.jsx("span",{className:"italic text-ink-muted/50",children:"empty"})})]})]})]})}):null}const X2=["Bytes","KB","MB","GB","TB"];function gA(n){if(n===0)return"0 Bytes";const e=1024,t=Math.max(0,Math.min(X2.length-1,Math.floor(Math.log(n)/Math.log(e))));return parseFloat((n/Math.pow(e,t)).toFixed(2))+" "+X2[t]}function l8(n){const e=Math.max(n.lastIndexOf("\\"),n.lastIndexOf("/"));return e===-1?"":n.slice(0,e)}function s8(n){const e=[`File Properties: ${n.name}`,`Path: ${n.path}`,`Type: ${n.type}`,`Size: ${gA(n.size_bytes)}`,`Created: ${n.created}`,`Modified: ${n.modified}`];return n.md5&&e.push(`MD5: ${n.md5}`),n.sha256&&e.push(`SHA256: ${n.sha256}`),e.join(` -`)}function A0(n,e,t){return n.length<=e+t+1?n:`${n.slice(0,e)}…${n.slice(-t)}`}function o8(n){const e=n.includes("\\")?"\\":"/",t=n.split(/[\\/]/);return t.length<=5?n:[t[0],t[1],"…",t[t.length-2],t[t.length-1]].join(e)}const a8=[{ms:1e3*60,unit:"minute"},{ms:1e3*60*60,unit:"hour"},{ms:1e3*60*60*24,unit:"day"},{ms:1e3*60*60*24*30,unit:"month"},{ms:1e3*60*60*24*365,unit:"year"}];function $2(n,e=new Date){const t=new Date(n.replace(" ","T"));if(Number.isNaN(t.getTime()))return"just now";const i=e.getTime()-t.getTime();if(i<6e4)return"just now";let l="just now";for(const{ms:o,unit:a}of a8){if(i{var U;n||((U=M.current)==null||U.focus(),v(!1))},[n]),R.useEffect(()=>{if(!n||!e)return;const U=new AbortController;return H.current=U,o(null),O(null),c(!0),d(null),(async()=>{try{const re=await RM(e.path,U.signal);if(H.current!==U)return;o(re)}catch(re){if(H.current!==U||re instanceof DOMException&&re.name==="AbortError")return;d(re instanceof Error?re.message:"Failed to load properties")}finally{H.current===U&&c(!1)}})(),()=>{H.current=null,U.abort()}},[n,e]),R.useEffect(()=>{if(!n)return;const U=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=U}},[n]),R.useEffect(()=>{if(!n)return;const U=re=>{if(re.key==="Escape"){if(b)return;t();return}if(re.key!=="Tab")return;const de=j.current;if(!de)return;const ie=Array.from(de.querySelectorAll('button:not([disabled]), [href], input, select, textarea, [tabindex]:not([tabindex="-1"])')).filter(le=>le.offsetParent!==null);if(ie.length===0)return;const L=ie[0],ee=ie[ie.length-1],se=document.activeElement instanceof HTMLElement?document.activeElement:null;re.shiftKey?(se===L||!de.contains(se))&&(re.preventDefault(),ee.focus()):se===ee&&(re.preventDefault(),L.focus())};return window.addEventListener("keydown",U),()=>window.removeEventListener("keydown",U)},[n,b,t]),R.useEffect(()=>{if(!n)return;const U=document.activeElement instanceof HTMLElement?document.activeElement:null;M.current=U;const re=requestAnimationFrame(()=>{var de,ie;(ie=(de=j.current)==null?void 0:de.querySelector("button"))==null||ie.focus()});return()=>cancelAnimationFrame(re)},[n]);const P=async(U,re)=>{try{await navigator.clipboard.writeText(U),g(re),setTimeout(()=>g(null),2e3)}catch(de){console.error("Failed to copy:",de)}},A=async(U,re,de)=>{S(U),O(null);try{await de(),O(re)}catch{O("Action failed")}finally{S(null)}},T=U=>`btn btn-chip rounded-md border px-3 py-2 text-xs ${{reveal:"bg-chip-sky-bg text-chip-sky-text border-chip-sky-border",launch:"border-emerald-500/30 bg-emerald-600 font-semibold text-white hover:bg-emerald-500",folder:"bg-chip-amber-bg text-chip-amber-text border-chip-amber-border"}[U]??"bg-chip-indigo-bg text-chip-indigo-text border-chip-indigo-border"}`,z=(U,re,de,ie=!1,L)=>y.jsxs("div",{className:"flex items-start gap-2 py-1.5 group",children:[y.jsxs("span",{className:"text-ink-muted min-w-[100px] text-xs",children:[U,":"]}),y.jsx("div",{className:"flex-1 min-w-0",children:y.jsx("span",{className:`text-ink text-xs break-all ${ie?"font-mono":""}`,children:L??re})}),y.jsx(Qe,{text:"Copy to clipboard",block:!1,children:y.jsx("button",{onClick:()=>P(re,de),className:"opacity-0 group-hover:opacity-100 transition-opacity p-1 rounded hover:bg-elevated","aria-label":`Copy ${U}`,children:p===de?y.jsx(il,{className:"h-3.5 w-3.5 text-status-success-text"}):y.jsx(si,{className:"h-3.5 w-3.5 text-ink-muted"})})})]}),ne=(U,re,de)=>y.jsxs("div",{className:"rounded-lg border border-line bg-elevated p-4",children:[y.jsxs("div",{className:"mb-1 flex items-center gap-2",children:[re,y.jsx("span",{className:"text-xs font-semibold uppercase tracking-wide text-ink-muted",children:U})]}),de]}),F=()=>y.jsx(Qe,{text:"Click to copy full path",children:y.jsxs("button",{onClick:()=>void P(l.path,"path"),className:"group mb-3 flex w-full items-center gap-2 rounded-lg border border-line bg-elevated px-3 py-2 text-left hover:bg-surface",children:[y.jsx(Sc,{className:"text-chip-amber-text h-4 w-4 flex-shrink-0"}),y.jsx("span",{className:"text-ink min-w-0 flex-1 truncate font-mono text-xs",children:o8(l.path)}),p==="path"?y.jsx(il,{className:"text-status-success-text h-3.5 w-3.5"}):y.jsx(si,{className:"text-ink-muted h-3.5 w-3.5"})]})});if(!n||!e)return null;const W=e;return y.jsxs("div",{className:"animate-overlay-in fixed inset-0 z-[var(--z-modal)] flex items-center justify-center bg-black/60 backdrop-blur-md p-4",role:"dialog","aria-modal":"true","aria-labelledby":"properties-modal-title",children:[y.jsx("div",{className:"absolute inset-0",onClick:t,onContextMenu:U=>{U.preventDefault(),t()}}),y.jsxs("div",{ref:j,className:"animate-modal-in relative w-full max-w-4xl max-h-[90vh] overflow-hidden rounded-xl border border-frame-line glass-panel flex flex-col",children:[y.jsx("div",{className:"flex-shrink-0 border-b border-line px-6 py-4",children:y.jsxs("div",{className:"flex items-start justify-between gap-4",children:[y.jsxs("div",{className:"flex items-center gap-3 flex-1 min-w-0",children:[y.jsx("div",{className:"rounded-lg bg-indigo-600 p-2 flex-shrink-0",children:y.jsx(Gg,{className:"h-5 w-5 text-white"})}),y.jsxs("div",{className:"min-w-0 flex-1",children:[y.jsx("h3",{id:"properties-modal-title",className:"text-base font-semibold text-ink truncate",children:"File Properties"}),y.jsx("p",{className:"text-xs text-ink-muted truncate",children:e.filename})]}),y.jsx(Qe,{text:"Copy all properties to clipboard",block:!1,children:y.jsx("button",{onClick:()=>{l&&P(s8(l),"all")},disabled:!l||a||f!==null,className:"btn-chip ml-2 flex items-center gap-1 rounded-md border border-chip-indigo-border bg-chip-indigo-bg p-1.5 text-chip-indigo-text","aria-label":"Copy all properties",children:p==="all"?y.jsx(il,{className:"h-4 w-4 text-status-success-text"}):y.jsx(si,{className:"h-4 w-4"})})}),y.jsx(Qe,{text:"Generate Barcode/QR Code",block:!1,children:y.jsx("button",{onClick:()=>v(!0),className:"btn-chip rounded-md border border-chip-indigo-border bg-chip-indigo-bg p-1.5 text-chip-indigo-text",children:y.jsx(py,{className:"h-4 w-4"})})})]}),y.jsx("button",{onClick:t,className:"focus-ring rounded-md p-1 text-ink-muted hover:bg-elevated hover:text-ink flex-shrink-0","aria-label":"Close",children:y.jsx(Ui,{className:"h-4 w-4"})})]})}),y.jsxs("div",{className:"flex-1 overflow-y-auto px-6 py-4",children:[a&&y.jsx("div",{className:"flex items-center justify-center py-8",children:y.jsxs("div",{className:"flex flex-col items-center gap-2",children:[y.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-2 border-indigo-600 border-t-transparent"}),y.jsx("p",{className:"text-xs text-ink-muted",children:"Loading properties..."})]})}),f&&y.jsx("div",{className:"rounded-lg border border-status-danger-border bg-status-danger-bg p-4 text-center",children:y.jsx("p",{className:"text-xs text-status-danger-text",children:f})}),l&&!a&&!f&&y.jsxs("div",{children:[y.jsxs("div",{className:"mb-2 flex flex-wrap items-center gap-x-4 gap-y-1.5 rounded-lg border border-line bg-elevated px-4 py-2.5",children:[y.jsx("span",{className:"inline-flex items-center gap-1 rounded-md border border-chip-indigo-border bg-chip-indigo-bg px-2 py-0.5 text-xs font-semibold text-chip-indigo-text",children:l.type}),l.attributes.extension&&y.jsx("span",{className:"inline-flex items-center rounded-md border border-line bg-surface px-2 py-0.5 text-xs font-medium text-ink-muted",children:l.attributes.extension}),y.jsxs("span",{className:"text-xs text-ink-muted",title:`${l.size_bytes} bytes`,children:["Size ",y.jsx("strong",{className:"text-ink font-medium",children:gA(l.size_bytes)})]}),y.jsxs("span",{className:"text-xs text-ink-muted",title:l.created,children:["Created ",y.jsx("strong",{className:"text-ink font-medium",children:$2(l.created)})]}),y.jsxs("span",{className:"text-xs text-ink-muted",title:l.modified,children:["Modified ",y.jsx("strong",{className:"text-ink font-medium",children:$2(l.modified)})]}),l.md5&&y.jsx("span",{className:"inline-flex items-center rounded-md border border-chip-purple-border bg-chip-purple-bg px-2 py-0.5 font-mono text-xs font-medium text-chip-purple-text",title:`MD5 ${l.md5}`,children:A0(l.md5,4,4)}),l.attributes.is_symlink&&y.jsxs("span",{className:"inline-flex items-center gap-1 rounded-md border border-chip-fuchsia-border bg-chip-fuchsia-bg px-2 py-0.5 text-xs font-medium text-chip-fuchsia-text",children:[y.jsx($4,{className:"h-3 w-3"})," Symlink"]})]}),F(),y.jsxs("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2",children:[ne("Hashes",y.jsx(ua,{className:"text-chip-purple-text h-3.5 w-3.5"}),y.jsxs("div",{className:"space-y-0.5",children:[z("MD5",l.md5,"md5",!0,A0(l.md5,10,6)),z("SHA256",l.sha256,"sha256",!0,A0(l.sha256,10,6))]})),ne("Timestamps",y.jsx(i4,{className:"text-chip-sky-text h-3.5 w-3.5"}),y.jsxs("div",{className:"space-y-0.5",children:[z("Created",l.created,"created",!0),z("Modified",l.modified,"modified",!0)]})),ne("Identity",y.jsx(Gg,{className:"text-chip-indigo-text h-3.5 w-3.5"}),y.jsxs("div",{className:"space-y-0.5",children:[z("Type",l.type,"type"),l.attributes.stem&&z("Stem",l.attributes.stem,"attrStem"),z("Extension",l.name.includes(".")?l.name.slice(l.name.lastIndexOf(".")):"None","extension"),z("Directory",l8(l.path)||"None","directory",!0)]})),ne("System",y.jsx(Gg,{className:"text-status-success-text h-3.5 w-3.5"}),y.jsxs("div",{children:[y.jsxs("div",{className:"mb-1 flex min-h-[24px] flex-wrap items-center gap-1.5",children:[l.attributes.is_readonly&&y.jsxs("span",{className:"inline-flex items-center gap-1 rounded-md border border-status-danger-border bg-status-danger-bg px-2 py-0.5 text-xs text-status-danger-text",children:[y.jsx(K4,{className:"h-3 w-3"})," Read-only"]}),l.attributes.is_hidden&&y.jsxs("span",{className:"inline-flex items-center gap-1 rounded-md border border-slate-500/30 bg-slate-600/20 px-2 py-0.5 text-xs text-slate-300",children:[y.jsx(C4,{className:"h-3 w-3"})," Hidden"]}),!l.attributes.is_readonly&&!l.attributes.is_hidden&&!l.attributes.is_symlink&&y.jsx("span",{className:"text-xs text-ink-muted",children:"No special flags"})]}),y.jsxs("div",{className:"space-y-0.5",children:[z("File Type",l.attributes.is_file?"Regular File":l.attributes.is_dir?"Directory":"Other","fileType"),l.attributes.permissions&&z("Permissions",l.attributes.permissions,"permissions",!0),l.attributes.owner_uid!==void 0&&z("Owner UID",String(l.attributes.owner_uid),"ownerUid"),l.attributes.group_gid!==void 0&&z("Group GID",String(l.attributes.group_gid),"groupGid")]})]}))]})]})]}),y.jsx("div",{className:"flex-shrink-0 border-t border-line px-6 py-3",children:y.jsxs("div",{className:"flex justify-between items-center gap-2",children:[y.jsx("p",{className:"min-w-0 text-xs text-ink-muted truncate",children:C??"Click the copy icon next to any field to copy its value"}),y.jsxs("div",{className:"flex items-center gap-2 whitespace-nowrap",children:[y.jsx(Qe,{text:"Show file in Explorer",block:!1,children:y.jsxs("button",{onClick:()=>void A("reveal","Revealed in Explorer",()=>GC(W.path)),disabled:w!==null,className:T("reveal"),children:[y.jsx($0,{className:"h-3.5 w-3.5"})," Reveal"]})}),y.jsx(Qe,{text:"Launch file with default association",block:!1,children:y.jsxs("button",{onClick:()=>{i&&(S("launch"),Promise.resolve(i(W)).finally(()=>S(null)))},disabled:w!==null||!i,className:T("launch"),children:[y.jsx(Jl,{className:"h-3.5 w-3.5"})," Launch"]})}),y.jsx(Qe,{text:"Open containing folder",block:!1,children:y.jsxs("button",{onClick:()=>void A("folder","Opened folder",()=>Q0(W.path)),disabled:w!==null,className:T("folder"),children:[y.jsx(Kl,{className:"h-3.5 w-3.5"})," Open Folder"]})}),y.jsx("button",{onClick:t,className:"btn btn-primary px-4 py-2",children:"Close"})]})]})})]}),y.jsx(mA,{isOpen:b,onClose:()=>v(!1),initialFilePath:e.path,md5:l==null?void 0:l.md5})]})}const c8=["qr_code","code_128","code_39","ean_13","ean_8","upc_a","upc_e","data_matrix"],f8=250,h8=400,d8=.7;function p8(n,e=h8,t=d8){const i=n.videoWidth,l=n.videoHeight;if(!i||!l)return null;const o=Math.min(i,l),a=document.createElement("canvas");a.width=Math.min(e,o),a.height=a.width;const c=a.getContext("2d");if(!c)return null;c.drawImage(n,(i-o)/2,(l-o)/2,o,o,0,0,a.width,a.height);const f=a.toDataURL("image/jpeg",t);return f.slice(f.indexOf(",")+1)}function m8(n,e){const t=n.intervalMs??f8;let i=!1,l=!1;const o=()=>{i=!0,clearInterval(a)},a=setInterval(()=>{if(i||l)return;const c=n.capture();c&&(l=!0,n.decode(c).then(f=>{i||f.decoded&&(o(),e.onDetected(f.decoded))}).catch(f=>{i||(o(),e.onError(f instanceof Error?f.message:"Frame decoding failed"))}).finally(()=>{l=!1}))},t);return o}const g8=8e3;function x8({isOpen:n,onClose:e,onDetected:t}){const i=R.useRef(null),l=R.useRef(null),o=cs({isOpen:n,onClose:e,dialogRef:l}),a=R.useRef(null),c=R.useRef(null),f=R.useRef(null),[d,p]=R.useState(null),[g,b]=R.useState(!1),v=()=>{f.current&&(f.current(),f.current=null),c.current&&(cancelAnimationFrame(c.current),c.current=null),a.current&&(a.current.getTracks().forEach(C=>C.stop()),a.current=null),i.current&&(i.current.srcObject=null)};R.useEffect(()=>{if(!n){v(),p(null);return}let C=!0;async function O(){var M,H,P,A,T;if(p(null),b(!1),typeof window<"u"&&!window.isSecureContext&&window.location.hostname!=="localhost"&&window.location.hostname!=="127.0.0.1"){p("Camera access requires HTTPS or localhost. If connecting across a local network IP (e.g. 192.168.x.x), modern browsers disable camera access for insecure HTTP.");return}const j=((H=(M=navigator.mediaDevices)==null?void 0:M.getUserMedia)==null?void 0:H.bind(navigator.mediaDevices))||((P=navigator.getUserMedia)==null?void 0:P.bind(navigator))||((A=navigator.webkitGetUserMedia)==null?void 0:A.bind(navigator))||((T=navigator.mozGetUserMedia)==null?void 0:T.bind(navigator));if(!j){p(window.isSecureContext?"Camera access is not supported by your browser or environment.":"Camera access is blocked because the page is not served over a secure origin (HTTPS or localhost/127.0.0.1).");return}try{let z;const ne=await Promise.race([j({video:{facingMode:"environment",width:{ideal:1280},height:{ideal:720}}}),new Promise((F,W)=>{z=window.setTimeout(()=>W(new DOMException("Camera did not start in time","TimeoutError")),g8)})]).finally(()=>{z!==void 0&&window.clearTimeout(z)});if(!C){ne.getTracks().forEach(F=>F.stop());return}a.current=ne,i.current&&(i.current.srcObject=ne,await i.current.play()),"BarcodeDetector"in window?S():w()}catch(z){if(!C)return;console.error("Camera access error:",z),p(z.name==="NotAllowedError"||z.name==="PermissionDeniedError"?"Camera permission denied. Please allow camera access in your browser settings.":z.name==="TimeoutError"?"The camera did not start in time. On macOS, camera capture needs the packaged desktop app — a bare Python process cannot access the camera. Alternatively, open ProFiles in Chrome, Edge or Safari.":`Could not access camera: ${z.message||"Unknown error"}`)}}return O(),()=>{C=!1,v()}},[n]);const w=()=>{b(!0),f.current=m8({capture:()=>i.current?p8(i.current):null,decode:C=>DM({imageBase64:C,formats:[...c8]})},{onDetected:C=>{v(),t(C)},onError:C=>{v(),p(C)}})},S=()=>{const C=["qr_code","code_128","code_39","ean_13","ean_8","upc_a","upc_e","data_matrix"];let O;try{O=new window.BarcodeDetector({formats:C})}catch(M){console.warn("BarcodeDetector formats unsupported:",M),O=new window.BarcodeDetector}const j=async()=>{if(!i.current||i.current.readyState<2){c.current=requestAnimationFrame(j);return}try{const M=await O.detect(i.current);if(M&&M.length>0){const H=M[0].rawValue;if(H){v(),t(H);return}}}catch(M){console.debug("Frame detection error:",M)}c.current=requestAnimationFrame(j)};c.current=requestAnimationFrame(j)};return n?y.jsx("div",{className:"animate-overlay-in fixed inset-0 z-[var(--z-modal)] flex items-center justify-center bg-black/70 p-4 backdrop-blur-sm",onClick:e,children:y.jsxs("div",{ref:l,role:"dialog","aria-modal":"true","aria-label":"Camera barcode scanner",onKeyDown:o,className:"relative w-full max-w-lg rounded-2xl border border-frame-line glass-panel p-6 flex flex-col",onClick:C=>C.stopPropagation(),children:[y.jsxs("div",{className:"mb-4 flex items-center justify-between border-b border-line pb-3",children:[y.jsxs("div",{className:"flex items-center gap-2 font-semibold text-ink",children:[y.jsx(WC,{className:"h-5 w-5 text-chip-indigo-text"}),y.jsx("span",{children:"Scan with Camera"})]}),y.jsx("button",{onClick:e,className:"focus-ring rounded-lg p-1 text-ink-muted hover:bg-elevated hover:text-ink transition-colors","aria-label":"Close",children:y.jsx(Ui,{className:"h-4 w-4"})})]}),d?y.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-center",children:[y.jsx("div",{className:"rounded-full bg-status-danger-bg p-3 text-status-danger-text mb-3",children:y.jsx(Gu,{className:"h-6 w-6"})}),y.jsx("p",{className:"text-xs text-status-danger-text max-w-xs",children:d}),y.jsx("button",{onClick:e,className:"btn btn-secondary mt-6 px-4 py-2",children:"Close"})]}):y.jsxs("div",{className:"flex flex-col items-center",children:[y.jsxs("div",{className:"relative aspect-video w-full overflow-hidden rounded-xl bg-black border border-line flex items-center justify-center",children:[y.jsx("video",{ref:i,playsInline:!0,muted:!0,className:"h-full w-full object-cover"}),y.jsx("div",{className:"pointer-events-none absolute inset-0 flex items-center justify-center",children:y.jsxs("div",{className:"relative h-48 w-48 rounded-lg border-2 border-dashed border-indigo-400/80 bg-indigo-500/5 shadow-[0_0_0_9999px_rgba(0,0,0,0.45)]",children:[y.jsx("div",{className:"absolute top-0 left-0 h-4 w-4 border-t-2 border-l-2 border-indigo-400"}),y.jsx("div",{className:"absolute top-0 right-0 h-4 w-4 border-t-2 border-r-2 border-indigo-400"}),y.jsx("div",{className:"absolute bottom-0 left-0 h-4 w-4 border-b-2 border-l-2 border-indigo-400"}),y.jsx("div",{className:"absolute bottom-0 right-0 h-4 w-4 border-b-2 border-r-2 border-indigo-400"})]})})]}),y.jsx("p",{className:"mt-4 text-center text-xs text-ink-muted",children:g?"Hold a QR code or barcode steady in front of your camera — frames are decoded by the local ProFiles server (no native Barcode Detector in this browser).":"Hold a QR code or barcode steady in front of your camera to auto-scan."})]})]})}):null}function y8({isOpen:n,file:e,onConfirm:t,onDismiss:i}){const l=R.useRef(null);return R.useEffect(()=>{var o;if(n){const a=c=>{c.key==="Enter"?(c.preventDefault(),t()):c.key==="Escape"&&(c.preventDefault(),i())};return window.addEventListener("keydown",a),(o=l.current)==null||o.focus(),()=>window.removeEventListener("keydown",a)}},[n,t,i]),!n||!e?null:y.jsx("div",{className:"animate-overlay-in fixed inset-0 z-[var(--z-modal)] flex items-center justify-center bg-black/60 p-4 backdrop-blur-sm",onClick:i,children:y.jsxs("div",{role:"dialog","aria-modal":"true","aria-label":`1 file matched: ${e.filename}`,className:"animate-modal-in w-full max-w-sm rounded-xl border border-frame-line glass-panel p-5 flex flex-col gap-4",onClick:o=>o.stopPropagation(),children:[y.jsxs("div",{className:"flex items-center justify-between border-b border-line pb-3",children:[y.jsxs("div",{className:"flex items-center gap-2 font-semibold text-ink text-sm",children:[e.has_hook?y.jsx(ND,{className:"h-4 w-4 text-chip-purple-text"}):y.jsx(Jl,{className:"h-4 w-4 text-status-success-text"}),y.jsx("span",{children:"1 File Matched"})]}),y.jsx("button",{onClick:i,className:"focus-ring rounded p-1 text-ink-muted hover:bg-elevated hover:text-ink","aria-label":"Dismiss",children:y.jsx(Ui,{className:"h-4 w-4"})})]}),y.jsxs("div",{className:"flex items-start gap-3 rounded-lg border border-line bg-elevated/50 p-3",children:[y.jsx(Ca,{className:"h-5 w-5 text-chip-indigo-text shrink-0 mt-0.5"}),y.jsxs("div",{className:"min-w-0 flex-1",children:[y.jsx("h4",{className:"text-xs font-semibold text-ink truncate",children:e.filename}),y.jsx("p",{className:"text-[11px] text-ink-muted truncate mt-0.5",children:e.rel_path||e.path}),e.has_hook&&y.jsx("span",{className:"inline-block mt-1 text-[10px] text-chip-purple-text bg-chip-purple-bg px-1.5 py-0.5 rounded border border-chip-purple-border/50 font-medium",children:"Workflow Hook Configured"})]})]}),y.jsx("p",{className:"text-xs text-ink-muted text-center",children:"Launch this file now?"}),y.jsxs("div",{className:"flex gap-2",children:[y.jsx("button",{type:"button",onClick:i,className:"btn btn-secondary flex-1 px-3 py-1.5",children:"Dismiss (Esc)"}),y.jsxs("button",{ref:l,type:"button",onClick:t,className:"btn btn-primary flex-1 px-3 py-1.5 shadow-md",children:[y.jsx(Jl,{className:"h-3 w-3 fill-current"}),"Launch (Enter)"]})]})]})})}function b8({systemInfo:n,fileCount:e,theme:t,onToggleTheme:i,onOpenLog:l,onOpenConfig:o,onLoadConfig:a,onShowShortcuts:c,onReloadConfig:f,onExport:d,exportDisabled:p=!1,language:g="en",onLanguageChange:b,activeConfigName:v,lanEnabled:w,onToggleLan:S}){return y.jsxs("footer",{className:"flex items-center justify-between border-t border-line bg-app px-4 py-2 text-[11px] text-ink-muted transition-colors duration-200",children:[y.jsx("div",{className:"flex items-center gap-4",children:n&&y.jsxs("div",{className:"flex items-center gap-1.5 rounded-full border border-line bg-surface px-2.5 py-0.5 text-ink-secondary",children:[y.jsx(QM,{className:"h-3 w-3 text-status-success-text"}),y.jsx("a",{href:`http://${n.hostname}:${window.location.port}`,target:"_blank",rel:"noopener noreferrer","aria-label":`Open ProFiles on ${n.hostname}`,className:"font-mono hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-indigo-500 rounded px-1 py-0.5",children:n.hostname}),y.jsx("span",{className:"text-ink-faint",children:"|"}),y.jsx("a",{href:`http://${n.ip}:${window.location.port}`,target:"_blank",rel:"noopener noreferrer","aria-label":`Open ProFiles on ${n.ip}`,className:"font-mono hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-indigo-500 rounded px-1 py-0.5",children:n.ip}),y.jsx("span",{className:"text-ink-faint",children:"|"}),y.jsxs("span",{className:"flex items-center gap-1",title:"Session user",children:[y.jsx(SD,{className:"h-3 w-3 text-ink-faint"}),y.jsx("span",{children:n.username||"operator"})]}),S!==void 0&&y.jsxs(y.Fragment,{children:[y.jsx("span",{className:"text-ink-faint",children:"|"}),y.jsx(Qe,{text:"LAN access",block:!1,children:y.jsxs("button",{onClick:()=>S(w!==!0),disabled:w===null,"aria-pressed":w===!0,className:`focus-ring flex items-center gap-1 rounded px-1 py-0.5 text-[10px] ${w===null?"text-ink-faint cursor-not-allowed":w===!0?"text-status-success-text":"text-ink-muted hover:text-ink"}`,children:[y.jsx(eD,{className:"h-3 w-3"}),y.jsx("span",{children:"LAN"})]})})]})]})}),y.jsxs("div",{className:"flex items-center gap-3",children:[y.jsxs("span",{children:[y.jsx("strong",{className:"text-ink",children:e})," files found"]}),y.jsx("span",{className:"text-ink-faint",children:"|"}),y.jsx(Qe,{text:"Keyboard shortcuts (?)",block:!1,children:y.jsxs("button",{onClick:c,className:"focus-ring flex items-center gap-1 text-ink-muted hover:text-ink",children:[y.jsx(tO,{className:"h-3 w-3"}),y.jsx("span",{children:"Shortcuts"})]})}),y.jsx(Qe,{text:"Open the application log viewer",block:!1,children:y.jsxs("button",{onClick:l,className:"focus-ring flex items-center gap-1 text-ink-muted hover:text-ink",children:[y.jsx(Ca,{className:"h-3 w-3"}),y.jsx("span",{children:"Logs"})]})}),y.jsx("span",{className:"text-ink-faint",children:"|"}),f&&y.jsx(Qe,{text:"Reload configuration from disk",block:!1,children:y.jsxs("button",{onClick:f,className:"focus-ring flex items-center gap-1 text-ink-muted hover:text-ink",children:[y.jsx(Xd,{className:"h-3 w-3"}),y.jsx("span",{children:"Reload"})]})}),d&&y.jsx(Qe,{text:"Export the current results as CSV",block:!1,children:y.jsxs("button",{onClick:d,disabled:p,className:"focus-ring flex items-center gap-1 rounded text-ink-muted hover:text-ink disabled:opacity-40 disabled:hover:text-ink-muted",children:[y.jsx(ZC,{className:"h-3 w-3"}),y.jsx("span",{children:"Export CSV"})]})}),b&&y.jsxs("div",{className:"flex items-center overflow-hidden rounded border border-line text-[10px]",children:[y.jsx(Qe,{text:"English",block:!1,children:y.jsxs("button",{onClick:()=>b("en"),className:`flex items-center gap-1 px-1.5 py-0.5 transition-colors ${g==="en"?"bg-indigo-600 text-white focus-ring":"text-ink-muted hover:text-ink focus-ring"}`,children:[y.jsx(U4,{className:"h-3 w-3"}),y.jsx("span",{children:"EN"})]})}),y.jsx(Qe,{text:"Français",block:!1,children:y.jsx("button",{onClick:()=>b("fr"),className:`flex items-center gap-1 px-1.5 py-0.5 transition-colors ${g==="fr"?"bg-indigo-600 text-white focus-ring":"text-ink-muted hover:text-ink focus-ring"}`,children:y.jsx("span",{children:"FR"})})})]}),a&&y.jsx(Qe,{text:v?`Load a different .profiles file (active: ${v})`:"Load a .profiles file",block:!1,children:y.jsxs("button",{onClick:a,className:"focus-ring flex items-center gap-1 text-ink-muted hover:text-ink",children:[y.jsx(aa,{className:"h-3 w-3"}),y.jsx("span",{children:"Load config…"})]})}),y.jsx(Qe,{text:"Open configuration file",block:!1,children:y.jsxs("button",{onClick:o,className:"focus-ring flex items-center gap-1 text-ink-muted hover:text-ink",children:[y.jsx(mD,{className:"h-3 w-3"}),y.jsx("span",{children:"Config"})]})}),y.jsx(Qe,{text:`Switch to ${t==="dark"?"light":"dark"} mode`,block:!1,children:y.jsxs("button",{onClick:i,className:"focus-ring flex items-center gap-1 rounded px-1.5 py-0.5 text-ink-muted hover:bg-elevated hover:text-status-warning-text",children:[t==="dark"?y.jsx(xD,{className:"h-3 w-3 text-status-warning-text"}):y.jsx(Z4,{className:"h-3 w-3 text-chip-indigo-text"}),y.jsx("span",{children:t==="dark"?"Light":"Dark"})]})})]})]})}const v8=[{label:"5 seconds",seconds:5},{label:"10 seconds",seconds:10},{label:"30 seconds",seconds:30},{label:"1 minute",seconds:60},{label:"5 minutes",seconds:300}];function w8({isOpen:n,currentInterval:e,onClose:t,onSetInterval:i}){const l=R.useRef(null),o=cs({isOpen:n,onClose:t,dialogRef:l});if(!n)return null;const a=e>0,c=p=>{i(p)},f=p=>{p.preventDefault();const b=p.currentTarget.elements.namedItem("custom-interval"),v=parseInt(b.value,10);!isNaN(v)&&v>0&&i(v)},d=()=>{i(0)};return y.jsx("div",{className:"animate-overlay-in fixed inset-0 z-[var(--z-modal)] flex items-center justify-center bg-black/60 p-4 backdrop-blur-sm",children:y.jsxs("div",{ref:l,role:"dialog","aria-modal":"true","aria-label":"Auto-Rescan Timer",onKeyDown:o,className:"animate-modal-in w-[420px] max-w-full rounded-2xl border border-frame-line glass-panel p-5",children:[y.jsxs("div",{className:"mb-4 flex items-center justify-between border-b border-line pb-3",children:[y.jsxs("div",{className:"flex items-center gap-2 font-semibold text-ink",children:[y.jsx(rO,{className:"h-5 w-5 text-chip-indigo-text"}),y.jsx("span",{children:"Auto-Rescan Timer"})]}),y.jsx("button",{onClick:t,className:"focus-ring rounded-lg p-1 text-ink-muted hover:bg-elevated hover:text-ink",children:y.jsx(Ui,{className:"h-4 w-4"})})]}),y.jsx("div",{className:"mb-4 rounded-lg bg-elevated/50 px-3 py-2 text-xs",children:a?y.jsxs("div",{className:"flex items-center gap-2 text-status-success-text",children:[y.jsx(g4,{className:"h-4 w-4 animate-pulse"}),y.jsxs("span",{children:["Auto-rescan every ",e,"s"]})]}):y.jsxs("div",{className:"flex items-center gap-2 text-ink-secondary",children:[y.jsx(p4,{className:"h-4 w-4"}),y.jsx("span",{children:"Auto-rescan is disabled"})]})}),y.jsxs("div",{className:"mb-4 space-y-1 text-xs",children:[y.jsx("p",{className:"text-ink-muted",children:"Presets:"}),y.jsx("div",{className:"grid grid-cols-2 gap-2",children:v8.map(p=>y.jsx("button",{onClick:()=>c(p.seconds),className:"rounded-lg border border-line bg-elevated/50 px-3 py-1.5 text-left font-medium text-ink-secondary hover:border-chip-indigo-border hover:bg-chip-indigo-bg/40 hover:text-chip-indigo-text focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-indigo-500",children:p.label},p.seconds))})]}),y.jsxs("form",{onSubmit:f,className:"mb-4",children:[y.jsxs("label",{className:"flex items-center gap-2 text-xs font-medium text-ink-secondary",children:[y.jsx(b4,{className:"h-3.5 w-3.5"}),y.jsx("span",{children:"Custom interval (seconds):"})]}),y.jsxs("div",{className:"mt-1 flex gap-2",children:[y.jsx("input",{type:"number",name:"custom-interval",min:"1",placeholder:"e.g. 45",className:"flex-1 rounded-lg border border-line bg-app px-2 py-1 text-xs text-ink placeholder-ink-faint focus:border-indigo-500 focus:outline-none"}),y.jsx("button",{type:"submit",className:"btn btn-primary rounded-lg px-3 py-1 font-semibold",children:"Set"})]})]}),a&&y.jsx("button",{onClick:d,className:"btn w-full rounded-lg border-line bg-elevated/50 px-3 py-2 text-status-warning-text hover:border-status-warning-border hover:bg-status-warning-bg/40",children:"Stop Auto-Rescan"}),y.jsx("div",{className:"flex justify-end gap-2 border-t border-line pt-3",children:y.jsx("button",{onClick:t,className:"rounded-lg border border-line bg-elevated px-4 py-2 text-xs font-semibold text-ink-secondary hover:bg-elevated/70 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-indigo-500",children:"Close"})})]})})}function k8(n,e){const t={};return(n[n.length-1]===""?[...n,""]:n).join((t.padRight?" ":"")+","+(t.padLeft===!1?"":" ")).trim()}const S8=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,C8=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,O8={};function G2(n,e){return(O8.jsx?C8:S8).test(n)}const N8=/[ \t\n\f\r]/g;function T8(n){return typeof n=="object"?n.type==="text"?Y2(n.value):!1:Y2(n)}function Y2(n){return n.replace(N8,"")===""}class Mc{constructor(e,t,i){this.normal=t,this.property=e,i&&(this.space=i)}}Mc.prototype.normal={};Mc.prototype.property={};Mc.prototype.space=void 0;function xA(n,e){const t={},i={};for(const l of n)Object.assign(t,l.property),Object.assign(i,l.normal);return new Mc(t,i,e)}function Wx(n){return n.toLowerCase()}class di{constructor(e,t){this.attribute=t,this.property=e}}di.prototype.attribute="";di.prototype.booleanish=!1;di.prototype.boolean=!1;di.prototype.commaOrSpaceSeparated=!1;di.prototype.commaSeparated=!1;di.prototype.defined=!1;di.prototype.mustUseProperty=!1;di.prototype.number=!1;di.prototype.overloadedBoolean=!1;di.prototype.property="";di.prototype.spaceSeparated=!1;di.prototype.space=void 0;let A8=0;const qe=ao(),on=ao(),Zx=ao(),me=ao(),Mt=ao(),no=ao(),Ci=ao();function ao(){return 2**++A8}const Jx=Object.freeze(Object.defineProperty({__proto__:null,boolean:qe,booleanish:on,commaOrSpaceSeparated:Ci,commaSeparated:no,number:me,overloadedBoolean:Zx,spaceSeparated:Mt},Symbol.toStringTag,{value:"Module"})),E0=Object.keys(Jx);class eb extends di{constructor(e,t,i,l){let o=-1;if(super(e,t),K2(this,"space",l),typeof i=="number")for(;++o4&&t.slice(0,4)==="data"&&j8.test(e)){if(e.charAt(4)==="-"){const o=e.slice(5).replace(W2,z8);i="data"+o.charAt(0).toUpperCase()+o.slice(1)}else{const o=e.slice(4);if(!W2.test(o)){let a=o.replace(R8,L8);a.charAt(0)!=="-"&&(a="-"+a),e="data"+a}}l=eb}return new l(i,e)}function L8(n){return"-"+n.toLowerCase()}function z8(n){return n.charAt(1).toUpperCase()}const B8=xA([yA,E8,wA,kA,SA],"html"),tb=xA([yA,M8,wA,kA,SA],"svg");function P8(n){return n.join(" ").trim()}var Z2=/\/\*(?:[^*]|\*(?!\/))*\*\//g,H8=/\n/g,I8=/^\s*/,U8=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,F8=/^:\s*/,q8=/^((?:'(?:\\.|[^'\\])*'|"(?:\\.|[^"\\])*"|url\((?:'(?:\\.|[^'\\])*'|"(?:\\.|[^"\\])*"|[^)]*)\)|[^};])+)/,V8=/^[;\s]*/,Q8=` -`,J2="/",eC="*",Iu="",X8="comment",$8="declaration";function G8(n,e){if(typeof n!="string")throw new TypeError("First argument must be a string");if(!n)return[];e=e||{};var t=1,i=1;function l(w){var S=w.match(H8);S&&(t+=S.length);var C=w.lastIndexOf(Q8);i=~C?w.length-C:i+w.length}function o(){var w={line:t,column:i};return function(S){return S.position=new a(w),d(),S}}function a(w){this.start=w,this.end={line:t,column:i},this.source=e.source}a.prototype.content=n;function c(w){var S=new Error(e.source+":"+t+":"+i+": "+w);if(S.reason=w,S.filename=e.source,S.line=t,S.column=i,S.source=n,!e.silent)throw S}function f(w){var S=w.exec(n);if(S){var C=S[0];return l(C),n=n.slice(C.length),S}}function d(){f(I8)}function p(w){for(var S;S=g();)w.push(S);return w}function g(){var w=o();if(!(J2!=n.charAt(0)||eC!=n.charAt(1))){for(var S=2;Iu!=n.charAt(S)&&(eC!=n.charAt(S)||J2!=n.charAt(S+1));)++S;if(S+=2,Iu===n.charAt(S-1))return c("End of comment missing");var C=n.slice(2,S-2);return i+=2,l(C),n=n.slice(S),i+=2,w({type:X8,comment:C})}}function b(){var w=o(),S=f(U8);if(S){if(g(),!f(F8))return c("property missing ':'");var C=f(q8),O=w({type:$8,property:S[0].replace(Z2,Iu).trim(),value:C?C[0].replace(Z2,Iu).trim():Iu});return f(V8),O}}function v(){var w=[];p(w);for(var S;S=b();)w.push(S),p(w);return w}return d(),v()}function Y8(n,e){let t=null;if(!n||typeof n!="string")return t;const i=G8(n),l=typeof e=="function";return i.forEach(o=>{if(o.type!=="declaration")return;const{property:a,value:c}=o;l?e(a,c,o):c&&(t=t??{},t[a]=c)}),t}const CA=OA("end"),nb=OA("start");function OA(n){return e;function e(t){const i=t&&t.position&&t.position[n]||{};if(typeof i.line=="number"&&i.line>0&&typeof i.column=="number"&&i.column>0)return{line:i.line,column:i.column,offset:typeof i.offset=="number"&&i.offset>-1?i.offset:void 0}}}function K8(n){const e=nb(n),t=CA(n);if(e&&t)return{start:e,end:t}}function ic(n){return!n||typeof n!="object"?"":"position"in n||"type"in n?tC(n.position):"start"in n||"end"in n?tC(n):"line"in n||"column"in n?ey(n):""}function ey(n){return nC(n&&n.line)+":"+nC(n&&n.column)}function tC(n){return ey(n&&n.start)+"-"+ey(n&&n.end)}function nC(n){return n&&typeof n=="number"?n:1}class In extends Error{constructor(e,t,i){super(),typeof t=="string"&&(i=t,t=void 0);let l="",o={},a=!1;if(t&&("line"in t&&"column"in t?o={place:t}:"start"in t&&"end"in t?o={place:t}:"type"in t?o={ancestors:[t],place:t.position}:o={...t}),typeof e=="string"?l=e:!o.cause&&e&&(a=!0,l=e.message,o.cause=e),!o.ruleId&&!o.source&&typeof i=="string"){const f=i.indexOf(":");f===-1?o.ruleId=i:(o.source=i.slice(0,f),o.ruleId=i.slice(f+1))}if(!o.place&&o.ancestors&&o.ancestors){const f=o.ancestors[o.ancestors.length-1];f&&(o.place=f.position)}const c=o.place&&"start"in o.place?o.place.start:o.place;this.ancestors=o.ancestors||void 0,this.cause=o.cause||void 0,this.column=c?c.column:void 0,this.fatal=void 0,this.file="",this.message=l,this.line=c?c.line:void 0,this.name=ic(o.place)||"1:1",this.place=o.place||void 0,this.reason=this.message,this.ruleId=o.ruleId||void 0,this.source=o.source||void 0,this.stack=a&&o.cause&&typeof o.cause.stack=="string"?o.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}In.prototype.file="";In.prototype.name="";In.prototype.reason="";In.prototype.message="";In.prototype.stack="";In.prototype.column=void 0;In.prototype.line=void 0;In.prototype.ancestors=void 0;In.prototype.cause=void 0;In.prototype.fatal=void 0;In.prototype.place=void 0;In.prototype.ruleId=void 0;In.prototype.source=void 0;const ib={}.hasOwnProperty,W8=new Map,Z8=/[A-Z]/g,J8=/-([a-z])/g,eP=new Set(["table","tbody","thead","tfoot","tr"]),tP=new Set(["td","th"]),NA="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function nP(n,e){if(!e||e.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const t=e.filePath||void 0;let i;if(e.development){if(typeof e.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");i=cP(t,e.jsxDEV)}else{if(typeof e.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof e.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");i=uP(t,e.jsx,e.jsxs)}const l={Fragment:e.Fragment,ancestors:[],components:e.components||{},create:i,elementAttributeNameCase:e.elementAttributeNameCase||"react",evaluater:e.createEvaluater?e.createEvaluater():void 0,filePath:t,ignoreInvalidStyle:e.ignoreInvalidStyle||!1,passKeys:e.passKeys!==!1,passNode:e.passNode||!1,schema:e.space==="svg"?tb:B8,stylePropertyNameCase:e.stylePropertyNameCase||"dom",tableCellAlignToStyle:e.tableCellAlignToStyle!==!1},o=TA(l,n,void 0);return o&&typeof o!="string"?o:l.create(n,l.Fragment,{children:o||void 0},void 0)}function TA(n,e,t){if(e.type==="element")return iP(n,e,t);if(e.type==="mdxFlowExpression"||e.type==="mdxTextExpression")return rP(n,e);if(e.type==="mdxJsxFlowElement"||e.type==="mdxJsxTextElement")return sP(n,e,t);if(e.type==="mdxjsEsm")return lP(n,e);if(e.type==="root")return oP(n,e,t);if(e.type==="text")return aP(n,e)}function iP(n,e,t){const i=n.schema;let l=i;e.tagName.toLowerCase()==="svg"&&i.space==="html"&&(l=tb,n.schema=l),n.ancestors.push(e);const o=EA(n,e.tagName,!1),a=fP(n,e);let c=lb(n,e);return eP.has(e.tagName)&&(c=c.filter(function(f){return typeof f=="string"?!T8(f):!0})),AA(n,a,o,e),rb(a,c),n.ancestors.pop(),n.schema=i,n.create(e,o,a,t)}function rP(n,e){if(e.data&&e.data.estree&&n.evaluater){const i=e.data.estree.body[0];return i.type,n.evaluater.evaluateExpression(i.expression)}kc(n,e.position)}function lP(n,e){if(e.data&&e.data.estree&&n.evaluater)return n.evaluater.evaluateProgram(e.data.estree);kc(n,e.position)}function sP(n,e,t){const i=n.schema;let l=i;e.name==="svg"&&i.space==="html"&&(l=tb,n.schema=l),n.ancestors.push(e);const o=e.name===null?n.Fragment:EA(n,e.name,!0),a=hP(n,e),c=lb(n,e);return AA(n,a,o,e),rb(a,c),n.ancestors.pop(),n.schema=i,n.create(e,o,a,t)}function oP(n,e,t){const i={};return rb(i,lb(n,e)),n.create(e,n.Fragment,i,t)}function aP(n,e){return e.value}function AA(n,e,t,i){typeof t!="string"&&t!==n.Fragment&&n.passNode&&(e.node=i)}function rb(n,e){if(e.length>0){const t=e.length>1?e:e[0];t&&(n.children=t)}}function uP(n,e,t){return i;function i(l,o,a,c){const d=Array.isArray(a.children)?t:e;return c?d(o,a,c):d(o,a)}}function cP(n,e){return t;function t(i,l,o,a){const c=Array.isArray(o.children),f=nb(i);return e(l,o,a,c,{columnNumber:f?f.column-1:void 0,fileName:n,lineNumber:f?f.line:void 0},void 0)}}function fP(n,e){const t={};let i,l;for(l in e.properties)if(l!=="children"&&ib.call(e.properties,l)){const o=dP(n,l,e.properties[l]);if(o){const[a,c]=o;n.tableCellAlignToStyle&&a==="align"&&typeof c=="string"&&tP.has(e.tagName)?i=c:t[a]=c}}if(i){const o=t.style||(t.style={});o[n.stylePropertyNameCase==="css"?"text-align":"textAlign"]=i}return t}function hP(n,e){const t={};for(const i of e.attributes)if(i.type==="mdxJsxExpressionAttribute")if(i.data&&i.data.estree&&n.evaluater){const o=i.data.estree.body[0];o.type;const a=o.expression;a.type;const c=a.properties[0];c.type,Object.assign(t,n.evaluater.evaluateExpression(c.argument))}else kc(n,e.position);else{const{name:l}=i;let o;if(i.value&&typeof i.value=="object")if(i.value.data&&i.value.data.estree&&n.evaluater){const c=i.value.data.estree.body[0];c.type,o=n.evaluater.evaluateExpression(c.expression)}else kc(n,e.position);else o=i.value===null?!0:i.value;t[l]=o}return t}function lb(n,e){const t=[];let i=-1;const l=n.passKeys?new Map:W8;for(;++il?0:l+e:e=e>l?l:e,t=t>0?t:0,i.length<1e4)a=Array.from(i),a.unshift(e,t),n.splice(...a);else for(t&&n.splice(e,t);o0?(tr(n,n.length,0,e),n):e}const lC={}.hasOwnProperty;function DA(n){const e={};let t=-1;for(;++t13&&t<32||t>126&&t<160||t>55295&&t<57344||t>64975&&t<65008||(t&65535)===65535||(t&65535)===65534||t>1114111?"�":String.fromCodePoint(t)}function nr(n){return n.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const En=fs(/[A-Za-z]/),Mn=fs(/[\dA-Za-z]/),SP=fs(/[#-'*+\--9=?A-Z^-~]/);function Hd(n){return n!==null&&(n<32||n===127)}const ty=fs(/\d/),CP=fs(/[\dA-Fa-f]/),jA=fs(/[!-/:-@[-`{-~]/);function Be(n){return n!==null&&n<-2}function Rt(n){return n!==null&&(n<0||n===32)}function Je(n){return n===-2||n===-1||n===32}const cp=fs(new RegExp("\\p{P}|\\p{S}","u")),so=fs(/\s/);function fs(n){return e;function e(t){return t!==null&&t>-1&&n.test(String.fromCharCode(t))}}function Ha(n){const e=[];let t=-1,i=0,l=0;for(;++t55295&&o<57344){const c=n.charCodeAt(t+1);o<56320&&c>56319&&c<57344?(a=String.fromCharCode(o,c),l=1):a="�"}else a=String.fromCharCode(o);a&&(e.push(n.slice(i,t),encodeURIComponent(a)),i=t+l+1,a=""),l&&(t+=l,l=0)}return e.join("")+n.slice(i)}function gt(n,e,t,i){const l=i?i-1:1/0;let o=0;return a;function a(f){return Je(f)?(n.enter(t),c(f)):e(f)}function c(f){return Je(f)&&o++=l?e(p):t(p)}}const OP={tokenize:NP};function NP(n){const e=n.attempt(this.parser.constructs.contentInitial,i,l);let t;return e;function i(c){if(c===null){n.consume(c);return}return n.enter("lineEnding"),n.consume(c),n.exit("lineEnding"),gt(n,e,"linePrefix")}function l(c){return n.enter("paragraph"),o(c)}function o(c){const f=n.enter("chunkText",{contentType:"text",previous:t});return t&&(t.next=f),t=f,a(c)}function a(c){if(c===null){n.exit("chunkText"),n.exit("paragraph"),n.consume(c);return}return Be(c)?(n.consume(c),n.exit("chunkText"),o):(n.consume(c),a)}}let Id=class{constructor(){this.index=new Map,this.map=[]}add(e,t,i){sC(this,e,t,i,!1)}addBefore(e,t,i){sC(this,e,t,i,!0)}consume(e){if(this.map.sort(function(o,a){return o[0]-a[0]}),this.map.length===0)return;let t=this.map.length;const i=[];for(;t>0;)t-=1,i.push(e.slice(this.map[t][0]+this.map[t][1]),this.map[t][2]),e.length=this.map[t][0];i.push(e.slice()),e.length=0;let l=i.pop();for(;l;){for(const o of l)e.push(o);l=i.pop()}this.map.length=0,this.index.clear()}};function sC(n,e,t,i,l){if(t===0&&i.length===0)return;const o=n.index.get(e);if(o){o[1]+=t,l?(i.push(...o[2]),o[2]=i):o[2].push(...i);return}const a=[e,t,i];n.map.push(a),n.index.set(e,a)}const TP={tokenize:AP},oC={tokenize:EP};function AP(n){const e=this,t=[];let i=0,l,o,a;return c;function c(M){if(ia))return;const T=e.events.length;let z=T,ne,F;for(;z--;)if(e.events[z][0]==="exit"&&e.events[z][1].type==="chunkFlow"){if(ne){F=e.events[z][1].end;break}ne=!0}for(O(i),A=T;AM;){const P=t[H];e.containerState=P[1],P[0].exit.call(e,n)}t.length=M}function j(){l.write([null]),o=void 0,l=void 0,e.containerState._closeFlow=void 0}}function EP(n,e,t){return gt(n,n.attempt(this.parser.constructs.document,e,t),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function os(n){if(n===null||Rt(n)||so(n))return 1;if(cp(n))return 2}function fp(n,e,t){const i=[];let l=-1;for(;++l1&&n[t][1].end.offset-n[t][1].start.offset>1?2:1,a={...n[l][1].end},c={...n[t][1].start};aC(a,-o),aC(c,o);const f={type:o>1?"strongSequence":"emphasisSequence",start:a,end:{...n[l][1].end}},d={type:o>1?"strongSequence":"emphasisSequence",start:{...n[t][1].start},end:c},p={type:o>1?"strongText":"emphasisText",start:{...n[l][1].end},end:{...n[t][1].start}},g={type:o>1?"strong":"emphasis",start:{...f.start},end:{...d.end}};n[l][1].end={...f.start},n[t][1].start={...d.end},i=[],n[l][1].end.offset-n[l][1].start.offset&&(i=zi(i,[["enter",n[l][1],e],["exit",n[l][1],e]])),i=zi(i,[["enter",g,e],["enter",f,e],["exit",f,e],["enter",p,e]]),i=zi(i,fp(e.parser.constructs.insideSpan.null,n.slice(l+1,t),e)),i=zi(i,[["exit",p,e],["enter",d,e],["exit",d,e],["exit",g,e]]);let b=0;n[t][1].end.offset-n[t][1].start.offset&&(b=2,i=zi(i,[["enter",n[t][1],e],["exit",n[t][1],e]])),tr(n,l-1,t-l+3,i),t=l+i.length-b-2;break}}for(t=-1;++t0&&Je(A)?gt(n,j,"linePrefix",o+1)(A):j(A)}function j(A){return A===null||Be(A)?n.check(iy,S,H)(A):(n.enter("codeFlowValue"),M(A))}function M(A){return A===null||Be(A)?(n.exit("codeFlowValue"),j(A)):(n.consume(A),M)}function H(A){return n.exit("codeFenced"),e(A)}function P(A,T,z){let ne=0;return F;function F(ie){return A.enter("lineEnding"),A.consume(ie),A.exit("lineEnding"),W}function W(ie){return A.enter("codeFencedFence"),Je(ie)?gt(A,U,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(ie):U(ie)}function U(ie){return ie===c?(A.enter("codeFencedFenceSequence"),re(ie)):z(ie)}function re(ie){return ie===c?(ne++,A.consume(ie),re):ne>=a?(A.exit("codeFencedFenceSequence"),Je(ie)?gt(A,de,"whitespace")(ie):de(ie)):z(ie)}function de(ie){return ie===null||Be(ie)?(A.exit("codeFencedFence"),T(ie)):z(ie)}}}const D0={name:"codeIndented",tokenize:qP},FP={partial:!0,tokenize:VP};function qP(n,e,t){return i;function i(c){return n.enter("codeIndented"),_A(n,l,t,"linePrefix",4,4)(c)}function l(c){return c===null?a(c):Be(c)?n.attempt(FP,l,a)(c):(n.enter("codeFlowValue"),o(c))}function o(c){return c===null||Be(c)?(n.exit("codeFlowValue"),l(c)):(n.consume(c),o)}function a(c){return n.exit("codeIndented"),e(c)}}function VP(n,e,t){const i=this;return l;function l(a){return i.parser.lazy[i.now().line]?t(a):Be(a)?(n.enter("lineEnding"),n.consume(a),n.exit("lineEnding"),l):_A(n,e,o,"linePrefix",4,4)(a)}function o(a){return Be(a)?l(a):t(a)}}const QP={name:"codeText",previous:$P,resolve:XP,tokenize:GP};function XP(n){let e=n.length-4,t=3,i,l;if((n[t][1].type==="lineEnding"||n[t][1].type==="space")&&(n[e][1].type==="lineEnding"||n[e][1].type==="space")){for(i=t;++i=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+e+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return ethis.left.length?this.right.slice(this.right.length-i+this.left.length,this.right.length-e+this.left.length).reverse():this.left.slice(e).concat(this.right.slice(this.right.length-i+this.left.length).reverse())}splice(e,t,i){const l=t||0;this.setCursor(Math.trunc(e));const o=this.right.splice(this.right.length-l,Number.POSITIVE_INFINITY);return i&&Uu(this.left,i),o.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(e){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(e)}pushMany(e){this.setCursor(Number.POSITIVE_INFINITY),Uu(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),Uu(this.right,e.reverse())}setCursor(e){if(!(e===this.left.length||e>this.left.length&&this.right.length===0||e<0&&this.left.length===0))if(e=4?e(a):n.interrupt(i.parser.constructs.flow,t,e)(a)}}function HA(n,e,t,i,l,o,a,c,f){const d=f||Number.POSITIVE_INFINITY;let p=0;return g;function g(O){return O===60?(n.enter(i),n.enter(l),n.enter(o),n.consume(O),n.exit(o),b):O===null||O===32||O===41||Hd(O)?t(O):(n.enter(i),n.enter(a),n.enter(c),n.enter("chunkString",{contentType:"string"}),S(O))}function b(O){return O===62?(n.enter(o),n.consume(O),n.exit(o),n.exit(l),n.exit(i),e):(n.enter(c),n.enter("chunkString",{contentType:"string"}),v(O))}function v(O){return O===62?(n.exit("chunkString"),n.exit(c),b(O)):O===null||O===60||Be(O)?t(O):(n.consume(O),O===92?w:v)}function w(O){return O===60||O===62||O===92?(n.consume(O),v):v(O)}function S(O){return!p&&(O===null||O===41||Rt(O))?(n.exit("chunkString"),n.exit(c),n.exit(a),n.exit(i),e(O)):p999||v===null||v===91||v===93&&!f||v===94&&!c&&"_hiddenFootnoteSupport"in a.parser.constructs?t(v):v===93?(n.exit(o),n.enter(l),n.consume(v),n.exit(l),n.exit(i),e):Be(v)?(n.enter("lineEnding"),n.consume(v),n.exit("lineEnding"),p):(n.enter("chunkString",{contentType:"string"}),g(v))}function g(v){return v===null||v===91||v===93||Be(v)||c++>999?(n.exit("chunkString"),p(v)):(n.consume(v),f||(f=!Je(v)),v===92?b:g)}function b(v){return v===91||v===92||v===93?(n.consume(v),c++,g):g(v)}}function UA(n,e,t,i,l,o){let a;return c;function c(b){return b===34||b===39||b===40?(n.enter(i),n.enter(l),n.consume(b),n.exit(l),a=b===40?41:b,f):t(b)}function f(b){return b===a?(n.enter(l),n.consume(b),n.exit(l),n.exit(i),e):(n.enter(o),d(b))}function d(b){return b===a?(n.exit(o),f(a)):b===null?t(b):Be(b)?(n.enter("lineEnding"),n.consume(b),n.exit("lineEnding"),gt(n,d,"linePrefix")):(n.enter("chunkString",{contentType:"string"}),p(b))}function p(b){return b===a||b===null||Be(b)?(n.exit("chunkString"),d(b)):(n.consume(b),b===92?g:p)}function g(b){return b===a||b===92?(n.consume(b),p):p(b)}}function rc(n,e){let t;return i;function i(l){return Be(l)?(n.enter("lineEnding"),n.consume(l),n.exit("lineEnding"),t=!0,i):Je(l)?gt(n,i,t?"linePrefix":"lineSuffix")(l):e(l)}}const nH={name:"definition",tokenize:rH},iH={partial:!0,tokenize:lH};function rH(n,e,t){const i=this;let l;return o;function o(v){return n.enter("definition"),a(v)}function a(v){return IA.call(i,n,c,t,"definitionLabel","definitionLabelMarker","definitionLabelString")(v)}function c(v){return l=nr(i.sliceSerialize(i.events[i.events.length-1][1]).slice(1,-1)),v===58?(n.enter("definitionMarker"),n.consume(v),n.exit("definitionMarker"),f):t(v)}function f(v){return Rt(v)?rc(n,d)(v):d(v)}function d(v){return HA(n,p,t,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(v)}function p(v){return n.attempt(iH,g,g)(v)}function g(v){return Je(v)?gt(n,b,"whitespace")(v):b(v)}function b(v){return v===null||Be(v)?(n.exit("definition"),i.parser.defined.push(l),e(v)):t(v)}}function lH(n,e,t){return i;function i(c){return Rt(c)?rc(n,l)(c):t(c)}function l(c){return UA(n,o,t,"definitionTitle","definitionTitleMarker","definitionTitleString")(c)}function o(c){return Je(c)?gt(n,a,"whitespace")(c):a(c)}function a(c){return c===null||Be(c)?e(c):t(c)}}const sH={name:"hardBreakEscape",tokenize:oH};function oH(n,e,t){return i;function i(o){return n.enter("hardBreakEscape"),n.consume(o),l}function l(o){return Be(o)?(n.exit("hardBreakEscape"),e(o)):t(o)}}const aH={name:"headingAtx",resolve:uH,tokenize:cH};function uH(n,e){let t=n.length-2,i=3;if(n[i][1].type==="whitespace"&&(i+=2),t-2>i&&n[t][1].type==="whitespace"&&(t-=2),n[t][1].type==="atxHeadingSequence"&&(i===t-1||t-4>i&&n[t-2][1].type==="whitespace")&&(t-=i+1===t?2:4),t>i){const l={type:"atxHeadingText",start:n[i][1].start,end:n[t][1].end},o={type:"chunkText",start:n[i][1].start,end:n[t][1].end,contentType:"text"};tr(n,i,t-i+1,[["enter",l,e],["enter",o,e],["exit",o,e],["exit",l,e]])}return n}function cH(n,e,t){let i=0;return l;function l(p){return n.enter("atxHeading"),o(p)}function o(p){return n.enter("atxHeadingSequence"),a(p)}function a(p){return p===35&&i++<6?(n.consume(p),a):p===null||Rt(p)?(n.exit("atxHeadingSequence"),c(p)):t(p)}function c(p){return p===35?(n.enter("atxHeadingSequence"),f(p)):p===null||Be(p)?(n.exit("atxHeading"),e(p)):Je(p)?gt(n,c,"whitespace")(p):(n.enter("atxHeadingText"),d(p))}function f(p){return p===35?(n.consume(p),f):(n.exit("atxHeadingSequence"),c(p))}function d(p){return p===null||p===35||Rt(p)?(n.exit("atxHeadingText"),c(p)):(n.consume(p),d)}}const FA=["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"],ry=["pre","script","style","textarea"],fH={concrete:!0,name:"htmlFlow",resolveTo:dH,tokenize:pH},hH={partial:!0,tokenize:mH};function dH(n){let e=n.length;for(;e--&&!(n[e][0]==="enter"&&n[e][1].type==="htmlFlow"););return e>1&&n[e-2][1].type==="linePrefix"&&(n[e][1].start=n[e-2][1].start,n[e+1][1].start=n[e-2][1].start,n.splice(e-2,2)),n}function pH(n,e,t){const i=this;let l,o,a,c,f;return d;function d(B){return p(B)}function p(B){return n.enter("htmlFlow"),n.enter("htmlFlowData"),n.consume(B),g}function g(B){return B===33?(n.consume(B),b):B===47?(n.consume(B),o=!0,S):B===63?(n.consume(B),l=3,i.interrupt?e:E):En(B)?(n.consume(B),a=String.fromCharCode(B),C):t(B)}function b(B){return B===45?(n.consume(B),l=2,v):B===91?(n.consume(B),l=5,c=0,w):En(B)?(n.consume(B),l=4,i.interrupt?e:E):t(B)}function v(B){return B===45?(n.consume(B),i.interrupt?e:E):t(B)}function w(B){const D="CDATA[";return B===D.charCodeAt(c++)?(n.consume(B),c===D.length?i.interrupt?e:U:w):t(B)}function S(B){return En(B)?(n.consume(B),a=String.fromCharCode(B),C):t(B)}function C(B){if(B===null||B===47||B===62||Rt(B)){const D=B===47,X=a.toLowerCase();return!D&&!o&&ry.includes(X)?(l=1,i.interrupt?e(B):U(B)):FA.includes(a.toLowerCase())?(l=6,D?(n.consume(B),O):i.interrupt?e(B):U(B)):(l=7,i.interrupt&&!i.parser.lazy[i.now().line]?t(B):o?j(B):M(B))}return B===45||Mn(B)?(n.consume(B),a+=String.fromCharCode(B),C):t(B)}function O(B){return B===62?(n.consume(B),i.interrupt?e:U):t(B)}function j(B){return Je(B)?(n.consume(B),j):F(B)}function M(B){return B===47?(n.consume(B),F):B===58||B===95||En(B)?(n.consume(B),H):Je(B)?(n.consume(B),M):F(B)}function H(B){return B===45||B===46||B===58||B===95||Mn(B)?(n.consume(B),H):P(B)}function P(B){return B===61?(n.consume(B),A):Je(B)?(n.consume(B),P):M(B)}function A(B){return B===null||B===60||B===61||B===62||B===96?t(B):B===34||B===39?(n.consume(B),f=B,T):Je(B)?(n.consume(B),A):z(B)}function T(B){return B===f?(n.consume(B),f=null,ne):B===null||Be(B)?t(B):(n.consume(B),T)}function z(B){return B===null||B===34||B===39||B===47||B===60||B===61||B===62||B===96||Rt(B)?P(B):(n.consume(B),z)}function ne(B){return B===47||B===62||Je(B)?M(B):t(B)}function F(B){return B===62?(n.consume(B),W):t(B)}function W(B){return B===null||Be(B)?U(B):Je(B)?(n.consume(B),W):t(B)}function U(B){return B===45&&l===2?(n.consume(B),L):B===60&&l===1?(n.consume(B),ee):B===62&&l===4?(n.consume(B),ze):B===63&&l===3?(n.consume(B),E):B===93&&l===5?(n.consume(B),le):Be(B)&&(l===6||l===7)?(n.exit("htmlFlowData"),n.check(hH,je,re)(B)):B===null||Be(B)?(n.exit("htmlFlowData"),re(B)):(n.consume(B),U)}function re(B){return n.check(iy,de,je)(B)}function de(B){return n.enter("lineEnding"),n.consume(B),n.exit("lineEnding"),ie}function ie(B){return B===null||Be(B)?re(B):(n.enter("htmlFlowData"),U(B))}function L(B){return B===45?(n.consume(B),E):U(B)}function ee(B){return B===47?(n.consume(B),a="",se):U(B)}function se(B){if(B===62){const D=a.toLowerCase();return ry.includes(D)?(n.consume(B),ze):U(B)}return En(B)&&a.length<8?(n.consume(B),a+=String.fromCharCode(B),se):U(B)}function le(B){return B===93?(n.consume(B),E):U(B)}function E(B){return B===62?(n.consume(B),ze):B===45&&l===2?(n.consume(B),E):U(B)}function ze(B){return B===null||Be(B)?(n.exit("htmlFlowData"),je(B)):(n.consume(B),ze)}function je(B){return n.exit("htmlFlow"),e(B)}}function mH(n,e,t){return i;function i(l){return n.enter("lineEnding"),n.consume(l),n.exit("lineEnding"),n.attempt(Dc,e,t)}}const gH={name:"htmlText",tokenize:xH};function xH(n,e,t){const i=this;let l,o,a;return c;function c(E){return n.enter("htmlText"),n.enter("htmlTextData"),n.consume(E),f}function f(E){return E===33?(n.consume(E),d):E===47?(n.consume(E),P):E===63?(n.consume(E),M):En(E)?(n.consume(E),z):t(E)}function d(E){return E===45?(n.consume(E),p):E===91?(n.consume(E),o=0,w):En(E)?(n.consume(E),j):t(E)}function p(E){return E===45?(n.consume(E),v):t(E)}function g(E){return E===null?t(E):E===45?(n.consume(E),b):Be(E)?(a=g,ee(E)):(n.consume(E),g)}function b(E){return E===45?(n.consume(E),v):g(E)}function v(E){return E===62?L(E):E===45?b(E):g(E)}function w(E){const ze="CDATA[";return E===ze.charCodeAt(o++)?(n.consume(E),o===ze.length?S:w):t(E)}function S(E){return E===null?t(E):E===93?(n.consume(E),C):Be(E)?(a=S,ee(E)):(n.consume(E),S)}function C(E){return E===93?(n.consume(E),O):S(E)}function O(E){return E===62?L(E):E===93?(n.consume(E),O):S(E)}function j(E){return E===null||E===62?L(E):Be(E)?(a=j,ee(E)):(n.consume(E),j)}function M(E){return E===null?t(E):E===63?(n.consume(E),H):Be(E)?(a=M,ee(E)):(n.consume(E),M)}function H(E){return E===62?L(E):M(E)}function P(E){return En(E)?(n.consume(E),A):t(E)}function A(E){return E===45||Mn(E)?(n.consume(E),A):T(E)}function T(E){return Be(E)?(a=T,ee(E)):Je(E)?(n.consume(E),T):L(E)}function z(E){return E===45||Mn(E)?(n.consume(E),z):E===47||E===62||Rt(E)?ne(E):t(E)}function ne(E){return E===47?(n.consume(E),L):E===58||E===95||En(E)?(n.consume(E),F):Be(E)?(a=ne,ee(E)):Je(E)?(n.consume(E),ne):L(E)}function F(E){return E===45||E===46||E===58||E===95||Mn(E)?(n.consume(E),F):W(E)}function W(E){return E===61?(n.consume(E),U):Be(E)?(a=W,ee(E)):Je(E)?(n.consume(E),W):ne(E)}function U(E){return E===null||E===60||E===61||E===62||E===96?t(E):E===34||E===39?(n.consume(E),l=E,re):Be(E)?(a=U,ee(E)):Je(E)?(n.consume(E),U):(n.consume(E),de)}function re(E){return E===l?(n.consume(E),l=void 0,ie):E===null?t(E):Be(E)?(a=re,ee(E)):(n.consume(E),re)}function de(E){return E===null||E===34||E===39||E===60||E===61||E===96?t(E):E===47||E===62||Rt(E)?ne(E):(n.consume(E),de)}function ie(E){return E===47||E===62||Rt(E)?ne(E):t(E)}function L(E){return E===62?(n.consume(E),n.exit("htmlTextData"),n.exit("htmlText"),e):t(E)}function ee(E){return n.exit("htmlTextData"),n.enter("lineEnding"),n.consume(E),n.exit("lineEnding"),se}function se(E){return Je(E)?gt(n,le,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(E):le(E)}function le(E){return n.enter("htmlTextData"),a(E)}}const ab={name:"labelEnd",resolveAll:wH,resolveTo:kH,tokenize:SH},yH={tokenize:CH},bH={tokenize:OH},vH={tokenize:NH};function wH(n){let e=-1;const t=[];for(;++e0&&l[l.length-1]._balanced;)l.pop();o=l[l.length-1]}return c;function c(b){return o?o._inactive?g(b):(a=i.parser.defined.includes(nr(i.sliceSerialize({start:o.end,end:i.now()}))),n.enter("labelEnd"),n.enter("labelMarker"),n.consume(b),n.exit("labelMarker"),n.exit("labelEnd"),f):t(b)}function f(b){return b===40?n.attempt(yH,p,a?p:g)(b):b===91?n.attempt(bH,p,a?d:g)(b):a?p(b):g(b)}function d(b){return n.attempt(vH,p,g)(b)}function p(b){return l.pop(),e(b)}function g(b){return o._balanced=!0,t(b)}}function CH(n,e,t){return i;function i(g){return n.enter("resource"),n.enter("resourceMarker"),n.consume(g),n.exit("resourceMarker"),l}function l(g){return Rt(g)?rc(n,o)(g):o(g)}function o(g){return g===41?p(g):HA(n,a,c,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(g)}function a(g){return Rt(g)?rc(n,f)(g):p(g)}function c(g){return t(g)}function f(g){return g===34||g===39||g===40?UA(n,d,t,"resourceTitle","resourceTitleMarker","resourceTitleString")(g):p(g)}function d(g){return Rt(g)?rc(n,p)(g):p(g)}function p(g){return g===41?(n.enter("resourceMarker"),n.consume(g),n.exit("resourceMarker"),n.exit("resource"),e):t(g)}}function OH(n,e,t){const i=this;return l;function l(c){return IA.call(i,n,o,a,"reference","referenceMarker","referenceString")(c)}function o(c){return i.parser.defined.includes(nr(i.sliceSerialize(i.events[i.events.length-1][1]).slice(1,-1)))?e(c):t(c)}function a(c){return t(c)}}function NH(n,e,t){return i;function i(o){return n.enter("reference"),n.enter("referenceMarker"),n.consume(o),n.exit("referenceMarker"),l}function l(o){return o===93?(n.enter("referenceMarker"),n.consume(o),n.exit("referenceMarker"),n.exit("reference"),e):t(o)}}const TH={name:"labelStartImage",resolveAll:ab.resolveAll,tokenize:AH};function AH(n,e,t){const i=this;let l;return o;function o(f){return n.enter("labelImage"),n.enter("labelImageMarker"),n.consume(f),n.exit("labelImageMarker"),a}function a(f){return f===91?(n.enter("labelMarker"),n.consume(f),n.exit("labelMarker"),l=n.exit("labelImage"),c):t(f)}function c(f){return f===94&&"_hiddenFootnoteSupport"in i.parser.constructs?t(f):(i._labelStarts=i._labelStarts||[],i._labelStarts.push(l),e(f))}}const EH={name:"labelStartLink",resolveAll:ab.resolveAll,tokenize:MH};function MH(n,e,t){const i=this;let l;return o;function o(c){return n.enter("labelLink"),n.enter("labelMarker"),n.consume(c),n.exit("labelMarker"),l=n.exit("labelLink"),a}function a(c){return c===94&&"_hiddenFootnoteSupport"in i.parser.constructs?t(c):(i._labelStarts=i._labelStarts||[],i._labelStarts.push(l),e(c))}}const R0={name:"lineEnding",tokenize:DH};function DH(n,e){return t;function t(i){return n.enter("lineEnding"),n.consume(i),n.exit("lineEnding"),gt(n,e,"linePrefix")}}const sd={name:"thematicBreak",tokenize:RH};function RH(n,e,t){let i=0,l;return o;function o(d){return n.enter("thematicBreak"),a(d)}function a(d){return l=d,c(d)}function c(d){return d===l?(n.enter("thematicBreakSequence"),f(d)):i>=3&&(d===null||Be(d))?(n.exit("thematicBreak"),e(d)):t(d)}function f(d){return d===l?(n.consume(d),i++,f):(n.exit("thematicBreakSequence"),Je(d)?gt(n,c,"whitespace")(d):c(d))}}const li={continuation:{tokenize:zH},exit:PH,name:"list",tokenize:LH},jH={partial:!0,tokenize:HH},_H={partial:!0,tokenize:BH};function LH(n,e,t){const i=this,l=i.events[i.events.length-1];let o=l&&l[1].type==="linePrefix"?l[2].sliceSerialize(l[1],!0).length:0,a=0;return c;function c(v){const w=i.containerState.type||(v===42||v===43||v===45?"listUnordered":"listOrdered");if(w==="listUnordered"?!i.containerState.marker||v===i.containerState.marker:ty(v)){if(i.containerState.type||(i.containerState.type=w,n.enter(w,{_container:!0})),w==="listUnordered")return n.enter("listItemPrefix"),v===42||v===45?n.check(sd,t,d)(v):d(v);if(!i.interrupt||v===49)return n.enter("listItemPrefix"),n.enter("listItemValue"),f(v)}return t(v)}function f(v){return ty(v)&&++a<10?(n.consume(v),f):(!i.interrupt||a<2)&&(i.containerState.marker?v===i.containerState.marker:v===41||v===46)?(n.exit("listItemValue"),d(v)):t(v)}function d(v){return n.enter("listItemMarker"),n.consume(v),n.exit("listItemMarker"),i.containerState.marker=i.containerState.marker||v,n.check(Dc,i.interrupt?t:p,n.attempt(jH,b,g))}function p(v){return i.containerState.initialBlankLine=!0,o++,b(v)}function g(v){return Je(v)?(n.enter("listItemPrefixWhitespace"),n.consume(v),n.exit("listItemPrefixWhitespace"),b):t(v)}function b(v){return i.containerState.size=o+i.sliceSerialize(n.exit("listItemPrefix"),!0).length,e(v)}}function zH(n,e,t){const i=this;return i.containerState._closeFlow=void 0,n.check(Dc,l,o);function l(c){return i.containerState.furtherBlankLines=i.containerState.furtherBlankLines||i.containerState.initialBlankLine,gt(n,e,"listItemIndent",i.containerState.size+1)(c)}function o(c){return i.containerState.furtherBlankLines||!Je(c)?(i.containerState.furtherBlankLines=void 0,i.containerState.initialBlankLine=void 0,a(c)):(i.containerState.furtherBlankLines=void 0,i.containerState.initialBlankLine=void 0,n.attempt(_H,e,a)(c))}function a(c){return i.containerState._closeFlow=!0,i.interrupt=void 0,gt(n,n.attempt(li,e,t),"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(c)}}function BH(n,e,t){const i=this;return gt(n,l,"listItemIndent",i.containerState.size+1);function l(o){const a=i.events[i.events.length-1];return a&&a[1].type==="listItemIndent"&&a[2].sliceSerialize(a[1],!0).length===i.containerState.size?e(o):t(o)}}function PH(n){n.exit(this.containerState.type)}function HH(n,e,t){const i=this;return gt(n,l,"listItemPrefixWhitespace",i.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function l(o){const a=i.events[i.events.length-1];return!Je(o)&&a&&a[1].type==="listItemPrefixWhitespace"?e(o):t(o)}}const cC={name:"setextUnderline",resolveTo:IH,tokenize:UH};function IH(n,e){const t=new Id;let i=n.length,l,o,a;for(;i--;)if(n[i][0]==="enter"){if(n[i][1].type==="content"){l=i;break}n[i][1].type==="paragraph"&&(o=i)}else n[i][1].type==="content"&&t.add(i,1,[]),!a&&n[i][1].type==="definition"&&(a=i);const c={type:"setextHeading",start:{...n[l][1].start},end:{...n[n.length-1][1].end}};return n[o][1].type="setextHeadingText",a?(t.add(o,0,[["enter",c,e]]),t.add(a+1,0,[["exit",n[l][1],e]]),n[l][1].end={...n[a][1].end}):n[l][1]=c,t.add(n.length,0,[["exit",c,e]]),t.consume(n),n}function UH(n,e,t){const i=this;let l;return o;function o(d){let p=i.events.length,g;for(;p--;)if(i.events[p][1].type!=="lineEnding"&&i.events[p][1].type!=="linePrefix"&&i.events[p][1].type!=="content"){g=i.events[p][1].type==="paragraph";break}return!i.parser.lazy[i.now().line]&&(i.interrupt||g)?(n.enter("setextHeadingLine"),l=d,a(d)):t(d)}function a(d){return n.enter("setextHeadingLineSequence"),c(d)}function c(d){return d===l?(n.consume(d),c):(n.exit("setextHeadingLineSequence"),Je(d)?gt(n,f,"lineSuffix")(d):f(d))}function f(d){return d===null||Be(d)?(n.exit("setextHeadingLine"),e(d)):t(d)}}const FH={tokenize:qH};function qH(n){const e=this,t=n.attempt(Dc,i,n.attempt(this.parser.constructs.flowInitial,l,gt(n,n.attempt(this.parser.constructs.flow,l,n.attempt(WP,l)),"linePrefix")));return t;function i(o){if(o===null){n.consume(o);return}return n.enter("lineEndingBlank"),n.consume(o),n.exit("lineEndingBlank"),e.currentConstruct=void 0,t}function l(o){if(o===null){n.consume(o);return}return n.enter("lineEnding"),n.consume(o),n.exit("lineEnding"),e.currentConstruct=void 0,t}}const VH={resolveAll:VA()},QH=qA("string"),XH=qA("text");function qA(n){return{resolveAll:VA(n==="text"?$H:void 0),tokenize:e};function e(t){const i=this,l=this.parser.constructs[n],o=t.attempt(l,a,c);return a;function a(p){return d(p)?o(p):c(p)}function c(p){if(p===null){t.consume(p);return}return t.enter("data"),t.consume(p),f}function f(p){return d(p)?(t.exit("data"),o(p)):(t.consume(p),f)}function d(p){if(p===null)return!0;const g=l[p];let b=-1;if(g)for(;++b-1){const c=a[0];typeof c=="string"?a[0]=c.slice(i):a.shift()}o>0&&a.push(n[l].slice(0,o))}return a}function s7(n,e){let t=-1;const i=[];let l;for(;++t0&&l(e.beforeEnter,{...Ae,sliceSerialize:J[ft][2].sliceSerialize},J[ft][1]),QA.call(jt,J[ft][1].type)&&jt[J[ft][1].type].call({...Ae,sliceSerialize:J[ft][2].sliceSerialize},J[ft][1]),J[ft][0]==="exit"&&e.afterExit.length>0&&l(e.afterExit,{...Ae,sliceSerialize:J[ft][2].sliceSerialize},J[ft][1])}if(Ae.tokenStack.length>0){const jt=Ae.tokenStack[Ae.tokenStack.length-1];(jt[1]||hC).call(Ae,void 0,jt[0])}for(he.position={start:Fl(J.length>0?J[0][1].start:{line:1,column:1,offset:0}),end:Fl(J.length>0?J[J.length-2][1].end:{line:1,column:1,offset:0})},ft=-1;++ft0&&(i.className=["language-"+l[0]]);let o={type:"element",tagName:"code",properties:i,children:[{type:"text",value:t}]};return e.meta&&(o.data={meta:e.meta}),n.patch(e,o),o=n.applyData(e,o),o={type:"element",tagName:"pre",properties:{},children:[o]},n.patch(e,o),o}function v7(n,e){const t={type:"element",tagName:"del",properties:{},children:n.all(e)};return n.patch(e,t),n.applyData(e,t)}function w7(n,e){const t={type:"element",tagName:"em",properties:{},children:n.all(e)};return n.patch(e,t),n.applyData(e,t)}function k7(n,e){const t=typeof n.options.clobberPrefix=="string"?n.options.clobberPrefix:"user-content-",i=String(e.identifier).toUpperCase(),l=Ha(i.toLowerCase()),o=n.footnoteOrder.indexOf(i);let a,c=n.footnoteCounts.get(i);c===void 0?(c=0,n.footnoteOrder.push(i),a=n.footnoteOrder.length):a=o+1,c+=1,n.footnoteCounts.set(i,c);const f={type:"element",tagName:"a",properties:{href:"#"+t+"fn-"+l,id:t+"fnref-"+l+(c>1?"-"+c:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(a)}]};n.patch(e,f);const d={type:"element",tagName:"sup",properties:{},children:[f]};return n.patch(e,d),n.applyData(e,d)}function S7(n,e){const t={type:"element",tagName:"h"+e.depth,properties:{},children:n.all(e)};return n.patch(e,t),n.applyData(e,t)}function C7(n,e){if(n.options.allowDangerousHtml){const t={type:"raw",value:e.value};return n.patch(e,t),n.applyData(e,t)}}function $A(n,e){const t=e.referenceType;let i="]";if(t==="collapsed"?i+="[]":t==="full"&&(i+="["+(e.label||e.identifier)+"]"),e.type==="imageReference")return[{type:"text",value:"!["+e.alt+i}];const l=n.all(e),o=l[0];o&&o.type==="text"?o.value="["+o.value:l.unshift({type:"text",value:"["});const a=l[l.length-1];return a&&a.type==="text"?a.value+=i:l.push({type:"text",value:i}),l}function O7(n,e){const t=String(e.identifier).toUpperCase(),i=n.definitionById.get(t);if(!i)return $A(n,e);const l={src:Ha(i.url||""),alt:e.alt};i.title!==null&&i.title!==void 0&&(l.title=i.title);const o={type:"element",tagName:"img",properties:l,children:[]};return n.patch(e,o),n.applyData(e,o)}function N7(n,e){const t={src:Ha(e.url)};e.alt!==null&&e.alt!==void 0&&(t.alt=e.alt),e.title!==null&&e.title!==void 0&&(t.title=e.title);const i={type:"element",tagName:"img",properties:t,children:[]};return n.patch(e,i),n.applyData(e,i)}function T7(n,e){const t={type:"text",value:e.value.replace(/\r?\n|\r/g," ")};n.patch(e,t);const i={type:"element",tagName:"code",properties:{},children:[t]};return n.patch(e,i),n.applyData(e,i)}function A7(n,e){const t=String(e.identifier).toUpperCase(),i=n.definitionById.get(t);if(!i)return $A(n,e);const l={href:Ha(i.url||"")};i.title!==null&&i.title!==void 0&&(l.title=i.title);const o={type:"element",tagName:"a",properties:l,children:n.all(e)};return n.patch(e,o),n.applyData(e,o)}function E7(n,e){const t={href:Ha(e.url)};e.title!==null&&e.title!==void 0&&(t.title=e.title);const i={type:"element",tagName:"a",properties:t,children:n.all(e)};return n.patch(e,i),n.applyData(e,i)}function M7(n,e,t){const i=n.all(e),l=t?D7(t):GA(e),o={},a=[];if(typeof e.checked=="boolean"){const p=i[0];let g;p&&p.type==="element"&&p.tagName==="p"?g=p:(g={type:"element",tagName:"p",properties:{},children:[]},i.unshift(g)),g.children.length>0&&g.children.unshift({type:"text",value:" "}),g.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:e.checked,disabled:!0},children:[]}),o.className=["task-list-item"]}let c=-1;for(;++c1}function R7(n,e){const t={},i=n.all(e);let l=-1;for(typeof e.start=="number"&&e.start!==1&&(t.start=e.start);++l0){const a={type:"element",tagName:"tbody",properties:{},children:n.wrap(t,!0)},c=nb(e.children[1]),f=CA(e.children[e.children.length-1]);c&&f&&(a.position={start:c,end:f}),l.push(a)}const o={type:"element",tagName:"table",properties:{},children:n.wrap(l,!0)};return n.patch(e,o),n.applyData(e,o)}function B7(n,e,t){const i=t?t.children:void 0,o=(i?i.indexOf(e):1)===0?"th":"td",a=t&&t.type==="table"?t.align:void 0,c=a?a.length:e.children.length;let f=-1;const d=[];for(;++f0,!0),i[0]),l=i.index+i[0].length,i=t.exec(e);return o.push(mC(e.slice(l),l>0,!1)),o.join("")}function mC(n,e,t){let i=0,l=n.length;if(e){let o=n.codePointAt(i);for(;o===dC||o===pC;)i++,o=n.codePointAt(i)}if(t){let o=n.codePointAt(l-1);for(;o===dC||o===pC;)l--,o=n.codePointAt(l-1)}return l>i?n.slice(i,l):""}function I7(n,e){const t={type:"text",value:H7(String(e.value))};return n.patch(e,t),n.applyData(e,t)}function U7(n,e){const t={type:"element",tagName:"hr",properties:{},children:[]};return n.patch(e,t),n.applyData(e,t)}const F7={blockquote:x7,break:y7,code:b7,delete:v7,emphasis:w7,footnoteReference:k7,heading:S7,html:C7,imageReference:O7,image:N7,inlineCode:T7,linkReference:A7,link:E7,listItem:M7,list:R7,paragraph:j7,root:_7,strong:L7,table:z7,tableCell:P7,tableRow:B7,text:I7,thematicBreak:U7,toml:Ih,yaml:Ih,definition:Ih,footnoteDefinition:Ih};function Ih(){}const YA=-1,hp=0,lc=1,Ud=2,ub=3,cb=4,fb=5,hb=6,KA=7,WA=8,{defineProperty:q7}=Object,ZA=typeof self=="object"?self:globalThis,gC=(n,e)=>{switch(n){case"Function":case"SharedWorker":case"Worker":case"eval":case"setInterval":case"setTimeout":throw new TypeError("unable to deserialize "+n)}return new ZA[n](e)},V7=(n,e)=>{const t=(l,o)=>(n.set(o,l),l),i=l=>{if(n.has(l))return n.get(l);const[o,a]=e[l];switch(o){case hp:case YA:return t(a,l);case lc:{const c=t([],l);for(const f of a)c.push(i(f));return c}case Ud:{const c=t({},l);for(const[f,d]of a){const p=i(f),g=i(d);p==="__proto__"?q7(c,p,{value:g,configurable:!0,enumerable:!0,writable:!0}):c[p]=g}return c}case ub:return t(new Date(a),l);case cb:{const{source:c,flags:f}=a;return t(new RegExp(c,f),l)}case fb:{const c=t(new Map,l);for(const[f,d]of a)c.set(i(f),i(d));return c}case hb:{const c=t(new Set,l);for(const f of a)c.add(i(f));return c}case KA:{const{name:c,message:f}=a;return t(typeof ZA[c]=="function"?gC(c,f):new Error(f),l)}case WA:return t(BigInt(a),l);case"BigInt":return t(Object(BigInt(a)),l);case"ArrayBuffer":return t(new Uint8Array(a).buffer,a);case"DataView":{const{buffer:c}=new Uint8Array(a);return t(new DataView(c),a)}case"-0":return-0}return t(gC(o,a),l)};return i},xC=n=>V7(new Map,n)(0),Xs="",{toString:Q7}={},{keys:X7,is:$7}=Object,Fu=n=>{const e=typeof n;if(e!=="object"||!n)return[hp,e];const t=Q7.call(n).slice(8,-1);switch(t){case"Array":return[lc,Xs];case"Object":return[Ud,Xs];case"Date":return[ub,Xs];case"RegExp":return[cb,Xs];case"Map":return[fb,Xs];case"Set":return[hb,Xs];case"DataView":return[lc,t]}return t.includes("Array")?[lc,t]:n instanceof Error?[KA,n.name||"Error"]:[Ud,t]},Uh=([n,e])=>n===hp&&(e==="function"||e==="symbol"),G7=(n,e,t,i)=>{const l=(a,c)=>{const f=i.push(a)-1;return t.set(c,f),f},o=a=>{if(t.has(a))return t.get(a);let[c,f]=Fu(a);switch(c){case hp:{let p=a;switch(f){case"bigint":c=WA,p=a.toString();break;case"number":if(!a&&$7(a,-0))return i.push(["-0"])-1;break;case"function":case"symbol":if(n)throw new TypeError("unable to serialize "+f);p=null;break;case"undefined":return l([YA],a)}return l([c,p],a)}case lc:{if(f){let b=a;return f==="DataView"?b=new Uint8Array(a.buffer):f==="ArrayBuffer"&&(b=new Uint8Array(a)),l([f,[...b]],a)}const p=[],g=l([c,p],a);for(const b of a)p.push(o(b));return g}case Ud:{if(f)switch(f){case"BigInt":return l([f,a.toString()],a);case"Boolean":case"Number":case"String":return l([f,a.valueOf()],a)}if(e&&"toJSON"in a)return o(a.toJSON());const p=[],g=l([c,p],a);for(const b of X7(a))(n||!Uh(Fu(a[b])))&&p.push([o(b),o(a[b])]);return g}case ub:return l([c,isNaN(a.getTime())?Xs:a.toISOString()],a);case cb:{const{source:p,flags:g}=a;return l([c,{source:p,flags:g}],a)}case fb:{const p=[],g=l([c,p],a);for(const[b,v]of a)(n||!(Uh(Fu(b))||Uh(Fu(v))))&&p.push([o(b),o(v)]);return g}case hb:{const p=[],g=l([c,p],a);for(const b of a)(n||!Uh(Fu(b)))&&p.push(o(b));return g}}const{message:d}=a;return l([c,{name:f,message:d}],a)};return o},yC=(n,{json:e,lossy:t}={})=>{const i=[];return G7(!(e||t),!!e,new Map,i)(n),i},Fd=typeof structuredClone=="function"?(n,e)=>e&&("json"in e||"lossy"in e)?xC(yC(n,e)):structuredClone(n):(n,e)=>xC(yC(n,e));function Y7(n,e){const t=[{type:"text",value:"↩"}];return e>1&&t.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(e)}]}),t}function K7(n,e){return"Back to reference "+(n+1)+(e>1?"-"+e:"")}function W7(n){const e=typeof n.options.clobberPrefix=="string"?n.options.clobberPrefix:"user-content-",t=n.options.footnoteBackContent||Y7,i=n.options.footnoteBackLabel||K7,l=n.options.footnoteLabel||"Footnotes",o=n.options.footnoteLabelTagName||"h2",a=n.options.footnoteLabelProperties||{className:["sr-only"]},c=[];let f=-1;for(;++f0&&w.push({type:"text",value:" "});let j=typeof t=="string"?t:t(f,v);typeof j=="string"&&(j={type:"text",value:j}),w.push({type:"element",tagName:"a",properties:{href:"#"+e+"fnref-"+b+(v>1?"-"+v:""),dataFootnoteBackref:"",ariaLabel:typeof i=="string"?i:i(f,v),className:["data-footnote-backref"]},children:Array.isArray(j)?j:[j]})}const C=p[p.length-1];if(C&&C.type==="element"&&C.tagName==="p"){const j=C.children[C.children.length-1];j&&j.type==="text"?j.value+=" ":C.children.push({type:"text",value:" "}),C.children.push(...w)}else p.push(...w);const O={type:"element",tagName:"li",properties:{id:e+"fn-"+b},children:n.wrap(p,!0)};n.patch(d,O),c.push(O)}if(c.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:o,properties:{...Fd(a),id:"footnote-label"},children:[{type:"text",value:l}]},{type:"text",value:` -`},{type:"element",tagName:"ol",properties:{},children:n.wrap(c,!0)},{type:"text",value:` -`}]}}const dp=(function(n){if(n==null)return tI;if(typeof n=="function")return pp(n);if(typeof n=="object")return Array.isArray(n)?Z7(n):J7(n);if(typeof n=="string")return eI(n);throw new Error("Expected function, string, or object as test")});function Z7(n){const e=[];let t=-1;for(;++t":""))+")"})}return C;function C(){const O=!o||d(b,v,w[w.length-1]||void 0);let j=JA;if(c&&O&&(j=bC(c(b,w,v)),j[0]===od))return j;if("children"in b&&b.children){const M=b;if(M.children&&j[0]!==ly){let H=(l?-1:M.children.length)+p;const P=[...w,M];for(;H>-1&&H0&&t.push({type:"text",value:` -`}),t}function vC(n){let e=0,t=n.charCodeAt(e);for(;t===9||t===32;)e++,t=n.charCodeAt(e);return n.slice(e)}function wC(n,e){const t=sI(n,e),i=t.one(n,void 0),l=W7(t),o=Array.isArray(i)?{type:"root",children:i}:i||{type:"root",children:[]};return l&&o.children.push({type:"text",value:` -`},l),o}function fI(n,e){return n&&"run"in n?async function(t,i){const l=wC(t,{file:i,...e});await n.run(l,i)}:function(t,i){return wC(t,{file:i,...n||e})}}function kC(n){if(n)throw n}var j0,SC;function hI(){if(SC)return j0;SC=1;var n=Object.prototype.hasOwnProperty,e=Object.prototype.toString,t=Object.defineProperty,i=Object.getOwnPropertyDescriptor,l=function(d){return typeof Array.isArray=="function"?Array.isArray(d):e.call(d)==="[object Array]"},o=function(d){if(!d||e.call(d)!=="[object Object]")return!1;var p=n.call(d,"constructor"),g=d.constructor&&d.constructor.prototype&&n.call(d.constructor.prototype,"isPrototypeOf");if(d.constructor&&!p&&!g)return!1;var b;for(b in d);return typeof b>"u"||n.call(d,b)},a=function(d,p){t&&p.name==="__proto__"?t(d,p.name,{enumerable:!0,configurable:!0,value:p.newValue,writable:!0}):d[p.name]=p.newValue},c=function(d,p){if(p==="__proto__")if(n.call(d,p)){if(i)return i(d,p).value}else return;return d[p]};return j0=function f(){var d,p,g,b,v,w,S=arguments[0],C=1,O=arguments.length,j=!1;for(typeof S=="boolean"&&(j=S,S=arguments[1]||{},C=2),(S==null||typeof S!="object"&&typeof S!="function")&&(S={});Ca.length;let f;c&&a.push(l);try{f=n.apply(this,a)}catch(d){const p=d;if(c&&t)throw p;return l(p)}c||(f&&f.then&&typeof f.then=="function"?f.then(o,l):f instanceof Error?l(f):o(f))}function l(a,...c){t||(t=!0,e(a,...c))}function o(a){l(null,a)}}const Sr={basename:gI,dirname:xI,extname:yI,join:bI,sep:"/"};function gI(n,e){if(e!==void 0&&typeof e!="string")throw new TypeError('"ext" argument must be a string');Rc(n);let t=0,i=-1,l=n.length,o;if(e===void 0||e.length===0||e.length>n.length){for(;l--;)if(n.codePointAt(l)===47){if(o){t=l+1;break}}else i<0&&(o=!0,i=l+1);return i<0?"":n.slice(t,i)}if(e===n)return"";let a=-1,c=e.length-1;for(;l--;)if(n.codePointAt(l)===47){if(o){t=l+1;break}}else a<0&&(o=!0,a=l+1),c>-1&&(n.codePointAt(l)===e.codePointAt(c--)?c<0&&(i=l):(c=-1,i=a));return t===i?i=a:i<0&&(i=n.length),n.slice(t,i)}function xI(n){if(Rc(n),n.length===0)return".";let e=-1,t=n.length,i;for(;--t;)if(n.codePointAt(t)===47){if(i){e=t;break}}else i||(i=!0);return e<0?n.codePointAt(0)===47?"/":".":e===1&&n.codePointAt(0)===47?"//":n.slice(0,e)}function yI(n){Rc(n);let e=n.length,t=-1,i=0,l=-1,o=0,a;for(;e--;){const c=n.codePointAt(e);if(c===47){if(a){i=e+1;break}continue}t<0&&(a=!0,t=e+1),c===46?l<0?l=e:o!==1&&(o=1):l>-1&&(o=-1)}return l<0||t<0||o===0||o===1&&l===t-1&&l===i+1?"":n.slice(l,t)}function bI(...n){let e=-1,t;for(;++e0&&n.codePointAt(n.length-1)===47&&(t+="/"),e?"/"+t:t}function wI(n,e){let t="",i=0,l=-1,o=0,a=-1,c,f;for(;++a<=n.length;){if(a2){if(f=t.lastIndexOf("/"),f!==t.length-1){f<0?(t="",i=0):(t=t.slice(0,f),i=t.length-1-t.lastIndexOf("/")),l=a,o=0;continue}}else if(t.length>0){t="",i=0,l=a,o=0;continue}}e&&(t=t.length>0?t+"/..":"..",i=2)}else t.length>0?t+="/"+n.slice(l+1,a):t=n.slice(l+1,a),i=a-l-1;l=a,o=0}else c===46&&o>-1?o++:o=-1}return t}function Rc(n){if(typeof n!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(n))}const kI={cwd:SI};function SI(){return"/"}function cy(n){return!!(n!==null&&typeof n=="object"&&"href"in n&&n.href&&"protocol"in n&&n.protocol&&n.auth===void 0)}function CI(n){if(typeof n=="string")n=new URL(n);else if(!cy(n)){const e=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+n+"`");throw e.code="ERR_INVALID_ARG_TYPE",e}if(n.protocol!=="file:"){const e=new TypeError("The URL must be of scheme file");throw e.code="ERR_INVALID_URL_SCHEME",e}return OI(n)}function OI(n){if(n.hostname!==""){const i=new TypeError('File URL host must be "localhost" or empty on darwin');throw i.code="ERR_INVALID_FILE_URL_HOST",i}const e=n.pathname;let t=-1;for(;++t0){let[v,...w]=p;const S=i[b][1];uy(S)&&uy(v)&&(v=_0(!0,S,v)),i[b]=[d,v,...w]}}}}const EI=new pb().freeze();function P0(n,e){if(typeof e!="function")throw new TypeError("Cannot `"+n+"` without `parser`")}function H0(n,e){if(typeof e!="function")throw new TypeError("Cannot `"+n+"` without `compiler`")}function I0(n,e){if(e)throw new Error("Cannot call `"+n+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function OC(n){if(!uy(n)||typeof n.type!="string")throw new TypeError("Expected node, got `"+n+"`")}function NC(n,e,t){if(!t)throw new Error("`"+n+"` finished async. Use `"+e+"` instead")}function Fh(n){return MI(n)?n:new eE(n)}function MI(n){return!!(n&&typeof n=="object"&&"message"in n&&"messages"in n)}function DI(n){return typeof n=="string"||RI(n)}function RI(n){return!!(n&&typeof n=="object"&&"byteLength"in n&&"byteOffset"in n)}const jI="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",TC=[],AC={allowDangerousHtml:!0},_I=/^(https?|ircs?|mailto|xmpp)$/i,LI=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"className",id:"remove-classname"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function zI(n){const e=BI(n),t=PI(n);return HI(e.runSync(e.parse(t),t),n)}function BI(n){const e=n.rehypePlugins||TC,t=n.remarkPlugins||TC,i=n.remarkRehypeOptions?{...n.remarkRehypeOptions,...AC}:AC;return EI().use(g7).use(t).use(fI,i).use(e)}function PI(n){const e=n.children||"",t=new eE;return typeof e=="string"&&(t.value=e),t}function HI(n,e){const t=e.allowedElements,i=e.allowElement,l=e.components,o=e.disallowedElements,a=e.skipHtml,c=e.unwrapDisallowed,f=e.urlTransform||II;for(const p of LI)Object.hasOwn(e,p.from)&&(""+p.from+(p.to?"use `"+p.to+"` instead":"remove it")+jI+p.id,void 0);return db(n,d),nP(n,{Fragment:y.Fragment,components:l,ignoreInvalidStyle:!0,jsx:y.jsx,jsxs:y.jsxs,passKeys:!0,passNode:!0});function d(p,g,b){if(p.type==="raw"&&b&&typeof g=="number")return a?b.children.splice(g,1):b.children[g]={type:"text",value:p.value},g;if(p.type==="element"){let v;for(v in M0)if(Object.hasOwn(M0,v)&&Object.hasOwn(p.properties,v)){const w=p.properties[v],S=M0[v];(S===null||S.includes(p.tagName))&&(p.properties[v]=f(String(w||""),v,p))}}if(p.type==="element"){let v=t?!t.includes(p.tagName):o?o.includes(p.tagName):!1;if(!v&&i&&typeof g=="number"&&(v=!i(p,g,b)),v&&b&&typeof g=="number")return c&&p.children?b.children.splice(g,1,...p.children):b.children.splice(g,1),g}}}function II(n){const e=n.indexOf(":"),t=n.indexOf("?"),i=n.indexOf("#"),l=n.indexOf("/");return e===-1||l!==-1&&e>l||t!==-1&&e>t||i!==-1&&e>i||_I.test(n.slice(0,e))?n:""}function UI(n){if(typeof n!="string")throw new TypeError("Expected a string");return n.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function tE(n,e,t){const l=dp((t||{}).ignore||[]),o=FI(e);let a=-1;for(;++a0?{type:"text",value:A}:void 0),A===!1)v.lastIndex=H+1;else{if(S!==H&&M({type:"text",value:d.value.slice(S,H)}),Array.isArray(A))for(const T of A)M(T);else A&&M(A);S=H+j[0].length,C=!0}if(!v.global)break;j=v.exec(d.value)}return C?(S?\]}]+$/.exec(n);if(!e)return[n,void 0];n=n.slice(0,e.index);let t=e[0],i=t.indexOf(")");const l=EC(n,"(");let o=EC(n,")");for(;i!==-1&&l>o;)n+=t.slice(0,i+1),t=t.slice(i+1),i=t.indexOf(")"),o++;return[n,t]}function nE(n,e){const t=n.input.charCodeAt(n.index-1);return(n.index===0||so(t)||cp(t))&&(!e||t!==47)}iE.peek=pU;function sU(){this.buffer()}function oU(n){this.enter({type:"footnoteReference",identifier:"",label:""},n)}function aU(){this.buffer()}function uU(n){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},n)}function cU(n){const e=this.resume(),t=this.stack[this.stack.length-1];t.type,t.identifier=nr(this.sliceSerialize(n)).toLowerCase(),t.label=e}function fU(n){this.exit(n)}function hU(n){const e=this.resume(),t=this.stack[this.stack.length-1];t.type,t.identifier=nr(this.sliceSerialize(n)).toLowerCase(),t.label=e}function dU(n){this.exit(n)}function pU(){return"["}function iE(n,e,t,i){const l=t.createTracker(i);let o=l.move("[^");const a=t.enter("footnoteReference"),c=t.enter("reference");return o+=l.move(t.safe(t.associationId(n),{after:"]",before:o})),c(),a(),o+=l.move("]"),o}function mU(){return{enter:{gfmFootnoteCallString:sU,gfmFootnoteCall:oU,gfmFootnoteDefinitionLabelString:aU,gfmFootnoteDefinition:uU},exit:{gfmFootnoteCallString:cU,gfmFootnoteCall:fU,gfmFootnoteDefinitionLabelString:hU,gfmFootnoteDefinition:dU}}}function gU(n){let e=!1;return n&&n.firstLineBlank&&(e=!0),{handlers:{footnoteDefinition:t,footnoteReference:iE},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function t(i,l,o,a){const c=o.createTracker(a);let f=c.move("[^");const d=o.enter("footnoteDefinition"),p=o.enter("label");return f+=c.move(o.safe(o.associationId(i),{before:f,after:"]"})),p(),f+=c.move("]:"),i.children&&i.children.length>0&&(c.shift(4),f+=c.move((e?` -`:" ")+o.indentLines(o.containerFlow(i,c.current()),e?rE:xU))),d(),f}}function xU(n,e,t){return e===0?n:rE(n,e,t)}function rE(n,e,t){return(t?"":" ")+n}const yU=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];mb.attention=SU;mb.peek=CU;function bU(){return{canContainEols:["delete"],enter:{strikethrough:wU},exit:{strikethrough:kU}}}function vU(){return{handlers:{delete:mb},unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:yU}]}}function wU(n){this.enter({type:"delete",children:[],position:void 0},n)}function kU(n){this.exit(n)}function mb(n,e,t,i){const l=t.createTracker(i),o=t.stack.includes("strikethrough")?"~":"~~",a=t.enter("strikethrough");let c=l.move(o);return c+=t.containerPhrasing(n,{...l.current(),before:c,after:"~"}),c+=l.move(o),a(),c}function SU(){return{construct:"strikethrough",markers:["~"],sizes:[2,1]}}function CU(){return"~"}function OU(n){return n.length}function NU(n,e){const t=e||{},i=(t.align||[]).concat(),l=t.stringLength||OU,o=[],a=[],c=[],f=[];let d=0,p=-1;for(;++pd&&(d=n[p].length);++Of[O])&&(f[O]=M)}S.push(j)}a[p]=S,c[p]=C}let g=-1;if(typeof i=="object"&&"length"in i)for(;++gf[g]&&(f[g]=j),v[g]=j),b[g]=M}a.splice(1,0,b),c.splice(1,0,v),p=-1;const w=[];for(;++p "),o.shift(2);const a=t.indentLines(t.containerFlow(n,o.current()),MU);return l(),a}function MU(n,e,t){return">"+(t?"":" ")+n}function DU(n,e){return DC(n,e.inConstruct,!0)&&!DC(n,e.notInConstruct,!1)}function DC(n,e,t){if(typeof e=="string"&&(e=[e]),!e||e.length===0)return t;let i=-1;for(;++ia&&(a=o):o=1,l=i+e.length,i=t.indexOf(e,l);return a}function jU(n,e){return!!(e.options.fences===!1&&n.value&&!n.lang&&/[^\n\r ]/.test(n.value)&&!/^[\t ]*(?:[\n\r]|$)|(?:^|[\n\r])[\t ]*$/.test(n.value))}function _U(n){const e=n.options.fence||"`";if(e!=="`"&&e!=="~")throw new Error("Cannot serialize code with `"+e+"` for `options.fence`, expected `` ` `` or `~`");return e}function LU(n,e,t,i){const l=_U(t),o=n.value||"";if(jU(n,t)){const g=t.enter("codeIndented"),b=t.indentLines(o,zU);return g(),b}const a=t.createTracker(i),c=l.repeat(Math.max(RU(o,l)+1,3)),f=t.enter("codeFenced"),d=l==="`"?"GraveAccent":"Tilde";let p=a.move(c);if(n.lang){const g=t.enter(`codeFencedLang${d}`);p+=a.move(t.safe(n.lang,{before:p,after:" ",encode:["`"],...a.current()})),g()}if(n.lang&&n.meta){const g=t.enter(`codeFencedMeta${d}`);p+=a.move(" "),p+=a.move(t.safe(n.meta,{before:p,after:` -`,encode:["`"],...a.current()})),g()}return p+=a.move(` -`),o&&(p+=a.move(o+` -`)),p+=a.move(c),f(),p}function zU(n,e,t){return(t?"":" ")+n}function gb(n){const e=n.options.quote||'"';if(e!=='"'&&e!=="'")throw new Error("Cannot serialize title with `"+e+"` for `options.quote`, expected `\"`, or `'`");return e}function BU(n,e,t,i){const l=gb(t),o=l==='"'?"Quote":"Apostrophe",a=t.enter("definition");let c=t.enter("label");const f=t.createTracker(i);let d=f.move("[");return d+=f.move(t.safe(t.associationId(n),{before:d,after:"]",...f.current()})),d+=f.move("]: "),c(),!n.url||/[\0- \u007F]/.test(n.url)?(c=t.enter("destinationLiteral"),d+=f.move("<"),d+=f.move(t.safe(n.url,{before:d,after:">",...f.current()})),d+=f.move(">")):(c=t.enter("destinationRaw"),d+=f.move(t.safe(n.url,{before:d,after:n.title?" ":` -`,...f.current()}))),c(),n.title&&(c=t.enter(`title${o}`),d+=f.move(" "+l),d+=f.move(t.safe(n.title,{before:d,after:l,...f.current()})),d+=f.move(l),c()),a(),d}function PU(n){const e=n.options.emphasis||"*";if(e!=="*"&&e!=="_")throw new Error("Cannot serialize emphasis with `"+e+"` for `options.emphasis`, expected `*`, or `_`");return e}function qd(n){const e=n.codePointAt(0);return e===void 0?"":String.fromCodePoint(e)}function Sa(n){const e=n.codePointAt(n.length-2);return e!==void 0&&e>65535?n.slice(-2):n.slice(-1)}function lE(n){return"&#x"+n.toString(16).toUpperCase()+";"}function jC(n,e,t){const i=os(n),l=os(e);return i===void 0?l===void 0?t==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:l===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:i===1?l===void 0?{inside:!1,outside:!1}:l===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:l===void 0?{inside:!1,outside:!1}:l===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}function HU(n){if(n.charCodeAt(0)!==60)return;const e=n.charCodeAt(1);if(e===33){const c=n.charCodeAt(2);return c===45?2:c===91?5:En(c)?4:void 0}if(e===63)return 3;const t=e===47,i=t?2:1;let l=i,o=n.charCodeAt(l);if(!En(o))return;for(;o===45||Mn(o);)o=n.charCodeAt(++l);const a=n.slice(i,l).toLowerCase();return!t&&o!==47&&ry.includes(a)?1:FA.includes(a)?6:7}const IU=new Map([["*",!1],["_",!0]]);function UU(n,e,t){const i=new Set;for(const o of n){const a=t.get(o);if(a&&o.attention&&e.some(c=>c.attention===o.attention))for(const c of a.tokens)i.add(c.attention)}const l=[];for(const o of n)o.attention&&i.delete(o.attention)&&l.push(o.attention);return l.reverse(),l}function sE(n,e,t){const i=[],l=new Map,o=new Map;let a=0;for(;at.index)return{chosen:f,mistake:p,tokens:d}}}}function qU(n,e){const t=new Map;for(const i of n){const l=i.tokens[0].value.charAt(0);let o=t.get(l);o||(o=[],t.set(l,o));let a=i.close?o.length:0;for(;a--&&i.start1&&d>1?2:1:d,g=c.markers.slice(c.end-p,c.end),b=i.markers.slice(i.start,i.start+p),v=g[0],w=b[0];if(v===g[p-1]&&v.value.length===p&&w===b[p-1]&&w.value.length===p&&v.attention===w.attention)e.delete(v),e.delete(w);else{const S=[...new Set([...g,...b])];for(const C of S){const O=e.get(C);O&&O.push(...S)}}c.end-=p,i.start+=p,c.start===c.end&&o.splice(a,1),a=o.length}i.open&&i.start0?w[0].value:"",C=jC(b.charCodeAt(b.length-1),S.charCodeAt(0),p);C.inside&&qh(w,!0);const O=w.length>0?Sa(w[w.length-1].value):"",j=jC(v.charCodeAt(0),O.charCodeAt(O.length-1),p);j.inside&&qh(w,!1),C.outside&&b!==` -`&&b!=="\r"&&qh(l,!1),j.outside&&(o=v),l.push({value:d,attention:f},...w,{value:d,attention:f}),a=d.charAt(d.length-1)}return l}function mp(n,e,t){let i=new Map;const l=yb(n,i,e,t);let o=l,a=sE(o,e,t);for(;a;){const f=FU(n,i,a,e,t);if(!f){o=l;break}i=f.chosen,o=f.tokens,a=f.mistake}let c="";for(const f of o)c+=f.value;return c}bb.attention=oE;bb.peek=XU;function bb(n,e,t,i){const l=t.enter("phrasing"),o=xb(n,oE,t,t.createTracker(i)),a=mp([o],i.before,i.after);return l(),a}function oE(n,e){return{construct:"emphasis",markers:PU(e)==="*"?["*","_"]:["_","*"],sizes:[1]}}function XU(n,e,t){return t.options.emphasis||"*"}function $U(n,e){let t=!1;return db(n,function(i){if("value"in i&&/\r?\n|\r/.test(i.value)||i.type==="break")return t=!0,od}),!!((!n.depth||n.depth<3)&&sb(n)&&(e.options.setext||t))}function GU(n,e,t,i){const l=Math.max(Math.min(6,n.depth||1),1),o=t.createTracker(i);if($U(n,t)){const g=t.enter("headingSetext"),b=t.enter("phrasing"),v=t.containerPhrasing(n,{...o.current(),before:` -`,after:` -`});return b(),g(),v+` -`+(l===1?"=":"-").repeat(v.length-(Math.max(v.lastIndexOf("\r"),v.lastIndexOf(` -`))+1))}const a="#".repeat(l),c=t.enter("headingAtx"),f=t.enter("phrasing");o.move(a+" ");let d=t.containerPhrasing(n,{before:"# ",after:` -`,...o.current()});const p=d.charCodeAt(0);return(p===9||p===32)&&(d=lE(p)+d.slice(1)),d=d?a+" "+d:a,t.options.closeAtx&&(d+=" "+a),f(),c(),d}aE.peek=YU;function aE(n){return n.value||""}function YU(){return"<"}uE.peek=KU;function uE(n,e,t,i){const l=gb(t),o=l==='"'?"Quote":"Apostrophe",a=t.enter("image");let c=t.enter("label");const f=t.createTracker(i);let d=f.move("![");return d+=f.move(t.safe(n.alt,{before:d,after:"]",...f.current()})),d+=f.move("]("),c(),!n.url&&n.title||/[\0- \u007F]/.test(n.url)?(c=t.enter("destinationLiteral"),d+=f.move("<"),d+=f.move(t.safe(n.url,{before:d,after:">",...f.current()})),d+=f.move(">")):(c=t.enter("destinationRaw"),d+=f.move(t.safe(n.url,{before:d,after:n.title?" ":")",...f.current()}))),c(),n.title&&(c=t.enter(`title${o}`),d+=f.move(" "+l),d+=f.move(t.safe(n.title,{before:d,after:l,...f.current()})),d+=f.move(l),c()),d+=f.move(")"),a(),d}function KU(){return"!"}cE.peek=WU;function cE(n,e,t,i){const l=n.referenceType,o=t.enter("imageReference");let a=t.enter("label");const c=t.createTracker(i);let f=c.move("![");const d=t.safe(n.alt,{before:f,after:"]",...c.current()});f+=c.move(d+"]["),a();const p=t.stack;t.stack=p.filter(function(b){return b!=="phrasing"}),a=t.enter("reference");const g=t.safe(t.associationId(n),{before:f,after:"]",...c.current()});return a(),t.stack=p,o(),l==="full"||!d||d!==g?f+=c.move(g+"]"):l==="shortcut"?f=f.slice(0,-1):f+=c.move("]"),f}function WU(){return"!"}fE.peek=ZU;function fE(n,e,t){let i=n.value||"",l="`",o=-1;for(;new RegExp("(^|[^`])"+l+"([^`]|$)").test(i);)l+="`";for(/[^\n\r ]/.test(i)&&(/^[\n\r ]/.test(i)&&/[\n\r ]$/.test(i)||/^`|`$/.test(i))&&(i=" "+i+" ");++o\u007F]/.test(n.url))}dE.peek=JU;function dE(n,e,t,i){const l=gb(t),o=l==='"'?"Quote":"Apostrophe",a=t.createTracker(i);if(hE(n,t)){const w=t.stack;t.stack=w.filter(function(O){return O!=="phrasing"});const S=t.enter("autolink");let C=a.move("<");return C+=a.move(t.containerPhrasing(n,{before:C,after:">",...a.current()})),C+=a.move(">"),S(),t.stack=w,C}const c=t.enter("link");let f=t.enter("label"),d=a.move("[");const p=t.containerPhrasing(n,{before:d,after:"](",...a.current()});d+=a.move(p),f(),d+=a.move("](");const g=/[\0- \u007F]/.test(n.url),b=i.before.charAt(i.before.length-1);let v=n.title||void 0;if(!v&&!g&&(b===` -`||b==="\r")){let w=0;for(;w",...a.current()})),d+=a.move(">")):(f=t.enter("destinationRaw"),d+=a.move(t.safe(n.url,{before:d,after:typeof v=="string"?" ":")",...a.current()}))),f(),typeof v=="string"&&(f=t.enter(`title${o}`),d+=a.move(" "+l),d+=a.move(t.safe(v,{before:d,after:l,...a.current()})),d+=a.move(l),f()),d+=a.move(")"),c(),d}function JU(n,e,t){return hE(n,t)?"<":"["}pE.peek=eF;function pE(n,e,t,i){const l=n.referenceType,o=t.enter("linkReference");let a=t.enter("label");const c=t.createTracker(i);let f=c.move("[");const d=t.containerPhrasing(n,{before:f,after:"]",...c.current()});f+=c.move(d+"]["),a();const p=t.stack;t.stack=p.filter(function(b){return b!=="phrasing"}),a=t.enter("reference");const g=t.safe(t.associationId(n),{before:f,after:"]",...c.current()});return a(),t.stack=p,o(),l==="full"||!d||d!==g?f+=c.move(g+"]"):l==="shortcut"?f=f.slice(0,-1):f+=c.move("]"),f}function eF(){return"["}function vb(n){const e=n.options.bullet||"*";if(e!=="*"&&e!=="+"&&e!=="-")throw new Error("Cannot serialize items with `"+e+"` for `options.bullet`, expected `*`, `+`, or `-`");return e}function tF(n){const e=vb(n),t=n.options.bulletOther;if(!t)return e==="*"?"-":"*";if(t!=="*"&&t!=="+"&&t!=="-")throw new Error("Cannot serialize items with `"+t+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(t===e)throw new Error("Expected `bullet` (`"+e+"`) and `bulletOther` (`"+t+"`) to be different");return t}function nF(n){const e=n.options.bulletOrdered||".";if(e!=="."&&e!==")")throw new Error("Cannot serialize items with `"+e+"` for `options.bulletOrdered`, expected `.` or `)`");return e}function mE(n){const e=n.options.rule||"*";if(e!=="*"&&e!=="-"&&e!=="_")throw new Error("Cannot serialize rules with `"+e+"` for `options.rule`, expected `*`, `-`, or `_`");return e}function iF(n,e,t,i){const l=t.enter("list"),o=t.bulletCurrent;let a=n.ordered?nF(t):vb(t);const c=n.ordered?a==="."?")":".":tF(t);let f=e&&t.bulletLastUsed?a===t.bulletLastUsed:!1;if(!n.ordered){const p=n.children?n.children[0]:void 0;if((a==="*"||a==="-")&&p&&(!p.children||!p.children[0])&&t.stack[t.stack.length-1]==="list"&&t.stack[t.stack.length-2]==="listItem"&&t.stack[t.stack.length-3]==="list"&&t.stack[t.stack.length-4]==="listItem"&&t.indexStack[t.indexStack.length-1]===0&&t.indexStack[t.indexStack.length-2]===0&&t.indexStack[t.indexStack.length-3]===0&&(f=!0),mE(t)===a&&p){let g=-1;for(;++g-1?e.start:1)+(t.options.incrementListMarker===!1?0:e.children.indexOf(n))+o);let a=o.length+1;(l==="tab"||l==="mixed"&&(e&&e.type==="list"&&e.spread||n.spread))&&(a=Math.ceil(a/4)*4);const c=t.createTracker(i);c.move(o+" ".repeat(a-o.length)),c.shift(a);const f=t.enter("listItem"),d=t.indentLines(t.containerFlow(n,c.current()),p);return f(),d;function p(g,b,v){return b?(v?"":" ".repeat(a))+g:(v?o:o+" ".repeat(a-o.length))+g}}function sF(n,e,t,i){const l=t.enter("paragraph"),o=t.enter("phrasing"),a=t.containerPhrasing(n,i);return o(),l(),a}function oF(n,e,t,i){if(!n.children.some(function(c){return AU(c)}))return t.containerFlow(n,i);const o=t.enter("phrasing"),a=t.containerPhrasing(n,i);return o(),a}function aF(n){const e=n.options.strong||"*";if(e!=="*"&&e!=="_")throw new Error("Cannot serialize strong with `"+e+"` for `options.strong`, expected `*`, or `_`");return e}wb.attention=gE;wb.peek=uF;function wb(n,e,t,i){const l=t.enter("phrasing"),o=xb(n,gE,t,t.createTracker(i)),a=mp([o],i.before,i.after);return l(),a}function gE(n,e){return{construct:"strong",markers:aF(e)==="*"?["*","_"]:["_","*"],sizes:[2]}}function uF(n,e,t){return t.options.strong||"*"}function cF(n,e,t,i){const l=e?e.children:[],o=t.indexStack[t.indexStack.length-1];return t.safe(n.value,{...i,afterNode:l[o+1],beforeNode:l[o-1]})}function fF(n){const e=n.options.ruleRepetition||3;if(e<3)throw new Error("Cannot serialize rules with repetition `"+e+"` for `options.ruleRepetition`, expected `3` or more");return e}function hF(n,e,t){const i=(mE(t)+(t.options.ruleSpaces?" ":"")).repeat(fF(t));return t.options.ruleSpaces?i.slice(0,-1):i}const xE={blockquote:EU,break:RC,code:LU,definition:BU,emphasis:bb,hardBreak:RC,heading:GU,html:aE,image:uE,imageReference:cE,inlineCode:fE,link:dE,linkReference:pE,list:iF,listItem:lF,paragraph:sF,root:oF,strong:wb,text:cF,thematicBreak:hF};function dF(){return{enter:{table:pF,tableData:_C,tableHeader:_C,tableRow:gF},exit:{codeText:xF,table:mF,tableData:V0,tableHeader:V0,tableRow:V0}}}function pF(n){const e=n._align;this.enter({type:"table",align:e.map(function(t){return t==="none"?null:t}),children:[]},n),this.data.inTable=!0}function mF(n){this.exit(n),this.data.inTable=void 0}function gF(n){this.enter({type:"tableRow",children:[]},n)}function V0(n){this.exit(n)}function _C(n){this.enter({type:"tableCell",children:[]},n)}function xF(n){let e=this.resume();this.data.inTable&&(e=e.replace(/\\([\\|])/g,yF));const t=this.stack[this.stack.length-1];t.type,t.value=e,this.exit(n)}function yF(n,e){return e==="|"?e:n}function bF(n){const e=n||{},t=e.tableCellPadding,i=e.tablePipeAlign,l=e.stringLength,o=t?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:` -`,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:b,table:a,tableCell:f,tableRow:c}};function a(v,w,S,C){return d(p(v,S,C),v.align)}function c(v,w,S,C){const O=g(v,S,C),j=d([O]);return j.slice(0,j.indexOf(` -`))}function f(v,w,S,C){const O=S.enter("tableCell"),j=S.enter("phrasing"),M=S.containerPhrasing(v,{...C,before:o,after:o});return j(),O(),M}function d(v,w){return NU(v,{align:w,alignDelimiters:i,padding:t,stringLength:l})}function p(v,w,S){const C=v.children;let O=-1;const j=[],M=w.enter("table");for(;++O0&&!t&&(n[n.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),t}const BF={tokenize:QF,partial:!0};function PF(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:FF,continuation:{tokenize:qF},exit:VF}},text:{91:{name:"gfmFootnoteCall",tokenize:UF},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:HF,resolveTo:IF}}}}function HF(n,e,t){const i=this;let l=i.events.length;const o=i.parser.gfmFootnotes||(i.parser.gfmFootnotes=[]);let a;for(;l--;){const f=i.events[l][1];if(f.type==="labelImage"){a=f;break}if(f.type==="gfmFootnoteCall"||f.type==="labelLink"||f.type==="label"||f.type==="image"||f.type==="link")break}return c;function c(f){if(!a||!a._balanced)return t(f);const d=nr(i.sliceSerialize({start:a.end,end:i.now()}));return d.codePointAt(0)!==94||!o.includes(d.slice(1))?t(f):(n.enter("gfmFootnoteCallLabelMarker"),n.consume(f),n.exit("gfmFootnoteCallLabelMarker"),e(f))}}function IF(n,e){let t=n.length;for(;t--;)if(n[t][1].type==="labelImage"&&n[t][0]==="enter"){n[t][1];break}n[t+1][1].type="data",n[t+3][1].type="gfmFootnoteCallLabelMarker";const i={type:"gfmFootnoteCall",start:Object.assign({},n[t+3][1].start),end:Object.assign({},n[n.length-1][1].end)},l={type:"gfmFootnoteCallMarker",start:Object.assign({},n[t+3][1].end),end:Object.assign({},n[t+3][1].end)};l.end.column++,l.end.offset++,l.end._bufferIndex++;const o={type:"gfmFootnoteCallString",start:Object.assign({},l.end),end:Object.assign({},n[n.length-1][1].start)},a={type:"chunkString",contentType:"string",start:Object.assign({},o.start),end:Object.assign({},o.end)},c=[n[t+1],n[t+2],["enter",i,e],n[t+3],n[t+4],["enter",l,e],["exit",l,e],["enter",o,e],["enter",a,e],["exit",a,e],["exit",o,e],n[n.length-2],n[n.length-1],["exit",i,e]];return n.splice(t,n.length-t+1,...c),n}function UF(n,e,t){const i=this,l=i.parser.gfmFootnotes||(i.parser.gfmFootnotes=[]);let o=0,a;return c;function c(g){return n.enter("gfmFootnoteCall"),n.enter("gfmFootnoteCallLabelMarker"),n.consume(g),n.exit("gfmFootnoteCallLabelMarker"),f}function f(g){return g!==94?t(g):(n.enter("gfmFootnoteCallMarker"),n.consume(g),n.exit("gfmFootnoteCallMarker"),n.enter("gfmFootnoteCallString"),n.enter("chunkString").contentType="string",d)}function d(g){if(o>999||g===93&&!a||g===null||g===91||Rt(g))return t(g);if(g===93){n.exit("chunkString");const b=n.exit("gfmFootnoteCallString");return l.includes(nr(i.sliceSerialize(b)))?(n.enter("gfmFootnoteCallLabelMarker"),n.consume(g),n.exit("gfmFootnoteCallLabelMarker"),n.exit("gfmFootnoteCall"),e):t(g)}return Rt(g)||(a=!0),o++,n.consume(g),g===92?p:d}function p(g){return g===91||g===92||g===93?(n.consume(g),o++,d):d(g)}}function FF(n,e,t){const i=this,l=i.parser.gfmFootnotes||(i.parser.gfmFootnotes=[]);let o,a=0,c;return f;function f(w){return n.enter("gfmFootnoteDefinition")._container=!0,n.enter("gfmFootnoteDefinitionLabel"),n.enter("gfmFootnoteDefinitionLabelMarker"),n.consume(w),n.exit("gfmFootnoteDefinitionLabelMarker"),d}function d(w){return w===94?(n.enter("gfmFootnoteDefinitionMarker"),n.consume(w),n.exit("gfmFootnoteDefinitionMarker"),n.enter("gfmFootnoteDefinitionLabelString"),n.enter("chunkString").contentType="string",p):t(w)}function p(w){if(a>999||w===93&&!c||w===null||w===91||Rt(w))return t(w);if(w===93){n.exit("chunkString");const S=n.exit("gfmFootnoteDefinitionLabelString");return o=nr(i.sliceSerialize(S)),n.enter("gfmFootnoteDefinitionLabelMarker"),n.consume(w),n.exit("gfmFootnoteDefinitionLabelMarker"),n.exit("gfmFootnoteDefinitionLabel"),b}return Rt(w)||(c=!0),a++,n.consume(w),w===92?g:p}function g(w){return w===91||w===92||w===93?(n.consume(w),a++,p):p(w)}function b(w){return w===58?(n.enter("definitionMarker"),n.consume(w),n.exit("definitionMarker"),l.includes(o)||l.push(o),gt(n,v,"gfmFootnoteDefinitionWhitespace")):t(w)}function v(w){return e(w)}}function qF(n,e,t){return n.check(Dc,e,n.attempt(BF,e,t))}function VF(n){n.exit("gfmFootnoteDefinition")}function QF(n,e,t){const i=this;return gt(n,l,"gfmFootnoteDefinitionIndent",5);function l(o){const a=i.events[i.events.length-1];return a&&a[1].type==="gfmFootnoteDefinitionIndent"&&a[2].sliceSerialize(a[1],!0).length===4?e(o):t(o)}}function XF(n){let t=(n||{}).singleTilde;const i={name:"strikethrough",tokenize:o,resolveAll:l};return t==null&&(t=!0),{text:{126:i},insideSpan:{null:[i]},attentionMarkers:{null:[126]}};function l(a,c){let f=-1;for(;++f1?f(w):(a.consume(w),g++,v);if(g<2&&!t)return f(w);const C=a.exit("strikethroughSequenceTemporary"),O=os(w);return C._open=!O||O===2&&!!S,C._close=!S||S===2&&!!O,c(w)}}}class $F{constructor(){this.map=[],this.index=new Map}add(e,t,i){GF(this,e,t,i)}consume(e){if(this.map.sort(function(o,a){return o[0]-a[0]}),this.map.length===0)return;let t=this.map.length;const i=[];for(;t>0;)t-=1,i.push(e.slice(this.map[t][0]+this.map[t][1]),this.map[t][2]),e.length=this.map[t][0];i.push(e.slice()),e.length=0;let l=i.pop();for(;l;){for(const o of l)e.push(o);l=i.pop()}this.map.length=0,this.index.clear()}}function GF(n,e,t,i){if(t===0&&i.length===0)return;const l=n.index.get(e);if(l){l[1]+=t,l[2].push(...i);return}const o=[e,t,i];n.map.push(o),n.index.set(e,o)}function YF(n,e){let t=!1;const i=[];for(;e-1;){const{type:de}=i.events[W][1];if(de==="lineEnding"||de==="linePrefix")W--;else break}const U=W>-1?i.events[W][1].type:null,re=U==="tableHead"||U==="tableRow"?A:f;return re===A&&i.parser.lazy[i.now().line]?t(F):re(F)}function f(F){return n.enter("tableHead"),n.enter("tableRow"),d(F)}function d(F){return F===124||(a=!0,o+=1),p(F)}function p(F){return F===null?t(F):Be(F)?o>1?(o=0,i.interrupt=!0,n.exit("tableRow"),n.enter("lineEnding"),n.consume(F),n.exit("lineEnding"),v):t(F):Je(F)?gt(n,p,"whitespace")(F):(o+=1,a&&(a=!1,l+=1),F===124?(n.enter("tableCellDivider"),n.consume(F),n.exit("tableCellDivider"),a=!0,p):(n.enter("data"),g(F)))}function g(F){return F===null||F===124||Rt(F)?(n.exit("data"),p(F)):(n.consume(F),F===92?b:g)}function b(F){return F===92||F===124?(n.consume(F),g):g(F)}function v(F){return i.interrupt=!1,i.parser.lazy[i.now().line]?t(F):(n.enter("tableDelimiterRow"),a=!1,Je(F)?gt(n,w,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(F):w(F))}function w(F){return F===45||F===58?C(F):F===124?(a=!0,n.enter("tableCellDivider"),n.consume(F),n.exit("tableCellDivider"),S):P(F)}function S(F){return Je(F)?gt(n,C,"whitespace")(F):C(F)}function C(F){return F===58?(o+=1,a=!0,n.enter("tableDelimiterMarker"),n.consume(F),n.exit("tableDelimiterMarker"),O):F===45?(o+=1,O(F)):F===null||Be(F)?H(F):P(F)}function O(F){return F===45?(n.enter("tableDelimiterFiller"),j(F)):P(F)}function j(F){return F===45?(n.consume(F),j):F===58?(a=!0,n.exit("tableDelimiterFiller"),n.enter("tableDelimiterMarker"),n.consume(F),n.exit("tableDelimiterMarker"),M):(n.exit("tableDelimiterFiller"),M(F))}function M(F){return Je(F)?gt(n,H,"whitespace")(F):H(F)}function H(F){return F===124?w(F):F===null||Be(F)?!a||l!==o?P(F):(n.exit("tableDelimiterRow"),n.exit("tableHead"),e(F)):P(F)}function P(F){return t(F)}function A(F){return n.enter("tableRow"),T(F)}function T(F){return F===124?(n.enter("tableCellDivider"),n.consume(F),n.exit("tableCellDivider"),T):F===null||Be(F)?(n.exit("tableRow"),e(F)):Je(F)?gt(n,T,"whitespace")(F):(n.enter("data"),z(F))}function z(F){return F===null||F===124||Rt(F)?(n.exit("data"),T(F)):(n.consume(F),F===92?ne:z)}function ne(F){return F===92||F===124?(n.consume(F),z):z(F)}}function ZF(n,e){let t=-1,i=!0,l=0,o=[0,0,0,0],a=[0,0,0,0],c=!1,f=0,d,p,g;const b=new $F;for(;++tt[2]+1){const w=t[2]+1,S=t[3]-t[2]-1;n.add(w,S,[])}}n.add(t[3]+1,0,[["exit",g,e]])}return l!==void 0&&(o.end=Object.assign({},oa(e.events,l)),n.add(l,0,[["exit",o,e]]),o=void 0),o}function zC(n,e,t,i,l){const o=[],a=oa(e.events,t);l&&(l.end=Object.assign({},a),o.push(["exit",l,e])),i.end=Object.assign({},a),o.push(["exit",i,e]),n.add(t+1,0,o)}function oa(n,e){const t=n[e],i=t[0]==="enter"?"start":"end";return t[1][i]}const JF={name:"tasklistCheck",tokenize:tq};function eq(){return{text:{91:JF}}}function tq(n,e,t){const i=this;return l;function l(f){return i.previous!==null||!i._gfmTasklistFirstContentOfListItem?t(f):(n.enter("taskListCheck"),n.enter("taskListCheckMarker"),n.consume(f),n.exit("taskListCheckMarker"),o)}function o(f){return Rt(f)?(n.enter("taskListCheckValueUnchecked"),n.consume(f),n.exit("taskListCheckValueUnchecked"),a):f===88||f===120?(n.enter("taskListCheckValueChecked"),n.consume(f),n.exit("taskListCheckValueChecked"),a):t(f)}function a(f){return f===93?(n.enter("taskListCheckMarker"),n.consume(f),n.exit("taskListCheckMarker"),n.exit("taskListCheck"),c):t(f)}function c(f){return Be(f)?e(f):Je(f)?n.check({tokenize:nq},e,t)(f):t(f)}}function nq(n,e,t){return gt(n,i,"whitespace");function i(l){return l===null?t(l):e(l)}}function iq(n){return DA([AF(),PF(),XF(n),KF(),eq()])}const rq={};function lq(n){const e=this,t=n||rq,i=e.data(),l=i.micromarkExtensions||(i.micromarkExtensions=[]),o=i.fromMarkdownExtensions||(i.fromMarkdownExtensions=[]),a=i.toMarkdownExtensions||(i.toMarkdownExtensions=[]);l.push(iq(t)),o.push(CF()),a.push(OF(t))}function sq(n){return n.replace(/\\n/g,` -`).replace(/\\t/g," ").replace(/\\"/g,'"').replace(/\\'/g,"'").replace(/\\\\/g,"\\")}const oq={h1:({children:n})=>y.jsx("h3",{className:"mt-3 mb-1.5 text-base font-bold text-ink first:mt-0",children:n}),h2:({children:n})=>y.jsx("h4",{className:"mt-3 mb-1 text-sm font-semibold text-ink first:mt-0",children:n}),h3:({children:n})=>y.jsx("h5",{className:"mt-2 mb-1 text-xs font-semibold text-ink first:mt-0",children:n}),p:({children:n})=>y.jsx("p",{className:"my-1.5 leading-relaxed first:mt-0 last:mb-0",children:n}),strong:({children:n})=>y.jsx("strong",{className:"font-semibold text-ink",children:n}),em:({children:n})=>y.jsx("em",{className:"italic text-ink-secondary",children:n}),del:({children:n})=>y.jsx("del",{className:"text-ink-muted line-through",children:n}),a:({children:n,href:e})=>y.jsx("a",{href:e,target:"_blank",rel:"noopener noreferrer",className:"text-chip-indigo-text underline underline-offset-2 hover:text-ink",children:n}),code:({children:n,className:e})=>y.jsx("code",{className:`break-words rounded bg-elevated px-1 py-0.5 font-mono text-chip-indigo-text whitespace-pre-wrap ${e??""}`,children:n}),pre:({children:n})=>y.jsx("pre",{className:"my-2 overflow-x-auto rounded-lg border border-line bg-elevated p-3 font-mono text-xs text-ink [&_code]:bg-transparent [&_code]:px-0 [&_code]:py-0 [&_code]:text-inherit",children:n}),ul:({children:n})=>y.jsx("ul",{className:"my-1.5 list-disc space-y-0.5 pl-5",children:n}),ol:({children:n})=>y.jsx("ol",{className:"my-1.5 list-decimal space-y-0.5 pl-5",children:n}),li:({children:n})=>y.jsx("li",{className:"leading-relaxed",children:n}),blockquote:({children:n})=>y.jsx("blockquote",{className:"my-2 border-l-2 border-line-strong pl-3 text-ink-secondary italic",children:n}),table:({children:n})=>y.jsx("div",{className:"my-2 overflow-x-auto",children:y.jsx("table",{className:"w-full border-collapse text-xs",children:n})}),th:({children:n})=>y.jsx("th",{className:"border border-line bg-elevated px-2 py-1 text-left font-semibold",children:n}),td:({children:n})=>y.jsx("td",{className:"border border-line px-2 py-1 align-top",children:n}),hr:()=>y.jsx("hr",{className:"my-3 border-line"}),img:({alt:n,src:e,title:t})=>y.jsx("img",{src:e,alt:n,title:t,loading:"lazy",referrerPolicy:"no-referrer",className:"my-2 max-w-full rounded-lg border border-line"})};function Qh({text:n}){return n?y.jsx(zI,{remarkPlugins:[lq,$I],components:oq,children:sq(n)}):null}function NE(n){return n==="completed"||n==="aborted"||n==="failed"}function qu({label:n}){return y.jsx("kbd",{"aria-hidden":"true",className:"ml-1.5 inline-block rounded border border-line/60 bg-elevated/60 px-1 py-px font-mono text-[10px] font-normal leading-none opacity-90",children:n})}function BC(n){!n||NE(n.status)||BM(n.session_id).catch(()=>{})}const aq={running:"running",completed:"done",skipped:"skipped",failed:"failed",pending:"pending"};function Xh({text:n}){const[e,t]=R.useState(!1),i=R.useRef(void 0);R.useEffect(()=>()=>window.clearTimeout(i.current),[]);const l=async()=>{try{await navigator.clipboard.writeText(n),t(!0),window.clearTimeout(i.current),i.current=window.setTimeout(()=>t(!1),1500)}catch{}};return y.jsx("button",{type:"button",onClick:l,"aria-label":e?"Copied":"Copy content",title:e?"Copied!":"Copy content",className:"absolute right-2 top-2 rounded-md p-1.5 text-ink-muted hover:bg-elevated hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-indigo-500",children:e?y.jsx(il,{className:"h-3.5 w-3.5"}):y.jsx(si,{className:"h-3.5 w-3.5"})})}function uq({isOpen:n,onClose:e,directory:t,filename:i,release:l,args:o,onFinished:a}){var je,B;const[c,f]=R.useState(null),[d,p]=R.useState(!1),[g,b]=R.useState(null),[v,w]=R.useState(null),[S,C]=R.useState(!1),[O,j]=R.useState(0),M=R.useRef(null),H=R.useRef(!1),P=R.useRef(null),A=R.useRef(!1);R.useEffect(()=>{if(!n||!t||!i){f(null),b(null),C(!1),w(null),A.current=!1;return}let D=!0;return p(!0),b(null),C(!1),w(null),LM({directory:t,filename:i,release:l,args:o}).then(X=>{D&&(f(X),p(!1),(X.status==="completed"||X.status==="aborted"||X.status==="failed")&&(a==null||a(X.status,X.final_message||"")))}).catch(X=>{D&&((X==null?void 0:X.status)===404&&C(!0),b(X.message||"Failed to start workflow"),p(!1))}),()=>{D=!1}},[n,t,i,l,o,O]);const T=async D=>{if(!(!c||H.current)){H.current=!0,p(!0);try{const X=await zM(c.session_id,D);f(X),(X.status==="completed"||X.status==="aborted"||X.status==="failed")&&(a==null||a(X.status,X.final_message||""))}catch(X){(X==null?void 0:X.status)===404?(C(!0),b(X.message||"Workflow session on the server has expired.")):b(X.message||"Failed to process workflow response")}finally{H.current=!1,p(!1)}}},z=R.useRef(c);z.current=c;const ne=R.useRef(T);ne.current=T;const F=R.useRef(v);F.current=v;const W=R.useRef([]),U=(D,X)=>{var Re,Ne;if(D.key!=="ArrowDown"&&D.key!=="ArrowUp"&&D.key!=="Home"&&D.key!=="End")return;D.preventDefault();const fe=((Re=z.current)==null?void 0:Re.steps.length)??0;if(fe===0)return;const pe=D.key==="ArrowDown"?(X+1)%fe:D.key==="ArrowUp"?(X-1+fe)%fe:D.key==="Home"?0:fe-1;w(pe),(Ne=W.current[pe])==null||Ne.focus()};R.useEffect(()=>()=>BC(z.current),[]);const re=()=>{A.current||(A.current=!0,BC(z.current),e())},de=()=>{f(null),b(null),C(!1),w(null),A.current=!1,j(D=>D+1)},ie=cs({isOpen:n,onClose:re,dialogRef:M,initialFocusRef:P});if(R.useEffect(()=>{if(!n)return;const D=X=>{var ce,xe,Ue;if(X.key==="Escape"){X.preventDefault(),re();return}const fe=z.current;if(!fe)return;if(NE(fe.status)){X.key==="Enter"&&!X.repeat&&!X.ctrlKey&&!X.metaKey&&!X.altKey&&!H.current&&((ce=X.target)==null?void 0:ce.tagName)!=="BUTTON"&&((xe=document.activeElement)==null?void 0:xe.tagName)!=="BUTTON"&&(X.preventDefault(),re());return}if(H.current||X.repeat||X.ctrlKey||X.metaKey||X.altKey)return;const pe=X.target;if((pe==null?void 0:pe.tagName)==="INPUT"||(pe==null?void 0:pe.tagName)==="TEXTAREA"||pe!=null&&pe.isContentEditable)return;const Re=F.current,Ne=Re===null||Re===fe.current_index,_e=fe.status==="waiting_ask"?"yes":fe.status==="waiting_notify"||fe.status==="waiting_notice"?"ack":null;if(!Ne||_e===null)return;if(X.key==="Enter"){const ot=X.target;if((ot==null?void 0:ot.tagName)==="BUTTON"||((Ue=document.activeElement)==null?void 0:Ue.tagName)==="BUTTON")return;X.preventDefault(),ne.current(_e);return}if(fe.status!=="waiting_ask")return;const ve=X.key.toLowerCase();ve==="y"?(X.preventDefault(),ne.current("yes")):ve==="s"?(X.preventDefault(),ne.current("skip")):ve==="n"&&(X.preventDefault(),ne.current("no"))};return window.addEventListener("keydown",D),()=>window.removeEventListener("keydown",D)},[n,e]),R.useEffect(()=>{if(!n||!c)return;const D=requestAnimationFrame(()=>{var X;return(X=P.current)==null?void 0:X.focus()});return()=>cancelAnimationFrame(D)},[n,c==null?void 0:c.status]),!n)return null;const L=v!==null?c==null?void 0:c.steps[v]:c==null?void 0:c.steps[c.current_index],ee=(c==null?void 0:c.status)==="completed"||(c==null?void 0:c.status)==="aborted"||(c==null?void 0:c.status)==="failed",se=!!c&&!ee&&!S&&(((je=c.status)==null?void 0:je.startsWith("waiting"))??!1),le=(((B=c==null?void 0:c.steps[(c==null?void 0:c.current_index)??-1])==null?void 0:B.phase)??"pre")==="post",ze=!S&&(v===null||v===(c==null?void 0:c.current_index))&&(L!=null&&L.command)&&((c==null?void 0:c.status)==="waiting_notify"||(c==null?void 0:c.status)==="waiting_notice"||(c==null?void 0:c.status)==="waiting_ask")?y.jsxs("div",{className:"space-y-2",children:[y.jsx("p",{className:"text-[11px] font-medium uppercase tracking-wider text-ink-muted",children:"Command:"}),y.jsxs("div",{className:"relative rounded-lg border border-line bg-surface-strong p-4 pr-10 font-mono text-xs text-ink leading-relaxed",children:[y.jsx(Xh,{text:L.command}),L.command]})]}):null;return y.jsx("div",{ref:M,role:"dialog","aria-modal":"true","aria-labelledby":"workflow-runner-title",onKeyDown:ie,className:"animate-overlay-in fixed inset-0 z-[var(--z-modal)] flex items-center justify-center bg-black/60 p-4 backdrop-blur-xs",children:y.jsxs("div",{className:"animate-modal-in flex h-[80vh] w-full max-w-5xl flex-col rounded-xl border border-frame-line glass-panel overflow-hidden",children:[y.jsxs("div",{className:"flex items-center justify-between border-b border-line px-5 py-3.5 bg-surface-strong/30 shrink-0",children:[y.jsxs("div",{className:"flex items-center gap-2.5",children:[y.jsx("span",{className:"flex h-8 w-8 items-center justify-center rounded-lg bg-chip-indigo-bg text-chip-indigo-text",children:y.jsx(oO,{className:"h-4 w-4"})}),y.jsxs("div",{children:[y.jsx("h2",{id:"workflow-runner-title",className:"text-sm font-semibold text-ink",children:"Launch Workflow Engine"}),y.jsxs("p",{className:"text-xs text-ink-muted",children:[i," ",c!=null&&c.pattern?`• Pattern: ${c.pattern}`:""]})]})]}),y.jsxs("div",{className:"flex items-center gap-1.5",children:[c&&!ee&&!S&&y.jsxs("button",{type:"button",disabled:!se||d,onClick:()=>T("bypass"),title:le?"Skip the remaining post-launch steps":"Skip the remaining steps and launch with the OS default app",className:"btn inline-flex items-center gap-1.5 rounded-md border border-line bg-surface px-3 py-1.5 text-xs font-medium text-status-warning-text hover:bg-status-warning-bg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-indigo-500 disabled:cursor-not-allowed disabled:opacity-40",children:[y.jsx(oD,{className:"h-3.5 w-3.5"}),le?"Skip rest":"Launch now"]}),y.jsx("button",{type:"button",onClick:re,className:"rounded-md p-1.5 text-ink-muted hover:bg-elevated hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-indigo-500",children:y.jsx(Ui,{className:"h-4 w-4"})})]})]}),y.jsxs("div",{className:"flex flex-1 overflow-hidden",children:[y.jsxs("div",{className:"w-72 border-r border-line bg-surface-strong/20 p-4 overflow-y-auto flex flex-col gap-2 shrink-0",children:[y.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wider text-ink-muted px-1 mb-1",children:"Workflow Steps (Click to inspect)"}),c&&c.steps.length>0?y.jsx("ul",{role:"list",className:"flex flex-col gap-2",children:c.steps.map((D,X)=>{const fe=c.current_index===X&&!ee,pe=v===X||v===null&&fe,Re=aq[D.status];return y.jsx("li",{children:y.jsxs("button",{ref:Ne=>{W.current[X]=Ne},type:"button",tabIndex:pe?0:-1,"aria-current":pe?"step":void 0,onKeyDown:Ne=>U(Ne,X),onClick:()=>w(X),className:`flex items-start text-left gap-2.5 rounded-lg border px-3 py-2.5 transition-colors cursor-pointer w-full ${pe?"border-chip-indigo-border bg-chip-indigo-bg shadow-xs ring-1 ring-chip-indigo-border/40":"border-line/60 bg-surface/60 hover:bg-elevated/80"}`,children:[y.jsxs("div",{className:"mt-0.5 shrink-0",children:[D.status==="running"&&y.jsx(Zl,{className:"h-4 w-4 animate-spin text-chip-indigo-text"}),D.status==="completed"&&y.jsx(qk,{className:"h-4 w-4 text-status-success-text"}),D.status==="skipped"&&y.jsx(T4,{className:"h-4 w-4 text-status-warning-text"}),D.status==="failed"&&y.jsx(Gu,{className:"h-4 w-4 text-status-danger-text"}),D.status==="pending"&&y.jsx("div",{className:"h-4 w-4 rounded-full border border-line-strong flex items-center justify-center text-[10px] text-ink-faint font-mono",children:D.index})]}),y.jsxs("div",{className:"min-w-0 flex-1",children:[y.jsxs("div",{className:"flex items-center justify-between",children:[y.jsx("span",{className:"font-mono text-[11px] font-bold uppercase text-chip-indigo-text",children:D.action}),y.jsxs("span",{className:"text-[10px] font-mono text-ink-faint",children:["#",D.index," · ",Re]})]}),y.jsx("p",{className:"truncate font-mono text-[11px] text-ink-secondary mt-0.5",title:D.command,children:D.message?D.message.split(` -`)[0]:D.command}),D.note&&y.jsx("p",{className:"mt-1 text-[10px] text-ink-faint italic",children:D.note})]})]})},D.index)})}):y.jsx("div",{className:"p-4 text-center text-xs text-ink-faint",children:g||S?"Session unavailable — see the error panel.":"Loading steps..."})]}),y.jsxs("div",{className:"flex-1 flex flex-col bg-app",children:[y.jsx("div",{className:"flex-1 min-h-0 overflow-y-auto p-6",children:y.jsx("div",{className:"space-y-6",children:y.jsxs("div",{className:"rounded-xl border border-line bg-surface p-5 shadow-xs space-y-4",children:[y.jsxs("div",{className:"flex items-center justify-between border-b border-line pb-3",children:[y.jsxs("div",{className:"flex items-center gap-2",children:[y.jsx("span",{className:"rounded bg-chip-indigo-bg px-2 py-0.5 font-mono text-xs font-semibold uppercase text-chip-indigo-text",children:(L==null?void 0:L.action)||(c==null?void 0:c.status)}),y.jsx("span",{className:"text-xs text-ink-muted",children:L?`Step ${L.index} of ${c==null?void 0:c.steps.length}`:"Status"}),v!==null&&v!==(c==null?void 0:c.current_index)&&y.jsx("button",{type:"button",onClick:()=>w(null),className:"text-[11px] text-chip-indigo-text hover:underline ml-2",children:"(Return to active step)"})]}),d&&y.jsx(Zl,{className:"h-4 w-4 animate-spin text-chip-indigo-text"})]}),y.jsxs("div",{className:"space-y-3 text-xs text-ink font-sans leading-relaxed",children:[(v===null||v===(c==null?void 0:c.current_index))&&(c==null?void 0:c.status)==="waiting_notify"&&c.notify_message&&y.jsxs("div",{className:"space-y-2",children:[y.jsx("p",{className:"text-[11px] font-medium uppercase tracking-wider text-ink-muted",children:"Notification Message:"}),y.jsx("div",{className:"rounded-lg border border-line bg-surface-strong p-4 text-ink",children:y.jsx(Qh,{text:c.notify_message})}),ze]}),(v===null||v===(c==null?void 0:c.current_index))&&(c==null?void 0:c.status)==="waiting_notice"&&c.notice_message&&y.jsxs("div",{className:"space-y-2",children:[y.jsx("p",{className:"text-[11px] font-medium uppercase tracking-wider text-ink-muted",children:"Notice:"}),y.jsx("div",{className:"rounded-lg border border-line bg-surface-strong p-4 text-ink",children:y.jsx(Qh,{text:c.notice_message})}),ze,y.jsx("p",{className:"text-[11px] text-ink-faint",children:"The command will run when you continue."})]}),(v===null||v===(c==null?void 0:c.current_index))&&(c==null?void 0:c.status)==="waiting_ask"&&c.ask_prompt&&y.jsxs("div",{className:"space-y-2",children:[c.ask_message&&y.jsx("div",{className:"rounded-lg border border-line bg-surface-strong p-4 text-ink",children:y.jsx(Qh,{text:c.ask_message})}),y.jsx("p",{className:"text-[11px] font-medium uppercase tracking-wider text-status-warning-text",children:"Confirmation Prompt:"}),y.jsx("div",{className:"rounded-lg border border-status-warning-border bg-status-warning-bg p-4 text-sm font-medium text-ink",children:c.ask_prompt}),ze]}),ee&&v===null&&y.jsxs("div",{className:`rounded-xl border p-8 text-center space-y-4 ${(c==null?void 0:c.status)==="completed"?"border-status-success-border bg-status-success-bg text-status-success-text":"border-status-danger-border bg-status-danger-bg text-status-danger-text"}`,children:[y.jsx("div",{className:"inline-flex h-12 w-12 items-center justify-center rounded-full bg-surface/50 mx-auto",children:(c==null?void 0:c.status)==="completed"?y.jsx(qk,{className:"h-6 w-6 text-status-success-text"}):y.jsx(Gu,{className:"h-6 w-6 text-status-danger-text"})}),y.jsxs("div",{className:"space-y-1",children:[y.jsx("h3",{className:"text-base font-bold",children:(c==null?void 0:c.status)==="completed"?"Workflow Finished":"Workflow Terminated"}),y.jsx("p",{className:"text-xs text-ink-secondary max-w-md mx-auto",children:(c==null?void 0:c.final_message)||"The launch sequence has ended."})]}),y.jsx("div",{className:"pt-2",children:y.jsx("button",{type:"button",onClick:e,className:"btn btn-primary px-8 py-2.5 font-bold shadow-lg",children:"Close Engine Runner"})})]}),ee&&v===null&&(c==null?void 0:c.last_output)&&y.jsxs("div",{className:"space-y-2",children:[y.jsx("p",{className:"text-[11px] font-medium uppercase tracking-wider text-ink-muted",children:"Command Output:"}),y.jsxs("div",{className:"relative",children:[y.jsx(Xh,{text:c.last_output}),y.jsx("pre",{className:"max-h-48 overflow-y-auto whitespace-pre-wrap break-words rounded-lg border border-line bg-surface-strong p-4 font-mono text-xs text-ink",children:c.last_output})]})]}),!S&&!(ee&&v===null)&&!((v===null||v===(c==null?void 0:c.current_index))&&((c==null?void 0:c.status)==="waiting_notify"||(c==null?void 0:c.status)==="waiting_ask"||(c==null?void 0:c.status)==="waiting_notice"))&&y.jsxs("div",{className:"space-y-4",children:[(L==null?void 0:L.message)&&y.jsxs("div",{className:"space-y-2",children:[y.jsx("p",{className:"text-[11px] font-medium uppercase tracking-wider text-ink-muted",children:"Message:"}),y.jsx("div",{className:"rounded-lg border border-line bg-surface-strong p-4 text-xs text-ink",children:y.jsx(Qh,{text:L.message})})]}),y.jsxs("div",{className:"space-y-2",children:[y.jsx("p",{className:"text-[11px] font-medium uppercase tracking-wider text-ink-muted",children:"Command:"}),y.jsx("div",{className:"relative rounded-lg border border-line bg-surface-strong p-4 font-mono text-xs text-ink leading-relaxed",children:L!=null&&L.command?y.jsxs(y.Fragment,{children:[y.jsx(Xh,{text:L.command}),y.jsx("span",{className:"block pr-8",children:L.command})]}):"Waiting..."})]}),(L==null?void 0:L.output)&&y.jsxs("div",{className:"space-y-2",children:[y.jsx("p",{className:"text-[11px] font-medium uppercase tracking-wider text-ink-muted",children:"Output:"}),y.jsxs("div",{className:"relative",children:[y.jsx(Xh,{text:L.output}),y.jsx("pre",{className:"max-h-48 overflow-y-auto whitespace-pre-wrap break-words rounded-lg border border-line bg-surface-strong p-4 font-mono text-xs text-ink",children:L.output})]})]}),(L==null?void 0:L.ask)&&y.jsxs("div",{className:"rounded-lg border border-status-warning-border bg-status-warning-bg p-3 text-xs text-status-warning-text",children:[y.jsx("span",{className:"font-semibold",children:"Workflow Guard:"})," ",L.ask]}),(L==null?void 0:L.note)&&y.jsxs("div",{className:"rounded-lg border border-line bg-surface-strong p-3 text-xs text-ink-muted italic",children:[y.jsx("span",{className:"font-semibold text-ink-secondary not-italic uppercase text-[10px]",children:"Log:"})," ",L.note]})]})]})]})})}),(g||S)&&y.jsx("div",{className:"shrink-0 px-6 pt-3",children:y.jsxs("div",{className:"flex items-start gap-2 rounded-lg border border-status-danger-border bg-status-danger-bg p-3 text-xs text-status-danger-text",children:[y.jsx(Gu,{className:"mt-0.5 h-4 w-4 shrink-0"}),y.jsxs("div",{className:"min-w-0 flex-1 space-y-1.5",children:[y.jsx("p",{children:S?"Workflow session on the server has expired or ended.":g}),S?y.jsxs("div",{className:"space-y-2",children:[g&&y.jsxs("details",{className:"text-ink-muted",children:[y.jsx("summary",{className:"cursor-pointer select-none text-[11px] underline",children:"Raw error (for bug reports)"}),y.jsx("pre",{className:"mt-1 overflow-x-auto whitespace-pre-wrap break-words font-mono text-[11px]",children:g})]}),y.jsxs("div",{className:"flex items-center gap-2",children:[y.jsx("button",{type:"button",onClick:de,className:"btn btn-primary px-4 py-1.5 text-xs font-semibold",children:"Restart workflow"}),y.jsx("button",{type:"button",onClick:re,className:"btn rounded-md border-line bg-surface px-4 py-1.5 text-xs",children:"Close"})]})]}):null]})]})}),y.jsxs("div",{className:"shrink-0 px-6 pt-4 pb-4 border-t border-line flex items-center justify-between bg-app",children:[y.jsx("div",{className:"text-xs text-ink-muted","aria-live":"polite",children:S?"Session unavailable — restart or close above.":(c==null?void 0:c.status)==="waiting_ask"&&(v===null||v===c.current_index)?"Action required to proceed:":(c==null?void 0:c.status)==="waiting_notify"&&(v===null||v===c.current_index)?"Acknowledge message to proceed:":(c==null?void 0:c.status)==="waiting_notice"&&(v===null||v===c.current_index)?"Continue to run the command:":ee?"Session terminated.":"Step in progress..."}),y.jsxs("div",{className:"flex items-center gap-2",children:[!S&&(c==null?void 0:c.status)==="waiting_notice"&&(v===null||v===c.current_index)&&y.jsxs("button",{type:"button",ref:P,disabled:d,onClick:()=>T("ack"),className:"btn btn-primary px-5 py-2 font-semibold shadow-sm",children:["Run Command",y.jsx(qu,{label:"↵"})]}),!S&&(c==null?void 0:c.status)==="waiting_notify"&&(v===null||v===c.current_index)&&y.jsxs("button",{type:"button",ref:P,disabled:d,onClick:()=>T("ack"),className:"btn btn-primary px-5 py-2 font-semibold shadow-sm",children:["Continue Workflow",y.jsx(qu,{label:"↵"})]}),!S&&(c==null?void 0:c.status)==="waiting_ask"&&(v===null||v===c.current_index)&&y.jsxs(y.Fragment,{children:[y.jsxs("button",{type:"button",disabled:d,onClick:()=>T("no"),className:"btn rounded-md border-line bg-surface px-4 py-2 text-status-danger-text hover:bg-status-danger-bg",children:["Abort Launch",y.jsx(qu,{label:"N"})]}),y.jsxs("button",{type:"button",disabled:d,onClick:()=>T("skip"),className:"btn rounded-md border-line bg-surface px-4 py-2 text-status-warning-text hover:bg-status-warning-bg",children:["Skip Step",y.jsx(qu,{label:"S"})]}),y.jsxs("button",{type:"button",ref:P,disabled:d,onClick:()=>T("yes"),className:"btn btn-primary px-5 py-2 font-semibold shadow-sm",children:["Execute Step",y.jsx(qu,{label:"Y"})]})]}),ee&&y.jsx("button",{type:"button",ref:P,onClick:e,className:"btn btn-primary px-5 py-2 font-semibold shadow-sm",children:"Close Runner"})]})]})]})]})]})})}function PC({url:n,label:e,className:t="",onCopied:i,onCopyError:l}){const o=async()=>{try{await navigator.clipboard.writeText(n),i==null||i(n)}catch{l==null||l(n)}};return y.jsxs("span",{className:`flex items-center justify-between gap-2 ${t}`.trim(),children:[y.jsx("code",{className:"truncate font-mono text-[11px] text-ink",children:n}),y.jsx("button",{type:"button",onClick:o,"aria-label":e??`Copy ${n}`,title:e??"Copy",className:"focus-ring shrink-0 rounded p-1 text-ink-faint transition-colors hover:bg-elevated hover:text-ink",children:y.jsx(si,{className:"h-3.5 w-3.5"})})]})}const cq=";",HC="=";function fq(n){const e=n.trim().toLowerCase();return e==="extension"||e==="file_ext"||e==="filetype"?"ext":e==="directory"||e==="path"||e==="folder"?"dir":e==="recurse"||e==="recursive_search"?"recursive":e==="filter_text"||e==="query"||e==="search"?"filter":e}function IC(n){const e=n.trim();if(!e.includes(HC))return{values:{filter:e},isPlainFilter:!0};const t={};for(const i of e.split(cq)){const l=i.trim();if(!l)continue;const o=l.indexOf(HC);if(o===-1)continue;const a=fq(l.slice(0,o)),c=l.slice(o+1).trim();switch(a){case"filter":t.filter=c;break;case"ext":t.ext=c;break;case"recursive":t.recursive=UC(c,!0);break;case"dir":t.dir=c;break;case"scan":t.scan=UC(c,!1);break}}return{values:t,isPlainFilter:!1}}function UC(n,e){const t=n.toLowerCase();return["0","false","no","off"].includes(t)?!1:["1","true","yes","on"].includes(t)?!0:e}function Vu(n){return/[",\n\r]/.test(n)?`"${n.replace(/"/g,'""')}"`:n}function hq(n,e,t,i){var f,d;const l=[],a=[["Exported",new Date().toISOString()],["App Version",(t==null?void 0:t.release)??"unknown"],["Config File",(t==null?void 0:t.config_path)??"none"],["Config Exists",String((t==null?void 0:t.config_exists)??!1)],["Directory",(t==null?void 0:t.active_directory)??""],["Extensions",((f=t==null?void 0:t.extensions)==null?void 0:f.join(" | "))??""],["Filter Text",i??((d=t==null?void 0:t.filters)==null?void 0:d[0])??""],["Recursive",String((t==null?void 0:t.recursive_search)??!0)],["Title",(t==null?void 0:t.title)??""],["Release",(t==null?void 0:t.release)??""]];for(const[p,g]of a)l.push(`${Vu(p)},${Vu(g)}`);l.push("");const c=e.length>0?e:["filename","path","rel_path"];l.push(c.map(Vu).join(","));for(const p of n){const g=c.map(b=>b in p?Vu(String(p[b]??"")):Vu(p.column_values[b]??""));l.push(g.join(","))}return l.join(`\r -`)}const dq=120,FC=800,pq=4e3,qC=20;function mq(){const[n,e]=R.useState("dark"),[t,i]=R.useState(null),[l,o]=R.useState(null),[a,c]=R.useState(""),[f,d]=R.useState(""),[p,g]=R.useState(""),[b,v]=R.useState(!0),[w,S]=R.useState([]),[C,O]=R.useState(0),[j,M]=R.useState(!1),[H,P]=R.useState(!1),[A,T]=R.useState(null),[z,ne]=R.useState(!1),[F,W]=R.useState(null),[U,re]=R.useState(0),[de,ie]=R.useState(!1),L=R.useRef(0),ee=R.useRef(null),se=R.useRef(null),[le,E]=R.useState(""),[ze,je]=R.useState(null),[B,D]=R.useState(!1),[X,fe]=R.useState(null),[pe,Re]=R.useState(!1),[Ne,_e]=R.useState("en"),[ve,ce]=R.useState(!1),[xe,Ue]=R.useState(!1),[ot,wt]=R.useState(!1),[xt,Xe]=R.useState(!1),[Ft,Zn]=R.useState(null),[Un,Rn]=R.useState(null),[Se,Ve]=R.useState(!1),[We,yt]=R.useState(!1),[J,he]=R.useState(null),[Ae,Pe]=R.useState(null),[qt,ft]=R.useState(!1),jt=R.useRef(""),[vn,Ti]=R.useState(!1),[qi,sr]=R.useState(void 0),[hs,Qt]=R.useState(!1),[Wt,pi]=R.useState(null),[dn,uo]=R.useState(0),co=R.useRef(null),fl=R.useRef(null),ye=(q,I="info")=>{q&&(fe({message:q,kind:I}),fl.current&&clearTimeout(fl.current),fl.current=setTimeout(()=>fe(null),I==="error"?1e4:3500))},gp=()=>{fl.current&&clearTimeout(fl.current),fe(null)},ds=q=>{he(q)},Pt=()=>{var I;se.current&&(clearTimeout(se.current),se.current=null),(I=ee.current)==null||I.abort(),ee.current=new AbortController;const q=++L.current;return ie(!0),P(!1),q},kt=q=>q===L.current,_t=q=>{kt(q)&&ie(!1)},Jn=R.useRef(null);R.useEffect(()=>{if(!p.trim()){E("");return}const q=window.setTimeout(()=>E(p),dq);return()=>window.clearTimeout(q)},[p]);const Ht=R.useMemo(()=>le.trim()===""?w:w.filter(q=>K9(q.rel_path,le)),[w,le]),xp=p.trim()&&w.length{const q=Jn.current,I=q?Ht.findIndex(te=>te.path===q):-1;if(I>=0){re(te=>I!==te?I:te);return}re(te=>Math.min(te,Math.max(0,Ht.length-1)))},[Ht]);const ps=async(q,I=F)=>{var Me;const te=await $g({offset:0,limit:T0,sort_by:I==null?void 0:I.column,sort_dir:I==null?void 0:I.direction,signal:(Me=ee.current)==null?void 0:Me.signal});return kt(q)?(S(te.items),O(te.count),M(!0),!0):!1},Fn=async(q,I)=>{var te;return!kt(q)||(await zk(I,(te=ee.current)==null?void 0:te.signal),!kt(q)||!await ps(q))?!1:(Jn.current=null,re(0),!0)},fo=async()=>{if(H||w.length>=C)return;const q=L.current;P(!0);try{const I=await $g({offset:w.length,limit:T0,sort_by:F==null?void 0:F.column,sort_dir:F==null?void 0:F.direction});if(!kt(q))return;const te=new Set(w.map(Me=>Me.path||Me.filename));S(Me=>[...Me,...I.items.filter(ut=>!te.has(ut.path||ut.filename))]),O(I.count)}catch{ye("Couldn't load more results — scroll to try again.","error")}finally{kt(q)&&P(!1)}},or=async()=>{if(pe)return;Re(!0),ye("Reloading configuration...");const q=Pt();try{const I=await $h();i(I);const te=await SM();o(te),e(Uk(te.theme));const Me=te.active_directory||a,ut=te.extensions[0]??"",et=te.filters[0]??"";Me&&c(Me),d(ut),g(et),v(te.recursive_search),te.reloaded===!1?ye(`Config file not found: ${te.config_path||"(unknown path)"} — kept current configuration.`,"error"):ye("Configuration reloaded."),Me&&await Fn(q,{directory:Me,extension:ut,filter_text:et,recursive:te.recursive_search})}catch(I){ye(`Failed to reload configuration: ${I.message}`,"error")}finally{Re(!1),_t(q)}},Lr=async q=>{const I=Pt();o(q),e(Uk(q.theme));const te=q.active_directory||a||(q.directories[0]??""),Me=q.extensions[0]??"",ut=q.filters[0]??"";if(te&&c(te),d(Me),g(ut),v(q.recursive_search),q.session_trial||ye(q.config_exists?`Loaded config: ${q.config_path}`:"Starter configuration created."),te)try{await Fn(I,{directory:te,extension:Me,filter_text:ut,recursive:q.recursive_search})}catch(et){ye(`Scan failed after config load: ${et.message}`,"error")}finally{_t(I)}else _t(I)},[ms,jc]=R.useState(!1),Ia=R.useRef(Gh()),gs=q=>{Ia.current=q,jc(q.overlayVisible)},xs=R.useRef(()=>{}),ys=async q=>{try{const I=await q.text(),te=await XC(q.name,I);await Lr(te),ye(`Session config applied: ${q.name}`)}catch(I){ye(I.message||"Failed to apply dropped configuration","error")}};xs.current=q=>{ys(q)};const Ua=R.useRef(0),Fa=R.useRef(async()=>{});R.useEffect(()=>{Fa.current=async()=>{const q=await Rk();await Lr(q)}}),R.useEffect(()=>{const q=async()=>{let te=[];try{te=(await xM(Ua.current)).events}catch{return}for(const Me of te){if(Ua.current=Math.max(Ua.current,Me.id),Me.config_applied)try{await Fa.current()}catch{}ye(Me.message)}},I=setInterval(()=>void q(),pq);return()=>clearInterval(I)},[]),R.useEffect(()=>{const q=et=>{var Xt;return Array.from(((Xt=et.dataTransfer)==null?void 0:Xt.types)??[]).includes("Files")},I=et=>{gs(Ik(Ia.current,"enter",q(et)))},te=et=>{q(et)&&et.preventDefault()},Me=et=>{gs(Ik(Ia.current,"leave",q(et)))},ut=et=>{var ht;et.preventDefault(),gs(Gh());const Xt=Array.from(((ht=et.dataTransfer)==null?void 0:ht.files)??[]),Ke=IM(Xt);if(!Ke){Xt.length>0&&ye("Not a ProFiles configuration file.","error");return}xs.current(Ke)};return window.addEventListener("dragenter",I),window.addEventListener("dragover",te),window.addEventListener("dragleave",Me),window.addEventListener("drop",ut),()=>{window.removeEventListener("dragenter",I),window.removeEventListener("dragover",te),window.removeEventListener("dragleave",Me),window.removeEventListener("drop",ut)}},[]);const _c=()=>{ce(!0)},Lc=async q=>{const I=Pt();ce(!1),c(q),ye(`Directory selected: ${q}`);let te;try{te=await jk(q),o(te)}catch(et){console.error("select-directory failed:",et)}if(!kt(I))return;const Me=te!=null&&te.extensions.includes(f)?f:(te==null?void 0:te.extensions[0])??f,ut=te!=null&&te.filters.includes(p)?p:(te==null?void 0:te.filters[0])??p;d(Me),g(ut);try{await Fn(I,{directory:q,extension:Me,filter_text:ut,recursive:b})}catch(et){kt(I)&&ye(`Scan failed: ${et.message}`,"error")}finally{_t(I)}},qa=async(q,I)=>{if(!kt(I))return;const te=q.theme==="auto"?"dark":q.theme==="light"?"light":"dark";e(te);try{localStorage.setItem("profiles-theme",te)}catch{}o(q);const Me=q.active_directory||(q.directories.length>0?q.directories[0]:""),ut=q.extensions.length>0?q.extensions[0]:"",et=q.filters.length>0?q.filters[0]:"";if(Me&&c(Me),ut&&d(ut),q.recursive_search!==void 0&&v(q.recursive_search),et&&g(et),q.config_exists||Ue(!0),Me)try{await Fn(I,{directory:Me,extension:ut,filter_text:et,recursive:q.recursive_search})}catch(Xt){kt(I)&&ye(`Initial scan failed: ${Xt.message}`,"error")}},ho=async()=>{var I;(I=ee.current)==null||I.abort(),ee.current=new AbortController;const q=++L.current;T(null),ne(!0);try{const te=await $h();i(te);const Me=await Rk();await qa(Me,q)}catch(te){T((te==null?void 0:te.message)||"Couldn't fetch system info or configuration.")}finally{ne(!1)}};R.useEffect(()=>{ho()},[]),R.useEffect(()=>()=>{var q;se.current&&(clearTimeout(se.current),se.current=null),(q=ee.current)==null||q.abort()},[]);const bs=async q=>{const I=Pt();c(q);try{const te=await jk(q);if(!kt(I))return;o(te);const Me=te.extensions.includes(f)?f:te.extensions[0]??"",ut=te.filters.includes(p)?p:te.filters[0]??"";d(Me),g(ut),await Fn(I,{directory:q,extension:Me,filter_text:ut,recursive:b})}catch(te){kt(I)&&ye(`Directory change failed: ${te.message}`,"error")}finally{_t(I)}},zr=async()=>{if(!a)return;const q=Pt();try{await Fn(q,{directory:a,extension:f,filter_text:p,recursive:b})}catch(I){kt(q)&&ye(`Scan failed: ${(I==null?void 0:I.message)??I}`,"error")}finally{_t(q)}},jn=R.useRef(zr);R.useEffect(()=>{jn.current=zr});const un=q=>{g(q),se.current&&clearTimeout(se.current),se.current=setTimeout(()=>{se.current=null,jn.current()},FC)},_n=q=>{v(q),se.current&&clearTimeout(se.current),se.current=setTimeout(()=>{se.current=null,jn.current()},FC)},hl=async()=>{if(g(""),!a)return;const q=Pt();try{await Fn(q,{directory:a,extension:f,filter_text:"",recursive:b})}catch(I){kt(q)&&ye(`Scan failed: ${(I==null?void 0:I.message)??I}`,"error")}finally{_t(q)}},zc=async()=>{if(v(!1),!a)return;const q=Pt();try{await Fn(q,{directory:a,extension:f,filter_text:p,recursive:!1})}catch(I){kt(q)&&ye(`Scan failed: ${I.message}`,"error")}finally{_t(q)}},dl=async(q,I)=>{if(q.has_hook){Pe({file:q,args:I});return}try{await EM({directory:a,filename:q.rel_path,release:l==null?void 0:l.release,args:I}),ye(`Launched ${q.filename}`)}catch(te){ye(`Launch error: ${te.message}`,"error")}},Bc=()=>{Ht.length>0&&Ht[U]&&dl(Ht[U])},Pc=q=>{var I;Jn.current=((I=Ht[q])==null?void 0:I.path)??null,re(q)},vs=async(q,I)=>{dl(q,I)},po=async q=>{try{await GC(q.path),ye("Revealed in file manager.")}catch(I){ye(`Error: ${I.message}`,"error")}},mo=async q=>{try{await Q0(q.path),ye("Folder opened in file manager.")}catch(I){ye(`Error: ${I.message}`,"error")}},Br=async q=>{try{const I=await Bk(q.path);ye(I.message||"Terminal opened.")}catch(I){ye(`Error: ${I.message}`,"error")}},pl=async q=>{try{await bs(q),ye(`Scanned directory: ${q}`)}catch(I){ye(`Error: ${I.message}`,"error")}},ws=q=>{g(q);const I=Pt();Fn(I,{directory:a,extension:f,filter_text:q,recursive:b}).catch(te=>{kt(I)&&ye(`Scan failed: ${(te==null?void 0:te.message)??te}`,"error")}).finally(()=>_t(I))},ml=q=>{d(q);const I=Pt();Fn(I,{directory:a,extension:q,filter_text:p,recursive:b}).catch(te=>{kt(I)&&ye(`Scan failed: ${(te==null?void 0:te.message)??te}`,"error")}).finally(()=>_t(I))},tn=async(q,I)=>{const te=I?q.path.replace(/\\/g,"/"):q.path;try{await navigator.clipboard.writeText(te),ye("Path copied to clipboard.")}catch(Me){ye(`Copy failed: ${(Me==null?void 0:Me.message)??Me}`,"error")}},Hc=async(q,I)=>{let te=q.filename;if(I){const Me=te.lastIndexOf(".");Me!==-1&&(te=te.slice(0,Me))}try{await navigator.clipboard.writeText(te),ye("Filename copied to clipboard.")}catch(Me){ye(`Copy failed: ${(Me==null?void 0:Me.message)??Me}`,"error")}},Ic=async(q,I)=>{try{ye(`Computing ${I.toUpperCase()}...`);const te=await Pk(q.path,I);await navigator.clipboard.writeText(te.hash),ye(`${I.toUpperCase()} hash copied: ${te.hash.slice(0,12)}...`)}catch(te){ye(`Hash computation failed: ${te.message}`,"error")}},Uc=async q=>{try{const I=new URL("file:///").href+q.path.replace(/\\/g,"/");await navigator.clipboard.writeText(I),ye("File URI copied to clipboard.")}catch(I){ye(`URI copy failed: ${I.message}`,"error")}},Pr=async(q,I)=>{try{const te=await navigator.clipboard.readText();if(!te.trim()){ye("Clipboard is empty — copy a hash first, then try again.");return}ye(`Computing ${I.toUpperCase()}...`);const ut=(await Pk(q.path,I)).hash.toLowerCase()===te.trim().toLowerCase();ye(ut?`✅ ${I.toUpperCase()} matches!`:`❌ ${I.toUpperCase()} mismatch`)}catch(te){ye(`Verification failed: ${te.message}`,"error")}},Hr=q=>{Rn(q),Xe(!0)},yp=q=>{Zn(q)},Fc=async()=>{const q=Ft;if(Zn(null),!!q)try{if(ye("Deleting file..."),!(await fetch("/api/actions/delete",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({file_path:q.path})})).ok)throw new Error("Failed to delete file");ye("File deleted successfully."),zr()}catch(I){ye(`Delete failed: ${I.message}`,"error")}},qc=q=>{sr(q.path),Ti(!0)},Vc=async()=>{if(a)try{await Q0(a),ye("Directory opened in file manager.")}catch(q){ye(`Error: ${q.message}`,"error")}},at=async q=>{if(q)try{await Bk(q),ye("Terminal opened in directory.")}catch(I){ye(`Error: ${I.message}`,"error")}},Va=async()=>{try{await bs("~"),ye("Directory set to home folder.")}catch(q){ye(`Error: ${q.message}`,"error")}},go=async()=>{if(a)try{const q=await $C(a);q.parent_path?(await bs(q.parent_path),ye("Moved to parent directory.")):ye("Already at root directory.")}catch(q){ye(`Error: ${q.message}`,"error")}},xo=async()=>{if(w.length===0){ye("No files to export.");return}try{const q=hq(w,(l==null?void 0:l.column_names)||[],l??void 0,p),I=`profiles-export-${new Date().toISOString().slice(0,19).replace(/[:.]/g,"-")}.csv`,te=await jM(q,I);ye(`Exported ${w.length} loaded row${w.length===1?"":"s"}${p?` matching "${p}"`:""} — ${te.message}`)}catch(q){ye(`Export failed: ${q.message}`,"error")}},Vi=async q=>{var Ke,ht;Qt(!1),ye("Barcode detected!");const te=IC(q).values,Me=te.dir!==void 0?te.dir:a,ut=te.ext!==void 0?te.ext:f,et=te.filter!==void 0?te.filter:p,Xt=te.recursive!==void 0?te.recursive:b;if(te.dir!==void 0&&c(te.dir),te.ext!==void 0&&d(te.ext),te.filter!==void 0&&g(te.filter),te.recursive!==void 0&&v(te.recursive),Me){const dt=Pt();try{await zk({directory:Me,extension:ut,filter_text:et,recursive:Xt},(Ke=ee.current)==null?void 0:Ke.signal);const Ir=await $g({offset:0,limit:T0,sort_by:F==null?void 0:F.column,sort_dir:F==null?void 0:F.direction,signal:(ht=ee.current)==null?void 0:ht.signal});if(!kt(dt))return;S(Ir.items),O(Ir.count),M(!0),Jn.current=null,re(0),Ir.count===1&&Ir.items.length===1&&pi(Ir.items[0])}catch(Ir){kt(dt)&&ye(`Scan error: ${Ir.message}`,"error")}finally{_t(dt)}}},qn=()=>{ft(q=>{const I=!q;return I?(jt.current="",ye("Barcode mode ON — scan a barcode now.")):(jt.current="",ye("Barcode mode OFF.")),I})},Qc=q=>{q.filter!==void 0&&g(q.filter),q.ext!==void 0&&d(q.ext),q.recursive!==void 0&&v(q.recursive),q.dir!==void 0&&c(q.dir),(q.scan===!0||q.filter!==void 0||q.ext!==void 0||q.recursive!==void 0||q.dir!==void 0)&&(ft(!1),jt.current="",setTimeout(()=>{jn.current()},50))};R.useEffect(()=>{if(!qt)return;const q=I=>{const te=I.target;if(!(te instanceof HTMLElement&&(te.isContentEditable||te instanceof HTMLInputElement||te instanceof HTMLTextAreaElement||te instanceof HTMLSelectElement)))if(I.key==="Enter"){const ut=jt.current;if(!ut){jt.current="";return}I.preventDefault(),jt.current="";const et=IC(ut);if(et.isPlainFilter)ye(`Barcode filter: ${et.values.filter}`),g(et.values.filter||""),ft(!1),setTimeout(()=>void jn.current(),50);else{const Xt=et.values,Ke=Object.entries(Xt).map(([ht,dt])=>`${ht}=${dt}`).join(", ");ye(`Barcode applied: ${Ke}`),Qc(Xt)}}else I.key==="Escape"?(ft(!1),jt.current="",ye("Barcode mode cancelled.")):I.key.length===1&&!I.ctrlKey&&!I.metaKey&&!I.altKey&&(jt.current+=I.key)};return document.addEventListener("keydown",q,!0),()=>document.removeEventListener("keydown",q,!0)},[qt]),R.useEffect(()=>(dn>0&&(co.current=setInterval(()=>{jn.current()},dn*1e3)),()=>{co.current&&(clearInterval(co.current),co.current=null)}),[dn]);const bp=q=>{uo(q),q>0?ye(`Auto-rescan every ${q}s.`):ye("Auto-rescan disabled.")},yo=!!(ze||B||ve||xe||xt||Se||We||vn||hs||Wt||Ae||Ft);return R.useEffect(()=>{const q=I=>{var Me,ut,et,Xt;if(I.key==="Escape"){je(null),D(!1),Ve(!1),yt(!1),gs(Gh());return}if(yo)return;if(I.ctrlKey&&!I.shiftKey&&I.key.toLowerCase()==="l"){I.preventDefault(),(Me=document.querySelector("[data-testid='file-list']"))==null||Me.focus();return}const te=I.target;if(!(te instanceof HTMLElement&&te.closest("button, a, [role='menuitem'], [role='option'], [role='columnheader'], [role='separator']"))){if(te instanceof HTMLInputElement||te instanceof HTMLSelectElement){I.key==="Enter"&&zr();return}if(I.key==="ContextMenu"||I.shiftKey&&I.key==="F10"){const Ke=Ht[U];if(!Ke)return;I.preventDefault();const ht=document.querySelector(`[data-row-index="${U}"]`),dt=ht==null?void 0:ht.getBoundingClientRect();je({x:dt?dt.left+24:24,y:dt?dt.top+dt.height/2:24,file:Ke});return}if(I.key==="F5"){I.preventDefault(),zr();return}if(I.ctrlKey&&I.key.toLowerCase()==="r"){I.preventDefault(),or();return}if(I.ctrlKey&&I.key.toLowerCase()==="d"){I.preventDefault(),(ut=document.querySelector("#directory-combobox"))==null||ut.focus();return}if(I.ctrlKey&&I.key.toLowerCase()==="e"){I.preventDefault(),(et=document.querySelector("#extension-combobox"))==null||et.focus();return}if(I.ctrlKey&&I.key.toLowerCase()==="f"){I.preventDefault(),(Xt=document.querySelector("#filter-combobox"))==null||Xt.focus();return}if(I.ctrlKey&&I.shiftKey&&I.key.toLowerCase()==="l"){I.preventDefault(),Ve(Ke=>!Ke);return}if(I.ctrlKey&&I.key===","){I.preventDefault(),wt(!0);return}if(I.ctrlKey&&I.shiftKey&&I.key.toLowerCase()==="t"){I.preventDefault(),e(Ke=>Ke==="dark"?"light":"dark");return}if(I.ctrlKey&&!I.shiftKey&&I.key.toLowerCase()==="b"){I.preventDefault(),ft(Ke=>!Ke);return}if(I.ctrlKey&&I.shiftKey&&I.key.toLowerCase()==="b"){I.preventDefault(),Qt(Ke=>!Ke);return}if(I.ctrlKey&&!I.shiftKey&&I.key.toLowerCase()==="t"){I.preventDefault(),yt(!0);return}if(I.ctrlKey&&!I.shiftKey&&I.key.toLowerCase()==="h"){I.preventDefault(),Va();return}if(I.key==="?"||I.ctrlKey&&I.key==="/"){I.preventDefault(),D(Ke=>!Ke);return}if(I.key.toLowerCase()==="p"&&!I.ctrlKey&&!I.shiftKey&&!I.altKey){const Ke=Ht[U];Ke&&(I.preventDefault(),Hr(Ke));return}I.key==="ArrowDown"?(I.preventDefault(),re(Ke=>{var dt;const ht=Math.min(Ke+1,Math.max(0,Ht.length-1));return Jn.current=((dt=Ht[ht])==null?void 0:dt.path)??null,ht})):I.key==="ArrowUp"?(I.preventDefault(),re(Ke=>{var dt;const ht=Math.max(Ke-1,0);return Jn.current=((dt=Ht[ht])==null?void 0:dt.path)??null,ht})):I.key==="Home"?(I.preventDefault(),re(Ke=>{var ht;return Jn.current=((ht=Ht[0])==null?void 0:ht.path)??null,Ke===0?Ke:0})):I.key==="End"?(I.preventDefault(),re(Ke=>{var dt;const ht=Math.max(0,Ht.length-1);return Jn.current=((dt=Ht[ht])==null?void 0:dt.path)??null,Ke===ht?Ke:ht})):I.key==="PageUp"?(I.preventDefault(),re(Ke=>{var dt;const ht=Math.max(Ke-qC,0);return Jn.current=((dt=Ht[ht])==null?void 0:dt.path)??null,ht})):I.key==="PageDown"?(I.preventDefault(),re(Ke=>{var dt;const ht=Math.min(Ke+qC,Math.max(0,Ht.length-1));return Jn.current=((dt=Ht[ht])==null?void 0:dt.path)??null,ht})):I.key==="Enter"&&(I.preventDefault(),Bc())}};return window.addEventListener("keydown",q),()=>window.removeEventListener("keydown",q)},[yo,Ht,U,a,f,p,b,qt]),R.useEffect(()=>{document.documentElement.setAttribute("data-theme",n);try{localStorage.setItem("profiles-theme",n)}catch{}},[n]),y.jsxs("div",{className:"flex h-dvh flex-col bg-elevated/30 p-1 font-sans text-ink transition-colors duration-200 sm:p-1.5",children:[y.jsxs("div",{className:"flex min-h-0 flex-1 flex-col overflow-hidden rounded-lg border border-frame-line bg-app shadow-[0_2px_6px_rgb(0_0_0/0.35)] transition-colors duration-200 sm:rounded-xl",children:[y.jsx(q9,{title:(l==null?void 0:l.title)||"",release:(l==null?void 0:l.release)||"",directories:(l==null?void 0:l.directories)||[],activeDirectory:a,onDirectoryChange:bs,onBrowseDirectory:_c,onGoToParentDirectory:go,onGoToHomeDirectory:Va,onOpenActiveDirectory:Vc,onOpenTerminal:at}),y.jsx(Z9,{extensions:(l==null?void 0:l.extensions)||[],activeExtension:f,onExtensionChange:d,filterOptions:(l==null?void 0:l.filters)||[],filterText:p,onFilterTextChange:un,recursive:b,onRecursiveChange:_n,onScan:zr,scanning:de,barcodeMode:qt,onBarcodeToggle:qn,onCameraBarcodeClick:()=>Qt(!0),autoRescanActive:dn>0,onTimerClick:()=>yt(!0)}),A?y.jsx(V9,{message:A,onRetry:()=>void ho(),retrying:z}):y.jsx(F9,{files:Ht,totalCount:C,rawLoadedCount:w.length,onLoadMore:fo,loadingMore:H,scanning:de,hasScanned:j,activeDirectory:a,recursive:b,onDisableRecursive:zc,onOpenDirectory:Vc,onOpenConfig:()=>Ue(!0),filterText:p,onClearFilter:hl,columnHeaders:(l==null?void 0:l.column_headers)||[],columnNames:(l==null?void 0:l.column_names)||[],selectedIndex:U,onSelectIndex:Pc,prefilterNote:xp,onLaunch:dl,onContextMenu:(q,I,te)=>{q.preventDefault(),Jn.current=I.path,re(te),je({x:q.clientX,y:q.clientY,file:I})},rowColors:(l==null?void 0:l.row_colors)||[],sort:F,onSortChange:q=>{W(q),Jn.current=null,re(0);const I=Pt();ps(I,q).catch(te=>{kt(I)&&ye(`Sort failed: ${te.message}`,"error")}).finally(()=>_t(I))}}),y.jsx(DD,{onExecute:Bc,scanning:de,scanningDirectory:a,hasSelection:Ht.length>0,fileCount:Ht.length,totalCount:C,toastMessage:X,onToastDismiss:gp}),y.jsx(b8,{systemInfo:t,fileCount:C,theme:n,onToggleTheme:()=>e(q=>q==="dark"?"light":"dark"),onOpenLog:()=>Ve(!0),onOpenConfig:()=>wt(!0),onLoadConfig:()=>Ue(!0),onShowShortcuts:()=>D(!0),onReloadConfig:or,onExport:xo,exportDisabled:w.length===0||de,language:Ne,onLanguageChange:_e,activeConfigName:l!=null&&l.config_path?l.config_path.split(/[\\/]/).pop()||l.config_path:void 0,lanEnabled:(t==null?void 0:t.lan_enabled)??null,onToggleLan:ds})]}),y.jsx(r8,{isOpen:xe,activeConfigPath:l==null?void 0:l.config_path,configExists:l==null?void 0:l.config_exists,onClose:()=>Ue(!1),onLoaded:Lr}),y.jsx(B9,{open:ot,onClose:()=>wt(!1),onApplied:Lr}),y.jsx(I9,{visible:ms,onFileSelected:q=>xs.current(q)}),y.jsx(H9,{isOpen:ve,initialPath:a,onClose:()=>ce(!1),onSelect:Lc}),y.jsx(P9,{position:ze,onClose:()=>je(null),onLaunch:dl,onLaunchWithArgs:vs,onReveal:po,onOpenFolder:mo,onOpenTerminal:Br,onScanDirectory:pl,onFilterFolder:ws,onFilterExtension:ml,onCopyPath:tn,onCopyFilename:Hc,onCopyUri:Uc,onComputeHash:Ic,onVerifyHash:Pr,onProperties:Hr,onClearFile:yp,onGenerateBarcode:qc,showToast:ye}),y.jsx(i8,{isOpen:B,onClose:()=>D(!1)}),y.jsx(u8,{isOpen:xt,file:Un,onLaunch:dl,onClose:()=>{Xe(!1),Rn(null)}}),y.jsx(w8,{isOpen:We,currentInterval:dn,onClose:()=>yt(!1),onSetInterval:bp}),y.jsx(n8,{isOpen:Se,onClose:()=>Ve(!1),onOpenExternally:()=>{yM().then(q=>ye(q.message))}}),y.jsx(uq,{isOpen:!!Ae,onClose:()=>Pe(null),directory:a,filename:(Ae==null?void 0:Ae.file.rel_path)||"",release:l==null?void 0:l.release,args:Ae==null?void 0:Ae.args,onFinished:(q,I)=>{q==="completed"?ye(I||"Workflow launched successfully."):(q==="aborted"||q==="failed")&&ye(`Workflow stopped: ${I}`,"error")}}),y.jsx(mA,{isOpen:vn,onClose:()=>{Ti(!1),sr(void 0)},initialFilePath:qi}),y.jsx(x8,{isOpen:hs,onClose:()=>Qt(!1),onDetected:Vi}),y.jsx(ka,{isOpen:!!Ft,title:"Delete file",message:`Delete this file? - -${(Ft==null?void 0:Ft.path)??""} - -This action cannot be undone.`,confirmLabel:"Delete",danger:!0,onConfirm:Fc,onCancel:()=>Zn(null)}),y.jsx(ka,{isOpen:J!==null,title:J?"Enable LAN access?":"Restrict to this machine?",message:J?y.jsxs("span",{className:"block",children:["ProFiles will be reachable by anyone on this network:",y.jsx(PC,{url:`http://${t==null?void 0:t.hostname}:${window.location.port}`,label:"Copy hostname URL",className:"mt-1.5",onCopied:()=>ye("URL copied to clipboard."),onCopyError:()=>ye("Failed to copy URL.","error")}),y.jsx(PC,{url:`http://${t==null?void 0:t.ip}:${window.location.port}`,label:"Copy IP URL",className:"mt-1.5",onCopied:()=>ye("URL copied to clipboard."),onCopyError:()=>ye("Failed to copy URL.","error")})]}):"ProFiles will be reachable only on this machine.",confirmLabel:J?"Enable LAN":"Restrict",onConfirm:async()=>{const q=J;he(null);try{await vM(q),ye(q?"Updating LAN binding…":"Restricting ProFiles to this machine…","info");const I=await wM(q);I&&i(I),(I==null?void 0:I.lan_enabled)===q?ye(q?"ProFiles is now reachable on the local network.":"ProFiles is restricted to this machine.","info"):ye("Failed to update LAN binding — the previous address is still active.","error")}catch(I){const te=I instanceof Error?I.message:"Failed to update LAN binding";ye(`Failed to update LAN binding: ${te}`,"error");const Me=await $h();i(Me)}},onCancel:()=>he(null)}),y.jsx(y8,{isOpen:!!Wt,file:Wt,onConfirm:()=>{if(Wt){const q=Wt;pi(null),dl(q)}},onDismiss:()=>pi(null)})]})}class gq extends R.Component{constructor(){super(...arguments);fh(this,"state",{error:null})}static getDerivedStateFromError(t){return{error:t}}componentDidCatch(t,i){console.error("Application render error:",t,i.componentStack)}render(){return this.state.error?y.jsx("main",{className:"flex min-h-screen items-center justify-center bg-app p-6 text-ink",children:y.jsxs("section",{className:"w-full max-w-lg rounded-lg border border-line bg-surface p-6",children:[y.jsx("h1",{className:"text-base font-semibold",children:"ProFiles encountered an error"}),y.jsx("p",{className:"mt-2 text-sm text-ink-secondary",children:"The interface could not continue. Reload the application to try again."}),y.jsxs("details",{className:"mt-4 text-xs text-ink-muted",children:[y.jsx("summary",{className:"cursor-pointer",children:"Error details"}),y.jsx("pre",{className:"mt-2 max-h-40 overflow-auto whitespace-pre-wrap",children:this.state.error.message})]}),y.jsx("button",{type:"button",onClick:()=>window.location.reload(),className:"btn btn-primary mt-5 px-4 py-2 text-sm font-semibold",children:"Reload application"})]})}):this.props.children}}gM.createRoot(document.getElementById("root")).render(y.jsx(uM.StrictMode,{children:y.jsx(gq,{children:y.jsx(mq,{})})})); diff --git a/src/profiles/web/dist/assets/index-DwqUySVf.css b/src/profiles/web/dist/assets/index-DwqUySVf.css deleted file mode 100644 index 62a3c57..0000000 --- a/src/profiles/web/dist/assets/index-DwqUySVf.css +++ /dev/null @@ -1 +0,0 @@ -/*! tailwindcss v4.3.3 | MIT License | https://tailwindcss.com */@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-translate-x:0;--tw-translate-y:0;--tw-translate-z:0;--tw-rotate-x:initial;--tw-rotate-y:initial;--tw-rotate-z:initial;--tw-skew-x:initial;--tw-skew-y:initial;--tw-space-y-reverse:0;--tw-border-style:solid;--tw-gradient-position:initial;--tw-gradient-from:#0000;--tw-gradient-via:#0000;--tw-gradient-to:#0000;--tw-gradient-stops:initial;--tw-gradient-via-stops:initial;--tw-gradient-from-position:0%;--tw-gradient-via-position:50%;--tw-gradient-to-position:100%;--tw-leading:initial;--tw-font-weight:initial;--tw-tracking:initial;--tw-ordinal:initial;--tw-slashed-zero:initial;--tw-numeric-figure:initial;--tw-numeric-spacing:initial;--tw-numeric-fraction:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-outline-style:solid;--tw-blur:initial;--tw-brightness:initial;--tw-contrast:initial;--tw-grayscale:initial;--tw-hue-rotate:initial;--tw-invert:initial;--tw-opacity:initial;--tw-saturate:initial;--tw-sepia:initial;--tw-drop-shadow:initial;--tw-drop-shadow-color:initial;--tw-drop-shadow-alpha:100%;--tw-drop-shadow-size:initial;--tw-backdrop-blur:initial;--tw-backdrop-brightness:initial;--tw-backdrop-contrast:initial;--tw-backdrop-grayscale:initial;--tw-backdrop-hue-rotate:initial;--tw-backdrop-invert:initial;--tw-backdrop-opacity:initial;--tw-backdrop-saturate:initial;--tw-backdrop-sepia:initial;--tw-duration:initial;--tw-scale-x:1;--tw-scale-y:1;--tw-scale-z:1}}}@layer theme{:root,:host{--font-sans:-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", "Noto Sans", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";--font-mono:ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;--color-emerald-200:oklch(90.5% .093 164.15);--color-emerald-300:oklch(84.5% .143 164.978);--color-emerald-400:oklch(76.5% .177 163.223);--color-emerald-500:oklch(69.6% .17 162.48);--color-emerald-600:oklch(59.6% .145 163.225);--color-emerald-800:oklch(43.2% .095 166.913);--color-indigo-400:oklch(67.3% .182 276.935);--color-indigo-500:oklch(58.5% .233 277.117);--color-indigo-600:oklch(51.1% .262 276.966);--color-slate-300:oklch(86.9% .022 252.894);--color-slate-400:oklch(70.4% .04 256.788);--color-slate-500:oklch(55.4% .046 257.417);--color-slate-600:oklch(44.6% .043 257.281);--color-slate-900:oklch(20.8% .042 265.755);--color-black:#000;--color-white:#fff;--spacing:.25rem;--container-xs:20rem;--container-sm:24rem;--container-md:28rem;--container-lg:32rem;--container-4xl:56rem;--container-5xl:64rem;--container-6xl:72rem;--text-xs:.75rem;--text-xs--line-height:calc(1 / .75);--text-sm:.875rem;--text-sm--line-height:calc(1.25 / .875);--text-base:1rem;--text-base--line-height: 1.5 ;--font-weight-normal:400;--font-weight-medium:500;--font-weight-semibold:600;--font-weight-bold:700;--tracking-tight:-.025em;--tracking-wide:.025em;--tracking-wider:.05em;--leading-relaxed:1.625;--radius-md:.375rem;--radius-lg:.5rem;--radius-xl:.75rem;--radius-2xl:1rem;--animate-spin:spin 1s linear infinite;--animate-pulse:pulse 2s cubic-bezier(.4, 0, .6, 1) infinite;--blur-xs:4px;--blur-sm:8px;--blur-md:12px;--blur-xl:24px;--aspect-video:16 / 9;--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4, 0, .2, 1);--default-font-family:var(--font-sans);--default-mono-font-family:var(--font-mono)}}@layer base{*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;-moz-tab-size:4;tab-size:4;line-height:1.5;font-family:var(--default-font-family,-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", "Noto Sans", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--default-mono-font-family,ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-variation-settings:var(--default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring:where(:not(iframe)){outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab,red,red)){::placeholder{color:color-mix(in oklab,currentcolor 50%,transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){-webkit-appearance:button;-moz-appearance:button;appearance:button}::file-selector-button{-webkit-appearance:button;-moz-appearance:button;appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}}@layer components{.glass-panel{background:var(--app-glass-panel);-webkit-backdrop-filter:blur(24px)saturate(160%);backdrop-filter:blur(24px)saturate(160%);box-shadow:var(--app-panel-shadow),inset 0 1px 0 var(--app-glass-highlight)}.glass-panel-strong{background:var(--app-glass-panel-strong);-webkit-backdrop-filter:blur(28px)saturate(180%);backdrop-filter:blur(28px)saturate(180%);box-shadow:var(--app-panel-shadow),inset 0 1px 0 var(--app-glass-highlight)}.btn{justify-content:center;align-items:center;gap:calc(var(--spacing) * 1.5);border-radius:var(--radius-md);border-style:var(--tw-border-style);font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height));--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium);transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration));border-width:1px;display:inline-flex}.btn:focus-visible{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow);--tw-ring-color:#625fffb3}@supports (color:color-mix(in lab,red,red)){.btn:focus-visible{--tw-ring-color:color-mix(in oklab, var(--color-indigo-500) 70%, transparent)}}.btn:focus-visible{--tw-outline-style:none;outline-style:none}.btn:disabled{cursor:not-allowed;opacity:.4}.btn-primary{background-color:var(--color-indigo-600);color:var(--color-white);border-color:#0000}@media(hover:hover){.btn-primary:hover{background-color:var(--color-indigo-500)}}.btn-secondary{border-color:var(--app-border);background-color:var(--app-elevated);color:var(--app-text-secondary)}@media(hover:hover){.btn-secondary:hover{border-color:var(--color-indigo-500);color:var(--app-text-primary)}.btn-chip:hover{--tw-brightness:brightness(95%);filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}}.btn-chip:focus-visible{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow);--tw-ring-color:#625fffb3}@supports (color:color-mix(in lab,red,red)){.btn-chip:focus-visible{--tw-ring-color:color-mix(in oklab, var(--color-indigo-500) 70%, transparent)}}.btn-chip:focus-visible{--tw-outline-style:none;outline-style:none}.btn-chip:disabled{cursor:not-allowed;opacity:.4}.focus-ring:focus-visible{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow);--tw-ring-color:#625fffb3}@supports (color:color-mix(in lab,red,red)){.focus-ring:focus-visible{--tw-ring-color:color-mix(in oklab, var(--color-indigo-500) 70%, transparent)}}.focus-ring:focus-visible{--tw-outline-style:none;outline-style:none}}@layer utilities{.pointer-events-auto{pointer-events:auto}.pointer-events-none{pointer-events:none}.invisible{visibility:hidden}.visible{visibility:visible}.sr-only{clip-path:inset(50%);white-space:nowrap;border-width:0;width:1px;height:1px;margin:-1px;padding:0;position:absolute;overflow:hidden}.absolute{position:absolute}.fixed{position:fixed}.relative{position:relative}.static{position:static}.sticky{position:sticky}.inset-0{top:0;right:0;bottom:0;left:0}.inset-y-0{inset-block:0}.-top-1{top:calc(var(--spacing) * -1)}.top-0{top:0}.top-1\/2{top:50%}.top-2{top:calc(var(--spacing) * 2)}.top-full{top:100%}.-right-0\.5{right:calc(var(--spacing) * -.5)}.-right-1{right:calc(var(--spacing) * -1)}.right-0{right:0}.right-2{right:calc(var(--spacing) * 2)}.-bottom-0\.5{bottom:calc(var(--spacing) * -.5)}.-bottom-1{bottom:calc(var(--spacing) * -1)}.bottom-0{bottom:0}.bottom-2{bottom:calc(var(--spacing) * 2)}.-left-1{left:calc(var(--spacing) * -1)}.left-0{left:0}.left-1\/2{left:50%}.left-2\.5{left:calc(var(--spacing) * 2.5)}.left-3{left:calc(var(--spacing) * 3)}.isolate{isolation:isolate}.z-10{z-index:10}.z-20{z-index:20}.z-30{z-index:30}.z-\[calc\(var\(--z-context-menu\)-1\)\]{z-index:calc(var(--z-context-menu) - 1)}.z-\[var\(--z-combobox-list\)\]{z-index:var(--z-combobox-list)}.z-\[var\(--z-context-menu\)\]{z-index:var(--z-context-menu)}.z-\[var\(--z-drop-overlay\)\]{z-index:var(--z-drop-overlay)}.z-\[var\(--z-modal\)\]{z-index:var(--z-modal)}.z-\[var\(--z-syntax-helper\)\]{z-index:var(--z-syntax-helper)}.z-\[var\(--z-toast\)\]{z-index:var(--z-toast)}.z-\[var\(--z-tooltip\)\]{z-index:var(--z-tooltip)}.container{width:100%}@media(min-width:40rem){.container{max-width:40rem}}@media(min-width:48rem){.container{max-width:48rem}}@media(min-width:64rem){.container{max-width:64rem}}@media(min-width:80rem){.container{max-width:80rem}}@media(min-width:96rem){.container{max-width:96rem}}.container\!{width:100%!important}@media(min-width:40rem){.container\!{max-width:40rem!important}}@media(min-width:48rem){.container\!{max-width:48rem!important}}@media(min-width:64rem){.container\!{max-width:64rem!important}}@media(min-width:80rem){.container\!{max-width:80rem!important}}@media(min-width:96rem){.container\!{max-width:96rem!important}}.mx-1{margin-inline:var(--spacing)}.mx-auto{margin-inline:auto}.my-1{margin-block:var(--spacing)}.my-1\.5{margin-block:calc(var(--spacing) * 1.5)}.my-2{margin-block:calc(var(--spacing) * 2)}.my-3{margin-block:calc(var(--spacing) * 3)}.mt-0\.5{margin-top:calc(var(--spacing) * .5)}.mt-1{margin-top:var(--spacing)}.mt-1\.5{margin-top:calc(var(--spacing) * 1.5)}.mt-2{margin-top:calc(var(--spacing) * 2)}.mt-3{margin-top:calc(var(--spacing) * 3)}.mt-4{margin-top:calc(var(--spacing) * 4)}.mt-5{margin-top:calc(var(--spacing) * 5)}.mt-6{margin-top:calc(var(--spacing) * 6)}.mr-1\.5{margin-right:calc(var(--spacing) * 1.5)}.mr-auto{margin-right:auto}.mb-0\.5{margin-bottom:calc(var(--spacing) * .5)}.mb-1{margin-bottom:var(--spacing)}.mb-1\.5{margin-bottom:calc(var(--spacing) * 1.5)}.mb-2{margin-bottom:calc(var(--spacing) * 2)}.mb-3{margin-bottom:calc(var(--spacing) * 3)}.mb-4{margin-bottom:calc(var(--spacing) * 4)}.mb-5{margin-bottom:calc(var(--spacing) * 5)}.ml-1\.5{margin-left:calc(var(--spacing) * 1.5)}.ml-2{margin-left:calc(var(--spacing) * 2)}.ml-auto{margin-left:auto}.block{display:block}.contents{display:contents}.flex{display:flex}.grid{display:grid}.hidden{display:none}.inline{display:inline}.inline-block{display:inline-block}.inline-flex{display:inline-flex}.list-item{display:list-item}.table{display:table}.aspect-video{aspect-ratio:var(--aspect-video)}.h-2{height:calc(var(--spacing) * 2)}.h-2\.5{height:calc(var(--spacing) * 2.5)}.h-3{height:calc(var(--spacing) * 3)}.h-3\.5{height:calc(var(--spacing) * 3.5)}.h-4{height:calc(var(--spacing) * 4)}.h-5{height:calc(var(--spacing) * 5)}.h-6{height:calc(var(--spacing) * 6)}.h-7{height:calc(var(--spacing) * 7)}.h-8{height:calc(var(--spacing) * 8)}.h-9{height:calc(var(--spacing) * 9)}.h-10{height:calc(var(--spacing) * 10)}.h-12{height:calc(var(--spacing) * 12)}.h-48{height:calc(var(--spacing) * 48)}.h-\[80vh\]{height:80vh}.h-\[90vh\]{height:90vh}.h-\[min\(84dvh\,760px\)\]{height:min(84dvh,760px)}.h-dvh{height:100dvh}.h-full{height:100%}.max-h-40{max-height:calc(var(--spacing) * 40)}.max-h-48{max-height:calc(var(--spacing) * 48)}.max-h-60{max-height:calc(var(--spacing) * 60)}.max-h-\[60vh\]{max-height:60vh}.max-h-\[90vh\]{max-height:90vh}.max-h-\[calc\(100dvh-1\.5rem\)\]{max-height:calc(100dvh - 1.5rem)}.max-h-\[calc\(100dvh-2rem\)\]{max-height:calc(100dvh - 2rem)}.max-h-\[calc\(100dvh-16px\)\]{max-height:calc(100dvh - 16px)}.min-h-0{min-height:0}.min-h-9{min-height:calc(var(--spacing) * 9)}.min-h-10{min-height:calc(var(--spacing) * 10)}.min-h-16{min-height:calc(var(--spacing) * 16)}.min-h-24{min-height:calc(var(--spacing) * 24)}.min-h-36{min-height:calc(var(--spacing) * 36)}.min-h-\[24px\]{min-height:24px}.min-h-\[44px\]{min-height:44px}.min-h-screen{min-height:100vh}.w-1\/3{width:33.3333%}.w-2{width:calc(var(--spacing) * 2)}.w-2\.5{width:calc(var(--spacing) * 2.5)}.w-3{width:calc(var(--spacing) * 3)}.w-3\.5{width:calc(var(--spacing) * 3.5)}.w-4{width:calc(var(--spacing) * 4)}.w-5{width:calc(var(--spacing) * 5)}.w-6{width:calc(var(--spacing) * 6)}.w-7{width:calc(var(--spacing) * 7)}.w-8{width:calc(var(--spacing) * 8)}.w-9{width:calc(var(--spacing) * 9)}.w-10{width:calc(var(--spacing) * 10)}.w-12{width:calc(var(--spacing) * 12)}.w-44{width:calc(var(--spacing) * 44)}.w-48{width:calc(var(--spacing) * 48)}.w-56{width:calc(var(--spacing) * 56)}.w-72{width:calc(var(--spacing) * 72)}.w-96{width:calc(var(--spacing) * 96)}.w-\[52px\]{width:52px}.w-\[138px\]{width:138px}.w-\[150px\]{width:150px}.w-\[400px\]{width:400px}.w-\[420px\]{width:420px}.w-\[450px\]{width:450px}.w-\[clamp\(560px\,85vw\,1500px\)\]{width:clamp(560px,85vw,1500px)}.w-\[min\(94vw\,560px\)\]{width:min(94vw,560px)}.w-\[min\(94vw\,960px\)\]{width:min(94vw,960px)}.w-full{width:100%}.w-max{width:max-content}.max-w-4xl{max-width:var(--container-4xl)}.max-w-5xl{max-width:var(--container-5xl)}.max-w-6xl{max-width:var(--container-6xl)}.max-w-\[calc\(100vw-16px\)\]{max-width:calc(100vw - 16px)}.max-w-\[min\(70vw\,560px\)\]{max-width:min(70vw,560px)}.max-w-\[min\(80vw\,640px\)\]{max-width:min(80vw,640px)}.max-w-full{max-width:100%}.max-w-lg{max-width:var(--container-lg)}.max-w-md{max-width:var(--container-md)}.max-w-sm{max-width:var(--container-sm)}.max-w-xs{max-width:var(--container-xs)}.min-w-0{min-width:0}.min-w-48{min-width:calc(var(--spacing) * 48)}.min-w-\[100px\]{min-width:100px}.min-w-\[220px\]{min-width:220px}.flex-1{flex:1}.flex-shrink-0,.shrink-0{flex-shrink:0}.flex-grow,.grow{flex-grow:1}.basis-64{flex-basis:calc(var(--spacing) * 64)}.basis-full{flex-basis:100%}.border-collapse{border-collapse:collapse}.-translate-x-1\/2{--tw-translate-x: -50% ;translate:var(--tw-translate-x) var(--tw-translate-y)}.-translate-y-1\/2{--tw-translate-y: -50% ;translate:var(--tw-translate-x) var(--tw-translate-y)}.rotate-45{rotate:45deg}.rotate-180{rotate:180deg}.transform{transform:var(--tw-rotate-x,) var(--tw-rotate-y,) var(--tw-rotate-z,) var(--tw-skew-x,) var(--tw-skew-y,)}.animate-pulse{animation:var(--animate-pulse)}.animate-spin{animation:var(--animate-spin)}.cursor-col-resize{cursor:col-resize}.cursor-not-allowed{cursor:not-allowed}.cursor-pointer{cursor:pointer}.touch-none{touch-action:none}.resize{resize:both}.resize\!{resize:both!important}.list-decimal{list-style-type:decimal}.list-disc{list-style-type:disc}.grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.place-items-center{place-items:center}.items-center{align-items:center}.items-start{align-items:flex-start}.justify-between{justify-content:space-between}.justify-center{justify-content:center}.justify-end{justify-content:flex-end}.gap-1{gap:var(--spacing)}.gap-1\.5{gap:calc(var(--spacing) * 1.5)}.gap-2{gap:calc(var(--spacing) * 2)}.gap-2\.5{gap:calc(var(--spacing) * 2.5)}.gap-3{gap:calc(var(--spacing) * 3)}.gap-3\.5{gap:calc(var(--spacing) * 3.5)}.gap-4{gap:calc(var(--spacing) * 4)}:where(.space-y-0\.5>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * .5) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * .5) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-1>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(var(--spacing) * var(--tw-space-y-reverse));margin-block-end:calc(var(--spacing) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-1\.5>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 1.5) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 1.5) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-2>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 2) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 2) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-3>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 3) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 3) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-4>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 4) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 4) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-6>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 6) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 6) * calc(1 - var(--tw-space-y-reverse)))}.gap-x-4{column-gap:calc(var(--spacing) * 4)}.gap-y-1\.5{row-gap:calc(var(--spacing) * 1.5)}.gap-y-2{row-gap:calc(var(--spacing) * 2)}.truncate{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.overflow-auto{overflow:auto}.overflow-hidden{overflow:hidden}.overflow-x-auto{overflow-x:auto}.overflow-y-auto{overflow-y:auto}.overscroll-contain{overscroll-behavior:contain}.rounded{border-radius:.25rem}.rounded-2xl{border-radius:var(--radius-2xl)}.rounded-full{border-radius:3.40282e38px}.rounded-lg{border-radius:var(--radius-lg)}.rounded-md{border-radius:var(--radius-md)}.rounded-xl{border-radius:var(--radius-xl)}.rounded-l-md{border-top-left-radius:var(--radius-md);border-bottom-left-radius:var(--radius-md)}.rounded-r-md{border-top-right-radius:var(--radius-md);border-bottom-right-radius:var(--radius-md)}.border{border-style:var(--tw-border-style);border-width:1px}.border-2{border-style:var(--tw-border-style);border-width:2px}.border-t{border-top-style:var(--tw-border-style);border-top-width:1px}.border-t-2{border-top-style:var(--tw-border-style);border-top-width:2px}.border-r{border-right-style:var(--tw-border-style);border-right-width:1px}.border-r-2{border-right-style:var(--tw-border-style);border-right-width:2px}.border-b{border-bottom-style:var(--tw-border-style);border-bottom-width:1px}.border-b-2{border-bottom-style:var(--tw-border-style);border-bottom-width:2px}.border-l{border-left-style:var(--tw-border-style);border-left-width:1px}.border-l-0{border-left-style:var(--tw-border-style);border-left-width:0}.border-l-2{border-left-style:var(--tw-border-style);border-left-width:2px}.border-l-4{border-left-style:var(--tw-border-style);border-left-width:4px}.border-dashed{--tw-border-style:dashed;border-style:dashed}.border-chip-amber-border{border-color:var(--chip-amber-border)}.border-chip-fuchsia-border{border-color:var(--chip-fuchsia-border)}.border-chip-indigo-border,.border-chip-indigo-border\/50{border-color:var(--chip-indigo-border)}@supports (color:color-mix(in lab,red,red)){.border-chip-indigo-border\/50{border-color:color-mix(in oklab,var(--chip-indigo-border) 50%,transparent)}}.border-chip-purple-border,.border-chip-purple-border\/50{border-color:var(--chip-purple-border)}@supports (color:color-mix(in lab,red,red)){.border-chip-purple-border\/50{border-color:color-mix(in oklab,var(--chip-purple-border) 50%,transparent)}}.border-chip-sky-border{border-color:var(--chip-sky-border)}.border-emerald-300\/50{border-color:#5ee9b580}@supports (color:color-mix(in lab,red,red)){.border-emerald-300\/50{border-color:color-mix(in oklab,var(--color-emerald-300) 50%,transparent)}}.border-emerald-500\/30{border-color:#00bb7f4d}@supports (color:color-mix(in lab,red,red)){.border-emerald-500\/30{border-color:color-mix(in oklab,var(--color-emerald-500) 30%,transparent)}}.border-frame-line{border-color:var(--app-frame-border)}.border-indigo-400{border-color:var(--color-indigo-400)}.border-indigo-400\/80{border-color:#7d87ffcc}@supports (color:color-mix(in lab,red,red)){.border-indigo-400\/80{border-color:color-mix(in oklab,var(--color-indigo-400) 80%,transparent)}}.border-indigo-600{border-color:var(--color-indigo-600)}.border-line,.border-line\/40{border-color:var(--app-border)}@supports (color:color-mix(in lab,red,red)){.border-line\/40{border-color:color-mix(in oklab,var(--app-border) 40%,transparent)}}.border-line\/60{border-color:var(--app-border)}@supports (color:color-mix(in lab,red,red)){.border-line\/60{border-color:color-mix(in oklab,var(--app-border) 60%,transparent)}}.border-slate-500\/30{border-color:#62748e4d}@supports (color:color-mix(in lab,red,red)){.border-slate-500\/30{border-color:color-mix(in oklab,var(--color-slate-500) 30%,transparent)}}.border-status-danger-border{border-color:var(--status-danger-border)}.border-status-success-border{border-color:var(--status-success-border)}.border-status-warning-border{border-color:var(--status-warning-border)}.border-transparent{border-color:#0000}.border-t-transparent{border-top-color:#0000}.border-l-transparent{border-left-color:#0000}.bg-app,.bg-app\/90{background-color:var(--app-bg)}@supports (color:color-mix(in lab,red,red)){.bg-app\/90{background-color:color-mix(in oklab,var(--app-bg) 90%,transparent)}}.bg-black{background-color:var(--color-black)}.bg-black\/20{background-color:#0003}@supports (color:color-mix(in lab,red,red)){.bg-black\/20{background-color:color-mix(in oklab,var(--color-black) 20%,transparent)}}.bg-black\/60{background-color:#0009}@supports (color:color-mix(in lab,red,red)){.bg-black\/60{background-color:color-mix(in oklab,var(--color-black) 60%,transparent)}}.bg-black\/65{background-color:#000000a6}@supports (color:color-mix(in lab,red,red)){.bg-black\/65{background-color:color-mix(in oklab,var(--color-black) 65%,transparent)}}.bg-black\/70{background-color:#000000b3}@supports (color:color-mix(in lab,red,red)){.bg-black\/70{background-color:color-mix(in oklab,var(--color-black) 70%,transparent)}}.bg-chip-amber-bg{background-color:var(--chip-amber-bg)}.bg-chip-fuchsia-bg{background-color:var(--chip-fuchsia-bg)}.bg-chip-indigo-bg,.bg-chip-indigo-bg\/20{background-color:var(--chip-indigo-bg)}@supports (color:color-mix(in lab,red,red)){.bg-chip-indigo-bg\/20{background-color:color-mix(in oklab,var(--chip-indigo-bg) 20%,transparent)}}.bg-chip-purple-bg{background-color:var(--chip-purple-bg)}.bg-chip-sky-bg{background-color:var(--chip-sky-bg)}.bg-elevated,.bg-elevated\/30{background-color:var(--app-elevated)}@supports (color:color-mix(in lab,red,red)){.bg-elevated\/30{background-color:color-mix(in oklab,var(--app-elevated) 30%,transparent)}}.bg-elevated\/50{background-color:var(--app-elevated)}@supports (color:color-mix(in lab,red,red)){.bg-elevated\/50{background-color:color-mix(in oklab,var(--app-elevated) 50%,transparent)}}.bg-elevated\/60{background-color:var(--app-elevated)}@supports (color:color-mix(in lab,red,red)){.bg-elevated\/60{background-color:color-mix(in oklab,var(--app-elevated) 60%,transparent)}}.bg-emerald-400{background-color:var(--color-emerald-400)}.bg-emerald-500{background-color:var(--color-emerald-500)}.bg-emerald-600{background-color:var(--color-emerald-600)}.bg-emerald-800\/60{background-color:#005f4699}@supports (color:color-mix(in lab,red,red)){.bg-emerald-800\/60{background-color:color-mix(in oklab,var(--color-emerald-800) 60%,transparent)}}.bg-indigo-500\/5{background-color:#625fff0d}@supports (color:color-mix(in lab,red,red)){.bg-indigo-500\/5{background-color:color-mix(in oklab,var(--color-indigo-500) 5%,transparent)}}.bg-indigo-600{background-color:var(--color-indigo-600)}.bg-ink-faint{background-color:var(--app-text-faint)}.bg-slate-600\/20{background-color:#45556c33}@supports (color:color-mix(in lab,red,red)){.bg-slate-600\/20{background-color:color-mix(in oklab,var(--color-slate-600) 20%,transparent)}}.bg-status-danger-bg,.bg-status-danger-bg\/30{background-color:var(--status-danger-bg)}@supports (color:color-mix(in lab,red,red)){.bg-status-danger-bg\/30{background-color:color-mix(in oklab,var(--status-danger-bg) 30%,transparent)}}.bg-status-danger-bg\/40{background-color:var(--status-danger-bg)}@supports (color:color-mix(in lab,red,red)){.bg-status-danger-bg\/40{background-color:color-mix(in oklab,var(--status-danger-bg) 40%,transparent)}}.bg-status-success-bg{background-color:var(--status-success-bg)}.bg-status-warning-bg{background-color:var(--status-warning-bg)}.bg-surface{background-color:var(--app-surface)}.bg-surface-glass{background-color:var(--app-glass)}.bg-surface-strong,.bg-surface-strong\/20{background-color:var(--app-glass-strong)}@supports (color:color-mix(in lab,red,red)){.bg-surface-strong\/20{background-color:color-mix(in oklab,var(--app-glass-strong) 20%,transparent)}}.bg-surface-strong\/30{background-color:var(--app-glass-strong)}@supports (color:color-mix(in lab,red,red)){.bg-surface-strong\/30{background-color:color-mix(in oklab,var(--app-glass-strong) 30%,transparent)}}.bg-surface\/50{background-color:var(--app-surface)}@supports (color:color-mix(in lab,red,red)){.bg-surface\/50{background-color:color-mix(in oklab,var(--app-surface) 50%,transparent)}}.bg-surface\/60{background-color:var(--app-surface)}@supports (color:color-mix(in lab,red,red)){.bg-surface\/60{background-color:color-mix(in oklab,var(--app-surface) 60%,transparent)}}.bg-white{background-color:var(--color-white)}.bg-white\/90{background-color:#ffffffe6}@supports (color:color-mix(in lab,red,red)){.bg-white\/90{background-color:color-mix(in oklab,var(--color-white) 90%,transparent)}}.bg-gradient-to-b{--tw-gradient-position:to bottom in oklab;background-image:linear-gradient(var(--tw-gradient-stops))}.bg-gradient-to-br{--tw-gradient-position:to bottom right in oklab;background-image:linear-gradient(var(--tw-gradient-stops))}.from-chip-indigo-bg{--tw-gradient-from:var(--chip-indigo-bg);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-emerald-400\/90{--tw-gradient-from:#00d294e6}@supports (color:color-mix(in lab,red,red)){.from-emerald-400\/90{--tw-gradient-from:color-mix(in oklab, var(--color-emerald-400) 90%, transparent)}}.from-emerald-400\/90{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-chip-purple-bg{--tw-gradient-to:var(--chip-purple-bg);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-emerald-600\/90{--tw-gradient-to:#009767e6}@supports (color:color-mix(in lab,red,red)){.to-emerald-600\/90{--tw-gradient-to:color-mix(in oklab, var(--color-emerald-600) 90%, transparent)}}.to-emerald-600\/90{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.fill-current{fill:currentColor}.object-contain{object-fit:contain}.object-cover{object-fit:cover}.p-0\.5{padding:calc(var(--spacing) * .5)}.p-1{padding:var(--spacing)}.p-1\.5{padding:calc(var(--spacing) * 1.5)}.p-2{padding:calc(var(--spacing) * 2)}.p-3{padding:calc(var(--spacing) * 3)}.p-4{padding:calc(var(--spacing) * 4)}.p-5{padding:calc(var(--spacing) * 5)}.p-6{padding:calc(var(--spacing) * 6)}.p-8{padding:calc(var(--spacing) * 8)}.px-1{padding-inline:var(--spacing)}.px-1\.5{padding-inline:calc(var(--spacing) * 1.5)}.px-2{padding-inline:calc(var(--spacing) * 2)}.px-2\.5{padding-inline:calc(var(--spacing) * 2.5)}.px-3{padding-inline:calc(var(--spacing) * 3)}.px-3\.5{padding-inline:calc(var(--spacing) * 3.5)}.px-4{padding-inline:calc(var(--spacing) * 4)}.px-5{padding-inline:calc(var(--spacing) * 5)}.px-6{padding-inline:calc(var(--spacing) * 6)}.px-8{padding-inline:calc(var(--spacing) * 8)}.py-0\.5{padding-block:calc(var(--spacing) * .5)}.py-1{padding-block:var(--spacing)}.py-1\.5{padding-block:calc(var(--spacing) * 1.5)}.py-2{padding-block:calc(var(--spacing) * 2)}.py-2\.5{padding-block:calc(var(--spacing) * 2.5)}.py-3{padding-block:calc(var(--spacing) * 3)}.py-3\.5{padding-block:calc(var(--spacing) * 3.5)}.py-4{padding-block:calc(var(--spacing) * 4)}.py-6{padding-block:calc(var(--spacing) * 6)}.py-8{padding-block:calc(var(--spacing) * 8)}.py-px{padding-block:1px}.pt-2{padding-top:calc(var(--spacing) * 2)}.pt-3{padding-top:calc(var(--spacing) * 3)}.pt-4{padding-top:calc(var(--spacing) * 4)}.pr-1{padding-right:var(--spacing)}.pr-2\.5{padding-right:calc(var(--spacing) * 2.5)}.pr-3{padding-right:calc(var(--spacing) * 3)}.pr-8{padding-right:calc(var(--spacing) * 8)}.pr-10{padding-right:calc(var(--spacing) * 10)}.pb-3{padding-bottom:calc(var(--spacing) * 3)}.pb-4{padding-bottom:calc(var(--spacing) * 4)}.pl-3{padding-left:calc(var(--spacing) * 3)}.pl-5{padding-left:calc(var(--spacing) * 5)}.pl-8{padding-left:calc(var(--spacing) * 8)}.pl-9{padding-left:calc(var(--spacing) * 9)}.text-center{text-align:center}.text-left{text-align:left}.align-\[1px\]{vertical-align:1px}.align-top{vertical-align:top}.font-mono{font-family:var(--font-mono)}.font-sans{font-family:var(--font-sans)}.text-base{font-size:var(--text-base);line-height:var(--tw-leading,var(--text-base--line-height))}.text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.text-xs{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.text-\[10px\]{font-size:10px}.text-\[11px\]{font-size:11px}.leading-5{--tw-leading:calc(var(--spacing) * 5);line-height:calc(var(--spacing) * 5)}.leading-none{--tw-leading:1;line-height:1}.leading-relaxed{--tw-leading:var(--leading-relaxed);line-height:var(--leading-relaxed)}.font-bold{--tw-font-weight:var(--font-weight-bold);font-weight:var(--font-weight-bold)}.font-medium{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.font-normal{--tw-font-weight:var(--font-weight-normal);font-weight:var(--font-weight-normal)}.font-semibold{--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.tracking-tight{--tw-tracking:var(--tracking-tight);letter-spacing:var(--tracking-tight)}.tracking-wide{--tw-tracking:var(--tracking-wide);letter-spacing:var(--tracking-wide)}.tracking-wider{--tw-tracking:var(--tracking-wider);letter-spacing:var(--tracking-wider)}.break-words{overflow-wrap:break-word}.break-all{word-break:break-all}.whitespace-nowrap{white-space:nowrap}.whitespace-pre-line{white-space:pre-line}.whitespace-pre-wrap{white-space:pre-wrap}.text-chip-amber-text{color:var(--chip-amber-text)}.text-chip-fuchsia-text{color:var(--chip-fuchsia-text)}.text-chip-indigo-text{color:var(--chip-indigo-text)}.text-chip-purple-text{color:var(--chip-purple-text)}.text-chip-sky-text{color:var(--chip-sky-text)}.text-emerald-200{color:var(--color-emerald-200)}.text-ink{color:var(--app-text-primary)}.text-ink-faint{color:var(--app-text-faint)}.text-ink-muted,.text-ink-muted\/50{color:var(--app-text-muted)}@supports (color:color-mix(in lab,red,red)){.text-ink-muted\/50{color:color-mix(in oklab,var(--app-text-muted) 50%,transparent)}}.text-ink-secondary{color:var(--app-text-secondary)}.text-ink\/70{color:var(--app-text-primary)}@supports (color:color-mix(in lab,red,red)){.text-ink\/70{color:color-mix(in oklab,var(--app-text-primary) 70%,transparent)}}.text-slate-300{color:var(--color-slate-300)}.text-slate-400{color:var(--color-slate-400)}.text-slate-900{color:var(--color-slate-900)}.text-status-danger-text,.text-status-danger-text\/60{color:var(--status-danger-text)}@supports (color:color-mix(in lab,red,red)){.text-status-danger-text\/60{color:color-mix(in oklab,var(--status-danger-text) 60%,transparent)}}.text-status-danger-text\/70{color:var(--status-danger-text)}@supports (color:color-mix(in lab,red,red)){.text-status-danger-text\/70{color:color-mix(in oklab,var(--status-danger-text) 70%,transparent)}}.text-status-danger-text\/80{color:var(--status-danger-text)}@supports (color:color-mix(in lab,red,red)){.text-status-danger-text\/80{color:color-mix(in oklab,var(--status-danger-text) 80%,transparent)}}.text-status-danger-text\/90{color:var(--status-danger-text)}@supports (color:color-mix(in lab,red,red)){.text-status-danger-text\/90{color:color-mix(in oklab,var(--status-danger-text) 90%,transparent)}}.text-status-success-text{color:var(--status-success-text)}.text-status-warning-text{color:var(--status-warning-text)}.text-white{color:var(--color-white)}.lowercase{text-transform:lowercase}.uppercase{text-transform:uppercase}.italic{font-style:italic}.not-italic{font-style:normal}.tabular-nums{--tw-numeric-spacing:tabular-nums;font-variant-numeric:var(--tw-ordinal,) var(--tw-slashed-zero,) var(--tw-numeric-figure,) var(--tw-numeric-spacing,) var(--tw-numeric-fraction,)}.line-through{text-decoration-line:line-through}.underline{text-decoration-line:underline}.underline-offset-2{text-underline-offset:2px}.antialiased{-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.placeholder-ink-faint::placeholder{color:var(--app-text-faint)}.opacity-0{opacity:0}.opacity-40{opacity:.4}.opacity-90{opacity:.9}.opacity-100{opacity:1}.shadow{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a), 0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-2xl{--tw-shadow:0 25px 50px -12px var(--tw-shadow-color,#00000040);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-\[0_0_0_9999px_rgba\(0\,0\,0\,0\.45\)\]{--tw-shadow:0 0 0 9999px var(--tw-shadow-color,#00000073);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-\[0_2px_6px_rgb\(0_0_0\/0\.35\)\]{--tw-shadow:0 2px 6px var(--tw-shadow-color,#00000059);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-\[inset_0_1px_0_rgb\(255_255_255\/0\.12\)\]{--tw-shadow:inset 0 1px 0 var(--tw-shadow-color,#ffffff1f);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-\[inset_0_1px_0_rgb\(255_255_255\/0\.35\)\,0_8px_24px_-6px_rgb\(16_185_129\/0\.55\)\]{--tw-shadow:inset 0 1px 0 var(--tw-shadow-color,#ffffff59), 0 8px 24px -6px var(--tw-shadow-color,#10b9818c);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-lg{--tw-shadow:0 10px 15px -3px var(--tw-shadow-color,#0000001a), 0 4px 6px -4px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-md{--tw-shadow:0 4px 6px -1px var(--tw-shadow-color,#0000001a), 0 2px 4px -2px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-sm{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a), 0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-xl{--tw-shadow:0 20px 25px -5px var(--tw-shadow-color,#0000001a), 0 8px 10px -6px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-xs{--tw-shadow:0 1px 2px 0 var(--tw-shadow-color,#0000000d);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.ring-1{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.ring-2{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.ring-app{--tw-ring-color:var(--app-bg)}.ring-chip-indigo-border\/40{--tw-ring-color:var(--chip-indigo-border)}@supports (color:color-mix(in lab,red,red)){.ring-chip-indigo-border\/40{--tw-ring-color:color-mix(in oklab, var(--chip-indigo-border) 40%, transparent)}}.outline{outline-style:var(--tw-outline-style);outline-width:1px}.blur{--tw-blur:blur(8px);filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.filter{filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.filter\!{filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)!important}.backdrop-blur-md{--tw-backdrop-blur:blur(var(--blur-md));-webkit-backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,)}.backdrop-blur-sm{--tw-backdrop-blur:blur(var(--blur-sm));-webkit-backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,)}.backdrop-blur-xl{--tw-backdrop-blur:blur(var(--blur-xl));-webkit-backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,)}.backdrop-blur-xs{--tw-backdrop-blur:blur(var(--blur-xs));-webkit-backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,)}.transition{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to,opacity,box-shadow,transform,translate,scale,rotate,filter,-webkit-backdrop-filter,backdrop-filter,display,content-visibility,overlay,pointer-events;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-\[filter\,box-shadow\,transform\]{transition-property:filter,box-shadow,transform;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-all{transition-property:all;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-colors{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-opacity{transition-property:opacity;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-transform{transition-property:transform,translate,scale,rotate;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.duration-200{--tw-duration:.2s;transition-duration:.2s}.outline-none{--tw-outline-style:none;outline-style:none}.select-none{-webkit-user-select:none;user-select:none}@media(hover:hover){.group-hover\:text-white:is(:where(.group):hover *){color:var(--color-white)}.group-hover\:opacity-40:is(:where(.group):hover *){opacity:.4}.group-hover\:opacity-100:is(:where(.group):hover *){opacity:1}}.selection\:bg-indigo-500 ::selection{background-color:var(--color-indigo-500)}.selection\:bg-indigo-500::selection{background-color:var(--color-indigo-500)}.selection\:text-white ::selection{color:var(--color-white)}.selection\:text-white::selection{color:var(--color-white)}.placeholder\:text-ink-faint::placeholder{color:var(--app-text-faint)}.first\:mt-0:first-child{margin-top:0}.last\:mb-0:last-child{margin-bottom:0}@media(hover:hover){.hover\:-translate-y-px:hover{--tw-translate-y:-1px;translate:var(--tw-translate-x) var(--tw-translate-y)}.hover\:border-chip-indigo-border:hover{border-color:var(--chip-indigo-border)}.hover\:border-indigo-400:hover{border-color:var(--color-indigo-400)}.hover\:border-indigo-500:hover{border-color:var(--color-indigo-500)}.hover\:border-status-warning-border:hover{border-color:var(--status-warning-border)}.hover\:bg-chip-indigo-bg\/40:hover{background-color:var(--chip-indigo-bg)}@supports (color:color-mix(in lab,red,red)){.hover\:bg-chip-indigo-bg\/40:hover{background-color:color-mix(in oklab,var(--chip-indigo-bg) 40%,transparent)}}.hover\:bg-elevated:hover,.hover\:bg-elevated\/50:hover{background-color:var(--app-elevated)}@supports (color:color-mix(in lab,red,red)){.hover\:bg-elevated\/50:hover{background-color:color-mix(in oklab,var(--app-elevated) 50%,transparent)}}.hover\:bg-elevated\/60:hover{background-color:var(--app-elevated)}@supports (color:color-mix(in lab,red,red)){.hover\:bg-elevated\/60:hover{background-color:color-mix(in oklab,var(--app-elevated) 60%,transparent)}}.hover\:bg-elevated\/70:hover{background-color:var(--app-elevated)}@supports (color:color-mix(in lab,red,red)){.hover\:bg-elevated\/70:hover{background-color:color-mix(in oklab,var(--app-elevated) 70%,transparent)}}.hover\:bg-elevated\/80:hover{background-color:var(--app-elevated)}@supports (color:color-mix(in lab,red,red)){.hover\:bg-elevated\/80:hover{background-color:color-mix(in oklab,var(--app-elevated) 80%,transparent)}}.hover\:bg-emerald-500:hover{background-color:var(--color-emerald-500)}.hover\:bg-hover-surface:hover{background-color:var(--app-hover)}.hover\:bg-indigo-500:hover{background-color:var(--color-indigo-500)}.hover\:bg-indigo-600:hover{background-color:var(--color-indigo-600)}.hover\:bg-status-danger-bg:hover,.hover\:bg-status-danger-bg\/60:hover{background-color:var(--status-danger-bg)}@supports (color:color-mix(in lab,red,red)){.hover\:bg-status-danger-bg\/60:hover{background-color:color-mix(in oklab,var(--status-danger-bg) 60%,transparent)}}.hover\:bg-status-warning-bg:hover,.hover\:bg-status-warning-bg\/40:hover{background-color:var(--status-warning-bg)}@supports (color:color-mix(in lab,red,red)){.hover\:bg-status-warning-bg\/40:hover{background-color:color-mix(in oklab,var(--status-warning-bg) 40%,transparent)}}.hover\:bg-surface:hover{background-color:var(--app-surface)}.hover\:bg-surface-strong:hover{background-color:var(--app-glass-strong)}.hover\:bg-white:hover{background-color:var(--color-white)}.hover\:text-chip-indigo-text:hover{color:var(--chip-indigo-text)}.hover\:text-ink:hover{color:var(--app-text-primary)}.hover\:text-status-danger-text:hover{color:var(--status-danger-text)}.hover\:text-status-warning-text:hover{color:var(--status-warning-text)}.hover\:text-white:hover{color:var(--color-white)}.hover\:underline:hover{text-decoration-line:underline}.hover\:opacity-40:hover{opacity:.4}.hover\:shadow-\[inset_0_1px_0_rgb\(255_255_255\/0\.35\)\,0_12px_30px_-6px_rgb\(16_185_129\/0\.7\)\]:hover{--tw-shadow:inset 0 1px 0 var(--tw-shadow-color,#ffffff59), 0 12px 30px -6px var(--tw-shadow-color,#10b981b3);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.hover\:brightness-95:hover{--tw-brightness:brightness(95%);filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.hover\:brightness-110:hover{--tw-brightness:brightness(110%);filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}}.focus\:border-indigo-500:focus{border-color:var(--color-indigo-500)}.focus\:ring-2:focus{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.focus\:ring-indigo-500:focus{--tw-ring-color:var(--color-indigo-500)}.focus\:outline-none:focus{--tw-outline-style:none;outline-style:none}.focus-visible\:z-10:focus-visible{z-index:10}.focus-visible\:border-indigo-400:focus-visible{border-color:var(--color-indigo-400)}.focus-visible\:border-indigo-500:focus-visible{border-color:var(--color-indigo-500)}.focus-visible\:ring-2:focus-visible{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.focus-visible\:ring-emerald-400:focus-visible{--tw-ring-color:var(--color-emerald-400)}.focus-visible\:ring-indigo-400:focus-visible{--tw-ring-color:var(--color-indigo-400)}.focus-visible\:ring-indigo-500:focus-visible{--tw-ring-color:var(--color-indigo-500)}.focus-visible\:ring-indigo-500\/30:focus-visible{--tw-ring-color:#625fff4d}@supports (color:color-mix(in lab,red,red)){.focus-visible\:ring-indigo-500\/30:focus-visible{--tw-ring-color:color-mix(in oklab, var(--color-indigo-500) 30%, transparent)}}.focus-visible\:ring-status-danger-border:focus-visible{--tw-ring-color:var(--status-danger-border)}.focus-visible\:ring-offset-1:focus-visible{--tw-ring-offset-width:1px;--tw-ring-offset-shadow:var(--tw-ring-inset,) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color)}.focus-visible\:ring-offset-app:focus-visible{--tw-ring-offset-color:var(--app-bg)}.focus-visible\:outline:focus-visible{outline-style:var(--tw-outline-style);outline-width:1px}.focus-visible\:outline-2:focus-visible{outline-style:var(--tw-outline-style);outline-width:2px}.focus-visible\:outline-offset-\[-2px\]:focus-visible{outline-offset:-2px}.focus-visible\:outline-indigo-500:focus-visible{outline-color:var(--color-indigo-500)}.focus-visible\:outline-none:focus-visible{--tw-outline-style:none;outline-style:none}.focus-visible\:ring-inset:focus-visible{--tw-ring-inset:inset}.active\:scale-95:active{--tw-scale-x:95%;--tw-scale-y:95%;--tw-scale-z:95%;scale:var(--tw-scale-x) var(--tw-scale-y)}.disabled\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\:opacity-40:disabled{opacity:.4}.disabled\:opacity-50:disabled{opacity:.5}@media(hover:hover){.disabled\:hover\:translate-y-0:disabled:hover{--tw-translate-y:0px;translate:var(--tw-translate-x) var(--tw-translate-y)}.disabled\:hover\:text-ink-muted:disabled:hover{color:var(--app-text-muted)}.disabled\:hover\:shadow-\[inset_0_1px_0_rgb\(255_255_255\/0\.35\)\,0_8px_24px_-6px_rgb\(16_185_129\/0\.55\)\]:disabled:hover{--tw-shadow:inset 0 1px 0 var(--tw-shadow-color,#ffffff59), 0 8px 24px -6px var(--tw-shadow-color,#10b9818c);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.disabled\:hover\:brightness-100:disabled:hover{--tw-brightness:brightness(100%);filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}}@media(prefers-reduced-motion:reduce){.motion-reduce\:animate-none{animation:none}}@media(min-width:40rem){.sm\:inline{display:inline}.sm\:basis-auto{flex-basis:auto}.sm\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.sm\:flex-row{flex-direction:row}.sm\:items-center{align-items:center}.sm\:justify-between{justify-content:space-between}.sm\:rounded-2xl{border-radius:var(--radius-2xl)}.sm\:rounded-xl{border-radius:var(--radius-xl)}.sm\:p-1\.5{padding:calc(var(--spacing) * 1.5)}.sm\:p-6{padding:calc(var(--spacing) * 6)}.sm\:px-3{padding-inline:calc(var(--spacing) * 3)}.sm\:px-5{padding-inline:calc(var(--spacing) * 5)}.sm\:px-6{padding-inline:calc(var(--spacing) * 6)}.sm\:py-3{padding-block:calc(var(--spacing) * 3)}}@media(min-width:64rem){.lg\:flex{display:flex}}.\[\&_code\]\:bg-transparent code{background-color:#0000}.\[\&_code\]\:px-0 code{padding-inline:0}.\[\&_code\]\:py-0 code{padding-block:0}.\[\&_code\]\:text-inherit code{color:inherit}.animate-modal-in{animation:.15s cubic-bezier(.2,.8,.2,1) modal-in}.animate-overlay-in{animation:.15s ease-out overlay-in}.animate-toast-in{animation:.12s ease-out toast-in}}:where(button,[role=button],input,select,textarea,a,summary,video[tabindex],[tabindex]):focus-visible{outline:2px solid var(--color-indigo-500,#6366f1);outline-offset:2px}:root{color-scheme:light dark;--z-combobox-list:60;--z-syntax-helper:65;--z-context-menu:70;--z-modal:80;--z-drop-overlay:85;--z-toast:90;--z-tooltip:100}:root,[data-theme=dark]{--app-bg:#020617;--app-surface:#0f172a;--app-elevated:#1e293b;--app-hover:#334155;--app-border:#334155;--app-frame-border:#94a3b84d;--app-text-primary:#f8fafc;--app-text-secondary:#cbd5e1;--app-text-muted:#94a3b8;--app-text-faint:#94a3b8;--app-glass:#0f172a99;--app-glass-strong:#020617e6;--app-glass-panel:#0f172ac7;--app-glass-panel-strong:#020617e0;--app-glass-highlight:#ffffff17;--app-panel-shadow:0 24px 60px -12px #0206178c;color-scheme:dark;--chip-indigo-bg:#6366f140;--chip-indigo-border:#818cf880;--chip-indigo-text:#c7d2fe;--chip-purple-bg:#a855f740;--chip-purple-border:#c084fc80;--chip-purple-text:#f3e8ff;--chip-fuchsia-bg:#c026d340;--chip-fuchsia-border:#e879f980;--chip-fuchsia-text:#f5d0fe;--chip-sky-bg:#0ea5e940;--chip-sky-border:#38bdf880;--chip-sky-text:#bae6fd;--chip-amber-bg:#f59e0b40;--chip-amber-border:#fbbf2480;--chip-amber-text:#fde68a;--status-success-bg:#10b98140;--status-success-border:#34d39980;--status-success-text:#a7f3d0;--status-warning-bg:#f59e0b40;--status-warning-border:#fbbf2480;--status-warning-text:#fde68a;--status-danger-bg:#f43f5e40;--status-danger-border:#fb718580;--status-danger-text:#fecdd3}[data-theme=light]{--chip-indigo-bg:#e0e7ff;--chip-indigo-border:#a5b4fc;--chip-indigo-text:#3730a3;--chip-purple-bg:#f3e8ff;--chip-purple-border:#d8b4fe;--chip-purple-text:#6b21a8;--chip-fuchsia-bg:#fae8ff;--chip-fuchsia-border:#f0abfc;--chip-fuchsia-text:#86198f;--chip-sky-bg:#e0f2fe;--chip-sky-border:#7dd3fc;--chip-sky-text:#0369a1;--chip-amber-bg:#fef3c7;--chip-amber-border:#fcd34d;--chip-amber-text:#92400e;--status-success-bg:#d1fae5;--status-success-border:#6ee7b7;--status-success-text:#065f46;--status-warning-bg:#fef3c7;--status-warning-border:#fcd34d;--status-warning-text:#92400e;--status-danger-bg:#ffe4e6;--status-danger-border:#fda4af;--status-danger-text:#9f1239;--app-bg:#f8fafc;--app-surface:#fff;--app-elevated:#f1f5f9;--app-hover:#e2e8f0;--app-border:#cbd5e1;--app-frame-border:#0f172a29;--app-text-primary:#0f172a;--app-text-secondary:#334155;--app-text-muted:#475569;--app-text-faint:#475569;--app-glass:#ffffffb3;--app-glass-strong:#f8fafcf2;--app-glass-panel:#fffc;--app-glass-panel-strong:#f8fafceb;--app-glass-highlight:#ffffffe6;--app-panel-shadow:0 24px 60px -18px #0f172a47;color-scheme:light}body{background-color:var(--app-bg);min-height:100vh;color:var(--app-text-primary);margin:0;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica,Arial,sans-serif;transition:background-color .2s,color .2s}@media(prefers-reduced-motion:reduce){*,:before,:after{scroll-behavior:auto!important;transition-duration:.01ms!important;animation-duration:.01ms!important;animation-iteration-count:1!important}}@keyframes modal-in{0%{opacity:0;transform:translateY(4px)scale(.995)}to{opacity:1;transform:none}}@keyframes overlay-in{0%{opacity:0}to{opacity:1}}@keyframes toast-in{0%{opacity:0;translate:-50% calc(6px - 50%)}to{opacity:1;translate:-50% -50%}}*{scrollbar-color:var(--app-border) transparent;scrollbar-width:thin}::-webkit-scrollbar{width:10px;height:10px}::-webkit-scrollbar-track{background:0 0}::-webkit-scrollbar-thumb{background-color:var(--app-border);background-clip:content-box;border:2px solid #0000;border-radius:9999px}::-webkit-scrollbar-thumb:hover{background-color:var(--app-text-faint)}@property --tw-translate-x{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-y{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-z{syntax:"*";inherits:false;initial-value:0}@property --tw-rotate-x{syntax:"*";inherits:false}@property --tw-rotate-y{syntax:"*";inherits:false}@property --tw-rotate-z{syntax:"*";inherits:false}@property --tw-skew-x{syntax:"*";inherits:false}@property --tw-skew-y{syntax:"*";inherits:false}@property --tw-space-y-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-gradient-position{syntax:"*";inherits:false}@property --tw-gradient-from{syntax:"";inherits:false;initial-value:#0000}@property --tw-gradient-via{syntax:"";inherits:false;initial-value:#0000}@property --tw-gradient-to{syntax:"";inherits:false;initial-value:#0000}@property --tw-gradient-stops{syntax:"*";inherits:false}@property --tw-gradient-via-stops{syntax:"*";inherits:false}@property --tw-gradient-from-position{syntax:"";inherits:false;initial-value:0%}@property --tw-gradient-via-position{syntax:"";inherits:false;initial-value:50%}@property --tw-gradient-to-position{syntax:"";inherits:false;initial-value:100%}@property --tw-leading{syntax:"*";inherits:false}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-tracking{syntax:"*";inherits:false}@property --tw-ordinal{syntax:"*";inherits:false}@property --tw-slashed-zero{syntax:"*";inherits:false}@property --tw-numeric-figure{syntax:"*";inherits:false}@property --tw-numeric-spacing{syntax:"*";inherits:false}@property --tw-numeric-fraction{syntax:"*";inherits:false}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-outline-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-blur{syntax:"*";inherits:false}@property --tw-brightness{syntax:"*";inherits:false}@property --tw-contrast{syntax:"*";inherits:false}@property --tw-grayscale{syntax:"*";inherits:false}@property --tw-hue-rotate{syntax:"*";inherits:false}@property --tw-invert{syntax:"*";inherits:false}@property --tw-opacity{syntax:"*";inherits:false}@property --tw-saturate{syntax:"*";inherits:false}@property --tw-sepia{syntax:"*";inherits:false}@property --tw-drop-shadow{syntax:"*";inherits:false}@property --tw-drop-shadow-color{syntax:"*";inherits:false}@property --tw-drop-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-drop-shadow-size{syntax:"*";inherits:false}@property --tw-backdrop-blur{syntax:"*";inherits:false}@property --tw-backdrop-brightness{syntax:"*";inherits:false}@property --tw-backdrop-contrast{syntax:"*";inherits:false}@property --tw-backdrop-grayscale{syntax:"*";inherits:false}@property --tw-backdrop-hue-rotate{syntax:"*";inherits:false}@property --tw-backdrop-invert{syntax:"*";inherits:false}@property --tw-backdrop-opacity{syntax:"*";inherits:false}@property --tw-backdrop-saturate{syntax:"*";inherits:false}@property --tw-backdrop-sepia{syntax:"*";inherits:false}@property --tw-duration{syntax:"*";inherits:false}@property --tw-scale-x{syntax:"*";inherits:false;initial-value:1}@property --tw-scale-y{syntax:"*";inherits:false;initial-value:1}@property --tw-scale-z{syntax:"*";inherits:false;initial-value:1}@keyframes spin{to{transform:rotate(360deg)}}@keyframes pulse{50%{opacity:.5}} diff --git a/src/profiles/web/dist/index.html b/src/profiles/web/dist/index.html index c6518bc..84c9d20 100644 --- a/src/profiles/web/dist/index.html +++ b/src/profiles/web/dist/index.html @@ -1,14 +1,14 @@ - - - - - - ProFiles - - - - - -
- - + + + + + + ProFiles + + + + + +
+ + diff --git a/src/profiles/web/dist/sw.js b/src/profiles/web/dist/sw.js index 91405fe..4e89567 100644 --- a/src/profiles/web/dist/sw.js +++ b/src/profiles/web/dist/sw.js @@ -1 +1 @@ -if(!self.define){let e,s={};const i=(i,n)=>(i=new URL(i+".js",n).href,s[i]||new Promise(s=>{if("document"in self){const e=document.createElement("script");e.src=i,e.onload=s,document.head.appendChild(e)}else e=i,importScripts(i),s()}).then(()=>{let e=s[i];if(!e)throw new Error(`Module ${i} didn’t register its module`);return e}));self.define=(n,r)=>{const t=e||("document"in self?document.currentScript.src:"")||location.href;if(s[t])return;let o={};const l=e=>i(e,t),c={module:{uri:t},exports:o,require:l};s[t]=Promise.all(n.map(e=>c[e]||l(e))).then(e=>(r(...e),o))}}define(["./workbox-9c191d2f"],function(e){"use strict";self.skipWaiting(),e.clientsClaim(),e.precacheAndRoute([{url:"registerSW.js",revision:"1872c500de691dce40960bb85481de07"},{url:"index.html",revision:"100ff03048564fa9336a4cae83cc2cb1"},{url:"assets/index-DwqUySVf.css",revision:null},{url:"assets/index-D7fUv0zM.js",revision:null},{url:"manifest.webmanifest",revision:"5a42ebe8b55b07b5831cbbddda834829"}],{}),e.cleanupOutdatedCaches(),e.registerRoute(new e.NavigationRoute(e.createHandlerBoundToURL("index.html")))}); +if(!self.define){let e,s={};const i=(i,n)=>(i=new URL(i+".js",n).href,s[i]||new Promise(s=>{if("document"in self){const e=document.createElement("script");e.src=i,e.onload=s,document.head.appendChild(e)}else e=i,importScripts(i),s()}).then(()=>{let e=s[i];if(!e)throw new Error(`Module ${i} didn’t register its module`);return e}));self.define=(n,r)=>{const t=e||("document"in self?document.currentScript.src:"")||location.href;if(s[t])return;let o={};const d=e=>i(e,t),l={module:{uri:t},exports:o,require:d};s[t]=Promise.all(n.map(e=>l[e]||d(e))).then(e=>(r(...e),o))}}define(["./workbox-9c191d2f"],function(e){"use strict";self.skipWaiting(),e.clientsClaim(),e.precacheAndRoute([{url:"registerSW.js",revision:"1872c500de691dce40960bb85481de07"},{url:"index.html",revision:"513cdf30c92d1a263530c9be06c2603f"},{url:"assets/index-D1PFxxdY.css",revision:null},{url:"assets/index-CVDj4KUe.js",revision:null},{url:"manifest.webmanifest",revision:"5a42ebe8b55b07b5831cbbddda834829"}],{}),e.cleanupOutdatedCaches(),e.registerRoute(new e.NavigationRoute(e.createHandlerBoundToURL("index.html")))}); diff --git a/src/profiles/web/src/App.configEditor.test.tsx b/src/profiles/web/src/App.configEditor.test.tsx index fdd5da4..949f1ef 100644 --- a/src/profiles/web/src/App.configEditor.test.tsx +++ b/src/profiles/web/src/App.configEditor.test.tsx @@ -17,6 +17,7 @@ import { EditorView } from "codemirror"; */ import App from "./App"; import { + browseForConfigFiles, executeScan, fetchConfig, fetchConfigContent, @@ -24,9 +25,10 @@ import { fetchScanResults, fetchSystemInfo, loadConfigContent, + loadConfigFile, openConfigFile, } from "./api/client"; -import type { AppConfigData, ConfigContentData, ScanResultsResponse, SystemInfo } from "./api/types"; +import type { AppConfigData, BrowseResult, ConfigContentData, ScanResultsResponse, SystemInfo } from "./api/types"; vi.mock("./api/client", async (importOriginal) => ({ ...(await importOriginal>()), @@ -38,6 +40,8 @@ vi.mock("./api/client", async (importOriginal) => ({ fetchConfigContent: vi.fn(), loadConfigContent: vi.fn(), openConfigFile: vi.fn(), + browseForConfigFiles: vi.fn(), + loadConfigFile: vi.fn(), })); // `__APP_VERSION__` is injected by vite.config's `define` at build time; @@ -53,6 +57,18 @@ const executeScanSpy = vi.mocked(executeScan); const fetchContentSpy = vi.mocked(fetchConfigContent); const loadContentSpy = vi.mocked(loadConfigContent); const openInOSSpy = vi.mocked(openConfigFile); +const browseSpy = vi.mocked(browseForConfigFiles); +const loadFileSpy = vi.mocked(loadConfigFile); + +/** Listing served by /api/fs/browse (include_hidden) inside the config picker. */ +function makeBrowseResult(overrides: Partial = {}): BrowseResult { + return { + current_path: "C:/configs", + parent_path: "C:/", + items: [], + ...overrides, + }; +} // jsdom gaps (same treatment as ConfigEditorModal.test.tsx): // - CodeMirror's measurement code calls Range geometry APIs jsdom lacks. @@ -221,4 +237,47 @@ describe("App config editor integration", () => { }); expect(openInOSSpy).not.toHaveBeenCalled(); }); + + it("test_editor_load_config_opens_picker_above_editor_and_pick_reloads_content", async () => { + const user = userEvent.setup(); + render(); + + await waitFor(() => expect(executeScanSpy).toHaveBeenCalledTimes(1)); + + // Open the in-app editor first. + await user.click(screen.getByRole("button", { name: /^config$/i })); + const editor = await screen.findByRole("dialog", { name: /configuration editor/i }); + await waitFor(() => expect(fetchContentSpy).toHaveBeenCalledTimes(1)); + await waitFor(() => expect(editor.querySelector(".cm-editor")).toBeTruthy()); + + // "Load config file…" raises the picker from INSIDE the editor (issue + // #101); the editor stays mounted underneath. + browseSpy.mockResolvedValue( + makeBrowseResult({ items: [{ name: "other.profiles", path: "C:/configs/other.profiles", is_dir: false, is_config: true }] }), + ); + loadFileSpy.mockResolvedValue( + makeAppConfig({ config_path: "C:/configs/other.profiles", title: "other" }), + ); + // After the pick, the editor's reload fetch serves the OTHER file. + fetchContentSpy.mockResolvedValueOnce( + makeContent({ filename: "other.profiles", content: 'release: "2.0"\nsearch_dir: "E:/other"\n', config_path: "C:/configs/other.profiles" }), + ); + await user.click(within(editor).getByRole("button", { name: /load config file/i })); + + const picker = await screen.findByRole("dialog", { name: /load configuration/i }); + // The picker must stack ABOVE the editor: same explicit z-scale, so the + // DOM order decides (later sibling paints on top). + expect(editor.compareDocumentPosition(picker as Node) & Node.DOCUMENT_POSITION_FOLLOWING).toBeTruthy(); + + // Pick the other config and confirm: onLoaded fires, the picker closes, + // and the editor reloads its content for the new file. + await user.click(await screen.findByRole("button", { name: /other\.profiles/i })); + await user.click(screen.getByRole("button", { name: /^load configuration$/i })); + await waitFor(() => expect(fetchContentSpy).toHaveBeenCalledTimes(2)); + // The editor swapped to the freshly served file (header + footer both + // carry the name — check the header). + await waitFor(() => + expect(within(editor).getByTestId("editor-header").textContent).toContain("other.profiles"), + ); + }); }); diff --git a/src/profiles/web/src/App.tsx b/src/profiles/web/src/App.tsx index 9ee8b47..a62a975 100644 --- a/src/profiles/web/src/App.tsx +++ b/src/profiles/web/src/App.tsx @@ -104,6 +104,13 @@ export default function App() { // "Config" button. The old OS-launch behavior moved into the editor's // header ("Open in OS"). const [showConfigEditor, setShowConfigEditor] = useState(false); + /** + * Bumped when the config picker loads a different .profiles file (issue + * #101): an editor left open underneath re-runs its load-on-open fetch + * so it swaps to the freshly picked content. Apply/Save do NOT bump it — + * they already drive the editor through onApplied. + */ + const [editorReloadKey, setEditorReloadKey] = useState(0); const [showPropertiesModal, setShowPropertiesModal] = useState(false); // File awaiting delete confirmation (in-app dialog — window.confirm is a // no-op inside the desktop webviews, issue #31). @@ -1500,7 +1507,7 @@ export default function App() { recursive={recursive} onDisableRecursive={handleDisableRecursive} onOpenDirectory={handleOpenActiveDirectory} - onOpenConfig={() => setShowConfigPicker(true)} + onLoadConfig={() => setShowConfigPicker(true)} filterText={filterText} onClearFilter={handleClearFilter} columnHeaders={config?.column_headers || []} @@ -1557,35 +1564,45 @@ export default function App() { // this button used to perform now lives in the editor's header // ("Open in OS"); the modal's onApplied drives handleConfigLoaded, // the same refresh path as LoadConfigModal and the drag/drop trial. + // Config LOADING no longer lives here (issue #101): the editor's + // "Load config file…" raises the picker from inside the editor. onOpenConfig={() => setShowConfigEditor(true)} - onLoadConfig={() => setShowConfigPicker(true)} onShowShortcuts={() => setShowShortcuts(true)} onReloadConfig={handleReloadConfig} onExport={handleExport} exportDisabled={files.length === 0 || scanning} language={language} onLanguageChange={setLanguage} - activeConfigName={config?.config_path ? config.config_path.split(/[\\/]/).pop() || config.config_path : undefined} lanEnabled={systemInfo?.lan_enabled ?? null} onToggleLan={toggleLan} /> - {/* Config Picker Modal */} - setShowConfigPicker(false)} - onLoaded={handleConfigLoaded} - /> - {/* YAML Configuration Editor (issue #95): Apply/Save/Save As hand the - fresh AppConfigData to the shared handleConfigLoaded refresh path. */} + fresh AppConfigData to the shared handleConfigLoaded refresh path. + Rendered BEFORE the picker so the picker — raised from inside the + editor via onLoadConfig (issue #101) — paints on top (same z-scale + token; DOM order decides). */} setShowConfigEditor(false)} onApplied={handleConfigLoaded} + onLoadConfig={() => setShowConfigPicker(true)} + reloadKey={editorReloadKey} + /> + + {/* Config Picker Modal. onLoaded ALSO bumps the editor's reload key + so an editor left open underneath re-fetches the freshly picked + file instead of keeping stale text (issue #101). */} + setShowConfigPicker(false)} + onLoaded={(cfg) => { + void handleConfigLoaded(cfg); + setEditorReloadKey((key) => key + 1); + }} /> {/* Dropped configuration files (session-only trial) */} diff --git a/src/profiles/web/src/components/ConfigEditorModal.test.tsx b/src/profiles/web/src/components/ConfigEditorModal.test.tsx index 2208a86..bb70eb4 100644 --- a/src/profiles/web/src/components/ConfigEditorModal.test.tsx +++ b/src/profiles/web/src/components/ConfigEditorModal.test.tsx @@ -2,6 +2,8 @@ import { afterEach, beforeEach, describe, expect, it, vi } from "vitest"; import { act, cleanup, render, screen, waitFor, within } from "@testing-library/react"; import userEvent from "@testing-library/user-event"; +import { readFileSync } from "node:fs"; +import { join } from "node:path"; import { EditorView } from "codemirror"; import { ConfigEditorModal } from "./ConfigEditorModal"; import { @@ -93,17 +95,33 @@ function makeBrowseResult(overrides: Partial = {}): BrowseResult { }; } -function renderModal(overrides: { open?: boolean } = {}) { +function renderModal( + overrides: { + open?: boolean; + /** Issue #101: injected picker-raiser spy. */ + onLoadConfig?: () => void; + /** Issue #101: reload key that must re-run the load-on-open fetch. */ + reloadKey?: number, + } = {}, +) { const onClose = vi.fn(); const onApplied = vi.fn(); - render( - , - ); - return { onClose, onApplied }; + const initialProps = { + open: overrides.open ?? true, + onClose, + onApplied, + onLoadConfig: overrides.onLoadConfig, + reloadKey: overrides.reloadKey, + }; + const view = render(); + return { + onClose, + onApplied, + /** Re-render with changed props (issue #101 reload / open cycling). */ + rerenderWith: (next: { open?: boolean; reloadKey?: number }) => { + view.rerender(); + }, + }; } /** @@ -159,8 +177,9 @@ describe("ConfigEditorModal", () => { // The document is actually drawn into the DOM (first line visible). const content = document.querySelector(".cm-content"); expect(content?.textContent).toContain('release: "1.0"'); - // Header identifies the backing file. - expect(screen.getByText("machine.profiles")).toBeTruthy(); + // Header identifies the backing file (the footer status bar shows it + // too — issue #105 — so scope to the header). + expect(within(screen.getByTestId("editor-header")).getByText("machine.profiles")).toBeTruthy(); }); it("test_dirty_indicator_and_escape_warning", async () => { @@ -755,3 +774,478 @@ describe("ConfigEditorModal", () => { expect(saveSpy).not.toHaveBeenCalled(); }); }); + +/** + * Editor feedback tests (issues #102 + #100): editing must clear stale + * Test/validation feedback immediately, and validation must re-run + * automatically ~800ms after the user stops typing. + */ +describe("ConfigEditorModal live validation (issues #102/#100)", () => { + afterEach(() => { + vi.useRealTimers(); + }); + + it("test_editing_clears_stale_validation_feedback", async () => { + validateSpy.mockResolvedValue({ valid: false, issues: [{ severity: "error", message: "boom" }] }); + const user = userEvent.setup(); + renderModal(); + + const view = await readyEditorView(); + // Run Test: the banner + issue list describe the pre-edit document. + await user.click(screen.getByRole("button", { name: /test/i })); + await waitFor(() => expect(screen.getByTestId("editor-status")).toBeTruthy()); + expect(screen.getByTestId("editor-issues")).toBeTruthy(); + + // One keystroke invalidates that feedback — it must vanish immediately. + await act(async () => { + view.dispatch({ changes: { from: 0, insert: "# edited\n" } }); + }); + expect(screen.queryByTestId("editor-status")).toBeNull(); + expect(screen.queryByTestId("editor-issues")).toBeNull(); + }); + + it("test_live_validation_fires_after_debounce", async () => { + renderModal(); + const view = await readyEditorView(); + // Freeze time only after the editor is ready: RTL waitFor relies on + // real timers while probing the mounted view. + vi.useFakeTimers(); + validateSpy.mockResolvedValue({ valid: true, issues: [] }); + + await act(async () => { + view.dispatch({ changes: { from: 0, insert: "# edited\n" } }); + }); + // A pause shorter than the debounce fires nothing. + await act(async () => { + await vi.advanceTimersByTimeAsync(799); + }); + expect(validateSpy).not.toHaveBeenCalled(); + + // At 800ms after the last change, exactly one validation leaves — + // carrying the current document text. + await act(async () => { + await vi.advanceTimersByTimeAsync(1); + }); + expect(validateSpy).toHaveBeenCalledTimes(1); + expect(validateSpy.mock.calls[0][1]).toContain("# edited\n"); + }); + + it("test_live_validation_coalesces_rapid_typing", async () => { + renderModal(); + const view = await readyEditorView(); + vi.useFakeTimers(); + validateSpy.mockResolvedValue({ valid: true, issues: [] }); + + // Three changes inside the debounce window coalesce into one request. + await act(async () => { + view.dispatch({ changes: { from: 0, insert: "a\n" } }); + await vi.advanceTimersByTimeAsync(300); + view.dispatch({ changes: { from: 1, insert: "b\n" } }); + await vi.advanceTimersByTimeAsync(300); + view.dispatch({ changes: { from: 2, insert: "c\n" } }); + await vi.advanceTimersByTimeAsync(800); + }); + expect(validateSpy).toHaveBeenCalledTimes(1); + expect(validateSpy.mock.calls[0][1]).toContain("c\n"); + }); + + it("test_explicit_test_cancels_pending_debounce", async () => { + renderModal(); + const view = await readyEditorView(); + vi.useFakeTimers(); + validateSpy.mockResolvedValue({ valid: true, issues: [] }); + + await act(async () => { + view.dispatch({ changes: { from: 0, insert: "# edited\n" } }); + }); + // The explicit Test button short-circuits the pending debounce. + await act(async () => { + screen.getByRole("button", { name: /test/i }).click(); + await vi.advanceTimersByTimeAsync(0); + }); + expect(validateSpy).toHaveBeenCalledTimes(1); + + // The canceled timer must not re-fire later. + await act(async () => { + await vi.advanceTimersByTimeAsync(1000); + }); + expect(validateSpy).toHaveBeenCalledTimes(1); + }); + + it("test_live_validation_rechecks_after_in_flight_completes", async () => { + renderModal(); + const view = await readyEditorView(); + vi.useFakeTimers(); + let resolveFirst!: (value: { valid: boolean; issues: never[] }) => void; + validateSpy.mockImplementationOnce( + () => new Promise((resolve) => { resolveFirst = resolve; }), + ); + + await act(async () => { + view.dispatch({ changes: { from: 0, insert: "x\n" } }); + await vi.advanceTimersByTimeAsync(800); + }); + expect(validateSpy).toHaveBeenCalledTimes(1); // in flight + + // A second edit while validation is in flight must not be swallowed — + // it re-schedules and re-fires once the round trip lands. + await act(async () => { + view.dispatch({ changes: { from: 0, insert: "y\n" } }); + await vi.advanceTimersByTimeAsync(800); + }); + expect(validateSpy).toHaveBeenCalledTimes(1); + + await act(async () => { + resolveFirst({ valid: true, issues: [] }); + await vi.advanceTimersByTimeAsync(800); + }); + expect(validateSpy).toHaveBeenCalledTimes(2); + }); + + it("test_live_validation_skipped_while_gate_parked", async () => { + // The compliance gate (invalid save confirm) is a blocking modal: no + // auto-validation churn behind it. + validateSpy.mockResolvedValue({ + valid: false, + issues: [{ severity: "error", message: "boom" }], + }); + const user = userEvent.setup(); + renderModal(); + const view = await readyEditorView(); + + await user.click(screen.getByRole("button", { name: /^save$/i })); + expect(await screen.findByRole("dialog", { name: /save with validation issues\?/i })).toBeTruthy(); + + vi.useFakeTimers(); + validateSpy.mockResolvedValue({ valid: true, issues: [] }); + await act(async () => { + view.dispatch({ changes: { from: 0, insert: "# edited\n" } }); + await vi.advanceTimersByTimeAsync(2000); + }); + // Only the save pre-validation ran — no live cycle behind the gate. + expect(validateSpy).toHaveBeenCalledTimes(1); + }); +}); + +/** + * Editor chrome tests (issues #98 + #99): the CodeMirror surface must be + * solid and token-backed (never the frosted modal glass), the gutter must + * be opaque, and the editor must sit inside a padded bordered card that + * separates it from the modal chrome. + */ +describe("ConfigEditorModal editor chrome (issues #98/#99)", () => { + it("test_editor_theme_is_solid_and_token_backed", async () => { + renderModal(); + await readyEditorView(); + + // CodeMirror injects the compiled theme as real