comfy-ts 2.13.0 → 2.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. package/dist/cli.js +3 -3
  2. package/dist/index.cjs +1 -1
  3. package/dist/index.js +1 -1
  4. package/dist/{run-serve-DlRBv_Nk.js → run-serve-DUqcn0h3.js} +211 -59
  5. package/dist/run-serve-DUqcn0h3.js.map +1 -0
  6. package/dist/{run-tui-B5uxm2_l.js → run-tui-D-LaSqgB.js} +2 -2
  7. package/dist/{run-tui-B5uxm2_l.js.map → run-tui-D-LaSqgB.js.map} +1 -1
  8. package/dist/serve-web.js +146 -71
  9. package/dist/{state-CUp2J1Zy.js → state-BytbdZ8s.js} +2 -2
  10. package/dist/{state-CUp2J1Zy.js.map → state-BytbdZ8s.js.map} +1 -1
  11. package/dist/web.js +1 -1
  12. package/package.json +1 -1
  13. package/src/cli/serve/ServeApp.ts +90 -82
  14. package/src/cli/serve/resultHistory.ts +125 -0
  15. package/src/cli/serve/runError.ts +23 -0
  16. package/src/cli/serve/serveSettings.ts +17 -1
  17. package/src/cli/serve/web/api.ts +29 -2
  18. package/src/cli/serve/web/components/App.tsx +6 -4
  19. package/src/cli/serve/web/components/Gallery.tsx +33 -8
  20. package/src/cli/serve/web/components/Icon.tsx +4 -0
  21. package/src/cli/serve/web/components/MemoryBudget.tsx +98 -0
  22. package/src/cli/serve/web/components/RunError.tsx +19 -0
  23. package/src/cli/serve/web/components/ShortcutsModal.tsx +54 -0
  24. package/src/cli/serve/web/components/SideMenu.tsx +14 -0
  25. package/src/cli/serve/web/components/VarsForm.tsx +71 -53
  26. package/src/cli/serve/web/components/controls/BasicControls.tsx +8 -1
  27. package/src/cli/serve/web/components/controls/LorasControl.tsx +6 -3
  28. package/src/cli/serve/web/promptEditor/promptExtensions.ts +3 -1
  29. package/src/cli/serve/web/state/RunSt.ts +61 -3
  30. package/src/cli/serve/web/state/WebSt.ts +26 -2
  31. package/src/cli/serve/web/state/formRows.ts +9 -0
  32. package/src/cli/serve/web/state/keptResults.ts +26 -0
  33. package/src/cli/serve/web/state/lightbox.ts +17 -0
  34. package/src/cli/serve/web/state/shortcutCatalog.ts +100 -0
  35. package/src/cli/serve/web/state/shortcuts.ts +10 -0
  36. package/src/cli/serve/web/styles.ts +98 -24
  37. package/dist/run-serve-DlRBv_Nk.js.map +0 -1
package/dist/serve-web.js CHANGED
@@ -1,65 +1,75 @@
1
- var vL=Object.defineProperty;var ew=(e,t,n)=>{for(var i in t)vL(e,i,{get:t[i],set:n[i],enumerable:!0,configurable:!0})};function RC(){if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!=="function")return;try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(RC)}catch(e){console.error(e)}}var $o={};ew($o,{unstable_now:()=>ei,unstable_IdlePriority:()=>kf,unstable_ImmediatePriority:()=>_f,unstable_LowPriority:()=>Cf,unstable_NormalPriority:()=>Xo,unstable_Profiling:()=>lw,unstable_UserBlockingPriority:()=>Ef,unstable_cancelCallback:()=>Of,unstable_forceFrameRate:()=>aw,unstable_getCurrentPriorityLevel:()=>Af,unstable_next:()=>uw,unstable_requestPaint:()=>Rf,unstable_runWithPriority:()=>cw,unstable_scheduleCallback:()=>Go,unstable_shouldYield:()=>Tf,unstable_wrapCallback:()=>fw},{unstable_now:(h9)=>ei=h9,unstable_IdlePriority:(h9)=>kf=h9,unstable_ImmediatePriority:(h9)=>_f=h9,unstable_LowPriority:(h9)=>Cf=h9,unstable_NormalPriority:(h9)=>Xo=h9,unstable_Profiling:(h9)=>lw=h9,unstable_UserBlockingPriority:(h9)=>Ef=h9,unstable_cancelCallback:(h9)=>Of=h9,unstable_forceFrameRate:(h9)=>aw=h9,unstable_getCurrentPriorityLevel:(h9)=>Af=h9,unstable_next:(h9)=>uw=h9,unstable_requestPaint:(h9)=>Rf=h9,unstable_runWithPriority:(h9)=>cw=h9,unstable_scheduleCallback:(h9)=>Go=h9,unstable_shouldYield:(h9)=>Tf=h9,unstable_wrapCallback:(h9)=>fw=h9});function hm(e,t){var n=e.length;e.push(t);e:for(;0<n;){var i=n-1>>>1,r=e[i];if(0<bf(r,t))e[i]=t,e[n]=r,n=i;else break e}}function Ri(e){return e.length===0?null:e[0]}function Sf(e){if(e.length===0)return null;var t=e[0],n=e.pop();if(n!==t){e[0]=n;e:for(var i=0,r=e.length,o=r>>>1;i<o;){var s=2*(i+1)-1,l=e[s],a=s+1,u=e[a];if(0>bf(l,n))a<r&&0>bf(u,l)?(e[i]=u,e[a]=n,i=a):(e[i]=l,e[s]=n,i=s);else if(a<r&&0>bf(u,n))e[i]=u,e[a]=n,i=a;else break e}}return t}function bf(e,t){var n=e.sortIndex-t.sortIndex;return n!==0?n:e.id-t.id}var ei=void 0;if(typeof performance==="object"&&typeof performance.now==="function")pm=performance,ei=function(){return pm.now()};else yf=Date,mm=yf.now(),ei=function(){return yf.now()-mm};var pm,yf,mm,ar=[],jr=[],bL=1,Rn=null,Dt=3,gm=!1,Xa=!1,Ga=!1,bm=!1,nw=typeof setTimeout==="function"?setTimeout:null,iw=typeof clearTimeout==="function"?clearTimeout:null,tw=typeof setImmediate<"u"?setImmediate:null;function xf(e){for(var t=Ri(jr);t!==null;){if(t.callback===null)Sf(jr);else if(t.startTime<=e)Sf(jr),t.sortIndex=t.expirationTime,hm(ar,t);else break;t=Ri(jr)}}function ym(e){if(Ga=!1,xf(e),!Xa)if(Ri(ar)!==null)Xa=!0,Ws||(Ws=!0,Ys());else{var t=Ri(jr);t!==null&&xm(ym,t.startTime-e)}}var Ws=!1,Ya=-1,rw=5,ow=-1;function sw(){return bm?!0:$o.unstable_now()-ow<rw?!1:!0}function dm(){if(bm=!1,Ws){var e=$o.unstable_now();ow=e;var t=!0;try{e:{Xa=!1,Ga&&(Ga=!1,iw(Ya),Ya=-1),gm=!0;var n=Dt;try{t:{xf(e);for(Rn=Ri(ar);Rn!==null&&!(Rn.expirationTime>e&&sw());){var i=Rn.callback;if(typeof i==="function"){Rn.callback=null,Dt=Rn.priorityLevel;var r=i(Rn.expirationTime<=e);if(e=$o.unstable_now(),typeof r==="function"){Rn.callback=r,xf(e),t=!0;break t}Rn===Ri(ar)&&Sf(ar),xf(e)}else Sf(ar);Rn=Ri(ar)}if(Rn!==null)t=!0;else{var o=Ri(jr);o!==null&&xm(ym,o.startTime-e),t=!1}}break e}finally{Rn=null,Dt=n,gm=!1}t=void 0}}finally{t?Ys():Ws=!1}}}var Ys;if(typeof tw==="function")Ys=function(){tw(dm)};else if(typeof MessageChannel<"u")wf=new MessageChannel,vm=wf.port2,wf.port1.onmessage=dm,Ys=function(){vm.postMessage(null)};else Ys=function(){nw(dm,0)};var wf,vm;function xm(e,t){Ya=nw(function(){e($o.unstable_now())},t)}var kf=5,_f=1,Cf=4,Xo=3,lw=null,Ef=2,Of=function(e){e.callback=null},aw=function(e){0>e||125<e?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):rw=0<e?Math.floor(1000/e):5},Af=function(){return Dt},uw=function(e){switch(Dt){case 1:case 2:case 3:var t=3;break;default:t=Dt}var n=Dt;Dt=t;try{return e()}finally{Dt=n}},Rf=function(){bm=!0},cw=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=Dt;Dt=e;try{return t()}finally{Dt=n}},Go=function(e,t,n){var i=$o.unstable_now();switch(typeof n==="object"&&n!==null?(n=n.delay,n=typeof n==="number"&&0<n?i+n:i):n=i,e){case 1:var r=-1;break;case 2:r=250;break;case 5:r=1073741823;break;case 4:r=1e4;break;default:r=5000}return r=n+r,e={id:bL++,callback:t,priorityLevel:e,startTime:n,expirationTime:r,sortIndex:-1},n>i?(e.sortIndex=n,hm(jr,e),Ri(ar)===null&&e===Ri(jr)&&(Ga?(iw(Ya),Ya=-1):Ga=!0,xm(ym,n-i))):(e.sortIndex=r,hm(ar,e),Xa||gm||(Xa=!0,Ws||(Ws=!0,Ys()))),e},Tf=sw,fw=function(e){var t=Dt;return function(){var n=Dt;Dt=t;try{return e.apply(this,arguments)}finally{Dt=n}}};var ur={};ew(ur,{Activity:()=>_w,Children:()=>Cw,Component:()=>Ew,Fragment:()=>Ow,Profiler:()=>Aw,PureComponent:()=>Rw,StrictMode:()=>Tw,Suspense:()=>Mw,ViewTransition:()=>Nw,__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE:()=>Zs,__COMPILER_RUNTIME:()=>Dw,addTransitionType:()=>Lw,cache:()=>zw,cacheSignal:()=>Bw,cloneElement:()=>Am,createContext:()=>Kr,createElement:()=>Pw,createRef:()=>Iw,forwardRef:()=>Fr,isValidElement:()=>Nf,lazy:()=>Vw,memo:()=>el,startTransition:()=>Hw,unstable_useCacheRefresh:()=>Uw,use:()=>jw,useActionState:()=>Kw,useCallback:()=>st,useContext:()=>qr,useDebugValue:()=>Rm,useDeferredValue:()=>Fw,useEffect:()=>Z,useEffectEvent:()=>qw,useId:()=>Df,useImperativeHandle:()=>Wa,useInsertionEffect:()=>$w,useLayoutEffect:()=>ti,useMemo:()=>Ke,useOptimistic:()=>Xw,useReducer:()=>Tm,useRef:()=>X,useState:()=>Q,useSyncExternalStore:()=>$r,useTransition:()=>Gw,version:()=>Lf},{Activity:(p9)=>_w=p9,Children:(p9)=>Cw=p9,Component:(p9)=>Ew=p9,Fragment:(p9)=>Ow=p9,Profiler:(p9)=>Aw=p9,PureComponent:(p9)=>Rw=p9,StrictMode:(p9)=>Tw=p9,Suspense:(p9)=>Mw=p9,ViewTransition:(p9)=>Nw=p9,__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE:(p9)=>Zs=p9,__COMPILER_RUNTIME:(p9)=>Dw=p9,addTransitionType:(p9)=>Lw=p9,cache:(p9)=>zw=p9,cacheSignal:(p9)=>Bw=p9,cloneElement:(p9)=>Am=p9,createContext:(p9)=>Kr=p9,createElement:(p9)=>Pw=p9,createRef:(p9)=>Iw=p9,forwardRef:(p9)=>Fr=p9,isValidElement:(p9)=>Nf=p9,lazy:(p9)=>Vw=p9,memo:(p9)=>el=p9,startTransition:(p9)=>Hw=p9,unstable_useCacheRefresh:(p9)=>Uw=p9,use:(p9)=>jw=p9,useActionState:(p9)=>Kw=p9,useCallback:(p9)=>st=p9,useContext:(p9)=>qr=p9,useDebugValue:(p9)=>Rm=p9,useDeferredValue:(p9)=>Fw=p9,useEffect:(p9)=>Z=p9,useEffectEvent:(p9)=>qw=p9,useId:(p9)=>Df=p9,useImperativeHandle:(p9)=>Wa=p9,useInsertionEffect:(p9)=>$w=p9,useLayoutEffect:(p9)=>ti=p9,useMemo:(p9)=>Ke=p9,useOptimistic:(p9)=>Xw=p9,useReducer:(p9)=>Tm=p9,useRef:(p9)=>X=p9,useState:(p9)=>Q=p9,useSyncExternalStore:(p9)=>$r=p9,useTransition:(p9)=>Gw=p9,version:(p9)=>Lf=p9});var km=Symbol.for("react.transitional.element"),yL=Symbol.for("react.portal"),xL=Symbol.for("react.fragment"),wL=Symbol.for("react.strict_mode"),SL=Symbol.for("react.profiler"),kL=Symbol.for("react.consumer"),_L=Symbol.for("react.context"),CL=Symbol.for("react.forward_ref"),EL=Symbol.for("react.suspense"),OL=Symbol.for("react.memo"),gw=Symbol.for("react.lazy"),AL=Symbol.for("react.activity"),RL=Symbol.for("react.view_transition"),dw=Symbol.iterator;function TL(e){if(e===null||typeof e!=="object")return null;return e=dw&&e[dw]||e["@@iterator"],typeof e==="function"?e:null}var vw={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},bw=Object.assign,yw={};function Js(e,t,n){this.props=e,this.context=t,this.refs=yw,this.updater=n||vw}Js.prototype.isReactComponent={};Js.prototype.setState=function(e,t){if(typeof e!=="object"&&typeof e!=="function"&&e!=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,e,t,"setState")};Js.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function xw(){}xw.prototype=Js.prototype;function _m(e,t,n){this.props=e,this.context=t,this.refs=yw,this.updater=n||vw}var Cm=_m.prototype=new xw;Cm.constructor=_m;bw(Cm,Js.prototype);Cm.isPureReactComponent=!0;var hw=Array.isArray;function Sm(){}var De={H:null,A:null,T:null,S:null},ww=Object.prototype.hasOwnProperty;function Em(e,t,n){var i=n.ref;return{$$typeof:km,type:e,key:t,ref:i!==void 0?i:null,props:n}}function ML(e,t){return Em(e.type,t,e.props)}function Om(e){return typeof e==="object"&&e!==null&&e.$$typeof===km}function NL(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(n){return t[n]})}var pw=/\/+/g;function wm(e,t){return typeof e==="object"&&e!==null&&e.key!=null?NL(""+e.key):t.toString(36)}function DL(e){switch(e.status){case"fulfilled":return e.value;case"rejected":throw e.reason;default:switch(typeof e.status==="string"?e.then(Sm,Sm):(e.status="pending",e.then(function(t){e.status==="pending"&&(e.status="fulfilled",e.value=t)},function(t){e.status==="pending"&&(e.status="rejected",e.reason=t)})),e.status){case"fulfilled":return e.value;case"rejected":throw e.reason}}throw e}function Qs(e,t,n,i,r){var o=typeof e;if(o==="undefined"||o==="boolean")e=null;var s=!1;if(e===null)s=!0;else switch(o){case"bigint":case"string":case"number":s=!0;break;case"object":switch(e.$$typeof){case km:case yL:s=!0;break;case gw:return s=e._init,Qs(s(e._payload),t,n,i,r)}}if(s)return r=r(e),s=i===""?"."+wm(e,0):i,hw(r)?(n="",s!=null&&(n=s.replace(pw,"$&/")+"/"),Qs(r,t,n,"",function(u){return u})):r!=null&&(Om(r)&&(r=ML(r,n+(r.key==null||e&&e.key===r.key?"":(""+r.key).replace(pw,"$&/")+"/")+s)),t.push(r)),1;s=0;var l=i===""?".":i+":";if(hw(e))for(var a=0;a<e.length;a++)i=e[a],o=l+wm(i,a),s+=Qs(i,t,n,o,r);else if(a=TL(e),typeof a==="function")for(e=a.call(e),a=0;!(i=e.next()).done;)i=i.value,o=l+wm(i,a++),s+=Qs(i,t,n,o,r);else if(o==="object"){if(typeof e.then==="function")return Qs(DL(e),t,n,i,r);throw t=String(e),Error("Objects are not valid as a React child (found: "+(t==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":t)+"). If you meant to render a collection of children, use an array instead.")}return s}function Mf(e,t,n){if(e==null)return e;var i=[],r=0;return Qs(e,i,"","",function(o){return t.call(n,o,r++)}),i}function LL(e){if(e._status===-1){var t=e._result,n=t();n.then(function(i){if(e._status===0||e._status===-1)e._status=1,e._result=i,n.status===void 0&&(n.status="fulfilled",n.value=i)},function(i){if(e._status===0||e._status===-1)e._status=2,e._result=i,n.status===void 0&&(n.status="rejected",n.reason=i)}),e._status===-1&&(e._status=0,e._result=n)}if(e._status===1)return e._result.default;throw e._result}var mw=typeof reportError==="function"?reportError:function(e){if(typeof window==="object"&&typeof window.ErrorEvent==="function"){var t=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof e==="object"&&e!==null&&typeof e.message==="string"?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process==="object"&&typeof process.emit==="function"){process.emit("uncaughtException",e);return}console.error(e)};function Sw(e){var t=De.T,n={};n.types=t!==null?t.types:null,De.T=n;try{var i=e(),r=De.S;r!==null&&r(n,i),typeof i==="object"&&i!==null&&typeof i.then==="function"&&i.then(Sm,mw)}catch(o){mw(o)}finally{t!==null&&n.types!==null&&(t.types=n.types),De.T=t}}function kw(e){var t=De.T;if(t!==null){var n=t.types;n===null?t.types=[e]:n.indexOf(e)===-1&&n.push(e)}else Sw(kw.bind(null,e))}var zL={map:Mf,forEach:function(e,t,n){Mf(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return Mf(e,function(){t++}),t},toArray:function(e){return Mf(e,function(t){return t})||[]},only:function(e){if(!Om(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};var _w=AL,Cw=zL,Ew=Js,Ow=xL,Aw=SL,Rw=_m,Tw=wL,Mw=EL,Nw=RL,Zs=De,Dw={__proto__:null,c:function(e){return De.H.useMemoCache(e)}},Lw=kw,zw=function(e){return function(){return e.apply(null,arguments)}},Bw=function(){return null},Am=function(e,t,n){if(e===null||e===void 0)throw Error("The argument must be a React element, but you passed "+e+".");var i=bw({},e.props),r=e.key;if(t!=null)for(o in t.key!==void 0&&(r=""+t.key),t)!ww.call(t,o)||o==="key"||o==="__self"||o==="__source"||o==="ref"&&t.ref===void 0||(i[o]=t[o]);var o=arguments.length-2;if(o===1)i.children=n;else if(1<o){for(var s=Array(o),l=0;l<o;l++)s[l]=arguments[l+2];i.children=s}return Em(e.type,r,i)},Kr=function(e){return e={$$typeof:_L,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null},e.Provider=e,e.Consumer={$$typeof:kL,_context:e},e},Pw=function(e,t,n){var i,r={},o=null;if(t!=null)for(i in t.key!==void 0&&(o=""+t.key),t)ww.call(t,i)&&i!=="key"&&i!=="__self"&&i!=="__source"&&(r[i]=t[i]);var s=arguments.length-2;if(s===1)r.children=n;else if(1<s){for(var l=Array(s),a=0;a<s;a++)l[a]=arguments[a+2];r.children=l}if(e&&e.defaultProps)for(i in s=e.defaultProps,s)r[i]===void 0&&(r[i]=s[i]);return Em(e,o,r)},Iw=function(){return{current:null}},Fr=function(e){return{$$typeof:CL,render:e}},Nf=Om,Vw=function(e){return{$$typeof:gw,_payload:{_status:-1,_result:e},_init:LL}},el=function(e,t){return{$$typeof:OL,type:e,compare:t===void 0?null:t}},Hw=Sw,Uw=function(){return De.H.useCacheRefresh()},jw=function(e){return De.H.use(e)},Kw=function(e,t,n){return De.H.useActionState(e,t,n)},st=function(e,t){return De.H.useCallback(e,t)},qr=function(e){return De.H.useContext(e)},Rm=function(){},Fw=function(e,t){return De.H.useDeferredValue(e,t)},Z=function(e,t){return De.H.useEffect(e,t)},qw=function(e){return De.H.useEffectEvent(e)},Df=function(){return De.H.useId()},Wa=function(e,t,n){return De.H.useImperativeHandle(e,t,n)},$w=function(e,t){return De.H.useInsertionEffect(e,t)},ti=function(e,t){return De.H.useLayoutEffect(e,t)},Ke=function(e,t){return De.H.useMemo(e,t)},Xw=function(e,t){return De.H.useOptimistic(e,t)},Tm=function(e,t,n){return De.H.useReducer(e,t,n)},X=function(e){return De.H.useRef(e)},Q=function(e){return De.H.useState(e)},$r=function(e,t,n){return De.H.useSyncExternalStore(e,t,n)},Gw=function(){return De.H.useTransition()},Lf="19.3.0";function Qw(){if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!=="function")return;try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(Qw)}catch(e){console.error(e)}}function Ww(e){var t="https://react.dev/errors/"+e;if(1<arguments.length){t+="?args[]="+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+="&args[]="+encodeURIComponent(arguments[n])}return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function Xr(){}var Qa={d:{f:Xr,r:function(){throw Error(Ww(522))},D:Xr,C:Xr,L:Xr,m:Xr,X:Xr,S:Xr,M:Xr},p:0,findDOMNode:null},BL=Symbol.for("react.portal");var Yw=Symbol.for("react.optimistic_key");function PL(e,t,n){var i=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:BL,key:i==null?null:i===Yw?Yw:""+i,children:e,containerInfo:t,implementation:n}}var Mm=Zs;var Nm=Qa;var Dm=function(e,t){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)throw Error(Ww(299));return PL(e,t,null,n)},zf=function(e){var t=Mm.T,n=Qa.p;try{if(Mm.T=null,Qa.p=2,e)return e()}finally{Mm.T=t,Qa.p=n,Qa.d.f()}};Qw();function A(e){var t="https://react.dev/errors/"+e;if(1<arguments.length){t+="?args[]="+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+="&args[]="+encodeURIComponent(arguments[n])}return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function IL(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function Uu(e){for(var t=e,n=t;n&&!n.alternate;)t=n,(t.flags&4098)!==0&&(e=t.return),n=t.return;for(;t.return;)t=t.return;return t.tag===3?e:null}function LS(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function zS(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function Jw(e){if(Uu(e)!==e)throw Error(A(188))}function VL(e){var t=e.alternate;if(!t){if(t=Uu(e),t===null)throw Error(A(188));return t!==e?null:e}for(var n=e,i=t;;){var r=n.return;if(r===null)break;var o=r.alternate;if(o===null){if(i=r.return,i!==null){n=i;continue}break}if(r.child===o.child){for(o=r.child;o;){if(o===n)return Jw(r),e;if(o===i)return Jw(r),t;o=o.sibling}throw Error(A(188))}if(n.return!==i.return)n=r,i=o;else{for(var s=!1,l=r.child;l;){if(l===n){s=!0,n=r,i=o;break}if(l===i){s=!0,i=r,n=o;break}l=l.sibling}if(!s){for(l=o.child;l;){if(l===n){s=!0,n=o,i=r;break}if(l===i){s=!0,i=o,n=r;break}l=l.sibling}if(!s)throw Error(A(189))}}if(n.alternate!==i)throw Error(A(190))}if(n.tag!==3)throw Error(A(188));return n.stateNode.current===n?e:t}function BS(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=BS(e),t!==null)return t;e=e.sibling}return null}function tn(e,t,n,i,r,o){for(;e!==null;){if((e.tag===5||e.tag===27||e.tag===6)&&n(e,i,r,o)||(e.tag!==22||e.memoizedState===null)&&(t||e.tag!==5&&e.tag!==27)&&tn(e.child,t,n,i,r,o))return!0;e=e.sibling}return!1}function bs(e){for(e=e.return;e!==null;){if(e.tag===3||e.tag===5||e.tag===27)return e;e=e.return}return null}function Zw(e){var t=!1;for(e=e.return;e!==null;){if(e.tag===4&&(t=!0),e.tag===3||e.tag===5||e.tag===27)break;e=e.return}return t}function PS(e){var t=[null,null],n=bs(e);if(n===null)return t;return IS(t,e,n.child,{foundSelf:!1}),t}function IS(e,t,n,i){for(;n!==null;){if(n===t)i.foundSelf=!0;else if(n.tag===5||n.tag===27||n.tag===6){if(i.foundSelf)return e[1]=n,!0;e[0]=n}else if((n.tag!==22||n.memoizedState===null)&&IS(e,t,n.child,i))return!0;n=n.sibling}return!1}function ft(e){switch(e.tag){case 5:case 27:case 6:return e.stateNode;case 3:return e.stateNode.containerInfo;default:throw Error(A(559))}}var ll=null,fg=null;function HL(e,t,n){return e===n?!0:e===t?(ll=e,!0):!1}function UL(e,t,n){return e===n?(fg=e,!1):e===t?(fg!==null&&(ll=e),!0):!1}function e1(e){if(e===null)return null;do e=e===null?null:e.return;while(e&&e.tag!==5&&e.tag!==27&&e.tag!==3);return e?e:null}function dg(e,t,n){for(var i=0,r=e;r;r=n(r))i++;r=0;for(var o=t;o;o=n(o))r++;for(;0<i-r;)e=n(e),i--;for(;0<r-i;)t=n(t),r--;for(;i--;){if(e===t||t!==null&&e===t.alternate)return e;e=n(e),t=n(t)}return null}var Te=Object.assign,jL=Symbol.for("react.element"),Bf=Symbol.for("react.transitional.element"),iu=Symbol.for("react.portal"),al=Symbol.for("react.fragment"),VS=Symbol.for("react.strict_mode"),hg=Symbol.for("react.profiler"),HS=Symbol.for("react.consumer"),zi=Symbol.for("react.context"),_v=Symbol.for("react.forward_ref"),pg=Symbol.for("react.suspense"),mg=Symbol.for("react.suspense_list"),Cv=Symbol.for("react.memo"),Qr=Symbol.for("react.lazy"),gg=Symbol.for("react.activity"),KL=Symbol.for("react.legacy_hidden"),FL=Symbol.for("react.memo_cache_sentinel"),vg=Symbol.for("react.view_transition"),qL=Symbol.for("react.recoverable"),t1=Symbol.iterator;function Ja(e){if(e===null||typeof e!=="object")return null;return e=t1&&e[t1]||e["@@iterator"],typeof e==="function"?e:null}var $L=Symbol.for("react.client.reference");function bg(e){if(e==null)return null;if(typeof e==="function")return e.$$typeof===$L?null:e.displayName||e.name||null;if(typeof e==="string")return e;switch(e){case al:return"Fragment";case hg:return"Profiler";case VS:return"StrictMode";case pg:return"Suspense";case mg:return"SuspenseList";case gg:return"Activity";case vg:return"ViewTransition"}if(typeof e==="object")switch(e.$$typeof){case iu:return"Portal";case zi:return e.displayName||"Context";case HS:return(e._context.displayName||"Context")+".Consumer";case _v:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case Cv:return t=e.displayName||null,t!==null?t:bg(e.type)||"Memo";case Qr:t=e._payload,e=e._init;try{return bg(e(t))}catch(n){}}return null}var ru=Array.isArray,ne=Zs,be=Nm,is={pending:!1,data:null,method:null,action:null},yg=[],ul=-1;function ji(e){return{current:e}}function Et(e){0>ul||(e.current=yg[ul],yg[ul]=null,ul--)}function Be(e,t){ul++,yg[ul]=e.current,e.current=t}var Vi=ji(null),Cu=ji(null),so=ji(null),yd=ji(null);function xd(e,t){switch(Be(so,t),Be(Cu,e),Be(Vi,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)?(e=e.namespaceURI)?hS(e):0:0;break;default:if(e=t.tagName,t=t.namespaceURI)t=hS(t),e=lC(t,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}Et(Vi),Be(Vi,e)}function Rl(){Et(Vi),Et(Cu),Et(so)}function xg(e){var t=e.memoizedState;t!==null&&(Vl._currentValue=t.memoizedState,Be(yd,e)),t=Vi.current;var n=lC(t,e.type);t!==n&&(Be(Cu,e),Be(Vi,n))}function wd(e){Cu.current===e&&(Et(Vi),Et(Cu)),yd.current===e&&(Et(yd),Vl._currentValue=is)}var zm,n1;function Yr(e){if(zm===void 0)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);zm=t&&t[1]||"",n1=-1<n.stack.indexOf(`
1
+ var VL=Object.defineProperty;var cw=(e,t,n)=>{for(var i in t)VL(e,i,{get:t[i],set:n[i],enumerable:!0,configurable:!0})};function HC(){if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!=="function")return;try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(HC)}catch(e){console.error(e)}}var Go={};cw(Go,{unstable_now:()=>ei,unstable_IdlePriority:()=>Of,unstable_ImmediatePriority:()=>Rf,unstable_LowPriority:()=>Af,unstable_NormalPriority:()=>Yo,unstable_Profiling:()=>vw,unstable_UserBlockingPriority:()=>Tf,unstable_cancelCallback:()=>Mf,unstable_forceFrameRate:()=>bw,unstable_getCurrentPriorityLevel:()=>Nf,unstable_next:()=>yw,unstable_requestPaint:()=>Df,unstable_runWithPriority:()=>xw,unstable_scheduleCallback:()=>Wo,unstable_shouldYield:()=>Lf,unstable_wrapCallback:()=>ww},{unstable_now:(I9)=>ei=I9,unstable_IdlePriority:(I9)=>Of=I9,unstable_ImmediatePriority:(I9)=>Rf=I9,unstable_LowPriority:(I9)=>Af=I9,unstable_NormalPriority:(I9)=>Yo=I9,unstable_Profiling:(I9)=>vw=I9,unstable_UserBlockingPriority:(I9)=>Tf=I9,unstable_cancelCallback:(I9)=>Mf=I9,unstable_forceFrameRate:(I9)=>bw=I9,unstable_getCurrentPriorityLevel:(I9)=>Nf=I9,unstable_next:(I9)=>yw=I9,unstable_requestPaint:(I9)=>Df=I9,unstable_runWithPriority:(I9)=>xw=I9,unstable_scheduleCallback:(I9)=>Wo=I9,unstable_shouldYield:(I9)=>Lf=I9,unstable_wrapCallback:(I9)=>ww=I9});function ym(e,t){var n=e.length;e.push(t);e:for(;0<n;){var i=n-1>>>1,r=e[i];if(0<Sf(r,t))e[i]=t,e[n]=r,n=i;else break e}}function Ai(e){return e.length===0?null:e[0]}function Ef(e){if(e.length===0)return null;var t=e[0],n=e.pop();if(n!==t){e[0]=n;e:for(var i=0,r=e.length,o=r>>>1;i<o;){var s=2*(i+1)-1,l=e[s],a=s+1,u=e[a];if(0>Sf(l,n))a<r&&0>Sf(u,l)?(e[i]=u,e[a]=n,i=a):(e[i]=l,e[s]=n,i=s);else if(a<r&&0>Sf(u,n))e[i]=u,e[a]=n,i=a;else break e}}return t}function Sf(e,t){var n=e.sortIndex-t.sortIndex;return n!==0?n:e.id-t.id}var ei=void 0;if(typeof performance==="object"&&typeof performance.now==="function")xm=performance,ei=function(){return xm.now()};else kf=Date,wm=kf.now(),ei=function(){return kf.now()-wm};var xm,kf,wm,ar=[],Kr=[],UL=1,An=null,zt=3,Sm=!1,Za=!1,eu=!1,_m=!1,dw=typeof setTimeout==="function"?setTimeout:null,hw=typeof clearTimeout==="function"?clearTimeout:null,fw=typeof setImmediate<"u"?setImmediate:null;function _f(e){for(var t=Ai(Kr);t!==null;){if(t.callback===null)Ef(Kr);else if(t.startTime<=e)Ef(Kr),t.sortIndex=t.expirationTime,ym(ar,t);else break;t=Ai(Kr)}}function Cm(e){if(eu=!1,_f(e),!Za)if(Ai(ar)!==null)Za=!0,tl||(tl=!0,el());else{var t=Ai(Kr);t!==null&&Em(Cm,t.startTime-e)}}var tl=!1,tu=-1,pw=5,mw=-1;function gw(){return _m?!0:Go.unstable_now()-mw<pw?!1:!0}function bm(){if(_m=!1,tl){var e=Go.unstable_now();mw=e;var t=!0;try{e:{Za=!1,eu&&(eu=!1,hw(tu),tu=-1),Sm=!0;var n=zt;try{t:{_f(e);for(An=Ai(ar);An!==null&&!(An.expirationTime>e&&gw());){var i=An.callback;if(typeof i==="function"){An.callback=null,zt=An.priorityLevel;var r=i(An.expirationTime<=e);if(e=Go.unstable_now(),typeof r==="function"){An.callback=r,_f(e),t=!0;break t}An===Ai(ar)&&Ef(ar),_f(e)}else Ef(ar);An=Ai(ar)}if(An!==null)t=!0;else{var o=Ai(Kr);o!==null&&Em(Cm,o.startTime-e),t=!1}}break e}finally{An=null,zt=n,Sm=!1}t=void 0}}finally{t?el():tl=!1}}}var el;if(typeof fw==="function")el=function(){fw(bm)};else if(typeof MessageChannel<"u")Cf=new MessageChannel,km=Cf.port2,Cf.port1.onmessage=bm,el=function(){km.postMessage(null)};else el=function(){dw(bm,0)};var Cf,km;function Em(e,t){tu=dw(function(){e(Go.unstable_now())},t)}var Of=5,Rf=1,Af=4,Yo=3,vw=null,Tf=2,Mf=function(e){e.callback=null},bw=function(e){0>e||125<e?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):pw=0<e?Math.floor(1000/e):5},Nf=function(){return zt},yw=function(e){switch(zt){case 1:case 2:case 3:var t=3;break;default:t=zt}var n=zt;zt=t;try{return e()}finally{zt=n}},Df=function(){_m=!0},xw=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=zt;zt=e;try{return t()}finally{zt=n}},Wo=function(e,t,n){var i=Go.unstable_now();switch(typeof n==="object"&&n!==null?(n=n.delay,n=typeof n==="number"&&0<n?i+n:i):n=i,e){case 1:var r=-1;break;case 2:r=250;break;case 5:r=1073741823;break;case 4:r=1e4;break;default:r=5000}return r=n+r,e={id:UL++,callback:t,priorityLevel:e,startTime:n,expirationTime:r,sortIndex:-1},n>i?(e.sortIndex=n,ym(Kr,e),Ai(ar)===null&&e===Ai(Kr)&&(eu?(hw(tu),tu=-1):eu=!0,Em(Cm,n-i))):(e.sortIndex=r,ym(ar,e),Za||Sm||(Za=!0,tl||(tl=!0,el()))),e},Lf=gw,ww=function(e){var t=zt;return function(){var n=zt;zt=t;try{return e.apply(this,arguments)}finally{zt=n}}};var ur={};cw(ur,{Activity:()=>Lw,Children:()=>zw,Component:()=>Bw,Fragment:()=>Pw,Profiler:()=>Iw,PureComponent:()=>Hw,StrictMode:()=>Vw,Suspense:()=>Uw,ViewTransition:()=>Kw,__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE:()=>rl,__COMPILER_RUNTIME:()=>jw,addTransitionType:()=>Fw,cache:()=>qw,cacheSignal:()=>$w,cloneElement:()=>Lm,createContext:()=>jr,createElement:()=>Xw,createRef:()=>Gw,forwardRef:()=>Fr,isValidElement:()=>Bf,lazy:()=>Yw,memo:()=>ol,startTransition:()=>Ww,unstable_useCacheRefresh:()=>Qw,use:()=>Jw,useActionState:()=>Zw,useCallback:()=>ot,useContext:()=>qr,useDebugValue:()=>zm,useDeferredValue:()=>e1,useEffect:()=>J,useEffectEvent:()=>t1,useId:()=>Pf,useImperativeHandle:()=>nu,useInsertionEffect:()=>n1,useLayoutEffect:()=>ti,useMemo:()=>je,useOptimistic:()=>i1,useReducer:()=>Bm,useRef:()=>X,useState:()=>W,useSyncExternalStore:()=>$r,useTransition:()=>r1,version:()=>If},{Activity:(H9)=>Lw=H9,Children:(H9)=>zw=H9,Component:(H9)=>Bw=H9,Fragment:(H9)=>Pw=H9,Profiler:(H9)=>Iw=H9,PureComponent:(H9)=>Hw=H9,StrictMode:(H9)=>Vw=H9,Suspense:(H9)=>Uw=H9,ViewTransition:(H9)=>Kw=H9,__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE:(H9)=>rl=H9,__COMPILER_RUNTIME:(H9)=>jw=H9,addTransitionType:(H9)=>Fw=H9,cache:(H9)=>qw=H9,cacheSignal:(H9)=>$w=H9,cloneElement:(H9)=>Lm=H9,createContext:(H9)=>jr=H9,createElement:(H9)=>Xw=H9,createRef:(H9)=>Gw=H9,forwardRef:(H9)=>Fr=H9,isValidElement:(H9)=>Bf=H9,lazy:(H9)=>Yw=H9,memo:(H9)=>ol=H9,startTransition:(H9)=>Ww=H9,unstable_useCacheRefresh:(H9)=>Qw=H9,use:(H9)=>Jw=H9,useActionState:(H9)=>Zw=H9,useCallback:(H9)=>ot=H9,useContext:(H9)=>qr=H9,useDebugValue:(H9)=>zm=H9,useDeferredValue:(H9)=>e1=H9,useEffect:(H9)=>J=H9,useEffectEvent:(H9)=>t1=H9,useId:(H9)=>Pf=H9,useImperativeHandle:(H9)=>nu=H9,useInsertionEffect:(H9)=>n1=H9,useLayoutEffect:(H9)=>ti=H9,useMemo:(H9)=>je=H9,useOptimistic:(H9)=>i1=H9,useReducer:(H9)=>Bm=H9,useRef:(H9)=>X=H9,useState:(H9)=>W=H9,useSyncExternalStore:(H9)=>$r=H9,useTransition:(H9)=>r1=H9,version:(H9)=>If=H9});var Am=Symbol.for("react.transitional.element"),KL=Symbol.for("react.portal"),jL=Symbol.for("react.fragment"),FL=Symbol.for("react.strict_mode"),qL=Symbol.for("react.profiler"),$L=Symbol.for("react.consumer"),XL=Symbol.for("react.context"),GL=Symbol.for("react.forward_ref"),YL=Symbol.for("react.suspense"),WL=Symbol.for("react.memo"),Ew=Symbol.for("react.lazy"),QL=Symbol.for("react.activity"),JL=Symbol.for("react.view_transition"),Sw=Symbol.iterator;function ZL(e){if(e===null||typeof e!=="object")return null;return e=Sw&&e[Sw]||e["@@iterator"],typeof e==="function"?e:null}var Ow={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},Rw=Object.assign,Aw={};function il(e,t,n){this.props=e,this.context=t,this.refs=Aw,this.updater=n||Ow}il.prototype.isReactComponent={};il.prototype.setState=function(e,t){if(typeof e!=="object"&&typeof e!=="function"&&e!=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,e,t,"setState")};il.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function Tw(){}Tw.prototype=il.prototype;function Tm(e,t,n){this.props=e,this.context=t,this.refs=Aw,this.updater=n||Ow}var Mm=Tm.prototype=new Tw;Mm.constructor=Tm;Rw(Mm,il.prototype);Mm.isPureReactComponent=!0;var kw=Array.isArray;function Rm(){}var Le={H:null,A:null,T:null,S:null},Mw=Object.prototype.hasOwnProperty;function Nm(e,t,n){var i=n.ref;return{$$typeof:Am,type:e,key:t,ref:i!==void 0?i:null,props:n}}function ez(e,t){return Nm(e.type,t,e.props)}function Dm(e){return typeof e==="object"&&e!==null&&e.$$typeof===Am}function tz(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(n){return t[n]})}var _w=/\/+/g;function Om(e,t){return typeof e==="object"&&e!==null&&e.key!=null?tz(""+e.key):t.toString(36)}function nz(e){switch(e.status){case"fulfilled":return e.value;case"rejected":throw e.reason;default:switch(typeof e.status==="string"?e.then(Rm,Rm):(e.status="pending",e.then(function(t){e.status==="pending"&&(e.status="fulfilled",e.value=t)},function(t){e.status==="pending"&&(e.status="rejected",e.reason=t)})),e.status){case"fulfilled":return e.value;case"rejected":throw e.reason}}throw e}function nl(e,t,n,i,r){var o=typeof e;if(o==="undefined"||o==="boolean")e=null;var s=!1;if(e===null)s=!0;else switch(o){case"bigint":case"string":case"number":s=!0;break;case"object":switch(e.$$typeof){case Am:case KL:s=!0;break;case Ew:return s=e._init,nl(s(e._payload),t,n,i,r)}}if(s)return r=r(e),s=i===""?"."+Om(e,0):i,kw(r)?(n="",s!=null&&(n=s.replace(_w,"$&/")+"/"),nl(r,t,n,"",function(u){return u})):r!=null&&(Dm(r)&&(r=ez(r,n+(r.key==null||e&&e.key===r.key?"":(""+r.key).replace(_w,"$&/")+"/")+s)),t.push(r)),1;s=0;var l=i===""?".":i+":";if(kw(e))for(var a=0;a<e.length;a++)i=e[a],o=l+Om(i,a),s+=nl(i,t,n,o,r);else if(a=ZL(e),typeof a==="function")for(e=a.call(e),a=0;!(i=e.next()).done;)i=i.value,o=l+Om(i,a++),s+=nl(i,t,n,o,r);else if(o==="object"){if(typeof e.then==="function")return nl(nz(e),t,n,i,r);throw t=String(e),Error("Objects are not valid as a React child (found: "+(t==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":t)+"). If you meant to render a collection of children, use an array instead.")}return s}function zf(e,t,n){if(e==null)return e;var i=[],r=0;return nl(e,i,"","",function(o){return t.call(n,o,r++)}),i}function iz(e){if(e._status===-1){var t=e._result,n=t();n.then(function(i){if(e._status===0||e._status===-1)e._status=1,e._result=i,n.status===void 0&&(n.status="fulfilled",n.value=i)},function(i){if(e._status===0||e._status===-1)e._status=2,e._result=i,n.status===void 0&&(n.status="rejected",n.reason=i)}),e._status===-1&&(e._status=0,e._result=n)}if(e._status===1)return e._result.default;throw e._result}var Cw=typeof reportError==="function"?reportError:function(e){if(typeof window==="object"&&typeof window.ErrorEvent==="function"){var t=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof e==="object"&&e!==null&&typeof e.message==="string"?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process==="object"&&typeof process.emit==="function"){process.emit("uncaughtException",e);return}console.error(e)};function Nw(e){var t=Le.T,n={};n.types=t!==null?t.types:null,Le.T=n;try{var i=e(),r=Le.S;r!==null&&r(n,i),typeof i==="object"&&i!==null&&typeof i.then==="function"&&i.then(Rm,Cw)}catch(o){Cw(o)}finally{t!==null&&n.types!==null&&(t.types=n.types),Le.T=t}}function Dw(e){var t=Le.T;if(t!==null){var n=t.types;n===null?t.types=[e]:n.indexOf(e)===-1&&n.push(e)}else Nw(Dw.bind(null,e))}var rz={map:zf,forEach:function(e,t,n){zf(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return zf(e,function(){t++}),t},toArray:function(e){return zf(e,function(t){return t})||[]},only:function(e){if(!Dm(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};var Lw=QL,zw=rz,Bw=il,Pw=jL,Iw=qL,Hw=Tm,Vw=FL,Uw=YL,Kw=JL,rl=Le,jw={__proto__:null,c:function(e){return Le.H.useMemoCache(e)}},Fw=Dw,qw=function(e){return function(){return e.apply(null,arguments)}},$w=function(){return null},Lm=function(e,t,n){if(e===null||e===void 0)throw Error("The argument must be a React element, but you passed "+e+".");var i=Rw({},e.props),r=e.key;if(t!=null)for(o in t.key!==void 0&&(r=""+t.key),t)!Mw.call(t,o)||o==="key"||o==="__self"||o==="__source"||o==="ref"&&t.ref===void 0||(i[o]=t[o]);var o=arguments.length-2;if(o===1)i.children=n;else if(1<o){for(var s=Array(o),l=0;l<o;l++)s[l]=arguments[l+2];i.children=s}return Nm(e.type,r,i)},jr=function(e){return e={$$typeof:XL,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null},e.Provider=e,e.Consumer={$$typeof:$L,_context:e},e},Xw=function(e,t,n){var i,r={},o=null;if(t!=null)for(i in t.key!==void 0&&(o=""+t.key),t)Mw.call(t,i)&&i!=="key"&&i!=="__self"&&i!=="__source"&&(r[i]=t[i]);var s=arguments.length-2;if(s===1)r.children=n;else if(1<s){for(var l=Array(s),a=0;a<s;a++)l[a]=arguments[a+2];r.children=l}if(e&&e.defaultProps)for(i in s=e.defaultProps,s)r[i]===void 0&&(r[i]=s[i]);return Nm(e,o,r)},Gw=function(){return{current:null}},Fr=function(e){return{$$typeof:GL,render:e}},Bf=Dm,Yw=function(e){return{$$typeof:Ew,_payload:{_status:-1,_result:e},_init:iz}},ol=function(e,t){return{$$typeof:WL,type:e,compare:t===void 0?null:t}},Ww=Nw,Qw=function(){return Le.H.useCacheRefresh()},Jw=function(e){return Le.H.use(e)},Zw=function(e,t,n){return Le.H.useActionState(e,t,n)},ot=function(e,t){return Le.H.useCallback(e,t)},qr=function(e){return Le.H.useContext(e)},zm=function(){},e1=function(e,t){return Le.H.useDeferredValue(e,t)},J=function(e,t){return Le.H.useEffect(e,t)},t1=function(e){return Le.H.useEffectEvent(e)},Pf=function(){return Le.H.useId()},nu=function(e,t,n){return Le.H.useImperativeHandle(e,t,n)},n1=function(e,t){return Le.H.useInsertionEffect(e,t)},ti=function(e,t){return Le.H.useLayoutEffect(e,t)},je=function(e,t){return Le.H.useMemo(e,t)},i1=function(e,t){return Le.H.useOptimistic(e,t)},Bm=function(e,t,n){return Le.H.useReducer(e,t,n)},X=function(e){return Le.H.useRef(e)},W=function(e){return Le.H.useState(e)},$r=function(e,t,n){return Le.H.useSyncExternalStore(e,t,n)},r1=function(){return Le.H.useTransition()},If="19.3.0";function l1(){if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!=="function")return;try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(l1)}catch(e){console.error(e)}}function s1(e){var t="https://react.dev/errors/"+e;if(1<arguments.length){t+="?args[]="+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+="&args[]="+encodeURIComponent(arguments[n])}return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function Xr(){}var iu={d:{f:Xr,r:function(){throw Error(s1(522))},D:Xr,C:Xr,L:Xr,m:Xr,X:Xr,S:Xr,M:Xr},p:0,findDOMNode:null},oz=Symbol.for("react.portal");var o1=Symbol.for("react.optimistic_key");function sz(e,t,n){var i=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:oz,key:i==null?null:i===o1?o1:""+i,children:e,containerInfo:t,implementation:n}}var Pm=rl;var Im=iu;var Hm=function(e,t){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)throw Error(s1(299));return sz(e,t,null,n)},Hf=function(e){var t=Pm.T,n=iu.p;try{if(Pm.T=null,iu.p=2,e)return e()}finally{Pm.T=t,iu.p=n,iu.d.f()}};l1();function R(e){var t="https://react.dev/errors/"+e;if(1<arguments.length){t+="?args[]="+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+="&args[]="+encodeURIComponent(arguments[n])}return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function lz(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function Xu(e){for(var t=e,n=t;n&&!n.alternate;)t=n,(t.flags&4098)!==0&&(e=t.return),n=t.return;for(;t.return;)t=t.return;return t.tag===3?e:null}function FS(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function qS(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function a1(e){if(Xu(e)!==e)throw Error(R(188))}function az(e){var t=e.alternate;if(!t){if(t=Xu(e),t===null)throw Error(R(188));return t!==e?null:e}for(var n=e,i=t;;){var r=n.return;if(r===null)break;var o=r.alternate;if(o===null){if(i=r.return,i!==null){n=i;continue}break}if(r.child===o.child){for(o=r.child;o;){if(o===n)return a1(r),e;if(o===i)return a1(r),t;o=o.sibling}throw Error(R(188))}if(n.return!==i.return)n=r,i=o;else{for(var s=!1,l=r.child;l;){if(l===n){s=!0,n=r,i=o;break}if(l===i){s=!0,i=r,n=o;break}l=l.sibling}if(!s){for(l=o.child;l;){if(l===n){s=!0,n=o,i=r;break}if(l===i){s=!0,i=o,n=r;break}l=l.sibling}if(!s)throw Error(R(189))}}if(n.alternate!==i)throw Error(R(190))}if(n.tag!==3)throw Error(R(188));return n.stateNode.current===n?e:t}function $S(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=$S(e),t!==null)return t;e=e.sibling}return null}function tn(e,t,n,i,r,o){for(;e!==null;){if((e.tag===5||e.tag===27||e.tag===6)&&n(e,i,r,o)||(e.tag!==22||e.memoizedState===null)&&(t||e.tag!==5&&e.tag!==27)&&tn(e.child,t,n,i,r,o))return!0;e=e.sibling}return!1}function xs(e){for(e=e.return;e!==null;){if(e.tag===3||e.tag===5||e.tag===27)return e;e=e.return}return null}function u1(e){var t=!1;for(e=e.return;e!==null;){if(e.tag===4&&(t=!0),e.tag===3||e.tag===5||e.tag===27)break;e=e.return}return t}function XS(e){var t=[null,null],n=xs(e);if(n===null)return t;return GS(t,e,n.child,{foundSelf:!1}),t}function GS(e,t,n,i){for(;n!==null;){if(n===t)i.foundSelf=!0;else if(n.tag===5||n.tag===27||n.tag===6){if(i.foundSelf)return e[1]=n,!0;e[0]=n}else if((n.tag!==22||n.memoizedState===null)&&GS(e,t,n.child,i))return!0;n=n.sibling}return!1}function dt(e){switch(e.tag){case 5:case 27:case 6:return e.stateNode;case 3:return e.stateNode.containerInfo;default:throw Error(R(559))}}var dl=null,vg=null;function uz(e,t,n){return e===n?!0:e===t?(dl=e,!0):!1}function cz(e,t,n){return e===n?(vg=e,!1):e===t?(vg!==null&&(dl=e),!0):!1}function c1(e){if(e===null)return null;do e=e===null?null:e.return;while(e&&e.tag!==5&&e.tag!==27&&e.tag!==3);return e?e:null}function bg(e,t,n){for(var i=0,r=e;r;r=n(r))i++;r=0;for(var o=t;o;o=n(o))r++;for(;0<i-r;)e=n(e),i--;for(;0<r-i;)t=n(t),r--;for(;i--;){if(e===t||t!==null&&e===t.alternate)return e;e=n(e),t=n(t)}return null}var Me=Object.assign,fz=Symbol.for("react.element"),Vf=Symbol.for("react.transitional.element"),uu=Symbol.for("react.portal"),hl=Symbol.for("react.fragment"),YS=Symbol.for("react.strict_mode"),yg=Symbol.for("react.profiler"),WS=Symbol.for("react.consumer"),zi=Symbol.for("react.context"),Tv=Symbol.for("react.forward_ref"),xg=Symbol.for("react.suspense"),wg=Symbol.for("react.suspense_list"),Mv=Symbol.for("react.memo"),Qr=Symbol.for("react.lazy"),Sg=Symbol.for("react.activity"),dz=Symbol.for("react.legacy_hidden"),hz=Symbol.for("react.memo_cache_sentinel"),kg=Symbol.for("react.view_transition"),pz=Symbol.for("react.recoverable"),f1=Symbol.iterator;function ru(e){if(e===null||typeof e!=="object")return null;return e=f1&&e[f1]||e["@@iterator"],typeof e==="function"?e:null}var mz=Symbol.for("react.client.reference");function _g(e){if(e==null)return null;if(typeof e==="function")return e.$$typeof===mz?null:e.displayName||e.name||null;if(typeof e==="string")return e;switch(e){case hl:return"Fragment";case yg:return"Profiler";case YS:return"StrictMode";case xg:return"Suspense";case wg:return"SuspenseList";case Sg:return"Activity";case kg:return"ViewTransition"}if(typeof e==="object")switch(e.$$typeof){case uu:return"Portal";case zi:return e.displayName||"Context";case WS:return(e._context.displayName||"Context")+".Consumer";case Tv:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case Mv:return t=e.displayName||null,t!==null?t:_g(e.type)||"Memo";case Qr:t=e._payload,e=e._init;try{return _g(e(t))}catch(n){}}return null}var cu=Array.isArray,ie=rl,be=Im,os={pending:!1,data:null,method:null,action:null},Cg=[],pl=-1;function Ki(e){return{current:e}}function At(e){0>pl||(e.current=Cg[pl],Cg[pl]=null,pl--)}function Pe(e,t){pl++,Cg[pl]=e.current,e.current=t}var Hi=Ki(null),Mu=Ki(null),so=Ki(null),kd=Ki(null);function _d(e,t){switch(Pe(so,t),Pe(Mu,e),Pe(Hi,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)?(e=e.namespaceURI)?kS(e):0:0;break;default:if(e=t.tagName,t=t.namespaceURI)t=kS(t),e=vC(t,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}At(Hi),Pe(Hi,e)}function Ll(){At(Hi),At(Mu),At(so)}function Eg(e){var t=e.memoizedState;t!==null&&(Fl._currentValue=t.memoizedState,Pe(kd,e)),t=Hi.current;var n=vC(t,e.type);t!==n&&(Pe(Mu,e),Pe(Hi,n))}function Cd(e){Mu.current===e&&(At(Hi),At(Mu)),kd.current===e&&(At(kd),Fl._currentValue=os)}var Um,d1;function Yr(e){if(Um===void 0)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);Um=t&&t[1]||"",d1=-1<n.stack.indexOf(`
2
2
  at`)?" (<anonymous>)":-1<n.stack.indexOf("@")?"@unknown:0:0":""}return`
3
- `+zm+e+n1}var Bm=!1;function Pm(e,t){if(!e||Bm)return"";Bm=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var i={DetermineComponentFrameRoot:function(){try{if(t){var f=function(){throw Error()};if(Object.defineProperty(f.prototype,"props",{set:function(){throw Error()}}),typeof Reflect==="object"&&Reflect.construct){try{Reflect.construct(f,[])}catch(m){var d=m}Reflect.construct(e,[],f)}else{try{f.call()}catch(m){d=m}f=!1;try{var h=Object.getOwnPropertyDescriptor(e.prototype,"props");Object.defineProperty(e.prototype,"props",{configurable:!0,set:function(){throw Error()}}),f=!0,new e}finally{f&&(h!==void 0?Object.defineProperty(e.prototype,"props",h):delete e.prototype.props)}}}else{try{throw Error()}catch(m){d=m}(f=e())&&typeof f.catch==="function"&&f.catch(function(){})}}catch(m){if(m&&d&&typeof m.stack==="string")return[m.stack,d.stack]}return[null,null]}};i.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var r=Object.getOwnPropertyDescriptor(i.DetermineComponentFrameRoot,"name");r&&r.configurable&&Object.defineProperty(i.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var o=i.DetermineComponentFrameRoot(),s=o[0],l=o[1];if(s&&l){var a=s.split(`
3
+ `+Um+e+d1}var Km=!1;function jm(e,t){if(!e||Km)return"";Km=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var i={DetermineComponentFrameRoot:function(){try{if(t){var f=function(){throw Error()};if(Object.defineProperty(f.prototype,"props",{set:function(){throw Error()}}),typeof Reflect==="object"&&Reflect.construct){try{Reflect.construct(f,[])}catch(m){var d=m}Reflect.construct(e,[],f)}else{try{f.call()}catch(m){d=m}f=!1;try{var h=Object.getOwnPropertyDescriptor(e.prototype,"props");Object.defineProperty(e.prototype,"props",{configurable:!0,set:function(){throw Error()}}),f=!0,new e}finally{f&&(h!==void 0?Object.defineProperty(e.prototype,"props",h):delete e.prototype.props)}}}else{try{throw Error()}catch(m){d=m}(f=e())&&typeof f.catch==="function"&&f.catch(function(){})}}catch(m){if(m&&d&&typeof m.stack==="string")return[m.stack,d.stack]}return[null,null]}};i.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var r=Object.getOwnPropertyDescriptor(i.DetermineComponentFrameRoot,"name");r&&r.configurable&&Object.defineProperty(i.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var o=i.DetermineComponentFrameRoot(),s=o[0],l=o[1];if(s&&l){var a=s.split(`
4
4
  `),u=l.split(`
5
5
  `);for(r=i=0;i<a.length&&!a[i].includes("DetermineComponentFrameRoot");)i++;for(;r<u.length&&!u[r].includes("DetermineComponentFrameRoot");)r++;if(i===a.length||r===u.length)for(i=a.length-1,r=u.length-1;1<=i&&0<=r&&a[i]!==u[r];)r--;for(;1<=i&&0<=r;i--,r--)if(a[i]!==u[r]){if(i!==1||r!==1)do if(i--,r--,0>r||a[i]!==u[r]){var c=`
6
- `+a[i].replace(" at new "," at ");return e.displayName&&c.includes("<anonymous>")&&(c=c.replace("<anonymous>",e.displayName)),c}while(1<=i&&0<=r);break}}}finally{Bm=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:"")?Yr(n):""}function XL(e,t){switch(e.tag){case 26:case 27:case 5:return Yr(e.type);case 16:return Yr("Lazy");case 13:return e.child!==t&&t!==null?Yr("Suspense Fallback"):Yr("Suspense");case 19:return Yr("SuspenseList");case 0:case 15:return Pm(e.type,!1);case 11:return Pm(e.type.render,!1);case 1:return Pm(e.type,!0);case 31:return Yr("Activity");case 30:return Yr("ViewTransition");default:return""}}function i1(e){try{var t="",n=null;do t+=XL(e,n),n=e,e=e.return;while(e);return t}catch(i){return`
6
+ `+a[i].replace(" at new "," at ");return e.displayName&&c.includes("<anonymous>")&&(c=c.replace("<anonymous>",e.displayName)),c}while(1<=i&&0<=r);break}}}finally{Km=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:"")?Yr(n):""}function gz(e,t){switch(e.tag){case 26:case 27:case 5:return Yr(e.type);case 16:return Yr("Lazy");case 13:return e.child!==t&&t!==null?Yr("Suspense Fallback"):Yr("Suspense");case 19:return Yr("SuspenseList");case 0:case 15:return jm(e.type,!1);case 11:return jm(e.type.render,!1);case 1:return jm(e.type,!0);case 31:return Yr("Activity");case 30:return Yr("ViewTransition");default:return""}}function h1(e){try{var t="",n=null;do t+=gz(e,n),n=e,e=e.return;while(e);return t}catch(i){return`
7
7
  Error generating stack: `+i.message+`
8
- `+i.stack}}var wg=Object.prototype.hasOwnProperty,Ev=Go,Im=Of,GL=Tf,YL=Rf,hn=ei,WL=Af,US=_f,jS=Ef,Sd=Xo,QL=Cf,KS=kf,JL=void 0,ZL=void 0,ju=null,pn=null;function eo(e){if(typeof JL==="function"&&ZL(e),pn&&typeof pn.setStrictMode==="function")try{pn.setStrictMode(ju,e)}catch(t){}}var mn=Math.clz32?Math.clz32:nz,{log:ez,LN2:tz}=Math;function nz(e){return e>>>=0,e===0?32:31-(ez(e)/tz|0)|0}var Pf=256,If=262144,Vf=4194304;function Qo(e){var t=e&42;if(t!==0)return t;switch(e&-e){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 e&-e;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function Gd(e,t,n){var i=e.pendingLanes;if(i===0)return 0;var r=0,o=e.suspendedLanes,s=e.pingedLanes;e=e.warmLanes;var l=i&134217727;return l!==0?(i=l&~o,i!==0?r=Qo(i):(s&=l,s!==0?r=Qo(s):n||(n=l&~e,n!==0&&(r=Qo(n))))):(l=i&~o,l!==0?r=Qo(l):s!==0?r=Qo(s):n||(n=i&~e,n!==0&&(r=Qo(n)))),r===0?0:t!==0&&t!==r&&(t&o)===0&&(o=r&-r,n=t&-t,o>=n||o===32&&(n&4194048)!==0)?t:r}function Ku(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function FS(e,t){(t&8)!==0&&(t|=t&32);var n=e.entangledLanes;if(n!==0)for(e=e.entanglements,n&=t;0<n;){var i=31-mn(n),r=1<<i;t|=e[i],n&=~r}return t}function iz(e,t){switch(e){case 1:case 2:case 4:case 8:case 64:return t+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5000;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function qS(){var e=Vf;return Vf<<=1,(Vf&62914560)===0&&(Vf=4194304),e}function Vm(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function Yd(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function rz(e,t,n,i,r,o){var s=e.pendingLanes;e.pendingLanes=n,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=n,e.entangledLanes&=n,e.errorRecoveryDisabledLanes&=n,e.shellSuspendCounter=0;var{entanglements:l,expirationTimes:a,hiddenUpdates:u}=e;for(n=s&~n;0<n;){var c=31-mn(n),f=1<<c;l[c]=0,a[c]=-1;var d=u[c];if(d!==null)for(u[c]=null,c=0;c<d.length;c++){var h=d[c];h!==null&&(h.lane&=-536870913)}n&=~f}i!==0&&$S(e,i,0),o!==0&&r===0&&e.tag!==0&&(e.suspendedLanes|=o&~(s&~t))}function $S(e,t,n){e.pendingLanes|=t,e.suspendedLanes&=~t;var i=31-mn(t);e.entangledLanes|=t,e.entanglements[i]=e.entanglements[i]|1073741824|n&261930}function XS(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var i=31-mn(n),r=1<<i;r&t|e[i]&t&&(e[i]|=t),n&=~r}}function GS(e,t){var n=t&-t;return n=(n&42)!==0?1:YS(n),(n&(e.suspendedLanes|t))!==0?0:n}function YS(e){switch(e){case 2:e=1;break;case 8:e=4;break;case 32:e=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:e=128;break;case 268435456:e=134217728;break;default:e=0}return e}function Ov(e){return e&=-e,2<e?8<e?(e&134217727)!==0?32:268435456:8:2}function WS(){var e=be.p;if(e!==0)return e;return e=window.event,e===void 0?32:OC(e.type)}function r1(e,t){var n=be.p;try{return be.p=e,t()}finally{be.p=n}}var Sr=Math.random().toString(36).slice(2),_t="__reactFiber$"+Sr,nn="__reactProps$"+Sr,Fu="__reactContainer$"+Sr,o1="__reactEvents$"+Sr,oz="__reactListeners$"+Sr,sz="__reactHandles$"+Sr,s1="__reactResources$"+Sr,qu="__reactMarker$"+Sr,kd="__reactLoad$"+Sr;function Wd(e){delete e[_t],delete e[nn],delete e[oz],delete e[sz]}function ts(e){var t;if(t=e[_t])return t;for(var n=e.parentNode;n;){if(t=n[Fu]||n[_t]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=wS(e);e!==null;){if(n=e[_t])return n;e=wS(e)}return t}e=n,n=e.parentNode}return null}function jl(e){if(e=e[_t]||e[Fu]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function ou(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(A(33))}function yl(e){var t=e[s1];return t||(t=e[s1]={hoistableStyles:new Map,hoistableScripts:new Map}),t}function gt(e){e[qu]=!0}function QS(e){e[kd]=void 0}var JS=new Set,ZS={};function ys(e,t){Tl(e,t),Tl(e+"Capture",t)}function Tl(e,t){ZS[e]=t;for(e=0;e<t.length;e++)JS.add(t[e])}var lz=RegExp("^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$"),l1={},a1={};function az(e){if(wg.call(a1,e))return!0;if(wg.call(l1,e))return!1;if(lz.test(e))return a1[e]=!0;return l1[e]=!0,!1}var me=!1;function u1(){var e=me;return me=!1,e}function Zf(e,t,n){if(az(t))if(n===null)e.removeAttribute(t);else{switch(typeof n){case"undefined":case"function":case"symbol":e.removeAttribute(t);return;case"boolean":var i=t.toLowerCase().slice(0,5);if(i!=="data-"&&i!=="aria-"){e.removeAttribute(t);return}}e.setAttribute(t,n)}}function Hf(e,t,n){if(n===null)e.removeAttribute(t);else{switch(typeof n){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(t);return}e.setAttribute(t,n)}}function cr(e,t,n,i){if(i===null)e.removeAttribute(n);else{switch(typeof i){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(n);return}e.setAttributeNS(t,n,i)}}function un(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function ek(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function uz(e,t,n){var i=Object.getOwnPropertyDescriptor(e.constructor.prototype,t);if(!e.hasOwnProperty(t)&&typeof i<"u"&&typeof i.get==="function"&&typeof i.set==="function"){var{get:r,set:o}=i;return Object.defineProperty(e,t,{configurable:!0,get:function(){return r.call(this)},set:function(s){n=""+s,o.call(this,s)}}),Object.defineProperty(e,t,{enumerable:i.enumerable}),{getValue:function(){return n},setValue:function(s){n=""+s},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Sg(e){if(!e._valueTracker){var t=ek(e)?"checked":"value";e._valueTracker=uz(e,t,""+e[t])}}function tk(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),i="";return e&&(i=ek(e)?e.checked?"true":"false":e.value),e=i,e!==n?(t.setValue(e),!0):!1}var cz=/[\n"\\]/g;function Ln(e){return e.replace(cz,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function kg(e,t,n,i,r,o,s,l){if(e.name="",s!=null&&typeof s!=="function"&&typeof s!=="symbol"&&typeof s!=="boolean"?e.type=s:e.removeAttribute("type"),t!=null)if(s==="number"){if(t===0&&e.value===""||e.value!=t)e.value=""+un(t)}else e.value!==""+un(t)&&(e.value=""+un(t));else s!=="submit"&&s!=="reset"||e.removeAttribute("value");t!=null?s==="number"&&e.value==t?Hm(e,un(e.value)):Hm(e,un(t)):n!=null?Hm(e,un(n)):i!=null&&e.removeAttribute("value"),r==null&&o!=null&&(e.defaultChecked=!!o),r!=null&&(e.checked=r&&typeof r!=="function"&&typeof r!=="symbol"),l!=null&&typeof l!=="function"&&typeof l!=="symbol"&&typeof l!=="boolean"?e.name=""+un(l):e.removeAttribute("name")}function nk(e,t,n,i,r,o,s,l){if(o!=null&&typeof o!=="function"&&typeof o!=="symbol"&&typeof o!=="boolean"&&(e.type=o),t!=null||n!=null){if(!(o!=="submit"&&o!=="reset"||t!==void 0&&t!==null)){Sg(e);return}n=n!=null?""+un(n):"",t=t!=null?""+un(t):n,l||t===e.value||(e.value=t),e.defaultValue=t}i=i!=null?i:r,i=typeof i!=="function"&&typeof i!=="symbol"&&!!i,e.checked=l?e.checked:!!i,e.defaultChecked=!!i,s!=null&&typeof s!=="function"&&typeof s!=="symbol"&&typeof s!=="boolean"&&(e.name=s),Sg(e)}function Hm(e,t){e.defaultValue!==""+t&&(e.defaultValue=""+t)}function xl(e,t,n,i){if(e=e.options,t){t={};for(var r=0;r<n.length;r++)t["$"+n[r]]=!0;for(n=0;n<e.length;n++)r=t.hasOwnProperty("$"+e[n].value),e[n].selected!==r&&(e[n].selected=r),r&&i&&(e[n].defaultSelected=!0)}else{n=""+un(n),t=null;for(r=0;r<e.length;r++){if(e[r].value===n){e[r].selected=!0,i&&(e[r].defaultSelected=!0);return}t!==null||e[r].disabled||(t=e[r])}t!==null&&(t.selected=!0)}}function ik(e,t,n){if(t!=null&&(t=""+un(t),t!==e.value&&(e.value=t),n==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=n!=null?""+un(n):""}function rk(e,t,n,i){if(t==null){if(i!=null){if(n!=null)throw Error(A(92));if(ru(i)){if(1<i.length)throw Error(A(93));i=i[0]}n=i}n==null&&(n=""),t=n}n=un(t),e.defaultValue=n,i=e.textContent,i===n&&i!==""&&i!==null&&(e.value=i),Sg(e)}function Ml(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var fz=new Set("animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp".split(" "));function c1(e,t,n){var i=t.indexOf("--")===0;n==null||typeof n==="boolean"||n===""?i?e.setProperty(t,""):t==="float"?e.cssFloat="":e[t]="":i?e.setProperty(t,n):typeof n!=="number"||n===0||fz.has(t)?t==="float"?e.cssFloat=n:e[t]=(""+n).trim():e[t]=n+"px"}function ok(e,t,n){if(t!=null&&typeof t!=="object")throw Error(A(62));if(e=e.style,n!=null){for(var i in n)!n.hasOwnProperty(i)||t!=null&&t.hasOwnProperty(i)||(i.indexOf("--")===0?e.setProperty(i,""):i==="float"?e.cssFloat="":e[i]="",me=!0);for(var r in t)i=t[r],t.hasOwnProperty(r)&&n[r]!==i&&(c1(e,r,i),me=!0)}else for(var o in t)t.hasOwnProperty(o)&&c1(e,o,t[o])}function Av(e){if(e.indexOf("-")===-1)return!1;switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var dz=new Map([["acceptCharset","accept-charset"],["htmlFor","for"],["httpEquiv","http-equiv"],["crossOrigin","crossorigin"],["accentHeight","accent-height"],["alignmentBaseline","alignment-baseline"],["arabicForm","arabic-form"],["baselineShift","baseline-shift"],["capHeight","cap-height"],["clipPath","clip-path"],["clipRule","clip-rule"],["colorInterpolation","color-interpolation"],["colorInterpolationFilters","color-interpolation-filters"],["colorProfile","color-profile"],["colorRendering","color-rendering"],["dominantBaseline","dominant-baseline"],["enableBackground","enable-background"],["fillOpacity","fill-opacity"],["fillRule","fill-rule"],["floodColor","flood-color"],["floodOpacity","flood-opacity"],["fontFamily","font-family"],["fontSize","font-size"],["fontSizeAdjust","font-size-adjust"],["fontStretch","font-stretch"],["fontStyle","font-style"],["fontVariant","font-variant"],["fontWeight","font-weight"],["glyphName","glyph-name"],["glyphOrientationHorizontal","glyph-orientation-horizontal"],["glyphOrientationVertical","glyph-orientation-vertical"],["horizAdvX","horiz-adv-x"],["horizOriginX","horiz-origin-x"],["imageRendering","image-rendering"],["letterSpacing","letter-spacing"],["lightingColor","lighting-color"],["markerEnd","marker-end"],["markerMid","marker-mid"],["markerStart","marker-start"],["maskType","mask-type"],["overlinePosition","overline-position"],["overlineThickness","overline-thickness"],["paintOrder","paint-order"],["panose-1","panose-1"],["pointerEvents","pointer-events"],["renderingIntent","rendering-intent"],["shapeRendering","shape-rendering"],["stopColor","stop-color"],["stopOpacity","stop-opacity"],["strikethroughPosition","strikethrough-position"],["strikethroughThickness","strikethrough-thickness"],["strokeDasharray","stroke-dasharray"],["strokeDashoffset","stroke-dashoffset"],["strokeLinecap","stroke-linecap"],["strokeLinejoin","stroke-linejoin"],["strokeMiterlimit","stroke-miterlimit"],["strokeOpacity","stroke-opacity"],["strokeWidth","stroke-width"],["textAnchor","text-anchor"],["textDecoration","text-decoration"],["textRendering","text-rendering"],["transformOrigin","transform-origin"],["underlinePosition","underline-position"],["underlineThickness","underline-thickness"],["unicodeBidi","unicode-bidi"],["unicodeRange","unicode-range"],["unitsPerEm","units-per-em"],["vAlphabetic","v-alphabetic"],["vHanging","v-hanging"],["vIdeographic","v-ideographic"],["vMathematical","v-mathematical"],["vectorEffect","vector-effect"],["vertAdvY","vert-adv-y"],["vertOriginX","vert-origin-x"],["vertOriginY","vert-origin-y"],["wordSpacing","word-spacing"],["writingMode","writing-mode"],["xmlnsXlink","xmlns:xlink"],["xHeight","x-height"]]),hz=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function ed(e){return hz.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function Bi(){}var _g=null;function Rv(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var cl=null,wl=null;function f1(e){var t=jl(e);if(t&&(e=t.stateNode)){var n=e[nn]||null;e:switch(e=t.stateNode,t.type){case"input":if(kg(e,n.value,n.defaultValue,n.defaultValue,n.checked,n.defaultChecked,n.type,n.name),t=n.name,n.type==="radio"&&t!=null){for(n=e;n.parentNode;)n=n.parentNode;n=n.querySelectorAll('input[name="'+Ln(""+t)+'"][type="radio"]');for(t=0;t<n.length;t++){var i=n[t];if(i!==e&&i.form===e.form){var r=i[nn]||null;if(!r)throw Error(A(90));kg(i,r.value,r.defaultValue,r.defaultValue,r.checked,r.defaultChecked,r.type,r.name)}}for(t=0;t<n.length;t++)i=n[t],i.form===e.form&&tk(i)}break e;case"textarea":ik(e,n.value,n.defaultValue);break e;case"select":t=n.value,t!=null&&xl(e,!!n.multiple,t,!1)}}}var Um=!1;function sk(e,t,n){if(Um)return e(t,n);Um=!0;try{var i=e(t);return i}finally{if(Um=!1,cl!==null||wl!==null){if(ch(),cl&&(t=cl,e=wl,wl=cl=null,f1(t),e))for(t=0;t<e.length;t++)f1(e[t])}}}function Eu(e,t){var n=e.stateNode;if(n===null)return null;var i=n[nn]||null;if(i===null)return null;n=i[t];e:switch(t){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(i=!i.disabled)||(e=e.type,i=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!i;break e;default:e=!1}if(e)return null;if(n&&typeof n!=="function")throw Error(A(231,t,typeof n));return n}var gr=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Cg=!1;if(gr)try{Jo={},Object.defineProperty(Jo,"passive",{get:function(){Cg=!0}}),window.addEventListener("test",Jo,Jo),window.removeEventListener("test",Jo,Jo)}catch(e){Cg=!1}var Jo,to=null,Tv=null,td=null;function lk(){if(td)return td;var e,t=Tv,n=t.length,i,r="value"in to?to.value:to.textContent,o=r.length;for(e=0;e<n&&t[e]===r[e];e++);var s=n-e;for(i=1;i<=s&&t[n-i]===r[o-i];i++);return td=r.slice(e,1<i?1-i:void 0)}function nd(e){var t=e.keyCode;return"charCode"in e?(e=e.charCode,e===0&&t===13&&(e=13)):e=t,e===10&&(e=13),32<=e||e===13?e:0}function Uf(){return!0}function d1(){return!1}function Ft(e){function t(n,i,r,o,s){this._reactName=n,this._targetInst=r,this.type=i,this.nativeEvent=o,this.target=s,this.currentTarget=null;for(var l in e)e.hasOwnProperty(l)&&(n=e[l],this[l]=n?n(o):o[l]);return this.isDefaultPrevented=(o.defaultPrevented!=null?o.defaultPrevented:o.returnValue===!1)?Uf:d1,this.isPropagationStopped=d1,this}return Te(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var n=this.nativeEvent;n&&(n.preventDefault?n.preventDefault():typeof n.returnValue!=="unknown"&&(n.returnValue=!1),this.isDefaultPrevented=Uf)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!=="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=Uf)},persist:function(){},isPersistent:Uf}),t}var xo={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Qd=Ft(xo),$u=Te({},xo,{view:0,detail:0}),pz=Ft($u),jm,Km,Za,Jd=Te({},$u,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Mv,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){if("movementX"in e)return e.movementX;return e!==Za&&(Za&&e.type==="mousemove"?(jm=e.screenX-Za.screenX,Km=e.screenY-Za.screenY):Km=jm=0,Za=e),jm},movementY:function(e){return"movementY"in e?e.movementY:Km}}),h1=Ft(Jd),mz=Te({},Jd,{dataTransfer:0}),gz=Ft(mz),vz=Te({},$u,{relatedTarget:0}),Fm=Ft(vz),bz=Te({},xo,{animationName:0,elapsedTime:0,pseudoElement:0}),yz=Ft(bz),xz=Te({},xo,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),wz=Ft(xz),Sz=Te({},xo,{data:0}),p1=Ft(Sz),kz={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},_z={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},Cz={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Ez(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=Cz[e])?!!t[e]:!1}function Mv(){return Ez}var Oz=Te({},$u,{key:function(e){if(e.key){var t=kz[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=nd(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?_z[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Mv,charCode:function(e){return e.type==="keypress"?nd(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?nd(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),Az=Ft(Oz),Rz=Te({},Jd,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),m1=Ft(Rz),Tz=Te({},xo,{submitter:0}),Mz=Ft(Tz),Nz=Te({},$u,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Mv}),Dz=Ft(Nz),Lz=Te({},xo,{propertyName:0,elapsedTime:0,pseudoElement:0}),zz=Ft(Lz),Bz=Te({},Jd,{deltaX:function(e){return"deltaX"in e?e.deltaX:("wheelDeltaX"in e)?-e.wheelDeltaX:0},deltaY:function(e){return"deltaY"in e?e.deltaY:("wheelDeltaY"in e)?-e.wheelDeltaY:("wheelDelta"in e)?-e.wheelDelta:0},deltaZ:0,deltaMode:0}),Pz=Ft(Bz),Iz=Te({},xo,{newState:0,oldState:0,source:0}),Vz=Ft(Iz),Hz=[9,13,27,32],Nv=gr&&"CompositionEvent"in window,du=null;gr&&"documentMode"in document&&(du=document.documentMode);var Uz=gr&&"TextEvent"in window&&!du,ak=gr&&(!Nv||du&&8<du&&11>=du),g1=String.fromCharCode(32),v1=!1;function uk(e,t){switch(e){case"keyup":return Hz.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function ck(e){return e=e.detail,typeof e==="object"&&"data"in e?e.data:null}var fl=!1;function jz(e,t){switch(e){case"compositionend":return ck(t);case"keypress":if(t.which!==32)return null;return v1=!0,g1;case"textInput":return e=t.data,e===g1&&v1?null:e;default:return null}}function Kz(e,t){if(fl)return e==="compositionend"||!Nv&&uk(e,t)?(e=lk(),td=Tv=to=null,fl=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case"compositionend":return ak&&t.locale!=="ko"?null:t.data;default:return null}}var Fz={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function b1(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!Fz[e.type]:t==="textarea"?!0:!1}function fk(e,t,n,i){cl?wl?wl.push(i):wl=[i]:cl=i,t=qd(t,"onChange"),0<t.length&&(n=new Qd("onChange","change",null,n,i),e.push({event:n,listeners:t}))}var hu=null,Ou=null;function qz(e){iC(e,0)}function Zd(e){var t=ou(e);if(tk(t))return e}function y1(e,t){if(e==="change")return t}var dk=!1;if(gr){if(gr){if(lu="oninput"in document,!lu)id=document.createElement("div"),id.setAttribute("oninput","return;"),lu=typeof id.oninput==="function";su=lu}else su=!1;dk=su&&(!document.documentMode||9<document.documentMode)}var su,lu,id;function x1(){hu&&(hu.detachEvent("onpropertychange",hk),Ou=hu=null)}function hk(e){if(e.propertyName==="value"&&Zd(Ou)){var t=[];fk(t,Ou,e,Rv(e)),sk(qz,t)}}function $z(e,t,n){e==="focusin"?(x1(),hu=t,Ou=n,hu.attachEvent("onpropertychange",hk)):e==="focusout"&&x1()}function Xz(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return Zd(Ou)}function Gz(e,t){if(e==="click")return Zd(t)}function Yz(e,t){if(e==="input"||e==="change")return Zd(t)}function Wz(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var gn=typeof Object.is==="function"?Object.is:Wz;function Au(e,t){if(gn(e,t))return!0;if(typeof e!=="object"||e===null||typeof t!=="object"||t===null)return!1;var n=Object.keys(e),i=Object.keys(t);if(n.length!==i.length)return!1;for(i=0;i<n.length;i++){var r=n[i];if(!wg.call(t,r)||!gn(e[r],t[r]))return!1}return!0}function Eg(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch(t){return e.body}}function w1(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function S1(e,t){var n=w1(e);e=0;for(var i;n;){if(n.nodeType===3){if(i=e+n.textContent.length,e<=t&&i>=t)return{node:n,offset:t-e};e=i}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=w1(n)}}function pk(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?pk(e,t.parentNode):("contains"in e)?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function mk(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=Eg(e.document);t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href==="string"}catch(i){n=!1}if(n)e=t.contentWindow;else break;t=Eg(e.document)}return t}function Dv(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}var Qz=gr&&"documentMode"in document&&11>=document.documentMode,dl=null,Og=null,pu=null,Ag=!1;function k1(e,t,n){var i=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Ag||dl==null||dl!==Eg(i)||(i=dl,("selectionStart"in i)&&Dv(i)?i={start:i.selectionStart,end:i.selectionEnd}:(i=(i.ownerDocument&&i.ownerDocument.defaultView||window).getSelection(),i={anchorNode:i.anchorNode,anchorOffset:i.anchorOffset,focusNode:i.focusNode,focusOffset:i.focusOffset}),pu&&Au(pu,i)||(pu=i,i=qd(Og,"onSelect"),0<i.length&&(t=new Qd("onSelect","select",null,t,n),e.push({event:t,listeners:i}),t.target=dl)))}function Yo(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var hl={animationend:Yo("Animation","AnimationEnd"),animationiteration:Yo("Animation","AnimationIteration"),animationstart:Yo("Animation","AnimationStart"),transitionrun:Yo("Transition","TransitionRun"),transitionstart:Yo("Transition","TransitionStart"),transitioncancel:Yo("Transition","TransitionCancel"),transitionend:Yo("Transition","TransitionEnd")},qm={},gk={};gr&&(gk=document.createElement("div").style,("AnimationEvent"in window)||(delete hl.animationend.animation,delete hl.animationiteration.animation,delete hl.animationstart.animation),("TransitionEvent"in window)||delete hl.transitionend.transition);function xs(e){if(qm[e])return qm[e];if(!hl[e])return e;var t=hl[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in gk)return qm[e]=t[n];return e}var vk=xs("animationend"),bk=xs("animationiteration"),yk=xs("animationstart"),Jz=xs("transitionrun"),Zz=xs("transitionstart"),eB=xs("transitioncancel"),xk=xs("transitionend"),wk=new Map,Rg="abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error fullscreenChange fullscreenError gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");Rg.push("scrollEnd");function li(e,t){wk.set(e,t),ys(t,[e])}var tB=0;function vr(e,t){if(e.name!=null&&e.name!=="auto")return e.name;if(t.autoName!==null)return t.autoName;e=si.identifierPrefix;var n=tB++;return e="_"+e+"t_"+n.toString(32)+"_",t.autoName=e}function _1(e){if(e==null||typeof e==="string")return e;var t=null,n=Al;if(n!==null)for(var i=0;i<n.length;i++){var r=e[n[i]];if(r!=null){if(r==="none")return"none";t=t==null?r:t+(" "+r)}}return t==null?e.default:t}function kr(e,t){return e=_1(e),t=_1(t),t==null?e==="auto"?null:e:t==="auto"?null:t}var _d=typeof reportError==="function"?reportError:function(e){if(typeof window==="object"&&typeof window.ErrorEvent==="function"){var t=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof e==="object"&&e!==null&&typeof e.message==="string"?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process==="object"&&typeof process.emit==="function"){process.emit("uncaughtException",e);return}console.error(e)},Mn=[],pl=0,Lv=0;function eh(){for(var e=pl,t=Lv=pl=0;t<e;){var n=Mn[t];Mn[t++]=null;var i=Mn[t];Mn[t++]=null;var r=Mn[t];Mn[t++]=null;var o=Mn[t];if(Mn[t++]=null,i!==null&&r!==null){var s=i.pending;s===null?r.next=r:(r.next=s.next,s.next=r),i.pending=r}o!==0&&Sk(n,r,o)}}function th(e,t,n,i){Mn[pl++]=e,Mn[pl++]=t,Mn[pl++]=n,Mn[pl++]=i,Lv|=i,e.lanes|=i,e=e.alternate,e!==null&&(e.lanes|=i)}function zv(e,t,n,i){return th(e,t,n,i),Cd(e)}function ws(e,t){return th(e,null,null,t),Cd(e)}function Sk(e,t,n){e.lanes|=n;var i=e.alternate;i!==null&&(i.lanes|=n);for(var r=!1,o=e.return;o!==null;)o.childLanes|=n,i=o.alternate,i!==null&&(i.childLanes|=n),o.tag===22&&(e=o.stateNode,e===null||e._visibility&1||(r=!0)),e=o,o=o.return;return e.tag===3?(o=e.stateNode,r&&t!==null&&(r=31-mn(n),e=o.hiddenUpdates,i=e[r],i===null?e[r]=[t]:i.push(t),t.lane=n|536870912),o):null}function Cd(e){if(50<_u)throw _u=0,hd=null,Error(A(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var ml={};function nB(e,t,n,i){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=i,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Zt(e,t,n,i){return new nB(e,t,n,i)}function Bv(e){return e=e.prototype,!(!e||!e.isReactComponent)}function pr(e,t){var n=e.alternate;return n===null?(n=Zt(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&1206910976,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n.refCleanup=e.refCleanup,n}function kk(e,t){e.flags&=1206910978;var n=e.alternate;return n===null?(e.childLanes=0,e.lanes=t,e.child=null,e.subtreeFlags=0,e.memoizedProps=null,e.memoizedState=null,e.updateQueue=null,e.dependencies=null,e.stateNode=null):(e.childLanes=n.childLanes,e.lanes=n.lanes,e.child=n.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=n.memoizedProps,e.memoizedState=n.memoizedState,e.updateQueue=n.updateQueue,e.type=n.type,t=n.dependencies,e.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),e}function rd(e,t,n,i,r,o){var s=0;if(i=e,typeof i==="function")Bv(i)&&(s=1);else if(typeof i==="string")s=M4(e,n,Vi.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(i){case gg:return e=Zt(31,n,t,r),e.elementType=gg,e.lanes=o,e;case al:return rs(n.children,r,o,t);case VS:s=8,r|=24;break;case hg:return e=Zt(12,n,t,r|2),e.elementType=hg,e.lanes=o,e;case pg:return e=Zt(13,n,t,r),e.elementType=pg,e.lanes=o,e;case mg:return e=Zt(19,n,t,r),e.elementType=mg,e.lanes=o,e;case KL:case vg:return e=r|32,e=Zt(30,n,t,e),e.elementType=vg,e.lanes=o,e.stateNode={autoName:null,paired:null,clones:null,ref:null},e;default:if(typeof i==="object"&&i!==null)switch(i.$$typeof){case zi:s=10;break e;case HS:s=9;break e;case _v:s=11;break e;case Cv:s=14;break e;case Qr:s=16,i=null;break e}s=29,n=Error(A(130,e===null?"null":typeof e,"")),i=null}return t=Zt(s,n,t,r),t.elementType=e,t.type=i,t.lanes=o,t}function rs(e,t,n,i){return e=Zt(7,e,i,t),e.lanes=n,e}function $m(e,t,n){return e=Zt(6,e,null,t),e.lanes=n,e}function _k(e){var t=Zt(18,null,null,0);return t.stateNode=e,t}function Xm(e,t,n){return t=Zt(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var C1=new WeakMap;function zn(e,t){if(typeof e==="object"&&e!==null){var n=C1.get(e);if(n!==void 0)return n;return t={value:e,source:t,stack:i1(t)},C1.set(e,t),t}return{value:e,source:t,stack:i1(t)}}var gl=[],vl=0,Ed=null,Ru=0,Nn=[],Dn=0,mo=null,Pi=1,Ii="";function dr(e,t){gl[vl++]=Ru,gl[vl++]=Ed,Ed=e,Ru=t}function Ck(e,t,n){Nn[Dn++]=Pi,Nn[Dn++]=Ii,Nn[Dn++]=mo,mo=e;var i=Pi;e=Ii;var r=32-mn(i)-1;i&=~(1<<r),n+=1;var o=32-mn(t)+r;if(30<o){var s=r-r%5;o=(i&(1<<s)-1).toString(32),i>>=s,r-=s,Pi=1<<32-mn(t)+r|n<<r|i,Ii=o+e}else Pi=1<<o|n<<r|i,Ii=e}function nh(e){e.return!==null&&(dr(e,1),Ck(e,1,0))}function Pv(e){for(;e===Ed;)Ed=gl[--vl],gl[vl]=null,Ru=gl[--vl],gl[vl]=null;for(;e===mo;)mo=Nn[--Dn],Nn[Dn]=null,Ii=Nn[--Dn],Nn[Dn]=null,Pi=Nn[--Dn],Nn[Dn]=null}function Ek(e,t){Nn[Dn++]=Pi,Nn[Dn++]=Ii,Nn[Dn++]=mo,Pi=t.id,Ii=t.overflow,mo=e}var vt=null,ze=null,le=!1,lo=null,Bn=!1,Tg=Error(A(519));function go(e){var t=Error(A(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Tu(zn(t,e)),Tg}function E1(e){var{stateNode:t,type:n,memoizedProps:i}=e;switch(t[_t]=e,t[nn]=i,n){case"dialog":ae("cancel",t),ae("close",t);break;case"iframe":case"object":case"embed":ae("load",t);break;case"video":case"audio":for(n=0;n<Lu.length;n++)ae(Lu[n],t);break;case"source":ae("error",t);break;case"img":case"image":case"link":ae("error",t),ae("load",t);break;case"details":ae("toggle",t);break;case"input":ae("invalid",t),nk(t,i.value,i.defaultValue,i.checked,i.defaultChecked,i.type,i.name,!0);break;case"select":ae("invalid",t);break;case"textarea":ae("invalid",t),rk(t,i.value,i.defaultValue,i.children)}n=i.children,typeof n!=="string"&&typeof n!=="number"&&typeof n!=="bigint"||t.textContent===""+n||i.suppressHydrationWarning===!0||sC(t.textContent,n)?(i.popover!=null&&(ae("beforetoggle",t),ae("toggle",t)),i.onScroll!=null&&ae("scroll",t),i.onScrollEnd!=null&&ae("scrollend",t),i.onClick!=null&&(t.onclick=Bi),t=!0):t=!1,t||go(e,!0)}function Od(e){for(vt=e.return;vt;)switch(vt.tag){case 5:case 31:case 13:Bn=!1;return;case 27:case 3:Bn=!0;return;default:vt=vt.return}}function tl(e){if(e!==vt)return!1;if(!le)return Od(e),le=!0,!1;var t=e.tag,n;if(n=t!==3&&t!==27){if(n=t===5)n=e.type,n=!(n!=="form"&&n!=="button")||gv(e.type,e.memoizedProps);n=!n}if(n&&ze&&go(e),Od(e),t===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(A(317));ze=xS(e)}else if(t===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(A(317));ze=xS(e)}else t===27?(t=ze,wo(e.type)?(e=xv,xv=null,ze=e):ze=t):ze=vt?In(e.stateNode.nextSibling):null;return!0}function cs(){ze=vt=null,le=!1}function Gm(){var e=lo;return e!==null&&(Qt===null?Qt=e:Qt.push.apply(Qt,e),lo=null),e}function Tu(e){lo===null?lo=[e]:lo.push(e)}var Mg=ji(null),Ss=null,hr=null;function no(e,t,n){Be(Mg,t._currentValue),t._currentValue=n}function mr(e){e._currentValue=Mg.current,Et(Mg)}function od(e,t,n){for(;e!==null;){var i=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,i!==null&&(i.childLanes|=t)):i!==null&&(i.childLanes&t)!==t&&(i.childLanes|=t),e===n)break;e=e.return}}function Ng(e,t,n,i){var r=e.child;r!==null&&(r.return=e);for(;r!==null;){var o=r.dependencies;if(o!==null){var s=r.child;o=o.firstContext;e:for(;o!==null;){var l=o;o=r;for(var a=0;a<t.length;a++)if(l.context===t[a]){o.lanes|=n,l=o.alternate,l!==null&&(l.lanes|=n),od(o.return,n,e),i||(s=null);break e}o=l.next}}else if(r.tag===18){if(s=r.return,s===null)throw Error(A(341));s.lanes|=n,o=s.alternate,o!==null&&(o.lanes|=n),od(s,n,e),s=null}else r.tag===13&&r.memoizedState!==null&&r.memoizedState.dehydrated===null?(r.lanes|=n,s=r.alternate,s!==null&&(s.lanes|=n),od(r.return,n,e),s=r.child,s=s!==null?s.sibling:null):s=r.child;if(s!==null)s.return=r;else for(s=r;s!==null;){if(s===e){s=null;break}if(r=s.sibling,r!==null){r.return=s.return,s=r;break}s=s.return}r=s}}function fs(e,t,n,i){e=null;for(var r=t,o=!1;r!==null;){if(!o){if((r.flags&524288)!==0)o=!0;else if((r.flags&262144)!==0)break}if(r.tag===10){var s=r.alternate;if(s===null)throw Error(A(387));if(s=s.memoizedProps,s!==null){var l=r.type;gn(r.pendingProps.value,s.value)||(e!==null?e.push(l):e=[l])}}else if(r===yd.current){if(s=r.alternate,s===null)throw Error(A(387));s.memoizedState.memoizedState!==r.memoizedState.memoizedState&&(e!==null?e.push(Vl):e=[Vl])}r=r.return}return e!==null&&Ng(t,e,n,i),t.flags|=262144,e!==null}function Ad(e){for(e=e.firstContext;e!==null;){if(!gn(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function ds(e){Ss=e,hr=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function Ct(e){return Ok(Ss,e)}function jf(e,t){return Ss===null&&ds(e),Ok(e,t)}function Ok(e,t){var n=t._currentValue;if(t={context:t,memoizedValue:n,next:null},hr===null){if(e===null)throw Error(A(308));hr=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else hr=hr.next=t;return n}var iB=typeof AbortController<"u"?AbortController:function(){var e=[],t=this.signal={aborted:!1,addEventListener:function(n,i){e.push(i)}};this.abort=function(){t.aborted=!0,e.forEach(function(n){return n()})}},rB=Go,oB=Xo,at={$$typeof:zi,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Iv(){return{controller:new iB,data:new Map,refCount:0}}function Xu(e){e.refCount--,e.refCount===0&&rB(oB,function(){e.controller.abort()})}function O1(e,t){if((e.pendingLanes&4194048)!==0){var n=e.transitionTypes;n===null&&(n=e.transitionTypes=[]);for(e=0;e<t.length;e++){var i=t[e];n.indexOf(i)===-1&&n.push(i)}}}var au=null;function sB(e){var t=e.transitionTypes;return e.transitionTypes=null,t}var mu=null,Dg=0,hs=0,Sl=null;function lB(e,t){if(mu===null){var n=mu=[];Dg=0,hs=db(),Sl={status:"pending",value:void 0,then:function(i){n.push(i)}}}return Dg++,t.then(A1,A1),t}function A1(){if(--Dg===0&&(au=null,mu!==null)){Sl!==null&&(Sl.status="fulfilled");var e=mu;mu=null,hs=0,Sl=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function aB(e,t){var n=[],i={status:"pending",value:null,reason:null,then:function(r){n.push(r)}};return e.then(function(){i.status="fulfilled",i.value=t;for(var r=0;r<n.length;r++)(0,n[r])(t)},function(r){i.status="rejected",i.reason=r;for(r=0;r<n.length;r++)(0,n[r])(void 0)}),i}var R1=ne.S;ne.S=function(e,t){if(j_=hn(),typeof t==="object"&&t!==null&&typeof t.then==="function"&&lB(e,t),au!==null)for(var n=Bl;n!==null;)O1(n,au),n=n.next;if(n=e.types,n!==null){for(var i=Bl;i!==null;)O1(i,n),i=i.next;if(hs!==0){i=au,i===null&&(i=au=[]);for(var r=0;r<n.length;r++){var o=n[r];i.indexOf(o)===-1&&i.push(o)}}}R1!==null&&R1(e,t)};var os=ji(null);function Vv(){var e=os.current;return e!==null?e:Re.pooledCache}function sd(e,t){t===null?Be(os,os.current):Be(os,t.pool)}function Ak(){var e=Vv();return e===null?null:{parent:at._currentValue,pool:e}}var Kl=Error(A(460)),Hv=Error(A(474)),ih=Error(A(542)),Rd={then:function(){}};function T1(e){return e=e.status,e==="fulfilled"||e==="rejected"}function Rk(e,t,n){switch(n=e[n],n===void 0?e.push(t):n!==t&&(t.then(Bi,Bi),t=n),t.status){case"fulfilled":return t.value;case"rejected":if(e=t.reason,N1(e),e===void 0&&!("reason"in t))throw Error(A(600));throw e;default:if(typeof t.status==="string")t.then(Bi,Bi);else{if(e=Re,e!==null&&100<e.shellSuspendCounter)throw Error(A(482));e=t,e.status="pending",e.then(function(i){if(t.status==="pending"){var r=t;r.status="fulfilled",r.value=i}},function(i){if(t.status==="pending"){var r=t;r.status="rejected",r.reason=i}})}switch(t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,N1(e),e}throw ss=t,Kl}}function Zo(e){try{var t=e._init;return t(e._payload)}catch(n){if(n!==null&&typeof n==="object"&&typeof n.then==="function")throw ss=n,Kl;throw n}}var ss=null;function M1(){if(ss===null)throw Error(A(459));var e=ss;return ss=null,e}function N1(e){if(e===Kl||e===ih)throw Error(A(483))}var kl=null,Mu=0;function Kf(e){var t=Mu;return Mu+=1,kl===null&&(kl=[]),Rk(kl,e,t)}function Gr(e,t){t=t.props.ref,e.ref=t!==void 0?t:null}function Ff(e,t){if(t.$$typeof===jL)throw Error(A(525));throw e=Object.prototype.toString.call(t),Error(A(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e))}function Tk(e){function t(g,v){if(e){var w=g.deletions;w===null?(g.deletions=[v],g.flags|=16):w.push(v)}}function n(g,v){if(!e)return null;for(;v!==null;)t(g,v),v=v.sibling;return null}function i(g){for(var v=new Map;g!==null;)g.key===null?v.set(g.index,g):v.set(g.key,g),g=g.sibling;return v}function r(g,v){return g=pr(g,v),g.index=0,g.sibling=null,g}function o(g,v,w){if(g.index=w,!e)return g.flags|=1048576,v;if(w=g.alternate,w!==null)return w=w.index,w<v?(g.flags|=2,v):w;return g.flags|=134217730,v}function s(g){return e&&g.alternate===null&&(g.flags|=134217730),g}function l(g,v,w,S){if(v===null||v.tag!==6)return v=$m(w,g.mode,S),v.return=g,v;return v=r(v,w),v.return=g,v}function a(g,v,w,S){var k=w.type;if(k===al)return g=c(g,v,w.props.children,S,w.key),Gr(g,w),g;if(v!==null&&(v.elementType===k||typeof k==="object"&&k!==null&&k.$$typeof===Qr&&Zo(k)===v.type))return v=r(v,w.props),Gr(v,w),v.return=g,v;return v=rd(w.type,w.key,w.props,null,g.mode,S),Gr(v,w),v.return=g,v}function u(g,v,w,S){if(v===null||v.tag!==4||v.stateNode.containerInfo!==w.containerInfo||v.stateNode.implementation!==w.implementation)return v=Xm(w,g.mode,S),v.return=g,v;return v=r(v,w.children||[]),v.return=g,v}function c(g,v,w,S,k){if(v===null||v.tag!==7)return v=rs(w,g.mode,S,k),v.return=g,v;return v=r(v,w),v.return=g,v}function f(g,v,w){if(typeof v==="string"&&v!==""||typeof v==="number"||typeof v==="bigint")return v=$m(""+v,g.mode,w),v.return=g,v;if(typeof v==="object"&&v!==null){switch(v.$$typeof){case Bf:return w=rd(v.type,v.key,v.props,null,g.mode,w),Gr(w,v),w.return=g,w;case iu:return v=Xm(v,g.mode,w),v.return=g,v;case Qr:return v=Zo(v),f(g,v,w)}if(ru(v)||Ja(v))return v=rs(v,g.mode,w,null),v.return=g,v;if(typeof v.then==="function")return f(g,Kf(v),w);if(v.$$typeof===zi)return f(g,jf(g,v),w);Ff(g,v)}return null}function d(g,v,w,S){var k=v!==null?v.key:null;if(typeof w==="string"&&w!==""||typeof w==="number"||typeof w==="bigint")return k!==null?null:l(g,v,""+w,S);if(typeof w==="object"&&w!==null){switch(w.$$typeof){case Bf:return w.key===k?a(g,v,w,S):null;case iu:return w.key===k?u(g,v,w,S):null;case Qr:return w=Zo(w),d(g,v,w,S)}if(ru(w)||Ja(w))return k!==null?null:c(g,v,w,S,null);if(typeof w.then==="function")return d(g,v,Kf(w),S);if(w.$$typeof===zi)return d(g,v,jf(g,w),S);Ff(g,w)}return null}function h(g,v,w,S,k){if(typeof S==="string"&&S!==""||typeof S==="number"||typeof S==="bigint")return g=g.get(w)||null,l(v,g,""+S,k);if(typeof S==="object"&&S!==null){switch(S.$$typeof){case Bf:return g=g.get(S.key===null?w:S.key)||null,a(v,g,S,k);case iu:return g=g.get(S.key===null?w:S.key)||null,u(v,g,S,k);case Qr:return S=Zo(S),h(g,v,w,S,k)}if(ru(S)||Ja(S))return g=g.get(w)||null,c(v,g,S,k,null);if(typeof S.then==="function")return h(g,v,w,Kf(S),k);if(S.$$typeof===zi)return h(g,v,w,jf(v,S),k);Ff(v,S)}return null}function m(g,v,w,S){for(var k=null,E=null,_=v,O=v=0,P=null;_!==null&&O<w.length;O++){_.index>O?(P=_,_=null):P=_.sibling;var T=d(g,_,w[O],S);if(T===null){_===null&&(_=P);break}e&&_&&T.alternate===null&&t(g,_),v=o(T,v,O),E===null?k=T:E.sibling=T,E=T,_=P}if(O===w.length)return n(g,_),le&&dr(g,O),k;if(_===null){for(;O<w.length;O++)_=f(g,w[O],S),_!==null&&(v=o(_,v,O),E===null?k=_:E.sibling=_,E=_);return le&&dr(g,O),k}for(_=i(_);O<w.length;O++)P=h(_,g,O,w[O],S),P!==null&&(e&&(T=P.alternate,T!==null&&_.delete(T.key===null?O:T.key)),v=o(P,v,O),E===null?k=P:E.sibling=P,E=P);return e&&_.forEach(function(I){return t(g,I)}),le&&dr(g,O),k}function b(g,v,w,S){if(w==null)throw Error(A(151));for(var k=null,E=null,_=v,O=v=0,P=null,T=w.next();_!==null&&!T.done;O++,T=w.next()){_.index>O?(P=_,_=null):P=_.sibling;var I=d(g,_,T.value,S);if(I===null){_===null&&(_=P);break}e&&_&&I.alternate===null&&t(g,_),v=o(I,v,O),E===null?k=I:E.sibling=I,E=I,_=P}if(T.done)return n(g,_),le&&dr(g,O),k;if(_===null){for(;!T.done;O++,T=w.next())T=f(g,T.value,S),T!==null&&(v=o(T,v,O),E===null?k=T:E.sibling=T,E=T);return le&&dr(g,O),k}for(_=i(_);!T.done;O++,T=w.next())T=h(_,g,O,T.value,S),T!==null&&(e&&(P=T.alternate,P!==null&&_.delete(P.key===null?O:P.key)),v=o(T,v,O),E===null?k=T:E.sibling=T,E=T);return e&&_.forEach(function(V){return t(g,V)}),le&&dr(g,O),k}function x(g,v,w,S){if(typeof w==="object"&&w!==null&&w.type===al&&w.key===null&&w.props.ref===void 0&&(w=w.props.children),typeof w==="object"&&w!==null){switch(w.$$typeof){case Bf:e:{for(var k=w.key;v!==null;){if(v.key===k){if(k=w.type,k===al){if(v.tag===7){n(g,v.sibling),S=r(v,w.props.children),Gr(S,w),S.return=g,g=S;break e}}else if(v.elementType===k||typeof k==="object"&&k!==null&&k.$$typeof===Qr&&Zo(k)===v.type){n(g,v.sibling),S=r(v,w.props),Gr(S,w),S.return=g,g=S;break e}n(g,v);break}else t(g,v);v=v.sibling}w.type===al?(S=rs(w.props.children,g.mode,S,w.key),Gr(S,w),S.return=g,g=S):(S=rd(w.type,w.key,w.props,null,g.mode,S),Gr(S,w),S.return=g,g=S)}return s(g);case iu:e:{for(k=w.key;v!==null;){if(v.key===k)if(v.tag===4&&v.stateNode.containerInfo===w.containerInfo&&v.stateNode.implementation===w.implementation){n(g,v.sibling),S=r(v,w.children||[]),S.return=g,g=S;break e}else{n(g,v);break}else t(g,v);v=v.sibling}S=Xm(w,g.mode,S),S.return=g,g=S}return s(g);case Qr:return w=Zo(w),x(g,v,w,S)}if(ru(w))return m(g,v,w,S);if(Ja(w)){if(k=Ja(w),typeof k!=="function")throw Error(A(150));return w=k.call(w),b(g,v,w,S)}if(typeof w.then==="function")return x(g,v,Kf(w),S);if(w.$$typeof===zi)return x(g,v,jf(g,w),S);Ff(g,w)}return typeof w==="string"&&w!==""||typeof w==="number"||typeof w==="bigint"?(w=""+w,v!==null&&v.tag===6?(n(g,v.sibling),S=r(v,w),S.return=g,g=S):(n(g,v),S=$m(w,g.mode,S),S.return=g,g=S),s(g)):n(g,v)}return function(g,v,w,S){try{Mu=0;var k=x(g,v,w,S);return kl=null,k}catch(_){if(_===Kl||_===ih)throw _;var E=Zt(29,_,null,g.mode);return E.lanes=S,E.return=g,E}finally{}}}var ps=Tk(!0),Mk=Tk(!1),Jr=!1;function Uv(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Lg(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function ls(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function as(e,t,n){var i=e.updateQueue;if(i===null)return null;if(i=i.shared,(ve&2)!==0){var r=i.pending;return r===null?t.next=t:(t.next=r.next,r.next=t),i.pending=t,t=Cd(e),Sk(e,null,n),t}return th(e,i,t,n),Cd(e)}function gu(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,(n&4194048)!==0)){var i=t.lanes;i&=e.pendingLanes,n|=i,t.lanes=n,XS(e,n)}}function Ym(e,t){var n=e.updateQueue,i=e.alternate;if(i!==null&&(i=i.updateQueue,n===i)){var r=null,o=null;if(n=n.firstBaseUpdate,n!==null){do{var s={lane:n.lane,tag:n.tag,payload:n.payload,callback:null,next:null};o===null?r=o=s:o=o.next=s,n=n.next}while(n!==null);o===null?r=o=t:o=o.next=t}else r=o=t;n={baseState:i.baseState,firstBaseUpdate:r,lastBaseUpdate:o,shared:i.shared,callbacks:i.callbacks},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}var zg=!1;function vu(){if(zg){var e=Sl;if(e!==null)throw e}}function bu(e,t,n,i){zg=!1;var r=e.updateQueue;Jr=!1;var{firstBaseUpdate:o,lastBaseUpdate:s}=r,l=r.shared.pending;if(l!==null){r.shared.pending=null;var a=l,u=a.next;a.next=null,s===null?o=u:s.next=u,s=a;var c=e.alternate;c!==null&&(c=c.updateQueue,l=c.lastBaseUpdate,l!==s&&(l===null?c.firstBaseUpdate=u:l.next=u,c.lastBaseUpdate=a))}if(o!==null){var f=r.baseState;s=0,c=u=a=null,l=o;do{var d=l.lane&-536870913,h=d!==l.lane;if(h?(fe&d)===d:(i&d)===d){d!==0&&d===hs&&(zg=!0),c!==null&&(c=c.next={lane:0,tag:l.tag,payload:l.payload,callback:null,next:null});e:{var m=e,b=l;d=t;var x=n;switch(b.tag){case 1:if(m=b.payload,typeof m==="function"){f=m.call(x,f,d);break e}f=m;break e;case 3:m.flags=m.flags&-65537|128;case 0:if(m=b.payload,d=typeof m==="function"?m.call(x,f,d):m,d===null||d===void 0)break e;f=Te({},f,d);break e;case 2:Jr=!0}}d=l.callback,d!==null&&(e.flags|=64,h&&(e.flags|=8192),h=r.callbacks,h===null?r.callbacks=[d]:h.push(d))}else h={lane:d,tag:l.tag,payload:l.payload,callback:l.callback,next:null},c===null?(u=c=h,a=f):c=c.next=h,s|=d;if(l=l.next,l===null)if(l=r.shared.pending,l===null)break;else h=l,l=h.next,h.next=null,r.lastBaseUpdate=h,r.shared.pending=null}while(1);c===null&&(a=f),r.baseState=a,r.firstBaseUpdate=u,r.lastBaseUpdate=c,o===null&&(r.shared.lanes=0),yo|=s,e.lanes=s,e.memoizedState=f}}function Nk(e,t){if(typeof e!=="function")throw Error(A(191,e));e.call(t)}function Dk(e,t){var n=e.callbacks;if(n!==null)for(e.callbacks=null,e=0;e<n.length;e++)Nk(n[e],t)}var vo=ji(null),Td=ji(0);function D1(e,t){e=wr,Be(Td,e),Be(vo,t),wr=e|t.baseLanes}function Bg(){Be(Td,wr),Be(vo,vo.current)}function jv(){wr=Td.current,Et(vo),Et(Td)}var Rt=ji(null),Lt=null;function ao(e){var t=e.alternate;Be(Ot,Ot.current&1),Be(Rt,e),Lt===null&&(t===null||vo.current!==null?Lt=e:t.memoizedState!==null&&(Lt=e))}function Pg(e){Be(Ot,Ot.current),Be(Rt,e),Lt===null&&(Lt=e)}function Lk(e){e.tag===22?(Be(Ot,Ot.current),Be(Rt,e),Lt===null&&(Lt=e)):uo()}function uo(){Be(Ot,Ot.current),Be(Rt,Rt.current)}function cn(e){Et(Rt),Lt===e&&(Lt=null),Et(Ot)}var Ot=ji(0);function Nu(e,t){Be(Rt,Rt.current),Be(Ot,t)}function Kv(e){Et(Ot),Et(Rt),Lt===e&&(Lt=null)}function Md(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||yv(n)||mb(n)))return t}else if(t.tag===19&&t.memoizedProps.revealOrder!=="independent"){if((t.flags&128)!==0)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var br=0,re=null,_e=null,lt=null,Nd=!1,_l=!1,ms=!1,Dd=0,Du=0,Cl=null,uB=0;function We(){throw Error(A(321))}function Fv(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!gn(e[n],t[n]))return!1;return!0}function qv(e,t,n,i,r,o){return br=o,re=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,ne.H=e===null||e.memoizedState===null?f_:d_,ms=!1,o=n(i,r),ms=!1,_l&&(o=Bk(t,n,i,r)),zk(e),o}function zk(e){ne.H=Ld;var t=_e!==null&&_e.next!==null;if(br=0,lt=_e=re=null,Nd=!1,Du=0,Cl=null,t)throw Error(A(300));e===null||ut||(e=e.dependencies,e!==null&&Ad(e)&&(ut=!0))}function Bk(e,t,n,i){re=e;var r=0;do{if(_l&&(Cl=null),Du=0,_l=!1,25<=r)throw Error(A(301));if(r+=1,lt=_e=null,e.updateQueue!=null){var o=e.updateQueue;o.lastEffect=null,o.events=null,o.stores=null,o.memoCache!=null&&(o.memoCache.index=0)}ne.H=vB,o=t(n,i)}while(_l);return o}function cB(){var e=ne.H,t=e.useState()[0];return t=typeof t.then==="function"?Gu(t):t,e=e.useState()[0],(_e!==null?_e.memoizedState:null)!==e&&(re.flags|=1024),t}function $v(){var e=Dd!==0;return Dd=0,e}function Xv(e,t,n){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~n}function Gv(e){if(Nd){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}Nd=!1}br=0,lt=_e=re=null,_l=!1,Du=Dd=0,Cl=null}function Kt(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return lt===null?re.memoizedState=lt=e:lt=lt.next=e,lt}function nt(){if(_e===null){var e=re.alternate;e=e!==null?e.memoizedState:null}else e=_e.next;var t=lt===null?re.memoizedState:lt.next;if(t!==null)lt=t,_e=e;else{if(e===null){if(re.alternate===null)throw Error(A(467));throw Error(A(310))}_e=e,e={memoizedState:_e.memoizedState,baseState:_e.baseState,baseQueue:_e.baseQueue,queue:_e.queue,next:null},lt===null?re.memoizedState=lt=e:lt=lt.next=e}return lt}function rh(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Gu(e){var t=Du;return Du+=1,Cl===null&&(Cl=[]),e=Rk(Cl,e,t),t=re,(lt===null?t.memoizedState:lt.next)===null&&(t=t.alternate,ne.H=t===null||t.memoizedState===null?f_:d_),e}function oh(e){if(e!==null&&typeof e==="object"){if(typeof e.then==="function")return Gu(e);if(e.$$typeof===qL)return;if(e.$$typeof===zi)return Ct(e)}throw Error(A(438,String(e)))}function Yv(e){var t=null,n=re.updateQueue;if(n!==null&&(t=n.memoCache),t==null){var i=re.alternate;i!==null&&(i=i.updateQueue,i!==null&&(i=i.memoCache,i!=null&&(t={data:i.data.map(function(r){return r.slice()}),index:0})))}if(t==null&&(t={data:[],index:0}),n===null&&(n=rh(),re.updateQueue=n),n.memoCache=t,n=t.data[t.index],n===void 0)for(n=t.data[t.index]=Array(e),i=0;i<e;i++)n[i]=FL;return t.index++,n}function yr(e,t){return typeof t==="function"?t(e):t}function ld(e){var t=nt();return Wv(t,_e,e)}function Wv(e,t,n){var i=e.queue;if(i===null)throw Error(A(311));i.lastRenderedReducer=n;var r=e.baseQueue,o=i.pending;if(o!==null){if(r!==null){var s=r.next;r.next=o.next,o.next=s}t.baseQueue=r=o,i.pending=null}if(o=e.baseState,r===null)e.memoizedState=o;else{t=r.next;var l=s=null,a=null,u=t,c=!1;do{var f=u.lane&-536870913;if(f!==u.lane?(fe&f)===f:(br&f)===f){var d=u.revertLane;if(d===0)a!==null&&(a=a.next={lane:0,revertLane:0,gesture:null,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null}),f===hs&&(c=!0);else if((br&d)===d){u=u.next,d===hs&&(c=!0);continue}else f={lane:0,revertLane:u.revertLane,gesture:null,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null},a===null?(l=a=f,s=o):a=a.next=f,re.lanes|=d,yo|=d;f=u.action,ms&&n(o,f),o=u.hasEagerState?u.eagerState:n(o,f)}else d={lane:f,revertLane:u.revertLane,gesture:u.gesture,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null},a===null?(l=a=d,s=o):a=a.next=d,re.lanes|=f,yo|=f;u=u.next}while(u!==null&&u!==t);if(a===null?s=o:a.next=l,!gn(o,e.memoizedState)&&(ut=!0,c&&(n=Sl,n!==null)))throw n;e.memoizedState=o,e.baseState=s,e.baseQueue=a,i.lastRenderedState=o}return r===null&&(i.lanes=0),[e.memoizedState,i.dispatch]}function Wm(e){var t=nt(),n=t.queue;if(n===null)throw Error(A(311));n.lastRenderedReducer=e;var{dispatch:i,pending:r}=n,o=t.memoizedState;if(r!==null){n.pending=null;var s=r=r.next;do o=e(o,s.action),s=s.next;while(s!==r);gn(o,t.memoizedState)||(ut=!0),t.memoizedState=o,t.baseQueue===null&&(t.baseState=o),n.lastRenderedState=o}return[o,i]}function Pk(e,t,n){var i=re,r=nt(),o=le;if(o){if(n===void 0)throw Error(A(407));n=n()}else n=t();var s=!gn((_e||r).memoizedState,n);if(s&&(r.memoizedState=n,ut=!0),r=r.queue,Qv(Hk.bind(null,i,r,e),[e]),e=r.getSnapshot!==t||s||lt!==null&&(lt.memoizedState.tag&1)!==0,Nl(e?9:8,{destroy:void 0},Vk.bind(null,i,r,n,t),null),e){if(i.flags|=2048,Re===null)throw Error(A(349));o||(br&127)!==0||Ik(i,t,n)}return n}function Ik(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=re.updateQueue,t===null?(t=rh(),re.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function Vk(e,t,n,i){t.value=n,t.getSnapshot=i,Uk(t)&&jk(e)}function Hk(e,t,n){return n(function(){Uk(t)&&jk(e)})}function Uk(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!gn(e,n)}catch(i){return!0}}function jk(e){var t=ws(e,2);t!==null&&en(t,e,2)}function Ig(e){var t=Kt();if(typeof e==="function"){var n=e;if(e=n(),ms){eo(!0);try{n()}finally{eo(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:yr,lastRenderedState:e},t}function Kk(e,t,n,i){return e.baseState=n,Wv(e,_e,typeof i==="function"?i:yr)}function fB(e,t,n,i,r){if(lh(e))throw Error(A(485));if(e=t.action,e!==null){var o={payload:r,action:e,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(s){o.listeners.push(s)}};ne.T!==null?n(!0):o.isTransition=!1,i(o),n=t.pending,n===null?(o.next=t.pending=o,Fk(t,o)):(o.next=n.next,t.pending=n.next=o)}}function Fk(e,t){var{action:n,payload:i}=t,r=e.state;if(t.isTransition){var o=ne.T,s={};s.types=o!==null?o.types:null,ne.T=s;try{var l=n(r,i),a=ne.S;a!==null&&a(s,l),L1(e,t,l)}catch(u){Vg(e,t,u)}finally{o!==null&&s.types!==null&&(o.types=s.types),ne.T=o}}else try{o=n(r,i),L1(e,t,o)}catch(u){Vg(e,t,u)}}function L1(e,t,n){n!==null&&typeof n==="object"&&typeof n.then==="function"?n.then(function(i){z1(e,t,i)},function(i){return Vg(e,t,i)}):z1(e,t,n)}function z1(e,t,n){t.status="fulfilled",t.value=n,qk(t),e.state=n,t=e.pending,t!==null&&(n=t.next,n===t?e.pending=null:(n=n.next,t.next=n,Fk(e,n)))}function Vg(e,t,n){var i=e.pending;if(e.pending=null,i!==null){i=i.next;do t.status="rejected",t.reason=n,qk(t),t=t.next;while(t!==i)}e.action=null}function qk(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function $k(e,t){return t}function B1(e,t){if(le){var n=Re.formState;if(n!==null){e:{var i=re;if(le){if(ze){t:{var r=ze;for(var o=Bn;r.nodeType!==8;){if(!o){r=null;break t}if(r=In(r.nextSibling),r===null){r=null;break t}}o=r.data,r=o==="F!"||o==="F"?r:null}if(r){ze=In(r.nextSibling),i=r.data==="F!";break e}}go(i)}i=!1}i&&(t=n[0])}}return n=Kt(),n.memoizedState=n.baseState=t,i={pending:null,lanes:0,dispatch:null,lastRenderedReducer:$k,lastRenderedState:t},n.queue=i,n=a_.bind(null,re,i),i.dispatch=n,i=Ig(!1),o=tb.bind(null,re,!1,i.queue),i=Kt(),r={state:t,dispatch:null,action:e,pending:null},i.queue=r,n=fB.bind(null,re,r,o,n),r.dispatch=n,i.memoizedState=e,[t,n,!1]}function P1(e){var t=nt();return Xk(t,_e,e)}function Xk(e,t,n){if(t=Wv(e,t,$k)[0],e=ld(yr)[0],typeof t==="object"&&t!==null&&typeof t.then==="function")try{var i=Gu(t)}catch(s){if(s===Kl)throw ih;throw s}else i=t;t=nt();var r=t.queue,o=r.dispatch;return n!==t.memoizedState&&(re.flags|=2048,Nl(9,{destroy:void 0},dB.bind(null,r,n),null)),[i,o,e]}function dB(e,t){e.action=t}function I1(e){var t=nt(),n=_e;if(n!==null)return Xk(t,n,e);nt(),t=t.memoizedState,n=nt();var i=n.queue.dispatch;return n.memoizedState=e,[t,i,!1]}function Nl(e,t,n,i){return e={tag:e,create:n,deps:i,inst:t,next:null},t=re.updateQueue,t===null&&(t=rh(),re.updateQueue=t),n=t.lastEffect,n===null?t.lastEffect=e.next=e:(i=n.next,n.next=e,e.next=i,t.lastEffect=e),e}function Gk(){return nt().memoizedState}function ad(e,t,n,i){var r=Kt();re.flags|=e,r.memoizedState=Nl(1|t,{destroy:void 0},n,i===void 0?null:i)}function sh(e,t,n,i){var r=nt();i=i===void 0?null:i;var o=r.memoizedState.inst;_e!==null&&i!==null&&Fv(i,_e.memoizedState.deps)?r.memoizedState=Nl(t,o,n,i):(re.flags|=e,r.memoizedState=Nl(1|t,o,n,i))}function V1(e,t){ad(8390656,8,e,t)}function Qv(e,t){sh(2048,8,e,t)}function hB(e){re.flags|=4;var t=re.updateQueue;if(t===null)t=rh(),re.updateQueue=t,t.events=[e];else{var n=t.events;n===null?t.events=[e]:n.push(e)}}function Yk(e){var t=nt().memoizedState;return hB({ref:t,nextImpl:e}),function(){if((ve&2)!==0)throw Error(A(440));return t.impl.apply(void 0,arguments)}}function Wk(e,t){return sh(4,2,e,t)}function Qk(e,t){return sh(4,4,e,t)}function Jk(e,t){if(typeof t==="function"){e=e();var n=t(e);return function(){typeof n==="function"?n():t(null)}}if(t!==null&&t!==void 0)return e=e(),t.current=e,function(){t.current=null}}function Zk(e,t,n){n=n!==null&&n!==void 0?n.concat([e]):null,sh(4,4,Jk.bind(null,t,e),n)}function Jv(){}function e_(e,t){var n=nt();t=t===void 0?null:t;var i=n.memoizedState;if(t!==null&&Fv(t,i[1]))return i[0];return n.memoizedState=[e,t],e}function t_(e,t){var n=nt();t=t===void 0?null:t;var i=n.memoizedState;if(t!==null&&Fv(t,i[1]))return i[0];if(i=e(),ms){eo(!0);try{e()}finally{eo(!1)}}return n.memoizedState=[i,t],i}function Zv(e,t,n){if(n===void 0||(br&1073741824)!==0&&(fe&261930)===0)return e.memoizedState=t;return e.memoizedState=n,e=F_(),re.lanes|=e,yo|=e,n}function n_(e,t,n,i){if(gn(n,t))return n;if(vo.current!==null)return e=Zv(e,n,i),gn(e,t)||(ut=!0),e;if((br&106)===0||(br&1073741824)!==0&&(fe&261930)===0)return ut=!0,e.memoizedState=n;return e=F_(),re.lanes|=e,yo|=e,t}function i_(e,t,n,i,r){var o=be.p;be.p=o!==0&&8>o?o:8;var s=ne.T,l={};l.types=s!==null?s.types:null,ne.T=l,tb(e,!1,t,n);try{var a=r(),u=ne.S;if(u!==null&&u(l,a),a!==null&&typeof a==="object"&&typeof a.then==="function"){var c=aB(a,i);yu(e,t,c,Pn(e))}else yu(e,t,i,Pn(e))}catch(f){yu(e,t,{then:function(){},status:"rejected",reason:f},Pn())}finally{be.p=o,s!==null&&l.types!==null&&(s.types=l.types),ne.T=s}}function pB(){}function Hg(e,t,n,i){if(e.tag!==5)throw Error(A(476));var r=r_(e).queue;i_(e,r,t,is,n===null?pB:function(){return o_(e),n(i)})}function r_(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:is,baseState:is,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:yr,lastRenderedState:is},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:yr,lastRenderedState:n},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function o_(e){var t=r_(e);t.next===null&&(t=e.alternate.memoizedState),yu(e,t.next.queue,{},Pn())}function eb(){return Ct(Vl)}function s_(){return nt().memoizedState}function l_(){return nt().memoizedState}function mB(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var n=Pn();e=ls(n);var i=as(t,e,n);i!==null&&(en(i,t,n),gu(i,t,n)),t={cache:Iv()},e.payload=t;return}t=t.return}}function gB(e,t,n){var i=Pn();n={lane:i,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},lh(e)?u_(t,n):(n=zv(e,t,n,i),n!==null&&(en(n,e,i),c_(n,t,i)))}function a_(e,t,n){var i=Pn();yu(e,t,n,i)}function yu(e,t,n,i){var r={lane:i,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(lh(e))u_(t,r);else{var o=e.alternate;if(e.lanes===0&&(o===null||o.lanes===0)&&(o=t.lastRenderedReducer,o!==null))try{var s=t.lastRenderedState,l=o(s,n);if(r.hasEagerState=!0,r.eagerState=l,gn(l,s))return th(e,t,r,0),Re===null&&eh(),!1}catch(a){}finally{}if(n=zv(e,t,r,i),n!==null)return en(n,e,i),c_(n,t,i),!0}return!1}function tb(e,t,n,i){if(i={lane:2,revertLane:db(),gesture:null,action:i,hasEagerState:!1,eagerState:null,next:null},lh(e)){if(t)throw Error(A(479))}else t=zv(e,n,i,2),t!==null&&en(t,e,2)}function lh(e){var t=e.alternate;return e===re||t!==null&&t===re}function u_(e,t){_l=Nd=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function c_(e,t,n){if((n&4194048)!==0){var i=t.lanes;i&=e.pendingLanes,n|=i,t.lanes=n,XS(e,n)}}var Ld={readContext:Ct,use:oh,useCallback:We,useContext:We,useEffect:We,useImperativeHandle:We,useLayoutEffect:We,useInsertionEffect:We,useMemo:We,useReducer:We,useRef:We,useState:We,useDebugValue:We,useDeferredValue:We,useTransition:We,useSyncExternalStore:We,useId:We,useHostTransitionStatus:We,useFormState:We,useActionState:We,useOptimistic:We,useMemoCache:We,useCacheRefresh:We,useEffectEvent:We},f_={readContext:Ct,use:oh,useCallback:function(e,t){return Kt().memoizedState=[e,t===void 0?null:t],e},useContext:Ct,useEffect:V1,useImperativeHandle:function(e,t,n){n=n!==null&&n!==void 0?n.concat([e]):null,ad(4194308,4,Jk.bind(null,t,e),n)},useLayoutEffect:function(e,t){return ad(4194308,4,e,t)},useInsertionEffect:function(e,t){ad(4,2,e,t)},useMemo:function(e,t){var n=Kt();t=t===void 0?null:t;var i=e();if(ms){eo(!0);try{e()}finally{eo(!1)}}return n.memoizedState=[i,t],i},useReducer:function(e,t,n){var i=Kt();if(n!==void 0){var r=n(t);if(ms){eo(!0);try{n(t)}finally{eo(!1)}}}else r=t;return i.memoizedState=i.baseState=r,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:r},i.queue=e,e=e.dispatch=gB.bind(null,re,e),[i.memoizedState,e]},useRef:function(e){var t=Kt();return e={current:e},t.memoizedState=e},useState:function(e){e=Ig(e);var t=e.queue,n=a_.bind(null,re,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:Jv,useDeferredValue:function(e,t){var n=Kt();return Zv(n,e,t)},useTransition:function(){var e=Ig(!1);return e=i_.bind(null,re,e.queue,!0,!1),Kt().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var i=re,r=Kt();if(le){if(n===void 0)throw Error(A(407));n=n()}else{if(n=t(),Re===null)throw Error(A(349));(fe&127)!==0||Ik(i,t,n)}r.memoizedState=n;var o={value:n,getSnapshot:t};return r.queue=o,V1(Hk.bind(null,i,o,e),[e]),i.flags|=2048,Nl(9,{destroy:void 0},Vk.bind(null,i,o,n,t),null),n},useId:function(){var e=Kt(),t=Re.identifierPrefix;if(le){var n=Ii,i=Pi;n=(i&~(1<<32-mn(i)-1)).toString(32)+n,t="_"+t+"R_"+n,n=Dd++,0<n&&(t+="H"+n.toString(32)),t+="_"}else n=uB++,t="_"+t+"r_"+n.toString(32)+"_";return e.memoizedState=t},useHostTransitionStatus:eb,useFormState:B1,useActionState:B1,useOptimistic:function(e){var t=Kt();t.memoizedState=t.baseState=e;var n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=n,t=tb.bind(null,re,!0,n),n.dispatch=t,[e,t]},useMemoCache:Yv,useCacheRefresh:function(){return Kt().memoizedState=mB.bind(null,re)},useEffectEvent:function(e){var t=Kt(),n={impl:e};return t.memoizedState=n,function(){if((ve&2)!==0)throw Error(A(440));return n.impl.apply(void 0,arguments)}}},d_={readContext:Ct,use:oh,useCallback:e_,useContext:Ct,useEffect:Qv,useImperativeHandle:Zk,useInsertionEffect:Wk,useLayoutEffect:Qk,useMemo:t_,useReducer:ld,useRef:Gk,useState:function(){return ld(yr)},useDebugValue:Jv,useDeferredValue:function(e,t){var n=nt();return n_(n,_e.memoizedState,e,t)},useTransition:function(){var e=ld(yr)[0],t=nt().memoizedState;return[typeof e==="boolean"?e:Gu(e),t]},useSyncExternalStore:Pk,useId:s_,useHostTransitionStatus:eb,useFormState:P1,useActionState:P1,useOptimistic:function(e,t){var n=nt();return Kk(n,_e,e,t)},useMemoCache:Yv,useCacheRefresh:l_,useEffectEvent:Yk},vB={readContext:Ct,use:oh,useCallback:e_,useContext:Ct,useEffect:Qv,useImperativeHandle:Zk,useInsertionEffect:Wk,useLayoutEffect:Qk,useMemo:t_,useReducer:Wm,useRef:Gk,useState:function(){return Wm(yr)},useDebugValue:Jv,useDeferredValue:function(e,t){var n=nt();return _e===null?Zv(n,e,t):n_(n,_e.memoizedState,e,t)},useTransition:function(){var e=Wm(yr)[0],t=nt().memoizedState;return[typeof e==="boolean"?e:Gu(e),t]},useSyncExternalStore:Pk,useId:s_,useHostTransitionStatus:eb,useFormState:I1,useActionState:I1,useOptimistic:function(e,t){var n=nt();if(_e!==null)return Kk(n,_e,e,t);return n.baseState=e,[e,n.queue.dispatch]},useMemoCache:Yv,useCacheRefresh:l_,useEffectEvent:Yk};function Qm(e,t,n,i){t=e.memoizedState,n=n(i,t),n=n===null||n===void 0?t:Te({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var Ug={enqueueSetState:function(e,t,n){e=e._reactInternals;var i=Pn(),r=ls(i);r.payload=t,n!==void 0&&n!==null&&(r.callback=n),t=as(e,r,i),t!==null&&(en(t,e,i),gu(t,e,i))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var i=Pn(),r=ls(i);r.tag=1,r.payload=t,n!==void 0&&n!==null&&(r.callback=n),t=as(e,r,i),t!==null&&(en(t,e,i),gu(t,e,i))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=Pn(),i=ls(n);i.tag=2,t!==void 0&&t!==null&&(i.callback=t),t=as(e,i,n),t!==null&&(en(t,e,n),gu(t,e,n))}};function H1(e,t,n,i,r,o,s){return e=e.stateNode,typeof e.shouldComponentUpdate==="function"?e.shouldComponentUpdate(i,o,s):t.prototype&&t.prototype.isPureReactComponent?!Au(n,i)||!Au(r,o):!0}function U1(e,t,n,i){e=t.state,typeof t.componentWillReceiveProps==="function"&&t.componentWillReceiveProps(n,i),typeof t.UNSAFE_componentWillReceiveProps==="function"&&t.UNSAFE_componentWillReceiveProps(n,i),t.state!==e&&Ug.enqueueReplaceState(t,t.state,null)}function gs(e,t){var n=t;if("ref"in t){n={};for(var i in t)i!=="ref"&&(n[i]=t[i])}if(e=e.defaultProps){n===t&&(n=Te({},n));for(var r in e)n[r]===void 0&&(n[r]=e[r])}return n}function bB(e){_d(e)}function yB(e){console.error(e)}function xB(e){_d(e)}function zd(e,t){try{var n=e.onUncaughtError;n(t.value,{componentStack:t.stack})}catch(i){setTimeout(function(){throw i})}}function j1(e,t,n){try{var i=e.onCaughtError;i(n.value,{componentStack:n.stack,errorBoundary:t.tag===1?t.stateNode:null})}catch(r){setTimeout(function(){throw r})}}function jg(e,t,n){return n=ls(n),n.tag=3,n.payload={element:null},n.callback=function(){zd(e,t)},n}function h_(e){return e=ls(e),e.tag=3,e}function p_(e,t,n,i){var r=n.type.getDerivedStateFromError;if(typeof r==="function"){var o=i.value;e.payload=function(){return r(o)},e.callback=function(){j1(t,n,i)}}var s=n.stateNode;s!==null&&typeof s.componentDidCatch==="function"&&(e.callback=function(){j1(t,n,i),typeof r!=="function"&&(co===null?co=new Set([this]):co.add(this));var l=i.stack;this.componentDidCatch(i.value,{componentStack:l!==null?l:""})})}function wB(e,t,n,i,r){if(n.flags|=32768,i!==null&&typeof i==="object"&&typeof i.then==="function"){if(t=n.alternate,t!==null&&fs(t,n,r,!0),n=Rt.current,n!==null){switch(n.tag){case 31:case 13:case 19:return Lt===null?Kd():n.alternate===null&&Qe===0&&(Qe=3),n.flags&=-257,n.flags|=65536,n.lanes=r,i===Rd?n.flags|=16384:(t=n.updateQueue,t===null?n.updateQueue=new Set([i]):t.add(i),rg(e,i,r)),!1;case 22:return n.flags|=65536,i===Rd?n.flags|=16384:(t=n.updateQueue,t===null?(t={transitions:null,markerInstances:null,retryQueue:new Set([i])},n.updateQueue=t):(n=t.retryQueue,n===null?t.retryQueue=new Set([i]):n.add(i)),rg(e,i,r)),!1}throw Error(A(435,n.tag))}return rg(e,i,r),Kd(),!1}if(le)return t=Rt.current,t!==null?((t.flags&65536)===0&&(t.flags|=256),t.flags|=65536,t.lanes=r,i!==Tg&&(e=Error(A(422),{cause:i}),Tu(zn(e,n)))):(i!==Tg&&(t=Error(A(423),{cause:i}),Tu(zn(t,n))),e=e.current.alternate,e.flags|=65536,r&=-r,e.lanes|=r,i=zn(i,n),r=jg(e.stateNode,i,r),Ym(e,r),Qe!==4&&(Qe=2)),!1;var o=Error(A(520),{cause:i});if(o=zn(o,n),ku===null?ku=[o]:ku.push(o),Qe!==4&&(Qe=2),t===null)return!0;i=zn(i,n),n=t;do{switch(n.tag){case 3:return n.flags|=65536,e=r&-r,n.lanes|=e,e=jg(n.stateNode,i,e),Ym(n,e),!1;case 1:if(t=n.type,o=n.stateNode,(n.flags&128)===0&&(typeof t.getDerivedStateFromError==="function"||o!==null&&typeof o.componentDidCatch==="function"&&(co===null||!co.has(o))))return n.flags|=65536,r&=-r,n.lanes|=r,r=h_(r),p_(r,e,n,i),Ym(n,r),!1;break;case 22:if(n.memoizedState!==null)return n.flags|=65536,!1}n=n.return}while(n!==null);return!1}var nb=Error(A(461)),ut=!1;function ct(e,t,n,i){t.child=e===null?Mk(t,null,n,i):ps(t,e.child,n,i)}function K1(e,t,n,i,r){n=n.render;var o=t.ref;if("ref"in i){var s={};for(var l in i)l!=="ref"&&(s[l]=i[l])}else s=i;if(ds(t),i=qv(e,t,n,s,o,r),l=$v(),e!==null&&!ut)return Xv(e,t,r),xr(e,t,r);return le&&l&&nh(t),t.flags|=1,ct(e,t,i,r),t.child}function F1(e,t,n,i,r){if(e===null){var o=n.type;if(typeof o==="function"&&!Bv(o)&&o.defaultProps===void 0&&n.compare===null)return t.tag=15,t.type=o,m_(e,t,o,i,r);return e=rd(n.type,null,i,t,t.mode,r),e.ref=t.ref,e.return=t,t.child=e}if(o=e.child,!rb(e,r)){var s=o.memoizedProps;if(n=n.compare,n=n!==null?n:Au,n(s,i)&&e.ref===t.ref)return xr(e,t,r)}return t.flags|=1,e=pr(o,i),e.ref=t.ref,e.return=t,t.child=e}function m_(e,t,n,i,r){if(e!==null){var o=e.memoizedProps;if(Au(o,i)&&e.ref===t.ref)if(ut=!1,t.pendingProps=i=o,rb(e,r))(e.flags&131072)!==0&&(ut=!0);else return t.lanes=e.lanes,xr(e,t,r)}return Kg(e,t,n,i,r)}function g_(e,t,n,i){var r=i.children,o=e!==null?e.memoizedState:null;if(e===null&&t.stateNode===null&&(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),i.mode==="hidden"){if((t.flags&128)!==0){if(o=o!==null?o.baseLanes|n:n,e!==null){i=t.child=e.child;for(r=0;i!==null;)r=r|i.lanes|i.childLanes,i=i.sibling;i=r&~o}else i=0,t.child=null;return q1(e,t,o,n,i)}if((n&536870912)!==0)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&sd(t,o!==null?o.cachePool:null),o!==null?D1(t,o):Bg(),Lk(t);else return i=t.lanes=536870912,q1(e,t,o!==null?o.baseLanes|n:n,n,i)}else o!==null?(sd(t,o.cachePool),D1(t,o),uo(),t.memoizedState=null):(e!==null&&sd(t,null),Bg(),uo());return ct(e,t,r,n),t.child}function xu(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function q1(e,t,n,i,r){var o=Vv();return o=o===null?null:{parent:at._currentValue,pool:o},t.memoizedState={baseLanes:n,cachePool:o},e!==null&&sd(t,null),Bg(),Lk(t),e!==null&&fs(e,t,i,!0),t.childLanes=r,null}function ud(e,t){return t=ah({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function $1(e,t,n){return ps(t,e.child,null,n),e=ud(t,t.pendingProps),e.flags|=2,cn(t),t.memoizedState=null,e}function SB(e,t,n){var i=t.pendingProps,r=(t.flags&128)!==0;if(t.flags&=-129,e===null){if(le){if(i.mode==="hidden")return e=ud(t,i),t.lanes=536870912,e.memoizedState={baseLanes:0,cachePool:null},xu(null,e);if(Pg(t),(e=ze)?(e=vC(e,Bn),e=e!==null&&e.data==="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:mo!==null?{id:Pi,overflow:Ii}:null,retryLane:536870912,hydrationErrors:null},n=_k(e),n.return=t,t.child=n,vt=t,ze=null)):e=null,e===null)throw go(t);return t.lanes=536870912,null}return ud(t,i)}var o=e.memoizedState;if(o!==null){var s=o.dehydrated;if(Pg(t),r)if(t.flags&256)t.flags&=-257,t=$1(e,t,n);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(A(558));else if(ut||fs(e,t,n,!1),r=(n&e.childLanes)!==0,ut||r){if(vo.current===null){if(i=Re,i!==null&&(s=GS(i,n),s!==0&&s!==o.retryLane))throw o.retryLane=s,ws(e,s),en(i,e,s),nb;Kd()}t=$1(e,t,n)}else e=o.treeContext,ze=In(s.nextSibling),vt=t,le=!0,lo=null,Bn=!1,e!==null&&Ek(t,e),t=ud(t,i),t.flags|=134221824;return t}return e=pr(e.child,{mode:i.mode,children:i.children}),e.ref=t.ref,t.child=e,e.return=t,e}function il(e,t){var n=t.ref;if(n===null)e!==null&&e.ref!==null&&(t.flags|=4194816);else{if(typeof n!=="function"&&typeof n!=="object")throw Error(A(284));if(e===null||e.ref!==n)t.flags|=4194816}}function Kg(e,t,n,i,r){if(ds(t),n=qv(e,t,n,i,void 0,r),i=$v(),e!==null&&!ut)return Xv(e,t,r),xr(e,t,r);return le&&i&&nh(t),t.flags|=1,ct(e,t,n,r),t.child}function X1(e,t,n,i,r,o){if(ds(t),t.updateQueue=null,n=Bk(t,i,n,r),zk(e),i=$v(),e!==null&&!ut)return Xv(e,t,o),xr(e,t,o);return le&&i&&nh(t),t.flags|=1,ct(e,t,n,o),t.child}function G1(e,t,n,i,r){if(ds(t),t.stateNode===null){var o=ml,s=n.contextType;typeof s==="object"&&s!==null&&(o=Ct(s)),o=new n(i,o),t.memoizedState=o.state!==null&&o.state!==void 0?o.state:null,o.updater=Ug,t.stateNode=o,o._reactInternals=t,o=t.stateNode,o.props=i,o.state=t.memoizedState,o.refs={},Uv(t),s=n.contextType,o.context=typeof s==="object"&&s!==null?Ct(s):ml,o.state=t.memoizedState,s=n.getDerivedStateFromProps,typeof s==="function"&&(Qm(t,n,s,i),o.state=t.memoizedState),typeof n.getDerivedStateFromProps==="function"||typeof o.getSnapshotBeforeUpdate==="function"||typeof o.UNSAFE_componentWillMount!=="function"&&typeof o.componentWillMount!=="function"||(s=o.state,typeof o.componentWillMount==="function"&&o.componentWillMount(),typeof o.UNSAFE_componentWillMount==="function"&&o.UNSAFE_componentWillMount(),s!==o.state&&Ug.enqueueReplaceState(o,o.state,null),bu(t,i,o,r),vu(),o.state=t.memoizedState),typeof o.componentDidMount==="function"&&(t.flags|=4194308),i=!0}else if(e===null){o=t.stateNode;var l=t.memoizedProps,a=gs(n,l);o.props=a;var u=o.context,c=n.contextType;s=ml,typeof c==="object"&&c!==null&&(s=Ct(c));var f=n.getDerivedStateFromProps;c=typeof f==="function"||typeof o.getSnapshotBeforeUpdate==="function",l=t.pendingProps!==l,c||typeof o.UNSAFE_componentWillReceiveProps!=="function"&&typeof o.componentWillReceiveProps!=="function"||(l||u!==s)&&U1(t,o,i,s),Jr=!1;var d=t.memoizedState;o.state=d,bu(t,i,o,r),vu(),u=t.memoizedState,l||d!==u||Jr?(typeof f==="function"&&(Qm(t,n,f,i),u=t.memoizedState),(a=Jr||H1(t,n,a,i,d,u,s))?(c||typeof o.UNSAFE_componentWillMount!=="function"&&typeof o.componentWillMount!=="function"||(typeof o.componentWillMount==="function"&&o.componentWillMount(),typeof o.UNSAFE_componentWillMount==="function"&&o.UNSAFE_componentWillMount()),typeof o.componentDidMount==="function"&&(t.flags|=4194308)):(typeof o.componentDidMount==="function"&&(t.flags|=4194308),t.memoizedProps=i,t.memoizedState=u),o.props=i,o.state=u,o.context=s,i=a):(typeof o.componentDidMount==="function"&&(t.flags|=4194308),i=!1)}else{o=t.stateNode,Lg(e,t),s=t.memoizedProps,c=gs(n,s),o.props=c,f=t.pendingProps,d=o.context,u=n.contextType,a=ml,typeof u==="object"&&u!==null&&(a=Ct(u)),l=n.getDerivedStateFromProps,(u=typeof l==="function"||typeof o.getSnapshotBeforeUpdate==="function")||typeof o.UNSAFE_componentWillReceiveProps!=="function"&&typeof o.componentWillReceiveProps!=="function"||(s!==f||d!==a)&&U1(t,o,i,a),Jr=!1,d=t.memoizedState,o.state=d,bu(t,i,o,r),vu();var h=t.memoizedState;s!==f||d!==h||Jr||e!==null&&e.dependencies!==null&&Ad(e.dependencies)?(typeof l==="function"&&(Qm(t,n,l,i),h=t.memoizedState),(c=Jr||H1(t,n,c,i,d,h,a)||e!==null&&e.dependencies!==null&&Ad(e.dependencies))?(u||typeof o.UNSAFE_componentWillUpdate!=="function"&&typeof o.componentWillUpdate!=="function"||(typeof o.componentWillUpdate==="function"&&o.componentWillUpdate(i,h,a),typeof o.UNSAFE_componentWillUpdate==="function"&&o.UNSAFE_componentWillUpdate(i,h,a)),typeof o.componentDidUpdate==="function"&&(t.flags|=4),typeof o.getSnapshotBeforeUpdate==="function"&&(t.flags|=1024)):(typeof o.componentDidUpdate!=="function"||s===e.memoizedProps&&d===e.memoizedState||(t.flags|=4),typeof o.getSnapshotBeforeUpdate!=="function"||s===e.memoizedProps&&d===e.memoizedState||(t.flags|=1024),t.memoizedProps=i,t.memoizedState=h),o.props=i,o.state=h,o.context=a,i=c):(typeof o.componentDidUpdate!=="function"||s===e.memoizedProps&&d===e.memoizedState||(t.flags|=4),typeof o.getSnapshotBeforeUpdate!=="function"||s===e.memoizedProps&&d===e.memoizedState||(t.flags|=1024),i=!1)}return o=i,il(e,t),i=(t.flags&128)!==0,o||i?(o=t.stateNode,n=i&&typeof n.getDerivedStateFromError!=="function"?null:o.render(),t.flags|=1,e!==null&&i?(t.child=ps(t,e.child,null,r),t.child=ps(t,null,n,r)):ct(e,t,n,r),t.memoizedState=o.state,e=t.child):e=xr(e,t,r),e}function Y1(e,t,n,i){return cs(),t.flags|=256,ct(e,t,n,i),t.child}var Fg={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function qg(e){return{baseLanes:e,cachePool:Ak()}}function $g(e,t,n){return e=e!==null?e.childLanes&~n:0,t&&(e|=dn),e}function v_(e,t,n){var i=t.pendingProps,r=!1,o=(t.flags&128)!==0,s;if((s=o)||(s=e!==null&&e.memoizedState===null?!1:(Ot.current&2)!==0),s&&(r=!0,t.flags&=-129),s=(t.flags&32)!==0,t.flags&=-33,e===null){if(le){if(r?ao(t):uo(),(e=ze)?(e=vC(e,Bn),e=e!==null&&e.data!=="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:mo!==null?{id:Pi,overflow:Ii}:null,retryLane:536870912,hydrationErrors:null},n=_k(e),n.return=t,t.child=n,vt=t,ze=null)):e=null,e===null)throw go(t);return mb(e)?t.lanes=32:t.lanes=536870912,null}if(o=i.children,i=i.fallback,r)return uo(),r=t.mode,o=ah({mode:"hidden",children:o},r),i=rs(i,r,n,null),o.return=t,i.return=t,o.sibling=i,t.child=o,i=t.child,i.memoizedState=qg(n),i.childLanes=$g(e,s,n),t.memoizedState=Fg,xu(null,i);return ao(t),ib(t,o)}var l=e.memoizedState;if(l!==null){var a=l.dehydrated;if(a!==null)return kB(e,t,o,s,i,a,l,n)}if(r)return uo(),r=i.fallback,o=t.mode,l=e.child,a=l.sibling,i=pr(l,{mode:"hidden",children:i.children}),i.subtreeFlags=l.subtreeFlags&1206910976,a!==null?r=pr(a,r):(r=rs(r,o,n,null),r.flags|=2),r.return=t,i.return=t,i.sibling=r,t.child=i,xu(null,i),i=t.child,r=e.child.memoizedState,r===null?r=qg(n):(o=r.cachePool,o!==null?(l=at._currentValue,o=o.parent!==l?{parent:l,pool:l}:o):o=Ak(),r={baseLanes:r.baseLanes|n,cachePool:o}),i.memoizedState=r,i.childLanes=$g(e,s,n),t.memoizedState=Fg,xu(e.child,i);return ao(t),n=e.child,e=n.sibling,n=pr(n,{mode:"visible",children:i.children}),n.return=t,n.sibling=null,e!==null&&(s=t.deletions,s===null?(t.deletions=[e],t.flags|=16):s.push(e)),t.child=n,t.memoizedState=null,n}function ib(e,t){return t=ah({mode:"visible",children:t},e.mode),t.return=e,e.child=t}function ah(e,t){return e=Zt(22,e,null,t),e.lanes=0,e}function qf(e,t,n){return ps(t,e.child,null,n),e=ib(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function kB(e,t,n,i,r,o,s,l){if(n){if(t.flags&256)return ao(t),t.flags&=-257,qf(e,t,l);if(t.memoizedState!==null)return uo(),t.child=e.child,t.flags|=128,null;return uo(),o=r.fallback,s=t.mode,r=ah({mode:"visible",children:r.children},s),o=rs(o,s,l,null),o.flags|=2,r.return=t,o.return=t,r.sibling=o,t.child=r,ps(t,e.child,null,l),r=t.child,r.memoizedState=qg(l),r.childLanes=$g(e,i,l),t.memoizedState=Fg,xu(null,r)}if(ao(t),mb(o)){if(i=o.nextSibling&&o.nextSibling.dataset,i)var a=i.dgst;return i=a,i!==""&&(r=Error(A(419)),r.stack="",r.digest=i,Tu({value:r,source:null,stack:null})),qf(e,t,l)}if(ut||fs(e,t,l,!1),i=(l&e.childLanes)!==0,ut||i){if(vo.current!==null)return qf(e,t,l);if(i=Re,i!==null&&(r=GS(i,l),r!==0&&r!==s.retryLane))throw s.retryLane=r,ws(e,r),en(i,e,r),nb;return yv(o)||Kd(),qf(e,t,l)}if(yv(o))return t.flags|=192,t.child=e.child,null;return e=s.treeContext,ze=In(o.nextSibling),vt=t,le=!0,lo=null,Bn=!1,e!==null&&Ek(t,e),t=ib(t,r.children),t.flags|=134221824,t}function W1(e,t,n){e.lanes|=t;var i=e.alternate;i!==null&&(i.lanes|=t),od(e.return,t,n)}function Q1(e){for(var t=null;e!==null;){var n=e.alternate;n!==null&&Md(n)===null&&(t=e),e=e.sibling}return t}function $f(e,t,n,i,r,o){var s=e.memoizedState;s===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:i,tail:n,tailMode:r,treeForkCount:o}:(s.isBackwards=t,s.rendering=null,s.renderingStartTime=0,s.last=i,s.tail=n,s.tailMode=r,s.treeForkCount=o)}function Jm(e){var t=e.child;for(e.child=null;t!==null;){var n=t.sibling;t.sibling=e.child,e.child=t,t=n}}function Xg(e,t,n){var i=t.pendingProps,r=i.revealOrder,o=i.tail;i=i.children;var s=Ot.current;if(t.flags&128)return Nu(t,s),null;var l=(s&2)!==0;if(l?(s=s&1|2,t.flags|=128):s&=1,Nu(t,s),r==="backwards"&&e!==null?(Jm(e),ct(e,t,i,n),Jm(e)):ct(e,t,i,n),i=le?Ru:0,!l&&e!==null&&(e.flags&128)!==0)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&W1(e,n,t);else if(e.tag===19)W1(e,n,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;e.sibling===null;){if(e.return===null||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}switch(r){case"backwards":n=Q1(t.child),n===null?(r=t.child,t.child=null):(r=n.sibling,n.sibling=null,Jm(t)),$f(t,!0,r,null,o,i);break;case"unstable_legacy-backwards":n=null,r=t.child;for(t.child=null;r!==null;){if(e=r.alternate,e!==null&&Md(e)===null){t.child=r;break}e=r.sibling,r.sibling=n,n=r,r=e}$f(t,!0,n,null,o,i);break;case"together":$f(t,!1,null,null,void 0,i);break;case"independent":t.memoizedState=null;break;default:n=Q1(t.child),n===null?(r=t.child,t.child=null):(r=n.sibling,n.sibling=null),$f(t,!1,r,n,o,i)}return t.child}function J1(e,t,n){var i=t.pendingProps;return no(t,t.type,i.value),ct(e,t,i.children,n),t.child}function xr(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),yo|=t.lanes,(n&t.childLanes)===0)if(e!==null){if(fs(e,t,n,!1),(n&t.childLanes)===0)return null}else return null;if(e!==null&&t.child!==e.child)throw Error(A(153));if(t.child!==null){e=t.child,n=pr(e,e.pendingProps),t.child=n;for(n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=pr(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function rb(e,t){if((e.lanes&t)!==0)return!0;return e=e.dependencies,e!==null&&Ad(e)?!0:!1}function _B(e,t,n){switch(t.tag){case 3:xd(t,t.stateNode.containerInfo),no(t,at,e.memoizedState.cache),cs();break;case 27:case 5:xg(t);break;case 4:xd(t,t.stateNode.containerInfo);break;case 10:no(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,Pg(t),null;break;case 13:var i=t.memoizedState;if(i!==null){if(i.dehydrated!==null)return ao(t),t.flags|=128,null;i=fs(e,t,n,!1);var r=t.child.childLanes;if(i||(n&r)!==0)return v_(e,t,n);return ao(t),e=xr(e,t,n),e!==null?e.sibling:null}ao(t);break;case 19:if(t.flags&128)return Xg(e,t,n);if(r=(e.flags&128)!==0,i=(n&t.childLanes)!==0,i||(fs(e,t,n,!1),i=(n&t.childLanes)!==0),r){if(i)return Xg(e,t,n);t.flags|=128}if(r=t.memoizedState,r!==null&&(r.rendering=null,r.tail=null,r.lastEffect=null),Nu(t,Ot.current),i)break;else return null;case 22:return t.lanes=0,g_(e,t,n,t.pendingProps);case 24:no(t,at,e.memoizedState.cache)}return xr(e,t,n)}function b_(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps)ut=!0;else{if(!rb(e,n)&&(t.flags&128)===0)return ut=!1,_B(e,t,n);ut=(e.flags&131072)!==0?!0:!1}else ut=!1,le&&(t.flags&1048576)!==0&&Ck(t,Ru,t.index);switch(t.lanes=0,t.tag){case 16:e:{var i=t.pendingProps;if(e=Zo(t.elementType),t.type=e,typeof e==="function")Bv(e)?(i=gs(e,i),t.tag=1,t=G1(null,t,e,i,n)):(t.tag=0,t=Kg(null,t,e,i,n));else{if(e!==void 0&&e!==null){var r=e.$$typeof;if(r===_v){t.tag=11,t=K1(null,t,e,i,n);break e}else if(r===Cv){t.tag=14,t=F1(null,t,e,i,n);break e}else if(r===zi){t.tag=10,t.type=e,t=J1(null,t,n);break e}}throw t=bg(e)||e,Error(A(306,t,""))}}return t;case 0:return Kg(e,t,t.type,t.pendingProps,n);case 1:return i=t.type,r=gs(i,t.pendingProps),G1(e,t,i,r,n);case 3:e:{if(xd(t,t.stateNode.containerInfo),e===null)throw Error(A(387));i=t.pendingProps;var o=t.memoizedState;r=o.element,Lg(e,t),bu(t,i,null,n);var s=t.memoizedState;if(i=s.cache,no(t,at,i),i!==o.cache&&Ng(t,[at],n,!0),vu(),i=s.element,o.isDehydrated)if(o={element:i,isDehydrated:!1,cache:s.cache},t.updateQueue.baseState=o,t.memoizedState=o,t.flags&256){t=Y1(e,t,i,n);break e}else if(i!==r){r=zn(Error(A(424)),t),Tu(r),t=Y1(e,t,i,n);break e}else{switch(e=t.stateNode.containerInfo,e.nodeType){case 9:e=e.body;break;default:e=e.nodeName==="HTML"?e.ownerDocument.body:e}ze=In(e.firstChild),vt=t,le=!0,lo=null,Bn=!0,n=Mk(t,null,i,n);for(t.child=n;n;)n.flags=n.flags&-3|134221824,n=n.sibling}else{if(cs(),i===r){t=xr(e,t,n);break e}ct(e,t,i,n)}t=t.child}return t;case 26:return il(e,t),e===null?(n=kS(t.type,null,t.pendingProps,null))?t.memoizedState=n:le||(t.stateNode=aC(t.type,t.pendingProps,so.current,t)):t.memoizedState=kS(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return xg(t),e===null&&le&&(i=t.stateNode=bC(t.type,t.pendingProps,so.current),vt=t,Bn=!0,r=ze,wo(t.type)?(xv=r,ze=In(i.firstChild)):ze=r),ct(e,t,t.pendingProps.children,n),il(e,t),e===null&&(t.flags|=4194304),t.child;case 5:if(e===null&&le){if(r=i=ze)i=g4(i,t.type,t.pendingProps,Bn),i!==null?(t.stateNode=i,vt=t,ze=In(i.firstChild),Bn=!1,r=!0):r=!1;r||go(t)}return xg(t),r=t.type,o=t.pendingProps,s=e!==null?e.memoizedProps:null,i=o.children,gv(r,o)?i=null:s!==null&&gv(r,s)&&(t.flags|=32),t.memoizedState!==null&&(r=qv(e,t,cB,null,null,n),Vl._currentValue=r),il(e,t),ct(e,t,i,n),t.child;case 6:if(e===null&&le){if(e=n=ze)n=v4(n,t.pendingProps,Bn),n!==null?(t.stateNode=n,vt=t,ze=null,e=!0):e=!1;e||go(t)}return null;case 13:return v_(e,t,n);case 4:return xd(t,t.stateNode.containerInfo),i=t.pendingProps,e===null?t.child=ps(t,null,i,n):ct(e,t,i,n),t.child;case 11:return K1(e,t,t.type,t.pendingProps,n);case 7:return i=t.pendingProps,il(e,t),ct(e,t,i,n),t.child;case 8:return ct(e,t,t.pendingProps.children,n),t.child;case 12:return ct(e,t,t.pendingProps.children,n),t.child;case 10:return J1(e,t,n);case 9:return r=t.type._context,i=t.pendingProps.children,ds(t),r=Ct(r),i=i(r),t.flags|=1,ct(e,t,i,n),t.child;case 14:return F1(e,t,t.type,t.pendingProps,n);case 15:return m_(e,t,t.type,t.pendingProps,n);case 19:return Xg(e,t,n);case 31:return SB(e,t,n);case 22:return g_(e,t,n,t.pendingProps);case 24:return ds(t),i=Ct(at),e===null?(r=Vv(),r===null&&(r=Re,o=Iv(),r.pooledCache=o,o.refCount++,o!==null&&(r.pooledCacheLanes|=n),r=o),t.memoizedState={parent:i,cache:r},Uv(t),no(t,at,r)):((e.lanes&n)!==0&&(Lg(e,t),bu(t,null,null,n),vu()),r=e.memoizedState,o=t.memoizedState,r.parent!==i?(r={parent:i,cache:i},t.memoizedState=r,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=r),no(t,at,i)):(i=o.cache,no(t,at,i),i!==r.cache&&Ng(t,[at],n,!0))),ct(e,t,t.pendingProps.children,n),t.child;case 30:return t.stateNode===null&&(t.stateNode={autoName:null,paired:null,clones:null,ref:null}),i=t.pendingProps,i.name!=null&&i.name!=="auto"?t.flags|=e===null?18882560:18874368:le&&nh(t),e!==null&&e.memoizedProps.name!==i.name?t.flags|=4194816:il(e,t),ct(e,t,i.children,n),t.child;case 29:throw t.pendingProps}throw Error(A(156,t.tag))}function fr(e){e.flags|=4}function Zm(e,t,n,i,r){var o;if(o=(e.mode&32)!==0)o=n===null?ES(t,i):ES(t,i)&&(i.src!==n.src||i.srcSet!==n.srcSet);if(o){if(e.flags|=16777216,(r&335544128)===r)if(e.stateNode.complete)e.flags|=8192;else if(X_())e.flags|=8192;else throw ss=Rd,Hv}else e.flags&=-16777217}function Z1(e,t){if(t.type!=="stylesheet"||(t.state.loading&4)!==0)e.flags&=-16777217;else if(e.flags|=16777216,!SC(t))if(X_())e.flags|=8192;else throw ss=Rd,Hv}function Xf(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag!==22?qS():536870912,e.lanes|=t,Dl|=t)}function eu(e,t){if(!le)switch(e.tailMode){case"visible":break;case"collapsed":for(var n=e.tail,i=null;n!==null;)n.alternate!==null&&(i=n),n=n.sibling;i===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:i.sibling=null;break;default:t=e.tail;for(n=null;t!==null;)t.alternate!==null&&(n=t),t=t.sibling;n===null?e.tail=null:n.sibling=null}}function Le(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,i=0;if(t)for(var r=e.child;r!==null;)n|=r.lanes|r.childLanes,i|=r.subtreeFlags&1206910976,i|=r.flags&1206910976,r.return=e,r=r.sibling;else for(r=e.child;r!==null;)n|=r.lanes|r.childLanes,i|=r.subtreeFlags,i|=r.flags,r.return=e,r=r.sibling;return e.subtreeFlags|=i,e.childLanes=n,t}function CB(e,t,n){var i=t.pendingProps;switch(Pv(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Le(t),null;case 1:return Le(t),null;case 3:if(n=t.stateNode,i=null,e!==null&&(i=e.memoizedState.cache),t.memoizedState.cache!==i&&(t.flags|=2048),mr(at),Rl(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),e===null||e.child===null)tl(t)?fr(t):e===null||e.memoizedState.isDehydrated&&(t.flags&256)===0||(t.flags|=1024,Gm());return Le(t),null;case 26:var{type:r,memoizedState:o}=t;return e===null?(fr(t),o!==null?(Le(t),Z1(t,o)):(Le(t),Zm(t,r,null,i,n))):o?o!==e.memoizedState?(fr(t),Le(t),Z1(t,o)):(Le(t),t.flags&=-16777217):(e=e.memoizedProps,e!==i&&fr(t),Le(t),Zm(t,r,e,i,n)),null;case 27:if(wd(t),n=so.current,r=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==i&&fr(t);else{if(!i){if(t.stateNode===null)throw Error(A(166));return Le(t),t.subtreeFlags&=-33554433,null}e=Vi.current,tl(t)?E1(t,e):(e=bC(r,i,n),t.stateNode=e,fr(t))}return Le(t),t.subtreeFlags&=-33554433,null;case 5:if(wd(t),r=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==i&&fr(t);else{if(!i){if(t.stateNode===null)throw Error(A(166));return Le(t),t.subtreeFlags&=-33554433,null}if(o=Vi.current,tl(t))E1(t,o);else{var s=Bu(so.current);switch(o){case 1:o=s.createElementNS("http://www.w3.org/2000/svg",r);break;case 2:o=s.createElementNS("http://www.w3.org/1998/Math/MathML",r);break;default:switch(r){case"svg":o=s.createElementNS("http://www.w3.org/2000/svg",r);break;case"math":o=s.createElementNS("http://www.w3.org/1998/Math/MathML",r);break;case"script":o=s.createElement("div"),o.innerHTML="<script></script>",o=o.removeChild(o.firstChild);break;case"select":o=typeof i.is==="string"?s.createElement("select",{is:i.is}):s.createElement("select"),i.multiple?o.multiple=!0:i.size&&(o.size=i.size);break;default:o=typeof i.is==="string"?s.createElement(r,{is:i.is}):s.createElement(r)}}o[_t]=t,o[nn]=i;e:for(s=t.child;s!==null;){if(s.tag===5||s.tag===6)o.appendChild(s.stateNode);else if(s.tag!==4&&s.tag!==27&&s.child!==null){s.child.return=s,s=s.child;continue}if(s===t)break e;for(;s.sibling===null;){if(s.return===null||s.return===t)break e;s=s.return}s.sibling.return=s.return,s=s.sibling}t.stateNode=o;e:switch(At(o,r,i),r){case"button":case"input":case"select":case"textarea":i=!!i.autoFocus;break e;case"img":i=!0;break e;default:i=!1}i&&fr(t)}}return Le(t),t.subtreeFlags&=-33554433,Zm(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,n),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==i&&fr(t);else{if(typeof i!=="string"&&t.stateNode===null)throw Error(A(166));if(e=so.current,tl(t)){if(e=t.stateNode,n=t.memoizedProps,i=null,r=vt,r!==null)switch(r.tag){case 27:case 5:i=r.memoizedProps}e[_t]=t,e=e.nodeValue===n||i!==null&&i.suppressHydrationWarning===!0||sC(e.nodeValue,n)?!0:!1,e||go(t,!0)}else e=Bu(e).createTextNode(i),e[_t]=t,t.stateNode=e}return Le(t),null;case 31:if(n=t.memoizedState,e===null||e.memoizedState!==null){if(i=tl(t),n!==null){if(e===null){if(!i)throw Error(A(318));if(e=t.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(A(557));e[_t]=t}else cs(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;Le(t),e=!1}else n=Gm(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=n),e=!0;if(!e){if(t.flags&256)return cn(t),t;return cn(t),null}if((t.flags&128)!==0)throw Error(A(558))}return Le(t),null;case 13:if(i=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(r=tl(t),i!==null&&i.dehydrated!==null){if(e===null){if(!r)throw Error(A(318));if(r=t.memoizedState,r=r!==null?r.dehydrated:null,!r)throw Error(A(317));r[_t]=t}else cs(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;Le(t),r=!1}else r=Gm(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=r),r=!0;if(!r){if(t.flags&256)return cn(t),t;return cn(t),null}}if(cn(t),(t.flags&128)!==0)return t.lanes=n,t;return n=i!==null,e=e!==null&&e.memoizedState!==null,n&&(i=t.child,r=null,i.alternate!==null&&i.alternate.memoizedState!==null&&i.alternate.memoizedState.cachePool!==null&&(r=i.alternate.memoizedState.cachePool.pool),o=null,i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(o=i.memoizedState.cachePool.pool),o!==r&&(i.flags|=2048)),n!==e&&n&&(t.child.flags|=8192),Xf(t,t.updateQueue),Le(t),null;case 4:return Rl(),e===null&&rC(t.stateNode.containerInfo),t.flags|=67108864,Le(t),null;case 10:return mr(t.type),Le(t),null;case 19:if(Kv(t),i=t.memoizedState,i===null)return Le(t),null;if(r=(t.flags&128)!==0,o=i.rendering,o===null)if(r)eu(i,!1);else{if(Qe!==0||e!==null&&(e.flags&128)!==0)for(e=t.child;e!==null;){if(o=Md(e),o!==null){t.flags|=128,eu(i,!1),e=o.updateQueue,t.updateQueue=e,Xf(t,e),t.subtreeFlags=0,e=n;for(n=t.child;n!==null;)kk(n,e),n=n.sibling;return Nu(t,Ot.current&1|2),le&&dr(t,i.treeForkCount),t.child}e=e.sibling}i.tail!==null&&hn()>Ud&&(t.flags|=128,r=!0,eu(i,!1),t.lanes=4194304)}else{if(!r)if(e=Md(o),e!==null){if(t.flags|=128,r=!0,e=e.updateQueue,t.updateQueue=e,Xf(t,e),eu(i,!0),i.tail===null&&i.tailMode!=="collapsed"&&i.tailMode!=="visible"&&!o.alternate&&!le)return Le(t),null}else 2*hn()-i.renderingStartTime>Ud&&n!==536870912&&(t.flags|=128,r=!0,eu(i,!1),t.lanes=4194304);i.isBackwards?(o.sibling=t.child,t.child=o):(e=i.last,e!==null?e.sibling=o:t.child=o,i.last=o)}if(i.tail!==null){e=i.tail;e:{for(n=e;n!==null;){if(n.alternate!==null){n=!1;break e}n=n.sibling}n=!0}return i.rendering=e,i.tail=e.sibling,i.renderingStartTime=hn(),e.sibling=null,o=Ot.current,o=r?o&1|2:o&1,i.tailMode==="visible"||i.tailMode==="collapsed"||!n||le?Nu(t,o):(n=o,Be(Rt,t),Be(Ot,n),Lt===null&&(Lt=t)),le&&dr(t,i.treeForkCount),e}return Le(t),null;case 22:case 23:return cn(t),jv(),i=t.memoizedState!==null,e!==null?e.memoizedState!==null!==i&&(t.flags|=8192):i&&(t.flags|=8192),i?(n&536870912)!==0&&(t.flags&128)===0&&(Le(t),t.subtreeFlags&6&&(t.flags|=8192)):Le(t),n=t.updateQueue,n!==null&&Xf(t,n.retryQueue),n=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),i=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(i=t.memoizedState.cachePool.pool),i!==n&&(t.flags|=2048),e!==null&&Et(os),null;case 24:return n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),mr(at),Le(t),null;case 25:return null;case 30:return t.flags|=33554432,Le(t),null}throw Error(A(156,t.tag))}function EB(e,t){switch(Pv(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return mr(at),Rl(),e=t.flags,(e&65536)!==0&&(e&128)===0?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return wd(t),null;case 31:if(t.memoizedState!==null){if(cn(t),t.alternate===null)throw Error(A(340));cs()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(cn(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(A(340));cs()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return Kv(t),e=t.flags,e&65536?(t.flags=e&-65537|128,e=t.memoizedState,e!==null&&(e.rendering=null,e.tail=null),t.flags|=4,t):null;case 4:return Rl(),null;case 10:return mr(t.type),null;case 22:case 23:return cn(t),jv(),e!==null&&Et(os),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return mr(at),null;case 25:return null;default:return null}}function y_(e,t){switch(Pv(t),t.tag){case 3:mr(at),Rl();break;case 26:case 27:case 5:wd(t);break;case 4:Rl();break;case 31:t.memoizedState!==null&&cn(t);break;case 13:cn(t);break;case 19:Kv(t);break;case 10:mr(t.type);break;case 22:case 23:cn(t),jv(),e!==null&&Et(os);break;case 24:mr(at)}}function Yu(e,t){try{var n=t.updateQueue,i=n!==null?n.lastEffect:null;if(i!==null){var r=i.next;n=r;do{if((n.tag&e)===e){i=void 0;var o=n.create,s=n.inst;i=o(),s.destroy=i}n=n.next}while(n!==r)}}catch(l){ke(t,t.return,l)}}function bo(e,t,n){try{var i=t.updateQueue,r=i!==null?i.lastEffect:null;if(r!==null){var o=r.next;i=o;do{if((i.tag&e)===e){var s=i.inst,l=s.destroy;if(l!==void 0){s.destroy=void 0,r=t;var a=n,u=l;try{u()}catch(c){ke(r,a,c)}}}i=i.next}while(i!==o)}}catch(c){ke(t,t.return,c)}}function x_(e){var t=e.updateQueue;if(t!==null){var n=e.stateNode;try{Dk(t,n)}catch(i){ke(e,e.return,i)}}}function w_(e,t,n){n.props=gs(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(i){ke(e,t,i)}}function Di(e,t){try{var n=e.ref;if(n!==null){switch(e.tag){case 26:case 27:case 5:var i=e.stateNode;break;case 30:var r=e.stateNode,o=vr(e.memoizedProps,r);if(r.ref===null||r.ref.name!==o)r.ref=dC(o);i=r.ref;break;case 7:if(e.stateNode===null){var s=new vn(e);tn(e.child,!1,p4,s,void 0,void 0),e.stateNode=s}i=e.stateNode;break;default:i=e.stateNode}typeof n==="function"?e.refCleanup=n(i):n.current=i}}catch(l){ke(e,t,l)}}function kt(e,t){var n=e.ref,i=e.refCleanup;if(n!==null)if(typeof i==="function")try{i()}catch(r){ke(e,t,r)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof n==="function")try{n(null)}catch(r){ke(e,t,r)}else n.current=null}function Bd(e,t){if((e.tag===5||e.tag===27||e.tag===6)&&e.alternate===null&&t!==null)for(var n=0;n<t.length;n++)gC(e.stateNode,t[n])}function eS(e){for(var t=e.return;t!==null;){if(sb(t)&&gC(e.stateNode,t.stateNode),ob(t))break;t=t.return}}function wu(e){for(var t=e.return;t!==null;){if(sb(t)&&m4(e.stateNode,t.stateNode),ob(t))break;t=t.return}}function ob(e){return e.tag===5||e.tag===3||e.tag===27}function sb(e){return e&&e.tag===7&&e.stateNode!==null}function Gg(e){var{type:t,memoizedProps:n,stateNode:i}=e;try{e:switch(t){case"button":case"input":case"select":case"textarea":n.autoFocus&&i.focus();break e;case"img":n.src?i.src=n.src:n.srcSet&&(i.srcset=n.srcSet)}}catch(r){ke(e,e.return,r)}}function eg(e,t,n){try{var i=e.stateNode;WB(i,e.type,n,t),i[nn]=t}catch(r){ke(e,e.return,r)}}function S_(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&wo(e.type)||e.tag===4}function tg(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||S_(e.return))return null;e=e.return}e.sibling.return=e.return;for(e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.tag===27&&wo(e.type))continue e;if(e.flags&2)continue e;if(e.child===null||e.tag===4)continue e;else e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Yg(e,t,n,i){var r=e.tag;if(r===5||r===6)r=e.stateNode,t?(n.nodeType===9?n.body:n.nodeName==="HTML"?n.ownerDocument.body:n).insertBefore(r,t):(t=n.nodeType===9?n.body:n.nodeName==="HTML"?n.ownerDocument.body:n,t.appendChild(r),n=n._reactRootContainer,n!==null&&n!==void 0||t.onclick!==null||(t.onclick=Bi)),Bd(e,i),me=!0;else if(r!==4&&(r===27&&(Bd(e,i),i=null,wo(e.type)&&(n=e.stateNode,t=null)),e=e.child,e!==null))for(Yg(e,t,n,i),e=e.sibling;e!==null;)Yg(e,t,n,i),e=e.sibling}function Pd(e,t,n,i){var r=e.tag;if(r===5||r===6)r=e.stateNode,t?n.insertBefore(r,t):n.appendChild(r),Bd(e,i),me=!0;else if(r!==4&&(r===27&&(Bd(e,i),i=null,wo(e.type)&&(n=e.stateNode)),e=e.child,e!==null))for(Pd(e,t,n,i),e=e.sibling;e!==null;)Pd(e,t,n,i),e=e.sibling}function k_(e){var{stateNode:t,memoizedProps:n}=e;try{for(var i=e.type,r=t.attributes;r.length;)t.removeAttributeNode(r[0]);At(t,i,n),t[_t]=e,t[nn]=n}catch(o){ke(e,e.return,o)}}var Id=!1,fn=null;function tS(e){if(e.tag===30||(e.subtreeFlags&33554432)!==0)Id=!0}var Li=null;function nS(){var e=Li;return Li=null,e}var Jt=0;function Fl(e,t,n,i,r){return Jt=0,__(e.child,t,n,i,r)}function __(e,t,n,i,r){for(var o=!1;e!==null;){if(e.tag===5){var s=e.stateNode;if(i!==null){var l=vv(s);i.push(l),l.view&&(o=!0)}else o||vv(s).view&&(o=!0);Id=!0,uC(s,Jt===0?t:t+"_"+Jt,n),Jt++}else if(e.tag!==22||e.memoizedState===null)e.tag===30&&r||__(e.child,t,n,i,r)&&(o=!0);e=e.sibling}return o}function Ui(e,t){for(;e!==null;){if(e.tag===5)cC(e.stateNode,e.memoizedProps);else if(e.tag!==22||e.memoizedState===null)e.tag===30&&t||Ui(e.child,t);e=e.sibling}}function cd(e){if((e.subtreeFlags&18874368)!==0)for(e=e.child;e!==null;){if(e.tag!==22||e.memoizedState===null){if(cd(e),e.tag===30&&(e.flags&18874368)!==0&&e.stateNode.paired){var t=e.memoizedProps;if(t.name==null||t.name==="auto")throw Error(A(544));var n=t.name;t=kr(t.default,t.share),t!=="none"&&(Fl(e,n,t,null,!1)||Ui(e.child,!1))}}e=e.sibling}}function Wg(e,t){if(e.tag===30){var n=e.stateNode,i=e.memoizedProps,r=vr(i,n),o=kr(i.default,n.paired?i.share:i.enter);o!=="none"?Fl(e,r,o,null,!1)?(cd(e),n.paired||t||Ll(e,i.onEnter)):Ui(e.child,!1):cd(e)}else if((e.subtreeFlags&33554432)!==0)for(e=e.child;e!==null;)Wg(e,t),e=e.sibling;else cd(e)}function Qg(e){if(fn!==null&&fn.size!==0){var t=fn;if((e.subtreeFlags&18874368)!==0)for(e=e.child;e!==null;){if(e.tag!==22||e.memoizedState===null){if(e.tag===30&&(e.flags&18874368)!==0){var n=e.memoizedProps,i=n.name;if(i!=null&&i!=="auto"){var r=t.get(i);if(r!==void 0){var o=kr(n.default,n.share);if(o!=="none"&&(Fl(e,i,o,null,!1)?(o=e.stateNode,r.paired=o,o.paired=r,Ll(e,n.onShare)):Ui(e.child,!1)),t.delete(i),t.size===0)break}}}Qg(e)}e=e.sibling}}}function Jg(e){if(e.tag===30){var t=e.memoizedProps,n=vr(t,e.stateNode),i=fn!==null?fn.get(n):void 0,r=kr(t.default,i!==void 0?t.share:t.exit);r!=="none"&&(Fl(e,n,r,null,!1)?i!==void 0?(r=e.stateNode,i.paired=r,r.paired=i,fn.delete(n),Ll(e,t.onShare)):Ll(e,t.onExit):Ui(e.child,!1)),fn!==null&&Qg(e)}else if((e.subtreeFlags&33554432)!==0)for(e=e.child;e!==null;)Jg(e),e=e.sibling;else fn!==null&&Qg(e)}function C_(e){for(e=e.child;e!==null;){if(e.tag===30){var t=e.memoizedProps,n=vr(t,e.stateNode);t=kr(t.default,t.update),e.flags&=-5,t!=="none"&&Fl(e,n,t,e.memoizedState=[],!1)}else(e.subtreeFlags&33554432)!==0&&C_(e);e=e.sibling}}function Zg(e){if((e.subtreeFlags&18874368)!==0)for(e=e.child;e!==null;){if(e.tag!==22||e.memoizedState===null){if(e.tag===30&&(e.flags&18874368)!==0){var t=e.stateNode;t.paired!==null&&(t.paired=null,Ui(e.child,!1))}Zg(e)}e=e.sibling}}function fd(e){if(e.tag===30)e.stateNode.paired=null,Ui(e.child,!1),Zg(e);else if((e.subtreeFlags&33554432)!==0)for(e=e.child;e!==null;)fd(e),e=e.sibling;else Zg(e)}function E_(e){for(e=e.child;e!==null;)e.tag===30?Ui(e.child,!1):(e.subtreeFlags&33554432)!==0&&E_(e),e=e.sibling}function lb(e,t,n,i,r,o,s){for(var l=!1;t!==null;){if(t.tag===5){var a=t.stateNode;if(o!==null&&Jt<o.length){var u=o[Jt],c=vv(a);if(u.view||c.view)l=!0;var f;if(f=(e.flags&4)===0)if(c.clip)f=!0;else{f=u.rect;var d=c.rect;f=f.y!==d.y||f.x!==d.x||f.height!==d.height||f.width!==d.width}f&&(e.flags|=4),c.abs?c=!u.abs:(u=u.rect,c=c.rect,c=u.height!==c.height||u.width!==c.width),c&&(e.flags|=32)}else e.flags|=32;(e.flags&4)!==0&&uC(a,Jt===0?n:n+"_"+Jt,r),l&&(e.flags&4)!==0||(Li===null&&(Li=[]),Li.push(a,Jt===0?i:i+"_"+Jt,t.memoizedProps)),Jt++}else if(t.tag!==22||t.memoizedState===null)t.tag===30&&s?e.flags|=t.flags&32:lb(e,t.child,n,i,r,o,s)&&(l=!0);t=t.sibling}return l}function O_(e,t){for(e=e.child;e!==null;){if(e.tag===30){var n=e.memoizedProps,i=e.stateNode,r=vr(n,i),o=kr(n.default,n.update);if(t){i=i.clones;var s=i===null?null:i.map(n4)}else s=e.memoizedState,e.memoizedState=null;i=e;var l=e.child;Jt=0,r=lb(i,l,r,r,o,s,!1),(e.flags&4)!==0&&r&&(t||Ll(e,n.onUpdate))}else(e.subtreeFlags&33554432)!==0&&O_(e,t);e=e.sibling}}var pt=!1,xe=!1,Ti=!1,ng=!1,iS=typeof WeakSet==="function"?WeakSet:Set,mt=null,Mi=!1,uu=!1,Vd=!1,ev=!1;function OB(e,t,n){if(e=e.containerInfo,pv=Hl,e=mk(e),Dv(e)){if("selectionStart"in e)var i={start:e.selectionStart,end:e.selectionEnd};else e:{i=(i=e.ownerDocument)&&i.defaultView||window;var r=i.getSelection&&i.getSelection();if(r&&r.rangeCount!==0){i=r.anchorNode;var o=r.anchorOffset,s=r.focusNode;r=r.focusOffset;try{i.nodeType,s.nodeType}catch(b){i=null;break e}var l=0,a=-1,u=-1,c=0,f=0,d=e,h=null;t:for(;;){for(var m;;){if(d!==i||o!==0&&d.nodeType!==3||(a=l+o),d!==s||r!==0&&d.nodeType!==3||(u=l+r),d.nodeType===3&&(l+=d.nodeValue.length),(m=d.firstChild)===null)break;h=d,d=m}for(;;){if(d===e)break t;if(h===i&&++c===o&&(a=l),h===s&&++f===r&&(u=l),(m=d.nextSibling)!==null)break;d=h,h=d.parentNode}d=m}i=a===-1||u===-1?null:{start:a,end:u}}else i=null}i=i||{start:0,end:0}}else i=null;mv={focusedElem:e,selectionRange:i},Hl=!1,n=(n&335544064)===n,mt=t;for(t=n?9270:1024;mt!==null;){if(e=mt,n&&(i=e.deletions,i!==null))for(o=0;o<i.length;o++)n&&Jg(i[o]);if(e.alternate===null&&(e.flags&2)!==0)n&&tS(e),Gf(n);else{if(e.tag===22){if(i=e.alternate,e.memoizedState!==null){i!==null&&i.memoizedState===null&&n&&Jg(i),Gf(n);continue}else if(i!==null&&i.memoizedState!==null){n&&tS(e),Gf(n);continue}}i=e.child,(e.subtreeFlags&t)!==0&&i!==null?(i.return=e,mt=i):(n&&C_(e),Gf(n))}}fn=null}function Gf(e){for(;mt!==null;){var t=mt,n=e,{alternate:i,flags:r}=t;switch(t.tag){case 0:case 11:case 15:break;case 1:if((r&1024)!==0&&i!==null){n=void 0,r=i.memoizedProps,i=i.memoizedState;var o=t.stateNode;try{var s=gs(t.type,r);n=o.getSnapshotBeforeUpdate(s,i),o.__reactInternalSnapshotBeforeUpdate=n}catch(l){ke(t,t.return,l)}}break;case 3:if((r&1024)!==0){if(i=t.stateNode.containerInfo,n=i.nodeType,n===9)bv(i);else if(n===1)switch(i.nodeName){case"HEAD":case"HTML":case"BODY":bv(i);break;default:i.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;case 30:n&&i!==null&&(n=vr(i.memoizedProps,i.stateNode),r=t.memoizedProps,r=kr(r.default,r.update),r!=="none"&&Fl(i,n,r,i.memoizedState=[],!0));break;default:if((r&1024)!==0)throw Error(A(163))}if(i=t.sibling,i!==null){i.return=t.return,mt=i;break}mt=t.return}}function A_(e,t,n){var i=n.flags;switch(n.tag){case 0:case 11:case 15:Ni(e,n),i&4&&Yu(5,n);break;case 1:if(Ni(e,n),i&4)if(e=n.stateNode,t===null)try{e.componentDidMount()}catch(s){ke(n,n.return,s)}else{var r=gs(n.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(r,t,e.__reactInternalSnapshotBeforeUpdate)}catch(s){ke(n,n.return,s)}}i&64&&x_(n),i&512&&Di(n,n.return);break;case 3:if(Ni(e,n),i&64&&(e=n.updateQueue,e!==null)){if(t=null,n.child!==null)switch(n.child.tag){case 27:case 5:t=n.child.stateNode;break;case 1:t=n.child.stateNode}try{Dk(e,t)}catch(s){ke(n,n.return,s)}}break;case 27:t===null&&i&4&&k_(n);case 26:case 5:Ni(e,n),t===null&&i&4&&Gg(n),i&512&&Di(n,n.return);break;case 12:Ni(e,n);break;case 31:Ni(e,n),i&4&&N_(e,n);break;case 13:Ni(e,n),i&4&&D_(e,n),i&64&&(e=n.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(n=VB.bind(null,n),b4(e,n))));break;case 22:if(i=n.memoizedState!==null||pt,!i){var o=t!==null&&t.memoizedState!==null||xe;t=pt,r=xe,pt=i,(xe=o)&&!r?(i=2,(n.subtreeFlags&8772)!==0&&(i|=1),ii(e,n,i)):Ni(e,n),pt=t,xe=r}break;case 30:Ni(e,n),i&512&&Di(n,n.return);break;case 7:i&512&&Di(n,n.return);default:Ni(e,n)}}function tv(e,t){for(e=e.child;e!==null;)R_(e,t),e=e.sibling}function R_(e,t){switch(e.tag){case 5:case 26:try{var n=e.stateNode;if(t){var i=n.style;typeof i.setProperty==="function"?i.setProperty("display","none","important"):i.display="none"}else{var r=e.stateNode,o=e.memoizedProps.style,s=o!==void 0&&o!==null&&o.hasOwnProperty("display")?o.display:null;r.style.display=s==null||typeof s==="boolean"?"":(""+s).trim()}}catch(a){ke(e,e.return,a)}nv(e,t);break;case 6:try{e.stateNode.nodeValue=t?"":e.memoizedProps,me=!0}catch(a){ke(e,e.return,a)}break;case 18:try{var l=e.stateNode;t?vS(l,!0):vS(e.stateNode,!1)}catch(a){ke(e,e.return,a)}break;case 22:case 23:e.memoizedState===null&&tv(e,t);break;default:tv(e,t)}}function nv(e,t){if(e.subtreeFlags&67108864)for(e=e.child;e!==null;){e:{var n=e,i=t;switch(n.tag){case 4:R_(n,i);break e;case 22:n.memoizedState===null&&nv(n,i);break e;default:nv(n,i)}}e=e.sibling}}function T_(e){var t=e.alternate;t!==null&&(e.alternate=null,T_(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&Wd(t)),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}var Fe=null,Wt=!1;function ni(e,t,n){for(n=n.child;n!==null;)M_(e,t,n),n=n.sibling}function M_(e,t,n){if(pn&&typeof pn.onCommitFiberUnmount==="function")try{pn.onCommitFiberUnmount(ju,n)}catch(o){}switch(n.tag){case 26:xe||kt(n,t),ni(e,t,n),n.memoizedState?n.memoizedState.count--:n.stateNode&&!xe&&(n=n.stateNode,n.parentNode.removeChild(n));break;case 27:xe||kt(n,t),wu(n);var i=Fe,r=Wt;wo(n.type)&&(Fe=n.stateNode,Wt=!1),ni(e,t,n),yC(n.stateNode,n.type,n.memoizedProps),Fe=i,Wt=r;break;case 5:xe||kt(n,t),wu(n);case 6:if(n.tag===6&&wu(n),i=Fe,r=Wt,Fe=null,ni(e,t,n),Fe=i,Wt=r,Fe!==null)if(Wt)try{(Fe.nodeType===9?Fe.body:Fe.nodeName==="HTML"?Fe.ownerDocument.body:Fe).removeChild(n.stateNode),me=!0}catch(o){ke(n,t,o)}else try{Fe.removeChild(n.stateNode),me=!0}catch(o){ke(n,t,o)}break;case 18:Fe!==null&&(Wt?(e=Fe,gS(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,n.stateNode),Ul(e)):gS(Fe,n.stateNode));break;case 4:i=Fe,r=Wt,Fe=n.stateNode.containerInfo,Wt=!0,ni(e,t,n),Fe=i,Wt=r;break;case 0:case 11:case 14:case 15:bo(2,n,t),xe||bo(4,n,t),ni(e,t,n);break;case 1:xe||(kt(n,t),i=n.stateNode,typeof i.componentWillUnmount==="function"&&w_(n,t,i)),ni(e,t,n);break;case 21:ni(e,t,n);break;case 22:xe=(i=xe)||n.memoizedState!==null,ni(e,t,n),xe=i;break;case 30:kt(n,t),ni(e,t,n);break;case 7:xe||kt(n,t),ni(e,t,n);break;default:ni(e,t,n)}}function N_(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{Ul(e)}catch(n){ke(t,t.return,n)}}}function D_(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{Ul(e)}catch(n){ke(t,t.return,n)}}function AB(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new iS),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new iS),t;default:throw Error(A(435,e.tag))}}function Yf(e,t){var n=AB(e);t.forEach(function(i){if(!n.has(i)){n.add(i);var r=HB.bind(null,e,i);i.then(r,r)}})}function Ut(e,t,n){var i=t.deletions;if(i!==null)for(var r=0;r<i.length;r++){var o=i[r],s=e,l=t,a=l;e:for(;a!==null;){switch(a.tag){case 27:if(wo(a.type)){Fe=a.stateNode,Wt=!1;break e}break;case 5:Fe=a.stateNode,Wt=!1;break e;case 3:case 4:Fe=a.stateNode.containerInfo,Wt=!0;break e}a=a.return}if(Fe===null)throw Error(A(160));M_(s,l,o),Fe=null,Wt=!1,s=o.alternate,s!==null&&(s.return=null),o.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)L_(t,e,n),t=t.sibling}var ri=null;function L_(e,t,n){var i=e.alternate,r=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(r&4&&(i=e.updateQueue,i=i!==null?i.events:null,i!==null))for(var o=0;o<i.length;o++){var s=i[o];s.ref.impl=s.nextImpl}Ut(t,e,n),jt(e),r&4&&(bo(3,e,e.return),Yu(3,e),bo(5,e,e.return));break;case 1:Ut(t,e,n),jt(e),r&512&&(xe||i===null||kt(i,i.return)),r&64&&pt&&(e=e.updateQueue,e!==null&&(t=e.callbacks,t!==null&&(n=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=n===null?t:n.concat(t))));break;case 26:if(o=ri,Ut(t,e,n),jt(e),r&512&&(xe||i===null||kt(i,i.return)),r&4)if(r=i!==null?i.memoizedState:null,n=e.memoizedState,i===null)if(n===null)if(e.stateNode===null)if(pt)e.stateNode=aC(e.type,e.memoizedProps,t.containerInfo,e);else{e:{t=e.type,n=e.memoizedProps,r=o.ownerDocument||o;t:switch(t){case"title":if(i=r.getElementsByTagName("title")[0],!i||i[qu]||i[_t]||i.namespaceURI==="http://www.w3.org/2000/svg"||i.hasAttribute("itemprop"))i=r.createElement(t),r.head.insertBefore(i,r.querySelector("head > title"));At(i,t,n),i[_t]=e,gt(i),t=i;break e;case"link":if(o=CS("link","href",r).get(t+(n.href||""))){for(s=0;s<o.length;s++)if(i=o[s],i.getAttribute("href")===(n.href==null||n.href===""?null:n.href)&&i.getAttribute("rel")===(n.rel==null?null:n.rel)&&i.getAttribute("title")===(n.title==null?null:n.title)&&i.getAttribute("crossorigin")===(n.crossOrigin==null?null:n.crossOrigin)){o.splice(s,1);break t}}i=r.createElement(t),At(i,t,n),r.head.appendChild(i);break;case"meta":if(o=CS("meta","content",r).get(t+(n.content||""))){for(s=0;s<o.length;s++)if(i=o[s],i.getAttribute("content")===(n.content==null?null:""+n.content)&&i.getAttribute("name")===(n.name==null?null:n.name)&&i.getAttribute("property")===(n.property==null?null:n.property)&&i.getAttribute("http-equiv")===(n.httpEquiv==null?null:n.httpEquiv)&&i.getAttribute("charset")===(n.charSet==null?null:n.charSet)){o.splice(s,1);break t}}i=r.createElement(t),At(i,t,n),r.head.appendChild(i);break;default:throw Error(A(468,t))}i[_t]=e,gt(i),t=i}e.stateNode=t}else pt||wv(o,e.type,e.stateNode);else e.stateNode=_S(o,n,e.memoizedProps);else r!==n?(r===null?(t=i.stateNode,t===null||xe||t.parentNode.removeChild(t)):r.count--,n===null?pt||wv(o,e.type,e.stateNode):_S(o,n,e.memoizedProps)):n===null&&e.stateNode!==null&&eg(e,e.memoizedProps,i.memoizedProps);break;case 27:Ut(t,e,n),jt(e),r&512&&(xe||i===null||kt(i,i.return)),i!==null&&r&4&&eg(e,e.memoizedProps,i.memoizedProps);break;case 5:if(o=Ti,Ti=!1,Ut(t,e,n),Ti=o,jt(e),r&512&&(xe||i===null||kt(i,i.return)),e.flags&32){t=e.stateNode;try{Ml(t,""),me=!0}catch(c){ke(e,e.return,c)}}r&4&&e.stateNode!=null&&(t=e.memoizedProps,eg(e,t,i!==null?i.memoizedProps:t)),r&1024&&(ng=!0);break;case 6:if(Ut(t,e,n),jt(e),r&4){if(e.stateNode===null)throw Error(A(162));t=e.memoizedProps,n=e.stateNode;try{n.nodeValue=t,me=!0}catch(c){ke(e,e.return,c)}}break;case 3:if(me=!1,md=null,o=ri,ri=Pu(t.containerInfo),Ut(t,e,n),ri=o,jt(e),r&4&&i!==null&&i.memoizedState.isDehydrated)try{Ul(t.containerInfo)}catch(c){ke(e,e.return,c)}ng&&(ng=!1,z_(e)),me=!1;break;case 4:r=Ti,Ti=pt,i=u1(),o=ri,ri=Pu(e.stateNode.containerInfo),Ut(t,e,n),jt(e),ri=o,me&&uu&&(Vd=!0),me=i,Ti=r;break;case 12:Ut(t,e,n),jt(e);break;case 31:Ut(t,e,n),jt(e),r&4&&(t=e.updateQueue,t!==null&&(e.updateQueue=null,Yf(e,t)));break;case 13:Ut(t,e,n),jt(e),e.child.flags&8192&&e.memoizedState!==null!==(i!==null&&i.memoizedState!==null)&&(uh=hn()),r&4&&(t=e.updateQueue,t!==null&&(e.updateQueue=null,Yf(e,t)));break;case 22:o=e.memoizedState!==null,s=i!==null&&i.memoizedState!==null;var l=pt,a=xe,u=Ti;pt=l||o,Ti=u||o,xe=a||s,Ut(t,e,n),xe=a,Ti=u,pt=l,jt(e),r&8192&&(t=e.stateNode,t._visibility=o?t._visibility&-2:t._visibility|1,!o||i===null||s||pt||xe||(t=s||xe,n=pt,i=xe,pt=o||pt,xe=t,Wr(e,2),pt=n,xe=i),!o&&Ti||tv(e,o)),r&4&&(t=e.updateQueue,t!==null&&(n=t.retryQueue,n!==null&&(t.retryQueue=null,Yf(e,n))));break;case 19:Ut(t,e,n),jt(e),r&4&&(t=e.updateQueue,t!==null&&(e.updateQueue=null,Yf(e,t)));break;case 30:r&512&&(xe||i===null||kt(i,i.return)),r=u1(),o=uu,s=(n&335544064)===n,l=e.memoizedProps,uu=s&&kr(l.default,l.update)!=="none",Ut(t,e,n),jt(e),s&&i!==null&&me&&(e.flags|=4),uu=o,me=r;break;case 21:break;case 7:r&512&&(xe||i===null||kt(i,i.return)),i&&i.stateNode!==null&&(i.stateNode._fragmentFiber=e);default:Ut(t,e,n),jt(e)}}function jt(e){var t=e.flags;if(t&2){try{for(var n,i=e.return;i!==null;){if(S_(i)){n=i;break}i=i.return}i=null;for(var r=e.return;r!==null;){if(sb(r)){var o=r.stateNode;i===null?i=[o]:i.push(o)}if(ob(r))break;r=r.return}var s=i;if(n==null)throw Error(A(160));switch(n.tag){case 27:var l=n.stateNode,a=tg(e);Pd(e,a,l,s);break;case 5:var u=n.stateNode;n.flags&32&&(Ml(u,""),n.flags&=-33);var c=tg(e);Pd(e,c,u,s);break;case 3:case 4:var f=n.stateNode.containerInfo,d=tg(e);Yg(e,d,f,s);break;default:throw Error(A(161))}}catch(h){ke(e,e.return,h)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function z_(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;z_(t),t.tag===5&&t.flags&1024&&(t=t.stateNode,Hl=!0,t.reset(),Hl=!1),e=e.sibling}}function nl(e,t){if(t.subtreeFlags&9270)for(t=t.child;t!==null;)B_(t,e),t=t.sibling;else O_(t,!1)}function B_(e,t){var n=e.alternate;if(n===null)Wg(e,!1);else switch(e.tag){case 3:if(ev=Mi=!1,nS(),nl(t,e),!Mi&&!Vd){if(e=Li,e!==null)for(var i=0;i<e.length;i+=3){n=e[i];var r=e[i+1];cC(n,e[i+2]),n=n.ownerDocument.documentElement,n!==null&&n.animate({opacity:[0,0],pointerEvents:["none","none"]},{duration:0,fill:"forwards",pseudoElement:"::view-transition-group("+r+")"})}e=t.containerInfo,e=e.nodeType===9?e.documentElement:e.ownerDocument.documentElement,e!==null&&e.style.viewTransitionName===""&&(e.style.viewTransitionName="none",e.animate({opacity:[0,0],pointerEvents:["none","none"]},{duration:0,fill:"forwards",pseudoElement:"::view-transition-group(root)"}),e.animate({width:[0,0],height:[0,0]},{duration:0,fill:"forwards",pseudoElement:"::view-transition"})),ev=!0}Li=null;break;case 5:nl(t,e);break;case 4:i=Mi,Mi=!1,nl(t,e),Mi&&(Vd=!0),Mi=i;break;case 22:e.memoizedState===null&&(n.memoizedState!==null?Wg(e,!1):nl(t,e));break;case 30:i=Mi,r=nS(),Mi=!1,nl(t,e),Mi&&(e.flags|=4);var o=e.memoizedProps,s=e.stateNode;t=vr(o,s),s=vr(n.memoizedProps,s);var l=kr(o.default,o.update);l==="none"?t=!1:(o=n.memoizedState,n.memoizedState=null,n=e.child,Jt=0,t=lb(e,n,t,s,l,o,!0),Jt!==(o===null?0:o.length)&&(e.flags|=32)),(e.flags&4)!==0&&t?(Ll(e,e.memoizedProps.onUpdate),Li=r):r!==null&&(r.push.apply(r,Li),Li=r),Mi=(e.flags&32)!==0?!0:i;break;default:nl(t,e)}}function Ni(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)A_(e,t.alternate,t),t=t.sibling}function Wr(e,t){for(e=e.child;e!==null;){var n=e,i=t;switch(n.tag){case 0:case 11:case 14:case 15:bo(4,n,n.return),Wr(n,i);break;case 1:kt(n,n.return);var r=n.stateNode;typeof r.componentWillUnmount==="function"&&w_(n,n.return,r),Wr(n,i);break;case 27:(i&2)!==0&&yC(n.stateNode,n.type,n.memoizedProps);case 5:kt(n,n.return),n.tag!==5&&n.tag!==27||wu(n),Wr(n,i);break;case 6:wu(n);break;case 26:kt(n,n.return),r=n.stateNode,n.memoizedState!==null||r===null||xe||r.parentNode.removeChild(r),Wr(n,i);break;case 22:n.memoizedState===null&&Wr(n,i);break;case 30:kt(n,n.return),Wr(n,i);break;case 7:kt(n,n.return);default:Wr(n,i)}e=e.sibling}}function ii(e,t,n){n=(t.subtreeFlags&8772)!==0?n:n&-2;for(t=t.child;t!==null;){var i=t.alternate,r=e,o=t,s=o.flags,l=(n&1)!==0;switch(o.tag){case 0:case 11:case 15:ii(r,o,n),Yu(4,o);break;case 1:if(ii(r,o,n),i=o,r=i.stateNode,typeof r.componentDidMount==="function")try{r.componentDidMount()}catch(c){ke(i,i.return,c)}if(i=o,r=i.updateQueue,r!==null){var a=i.stateNode;try{var u=r.shared.hiddenCallbacks;if(u!==null)for(r.shared.hiddenCallbacks=null,r=0;r<u.length;r++)Nk(u[r],a)}catch(c){ke(i,i.return,c)}}l&&s&64&&x_(o),Di(o,o.return);break;case 27:(n&2)!==0&&k_(o);case 5:o.tag!==5&&o.tag!==27||eS(o),ii(r,o,n),l&&i===null&&s&4&&Gg(o),Di(o,o.return);break;case 6:eS(o);break;case 26:a=o.stateNode,o.memoizedState!==null||a===null||pt||wv(Pu(a.ownerDocument),o.type,a),ii(r,o,n),l&&i===null&&s&4&&Gg(o),Di(o,o.return);break;case 12:ii(r,o,n);break;case 31:ii(r,o,n),l&&s&4&&N_(r,o);break;case 13:ii(r,o,n),l&&s&4&&D_(r,o);break;case 22:o.memoizedState===null&&ii(r,o,n),Di(o,o.return);break;case 30:ii(r,o,n),Di(o,o.return);break;case 7:Di(o,o.return);default:ii(r,o,n)}t=t.sibling}}function ab(e,t){var n=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),e=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(e=t.memoizedState.cachePool.pool),e!==n&&(e!=null&&e.refCount++,n!=null&&Xu(n))}function ub(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&Xu(e))}function Tn(e,t,n,i){var r=(n&335544064)===n;if(t.subtreeFlags&(r?10262:10256))for(t=t.child;t!==null;)P_(e,t,n,i),t=t.sibling;else r&&E_(t)}function P_(e,t,n,i){var r=(n&335544064)===n;r&&t.alternate===null&&t.return!==null&&t.return.alternate!==null&&fd(t);var o=t.flags;switch(t.tag){case 0:case 11:case 15:Tn(e,t,n,i),o&2048&&Yu(9,t);break;case 1:Tn(e,t,n,i);break;case 3:Tn(e,t,n,i),r&&ev&&(e=e.containerInfo,e=e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,e.style.viewTransitionName==="root"&&(e.style.viewTransitionName=""),e=e.ownerDocument.documentElement,e!==null&&e.style.viewTransitionName==="none"&&(e.style.viewTransitionName="")),o&2048&&(o=null,t.alternate!==null&&(o=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==o&&(t.refCount++,o!=null&&Xu(o)));break;case 12:if(o&2048){Tn(e,t,n,i),o=t.stateNode;try{var s=t.memoizedProps,l=s.id,a=s.onPostCommit;typeof a==="function"&&a(l,t.alternate===null?"mount":"update",o.passiveEffectDuration,-0)}catch(u){ke(t,t.return,u)}}else Tn(e,t,n,i);break;case 31:Tn(e,t,n,i);break;case 13:Tn(e,t,n,i);break;case 23:break;case 22:s=t.stateNode,l=t.alternate,t.memoizedState!==null?(r&&l!==null&&l.memoizedState===null&&fd(l),s._visibility&2?Tn(e,t,n,i):Su(e,t)):(r&&l!==null&&l.memoizedState!==null&&fd(t),s._visibility&2?Tn(e,t,n,i):(s._visibility|=2,rl(e,t,n,i,(t.subtreeFlags&10256)!==0||!1))),o&2048&&ab(l,t);break;case 24:Tn(e,t,n,i),o&2048&&ub(t.alternate,t);break;case 30:r&&(o=t.alternate,o!==null&&(Ui(o.child,!0),Ui(t.child,!0))),Tn(e,t,n,i);break;default:Tn(e,t,n,i)}}function rl(e,t,n,i,r){r=r&&((t.subtreeFlags&10256)!==0||!1);for(t=t.child;t!==null;){var o=e,s=t,l=n,a=i,u=s.flags;switch(s.tag){case 0:case 11:case 15:rl(o,s,l,a,r),Yu(8,s);break;case 23:break;case 22:var c=s.stateNode;s.memoizedState!==null?c._visibility&2?rl(o,s,l,a,r):Su(o,s):(c._visibility|=2,rl(o,s,l,a,r)),r&&u&2048&&ab(s.alternate,s);break;case 24:rl(o,s,l,a,r),r&&u&2048&&ub(s.alternate,s);break;default:rl(o,s,l,a,r)}t=t.sibling}}function Su(e,t){if(t.subtreeFlags&10256)for(t=t.child;t!==null;){var n=e,i=t,r=i.flags;switch(i.tag){case 22:Su(n,i),r&2048&&ab(i.alternate,i);break;case 24:Su(n,i),r&2048&&ub(i.alternate,i);break;default:Su(n,i)}t=t.sibling}}var es=8192;function Wo(e,t,n){if(e.subtreeFlags&es)for(e=e.child;e!==null;)I_(e,t,n),e=e.sibling}function I_(e,t,n){switch(e.tag){case 26:Wo(e,t,n),e.flags&es&&(e.memoizedState!==null?N4(n,ri,e.memoizedState,e.memoizedProps):(e=e.stateNode,(t&335544128)===t&&OS(n,e)));break;case 5:Wo(e,t,n),e.flags&es&&(e=e.stateNode,(t&335544128)===t&&OS(n,e));break;case 3:case 4:var i=ri;ri=Pu(e.stateNode.containerInfo),Wo(e,t,n),ri=i;break;case 22:e.memoizedState===null&&(i=e.alternate,i!==null&&i.memoizedState!==null?(i=es,es=16777216,Wo(e,t,n),es=i):Wo(e,t,n));break;case 30:if((e.flags&es)!==0&&(i=e.memoizedProps.name,i!=null&&i!=="auto")){var r=e.stateNode;r.paired=null,fn===null&&(fn=new Map),fn.set(i,r)}Wo(e,t,n);break;default:Wo(e,t,n)}}function V_(e){var t=e.alternate;if(t!==null&&(e=t.child,e!==null)){t.child=null;do t=e.sibling,e.sibling=null,e=t;while(e!==null)}}function tu(e){var t=e.deletions;if((e.flags&16)!==0){if(t!==null)for(var n=0;n<t.length;n++){var i=t[n];mt=i,U_(i,e)}V_(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)H_(e),e=e.sibling}function H_(e){switch(e.tag){case 0:case 11:case 15:tu(e),e.flags&2048&&bo(9,e,e.return);break;case 3:tu(e);break;case 12:tu(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,dd(e)):tu(e);break;default:tu(e)}}function dd(e){var t=e.deletions;if((e.flags&16)!==0){if(t!==null)for(var n=0;n<t.length;n++){var i=t[n];mt=i,U_(i,e)}V_(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:bo(8,t,t.return),dd(t);break;case 22:n=t.stateNode,n._visibility&2&&(n._visibility&=-3,dd(t));break;default:dd(t)}e=e.sibling}}function U_(e,t){for(;mt!==null;){var n=mt;switch(n.tag){case 0:case 11:case 15:bo(8,n,t);break;case 23:case 22:if(n.memoizedState!==null&&n.memoizedState.cachePool!==null){var i=n.memoizedState.cachePool.pool;i!=null&&i.refCount++}break;case 24:Xu(n.memoizedState.cache)}if(i=n.child,i!==null)i.return=n,mt=i;else e:for(n=e;mt!==null;){i=mt;var r=i.sibling,o=i.return;if(T_(i),i===n){mt=null;break e}if(r!==null){r.return=o,mt=r;break e}mt=o}}}var RB={getCacheForType:function(e){var t=Ct(at),n=t.data.get(e);return n===void 0&&(n=e(),t.data.set(e,n)),n},cacheSignal:function(){return Ct(at).controller.signal}},TB=typeof WeakMap==="function"?WeakMap:Map,ve=0,Re=null,ue=null,fe=0,we=0,an=null,io=!1,ql=!1,cb=!1,wr=0,Qe=0,yo=0,us=0,Hd=0,dn=0,Dl=0,ku=null,Qt=null,iv=!1,uh=0,j_=0,Ud=1/0,jd=null,co=null,Xe=0,si=null,vs=null,Hi=0,rv=0,ov=null,K_=null,El=null,Ol=null,Al=null,_u=0,hd=null;function Pn(){return(ve&2)!==0&&fe!==0?fe&-fe:ne.T!==null?db():WS()}function F_(){if(dn===0)if((fe&536870912)===0||le){var e=If;If<<=1,(If&3932160)===0&&(If=262144),dn=e}else dn=536870912;return e=Rt.current,e!==null&&(e.flags|=32),dn}function Ll(e,t){if(t!=null){var n=e.stateNode,i=n.ref;i===null&&(i=n.ref=dC(vr(e.memoizedProps,n))),Ol===null&&(Ol=[]),Ol.push(t.bind(null,i))}}function en(e,t,n){if(e===Re&&(we===2||we===9)||e.cancelPendingCommit!==null)zl(e,0),ro(e,fe,dn,!1);if(Yd(e,n),(ve&2)===0||e!==Re)e===Re&&((ve&2)===0&&(us|=n),Qe===4&&ro(e,fe,dn,!1)),_r(e)}function q_(e,t,n){if((ve&6)!==0)throw Error(A(327));var i=!n&&(t&127)===0&&(t&e.expiredLanes)===0||Ku(e,t),r=i?DB(e,t):ig(e,t,!0),o=i;do{if(r===0){ql&&!i&&ro(e,t,0,!1);break}else{if(n=e.current.alternate,o&&!MB(n)){r=ig(e,t,!1),o=!1;continue}if(r===2){if(o=t,e.errorRecoveryDisabledLanes&o)var s=0;else s=e.pendingLanes&-536870913,s=s!==0?s:s&536870912?536870912:0;if(s!==0){t=s;e:{var l=e;r=ku;var a=l.current.memoizedState.isDehydrated;if(a&&(zl(l,s).flags|=256),s=ig(l,s,!1),s!==2&&s!==6){if(cb&&!a){l.errorRecoveryDisabledLanes|=o,us|=o,r=4;break e}o=Qt,Qt=r,o!==null&&(Qt===null?Qt=o:Qt.push.apply(Qt,o))}r=s}if(o=!1,r!==2)continue}}if(r===1){zl(e,0),ro(e,t,0,!0);break}e:{switch(i=e,o=r,o){case 0:case 1:throw Error(A(345));case 4:if((t&4194048)!==t&&(t&62914560)!==t)break;case 6:ro(i,t,dn,!io);break e;case 2:Qt=null;break;case 3:case 5:break;default:throw Error(A(329))}if((t&62914560)===t&&(r=uh+300-hn(),10<r)){if(ro(i,t,dn,!io),Gd(i,0,!0)!==0)break e;Hi=t,i.timeoutHandle=hb(rS.bind(null,i,n,Qt,jd,iv,t,dn,us,Dl,io,o,"Throttled",-0,0),r);break e}rS(i,n,Qt,jd,iv,t,dn,us,Dl,io,o,null,-0,0)}}break}while(1);_r(e)}function rS(e,t,n,i,r,o,s,l,a,u,c,f,d,h){e.timeoutHandle=-1;var m=t.subtreeFlags,b=(o&335544064)===o;if(f=null,b||m&8192||(m&16785408)===16785408){if(f={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Bi},fn=null,I_(t,o,f),b&&(m=f,b=e.containerInfo,b=(b.nodeType===9?b:b.ownerDocument).__reactViewTransition,b!=null&&(m.count++,m.waitingForViewTransition=!0,m=Iu.bind(m),b.finished.then(m,m))),m=(o&62914560)===o?uh-hn():(o&4194048)===o?j_-hn():0,m=D4(f,m),m!==null){Hi=o,e.cancelPendingCommit=m(sS.bind(null,e,t,o,n,i,r,s,l,a,u,c,f,null,d,h)),ro(e,o,s,!u);return}}sS(e,t,o,n,i,r,s,l,a,u,c,f)}function MB(e){for(var t=e;;){var n=t.tag;if((n===0||n===11||n===15)&&t.flags&16384&&(n=t.updateQueue,n!==null&&(n=n.stores,n!==null)))for(var i=0;i<n.length;i++){var r=n[i],o=r.getSnapshot;r=r.value;try{if(!gn(o(),r))return!1}catch(s){return!1}}if(n=t.child,t.subtreeFlags&16384&&n!==null)n.return=t,t=n;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function ro(e,t,n,i){t=FS(e,t),t&=~Hd,t&=~us,e.suspendedLanes|=t,e.pingedLanes&=~t,i&&(e.warmLanes|=t),i=e.expirationTimes;for(var r=t;0<r;){var o=31-mn(r),s=1<<o;i[o]=-1,r&=~s}n!==0&&$S(e,n,t)}function ch(){return(ve&6)===0?(Wu(0,!1),!1):!0}function fb(){if(ue!==null){if(we===0)var e=ue.return;else e=ue,hr=Ss=null,Gv(e),kl=null,Mu=0,e=ue;for(;e!==null;)y_(e.alternate,e),e=e.return;ue=null}}function zl(e,t){var n=e.timeoutHandle;return n!==-1&&(e.timeoutHandle=-1,ZB(n)),n=e.cancelPendingCommit,n!==null&&(e.cancelPendingCommit=null,n()),Hi=0,fb(),Re=e,ue=n=pr(e.current,null),fe=t,we=0,an=null,io=!1,ql=Ku(e,t),cb=!1,Dl=dn=Hd=us=yo=Qe=0,Qt=ku=null,iv=!1,wr=FS(e,t),eh(),n}function $_(e,t){re=null,ne.H=Ld,t===Kl||t===ih?(t=M1(),we=3):t===Hv?(t=M1(),we=4):we=t===nb?8:t!==null&&typeof t==="object"&&typeof t.then==="function"?6:1,an=t,ue===null&&(Qe=1,zd(e,zn(t,e.current)))}function X_(){var e=Rt.current;return e===null?!0:(fe&4194048)===fe?Lt===null?!0:!1:(fe&62914560)===fe||(fe&536870912)!==0?e===Lt:!1}function G_(){var e=ne.H;return ne.H=Ld,e===null?Ld:e}function Y_(){var e=ne.A;return ne.A=RB,e}function Kd(){Qe=4,io||(fe&4194048)!==fe&&Rt.current!==null||(ql=!0),(yo&134217727)===0&&(us&134217727)===0||Re===null||ro(Re,fe,dn,!1)}function ig(e,t,n){var i=ve;ve|=2;var r=G_(),o=Y_();if(Re!==e||fe!==t)jd=null,zl(e,t);t=!1;var s=Qe;e:do try{if(we!==0&&ue!==null){var l=ue,a=an;switch(we){case 8:fb(),s=6;break e;case 3:case 2:case 9:case 6:Rt.current===null&&(t=!0);var u=we;if(we=0,an=null,bl(e,l,a,u),n&&ql){s=0;break e}break;default:u=we,we=0,an=null,bl(e,l,a,u)}}NB(),s=Qe;break}catch(c){$_(e,c)}while(1);return t&&e.shellSuspendCounter++,hr=Ss=null,ve=i,ne.H=r,ne.A=o,ue===null&&(Re=null,fe=0,eh()),s}function NB(){for(;ue!==null;)W_(ue)}function DB(e,t){var n=ve;ve|=2;var i=G_(),r=Y_();Re!==e||fe!==t?(jd=null,Ud=hn()+500,zl(e,t)):ql=Ku(e,t);e:do try{if(we!==0&&ue!==null){t=ue;var o=an;t:switch(we){case 1:we=0,an=null,bl(e,t,o,1);break;case 2:case 9:if(T1(o)){we=0,an=null,oS(t);break}t=function(){we!==2&&we!==9||Re!==e||(we=7),_r(e)},o.then(t,t);break e;case 3:we=7;break e;case 4:we=5;break e;case 7:T1(o)?(we=0,an=null,oS(t)):(we=0,an=null,bl(e,t,o,7));break;case 5:var s=null;switch(ue.tag){case 26:s=ue.memoizedState;case 5:case 27:var l=ue;if(s?SC(s):l.stateNode.complete){we=0,an=null;var a=l.sibling;if(a!==null)ue=a;else{var u=l.return;u!==null?(ue=u,fh(u)):ue=null}break t}}we=0,an=null,bl(e,t,o,5);break;case 6:we=0,an=null,bl(e,t,o,6);break;case 8:fb(),Qe=6;break e;default:throw Error(A(462))}}LB();break}catch(c){$_(e,c)}while(1);if(hr=Ss=null,ne.H=i,ne.A=r,ve=n,ue!==null)return 0;return Re=null,fe=0,eh(),Qe}function LB(){for(;ue!==null&&!GL();)W_(ue)}function W_(e){var t=b_(e.alternate,e,wr);e.memoizedProps=e.pendingProps,t===null?fh(e):ue=t}function oS(e){var t=e,n=t.alternate;switch(t.tag){case 15:case 0:t=X1(n,t,t.pendingProps,t.type,void 0,fe);break;case 11:t=X1(n,t,t.pendingProps,t.type.render,t.ref,fe);break;case 5:Gv(t);var i=t;i===vt&&(le?(Od(i),i.tag===5&&i.stateNode!=null&&(ze=i.stateNode)):(Od(i),le=!0));default:y_(n,t),t=ue=kk(t,wr),t=b_(n,t,wr)}e.memoizedProps=e.pendingProps,t===null?fh(e):ue=t}function bl(e,t,n,i){hr=Ss=null,Gv(t),kl=null,Mu=0;var r=t.return;try{if(wB(e,r,t,n,fe)){Qe=1,zd(e,zn(n,e.current)),ue=null;return}}catch(o){if(r!==null)throw ue=r,o;Qe=1,zd(e,zn(n,e.current)),ue=null;return}if(t.flags&32768){if(le||i===1)e=!0;else if(ql||(fe&536870912)!==0)e=!1;else if(io=e=!0,i===2||i===9||i===3||i===6)i=Rt.current,i!==null&&i.tag===13&&(i.flags|=16384);Q_(t,e)}else fh(t)}function fh(e){var t=e;do{if((t.flags&32768)!==0){Q_(t,io);return}e=t.return;var n=CB(t.alternate,t,wr);if(n!==null){ue=n;return}if(t=t.sibling,t!==null){ue=t;return}ue=t=e}while(t!==null);Qe===0&&(Qe=5)}function Q_(e,t){do{var n=EB(e.alternate,e);if(n!==null){n.flags&=32767,ue=n;return}if(n=e.return,n!==null&&(n.flags|=32768,n.subtreeFlags=0,n.deletions=null),!t&&(e=e.sibling,e!==null)){ue=e;return}ue=e=n}while(e!==null);Qe=6,ue=null}function sS(e,t,n,i,r,o,s,l,a,u,c,f){e.cancelPendingCommit=null;do dh();while(Xe!==0);if((ve&6)!==0)throw Error(A(327));if(t!==null){if(t===e.current)throw Error(A(177));e===Re&&(ue=Re=null,fe=0),vs=t,si=e,Hi=n,ov=r,K_=i,zB(e,t,n,s,l,a,f)}}function zB(e,t,n,i,r,o,s){var l=t.lanes|t.childLanes;if(rv=l,l|=Lv,rz(e,n,l,i,r,o),Ol=null,(n&335544064)===n?(Al=sB(e),i=10262):(Al=null,i=10256),(t.subtreeFlags&i)!==0||(t.flags&i)!==0?(e.callbackNode=null,e.callbackPriority=0,UB(Sd,function(){return uv(),null})):(e.callbackNode=null,e.callbackPriority=0),Id=!1,i=(t.flags&13878)!==0,(t.subtreeFlags&13878)!==0||i){i=ne.T,ne.T=null,r=be.p,be.p=2,o=ve,ve|=4;try{OB(e,t,n)}finally{ve=o,be.p=r,ne.T=i}}Xe=1,Id?El=o4(s,e.containerInfo,Al,sv,lv,PB,av,uv,BB,null,null):(sv(),lv(),av())}function BB(e){if(Xe!==0){var t=si.onRecoverableError;t(e,{componentStack:null})}}function PB(){Xe===3&&(Xe=0,B_(vs,si),Xe=4)}function sv(){if(Xe===1){Xe=0;var e=si,t=vs,n=Hi,i=(t.flags&13878)!==0;if((t.subtreeFlags&13878)!==0||i){i=ne.T,ne.T=null;var r=be.p;be.p=2;var o=ve;ve|=4;try{uu=Vd=!1,L_(t,e,n),n=mv;var s=mk(e.containerInfo),l=n.focusedElem,a=n.selectionRange;if(s!==l&&l&&l.ownerDocument&&pk(l.ownerDocument.documentElement,l)){if(a!==null&&Dv(l)){var{start:u,end:c}=a;if(c===void 0&&(c=u),"selectionStart"in l)l.selectionStart=u,l.selectionEnd=Math.min(c,l.value.length);else{var f=l.ownerDocument||document,d=f&&f.defaultView||window;if(d.getSelection){var h=d.getSelection(),m=l.textContent.length,b=Math.min(a.start,m),x=a.end===void 0?b:Math.min(a.end,m);!h.extend&&b>x&&(s=x,x=b,b=s);var g=S1(l,b),v=S1(l,x);if(g&&v&&(h.rangeCount!==1||h.anchorNode!==g.node||h.anchorOffset!==g.offset||h.focusNode!==v.node||h.focusOffset!==v.offset)){var w=f.createRange();w.setStart(g.node,g.offset),h.removeAllRanges(),b>x?(h.addRange(w),h.extend(v.node,v.offset)):(w.setEnd(v.node,v.offset),h.addRange(w))}}}}f=[];for(h=l;h=h.parentNode;)h.nodeType===1&&f.push({element:h,left:h.scrollLeft,top:h.scrollTop});typeof l.focus==="function"&&l.focus();for(l=0;l<f.length;l++){var S=f[l];S.element.scrollLeft=S.left,S.element.scrollTop=S.top}}Hl=!!pv,mv=pv=null}finally{ve=o,be.p=r,ne.T=i}}e.current=t,Xe=2}}function lv(){if(Xe===2){Xe=0;var e=si,t=vs,n=(t.flags&8772)!==0;if((t.subtreeFlags&8772)!==0||n){n=ne.T,ne.T=null;var i=be.p;be.p=2;var r=ve;ve|=4;try{A_(e,t.alternate,t)}finally{ve=r,be.p=i,ne.T=n}}Xe=3}}function av(){if(Xe===4||Xe===3){Xe=0;var e=El;El=null,YL();var t=si,n=vs,i=Hi,r=K_,o=(i&335544064)===i?10262:10256;if((n.subtreeFlags&o)!==0||(n.flags&o)!==0?Xe=5:(Xe=0,vs=si=null,J_(t,t.pendingLanes)),o=t.pendingLanes,o===0&&(co=null),Ov(i),n=n.stateNode,pn&&typeof pn.onCommitFiberRoot==="function")try{pn.onCommitFiberRoot(ju,n,void 0,(n.current.flags&128)===128)}catch(u){}if(r!==null){n=ne.T,o=be.p,be.p=2,ne.T=null;try{for(var s=t.onRecoverableError,l=0;l<r.length;l++){var a=r[l];s(a.value,{componentStack:a.stack})}}finally{ne.T=n,be.p=o}}if(r=Ol,s=Al,Al=null,r!==null&&(Ol=null,s===null&&(s=[]),e!==null))for(a=0;a<r.length;a++)n=(0,r[a])(s),n!==void 0&&e.finished.finally(n);(Hi&3)!==0&&dh(),_r(t),o=t.pendingLanes,(i&261930)!==0&&(o&42)!==0?t===hd?_u++:(_u=0,hd=t):(_u=0,hd=null),Wu(0,!1)}}function J_(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,Xu(t)))}function dh(){return El!==null&&(El.skipTransition(),El=null),sv(),lv(),av(),uv()}function uv(){if(Xe!==5)return!1;var e=si,t=rv;rv=0;var n=Ov(Hi),i=ne.T,r=be.p;try{be.p=32>n?32:n,ne.T=null,n=ov,ov=null;var o=si,s=Hi;if(Xe=0,vs=si=null,Hi=0,(ve&6)!==0)throw Error(A(331));var l=ve;if(ve|=4,H_(o.current),P_(o,o.current,s,n),ve=l,Wu(0,!1),pn&&typeof pn.onPostCommitFiberRoot==="function")try{pn.onPostCommitFiberRoot(ju,o)}catch(a){}return!0}finally{be.p=r,ne.T=i,J_(e,t)}}function lS(e,t,n){t=zn(n,t),t=jg(e.stateNode,t,2),e=as(e,t,2),e!==null&&(Yd(e,2),_r(e))}function ke(e,t,n){if(e.tag===3)lS(e,e,n);else for(;t!==null;){if(t.tag===3){lS(t,e,n);break}else if(t.tag===1){var i=t.stateNode;if(typeof t.type.getDerivedStateFromError==="function"||typeof i.componentDidCatch==="function"&&(co===null||!co.has(i))){e=zn(n,e),n=h_(2),i=as(t,n,2),i!==null&&(p_(n,i,t,e),Yd(i,2),_r(i));break}}t=t.return}}function rg(e,t,n){var i=e.pingCache;if(i===null){i=e.pingCache=new TB;var r=new Set;i.set(t,r)}else r=i.get(t),r===void 0&&(r=new Set,i.set(t,r));r.has(n)||(cb=!0,r.add(n),e=IB.bind(null,e,t,n),t.then(e,e))}function IB(e,t,n){var i=e.pingCache;i!==null&&i.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,Re===e&&(fe&n)===n&&(Qe===4||Qe===3&&(fe&62914560)===fe&&300>hn()-uh?(ve&2)===0?zl(e,0):Hd|=n:Hd|=n,Dl===fe&&(Dl=0)),_r(e)}function Z_(e,t){t===0&&(t=qS()),e=ws(e,t),e!==null&&(Yd(e,t),_r(e))}function VB(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),Z_(e,n)}function HB(e,t){var n=0;switch(e.tag){case 31:case 13:var{stateNode:i,memoizedState:r}=e;r!==null&&(n=r.retryLane);break;case 19:i=e.stateNode;break;case 22:i=e.stateNode._retryCache;break;default:throw Error(A(314))}i!==null&&i.delete(t),Z_(e,n)}function UB(e,t){return Ev(e,t)}var Bl=null,ol=null,cv=!1,Fd=!1,og=!1,oo=0;function _r(e){e!==ol&&e.next===null&&(ol===null?Bl=ol=e:ol=ol.next=e),Fd=!0,cv||(cv=!0,KB())}function Wu(e,t){if(!og&&Fd){og=!0;do{var n=!1;for(var i=Bl;i!==null;){if(!t)if(e!==0){var r=i.pendingLanes;if(r===0)var o=0;else{var s=i.suspendedLanes,l=i.pingedLanes;o=(1<<31-mn(42|e)+1)-1,o&=r&~(s&~l),o=o&201326741?o&201326741|1:o?o|2:0}o!==0&&(n=!0,aS(i,o))}else o=fe,o=Gd(i,i===Re?o:0,i.cancelPendingCommit!==null||i.timeoutHandle!==-1),(o&3)===0||Ku(i,o)||(n=!0,aS(i,o));i=i.next}}while(n);og=!1}}function jB(){eC()}function eC(){Fd=cv=!1;var e=0;oo!==0&&JB()&&(e=oo);for(var t=hn(),n=null,i=Bl;i!==null;){var r=i.next,o=tC(i,t);if(o===0)i.next=null,n===null?Bl=r:n.next=r,r===null&&(ol=n);else if(n=i,e!==0||(o&3)!==0)Fd=!0;i=r}Xe!==0&&Xe!==5||Wu(e,!1),oo!==0&&(oo=0)}function tC(e,t){for(var{suspendedLanes:n,pingedLanes:i,expirationTimes:r}=e,o=e.pendingLanes&-62914561;0<o;){var s=31-mn(o),l=1<<s,a=r[s];if(a===-1){if((l&n)===0||(l&i)!==0)r[s]=iz(l,t)}else a<=t&&(e.expiredLanes|=l);o&=~l}if(t=Re,n=fe,n=Gd(e,e===t?n:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),i=e.callbackNode,n===0||e===t&&(we===2||we===9)||e.cancelPendingCommit!==null)return i!==null&&i!==null&&Im(i),e.callbackNode=null,e.callbackPriority=0;if((n&3)===0||Ku(e,n)){if(t=n&-n,t===e.callbackPriority)return t;switch(i!==null&&Im(i),Ov(n)){case 2:case 8:n=jS;break;case 32:n=Sd;break;case 268435456:n=KS;break;default:n=Sd}return i=nC.bind(null,e),n=Ev(n,i),e.callbackPriority=t,e.callbackNode=n,t}return i!==null&&i!==null&&Im(i),e.callbackPriority=2,e.callbackNode=null,2}function nC(e,t){if(Xe!==0&&Xe!==5)return e.callbackNode=null,e.callbackPriority=0,null;var n=e.callbackNode;if(dh()&&e.callbackNode!==n)return null;var i=fe;if(i=Gd(e,e===Re?i:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),i===0)return null;return q_(e,i,t),tC(e,hn()),e.callbackNode!=null&&e.callbackNode===n?nC.bind(null,e):null}function aS(e,t){if(dh())return null;q_(e,t,!0)}function KB(){e4(function(){(ve&6)!==0?Ev(US,jB):eC()})}function db(){if(oo===0){var e=hs;e===0&&(e=Pf,Pf<<=1,(Pf&261888)===0&&(Pf=256)),oo=e}return oo}function uS(e){return e==null||typeof e==="symbol"||typeof e==="boolean"?null:typeof e==="function"?e:ed(e)}function FB(e,t,n,i,r){if(t==="submit"&&n&&n.stateNode===r){var o=uS((r[nn]||null).action),s=i.submitter;s&&(t=(t=s[nn]||null)?uS(t.formAction):s.getAttribute("formAction"),t!==null&&(o=t,s=null));var l=new Qd("action","action",null,i,r);e.push({event:l,listeners:[{instance:null,listener:function(){if(i.defaultPrevented){if(oo!==0){var a=new FormData(r,s);Hg(n,{pending:!0,data:a,method:r.method,action:o},null,a)}}else typeof o==="function"&&(l.preventDefault(),a=new FormData(r,s),Hg(n,{pending:!0,data:a,method:r.method,action:o},o,a))},currentTarget:r}]})}}for(cu=0;cu<Rg.length;cu++)fu=Rg[cu],fv=fu.toLowerCase(),dv=fu[0].toUpperCase()+fu.slice(1),li(fv,"on"+dv);var fu,fv,dv,cu;li(vk,"onAnimationEnd");li(bk,"onAnimationIteration");li(yk,"onAnimationStart");li("dblclick","onDoubleClick");li("focusin","onFocus");li("focusout","onBlur");li(Jz,"onTransitionRun");li(Zz,"onTransitionStart");li(eB,"onTransitionCancel");li(xk,"onTransitionEnd");Tl("onMouseEnter",["mouseout","mouseover"]);Tl("onMouseLeave",["mouseout","mouseover"]);Tl("onPointerEnter",["pointerout","pointerover"]);Tl("onPointerLeave",["pointerout","pointerover"]);ys("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));ys("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));ys("onBeforeInput",["compositionend","keypress","textInput","paste"]);ys("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));ys("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));ys("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Lu="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),qB=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Lu));function iC(e,t){t=(t&4)!==0;for(var n=0;n<e.length;n++){var i=e[n],r=i.event;i=i.listeners;e:{var o=void 0;if(t)for(var s=i.length-1;0<=s;s--){var l=i[s],a=l.instance,u=l.currentTarget;if(l=l.listener,a!==o&&r.isPropagationStopped())break e;o=l,r.currentTarget=u;try{o(r)}catch(c){_d(c)}r.currentTarget=null,o=a}else for(s=0;s<i.length;s++){if(l=i[s],a=l.instance,u=l.currentTarget,l=l.listener,a!==o&&r.isPropagationStopped())break e;o=l,r.currentTarget=u;try{o(r)}catch(c){_d(c)}r.currentTarget=null,o=a}}}}function ae(e,t){var n=t[o1];n===void 0&&(n=t[o1]=new Set);var i=e+"__bubble";n.has(i)||(oC(t,e,2,!1),n.add(i))}function sg(e,t,n){var i=0;t&&(i|=4),oC(n,e,i,t)}var Wf="_reactListening"+Math.random().toString(36).slice(2);function rC(e){if(!e[Wf]){e[Wf]=!0,JS.forEach(function(n){n!=="selectionchange"&&(qB.has(n)||sg(n,!1,e),sg(n,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[Wf]||(t[Wf]=!0,sg("selectionchange",!1,t))}}function oC(e,t,n,i){switch(OC(t)){case 2:var r=V4;break;case 8:r=H4;break;default:r=yb}n=r.bind(null,t,n,e),r=void 0,!Cg||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(r=!0),i?r!==void 0?e.addEventListener(t,n,{capture:!0,passive:r}):e.addEventListener(t,n,!0):r!==void 0?e.addEventListener(t,n,{passive:r}):e.addEventListener(t,n,!1)}function lg(e,t,n,i,r){var o=i;if((t&1)===0&&(t&2)===0&&i!==null)e:for(;;){if(i===null)return;var s=i.tag;if(s===3||s===4){var l=i.stateNode.containerInfo;if(l===r)break;if(s===4)for(s=i.return;s!==null;){var a=s.tag;if((a===3||a===4)&&s.stateNode.containerInfo===r)return;s=s.return}for(;l!==null;){if(s=ts(l),s===null)return;if(a=s.tag,a===5||a===6||a===26||a===27){i=o=s;continue e}l=l.parentNode}}i=i.return}sk(function(){var u=o,c=Rv(n),f=[];e:{var d=wk.get(e);if(d!==void 0){var h=Qd,m=e;switch(e){case"keypress":if(nd(n)===0)break e;case"keydown":case"keyup":h=Az;break;case"focusin":m="focus",h=Fm;break;case"focusout":m="blur",h=Fm;break;case"beforeblur":case"afterblur":h=Fm;break;case"click":if(n.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":h=h1;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":h=gz;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":h=Dz;break;case vk:case bk:case yk:h=yz;break;case xk:h=zz;break;case"scroll":case"scrollend":h=pz;break;case"wheel":h=Pz;break;case"copy":case"cut":case"paste":h=wz;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":h=m1;break;case"submit":h=Mz;break;case"toggle":case"beforetoggle":h=Vz}var b=(t&4)!==0,x=!b&&(e==="scroll"||e==="scrollend"),g=b?d!==null?d+"Capture":null:d;b=[];for(var v=u,w;v!==null;){var S=v;if(w=S.stateNode,S=S.tag,S!==5&&S!==26&&S!==27||w===null||g===null||(S=Eu(v,g),S!=null&&b.push(zu(v,S,w))),x)break;v=v.return}0<b.length&&(d=new h(d,m,null,n,c),f.push({event:d,listeners:b}))}}if((t&7)===0){e:{if(h=e==="mouseover"||e==="pointerover",d=e==="mouseout"||e==="pointerout",h&&n!==_g&&(m=n.relatedTarget||n.fromElement)&&(ts(m)||m[Fu]))break e;if(d||h){if(m=c.window===c?c:(h=c.ownerDocument)?h.defaultView||h.parentWindow:window,d){if(h=n.relatedTarget||n.toElement,d=u,h=h?ts(h):null,h!==null&&(x=Uu(h),b=h.tag,h!==x||b!==5&&b!==27&&b!==6))h=null}else d=null,h=u;if(d!==h){if(b=h1,S="onMouseLeave",g="onMouseEnter",v="mouse",e==="pointerout"||e==="pointerover")b=m1,S="onPointerLeave",g="onPointerEnter",v="pointer";x=d==null?m:ou(d),w=h==null?m:ou(h),m=new b(S,v+"leave",d,n,c),m.target=x,m.relatedTarget=w,S=null,ts(c)===u&&(b=new b(g,v+"enter",h,n,c),b.target=w,b.relatedTarget=x,S=b),x=S,b=d&&h?dg(d,h,$B):null,d!==null&&cS(f,m,d,b,!1),h!==null&&x!==null&&cS(f,x,h,b,!0)}}}e:{if(d=u?ou(u):window,h=d.nodeName&&d.nodeName.toLowerCase(),h==="select"||h==="input"&&d.type==="file")var k=y1;else if(b1(d))if(dk)k=Yz;else{k=Xz;var E=$z}else h=d.nodeName,!h||h.toLowerCase()!=="input"||d.type!=="checkbox"&&d.type!=="radio"?u&&Av(u.elementType)&&(k=y1):k=Gz;if(k&&(k=k(e,u))){fk(f,k,n,c);break e}E&&E(e,d,u)}switch(E=u?ou(u):window,e){case"focusin":if(b1(E)||E.contentEditable==="true")dl=E,Og=u,pu=null;break;case"focusout":pu=Og=dl=null;break;case"mousedown":Ag=!0;break;case"contextmenu":case"mouseup":case"dragend":Ag=!1,k1(f,n,c);break;case"selectionchange":if(Qz)break;case"keydown":case"keyup":k1(f,n,c)}var _;if(Nv)e:{switch(e){case"compositionstart":var O="onCompositionStart";break e;case"compositionend":O="onCompositionEnd";break e;case"compositionupdate":O="onCompositionUpdate";break e}O=void 0}else fl?uk(e,n)&&(O="onCompositionEnd"):e==="keydown"&&n.keyCode===229&&(O="onCompositionStart");if(O&&(ak&&n.locale!=="ko"&&(fl||O!=="onCompositionStart"?O==="onCompositionEnd"&&fl&&(_=lk()):(to=c,Tv=("value"in to)?to.value:to.textContent,fl=!0)),E=qd(u,O),0<E.length&&(O=new p1(O,e,null,n,c),f.push({event:O,listeners:E}),_?O.data=_:(_=ck(n),_!==null&&(O.data=_)))),_=Uz?jz(e,n):Kz(e,n))O=qd(u,"onBeforeInput"),0<O.length&&(E=new p1("onBeforeInput","beforeinput",null,n,c),f.push({event:E,listeners:O}),E.data=_);FB(f,e,u,n,c)}iC(f,t)})}function zu(e,t,n){return{instance:e,listener:t,currentTarget:n}}function qd(e,t){for(var n=t+"Capture",i=[];e!==null;){var r=e,o=r.stateNode;if(r=r.tag,r!==5&&r!==26&&r!==27||o===null||(r=Eu(e,n),r!=null&&i.unshift(zu(e,r,o)),r=Eu(e,t),r!=null&&i.push(zu(e,r,o))),e.tag===3)return i;e=e.return}return[]}function $B(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e?e:null}function cS(e,t,n,i,r){for(var o=t._reactName,s=[];n!==null&&n!==i;){var l=n,a=l.alternate,u=l.stateNode;if(l=l.tag,a!==null&&a===i)break;l!==5&&l!==26&&l!==27||u===null||(a=u,r?(u=Eu(n,o),u!=null&&s.unshift(zu(n,u,a))):r||(u=Eu(n,o),u!=null&&s.push(zu(n,u,a)))),n=n.return}s.length!==0&&e.push({event:t,listeners:s})}var XB=/\r\n?/g,GB=/\u0000|\uFFFD/g;function fS(e){return(typeof e==="string"?e:""+e).replace(XB,`
9
- `).replace(GB,"")}function sC(e,t){return t=fS(t),fS(e)===t?!0:!1}function Se(e,t,n,i,r,o){switch(n){case"children":if(typeof i==="string")t==="body"||t==="textarea"&&i===""||Ml(e,i);else if(typeof i==="number"||typeof i==="bigint")t!=="body"&&Ml(e,""+i);else return;break;case"className":Hf(e,"class",i);break;case"tabIndex":Hf(e,"tabindex",i);break;case"dir":case"role":case"viewBox":case"width":case"height":Hf(e,n,i);break;case"style":ok(e,i,o);return;case"data":if(t!=="object"){Hf(e,"data",i);break}case"src":case"href":if(i===""&&(t!=="a"||n!=="href")){e.removeAttribute(n);break}if(i==null||typeof i==="function"||typeof i==="symbol"||typeof i==="boolean"){e.removeAttribute(n);break}i=ed(i),e.setAttribute(n,i);break;case"action":case"formAction":if(typeof i==="function"){e.setAttribute(n,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof o==="function"&&(n==="formAction"?(t!=="input"&&Se(e,t,"name",r.name,r,null),Se(e,t,"formEncType",r.formEncType,r,null),Se(e,t,"formMethod",r.formMethod,r,null),Se(e,t,"formTarget",r.formTarget,r,null)):(Se(e,t,"encType",r.encType,r,null),Se(e,t,"method",r.method,r,null),Se(e,t,"target",r.target,r,null)));if(i==null||typeof i==="symbol"||typeof i==="boolean"){e.removeAttribute(n);break}i=ed(i),e.setAttribute(n,i);break;case"onClick":i!=null&&(e.onclick=Bi);return;case"onScroll":i!=null&&ae("scroll",e);return;case"onScrollEnd":i!=null&&ae("scrollend",e);return;case"dangerouslySetInnerHTML":if(i!=null){if(typeof i!=="object"||!("__html"in i))throw Error(A(61));if(n=i.__html,n!=null){if(r.children!=null)throw Error(A(60));(o!=null?o.__html:void 0)!==n&&(e.innerHTML=n)}}break;case"multiple":e.multiple=i&&typeof i!=="function"&&typeof i!=="symbol";break;case"muted":e.muted=i&&typeof i!=="function"&&typeof i!=="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(i==null||typeof i==="function"||typeof i==="boolean"||typeof i==="symbol"){e.removeAttribute("xlink:href");break}n=ed(i),e.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",n);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":i!=null&&typeof i!=="function"&&typeof i!=="symbol"?e.setAttribute(n,i):e.removeAttribute(n);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"credentialless":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":i&&typeof i!=="function"&&typeof i!=="symbol"?e.setAttribute(n,""):e.removeAttribute(n);break;case"capture":case"download":i===!0?e.setAttribute(n,""):i!==!1&&i!=null&&typeof i!=="function"&&typeof i!=="symbol"?e.setAttribute(n,i):e.removeAttribute(n);break;case"cols":case"rows":case"size":case"span":i!=null&&typeof i!=="function"&&typeof i!=="symbol"&&!isNaN(i)&&1<=i?e.setAttribute(n,i):e.removeAttribute(n);break;case"rowSpan":case"start":i==null||typeof i==="function"||typeof i==="symbol"||isNaN(i)?e.removeAttribute(n):e.setAttribute(n,i);break;case"popover":ae("beforetoggle",e),ae("toggle",e),Zf(e,"popover",i);break;case"xlinkActuate":cr(e,"http://www.w3.org/1999/xlink","xlink:actuate",i);break;case"xlinkArcrole":cr(e,"http://www.w3.org/1999/xlink","xlink:arcrole",i);break;case"xlinkRole":cr(e,"http://www.w3.org/1999/xlink","xlink:role",i);break;case"xlinkShow":cr(e,"http://www.w3.org/1999/xlink","xlink:show",i);break;case"xlinkTitle":cr(e,"http://www.w3.org/1999/xlink","xlink:title",i);break;case"xlinkType":cr(e,"http://www.w3.org/1999/xlink","xlink:type",i);break;case"xmlBase":cr(e,"http://www.w3.org/XML/1998/namespace","xml:base",i);break;case"xmlLang":cr(e,"http://www.w3.org/XML/1998/namespace","xml:lang",i);break;case"xmlSpace":cr(e,"http://www.w3.org/XML/1998/namespace","xml:space",i);break;case"is":Zf(e,"is",i);break;case"innerText":case"textContent":return;default:if(!(2<n.length)||n[0]!=="o"&&n[0]!=="O"||n[1]!=="n"&&n[1]!=="N")n=dz.get(n)||n,Zf(e,n,i);else return}me=!0}function hv(e,t,n,i,r,o){switch(n){case"style":ok(e,i,o);return;case"dangerouslySetInnerHTML":if(i!=null){if(typeof i!=="object"||!("__html"in i))throw Error(A(61));if(n=i.__html,n!=null){if(r.children!=null)throw Error(A(60));(o!=null?o.__html:void 0)!==n&&(e.innerHTML=n)}}break;case"children":if(typeof i==="string")Ml(e,i);else if(typeof i==="number"||typeof i==="bigint")Ml(e,""+i);else return;break;case"onScroll":i!=null&&ae("scroll",e);return;case"onScrollEnd":i!=null&&ae("scrollend",e);return;case"onClick":i!=null&&(e.onclick=Bi);return;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":return;case"innerText":case"textContent":return;default:if(!ZS.hasOwnProperty(n))e:{if(n[0]==="o"&&n[1]==="n"&&(r=n.endsWith("Capture"),o=n.slice(2,r?n.length-7:void 0),t=e[nn]||null,t=t!=null?t[n]:null,typeof t==="function"&&e.removeEventListener(o,t,r),typeof i==="function")){typeof t!=="function"&&t!==null&&(n in e?e[n]=null:e.hasAttribute(n)&&e.removeAttribute(n)),e.addEventListener(o,i,r);break e}me=!0,n in e?e[n]=i:i===!0?e.setAttribute(n,""):Zf(e,n,i)}return}me=!0}function At(e,t,n){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":ae("error",e),ae("load",e);var i=!1,r=!1,o;for(o in n)if(n.hasOwnProperty(o)){var s=n[o];if(s!=null)switch(o){case"src":i=!0;break;case"srcSet":r=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(A(137,t));default:Se(e,t,o,s,n,null)}}r&&Se(e,t,"srcSet",n.srcSet,n,null),i&&Se(e,t,"src",n.src,n,null);return;case"input":ae("invalid",e);var l=o=s=r=null,a=null,u=null;for(i in n)if(n.hasOwnProperty(i)){var c=n[i];if(c!=null)switch(i){case"name":r=c;break;case"type":s=c;break;case"checked":a=c;break;case"defaultChecked":u=c;break;case"value":o=c;break;case"defaultValue":l=c;break;case"children":case"dangerouslySetInnerHTML":if(c!=null)throw Error(A(137,t));break;default:Se(e,t,i,c,n,null)}}nk(e,o,l,a,u,s,r,!1);return;case"select":ae("invalid",e),i=s=o=null;for(r in n)if(n.hasOwnProperty(r)&&(l=n[r],l!=null))switch(r){case"value":o=l;break;case"defaultValue":s=l;break;case"multiple":i=l;default:Se(e,t,r,l,n,null)}t=o,n=s,e.multiple=!!i,t!=null?xl(e,!!i,t,!1):n!=null&&xl(e,!!i,n,!0);return;case"textarea":ae("invalid",e),o=r=i=null;for(s in n)if(n.hasOwnProperty(s)&&(l=n[s],l!=null))switch(s){case"value":i=l;break;case"defaultValue":r=l;break;case"children":o=l;break;case"dangerouslySetInnerHTML":if(l!=null)throw Error(A(91));break;default:Se(e,t,s,l,n,null)}rk(e,i,r,o);return;case"option":for(a in n)if(n.hasOwnProperty(a)&&(i=n[a],i!=null))switch(a){case"selected":e.selected=i&&typeof i!=="function"&&typeof i!=="symbol";break;default:Se(e,t,a,i,n,null)}return;case"dialog":ae("beforetoggle",e),ae("toggle",e),ae("cancel",e),ae("close",e);break;case"iframe":case"object":ae("load",e);break;case"video":case"audio":for(i=0;i<Lu.length;i++)ae(Lu[i],e);break;case"image":ae("error",e),ae("load",e);break;case"details":ae("toggle",e);break;case"embed":case"source":case"link":ae("error",e),ae("load",e);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(u in n)if(n.hasOwnProperty(u)&&(i=n[u],i!=null))switch(u){case"children":case"dangerouslySetInnerHTML":throw Error(A(137,t));default:Se(e,t,u,i,n,null)}return;default:if(Av(t)){for(c in n)n.hasOwnProperty(c)&&(i=n[c],i!==void 0&&hv(e,t,c,i,n,void 0));return}}for(l in n)n.hasOwnProperty(l)&&(i=n[l],i!=null&&Se(e,t,l,i,n,null))}var YB={};function WB(e,t,n,i){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var r=null,o=null,s=null,l=null,a=null,u=null,c=null;for(h in n){var f=n[h];if(n.hasOwnProperty(h)&&f!=null)switch(h){case"checked":break;case"value":break;case"defaultValue":a=f;default:i.hasOwnProperty(h)||Se(e,t,h,null,i,f)}}for(var d in i){var h=i[d];if(f=n[d],i.hasOwnProperty(d)&&(h!=null||f!=null))switch(d){case"type":h!==f&&(me=!0),o=h;break;case"name":h!==f&&(me=!0),r=h;break;case"checked":h!==f&&(me=!0),u=h;break;case"defaultChecked":h!==f&&(me=!0),c=h;break;case"value":h!==f&&(me=!0),s=h;break;case"defaultValue":h!==f&&(me=!0),l=h;break;case"children":case"dangerouslySetInnerHTML":if(h!=null)throw Error(A(137,t));break;default:h!==f&&Se(e,t,d,h,i,f)}}kg(e,s,l,a,u,c,o,r);return;case"select":h=s=l=d=null;for(o in n)if(a=n[o],n.hasOwnProperty(o)&&a!=null)switch(o){case"value":break;case"multiple":h=a;default:i.hasOwnProperty(o)||Se(e,t,o,null,i,a)}for(r in i)if(o=i[r],a=n[r],i.hasOwnProperty(r)&&(o!=null||a!=null))switch(r){case"value":o!==a&&(me=!0),d=o;break;case"defaultValue":o!==a&&(me=!0),l=o;break;case"multiple":o!==a&&(me=!0),s=o;default:o!==a&&Se(e,t,r,o,i,a)}t=l,n=s,i=h,d!=null?xl(e,!!n,d,!1):!!i!==!!n&&(t!=null?xl(e,!!n,t,!0):xl(e,!!n,n?[]:"",!1));return;case"textarea":h=d=null;for(l in n)if(r=n[l],n.hasOwnProperty(l)&&r!=null&&!i.hasOwnProperty(l))switch(l){case"value":break;case"children":break;default:Se(e,t,l,null,i,r)}for(s in i)if(r=i[s],o=n[s],i.hasOwnProperty(s)&&(r!=null||o!=null))switch(s){case"value":r!==o&&(me=!0),d=r;break;case"defaultValue":r!==o&&(me=!0),h=r;break;case"children":break;case"dangerouslySetInnerHTML":if(r!=null)throw Error(A(91));break;default:r!==o&&Se(e,t,s,r,i,o)}ik(e,d,h);return;case"option":for(var m in n)if(d=n[m],n.hasOwnProperty(m)&&d!=null&&!i.hasOwnProperty(m))switch(m){case"selected":e.selected=!1;break;default:Se(e,t,m,null,i,d)}for(a in i)if(d=i[a],h=n[a],i.hasOwnProperty(a)&&d!==h&&(d!=null||h!=null))switch(a){case"selected":d!==h&&(me=!0),e.selected=d&&typeof d!=="function"&&typeof d!=="symbol";break;default:Se(e,t,a,d,i,h)}return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var b in n)d=n[b],n.hasOwnProperty(b)&&d!=null&&!i.hasOwnProperty(b)&&Se(e,t,b,null,i,d);for(u in i)if(d=i[u],h=n[u],i.hasOwnProperty(u)&&d!==h&&(d!=null||h!=null))switch(u){case"children":case"dangerouslySetInnerHTML":if(d!=null)throw Error(A(137,t));break;default:Se(e,t,u,d,i,h)}return;default:if(Av(t)){for(var x in n)d=n[x],n.hasOwnProperty(x)&&d!==void 0&&!i.hasOwnProperty(x)&&hv(e,t,x,void 0,i,d);for(c in i)d=i[c],h=n[c],!i.hasOwnProperty(c)||d===h||d===void 0&&h===void 0||hv(e,t,c,d,i,h);return}}for(var g in n)d=n[g],n.hasOwnProperty(g)&&d!=null&&!i.hasOwnProperty(g)&&Se(e,t,g,null,i,d);for(f in i)d=i[f],h=n[f],!i.hasOwnProperty(f)||d===h||d==null&&h==null||Se(e,t,f,d,i,h)}function dS(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function QB(){if(typeof performance.getEntriesByType==="function"){for(var e=0,t=0,n=performance.getEntriesByType("resource"),i=0;i<n.length;i++){var r=n[i],{transferSize:o,initiatorType:s,duration:l}=r;if(o&&l&&dS(s)){s=0,l=r.responseEnd;for(i+=1;i<n.length;i++){var a=n[i],u=a.startTime;if(u>l)break;var c=a.transferSize,f=a.initiatorType;c&&dS(f)&&(a=a.responseEnd,s+=c*(a<l?1:(l-u)/(a-u)))}if(--i,t+=8*(o+s)/(r.duration/1000),e++,10<e)break}}if(0<e)return t/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e==="number")?e:5}var pv=null,mv=null;function Bu(e){return e.nodeType===9?e:e.ownerDocument}function hS(e){switch(e){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function lC(e,t){if(e===0)switch(t){case"svg":return 1;case"math":return 2;default:return 0}return e===1&&t==="foreignObject"?0:e}function aC(e,t,n,i){return n=Bu(n).createElement(e),n[_t]=i,n[nn]=t,At(n,e,t),gt(n),n}function gv(e,t){return e==="textarea"||e==="noscript"||typeof t.children==="string"||typeof t.children==="number"||typeof t.children==="bigint"||typeof t.dangerouslySetInnerHTML==="object"&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var ag=null;function JB(){var e=window.event;if(e&&e.type==="popstate"){if(e===ag)return!1;return ag=e,!0}return ag=null,!1}var hb=typeof setTimeout==="function"?setTimeout:void 0,ZB=typeof clearTimeout==="function"?clearTimeout:void 0,pS=typeof Promise==="function"?Promise:void 0,mS=typeof requestAnimationFrame==="function"?requestAnimationFrame:hb,e4=typeof queueMicrotask==="function"?queueMicrotask:typeof pS<"u"?function(e){return pS.resolve(null).then(e).catch(t4)}:hb;function t4(e){setTimeout(function(){throw e})}function wo(e){return e==="head"}function gS(e,t){var n=t,i=0;do{var r=n.nextSibling;if(e.removeChild(n),r&&r.nodeType===8)if(n=r.data,n==="/$"||n==="/&"){if(i===0){e.removeChild(r),Ul(t);return}i--}else if(n==="$"||n==="$?"||n==="$~"||n==="$!"||n==="&")i++;else if(n==="html")cg(e.ownerDocument.documentElement);else if(n==="head"){n=e.ownerDocument.head,cg(n);for(var o=n.firstChild;o;){var s=o.nextSibling,l=o.nodeName;o[qu]||l==="SCRIPT"||l==="STYLE"||l==="LINK"&&o.rel.toLowerCase()==="stylesheet"||n.removeChild(o),o=s}}else n==="body"&&cg(e.ownerDocument.body);n=r}while(n);Ul(t)}function vS(e,t){var n=e;e=0;do{var i=n.nextSibling;if(n.nodeType===1?t?(n._stashedDisplay=n.style.display,n.style.display="none"):(n.style.display=n._stashedDisplay||"",n.getAttribute("style")===""&&n.removeAttribute("style")):n.nodeType===3&&(t?(n._stashedText=n.nodeValue,n.nodeValue=""):n.nodeValue=n._stashedText||""),i&&i.nodeType===8)if(n=i.data,n==="/$")if(e===0)break;else e--;else n!=="$"&&n!=="$?"&&n!=="$~"&&n!=="$!"||e++;n=i}while(n)}function uC(e,t,n){if(t=CSS.escape(t)!==t?"r-"+btoa(t).replace(/=/g,""):t,e.style.viewTransitionName=t,n!=null&&(e.style.viewTransitionClass=n),n=getComputedStyle(e),n.display==="inline"){if(t=e.getClientRects(),t.length===1)var i=1;else for(var r=i=0;r<t.length;r++){var o=t[r];0<o.width&&0<o.height&&i++}i===1&&(e=e.style,e.display=t.length===1?"inline-block":"block",e.marginTop="-"+n.paddingTop,e.marginBottom="-"+n.paddingBottom)}}function cC(e,t){e=e.style,t=t.style;var n=t!=null?t.hasOwnProperty("viewTransitionName")?t.viewTransitionName:t.hasOwnProperty("view-transition-name")?t["view-transition-name"]:null:null;e.viewTransitionName=n==null||typeof n==="boolean"?"":(""+n).trim(),n=t!=null?t.hasOwnProperty("viewTransitionClass")?t.viewTransitionClass:t.hasOwnProperty("view-transition-class")?t["view-transition-class"]:null:null,e.viewTransitionClass=n==null||typeof n==="boolean"?"":(""+n).trim(),e.display==="inline-block"&&(t==null?e.display=e.margin="":(n=t.display,e.display=n==null||typeof n==="boolean"?"":n,n=t.margin,n!=null?e.margin=n:(n=t.hasOwnProperty("marginTop")?t.marginTop:t["margin-top"],e.marginTop=n==null||typeof n==="boolean"?"":n,t=t.hasOwnProperty("marginBottom")?t.marginBottom:t["margin-bottom"],e.marginBottom=t==null||typeof t==="boolean"?"":t)))}function fC(e,t,n){return n=n.ownerDocument.defaultView,{rect:e,abs:t.position==="absolute"||t.position==="fixed",clip:t.clipPath!=="none"||t.overflow!=="visible"||t.filter!=="none"||t.mask!=="none"||t.mask!=="none"||t.borderRadius!=="0px",view:0<=e.bottom&&0<=e.right&&e.top<=n.innerHeight&&e.left<=n.innerWidth}}function vv(e){var t=e.getBoundingClientRect(),n=getComputedStyle(e);return fC(t,n,e)}function n4(e){var t=e.getBoundingClientRect();t=new DOMRect(t.x+20000,t.y+20000,t.width,t.height);var n=getComputedStyle(e);return fC(t,n,e)}function i4(e){return e.documentElement.clientHeight}function r4(e){this.addEventListener("load",e),this.addEventListener("error",e)}function o4(e,t,n,i,r,o,s,l,a){var u=t.nodeType===9?t:t.ownerDocument;try{var c=u.startViewTransition({update:function(){var d=u.defaultView,h=d.navigation&&d.navigation.transition,m=u.fonts.status;i();var b=[];if(m==="loaded"&&(i4(u),u.fonts.status==="loading"&&b.push(u.fonts.ready)),m=b.length,e!==null)for(var x=e.suspenseyImages,g=0,v=0;v<x.length;v++){var w=x[v];if(!w.complete){var S=w.getBoundingClientRect();if(0<S.bottom&&0<S.right&&S.top<d.innerHeight&&S.left<d.innerWidth){if(g+=kC(w),g>gd){b.length=m;break}w=new Promise(r4.bind(w)),b.push(w)}}}if(0<b.length)return d=Promise.race([Promise.all(b),new Promise(function(k){return setTimeout(k,500)})]).then(r,r),(h?Promise.allSettled([h.finished,d]):d).then(o,o);if(r(),h)return h.finished.then(o,o);o()},types:n});u.__reactViewTransition=c;var f=[];return c.ready.then(function(){for(var d=u.documentElement.getAnimations({subtree:!0}),h=0;h<d.length;h++){var m=d[h],b=m.effect,x=b.pseudoElement;if(x!=null&&x.startsWith("::view-transition")){f.push(m),m=b.getKeyframes();for(var g=x=void 0,v=!0,w=0;w<m.length;w++){var S=m[w],k=S.width;if(x===void 0)x=k;else if(x!==k){v=!1;break}if(k=S.height,g===void 0)g=k;else if(g!==k){v=!1;break}delete S.width,delete S.height,S.transform==="none"&&delete S.transform}v&&x!==void 0&&g!==void 0&&(b.setKeyframes(m),v=getComputedStyle(b.target,b.pseudoElement),v.width!==x||v.height!==g)&&(v=m[0],v.width=x,v.height=g,v=m[m.length-1],v.width=x,v.height=g,b.setKeyframes(m))}}s()},function(d){u.__reactViewTransition===c&&(u.__reactViewTransition=null);try{if(typeof d==="object"&&d!==null)switch(d.name){case"InvalidStateError":if(d.message==="View transition was skipped because document visibility state is hidden."||d.message==="Skipping view transition because document visibility state has become hidden."||d.message==="Skipping view transition because viewport size changed."||d.message==="Transition was aborted because of invalid state")d=null}d!==null&&a(d)}finally{i(),r(),s()}}),c.finished.finally(function(){for(var d=0;d<f.length;d++)f[d].cancel();u.__reactViewTransition===c&&(u.__reactViewTransition=null),l()}),c}catch(d){return i(),r(),s(),null}}function ns(e,t){this._scope=document.documentElement,this._selector="::view-transition-"+e+"("+t+")"}ns.prototype.animate=function(e,t){return t=typeof t==="number"?{duration:t}:Te({},t),t.pseudoElement=this._selector,this._scope.animate(e,t)};ns.prototype.getAnimations=function(){for(var e=this._scope,t=this._selector,n=e.getAnimations({subtree:!0}),i=[],r=0;r<n.length;r++){var o=n[r].effect;o!==null&&o.target===e&&o.pseudoElement===t&&i.push(n[r])}return i};ns.prototype.getComputedStyle=function(){return getComputedStyle(this._scope,this._selector)};function dC(e){return{name:e,group:new ns("group",e),imagePair:new ns("image-pair",e),old:new ns("old",e),new:new ns("new",e)}}function vn(e){this._fragmentFiber=e,this._observers=this._eventListeners=null}vn.prototype.addEventListener=function(e,t,n){var i=null,r=null;if(n!=null&&typeof n!=="boolean"&&(i=n.signal||null,i!==null&&i.aborted))return;this._eventListeners===null&&(this._eventListeners=[]);var o=this._eventListeners;if(hC(o,e,t,n)===-1){var s=this,l=t;n!=null&&typeof n!=="boolean"&&n.once===!0&&(l=function(a){s.removeEventListener(e,t,n),typeof t==="function"?t.call(this,a):t.handleEvent(a)}),i!==null&&(r=s.removeEventListener.bind(s,e,t,n),i.addEventListener("abort",r,{once:!0}),r=i.removeEventListener.bind(i,"abort",r)),i=Pl(n),o.push({type:e,listener:t,optionsOrUseCapture:n,attachedListener:l,cleanup:r}),tn(this._fragmentFiber.child,!1,s4,e,l,i)}this._eventListeners=o};function s4(e,t,n,i){return ft(e).addEventListener(t,n,i),!1}vn.prototype.removeEventListener=function(e,t,n){var i=this._eventListeners;if(i!==null&&(t=hC(i,e,t,n),t!==-1)){var r=i[t];n=r.attachedListener;var o=r.cleanup;r=Pl(r.optionsOrUseCapture),tn(this._fragmentFiber.child,!1,l4,e,n,r),i.splice(t,1),o!==null&&o()}};function l4(e,t,n,i){return ft(e).removeEventListener(t,n,i),!1}function Pl(e){return e!=null&&typeof e!=="boolean"&&(e.once===!0||e.signal instanceof AbortSignal)?{capture:e.capture,passive:e.passive}:e}function bS(e){return e==null?"c=0":typeof e==="boolean"?"c="+(e?"1":"0"):"c="+(e.capture?"1":"0")}function hC(e,t,n,i){if(e.length===0)return-1;i=bS(i);for(var r=0;r<e.length;r++){var o=e[r];if(o.type===t&&o.listener===n&&bS(o.optionsOrUseCapture)===i)return r}return-1}vn.prototype.dispatchEvent=function(e){var t=bs(this._fragmentFiber);if(t===null)return!0;t=ft(t);var n=this._eventListeners;if(n!==null&&0<n.length||!e.bubbles){var i=t.nodeType===9?t.createComment(""):document.createTextNode("");if(n)for(var r=0;r<n.length;r++){var o=n[r];i.addEventListener(o.type,o.attachedListener,Pl(o.optionsOrUseCapture))}if(t.appendChild(i),e=i.dispatchEvent(e),n)for(r=0;r<n.length;r++)o=n[r],i.removeEventListener(o.type,o.attachedListener,Pl(o.optionsOrUseCapture));return t.removeChild(i),e}return t.dispatchEvent(e)};vn.prototype.focus=function(e){tn(this._fragmentFiber.child,!0,pC,e,void 0,void 0)};function pC(e,t){if(e.tag===6)return!1;return e=ft(e),y4(e,t)}vn.prototype.focusLast=function(e){var t=[];tn(this._fragmentFiber.child,!0,pb,t,void 0,void 0);for(var n=t.length-1;0<=n&&!pC(t[n],e);n--);};function pb(e,t){return t.push(e),!1}vn.prototype.blur=function(){var e=bs(this._fragmentFiber);e!==null&&(e=ft(e),e=Bu(e).activeElement,e!==null&&tn(this._fragmentFiber.child,!1,a4,e,void 0,void 0))};function a4(e,t){if(e.tag===6)return!1;return e=ft(e),e===t||e.contains(t)?(t.blur(),!0):!1}vn.prototype.observeUsing=function(e){this._observers===null&&(this._observers=new Set),this._observers.add(e),tn(this._fragmentFiber.child,!1,u4,e,void 0,void 0)};function u4(e,t){if(e.tag===6)return!1;return e=ft(e),t.observe(e),!1}vn.prototype.unobserveUsing=function(e){var t=this._observers;if(t!==null&&t.has(e)){t.delete(e),tn(this._fragmentFiber.child,!1,c4,e,void 0,void 0);for(var n=t=0;n<oi.length;n++){var i=oi[n];i.fragmentInstance===this&&i.observer===e?e.unobserve(i.instance):oi[t++]=i}oi.length=t}};function c4(e,t){if(e.tag===6)return!1;return e=ft(e),t.unobserve(e),!1}var oi=[],ug=!1;function f4(e,t,n){oi.push({fragmentInstance:e,observer:t,instance:n}),ug||(ug=!0,x4(function(){ug=!1;var i=oi;oi=[];for(var r=0;r<i.length;r++){var o=i[r];o.observer.unobserve(o.instance)}}))}vn.prototype.getClientRects=function(){var e=[];return tn(this._fragmentFiber.child,!1,d4,e,void 0,void 0),e};function d4(e,t){if(e.tag===6){e=e.stateNode;var n=e.ownerDocument.createRange();n.selectNodeContents(e),t.push.apply(t,n.getClientRects())}else e=ft(e),t.push.apply(t,e.getClientRects());return!1}vn.prototype.getRootNode=function(e){var t=bs(this._fragmentFiber);return t===null?this:ft(t).getRootNode(e)};vn.prototype.compareDocumentPosition=function(e){var t=bs(this._fragmentFiber);if(t===null)return Node.DOCUMENT_POSITION_DISCONNECTED;var n=[];tn(this._fragmentFiber.child,!1,pb,n,void 0,void 0);var i=ft(t);if(n.length===0){if(n=i,Zw(this._fragmentFiber)){e:{for(t=this._fragmentFiber.return;t!==null;){if(t.tag===4){t=t.stateNode.containerInfo;break e}if(t.tag===3||t.tag===5||t.tag===27)break;t=t.return}t=null}t!=null&&(n=t)}t=this._fragmentFiber;var r=i=n.compareDocumentPosition(e);return n===e?r=Node.DOCUMENT_POSITION_CONTAINS:i&Node.DOCUMENT_POSITION_CONTAINED_BY&&(n=PS(t)[1],n===null?r=Node.DOCUMENT_POSITION_PRECEDING:(e=ft(n).compareDocumentPosition(e),r=e===0||e&Node.DOCUMENT_POSITION_FOLLOWING?Node.DOCUMENT_POSITION_FOLLOWING:Node.DOCUMENT_POSITION_PRECEDING)),r|=Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC}t=ft(n[0]),r=ft(n[n.length-1]);var o=Zw(this._fragmentFiber)?t.parentElement:i;if(o==null)return Node.DOCUMENT_POSITION_DISCONNECTED;i=o.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_CONTAINED_BY,o=o.compareDocumentPosition(r)&Node.DOCUMENT_POSITION_CONTAINED_BY;var s=t.compareDocumentPosition(e),l=r.compareDocumentPosition(e),a=s&Node.DOCUMENT_POSITION_CONTAINED_BY||l&Node.DOCUMENT_POSITION_CONTAINED_BY;return l=i&&o&&s&Node.DOCUMENT_POSITION_FOLLOWING&&l&Node.DOCUMENT_POSITION_PRECEDING,t=i&&t===e||o&&r===e||a||l?Node.DOCUMENT_POSITION_CONTAINED_BY:!i&&t===e||!o&&r===e?Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC:s,t&Node.DOCUMENT_POSITION_DISCONNECTED||t&Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC||h4(t,this._fragmentFiber,n[0],n[n.length-1],e)?t:Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC};function h4(e,t,n,i,r){var o=ts(r);if(e&Node.DOCUMENT_POSITION_CONTAINED_BY){if(n=!!o)e:{for(;o!==null;){if(o.tag===7&&(o===t||o.alternate===t)){n=!0;break e}o=o.return}n=!1}return n}if(e&Node.DOCUMENT_POSITION_CONTAINS){if(o===null)return o=r.ownerDocument,r===o||r===o.documentElement||r===o.body;e:{o=t;for(t=bs(t);o!==null;){if(!(o.tag!==5&&o.tag!==3&&o.tag!==27||o!==t&&o.alternate!==t)){o=!0;break e}o=o.return}o=!1}return o}return e&Node.DOCUMENT_POSITION_PRECEDING?((t=!!o)&&!(t=o===n)&&(t=dg(n,o,e1),t===null?t=!1:(tn(t,!0,HL,o,n),o=ll,ll=null,t=o!==null)),t):e&Node.DOCUMENT_POSITION_FOLLOWING?((t=!!o)&&!(t=o===i)&&(t=dg(i,o,e1),t===null?t=!1:(tn(t,!0,UL,o,i),o=ll,fg=ll=null,t=o!==null)),t):!1}function yS(e,t){var n=e.ownerDocument.createRange();n.selectNodeContents(e),e=n.getBoundingClientRect(),window.scrollTo(window.scrollX+e.left,t?window.scrollY+e.top:window.scrollY+e.bottom-window.innerHeight)}vn.prototype.scrollIntoView=function(e){if(typeof e==="object")throw Error(A(566));var t=[];tn(this._fragmentFiber.child,!1,pb,t,void 0,void 0);var n=e!==!1;if(t.length===0){var i=PS(this._fragmentFiber);if(i=n?i[1]||i[0]||bs(this._fragmentFiber):i[0]||i[1],i===null)return;if(i.tag===6){e=ft(i),yS(e,n);return}if(i=ft(i),i.nodeType!==9){if(i.nodeType===11){n="host"in i?i.host:null,n!==null&&n.scrollIntoView(e);return}i.scrollIntoView(e)}}for(i=n?t.length-1:0;i!==(n?-1:t.length);){var r=t[i];r.tag===6?(r=ft(r),yS(r,n)):ft(r).scrollIntoView(e),i+=n?-1:1}};function p4(e,t){return e=ft(e),mC(e,t),!1}function mC(e,t){e.reactFragments==null&&(e.reactFragments=new Set),e.reactFragments.add(t)}function gC(e,t){var n=t._eventListeners;if(n!==null)for(var i=0;i<n.length;i++){var r=n[i];e.addEventListener(r.type,r.attachedListener,Pl(r.optionsOrUseCapture))}e.nodeType!==3&&(n=t._observers,n!==null&&n.forEach(function(o){for(var s=0,l=0;l<oi.length;l++){var a=oi[l];if(a.fragmentInstance!==t||a.observer!==o||a.instance!==e)oi[s++]=a}oi.length=s,o.observe(e)}),mC(e,t))}function m4(e,t){var n=t._eventListeners;if(n!==null)for(var i=0;i<n.length;i++){var r=n[i];e.removeEventListener(r.type,r.attachedListener,Pl(r.optionsOrUseCapture))}e.nodeType!==3&&(n=t._observers,n!==null&&n.forEach(function(o){typeof o.rootMargin==="string"?f4(t,o,e):o.unobserve(e)}),e.reactFragments!=null&&e.reactFragments.delete(t))}function bv(e){var t=e.firstChild;t&&t.nodeType===10&&(t=t.nextSibling);for(;t;){var n=t;switch(t=t.nextSibling,n.nodeName){case"HTML":case"HEAD":case"BODY":bv(n),Wd(n);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(n.rel.toLowerCase()==="stylesheet")continue}e.removeChild(n)}}function g4(e,t,n,i){for(;e.nodeType===1;){var r=n;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!i&&(e.nodeName!=="INPUT"||e.type!=="hidden"))break}else if(!i)if(t==="input"&&e.type==="hidden"){var o=r.name==null?null:""+r.name;if(r.type==="hidden"&&e.getAttribute("name")===o)return e}else return e;else if(!e[qu])switch(t){case"meta":if(!e.hasAttribute("itemprop"))break;return e;case"link":if(o=e.getAttribute("rel"),o==="stylesheet"&&e.hasAttribute("data-precedence"))break;else if(o!==r.rel||e.getAttribute("href")!==(r.href==null||r.href===""?null:r.href)||e.getAttribute("crossorigin")!==(r.crossOrigin==null?null:r.crossOrigin)||e.getAttribute("title")!==(r.title==null?null:r.title))break;return e;case"style":if(e.hasAttribute("data-precedence"))break;return e;case"script":if(o=e.getAttribute("src"),(o!==(r.src==null?null:r.src)||e.getAttribute("type")!==(r.type==null?null:r.type)||e.getAttribute("crossorigin")!==(r.crossOrigin==null?null:r.crossOrigin))&&o&&e.hasAttribute("async")&&!e.hasAttribute("itemprop"))break;return e;default:return e}if(e=In(e.nextSibling),e===null)break}return null}function v4(e,t,n){if(t==="")return null;for(;e.nodeType!==3;){if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!n)return null;if(e=In(e.nextSibling),e===null)return null}return e}function vC(e,t){for(;e.nodeType!==8;){if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!t)return null;if(e=In(e.nextSibling),e===null)return null}return e}function yv(e){return e.data==="$?"||e.data==="$~"}function mb(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function b4(e,t){var n=e.ownerDocument;if(e.data==="$~")e._reactRetry=t;else if(e.data!=="$?"||n.readyState!=="loading")t();else{var i=function(){t(),n.removeEventListener("DOMContentLoaded",i)};n.addEventListener("DOMContentLoaded",i),e._reactRetry=i}}function In(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t==="$"||t==="$!"||t==="$?"||t==="$~"||t==="&"||t==="F!"||t==="F")break;if(t==="/$"||t==="/&")return null}}return e}var xv=null;function xS(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="/$"||n==="/&"){if(t===0)return In(e.nextSibling);t--}else n!=="$"&&n!=="$!"&&n!=="$?"&&n!=="$~"&&n!=="&"||t++}e=e.nextSibling}return null}function wS(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="$"||n==="$!"||n==="$?"||n==="$~"||n==="&"){if(t===0)return e;t--}else n!=="/$"&&n!=="/&"||t++}e=e.previousSibling}return null}function y4(e,t){function n(){i=!0}if(e.ownerDocument.activeElement===e)return!0;var i=!1;try{e.ownerDocument.addEventListener("focus",n,!0),(e.focus||HTMLElement.prototype.focus).call(e,t)}finally{e.ownerDocument.removeEventListener("focus",n,!0)}return i}function x4(e){mS(function(){mS(function(t){return e(t)})})}function bC(e,t,n){switch(t=Bu(n),e){case"html":if(e=t.documentElement,!e)throw Error(A(452));return e;case"head":if(e=t.head,!e)throw Error(A(453));return e;case"body":if(e=t.body,!e)throw Error(A(454));return e;default:throw Error(A(451))}}function yC(e,t,n){for(var i in n){var r=n[i];n.hasOwnProperty(i)&&r!=null&&Se(e,t,i,null,YB,r)}n.dangerouslySetInnerHTML!=null&&(e.textContent=""),e.onclick===Bi&&(e.onclick=null),Wd(e)}function cg(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);Wd(e)}var Vn=new Map,SS=new Set;function Pu(e){if(typeof e.getRootNode==="function"){var t=e.getRootNode();if(t.nodeType===9||t.nodeType===11)return t}return e.nodeType===9?e:e.ownerDocument}var Cr=be.d;be.d={f:w4,r:S4,D:k4,C:_4,L:C4,m:E4,X:A4,S:O4,M:R4};function w4(){var e=Cr.f(),t=ch();return e||t}function S4(e){var t=jl(e);t!==null&&t.tag===5&&t.type==="form"?o_(t):Cr.r(e)}var $l=typeof document>"u"?null:document;function xC(e,t,n){var i=$l;if(i&&typeof t==="string"&&t){var r=Ln(t);r='link[rel="'+e+'"][href="'+r+'"]',typeof n==="string"&&(r+='[crossorigin="'+n+'"]'),SS.has(r)||(SS.add(r),e={rel:e,crossOrigin:n,href:t},i.querySelector(r)===null&&(t=i.createElement("link"),At(t,"link",e),gt(t),i.head.appendChild(t)))}}function k4(e){Cr.D(e),xC("dns-prefetch",e,null)}function _4(e,t){Cr.C(e,t),xC("preconnect",e,t)}function C4(e,t,n){Cr.L(e,t,n);var i=$l;if(i&&e&&t){var r='link[rel="preload"][as="'+Ln(t)+'"]';t==="image"?n&&n.imageSrcSet?(r+='[imagesrcset="'+Ln(n.imageSrcSet)+'"]',typeof n.imageSizes==="string"&&(r+='[imagesizes="'+Ln(n.imageSizes)+'"]')):r+='[href="'+Ln(e)+'"]':r+='[href="'+Ln(e)+'"]';var o=r;switch(t){case"style":o=Il(e);break;case"script":o=Xl(e)}if(!(Vn.has(o)||(e=Te({rel:"preload",href:t==="image"&&n&&n.imageSrcSet?void 0:e,as:t},n),Vn.set(o,e),i.querySelector(r)!==null||t==="style"&&i.querySelector(Qu(o))||t==="script"&&i.querySelector(Ju(o))))){var s=i.createElement("link");At(s,"link",e),t==="style"&&(s[kd]=!0,s.onload=s.onerror=function(){QS(s)}),gt(s),i.head.appendChild(s)}}}function E4(e,t){Cr.m(e,t);var n=$l;if(n&&e){var i=t&&typeof t.as==="string"?t.as:"script",r='link[rel="modulepreload"][as="'+Ln(i)+'"][href="'+Ln(e)+'"]',o=r;switch(i){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":o=Xl(e)}if(!Vn.has(o)&&(e=Te({rel:"modulepreload",href:e},t),Vn.set(o,e),n.querySelector(r)===null)){switch(i){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(n.querySelector(Ju(o)))return}i=n.createElement("link"),At(i,"link",e),gt(i),n.head.appendChild(i)}}}function O4(e,t,n){Cr.S(e,t,n);var i=$l;if(i&&e){var r=yl(i).hoistableStyles,o=Il(e);t=t||"default";var s=r.get(o);if(!s){var l={loading:0,preload:null};if(s=i.querySelector(Qu(o)))l.loading=5;else{e=Te({rel:"stylesheet",href:e,"data-precedence":t},n),(n=Vn.get(o))&&gb(e,n);var a=s=i.createElement("link");gt(a),At(a,"link",e),a._p=new Promise(function(u,c){a.onload=u,a.onerror=c}),a.addEventListener("load",function(){l.loading|=1}),a.addEventListener("error",function(){l.loading|=2}),l.loading|=4,pd(s,t,i)}s={type:"stylesheet",instance:s,count:1,state:l},r.set(o,s)}}}function A4(e,t){Cr.X(e,t);var n=$l;if(n&&e){var i=yl(n).hoistableScripts,r=Xl(e),o=i.get(r);o||(o=n.querySelector(Ju(r)),o||(e=Te({src:e,async:!0},t),(t=Vn.get(r))&&vb(e,t),o=n.createElement("script"),gt(o),At(o,"link",e),n.head.appendChild(o)),o={type:"script",instance:o,count:1,state:null},i.set(r,o))}}function R4(e,t){Cr.M(e,t);var n=$l;if(n&&e){var i=yl(n).hoistableScripts,r=Xl(e),o=i.get(r);o||(o=n.querySelector(Ju(r)),o||(e=Te({src:e,async:!0,type:"module"},t),(t=Vn.get(r))&&vb(e,t),o=n.createElement("script"),gt(o),At(o,"link",e),n.head.appendChild(o)),o={type:"script",instance:o,count:1,state:null},i.set(r,o))}}function kS(e,t,n,i){var r=(r=so.current)?Pu(r):null;if(!r)throw Error(A(446));switch(e){case"meta":case"title":return null;case"style":return typeof n.precedence==="string"&&typeof n.href==="string"?(n=Il(n.href),t=yl(r).hoistableStyles,i=t.get(n),i||(i={type:"style",instance:null,count:0,state:null},t.set(n,i)),i):{type:"void",instance:null,count:0,state:null};case"link":if(n.rel==="stylesheet"&&typeof n.href==="string"&&typeof n.precedence==="string"){e=Il(n.href);var o=yl(r).hoistableStyles,s=o.get(e);if(s||(r=r.ownerDocument||r,s={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},o.set(e,s),(o=r.querySelector(Qu(e)))?o._p||(s.instance=o,s.state.loading=5):(o=Vn.get(e),o||(o={rel:"preload",as:"style",href:n.href,crossOrigin:n.crossOrigin,integrity:n.integrity,media:n.media,hrefLang:n.hrefLang,referrerPolicy:n.referrerPolicy},Vn.set(e,o)),T4(r,e,o,s.state))),t&&i===null)throw Error(A(528,""));return s}if(t&&i!==null)throw Error(A(529,""));return null;case"script":return t=n.async,n=n.src,typeof n==="string"&&t&&typeof t!=="function"&&typeof t!=="symbol"?(n=Xl(n),t=yl(r).hoistableScripts,i=t.get(n),i||(i={type:"script",instance:null,count:0,state:null},t.set(n,i)),i):{type:"void",instance:null,count:0,state:null};default:throw Error(A(444,e))}}function Il(e){return'href="'+Ln(e)+'"'}function Qu(e){return'link[rel="stylesheet"]['+e+"]"}function wC(e){return Te({},e,{"data-precedence":e.precedence,precedence:null})}function T4(e,t,n,i){if(t=e.querySelector('link[rel="preload"][as="style"]['+t+"]")){if(t[kd]!==!0){i.loading=1;return}}else t=e.createElement("link"),t[kd]=!0,t.onload=t.onerror=QS.bind(null,t),At(t,"link",n),gt(t),e.head.appendChild(t);i.preload=t,t.addEventListener("load",function(){return i.loading|=1}),t.addEventListener("error",function(){return i.loading|=2})}function Xl(e){return'[src="'+Ln(e)+'"]'}function Ju(e){return"script[async]"+e}function _S(e,t,n){if(t.count++,t.instance===null)switch(t.type){case"style":var i=e.querySelector('style[data-href~="'+Ln(n.href)+'"]');if(i)return t.instance=i,gt(i),i;var r=Te({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return i=(e.ownerDocument||e).createElement("style"),gt(i),At(i,"style",r),pd(i,n.precedence,e),t.instance=i;case"stylesheet":r=Il(n.href);var o=e.querySelector(Qu(r));if(o)return t.state.loading|=4,t.instance=o,gt(o),o;i=wC(n),(r=Vn.get(r))&&gb(i,r),o=(e.ownerDocument||e).createElement("link"),gt(o);var s=o;return s._p=new Promise(function(l,a){s.onload=l,s.onerror=a}),At(o,"link",i),t.state.loading|=4,pd(o,n.precedence,e),t.instance=o;case"script":if(o=Xl(n.src),r=e.querySelector(Ju(o)))return t.instance=r,gt(r),r;if(i=n,r=Vn.get(o))i=Te({},n),vb(i,r);return e=e.ownerDocument||e,r=e.createElement("script"),gt(r),At(r,"link",i),e.head.appendChild(r),t.instance=r;case"void":return null;default:throw Error(A(443,t.type))}else t.type==="stylesheet"&&(t.state.loading&4)===0&&(i=t.instance,t.state.loading|=4,pd(i,n.precedence,e));return t.instance}function pd(e,t,n){for(var i=n.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),r=i.length?i[i.length-1]:null,o=r,s=0;s<i.length;s++){var l=i[s];if(l.dataset.precedence===t)o=l;else if(o!==r)break}o?o.parentNode.insertBefore(e,o.nextSibling):(t=n.nodeType===9?n.head:n,t.insertBefore(e,t.firstChild))}function gb(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.title==null&&(e.title=t.title)}function vb(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.integrity==null&&(e.integrity=t.integrity)}var md=null;function CS(e,t,n){if(md===null){var i=new Map,r=md=new Map;r.set(n,i)}else r=md,i=r.get(n),i||(i=new Map,r.set(n,i));if(i.has(e))return i;i.set(e,null),n=n.getElementsByTagName(e);for(r=0;r<n.length;r++){var o=n[r];if(!(o[qu]||o[_t]||e==="link"&&o.getAttribute("rel")==="stylesheet")&&o.namespaceURI!=="http://www.w3.org/2000/svg"){var s=o.getAttribute(t)||"";s=e+s;var l=i.get(s);l?l.push(o):i.set(s,[o])}}return i}function wv(e,t,n){e=e.ownerDocument||e,e.head.insertBefore(n,t==="title"?e.querySelector("head > title"):null)}function M4(e,t,n){if(n===1||t.itemProp!=null)return!1;switch(e){case"meta":case"title":return!0;case"style":if(typeof t.precedence!=="string"||typeof t.href!=="string"||t.href==="")break;return!0;case"link":if(typeof t.rel!=="string"||typeof t.href!=="string"||t.href===""||t.onLoad||t.onError)break;switch(t.rel){case"stylesheet":return e=t.disabled,typeof t.precedence==="string"&&e==null;default:return!0}case"script":if(t.async&&typeof t.async!=="function"&&typeof t.async!=="symbol"&&!t.onLoad&&!t.onError&&t.src&&typeof t.src==="string")return!0}return!1}function ES(e,t){return e==="img"&&t.src!=null&&t.src!==""&&t.onLoad==null&&t.loading!=="lazy"}function SC(e){return e.type==="stylesheet"&&(e.state.loading&3)===0?!1:!0}function kC(e){return(e.width||100)*(e.height||100)*(typeof devicePixelRatio==="number"?devicePixelRatio:1)*0.25}function OS(e,t){typeof t.decode==="function"&&(e.imgCount++,t.complete||(e.imgBytes+=kC(t),e.suspenseyImages.push(t)),e=L4.bind(e),t.decode().then(e,e))}function N4(e,t,n,i){if(n.type==="stylesheet"&&(typeof i.media!=="string"||matchMedia(i.media).matches!==!1)&&(n.state.loading&4)===0){if(n.instance===null){var r=Il(i.href),o=t.querySelector(Qu(r));if(o){t=o._p,t!==null&&typeof t==="object"&&typeof t.then==="function"&&(e.count++,e=Iu.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=o,gt(o);return}o=t.ownerDocument||t,i=wC(i),(r=Vn.get(r))&&gb(i,r),o=o.createElement("link"),gt(o);var s=o;s._p=new Promise(function(l,a){s.onload=l,s.onerror=a}),At(o,"link",i),n.instance=o}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(n,t),(t=n.state.preload)&&(n.state.loading&3)===0&&(e.count++,n=Iu.bind(e),t.addEventListener("load",n),t.addEventListener("error",n))}}var gd=0;function D4(e,t){return e.stylesheets&&e.count===0&&vd(e,e.stylesheets),0<e.count||0<e.imgCount?function(n){var i=setTimeout(function(){if(e.stylesheets&&vd(e,e.stylesheets),e.unsuspend){var o=e.unsuspend;e.unsuspend=null,o()}},60000+t);0<e.imgBytes&&gd===0&&(gd=62500*QB());var r=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&vd(e,e.stylesheets),e.unsuspend)){var o=e.unsuspend;e.unsuspend=null,o()}},(e.imgBytes>gd?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(i),clearTimeout(r)}}:null}function _C(e){if(e.count===0&&(e.imgCount===0||!e.waitingForImages)){if(e.stylesheets)vd(e,e.stylesheets);else if(e.unsuspend){var t=e.unsuspend;e.unsuspend=null,t()}}}function Iu(){this.count--,_C(this)}function L4(){this.imgCount--,_C(this)}var $d=null;function vd(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,$d=new Map,t.forEach(z4,e),$d=null,Iu.call(e))}function z4(e,t){if(!(t.state.loading&4)){var n=$d.get(e);if(n)var i=n.get(null);else{n=new Map,$d.set(e,n);for(var r=e.querySelectorAll("link[data-precedence],style[data-precedence]"),o=0;o<r.length;o++){var s=r[o];if(s.nodeName==="LINK"||s.getAttribute("media")!=="not all")n.set(s.dataset.precedence,s),i=s}i&&n.set(null,i)}r=t.instance,s=r.getAttribute("data-precedence"),o=n.get(s)||i,o===i&&n.set(null,r),n.set(s,r),this.count++,i=Iu.bind(this),r.addEventListener("load",i),r.addEventListener("error",i),o?o.parentNode.insertBefore(r,o.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(r,e.firstChild)),t.state.loading|=4}}var Vl={$$typeof:zi,Provider:null,Consumer:null,_currentValue:is,_currentValue2:is,_threadCount:0};function B4(e,t,n,i,r,o,s,l,a){this.tag=1,this.containerInfo=e,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=Vm(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Vm(0),this.hiddenUpdates=Vm(null),this.identifierPrefix=i,this.onUncaughtError=r,this.onCaughtError=o,this.onRecoverableError=s,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=a,this.transitionTypes=null,this.incompleteTransitions=new Map}function P4(e,t,n,i,r,o,s,l,a,u,c,f){return e=new B4(e,t,n,s,a,u,c,f,l),t=1,o===!0&&(t|=24),o=Zt(3,null,null,t),e.current=o,o.stateNode=e,t=Iv(),t.refCount++,e.pooledCache=t,t.refCount++,o.memoizedState={element:i,isDehydrated:n,cache:t},Uv(o),e}function I4(e){if(!e)return ml;return e=ml,e}function CC(e,t,n,i,r,o){r=I4(r),i.context===null?i.context=r:i.pendingContext=r,i=ls(t),i.payload={element:n},o=o===void 0?null:o,o!==null&&(i.callback=o),n=as(e,i,t),n!==null&&(en(n,e,t),gu(n,e,t))}function AS(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function bb(e,t){AS(e,t),(e=e.alternate)&&AS(e,t)}function EC(e){if(e.tag===13||e.tag===31){var t=ws(e,67108864);t!==null&&en(t,e,67108864),bb(e,67108864)}}function RS(e){if(e.tag===13||e.tag===31){var t=Pn();t=YS(t);var n=ws(e,t);n!==null&&en(n,e,t),bb(e,t)}}var Hl=!0;function V4(e,t,n,i){var r=ne.T;ne.T=null;var o=be.p;try{be.p=2,yb(e,t,n,i)}finally{be.p=o,ne.T=r}}function H4(e,t,n,i){var r=ne.T;ne.T=null;var o=be.p;try{be.p=8,yb(e,t,n,i)}finally{be.p=o,ne.T=r}}function yb(e,t,n,i){if(Hl){var r=Sv(i);if(r===null)lg(e,t,i,Xd,n),TS(e,i);else if(j4(r,e,t,n,i))i.stopPropagation();else if(TS(e,i),t&4&&-1<U4.indexOf(e)){for(;r!==null;){var o=jl(r);if(o!==null)switch(o.tag){case 3:if(o=o.stateNode,o.current.memoizedState.isDehydrated){var s=Qo(o.pendingLanes);if(s!==0){var l=o;l.pendingLanes|=2;for(l.entangledLanes|=2;s;){var a=1<<31-mn(s);l.entanglements[1]|=a,s&=~a}_r(o),(ve&6)===0&&(Ud=hn()+500,Wu(0,!1))}}break;case 31:case 13:l=ws(o,2),l!==null&&en(l,o,2),ch(),bb(o,2)}if(o=Sv(i),o===null&&lg(e,t,i,Xd,n),o===r)break;r=o}r!==null&&i.stopPropagation()}else lg(e,t,i,null,n)}}function Sv(e){return e=Rv(e),xb(e)}var Xd=null;function xb(e){if(Xd=null,e=ts(e),e!==null){var t=Uu(e);if(t===null)e=null;else{var n=t.tag;if(n===13){if(e=LS(t),e!==null)return e;e=null}else if(n===31){if(e=zS(t),e!==null)return e;e=null}else if(n===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null)}}return Xd=e,null}function OC(e){switch(e){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"fullscreenerror":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"resize":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(WL()){case US:return 2;case jS:return 8;case Sd:case QL:return 32;case KS:return 268435456;default:return 32}default:return 32}}var kv=!1,fo=null,ho=null,po=null,Vu=new Map,Hu=new Map,Zr=[],U4="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset".split(" ");function TS(e,t){switch(e){case"focusin":case"focusout":fo=null;break;case"dragenter":case"dragleave":ho=null;break;case"mouseover":case"mouseout":po=null;break;case"pointerover":case"pointerout":Vu.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":Hu.delete(t.pointerId)}}function nu(e,t,n,i,r,o){if(e===null||e.nativeEvent!==o)return e={blockedOn:t,domEventName:n,eventSystemFlags:i,nativeEvent:o,targetContainers:[r]},t!==null&&(t=jl(t),t!==null&&EC(t)),e;return e.eventSystemFlags|=i,t=e.targetContainers,r!==null&&t.indexOf(r)===-1&&t.push(r),e}function j4(e,t,n,i,r){switch(t){case"focusin":return fo=nu(fo,e,t,n,i,r),!0;case"dragenter":return ho=nu(ho,e,t,n,i,r),!0;case"mouseover":return po=nu(po,e,t,n,i,r),!0;case"pointerover":var o=r.pointerId;return Vu.set(o,nu(Vu.get(o)||null,e,t,n,i,r)),!0;case"gotpointercapture":return o=r.pointerId,Hu.set(o,nu(Hu.get(o)||null,e,t,n,i,r)),!0}return!1}function AC(e){var t=ts(e.target);if(t!==null){var n=Uu(t);if(n!==null){if(t=n.tag,t===13){if(t=LS(n),t!==null){e.blockedOn=t,r1(e.priority,function(){RS(n)});return}}else if(t===31){if(t=zS(n),t!==null){e.blockedOn=t,r1(e.priority,function(){RS(n)});return}}else if(t===3&&n.stateNode.current.memoizedState.isDehydrated){e.blockedOn=n.tag===3?n.stateNode.containerInfo:null;return}}}e.blockedOn=null}function bd(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=Sv(e.nativeEvent);if(n===null){n=e.nativeEvent;var i=new n.constructor(n.type,n);_g=i,n.target.dispatchEvent(i),_g=null}else return t=jl(n),t!==null&&EC(t),e.blockedOn=n,!1;t.shift()}return!0}function MS(e,t,n){bd(e)&&n.delete(t)}function K4(){kv=!1,fo!==null&&bd(fo)&&(fo=null),ho!==null&&bd(ho)&&(ho=null),po!==null&&bd(po)&&(po=null),Vu.forEach(MS),Hu.forEach(MS)}function Qf(e,t){e.blockedOn===t&&(e.blockedOn=null,kv||(kv=!0,Go(Xo,K4)))}var Jf=null;function NS(e){Jf!==e&&(Jf=e,Go(Xo,function(){Jf===e&&(Jf=null);for(var t=0;t<e.length;t+=3){var n=e[t],i=e[t+1],r=e[t+2];if(typeof i!=="function")if(xb(i||n)===null)continue;else break;var o=jl(n);o!==null&&(e.splice(t,3),t-=3,Hg(o,{pending:!0,data:r,method:n.method,action:i},i,r))}}))}function Ul(e){function t(a){return Qf(a,e)}fo!==null&&Qf(fo,e),ho!==null&&Qf(ho,e),po!==null&&Qf(po,e),Vu.forEach(t),Hu.forEach(t);for(var n=0;n<Zr.length;n++){var i=Zr[n];i.blockedOn===e&&(i.blockedOn=null)}for(;0<Zr.length&&(n=Zr[0],n.blockedOn===null);)AC(n),n.blockedOn===null&&Zr.shift();if(n=(e.ownerDocument||e).$$reactFormReplay,n!=null)for(i=0;i<n.length;i+=3){var r=n[i],o=n[i+1],s=r[nn]||null;if(typeof o==="function")s||NS(n);else if(s){var l=null;if(o&&o.hasAttribute("formAction")){if(r=o,s=o[nn]||null)l=s.formAction;else if(xb(r)!==null)continue}else l=s.action;typeof l==="function"?n[i+1]=l:(n.splice(i,3),i-=3),NS(n)}}}function F4(){function e(o){o.canIntercept&&o.info==="react-transition"&&o.intercept({handler:function(){return new Promise(function(s){return r=s})},focusReset:"manual",scroll:"manual"})}function t(){r!==null&&(r(),r=null),i||setTimeout(n,20)}function n(){if(!i&&!navigation.transition){var o=navigation.currentEntry;o&&o.url!=null&&navigation.navigate(o.url,{state:o.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation==="object"){var i=!1,r=null;return navigation.addEventListener("navigate",e),navigation.addEventListener("navigatesuccess",t),navigation.addEventListener("navigateerror",t),setTimeout(n,100),function(){i=!0,navigation.removeEventListener("navigate",e),navigation.removeEventListener("navigatesuccess",t),navigation.removeEventListener("navigateerror",t),r!==null&&(r(),r=null)}}}function wb(e){this._internalRoot=e}Sb.prototype.render=wb.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(A(409));var n=t.current,i=Pn();CC(n,i,e,t,null,null)};Sb.prototype.unmount=wb.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;CC(e.current,2,null,e,null,null),ch(),t[Fu]=null}};function Sb(e){this._internalRoot=e}Sb.prototype.unstable_scheduleHydration=function(e){if(e){var t=WS();e={blockedOn:null,target:e,priority:t};for(var n=0;n<Zr.length&&t!==0&&t<Zr[n].priority;n++);Zr.splice(n,0,e),n===0&&AC(e)}};var DS=Lf;if(DS!=="19.3.0")throw Error(A(527,DS,"19.3.0"));be.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0){if(typeof e.render==="function")throw Error(A(188));throw e=Object.keys(e).join(","),Error(A(268,e))}return e=VL(t),e=e!==null?BS(e):null,e=e===null?null:e.stateNode,e};var q4={bundleType:0,version:"19.3.0",rendererPackageName:"react-dom",currentDispatcherRef:ne,reconcilerVersion:"19.3.0"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){if(sl=__REACT_DEVTOOLS_GLOBAL_HOOK__,!sl.isDisabled&&sl.supportsFiber)try{ju=sl.inject(q4),pn=sl}catch(e){}}var sl;var kb=function(e,t){if(!IL(e))throw Error(A(299));var n=!1,i="",r=bB,o=yB,s=xB;return t!==null&&t!==void 0&&(t.unstable_strictMode===!0&&(n=!0),t.identifierPrefix!==void 0&&(i=t.identifierPrefix),t.onUncaughtError!==void 0&&(r=t.onUncaughtError),t.onCaughtError!==void 0&&(o=t.onCaughtError),t.onRecoverableError!==void 0&&(s=t.onRecoverableError)),t=P4(e,1,!1,null,null,n,i,null,r,o,s,F4),e[Fu]=t.current,rC(e),new wb(t)};RC();function Pe(e,...t){throw Error(`[MobX] minified error nr: ${e}${t.length?" "+t.map(String).join(","):""}. See mobx.js.org/errors`)}var{assign:Fi,getOwnPropertyDescriptor:Nb,defineProperty:Or,prototype:wh}=Object,Eb=[];Object.freeze(Eb);var KC={};Object.freeze(KC);var G4=Object.toString();var Yl=()=>{};function Ql(e){return typeof e==="function"}function Ob(e){switch(typeof e){case"string":case"symbol":case"number":return!0}return!1}function Sh(e){return e!==null&&typeof e==="object"}function Rr(e){if(!Sh(e))return!1;let t=Object.getPrototypeOf(e);if(t==null)return!0;let n=ks(t,"constructor")&&t.constructor;return typeof n==="function"&&n.toString()===G4}function FC(e){let t=e==null?void 0:e.constructor;if(!t)return!1;if(t.name==="GeneratorFunction"||t.displayName==="GeneratorFunction")return!0;return!1}function qC(e,t,n){Or(e,t,{enumerable:!1,writable:!0,configurable:!0,value:n})}function Y4(e,t,n){Or(e,t,{enumerable:!1,writable:!1,configurable:!0,value:n})}function Es(e,t){let n="isMobX"+e;return t.prototype[n]=!0,function(i){return Sh(i)&&i[n]===!0}}function ic(e){return e!=null&&Object.prototype.toString.call(e)==="[object Map]"}function W4(e){let t=Object.getPrototypeOf(e),n=Object.getPrototypeOf(t);return Object.getPrototypeOf(n)===null}function Zu(e){return e!=null&&Object.prototype.toString.call(e)==="[object Set]"}function Q4(e){let t=Object.keys(e),n=Object.getOwnPropertySymbols(e);if(!n.length)return t;return[...t,...n.filter((i)=>wh.propertyIsEnumerable.call(e,i))]}var gh=Reflect.ownKeys;function $C(e){return e===null?null:typeof e==="object"?""+e:e}function ks(e,t){return wh.hasOwnProperty.call(e,t)}var J4=Object.getOwnPropertyDescriptors;function bn(e,t){return!!(e&t)}function yn(e,t,n){if(n)e|=t;else e&=~t;return e}var oe=Symbol("mobx administration");class Zl{constructor(e="Atom"){this.name_=void 0,this.flags_=0,this.observers_=null,this.lastAccessedBy_=0,this.lowestObserverState_=-1,this.onBOL=void 0,this.onBUOL=void 0,this.name_=e}get isBeingObserved(){return bn(this.flags_,1)}set isBeingObserved(e){this.flags_=yn(this.flags_,1,e)}get isPendingUnobservation(){return bn(this.flags_,2)}set isPendingUnobservation(e){this.flags_=yn(this.flags_,2,e)}get diffValue(){return bn(this.flags_,4)?1:0}set diffValue(e){this.flags_=yn(this.flags_,4,e===1?!0:!1)}onBO(){if(this.onBOL)this.onBOL.forEach((e)=>e())}onBUO(){if(this.onBUOL)this.onBUOL.forEach((e)=>e())}reportObserved(){return gE(this)}reportChanged(){jn(),vE(this),Kn()}toString(){return this.name_}}var Db=Es("Atom",Zl);function XC(e,t=Yl,n=Yl){let i=new Zl(e);if(t!==Yl)i.onBOL=new Set([t]);if(n!==Yl)i.onBUOL=new Set([n]);return i}var Lb=Object.is;function _s(e,t,n){if(e===null||typeof e!=="object"&&typeof e!=="function")return e;if(TE(e))return e;if(Array.isArray(e))return Tt.array(e,{name:n});if(Rr(e))return Tt.object(e,void 0,{name:n});if(ic(e))return Tt.map(e,{name:n});if(Zu(e))return Tt.set(e,{name:n});if(typeof e==="function"&&!Jl(e)&&!tc(e))if(FC(e))return Oh(e);else return Ib(n,e);return e}function Z4(e,t,n){if(e===void 0||e===null)return e;if(nc(e)||NE(e)||na(e)||sc(e))return e;if(Array.isArray(e))return Tt.array(e,{name:n,deep:!1});if(Rr(e))return Tt.object(e,void 0,{name:n,deep:!1});if(ic(e))return Tt.map(e,{name:n,deep:!1});if(Zu(e))return Tt.set(e,{name:n,deep:!1})}function kh(e){return e}function _h(e,t){return{annotationType_:e,options_:t,make_:e3,extend_:t3}}function e3(e,t,n,i){var r;if((r=this.options_)!=null&&r.bound)return this.extend_(e,t,n,!1)===null?0:1;if(i===e.target_)return this.extend_(e,t,n,!1)===null?0:2;if(Jl(n.value))return 1;let o=YC(e,this,t,n,!1);return Or(i,t,o),2}function t3(e,t,n,i){let r=YC(e,this,t,n);return e.defineProperty_(t,r,i)}function GC(e,t,n){let{kind:i,name:r,addInitializer:o}=n,s=e,l=(u)=>{var c,f,d,h;return Cs((c=(f=s.options_)==null?void 0:f.name)!=null?c:r.toString(),u,(d=(h=s.options_)==null?void 0:h.autoAction)!=null?d:!1)};if(i=="field")return function(u){var c;let f=u;if(!Jl(f))f=l(f);if((c=s.options_)!=null&&c.bound)f=f.bind(this),f.isMobxAction=!0;return f};if(i=="method"){var a;if(!Jl(t))t=l(t);if((a=s.options_)!=null&&a.bound)o(function(){let u=this,c=u[r].bind(u);c.isMobxAction=!0,u[r]=c});return t}Pe(43,s.annotationType_,String(r),i)}function n3(e,{annotationType_:t},n,{value:i}){}function YC(e,t,n,i,r=F.safeDescriptors){var o,s,l,a,u,c,f;n3(e,t,n,i);let{value:d}=i;if((o=t.options_)!=null&&o.bound){var h;d=d.bind((h=e.proxy_)!=null?h:e.target_)}return{value:Cs((s=(l=t.options_)==null?void 0:l.name)!=null?s:n.toString(),d,(a=(u=t.options_)==null?void 0:u.autoAction)!=null?a:!1,(c=t.options_)!=null&&c.bound?(f=e.proxy_)!=null?f:e.target_:void 0),configurable:r?e.isPlainObject_:!0,enumerable:!1,writable:r?!1:!0}}function WC(e,t){return{annotationType_:e,options_:t,make_:i3,extend_:r3}}function i3(e,t,n,i){var r;if(i===e.target_)return this.extend_(e,t,n,!1)===null?0:2;if((r=this.options_)!=null&&r.bound&&(!ks(e.target_,t)||!tc(e.target_[t]))){if(this.extend_(e,t,n,!1)===null)return 0}if(tc(n.value))return 1;let o=JC(e,this,t,n,!1,!1);return Or(i,t,o),2}function r3(e,t,n,i){var r;let o=JC(e,this,t,n,(r=this.options_)==null?void 0:r.bound);return e.defineProperty_(t,o,i)}function QC(e,t,n){var i;let{name:r,addInitializer:o}=n;if(!tc(t))t=Oh(t);if((i=e.options_)!=null&&i.bound)o(function(){let s=this,l=s[r].bind(s);l.isMobXFlow=!0,s[r]=l});return t}function o3(e,{annotationType_:t},n,{value:i}){}function JC(e,t,n,i,r,o=F.safeDescriptors){o3(e,t,n,i);let{value:s}=i;if(!tc(s))s=Oh(s);if(r){var l;s=s.bind((l=e.proxy_)!=null?l:e.target_),s.isMobXFlow=!0}return{value:s,configurable:o?e.isPlainObject_:!0,enumerable:!1,writable:o?!1:!0}}function ZC(e,t){return{annotationType_:e,options_:t,make_:s3,extend_:l3}}function s3(e,t,n){return this.extend_(e,t,n,!1)===null?0:1}function l3(e,t,n,i){return a3(e,this,t,n),e.defineComputedProperty_(t,Fi({},this.options_,{get:n.get,set:n.set}),i)}function eE(e,t,n){let i=e,{name:r,addInitializer:o}=n,s;function l(a,u){let c=Fi({},i.options_,{get:t,context:a});return c.name||(c.name=`ObservableObject.${r.toString()}`),new Ar(c)}return o(function(){var a;let u=lc(this)[oe],c=this,f=u.values_.get(r);if(f instanceof Ar&&f.derivation!==t)u.values_.delete(r);((a=u.lazyComputedKeys_)!=null?a:u.lazyComputedKeys_=new Map).set(r,()=>l(c,u))}),function(){let a=this[oe],u=a.values_.get(r);if(u instanceof Ar&&u.derivation!==t){var c;let d=(c=s)==null?void 0:c.get(this);if(!d){var f;d=l(this,a),((f=s)!=null?f:s=new WeakMap).set(this,d)}return d.get()}return a.getObservablePropValue_(r)}}function a3(e,{annotationType_:t},n,{get:i}){}function zb(e,t){return{annotationType_:e,options_:t,make_:u3,extend_:c3}}function u3(e,t,n){return this.extend_(e,t,n,!1)===null?0:1}function c3(e,t,n,i){var r,o;return f3(e,this,t,n),e.defineObservableProperty_(t,n.value,(r=(o=this.options_)==null?void 0:o.enhancer_)!=null?r:_s,i)}function tE(e,t,n){let i=e,{kind:r,name:o}=n;if(r!=="accessor")return;function s(l,a){var u;let c=lc(l)[oe];return((u=c.lazyObservableKeys_)!=null?u:c.lazyObservableKeys_=new Map).set(o,()=>{var f,d;return new ko(a,(f=(d=i.options_)==null?void 0:d.enhancer_)!=null?f:_s,`ObservableObject.${o.toString()}`,!1)}),c}return{get(){var l;return((l=this[oe])!=null?l:s(this,t.get.call(this))).getObservablePropValue_(o)},set(l){var a;return((a=this[oe])!=null?a:s(this,l)).setObservablePropValue_(o,l)},init(l){return s(this,l),l}}}function f3(e,{annotationType_:t},n,i){}var d3="true",h3=nE();function nE(e){return{annotationType_:d3,options_:e,make_:p3,extend_:m3}}function p3(e,t,n,i){var r,o;if(n.get)return Bb.make_(e,t,n,i);if(n.set){let c=Jl(n.set)?n.set:Cs(t.toString(),n.set);if(i===e.target_)return e.defineProperty_(t,{configurable:F.safeDescriptors?e.isPlainObject_:!0,set:c})===null?0:2;return Or(i,t,{configurable:!0,set:c}),2}if(i!==e.target_&&typeof n.value==="function"){var s;if(FC(n.value)){var l;return((l=this.options_)!=null&&l.autoBind?J3:Oh).make_(e,t,n,i)}return((s=this.options_)!=null&&s.autoBind?q3:Ib).make_(e,t,n,i)}let a=((r=this.options_)==null?void 0:r.deep)===!1?ea:Tt;if(typeof n.value==="function"&&(o=this.options_)!=null&&o.autoBind){var u;n.value=n.value.bind((u=e.proxy_)!=null?u:e.target_)}return a.make_(e,t,n,i)}function m3(e,t,n,i){var r,o;if(n.get)return Bb.extend_(e,t,n,i);if(n.set)return e.defineProperty_(t,{configurable:F.safeDescriptors?e.isPlainObject_:!0,set:Cs(t.toString(),n.set)},i);if(typeof n.value==="function"&&(r=this.options_)!=null&&r.autoBind){var s;n.value=n.value.bind((s=e.proxy_)!=null?s:e.target_)}return(((o=this.options_)==null?void 0:o.deep)===!1?ea:Tt).extend_(e,t,n,i)}function Ch(e,t){return Fi(function(i,r){if(r&&typeof r.kind==="string")return t(e,i,r);return},e)}var g3="observable",v3="observable.ref",b3="observable.shallow";var iE={deep:!0,name:void 0,defaultDecorator:void 0};Object.freeze(iE);function hh(e){return e||iE}var rE=zb(g3),y3=zb(v3,{enhancer_:kh}),x3=zb(b3,{enhancer_:Z4});function oE(e){return Ch(e,tE)}function ph(e){return e.deep===!0?_s:e.deep===!1?kh:S3(e.defaultDecorator)}function w3(e){var t;return e?(t=e.defaultDecorator)!=null?t:nE(e):void 0}function S3(e){var t,n;return!e?_s:(t=(n=e.options_)==null?void 0:n.enhancer_)!=null?t:_s}function k3(e,t,n){if(t&&typeof t.kind==="string")return tE(rE,e,t);if(TE(e))return e;if(Rr(e))return Tt.object(e,t,n);if(Array.isArray(e))return Tt.array(e,t);if(ic(e))return Tt.map(e,t);if(Zu(e))return Tt.set(e,t);if(typeof e==="object"&&e!==null)return e;return Tt.box(e,t)}var _3={box(e,t){let n=hh(t);return new ko(e,ph(n),n.name,!0,n.equals)},array(e,t){let n=hh(t);return o5(e,ph(n),n.name)},map(e,t){let n=hh(t);return new Hb(e,ph(n),n.name)},set(e,t){let n=hh(t);return new Ub(e,ph(n),n.name)},object(e,t,n){return ia(()=>EE(t5({},n),e,t))}},ea=oE(y3),rc=oE(x3);var Tt=Fi(k3,rE,_3),sE="computed";function C3(e){return Ch(e,eE)}var lE=ZC(sE);var Bb=function(t,n){if(n&&typeof n.kind==="string")return eE(lE,t,n);if(Rr(t))return C3(ZC(sE,t));let i=Rr(n)?n:{};return i.get=t,i.name||(i.name=t.name||""),new Ar(i)};Fi(Bb,lE);var TC,MC,vh=0,E3=1,O3=(TC=(MC=Nb(()=>{},"name"))==null?void 0:MC.configurable)!=null?TC:!1,NC={value:"action",configurable:!0,writable:!1,enumerable:!1};function Cs(e,t,n=!1,i){function r(){return aE(e,n,t,i||this,arguments)}if(r.isMobxAction=!0,r.toString=()=>t.toString(),O3)NC.value=e,Or(r,"name",NC);return r}function aE(e,t,n,i,r){let o=A3(e,t,i,r);try{return n.apply(i,r)}catch(s){throw o.error_=s,s}finally{R3(o)}}function A3(e,t,n,i){let o=0,s=F.trackingDerivation,l=!t||!s;jn();let a=F.allowStateChanges;if(l)ta();let u=F.allowStateReads,c={runAsAction_:l,prevDerivation_:s,prevAllowStateChanges_:a,prevAllowStateReads_:u,notifySpy_:!1,startTime_:o,actionId_:E3++,parentActionId_:vh};return vh=c.actionId_,c}function R3(e){if(vh!==e.actionId_)Pe(30);if(vh=e.parentActionId_,e.error_!==void 0)F.suppressReactionErrors=!0;if(Kn(),e.runAsAction_)_o(e.prevDerivation_);F.suppressReactionErrors=!1}function T3(e,t){let n=M3(e);try{return t()}finally{N3(n)}}function M3(e){let t=F.allowStateChanges;return F.allowStateChanges=e,t}function N3(e){F.allowStateChanges=e}class ko extends Zl{constructor(e,t,n="ObservableValue",i=!0,r=Lb){super(n);if(this.enhancer_=void 0,this.name_=void 0,this.equals_=void 0,this.hasUnreportedChange_=!1,this.interceptors_=void 0,this.changeListeners_=void 0,this.value_=void 0,this.dehancer=void 0,this.enhancer_=t,this.name_=n,this.equals_=r,this.value_=t(e,void 0,n),!1)var o}dehanceValue(e){if(this.dehancer!==void 0)return this.dehancer(e);return e}set(e){let t=this.value_;if(e=this.prepareNewValue_(e),e!==F.UNCHANGED)this.setNewValue_(e)}prepareNewValue_(e){if(Ki(this),Hn(this)){let t=Un(this,{object:this,type:Co,newValue:e});if(!t)return F.UNCHANGED;e=t.newValue}return e=this.enhancer_(e,this.value_,this.name_),this.equals_(this.value_,e)?F.UNCHANGED:e}setNewValue_(e){let t=this.value_;if(this.value_=e,this.reportChanged(),ai(this))ui(this,{type:Co,object:this,newValue:e,oldValue:t})}get(){return this.reportObserved(),this.dehanceValue(this.value_)}raw(){return this.value_}toJSON(){return this.get()}toString(){return`${this.name_}[${this.value_}]`}valueOf(){return $C(this.get())}[Symbol.toPrimitive](){return this.valueOf()}}class Ar{constructor(e){if(this.dependenciesState_=-1,this.observing_=[],this.newObserving_=null,this.observers_=null,this.runId_=0,this.lastAccessedBy_=0,this.lowestObserverState_=0,this.unboundDepsCount_=0,this.value_=new ec(null),this.name_=void 0,this.triggeredBy_=void 0,this.flags_=0,this.derivation=void 0,this.setter_=void 0,this.scope_=void 0,this.equals_=void 0,this.requiresReaction_=void 0,this.keepAlive_=void 0,this.onBOL=void 0,this.onBUOL=void 0,!e.get)Pe(31);if(this.derivation=e.get,this.name_=e.name||"ComputedValue",e.set)this.setter_=Cs("ComputedValue-setter",e.set);this.equals_=e.equals||Lb,this.scope_=e.context,this.requiresReaction_=e.requiresReaction,this.keepAlive_=!!e.keepAlive}onBecomeStale_(){V3(this)}onBO(){if(this.onBOL)this.onBOL.forEach((e)=>e())}onBUO(){if(this.onBUOL)this.onBUOL.forEach((e)=>e())}get isComputing(){return bn(this.flags_,1)}set isComputing(e){this.flags_=yn(this.flags_,1,e)}get isRunningSetter(){return bn(this.flags_,2)}set isRunningSetter(e){this.flags_=yn(this.flags_,2,e)}get isBeingObserved(){return bn(this.flags_,4)}set isBeingObserved(e){this.flags_=yn(this.flags_,4,e)}get isPendingUnobservation(){return bn(this.flags_,8)}set isPendingUnobservation(e){this.flags_=yn(this.flags_,8,e)}get diffValue(){return bn(this.flags_,16)?1:0}set diffValue(e){this.flags_=yn(this.flags_,16,e===1?!0:!1)}get(){if(this.isComputing)Pe(32,this.name_,this.derivation);if(F.inBatch===0&&(!this.observers_||this.observers_.size===0)&&!this.keepAlive_){if(Ab(this))this.warnAboutUntrackedRead_(),jn(),this.value_=this.computeValue_(!1),Kn()}else{let t=this.isBeingObserved;if(gE(this),Ab(this)){let n=F.trackingContext;if(!n&&(this.keepAlive_||this.isBeingObserved))F.trackingContext=this;if(this.trackAndCompute())I3(this);F.trackingContext=n}else if(!t&&this.isBeingObserved)this.observing_.forEach(mE)}let e=this.value_;if(mh(e))throw e.cause;return e}set(e){if(this.setter_){if(this.isRunningSetter)Pe(33,this.name_);this.isRunningSetter=!0;try{this.setter_.call(this.scope_,e)}finally{this.isRunningSetter=!1}}else Pe(34,this.name_)}trackAndCompute(){let e=this.value_,t=this.dependenciesState_===-1,n=this.computeValue_(!0),i=t||mh(e)||mh(n)||!this.equals_(e,n);if(i)this.value_=n;return i}computeValue_(e){this.isComputing=!0;let t=!1,n;if(e)n=uE(this,this.derivation,this.scope_);else if(F.disableErrorBoundaries===!0)n=this.derivation.call(this.scope_);else try{n=this.derivation.call(this.scope_)}catch(i){n=new ec(i)}return this.isComputing=!1,n}suspend_(){if(!this.keepAlive_)Rb(this),this.value_=void 0}warnAboutUntrackedRead_(){return}toString(){return`${this.name_}[${this.derivation.toString()}]`}valueOf(){return $C(this.get())}[Symbol.toPrimitive](){return this.valueOf()}}var Eh=Es("ComputedValue",Ar);class ec{constructor(e){this.cause=void 0,this.cause=e}}function mh(e){return e instanceof ec}function Ab(e){switch(e.dependenciesState_){case 0:return!1;case-1:case 2:return!0;case 1:{let n=ta(),i=e.observing_,r=i.length;for(let o=0;o<r;o++){let s=i[o];if(Eh(s)){if(F.disableErrorBoundaries)s.get();else try{s.get()}catch(l){return _o(n),!0}if(e.dependenciesState_===2)return _o(n),!0}}return fE(e),_o(n),!1}}}function Ki(e){return}function D3(e){}function uE(e,t,n){fE(e),e.newObserving_=Array(e.runId_===0?100:e.observing_.length),e.unboundDepsCount_=0,e.runId_=++F.runId;let r=F.trackingDerivation;F.trackingDerivation=e,F.inBatch++;let o;if(F.disableErrorBoundaries===!0)o=t.call(n);else try{o=t.call(n)}catch(s){o=new ec(s)}return F.inBatch--,F.trackingDerivation=r,z3(e),L3(e),o}function L3(e){return}function z3(e){let t=e.observing_,n=e.observing_=e.newObserving_,i=0,r=0,o=e.unboundDepsCount_;for(let s=0;s<o;s++){let l=n[s];if(l.diffValue===0){if(l.diffValue=1,r!==s)n[r]=l;r++}if(l.dependenciesState_>i)i=l.dependenciesState_}n.length=r,e.newObserving_=null,o=t.length;while(o--){let s=t[o];if(s.diffValue===0)hE(s,e);s.diffValue=0}while(r--){let s=n[r];if(s.diffValue===1)s.diffValue=0,P3(s,e)}if(i!==0)e.dependenciesState_=i,e.onBecomeStale_()}function Rb(e){let t=e.observing_;e.observing_=[];let n=t.length;while(n--)hE(t[n],e);e.dependenciesState_=-1}function cE(e){let t=ta();try{return e()}finally{_o(t)}}function ta(){let e=F.trackingDerivation;return F.trackingDerivation=null,e}function _o(e){F.trackingDerivation=e}function fE(e){if(e.dependenciesState_===0)return;e.dependenciesState_=0;let t=e.observing_,n=t.length;while(n--)t[n].lowestObserverState_=0}var dE=7;class Tb{constructor(){this.version=dE,this.UNCHANGED={},this.trackingDerivation=null,this.trackingContext=null,this.runId=0,this.mobxGuid=0,this.inBatch=0,this.pendingUnobservations=[],this.pendingReactions=[],this.isRunningReactions=!1,this.isRunningUnobservations=!1,this.allowStateChanges=!1,this.allowStateReads=!0,this.enforceActions=!0,this.spyListeners=[],this.globalReactionErrorHandlers=[],this.computedRequiresReaction=!1,this.reactionRequiresObservable=!1,this.observableRequiresReaction=!1,this.disableErrorBoundaries=!1,this.suppressReactionErrors=!1,this.safeDescriptors=!0}}var _b=!0,B3=!1,F=function(){let e=globalThis;if(e.__mobxInstanceCount>0&&!e.__mobxGlobals)_b=!1;if(e.__mobxGlobals&&e.__mobxGlobals.version!==dE)_b=!1;if(!_b)return setTimeout(()=>{if(!B3)Pe(35)},1),new Tb;else if(e.__mobxGlobals){if(e.__mobxInstanceCount+=1,!e.__mobxGlobals.UNCHANGED)e.__mobxGlobals.UNCHANGED={};return e.__mobxGlobals}else return e.__mobxInstanceCount=1,e.__mobxGlobals=new Tb}();function Pb(){return F}function P3(e,t){var n;if(((n=e.observers_)!=null?n:e.observers_=new Set).add(t),e.lowestObserverState_>t.dependenciesState_)e.lowestObserverState_=t.dependenciesState_}function hE(e,t){let n=e.observers_;if(!n)return;if(n.delete(t),n.size===0)pE(e)}function pE(e){if(e.isPendingUnobservation===!1)e.isPendingUnobservation=!0,F.pendingUnobservations.push(e)}function jn(){F.inBatch++}function Kn(){if(--F.inBatch===0){if(bE(),!F.isRunningUnobservations){F.isRunningUnobservations=!0;try{let e=F.pendingUnobservations;for(let t=0;t<e.length;t++){let n=e[t];if(n.isPendingUnobservation=!1,!n.observers_||n.observers_.size===0){if(n.isBeingObserved)n.isBeingObserved=!1,n.onBUO();if(n instanceof Ar)n.suspend_()}}F.pendingUnobservations=[]}finally{F.isRunningUnobservations=!1}}}}function mE(e){var t;if(e.isBeingObserved)return;e.isBeingObserved=!0,e.onBO(),(t=e.observing_)==null||t.forEach(mE)}function gE(e){D3(e);let t=F.trackingDerivation;if(t!==null){if(t.runId_!==e.lastAccessedBy_){if(e.lastAccessedBy_=t.runId_,t.newObserving_[t.unboundDepsCount_++]=e,!e.isBeingObserved&&F.trackingContext)e.isBeingObserved=!0,e.onBO()}return e.isBeingObserved}else if((!e.observers_||e.observers_.size===0)&&F.inBatch>0)pE(e);return!1}function vE(e){var t;if(e.lowestObserverState_===2)return;e.lowestObserverState_=2,(t=e.observers_)==null||t.forEach((n)=>{if(n.dependenciesState_===0)n.onBecomeStale_();n.dependenciesState_=2})}function I3(e){var t;if(e.lowestObserverState_===2)return;e.lowestObserverState_=2,(t=e.observers_)==null||t.forEach((n)=>{if(n.dependenciesState_===1)n.dependenciesState_=2;else if(n.dependenciesState_===0)e.lowestObserverState_=0})}function V3(e){var t;if(e.lowestObserverState_!==0)return;e.lowestObserverState_=1,(t=e.observers_)==null||t.forEach((n)=>{if(n.dependenciesState_===0)n.dependenciesState_=1,n.onBecomeStale_()})}class oc{constructor(e="Reaction",t,n,i){this.name_=void 0,this.onInvalidate_=void 0,this.errorHandler_=void 0,this.requiresObservable_=void 0,this.observing_=[],this.newObserving_=[],this.dependenciesState_=-1,this.runId_=0,this.unboundDepsCount_=0,this.flags_=0,this.name_=e,this.onInvalidate_=t,this.errorHandler_=n,this.requiresObservable_=i}get isDisposed(){return bn(this.flags_,1)}set isDisposed(e){this.flags_=yn(this.flags_,1,e)}get isScheduled(){return bn(this.flags_,2)}set isScheduled(e){this.flags_=yn(this.flags_,2,e)}get isTrackPending(){return bn(this.flags_,4)}set isTrackPending(e){this.flags_=yn(this.flags_,4,e)}get isRunning(){return bn(this.flags_,8)}set isRunning(e){this.flags_=yn(this.flags_,8,e)}get diffValue(){return bn(this.flags_,16)?1:0}set diffValue(e){this.flags_=yn(this.flags_,16,e===1?!0:!1)}onBecomeStale_(){this.schedule_()}schedule_(){if(!this.isScheduled)this.isScheduled=!0,F.pendingReactions.push(this),bE()}runReaction_(){if(!this.isDisposed){jn(),this.isScheduled=!1;let e=F.trackingContext;if(F.trackingContext=this,Ab(this)){this.isTrackPending=!0;try{this.onInvalidate_()}catch(t){this.reportExceptionInDerivation_(t)}}F.trackingContext=e,Kn()}}track(e){if(this.isDisposed)return;jn();let t=!1,n;this.isRunning=!0;let i=F.trackingContext;F.trackingContext=this;let r=uE(this,e,void 0);if(F.trackingContext=i,this.isRunning=!1,this.isTrackPending=!1,this.isDisposed)Rb(this);if(mh(r))this.reportExceptionInDerivation_(r.cause);Kn()}reportExceptionInDerivation_(e){if(this.errorHandler_){this.errorHandler_(e,this);return}if(F.disableErrorBoundaries)throw e;let t=`[mobx] uncaught error in '${this}'`;if(!F.suppressReactionErrors)console.error(t,e);F.globalReactionErrorHandlers.forEach((n)=>n(e,this))}dispose(){if(!this.isDisposed){if(this.isDisposed=!0,!this.isRunning)jn(),Rb(this),Kn()}}getDisposer_(e){let t=()=>{this.dispose(),e==null||e.removeEventListener==null||e.removeEventListener("abort",t)};if(e==null||e.addEventListener==null||e.addEventListener("abort",t),t[oe]=this,"dispose"in Symbol&&typeof Symbol.dispose==="symbol")t[Symbol.dispose]=t;return t}toString(){return`Reaction[${this.name_}]`}}var H3=100,U3=(e)=>e();function bE(){if(F.inBatch>0||F.isRunningReactions)return;U3(j3)}function j3(){F.isRunningReactions=!0;let e=F.pendingReactions,t=0;while(e.length>0){if(++t===H3)console.error(`[mobx] cycle in reaction: ${e[0]}`),e.splice(0);let n=e.splice(0);for(let i=0,r=n.length;i<r;i++)n[i].runReaction_()}F.isRunningReactions=!1}var bh=Es("Reaction",oc);var yE="action";var xE="autoAction",K3="autoAction.bound",wE="<unnamed action>",SE=_h(yE);var kE=_h(xE,{autoAction:!0}),F3=_h(K3,{autoAction:!0,bound:!0});function _E(e){return Ch(e,GC)}function CE(e){return function(i,r){if(r&&typeof r.kind==="string")return GC(e?kE:SE,i,r);if(Ql(i))return Cs(i.name||wE,i,e);if(Ql(r))return Cs(i,r,e);if(Ob(i))return _E(_h(e?xE:yE,{name:i,autoAction:e}))}}var Wl=CE(!1);Fi(Wl,SE);var Ib=CE(!0);Fi(Ib,kE);var q3=_E(F3);function M(e){return aE(e.name||wE,!1,e,this,void 0)}function Jl(e){return Ql(e)&&e.isMobxAction===!0}var $3=(e)=>e();function X3(e){return e.scheduler?e.scheduler:e.delay?(t)=>setTimeout(t,e.delay):$3}function Tr(e,t,n=KC){var i,r;let o=(i=n.name)!=null?i:"Reaction",s=Wl(o,n.onError?G3(n.onError,t):t),l=!n.scheduler&&!n.delay,a=X3(n),u=!0,c=!1,f,d=n.equals||Lb,h=new oc(o,()=>{if(u||l)m();else if(!c)c=!0,a(m)},n.onError,n.requiresObservable);function m(){if(c=!1,h.isDisposed)return;let b=!1,x=f;if(h.track(()=>{let g=T3(!1,()=>e(h));b=u||!d(f,g),f=g}),u&&n.fireImmediately)s(f,x,h);else if(!u&&b)s(f,x,h);u=!1}if(!(n!=null&&(r=n.signal)!=null&&r.aborted))h.schedule_();return h.getDisposer_(n==null?void 0:n.signal)}function G3(e,t){return function(){try{return t.apply(this,arguments)}catch(n){e.call(this,n)}}}function EE(e,t,n,i){let r=J4(t);return ia(()=>{let o=lc(e,i)[oe];gh(r).forEach((s)=>{o.extend_(s,r[s],!n?!0:(s in n)?n[s]:!0)})}),e}function OE(e,t){return AE(xh(e,t))}function AE(e){let t={name:e.name_};if(e.observing_&&e.observing_.length>0)t.dependencies=Y3(e.observing_).map(AE);return t}function Y3(e){return Array.from(new Set(e))}class RE extends Error{constructor(){super("FLOW_CANCELLED");Object.setPrototypeOf(this,new.target.prototype),this.name="FlowCancellationError"}toString(){return`Error: ${this.message}`}}function W3(e){return Ch(e,QC)}var DC=WC("flow"),Q3=WC("flow.bound",{bound:!0}),Oh=Fi(function(t,n){if(n&&typeof n.kind==="string")return QC(DC,t,n);let i=t,r=i.name||"flow",o=function(){let l=this,a=arguments,u=0,c=Wl(r,i).apply(l,a),f,d=void 0,h=new Promise(function(b,x){let g=0;f=x;function v(k){d=void 0;let E;try{E=Wl(r,c.next).call(c,k)}catch(_){return x(_)}S(E)}function w(k){d=void 0;let E;try{E=Wl(r,c.throw).call(c,k)}catch(_){return x(_)}S(E)}function S(k){if(Ql(k==null?void 0:k.then)){k.then(S,x);return}if(k.done)return b(k.value);return d=Promise.resolve(k.value),d.then(v,w)}v(void 0)}),m=r;return h.cancel=Wl(m,function(){try{if(d)LC(d);let b=c.return(void 0),x=Promise.resolve(b.value);x.then(Yl,Yl),LC(x),f(new RE)}catch(b){f(b)}}),h};return o.isMobXFlow=!0,o},DC),J3=W3(Q3);function LC(e){if(Ql(e.cancel))e.cancel()}function tc(e){return(e==null?void 0:e.isMobXFlow)===!0}function Z3(e,t){if(!e)return!1;if(t!==void 0){if(nc(e)){var n,i;let r=e[oe];return r.values_.has(t)||!!((n=r.lazyComputedKeys_)!=null&&n.has(t))||!!((i=r.lazyObservableKeys_)!=null&&i.has(t))}return!1}return nc(e)||!!e[oe]||Db(e)||bh(e)||Eh(e)}function TE(e){return Z3(e)}function Er(e,t=void 0){jn();try{return e.apply(t)}finally{Kn()}}function Gl(e){return e[oe]}var e5={has(e,t){return Gl(e).has_(t)},get(e,t){return Gl(e).get_(t)},set(e,t,n){var i;if(!Ob(t))return!1;return(i=Gl(e).set_(t,n,!0))!=null?i:!0},deleteProperty(e,t){var n;if(!Ob(t))return!1;return(n=Gl(e).delete_(t,!0))!=null?n:!0},defineProperty(e,t,n){var i;return(i=Gl(e).defineProperty_(t,n))!=null?i:!0},ownKeys(e){return Gl(e).ownKeys_()},preventExtensions(e){Pe(13)}};function t5(e,t){var n,i;return e=lc(e,t),(i=(n=e[oe]).proxy_)!=null?i:n.proxy_=new Proxy(e,e5)}function Hn(e){return e.interceptors_!==void 0&&e.interceptors_.length>0}function Un(e,t){let n=ta();try{let i=[...e.interceptors_||[]];for(let r=0,o=i.length;r<o;r++){if(t=i[r](t),t&&!t.type)Pe(14);if(!t)break}return t}finally{_o(n)}}function ai(e){return e.changeListeners_!==void 0&&e.changeListeners_.length>0}function ui(e,t){let n=ta(),i=e.changeListeners_;if(!i)return;i=i.slice();for(let r=0,o=i.length;r<o;r++)i[r](t);_o(n)}var Cb=Symbol("mobx-keys");function ci(e,t,n){if(Rr(e))return EE(e,e,t,n);return ia(()=>{let i=lc(e,n)[oe];if(!e[Cb]){let r=Object.getPrototypeOf(e),o=new Set([...gh(e),...gh(r)]);o.delete("constructor"),o.delete(oe),qC(r,Cb,o)}e[Cb].forEach((r)=>n5(i,r,!t?!0:(r in t)?t[r]:!0))}),e}function n5(e,t,n){if(n===!0)n=e.defaultAnnotation_;if(n===!1)return;if(LE(e,n,t),!(t in e.target_))Pe(1,n.annotationType_,`${e.name_}.${t.toString()}`);let i=e.target_;while(i&&i!==wh){let r=Nb(i,t);if(r){let o=n.make_(e,t,r,i);if(o===0)return;if(o===1)break}i=Object.getPrototypeOf(i)}DE(e,n,t)}var zC="splice",Co="update",i5=1e4,r5={get(e,t){let n=e[oe];if(t===oe)return n;if(t==="length")return n.getArrayLength_();if(typeof t==="string"&&!isNaN(t))return n.get_(parseInt(t));if(ks(Mb,t))return Mb[t];return e[t]},set(e,t,n){let i=e[oe];if(t==="length")i.setArrayLength_(n);if(typeof t==="symbol"||isNaN(t))e[t]=n;else i.set_(parseInt(t),n);return!0},preventExtensions(){Pe(15)}};class Vb{constructor(e="ObservableArray",t,n){this.owned_=void 0,this.atom_=void 0,this.values_=[],this.interceptors_=void 0,this.changeListeners_=void 0,this.enhancer_=void 0,this.dehancer=void 0,this.proxy_=void 0,this.lastKnownLength_=0,this.owned_=n,this.atom_=new Zl(e),this.enhancer_=(i,r)=>t(i,r,"ObservableArray[..]")}dehanceValue_(e){if(this.dehancer!==void 0)return this.dehancer(e);return e}dehanceValues_(e){if(this.dehancer!==void 0&&e.length>0)return e.map(this.dehancer);return e}getArrayLength_(){return this.atom_.reportObserved(),this.values_.length}setArrayLength_(e){if(typeof e!=="number"||isNaN(e)||e<0)Pe(40,e);let t=this.values_.length;if(e===t)return;else if(e>t){let n=Array.from({length:e-t});this.spliceWithArray_(t,0,n)}else this.spliceWithArray_(e,t-e)}updateArrayLength_(e,t){if(e!==this.lastKnownLength_)Pe(16);this.lastKnownLength_+=t}spliceWithArray_(e,t,n){Ki(this.atom_);let i=this.values_.length;if(e===void 0)e=0;else if(e>i)e=i;else if(e<0)e=Math.max(0,i+e);if(arguments.length===1)t=i-e;else if(t===void 0||t===null)t=0;else t=Math.max(0,Math.min(t,i-e));if(n===void 0)n=Eb;if(Hn(this)){let o=Un(this,{object:this.proxy_,type:zC,index:e,removedCount:t,added:n});if(!o)return Eb;t=o.removedCount,n=o.added}n=n.length===0?n:n.map((o)=>this.enhancer_(o,void 0));let r=this.spliceItemsIntoValues_(e,t,n);if(t!==0||n.length!==0)this.notifyArraySplice_(e,n,r);return this.dehanceValues_(r)}spliceItemsIntoValues_(e,t,n){if(n.length<i5)return this.values_.splice(e,t,...n);else{let i=this.values_.slice(e,e+t),r=this.values_.slice(e+t);this.values_.length+=n.length-t;for(let o=0;o<n.length;o++)this.values_[e+o]=n[o];for(let o=0;o<r.length;o++)this.values_[e+n.length+o]=r[o];return i}}notifyArrayChildUpdate_(e,t,n){let r=ai(this),o=r?{observableKind:"array",object:this.proxy_,type:Co,debugObjectName:this.atom_.name_,index:e,newValue:t,oldValue:n}:null;if(this.atom_.reportChanged(),r)ui(this,o)}notifyArraySplice_(e,t,n){let r=ai(this),o=r?{observableKind:"array",object:this.proxy_,debugObjectName:this.atom_.name_,type:zC,index:e,removed:n,added:t,removedCount:n.length,addedCount:t.length}:null;if(this.atom_.reportChanged(),r)ui(this,o)}get_(e){return this.atom_.reportObserved(),this.dehanceValue_(this.values_[e])}set_(e,t){let n=this.values_;if(e<n.length){Ki(this.atom_);let i=n[e];if(Hn(this)){let o=Un(this,{type:Co,object:this.proxy_,index:e,newValue:t});if(!o)return;t=o.newValue}if(t=this.enhancer_(t,i),t!==i)n[e]=t,this.notifyArrayChildUpdate_(e,t,i)}else{let i=Array.from({length:e+1-n.length});i[i.length-1]=t,this.spliceWithArray_(n.length,0,i)}}}function o5(e,t,n="ObservableArray",i=!1){return ia(()=>{let r=new Vb(n,t,i);Y4(r.values_,oe,r);let o=new Proxy(r.values_,r5);if(r.proxy_=o,e&&e.length)r.spliceWithArray_(0,0,e);return o})}var Mb={clear(){return this.splice(0)},replace(e){let t=this[oe];return t.spliceWithArray_(0,t.values_.length,e)},toJSON(){return this.slice()},splice(e,t,...n){let i=this[oe];switch(arguments.length){case 0:return[];case 1:return i.spliceWithArray_(e);case 2:return i.spliceWithArray_(e,t)}return i.spliceWithArray_(e,t,n)},spliceWithArray(e,t,n){return this[oe].spliceWithArray_(e,t,n)},push(...e){let t=this[oe];return t.spliceWithArray_(t.values_.length,0,e),t.values_.length},pop(){return this.splice(Math.max(this[oe].values_.length-1,0),1)[0]},shift(){return this.splice(0,1)[0]},unshift(...e){let t=this[oe];return t.spliceWithArray_(0,0,e),t.values_.length},reverse(){if(F.trackingDerivation)Pe(37,"reverse");return this.replace(this.slice().reverse()),this},sort(){if(F.trackingDerivation)Pe(37,"sort");let e=this.slice();return e.sort.apply(e,arguments),this.replace(e),this},remove(e){let t=this[oe],n=t.dehanceValues_(t.values_).indexOf(e);if(n>-1)return this.splice(n,1),!0;return!1}};Ie("at",xn);Ie("concat",xn);Ie("flat",xn);Ie("includes",xn);Ie("indexOf",xn);Ie("join",xn);Ie("lastIndexOf",xn);Ie("slice",xn);Ie("toString",xn);Ie("toLocaleString",xn);Ie("toSorted",xn);Ie("toSpliced",xn);Ie("with",xn);Ie("every",fi);Ie("filter",fi);Ie("find",fi);Ie("findIndex",fi);Ie("findLast",fi);Ie("findLastIndex",fi);Ie("flatMap",fi);Ie("forEach",fi);Ie("map",fi);Ie("some",fi);Ie("toReversed",fi);Ie("reduce",ME);Ie("reduceRight",ME);function Ie(e,t){if(typeof Array.prototype[e]==="function")Mb[e]=t(e)}function xn(e){return function(){let t=this[oe];t.atom_.reportObserved();let n=t.dehanceValues_(t.values_);return n[e].apply(n,arguments)}}function fi(e){return function(t,n){let i=this[oe];return i.atom_.reportObserved(),i.dehanceValues_(i.values_)[e]((o,s)=>t.call(n,o,s,this))}}function ME(e){return function(){let t=this[oe];t.atom_.reportObserved();let n=t.dehanceValues_(t.values_),i=arguments[0];return arguments[0]=(r,o,s)=>i(r,o,s,this),n[e].apply(n,arguments)}}var s5=Es("ObservableArrayAdministration",Vb);function NE(e){return Sh(e)&&s5(e[oe])}var l5={},So="add",yh="delete";class Hb{constructor(e,t=_s,n="ObservableMap"){this.enhancer_=void 0,this.name_=void 0,this[oe]=l5,this.data_=void 0,this.hasMap_=void 0,this.keysAtom_=void 0,this.interceptors_=void 0,this.changeListeners_=void 0,this.dehancer=void 0,this.enhancer_=t,this.name_=n,ia(()=>{if(this.keysAtom_=XC("ObservableMap.keys()"),this.data_=new Map,this.hasMap_=new Map,e)this.merge(e)})}has_(e){return this.data_.has(e)}has(e){if(!F.trackingDerivation)return this.has_(e);let t=this.hasMap_.get(e);if(!t){let n=t=new ko(this.has_(e),kh,"ObservableMap.key?",!1);this.hasMap_.set(e,n),n.onBUOL=new Set([()=>this.hasMap_.delete(e)])}return t.get()}set(e,t){let n=this.has_(e);if(Hn(this)){let i=Un(this,{type:n?Co:So,object:this,newValue:t,name:e});if(!i)return this;t=i.newValue}if(n)this.updateValue_(e,t);else this.addValue_(e,t);return this}delete(e){if(Ki(this.keysAtom_),Hn(this)){if(!Un(this,{type:yh,object:this,name:e}))return!1}if(this.has_(e)){let n=ai(this),i=n?{observableKind:"map",debugObjectName:this.name_,type:yh,object:this,oldValue:this.data_.get(e).value_,name:e}:null;if(Er(()=>{var r;this.keysAtom_.reportChanged(),(r=this.hasMap_.get(e))==null||r.setNewValue_(!1),this.data_.get(e).setNewValue_(void 0),this.data_.delete(e)}),n)ui(this,i);return!0}return!1}updateValue_(e,t){let n=this.data_.get(e);if(t=n.prepareNewValue_(t),t!==F.UNCHANGED){let r=ai(this),o=r?{observableKind:"map",debugObjectName:this.name_,type:Co,object:this,oldValue:n.value_,name:e,newValue:t}:null;if(n.setNewValue_(t),r)ui(this,o)}}addValue_(e,t){Ki(this.keysAtom_),Er(()=>{var o;let s=new ko(t,this.enhancer_,"ObservableMap.key",!1);this.data_.set(e,s),t=s.value_,(o=this.hasMap_.get(e))==null||o.setNewValue_(!0),this.keysAtom_.reportChanged()});let n=!1,i=ai(this),r=i||n?{observableKind:"map",debugObjectName:this.name_,type:So,object:this,name:e,newValue:t}:null;if(i)ui(this,r)}get(e){if(this.has(e))return this.dehanceValue_(this.data_.get(e).get());return this.dehanceValue_(void 0)}getOrInsert(e,t){if(!this.has(e))this.set(e,t);return this.get(e)}getOrInsertComputed(e,t){if(!this.has(e))this.set(e,t(e));return this.get(e)}dehanceValue_(e){if(this.dehancer!==void 0)return this.dehancer(e);return e}keys(){return this.keysAtom_.reportObserved(),this.data_.keys()}values(){let e=this,t=this.keys();return BC({next(){let{done:n,value:i}=t.next();return{done:n,value:n?void 0:e.get(i)}}})}entries(){let e=this,t=this.keys();return BC({next(){let{done:n,value:i}=t.next();return{done:n,value:n?void 0:[i,e.get(i)]}}})}[Symbol.iterator](){return this.entries()}forEach(e,t){for(let[n,i]of this)e.call(t,i,n,this)}merge(e){if(na(e))e=new Map(e);return Er(()=>{if(Rr(e))Q4(e).forEach((t)=>this.set(t,e[t]));else if(Array.isArray(e))e.forEach(([t,n])=>this.set(t,n));else if(ic(e)){if(!W4(e))Pe(19,e);e.forEach((t,n)=>this.set(n,t))}else if(e!==null&&e!==void 0)Pe(20,e)}),this}clear(){Er(()=>{cE(()=>{for(let e of this.keys())this.delete(e)})})}replace(e){return Er(()=>{let t=a5(e),n=new Map,i=!1;for(let r of this.data_.keys())if(!t.has(r))if(this.delete(r))i=!0;else{let s=this.data_.get(r);n.set(r,s)}for(let[r,o]of t.entries()){let s=this.data_.has(r);if(this.set(r,o),this.data_.has(r)){let l=this.data_.get(r);if(n.set(r,l),!s)i=!0}}if(!i)if(this.data_.size!==n.size)this.keysAtom_.reportChanged();else{let r=this.data_.keys(),o=n.keys(),s=r.next(),l=o.next();while(!s.done){if(s.value!==l.value){this.keysAtom_.reportChanged();break}s=r.next(),l=o.next()}}this.data_=n}),this}get size(){return this.keysAtom_.reportObserved(),this.data_.size}toString(){return"[object ObservableMap]"}toJSON(){return Array.from(this)}get[Symbol.toStringTag](){return"Map"}}var na=Es("ObservableMap",Hb);function BC(e){return e[Symbol.toStringTag]="MapIterator",BE(e)}function a5(e){if(ic(e)||na(e))return e;else if(Array.isArray(e))return new Map(e);else if(Rr(e)){let t=new Map;for(let n in e)t.set(n,e[n]);return t}else return Pe(21,e)}var u5={};class Ub{constructor(e,t=_s,n="ObservableSet"){this.name_=void 0,this[oe]=u5,this.data_=new Set,this.atom_=void 0,this.changeListeners_=void 0,this.interceptors_=void 0,this.dehancer=void 0,this.enhancer_=void 0,this.name_=n,this.enhancer_=(i,r)=>t(i,r,n),ia(()=>{if(this.atom_=XC(this.name_),e)this.replace(e)})}dehanceValue_(e){if(this.dehancer!==void 0)return this.dehancer(e);return e}clear(){Er(()=>{cE(()=>{for(let e of this.data_.values())this.delete(e)})})}forEach(e,t){for(let n of this)e.call(t,n,n,this)}get size(){return this.atom_.reportObserved(),this.data_.size}add(e){if(Ki(this.atom_),Hn(this)){let t=Un(this,{type:So,object:this,newValue:e});if(!t)return this;e=t.newValue}if(!this.has(e)){Er(()=>{this.data_.add(this.enhancer_(e,void 0)),this.atom_.reportChanged()});let t=!1,n=ai(this),i=n||t?{observableKind:"set",debugObjectName:this.name_,type:So,object:this,newValue:e}:null;if(n)ui(this,i)}return this}delete(e){if(Hn(this)){if(!Un(this,{type:yh,object:this,oldValue:e}))return!1}if(this.has(e)){let n=ai(this),i=n?{observableKind:"set",debugObjectName:this.name_,type:yh,object:this,oldValue:e}:null;if(Er(()=>{this.atom_.reportChanged(),this.data_.delete(e)}),n)ui(this,i);return!0}return!1}has(e){return this.atom_.reportObserved(),this.data_.has(this.dehanceValue_(e))}entries(){let e=this.values();return PC({next(){let{value:t,done:n}=e.next();return!n?{value:[t,t],done:n}:{value:void 0,done:n}}})}keys(){return this.values()}values(){this.atom_.reportObserved();let e=this,t=this.data_.values();return PC({next(){let{value:n,done:i}=t.next();return!i?{value:e.dehanceValue_(n),done:i}:{value:void 0,done:i}}})}intersection(e){return new Set(this).intersection(e)}union(e){return new Set(this).union(e)}difference(e){return new Set(this).difference(e)}symmetricDifference(e){return new Set(this).symmetricDifference(e)}isSubsetOf(e){return new Set(this).isSubsetOf(e)}isSupersetOf(e){return new Set(this).isSupersetOf(e)}isDisjointFrom(e){return new Set(this).isDisjointFrom(e)}replace(e){if(sc(e))e=new Set(e);if(Array.isArray(e)||Zu(e))Er(()=>{let t=Zu(e)?e:new Set(e);if(t.size===0){this.clear();return}if(this.data_.size===0){t.forEach((n)=>this.add(n));return}for(let n of this.data_.values())if(!t.has(this.dehanceValue_(n)))this.delete(n);t.forEach((n)=>this.add(n))});else if(e!==null&&e!==void 0)Pe(41,e);return this}toJSON(){return Array.from(this)}toString(){return"[object ObservableSet]"}[Symbol.iterator](){return this.values()}get[Symbol.toStringTag](){return"Set"}}var sc=Es("ObservableSet",Ub);function PC(e){return e[Symbol.toStringTag]="SetIterator",BE(e)}var IC=Object.create(null),VC="remove";class jb{constructor(e,t=new Map,n,i=h3){this.target_=void 0,this.values_=void 0,this.name_=void 0,this.defaultAnnotation_=void 0,this.keysAtom_=void 0,this.changeListeners_=void 0,this.interceptors_=void 0,this.proxy_=void 0,this.isPlainObject_=void 0,this.appliedAnnotations_=void 0,this.pendingKeys_=void 0,this.lazyComputedKeys_=void 0,this.lazyObservableKeys_=void 0,this.target_=e,this.values_=t,this.name_=n,this.defaultAnnotation_=i,this.keysAtom_=new Zl("ObservableObject.keys"),this.isPlainObject_=Rr(this.target_)}getObservablePropValue_(e){var t,n;return((t=(n=this.values_.get(e))!=null?n:this.materializeLazyComputed_(e))!=null?t:this.materializeLazyObservable_(e)).get()}materializeLazyComputed_(e){var t;let n=(t=this.lazyComputedKeys_)==null?void 0:t.get(e);if(!n)return;if(this.lazyComputedKeys_.delete(e),this.lazyComputedKeys_.size===0)this.lazyComputedKeys_=void 0;let i=n();return this.values_.set(e,i),i}materializeLazyObservable_(e){var t;let n=(t=this.lazyObservableKeys_)==null?void 0:t.get(e);if(!n)return;if(this.lazyObservableKeys_.delete(e),this.lazyObservableKeys_.size===0)this.lazyObservableKeys_=void 0;let i=n();return this.values_.set(e,i),i}setObservablePropValue_(e,t){var n,i;let r=(n=(i=this.values_.get(e))!=null?i:this.materializeLazyComputed_(e))!=null?n:this.materializeLazyObservable_(e);if(r instanceof Ar)return r.set(t),!0;if(Hn(this)){let o=Un(this,{type:Co,object:this.proxy_||this.target_,name:e,newValue:t});if(!o)return null;t=o.newValue}if(t=r.prepareNewValue_(t),t!==F.UNCHANGED){let o=ai(this),s=!1,l=o?{type:Co,observableKind:"object",debugObjectName:this.name_,object:this.proxy_||this.target_,oldValue:r.value_,name:e,newValue:t}:null;if(r.setNewValue_(t),o)ui(this,l)}return!0}get_(e){if(F.trackingDerivation&&!ks(this.target_,e))this.has_(e);return this.target_[e]}set_(e,t,n=!1){if(ks(this.target_,e))if(this.values_.has(e))return this.setObservablePropValue_(e,t);else if(n)return Reflect.set(this.target_,e,t);else return this.target_[e]=t,!0;else return this.extend_(e,{value:t,enumerable:!0,writable:!0,configurable:!0},this.defaultAnnotation_,n)}has_(e){if(!F.trackingDerivation)return e in this.target_;this.pendingKeys_||(this.pendingKeys_=new Map);let t=this.pendingKeys_.get(e);if(!t)t=new ko(e in this.target_,kh,"ObservableObject.key?",!1),this.pendingKeys_.set(e,t);return t.get()}extend_(e,t,n,i=!1){if(n===!0)n=this.defaultAnnotation_;if(n===!1)return this.defineProperty_(e,t,i);LE(this,n,e);let r=n.extend_(this,e,t,i);if(r)DE(this,n,e);return r}defineProperty_(e,t,n=!1){Ki(this.keysAtom_);try{jn();let i=this.delete_(e);if(!i)return i;if(Hn(this)){let r=Un(this,{object:this.proxy_||this.target_,name:e,type:So,newValue:t.value});if(!r)return null;let{newValue:o}=r;if(t.value!==o)t=Fi({},t,{value:o})}if(n){if(!Reflect.defineProperty(this.target_,e,t))return!1}else Or(this.target_,e,t);this.notifyPropertyAddition_(e,t.value)}finally{Kn()}return!0}defineObservableProperty_(e,t,n,i=!1){Ki(this.keysAtom_);try{jn();let r=this.delete_(e);if(!r)return r;if(Hn(this)){let a=Un(this,{object:this.proxy_||this.target_,name:e,type:So,newValue:t});if(!a)return null;t=a.newValue}let o=HC(e),s={configurable:F.safeDescriptors?this.isPlainObject_:!0,enumerable:!0,get:o.get,set:o.set};if(i){if(!Reflect.defineProperty(this.target_,e,s))return!1}else Or(this.target_,e,s);let l=new ko(t,n,"ObservableObject.key",!1);this.values_.set(e,l),this.notifyPropertyAddition_(e,l.value_)}finally{Kn()}return!0}defineComputedProperty_(e,t,n=!1){Ki(this.keysAtom_);try{jn();let i=this.delete_(e);if(!i)return i;if(Hn(this)){if(!Un(this,{object:this.proxy_||this.target_,name:e,type:So,newValue:void 0}))return null}t.name||(t.name="ObservableObject.key"),t.context=this.proxy_||this.target_;let r=HC(e),o={configurable:F.safeDescriptors?this.isPlainObject_:!0,enumerable:!1,get:r.get,set:r.set};if(n){if(!Reflect.defineProperty(this.target_,e,o))return!1}else Or(this.target_,e,o);this.values_.set(e,new Ar(t)),this.notifyPropertyAddition_(e,void 0)}finally{Kn()}return!0}delete_(e,t=!1){if(Ki(this.keysAtom_),!ks(this.target_,e))return!0;if(Hn(this)){if(!Un(this,{object:this.proxy_||this.target_,name:e,type:VC}))return null}try{var n;jn();let r=ai(this),o=!1,s=this.values_.get(e),l=void 0;if(!s&&(r||o)){var i;l=(i=Nb(this.target_,e))==null?void 0:i.value}if(t){if(!Reflect.deleteProperty(this.target_,e))return!1}else delete this.target_[e];if(s){if(this.values_.delete(e),s instanceof ko)l=s.value_;vE(s)}if(this.keysAtom_.reportChanged(),(n=this.pendingKeys_)==null||(n=n.get(e))==null||n.set(e in this.target_),r||o){let a={type:VC,observableKind:"object",object:this.proxy_||this.target_,debugObjectName:this.name_,oldValue:l,name:e};if(r)ui(this,a)}}finally{Kn()}return!0}notifyPropertyAddition_(e,t){var n;let i=ai(this),r=!1;if(i){let o=i?{type:So,observableKind:"object",debugObjectName:this.name_,object:this.proxy_||this.target_,name:e,newValue:t}:null;if(i)ui(this,o)}(n=this.pendingKeys_)==null||(n=n.get(e))==null||n.set(!0),this.keysAtom_.reportChanged()}ownKeys_(){return this.keysAtom_.reportObserved(),gh(this.target_)}keys_(){return this.keysAtom_.reportObserved(),Object.keys(this.target_)}}function lc(e,t){var n;if(ks(e,oe))return e;let i=(n=t==null?void 0:t.name)!=null?n:"ObservableObject",r=new jb(e,new Map,String(i),w3(t));return qC(e,oe,r),e}var c5=Es("ObservableObjectAdministration",jb);function HC(e){return IC[e]||(IC[e]={get(){return this[oe].getObservablePropValue_(e)},set(t){return this[oe].setObservablePropValue_(e,t)}})}function nc(e){if(Sh(e))return c5(e[oe]);return!1}function DE(e,t,n){}function LE(e,t,n){}function xh(e,t){if(typeof e==="object"&&e!==null){if(NE(e)){if(t!==void 0)Pe(23);return e[oe].atom_}if(sc(e))return e.atom_;if(na(e)){if(t===void 0)return e.keysAtom_;let r=e.data_.get(t)||e.hasMap_.get(t);if(!r)Pe(25,t,UC(e));return r}if(nc(e)){var n,i;if(!t)return Pe(26);let r=e[oe],o=(n=(i=r.values_.get(t))!=null?i:r.materializeLazyComputed_(t))!=null?n:r.materializeLazyObservable_(t);if(!o)Pe(27,t,UC(e));return o}if(Db(e)||Eh(e)||bh(e))return e}else if(Ql(e)){if(bh(e[oe]))return e[oe]}Pe(28)}function zE(e,t){if(!e)Pe(29);if(t!==void 0)return zE(xh(e,t));if(Db(e)||Eh(e)||bh(e))return e;if(na(e)||sc(e))return e;if(e[oe])return e[oe];Pe(24,e)}function UC(e,t){let n;if(t!==void 0)n=xh(e,t);else if(Jl(e))return e.name;else if(nc(e)||na(e)||sc(e))n=zE(e);else n=xh(e);return n.name_}function ia(e){let t=ta(),n=!0;jn();try{return e()}finally{Kn(),_o(t)}}var x9=wh.toString;var jC,f5=((jC=globalThis.Iterator)==null?void 0:jC.prototype)||{};function BE(e){return e[Symbol.iterator]=d5,Fi(Object.create(f5),e)}function d5(){return this}var PE;if(!Q||!$r)throw Error("mobx-react-lite requires React 18 or later");if(!((Pb==null||(PE=Pb())==null?void 0:PE.version)>=7))throw Error("mobx-react-lite requires mobx at least version 7 to be available");var h5=1e4,p5=1e4;class Kb{constructor(e){this.finalize=void 0,this.registrations=new Map,this.sweepTimeout=void 0,this.sweep=(t=h5)=>{clearTimeout(this.sweepTimeout),this.sweepTimeout=void 0;let n=Date.now();if(this.registrations.forEach((i,r)=>{if(n-i.registeredAt>=t)this.registrations.delete(r),this.finalize(i.value)}),this.registrations.size>0)this.scheduleSweep()},this.finalizeAllImmediately=()=>{this.sweep(0)},this.finalize=e}register(e,t,n){this.registrations.set(n,{value:t,registeredAt:Date.now()}),this.scheduleSweep()}unregister(e){if(this.registrations.delete(e),this.registrations.size===0)clearTimeout(this.sweepTimeout),this.sweepTimeout=void 0}scheduleSweep(){if(this.sweepTimeout===void 0)this.sweepTimeout=setTimeout(this.sweep,p5)}}class jE{constructor(e){this.finalize=void 0,this.finalizeRegistration=(t)=>{var n;(n=this.native)==null||n.unregister(t.token),this.timer.unregister(t.token),this.finalize(t.value)},this.tokens=new WeakMap,this.staged=new Map,this.flushScheduled=!1,this.native=typeof FinalizationRegistry<"u"?new FinalizationRegistry(this.finalizeRegistration):void 0,this.timer=new Kb(this.finalizeRegistration),this.finalizeAllImmediately=()=>{this.flushRegistrations(),this.timer.finalizeAllImmediately()},this.flushRegistrations=()=>{this.flushScheduled=!1,this.staged.forEach(({target:t,value:n},i)=>{var r;let o={value:n,token:{}};this.tokens.set(i,o.token),(r=this.native)==null||r.register(t,o,o.token),this.timer.register(t,o,o.token)}),this.staged.clear()},this.finalize=e}register(e,t,n=e){if(this.unregister(n),this.staged.set(n,{target:e,value:t}),!this.flushScheduled)this.flushScheduled=!0,Promise.resolve().then(this.flushRegistrations)}unregister(e){if(this.staged.delete(e))return;let t=this.tokens.get(e);if(t){var n;this.tokens.delete(e),(n=this.native)==null||n.unregister(t),this.timer.unregister(t)}}}var m5=typeof FinalizationRegistry<"u"?jE:Kb,Fb=new m5((e)=>{let t=e.reaction;e.reaction=null,t==null||t.dispose()}),g5=!1;function KE(){return g5}function FE(e){e.reaction=new oc(`observer${e.name}`,()=>{e.stateVersion=Symbol(),e.onStoreChange==null||e.onStoreChange()})}function v5(e){let t={reaction:null,onStoreChange:null,stateVersion:Symbol(),name:e,subscribe(n){if(Fb.unregister(t),t.onStoreChange=n,!t.reaction)FE(t),t.stateVersion=Symbol();return()=>{var i;t.onStoreChange=null,(i=t.reaction)==null||i.dispose(),t.reaction=null}},getSnapshot(){return t.stateVersion}};return t}function qE(e,t="observed"){if(KE())return e();let n=X(null);if(!n.current)n.current=v5(t);let i=n.current;if(!i.reaction)FE(i),Fb.register(n,i,i);Rm(i.reaction,OE),$r(i.subscribe,i.getSnapshot,i.getSnapshot);let r,o;if(i.reaction.track(()=>{try{r=e()}catch(s){o=s}}),o)throw o;return r}var IE,VE,$E=typeof Symbol==="function"&&Symbol.for,b5=(IE=(VE=Object.getOwnPropertyDescriptor(()=>{},"name"))==null?void 0:VE.configurable)!=null?IE:!1,HE=$E?Symbol.for("react.forward_ref"):typeof Fr==="function"&&Fr((e)=>null).$$typeof,UE=$E?Symbol.for("react.memo"):typeof el==="function"&&el((e)=>null).$$typeof;function q(e){if(UE&&e.$$typeof===UE)throw Error("[mobx-react-lite] You are trying to use `observer` on a function component wrapped in either another `observer` or `React.memo`. The observer already applies 'React.memo' for you.");if(KE())return e;let t=!1,n=e,i=e.displayName||e.name;if(HE&&e.$$typeof===HE){if(t=!0,n=e.render,typeof n!=="function")throw Error("[mobx-react-lite] `render` property of ForwardRef was not a function")}let r=(o,s)=>qE(()=>n(o,s),i);if(r.displayName=e.displayName,b5)Object.defineProperty(r,"name",{value:e.name,writable:!0,configurable:!0});if(t)r=Fr(r);return r=el(r),x5(e,r),r}var y5={$$typeof:!0,render:!0,compare:!0,type:!0,displayName:!0};function x5(e,t){Object.keys(e).forEach((n)=>{if(!y5[n])Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(e,n))})}function w5({children:e,render:t}){if(e&&t)console.error("MobX Observer: Do not use children and render in the same time in `Observer`");let n=e||t;if(typeof n!=="function")return null;return qE(n)}w5.displayName="Observer";function ra(e,t){return Q(()=>Tt(e(),t,{autoBind:!0}))[0]}var _9=Fb.finalizeAllImmediately;var S5=Symbol.for("react.transitional.element"),k5=Symbol.for("react.fragment");function XE(e,t,n){var i=null;if(n!==void 0&&(i=""+n),t.key!==void 0&&(i=""+t.key),"key"in t){n={};for(var r in t)r!=="key"&&(n[r]=t[r])}else n=t;return t=n.ref,{$$typeof:S5,type:e,key:i,ref:t!==void 0?t:null,props:n}}var ie=k5,p=XE,y=XE;function _5(e,t){let n=getComputedStyle(e),i=parseFloat(n.fontSize);return t*i}function C5(e,t){let n=getComputedStyle(e.ownerDocument.documentElement),i=parseFloat(n.fontSize);return t*i}function E5(e){return e/100*window.innerHeight}function O5(e){return e/100*window.innerWidth}function A5(e){switch(typeof e){case"number":return[e,"px"];case"string":{let t=parseFloat(e);return e.endsWith("%")?[t,"%"]:e.endsWith("px")?[t,"px"]:e.endsWith("rem")?[t,"rem"]:e.endsWith("em")?[t,"em"]:e.endsWith("vh")?[t,"vh"]:e.endsWith("vw")?[t,"vw"]:[t,"%"]}}}function sa({groupSize:e,panelElement:t,styleProp:n}){let i,[r,o]=A5(n);switch(o){case"%":{i=r/100*e;break}case"px":{i=r;break}case"rem":{i=C5(t,r);break}case"em":{i=_5(t,r);break}case"vh":{i=E5(r);break}case"vw":{i=O5(r);break}}return i}function zt(e){return parseFloat(e.toFixed(3))}function aa({group:e}){let{orientation:t,panels:n}=e;return n.reduce((i,r)=>(i+=t==="horizontal"?r.element.offsetWidth:r.element.offsetHeight,i),0)}function $b(e){let{panels:t}=e,n=aa({group:e});return n===0?t.map((i)=>({groupResizeBehavior:i.panelConstraints.groupResizeBehavior,collapsedSize:0,collapsible:i.panelConstraints.collapsible===!0,defaultSize:void 0,disabled:i.panelConstraints.disabled,minSize:0,maxSize:100,panelId:i.id})):t.map((i)=>{let{element:r,panelConstraints:o}=i,s=0;if(o.collapsedSize!==void 0){let f=sa({groupSize:n,panelElement:r,styleProp:o.collapsedSize});s=zt(f/n*100)}let l;if(o.collapsedThreshold!==void 0){let f=sa({groupSize:n,panelElement:r,styleProp:o.collapsedThreshold});l=zt(f/n*100)}let a;if(o.defaultSize!==void 0){let f=sa({groupSize:n,panelElement:r,styleProp:o.defaultSize});a=zt(f/n*100)}let u=0;if(o.minSize!==void 0){let f=sa({groupSize:n,panelElement:r,styleProp:o.minSize});u=zt(f/n*100)}let c=100;if(o.maxSize!==void 0){let f=sa({groupSize:n,panelElement:r,styleProp:o.maxSize});c=zt(f/n*100)}return{groupResizeBehavior:o.groupResizeBehavior,collapsedSize:s,collapsedThreshold:l,collapsible:o.collapsible===!0,defaultSize:a,disabled:o.disabled,minSize:u,maxSize:c,panelId:i.id}})}class Yb{#e={};addListener(e,t){let n=this.#e[e];return n===void 0?this.#e[e]=[t]:n.includes(t)||n.push(t),()=>{this.removeListener(e,t)}}emit(e,t){let n=this.#e[e];if(n!==void 0)if(n.length===1)n[0].call(null,t);else{let i=!1,r=null,o=Array.from(n);for(let s=0;s<o.length;s++){let l=o[s];try{l.call(null,t)}catch(a){r===null&&(i=!0,r=a)}}if(i)throw r}}removeAllListeners(){this.#e={}}removeListener(e,t){let n=this.#e[e];if(n!==void 0){let i=n.indexOf(t);i>=0&&n.splice(i,1)}}}var it={cursorFlags:0,state:"inactive"},Wb=new Yb;function Mr(){return it}function cO(e){return Wb.addListener("change",e)}function R5(e,t=[],n,i=!1){let r=it,o={...it};o.cursorFlags=e,o.state==="active"&&(o.didPointerMove||=i,o.previews=t,n&&(o.previewLayoutMap=n)),it=o,Wb.emit("change",{prev:r,next:o})}function Xi(e){let t=it;it=e,t.state==="active"&&e.state!=="active"&&t.didPointerMove&&t.hitRegions.forEach(({separator:n})=>{n&&n.element.ownerDocument.activeElement===n.element&&n.element.blur()}),Wb.emit("change",{prev:t,next:e})}function T5(e){it.state!=="active"||!it.previews.some((t)=>t.separator===e)||Xi({...it,previews:it.previews.map((t)=>t.separator===e?{...t}:t)})}function M5(e){if(it.state==="inactive")return!1;let t=it.hitRegions.filter((i)=>i.group!==e),n=it.state==="active"&&it.previews.some((i)=>i.group===e);if(t.length===it.hitRegions.length&&!n)return!1;if(t.length===0)Xi({cursorFlags:0,state:"inactive"});else if(it.state==="active"){let i=new Map(it.initialLayoutMap),r=new Map(it.previewLayoutMap);i.delete(e),r.delete(e),Xi({...it,cursorFlags:0,hitRegions:t,initialLayoutMap:i,previewLayoutMap:r,previews:it.previews.filter((o)=>o.group!==e)})}else Xi({...it,hitRegions:t});return!0}var N5=(e)=>e,qb=()=>{},fO=1,dO=2,hO=4,pO=8,GE=3,YE=12,Ah;function WE(){return Ah===void 0&&(Ah=!1,typeof window<"u"&&(window.navigator.userAgent.includes("Chrome")||window.navigator.userAgent.includes("Firefox"))&&(Ah=!0)),Ah}function D5({cursorFlags:e,groups:t,state:n}){let i=0,r=0;switch(n){case"active":case"hover":t.forEach((o)=>{if(!o.mutableState.disableCursor)switch(o.orientation){case"horizontal":{i++;break}case"vertical":{r++;break}}})}if(!(i===0&&r===0)){switch(n){case"active":{if(e&&WE()){let o=(e&fO)!==0,s=(e&dO)!==0,l=(e&hO)!==0,a=(e&pO)!==0;if(o)return l?"se-resize":a?"ne-resize":"e-resize";if(s)return l?"sw-resize":a?"nw-resize":"w-resize";if(l)return"s-resize";if(a)return"n-resize"}break}}return WE()?i>0&&r>0?"move":i>0?"ew-resize":"ns-resize":i>0&&r>0?"grab":i>0?"col-resize":"row-resize"}}var QE=new WeakMap;function uc(e){if(!e.defaultView||!e.adoptedStyleSheets)return;let{prevStyle:t,styleSheet:n}=QE.get(e)??{};n===void 0&&(n=new e.defaultView.CSSStyleSheet,e.adoptedStyleSheets&&(Object.isExtensible(e.adoptedStyleSheets)?e.adoptedStyleSheets.push(n):e.adoptedStyleSheets=[...e.adoptedStyleSheets,n]));let i=Mr();switch(i.state){case"active":case"hover":{let r=D5({cursorFlags:i.cursorFlags,groups:i.hitRegions.map((s)=>s.group),state:i.state}),o=`*, *:hover {cursor: ${r} !important; }`;if(t===o)return;t=o,r?n.cssRules.length===0?n.insertRule(o):n.replaceSync(o):n.cssRules.length===1&&n.deleteRule(0);break}case"inactive":{t=void 0,n.cssRules.length===1&&n.deleteRule(0);break}}QE.set(e,{prevStyle:t,styleSheet:n})}function Ce(e,t="Assertion error"){if(!e)throw Error(t)}function Xb(e,t){return Array.from(t).sort((n,i)=>{let r=e==="horizontal"?L5(n,i):z5(n,i);if(r!==0)return r;let o=n.element.compareDocumentPosition(i.element);return o&Node.DOCUMENT_POSITION_DISCONNECTED?0:o&Node.DOCUMENT_POSITION_FOLLOWING?-1:o&Node.DOCUMENT_POSITION_PRECEDING?1:0})}function L5(e,t){let n=e.element.offsetLeft-t.element.offsetLeft;return n!==0?n:e.element.offsetWidth-t.element.offsetWidth}function z5(e,t){let n=e.element.offsetTop-t.element.offsetTop;return n!==0?n:e.element.offsetHeight-t.element.offsetHeight}function Gb(e){return e!==null&&typeof e=="object"&&"nodeType"in e&&e.nodeType===Node.ELEMENT_NODE}function mO(e,t){return{x:e.x>=t.left&&e.x<=t.right?0:Math.min(Math.abs(e.x-t.left),Math.abs(e.x-t.right)),y:e.y>=t.top&&e.y<=t.bottom?0:Math.min(Math.abs(e.y-t.top),Math.abs(e.y-t.bottom))}}function B5({orientation:e,rects:t,targetRect:n}){let i={x:n.x+n.width/2,y:n.y+n.height/2},r,o=Number.MAX_VALUE;for(let s of t){let{x:l,y:a}=mO(i,s),u=e==="horizontal"?l:a;u<o&&(o=u,r=s)}return Ce(r,"No rect found"),r}var Rh;function P5(){return Rh===void 0&&(typeof matchMedia=="function"?Rh=!!matchMedia("(pointer:coarse)").matches:Rh=!1),Rh}function Qb({expandHitTargets:e=!0,group:t,includeDisabled:n=!1}){let{element:i,orientation:r,panels:o,separators:s}=t,l=Xb(r,Array.from(i.children).filter(Gb).filter((g)=>!g.hasAttribute("data-resize-preview")).map((g)=>({element:g}))).map(({element:g})=>g),a=[],u=!1,c=!1,f=-1,d,h=-1,m=0,b,x=[];{let g=-1;for(let v of l)v.hasAttribute("data-panel")&&(g++,v.hasAttribute("data-disabled")||(m++,f===-1&&(f=g),h=g))}if(n||m>1){let g=-1;for(let v of l)if(v.hasAttribute("data-panel")){g++;let w=o.find((S)=>S.element===v);if(w){if(b){let S=b.element.getBoundingClientRect(),k=v.getBoundingClientRect(),E;if(c){let _=r==="horizontal"?new DOMRect(S.right,S.top,0,S.height):new DOMRect(S.left,S.bottom,S.width,0),O=r==="horizontal"?new DOMRect(k.left,k.top,0,k.height):new DOMRect(k.left,k.top,k.width,0);switch(x.length){case 0:{E=[_,O];break}case 1:{let P=x[0],T=B5({orientation:r,rects:[S,k],targetRect:P.element.getBoundingClientRect()});E=[P,T===S?O:_];break}default:{E=x;break}}}else x.length?E=x:E=[r==="horizontal"?new DOMRect(S.right,k.top,k.left-S.right,k.height):new DOMRect(k.left,S.bottom,k.width,k.top-S.bottom)];for(let _ of E){let O="width"in _?_:_.element.getBoundingClientRect(),P=e?P5()?t.resizeTargetMinimumSize.coarse:t.resizeTargetMinimumSize.fine:0;if(O.width<P){let I=P-O.width;O=new DOMRect(O.x-I/2,O.y,O.width+I,O.height)}if(O.height<P){let I=P-O.height;O=new DOMRect(O.x,O.y-I/2,O.width,O.height+I)}let T=g<=f||g>h;(n||!u&&!T)&&(d??=aa({group:t}),a.push({group:t,groupSize:d,panels:[b,w],separator:"width"in _?void 0:_,rect:O})),u=!1}}c=!1,b=w,x=[]}}else if(v.hasAttribute("data-separator")){v.ariaDisabled!==null&&(u=!0);let w=s.find((S)=>S.element===v);w?x.push(w):(b=void 0,x=[])}else c=!0}return a}var $i=new Map,gO=new Yb;function I5(e){$i=new Map($i),$i.delete(e)}function vO(e,t){for(let[n]of $i)if(n.id===e)return n}function Eo(e,t){for(let[n,i]of $i)if(n.id===e)return i;if(t)throw Error(`Could not find data for Group with id ${e}`)}function Oo(){return $i}function Jb(e,t){return gO.addListener("groupChange",(n)=>{n.group.id===e&&t(n)})}function Yi(e,t,n){let i=$i.get(e);$i=new Map($i),$i.set(e,t),gO.emit("groupChange",{group:e,isUserInteraction:n?.isUserInteraction===!0,prev:i,next:t})}function V5(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!=t[n])return!1;return!0}function bt(e,t,n=0){return Math.abs(zt(e)-zt(t))<=n}function qi(e,t){return bt(e,t)?0:e>t?1:-1}function la({overrideDisabledPanels:e,panelConstraints:t,prevSize:n,size:i}){let{collapsedSize:r=0,collapsedThreshold:o,collapsible:s,disabled:l,maxSize:a=100,minSize:u=0}=t;if(l&&!e)return n;if(qi(i,u)<0)if(s){let c=o??(u-r)/2,f=qi(n,r)<=0,d=f?r+c:u-c,h=qi(i,d);qi(i,r)<=0||h<0||o!==void 0&&f&&h===0?i=r:i=u}else i=u;return i=Math.min(a,i),i=zt(i),i}function cc({delta:e,initialLayout:t,panelConstraints:n,pivotIndices:i,prevLayout:r,trigger:o}){if(bt(e,0))return t;let s=o==="imperative-api",l=n.map(({panelId:m})=>t[m]),a=n.map(({panelId:m})=>r[m]),u=[...l],[c,f]=i;Ce(c!=null,"Invalid first pivot index"),Ce(f!=null,"Invalid second pivot index");let d=0;switch(o){case"keyboard":{{let m=e<0?f:c,b=n[m];Ce(b,`Panel constraints not found for index ${m}`);let{collapsedSize:x=0,collapsible:g,minSize:v=0}=b;if(g){let w=l[m];if(Ce(w!=null,`Previous layout not found for panel index ${m}`),bt(w,x)){let S=v-w;qi(S,Math.abs(e))>0&&(e=e<0?0-S:S)}}}{let m=e<0?c:f,b=n[m];Ce(b,`No panel constraints found for index ${m}`);let{collapsedSize:x=0,collapsible:g,minSize:v=0}=b;if(g){let w=l[m];if(Ce(w!=null,`Previous layout not found for panel index ${m}`),bt(w,v)){let S=w-x;qi(S,Math.abs(e))>0&&(e=e<0?0-S:S)}}}break}default:{let m=e<0?f:c,b=n[m];Ce(b,`Panel constraints not found for index ${m}`);let x=l[m],{collapsedSize:g,collapsedThreshold:v,collapsible:w,minSize:S}=b;if(w&&qi(x,S)<0){let k=S-g,E=v??k/2,_=x+Math.abs(e);if(qi(_,S)<0){let O=qi(Math.abs(e),E),P=v===void 0&&e<0;O>0||O===0&&P?e=e<0?-k:k:e=0}}break}}{let m=e<0?1:-1,b=e<0?f:c,x=0;for(;;){let v=l[b];Ce(v!=null,`Previous layout not found for panel index ${b}`);let w=la({overrideDisabledPanels:s,panelConstraints:n[b],prevSize:v,size:100})-v;if(x+=w,b+=m,b<0||b>=n.length)break}let g=Math.min(Math.abs(e),Math.abs(x));e=e<0?0-g:g}{let m=e<0?c:f;for(;m>=0&&m<n.length;){let b=Math.abs(e)-Math.abs(d),x=l[m];Ce(x!=null,`Previous layout not found for panel index ${m}`);let g=x-b,v=la({overrideDisabledPanels:s,panelConstraints:n[m],prevSize:x,size:g});if(!bt(x,v)&&(d+=x-v,u[m]=v,d.toFixed(3).localeCompare(Math.abs(e).toFixed(3),void 0,{numeric:!0})>=0))break;e<0?m--:m++}}if(V5(a,u))return r;{let m=e<0?f:c,b=l[m];Ce(b!=null,`Previous layout not found for panel index ${m}`);let x=b+d,g=la({overrideDisabledPanels:s,panelConstraints:n[m],prevSize:b,size:x});if(u[m]=g,!bt(g,x)){let v=x-g,w=e<0?f:c;for(;w>=0&&w<n.length;){let S=u[w];Ce(S!=null,`Previous layout not found for panel index ${w}`);let k=S+v,E=la({overrideDisabledPanels:s,panelConstraints:n[w],prevSize:S,size:k});if(bt(S,E)||(v-=E-S,u[w]=E),bt(v,0))break;e>0?w--:w++}}}let h=Object.values(u).reduce((m,b)=>b+m,0);return bt(h,100,0.1)?u.reduce((m,b,x)=>(m[n[x].panelId]=b,m),{}):r}function Gi(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(t[n]===void 0||qi(e[n],t[n])!==0)return!1;return!0}function Zb({commit:e,document:t,event:n,hitRegions:i,initialLayoutMap:r,mountedGroups:o,pointerDownAtPoint:s,prevCursorFlags:l}){let a=0,u=Mr(),c=u.state==="active"?u.previews:[],f=new Map(u.state==="active"?u.previewLayoutMap:void 0);i.forEach((m)=>{let{group:b,groupSize:x}=m,{orientation:g,panels:v}=b;if(e&&b.resizePreviewMode!=="separator")return;let{disableCursor:w}=b.mutableState,S=0;s?g==="horizontal"?S=(n.clientX-s.x)/x*100:S=(n.clientY-s.y)/x*100:g==="horizontal"?S=n.clientX<0?-100:100:S=n.clientY<0?-100:100;let k=r.get(b),E=o.get(b);if(!k||!E)return;let{defaultLayoutDeferred:_,derivedPanelConstraints:O,groupSize:P,layout:T,separatorToPanels:I}=E;if(O&&T&&I){let V=b.resizePreviewMode==="separator"?f.get(b)??T:T,Y=cc({delta:S,initialLayout:k,panelConstraints:O,pivotIndices:m.panels.map((N)=>v.indexOf(N)),prevLayout:V,trigger:"mouse-or-touch"});if(b.resizePreviewMode==="separator"&&!e&&!Gi(Y,V)){f.set(b,Y);let N=0,D=v.map((H)=>(N+=Y[H.id]-k[H.id],N*(x/100)));c=c.map((H)=>{if(H.group!==b)return H;let G=D[H.panelIndex];return G===H.offset?H:{...H,offset:G}})}if(Gi(Y,V)&&S!==0&&!w)switch(g){case"horizontal":{a|=S<0?fO:dO;break}case"vertical":{a|=S<0?hO:pO;break}}(b.resizePreviewMode!=="separator"||e)&&!Gi(Y,T)&&Yi(m.group,{defaultLayoutDeferred:_,derivedPanelConstraints:O,groupSize:P,layout:Y,separatorToPanels:I})}});let d=0;n.movementX===0?d|=l&GE:d|=a&GE,n.movementY===0?d|=l&YE:d|=a&YE;let h=u.state==="active"&&(n.clientX!==u.pointerDownAtPoint.x||n.clientY!==u.pointerDownAtPoint.y);R5(d,c,f,h),uc(t)}function bO(e,t){let n=Mr(),i=Oo(),r=!1;switch(n.state){case"active":Zb({commit:!0,document:e,event:t,hitRegions:n.hitRegions,initialLayoutMap:n.initialLayoutMap,mountedGroups:i,pointerDownAtPoint:n.pointerDownAtPoint,prevCursorFlags:n.cursorFlags}),Xi({cursorFlags:0,state:"inactive"}),n.hitRegions.length>0&&(uc(e),r=!0,n.hitRegions.forEach((o)=>{if(!i.has(o.group))return;let s=Eo(o.group.id,!0);Yi(o.group,s,{isUserInteraction:!0})}))}return r}function JE(e){e.defaultPrevented||bO(e.currentTarget,e)}function H5(e,t,n){let i,r={x:1/0,y:1/0};for(let o of t){let s=mO(n,o.rect);switch(e){case"horizontal":{s.x<=r.x&&(i=o,r=s);break}case"vertical":{s.y<=r.y&&(i=o,r=s);break}}}return i?{distance:r,hitRegion:i}:void 0}function U5(e){return e!==null&&typeof e=="object"&&"nodeType"in e&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE}function j5(e,t){if(e===t)throw Error("Cannot compare node with itself");let n={a:tO(e),b:tO(t)},i;for(;n.a.at(-1)===n.b.at(-1);)i=n.a.pop(),n.b.pop();Ce(i,"Stacking order can only be calculated for elements with a common ancestor");let r={a:eO(ZE(n.a)),b:eO(ZE(n.b))};if(r.a===r.b){let o=i.childNodes,s={a:n.a.at(-1),b:n.b.at(-1)},l=o.length;for(;l--;){let a=o[l];if(a===s.a)return 1;if(a===s.b)return-1}}return Math.sign(r.a-r.b)}var K5=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function F5(e){let t=getComputedStyle(yO(e)??e).display;return t==="flex"||t==="inline-flex"}function q5(e){let t=getComputedStyle(e);return!!(t.position==="fixed"||t.zIndex!=="auto"&&(t.position!=="static"||F5(e))||+t.opacity<1||("transform"in t)&&t.transform!=="none"||("webkitTransform"in t)&&t.webkitTransform!=="none"||("mixBlendMode"in t)&&t.mixBlendMode!=="normal"||("filter"in t)&&t.filter!=="none"||("webkitFilter"in t)&&t.webkitFilter!=="none"||("isolation"in t)&&t.isolation==="isolate"||K5.test(t.willChange)||t.webkitOverflowScrolling==="touch")}function ZE(e){let t=e.length;for(;t--;){let n=e[t];if(Ce(n,"Missing node"),q5(n))return n}return null}function eO(e){return e&&Number(getComputedStyle(e).zIndex)||0}function tO(e){let t=[];for(;e;)t.push(e),e=yO(e);return t}function yO(e){let{parentNode:t}=e;return U5(t)?t.host:t}function $5(e,t){return e.x<t.x+t.width&&e.x+e.width>t.x&&e.y<t.y+t.height&&e.y+e.height>t.y}function X5(e){try{return e.matches(":modal")}catch{return!1}}function G5({groupElement:e,hitRegion:t,pointerEventTarget:n}){if(Gb(n)){let i=n.closest("dialog");if(i&&!i.contains(e)&&X5(i))return!1}if(!Gb(n)||n.contains(e)||e.contains(n))return!0;if(j5(n,e)>0){let i=n;for(;i;){if(i.contains(e))return!0;if($5(i.getBoundingClientRect(),t))return!1;i=i.parentElement}}return!0}function e0(e,t){let n=[];return t.forEach((i,r)=>{if(r.disabled)return;let o=Qb({group:r}),s=H5(r.orientation,o,{x:e.clientX,y:e.clientY});s&&s.distance.x<=0&&s.distance.y<=0&&G5({groupElement:r.element,hitRegion:s.hitRegion.rect,pointerEventTarget:e.target})&&n.push(s.hitRegion)}),n}function As({layout:e,panelConstraints:t}){let n=t.map(({panelId:s})=>e[s]),i=[...n],r=i.reduce((s,l)=>s+l,0);if(Object.keys(e).length!==t.length)throw Error(`Invalid ${t.length} panel layout: ${Object.values(e).map((s)=>`${s}%`).join(", ")}`);if(!bt(r,100)&&i.length>0)for(let s=0;s<t.length;s++){let l=i[s];Ce(l!=null,`No layout data found for index ${s}`);let a=100/r*l;i[s]=a}let o=0;for(let s=0;s<t.length;s++){let l=n[s];Ce(l!=null,`No layout data found for index ${s}`);let a=i[s];Ce(a!=null,`No layout data found for index ${s}`);let u=la({overrideDisabledPanels:!0,panelConstraints:t[s],prevSize:l,size:a});a!=u&&(o+=a-u,i[s]=u)}if(!bt(o,0))for(let s=0;s<t.length;s++){let l=i[s];Ce(l!=null,`No layout data found for index ${s}`);let a=l+o,u=la({overrideDisabledPanels:!0,panelConstraints:t[s],prevSize:l,size:a});if(l!==u&&(o-=u-l,i[s]=u,bt(o,0)))break}return i.reduce((s,l,a)=>(s[t[a].panelId]=l,s),{})}function xO({groupId:e,panelId:t}){let n=()=>{let a=Oo();for(let[u,{defaultLayoutDeferred:c,derivedPanelConstraints:f,layout:d,groupSize:h,separatorToPanels:m}]of a)if(u.id===e)return{defaultLayoutDeferred:c,derivedPanelConstraints:f,group:u,groupSize:h,layout:d,separatorToPanels:m};throw Error(`Group ${e} not found`)},i=()=>{let a=n().derivedPanelConstraints.find((u)=>u.panelId===t);if(a!==void 0)return a;throw Error(`Panel constraints not found for Panel ${t}`)},r=()=>{let a=n().group.panels.find((u)=>u.id===t);if(a!==void 0)return a;throw Error(`Layout not found for Panel ${t}`)},o=()=>{let a=n().layout[t];if(a!==void 0)return a;throw Error(`Layout not found for Panel ${t}`)},s=({nextSize:a,panels:u,prevLayout:c,derivedPanelConstraints:f})=>{let d=o(),h=u.findIndex((x)=>x.id===t),m=h===0,b=h===u.length-1;if(b&&a<d&&(m||u.slice(0,h).every((x,g)=>{let v=f[g];return v?.collapsible&&bt(v.collapsedSize,c[v.panelId])}))){let x=u.slice(0,h).reduce((g,v)=>g+c[v.id],0);return{...c,[t]:zt(100-x)}}return cc({delta:b?d-a:a-d,initialLayout:c,panelConstraints:f,pivotIndices:b?[h-1,h]:[h,h+1],prevLayout:c,trigger:"imperative-api"})},l=(a)=>{let u=o();if(a===u)return;let{defaultLayoutDeferred:c,derivedPanelConstraints:f,group:d,groupSize:h,layout:m,separatorToPanels:b}=n(),x=s({nextSize:a,panels:d.panels,prevLayout:m,derivedPanelConstraints:f}),g=As({layout:x,panelConstraints:f});Gi(m,g)||Yi(d,{defaultLayoutDeferred:c,derivedPanelConstraints:f,groupSize:h,layout:g,separatorToPanels:b})};return{collapse:()=>{let{collapsible:a,collapsedSize:u}=i(),{mutableValues:c}=r(),f=o();a&&f!==u&&(c.expandToSize=f,l(u))},expand:()=>{let{collapsible:a,collapsedSize:u,minSize:c}=i(),{mutableValues:f}=r(),d=o();if(a&&d===u){let h=f.expandToSize??c;h===0&&(h=1),l(h)}},getSize:()=>{let{group:a}=n(),u=o(),{element:c}=r(),f=a.orientation==="horizontal"?c.offsetWidth:c.offsetHeight;return{asPercentage:u,inPixels:f}},isCollapsed:()=>{let{collapsible:a,collapsedSize:u}=i(),c=o();return a&&bt(u,c)},resize:(a)=>{let{group:u}=n(),{element:c}=r(),f=aa({group:u}),d=sa({groupSize:f,panelElement:c,styleProp:a}),h=zt(d/f*100);l(h)}}}function nO(e){if(e.defaultPrevented)return;let t=Oo();e0(e,t).forEach((n)=>{if(n.separator&&!n.separator.disableDoubleClick){let i=n.panels.find((r)=>r.panelConstraints.defaultSize!==void 0);if(i){let r=i.panelConstraints.defaultSize,o=xO({groupId:n.group.id,panelId:i.id});o&&r!==void 0&&(o.resize(r),e.preventDefault())}}})}function Th(e){let t=Oo();for(let[n]of t)if(n.separators.some((i)=>i.element===e))return n;throw Error("Could not find parent Group for separator element")}function wO({groupId:e}){let t=()=>{let n=Oo();for(let[i,r]of n)if(i.id===e)return{group:i,...r};throw Error(`Could not find Group with id "${e}"`)};return{getLayout(){let{defaultLayoutDeferred:n,layout:i}=t();return n?{}:i},setLayout(n){let{defaultLayoutDeferred:i,derivedPanelConstraints:r,group:o,groupSize:s,layout:l,separatorToPanels:a}=t(),u=As({layout:n,panelConstraints:r});return i?l:(Gi(l,u)||Yi(o,{defaultLayoutDeferred:i,derivedPanelConstraints:r,groupSize:s,layout:u,separatorToPanels:a}),u)}}}function Os(e,t){let n=Th(e),i=Eo(n.id,!0),r=n.separators.find((c)=>c.element===e);Ce(r,"Matching separator not found");let o=i.separatorToPanels.get(r);Ce(o,"Matching panels not found");let s=o.map((c)=>n.panels.indexOf(c)),l=wO({groupId:n.id}).getLayout(),a=cc({delta:t,initialLayout:l,panelConstraints:i.derivedPanelConstraints,pivotIndices:s,prevLayout:l,trigger:"keyboard"}),u=As({layout:a,panelConstraints:i.derivedPanelConstraints});Gi(l,u)||Yi(n,{defaultLayoutDeferred:i.defaultLayoutDeferred,derivedPanelConstraints:i.derivedPanelConstraints,groupSize:i.groupSize,layout:u,separatorToPanels:i.separatorToPanels},{isUserInteraction:!0})}function iO(e){if(e.defaultPrevented)return;let t=e.currentTarget,n=Th(t);if(!(n.disabled||n.separators.find((i)=>i.element===t)?.disabled))switch(e.key){case"ArrowDown":{e.preventDefault(),n.orientation==="vertical"&&Os(t,5);break}case"ArrowLeft":{e.preventDefault(),n.orientation==="horizontal"&&Os(t,-5);break}case"ArrowRight":{e.preventDefault(),n.orientation==="horizontal"&&Os(t,5);break}case"ArrowUp":{e.preventDefault(),n.orientation==="vertical"&&Os(t,-5);break}case"End":{e.preventDefault(),Os(t,100);break}case"Enter":{e.preventDefault();let i=Th(t),r=Eo(i.id,!0),{derivedPanelConstraints:o,layout:s,separatorToPanels:l}=r,a=i.separators.find((d)=>d.element===t);Ce(a,"Matching separator not found");let u=l.get(a);Ce(u,"Matching panels not found");let c=u[0],f=o.find((d)=>d.panelId===c.id);if(Ce(f,"Panel metadata not found"),f.collapsible){let d=s[c.id],h=f.collapsedSize===d?i.mutableState.expandedPanelSizes[c.id]??f.minSize:f.collapsedSize;Os(t,h-d)}break}case"F6":{e.preventDefault();let i=Th(t).separators.map((s)=>s.element),r=Array.from(i).findIndex((s)=>s===e.currentTarget);Ce(r!==null,"Index not found");let o=e.shiftKey?r>0?r-1:i.length-1:r+1<i.length?r+1:0;i[o].focus({preventScroll:!0});break}case"Home":{e.preventDefault(),Os(t,-100);break}}}function Y5(e,t){let{element:n,orientation:i,panels:r}=e,o=n.getBoundingClientRect(),s=i==="horizontal";return Qb({expandHitTargets:!1,group:e,includeDisabled:!0}).map(({panels:l,rect:a,separator:u},c)=>{let f=r.indexOf(l[0]),d=s?a.left+a.width/2:a.top+a.height/2;return{active:t.some((h)=>{if(h.group!==e||h.panels[0]!==l[0])return!1;if(u||h.separator)return h.separator===u;let m=s?h.rect.left+h.rect.width/2:h.rect.top+h.rect.height/2;return bt(d,m)}),group:e,key:u?`separator-${u.id}`:`panel-${l[0].id}-${c}`,offset:0,panelIndex:f,rect:new DOMRect((s&&!u?d:a.left)-o.left-n.clientLeft+n.scrollLeft,(!s&&!u?d:a.top)-o.top-n.clientTop+n.scrollTop,s&&!u?0:a.width,!s&&!u?0:a.height),separator:u}})}function rO(e){if(e.defaultPrevented)return;if(e.pointerType==="mouse"&&e.button>0)return;let t=Oo(),n=e0(e,t);if(n.length===0)return;let i=new Map,r=!1;n.forEach((s)=>{s.separator&&(r||(r=!0,s.separator.element.focus({focusVisible:!1,preventScroll:!0})));let l=t.get(s.group);l&&i.set(s.group,l.layout)});let o=Array.from(i.keys()).flatMap((s)=>s.resizePreviewMode==="separator"?Y5(s,n):[]);Xi({cursorFlags:0,didPointerMove:!1,hitRegions:n,initialLayoutMap:i,pointerDownAtPoint:{x:e.clientX,y:e.clientY},previewLayoutMap:new Map(i),previews:o,state:"active"}),e.preventDefault()}function oO(e){let t=Oo(),n=Mr();switch(n.state){case"active":Zb({commit:!1,document:e.currentTarget,event:e,hitRegions:n.hitRegions,initialLayoutMap:n.initialLayoutMap,mountedGroups:t,prevCursorFlags:n.cursorFlags})}}function sO(e){if(e.defaultPrevented)return;let t=Mr(),n=Oo();switch(t.state){case"active":{if(e.buttons===0){t.previewLayoutMap.forEach((i,r)=>{let o=n.get(r);r.resizePreviewMode==="separator"&&o&&!Gi(i,o.layout)&&Yi(r,{...o,layout:i})}),Xi({cursorFlags:0,state:"inactive"}),t.hitRegions.forEach((i)=>{if(!n.has(i.group))return;let r=Eo(i.group.id,!0);Yi(i.group,r,{isUserInteraction:!0})}),uc(e.currentTarget);return}for(let i of t.hitRegions)if(i.separator){let{element:r}=i.separator;r.isConnected&&!r.hasPointerCapture?.(e.pointerId)&&r.setPointerCapture?.(e.pointerId)}Zb({commit:!1,document:e.currentTarget,event:e,hitRegions:t.hitRegions,initialLayoutMap:t.initialLayoutMap,mountedGroups:n,pointerDownAtPoint:t.pointerDownAtPoint,prevCursorFlags:t.cursorFlags});break}default:{let i=e0(e,n);i.length===0?t.state!=="inactive"&&Xi({cursorFlags:0,state:"inactive"}):Xi({cursorFlags:0,hitRegions:i,state:"hover"}),uc(e.currentTarget);break}}}function lO(e){if(e.relatedTarget instanceof HTMLIFrameElement)switch(Mr().state){case"hover":Xi({cursorFlags:0,state:"inactive"})}}function aO(e){if(e.defaultPrevented)return;if(e.pointerType==="mouse"&&e.button>0)return;bO(e.currentTarget,e)&&e.preventDefault()}function W5(e){let t=0,n=0,i={};for(let o of e)if(o.defaultSize!==void 0){t++;let s=zt(o.defaultSize);n+=s,i[o.panelId]=s}else i[o.panelId]=void 0;let r=e.length-t;if(r!==0){let o=zt((100-n)/r);for(let s of e)s.defaultSize===void 0&&(i[s.panelId]=o)}return i}function Q5(e,t){let n=e.map((r)=>r.id),i=Object.keys(t);if(n.length!==i.length)return!1;for(let r of n)if(!i.includes(r))return!1;return!0}function uO({group:e,panelConstraints:t}){let n=e.panels.map(({id:r})=>r).join(","),i=e.mutableState.defaultLayout;return e.mutableState.layouts[n]??(i&&Q5(e.panels,i)?i:W5(t))}function J5(e,t,n){if(!n[0])return;let i=e.panels.find((a)=>a.element===t);if(!i||!i.onResize)return;let r=aa({group:e}),o=e.orientation==="horizontal"?i.element.offsetWidth:i.element.offsetHeight,s=i.mutableValues.prevSize,l={asPercentage:zt(o/r*100),inPixels:o};i.mutableValues.prevSize=l,i.onResize(l,i.id,s)}function SO(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(e[n]!==t[n])return!1;return!0}function Z5(e,t){return e.length!==t.length?!1:e.every((n,i)=>SO(n,t[i]))}function eP({group:e,nextGroupSize:t,prevGroupSize:n,prevLayout:i}){if(n<=0||t<=0||n===t)return i;let r=0,o=0,s=!1,l=new Map,a=[];for(let f of e.panels){let d=i[f.id]??0;switch(f.panelConstraints.groupResizeBehavior){case"preserve-pixel-size":{s=!0;let h=d/100*n,m=zt(h/t*100);l.set(f.id,m),r+=m;break}case"preserve-relative-size":default:{a.push(f.id),o+=d;break}}}if(!s||a.length===0)return i;let u=100-r,c={...i};if(l.forEach((f,d)=>{c[d]=f}),o>0)for(let f of a){let d=i[f]??0;c[f]=zt(d/o*u)}else{let f=zt(u/a.length);for(let d of a)c[d]=f}return c}var oa=new Map;function tP(e){let t=!0;Ce(e.element.ownerDocument.defaultView,"Cannot register an unmounted Group");let n=e.element.ownerDocument.defaultView.ResizeObserver,i=new Set,r=new Set,o=new n((d)=>{for(let h of d){let{borderBoxSize:m,target:b}=h;if(b===e.element){if(t){let x=aa({group:e});if(x===0)return;let g=Eo(e.id);if(!g)return;let v=$b(e),w=g.defaultLayoutDeferred?uO({group:e,panelConstraints:v}):g.layout,S=eP({group:e,nextGroupSize:x,prevGroupSize:g.groupSize,prevLayout:w}),k=As({layout:S,panelConstraints:v});if(!g.defaultLayoutDeferred&&Gi(g.layout,k)&&Z5(g.derivedPanelConstraints,v)&&g.groupSize===x)continue;Yi(e,{defaultLayoutDeferred:!1,derivedPanelConstraints:v,groupSize:x,layout:k,separatorToPanels:g.separatorToPanels})}}else J5(e,b,m)}});o.observe(e.element),e.panels.forEach((d)=>{Ce(!i.has(d.id),`Panel ids must be unique; id "${d.id}" was used more than once`),i.add(d.id),d.onResize&&o.observe(d.element)});let s=aa({group:e}),l=$b(e),a=uO({group:e,panelConstraints:l}),u=As({layout:a,panelConstraints:l}),c=e.element.ownerDocument;oa.set(c,(oa.get(c)??0)+1);let f=new Map;return Qb({group:e,includeDisabled:!0}).forEach((d)=>{d.separator&&f.set(d.separator,d.panels)}),Yi(e,{defaultLayoutDeferred:s===0,derivedPanelConstraints:l,groupSize:s,layout:u,separatorToPanels:f}),e.separators.forEach((d)=>{Ce(!r.has(d.id),`Separator ids must be unique; id "${d.id}" was used more than once`),r.add(d.id),d.element.addEventListener("keydown",iO)}),oa.get(c)===1&&(c.addEventListener("contextmenu",JE,!0),c.addEventListener("dblclick",nO,!0),c.addEventListener("pointerdown",rO,!0),c.addEventListener("pointerleave",oO),c.addEventListener("pointermove",sO),c.addEventListener("pointerout",lO),c.addEventListener("pointerup",aO,!0)),function(){t=!1,oa.set(c,Math.max(0,(oa.get(c)??0)-1)),I5(e),M5(e)&&uc(c),e.separators.forEach((d)=>{d.element.removeEventListener("keydown",iO)}),oa.get(c)||(c.removeEventListener("contextmenu",JE,!0),c.removeEventListener("dblclick",nO,!0),c.removeEventListener("pointerdown",rO,!0),c.removeEventListener("pointerleave",oO),c.removeEventListener("pointermove",sO),c.removeEventListener("pointerout",lO),c.removeEventListener("pointerup",aO,!0)),o.disconnect()}}function nP(){let[e,t]=Q({}),n=st(()=>t({}),[]);return[e,n]}function t0(e){let t=Df();return`${e??t}`}var di=typeof window<"u"?ti:Z;function ac(e){let t=X(e);return di(()=>{t.current=e},[e]),st((...n)=>t.current?.(...n),[t])}function n0(...e){return ac((t)=>{e.forEach((n)=>{if(n)switch(typeof n){case"function":{n(t);break}case"object":{n.current=t;break}}})})}function i0(e){let t=X({...e});return di(()=>{for(let n in e)t.current[n]=e[n]},[e]),t.current}var kO=Kr(null);function iP({separator:e}){let{element:t}=e,n=X(null);return di(()=>{let i=t.cloneNode(!0),r=[t,...t.querySelectorAll("*")],o=[i,...i.querySelectorAll("*")],s=t.ownerDocument.defaultView;return r.forEach((l,a)=>{let u=o[a];if(u instanceof s.HTMLElement||u instanceof s.SVGElement){let c=s.getComputedStyle(l);for(let f=0;f<c.length;f++){let d=c.item(f);u.style.setProperty(d,c.getPropertyValue(d))}}u.removeAttribute("data-testid"),u.removeAttribute("id")}),Object.assign(i.style,{boxSizing:"border-box",height:"100%",margin:"0",position:"static",transform:"none",width:"100%"}),n.current.appendChild(i),()=>i.remove()},[t]),p("div",{ref:n,style:{height:"100%",opacity:0.65,pointerEvents:"none",width:"100%"}})}function Nh(){let e=qr(kO);return Ce(e,"Group Context not found; did you render a Panel or Separator outside of a Group?"),e}function _O(e){let{registerOverlay:t}=Nh(),n=X(e);SO(n.current,e)||(n.current=e);let i=n.current;return di(()=>t(i),[t,i]),null}_O.displayName="SeparatorOverlay";function rP({active:e,orientation:t,style:n,...i}){let r;switch(t){case"horizontal":{r={height:"100%",minWidth:"1px"};break}case"vertical":{r={minHeight:"1px",width:"100%"};break}}return p("div",{...i,"data-separator-overlay":e?"active":"inactive",style:{...r,...n,flexShrink:0,pointerEvents:"none"}})}function oP({overlay:e,preview:t}){let{group:n,offset:i,rect:r,separator:o}=t,s=n.orientation==="horizontal",l=o?.preview,a=e;return Nf(l)&&l.type===_O&&(a=l.props,l=void 0),l==null&&(a?l=p(rP,{...a,active:t.active,orientation:n.orientation}):o&&(l=p(iP,{separator:o}))),p("div",{"aria-hidden":"true","data-resize-preview":!0,inert:!0,style:{height:r.height,left:r.left,pointerEvents:"none",position:"absolute",top:r.top,transform:s?`translateX(${i}px)`:`translateY(${i}px)`,width:r.width},children:l})}function sP(e,t){let n=X({getLayout:()=>({}),setLayout:N5});Wa(t,()=>n.current,[]),di(()=>{Object.assign(n.current,wO({groupId:e}))})}function lP({groupId:e,resizePreviewMode:t}){let[n,i]=Q([]),r=X(n);return di(()=>{let o=(l)=>{let a=vO(e),u=t==="separator"&&l.state==="active"?l.previews.filter((f)=>f.group===a&&(f.active||!bt(f.offset,0))):[],c=r.current;c.length===u.length&&u.every((f,d)=>f===c[d])||(r.current=u,i(u))};if(t!=="separator"){o(Mr());return}let s=cO(({next:l})=>o(l));return o(Mr()),s},[e,t]),n}function Dh({children:e,className:t,defaultLayout:n,disableCursor:i,disabled:r,elementRef:o,groupRef:s,id:l,onLayoutChange:a,onLayoutChanged:u,orientation:c="horizontal",resizePreviewMode:f="panel",resizeTargetMinimumSize:d={coarse:20,fine:10},style:h,...m}){let b=X({onLayoutChange:{},onLayoutChanged:{}}),x=ac((D)=>{Gi(b.current.onLayoutChange,D)||(b.current.onLayoutChange=D,a?.(D))}),g=ac((D,H)=>{Gi(b.current.onLayoutChanged,D)||(b.current.onLayoutChanged=D,u?.(D,{isUserInteraction:H}))}),v=t0(l),[w,S]=Q(),k=lP({groupId:v,resizePreviewMode:f}),E=X(null),[_,O]=nP(),P=X({lastExpandedPanelSizes:{},layouts:{},panels:[],separators:[]}),T=n0(E,o);sP(v,s);let I=ac((D,H)=>{let G=Eo(D);if(G)return{flexGrow:G.layout[H]??1};if(n?.[H])return{flexGrow:n?.[H]}}),V=i0({defaultLayout:n,disableCursor:i,resizeTargetMinimumSize:d}),Y=Ke(()=>({get disableCursor(){return!!V.disableCursor},getPanelStyles:I,id:v,orientation:c,registerPanel:(D)=>{let H=P.current;return H.panels=Xb(c,[...H.panels,D]),O(),()=>{H.panels=H.panels.filter((G)=>G!==D),O()}},registerOverlay:(D)=>(S(D),()=>{S(void 0)}),registerSeparator:(D)=>{let H=P.current;return H.separators=Xb(c,[...H.separators,D]),O(),()=>{H.separators=H.separators.filter((G)=>G!==D),O()}},updatePanelProps:(D,{disabled:H})=>{let G=P.current.panels.find((he)=>he.id===D);G&&(G.panelConstraints.disabled=H);let L=vO(v),ee=Eo(v);L&&ee&&Yi(L,{...ee,derivedPanelConstraints:$b(L)})},updateSeparatorProps:(D,{disabled:H,disableDoubleClick:G})=>{let L=P.current.separators.find((ee)=>ee.id===D);L&&(L.disabled=H,L.disableDoubleClick=G)}}),[I,v,O,c,V]),N=X(null);return di(()=>{let D=E.current;if(D===null)return;let H=P.current,G;if(V.defaultLayout!==void 0&&Object.keys(V.defaultLayout).length===H.panels.length){G={};for(let $e of H.panels){let Ae=V.defaultLayout[$e.id];Ae!==void 0&&(G[$e.id]=Ae)}}let L={disabled:!!r,element:D,id:v,mutableState:{defaultLayout:G,disableCursor:!!V.disableCursor,expandedPanelSizes:P.current.lastExpandedPanelSizes,layouts:P.current.layouts},orientation:c,panels:H.panels,resizePreviewMode:f,get resizeTargetMinimumSize(){return V.resizeTargetMinimumSize},separators:H.separators};N.current=L;let ee=tP(L),{defaultLayoutDeferred:he,derivedPanelConstraints:He,layout:qe}=Eo(L.id,!0);!he&&He.length>0&&(x(qe),g(qe,!1));let dt=Jb(v,($e)=>{let{defaultLayoutDeferred:Ae,derivedPanelConstraints:tt,layout:St}=$e.next;if(Ae||tt.length===0)return;let qa=L.panels.map(({id:Nt})=>Nt).join(",");L.mutableState.layouts[qa]=St,tt.forEach((Nt)=>{if(Nt.collapsible){let{layout:Ur}=$e.prev??{};if(Ur){let $a=bt(Nt.collapsedSize,St[Nt.panelId]),C=bt(Nt.collapsedSize,Ur[Nt.panelId]);$a&&!C&&(L.mutableState.expandedPanelSizes[Nt.panelId]=Ur[Nt.panelId])}}});let Xs=Mr(),qo=Xs.state!=="active"||!Xs.hitRegions.some((Nt)=>Nt.group===L);x(St),qo&&g(St,$e.isUserInteraction)});return()=>{N.current=null,ee(),dt()}},[r,v,g,x,c,_,f,V]),Z(()=>{let D=N.current;D&&(D.mutableState.defaultLayout=n,D.mutableState.disableCursor=!!i)}),p(kO.Provider,{value:Y,children:y("div",{...m,className:t,"data-group":!0,"data-testid":v,id:v,ref:T,style:{height:"100%",width:"100%",overflow:"hidden",position:f==="separator"?"relative":void 0,...h,display:"flex",flexDirection:c==="horizontal"?"row":"column",flexWrap:"nowrap",touchAction:c==="horizontal"?"pan-y":"pan-x"},children:[e,k.map((D)=>p(oP,{overlay:w,preview:D},D.key))]})})}Dh.displayName="Group";function Mh(e,t){return`react-resizable-panels:${[e,...t].join(":")}`}function aP({id:e,panelIds:t,storage:n}){let i=Mh(e,[]),r=n.getItem(i);if(r)try{let o=JSON.parse(r);if(t){let s=t.join(","),l=o[s];if(l&&Array.isArray(l.layout)&&t.length===l.layout.length){let a={};for(let u=0;u<t.length;u++)a[t[u]]=l.layout[u];return a}}else{let s=Object.keys(o);if(s.length===1){let l=o[s[0]];if(l&&Array.isArray(l.layout)){let a=s[0].split(",");if(a.length===l.layout.length){let u={};for(let c=0;c<a.length;c++)u[a[c]]=l.layout[c];return u}}}}}catch{}}function r0({debounceSaveMs:e=100,onlySaveAfterUserInteractions:t,panelIds:n,storage:i=localStorage,...r}){let o=n!==void 0,s="id"in r?r.id:r.groupId,l=Mh(s,n??[]),a=$r(uP,()=>i.getItem(l),()=>i.getItem(l)),u=Ke(()=>{if(a){let x=JSON.parse(a),g=Object.values(x);if(Array.from(g).every((v)=>typeof v=="number"))return x}},[a]),c=Ke(()=>{if(!u)return aP({id:s,panelIds:n,storage:i})},[u,s,n,i]),f=u??c,d=X(null),h=st(()=>{let x=d.current;x&&(d.current=null,clearTimeout(x))},[]);ti(()=>()=>{h()},[h]);let m=st((x,g)=>{if(t&&!g.isUserInteraction)return;h();let v;o?v=Mh(s,Object.keys(x)):v=Mh(s,[]);try{i.setItem(v,JSON.stringify(x))}catch(w){console.error(w)}},[h,o,s,t,i]),b=st((x)=>{h(),e===0?m(x,{isUserInteraction:!1}):d.current=setTimeout(()=>{m(x,{isUserInteraction:!1})},e)},[h,e,m]);return{defaultLayout:f,onLayoutChange:b,onLayoutChanged:m}}function uP(){return function(){}}function cP(e,t){let{id:n}=Nh(),i=X({collapse:qb,expand:qb,getSize:()=>({asPercentage:0,inPixels:0}),isCollapsed:()=>!1,resize:qb});Wa(t,()=>i.current,[]),di(()=>{Object.assign(i.current,xO({groupId:n,panelId:e}))})}function ua({children:e,className:t,collapsedSize:n="0%",collapsedThreshold:i,collapsible:r=!1,defaultSize:o,disabled:s,elementRef:l,groupResizeBehavior:a="preserve-relative-size",id:u,maxSize:c="100%",minSize:f="0%",onResize:d,panelRef:h,style:m,...b}){let x=!!u,g=t0(u),v=i0({disabled:s}),w=X(null),S=n0(w,l),{getPanelStyles:k,id:E,orientation:_,registerPanel:O,updatePanelProps:P}=Nh(),T=d!==null,I=ac((D,H,G)=>{d?.(D,u,G)});di(()=>{let D=w.current;if(D!==null){let H={element:D,id:g,idIsStable:x,mutableValues:{expandToSize:void 0,prevSize:void 0},onResize:T?I:void 0,panelConstraints:{groupResizeBehavior:a,collapsedSize:n,collapsedThreshold:i,collapsible:r,defaultSize:o,disabled:v.disabled,maxSize:c,minSize:f}};return O(H)}},[a,n,i,r,o,T,g,x,c,f,I,O,v]),Z(()=>{P(g,{disabled:s})},[s,g,P]),cP(g,h);let V=()=>{let D=k(E,g);if(D)return JSON.stringify(D)},Y=$r((D)=>Jb(E,D),V,V),N;return Y?N=JSON.parse(Y):o!==void 0?N={flexGrow:void 0,flexShrink:void 0,flexBasis:o}:N={flexGrow:1},p("div",{...b,"data-disabled":s||void 0,"data-panel":!0,"data-testid":g,id:g,ref:S,style:{...fP,display:"flex",flexBasis:0,flexShrink:1,overflow:"visible",...N},children:p("div",{className:t,style:{maxHeight:"100%",maxWidth:"100%",flexGrow:1,overflow:"auto",...m,touchAction:_==="horizontal"?"pan-y":"pan-x"},children:e})})}ua.displayName="Panel";var fP={minHeight:0,maxHeight:"100%",height:"auto",minWidth:0,maxWidth:"100%",width:"auto",border:"none",borderWidth:0,padding:0,margin:0};function CO(){return X(null)}function dP({layout:e,panelConstraints:t,panelId:n,panelIndex:i}){let r,o,s=e[n],l=t.find((a)=>a.panelId===n);if(l){let a=l.maxSize,u=l.collapsible?l.collapsedSize:l.minSize,c=[i,i+1];o=As({layout:cc({delta:u-s,initialLayout:e,panelConstraints:t,pivotIndices:c,prevLayout:e}),panelConstraints:t})[n],r=As({layout:cc({delta:a-s,initialLayout:e,panelConstraints:t,pivotIndices:c,prevLayout:e}),panelConstraints:t})[n]}return{valueControls:n,valueMax:r,valueMin:o,valueNow:s}}function Lh({children:e,className:t,disabled:n,disableDoubleClick:i,elementRef:r,id:o,preview:s,style:l,...a}){let u=t0(o),c=i0({disabled:n,disableDoubleClick:i,children:e,className:t,preview:s,style:l}),[f,d]=Q({}),[h,m]=Q("inactive"),[b,x]=Q(!1),g=X(null),v=X(null),w=n0(g,r),{disableCursor:S,id:k,orientation:E,registerSeparator:_,updateSeparatorProps:O}=Nh(),P=E==="horizontal"?"vertical":"horizontal";di(()=>{let V=g.current;if(V!==null){let Y={disabled:c.disabled,disableDoubleClick:c.disableDoubleClick,element:V,id:u,get children(){return c.children},get className(){return c.className},get preview(){return c.preview},get style(){return c.style}};v.current=Y;let N=_(Y),D=cO((G)=>{m(G.next.state!=="inactive"&&G.next.hitRegions.some((L)=>L.separator===Y)?G.next.state:"inactive")}),H=Jb(k,(G)=>{let{derivedPanelConstraints:L,layout:ee,separatorToPanels:he}=G.next,He=he.get(Y);if(He){let qe=He[0],dt=L.findIndex(($e)=>$e.panelId===qe.id);d(dP({layout:ee,panelConstraints:L,panelId:qe.id,panelIndex:dt}))}});return()=>{v.current=null,D(),H(),N()}}},[k,u,_,c]),di(()=>{let V=v.current;V&&T5(V)},[s]),Z(()=>{O(u,{disabled:n,disableDoubleClick:i})},[n,i,u,O]);let T;n&&!S&&(T="not-allowed");let I;if(n)I="disabled";else switch(h){case"active":{I="active";break}default:b?I="focus":I=h}return p("div",{...a,"aria-controls":f.valueControls,"aria-disabled":n||void 0,"aria-orientation":P,"aria-valuemax":f.valueMax,"aria-valuemin":f.valueMin,"aria-valuenow":f.valueNow,children:e,className:t,"data-separator":I,"data-testid":u,id:u,onBlur:()=>x(!1),onFocus:()=>x(!0),ref:w,role:"separator",style:{flexBasis:"auto",cursor:T,...l,flexGrow:0,flexShrink:0,touchAction:"none"},tabIndex:n?void 0:0})}Lh.displayName="Separator";var hP={close:p("path",{d:"M6 6l12 12M18 6L6 18"}),check:p("path",{d:"M5 12.5l4.5 4.5L19 7.5"}),trash:p("path",{d:"M4 7h16M10 7V5h4v2M6 7l1 12h10l1-12M10 11v5M14 11v5"}),copy:p("path",{d:"M9 9h10v10H9zM5 15V5h10"}),external:p("path",{d:"M14 5h5v5M19 5l-8 8M18 14v5H5V6h5"}),dice:y(ie,{children:[p("rect",{x:"4",y:"4",width:"16",height:"16",rx:"3"}),p("circle",{cx:"9",cy:"9",r:"1.3",fill:"currentColor",stroke:"none"}),p("circle",{cx:"15",cy:"15",r:"1.3",fill:"currentColor",stroke:"none"}),p("circle",{cx:"12",cy:"12",r:"1.3",fill:"currentColor",stroke:"none"})]}),image:y(ie,{children:[p("rect",{x:"3",y:"5",width:"18",height:"14",rx:"2"}),p("circle",{cx:"8.5",cy:"10",r:"1.5"}),p("path",{d:"M4 17l5-5 4 4 3-2 4 4"})]}),tag:y(ie,{children:[p("path",{d:"M4 11V4h7l9 9-7 7-9-9z"}),p("circle",{cx:"8",cy:"8",r:"1.3",fill:"currentColor",stroke:"none"})]}),sparkle:p("path",{d:"M12 3l1.9 5.1L19 10l-5.1 1.9L12 17l-1.9-5.1L5 10l5.1-1.9zM18 15l.8 2.2L21 18l-2.2.8L18 21l-.8-2.2L15 18l2.2-.8z"}),play:p("path",{d:"M7 4l13 8-13 8z",fill:"currentColor",stroke:"none"}),pause:p("path",{d:"M8 5v14M16 5v14"}),stop:p("rect",{x:"6",y:"6",width:"12",height:"12",rx:"1.5",fill:"currentColor",stroke:"none"}),save:p("path",{d:"M5 4h11l3 3v13H5zM8 4v6h7V4M8 20v-6h8v6"}),ghost:p("path",{d:"M5 20V10a7 7 0 0114 0v10l-2.3-2-2.4 2-2.3-2-2.4 2zM9.5 10h.01M14.5 10h.01"}),"panel-off":y(ie,{children:[p("rect",{x:"3",y:"4",width:"18",height:"16",rx:"2"}),p("path",{d:"M4 5l16 14"})]}),"panel-bottom":y(ie,{children:[p("rect",{x:"3",y:"4",width:"18",height:"16",rx:"2"}),p("path",{d:"M3 14h18"}),p("rect",{x:"4.5",y:"15.5",width:"15",height:"3",fill:"currentColor",stroke:"none",opacity:"0.85"})]}),"panel-side":y(ie,{children:[p("rect",{x:"3",y:"4",width:"18",height:"16",rx:"2"}),p("path",{d:"M14 4v16"}),p("rect",{x:"15.5",y:"5.5",width:"4",height:"13",fill:"currentColor",stroke:"none",opacity:"0.85"})]}),"panel-left":y(ie,{children:[p("rect",{x:"3",y:"4",width:"18",height:"16",rx:"2"}),p("path",{d:"M10 4v16"}),p("rect",{x:"4.5",y:"5.5",width:"4",height:"13",fill:"currentColor",stroke:"none",opacity:"0.85"})]}),"panel-corner":y(ie,{children:[p("rect",{x:"3",y:"4",width:"18",height:"16",rx:"2"}),p("rect",{x:"12.5",y:"12.5",width:"7",height:"6",fill:"currentColor",stroke:"none",opacity:"0.85"})]}),swap:p("path",{d:"M4 8h13l-3-3M20 16H7l3 3"}),plus:p("path",{d:"M12 5v14M5 12h14"}),"copy-plus":p("path",{d:"M9 9h10v10H9zM5 15V5h10M14 12v4M12 14h4"}),pen:p("path",{d:"M4 20h4L20 8l-4-4L4 16zM14 6l4 4"}),broom:p("path",{d:"M19 4l-7 7M9.5 8.5l6 6-5 5-6-6zM4.5 13.5L2 21l7.5-2.5"}),expand:p("path",{d:"M4 9V4h5M20 15v5h-5M15 4h5v5M9 20H4v-5"}),shrink:p("path",{d:"M9 4v5H4M15 20v-5h5M20 9h-5V4M4 15h5v5"}),power:p("path",{d:"M12 3v9M7.5 6.5a7 7 0 109 0"}),warn:p("path",{d:"M12 4l9 16H3zM12 10v4M12 17h.01"}),link:p("path",{d:"M10 14a4 4 0 015.7 0l2.6-2.6a4 4 0 10-5.7-5.7L11 7.3M14 10a4 4 0 01-5.7 0l-2.6 2.6a4 4 0 105.7 5.7L13 16.7"}),unlink:p("path",{d:"M9 15l-1.6 1.6a4 4 0 01-5.7-5.7L3.3 9.3M15 9l1.6-1.6a4 4 0 015.7 5.7L20.7 14.7M4 4l16 16"}),grip:y(ie,{children:[p("circle",{cx:"9",cy:"6",r:"1.4",fill:"currentColor",stroke:"none"}),p("circle",{cx:"15",cy:"6",r:"1.4",fill:"currentColor",stroke:"none"}),p("circle",{cx:"9",cy:"12",r:"1.4",fill:"currentColor",stroke:"none"}),p("circle",{cx:"15",cy:"12",r:"1.4",fill:"currentColor",stroke:"none"}),p("circle",{cx:"9",cy:"18",r:"1.4",fill:"currentColor",stroke:"none"}),p("circle",{cx:"15",cy:"18",r:"1.4",fill:"currentColor",stroke:"none"})]}),refresh:p("path",{d:"M20 11a8 8 0 10-2 6M20 6v5h-5"}),terminal:p("path",{d:"M4 5h16v14H4zM7 9l3 3-3 3M13 15h4"}),text:p("path",{d:"M4 7h16M4 12h10M4 17h13"}),more:p("path",{d:"M5 12h.01M12 12h.01M19 12h.01",strokeWidth:3.2}),eye:p("path",{d:"M2 12s3.5-7 10-7 10 7 10 7-3.5 7-10 7S2 12 2 12zM12 9a3 3 0 110 6 3 3 0 010-6z"}),"eye-off":p("path",{d:"M3 3l18 18M10.6 5.1A10 10 0 0112 5c6.5 0 10 7 10 7a17 17 0 01-3.2 4.2M6.6 6.6C3.9 8.4 2 12 2 12s3.5 7 10 7a9.7 9.7 0 005.4-1.6M9.9 9.9a3 3 0 004.2 4.2"}),rows:p("path",{d:"M4 5h16v6H4zM4 13h16v6H4z"}),grid:p("path",{d:"M4 4h7v7H4zM13 4h7v7h-7zM4 13h7v7H4zM13 13h7v7h-7z"}),search:p("path",{d:"M10.5 4a6.5 6.5 0 110 13 6.5 6.5 0 010-13zM15.5 15.5L20 20"}),history:p("path",{d:"M4 12a8 8 0 102.3-5.6M4 4v4h4M12 8v4l3 2"}),dot:p("circle",{cx:"12",cy:"12",r:"5",fill:"currentColor",stroke:"none"}),audio:p("path",{d:"M3 12h2M7 8v8M11 4v16M15 7v10M19 10v4M21 12h0"}),video:y(ie,{children:[p("rect",{x:"3",y:"6",width:"13",height:"12",rx:"2"}),p("path",{d:"M16 10l5-3v10l-5-3z"})]}),workflow:y(ie,{children:[p("rect",{x:"3",y:"4",width:"6",height:"5",rx:"1.2"}),p("rect",{x:"15",y:"4",width:"6",height:"5",rx:"1.2"}),p("rect",{x:"9",y:"15",width:"6",height:"5",rx:"1.2"}),p("path",{d:"M6 9v2.5a1.5 1.5 0 001.5 1.5h9a1.5 1.5 0 001.5-1.5V9M12 13v2"})]}),draft:p("path",{d:"M6 3h8l4 4v14H6zM14 3v4h4M9 12h6M9 16h4"}),folder:p("path",{d:"M3 6.5A1.5 1.5 0 014.5 5H9l2 2h8.5A1.5 1.5 0 0121 8.5v9a1.5 1.5 0 01-1.5 1.5h-15A1.5 1.5 0 013 17.5z"}),"folder-tree":p("path",{d:"M4 4v14a2 2 0 002 2h2M4 10h4M10 7h3l1 1.5h6V12H10zM10 16h3l1 1.5h6V21H10z"}),server:y(ie,{children:[p("rect",{x:"3",y:"4",width:"18",height:"7",rx:"1.5"}),p("rect",{x:"3",y:"13",width:"18",height:"7",rx:"1.5"}),p("path",{d:"M7 7.5h.01M7 16.5h.01M11 7.5h6M11 16.5h6"})]}),menu:p("path",{d:"M4 7h16M4 12h16M4 17h16"})};function B(e){return y("svg",{className:"icon",viewBox:"0 0 24 24",width:`${e.size??1.15}em`,height:`${e.size??1.15}em`,fill:"none",stroke:"currentColor",strokeWidth:1.8,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":e.title==null,role:e.title==null?void 0:"img",children:[e.title==null?null:p("title",{children:e.title}),hP[e.name]]})}var Me=/mac|iphone|ipad/i.test(navigator.userAgent)?"⌘":"Ctrl+";var Bt={"focus-prompt":"P","open-loras":"O","open-enhancer":"E","rename-draft":"F2","duplicate-draft":"D","toggle-menu":"B","toggle-blur":"U"},o0=(e)=>/^F\d{1,2}$/.test(e);function zh(e){let t=Bt[e];return o0(t)?t:`${Me}${t}`}function EO(e){return(e.metaKey||e.ctrlKey)&&!e.altKey&&!e.shiftKey&&(e.key.toUpperCase()==="K"||e.key.toUpperCase()==="J")}function Bh(e){let t=!(e.metaKey||e.ctrlKey||e.altKey||e.shiftKey);for(let[i,r]of Object.entries(Bt))if(o0(r)&&t&&e.key===r)return i;if(!(e.metaKey||e.ctrlKey)||e.altKey)return null;let n=e.key.toUpperCase();for(let[i,r]of Object.entries(Bt)){if(o0(r))continue;let o=r.startsWith("⇧");if(o===e.shiftKey&&r.slice(o?1:0)===n)return i}return null}function OO(e){let t=(n)=>e.find((i)=>i.kind===n&&!i.inactive)?.name??null;return{prompt:t("prompt"),loras:t("loras")}}var s0={enhance:"E",apply:"I"};function AO(e){if(!(e.metaKey||e.ctrlKey)||e.altKey||e.shiftKey)return null;let t=e.key.toUpperCase();for(let[n,i]of Object.entries(s0))if(i===t)return n;return null}async function Ee(e,t){let n=await fetch(e,t),i=await n.json().catch(()=>null);if(!n.ok||i==null)throw Error(i?.error??`http ${n.status} on ${e}`);return i}function l0(){return Ee("/drafts")}function RO(e){return Ee(`/drafts/${encodeURIComponent(e.module)}/${encodeURIComponent(e.draft)}`)}function TO(e){return Ee(`/generate/${encodeURIComponent(e.module)}/${encodeURIComponent(e.draft)}`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(e.payload)})}function MO(e){return Ee(`/preview/${encodeURIComponent(e.module)}`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(e.values),signal:e.signal})}function fc(e,t={}){return Ee(`/drafts/${encodeURIComponent(e.module)}/${encodeURIComponent(e.draft)}`,{method:"PUT",headers:{"content-type":"application/json"},body:JSON.stringify(e.values),keepalive:t.keepalive===!0})}function NO(){return Ee("/tabs")}function DO(e){return Ee("/tabs",{method:"PUT",headers:{"content-type":"application/json"},body:JSON.stringify({tabs:e})})}function a0(e){return Ee(`/drafts/${encodeURIComponent(e.module)}/${encodeURIComponent(e.draft)}`,{method:"DELETE"})}function LO(e){return Ee(`/run/${encodeURIComponent(e.module)}`)}function dc(e){return`/run/${encodeURIComponent(e.module)}/preview?t=${e.tick}`}function u0(e){return Ee(`/lora-info/${encodeURIComponent(e.host)}/${encodeURIComponent(e.name)}`)}function zO(e){return Ee(`/lora-about/${encodeURIComponent(e.host)}/${encodeURIComponent(e.name)}`)}function c0(e){return`/lora-preview/${encodeURIComponent(e.host)}/${encodeURIComponent(e.name)}`}function BO(){return Ee("/settings")}function PO(e){return Ee("/settings",{method:"PUT",headers:{"content-type":"application/json"},body:JSON.stringify(e)})}function IO(){return Ee("/hosts")}function VO(e){return Ee(`/hosts/${encodeURIComponent(e.host)}/ping`)}function HO(e){return Ee(`/hosts/${encodeURIComponent(e.host)}/${e.action}`,{method:"POST"})}function UO(e){return Ee(`/hosts/${encodeURIComponent(e.host)}/drift${e.full?"?full=1":""}`)}function jO(e){return Ee(`/hosts/${encodeURIComponent(e.host)}/lora-civitai/${encodeURIComponent(e.lora)}`,{method:"POST"})}function KO(e){return Ee(`/hosts/${encodeURIComponent(e.host)}/logs`)}function FO(e){return Ee(`/hosts/${encodeURIComponent(e.module)}`,{method:"PUT",headers:{"content-type":"application/json"},body:JSON.stringify({host:e.host})})}function qO(){return Ee("/prompt-enhancers")}function $O(e){return Ee(`/prompt-enhancers/${encodeURIComponent(e.name)}`,{method:"PUT",headers:{"content-type":"application/json"},body:JSON.stringify({text:e.text})})}function XO(e){return Ee(`/prompt-enhancers/${encodeURIComponent(e.name)}`,{method:"DELETE"})}function GO(){return Ee("/llm-configs")}function YO(e){return Ee(`/llm-configs/${encodeURIComponent(e.name)}`,{method:"PUT",headers:{"content-type":"application/json"},body:JSON.stringify(e.config)})}function WO(e){return Ee(`/llm-configs/${encodeURIComponent(e.name)}`,{method:"DELETE"})}async function QO(e){let t=new Uint8Array(await e.file.arrayBuffer()),n="";for(let i=0;i<t.length;i+=32768)n+=String.fromCharCode(...t.subarray(i,i+32768));return Ee("/upload",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({name:e.file.name,dataBase64:btoa(n)})})}function JO(e){let t=new URLSearchParams({q:e.q,limit:String(e.limit??20)});return Ee(`/tags/${encodeURIComponent(e.module)}/${encodeURIComponent(e.varName)}?${t}`,{signal:e.signal})}function f0(e){let t={};if(typeof e==="object"&&e!==null&&!Array.isArray(e)){for(let[n,i]of Object.entries(e))if(typeof i==="string")t[n]=i}return t}function ca(e,t){let n=/^(.*?)(\d+)$/.exec(e);if(n==null)return ca(`${e}-1`,t);let i=n[1]??"",r=n[2]??"";for(let o=Number(r)+1;;o++){let s=`${i}${String(o).padStart(r.length,"0")}`;if(!t.includes(s))return s}}function Ph(e){if(e==="openrouter")return"https://openrouter.ai/api/v1";return e==="openwebui"?"http://localhost:3000":"http://localhost:8080/v1"}function ZO(e){return e.trim().replace(/\/+$/,"")}function eA(e){let t=ZO(e.baseUrl)===""?Ph(e.provider):ZO(e.baseUrl);return e.provider==="openwebui"?`${t}/api`:t}function pP(e){return`${eA(e)}/models`}function mP(e){return`${eA(e)}/chat/completions`}function fa(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)?e:{}}function Nr(e){return typeof e==="string"?e:""}function gP(e){let t=fa(e).data;if(!Array.isArray(t))return[];let n=[];for(let i of t){let r=fa(i),o=Nr(r.id);if(o==="")continue;let s=r.supported_parameters,l=Array.isArray(s)?s.includes("reasoning"):null;n.push({id:o,name:Nr(r.name)===""?o:Nr(r.name),reasoning:l})}return n.sort((i,r)=>i.id.localeCompare(r.id)),n}async function tA(e,t){let n=await e.text().catch(()=>"");return Error(`llm ${t} failed: http ${e.status} ${n.slice(0,300)}`)}function nA(e,t){if(e instanceof Error&&e.name==="AbortError")return e;let n=e instanceof Error?e.message:String(e);return Error(`could not reach ${t} (${n}) — is it running, and does it allow this origin? open webui needs CORS_ALLOW_ORIGIN`)}async function d0(e){let t=pP(e),n;try{n=await fetch(t,{headers:iA(e)})}catch(i){throw nA(i,t)}if(!n.ok)throw await tA(n,"model list");return gP(await n.json())}function iA(e){return e.key.trim()===""?{}:{Authorization:`Bearer ${e.key.trim()}`}}function vP(e){let t=e.provider==="openrouter"&&e.effort!=="off"?{reasoning:{effort:e.effort}}:e.provider==="openai"?{chat_template_kwargs:{enable_thinking:e.effort!=="off"}}:{};return{model:e.model,stream:!0,messages:[{role:"system",content:e.system},{role:"user",content:e.user}],...t}}function bP(e){let t=e.split(`
10
- `),n=t.pop()??"",i=[];for(let r of t){let o=r.trim();if(o===""||o.startsWith(":"))continue;if(o.startsWith("data:"))i.push(o.slice(5).trim())}return{events:i,rest:n}}function yP(e){if(e===""||e==="[DONE]")return null;let t;try{t=JSON.parse(e)}catch{return null}let n=fa(t),i=fa(n.error);if(Nr(i.message)!=="")throw Error(`llm stream error: ${Nr(i.message)}`);let r=n.choices;if(!Array.isArray(r))return null;let o=fa(fa(r[0]).delta),s=Nr(o.content),l=Nr(o.reasoning)===""?Nr(o.reasoning_content):Nr(o.reasoning);if(s===""&&l==="")return null;return{content:s,reasoning:l}}class rA{inside=!1;pending="";feed(e){let t=this.pending+e;this.pending="";let n="",i="";for(;;){let o=this.inside?"</think>":"<think>",s=t.indexOf(o);if(s===-1)break;let l=t.slice(0,s);if(this.inside)i+=l;else n+=l;t=t.slice(s+o.length),this.inside=!this.inside}let r=xP(t);if(r!==-1)this.pending=t.slice(r),t=t.slice(0,r);if(this.inside)i+=t;else n+=t;return{content:n,reasoning:i}}flush(){let e=this.pending;return this.pending="",this.inside?{content:"",reasoning:e}:{content:e,reasoning:""}}}function xP(e){let t=e.lastIndexOf("<");if(t===-1)return-1;let n=e.slice(t);return"<think>".startsWith(n)||"</think>".startsWith(n)?t:-1}async function oA(e){if(e.endpoint.provider==="openrouter"&&e.endpoint.key.trim()==="")throw Error("no openrouter api key — paste one in the enhancer settings");if(e.model.trim()==="")throw Error("no model selected");let t=mP(e.endpoint),n;try{n=await fetch(t,{method:"POST",headers:{...iA(e.endpoint),"content-type":"application/json"},body:JSON.stringify(vP({...e,provider:e.endpoint.provider})),signal:e.signal})}catch(u){throw nA(u,t)}if(!n.ok)throw await tA(n,"refine");let i=n.body?.getReader();if(i==null)throw Error("llm refine failed: the response carried no stream");let r=new TextDecoder,o=new rA,s={content:"",reasoning:""},l=(u)=>{if(u.content===""&&u.reasoning==="")return;s.content+=u.content,s.reasoning+=u.reasoning,e.onDelta(u)},a="";for(;;){let u=await i.read();if(u.done)break;a+=r.decode(u.value,{stream:!0});let c=bP(a);a=c.rest;for(let f of c.events){let d=yP(f);if(d==null)continue;let h=o.feed(d.content);l({content:h.content,reasoning:h.reasoning+d.reasoning})}}if(l(o.flush()),s.content.trim()==="")throw Error("the model returned no prompt text — try another model");return s}function h0(e){return e==="openrouter"||e==="openwebui"||e==="openai"}function p0(e){return e==="off"||e==="low"||e==="medium"||e==="high"}var sA={openrouter:"anthropic/claude-sonnet-5",openwebui:"",openai:""};function m0(e){let t=typeof e==="object"&&e!==null&&!Array.isArray(e)?e:{},n=h0(t.provider)?t.provider:"openrouter";return{provider:n,baseUrl:typeof t.baseUrl==="string"&&t.baseUrl.trim()!==""?t.baseUrl.trim():Ph(n),model:typeof t.model==="string"?t.model:sA[n],effort:p0(t.effort)?t.effort:"medium",thinkingOnly:t.thinkingOnly!==!1}}function lA(e,t){if(t===e.provider)return e;return{...e,provider:t,baseUrl:Ph(t),model:sA[t]}}var g0="$enhance";function aA(e,t){return t==null?e:`${e}#${t}`}function uA(e){if(e==null||typeof e!=="object"||Array.isArray(e))return{};let t={};for(let[n,i]of Object.entries(e))if(typeof i==="string"&&i!=="")t[n]=i;return t}var v0=(e)=>{let t=e.trimStart();return t.startsWith("- ")||t.startsWith("// ")};function cA(e){let t=e.split(`
11
- `);return{body:t.filter((n)=>!v0(n)).join(`
12
- `).trim(),kept:t.filter(v0).map((n)=>n.trim())}}function wP(e){let t=new Set;for(let n of e){if(!n.startsWith("- "))continue;for(let i of n.slice(2).split(","))if(i.trim()!=="")t.add(i.trim().toLowerCase())}return t}function b0(e,t){let n=wP(t);return[e.split(`
13
- `).filter((r)=>t.length===0||!v0(r)).map((r)=>{if(n.size===0)return r;let o=r.indexOf(" - ");while(o!==-1){let s=(r.slice(o+3).split(",")[0]??"").trim().toLowerCase();if(n.has(s))return r.slice(0,o).trimEnd();o=r.indexOf(" - ",o+3)}return r}).join(`
8
+ `+i.stack}}var Og=Object.prototype.hasOwnProperty,Nv=Wo,Fm=Mf,vz=Lf,bz=Df,hn=ei,yz=Nf,QS=Rf,JS=Tf,Ed=Yo,xz=Af,ZS=Of,wz=void 0,Sz=void 0,Gu=null,pn=null;function eo(e){if(typeof wz==="function"&&Sz(e),pn&&typeof pn.setStrictMode==="function")try{pn.setStrictMode(Gu,e)}catch(t){}}var mn=Math.clz32?Math.clz32:Cz,{log:kz,LN2:_z}=Math;function Cz(e){return e>>>=0,e===0?32:31-(kz(e)/_z|0)|0}var Uf=256,Kf=262144,jf=4194304;function Zo(e){var t=e&42;if(t!==0)return t;switch(e&-e){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 e&-e;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function Jd(e,t,n){var i=e.pendingLanes;if(i===0)return 0;var r=0,o=e.suspendedLanes,s=e.pingedLanes;e=e.warmLanes;var l=i&134217727;return l!==0?(i=l&~o,i!==0?r=Zo(i):(s&=l,s!==0?r=Zo(s):n||(n=l&~e,n!==0&&(r=Zo(n))))):(l=i&~o,l!==0?r=Zo(l):s!==0?r=Zo(s):n||(n=i&~e,n!==0&&(r=Zo(n)))),r===0?0:t!==0&&t!==r&&(t&o)===0&&(o=r&-r,n=t&-t,o>=n||o===32&&(n&4194048)!==0)?t:r}function Yu(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function ek(e,t){(t&8)!==0&&(t|=t&32);var n=e.entangledLanes;if(n!==0)for(e=e.entanglements,n&=t;0<n;){var i=31-mn(n),r=1<<i;t|=e[i],n&=~r}return t}function Ez(e,t){switch(e){case 1:case 2:case 4:case 8:case 64:return t+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5000;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function tk(){var e=jf;return jf<<=1,(jf&62914560)===0&&(jf=4194304),e}function qm(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function Zd(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function Oz(e,t,n,i,r,o){var s=e.pendingLanes;e.pendingLanes=n,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=n,e.entangledLanes&=n,e.errorRecoveryDisabledLanes&=n,e.shellSuspendCounter=0;var{entanglements:l,expirationTimes:a,hiddenUpdates:u}=e;for(n=s&~n;0<n;){var c=31-mn(n),f=1<<c;l[c]=0,a[c]=-1;var d=u[c];if(d!==null)for(u[c]=null,c=0;c<d.length;c++){var h=d[c];h!==null&&(h.lane&=-536870913)}n&=~f}i!==0&&nk(e,i,0),o!==0&&r===0&&e.tag!==0&&(e.suspendedLanes|=o&~(s&~t))}function nk(e,t,n){e.pendingLanes|=t,e.suspendedLanes&=~t;var i=31-mn(t);e.entangledLanes|=t,e.entanglements[i]=e.entanglements[i]|1073741824|n&261930}function ik(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var i=31-mn(n),r=1<<i;r&t|e[i]&t&&(e[i]|=t),n&=~r}}function rk(e,t){var n=t&-t;return n=(n&42)!==0?1:ok(n),(n&(e.suspendedLanes|t))!==0?0:n}function ok(e){switch(e){case 2:e=1;break;case 8:e=4;break;case 32:e=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:e=128;break;case 268435456:e=134217728;break;default:e=0}return e}function Dv(e){return e&=-e,2<e?8<e?(e&134217727)!==0?32:268435456:8:2}function sk(){var e=be.p;if(e!==0)return e;return e=window.event,e===void 0?32:PC(e.type)}function p1(e,t){var n=be.p;try{return be.p=e,t()}finally{be.p=n}}var Sr=Math.random().toString(36).slice(2),Ot="__reactFiber$"+Sr,nn="__reactProps$"+Sr,Wu="__reactContainer$"+Sr,m1="__reactEvents$"+Sr,Rz="__reactListeners$"+Sr,Az="__reactHandles$"+Sr,g1="__reactResources$"+Sr,Qu="__reactMarker$"+Sr,Od="__reactLoad$"+Sr;function eh(e){delete e[Ot],delete e[nn],delete e[Rz],delete e[Az]}function is(e){var t;if(t=e[Ot])return t;for(var n=e.parentNode;n;){if(t=n[Wu]||n[Ot]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=MS(e);e!==null;){if(n=e[Ot])return n;e=MS(e)}return t}e=n,n=e.parentNode}return null}function Xl(e){if(e=e[Ot]||e[Wu]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function fu(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(R(33))}function _l(e){var t=e[g1];return t||(t=e[g1]={hoistableStyles:new Map,hoistableScripts:new Map}),t}function vt(e){e[Qu]=!0}function lk(e){e[Od]=void 0}var ak=new Set,uk={};function ws(e,t){zl(e,t),zl(e+"Capture",t)}function zl(e,t){uk[e]=t;for(e=0;e<t.length;e++)ak.add(t[e])}var Tz=RegExp("^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$"),v1={},b1={};function Mz(e){if(Og.call(b1,e))return!0;if(Og.call(v1,e))return!1;if(Tz.test(e))return b1[e]=!0;return v1[e]=!0,!1}var me=!1;function y1(){var e=me;return me=!1,e}function id(e,t,n){if(Mz(t))if(n===null)e.removeAttribute(t);else{switch(typeof n){case"undefined":case"function":case"symbol":e.removeAttribute(t);return;case"boolean":var i=t.toLowerCase().slice(0,5);if(i!=="data-"&&i!=="aria-"){e.removeAttribute(t);return}}e.setAttribute(t,n)}}function Ff(e,t,n){if(n===null)e.removeAttribute(t);else{switch(typeof n){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(t);return}e.setAttribute(t,n)}}function cr(e,t,n,i){if(i===null)e.removeAttribute(n);else{switch(typeof i){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(n);return}e.setAttributeNS(t,n,i)}}function un(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function ck(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function Nz(e,t,n){var i=Object.getOwnPropertyDescriptor(e.constructor.prototype,t);if(!e.hasOwnProperty(t)&&typeof i<"u"&&typeof i.get==="function"&&typeof i.set==="function"){var{get:r,set:o}=i;return Object.defineProperty(e,t,{configurable:!0,get:function(){return r.call(this)},set:function(s){n=""+s,o.call(this,s)}}),Object.defineProperty(e,t,{enumerable:i.enumerable}),{getValue:function(){return n},setValue:function(s){n=""+s},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Rg(e){if(!e._valueTracker){var t=ck(e)?"checked":"value";e._valueTracker=Nz(e,t,""+e[t])}}function fk(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),i="";return e&&(i=ck(e)?e.checked?"true":"false":e.value),e=i,e!==n?(t.setValue(e),!0):!1}var Dz=/[\n"\\]/g;function Ln(e){return e.replace(Dz,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function Ag(e,t,n,i,r,o,s,l){if(e.name="",s!=null&&typeof s!=="function"&&typeof s!=="symbol"&&typeof s!=="boolean"?e.type=s:e.removeAttribute("type"),t!=null)if(s==="number"){if(t===0&&e.value===""||e.value!=t)e.value=""+un(t)}else e.value!==""+un(t)&&(e.value=""+un(t));else s!=="submit"&&s!=="reset"||e.removeAttribute("value");t!=null?s==="number"&&e.value==t?$m(e,un(e.value)):$m(e,un(t)):n!=null?$m(e,un(n)):i!=null&&e.removeAttribute("value"),r==null&&o!=null&&(e.defaultChecked=!!o),r!=null&&(e.checked=r&&typeof r!=="function"&&typeof r!=="symbol"),l!=null&&typeof l!=="function"&&typeof l!=="symbol"&&typeof l!=="boolean"?e.name=""+un(l):e.removeAttribute("name")}function dk(e,t,n,i,r,o,s,l){if(o!=null&&typeof o!=="function"&&typeof o!=="symbol"&&typeof o!=="boolean"&&(e.type=o),t!=null||n!=null){if(!(o!=="submit"&&o!=="reset"||t!==void 0&&t!==null)){Rg(e);return}n=n!=null?""+un(n):"",t=t!=null?""+un(t):n,l||t===e.value||(e.value=t),e.defaultValue=t}i=i!=null?i:r,i=typeof i!=="function"&&typeof i!=="symbol"&&!!i,e.checked=l?e.checked:!!i,e.defaultChecked=!!i,s!=null&&typeof s!=="function"&&typeof s!=="symbol"&&typeof s!=="boolean"&&(e.name=s),Rg(e)}function $m(e,t){e.defaultValue!==""+t&&(e.defaultValue=""+t)}function Cl(e,t,n,i){if(e=e.options,t){t={};for(var r=0;r<n.length;r++)t["$"+n[r]]=!0;for(n=0;n<e.length;n++)r=t.hasOwnProperty("$"+e[n].value),e[n].selected!==r&&(e[n].selected=r),r&&i&&(e[n].defaultSelected=!0)}else{n=""+un(n),t=null;for(r=0;r<e.length;r++){if(e[r].value===n){e[r].selected=!0,i&&(e[r].defaultSelected=!0);return}t!==null||e[r].disabled||(t=e[r])}t!==null&&(t.selected=!0)}}function hk(e,t,n){if(t!=null&&(t=""+un(t),t!==e.value&&(e.value=t),n==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=n!=null?""+un(n):""}function pk(e,t,n,i){if(t==null){if(i!=null){if(n!=null)throw Error(R(92));if(cu(i)){if(1<i.length)throw Error(R(93));i=i[0]}n=i}n==null&&(n=""),t=n}n=un(t),e.defaultValue=n,i=e.textContent,i===n&&i!==""&&i!==null&&(e.value=i),Rg(e)}function Bl(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Lz=new Set("animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp".split(" "));function x1(e,t,n){var i=t.indexOf("--")===0;n==null||typeof n==="boolean"||n===""?i?e.setProperty(t,""):t==="float"?e.cssFloat="":e[t]="":i?e.setProperty(t,n):typeof n!=="number"||n===0||Lz.has(t)?t==="float"?e.cssFloat=n:e[t]=(""+n).trim():e[t]=n+"px"}function mk(e,t,n){if(t!=null&&typeof t!=="object")throw Error(R(62));if(e=e.style,n!=null){for(var i in n)!n.hasOwnProperty(i)||t!=null&&t.hasOwnProperty(i)||(i.indexOf("--")===0?e.setProperty(i,""):i==="float"?e.cssFloat="":e[i]="",me=!0);for(var r in t)i=t[r],t.hasOwnProperty(r)&&n[r]!==i&&(x1(e,r,i),me=!0)}else for(var o in t)t.hasOwnProperty(o)&&x1(e,o,t[o])}function Lv(e){if(e.indexOf("-")===-1)return!1;switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var zz=new Map([["acceptCharset","accept-charset"],["htmlFor","for"],["httpEquiv","http-equiv"],["crossOrigin","crossorigin"],["accentHeight","accent-height"],["alignmentBaseline","alignment-baseline"],["arabicForm","arabic-form"],["baselineShift","baseline-shift"],["capHeight","cap-height"],["clipPath","clip-path"],["clipRule","clip-rule"],["colorInterpolation","color-interpolation"],["colorInterpolationFilters","color-interpolation-filters"],["colorProfile","color-profile"],["colorRendering","color-rendering"],["dominantBaseline","dominant-baseline"],["enableBackground","enable-background"],["fillOpacity","fill-opacity"],["fillRule","fill-rule"],["floodColor","flood-color"],["floodOpacity","flood-opacity"],["fontFamily","font-family"],["fontSize","font-size"],["fontSizeAdjust","font-size-adjust"],["fontStretch","font-stretch"],["fontStyle","font-style"],["fontVariant","font-variant"],["fontWeight","font-weight"],["glyphName","glyph-name"],["glyphOrientationHorizontal","glyph-orientation-horizontal"],["glyphOrientationVertical","glyph-orientation-vertical"],["horizAdvX","horiz-adv-x"],["horizOriginX","horiz-origin-x"],["imageRendering","image-rendering"],["letterSpacing","letter-spacing"],["lightingColor","lighting-color"],["markerEnd","marker-end"],["markerMid","marker-mid"],["markerStart","marker-start"],["maskType","mask-type"],["overlinePosition","overline-position"],["overlineThickness","overline-thickness"],["paintOrder","paint-order"],["panose-1","panose-1"],["pointerEvents","pointer-events"],["renderingIntent","rendering-intent"],["shapeRendering","shape-rendering"],["stopColor","stop-color"],["stopOpacity","stop-opacity"],["strikethroughPosition","strikethrough-position"],["strikethroughThickness","strikethrough-thickness"],["strokeDasharray","stroke-dasharray"],["strokeDashoffset","stroke-dashoffset"],["strokeLinecap","stroke-linecap"],["strokeLinejoin","stroke-linejoin"],["strokeMiterlimit","stroke-miterlimit"],["strokeOpacity","stroke-opacity"],["strokeWidth","stroke-width"],["textAnchor","text-anchor"],["textDecoration","text-decoration"],["textRendering","text-rendering"],["transformOrigin","transform-origin"],["underlinePosition","underline-position"],["underlineThickness","underline-thickness"],["unicodeBidi","unicode-bidi"],["unicodeRange","unicode-range"],["unitsPerEm","units-per-em"],["vAlphabetic","v-alphabetic"],["vHanging","v-hanging"],["vIdeographic","v-ideographic"],["vMathematical","v-mathematical"],["vectorEffect","vector-effect"],["vertAdvY","vert-adv-y"],["vertOriginX","vert-origin-x"],["vertOriginY","vert-origin-y"],["wordSpacing","word-spacing"],["writingMode","writing-mode"],["xmlnsXlink","xmlns:xlink"],["xHeight","x-height"]]),Bz=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function rd(e){return Bz.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function Bi(){}var Tg=null;function zv(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var ml=null,El=null;function w1(e){var t=Xl(e);if(t&&(e=t.stateNode)){var n=e[nn]||null;e:switch(e=t.stateNode,t.type){case"input":if(Ag(e,n.value,n.defaultValue,n.defaultValue,n.checked,n.defaultChecked,n.type,n.name),t=n.name,n.type==="radio"&&t!=null){for(n=e;n.parentNode;)n=n.parentNode;n=n.querySelectorAll('input[name="'+Ln(""+t)+'"][type="radio"]');for(t=0;t<n.length;t++){var i=n[t];if(i!==e&&i.form===e.form){var r=i[nn]||null;if(!r)throw Error(R(90));Ag(i,r.value,r.defaultValue,r.defaultValue,r.checked,r.defaultChecked,r.type,r.name)}}for(t=0;t<n.length;t++)i=n[t],i.form===e.form&&fk(i)}break e;case"textarea":hk(e,n.value,n.defaultValue);break e;case"select":t=n.value,t!=null&&Cl(e,!!n.multiple,t,!1)}}}var Xm=!1;function gk(e,t,n){if(Xm)return e(t,n);Xm=!0;try{var i=e(t);return i}finally{if(Xm=!1,ml!==null||El!==null){if(ph(),ml&&(t=ml,e=El,El=ml=null,w1(t),e))for(t=0;t<e.length;t++)w1(e[t])}}}function Nu(e,t){var n=e.stateNode;if(n===null)return null;var i=n[nn]||null;if(i===null)return null;n=i[t];e:switch(t){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(i=!i.disabled)||(e=e.type,i=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!i;break e;default:e=!1}if(e)return null;if(n&&typeof n!=="function")throw Error(R(231,t,typeof n));return n}var gr=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Mg=!1;if(gr)try{es={},Object.defineProperty(es,"passive",{get:function(){Mg=!0}}),window.addEventListener("test",es,es),window.removeEventListener("test",es,es)}catch(e){Mg=!1}var es,to=null,Bv=null,od=null;function vk(){if(od)return od;var e,t=Bv,n=t.length,i,r="value"in to?to.value:to.textContent,o=r.length;for(e=0;e<n&&t[e]===r[e];e++);var s=n-e;for(i=1;i<=s&&t[n-i]===r[o-i];i++);return od=r.slice(e,1<i?1-i:void 0)}function sd(e){var t=e.keyCode;return"charCode"in e?(e=e.charCode,e===0&&t===13&&(e=13)):e=t,e===10&&(e=13),32<=e||e===13?e:0}function qf(){return!0}function S1(){return!1}function Ft(e){function t(n,i,r,o,s){this._reactName=n,this._targetInst=r,this.type=i,this.nativeEvent=o,this.target=s,this.currentTarget=null;for(var l in e)e.hasOwnProperty(l)&&(n=e[l],this[l]=n?n(o):o[l]);return this.isDefaultPrevented=(o.defaultPrevented!=null?o.defaultPrevented:o.returnValue===!1)?qf:S1,this.isPropagationStopped=S1,this}return Me(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var n=this.nativeEvent;n&&(n.preventDefault?n.preventDefault():typeof n.returnValue!=="unknown"&&(n.returnValue=!1),this.isDefaultPrevented=qf)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!=="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=qf)},persist:function(){},isPersistent:qf}),t}var xo={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},th=Ft(xo),Ju=Me({},xo,{view:0,detail:0}),Pz=Ft(Ju),Gm,Ym,ou,nh=Me({},Ju,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Pv,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){if("movementX"in e)return e.movementX;return e!==ou&&(ou&&e.type==="mousemove"?(Gm=e.screenX-ou.screenX,Ym=e.screenY-ou.screenY):Ym=Gm=0,ou=e),Gm},movementY:function(e){return"movementY"in e?e.movementY:Ym}}),k1=Ft(nh),Iz=Me({},nh,{dataTransfer:0}),Hz=Ft(Iz),Vz=Me({},Ju,{relatedTarget:0}),Wm=Ft(Vz),Uz=Me({},xo,{animationName:0,elapsedTime:0,pseudoElement:0}),Kz=Ft(Uz),jz=Me({},xo,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),Fz=Ft(jz),qz=Me({},xo,{data:0}),_1=Ft(qz),$z={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Xz={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},Gz={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Yz(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=Gz[e])?!!t[e]:!1}function Pv(){return Yz}var Wz=Me({},Ju,{key:function(e){if(e.key){var t=$z[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=sd(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?Xz[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Pv,charCode:function(e){return e.type==="keypress"?sd(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?sd(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),Qz=Ft(Wz),Jz=Me({},nh,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),C1=Ft(Jz),Zz=Me({},xo,{submitter:0}),eB=Ft(Zz),tB=Me({},Ju,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Pv}),nB=Ft(tB),iB=Me({},xo,{propertyName:0,elapsedTime:0,pseudoElement:0}),rB=Ft(iB),oB=Me({},nh,{deltaX:function(e){return"deltaX"in e?e.deltaX:("wheelDeltaX"in e)?-e.wheelDeltaX:0},deltaY:function(e){return"deltaY"in e?e.deltaY:("wheelDeltaY"in e)?-e.wheelDeltaY:("wheelDelta"in e)?-e.wheelDelta:0},deltaZ:0,deltaMode:0}),sB=Ft(oB),lB=Me({},xo,{newState:0,oldState:0,source:0}),aB=Ft(lB),uB=[9,13,27,32],Iv=gr&&"CompositionEvent"in window,bu=null;gr&&"documentMode"in document&&(bu=document.documentMode);var cB=gr&&"TextEvent"in window&&!bu,bk=gr&&(!Iv||bu&&8<bu&&11>=bu),E1=String.fromCharCode(32),O1=!1;function yk(e,t){switch(e){case"keyup":return uB.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function xk(e){return e=e.detail,typeof e==="object"&&"data"in e?e.data:null}var gl=!1;function fB(e,t){switch(e){case"compositionend":return xk(t);case"keypress":if(t.which!==32)return null;return O1=!0,E1;case"textInput":return e=t.data,e===E1&&O1?null:e;default:return null}}function dB(e,t){if(gl)return e==="compositionend"||!Iv&&yk(e,t)?(e=vk(),od=Bv=to=null,gl=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case"compositionend":return bk&&t.locale!=="ko"?null:t.data;default:return null}}var hB={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function R1(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!hB[e.type]:t==="textarea"?!0:!1}function wk(e,t,n,i){ml?El?El.push(i):El=[i]:ml=i,t=Yd(t,"onChange"),0<t.length&&(n=new th("onChange","change",null,n,i),e.push({event:n,listeners:t}))}var yu=null,Du=null;function pB(e){hC(e,0)}function ih(e){var t=fu(e);if(fk(t))return e}function A1(e,t){if(e==="change")return t}var Sk=!1;if(gr){if(gr){if(hu="oninput"in document,!hu)ld=document.createElement("div"),ld.setAttribute("oninput","return;"),hu=typeof ld.oninput==="function";du=hu}else du=!1;Sk=du&&(!document.documentMode||9<document.documentMode)}var du,hu,ld;function T1(){yu&&(yu.detachEvent("onpropertychange",kk),Du=yu=null)}function kk(e){if(e.propertyName==="value"&&ih(Du)){var t=[];wk(t,Du,e,zv(e)),gk(pB,t)}}function mB(e,t,n){e==="focusin"?(T1(),yu=t,Du=n,yu.attachEvent("onpropertychange",kk)):e==="focusout"&&T1()}function gB(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return ih(Du)}function vB(e,t){if(e==="click")return ih(t)}function bB(e,t){if(e==="input"||e==="change")return ih(t)}function yB(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var gn=typeof Object.is==="function"?Object.is:yB;function Lu(e,t){if(gn(e,t))return!0;if(typeof e!=="object"||e===null||typeof t!=="object"||t===null)return!1;var n=Object.keys(e),i=Object.keys(t);if(n.length!==i.length)return!1;for(i=0;i<n.length;i++){var r=n[i];if(!Og.call(t,r)||!gn(e[r],t[r]))return!1}return!0}function Ng(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch(t){return e.body}}function M1(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function N1(e,t){var n=M1(e);e=0;for(var i;n;){if(n.nodeType===3){if(i=e+n.textContent.length,e<=t&&i>=t)return{node:n,offset:t-e};e=i}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=M1(n)}}function _k(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?_k(e,t.parentNode):("contains"in e)?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Ck(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=Ng(e.document);t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href==="string"}catch(i){n=!1}if(n)e=t.contentWindow;else break;t=Ng(e.document)}return t}function Hv(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}var xB=gr&&"documentMode"in document&&11>=document.documentMode,vl=null,Dg=null,xu=null,Lg=!1;function D1(e,t,n){var i=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Lg||vl==null||vl!==Ng(i)||(i=vl,("selectionStart"in i)&&Hv(i)?i={start:i.selectionStart,end:i.selectionEnd}:(i=(i.ownerDocument&&i.ownerDocument.defaultView||window).getSelection(),i={anchorNode:i.anchorNode,anchorOffset:i.anchorOffset,focusNode:i.focusNode,focusOffset:i.focusOffset}),xu&&Lu(xu,i)||(xu=i,i=Yd(Dg,"onSelect"),0<i.length&&(t=new th("onSelect","select",null,t,n),e.push({event:t,listeners:i}),t.target=vl)))}function Qo(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var bl={animationend:Qo("Animation","AnimationEnd"),animationiteration:Qo("Animation","AnimationIteration"),animationstart:Qo("Animation","AnimationStart"),transitionrun:Qo("Transition","TransitionRun"),transitionstart:Qo("Transition","TransitionStart"),transitioncancel:Qo("Transition","TransitionCancel"),transitionend:Qo("Transition","TransitionEnd")},Qm={},Ek={};gr&&(Ek=document.createElement("div").style,("AnimationEvent"in window)||(delete bl.animationend.animation,delete bl.animationiteration.animation,delete bl.animationstart.animation),("TransitionEvent"in window)||delete bl.transitionend.transition);function Ss(e){if(Qm[e])return Qm[e];if(!bl[e])return e;var t=bl[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in Ek)return Qm[e]=t[n];return e}var Ok=Ss("animationend"),Rk=Ss("animationiteration"),Ak=Ss("animationstart"),wB=Ss("transitionrun"),SB=Ss("transitionstart"),kB=Ss("transitioncancel"),Tk=Ss("transitionend"),Mk=new Map,zg="abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error fullscreenChange fullscreenError gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");zg.push("scrollEnd");function li(e,t){Mk.set(e,t),ws(t,[e])}var _B=0;function vr(e,t){if(e.name!=null&&e.name!=="auto")return e.name;if(t.autoName!==null)return t.autoName;e=si.identifierPrefix;var n=_B++;return e="_"+e+"t_"+n.toString(32)+"_",t.autoName=e}function L1(e){if(e==null||typeof e==="string")return e;var t=null,n=Dl;if(n!==null)for(var i=0;i<n.length;i++){var r=e[n[i]];if(r!=null){if(r==="none")return"none";t=t==null?r:t+(" "+r)}}return t==null?e.default:t}function kr(e,t){return e=L1(e),t=L1(t),t==null?e==="auto"?null:e:t==="auto"?null:t}var Rd=typeof reportError==="function"?reportError:function(e){if(typeof window==="object"&&typeof window.ErrorEvent==="function"){var t=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof e==="object"&&e!==null&&typeof e.message==="string"?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process==="object"&&typeof process.emit==="function"){process.emit("uncaughtException",e);return}console.error(e)},Mn=[],yl=0,Vv=0;function rh(){for(var e=yl,t=Vv=yl=0;t<e;){var n=Mn[t];Mn[t++]=null;var i=Mn[t];Mn[t++]=null;var r=Mn[t];Mn[t++]=null;var o=Mn[t];if(Mn[t++]=null,i!==null&&r!==null){var s=i.pending;s===null?r.next=r:(r.next=s.next,s.next=r),i.pending=r}o!==0&&Nk(n,r,o)}}function oh(e,t,n,i){Mn[yl++]=e,Mn[yl++]=t,Mn[yl++]=n,Mn[yl++]=i,Vv|=i,e.lanes|=i,e=e.alternate,e!==null&&(e.lanes|=i)}function Uv(e,t,n,i){return oh(e,t,n,i),Ad(e)}function ks(e,t){return oh(e,null,null,t),Ad(e)}function Nk(e,t,n){e.lanes|=n;var i=e.alternate;i!==null&&(i.lanes|=n);for(var r=!1,o=e.return;o!==null;)o.childLanes|=n,i=o.alternate,i!==null&&(i.childLanes|=n),o.tag===22&&(e=o.stateNode,e===null||e._visibility&1||(r=!0)),e=o,o=o.return;return e.tag===3?(o=e.stateNode,r&&t!==null&&(r=31-mn(n),e=o.hiddenUpdates,i=e[r],i===null?e[r]=[t]:i.push(t),t.lane=n|536870912),o):null}function Ad(e){if(50<Tu)throw Tu=0,vd=null,Error(R(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var xl={};function CB(e,t,n,i){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=i,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Zt(e,t,n,i){return new CB(e,t,n,i)}function Kv(e){return e=e.prototype,!(!e||!e.isReactComponent)}function pr(e,t){var n=e.alternate;return n===null?(n=Zt(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&1206910976,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n.refCleanup=e.refCleanup,n}function Dk(e,t){e.flags&=1206910978;var n=e.alternate;return n===null?(e.childLanes=0,e.lanes=t,e.child=null,e.subtreeFlags=0,e.memoizedProps=null,e.memoizedState=null,e.updateQueue=null,e.dependencies=null,e.stateNode=null):(e.childLanes=n.childLanes,e.lanes=n.lanes,e.child=n.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=n.memoizedProps,e.memoizedState=n.memoizedState,e.updateQueue=n.updateQueue,e.type=n.type,t=n.dependencies,e.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),e}function ad(e,t,n,i,r,o){var s=0;if(i=e,typeof i==="function")Kv(i)&&(s=1);else if(typeof i==="string")s=e3(e,n,Hi.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(i){case Sg:return e=Zt(31,n,t,r),e.elementType=Sg,e.lanes=o,e;case hl:return ss(n.children,r,o,t);case YS:s=8,r|=24;break;case yg:return e=Zt(12,n,t,r|2),e.elementType=yg,e.lanes=o,e;case xg:return e=Zt(13,n,t,r),e.elementType=xg,e.lanes=o,e;case wg:return e=Zt(19,n,t,r),e.elementType=wg,e.lanes=o,e;case dz:case kg:return e=r|32,e=Zt(30,n,t,e),e.elementType=kg,e.lanes=o,e.stateNode={autoName:null,paired:null,clones:null,ref:null},e;default:if(typeof i==="object"&&i!==null)switch(i.$$typeof){case zi:s=10;break e;case WS:s=9;break e;case Tv:s=11;break e;case Mv:s=14;break e;case Qr:s=16,i=null;break e}s=29,n=Error(R(130,e===null?"null":typeof e,"")),i=null}return t=Zt(s,n,t,r),t.elementType=e,t.type=i,t.lanes=o,t}function ss(e,t,n,i){return e=Zt(7,e,i,t),e.lanes=n,e}function Jm(e,t,n){return e=Zt(6,e,null,t),e.lanes=n,e}function Lk(e){var t=Zt(18,null,null,0);return t.stateNode=e,t}function Zm(e,t,n){return t=Zt(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var z1=new WeakMap;function zn(e,t){if(typeof e==="object"&&e!==null){var n=z1.get(e);if(n!==void 0)return n;return t={value:e,source:t,stack:h1(t)},z1.set(e,t),t}return{value:e,source:t,stack:h1(t)}}var wl=[],Sl=0,Td=null,zu=0,Nn=[],Dn=0,mo=null,Pi=1,Ii="";function dr(e,t){wl[Sl++]=zu,wl[Sl++]=Td,Td=e,zu=t}function zk(e,t,n){Nn[Dn++]=Pi,Nn[Dn++]=Ii,Nn[Dn++]=mo,mo=e;var i=Pi;e=Ii;var r=32-mn(i)-1;i&=~(1<<r),n+=1;var o=32-mn(t)+r;if(30<o){var s=r-r%5;o=(i&(1<<s)-1).toString(32),i>>=s,r-=s,Pi=1<<32-mn(t)+r|n<<r|i,Ii=o+e}else Pi=1<<o|n<<r|i,Ii=e}function sh(e){e.return!==null&&(dr(e,1),zk(e,1,0))}function jv(e){for(;e===Td;)Td=wl[--Sl],wl[Sl]=null,zu=wl[--Sl],wl[Sl]=null;for(;e===mo;)mo=Nn[--Dn],Nn[Dn]=null,Ii=Nn[--Dn],Nn[Dn]=null,Pi=Nn[--Dn],Nn[Dn]=null}function Bk(e,t){Nn[Dn++]=Pi,Nn[Dn++]=Ii,Nn[Dn++]=mo,Pi=t.id,Ii=t.overflow,mo=e}var bt=null,Be=null,le=!1,lo=null,Bn=!1,Bg=Error(R(519));function go(e){var t=Error(R(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Bu(zn(t,e)),Bg}function B1(e){var{stateNode:t,type:n,memoizedProps:i}=e;switch(t[Ot]=e,t[nn]=i,n){case"dialog":ae("cancel",t),ae("close",t);break;case"iframe":case"object":case"embed":ae("load",t);break;case"video":case"audio":for(n=0;n<Vu.length;n++)ae(Vu[n],t);break;case"source":ae("error",t);break;case"img":case"image":case"link":ae("error",t),ae("load",t);break;case"details":ae("toggle",t);break;case"input":ae("invalid",t),dk(t,i.value,i.defaultValue,i.checked,i.defaultChecked,i.type,i.name,!0);break;case"select":ae("invalid",t);break;case"textarea":ae("invalid",t),pk(t,i.value,i.defaultValue,i.children)}n=i.children,typeof n!=="string"&&typeof n!=="number"&&typeof n!=="bigint"||t.textContent===""+n||i.suppressHydrationWarning===!0||gC(t.textContent,n)?(i.popover!=null&&(ae("beforetoggle",t),ae("toggle",t)),i.onScroll!=null&&ae("scroll",t),i.onScrollEnd!=null&&ae("scrollend",t),i.onClick!=null&&(t.onclick=Bi),t=!0):t=!1,t||go(e,!0)}function Md(e){for(bt=e.return;bt;)switch(bt.tag){case 5:case 31:case 13:Bn=!1;return;case 27:case 3:Bn=!0;return;default:bt=bt.return}}function sl(e){if(e!==bt)return!1;if(!le)return Md(e),le=!0,!1;var t=e.tag,n;if(n=t!==3&&t!==27){if(n=t===5)n=e.type,n=!(n!=="form"&&n!=="button")||Sv(e.type,e.memoizedProps);n=!n}if(n&&Be&&go(e),Md(e),t===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(R(317));Be=TS(e)}else if(t===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(R(317));Be=TS(e)}else t===27?(t=Be,wo(e.type)?(e=Ev,Ev=null,Be=e):Be=t):Be=bt?In(e.stateNode.nextSibling):null;return!0}function ds(){Be=bt=null,le=!1}function eg(){var e=lo;return e!==null&&(Qt===null?Qt=e:Qt.push.apply(Qt,e),lo=null),e}function Bu(e){lo===null?lo=[e]:lo.push(e)}var Pg=Ki(null),_s=null,hr=null;function no(e,t,n){Pe(Pg,t._currentValue),t._currentValue=n}function mr(e){e._currentValue=Pg.current,At(Pg)}function ud(e,t,n){for(;e!==null;){var i=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,i!==null&&(i.childLanes|=t)):i!==null&&(i.childLanes&t)!==t&&(i.childLanes|=t),e===n)break;e=e.return}}function Ig(e,t,n,i){var r=e.child;r!==null&&(r.return=e);for(;r!==null;){var o=r.dependencies;if(o!==null){var s=r.child;o=o.firstContext;e:for(;o!==null;){var l=o;o=r;for(var a=0;a<t.length;a++)if(l.context===t[a]){o.lanes|=n,l=o.alternate,l!==null&&(l.lanes|=n),ud(o.return,n,e),i||(s=null);break e}o=l.next}}else if(r.tag===18){if(s=r.return,s===null)throw Error(R(341));s.lanes|=n,o=s.alternate,o!==null&&(o.lanes|=n),ud(s,n,e),s=null}else r.tag===13&&r.memoizedState!==null&&r.memoizedState.dehydrated===null?(r.lanes|=n,s=r.alternate,s!==null&&(s.lanes|=n),ud(r.return,n,e),s=r.child,s=s!==null?s.sibling:null):s=r.child;if(s!==null)s.return=r;else for(s=r;s!==null;){if(s===e){s=null;break}if(r=s.sibling,r!==null){r.return=s.return,s=r;break}s=s.return}r=s}}function hs(e,t,n,i){e=null;for(var r=t,o=!1;r!==null;){if(!o){if((r.flags&524288)!==0)o=!0;else if((r.flags&262144)!==0)break}if(r.tag===10){var s=r.alternate;if(s===null)throw Error(R(387));if(s=s.memoizedProps,s!==null){var l=r.type;gn(r.pendingProps.value,s.value)||(e!==null?e.push(l):e=[l])}}else if(r===kd.current){if(s=r.alternate,s===null)throw Error(R(387));s.memoizedState.memoizedState!==r.memoizedState.memoizedState&&(e!==null?e.push(Fl):e=[Fl])}r=r.return}return e!==null&&Ig(t,e,n,i),t.flags|=262144,e!==null}function Nd(e){for(e=e.firstContext;e!==null;){if(!gn(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function ps(e){_s=e,hr=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function Rt(e){return Pk(_s,e)}function $f(e,t){return _s===null&&ps(e),Pk(e,t)}function Pk(e,t){var n=t._currentValue;if(t={context:t,memoizedValue:n,next:null},hr===null){if(e===null)throw Error(R(308));hr=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else hr=hr.next=t;return n}var EB=typeof AbortController<"u"?AbortController:function(){var e=[],t=this.signal={aborted:!1,addEventListener:function(n,i){e.push(i)}};this.abort=function(){t.aborted=!0,e.forEach(function(n){return n()})}},OB=Wo,RB=Yo,lt={$$typeof:zi,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Fv(){return{controller:new EB,data:new Map,refCount:0}}function Zu(e){e.refCount--,e.refCount===0&&OB(RB,function(){e.controller.abort()})}function P1(e,t){if((e.pendingLanes&4194048)!==0){var n=e.transitionTypes;n===null&&(n=e.transitionTypes=[]);for(e=0;e<t.length;e++){var i=t[e];n.indexOf(i)===-1&&n.push(i)}}}var pu=null;function AB(e){var t=e.transitionTypes;return e.transitionTypes=null,t}var wu=null,Hg=0,ms=0,Ol=null;function TB(e,t){if(wu===null){var n=wu=[];Hg=0,ms=bb(),Ol={status:"pending",value:void 0,then:function(i){n.push(i)}}}return Hg++,t.then(I1,I1),t}function I1(){if(--Hg===0&&(pu=null,wu!==null)){Ol!==null&&(Ol.status="fulfilled");var e=wu;wu=null,ms=0,Ol=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function MB(e,t){var n=[],i={status:"pending",value:null,reason:null,then:function(r){n.push(r)}};return e.then(function(){i.status="fulfilled",i.value=t;for(var r=0;r<n.length;r++)(0,n[r])(t)},function(r){i.status="rejected",i.reason=r;for(r=0;r<n.length;r++)(0,n[r])(void 0)}),i}var H1=ie.S;ie.S=function(e,t){if(J_=hn(),typeof t==="object"&&t!==null&&typeof t.then==="function"&&TB(e,t),pu!==null)for(var n=Ul;n!==null;)P1(n,pu),n=n.next;if(n=e.types,n!==null){for(var i=Ul;i!==null;)P1(i,n),i=i.next;if(ms!==0){i=pu,i===null&&(i=pu=[]);for(var r=0;r<n.length;r++){var o=n[r];i.indexOf(o)===-1&&i.push(o)}}}H1!==null&&H1(e,t)};var ls=Ki(null);function qv(){var e=ls.current;return e!==null?e:Te.pooledCache}function cd(e,t){t===null?Pe(ls,ls.current):Pe(ls,t.pool)}function Ik(){var e=qv();return e===null?null:{parent:lt._currentValue,pool:e}}var Gl=Error(R(460)),$v=Error(R(474)),lh=Error(R(542)),Dd={then:function(){}};function V1(e){return e=e.status,e==="fulfilled"||e==="rejected"}function Hk(e,t,n){switch(n=e[n],n===void 0?e.push(t):n!==t&&(t.then(Bi,Bi),t=n),t.status){case"fulfilled":return t.value;case"rejected":if(e=t.reason,K1(e),e===void 0&&!("reason"in t))throw Error(R(600));throw e;default:if(typeof t.status==="string")t.then(Bi,Bi);else{if(e=Te,e!==null&&100<e.shellSuspendCounter)throw Error(R(482));e=t,e.status="pending",e.then(function(i){if(t.status==="pending"){var r=t;r.status="fulfilled",r.value=i}},function(i){if(t.status==="pending"){var r=t;r.status="rejected",r.reason=i}})}switch(t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,K1(e),e}throw as=t,Gl}}function ts(e){try{var t=e._init;return t(e._payload)}catch(n){if(n!==null&&typeof n==="object"&&typeof n.then==="function")throw as=n,Gl;throw n}}var as=null;function U1(){if(as===null)throw Error(R(459));var e=as;return as=null,e}function K1(e){if(e===Gl||e===lh)throw Error(R(483))}var Rl=null,Pu=0;function Xf(e){var t=Pu;return Pu+=1,Rl===null&&(Rl=[]),Hk(Rl,e,t)}function Gr(e,t){t=t.props.ref,e.ref=t!==void 0?t:null}function Gf(e,t){if(t.$$typeof===fz)throw Error(R(525));throw e=Object.prototype.toString.call(t),Error(R(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e))}function Vk(e){function t(g,v){if(e){var w=g.deletions;w===null?(g.deletions=[v],g.flags|=16):w.push(v)}}function n(g,v){if(!e)return null;for(;v!==null;)t(g,v),v=v.sibling;return null}function i(g){for(var v=new Map;g!==null;)g.key===null?v.set(g.index,g):v.set(g.key,g),g=g.sibling;return v}function r(g,v){return g=pr(g,v),g.index=0,g.sibling=null,g}function o(g,v,w){if(g.index=w,!e)return g.flags|=1048576,v;if(w=g.alternate,w!==null)return w=w.index,w<v?(g.flags|=2,v):w;return g.flags|=134217730,v}function s(g){return e&&g.alternate===null&&(g.flags|=134217730),g}function l(g,v,w,S){if(v===null||v.tag!==6)return v=Jm(w,g.mode,S),v.return=g,v;return v=r(v,w),v.return=g,v}function a(g,v,w,S){var k=w.type;if(k===hl)return g=c(g,v,w.props.children,S,w.key),Gr(g,w),g;if(v!==null&&(v.elementType===k||typeof k==="object"&&k!==null&&k.$$typeof===Qr&&ts(k)===v.type))return v=r(v,w.props),Gr(v,w),v.return=g,v;return v=ad(w.type,w.key,w.props,null,g.mode,S),Gr(v,w),v.return=g,v}function u(g,v,w,S){if(v===null||v.tag!==4||v.stateNode.containerInfo!==w.containerInfo||v.stateNode.implementation!==w.implementation)return v=Zm(w,g.mode,S),v.return=g,v;return v=r(v,w.children||[]),v.return=g,v}function c(g,v,w,S,k){if(v===null||v.tag!==7)return v=ss(w,g.mode,S,k),v.return=g,v;return v=r(v,w),v.return=g,v}function f(g,v,w){if(typeof v==="string"&&v!==""||typeof v==="number"||typeof v==="bigint")return v=Jm(""+v,g.mode,w),v.return=g,v;if(typeof v==="object"&&v!==null){switch(v.$$typeof){case Vf:return w=ad(v.type,v.key,v.props,null,g.mode,w),Gr(w,v),w.return=g,w;case uu:return v=Zm(v,g.mode,w),v.return=g,v;case Qr:return v=ts(v),f(g,v,w)}if(cu(v)||ru(v))return v=ss(v,g.mode,w,null),v.return=g,v;if(typeof v.then==="function")return f(g,Xf(v),w);if(v.$$typeof===zi)return f(g,$f(g,v),w);Gf(g,v)}return null}function d(g,v,w,S){var k=v!==null?v.key:null;if(typeof w==="string"&&w!==""||typeof w==="number"||typeof w==="bigint")return k!==null?null:l(g,v,""+w,S);if(typeof w==="object"&&w!==null){switch(w.$$typeof){case Vf:return w.key===k?a(g,v,w,S):null;case uu:return w.key===k?u(g,v,w,S):null;case Qr:return w=ts(w),d(g,v,w,S)}if(cu(w)||ru(w))return k!==null?null:c(g,v,w,S,null);if(typeof w.then==="function")return d(g,v,Xf(w),S);if(w.$$typeof===zi)return d(g,v,$f(g,w),S);Gf(g,w)}return null}function h(g,v,w,S,k){if(typeof S==="string"&&S!==""||typeof S==="number"||typeof S==="bigint")return g=g.get(w)||null,l(v,g,""+S,k);if(typeof S==="object"&&S!==null){switch(S.$$typeof){case Vf:return g=g.get(S.key===null?w:S.key)||null,a(v,g,S,k);case uu:return g=g.get(S.key===null?w:S.key)||null,u(v,g,S,k);case Qr:return S=ts(S),h(g,v,w,S,k)}if(cu(S)||ru(S))return g=g.get(w)||null,c(v,g,S,k,null);if(typeof S.then==="function")return h(g,v,w,Xf(S),k);if(S.$$typeof===zi)return h(g,v,w,$f(v,S),k);Gf(v,S)}return null}function m(g,v,w,S){for(var k=null,E=null,_=v,O=v=0,B=null;_!==null&&O<w.length;O++){_.index>O?(B=_,_=null):B=_.sibling;var M=d(g,_,w[O],S);if(M===null){_===null&&(_=B);break}e&&_&&M.alternate===null&&t(g,_),v=o(M,v,O),E===null?k=M:E.sibling=M,E=M,_=B}if(O===w.length)return n(g,_),le&&dr(g,O),k;if(_===null){for(;O<w.length;O++)_=f(g,w[O],S),_!==null&&(v=o(_,v,O),E===null?k=_:E.sibling=_,E=_);return le&&dr(g,O),k}for(_=i(_);O<w.length;O++)B=h(_,g,O,w[O],S),B!==null&&(e&&(M=B.alternate,M!==null&&_.delete(M.key===null?O:M.key)),v=o(B,v,O),E===null?k=B:E.sibling=B,E=B);return e&&_.forEach(function(I){return t(g,I)}),le&&dr(g,O),k}function b(g,v,w,S){if(w==null)throw Error(R(151));for(var k=null,E=null,_=v,O=v=0,B=null,M=w.next();_!==null&&!M.done;O++,M=w.next()){_.index>O?(B=_,_=null):B=_.sibling;var I=d(g,_,M.value,S);if(I===null){_===null&&(_=B);break}e&&_&&I.alternate===null&&t(g,_),v=o(I,v,O),E===null?k=I:E.sibling=I,E=I,_=B}if(M.done)return n(g,_),le&&dr(g,O),k;if(_===null){for(;!M.done;O++,M=w.next())M=f(g,M.value,S),M!==null&&(v=o(M,v,O),E===null?k=M:E.sibling=M,E=M);return le&&dr(g,O),k}for(_=i(_);!M.done;O++,M=w.next())M=h(_,g,O,M.value,S),M!==null&&(e&&(B=M.alternate,B!==null&&_.delete(B.key===null?O:B.key)),v=o(M,v,O),E===null?k=M:E.sibling=M,E=M);return e&&_.forEach(function(H){return t(g,H)}),le&&dr(g,O),k}function x(g,v,w,S){if(typeof w==="object"&&w!==null&&w.type===hl&&w.key===null&&w.props.ref===void 0&&(w=w.props.children),typeof w==="object"&&w!==null){switch(w.$$typeof){case Vf:e:{for(var k=w.key;v!==null;){if(v.key===k){if(k=w.type,k===hl){if(v.tag===7){n(g,v.sibling),S=r(v,w.props.children),Gr(S,w),S.return=g,g=S;break e}}else if(v.elementType===k||typeof k==="object"&&k!==null&&k.$$typeof===Qr&&ts(k)===v.type){n(g,v.sibling),S=r(v,w.props),Gr(S,w),S.return=g,g=S;break e}n(g,v);break}else t(g,v);v=v.sibling}w.type===hl?(S=ss(w.props.children,g.mode,S,w.key),Gr(S,w),S.return=g,g=S):(S=ad(w.type,w.key,w.props,null,g.mode,S),Gr(S,w),S.return=g,g=S)}return s(g);case uu:e:{for(k=w.key;v!==null;){if(v.key===k)if(v.tag===4&&v.stateNode.containerInfo===w.containerInfo&&v.stateNode.implementation===w.implementation){n(g,v.sibling),S=r(v,w.children||[]),S.return=g,g=S;break e}else{n(g,v);break}else t(g,v);v=v.sibling}S=Zm(w,g.mode,S),S.return=g,g=S}return s(g);case Qr:return w=ts(w),x(g,v,w,S)}if(cu(w))return m(g,v,w,S);if(ru(w)){if(k=ru(w),typeof k!=="function")throw Error(R(150));return w=k.call(w),b(g,v,w,S)}if(typeof w.then==="function")return x(g,v,Xf(w),S);if(w.$$typeof===zi)return x(g,v,$f(g,w),S);Gf(g,w)}return typeof w==="string"&&w!==""||typeof w==="number"||typeof w==="bigint"?(w=""+w,v!==null&&v.tag===6?(n(g,v.sibling),S=r(v,w),S.return=g,g=S):(n(g,v),S=Jm(w,g.mode,S),S.return=g,g=S),s(g)):n(g,v)}return function(g,v,w,S){try{Pu=0;var k=x(g,v,w,S);return Rl=null,k}catch(_){if(_===Gl||_===lh)throw _;var E=Zt(29,_,null,g.mode);return E.lanes=S,E.return=g,E}finally{}}}var gs=Vk(!0),Uk=Vk(!1),Jr=!1;function Xv(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Vg(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function us(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function cs(e,t,n){var i=e.updateQueue;if(i===null)return null;if(i=i.shared,(ve&2)!==0){var r=i.pending;return r===null?t.next=t:(t.next=r.next,r.next=t),i.pending=t,t=Ad(e),Nk(e,null,n),t}return oh(e,i,t,n),Ad(e)}function Su(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,(n&4194048)!==0)){var i=t.lanes;i&=e.pendingLanes,n|=i,t.lanes=n,ik(e,n)}}function tg(e,t){var n=e.updateQueue,i=e.alternate;if(i!==null&&(i=i.updateQueue,n===i)){var r=null,o=null;if(n=n.firstBaseUpdate,n!==null){do{var s={lane:n.lane,tag:n.tag,payload:n.payload,callback:null,next:null};o===null?r=o=s:o=o.next=s,n=n.next}while(n!==null);o===null?r=o=t:o=o.next=t}else r=o=t;n={baseState:i.baseState,firstBaseUpdate:r,lastBaseUpdate:o,shared:i.shared,callbacks:i.callbacks},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}var Ug=!1;function ku(){if(Ug){var e=Ol;if(e!==null)throw e}}function _u(e,t,n,i){Ug=!1;var r=e.updateQueue;Jr=!1;var{firstBaseUpdate:o,lastBaseUpdate:s}=r,l=r.shared.pending;if(l!==null){r.shared.pending=null;var a=l,u=a.next;a.next=null,s===null?o=u:s.next=u,s=a;var c=e.alternate;c!==null&&(c=c.updateQueue,l=c.lastBaseUpdate,l!==s&&(l===null?c.firstBaseUpdate=u:l.next=u,c.lastBaseUpdate=a))}if(o!==null){var f=r.baseState;s=0,c=u=a=null,l=o;do{var d=l.lane&-536870913,h=d!==l.lane;if(h?(de&d)===d:(i&d)===d){d!==0&&d===ms&&(Ug=!0),c!==null&&(c=c.next={lane:0,tag:l.tag,payload:l.payload,callback:null,next:null});e:{var m=e,b=l;d=t;var x=n;switch(b.tag){case 1:if(m=b.payload,typeof m==="function"){f=m.call(x,f,d);break e}f=m;break e;case 3:m.flags=m.flags&-65537|128;case 0:if(m=b.payload,d=typeof m==="function"?m.call(x,f,d):m,d===null||d===void 0)break e;f=Me({},f,d);break e;case 2:Jr=!0}}d=l.callback,d!==null&&(e.flags|=64,h&&(e.flags|=8192),h=r.callbacks,h===null?r.callbacks=[d]:h.push(d))}else h={lane:d,tag:l.tag,payload:l.payload,callback:l.callback,next:null},c===null?(u=c=h,a=f):c=c.next=h,s|=d;if(l=l.next,l===null)if(l=r.shared.pending,l===null)break;else h=l,l=h.next,h.next=null,r.lastBaseUpdate=h,r.shared.pending=null}while(1);c===null&&(a=f),r.baseState=a,r.firstBaseUpdate=u,r.lastBaseUpdate=c,o===null&&(r.shared.lanes=0),yo|=s,e.lanes=s,e.memoizedState=f}}function Kk(e,t){if(typeof e!=="function")throw Error(R(191,e));e.call(t)}function jk(e,t){var n=e.callbacks;if(n!==null)for(e.callbacks=null,e=0;e<n.length;e++)Kk(n[e],t)}var vo=Ki(null),Ld=Ki(0);function j1(e,t){e=wr,Pe(Ld,e),Pe(vo,t),wr=e|t.baseLanes}function Kg(){Pe(Ld,wr),Pe(vo,vo.current)}function Gv(){wr=Ld.current,At(vo),At(Ld)}var Nt=Ki(null),Bt=null;function ao(e){var t=e.alternate;Pe(Tt,Tt.current&1),Pe(Nt,e),Bt===null&&(t===null||vo.current!==null?Bt=e:t.memoizedState!==null&&(Bt=e))}function jg(e){Pe(Tt,Tt.current),Pe(Nt,e),Bt===null&&(Bt=e)}function Fk(e){e.tag===22?(Pe(Tt,Tt.current),Pe(Nt,e),Bt===null&&(Bt=e)):uo()}function uo(){Pe(Tt,Tt.current),Pe(Nt,Nt.current)}function cn(e){At(Nt),Bt===e&&(Bt=null),At(Tt)}var Tt=Ki(0);function Iu(e,t){Pe(Nt,Nt.current),Pe(Tt,t)}function Yv(e){At(Tt),At(Nt),Bt===e&&(Bt=null)}function zd(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||Cv(n)||wb(n)))return t}else if(t.tag===19&&t.memoizedProps.revealOrder!=="independent"){if((t.flags&128)!==0)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var br=0,re=null,Oe=null,st=null,Bd=!1,Al=!1,vs=!1,Pd=0,Hu=0,Tl=null,NB=0;function Ye(){throw Error(R(321))}function Wv(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!gn(e[n],t[n]))return!1;return!0}function Qv(e,t,n,i,r,o){return br=o,re=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,ie.H=e===null||e.memoizedState===null?w_:S_,vs=!1,o=n(i,r),vs=!1,Al&&(o=$k(t,n,i,r)),qk(e),o}function qk(e){ie.H=Id;var t=Oe!==null&&Oe.next!==null;if(br=0,st=Oe=re=null,Bd=!1,Hu=0,Tl=null,t)throw Error(R(300));e===null||at||(e=e.dependencies,e!==null&&Nd(e)&&(at=!0))}function $k(e,t,n,i){re=e;var r=0;do{if(Al&&(Tl=null),Hu=0,Al=!1,25<=r)throw Error(R(301));if(r+=1,st=Oe=null,e.updateQueue!=null){var o=e.updateQueue;o.lastEffect=null,o.events=null,o.stores=null,o.memoCache!=null&&(o.memoCache.index=0)}ie.H=VB,o=t(n,i)}while(Al);return o}function DB(){var e=ie.H,t=e.useState()[0];return t=typeof t.then==="function"?ec(t):t,e=e.useState()[0],(Oe!==null?Oe.memoizedState:null)!==e&&(re.flags|=1024),t}function Jv(){var e=Pd!==0;return Pd=0,e}function Zv(e,t,n){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~n}function eb(e){if(Bd){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}Bd=!1}br=0,st=Oe=re=null,Al=!1,Hu=Pd=0,Tl=null}function jt(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return st===null?re.memoizedState=st=e:st=st.next=e,st}function tt(){if(Oe===null){var e=re.alternate;e=e!==null?e.memoizedState:null}else e=Oe.next;var t=st===null?re.memoizedState:st.next;if(t!==null)st=t,Oe=e;else{if(e===null){if(re.alternate===null)throw Error(R(467));throw Error(R(310))}Oe=e,e={memoizedState:Oe.memoizedState,baseState:Oe.baseState,baseQueue:Oe.baseQueue,queue:Oe.queue,next:null},st===null?re.memoizedState=st=e:st=st.next=e}return st}function ah(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function ec(e){var t=Hu;return Hu+=1,Tl===null&&(Tl=[]),e=Hk(Tl,e,t),t=re,(st===null?t.memoizedState:st.next)===null&&(t=t.alternate,ie.H=t===null||t.memoizedState===null?w_:S_),e}function uh(e){if(e!==null&&typeof e==="object"){if(typeof e.then==="function")return ec(e);if(e.$$typeof===pz)return;if(e.$$typeof===zi)return Rt(e)}throw Error(R(438,String(e)))}function tb(e){var t=null,n=re.updateQueue;if(n!==null&&(t=n.memoCache),t==null){var i=re.alternate;i!==null&&(i=i.updateQueue,i!==null&&(i=i.memoCache,i!=null&&(t={data:i.data.map(function(r){return r.slice()}),index:0})))}if(t==null&&(t={data:[],index:0}),n===null&&(n=ah(),re.updateQueue=n),n.memoCache=t,n=t.data[t.index],n===void 0)for(n=t.data[t.index]=Array(e),i=0;i<e;i++)n[i]=hz;return t.index++,n}function yr(e,t){return typeof t==="function"?t(e):t}function fd(e){var t=tt();return nb(t,Oe,e)}function nb(e,t,n){var i=e.queue;if(i===null)throw Error(R(311));i.lastRenderedReducer=n;var r=e.baseQueue,o=i.pending;if(o!==null){if(r!==null){var s=r.next;r.next=o.next,o.next=s}t.baseQueue=r=o,i.pending=null}if(o=e.baseState,r===null)e.memoizedState=o;else{t=r.next;var l=s=null,a=null,u=t,c=!1;do{var f=u.lane&-536870913;if(f!==u.lane?(de&f)===f:(br&f)===f){var d=u.revertLane;if(d===0)a!==null&&(a=a.next={lane:0,revertLane:0,gesture:null,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null}),f===ms&&(c=!0);else if((br&d)===d){u=u.next,d===ms&&(c=!0);continue}else f={lane:0,revertLane:u.revertLane,gesture:null,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null},a===null?(l=a=f,s=o):a=a.next=f,re.lanes|=d,yo|=d;f=u.action,vs&&n(o,f),o=u.hasEagerState?u.eagerState:n(o,f)}else d={lane:f,revertLane:u.revertLane,gesture:u.gesture,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null},a===null?(l=a=d,s=o):a=a.next=d,re.lanes|=f,yo|=f;u=u.next}while(u!==null&&u!==t);if(a===null?s=o:a.next=l,!gn(o,e.memoizedState)&&(at=!0,c&&(n=Ol,n!==null)))throw n;e.memoizedState=o,e.baseState=s,e.baseQueue=a,i.lastRenderedState=o}return r===null&&(i.lanes=0),[e.memoizedState,i.dispatch]}function ng(e){var t=tt(),n=t.queue;if(n===null)throw Error(R(311));n.lastRenderedReducer=e;var{dispatch:i,pending:r}=n,o=t.memoizedState;if(r!==null){n.pending=null;var s=r=r.next;do o=e(o,s.action),s=s.next;while(s!==r);gn(o,t.memoizedState)||(at=!0),t.memoizedState=o,t.baseQueue===null&&(t.baseState=o),n.lastRenderedState=o}return[o,i]}function Xk(e,t,n){var i=re,r=tt(),o=le;if(o){if(n===void 0)throw Error(R(407));n=n()}else n=t();var s=!gn((Oe||r).memoizedState,n);if(s&&(r.memoizedState=n,at=!0),r=r.queue,ib(Wk.bind(null,i,r,e),[e]),e=r.getSnapshot!==t||s||st!==null&&(st.memoizedState.tag&1)!==0,Pl(e?9:8,{destroy:void 0},Yk.bind(null,i,r,n,t),null),e){if(i.flags|=2048,Te===null)throw Error(R(349));o||(br&127)!==0||Gk(i,t,n)}return n}function Gk(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=re.updateQueue,t===null?(t=ah(),re.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function Yk(e,t,n,i){t.value=n,t.getSnapshot=i,Qk(t)&&Jk(e)}function Wk(e,t,n){return n(function(){Qk(t)&&Jk(e)})}function Qk(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!gn(e,n)}catch(i){return!0}}function Jk(e){var t=ks(e,2);t!==null&&en(t,e,2)}function Fg(e){var t=jt();if(typeof e==="function"){var n=e;if(e=n(),vs){eo(!0);try{n()}finally{eo(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:yr,lastRenderedState:e},t}function Zk(e,t,n,i){return e.baseState=n,nb(e,Oe,typeof i==="function"?i:yr)}function LB(e,t,n,i,r){if(fh(e))throw Error(R(485));if(e=t.action,e!==null){var o={payload:r,action:e,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(s){o.listeners.push(s)}};ie.T!==null?n(!0):o.isTransition=!1,i(o),n=t.pending,n===null?(o.next=t.pending=o,e_(t,o)):(o.next=n.next,t.pending=n.next=o)}}function e_(e,t){var{action:n,payload:i}=t,r=e.state;if(t.isTransition){var o=ie.T,s={};s.types=o!==null?o.types:null,ie.T=s;try{var l=n(r,i),a=ie.S;a!==null&&a(s,l),F1(e,t,l)}catch(u){qg(e,t,u)}finally{o!==null&&s.types!==null&&(o.types=s.types),ie.T=o}}else try{o=n(r,i),F1(e,t,o)}catch(u){qg(e,t,u)}}function F1(e,t,n){n!==null&&typeof n==="object"&&typeof n.then==="function"?n.then(function(i){q1(e,t,i)},function(i){return qg(e,t,i)}):q1(e,t,n)}function q1(e,t,n){t.status="fulfilled",t.value=n,t_(t),e.state=n,t=e.pending,t!==null&&(n=t.next,n===t?e.pending=null:(n=n.next,t.next=n,e_(e,n)))}function qg(e,t,n){var i=e.pending;if(e.pending=null,i!==null){i=i.next;do t.status="rejected",t.reason=n,t_(t),t=t.next;while(t!==i)}e.action=null}function t_(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function n_(e,t){return t}function $1(e,t){if(le){var n=Te.formState;if(n!==null){e:{var i=re;if(le){if(Be){t:{var r=Be;for(var o=Bn;r.nodeType!==8;){if(!o){r=null;break t}if(r=In(r.nextSibling),r===null){r=null;break t}}o=r.data,r=o==="F!"||o==="F"?r:null}if(r){Be=In(r.nextSibling),i=r.data==="F!";break e}}go(i)}i=!1}i&&(t=n[0])}}return n=jt(),n.memoizedState=n.baseState=t,i={pending:null,lanes:0,dispatch:null,lastRenderedReducer:n_,lastRenderedState:t},n.queue=i,n=b_.bind(null,re,i),i.dispatch=n,i=Fg(!1),o=lb.bind(null,re,!1,i.queue),i=jt(),r={state:t,dispatch:null,action:e,pending:null},i.queue=r,n=LB.bind(null,re,r,o,n),r.dispatch=n,i.memoizedState=e,[t,n,!1]}function X1(e){var t=tt();return i_(t,Oe,e)}function i_(e,t,n){if(t=nb(e,t,n_)[0],e=fd(yr)[0],typeof t==="object"&&t!==null&&typeof t.then==="function")try{var i=ec(t)}catch(s){if(s===Gl)throw lh;throw s}else i=t;t=tt();var r=t.queue,o=r.dispatch;return n!==t.memoizedState&&(re.flags|=2048,Pl(9,{destroy:void 0},zB.bind(null,r,n),null)),[i,o,e]}function zB(e,t){e.action=t}function G1(e){var t=tt(),n=Oe;if(n!==null)return i_(t,n,e);tt(),t=t.memoizedState,n=tt();var i=n.queue.dispatch;return n.memoizedState=e,[t,i,!1]}function Pl(e,t,n,i){return e={tag:e,create:n,deps:i,inst:t,next:null},t=re.updateQueue,t===null&&(t=ah(),re.updateQueue=t),n=t.lastEffect,n===null?t.lastEffect=e.next=e:(i=n.next,n.next=e,e.next=i,t.lastEffect=e),e}function r_(){return tt().memoizedState}function dd(e,t,n,i){var r=jt();re.flags|=e,r.memoizedState=Pl(1|t,{destroy:void 0},n,i===void 0?null:i)}function ch(e,t,n,i){var r=tt();i=i===void 0?null:i;var o=r.memoizedState.inst;Oe!==null&&i!==null&&Wv(i,Oe.memoizedState.deps)?r.memoizedState=Pl(t,o,n,i):(re.flags|=e,r.memoizedState=Pl(1|t,o,n,i))}function Y1(e,t){dd(8390656,8,e,t)}function ib(e,t){ch(2048,8,e,t)}function BB(e){re.flags|=4;var t=re.updateQueue;if(t===null)t=ah(),re.updateQueue=t,t.events=[e];else{var n=t.events;n===null?t.events=[e]:n.push(e)}}function o_(e){var t=tt().memoizedState;return BB({ref:t,nextImpl:e}),function(){if((ve&2)!==0)throw Error(R(440));return t.impl.apply(void 0,arguments)}}function s_(e,t){return ch(4,2,e,t)}function l_(e,t){return ch(4,4,e,t)}function a_(e,t){if(typeof t==="function"){e=e();var n=t(e);return function(){typeof n==="function"?n():t(null)}}if(t!==null&&t!==void 0)return e=e(),t.current=e,function(){t.current=null}}function u_(e,t,n){n=n!==null&&n!==void 0?n.concat([e]):null,ch(4,4,a_.bind(null,t,e),n)}function rb(){}function c_(e,t){var n=tt();t=t===void 0?null:t;var i=n.memoizedState;if(t!==null&&Wv(t,i[1]))return i[0];return n.memoizedState=[e,t],e}function f_(e,t){var n=tt();t=t===void 0?null:t;var i=n.memoizedState;if(t!==null&&Wv(t,i[1]))return i[0];if(i=e(),vs){eo(!0);try{e()}finally{eo(!1)}}return n.memoizedState=[i,t],i}function ob(e,t,n){if(n===void 0||(br&1073741824)!==0&&(de&261930)===0)return e.memoizedState=t;return e.memoizedState=n,e=eC(),re.lanes|=e,yo|=e,n}function d_(e,t,n,i){if(gn(n,t))return n;if(vo.current!==null)return e=ob(e,n,i),gn(e,t)||(at=!0),e;if((br&106)===0||(br&1073741824)!==0&&(de&261930)===0)return at=!0,e.memoizedState=n;return e=eC(),re.lanes|=e,yo|=e,t}function h_(e,t,n,i,r){var o=be.p;be.p=o!==0&&8>o?o:8;var s=ie.T,l={};l.types=s!==null?s.types:null,ie.T=l,lb(e,!1,t,n);try{var a=r(),u=ie.S;if(u!==null&&u(l,a),a!==null&&typeof a==="object"&&typeof a.then==="function"){var c=MB(a,i);Cu(e,t,c,Pn(e))}else Cu(e,t,i,Pn(e))}catch(f){Cu(e,t,{then:function(){},status:"rejected",reason:f},Pn())}finally{be.p=o,s!==null&&l.types!==null&&(s.types=l.types),ie.T=s}}function PB(){}function $g(e,t,n,i){if(e.tag!==5)throw Error(R(476));var r=p_(e).queue;h_(e,r,t,os,n===null?PB:function(){return m_(e),n(i)})}function p_(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:os,baseState:os,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:yr,lastRenderedState:os},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:yr,lastRenderedState:n},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function m_(e){var t=p_(e);t.next===null&&(t=e.alternate.memoizedState),Cu(e,t.next.queue,{},Pn())}function sb(){return Rt(Fl)}function g_(){return tt().memoizedState}function v_(){return tt().memoizedState}function IB(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var n=Pn();e=us(n);var i=cs(t,e,n);i!==null&&(en(i,t,n),Su(i,t,n)),t={cache:Fv()},e.payload=t;return}t=t.return}}function HB(e,t,n){var i=Pn();n={lane:i,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},fh(e)?y_(t,n):(n=Uv(e,t,n,i),n!==null&&(en(n,e,i),x_(n,t,i)))}function b_(e,t,n){var i=Pn();Cu(e,t,n,i)}function Cu(e,t,n,i){var r={lane:i,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(fh(e))y_(t,r);else{var o=e.alternate;if(e.lanes===0&&(o===null||o.lanes===0)&&(o=t.lastRenderedReducer,o!==null))try{var s=t.lastRenderedState,l=o(s,n);if(r.hasEagerState=!0,r.eagerState=l,gn(l,s))return oh(e,t,r,0),Te===null&&rh(),!1}catch(a){}finally{}if(n=Uv(e,t,r,i),n!==null)return en(n,e,i),x_(n,t,i),!0}return!1}function lb(e,t,n,i){if(i={lane:2,revertLane:bb(),gesture:null,action:i,hasEagerState:!1,eagerState:null,next:null},fh(e)){if(t)throw Error(R(479))}else t=Uv(e,n,i,2),t!==null&&en(t,e,2)}function fh(e){var t=e.alternate;return e===re||t!==null&&t===re}function y_(e,t){Al=Bd=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function x_(e,t,n){if((n&4194048)!==0){var i=t.lanes;i&=e.pendingLanes,n|=i,t.lanes=n,ik(e,n)}}var Id={readContext:Rt,use:uh,useCallback:Ye,useContext:Ye,useEffect:Ye,useImperativeHandle:Ye,useLayoutEffect:Ye,useInsertionEffect:Ye,useMemo:Ye,useReducer:Ye,useRef:Ye,useState:Ye,useDebugValue:Ye,useDeferredValue:Ye,useTransition:Ye,useSyncExternalStore:Ye,useId:Ye,useHostTransitionStatus:Ye,useFormState:Ye,useActionState:Ye,useOptimistic:Ye,useMemoCache:Ye,useCacheRefresh:Ye,useEffectEvent:Ye},w_={readContext:Rt,use:uh,useCallback:function(e,t){return jt().memoizedState=[e,t===void 0?null:t],e},useContext:Rt,useEffect:Y1,useImperativeHandle:function(e,t,n){n=n!==null&&n!==void 0?n.concat([e]):null,dd(4194308,4,a_.bind(null,t,e),n)},useLayoutEffect:function(e,t){return dd(4194308,4,e,t)},useInsertionEffect:function(e,t){dd(4,2,e,t)},useMemo:function(e,t){var n=jt();t=t===void 0?null:t;var i=e();if(vs){eo(!0);try{e()}finally{eo(!1)}}return n.memoizedState=[i,t],i},useReducer:function(e,t,n){var i=jt();if(n!==void 0){var r=n(t);if(vs){eo(!0);try{n(t)}finally{eo(!1)}}}else r=t;return i.memoizedState=i.baseState=r,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:r},i.queue=e,e=e.dispatch=HB.bind(null,re,e),[i.memoizedState,e]},useRef:function(e){var t=jt();return e={current:e},t.memoizedState=e},useState:function(e){e=Fg(e);var t=e.queue,n=b_.bind(null,re,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:rb,useDeferredValue:function(e,t){var n=jt();return ob(n,e,t)},useTransition:function(){var e=Fg(!1);return e=h_.bind(null,re,e.queue,!0,!1),jt().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var i=re,r=jt();if(le){if(n===void 0)throw Error(R(407));n=n()}else{if(n=t(),Te===null)throw Error(R(349));(de&127)!==0||Gk(i,t,n)}r.memoizedState=n;var o={value:n,getSnapshot:t};return r.queue=o,Y1(Wk.bind(null,i,o,e),[e]),i.flags|=2048,Pl(9,{destroy:void 0},Yk.bind(null,i,o,n,t),null),n},useId:function(){var e=jt(),t=Te.identifierPrefix;if(le){var n=Ii,i=Pi;n=(i&~(1<<32-mn(i)-1)).toString(32)+n,t="_"+t+"R_"+n,n=Pd++,0<n&&(t+="H"+n.toString(32)),t+="_"}else n=NB++,t="_"+t+"r_"+n.toString(32)+"_";return e.memoizedState=t},useHostTransitionStatus:sb,useFormState:$1,useActionState:$1,useOptimistic:function(e){var t=jt();t.memoizedState=t.baseState=e;var n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=n,t=lb.bind(null,re,!0,n),n.dispatch=t,[e,t]},useMemoCache:tb,useCacheRefresh:function(){return jt().memoizedState=IB.bind(null,re)},useEffectEvent:function(e){var t=jt(),n={impl:e};return t.memoizedState=n,function(){if((ve&2)!==0)throw Error(R(440));return n.impl.apply(void 0,arguments)}}},S_={readContext:Rt,use:uh,useCallback:c_,useContext:Rt,useEffect:ib,useImperativeHandle:u_,useInsertionEffect:s_,useLayoutEffect:l_,useMemo:f_,useReducer:fd,useRef:r_,useState:function(){return fd(yr)},useDebugValue:rb,useDeferredValue:function(e,t){var n=tt();return d_(n,Oe.memoizedState,e,t)},useTransition:function(){var e=fd(yr)[0],t=tt().memoizedState;return[typeof e==="boolean"?e:ec(e),t]},useSyncExternalStore:Xk,useId:g_,useHostTransitionStatus:sb,useFormState:X1,useActionState:X1,useOptimistic:function(e,t){var n=tt();return Zk(n,Oe,e,t)},useMemoCache:tb,useCacheRefresh:v_,useEffectEvent:o_},VB={readContext:Rt,use:uh,useCallback:c_,useContext:Rt,useEffect:ib,useImperativeHandle:u_,useInsertionEffect:s_,useLayoutEffect:l_,useMemo:f_,useReducer:ng,useRef:r_,useState:function(){return ng(yr)},useDebugValue:rb,useDeferredValue:function(e,t){var n=tt();return Oe===null?ob(n,e,t):d_(n,Oe.memoizedState,e,t)},useTransition:function(){var e=ng(yr)[0],t=tt().memoizedState;return[typeof e==="boolean"?e:ec(e),t]},useSyncExternalStore:Xk,useId:g_,useHostTransitionStatus:sb,useFormState:G1,useActionState:G1,useOptimistic:function(e,t){var n=tt();if(Oe!==null)return Zk(n,Oe,e,t);return n.baseState=e,[e,n.queue.dispatch]},useMemoCache:tb,useCacheRefresh:v_,useEffectEvent:o_};function ig(e,t,n,i){t=e.memoizedState,n=n(i,t),n=n===null||n===void 0?t:Me({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var Xg={enqueueSetState:function(e,t,n){e=e._reactInternals;var i=Pn(),r=us(i);r.payload=t,n!==void 0&&n!==null&&(r.callback=n),t=cs(e,r,i),t!==null&&(en(t,e,i),Su(t,e,i))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var i=Pn(),r=us(i);r.tag=1,r.payload=t,n!==void 0&&n!==null&&(r.callback=n),t=cs(e,r,i),t!==null&&(en(t,e,i),Su(t,e,i))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=Pn(),i=us(n);i.tag=2,t!==void 0&&t!==null&&(i.callback=t),t=cs(e,i,n),t!==null&&(en(t,e,n),Su(t,e,n))}};function W1(e,t,n,i,r,o,s){return e=e.stateNode,typeof e.shouldComponentUpdate==="function"?e.shouldComponentUpdate(i,o,s):t.prototype&&t.prototype.isPureReactComponent?!Lu(n,i)||!Lu(r,o):!0}function Q1(e,t,n,i){e=t.state,typeof t.componentWillReceiveProps==="function"&&t.componentWillReceiveProps(n,i),typeof t.UNSAFE_componentWillReceiveProps==="function"&&t.UNSAFE_componentWillReceiveProps(n,i),t.state!==e&&Xg.enqueueReplaceState(t,t.state,null)}function bs(e,t){var n=t;if("ref"in t){n={};for(var i in t)i!=="ref"&&(n[i]=t[i])}if(e=e.defaultProps){n===t&&(n=Me({},n));for(var r in e)n[r]===void 0&&(n[r]=e[r])}return n}function UB(e){Rd(e)}function KB(e){console.error(e)}function jB(e){Rd(e)}function Hd(e,t){try{var n=e.onUncaughtError;n(t.value,{componentStack:t.stack})}catch(i){setTimeout(function(){throw i})}}function J1(e,t,n){try{var i=e.onCaughtError;i(n.value,{componentStack:n.stack,errorBoundary:t.tag===1?t.stateNode:null})}catch(r){setTimeout(function(){throw r})}}function Gg(e,t,n){return n=us(n),n.tag=3,n.payload={element:null},n.callback=function(){Hd(e,t)},n}function k_(e){return e=us(e),e.tag=3,e}function __(e,t,n,i){var r=n.type.getDerivedStateFromError;if(typeof r==="function"){var o=i.value;e.payload=function(){return r(o)},e.callback=function(){J1(t,n,i)}}var s=n.stateNode;s!==null&&typeof s.componentDidCatch==="function"&&(e.callback=function(){J1(t,n,i),typeof r!=="function"&&(co===null?co=new Set([this]):co.add(this));var l=i.stack;this.componentDidCatch(i.value,{componentStack:l!==null?l:""})})}function FB(e,t,n,i,r){if(n.flags|=32768,i!==null&&typeof i==="object"&&typeof i.then==="function"){if(t=n.alternate,t!==null&&hs(t,n,r,!0),n=Nt.current,n!==null){switch(n.tag){case 31:case 13:case 19:return Bt===null?Xd():n.alternate===null&&We===0&&(We=3),n.flags&=-257,n.flags|=65536,n.lanes=r,i===Dd?n.flags|=16384:(t=n.updateQueue,t===null?n.updateQueue=new Set([i]):t.add(i),cg(e,i,r)),!1;case 22:return n.flags|=65536,i===Dd?n.flags|=16384:(t=n.updateQueue,t===null?(t={transitions:null,markerInstances:null,retryQueue:new Set([i])},n.updateQueue=t):(n=t.retryQueue,n===null?t.retryQueue=new Set([i]):n.add(i)),cg(e,i,r)),!1}throw Error(R(435,n.tag))}return cg(e,i,r),Xd(),!1}if(le)return t=Nt.current,t!==null?((t.flags&65536)===0&&(t.flags|=256),t.flags|=65536,t.lanes=r,i!==Bg&&(e=Error(R(422),{cause:i}),Bu(zn(e,n)))):(i!==Bg&&(t=Error(R(423),{cause:i}),Bu(zn(t,n))),e=e.current.alternate,e.flags|=65536,r&=-r,e.lanes|=r,i=zn(i,n),r=Gg(e.stateNode,i,r),tg(e,r),We!==4&&(We=2)),!1;var o=Error(R(520),{cause:i});if(o=zn(o,n),Au===null?Au=[o]:Au.push(o),We!==4&&(We=2),t===null)return!0;i=zn(i,n),n=t;do{switch(n.tag){case 3:return n.flags|=65536,e=r&-r,n.lanes|=e,e=Gg(n.stateNode,i,e),tg(n,e),!1;case 1:if(t=n.type,o=n.stateNode,(n.flags&128)===0&&(typeof t.getDerivedStateFromError==="function"||o!==null&&typeof o.componentDidCatch==="function"&&(co===null||!co.has(o))))return n.flags|=65536,r&=-r,n.lanes|=r,r=k_(r),__(r,e,n,i),tg(n,r),!1;break;case 22:if(n.memoizedState!==null)return n.flags|=65536,!1}n=n.return}while(n!==null);return!1}var ab=Error(R(461)),at=!1;function ft(e,t,n,i){t.child=e===null?Uk(t,null,n,i):gs(t,e.child,n,i)}function Z1(e,t,n,i,r){n=n.render;var o=t.ref;if("ref"in i){var s={};for(var l in i)l!=="ref"&&(s[l]=i[l])}else s=i;if(ps(t),i=Qv(e,t,n,s,o,r),l=Jv(),e!==null&&!at)return Zv(e,t,r),xr(e,t,r);return le&&l&&sh(t),t.flags|=1,ft(e,t,i,r),t.child}function eS(e,t,n,i,r){if(e===null){var o=n.type;if(typeof o==="function"&&!Kv(o)&&o.defaultProps===void 0&&n.compare===null)return t.tag=15,t.type=o,C_(e,t,o,i,r);return e=ad(n.type,null,i,t,t.mode,r),e.ref=t.ref,e.return=t,t.child=e}if(o=e.child,!cb(e,r)){var s=o.memoizedProps;if(n=n.compare,n=n!==null?n:Lu,n(s,i)&&e.ref===t.ref)return xr(e,t,r)}return t.flags|=1,e=pr(o,i),e.ref=t.ref,e.return=t,t.child=e}function C_(e,t,n,i,r){if(e!==null){var o=e.memoizedProps;if(Lu(o,i)&&e.ref===t.ref)if(at=!1,t.pendingProps=i=o,cb(e,r))(e.flags&131072)!==0&&(at=!0);else return t.lanes=e.lanes,xr(e,t,r)}return Yg(e,t,n,i,r)}function E_(e,t,n,i){var r=i.children,o=e!==null?e.memoizedState:null;if(e===null&&t.stateNode===null&&(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),i.mode==="hidden"){if((t.flags&128)!==0){if(o=o!==null?o.baseLanes|n:n,e!==null){i=t.child=e.child;for(r=0;i!==null;)r=r|i.lanes|i.childLanes,i=i.sibling;i=r&~o}else i=0,t.child=null;return tS(e,t,o,n,i)}if((n&536870912)!==0)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&cd(t,o!==null?o.cachePool:null),o!==null?j1(t,o):Kg(),Fk(t);else return i=t.lanes=536870912,tS(e,t,o!==null?o.baseLanes|n:n,n,i)}else o!==null?(cd(t,o.cachePool),j1(t,o),uo(),t.memoizedState=null):(e!==null&&cd(t,null),Kg(),uo());return ft(e,t,r,n),t.child}function Eu(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function tS(e,t,n,i,r){var o=qv();return o=o===null?null:{parent:lt._currentValue,pool:o},t.memoizedState={baseLanes:n,cachePool:o},e!==null&&cd(t,null),Kg(),Fk(t),e!==null&&hs(e,t,i,!0),t.childLanes=r,null}function hd(e,t){return t=dh({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function nS(e,t,n){return gs(t,e.child,null,n),e=hd(t,t.pendingProps),e.flags|=2,cn(t),t.memoizedState=null,e}function qB(e,t,n){var i=t.pendingProps,r=(t.flags&128)!==0;if(t.flags&=-129,e===null){if(le){if(i.mode==="hidden")return e=hd(t,i),t.lanes=536870912,e.memoizedState={baseLanes:0,cachePool:null},Eu(null,e);if(jg(t),(e=Be)?(e=OC(e,Bn),e=e!==null&&e.data==="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:mo!==null?{id:Pi,overflow:Ii}:null,retryLane:536870912,hydrationErrors:null},n=Lk(e),n.return=t,t.child=n,bt=t,Be=null)):e=null,e===null)throw go(t);return t.lanes=536870912,null}return hd(t,i)}var o=e.memoizedState;if(o!==null){var s=o.dehydrated;if(jg(t),r)if(t.flags&256)t.flags&=-257,t=nS(e,t,n);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(R(558));else if(at||hs(e,t,n,!1),r=(n&e.childLanes)!==0,at||r){if(vo.current===null){if(i=Te,i!==null&&(s=rk(i,n),s!==0&&s!==o.retryLane))throw o.retryLane=s,ks(e,s),en(i,e,s),ab;Xd()}t=nS(e,t,n)}else e=o.treeContext,Be=In(s.nextSibling),bt=t,le=!0,lo=null,Bn=!1,e!==null&&Bk(t,e),t=hd(t,i),t.flags|=134221824;return t}return e=pr(e.child,{mode:i.mode,children:i.children}),e.ref=t.ref,t.child=e,e.return=t,e}function al(e,t){var n=t.ref;if(n===null)e!==null&&e.ref!==null&&(t.flags|=4194816);else{if(typeof n!=="function"&&typeof n!=="object")throw Error(R(284));if(e===null||e.ref!==n)t.flags|=4194816}}function Yg(e,t,n,i,r){if(ps(t),n=Qv(e,t,n,i,void 0,r),i=Jv(),e!==null&&!at)return Zv(e,t,r),xr(e,t,r);return le&&i&&sh(t),t.flags|=1,ft(e,t,n,r),t.child}function iS(e,t,n,i,r,o){if(ps(t),t.updateQueue=null,n=$k(t,i,n,r),qk(e),i=Jv(),e!==null&&!at)return Zv(e,t,o),xr(e,t,o);return le&&i&&sh(t),t.flags|=1,ft(e,t,n,o),t.child}function rS(e,t,n,i,r){if(ps(t),t.stateNode===null){var o=xl,s=n.contextType;typeof s==="object"&&s!==null&&(o=Rt(s)),o=new n(i,o),t.memoizedState=o.state!==null&&o.state!==void 0?o.state:null,o.updater=Xg,t.stateNode=o,o._reactInternals=t,o=t.stateNode,o.props=i,o.state=t.memoizedState,o.refs={},Xv(t),s=n.contextType,o.context=typeof s==="object"&&s!==null?Rt(s):xl,o.state=t.memoizedState,s=n.getDerivedStateFromProps,typeof s==="function"&&(ig(t,n,s,i),o.state=t.memoizedState),typeof n.getDerivedStateFromProps==="function"||typeof o.getSnapshotBeforeUpdate==="function"||typeof o.UNSAFE_componentWillMount!=="function"&&typeof o.componentWillMount!=="function"||(s=o.state,typeof o.componentWillMount==="function"&&o.componentWillMount(),typeof o.UNSAFE_componentWillMount==="function"&&o.UNSAFE_componentWillMount(),s!==o.state&&Xg.enqueueReplaceState(o,o.state,null),_u(t,i,o,r),ku(),o.state=t.memoizedState),typeof o.componentDidMount==="function"&&(t.flags|=4194308),i=!0}else if(e===null){o=t.stateNode;var l=t.memoizedProps,a=bs(n,l);o.props=a;var u=o.context,c=n.contextType;s=xl,typeof c==="object"&&c!==null&&(s=Rt(c));var f=n.getDerivedStateFromProps;c=typeof f==="function"||typeof o.getSnapshotBeforeUpdate==="function",l=t.pendingProps!==l,c||typeof o.UNSAFE_componentWillReceiveProps!=="function"&&typeof o.componentWillReceiveProps!=="function"||(l||u!==s)&&Q1(t,o,i,s),Jr=!1;var d=t.memoizedState;o.state=d,_u(t,i,o,r),ku(),u=t.memoizedState,l||d!==u||Jr?(typeof f==="function"&&(ig(t,n,f,i),u=t.memoizedState),(a=Jr||W1(t,n,a,i,d,u,s))?(c||typeof o.UNSAFE_componentWillMount!=="function"&&typeof o.componentWillMount!=="function"||(typeof o.componentWillMount==="function"&&o.componentWillMount(),typeof o.UNSAFE_componentWillMount==="function"&&o.UNSAFE_componentWillMount()),typeof o.componentDidMount==="function"&&(t.flags|=4194308)):(typeof o.componentDidMount==="function"&&(t.flags|=4194308),t.memoizedProps=i,t.memoizedState=u),o.props=i,o.state=u,o.context=s,i=a):(typeof o.componentDidMount==="function"&&(t.flags|=4194308),i=!1)}else{o=t.stateNode,Vg(e,t),s=t.memoizedProps,c=bs(n,s),o.props=c,f=t.pendingProps,d=o.context,u=n.contextType,a=xl,typeof u==="object"&&u!==null&&(a=Rt(u)),l=n.getDerivedStateFromProps,(u=typeof l==="function"||typeof o.getSnapshotBeforeUpdate==="function")||typeof o.UNSAFE_componentWillReceiveProps!=="function"&&typeof o.componentWillReceiveProps!=="function"||(s!==f||d!==a)&&Q1(t,o,i,a),Jr=!1,d=t.memoizedState,o.state=d,_u(t,i,o,r),ku();var h=t.memoizedState;s!==f||d!==h||Jr||e!==null&&e.dependencies!==null&&Nd(e.dependencies)?(typeof l==="function"&&(ig(t,n,l,i),h=t.memoizedState),(c=Jr||W1(t,n,c,i,d,h,a)||e!==null&&e.dependencies!==null&&Nd(e.dependencies))?(u||typeof o.UNSAFE_componentWillUpdate!=="function"&&typeof o.componentWillUpdate!=="function"||(typeof o.componentWillUpdate==="function"&&o.componentWillUpdate(i,h,a),typeof o.UNSAFE_componentWillUpdate==="function"&&o.UNSAFE_componentWillUpdate(i,h,a)),typeof o.componentDidUpdate==="function"&&(t.flags|=4),typeof o.getSnapshotBeforeUpdate==="function"&&(t.flags|=1024)):(typeof o.componentDidUpdate!=="function"||s===e.memoizedProps&&d===e.memoizedState||(t.flags|=4),typeof o.getSnapshotBeforeUpdate!=="function"||s===e.memoizedProps&&d===e.memoizedState||(t.flags|=1024),t.memoizedProps=i,t.memoizedState=h),o.props=i,o.state=h,o.context=a,i=c):(typeof o.componentDidUpdate!=="function"||s===e.memoizedProps&&d===e.memoizedState||(t.flags|=4),typeof o.getSnapshotBeforeUpdate!=="function"||s===e.memoizedProps&&d===e.memoizedState||(t.flags|=1024),i=!1)}return o=i,al(e,t),i=(t.flags&128)!==0,o||i?(o=t.stateNode,n=i&&typeof n.getDerivedStateFromError!=="function"?null:o.render(),t.flags|=1,e!==null&&i?(t.child=gs(t,e.child,null,r),t.child=gs(t,null,n,r)):ft(e,t,n,r),t.memoizedState=o.state,e=t.child):e=xr(e,t,r),e}function oS(e,t,n,i){return ds(),t.flags|=256,ft(e,t,n,i),t.child}var Wg={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Qg(e){return{baseLanes:e,cachePool:Ik()}}function Jg(e,t,n){return e=e!==null?e.childLanes&~n:0,t&&(e|=dn),e}function O_(e,t,n){var i=t.pendingProps,r=!1,o=(t.flags&128)!==0,s;if((s=o)||(s=e!==null&&e.memoizedState===null?!1:(Tt.current&2)!==0),s&&(r=!0,t.flags&=-129),s=(t.flags&32)!==0,t.flags&=-33,e===null){if(le){if(r?ao(t):uo(),(e=Be)?(e=OC(e,Bn),e=e!==null&&e.data!=="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:mo!==null?{id:Pi,overflow:Ii}:null,retryLane:536870912,hydrationErrors:null},n=Lk(e),n.return=t,t.child=n,bt=t,Be=null)):e=null,e===null)throw go(t);return wb(e)?t.lanes=32:t.lanes=536870912,null}if(o=i.children,i=i.fallback,r)return uo(),r=t.mode,o=dh({mode:"hidden",children:o},r),i=ss(i,r,n,null),o.return=t,i.return=t,o.sibling=i,t.child=o,i=t.child,i.memoizedState=Qg(n),i.childLanes=Jg(e,s,n),t.memoizedState=Wg,Eu(null,i);return ao(t),ub(t,o)}var l=e.memoizedState;if(l!==null){var a=l.dehydrated;if(a!==null)return $B(e,t,o,s,i,a,l,n)}if(r)return uo(),r=i.fallback,o=t.mode,l=e.child,a=l.sibling,i=pr(l,{mode:"hidden",children:i.children}),i.subtreeFlags=l.subtreeFlags&1206910976,a!==null?r=pr(a,r):(r=ss(r,o,n,null),r.flags|=2),r.return=t,i.return=t,i.sibling=r,t.child=i,Eu(null,i),i=t.child,r=e.child.memoizedState,r===null?r=Qg(n):(o=r.cachePool,o!==null?(l=lt._currentValue,o=o.parent!==l?{parent:l,pool:l}:o):o=Ik(),r={baseLanes:r.baseLanes|n,cachePool:o}),i.memoizedState=r,i.childLanes=Jg(e,s,n),t.memoizedState=Wg,Eu(e.child,i);return ao(t),n=e.child,e=n.sibling,n=pr(n,{mode:"visible",children:i.children}),n.return=t,n.sibling=null,e!==null&&(s=t.deletions,s===null?(t.deletions=[e],t.flags|=16):s.push(e)),t.child=n,t.memoizedState=null,n}function ub(e,t){return t=dh({mode:"visible",children:t},e.mode),t.return=e,e.child=t}function dh(e,t){return e=Zt(22,e,null,t),e.lanes=0,e}function Yf(e,t,n){return gs(t,e.child,null,n),e=ub(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function $B(e,t,n,i,r,o,s,l){if(n){if(t.flags&256)return ao(t),t.flags&=-257,Yf(e,t,l);if(t.memoizedState!==null)return uo(),t.child=e.child,t.flags|=128,null;return uo(),o=r.fallback,s=t.mode,r=dh({mode:"visible",children:r.children},s),o=ss(o,s,l,null),o.flags|=2,r.return=t,o.return=t,r.sibling=o,t.child=r,gs(t,e.child,null,l),r=t.child,r.memoizedState=Qg(l),r.childLanes=Jg(e,i,l),t.memoizedState=Wg,Eu(null,r)}if(ao(t),wb(o)){if(i=o.nextSibling&&o.nextSibling.dataset,i)var a=i.dgst;return i=a,i!==""&&(r=Error(R(419)),r.stack="",r.digest=i,Bu({value:r,source:null,stack:null})),Yf(e,t,l)}if(at||hs(e,t,l,!1),i=(l&e.childLanes)!==0,at||i){if(vo.current!==null)return Yf(e,t,l);if(i=Te,i!==null&&(r=rk(i,l),r!==0&&r!==s.retryLane))throw s.retryLane=r,ks(e,r),en(i,e,r),ab;return Cv(o)||Xd(),Yf(e,t,l)}if(Cv(o))return t.flags|=192,t.child=e.child,null;return e=s.treeContext,Be=In(o.nextSibling),bt=t,le=!0,lo=null,Bn=!1,e!==null&&Bk(t,e),t=ub(t,r.children),t.flags|=134221824,t}function sS(e,t,n){e.lanes|=t;var i=e.alternate;i!==null&&(i.lanes|=t),ud(e.return,t,n)}function lS(e){for(var t=null;e!==null;){var n=e.alternate;n!==null&&zd(n)===null&&(t=e),e=e.sibling}return t}function Wf(e,t,n,i,r,o){var s=e.memoizedState;s===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:i,tail:n,tailMode:r,treeForkCount:o}:(s.isBackwards=t,s.rendering=null,s.renderingStartTime=0,s.last=i,s.tail=n,s.tailMode=r,s.treeForkCount=o)}function rg(e){var t=e.child;for(e.child=null;t!==null;){var n=t.sibling;t.sibling=e.child,e.child=t,t=n}}function Zg(e,t,n){var i=t.pendingProps,r=i.revealOrder,o=i.tail;i=i.children;var s=Tt.current;if(t.flags&128)return Iu(t,s),null;var l=(s&2)!==0;if(l?(s=s&1|2,t.flags|=128):s&=1,Iu(t,s),r==="backwards"&&e!==null?(rg(e),ft(e,t,i,n),rg(e)):ft(e,t,i,n),i=le?zu:0,!l&&e!==null&&(e.flags&128)!==0)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&sS(e,n,t);else if(e.tag===19)sS(e,n,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;e.sibling===null;){if(e.return===null||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}switch(r){case"backwards":n=lS(t.child),n===null?(r=t.child,t.child=null):(r=n.sibling,n.sibling=null,rg(t)),Wf(t,!0,r,null,o,i);break;case"unstable_legacy-backwards":n=null,r=t.child;for(t.child=null;r!==null;){if(e=r.alternate,e!==null&&zd(e)===null){t.child=r;break}e=r.sibling,r.sibling=n,n=r,r=e}Wf(t,!0,n,null,o,i);break;case"together":Wf(t,!1,null,null,void 0,i);break;case"independent":t.memoizedState=null;break;default:n=lS(t.child),n===null?(r=t.child,t.child=null):(r=n.sibling,n.sibling=null),Wf(t,!1,r,n,o,i)}return t.child}function aS(e,t,n){var i=t.pendingProps;return no(t,t.type,i.value),ft(e,t,i.children,n),t.child}function xr(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),yo|=t.lanes,(n&t.childLanes)===0)if(e!==null){if(hs(e,t,n,!1),(n&t.childLanes)===0)return null}else return null;if(e!==null&&t.child!==e.child)throw Error(R(153));if(t.child!==null){e=t.child,n=pr(e,e.pendingProps),t.child=n;for(n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=pr(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function cb(e,t){if((e.lanes&t)!==0)return!0;return e=e.dependencies,e!==null&&Nd(e)?!0:!1}function XB(e,t,n){switch(t.tag){case 3:_d(t,t.stateNode.containerInfo),no(t,lt,e.memoizedState.cache),ds();break;case 27:case 5:Eg(t);break;case 4:_d(t,t.stateNode.containerInfo);break;case 10:no(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,jg(t),null;break;case 13:var i=t.memoizedState;if(i!==null){if(i.dehydrated!==null)return ao(t),t.flags|=128,null;i=hs(e,t,n,!1);var r=t.child.childLanes;if(i||(n&r)!==0)return O_(e,t,n);return ao(t),e=xr(e,t,n),e!==null?e.sibling:null}ao(t);break;case 19:if(t.flags&128)return Zg(e,t,n);if(r=(e.flags&128)!==0,i=(n&t.childLanes)!==0,i||(hs(e,t,n,!1),i=(n&t.childLanes)!==0),r){if(i)return Zg(e,t,n);t.flags|=128}if(r=t.memoizedState,r!==null&&(r.rendering=null,r.tail=null,r.lastEffect=null),Iu(t,Tt.current),i)break;else return null;case 22:return t.lanes=0,E_(e,t,n,t.pendingProps);case 24:no(t,lt,e.memoizedState.cache)}return xr(e,t,n)}function R_(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps)at=!0;else{if(!cb(e,n)&&(t.flags&128)===0)return at=!1,XB(e,t,n);at=(e.flags&131072)!==0?!0:!1}else at=!1,le&&(t.flags&1048576)!==0&&zk(t,zu,t.index);switch(t.lanes=0,t.tag){case 16:e:{var i=t.pendingProps;if(e=ts(t.elementType),t.type=e,typeof e==="function")Kv(e)?(i=bs(e,i),t.tag=1,t=rS(null,t,e,i,n)):(t.tag=0,t=Yg(null,t,e,i,n));else{if(e!==void 0&&e!==null){var r=e.$$typeof;if(r===Tv){t.tag=11,t=Z1(null,t,e,i,n);break e}else if(r===Mv){t.tag=14,t=eS(null,t,e,i,n);break e}else if(r===zi){t.tag=10,t.type=e,t=aS(null,t,n);break e}}throw t=_g(e)||e,Error(R(306,t,""))}}return t;case 0:return Yg(e,t,t.type,t.pendingProps,n);case 1:return i=t.type,r=bs(i,t.pendingProps),rS(e,t,i,r,n);case 3:e:{if(_d(t,t.stateNode.containerInfo),e===null)throw Error(R(387));i=t.pendingProps;var o=t.memoizedState;r=o.element,Vg(e,t),_u(t,i,null,n);var s=t.memoizedState;if(i=s.cache,no(t,lt,i),i!==o.cache&&Ig(t,[lt],n,!0),ku(),i=s.element,o.isDehydrated)if(o={element:i,isDehydrated:!1,cache:s.cache},t.updateQueue.baseState=o,t.memoizedState=o,t.flags&256){t=oS(e,t,i,n);break e}else if(i!==r){r=zn(Error(R(424)),t),Bu(r),t=oS(e,t,i,n);break e}else{switch(e=t.stateNode.containerInfo,e.nodeType){case 9:e=e.body;break;default:e=e.nodeName==="HTML"?e.ownerDocument.body:e}Be=In(e.firstChild),bt=t,le=!0,lo=null,Bn=!0,n=Uk(t,null,i,n);for(t.child=n;n;)n.flags=n.flags&-3|134221824,n=n.sibling}else{if(ds(),i===r){t=xr(e,t,n);break e}ft(e,t,i,n)}t=t.child}return t;case 26:return al(e,t),e===null?(n=DS(t.type,null,t.pendingProps,null))?t.memoizedState=n:le||(t.stateNode=bC(t.type,t.pendingProps,so.current,t)):t.memoizedState=DS(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return Eg(t),e===null&&le&&(i=t.stateNode=RC(t.type,t.pendingProps,so.current),bt=t,Bn=!0,r=Be,wo(t.type)?(Ev=r,Be=In(i.firstChild)):Be=r),ft(e,t,t.pendingProps.children,n),al(e,t),e===null&&(t.flags|=4194304),t.child;case 5:if(e===null&&le){if(r=i=Be)i=H4(i,t.type,t.pendingProps,Bn),i!==null?(t.stateNode=i,bt=t,Be=In(i.firstChild),Bn=!1,r=!0):r=!1;r||go(t)}return Eg(t),r=t.type,o=t.pendingProps,s=e!==null?e.memoizedProps:null,i=o.children,Sv(r,o)?i=null:s!==null&&Sv(r,s)&&(t.flags|=32),t.memoizedState!==null&&(r=Qv(e,t,DB,null,null,n),Fl._currentValue=r),al(e,t),ft(e,t,i,n),t.child;case 6:if(e===null&&le){if(e=n=Be)n=V4(n,t.pendingProps,Bn),n!==null?(t.stateNode=n,bt=t,Be=null,e=!0):e=!1;e||go(t)}return null;case 13:return O_(e,t,n);case 4:return _d(t,t.stateNode.containerInfo),i=t.pendingProps,e===null?t.child=gs(t,null,i,n):ft(e,t,i,n),t.child;case 11:return Z1(e,t,t.type,t.pendingProps,n);case 7:return i=t.pendingProps,al(e,t),ft(e,t,i,n),t.child;case 8:return ft(e,t,t.pendingProps.children,n),t.child;case 12:return ft(e,t,t.pendingProps.children,n),t.child;case 10:return aS(e,t,n);case 9:return r=t.type._context,i=t.pendingProps.children,ps(t),r=Rt(r),i=i(r),t.flags|=1,ft(e,t,i,n),t.child;case 14:return eS(e,t,t.type,t.pendingProps,n);case 15:return C_(e,t,t.type,t.pendingProps,n);case 19:return Zg(e,t,n);case 31:return qB(e,t,n);case 22:return E_(e,t,n,t.pendingProps);case 24:return ps(t),i=Rt(lt),e===null?(r=qv(),r===null&&(r=Te,o=Fv(),r.pooledCache=o,o.refCount++,o!==null&&(r.pooledCacheLanes|=n),r=o),t.memoizedState={parent:i,cache:r},Xv(t),no(t,lt,r)):((e.lanes&n)!==0&&(Vg(e,t),_u(t,null,null,n),ku()),r=e.memoizedState,o=t.memoizedState,r.parent!==i?(r={parent:i,cache:i},t.memoizedState=r,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=r),no(t,lt,i)):(i=o.cache,no(t,lt,i),i!==r.cache&&Ig(t,[lt],n,!0))),ft(e,t,t.pendingProps.children,n),t.child;case 30:return t.stateNode===null&&(t.stateNode={autoName:null,paired:null,clones:null,ref:null}),i=t.pendingProps,i.name!=null&&i.name!=="auto"?t.flags|=e===null?18882560:18874368:le&&sh(t),e!==null&&e.memoizedProps.name!==i.name?t.flags|=4194816:al(e,t),ft(e,t,i.children,n),t.child;case 29:throw t.pendingProps}throw Error(R(156,t.tag))}function fr(e){e.flags|=4}function og(e,t,n,i,r){var o;if(o=(e.mode&32)!==0)o=n===null?BS(t,i):BS(t,i)&&(i.src!==n.src||i.srcSet!==n.srcSet);if(o){if(e.flags|=16777216,(r&335544128)===r)if(e.stateNode.complete)e.flags|=8192;else if(iC())e.flags|=8192;else throw as=Dd,$v}else e.flags&=-16777217}function uS(e,t){if(t.type!=="stylesheet"||(t.state.loading&4)!==0)e.flags&=-16777217;else if(e.flags|=16777216,!NC(t))if(iC())e.flags|=8192;else throw as=Dd,$v}function Qf(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag!==22?tk():536870912,e.lanes|=t,Il|=t)}function su(e,t){if(!le)switch(e.tailMode){case"visible":break;case"collapsed":for(var n=e.tail,i=null;n!==null;)n.alternate!==null&&(i=n),n=n.sibling;i===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:i.sibling=null;break;default:t=e.tail;for(n=null;t!==null;)t.alternate!==null&&(n=t),t=t.sibling;n===null?e.tail=null:n.sibling=null}}function ze(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,i=0;if(t)for(var r=e.child;r!==null;)n|=r.lanes|r.childLanes,i|=r.subtreeFlags&1206910976,i|=r.flags&1206910976,r.return=e,r=r.sibling;else for(r=e.child;r!==null;)n|=r.lanes|r.childLanes,i|=r.subtreeFlags,i|=r.flags,r.return=e,r=r.sibling;return e.subtreeFlags|=i,e.childLanes=n,t}function GB(e,t,n){var i=t.pendingProps;switch(jv(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return ze(t),null;case 1:return ze(t),null;case 3:if(n=t.stateNode,i=null,e!==null&&(i=e.memoizedState.cache),t.memoizedState.cache!==i&&(t.flags|=2048),mr(lt),Ll(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),e===null||e.child===null)sl(t)?fr(t):e===null||e.memoizedState.isDehydrated&&(t.flags&256)===0||(t.flags|=1024,eg());return ze(t),null;case 26:var{type:r,memoizedState:o}=t;return e===null?(fr(t),o!==null?(ze(t),uS(t,o)):(ze(t),og(t,r,null,i,n))):o?o!==e.memoizedState?(fr(t),ze(t),uS(t,o)):(ze(t),t.flags&=-16777217):(e=e.memoizedProps,e!==i&&fr(t),ze(t),og(t,r,e,i,n)),null;case 27:if(Cd(t),n=so.current,r=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==i&&fr(t);else{if(!i){if(t.stateNode===null)throw Error(R(166));return ze(t),t.subtreeFlags&=-33554433,null}e=Hi.current,sl(t)?B1(t,e):(e=RC(r,i,n),t.stateNode=e,fr(t))}return ze(t),t.subtreeFlags&=-33554433,null;case 5:if(Cd(t),r=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==i&&fr(t);else{if(!i){if(t.stateNode===null)throw Error(R(166));return ze(t),t.subtreeFlags&=-33554433,null}if(o=Hi.current,sl(t))B1(t,o);else{var s=Ku(so.current);switch(o){case 1:o=s.createElementNS("http://www.w3.org/2000/svg",r);break;case 2:o=s.createElementNS("http://www.w3.org/1998/Math/MathML",r);break;default:switch(r){case"svg":o=s.createElementNS("http://www.w3.org/2000/svg",r);break;case"math":o=s.createElementNS("http://www.w3.org/1998/Math/MathML",r);break;case"script":o=s.createElement("div"),o.innerHTML="<script></script>",o=o.removeChild(o.firstChild);break;case"select":o=typeof i.is==="string"?s.createElement("select",{is:i.is}):s.createElement("select"),i.multiple?o.multiple=!0:i.size&&(o.size=i.size);break;default:o=typeof i.is==="string"?s.createElement(r,{is:i.is}):s.createElement(r)}}o[Ot]=t,o[nn]=i;e:for(s=t.child;s!==null;){if(s.tag===5||s.tag===6)o.appendChild(s.stateNode);else if(s.tag!==4&&s.tag!==27&&s.child!==null){s.child.return=s,s=s.child;continue}if(s===t)break e;for(;s.sibling===null;){if(s.return===null||s.return===t)break e;s=s.return}s.sibling.return=s.return,s=s.sibling}t.stateNode=o;e:switch(Mt(o,r,i),r){case"button":case"input":case"select":case"textarea":i=!!i.autoFocus;break e;case"img":i=!0;break e;default:i=!1}i&&fr(t)}}return ze(t),t.subtreeFlags&=-33554433,og(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,n),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==i&&fr(t);else{if(typeof i!=="string"&&t.stateNode===null)throw Error(R(166));if(e=so.current,sl(t)){if(e=t.stateNode,n=t.memoizedProps,i=null,r=bt,r!==null)switch(r.tag){case 27:case 5:i=r.memoizedProps}e[Ot]=t,e=e.nodeValue===n||i!==null&&i.suppressHydrationWarning===!0||gC(e.nodeValue,n)?!0:!1,e||go(t,!0)}else e=Ku(e).createTextNode(i),e[Ot]=t,t.stateNode=e}return ze(t),null;case 31:if(n=t.memoizedState,e===null||e.memoizedState!==null){if(i=sl(t),n!==null){if(e===null){if(!i)throw Error(R(318));if(e=t.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(R(557));e[Ot]=t}else ds(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;ze(t),e=!1}else n=eg(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=n),e=!0;if(!e){if(t.flags&256)return cn(t),t;return cn(t),null}if((t.flags&128)!==0)throw Error(R(558))}return ze(t),null;case 13:if(i=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(r=sl(t),i!==null&&i.dehydrated!==null){if(e===null){if(!r)throw Error(R(318));if(r=t.memoizedState,r=r!==null?r.dehydrated:null,!r)throw Error(R(317));r[Ot]=t}else ds(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;ze(t),r=!1}else r=eg(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=r),r=!0;if(!r){if(t.flags&256)return cn(t),t;return cn(t),null}}if(cn(t),(t.flags&128)!==0)return t.lanes=n,t;return n=i!==null,e=e!==null&&e.memoizedState!==null,n&&(i=t.child,r=null,i.alternate!==null&&i.alternate.memoizedState!==null&&i.alternate.memoizedState.cachePool!==null&&(r=i.alternate.memoizedState.cachePool.pool),o=null,i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(o=i.memoizedState.cachePool.pool),o!==r&&(i.flags|=2048)),n!==e&&n&&(t.child.flags|=8192),Qf(t,t.updateQueue),ze(t),null;case 4:return Ll(),e===null&&pC(t.stateNode.containerInfo),t.flags|=67108864,ze(t),null;case 10:return mr(t.type),ze(t),null;case 19:if(Yv(t),i=t.memoizedState,i===null)return ze(t),null;if(r=(t.flags&128)!==0,o=i.rendering,o===null)if(r)su(i,!1);else{if(We!==0||e!==null&&(e.flags&128)!==0)for(e=t.child;e!==null;){if(o=zd(e),o!==null){t.flags|=128,su(i,!1),e=o.updateQueue,t.updateQueue=e,Qf(t,e),t.subtreeFlags=0,e=n;for(n=t.child;n!==null;)Dk(n,e),n=n.sibling;return Iu(t,Tt.current&1|2),le&&dr(t,i.treeForkCount),t.child}e=e.sibling}i.tail!==null&&hn()>qd&&(t.flags|=128,r=!0,su(i,!1),t.lanes=4194304)}else{if(!r)if(e=zd(o),e!==null){if(t.flags|=128,r=!0,e=e.updateQueue,t.updateQueue=e,Qf(t,e),su(i,!0),i.tail===null&&i.tailMode!=="collapsed"&&i.tailMode!=="visible"&&!o.alternate&&!le)return ze(t),null}else 2*hn()-i.renderingStartTime>qd&&n!==536870912&&(t.flags|=128,r=!0,su(i,!1),t.lanes=4194304);i.isBackwards?(o.sibling=t.child,t.child=o):(e=i.last,e!==null?e.sibling=o:t.child=o,i.last=o)}if(i.tail!==null){e=i.tail;e:{for(n=e;n!==null;){if(n.alternate!==null){n=!1;break e}n=n.sibling}n=!0}return i.rendering=e,i.tail=e.sibling,i.renderingStartTime=hn(),e.sibling=null,o=Tt.current,o=r?o&1|2:o&1,i.tailMode==="visible"||i.tailMode==="collapsed"||!n||le?Iu(t,o):(n=o,Pe(Nt,t),Pe(Tt,n),Bt===null&&(Bt=t)),le&&dr(t,i.treeForkCount),e}return ze(t),null;case 22:case 23:return cn(t),Gv(),i=t.memoizedState!==null,e!==null?e.memoizedState!==null!==i&&(t.flags|=8192):i&&(t.flags|=8192),i?(n&536870912)!==0&&(t.flags&128)===0&&(ze(t),t.subtreeFlags&6&&(t.flags|=8192)):ze(t),n=t.updateQueue,n!==null&&Qf(t,n.retryQueue),n=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),i=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(i=t.memoizedState.cachePool.pool),i!==n&&(t.flags|=2048),e!==null&&At(ls),null;case 24:return n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),mr(lt),ze(t),null;case 25:return null;case 30:return t.flags|=33554432,ze(t),null}throw Error(R(156,t.tag))}function YB(e,t){switch(jv(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return mr(lt),Ll(),e=t.flags,(e&65536)!==0&&(e&128)===0?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return Cd(t),null;case 31:if(t.memoizedState!==null){if(cn(t),t.alternate===null)throw Error(R(340));ds()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(cn(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(R(340));ds()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return Yv(t),e=t.flags,e&65536?(t.flags=e&-65537|128,e=t.memoizedState,e!==null&&(e.rendering=null,e.tail=null),t.flags|=4,t):null;case 4:return Ll(),null;case 10:return mr(t.type),null;case 22:case 23:return cn(t),Gv(),e!==null&&At(ls),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return mr(lt),null;case 25:return null;default:return null}}function A_(e,t){switch(jv(t),t.tag){case 3:mr(lt),Ll();break;case 26:case 27:case 5:Cd(t);break;case 4:Ll();break;case 31:t.memoizedState!==null&&cn(t);break;case 13:cn(t);break;case 19:Yv(t);break;case 10:mr(t.type);break;case 22:case 23:cn(t),Gv(),e!==null&&At(ls);break;case 24:mr(lt)}}function tc(e,t){try{var n=t.updateQueue,i=n!==null?n.lastEffect:null;if(i!==null){var r=i.next;n=r;do{if((n.tag&e)===e){i=void 0;var o=n.create,s=n.inst;i=o(),s.destroy=i}n=n.next}while(n!==r)}}catch(l){Ce(t,t.return,l)}}function bo(e,t,n){try{var i=t.updateQueue,r=i!==null?i.lastEffect:null;if(r!==null){var o=r.next;i=o;do{if((i.tag&e)===e){var s=i.inst,l=s.destroy;if(l!==void 0){s.destroy=void 0,r=t;var a=n,u=l;try{u()}catch(c){Ce(r,a,c)}}}i=i.next}while(i!==o)}}catch(c){Ce(t,t.return,c)}}function T_(e){var t=e.updateQueue;if(t!==null){var n=e.stateNode;try{jk(t,n)}catch(i){Ce(e,e.return,i)}}}function M_(e,t,n){n.props=bs(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(i){Ce(e,t,i)}}function Di(e,t){try{var n=e.ref;if(n!==null){switch(e.tag){case 26:case 27:case 5:var i=e.stateNode;break;case 30:var r=e.stateNode,o=vr(e.memoizedProps,r);if(r.ref===null||r.ref.name!==o)r.ref=SC(o);i=r.ref;break;case 7:if(e.stateNode===null){var s=new vn(e);tn(e.child,!1,P4,s,void 0,void 0),e.stateNode=s}i=e.stateNode;break;default:i=e.stateNode}typeof n==="function"?e.refCleanup=n(i):n.current=i}}catch(l){Ce(e,t,l)}}function Et(e,t){var n=e.ref,i=e.refCleanup;if(n!==null)if(typeof i==="function")try{i()}catch(r){Ce(e,t,r)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof n==="function")try{n(null)}catch(r){Ce(e,t,r)}else n.current=null}function Vd(e,t){if((e.tag===5||e.tag===27||e.tag===6)&&e.alternate===null&&t!==null)for(var n=0;n<t.length;n++)EC(e.stateNode,t[n])}function cS(e){for(var t=e.return;t!==null;){if(db(t)&&EC(e.stateNode,t.stateNode),fb(t))break;t=t.return}}function Ou(e){for(var t=e.return;t!==null;){if(db(t)&&I4(e.stateNode,t.stateNode),fb(t))break;t=t.return}}function fb(e){return e.tag===5||e.tag===3||e.tag===27}function db(e){return e&&e.tag===7&&e.stateNode!==null}function ev(e){var{type:t,memoizedProps:n,stateNode:i}=e;try{e:switch(t){case"button":case"input":case"select":case"textarea":n.autoFocus&&i.focus();break e;case"img":n.src?i.src=n.src:n.srcSet&&(i.srcset=n.srcSet)}}catch(r){Ce(e,e.return,r)}}function sg(e,t,n){try{var i=e.stateNode;y4(i,e.type,n,t),i[nn]=t}catch(r){Ce(e,e.return,r)}}function N_(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&wo(e.type)||e.tag===4}function lg(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||N_(e.return))return null;e=e.return}e.sibling.return=e.return;for(e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.tag===27&&wo(e.type))continue e;if(e.flags&2)continue e;if(e.child===null||e.tag===4)continue e;else e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function tv(e,t,n,i){var r=e.tag;if(r===5||r===6)r=e.stateNode,t?(n.nodeType===9?n.body:n.nodeName==="HTML"?n.ownerDocument.body:n).insertBefore(r,t):(t=n.nodeType===9?n.body:n.nodeName==="HTML"?n.ownerDocument.body:n,t.appendChild(r),n=n._reactRootContainer,n!==null&&n!==void 0||t.onclick!==null||(t.onclick=Bi)),Vd(e,i),me=!0;else if(r!==4&&(r===27&&(Vd(e,i),i=null,wo(e.type)&&(n=e.stateNode,t=null)),e=e.child,e!==null))for(tv(e,t,n,i),e=e.sibling;e!==null;)tv(e,t,n,i),e=e.sibling}function Ud(e,t,n,i){var r=e.tag;if(r===5||r===6)r=e.stateNode,t?n.insertBefore(r,t):n.appendChild(r),Vd(e,i),me=!0;else if(r!==4&&(r===27&&(Vd(e,i),i=null,wo(e.type)&&(n=e.stateNode)),e=e.child,e!==null))for(Ud(e,t,n,i),e=e.sibling;e!==null;)Ud(e,t,n,i),e=e.sibling}function D_(e){var{stateNode:t,memoizedProps:n}=e;try{for(var i=e.type,r=t.attributes;r.length;)t.removeAttributeNode(r[0]);Mt(t,i,n),t[Ot]=e,t[nn]=n}catch(o){Ce(e,e.return,o)}}var Kd=!1,fn=null;function fS(e){if(e.tag===30||(e.subtreeFlags&33554432)!==0)Kd=!0}var Li=null;function dS(){var e=Li;return Li=null,e}var Jt=0;function Yl(e,t,n,i,r){return Jt=0,L_(e.child,t,n,i,r)}function L_(e,t,n,i,r){for(var o=!1;e!==null;){if(e.tag===5){var s=e.stateNode;if(i!==null){var l=kv(s);i.push(l),l.view&&(o=!0)}else o||kv(s).view&&(o=!0);Kd=!0,yC(s,Jt===0?t:t+"_"+Jt,n),Jt++}else if(e.tag!==22||e.memoizedState===null)e.tag===30&&r||L_(e.child,t,n,i,r)&&(o=!0);e=e.sibling}return o}function Ui(e,t){for(;e!==null;){if(e.tag===5)xC(e.stateNode,e.memoizedProps);else if(e.tag!==22||e.memoizedState===null)e.tag===30&&t||Ui(e.child,t);e=e.sibling}}function pd(e){if((e.subtreeFlags&18874368)!==0)for(e=e.child;e!==null;){if(e.tag!==22||e.memoizedState===null){if(pd(e),e.tag===30&&(e.flags&18874368)!==0&&e.stateNode.paired){var t=e.memoizedProps;if(t.name==null||t.name==="auto")throw Error(R(544));var n=t.name;t=kr(t.default,t.share),t!=="none"&&(Yl(e,n,t,null,!1)||Ui(e.child,!1))}}e=e.sibling}}function nv(e,t){if(e.tag===30){var n=e.stateNode,i=e.memoizedProps,r=vr(i,n),o=kr(i.default,n.paired?i.share:i.enter);o!=="none"?Yl(e,r,o,null,!1)?(pd(e),n.paired||t||Hl(e,i.onEnter)):Ui(e.child,!1):pd(e)}else if((e.subtreeFlags&33554432)!==0)for(e=e.child;e!==null;)nv(e,t),e=e.sibling;else pd(e)}function iv(e){if(fn!==null&&fn.size!==0){var t=fn;if((e.subtreeFlags&18874368)!==0)for(e=e.child;e!==null;){if(e.tag!==22||e.memoizedState===null){if(e.tag===30&&(e.flags&18874368)!==0){var n=e.memoizedProps,i=n.name;if(i!=null&&i!=="auto"){var r=t.get(i);if(r!==void 0){var o=kr(n.default,n.share);if(o!=="none"&&(Yl(e,i,o,null,!1)?(o=e.stateNode,r.paired=o,o.paired=r,Hl(e,n.onShare)):Ui(e.child,!1)),t.delete(i),t.size===0)break}}}iv(e)}e=e.sibling}}}function rv(e){if(e.tag===30){var t=e.memoizedProps,n=vr(t,e.stateNode),i=fn!==null?fn.get(n):void 0,r=kr(t.default,i!==void 0?t.share:t.exit);r!=="none"&&(Yl(e,n,r,null,!1)?i!==void 0?(r=e.stateNode,i.paired=r,r.paired=i,fn.delete(n),Hl(e,t.onShare)):Hl(e,t.onExit):Ui(e.child,!1)),fn!==null&&iv(e)}else if((e.subtreeFlags&33554432)!==0)for(e=e.child;e!==null;)rv(e),e=e.sibling;else fn!==null&&iv(e)}function z_(e){for(e=e.child;e!==null;){if(e.tag===30){var t=e.memoizedProps,n=vr(t,e.stateNode);t=kr(t.default,t.update),e.flags&=-5,t!=="none"&&Yl(e,n,t,e.memoizedState=[],!1)}else(e.subtreeFlags&33554432)!==0&&z_(e);e=e.sibling}}function ov(e){if((e.subtreeFlags&18874368)!==0)for(e=e.child;e!==null;){if(e.tag!==22||e.memoizedState===null){if(e.tag===30&&(e.flags&18874368)!==0){var t=e.stateNode;t.paired!==null&&(t.paired=null,Ui(e.child,!1))}ov(e)}e=e.sibling}}function md(e){if(e.tag===30)e.stateNode.paired=null,Ui(e.child,!1),ov(e);else if((e.subtreeFlags&33554432)!==0)for(e=e.child;e!==null;)md(e),e=e.sibling;else ov(e)}function B_(e){for(e=e.child;e!==null;)e.tag===30?Ui(e.child,!1):(e.subtreeFlags&33554432)!==0&&B_(e),e=e.sibling}function hb(e,t,n,i,r,o,s){for(var l=!1;t!==null;){if(t.tag===5){var a=t.stateNode;if(o!==null&&Jt<o.length){var u=o[Jt],c=kv(a);if(u.view||c.view)l=!0;var f;if(f=(e.flags&4)===0)if(c.clip)f=!0;else{f=u.rect;var d=c.rect;f=f.y!==d.y||f.x!==d.x||f.height!==d.height||f.width!==d.width}f&&(e.flags|=4),c.abs?c=!u.abs:(u=u.rect,c=c.rect,c=u.height!==c.height||u.width!==c.width),c&&(e.flags|=32)}else e.flags|=32;(e.flags&4)!==0&&yC(a,Jt===0?n:n+"_"+Jt,r),l&&(e.flags&4)!==0||(Li===null&&(Li=[]),Li.push(a,Jt===0?i:i+"_"+Jt,t.memoizedProps)),Jt++}else if(t.tag!==22||t.memoizedState===null)t.tag===30&&s?e.flags|=t.flags&32:hb(e,t.child,n,i,r,o,s)&&(l=!0);t=t.sibling}return l}function P_(e,t){for(e=e.child;e!==null;){if(e.tag===30){var n=e.memoizedProps,i=e.stateNode,r=vr(n,i),o=kr(n.default,n.update);if(t){i=i.clones;var s=i===null?null:i.map(C4)}else s=e.memoizedState,e.memoizedState=null;i=e;var l=e.child;Jt=0,r=hb(i,l,r,r,o,s,!1),(e.flags&4)!==0&&r&&(t||Hl(e,n.onUpdate))}else(e.subtreeFlags&33554432)!==0&&P_(e,t);e=e.sibling}}var mt=!1,xe=!1,Ti=!1,ag=!1,hS=typeof WeakSet==="function"?WeakSet:Set,gt=null,Mi=!1,mu=!1,jd=!1,sv=!1;function WB(e,t,n){if(e=e.containerInfo,xv=ql,e=Ck(e),Hv(e)){if("selectionStart"in e)var i={start:e.selectionStart,end:e.selectionEnd};else e:{i=(i=e.ownerDocument)&&i.defaultView||window;var r=i.getSelection&&i.getSelection();if(r&&r.rangeCount!==0){i=r.anchorNode;var o=r.anchorOffset,s=r.focusNode;r=r.focusOffset;try{i.nodeType,s.nodeType}catch(b){i=null;break e}var l=0,a=-1,u=-1,c=0,f=0,d=e,h=null;t:for(;;){for(var m;;){if(d!==i||o!==0&&d.nodeType!==3||(a=l+o),d!==s||r!==0&&d.nodeType!==3||(u=l+r),d.nodeType===3&&(l+=d.nodeValue.length),(m=d.firstChild)===null)break;h=d,d=m}for(;;){if(d===e)break t;if(h===i&&++c===o&&(a=l),h===s&&++f===r&&(u=l),(m=d.nextSibling)!==null)break;d=h,h=d.parentNode}d=m}i=a===-1||u===-1?null:{start:a,end:u}}else i=null}i=i||{start:0,end:0}}else i=null;wv={focusedElem:e,selectionRange:i},ql=!1,n=(n&335544064)===n,gt=t;for(t=n?9270:1024;gt!==null;){if(e=gt,n&&(i=e.deletions,i!==null))for(o=0;o<i.length;o++)n&&rv(i[o]);if(e.alternate===null&&(e.flags&2)!==0)n&&fS(e),Jf(n);else{if(e.tag===22){if(i=e.alternate,e.memoizedState!==null){i!==null&&i.memoizedState===null&&n&&rv(i),Jf(n);continue}else if(i!==null&&i.memoizedState!==null){n&&fS(e),Jf(n);continue}}i=e.child,(e.subtreeFlags&t)!==0&&i!==null?(i.return=e,gt=i):(n&&z_(e),Jf(n))}}fn=null}function Jf(e){for(;gt!==null;){var t=gt,n=e,{alternate:i,flags:r}=t;switch(t.tag){case 0:case 11:case 15:break;case 1:if((r&1024)!==0&&i!==null){n=void 0,r=i.memoizedProps,i=i.memoizedState;var o=t.stateNode;try{var s=bs(t.type,r);n=o.getSnapshotBeforeUpdate(s,i),o.__reactInternalSnapshotBeforeUpdate=n}catch(l){Ce(t,t.return,l)}}break;case 3:if((r&1024)!==0){if(i=t.stateNode.containerInfo,n=i.nodeType,n===9)_v(i);else if(n===1)switch(i.nodeName){case"HEAD":case"HTML":case"BODY":_v(i);break;default:i.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;case 30:n&&i!==null&&(n=vr(i.memoizedProps,i.stateNode),r=t.memoizedProps,r=kr(r.default,r.update),r!=="none"&&Yl(i,n,r,i.memoizedState=[],!0));break;default:if((r&1024)!==0)throw Error(R(163))}if(i=t.sibling,i!==null){i.return=t.return,gt=i;break}gt=t.return}}function I_(e,t,n){var i=n.flags;switch(n.tag){case 0:case 11:case 15:Ni(e,n),i&4&&tc(5,n);break;case 1:if(Ni(e,n),i&4)if(e=n.stateNode,t===null)try{e.componentDidMount()}catch(s){Ce(n,n.return,s)}else{var r=bs(n.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(r,t,e.__reactInternalSnapshotBeforeUpdate)}catch(s){Ce(n,n.return,s)}}i&64&&T_(n),i&512&&Di(n,n.return);break;case 3:if(Ni(e,n),i&64&&(e=n.updateQueue,e!==null)){if(t=null,n.child!==null)switch(n.child.tag){case 27:case 5:t=n.child.stateNode;break;case 1:t=n.child.stateNode}try{jk(e,t)}catch(s){Ce(n,n.return,s)}}break;case 27:t===null&&i&4&&D_(n);case 26:case 5:Ni(e,n),t===null&&i&4&&ev(n),i&512&&Di(n,n.return);break;case 12:Ni(e,n);break;case 31:Ni(e,n),i&4&&K_(e,n);break;case 13:Ni(e,n),i&4&&j_(e,n),i&64&&(e=n.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(n=a4.bind(null,n),U4(e,n))));break;case 22:if(i=n.memoizedState!==null||mt,!i){var o=t!==null&&t.memoizedState!==null||xe;t=mt,r=xe,mt=i,(xe=o)&&!r?(i=2,(n.subtreeFlags&8772)!==0&&(i|=1),ii(e,n,i)):Ni(e,n),mt=t,xe=r}break;case 30:Ni(e,n),i&512&&Di(n,n.return);break;case 7:i&512&&Di(n,n.return);default:Ni(e,n)}}function lv(e,t){for(e=e.child;e!==null;)H_(e,t),e=e.sibling}function H_(e,t){switch(e.tag){case 5:case 26:try{var n=e.stateNode;if(t){var i=n.style;typeof i.setProperty==="function"?i.setProperty("display","none","important"):i.display="none"}else{var r=e.stateNode,o=e.memoizedProps.style,s=o!==void 0&&o!==null&&o.hasOwnProperty("display")?o.display:null;r.style.display=s==null||typeof s==="boolean"?"":(""+s).trim()}}catch(a){Ce(e,e.return,a)}av(e,t);break;case 6:try{e.stateNode.nodeValue=t?"":e.memoizedProps,me=!0}catch(a){Ce(e,e.return,a)}break;case 18:try{var l=e.stateNode;t?OS(l,!0):OS(e.stateNode,!1)}catch(a){Ce(e,e.return,a)}break;case 22:case 23:e.memoizedState===null&&lv(e,t);break;default:lv(e,t)}}function av(e,t){if(e.subtreeFlags&67108864)for(e=e.child;e!==null;){e:{var n=e,i=t;switch(n.tag){case 4:H_(n,i);break e;case 22:n.memoizedState===null&&av(n,i);break e;default:av(n,i)}}e=e.sibling}}function V_(e){var t=e.alternate;t!==null&&(e.alternate=null,V_(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&eh(t)),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}var Fe=null,Wt=!1;function ni(e,t,n){for(n=n.child;n!==null;)U_(e,t,n),n=n.sibling}function U_(e,t,n){if(pn&&typeof pn.onCommitFiberUnmount==="function")try{pn.onCommitFiberUnmount(Gu,n)}catch(o){}switch(n.tag){case 26:xe||Et(n,t),ni(e,t,n),n.memoizedState?n.memoizedState.count--:n.stateNode&&!xe&&(n=n.stateNode,n.parentNode.removeChild(n));break;case 27:xe||Et(n,t),Ou(n);var i=Fe,r=Wt;wo(n.type)&&(Fe=n.stateNode,Wt=!1),ni(e,t,n),AC(n.stateNode,n.type,n.memoizedProps),Fe=i,Wt=r;break;case 5:xe||Et(n,t),Ou(n);case 6:if(n.tag===6&&Ou(n),i=Fe,r=Wt,Fe=null,ni(e,t,n),Fe=i,Wt=r,Fe!==null)if(Wt)try{(Fe.nodeType===9?Fe.body:Fe.nodeName==="HTML"?Fe.ownerDocument.body:Fe).removeChild(n.stateNode),me=!0}catch(o){Ce(n,t,o)}else try{Fe.removeChild(n.stateNode),me=!0}catch(o){Ce(n,t,o)}break;case 18:Fe!==null&&(Wt?(e=Fe,ES(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,n.stateNode),$l(e)):ES(Fe,n.stateNode));break;case 4:i=Fe,r=Wt,Fe=n.stateNode.containerInfo,Wt=!0,ni(e,t,n),Fe=i,Wt=r;break;case 0:case 11:case 14:case 15:bo(2,n,t),xe||bo(4,n,t),ni(e,t,n);break;case 1:xe||(Et(n,t),i=n.stateNode,typeof i.componentWillUnmount==="function"&&M_(n,t,i)),ni(e,t,n);break;case 21:ni(e,t,n);break;case 22:xe=(i=xe)||n.memoizedState!==null,ni(e,t,n),xe=i;break;case 30:Et(n,t),ni(e,t,n);break;case 7:xe||Et(n,t),ni(e,t,n);break;default:ni(e,t,n)}}function K_(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{$l(e)}catch(n){Ce(t,t.return,n)}}}function j_(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{$l(e)}catch(n){Ce(t,t.return,n)}}function QB(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new hS),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new hS),t;default:throw Error(R(435,e.tag))}}function Zf(e,t){var n=QB(e);t.forEach(function(i){if(!n.has(i)){n.add(i);var r=u4.bind(null,e,i);i.then(r,r)}})}function Ut(e,t,n){var i=t.deletions;if(i!==null)for(var r=0;r<i.length;r++){var o=i[r],s=e,l=t,a=l;e:for(;a!==null;){switch(a.tag){case 27:if(wo(a.type)){Fe=a.stateNode,Wt=!1;break e}break;case 5:Fe=a.stateNode,Wt=!1;break e;case 3:case 4:Fe=a.stateNode.containerInfo,Wt=!0;break e}a=a.return}if(Fe===null)throw Error(R(160));U_(s,l,o),Fe=null,Wt=!1,s=o.alternate,s!==null&&(s.return=null),o.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)F_(t,e,n),t=t.sibling}var ri=null;function F_(e,t,n){var i=e.alternate,r=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(r&4&&(i=e.updateQueue,i=i!==null?i.events:null,i!==null))for(var o=0;o<i.length;o++){var s=i[o];s.ref.impl=s.nextImpl}Ut(t,e,n),Kt(e),r&4&&(bo(3,e,e.return),tc(3,e),bo(5,e,e.return));break;case 1:Ut(t,e,n),Kt(e),r&512&&(xe||i===null||Et(i,i.return)),r&64&&mt&&(e=e.updateQueue,e!==null&&(t=e.callbacks,t!==null&&(n=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=n===null?t:n.concat(t))));break;case 26:if(o=ri,Ut(t,e,n),Kt(e),r&512&&(xe||i===null||Et(i,i.return)),r&4)if(r=i!==null?i.memoizedState:null,n=e.memoizedState,i===null)if(n===null)if(e.stateNode===null)if(mt)e.stateNode=bC(e.type,e.memoizedProps,t.containerInfo,e);else{e:{t=e.type,n=e.memoizedProps,r=o.ownerDocument||o;t:switch(t){case"title":if(i=r.getElementsByTagName("title")[0],!i||i[Qu]||i[Ot]||i.namespaceURI==="http://www.w3.org/2000/svg"||i.hasAttribute("itemprop"))i=r.createElement(t),r.head.insertBefore(i,r.querySelector("head > title"));Mt(i,t,n),i[Ot]=e,vt(i),t=i;break e;case"link":if(o=zS("link","href",r).get(t+(n.href||""))){for(s=0;s<o.length;s++)if(i=o[s],i.getAttribute("href")===(n.href==null||n.href===""?null:n.href)&&i.getAttribute("rel")===(n.rel==null?null:n.rel)&&i.getAttribute("title")===(n.title==null?null:n.title)&&i.getAttribute("crossorigin")===(n.crossOrigin==null?null:n.crossOrigin)){o.splice(s,1);break t}}i=r.createElement(t),Mt(i,t,n),r.head.appendChild(i);break;case"meta":if(o=zS("meta","content",r).get(t+(n.content||""))){for(s=0;s<o.length;s++)if(i=o[s],i.getAttribute("content")===(n.content==null?null:""+n.content)&&i.getAttribute("name")===(n.name==null?null:n.name)&&i.getAttribute("property")===(n.property==null?null:n.property)&&i.getAttribute("http-equiv")===(n.httpEquiv==null?null:n.httpEquiv)&&i.getAttribute("charset")===(n.charSet==null?null:n.charSet)){o.splice(s,1);break t}}i=r.createElement(t),Mt(i,t,n),r.head.appendChild(i);break;default:throw Error(R(468,t))}i[Ot]=e,vt(i),t=i}e.stateNode=t}else mt||Ov(o,e.type,e.stateNode);else e.stateNode=LS(o,n,e.memoizedProps);else r!==n?(r===null?(t=i.stateNode,t===null||xe||t.parentNode.removeChild(t)):r.count--,n===null?mt||Ov(o,e.type,e.stateNode):LS(o,n,e.memoizedProps)):n===null&&e.stateNode!==null&&sg(e,e.memoizedProps,i.memoizedProps);break;case 27:Ut(t,e,n),Kt(e),r&512&&(xe||i===null||Et(i,i.return)),i!==null&&r&4&&sg(e,e.memoizedProps,i.memoizedProps);break;case 5:if(o=Ti,Ti=!1,Ut(t,e,n),Ti=o,Kt(e),r&512&&(xe||i===null||Et(i,i.return)),e.flags&32){t=e.stateNode;try{Bl(t,""),me=!0}catch(c){Ce(e,e.return,c)}}r&4&&e.stateNode!=null&&(t=e.memoizedProps,sg(e,t,i!==null?i.memoizedProps:t)),r&1024&&(ag=!0);break;case 6:if(Ut(t,e,n),Kt(e),r&4){if(e.stateNode===null)throw Error(R(162));t=e.memoizedProps,n=e.stateNode;try{n.nodeValue=t,me=!0}catch(c){Ce(e,e.return,c)}}break;case 3:if(me=!1,yd=null,o=ri,ri=ju(t.containerInfo),Ut(t,e,n),ri=o,Kt(e),r&4&&i!==null&&i.memoizedState.isDehydrated)try{$l(t.containerInfo)}catch(c){Ce(e,e.return,c)}ag&&(ag=!1,q_(e)),me=!1;break;case 4:r=Ti,Ti=mt,i=y1(),o=ri,ri=ju(e.stateNode.containerInfo),Ut(t,e,n),Kt(e),ri=o,me&&mu&&(jd=!0),me=i,Ti=r;break;case 12:Ut(t,e,n),Kt(e);break;case 31:Ut(t,e,n),Kt(e),r&4&&(t=e.updateQueue,t!==null&&(e.updateQueue=null,Zf(e,t)));break;case 13:Ut(t,e,n),Kt(e),e.child.flags&8192&&e.memoizedState!==null!==(i!==null&&i.memoizedState!==null)&&(hh=hn()),r&4&&(t=e.updateQueue,t!==null&&(e.updateQueue=null,Zf(e,t)));break;case 22:o=e.memoizedState!==null,s=i!==null&&i.memoizedState!==null;var l=mt,a=xe,u=Ti;mt=l||o,Ti=u||o,xe=a||s,Ut(t,e,n),xe=a,Ti=u,mt=l,Kt(e),r&8192&&(t=e.stateNode,t._visibility=o?t._visibility&-2:t._visibility|1,!o||i===null||s||mt||xe||(t=s||xe,n=mt,i=xe,mt=o||mt,xe=t,Wr(e,2),mt=n,xe=i),!o&&Ti||lv(e,o)),r&4&&(t=e.updateQueue,t!==null&&(n=t.retryQueue,n!==null&&(t.retryQueue=null,Zf(e,n))));break;case 19:Ut(t,e,n),Kt(e),r&4&&(t=e.updateQueue,t!==null&&(e.updateQueue=null,Zf(e,t)));break;case 30:r&512&&(xe||i===null||Et(i,i.return)),r=y1(),o=mu,s=(n&335544064)===n,l=e.memoizedProps,mu=s&&kr(l.default,l.update)!=="none",Ut(t,e,n),Kt(e),s&&i!==null&&me&&(e.flags|=4),mu=o,me=r;break;case 21:break;case 7:r&512&&(xe||i===null||Et(i,i.return)),i&&i.stateNode!==null&&(i.stateNode._fragmentFiber=e);default:Ut(t,e,n),Kt(e)}}function Kt(e){var t=e.flags;if(t&2){try{for(var n,i=e.return;i!==null;){if(N_(i)){n=i;break}i=i.return}i=null;for(var r=e.return;r!==null;){if(db(r)){var o=r.stateNode;i===null?i=[o]:i.push(o)}if(fb(r))break;r=r.return}var s=i;if(n==null)throw Error(R(160));switch(n.tag){case 27:var l=n.stateNode,a=lg(e);Ud(e,a,l,s);break;case 5:var u=n.stateNode;n.flags&32&&(Bl(u,""),n.flags&=-33);var c=lg(e);Ud(e,c,u,s);break;case 3:case 4:var f=n.stateNode.containerInfo,d=lg(e);tv(e,d,f,s);break;default:throw Error(R(161))}}catch(h){Ce(e,e.return,h)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function q_(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;q_(t),t.tag===5&&t.flags&1024&&(t=t.stateNode,ql=!0,t.reset(),ql=!1),e=e.sibling}}function ll(e,t){if(t.subtreeFlags&9270)for(t=t.child;t!==null;)$_(t,e),t=t.sibling;else P_(t,!1)}function $_(e,t){var n=e.alternate;if(n===null)nv(e,!1);else switch(e.tag){case 3:if(sv=Mi=!1,dS(),ll(t,e),!Mi&&!jd){if(e=Li,e!==null)for(var i=0;i<e.length;i+=3){n=e[i];var r=e[i+1];xC(n,e[i+2]),n=n.ownerDocument.documentElement,n!==null&&n.animate({opacity:[0,0],pointerEvents:["none","none"]},{duration:0,fill:"forwards",pseudoElement:"::view-transition-group("+r+")"})}e=t.containerInfo,e=e.nodeType===9?e.documentElement:e.ownerDocument.documentElement,e!==null&&e.style.viewTransitionName===""&&(e.style.viewTransitionName="none",e.animate({opacity:[0,0],pointerEvents:["none","none"]},{duration:0,fill:"forwards",pseudoElement:"::view-transition-group(root)"}),e.animate({width:[0,0],height:[0,0]},{duration:0,fill:"forwards",pseudoElement:"::view-transition"})),sv=!0}Li=null;break;case 5:ll(t,e);break;case 4:i=Mi,Mi=!1,ll(t,e),Mi&&(jd=!0),Mi=i;break;case 22:e.memoizedState===null&&(n.memoizedState!==null?nv(e,!1):ll(t,e));break;case 30:i=Mi,r=dS(),Mi=!1,ll(t,e),Mi&&(e.flags|=4);var o=e.memoizedProps,s=e.stateNode;t=vr(o,s),s=vr(n.memoizedProps,s);var l=kr(o.default,o.update);l==="none"?t=!1:(o=n.memoizedState,n.memoizedState=null,n=e.child,Jt=0,t=hb(e,n,t,s,l,o,!0),Jt!==(o===null?0:o.length)&&(e.flags|=32)),(e.flags&4)!==0&&t?(Hl(e,e.memoizedProps.onUpdate),Li=r):r!==null&&(r.push.apply(r,Li),Li=r),Mi=(e.flags&32)!==0?!0:i;break;default:ll(t,e)}}function Ni(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)I_(e,t.alternate,t),t=t.sibling}function Wr(e,t){for(e=e.child;e!==null;){var n=e,i=t;switch(n.tag){case 0:case 11:case 14:case 15:bo(4,n,n.return),Wr(n,i);break;case 1:Et(n,n.return);var r=n.stateNode;typeof r.componentWillUnmount==="function"&&M_(n,n.return,r),Wr(n,i);break;case 27:(i&2)!==0&&AC(n.stateNode,n.type,n.memoizedProps);case 5:Et(n,n.return),n.tag!==5&&n.tag!==27||Ou(n),Wr(n,i);break;case 6:Ou(n);break;case 26:Et(n,n.return),r=n.stateNode,n.memoizedState!==null||r===null||xe||r.parentNode.removeChild(r),Wr(n,i);break;case 22:n.memoizedState===null&&Wr(n,i);break;case 30:Et(n,n.return),Wr(n,i);break;case 7:Et(n,n.return);default:Wr(n,i)}e=e.sibling}}function ii(e,t,n){n=(t.subtreeFlags&8772)!==0?n:n&-2;for(t=t.child;t!==null;){var i=t.alternate,r=e,o=t,s=o.flags,l=(n&1)!==0;switch(o.tag){case 0:case 11:case 15:ii(r,o,n),tc(4,o);break;case 1:if(ii(r,o,n),i=o,r=i.stateNode,typeof r.componentDidMount==="function")try{r.componentDidMount()}catch(c){Ce(i,i.return,c)}if(i=o,r=i.updateQueue,r!==null){var a=i.stateNode;try{var u=r.shared.hiddenCallbacks;if(u!==null)for(r.shared.hiddenCallbacks=null,r=0;r<u.length;r++)Kk(u[r],a)}catch(c){Ce(i,i.return,c)}}l&&s&64&&T_(o),Di(o,o.return);break;case 27:(n&2)!==0&&D_(o);case 5:o.tag!==5&&o.tag!==27||cS(o),ii(r,o,n),l&&i===null&&s&4&&ev(o),Di(o,o.return);break;case 6:cS(o);break;case 26:a=o.stateNode,o.memoizedState!==null||a===null||mt||Ov(ju(a.ownerDocument),o.type,a),ii(r,o,n),l&&i===null&&s&4&&ev(o),Di(o,o.return);break;case 12:ii(r,o,n);break;case 31:ii(r,o,n),l&&s&4&&K_(r,o);break;case 13:ii(r,o,n),l&&s&4&&j_(r,o);break;case 22:o.memoizedState===null&&ii(r,o,n),Di(o,o.return);break;case 30:ii(r,o,n),Di(o,o.return);break;case 7:Di(o,o.return);default:ii(r,o,n)}t=t.sibling}}function pb(e,t){var n=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),e=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(e=t.memoizedState.cachePool.pool),e!==n&&(e!=null&&e.refCount++,n!=null&&Zu(n))}function mb(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&Zu(e))}function Tn(e,t,n,i){var r=(n&335544064)===n;if(t.subtreeFlags&(r?10262:10256))for(t=t.child;t!==null;)X_(e,t,n,i),t=t.sibling;else r&&B_(t)}function X_(e,t,n,i){var r=(n&335544064)===n;r&&t.alternate===null&&t.return!==null&&t.return.alternate!==null&&md(t);var o=t.flags;switch(t.tag){case 0:case 11:case 15:Tn(e,t,n,i),o&2048&&tc(9,t);break;case 1:Tn(e,t,n,i);break;case 3:Tn(e,t,n,i),r&&sv&&(e=e.containerInfo,e=e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,e.style.viewTransitionName==="root"&&(e.style.viewTransitionName=""),e=e.ownerDocument.documentElement,e!==null&&e.style.viewTransitionName==="none"&&(e.style.viewTransitionName="")),o&2048&&(o=null,t.alternate!==null&&(o=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==o&&(t.refCount++,o!=null&&Zu(o)));break;case 12:if(o&2048){Tn(e,t,n,i),o=t.stateNode;try{var s=t.memoizedProps,l=s.id,a=s.onPostCommit;typeof a==="function"&&a(l,t.alternate===null?"mount":"update",o.passiveEffectDuration,-0)}catch(u){Ce(t,t.return,u)}}else Tn(e,t,n,i);break;case 31:Tn(e,t,n,i);break;case 13:Tn(e,t,n,i);break;case 23:break;case 22:s=t.stateNode,l=t.alternate,t.memoizedState!==null?(r&&l!==null&&l.memoizedState===null&&md(l),s._visibility&2?Tn(e,t,n,i):Ru(e,t)):(r&&l!==null&&l.memoizedState!==null&&md(t),s._visibility&2?Tn(e,t,n,i):(s._visibility|=2,ul(e,t,n,i,(t.subtreeFlags&10256)!==0||!1))),o&2048&&pb(l,t);break;case 24:Tn(e,t,n,i),o&2048&&mb(t.alternate,t);break;case 30:r&&(o=t.alternate,o!==null&&(Ui(o.child,!0),Ui(t.child,!0))),Tn(e,t,n,i);break;default:Tn(e,t,n,i)}}function ul(e,t,n,i,r){r=r&&((t.subtreeFlags&10256)!==0||!1);for(t=t.child;t!==null;){var o=e,s=t,l=n,a=i,u=s.flags;switch(s.tag){case 0:case 11:case 15:ul(o,s,l,a,r),tc(8,s);break;case 23:break;case 22:var c=s.stateNode;s.memoizedState!==null?c._visibility&2?ul(o,s,l,a,r):Ru(o,s):(c._visibility|=2,ul(o,s,l,a,r)),r&&u&2048&&pb(s.alternate,s);break;case 24:ul(o,s,l,a,r),r&&u&2048&&mb(s.alternate,s);break;default:ul(o,s,l,a,r)}t=t.sibling}}function Ru(e,t){if(t.subtreeFlags&10256)for(t=t.child;t!==null;){var n=e,i=t,r=i.flags;switch(i.tag){case 22:Ru(n,i),r&2048&&pb(i.alternate,i);break;case 24:Ru(n,i),r&2048&&mb(i.alternate,i);break;default:Ru(n,i)}t=t.sibling}}var ns=8192;function Jo(e,t,n){if(e.subtreeFlags&ns)for(e=e.child;e!==null;)G_(e,t,n),e=e.sibling}function G_(e,t,n){switch(e.tag){case 26:Jo(e,t,n),e.flags&ns&&(e.memoizedState!==null?t3(n,ri,e.memoizedState,e.memoizedProps):(e=e.stateNode,(t&335544128)===t&&PS(n,e)));break;case 5:Jo(e,t,n),e.flags&ns&&(e=e.stateNode,(t&335544128)===t&&PS(n,e));break;case 3:case 4:var i=ri;ri=ju(e.stateNode.containerInfo),Jo(e,t,n),ri=i;break;case 22:e.memoizedState===null&&(i=e.alternate,i!==null&&i.memoizedState!==null?(i=ns,ns=16777216,Jo(e,t,n),ns=i):Jo(e,t,n));break;case 30:if((e.flags&ns)!==0&&(i=e.memoizedProps.name,i!=null&&i!=="auto")){var r=e.stateNode;r.paired=null,fn===null&&(fn=new Map),fn.set(i,r)}Jo(e,t,n);break;default:Jo(e,t,n)}}function Y_(e){var t=e.alternate;if(t!==null&&(e=t.child,e!==null)){t.child=null;do t=e.sibling,e.sibling=null,e=t;while(e!==null)}}function lu(e){var t=e.deletions;if((e.flags&16)!==0){if(t!==null)for(var n=0;n<t.length;n++){var i=t[n];gt=i,Q_(i,e)}Y_(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)W_(e),e=e.sibling}function W_(e){switch(e.tag){case 0:case 11:case 15:lu(e),e.flags&2048&&bo(9,e,e.return);break;case 3:lu(e);break;case 12:lu(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,gd(e)):lu(e);break;default:lu(e)}}function gd(e){var t=e.deletions;if((e.flags&16)!==0){if(t!==null)for(var n=0;n<t.length;n++){var i=t[n];gt=i,Q_(i,e)}Y_(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:bo(8,t,t.return),gd(t);break;case 22:n=t.stateNode,n._visibility&2&&(n._visibility&=-3,gd(t));break;default:gd(t)}e=e.sibling}}function Q_(e,t){for(;gt!==null;){var n=gt;switch(n.tag){case 0:case 11:case 15:bo(8,n,t);break;case 23:case 22:if(n.memoizedState!==null&&n.memoizedState.cachePool!==null){var i=n.memoizedState.cachePool.pool;i!=null&&i.refCount++}break;case 24:Zu(n.memoizedState.cache)}if(i=n.child,i!==null)i.return=n,gt=i;else e:for(n=e;gt!==null;){i=gt;var r=i.sibling,o=i.return;if(V_(i),i===n){gt=null;break e}if(r!==null){r.return=o,gt=r;break e}gt=o}}}var JB={getCacheForType:function(e){var t=Rt(lt),n=t.data.get(e);return n===void 0&&(n=e(),t.data.set(e,n)),n},cacheSignal:function(){return Rt(lt).controller.signal}},ZB=typeof WeakMap==="function"?WeakMap:Map,ve=0,Te=null,ue=null,de=0,ke=0,an=null,io=!1,Wl=!1,gb=!1,wr=0,We=0,yo=0,fs=0,Fd=0,dn=0,Il=0,Au=null,Qt=null,uv=!1,hh=0,J_=0,qd=1/0,$d=null,co=null,$e=0,si=null,ys=null,Vi=0,cv=0,fv=null,Z_=null,Ml=null,Nl=null,Dl=null,Tu=0,vd=null;function Pn(){return(ve&2)!==0&&de!==0?de&-de:ie.T!==null?bb():sk()}function eC(){if(dn===0)if((de&536870912)===0||le){var e=Kf;Kf<<=1,(Kf&3932160)===0&&(Kf=262144),dn=e}else dn=536870912;return e=Nt.current,e!==null&&(e.flags|=32),dn}function Hl(e,t){if(t!=null){var n=e.stateNode,i=n.ref;i===null&&(i=n.ref=SC(vr(e.memoizedProps,n))),Nl===null&&(Nl=[]),Nl.push(t.bind(null,i))}}function en(e,t,n){if(e===Te&&(ke===2||ke===9)||e.cancelPendingCommit!==null)Vl(e,0),ro(e,de,dn,!1);if(Zd(e,n),(ve&2)===0||e!==Te)e===Te&&((ve&2)===0&&(fs|=n),We===4&&ro(e,de,dn,!1)),_r(e)}function tC(e,t,n){if((ve&6)!==0)throw Error(R(327));var i=!n&&(t&127)===0&&(t&e.expiredLanes)===0||Yu(e,t),r=i?n4(e,t):ug(e,t,!0),o=i;do{if(r===0){Wl&&!i&&ro(e,t,0,!1);break}else{if(n=e.current.alternate,o&&!e4(n)){r=ug(e,t,!1),o=!1;continue}if(r===2){if(o=t,e.errorRecoveryDisabledLanes&o)var s=0;else s=e.pendingLanes&-536870913,s=s!==0?s:s&536870912?536870912:0;if(s!==0){t=s;e:{var l=e;r=Au;var a=l.current.memoizedState.isDehydrated;if(a&&(Vl(l,s).flags|=256),s=ug(l,s,!1),s!==2&&s!==6){if(gb&&!a){l.errorRecoveryDisabledLanes|=o,fs|=o,r=4;break e}o=Qt,Qt=r,o!==null&&(Qt===null?Qt=o:Qt.push.apply(Qt,o))}r=s}if(o=!1,r!==2)continue}}if(r===1){Vl(e,0),ro(e,t,0,!0);break}e:{switch(i=e,o=r,o){case 0:case 1:throw Error(R(345));case 4:if((t&4194048)!==t&&(t&62914560)!==t)break;case 6:ro(i,t,dn,!io);break e;case 2:Qt=null;break;case 3:case 5:break;default:throw Error(R(329))}if((t&62914560)===t&&(r=hh+300-hn(),10<r)){if(ro(i,t,dn,!io),Jd(i,0,!0)!==0)break e;Vi=t,i.timeoutHandle=yb(pS.bind(null,i,n,Qt,$d,uv,t,dn,fs,Il,io,o,"Throttled",-0,0),r);break e}pS(i,n,Qt,$d,uv,t,dn,fs,Il,io,o,null,-0,0)}}break}while(1);_r(e)}function pS(e,t,n,i,r,o,s,l,a,u,c,f,d,h){e.timeoutHandle=-1;var m=t.subtreeFlags,b=(o&335544064)===o;if(f=null,b||m&8192||(m&16785408)===16785408){if(f={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Bi},fn=null,G_(t,o,f),b&&(m=f,b=e.containerInfo,b=(b.nodeType===9?b:b.ownerDocument).__reactViewTransition,b!=null&&(m.count++,m.waitingForViewTransition=!0,m=Fu.bind(m),b.finished.then(m,m))),m=(o&62914560)===o?hh-hn():(o&4194048)===o?J_-hn():0,m=n3(f,m),m!==null){Vi=o,e.cancelPendingCommit=m(gS.bind(null,e,t,o,n,i,r,s,l,a,u,c,f,null,d,h)),ro(e,o,s,!u);return}}gS(e,t,o,n,i,r,s,l,a,u,c,f)}function e4(e){for(var t=e;;){var n=t.tag;if((n===0||n===11||n===15)&&t.flags&16384&&(n=t.updateQueue,n!==null&&(n=n.stores,n!==null)))for(var i=0;i<n.length;i++){var r=n[i],o=r.getSnapshot;r=r.value;try{if(!gn(o(),r))return!1}catch(s){return!1}}if(n=t.child,t.subtreeFlags&16384&&n!==null)n.return=t,t=n;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function ro(e,t,n,i){t=ek(e,t),t&=~Fd,t&=~fs,e.suspendedLanes|=t,e.pingedLanes&=~t,i&&(e.warmLanes|=t),i=e.expirationTimes;for(var r=t;0<r;){var o=31-mn(r),s=1<<o;i[o]=-1,r&=~s}n!==0&&nk(e,n,t)}function ph(){return(ve&6)===0?(nc(0,!1),!1):!0}function vb(){if(ue!==null){if(ke===0)var e=ue.return;else e=ue,hr=_s=null,eb(e),Rl=null,Pu=0,e=ue;for(;e!==null;)A_(e.alternate,e),e=e.return;ue=null}}function Vl(e,t){var n=e.timeoutHandle;return n!==-1&&(e.timeoutHandle=-1,S4(n)),n=e.cancelPendingCommit,n!==null&&(e.cancelPendingCommit=null,n()),Vi=0,vb(),Te=e,ue=n=pr(e.current,null),de=t,ke=0,an=null,io=!1,Wl=Yu(e,t),gb=!1,Il=dn=Fd=fs=yo=We=0,Qt=Au=null,uv=!1,wr=ek(e,t),rh(),n}function nC(e,t){re=null,ie.H=Id,t===Gl||t===lh?(t=U1(),ke=3):t===$v?(t=U1(),ke=4):ke=t===ab?8:t!==null&&typeof t==="object"&&typeof t.then==="function"?6:1,an=t,ue===null&&(We=1,Hd(e,zn(t,e.current)))}function iC(){var e=Nt.current;return e===null?!0:(de&4194048)===de?Bt===null?!0:!1:(de&62914560)===de||(de&536870912)!==0?e===Bt:!1}function rC(){var e=ie.H;return ie.H=Id,e===null?Id:e}function oC(){var e=ie.A;return ie.A=JB,e}function Xd(){We=4,io||(de&4194048)!==de&&Nt.current!==null||(Wl=!0),(yo&134217727)===0&&(fs&134217727)===0||Te===null||ro(Te,de,dn,!1)}function ug(e,t,n){var i=ve;ve|=2;var r=rC(),o=oC();if(Te!==e||de!==t)$d=null,Vl(e,t);t=!1;var s=We;e:do try{if(ke!==0&&ue!==null){var l=ue,a=an;switch(ke){case 8:vb(),s=6;break e;case 3:case 2:case 9:case 6:Nt.current===null&&(t=!0);var u=ke;if(ke=0,an=null,kl(e,l,a,u),n&&Wl){s=0;break e}break;default:u=ke,ke=0,an=null,kl(e,l,a,u)}}t4(),s=We;break}catch(c){nC(e,c)}while(1);return t&&e.shellSuspendCounter++,hr=_s=null,ve=i,ie.H=r,ie.A=o,ue===null&&(Te=null,de=0,rh()),s}function t4(){for(;ue!==null;)sC(ue)}function n4(e,t){var n=ve;ve|=2;var i=rC(),r=oC();Te!==e||de!==t?($d=null,qd=hn()+500,Vl(e,t)):Wl=Yu(e,t);e:do try{if(ke!==0&&ue!==null){t=ue;var o=an;t:switch(ke){case 1:ke=0,an=null,kl(e,t,o,1);break;case 2:case 9:if(V1(o)){ke=0,an=null,mS(t);break}t=function(){ke!==2&&ke!==9||Te!==e||(ke=7),_r(e)},o.then(t,t);break e;case 3:ke=7;break e;case 4:ke=5;break e;case 7:V1(o)?(ke=0,an=null,mS(t)):(ke=0,an=null,kl(e,t,o,7));break;case 5:var s=null;switch(ue.tag){case 26:s=ue.memoizedState;case 5:case 27:var l=ue;if(s?NC(s):l.stateNode.complete){ke=0,an=null;var a=l.sibling;if(a!==null)ue=a;else{var u=l.return;u!==null?(ue=u,mh(u)):ue=null}break t}}ke=0,an=null,kl(e,t,o,5);break;case 6:ke=0,an=null,kl(e,t,o,6);break;case 8:vb(),We=6;break e;default:throw Error(R(462))}}i4();break}catch(c){nC(e,c)}while(1);if(hr=_s=null,ie.H=i,ie.A=r,ve=n,ue!==null)return 0;return Te=null,de=0,rh(),We}function i4(){for(;ue!==null&&!vz();)sC(ue)}function sC(e){var t=R_(e.alternate,e,wr);e.memoizedProps=e.pendingProps,t===null?mh(e):ue=t}function mS(e){var t=e,n=t.alternate;switch(t.tag){case 15:case 0:t=iS(n,t,t.pendingProps,t.type,void 0,de);break;case 11:t=iS(n,t,t.pendingProps,t.type.render,t.ref,de);break;case 5:eb(t);var i=t;i===bt&&(le?(Md(i),i.tag===5&&i.stateNode!=null&&(Be=i.stateNode)):(Md(i),le=!0));default:A_(n,t),t=ue=Dk(t,wr),t=R_(n,t,wr)}e.memoizedProps=e.pendingProps,t===null?mh(e):ue=t}function kl(e,t,n,i){hr=_s=null,eb(t),Rl=null,Pu=0;var r=t.return;try{if(FB(e,r,t,n,de)){We=1,Hd(e,zn(n,e.current)),ue=null;return}}catch(o){if(r!==null)throw ue=r,o;We=1,Hd(e,zn(n,e.current)),ue=null;return}if(t.flags&32768){if(le||i===1)e=!0;else if(Wl||(de&536870912)!==0)e=!1;else if(io=e=!0,i===2||i===9||i===3||i===6)i=Nt.current,i!==null&&i.tag===13&&(i.flags|=16384);lC(t,e)}else mh(t)}function mh(e){var t=e;do{if((t.flags&32768)!==0){lC(t,io);return}e=t.return;var n=GB(t.alternate,t,wr);if(n!==null){ue=n;return}if(t=t.sibling,t!==null){ue=t;return}ue=t=e}while(t!==null);We===0&&(We=5)}function lC(e,t){do{var n=YB(e.alternate,e);if(n!==null){n.flags&=32767,ue=n;return}if(n=e.return,n!==null&&(n.flags|=32768,n.subtreeFlags=0,n.deletions=null),!t&&(e=e.sibling,e!==null)){ue=e;return}ue=e=n}while(e!==null);We=6,ue=null}function gS(e,t,n,i,r,o,s,l,a,u,c,f){e.cancelPendingCommit=null;do gh();while($e!==0);if((ve&6)!==0)throw Error(R(327));if(t!==null){if(t===e.current)throw Error(R(177));e===Te&&(ue=Te=null,de=0),ys=t,si=e,Vi=n,fv=r,Z_=i,r4(e,t,n,s,l,a,f)}}function r4(e,t,n,i,r,o,s){var l=t.lanes|t.childLanes;if(cv=l,l|=Vv,Oz(e,n,l,i,r,o),Nl=null,(n&335544064)===n?(Dl=AB(e),i=10262):(Dl=null,i=10256),(t.subtreeFlags&i)!==0||(t.flags&i)!==0?(e.callbackNode=null,e.callbackPriority=0,c4(Ed,function(){return mv(),null})):(e.callbackNode=null,e.callbackPriority=0),Kd=!1,i=(t.flags&13878)!==0,(t.subtreeFlags&13878)!==0||i){i=ie.T,ie.T=null,r=be.p,be.p=2,o=ve,ve|=4;try{WB(e,t,n)}finally{ve=o,be.p=r,ie.T=i}}$e=1,Kd?Ml=R4(s,e.containerInfo,Dl,dv,hv,s4,pv,mv,o4,null,null):(dv(),hv(),pv())}function o4(e){if($e!==0){var t=si.onRecoverableError;t(e,{componentStack:null})}}function s4(){$e===3&&($e=0,$_(ys,si),$e=4)}function dv(){if($e===1){$e=0;var e=si,t=ys,n=Vi,i=(t.flags&13878)!==0;if((t.subtreeFlags&13878)!==0||i){i=ie.T,ie.T=null;var r=be.p;be.p=2;var o=ve;ve|=4;try{mu=jd=!1,F_(t,e,n),n=wv;var s=Ck(e.containerInfo),l=n.focusedElem,a=n.selectionRange;if(s!==l&&l&&l.ownerDocument&&_k(l.ownerDocument.documentElement,l)){if(a!==null&&Hv(l)){var{start:u,end:c}=a;if(c===void 0&&(c=u),"selectionStart"in l)l.selectionStart=u,l.selectionEnd=Math.min(c,l.value.length);else{var f=l.ownerDocument||document,d=f&&f.defaultView||window;if(d.getSelection){var h=d.getSelection(),m=l.textContent.length,b=Math.min(a.start,m),x=a.end===void 0?b:Math.min(a.end,m);!h.extend&&b>x&&(s=x,x=b,b=s);var g=N1(l,b),v=N1(l,x);if(g&&v&&(h.rangeCount!==1||h.anchorNode!==g.node||h.anchorOffset!==g.offset||h.focusNode!==v.node||h.focusOffset!==v.offset)){var w=f.createRange();w.setStart(g.node,g.offset),h.removeAllRanges(),b>x?(h.addRange(w),h.extend(v.node,v.offset)):(w.setEnd(v.node,v.offset),h.addRange(w))}}}}f=[];for(h=l;h=h.parentNode;)h.nodeType===1&&f.push({element:h,left:h.scrollLeft,top:h.scrollTop});typeof l.focus==="function"&&l.focus();for(l=0;l<f.length;l++){var S=f[l];S.element.scrollLeft=S.left,S.element.scrollTop=S.top}}ql=!!xv,wv=xv=null}finally{ve=o,be.p=r,ie.T=i}}e.current=t,$e=2}}function hv(){if($e===2){$e=0;var e=si,t=ys,n=(t.flags&8772)!==0;if((t.subtreeFlags&8772)!==0||n){n=ie.T,ie.T=null;var i=be.p;be.p=2;var r=ve;ve|=4;try{I_(e,t.alternate,t)}finally{ve=r,be.p=i,ie.T=n}}$e=3}}function pv(){if($e===4||$e===3){$e=0;var e=Ml;Ml=null,bz();var t=si,n=ys,i=Vi,r=Z_,o=(i&335544064)===i?10262:10256;if((n.subtreeFlags&o)!==0||(n.flags&o)!==0?$e=5:($e=0,ys=si=null,aC(t,t.pendingLanes)),o=t.pendingLanes,o===0&&(co=null),Dv(i),n=n.stateNode,pn&&typeof pn.onCommitFiberRoot==="function")try{pn.onCommitFiberRoot(Gu,n,void 0,(n.current.flags&128)===128)}catch(u){}if(r!==null){n=ie.T,o=be.p,be.p=2,ie.T=null;try{for(var s=t.onRecoverableError,l=0;l<r.length;l++){var a=r[l];s(a.value,{componentStack:a.stack})}}finally{ie.T=n,be.p=o}}if(r=Nl,s=Dl,Dl=null,r!==null&&(Nl=null,s===null&&(s=[]),e!==null))for(a=0;a<r.length;a++)n=(0,r[a])(s),n!==void 0&&e.finished.finally(n);(Vi&3)!==0&&gh(),_r(t),o=t.pendingLanes,(i&261930)!==0&&(o&42)!==0?t===vd?Tu++:(Tu=0,vd=t):(Tu=0,vd=null),nc(0,!1)}}function aC(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,Zu(t)))}function gh(){return Ml!==null&&(Ml.skipTransition(),Ml=null),dv(),hv(),pv(),mv()}function mv(){if($e!==5)return!1;var e=si,t=cv;cv=0;var n=Dv(Vi),i=ie.T,r=be.p;try{be.p=32>n?32:n,ie.T=null,n=fv,fv=null;var o=si,s=Vi;if($e=0,ys=si=null,Vi=0,(ve&6)!==0)throw Error(R(331));var l=ve;if(ve|=4,W_(o.current),X_(o,o.current,s,n),ve=l,nc(0,!1),pn&&typeof pn.onPostCommitFiberRoot==="function")try{pn.onPostCommitFiberRoot(Gu,o)}catch(a){}return!0}finally{be.p=r,ie.T=i,aC(e,t)}}function vS(e,t,n){t=zn(n,t),t=Gg(e.stateNode,t,2),e=cs(e,t,2),e!==null&&(Zd(e,2),_r(e))}function Ce(e,t,n){if(e.tag===3)vS(e,e,n);else for(;t!==null;){if(t.tag===3){vS(t,e,n);break}else if(t.tag===1){var i=t.stateNode;if(typeof t.type.getDerivedStateFromError==="function"||typeof i.componentDidCatch==="function"&&(co===null||!co.has(i))){e=zn(n,e),n=k_(2),i=cs(t,n,2),i!==null&&(__(n,i,t,e),Zd(i,2),_r(i));break}}t=t.return}}function cg(e,t,n){var i=e.pingCache;if(i===null){i=e.pingCache=new ZB;var r=new Set;i.set(t,r)}else r=i.get(t),r===void 0&&(r=new Set,i.set(t,r));r.has(n)||(gb=!0,r.add(n),e=l4.bind(null,e,t,n),t.then(e,e))}function l4(e,t,n){var i=e.pingCache;i!==null&&i.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,Te===e&&(de&n)===n&&(We===4||We===3&&(de&62914560)===de&&300>hn()-hh?(ve&2)===0?Vl(e,0):Fd|=n:Fd|=n,Il===de&&(Il=0)),_r(e)}function uC(e,t){t===0&&(t=tk()),e=ks(e,t),e!==null&&(Zd(e,t),_r(e))}function a4(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),uC(e,n)}function u4(e,t){var n=0;switch(e.tag){case 31:case 13:var{stateNode:i,memoizedState:r}=e;r!==null&&(n=r.retryLane);break;case 19:i=e.stateNode;break;case 22:i=e.stateNode._retryCache;break;default:throw Error(R(314))}i!==null&&i.delete(t),uC(e,n)}function c4(e,t){return Nv(e,t)}var Ul=null,cl=null,gv=!1,Gd=!1,fg=!1,oo=0;function _r(e){e!==cl&&e.next===null&&(cl===null?Ul=cl=e:cl=cl.next=e),Gd=!0,gv||(gv=!0,d4())}function nc(e,t){if(!fg&&Gd){fg=!0;do{var n=!1;for(var i=Ul;i!==null;){if(!t)if(e!==0){var r=i.pendingLanes;if(r===0)var o=0;else{var s=i.suspendedLanes,l=i.pingedLanes;o=(1<<31-mn(42|e)+1)-1,o&=r&~(s&~l),o=o&201326741?o&201326741|1:o?o|2:0}o!==0&&(n=!0,bS(i,o))}else o=de,o=Jd(i,i===Te?o:0,i.cancelPendingCommit!==null||i.timeoutHandle!==-1),(o&3)===0||Yu(i,o)||(n=!0,bS(i,o));i=i.next}}while(n);fg=!1}}function f4(){cC()}function cC(){Gd=gv=!1;var e=0;oo!==0&&w4()&&(e=oo);for(var t=hn(),n=null,i=Ul;i!==null;){var r=i.next,o=fC(i,t);if(o===0)i.next=null,n===null?Ul=r:n.next=r,r===null&&(cl=n);else if(n=i,e!==0||(o&3)!==0)Gd=!0;i=r}$e!==0&&$e!==5||nc(e,!1),oo!==0&&(oo=0)}function fC(e,t){for(var{suspendedLanes:n,pingedLanes:i,expirationTimes:r}=e,o=e.pendingLanes&-62914561;0<o;){var s=31-mn(o),l=1<<s,a=r[s];if(a===-1){if((l&n)===0||(l&i)!==0)r[s]=Ez(l,t)}else a<=t&&(e.expiredLanes|=l);o&=~l}if(t=Te,n=de,n=Jd(e,e===t?n:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),i=e.callbackNode,n===0||e===t&&(ke===2||ke===9)||e.cancelPendingCommit!==null)return i!==null&&i!==null&&Fm(i),e.callbackNode=null,e.callbackPriority=0;if((n&3)===0||Yu(e,n)){if(t=n&-n,t===e.callbackPriority)return t;switch(i!==null&&Fm(i),Dv(n)){case 2:case 8:n=JS;break;case 32:n=Ed;break;case 268435456:n=ZS;break;default:n=Ed}return i=dC.bind(null,e),n=Nv(n,i),e.callbackPriority=t,e.callbackNode=n,t}return i!==null&&i!==null&&Fm(i),e.callbackPriority=2,e.callbackNode=null,2}function dC(e,t){if($e!==0&&$e!==5)return e.callbackNode=null,e.callbackPriority=0,null;var n=e.callbackNode;if(gh()&&e.callbackNode!==n)return null;var i=de;if(i=Jd(e,e===Te?i:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),i===0)return null;return tC(e,i,t),fC(e,hn()),e.callbackNode!=null&&e.callbackNode===n?dC.bind(null,e):null}function bS(e,t){if(gh())return null;tC(e,t,!0)}function d4(){k4(function(){(ve&6)!==0?Nv(QS,f4):cC()})}function bb(){if(oo===0){var e=ms;e===0&&(e=Uf,Uf<<=1,(Uf&261888)===0&&(Uf=256)),oo=e}return oo}function yS(e){return e==null||typeof e==="symbol"||typeof e==="boolean"?null:typeof e==="function"?e:rd(e)}function h4(e,t,n,i,r){if(t==="submit"&&n&&n.stateNode===r){var o=yS((r[nn]||null).action),s=i.submitter;s&&(t=(t=s[nn]||null)?yS(t.formAction):s.getAttribute("formAction"),t!==null&&(o=t,s=null));var l=new th("action","action",null,i,r);e.push({event:l,listeners:[{instance:null,listener:function(){if(i.defaultPrevented){if(oo!==0){var a=new FormData(r,s);$g(n,{pending:!0,data:a,method:r.method,action:o},null,a)}}else typeof o==="function"&&(l.preventDefault(),a=new FormData(r,s),$g(n,{pending:!0,data:a,method:r.method,action:o},o,a))},currentTarget:r}]})}}for(gu=0;gu<zg.length;gu++)vu=zg[gu],vv=vu.toLowerCase(),bv=vu[0].toUpperCase()+vu.slice(1),li(vv,"on"+bv);var vu,vv,bv,gu;li(Ok,"onAnimationEnd");li(Rk,"onAnimationIteration");li(Ak,"onAnimationStart");li("dblclick","onDoubleClick");li("focusin","onFocus");li("focusout","onBlur");li(wB,"onTransitionRun");li(SB,"onTransitionStart");li(kB,"onTransitionCancel");li(Tk,"onTransitionEnd");zl("onMouseEnter",["mouseout","mouseover"]);zl("onMouseLeave",["mouseout","mouseover"]);zl("onPointerEnter",["pointerout","pointerover"]);zl("onPointerLeave",["pointerout","pointerover"]);ws("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));ws("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));ws("onBeforeInput",["compositionend","keypress","textInput","paste"]);ws("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));ws("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));ws("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Vu="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),p4=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Vu));function hC(e,t){t=(t&4)!==0;for(var n=0;n<e.length;n++){var i=e[n],r=i.event;i=i.listeners;e:{var o=void 0;if(t)for(var s=i.length-1;0<=s;s--){var l=i[s],a=l.instance,u=l.currentTarget;if(l=l.listener,a!==o&&r.isPropagationStopped())break e;o=l,r.currentTarget=u;try{o(r)}catch(c){Rd(c)}r.currentTarget=null,o=a}else for(s=0;s<i.length;s++){if(l=i[s],a=l.instance,u=l.currentTarget,l=l.listener,a!==o&&r.isPropagationStopped())break e;o=l,r.currentTarget=u;try{o(r)}catch(c){Rd(c)}r.currentTarget=null,o=a}}}}function ae(e,t){var n=t[m1];n===void 0&&(n=t[m1]=new Set);var i=e+"__bubble";n.has(i)||(mC(t,e,2,!1),n.add(i))}function dg(e,t,n){var i=0;t&&(i|=4),mC(n,e,i,t)}var ed="_reactListening"+Math.random().toString(36).slice(2);function pC(e){if(!e[ed]){e[ed]=!0,ak.forEach(function(n){n!=="selectionchange"&&(p4.has(n)||dg(n,!1,e),dg(n,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[ed]||(t[ed]=!0,dg("selectionchange",!1,t))}}function mC(e,t,n,i){switch(PC(t)){case 2:var r=a3;break;case 8:r=u3;break;default:r=Cb}n=r.bind(null,t,n,e),r=void 0,!Mg||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(r=!0),i?r!==void 0?e.addEventListener(t,n,{capture:!0,passive:r}):e.addEventListener(t,n,!0):r!==void 0?e.addEventListener(t,n,{passive:r}):e.addEventListener(t,n,!1)}function hg(e,t,n,i,r){var o=i;if((t&1)===0&&(t&2)===0&&i!==null)e:for(;;){if(i===null)return;var s=i.tag;if(s===3||s===4){var l=i.stateNode.containerInfo;if(l===r)break;if(s===4)for(s=i.return;s!==null;){var a=s.tag;if((a===3||a===4)&&s.stateNode.containerInfo===r)return;s=s.return}for(;l!==null;){if(s=is(l),s===null)return;if(a=s.tag,a===5||a===6||a===26||a===27){i=o=s;continue e}l=l.parentNode}}i=i.return}gk(function(){var u=o,c=zv(n),f=[];e:{var d=Mk.get(e);if(d!==void 0){var h=th,m=e;switch(e){case"keypress":if(sd(n)===0)break e;case"keydown":case"keyup":h=Qz;break;case"focusin":m="focus",h=Wm;break;case"focusout":m="blur",h=Wm;break;case"beforeblur":case"afterblur":h=Wm;break;case"click":if(n.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":h=k1;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":h=Hz;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":h=nB;break;case Ok:case Rk:case Ak:h=Kz;break;case Tk:h=rB;break;case"scroll":case"scrollend":h=Pz;break;case"wheel":h=sB;break;case"copy":case"cut":case"paste":h=Fz;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":h=C1;break;case"submit":h=eB;break;case"toggle":case"beforetoggle":h=aB}var b=(t&4)!==0,x=!b&&(e==="scroll"||e==="scrollend"),g=b?d!==null?d+"Capture":null:d;b=[];for(var v=u,w;v!==null;){var S=v;if(w=S.stateNode,S=S.tag,S!==5&&S!==26&&S!==27||w===null||g===null||(S=Nu(v,g),S!=null&&b.push(Uu(v,S,w))),x)break;v=v.return}0<b.length&&(d=new h(d,m,null,n,c),f.push({event:d,listeners:b}))}}if((t&7)===0){e:{if(h=e==="mouseover"||e==="pointerover",d=e==="mouseout"||e==="pointerout",h&&n!==Tg&&(m=n.relatedTarget||n.fromElement)&&(is(m)||m[Wu]))break e;if(d||h){if(m=c.window===c?c:(h=c.ownerDocument)?h.defaultView||h.parentWindow:window,d){if(h=n.relatedTarget||n.toElement,d=u,h=h?is(h):null,h!==null&&(x=Xu(h),b=h.tag,h!==x||b!==5&&b!==27&&b!==6))h=null}else d=null,h=u;if(d!==h){if(b=k1,S="onMouseLeave",g="onMouseEnter",v="mouse",e==="pointerout"||e==="pointerover")b=C1,S="onPointerLeave",g="onPointerEnter",v="pointer";x=d==null?m:fu(d),w=h==null?m:fu(h),m=new b(S,v+"leave",d,n,c),m.target=x,m.relatedTarget=w,S=null,is(c)===u&&(b=new b(g,v+"enter",h,n,c),b.target=w,b.relatedTarget=x,S=b),x=S,b=d&&h?bg(d,h,m4):null,d!==null&&xS(f,m,d,b,!1),h!==null&&x!==null&&xS(f,x,h,b,!0)}}}e:{if(d=u?fu(u):window,h=d.nodeName&&d.nodeName.toLowerCase(),h==="select"||h==="input"&&d.type==="file")var k=A1;else if(R1(d))if(Sk)k=bB;else{k=gB;var E=mB}else h=d.nodeName,!h||h.toLowerCase()!=="input"||d.type!=="checkbox"&&d.type!=="radio"?u&&Lv(u.elementType)&&(k=A1):k=vB;if(k&&(k=k(e,u))){wk(f,k,n,c);break e}E&&E(e,d,u)}switch(E=u?fu(u):window,e){case"focusin":if(R1(E)||E.contentEditable==="true")vl=E,Dg=u,xu=null;break;case"focusout":xu=Dg=vl=null;break;case"mousedown":Lg=!0;break;case"contextmenu":case"mouseup":case"dragend":Lg=!1,D1(f,n,c);break;case"selectionchange":if(xB)break;case"keydown":case"keyup":D1(f,n,c)}var _;if(Iv)e:{switch(e){case"compositionstart":var O="onCompositionStart";break e;case"compositionend":O="onCompositionEnd";break e;case"compositionupdate":O="onCompositionUpdate";break e}O=void 0}else gl?yk(e,n)&&(O="onCompositionEnd"):e==="keydown"&&n.keyCode===229&&(O="onCompositionStart");if(O&&(bk&&n.locale!=="ko"&&(gl||O!=="onCompositionStart"?O==="onCompositionEnd"&&gl&&(_=vk()):(to=c,Bv=("value"in to)?to.value:to.textContent,gl=!0)),E=Yd(u,O),0<E.length&&(O=new _1(O,e,null,n,c),f.push({event:O,listeners:E}),_?O.data=_:(_=xk(n),_!==null&&(O.data=_)))),_=cB?fB(e,n):dB(e,n))O=Yd(u,"onBeforeInput"),0<O.length&&(E=new _1("onBeforeInput","beforeinput",null,n,c),f.push({event:E,listeners:O}),E.data=_);h4(f,e,u,n,c)}hC(f,t)})}function Uu(e,t,n){return{instance:e,listener:t,currentTarget:n}}function Yd(e,t){for(var n=t+"Capture",i=[];e!==null;){var r=e,o=r.stateNode;if(r=r.tag,r!==5&&r!==26&&r!==27||o===null||(r=Nu(e,n),r!=null&&i.unshift(Uu(e,r,o)),r=Nu(e,t),r!=null&&i.push(Uu(e,r,o))),e.tag===3)return i;e=e.return}return[]}function m4(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e?e:null}function xS(e,t,n,i,r){for(var o=t._reactName,s=[];n!==null&&n!==i;){var l=n,a=l.alternate,u=l.stateNode;if(l=l.tag,a!==null&&a===i)break;l!==5&&l!==26&&l!==27||u===null||(a=u,r?(u=Nu(n,o),u!=null&&s.unshift(Uu(n,u,a))):r||(u=Nu(n,o),u!=null&&s.push(Uu(n,u,a)))),n=n.return}s.length!==0&&e.push({event:t,listeners:s})}var g4=/\r\n?/g,v4=/\u0000|\uFFFD/g;function wS(e){return(typeof e==="string"?e:""+e).replace(g4,`
9
+ `).replace(v4,"")}function gC(e,t){return t=wS(t),wS(e)===t?!0:!1}function _e(e,t,n,i,r,o){switch(n){case"children":if(typeof i==="string")t==="body"||t==="textarea"&&i===""||Bl(e,i);else if(typeof i==="number"||typeof i==="bigint")t!=="body"&&Bl(e,""+i);else return;break;case"className":Ff(e,"class",i);break;case"tabIndex":Ff(e,"tabindex",i);break;case"dir":case"role":case"viewBox":case"width":case"height":Ff(e,n,i);break;case"style":mk(e,i,o);return;case"data":if(t!=="object"){Ff(e,"data",i);break}case"src":case"href":if(i===""&&(t!=="a"||n!=="href")){e.removeAttribute(n);break}if(i==null||typeof i==="function"||typeof i==="symbol"||typeof i==="boolean"){e.removeAttribute(n);break}i=rd(i),e.setAttribute(n,i);break;case"action":case"formAction":if(typeof i==="function"){e.setAttribute(n,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof o==="function"&&(n==="formAction"?(t!=="input"&&_e(e,t,"name",r.name,r,null),_e(e,t,"formEncType",r.formEncType,r,null),_e(e,t,"formMethod",r.formMethod,r,null),_e(e,t,"formTarget",r.formTarget,r,null)):(_e(e,t,"encType",r.encType,r,null),_e(e,t,"method",r.method,r,null),_e(e,t,"target",r.target,r,null)));if(i==null||typeof i==="symbol"||typeof i==="boolean"){e.removeAttribute(n);break}i=rd(i),e.setAttribute(n,i);break;case"onClick":i!=null&&(e.onclick=Bi);return;case"onScroll":i!=null&&ae("scroll",e);return;case"onScrollEnd":i!=null&&ae("scrollend",e);return;case"dangerouslySetInnerHTML":if(i!=null){if(typeof i!=="object"||!("__html"in i))throw Error(R(61));if(n=i.__html,n!=null){if(r.children!=null)throw Error(R(60));(o!=null?o.__html:void 0)!==n&&(e.innerHTML=n)}}break;case"multiple":e.multiple=i&&typeof i!=="function"&&typeof i!=="symbol";break;case"muted":e.muted=i&&typeof i!=="function"&&typeof i!=="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(i==null||typeof i==="function"||typeof i==="boolean"||typeof i==="symbol"){e.removeAttribute("xlink:href");break}n=rd(i),e.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",n);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":i!=null&&typeof i!=="function"&&typeof i!=="symbol"?e.setAttribute(n,i):e.removeAttribute(n);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"credentialless":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":i&&typeof i!=="function"&&typeof i!=="symbol"?e.setAttribute(n,""):e.removeAttribute(n);break;case"capture":case"download":i===!0?e.setAttribute(n,""):i!==!1&&i!=null&&typeof i!=="function"&&typeof i!=="symbol"?e.setAttribute(n,i):e.removeAttribute(n);break;case"cols":case"rows":case"size":case"span":i!=null&&typeof i!=="function"&&typeof i!=="symbol"&&!isNaN(i)&&1<=i?e.setAttribute(n,i):e.removeAttribute(n);break;case"rowSpan":case"start":i==null||typeof i==="function"||typeof i==="symbol"||isNaN(i)?e.removeAttribute(n):e.setAttribute(n,i);break;case"popover":ae("beforetoggle",e),ae("toggle",e),id(e,"popover",i);break;case"xlinkActuate":cr(e,"http://www.w3.org/1999/xlink","xlink:actuate",i);break;case"xlinkArcrole":cr(e,"http://www.w3.org/1999/xlink","xlink:arcrole",i);break;case"xlinkRole":cr(e,"http://www.w3.org/1999/xlink","xlink:role",i);break;case"xlinkShow":cr(e,"http://www.w3.org/1999/xlink","xlink:show",i);break;case"xlinkTitle":cr(e,"http://www.w3.org/1999/xlink","xlink:title",i);break;case"xlinkType":cr(e,"http://www.w3.org/1999/xlink","xlink:type",i);break;case"xmlBase":cr(e,"http://www.w3.org/XML/1998/namespace","xml:base",i);break;case"xmlLang":cr(e,"http://www.w3.org/XML/1998/namespace","xml:lang",i);break;case"xmlSpace":cr(e,"http://www.w3.org/XML/1998/namespace","xml:space",i);break;case"is":id(e,"is",i);break;case"innerText":case"textContent":return;default:if(!(2<n.length)||n[0]!=="o"&&n[0]!=="O"||n[1]!=="n"&&n[1]!=="N")n=zz.get(n)||n,id(e,n,i);else return}me=!0}function yv(e,t,n,i,r,o){switch(n){case"style":mk(e,i,o);return;case"dangerouslySetInnerHTML":if(i!=null){if(typeof i!=="object"||!("__html"in i))throw Error(R(61));if(n=i.__html,n!=null){if(r.children!=null)throw Error(R(60));(o!=null?o.__html:void 0)!==n&&(e.innerHTML=n)}}break;case"children":if(typeof i==="string")Bl(e,i);else if(typeof i==="number"||typeof i==="bigint")Bl(e,""+i);else return;break;case"onScroll":i!=null&&ae("scroll",e);return;case"onScrollEnd":i!=null&&ae("scrollend",e);return;case"onClick":i!=null&&(e.onclick=Bi);return;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":return;case"innerText":case"textContent":return;default:if(!uk.hasOwnProperty(n))e:{if(n[0]==="o"&&n[1]==="n"&&(r=n.endsWith("Capture"),o=n.slice(2,r?n.length-7:void 0),t=e[nn]||null,t=t!=null?t[n]:null,typeof t==="function"&&e.removeEventListener(o,t,r),typeof i==="function")){typeof t!=="function"&&t!==null&&(n in e?e[n]=null:e.hasAttribute(n)&&e.removeAttribute(n)),e.addEventListener(o,i,r);break e}me=!0,n in e?e[n]=i:i===!0?e.setAttribute(n,""):id(e,n,i)}return}me=!0}function Mt(e,t,n){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":ae("error",e),ae("load",e);var i=!1,r=!1,o;for(o in n)if(n.hasOwnProperty(o)){var s=n[o];if(s!=null)switch(o){case"src":i=!0;break;case"srcSet":r=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(R(137,t));default:_e(e,t,o,s,n,null)}}r&&_e(e,t,"srcSet",n.srcSet,n,null),i&&_e(e,t,"src",n.src,n,null);return;case"input":ae("invalid",e);var l=o=s=r=null,a=null,u=null;for(i in n)if(n.hasOwnProperty(i)){var c=n[i];if(c!=null)switch(i){case"name":r=c;break;case"type":s=c;break;case"checked":a=c;break;case"defaultChecked":u=c;break;case"value":o=c;break;case"defaultValue":l=c;break;case"children":case"dangerouslySetInnerHTML":if(c!=null)throw Error(R(137,t));break;default:_e(e,t,i,c,n,null)}}dk(e,o,l,a,u,s,r,!1);return;case"select":ae("invalid",e),i=s=o=null;for(r in n)if(n.hasOwnProperty(r)&&(l=n[r],l!=null))switch(r){case"value":o=l;break;case"defaultValue":s=l;break;case"multiple":i=l;default:_e(e,t,r,l,n,null)}t=o,n=s,e.multiple=!!i,t!=null?Cl(e,!!i,t,!1):n!=null&&Cl(e,!!i,n,!0);return;case"textarea":ae("invalid",e),o=r=i=null;for(s in n)if(n.hasOwnProperty(s)&&(l=n[s],l!=null))switch(s){case"value":i=l;break;case"defaultValue":r=l;break;case"children":o=l;break;case"dangerouslySetInnerHTML":if(l!=null)throw Error(R(91));break;default:_e(e,t,s,l,n,null)}pk(e,i,r,o);return;case"option":for(a in n)if(n.hasOwnProperty(a)&&(i=n[a],i!=null))switch(a){case"selected":e.selected=i&&typeof i!=="function"&&typeof i!=="symbol";break;default:_e(e,t,a,i,n,null)}return;case"dialog":ae("beforetoggle",e),ae("toggle",e),ae("cancel",e),ae("close",e);break;case"iframe":case"object":ae("load",e);break;case"video":case"audio":for(i=0;i<Vu.length;i++)ae(Vu[i],e);break;case"image":ae("error",e),ae("load",e);break;case"details":ae("toggle",e);break;case"embed":case"source":case"link":ae("error",e),ae("load",e);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(u in n)if(n.hasOwnProperty(u)&&(i=n[u],i!=null))switch(u){case"children":case"dangerouslySetInnerHTML":throw Error(R(137,t));default:_e(e,t,u,i,n,null)}return;default:if(Lv(t)){for(c in n)n.hasOwnProperty(c)&&(i=n[c],i!==void 0&&yv(e,t,c,i,n,void 0));return}}for(l in n)n.hasOwnProperty(l)&&(i=n[l],i!=null&&_e(e,t,l,i,n,null))}var b4={};function y4(e,t,n,i){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var r=null,o=null,s=null,l=null,a=null,u=null,c=null;for(h in n){var f=n[h];if(n.hasOwnProperty(h)&&f!=null)switch(h){case"checked":break;case"value":break;case"defaultValue":a=f;default:i.hasOwnProperty(h)||_e(e,t,h,null,i,f)}}for(var d in i){var h=i[d];if(f=n[d],i.hasOwnProperty(d)&&(h!=null||f!=null))switch(d){case"type":h!==f&&(me=!0),o=h;break;case"name":h!==f&&(me=!0),r=h;break;case"checked":h!==f&&(me=!0),u=h;break;case"defaultChecked":h!==f&&(me=!0),c=h;break;case"value":h!==f&&(me=!0),s=h;break;case"defaultValue":h!==f&&(me=!0),l=h;break;case"children":case"dangerouslySetInnerHTML":if(h!=null)throw Error(R(137,t));break;default:h!==f&&_e(e,t,d,h,i,f)}}Ag(e,s,l,a,u,c,o,r);return;case"select":h=s=l=d=null;for(o in n)if(a=n[o],n.hasOwnProperty(o)&&a!=null)switch(o){case"value":break;case"multiple":h=a;default:i.hasOwnProperty(o)||_e(e,t,o,null,i,a)}for(r in i)if(o=i[r],a=n[r],i.hasOwnProperty(r)&&(o!=null||a!=null))switch(r){case"value":o!==a&&(me=!0),d=o;break;case"defaultValue":o!==a&&(me=!0),l=o;break;case"multiple":o!==a&&(me=!0),s=o;default:o!==a&&_e(e,t,r,o,i,a)}t=l,n=s,i=h,d!=null?Cl(e,!!n,d,!1):!!i!==!!n&&(t!=null?Cl(e,!!n,t,!0):Cl(e,!!n,n?[]:"",!1));return;case"textarea":h=d=null;for(l in n)if(r=n[l],n.hasOwnProperty(l)&&r!=null&&!i.hasOwnProperty(l))switch(l){case"value":break;case"children":break;default:_e(e,t,l,null,i,r)}for(s in i)if(r=i[s],o=n[s],i.hasOwnProperty(s)&&(r!=null||o!=null))switch(s){case"value":r!==o&&(me=!0),d=r;break;case"defaultValue":r!==o&&(me=!0),h=r;break;case"children":break;case"dangerouslySetInnerHTML":if(r!=null)throw Error(R(91));break;default:r!==o&&_e(e,t,s,r,i,o)}hk(e,d,h);return;case"option":for(var m in n)if(d=n[m],n.hasOwnProperty(m)&&d!=null&&!i.hasOwnProperty(m))switch(m){case"selected":e.selected=!1;break;default:_e(e,t,m,null,i,d)}for(a in i)if(d=i[a],h=n[a],i.hasOwnProperty(a)&&d!==h&&(d!=null||h!=null))switch(a){case"selected":d!==h&&(me=!0),e.selected=d&&typeof d!=="function"&&typeof d!=="symbol";break;default:_e(e,t,a,d,i,h)}return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var b in n)d=n[b],n.hasOwnProperty(b)&&d!=null&&!i.hasOwnProperty(b)&&_e(e,t,b,null,i,d);for(u in i)if(d=i[u],h=n[u],i.hasOwnProperty(u)&&d!==h&&(d!=null||h!=null))switch(u){case"children":case"dangerouslySetInnerHTML":if(d!=null)throw Error(R(137,t));break;default:_e(e,t,u,d,i,h)}return;default:if(Lv(t)){for(var x in n)d=n[x],n.hasOwnProperty(x)&&d!==void 0&&!i.hasOwnProperty(x)&&yv(e,t,x,void 0,i,d);for(c in i)d=i[c],h=n[c],!i.hasOwnProperty(c)||d===h||d===void 0&&h===void 0||yv(e,t,c,d,i,h);return}}for(var g in n)d=n[g],n.hasOwnProperty(g)&&d!=null&&!i.hasOwnProperty(g)&&_e(e,t,g,null,i,d);for(f in i)d=i[f],h=n[f],!i.hasOwnProperty(f)||d===h||d==null&&h==null||_e(e,t,f,d,i,h)}function SS(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function x4(){if(typeof performance.getEntriesByType==="function"){for(var e=0,t=0,n=performance.getEntriesByType("resource"),i=0;i<n.length;i++){var r=n[i],{transferSize:o,initiatorType:s,duration:l}=r;if(o&&l&&SS(s)){s=0,l=r.responseEnd;for(i+=1;i<n.length;i++){var a=n[i],u=a.startTime;if(u>l)break;var c=a.transferSize,f=a.initiatorType;c&&SS(f)&&(a=a.responseEnd,s+=c*(a<l?1:(l-u)/(a-u)))}if(--i,t+=8*(o+s)/(r.duration/1000),e++,10<e)break}}if(0<e)return t/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e==="number")?e:5}var xv=null,wv=null;function Ku(e){return e.nodeType===9?e:e.ownerDocument}function kS(e){switch(e){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function vC(e,t){if(e===0)switch(t){case"svg":return 1;case"math":return 2;default:return 0}return e===1&&t==="foreignObject"?0:e}function bC(e,t,n,i){return n=Ku(n).createElement(e),n[Ot]=i,n[nn]=t,Mt(n,e,t),vt(n),n}function Sv(e,t){return e==="textarea"||e==="noscript"||typeof t.children==="string"||typeof t.children==="number"||typeof t.children==="bigint"||typeof t.dangerouslySetInnerHTML==="object"&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var pg=null;function w4(){var e=window.event;if(e&&e.type==="popstate"){if(e===pg)return!1;return pg=e,!0}return pg=null,!1}var yb=typeof setTimeout==="function"?setTimeout:void 0,S4=typeof clearTimeout==="function"?clearTimeout:void 0,_S=typeof Promise==="function"?Promise:void 0,CS=typeof requestAnimationFrame==="function"?requestAnimationFrame:yb,k4=typeof queueMicrotask==="function"?queueMicrotask:typeof _S<"u"?function(e){return _S.resolve(null).then(e).catch(_4)}:yb;function _4(e){setTimeout(function(){throw e})}function wo(e){return e==="head"}function ES(e,t){var n=t,i=0;do{var r=n.nextSibling;if(e.removeChild(n),r&&r.nodeType===8)if(n=r.data,n==="/$"||n==="/&"){if(i===0){e.removeChild(r),$l(t);return}i--}else if(n==="$"||n==="$?"||n==="$~"||n==="$!"||n==="&")i++;else if(n==="html")gg(e.ownerDocument.documentElement);else if(n==="head"){n=e.ownerDocument.head,gg(n);for(var o=n.firstChild;o;){var s=o.nextSibling,l=o.nodeName;o[Qu]||l==="SCRIPT"||l==="STYLE"||l==="LINK"&&o.rel.toLowerCase()==="stylesheet"||n.removeChild(o),o=s}}else n==="body"&&gg(e.ownerDocument.body);n=r}while(n);$l(t)}function OS(e,t){var n=e;e=0;do{var i=n.nextSibling;if(n.nodeType===1?t?(n._stashedDisplay=n.style.display,n.style.display="none"):(n.style.display=n._stashedDisplay||"",n.getAttribute("style")===""&&n.removeAttribute("style")):n.nodeType===3&&(t?(n._stashedText=n.nodeValue,n.nodeValue=""):n.nodeValue=n._stashedText||""),i&&i.nodeType===8)if(n=i.data,n==="/$")if(e===0)break;else e--;else n!=="$"&&n!=="$?"&&n!=="$~"&&n!=="$!"||e++;n=i}while(n)}function yC(e,t,n){if(t=CSS.escape(t)!==t?"r-"+btoa(t).replace(/=/g,""):t,e.style.viewTransitionName=t,n!=null&&(e.style.viewTransitionClass=n),n=getComputedStyle(e),n.display==="inline"){if(t=e.getClientRects(),t.length===1)var i=1;else for(var r=i=0;r<t.length;r++){var o=t[r];0<o.width&&0<o.height&&i++}i===1&&(e=e.style,e.display=t.length===1?"inline-block":"block",e.marginTop="-"+n.paddingTop,e.marginBottom="-"+n.paddingBottom)}}function xC(e,t){e=e.style,t=t.style;var n=t!=null?t.hasOwnProperty("viewTransitionName")?t.viewTransitionName:t.hasOwnProperty("view-transition-name")?t["view-transition-name"]:null:null;e.viewTransitionName=n==null||typeof n==="boolean"?"":(""+n).trim(),n=t!=null?t.hasOwnProperty("viewTransitionClass")?t.viewTransitionClass:t.hasOwnProperty("view-transition-class")?t["view-transition-class"]:null:null,e.viewTransitionClass=n==null||typeof n==="boolean"?"":(""+n).trim(),e.display==="inline-block"&&(t==null?e.display=e.margin="":(n=t.display,e.display=n==null||typeof n==="boolean"?"":n,n=t.margin,n!=null?e.margin=n:(n=t.hasOwnProperty("marginTop")?t.marginTop:t["margin-top"],e.marginTop=n==null||typeof n==="boolean"?"":n,t=t.hasOwnProperty("marginBottom")?t.marginBottom:t["margin-bottom"],e.marginBottom=t==null||typeof t==="boolean"?"":t)))}function wC(e,t,n){return n=n.ownerDocument.defaultView,{rect:e,abs:t.position==="absolute"||t.position==="fixed",clip:t.clipPath!=="none"||t.overflow!=="visible"||t.filter!=="none"||t.mask!=="none"||t.mask!=="none"||t.borderRadius!=="0px",view:0<=e.bottom&&0<=e.right&&e.top<=n.innerHeight&&e.left<=n.innerWidth}}function kv(e){var t=e.getBoundingClientRect(),n=getComputedStyle(e);return wC(t,n,e)}function C4(e){var t=e.getBoundingClientRect();t=new DOMRect(t.x+20000,t.y+20000,t.width,t.height);var n=getComputedStyle(e);return wC(t,n,e)}function E4(e){return e.documentElement.clientHeight}function O4(e){this.addEventListener("load",e),this.addEventListener("error",e)}function R4(e,t,n,i,r,o,s,l,a){var u=t.nodeType===9?t:t.ownerDocument;try{var c=u.startViewTransition({update:function(){var d=u.defaultView,h=d.navigation&&d.navigation.transition,m=u.fonts.status;i();var b=[];if(m==="loaded"&&(E4(u),u.fonts.status==="loading"&&b.push(u.fonts.ready)),m=b.length,e!==null)for(var x=e.suspenseyImages,g=0,v=0;v<x.length;v++){var w=x[v];if(!w.complete){var S=w.getBoundingClientRect();if(0<S.bottom&&0<S.right&&S.top<d.innerHeight&&S.left<d.innerWidth){if(g+=DC(w),g>xd){b.length=m;break}w=new Promise(O4.bind(w)),b.push(w)}}}if(0<b.length)return d=Promise.race([Promise.all(b),new Promise(function(k){return setTimeout(k,500)})]).then(r,r),(h?Promise.allSettled([h.finished,d]):d).then(o,o);if(r(),h)return h.finished.then(o,o);o()},types:n});u.__reactViewTransition=c;var f=[];return c.ready.then(function(){for(var d=u.documentElement.getAnimations({subtree:!0}),h=0;h<d.length;h++){var m=d[h],b=m.effect,x=b.pseudoElement;if(x!=null&&x.startsWith("::view-transition")){f.push(m),m=b.getKeyframes();for(var g=x=void 0,v=!0,w=0;w<m.length;w++){var S=m[w],k=S.width;if(x===void 0)x=k;else if(x!==k){v=!1;break}if(k=S.height,g===void 0)g=k;else if(g!==k){v=!1;break}delete S.width,delete S.height,S.transform==="none"&&delete S.transform}v&&x!==void 0&&g!==void 0&&(b.setKeyframes(m),v=getComputedStyle(b.target,b.pseudoElement),v.width!==x||v.height!==g)&&(v=m[0],v.width=x,v.height=g,v=m[m.length-1],v.width=x,v.height=g,b.setKeyframes(m))}}s()},function(d){u.__reactViewTransition===c&&(u.__reactViewTransition=null);try{if(typeof d==="object"&&d!==null)switch(d.name){case"InvalidStateError":if(d.message==="View transition was skipped because document visibility state is hidden."||d.message==="Skipping view transition because document visibility state has become hidden."||d.message==="Skipping view transition because viewport size changed."||d.message==="Transition was aborted because of invalid state")d=null}d!==null&&a(d)}finally{i(),r(),s()}}),c.finished.finally(function(){for(var d=0;d<f.length;d++)f[d].cancel();u.__reactViewTransition===c&&(u.__reactViewTransition=null),l()}),c}catch(d){return i(),r(),s(),null}}function rs(e,t){this._scope=document.documentElement,this._selector="::view-transition-"+e+"("+t+")"}rs.prototype.animate=function(e,t){return t=typeof t==="number"?{duration:t}:Me({},t),t.pseudoElement=this._selector,this._scope.animate(e,t)};rs.prototype.getAnimations=function(){for(var e=this._scope,t=this._selector,n=e.getAnimations({subtree:!0}),i=[],r=0;r<n.length;r++){var o=n[r].effect;o!==null&&o.target===e&&o.pseudoElement===t&&i.push(n[r])}return i};rs.prototype.getComputedStyle=function(){return getComputedStyle(this._scope,this._selector)};function SC(e){return{name:e,group:new rs("group",e),imagePair:new rs("image-pair",e),old:new rs("old",e),new:new rs("new",e)}}function vn(e){this._fragmentFiber=e,this._observers=this._eventListeners=null}vn.prototype.addEventListener=function(e,t,n){var i=null,r=null;if(n!=null&&typeof n!=="boolean"&&(i=n.signal||null,i!==null&&i.aborted))return;this._eventListeners===null&&(this._eventListeners=[]);var o=this._eventListeners;if(kC(o,e,t,n)===-1){var s=this,l=t;n!=null&&typeof n!=="boolean"&&n.once===!0&&(l=function(a){s.removeEventListener(e,t,n),typeof t==="function"?t.call(this,a):t.handleEvent(a)}),i!==null&&(r=s.removeEventListener.bind(s,e,t,n),i.addEventListener("abort",r,{once:!0}),r=i.removeEventListener.bind(i,"abort",r)),i=Kl(n),o.push({type:e,listener:t,optionsOrUseCapture:n,attachedListener:l,cleanup:r}),tn(this._fragmentFiber.child,!1,A4,e,l,i)}this._eventListeners=o};function A4(e,t,n,i){return dt(e).addEventListener(t,n,i),!1}vn.prototype.removeEventListener=function(e,t,n){var i=this._eventListeners;if(i!==null&&(t=kC(i,e,t,n),t!==-1)){var r=i[t];n=r.attachedListener;var o=r.cleanup;r=Kl(r.optionsOrUseCapture),tn(this._fragmentFiber.child,!1,T4,e,n,r),i.splice(t,1),o!==null&&o()}};function T4(e,t,n,i){return dt(e).removeEventListener(t,n,i),!1}function Kl(e){return e!=null&&typeof e!=="boolean"&&(e.once===!0||e.signal instanceof AbortSignal)?{capture:e.capture,passive:e.passive}:e}function RS(e){return e==null?"c=0":typeof e==="boolean"?"c="+(e?"1":"0"):"c="+(e.capture?"1":"0")}function kC(e,t,n,i){if(e.length===0)return-1;i=RS(i);for(var r=0;r<e.length;r++){var o=e[r];if(o.type===t&&o.listener===n&&RS(o.optionsOrUseCapture)===i)return r}return-1}vn.prototype.dispatchEvent=function(e){var t=xs(this._fragmentFiber);if(t===null)return!0;t=dt(t);var n=this._eventListeners;if(n!==null&&0<n.length||!e.bubbles){var i=t.nodeType===9?t.createComment(""):document.createTextNode("");if(n)for(var r=0;r<n.length;r++){var o=n[r];i.addEventListener(o.type,o.attachedListener,Kl(o.optionsOrUseCapture))}if(t.appendChild(i),e=i.dispatchEvent(e),n)for(r=0;r<n.length;r++)o=n[r],i.removeEventListener(o.type,o.attachedListener,Kl(o.optionsOrUseCapture));return t.removeChild(i),e}return t.dispatchEvent(e)};vn.prototype.focus=function(e){tn(this._fragmentFiber.child,!0,_C,e,void 0,void 0)};function _C(e,t){if(e.tag===6)return!1;return e=dt(e),K4(e,t)}vn.prototype.focusLast=function(e){var t=[];tn(this._fragmentFiber.child,!0,xb,t,void 0,void 0);for(var n=t.length-1;0<=n&&!_C(t[n],e);n--);};function xb(e,t){return t.push(e),!1}vn.prototype.blur=function(){var e=xs(this._fragmentFiber);e!==null&&(e=dt(e),e=Ku(e).activeElement,e!==null&&tn(this._fragmentFiber.child,!1,M4,e,void 0,void 0))};function M4(e,t){if(e.tag===6)return!1;return e=dt(e),e===t||e.contains(t)?(t.blur(),!0):!1}vn.prototype.observeUsing=function(e){this._observers===null&&(this._observers=new Set),this._observers.add(e),tn(this._fragmentFiber.child,!1,N4,e,void 0,void 0)};function N4(e,t){if(e.tag===6)return!1;return e=dt(e),t.observe(e),!1}vn.prototype.unobserveUsing=function(e){var t=this._observers;if(t!==null&&t.has(e)){t.delete(e),tn(this._fragmentFiber.child,!1,D4,e,void 0,void 0);for(var n=t=0;n<oi.length;n++){var i=oi[n];i.fragmentInstance===this&&i.observer===e?e.unobserve(i.instance):oi[t++]=i}oi.length=t}};function D4(e,t){if(e.tag===6)return!1;return e=dt(e),t.unobserve(e),!1}var oi=[],mg=!1;function L4(e,t,n){oi.push({fragmentInstance:e,observer:t,instance:n}),mg||(mg=!0,j4(function(){mg=!1;var i=oi;oi=[];for(var r=0;r<i.length;r++){var o=i[r];o.observer.unobserve(o.instance)}}))}vn.prototype.getClientRects=function(){var e=[];return tn(this._fragmentFiber.child,!1,z4,e,void 0,void 0),e};function z4(e,t){if(e.tag===6){e=e.stateNode;var n=e.ownerDocument.createRange();n.selectNodeContents(e),t.push.apply(t,n.getClientRects())}else e=dt(e),t.push.apply(t,e.getClientRects());return!1}vn.prototype.getRootNode=function(e){var t=xs(this._fragmentFiber);return t===null?this:dt(t).getRootNode(e)};vn.prototype.compareDocumentPosition=function(e){var t=xs(this._fragmentFiber);if(t===null)return Node.DOCUMENT_POSITION_DISCONNECTED;var n=[];tn(this._fragmentFiber.child,!1,xb,n,void 0,void 0);var i=dt(t);if(n.length===0){if(n=i,u1(this._fragmentFiber)){e:{for(t=this._fragmentFiber.return;t!==null;){if(t.tag===4){t=t.stateNode.containerInfo;break e}if(t.tag===3||t.tag===5||t.tag===27)break;t=t.return}t=null}t!=null&&(n=t)}t=this._fragmentFiber;var r=i=n.compareDocumentPosition(e);return n===e?r=Node.DOCUMENT_POSITION_CONTAINS:i&Node.DOCUMENT_POSITION_CONTAINED_BY&&(n=XS(t)[1],n===null?r=Node.DOCUMENT_POSITION_PRECEDING:(e=dt(n).compareDocumentPosition(e),r=e===0||e&Node.DOCUMENT_POSITION_FOLLOWING?Node.DOCUMENT_POSITION_FOLLOWING:Node.DOCUMENT_POSITION_PRECEDING)),r|=Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC}t=dt(n[0]),r=dt(n[n.length-1]);var o=u1(this._fragmentFiber)?t.parentElement:i;if(o==null)return Node.DOCUMENT_POSITION_DISCONNECTED;i=o.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_CONTAINED_BY,o=o.compareDocumentPosition(r)&Node.DOCUMENT_POSITION_CONTAINED_BY;var s=t.compareDocumentPosition(e),l=r.compareDocumentPosition(e),a=s&Node.DOCUMENT_POSITION_CONTAINED_BY||l&Node.DOCUMENT_POSITION_CONTAINED_BY;return l=i&&o&&s&Node.DOCUMENT_POSITION_FOLLOWING&&l&Node.DOCUMENT_POSITION_PRECEDING,t=i&&t===e||o&&r===e||a||l?Node.DOCUMENT_POSITION_CONTAINED_BY:!i&&t===e||!o&&r===e?Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC:s,t&Node.DOCUMENT_POSITION_DISCONNECTED||t&Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC||B4(t,this._fragmentFiber,n[0],n[n.length-1],e)?t:Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC};function B4(e,t,n,i,r){var o=is(r);if(e&Node.DOCUMENT_POSITION_CONTAINED_BY){if(n=!!o)e:{for(;o!==null;){if(o.tag===7&&(o===t||o.alternate===t)){n=!0;break e}o=o.return}n=!1}return n}if(e&Node.DOCUMENT_POSITION_CONTAINS){if(o===null)return o=r.ownerDocument,r===o||r===o.documentElement||r===o.body;e:{o=t;for(t=xs(t);o!==null;){if(!(o.tag!==5&&o.tag!==3&&o.tag!==27||o!==t&&o.alternate!==t)){o=!0;break e}o=o.return}o=!1}return o}return e&Node.DOCUMENT_POSITION_PRECEDING?((t=!!o)&&!(t=o===n)&&(t=bg(n,o,c1),t===null?t=!1:(tn(t,!0,uz,o,n),o=dl,dl=null,t=o!==null)),t):e&Node.DOCUMENT_POSITION_FOLLOWING?((t=!!o)&&!(t=o===i)&&(t=bg(i,o,c1),t===null?t=!1:(tn(t,!0,cz,o,i),o=dl,vg=dl=null,t=o!==null)),t):!1}function AS(e,t){var n=e.ownerDocument.createRange();n.selectNodeContents(e),e=n.getBoundingClientRect(),window.scrollTo(window.scrollX+e.left,t?window.scrollY+e.top:window.scrollY+e.bottom-window.innerHeight)}vn.prototype.scrollIntoView=function(e){if(typeof e==="object")throw Error(R(566));var t=[];tn(this._fragmentFiber.child,!1,xb,t,void 0,void 0);var n=e!==!1;if(t.length===0){var i=XS(this._fragmentFiber);if(i=n?i[1]||i[0]||xs(this._fragmentFiber):i[0]||i[1],i===null)return;if(i.tag===6){e=dt(i),AS(e,n);return}if(i=dt(i),i.nodeType!==9){if(i.nodeType===11){n="host"in i?i.host:null,n!==null&&n.scrollIntoView(e);return}i.scrollIntoView(e)}}for(i=n?t.length-1:0;i!==(n?-1:t.length);){var r=t[i];r.tag===6?(r=dt(r),AS(r,n)):dt(r).scrollIntoView(e),i+=n?-1:1}};function P4(e,t){return e=dt(e),CC(e,t),!1}function CC(e,t){e.reactFragments==null&&(e.reactFragments=new Set),e.reactFragments.add(t)}function EC(e,t){var n=t._eventListeners;if(n!==null)for(var i=0;i<n.length;i++){var r=n[i];e.addEventListener(r.type,r.attachedListener,Kl(r.optionsOrUseCapture))}e.nodeType!==3&&(n=t._observers,n!==null&&n.forEach(function(o){for(var s=0,l=0;l<oi.length;l++){var a=oi[l];if(a.fragmentInstance!==t||a.observer!==o||a.instance!==e)oi[s++]=a}oi.length=s,o.observe(e)}),CC(e,t))}function I4(e,t){var n=t._eventListeners;if(n!==null)for(var i=0;i<n.length;i++){var r=n[i];e.removeEventListener(r.type,r.attachedListener,Kl(r.optionsOrUseCapture))}e.nodeType!==3&&(n=t._observers,n!==null&&n.forEach(function(o){typeof o.rootMargin==="string"?L4(t,o,e):o.unobserve(e)}),e.reactFragments!=null&&e.reactFragments.delete(t))}function _v(e){var t=e.firstChild;t&&t.nodeType===10&&(t=t.nextSibling);for(;t;){var n=t;switch(t=t.nextSibling,n.nodeName){case"HTML":case"HEAD":case"BODY":_v(n),eh(n);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(n.rel.toLowerCase()==="stylesheet")continue}e.removeChild(n)}}function H4(e,t,n,i){for(;e.nodeType===1;){var r=n;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!i&&(e.nodeName!=="INPUT"||e.type!=="hidden"))break}else if(!i)if(t==="input"&&e.type==="hidden"){var o=r.name==null?null:""+r.name;if(r.type==="hidden"&&e.getAttribute("name")===o)return e}else return e;else if(!e[Qu])switch(t){case"meta":if(!e.hasAttribute("itemprop"))break;return e;case"link":if(o=e.getAttribute("rel"),o==="stylesheet"&&e.hasAttribute("data-precedence"))break;else if(o!==r.rel||e.getAttribute("href")!==(r.href==null||r.href===""?null:r.href)||e.getAttribute("crossorigin")!==(r.crossOrigin==null?null:r.crossOrigin)||e.getAttribute("title")!==(r.title==null?null:r.title))break;return e;case"style":if(e.hasAttribute("data-precedence"))break;return e;case"script":if(o=e.getAttribute("src"),(o!==(r.src==null?null:r.src)||e.getAttribute("type")!==(r.type==null?null:r.type)||e.getAttribute("crossorigin")!==(r.crossOrigin==null?null:r.crossOrigin))&&o&&e.hasAttribute("async")&&!e.hasAttribute("itemprop"))break;return e;default:return e}if(e=In(e.nextSibling),e===null)break}return null}function V4(e,t,n){if(t==="")return null;for(;e.nodeType!==3;){if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!n)return null;if(e=In(e.nextSibling),e===null)return null}return e}function OC(e,t){for(;e.nodeType!==8;){if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!t)return null;if(e=In(e.nextSibling),e===null)return null}return e}function Cv(e){return e.data==="$?"||e.data==="$~"}function wb(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function U4(e,t){var n=e.ownerDocument;if(e.data==="$~")e._reactRetry=t;else if(e.data!=="$?"||n.readyState!=="loading")t();else{var i=function(){t(),n.removeEventListener("DOMContentLoaded",i)};n.addEventListener("DOMContentLoaded",i),e._reactRetry=i}}function In(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t==="$"||t==="$!"||t==="$?"||t==="$~"||t==="&"||t==="F!"||t==="F")break;if(t==="/$"||t==="/&")return null}}return e}var Ev=null;function TS(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="/$"||n==="/&"){if(t===0)return In(e.nextSibling);t--}else n!=="$"&&n!=="$!"&&n!=="$?"&&n!=="$~"&&n!=="&"||t++}e=e.nextSibling}return null}function MS(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="$"||n==="$!"||n==="$?"||n==="$~"||n==="&"){if(t===0)return e;t--}else n!=="/$"&&n!=="/&"||t++}e=e.previousSibling}return null}function K4(e,t){function n(){i=!0}if(e.ownerDocument.activeElement===e)return!0;var i=!1;try{e.ownerDocument.addEventListener("focus",n,!0),(e.focus||HTMLElement.prototype.focus).call(e,t)}finally{e.ownerDocument.removeEventListener("focus",n,!0)}return i}function j4(e){CS(function(){CS(function(t){return e(t)})})}function RC(e,t,n){switch(t=Ku(n),e){case"html":if(e=t.documentElement,!e)throw Error(R(452));return e;case"head":if(e=t.head,!e)throw Error(R(453));return e;case"body":if(e=t.body,!e)throw Error(R(454));return e;default:throw Error(R(451))}}function AC(e,t,n){for(var i in n){var r=n[i];n.hasOwnProperty(i)&&r!=null&&_e(e,t,i,null,b4,r)}n.dangerouslySetInnerHTML!=null&&(e.textContent=""),e.onclick===Bi&&(e.onclick=null),eh(e)}function gg(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);eh(e)}var Hn=new Map,NS=new Set;function ju(e){if(typeof e.getRootNode==="function"){var t=e.getRootNode();if(t.nodeType===9||t.nodeType===11)return t}return e.nodeType===9?e:e.ownerDocument}var Cr=be.d;be.d={f:F4,r:q4,D:$4,C:X4,L:G4,m:Y4,X:Q4,S:W4,M:J4};function F4(){var e=Cr.f(),t=ph();return e||t}function q4(e){var t=Xl(e);t!==null&&t.tag===5&&t.type==="form"?m_(t):Cr.r(e)}var Ql=typeof document>"u"?null:document;function TC(e,t,n){var i=Ql;if(i&&typeof t==="string"&&t){var r=Ln(t);r='link[rel="'+e+'"][href="'+r+'"]',typeof n==="string"&&(r+='[crossorigin="'+n+'"]'),NS.has(r)||(NS.add(r),e={rel:e,crossOrigin:n,href:t},i.querySelector(r)===null&&(t=i.createElement("link"),Mt(t,"link",e),vt(t),i.head.appendChild(t)))}}function $4(e){Cr.D(e),TC("dns-prefetch",e,null)}function X4(e,t){Cr.C(e,t),TC("preconnect",e,t)}function G4(e,t,n){Cr.L(e,t,n);var i=Ql;if(i&&e&&t){var r='link[rel="preload"][as="'+Ln(t)+'"]';t==="image"?n&&n.imageSrcSet?(r+='[imagesrcset="'+Ln(n.imageSrcSet)+'"]',typeof n.imageSizes==="string"&&(r+='[imagesizes="'+Ln(n.imageSizes)+'"]')):r+='[href="'+Ln(e)+'"]':r+='[href="'+Ln(e)+'"]';var o=r;switch(t){case"style":o=jl(e);break;case"script":o=Jl(e)}if(!(Hn.has(o)||(e=Me({rel:"preload",href:t==="image"&&n&&n.imageSrcSet?void 0:e,as:t},n),Hn.set(o,e),i.querySelector(r)!==null||t==="style"&&i.querySelector(ic(o))||t==="script"&&i.querySelector(rc(o))))){var s=i.createElement("link");Mt(s,"link",e),t==="style"&&(s[Od]=!0,s.onload=s.onerror=function(){lk(s)}),vt(s),i.head.appendChild(s)}}}function Y4(e,t){Cr.m(e,t);var n=Ql;if(n&&e){var i=t&&typeof t.as==="string"?t.as:"script",r='link[rel="modulepreload"][as="'+Ln(i)+'"][href="'+Ln(e)+'"]',o=r;switch(i){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":o=Jl(e)}if(!Hn.has(o)&&(e=Me({rel:"modulepreload",href:e},t),Hn.set(o,e),n.querySelector(r)===null)){switch(i){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(n.querySelector(rc(o)))return}i=n.createElement("link"),Mt(i,"link",e),vt(i),n.head.appendChild(i)}}}function W4(e,t,n){Cr.S(e,t,n);var i=Ql;if(i&&e){var r=_l(i).hoistableStyles,o=jl(e);t=t||"default";var s=r.get(o);if(!s){var l={loading:0,preload:null};if(s=i.querySelector(ic(o)))l.loading=5;else{e=Me({rel:"stylesheet",href:e,"data-precedence":t},n),(n=Hn.get(o))&&Sb(e,n);var a=s=i.createElement("link");vt(a),Mt(a,"link",e),a._p=new Promise(function(u,c){a.onload=u,a.onerror=c}),a.addEventListener("load",function(){l.loading|=1}),a.addEventListener("error",function(){l.loading|=2}),l.loading|=4,bd(s,t,i)}s={type:"stylesheet",instance:s,count:1,state:l},r.set(o,s)}}}function Q4(e,t){Cr.X(e,t);var n=Ql;if(n&&e){var i=_l(n).hoistableScripts,r=Jl(e),o=i.get(r);o||(o=n.querySelector(rc(r)),o||(e=Me({src:e,async:!0},t),(t=Hn.get(r))&&kb(e,t),o=n.createElement("script"),vt(o),Mt(o,"link",e),n.head.appendChild(o)),o={type:"script",instance:o,count:1,state:null},i.set(r,o))}}function J4(e,t){Cr.M(e,t);var n=Ql;if(n&&e){var i=_l(n).hoistableScripts,r=Jl(e),o=i.get(r);o||(o=n.querySelector(rc(r)),o||(e=Me({src:e,async:!0,type:"module"},t),(t=Hn.get(r))&&kb(e,t),o=n.createElement("script"),vt(o),Mt(o,"link",e),n.head.appendChild(o)),o={type:"script",instance:o,count:1,state:null},i.set(r,o))}}function DS(e,t,n,i){var r=(r=so.current)?ju(r):null;if(!r)throw Error(R(446));switch(e){case"meta":case"title":return null;case"style":return typeof n.precedence==="string"&&typeof n.href==="string"?(n=jl(n.href),t=_l(r).hoistableStyles,i=t.get(n),i||(i={type:"style",instance:null,count:0,state:null},t.set(n,i)),i):{type:"void",instance:null,count:0,state:null};case"link":if(n.rel==="stylesheet"&&typeof n.href==="string"&&typeof n.precedence==="string"){e=jl(n.href);var o=_l(r).hoistableStyles,s=o.get(e);if(s||(r=r.ownerDocument||r,s={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},o.set(e,s),(o=r.querySelector(ic(e)))?o._p||(s.instance=o,s.state.loading=5):(o=Hn.get(e),o||(o={rel:"preload",as:"style",href:n.href,crossOrigin:n.crossOrigin,integrity:n.integrity,media:n.media,hrefLang:n.hrefLang,referrerPolicy:n.referrerPolicy},Hn.set(e,o)),Z4(r,e,o,s.state))),t&&i===null)throw Error(R(528,""));return s}if(t&&i!==null)throw Error(R(529,""));return null;case"script":return t=n.async,n=n.src,typeof n==="string"&&t&&typeof t!=="function"&&typeof t!=="symbol"?(n=Jl(n),t=_l(r).hoistableScripts,i=t.get(n),i||(i={type:"script",instance:null,count:0,state:null},t.set(n,i)),i):{type:"void",instance:null,count:0,state:null};default:throw Error(R(444,e))}}function jl(e){return'href="'+Ln(e)+'"'}function ic(e){return'link[rel="stylesheet"]['+e+"]"}function MC(e){return Me({},e,{"data-precedence":e.precedence,precedence:null})}function Z4(e,t,n,i){if(t=e.querySelector('link[rel="preload"][as="style"]['+t+"]")){if(t[Od]!==!0){i.loading=1;return}}else t=e.createElement("link"),t[Od]=!0,t.onload=t.onerror=lk.bind(null,t),Mt(t,"link",n),vt(t),e.head.appendChild(t);i.preload=t,t.addEventListener("load",function(){return i.loading|=1}),t.addEventListener("error",function(){return i.loading|=2})}function Jl(e){return'[src="'+Ln(e)+'"]'}function rc(e){return"script[async]"+e}function LS(e,t,n){if(t.count++,t.instance===null)switch(t.type){case"style":var i=e.querySelector('style[data-href~="'+Ln(n.href)+'"]');if(i)return t.instance=i,vt(i),i;var r=Me({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return i=(e.ownerDocument||e).createElement("style"),vt(i),Mt(i,"style",r),bd(i,n.precedence,e),t.instance=i;case"stylesheet":r=jl(n.href);var o=e.querySelector(ic(r));if(o)return t.state.loading|=4,t.instance=o,vt(o),o;i=MC(n),(r=Hn.get(r))&&Sb(i,r),o=(e.ownerDocument||e).createElement("link"),vt(o);var s=o;return s._p=new Promise(function(l,a){s.onload=l,s.onerror=a}),Mt(o,"link",i),t.state.loading|=4,bd(o,n.precedence,e),t.instance=o;case"script":if(o=Jl(n.src),r=e.querySelector(rc(o)))return t.instance=r,vt(r),r;if(i=n,r=Hn.get(o))i=Me({},n),kb(i,r);return e=e.ownerDocument||e,r=e.createElement("script"),vt(r),Mt(r,"link",i),e.head.appendChild(r),t.instance=r;case"void":return null;default:throw Error(R(443,t.type))}else t.type==="stylesheet"&&(t.state.loading&4)===0&&(i=t.instance,t.state.loading|=4,bd(i,n.precedence,e));return t.instance}function bd(e,t,n){for(var i=n.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),r=i.length?i[i.length-1]:null,o=r,s=0;s<i.length;s++){var l=i[s];if(l.dataset.precedence===t)o=l;else if(o!==r)break}o?o.parentNode.insertBefore(e,o.nextSibling):(t=n.nodeType===9?n.head:n,t.insertBefore(e,t.firstChild))}function Sb(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.title==null&&(e.title=t.title)}function kb(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.integrity==null&&(e.integrity=t.integrity)}var yd=null;function zS(e,t,n){if(yd===null){var i=new Map,r=yd=new Map;r.set(n,i)}else r=yd,i=r.get(n),i||(i=new Map,r.set(n,i));if(i.has(e))return i;i.set(e,null),n=n.getElementsByTagName(e);for(r=0;r<n.length;r++){var o=n[r];if(!(o[Qu]||o[Ot]||e==="link"&&o.getAttribute("rel")==="stylesheet")&&o.namespaceURI!=="http://www.w3.org/2000/svg"){var s=o.getAttribute(t)||"";s=e+s;var l=i.get(s);l?l.push(o):i.set(s,[o])}}return i}function Ov(e,t,n){e=e.ownerDocument||e,e.head.insertBefore(n,t==="title"?e.querySelector("head > title"):null)}function e3(e,t,n){if(n===1||t.itemProp!=null)return!1;switch(e){case"meta":case"title":return!0;case"style":if(typeof t.precedence!=="string"||typeof t.href!=="string"||t.href==="")break;return!0;case"link":if(typeof t.rel!=="string"||typeof t.href!=="string"||t.href===""||t.onLoad||t.onError)break;switch(t.rel){case"stylesheet":return e=t.disabled,typeof t.precedence==="string"&&e==null;default:return!0}case"script":if(t.async&&typeof t.async!=="function"&&typeof t.async!=="symbol"&&!t.onLoad&&!t.onError&&t.src&&typeof t.src==="string")return!0}return!1}function BS(e,t){return e==="img"&&t.src!=null&&t.src!==""&&t.onLoad==null&&t.loading!=="lazy"}function NC(e){return e.type==="stylesheet"&&(e.state.loading&3)===0?!1:!0}function DC(e){return(e.width||100)*(e.height||100)*(typeof devicePixelRatio==="number"?devicePixelRatio:1)*0.25}function PS(e,t){typeof t.decode==="function"&&(e.imgCount++,t.complete||(e.imgBytes+=DC(t),e.suspenseyImages.push(t)),e=i3.bind(e),t.decode().then(e,e))}function t3(e,t,n,i){if(n.type==="stylesheet"&&(typeof i.media!=="string"||matchMedia(i.media).matches!==!1)&&(n.state.loading&4)===0){if(n.instance===null){var r=jl(i.href),o=t.querySelector(ic(r));if(o){t=o._p,t!==null&&typeof t==="object"&&typeof t.then==="function"&&(e.count++,e=Fu.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=o,vt(o);return}o=t.ownerDocument||t,i=MC(i),(r=Hn.get(r))&&Sb(i,r),o=o.createElement("link"),vt(o);var s=o;s._p=new Promise(function(l,a){s.onload=l,s.onerror=a}),Mt(o,"link",i),n.instance=o}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(n,t),(t=n.state.preload)&&(n.state.loading&3)===0&&(e.count++,n=Fu.bind(e),t.addEventListener("load",n),t.addEventListener("error",n))}}var xd=0;function n3(e,t){return e.stylesheets&&e.count===0&&wd(e,e.stylesheets),0<e.count||0<e.imgCount?function(n){var i=setTimeout(function(){if(e.stylesheets&&wd(e,e.stylesheets),e.unsuspend){var o=e.unsuspend;e.unsuspend=null,o()}},60000+t);0<e.imgBytes&&xd===0&&(xd=62500*x4());var r=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&wd(e,e.stylesheets),e.unsuspend)){var o=e.unsuspend;e.unsuspend=null,o()}},(e.imgBytes>xd?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(i),clearTimeout(r)}}:null}function LC(e){if(e.count===0&&(e.imgCount===0||!e.waitingForImages)){if(e.stylesheets)wd(e,e.stylesheets);else if(e.unsuspend){var t=e.unsuspend;e.unsuspend=null,t()}}}function Fu(){this.count--,LC(this)}function i3(){this.imgCount--,LC(this)}var Wd=null;function wd(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,Wd=new Map,t.forEach(r3,e),Wd=null,Fu.call(e))}function r3(e,t){if(!(t.state.loading&4)){var n=Wd.get(e);if(n)var i=n.get(null);else{n=new Map,Wd.set(e,n);for(var r=e.querySelectorAll("link[data-precedence],style[data-precedence]"),o=0;o<r.length;o++){var s=r[o];if(s.nodeName==="LINK"||s.getAttribute("media")!=="not all")n.set(s.dataset.precedence,s),i=s}i&&n.set(null,i)}r=t.instance,s=r.getAttribute("data-precedence"),o=n.get(s)||i,o===i&&n.set(null,r),n.set(s,r),this.count++,i=Fu.bind(this),r.addEventListener("load",i),r.addEventListener("error",i),o?o.parentNode.insertBefore(r,o.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(r,e.firstChild)),t.state.loading|=4}}var Fl={$$typeof:zi,Provider:null,Consumer:null,_currentValue:os,_currentValue2:os,_threadCount:0};function o3(e,t,n,i,r,o,s,l,a){this.tag=1,this.containerInfo=e,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=qm(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=qm(0),this.hiddenUpdates=qm(null),this.identifierPrefix=i,this.onUncaughtError=r,this.onCaughtError=o,this.onRecoverableError=s,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=a,this.transitionTypes=null,this.incompleteTransitions=new Map}function s3(e,t,n,i,r,o,s,l,a,u,c,f){return e=new o3(e,t,n,s,a,u,c,f,l),t=1,o===!0&&(t|=24),o=Zt(3,null,null,t),e.current=o,o.stateNode=e,t=Fv(),t.refCount++,e.pooledCache=t,t.refCount++,o.memoizedState={element:i,isDehydrated:n,cache:t},Xv(o),e}function l3(e){if(!e)return xl;return e=xl,e}function zC(e,t,n,i,r,o){r=l3(r),i.context===null?i.context=r:i.pendingContext=r,i=us(t),i.payload={element:n},o=o===void 0?null:o,o!==null&&(i.callback=o),n=cs(e,i,t),n!==null&&(en(n,e,t),Su(n,e,t))}function IS(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function _b(e,t){IS(e,t),(e=e.alternate)&&IS(e,t)}function BC(e){if(e.tag===13||e.tag===31){var t=ks(e,67108864);t!==null&&en(t,e,67108864),_b(e,67108864)}}function HS(e){if(e.tag===13||e.tag===31){var t=Pn();t=ok(t);var n=ks(e,t);n!==null&&en(n,e,t),_b(e,t)}}var ql=!0;function a3(e,t,n,i){var r=ie.T;ie.T=null;var o=be.p;try{be.p=2,Cb(e,t,n,i)}finally{be.p=o,ie.T=r}}function u3(e,t,n,i){var r=ie.T;ie.T=null;var o=be.p;try{be.p=8,Cb(e,t,n,i)}finally{be.p=o,ie.T=r}}function Cb(e,t,n,i){if(ql){var r=Rv(i);if(r===null)hg(e,t,i,Qd,n),VS(e,i);else if(f3(r,e,t,n,i))i.stopPropagation();else if(VS(e,i),t&4&&-1<c3.indexOf(e)){for(;r!==null;){var o=Xl(r);if(o!==null)switch(o.tag){case 3:if(o=o.stateNode,o.current.memoizedState.isDehydrated){var s=Zo(o.pendingLanes);if(s!==0){var l=o;l.pendingLanes|=2;for(l.entangledLanes|=2;s;){var a=1<<31-mn(s);l.entanglements[1]|=a,s&=~a}_r(o),(ve&6)===0&&(qd=hn()+500,nc(0,!1))}}break;case 31:case 13:l=ks(o,2),l!==null&&en(l,o,2),ph(),_b(o,2)}if(o=Rv(i),o===null&&hg(e,t,i,Qd,n),o===r)break;r=o}r!==null&&i.stopPropagation()}else hg(e,t,i,null,n)}}function Rv(e){return e=zv(e),Eb(e)}var Qd=null;function Eb(e){if(Qd=null,e=is(e),e!==null){var t=Xu(e);if(t===null)e=null;else{var n=t.tag;if(n===13){if(e=FS(t),e!==null)return e;e=null}else if(n===31){if(e=qS(t),e!==null)return e;e=null}else if(n===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null)}}return Qd=e,null}function PC(e){switch(e){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"fullscreenerror":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"resize":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(yz()){case QS:return 2;case JS:return 8;case Ed:case xz:return 32;case ZS:return 268435456;default:return 32}default:return 32}}var Av=!1,fo=null,ho=null,po=null,qu=new Map,$u=new Map,Zr=[],c3="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset".split(" ");function VS(e,t){switch(e){case"focusin":case"focusout":fo=null;break;case"dragenter":case"dragleave":ho=null;break;case"mouseover":case"mouseout":po=null;break;case"pointerover":case"pointerout":qu.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":$u.delete(t.pointerId)}}function au(e,t,n,i,r,o){if(e===null||e.nativeEvent!==o)return e={blockedOn:t,domEventName:n,eventSystemFlags:i,nativeEvent:o,targetContainers:[r]},t!==null&&(t=Xl(t),t!==null&&BC(t)),e;return e.eventSystemFlags|=i,t=e.targetContainers,r!==null&&t.indexOf(r)===-1&&t.push(r),e}function f3(e,t,n,i,r){switch(t){case"focusin":return fo=au(fo,e,t,n,i,r),!0;case"dragenter":return ho=au(ho,e,t,n,i,r),!0;case"mouseover":return po=au(po,e,t,n,i,r),!0;case"pointerover":var o=r.pointerId;return qu.set(o,au(qu.get(o)||null,e,t,n,i,r)),!0;case"gotpointercapture":return o=r.pointerId,$u.set(o,au($u.get(o)||null,e,t,n,i,r)),!0}return!1}function IC(e){var t=is(e.target);if(t!==null){var n=Xu(t);if(n!==null){if(t=n.tag,t===13){if(t=FS(n),t!==null){e.blockedOn=t,p1(e.priority,function(){HS(n)});return}}else if(t===31){if(t=qS(n),t!==null){e.blockedOn=t,p1(e.priority,function(){HS(n)});return}}else if(t===3&&n.stateNode.current.memoizedState.isDehydrated){e.blockedOn=n.tag===3?n.stateNode.containerInfo:null;return}}}e.blockedOn=null}function Sd(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=Rv(e.nativeEvent);if(n===null){n=e.nativeEvent;var i=new n.constructor(n.type,n);Tg=i,n.target.dispatchEvent(i),Tg=null}else return t=Xl(n),t!==null&&BC(t),e.blockedOn=n,!1;t.shift()}return!0}function US(e,t,n){Sd(e)&&n.delete(t)}function d3(){Av=!1,fo!==null&&Sd(fo)&&(fo=null),ho!==null&&Sd(ho)&&(ho=null),po!==null&&Sd(po)&&(po=null),qu.forEach(US),$u.forEach(US)}function td(e,t){e.blockedOn===t&&(e.blockedOn=null,Av||(Av=!0,Wo(Yo,d3)))}var nd=null;function KS(e){nd!==e&&(nd=e,Wo(Yo,function(){nd===e&&(nd=null);for(var t=0;t<e.length;t+=3){var n=e[t],i=e[t+1],r=e[t+2];if(typeof i!=="function")if(Eb(i||n)===null)continue;else break;var o=Xl(n);o!==null&&(e.splice(t,3),t-=3,$g(o,{pending:!0,data:r,method:n.method,action:i},i,r))}}))}function $l(e){function t(a){return td(a,e)}fo!==null&&td(fo,e),ho!==null&&td(ho,e),po!==null&&td(po,e),qu.forEach(t),$u.forEach(t);for(var n=0;n<Zr.length;n++){var i=Zr[n];i.blockedOn===e&&(i.blockedOn=null)}for(;0<Zr.length&&(n=Zr[0],n.blockedOn===null);)IC(n),n.blockedOn===null&&Zr.shift();if(n=(e.ownerDocument||e).$$reactFormReplay,n!=null)for(i=0;i<n.length;i+=3){var r=n[i],o=n[i+1],s=r[nn]||null;if(typeof o==="function")s||KS(n);else if(s){var l=null;if(o&&o.hasAttribute("formAction")){if(r=o,s=o[nn]||null)l=s.formAction;else if(Eb(r)!==null)continue}else l=s.action;typeof l==="function"?n[i+1]=l:(n.splice(i,3),i-=3),KS(n)}}}function h3(){function e(o){o.canIntercept&&o.info==="react-transition"&&o.intercept({handler:function(){return new Promise(function(s){return r=s})},focusReset:"manual",scroll:"manual"})}function t(){r!==null&&(r(),r=null),i||setTimeout(n,20)}function n(){if(!i&&!navigation.transition){var o=navigation.currentEntry;o&&o.url!=null&&navigation.navigate(o.url,{state:o.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation==="object"){var i=!1,r=null;return navigation.addEventListener("navigate",e),navigation.addEventListener("navigatesuccess",t),navigation.addEventListener("navigateerror",t),setTimeout(n,100),function(){i=!0,navigation.removeEventListener("navigate",e),navigation.removeEventListener("navigatesuccess",t),navigation.removeEventListener("navigateerror",t),r!==null&&(r(),r=null)}}}function Ob(e){this._internalRoot=e}Rb.prototype.render=Ob.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(R(409));var n=t.current,i=Pn();zC(n,i,e,t,null,null)};Rb.prototype.unmount=Ob.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;zC(e.current,2,null,e,null,null),ph(),t[Wu]=null}};function Rb(e){this._internalRoot=e}Rb.prototype.unstable_scheduleHydration=function(e){if(e){var t=sk();e={blockedOn:null,target:e,priority:t};for(var n=0;n<Zr.length&&t!==0&&t<Zr[n].priority;n++);Zr.splice(n,0,e),n===0&&IC(e)}};var jS=If;if(jS!=="19.3.0")throw Error(R(527,jS,"19.3.0"));be.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0){if(typeof e.render==="function")throw Error(R(188));throw e=Object.keys(e).join(","),Error(R(268,e))}return e=az(t),e=e!==null?$S(e):null,e=e===null?null:e.stateNode,e};var p3={bundleType:0,version:"19.3.0",rendererPackageName:"react-dom",currentDispatcherRef:ie,reconcilerVersion:"19.3.0"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){if(fl=__REACT_DEVTOOLS_GLOBAL_HOOK__,!fl.isDisabled&&fl.supportsFiber)try{Gu=fl.inject(p3),pn=fl}catch(e){}}var fl;var Ab=function(e,t){if(!lz(e))throw Error(R(299));var n=!1,i="",r=UB,o=KB,s=jB;return t!==null&&t!==void 0&&(t.unstable_strictMode===!0&&(n=!0),t.identifierPrefix!==void 0&&(i=t.identifierPrefix),t.onUncaughtError!==void 0&&(r=t.onUncaughtError),t.onCaughtError!==void 0&&(o=t.onCaughtError),t.onRecoverableError!==void 0&&(s=t.onRecoverableError)),t=s3(e,1,!1,null,null,n,i,null,r,o,s,h3),e[Wu]=t.current,pC(e),new Ob(t)};HC();function Ie(e,...t){throw Error(`[MobX] minified error nr: ${e}${t.length?" "+t.map(String).join(","):""}. See mobx.js.org/errors`)}var{assign:Fi,getOwnPropertyDescriptor:Ib,defineProperty:Or,prototype:Ch}=Object,Nb=[];Object.freeze(Nb);var ZC={};Object.freeze(ZC);var v3=Object.toString();var ea=()=>{};function na(e){return typeof e==="function"}function Db(e){switch(typeof e){case"string":case"symbol":case"number":return!0}return!1}function Eh(e){return e!==null&&typeof e==="object"}function Ar(e){if(!Eh(e))return!1;let t=Object.getPrototypeOf(e);if(t==null)return!0;let n=Cs(t,"constructor")&&t.constructor;return typeof n==="function"&&n.toString()===v3}function eE(e){let t=e==null?void 0:e.constructor;if(!t)return!1;if(t.name==="GeneratorFunction"||t.displayName==="GeneratorFunction")return!0;return!1}function tE(e,t,n){Or(e,t,{enumerable:!1,writable:!0,configurable:!0,value:n})}function b3(e,t,n){Or(e,t,{enumerable:!1,writable:!1,configurable:!0,value:n})}function Rs(e,t){let n="isMobX"+e;return t.prototype[n]=!0,function(i){return Eh(i)&&i[n]===!0}}function uc(e){return e!=null&&Object.prototype.toString.call(e)==="[object Map]"}function y3(e){let t=Object.getPrototypeOf(e),n=Object.getPrototypeOf(t);return Object.getPrototypeOf(n)===null}function oc(e){return e!=null&&Object.prototype.toString.call(e)==="[object Set]"}function x3(e){let t=Object.keys(e),n=Object.getOwnPropertySymbols(e);if(!n.length)return t;return[...t,...n.filter((i)=>Ch.propertyIsEnumerable.call(e,i))]}var xh=Reflect.ownKeys;function nE(e){return e===null?null:typeof e==="object"?""+e:e}function Cs(e,t){return Ch.hasOwnProperty.call(e,t)}var w3=Object.getOwnPropertyDescriptors;function bn(e,t){return!!(e&t)}function yn(e,t,n){if(n)e|=t;else e&=~t;return e}var oe=Symbol("mobx administration");class ra{constructor(e="Atom"){this.name_=void 0,this.flags_=0,this.observers_=null,this.lastAccessedBy_=0,this.lowestObserverState_=-1,this.onBOL=void 0,this.onBUOL=void 0,this.name_=e}get isBeingObserved(){return bn(this.flags_,1)}set isBeingObserved(e){this.flags_=yn(this.flags_,1,e)}get isPendingUnobservation(){return bn(this.flags_,2)}set isPendingUnobservation(e){this.flags_=yn(this.flags_,2,e)}get diffValue(){return bn(this.flags_,4)?1:0}set diffValue(e){this.flags_=yn(this.flags_,4,e===1?!0:!1)}onBO(){if(this.onBOL)this.onBOL.forEach((e)=>e())}onBUO(){if(this.onBUOL)this.onBUOL.forEach((e)=>e())}reportObserved(){return EE(this)}reportChanged(){Kn(),OE(this),jn()}toString(){return this.name_}}var Hb=Rs("Atom",ra);function iE(e,t=ea,n=ea){let i=new ra(e);if(t!==ea)i.onBOL=new Set([t]);if(n!==ea)i.onBUOL=new Set([n]);return i}var Vb=Object.is;function Es(e,t,n){if(e===null||typeof e!=="object"&&typeof e!=="function")return e;if(VE(e))return e;if(Array.isArray(e))return Dt.array(e,{name:n});if(Ar(e))return Dt.object(e,void 0,{name:n});if(uc(e))return Dt.map(e,{name:n});if(oc(e))return Dt.set(e,{name:n});if(typeof e==="function"&&!ia(e)&&!lc(e))if(eE(e))return Mh(e);else return Fb(n,e);return e}function S3(e,t,n){if(e===void 0||e===null)return e;if(ac(e)||KE(e)||la(e)||dc(e))return e;if(Array.isArray(e))return Dt.array(e,{name:n,deep:!1});if(Ar(e))return Dt.object(e,void 0,{name:n,deep:!1});if(uc(e))return Dt.map(e,{name:n,deep:!1});if(oc(e))return Dt.set(e,{name:n,deep:!1})}function Oh(e){return e}function Rh(e,t){return{annotationType_:e,options_:t,make_:k3,extend_:_3}}function k3(e,t,n,i){var r;if((r=this.options_)!=null&&r.bound)return this.extend_(e,t,n,!1)===null?0:1;if(i===e.target_)return this.extend_(e,t,n,!1)===null?0:2;if(ia(n.value))return 1;let o=oE(e,this,t,n,!1);return Or(i,t,o),2}function _3(e,t,n,i){let r=oE(e,this,t,n);return e.defineProperty_(t,r,i)}function rE(e,t,n){let{kind:i,name:r,addInitializer:o}=n,s=e,l=(u)=>{var c,f,d,h;return Os((c=(f=s.options_)==null?void 0:f.name)!=null?c:r.toString(),u,(d=(h=s.options_)==null?void 0:h.autoAction)!=null?d:!1)};if(i=="field")return function(u){var c;let f=u;if(!ia(f))f=l(f);if((c=s.options_)!=null&&c.bound)f=f.bind(this),f.isMobxAction=!0;return f};if(i=="method"){var a;if(!ia(t))t=l(t);if((a=s.options_)!=null&&a.bound)o(function(){let u=this,c=u[r].bind(u);c.isMobxAction=!0,u[r]=c});return t}Ie(43,s.annotationType_,String(r),i)}function C3(e,{annotationType_:t},n,{value:i}){}function oE(e,t,n,i,r=F.safeDescriptors){var o,s,l,a,u,c,f;C3(e,t,n,i);let{value:d}=i;if((o=t.options_)!=null&&o.bound){var h;d=d.bind((h=e.proxy_)!=null?h:e.target_)}return{value:Os((s=(l=t.options_)==null?void 0:l.name)!=null?s:n.toString(),d,(a=(u=t.options_)==null?void 0:u.autoAction)!=null?a:!1,(c=t.options_)!=null&&c.bound?(f=e.proxy_)!=null?f:e.target_:void 0),configurable:r?e.isPlainObject_:!0,enumerable:!1,writable:r?!1:!0}}function sE(e,t){return{annotationType_:e,options_:t,make_:E3,extend_:O3}}function E3(e,t,n,i){var r;if(i===e.target_)return this.extend_(e,t,n,!1)===null?0:2;if((r=this.options_)!=null&&r.bound&&(!Cs(e.target_,t)||!lc(e.target_[t]))){if(this.extend_(e,t,n,!1)===null)return 0}if(lc(n.value))return 1;let o=aE(e,this,t,n,!1,!1);return Or(i,t,o),2}function O3(e,t,n,i){var r;let o=aE(e,this,t,n,(r=this.options_)==null?void 0:r.bound);return e.defineProperty_(t,o,i)}function lE(e,t,n){var i;let{name:r,addInitializer:o}=n;if(!lc(t))t=Mh(t);if((i=e.options_)!=null&&i.bound)o(function(){let s=this,l=s[r].bind(s);l.isMobXFlow=!0,s[r]=l});return t}function R3(e,{annotationType_:t},n,{value:i}){}function aE(e,t,n,i,r,o=F.safeDescriptors){R3(e,t,n,i);let{value:s}=i;if(!lc(s))s=Mh(s);if(r){var l;s=s.bind((l=e.proxy_)!=null?l:e.target_),s.isMobXFlow=!0}return{value:s,configurable:o?e.isPlainObject_:!0,enumerable:!1,writable:o?!1:!0}}function uE(e,t){return{annotationType_:e,options_:t,make_:A3,extend_:T3}}function A3(e,t,n){return this.extend_(e,t,n,!1)===null?0:1}function T3(e,t,n,i){return M3(e,this,t,n),e.defineComputedProperty_(t,Fi({},this.options_,{get:n.get,set:n.set}),i)}function cE(e,t,n){let i=e,{name:r,addInitializer:o}=n,s;function l(a,u){let c=Fi({},i.options_,{get:t,context:a});return c.name||(c.name=`ObservableObject.${r.toString()}`),new Rr(c)}return o(function(){var a;let u=hc(this)[oe],c=this,f=u.values_.get(r);if(f instanceof Rr&&f.derivation!==t)u.values_.delete(r);((a=u.lazyComputedKeys_)!=null?a:u.lazyComputedKeys_=new Map).set(r,()=>l(c,u))}),function(){let a=this[oe],u=a.values_.get(r);if(u instanceof Rr&&u.derivation!==t){var c;let d=(c=s)==null?void 0:c.get(this);if(!d){var f;d=l(this,a),((f=s)!=null?f:s=new WeakMap).set(this,d)}return d.get()}return a.getObservablePropValue_(r)}}function M3(e,{annotationType_:t},n,{get:i}){}function Ub(e,t){return{annotationType_:e,options_:t,make_:N3,extend_:D3}}function N3(e,t,n){return this.extend_(e,t,n,!1)===null?0:1}function D3(e,t,n,i){var r,o;return L3(e,this,t,n),e.defineObservableProperty_(t,n.value,(r=(o=this.options_)==null?void 0:o.enhancer_)!=null?r:Es,i)}function fE(e,t,n){let i=e,{kind:r,name:o}=n;if(r!=="accessor")return;function s(l,a){var u;let c=hc(l)[oe];return((u=c.lazyObservableKeys_)!=null?u:c.lazyObservableKeys_=new Map).set(o,()=>{var f,d;return new ko(a,(f=(d=i.options_)==null?void 0:d.enhancer_)!=null?f:Es,`ObservableObject.${o.toString()}`,!1)}),c}return{get(){var l;return((l=this[oe])!=null?l:s(this,t.get.call(this))).getObservablePropValue_(o)},set(l){var a;return((a=this[oe])!=null?a:s(this,l)).setObservablePropValue_(o,l)},init(l){return s(this,l),l}}}function L3(e,{annotationType_:t},n,i){}var z3="true",B3=dE();function dE(e){return{annotationType_:z3,options_:e,make_:P3,extend_:I3}}function P3(e,t,n,i){var r,o;if(n.get)return Kb.make_(e,t,n,i);if(n.set){let c=ia(n.set)?n.set:Os(t.toString(),n.set);if(i===e.target_)return e.defineProperty_(t,{configurable:F.safeDescriptors?e.isPlainObject_:!0,set:c})===null?0:2;return Or(i,t,{configurable:!0,set:c}),2}if(i!==e.target_&&typeof n.value==="function"){var s;if(eE(n.value)){var l;return((l=this.options_)!=null&&l.autoBind?w5:Mh).make_(e,t,n,i)}return((s=this.options_)!=null&&s.autoBind?p5:Fb).make_(e,t,n,i)}let a=((r=this.options_)==null?void 0:r.deep)===!1?oa:Dt;if(typeof n.value==="function"&&(o=this.options_)!=null&&o.autoBind){var u;n.value=n.value.bind((u=e.proxy_)!=null?u:e.target_)}return a.make_(e,t,n,i)}function I3(e,t,n,i){var r,o;if(n.get)return Kb.extend_(e,t,n,i);if(n.set)return e.defineProperty_(t,{configurable:F.safeDescriptors?e.isPlainObject_:!0,set:Os(t.toString(),n.set)},i);if(typeof n.value==="function"&&(r=this.options_)!=null&&r.autoBind){var s;n.value=n.value.bind((s=e.proxy_)!=null?s:e.target_)}return(((o=this.options_)==null?void 0:o.deep)===!1?oa:Dt).extend_(e,t,n,i)}function Ah(e,t){return Fi(function(i,r){if(r&&typeof r.kind==="string")return t(e,i,r);return},e)}var H3="observable",V3="observable.ref",U3="observable.shallow";var hE={deep:!0,name:void 0,defaultDecorator:void 0};Object.freeze(hE);function vh(e){return e||hE}var pE=Ub(H3),K3=Ub(V3,{enhancer_:Oh}),j3=Ub(U3,{enhancer_:S3});function mE(e){return Ah(e,fE)}function bh(e){return e.deep===!0?Es:e.deep===!1?Oh:q3(e.defaultDecorator)}function F3(e){var t;return e?(t=e.defaultDecorator)!=null?t:dE(e):void 0}function q3(e){var t,n;return!e?Es:(t=(n=e.options_)==null?void 0:n.enhancer_)!=null?t:Es}function $3(e,t,n){if(t&&typeof t.kind==="string")return fE(pE,e,t);if(VE(e))return e;if(Ar(e))return Dt.object(e,t,n);if(Array.isArray(e))return Dt.array(e,t);if(uc(e))return Dt.map(e,t);if(oc(e))return Dt.set(e,t);if(typeof e==="object"&&e!==null)return e;return Dt.box(e,t)}var X3={box(e,t){let n=vh(t);return new ko(e,bh(n),n.name,!0,n.equals)},array(e,t){let n=vh(t);return R5(e,bh(n),n.name)},map(e,t){let n=vh(t);return new $b(e,bh(n),n.name)},set(e,t){let n=vh(t);return new Xb(e,bh(n),n.name)},object(e,t,n){return aa(()=>BE(_5({},n),e,t))}},oa=mE(K3),cc=mE(j3);var Dt=Fi($3,pE,X3),gE="computed";function G3(e){return Ah(e,cE)}var vE=uE(gE);var Kb=function(t,n){if(n&&typeof n.kind==="string")return cE(vE,t,n);if(Ar(t))return G3(uE(gE,t));let i=Ar(n)?n:{};return i.get=t,i.name||(i.name=t.name||""),new Rr(i)};Fi(Kb,vE);var VC,UC,wh=0,Y3=1,W3=(VC=(UC=Ib(()=>{},"name"))==null?void 0:UC.configurable)!=null?VC:!1,KC={value:"action",configurable:!0,writable:!1,enumerable:!1};function Os(e,t,n=!1,i){function r(){return bE(e,n,t,i||this,arguments)}if(r.isMobxAction=!0,r.toString=()=>t.toString(),W3)KC.value=e,Or(r,"name",KC);return r}function bE(e,t,n,i,r){let o=Q3(e,t,i,r);try{return n.apply(i,r)}catch(s){throw o.error_=s,s}finally{J3(o)}}function Q3(e,t,n,i){let o=0,s=F.trackingDerivation,l=!t||!s;Kn();let a=F.allowStateChanges;if(l)sa();let u=F.allowStateReads,c={runAsAction_:l,prevDerivation_:s,prevAllowStateChanges_:a,prevAllowStateReads_:u,notifySpy_:!1,startTime_:o,actionId_:Y3++,parentActionId_:wh};return wh=c.actionId_,c}function J3(e){if(wh!==e.actionId_)Ie(30);if(wh=e.parentActionId_,e.error_!==void 0)F.suppressReactionErrors=!0;if(jn(),e.runAsAction_)_o(e.prevDerivation_);F.suppressReactionErrors=!1}function Z3(e,t){let n=e5(e);try{return t()}finally{t5(n)}}function e5(e){let t=F.allowStateChanges;return F.allowStateChanges=e,t}function t5(e){F.allowStateChanges=e}class ko extends ra{constructor(e,t,n="ObservableValue",i=!0,r=Vb){super(n);if(this.enhancer_=void 0,this.name_=void 0,this.equals_=void 0,this.hasUnreportedChange_=!1,this.interceptors_=void 0,this.changeListeners_=void 0,this.value_=void 0,this.dehancer=void 0,this.enhancer_=t,this.name_=n,this.equals_=r,this.value_=t(e,void 0,n),!1)var o}dehanceValue(e){if(this.dehancer!==void 0)return this.dehancer(e);return e}set(e){let t=this.value_;if(e=this.prepareNewValue_(e),e!==F.UNCHANGED)this.setNewValue_(e)}prepareNewValue_(e){if(ji(this),Vn(this)){let t=Un(this,{object:this,type:Co,newValue:e});if(!t)return F.UNCHANGED;e=t.newValue}return e=this.enhancer_(e,this.value_,this.name_),this.equals_(this.value_,e)?F.UNCHANGED:e}setNewValue_(e){let t=this.value_;if(this.value_=e,this.reportChanged(),ai(this))ui(this,{type:Co,object:this,newValue:e,oldValue:t})}get(){return this.reportObserved(),this.dehanceValue(this.value_)}raw(){return this.value_}toJSON(){return this.get()}toString(){return`${this.name_}[${this.value_}]`}valueOf(){return nE(this.get())}[Symbol.toPrimitive](){return this.valueOf()}}class Rr{constructor(e){if(this.dependenciesState_=-1,this.observing_=[],this.newObserving_=null,this.observers_=null,this.runId_=0,this.lastAccessedBy_=0,this.lowestObserverState_=0,this.unboundDepsCount_=0,this.value_=new sc(null),this.name_=void 0,this.triggeredBy_=void 0,this.flags_=0,this.derivation=void 0,this.setter_=void 0,this.scope_=void 0,this.equals_=void 0,this.requiresReaction_=void 0,this.keepAlive_=void 0,this.onBOL=void 0,this.onBUOL=void 0,!e.get)Ie(31);if(this.derivation=e.get,this.name_=e.name||"ComputedValue",e.set)this.setter_=Os("ComputedValue-setter",e.set);this.equals_=e.equals||Vb,this.scope_=e.context,this.requiresReaction_=e.requiresReaction,this.keepAlive_=!!e.keepAlive}onBecomeStale_(){a5(this)}onBO(){if(this.onBOL)this.onBOL.forEach((e)=>e())}onBUO(){if(this.onBUOL)this.onBUOL.forEach((e)=>e())}get isComputing(){return bn(this.flags_,1)}set isComputing(e){this.flags_=yn(this.flags_,1,e)}get isRunningSetter(){return bn(this.flags_,2)}set isRunningSetter(e){this.flags_=yn(this.flags_,2,e)}get isBeingObserved(){return bn(this.flags_,4)}set isBeingObserved(e){this.flags_=yn(this.flags_,4,e)}get isPendingUnobservation(){return bn(this.flags_,8)}set isPendingUnobservation(e){this.flags_=yn(this.flags_,8,e)}get diffValue(){return bn(this.flags_,16)?1:0}set diffValue(e){this.flags_=yn(this.flags_,16,e===1?!0:!1)}get(){if(this.isComputing)Ie(32,this.name_,this.derivation);if(F.inBatch===0&&(!this.observers_||this.observers_.size===0)&&!this.keepAlive_){if(Lb(this))this.warnAboutUntrackedRead_(),Kn(),this.value_=this.computeValue_(!1),jn()}else{let t=this.isBeingObserved;if(EE(this),Lb(this)){let n=F.trackingContext;if(!n&&(this.keepAlive_||this.isBeingObserved))F.trackingContext=this;if(this.trackAndCompute())l5(this);F.trackingContext=n}else if(!t&&this.isBeingObserved)this.observing_.forEach(CE)}let e=this.value_;if(yh(e))throw e.cause;return e}set(e){if(this.setter_){if(this.isRunningSetter)Ie(33,this.name_);this.isRunningSetter=!0;try{this.setter_.call(this.scope_,e)}finally{this.isRunningSetter=!1}}else Ie(34,this.name_)}trackAndCompute(){let e=this.value_,t=this.dependenciesState_===-1,n=this.computeValue_(!0),i=t||yh(e)||yh(n)||!this.equals_(e,n);if(i)this.value_=n;return i}computeValue_(e){this.isComputing=!0;let t=!1,n;if(e)n=yE(this,this.derivation,this.scope_);else if(F.disableErrorBoundaries===!0)n=this.derivation.call(this.scope_);else try{n=this.derivation.call(this.scope_)}catch(i){n=new sc(i)}return this.isComputing=!1,n}suspend_(){if(!this.keepAlive_)zb(this),this.value_=void 0}warnAboutUntrackedRead_(){return}toString(){return`${this.name_}[${this.derivation.toString()}]`}valueOf(){return nE(this.get())}[Symbol.toPrimitive](){return this.valueOf()}}var Th=Rs("ComputedValue",Rr);class sc{constructor(e){this.cause=void 0,this.cause=e}}function yh(e){return e instanceof sc}function Lb(e){switch(e.dependenciesState_){case 0:return!1;case-1:case 2:return!0;case 1:{let n=sa(),i=e.observing_,r=i.length;for(let o=0;o<r;o++){let s=i[o];if(Th(s)){if(F.disableErrorBoundaries)s.get();else try{s.get()}catch(l){return _o(n),!0}if(e.dependenciesState_===2)return _o(n),!0}}return wE(e),_o(n),!1}}}function ji(e){return}function n5(e){}function yE(e,t,n){wE(e),e.newObserving_=Array(e.runId_===0?100:e.observing_.length),e.unboundDepsCount_=0,e.runId_=++F.runId;let r=F.trackingDerivation;F.trackingDerivation=e,F.inBatch++;let o;if(F.disableErrorBoundaries===!0)o=t.call(n);else try{o=t.call(n)}catch(s){o=new sc(s)}return F.inBatch--,F.trackingDerivation=r,r5(e),i5(e),o}function i5(e){return}function r5(e){let t=e.observing_,n=e.observing_=e.newObserving_,i=0,r=0,o=e.unboundDepsCount_;for(let s=0;s<o;s++){let l=n[s];if(l.diffValue===0){if(l.diffValue=1,r!==s)n[r]=l;r++}if(l.dependenciesState_>i)i=l.dependenciesState_}n.length=r,e.newObserving_=null,o=t.length;while(o--){let s=t[o];if(s.diffValue===0)kE(s,e);s.diffValue=0}while(r--){let s=n[r];if(s.diffValue===1)s.diffValue=0,s5(s,e)}if(i!==0)e.dependenciesState_=i,e.onBecomeStale_()}function zb(e){let t=e.observing_;e.observing_=[];let n=t.length;while(n--)kE(t[n],e);e.dependenciesState_=-1}function xE(e){let t=sa();try{return e()}finally{_o(t)}}function sa(){let e=F.trackingDerivation;return F.trackingDerivation=null,e}function _o(e){F.trackingDerivation=e}function wE(e){if(e.dependenciesState_===0)return;e.dependenciesState_=0;let t=e.observing_,n=t.length;while(n--)t[n].lowestObserverState_=0}var SE=7;class Bb{constructor(){this.version=SE,this.UNCHANGED={},this.trackingDerivation=null,this.trackingContext=null,this.runId=0,this.mobxGuid=0,this.inBatch=0,this.pendingUnobservations=[],this.pendingReactions=[],this.isRunningReactions=!1,this.isRunningUnobservations=!1,this.allowStateChanges=!1,this.allowStateReads=!0,this.enforceActions=!0,this.spyListeners=[],this.globalReactionErrorHandlers=[],this.computedRequiresReaction=!1,this.reactionRequiresObservable=!1,this.observableRequiresReaction=!1,this.disableErrorBoundaries=!1,this.suppressReactionErrors=!1,this.safeDescriptors=!0}}var Tb=!0,o5=!1,F=function(){let e=globalThis;if(e.__mobxInstanceCount>0&&!e.__mobxGlobals)Tb=!1;if(e.__mobxGlobals&&e.__mobxGlobals.version!==SE)Tb=!1;if(!Tb)return setTimeout(()=>{if(!o5)Ie(35)},1),new Bb;else if(e.__mobxGlobals){if(e.__mobxInstanceCount+=1,!e.__mobxGlobals.UNCHANGED)e.__mobxGlobals.UNCHANGED={};return e.__mobxGlobals}else return e.__mobxInstanceCount=1,e.__mobxGlobals=new Bb}();function jb(){return F}function s5(e,t){var n;if(((n=e.observers_)!=null?n:e.observers_=new Set).add(t),e.lowestObserverState_>t.dependenciesState_)e.lowestObserverState_=t.dependenciesState_}function kE(e,t){let n=e.observers_;if(!n)return;if(n.delete(t),n.size===0)_E(e)}function _E(e){if(e.isPendingUnobservation===!1)e.isPendingUnobservation=!0,F.pendingUnobservations.push(e)}function Kn(){F.inBatch++}function jn(){if(--F.inBatch===0){if(RE(),!F.isRunningUnobservations){F.isRunningUnobservations=!0;try{let e=F.pendingUnobservations;for(let t=0;t<e.length;t++){let n=e[t];if(n.isPendingUnobservation=!1,!n.observers_||n.observers_.size===0){if(n.isBeingObserved)n.isBeingObserved=!1,n.onBUO();if(n instanceof Rr)n.suspend_()}}F.pendingUnobservations=[]}finally{F.isRunningUnobservations=!1}}}}function CE(e){var t;if(e.isBeingObserved)return;e.isBeingObserved=!0,e.onBO(),(t=e.observing_)==null||t.forEach(CE)}function EE(e){n5(e);let t=F.trackingDerivation;if(t!==null){if(t.runId_!==e.lastAccessedBy_){if(e.lastAccessedBy_=t.runId_,t.newObserving_[t.unboundDepsCount_++]=e,!e.isBeingObserved&&F.trackingContext)e.isBeingObserved=!0,e.onBO()}return e.isBeingObserved}else if((!e.observers_||e.observers_.size===0)&&F.inBatch>0)_E(e);return!1}function OE(e){var t;if(e.lowestObserverState_===2)return;e.lowestObserverState_=2,(t=e.observers_)==null||t.forEach((n)=>{if(n.dependenciesState_===0)n.onBecomeStale_();n.dependenciesState_=2})}function l5(e){var t;if(e.lowestObserverState_===2)return;e.lowestObserverState_=2,(t=e.observers_)==null||t.forEach((n)=>{if(n.dependenciesState_===1)n.dependenciesState_=2;else if(n.dependenciesState_===0)e.lowestObserverState_=0})}function a5(e){var t;if(e.lowestObserverState_!==0)return;e.lowestObserverState_=1,(t=e.observers_)==null||t.forEach((n)=>{if(n.dependenciesState_===0)n.dependenciesState_=1,n.onBecomeStale_()})}class fc{constructor(e="Reaction",t,n,i){this.name_=void 0,this.onInvalidate_=void 0,this.errorHandler_=void 0,this.requiresObservable_=void 0,this.observing_=[],this.newObserving_=[],this.dependenciesState_=-1,this.runId_=0,this.unboundDepsCount_=0,this.flags_=0,this.name_=e,this.onInvalidate_=t,this.errorHandler_=n,this.requiresObservable_=i}get isDisposed(){return bn(this.flags_,1)}set isDisposed(e){this.flags_=yn(this.flags_,1,e)}get isScheduled(){return bn(this.flags_,2)}set isScheduled(e){this.flags_=yn(this.flags_,2,e)}get isTrackPending(){return bn(this.flags_,4)}set isTrackPending(e){this.flags_=yn(this.flags_,4,e)}get isRunning(){return bn(this.flags_,8)}set isRunning(e){this.flags_=yn(this.flags_,8,e)}get diffValue(){return bn(this.flags_,16)?1:0}set diffValue(e){this.flags_=yn(this.flags_,16,e===1?!0:!1)}onBecomeStale_(){this.schedule_()}schedule_(){if(!this.isScheduled)this.isScheduled=!0,F.pendingReactions.push(this),RE()}runReaction_(){if(!this.isDisposed){Kn(),this.isScheduled=!1;let e=F.trackingContext;if(F.trackingContext=this,Lb(this)){this.isTrackPending=!0;try{this.onInvalidate_()}catch(t){this.reportExceptionInDerivation_(t)}}F.trackingContext=e,jn()}}track(e){if(this.isDisposed)return;Kn();let t=!1,n;this.isRunning=!0;let i=F.trackingContext;F.trackingContext=this;let r=yE(this,e,void 0);if(F.trackingContext=i,this.isRunning=!1,this.isTrackPending=!1,this.isDisposed)zb(this);if(yh(r))this.reportExceptionInDerivation_(r.cause);jn()}reportExceptionInDerivation_(e){if(this.errorHandler_){this.errorHandler_(e,this);return}if(F.disableErrorBoundaries)throw e;let t=`[mobx] uncaught error in '${this}'`;if(!F.suppressReactionErrors)console.error(t,e);F.globalReactionErrorHandlers.forEach((n)=>n(e,this))}dispose(){if(!this.isDisposed){if(this.isDisposed=!0,!this.isRunning)Kn(),zb(this),jn()}}getDisposer_(e){let t=()=>{this.dispose(),e==null||e.removeEventListener==null||e.removeEventListener("abort",t)};if(e==null||e.addEventListener==null||e.addEventListener("abort",t),t[oe]=this,"dispose"in Symbol&&typeof Symbol.dispose==="symbol")t[Symbol.dispose]=t;return t}toString(){return`Reaction[${this.name_}]`}}var u5=100,c5=(e)=>e();function RE(){if(F.inBatch>0||F.isRunningReactions)return;c5(f5)}function f5(){F.isRunningReactions=!0;let e=F.pendingReactions,t=0;while(e.length>0){if(++t===u5)console.error(`[mobx] cycle in reaction: ${e[0]}`),e.splice(0);let n=e.splice(0);for(let i=0,r=n.length;i<r;i++)n[i].runReaction_()}F.isRunningReactions=!1}var Sh=Rs("Reaction",fc);var AE="action";var TE="autoAction",d5="autoAction.bound",ME="<unnamed action>",NE=Rh(AE);var DE=Rh(TE,{autoAction:!0}),h5=Rh(d5,{autoAction:!0,bound:!0});function LE(e){return Ah(e,rE)}function zE(e){return function(i,r){if(r&&typeof r.kind==="string")return rE(e?DE:NE,i,r);if(na(i))return Os(i.name||ME,i,e);if(na(r))return Os(i,r,e);if(Db(i))return LE(Rh(e?TE:AE,{name:i,autoAction:e}))}}var ta=zE(!1);Fi(ta,NE);var Fb=zE(!0);Fi(Fb,DE);var p5=LE(h5);function N(e){return bE(e.name||ME,!1,e,this,void 0)}function ia(e){return na(e)&&e.isMobxAction===!0}var m5=(e)=>e();function g5(e){return e.scheduler?e.scheduler:e.delay?(t)=>setTimeout(t,e.delay):m5}function Tr(e,t,n=ZC){var i,r;let o=(i=n.name)!=null?i:"Reaction",s=ta(o,n.onError?v5(n.onError,t):t),l=!n.scheduler&&!n.delay,a=g5(n),u=!0,c=!1,f,d=n.equals||Vb,h=new fc(o,()=>{if(u||l)m();else if(!c)c=!0,a(m)},n.onError,n.requiresObservable);function m(){if(c=!1,h.isDisposed)return;let b=!1,x=f;if(h.track(()=>{let g=Z3(!1,()=>e(h));b=u||!d(f,g),f=g}),u&&n.fireImmediately)s(f,x,h);else if(!u&&b)s(f,x,h);u=!1}if(!(n!=null&&(r=n.signal)!=null&&r.aborted))h.schedule_();return h.getDisposer_(n==null?void 0:n.signal)}function v5(e,t){return function(){try{return t.apply(this,arguments)}catch(n){e.call(this,n)}}}function BE(e,t,n,i){let r=w3(t);return aa(()=>{let o=hc(e,i)[oe];xh(r).forEach((s)=>{o.extend_(s,r[s],!n?!0:(s in n)?n[s]:!0)})}),e}function PE(e,t){return IE(_h(e,t))}function IE(e){let t={name:e.name_};if(e.observing_&&e.observing_.length>0)t.dependencies=b5(e.observing_).map(IE);return t}function b5(e){return Array.from(new Set(e))}class HE extends Error{constructor(){super("FLOW_CANCELLED");Object.setPrototypeOf(this,new.target.prototype),this.name="FlowCancellationError"}toString(){return`Error: ${this.message}`}}function y5(e){return Ah(e,lE)}var jC=sE("flow"),x5=sE("flow.bound",{bound:!0}),Mh=Fi(function(t,n){if(n&&typeof n.kind==="string")return lE(jC,t,n);let i=t,r=i.name||"flow",o=function(){let l=this,a=arguments,u=0,c=ta(r,i).apply(l,a),f,d=void 0,h=new Promise(function(b,x){let g=0;f=x;function v(k){d=void 0;let E;try{E=ta(r,c.next).call(c,k)}catch(_){return x(_)}S(E)}function w(k){d=void 0;let E;try{E=ta(r,c.throw).call(c,k)}catch(_){return x(_)}S(E)}function S(k){if(na(k==null?void 0:k.then)){k.then(S,x);return}if(k.done)return b(k.value);return d=Promise.resolve(k.value),d.then(v,w)}v(void 0)}),m=r;return h.cancel=ta(m,function(){try{if(d)FC(d);let b=c.return(void 0),x=Promise.resolve(b.value);x.then(ea,ea),FC(x),f(new HE)}catch(b){f(b)}}),h};return o.isMobXFlow=!0,o},jC),w5=y5(x5);function FC(e){if(na(e.cancel))e.cancel()}function lc(e){return(e==null?void 0:e.isMobXFlow)===!0}function S5(e,t){if(!e)return!1;if(t!==void 0){if(ac(e)){var n,i;let r=e[oe];return r.values_.has(t)||!!((n=r.lazyComputedKeys_)!=null&&n.has(t))||!!((i=r.lazyObservableKeys_)!=null&&i.has(t))}return!1}return ac(e)||!!e[oe]||Hb(e)||Sh(e)||Th(e)}function VE(e){return S5(e)}function Er(e,t=void 0){Kn();try{return e.apply(t)}finally{jn()}}function Zl(e){return e[oe]}var k5={has(e,t){return Zl(e).has_(t)},get(e,t){return Zl(e).get_(t)},set(e,t,n){var i;if(!Db(t))return!1;return(i=Zl(e).set_(t,n,!0))!=null?i:!0},deleteProperty(e,t){var n;if(!Db(t))return!1;return(n=Zl(e).delete_(t,!0))!=null?n:!0},defineProperty(e,t,n){var i;return(i=Zl(e).defineProperty_(t,n))!=null?i:!0},ownKeys(e){return Zl(e).ownKeys_()},preventExtensions(e){Ie(13)}};function _5(e,t){var n,i;return e=hc(e,t),(i=(n=e[oe]).proxy_)!=null?i:n.proxy_=new Proxy(e,k5)}function Vn(e){return e.interceptors_!==void 0&&e.interceptors_.length>0}function Un(e,t){let n=sa();try{let i=[...e.interceptors_||[]];for(let r=0,o=i.length;r<o;r++){if(t=i[r](t),t&&!t.type)Ie(14);if(!t)break}return t}finally{_o(n)}}function ai(e){return e.changeListeners_!==void 0&&e.changeListeners_.length>0}function ui(e,t){let n=sa(),i=e.changeListeners_;if(!i)return;i=i.slice();for(let r=0,o=i.length;r<o;r++)i[r](t);_o(n)}var Mb=Symbol("mobx-keys");function ci(e,t,n){if(Ar(e))return BE(e,e,t,n);return aa(()=>{let i=hc(e,n)[oe];if(!e[Mb]){let r=Object.getPrototypeOf(e),o=new Set([...xh(e),...xh(r)]);o.delete("constructor"),o.delete(oe),tE(r,Mb,o)}e[Mb].forEach((r)=>C5(i,r,!t?!0:(r in t)?t[r]:!0))}),e}function C5(e,t,n){if(n===!0)n=e.defaultAnnotation_;if(n===!1)return;if(FE(e,n,t),!(t in e.target_))Ie(1,n.annotationType_,`${e.name_}.${t.toString()}`);let i=e.target_;while(i&&i!==Ch){let r=Ib(i,t);if(r){let o=n.make_(e,t,r,i);if(o===0)return;if(o===1)break}i=Object.getPrototypeOf(i)}jE(e,n,t)}var qC="splice",Co="update",E5=1e4,O5={get(e,t){let n=e[oe];if(t===oe)return n;if(t==="length")return n.getArrayLength_();if(typeof t==="string"&&!isNaN(t))return n.get_(parseInt(t));if(Cs(Pb,t))return Pb[t];return e[t]},set(e,t,n){let i=e[oe];if(t==="length")i.setArrayLength_(n);if(typeof t==="symbol"||isNaN(t))e[t]=n;else i.set_(parseInt(t),n);return!0},preventExtensions(){Ie(15)}};class qb{constructor(e="ObservableArray",t,n){this.owned_=void 0,this.atom_=void 0,this.values_=[],this.interceptors_=void 0,this.changeListeners_=void 0,this.enhancer_=void 0,this.dehancer=void 0,this.proxy_=void 0,this.lastKnownLength_=0,this.owned_=n,this.atom_=new ra(e),this.enhancer_=(i,r)=>t(i,r,"ObservableArray[..]")}dehanceValue_(e){if(this.dehancer!==void 0)return this.dehancer(e);return e}dehanceValues_(e){if(this.dehancer!==void 0&&e.length>0)return e.map(this.dehancer);return e}getArrayLength_(){return this.atom_.reportObserved(),this.values_.length}setArrayLength_(e){if(typeof e!=="number"||isNaN(e)||e<0)Ie(40,e);let t=this.values_.length;if(e===t)return;else if(e>t){let n=Array.from({length:e-t});this.spliceWithArray_(t,0,n)}else this.spliceWithArray_(e,t-e)}updateArrayLength_(e,t){if(e!==this.lastKnownLength_)Ie(16);this.lastKnownLength_+=t}spliceWithArray_(e,t,n){ji(this.atom_);let i=this.values_.length;if(e===void 0)e=0;else if(e>i)e=i;else if(e<0)e=Math.max(0,i+e);if(arguments.length===1)t=i-e;else if(t===void 0||t===null)t=0;else t=Math.max(0,Math.min(t,i-e));if(n===void 0)n=Nb;if(Vn(this)){let o=Un(this,{object:this.proxy_,type:qC,index:e,removedCount:t,added:n});if(!o)return Nb;t=o.removedCount,n=o.added}n=n.length===0?n:n.map((o)=>this.enhancer_(o,void 0));let r=this.spliceItemsIntoValues_(e,t,n);if(t!==0||n.length!==0)this.notifyArraySplice_(e,n,r);return this.dehanceValues_(r)}spliceItemsIntoValues_(e,t,n){if(n.length<E5)return this.values_.splice(e,t,...n);else{let i=this.values_.slice(e,e+t),r=this.values_.slice(e+t);this.values_.length+=n.length-t;for(let o=0;o<n.length;o++)this.values_[e+o]=n[o];for(let o=0;o<r.length;o++)this.values_[e+n.length+o]=r[o];return i}}notifyArrayChildUpdate_(e,t,n){let r=ai(this),o=r?{observableKind:"array",object:this.proxy_,type:Co,debugObjectName:this.atom_.name_,index:e,newValue:t,oldValue:n}:null;if(this.atom_.reportChanged(),r)ui(this,o)}notifyArraySplice_(e,t,n){let r=ai(this),o=r?{observableKind:"array",object:this.proxy_,debugObjectName:this.atom_.name_,type:qC,index:e,removed:n,added:t,removedCount:n.length,addedCount:t.length}:null;if(this.atom_.reportChanged(),r)ui(this,o)}get_(e){return this.atom_.reportObserved(),this.dehanceValue_(this.values_[e])}set_(e,t){let n=this.values_;if(e<n.length){ji(this.atom_);let i=n[e];if(Vn(this)){let o=Un(this,{type:Co,object:this.proxy_,index:e,newValue:t});if(!o)return;t=o.newValue}if(t=this.enhancer_(t,i),t!==i)n[e]=t,this.notifyArrayChildUpdate_(e,t,i)}else{let i=Array.from({length:e+1-n.length});i[i.length-1]=t,this.spliceWithArray_(n.length,0,i)}}}function R5(e,t,n="ObservableArray",i=!1){return aa(()=>{let r=new qb(n,t,i);b3(r.values_,oe,r);let o=new Proxy(r.values_,O5);if(r.proxy_=o,e&&e.length)r.spliceWithArray_(0,0,e);return o})}var Pb={clear(){return this.splice(0)},replace(e){let t=this[oe];return t.spliceWithArray_(0,t.values_.length,e)},toJSON(){return this.slice()},splice(e,t,...n){let i=this[oe];switch(arguments.length){case 0:return[];case 1:return i.spliceWithArray_(e);case 2:return i.spliceWithArray_(e,t)}return i.spliceWithArray_(e,t,n)},spliceWithArray(e,t,n){return this[oe].spliceWithArray_(e,t,n)},push(...e){let t=this[oe];return t.spliceWithArray_(t.values_.length,0,e),t.values_.length},pop(){return this.splice(Math.max(this[oe].values_.length-1,0),1)[0]},shift(){return this.splice(0,1)[0]},unshift(...e){let t=this[oe];return t.spliceWithArray_(0,0,e),t.values_.length},reverse(){if(F.trackingDerivation)Ie(37,"reverse");return this.replace(this.slice().reverse()),this},sort(){if(F.trackingDerivation)Ie(37,"sort");let e=this.slice();return e.sort.apply(e,arguments),this.replace(e),this},remove(e){let t=this[oe],n=t.dehanceValues_(t.values_).indexOf(e);if(n>-1)return this.splice(n,1),!0;return!1}};He("at",xn);He("concat",xn);He("flat",xn);He("includes",xn);He("indexOf",xn);He("join",xn);He("lastIndexOf",xn);He("slice",xn);He("toString",xn);He("toLocaleString",xn);He("toSorted",xn);He("toSpliced",xn);He("with",xn);He("every",fi);He("filter",fi);He("find",fi);He("findIndex",fi);He("findLast",fi);He("findLastIndex",fi);He("flatMap",fi);He("forEach",fi);He("map",fi);He("some",fi);He("toReversed",fi);He("reduce",UE);He("reduceRight",UE);function He(e,t){if(typeof Array.prototype[e]==="function")Pb[e]=t(e)}function xn(e){return function(){let t=this[oe];t.atom_.reportObserved();let n=t.dehanceValues_(t.values_);return n[e].apply(n,arguments)}}function fi(e){return function(t,n){let i=this[oe];return i.atom_.reportObserved(),i.dehanceValues_(i.values_)[e]((o,s)=>t.call(n,o,s,this))}}function UE(e){return function(){let t=this[oe];t.atom_.reportObserved();let n=t.dehanceValues_(t.values_),i=arguments[0];return arguments[0]=(r,o,s)=>i(r,o,s,this),n[e].apply(n,arguments)}}var A5=Rs("ObservableArrayAdministration",qb);function KE(e){return Eh(e)&&A5(e[oe])}var T5={},So="add",kh="delete";class $b{constructor(e,t=Es,n="ObservableMap"){this.enhancer_=void 0,this.name_=void 0,this[oe]=T5,this.data_=void 0,this.hasMap_=void 0,this.keysAtom_=void 0,this.interceptors_=void 0,this.changeListeners_=void 0,this.dehancer=void 0,this.enhancer_=t,this.name_=n,aa(()=>{if(this.keysAtom_=iE("ObservableMap.keys()"),this.data_=new Map,this.hasMap_=new Map,e)this.merge(e)})}has_(e){return this.data_.has(e)}has(e){if(!F.trackingDerivation)return this.has_(e);let t=this.hasMap_.get(e);if(!t){let n=t=new ko(this.has_(e),Oh,"ObservableMap.key?",!1);this.hasMap_.set(e,n),n.onBUOL=new Set([()=>this.hasMap_.delete(e)])}return t.get()}set(e,t){let n=this.has_(e);if(Vn(this)){let i=Un(this,{type:n?Co:So,object:this,newValue:t,name:e});if(!i)return this;t=i.newValue}if(n)this.updateValue_(e,t);else this.addValue_(e,t);return this}delete(e){if(ji(this.keysAtom_),Vn(this)){if(!Un(this,{type:kh,object:this,name:e}))return!1}if(this.has_(e)){let n=ai(this),i=n?{observableKind:"map",debugObjectName:this.name_,type:kh,object:this,oldValue:this.data_.get(e).value_,name:e}:null;if(Er(()=>{var r;this.keysAtom_.reportChanged(),(r=this.hasMap_.get(e))==null||r.setNewValue_(!1),this.data_.get(e).setNewValue_(void 0),this.data_.delete(e)}),n)ui(this,i);return!0}return!1}updateValue_(e,t){let n=this.data_.get(e);if(t=n.prepareNewValue_(t),t!==F.UNCHANGED){let r=ai(this),o=r?{observableKind:"map",debugObjectName:this.name_,type:Co,object:this,oldValue:n.value_,name:e,newValue:t}:null;if(n.setNewValue_(t),r)ui(this,o)}}addValue_(e,t){ji(this.keysAtom_),Er(()=>{var o;let s=new ko(t,this.enhancer_,"ObservableMap.key",!1);this.data_.set(e,s),t=s.value_,(o=this.hasMap_.get(e))==null||o.setNewValue_(!0),this.keysAtom_.reportChanged()});let n=!1,i=ai(this),r=i||n?{observableKind:"map",debugObjectName:this.name_,type:So,object:this,name:e,newValue:t}:null;if(i)ui(this,r)}get(e){if(this.has(e))return this.dehanceValue_(this.data_.get(e).get());return this.dehanceValue_(void 0)}getOrInsert(e,t){if(!this.has(e))this.set(e,t);return this.get(e)}getOrInsertComputed(e,t){if(!this.has(e))this.set(e,t(e));return this.get(e)}dehanceValue_(e){if(this.dehancer!==void 0)return this.dehancer(e);return e}keys(){return this.keysAtom_.reportObserved(),this.data_.keys()}values(){let e=this,t=this.keys();return $C({next(){let{done:n,value:i}=t.next();return{done:n,value:n?void 0:e.get(i)}}})}entries(){let e=this,t=this.keys();return $C({next(){let{done:n,value:i}=t.next();return{done:n,value:n?void 0:[i,e.get(i)]}}})}[Symbol.iterator](){return this.entries()}forEach(e,t){for(let[n,i]of this)e.call(t,i,n,this)}merge(e){if(la(e))e=new Map(e);return Er(()=>{if(Ar(e))x3(e).forEach((t)=>this.set(t,e[t]));else if(Array.isArray(e))e.forEach(([t,n])=>this.set(t,n));else if(uc(e)){if(!y3(e))Ie(19,e);e.forEach((t,n)=>this.set(n,t))}else if(e!==null&&e!==void 0)Ie(20,e)}),this}clear(){Er(()=>{xE(()=>{for(let e of this.keys())this.delete(e)})})}replace(e){return Er(()=>{let t=M5(e),n=new Map,i=!1;for(let r of this.data_.keys())if(!t.has(r))if(this.delete(r))i=!0;else{let s=this.data_.get(r);n.set(r,s)}for(let[r,o]of t.entries()){let s=this.data_.has(r);if(this.set(r,o),this.data_.has(r)){let l=this.data_.get(r);if(n.set(r,l),!s)i=!0}}if(!i)if(this.data_.size!==n.size)this.keysAtom_.reportChanged();else{let r=this.data_.keys(),o=n.keys(),s=r.next(),l=o.next();while(!s.done){if(s.value!==l.value){this.keysAtom_.reportChanged();break}s=r.next(),l=o.next()}}this.data_=n}),this}get size(){return this.keysAtom_.reportObserved(),this.data_.size}toString(){return"[object ObservableMap]"}toJSON(){return Array.from(this)}get[Symbol.toStringTag](){return"Map"}}var la=Rs("ObservableMap",$b);function $C(e){return e[Symbol.toStringTag]="MapIterator",$E(e)}function M5(e){if(uc(e)||la(e))return e;else if(Array.isArray(e))return new Map(e);else if(Ar(e)){let t=new Map;for(let n in e)t.set(n,e[n]);return t}else return Ie(21,e)}var N5={};class Xb{constructor(e,t=Es,n="ObservableSet"){this.name_=void 0,this[oe]=N5,this.data_=new Set,this.atom_=void 0,this.changeListeners_=void 0,this.interceptors_=void 0,this.dehancer=void 0,this.enhancer_=void 0,this.name_=n,this.enhancer_=(i,r)=>t(i,r,n),aa(()=>{if(this.atom_=iE(this.name_),e)this.replace(e)})}dehanceValue_(e){if(this.dehancer!==void 0)return this.dehancer(e);return e}clear(){Er(()=>{xE(()=>{for(let e of this.data_.values())this.delete(e)})})}forEach(e,t){for(let n of this)e.call(t,n,n,this)}get size(){return this.atom_.reportObserved(),this.data_.size}add(e){if(ji(this.atom_),Vn(this)){let t=Un(this,{type:So,object:this,newValue:e});if(!t)return this;e=t.newValue}if(!this.has(e)){Er(()=>{this.data_.add(this.enhancer_(e,void 0)),this.atom_.reportChanged()});let t=!1,n=ai(this),i=n||t?{observableKind:"set",debugObjectName:this.name_,type:So,object:this,newValue:e}:null;if(n)ui(this,i)}return this}delete(e){if(Vn(this)){if(!Un(this,{type:kh,object:this,oldValue:e}))return!1}if(this.has(e)){let n=ai(this),i=n?{observableKind:"set",debugObjectName:this.name_,type:kh,object:this,oldValue:e}:null;if(Er(()=>{this.atom_.reportChanged(),this.data_.delete(e)}),n)ui(this,i);return!0}return!1}has(e){return this.atom_.reportObserved(),this.data_.has(this.dehanceValue_(e))}entries(){let e=this.values();return XC({next(){let{value:t,done:n}=e.next();return!n?{value:[t,t],done:n}:{value:void 0,done:n}}})}keys(){return this.values()}values(){this.atom_.reportObserved();let e=this,t=this.data_.values();return XC({next(){let{value:n,done:i}=t.next();return!i?{value:e.dehanceValue_(n),done:i}:{value:void 0,done:i}}})}intersection(e){return new Set(this).intersection(e)}union(e){return new Set(this).union(e)}difference(e){return new Set(this).difference(e)}symmetricDifference(e){return new Set(this).symmetricDifference(e)}isSubsetOf(e){return new Set(this).isSubsetOf(e)}isSupersetOf(e){return new Set(this).isSupersetOf(e)}isDisjointFrom(e){return new Set(this).isDisjointFrom(e)}replace(e){if(dc(e))e=new Set(e);if(Array.isArray(e)||oc(e))Er(()=>{let t=oc(e)?e:new Set(e);if(t.size===0){this.clear();return}if(this.data_.size===0){t.forEach((n)=>this.add(n));return}for(let n of this.data_.values())if(!t.has(this.dehanceValue_(n)))this.delete(n);t.forEach((n)=>this.add(n))});else if(e!==null&&e!==void 0)Ie(41,e);return this}toJSON(){return Array.from(this)}toString(){return"[object ObservableSet]"}[Symbol.iterator](){return this.values()}get[Symbol.toStringTag](){return"Set"}}var dc=Rs("ObservableSet",Xb);function XC(e){return e[Symbol.toStringTag]="SetIterator",$E(e)}var GC=Object.create(null),YC="remove";class Gb{constructor(e,t=new Map,n,i=B3){this.target_=void 0,this.values_=void 0,this.name_=void 0,this.defaultAnnotation_=void 0,this.keysAtom_=void 0,this.changeListeners_=void 0,this.interceptors_=void 0,this.proxy_=void 0,this.isPlainObject_=void 0,this.appliedAnnotations_=void 0,this.pendingKeys_=void 0,this.lazyComputedKeys_=void 0,this.lazyObservableKeys_=void 0,this.target_=e,this.values_=t,this.name_=n,this.defaultAnnotation_=i,this.keysAtom_=new ra("ObservableObject.keys"),this.isPlainObject_=Ar(this.target_)}getObservablePropValue_(e){var t,n;return((t=(n=this.values_.get(e))!=null?n:this.materializeLazyComputed_(e))!=null?t:this.materializeLazyObservable_(e)).get()}materializeLazyComputed_(e){var t;let n=(t=this.lazyComputedKeys_)==null?void 0:t.get(e);if(!n)return;if(this.lazyComputedKeys_.delete(e),this.lazyComputedKeys_.size===0)this.lazyComputedKeys_=void 0;let i=n();return this.values_.set(e,i),i}materializeLazyObservable_(e){var t;let n=(t=this.lazyObservableKeys_)==null?void 0:t.get(e);if(!n)return;if(this.lazyObservableKeys_.delete(e),this.lazyObservableKeys_.size===0)this.lazyObservableKeys_=void 0;let i=n();return this.values_.set(e,i),i}setObservablePropValue_(e,t){var n,i;let r=(n=(i=this.values_.get(e))!=null?i:this.materializeLazyComputed_(e))!=null?n:this.materializeLazyObservable_(e);if(r instanceof Rr)return r.set(t),!0;if(Vn(this)){let o=Un(this,{type:Co,object:this.proxy_||this.target_,name:e,newValue:t});if(!o)return null;t=o.newValue}if(t=r.prepareNewValue_(t),t!==F.UNCHANGED){let o=ai(this),s=!1,l=o?{type:Co,observableKind:"object",debugObjectName:this.name_,object:this.proxy_||this.target_,oldValue:r.value_,name:e,newValue:t}:null;if(r.setNewValue_(t),o)ui(this,l)}return!0}get_(e){if(F.trackingDerivation&&!Cs(this.target_,e))this.has_(e);return this.target_[e]}set_(e,t,n=!1){if(Cs(this.target_,e))if(this.values_.has(e))return this.setObservablePropValue_(e,t);else if(n)return Reflect.set(this.target_,e,t);else return this.target_[e]=t,!0;else return this.extend_(e,{value:t,enumerable:!0,writable:!0,configurable:!0},this.defaultAnnotation_,n)}has_(e){if(!F.trackingDerivation)return e in this.target_;this.pendingKeys_||(this.pendingKeys_=new Map);let t=this.pendingKeys_.get(e);if(!t)t=new ko(e in this.target_,Oh,"ObservableObject.key?",!1),this.pendingKeys_.set(e,t);return t.get()}extend_(e,t,n,i=!1){if(n===!0)n=this.defaultAnnotation_;if(n===!1)return this.defineProperty_(e,t,i);FE(this,n,e);let r=n.extend_(this,e,t,i);if(r)jE(this,n,e);return r}defineProperty_(e,t,n=!1){ji(this.keysAtom_);try{Kn();let i=this.delete_(e);if(!i)return i;if(Vn(this)){let r=Un(this,{object:this.proxy_||this.target_,name:e,type:So,newValue:t.value});if(!r)return null;let{newValue:o}=r;if(t.value!==o)t=Fi({},t,{value:o})}if(n){if(!Reflect.defineProperty(this.target_,e,t))return!1}else Or(this.target_,e,t);this.notifyPropertyAddition_(e,t.value)}finally{jn()}return!0}defineObservableProperty_(e,t,n,i=!1){ji(this.keysAtom_);try{Kn();let r=this.delete_(e);if(!r)return r;if(Vn(this)){let a=Un(this,{object:this.proxy_||this.target_,name:e,type:So,newValue:t});if(!a)return null;t=a.newValue}let o=WC(e),s={configurable:F.safeDescriptors?this.isPlainObject_:!0,enumerable:!0,get:o.get,set:o.set};if(i){if(!Reflect.defineProperty(this.target_,e,s))return!1}else Or(this.target_,e,s);let l=new ko(t,n,"ObservableObject.key",!1);this.values_.set(e,l),this.notifyPropertyAddition_(e,l.value_)}finally{jn()}return!0}defineComputedProperty_(e,t,n=!1){ji(this.keysAtom_);try{Kn();let i=this.delete_(e);if(!i)return i;if(Vn(this)){if(!Un(this,{object:this.proxy_||this.target_,name:e,type:So,newValue:void 0}))return null}t.name||(t.name="ObservableObject.key"),t.context=this.proxy_||this.target_;let r=WC(e),o={configurable:F.safeDescriptors?this.isPlainObject_:!0,enumerable:!1,get:r.get,set:r.set};if(n){if(!Reflect.defineProperty(this.target_,e,o))return!1}else Or(this.target_,e,o);this.values_.set(e,new Rr(t)),this.notifyPropertyAddition_(e,void 0)}finally{jn()}return!0}delete_(e,t=!1){if(ji(this.keysAtom_),!Cs(this.target_,e))return!0;if(Vn(this)){if(!Un(this,{object:this.proxy_||this.target_,name:e,type:YC}))return null}try{var n;Kn();let r=ai(this),o=!1,s=this.values_.get(e),l=void 0;if(!s&&(r||o)){var i;l=(i=Ib(this.target_,e))==null?void 0:i.value}if(t){if(!Reflect.deleteProperty(this.target_,e))return!1}else delete this.target_[e];if(s){if(this.values_.delete(e),s instanceof ko)l=s.value_;OE(s)}if(this.keysAtom_.reportChanged(),(n=this.pendingKeys_)==null||(n=n.get(e))==null||n.set(e in this.target_),r||o){let a={type:YC,observableKind:"object",object:this.proxy_||this.target_,debugObjectName:this.name_,oldValue:l,name:e};if(r)ui(this,a)}}finally{jn()}return!0}notifyPropertyAddition_(e,t){var n;let i=ai(this),r=!1;if(i){let o=i?{type:So,observableKind:"object",debugObjectName:this.name_,object:this.proxy_||this.target_,name:e,newValue:t}:null;if(i)ui(this,o)}(n=this.pendingKeys_)==null||(n=n.get(e))==null||n.set(!0),this.keysAtom_.reportChanged()}ownKeys_(){return this.keysAtom_.reportObserved(),xh(this.target_)}keys_(){return this.keysAtom_.reportObserved(),Object.keys(this.target_)}}function hc(e,t){var n;if(Cs(e,oe))return e;let i=(n=t==null?void 0:t.name)!=null?n:"ObservableObject",r=new Gb(e,new Map,String(i),F3(t));return tE(e,oe,r),e}var D5=Rs("ObservableObjectAdministration",Gb);function WC(e){return GC[e]||(GC[e]={get(){return this[oe].getObservablePropValue_(e)},set(t){return this[oe].setObservablePropValue_(e,t)}})}function ac(e){if(Eh(e))return D5(e[oe]);return!1}function jE(e,t,n){}function FE(e,t,n){}function _h(e,t){if(typeof e==="object"&&e!==null){if(KE(e)){if(t!==void 0)Ie(23);return e[oe].atom_}if(dc(e))return e.atom_;if(la(e)){if(t===void 0)return e.keysAtom_;let r=e.data_.get(t)||e.hasMap_.get(t);if(!r)Ie(25,t,QC(e));return r}if(ac(e)){var n,i;if(!t)return Ie(26);let r=e[oe],o=(n=(i=r.values_.get(t))!=null?i:r.materializeLazyComputed_(t))!=null?n:r.materializeLazyObservable_(t);if(!o)Ie(27,t,QC(e));return o}if(Hb(e)||Th(e)||Sh(e))return e}else if(na(e)){if(Sh(e[oe]))return e[oe]}Ie(28)}function qE(e,t){if(!e)Ie(29);if(t!==void 0)return qE(_h(e,t));if(Hb(e)||Th(e)||Sh(e))return e;if(la(e)||dc(e))return e;if(e[oe])return e[oe];Ie(24,e)}function QC(e,t){let n;if(t!==void 0)n=_h(e,t);else if(ia(e))return e.name;else if(ac(e)||la(e)||dc(e))n=qE(e);else n=_h(e);return n.name_}function aa(e){let t=sa(),n=!0;Kn();try{return e()}finally{jn(),_o(t)}}var q9=Ch.toString;var JC,L5=((JC=globalThis.Iterator)==null?void 0:JC.prototype)||{};function $E(e){return e[Symbol.iterator]=z5,Fi(Object.create(L5),e)}function z5(){return this}var XE;if(!W||!$r)throw Error("mobx-react-lite requires React 18 or later");if(!((jb==null||(XE=jb())==null?void 0:XE.version)>=7))throw Error("mobx-react-lite requires mobx at least version 7 to be available");var B5=1e4,P5=1e4;class Yb{constructor(e){this.finalize=void 0,this.registrations=new Map,this.sweepTimeout=void 0,this.sweep=(t=B5)=>{clearTimeout(this.sweepTimeout),this.sweepTimeout=void 0;let n=Date.now();if(this.registrations.forEach((i,r)=>{if(n-i.registeredAt>=t)this.registrations.delete(r),this.finalize(i.value)}),this.registrations.size>0)this.scheduleSweep()},this.finalizeAllImmediately=()=>{this.sweep(0)},this.finalize=e}register(e,t,n){this.registrations.set(n,{value:t,registeredAt:Date.now()}),this.scheduleSweep()}unregister(e){if(this.registrations.delete(e),this.registrations.size===0)clearTimeout(this.sweepTimeout),this.sweepTimeout=void 0}scheduleSweep(){if(this.sweepTimeout===void 0)this.sweepTimeout=setTimeout(this.sweep,P5)}}class JE{constructor(e){this.finalize=void 0,this.finalizeRegistration=(t)=>{var n;(n=this.native)==null||n.unregister(t.token),this.timer.unregister(t.token),this.finalize(t.value)},this.tokens=new WeakMap,this.staged=new Map,this.flushScheduled=!1,this.native=typeof FinalizationRegistry<"u"?new FinalizationRegistry(this.finalizeRegistration):void 0,this.timer=new Yb(this.finalizeRegistration),this.finalizeAllImmediately=()=>{this.flushRegistrations(),this.timer.finalizeAllImmediately()},this.flushRegistrations=()=>{this.flushScheduled=!1,this.staged.forEach(({target:t,value:n},i)=>{var r;let o={value:n,token:{}};this.tokens.set(i,o.token),(r=this.native)==null||r.register(t,o,o.token),this.timer.register(t,o,o.token)}),this.staged.clear()},this.finalize=e}register(e,t,n=e){if(this.unregister(n),this.staged.set(n,{target:e,value:t}),!this.flushScheduled)this.flushScheduled=!0,Promise.resolve().then(this.flushRegistrations)}unregister(e){if(this.staged.delete(e))return;let t=this.tokens.get(e);if(t){var n;this.tokens.delete(e),(n=this.native)==null||n.unregister(t),this.timer.unregister(t)}}}var I5=typeof FinalizationRegistry<"u"?JE:Yb,Wb=new I5((e)=>{let t=e.reaction;e.reaction=null,t==null||t.dispose()}),H5=!1;function ZE(){return H5}function eO(e){e.reaction=new fc(`observer${e.name}`,()=>{e.stateVersion=Symbol(),e.onStoreChange==null||e.onStoreChange()})}function V5(e){let t={reaction:null,onStoreChange:null,stateVersion:Symbol(),name:e,subscribe(n){if(Wb.unregister(t),t.onStoreChange=n,!t.reaction)eO(t),t.stateVersion=Symbol();return()=>{var i;t.onStoreChange=null,(i=t.reaction)==null||i.dispose(),t.reaction=null}},getSnapshot(){return t.stateVersion}};return t}function tO(e,t="observed"){if(ZE())return e();let n=X(null);if(!n.current)n.current=V5(t);let i=n.current;if(!i.reaction)eO(i),Wb.register(n,i,i);zm(i.reaction,PE),$r(i.subscribe,i.getSnapshot,i.getSnapshot);let r,o;if(i.reaction.track(()=>{try{r=e()}catch(s){o=s}}),o)throw o;return r}var GE,YE,nO=typeof Symbol==="function"&&Symbol.for,U5=(GE=(YE=Object.getOwnPropertyDescriptor(()=>{},"name"))==null?void 0:YE.configurable)!=null?GE:!1,WE=nO?Symbol.for("react.forward_ref"):typeof Fr==="function"&&Fr((e)=>null).$$typeof,QE=nO?Symbol.for("react.memo"):typeof ol==="function"&&ol((e)=>null).$$typeof;function q(e){if(QE&&e.$$typeof===QE)throw Error("[mobx-react-lite] You are trying to use `observer` on a function component wrapped in either another `observer` or `React.memo`. The observer already applies 'React.memo' for you.");if(ZE())return e;let t=!1,n=e,i=e.displayName||e.name;if(WE&&e.$$typeof===WE){if(t=!0,n=e.render,typeof n!=="function")throw Error("[mobx-react-lite] `render` property of ForwardRef was not a function")}let r=(o,s)=>tO(()=>n(o,s),i);if(r.displayName=e.displayName,U5)Object.defineProperty(r,"name",{value:e.name,writable:!0,configurable:!0});if(t)r=Fr(r);return r=ol(r),j5(e,r),r}var K5={$$typeof:!0,render:!0,compare:!0,type:!0,displayName:!0};function j5(e,t){Object.keys(e).forEach((n)=>{if(!K5[n])Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(e,n))})}function F5({children:e,render:t}){if(e&&t)console.error("MobX Observer: Do not use children and render in the same time in `Observer`");let n=e||t;if(typeof n!=="function")return null;return tO(n)}F5.displayName="Observer";function ua(e,t){return W(()=>Dt(e(),t,{autoBind:!0}))[0]}var Y9=Wb.finalizeAllImmediately;var q5=Symbol.for("react.transitional.element"),$5=Symbol.for("react.fragment");function iO(e,t,n){var i=null;if(n!==void 0&&(i=""+n),t.key!==void 0&&(i=""+t.key),"key"in t){n={};for(var r in t)r!=="key"&&(n[r]=t[r])}else n=t;return t=n.ref,{$$typeof:q5,type:e,key:i,ref:t!==void 0?t:null,props:n}}var te=$5,p=iO,y=iO;function X5(e,t){let n=getComputedStyle(e),i=parseFloat(n.fontSize);return t*i}function G5(e,t){let n=getComputedStyle(e.ownerDocument.documentElement),i=parseFloat(n.fontSize);return t*i}function Y5(e){return e/100*window.innerHeight}function W5(e){return e/100*window.innerWidth}function Q5(e){switch(typeof e){case"number":return[e,"px"];case"string":{let t=parseFloat(e);return e.endsWith("%")?[t,"%"]:e.endsWith("px")?[t,"px"]:e.endsWith("rem")?[t,"rem"]:e.endsWith("em")?[t,"em"]:e.endsWith("vh")?[t,"vh"]:e.endsWith("vw")?[t,"vw"]:[t,"%"]}}}function fa({groupSize:e,panelElement:t,styleProp:n}){let i,[r,o]=Q5(n);switch(o){case"%":{i=r/100*e;break}case"px":{i=r;break}case"rem":{i=G5(t,r);break}case"em":{i=X5(t,r);break}case"vh":{i=Y5(r);break}case"vw":{i=W5(r);break}}return i}function Pt(e){return parseFloat(e.toFixed(3))}function ha({group:e}){let{orientation:t,panels:n}=e;return n.reduce((i,r)=>(i+=t==="horizontal"?r.element.offsetWidth:r.element.offsetHeight,i),0)}function Jb(e){let{panels:t}=e,n=ha({group:e});return n===0?t.map((i)=>({groupResizeBehavior:i.panelConstraints.groupResizeBehavior,collapsedSize:0,collapsible:i.panelConstraints.collapsible===!0,defaultSize:void 0,disabled:i.panelConstraints.disabled,minSize:0,maxSize:100,panelId:i.id})):t.map((i)=>{let{element:r,panelConstraints:o}=i,s=0;if(o.collapsedSize!==void 0){let f=fa({groupSize:n,panelElement:r,styleProp:o.collapsedSize});s=Pt(f/n*100)}let l;if(o.collapsedThreshold!==void 0){let f=fa({groupSize:n,panelElement:r,styleProp:o.collapsedThreshold});l=Pt(f/n*100)}let a;if(o.defaultSize!==void 0){let f=fa({groupSize:n,panelElement:r,styleProp:o.defaultSize});a=Pt(f/n*100)}let u=0;if(o.minSize!==void 0){let f=fa({groupSize:n,panelElement:r,styleProp:o.minSize});u=Pt(f/n*100)}let c=100;if(o.maxSize!==void 0){let f=fa({groupSize:n,panelElement:r,styleProp:o.maxSize});c=Pt(f/n*100)}return{groupResizeBehavior:o.groupResizeBehavior,collapsedSize:s,collapsedThreshold:l,collapsible:o.collapsible===!0,defaultSize:a,disabled:o.disabled,minSize:u,maxSize:c,panelId:i.id}})}class ty{#e={};addListener(e,t){let n=this.#e[e];return n===void 0?this.#e[e]=[t]:n.includes(t)||n.push(t),()=>{this.removeListener(e,t)}}emit(e,t){let n=this.#e[e];if(n!==void 0)if(n.length===1)n[0].call(null,t);else{let i=!1,r=null,o=Array.from(n);for(let s=0;s<o.length;s++){let l=o[s];try{l.call(null,t)}catch(a){r===null&&(i=!0,r=a)}}if(i)throw r}}removeAllListeners(){this.#e={}}removeListener(e,t){let n=this.#e[e];if(n!==void 0){let i=n.indexOf(t);i>=0&&n.splice(i,1)}}}var nt={cursorFlags:0,state:"inactive"},ny=new ty;function Mr(){return nt}function xO(e){return ny.addListener("change",e)}function J5(e,t=[],n,i=!1){let r=nt,o={...nt};o.cursorFlags=e,o.state==="active"&&(o.didPointerMove||=i,o.previews=t,n&&(o.previewLayoutMap=n)),nt=o,ny.emit("change",{prev:r,next:o})}function Xi(e){let t=nt;nt=e,t.state==="active"&&e.state!=="active"&&t.didPointerMove&&t.hitRegions.forEach(({separator:n})=>{n&&n.element.ownerDocument.activeElement===n.element&&n.element.blur()}),ny.emit("change",{prev:t,next:e})}function Z5(e){nt.state!=="active"||!nt.previews.some((t)=>t.separator===e)||Xi({...nt,previews:nt.previews.map((t)=>t.separator===e?{...t}:t)})}function eP(e){if(nt.state==="inactive")return!1;let t=nt.hitRegions.filter((i)=>i.group!==e),n=nt.state==="active"&&nt.previews.some((i)=>i.group===e);if(t.length===nt.hitRegions.length&&!n)return!1;if(t.length===0)Xi({cursorFlags:0,state:"inactive"});else if(nt.state==="active"){let i=new Map(nt.initialLayoutMap),r=new Map(nt.previewLayoutMap);i.delete(e),r.delete(e),Xi({...nt,cursorFlags:0,hitRegions:t,initialLayoutMap:i,previewLayoutMap:r,previews:nt.previews.filter((o)=>o.group!==e)})}else Xi({...nt,hitRegions:t});return!0}var tP=(e)=>e,Qb=()=>{},wO=1,SO=2,kO=4,_O=8,rO=3,oO=12,Nh;function sO(){return Nh===void 0&&(Nh=!1,typeof window<"u"&&(window.navigator.userAgent.includes("Chrome")||window.navigator.userAgent.includes("Firefox"))&&(Nh=!0)),Nh}function nP({cursorFlags:e,groups:t,state:n}){let i=0,r=0;switch(n){case"active":case"hover":t.forEach((o)=>{if(!o.mutableState.disableCursor)switch(o.orientation){case"horizontal":{i++;break}case"vertical":{r++;break}}})}if(!(i===0&&r===0)){switch(n){case"active":{if(e&&sO()){let o=(e&wO)!==0,s=(e&SO)!==0,l=(e&kO)!==0,a=(e&_O)!==0;if(o)return l?"se-resize":a?"ne-resize":"e-resize";if(s)return l?"sw-resize":a?"nw-resize":"w-resize";if(l)return"s-resize";if(a)return"n-resize"}break}}return sO()?i>0&&r>0?"move":i>0?"ew-resize":"ns-resize":i>0&&r>0?"grab":i>0?"col-resize":"row-resize"}}var lO=new WeakMap;function mc(e){if(!e.defaultView||!e.adoptedStyleSheets)return;let{prevStyle:t,styleSheet:n}=lO.get(e)??{};n===void 0&&(n=new e.defaultView.CSSStyleSheet,e.adoptedStyleSheets&&(Object.isExtensible(e.adoptedStyleSheets)?e.adoptedStyleSheets.push(n):e.adoptedStyleSheets=[...e.adoptedStyleSheets,n]));let i=Mr();switch(i.state){case"active":case"hover":{let r=nP({cursorFlags:i.cursorFlags,groups:i.hitRegions.map((s)=>s.group),state:i.state}),o=`*, *:hover {cursor: ${r} !important; }`;if(t===o)return;t=o,r?n.cssRules.length===0?n.insertRule(o):n.replaceSync(o):n.cssRules.length===1&&n.deleteRule(0);break}case"inactive":{t=void 0,n.cssRules.length===1&&n.deleteRule(0);break}}lO.set(e,{prevStyle:t,styleSheet:n})}function Re(e,t="Assertion error"){if(!e)throw Error(t)}function Zb(e,t){return Array.from(t).sort((n,i)=>{let r=e==="horizontal"?iP(n,i):rP(n,i);if(r!==0)return r;let o=n.element.compareDocumentPosition(i.element);return o&Node.DOCUMENT_POSITION_DISCONNECTED?0:o&Node.DOCUMENT_POSITION_FOLLOWING?-1:o&Node.DOCUMENT_POSITION_PRECEDING?1:0})}function iP(e,t){let n=e.element.offsetLeft-t.element.offsetLeft;return n!==0?n:e.element.offsetWidth-t.element.offsetWidth}function rP(e,t){let n=e.element.offsetTop-t.element.offsetTop;return n!==0?n:e.element.offsetHeight-t.element.offsetHeight}function ey(e){return e!==null&&typeof e=="object"&&"nodeType"in e&&e.nodeType===Node.ELEMENT_NODE}function CO(e,t){return{x:e.x>=t.left&&e.x<=t.right?0:Math.min(Math.abs(e.x-t.left),Math.abs(e.x-t.right)),y:e.y>=t.top&&e.y<=t.bottom?0:Math.min(Math.abs(e.y-t.top),Math.abs(e.y-t.bottom))}}function oP({orientation:e,rects:t,targetRect:n}){let i={x:n.x+n.width/2,y:n.y+n.height/2},r,o=Number.MAX_VALUE;for(let s of t){let{x:l,y:a}=CO(i,s),u=e==="horizontal"?l:a;u<o&&(o=u,r=s)}return Re(r,"No rect found"),r}var Dh;function sP(){return Dh===void 0&&(typeof matchMedia=="function"?Dh=!!matchMedia("(pointer:coarse)").matches:Dh=!1),Dh}function iy({expandHitTargets:e=!0,group:t,includeDisabled:n=!1}){let{element:i,orientation:r,panels:o,separators:s}=t,l=Zb(r,Array.from(i.children).filter(ey).filter((g)=>!g.hasAttribute("data-resize-preview")).map((g)=>({element:g}))).map(({element:g})=>g),a=[],u=!1,c=!1,f=-1,d,h=-1,m=0,b,x=[];{let g=-1;for(let v of l)v.hasAttribute("data-panel")&&(g++,v.hasAttribute("data-disabled")||(m++,f===-1&&(f=g),h=g))}if(n||m>1){let g=-1;for(let v of l)if(v.hasAttribute("data-panel")){g++;let w=o.find((S)=>S.element===v);if(w){if(b){let S=b.element.getBoundingClientRect(),k=v.getBoundingClientRect(),E;if(c){let _=r==="horizontal"?new DOMRect(S.right,S.top,0,S.height):new DOMRect(S.left,S.bottom,S.width,0),O=r==="horizontal"?new DOMRect(k.left,k.top,0,k.height):new DOMRect(k.left,k.top,k.width,0);switch(x.length){case 0:{E=[_,O];break}case 1:{let B=x[0],M=oP({orientation:r,rects:[S,k],targetRect:B.element.getBoundingClientRect()});E=[B,M===S?O:_];break}default:{E=x;break}}}else x.length?E=x:E=[r==="horizontal"?new DOMRect(S.right,k.top,k.left-S.right,k.height):new DOMRect(k.left,S.bottom,k.width,k.top-S.bottom)];for(let _ of E){let O="width"in _?_:_.element.getBoundingClientRect(),B=e?sP()?t.resizeTargetMinimumSize.coarse:t.resizeTargetMinimumSize.fine:0;if(O.width<B){let I=B-O.width;O=new DOMRect(O.x-I/2,O.y,O.width+I,O.height)}if(O.height<B){let I=B-O.height;O=new DOMRect(O.x,O.y-I/2,O.width,O.height+I)}let M=g<=f||g>h;(n||!u&&!M)&&(d??=ha({group:t}),a.push({group:t,groupSize:d,panels:[b,w],separator:"width"in _?void 0:_,rect:O})),u=!1}}c=!1,b=w,x=[]}}else if(v.hasAttribute("data-separator")){v.ariaDisabled!==null&&(u=!0);let w=s.find((S)=>S.element===v);w?x.push(w):(b=void 0,x=[])}else c=!0}return a}var $i=new Map,EO=new ty;function lP(e){$i=new Map($i),$i.delete(e)}function OO(e,t){for(let[n]of $i)if(n.id===e)return n}function Eo(e,t){for(let[n,i]of $i)if(n.id===e)return i;if(t)throw Error(`Could not find data for Group with id ${e}`)}function Oo(){return $i}function ry(e,t){return EO.addListener("groupChange",(n)=>{n.group.id===e&&t(n)})}function Yi(e,t,n){let i=$i.get(e);$i=new Map($i),$i.set(e,t),EO.emit("groupChange",{group:e,isUserInteraction:n?.isUserInteraction===!0,prev:i,next:t})}function aP(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!=t[n])return!1;return!0}function yt(e,t,n=0){return Math.abs(Pt(e)-Pt(t))<=n}function qi(e,t){return yt(e,t)?0:e>t?1:-1}function da({overrideDisabledPanels:e,panelConstraints:t,prevSize:n,size:i}){let{collapsedSize:r=0,collapsedThreshold:o,collapsible:s,disabled:l,maxSize:a=100,minSize:u=0}=t;if(l&&!e)return n;if(qi(i,u)<0)if(s){let c=o??(u-r)/2,f=qi(n,r)<=0,d=f?r+c:u-c,h=qi(i,d);qi(i,r)<=0||h<0||o!==void 0&&f&&h===0?i=r:i=u}else i=u;return i=Math.min(a,i),i=Pt(i),i}function gc({delta:e,initialLayout:t,panelConstraints:n,pivotIndices:i,prevLayout:r,trigger:o}){if(yt(e,0))return t;let s=o==="imperative-api",l=n.map(({panelId:m})=>t[m]),a=n.map(({panelId:m})=>r[m]),u=[...l],[c,f]=i;Re(c!=null,"Invalid first pivot index"),Re(f!=null,"Invalid second pivot index");let d=0;switch(o){case"keyboard":{{let m=e<0?f:c,b=n[m];Re(b,`Panel constraints not found for index ${m}`);let{collapsedSize:x=0,collapsible:g,minSize:v=0}=b;if(g){let w=l[m];if(Re(w!=null,`Previous layout not found for panel index ${m}`),yt(w,x)){let S=v-w;qi(S,Math.abs(e))>0&&(e=e<0?0-S:S)}}}{let m=e<0?c:f,b=n[m];Re(b,`No panel constraints found for index ${m}`);let{collapsedSize:x=0,collapsible:g,minSize:v=0}=b;if(g){let w=l[m];if(Re(w!=null,`Previous layout not found for panel index ${m}`),yt(w,v)){let S=w-x;qi(S,Math.abs(e))>0&&(e=e<0?0-S:S)}}}break}default:{let m=e<0?f:c,b=n[m];Re(b,`Panel constraints not found for index ${m}`);let x=l[m],{collapsedSize:g,collapsedThreshold:v,collapsible:w,minSize:S}=b;if(w&&qi(x,S)<0){let k=S-g,E=v??k/2,_=x+Math.abs(e);if(qi(_,S)<0){let O=qi(Math.abs(e),E),B=v===void 0&&e<0;O>0||O===0&&B?e=e<0?-k:k:e=0}}break}}{let m=e<0?1:-1,b=e<0?f:c,x=0;for(;;){let v=l[b];Re(v!=null,`Previous layout not found for panel index ${b}`);let w=da({overrideDisabledPanels:s,panelConstraints:n[b],prevSize:v,size:100})-v;if(x+=w,b+=m,b<0||b>=n.length)break}let g=Math.min(Math.abs(e),Math.abs(x));e=e<0?0-g:g}{let m=e<0?c:f;for(;m>=0&&m<n.length;){let b=Math.abs(e)-Math.abs(d),x=l[m];Re(x!=null,`Previous layout not found for panel index ${m}`);let g=x-b,v=da({overrideDisabledPanels:s,panelConstraints:n[m],prevSize:x,size:g});if(!yt(x,v)&&(d+=x-v,u[m]=v,d.toFixed(3).localeCompare(Math.abs(e).toFixed(3),void 0,{numeric:!0})>=0))break;e<0?m--:m++}}if(aP(a,u))return r;{let m=e<0?f:c,b=l[m];Re(b!=null,`Previous layout not found for panel index ${m}`);let x=b+d,g=da({overrideDisabledPanels:s,panelConstraints:n[m],prevSize:b,size:x});if(u[m]=g,!yt(g,x)){let v=x-g,w=e<0?f:c;for(;w>=0&&w<n.length;){let S=u[w];Re(S!=null,`Previous layout not found for panel index ${w}`);let k=S+v,E=da({overrideDisabledPanels:s,panelConstraints:n[w],prevSize:S,size:k});if(yt(S,E)||(v-=E-S,u[w]=E),yt(v,0))break;e>0?w--:w++}}}let h=Object.values(u).reduce((m,b)=>b+m,0);return yt(h,100,0.1)?u.reduce((m,b,x)=>(m[n[x].panelId]=b,m),{}):r}function Gi(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(t[n]===void 0||qi(e[n],t[n])!==0)return!1;return!0}function oy({commit:e,document:t,event:n,hitRegions:i,initialLayoutMap:r,mountedGroups:o,pointerDownAtPoint:s,prevCursorFlags:l}){let a=0,u=Mr(),c=u.state==="active"?u.previews:[],f=new Map(u.state==="active"?u.previewLayoutMap:void 0);i.forEach((m)=>{let{group:b,groupSize:x}=m,{orientation:g,panels:v}=b;if(e&&b.resizePreviewMode!=="separator")return;let{disableCursor:w}=b.mutableState,S=0;s?g==="horizontal"?S=(n.clientX-s.x)/x*100:S=(n.clientY-s.y)/x*100:g==="horizontal"?S=n.clientX<0?-100:100:S=n.clientY<0?-100:100;let k=r.get(b),E=o.get(b);if(!k||!E)return;let{defaultLayoutDeferred:_,derivedPanelConstraints:O,groupSize:B,layout:M,separatorToPanels:I}=E;if(O&&M&&I){let H=b.resizePreviewMode==="separator"?f.get(b)??M:M,Y=gc({delta:S,initialLayout:k,panelConstraints:O,pivotIndices:m.panels.map((D)=>v.indexOf(D)),prevLayout:H,trigger:"mouse-or-touch"});if(b.resizePreviewMode==="separator"&&!e&&!Gi(Y,H)){f.set(b,Y);let D=0,L=v.map((V)=>(D+=Y[V.id]-k[V.id],D*(x/100)));c=c.map((V)=>{if(V.group!==b)return V;let G=L[V.panelIndex];return G===V.offset?V:{...V,offset:G}})}if(Gi(Y,H)&&S!==0&&!w)switch(g){case"horizontal":{a|=S<0?wO:SO;break}case"vertical":{a|=S<0?kO:_O;break}}(b.resizePreviewMode!=="separator"||e)&&!Gi(Y,M)&&Yi(m.group,{defaultLayoutDeferred:_,derivedPanelConstraints:O,groupSize:B,layout:Y,separatorToPanels:I})}});let d=0;n.movementX===0?d|=l&rO:d|=a&rO,n.movementY===0?d|=l&oO:d|=a&oO;let h=u.state==="active"&&(n.clientX!==u.pointerDownAtPoint.x||n.clientY!==u.pointerDownAtPoint.y);J5(d,c,f,h),mc(t)}function RO(e,t){let n=Mr(),i=Oo(),r=!1;switch(n.state){case"active":oy({commit:!0,document:e,event:t,hitRegions:n.hitRegions,initialLayoutMap:n.initialLayoutMap,mountedGroups:i,pointerDownAtPoint:n.pointerDownAtPoint,prevCursorFlags:n.cursorFlags}),Xi({cursorFlags:0,state:"inactive"}),n.hitRegions.length>0&&(mc(e),r=!0,n.hitRegions.forEach((o)=>{if(!i.has(o.group))return;let s=Eo(o.group.id,!0);Yi(o.group,s,{isUserInteraction:!0})}))}return r}function aO(e){e.defaultPrevented||RO(e.currentTarget,e)}function uP(e,t,n){let i,r={x:1/0,y:1/0};for(let o of t){let s=CO(n,o.rect);switch(e){case"horizontal":{s.x<=r.x&&(i=o,r=s);break}case"vertical":{s.y<=r.y&&(i=o,r=s);break}}}return i?{distance:r,hitRegion:i}:void 0}function cP(e){return e!==null&&typeof e=="object"&&"nodeType"in e&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE}function fP(e,t){if(e===t)throw Error("Cannot compare node with itself");let n={a:fO(e),b:fO(t)},i;for(;n.a.at(-1)===n.b.at(-1);)i=n.a.pop(),n.b.pop();Re(i,"Stacking order can only be calculated for elements with a common ancestor");let r={a:cO(uO(n.a)),b:cO(uO(n.b))};if(r.a===r.b){let o=i.childNodes,s={a:n.a.at(-1),b:n.b.at(-1)},l=o.length;for(;l--;){let a=o[l];if(a===s.a)return 1;if(a===s.b)return-1}}return Math.sign(r.a-r.b)}var dP=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function hP(e){let t=getComputedStyle(AO(e)??e).display;return t==="flex"||t==="inline-flex"}function pP(e){let t=getComputedStyle(e);return!!(t.position==="fixed"||t.zIndex!=="auto"&&(t.position!=="static"||hP(e))||+t.opacity<1||("transform"in t)&&t.transform!=="none"||("webkitTransform"in t)&&t.webkitTransform!=="none"||("mixBlendMode"in t)&&t.mixBlendMode!=="normal"||("filter"in t)&&t.filter!=="none"||("webkitFilter"in t)&&t.webkitFilter!=="none"||("isolation"in t)&&t.isolation==="isolate"||dP.test(t.willChange)||t.webkitOverflowScrolling==="touch")}function uO(e){let t=e.length;for(;t--;){let n=e[t];if(Re(n,"Missing node"),pP(n))return n}return null}function cO(e){return e&&Number(getComputedStyle(e).zIndex)||0}function fO(e){let t=[];for(;e;)t.push(e),e=AO(e);return t}function AO(e){let{parentNode:t}=e;return cP(t)?t.host:t}function mP(e,t){return e.x<t.x+t.width&&e.x+e.width>t.x&&e.y<t.y+t.height&&e.y+e.height>t.y}function gP(e){try{return e.matches(":modal")}catch{return!1}}function vP({groupElement:e,hitRegion:t,pointerEventTarget:n}){if(ey(n)){let i=n.closest("dialog");if(i&&!i.contains(e)&&gP(i))return!1}if(!ey(n)||n.contains(e)||e.contains(n))return!0;if(fP(n,e)>0){let i=n;for(;i;){if(i.contains(e))return!0;if(mP(i.getBoundingClientRect(),t))return!1;i=i.parentElement}}return!0}function sy(e,t){let n=[];return t.forEach((i,r)=>{if(r.disabled)return;let o=iy({group:r}),s=uP(r.orientation,o,{x:e.clientX,y:e.clientY});s&&s.distance.x<=0&&s.distance.y<=0&&vP({groupElement:r.element,hitRegion:s.hitRegion.rect,pointerEventTarget:e.target})&&n.push(s.hitRegion)}),n}function Ts({layout:e,panelConstraints:t}){let n=t.map(({panelId:s})=>e[s]),i=[...n],r=i.reduce((s,l)=>s+l,0);if(Object.keys(e).length!==t.length)throw Error(`Invalid ${t.length} panel layout: ${Object.values(e).map((s)=>`${s}%`).join(", ")}`);if(!yt(r,100)&&i.length>0)for(let s=0;s<t.length;s++){let l=i[s];Re(l!=null,`No layout data found for index ${s}`);let a=100/r*l;i[s]=a}let o=0;for(let s=0;s<t.length;s++){let l=n[s];Re(l!=null,`No layout data found for index ${s}`);let a=i[s];Re(a!=null,`No layout data found for index ${s}`);let u=da({overrideDisabledPanels:!0,panelConstraints:t[s],prevSize:l,size:a});a!=u&&(o+=a-u,i[s]=u)}if(!yt(o,0))for(let s=0;s<t.length;s++){let l=i[s];Re(l!=null,`No layout data found for index ${s}`);let a=l+o,u=da({overrideDisabledPanels:!0,panelConstraints:t[s],prevSize:l,size:a});if(l!==u&&(o-=u-l,i[s]=u,yt(o,0)))break}return i.reduce((s,l,a)=>(s[t[a].panelId]=l,s),{})}function TO({groupId:e,panelId:t}){let n=()=>{let a=Oo();for(let[u,{defaultLayoutDeferred:c,derivedPanelConstraints:f,layout:d,groupSize:h,separatorToPanels:m}]of a)if(u.id===e)return{defaultLayoutDeferred:c,derivedPanelConstraints:f,group:u,groupSize:h,layout:d,separatorToPanels:m};throw Error(`Group ${e} not found`)},i=()=>{let a=n().derivedPanelConstraints.find((u)=>u.panelId===t);if(a!==void 0)return a;throw Error(`Panel constraints not found for Panel ${t}`)},r=()=>{let a=n().group.panels.find((u)=>u.id===t);if(a!==void 0)return a;throw Error(`Layout not found for Panel ${t}`)},o=()=>{let a=n().layout[t];if(a!==void 0)return a;throw Error(`Layout not found for Panel ${t}`)},s=({nextSize:a,panels:u,prevLayout:c,derivedPanelConstraints:f})=>{let d=o(),h=u.findIndex((x)=>x.id===t),m=h===0,b=h===u.length-1;if(b&&a<d&&(m||u.slice(0,h).every((x,g)=>{let v=f[g];return v?.collapsible&&yt(v.collapsedSize,c[v.panelId])}))){let x=u.slice(0,h).reduce((g,v)=>g+c[v.id],0);return{...c,[t]:Pt(100-x)}}return gc({delta:b?d-a:a-d,initialLayout:c,panelConstraints:f,pivotIndices:b?[h-1,h]:[h,h+1],prevLayout:c,trigger:"imperative-api"})},l=(a)=>{let u=o();if(a===u)return;let{defaultLayoutDeferred:c,derivedPanelConstraints:f,group:d,groupSize:h,layout:m,separatorToPanels:b}=n(),x=s({nextSize:a,panels:d.panels,prevLayout:m,derivedPanelConstraints:f}),g=Ts({layout:x,panelConstraints:f});Gi(m,g)||Yi(d,{defaultLayoutDeferred:c,derivedPanelConstraints:f,groupSize:h,layout:g,separatorToPanels:b})};return{collapse:()=>{let{collapsible:a,collapsedSize:u}=i(),{mutableValues:c}=r(),f=o();a&&f!==u&&(c.expandToSize=f,l(u))},expand:()=>{let{collapsible:a,collapsedSize:u,minSize:c}=i(),{mutableValues:f}=r(),d=o();if(a&&d===u){let h=f.expandToSize??c;h===0&&(h=1),l(h)}},getSize:()=>{let{group:a}=n(),u=o(),{element:c}=r(),f=a.orientation==="horizontal"?c.offsetWidth:c.offsetHeight;return{asPercentage:u,inPixels:f}},isCollapsed:()=>{let{collapsible:a,collapsedSize:u}=i(),c=o();return a&&yt(u,c)},resize:(a)=>{let{group:u}=n(),{element:c}=r(),f=ha({group:u}),d=fa({groupSize:f,panelElement:c,styleProp:a}),h=Pt(d/f*100);l(h)}}}function dO(e){if(e.defaultPrevented)return;let t=Oo();sy(e,t).forEach((n)=>{if(n.separator&&!n.separator.disableDoubleClick){let i=n.panels.find((r)=>r.panelConstraints.defaultSize!==void 0);if(i){let r=i.panelConstraints.defaultSize,o=TO({groupId:n.group.id,panelId:i.id});o&&r!==void 0&&(o.resize(r),e.preventDefault())}}})}function Lh(e){let t=Oo();for(let[n]of t)if(n.separators.some((i)=>i.element===e))return n;throw Error("Could not find parent Group for separator element")}function MO({groupId:e}){let t=()=>{let n=Oo();for(let[i,r]of n)if(i.id===e)return{group:i,...r};throw Error(`Could not find Group with id "${e}"`)};return{getLayout(){let{defaultLayoutDeferred:n,layout:i}=t();return n?{}:i},setLayout(n){let{defaultLayoutDeferred:i,derivedPanelConstraints:r,group:o,groupSize:s,layout:l,separatorToPanels:a}=t(),u=Ts({layout:n,panelConstraints:r});return i?l:(Gi(l,u)||Yi(o,{defaultLayoutDeferred:i,derivedPanelConstraints:r,groupSize:s,layout:u,separatorToPanels:a}),u)}}}function As(e,t){let n=Lh(e),i=Eo(n.id,!0),r=n.separators.find((c)=>c.element===e);Re(r,"Matching separator not found");let o=i.separatorToPanels.get(r);Re(o,"Matching panels not found");let s=o.map((c)=>n.panels.indexOf(c)),l=MO({groupId:n.id}).getLayout(),a=gc({delta:t,initialLayout:l,panelConstraints:i.derivedPanelConstraints,pivotIndices:s,prevLayout:l,trigger:"keyboard"}),u=Ts({layout:a,panelConstraints:i.derivedPanelConstraints});Gi(l,u)||Yi(n,{defaultLayoutDeferred:i.defaultLayoutDeferred,derivedPanelConstraints:i.derivedPanelConstraints,groupSize:i.groupSize,layout:u,separatorToPanels:i.separatorToPanels},{isUserInteraction:!0})}function hO(e){if(e.defaultPrevented)return;let t=e.currentTarget,n=Lh(t);if(!(n.disabled||n.separators.find((i)=>i.element===t)?.disabled))switch(e.key){case"ArrowDown":{e.preventDefault(),n.orientation==="vertical"&&As(t,5);break}case"ArrowLeft":{e.preventDefault(),n.orientation==="horizontal"&&As(t,-5);break}case"ArrowRight":{e.preventDefault(),n.orientation==="horizontal"&&As(t,5);break}case"ArrowUp":{e.preventDefault(),n.orientation==="vertical"&&As(t,-5);break}case"End":{e.preventDefault(),As(t,100);break}case"Enter":{e.preventDefault();let i=Lh(t),r=Eo(i.id,!0),{derivedPanelConstraints:o,layout:s,separatorToPanels:l}=r,a=i.separators.find((d)=>d.element===t);Re(a,"Matching separator not found");let u=l.get(a);Re(u,"Matching panels not found");let c=u[0],f=o.find((d)=>d.panelId===c.id);if(Re(f,"Panel metadata not found"),f.collapsible){let d=s[c.id],h=f.collapsedSize===d?i.mutableState.expandedPanelSizes[c.id]??f.minSize:f.collapsedSize;As(t,h-d)}break}case"F6":{e.preventDefault();let i=Lh(t).separators.map((s)=>s.element),r=Array.from(i).findIndex((s)=>s===e.currentTarget);Re(r!==null,"Index not found");let o=e.shiftKey?r>0?r-1:i.length-1:r+1<i.length?r+1:0;i[o].focus({preventScroll:!0});break}case"Home":{e.preventDefault(),As(t,-100);break}}}function bP(e,t){let{element:n,orientation:i,panels:r}=e,o=n.getBoundingClientRect(),s=i==="horizontal";return iy({expandHitTargets:!1,group:e,includeDisabled:!0}).map(({panels:l,rect:a,separator:u},c)=>{let f=r.indexOf(l[0]),d=s?a.left+a.width/2:a.top+a.height/2;return{active:t.some((h)=>{if(h.group!==e||h.panels[0]!==l[0])return!1;if(u||h.separator)return h.separator===u;let m=s?h.rect.left+h.rect.width/2:h.rect.top+h.rect.height/2;return yt(d,m)}),group:e,key:u?`separator-${u.id}`:`panel-${l[0].id}-${c}`,offset:0,panelIndex:f,rect:new DOMRect((s&&!u?d:a.left)-o.left-n.clientLeft+n.scrollLeft,(!s&&!u?d:a.top)-o.top-n.clientTop+n.scrollTop,s&&!u?0:a.width,!s&&!u?0:a.height),separator:u}})}function pO(e){if(e.defaultPrevented)return;if(e.pointerType==="mouse"&&e.button>0)return;let t=Oo(),n=sy(e,t);if(n.length===0)return;let i=new Map,r=!1;n.forEach((s)=>{s.separator&&(r||(r=!0,s.separator.element.focus({focusVisible:!1,preventScroll:!0})));let l=t.get(s.group);l&&i.set(s.group,l.layout)});let o=Array.from(i.keys()).flatMap((s)=>s.resizePreviewMode==="separator"?bP(s,n):[]);Xi({cursorFlags:0,didPointerMove:!1,hitRegions:n,initialLayoutMap:i,pointerDownAtPoint:{x:e.clientX,y:e.clientY},previewLayoutMap:new Map(i),previews:o,state:"active"}),e.preventDefault()}function mO(e){let t=Oo(),n=Mr();switch(n.state){case"active":oy({commit:!1,document:e.currentTarget,event:e,hitRegions:n.hitRegions,initialLayoutMap:n.initialLayoutMap,mountedGroups:t,prevCursorFlags:n.cursorFlags})}}function gO(e){if(e.defaultPrevented)return;let t=Mr(),n=Oo();switch(t.state){case"active":{if(e.buttons===0){t.previewLayoutMap.forEach((i,r)=>{let o=n.get(r);r.resizePreviewMode==="separator"&&o&&!Gi(i,o.layout)&&Yi(r,{...o,layout:i})}),Xi({cursorFlags:0,state:"inactive"}),t.hitRegions.forEach((i)=>{if(!n.has(i.group))return;let r=Eo(i.group.id,!0);Yi(i.group,r,{isUserInteraction:!0})}),mc(e.currentTarget);return}for(let i of t.hitRegions)if(i.separator){let{element:r}=i.separator;r.isConnected&&!r.hasPointerCapture?.(e.pointerId)&&r.setPointerCapture?.(e.pointerId)}oy({commit:!1,document:e.currentTarget,event:e,hitRegions:t.hitRegions,initialLayoutMap:t.initialLayoutMap,mountedGroups:n,pointerDownAtPoint:t.pointerDownAtPoint,prevCursorFlags:t.cursorFlags});break}default:{let i=sy(e,n);i.length===0?t.state!=="inactive"&&Xi({cursorFlags:0,state:"inactive"}):Xi({cursorFlags:0,hitRegions:i,state:"hover"}),mc(e.currentTarget);break}}}function vO(e){if(e.relatedTarget instanceof HTMLIFrameElement)switch(Mr().state){case"hover":Xi({cursorFlags:0,state:"inactive"})}}function bO(e){if(e.defaultPrevented)return;if(e.pointerType==="mouse"&&e.button>0)return;RO(e.currentTarget,e)&&e.preventDefault()}function yP(e){let t=0,n=0,i={};for(let o of e)if(o.defaultSize!==void 0){t++;let s=Pt(o.defaultSize);n+=s,i[o.panelId]=s}else i[o.panelId]=void 0;let r=e.length-t;if(r!==0){let o=Pt((100-n)/r);for(let s of e)s.defaultSize===void 0&&(i[s.panelId]=o)}return i}function xP(e,t){let n=e.map((r)=>r.id),i=Object.keys(t);if(n.length!==i.length)return!1;for(let r of n)if(!i.includes(r))return!1;return!0}function yO({group:e,panelConstraints:t}){let n=e.panels.map(({id:r})=>r).join(","),i=e.mutableState.defaultLayout;return e.mutableState.layouts[n]??(i&&xP(e.panels,i)?i:yP(t))}function wP(e,t,n){if(!n[0])return;let i=e.panels.find((a)=>a.element===t);if(!i||!i.onResize)return;let r=ha({group:e}),o=e.orientation==="horizontal"?i.element.offsetWidth:i.element.offsetHeight,s=i.mutableValues.prevSize,l={asPercentage:Pt(o/r*100),inPixels:o};i.mutableValues.prevSize=l,i.onResize(l,i.id,s)}function NO(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(e[n]!==t[n])return!1;return!0}function SP(e,t){return e.length!==t.length?!1:e.every((n,i)=>NO(n,t[i]))}function kP({group:e,nextGroupSize:t,prevGroupSize:n,prevLayout:i}){if(n<=0||t<=0||n===t)return i;let r=0,o=0,s=!1,l=new Map,a=[];for(let f of e.panels){let d=i[f.id]??0;switch(f.panelConstraints.groupResizeBehavior){case"preserve-pixel-size":{s=!0;let h=d/100*n,m=Pt(h/t*100);l.set(f.id,m),r+=m;break}case"preserve-relative-size":default:{a.push(f.id),o+=d;break}}}if(!s||a.length===0)return i;let u=100-r,c={...i};if(l.forEach((f,d)=>{c[d]=f}),o>0)for(let f of a){let d=i[f]??0;c[f]=Pt(d/o*u)}else{let f=Pt(u/a.length);for(let d of a)c[d]=f}return c}var ca=new Map;function _P(e){let t=!0;Re(e.element.ownerDocument.defaultView,"Cannot register an unmounted Group");let n=e.element.ownerDocument.defaultView.ResizeObserver,i=new Set,r=new Set,o=new n((d)=>{for(let h of d){let{borderBoxSize:m,target:b}=h;if(b===e.element){if(t){let x=ha({group:e});if(x===0)return;let g=Eo(e.id);if(!g)return;let v=Jb(e),w=g.defaultLayoutDeferred?yO({group:e,panelConstraints:v}):g.layout,S=kP({group:e,nextGroupSize:x,prevGroupSize:g.groupSize,prevLayout:w}),k=Ts({layout:S,panelConstraints:v});if(!g.defaultLayoutDeferred&&Gi(g.layout,k)&&SP(g.derivedPanelConstraints,v)&&g.groupSize===x)continue;Yi(e,{defaultLayoutDeferred:!1,derivedPanelConstraints:v,groupSize:x,layout:k,separatorToPanels:g.separatorToPanels})}}else wP(e,b,m)}});o.observe(e.element),e.panels.forEach((d)=>{Re(!i.has(d.id),`Panel ids must be unique; id "${d.id}" was used more than once`),i.add(d.id),d.onResize&&o.observe(d.element)});let s=ha({group:e}),l=Jb(e),a=yO({group:e,panelConstraints:l}),u=Ts({layout:a,panelConstraints:l}),c=e.element.ownerDocument;ca.set(c,(ca.get(c)??0)+1);let f=new Map;return iy({group:e,includeDisabled:!0}).forEach((d)=>{d.separator&&f.set(d.separator,d.panels)}),Yi(e,{defaultLayoutDeferred:s===0,derivedPanelConstraints:l,groupSize:s,layout:u,separatorToPanels:f}),e.separators.forEach((d)=>{Re(!r.has(d.id),`Separator ids must be unique; id "${d.id}" was used more than once`),r.add(d.id),d.element.addEventListener("keydown",hO)}),ca.get(c)===1&&(c.addEventListener("contextmenu",aO,!0),c.addEventListener("dblclick",dO,!0),c.addEventListener("pointerdown",pO,!0),c.addEventListener("pointerleave",mO),c.addEventListener("pointermove",gO),c.addEventListener("pointerout",vO),c.addEventListener("pointerup",bO,!0)),function(){t=!1,ca.set(c,Math.max(0,(ca.get(c)??0)-1)),lP(e),eP(e)&&mc(c),e.separators.forEach((d)=>{d.element.removeEventListener("keydown",hO)}),ca.get(c)||(c.removeEventListener("contextmenu",aO,!0),c.removeEventListener("dblclick",dO,!0),c.removeEventListener("pointerdown",pO,!0),c.removeEventListener("pointerleave",mO),c.removeEventListener("pointermove",gO),c.removeEventListener("pointerout",vO),c.removeEventListener("pointerup",bO,!0)),o.disconnect()}}function CP(){let[e,t]=W({}),n=ot(()=>t({}),[]);return[e,n]}function ly(e){let t=Pf();return`${e??t}`}var di=typeof window<"u"?ti:J;function pc(e){let t=X(e);return di(()=>{t.current=e},[e]),ot((...n)=>t.current?.(...n),[t])}function ay(...e){return pc((t)=>{e.forEach((n)=>{if(n)switch(typeof n){case"function":{n(t);break}case"object":{n.current=t;break}}})})}function uy(e){let t=X({...e});return di(()=>{for(let n in e)t.current[n]=e[n]},[e]),t.current}var DO=jr(null);function EP({separator:e}){let{element:t}=e,n=X(null);return di(()=>{let i=t.cloneNode(!0),r=[t,...t.querySelectorAll("*")],o=[i,...i.querySelectorAll("*")],s=t.ownerDocument.defaultView;return r.forEach((l,a)=>{let u=o[a];if(u instanceof s.HTMLElement||u instanceof s.SVGElement){let c=s.getComputedStyle(l);for(let f=0;f<c.length;f++){let d=c.item(f);u.style.setProperty(d,c.getPropertyValue(d))}}u.removeAttribute("data-testid"),u.removeAttribute("id")}),Object.assign(i.style,{boxSizing:"border-box",height:"100%",margin:"0",position:"static",transform:"none",width:"100%"}),n.current.appendChild(i),()=>i.remove()},[t]),p("div",{ref:n,style:{height:"100%",opacity:0.65,pointerEvents:"none",width:"100%"}})}function Bh(){let e=qr(DO);return Re(e,"Group Context not found; did you render a Panel or Separator outside of a Group?"),e}function LO(e){let{registerOverlay:t}=Bh(),n=X(e);NO(n.current,e)||(n.current=e);let i=n.current;return di(()=>t(i),[t,i]),null}LO.displayName="SeparatorOverlay";function OP({active:e,orientation:t,style:n,...i}){let r;switch(t){case"horizontal":{r={height:"100%",minWidth:"1px"};break}case"vertical":{r={minHeight:"1px",width:"100%"};break}}return p("div",{...i,"data-separator-overlay":e?"active":"inactive",style:{...r,...n,flexShrink:0,pointerEvents:"none"}})}function RP({overlay:e,preview:t}){let{group:n,offset:i,rect:r,separator:o}=t,s=n.orientation==="horizontal",l=o?.preview,a=e;return Bf(l)&&l.type===LO&&(a=l.props,l=void 0),l==null&&(a?l=p(OP,{...a,active:t.active,orientation:n.orientation}):o&&(l=p(EP,{separator:o}))),p("div",{"aria-hidden":"true","data-resize-preview":!0,inert:!0,style:{height:r.height,left:r.left,pointerEvents:"none",position:"absolute",top:r.top,transform:s?`translateX(${i}px)`:`translateY(${i}px)`,width:r.width},children:l})}function AP(e,t){let n=X({getLayout:()=>({}),setLayout:tP});nu(t,()=>n.current,[]),di(()=>{Object.assign(n.current,MO({groupId:e}))})}function TP({groupId:e,resizePreviewMode:t}){let[n,i]=W([]),r=X(n);return di(()=>{let o=(l)=>{let a=OO(e),u=t==="separator"&&l.state==="active"?l.previews.filter((f)=>f.group===a&&(f.active||!yt(f.offset,0))):[],c=r.current;c.length===u.length&&u.every((f,d)=>f===c[d])||(r.current=u,i(u))};if(t!=="separator"){o(Mr());return}let s=xO(({next:l})=>o(l));return o(Mr()),s},[e,t]),n}function Ph({children:e,className:t,defaultLayout:n,disableCursor:i,disabled:r,elementRef:o,groupRef:s,id:l,onLayoutChange:a,onLayoutChanged:u,orientation:c="horizontal",resizePreviewMode:f="panel",resizeTargetMinimumSize:d={coarse:20,fine:10},style:h,...m}){let b=X({onLayoutChange:{},onLayoutChanged:{}}),x=pc((L)=>{Gi(b.current.onLayoutChange,L)||(b.current.onLayoutChange=L,a?.(L))}),g=pc((L,V)=>{Gi(b.current.onLayoutChanged,L)||(b.current.onLayoutChanged=L,u?.(L,{isUserInteraction:V}))}),v=ly(l),[w,S]=W(),k=TP({groupId:v,resizePreviewMode:f}),E=X(null),[_,O]=CP(),B=X({lastExpandedPanelSizes:{},layouts:{},panels:[],separators:[]}),M=ay(E,o);AP(v,s);let I=pc((L,V)=>{let G=Eo(L);if(G)return{flexGrow:G.layout[V]??1};if(n?.[V])return{flexGrow:n?.[V]}}),H=uy({defaultLayout:n,disableCursor:i,resizeTargetMinimumSize:d}),Y=je(()=>({get disableCursor(){return!!H.disableCursor},getPanelStyles:I,id:v,orientation:c,registerPanel:(L)=>{let V=B.current;return V.panels=Zb(c,[...V.panels,L]),O(),()=>{V.panels=V.panels.filter((G)=>G!==L),O()}},registerOverlay:(L)=>(S(L),()=>{S(void 0)}),registerSeparator:(L)=>{let V=B.current;return V.separators=Zb(c,[...V.separators,L]),O(),()=>{V.separators=V.separators.filter((G)=>G!==L),O()}},updatePanelProps:(L,{disabled:V})=>{let G=B.current.panels.find((fe)=>fe.id===L);G&&(G.panelConstraints.disabled=V);let P=OO(v),ee=Eo(v);P&&ee&&Yi(P,{...ee,derivedPanelConstraints:Jb(P)})},updateSeparatorProps:(L,{disabled:V,disableDoubleClick:G})=>{let P=B.current.separators.find((ee)=>ee.id===L);P&&(P.disabled=V,P.disableDoubleClick=G)}}),[I,v,O,c,H]),D=X(null);return di(()=>{let L=E.current;if(L===null)return;let V=B.current,G;if(H.defaultLayout!==void 0&&Object.keys(H.defaultLayout).length===V.panels.length){G={};for(let et of V.panels){let Se=H.defaultLayout[et.id];Se!==void 0&&(G[et.id]=Se)}}let P={disabled:!!r,element:L,id:v,mutableState:{defaultLayout:G,disableCursor:!!H.disableCursor,expandedPanelSizes:B.current.lastExpandedPanelSizes,layouts:B.current.layouts},orientation:c,panels:V.panels,resizePreviewMode:f,get resizeTargetMinimumSize(){return H.resizeTargetMinimumSize},separators:V.separators};D.current=P;let ee=_P(P),{defaultLayoutDeferred:fe,derivedPanelConstraints:De,layout:qe}=Eo(P.id,!0);!fe&&De.length>0&&(x(qe),g(qe,!1));let ht=ry(v,(et)=>{let{defaultLayoutDeferred:Se,derivedPanelConstraints:ct,layout:_t}=et.next;if(Se||ct.length===0)return;let Xo=P.panels.map(({id:Ct})=>Ct).join(",");P.mutableState.layouts[Xo]=_t,ct.forEach((Ct)=>{if(Ct.collapsible){let{layout:Ur}=et.prev??{};if(Ur){let Js=yt(Ct.collapsedSize,_t[Ct.panelId]),Ja=yt(Ct.collapsedSize,Ur[Ct.panelId]);Js&&!Ja&&(P.mutableState.expandedPanelSizes[Ct.panelId]=Ur[Ct.panelId])}}});let Qs=Mr(),Qa=Qs.state!=="active"||!Qs.hitRegions.some((Ct)=>Ct.group===P);x(_t),Qa&&g(_t,et.isUserInteraction)});return()=>{D.current=null,ee(),ht()}},[r,v,g,x,c,_,f,H]),J(()=>{let L=D.current;L&&(L.mutableState.defaultLayout=n,L.mutableState.disableCursor=!!i)}),p(DO.Provider,{value:Y,children:y("div",{...m,className:t,"data-group":!0,"data-testid":v,id:v,ref:M,style:{height:"100%",width:"100%",overflow:"hidden",position:f==="separator"?"relative":void 0,...h,display:"flex",flexDirection:c==="horizontal"?"row":"column",flexWrap:"nowrap",touchAction:c==="horizontal"?"pan-y":"pan-x"},children:[e,k.map((L)=>p(RP,{overlay:w,preview:L},L.key))]})})}Ph.displayName="Group";function zh(e,t){return`react-resizable-panels:${[e,...t].join(":")}`}function MP({id:e,panelIds:t,storage:n}){let i=zh(e,[]),r=n.getItem(i);if(r)try{let o=JSON.parse(r);if(t){let s=t.join(","),l=o[s];if(l&&Array.isArray(l.layout)&&t.length===l.layout.length){let a={};for(let u=0;u<t.length;u++)a[t[u]]=l.layout[u];return a}}else{let s=Object.keys(o);if(s.length===1){let l=o[s[0]];if(l&&Array.isArray(l.layout)){let a=s[0].split(",");if(a.length===l.layout.length){let u={};for(let c=0;c<a.length;c++)u[a[c]]=l.layout[c];return u}}}}}catch{}}function cy({debounceSaveMs:e=100,onlySaveAfterUserInteractions:t,panelIds:n,storage:i=localStorage,...r}){let o=n!==void 0,s="id"in r?r.id:r.groupId,l=zh(s,n??[]),a=$r(NP,()=>i.getItem(l),()=>i.getItem(l)),u=je(()=>{if(a){let x=JSON.parse(a),g=Object.values(x);if(Array.from(g).every((v)=>typeof v=="number"))return x}},[a]),c=je(()=>{if(!u)return MP({id:s,panelIds:n,storage:i})},[u,s,n,i]),f=u??c,d=X(null),h=ot(()=>{let x=d.current;x&&(d.current=null,clearTimeout(x))},[]);ti(()=>()=>{h()},[h]);let m=ot((x,g)=>{if(t&&!g.isUserInteraction)return;h();let v;o?v=zh(s,Object.keys(x)):v=zh(s,[]);try{i.setItem(v,JSON.stringify(x))}catch(w){console.error(w)}},[h,o,s,t,i]),b=ot((x)=>{h(),e===0?m(x,{isUserInteraction:!1}):d.current=setTimeout(()=>{m(x,{isUserInteraction:!1})},e)},[h,e,m]);return{defaultLayout:f,onLayoutChange:b,onLayoutChanged:m}}function NP(){return function(){}}function DP(e,t){let{id:n}=Bh(),i=X({collapse:Qb,expand:Qb,getSize:()=>({asPercentage:0,inPixels:0}),isCollapsed:()=>!1,resize:Qb});nu(t,()=>i.current,[]),di(()=>{Object.assign(i.current,TO({groupId:n,panelId:e}))})}function pa({children:e,className:t,collapsedSize:n="0%",collapsedThreshold:i,collapsible:r=!1,defaultSize:o,disabled:s,elementRef:l,groupResizeBehavior:a="preserve-relative-size",id:u,maxSize:c="100%",minSize:f="0%",onResize:d,panelRef:h,style:m,...b}){let x=!!u,g=ly(u),v=uy({disabled:s}),w=X(null),S=ay(w,l),{getPanelStyles:k,id:E,orientation:_,registerPanel:O,updatePanelProps:B}=Bh(),M=d!==null,I=pc((L,V,G)=>{d?.(L,u,G)});di(()=>{let L=w.current;if(L!==null){let V={element:L,id:g,idIsStable:x,mutableValues:{expandToSize:void 0,prevSize:void 0},onResize:M?I:void 0,panelConstraints:{groupResizeBehavior:a,collapsedSize:n,collapsedThreshold:i,collapsible:r,defaultSize:o,disabled:v.disabled,maxSize:c,minSize:f}};return O(V)}},[a,n,i,r,o,M,g,x,c,f,I,O,v]),J(()=>{B(g,{disabled:s})},[s,g,B]),DP(g,h);let H=()=>{let L=k(E,g);if(L)return JSON.stringify(L)},Y=$r((L)=>ry(E,L),H,H),D;return Y?D=JSON.parse(Y):o!==void 0?D={flexGrow:void 0,flexShrink:void 0,flexBasis:o}:D={flexGrow:1},p("div",{...b,"data-disabled":s||void 0,"data-panel":!0,"data-testid":g,id:g,ref:S,style:{...LP,display:"flex",flexBasis:0,flexShrink:1,overflow:"visible",...D},children:p("div",{className:t,style:{maxHeight:"100%",maxWidth:"100%",flexGrow:1,overflow:"auto",...m,touchAction:_==="horizontal"?"pan-y":"pan-x"},children:e})})}pa.displayName="Panel";var LP={minHeight:0,maxHeight:"100%",height:"auto",minWidth:0,maxWidth:"100%",width:"auto",border:"none",borderWidth:0,padding:0,margin:0};function zO(){return X(null)}function zP({layout:e,panelConstraints:t,panelId:n,panelIndex:i}){let r,o,s=e[n],l=t.find((a)=>a.panelId===n);if(l){let a=l.maxSize,u=l.collapsible?l.collapsedSize:l.minSize,c=[i,i+1];o=Ts({layout:gc({delta:u-s,initialLayout:e,panelConstraints:t,pivotIndices:c,prevLayout:e}),panelConstraints:t})[n],r=Ts({layout:gc({delta:a-s,initialLayout:e,panelConstraints:t,pivotIndices:c,prevLayout:e}),panelConstraints:t})[n]}return{valueControls:n,valueMax:r,valueMin:o,valueNow:s}}function Ih({children:e,className:t,disabled:n,disableDoubleClick:i,elementRef:r,id:o,preview:s,style:l,...a}){let u=ly(o),c=uy({disabled:n,disableDoubleClick:i,children:e,className:t,preview:s,style:l}),[f,d]=W({}),[h,m]=W("inactive"),[b,x]=W(!1),g=X(null),v=X(null),w=ay(g,r),{disableCursor:S,id:k,orientation:E,registerSeparator:_,updateSeparatorProps:O}=Bh(),B=E==="horizontal"?"vertical":"horizontal";di(()=>{let H=g.current;if(H!==null){let Y={disabled:c.disabled,disableDoubleClick:c.disableDoubleClick,element:H,id:u,get children(){return c.children},get className(){return c.className},get preview(){return c.preview},get style(){return c.style}};v.current=Y;let D=_(Y),L=xO((G)=>{m(G.next.state!=="inactive"&&G.next.hitRegions.some((P)=>P.separator===Y)?G.next.state:"inactive")}),V=ry(k,(G)=>{let{derivedPanelConstraints:P,layout:ee,separatorToPanels:fe}=G.next,De=fe.get(Y);if(De){let qe=De[0],ht=P.findIndex((et)=>et.panelId===qe.id);d(zP({layout:ee,panelConstraints:P,panelId:qe.id,panelIndex:ht}))}});return()=>{v.current=null,L(),V(),D()}}},[k,u,_,c]),di(()=>{let H=v.current;H&&Z5(H)},[s]),J(()=>{O(u,{disabled:n,disableDoubleClick:i})},[n,i,u,O]);let M;n&&!S&&(M="not-allowed");let I;if(n)I="disabled";else switch(h){case"active":{I="active";break}default:b?I="focus":I=h}return p("div",{...a,"aria-controls":f.valueControls,"aria-disabled":n||void 0,"aria-orientation":B,"aria-valuemax":f.valueMax,"aria-valuemin":f.valueMin,"aria-valuenow":f.valueNow,children:e,className:t,"data-separator":I,"data-testid":u,id:u,onBlur:()=>x(!1),onFocus:()=>x(!0),ref:w,role:"separator",style:{flexBasis:"auto",cursor:M,...l,flexGrow:0,flexShrink:0,touchAction:"none"},tabIndex:n?void 0:0})}Ih.displayName="Separator";var BP={close:p("path",{d:"M6 6l12 12M18 6L6 18"}),check:p("path",{d:"M5 12.5l4.5 4.5L19 7.5"}),trash:p("path",{d:"M4 7h16M10 7V5h4v2M6 7l1 12h10l1-12M10 11v5M14 11v5"}),copy:p("path",{d:"M9 9h10v10H9zM5 15V5h10"}),external:p("path",{d:"M14 5h5v5M19 5l-8 8M18 14v5H5V6h5"}),dice:y(te,{children:[p("rect",{x:"4",y:"4",width:"16",height:"16",rx:"3"}),p("circle",{cx:"9",cy:"9",r:"1.3",fill:"currentColor",stroke:"none"}),p("circle",{cx:"15",cy:"15",r:"1.3",fill:"currentColor",stroke:"none"}),p("circle",{cx:"12",cy:"12",r:"1.3",fill:"currentColor",stroke:"none"})]}),image:y(te,{children:[p("rect",{x:"3",y:"5",width:"18",height:"14",rx:"2"}),p("circle",{cx:"8.5",cy:"10",r:"1.5"}),p("path",{d:"M4 17l5-5 4 4 3-2 4 4"})]}),tag:y(te,{children:[p("path",{d:"M4 11V4h7l9 9-7 7-9-9z"}),p("circle",{cx:"8",cy:"8",r:"1.3",fill:"currentColor",stroke:"none"})]}),sparkle:p("path",{d:"M12 3l1.9 5.1L19 10l-5.1 1.9L12 17l-1.9-5.1L5 10l5.1-1.9zM18 15l.8 2.2L21 18l-2.2.8L18 21l-.8-2.2L15 18l2.2-.8z"}),play:p("path",{d:"M7 4l13 8-13 8z",fill:"currentColor",stroke:"none"}),pause:p("path",{d:"M8 5v14M16 5v14"}),stop:p("rect",{x:"6",y:"6",width:"12",height:"12",rx:"1.5",fill:"currentColor",stroke:"none"}),save:p("path",{d:"M5 4h11l3 3v13H5zM8 4v6h7V4M8 20v-6h8v6"}),ghost:p("path",{d:"M5 20V10a7 7 0 0114 0v10l-2.3-2-2.4 2-2.3-2-2.4 2zM9.5 10h.01M14.5 10h.01"}),"panel-off":y(te,{children:[p("rect",{x:"3",y:"4",width:"18",height:"16",rx:"2"}),p("path",{d:"M4 5l16 14"})]}),"panel-bottom":y(te,{children:[p("rect",{x:"3",y:"4",width:"18",height:"16",rx:"2"}),p("path",{d:"M3 14h18"}),p("rect",{x:"4.5",y:"15.5",width:"15",height:"3",fill:"currentColor",stroke:"none",opacity:"0.85"})]}),"panel-side":y(te,{children:[p("rect",{x:"3",y:"4",width:"18",height:"16",rx:"2"}),p("path",{d:"M14 4v16"}),p("rect",{x:"15.5",y:"5.5",width:"4",height:"13",fill:"currentColor",stroke:"none",opacity:"0.85"})]}),"panel-left":y(te,{children:[p("rect",{x:"3",y:"4",width:"18",height:"16",rx:"2"}),p("path",{d:"M10 4v16"}),p("rect",{x:"4.5",y:"5.5",width:"4",height:"13",fill:"currentColor",stroke:"none",opacity:"0.85"})]}),"panel-corner":y(te,{children:[p("rect",{x:"3",y:"4",width:"18",height:"16",rx:"2"}),p("rect",{x:"12.5",y:"12.5",width:"7",height:"6",fill:"currentColor",stroke:"none",opacity:"0.85"})]}),swap:p("path",{d:"M4 8h13l-3-3M20 16H7l3 3"}),plus:p("path",{d:"M12 5v14M5 12h14"}),"copy-plus":p("path",{d:"M9 9h10v10H9zM5 15V5h10M14 12v4M12 14h4"}),pen:p("path",{d:"M4 20h4L20 8l-4-4L4 16zM14 6l4 4"}),broom:p("path",{d:"M19 4l-7 7M9.5 8.5l6 6-5 5-6-6zM4.5 13.5L2 21l7.5-2.5"}),expand:p("path",{d:"M4 9V4h5M20 15v5h-5M15 4h5v5M9 20H4v-5"}),shrink:p("path",{d:"M9 4v5H4M15 20v-5h5M20 9h-5V4M4 15h5v5"}),power:p("path",{d:"M12 3v9M7.5 6.5a7 7 0 109 0"}),warn:p("path",{d:"M12 4l9 16H3zM12 10v4M12 17h.01"}),link:p("path",{d:"M10 14a4 4 0 015.7 0l2.6-2.6a4 4 0 10-5.7-5.7L11 7.3M14 10a4 4 0 01-5.7 0l-2.6 2.6a4 4 0 105.7 5.7L13 16.7"}),unlink:p("path",{d:"M9 15l-1.6 1.6a4 4 0 01-5.7-5.7L3.3 9.3M15 9l1.6-1.6a4 4 0 015.7 5.7L20.7 14.7M4 4l16 16"}),grip:y(te,{children:[p("circle",{cx:"9",cy:"6",r:"1.4",fill:"currentColor",stroke:"none"}),p("circle",{cx:"15",cy:"6",r:"1.4",fill:"currentColor",stroke:"none"}),p("circle",{cx:"9",cy:"12",r:"1.4",fill:"currentColor",stroke:"none"}),p("circle",{cx:"15",cy:"12",r:"1.4",fill:"currentColor",stroke:"none"}),p("circle",{cx:"9",cy:"18",r:"1.4",fill:"currentColor",stroke:"none"}),p("circle",{cx:"15",cy:"18",r:"1.4",fill:"currentColor",stroke:"none"})]}),refresh:p("path",{d:"M20 11a8 8 0 10-2 6M20 6v5h-5"}),terminal:p("path",{d:"M4 5h16v14H4zM7 9l3 3-3 3M13 15h4"}),text:p("path",{d:"M4 7h16M4 12h10M4 17h13"}),more:p("path",{d:"M5 12h.01M12 12h.01M19 12h.01",strokeWidth:3.2}),eye:p("path",{d:"M2 12s3.5-7 10-7 10 7 10 7-3.5 7-10 7S2 12 2 12zM12 9a3 3 0 110 6 3 3 0 010-6z"}),"eye-off":p("path",{d:"M3 3l18 18M10.6 5.1A10 10 0 0112 5c6.5 0 10 7 10 7a17 17 0 01-3.2 4.2M6.6 6.6C3.9 8.4 2 12 2 12s3.5 7 10 7a9.7 9.7 0 005.4-1.6M9.9 9.9a3 3 0 004.2 4.2"}),rows:p("path",{d:"M4 5h16v6H4zM4 13h16v6H4z"}),grid:p("path",{d:"M4 4h7v7H4zM13 4h7v7h-7zM4 13h7v7H4zM13 13h7v7h-7z"}),search:p("path",{d:"M10.5 4a6.5 6.5 0 110 13 6.5 6.5 0 010-13zM15.5 15.5L20 20"}),history:p("path",{d:"M4 12a8 8 0 102.3-5.6M4 4v4h4M12 8v4l3 2"}),dot:p("circle",{cx:"12",cy:"12",r:"5",fill:"currentColor",stroke:"none"}),audio:p("path",{d:"M3 12h2M7 8v8M11 4v16M15 7v10M19 10v4M21 12h0"}),video:y(te,{children:[p("rect",{x:"3",y:"6",width:"13",height:"12",rx:"2"}),p("path",{d:"M16 10l5-3v10l-5-3z"})]}),workflow:y(te,{children:[p("rect",{x:"3",y:"4",width:"6",height:"5",rx:"1.2"}),p("rect",{x:"15",y:"4",width:"6",height:"5",rx:"1.2"}),p("rect",{x:"9",y:"15",width:"6",height:"5",rx:"1.2"}),p("path",{d:"M6 9v2.5a1.5 1.5 0 001.5 1.5h9a1.5 1.5 0 001.5-1.5V9M12 13v2"})]}),draft:p("path",{d:"M6 3h8l4 4v14H6zM14 3v4h4M9 12h6M9 16h4"}),folder:p("path",{d:"M3 6.5A1.5 1.5 0 014.5 5H9l2 2h8.5A1.5 1.5 0 0121 8.5v9a1.5 1.5 0 01-1.5 1.5h-15A1.5 1.5 0 013 17.5z"}),"folder-tree":p("path",{d:"M4 4v14a2 2 0 002 2h2M4 10h4M10 7h3l1 1.5h6V12H10zM10 16h3l1 1.5h6V21H10z"}),server:y(te,{children:[p("rect",{x:"3",y:"4",width:"18",height:"7",rx:"1.5"}),p("rect",{x:"3",y:"13",width:"18",height:"7",rx:"1.5"}),p("path",{d:"M7 7.5h.01M7 16.5h.01M11 7.5h6M11 16.5h6"})]}),menu:p("path",{d:"M4 7h16M4 12h16M4 17h16"}),memory:p("path",{d:"M6 6h12v12H6zM9 9h6v6H9zM9 3v3M15 3v3M9 18v3M15 18v3M3 9h3M3 15h3M18 9h3M18 15h3"}),keyboard:p("path",{d:"M3 6h18v12H3zM7 10h.01M11 10h.01M15 10h.01M19 10h.01M8 14h8"})};function T(e){return y("svg",{className:"icon",viewBox:"0 0 24 24",width:`${e.size??1.15}em`,height:`${e.size??1.15}em`,fill:"none",stroke:"currentColor",strokeWidth:1.8,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":e.title==null,role:e.title==null?void 0:"img",children:[e.title==null?null:p("title",{children:e.title}),BP[e.name]]})}var Ee=/mac|iphone|ipad/i.test(navigator.userAgent)?"⌘":"Ctrl+";var xt={"focus-prompt":"P","open-loras":"O","open-enhancer":"E","rename-draft":"F2","duplicate-draft":"D","toggle-menu":"B","toggle-blur":"U"},fy=(e)=>/^F\d{1,2}$/.test(e);function Hh(e){let t=xt[e];return fy(t)?t:`${Ee}${t}`}function BO(e){return(e.metaKey||e.ctrlKey)&&!e.altKey&&!e.shiftKey&&(e.key.toUpperCase()==="K"||e.key.toUpperCase()==="J")}function Vh(e){let t=!(e.metaKey||e.ctrlKey||e.altKey||e.shiftKey);for(let[i,r]of Object.entries(xt))if(fy(r)&&t&&e.key===r)return i;if(!(e.metaKey||e.ctrlKey)||e.altKey)return null;let n=e.key.toUpperCase();for(let[i,r]of Object.entries(xt)){if(fy(r))continue;let o=r.startsWith("⇧");if(o===e.shiftKey&&r.slice(o?1:0)===n)return i}return null}function Uh(e,t,n){return e!=null&&e.kind===t&&e.seq>n}function PO(e){let t=(n)=>e.find((i)=>i.kind===n&&!i.inactive)?.name??null;return{prompt:t("prompt"),loras:t("loras")}}var vc={enhance:"E",apply:"I"};function IO(e){if(!(e.metaKey||e.ctrlKey)||e.altKey||e.shiftKey)return null;let t=e.key.toUpperCase();for(let[n,i]of Object.entries(vc))if(i===t)return n;return null}async function we(e,t){let n=await fetch(e,t),i=await n.json().catch(()=>null);if(!n.ok||i==null){let r=i?.error;throw Error(typeof r==="string"?r:r!=null?JSON.stringify(r):`http ${n.status} on ${e}`)}return i}function dy(){return we("/drafts")}function HO(e){return we(`/drafts/${encodeURIComponent(e.module)}/${encodeURIComponent(e.draft)}`)}function VO(e){return we(`/generate/${encodeURIComponent(e.module)}/${encodeURIComponent(e.draft)}`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(e.payload)})}function hy(){return we("/results")}function UO(e={}){let t=e.promptId==null?"/results":`/results/${encodeURIComponent(e.promptId)}`;return we(t,{method:"DELETE"})}function KO(e){return we(`/preview/${encodeURIComponent(e.module)}`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(e.values),signal:e.signal})}function bc(e,t={}){return we(`/drafts/${encodeURIComponent(e.module)}/${encodeURIComponent(e.draft)}`,{method:"PUT",headers:{"content-type":"application/json"},body:JSON.stringify(e.values),keepalive:t.keepalive===!0})}function jO(){return we("/tabs")}function FO(e){return we("/tabs",{method:"PUT",headers:{"content-type":"application/json"},body:JSON.stringify({tabs:e})})}function py(e){return we(`/drafts/${encodeURIComponent(e.module)}/${encodeURIComponent(e.draft)}`,{method:"DELETE"})}function qO(e){return we(`/run/${encodeURIComponent(e.module)}`)}function yc(e){return`/run/${encodeURIComponent(e.module)}/preview?t=${e.tick}`}function my(e){return we(`/lora-info/${encodeURIComponent(e.host)}/${encodeURIComponent(e.name)}`)}function $O(e){return we(`/lora-about/${encodeURIComponent(e.host)}/${encodeURIComponent(e.name)}`)}function gy(e){return`/lora-preview/${encodeURIComponent(e.host)}/${encodeURIComponent(e.name)}`}function XO(){return we("/settings")}function GO(e){return we("/settings",{method:"PUT",headers:{"content-type":"application/json"},body:JSON.stringify(e)})}function YO(){return we("/hosts")}function WO(e){return we(`/hosts/${encodeURIComponent(e.host)}/ping`)}function QO(e){return we(`/hosts/${encodeURIComponent(e.host)}/${e.action}`,{method:"POST"})}function JO(e){return we(`/hosts/${encodeURIComponent(e.host)}/drift${e.full?"?full=1":""}`)}function ZO(e){return we(`/hosts/${encodeURIComponent(e.host)}/lora-civitai/${encodeURIComponent(e.lora)}`,{method:"POST"})}function eR(e){return we(`/hosts/${encodeURIComponent(e.host)}/logs`)}function tR(e){return we(`/hosts/${encodeURIComponent(e.module)}`,{method:"PUT",headers:{"content-type":"application/json"},body:JSON.stringify({host:e.host})})}function nR(){return we("/prompt-enhancers")}function iR(e){return we(`/prompt-enhancers/${encodeURIComponent(e.name)}`,{method:"PUT",headers:{"content-type":"application/json"},body:JSON.stringify({text:e.text})})}function rR(e){return we(`/prompt-enhancers/${encodeURIComponent(e.name)}`,{method:"DELETE"})}function oR(){return we("/llm-configs")}function sR(e){return we(`/llm-configs/${encodeURIComponent(e.name)}`,{method:"PUT",headers:{"content-type":"application/json"},body:JSON.stringify(e.config)})}function lR(e){return we(`/llm-configs/${encodeURIComponent(e.name)}`,{method:"DELETE"})}async function aR(e){let t=new Uint8Array(await e.file.arrayBuffer()),n="";for(let i=0;i<t.length;i+=32768)n+=String.fromCharCode(...t.subarray(i,i+32768));return we("/upload",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({name:e.file.name,dataBase64:btoa(n)})})}function uR(e){let t=new URLSearchParams({q:e.q,limit:String(e.limit??20)});return we(`/tags/${encodeURIComponent(e.module)}/${encodeURIComponent(e.varName)}?${t}`,{signal:e.signal})}function vy(e){let t={};if(typeof e==="object"&&e!==null&&!Array.isArray(e)){for(let[n,i]of Object.entries(e))if(typeof i==="string")t[n]=i}return t}function ma(e,t){let n=/^(.*?)(\d+)$/.exec(e);if(n==null)return ma(`${e}-1`,t);let i=n[1]??"",r=n[2]??"";for(let o=Number(r)+1;;o++){let s=`${i}${String(o).padStart(r.length,"0")}`;if(!t.includes(s))return s}}function Kh(e){if(e==="openrouter")return"https://openrouter.ai/api/v1";return e==="openwebui"?"http://localhost:3000":"http://localhost:8080/v1"}function cR(e){return e.trim().replace(/\/+$/,"")}function fR(e){let t=cR(e.baseUrl)===""?Kh(e.provider):cR(e.baseUrl);return e.provider==="openwebui"?`${t}/api`:t}function PP(e){return`${fR(e)}/models`}function IP(e){return`${fR(e)}/chat/completions`}function ga(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)?e:{}}function Nr(e){return typeof e==="string"?e:""}function HP(e){let t=ga(e).data;if(!Array.isArray(t))return[];let n=[];for(let i of t){let r=ga(i),o=Nr(r.id);if(o==="")continue;let s=r.supported_parameters,l=Array.isArray(s)?s.includes("reasoning"):null;n.push({id:o,name:Nr(r.name)===""?o:Nr(r.name),reasoning:l})}return n.sort((i,r)=>i.id.localeCompare(r.id)),n}async function dR(e,t){let n=await e.text().catch(()=>"");return Error(`llm ${t} failed: http ${e.status} ${n.slice(0,300)}`)}function hR(e,t){if(e instanceof Error&&e.name==="AbortError")return e;let n=e instanceof Error?e.message:String(e);return Error(`could not reach ${t} (${n}) — is it running, and does it allow this origin? open webui needs CORS_ALLOW_ORIGIN`)}async function by(e){let t=PP(e),n;try{n=await fetch(t,{headers:pR(e)})}catch(i){throw hR(i,t)}if(!n.ok)throw await dR(n,"model list");return HP(await n.json())}function pR(e){return e.key.trim()===""?{}:{Authorization:`Bearer ${e.key.trim()}`}}function VP(e){let t=e.provider==="openrouter"&&e.effort!=="off"?{reasoning:{effort:e.effort}}:e.provider==="openai"?{chat_template_kwargs:{enable_thinking:e.effort!=="off"}}:{};return{model:e.model,stream:!0,messages:[{role:"system",content:e.system},{role:"user",content:e.user}],...t}}function UP(e){let t=e.split(`
10
+ `),n=t.pop()??"",i=[];for(let r of t){let o=r.trim();if(o===""||o.startsWith(":"))continue;if(o.startsWith("data:"))i.push(o.slice(5).trim())}return{events:i,rest:n}}function KP(e){if(e===""||e==="[DONE]")return null;let t;try{t=JSON.parse(e)}catch{return null}let n=ga(t),i=ga(n.error);if(Nr(i.message)!=="")throw Error(`llm stream error: ${Nr(i.message)}`);let r=n.choices;if(!Array.isArray(r))return null;let o=ga(ga(r[0]).delta),s=Nr(o.content),l=Nr(o.reasoning)===""?Nr(o.reasoning_content):Nr(o.reasoning);if(s===""&&l==="")return null;return{content:s,reasoning:l}}class mR{inside=!1;pending="";feed(e){let t=this.pending+e;this.pending="";let n="",i="";for(;;){let o=this.inside?"</think>":"<think>",s=t.indexOf(o);if(s===-1)break;let l=t.slice(0,s);if(this.inside)i+=l;else n+=l;t=t.slice(s+o.length),this.inside=!this.inside}let r=jP(t);if(r!==-1)this.pending=t.slice(r),t=t.slice(0,r);if(this.inside)i+=t;else n+=t;return{content:n,reasoning:i}}flush(){let e=this.pending;return this.pending="",this.inside?{content:"",reasoning:e}:{content:e,reasoning:""}}}function jP(e){let t=e.lastIndexOf("<");if(t===-1)return-1;let n=e.slice(t);return"<think>".startsWith(n)||"</think>".startsWith(n)?t:-1}async function gR(e){if(e.endpoint.provider==="openrouter"&&e.endpoint.key.trim()==="")throw Error("no openrouter api key — paste one in the enhancer settings");if(e.model.trim()==="")throw Error("no model selected");let t=IP(e.endpoint),n;try{n=await fetch(t,{method:"POST",headers:{...pR(e.endpoint),"content-type":"application/json"},body:JSON.stringify(VP({...e,provider:e.endpoint.provider})),signal:e.signal})}catch(u){throw hR(u,t)}if(!n.ok)throw await dR(n,"refine");let i=n.body?.getReader();if(i==null)throw Error("llm refine failed: the response carried no stream");let r=new TextDecoder,o=new mR,s={content:"",reasoning:""},l=(u)=>{if(u.content===""&&u.reasoning==="")return;s.content+=u.content,s.reasoning+=u.reasoning,e.onDelta(u)},a="";for(;;){let u=await i.read();if(u.done)break;a+=r.decode(u.value,{stream:!0});let c=UP(a);a=c.rest;for(let f of c.events){let d=KP(f);if(d==null)continue;let h=o.feed(d.content);l({content:h.content,reasoning:h.reasoning+d.reasoning})}}if(l(o.flush()),s.content.trim()==="")throw Error("the model returned no prompt text — try another model");return s}function yy(e){return e==="openrouter"||e==="openwebui"||e==="openai"}function xy(e){return e==="off"||e==="low"||e==="medium"||e==="high"}var vR={openrouter:"anthropic/claude-sonnet-5",openwebui:"",openai:""};function wy(e){let t=typeof e==="object"&&e!==null&&!Array.isArray(e)?e:{},n=yy(t.provider)?t.provider:"openrouter";return{provider:n,baseUrl:typeof t.baseUrl==="string"&&t.baseUrl.trim()!==""?t.baseUrl.trim():Kh(n),model:typeof t.model==="string"?t.model:vR[n],effort:xy(t.effort)?t.effort:"medium",thinkingOnly:t.thinkingOnly!==!1}}function bR(e,t){if(t===e.provider)return e;return{...e,provider:t,baseUrl:Kh(t),model:vR[t]}}var Sy="$enhance";function yR(e,t){return t==null?e:`${e}#${t}`}function xR(e){if(e==null||typeof e!=="object"||Array.isArray(e))return{};let t={};for(let[n,i]of Object.entries(e))if(typeof i==="string"&&i!=="")t[n]=i;return t}var ky=(e)=>{let t=e.trimStart();return t.startsWith("- ")||t.startsWith("// ")};function wR(e){let t=e.split(`
11
+ `);return{body:t.filter((n)=>!ky(n)).join(`
12
+ `).trim(),kept:t.filter(ky).map((n)=>n.trim())}}function FP(e){let t=new Set;for(let n of e){if(!n.startsWith("- "))continue;for(let i of n.slice(2).split(","))if(i.trim()!=="")t.add(i.trim().toLowerCase())}return t}function _y(e,t){let n=FP(t);return[e.split(`
13
+ `).filter((r)=>t.length===0||!ky(r)).map((r)=>{if(n.size===0)return r;let o=r.indexOf(" - ");while(o!==-1){let s=(r.slice(o+3).split(",")[0]??"").trim().toLowerCase();if(n.has(s))return r.slice(0,o).trimEnd();o=r.indexOf(" - ",o+3)}return r}).join(`
14
14
  `).trim(),...t].filter((r)=>r!=="").join(`
15
- `)}function Ih(e,t){if(t.text.trim()==="")return[...e];let n=e.find((r)=>r.text===t.text),i=e.filter((r)=>r.text!==t.text);return[{...t,count:(n?.count??0)+1},...i].slice(0,1000)}function fA(e,t){let n=t.toLowerCase().split(/\s+/).filter((i)=>i!=="");if(n.length===0)return[...e];return e.filter((i)=>{let r=`${i.text}
16
- ${i.source}`.toLowerCase();return n.every((o)=>r.includes(o))})}function dA(e,t){let n=Math.max(0,Math.round((t-e)/1000));if(n<10)return"just now";if(n<60)return`${n}s ago`;let i=Math.floor(n/60);if(i<60)return`${i} min ago`;let r=Math.floor(i/60);if(r<24)return`${r} h ${i%60} min ago`;return`${Math.floor(r/24)} d ago`}function hc(e){if(typeof e!=="object"||e==null||Array.isArray(e))return!1;let t=e,n=t.strength;return Array.isArray(n)&&n.length===2&&typeof n[0]==="number"&&Number.isFinite(n[0])&&typeof n[1]==="number"&&Number.isFinite(n[1])&&(t.off==null||typeof t.off==="boolean")&&(t.mute==null||Array.isArray(t.mute)&&t.mute.every((i)=>typeof i==="string"))}function Vh(e){if(typeof e==="boolean")return!0;if(typeof e==="number")return Number.isFinite(e);if(Array.isArray(e))return e.length===2&&e.every((t)=>typeof t==="number"&&Number.isFinite(t));return hc(e)}function da(e){if(e==null||e===!1)return!1;if(hc(e))return e.off!==!0;return!0}function y0(e){return da(e)||hc(e)&&e.off===!0}function x0(e){if(typeof e==="number"&&Number.isFinite(e))return[e,e];if(Array.isArray(e)&&typeof e[0]==="number"&&typeof e[1]==="number")return[e[0],e[1]];if(hc(e))return[e.strength[0],e.strength[1]];return[1,1]}function Hh(e){return hc(e)&&e.mute!=null?e.mute:[]}function w0(e){return[...new Set(e.split(",").map((t)=>t.trim()).filter((t)=>t!==""))]}function pc(e,t){let n=t.strength??x0(e),i=t.on==null?!da(e):!t.on,r=[...t.mute??Hh(e)];if(!i&&r.length===0)return[n[0],n[1]];return{strength:[n[0],n[1]],...i?{off:!0}:{},...r.length===0?{}:{mute:r}}}var S0="main";function mc(e){return typeof e==="object"&&e!=null&&!Array.isArray(e)}function SP(e){return mc(e)&&typeof e.name==="string"&&typeof e.prompt==="string"&&typeof e.active==="boolean"}function Dr(e){return mc(e)&&Array.isArray(e.lanes)&&e.lanes.every(SP)}function hA(e){return typeof e==="string"||Dr(e)}function pA(e){return typeof e==="string"?{lanes:[{name:S0,prompt:e,active:!0}]}:e}function mA(e){let t=e.lanes[0];return e.lanes.length===1&&t!=null&&t.active?t.prompt:null}function gA(e){return e.lanes.map((t)=>`# ${t.name}${t.active?"":" (off)"}
15
+ `)}function jh(e,t){if(t.text.trim()==="")return[...e];let n=e.find((r)=>r.text===t.text),i=e.filter((r)=>r.text!==t.text);return[{...t,count:(n?.count??0)+1},...i].slice(0,1000)}function SR(e,t){let n=t.toLowerCase().split(/\s+/).filter((i)=>i!=="");if(n.length===0)return[...e];return e.filter((i)=>{let r=`${i.text}
16
+ ${i.source}`.toLowerCase();return n.every((o)=>r.includes(o))})}function kR(e,t){let n=Math.max(0,Math.round((t-e)/1000));if(n<10)return"just now";if(n<60)return`${n}s ago`;let i=Math.floor(n/60);if(i<60)return`${i} min ago`;let r=Math.floor(i/60);if(r<24)return`${r} h ${i%60} min ago`;return`${Math.floor(r/24)} d ago`}function xc(e){if(typeof e!=="object"||e==null||Array.isArray(e))return!1;let t=e,n=t.strength;return Array.isArray(n)&&n.length===2&&typeof n[0]==="number"&&Number.isFinite(n[0])&&typeof n[1]==="number"&&Number.isFinite(n[1])&&(t.off==null||typeof t.off==="boolean")&&(t.mute==null||Array.isArray(t.mute)&&t.mute.every((i)=>typeof i==="string"))}function Fh(e){if(typeof e==="boolean")return!0;if(typeof e==="number")return Number.isFinite(e);if(Array.isArray(e))return e.length===2&&e.every((t)=>typeof t==="number"&&Number.isFinite(t));return xc(e)}function va(e){if(e==null||e===!1)return!1;if(xc(e))return e.off!==!0;return!0}function Cy(e){return va(e)||xc(e)&&e.off===!0}function Ey(e){if(typeof e==="number"&&Number.isFinite(e))return[e,e];if(Array.isArray(e)&&typeof e[0]==="number"&&typeof e[1]==="number")return[e[0],e[1]];if(xc(e))return[e.strength[0],e.strength[1]];return[1,1]}function qh(e){return xc(e)&&e.mute!=null?e.mute:[]}function Oy(e){return[...new Set(e.split(",").map((t)=>t.trim()).filter((t)=>t!==""))]}function wc(e,t){let n=t.strength??Ey(e),i=t.on==null?!va(e):!t.on,r=[...t.mute??qh(e)];if(!i&&r.length===0)return[n[0],n[1]];return{strength:[n[0],n[1]],...i?{off:!0}:{},...r.length===0?{}:{mute:r}}}var Ry="main";function Sc(e){return typeof e==="object"&&e!=null&&!Array.isArray(e)}function qP(e){return Sc(e)&&typeof e.name==="string"&&typeof e.prompt==="string"&&typeof e.active==="boolean"}function Dr(e){return Sc(e)&&Array.isArray(e.lanes)&&e.lanes.every(qP)}function _R(e){return typeof e==="string"||Dr(e)}function CR(e){return typeof e==="string"?{lanes:[{name:Ry,prompt:e,active:!0}]}:e}function ER(e){let t=e.lanes[0];return e.lanes.length===1&&t!=null&&t.active?t.prompt:null}function OR(e){return e.lanes.map((t)=>`# ${t.name}${t.active?"":" (off)"}
17
17
  ${t.prompt}`).join(`
18
- `)}function vA(e){return mc(e)&&!("lanes"in e)&&Object.values(e).every((t)=>t==null||Vh(t))}function kP(e){return mc(e)&&typeof e.name==="string"&&typeof e.active==="boolean"&&vA(e.loras)}function hi(e){return mc(e)&&Array.isArray(e.lanes)&&e.lanes.every(kP)}function Uh(e){return vA(e)||hi(e)}function bA(e){if(!hi(e))return{record:e,duplicates:[]};let t={},n=[];for(let i of e.lanes){if(!i.active)continue;for(let[r,o]of Object.entries(i.loras)){if(o==null)continue;if(r in t)n.push(r);else t[r]=o}}return{record:t,duplicates:n}}function yA(e){return hi(e)?e:{lanes:[{name:S0,active:!0,loras:e}]}}function jh(e){let t=e.lanes[0];return e.lanes.length===1&&t!=null&&t.active?t.loras:null}function xA(e,t){let n=e.lanes.findIndex((i)=>i.active&&i.loras[t]!=null);return n!==-1?n:e.lanes.findIndex((i)=>i.loras[t]!=null)}function wA(e,t,n){let i=(s)=>{let l={...s};if(n==null)delete l[t];else l[t]=n;return l};if(!hi(e))return i(e);if(e.lanes.length===0)return{lanes:[{name:S0,active:!0,loras:i({})}]};let r=xA(e,t),o=r===-1?0:r;return{lanes:e.lanes.map((s,l)=>l===o?{...s,loras:i(s.loras)}:s)}}function gc(e){let t=new Set(e.map((i)=>i.name)),n=e.length+1;while(t.has(`lane ${n}`))n++;return`lane ${n}`}function pi(e,t,n){return e.map((i,r)=>r===t?{...i,...n}:i)}function Kh(e,t,n){let i=t+n;if(t<0||t>=e.length||i<0||i>=e.length)return[...e];let r=[...e],[o]=r.splice(t,1);if(o!=null)r.splice(i,0,o);return r}function Fh(e,t){return e.filter((n,i)=>i!==t)}function SA(e,t){let n=e.lanes[t.from],i=n?.loras[t.name];if(n==null||i==null||e.lanes[t.to]==null)return e;let r=e.lanes.map((u)=>({...u,loras:{...u.loras}})),o=r[t.from],s=r[t.to];if(o==null||s==null)return e;delete o.loras[t.name];let l={},a=!1;for(let[u,c]of Object.entries(s.loras)){if(u===t.beforeName&&!a)l[t.name]=i,a=!0;l[u]=c}if(!a)l[t.name]=i;return s.loras=l,{lanes:r}}function k0(e,t){if(!hi(e))return e[t];return e.lanes[xA(e,t)]?.loras[t]}function kA(e){let t=new Map,n=hi(e)?e.lanes:[{name:"",active:!0,loras:e}];for(let i of n)for(let[r,o]of Object.entries(i.loras)){if(o==null||o===!1)continue;let s=i.active&&da(o),l=t.get(r);if(l==null||!l.running&&s)t.set(r,{name:r,setting:o,running:s})}return[...t.values()]}var CA="comfy-ts-serve-enhancer",EA=["openrouter","openwebui","openai"];function _A(e){let t=typeof e==="object"&&e!==null?e:{};return{keyByProvider:f0(t.keyByProvider),configName:typeof t.configName==="string"?t.configName:"",presetName:typeof t.presetName==="string"?t.presetName:"",presetByModule:f0(t.presetByModule)}}function qh(e,t){if(!t.includes(e))return e;for(let n=2;n<1000;n++){let i=`${e} ${n}`;if(!t.includes(i))return i}return`${e} ${t.length+1}`}function _P(e,t){let n=(o)=>o.toLowerCase().split(/[^a-z0-9]+/).filter((s)=>s.length>2&&!/^\d+$/.test(s)),i=new Set(n(e)),r=null;for(let o of t){let s=n(o).filter((l)=>i.has(l)).length;if(s===0)continue;if(r==null||s>r.score||s===r.score&&o.length<r.name.length)r={name:o,score:s}}return r?.name??null}function CP(e,t){if(t!=null)return Dr(e)?e.lanes[t]?.prompt??"":"";return typeof e==="string"?e:""}function EP(e,t,n){if(t!=null&&Dr(e))return{lanes:pi(e.lanes,t,{prompt:n})};return n}function OP(e){let t=e.result.trim();if(!e.open||e.target==null||t==="")return;return{[e.target.name]:EP(e.target.value,e.lane,t)}}function AP(e){return e.previous!==""?e.previous:e.prompt}function RP(){try{return _A(JSON.parse(localStorage.getItem(CA)??"{}"))}catch{return _A({})}}class _0{getForm;keyByProvider;configName;presetName;presetByModule;configs=[];configsState="idle";configsError="";configSaveState="saved";configSaveError="";presets=[];presetsState="idle";presetsError="";saveState="saved";saveError="";configStatus=new Map;configStatusError=new Map;models=[];modelsState="idle";modelsError="";editing=null;inputHistory=[];target=null;targetLane=null;targetModule="";result="";thinking="";phase="idle";error="";abort=null;disposers;lastSaved="";lastSavedConfig="";constructor(e=()=>null){this.getForm=e;let t=RP();this.keyByProvider=t.keyByProvider,this.configName=t.configName,this.presetName=t.presetName,this.presetByModule=t.presetByModule,ci(this,{abort:!1,disposers:!1,lastSaved:!1,lastSavedConfig:!1,getForm:!1}),this.disposers=[Tr(()=>{let n=this.preset;return n==null?null:JSON.stringify(n)},(n)=>{if(n==null||n===this.lastSaved)return;this.savePresetNow(JSON.parse(n))},{delay:600}),Tr(()=>{let n=this.configEntry;return n==null?null:JSON.stringify(n)},(n)=>{if(n==null||n===this.lastSavedConfig)return;this.saveConfigNow(JSON.parse(n))},{delay:600})]}dispose(){for(let e of this.disposers)e()}get configEntry(){return this.configs.find((e)=>e.name===this.configName)??this.configs[0]??null}get config(){return this.configEntry?.config??m0({})}get provider(){return this.config.provider}get apiKey(){return this.keyByProvider[this.provider]??""}get baseUrl(){return this.config.baseUrl}get model(){return this.config.model}get effort(){return this.config.effort}get thinkingOnly(){return this.config.thinkingOnly}get endpoint(){return{provider:this.provider,baseUrl:this.baseUrl,key:this.apiKey}}get visibleModels(){return this.thinkingOnly?this.models.filter((e)=>e.reasoning!==!1):this.models}get preset(){return this.presets.find((e)=>e.name===this.presetName)??this.presets[0]??null}get isOpen(){return this.target!=null}settingsJSON(){return{keyByProvider:this.keyByProvider,configName:this.configName,presetName:this.presetName,presetByModule:this.presetByModule}}persist(){try{localStorage.setItem(CA,JSON.stringify(this.settingsJSON()))}catch{}}async loadConfigs(){M(()=>{this.configsState="loading",this.configsError=""});try{let e=await GO();M(()=>{if(this.configs=e.configs,this.configsState="idle",!this.configs.some((t)=>t.name===this.configName))this.configName=this.configs[0]?.name??"";this.lastSavedConfig=JSON.stringify(this.configEntry)}),this.probeConfigs()}catch(e){M(()=>{this.configsState="error",this.configsError=e instanceof Error?e.message:String(e)})}}async saveConfigNow(e){M(()=>{this.configSaveState="saving",this.lastSavedConfig=JSON.stringify(e)});try{let t=await YO(e);M(()=>{this.configs=t.configs.map((n)=>this.configs.find((i)=>i.name===n.name)??n),this.configSaveState="saved",this.configSaveError=""})}catch(t){M(()=>{this.configSaveState="error",this.configSaveError=t instanceof Error?t.message:String(t)})}}async probeConfigs(){let e=this.configs.map((t)=>({name:t.name,config:t.config}));await Promise.all(e.map(async(t)=>{M(()=>this.configStatus.set(t.name,"checking"));let n={provider:t.config.provider,baseUrl:t.config.baseUrl,key:this.keyByProvider[t.config.provider]??""};try{let i=await d0(n);M(()=>{if(this.configStatus.set(t.name,"up"),this.configStatusError.delete(t.name),t.name===this.configEntry?.name&&this.models.length===0)this.models=i,this.modelsState="idle"})}catch(i){M(()=>{this.configStatus.set(t.name,"down"),this.configStatusError.set(t.name,i instanceof Error?i.message:String(i))})}}))}selectConfig(e){if(!this.configs.some((t)=>t.name===e))return;if(this.configName=e,this.lastSavedConfig=JSON.stringify(this.configEntry),this.clearModels(),this.persist(),this.configStatus.get(e)==="up")this.loadModels()}addConfig(e,t=m0({})){if(e.trim()==="")return;let n=qh(e.trim(),this.configs.map((i)=>i.name));this.configs=[...this.configs,{name:n,config:t}],this.configName=n,this.clearModels(),this.persist(),this.saveConfigNow({name:n,config:t})}duplicateConfig(){let e=this.configEntry;if(e!=null)this.addConfig(ca(e.name,this.configs.map((t)=>t.name)),e.config)}async renameConfig(e){let t=this.configEntry,n=qh(e.trim(),this.configs.filter((i)=>i.name!==t?.name).map((i)=>i.name));if(t==null||n===""||n===t.name)return;await this.saveConfigNow({name:n,config:t.config}),M(()=>{this.configName=n,this.persist()}),await this.removeConfigFile(t.name)}async deleteConfig(){let e=this.configEntry;if(e==null)return;await this.removeConfigFile(e.name),M(()=>{if(!this.configs.some((t)=>t.name===this.configName))this.configName=this.configs[0]?.name??"";this.lastSavedConfig=JSON.stringify(this.configEntry),this.persist()})}async removeConfigFile(e){try{let t=await WO({name:e});M(()=>{this.configs=t.configs})}catch(t){M(()=>{this.configSaveState="error",this.configSaveError=t instanceof Error?t.message:String(t)})}}patchConfig(e){let t=this.configEntry;if(t==null){this.addConfig("default",e(this.config));return}this.configs=this.configs.map((n)=>n.name===t.name?{name:n.name,config:e(n.config)}:n)}clearModels(){this.models=[],this.modelsState="idle",this.modelsError=""}setProvider(e){if(!h0(e))return;this.patchConfig((t)=>lA(t,e)),this.clearModels()}setApiKey(e){this.keyByProvider[this.provider]=e.trim(),this.persist()}setBaseUrl(e){this.patchConfig((t)=>({...t,baseUrl:e.trim()}))}setModel(e){this.patchConfig((t)=>({...t,model:e}))}setEffort(e){if(!p0(e))return;this.patchConfig((t)=>({...t,effort:e}))}toggleThinkingOnly(){this.patchConfig((e)=>({...e,thinkingOnly:!e.thinkingOnly}))}async loadPresets(){M(()=>{this.presetsState="loading",this.presetsError=""});try{let e=await qO();M(()=>{if(this.presets=e.enhancers,this.presetsState="idle",!this.presets.some((t)=>t.name===this.presetName))this.presetName=this.presets[0]?.name??"";this.lastSaved=JSON.stringify(this.preset)})}catch(e){M(()=>{this.presetsState="error",this.presetsError=e instanceof Error?e.message:String(e)})}}async savePresetNow(e){M(()=>{this.saveState="saving",this.lastSaved=JSON.stringify(e)});try{let t=await $O(e);M(()=>{this.presets=t.enhancers,this.saveState="saved",this.saveError=""})}catch(t){M(()=>{this.saveState="error",this.saveError=t instanceof Error?t.message:String(t)})}}selectPreset(e){if(!this.presets.some((t)=>t.name===e))return;if(this.presetName=e,this.lastSaved=JSON.stringify(this.preset),this.targetModule!=="")this.presetByModule[this.targetModule]=e;this.persist()}setPresetText(e){let t=this.preset;if(t==null)return;this.presets=this.presets.map((n)=>n.name===t.name?{...n,text:e}:n)}addPreset(e,t=""){if(e.trim()==="")return;let n=qh(e.trim(),this.presets.map((i)=>i.name));this.presets=[...this.presets,{name:n,text:t}],this.presetName=n,this.persist(),this.savePresetNow({name:n,text:t})}duplicatePreset(){let e=this.preset;if(e!=null)this.addPreset(ca(e.name,this.presets.map((t)=>t.name)),e.text)}async renamePreset(e){let t=this.preset,n=qh(e.trim(),this.presets.filter((i)=>i.name!==t?.name).map((i)=>i.name));if(t==null||n===""||n===t.name)return;await this.savePresetNow({name:n,text:t.text}),M(()=>{this.presetName=n,this.persist()}),await this.removePresetFile(t.name)}async deletePreset(){let e=this.preset;if(e==null)return;await this.removePresetFile(e.name),M(()=>{for(let[t,n]of Object.entries(this.presetByModule))if(n===e.name)delete this.presetByModule[t];if(!this.presets.some((t)=>t.name===this.presetName))this.presetName=this.presets[0]?.name??"";this.persist()})}async removePresetFile(e){try{let t=await XO({name:e});M(()=>{this.presets=t.enhancers})}catch(t){M(()=>{this.saveState="error",this.saveError=t instanceof Error?t.message:String(t)})}}openFor(e){this.target=e.v,this.targetLane=e.lane??null,this.targetModule=e.module,this.error="";let t=this.presetByModule[e.module];if(t!=null)this.presetName=t;if(this.presets.length===0)this.loadPresets().then(()=>this.guessFor(e.module));else this.guessFor(e.module);this.loadConfigs()}guessFor(e){if(this.presetByModule[e]!=null)return;let t=_P(e,this.presets.map((n)=>n.name));if(t==null)return;this.presetName=t,this.lastSaved=JSON.stringify(this.preset)}setEditing(e){this.editing=e}get tryOverride(){return OP({open:this.isOpen,target:this.target,lane:this.targetLane,result:this.result})}get intentKey(){return this.target==null?null:aA(this.target.name,this.targetLane)}get original(){let e=this.intentKey;if(e==null||this.target==null)return"";return AP({previous:this.getForm()?.intentFor(e)??"",prompt:CP(this.target.value,this.targetLane)})}usePrompt(){let e=this.intentKey;if(e!=null)this.getForm()?.setIntent(e,"")}close(){this.editing=null,this.cancel(),this.target=null,this.targetLane=null,this.targetModule=""}setResult(e){this.result=e}setOriginal(e){let t=this.intentKey;if(t!=null)this.getForm()?.setIntent(t,e)}async loadModels(){M(()=>{this.modelsState="loading",this.modelsError=""});try{let e=await d0(this.endpoint);M(()=>{this.models=e,this.modelsState="idle";let t=this.configEntry?.name;if(t!=null)this.configStatus.set(t,"up")})}catch(e){M(()=>{this.modelsState="error",this.modelsError=e instanceof Error?e.message:String(e);let t=this.configEntry?.name;if(t!=null)this.configStatus.set(t,"down")})}}cancel(){if(this.abort?.abort(),this.abort=null,this.phase==="running")this.phase=this.result===""?"idle":"done"}run(){this.runNow()}async runNow(){let e=this.preset;if(e==null||this.phase==="running")return;let t=new AbortController;this.abort=t;let n=cA(this.original);this.inputHistory=Ih(this.inputHistory,{text:this.original,value:this.original,at:Date.now(),source:this.targetModule}),M(()=>{this.phase="running",this.error="",this.result="",this.thinking=""});try{await oA({endpoint:this.endpoint,model:this.model,system:e.text,user:n.body,effort:this.effort,signal:t.signal,onDelta:(i)=>M(()=>{this.result+=i.content,this.thinking+=i.reasoning})}),M(()=>{this.result=b0(this.result,n.kept),this.phase="done"})}catch(i){let r=t.signal.aborted;M(()=>{if(r&&this.result!=="")this.result=b0(this.result,n.kept);if(this.phase=r?this.result===""?"idle":"done":"error",!r)this.error=i instanceof Error?i.message:String(i)})}finally{if(this.abort===t)this.abort=null}}apply(){let e=this.result.trim();if(this.target==null||e==="")return;let t=this.target.value,n=this.targetLane;if(n!=null&&Dr(t))this.target.set({lanes:pi(t.lanes,n,{prompt:e})});else this.target.set(e);this.close()}}function TP(e){return e.split(/[/\\]/).filter((t)=>t!=="")}function MP(e){return TP(e).slice(0,-1)}function NP(e){let t=e[0];if(t==null)return[];let n=[];for(let i=0;i<t.length;i++){let r=t[i];if(r==null||!e.every((o)=>o[i]===r))break;n.push(r)}return n}function OA(e){if(e.length===0)return[];let t=e.map((o)=>MP(o.file)),n=NP(t),i=Math.max(0,n.length-1),r=new Map;for(let[o,s]of e.entries()){let l=(t[o]??[]).slice(i).join("/"),a=r.get(l);if(a==null)r.set(l,[s]);else a.push(s)}return[...r.entries()].map(([o,s])=>({folder:o,modules:[...s].sort((l,a)=>l.module.localeCompare(a.module))})).sort((o,s)=>o.folder.localeCompare(s.folder))}function AA(e){return`${e.kind}:${e.module}/${e.draft}`}function RA(e){let t=[];for(let n of OA(e))for(let i of n.modules){let r=i.drafts.length>0?i.drafts:["default"],o={module:i.module,host:i.host,folder:n.folder,tags:i.tags??[]};t.push({kind:"workflow",draft:r[0]??"default",...o});for(let s of r)t.push({kind:"draft",draft:s,...o})}return t}function DP(e){return e==null||e==="/"||e==="-"||e==="_"||e===" "||e==="."}function LP(e,t,n){let i=0,r=n-1;for(let o of e){let s=t.indexOf(o,r+1);if(s<0)return null;if(i+=1,s===r+1)i+=3;if(DP(t[s-1]))i+=5;i-=(s-r-1)*0.05,r=s}return i}function C0(e,t){let n=e.toLowerCase().replace(/\s+/g,"");if(n==="")return 0;let i=t.toLowerCase(),r=null;for(let o=i.indexOf(n[0]??"");o>=0;o=i.indexOf(n[0]??"",o+1)){let s=LP(n,i,o);if(s!=null&&(r==null||s>r))r=s}return r}function zP(e){let t=[];for(let n of e)if(n.kind==="workflow")t.push({head:n,drafts:[],ix:t.length});else t.at(-1)?.drafts.push(n);return t}var E0=(e,t)=>e==null?t:t==null?e:Math.max(e,t),BP=2.5;function TA(e,t){let n=t.trim().toLowerCase().split(/\s+/).filter((l)=>l!=="");if(n.length===0)return[...e];let i=new Set(e.flatMap((l)=>l.tags)),r=n.filter((l)=>i.has(l)),o=n.filter((l)=>!i.has(l)).join(""),s=[];for(let l of zP(e)){if(!r.every((b)=>l.head.tags.includes(b)))continue;if(o===""){s.push({group:l,score:0,rows:[l.head,...l.drafts]});continue}let a=`${l.head.folder}/${l.head.module} ${l.head.tags.join(" ")}`,u=(b)=>b!=null&&b>=o.length*BP?b:null,c=u(C0(o,a)),f=l.drafts.map((b)=>{let x=u(C0(o,b.draft));return{d:b,own:x,score:E0(x==null?null:x+2,u(C0(o,`${a}/${b.draft}`)))}}).filter((b)=>b.score!=null),d=f.filter((b)=>b.own!=null),h=E0(c,f.reduce((b,x)=>E0(b,x.score),null));if(h==null)continue;let m=d.length>0?[...d].sort((b,x)=>x.score-b.score).map((b)=>b.d):l.drafts;s.push({group:l,score:h,rows:[l.head,...m]})}return s.sort((l,a)=>a.score-l.score||l.group.ix-a.group.ix),s.flatMap((l)=>l.rows)}class O0{st;isOpen=!1;query="";cursor=0;constructor(e){this.st=e;ci(this,{st:!1})}get results(){return TA(RA(this.st.modules),this.query)}open(){this.isOpen=!0,this.query="";let e=this.st.form,t=e==null?-1:this.results.findIndex((n)=>n.kind==="draft"&&n.module===e.moduleKey&&n.draft===e.draft);this.cursor=Math.max(0,t)}close(){this.isOpen=!1}toggle(){if(this.isOpen)this.close();else this.open()}setQuery(e){this.query=e,this.cursor=0}move(e){let t=this.results.length;if(t===0)return;this.cursor=(this.cursor+e+t)%t}pick(e=this.results[this.cursor]){if(e==null)return;this.close(),this.st.select({module:e.module,draft:e.draft})}}function MA(e){if(!e.includes("new"))return"new";let t=2;while(e.includes(`new ${t}`))t++;return`new ${t}`}function NA(e,t){return ca(e,t)}var DA=[{mode:"corner",tip:"latent small, in a corner: the last image stays where it is, the new one lands at once when done"},{mode:"full",tip:"latent full size, in the running card at the top of the results"},{mode:"off",tip:"no latent: a progress bar, then the image"}];function LA(e){if(e==="full"||e==="corner"||e==="off")return e;if(e===!1)return"off";return"corner"}function zA(e){return e.length>0&&e.length<=5&&e.every((t)=>t.length<=16)}function $h(e){if(typeof e==="string")return[e];if(Array.isArray(e))return e.filter((t)=>typeof t==="string");return[]}function BA(e){if(e.select==="one")return e.c;let t=$h(e.value);if(e.select==="zero-or-one")return t.includes(e.c)?null:e.c;let n=t.includes(e.c);return e.choices.filter((i)=>i===e.c?!n:t.includes(i))}function PA(e){let t=(n)=>typeof n==="string"&&e.choices.includes(n);if(e.select==="many")return Array.isArray(e.raw)&&e.raw.every(t)?{ok:!0,value:e.choices.filter((n)=>Array.isArray(e.raw)&&e.raw.includes(n))}:{ok:!1};if(e.select==="zero-or-one")return e.raw===null||t(e.raw)?{ok:!0,value:e.raw}:{ok:!1};return t(e.raw)?{ok:!0,value:e.raw}:{ok:!1}}function IA(e){let t=$h(e.raw).filter((n)=>e.choices.includes(n));if(e.select==="many")return e.choices.filter((n)=>t.includes(n));if(e.select==="zero-or-one")return t[0]??null;return typeof e.raw==="string"?e.raw:t[0]??null}function VA(e){let t={};for(let n of e)if(n.kind!=="seed")t[n.name]=n.value;return t}function Rs(e){if(typeof e==="number"&&Number.isFinite(e))return{mode:"=",value:e};if(e!=null&&typeof e==="object"){let t=e;return{mode:typeof t.mode==="string"?t.mode:"=",value:typeof t.value==="number"&&Number.isFinite(t.value)?t.value:0}}return{mode:"=",value:0}}function vc(e){if(e!=null&&typeof e==="object"){let t=e;if(typeof t.width==="number"&&typeof t.height==="number")return{width:t.width,height:t.height}}return{width:1024,height:1024}}function ha(e,t){if(e==null||typeof e!=="object"||Array.isArray(e))return{};let n=new Set(t),i={};for(let[r,o]of Object.entries(e))if(n.has(r)&&Vh(o)&&y0(o))i[r]=o;return i}function PP(e,t){if(hi(e))return{lanes:e.lanes.map((n)=>({...n,loras:ha(n.loras,t)}))};return ha(e,t)}function A0(e,t){if(e.kind==="seed")return Rs(t??e.default);if(e.kind==="size")return vc(t??e.default);if(e.kind==="loras")return PP(t??e.default,e.options??[]);if(e.kind==="choice")return IA({select:e.select??"one",choices:e.choices??[],raw:t??e.default});return t??e.default}function HA(){return Math.floor(Math.random()*4294967296)}function UA(e){return da(e)}function jA(e){let[t,n]=x0(e);return{model:t,clip:n}}function KA(e,t,n){return{...e,[t]:pc(e[t],{on:n})}}function FA(e){let t=new Set(e.options);return Object.keys(e.record).filter((n)=>t.has(n)&&y0(e.record[n]))}function qA(e){let t=[...e.displayed],[n]=t.splice(e.from,1);if(n==null)return e.record;t.splice(e.to,0,n);let i={};for(let r of t)if(r in e.record)i[r]=e.record[r];for(let[r,o]of Object.entries(e.record))if(!(r in i))i[r]=o;return i}function $A(e,t,n){return{...e,[t]:pc(e[t],{strength:[n.model,n.clip]})}}class GA{name;desc;initial;value;dirty=!1;uploadedUrl=null;constructor(e,t,n){this.name=e;this.desc=t;this.initial=n;this.value=n,ci(this,{value:ea,name:!1,desc:!1})}set(e){this.value=e,this.dirty=!0}setFromRun(e){this.value=e,this.initial=e,this.dirty=!1}setUploadedUrl(e){this.uploadedUrl=e}get defaultValue(){return A0(this.desc,this.desc.default)}get isAtDefault(){return JSON.stringify(this.value)===JSON.stringify(this.defaultValue)}resetToDefault(){this.set(this.defaultValue)}revert(){this.value=this.initial,this.dirty=!1,this.uploadedUrl=null}snapshot(){return{name:this.name,value:this.value}}}var R0={autosaveMs:500,previewMs:250};class T0{moduleKey;draft;vars;host;saveState="saved";saveError=null;disposers=[];saveChain=Promise.resolve(!0);lastSaved;lastQueued;queueSeq=0;onSettled=null;previews={};previewError=null;previewAbort=null;constructor(e,t,n,i,r=R0){this.moduleKey=e;this.draft=t;if(this.host=n.host,this.vars=Object.entries(n.vars).map(([s,l])=>new GA(s,l,A0(l,i[s]))),this.intents=uA(i[g0]),this.lastSaved=JSON.stringify(XA(Object.fromEntries(this.vars.map((s)=>[s.name,i[s.name]])),this.intents)),this.lastQueued=this.lastSaved,ci(this,{vars:!1,moduleKey:!1,draft:!1,host:!1,disposers:!1,saveChain:!1,lastSaved:!0,lastQueued:!1,queueSeq:!1,onSettled:!1,previewAbort:!1}),this.disposers.push(Tr(()=>JSON.stringify(this.valuesJSON()),()=>{this.save(),this.onSettled?.()},{delay:r.autosaveMs})),(n.previews??[]).length>0)this.disposers.push(Tr(()=>JSON.stringify(this.varValues()),()=>void this.refreshPreviews(),{delay:r.previewMs,fireImmediately:!0}))}async refreshPreviews(){this.previewAbort?.abort();let e=new AbortController;this.previewAbort=e;try{let t=await MO({module:this.moduleKey,values:this.varValues(),signal:e.signal});M(()=>{this.previews=t.previews,this.previewError=null})}catch(t){if(e.signal.aborted)return;M(()=>{this.previewError=t instanceof Error?t.message:String(t)})}}dispose(e={}){for(let t of this.disposers)t();if(this.disposers=[],this.previewAbort?.abort(),e.flush===!1)return;if(JSON.stringify(this.valuesJSON())!==this.lastQueued)this.save()}flushKeepalive(){let e=JSON.stringify(this.valuesJSON());if(e===this.lastQueued)return;this.lastQueued=e,fc({module:this.moduleKey,draft:this.draft,values:JSON.parse(e)},{keepalive:!0}).then(()=>M(()=>{this.lastSaved=e,this.lastQueued=e,this.saveState="saved"}),(t)=>M(()=>{if(this.lastQueued===e)this.lastQueued=this.lastSaved;this.saveState="error",this.saveError=t instanceof Error?t.message:String(t)}))}intents={};intentFor(e){return this.intents[e]}setIntent(e,t){let n={...this.intents};if(t==="")delete n[e];else n[e]=t;this.intents=n}valuesJSON(){return XA(this.varValues(),this.intents)}varValues(){return Object.fromEntries(this.vars.map((e)=>[e.name,e.value]))}queuePayload(){return VA(this.vars.map((e)=>({name:e.name,kind:e.desc.kind,value:e.value})))}inactiveReason(e){let t=e.desc.ui?.activeWhen;if(t==null)return null;for(let[n,i]of Object.entries(t)){let o=this.vars.find((s)=>s.name===n)?.value;if(!i.some((s)=>s===o))return`only used when ${n} is ${i.join(" or ")}`}return null}keywordSource(e){let t=e.desc.keywordsFrom;if(t==null)return null;let n=this.vars.find((r)=>r.name===t);if(n==null)return null;let i=Uh(n.value)?n.value:{};return{source:n,value:i,record:bA(i).record}}loraKeywordGroups(e){let t=this.keywordSource(e);if(t==null)return[];let n=t.source.desc.optionKeywords??{},i=t.source.desc.optionLabels??{},r=new Map(kA(t.value).map((s)=>[s.name,s])),o=[];for(let s of t.source.desc.options??[]){let l=r.get(s);if(l==null)continue;let a=w0(n[s]??"");if(a.length===0)continue;let u=Hh(l.setting);o.push({lora:s,label:i[s]??s,running:l.running,parts:a.map((c)=>({text:c,on:!u.includes(c)}))})}return o}loraKeywordsFor(e){let t=[];for(let n of this.loraKeywordGroups(e)){if(!n.running)continue;let i=n.parts.filter((r)=>r.on).map((r)=>r.text).join(", ");if(i!==""&&!t.includes(i))t.push(i)}return t}injectedTagsFor(e){return this.loraKeywordGroups(e).filter((t)=>t.running).flatMap((t)=>t.parts.filter((n)=>n.on).map((n)=>({tag:n.text,source:t.label})))}loraWordsFor(e){let t=e.desc.keywordsFrom,n=t==null?null:this.vars.find((o)=>o.name===t);if(n==null)return[];let i=n.desc.optionKeywords??{},r=n.desc.optionLabels??{};return Object.entries(i).flatMap(([o,s])=>w0(s).map((l)=>({word:l,source:r[o]??o})))}toggleKeywordPart(e,t,n){let i=this.keywordSource(e);if(i==null)return;let r=Hh(k0(i.value,t));this.setKeywordMute(e,t,r.includes(n)?r.filter((o)=>o!==n):[...r,n])}setKeywordMute(e,t,n){let i=this.keywordSource(e);if(i==null)return;i.source.set(wA(i.value,t,pc(k0(i.value,t),{mute:n})))}get unsaved(){return JSON.stringify(this.valuesJSON())!==this.lastSaved}get dirtyCount(){return this.vars.filter((e)=>e.dirty).length}save(){let e=JSON.stringify(this.valuesJSON());if(e===this.lastQueued)return this.lastSaved===e?Promise.resolve(!0):this.saveChain;this.lastQueued=e;let t=++this.queueSeq;return M(()=>{this.saveState="saving"}),this.saveChain=this.saveChain.then(async()=>{try{return await fc({module:this.moduleKey,draft:this.draft,values:JSON.parse(e)}),M(()=>{this.lastSaved=e,this.saveState="saved",this.saveError=null}),!0}catch(n){return M(()=>{if(this.queueSeq===t)this.lastQueued=this.lastSaved;this.saveChain=Promise.resolve(!0),this.saveState="error",this.saveError=n instanceof Error?n.message:String(n)}),!1}}),this.saveChain}revertAll(){for(let e of this.vars)e.revert()}}function XA(e,t){return Object.keys(t).length===0?e:{...e,[g0]:t}}var Ao=(e,t)=>e.module===t.module&&e.draft===t.draft;function M0(e,t){return e.some((n)=>Ao(n,t))?e:[...e,{module:t.module,draft:t.draft}]}function N0(e,t,n){let i=e.findIndex((o)=>Ao(o,t));if(i<0||e.length<=1)return{tabs:e,next:null};let r=e.filter((o,s)=>s!==i);if(n==null||!Ao(n,t))return{tabs:r,next:null};return{tabs:r,next:r[Math.min(i,r.length-1)]??null}}function YA(e,t,n){let i=e.findIndex((o)=>Ao(o,t)),r=e.filter((o)=>!Ao(o,n));if(i<0)return M0(r,n);return r.map((o)=>Ao(o,t)?{module:n.module,draft:n.draft}:o)}function WA(e,t){if(!(t.metaKey||t.ctrlKey)||t.altKey||t.shiftKey)return null;if(!/^[1-9]$/.test(t.key))return null;let n=Number(t.key);return(n===9?e[e.length-1]:e[n-1])??null}function QA(e,t,n){if(!(n.metaKey||n.ctrlKey)||n.altKey||n.shiftKey)return null;let i=n.key==="PageDown"?1:n.key==="PageUp"?-1:0;if(i===0||e.length<2)return null;let r=t==null?-1:e.findIndex((o)=>Ao(o,t));if(r<0)return(i>0?e[0]:e[e.length-1])??null;return e[(r+i+e.length)%e.length]??null}function JA(e,t){if(!Array.isArray(e))return[];let n=[];for(let i of e){if(i==null||typeof i!=="object")continue;let r=i;if(typeof r.module!=="string"||typeof r.draft!=="string")continue;let o={module:r.module,draft:r.draft};if(!t.some((s)=>s.module===o.module&&s.drafts.includes(o.draft)))continue;if(!n.some((s)=>Ao(s,o)))n.push(o)}return n}function Pt(e,t){console.error(`\uD83D\uDD34 [comfy-ts serve] ${e}: ${t instanceof Error?t.message:String(t)}`)}function ZA(e){try{let t=new URLSearchParams(e.startsWith("?")?e.slice(1):e),n=t.get("workflow"),i=t.get("draft");return{module:n===""?null:n,draft:i===""?null:i}}catch{return{module:null,draft:null}}}function eR(e){let t=new URLSearchParams(e.search.startsWith("?")?e.search.slice(1):e.search);t.set("workflow",e.module),t.set("draft",e.draft);let n=t.toString();return n===""?"":`?${n}`}function tR(e){let t=(o)=>o==null?null:e.modules.find((s)=>s.module===o)??null,n=t(e.url.module)??t(e.stored.module)??e.modules[0];if(n==null)return null;let i=e.url.module!=null&&e.url.module===n.module?e.url.draft:e.stored.draft,r=i!=null&&n.drafts.includes(i)?i:"default";return{module:n.module,draft:r}}function IP(e){return new Promise((t)=>setTimeout(t,e))}class D0{queue=[];error=null;results=[];progressPercent=null;progressNode=null;progressCount=null;progressText=null;hasPreview=!1;previewTick=0;draining=!1;nextId=0;pollGen=0;onSeeds=null;constructor(){ci(this,{queue:rc,results:rc})}get isRunning(){return this.queue.some((e)=>e.sent)}get runningModule(){return this.queue.find((e)=>e.sent)?.module??null}get pendingCount(){return this.queue.filter((e)=>!e.sent).length}enqueue(e){if(this.queue=[...this.queue,{id:`q${this.nextId++}`,...e,sent:!1}],this.error=null,!this.draining)this.drain()}removeQueued(e){this.queue=this.queue.filter((t)=>t.id!==e||t.sent)}clearQueue(){this.queue=this.queue.filter((e)=>e.sent)}remove(e){this.results=this.results.filter((t)=>t.promptId!==e)}clear(){this.results=[]}async drain(){if(this.draining)return;this.draining=!0;try{while(!0){let e=this.queue.find((n)=>!n.sent);if(e==null)return;M(()=>{this.queue=this.queue.map((n)=>n.id===e.id?{...n,sent:!0}:n),this.progressPercent=null,this.progressNode=null,this.progressCount=null,this.progressText=null,this.hasPreview=!1});let t=++this.pollGen;this.poll(e.module,t);try{let n=await TO(e);M(()=>{this.results=[{...n,at:new Date().toLocaleTimeString()},...this.results].slice(0,20)}),this.onSeeds?.({module:e.module,draft:e.draft,seeds:n.seeds})}catch(n){M(()=>{this.error=n instanceof Error?n.message:String(n),this.queue=this.queue.filter((i)=>i.sent&&i.id!==e.id)})}finally{this.pollGen++,M(()=>{this.queue=this.queue.filter((n)=>n.id!==e.id),this.progressPercent=null,this.progressNode=null,this.progressCount=null,this.progressText=null,this.hasPreview=!1})}}}finally{this.draining=!1}}async poll(e,t){while(t===this.pollGen){if(await IP(700),t!==this.pollGen)return;try{let n=await LO({module:e});M(()=>{if(t!==this.pollGen)return;this.progressPercent=n.percent,this.progressNode=n.node??null,this.progressCount=n.nodeProgress??null,this.progressText=n.progressText??null,this.hasPreview=n.hasPreview,this.previewTick=n.previewSeq??0})}catch{}}}}var nR=[{mode:"folder",label:"folder",tip:"grouped by folder, in the order the host lists them"},{mode:"name",label:"name",tip:"by display name, A to Z"},{mode:"added",label:"date added",tip:"newest file first (the lora manager date). loras it has no date for come last"}];function iR(e){return e==="name"||e==="added"?e:"folder"}function rR(e){let t=[...e.names];if(e.mode==="name")return t.sort((n,i)=>e.label(n).localeCompare(e.label(i),void 0,{sensitivity:"base",numeric:!0}));if(e.mode==="added")return t.sort((n,i)=>{let r=e.addedAt[n],o=e.addedAt[i];if(r==null)return o==null?0:1;if(o==null)return-1;return o-r});return t}function oR(e){let t=e.matches.slice(0,e.cap),n=new Set(e.picked);return{cards:t,enterPick:t.find((i)=>!n.has(i))??null}}function sR(e){if(!e.picked)return"add";return e.on?"pause":"resume"}function L0(e){return e!=null&&typeof e==="object"}function Xh(e){return L0(e)&&!Array.isArray(e)}function lR(e){if(!L0(e))return null;switch(e.comfyTs){case"set-prompt":return typeof e.text==="string"?{comfyTs:"set-prompt",text:e.text}:null;case"host-actions":{if(!Array.isArray(e.actions))return null;let t=[];for(let n of e.actions){if(!L0(n)||typeof n.id!=="string"||n.id===""||typeof n.label!=="string")continue;if(n.label===""||t.some((i)=>i.id===n.id))continue;t.push({id:n.id,label:n.label,...typeof n.title==="string"?{title:n.title}:{}})}return{comfyTs:"host-actions",actions:t}}case"set-selection":return typeof e.module==="string"&&e.module!==""&&typeof e.draft==="string"?{comfyTs:"set-selection",module:e.module,draft:e.draft}:null;case"set-values":return Xh(e.values)?{comfyTs:"set-values",values:e.values}:null;case"get-state":return{comfyTs:"get-state"};default:return null}}function aR(e){let t=e.modules.find((n)=>n.module===e.want.module);if(t==null)return null;return{module:t.module,draft:t.drafts.includes(e.want.draft)?e.want.draft:"default"}}var Fn={ok:!1},VP=["=","+","-","?"];function Wi(e){return typeof e==="number"&&Number.isFinite(e)}function HP(e){if(typeof e==="boolean"||Wi(e))return!0;return Array.isArray(e)&&e.length===2&&Wi(e[0])&&Wi(e[1])}function z0(e,t,n){switch(e.kind){case"prompt":case"text":case"image":return typeof t==="string"?{ok:!0,value:t}:Fn;case"int":return Wi(t)?{ok:!0,value:Math.trunc(t)}:Fn;case"float":return Wi(t)?{ok:!0,value:t}:Fn;case"toggle":return typeof t==="boolean"?{ok:!0,value:t}:Fn;case"choice":{let i=PA({select:e.select??"one",choices:e.choices??[],raw:t});return i.ok?{ok:!0,value:i.value}:Fn}case"seed":{let i=Rs(n);if(Wi(t))return{ok:!0,value:{mode:i.mode,value:Math.max(0,Math.floor(t))}};if(!Xh(t))return Fn;if(t.mode!==void 0&&!(typeof t.mode==="string"&&VP.includes(t.mode)))return Fn;if(t.value!==void 0&&!Wi(t.value))return Fn;return{ok:!0,value:{mode:typeof t.mode==="string"?t.mode:i.mode,value:Wi(t.value)?Math.max(0,Math.floor(t.value)):i.value}}}case"size":{let i=null,r=null;if(typeof t==="string"){let o=/^\s*(\d+)\s*x\s*(\d+)\s*$/i.exec(t);if(o!=null)i=Number(o[1]),r=Number(o[2])}else if(Xh(t))i=t.width,r=t.height;if(!Wi(i)||!Wi(r)||i<1||r<1)return Fn;return{ok:!0,value:{width:Math.floor(i),height:Math.floor(r)}}}case"loras":{if(!Xh(t))return Fn;for(let i of Object.values(t))if(!HP(i))return Fn;return{ok:!0,value:ha(t,e.options??[])}}default:return Fn}}function uR(e){return e.find((t)=>t.desc.kind==="prompt")??e.find((t)=>(t.desc.kind==="text"||t.desc.kind==="prompt")&&/prompt/i.test(t.name)&&!/neg/i.test(t.name))??null}function cR(e,t){if(t==null)return e.comfyTs==="ready"||e.comfyTs==="selection"||e.comfyTs==="error"&&e.code==="boot"?"*":null;return t==="null"?"*":t}function B0(e){try{let t=JSON.stringify(e,(n,i)=>typeof i==="bigint"?`${i}n`:i);if(typeof e==="bigint")return`${e}n`;return t??String(e)}catch{try{return String(e)}catch{return"[unprintable]"}}}function fR(e){try{let n=new URLSearchParams(e.startsWith("?")?e.slice(1):e).get("prompt");return n==null||n===""?null:n}catch{return null}}function P0(){try{return typeof window<"u"&&window.parent!==window}catch{return!1}}var mR="comfy-ts-serve-ui",I0="side",Yh=[{id:"off",icon:"panel-off",label:"none",title:"no preview: the form only"},{id:"bottom",icon:"panel-bottom",label:"below",title:"results below the form"},{id:"left",icon:"panel-left",label:"left",title:"results left of the form"},{id:"side",icon:"panel-side",label:"right",title:"results right of the form"},{id:"pinned",icon:"panel-corner",label:"corner",title:"newest image in the bottom right corner, form scrolls under it"}];function UP(e){return e==="off"||e==="bottom"||e==="left"||e==="side"||e==="pinned"}var gR=200,jP=60;function Gh(e){let t=typeof e==="number"&&Number.isFinite(e)?e:1;return Math.min(2,Math.max(0.6,Math.round(t*20)/20))}function KP(e){return{form:Gh(e.loraFormScale??e.loraScale),popup:Gh(e.loraPopupScale??e.loraScale)}}function vR(e){let t=typeof e==="number"&&Number.isFinite(e)?Math.round(e):1;return Math.min(8,Math.max(1,t))}function FP(e){if(e.resultsColumns!=null)return vR(e.resultsColumns);return e.resultsView==="grid"?3:1}var bR=120;function dR(e){let t=typeof e==="number"&&Number.isFinite(e)?Math.round(e):bR;return Math.min(360,Math.max(60,t))}function hR(e){let t=typeof e==="number"&&Number.isFinite(e)?Math.floor(e):gR;return Math.min(2000,Math.max(1,t))}function pR(e){if(e==null||typeof e!=="object"||Array.isArray(e))return{};let t={};for(let[n,i]of Object.entries(e))if(Array.isArray(i))t[n]=i.filter((r)=>typeof r==="string");return t}function V0(){try{let e=JSON.parse(localStorage.getItem(mR)??"{}")??{};return{...e,varOrder:pR(e.varOrder),sizeStars:pR(e.sizeStars)}}catch{return{}}}class H0{formTiming;phase="loading";bootError="";modules=[];loadErrors={};workspace=null;root=null;menuOpen=!1;form=null;formLoading=!1;formError=null;showLoraImages;showLoraTitles;loraFill;showLoraTriggers;loraFormScale;loraPopupScale;loraSort;loraCap;run;enhancer;omnibox;settings={saveToDisk:!0,hostOverride:{},savePrefix:{},effectivePrefix:{}};savingError=null;prefixEdits={};prefixTimers=new Map;get saveToDisk(){return this.settings.saveToDisk}layout;lastShownLayout=I0;varOrder={};sizeStars={};labelWidth=bR;orderedVars(e,t){let n=this.varOrder[e];if(n==null)return[...t];let i=new Set(t),r=n.filter((o)=>i.has(o));return[...r,...t.filter((o)=>!r.includes(o))]}moveVar(e){let t=this.orderedVars(e.module,e.names),[n]=t.splice(e.from,1);if(n==null)return;t.splice(e.to,0,n),this.varOrder={...this.varOrder,[e.module]:t},this.persist()}hosts={hosts:[],defaults:{},overrides:{}};hostError=null;hostActions=[];hostOrigin=null;lastPostedState=null;switches=new Set;hostChain=Promise.resolve();constructor(e=R0){this.formTiming=e;this.run=new D0,this.run.onSeeds=(i)=>this.applyRunSeeds(i),this.enhancer=new _0(()=>this.form),this.omnibox=new O0(this);let t=V0();this.layout=UP(t.layout)?t.layout:I0,this.showLoraImages=t.loraImages??!0,this.showLoraTitles=t.loraTitles??!0,this.loraFill=t.loraFill??!0,this.showLoraTriggers=t.loraTriggers??!1;let n=KP(t);if(this.loraFormScale=n.form,this.loraPopupScale=n.popup,this.loraSort=iR(t.loraSort),this.loraCap=hR(t.loraCapMigrated!==!0&&t.loraCap===jP?gR:t.loraCap),this.latentMode=LA(t.latent),this.blurResults=t.blur??!1,this.resultsColumns=FP(t),this.expandedPreviews=Array.isArray(t.expandedPreviews)?t.expandedPreviews.filter((i)=>typeof i==="string"):[],this.varOrder=t.varOrder??{},this.sizeStars=t.sizeStars??{},this.labelWidth=dR(t.labelWidth),this.showLogs=t.logs??!1,ci(this,{run:!1,enhancer:!1,omnibox:!1,form:ea,modules:rc,hostOrigin:!1,hostChain:!1,lastPostedState:!1,switches:!1,formTiming:!1}),P0())window.addEventListener("message",(i)=>this.onHostMessage(i));window.addEventListener("beforeunload",()=>this.form?.flushKeepalive()),document.addEventListener("visibilitychange",()=>{if(document.visibilityState==="hidden")this.form?.save()}),this.hostChain=this.boot().catch((i)=>Pt("panel boot failed",i))}setLabelWidth(e,t){if(this.labelWidth=dR(e),t)this.persist()}setSizeStars(e,t){this.sizeStars[e]=t,this.persist()}setLoraFormScale(e){this.loraFormScale=Gh(e),this.persist()}setLoraPopupScale(e){this.loraPopupScale=Gh(e),this.persist()}toggleLoraTriggers(){this.showLoraTriggers=!this.showLoraTriggers,this.persist()}toggleLoraImages(){this.showLoraImages=!this.showLoraImages,this.persist()}toggleLoraTitles(){this.showLoraTitles=!this.showLoraTitles,this.persist()}setLoraSort(e){this.loraSort=e,this.persist()}toggleLoraFill(){this.loraFill=!this.loraFill,this.persist()}setLoraCap(e){this.loraCap=hR(e),this.persist()}applyRunSeeds(e){let t=this.form;if(t==null||t.moduleKey!==e.module||t.draft!==e.draft)return;M(()=>{for(let n of t.vars){if(n.desc.kind!=="seed")continue;let i=e.seeds[n.name];if(typeof i!=="number"||!Number.isFinite(i))continue;let r=Rs(n.value);if(r.value===i)continue;n.setFromRun({mode:r.mode,value:i})}}),this.mirrorState()}syncUrl(){let e=this.form;if(e==null)return;try{let t=eR({search:window.location.search,module:e.moduleKey,draft:e.draft});window.history.replaceState(null,"",`${window.location.pathname}${t}${window.location.hash}`)}catch(t){Pt("could not put the selection in the url",t)}}persist(){try{let e=V0();localStorage.setItem(mR,JSON.stringify({...e,...this.form!=null?{module:this.form.moduleKey,draft:this.form.draft}:{},loraImages:this.showLoraImages,loraTitles:this.showLoraTitles,loraFill:this.loraFill,loraTriggers:this.showLoraTriggers,loraFormScale:this.loraFormScale,loraPopupScale:this.loraPopupScale,loraSort:this.loraSort,loraCap:this.loraCap,loraCapMigrated:!0,layout:this.layout,latent:this.latentMode,blur:this.blurResults,resultsColumns:this.resultsColumns,expandedPreviews:this.expandedPreviews,logs:this.showLogs,varOrder:this.varOrder,sizeStars:this.sizeStars,labelWidth:this.labelWidth}))}catch(e){Pt("ui state could not be stored (it will not survive a reload)",e)}}tabs=[];async loadTabs(){try{let e=await NO(),t=JA(e.tabs,this.modules.map((n)=>({module:n.module,drafts:n.drafts})));M(()=>{this.tabs=t})}catch(e){Pt("the open tabs could not be read, starting with none",e)}}setTabs(e){if(e===this.tabs)return;this.tabs=e,DO(e).catch((t)=>Pt("the open tabs could not be saved",t))}get activeTab(){return this.form==null?null:{module:this.form.moduleKey,draft:this.form.draft}}closeTab(e){let t=N0(this.tabs,e,this.activeTab);if(this.setTabs(t.tabs),t.next!=null)this.select(t.next)}moduleByKey(e){return this.modules.find((t)=>t.module===e)??null}async boot(){try{let e=await l0();M(()=>{this.modules=e.workflows,this.loadErrors=e.loadErrors??{},this.workspace=e.workspace??null,this.root=e.root??null,this.phase="ready"}),this.loadSettings(),this.loadHosts();let t=V0(),n=tR({url:ZA(window.location.search),stored:{module:t.module??null,draft:t.draft??null},modules:this.modules});if(n==null){this.postHost({comfyTs:"error",code:"boot",message:"no workflows are served"});return}if(await this.loadTabs(),await this.select(n),this.form==null){this.postHost({comfyTs:"error",code:"boot",message:`the opening draft could not be read: ${this.formError??"unknown error"}`});return}let i=fR(window.location.search);if(i!=null)this.setPromptText(i);this.postHost({comfyTs:"ready"}),this.startDriftWatch()}catch(e){let t=e instanceof Error?e.message:String(e);M(()=>{this.phase="error",this.bootError=t}),this.postHost({comfyTs:"error",code:"boot",message:t})}}selectToken=0;select(e,t={}){return this.menuOpen=!1,this.renamingDraft=null,this.trackSwitch(this.selectNow(e,t.mirror??!0))}trackSwitch(e){this.switches.add(e);let t=()=>void this.switches.delete(e);return e.then(t,t),e}async switchSettled(){while(this.switches.size>0)await Promise.allSettled(this.switches)}async selectNow(e,t){let n=this.moduleByKey(e.module);if(n==null)return;if(this.form?.moduleKey===e.module&&this.form.draft===e.draft)return;let i=++this.selectToken;M(()=>{this.enhancer.close(),this.formLoading=!0,this.formError=null});let r=this.form;if(r!=null){if(r.dispose(),M(()=>{this.form=null}),!await r.save())M(()=>{this.formError=`the previous draft could not be saved: ${r.saveError??"unknown error"}`})}try{let o=await RO(e);if(i!==this.selectToken)return;let s=new T0(e.module,e.draft,n,o.values??{},this.formTiming);if(s.onSettled=()=>this.mirrorState(),M(()=>{this.form=s,this.setTabs(M0(this.tabs,e)),this.persist(),this.syncUrl()}),this.postHost({comfyTs:"selection",module:s.moduleKey,draft:s.draft}),t)this.mirrorState()}catch(o){M(()=>{if(i!==this.selectToken)return;this.form=null,this.formError=o instanceof Error?o.message:String(o)})}finally{M(()=>{if(i===this.selectToken)this.formLoading=!1})}}promptVar(){return uR(this.form?.vars??[])}setPromptText(e){let t=this.promptVar();if(t==null)return;let n=z0(t.desc,e,t.value);if(!n.ok){Pt("host set-prompt",`'${t.name}' (${t.desc.kind}) rejected the text`);return}M(()=>t.set(n.value))}postHost(e){if(!P0())return;let t=cR(e,this.hostOrigin);if(t==null)return;try{window.parent.postMessage(e,t)}catch(n){Pt("could not post to the host page",n)}}setValues(e){let t=this.form;if(t==null)return Object.keys(e);let n=[];return M(()=>{for(let[i,r]of Object.entries(e)){let o=t.vars.find((l)=>l.name===i);if(o==null){n.push(i),Pt("host set-values",`no var named '${i}' on ${t.moduleKey}`);continue}let s=z0(o.desc,r,o.value);if(s.ok)o.set(s.value);else n.push(i),Pt("host set-values",`'${i}' (${o.desc.kind}) rejected ${B0(r)}`)}}),n}stateOf(e){let t=e.varValues();return{key:B0([e.moduleKey,e.draft,t]),values:t}}replyState(e,t,n){let{key:i,values:r}=this.stateOf(e);this.lastPostedState=i,this.postHost({comfyTs:"state",module:e.moduleKey,draft:e.draft,values:r,request:t,...n!=null?{rejected:n}:{}})}mirrorState(){let e=this.form;if(e==null||this.hostOrigin==null)return;let{key:t,values:n}=this.stateOf(e);if(t===this.lastPostedState)return;this.lastPostedState=t,this.postHost({comfyTs:"state",module:e.moduleKey,draft:e.draft,values:n})}replyError(e,t,n){this.postHost({comfyTs:"error",code:t,message:n,request:e})}onHostMessage(e){if(e.source!==window.parent)return;let t=lR(e.data);if(t==null)return;if(this.hostOrigin==null)this.hostOrigin=e.origin;else if(e.origin!==this.hostOrigin)return;this.hostChain=this.hostChain.then(()=>this.applyHostMessage(t)).catch((n)=>Pt(`host message '${t.comfyTs}' failed`,n))}async applyHostMessage(e){try{await this.applyHostMessageNow(e)}catch(t){if(e.comfyTs==="set-selection"||e.comfyTs==="set-values"||e.comfyTs==="get-state")this.replyError(e.comfyTs,"no-form",t instanceof Error?t.message:String(t));throw t}}async applyHostMessageNow(e){switch(e.comfyTs){case"host-actions":M(()=>{this.hostActions=e.actions});return;case"set-prompt":await this.switchSettled(),this.setPromptText(e.text);return;case"set-selection":{await this.switchSettled();let t=aR({want:e,modules:this.modules});if(t==null){this.replyError("set-selection","unknown-module",`no workflow named '${e.module}' is served`);return}let n=this.form;if(n==null||n.moduleKey!==t.module||n.draft!==t.draft)await this.select(t,{mirror:!1}),await this.switchSettled();let i=this.form;if(i==null){let r=this.formError??"the draft could not be read";this.replyError("set-selection","select-failed",r)}else if(i.moduleKey!==t.module||i.draft!==t.draft)this.replyError("set-selection","superseded",`the panel switched to ${i.moduleKey}/${i.draft} while ${t.module}/${t.draft} was loading`);else this.replyState(i,"set-selection");return}case"set-values":{await this.switchSettled();let t=this.form;if(t==null){this.replyError("set-values","no-form",this.noFormMessage());return}this.replyState(t,"set-values",this.setValues(e.values));return}case"get-state":{await this.switchSettled();let t=this.form;if(t==null)this.replyError("get-state","no-form",this.noFormMessage());else this.replyState(t,"get-state");return}}}noFormMessage(){return this.formError!=null?`no draft is open: ${this.formError}`:"no draft is open"}postResultAction(e,t,n,i){let r=this.promptVar();this.postHost({comfyTs:"result-action",id:e,promptId:t.promptId,ix:i,url:n.url,filename:n.filename,module:t.module,draft:t.draft,seeds:t.seeds,prompt:r!=null&&typeof r.value==="string"?r.value:null})}get generateInResults(){return this.layout==="side"||this.layout==="left"||this.layout==="pinned"}setLayout(e){if(this.layout!=="off")this.lastShownLayout=this.layout;this.layout=e,this.persist()}showPreview(){this.setLayout(this.lastShownLayout==="off"?I0:this.lastShownLayout)}hostFor(e){return this.hosts.overrides[e]??this.hosts.defaults[e]??""}hostUrlFor(e){let t=this.hostFor(e);return this.hosts.hosts.find((n)=>n.id===t)?.httpUrl??null}isHostOverridden(e){return this.hosts.overrides[e]!=null}async loadHosts(){try{let e=await IO();M(()=>{this.hosts=e})}catch(e){Pt("could not read the host list",e)}}showLogs=!1;logLines=[];logsError=null;latentMode="corner";blurResults=!1;jump=null;requestJump(e){this.jump={kind:e,seq:(this.jump?.seq??0)+1}}resultsColumns=1;expandedPreviews=[];logsTimer=null;setLatentMode(e){this.latentMode=e,this.persist()}togglePreviewExpanded(e){this.expandedPreviews=this.expandedPreviews.includes(e)?this.expandedPreviews.filter((t)=>t!==e):[...this.expandedPreviews,e],this.persist()}setResultsColumns(e){this.resultsColumns=vR(e),this.persist()}toggleBlur(){this.blurResults=!this.blurResults,this.persist()}setMenuOpen(e){this.menuOpen=e}renamingDraft=null;startRename(){if(this.form==null)return;this.renamingDraft=this.form.draft,this.menuOpen=!0}setRenaming(e){this.renamingDraft=e}stopRename(){this.renamingDraft=null}menuFoldTick=0;requestMenuFold(){this.menuFoldTick++}toggleLogs(){if(this.showLogs=!this.showLogs,this.persist(),this.logsTimer!=null)clearInterval(this.logsTimer);if(this.logsTimer=null,!this.showLogs)return;this.pullLogs(),this.logsTimer=setInterval(()=>void this.pullLogs(),3000)}async pullLogs(){let e=this.form==null?null:this.hostFor(this.form.moduleKey);if(e==null||e==="")return;try{let t=await KO({host:e});M(()=>{this.logLines=t.lines,this.logsError=null})}catch(t){M(()=>{this.logsError=t instanceof Error?t.message:String(t)})}}refreshing=!1;async refreshHost(){if(this.refreshing)return;M(()=>{this.refreshing=!0});try{await this.hostAction("refresh-schema"),await this.trackSwitch(this.reloadIndexAndForm())}finally{M(()=>{this.refreshing=!1})}}driftDown=!1;startDriftWatch(){this.checkDrift(!0),setInterval(()=>{if(document.visibilityState==="visible")this.checkDrift(!1)},15000)}async checkDrift(e){let t=this.form==null?null:this.hostFor(this.form.moduleKey);if(t==null||t===""||this.refreshing)return;try{let n=await UO({host:t,full:e}),i=this.driftDown;if(M(()=>{this.driftDown=!1}),n.changed)await this.refreshHost();else if(i&&!e)await this.checkDrift(!0)}catch{M(()=>{this.driftDown=!0})}}loraFetching=new Set;async fetchLoraTriggers(e){let t=this.form==null?null:this.hostFor(this.form.moduleKey);if(t==null||t===""||this.loraFetching.has(e))return;M(()=>{this.loraFetching.add(e),this.hostError=null});try{await jO({host:t,lora:e}),await this.trackSwitch(this.reloadIndexAndForm())}catch(n){M(()=>{this.hostError=n instanceof Error?n.message:String(n)})}finally{M(()=>{this.loraFetching.delete(e)})}}async reloadIndexAndForm(){try{let e=await l0(),t=this.form;if(M(()=>{this.modules=e.workflows}),t!=null)t.dispose(),await t.save(),M(()=>{this.form=null}),await this.select({module:t.moduleKey,draft:t.draft})}catch(e){M(()=>{this.hostError=e instanceof Error?e.message:String(e)})}}hostWatch="idle";async watchHostComeBack(){let e=this.form==null?null:this.hostFor(this.form.moduleKey);if(e==null||e==="")return;M(()=>{this.hostWatch="down"});let t=Date.now()+120000;for(;;){if(await new Promise((i)=>setTimeout(i,2500)),Date.now()>t){M(()=>{this.hostWatch="idle",this.hostError=`${e} has not answered for 2 minutes — check the console`});return}if(!await VO({host:e}).then((i)=>i.up).catch(()=>!1))continue;M(()=>{this.hostWatch="back"}),this.checkDrift(!0),setTimeout(()=>M(()=>this.hostWatch="idle"),4000);return}}async hostAction(e){let t=this.form==null?null:this.hostFor(this.form.moduleKey);if(t==null||t==="")return;M(()=>{this.hostError=null});try{if(await HO({host:t,action:e}),e==="restart")this.watchHostComeBack()}catch(n){M(()=>{this.hostError=n instanceof Error?n.message:String(n)})}}async setModuleHost(e){M(()=>{this.hostError=null});try{let t=await FO(e);M(()=>{this.hosts={...this.hosts,overrides:t.overrides}})}catch(t){M(()=>{this.hostError=t instanceof Error?t.message:String(t)})}}async loadSettings(){try{let e=await BO();M(()=>{this.settings=e})}catch(e){Pt("could not read the serve settings",e)}}savePrefixDraft(e){return this.prefixEdits[e]??this.settings.savePrefix[e]??""}setSavePrefix(e,t){this.prefixEdits[e]=t,this.savingError=null;let n=this.prefixTimers.get(e);if(n!=null)clearTimeout(n);this.prefixTimers.set(e,setTimeout(()=>{this.pushSettings({savePrefix:{[e]:t}})},500))}async pushSettings(e){try{let t=await PO(e);return M(()=>{this.settings=t,this.savingError=null}),!0}catch(t){return M(()=>{this.savingError=t instanceof Error?t.message:String(t)}),!1}}async toggleSaveToDisk(){let e=!this.saveToDisk,t=this.settings;if(M(()=>{this.settings={...this.settings,saveToDisk:e},this.savingError=null}),!await this.pushSettings({saveToDisk:e}))M(()=>{this.settings=t})}generate(e){this.generateNow(e)}async generateNow(e){let t=this.form;if(t==null)return;let n={...t.queuePayload(),...e};if(!await t.save())return;this.run.enqueue({module:t.moduleKey,draft:t.draft,payload:n}),this.recordPrompts(t,n)}promptHistory=[];recordPrompts(e,t){let n=Date.now();for(let i of e.vars){let r=t[i.name];if(i.desc.kind!=="prompt"||!hA(r))continue;let o=typeof r==="string"?r:gA(r);this.promptHistory=Ih(this.promptHistory,{text:o,value:r,at:n,source:`${e.moduleKey} · ${i.desc.label??i.name}`})}}async renameDraft(e){let t=this.form,n=e.trim();if(t==null||n===""||n===t.draft)return;let i=t.draft;if(await this.duplicateDraft(n),this.form?.draft!==n)return;await a0({module:t.moduleKey,draft:i}).then((r)=>M(()=>{this.modules=this.modules.map((o)=>o.module===t.moduleKey?{...o,drafts:r.drafts}:o),this.setTabs(YA(this.tabs,{module:t.moduleKey,draft:i},{module:t.moduleKey,draft:n}))}),(r)=>M(()=>{this.formError=`renamed to '${n}', but the old draft '${i}' could not be removed: ${r instanceof Error?r.message:String(r)}`}))}deleteDraft(e){return this.trackSwitch(this.deleteDraftNow(e))}async deleteDraftNow(e){let t=N0(this.tabs,e,this.activeTab).next,n=this.form;if(n!=null&&n.moduleKey===e.module&&n.draft===e.draft)n.dispose({flush:!1}),M(()=>{this.form=null});try{let i=await a0(e);if(M(()=>{this.modules=this.modules.map((o)=>o.module===e.module?{...o,drafts:i.drafts}:o),this.setTabs(this.tabs.filter((o)=>o.module!==e.module||o.draft!==e.draft))}),this.form!=null)return;let r=i.drafts.includes("default")?"default":i.drafts[0]??"default";await this.select(t??{module:e.module,draft:r})}catch(i){M(()=>{this.formError=i instanceof Error?i.message:String(i)})}}async duplicateDraft(e){let t=this.form;if(t==null)return;await this.createDraft(e,t.valuesJSON())}duplicateCurrentDraft(){let e=this.form;if(e==null)return Promise.resolve();let t=this.moduleByKey(e.moduleKey)?.drafts??[e.draft];return this.duplicateDraft(NA(e.draft,t))}newDraftFromDefaults(){let e=this.form;if(e==null)return Promise.resolve();return this.newDraft(MA(this.moduleByKey(e.moduleKey)?.drafts??[]))}async newDraft(e){let t=this.form,n=t==null?null:this.moduleByKey(t.moduleKey);if(n==null)return;let i={};for(let[r,o]of Object.entries(n.vars))i[r]=o.default;await this.createDraft(e,i)}async createDraft(e,t){let n=this.form,i=e.trim();if(n==null||i==="")return;if(this.moduleByKey(n.moduleKey)?.drafts.includes(i)===!0&&!window.confirm(`draft '${i}' already exists — overwrite it?`))return;try{let o=await fc({module:n.moduleKey,draft:i,values:t});M(()=>{this.modules=this.modules.map((s)=>s.module===n.moduleKey?{...s,drafts:o.drafts}:s)}),await this.select({module:n.moduleKey,draft:i})}catch(o){M(()=>{this.formError=o instanceof Error?o.message:String(o)})}}}function bc(e){return y("section",{className:"menu-section",children:[y("div",{className:"menu-title",children:[p("span",{children:e.title}),e.actions==null?null:p("span",{className:"menu-title-actions",children:e.actions})]}),e.children]})}var qP=q(function(t){let n=t.st.moduleByKey(t.form.moduleKey)?.drafts??[t.form.draft],i=t.st.renamingDraft,r=()=>{let s=(i??"").trim();if(t.st.stopRename(),s!==""&&s!==t.form.draft)t.st.renameDraft(s)},o=t.form.dirtyCount;return y(bc,{title:"draft",actions:y(ie,{children:[o>0?p("button",{type:"button",className:"head-icon dirty","data-tip":`revert ${o} change${o>1?"s":""}: put back the values this draft loaded with`,onClick:()=>t.form.revertAll(),children:p(B,{name:"broom"})}):null,p($P,{form:t.form})]}),children:[i!=null?y("div",{className:"menu-row",children:[p(B,{name:"pen"}),p("input",{type:"text",autoFocus:!0,className:"head-input",value:i,placeholder:"new name, then enter",onFocus:(s)=>s.currentTarget.select(),onChange:(s)=>t.st.setRenaming(s.target.value),onKeyDown:(s)=>{if(s.key==="Enter")r();if(s.key==="Escape")t.st.stopRename()},onBlur:()=>t.st.stopRename()})]}):y("div",{className:"menu-row",children:[p("select",{className:"menu-select draft",value:t.form.draft,"data-tip":"switch draft",onChange:(s)=>void t.st.select({module:t.form.moduleKey,draft:s.target.value}),children:n.map((s)=>p("option",{value:s,children:s},s))}),p("span",{className:"menu-row-actions",children:p("button",{type:"button",className:"head-icon danger","data-tip":"delete this draft's file (default resets to the workflow's own values)",onClick:()=>{if(window.confirm(`delete draft '${t.form.draft}' of ${t.form.moduleKey}? the file is removed.`))t.st.deleteDraft({module:t.form.moduleKey,draft:t.form.draft})},children:p(B,{name:"trash"})})})]}),y("button",{type:"button",className:"menu-row menu-action","data-tip":"rename this draft (the file is renamed)",onClick:()=>t.st.startRename(),children:[p(B,{name:"pen"}),p("span",{children:"rename"}),p("span",{className:"kbd-hint",children:zh("rename-draft")})]}),y("button",{type:"button",className:"menu-row menu-action","data-tip":"a copy of the values on screen, as a new draft",onClick:()=>void t.st.duplicateCurrentDraft(),children:[p(B,{name:"copy-plus"}),p("span",{children:"duplicate"}),y("span",{className:"kbd-hint",children:[Me,Bt["duplicate-draft"]]})]}),y("button",{type:"button",className:"menu-row menu-action","data-tip":"a new draft with the workflow's own default values",onClick:()=>void t.st.newDraftFromDefaults(),children:[p(B,{name:"plus"}),p("span",{children:"new default"})]})]})}),$P=q(function(t){if(t.form.saveState==="error")return p("span",{className:"menu-note error","data-tip":t.form.saveError??"the last write failed",children:"NOT SAVED"});if(t.form.unsaved)return p("span",{className:"save-mark","data-tip":"saving…",children:p("span",{className:"spinner"})});return p("span",{className:"save-mark","data-tip":"saved",children:p(B,{name:"check"})})});function yR(e){if(e.value==null)return null;let t=e.value;return y("button",{type:"button",className:"menu-row path-row","data-tip":`${e.what}: ${t.path} (click to copy)`,"data-tip-side":"right",onClick:()=>void navigator.clipboard.writeText(t.path),children:[p(B,{name:e.icon}),p("span",{className:"path-text",children:p("bdi",{children:t.label})})]})}function U0(e){return y("div",{className:"menu-head",children:[p("button",{type:"button",className:"head-icon","data-tip":e.tip,"aria-label":"menu",onClick:e.onBurger,children:p(B,{name:"menu"})}),p("span",{className:"menu-brand",children:"comfy-ts"}),e.keyHint==null?null:p("span",{className:"kbd-hint menu-head-key",children:e.keyHint})]})}var j0=q(function(t){let n=t.st.form,i=Object.keys(t.st.loadErrors).length;return y("div",{className:"menu-sections",children:[y(bc,{title:"workspace",children:[p(yR,{what:"workspace (where .comfy-ts/ lives)",icon:"folder",value:t.st.workspace}),p(yR,{what:"root (the folder serve scans)",icon:"folder-tree",value:t.st.root})]}),n==null?null:y(ie,{children:[p(bc,{title:"workflow",actions:y(ie,{children:[i>0?y("button",{type:"button",className:"link load-errors","data-tip":"some workflows failed to load: the list is at the bottom of the search",onClick:()=>t.st.omnibox.open(),children:[p(B,{name:"warn"})," ",i]}):null,y("button",{type:"button",className:"head-icon","data-tip":`search every workflow and draft (${Me}K or ${Me}J)`,onClick:()=>t.st.omnibox.open(),children:[p(B,{name:"search"})," ",y("span",{className:"kbd-hint",children:[Me,"K"]})]})]}),children:y("button",{type:"button",className:"menu-row workflow-row","data-tip":`search every workflow and draft (${Me}K)`,onClick:()=>t.st.omnibox.open(),children:[p(B,{name:"workflow"}),p("span",{className:"menu-value",children:n.moduleKey})]})}),p(qP,{st:t.st,form:n}),y(bc,{title:t.st.hostWatch==="down"?"host · restarting…":t.st.hostWatch==="back"?"host · back up":"host",actions:y(ie,{children:[p("button",{type:"button",className:t.st.refreshing?"head-icon pulse":"head-icon","data-tip":t.st.refreshing?"refreshing what the host has…":"refresh what the host has (models, nodes, loras). It also refreshes by itself when something new appears",onClick:()=>void t.st.refreshHost(),children:p(B,{name:"refresh"})}),p("button",{type:"button",className:"head-icon danger","data-tip":"restart ComfyUI on that host (manager reboot) — it reconnects when back",onClick:()=>{if(window.confirm(`restart ComfyUI on '${t.st.hostFor(n.moduleKey)}'?`))t.st.hostAction("restart")},children:p(B,{name:"power"})})]}),children:[y("div",{className:"menu-row",children:[t.st.hosts.hosts.length>1?p("select",{className:"menu-select host",value:t.st.hostFor(n.moduleKey),"data-tip":"run this workflow on another host",onChange:(r)=>void t.st.setModuleHost({module:n.moduleKey,host:r.target.value}),children:t.st.hosts.hosts.map((r)=>p("option",{value:r.id,children:r.id===(t.st.hosts.defaults[n.moduleKey]??"")?`${r.id} (its own)`:r.id},r.id))}):p("span",{className:"menu-value host",children:t.st.hostFor(n.moduleKey)||n.host}),t.st.isHostOverridden(n.moduleKey)?p("span",{className:"menu-row-actions",children:p("button",{type:"button",className:"head-icon","data-tip":`runs on an override — back to ${t.st.hosts.defaults[n.moduleKey]??"its own host"}`,onClick:()=>void t.st.setModuleHost({module:n.moduleKey,host:null}),children:p(B,{name:"swap"})})}):null]}),y("div",{className:"menu-row menu-buttons",children:[y("button",{type:"button","data-tip":"interrupt the prompt running now",onClick:()=>void t.st.hostAction("interrupt"),children:[p(B,{name:"pause"})," stop"]}),y("button",{type:"button",className:"quiet-danger","data-tip":"drop everything still pending in the host queue",onClick:()=>void t.st.hostAction("clear-queue"),children:[p(B,{name:"trash"})," clear"]}),y("button",{type:"button",className:t.st.showLogs?"sel":"","data-tip":t.st.showLogs?"hide the ComfyUI console":"show the ComfyUI console of this host",onClick:()=>t.st.toggleLogs(),children:[p(B,{name:"terminal"})," console"]})]}),t.st.hostError!=null?y("div",{className:"error menu-error",children:["\uD83D\uDD34 ",t.st.hostError]}):null]})]}),p(bc,{title:"preview",children:p("div",{className:"layout-tiles",children:Yh.map((r)=>y("button",{type:"button",className:t.st.layout===r.id?"layout-tile sel":"layout-tile","data-tip":r.title,onClick:()=>t.st.setLayout(r.id),children:[p(B,{name:r.icon,size:1.8}),p("span",{children:r.label})]},r.id))})})]})}),xR=q(function(t){let n=[{icon:"folder",tip:`workspace: ${t.st.workspace?.label??"?"}`},{icon:"folder-tree",tip:`root: ${t.st.root?.label??"?"}`},{icon:"workflow",tip:`workflow: ${t.st.form?.moduleKey??"none"}`},{icon:"draft",tip:`draft: ${t.st.form?.draft??"none"}`},{icon:"server",tip:`host: ${t.st.hostFor(t.st.form?.moduleKey??"")||"none"}`},{icon:Yh.find((i)=>i.id===t.st.layout)?.icon??"panel-side",tip:`preview: ${Yh.find((i)=>i.id===t.st.layout)?.title??t.st.layout}`}];return y("div",{className:"menu-rail",children:[p("button",{type:"button",className:"head-icon","data-tip":`unfold the menu (${Me}B)`,"aria-label":"menu",onClick:t.onExpand,children:p(B,{name:"menu"})}),p("button",{type:"button",className:"head-icon","data-tip":`search (${Me}K)`,onClick:()=>t.st.omnibox.open(),children:p(B,{name:"search"})}),n.map((i)=>p("button",{type:"button",className:"head-icon","data-tip":i.tip,onClick:t.onExpand,children:p(B,{name:i.icon})},i.icon))]})});function wR(e){if(e.target.kind==="image")return{url:e.target.url,title:e.target.title,promptId:e.target.promptId};let t=e.target.module,n=e.results.filter((o)=>o.module===t),i=n.length>e.target.after?n[0]:void 0,r=i?.images.find((o)=>o.url!=null);if(!e.isRunning&&r?.url!=null)return{url:r.url,title:r.filename,promptId:i?.promptId??null};return{url:dc({module:t,tick:e.previewTick}),title:"latent preview",promptId:null}}async function SR(e){let t=await fetch(e);if(!t.ok)throw Error(`fetch failed (http ${t.status})`);let n=await t.blob(),i=n.type==="image/png"?n:await XP(n);await navigator.clipboard.write([new ClipboardItem({"image/png":i})])}async function XP(e){let t=await createImageBitmap(e),n=document.createElement("canvas");n.width=t.width,n.height=t.height;let i=n.getContext("2d");if(i==null)throw Error("canvas 2d context unavailable");return i.drawImage(t,0,0),await new Promise((r,o)=>{n.toBlob((s)=>{if(s==null)o(Error("png encode failed"));else r(s)},"image/png")})}var K0=q(function(t){if(!t.st.blurResults)return null;return y("span",{className:"blur-hint kbd-hint",children:[Me,Bt["toggle-blur"]]})}),kR=typeof navigator<"u"&&navigator.clipboard!=null;function GP(){return ra(()=>({copyNote:null,lightbox:null,zoom:1,panX:0,panY:0,setCopyNote(e,t){this.copyNote={url:e,text:t}},openLightbox(e){this.lightbox=e,this.resetZoom()},closeLightbox(){this.lightbox=null,this.resetZoom()},zoomBy(e,t){let n=Math.min(8,Math.max(1,this.zoom*e));if(n===this.zoom)return;let i=n/this.zoom;if(this.panX=t.x-(t.x-this.panX)*i,this.panY=t.y-(t.y-this.panY)*i,this.zoom=n,n===1)this.panX=0,this.panY=0},panBy(e,t){if(this.zoom===1)return;this.panX+=e,this.panY+=t},resetZoom(){this.zoom=1,this.panX=0,this.panY=0}}))}var YP=q(function(t){let n=t.local.lightbox,i=n==null?null:wR({target:n,isRunning:t.st.run.isRunning,previewTick:t.st.run.previewTick,results:t.st.run.results});Z(()=>{if(n==null)return;let s=(l)=>{if(l.key==="Escape")t.local.closeLightbox()};return window.addEventListener("keydown",s),()=>window.removeEventListener("keydown",s)},[n,t.local]);let r=X(null);if(Z(()=>{let s=r.current;if(s==null)return;let l=(a)=>{a.preventDefault();let u=s.getBoundingClientRect();t.local.zoomBy(a.deltaY<0?1.2:0.8333333333333334,{x:a.clientX-u.left-u.width/2,y:a.clientY-u.top-u.height/2})};return s.addEventListener("wheel",l,{passive:!1}),()=>s.removeEventListener("wheel",l)},[n,t.local]),i==null)return null;let o=()=>{SR(i.url).then(()=>t.local.setCopyNote(i.url,"copied ✓")).catch((s)=>t.local.setCopyNote(i.url,`copy failed: ${s instanceof Error?s.message:String(s)}`))};return p("div",{className:"modal-overlay",onClick:()=>t.local.closeLightbox(),children:y("div",{className:"lightbox",onClick:(s)=>s.stopPropagation(),children:[p("div",{ref:r,className:t.local.zoom>1?"zoom-view grabbing":"zoom-view",onDoubleClick:()=>t.local.resetZoom(),onPointerDown:(s)=>{if(t.local.zoom===1)return;s.currentTarget.setPointerCapture(s.pointerId)},onPointerMove:(s)=>{if(s.buttons!==1)return;t.local.panBy(s.movementX,s.movementY)},children:p("img",{src:i.url,alt:i.title,draggable:!1,style:{transform:`translate(${t.local.panX}px, ${t.local.panY}px) scale(${t.local.zoom})`}})}),y("div",{className:"lightbox-bar",children:[p("span",{className:"hint","data-tip":i.title,children:i.title}),t.local.zoom>1?y("button",{type:"button","data-tip":"back to fit (or double click the image)",onClick:()=>t.local.resetZoom(),children:[t.local.zoom.toFixed(1),"× · fit"]}):p("span",{className:"hint",children:"scroll to zoom"}),kR?p("button",{type:"button",onClick:o,children:"copy"}):null,p("a",{href:i.url,target:"_blank",rel:"noreferrer",children:"open ↗"}),i.promptId!=null?t.st.hostActions.map((s)=>{let l=t.st.run.results.find((u)=>u.promptId===i.promptId),a=l?.images.findIndex((u)=>u.url===i.url)??-1;if(l==null||a<0)return null;return p("button",{type:"button",className:"host-action","data-tip":s.title,onClick:()=>t.st.postResultAction(s.id,l,{url:i.url,filename:i.title},a),children:s.label},s.id)}):null,i.promptId!=null?p("button",{type:"button","data-tip":"remove this result",onClick:()=>{if(i.promptId!=null)t.st.run.remove(i.promptId);t.local.closeLightbox()},children:"delete"}):null,t.local.copyNote?.url===i.url?p("span",{className:"hint",children:t.local.copyNote.text}):null,p("button",{type:"button","data-tip":"close (esc)",onClick:()=>t.local.closeLightbox(),children:p(B,{name:"close"})})]})]})})});function _R(e){let t=e.indexOf("</think>");if(t===-1)return e.trimStart().startsWith("<think>")?{thinking:e.replace(/^\s*<think>/,"").trim(),answer:""}:{thinking:null,answer:e.trim()};let n=e.slice(0,t).replace(/^\s*<think>/,"").trim();return{thinking:n===""?null:n,answer:e.slice(t+8).trim()}}var WP=q(function(t){let n=ra(()=>({showThinking:!1,copied:!1,toggle(){this.showThinking=!this.showThinking},markCopied(){this.copied=!0}})),{thinking:i,answer:r}=_R(t.entry.text);return y("div",{className:"run-text",children:[y("div",{className:"run-text-head",children:[p("span",{className:"hint",children:t.entry.nodeKey??"text"}),i!=null?p("button",{type:"button",className:"link","data-tip":"the model's reasoning, before its answer",onClick:()=>n.toggle(),children:n.showThinking?"hide thinking":"thinking"}):null,kR?y("button",{type:"button",className:"link","data-tip":"copy this text",onClick:()=>{navigator.clipboard.writeText(r===""?t.entry.text:r),n.markCopied()},children:[p(B,{name:"copy"})," ",n.copied?"copied":""]}):null]}),i!=null&&n.showThinking?p("pre",{className:"run-thinking",children:i}):null,r===""?p("div",{className:"noimg",children:"the model reasoned past its token budget and never answered — raise max tokens"}):p("pre",{className:"run-text-body",children:r})]})}),QP=q(function(t){let{thinking:n,answer:i}=_R(t.text),r=X(null);Z(()=>{let s=r.current;if(s!=null)s.scrollTop=s.scrollHeight});let o=i!==""?i:n??"";return y("div",{className:"run-live",children:[i===""&&n!=null?p("span",{className:"hint",children:"thinking…"}):null,p("pre",{ref:r,className:i===""?"run-live-body dim":"run-live-body",children:o})]})}),JP=q(function(t){let n=t.st.run.progressPercent,i=t.st.run.progressNode,r=t.st.run.progressCount;return p("div",{className:"corner-run-anchor",children:y("div",{className:"corner-run",children:[t.st.run.hasPreview?y("button",{type:"button",className:"img-button","data-tip":"the latent so far: click to see it big",onClick:()=>t.local.openLightbox({kind:"latent",module:t.module,after:t.st.run.results.filter((o)=>o.module===t.module).length}),children:[p("img",{src:dc({module:t.module,tick:t.st.run.previewTick}),alt:"latent preview"}),p(K0,{st:t.st})]}):null,y("div",{className:"corner-run-meta",children:[y("span",{className:"run-meta-text",children:[i==null?t.module:i,r!=null?` ${r.value}/${r.max}`:""]}),p("span",{children:n!=null?`${Math.round(n)}%`:""})]}),p("div",{className:"progress-track",children:p("div",{className:"progress-fill",style:{width:`${n??0}%`}})})]})})}),ZP=q(function(t){let n=t.st.run.runningModule;if(!t.st.run.isRunning||n==null)return null;if(t.st.latentMode==="corner")return p(JP,{st:t.st,local:t.local,module:n});let i=t.st.run.progressPercent,r=dc({module:n,tick:t.st.run.previewTick}),o=t.st.run.progressNode,s=t.st.run.progressCount,l=t.st.run.progressText,a=t.st.form,u=a?.moduleKey===n?a.vars.find((h)=>h.desc.kind==="size"):void 0,c=u==null?null:vc(u.value),f=c!=null||t.st.run.hasPreview,d=c==null?1:c.width/c.height;return y("div",{className:f?"run-card running cell":"run-card running",children:[y("div",{className:"meta",children:[y("span",{className:"run-meta-text",children:["generating ",n,"…",o!=null?` · ${o}${s!=null?` ${s.value}/${s.max}`:""}`:""]}),p("span",{children:i!=null?`${Math.round(i)}%`:""})]}),l!=null&&l!==""?p(QP,{text:l}):null,f?y("div",{className:"run-frame",style:{aspectRatio:String(d),width:"100%"},children:[t.st.run.hasPreview&&t.st.latentMode==="full"?y("button",{type:"button",className:"img-button",onClick:()=>t.local.openLightbox({kind:"latent",module:n,after:t.st.run.results.filter((h)=>h.module===n).length}),children:[p("img",{src:r,alt:"latent preview"}),p(K0,{st:t.st})]}):null,p("div",{className:"progress-track over",children:p("div",{className:"progress-fill",style:{width:`${i??0}%`}})})]}):p("div",{className:"progress-track",children:p("div",{className:"progress-fill",style:{width:`${i??0}%`}})})]})}),CR=q(function(t){let n=GP();if(t.st.run.results.length===0&&!t.st.run.isRunning)return null;let i=t.compact===!0?t.st.run.results.slice(0,1):t.st.run.results;return y("div",{className:`gallery${t.st.blurResults?" blur":""}${t.compact===!0?"":" by-cols"}`,style:t.compact===!0?void 0:{gridTemplateColumns:`repeat(${t.st.resultsColumns}, minmax(0, 1fr))`},children:[p(ZP,{st:t.st,local:n}),i.map((r)=>y("div",{className:r.images.some((o)=>o.url!=null)?"run-card has-image":"run-card",children:[y("div",{className:"meta",children:[y("span",{className:"meta-text",children:[r.at," · ",r.module,"/",r.draft," · ",(r.durationMs/1000).toFixed(1),"s",Object.entries(r.seeds).map(([o,s])=>` · ${o}: ${s}`)]}),p("button",{type:"button",className:"link","data-tip":"remove this result",onClick:()=>t.st.run.remove(r.promptId),children:p(B,{name:"trash"})})]}),y("div",{className:"imgs",children:[r.images.map((o,s)=>o.url!=null?y("div",{className:"img-cell",children:[y("button",{type:"button",className:"img-button","data-tip":o.filename,onClick:()=>{if(o.url!=null)n.openLightbox({kind:"image",url:o.url,title:o.filename,promptId:r.promptId})},children:[p("img",{src:o.url,alt:o.filename}),p(K0,{st:t.st})]}),t.st.hostActions.length>0?y("div",{className:"host-actions",children:[t.st.hostActions.map((l)=>p("button",{type:"button",className:"host-action","data-tip":l.title,onClick:()=>{if(o.url!=null)t.st.postResultAction(l.id,r,{url:o.url,filename:o.filename},s)},children:l.label},l.id)),p("button",{type:"button",className:"host-action danger","data-tip":"remove this result",onClick:()=>t.st.run.remove(r.promptId),children:"✕"})]}):null]},o.filename):y("div",{className:"noimg",children:[o.filename," (not saved locally — no preview)"]},o.filename)),(r.audios??[]).map((o,s)=>o.url!=null?y("div",{className:"audio-cell",children:[p("audio",{controls:!0,preload:"metadata",src:o.url}),p("a",{className:"hint",href:o.url,download:o.filename,children:o.filename})]},`${r.promptId}-audio-${s}`):y("div",{className:"noimg",children:[o.filename," (not kept — no preview)"]},`${r.promptId}-audio-${s}`)),r.images.length===0&&(r.texts??[]).length===0&&(r.audios??[]).length===0?p("div",{className:"noimg",children:"no outputs"}):null]}),(r.texts??[]).map((o,s)=>p(WP,{entry:o},`${r.promptId}-${s}`))]},r.promptId)),p(YP,{st:t.st,local:n})]})});var eI={image:"image",audio:"audio",video:"video",text:"text"};function ER(e){for(let t of e){let n=eI[t];if(n!=null)return n}return"workflow"}var tI=new Set(["image","audio","video","text","llm","edit"]);function nI(e){let t=e.entry,n=["omni-row",t.kind,e.sel?"sel":"",e.open?"open":""].join(" ");if(t.kind==="draft")return y("button",{type:"button",className:n,onClick:e.onPick,children:[p(B,{name:"draft",size:0.95}),p("span",{className:"omni-draft",children:t.draft}),e.open?p("span",{className:"omni-open",children:"open"}):null]});return y("button",{type:"button",className:n,onClick:e.onPick,children:[p("span",{className:`omni-icon tint-${ER(t.tags)}`,children:p(B,{name:ER(t.tags)})}),y("span",{className:"omni-path",children:[t.folder===""?null:y("span",{className:"omni-folder",children:[t.folder," / "]}),p("span",{className:"omni-name",children:t.module})]}),y("span",{className:"omni-tags",children:[t.tags.map((i)=>p("span",{className:["omni-tag",tI.has(i)?`tint-${i}`:"",e.words.includes(i)?"hit":""].join(" "),children:i},i)),p("span",{className:"omni-host",children:t.host})]})]})}function OR(e){Z(()=>{let t=(n)=>{if(!EO(n))return;n.preventDefault(),e.omnibox.toggle()};return window.addEventListener("keydown",t),()=>window.removeEventListener("keydown",t)},[e])}var AR=q(function(t){let n=t.st.omnibox,i=X(null);if(Z(()=>{i.current?.querySelector(".omni-row.sel")?.scrollIntoView({block:"nearest"})},[n.cursor,n.query]),!n.isOpen)return null;let r=n.results,o=Object.entries(t.st.loadErrors),s=t.st.form,l=n.query.trim().toLowerCase().split(/\s+/);return p("div",{className:"modal-overlay omni-overlay",onClick:()=>n.close(),children:y("div",{className:"modal omni",onClick:(a)=>a.stopPropagation(),children:[p("div",{className:"modal-head",children:p("input",{type:"text",autoFocus:!0,placeholder:"workflow, draft or tag (audio, image, edit…)",value:n.query,onChange:(a)=>n.setQuery(a.target.value),onKeyDown:(a)=>{if(a.key==="ArrowDown")n.move(1);else if(a.key==="ArrowUp")n.move(-1);else if(a.key==="Enter")n.pick();else if(a.key==="Escape")n.close();else return;a.preventDefault()}})}),y("div",{className:"modal-body omni-list",ref:i,children:[r.length===0?p("div",{className:"hint",children:"no workflow or draft matches"}):null,r.map((a,u)=>p(nI,{entry:a,sel:u===n.cursor,open:a.kind==="draft"&&s?.moduleKey===a.module&&s.draft===a.draft,words:l,onPick:()=>n.pick(a)},AA(a))),o.length>0?y("div",{className:"omni-errors",children:[p("div",{className:"section-title",children:"failed to load"}),o.map(([a,u])=>y("div",{children:[p("div",{className:"file",children:a}),p("div",{className:"msg",children:u})]},a))]}):null]})]})})});function Wh(){return typeof window<"u"}function Ro(e){if(Qh(e))return(e.nodeName||"").toLowerCase();return"#document"}function It(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Ji(e){var t;return(t=(Qh(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function Qh(e){if(!Wh())return!1;return e instanceof Node||e instanceof It(e).Node}function Je(e){if(!Wh())return!1;return e instanceof Element||e instanceof It(e).Element}function qn(e){if(!Wh())return!1;return e instanceof HTMLElement||e instanceof It(e).HTMLElement}function yc(e){if(!Wh()||typeof ShadowRoot>"u")return!1;return e instanceof ShadowRoot||e instanceof It(e).ShadowRoot}function xc(e){let{overflow:t,overflowX:n,overflowY:i,display:r}=Sn(e);return/auto|scroll|overlay|hidden|clip/.test(t+i+n)&&r!=="inline"&&r!=="contents"}function RR(e){return/^(table|td|th)$/.test(Ro(e))}function wc(e){try{if(e.matches(":popover-open"))return!0}catch(t){}try{return e.matches(":modal")}catch(t){return!1}}var iI=/transform|translate|scale|rotate|perspective|filter/,rI=/paint|layout|strict|content/,Ts=(e)=>!!e&&e!=="none",F0;function Jh(e){let t=Je(e)?Sn(e):e;return Ts(t.transform)||Ts(t.translate)||Ts(t.scale)||Ts(t.rotate)||Ts(t.perspective)||!pa()&&(Ts(t.backdropFilter)||Ts(t.filter))||iI.test(t.willChange||"")||rI.test(t.contain||"")}function TR(e){let t=Qi(e);while(qn(t)&&!Zi(t)){if(Jh(t))return t;else if(wc(t))return null;t=Qi(t)}return null}function pa(){if(F0==null)F0=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none");return F0}function Zi(e){return/^(html|body|#document)$/.test(Ro(e))}function Sn(e){return It(e).getComputedStyle(e)}function Sc(e){if(Je(e))return{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop};return{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Qi(e){if(Ro(e)==="html")return e;let t=e.assignedSlot||e.parentNode||yc(e)&&e.host||Ji(e);return yc(t)?t.host:t}function MR(e){let t=Qi(e);if(Zi(t))return(e.ownerDocument||e).body;if(qn(t)&&xc(t))return t;return MR(t)}function wn(e,t,n){var i;if(t===void 0)t=[];if(n===void 0)n=!0;let r=MR(e),o=r===((i=e.ownerDocument)==null?void 0:i.body),s=It(r);if(o){let l=Zh(s);return t.concat(s,s.visualViewport||[],xc(r)?r:[],l&&n?wn(l):[])}else return t.concat(r,wn(r,[],n))}function Zh(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}var{min:ma,max:Lr,round:_c,floor:Cc}=Math,er=(e)=>({x:e,y:e}),oI={left:"right",right:"left",bottom:"top",top:"bottom"};function LR(e,t,n){return Lr(e,ma(t,n))}function Ec(e,t){return typeof e==="function"?e(t):e}function Ms(e){return e.split("-")[0]}function Oc(e){return e.split("-")[1]}function q0(e){return e==="x"?"y":"x"}function $0(e){return e==="y"?"height":"width"}function zr(e){let t=e[0];return t==="t"||t==="b"?"y":"x"}function X0(e){return q0(zr(e))}function zR(e,t,n){if(n===void 0)n=!1;let i=Oc(e),r=X0(e),o=$0(r),s=r==="x"?i===(n?"end":"start")?"right":"left":i==="start"?"bottom":"top";if(t.reference[o]>t.floating[o])s=kc(s);return[s,kc(s)]}function BR(e){let t=kc(e);return[ep(e),t,ep(t)]}function ep(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}var NR=["left","right"],DR=["right","left"],sI=["top","bottom"],lI=["bottom","top"];function aI(e,t,n){switch(e){case"top":case"bottom":if(n)return t?DR:NR;return t?NR:DR;case"left":case"right":return t?sI:lI;default:return[]}}function PR(e,t,n,i){let r=Oc(e),o=aI(Ms(e),n==="start",i);if(r){if(o=o.map((s)=>s+"-"+r),t)o=o.concat(o.map(ep))}return o}function kc(e){let t=Ms(e);return oI[t]+e.slice(t.length)}function uI(e){var t,n,i,r;return{top:(t=e.top)!=null?t:0,right:(n=e.right)!=null?n:0,bottom:(i=e.bottom)!=null?i:0,left:(r=e.left)!=null?r:0}}function IR(e){return typeof e!=="number"?uI(e):{top:e,right:e,bottom:e,left:e}}function Ns(e){let{x:t,y:n,width:i,height:r}=e;return{width:i,height:r,top:n,left:t,right:t+i,bottom:n+r,x:t,y:n}}/*!
18
+ `)}function RR(e){return Sc(e)&&!("lanes"in e)&&Object.values(e).every((t)=>t==null||Fh(t))}function $P(e){return Sc(e)&&typeof e.name==="string"&&typeof e.active==="boolean"&&RR(e.loras)}function hi(e){return Sc(e)&&Array.isArray(e.lanes)&&e.lanes.every($P)}function $h(e){return RR(e)||hi(e)}function AR(e){if(!hi(e))return{record:e,duplicates:[]};let t={},n=[];for(let i of e.lanes){if(!i.active)continue;for(let[r,o]of Object.entries(i.loras)){if(o==null)continue;if(r in t)n.push(r);else t[r]=o}}return{record:t,duplicates:n}}function TR(e){return hi(e)?e:{lanes:[{name:Ry,active:!0,loras:e}]}}function Xh(e){let t=e.lanes[0];return e.lanes.length===1&&t!=null&&t.active?t.loras:null}function MR(e,t){let n=e.lanes.findIndex((i)=>i.active&&i.loras[t]!=null);return n!==-1?n:e.lanes.findIndex((i)=>i.loras[t]!=null)}function NR(e,t,n){let i=(s)=>{let l={...s};if(n==null)delete l[t];else l[t]=n;return l};if(!hi(e))return i(e);if(e.lanes.length===0)return{lanes:[{name:Ry,active:!0,loras:i({})}]};let r=MR(e,t),o=r===-1?0:r;return{lanes:e.lanes.map((s,l)=>l===o?{...s,loras:i(s.loras)}:s)}}function kc(e){let t=new Set(e.map((i)=>i.name)),n=e.length+1;while(t.has(`lane ${n}`))n++;return`lane ${n}`}function pi(e,t,n){return e.map((i,r)=>r===t?{...i,...n}:i)}function Gh(e,t,n){let i=t+n;if(t<0||t>=e.length||i<0||i>=e.length)return[...e];let r=[...e],[o]=r.splice(t,1);if(o!=null)r.splice(i,0,o);return r}function Yh(e,t){return e.filter((n,i)=>i!==t)}function DR(e,t){let n=e.lanes[t.from],i=n?.loras[t.name];if(n==null||i==null||e.lanes[t.to]==null)return e;let r=e.lanes.map((u)=>({...u,loras:{...u.loras}})),o=r[t.from],s=r[t.to];if(o==null||s==null)return e;delete o.loras[t.name];let l={},a=!1;for(let[u,c]of Object.entries(s.loras)){if(u===t.beforeName&&!a)l[t.name]=i,a=!0;l[u]=c}if(!a)l[t.name]=i;return s.loras=l,{lanes:r}}function Ay(e,t){if(!hi(e))return e[t];return e.lanes[MR(e,t)]?.loras[t]}function LR(e){let t=new Map,n=hi(e)?e.lanes:[{name:"",active:!0,loras:e}];for(let i of n)for(let[r,o]of Object.entries(i.loras)){if(o==null||o===!1)continue;let s=i.active&&va(o),l=t.get(r);if(l==null||!l.running&&s)t.set(r,{name:r,setting:o,running:s})}return[...t.values()]}var BR="comfy-ts-serve-enhancer",PR=["openrouter","openwebui","openai"];function zR(e){let t=typeof e==="object"&&e!==null?e:{};return{keyByProvider:vy(t.keyByProvider),configName:typeof t.configName==="string"?t.configName:"",presetName:typeof t.presetName==="string"?t.presetName:"",presetByModule:vy(t.presetByModule)}}function Wh(e,t){if(!t.includes(e))return e;for(let n=2;n<1000;n++){let i=`${e} ${n}`;if(!t.includes(i))return i}return`${e} ${t.length+1}`}function XP(e,t){let n=(o)=>o.toLowerCase().split(/[^a-z0-9]+/).filter((s)=>s.length>2&&!/^\d+$/.test(s)),i=new Set(n(e)),r=null;for(let o of t){let s=n(o).filter((l)=>i.has(l)).length;if(s===0)continue;if(r==null||s>r.score||s===r.score&&o.length<r.name.length)r={name:o,score:s}}return r?.name??null}function GP(e,t){if(t!=null)return Dr(e)?e.lanes[t]?.prompt??"":"";return typeof e==="string"?e:""}function YP(e,t,n){if(t!=null&&Dr(e))return{lanes:pi(e.lanes,t,{prompt:n})};return n}function WP(e){let t=e.result.trim();if(!e.open||e.target==null||t==="")return;return{[e.target.name]:YP(e.target.value,e.lane,t)}}function QP(e){return e.previous!==""?e.previous:e.prompt}function JP(){try{return zR(JSON.parse(localStorage.getItem(BR)??"{}"))}catch{return zR({})}}class Ty{getForm;keyByProvider;configName;presetName;presetByModule;configs=[];configsState="idle";configsError="";configSaveState="saved";configSaveError="";presets=[];presetsState="idle";presetsError="";saveState="saved";saveError="";configStatus=new Map;configStatusError=new Map;models=[];modelsState="idle";modelsError="";editing=null;inputHistory=[];target=null;targetLane=null;targetModule="";result="";thinking="";phase="idle";error="";abort=null;disposers;lastSaved="";lastSavedConfig="";constructor(e=()=>null){this.getForm=e;let t=JP();this.keyByProvider=t.keyByProvider,this.configName=t.configName,this.presetName=t.presetName,this.presetByModule=t.presetByModule,ci(this,{abort:!1,disposers:!1,lastSaved:!1,lastSavedConfig:!1,getForm:!1}),this.disposers=[Tr(()=>{let n=this.preset;return n==null?null:JSON.stringify(n)},(n)=>{if(n==null||n===this.lastSaved)return;this.savePresetNow(JSON.parse(n))},{delay:600}),Tr(()=>{let n=this.configEntry;return n==null?null:JSON.stringify(n)},(n)=>{if(n==null||n===this.lastSavedConfig)return;this.saveConfigNow(JSON.parse(n))},{delay:600})]}dispose(){for(let e of this.disposers)e()}get configEntry(){return this.configs.find((e)=>e.name===this.configName)??this.configs[0]??null}get config(){return this.configEntry?.config??wy({})}get provider(){return this.config.provider}get apiKey(){return this.keyByProvider[this.provider]??""}get baseUrl(){return this.config.baseUrl}get model(){return this.config.model}get effort(){return this.config.effort}get thinkingOnly(){return this.config.thinkingOnly}get endpoint(){return{provider:this.provider,baseUrl:this.baseUrl,key:this.apiKey}}get visibleModels(){return this.thinkingOnly?this.models.filter((e)=>e.reasoning!==!1):this.models}get preset(){return this.presets.find((e)=>e.name===this.presetName)??this.presets[0]??null}get isOpen(){return this.target!=null}settingsJSON(){return{keyByProvider:this.keyByProvider,configName:this.configName,presetName:this.presetName,presetByModule:this.presetByModule}}persist(){try{localStorage.setItem(BR,JSON.stringify(this.settingsJSON()))}catch{}}async loadConfigs(){N(()=>{this.configsState="loading",this.configsError=""});try{let e=await oR();N(()=>{if(this.configs=e.configs,this.configsState="idle",!this.configs.some((t)=>t.name===this.configName))this.configName=this.configs[0]?.name??"";this.lastSavedConfig=JSON.stringify(this.configEntry)}),this.probeConfigs()}catch(e){N(()=>{this.configsState="error",this.configsError=e instanceof Error?e.message:String(e)})}}async saveConfigNow(e){N(()=>{this.configSaveState="saving",this.lastSavedConfig=JSON.stringify(e)});try{let t=await sR(e);N(()=>{this.configs=t.configs.map((n)=>this.configs.find((i)=>i.name===n.name)??n),this.configSaveState="saved",this.configSaveError=""})}catch(t){N(()=>{this.configSaveState="error",this.configSaveError=t instanceof Error?t.message:String(t)})}}async probeConfigs(){let e=this.configs.map((t)=>({name:t.name,config:t.config}));await Promise.all(e.map(async(t)=>{N(()=>this.configStatus.set(t.name,"checking"));let n={provider:t.config.provider,baseUrl:t.config.baseUrl,key:this.keyByProvider[t.config.provider]??""};try{let i=await by(n);N(()=>{if(this.configStatus.set(t.name,"up"),this.configStatusError.delete(t.name),t.name===this.configEntry?.name&&this.models.length===0)this.models=i,this.modelsState="idle"})}catch(i){N(()=>{this.configStatus.set(t.name,"down"),this.configStatusError.set(t.name,i instanceof Error?i.message:String(i))})}}))}selectConfig(e){if(!this.configs.some((t)=>t.name===e))return;if(this.configName=e,this.lastSavedConfig=JSON.stringify(this.configEntry),this.clearModels(),this.persist(),this.configStatus.get(e)==="up")this.loadModels()}addConfig(e,t=wy({})){if(e.trim()==="")return;let n=Wh(e.trim(),this.configs.map((i)=>i.name));this.configs=[...this.configs,{name:n,config:t}],this.configName=n,this.clearModels(),this.persist(),this.saveConfigNow({name:n,config:t})}duplicateConfig(){let e=this.configEntry;if(e!=null)this.addConfig(ma(e.name,this.configs.map((t)=>t.name)),e.config)}async renameConfig(e){let t=this.configEntry,n=Wh(e.trim(),this.configs.filter((i)=>i.name!==t?.name).map((i)=>i.name));if(t==null||n===""||n===t.name)return;await this.saveConfigNow({name:n,config:t.config}),N(()=>{this.configName=n,this.persist()}),await this.removeConfigFile(t.name)}async deleteConfig(){let e=this.configEntry;if(e==null)return;await this.removeConfigFile(e.name),N(()=>{if(!this.configs.some((t)=>t.name===this.configName))this.configName=this.configs[0]?.name??"";this.lastSavedConfig=JSON.stringify(this.configEntry),this.persist()})}async removeConfigFile(e){try{let t=await lR({name:e});N(()=>{this.configs=t.configs})}catch(t){N(()=>{this.configSaveState="error",this.configSaveError=t instanceof Error?t.message:String(t)})}}patchConfig(e){let t=this.configEntry;if(t==null){this.addConfig("default",e(this.config));return}this.configs=this.configs.map((n)=>n.name===t.name?{name:n.name,config:e(n.config)}:n)}clearModels(){this.models=[],this.modelsState="idle",this.modelsError=""}setProvider(e){if(!yy(e))return;this.patchConfig((t)=>bR(t,e)),this.clearModels()}setApiKey(e){this.keyByProvider[this.provider]=e.trim(),this.persist()}setBaseUrl(e){this.patchConfig((t)=>({...t,baseUrl:e.trim()}))}setModel(e){this.patchConfig((t)=>({...t,model:e}))}setEffort(e){if(!xy(e))return;this.patchConfig((t)=>({...t,effort:e}))}toggleThinkingOnly(){this.patchConfig((e)=>({...e,thinkingOnly:!e.thinkingOnly}))}async loadPresets(){N(()=>{this.presetsState="loading",this.presetsError=""});try{let e=await nR();N(()=>{if(this.presets=e.enhancers,this.presetsState="idle",!this.presets.some((t)=>t.name===this.presetName))this.presetName=this.presets[0]?.name??"";this.lastSaved=JSON.stringify(this.preset)})}catch(e){N(()=>{this.presetsState="error",this.presetsError=e instanceof Error?e.message:String(e)})}}async savePresetNow(e){N(()=>{this.saveState="saving",this.lastSaved=JSON.stringify(e)});try{let t=await iR(e);N(()=>{this.presets=t.enhancers,this.saveState="saved",this.saveError=""})}catch(t){N(()=>{this.saveState="error",this.saveError=t instanceof Error?t.message:String(t)})}}selectPreset(e){if(!this.presets.some((t)=>t.name===e))return;if(this.presetName=e,this.lastSaved=JSON.stringify(this.preset),this.targetModule!=="")this.presetByModule[this.targetModule]=e;this.persist()}setPresetText(e){let t=this.preset;if(t==null)return;this.presets=this.presets.map((n)=>n.name===t.name?{...n,text:e}:n)}addPreset(e,t=""){if(e.trim()==="")return;let n=Wh(e.trim(),this.presets.map((i)=>i.name));this.presets=[...this.presets,{name:n,text:t}],this.presetName=n,this.persist(),this.savePresetNow({name:n,text:t})}duplicatePreset(){let e=this.preset;if(e!=null)this.addPreset(ma(e.name,this.presets.map((t)=>t.name)),e.text)}async renamePreset(e){let t=this.preset,n=Wh(e.trim(),this.presets.filter((i)=>i.name!==t?.name).map((i)=>i.name));if(t==null||n===""||n===t.name)return;await this.savePresetNow({name:n,text:t.text}),N(()=>{this.presetName=n,this.persist()}),await this.removePresetFile(t.name)}async deletePreset(){let e=this.preset;if(e==null)return;await this.removePresetFile(e.name),N(()=>{for(let[t,n]of Object.entries(this.presetByModule))if(n===e.name)delete this.presetByModule[t];if(!this.presets.some((t)=>t.name===this.presetName))this.presetName=this.presets[0]?.name??"";this.persist()})}async removePresetFile(e){try{let t=await rR({name:e});N(()=>{this.presets=t.enhancers})}catch(t){N(()=>{this.saveState="error",this.saveError=t instanceof Error?t.message:String(t)})}}openFor(e){this.target=e.v,this.targetLane=e.lane??null,this.targetModule=e.module,this.error="";let t=this.presetByModule[e.module];if(t!=null)this.presetName=t;if(this.presets.length===0)this.loadPresets().then(()=>this.guessFor(e.module));else this.guessFor(e.module);this.loadConfigs()}guessFor(e){if(this.presetByModule[e]!=null)return;let t=XP(e,this.presets.map((n)=>n.name));if(t==null)return;this.presetName=t,this.lastSaved=JSON.stringify(this.preset)}setEditing(e){this.editing=e}get tryOverride(){return WP({open:this.isOpen,target:this.target,lane:this.targetLane,result:this.result})}get intentKey(){return this.target==null?null:yR(this.target.name,this.targetLane)}get original(){let e=this.intentKey;if(e==null||this.target==null)return"";return QP({previous:this.getForm()?.intentFor(e)??"",prompt:GP(this.target.value,this.targetLane)})}usePrompt(){let e=this.intentKey;if(e!=null)this.getForm()?.setIntent(e,"")}close(){this.editing=null,this.cancel(),this.target=null,this.targetLane=null,this.targetModule=""}setResult(e){this.result=e}setOriginal(e){let t=this.intentKey;if(t!=null)this.getForm()?.setIntent(t,e)}async loadModels(){N(()=>{this.modelsState="loading",this.modelsError=""});try{let e=await by(this.endpoint);N(()=>{this.models=e,this.modelsState="idle";let t=this.configEntry?.name;if(t!=null)this.configStatus.set(t,"up")})}catch(e){N(()=>{this.modelsState="error",this.modelsError=e instanceof Error?e.message:String(e);let t=this.configEntry?.name;if(t!=null)this.configStatus.set(t,"down")})}}cancel(){if(this.abort?.abort(),this.abort=null,this.phase==="running")this.phase=this.result===""?"idle":"done"}run(){this.runNow()}async runNow(){let e=this.preset;if(e==null||this.phase==="running")return;let t=new AbortController;this.abort=t;let n=wR(this.original);this.inputHistory=jh(this.inputHistory,{text:this.original,value:this.original,at:Date.now(),source:this.targetModule}),N(()=>{this.phase="running",this.error="",this.result="",this.thinking=""});try{await gR({endpoint:this.endpoint,model:this.model,system:e.text,user:n.body,effort:this.effort,signal:t.signal,onDelta:(i)=>N(()=>{this.result+=i.content,this.thinking+=i.reasoning})}),N(()=>{this.result=_y(this.result,n.kept),this.phase="done"})}catch(i){let r=t.signal.aborted;N(()=>{if(r&&this.result!=="")this.result=_y(this.result,n.kept);if(this.phase=r?this.result===""?"idle":"done":"error",!r)this.error=i instanceof Error?i.message:String(i)})}finally{if(this.abort===t)this.abort=null}}apply(){let e=this.result.trim();if(this.target==null||e==="")return;let t=this.target.value,n=this.targetLane;if(n!=null&&Dr(t))this.target.set({lanes:pi(t.lanes,n,{prompt:e})});else this.target.set(e);this.close()}}function ZP(e){return e.split(/[/\\]/).filter((t)=>t!=="")}function eI(e){return ZP(e).slice(0,-1)}function tI(e){let t=e[0];if(t==null)return[];let n=[];for(let i=0;i<t.length;i++){let r=t[i];if(r==null||!e.every((o)=>o[i]===r))break;n.push(r)}return n}function IR(e){if(e.length===0)return[];let t=e.map((o)=>eI(o.file)),n=tI(t),i=Math.max(0,n.length-1),r=new Map;for(let[o,s]of e.entries()){let l=(t[o]??[]).slice(i).join("/"),a=r.get(l);if(a==null)r.set(l,[s]);else a.push(s)}return[...r.entries()].map(([o,s])=>({folder:o,modules:[...s].sort((l,a)=>l.module.localeCompare(a.module))})).sort((o,s)=>o.folder.localeCompare(s.folder))}function HR(e){return`${e.kind}:${e.module}/${e.draft}`}function VR(e){let t=[];for(let n of IR(e))for(let i of n.modules){let r=i.drafts.length>0?i.drafts:["default"],o={module:i.module,host:i.host,folder:n.folder,tags:i.tags??[]};t.push({kind:"workflow",draft:r[0]??"default",...o});for(let s of r)t.push({kind:"draft",draft:s,...o})}return t}function nI(e){return e==null||e==="/"||e==="-"||e==="_"||e===" "||e==="."}function iI(e,t,n){let i=0,r=n-1;for(let o of e){let s=t.indexOf(o,r+1);if(s<0)return null;if(i+=1,s===r+1)i+=3;if(nI(t[s-1]))i+=5;i-=(s-r-1)*0.05,r=s}return i}function My(e,t){let n=e.toLowerCase().replace(/\s+/g,"");if(n==="")return 0;let i=t.toLowerCase(),r=null;for(let o=i.indexOf(n[0]??"");o>=0;o=i.indexOf(n[0]??"",o+1)){let s=iI(n,i,o);if(s!=null&&(r==null||s>r))r=s}return r}function rI(e){let t=[];for(let n of e)if(n.kind==="workflow")t.push({head:n,drafts:[],ix:t.length});else t.at(-1)?.drafts.push(n);return t}var Ny=(e,t)=>e==null?t:t==null?e:Math.max(e,t),oI=2.5;function UR(e,t){let n=t.trim().toLowerCase().split(/\s+/).filter((l)=>l!=="");if(n.length===0)return[...e];let i=new Set(e.flatMap((l)=>l.tags)),r=n.filter((l)=>i.has(l)),o=n.filter((l)=>!i.has(l)).join(""),s=[];for(let l of rI(e)){if(!r.every((b)=>l.head.tags.includes(b)))continue;if(o===""){s.push({group:l,score:0,rows:[l.head,...l.drafts]});continue}let a=`${l.head.folder}/${l.head.module} ${l.head.tags.join(" ")}`,u=(b)=>b!=null&&b>=o.length*oI?b:null,c=u(My(o,a)),f=l.drafts.map((b)=>{let x=u(My(o,b.draft));return{d:b,own:x,score:Ny(x==null?null:x+2,u(My(o,`${a}/${b.draft}`)))}}).filter((b)=>b.score!=null),d=f.filter((b)=>b.own!=null),h=Ny(c,f.reduce((b,x)=>Ny(b,x.score),null));if(h==null)continue;let m=d.length>0?[...d].sort((b,x)=>x.score-b.score).map((b)=>b.d):l.drafts;s.push({group:l,score:h,rows:[l.head,...m]})}return s.sort((l,a)=>a.score-l.score||l.group.ix-a.group.ix),s.flatMap((l)=>l.rows)}class Dy{st;isOpen=!1;query="";cursor=0;constructor(e){this.st=e;ci(this,{st:!1})}get results(){return UR(VR(this.st.modules),this.query)}open(){this.isOpen=!0,this.query="";let e=this.st.form,t=e==null?-1:this.results.findIndex((n)=>n.kind==="draft"&&n.module===e.moduleKey&&n.draft===e.draft);this.cursor=Math.max(0,t)}close(){this.isOpen=!1}toggle(){if(this.isOpen)this.close();else this.open()}setQuery(e){this.query=e,this.cursor=0}move(e){let t=this.results.length;if(t===0)return;this.cursor=(this.cursor+e+t)%t}pick(e=this.results[this.cursor]){if(e==null)return;this.close(),this.st.select({module:e.module,draft:e.draft})}}function KR(e){if(!e.includes("new"))return"new";let t=2;while(e.includes(`new ${t}`))t++;return`new ${t}`}function jR(e,t){return ma(e,t)}var FR=[{mode:"corner",tip:"latent small, in a corner: the last image stays where it is, the new one lands at once when done"},{mode:"full",tip:"latent full size, in the running card at the top of the results"},{mode:"off",tip:"no latent: a progress bar, then the image"}];function qR(e){if(e==="full"||e==="corner"||e==="off")return e;if(e===!1)return"off";return"corner"}function $R(e){return e.length>0&&e.length<=5&&e.every((t)=>t.length<=16)}function Qh(e){if(typeof e==="string")return[e];if(Array.isArray(e))return e.filter((t)=>typeof t==="string");return[]}function XR(e){if(e.select==="one")return e.c;let t=Qh(e.value);if(e.select==="zero-or-one")return t.includes(e.c)?null:e.c;let n=t.includes(e.c);return e.choices.filter((i)=>i===e.c?!n:t.includes(i))}function GR(e){let t=(n)=>typeof n==="string"&&e.choices.includes(n);if(e.select==="many")return Array.isArray(e.raw)&&e.raw.every(t)?{ok:!0,value:e.choices.filter((n)=>Array.isArray(e.raw)&&e.raw.includes(n))}:{ok:!1};if(e.select==="zero-or-one")return e.raw===null||t(e.raw)?{ok:!0,value:e.raw}:{ok:!1};return t(e.raw)?{ok:!0,value:e.raw}:{ok:!1}}function YR(e){let t=Qh(e.raw).filter((n)=>e.choices.includes(n));if(e.select==="many")return e.choices.filter((n)=>t.includes(n));if(e.select==="zero-or-one")return t[0]??null;return typeof e.raw==="string"?e.raw:t[0]??null}function WR(e){let t={};for(let n of e)if(n.kind!=="seed")t[n.name]=n.value;return t}function Ms(e){if(typeof e==="number"&&Number.isFinite(e))return{mode:"=",value:e};if(e!=null&&typeof e==="object"){let t=e;return{mode:typeof t.mode==="string"?t.mode:"=",value:typeof t.value==="number"&&Number.isFinite(t.value)?t.value:0}}return{mode:"=",value:0}}function _c(e){if(e!=null&&typeof e==="object"){let t=e;if(typeof t.width==="number"&&typeof t.height==="number")return{width:t.width,height:t.height}}return{width:1024,height:1024}}function ba(e,t){if(e==null||typeof e!=="object"||Array.isArray(e))return{};let n=new Set(t),i={};for(let[r,o]of Object.entries(e))if(n.has(r)&&Fh(o)&&Cy(o))i[r]=o;return i}function sI(e,t){if(hi(e))return{lanes:e.lanes.map((n)=>({...n,loras:ba(n.loras,t)}))};return ba(e,t)}function Ly(e,t){if(e.kind==="seed")return Ms(t??e.default);if(e.kind==="size")return _c(t??e.default);if(e.kind==="loras")return sI(t??e.default,e.options??[]);if(e.kind==="choice")return YR({select:e.select??"one",choices:e.choices??[],raw:t??e.default});return t??e.default}function QR(){return Math.floor(Math.random()*4294967296)}function JR(e){return va(e)}function ZR(e){let[t,n]=Ey(e);return{model:t,clip:n}}function eA(e,t,n){return{...e,[t]:wc(e[t],{on:n})}}function tA(e){let t=new Set(e.options);return Object.keys(e.record).filter((n)=>t.has(n)&&Cy(e.record[n]))}function nA(e){let t=[...e.displayed],[n]=t.splice(e.from,1);if(n==null)return e.record;t.splice(e.to,0,n);let i={};for(let r of t)if(r in e.record)i[r]=e.record[r];for(let[r,o]of Object.entries(e.record))if(!(r in i))i[r]=o;return i}function iA(e,t,n){return{...e,[t]:wc(e[t],{strength:[n.model,n.clip]})}}class oA{name;desc;initial;value;dirty=!1;uploadedUrl=null;constructor(e,t,n){this.name=e;this.desc=t;this.initial=n;this.value=n,ci(this,{value:oa,name:!1,desc:!1})}set(e){this.value=e,this.dirty=!0}setFromRun(e){this.value=e,this.initial=e,this.dirty=!1}setUploadedUrl(e){this.uploadedUrl=e}get defaultValue(){return Ly(this.desc,this.desc.default)}get isAtDefault(){return JSON.stringify(this.value)===JSON.stringify(this.defaultValue)}resetToDefault(){this.set(this.defaultValue)}revert(){this.value=this.initial,this.dirty=!1,this.uploadedUrl=null}snapshot(){return{name:this.name,value:this.value}}}var zy={autosaveMs:500,previewMs:250};class By{moduleKey;draft;vars;host;saveState="saved";saveError=null;disposers=[];saveChain=Promise.resolve(!0);lastSaved;lastQueued;queueSeq=0;onSettled=null;previews={};previewError=null;previewAbort=null;constructor(e,t,n,i,r=zy){this.moduleKey=e;this.draft=t;if(this.host=n.host,this.vars=Object.entries(n.vars).map(([s,l])=>new oA(s,l,Ly(l,i[s]))),this.intents=xR(i[Sy]),this.lastSaved=JSON.stringify(rA(Object.fromEntries(this.vars.map((s)=>[s.name,i[s.name]])),this.intents)),this.lastQueued=this.lastSaved,ci(this,{vars:!1,moduleKey:!1,draft:!1,host:!1,disposers:!1,saveChain:!1,lastSaved:!0,lastQueued:!1,queueSeq:!1,onSettled:!1,previewAbort:!1}),this.disposers.push(Tr(()=>JSON.stringify(this.valuesJSON()),()=>{this.save(),this.onSettled?.()},{delay:r.autosaveMs})),(n.previews??[]).length>0)this.disposers.push(Tr(()=>JSON.stringify(this.varValues()),()=>void this.refreshPreviews(),{delay:r.previewMs,fireImmediately:!0}))}async refreshPreviews(){this.previewAbort?.abort();let e=new AbortController;this.previewAbort=e;try{let t=await KO({module:this.moduleKey,values:this.varValues(),signal:e.signal});N(()=>{this.previews=t.previews,this.previewError=null})}catch(t){if(e.signal.aborted)return;N(()=>{this.previewError=t instanceof Error?t.message:String(t)})}}dispose(e={}){for(let t of this.disposers)t();if(this.disposers=[],this.previewAbort?.abort(),e.flush===!1)return;if(JSON.stringify(this.valuesJSON())!==this.lastQueued)this.save()}flushKeepalive(){let e=JSON.stringify(this.valuesJSON());if(e===this.lastQueued)return;this.lastQueued=e,bc({module:this.moduleKey,draft:this.draft,values:JSON.parse(e)},{keepalive:!0}).then(()=>N(()=>{this.lastSaved=e,this.lastQueued=e,this.saveState="saved"}),(t)=>N(()=>{if(this.lastQueued===e)this.lastQueued=this.lastSaved;this.saveState="error",this.saveError=t instanceof Error?t.message:String(t)}))}intents={};intentFor(e){return this.intents[e]}setIntent(e,t){let n={...this.intents};if(t==="")delete n[e];else n[e]=t;this.intents=n}valuesJSON(){return rA(this.varValues(),this.intents)}varValues(){return Object.fromEntries(this.vars.map((e)=>[e.name,e.value]))}queuePayload(){return WR(this.vars.map((e)=>({name:e.name,kind:e.desc.kind,value:e.value})))}inactiveReason(e){let t=e.desc.ui?.activeWhen;if(t==null)return null;for(let[n,i]of Object.entries(t)){let o=this.vars.find((s)=>s.name===n)?.value;if(!i.some((s)=>s===o))return`only used when ${n} is ${i.join(" or ")}`}return null}keywordSource(e){let t=e.desc.keywordsFrom;if(t==null)return null;let n=this.vars.find((r)=>r.name===t);if(n==null)return null;let i=$h(n.value)?n.value:{};return{source:n,value:i,record:AR(i).record}}loraKeywordGroups(e){let t=this.keywordSource(e);if(t==null)return[];let n=t.source.desc.optionKeywords??{},i=t.source.desc.optionLabels??{},r=new Map(LR(t.value).map((s)=>[s.name,s])),o=[];for(let s of t.source.desc.options??[]){let l=r.get(s);if(l==null)continue;let a=Oy(n[s]??"");if(a.length===0)continue;let u=qh(l.setting);o.push({lora:s,label:i[s]??s,running:l.running,parts:a.map((c)=>({text:c,on:!u.includes(c)}))})}return o}loraKeywordsFor(e){let t=[];for(let n of this.loraKeywordGroups(e)){if(!n.running)continue;let i=n.parts.filter((r)=>r.on).map((r)=>r.text).join(", ");if(i!==""&&!t.includes(i))t.push(i)}return t}injectedTagsFor(e){return this.loraKeywordGroups(e).filter((t)=>t.running).flatMap((t)=>t.parts.filter((n)=>n.on).map((n)=>({tag:n.text,source:t.label})))}loraWordsFor(e){let t=e.desc.keywordsFrom,n=t==null?null:this.vars.find((o)=>o.name===t);if(n==null)return[];let i=n.desc.optionKeywords??{},r=n.desc.optionLabels??{};return Object.entries(i).flatMap(([o,s])=>Oy(s).map((l)=>({word:l,source:r[o]??o})))}toggleKeywordPart(e,t,n){let i=this.keywordSource(e);if(i==null)return;let r=qh(Ay(i.value,t));this.setKeywordMute(e,t,r.includes(n)?r.filter((o)=>o!==n):[...r,n])}setKeywordMute(e,t,n){let i=this.keywordSource(e);if(i==null)return;i.source.set(NR(i.value,t,wc(Ay(i.value,t),{mute:n})))}get unsaved(){return JSON.stringify(this.valuesJSON())!==this.lastSaved}get dirtyCount(){return this.vars.filter((e)=>e.dirty).length}save(){let e=JSON.stringify(this.valuesJSON());if(e===this.lastQueued)return this.lastSaved===e?Promise.resolve(!0):this.saveChain;this.lastQueued=e;let t=++this.queueSeq;return N(()=>{this.saveState="saving"}),this.saveChain=this.saveChain.then(async()=>{try{return await bc({module:this.moduleKey,draft:this.draft,values:JSON.parse(e)}),N(()=>{this.lastSaved=e,this.saveState="saved",this.saveError=null}),!0}catch(n){return N(()=>{if(this.queueSeq===t)this.lastQueued=this.lastSaved;this.saveChain=Promise.resolve(!0),this.saveState="error",this.saveError=n instanceof Error?n.message:String(n)}),!1}}),this.saveChain}revertAll(){for(let e of this.vars)e.revert()}}function rA(e,t){return Object.keys(t).length===0?e:{...e,[Sy]:t}}var Ro=(e,t)=>e.module===t.module&&e.draft===t.draft;function Py(e,t){return e.some((n)=>Ro(n,t))?e:[...e,{module:t.module,draft:t.draft}]}function Iy(e,t,n){let i=e.findIndex((o)=>Ro(o,t));if(i<0||e.length<=1)return{tabs:e,next:null};let r=e.filter((o,s)=>s!==i);if(n==null||!Ro(n,t))return{tabs:r,next:null};return{tabs:r,next:r[Math.min(i,r.length-1)]??null}}function sA(e,t,n){let i=e.findIndex((o)=>Ro(o,t)),r=e.filter((o)=>!Ro(o,n));if(i<0)return Py(r,n);return r.map((o)=>Ro(o,t)?{module:n.module,draft:n.draft}:o)}function lA(e,t){if(!(t.metaKey||t.ctrlKey)||t.altKey||t.shiftKey)return null;if(!/^[1-9]$/.test(t.key))return null;let n=Number(t.key);return(n===9?e[e.length-1]:e[n-1])??null}function aA(e,t,n){if(!(n.metaKey||n.ctrlKey)||n.altKey||n.shiftKey)return null;let i=n.key==="PageDown"?1:n.key==="PageUp"?-1:0;if(i===0||e.length<2)return null;let r=t==null?-1:e.findIndex((o)=>Ro(o,t));if(r<0)return(i>0?e[0]:e[e.length-1])??null;return e[(r+i+e.length)%e.length]??null}function uA(e,t){if(!Array.isArray(e))return[];let n=[];for(let i of e){if(i==null||typeof i!=="object")continue;let r=i;if(typeof r.module!=="string"||typeof r.draft!=="string")continue;let o={module:r.module,draft:r.draft};if(!t.some((s)=>s.module===o.module&&s.drafts.includes(o.draft)))continue;if(!n.some((s)=>Ro(s,o)))n.push(o)}return n}function ut(e,t){console.error(`\uD83D\uDD34 [comfy-ts serve] ${e}: ${t instanceof Error?t.message:String(t)}`)}function cA(e){try{let t=new URLSearchParams(e.startsWith("?")?e.slice(1):e),n=t.get("workflow"),i=t.get("draft");return{module:n===""?null:n,draft:i===""?null:i}}catch{return{module:null,draft:null}}}function fA(e){let t=new URLSearchParams(e.search.startsWith("?")?e.search.slice(1):e.search);t.set("workflow",e.module),t.set("draft",e.draft);let n=t.toString();return n===""?"":`?${n}`}function dA(e){let t=(o)=>o==null?null:e.modules.find((s)=>s.module===o)??null,n=t(e.url.module)??t(e.stored.module)??e.modules[0];if(n==null)return null;let i=e.url.module!=null&&e.url.module===n.module?e.url.draft:e.stored.draft,r=i!=null&&n.drafts.includes(i)?i:"default";return{module:n.module,draft:r}}var hA=50,pA=100;function Hy(e,t){let n=new Set(e.map((r)=>r.promptId));return[...e,...t.filter((r)=>!n.has(r.promptId))].map((r,o)=>({r,ix:o})).sort((r,o)=>(o.r.finishedAt??0)-(r.r.finishedAt??0)||r.ix-o.ix).map((r)=>r.r).slice(0,hA)}function mA(e){return e.absPath==null&&e.url!=null}function Vy(e){let t=e/1048576;return t<10?t.toFixed(1):String(Math.round(t))}function gA(e){return{...e,at:new Date(e.finishedAt??Date.now()).toLocaleTimeString()}}function lI(e){return new Promise((t)=>setTimeout(t,e))}class Uy{queue=[];error=null;results=[];memory=null;progressPercent=null;progressNode=null;progressCount=null;progressText=null;hasPreview=!1;previewTick=0;draining=!1;nextId=0;pollGen=0;onSeeds=null;constructor(){ci(this,{queue:cc,results:cc})}get isRunning(){return this.queue.some((e)=>e.sent)}get runningModule(){return this.queue.find((e)=>e.sent)?.module??null}get pendingCount(){return this.queue.filter((e)=>!e.sent).length}enqueue(e){if(this.queue=[...this.queue,{id:`q${this.nextId++}`,...e,sent:!1}],this.error=null,!this.draining)this.drain()}removeQueued(e){this.queue=this.queue.filter((t)=>t.id!==e||t.sent)}dismissError(){this.error=null}clearQueue(){this.queue=this.queue.filter((e)=>e.sent)}remove(e){this.results=this.results.filter((t)=>t.promptId!==e),this.forget({promptId:e})}clear(){this.results=[],this.forget({})}async loadKept(){try{let e=await hy();N(()=>{this.results=Hy(this.results,e.runs.map(gA)),this.memory=e.memory})}catch(e){ut("could not read the kept results",e)}}async refreshMemory(){try{let e=await hy();N(()=>{this.memory=e.memory})}catch(e){ut("could not read the memory usage",e)}}async forget(e){try{let t=await UO(e);N(()=>{this.memory=t.memory})}catch(t){ut("could not delete the kept result",t)}}async drain(){if(this.draining)return;this.draining=!0;try{while(!0){let e=this.queue.find((n)=>!n.sent);if(e==null)return;N(()=>{this.queue=this.queue.map((n)=>n.id===e.id?{...n,sent:!0}:n),this.progressPercent=null,this.progressNode=null,this.progressCount=null,this.progressText=null,this.hasPreview=!1});let t=++this.pollGen;this.poll(e.module,t);try{let n=await VO(e);N(()=>{this.results=Hy([gA(n)],this.results)}),this.refreshMemory(),this.onSeeds?.({module:e.module,draft:e.draft,seeds:n.seeds})}catch(n){N(()=>{this.error=n instanceof Error?n.message:String(n),this.queue=this.queue.filter((i)=>i.sent&&i.id!==e.id)})}finally{this.pollGen++,N(()=>{this.queue=this.queue.filter((n)=>n.id!==e.id),this.progressPercent=null,this.progressNode=null,this.progressCount=null,this.progressText=null,this.hasPreview=!1})}}}finally{this.draining=!1}}async poll(e,t){while(t===this.pollGen){if(await lI(700),t!==this.pollGen)return;try{let n=await qO({module:e});N(()=>{if(t!==this.pollGen)return;this.progressPercent=n.percent,this.progressNode=n.node??null,this.progressCount=n.nodeProgress??null,this.progressText=n.progressText??null,this.hasPreview=n.hasPreview,this.previewTick=n.previewSeq??0})}catch{}}}}var vA=[{mode:"folder",label:"folder",tip:"grouped by folder, in the order the host lists them"},{mode:"name",label:"name",tip:"by display name, A to Z"},{mode:"added",label:"date added",tip:"newest file first (the lora manager date). loras it has no date for come last"}];function bA(e){return e==="name"||e==="added"?e:"folder"}function yA(e){let t=[...e.names];if(e.mode==="name")return t.sort((n,i)=>e.label(n).localeCompare(e.label(i),void 0,{sensitivity:"base",numeric:!0}));if(e.mode==="added")return t.sort((n,i)=>{let r=e.addedAt[n],o=e.addedAt[i];if(r==null)return o==null?0:1;if(o==null)return-1;return o-r});return t}function xA(e){let t=e.matches.slice(0,e.cap),n=new Set(e.picked);return{cards:t,enterPick:t.find((i)=>!n.has(i))??null}}function wA(e){if(!e.picked)return"add";return e.on?"pause":"resume"}function Ky(e){return e!=null&&typeof e==="object"}function Jh(e){return Ky(e)&&!Array.isArray(e)}function SA(e){if(!Ky(e))return null;switch(e.comfyTs){case"set-prompt":return typeof e.text==="string"?{comfyTs:"set-prompt",text:e.text}:null;case"host-actions":{if(!Array.isArray(e.actions))return null;let t=[];for(let n of e.actions){if(!Ky(n)||typeof n.id!=="string"||n.id===""||typeof n.label!=="string")continue;if(n.label===""||t.some((i)=>i.id===n.id))continue;t.push({id:n.id,label:n.label,...typeof n.title==="string"?{title:n.title}:{}})}return{comfyTs:"host-actions",actions:t}}case"set-selection":return typeof e.module==="string"&&e.module!==""&&typeof e.draft==="string"?{comfyTs:"set-selection",module:e.module,draft:e.draft}:null;case"set-values":return Jh(e.values)?{comfyTs:"set-values",values:e.values}:null;case"get-state":return{comfyTs:"get-state"};default:return null}}function kA(e){let t=e.modules.find((n)=>n.module===e.want.module);if(t==null)return null;return{module:t.module,draft:t.drafts.includes(e.want.draft)?e.want.draft:"default"}}var Fn={ok:!1},aI=["=","+","-","?"];function Wi(e){return typeof e==="number"&&Number.isFinite(e)}function uI(e){if(typeof e==="boolean"||Wi(e))return!0;return Array.isArray(e)&&e.length===2&&Wi(e[0])&&Wi(e[1])}function jy(e,t,n){switch(e.kind){case"prompt":case"text":case"image":return typeof t==="string"?{ok:!0,value:t}:Fn;case"int":return Wi(t)?{ok:!0,value:Math.trunc(t)}:Fn;case"float":return Wi(t)?{ok:!0,value:t}:Fn;case"toggle":return typeof t==="boolean"?{ok:!0,value:t}:Fn;case"choice":{let i=GR({select:e.select??"one",choices:e.choices??[],raw:t});return i.ok?{ok:!0,value:i.value}:Fn}case"seed":{let i=Ms(n);if(Wi(t))return{ok:!0,value:{mode:i.mode,value:Math.max(0,Math.floor(t))}};if(!Jh(t))return Fn;if(t.mode!==void 0&&!(typeof t.mode==="string"&&aI.includes(t.mode)))return Fn;if(t.value!==void 0&&!Wi(t.value))return Fn;return{ok:!0,value:{mode:typeof t.mode==="string"?t.mode:i.mode,value:Wi(t.value)?Math.max(0,Math.floor(t.value)):i.value}}}case"size":{let i=null,r=null;if(typeof t==="string"){let o=/^\s*(\d+)\s*x\s*(\d+)\s*$/i.exec(t);if(o!=null)i=Number(o[1]),r=Number(o[2])}else if(Jh(t))i=t.width,r=t.height;if(!Wi(i)||!Wi(r)||i<1||r<1)return Fn;return{ok:!0,value:{width:Math.floor(i),height:Math.floor(r)}}}case"loras":{if(!Jh(t))return Fn;for(let i of Object.values(t))if(!uI(i))return Fn;return{ok:!0,value:ba(t,e.options??[])}}default:return Fn}}function _A(e){return e.find((t)=>t.desc.kind==="prompt")??e.find((t)=>(t.desc.kind==="text"||t.desc.kind==="prompt")&&/prompt/i.test(t.name)&&!/neg/i.test(t.name))??null}function CA(e,t){if(t==null)return e.comfyTs==="ready"||e.comfyTs==="selection"||e.comfyTs==="error"&&e.code==="boot"?"*":null;return t==="null"?"*":t}function Fy(e){try{let t=JSON.stringify(e,(n,i)=>typeof i==="bigint"?`${i}n`:i);if(typeof e==="bigint")return`${e}n`;return t??String(e)}catch{try{return String(e)}catch{return"[unprintable]"}}}function EA(e){try{let n=new URLSearchParams(e.startsWith("?")?e.slice(1):e).get("prompt");return n==null||n===""?null:n}catch{return null}}function qy(){try{return typeof window<"u"&&window.parent!==window}catch{return!1}}var TA="comfy-ts-serve-ui",$y="side",ep=[{id:"off",icon:"panel-off",label:"none",title:"no preview: the form only"},{id:"bottom",icon:"panel-bottom",label:"below",title:"results below the form"},{id:"left",icon:"panel-left",label:"left",title:"results left of the form"},{id:"side",icon:"panel-side",label:"right",title:"results right of the form"},{id:"pinned",icon:"panel-corner",label:"corner",title:"newest image in the bottom right corner, form scrolls under it"}];function cI(e){return e==="off"||e==="bottom"||e==="left"||e==="side"||e==="pinned"}var MA=200,fI=60;function Zh(e){let t=typeof e==="number"&&Number.isFinite(e)?e:1;return Math.min(2,Math.max(0.6,Math.round(t*20)/20))}function dI(e){return{form:Zh(e.loraFormScale??e.loraScale),popup:Zh(e.loraPopupScale??e.loraScale)}}function NA(e){let t=typeof e==="number"&&Number.isFinite(e)?Math.round(e):1;return Math.min(8,Math.max(1,t))}function hI(e){if(e.resultsColumns!=null)return NA(e.resultsColumns);return e.resultsView==="grid"?3:1}var DA=120;function OA(e){let t=typeof e==="number"&&Number.isFinite(e)?Math.round(e):DA;return Math.min(360,Math.max(60,t))}function RA(e){let t=typeof e==="number"&&Number.isFinite(e)?Math.floor(e):MA;return Math.min(2000,Math.max(1,t))}function AA(e){if(e==null||typeof e!=="object"||Array.isArray(e))return{};let t={};for(let[n,i]of Object.entries(e))if(Array.isArray(i))t[n]=i.filter((r)=>typeof r==="string");return t}function Xy(){try{let e=JSON.parse(localStorage.getItem(TA)??"{}")??{};return{...e,varOrder:AA(e.varOrder),sizeStars:AA(e.sizeStars)}}catch{return{}}}class Gy{formTiming;phase="loading";bootError="";modules=[];loadErrors={};workspace=null;root=null;menuOpen=!1;form=null;formLoading=!1;formError=null;showLoraImages;showLoraTitles;loraFill;showLoraTriggers;loraFormScale;loraPopupScale;loraSort;loraCap;run;enhancer;omnibox;settings={saveToDisk:!0,hostOverride:{},savePrefix:{},memoryBudgetMb:pA,effectivePrefix:{}};savingError=null;prefixEdits={};prefixTimers=new Map;get saveToDisk(){return this.settings.saveToDisk}layout;lastShownLayout=$y;varOrder={};sizeStars={};labelWidth=DA;orderedVars(e,t){let n=this.varOrder[e];if(n==null)return[...t];let i=new Set(t),r=n.filter((o)=>i.has(o));return[...r,...t.filter((o)=>!r.includes(o))]}moveVar(e){let t=this.orderedVars(e.module,e.names),[n]=t.splice(e.from,1);if(n==null)return;t.splice(e.to,0,n),this.varOrder={...this.varOrder,[e.module]:t},this.persist()}hosts={hosts:[],defaults:{},overrides:{}};hostError=null;hostActions=[];hostOrigin=null;lastPostedState=null;switches=new Set;hostChain=Promise.resolve();constructor(e=zy){this.formTiming=e;this.run=new Uy,this.run.onSeeds=(i)=>this.applyRunSeeds(i),this.enhancer=new Ty(()=>this.form),this.omnibox=new Dy(this);let t=Xy();this.layout=cI(t.layout)?t.layout:$y,this.showLoraImages=t.loraImages??!0,this.showLoraTitles=t.loraTitles??!0,this.loraFill=t.loraFill??!0,this.showLoraTriggers=t.loraTriggers??!1;let n=dI(t);if(this.loraFormScale=n.form,this.loraPopupScale=n.popup,this.loraSort=bA(t.loraSort),this.loraCap=RA(t.loraCapMigrated!==!0&&t.loraCap===fI?MA:t.loraCap),this.latentMode=qR(t.latent),this.blurResults=t.blur??!1,this.resultsColumns=hI(t),this.expandedPreviews=Array.isArray(t.expandedPreviews)?t.expandedPreviews.filter((i)=>typeof i==="string"):[],this.varOrder=t.varOrder??{},this.sizeStars=t.sizeStars??{},this.labelWidth=OA(t.labelWidth),this.showLogs=t.logs??!1,ci(this,{run:!1,enhancer:!1,omnibox:!1,form:oa,modules:cc,hostOrigin:!1,hostChain:!1,lastPostedState:!1,switches:!1,formTiming:!1}),qy())window.addEventListener("message",(i)=>this.onHostMessage(i));window.addEventListener("beforeunload",()=>this.form?.flushKeepalive()),document.addEventListener("visibilitychange",()=>{if(document.visibilityState==="hidden")this.form?.save()}),this.hostChain=this.boot().catch((i)=>ut("panel boot failed",i))}setLabelWidth(e,t){if(this.labelWidth=OA(e),t)this.persist()}setSizeStars(e,t){this.sizeStars[e]=t,this.persist()}setLoraFormScale(e){this.loraFormScale=Zh(e),this.persist()}setLoraPopupScale(e){this.loraPopupScale=Zh(e),this.persist()}toggleLoraTriggers(){this.showLoraTriggers=!this.showLoraTriggers,this.persist()}toggleLoraImages(){this.showLoraImages=!this.showLoraImages,this.persist()}toggleLoraTitles(){this.showLoraTitles=!this.showLoraTitles,this.persist()}setLoraSort(e){this.loraSort=e,this.persist()}toggleLoraFill(){this.loraFill=!this.loraFill,this.persist()}setLoraCap(e){this.loraCap=RA(e),this.persist()}applyRunSeeds(e){let t=this.form;if(t==null||t.moduleKey!==e.module||t.draft!==e.draft)return;N(()=>{for(let n of t.vars){if(n.desc.kind!=="seed")continue;let i=e.seeds[n.name];if(typeof i!=="number"||!Number.isFinite(i))continue;let r=Ms(n.value);if(r.value===i)continue;n.setFromRun({mode:r.mode,value:i})}}),this.mirrorState()}syncUrl(){let e=this.form;if(e==null)return;try{let t=fA({search:window.location.search,module:e.moduleKey,draft:e.draft});window.history.replaceState(null,"",`${window.location.pathname}${t}${window.location.hash}`)}catch(t){ut("could not put the selection in the url",t)}}persist(){try{let e=Xy();localStorage.setItem(TA,JSON.stringify({...e,...this.form!=null?{module:this.form.moduleKey,draft:this.form.draft}:{},loraImages:this.showLoraImages,loraTitles:this.showLoraTitles,loraFill:this.loraFill,loraTriggers:this.showLoraTriggers,loraFormScale:this.loraFormScale,loraPopupScale:this.loraPopupScale,loraSort:this.loraSort,loraCap:this.loraCap,loraCapMigrated:!0,layout:this.layout,latent:this.latentMode,blur:this.blurResults,resultsColumns:this.resultsColumns,expandedPreviews:this.expandedPreviews,logs:this.showLogs,varOrder:this.varOrder,sizeStars:this.sizeStars,labelWidth:this.labelWidth}))}catch(e){ut("ui state could not be stored (it will not survive a reload)",e)}}tabs=[];async loadTabs(){try{let e=await jO(),t=uA(e.tabs,this.modules.map((n)=>({module:n.module,drafts:n.drafts})));N(()=>{this.tabs=t})}catch(e){ut("the open tabs could not be read, starting with none",e)}}setTabs(e){if(e===this.tabs)return;this.tabs=e,FO(e).catch((t)=>ut("the open tabs could not be saved",t))}get activeTab(){return this.form==null?null:{module:this.form.moduleKey,draft:this.form.draft}}closeTab(e){let t=Iy(this.tabs,e,this.activeTab);if(this.setTabs(t.tabs),t.next!=null)this.select(t.next)}moduleByKey(e){return this.modules.find((t)=>t.module===e)??null}async boot(){try{let e=await dy();N(()=>{this.modules=e.workflows,this.loadErrors=e.loadErrors??{},this.workspace=e.workspace??null,this.root=e.root??null,this.phase="ready"}),this.loadSettings(),this.loadHosts(),this.run.loadKept();let t=Xy(),n=dA({url:cA(window.location.search),stored:{module:t.module??null,draft:t.draft??null},modules:this.modules});if(n==null){this.postHost({comfyTs:"error",code:"boot",message:"no workflows are served"});return}if(await this.loadTabs(),await this.select(n),this.form==null){this.postHost({comfyTs:"error",code:"boot",message:`the opening draft could not be read: ${this.formError??"unknown error"}`});return}let i=EA(window.location.search);if(i!=null)this.setPromptText(i);this.postHost({comfyTs:"ready"}),this.startDriftWatch()}catch(e){let t=e instanceof Error?e.message:String(e);N(()=>{this.phase="error",this.bootError=t}),this.postHost({comfyTs:"error",code:"boot",message:t})}}selectToken=0;select(e,t={}){return this.menuOpen=!1,this.renamingDraft=null,this.trackSwitch(this.selectNow(e,t.mirror??!0))}trackSwitch(e){this.switches.add(e);let t=()=>void this.switches.delete(e);return e.then(t,t),e}async switchSettled(){while(this.switches.size>0)await Promise.allSettled(this.switches)}async selectNow(e,t){let n=this.moduleByKey(e.module);if(n==null)return;if(this.form?.moduleKey===e.module&&this.form.draft===e.draft)return;let i=++this.selectToken;N(()=>{this.enhancer.close(),this.formLoading=!0,this.formError=null});let r=this.form;if(r!=null){if(r.dispose(),N(()=>{this.form=null}),!await r.save())N(()=>{this.formError=`the previous draft could not be saved: ${r.saveError??"unknown error"}`})}try{let o=await HO(e);if(i!==this.selectToken)return;let s=new By(e.module,e.draft,n,o.values??{},this.formTiming);if(s.onSettled=()=>this.mirrorState(),N(()=>{this.form=s,this.setTabs(Py(this.tabs,e)),this.persist(),this.syncUrl()}),this.postHost({comfyTs:"selection",module:s.moduleKey,draft:s.draft}),t)this.mirrorState()}catch(o){N(()=>{if(i!==this.selectToken)return;this.form=null,this.formError=o instanceof Error?o.message:String(o)})}finally{N(()=>{if(i===this.selectToken)this.formLoading=!1})}}promptVar(){return _A(this.form?.vars??[])}setPromptText(e){let t=this.promptVar();if(t==null)return;let n=jy(t.desc,e,t.value);if(!n.ok){ut("host set-prompt",`'${t.name}' (${t.desc.kind}) rejected the text`);return}N(()=>t.set(n.value))}postHost(e){if(!qy())return;let t=CA(e,this.hostOrigin);if(t==null)return;try{window.parent.postMessage(e,t)}catch(n){ut("could not post to the host page",n)}}setValues(e){let t=this.form;if(t==null)return Object.keys(e);let n=[];return N(()=>{for(let[i,r]of Object.entries(e)){let o=t.vars.find((l)=>l.name===i);if(o==null){n.push(i),ut("host set-values",`no var named '${i}' on ${t.moduleKey}`);continue}let s=jy(o.desc,r,o.value);if(s.ok)o.set(s.value);else n.push(i),ut("host set-values",`'${i}' (${o.desc.kind}) rejected ${Fy(r)}`)}}),n}stateOf(e){let t=e.varValues();return{key:Fy([e.moduleKey,e.draft,t]),values:t}}replyState(e,t,n){let{key:i,values:r}=this.stateOf(e);this.lastPostedState=i,this.postHost({comfyTs:"state",module:e.moduleKey,draft:e.draft,values:r,request:t,...n!=null?{rejected:n}:{}})}mirrorState(){let e=this.form;if(e==null||this.hostOrigin==null)return;let{key:t,values:n}=this.stateOf(e);if(t===this.lastPostedState)return;this.lastPostedState=t,this.postHost({comfyTs:"state",module:e.moduleKey,draft:e.draft,values:n})}replyError(e,t,n){this.postHost({comfyTs:"error",code:t,message:n,request:e})}onHostMessage(e){if(e.source!==window.parent)return;let t=SA(e.data);if(t==null)return;if(this.hostOrigin==null)this.hostOrigin=e.origin;else if(e.origin!==this.hostOrigin)return;this.hostChain=this.hostChain.then(()=>this.applyHostMessage(t)).catch((n)=>ut(`host message '${t.comfyTs}' failed`,n))}async applyHostMessage(e){try{await this.applyHostMessageNow(e)}catch(t){if(e.comfyTs==="set-selection"||e.comfyTs==="set-values"||e.comfyTs==="get-state")this.replyError(e.comfyTs,"no-form",t instanceof Error?t.message:String(t));throw t}}async applyHostMessageNow(e){switch(e.comfyTs){case"host-actions":N(()=>{this.hostActions=e.actions});return;case"set-prompt":await this.switchSettled(),this.setPromptText(e.text);return;case"set-selection":{await this.switchSettled();let t=kA({want:e,modules:this.modules});if(t==null){this.replyError("set-selection","unknown-module",`no workflow named '${e.module}' is served`);return}let n=this.form;if(n==null||n.moduleKey!==t.module||n.draft!==t.draft)await this.select(t,{mirror:!1}),await this.switchSettled();let i=this.form;if(i==null){let r=this.formError??"the draft could not be read";this.replyError("set-selection","select-failed",r)}else if(i.moduleKey!==t.module||i.draft!==t.draft)this.replyError("set-selection","superseded",`the panel switched to ${i.moduleKey}/${i.draft} while ${t.module}/${t.draft} was loading`);else this.replyState(i,"set-selection");return}case"set-values":{await this.switchSettled();let t=this.form;if(t==null){this.replyError("set-values","no-form",this.noFormMessage());return}this.replyState(t,"set-values",this.setValues(e.values));return}case"get-state":{await this.switchSettled();let t=this.form;if(t==null)this.replyError("get-state","no-form",this.noFormMessage());else this.replyState(t,"get-state");return}}}noFormMessage(){return this.formError!=null?`no draft is open: ${this.formError}`:"no draft is open"}postResultAction(e,t,n,i){let r=this.promptVar();this.postHost({comfyTs:"result-action",id:e,promptId:t.promptId,ix:i,url:n.url,filename:n.filename,module:t.module,draft:t.draft,seeds:t.seeds,prompt:r!=null&&typeof r.value==="string"?r.value:null})}get generateInResults(){return this.layout==="side"||this.layout==="left"||this.layout==="pinned"}setLayout(e){if(this.layout!=="off")this.lastShownLayout=this.layout;this.layout=e,this.persist()}showPreview(){this.setLayout(this.lastShownLayout==="off"?$y:this.lastShownLayout)}hostFor(e){return this.hosts.overrides[e]??this.hosts.defaults[e]??""}hostUrlFor(e){let t=this.hostFor(e);return this.hosts.hosts.find((n)=>n.id===t)?.httpUrl??null}isHostOverridden(e){return this.hosts.overrides[e]!=null}async loadHosts(){try{let e=await YO();N(()=>{this.hosts=e})}catch(e){ut("could not read the host list",e)}}showLogs=!1;logLines=[];logsError=null;latentMode="corner";blurResults=!1;showShortcuts=!1;setShowShortcuts(e){this.showShortcuts=e}jump=null;requestJump(e){this.jump={kind:e,seq:(this.jump?.seq??0)+1}}resultsColumns=1;expandedPreviews=[];logsTimer=null;setLatentMode(e){this.latentMode=e,this.persist()}togglePreviewExpanded(e){this.expandedPreviews=this.expandedPreviews.includes(e)?this.expandedPreviews.filter((t)=>t!==e):[...this.expandedPreviews,e],this.persist()}setResultsColumns(e){this.resultsColumns=NA(e),this.persist()}toggleBlur(){this.blurResults=!this.blurResults,this.persist()}setMenuOpen(e){this.menuOpen=e}renamingDraft=null;startRename(){if(this.form==null)return;this.renamingDraft=this.form.draft,this.menuOpen=!0}setRenaming(e){this.renamingDraft=e}stopRename(){this.renamingDraft=null}menuFoldTick=0;requestMenuFold(){this.menuFoldTick++}toggleLogs(){if(this.showLogs=!this.showLogs,this.persist(),this.logsTimer!=null)clearInterval(this.logsTimer);if(this.logsTimer=null,!this.showLogs)return;this.pullLogs(),this.logsTimer=setInterval(()=>void this.pullLogs(),3000)}async pullLogs(){let e=this.form==null?null:this.hostFor(this.form.moduleKey);if(e==null||e==="")return;try{let t=await eR({host:e});N(()=>{this.logLines=t.lines,this.logsError=null})}catch(t){N(()=>{this.logsError=t instanceof Error?t.message:String(t)})}}refreshing=!1;async refreshHost(){if(this.refreshing)return;N(()=>{this.refreshing=!0});try{await this.hostAction("refresh-schema"),await this.trackSwitch(this.reloadIndexAndForm())}finally{N(()=>{this.refreshing=!1})}}driftDown=!1;startDriftWatch(){this.checkDrift(!0),setInterval(()=>{if(document.visibilityState==="visible")this.checkDrift(!1)},15000)}async checkDrift(e){let t=this.form==null?null:this.hostFor(this.form.moduleKey);if(t==null||t===""||this.refreshing)return;try{let n=await JO({host:t,full:e}),i=this.driftDown;if(N(()=>{this.driftDown=!1}),n.changed)await this.refreshHost();else if(i&&!e)await this.checkDrift(!0)}catch{N(()=>{this.driftDown=!0})}}loraFetching=new Set;async fetchLoraTriggers(e){let t=this.form==null?null:this.hostFor(this.form.moduleKey);if(t==null||t===""||this.loraFetching.has(e))return;N(()=>{this.loraFetching.add(e),this.hostError=null});try{await ZO({host:t,lora:e}),await this.trackSwitch(this.reloadIndexAndForm())}catch(n){N(()=>{this.hostError=n instanceof Error?n.message:String(n)})}finally{N(()=>{this.loraFetching.delete(e)})}}async reloadIndexAndForm(){try{let e=await dy(),t=this.form;if(N(()=>{this.modules=e.workflows}),t!=null)t.dispose(),await t.save(),N(()=>{this.form=null}),await this.select({module:t.moduleKey,draft:t.draft})}catch(e){N(()=>{this.hostError=e instanceof Error?e.message:String(e)})}}hostWatch="idle";async watchHostComeBack(){let e=this.form==null?null:this.hostFor(this.form.moduleKey);if(e==null||e==="")return;N(()=>{this.hostWatch="down"});let t=Date.now()+120000;for(;;){if(await new Promise((i)=>setTimeout(i,2500)),Date.now()>t){N(()=>{this.hostWatch="idle",this.hostError=`${e} has not answered for 2 minutes — check the console`});return}if(!await WO({host:e}).then((i)=>i.up).catch(()=>!1))continue;N(()=>{this.hostWatch="back"}),this.checkDrift(!0),setTimeout(()=>N(()=>this.hostWatch="idle"),4000);return}}async hostAction(e){let t=this.form==null?null:this.hostFor(this.form.moduleKey);if(t==null||t==="")return;N(()=>{this.hostError=null});try{if(await QO({host:t,action:e}),e==="restart")this.watchHostComeBack()}catch(n){N(()=>{this.hostError=n instanceof Error?n.message:String(n)})}}async setModuleHost(e){N(()=>{this.hostError=null});try{let t=await tR(e);N(()=>{this.hosts={...this.hosts,overrides:t.overrides}})}catch(t){N(()=>{this.hostError=t instanceof Error?t.message:String(t)})}}async loadSettings(){try{let e=await XO();N(()=>{this.settings=e})}catch(e){ut("could not read the serve settings",e)}}savePrefixDraft(e){return this.prefixEdits[e]??this.settings.savePrefix[e]??""}setSavePrefix(e,t){this.prefixEdits[e]=t,this.savingError=null;let n=this.prefixTimers.get(e);if(n!=null)clearTimeout(n);this.prefixTimers.set(e,setTimeout(()=>{this.pushSettings({savePrefix:{[e]:t}})},500))}async setMemoryBudget(e){if(await this.pushSettings({memoryBudgetMb:e}))await this.run.refreshMemory()}async pushSettings(e){try{let t=await GO(e);return N(()=>{this.settings=t,this.savingError=null}),!0}catch(t){return N(()=>{this.savingError=t instanceof Error?t.message:String(t)}),!1}}async toggleSaveToDisk(){let e=!this.saveToDisk,t=this.settings;if(N(()=>{this.settings={...this.settings,saveToDisk:e},this.savingError=null}),!await this.pushSettings({saveToDisk:e}))N(()=>{this.settings=t})}generate(e){this.generateNow(e)}async generateNow(e){let t=this.form;if(t==null)return;let n={...t.queuePayload(),...e};if(!await t.save())return;this.run.enqueue({module:t.moduleKey,draft:t.draft,payload:n}),this.recordPrompts(t,n)}promptHistory=[];recordPrompts(e,t){let n=Date.now();for(let i of e.vars){let r=t[i.name];if(i.desc.kind!=="prompt"||!_R(r))continue;let o=typeof r==="string"?r:OR(r);this.promptHistory=jh(this.promptHistory,{text:o,value:r,at:n,source:`${e.moduleKey} · ${i.desc.label??i.name}`})}}async renameDraft(e){let t=this.form,n=e.trim();if(t==null||n===""||n===t.draft)return;let i=t.draft;if(await this.duplicateDraft(n),this.form?.draft!==n)return;await py({module:t.moduleKey,draft:i}).then((r)=>N(()=>{this.modules=this.modules.map((o)=>o.module===t.moduleKey?{...o,drafts:r.drafts}:o),this.setTabs(sA(this.tabs,{module:t.moduleKey,draft:i},{module:t.moduleKey,draft:n}))}),(r)=>N(()=>{this.formError=`renamed to '${n}', but the old draft '${i}' could not be removed: ${r instanceof Error?r.message:String(r)}`}))}deleteDraft(e){return this.trackSwitch(this.deleteDraftNow(e))}async deleteDraftNow(e){let t=Iy(this.tabs,e,this.activeTab).next,n=this.form;if(n!=null&&n.moduleKey===e.module&&n.draft===e.draft)n.dispose({flush:!1}),N(()=>{this.form=null});try{let i=await py(e);if(N(()=>{this.modules=this.modules.map((o)=>o.module===e.module?{...o,drafts:i.drafts}:o),this.setTabs(this.tabs.filter((o)=>o.module!==e.module||o.draft!==e.draft))}),this.form!=null)return;let r=i.drafts.includes("default")?"default":i.drafts[0]??"default";await this.select(t??{module:e.module,draft:r})}catch(i){N(()=>{this.formError=i instanceof Error?i.message:String(i)})}}async duplicateDraft(e){let t=this.form;if(t==null)return;await this.createDraft(e,t.valuesJSON())}duplicateCurrentDraft(){let e=this.form;if(e==null)return Promise.resolve();let t=this.moduleByKey(e.moduleKey)?.drafts??[e.draft];return this.duplicateDraft(jR(e.draft,t))}newDraftFromDefaults(){let e=this.form;if(e==null)return Promise.resolve();return this.newDraft(KR(this.moduleByKey(e.moduleKey)?.drafts??[]))}async newDraft(e){let t=this.form,n=t==null?null:this.moduleByKey(t.moduleKey);if(n==null)return;let i={};for(let[r,o]of Object.entries(n.vars))i[r]=o.default;await this.createDraft(e,i)}async createDraft(e,t){let n=this.form,i=e.trim();if(n==null||i==="")return;if(this.moduleByKey(n.moduleKey)?.drafts.includes(i)===!0&&!window.confirm(`draft '${i}' already exists — overwrite it?`))return;try{let o=await bc({module:n.moduleKey,draft:i,values:t});N(()=>{this.modules=this.modules.map((s)=>s.module===n.moduleKey?{...s,drafts:o.drafts}:s)}),await this.select({module:n.moduleKey,draft:i})}catch(o){N(()=>{this.formError=o instanceof Error?o.message:String(o)})}}}function ya(e){return y("section",{className:"menu-section",children:[y("div",{className:"menu-title",children:[p("span",{children:e.title}),e.actions==null?null:p("span",{className:"menu-title-actions",children:e.actions})]}),e.children]})}var pI=q(function(t){let n=t.st.moduleByKey(t.form.moduleKey)?.drafts??[t.form.draft],i=t.st.renamingDraft,r=()=>{let s=(i??"").trim();if(t.st.stopRename(),s!==""&&s!==t.form.draft)t.st.renameDraft(s)},o=t.form.dirtyCount;return y(ya,{title:"draft",actions:y(te,{children:[o>0?p("button",{type:"button",className:"head-icon dirty","data-tip":`revert ${o} change${o>1?"s":""}: put back the values this draft loaded with`,onClick:()=>t.form.revertAll(),children:p(T,{name:"broom"})}):null,p(mI,{form:t.form})]}),children:[i!=null?y("div",{className:"menu-row",children:[p(T,{name:"pen"}),p("input",{type:"text",autoFocus:!0,className:"head-input",value:i,placeholder:"new name, then enter",onFocus:(s)=>s.currentTarget.select(),onChange:(s)=>t.st.setRenaming(s.target.value),onKeyDown:(s)=>{if(s.key==="Enter")r();if(s.key==="Escape")t.st.stopRename()},onBlur:()=>t.st.stopRename()})]}):y("div",{className:"menu-row",children:[p("select",{className:"menu-select draft",value:t.form.draft,"data-tip":"switch draft",onChange:(s)=>void t.st.select({module:t.form.moduleKey,draft:s.target.value}),children:n.map((s)=>p("option",{value:s,children:s},s))}),p("span",{className:"menu-row-actions",children:p("button",{type:"button",className:"head-icon danger","data-tip":"delete this draft's file (default resets to the workflow's own values)",onClick:()=>{if(window.confirm(`delete draft '${t.form.draft}' of ${t.form.moduleKey}? the file is removed.`))t.st.deleteDraft({module:t.form.moduleKey,draft:t.form.draft})},children:p(T,{name:"trash"})})})]}),y("button",{type:"button",className:"menu-row menu-action","data-tip":"rename this draft (the file is renamed)",onClick:()=>t.st.startRename(),children:[p(T,{name:"pen"}),p("span",{children:"rename"}),p("span",{className:"kbd-hint",children:Hh("rename-draft")})]}),y("button",{type:"button",className:"menu-row menu-action","data-tip":"a copy of the values on screen, as a new draft",onClick:()=>void t.st.duplicateCurrentDraft(),children:[p(T,{name:"copy-plus"}),p("span",{children:"duplicate"}),y("span",{className:"kbd-hint",children:[Ee,xt["duplicate-draft"]]})]}),y("button",{type:"button",className:"menu-row menu-action","data-tip":"a new draft with the workflow's own default values",onClick:()=>void t.st.newDraftFromDefaults(),children:[p(T,{name:"plus"}),p("span",{children:"new default"})]})]})}),mI=q(function(t){if(t.form.saveState==="error")return p("span",{className:"menu-note error","data-tip":t.form.saveError??"the last write failed",children:"NOT SAVED"});if(t.form.unsaved)return p("span",{className:"save-mark","data-tip":"saving…",children:p("span",{className:"spinner"})});return p("span",{className:"save-mark","data-tip":"saved",children:p(T,{name:"check"})})});function LA(e){if(e.value==null)return null;let t=e.value;return y("button",{type:"button",className:"menu-row path-row","data-tip":`${e.what}: ${t.path} (click to copy)`,"data-tip-side":"right",onClick:()=>void navigator.clipboard.writeText(t.path),children:[p(T,{name:e.icon}),p("span",{className:"path-text",children:p("bdi",{children:t.label})})]})}function Yy(e){return y("div",{className:"menu-head",children:[p("button",{type:"button",className:"head-icon","data-tip":e.tip,"aria-label":"menu",onClick:e.onBurger,children:p(T,{name:"menu"})}),p("span",{className:"menu-brand",children:"comfy-ts"}),e.keyHint==null?null:p("span",{className:"kbd-hint menu-head-key",children:e.keyHint})]})}var Wy=q(function(t){let n=t.st.form,i=Object.keys(t.st.loadErrors).length;return y("div",{className:"menu-sections",children:[y(ya,{title:"workspace",children:[p(LA,{what:"workspace (where .comfy-ts/ lives)",icon:"folder",value:t.st.workspace}),p(LA,{what:"root (the folder serve scans)",icon:"folder-tree",value:t.st.root})]}),n==null?null:y(te,{children:[p(ya,{title:"workflow",actions:y(te,{children:[i>0?y("button",{type:"button",className:"link load-errors","data-tip":"some workflows failed to load: the list is at the bottom of the search",onClick:()=>t.st.omnibox.open(),children:[p(T,{name:"warn"})," ",i]}):null,y("button",{type:"button",className:"head-icon","data-tip":`search every workflow and draft (${Ee}K or ${Ee}J)`,onClick:()=>t.st.omnibox.open(),children:[p(T,{name:"search"})," ",y("span",{className:"kbd-hint",children:[Ee,"K"]})]})]}),children:y("button",{type:"button",className:"menu-row workflow-row","data-tip":`search every workflow and draft (${Ee}K)`,onClick:()=>t.st.omnibox.open(),children:[p(T,{name:"workflow"}),p("span",{className:"menu-value",children:n.moduleKey})]})}),p(pI,{st:t.st,form:n}),y(ya,{title:t.st.hostWatch==="down"?"host · restarting…":t.st.hostWatch==="back"?"host · back up":"host",actions:y(te,{children:[p("button",{type:"button",className:t.st.refreshing?"head-icon pulse":"head-icon","data-tip":t.st.refreshing?"refreshing what the host has…":"refresh what the host has (models, nodes, loras). It also refreshes by itself when something new appears",onClick:()=>void t.st.refreshHost(),children:p(T,{name:"refresh"})}),p("button",{type:"button",className:"head-icon danger","data-tip":"restart ComfyUI on that host (manager reboot) — it reconnects when back",onClick:()=>{if(window.confirm(`restart ComfyUI on '${t.st.hostFor(n.moduleKey)}'?`))t.st.hostAction("restart")},children:p(T,{name:"power"})})]}),children:[y("div",{className:"menu-row",children:[t.st.hosts.hosts.length>1?p("select",{className:"menu-select host",value:t.st.hostFor(n.moduleKey),"data-tip":"run this workflow on another host",onChange:(r)=>void t.st.setModuleHost({module:n.moduleKey,host:r.target.value}),children:t.st.hosts.hosts.map((r)=>p("option",{value:r.id,children:r.id===(t.st.hosts.defaults[n.moduleKey]??"")?`${r.id} (its own)`:r.id},r.id))}):p("span",{className:"menu-value host",children:t.st.hostFor(n.moduleKey)||n.host}),t.st.isHostOverridden(n.moduleKey)?p("span",{className:"menu-row-actions",children:p("button",{type:"button",className:"head-icon","data-tip":`runs on an override — back to ${t.st.hosts.defaults[n.moduleKey]??"its own host"}`,onClick:()=>void t.st.setModuleHost({module:n.moduleKey,host:null}),children:p(T,{name:"swap"})})}):null]}),y("div",{className:"menu-row menu-buttons",children:[y("button",{type:"button","data-tip":"interrupt the prompt running now",onClick:()=>void t.st.hostAction("interrupt"),children:[p(T,{name:"pause"})," stop"]}),y("button",{type:"button",className:"quiet-danger","data-tip":"drop everything still pending in the host queue",onClick:()=>void t.st.hostAction("clear-queue"),children:[p(T,{name:"trash"})," clear"]}),y("button",{type:"button",className:t.st.showLogs?"sel":"","data-tip":t.st.showLogs?"hide the ComfyUI console":"show the ComfyUI console of this host",onClick:()=>t.st.toggleLogs(),children:[p(T,{name:"terminal"})," console"]})]}),t.st.hostError!=null?y("div",{className:"error menu-error",children:["\uD83D\uDD34 ",t.st.hostError]}):null]})]}),p(ya,{title:"preview",children:p("div",{className:"layout-tiles",children:ep.map((r)=>y("button",{type:"button",className:t.st.layout===r.id?"layout-tile sel":"layout-tile","data-tip":r.title,onClick:()=>t.st.setLayout(r.id),children:[p(T,{name:r.icon,size:1.8}),p("span",{children:r.label})]},r.id))})}),p(ya,{title:"help",children:y("button",{type:"button",className:"menu-row menu-action","data-tip":"every key the panel binds",onClick:()=>t.st.setShowShortcuts(!0),children:[p(T,{name:"keyboard"}),p("span",{children:"shortcuts"})]})})]})}),zA=q(function(t){let n=[{icon:"folder",tip:`workspace: ${t.st.workspace?.label??"?"}`},{icon:"folder-tree",tip:`root: ${t.st.root?.label??"?"}`},{icon:"workflow",tip:`workflow: ${t.st.form?.moduleKey??"none"}`},{icon:"draft",tip:`draft: ${t.st.form?.draft??"none"}`},{icon:"server",tip:`host: ${t.st.hostFor(t.st.form?.moduleKey??"")||"none"}`},{icon:ep.find((i)=>i.id===t.st.layout)?.icon??"panel-side",tip:`preview: ${ep.find((i)=>i.id===t.st.layout)?.title??t.st.layout}`}];return y("div",{className:"menu-rail",children:[p("button",{type:"button",className:"head-icon","data-tip":`unfold the menu (${Ee}B)`,"aria-label":"menu",onClick:t.onExpand,children:p(T,{name:"menu"})}),p("button",{type:"button",className:"head-icon","data-tip":`search (${Ee}K)`,onClick:()=>t.st.omnibox.open(),children:p(T,{name:"search"})}),n.map((i)=>p("button",{type:"button",className:"head-icon","data-tip":i.tip,onClick:t.onExpand,children:p(T,{name:i.icon})},i.icon)),p("button",{type:"button",className:"head-icon","data-tip":"shortcuts",onClick:()=>t.st.setShowShortcuts(!0),children:p(T,{name:"keyboard"})})]})});function BA(e){if(e.target.kind==="image")return{url:e.target.url,title:e.target.title,promptId:e.target.promptId};let t=e.target.module,n=e.results.filter((o)=>o.module===t),i=n.length>e.target.after?n[0]:void 0,r=i?.images.find((o)=>o.url!=null);if(!e.isRunning&&r?.url!=null)return{url:r.url,title:r.filename,promptId:i?.promptId??null};return{url:yc({module:t,tick:e.previewTick}),title:"latent preview",promptId:null}}function PA(e){let t=e.results.flatMap((r)=>r.images.flatMap((o)=>o.url==null?[]:[{url:o.url,title:o.filename,promptId:r.promptId}])),n=t.findIndex((r)=>r.url===e.url);if(n<0)return null;let i=t[n+e.dir];return i==null?null:{kind:"image",...i}}async function IA(e){let t=await fetch(e);if(!t.ok)throw Error(`fetch failed (http ${t.status})`);let n=await t.blob(),i=n.type==="image/png"?n:await gI(n);await navigator.clipboard.write([new ClipboardItem({"image/png":i})])}async function gI(e){let t=await createImageBitmap(e),n=document.createElement("canvas");n.width=t.width,n.height=t.height;let i=n.getContext("2d");if(i==null)throw Error("canvas 2d context unavailable");return i.drawImage(t,0,0),await new Promise((r,o)=>{n.toBlob((s)=>{if(s==null)o(Error("png encode failed"));else r(s)},"image/png")})}function HA(e){if(!mA(e.out))return null;return y("span",{className:"ephemeral-pill","data-tip":"not saved: kept in the server memory only, lost on a restart or past the memory budget",children:[p(T,{name:"warn"})," ephemeral"]})}var Qy=q(function(t){if(!t.st.blurResults)return null;return y("span",{className:"blur-hint kbd-hint",children:[Ee,xt["toggle-blur"]]})}),VA=typeof navigator<"u"&&navigator.clipboard!=null;function vI(){return ua(()=>({copyNote:null,lightbox:null,zoom:1,panX:0,panY:0,setCopyNote(e,t){this.copyNote={url:e,text:t}},openLightbox(e){this.lightbox=e,this.resetZoom()},closeLightbox(){this.lightbox=null,this.resetZoom()},zoomBy(e,t){let n=Math.min(8,Math.max(1,this.zoom*e));if(n===this.zoom)return;let i=n/this.zoom;if(this.panX=t.x-(t.x-this.panX)*i,this.panY=t.y-(t.y-this.panY)*i,this.zoom=n,n===1)this.panX=0,this.panY=0},panBy(e,t){if(this.zoom===1)return;this.panX+=e,this.panY+=t},resetZoom(){this.zoom=1,this.panX=0,this.panY=0}}))}var bI=q(function(t){let n=t.local.lightbox,i=n==null?null:BA({target:n,isRunning:t.st.run.isRunning,previewTick:t.st.run.previewTick,results:t.st.run.results}),r=i?.url;J(()=>{if(n==null)return;let l=(a)=>{if(a.key==="Escape")return t.local.closeLightbox();let u=a.key==="ArrowDown"||a.key==="ArrowRight"?1:a.key==="ArrowUp"||a.key==="ArrowLeft"?-1:0;if(u===0)return;if(a.metaKey||a.ctrlKey||a.altKey||a.shiftKey||r==null)return;a.preventDefault();let c=PA({results:t.st.run.results,url:r,dir:u});if(c!=null)t.local.openLightbox(c)};return window.addEventListener("keydown",l),()=>window.removeEventListener("keydown",l)},[n,r,t.local,t.st]);let o=X(null);if(J(()=>{let l=o.current;if(l==null)return;let a=(u)=>{u.preventDefault();let c=l.getBoundingClientRect();t.local.zoomBy(u.deltaY<0?1.2:0.8333333333333334,{x:u.clientX-c.left-c.width/2,y:u.clientY-c.top-c.height/2})};return l.addEventListener("wheel",a,{passive:!1}),()=>l.removeEventListener("wheel",a)},[n,t.local]),i==null)return null;let s=()=>{IA(i.url).then(()=>t.local.setCopyNote(i.url,"copied ✓")).catch((l)=>t.local.setCopyNote(i.url,`copy failed: ${l instanceof Error?l.message:String(l)}`))};return p("div",{className:"modal-overlay",onClick:()=>t.local.closeLightbox(),children:y("div",{className:"lightbox",onClick:(l)=>l.stopPropagation(),children:[p("div",{ref:o,className:t.local.zoom>1?"zoom-view grabbing":"zoom-view",onDoubleClick:()=>t.local.resetZoom(),onPointerDown:(l)=>{if(t.local.zoom===1)return;l.currentTarget.setPointerCapture(l.pointerId)},onPointerMove:(l)=>{if(l.buttons!==1)return;t.local.panBy(l.movementX,l.movementY)},children:p("img",{src:i.url,alt:i.title,draggable:!1,style:{transform:`translate(${t.local.panX}px, ${t.local.panY}px) scale(${t.local.zoom})`}})}),y("div",{className:"lightbox-bar",children:[p("span",{className:"hint","data-tip":i.title,children:i.title}),t.local.zoom>1?y("button",{type:"button","data-tip":"back to fit (or double click the image)",onClick:()=>t.local.resetZoom(),children:[t.local.zoom.toFixed(1),"× · fit"]}):p("span",{className:"hint",children:"scroll to zoom, ↑ ↓ for the other images"}),VA?p("button",{type:"button",onClick:s,children:"copy"}):null,p("a",{href:i.url,target:"_blank",rel:"noreferrer",children:"open ↗"}),i.promptId!=null?t.st.hostActions.map((l)=>{let a=t.st.run.results.find((c)=>c.promptId===i.promptId),u=a?.images.findIndex((c)=>c.url===i.url)??-1;if(a==null||u<0)return null;return p("button",{type:"button",className:"host-action","data-tip":l.title,onClick:()=>t.st.postResultAction(l.id,a,{url:i.url,filename:i.title},u),children:l.label},l.id)}):null,i.promptId!=null?p("button",{type:"button","data-tip":"remove this result",onClick:()=>{if(i.promptId!=null)t.st.run.remove(i.promptId);t.local.closeLightbox()},children:"delete"}):null,t.local.copyNote?.url===i.url?p("span",{className:"hint",children:t.local.copyNote.text}):null,p("button",{type:"button","data-tip":"close (esc)",onClick:()=>t.local.closeLightbox(),children:p(T,{name:"close"})})]})]})})});function UA(e){let t=e.indexOf("</think>");if(t===-1)return e.trimStart().startsWith("<think>")?{thinking:e.replace(/^\s*<think>/,"").trim(),answer:""}:{thinking:null,answer:e.trim()};let n=e.slice(0,t).replace(/^\s*<think>/,"").trim();return{thinking:n===""?null:n,answer:e.slice(t+8).trim()}}var yI=q(function(t){let n=ua(()=>({showThinking:!1,copied:!1,toggle(){this.showThinking=!this.showThinking},markCopied(){this.copied=!0}})),{thinking:i,answer:r}=UA(t.entry.text);return y("div",{className:"run-text",children:[y("div",{className:"run-text-head",children:[p("span",{className:"hint",children:t.entry.nodeKey??"text"}),i!=null?p("button",{type:"button",className:"link","data-tip":"the model's reasoning, before its answer",onClick:()=>n.toggle(),children:n.showThinking?"hide thinking":"thinking"}):null,VA?y("button",{type:"button",className:"link","data-tip":"copy this text",onClick:()=>{navigator.clipboard.writeText(r===""?t.entry.text:r),n.markCopied()},children:[p(T,{name:"copy"})," ",n.copied?"copied":""]}):null]}),i!=null&&n.showThinking?p("pre",{className:"run-thinking",children:i}):null,r===""?p("div",{className:"noimg",children:"the model reasoned past its token budget and never answered — raise max tokens"}):p("pre",{className:"run-text-body",children:r})]})}),xI=q(function(t){let{thinking:n,answer:i}=UA(t.text),r=X(null);J(()=>{let s=r.current;if(s!=null)s.scrollTop=s.scrollHeight});let o=i!==""?i:n??"";return y("div",{className:"run-live",children:[i===""&&n!=null?p("span",{className:"hint",children:"thinking…"}):null,p("pre",{ref:r,className:i===""?"run-live-body dim":"run-live-body",children:o})]})}),wI=q(function(t){let n=t.st.run.progressPercent,i=t.st.run.progressNode,r=t.st.run.progressCount;return p("div",{className:"corner-run-anchor",children:y("div",{className:"corner-run",children:[t.st.run.hasPreview?y("button",{type:"button",className:"img-button","data-tip":"the latent so far: click to see it big",onClick:()=>t.local.openLightbox({kind:"latent",module:t.module,after:t.st.run.results.filter((o)=>o.module===t.module).length}),children:[p("img",{src:yc({module:t.module,tick:t.st.run.previewTick}),alt:"latent preview"}),p(Qy,{st:t.st})]}):null,y("div",{className:"corner-run-meta",children:[y("span",{className:"run-meta-text",children:[i==null?t.module:i,r!=null?` ${r.value}/${r.max}`:""]}),p("span",{children:n!=null?`${Math.round(n)}%`:""})]}),p("div",{className:"progress-track",children:p("div",{className:"progress-fill",style:{width:`${n??0}%`}})})]})})}),SI=q(function(t){let n=t.st.run.runningModule;if(!t.st.run.isRunning||n==null)return null;if(t.st.latentMode==="corner")return p(wI,{st:t.st,local:t.local,module:n});let i=t.st.run.progressPercent,r=yc({module:n,tick:t.st.run.previewTick}),o=t.st.run.progressNode,s=t.st.run.progressCount,l=t.st.run.progressText,a=t.st.form,u=a?.moduleKey===n?a.vars.find((h)=>h.desc.kind==="size"):void 0,c=u==null?null:_c(u.value),f=c!=null||t.st.run.hasPreview,d=c==null?1:c.width/c.height;return y("div",{className:f?"run-card running cell":"run-card running",children:[y("div",{className:"meta",children:[y("span",{className:"run-meta-text",children:["generating ",n,"…",o!=null?` · ${o}${s!=null?` ${s.value}/${s.max}`:""}`:""]}),p("span",{children:i!=null?`${Math.round(i)}%`:""})]}),l!=null&&l!==""?p(xI,{text:l}):null,f?y("div",{className:"run-frame",style:{aspectRatio:String(d),width:"100%"},children:[t.st.run.hasPreview&&t.st.latentMode==="full"?y("button",{type:"button",className:"img-button",onClick:()=>t.local.openLightbox({kind:"latent",module:n,after:t.st.run.results.filter((h)=>h.module===n).length}),children:[p("img",{src:r,alt:"latent preview"}),p(Qy,{st:t.st})]}):null,p("div",{className:"progress-track over",children:p("div",{className:"progress-fill",style:{width:`${i??0}%`}})})]}):p("div",{className:"progress-track",children:p("div",{className:"progress-fill",style:{width:`${i??0}%`}})})]})}),KA=q(function(t){let n=vI();if(t.st.run.results.length===0&&!t.st.run.isRunning)return null;let i=t.compact===!0?t.st.run.results.slice(0,1):t.st.run.results;return y("div",{className:`gallery${t.st.blurResults?" blur":""}${t.compact===!0?"":" by-cols"}`,style:t.compact===!0?void 0:{gridTemplateColumns:`repeat(${t.st.resultsColumns}, minmax(0, 1fr))`},children:[p(SI,{st:t.st,local:n}),i.map((r)=>y("div",{className:r.images.some((o)=>o.url!=null)?"run-card has-image":"run-card",children:[y("div",{className:"meta",children:[y("span",{className:"meta-text",children:[r.at," · ",r.module,"/",r.draft," · ",(r.durationMs/1000).toFixed(1),"s",Object.entries(r.seeds).map(([o,s])=>` · ${o}: ${s}`)]}),p("button",{type:"button",className:"link","data-tip":"remove this result",onClick:()=>t.st.run.remove(r.promptId),children:p(T,{name:"trash"})})]}),y("div",{className:"imgs",children:[r.images.map((o,s)=>o.url!=null?y("div",{className:"img-cell",children:[y("button",{type:"button",className:"img-button","data-tip":o.filename,onClick:()=>{if(o.url!=null)n.openLightbox({kind:"image",url:o.url,title:o.filename,promptId:r.promptId})},children:[p("img",{src:o.url,alt:o.filename,loading:"lazy"}),p(Qy,{st:t.st}),p(HA,{out:o})]}),t.st.hostActions.length>0?y("div",{className:"host-actions",children:[t.st.hostActions.map((l)=>p("button",{type:"button",className:"host-action","data-tip":l.title,onClick:()=>{if(o.url!=null)t.st.postResultAction(l.id,r,{url:o.url,filename:o.filename},s)},children:l.label},l.id)),p("button",{type:"button",className:"host-action danger","data-tip":"remove this result",onClick:()=>t.st.run.remove(r.promptId),children:"✕"})]}):null]},o.filename):y("div",{className:"noimg",children:[o.filename," (not saved, and no longer in memory)"]},o.filename)),(r.audios??[]).map((o,s)=>o.url!=null?y("div",{className:"audio-cell",children:[p("audio",{controls:!0,preload:"metadata",src:o.url}),p("a",{className:"hint",href:o.url,download:o.filename,children:o.filename}),p(HA,{out:o})]},`${r.promptId}-audio-${s}`):y("div",{className:"noimg",children:[o.filename," (not saved, and no longer in memory)"]},`${r.promptId}-audio-${s}`)),r.images.length===0&&(r.texts??[]).length===0&&(r.audios??[]).length===0?p("div",{className:"noimg",children:"no outputs"}):null]}),(r.texts??[]).map((o,s)=>p(yI,{entry:o},`${r.promptId}-${s}`))]},r.promptId)),p(bI,{st:t.st,local:n})]})});var kI={image:"image",audio:"audio",video:"video",text:"text"};function jA(e){for(let t of e){let n=kI[t];if(n!=null)return n}return"workflow"}var _I=new Set(["image","audio","video","text","llm","edit"]);function CI(e){let t=e.entry,n=["omni-row",t.kind,e.sel?"sel":"",e.open?"open":""].join(" ");if(t.kind==="draft")return y("button",{type:"button",className:n,onClick:e.onPick,children:[p(T,{name:"draft",size:0.95}),p("span",{className:"omni-draft",children:t.draft}),e.open?p("span",{className:"omni-open",children:"open"}):null]});return y("button",{type:"button",className:n,onClick:e.onPick,children:[p("span",{className:`omni-icon tint-${jA(t.tags)}`,children:p(T,{name:jA(t.tags)})}),y("span",{className:"omni-path",children:[t.folder===""?null:y("span",{className:"omni-folder",children:[t.folder," / "]}),p("span",{className:"omni-name",children:t.module})]}),y("span",{className:"omni-tags",children:[t.tags.map((i)=>p("span",{className:["omni-tag",_I.has(i)?`tint-${i}`:"",e.words.includes(i)?"hit":""].join(" "),children:i},i)),p("span",{className:"omni-host",children:t.host})]})]})}function FA(e){J(()=>{let t=(n)=>{if(!BO(n))return;n.preventDefault(),e.omnibox.toggle()};return window.addEventListener("keydown",t),()=>window.removeEventListener("keydown",t)},[e])}var qA=q(function(t){let n=t.st.omnibox,i=X(null);if(J(()=>{i.current?.querySelector(".omni-row.sel")?.scrollIntoView({block:"nearest"})},[n.cursor,n.query]),!n.isOpen)return null;let r=n.results,o=Object.entries(t.st.loadErrors),s=t.st.form,l=n.query.trim().toLowerCase().split(/\s+/);return p("div",{className:"modal-overlay omni-overlay",onClick:()=>n.close(),children:y("div",{className:"modal omni",onClick:(a)=>a.stopPropagation(),children:[p("div",{className:"modal-head",children:p("input",{type:"text",autoFocus:!0,placeholder:"workflow, draft or tag (audio, image, edit…)",value:n.query,onChange:(a)=>n.setQuery(a.target.value),onKeyDown:(a)=>{if(a.key==="ArrowDown")n.move(1);else if(a.key==="ArrowUp")n.move(-1);else if(a.key==="Enter")n.pick();else if(a.key==="Escape")n.close();else return;a.preventDefault()}})}),y("div",{className:"modal-body omni-list",ref:i,children:[r.length===0?p("div",{className:"hint",children:"no workflow or draft matches"}):null,r.map((a,u)=>p(CI,{entry:a,sel:u===n.cursor,open:a.kind==="draft"&&s?.moduleKey===a.module&&s.draft===a.draft,words:l,onPick:()=>n.pick(a)},HR(a))),o.length>0?y("div",{className:"omni-errors",children:[p("div",{className:"section-title",children:"failed to load"}),o.map(([a,u])=>y("div",{children:[p("div",{className:"file",children:a}),p("div",{className:"msg",children:u})]},a))]}):null]})]})})});function tp(){return typeof window<"u"}function Ao(e){if(np(e))return(e.nodeName||"").toLowerCase();return"#document"}function It(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Ji(e){var t;return(t=(np(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function np(e){if(!tp())return!1;return e instanceof Node||e instanceof It(e).Node}function Qe(e){if(!tp())return!1;return e instanceof Element||e instanceof It(e).Element}function qn(e){if(!tp())return!1;return e instanceof HTMLElement||e instanceof It(e).HTMLElement}function Cc(e){if(!tp()||typeof ShadowRoot>"u")return!1;return e instanceof ShadowRoot||e instanceof It(e).ShadowRoot}function Ec(e){let{overflow:t,overflowX:n,overflowY:i,display:r}=Sn(e);return/auto|scroll|overlay|hidden|clip/.test(t+i+n)&&r!=="inline"&&r!=="contents"}function $A(e){return/^(table|td|th)$/.test(Ao(e))}function Oc(e){try{if(e.matches(":popover-open"))return!0}catch(t){}try{return e.matches(":modal")}catch(t){return!1}}var EI=/transform|translate|scale|rotate|perspective|filter/,OI=/paint|layout|strict|content/,Ns=(e)=>!!e&&e!=="none",Jy;function ip(e){let t=Qe(e)?Sn(e):e;return Ns(t.transform)||Ns(t.translate)||Ns(t.scale)||Ns(t.rotate)||Ns(t.perspective)||!xa()&&(Ns(t.backdropFilter)||Ns(t.filter))||EI.test(t.willChange||"")||OI.test(t.contain||"")}function XA(e){let t=Qi(e);while(qn(t)&&!Zi(t)){if(ip(t))return t;else if(Oc(t))return null;t=Qi(t)}return null}function xa(){if(Jy==null)Jy=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none");return Jy}function Zi(e){return/^(html|body|#document)$/.test(Ao(e))}function Sn(e){return It(e).getComputedStyle(e)}function Rc(e){if(Qe(e))return{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop};return{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Qi(e){if(Ao(e)==="html")return e;let t=e.assignedSlot||e.parentNode||Cc(e)&&e.host||Ji(e);return Cc(t)?t.host:t}function GA(e){let t=Qi(e);if(Zi(t))return(e.ownerDocument||e).body;if(qn(t)&&Ec(t))return t;return GA(t)}function wn(e,t,n){var i;if(t===void 0)t=[];if(n===void 0)n=!0;let r=GA(e),o=r===((i=e.ownerDocument)==null?void 0:i.body),s=It(r);if(o){let l=rp(s);return t.concat(s,s.visualViewport||[],Ec(r)?r:[],l&&n?wn(l):[])}else return t.concat(r,wn(r,[],n))}function rp(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}var{min:wa,max:Lr,round:Tc,floor:Mc}=Math,er=(e)=>({x:e,y:e}),RI={left:"right",right:"left",bottom:"top",top:"bottom"};function QA(e,t,n){return Lr(e,wa(t,n))}function Nc(e,t){return typeof e==="function"?e(t):e}function Ds(e){return e.split("-")[0]}function Dc(e){return e.split("-")[1]}function Zy(e){return e==="x"?"y":"x"}function e0(e){return e==="y"?"height":"width"}function zr(e){let t=e[0];return t==="t"||t==="b"?"y":"x"}function t0(e){return Zy(zr(e))}function JA(e,t,n){if(n===void 0)n=!1;let i=Dc(e),r=t0(e),o=e0(r),s=r==="x"?i===(n?"end":"start")?"right":"left":i==="start"?"bottom":"top";if(t.reference[o]>t.floating[o])s=Ac(s);return[s,Ac(s)]}function ZA(e){let t=Ac(e);return[op(e),t,op(t)]}function op(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}var YA=["left","right"],WA=["right","left"],AI=["top","bottom"],TI=["bottom","top"];function MI(e,t,n){switch(e){case"top":case"bottom":if(n)return t?WA:YA;return t?YA:WA;case"left":case"right":return t?AI:TI;default:return[]}}function eT(e,t,n,i){let r=Dc(e),o=MI(Ds(e),n==="start",i);if(r){if(o=o.map((s)=>s+"-"+r),t)o=o.concat(o.map(op))}return o}function Ac(e){let t=Ds(e);return RI[t]+e.slice(t.length)}function NI(e){var t,n,i,r;return{top:(t=e.top)!=null?t:0,right:(n=e.right)!=null?n:0,bottom:(i=e.bottom)!=null?i:0,left:(r=e.left)!=null?r:0}}function tT(e){return typeof e!=="number"?NI(e):{top:e,right:e,bottom:e,left:e}}function Ls(e){let{x:t,y:n,width:i,height:r}=e;return{width:i,height:r,top:n,left:t,right:t+i,bottom:n+r,x:t,y:n}}/*!
19
19
  * tabbable 6.5.0
20
20
  * @license MIT, https://github.com/focus-trap/tabbable/blob/master/LICENSE
21
- */var cI=["input:not([inert]):not([inert] *)","select:not([inert]):not([inert] *)","textarea:not([inert]):not([inert] *)","a[href]:not([inert]):not([inert] *)","area[href]:not([inert]):not([inert] *)","button:not([inert]):not([inert] *)","[tabindex]:not(slot):not([inert]):not([inert] *)","audio[controls]:not([inert]):not([inert] *)","video[controls]:not([inert]):not([inert] *)",'[contenteditable]:not([contenteditable="false"]):not([inert]):not([inert] *)',"details>summary:first-of-type:not([inert]):not([inert] *)","details:not([inert]):not([inert] *)"],G0=cI.join(","),UR=typeof Element>"u",Ac=UR?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,tp=!UR&&Element.prototype.getRootNode?function(e){var t;return e===null||e===void 0?void 0:(t=e.getRootNode)===null||t===void 0?void 0:t.call(e)}:function(e){return e===null||e===void 0?void 0:e.ownerDocument},np=function(t,n){var i;if(n===void 0)n=!0;var r=t===null||t===void 0?void 0:(i=t.getAttribute)===null||i===void 0?void 0:i.call(t,"inert"),o=r===""||r==="true",s=o||n&&t&&(typeof t.closest==="function"?t.closest("[inert]"):np(t.parentNode));return s},fI=function(t){var n,i=t===null||t===void 0?void 0:(n=t.getAttribute)===null||n===void 0?void 0:n.call(t,"contenteditable");return i===""||i==="true"},dI=function(t,n,i){if(np(t))return[];var r=Array.prototype.slice.apply(t.querySelectorAll(G0));if(n&&Ac.call(t,G0))r.unshift(t);return r=r.filter(i),r},Y0=function(t,n,i){var r=[],o=Array.from(t);while(o.length){var s=o.shift();if(np(s,!1))continue;if(s.tagName==="SLOT"){var l=s.assignedElements(),a=l.length?l:s.children,u=Y0(a,!0,i);if(i.flatten)r.push.apply(r,u);else r.push({scopeParent:s,candidates:u})}else{var c=Ac.call(s,G0);if(c&&i.filter(s)&&(n||!t.includes(s)))r.push(s);var f=s.shadowRoot||typeof i.getShadowRoot==="function"&&i.getShadowRoot(s),d=!np(f,!1)&&(!i.shadowRootFilter||i.shadowRootFilter(s));if(f&&d){var h=Y0(f===!0?s.children:f.children,!0,i);if(i.flatten)r.push.apply(r,h);else r.push({scopeParent:s,candidates:h})}else o.unshift.apply(o,s.children)}}return r},jR=function(t){return!isNaN(parseInt(t.getAttribute("tabindex"),10))},KR=function(t){if(!t)throw Error("No node provided");if(t.tabIndex<0){if((/^(AUDIO|VIDEO|DETAILS)$/.test(t.tagName)||fI(t))&&!jR(t))return 0}return t.tabIndex},hI=function(t,n){var i=KR(t);if(i<0&&n&&!jR(t))return 0;return i},pI=function(t,n){return t.tabIndex===n.tabIndex?t.documentOrder-n.documentOrder:t.tabIndex-n.tabIndex},FR=function(t){return t.tagName==="INPUT"},mI=function(t){return FR(t)&&t.type==="hidden"},gI=function(t){var n=t.tagName==="DETAILS"&&Array.prototype.slice.apply(t.children).some(function(i){return i.tagName==="SUMMARY"});return n},vI=function(t,n){for(var i=0;i<t.length;i++)if(t[i].checked&&t[i].form===n)return t[i]},bI=function(t){if(!t.name)return!0;var n=t.form||tp(t),i=function(l){return n.querySelectorAll('input[type="radio"][name="'+l+'"]')},r;if(typeof window<"u"&&typeof window.CSS<"u"&&typeof window.CSS.escape==="function")r=i(window.CSS.escape(t.name));else try{r=i(t.name)}catch(s){return console.error("Looks like you have a radio button with a name attribute containing invalid CSS selector characters and need the CSS.escape polyfill: %s",s.message),!1}var o=vI(r,t.form);return!o||o===t},yI=function(t){return FR(t)&&t.type==="radio"},xI=function(t){return yI(t)&&!bI(t)},wI=function(t){var n,i=t&&tp(t),r=(n=i)===null||n===void 0?void 0:n.host,o=!1;if(i&&i!==t){var s,l,a;o=!!((s=r)!==null&&s!==void 0&&(l=s.ownerDocument)!==null&&l!==void 0&&l.contains(r)||t!==null&&t!==void 0&&(a=t.ownerDocument)!==null&&a!==void 0&&a.contains(t));while(!o&&r){var u,c,f;i=tp(r),r=(u=i)===null||u===void 0?void 0:u.host,o=!!((c=r)!==null&&c!==void 0&&(f=c.ownerDocument)!==null&&f!==void 0&&f.contains(r))}}return o},VR=function(t){var n=t.getBoundingClientRect(),{width:i,height:r}=n;return i===0&&r===0},SI=function(t,n){var{displayCheck:i,getShadowRoot:r}=n;if(i==="full-native"){if("checkVisibility"in t){var o=t.checkVisibility({checkOpacity:!1,opacityProperty:!1,contentVisibilityAuto:!0,visibilityProperty:!0,checkVisibilityCSS:!0});return!o}}var s=getComputedStyle(t),l=s.visibility;if(l==="hidden"||l==="collapse")return!0;var a=Ac.call(t,"details>summary:first-of-type"),u=a?t.parentElement:t;if(Ac.call(u,"details:not([open]) *"))return!0;if(!i||i==="full"||i==="full-native"||i==="legacy-full"){if(typeof r==="function"){var c=t;while(t){var f=t.parentElement,d=tp(t);if(f&&!f.shadowRoot&&r(f)===!0)return VR(t);else if(t.assignedSlot)t=t.assignedSlot;else if(!f&&d!==t.ownerDocument)t=d.host;else t=f}t=c}if(wI(t))return!t.getClientRects().length;if(i!=="legacy-full")return!0}else if(i==="non-zero-area")return VR(t);return!1},kI=function(t){if(/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(t.tagName)){var n=t.parentElement;while(n){if(n.tagName==="FIELDSET"&&n.disabled){for(var i=0;i<n.children.length;i++){var r=n.children.item(i);if(r.tagName==="LEGEND")return Ac.call(n,"fieldset[disabled] *")?!0:!r.contains(t)}return!0}n=n.parentElement}}return!1},_I=function(t,n){if(n.disabled||mI(n)||SI(n,t)||gI(n)||kI(n))return!1;return!0},HR=function(t,n){if(xI(n)||KR(n)<0||!_I(t,n))return!1;return!0},CI=function(t){var n=parseInt(t.getAttribute("tabindex"),10);if(isNaN(n)||n>=0)return!0;return!1},qR=function(t){var n=[],i=[];return t.forEach(function(r,o){var s=!!r.scopeParent,l=s?r.scopeParent:r,a=hI(l,s),u=s?qR(r.candidates):l;if(a===0)s?n.push.apply(n,u):n.push(l);else i.push({documentOrder:o,tabIndex:a,item:r,isScope:s,content:u})}),i.sort(pI).reduce(function(r,o){return o.isScope?r.push.apply(r,o.content):r.push(o.content),r},[]).concat(n)},W0=function(t,n){n=n||{};var i;if(n.getShadowRoot)i=Y0([t],n.includeContainer,{filter:HR.bind(null,n),flatten:!1,getShadowRoot:n.getShadowRoot,shadowRootFilter:CI});else i=dI(t,n.includeContainer,HR.bind(null,n));return qR(i)};function $R(){return/apple/i.test(navigator.vendor)}function XR(e){let t=e.activeElement;while(((n=t)==null||(n=n.shadowRoot)==null?void 0:n.activeElement)!=null){var n;t=t.shadowRoot.activeElement}return t}function ip(e,t){if(!e||!t)return!1;let n=t.getRootNode==null?void 0:t.getRootNode();if(e.contains(t))return!0;if(n&&yc(n)){let i=t;while(i){if(e===i)return!0;i=i.parentNode||i.host}}return!1}function ga(e){if("composedPath"in e)return e.composedPath()[0];return e.target}function rp(e,t){if(t==null)return!1;if("composedPath"in e)return e.composedPath().includes(t);let n=e;return n.target!=null&&t.contains(n.target)}function GR(e){return e.matches("html,body")}function va(e){return(e==null?void 0:e.ownerDocument)||document}function Rc(e,t,n){if(n===void 0)n=!0;return e.filter((r)=>{var o;return r.parentId===t&&(!n||((o=r.context)==null?void 0:o.open))}).flatMap((r)=>[r,...Rc(e,r.id,n)])}function YR(e){return"nativeEvent"in e}var EI=typeof document<"u",OI=function(){},To=EI?ti:OI,AI={...ur};var RI=AI.useInsertionEffect,TI=RI||((e)=>e());function Ds(e){let t=X(()=>{});return TI(()=>{t.current=e}),st(function(){for(var n=arguments.length,i=Array(n),r=0;r<n;r++)i[r]=arguments[r];return t.current==null?void 0:t.current(...i)},[])}var Q0=()=>({getShadowRoot:!0,displayCheck:typeof ResizeObserver==="function"&&ResizeObserver.toString().includes("[native code]")?"full":"none"});function WR(e,t){let n=W0(e,Q0()),i=n.length;if(i===0)return;let r=XR(va(e)),o=n.indexOf(r),s=o===-1?t===1?0:i-1:o+t;return n[s]}function QR(e){return WR(va(e).body,1)||e}function JR(e){return WR(va(e).body,-1)||e}function op(e,t){let n=t||e.currentTarget,i=e.relatedTarget;return!i||!ip(n,i)}function ZR(e){W0(e,Q0()).forEach((n)=>{n.dataset.tabindex=n.getAttribute("tabindex")||"",n.setAttribute("tabindex","-1")})}function J0(e){e.querySelectorAll("[data-tabindex]").forEach((n)=>{let i=n.dataset.tabindex;if(delete n.dataset.tabindex,i)n.setAttribute("tabindex",i);else n.removeAttribute("tabindex")})}function eT(e,t,n){let{reference:i,floating:r}=e,o=zr(t),s=X0(t),l=$0(s),a=Ms(t),u=o==="y",c=i.x+i.width/2-r.width/2,f=i.y+i.height/2-r.height/2,d=i[l]/2-r[l]/2,h;switch(a){case"top":h={x:c,y:i.y-r.height};break;case"bottom":h={x:c,y:i.y+i.height};break;case"right":h={x:i.x+i.width,y:f};break;case"left":h={x:i.x-r.width,y:f};break;default:h={x:i.x,y:i.y}}let m=Oc(t);if(m)h[s]+=d*(m==="end"?1:-1)*(n&&u?-1:1);return h}async function tT(e,t){var n;if(t===void 0)t={};let{x:i,y:r,platform:o,rects:s,elements:l,strategy:a}=e,{boundary:u="clippingAncestors",rootBoundary:c="viewport",elementContext:f="floating",altBoundary:d=!1,padding:h=0}=Ec(t,e),m=IR(h),x=l[d?f==="floating"?"reference":"floating":f],g=Ns(await o.getClippingRect({element:((n=await(o.isElement==null?void 0:o.isElement(x)))!=null?n:!0)?x:x.contextElement||await(o.getDocumentElement==null?void 0:o.getDocumentElement(l.floating)),boundary:u,rootBoundary:c,strategy:a})),v=f==="floating"?{x:i,y:r,width:s.floating.width,height:s.floating.height}:s.reference,w=await(o.getOffsetParent==null?void 0:o.getOffsetParent(l.floating)),S=await(o.isElement==null?void 0:o.isElement(w))&&await(o.getScale==null?void 0:o.getScale(w))||{x:1,y:1},k=Ns(o.convertOffsetParentRelativeRectToViewportRelativeRect?await o.convertOffsetParentRelativeRectToViewportRelativeRect({elements:l,rect:v,offsetParent:w,strategy:a}):v);return{top:(g.top-k.top+m.top)/S.y,bottom:(k.bottom-g.bottom+m.bottom)/S.y,left:(g.left-k.left+m.left)/S.x,right:(k.right-g.right+m.right)/S.x}}var MI=50,nT=async(e,t,n)=>{let{placement:i="bottom",strategy:r="absolute",middleware:o=[],platform:s}=n,l=s.detectOverflow?s:{...s,detectOverflow:tT},a=await(s.isRTL==null?void 0:s.isRTL(t)),u=await s.getElementRects({reference:e,floating:t,strategy:r}),{x:c,y:f}=eT(u,i,a),d=i,h=0,m={};for(let b=0;b<o.length;b++){let x=o[b];if(!x)continue;let{name:g,fn:v}=x,{x:w,y:S,data:k,reset:E}=await v({x:c,y:f,initialPlacement:i,placement:d,strategy:r,middlewareData:m,rects:u,platform:l,elements:{reference:e,floating:t}});if(c=w!=null?w:c,f=S!=null?S:f,m[g]={...m[g],...k},E&&h<MI){if(h++,typeof E==="object"){if(E.placement)d=E.placement;if(E.rects)u=E.rects===!0?await s.getElementRects({reference:e,floating:t,strategy:r}):E.rects;({x:c,y:f}=eT(u,d,a))}b=-1}}return{x:c,y:f,placement:d,strategy:r,middlewareData:m}};var iT=function(e){if(e===void 0)e={};return{name:"flip",options:e,async fn(t){var n,i;let{placement:r,middlewareData:o,rects:s,initialPlacement:l,platform:a,elements:u}=t,{mainAxis:c=!0,crossAxis:f=!0,fallbackPlacements:d,fallbackStrategy:h="bestFit",fallbackAxisSideDirection:m="none",flipAlignment:b=!0,...x}=Ec(e,t);if((n=o.arrow)!=null&&n.alignmentOffset)return{};let g=Ms(r),v=zr(l),w=Ms(l)===l,S=await(a.isRTL==null?void 0:a.isRTL(u.floating)),k=d||(w||!b?[kc(l)]:BR(l)),E=m!=="none";if(!d&&E)k.push(...PR(l,b,m,S));let _=[l,...k],O=await a.detectOverflow(t,x),P=[],T=((i=o.flip)==null?void 0:i.overflows)||[];if(c)P.push(O[g]);if(f){let N=zR(r,s,S);P.push(O[N[0]],O[N[1]])}if(T=[...T,{placement:r,overflows:P}],!P.every((N)=>N<=0)){var I,V;let N=(((I=o.flip)==null?void 0:I.index)||0)+1,D=_[N];if(D){if(!(f==="alignment"?v!==zr(D):!1)||T.every((L)=>zr(L.placement)===v?L.overflows[0]>0:!0))return{data:{index:N,overflows:T},reset:{placement:D}}}let H=(V=T.filter((G)=>G.overflows[0]<=0).sort((G,L)=>G.overflows[1]-L.overflows[1])[0])==null?void 0:V.placement;if(!H)switch(h){case"bestFit":{var Y;let G=(Y=T.filter((L)=>{if(E){let ee=zr(L.placement);return ee===v||ee==="y"}return!0}).map((L)=>[L.placement,L.overflows.filter((ee)=>ee>0).reduce((ee,he)=>ee+he,0)]).sort((L,ee)=>L[1]-ee[1])[0])==null?void 0:Y[0];if(G)H=G;break}case"initialPlacement":H=l;break}if(r!==H)return{reset:{placement:H}}}return{}}}};var NI=new Set(["left","top"]);async function DI(e,t){let{placement:n,platform:i,elements:r}=e,o=await(i.isRTL==null?void 0:i.isRTL(r.floating)),s=Ms(n),l=Oc(n),a=zr(n)==="y",u=NI.has(s)?-1:1,c=o&&a?-1:1,f=Ec(t,e),{mainAxis:d,crossAxis:h,alignmentAxis:m}=typeof f==="number"?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:f.mainAxis||0,crossAxis:f.crossAxis||0,alignmentAxis:f.alignmentAxis};if(l&&typeof m==="number")h=l==="end"?m*-1:m;return a?{x:h*c,y:d*u}:{x:d*u,y:h*c}}var rT=function(e){if(e===void 0)e=0;return{name:"offset",options:e,async fn(t){var n,i;let{x:r,y:o,placement:s,middlewareData:l}=t,a=await DI(t,e);if(s===((n=l.offset)==null?void 0:n.placement)&&(i=l.arrow)!=null&&i.alignmentOffset)return{};return{x:r+a.x,y:o+a.y,data:{...a,placement:s}}}}},oT=function(e){if(e===void 0)e={};return{name:"shift",options:e,async fn(t){let{x:n,y:i,placement:r,platform:o}=t,{mainAxis:s=!0,crossAxis:l=!1,limiter:a={fn:(v)=>{let{x:w,y:S}=v;return{x:w,y:S}}},...u}=Ec(e,t),c={x:n,y:i},f=await o.detectOverflow(t,u),d=zr(r),h=q0(d),m=c[h],b=c[d],x=(v,w)=>LR(w+f[v==="y"?"top":"left"],w,w-f[v==="y"?"bottom":"right"]);if(s)m=x(h,m);if(l)b=x(d,b);let g=a.fn({...t,[h]:m,[d]:b});return{...g,data:{x:g.x-n,y:g.y-i,enabled:{[h]:s,[d]:l}}}}}};function aT(e){let t=Sn(e),n=parseFloat(t.width)||0,i=parseFloat(t.height)||0,r=qn(e),o=r?e.offsetWidth:n,s=r?e.offsetHeight:i,l=_c(n)!==o||_c(i)!==s;if(l)n=o,i=s;return{width:n,height:i,$:l}}function ey(e){return!Je(e)?e.contextElement:e}function ba(e){let t=ey(e);if(!qn(t))return er(1);let n=t.getBoundingClientRect(),{width:i,height:r,$:o}=aT(t),s=(o?_c(n.width):n.width)/i,l=(o?_c(n.height):n.height)/r;if(!s||!Number.isFinite(s))s=1;if(!l||!Number.isFinite(l))l=1;return{x:s,y:l}}var LI=er(0);function uT(e){let t=It(e);if(!pa()||!t.visualViewport)return LI;return{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function zI(e,t,n){if(t===void 0)t=!1;return!!n&&t&&n===It(e)}function Ls(e,t,n,i){if(t===void 0)t=!1;if(n===void 0)n=!1;let r=e.getBoundingClientRect(),o=ey(e),s=er(1);if(t)if(i){if(Je(i))s=ba(i)}else s=ba(e);let l=zI(o,n,i)?uT(o):er(0),a=(r.left+l.x)/s.x,u=(r.top+l.y)/s.y,c=r.width/s.x,f=r.height/s.y;if(o&&i){let d=It(o),h=Je(i)?It(i):i,m=d,b=Zh(m);while(b&&h!==m){let x=ba(b),g=b.getBoundingClientRect(),v=Sn(b),w=g.left+(b.clientLeft+parseFloat(v.paddingLeft))*x.x,S=g.top+(b.clientTop+parseFloat(v.paddingTop))*x.y;a*=x.x,u*=x.y,c*=x.x,f*=x.y,a+=w,u+=S,m=It(b),b=Zh(m)}}return Ns({width:c,height:f,x:a,y:u})}function sp(e,t){let n=Sc(e).scrollLeft;if(!t)return Ls(Ji(e)).left+n;return t.left+n}function cT(e,t){let n=e.getBoundingClientRect(),i=n.left+t.scrollLeft-sp(e,n),r=n.top+t.scrollTop;return{x:i,y:r}}function BI(e){let{elements:t,rect:n,offsetParent:i,strategy:r}=e,o=r==="fixed",s=Ji(i),l=t?wc(t.floating):!1;if(i===s||l&&o)return n;let a={scrollLeft:0,scrollTop:0},u=er(1),c=er(0),f=qn(i);if(f||!o){if(Ro(i)!=="body"||xc(s))a=Sc(i);if(f){let h=Ls(i);u=ba(i),c.x=h.x+i.clientLeft,c.y=h.y+i.clientTop}}let d=s&&!f&&!o?cT(s,a):er(0);return{width:n.width*u.x,height:n.height*u.y,x:n.x*u.x-a.scrollLeft*u.x+c.x+d.x,y:n.y*u.y-a.scrollTop*u.y+c.y+d.y}}function PI(e){return e.getClientRects?Array.from(e.getClientRects()):[]}function II(e){let t=Sc(e),n=e.ownerDocument.body,i=Lr(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),r=Lr(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight),o=-t.scrollLeft+sp(e),s=-t.scrollTop;if(Sn(n).direction==="rtl")o+=Lr(e.clientWidth,n.clientWidth)-i;return{width:i,height:r,x:o,y:s}}var VI=25;function HI(e,t,n){if(n===void 0)n="viewport";let i=n==="layoutViewport",r=It(e),o=Ji(e),s=r.visualViewport,{clientWidth:l,clientHeight:a}=o,u=0,c=0;if(s){let d=!pa()||t==="fixed";if(i){if(!d)u=-s.offsetLeft,c=-s.offsetTop}else if(l=s.width,a=s.height,d)u=s.offsetLeft,c=s.offsetTop}if(sp(o)<=0){let d=o.ownerDocument,h=d.body,m=getComputedStyle(h),b=d.compatMode==="CSS1Compat"?parseFloat(m.marginLeft)+parseFloat(m.marginRight)||0:0,x=Math.abs(o.clientWidth-h.clientWidth-b),g=getComputedStyle(o).scrollbarGutter==="stable both-edges"?x/2:x;if(g<=VI)l-=g}return{width:l,height:a,x:u,y:c}}function UI(e,t){let n=Ls(e,!0,t==="fixed"),i=n.top+e.clientTop,r=n.left+e.clientLeft,o=ba(e),s=e.clientWidth*o.x,l=e.clientHeight*o.y,a=r*o.x,u=i*o.y;return{width:s,height:l,x:a,y:u}}function sT(e,t,n){let i;if(t==="viewport"||t==="layoutViewport")i=HI(e,n,t);else if(t==="document")i=II(Ji(e));else if(Je(t))i=UI(t,n);else{let r=uT(e);i={x:t.x-r.x,y:t.y-r.y,width:t.width,height:t.height}}return Ns(i)}function jI(e,t){let n=t.get(e);if(n)return n;let i=wn(e,[],!1).filter((l)=>Je(l)&&Ro(l)!=="body"),r=null,o=Sn(e).position==="fixed",s=o?Qi(e):e;while(Je(s)&&!Zi(s)){let l=Sn(s),a=Jh(s),u=r?r.position:o?"fixed":"";if(!a&&(u==="fixed"||u==="absolute"&&l.position==="static"))i=i.filter((f)=>f!==s);else r=l;s=Qi(s)}return t.set(e,i),i}function KI(e){let{element:t,boundary:n,rootBoundary:i,strategy:r}=e,s=[...n==="clippingAncestors"?wc(t)?[]:jI(t,this._c):[].concat(n),i],l=sT(t,s[0],r),{top:a,right:u,bottom:c,left:f}=l;for(let d=1;d<s.length;d++){let h=sT(t,s[d],r);a=Lr(h.top,a),u=ma(h.right,u),c=ma(h.bottom,c),f=Lr(h.left,f)}return{width:u-f,height:c-a,x:f,y:a}}function FI(e){let{width:t,height:n}=aT(e);return{width:t,height:n}}function qI(e,t,n){let i=qn(t),r=Ji(t),o=n==="fixed",s=Ls(e,!0,o,t),l={scrollLeft:0,scrollTop:0},a=er(0);if(i||!o){if(Ro(t)!=="body"||xc(r))l=Sc(t);if(i){let d=Ls(t,!0,o,t);a.x=d.x+t.clientLeft,a.y=d.y+t.clientTop}}if(!i&&r)a.x=sp(r);let u=r&&!i&&!o?cT(r,l):er(0),c=s.left+l.scrollLeft-a.x-u.x,f=s.top+l.scrollTop-a.y-u.y;return{x:c,y:f,width:s.width,height:s.height}}function Z0(e){return Sn(e).position==="static"}function lT(e,t){if(!qn(e)||Sn(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;if(Ji(e)===n)n=n.ownerDocument.body;return n}function fT(e,t){let n=It(e);if(wc(e))return n;if(!qn(e)){let r=Qi(e);while(r&&!Zi(r)){if(Je(r)&&!Z0(r))return r;r=Qi(r)}return n}let i=lT(e,t);while(i&&RR(i)&&Z0(i))i=lT(i,t);if(i&&Zi(i)&&Z0(i)&&!Jh(i))return n;return i||TR(e)||n}var $I=async function(e){let t=this.getOffsetParent||fT,n=this.getDimensions,i=await n(e.floating);return{reference:qI(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:i.width,height:i.height}}};function XI(e){return Sn(e).direction==="rtl"}var ty={convertOffsetParentRelativeRectToViewportRelativeRect:BI,getDocumentElement:Ji,getClippingRect:KI,getOffsetParent:fT,getElementRects:$I,getClientRects:PI,getDimensions:FI,getScale:ba,isElement:Je,isRTL:XI};function dT(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function GI(e,t,n){let i=null,r,o=Ji(e);function s(){var c;clearTimeout(r),(c=i)==null||c.disconnect(),i=null}function l(c,f){if(c===void 0)c=!1;if(f===void 0)f=1;s();let d=e.getBoundingClientRect(),{left:h,top:m,width:b,height:x}=d;if(!c)t();if(!b||!x)return;let g=Cc(m),v=Cc(o.clientWidth-(h+b)),w=Cc(o.clientHeight-(m+x)),S=Cc(h),E={rootMargin:-g+"px "+-v+"px "+-w+"px "+-S+"px",threshold:Lr(0,ma(1,f))||1},_=!0;function O(P){let T=P[0].intersectionRatio;if(!dT(d,e.getBoundingClientRect()))return l();if(T!==f){if(!_)return l();if(!T)r=setTimeout(()=>{l(!1,0.0000001)},1000);else l(!1,T)}_=!1}try{i=new IntersectionObserver(O,{...E,root:o.ownerDocument})}catch(P){i=new IntersectionObserver(O,E)}i.observe(e)}let a=It(e),u=()=>l(n);return a.addEventListener("resize",u),l(!0),()=>{a.removeEventListener("resize",u),s()}}function ya(e,t,n,i){if(i===void 0)i={};let{ancestorScroll:r=!0,ancestorResize:o=!0,elementResize:s=typeof ResizeObserver==="function",layoutShift:l=typeof IntersectionObserver==="function",animationFrame:a=!1}=i,u=ey(e),c=r||o?[...u?wn(u):[],...t?wn(t):[]]:[];c.forEach((g)=>{r&&g.addEventListener("scroll",n),o&&g.addEventListener("resize",n)});let f=u&&l?GI(u,n,o):null,d=-1,h=null;if(s){if(h=new ResizeObserver((g)=>{let[v]=g;if(v&&v.target===u&&h&&t)h.unobserve(t),cancelAnimationFrame(d),d=requestAnimationFrame(()=>{var w;(w=h)==null||w.observe(t)});n()}),u&&!a)h.observe(u);if(t)h.observe(t)}let m,b=a?Ls(e):null;if(a)x();function x(){let g=Ls(e);if(b&&!dT(b,g))n();b=g,m=requestAnimationFrame(x)}return n(),()=>{var g;if(c.forEach((v)=>{r&&v.removeEventListener("scroll",n),o&&v.removeEventListener("resize",n)}),f==null||f(),(g=h)==null||g.disconnect(),h=null,a)cancelAnimationFrame(m)}}var hT=rT;var pT=oT,mT=iT;var lp=(e,t,n)=>{let i=new Map,r=n!=null?n:{},o={...ty,...r.platform,_c:i};return nT(e,t,{...r,platform:o})};var WI=typeof document<"u",QI=function(){},ap=WI?ti:QI;function up(e,t){if(e===t)return!0;if(typeof e!==typeof t)return!1;if(typeof e==="function"&&e.toString()===t.toString())return!0;let n,i,r;if(e&&t&&typeof e==="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(i=n;i--!==0;)if(!up(e[i],t[i]))return!1;return!0}if(r=Object.keys(e),n=r.length,n!==Object.keys(t).length)return!1;for(i=n;i--!==0;)if(!{}.hasOwnProperty.call(t,r[i]))return!1;for(i=n;i--!==0;){let o=r[i];if(o==="_owner"&&e.$$typeof)continue;if(!up(e[o],t[o]))return!1}return!0}return e!==e&&t!==t}function vT(e){if(typeof window>"u")return 1;return(e.ownerDocument.defaultView||window).devicePixelRatio||1}function gT(e,t){let n=vT(e);return Math.round(t*n)/n}function ny(e){let t=X(e);return ap(()=>{t.current=e}),t}function bT(e){if(e===void 0)e={};let{placement:t="bottom",strategy:n="absolute",middleware:i=[],platform:r,elements:{reference:o,floating:s}={},transform:l=!0,whileElementsMounted:a,open:u}=e,[c,f]=Q({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[d,h]=Q(i);if(!up(d,i))h(i);let[m,b]=Q(null),[x,g]=Q(null),v=st((L)=>{if(L!==E.current)E.current=L,b(L)},[]),w=st((L)=>{if(L!==_.current)_.current=L,g(L)},[]),S=o||m,k=s||x,E=X(null),_=X(null),O=X(c),P=a!=null,T=ny(a),I=ny(r),V=ny(u),Y=st(()=>{if(!E.current||!_.current)return;let L={placement:t,strategy:n,middleware:d};if(I.current)L.platform=I.current;lp(E.current,_.current,L).then((ee)=>{let he={...ee,isPositioned:V.current!==!1};if(N.current&&!up(O.current,he))O.current=he,zf(()=>{f(he)})})},[d,t,n,I,V]);ap(()=>{if(u===!1&&O.current.isPositioned)O.current.isPositioned=!1,f((L)=>({...L,isPositioned:!1}))},[u]);let N=X(!1);ap(()=>(N.current=!0,()=>{N.current=!1}),[]),ap(()=>{if(S)E.current=S;if(k)_.current=k;if(S&&k){if(T.current)return T.current(S,k,Y);Y()}},[S,k,Y,T,P]);let D=Ke(()=>({reference:E,floating:_,setReference:v,setFloating:w}),[v,w]),H=Ke(()=>({reference:S,floating:k}),[S,k]),G=Ke(()=>{let L={position:n,left:0,top:0};if(!H.floating)return L;let ee=gT(H.floating,c.x),he=gT(H.floating,c.y);if(l)return{...L,transform:"translate("+ee+"px, "+he+"px)",...vT(H.floating)>=1.5&&{willChange:"transform"}};return{position:n,left:ee,top:he}},[n,l,H.floating,c.x,c.y]);return Ke(()=>({...c,update:Y,refs:D,elements:H,floatingStyles:G}),[c,Y,D,H,G])}var xa=(e,t)=>{let n=hT(e);return{name:n.name,fn:n.fn,options:[e,t]}},Tc=(e,t)=>{let n=pT(e);return{name:n.name,fn:n.fn,options:[e,t]}};var Mc=(e,t)=>{let n=mT(e);return{name:n.name,fn:n.fn,options:[e,t]}};var JI="data-floating-ui-focusable",yT="active",xT="selected",ZI="ArrowLeft",e8="ArrowRight",t8="ArrowUp",n8="ArrowDown";var i8=[ZI,e8],r8=[t8,n8],VK=[...i8,...r8];var o8={...ur},wT=!1,s8=0,ST=()=>"floating-ui-"+Math.random().toString(36).slice(2,6)+s8++;function l8(){let[e,t]=Q(()=>wT?ST():void 0);return To(()=>{if(e==null)t(ST())},[]),Z(()=>{wT=!0},[]),e}var a8=o8.useId,ET=a8||l8;function u8(){let e=new Map;return{emit(t,n){var i;(i=e.get(t))==null||i.forEach((r)=>r(n))},on(t,n){if(!e.has(t))e.set(t,new Set);e.get(t).add(n)},off(t,n){var i;(i=e.get(t))==null||i.delete(n)}}}var c8=Kr(null),f8=Kr(null),d8=()=>{var e;return((e=qr(c8))==null?void 0:e.id)||null},OT=()=>qr(f8);function ry(e){return"data-floating-ui-"+e}var h8={border:0,clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:0,position:"fixed",whiteSpace:"nowrap",width:"1px",top:0,left:0},kT=Fr(function(t,n){let[i,r]=Q();To(()=>{if($R())r("button")},[]);let o={ref:n,tabIndex:0,role:i,"aria-hidden":i?void 0:!0,[ry("focus-guard")]:"",style:h8};return p("span",{...t,...o})}),p8={clipPath:"inset(50%)",position:"fixed",top:0,left:0},AT=Kr(null),_T=ry("portal");function m8(e){if(e===void 0)e={};let{id:t,root:n}=e,i=ET(),r=g8(),[o,s]=Q(null),l=X(null);return To(()=>()=>{o==null||o.remove(),queueMicrotask(()=>{l.current=null})},[o]),To(()=>{if(!i)return;if(l.current)return;let a=t?document.getElementById(t):null;if(!a)return;let u=document.createElement("div");u.id=i,u.setAttribute(_T,""),a.appendChild(u),l.current=u,s(u)},[t,i]),To(()=>{if(n===null)return;if(!i)return;if(l.current)return;let a=n||(r==null?void 0:r.portalNode);if(a&&!Qh(a))a=a.current;a=a||document.body;let u=null;if(t)u=document.createElement("div"),u.id=t,a.appendChild(u);let c=document.createElement("div");c.id=i,c.setAttribute(_T,""),a=u||a,a.appendChild(c),l.current=c,s(c)},[t,n,i,r]),o}function cp(e){let{children:t,id:n,root:i,preserveTabOrder:r=!0}=e,o=m8({id:n,root:i}),[s,l]=Q(null),a=X(null),u=X(null),c=X(null),f=X(null),d=s==null?void 0:s.modal,h=s==null?void 0:s.open,m=!!s&&!s.modal&&s.open&&r&&!!(i||o);return Z(()=>{if(!o||!r||d)return;function b(x){if(o&&op(x))(x.type==="focusin"?J0:ZR)(o)}return o.addEventListener("focusin",b,!0),o.addEventListener("focusout",b,!0),()=>{o.removeEventListener("focusin",b,!0),o.removeEventListener("focusout",b,!0)}},[o,r,d]),Z(()=>{if(!o)return;if(h)return;J0(o)},[h,o]),y(AT.Provider,{value:Ke(()=>({preserveTabOrder:r,beforeOutsideRef:a,afterOutsideRef:u,beforeInsideRef:c,afterInsideRef:f,portalNode:o,setFocusManagerState:l}),[r,o]),children:[m&&o&&p(kT,{"data-type":"outside",ref:a,onFocus:(b)=>{if(op(b,o)){var x;(x=c.current)==null||x.focus()}else{let g=s?s.domReference:null,v=JR(g);v==null||v.focus()}}}),m&&o&&p("span",{"aria-owns":o.id,style:p8}),o&&Dm(t,o),m&&o&&p(kT,{"data-type":"outside",ref:u,onFocus:(b)=>{if(op(b,o)){var x;(x=f.current)==null||x.focus()}else{let g=s?s.domReference:null,v=QR(g);v==null||v.focus(),(s==null?void 0:s.closeOnFocusOut)&&(s==null||s.onOpenChange(!1,b.nativeEvent,"focus-out"))}}})]})}var g8=()=>qr(AT);var v8={pointerdown:"onPointerDown",mousedown:"onMouseDown",click:"onClick"},b8={pointerdown:"onPointerDownCapture",mousedown:"onMouseDownCapture",click:"onClickCapture"},CT=(e)=>{var t,n;return{escapeKey:typeof e==="boolean"?e:(t=e==null?void 0:e.escapeKey)!=null?t:!1,outsidePress:typeof e==="boolean"?e:(n=e==null?void 0:e.outsidePress)!=null?n:!0}};function RT(e,t){if(t===void 0)t={};let{open:n,onOpenChange:i,elements:r,dataRef:o}=e,{enabled:s=!0,escapeKey:l=!0,outsidePress:a=!0,outsidePressEvent:u="pointerdown",referencePress:c=!1,referencePressEvent:f="pointerdown",ancestorScroll:d=!1,bubbles:h,capture:m}=t,b=OT(),x=Ds(typeof a==="function"?a:()=>!1),g=typeof a==="function"?x:a,v=X(!1),{escapeKey:w,outsidePress:S}=CT(h),{escapeKey:k,outsidePress:E}=CT(m),_=X(!1),O=Ds((N)=>{var D;if(!n||!s||!l||N.key!=="Escape")return;if(_.current)return;let H=(D=o.current.floatingContext)==null?void 0:D.nodeId,G=b?Rc(b.nodesRef.current,H):[];if(!w){if(N.stopPropagation(),G.length>0){let L=!0;if(G.forEach((ee)=>{var he;if((he=ee.context)!=null&&he.open&&!ee.context.dataRef.current.__escapeKeyBubbles){L=!1;return}}),!L)return}}i(!1,YR(N)?N.nativeEvent:N,"escape-key")}),P=Ds((N)=>{var D;let H=()=>{var G;O(N),(G=ga(N))==null||G.removeEventListener("keydown",H)};(D=ga(N))==null||D.addEventListener("keydown",H)}),T=Ds((N)=>{var D;let H=o.current.insideReactTree;o.current.insideReactTree=!1;let G=v.current;if(v.current=!1,u==="click"&&G)return;if(H)return;if(typeof g==="function"&&!g(N))return;let L=ga(N),ee="["+ry("inert")+"]",he=va(r.floating).querySelectorAll(ee),He=Je(L)?L:null;while(He&&!Zi(He)){let Ae=Qi(He);if(Zi(Ae)||!Je(Ae))break;He=Ae}if(he.length&&Je(L)&&!GR(L)&&!ip(L,r.floating)&&Array.from(he).every((Ae)=>!ip(He,Ae)))return;if(qn(L)&&Y){let Ae=Zi(L),tt=Sn(L),St=/auto|scroll/,qa=Ae||St.test(tt.overflowX),Xs=Ae||St.test(tt.overflowY),qo=qa&&L.clientWidth>0&&L.scrollWidth>L.clientWidth,Nt=Xs&&L.clientHeight>0&&L.scrollHeight>L.clientHeight,Ur=tt.direction==="rtl",$a=Nt&&(Ur?N.offsetX<=L.offsetWidth-L.clientWidth:N.offsetX>L.clientWidth),C=qo&&N.offsetY>L.clientHeight;if($a||C)return}let qe=(D=o.current.floatingContext)==null?void 0:D.nodeId,dt=b&&Rc(b.nodesRef.current,qe).some((Ae)=>{var tt;return rp(N,(tt=Ae.context)==null?void 0:tt.elements.floating)});if(rp(N,r.floating)||rp(N,r.domReference)||dt)return;let $e=b?Rc(b.nodesRef.current,qe):[];if($e.length>0){let Ae=!0;if($e.forEach((tt)=>{var St;if((St=tt.context)!=null&&St.open&&!tt.context.dataRef.current.__outsidePressBubbles){Ae=!1;return}}),!Ae)return}i(!1,N,"outside-press")}),I=Ds((N)=>{var D;let H=()=>{var G;T(N),(G=ga(N))==null||G.removeEventListener(u,H)};(D=ga(N))==null||D.addEventListener(u,H)});Z(()=>{if(!n||!s)return;o.current.__escapeKeyBubbles=w,o.current.__outsidePressBubbles=S;let N=-1;function D(he){i(!1,he,"ancestor-scroll")}function H(){window.clearTimeout(N),_.current=!0}function G(){N=window.setTimeout(()=>{_.current=!1},pa()?5:0)}let L=va(r.floating);if(l)L.addEventListener("keydown",k?P:O,k),L.addEventListener("compositionstart",H),L.addEventListener("compositionend",G);g&&L.addEventListener(u,E?I:T,E);let ee=[];if(d){if(Je(r.domReference))ee=wn(r.domReference);if(Je(r.floating))ee=ee.concat(wn(r.floating));if(!Je(r.reference)&&r.reference&&r.reference.contextElement)ee=ee.concat(wn(r.reference.contextElement))}return ee=ee.filter((he)=>{var He;return he!==((He=L.defaultView)==null?void 0:He.visualViewport)}),ee.forEach((he)=>{he.addEventListener("scroll",D)}),()=>{if(l)L.removeEventListener("keydown",k?P:O,k),L.removeEventListener("compositionstart",H),L.removeEventListener("compositionend",G);g&&L.removeEventListener(u,E?I:T,E),ee.forEach((he)=>{he.removeEventListener("scroll",D)}),window.clearTimeout(N)}},[o,r,l,g,u,n,i,d,s,w,S,O,k,P,T,E,I]),Z(()=>{o.current.insideReactTree=!1},[o,g,u]);let V=Ke(()=>({onKeyDown:O,...c&&{[v8[f]]:(N)=>{i(!1,N.nativeEvent,"reference-press")},...f!=="click"&&{onClick(N){i(!1,N.nativeEvent,"reference-press")}}}}),[O,i,c,f]),Y=Ke(()=>{function N(D){if(D.button!==0)return;v.current=!0}return{onKeyDown:O,onMouseDown:N,onMouseUp:N,[b8[u]]:()=>{o.current.insideReactTree=!0}}},[O,u,o]);return Ke(()=>s?{reference:V,floating:Y}:{},[s,V,Y])}function y8(e){let{open:t=!1,onOpenChange:n,elements:i}=e,r=ET(),o=X({}),[s]=Q(()=>u8()),l=d8()!=null,[a,u]=Q(i.reference),c=Ds((h,m,b)=>{o.current.openEvent=h?m:void 0,s.emit("openchange",{open:h,event:m,reason:b,nested:l}),n==null||n(h,m,b)}),f=Ke(()=>({setPositionReference:u}),[]),d=Ke(()=>({reference:a||i.reference||null,floating:i.floating||null,domReference:i.reference}),[a,i.reference,i.floating]);return Ke(()=>({dataRef:o,open:t,onOpenChange:c,elements:d,events:s,floatingId:r,refs:f}),[t,c,d,s,r,f])}function fp(e){var t,n;let{elements:i,...r}=e===void 0?{}:e,{nodeId:o}=r,s=y8({...r,elements:{reference:(t=i==null?void 0:i.reference)!=null?t:null,floating:(n=i==null?void 0:i.floating)!=null?n:null}}),l=r.rootContext||s,a=l.elements,[u,c]=Q(null),[f,d]=Q(null),m=(a==null?void 0:a.domReference)||u,b=X(null),x=OT();To(()=>{if(m)b.current=m},[m]);let g=bT({...r,elements:{...a,...f&&{reference:f}}}),v=st((_)=>{let O=Je(_)?{getBoundingClientRect:()=>_.getBoundingClientRect(),getClientRects:()=>_.getClientRects(),contextElement:_}:_;d(O),g.refs.setReference(O)},[g.refs]),w=st((_)=>{if(Je(_)||_===null)b.current=_,c(_);if(Je(g.refs.reference.current)||g.refs.reference.current===null||_!==null&&!Je(_))g.refs.setReference(_)},[g.refs]),S=Ke(()=>({...g.refs,setReference:w,setPositionReference:v,domReference:b}),[g.refs,w,v]),k=Ke(()=>({...g.elements,domReference:m}),[g.elements,m]),E=Ke(()=>({...g,...l,refs:S,elements:k,nodeId:o}),[g,S,k,o,l]);return To(()=>{l.dataRef.current.floatingContext=E;let _=x==null?void 0:x.nodesRef.current.find((O)=>O.id===o);if(_)_.context=E}),Ke(()=>({...g,context:E,refs:S,elements:k}),[g,S,k,E])}function iy(e,t,n){let i=new Map,r=n==="item",o=e;if(r&&e){let{[yT]:s,[xT]:l,...a}=e;o=a}return{...n==="floating"&&{tabIndex:-1,[JI]:""},...o,...t.map((s)=>{let l=s?s[n]:null;if(typeof l==="function")return e?l(e):null;return l}).concat(e).reduce((s,l)=>{if(!l)return s;return Object.entries(l).forEach((a)=>{let[u,c]=a;if(r&&[yT,xT].includes(u))return;if(u.indexOf("on")===0){if(!i.has(u))i.set(u,[]);if(typeof c==="function"){var f;(f=i.get(u))==null||f.push(c),s[u]=function(){var d;for(var h=arguments.length,m=Array(h),b=0;b<h;b++)m[b]=arguments[b];return(d=i.get(u))==null?void 0:d.map((x)=>x(...m)).find((x)=>x!==void 0)}}}else s[u]=c}),s},{})}}function TT(e){if(e===void 0)e=[];let t=e.map((l)=>l==null?void 0:l.reference),n=e.map((l)=>l==null?void 0:l.floating),i=e.map((l)=>l==null?void 0:l.item),r=st((l)=>iy(l,e,"reference"),t),o=st((l)=>iy(l,e,"floating"),n),s=st((l)=>iy(l,e,"item"),i);return Ke(()=>({getReferenceProps:r,getFloatingProps:o,getItemProps:s}),[r,o,s])}function MT(){let[e,t]=Q(null),{refs:n,floatingStyles:i}=fp({placement:e?.el.getAttribute("data-tip-side")==="right"?"right":"bottom-start",middleware:[xa(6),Mc(),Tc({padding:8})],whileElementsMounted:ya,elements:{reference:e?.el??null}});if(Z(()=>{let r=(s)=>{if(s.pointerType==="touch")return;let l=s.target,a=l instanceof Element?l.closest("[data-tip]"):null,u=a?.getAttribute("data-tip")??"";t((c)=>a==null||u===""?null:c?.el===a&&c.text===u?c:{el:a,text:u})},o=()=>t(null);return document.addEventListener("pointerover",r),document.addEventListener("pointerdown",o),document.addEventListener("keydown",o),window.addEventListener("scroll",o,!0),()=>{document.removeEventListener("pointerover",r),document.removeEventListener("pointerdown",o),document.removeEventListener("keydown",o),window.removeEventListener("scroll",o,!0)}},[]),e==null)return null;return p(cp,{children:p("div",{ref:n.setFloating,style:i,className:"tooltip",role:"tooltip",children:e.text})})}function oy(e){return{label:e.kind,count:String(Math.max(0,Math.min(999,Math.round(e.count))))}}function NT(e){let t=e.split(`
22
- `).map((r)=>r.trim()).filter((r)=>r!==""),n=t.filter((r)=>r.startsWith("- ")).map((r)=>r.slice(2).trim());return{positive:t.filter((r)=>!r.startsWith("- ")).join(" · "),negative:n.join(" · ")}}function DT(e,t){let n=t.trim();return e.find((i)=>i.text.trim()===n)?.label??null}function x8(e){let t=e.split(`
23
- `).find((n)=>n.trim()!=="")??"";return t.length<=90?t:`${t.slice(0,89)}…`}var Nc=q(function(t){let n=t.v.desc.textPresets??[],[i,r]=Q(!1);if(n.length===0)return null;let o=typeof t.v.value==="string"?t.v.value:"",s=DT(n,o);return y("div",{className:"preset-box",onKeyDown:(l)=>l.key==="Escape"?r(!1):void 0,children:[y("button",{type:"button",className:"preset-btn mini","aria-expanded":i,"data-tip":"named starting texts — picking one replaces the field",onClick:()=>r(!i),children:[p(B,{name:"tag"})," presets ▾"]}),i?y(ie,{children:[p("div",{className:"preset-backdrop",onClick:()=>r(!1)}),p("div",{className:"preset-menu",children:n.map((l)=>y("button",{type:"button",className:l.label===s?"preset-item on":"preset-item",onClick:()=>{t.v.set(l.text),r(!1)},children:[y("span",{className:"preset-name",children:[l.label===s?"• ":"  ",l.label]}),p("span",{className:"preset-peek",children:x8(l.text)})]},l.label))})]}):null]})});function dp(e){if(e.icon.trimStart().startsWith("<svg"))return p("img",{className:"var-icon",alt:"",src:`data:image/svg+xml;utf8,${encodeURIComponent(e.icon)}`});return p("svg",{className:"var-icon",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",style:e.color==null?void 0:{color:e.color},"aria-hidden":"true",children:p("path",{d:e.icon})})}var LT=q(function(t){let n=typeof t.v.value==="string"?t.v.value:"",i=t.v.desc.textPresets??[];if(t.v.desc.multiline===!0){let r=Math.min(12,Math.max(3,n.split(`
24
- `).length+1));return y("div",{children:[p("textarea",{rows:r,value:n,onChange:(o)=>t.v.set(o.target.value)}),i.length>0?p("div",{className:"row-inline",children:p(Nc,{v:t.v})}):null]})}if(i.length===0)return p("input",{type:"text",value:n,onChange:(r)=>t.v.set(r.target.value)});return y("div",{className:"row-inline",children:[p("input",{type:"text",style:{flex:1},value:n,onChange:(r)=>t.v.set(r.target.value)}),p(Nc,{v:t.v})]})}),zT=q(function(t){let n=t.v.desc.kind==="int",i=typeof t.v.value==="number"?t.v.value:0,r=t.v.desc.min,o=t.v.desc.max,s=(l)=>{let a=n?parseInt(l,10):parseFloat(l);if(Number.isFinite(a))t.v.set(a)};return y("div",{className:"row-inline",children:[p("input",{type:"number",value:i,step:n?1:"any",min:r,max:o,onChange:(l)=>s(l.target.value)}),r!=null&&o!=null?p("input",{type:"range",style:{flex:1,minWidth:120},value:i,min:r,max:o,step:n?1:(o-r)/200,onChange:(l)=>s(l.target.value)}):null,r!=null||o!=null?p("span",{className:"hint",children:`${r??"-∞"} … ${o??"∞"}`}):null]})}),BT=q(function(t){return y("label",{className:"row-inline",style:{cursor:"pointer"},children:[p("input",{type:"checkbox",checked:t.v.value===!0,onChange:(n)=>t.v.set(n.target.checked)}),p("span",{className:"hint",children:t.v.value===!0?"on":"off"})]})}),PT=q(function(t){let n=t.v.desc.choices??[],i=t.v.desc.select??"one",r=$h(t.v.value),o=t.v.desc.ui?.options??{},s=(c)=>t.v.set(BA({select:i,choices:n,value:t.v.value,c})),l=r.filter((c)=>!n.includes(c)),a=l.length>0?y("span",{className:"hint",children:[l.join(", ")," (not on this host)"]}):i==="one"&&r.length===0?p("span",{className:"hint",children:"(unset)"}):null;if(zA(n)||i!=="one")return y("span",{className:"row-inline",children:[p("span",{className:"btn-group wrap",children:n.map((c)=>{let f=o[c],d=r.includes(c);return y("button",{type:"button",className:d?"sel":"","data-tip":i==="many"?`${d?"on":"off"}: click to toggle`:i==="zero-or-one"&&d?"click again to pick none":void 0,style:f?.color==null?void 0:d?{background:f.color,borderColor:f.color}:{color:f.color},onClick:()=>s(c),children:[f?.icon==null?null:p(dp,{icon:f.icon,color:void 0}),c]},c)})}),a]});let u=r[0]??"";return y("select",{value:u,onChange:(c)=>t.v.set(c.target.value),children:[n.includes(u)?null:p("option",{value:u,disabled:!0,children:u===""?"(unset)":`${u} (not on this host)`}),n.map((c)=>p("option",{value:c,children:c},c))]})});function Dc(e){let[t,n]=Q(!1),i=()=>n(!1);return y("span",{className:`preset-box menu-box ${e.className??""}`,onKeyDown:(r)=>r.key==="Escape"?i():void 0,children:[p("button",{type:"button",className:"menu-btn","aria-expanded":t,"data-tip":e.tip,onClick:()=>n(!t),children:p(B,{name:"more"})}),t?y(ie,{children:[p("div",{className:"preset-backdrop",onClick:i}),p("div",{className:"preset-menu menu-list",children:e.children(i)})]}):null]})}function rn(e){return y("button",{type:"button",className:"menu-item",disabled:e.disabled,"data-tip":e.tip,onClick:e.onClick,children:[p("span",{className:"menu-check",children:e.checked==null?"":e.checked?"✓":""}),e.label]})}var ly=[],UT=[];(()=>{let e="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((t)=>t?parseInt(t,36):1);for(let t=0,n=0;t<e.length;t++)(t%2?UT:ly).push(n=n+e[t])})();function w8(e){if(e<768)return!1;for(let t=0,n=ly.length;;){let i=t+n>>1;if(e<ly[i])n=i;else if(e>=UT[i])t=i+1;else return!0;if(t==n)return!1}}function IT(e){return e>=127462&&e<=127487}var VT=8205;function jT(e,t,n=!0,i=!0){return(n?KT:S8)(e,t,i)}function KT(e,t,n){if(t==e.length)return t;if(t&&FT(e.charCodeAt(t))&&qT(e.charCodeAt(t-1)))t--;let i=sy(e,t);t+=HT(i);while(t<e.length){let r=sy(e,t);if(i==VT||r==VT||n&&w8(r))t+=HT(r),i=r;else if(IT(r)){let o=0,s=t-2;while(s>=0&&IT(sy(e,s)))o++,s-=2;if(o%2==0)break;else t+=2}else break}return t}function S8(e,t,n){while(t>1){let i=KT(e,t-2,n);if(i<t)return i;t--}return 0}function sy(e,t){let n=e.charCodeAt(t);if(!qT(n)||t+1==e.length)return n;let i=e.charCodeAt(t+1);if(!FT(i))return n;return(n-55296<<10)+(i-56320)+65536}function FT(e){return e>=56320&&e<57344}function qT(e){return e>=55296&&e<56320}function HT(e){return e<65536?1:2}class de{lineAt(e){if(e<0||e>this.length)throw 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 RangeError(`Invalid line number ${e} in ${this.lines}-line document`);return this.lineInner(e,!0,1,0)}replace(e,t,n){[e,t]=Ca(this,e,t);let i=[];if(this.decompose(0,e,i,2),n.length)n.decompose(0,n.length,i,3);return this.decompose(t,this.length,i,1),tr.from(i,this.length-(t-e)+n.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,t=this.length){[e,t]=Ca(this,e,t);let n=[];return this.decompose(e,t,n,0),tr.from(n,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),n=this.length-this.scanIdentical(e,-1),i=new ka(this),r=new ka(e);for(let o=t,s=t;;){if(i.next(o),r.next(o),o=0,i.lineBreak!=r.lineBreak||i.done!=r.done||i.value!=r.value)return!1;if(s+=i.value.length,i.done||s>=n)return!0}}iter(e=1){return new ka(this,e)}iterRange(e,t=this.length){return new by(this,e,t)}iterLines(e,t){let n;if(e==null)n=this.iter();else{if(t==null)t=this.lines+1;let i=this.line(e).from;n=this.iterRange(i,Math.max(i,t==this.lines+1?this.length:t<=1?0:this.line(t-1).to))}return new yy(n)}toString(){return this.sliceString(0)}toJSON(){let e=[];return this.flatten(e),e}constructor(){}static of(e){if(e.length==0)throw RangeError("A document must have at least one line");if(e.length==1&&!e[0])return de.empty;return e.length<=32?new rt(e):tr.from(rt.split(e,[]))}}class rt extends de{constructor(e,t=k8(e)){super();this.text=e,this.length=t}get lines(){return this.text.length}get children(){return null}lineInner(e,t,n,i){for(let r=0;;r++){let o=this.text[r],s=i+o.length;if((t?n:s)>=e)return new QT(i,s,n,o);i=s+1,n++}}decompose(e,t,n,i){let r=e<=0&&t>=this.length?this:new rt($T(this.text,e,t),Math.min(t,this.length)-Math.max(0,e));if(i&1){let o=n.pop(),s=gp(r.text,o.text.slice(),0,r.length);if(s.length<=32)n.push(new rt(s,o.length+r.length));else{let l=s.length>>1;n.push(new rt(s.slice(0,l)),new rt(s.slice(l)))}}else n.push(r)}replace(e,t,n){if(!(n instanceof rt))return super.replace(e,t,n);[e,t]=Ca(this,e,t);let i=gp(this.text,gp(n.text,$T(this.text,0,e)),t),r=this.length+n.length-(t-e);if(i.length<=32)return new rt(i,r);return tr.from(rt.split(i,[]),r)}sliceString(e,t=this.length,n=`
25
- `){[e,t]=Ca(this,e,t);let i="";for(let r=0,o=0;r<=t&&o<this.text.length;o++){let s=this.text[o],l=r+s.length;if(r>e&&o)i+=n;if(e<l&&t>r)i+=s.slice(Math.max(0,e-r),t-r);r=l+1}return i}flatten(e){for(let t of this.text)e.push(t)}scanIdentical(){return 0}static split(e,t){let n=[],i=-1;for(let r of e)if(n.push(r),i+=r.length+1,n.length==32)t.push(new rt(n,i)),n=[],i=-1;if(i>-1)t.push(new rt(n,i));return t}}class tr extends de{constructor(e,t){super();this.children=e,this.length=t,this.lines=0;for(let n of e)this.lines+=n.lines}lineInner(e,t,n,i){for(let r=0;;r++){let o=this.children[r],s=i+o.length,l=n+o.lines-1;if((t?l:s)>=e)return o.lineInner(e,t,n,i);i=s+1,n=l+1}}decompose(e,t,n,i){for(let r=0,o=0;o<=t&&r<this.children.length;r++){let s=this.children[r],l=o+s.length;if(e<=l&&t>=o){let a=i&((o<=e?1:0)|(l>=t?2:0));if(o>=e&&l<=t&&!a)n.push(s);else s.decompose(e-o,t-o,n,a)}o=l+1}}replace(e,t,n){if([e,t]=Ca(this,e,t),n.lines<this.lines)for(let i=0,r=0;i<this.children.length;i++){let o=this.children[i],s=r+o.length;if(e>=r&&t<=s){let l=o.replace(e-r,t-r,n),a=this.lines-o.lines+l.lines;if(l.lines<a>>4&&l.lines>a>>6){let u=this.children.slice();return u[i]=l,new tr(u,this.length-(t-e)+n.length)}return super.replace(r,s,l)}r=s+1}return super.replace(e,t,n)}sliceString(e,t=this.length,n=`
26
- `){[e,t]=Ca(this,e,t);let i="";for(let r=0,o=0;r<this.children.length&&o<=t;r++){let s=this.children[r],l=o+s.length;if(o>e&&r)i+=n;if(e<l&&t>o)i+=s.sliceString(e-o,t-o,n);o=l+1}return i}flatten(e){for(let t of this.children)t.flatten(e)}scanIdentical(e,t){if(!(e instanceof tr))return 0;let n=0,[i,r,o,s]=t>0?[0,0,this.children.length,e.children.length]:[this.children.length-1,e.children.length-1,-1,-1];for(;;i+=t,r+=t){if(i==o||r==s)return n;let l=this.children[i],a=e.children[r];if(l!=a)return n+l.scanIdentical(a,t);n+=l.length+1}}static from(e,t=e.reduce((n,i)=>n+i.length+1,-1)){let n=0;for(let d of e)n+=d.lines;if(n<32){let d=[];for(let h of e)h.flatten(d);return new rt(d,t)}let i=Math.max(32,n>>5),r=i<<1,o=i>>1,s=[],l=0,a=-1,u=[];function c(d){let h;if(d.lines>r&&d instanceof tr)for(let m of d.children)c(m);else if(d.lines>o&&(l>o||!l))f(),s.push(d);else if(d instanceof rt&&l&&(h=u[u.length-1])instanceof rt&&d.lines+h.lines<=32)l+=d.lines,a+=d.length+1,u[u.length-1]=new rt(h.text.concat(d.text),h.length+1+d.length);else{if(l+d.lines>i)f();l+=d.lines,a+=d.length+1,u.push(d)}}function f(){if(l==0)return;s.push(u.length==1?u[0]:tr.from(u,a)),a=-1,l=u.length=0}for(let d of e)c(d);return f(),s.length==1?s[0]:new tr(s,t)}}de.empty=new rt([""],0);function k8(e){let t=-1;for(let n of e)t+=n.length+1;return t}function gp(e,t,n=0,i=1e9){for(let r=0,o=0,s=!0;o<e.length&&r<=i;o++){let l=e[o],a=r+l.length;if(a>=n){if(a>i)l=l.slice(0,i-r);if(r<n)l=l.slice(n-r);if(s)t[t.length-1]+=l,s=!1;else t.push(l)}r=a+1}return t}function $T(e,t,n){return gp(e,[""],t,n)}class ka{constructor(e,t=1){this.dir=t,this.done=!1,this.lineBreak=!1,this.value="",this.nodes=[e],this.offsets=[t>0?1:(e instanceof rt?e.text.length:e.children.length)<<1]}nextInner(e,t){this.done=this.lineBreak=!1;for(;;){let n=this.nodes.length-1,i=this.nodes[n],r=this.offsets[n],o=r>>1,s=i instanceof rt?i.text.length:i.children.length;if(o==(t>0?s:0)){if(n==0)return this.done=!0,this.value="",this;if(t>0)this.offsets[n-1]++;this.nodes.pop(),this.offsets.pop()}else if((r&1)==(t>0?0:1)){if(this.offsets[n]+=t,e==0)return this.lineBreak=!0,this.value=`
27
- `,this;e--}else if(i instanceof rt){let l=i.text[o+(t<0?-1:0)];if(this.offsets[n]+=t,l.length>Math.max(0,e))return this.value=e==0?l:t>0?l.slice(e):l.slice(0,l.length-e),this;e-=l.length}else{let l=i.children[o+(t<0?-1:0)];if(e>l.length)e-=l.length,this.offsets[n]+=t;else{if(t<0)this.offsets[n]--;this.nodes.push(l),this.offsets.push(t>0?1:(l instanceof rt?l.text.length:l.children.length)<<1)}}}}next(e=0){if(e<0)this.nextInner(-e,-this.dir),e=this.value.length;return this.nextInner(e,this.dir)}}class by{constructor(e,t,n){this.value="",this.done=!1,this.cursor=new ka(e,t>n?-1:1),this.pos=t>n?e.length:0,this.from=Math.min(t,n),this.to=Math.max(t,n)}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 n=t<0?this.pos-this.from:this.to-this.pos;if(e>n)e=n;n-=e;let{value:i}=this.cursor.next(e);return this.pos+=(i.length+e)*t,this.value=i.length<=n?i:t<0?i.slice(i.length-n):i.slice(0,n),this.done=!this.value,this}next(e=0){if(e<0)e=Math.max(e,this.from-this.pos);else if(e>0)e=Math.min(e,this.to-this.pos);return this.nextInner(e,this.cursor.dir)}get lineBreak(){return this.cursor.lineBreak&&this.value!=""}}class yy{constructor(e){this.inner=e,this.afterBreak=!0,this.value="",this.done=!1}next(e=0){let{done:t,lineBreak:n,value:i}=this.inner.next(e);if(t&&this.afterBreak)this.value="",this.afterBreak=!1;else if(t)this.done=!0,this.value="";else if(n)if(this.afterBreak)this.value="";else this.afterBreak=!0,this.next();else this.value=i,this.afterBreak=!1;return this}get lineBreak(){return!1}}if(typeof Symbol<"u")de.prototype[Symbol.iterator]=function(){return this.iter()},ka.prototype[Symbol.iterator]=by.prototype[Symbol.iterator]=yy.prototype[Symbol.iterator]=function(){return this};class QT{constructor(e,t,n,i){this.from=e,this.to=t,this.number=n,this.text=i}get length(){return this.to-this.from}}function Ca(e,t,n){return t=Math.max(0,Math.min(e.length,t)),[t,Math.max(t,Math.min(e.length,n))]}function yt(e,t,n=!0,i=!0){return jT(e,t,n,i)}function _8(e){return e>=56320&&e<57344}function C8(e){return e>=55296&&e<56320}function Br(e,t){let n=e.charCodeAt(t);if(!C8(n)||t+1==e.length)return n;let i=e.charCodeAt(t+1);if(!_8(i))return n;return(n-55296<<10)+(i-56320)+65536}function JT(e){if(e<=65535)return String.fromCharCode(e);return e-=65536,String.fromCharCode((e>>10)+55296,(e&1023)+56320)}function Do(e){return e<65536?1:2}var uy=/\r\n?|\n/,qt=function(e){return e[e.Simple=0]="Simple",e[e.TrackDel=1]="TrackDel",e[e.TrackBefore=2]="TrackBefore",e[e.TrackAfter=3]="TrackAfter",e}(qt||(qt={}));class mi{constructor(e){this.sections=e}get length(){let e=0;for(let t=0;t<this.sections.length;t+=2)e+=this.sections[t];return e}get newLength(){let e=0;for(let t=0;t<this.sections.length;t+=2){let n=this.sections[t+1];e+=n<0?this.sections[t]:n}return e}get empty(){return this.sections.length==0||this.sections.length==2&&this.sections[1]<0}iterGaps(e){for(let t=0,n=0,i=0;t<this.sections.length;){let r=this.sections[t++],o=this.sections[t++];if(o<0)e(n,i,r),i+=r;else i+=o;n+=r}}iterChangedRanges(e,t=!1){cy(this,e,t)}get invertedDesc(){let e=[];for(let t=0;t<this.sections.length;){let n=this.sections[t++],i=this.sections[t++];if(i<0)e.push(n,i);else e.push(i,n)}return new mi(e)}composeDesc(e){return this.empty?e:e.empty?this:ZT(this,e)}mapDesc(e,t=!1){return e.empty?this:fy(this,e,t)}mapPos(e,t=-1,n=qt.Simple){let i=0,r=0;for(let o=0;o<this.sections.length;){let s=this.sections[o++],l=this.sections[o++],a=i+s;if(l<0){if(a>e)return r+(e-i);r+=s}else{if(n!=qt.Simple&&a>=e&&(n==qt.TrackDel&&i<e&&a>e||n==qt.TrackBefore&&i<e||n==qt.TrackAfter&&a>e))return null;if(a>e||a==e&&t<0&&!s)return e==i||t<0?r:r+l;r+=l}i=a}if(e>i)throw RangeError(`Position ${e} is out of range for changeset of length ${i}`);return r}touchesRange(e,t=e){for(let n=0,i=0;n<this.sections.length&&i<=t;){let r=this.sections[n++],o=this.sections[n++],s=i+r;if(o>=0&&i<=t&&s>=e)return i<e&&s>t?"cover":!0;i=s}return!1}toString(){let e="";for(let t=0;t<this.sections.length;){let n=this.sections[t++],i=this.sections[t++];e+=(e?" ":"")+n+(i>=0?":"+i:"")}return e}toJSON(){return this.sections}static fromJSON(e){if(!Array.isArray(e)||e.length%2||e.some((t)=>typeof t!="number"))throw RangeError("Invalid JSON representation of ChangeDesc");return new mi(e)}static create(e){return new mi(e)}}class ot extends mi{constructor(e,t){super(e);this.inserted=t}apply(e){if(this.length!=e.length)throw RangeError("Applying change set to a document with the wrong length");return cy(this,(t,n,i,r,o)=>e=e.replace(i,i+(n-t),o),!1),e}mapDesc(e,t=!1){return fy(this,e,t,!0)}invert(e){let t=this.sections.slice(),n=[];for(let i=0,r=0;i<t.length;i+=2){let o=t[i],s=t[i+1];if(s>=0){t[i]=s,t[i+1]=o;let l=i>>1;while(n.length<l)n.push(de.empty);n.push(o?e.slice(r,r+o):de.empty)}r+=o}return new ot(t,n)}compose(e){return this.empty?e:e.empty?this:ZT(this,e,!0)}map(e,t=!1){return e.empty?this:fy(this,e,t,!0)}iterChanges(e,t=!1){cy(this,e,t)}get desc(){return mi.create(this.sections)}filter(e){let t=[],n=[],i=[],r=new Ea(this);e:for(let o=0,s=0;;){let l=o==e.length?1e9:e[o++];while(s<l||s==l&&r.len==0){if(r.done)break e;let u=Math.min(r.len,l-s);Vt(i,u,-1);let c=r.ins==-1?-1:r.off==0?r.ins:0;if(Vt(t,u,c),c>0)No(n,t,r.text);r.forward(u),s+=u}let a=e[o++];while(s<a){if(r.done)break e;let u=Math.min(r.len,a-s);Vt(t,u,-1),Vt(i,u,r.ins==-1?-1:r.off==0?r.ins:0),r.forward(u),s+=u}}return{changes:new ot(t,n),filtered:mi.create(i)}}toJSON(){let e=[];for(let t=0;t<this.sections.length;t+=2){let n=this.sections[t],i=this.sections[t+1];if(i<0)e.push(n);else if(i==0)e.push([n]);else e.push([n].concat(this.inserted[t>>1].toJSON()))}return e}static of(e,t,n){let i=[],r=[],o=0,s=null;function l(u=!1){if(!u&&!i.length)return;if(o<t)Vt(i,t-o,-1);let c=new ot(i,r);s=s?s.compose(c.map(s)):c,i=[],r=[],o=0}function a(u){if(Array.isArray(u))for(let c of u)a(c);else if(u instanceof ot){if(u.length!=t)throw RangeError(`Mismatched change set length (got ${u.length}, expected ${t})`);l(),s=s?s.compose(u.map(s)):u}else{let{from:c,to:f=c,insert:d}=u;if(c>f||c<0||f>t)throw RangeError(`Invalid change range ${c} to ${f} (in doc of length ${t})`);let h=!d?de.empty:typeof d=="string"?de.of(d.split(n||uy)):d,m=h.length;if(c==f&&m==0)return;if(c<o)l();if(c>o)Vt(i,c-o,-1);Vt(i,f-c,m),No(r,i,h),o=f}}return a(e),l(!s),s}static empty(e){return new ot(e?[e,-1]:[],[])}static fromJSON(e){if(!Array.isArray(e))throw RangeError("Invalid JSON representation of ChangeSet");let t=[],n=[];for(let i=0;i<e.length;i++){let r=e[i];if(typeof r=="number")t.push(r,-1);else if(!Array.isArray(r)||typeof r[0]!="number"||r.some((o,s)=>s&&typeof o!="string"))throw RangeError("Invalid JSON representation of ChangeSet");else if(r.length==1)t.push(r[0],0);else{while(n.length<i)n.push(de.empty);n[i]=de.of(r.slice(1)),t.push(r[0],n[i].length)}}return new ot(t,n)}static createSet(e,t){return new ot(e,t)}}function Vt(e,t,n,i=!1){if(t==0&&n<=0)return;let r=e.length-2;if(r>=0&&n<=0&&n==e[r+1])e[r]+=t;else if(r>=0&&t==0&&e[r]==0)e[r+1]+=n;else if(i)e[r]+=t,e[r+1]+=n;else e.push(t,n)}function No(e,t,n){if(n.length==0)return;let i=t.length-2>>1;if(i<e.length)e[e.length-1]=e[e.length-1].append(n);else{while(e.length<i)e.push(de.empty);e.push(n)}}function cy(e,t,n){let i=e.inserted;for(let r=0,o=0,s=0;s<e.sections.length;){let l=e.sections[s++],a=e.sections[s++];if(a<0)r+=l,o+=l;else{let u=r,c=o,f=de.empty;for(;;){if(u+=l,c+=a,a&&i)f=f.append(i[s-2>>1]);if(n||s==e.sections.length||e.sections[s+1]<0)break;l=e.sections[s++],a=e.sections[s++]}t(r,u,o,c,f),r=u,o=c}}}function fy(e,t,n,i=!1){let r=[],o=i?[]:null,s=new Ea(e),l=new Ea(t);for(let a=-1;;)if(s.done&&l.len||l.done&&s.len)throw Error("Mismatched change set lengths");else if(s.ins==-1&&l.ins==-1){let u=Math.min(s.len,l.len);Vt(r,u,-1),s.forward(u),l.forward(u)}else if(l.ins>=0&&(s.ins<0||a==s.i||s.off==0&&(l.len<s.len||l.len==s.len&&!n))){let u=l.len;Vt(r,l.ins,-1);while(u){let c=Math.min(s.len,u);if(s.ins>=0&&a<s.i&&s.len<=c){if(Vt(r,0,s.ins),o)No(o,r,s.text);a=s.i}s.forward(c),u-=c}l.next()}else if(s.ins>=0){let u=0,c=s.len;while(c)if(l.ins==-1){let f=Math.min(c,l.len);u+=f,c-=f,l.forward(f)}else if(l.ins==0&&l.len<c)c-=l.len,l.next();else break;if(Vt(r,u,a<s.i?s.ins:0),o&&a<s.i)No(o,r,s.text);a=s.i,s.forward(s.len-c)}else if(s.done&&l.done)return o?ot.createSet(r,o):mi.create(r);else throw Error("Mismatched change set lengths")}function ZT(e,t,n=!1){let i=[],r=n?[]:null,o=new Ea(e),s=new Ea(t);for(let l=!1;;)if(o.done&&s.done)return r?ot.createSet(i,r):mi.create(i);else if(o.ins==0)Vt(i,o.len,0,l),o.next();else if(s.len==0&&!s.done){if(Vt(i,0,s.ins,l),r)No(r,i,s.text);s.next()}else if(o.done||s.done)throw Error("Mismatched change set lengths");else{let a=Math.min(o.len2,s.len),u=i.length;if(o.ins==-1){let c=s.ins==-1?-1:s.off?0:s.ins;if(Vt(i,a,c,l),r&&c)No(r,i,s.text)}else if(s.ins==-1){if(Vt(i,o.off?0:o.len,a,l),r)No(r,i,o.textBit(a))}else if(Vt(i,o.off?0:o.len,s.off?0:s.ins,l),r&&!s.off)No(r,i,s.text);l=(o.ins>a||s.ins>=0&&s.len>a)&&(l||i.length>u),o.forward2(a),s.forward(a)}}class Ea{constructor(e){this.set=e,this.i=0,this.next()}next(){let{sections:e}=this.set;if(this.i<e.length)this.len=e[this.i++],this.ins=e[this.i++];else this.len=0,this.ins=-2;this.off=0}get done(){return this.ins==-2}get len2(){return this.ins<0?this.len:this.ins}get text(){let{inserted:e}=this.set,t=this.i-2>>1;return t>=e.length?de.empty:e[t]}textBit(e){let{inserted:t}=this.set,n=this.i-2>>1;return n>=t.length&&!e?de.empty:t[n].slice(this.off,e==null?void 0:this.off+e)}forward(e){if(e==this.len)this.next();else this.len-=e,this.off+=e}forward2(e){if(this.ins==-1)this.forward(e);else if(e==this.ins)this.next();else this.ins-=e,this.off+=e}}class Mo{constructor(e,t,n,i){this.from=e,this.to=t,this.flags=n,this.goalColumn=i}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 n,i;if(this.empty)n=i=e.mapPos(this.from,t);else n=e.mapPos(this.from,1),i=e.mapPos(this.to,-1);return n==this.from&&i==this.to?this:new Mo(n,i,this.flags,this.goalColumn)}extend(e,t=e,n=0){if(e<=this.anchor&&t>=this.anchor)return R.range(e,t,void 0,void 0,n);let i=Math.abs(e-this.anchor)>Math.abs(t-this.anchor)?e:t;return R.range(this.anchor,i,void 0,void 0,n)}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 RangeError("Invalid JSON representation for SelectionRange");return R.range(e.anchor,e.head)}static create(e,t,n,i){return new Mo(e,t,n,i)}}class R{constructor(e,t){this.ranges=e,this.mainIndex=t}map(e,t=-1){if(e.empty)return this;return R.create(this.ranges.map((n)=>n.map(e,t)),this.mainIndex)}eq(e,t=!1){if(this.ranges.length!=e.ranges.length||this.mainIndex!=e.mainIndex)return!1;for(let n=0;n<this.ranges.length;n++)if(!this.ranges[n].eq(e.ranges[n],t))return!1;return!0}get main(){return this.ranges[this.mainIndex]}asSingle(){return this.ranges.length==1?this:new R([this.main],0)}addRange(e,t=!0){return R.create([e].concat(this.ranges),t?0:this.mainIndex+1)}replaceRange(e,t=this.mainIndex){let n=this.ranges.slice();return n[t]=e,R.create(n,this.mainIndex)}toJSON(){return{ranges:this.ranges.map((e)=>e.toJSON()),main:this.mainIndex}}static fromJSON(e){if(!e||!Array.isArray(e.ranges)||typeof e.main!="number"||e.main>=e.ranges.length)throw RangeError("Invalid JSON representation for EditorSelection");return new R(e.ranges.map((t)=>Mo.fromJSON(t)),e.main)}static single(e,t=e){return new R([R.range(e,t)],0)}static create(e,t=0){if(e.length==0)throw RangeError("A selection needs at least one range");for(let n=0,i=0;i<e.length;i++){let r=e[i];if(r.empty?r.from<=n:r.from<n)return R.normalized(e.slice(),t);n=r.to}return new R(e,t)}static cursor(e,t=0,n,i){return Mo.create(e,e,(t==0?0:t<0?8:16)|(n==null?7:Math.min(6,n)),i)}static range(e,t,n,i,r){let o=i==null?7:Math.min(6,i);if(!r&&e!=t)r=t<e?1:-1;if(r)o|=r<0?8:16;return t<e?Mo.create(t,e,o|32,n):Mo.create(e,t,o,n)}static undirectionalRange(e,t){return Mo.create(e,t,64,void 0)}static normalized(e,t=0){let n=e[t];e.sort((i,r)=>i.from-r.from),t=e.indexOf(n);for(let i=1;i<e.length;i++){let r=e[i],o=e[i-1];if(r.empty?r.from<=o.to:r.from<o.to){let s=o.from,l=Math.max(r.to,o.to);if(i<=t)t--;e.splice(--i,2,r.anchor>r.head?R.range(l,s):R.range(s,l))}}return new R(e,t)}}function eM(e,t){for(let n of e.ranges)if(n.to>t)throw RangeError("Selection points outside of document")}var xy=0;class J{constructor(e,t,n,i,r){this.combine=e,this.compareInput=t,this.compare=n,this.isStatic=i,this.id=xy++,this.default=e([]),this.extensions=typeof r=="function"?r(this):r}get reader(){return this}static define(e={}){return new J(e.combine||((t)=>t),e.compareInput||((t,n)=>t===n),e.compare||(!e.combine?wy:(t,n)=>t===n),!!e.static,e.enables)}of(e){return new zc([],this,0,e)}compute(e,t){if(this.isStatic)throw Error("Can't compute a static facet");return new zc(e,this,1,t)}computeN(e,t){if(this.isStatic)throw Error("Can't compute a static facet");return new zc(e,this,2,t)}from(e,t){if(!t)t=(n)=>n;return this.compute([e],(n)=>t(n.field(e)))}}function wy(e,t){return e==t||e.length==t.length&&e.every((n,i)=>n===t[i])}class zc{constructor(e,t,n,i){this.dependencies=e,this.facet=t,this.type=n,this.value=i,this.id=xy++}dynamicSlot(e){var t;let n=this.value,i=this.facet.compareInput,r=this.id,o=e[r]>>1,s=this.type==2,l=!1,a=!1,u=[];for(let c of this.dependencies)if(c=="doc")l=!0;else if(c=="selection")a=!0;else if((((t=e[c.id])!==null&&t!==void 0?t:1)&1)==0)u.push(e[c.id]);return{create(c){return c.values[o]=n(c),1},update(c,f){if(l&&f.docChanged||a&&(f.docChanged||f.selection)||dy(c,u)){let d=n(c);if(s?!XT(d,c.values[o],i):!i(d,c.values[o]))return c.values[o]=d,1}return 0},reconfigure:(c,f)=>{let d,h=f.config.address[r];if(h!=null){let m=yp(f,h);if(this.dependencies.every((b)=>b instanceof J?f.facet(b)===c.facet(b):b instanceof kn?f.field(b,!1)==c.field(b,!1):!0)||(s?XT(d=n(c),m,i):i(d=n(c),m)))return c.values[o]=m,0}else d=n(c);return c.values[o]=d,1}}}get extension(){return this}}function XT(e,t,n){if(e.length!=t.length)return!1;for(let i=0;i<e.length;i++)if(!n(e[i],t[i]))return!1;return!0}function dy(e,t){let n=!1;for(let i of t)if(Bc(e,i)&1)n=!0;return n}function E8(e,t,n){let i=n.map((a)=>e[a.id]),r=n.map((a)=>a.type),o=i.filter((a)=>!(a&1)),s=e[t.id]>>1;function l(a){let u=[];for(let c=0;c<i.length;c++){let f=yp(a,i[c]);if(r[c]==2)for(let d of f)u.push(d);else u.push(f)}return t.combine(u)}return{create(a){for(let u of i)Bc(a,u);return a.values[s]=l(a),1},update(a,u){if(!dy(a,o))return 0;let c=l(a);if(t.compare(c,a.values[s]))return 0;return a.values[s]=c,1},reconfigure(a,u){let c=dy(a,i),f=u.config.facets[t.id],d=u.facet(t);if(f&&!c&&wy(n,f))return a.values[s]=d,0;let h=l(a);if(t.compare(h,d))return a.values[s]=d,0;return a.values[s]=h,1}}}var hp=J.define({static:!0});class kn{constructor(e,t,n,i,r){this.id=e,this.createF=t,this.updateF=n,this.compareF=i,this.spec=r,this.provides=void 0}static define(e){let t=new kn(xy++,e.create,e.update,e.compare||((n,i)=>n===i),e);if(e.provide)t.provides=e.provide(t);return t}create(e){let t=e.facet(hp).find((n)=>n.field==this);return((t===null||t===void 0?void 0:t.create)||this.createF)(e)}slot(e){let t=e[this.id]>>1;return{create:(n)=>(n.values[t]=this.create(n),1),update:(n,i)=>{let r=n.values[t],o=this.updateF(r,i);if(this.compareF(r,o))return 0;return n.values[t]=o,1},reconfigure:(n,i)=>{let r=n.facet(hp),o=i.facet(hp),s;if((s=r.find((l)=>l.field==this))&&s!=o.find((l)=>l.field==this))return n.values[t]=s.create(n),1;if(i.config.address[this.id]!=null)return n.values[t]=i.field(this),0;return n.values[t]=this.create(n),1}}}init(e){return[this,hp.of({field:this,create:e})]}get extension(){return this}}var zs={lowest:4,low:3,default:2,high:1,highest:0};function Lc(e){return(t)=>new Sy(t,e)}var nr={highest:Lc(zs.highest),high:Lc(zs.high),default:Lc(zs.default),low:Lc(zs.low),lowest:Lc(zs.lowest)};class Sy{constructor(e,t){this.inner=e,this.prec=t}get extension(){return this}}class xp{of(e){return new vp(this,e)}reconfigure(e){return xp.reconfigure.of({compartment:this,extension:e})}get(e){return e.config.compartments.get(this)}}class vp{constructor(e,t){this.compartment=e,this.inner=t}get extension(){return this}}class bp{constructor(e,t,n,i,r,o){this.base=e,this.compartments=t,this.dynamicSlots=n,this.address=i,this.staticValues=r,this.facets=o,this.statusTemplate=[];while(this.statusTemplate.length<n.length)this.statusTemplate.push(0)}staticFacet(e){let t=this.address[e.id];return t==null?e.default:this.staticValues[t>>1]}static resolve(e,t,n){let i=[],r=Object.create(null),o=new Map;for(let f of O8(e,t,o))if(f instanceof kn)i.push(f);else(r[f.facet.id]||(r[f.facet.id]=[])).push(f);let s=Object.create(null),l=[],a=[];for(let f of i)s[f.id]=a.length<<1,a.push((d)=>f.slot(d));let u=n===null||n===void 0?void 0:n.config.facets;for(let f in r){let d=r[f],h=d[0].facet,m=u&&u[f]||[];if(d.every((b)=>b.type==0))if(s[h.id]=l.length<<1|1,wy(m,d))l.push(n.facet(h));else{let b=h.combine(d.map((x)=>x.value));l.push(n&&h.compare(b,n.facet(h))?n.facet(h):b)}else{for(let b of d)if(b.type==0)s[b.id]=l.length<<1|1,l.push(b.value);else s[b.id]=a.length<<1,a.push((x)=>b.dynamicSlot(x));s[h.id]=a.length<<1,a.push((b)=>E8(b,h,d))}}let c=a.map((f)=>f(s));return new bp(e,o,c,s,l,r)}}function O8(e,t,n){let i=[[],[],[],[],[]],r=new Map;function o(s,l){let a=r.get(s);if(a!=null){if(a<=l)return;let u=i[a].indexOf(s);if(u>-1)i[a].splice(u,1);if(s instanceof vp)n.delete(s.compartment)}if(r.set(s,l),Array.isArray(s))for(let u of s)o(u,l);else if(s instanceof vp){if(n.has(s.compartment))throw RangeError("Duplicate use of compartment in extensions");let u=t.get(s.compartment)||s.inner;n.set(s.compartment,u),o(u,l)}else if(s instanceof Sy)o(s.inner,s.prec);else if(s instanceof kn){if(i[l].push(s),s.provides)o(s.provides,l)}else if(s instanceof zc){if(i[l].push(s),s.facet.extensions)o(s.facet.extensions,zs.default)}else{let u=s.extension;if(!u)throw Error(`Unrecognized extension value in extension set (${s}).`);if(u==s)throw Error(`Unrecognized extension value in extension set (${s}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);o(u,l)}}return o(e,zs.default),i.reduce((s,l)=>s.concat(l))}function Bc(e,t){if(t&1)return 2;let n=t>>1,i=e.status[n];if(i==4)throw Error("Cyclic dependency between fields and/or facets");if(i&2)return i;e.status[n]=4;let r=e.computeSlot(e,e.config.dynamicSlots[n]);return e.status[n]=2|r}function yp(e,t){return t&1?e.config.staticValues[t>>1]:e.values[t>>1]}var tM=J.define(),hy=J.define({combine:(e)=>e.some((t)=>t),static:!0}),nM=J.define({combine:(e)=>e.length?e[0]:void 0,static:!0}),iM=J.define(),rM=J.define(),oM=J.define(),sM=J.define({combine:(e)=>e.length?e[0]:!1});class _n{constructor(e,t){this.type=e,this.value=t}static define(){return new lM}}class lM{of(e){return new _n(this,e)}}class aM{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 aM(e.map||((t)=>t))}static mapEffects(e,t){if(!e.length)return e;let n=[];for(let i of e){let r=i.map(t);if(r)n.push(r)}return n}}ye.reconfigure=ye.define();ye.appendConfig=ye.define();class Ze{constructor(e,t,n,i,r,o){if(this.startState=e,this.changes=t,this.selection=n,this.effects=i,this.annotations=r,this.scrollIntoView=o,this._doc=null,this._state=null,n)eM(n,t.newLength);if(!r.some((s)=>s.type==Ze.time))this.annotations=r.concat(Ze.time.of(Date.now()))}static create(e,t,n,i,r,o){return new Ze(e,t,n,i,r,o)}get newDoc(){return this._doc||(this._doc=this.changes.apply(this.startState.doc))}get newSelection(){return this.selection||this.startState.selection.map(this.changes)}get state(){if(!this._state)this.startState.applyTransaction(this);return this._state}annotation(e){for(let t of this.annotations)if(t.type==e)return t.value;return}get docChanged(){return!this.changes.empty}get reconfigured(){return this.startState.config!=this.state.config}isUserEvent(e){let t=this.annotation(Ze.userEvent);return!!(t&&(t==e||t.length>e.length&&t.slice(0,e.length)==e&&t[e.length]=="."))}}Ze.time=_n.define();Ze.userEvent=_n.define();Ze.addToHistory=_n.define();Ze.remote=_n.define();function A8(e,t){let n=[];for(let i=0,r=0;;){let o,s;if(i<e.length&&(r==t.length||t[r]>=e[i]))o=e[i++],s=e[i++];else if(r<t.length)o=t[r++],s=t[r++];else return n;if(!n.length||n[n.length-1]<o)n.push(o,s);else if(n[n.length-1]<s)n[n.length-1]=s}}function uM(e,t,n){var i;let r,o,s;if(n)r=t.changes,o=ot.empty(t.changes.length),s=e.changes.compose(t.changes);else r=t.changes.map(e.changes),o=e.changes.mapDesc(t.changes,!0),s=e.changes.compose(r);return{changes:s,selection:t.selection?t.selection.map(o):(i=e.selection)===null||i===void 0?void 0:i.map(r),effects:ye.mapEffects(e.effects,r).concat(ye.mapEffects(t.effects,o)),annotations:e.annotations.length?e.annotations.concat(t.annotations):t.annotations,scrollIntoView:e.scrollIntoView||t.scrollIntoView}}function py(e,t,n){let i=t.selection,r=_a(t.annotations);if(t.userEvent)r=r.concat(Ze.userEvent.of(t.userEvent));return{changes:t.changes instanceof ot?t.changes:ot.of(t.changes||[],n,e.facet(nM)),selection:i&&(i instanceof R?i:R.single(i.anchor,i.head)),effects:_a(t.effects),annotations:r,scrollIntoView:!!t.scrollIntoView}}function cM(e,t,n){let i=py(e,t.length?t[0]:{},e.doc.length);if(t.length&&t[0].filter===!1)n=!1;for(let o=1;o<t.length;o++){if(t[o].filter===!1)n=!1;let s=!!t[o].sequential;i=uM(i,py(e,t[o],s?i.changes.newLength:e.doc.length),s)}let r=Ze.create(e,i.changes,i.selection,i.effects,i.annotations,i.scrollIntoView);return T8(n?R8(r):r)}function R8(e){let t=e.startState,n=!0;for(let r of t.facet(iM)){let o=r(e);if(o===!1){n=!1;break}if(Array.isArray(o))n=n===!0?o:A8(n,o)}if(n!==!0){let r,o;if(n===!1)o=e.changes.invertedDesc,r=ot.empty(t.doc.length);else{let s=e.changes.filter(n);r=s.changes,o=s.filtered.mapDesc(s.changes).invertedDesc}e=Ze.create(t,r,e.selection&&e.selection.map(o),ye.mapEffects(e.effects,o),e.annotations,e.scrollIntoView)}let i=t.facet(rM);for(let r=i.length-1;r>=0;r--){let o=i[r](e);if(o instanceof Ze)e=o;else if(Array.isArray(o)&&o.length==1&&o[0]instanceof Ze)e=o[0];else e=cM(t,_a(o),!1)}return e}function T8(e){let t=e.startState,n=t.facet(oM),i=e;for(let r=n.length-1;r>=0;r--){let o=n[r](e);if(o&&Object.keys(o).length)i=uM(i,py(t,o,e.changes.newLength),!0)}return i==e?e:Ze.create(t,e.changes,e.selection,i.effects,i.annotations,i.scrollIntoView)}var M8=[];function _a(e){return e==null?M8:Array.isArray(e)?e:[e]}var $n=function(e){return e[e.Word=0]="Word",e[e.Space=1]="Space",e[e.Other=2]="Other",e}($n||($n={})),N8=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/,my;try{my=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch(e){}function D8(e){if(my)return my.test(e);for(let t=0;t<e.length;t++){let n=e[t];if(/\w/.test(n)||n>"€"&&(n.toUpperCase()!=n.toLowerCase()||N8.test(n)))return!0}return!1}function L8(e){return(t)=>{if(!/\S/.test(t))return $n.Space;if(D8(t))return $n.Word;for(let n=0;n<e.length;n++)if(t.indexOf(e[n])>-1)return $n.Word;return $n.Other}}class pe{constructor(e,t,n,i,r,o){if(this.config=e,this.doc=t,this.selection=n,this.values=i,this.status=e.statusTemplate.slice(),this.computeSlot=r,o)o._state=this;for(let s=0;s<this.config.dynamicSlots.length;s++)Bc(this,s<<1);this.computeSlot=null}field(e,t=!0){let n=this.config.address[e.id];if(n==null){if(t)throw RangeError("Field is not present in this state");return}return Bc(this,n),yp(this,n)}update(...e){return cM(this,e,!0)}applyTransaction(e){let t=this.config,{base:n,compartments:i}=t;for(let s of e.effects)if(s.is(xp.reconfigure)){if(t)i=new Map,t.compartments.forEach((l,a)=>i.set(a,l)),t=null;i.set(s.value.compartment,s.value.extension)}else if(s.is(ye.reconfigure))t=null,n=s.value;else if(s.is(ye.appendConfig))t=null,n=_a(n).concat(s.value);let r;if(!t)t=bp.resolve(n,i,this),r=new pe(t,this.doc,this.selection,t.dynamicSlots.map(()=>null),(l,a)=>a.reconfigure(l,this),null).values;else r=e.startState.values.slice();let o=e.startState.facet(hy)?e.newSelection:e.newSelection.asSingle();new pe(t,e.newDoc,o,r,(s,l)=>l.update(s,e),e)}replaceSelection(e){if(typeof e=="string")e=this.toText(e);return this.changeByRange((t)=>({changes:{from:t.from,to:t.to,insert:e},range:R.cursor(t.from+e.length,-1)}))}changeByRange(e){let t=this.selection,n=e(t.ranges[0]),i=this.changes(n.changes),r=[n.range],o=_a(n.effects);for(let s=1;s<t.ranges.length;s++){let l=e(t.ranges[s]),a=this.changes(l.changes),u=a.map(i);for(let f=0;f<s;f++)r[f]=r[f].map(u);let c=i.mapDesc(a,!0);r.push(l.range.map(c)),i=i.compose(u),o=ye.mapEffects(o,u).concat(ye.mapEffects(_a(l.effects),c))}return{changes:i,selection:R.create(r,t.mainIndex),effects:o}}changes(e=[]){if(e instanceof ot)return e;return ot.of(e,this.doc.length,this.facet(pe.lineSeparator))}toText(e){return de.of(e.split(this.facet(pe.lineSeparator)||uy))}sliceDoc(e=0,t=this.doc.length){return this.doc.sliceString(e,t,this.lineBreak)}facet(e){let t=this.config.address[e.id];if(t==null)return e.default;return Bc(this,t),yp(this,t)}toJSON(e){let t={doc:this.sliceDoc(),selection:this.selection.toJSON()};if(e)for(let n in e){let i=e[n];if(i instanceof kn&&this.config.address[i.id]!=null)t[n]=i.spec.toJSON(this.field(e[n]),this)}return t}static fromJSON(e,t={},n){if(!e||typeof e.doc!="string")throw RangeError("Invalid JSON representation for EditorState");let i=[];if(n){for(let r in n)if(Object.prototype.hasOwnProperty.call(e,r)){let o=n[r],s=e[r];i.push(o.init((l)=>o.spec.fromJSON(s,l)))}}return pe.create({doc:e.doc,selection:R.fromJSON(e.selection),extensions:t.extensions?i.concat([t.extensions]):i})}static create(e={}){let t=bp.resolve(e.extensions||[],new Map),n=e.doc instanceof de?e.doc:de.of((e.doc||"").split(t.staticFacet(pe.lineSeparator)||uy)),i=!e.selection?R.single(0):e.selection instanceof R?e.selection:R.single(e.selection.anchor,e.selection.head);if(eM(i,n.length),!t.staticFacet(hy))i=i.asSingle();return new pe(t,n,i,t.dynamicSlots.map(()=>null),(r,o)=>o.create(r),null)}get tabSize(){return this.facet(pe.tabSize)}get lineBreak(){return this.facet(pe.lineSeparator)||`
28
- `}get readOnly(){return this.facet(sM)}phrase(e,...t){for(let n of this.facet(pe.phrases))if(Object.prototype.hasOwnProperty.call(n,e)){e=n[e];break}if(t.length)e=e.replace(/\$(\$|\d*)/g,(n,i)=>{if(i=="$")return"$";let r=+(i||1);return!r||r>t.length?n:t[r-1]});return e}languageDataAt(e,t,n=-1){let i=[];for(let r of this.facet(tM))for(let o of r(this,t,n))if(Object.prototype.hasOwnProperty.call(o,e))i.push(o[e]);return i}charCategorizer(e){let t=this.languageDataAt("wordChars",e);return L8(t.length?t[0]:"")}wordAt(e){let{text:t,from:n,length:i}=this.doc.lineAt(e),r=this.charCategorizer(e),o=e-n,s=e-n;while(o>0){let l=yt(t,o,!1);if(r(t.slice(l,o))!=$n.Word)break;o=l}while(s<i){let l=yt(t,s);if(r(t.slice(s,l))!=$n.Word)break;s=l}return o==s?null:R.range(o+n,s+n)}}pe.allowMultipleSelections=hy;pe.tabSize=J.define({combine:(e)=>e.length?e[0]:4});pe.lineSeparator=nM;pe.readOnly=sM;pe.phrases=J.define({compare(e,t){let n=Object.keys(e),i=Object.keys(t);return n.length==i.length&&n.every((r)=>e[r]==t[r])}});pe.languageData=tM;pe.changeFilter=iM;pe.transactionFilter=rM;pe.transactionExtender=oM;xp.reconfigure=ye.define();function Oa(e,t,n={}){let i={};for(let r of e)for(let o of Object.keys(r)){let s=r[o],l=i[o];if(l===void 0)i[o]=s;else if(l===s||s===void 0);else if(Object.hasOwnProperty.call(n,o))i[o]=n[o](l,s);else throw Error("Config merge conflict for field "+o)}for(let r in t)if(i[r]===void 0)i[r]=t[r];return i}class gi{eq(e){return this==e}range(e,t=e){return Pc.create(e,t,this)}}gi.prototype.startSide=gi.prototype.endSide=0;gi.prototype.point=!1;gi.prototype.mapMode=qt.TrackDel;function ky(e,t){return e==t||e.constructor==t.constructor&&e.eq(t)}class Pc{constructor(e,t,n){this.from=e,this.to=t,this.value=n}static create(e,t,n){return new Pc(e,t,n)}}function gy(e,t){return e.from-t.from||e.value.startSide-t.value.startSide}class _y{constructor(e,t,n,i){this.from=e,this.to=t,this.value=n,this.maxPoint=i}get length(){return wa(this.to)}findIndex(e,t,n,i=0){let r=n?this.to:this.from;for(let o=i,s=r.length;;){if(o==s)return o;let l=o+s>>1,a=r[l]-e||(n?this.value[l].endSide:this.value[l].startSide)-t;if(l==o)return a>=0?o:s;if(a>=0)s=l;else o=l+1}}between(e,t,n,i){for(let r=this.findIndex(t,-1e9,!0),o=this.findIndex(n,1e9,!1,r);r<o;r++)if(i(this.from[r]+e,this.to[r]+e,this.value[r])===!1)return!1}map(e,t,n,i,r){let o=[],s=[],l=[],a=-1,u=-1;e:for(let c=0;c<this.value.length;c++){let f=this.value[c],d=this.from[c]+e,h=this.to[c]+e,m,b;if(d==h){let x=t.mapPos(d,f.startSide,f.mapMode);if(x==null)continue;if(m=b=x,f.startSide!=f.endSide){if(b=t.mapPos(d,f.endSide),b<m)continue}}else if(m=t.mapPos(d,f.startSide),b=t.mapPos(h,f.endSide),m>b||m==b&&f.startSide>0&&f.endSide<=0)continue;if((b-m||f.endSide-f.startSide)<0)continue;if(a<0)a=m;if(f.point)u=Math.max(u,b-m);if((m-n||f.startSide-i)>=0)o.push(f),s.push(m-a),l.push(b-a),n=b,i=f.endSide;else{if(m==b)for(let x=o.length;x>0;x--){if((m-(l[x-1]+a)||f.startSide-o[x-1].endSide)>=0){o.splice(x,0,f),s.splice(x,0,m-a),l.splice(x,0,b-a);continue e}if((m-(s[x-1]+a)||f.endSide-o[x-1].startSide)>0)break}r(m,b,f)}}return{mapped:o.length?new _y(s,l,o,u):null,pos:a}}}class ge{constructor(e,t,n,i){this.chunkPos=e,this.chunk=t,this.nextLayer=n,this.maxPoint=i}static create(e,t,n,i){return new ge(e,t,n,i)}get length(){let e=this.chunk.length-1;return e<0?0:Math.max(this.chunkEnd(e),this.nextLayer.length)}get size(){if(this.isEmpty)return 0;let e=this.nextLayer.size;for(let t of this.chunk)e+=t.value.length;return e}chunkEnd(e){return this.chunkPos[e]+this.chunk[e].length}update(e){let{add:t=[],sort:n=!1,filterFrom:i=0,filterTo:r=this.length}=e,o=e.filter;if(t.length==0&&!o)return this;if(n)t=t.slice().sort(gy);if(this.isEmpty)return t.length?ge.of(t):this;let s=new Cy(this,null,-1).goto(0),l=0,a=[],u=new Bs;while(s.value||l<t.length)if(l<t.length&&(s.from-t[l].from||s.startSide-t[l].value.startSide)>=0){let c=t[l++];if(!u.addInner(c.from,c.to,c.value,!1))a.push(c)}else if(s.rangeIndex==1&&s.chunkIndex<this.chunk.length&&(l==t.length||this.chunkEnd(s.chunkIndex)<t[l].from)&&(!o||i>this.chunkEnd(s.chunkIndex)||r<this.chunkPos[s.chunkIndex])&&u.addChunk(this.chunkPos[s.chunkIndex],this.chunk[s.chunkIndex]))s.nextChunk();else{if(!o||i>s.to||r<s.from||o(s.from,s.to,s.value)){if(!u.addInner(s.from,s.to,s.value,!1))a.push(Pc.create(s.from,s.to,s.value))}s.next()}return u.finishInner(this.nextLayer.isEmpty&&!a.length?ge.empty:this.nextLayer.update({add:a,filter:o,filterFrom:i,filterTo:r}))}map(e){if(e.empty||this.isEmpty)return this;let t=[],n=[],i=-1,r,o=(l,a,u)=>{if(!r)r=new Bs;r.addRange(l,a,u,!1)};for(let l=0;l<this.chunk.length;l++){let a=this.chunkPos[l],u=this.chunk[l],c=e.touchesRange(a,a+u.length);if(c===!1)i=Math.max(i,u.maxPoint),t.push(u),n.push(e.mapPos(a));else if(c===!0){let[f,d]=!t.length?[-1,-1]:[wa(n)+wa(t).length,wa(wa(t).value).endSide],{mapped:h,pos:m}=u.map(a,e,f,d,o);if(h)i=Math.max(i,h.maxPoint),t.push(h),n.push(m)}}let s=this.nextLayer.map(e);if(r)s=r.finishInner(s);return t.length==0?s:new ge(n,t,s||ge.empty,i)}between(e,t,n){if(this.isEmpty)return;for(let i=0;i<this.chunk.length;i++){let r=this.chunkPos[i],o=this.chunk[i];if(t>=r&&e<=r+o.length&&o.between(r,e-r,t-r,n)===!1)return}this.nextLayer.between(e,t,n)}iter(e=0){return Ic.from([this]).goto(e)}get isEmpty(){return this.nextLayer==this}static iter(e,t=0){return Ic.from(e).goto(t)}static compare(e,t,n,i,r=-1){let o=e.filter((c)=>c.maxPoint>0||!c.isEmpty&&c.maxPoint>=r),s=t.filter((c)=>c.maxPoint>0||!c.isEmpty&&c.maxPoint>=r),l=GT(o,s,n),a=new Sa(o,l,r),u=new Sa(s,l,r);if(n.iterGaps((c,f,d)=>YT(a,c,u,f,d,i)),n.empty&&n.length==0)YT(a,0,u,0,0,i)}static eq(e,t,n=0,i){if(i==null)i=999999999;let r=e.filter((u)=>!u.isEmpty&&t.indexOf(u)<0),o=t.filter((u)=>!u.isEmpty&&e.indexOf(u)<0);if(r.length!=o.length)return!1;if(!r.length)return!0;let s=GT(r,o),l=new Sa(r,s,0).goto(n),a=new Sa(o,s,0).goto(n);for(;;){if(l.to!=a.to||!vy(l.active,a.active)||l.point&&(!a.point||!ky(l.point,a.point)))return!1;if(l.to>i)return!0;l.next(),a.next()}}static spans(e,t,n,i,r=-1){let o=new Sa(e,null,r).goto(t),s=t,l=o.openStart;for(;;){let a=Math.min(o.to,n);if(o.point){let u=o.activeForPoint(o.to),c=o.pointFrom<t?u.length+1:o.point.startSide<0?u.length:Math.min(u.length,l);i.point(s,a,o.point,u,c,o.pointRank),l=Math.min(o.openEnd(a),u.length)}else if(a>s)i.span(s,a,o.active,l),l=o.openEnd(a);if(o.to>n)return l+(o.point&&o.to>n?1:0);s=o.to,o.next()}}static of(e,t=!1){let n=new Bs;for(let i of e instanceof Pc?[e]:t?z8(e):e)n.add(i.from,i.to,i.value);return n.finish()}static join(e){if(!e.length)return ge.empty;let t=wa(e);for(let n=e.length-2;n>=0;n--)for(let i=e[n];i!=ge.empty;i=i.nextLayer)t=new ge(i.chunkPos,i.chunk,t,Math.max(i.maxPoint,t.maxPoint));return t}}ge.empty=new ge([],[],null,-1);function wa(e){return e[e.length-1]}function z8(e){if(e.length>1)for(let t=e[0],n=1;n<e.length;n++){let i=e[n];if(gy(t,i)>0)return e.slice().sort(gy);t=i}return e}ge.empty.nextLayer=ge.empty;class Bs{finishChunk(e){if(this.chunks.push(new _y(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,n){this.addRange(e,t,n,!0)}addRange(e,t,n,i){if(!this.addInner(e,t,n,i))(this.nextLayer||(this.nextLayer=new Bs)).addRange(e,t,n,i)}addInner(e,t,n,i){let r=e-this.lastTo||n.startSide-this.last.endSide;if(i&&r<=0&&(e-this.lastFrom||n.startSide-this.last.startSide)<0)throw Error("Ranges must be added sorted by `from` position and `startSide`");if(r<0)return!1;if(this.from.length==250)this.finishChunk(!0);if(this.chunkStart<0)this.chunkStart=e;if(this.from.push(e-this.chunkStart),this.to.push(t-this.chunkStart),this.last=n,this.lastFrom=e,this.lastTo=t,this.value.push(n),n.point)this.maxPoint=Math.max(this.maxPoint,t-e);return!0}addChunk(e,t){if((e-this.lastTo||t.value[0].startSide-this.last.endSide)<0)return!1;if(this.from.length)this.finishChunk(!0);this.setMaxPoint=Math.max(this.setMaxPoint,t.maxPoint),this.chunks.push(t),this.chunkPos.push(e);let n=t.value.length-1;return this.last=t.value[n],this.lastFrom=t.from[n]+e,this.lastTo=t.to[n]+e,!0}finish(){return this.finishInner(ge.empty)}finishInner(e){if(this.from.length)this.finishChunk(!1);if(this.chunks.length==0)return e;let t=ge.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(e):e,this.setMaxPoint);return this.from=null,t}}function GT(e,t,n){let i=new Map;for(let o of e)for(let s=0;s<o.chunk.length;s++)if(o.chunk[s].maxPoint<=0)i.set(o.chunk[s],o.chunkPos[s]);let r=new Set;for(let o of t)for(let s=0;s<o.chunk.length;s++){let l=i.get(o.chunk[s]);if(l!=null&&(n?n.mapPos(l):l)==o.chunkPos[s]&&!(n===null||n===void 0?void 0:n.touchesRange(l,l+o.chunk[s].length)))r.add(o.chunk[s])}return r}class Cy{constructor(e,t,n,i=0){this.layer=e,this.skip=t,this.minPoint=n,this.rank=i}get startSide(){return this.value?this.value.startSide:0}get endSide(){return this.value?this.value.endSide:0}goto(e,t=-1e9){return this.chunkIndex=this.rangeIndex=0,this.gotoInner(e,t,!1),this}gotoInner(e,t,n){while(this.chunkIndex<this.layer.chunk.length){let i=this.layer.chunk[this.chunkIndex];if(!(this.skip&&this.skip.has(i)||this.layer.chunkEnd(this.chunkIndex)<e||i.maxPoint<this.minPoint))break;this.chunkIndex++,n=!1}if(this.chunkIndex<this.layer.chunk.length){let i=this.layer.chunk[this.chunkIndex].findIndex(e-this.layer.chunkPos[this.chunkIndex],t,!0);if(!n||this.rangeIndex<i)this.setRangeIndex(i)}this.next()}forward(e,t){if((this.to-e||this.endSide-t)<0)this.gotoInner(e,t,!0)}next(){for(;;)if(this.chunkIndex==this.layer.chunk.length){this.from=this.to=1e9,this.value=null;break}else{let e=this.layer.chunkPos[this.chunkIndex],t=this.layer.chunk[this.chunkIndex],n=e+t.from[this.rangeIndex];if(this.from=n,this.to=e+t.to[this.rangeIndex],this.value=t.value[this.rangeIndex],this.setRangeIndex(this.rangeIndex+1),this.minPoint<0||this.value.point&&this.to-this.from>=this.minPoint)break}}setRangeIndex(e){if(e==this.layer.chunk[this.chunkIndex].value.length){if(this.chunkIndex++,this.skip)while(this.chunkIndex<this.layer.chunk.length&&this.skip.has(this.layer.chunk[this.chunkIndex]))this.chunkIndex++;this.rangeIndex=0}else this.rangeIndex=e}nextChunk(){this.chunkIndex++,this.rangeIndex=0,this.next()}compare(e){return this.from-e.from||this.startSide-e.startSide||this.rank-e.rank||this.to-e.to||this.endSide-e.endSide}}class Ic{constructor(e){this.heap=e}static from(e,t=null,n=-1){let i=[];for(let r=0;r<e.length;r++)for(let o=e[r];!o.isEmpty;o=o.nextLayer)if(o.maxPoint>=n)i.push(new Cy(o,t,n,r));return i.length==1?i[0]:new Ic(i)}get startSide(){return this.value?this.value.startSide:0}goto(e,t=-1e9){for(let n of this.heap)n.goto(e,t);for(let n=this.heap.length>>1;n>=0;n--)ay(this.heap,n);return this.next(),this}forward(e,t){for(let n of this.heap)n.forward(e,t);for(let n=this.heap.length>>1;n>=0;n--)ay(this.heap,n);if((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];if(this.from=e.from,this.to=e.to,this.value=e.value,this.rank=e.rank,e.value)e.next();ay(this.heap,0)}}}function ay(e,t){for(let n=e[t];;){let i=(t<<1)+1;if(i>=e.length)break;let r=e[i];if(i+1<e.length&&r.compare(e[i+1])>=0)r=e[i+1],i++;if(n.compare(r)<0)break;e[i]=n,e[t]=r,t=i}}class Sa{constructor(e,t,n){this.minPoint=n,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=Ic.from(e,t,n)}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){while(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){pp(this.active,e),pp(this.activeTo,e),pp(this.activeRank,e),this.minActive=WT(this.active,this.activeTo)}addActive(e){let t=0,{value:n,to:i,rank:r}=this.cursor;while(t<this.activeRank.length&&(r-this.activeRank[t]||i-this.activeTo[t])>0)t++;if(mp(this.active,t,n),mp(this.activeTo,t,i),mp(this.activeRank,t,r),e)mp(e,t,this.cursor.from);this.minActive=WT(this.active,this.activeTo)}next(){let e=this.to,t=this.point;this.point=null;let n=this.openStart<0?[]:null;for(;;){let i=this.minActive;if(i>-1&&(this.activeTo[i]-this.cursor.from||this.active[i].endSide-this.cursor.startSide)<0){if(this.activeTo[i]>e){this.to=this.activeTo[i],this.endSide=this.active[i].endSide;break}if(this.removeActive(i),n)pp(n,i)}else if(!this.cursor.value){this.to=this.endSide=1e9;break}else if(this.cursor.from>e){this.to=this.cursor.from,this.endSide=this.cursor.startSide;break}else{let r=this.cursor.value;if(!r.point)this.addActive(n),this.cursor.next();else if(t&&this.cursor.to==this.to&&this.cursor.from<this.cursor.to)this.cursor.next();else{this.point=r,this.pointFrom=this.cursor.from,this.pointRank=this.cursor.rank,this.to=this.cursor.to,this.endSide=r.endSide,this.cursor.next(),this.forward(this.to,this.endSide);break}}}if(n){this.openStart=0;for(let i=n.length-1;i>=0&&n[i]<e;i--)this.openStart++}}activeForPoint(e){if(!this.active.length)return this.active;let t=[];for(let n=this.active.length-1;n>=0;n--){if(this.activeRank[n]<this.pointRank)break;if(this.activeTo[n]>e||this.activeTo[n]==e&&this.active[n].endSide>=this.point.endSide)t.push(this.active[n])}return t.reverse()}openEnd(e){let t=0;for(let n=this.activeTo.length-1;n>=0&&this.activeTo[n]>e;n--)t++;return t}}function YT(e,t,n,i,r,o){e.goto(t),n.goto(i);let s=i+r,l=i,a=i-t,u=!!o.boundChange;for(let c=!1;;){let f=e.to+a-n.to,d=f||e.endSide-n.endSide,h=d<0?e.to+a:n.to,m=Math.min(h,s);if(e.point||n.point){if(!(e.point&&n.point&&ky(e.point,n.point)&&vy(e.activeForPoint(e.to),n.activeForPoint(n.to))))o.comparePoint(l,m,e.point,n.point);c=!1}else{if(c)o.boundChange(l),c=!1;if(m>l&&!vy(e.active,n.active))o.compareRange(l,m,e.active,n.active);if(u&&m<s&&(f||e.openEnd(h)!=n.openEnd(h)))c=!0}if(h>s)break;if(l=h,d<=0)e.next();if(d>=0)n.next()}}function vy(e,t){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!=t[n]&&!ky(e[n],t[n]))return!1;return!0}function pp(e,t){for(let n=t,i=e.length-1;n<i;n++)e[n]=e[n+1];e.pop()}function mp(e,t,n){for(let i=e.length-1;i>=t;i--)e[i+1]=e[i];e[t]=n}function WT(e,t){let n=-1,i=1e9;for(let r=0;r<t.length;r++)if((t[r]-i||e[r].endSide-e[n].endSide)<0)n=r,i=t[r];return n}function Ps(e,t,n=e.length){let i=0;for(let r=0;r<n&&r<e.length;)if(e.charCodeAt(r)==9)i+=t-i%t,r++;else i++,r=yt(e,r);return i}function fM(e,t,n,i){for(let r=0,o=0;;){if(o>=t)return r;if(r==e.length)break;o+=e.charCodeAt(r)==9?n-o%n:1,r=yt(e,r)}return i===!0?-1:e.length}var dM=typeof Symbol>"u"?"__"+"ͼ":Symbol.for("ͼ"),Ey=typeof Symbol>"u"?"__styleSet"+Math.floor(Math.random()*1e8):Symbol("styleSet"),hM=typeof globalThis<"u"?globalThis:typeof window<"u"?window:{};class vi{constructor(e,t){this.rules=[];let{finish:n}=t||{};function i(o){return/^@/.test(o)?[o]:o.split(/,\s*/)}function r(o,s,l,a){let u=[],c=/^@(\w+)\b/.exec(o[0]),f=c&&c[1]=="keyframes";if(c&&s==null)return l.push(o[0]+";");for(let d in s){let h=s[d];if(/&/.test(d))r(d.split(/,\s*/).map((m)=>o.map((b)=>m.replace(/&/,b))).reduce((m,b)=>m.concat(b)),h,l);else if(h&&typeof h=="object"){if(!c)throw RangeError("The value of a property ("+d+") should be a primitive value.");r(i(d),h,u,f)}else if(h!=null)u.push(d.replace(/_.*/,"").replace(/[A-Z]/g,(m)=>"-"+m.toLowerCase())+": "+h+";")}if(u.length||f)l.push((n&&!c&&!a?o.map(n):o).join(", ")+" {"+u.join(" ")+"}")}for(let o in e)r(i(o),e[o],this.rules)}getRules(){return this.rules.join(`
29
- `)}static newName(){let e=hM[dM]||1;return hM[dM]=e+1,"ͼ"+e.toString(36)}static mount(e,t,n){let i=e[Ey],r=n&&n.nonce;if(!i)i=new mM(e,r);else if(r)i.setNonce(r);i.mount(Array.isArray(t)?t:[t],e)}}var pM=new Map;class mM{constructor(e,t){let n=e.ownerDocument||e,i=n.defaultView;if(!e.head&&e.adoptedStyleSheets&&i.CSSStyleSheet){let r=pM.get(n);if(r)return e[Ey]=r;this.sheet=new i.CSSStyleSheet,pM.set(n,this)}else if(this.styleTag=n.createElement("style"),t)this.styleTag.setAttribute("nonce",t);this.modules=[],e[Ey]=this}mount(e,t){let n=this.sheet,i=0,r=0,o=!1;for(let s=0;s<e.length;s++){let l=e[s],a=this.modules.indexOf(l);if(a<r&&a>-1)this.modules.splice(a,1),o=!0,r--,a=-1;if(a==-1){if(this.modules.splice(r++,0,l),o=!0,n)for(let u=0;u<l.rules.length;u++)n.insertRule(l.rules[u],i++)}else{while(r<a)i+=this.modules[r++].rules.length;i+=l.rules.length,r++}}if(n){if(t.adoptedStyleSheets.indexOf(this.sheet)<0)t.adoptedStyleSheets=[this.sheet,...t.adoptedStyleSheets]}else{if(o){let l="";for(let a=0;a<this.modules.length;a++)l+=this.modules[a].getRules()+`
30
- `;this.styleTag.textContent=l}let s=t.head||t;if(this.styleTag.parentNode!=s)s.insertBefore(this.styleTag,s.firstChild)}}setNonce(e){if(this.styleTag&&this.styleTag.getAttribute("nonce")!=e)this.styleTag.setAttribute("nonce",e)}}var Pr={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},Aa={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},B8=typeof navigator<"u"&&/Mac/.test(navigator.platform),P8=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(Ge=0;Ge<10;Ge++)Pr[48+Ge]=Pr[96+Ge]=String(Ge);var Ge;for(Ge=1;Ge<=24;Ge++)Pr[Ge+111]="F"+Ge;var Ge;for(Ge=65;Ge<=90;Ge++)Pr[Ge]=String.fromCharCode(Ge+32),Aa[Ge]=String.fromCharCode(Ge);var Ge;for(Vc in Pr)if(!Aa.hasOwnProperty(Vc))Aa[Vc]=Pr[Vc];var Vc;function gM(e){var t=B8&&e.metaKey&&e.shiftKey&&!e.ctrlKey&&!e.altKey||P8&&e.shiftKey&&e.key&&e.key.length==1||e.key=="Unidentified",n=!t&&e.key||(e.shiftKey?Aa:Pr)[e.keyCode]||e.key||"Unidentified";if(n=="Esc")n="Escape";if(n=="Del")n="Delete";if(n=="Left")n="ArrowLeft";if(n=="Up")n="ArrowUp";if(n=="Right")n="ArrowRight";if(n=="Down")n="ArrowDown";return n}var $t=typeof navigator<"u"?navigator:{userAgent:"",vendor:"",platform:""},Dy=typeof document<"u"?document:{documentElement:{style:{}}},Ly=/Edge\/(\d+)/.exec($t.userAgent),$M=/MSIE \d/.test($t.userAgent),zy=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec($t.userAgent),Hp=!!($M||zy||Ly),vM=!Hp&&/gecko\/(\d+)/i.test($t.userAgent),Oy=!Hp&&/Chrome\/(\d+)/.exec($t.userAgent),bM="webkitFontSmoothing"in Dy.documentElement.style,By=!Hp&&/Apple Computer/.test($t.vendor),yM=By&&(/Mobile\/\w+/.test($t.userAgent)||$t.maxTouchPoints>2),K={mac:yM||/Mac/.test($t.platform),windows:/Win/.test($t.platform),linux:/Linux|X11/.test($t.platform),ie:Hp,ie_version:$M?Dy.documentMode||6:zy?+zy[1]:Ly?+Ly[1]:0,gecko:vM,gecko_version:vM?+(/Firefox\/(\d+)/.exec($t.userAgent)||[0,0])[1]:0,chrome:!!Oy,chrome_version:Oy?+Oy[1]:0,ios:yM,android:/Android\b/.test($t.userAgent),webkit:bM,webkit_version:bM?+(/\bAppleWebKit\/(\d+)/.exec($t.userAgent)||[0,0])[1]:0,safari:By,safari_version:By?+(/\bVersion\/(\d+(\.\d+)?)/.exec($t.userAgent)||[0,0])[1]:0,tabSize:Dy.documentElement.style.tabSize!=null?"tab-size":"-moz-tab-size"};function Jy(e,t){for(let n in e)if(n=="class"&&t.class)t.class+=" "+e.class;else if(n=="style"&&t.style)t.style+=";"+e.style;else t[n]=e[n];return t}var Dp=Object.create(null);function Zy(e,t,n){if(e==t)return!0;if(!e)e=Dp;if(!t)t=Dp;let i=Object.keys(e),r=Object.keys(t);if(i.length-(n&&i.indexOf(n)>-1?1:0)!=r.length-(n&&r.indexOf(n)>-1?1:0))return!1;for(let o of i)if(o!=n&&(r.indexOf(o)==-1||e[o]!==t[o]))return!1;return!0}function I8(e,t){for(let n=e.attributes.length-1;n>=0;n--){let i=e.attributes[n].name;if(t[i]==null)e.removeAttribute(i)}for(let n in t){let i=t[n];if(n=="style")e.style.cssText=i;else if(e.getAttribute(n)!=i)e.setAttribute(n,i)}}function xM(e,t,n){let i=!1;if(t){for(let r in t)if(!(n&&(r in n)))if(i=!0,r=="style")e.style.cssText="";else e.removeAttribute(r)}if(n){for(let r in n)if(!(t&&t[r]==n[r]))if(i=!0,r=="style")e.style.cssText=n[r];else e.setAttribute(r,n[r])}return i}function V8(e){let t=Object.create(null);for(let n=0;n<e.attributes.length;n++){let i=e.attributes[n];t[i.name]=i.value}return t}class Po{eq(e){return!1}updateDOM(e,t,n){return!1}compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}get estimatedHeight(){return-1}get lineBreaks(){return 0}ignoreEvent(e){return!0}coordsAt(e,t,n){return null}get isHidden(){return!1}get editable(){return!1}destroy(e){}}var Gn=function(e){return e[e.Text=0]="Text",e[e.WidgetBefore=1]="WidgetBefore",e[e.WidgetAfter=2]="WidgetAfter",e[e.WidgetRange=3]="WidgetRange",e}(Gn||(Gn={}));class Oe extends gi{constructor(e,t,n,i){super();this.startSide=e,this.endSide=t,this.widget=n,this.spec=i}get heightRelevant(){return!1}static mark(e){return new Jc(e)}static widget(e){let t=Math.max(-1e4,Math.min(1e4,e.side||0)),n=!!e.block;return t+=n&&!e.inlineOrder?t>0?300000000:-400000000:t>0?1e8:-1e8,new Hs(e,t,t,n,e.widget||null,!1)}static replace(e){let t=!!e.block,n,i;if(e.isBlockGap)n=-500000000,i=400000000;else{let{start:r,end:o}=XM(e,t);n=(r?t?-300000000:-1:500000000)-1,i=(o?t?200000000:1:-600000000)+1}return new Hs(e,n,i,t,e.widget||null,!0)}static line(e){return new Zc(e)}static set(e,t=!1){return ge.of(e,t)}hasHeight(){return this.widget?this.widget.estimatedHeight>-1:!1}}Oe.none=ge.empty;class Jc extends Oe{constructor(e){let{start:t,end:n}=XM(e);super(t?-1:500000000,n?1:-600000000,null,e);this.tagName=e.tagName||"span",this.attrs=e.class&&e.attributes?Jy(e.attributes,{class:e.class}):e.class?{class:e.class}:e.attributes||Dp}eq(e){return this==e||e instanceof Jc&&this.tagName==e.tagName&&Zy(this.attrs,e.attrs)}range(e,t=e){if(e>=t)throw RangeError("Mark decorations may not be empty");return super.range(e,t)}}Jc.prototype.point=!1;class Zc extends Oe{constructor(e){super(-200000000,-200000000,null,e)}eq(e){return e instanceof Zc&&this.spec.class==e.spec.class&&Zy(this.spec.attributes,e.spec.attributes)}range(e,t=e){if(t!=e)throw RangeError("Line decoration ranges must be zero-length");return super.range(e,t)}}Zc.prototype.mapMode=qt.TrackBefore;Zc.prototype.point=!0;class Hs extends Oe{constructor(e,t,n,i,r,o){super(t,n,r,e);this.block=i,this.isReplace=o,this.mapMode=!i?qt.TrackDel:t<=0?qt.TrackBefore:qt.TrackAfter}get type(){return this.startSide!=this.endSide?Gn.WidgetRange:this.startSide<=0?Gn.WidgetBefore:Gn.WidgetAfter}get heightRelevant(){return this.block||!!this.widget&&(this.widget.estimatedHeight>=5||this.widget.lineBreaks>0)}eq(e){return e instanceof Hs&&H8(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 RangeError("Invalid range for replacement decoration");if(!this.isReplace&&t!=e)throw RangeError("Widget decorations can only have zero-length ranges");return super.range(e,t)}}Hs.prototype.point=!0;function XM(e,t=!1){let{inclusiveStart:n,inclusiveEnd:i}=e;if(n==null)n=e.inclusive;if(i==null)i=e.inclusive;return{start:n!==null&&n!==void 0?n:t,end:i!==null&&i!==void 0?i:t}}function H8(e,t){return e==t||!!(e&&t&&e.compare(t))}function Ma(e,t,n,i=0){let r=n.length-1;if(r>=0&&n[r]+i>=e)n[r]=Math.max(n[r],t);else n.push(e,t)}class Xc extends gi{constructor(e,t,n){super();this.tagName=e,this.attributes=t,this.rank=n}eq(e){return e==this||e instanceof Xc&&this.tagName==e.tagName&&Zy(this.attributes,e.attributes)}static create(e){return new Xc(e.tagName,e.attributes||Dp,e.rank==null?50:Math.max(0,Math.min(e.rank,100)))}static set(e,t=!1){return ge.of(e,t)}}Xc.prototype.startSide=Xc.prototype.endSide=-1;function Gc(e){let t;if(e.nodeType==11)t=e.getSelection?e:e.ownerDocument;else t=e;return t.getSelection()}function Py(e,t){return t?e==t||e.contains(t.nodeType!=1?t.parentNode:t):!1}function Kc(e,t){if(!t.anchorNode)return!1;try{return Py(e,t.anchorNode)}catch(n){return!1}}function Fc(e){if(e.nodeType==3)return Wc(e,0,e.nodeValue.length).getClientRects();else if(e.nodeType==1)return e.getClientRects();else return[]}function qc(e,t,n,i){return n?wM(e,t,n,i,-1)||wM(e,t,n,i,1):!1}function zo(e){for(var t=0;;t++)if(e=e.previousSibling,!e)return t}function Lp(e){return e.nodeType==1&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(e.nodeName)}function wM(e,t,n,i,r){for(;;){if(e==n&&t==i)return!0;if(t==(r<0?0:Hr(e))){if(e.nodeName=="DIV")return!1;let o=e.parentNode;if(!o||o.nodeType!=1)return!1;t=zo(e)+(r<0?0:1),e=o}else if(e.nodeType==1){if(e=e.childNodes[t+(r<0?-1:0)],e.nodeType==1&&e.contentEditable=="false")return!1;t=r<0?Hr(e):0}else return!1}}function Hr(e){return e.nodeType==3?e.nodeValue.length:e.childNodes.length}function Yc(e,t){let{left:n,right:i}=e;if(n==i)return e;let r=t?n:i;return{left:r,right:r,top:e.top,bottom:e.bottom}}function U8(e){let t=e.visualViewport;if(t)return{left:0,right:t.width,top:0,bottom:t.height};return{left:0,right:e.innerWidth,top:0,bottom:e.innerHeight}}function GM(e,t){let n=t.width/e.offsetWidth,i=t.height/e.offsetHeight;if(n>0.995&&n<1.005||!isFinite(n)||Math.abs(t.width-e.offsetWidth)<1)n=1;if(i>0.995&&i<1.005||!isFinite(i)||Math.abs(t.height-e.offsetHeight)<1)i=1;return{scaleX:n,scaleY:i}}function j8(e,t,n,i,r,o,s,l){let a=e.ownerDocument,u=a.defaultView||window;for(let c=e,f=!1;c&&!f;)if(c.nodeType==1){let d,h=c==a.body,m=1,b=1;if(h)d=U8(u);else{if(/^(fixed|sticky)$/.test(getComputedStyle(c).position))f=!0;if(c.scrollHeight<=c.clientHeight&&c.scrollWidth<=c.clientWidth){c=c.assignedSlot||c.parentNode;continue}let v=c.getBoundingClientRect();({scaleX:m,scaleY:b}=GM(c,v)),d={left:v.left,right:v.left+c.clientWidth*m,top:v.top,bottom:v.top+c.clientHeight*b}}let x=0,g=0;if(r=="nearest"){if(t.top<d.top+s){if(g=t.top-(d.top+s),n>0&&t.bottom>d.bottom+g)g=t.bottom-d.bottom+s}else if(t.bottom>d.bottom-s){if(g=t.bottom-d.bottom+s,n<0&&t.top-g<d.top)g=t.top-(d.top+s)}}else{let v=t.bottom-t.top,w=d.bottom-d.top;g=(r=="center"&&v<=w?t.top+v/2-w/2:r=="start"||r=="center"&&n<0?t.top-s:t.bottom-w+s)-d.top}if(i=="nearest"){if(t.left<d.left+o){if(x=t.left-(d.left+o),n>0&&t.right>d.right+x)x=t.right-d.right+o}else if(t.right>d.right-o){if(x=t.right-d.right+o,n<0&&t.left<d.left+x)x=t.left-(d.left+o)}}else x=(i=="center"?t.left+(t.right-t.left)/2-(d.right-d.left)/2:i=="start"==l?t.left-o:t.right-(d.right-d.left)+o)-d.left;if(x||g)if(h)u.scrollBy(x,g);else{let v=0,w=0;if(g){let S=c.scrollTop;c.scrollTop+=g/b,w=(c.scrollTop-S)*b}if(x){let S=c.scrollLeft;c.scrollLeft+=x/m,v=(c.scrollLeft-S)*m}if(t={left:t.left-v,top:t.top-w,right:t.right-v,bottom:t.bottom-w},v&&Math.abs(v-x)<1)i="nearest";if(w&&Math.abs(w-g)<1)r="nearest"}if(h)break;if(t.top<d.top||t.bottom>d.bottom||t.left<d.left||t.right>d.right)t={left:Math.max(t.left,d.left),right:Math.min(t.right,d.right),top:Math.max(t.top,d.top),bottom:Math.min(t.bottom,d.bottom)};c=c.assignedSlot||c.parentNode}else if(c.nodeType==11)c=c.host;else break}function YM(e,t=!0){let n=e.ownerDocument,i=null,r=null;for(let o=e.parentNode;o;)if(o==n.body||(!t||i)&&r)break;else if(o.nodeType==1){if(!r&&o.scrollHeight>o.clientHeight)r=o;if(t&&!i&&o.scrollWidth>o.clientWidth)i=o;o=o.assignedSlot||o.parentNode}else if(o.nodeType==11)o=o.host;else break;return{x:i,y:r}}class WM{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:n}=e;this.set(t,Math.min(e.anchorOffset,t?Hr(t):0),n,Math.min(e.focusOffset,n?Hr(n):0))}set(e,t,n,i){this.anchorNode=e,this.anchorOffset=t,this.focusNode=n,this.focusOffset=i}}function QM(e){let t=[];for(let n=e;n;n=n.nodeType==11?n.host:n.parentNode)if(n.nodeType==1)t.push({node:n,left:n.scrollLeft,top:n.scrollTop});return t}function JM(e,t=!0){for(let{node:n,left:i,top:r}of e){if(t&&n.scrollTop!=r)n.scrollTop=r;if(n.scrollLeft!=i)n.scrollLeft=i}}var Is=null;if(K.safari&&K.safari_version>=26)Is=!1;function ZM(e){if(e.setActive)return e.setActive();if(Is)return e.focus(Is);let t=QM(e);if(e.focus(Is==null?{get preventScroll(){return Is={preventScroll:!0},!0}}:void 0),!Is)Is=!1,JM(t)}var SM;function Wc(e,t,n=t){let i=SM||(SM=document.createRange());return i.setEnd(e,n),i.setStart(e,t),i}function Na(e,t,n,i){let r={key:t,code:t,keyCode:n,which:n,cancelable:!0};if(i)({altKey:r.altKey,ctrlKey:r.ctrlKey,shiftKey:r.shiftKey,metaKey:r.metaKey}=i);let o=new KeyboardEvent("keydown",r);o.synthetic=!0,e.dispatchEvent(o);let s=new KeyboardEvent("keyup",r);return s.synthetic=!0,e.dispatchEvent(s),o.defaultPrevented||s.defaultPrevented}function K8(e){while(e){if(e&&(e.nodeType==9||e.nodeType==11&&e.host))return e;e=e.assignedSlot||e.parentNode}return null}function F8(e,t){let{focusNode:n,focusOffset:i}=t;if(!n||t.anchorNode!=n||t.anchorOffset!=i)return!1;i=Math.min(i,Hr(n));for(;;)if(i){if(n.nodeType!=1)return!1;let r=n.childNodes[i-1];if(r.contentEditable=="false")i--;else n=r,i=Hr(n)}else if(n==e)return!0;else i=zo(n),n=n.parentNode}function e2(e){if(e instanceof Window)return e.pageYOffset>Math.max(0,e.document.documentElement.scrollHeight-e.innerHeight-4);return e.scrollTop>Math.max(1,e.scrollHeight-e.clientHeight-4)}function t2(e,t){for(let n=e,i=t;;)if(n.nodeType==3&&i>0)return{node:n,offset:i};else if(n.nodeType==1&&i>0){if(n.contentEditable=="false")return null;n=n.childNodes[i-1],i=Hr(n)}else if(n.parentNode&&!Lp(n))i=zo(n),n=n.parentNode;else return null}function n2(e,t){for(let n=e,i=t;;)if(n.nodeType==3&&i<n.nodeValue.length)return{node:n,offset:i};else if(n.nodeType==1&&i<n.childNodes.length){if(n.contentEditable=="false")return null;n=n.childNodes[i],i=0}else if(n.parentNode&&!Lp(n))i=zo(n)+1,n=n.parentNode;else return null}class xi{constructor(e,t,n=!0){this.node=e,this.offset=t,this.precise=n}static before(e,t){return new xi(e.parentNode,zo(e),t)}static after(e,t){return new xi(e.parentNode,zo(e)+1,t)}}var je=function(e){return e[e.LTR=0]="LTR",e[e.RTL=1]="RTL",e}(je||(je={})),Us=je.LTR,ex=je.RTL;function i2(e){let t=[];for(let n=0;n<e.length;n++)t.push(1<<+e[n]);return t}var q8=i2("88888888888888888888888888888888888666888888787833333333337888888000000000000000000000000008888880000000000000000000000000088888888888888888888888888888888888887866668888088888663380888308888800000000000000000000000800000000000000000000000000000008"),$8=i2("4444448826627288999999999992222222222222222222222222222222222222222222222229999999999999999999994444444444644222822222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222999999949999999229989999223333333333"),Iy=Object.create(null),ir=[];for(let e of["()","[]","{}"]){let t=e.charCodeAt(0),n=e.charCodeAt(1);Iy[t]=n,Iy[n]=-t}function r2(e){return e<=247?q8[e]:1424<=e&&e<=1524?2:1536<=e&&e<=1785?$8[e-1536]:1774<=e&&e<=2220?4:8192<=e&&e<=8204?256:64336<=e&&e<=65023?4:1}var X8=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac\ufb50-\ufdff]/;class wi{get dir(){return this.level%2?ex:Us}constructor(e,t,n){this.from=e,this.to=t,this.level=n}side(e,t){return this.dir==t==e?this.to:this.from}forward(e,t){return e==(this.dir==t)}static find(e,t,n,i){let r=-1;for(let o=0;o<e.length;o++){let s=e[o];if(s.from<=t&&s.to>=t){if(s.level==n)return o;if(r<0||(i!=0?i<0?s.from<t:s.to>t:e[r].level>s.level))r=o}}if(r<0)throw RangeError("Index out of range");return r}}function o2(e,t){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++){let i=e[n],r=t[n];if(i.from!=r.from||i.to!=r.to||i.direction!=r.direction||!o2(i.inner,r.inner))return!1}return!0}var Ne=[];function G8(e,t,n,i,r){for(let o=0;o<=i.length;o++){let s=o?i[o-1].to:t,l=o<i.length?i[o].from:n,a=o?256:r;for(let u=s,c=a,f=a;u<l;u++){let d=r2(e.charCodeAt(u));if(d==512)d=c;else if(d==8&&f==4)d=16;if(Ne[u]=d==4?2:d,d&7)f=d;c=d}for(let u=s,c=a,f=a;u<l;u++){let d=Ne[u];if(d==128)if(u<l-1&&c==Ne[u+1]&&c&24)d=Ne[u]=c;else Ne[u]=256;else if(d==64){let h=u+1;while(h<l&&Ne[h]==64)h++;let m=u&&c==8||h<n&&Ne[h]==8?f==1?1:8:256;for(let b=u;b<h;b++)Ne[b]=m;u=h-1}else if(d==8&&f==1)Ne[u]=1;if(c=d,d&7)f=d}}}function Y8(e,t,n,i,r){let o=r==1?2:1;for(let s=0,l=0,a=0;s<=i.length;s++){let u=s?i[s-1].to:t,c=s<i.length?i[s].from:n;for(let f=u,d,h,m;f<c;f++)if(h=Iy[d=e.charCodeAt(f)])if(h<0){for(let b=l-3;b>=0;b-=3)if(ir[b+1]==-h){let x=ir[b+2],g=x&2?r:!(x&4)?0:x&1?o:r;if(g)Ne[f]=Ne[ir[b]]=g;l=b;break}}else if(ir.length==189)break;else ir[l++]=f,ir[l++]=d,ir[l++]=a;else if((m=Ne[f])==2||m==1){let b=m==r;a=b?0:1;for(let x=l-3;x>=0;x-=3){let g=ir[x+2];if(g&2)break;if(b)ir[x+2]|=2;else{if(g&4)break;ir[x+2]|=4}}}}}function W8(e,t,n,i){for(let r=0,o=i;r<=n.length;r++){let s=r?n[r-1].to:e,l=r<n.length?n[r].from:t;for(let a=s;a<l;){let u=Ne[a];if(u==256){let c=a+1;for(;;)if(c==l){if(r==n.length)break;c=n[r++].to,l=r<n.length?n[r].from:t}else if(Ne[c]==256)c++;else break;let f=o==1,d=(c<t?Ne[c]:i)==1,h=f==d?f?1:2:i;for(let m=c,b=r,x=b?n[b-1].to:e;m>a;){if(m==x)m=n[--b].from,x=b?n[b-1].to:e;Ne[--m]=h}a=c}else o=u,a++}}}function Vy(e,t,n,i,r,o,s){let l=i%2?2:1;if(i%2==r%2)for(let a=t,u=0;a<n;){let c=!0,f=!1;if(u==o.length||a<o[u].from){let b=Ne[a];if(b!=l)c=!1,f=b==16}let d=!c&&l==1?[]:null,h=c?i:i+1,m=a;e:for(;;)if(u<o.length&&m==o[u].from){if(f)break e;let b=o[u];if(!c)for(let x=b.to,g=u+1;;){if(x==n)break e;if(g<o.length&&o[g].from==x)x=o[g++].to;else if(Ne[x]==l)break e;else break}if(u++,d)d.push(b);else{if(b.from>a)s.push(new wi(a,b.from,h));let x=b.direction==Us!=!(h%2);Hy(e,x?i+1:i,r,b.inner,b.from,b.to,s),a=b.to}m=b.to}else if(m==n||(c?Ne[m]!=l:Ne[m]==l))break;else m++;if(d)Vy(e,a,m,i+1,r,d,s);else if(a<m)s.push(new wi(a,m,h));a=m}else for(let a=n,u=o.length;a>t;){let c=!0,f=!1;if(!u||a>o[u-1].to){let b=Ne[a-1];if(b!=l)c=!1,f=b==16}let d=!c&&l==1?[]:null,h=c?i:i+1,m=a;e:for(;;)if(u&&m==o[u-1].to){if(f)break e;let b=o[--u];if(!c)for(let x=b.from,g=u;;){if(x==t)break e;if(g&&o[g-1].to==x)x=o[--g].from;else if(Ne[x-1]==l)break e;else break}if(d)d.push(b);else{if(b.to<a)s.push(new wi(b.to,a,h));let x=b.direction==Us!=!(h%2);Hy(e,x?i+1:i,r,b.inner,b.from,b.to,s),a=b.from}m=b.from}else if(m==t||(c?Ne[m-1]!=l:Ne[m-1]==l))break;else m--;if(d)Vy(e,m,a,i+1,r,d,s);else if(m<a)s.push(new wi(m,a,h));a=m}}function Hy(e,t,n,i,r,o,s){let l=t%2?2:1;G8(e,r,o,i,l),Y8(e,r,o,i,l),W8(r,o,i,l),Vy(e,r,o,t,n,i,s)}function Q8(e,t,n){if(!e)return[new wi(0,0,t==ex?1:0)];if(t==Us&&!n.length&&!X8.test(e))return s2(e.length);if(n.length)while(e.length>Ne.length)Ne[Ne.length]=256;let i=[],r=t==Us?0:1;return Hy(e,r,r,n,0,e.length,i),i}function s2(e){return[new wi(0,e,0)]}var l2="";function J8(e,t,n,i,r){var o;if(!e.length)return null;let s=i.head-e.from,l;if(i.head==e.from&&i.assoc<0){if(!r)return null;s=t[l=0].side(!1,n)}else if(i.head==e.to&&i.assoc>0){if(r)return null;s=t[l=t.length-1].side(!0,n)}else l=wi.find(t,s,(o=i.bidiLevel)!==null&&o!==void 0?o:-1,i.assoc);let a=t[l],u=a.side(r,n);if(s==u){let d=l+=r?1:-1;if(d<0||d>=t.length)return null;a=t[l=d],s=a.side(!r,n),u=a.side(r,n)}let c=yt(e.text,s,a.forward(r,n));if(c<a.from||c>a.to)c=u;l2=e.text.slice(Math.min(s,c),Math.max(s,c));let f=l==(r?t.length-1:0)?null:t[l+(r?1:-1)];if(c==u){if(!f)return r?R.cursor(e.to,1):R.cursor(e.from,-1);if(f.level+(r?0:1)<a.level)return R.cursor(f.side(!r,n)+e.from,f.forward(r,n)?1:-1,f.level)}return R.cursor(c+e.from,a.forward(r,n)?-1:1,a.level)}function Z8(e,t,n){for(let i=t;i<n;i++){let r=r2(e.charCodeAt(i));if(r==1)return Us;if(r==2||r==4)return ex}return Us}var a2=J.define(),u2=J.define(),c2=J.define(),f2=J.define(),Uy=J.define(),d2=J.define(),h2=J.define(),tx=J.define(),nx=J.define(),p2=J.define({combine:(e)=>e.some((t)=>t)}),e6=J.define({combine:(e)=>e.some((t)=>t)}),m2=J.define();class Da{constructor(e,t,n,i,r,o=!1){this.range=e,this.y=t,this.x=n,this.yMargin=i,this.xMargin=r,this.isSnapshot=o}map(e){return e.empty?this:new Da(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 Da(R.cursor(e.doc.length),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}}var wp=ye.define({map:(e,t)=>e.map(t)}),g2=ye.define();function Xt(e,t,n){let i=e.facet(f2);if(i.length)i[0](t);else if(window.onerror&&window.onerror(String(t),n,void 0,void 0,t));else if(n)console.error(n+":",t);else console.error(t)}var Ir=J.define({combine:(e)=>e.length?e[0]:!0}),t6=0,Ta=J.define({combine(e){return e.filter((t,n)=>{for(let i=0;i<n;i++)if(e[i].plugin==t.plugin)return!1;return!0})}});class En{constructor(e,t,n,i,r){this.id=e,this.create=t,this.domEventHandlers=n,this.domEventObservers=i,this.baseExtensions=r(this),this.extension=this.baseExtensions.concat(Ta.of({plugin:this,arg:void 0}))}of(e){return this.baseExtensions.concat(Ta.of({plugin:this,arg:e}))}static define(e,t){let{eventHandlers:n,eventObservers:i,provide:r,decorations:o}=t||{};return new En(t6++,e,n,i,(s)=>{let l=[];if(o)l.push(Up.of((a)=>{let u=a.plugin(s);return u?o(u):Oe.none}));if(r)l.push(r(s));return l})}static fromClass(e,t){return En.define((n,i)=>new e(n,i),t)}}class Rp{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.spec)try{this.value=this.spec.plugin.create(e,this.spec.arg)}catch(t){Xt(e.state,t,"CodeMirror plugin crashed"),this.deactivate()}}else if(this.mustUpdate){let t=this.mustUpdate;if(this.mustUpdate=null,this.value.update)try{this.value.update(t)}catch(n){if(Xt(t.state,n,"CodeMirror plugin crashed"),this.value.destroy)try{this.value.destroy()}catch(i){}this.deactivate()}}return this}destroy(e){var t;if((t=this.value)===null||t===void 0?void 0:t.destroy)try{this.value.destroy()}catch(n){Xt(e.state,n,"CodeMirror plugin crashed")}}deactivate(){this.spec=this.value=null}}var v2=J.define(),ix=J.define(),Up=J.define(),b2=J.define(),rx=J.define(),ef=J.define(),y2=J.define();function kM(e,t){let n=e.state.facet(y2);if(!n.length)return n;let i=n.map((o)=>o instanceof Function?o(e):o),r=[];return ge.spans(i,t.from,t.to,{point(){},span(o,s,l,a){let u=o-t.from,c=s-t.from,f=r;for(let d=l.length-1;d>=0;d--,a--){let h=l[d].spec.bidiIsolate,m;if(h==null)h=Z8(t.text,u,c);if(a>0&&f.length&&(m=f[f.length-1]).to==u&&m.direction==h)m.to=c,f=m.inner;else{let b={from:u,to:c,direction:h,inner:[]};f.push(b),f=b.inner}}}}),r}var x2=J.define();function ox(e){let t=0,n=0,i=0,r=0;for(let o of e.state.facet(x2)){let s=o(e);if(s){if(s.left!=null)t=Math.max(t,s.left);if(s.right!=null)n=Math.max(n,s.right);if(s.top!=null)i=Math.max(i,s.top);if(s.bottom!=null)r=Math.max(r,s.bottom)}}return{left:t,right:n,top:i,bottom:r}}var Hc=J.define();class Xn{constructor(e,t,n,i){this.fromA=e,this.toA=t,this.fromB=n,this.toB=i}join(e){return new Xn(Math.min(this.fromA,e.fromA),Math.max(this.toA,e.toA),Math.min(this.fromB,e.fromB),Math.max(this.toB,e.toB))}addToSet(e){let t=e.length,n=this;for(;t>0;t--){let i=e[t-1];if(i.fromA>n.toA)continue;if(i.toA<n.fromA)break;n=n.join(i),e.splice(t-1,1)}return e.splice(t,0,n),e}static extendWithRanges(e,t){if(t.length==0)return e;let n=[];for(let i=0,r=0,o=0;;){let s=i<e.length?e[i].fromB:1e9,l=r<t.length?t[r]:1e9,a=Math.min(s,l);if(a==1e9)break;let u=a+o,c=a,f=u;for(;;)if(r<t.length&&t[r]<=c){let d=t[r+1];r+=2,c=Math.max(c,d);for(let h=i;h<e.length&&e[h].fromB<=c;h++)o=e[h].toA-e[h].toB;f=Math.max(f,d+o)}else if(i<e.length&&e[i].fromB<=c){let d=e[i++];c=Math.max(c,d.toB),f=Math.max(f,d.toA),o=d.toA-d.toB}else break;n.push(new Xn(u,f,a,c))}return n}}class zp{constructor(e,t,n){this.view=e,this.state=t,this.transactions=n,this.flags=0,this.startState=e.state,this.changes=ot.empty(this.startState.doc.length);for(let r of n)this.changes=this.changes.compose(r.changes);let i=[];this.changes.iterChangedRanges((r,o,s,l)=>i.push(new Xn(r,o,s,l))),this.changedRanges=i}static create(e,t,n){return new zp(e,t,n)}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}}var n6=[];class Ye{constructor(e,t,n=0){this.dom=e,this.length=t,this.flags=n,this.parent=null,e.cmTile=this}get breakAfter(){return this.flags&1}get children(){return n6}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;if(t)I8(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 n=t;for(let i of this.children){if(i==e)return n;n+=i.length+i.breakAfter}throw RangeError("Invalid child in posBefore")}posAfter(e){return this.posBefore(e)+e.length}covers(e){return!0}coordsIn(e,t,n){return null}domPosFor(e,t){let n=zo(this.dom),i=this.length?e>0:t>0;return new xi(this.parent.dom,n+(i?1:0),e==0||e==this.length)}markDirty(e){if(this.flags&=-3,e)this.flags|=4;if(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 nf)return e;return null}static get(e){return e.cmTile}}class tf extends Ye{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,n=null,i,r=(e===null||e===void 0?void 0:e.node)==t?e:null,o=0;for(let s of this.children){if(s.sync(e),o+=s.length+s.breakAfter,i=n?n.nextSibling:t.firstChild,r&&i!=s.dom)r.written=!0;if(s.dom.parentNode==t)while(i&&i!=s.dom)i=_M(i);else t.insertBefore(s.dom,i);n=s.dom}if(i=n?n.nextSibling:t.firstChild,r&&i)r.written=!0;while(i)i=_M(i);this.length=o}}function _M(e){let t=e.nextSibling;return e.parentNode.removeChild(e),t}class nf extends tf{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=Ye.get(e);if(t&&this.owns(t))return t;e=e.parentNode}}blockTiles(e){for(let t=[],n=this,i=0,r=0;;)if(i==n.children.length){if(!t.length)return;if(n=n.parent,n.breakAfter)r++;i=t.pop()}else{let o=n.children[i++];if(o instanceof Vr)t.push(i),n=o,i=0;else{let s=r+o.length,l=e(o,r);if(l!==void 0)return l;r=s+o.breakAfter}}}resolveBlock(e,t){let n,i=-1,r,o=-1;if(this.blockTiles((s,l)=>{let a=l+s.length;if(e>=l&&e<=a){if(s.isWidget()&&t>=-1&&t<=1){if(s.flags&32)return!0;if(s.flags&16)n=void 0}if((l<e||e==a&&(t<-1?s.length:s.covers(1)))&&(!n||!s.isWidget()&&n.isWidget()))n=s,i=e-l;if((a>e||e==l&&(t>1?s.length:s.covers(-1)))&&(!r||!s.isWidget()&&r.isWidget()))r=s,o=e-l}}),!n&&!r)throw Error("No tile at position "+e);return n&&t<0||!r?{tile:n,offset:i}:{tile:r,offset:o}}}class Vr extends tf{constructor(e,t){super(e);this.wrapper=t}isBlock(){return!0}covers(e){if(!this.children.length)return!1;return e<0?this.children[0].covers(-1):this.lastChild.covers(1)}get domAttrs(){return this.wrapper.attributes}static of(e,t){let n=new Vr(t||document.createElement(e.tagName),e);if(!t)n.flags|=4;return n}}class La extends tf{constructor(e,t){super(e);this.attrs=t}isLine(){return!0}static start(e,t,n){let i=new La(t||document.createElement("div"),e);if(!t||!n)i.flags|=4;return i}get domAttrs(){return this.attrs}resolveInline(e,t,n){let i=null,r=-1,o=null,s=-1;function l(u,c){for(let f=0,d=0;f<u.children.length&&d<=c;f++){let h=u.children[f],m=d+h.length;if(m>=c){if(h.isComposite())l(h,c-d);else if((!o||o.isHidden&&(t>0&&!(o.flags&32)||n&&r6(o,h)))&&(m>c||h.flags&32&&t<=1))o=h,s=c-d;else if(d<c||h.flags&16&&!h.isHidden&&t>=-1)i=h,r=c-d}d=m}}l(this,e);let a=(t<0?i:o)||i||o;return a?{tile:a,offset:a==i?r:s}:null}coordsIn(e,t,n){let i=this.resolveInline(e,t,!0);if(!i)return i6(this);return i.tile.coordsIn(Math.max(0,i.offset),t,n)}domIn(e,t){let n=this.resolveInline(e,t);if(n){let{tile:i,offset:r}=n;if(this.dom.contains(i.dom)){if(i.isText())return new xi(i.dom,Math.min(i.dom.nodeValue.length,r));return i.domPosFor(r,i.flags&16?1:i.flags&32?-1:t)}let o=n.tile.parent,s=!1;for(let l of o.children){if(s)return new xi(l.dom,0);if(l==n.tile)s=!0}}return new xi(this.dom,0)}}function i6(e){let t=e.dom.lastChild;if(!t)return e.dom.getBoundingClientRect();let n=Fc(t);return n[n.length-1]||null}function r6(e,t){let n=e.coordsIn(0,1),i=t.coordsIn(0,1);return n&&i&&i.top<n.bottom}class on extends tf{constructor(e,t){super(e);this.mark=t}get domAttrs(){return this.mark.attrs}static of(e,t){let n=new on(t||document.createElement(e.tagName),e);if(!t)n.flags|=4;return n}}class Vs extends Ye{constructor(e,t){super(e,t.length);this.text=t}sync(e){if(this.flags&2)return;if(super.sync(e),this.dom.nodeValue!=this.text){if(e&&e.node==this.dom)e.written=!0;this.dom.nodeValue=this.text}}isText(){return!0}toString(){return JSON.stringify(this.text)}coordsIn(e,t,n){let i=this.dom.nodeValue.length;if(e>i)e=i;let r=e,o=e,s=0;if(e==0&&t<0||e==i&&t>=0){if(!(K.chrome||K.gecko)){if(e)r--,s=1;else if(o<i)o++,s=-1}}else if(t<0)r--;else if(o<i)o++;let l=Wc(this.dom,r,o).getClientRects();if(!l.length)return null;let a=l[(s?s<0:t>=0)?0:l.length-1];if(K.safari&&!s&&a.width==0)a=Array.prototype.find.call(l,(u)=>u.width)||a;return n==null?a:Yc(a,(s?s>0:t<0)==n)}static of(e,t){let n=new Vs(t||document.createTextNode(e),e);if(!t)n.flags|=2;return n}}class js extends Ye{constructor(e,t,n,i){super(e,t,i);this.widget=n}isWidget(){return!0}get isHidden(){return this.widget.isHidden}covers(e){if(this.flags&48)return!1;return(this.flags&(e<0?64:128))>0}coordsIn(e,t){return this.coordsInWidget(e,t,!1)}coordsInWidget(e,t,n){let i=this.widget.coordsAt(this.dom,e,t);if(i)return i;if(n)return Yc(this.dom.getBoundingClientRect(),this.length?e==0:t<=0);else{let r=this.dom.getClientRects(),o=null;if(!r.length)return null;let s=this.flags&16?!0:this.flags&32?!1:e>0;for(let l=s?r.length-1:0;;l+=s?-1:1)if(o=r[l],e>0?l==0:l==r.length-1||o.top<o.bottom)break;return Yc(o,!s)}}get overrideDOMText(){if(!this.length)return de.empty;let{root:e}=this;if(!e)return de.empty;let t=this.posAtStart;return e.view.state.doc.slice(t,t+this.length)}destroy(){super.destroy(),this.widget.destroy(this.dom)}static of(e,t,n,i,r){if(!r){if(r=e.toDOM(t),!e.editable)r.contentEditable="false"}return new js(r,n,e,i)}}class Qc extends Ye{constructor(e){let t=document.createElement("img");t.className="cm-widgetBuffer",t.setAttribute("aria-hidden","true");super(t,0,e)}get isHidden(){return!0}get overrideDOMText(){return de.empty}coordsIn(e,t,n){let i=this.dom.getBoundingClientRect();return n==null?i:Yc(i,t>0==n)}}class w2{constructor(e){this.index=0,this.beforeBreak=!1,this.parents=[],this.tile=e}advance(e,t,n){let{tile:i,index:r,beforeBreak:o,parents:s}=this;while(e||t>0)if(!i.isComposite()){let l=i.length;if(r<l&&e){let a=Math.min(e,l-r);if(n)n.skip(i,r,r+a);e-=a,r+=a}if(r==l)o=!!i.breakAfter,{tile:i,index:r}=s.pop(),r++;else if(!e)break}else if(o){if(!e)break;if(n)n.break();e--,o=!1}else if(r==i.children.length){if(!e&&!s.length)break;if(n)n.leave(i);o=!!i.breakAfter,{tile:i,index:r}=s.pop(),r++}else{let l=i.children[r],a=l.breakAfter;if((t>0?l.length<=e:l.length<e)&&(!n||n.skip(l,0,l.length)!==!1||!l.isComposite))o=!!a,r++,e-=l.length;else if(s.push({tile:i,index:r}),i=l,r=0,n&&l.isComposite())n.enter(l)}return this.tile=i,this.index=r,this.beforeBreak=o,this}get root(){return this.parents.length?this.parents[0].tile:this.tile}}class S2{constructor(e,t,n,i){this.from=e,this.to=t,this.wrapper=n,this.rank=i}}class k2{constructor(e,t,n){this.cache=e,this.root=t,this.blockWrappers=n,this.curLine=null,this.lastBlock=null,this.afterWidget=null,this.pos=0,this.wrappers=[],this.wrapperPos=0}addText(e,t,n,i){var r;this.flushBuffer();let o=this.ensureMarks(t,n),s=o.lastChild;if(s&&s.isText()&&!(s.flags&8)&&s.length+e.length<512){this.cache.reused.set(s,2);let l=o.children[o.children.length-1]=new Vs(s.dom,s.text+e);l.parent=o}else o.append(i||Vs.of(e,(r=this.cache.find(Vs))===null||r===void 0?void 0:r.dom));this.pos+=e.length,this.afterWidget=null}addComposition(e,t){let n=this.curLine;if(n.dom!=t.line.dom)n.setDOM(this.cache.reused.has(t.line)?Ay(t.line.dom):t.line.dom),this.cache.reused.set(t.line,2);let i=n;for(let s=t.marks.length-1;s>=0;s--){let l=t.marks[s],a=i.lastChild;if(a instanceof on&&a.mark.eq(l.mark)){if(a.dom!=l.dom)a.setDOM(Ay(l.dom));i=a}else{let{dom:u}=l;if(this.cache.reused.get(l)){if(Ye.get(l.dom))u=Ay(l.dom)}let c=on.of(l.mark,u);i.append(c),i=c}this.cache.reused.set(l,2)}let r=Ye.get(e.text);if(r)this.cache.reused.set(r,2);let o=new Vs(e.text,e.text.nodeValue);o.flags|=8,this.pos=e.range.toB,i.append(o)}addInlineWidget(e,t,n){let i=this.afterWidget&&e.flags&48&&(this.afterWidget.flags&48)==(e.flags&48);if(!i)this.flushBuffer();let r=this.ensureMarks(t,n);if(!i&&!(e.flags&16))r.append(this.getBuffer(1));r.append(e),this.pos+=e.length,this.afterWidget=e}addMark(e,t,n){this.flushBuffer(),this.ensureMarks(t,n).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 n;if(!e)e=O2;let i=La.start(e,t||((n=this.cache.find(La))===null||n===void 0?void 0:n.dom),!!t);this.getBlockPos().append(this.lastBlock=this.curLine=i)}addLine(e){this.getBlockPos().append(e),this.pos+=e.length,this.lastBlock=e,this.endLine()}addBreak(){this.lastBlock.flags|=1,this.endLine(),this.pos++}addLineStartIfNotCovered(e){if(!this.blockPosCovered())this.addLineStart(e)}ensureLine(e){if(!this.curLine)this.addLineStart(e)}ensureMarks(e,t){var n;let i=this.curLine;for(let r=e.length-1;r>=0;r--){let o=e[r],s;if(t>0&&(s=i.lastChild)&&s instanceof on&&s.mark.eq(o))i=s,t--;else{let l=on.of(o,(n=this.cache.find(on,(a)=>a.mark.eq(o)))===null||n===void 0?void 0:n.dom);i.append(l),i=l,t=0}}return i}endLine(){if(this.curLine){this.flushBuffer();let e=this.curLine.lastChild;if(!e||!CM(this.curLine,!1)||e.dom.nodeName!="BR"&&e.isWidget()&&!(K.ios&&CM(this.curLine,!0)))this.curLine.append(this.cache.findWidget(Ry,0,32)||new js(Ry.toDOM(),0,Ry,32));this.curLine=this.afterWidget=null}}updateBlockWrappers(){if(this.wrapperPos>this.pos+1e4)this.blockWrappers.goto(this.pos),this.wrappers.length=0;for(let e=this.wrappers.length-1;e>=0;e--)if(this.wrappers[e].to<this.pos)this.wrappers.splice(e,1);for(let e=this.blockWrappers;e.value&&e.from<=this.pos;e.next())if(e.to>=this.pos){let t=e.rank*102+e.value.rank,n=new S2(e.from,e.to,e.value,t),i=this.wrappers.length;while(i>0&&(this.wrappers[i-1].rank-n.rank||this.wrappers[i-1].to-n.to)<0)i--;this.wrappers.splice(i,0,n)}this.wrapperPos=this.pos}getBlockPos(){var e;this.updateBlockWrappers();let t=this.root;for(let n of this.wrappers){let i=t.lastChild;if(n.from<this.pos&&i instanceof Vr&&i.wrapper.eq(n.wrapper))t=i;else{let r=Vr.of(n.wrapper,(e=this.cache.find(Vr,(o)=>o.wrapper.eq(n.wrapper)))===null||e===void 0?void 0:e.dom);t.append(r),t=r}}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),n=this.cache.find(Qc,void 0,1);if(n)n.flags=t;return n||new Qc(t)}flushBuffer(){if(this.afterWidget&&!(this.afterWidget.flags&32))this.afterWidget.parent.append(this.getBuffer(-1)),this.afterWidget=null}}class _2{constructor(e){this.skipCount=0,this.text="",this.textOff=0,this.cursor=e.iter()}skip(e){if(this.textOff+e<=this.text.length)this.textOff+=e;else this.skipCount+=e-(this.text.length-this.textOff),this.text="",this.textOff=0}next(e){if(this.textOff==this.text.length){let{value:i,lineBreak:r,done:o}=this.cursor.next(this.skipCount);if(this.skipCount=0,o)throw Error("Ran out of text content when drawing inline views");this.text=i;let s=this.textOff=Math.min(e,i.length);return r?null:i.slice(0,s)}let t=Math.min(this.text.length,this.textOff+e),n=this.text.slice(this.textOff,t);return this.textOff=t,n}}var Bp=[js,La,Vs,on,Qc,Vr,nf];for(let e=0;e<Bp.length;e++)Bp[e].bucket=e;class C2{constructor(e){this.view=e,this.buckets=Bp.map(()=>[]),this.index=Bp.map(()=>0),this.reused=new Map}add(e){let t=e.constructor.bucket,n=this.buckets[t];if(n.length<6)n.push(e);else n[this.index[t]=(this.index[t]+1)%6]=e}find(e,t,n=2){let i=e.bucket,r=this.buckets[i],o=this.index[i];for(let s=0;s<r.length;s++){let l=(s+o)%r.length,a=r[l];if((!t||t(a))&&!this.reused.has(a)){if(r.splice(l,1),l<o)this.index[i]--;return this.reused.set(a,n),a}}return null}findWidget(e,t,n){let i=this.buckets[0];if(i.length)for(let r=0,o=0;;r++){if(r==i.length){if(o)return null;o=1,r=0}let s=i[r];if(!this.reused.has(s)&&(o==0?s.widget.compare(e):s.widget.constructor==e.constructor&&e.updateDOM(s.dom,this.view,s.widget))){if(i.splice(r,1),r<this.index[0])this.index[0]--;if(s.widget==e&&s.length==t&&(s.flags&497)==n)return this.reused.set(s,1),s;else return this.reused.set(s,2),new js(s.dom,t,e,s.flags&-498|n)}}}reuse(e){return this.reused.set(e,1),e}maybeReuse(e,t=2){if(this.reused.has(e))return;return this.reused.set(e,t),e.dom}clear(){for(let e=0;e<this.buckets.length;e++)this.buckets[e].length=this.index[e]=0}}class E2{constructor(e,t,n,i,r){this.view=e,this.decorations=i,this.disallowBlockEffectsFor=r,this.openWidget=!1,this.openMarks=0,this.cache=new C2(e),this.text=new _2(e.state.doc),this.builder=new k2(this.cache,new nf(e,e.contentDOM),ge.iter(n)),this.cache.reused.set(t,2),this.old=new w2(t),this.reuseWalker={skip:(o,s,l)=>{if(this.cache.add(o),o.isComposite())return!1},enter:(o)=>this.cache.add(o),leave:()=>{},break:()=>{}}}run(e,t){let n=t&&this.getCompositionContext(t.text);for(let i=0,r=0,o=0;;){let s=o<e.length?e[o++]:null,l=s?s.fromA:this.old.root.length;if(l>i){let a=l-i;this.preserve(a,!o,!s),i=l,r+=a}if(!s)break;if(t&&s.fromA<=t.range.fromA&&s.toA>=t.range.toA)this.forward(s.fromA,t.range.fromA,t.range.fromA<t.range.toA?1:-1),this.emit(r,t.range.fromB),this.builder.flushBuffer(),this.cache.clear(),this.builder.addComposition(t,n),this.text.skip(t.range.toB-t.range.fromB),this.forward(t.range.fromA,s.toA),this.emit(t.range.toB,s.toB);else this.forward(s.fromA,s.toA),this.emit(r,s.toB);r=s.toB,i=s.toA}if(this.builder.curLine)this.builder.endLine();return this.builder.root}preserve(e,t,n){let i=l6(this.old),r=this.openMarks;this.old.advance(e,n?1:-1,{skip:(o,s,l)=>{if(o.isWidget())if(this.openWidget)this.builder.continueWidget(l-s);else{let a=l>0||s<o.length?js.of(o.widget,this.view,l-s,o.flags&496,this.cache.maybeReuse(o)):this.cache.reuse(o);if(a.flags&256)a.flags&=-2,this.builder.addBlockWidget(a);else this.builder.ensureLine(null),this.builder.addInlineWidget(a,i,r),r=i.length}else if(o.isText()){if(this.builder.ensureLine(null),!s&&l==o.length&&!this.cache.reused.has(o))this.builder.addText(o.text,i,r,this.cache.reuse(o));else this.cache.add(o),this.builder.addText(o.text.slice(s,l),i,r);r=i.length}else if(o.isLine())o.flags&=-2,this.cache.reused.set(o,1),this.builder.addLine(o);else if(o instanceof Qc)this.cache.add(o);else if(o instanceof on)this.builder.ensureLine(null),this.builder.addMark(o,i,r),this.cache.reused.set(o,1),r=i.length;else return!1;this.openWidget=!1},enter:(o)=>{if(o.isLine())this.builder.addLineStart(o.attrs,this.cache.maybeReuse(o));else if(this.cache.add(o),o instanceof on)i.unshift(o.mark);this.openWidget=!1},leave:(o)=>{if(o.isLine()){if(i.length)i.length=r=0}else if(o instanceof on)i.shift(),r=Math.min(r,i.length)},break:()=>{this.builder.addBreak(),this.openWidget=!1}}),this.text.skip(e)}emit(e,t){let n=null,i=this.builder,r=-1,o=ge.spans(this.decorations,e,t,{point:(s,l,a,u,c,f)=>{if(a instanceof Hs){if(this.disallowBlockEffectsFor[f]){if(a.block)throw RangeError("Block decorations may not be specified via plugins");if(l>this.view.state.doc.lineAt(s).to)throw RangeError("Decorations that replace line breaks may not be specified via plugins")}if(r=u.length,c>u.length)i.continueWidget(l-s);else{let d=a.widget||(a.block?Ks.block:Ks.inline),h=o6(a),m=this.cache.findWidget(d,l-s,h)||js.of(d,this.view,l-s,h);if(a.block){if(a.startSide>0)i.addLineStartIfNotCovered(n);i.addBlockWidget(m)}else i.ensureLine(n),i.addInlineWidget(m,u,c)}n=null}else n=s6(n,a);if(l>s)this.text.skip(l-s)},span:(s,l,a,u)=>{for(let c=s;c<l;){let f=this.text.next(Math.min(512,l-c));if(f==null)i.addLineStartIfNotCovered(n),i.addBreak(),c++;else i.ensureLine(n),i.addText(f,a,c==s?u:a.length),c+=f.length;n=null}r=a.length}});if(r>-1)this.openWidget=o>r;if(!this.openWidget)i.addLineStartIfNotCovered(n);this.openMarks=o}forward(e,t,n=1){if(t-e<=10)this.old.advance(t-e,n,this.reuseWalker);else this.old.advance(5,-1,this.reuseWalker),this.old.advance(t-e-10,-1),this.old.advance(5,n,this.reuseWalker)}getCompositionContext(e){let t=[],n=null;for(let i=e.parentNode;;i=i.parentNode){let r=Ye.get(i);if(i==this.view.contentDOM)break;if(r instanceof on)t.push(r);else if(r===null||r===void 0?void 0:r.isLine())n=r;else if(r instanceof Vr);else if(i.nodeName=="DIV"&&!n)n=new La(i,O2);else if(!n)t.push(on.of(new Jc({tagName:i.nodeName.toLowerCase(),attributes:V8(i)}),i))}if(!n)return null;return{line:n,marks:t}}}function CM(e,t){let n=(i)=>{for(let r of i.children)if((t?r.isText():r.length)||n(r))return!0;return!1};return n(e)}function o6(e){let t=e.isReplace?(e.startSide<0?64:0)|(e.endSide>0?128:0):e.startSide>0?32:16;if(e.block)t|=256;return t}var O2={class:"cm-line"};function s6(e,t){let n=t.spec.attributes,i=t.spec.class;if(!n&&!i)return e;if(!e)e={class:"cm-line"};if(n)Jy(n,e);if(i)e.class+=" "+i;return e}function l6(e){let t=[];for(let n=e.parents.length;n>1;n--){let i=n==e.parents.length?e.tile:e.parents[n].tile;if(i instanceof on)t.push(i.mark)}return t}function Ay(e){let t=Ye.get(e);if(t)t.setDOM(e.cloneNode());return e}class Ks extends Po{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}}Ks.inline=new Ks("span");Ks.block=new Ks("div");var Ry=new class extends Po{toDOM(){return document.createElement("br")}get isHidden(){return!0}get editable(){return!0}};class jy{constructor(e){this.view=e,this.decorations=[],this.blockWrappers=[],this.dynamicDecorationMap=[!1],this.domChanged=null,this.hasComposition=null,this.editContextFormatting=Oe.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 nf(e,e.contentDOM),this.updateInner([new Xn(0,0,0,e.state.doc.length)],null)}update(e){var t;let n=e.changedRanges;if(this.minWidth>0&&n.length)if(!n.every(({fromA:u,toA:c})=>c<this.minWidthFrom||u>this.minWidthTo))this.minWidth=this.minWidthFrom=this.minWidthTo=0;else this.minWidthFrom=e.changes.mapPos(this.minWidthFrom,1),this.minWidthTo=e.changes.mapPos(this.minWidthTo,1);this.updateEditContextFormatting(e);let i=-1;if(this.view.inputState.composing>=0&&!this.view.observer.editContext){if((t=this.domChanged)===null||t===void 0?void 0:t.newSel)i=this.domChanged.newSel.head;else if(!m6(e.changes,this.hasComposition)&&!e.selectionSet)i=e.state.selection.main.head}let r=i>-1?u6(this.view,e.changes,i):null;if(this.domChanged=null,this.hasComposition){let{from:u,to:c}=this.hasComposition;n=new Xn(u,c,e.changes.mapPos(u,-1),e.changes.mapPos(c,1)).addToSet(n.slice())}if(this.hasComposition=r?{from:r.range.fromB,to:r.range.toB}:null,(K.ie||K.chrome)&&!r&&e&&e.state.doc.lines!=e.startState.doc.lines)this.forceSelection=!0;let o=this.decorations,s=this.blockWrappers;this.updateDeco();let l=d6(o,this.decorations,e.changes);if(l.length)n=Xn.extendWithRanges(n,l);let a=h6(s,this.blockWrappers,e.changes);if(a.length)n=Xn.extendWithRanges(n,a);if(r&&!n.some((u)=>u.fromA<=r.range.fromA&&u.toA>=r.range.toA))n=r.range.addToSet(n.slice());if(this.tile.flags&2&&n.length==0)return!1;else{if(this.updateInner(n,r),e.transactions.length)this.lastUpdate=Date.now();return!0}}updateInner(e,t){this.view.viewState.mustMeasureContent=!0;let{observer:n}=this.view;n.ignore(()=>{if(t||e.length){let o=this.tile,s=new E2(this.view,o,this.blockWrappers,this.decorations,this.dynamicDecorationMap);if(t&&Ye.get(t.text))s.cache.reused.set(Ye.get(t.text),2);this.tile=s.run(e,t),Ky(o,s.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 r=K.chrome||K.ios?{node:n.selectionRange.focusNode,written:!1}:void 0;if(this.tile.sync(r),r&&(r.written||n.selectionRange.focusNode!=r.node||!this.tile.dom.contains(r.node)))this.forceSelection=!0;this.tile.dom.style.height=""});let i=[];if(this.view.viewport.from||this.view.viewport.to<this.view.state.doc.length){for(let r of this.tile.children)if(r.isWidget()&&r.widget instanceof Tp)i.push(r.dom)}n.updateGaps(i)}updateEditContextFormatting(e){this.editContextFormatting=this.editContextFormatting.map(e.changes);for(let t of e.transactions)for(let n of t.effects)if(n.is(g2))this.editContextFormatting=n.value}updateSelection(e=!1,t=!1){if(e||!this.view.observer.selectionRange.focusNode)this.view.observer.readSelectionRange();let{dom:n}=this.tile,i=this.view.root.activeElement,r=i==n,o=!r&&!(this.view.state.facet(Ir)||n.tabIndex>-1)&&Kc(n,this.view.observer.selectionRange)&&!(i&&n.contains(i));if(!(r||t||o))return;let s=this.forceSelection;this.forceSelection=!1;let l=this.view.state.selection.main,a,u;if(l.empty)u=a=this.inlineDOMNearPos(l.anchor,l.assoc||1);else u=this.inlineDOMNearPos(l.head,l.head==l.from?1:-1),a=this.inlineDOMNearPos(l.anchor,l.anchor==l.from?1:-1);if(K.gecko&&l.empty&&!this.hasComposition&&a6(a)){let f=document.createTextNode("");this.view.observer.ignore(()=>a.node.insertBefore(f,a.node.childNodes[a.offset]||null)),a=u=new xi(f,0),s=!0}let c=this.view.observer.selectionRange;if(s||!c.focusNode||(!qc(a.node,a.offset,c.anchorNode,c.anchorOffset)||!qc(u.node,u.offset,c.focusNode,c.focusOffset))&&!this.suppressWidgetCursorChange(c,l))this.view.observer.ignore(()=>{if(K.android&&K.chrome&&n.contains(c.focusNode)&&p6(c.focusNode,n))n.blur(),n.focus({preventScroll:!0});let f=Gc(this.view.root);if(!f);else if(l.empty){if(K.gecko){let d=c6(a.node,a.offset);if(d&&d!=3){let h=(d==1?t2:n2)(a.node,a.offset);if(h)a=new xi(h.node,h.offset)}}if(f.collapse(a.node,a.offset),l.bidiLevel!=null&&f.caretBidiLevel!==void 0)f.caretBidiLevel=l.bidiLevel}else if(f.extend){f.collapse(a.node,a.offset);try{f.extend(u.node,u.offset)}catch(d){}}else{let d=document.createRange();if(l.anchor>l.head)[a,u]=[u,a];d.setEnd(u.node,u.offset),d.setStart(a.node,a.offset),f.removeAllRanges(),f.addRange(d)}if(o&&this.view.root.activeElement==n){if(n.blur(),i)i.focus()}}),this.view.observer.setSelectionRange(a,u);this.impreciseAnchor=a.precise?null:new xi(c.anchorNode,c.anchorOffset),this.impreciseHead=u.precise?null:new xi(c.focusNode,c.focusOffset)}suppressWidgetCursorChange(e,t){return this.hasComposition&&t.empty&&qc(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,n=Gc(e.root),{anchorNode:i,anchorOffset:r}=e.observer.selectionRange;if(!n||!t.empty||!t.assoc||!n.modify)return;let o=this.lineAt(t.head,t.assoc);if(!o)return;let s=o.posAtStart;if(t.head==s||t.head==s+o.length)return;let l=this.coordsAt(t.head,-1),a=this.coordsAt(t.head,1);if(!l||!a||l.bottom>a.top)return;let u=this.domAtPos(t.head+t.assoc,t.assoc);n.collapse(u.node,u.offset),n.modify("move",t.assoc<0?"forward":"backward","lineboundary"),e.observer.readSelectionRange();let c=e.observer.selectionRange;if(e.docView.posFromDOM(c.anchorNode,c.anchorOffset)!=t.from)n.collapse(i,r)}posFromDOM(e,t){let n=this.tile.nearest(e);if(!n)return this.tile.dom.compareDocumentPosition(e)&2?0:this.view.state.doc.length;let i=n.posAtStart;if(n.isComposite()){let r;if(e==n.dom)r=n.dom.childNodes[t];else{let o=Hr(e)==0?0:t==0?-1:1;for(;;){let s=e.parentNode;if(s==n.dom)break;if(o==0&&s.firstChild!=s.lastChild)if(e==s.firstChild)o=-1;else o=1;e=s}if(o<0)r=e;else r=e.nextSibling}if(r==n.dom.firstChild)return i;while(r&&!Ye.get(r))r=r.nextSibling;if(!r)return i+n.length;for(let o=0,s=i;;o++){let l=n.children[o];if(l.dom==r)return s;s+=l.length+l.breakAfter}}else if(n.isText())return e==n.dom?i+t:i+(t?n.length:0);else return i}domAtPos(e,t){let{tile:n,offset:i}=this.tile.resolveBlock(e,t);if(n.isWidget())return n.domPosFor(i,t);return n.domIn(i,t)}inlineDOMNearPos(e,t){let n,i=-1,r=!1,o,s=-1,l=!1;if(this.tile.blockTiles((a,u)=>{if(a.isWidget()){if(a.flags&32&&u>=e)return!0;if(a.flags&16)r=!0}else{let c=u+a.length;if(u<=e)n=a,i=e-u,r=c<e;if(c>=e&&!o)o=a,s=e-u,l=u>e;if(u>e&&o)return!0}}),!n&&!o)return this.domAtPos(e,t);if(r&&o)n=null;else if(l&&n)o=null;return n&&t<0||!o?n.domIn(i,t):o.domIn(s,t)}coordsAt(e,t,n){let{tile:i,offset:r}=this.tile.resolveBlock(e,t);if(i.isWidget()){if(i.widget instanceof Tp)return null;return i.coordsInWidget(r,t,!0)}return i.coordsIn(r,t,n)}lineAt(e,t){let{tile:n}=this.tile.resolveBlock(e,t);return n.isLine()?n:null}coordsForChar(e){let{tile:t,offset:n}=this.tile.resolveBlock(e,1);if(!t.isLine())return null;function i(r,o){if(r.isComposite())for(let s of r.children){if(s.length>=o){let l=i(s,o);if(l)return l}if(o-=s.length,o<0)break}else if(r.isText()&&o<r.length){let s=yt(r.text,o);if(s==o)return null;let l=Wc(r.dom,o,s).getClientRects();for(let a=0;a<l.length;a++){let u=l[a];if(a==l.length-1||u.top<u.bottom&&u.left<u.right)return u}}return null}return i(t,n)}measureVisibleLineHeights(e){let t=[],{from:n,to:i}=e,r=this.view.contentDOM.clientWidth,o=r>Math.max(this.view.scrollDOM.clientWidth,this.minWidth)+1,s=-1,l=this.view.textDirection==je.LTR,a=0,u=(c,f,d)=>{for(let h=0;h<c.children.length;h++){if(f>i)break;let m=c.children[h],b=f+m.length,x=m.dom.getBoundingClientRect(),{height:g}=x;if(d&&!h)a+=x.top-d.top;if(m instanceof Vr){if(b>n)u(m,f,x)}else if(f>=n){if(a>0)t.push(-a);if(t.push(g+a),a=0,o){let v=m.dom.lastChild,w=v?Fc(v):[];if(w.length){let S=w[w.length-1],k=l?S.right-x.left:x.right-S.left;if(k>s)s=k,this.minWidth=r,this.minWidthFrom=f,this.minWidthTo=b}}}if(d&&h==c.children.length-1)a+=d.bottom-x.bottom;f=b+m.breakAfter}};return u(this.tile,0,null),t}textDirectionAt(e){let{tile:t}=this.tile.resolveBlock(e,1);return getComputedStyle(t.dom).direction=="rtl"?je.RTL:je.LTR}measureTextSize(){let e=this.tile.blockTiles((o)=>{if(o.isLine()&&o.children.length&&o.length<=20){let s=0,l;for(let a of o.children){if(!a.isText()||/[^ -~]/.test(a.text))return;let u=Fc(a.dom);if(u.length!=1)return;s+=u[0].width,l=u[0].height}if(s)return{lineHeight:o.dom.getBoundingClientRect().height,charWidth:s/o.length,textHeight:l}}});if(e)return e;let t=document.createElement("div"),n,i,r;return t.className="cm-line",t.style.width="99999px",t.style.position="absolute",t.textContent="abc def ghi jkl mno pqr stu",this.view.observer.ignore(()=>{this.tile.dom.appendChild(t);let o=Fc(t.firstChild)[0];n=t.getBoundingClientRect().height,i=o&&o.width?o.width/27:7,r=o&&o.height?o.height:n,t.remove()}),{lineHeight:n,charWidth:i,textHeight:r}}computeBlockGapDeco(){let e=[],t=this.view.viewState;for(let n=0,i=0;;i++){let r=i==t.viewports.length?null:t.viewports[i],o=r?r.from-1:this.view.state.doc.length;if(o>n){let s=(t.lineBlockAt(o).bottom-t.lineBlockAt(n).top)/this.view.scaleY;e.push(Oe.replace({widget:new Tp(s),block:!0,inclusive:!0,isBlockGap:!0}).range(n,o))}if(!r)break;n=r.to+1}return Oe.set(e)}updateDeco(){let e=1,t=this.view.state.facet(Up).map((r)=>(this.dynamicDecorationMap[e++]=typeof r=="function")?r(this.view):r),n=!1,i=this.view.state.facet(rx).map((r,o)=>{let s=typeof r=="function";if(s)n=!0;return s?r(this.view):r});if(i.length)this.dynamicDecorationMap[e++]=n,t.push(ge.join(i));this.decorations=[this.editContextFormatting,...t,this.computeBlockGapDeco(),this.view.viewState.lineGapDeco];while(e<this.decorations.length)this.dynamicDecorationMap[e++]=!1;this.blockWrappers=this.view.state.facet(b2).map((r)=>typeof r=="function"?r(this.view):r)}scrollIntoView(e){if(e.isSnapshot){let a=this.view.viewState.lineBlockAt(e.range.head);this.view.scrollDOM.scrollTop=a.top-e.yMargin,this.view.scrollDOM.scrollLeft=e.xMargin;return}for(let a of this.view.state.facet(m2))try{if(a(this.view,e.range,e))return!0}catch(u){Xt(this.view.state,u,"scroll handler")}let{range:t}=e,n=this.coordsAt(t.head,t.assoc||(t.head>t.anchor?-1:1)),i;if(!n)return;if(!t.empty&&(i=this.coordsAt(t.anchor,t.anchor>t.head?-1:1)))n={left:Math.min(n.left,i.left),top:Math.min(n.top,i.top),right:Math.max(n.right,i.right),bottom:Math.max(n.bottom,i.bottom)};let r=ox(this.view),o={left:n.left-r.left,top:n.top-r.top,right:n.right+r.right,bottom:n.bottom+r.bottom},{offsetWidth:s,offsetHeight:l}=this.view.scrollDOM;if(j8(this.view.scrollDOM,o,t.head<t.anchor?-1:1,e.x,e.y,Math.max(Math.min(e.xMargin,s),-s),Math.max(Math.min(e.yMargin,l),-l),this.view.textDirection==je.LTR),window.visualViewport&&window.innerHeight-window.visualViewport.height>1&&(n.top>window.visualViewport.offsetTop+window.visualViewport.height||n.bottom<window.visualViewport.offsetTop)){let a=this.view.docView.lineAt(t.head,1);if(a){let u=QM(a.dom);a.dom.scrollIntoView({block:"nearest"}),JM(u,!1)}}}lineHasWidget(e){let t=(n)=>n.isWidget()||n.children.some(t);return t(this.tile.resolveBlock(e,1).tile)}destroy(){Ky(this.tile)}}function Ky(e,t){let n=t===null||t===void 0?void 0:t.get(e);if(n!=1){if(n==null)e.destroy();for(let i of e.children)Ky(i,t)}}function a6(e){return e.node.nodeType==1&&e.node.firstChild&&(e.offset==0||e.node.childNodes[e.offset-1].contentEditable=="false")&&(e.offset==e.node.childNodes.length||e.node.childNodes[e.offset].contentEditable=="false")}function A2(e,t){let n=e.observer.selectionRange;if(!n.focusNode)return null;let i=t2(n.focusNode,n.focusOffset),r=n2(n.focusNode,n.focusOffset),o=i||r;if(r&&i&&r.node!=i.node){let l=Ye.get(r.node);if(!l||l.isText()&&l.text!=r.node.nodeValue)o=r;else if(e.docView.lastCompositionAfterCursor){let a=Ye.get(i.node);if(!(!a||a.isText()&&a.text!=i.node.nodeValue))o=r}}if(e.docView.lastCompositionAfterCursor=o!=i,!o)return null;let s=t-o.offset;return{from:s,to:s+o.node.nodeValue.length,node:o.node}}function u6(e,t,n){let i=A2(e,n);if(!i)return null;let{node:r,from:o,to:s}=i,l=r.nodeValue;if(/[\n\r]/.test(l))return null;if(e.state.doc.sliceString(i.from,i.to)!=l)return null;let a=t.invertedDesc;return{range:new Xn(a.mapPos(o),a.mapPos(s),o,s),text:r}}function c6(e,t){if(e.nodeType!=1)return 0;return(t&&e.childNodes[t-1].contentEditable=="false"?1:0)|(t<e.childNodes.length&&e.childNodes[t].contentEditable=="false"?2:0)}var f6=class{constructor(){this.changes=[]}compareRange(t,n){Ma(t,n,this.changes)}comparePoint(t,n){Ma(t,n,this.changes)}boundChange(t){Ma(t,t,this.changes)}};function d6(e,t,n){let i=new f6;return ge.compare(e,t,n,i),i.changes}class R2{constructor(){this.changes=[]}compareRange(e,t){Ma(e,t,this.changes)}comparePoint(){}boundChange(e){Ma(e,e,this.changes)}}function h6(e,t,n){let i=new R2;return ge.compare(e,t,n,i),i.changes}function p6(e,t){for(let n=e;n&&n!=t;n=n.assignedSlot||n.parentNode)if(n.nodeType==1&&n.contentEditable=="false")return!0;return!1}function m6(e,t){let n=!1;if(t)e.iterChangedRanges((i,r)=>{if(i<t.to&&r>t.from)n=!0});return n}class Tp extends Po{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 g6(e,t,n=1){let i=e.charCategorizer(t),r=e.doc.lineAt(t),o=t-r.from;if(r.length==0)return R.cursor(t);if(o==0)n=1;else if(o==r.length)n=-1;let s=o,l=o;if(n<0)s=yt(r.text,o,!1);else l=yt(r.text,o);let a=i(r.text.slice(s,l));while(s>0){let u=yt(r.text,s,!1);if(i(r.text.slice(u,s))!=a)break;s=u}while(l<r.length){let u=yt(r.text,l);if(i(r.text.slice(l,u))!=a)break;l=u}return R.undirectionalRange(s+r.from,l+r.from)}function v6(e,t,n,i,r){let o=Math.round((i-t.left)*e.defaultCharacterWidth);if(e.lineWrapping&&n.height>e.defaultLineHeight*1.5){let l=e.viewState.heightOracle.textHeight,a=Math.floor((r-n.top-(e.defaultLineHeight-l)*0.5)/l);o+=a*e.viewState.heightOracle.lineLength}let s=e.state.sliceDoc(n.from,n.to);return n.from+fM(s,o,e.state.tabSize)}function b6(e,t,n){let i=e.lineBlockAt(t);if(Array.isArray(i.type)){let r;for(let o of i.type){if(o.from>t)break;if(o.to<t)continue;if(o.from<t&&o.to>t)return o;if(!r||o.type==Gn.Text&&(r.type!=o.type||(n<0?o.from<t:o.to>t)))r=o}return r||i}return i}function y6(e,t,n,i){let r=b6(e,t.head,t.assoc||-1),o=!i||r.type!=Gn.Text||!(e.lineWrapping||r.widgetLineBreaks)?null:e.coordsAtPos(t.assoc<0&&t.head>r.from?t.head-1:t.head);if(o){let s=e.dom.getBoundingClientRect(),l=e.textDirectionAt(r.from),a=e.posAtCoords({x:n==(l==je.LTR)?s.right-1:s.left+1,y:(o.top+o.bottom)/2});if(a!=null)return R.cursor(a,n?-1:1)}return R.cursor(n?r.to:r.from,n?-1:1)}function EM(e,t,n,i){let r=e.state.doc.lineAt(t.head),o=e.bidiSpans(r),s=e.textDirectionAt(r.from);for(let l=t,a=null;;){let u=J8(r,o,s,l,n),c=l2;if(!u){if(r.number==(n?e.state.doc.lines:1))return l;c=`
31
- `,r=e.state.doc.line(r.number+(n?1:-1)),o=e.bidiSpans(r),u=n?R.cursor(r.from,-1):R.cursor(r.to,1)}if(!a){if(!i)return u;a=i(c)}else if(!a(c))return l;l=u}}function x6(e,t,n){let i=e.state.charCategorizer(t),r=i(n);return(o)=>{let s=i(o);if(r==$n.Space)r=s;return r==s}}function w6(e,t,n,i){let r=t.head,o=n?1:-1;if(r==(n?e.state.doc.length:0))return R.cursor(r,t.assoc);let s=t.goalColumn,l,a=e.contentDOM.getBoundingClientRect(),u=e.coordsAtPos(r,t.assoc||((t.empty?n:t.head==t.from)?1:-1)),c=e.documentTop;if(u){if(s==null)s=u.left-a.left;l=o<0?u.top:u.bottom}else{let m=e.viewState.lineBlockAt(r);if(s==null)s=Math.min(a.right-a.left,e.defaultCharacterWidth*(r-m.from));l=(o<0?m.top:m.bottom)+c}let f=a.left+s,d=e.viewState.heightOracle.textHeight>>1,h=i!==null&&i!==void 0?i:d;for(let m=0;;m+=d){let b=l+(h+m)*o,x=Fy(e,{x:f,y:b},!1,o);if(n?b>a.bottom:b<a.top)return R.cursor(x.pos,x.assoc);let g=e.coordsAtPos(x.pos,x.assoc),v=g?(g.top+g.bottom)/2:0;if(!g||(n?v>l:v<l))return R.cursor(x.pos,x.assoc,void 0,s)}}function $c(e,t,n){for(;;){let i=0;for(let r of e)r.between(t-1,t+1,(o,s,l)=>{if(t>o&&t<s){let a=i||n||(t-o<s-t?-1:1);t=a<0?o:s,i=a}});if(!i)return t}}function T2(e,t){let n=null;for(let i=0;i<t.ranges.length;i++){let r=t.ranges[i],o=null;if(r.empty){let s=$c(e,r.from,0);if(s!=r.from)o=R.cursor(s,-1)}else{let s=$c(e,r.from,-1),l=$c(e,r.to,1);if(s!=r.from||l!=r.to)if(r.undirectional)o=R.undirectionalRange(r.from,r.to);else o=R.range(r.from==r.anchor?s:l,r.from==r.head?s:l)}if(o){if(!n)n=t.ranges.slice();n[i]=o}}return n?R.create(n,t.mainIndex):t}function Ty(e,t,n){let i=$c(e.state.facet(ef).map((r)=>r(e)),n.from,t.head>n.from?-1:1);return i==n.from?n:R.cursor(i,i<n.from?1:-1)}class bi{constructor(e,t){this.pos=e,this.assoc=t}}function Fy(e,t,n,i){let r=e.contentDOM.getBoundingClientRect(),o=r.top+e.viewState.paddingTop,{x:s,y:l}=t,a=l-o,u;for(;;){if(a<0)return new bi(0,1);if(a>e.viewState.docHeight)return new bi(e.state.doc.length,-1);if(u=e.elementAtHeight(a),i==null)break;if(u.type==Gn.Text){if(i<0?u.to<e.viewport.from:u.from>e.viewport.to)break;let d=e.docView.coordsAt(i<0?u.from:u.to,i>0?-1:1);if(d&&(i<0?d.top<=a+o:d.bottom>=a+o))break}let f=e.viewState.heightOracle.textHeight/2;a=i>0?u.bottom+f:u.top-f}if(e.viewport.from>=u.to||e.viewport.to<=u.from){if(n)return null;if(u.type==Gn.Text){let f=v6(e,r,u,s,l);return new bi(f,f==u.from?1:-1)}}if(u.type!=Gn.Text)return a<(u.top+u.bottom)/2?new bi(u.from,1):new bi(u.to,-1);let c=e.docView.lineAt(u.from,2);if(!c||c.length!=u.length)c=e.docView.lineAt(u.from,-2);return new M2(e,s,l,e.textDirectionAt(u.from)).scanTile(c,u.from)}class M2{constructor(e,t,n,i){this.view=e,this.x=t,this.y=n,this.baseDir=i,this.line=null,this.spans=null}bidiSpansAt(e){if(!this.line||this.line.from>e||this.line.to<e)this.line=this.view.state.doc.lineAt(e),this.spans=this.view.bidiSpans(this.line);return this}baseDirAt(e,t){let{line:n,spans:i}=this.bidiSpansAt(e);return i[wi.find(i,e-n.from,-1,t)].level==this.baseDir}dirAt(e,t){let{line:n,spans:i}=this.bidiSpansAt(e);return i[wi.find(i,e-n.from,-1,t)].dir}bidiIn(e,t){let{spans:n,line:i}=this.bidiSpansAt(e);return n.length>1||n.length&&(n[0].level!=this.baseDir||n[0].to+i.from<t)}scan(e,t,n=!1){let i=0,r=e.length-1,o=new Set,s=this.bidiIn(e[0],e[r]),l,a,u=-1,c=1e9,f;e:while(i<r){let h=r-i,m=i+r>>1;t:if(o.has(m)){for(let g=1;g<h;g++){let v=m+g;if(v>=r)v-=h;if(!o.has(v)){m=v;break t}}break e}o.add(m);let b=t(m),x=0;if(b)for(let g=0;g<b.length;g++){let v=b[g];if(v.width==0&&b.length>1)continue;if(v.bottom<this.y){if(!l||l.bottom<v.bottom)l=v;x=1}else if(v.top>this.y){if(!a||a.top>v.top)a=v;x=-1}else{let w=v.left>this.x?this.x-v.left:v.right<this.x?this.x-v.right:0,S=Math.abs(w);if(S<c)u=m,c=S,f=v;if(w)x=w<0==(this.baseDir==je.LTR)?-1:1}}if(x==-1&&(!s||this.baseDirAt(e[m],1)))r=m;else if(x==1&&(!s||this.baseDirAt(e[m+1],-1)))i=m+1}if(!f){if(!a&&!l)return{i:0,after:!1};let h=l&&(!a||this.y-l.bottom<a.top-this.y)?l:a;return this.y=(h.top+h.bottom)/2,this.scan(e,t,!0)}if(c&&!n){let{top:h,bottom:m}=f;if(l&&l.bottom>(h+h+m)/3)return this.y=l.bottom-1,this.scan(e,t,!0);if(a&&a.top<(h+m+m)/3)return this.y=a.top+1,this.scan(e,t,!0)}let d=(s?this.dirAt(e[u],1):this.baseDir)==je.LTR;return{i:u,after:this.x>(f.left+f.right)/2==d}}scanText(e,t){let n=[];for(let r=0;r<e.length;r=yt(e.text,r))n.push(t+r);n.push(t+e.length);let i=this.scan(n,(r)=>{let o=n[r]-t,s=n[r+1]-t;return Wc(e.dom,o,s).getClientRects()});return i.after?new bi(n[i.i+1],-1):new bi(n[i.i],1)}scanTile(e,t){if(!e.length)return new bi(t,1);if(e.children.length==1){let s=e.children[0];if(s.isText())return this.scanText(s,t);else if(s.isComposite())return this.scanTile(s,t)}let n=[t];for(let s=0,l=t;s<e.children.length;s++)n.push(l+=e.children[s].length);let i=this.scan(n,(s)=>{let l=e.children[s];if(l.flags&48)return null;return(l.dom.nodeType==1?l.dom:Wc(l.dom,0,l.length)).getClientRects()}),r=e.children[i.i],o=n[i.i];if(r.isText())return this.scanText(r,o);if(r.isComposite())return this.scanTile(r,o);return i.after?new bi(n[i.i+1],-1):new bi(o,1)}}var Ra="￿";class N2{constructor(e,t){this.points=e,this.view=t,this.text="",this.lineSeparator=t.state.facet(pe.lineSeparator)}append(e){this.text+=e}lineBreak(){this.text+=Ra}readRange(e,t){if(!e)return this;let n=e.parentNode;for(let i=e;;){this.findPointBefore(n,i);let r=this.text.length;this.readNode(i);let o=Ye.get(i),s=i.nextSibling;if(s==t){if((o===null||o===void 0?void 0:o.breakAfter)&&!s&&n!=this.view.contentDOM)this.lineBreak();break}let l=Ye.get(s);if((o&&l?o.breakAfter:(o?o.breakAfter:Lp(i))||Lp(s)&&(i.nodeName!="BR"||(o===null||o===void 0?void 0:o.isWidget()))&&this.text.length>r)&&!k6(s,t))this.lineBreak();i=s}return this.findPointBefore(n,t),this}readTextNode(e){let t=e.nodeValue;for(let n of this.points)if(n.node==e)n.pos=this.text.length+Math.min(n.offset,t.length);for(let n=0,i=this.lineSeparator?null:/\r\n?|\n/g;;){let r=-1,o=1,s;if(this.lineSeparator)r=t.indexOf(this.lineSeparator,n),o=this.lineSeparator.length;else if(s=i.exec(t))r=s.index,o=s[0].length;if(this.append(t.slice(n,r<0?t.length:r)),r<0)break;if(this.lineBreak(),o>1){for(let l of this.points)if(l.node==e&&l.pos>this.text.length)l.pos-=o-1}n=r+o}}readNode(e){let t=Ye.get(e),n=t&&t.overrideDOMText;if(n!=null){this.findPointInside(e,n.length);for(let i=n.iter();!i.next().done;)if(i.lineBreak)this.lineBreak();else this.append(i.value)}else if(e.nodeType==3)this.readTextNode(e);else if(e.nodeName=="BR"){if(e.nextSibling)this.lineBreak()}else if(e.nodeType==1)this.readRange(e.firstChild,null)}findPointBefore(e,t){for(let n of this.points)if(n.node==e&&e.childNodes[n.offset]==t)n.pos=this.text.length}findPointInside(e,t){for(let n of this.points)if(e.nodeType==3?n.node==e:e.contains(n.node))n.pos=this.text.length+(S6(e,n.node,n.offset)?t:0)}}function S6(e,t,n){for(;;){if(!t||n<Hr(t))return!1;if(t==e)return!0;n=zo(t)+1,t=t.parentNode}}function k6(e,t){let n;for(;;e=e.nextSibling){if(e==t||!e)break;let i=Ye.get(e);if(!(i===null||i===void 0?void 0:i.isWidget()))return!1;if(i)(n||(n=[])).push(i)}if(n)for(let i of n){let r=i.overrideDOMText;if(r===null||r===void 0?void 0:r.length)return!1}return!0}class qy{constructor(e,t){this.node=e,this.offset=t,this.pos=-1}}class D2{constructor(e,t,n,i){this.typeOver=i,this.bounds=null,this.text="",this.domChanged=t>-1;let{impreciseHead:r,impreciseAnchor:o}=e.docView,s=e.state.selection;if(e.state.readOnly&&t>-1)this.newSel=null;else if(t>-1&&(this.bounds=L2(e.docView.tile,t,n,0))){let l=r||o?[]:C6(e),a=new N2(l,e);a.readRange(this.bounds.startDOM,this.bounds.endDOM),this.text=a.text,this.newSel=E6(l,this.bounds.from)}else{let l=e.observer.selectionRange,a=r&&r.node==l.focusNode&&r.offset==l.focusOffset||!Py(e.contentDOM,l.focusNode)?s.main.head:e.docView.posFromDOM(l.focusNode,l.focusOffset),u=o&&o.node==l.anchorNode&&o.offset==l.anchorOffset||!Py(e.contentDOM,l.anchorNode)?s.main.anchor:e.docView.posFromDOM(l.anchorNode,l.anchorOffset),c=e.viewport;if((K.ios||K.chrome)&&a!=u&&Math.min(a,u)<=s.main.from&&Math.max(a,u)>=s.main.to&&(c.from>0||c.to<e.state.doc.length)){let f=Math.min(a,u),d=Math.max(a,u),h=c.from-f,m=c.to-d;if((h==0||h==1||f==0)&&(m==0||m==-1||d==e.state.doc.length))a=0,u=e.state.doc.length}if(e.inputState.composing>-1&&s.ranges.length>1)this.newSel=s.replaceRange(R.range(u,a));else if(e.lineWrapping&&u==a&&!(s.main.empty&&s.main.head==a)&&e.inputState.lastTouchTime>Date.now()-100){let f=e.coordsAtPos(a,-1),d=0;if(f)d=e.inputState.lastTouchY<=f.bottom?-1:1;this.newSel=R.create([R.cursor(a,d)])}else this.newSel=R.single(u,a)}}}function L2(e,t,n,i){if(e.isComposite()){let r=-1,o=-1,s=-1,l=-1;for(let a=0,u=i,c=i;a<e.children.length;a++){let f=e.children[a],d=u+f.length;if(u<t&&d>n)return L2(f,t,n,u);if(d>=t&&r==-1)r=a,o=u;if(u>n&&f.dom.parentNode==e.dom){s=a,l=c;break}c=d,u=d+f.breakAfter}return{from:o,to:l<0?i+e.length:l,startDOM:(r?e.children[r-1].dom.nextSibling:null)||e.dom.firstChild,endDOM:s<e.children.length&&s>=0?e.children[s].dom:null}}else if(e.isText())return{from:i,to:i+e.length,startDOM:e.dom,endDOM:e.dom.nextSibling};else return null}function z2(e,t){let n,{newSel:i}=t,{state:r}=e,o=r.selection.main,s=e.inputState.lastKeyTime>Date.now()-100?e.inputState.lastKeyCode:-1;if(t.bounds){let{from:l,to:a}=t.bounds,u=o.from,c=null;if(s===8||K.android&&t.text.length<a-l)u=o.to,c="end";let f=r.doc.sliceString(l,a,Ra),d,h;if(!o.empty&&o.from>=l&&o.to<=a&&(t.typeOver||f!=t.text)&&f.slice(0,o.from-l)==t.text.slice(0,o.from-l)&&f.slice(o.to-l)==t.text.slice(d=t.text.length-(f.length-(o.to-l))))n={from:o.from,to:o.to,insert:de.of(t.text.slice(o.from-l,d).split(Ra))};else if(h=B2(f,t.text,u-l,c)){if(K.chrome&&s==13&&h.toB==h.from+2&&t.text.slice(h.from,h.toB)==Ra+Ra)h.toB--;n={from:l+h.from,to:l+h.toA,insert:de.of(t.text.slice(h.from,h.toB).split(Ra))}}}else if(i&&(!e.hasFocus&&r.facet(Ir)||Pp(i,o)))i=null;if(!n&&!i)return!1;if((K.mac||K.android)&&n&&n.from==n.to&&n.from==o.head-1&&/^\. ?$/.test(n.insert.toString())&&e.contentDOM.getAttribute("autocorrect")=="off"){if(i&&n.insert.length==2)i=R.single(i.main.anchor-1,i.main.head-1);n={from:n.from,to:n.to,insert:de.of([n.insert.toString().replace("."," ")])}}else if(r.doc.lineAt(o.from).to<o.to&&e.docView.lineHasWidget(o.to)&&e.inputState.insertingTextAt>Date.now()-50)n={from:o.from,to:o.to,insert:r.toText(e.inputState.insertingText)};else if(K.chrome&&n&&n.from==n.to&&n.from==o.head&&n.insert.toString()==`
32
- `&&e.lineWrapping){if(i)i=R.single(i.main.anchor-1,i.main.head-1);n={from:o.from,to:o.to,insert:de.of([" "])}}if(n)return sx(e,n,i,s);else if(i&&!Pp(i,o)){let l=!1,a="select";if(e.inputState.lastSelectionTime>Date.now()-50){if(e.inputState.lastSelectionOrigin=="select")l=!0;if(a=e.inputState.lastSelectionOrigin,a=="select.pointer")i=T2(r.facet(ef).map((u)=>u(e)),i)}return e.dispatch({selection:i,scrollIntoView:l,userEvent:a}),!0}else return!1}function sx(e,t,n,i=-1){if(K.ios&&e.inputState.flushIOSKey(t))return!0;let r=e.state.selection.main;if(K.android&&(t.to==r.to&&(t.from==r.from||t.from==r.from-1&&e.state.sliceDoc(t.from,r.from)==" ")&&t.insert.length==1&&t.insert.lines==2&&Na(e.contentDOM,"Enter",13)||(t.from==r.from-1&&t.to==r.to&&t.insert.length==0||i==8&&t.insert.length<t.to-t.from&&t.to>r.head)&&Na(e.contentDOM,"Backspace",8)||t.from==r.from&&t.to==r.to+1&&t.insert.length==0&&Na(e.contentDOM,"Delete",46)))return!0;let o=t.insert.toString();if(e.inputState.composing>=0)e.inputState.composing++;let s,l=()=>s||(s=_6(e,t,n));if(!e.state.facet(d2).some((a)=>a(e,t.from,t.to,o,l)))e.dispatch(l());return!0}function _6(e,t,n){let i,r=e.state,o=r.selection.main,s=-1;if(t.from==t.to&&t.from<o.from||t.from>o.to){let a=t.from<o.from?-1:1,u=a<0?o.from:o.to,c=$c(r.facet(ef).map((f)=>f(e)),u,a);if(t.from==c)s=c}if(s>-1)i={changes:t,selection:R.cursor(t.from+t.insert.length,-1)};else if(t.from>=o.from&&t.to<=o.to&&t.to-t.from>=(o.to-o.from)/3&&(!n||n.main.empty&&n.main.from==t.from+t.insert.length)&&e.inputState.composing<0){let a=o.from<t.from?r.sliceDoc(o.from,t.from):"",u=o.to>t.to?r.sliceDoc(t.to,o.to):"";i=r.replaceSelection(e.state.toText(a+t.insert.sliceString(0,void 0,e.state.lineBreak)+u))}else{let a=r.changes(t),u=n&&n.main.to<=a.newLength?n.main:void 0;if(r.selection.ranges.length>1&&(e.inputState.composing>=0||e.inputState.compositionPendingChange)&&t.to<=o.to+10&&t.to>=o.to-10){let c=e.state.sliceDoc(t.from,t.to),f,d=n&&A2(e,n.main.head);if(d){let m=t.insert.length-(t.to-t.from);f={from:d.from,to:d.to-m}}else f=e.state.doc.lineAt(o.head);let h=o.to-t.to;i=r.changeByRange((m)=>{if(m.from==o.from&&m.to==o.to)return{changes:a,range:u||m.map(a)};let b=m.to-h,x=b-c.length;if(e.state.sliceDoc(x,b)!=c||b>=f.from&&x<=f.to)return{range:m};let g=r.changes({from:x,to:b,insert:t.insert}),v=m.to-o.to;return{changes:g,range:!u?m.map(g):R.range(Math.max(0,u.anchor+v),Math.max(0,u.head+v))}})}else i={changes:a,selection:u&&r.selection.replaceRange(u)}}let l="input.type";if(e.composing||e.inputState.compositionPendingChange&&e.inputState.compositionEndedAt>Date.now()-50){if(e.inputState.compositionPendingChange=!1,l+=".compose",e.inputState.compositionFirstChange)l+=".start",e.inputState.compositionFirstChange=!1}return r.update(i,{userEvent:l,scrollIntoView:!0})}function B2(e,t,n,i){let r=Math.min(e.length,t.length),o=0;while(o<r&&e.charCodeAt(o)==t.charCodeAt(o))o++;if(o==r&&e.length==t.length)return null;let s=e.length,l=t.length;while(s>0&&l>0&&e.charCodeAt(s-1)==t.charCodeAt(l-1))s--,l--;if(i=="end"){let a=Math.max(0,o-Math.min(s,l));n-=s+a-o}if(s<o&&e.length<t.length){let a=n<=o&&n>=s?o-n:0;o-=a,l=o+(l-s),s=o}else if(l<o){let a=n<=o&&n>=l?o-n:0;o-=a,s=o+(s-l),l=o}return{from:o,toA:s,toB:l}}function C6(e){let t=[];if(e.root.activeElement!=e.contentDOM)return t;let{anchorNode:n,anchorOffset:i,focusNode:r,focusOffset:o}=e.observer.selectionRange;if(n){if(t.push(new qy(n,i)),r!=n||o!=i)t.push(new qy(r,o))}return t}function E6(e,t){if(e.length==0)return null;let n=e[0].pos,i=e.length==2?e[1].pos:n;return n<0||i<0?null:n==i?R.create([R.cursor(i+t,-1)]):R.single(n+t,i+t)}function Pp(e,t){return t.head==e.main.head&&t.anchor==e.main.anchor}class P2{setSelectionOrigin(e){this.lastSelectionOrigin=e,this.lastSelectionTime=Date.now()}constructor(e){if(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,K.safari)e.contentDOM.addEventListener("input",()=>null);if(K.gecko)U6(e.contentDOM.ownerDocument)}handleEvent(e){if(!L6(this.view,e)||this.ignoreDuringComposition(e))return;if(e.type=="keydown"&&this.keydown(e))return;if(this.view.updateState!=0)Promise.resolve().then(()=>this.runHandlers(e.type,e));else this.runHandlers(e.type,e)}runHandlers(e,t){let n=this.handlers[e];if(n){for(let i of n.observers)i(this.view,t);for(let i of n.handlers){if(t.defaultPrevented)break;if(i(this.view,t)){t.preventDefault();break}}}}ensureHandlers(e){let t=A6(e),n=this.handlers,i=this.view.contentDOM;for(let r in t)if(r!="scroll"){let o=!t[r].handlers.length,s=n[r];if(s&&o!=!s.handlers.length)i.removeEventListener(r,this.handleEvent),s=null;if(!s)i.addEventListener(r,this.handleEvent,{passive:o})}for(let r in n)if(r!="scroll"&&!t[r])i.removeEventListener(r,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&&V2.indexOf(e.keyCode)<0)this.tabFocusMode=-1;if(K.android&&K.chrome&&!e.synthetic&&(e.keyCode==13||e.keyCode==8))return this.view.observer.delayAndroidKey(e.key,e.keyCode),!0;if(K.ios&&!e.synthetic&&!e.altKey&&!e.metaKey&&(I2.some((t)=>t.keyCode==e.keyCode)&&!e.ctrlKey||R6.indexOf(e.key)>-1&&e.ctrlKey)){let t={ctrlKey:e.ctrlKey,altKey:e.altKey,metaKey:e.metaKey,shiftKey:e.shiftKey};if(t.shiftKey&&K.ios&&!/^(off|none)$/.test(this.view.contentDOM.autocapitalize)&&O6(this.view.win))t.shiftKey=!1;let n=this.pendingIOSKey={key:e.key,keyCode:e.keyCode,mods:t};return setTimeout(()=>{if(this.pendingIOSKey==n)this.flushIOSKey()},50),!0}if(e.keyCode!=229)this.view.observer.forceFlush();return!1}flushIOSKey(e){let t=this.pendingIOSKey;if(!t||this.view.observer.pendingRecords().length)return!1;if(t.key=="Enter"&&e&&e.from<e.to&&/^\S+$/.test(e.insert.toString()))return!1;return this.pendingIOSKey=void 0,Na(this.view.contentDOM,t.key,t.keyCode,t.mods)}ignoreDuringComposition(e){if(!/^key/.test(e.type)||e.synthetic)return!1;if(this.composing>0)return!0;if(K.safari&&!K.ios&&this.compositionPendingKey&&Date.now()-this.compositionEndedAt<100)return this.compositionPendingKey=!1,!0;return!1}startMouseSelection(e){if(this.mouseSelection)this.mouseSelection.destroy();this.mouseSelection=e}update(e){if(this.view.observer.update(e),this.mouseSelection)this.mouseSelection.update(e);if(this.draggedContent&&e.docChanged)this.draggedContent=this.draggedContent.map(e.changes);if(e.transactions.length)this.lastKeyCode=this.lastSelectionTime=0}destroy(){if(this.mouseSelection)this.mouseSelection.destroy()}}function O6(e){if(!e.visualViewport)return!1;return e.visualViewport.height*e.visualViewport.scale/e.document.documentElement.clientHeight<0.85}function OM(e,t){return(n,i)=>{try{return t.call(e,i,n)}catch(r){Xt(n.state,r)}}}function A6(e){let t=Object.create(null);function n(i){return t[i]||(t[i]={observers:[],handlers:[]})}for(let i of e){let r=i.spec,o=r&&r.plugin.domEventHandlers,s=r&&r.plugin.domEventObservers;if(o)for(let l in o){let a=o[l];if(a)n(l).handlers.push(OM(i.value,a))}if(s)for(let l in s){let a=s[l];if(a)n(l).observers.push(OM(i.value,a))}}for(let i in Si)n(i).handlers.push(Si[i]);for(let i in Yt)n(i).observers.push(Yt[i]);return t}var I2=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Enter",keyCode:13,inputType:"insertLineBreak"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],R6="dthko",V2=[16,17,18,20,91,92,224,225],Sp=6;function kp(e){return Math.max(0,e)*0.7+8}function T6(e,t){return Math.max(Math.abs(e.clientX-t.clientX),Math.abs(e.clientY-t.clientY))}class H2{constructor(e,t,n,i){this.view=e,this.startEvent=t,this.style=n,this.mustSelect=i,this.scrollSpeed={x:0,y:0},this.scrolling=-1,this.lastEvent=t,this.scrollParents=YM(e.contentDOM),this.atoms=e.state.facet(ef).map((o)=>o(e));let r=e.contentDOM.ownerDocument;r.addEventListener("mousemove",this.move=this.move.bind(this)),r.addEventListener("mouseup",this.up=this.up.bind(this)),this.extend=t.shiftKey,this.multiple=e.state.facet(pe.allowMultipleSelections)&&M6(e,t),this.dragging=D6(e,t)&&K2(t)==1?null:!1}start(e){if(this.dragging===!1)this.select(e)}move(e){if(e.buttons==0)return this.destroy();if(this.dragging||this.dragging==null&&T6(this.startEvent,e)<10)return;this.select(this.lastEvent=e);let t=0,n=0,i=0,r=0,o=this.view.win.innerWidth,s=this.view.win.innerHeight;if(this.scrollParents.x)({left:i,right:o}=this.scrollParents.x.getBoundingClientRect());if(this.scrollParents.y)({top:r,bottom:s}=this.scrollParents.y.getBoundingClientRect());let l=ox(this.view);if(e.clientX-l.left<=i+Sp)t=-kp(i-e.clientX);else if(e.clientX+l.right>=o-Sp)t=kp(e.clientX-o);if(e.clientY-l.top<=r+Sp)n=-kp(r-e.clientY);else if(e.clientY+l.bottom>=s-Sp)n=kp(e.clientY-s);this.setScrollSpeed(t,n)}up(e){if(this.dragging==null)this.select(this.lastEvent);if(!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){if(this.scrollSpeed={x:e,y:t},e||t){if(this.scrolling<0)this.scrolling=setInterval(()=>this.scroll(),50)}else if(this.scrolling>-1)clearInterval(this.scrolling),this.scrolling=-1}scroll(){let{x:e,y:t}=this.scrollSpeed;if(e&&this.scrollParents.x)this.scrollParents.x.scrollLeft+=e,e=0;if(t&&this.scrollParents.y)this.scrollParents.y.scrollTop+=t,t=0;if(e||t)this.view.win.scrollBy(e,t);if(this.dragging===!1)this.select(this.lastEvent)}select(e){let{view:t}=this,n=T2(this.atoms,this.style.get(e,this.extend,this.multiple));if(this.mustSelect||!n.eq(t.state.selection,this.dragging===!1))this.view.dispatch({selection:n,userEvent:"select.pointer"});this.mustSelect=!1}update(e){if(e.transactions.some((t)=>t.isUserEvent("input.type")))this.destroy();else if(this.style.update(e))setTimeout(()=>this.select(this.lastEvent),20)}}function M6(e,t){let n=e.state.facet(a2);return n.length?n[0](t):K.mac?t.metaKey:t.ctrlKey}function N6(e,t){let n=e.state.facet(u2);return n.length?n[0](t):K.mac?!t.altKey:!t.ctrlKey}function D6(e,t){let{main:n}=e.state.selection;if(n.empty)return!1;let i=Gc(e.root);if(!i||i.rangeCount==0)return!0;let r=i.getRangeAt(0).getClientRects();for(let o=0;o<r.length;o++){let s=r[o];if(s.left<=t.clientX&&s.right>=t.clientX&&s.top<=t.clientY&&s.bottom>=t.clientY)return!0}return!1}function L6(e,t){if(!t.bubbles)return!0;if(t.defaultPrevented)return!1;for(let n=t.target,i;n!=e.contentDOM;n=n.parentNode)if(!n||n.nodeType==11||(i=Ye.get(n))&&i.isWidget()&&!i.isHidden&&i.widget.ignoreEvent(t))return!1;return!0}var Si=Object.create(null),Yt=Object.create(null),U2=K.ie&&K.ie_version<15||K.ios&&K.webkit_version<604;function z6(e){let t=e.dom.parentNode;if(!t)return;let n=t.appendChild(document.createElement("textarea"));n.style.cssText="position: fixed; left: -10000px; top: 10px",n.focus(),setTimeout(()=>{e.focus(),n.remove(),j2(e,n.value)},50)}function jp(e,t,n){for(let i of e.facet(t))n=i(n,e);return n}function j2(e,t){t=jp(e.state,tx,t);let{state:n}=e,i,r=1,o=n.toText(t),s=o.lines==n.selection.ranges.length;if($y!=null&&n.selection.ranges.every((a)=>a.empty)&&$y==o.toString()){let a=-1;i=n.changeByRange((u)=>{let c=n.doc.lineAt(u.from);if(c.from==a)return{range:u};a=c.from;let f=n.toText((s?o.line(r++).text:t)+n.lineBreak);return{changes:{from:c.from,insert:f},range:R.cursor(u.from+f.length,-1)}})}else if(s)i=n.changeByRange((a)=>{let u=o.line(r++);return{changes:{from:a.from,to:a.to,insert:u.text},range:R.cursor(a.from+u.length,-1)}});else i=n.replaceSelection(o);e.dispatch(i,{userEvent:"input.paste",scrollIntoView:!0})}Yt.scroll=(e)=>{let t=e.inputState;if(t.lastScrollTop=e.scrollDOM.scrollTop,t.lastScrollLeft=e.scrollDOM.scrollLeft,K.ios&&!t.touchActive)t.lastIOSMomentumScroll=Date.now()};Yt.wheel=Yt.mousewheel=(e)=>{e.inputState.lastWheelEvent=Date.now()};Si.keydown=(e,t)=>{if(e.inputState.setSelectionOrigin("select"),t.keyCode==27&&e.inputState.tabFocusMode!=0)e.inputState.tabFocusMode=Date.now()+2000;return!1};Yt.touchstart=(e,t)=>{let n=e.inputState,i=t.targetTouches[0];if(n.touchActive=!0,n.lastTouchTime=Date.now(),i)n.lastTouchX=i.clientX,n.lastTouchY=i.clientY;n.setSelectionOrigin("select.pointer")};Yt.touchmove=(e)=>{e.inputState.setSelectionOrigin("select.pointer")};Yt.touchend=(e,t)=>{e.inputState.touchActive=!1};Si.mousedown=(e,t)=>{if(e.observer.flush(),e.inputState.lastTouchTime>Date.now()-2000)return!1;let n=null;for(let i of e.state.facet(c2))if(n=i(e,t),n)break;if(!n&&t.button==0)n=P6(e,t);if(n){let i=!e.hasFocus;if(e.inputState.startMouseSelection(new H2(e,t,n,i)),i)e.observer.ignore(()=>{ZM(e.contentDOM);let o=e.root.activeElement;if(o&&!o.contains(e.contentDOM))o.blur()});let r=e.inputState.mouseSelection;if(r)return r.start(t),r.dragging===!1}else e.inputState.setSelectionOrigin("select.pointer");return!1};function AM(e,t,n,i){if(i==1)return R.cursor(t,n);else if(i==2)return g6(e.state,t,n);else{let r=e.docView.lineAt(t,n),o=e.state.doc.lineAt(r?r.posAtEnd:t),s=r?r.posAtStart:o.from,l=r?r.posAtEnd:o.to;if(l<e.state.doc.length&&l==o.to)l++;return R.undirectionalRange(s,l)}}var B6=K.ie&&K.ie_version<=11,RM=null,TM=0,MM=0;function K2(e){if(!B6)return e.detail;let t=RM,n=MM;return RM=e,MM=Date.now(),TM=!t||n>Date.now()-400&&Math.abs(t.clientX-e.clientX)<2&&Math.abs(t.clientY-e.clientY)<2?(TM+1)%3:1}function P6(e,t){let n=e.posAndSideAtCoords({x:t.clientX,y:t.clientY},!1),i=K2(t),r=e.state.selection;return{update(o){if(o.docChanged)n.pos=o.changes.mapPos(n.pos),r=r.map(o.changes)},get(o,s,l){let a=e.posAndSideAtCoords({x:o.clientX,y:o.clientY},!1),u,c=AM(e,a.pos,a.assoc,i);if(n.pos!=a.pos&&!s){let f=AM(e,n.pos,n.assoc,i),d=Math.min(f.from,c.from),h=Math.max(f.to,c.to);c=d<c.from?R.range(d,h,c.assoc):R.range(h,d,c.assoc)}if(s)return r.replaceRange(r.main.extend(c.from,c.to,c.assoc));else if(l&&i==1&&r.ranges.length>1&&(u=I6(r,a.pos)))return u;else if(l)return r.addRange(c);else return R.create([c])}}}function I6(e,t){for(let n=0;n<e.ranges.length;n++){let{from:i,to:r}=e.ranges[n];if(i<=t&&r>=t)return R.create(e.ranges.slice(0,n).concat(e.ranges.slice(n+1)),e.mainIndex==n?0:e.mainIndex-(e.mainIndex>n?1:0))}return null}Si.dragstart=(e,t)=>{let{selection:{main:n}}=e.state;if(t.target.draggable){let r=e.docView.tile.nearest(t.target);if(r&&r.isWidget()){let o=r.posAtStart,s=o+r.length;if(o>=n.to||s<=n.from)n=R.undirectionalRange(o,s)}}let{inputState:i}=e;if(i.mouseSelection)i.mouseSelection.dragging=!0;if(i.draggedContent=n,t.dataTransfer)t.dataTransfer.setData("Text",jp(e.state,nx,e.state.sliceDoc(n.from,n.to))),t.dataTransfer.effectAllowed="copyMove";return!1};Si.dragend=(e)=>(e.inputState.draggedContent=null,!1);function NM(e,t,n,i){if(n=jp(e.state,tx,n),!n)return;let r=e.posAtCoords({x:t.clientX,y:t.clientY},!1),{draggedContent:o}=e.inputState,s=i&&o&&N6(e,t)?{from:o.from,to:o.to}:null,l={from:r,insert:n},a=e.state.changes(s?[s,l]:l);e.focus(),e.dispatch({changes:a,selection:{anchor:a.mapPos(r,-1),head:a.mapPos(r,1)},userEvent:s?"move.drop":"input.drop"}),e.inputState.draggedContent=null}Si.drop=(e,t)=>{if(!t.dataTransfer)return!1;if(e.state.readOnly)return!0;let n=t.dataTransfer.files;if(n&&n.length){let i=Array(n.length),r=0,o=()=>{if(++r==n.length)NM(e,t,i.filter((s)=>s!=null).join(e.state.lineBreak),!1)};for(let s=0;s<n.length;s++){let l=new FileReader;l.onerror=o,l.onload=()=>{if(!/[\x00-\x08\x0e-\x1f]{2}/.test(l.result))i[s]=l.result;o()},l.readAsText(n[s])}return!0}else{let i=t.dataTransfer.getData("Text");if(i)return NM(e,t,i,!0),!0}return!1};Si.paste=(e,t)=>{if(e.state.readOnly)return!0;e.observer.flush();let n=U2?null:t.clipboardData;if(n)return j2(e,n.getData("text/plain")||n.getData("text/uri-list")),!0;else return z6(e),!1};function V6(e,t){let n=e.dom.parentNode;if(!n)return;let i=n.appendChild(document.createElement("textarea"));i.style.cssText="position: fixed; left: -10000px; top: 10px",i.value=t,i.focus(),i.selectionEnd=t.length,i.selectionStart=0,setTimeout(()=>{i.remove(),e.focus()},50)}function H6(e){let t=[],n=[],i=!1;for(let r of e.selection.ranges)if(!r.empty)t.push(e.sliceDoc(r.from,r.to)),n.push(r);if(!t.length){let r=-1;for(let{from:o}of e.selection.ranges){let s=e.doc.lineAt(o);if(s.number>r)t.push(s.text),n.push({from:s.from,to:Math.min(e.doc.length,s.to+1)});r=s.number}i=!0}return{text:jp(e,nx,t.join(e.lineBreak)),ranges:n,linewise:i}}var $y=null;Si.copy=Si.cut=(e,t)=>{if(!Kc(e.contentDOM,e.observer.selectionRange))return!1;let{text:n,ranges:i,linewise:r}=H6(e.state);if(!n&&!r)return!1;if($y=r?n:null,t.type=="cut"&&!e.state.readOnly)e.dispatch({changes:i,scrollIntoView:!0,userEvent:"delete.cut"});let o=U2?null:t.clipboardData;if(o)return o.clearData(),o.setData("text/plain",n),!0;else return V6(e,n),!1};var F2=_n.define();function q2(e,t){let n=[];for(let i of e.facet(h2)){let r=i(e,t);if(r)n.push(r)}return n.length?e.update({effects:n,annotations:F2.of(!0)}):null}function $2(e){setTimeout(()=>{let t=e.hasFocus;if(t!=e.inputState.notifiedFocused){let n=q2(e.state,t);if(n)e.dispatch(n);else e.update([])}},10)}Yt.focus=(e)=>{if(e.inputState.lastFocusTime=Date.now(),!e.scrollDOM.scrollTop&&(e.inputState.lastScrollTop||e.inputState.lastScrollLeft))e.scrollDOM.scrollTop=e.inputState.lastScrollTop,e.scrollDOM.scrollLeft=e.inputState.lastScrollLeft;$2(e)};Yt.blur=(e)=>{e.observer.clearSelectionRange(),$2(e)};Yt.compositionstart=Yt.compositionupdate=(e)=>{if(e.observer.editContext)return;if(e.inputState.compositionFirstChange==null)e.inputState.compositionFirstChange=!0;if(e.inputState.composing<0){let{main:t}=e.state.selection;if(!t.empty&&e.lineBlockAt(t.from).from!=e.lineBlockAt(t.to).from)e.dispatch({changes:e.state.selection.ranges.filter((n)=>!n.empty).map((n)=>({from:n.from,to:n.to})),userEvent:"input"});e.inputState.composing=0}};Yt.compositionend=(e)=>{if(e.observer.editContext)return;if(e.inputState.composing=-1,e.inputState.compositionEndedAt=Date.now(),e.inputState.compositionPendingKey=!0,e.inputState.compositionPendingChange=e.observer.pendingRecords().length>0,e.inputState.compositionFirstChange=null,K.chrome&&K.android)e.observer.flushSoon();else if(e.inputState.compositionPendingChange)Promise.resolve().then(()=>e.observer.flush());else setTimeout(()=>{if(e.inputState.composing<0&&e.docView.hasComposition)e.update([])},50)};Yt.contextmenu=(e)=>{e.inputState.lastContextMenu=Date.now()};Si.beforeinput=(e,t)=>{var n,i;if(t.inputType=="insertText"||t.inputType=="insertCompositionText")e.inputState.insertingText=t.data,e.inputState.insertingTextAt=Date.now();if(t.inputType=="insertReplacementText"&&e.observer.editContext){let o=(n=t.dataTransfer)===null||n===void 0?void 0:n.getData("text/plain"),s=t.getTargetRanges();if(o&&s.length){let l=s[0],a=e.posAtDOM(l.startContainer,l.startOffset),u=e.posAtDOM(l.endContainer,l.endOffset);return sx(e,{from:a,to:u,insert:e.state.toText(o)},null),!0}}let r;if(K.chrome&&K.android&&(r=I2.find((o)=>o.inputType==t.inputType))){if(e.observer.delayAndroidKey(r.key,r.keyCode),r.key=="Backspace"||r.key=="Delete"){let o=((i=window.visualViewport)===null||i===void 0?void 0:i.height)||0;setTimeout(()=>{var s;if((((s=window.visualViewport)===null||s===void 0?void 0:s.height)||0)>o+10&&e.hasFocus)e.contentDOM.blur(),e.focus()},100)}}if(K.ios&&t.inputType=="deleteContentForward")e.observer.flushSoon();if(K.safari&&t.inputType=="insertText"&&e.inputState.composing>=0)setTimeout(()=>Yt.compositionend(e,t),20);return!1};var DM=new Set;function U6(e){if(!DM.has(e))DM.add(e),e.addEventListener("copy",()=>{}),e.addEventListener("cut",()=>{})}var LM=["pre-wrap","normal","pre-line","break-spaces"],za=!1;function zM(){za=!1}class X2{constructor(e){this.lineWrapping=e,this.doc=de.empty,this.heightSamples={},this.lineHeight=14,this.charWidth=7,this.textHeight=14,this.lineLength=30}heightForGap(e,t){let n=this.doc.lineAt(t).number-this.doc.lineAt(e).number+1;if(this.lineWrapping)n+=Math.max(0,Math.ceil((t-e-n*this.lineLength*0.5)/this.lineLength));return this.lineHeight*n}heightForLine(e){if(!this.lineWrapping)return this.lineHeight;return(1+Math.max(0,Math.ceil((e-this.lineLength)/Math.max(1,this.lineLength-5))))*this.lineHeight}setDoc(e){return this.doc=e,this}mustRefreshForWrapping(e){return LM.indexOf(e)>-1!=this.lineWrapping}mustRefreshForHeights(e){let t=!1;for(let n=0;n<e.length;n++){let i=e[n];if(i<0)n++;else if(!this.heightSamples[Math.floor(i*10)])t=!0,this.heightSamples[Math.floor(i*10)]=!0}return t}refresh(e,t,n,i,r,o){let s=LM.indexOf(e)>-1,l=Math.abs(t-this.lineHeight)>0.3||this.lineWrapping!=s;if(this.lineWrapping=s,this.lineHeight=t,this.charWidth=n,this.textHeight=i,this.lineLength=r,l){this.heightSamples={};for(let a=0;a<o.length;a++){let u=o[a];if(u<0)a++;else this.heightSamples[Math.floor(u*10)]=!0}}return l}}class G2{constructor(e,t){this.from=e,this.heights=t,this.index=0}get more(){return this.index<this.heights.length}}class yi{constructor(e,t,n,i,r){this.from=e,this.length=t,this.top=n,this.height=i,this._content=r}get type(){return typeof this._content=="number"?Gn.Text:Array.isArray(this._content)?this._content:this._content.type}get to(){return this.from+this.length}get bottom(){return this.top+this.height}get widget(){return this._content instanceof Hs?this._content.widget:null}get widgetLineBreaks(){return typeof this._content=="number"?this._content:0}join(e){let t=(Array.isArray(this._content)?this._content:[this]).concat(Array.isArray(e._content)?e._content:[e]);return new yi(this.from,this.length+e.length,this.top,this.height+e.height,t)}}var Ve=function(e){return e[e.ByPos=0]="ByPos",e[e.ByHeight=1]="ByHeight",e[e.ByPosNoHeight=2]="ByPosNoHeight",e}(Ve||(Ve={})),Mp=0.001;class Gt{constructor(e,t,n=2){this.length=e,this.height=t,this.flags=n}get outdated(){return(this.flags&2)>0}set outdated(e){this.flags=(e?2:0)|this.flags&-3}setHeight(e){if(this.height!=e){if(Math.abs(this.height-e)>Mp)za=!0;this.height=e}}replace(e,t,n){return Gt.of(n)}decomposeLeft(e,t){t.push(this)}decomposeRight(e,t){t.push(this)}applyChanges(e,t,n,i){let r=this,o=n.doc;for(let s=i.length-1;s>=0;s--){let{fromA:l,toA:a,fromB:u,toB:c}=i[s],f=r.lineAt(l,Ve.ByPosNoHeight,n.setDoc(t),0,0),d=f.to>=a?f:r.lineAt(a,Ve.ByPosNoHeight,n,0,0);c+=d.to-a,a=d.to;while(s>0&&f.from<=i[s-1].toA)if(l=i[s-1].fromA,u=i[s-1].fromB,s--,l<f.from)f=r.lineAt(l,Ve.ByPosNoHeight,n,0,0);u+=f.from-l,l=f.from;let h=ax.build(n.setDoc(o),e,u,c);r=Ip(r,r.replace(l,a,h))}return r.updateHeight(n,0)}static empty(){return new Cn(0,0,0)}static of(e){if(e.length==1)return e[0];let t=0,n=e.length,i=0,r=0;for(;;)if(t==n)if(i>r*2){let s=e[t-1];if(s.break)e.splice(--t,1,s.left,null,s.right);else e.splice(--t,1,s.left,s.right);n+=1+s.break,i-=s.size}else if(r>i*2){let s=e[n];if(s.break)e.splice(n,1,s.left,null,s.right);else e.splice(n,1,s.left,s.right);n+=2+s.break,r-=s.size}else break;else if(i<r){let s=e[t++];if(s)i+=s.size}else{let s=e[--n];if(s)r+=s.size}let o=!1;if(e[t-1]==null)o=!0,t--;else if(e[t]==null)o=!0,n++;return new Y2(Gt.of(e.slice(0,t)),o,Gt.of(e.slice(n)))}}function Ip(e,t){if(e==t)return e;if(e.constructor!=t.constructor)za=!0;return t}Gt.prototype.size=1;var j6=Oe.replace({});class lx extends Gt{constructor(e,t,n){super(e,t);this.deco=n,this.spaceAbove=0}mainBlock(e,t){return new yi(t,this.length,e+this.spaceAbove,this.height-this.spaceAbove,this.deco||0)}blockAt(e,t,n,i){return this.spaceAbove&&e<n+this.spaceAbove?new yi(i,0,n,this.spaceAbove,j6):this.mainBlock(n,i)}lineAt(e,t,n,i,r){let o=this.mainBlock(i,r);return this.spaceAbove?this.blockAt(0,n,i,r).join(o):o}forEachLine(e,t,n,i,r,o){if(e<=r+this.length&&t>=r)o(this.lineAt(0,Ve.ByPos,n,i,r))}setMeasuredHeight(e){let t=e.heights[e.index++];if(t<0)this.spaceAbove=-t,t=e.heights[e.index++];else this.spaceAbove=0;this.setHeight(t)}updateHeight(e,t=0,n=!1,i){if(i&&i.from<=t&&i.more)this.setMeasuredHeight(i);return this.outdated=!1,this}toString(){return`block(${this.length})`}}class Cn extends lx{constructor(e,t,n){super(e,t,null);this.collapsed=0,this.widgetHeight=0,this.breaks=0,this.spaceAbove=n}mainBlock(e,t){return new yi(t,this.length,e+this.spaceAbove,this.height-this.spaceAbove,this.breaks)}replace(e,t,n){let i=n[0];if(n.length==1&&(i instanceof Cn||i instanceof Mt&&i.flags&4)&&Math.abs(this.length-i.length)<10){if(i instanceof Mt)i=new Cn(i.length,this.height,this.spaceAbove);else i.height=this.height;if(!this.outdated)i.outdated=!1;return i}else return Gt.of(n)}updateHeight(e,t=0,n=!1,i){if(i&&i.from<=t&&i.more)this.setMeasuredHeight(i);else if(n||this.outdated)this.spaceAbove=0,this.setHeight(Math.max(this.widgetHeight,e.heightForLine(this.length-this.collapsed))+this.breaks*e.lineHeight);return this.outdated=!1,this}toString(){return`line(${this.length}${this.collapsed?-this.collapsed:""}${this.widgetHeight?":"+this.widgetHeight:""})`}}class Mt extends Gt{constructor(e){super(e,0)}heightMetrics(e,t){let n=e.doc.lineAt(t).number,i=e.doc.lineAt(t+this.length).number,r=i-n+1,o,s=0;if(e.lineWrapping){let l=Math.min(this.height,e.lineHeight*r);if(o=l/r,this.length>r+1)s=(this.height-l)/(this.length-r-1)}else o=this.height/r;return{firstLine:n,lastLine:i,perLine:o,perChar:s}}blockAt(e,t,n,i){let{firstLine:r,lastLine:o,perLine:s,perChar:l}=this.heightMetrics(t,i);if(t.lineWrapping){let a=i+(e<t.lineHeight?0:Math.round(Math.max(0,Math.min(1,(e-n)/this.height))*this.length)),u=t.doc.lineAt(a),c=s+u.length*l,f=Math.max(n,e-c/2);return new yi(u.from,u.length,f,c,0)}else{let a=Math.max(0,Math.min(o-r,Math.floor((e-n)/s))),{from:u,length:c}=t.doc.line(r+a);return new yi(u,c,n+s*a,s,0)}}lineAt(e,t,n,i,r){if(t==Ve.ByHeight)return this.blockAt(e,n,i,r);if(t==Ve.ByPosNoHeight){let{from:d,to:h}=n.doc.lineAt(e);return new yi(d,h-d,0,0,0)}let{firstLine:o,perLine:s,perChar:l}=this.heightMetrics(n,r),a=n.doc.lineAt(e),u=s+a.length*l,c=a.number-o,f=i+s*c+l*(a.from-r-c);return new yi(a.from,a.length,Math.max(i,Math.min(f,i+this.height-u)),u,0)}forEachLine(e,t,n,i,r,o){e=Math.max(e,r),t=Math.min(t,r+this.length);let{firstLine:s,perLine:l,perChar:a}=this.heightMetrics(n,r);for(let u=e,c=i;u<=t;){let f=n.doc.lineAt(u);if(u==e){let h=f.number-s;c+=l*h+a*(e-r-h)}let d=l+a*f.length;o(new yi(f.from,f.length,c,d,0)),c+=d,u=f.to+1}}replace(e,t,n){let i=this.length-t;if(i>0){let r=n[n.length-1];if(r instanceof Mt)n[n.length-1]=new Mt(r.length+i);else n.push(null,new Mt(i-1))}if(e>0){let r=n[0];if(r instanceof Mt)n[0]=new Mt(e+r.length);else n.unshift(new Mt(e-1),null)}return Gt.of(n)}decomposeLeft(e,t){t.push(new Mt(e-1),null)}decomposeRight(e,t){t.push(null,new Mt(this.length-e-1))}updateHeight(e,t=0,n=!1,i){let r=t+this.length;if(i&&i.from<=t+this.length&&i.more){let o=[],s=Math.max(t,i.from),l=-1;if(i.from>t)o.push(new Mt(i.from-t-1).updateHeight(e,t));while(s<=r&&i.more){let u=e.doc.lineAt(s).length;if(o.length)o.push(null);let c=i.heights[i.index++],f=0;if(c<0)f=-c,c=i.heights[i.index++];if(l==-1)l=c;else if(Math.abs(c-l)>=Mp)l=-2;let d=new Cn(u,c,f);d.outdated=!1,o.push(d),s+=u+1}if(s<=r)o.push(null,new Mt(r-s).updateHeight(e,s));let a=Gt.of(o);if(l<0||Math.abs(a.height-this.height)>=Mp||Math.abs(l-this.heightMetrics(e,t).perLine)>=Mp)za=!0;return Ip(this,a)}else if(n||this.outdated)this.setHeight(e.heightForGap(t,t+this.length)),this.outdated=!1;return this}toString(){return`gap(${this.length})`}}class Y2 extends Gt{constructor(e,t,n){super(e.length+(t?1:0)+n.length,e.height+n.height,(t?1:0)|(e.outdated||n.outdated?2:0));this.left=e,this.right=n,this.size=e.size+n.size}get break(){return this.flags&1}blockAt(e,t,n,i){let r=n+this.left.height;return e<r?this.left.blockAt(e,t,n,i):this.right.blockAt(e,t,r,i+this.left.length+this.break)}lineAt(e,t,n,i,r){let o=i+this.left.height,s=r+this.left.length+this.break,l=t==Ve.ByHeight?e<o:e<s,a=l?this.left.lineAt(e,t,n,i,r):this.right.lineAt(e,t,n,o,s);if(this.break||(l?a.to<s:a.from>s))return a;let u=t==Ve.ByPosNoHeight?Ve.ByPosNoHeight:Ve.ByPos;if(l)return a.join(this.right.lineAt(s,u,n,o,s));else return this.left.lineAt(s,u,n,i,r).join(a)}forEachLine(e,t,n,i,r,o){let s=i+this.left.height,l=r+this.left.length+this.break;if(this.break){if(e<l)this.left.forEachLine(e,t,n,i,r,o);if(t>=l)this.right.forEachLine(e,t,n,s,l,o)}else{let a=this.lineAt(l,Ve.ByPos,n,i,r);if(e<a.from)this.left.forEachLine(e,Math.min(t,a.from-1),n,i,r,o);if(a.to>=e&&a.from<=t)o(a);if(t>a.to)this.right.forEachLine(Math.max(e,a.to+1),t,n,s,l,o)}}replace(e,t,n){let i=this.left.length+this.break;if(t<i)return this.balanced(this.left.replace(e,t,n),this.right);if(e>this.left.length)return this.balanced(this.left,this.right.replace(e-i,t-i,n));let r=[];if(e>0)this.decomposeLeft(e,r);let o=r.length;for(let s of n)r.push(s);if(e>0)BM(r,o-1);if(t<this.length){let s=r.length;this.decomposeRight(t,r),BM(r,s)}return Gt.of(r)}decomposeLeft(e,t){let n=this.left.length;if(e<=n)return this.left.decomposeLeft(e,t);if(t.push(this.left),this.break){if(n++,e>=n)t.push(null)}if(e>n)this.right.decomposeLeft(e-n,t)}decomposeRight(e,t){let n=this.left.length,i=n+this.break;if(e>=i)return this.right.decomposeRight(e-i,t);if(e<n)this.left.decomposeRight(e,t);if(this.break&&e<i)t.push(null);t.push(this.right)}balanced(e,t){if(e.size>2*t.size||t.size>2*e.size)return Gt.of(this.break?[e,null,t]:[e,t]);return this.left=Ip(this.left,e),this.right=Ip(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,n=!1,i){let{left:r,right:o}=this,s=t+r.length+this.break,l=null;if(i&&i.from<=t+r.length&&i.more)l=r=r.updateHeight(e,t,n,i);else r.updateHeight(e,t,n);if(i&&i.from<=s+o.length&&i.more)l=o=o.updateHeight(e,s,n,i);else o.updateHeight(e,s,n);if(l)return this.balanced(r,o);return this.height=this.left.height+this.right.height,this.outdated=!1,this}toString(){return this.left+(this.break?" ":"-")+this.right}}function BM(e,t){let n,i;if(e[t]==null&&(n=e[t-1])instanceof Mt&&(i=e[t+1])instanceof Mt)e.splice(t-1,3,new Mt(n.length+1+i.length))}var K6=5;class ax{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 n=Math.min(t,this.lineEnd),i=this.nodes[this.nodes.length-1];if(i instanceof Cn)i.length+=n-this.pos;else if(n>this.pos||!this.isCovered)this.nodes.push(new Cn(n-this.pos,-1,0));if(this.writtenTo=n,t>n)this.nodes.push(null),this.writtenTo++,this.lineStart=-1}this.pos=t}point(e,t,n){if(e<t||n.heightRelevant){let i=n.widget?n.widget.estimatedHeight:0,r=n.widget?n.widget.lineBreaks:0;if(i<0)i=this.oracle.lineHeight;let o=t-e;if(n.block)this.addBlock(new lx(o,i,n));else if(o||r||i>=K6)this.addLineDeco(i,r,o)}else if(t>e)this.span(e,t);if(this.lineEnd>-1&&this.lineEnd<this.pos)this.lineEnd=this.oracle.doc.lineAt(this.pos).to}enterLine(){if(this.lineStart>-1)return;let{from:e,to:t}=this.oracle.doc.lineAt(this.pos);if(this.lineStart=e,this.lineEnd=t,this.writtenTo<e){if(this.writtenTo<e-1||this.nodes[this.nodes.length-1]==null)this.nodes.push(this.blankContent(this.writtenTo,e-1));this.nodes.push(null)}if(this.pos>e)this.nodes.push(new Cn(this.pos-e,-1,0));this.writtenTo=this.pos}blankContent(e,t){let n=new Mt(t-e);if(this.oracle.doc.lineAt(e).to==t)n.flags|=4;return n}ensureLine(){this.enterLine();let e=this.nodes.length?this.nodes[this.nodes.length-1]:null;if(e instanceof Cn)return e;let t=new Cn(0,-1,0);return this.nodes.push(t),t}addBlock(e){this.enterLine();let t=e.deco;if(t&&t.startSide>0&&!this.isCovered)this.ensureLine();if(this.nodes.push(e),this.writtenTo=this.pos=this.pos+e.length,t&&t.endSide>0)this.covering=e}addLineDeco(e,t,n){let i=this.ensureLine();i.length+=n,i.collapsed+=n,i.widgetHeight=Math.max(i.widgetHeight,e),i.breaks+=t,this.writtenTo=this.pos=this.pos+n}finish(e){let t=this.nodes.length==0?null:this.nodes[this.nodes.length-1];if(this.lineStart>-1&&!(t instanceof Cn)&&!this.isCovered)this.nodes.push(new Cn(0,-1,0));else if(this.writtenTo<this.pos||t==null)this.nodes.push(this.blankContent(this.writtenTo,this.pos));let n=e;for(let i of this.nodes){if(i instanceof Cn)i.updateHeight(this.oracle,n);n+=i?i.length:1}return this.nodes}static build(e,t,n,i){let r=new ax(n,e);return ge.spans(t,n,i,r,0),r.finish(n)}}function F6(e,t,n){let i=new W2;return ge.compare(e,t,n,i,0),i.changes}class W2{constructor(){this.changes=[]}compareRange(){}comparePoint(e,t,n,i){if(e<t||n&&n.heightRelevant||i&&i.heightRelevant)Ma(e,t,this.changes,5)}}function q6(e,t){let n=e.getBoundingClientRect(),i=e.ownerDocument,r=i.defaultView||window,o=Math.max(0,n.left),s=Math.min(r.innerWidth,n.right),l=Math.max(0,n.top),a=Math.min(r.innerHeight,n.bottom);for(let u=e.parentNode;u&&u!=i.body;)if(u.nodeType==1){let c=u,f=window.getComputedStyle(c);if((c.scrollHeight>c.clientHeight||c.scrollWidth>c.clientWidth)&&f.overflow!="visible"){let d=c.getBoundingClientRect();o=Math.max(o,d.left),s=Math.min(s,d.right),l=Math.max(l,d.top),a=Math.min(u==e.parentNode?r.innerHeight:a,d.bottom)}u=f.position=="absolute"||f.position=="fixed"?c.offsetParent:c.parentNode}else if(u.nodeType==11)u=u.host;else break;return{left:o-n.left,right:Math.max(o,s)-n.left,top:l-(n.top+t),bottom:Math.max(l,a)-(n.top+t)}}function $6(e){let t=e.getBoundingClientRect(),n=e.ownerDocument.defaultView||window;return t.left<n.innerWidth&&t.right>0&&t.top<n.innerHeight&&t.bottom>0}function X6(e,t){let n=e.getBoundingClientRect();return{left:0,right:n.right-n.left,top:t,bottom:n.bottom-(n.top+t)}}class Np{constructor(e,t,n,i){this.from=e,this.to=t,this.size=n,this.displaySize=i}static same(e,t){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++){let i=e[n],r=t[n];if(i.from!=r.from||i.to!=r.to||i.size!=r.size)return!1}return!0}draw(e,t){return Oe.replace({widget:new Q2(this.displaySize*(t?e.scaleY:e.scaleX),t)}).range(this.from,this.to)}}class Q2 extends Po{constructor(e,t){super();this.size=e,this.vertical=t}eq(e){return e.size==this.size&&e.vertical==this.vertical}toDOM(){let e=document.createElement("div");if(this.vertical)e.style.height=this.size+"px";else e.style.width=this.size+"px",e.style.height="2px",e.style.display="inline-block";return e}get estimatedHeight(){return this.vertical?this.size:-1}}class Xy{constructor(e,t){this.view=e,this.state=t,this.pixelViewport={left:0,right:window.innerWidth,top:0,bottom:0},this.inView=!0,this.paddingTop=0,this.paddingBottom=0,this.contentDOMWidth=0,this.contentDOMHeight=0,this.editorHeight=0,this.editorWidth=0,this.scaleX=1,this.scaleY=1,this.scrollOffset=0,this.scrolledToBottom=!1,this.scrollAnchorPos=0,this.scrollAnchorHeight=-1,this.scaler=PM,this.scrollTarget=null,this.printing=!1,this.mustMeasureContent=!0,this.defaultTextDirection=je.LTR,this.visibleRanges=[],this.mustEnforceCursorAssoc=!1;let n=t.facet(ix).some((i)=>typeof i!="function"&&i.class=="cm-lineWrapping");this.heightOracle=new X2(n),this.stateDeco=IM(t),this.heightMap=Gt.empty().applyChanges(this.stateDeco,de.empty,this.heightOracle.setDoc(t.doc),[new Xn(0,0,0,t.doc.length)]);for(let i=0;i<2;i++)if(this.viewport=this.getViewport(0,null),!this.updateForViewport())break;this.updateViewportLines(),this.lineGaps=this.ensureLineGaps([]),this.lineGapDeco=Oe.set(this.lineGaps.map((i)=>i.draw(this,!1))),this.scrollParent=e.scrollDOM,this.computeVisibleRanges()}updateForViewport(){let e=[this.viewport],{main:t}=this.state.selection;for(let n=0;n<=1;n++){let i=n?t.head:t.anchor;if(!e.some(({from:r,to:o})=>i>=r&&i<=o)){let{from:r,to:o}=this.lineBlockAt(i);e.push(new Uc(r,o))}}return this.viewports=e.sort((n,i)=>n.from-i.from),this.updateScaler()}updateScaler(){let e=this.scaler;return this.scaler=this.heightMap.height<=7000000?PM:new ux(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(jc(e,this.scaler))})}update(e,t=null){this.state=e.state;let n=this.stateDeco;this.stateDeco=IM(this.state);let i=e.changedRanges,r=Xn.extendWithRanges(i,F6(n,this.stateDeco,e?e.changes:ot.empty(this.state.doc.length))),o=this.heightMap.height,s=this.scrolledToBottom?null:this.scrollAnchorAt(this.scrollOffset);if(zM(),this.heightMap=this.heightMap.applyChanges(this.stateDeco,e.startState.doc,this.heightOracle.setDoc(this.state.doc),r),this.heightMap.height!=o||za)e.flags|=2;if(s)this.scrollAnchorPos=e.changes.mapPos(s.from,-1),this.scrollAnchorHeight=s.top;else this.scrollAnchorPos=-1,this.scrollAnchorHeight=o;let l=r.length?this.mapViewport(this.viewport,e.changes):this.viewport;if(t&&(t.range.head<l.from||t.range.head>l.to)||!this.viewportIsAppropriate(l))l=this.getViewport(0,t);let a=l.from!=this.viewport.from||l.to!=this.viewport.to;if(this.viewport=l,e.flags|=this.updateForViewport(),a||!e.changes.empty||e.flags&2)this.updateViewportLines();if(this.lineGaps.length||this.viewport.to-this.viewport.from>4000)this.updateLineGaps(this.ensureLineGaps(this.mapLineGaps(this.lineGaps,e.changes)));if(e.flags|=this.computeVisibleRanges(e.changes),t)this.scrollTarget=t;if(!this.mustEnforceCursorAssoc&&(e.selectionSet||e.focusChanged)&&e.view.lineWrapping&&e.state.selection.main.empty&&e.state.selection.main.assoc&&!e.state.facet(e6))this.mustEnforceCursorAssoc=!0}measure(){let{view:e}=this,t=e.contentDOM,n=window.getComputedStyle(t),i=this.heightOracle,r=n.whiteSpace;this.defaultTextDirection=n.direction=="rtl"?je.RTL:je.LTR;let o=this.heightOracle.mustRefreshForWrapping(r)||this.mustMeasureContent==="refresh",s=t.getBoundingClientRect(),l=o||this.mustMeasureContent||this.contentDOMHeight!=s.height;this.contentDOMHeight=s.height,this.mustMeasureContent=!1;let a=0,u=0;if(s.width&&s.height){let{scaleX:S,scaleY:k}=GM(t,s);if(S>0.005&&Math.abs(this.scaleX-S)>0.005||k>0.005&&Math.abs(this.scaleY-k)>0.005)this.scaleX=S,this.scaleY=k,a|=16,o=l=!0}let c=(parseInt(n.paddingTop)||0)*this.scaleY,f=(parseInt(n.paddingBottom)||0)*this.scaleY;if(this.paddingTop!=c||this.paddingBottom!=f)this.paddingTop=c,this.paddingBottom=f,a|=18;if(this.editorWidth!=e.scrollDOM.clientWidth){if(i.lineWrapping)l=!0;this.editorWidth=e.scrollDOM.clientWidth,a|=16}let d=YM(this.view.contentDOM,!1).y;if(d!=this.scrollParent)this.scrollParent=d,this.scrollAnchorHeight=-1,this.scrollOffset=0;let h=this.getScrollOffset();if(this.scrollOffset!=h)this.scrollAnchorHeight=-1,this.scrollOffset=h;this.scrolledToBottom=e2(this.scrollParent||e.win);let m=(this.printing?X6:q6)(t,this.paddingTop),b=m.top-this.pixelViewport.top,x=m.bottom-this.pixelViewport.bottom;this.pixelViewport=m;let g=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left;if(g!=this.inView){if(this.inView=g,g)l=!0}if(!this.inView&&!this.scrollTarget&&!$6(e.dom))return 0;let v=s.width;if(this.contentDOMWidth!=v||this.editorHeight!=e.scrollDOM.clientHeight)this.contentDOMWidth=s.width,this.editorHeight=e.scrollDOM.clientHeight,a|=16;if(l){let S=e.docView.measureVisibleLineHeights(this.viewport);if(i.mustRefreshForHeights(S))o=!0;if(o||i.lineWrapping&&Math.abs(v-this.contentDOMWidth)>i.charWidth){let{lineHeight:k,charWidth:E,textHeight:_}=e.docView.measureTextSize();if(o=k>0&&i.refresh(r,k,E,_,Math.max(5,v/E),S),o)e.docView.minWidth=0,a|=16}if(b>0&&x>0)u=Math.max(b,x);else if(b<0&&x<0)u=Math.min(b,x);zM();for(let k of this.viewports){let E=k.from==this.viewport.from?S:e.docView.measureVisibleLineHeights(k);this.heightMap=(o?Gt.empty().applyChanges(this.stateDeco,de.empty,this.heightOracle,[new Xn(0,0,0,e.state.doc.length)]):this.heightMap).updateHeight(i,0,o,new G2(k.from,E))}if(za)a|=2}let w=!this.viewportIsAppropriate(this.viewport,u)||this.scrollTarget&&(this.scrollTarget.range.head<this.viewport.from||this.scrollTarget.range.head>this.viewport.to);if(w){if(a&2)a|=this.updateScaler();this.viewport=this.getViewport(u,this.scrollTarget),a|=this.updateForViewport()}if(a&2||w)this.updateViewportLines();if(this.lineGaps.length||this.viewport.to-this.viewport.from>4000)this.updateLineGaps(this.ensureLineGaps(o?[]:this.lineGaps,e));if(a|=this.computeVisibleRanges(),this.mustEnforceCursorAssoc)this.mustEnforceCursorAssoc=!1,e.docView.enforceCursorAssoc();return a}get visibleTop(){return this.scaler.fromDOM(this.pixelViewport.top)}get visibleBottom(){return this.scaler.fromDOM(this.pixelViewport.bottom)}getViewport(e,t){let n=0.5-Math.max(-0.5,Math.min(0.5,e/1000/2)),i=this.heightMap,r=this.heightOracle,{visibleTop:o,visibleBottom:s}=this,l=new Uc(i.lineAt(o-n*1000,Ve.ByHeight,r,0,0).from,i.lineAt(s+(1-n)*1000,Ve.ByHeight,r,0,0).to);if(t){let{head:a}=t.range;if(a<l.from||a>l.to){let u=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),c=i.lineAt(a,Ve.ByPos,r,0,0),f;if(t.y=="center")f=(c.top+c.bottom)/2-u/2;else if(t.y=="start"||t.y=="nearest"&&a<l.from)f=c.top;else f=c.bottom-u;l=new Uc(i.lineAt(f-500,Ve.ByHeight,r,0,0).from,i.lineAt(f+u+500,Ve.ByHeight,r,0,0).to)}}return l}mapViewport(e,t){let n=t.mapPos(e.from,-1),i=t.mapPos(e.to,1);return new Uc(this.heightMap.lineAt(n,Ve.ByPos,this.heightOracle,0,0).from,this.heightMap.lineAt(i,Ve.ByPos,this.heightOracle,0,0).to)}viewportIsAppropriate({from:e,to:t},n=0){if(!this.inView)return!0;let{top:i}=this.heightMap.lineAt(e,Ve.ByPos,this.heightOracle,0,0),{bottom:r}=this.heightMap.lineAt(t,Ve.ByPos,this.heightOracle,0,0),{visibleTop:o,visibleBottom:s}=this;return(e==0||i<=o-Math.max(10,Math.min(-n,250)))&&(t==this.state.doc.length||r>=s+Math.max(10,Math.min(n,250)))&&(i>o-2000&&r<s+2000)}mapLineGaps(e,t){if(!e.length||t.empty)return e;let n=[];for(let i of e)if(!t.touchesRange(i.from,i.to))n.push(new Np(t.mapPos(i.from),t.mapPos(i.to),i.size,i.displaySize));return n}ensureLineGaps(e,t){let n=this.heightOracle.lineWrapping,i=n?1e4:2000,r=i>>1,o=i<<1;if(this.defaultTextDirection!=je.LTR&&!n)return[];let s=[],l=(u,c,f,d)=>{if(c-u<r)return;let h=this.state.selection.main,m=[h.from];if(!h.empty)m.push(h.to);for(let x of m)if(x>u&&x<c){l(u,x-10,f,d),l(x+10,c,f,d);return}let b=Y6(e,(x)=>x.from>=f.from&&x.to<=f.to&&Math.abs(x.from-u)<r&&Math.abs(x.to-c)<r&&!m.some((g)=>x.from<g&&x.to>g));if(!b){if(c<f.to&&t&&n&&t.visibleRanges.some((v)=>v.from<=c&&v.to>=c)){let v=t.moveToLineBoundary(R.cursor(c),!1,!0).head;if(v>u)c=v}let x=this.gapSize(f,u,c,d),g=n||x<2000000?x:2000000;b=new Np(u,c,x,g)}s.push(b)},a=(u)=>{if(u.length<o||u.type!=Gn.Text)return;let c=G6(u.from,u.to,this.stateDeco);if(c.total<o)return;let f=this.scrollTarget?this.scrollTarget.range.head:null,d,h;if(n){let m=i/this.heightOracle.lineLength*this.heightOracle.lineHeight,b,x;if(f!=null){let g=Cp(c,f),v=((this.visibleBottom-this.visibleTop)/2+m)/u.height;b=g-v,x=g+v}else b=(this.visibleTop-u.top-m)/u.height,x=(this.visibleBottom-u.top+m)/u.height;d=_p(c,b),h=_p(c,x)}else{let m=c.total*this.heightOracle.charWidth,b=i*this.heightOracle.charWidth,x=0;if(m>2000000){for(let k of e)if(k.from>=u.from&&k.from<u.to&&k.size!=k.displaySize&&k.from*this.heightOracle.charWidth+x<this.pixelViewport.left)x=k.size-k.displaySize}let g=this.pixelViewport.left+x,v=this.pixelViewport.right+x,w,S;if(f!=null){let k=Cp(c,f),E=((v-g)/2+b)/m;w=k-E,S=k+E}else w=(g-b)/m,S=(v+b)/m;d=_p(c,w),h=_p(c,S)}if(d>u.from)l(u.from,d,u,c);if(h<u.to)l(h,u.to,u,c)};for(let u of this.viewportLines)if(Array.isArray(u.type))u.type.forEach(a);else a(u);return s}gapSize(e,t,n,i){let r=Cp(i,n)-Cp(i,t);if(this.heightOracle.lineWrapping)return e.height*r;else return i.total*this.heightOracle.charWidth*r}updateLineGaps(e){if(!Np.same(e,this.lineGaps))this.lineGaps=e,this.lineGapDeco=Oe.set(e.map((t)=>t.draw(this,this.heightOracle.lineWrapping)))}computeVisibleRanges(e){let t=this.stateDeco;if(this.lineGaps.length)t=t.concat(this.lineGapDeco);let n=[];ge.spans(t,this.viewport.from,this.viewport.to,{span(r,o){n.push({from:r,to:o})},point(){}},20);let i=0;if(n.length!=this.visibleRanges.length)i=12;else for(let r=0;r<n.length&&!(i&8);r++){let o=this.visibleRanges[r],s=n[r];if(o.from!=s.from||o.to!=s.to){if(i|=4,!(e&&e.mapPos(o.from,-1)==s.from&&e.mapPos(o.to,1)==s.to))i|=8}}return this.visibleRanges=n,i}lineBlockAt(e){return e>=this.viewport.from&&e<=this.viewport.to&&this.viewportLines.find((t)=>t.from<=e&&t.to>=e)||jc(this.heightMap.lineAt(e,Ve.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)||jc(this.heightMap.lineAt(this.scaler.fromDOM(e),Ve.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+8);return t.from>=this.viewport.from||this.viewportLines[0].top-e>200?t:this.viewportLines[0]}elementAtHeight(e){return jc(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 Uc{constructor(e,t){this.from=e,this.to=t}}function G6(e,t,n){let i=[],r=e,o=0;if(ge.spans(n,e,t,{span(){},point(s,l){if(s>r)i.push({from:r,to:s}),o+=s-r;r=l}},20),r<t)i.push({from:r,to:t}),o+=t-r;return{total:o,ranges:i}}function _p({total:e,ranges:t},n){if(n<=0)return t[0].from;if(n>=1)return t[t.length-1].to;let i=Math.floor(e*n);for(let r=0;;r++){let{from:o,to:s}=t[r],l=s-o;if(i<=l)return o+i;i-=l}}function Cp(e,t){let n=0;for(let{from:i,to:r}of e.ranges){if(t<=r){n+=t-i;break}n+=r-i}return n/e.total}function Y6(e,t){for(let n of e)if(t(n))return n;return}var PM={toDOM(e){return e},fromDOM(e){return e},scale:1,eq(e){return e==this}};function IM(e){let t=e.facet(Up).filter((i)=>typeof i!="function"),n=e.facet(rx).filter((i)=>typeof i!="function");if(n.length)t.push(ge.join(n));return t}class ux{constructor(e,t,n){let i=0,r=0,o=0;this.viewports=n.map(({from:s,to:l})=>{let a=t.lineAt(s,Ve.ByPos,e,0,0).top,u=t.lineAt(l,Ve.ByPos,e,0,0).bottom;return i+=u-a,{from:s,to:l,top:a,bottom:u,domTop:0,domBottom:0}}),this.scale=(7000000-i)/(t.height-i);for(let s of this.viewports)s.domTop=o+(s.top-r)*this.scale,o=s.domBottom=s.domTop+(s.bottom-s.top),r=s.bottom}toDOM(e){for(let t=0,n=0,i=0;;t++){let r=t<this.viewports.length?this.viewports[t]:null;if(!r||e<r.top)return i+(e-n)*this.scale;if(e<=r.bottom)return r.domTop+(e-r.top);n=r.bottom,i=r.domBottom}}fromDOM(e){for(let t=0,n=0,i=0;;t++){let r=t<this.viewports.length?this.viewports[t]:null;if(!r||e<r.domTop)return n+(e-i)/this.scale;if(e<=r.domBottom)return r.top+(e-r.domTop);n=r.bottom,i=r.domBottom}}eq(e){if(!(e instanceof ux))return!1;return this.scale==e.scale&&this.viewports.length==e.viewports.length&&this.viewports.every((t,n)=>t.from==e.viewports[n].from&&t.to==e.viewports[n].to)}}function jc(e,t){if(t.scale==1)return e;let n=t.toDOM(e.top),i=t.toDOM(e.bottom);return new yi(e.from,e.length,n,i-n,Array.isArray(e._content)?e._content.map((r)=>jc(r,t)):e._content)}var Ep=J.define({combine:(e)=>e.join(" ")}),Gy=J.define({combine:(e)=>e.indexOf(!0)>-1}),Yy=vi.newName(),J2=vi.newName(),Z2=vi.newName(),eN={"&light":"."+J2,"&dark":"."+Z2};function Wy(e,t,n){return new vi(t,{finish(i){return/&/.test(i)?i.replace(/&\w*/,(r)=>{if(r=="&")return e;if(!n||!n[r])throw RangeError(`Unsupported selector: ${r}`);return n[r]}):e+" "+i}})}var W6=Wy("."+Yy,{"&":{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:"text-top",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,<svg xmlns="http://www.w3.org/2000/svg" width="200" height="20"><path stroke="%23888" stroke-width="1" fill="none" d="M1 10H196L190 5M190 15L196 10M197 4L197 16"/></svg>')`,backgroundSize:"auto 100%",backgroundPosition:"right 90%",backgroundRepeat:"no-repeat"},".cm-trailingSpace":{backgroundColor:"#ff332255"},".cm-button":{verticalAlign:"middle",color:"inherit",fontSize:"70%",padding:".2em 1em",borderRadius:"1px"},"&light .cm-button":{backgroundImage:"linear-gradient(#eff1f5, #d9d9df)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#b4b4b4, #d0d3d6)"}},"&dark .cm-button":{backgroundImage:"linear-gradient(#393939, #111)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#111, #333)"}},".cm-textfield":{verticalAlign:"middle",color:"inherit",fontSize:"70%",border:"1px solid silver",padding:".2em .5em"},"&light .cm-textfield":{backgroundColor:"white"},"&dark .cm-textfield":{border:"1px solid #555",backgroundColor:"inherit"}},eN),Q6={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},My=K.ie&&K.ie_version<=11;class tN{constructor(e){if(this.view=e,this.active=!1,this.editContext=null,this.selectionRange=new WM,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 n of t)this.queue.push(n);if((K.ie&&K.ie_version<=11||K.ios&&e.composing)&&t.some((n)=>n.type=="childList"&&n.removedNodes.length||n.type=="characterData"&&n.oldValue.length>n.target.nodeValue.length))this.flushSoon();else this.flush()}),window.EditContext&&K.android&&e.constructor.EDIT_CONTEXT!==!1&&!(K.chrome&&K.chrome_version<126)){if(this.editContext=new nN(e),e.state.facet(Ir))e.contentDOM.editContext=this.editContext.editContext}if(My)this.onCharData=(t)=>{this.queue.push({target:t.target,type:"characterData",oldValue:t.prevValue}),this.flushSoon()};if(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");if(typeof ResizeObserver=="function")this.resizeScroll=new ResizeObserver(()=>{var t;if(((t=this.view.docView)===null||t===void 0?void 0:t.lastUpdate)<Date.now()-75)this.onResize()}),this.resizeScroll.observe(e.scrollDOM);if(this.addWindowListeners(this.win=e.win),this.start(),typeof IntersectionObserver=="function")this.intersection=new IntersectionObserver((t)=>{if(this.parentCheck<0)this.parentCheck=setTimeout(this.listenForScroll.bind(this),1000);if(t.length>0&&t[t.length-1].intersectionRatio>0!=this.intersecting){if(this.intersecting=!this.intersecting,this.intersecting!=this.view.inView)this.onScrollChanged(document.createEvent("Event"))}},{threshold:[0,0.001]}),this.intersection.observe(this.dom),this.gapIntersection=new IntersectionObserver((t)=>{if(t.length>0&&t[t.length-1].intersectionRatio>0)this.onScrollChanged(document.createEvent("Event"))},{});this.listenForScroll(),this.readSelectionRange()}onScrollChanged(e){if(this.view.inputState.runHandlers("scroll",e),this.intersecting)this.view.measure()}onScroll(e){if(this.intersecting)this.flush(!1);if(this.editContext)this.view.requestMeasure(this.editContext.measureReq);this.onScrollChanged(e)}onResize(){if(this.resizeTimeout<0)this.resizeTimeout=setTimeout(()=>{this.resizeTimeout=-1,this.view.requestMeasure()},50)}onPrint(e){if((e.type=="change"||!e.type)&&!e.matches)return;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,n)=>t!=e[n]))){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:n}=this,i=this.selectionRange;if(n.state.facet(Ir)?n.root.activeElement!=this.dom:!Kc(this.dom,i))return;let r=i.anchorNode&&n.docView.tile.nearest(i.anchorNode);if(r&&r.isWidget()&&r.widget.ignoreEvent(e)){if(!t)this.selectionChanged=!1;return}if((K.ie&&K.ie_version<=11||K.android&&K.chrome)&&!n.state.selection.main.empty&&i.focusNode&&qc(i.focusNode,i.focusOffset,i.anchorNode,i.anchorOffset))this.flushSoon();else this.flush(!1)}readSelectionRange(){let{view:e}=this,t=Gc(e.root);if(!t)return!1;let n=K.safari&&e.root.nodeType==11&&e.root.activeElement==this.dom&&J6(this.view,t)||t;if(!n||this.selectionRange.eq(n))return!1;let i=Kc(this.dom,n);if(i&&!this.selectionChanged&&e.inputState.lastFocusTime>Date.now()-200&&e.inputState.lastTouchTime<Date.now()-300&&F8(this.dom,n))return this.view.inputState.lastFocusTime=0,e.docView.updateSelection(),!1;if(this.selectionRange.setRange(n),i)this.selectionChanged=!0;return!0}setSelectionRange(e,t){this.selectionRange.set(e.node,e.offset,t.node,t.offset),this.selectionChanged=!1}clearSelectionRange(){this.selectionRange.set(null,0,null,0)}listenForScroll(){this.parentCheck=-1;let e=0,t=null;for(let n=this.dom;n;)if(n.nodeType==1){if(!t&&e<this.scrollTargets.length&&this.scrollTargets[e]==n)e++;else if(!t)t=this.scrollTargets.slice(0,e);if(t)t.push(n);n=n.assignedSlot||n.parentNode}else if(n.nodeType==11)n=n.host;else break;if(e<this.scrollTargets.length&&!t)t=this.scrollTargets.slice(0,e);if(t){for(let n of this.scrollTargets)n.removeEventListener("scroll",this.onScroll);for(let n of this.scrollTargets=t)n.addEventListener("scroll",this.onScroll)}}ignore(e){if(!this.active)return e();try{return this.stop(),e()}finally{this.start(),this.clear()}}start(){if(this.active)return;if(this.observer.observe(this.dom,Q6),My)this.dom.addEventListener("DOMCharacterDataModified",this.onCharData);this.active=!0}stop(){if(!this.active)return;if(this.active=!1,this.observer.disconnect(),My)this.dom.removeEventListener("DOMCharacterDataModified",this.onCharData)}clear(){this.processRecords(),this.queue.length=0,this.selectionChanged=!1}delayAndroidKey(e,t){var n;if(!this.delayedAndroidKey){let i=()=>{let r=this.delayedAndroidKey;if(r){if(this.clearDelayedAndroidKey(),this.view.inputState.lastKeyCode=r.keyCode,this.view.inputState.lastKeyTime=Date.now(),!this.flush()&&r.force)Na(this.dom,r.key,r.keyCode)}};this.flushingAndroidKey=this.view.win.requestAnimationFrame(i)}if(!this.delayedAndroidKey||e=="Enter")this.delayedAndroidKey={key:e,keyCode:t,force:this.lastChange<Date.now()-50||!!((n=this.delayedAndroidKey)===null||n===void 0?void 0:n.force)}}clearDelayedAndroidKey(){this.win.cancelAnimationFrame(this.flushingAndroidKey),this.delayedAndroidKey=null,this.flushingAndroidKey=-1}flushSoon(){if(this.delayedFlush<0)this.delayedFlush=this.view.win.requestAnimationFrame(()=>{this.delayedFlush=-1,this.flush()})}forceFlush(){if(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();if(e.length)this.queue=[];let t=-1,n=-1,i=!1;for(let r of e){let o=this.readMutation(r);if(!o)continue;if(o.typeOver)i=!0;if(t==-1)({from:t,to:n}=o);else t=Math.min(o.from,t),n=Math.max(o.to,n)}return{from:t,to:n,typeOver:i}}readChange(){let{from:e,to:t,typeOver:n}=this.processRecords(),i=this.selectionChanged&&Kc(this.dom,this.selectionRange);if(e<0&&!i)return null;if(e>-1)this.lastChange=Date.now();this.view.inputState.lastFocusTime=0,this.selectionChanged=!1;let r=new D2(this.view,e,t,n);return this.view.docView.domChanged={newSel:r.newSel?r.newSel.main:null},r}flush(e=!0){if(this.delayedFlush>=0||this.delayedAndroidKey)return!1;if(e)this.readSelectionRange();let t=this.readChange();if(!t)return this.view.requestMeasure(),!1;let n=this.view.state,i=z2(this.view,t);if(this.view.state==n&&(t.domChanged||t.newSel&&!Pp(this.view.state.selection,t.newSel.main)))this.view.update([]);return i}readMutation(e){let t=this.view.docView.tile.nearest(e.target);if(!t||t.isWidget())return null;if(t.markDirty(e.type=="attributes"),e.type=="childList"){let n=VM(t,e.previousSibling||e.target.previousSibling,-1),i=VM(t,e.nextSibling||e.target.nextSibling,1);return{from:n?t.posAfter(n):t.posAtStart,to:i?t.posBefore(i):t.posAtEnd,typeOver:!1}}else if(e.type=="characterData")return{from:t.posAtStart,to:t.posAtEnd,typeOver:e.target.nodeValue==e.oldValue};else return null}setWindow(e){if(e!=this.win)this.removeWindowListeners(this.win),this.win=e,this.addWindowListeners(this.win)}addWindowListeners(e){if(e.addEventListener("resize",this.onResize),this.printQuery)if(this.printQuery.addEventListener)this.printQuery.addEventListener("change",this.onPrint);else this.printQuery.addListener(this.onPrint);else e.addEventListener("beforeprint",this.onPrint);e.addEventListener("scroll",this.onScroll),e.document.addEventListener("selectionchange",this.onSelectionChange)}removeWindowListeners(e){if(e.removeEventListener("scroll",this.onScroll),e.removeEventListener("resize",this.onResize),this.printQuery)if(this.printQuery.removeEventListener)this.printQuery.removeEventListener("change",this.onPrint);else this.printQuery.removeListener(this.onPrint);else e.removeEventListener("beforeprint",this.onPrint);e.document.removeEventListener("selectionchange",this.onSelectionChange)}update(e){if(this.editContext){if(this.editContext.update(e),e.startState.facet(Ir)!=e.state.facet(Ir))e.view.contentDOM.editContext=e.state.facet(Ir)?this.editContext.editContext:null}}destroy(){var e,t,n;this.stop(),(e=this.intersection)===null||e===void 0||e.disconnect(),(t=this.gapIntersection)===null||t===void 0||t.disconnect(),(n=this.resizeScroll)===null||n===void 0||n.disconnect();for(let i of this.scrollTargets)i.removeEventListener("scroll",this.onScroll);if(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 VM(e,t,n){while(t){let i=Ye.get(t);if(i&&i.parent==e)return i;let r=t.parentNode;t=r!=e.dom?r:n>0?t.nextSibling:t.previousSibling}return null}function HM(e,t){let{startContainer:n,startOffset:i,endContainer:r,endOffset:o}=t,s=e.docView.domAtPos(e.state.selection.main.anchor,1);if(qc(s.node,s.offset,r,o))[n,i,r,o]=[r,o,n,i];return{anchorNode:n,anchorOffset:i,focusNode:r,focusOffset:o}}function J6(e,t){if(t.getComposedRanges){let r=t.getComposedRanges(e.root)[0];if(r)return HM(e,r)}let n=null;function i(r){r.preventDefault(),r.stopImmediatePropagation(),n=r.getTargetRanges()[0]}return e.contentDOM.addEventListener("beforeinput",i,!0),e.dom.ownerDocument.execCommand("indent"),e.contentDOM.removeEventListener("beforeinput",i,!0),n?HM(e,n):null}class nN{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=(n)=>{let i=e.state.selection.main,{anchor:r,head:o}=i,s=this.toEditorPos(n.updateRangeStart),l=this.toEditorPos(n.updateRangeEnd);if(e.inputState.composing>=0&&!this.composing)this.composing={contextBase:n.updateRangeStart,editorBase:s,drifted:!1};let a=l-s>n.text.length;if(s==this.from&&r<this.from)s=r;else if(l==this.to&&r>this.to)l=r;let u=B2(e.state.sliceDoc(s,l),n.text,(a?i.from:i.to)-s,a?"end":null);if(!u){let f=R.single(this.toEditorPos(n.selectionStart),this.toEditorPos(n.selectionEnd));if(!Pp(f,i))e.dispatch({selection:f,userEvent:"select"});return}let c={from:u.from+s,to:u.toA+s,insert:de.of(n.text.slice(u.from,u.toB).split(`
33
- `))};if((K.mac||K.android)&&c.from==o-1&&/^\. ?$/.test(n.text)&&e.contentDOM.getAttribute("autocorrect")=="off")c={from:s,to:l,insert:de.of([n.text.replace("."," ")])};if(this.pendingContextChange=c,!e.state.readOnly){let f=this.to-this.from+(c.to-c.from+c.insert.length);sx(e,c,R.single(this.toEditorPos(n.selectionStart,f),this.toEditorPos(n.selectionEnd,f)))}if(this.pendingContextChange)this.revertPending(e.state),this.setSelection(e.state);if(c.from<c.to&&!c.insert.length&&e.inputState.composing>=0&&!/[\\p{Alphabetic}\\p{Number}_]/.test(t.text.slice(Math.max(0,n.updateRangeStart-1),Math.min(t.text.length,n.updateRangeStart+1))))this.handlers.compositionend(n)},this.handlers.characterboundsupdate=(n)=>{let i=[],r=null;for(let o=this.toEditorPos(n.rangeStart),s=this.toEditorPos(n.rangeEnd);o<s;o++){let l=e.coordsForChar(o);r=l&&new DOMRect(l.left,l.top,l.right-l.left,l.bottom-l.top)||r||new DOMRect,i.push(r)}t.updateCharacterBounds(n.rangeStart,i)},this.handlers.textformatupdate=(n)=>{let i=[];for(let r of n.getTextFormats()){let{underlineStyle:o,underlineThickness:s}=r;if(!/none/i.test(o)&&!/none/i.test(s)){let l=this.toEditorPos(r.rangeStart),a=this.toEditorPos(r.rangeEnd);if(l<a){let u=`text-decoration: underline ${/^[a-z]/.test(o)?o+" ":o=="Dashed"?"dashed ":o=="Squiggle"?"wavy ":""}${/thin/i.test(s)?1:2}px`;i.push(Oe.mark({attributes:{style:u}}).range(l,a))}}}e.dispatch({effects:g2.of(Oe.set(i))})},this.handlers.compositionstart=()=>{if(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:n}=this.composing;if(this.composing=null,n)this.reset(e.state)}};for(let n in this.handlers)t.addEventListener(n,this.handlers[n]);this.measureReq={read:(n)=>{let i=Gc(n.root);if(i&&i.rangeCount)this.editContext.updateSelectionBounds(i.getRangeAt(0).getBoundingClientRect())}}}applyEdits(e){let t=0,n=!1,i=this.pendingContextChange;if(e.changes.iterChanges((r,o,s,l,a)=>{if(n)return;let u=a.length-(o-r);if(i&&o>=i.to)if(i.from==r&&i.to==o&&i.insert.eq(a)){i=this.pendingContextChange=null,t+=u,this.to+=u;return}else i=null,this.revertPending(e.state);if(r+=t,o+=t,o<=this.from)this.from+=u,this.to+=u;else if(r<this.to){if(r<this.from||o>this.to||this.to-this.from+a.length>30000){n=!0;return}this.editContext.updateText(this.toContextPos(r),this.toContextPos(o),a.toString()),this.to+=u}t+=u}),i&&!n)this.revertPending(e.state);return!n}update(e){let t=this.pendingContextChange,n=e.startState.selection.main;if(this.composing&&(this.composing.drifted||!e.changes.touchesRange(n.from,n.to)&&e.transactions.some((i)=>!i.isUserEvent("input.type")&&i.changes.touchesRange(this.from,this.to))))this.composing.drifted=!0,this.composing.editorBase=e.changes.mapPos(this.composing.editorBase);else if(!this.applyEdits(e)||!this.rangeIsValid(e.state))this.pendingContextChange=null,this.reset(e.state);else if(e.docChanged||e.selectionSet||t)this.setSelection(e.state);if(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,n=this.toContextPos(Math.max(this.from,Math.min(this.to,t.anchor))),i=this.toContextPos(t.head);if(this.editContext.selectionStart!=n||this.editContext.selectionEnd!=i)this.editContext.updateSelection(n,i)}rangeIsValid(e){let{head:t}=e.selection.main;return!(this.from>0&&t-this.from<500||this.to<e.doc.length&&this.to-t<500||this.to-this.from>30000)}toEditorPos(e,t=this.to-this.from){e=Math.min(e,t);let n=this.composing;return n&&n.drifted?n.editorBase+(e-n.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 W{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;if(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:n}=e;if(this.dispatchTransactions=e.dispatchTransactions||n&&((i)=>i.forEach((r)=>n(r,this)))||((i)=>this.update(i)),this.dispatch=this.dispatch.bind(this),this._root=e.root||K8(e.parent)||document,this.viewState=new Xy(this,e.state||pe.create(e)),e.scrollTo&&e.scrollTo.is(wp))this.viewState.scrollTarget=e.scrollTo.value.clip(this.viewState.state);this.plugins=this.state.facet(Ta).map((i)=>new Rp(i));for(let i of this.plugins)i.update(this);if(this.observer=new tN(this),this.inputState=new P2(this),this.inputState.ensureHandlers(this.plugins),this.docView=new jy(this),this.mountStyles(),this.updateAttrs(),this.updateState=0,this.requestMeasure(),(t=document.fonts)===null||t===void 0?void 0:t.ready)document.fonts.ready.then(()=>{this.viewState.mustMeasureContent="refresh",this.requestMeasure()})}dispatch(...e){let t=e.length==1&&e[0]instanceof Ze?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 Error("Calls to EditorView.update are not allowed while an update is in progress");let t=!1,n=!1,i,r=this.state;for(let f of e){if(f.startState!=r)throw RangeError("Trying to update state with a transaction that doesn't start from the previous state.");r=f.state}if(this.destroyed){this.viewState.state=r;return}let o=this.hasFocus,s=0,l=null;if(e.some((f)=>f.annotation(F2)))this.inputState.notifiedFocused=o,s=1;else if(o!=this.inputState.notifiedFocused){if(this.inputState.notifiedFocused=o,l=q2(r,o),!l)s=1}let a=this.observer.delayedAndroidKey,u=null;if(a){if(this.observer.clearDelayedAndroidKey(),u=this.observer.readChange(),u&&!this.state.doc.eq(r.doc)||!this.state.selection.eq(r.selection))u=null}else this.observer.clear();if(r.facet(pe.phrases)!=this.state.facet(pe.phrases))return this.setState(r);i=zp.create(this,r,e),i.flags|=s;let c=this.viewState.scrollTarget;try{this.updateState=2;for(let f of e){if(c)c=c.map(f.changes);if(f.scrollIntoView){let{main:d}=f.state.selection,{x:h,y:m}=this.state.facet(W.cursorScrollMargin);c=new Da(d.empty?d:R.cursor(d.head,d.head>d.anchor?-1:1),"nearest","nearest",m,h)}for(let d of f.effects)if(d.is(wp))c=d.value.clip(this.state)}if(this.viewState.update(i,c),this.bidiCache=Vp.update(this.bidiCache,i.changes),!i.empty)this.updatePlugins(i),this.inputState.update(i);if(t=this.docView.update(i),this.state.facet(Hc)!=this.styleModules)this.mountStyles();n=this.updateAttrs(),this.showAnnouncements(e),this.docView.updateSelection(t,e.some((f)=>f.isUserEvent("select.pointer")))}finally{this.updateState=0}if(i.startState.facet(Ep)!=i.state.facet(Ep))this.viewState.mustMeasureContent=!0;if(t||n||c||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)this.requestMeasure();if(t)this.docViewUpdate();if(!i.empty)for(let f of this.state.facet(Uy))try{f(i)}catch(d){Xt(this.state,d,"update listener")}if(l||u)Promise.resolve().then(()=>{if(l&&this.state==l.startState)this.dispatch(l);if(u){if(!z2(this,u)&&a.force)Na(this.contentDOM,a.key,a.keyCode)}})}setState(e){if(this.updateState!=0)throw 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 n of this.plugins)n.destroy(this);this.viewState=new Xy(this,e),this.plugins=e.facet(Ta).map((n)=>new Rp(n)),this.pluginMap.clear();for(let n of this.plugins)n.update(this);this.docView.destroy(),this.docView=new jy(this),this.inputState.ensureHandlers(this.plugins),this.mountStyles(),this.updateAttrs(),this.bidiCache=[]}finally{this.updateState=0}if(t)this.focus();this.requestMeasure()}updatePlugins(e){let t=e.startState.facet(Ta),n=e.state.facet(Ta);if(t!=n){let i=[];for(let r of n){let o=t.indexOf(r);if(o<0)i.push(new Rp(r));else{let s=this.plugins[o];s.mustUpdate=e,i.push(s)}}for(let r of this.plugins)if(r.mustUpdate!=e)r.destroy(this);this.plugins=i,this.pluginMap.clear()}else for(let i of this.plugins)i.mustUpdate=e;for(let i=0;i<this.plugins.length;i++)this.plugins[i].update(this);if(t!=n)this.inputState.ensureHandlers(this.plugins)}docViewUpdate(){for(let e of this.plugins){let t=e.value;if(t&&t.docViewUpdate)try{t.docViewUpdate(this)}catch(n){Xt(this.state,n,"doc view update listener")}}}measure(e=!0){if(this.destroyed)return;if(this.measureScheduled>-1)this.win.cancelAnimationFrame(this.measureScheduled);if(this.observer.delayedAndroidKey){this.measureScheduled=-1,this.requestMeasure();return}if(this.measureScheduled=0,e)this.observer.forceFlush();let t=null,n=this.viewState.scrollParent,i=this.viewState.getScrollOffset(),{scrollAnchorPos:r,scrollAnchorHeight:o,scaleY:s}=this.viewState;if(Math.abs(i-this.viewState.scrollOffset)>1)o=-1;this.viewState.scrollAnchorHeight=-1;try{for(let l=0;;l++){if(o<0){if(e2(n||this.win))r=-1,o=this.viewState.heightMap.height/this.viewState.scaleY;else{let h=this.viewState.scrollAnchorAt(i);r=h.from,o=h.top}s=this.viewState.scaleY}this.updateState=1;let a=this.viewState.measure();if(!a&&!this.measureRequests.length&&this.viewState.scrollTarget==null)break;if(l>5){console.warn(this.measureRequests.length?"Measure loop restarted more than 5 times":"Viewport failed to stabilize");break}let u=[];if(!(a&4))[this.measureRequests,u]=[u,this.measureRequests];let c=u.map((h)=>{try{return h.read(this)}catch(m){return Xt(this.state,m),UM}}),f=zp.create(this,this.state,[]),d=!1;if(f.flags|=a,!t)t=f;else t.flags|=a;if(this.updateState=2,!f.empty){if(this.updatePlugins(f),this.inputState.update(f),this.updateAttrs(),d=this.docView.update(f),d)this.docViewUpdate()}for(let h=0;h<u.length;h++)if(c[h]!=UM)try{let m=u[h];if(m.write)m.write(c[h],this)}catch(m){Xt(this.state,m)}if(d)this.docView.updateSelection(!0);if(!f.viewportChanged&&this.measureRequests.length==0){if(this.viewState.editorHeight)if(this.viewState.scrollTarget){this.docView.scrollIntoView(this.viewState.scrollTarget),this.viewState.scrollTarget=null,o=-1;continue}else{let m=(r<0?this.viewState.heightMap.height:this.viewState.lineBlockAt(r).top)/this.viewState.scaleY-o/s;if((m>1||m<-1)&&!(K.ios&&this.inputState.lastIOSMomentumScroll>Date.now()-100)&&(n==this.scrollDOM||this.hasFocus||Math.max(this.inputState.lastWheelEvent,this.inputState.lastTouchTime)>Date.now()-100)){if(i=i+m,!n)this.win.scrollBy(0,m);else if(r<0)n.scrollTop=n.scrollHeight;else n.scrollTop+=m;o=-1;continue}}break}}}finally{this.updateState=0,this.measureScheduled=-1}if(t&&!t.empty)for(let l of this.state.facet(Uy))l(t)}get themeClasses(){return Yy+" "+(this.state.facet(Gy)?Z2:J2)+" "+this.state.facet(Ep)}updateAttrs(){let e=jM(this,v2,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),t={spellcheck:"false",autocorrect:"off",autocapitalize:"off",writingsuggestions:"false",translate:"no",contenteditable:!this.state.facet(Ir)?"false":"true",class:"cm-content",style:`${K.tabSize}: ${this.state.tabSize}`,role:"textbox","aria-multiline":"true"};if(this.state.readOnly)t["aria-readonly"]="true";jM(this,ix,t);let n=this.observer.ignore(()=>{let i=xM(this.contentDOM,this.contentAttrs,t),r=xM(this.dom,this.editorAttrs,e);return i||r});return this.editorAttrs=e,this.contentAttrs=t,n}showAnnouncements(e){let t=!0;for(let n of e)for(let i of n.effects)if(i.is(W.announce)){if(t)this.announceDOM.textContent="",this.win.clearTimeout(this.clearAnnouncement),this.clearAnnouncement=this.win.setTimeout(()=>{this.announceDOM.textContent=" "},200),t=!1;let r=this.announceDOM.appendChild(document.createElement("div"));r.textContent=i.value}}mountStyles(){this.styleModules=this.state.facet(Hc);let e=this.state.facet(W.cspNonce);vi.mount(this.root,this.styleModules.concat(W6).reverse(),e?{nonce:e}:void 0)}readMeasured(){if(this.updateState==2)throw Error("Reading the editor layout isn't allowed during an update");if(this.updateState==0&&this.measureScheduled>-1)this.measure(!1)}requestMeasure(e){if(this.measureScheduled<0)this.measureScheduled=this.win.requestAnimationFrame(()=>this.measure());if(e){if(this.measureRequests.indexOf(e)>-1)return;if(e.key!=null){for(let t=0;t<this.measureRequests.length;t++)if(this.measureRequests[t].key===e.key){this.measureRequests[t]=e;return}}this.measureRequests.push(e)}}plugin(e){let t=this.pluginMap.get(e);if(t===void 0||t&&t.plugin!=e)this.pluginMap.set(e,t=this.plugins.find((n)=>n.plugin==e)||null);return 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,n){return Ty(this,e,EM(this,e,t,n))}moveByGroup(e,t){return Ty(this,e,EM(this,e,t,(n)=>x6(this,e.head,n)))}visualLineSide(e,t){return t?R.cursor(e.to,1):R.cursor(e.from,-1)}moveToLineBoundary(e,t,n=!0){return y6(this,e,t,n)}moveVertically(e,t,n){return Ty(this,e,w6(this,e,t,n))}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 n=Fy(this,e,t);return n&&n.pos}posAndSideAtCoords(e,t=!0){return this.readMeasured(),Fy(this,e,t)}coordsAtPos(e,t=1){this.readMeasured();let n=this.state.doc.lineAt(e),i=this.bidiSpans(n),r=i[wi.find(i,e-n.from,-1,t)];if(n.length&&(e==n.from&&t<0||e==n.to&&t>0)&&r.dir!=this.textDirectionAt(n.from))if(e==n.to)e=n.from+r.from,t=1;else e=n.from+r.to,t=-1;return this.docView.coordsAt(e,t,r.dir==je.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){if(!this.state.facet(p2)||e<this.viewport.from||e>this.viewport.to)return this.textDirection;return this.readMeasured(),this.docView.textDirectionAt(e)}get lineWrapping(){return this.viewState.heightOracle.lineWrapping}bidiSpans(e){if(e.length>Z6)return s2(e.length);let t=this.textDirectionAt(e.from),n;for(let r of this.bidiCache)if(r.from==e.from&&r.dir==t&&(r.fresh||o2(r.isolates,n=kM(this,e))))return r.order;if(!n)n=kM(this,e);let i=Q8(e.text,t,n);return this.bidiCache.push(new Vp(e.from,e.to,t,n,!0,i)),i}get hasFocus(){var e;return(this.dom.ownerDocument.hasFocus()||K.safari&&((e=this.inputState)===null||e===void 0?void 0:e.lastContextMenu)>Date.now()-30000)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore(()=>{ZM(this.contentDOM),this.docView.updateSelection()})}setRoot(e){if(this._root!=e)this._root=e,this.observer.setWindow((e.nodeType==9?e:e.ownerDocument).defaultView||window),this.mountStyles()}destroy(){if(this.root.activeElement==this.contentDOM)this.contentDOM.blur();for(let e of this.plugins)e.destroy(this);if(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 n,i,r,o;return wp.of(new Da(typeof e=="number"?R.cursor(e):e,(n=t.y)!==null&&n!==void 0?n:"nearest",(i=t.x)!==null&&i!==void 0?i:"nearest",(r=t.yMargin)!==null&&r!==void 0?r:5,(o=t.xMargin)!==null&&o!==void 0?o:5))}scrollSnapshot(){let{scrollTop:e,scrollLeft:t}=this.scrollDOM,n=this.viewState.scrollAnchorAt(e);return wp.of(new Da(R.cursor(n.from),"start","start",n.top-e,t,!0))}setTabFocusMode(e){if(e==null)this.inputState.tabFocusMode=this.inputState.tabFocusMode<0?0:-1;else if(typeof e=="boolean")this.inputState.tabFocusMode=e?0:-1;else if(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 n=vi.newName(),i=[Ep.of(n),Hc.of(Wy(`.${n}`,e))];if(t&&t.dark)i.push(Gy.of(!0));return i}static baseTheme(e){return nr.lowest(Hc.of(Wy("."+Yy,e,eN)))}static findFromDOM(e){var t;let n=e.querySelector(".cm-content"),i=n&&Ye.get(n)||Ye.get(e);return((t=i===null||i===void 0?void 0:i.root)===null||t===void 0?void 0:t.view)||null}}W.styleModule=Hc;W.inputHandler=d2;W.clipboardInputFilter=tx;W.clipboardOutputFilter=nx;W.scrollHandler=m2;W.focusChangeEffect=h2;W.perLineTextDirection=p2;W.exceptionSink=f2;W.updateListener=Uy;W.editable=Ir;W.mouseSelectionStyle=c2;W.dragMovesSelection=u2;W.clickAddsSelectionRange=a2;W.decorations=Up;W.blockWrappers=b2;W.outerDecorations=rx;W.atomicRanges=ef;W.bidiIsolatedRanges=y2;W.cursorScrollMargin=J.define({combine:(e)=>{let t=5,n=5;for(let i of e)if(typeof i=="number")t=n=i;else({x:t,y:n}=i);return{x:t,y:n}}});W.scrollMargins=x2;W.darkTheme=Gy;W.cspNonce=J.define({combine:(e)=>e.length?e[0]:""});W.contentAttributes=ix;W.editorAttributes=v2;W.lineWrapping=W.contentAttributes.of({class:"cm-lineWrapping"});W.announce=ye.define();var Z6=4096,UM={};class Vp{constructor(e,t,n,i,r,o){this.from=e,this.to=t,this.dir=n,this.isolates=i,this.fresh=r,this.order=o}static update(e,t){if(t.empty&&!e.some((r)=>r.fresh))return e;let n=[],i=e.length?e[e.length-1].dir:je.LTR;for(let r=Math.max(0,e.length-10);r<e.length;r++){let o=e[r];if(o.dir==i&&!t.touchesRange(o.from,o.to))n.push(new Vp(t.mapPos(o.from,1),t.mapPos(o.to,-1),o.dir,o.isolates,!1,o.order))}return n}}function jM(e,t,n){for(let i=e.state.facet(t),r=i.length-1;r>=0;r--){let o=i[r],s=typeof o=="function"?o(e):o;if(s)Jy(s,n)}return n}var eV=K.mac?"mac":K.windows?"win":K.linux?"linux":"key";function tV(e,t){let n=e.split(/-(?!$)/),i=n[n.length-1];if(i=="Space")i=" ";let r,o,s,l;for(let a=0;a<n.length-1;++a){let u=n[a];if(/^(cmd|meta|m)$/i.test(u))l=!0;else if(/^a(lt)?$/i.test(u))r=!0;else if(/^(c|ctrl|control)$/i.test(u))o=!0;else if(/^s(hift)?$/i.test(u))s=!0;else if(/^mod$/i.test(u))if(t=="mac")l=!0;else o=!0;else throw Error("Unrecognized modifier name: "+u)}if(r)i="Alt-"+i;if(o)i="Ctrl-"+i;if(l)i="Meta-"+i;if(s)i="Shift-"+i;return i}function Op(e,t,n){if(t.altKey)e="Alt-"+e;if(t.ctrlKey)e="Ctrl-"+e;if(t.metaKey)e="Meta-"+e;if(n!==!1&&t.shiftKey)e="Shift-"+e;return e}var nV=nr.default(W.domEventHandlers({keydown(e,t){return sV(iV(t.state),e,t,"editor")}})),Ba=J.define({enables:nV}),KM=new WeakMap;function iV(e){let t=e.facet(Ba),n=KM.get(t);if(!n)KM.set(t,n=oV(t.reduce((i,r)=>i.concat(r),[])));return n}var Lo=null,rV=4000;function oV(e,t=eV){let n=Object.create(null),i=Object.create(null),r=(s,l)=>{let a=i[s];if(a==null)i[s]=l;else if(a!=l)throw Error("Key binding "+s+" is used both as a regular binding and as a multi-stroke prefix")},o=(s,l,a,u,c)=>{var f,d;let h=n[s]||(n[s]=Object.create(null)),m=l.split(/ (?!$)/).map((g)=>tV(g,t));for(let g=1;g<m.length;g++){let v=m.slice(0,g).join(" ");if(r(v,!0),!h[v])h[v]={preventDefault:!0,stopPropagation:!1,run:[(w)=>{let S=Lo={view:w,prefix:v,scope:s};return setTimeout(()=>{if(Lo==S)Lo=null},rV),!0}]}}let b=m.join(" ");r(b,!1);let x=h[b]||(h[b]={preventDefault:!1,stopPropagation:!1,run:((d=(f=h._any)===null||f===void 0?void 0:f.run)===null||d===void 0?void 0:d.slice())||[]});if(a)x.run.push(a);if(u)x.preventDefault=!0;if(c)x.stopPropagation=!0};for(let s of e){let l=s.scope?s.scope.split(" "):["editor"];if(s.any)for(let u of l){let c=n[u]||(n[u]=Object.create(null));if(!c._any)c._any={preventDefault:!1,stopPropagation:!1,run:[]};let{any:f}=s;for(let d in c)c[d].run.push((h)=>f(h,Qy))}let a=s[t]||s.key;if(!a)continue;for(let u of l)if(o(u,a,s.run,s.preventDefault,s.stopPropagation),s.shift)o(u,"Shift-"+a,s.shift,s.preventDefault,s.stopPropagation)}return n}var Qy=null;function sV(e,t,n,i){Qy=t;let r=gM(t),o=Br(r,0),s=Do(o)==r.length&&r!=" ",l="",a=!1,u=!1,c=!1;if(Lo&&Lo.view==n&&Lo.scope==i){if(l=Lo.prefix+" ",V2.indexOf(t.keyCode)<0)u=!0,Lo=null}let f=new Set,d=(x)=>{if(x){for(let g of x.run)if(!f.has(g)){if(f.add(g),g(n)){if(x.stopPropagation)c=!0;return!0}}if(x.preventDefault){if(x.stopPropagation)c=!0;u=!0}}return!1},h=e[i],m,b;if(h){if(d(h[l+Op(r,t,!s)]))a=!0;else if(s&&(t.altKey||t.metaKey||t.ctrlKey)&&!(K.windows&&t.ctrlKey&&t.altKey)&&!(K.mac&&t.altKey&&!(t.ctrlKey||t.metaKey))&&(m=Pr[t.keyCode])&&m!=r){if(d(h[l+Op(m,t,!0)]))a=!0;else if(t.shiftKey&&(b=Aa[t.keyCode])!=r&&b!=m&&d(h[l+Op(b,t,!1)]))a=!0}else if(s&&t.shiftKey&&d(h[l+Op(r,t,!0)]))a=!0;if(!a&&d(h._any))a=!0}if(u)a=!0;if(a&&c)t.stopPropagation();return Qy=null,a}var lV=K.gecko&&K.gecko_version==153?"#ffffff01":"transparent",kF=nr.highest(W.theme({".cm-line":{"& ::selection, &::selection":{backgroundColor:`${lV} !important`},caretColor:"transparent !important"},".cm-content":{caretColor:"transparent !important","& :focus":{caretColor:"initial !important","&::selection, & ::selection":{backgroundColor:"Highlight !important"}}}}));var _F=/x/.unicode!=null?"gu":"g";class iN extends Po{constructor(e){super();this.content=e}toDOM(e){let t=document.createElement("span");return t.className="cm-placeholder",t.style.pointerEvents="none",t.appendChild(typeof this.content=="string"?document.createTextNode(this.content):typeof this.content=="function"?this.content(e):this.content.cloneNode(!0)),t.setAttribute("aria-hidden","true"),t}coordsAt(e){let t=e.firstChild?Fc(e.firstChild):[];if(!t.length)return null;let n=window.getComputedStyle(e.parentNode),i=Yc(t[0],n.direction!="rtl"),r=parseInt(n.lineHeight);if(i.bottom-i.top>r*1.5)return{left:i.left,right:i.right,top:i.top,bottom:i.top+r};return i}ignoreEvent(){return!1}}function rN(e){let t=En.fromClass(class{constructor(n){this.view=n,this.placeholder=e?Oe.set([Oe.widget({widget:new iN(e),side:1}).range(0)]):Oe.none}get decorations(){return this.view.state.doc.length?Oe.none:this.placeholder}},{decorations:(n)=>n.decorations});return typeof e=="string"?[t,W.contentAttributes.of({"aria-placeholder":e})]:t}var Ap="-10000px";class oN{constructor(e,t,n,i){this.facet=t,this.createTooltipView=n,this.removeTooltipView=i,this.input=e.state.facet(t),this.tooltips=this.input.filter((o)=>o);let r=null;this.tooltipViews=this.tooltips.map((o)=>r=n(o,r))}update(e,t){var n;let i=e.state.facet(this.facet),r=i.filter((l)=>l);if(i===this.input){for(let l of this.tooltipViews)if(l.update)l.update(e);return!1}let o=[],s=t?[]:null;for(let l=0;l<r.length;l++){let a=r[l],u=-1;if(!a)continue;for(let c=0;c<this.tooltips.length;c++){let f=this.tooltips[c];if(f&&f.create==a.create)u=c}if(u<0){if(o[l]=this.createTooltipView(a,l?o[l-1]:null),s)s[l]=!!a.above}else{let c=o[l]=this.tooltipViews[u];if(s)s[l]=t[u];if(c.update)c.update(e)}}for(let l of this.tooltipViews)if(o.indexOf(l)<0)this.removeTooltipView(l),(n=l.destroy)===null||n===void 0||n.call(l);if(t)s.forEach((l,a)=>t[a]=l),t.length=s.length;return this.input=i,this.tooltips=r,this.tooltipViews=o,!0}}function aV(e){let t=e.dom.ownerDocument.documentElement;return{top:0,left:0,bottom:t.clientHeight,right:t.clientWidth}}var Ny=J.define({combine:(e)=>{var t,n,i;return{position:K.ios?"absolute":((t=e.find((r)=>r.position))===null||t===void 0?void 0:t.position)||"fixed",parent:((n=e.find((r)=>r.parent))===null||n===void 0?void 0:n.parent)||null,tooltipSpace:((i=e.find((r)=>r.tooltipSpace))===null||i===void 0?void 0:i.tooltipSpace)||aV}}}),FM=new WeakMap,sN=En.fromClass(class{constructor(e){this.view=e,this.above=[],this.inView=!0,this.madeAbsolute=!1,this.lastTransaction=0,this.measureTimeout=-1;let t=e.state.facet(Ny);this.position=t.position,this.parent=t.parent,this.classes=e.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 oN(e,cx,(n,i)=>this.createTooltip(n,i),(n)=>{if(this.resizeObserver)this.resizeObserver.unobserve(n.dom);n.dom.remove()}),this.above=this.manager.tooltips.map((n)=>!!n.above),this.intersectionObserver=typeof IntersectionObserver=="function"?new IntersectionObserver((n)=>{if(Date.now()>this.lastTransaction-50&&n.length>0&&n[n.length-1].intersectionRatio<1)this.measureSoon()},{threshold:[1]}):null,this.observeIntersection(),e.win.addEventListener("resize",this.measureSoon=this.measureSoon.bind(this)),this.maybeMeasure()}createContainer(){if(this.parent)this.container=document.createElement("div"),this.container.style.position="relative",this.container.className=this.view.themeClasses,this.parent.appendChild(this.container);else this.container=this.view.dom}observeIntersection(){if(this.intersectionObserver){this.intersectionObserver.disconnect();for(let e of this.manager.tooltipViews)this.intersectionObserver.observe(e.dom)}}measureSoon(){if(this.measureTimeout<0)this.measureTimeout=setTimeout(()=>{this.measureTimeout=-1,this.maybeMeasure()},50)}update(e){if(e.transactions.length)this.lastTransaction=Date.now();let t=this.manager.update(e,this.above);if(t)this.observeIntersection();let n=t||e.geometryChanged,i=e.state.facet(Ny);if(i.position!=this.position&&!this.madeAbsolute){this.position=i.position;for(let r of this.manager.tooltipViews)r.dom.style.position=this.position;n=!0}if(i.parent!=this.parent){if(this.parent)this.container.remove();this.parent=i.parent,this.createContainer();for(let r of this.manager.tooltipViews)this.container.appendChild(r.dom);n=!0}else if(this.parent&&this.view.themeClasses!=this.classes)this.classes=this.container.className=this.view.themeClasses;if(n)this.maybeMeasure()}createTooltip(e,t){let n=e.create(this.view),i=t?t.dom:null;if(n.dom.classList.add("cm-tooltip"),e.arrow&&!n.dom.querySelector(".cm-tooltip > .cm-tooltip-arrow")){let r=document.createElement("div");r.className="cm-tooltip-arrow",n.dom.appendChild(r)}if(n.dom.style.position=this.position,n.dom.style.top=Ap,n.dom.style.left="0px",this.container.insertBefore(n.dom,i),n.mount)n.mount(this.view);if(this.resizeObserver)this.resizeObserver.observe(n.dom);return n}destroy(){var e,t,n;this.view.win.removeEventListener("resize",this.measureSoon);for(let i of this.manager.tooltipViews)i.dom.remove(),(e=i.destroy)===null||e===void 0||e.call(i);if(this.parent)this.container.remove();(t=this.resizeObserver)===null||t===void 0||t.disconnect(),(n=this.intersectionObserver)===null||n===void 0||n.disconnect(),clearTimeout(this.measureTimeout)}readMeasure(){let e=1,t=1,n=!1;if(this.position=="fixed"&&this.manager.tooltipViews.length){let{dom:o}=this.manager.tooltipViews[0];if(K.safari){let s=o.getBoundingClientRect();n=Math.abs(s.top+1e4)>1||Math.abs(s.left)>1}else n=!!o.offsetParent&&o.offsetParent!=this.container.ownerDocument.body}if(n||this.position=="absolute")if(this.parent){let o=this.parent.getBoundingClientRect();if(o.width&&o.height)e=o.width/this.parent.offsetWidth,t=o.height/this.parent.offsetHeight}else({scaleX:e,scaleY:t}=this.view.viewState);let i=this.view.scrollDOM.getBoundingClientRect(),r=ox(this.view);return{visible:{left:i.left+r.left,top:i.top+r.top,right:i.right-r.right,bottom:i.bottom-r.bottom},parent:this.parent?this.container.getBoundingClientRect():this.view.dom.getBoundingClientRect(),pos:this.manager.tooltips.map((o,s)=>{let l=this.manager.tooltipViews[s];return l.getCoords?l.getCoords(o.pos):this.view.coordsAtPos(o.pos)}),size:this.manager.tooltipViews.map(({dom:o})=>o.getBoundingClientRect()),space:this.view.state.facet(Ny).tooltipSpace(this.view),scaleX:e,scaleY:t,makeAbsolute:n}}writeMeasure(e){var t;if(e.makeAbsolute){this.madeAbsolute=!0,this.position="absolute";for(let l of this.manager.tooltipViews)l.dom.style.position="absolute"}let{visible:n,space:i,scaleX:r,scaleY:o}=e,s=[];for(let l=0;l<this.manager.tooltips.length;l++){let a=this.manager.tooltips[l],u=this.manager.tooltipViews[l],{dom:c}=u,f=e.pos[l],d=e.size[l];if(!f||a.clip!==!1&&(f.bottom<=Math.max(n.top,i.top)||f.top>=Math.min(n.bottom,i.bottom)||f.right<Math.max(n.left,i.left)-0.1||f.left>Math.min(n.right,i.right)+0.1)){c.style.top=Ap;continue}let h=a.arrow?u.dom.querySelector(".cm-tooltip-arrow"):null,m=h?7:0,b=d.right-d.left,x=(t=FM.get(u))!==null&&t!==void 0?t:d.bottom-d.top,g=u.offset||cV,v=this.view.textDirection==je.LTR,w=d.width>i.right-i.left?v?i.left:i.right-d.width:v?Math.max(i.left,Math.min(f.left-(h?14:0)+g.x,i.right-b)):Math.min(Math.max(i.left,f.left-b+(h?14:0)-g.x),i.right-b),S=this.above[l];if(!a.strictSide&&(S?f.top-x-m-g.y<i.top:f.bottom+x+m+g.y>i.bottom)&&S==i.bottom-f.bottom>f.top-i.top)S=this.above[l]=!S;let k=(S?f.top-i.top:i.bottom-f.bottom)-m;if(k<x&&u.resize!==!1){if(k<this.view.defaultLineHeight){c.style.top=Ap;continue}FM.set(u,x),c.style.height=(x=k)/o+"px"}else if(c.style.height)c.style.height="";let E=S?f.top-x-m-g.y:f.bottom+m+g.y,_=w+b;if(u.overlap!==!0){for(let O of s)if(O.left<_&&O.right>w&&O.top<E+x&&O.bottom>E)E=S?O.top-x-2-m:O.bottom+m+2}if(this.position=="absolute")c.style.top=(E-e.parent.top)/o+"px",qM(c,(w-e.parent.left)/r);else c.style.top=E/o+"px",qM(c,w/r);if(h){let O=f.left+(v?g.x:-g.x)-(w+14-7);h.style.left=O/r+"px"}if(u.overlap!==!0)s.push({left:w,top:E,right:_,bottom:E+x});if(c.classList.toggle("cm-tooltip-above",S),c.classList.toggle("cm-tooltip-below",!S),u.positioned)u.positioned(e.space)}}maybeMeasure(){if(this.manager.tooltips.length){if(this.view.inView)this.view.requestMeasure(this.measureReq);if(this.inView!=this.view.inView){if(this.inView=this.view.inView,!this.inView)for(let e of this.manager.tooltipViews)e.dom.style.top=Ap}}}},{eventObservers:{scroll(){this.maybeMeasure()}}});function qM(e,t){let n=parseInt(e.style.left,10);if(isNaN(n)||Math.abs(t-n)>1)e.style.left=t+"px"}var uV=W.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"}}}),cV={x:0,y:0},cx=J.define({enables:[sN,uV]});function fx(e,t){let n=e.plugin(sN);if(!n)return null;let i=n.manager.tooltips.indexOf(t);return i<0?null:n.manager.tooltipViews[i]}class Bo extends gi{compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}eq(e){return!1}destroy(e){}}Bo.prototype.elementClass="";Bo.prototype.toDOM=void 0;Bo.prototype.mapMode=qt.TrackBefore;Bo.prototype.startSide=Bo.prototype.endSide=-1;Bo.prototype.point=!0;var fV=0;class Fp{constructor(e,t){this.from=e,this.to=t}}class ce{constructor(e={}){this.id=fV++,this.perNode=!!e.perNode,this.deserialize=e.deserialize||(()=>{throw Error("This node type doesn't define a deserialize function")}),this.combine=e.combine||null}add(e){if(this.perNode)throw RangeError("Can't add per-node props to node types");if(typeof e!="function")e=On.match(e);return(t)=>{let n=e(t);return n===void 0?null:[this,n]}}}ce.closedBy=new ce({deserialize:(e)=>e.split(" ")});ce.openedBy=new ce({deserialize:(e)=>e.split(" ")});ce.group=new ce({deserialize:(e)=>e.split(" ")});ce.isolate=new ce({deserialize:(e)=>{if(e&&e!="rtl"&&e!="ltr"&&e!="auto")throw RangeError("Invalid value for isolate: "+e);return e||"auto"}});ce.contextHash=new ce({perNode:!0});ce.lookAhead=new ce({perNode:!0});ce.mounted=new ce({perNode:!0});class Pa{constructor(e,t,n,i=!1){this.tree=e,this.overlay=t,this.parser=n,this.bracketed=i}static get(e){return e&&e.props&&e.props[ce.mounted.id]}}var dV=Object.create(null);class On{constructor(e,t,n,i=0){this.name=e,this.props=t,this.id=n,this.flags=i}static define(e){let t=e.props&&e.props.length?Object.create(null):dV,n=(e.top?1:0)|(e.skipped?2:0)|(e.error?4:0)|(e.name==null?8:0),i=new On(e.name||"",t,e.id,n);if(e.props)for(let r of e.props){if(!Array.isArray(r))r=r(i);if(r){if(r[0].perNode)throw RangeError("Can't store a per-node prop on a node type");t[r[0].id]=r[1]}}return i}prop(e){return this.props[e.id]}get isTop(){return(this.flags&1)>0}get isSkipped(){return(this.flags&2)>0}get isError(){return(this.flags&4)>0}get isAnonymous(){return(this.flags&8)>0}is(e){if(typeof e=="string"){if(this.name==e)return!0;let t=this.prop(ce.group);return t?t.indexOf(e)>-1:!1}return this.id==e}static match(e){let t=Object.create(null);for(let n in e)for(let i of n.split(" "))t[i]=e[n];return(n)=>{for(let i=n.prop(ce.group),r=-1;r<(i?i.length:0);r++){let o=t[r<0?n.name:i[r]];if(o)return o}}}}On.none=new On("",Object.create(null),0,8);var Kp=new WeakMap,lN=new WeakMap,et;(function(e){e[e.ExcludeBuffers=1]="ExcludeBuffers",e[e.IncludeAnonymous=2]="IncludeAnonymous",e[e.IgnoreMounts=4]="IgnoreMounts",e[e.IgnoreOverlays=8]="IgnoreOverlays",e[e.EnterBracketed=16]="EnterBracketed"})(et||(et={}));class xt{constructor(e,t,n,i,r){if(this.type=e,this.children=t,this.positions=n,this.length=i,this.props=null,r&&r.length){this.props=Object.create(null);for(let[o,s]of r)this.props[typeof o=="number"?o:o.id]=s}}toString(){let e=Pa.get(this);if(e&&!e.overlay)return e.tree.toString();let t="";for(let n of this.children){let i=n.toString();if(i){if(t)t+=",";t+=i}}return!this.type.name?t:(/\W/.test(this.type.name)&&!this.type.isError?JSON.stringify(this.type.name):this.type.name)+(t.length?"("+t+")":"")}cursor(e=0){return new $p(this.topNode,e)}cursorAt(e,t=0,n=0){let i=Kp.get(this)||this.topNode,r=new $p(i);return r.moveTo(e,t),Kp.set(this,r._tree),r}get topNode(){return new Yn(this,0,0,null)}resolve(e,t=0){let n=rf(Kp.get(this)||this.topNode,e,t,!1);return Kp.set(this,n),n}resolveInner(e,t=0){let n=rf(lN.get(this)||this.topNode,e,t,!0);return lN.set(this,n),n}resolveStack(e,t=0){return hV(this,e,t)}iterate(e){let{enter:t,leave:n,from:i=0,to:r=this.length}=e,o=e.mode||0,s=(o&et.IncludeAnonymous)>0;for(let l=this.cursor(o|et.IncludeAnonymous);;){let a=!1;if(l.from<=r&&l.to>=i&&(!s&&l.type.isAnonymous||t(l)!==!1)){if(l.firstChild())continue;a=!0}for(;;){if(a&&n&&(s||!l.type.isAnonymous))n(l);if(l.nextSibling())break;if(!l.parent())return;a=!0}}}prop(e){return!e.perNode?this.type.prop(e):this.props?this.props[e.id]:void 0}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:gx(On.none,this.children,this.positions,0,this.children.length,0,this.length,(t,n,i)=>new xt(this.type,t,n,i,this.propValues),e.makeTree||((t,n,i)=>new xt(On.none,t,n,i)))}static build(e){return pV(e)}}xt.empty=new xt(On.none,[],[],0);class hx{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 hx(this.buffer,this.index)}}class Vo{constructor(e,t,n){this.buffer=e,this.length=t,this.set=n}get type(){return On.none}toString(){let e=[];for(let t=0;t<this.buffer.length;)e.push(this.childString(t)),t=this.buffer[t+3];return e.join(",")}childString(e){let t=this.buffer[e],n=this.buffer[e+3],i=this.set.types[t],r=i.name;if(/\W/.test(r)&&!i.isError)r=JSON.stringify(r);if(e+=4,n==e)return r;let o=[];while(e<n)o.push(this.childString(e)),e=this.buffer[e+3];return r+"("+o.join(",")+")"}findChild(e,t,n,i,r){let{buffer:o}=this,s=-1;for(let l=e;l!=t;l=o[l+3])if(cN(r,i,o[l+1],o[l+2])){if(s=l,n>0)break}return s}slice(e,t,n){let i=this.buffer,r=new Uint16Array(t-e),o=0;for(let s=e,l=0;s<t;){r[l++]=i[s++],r[l++]=i[s++]-n;let a=r[l++]=i[s++]-n;r[l++]=i[s++]-e,o=Math.max(o,a)}return new Vo(r,o,this.set)}}function cN(e,t,n,i){switch(e){case-2:return n<t;case-1:return i>=t&&n<t;case 0:return n<t&&i>t;case 1:return n<=t&&i>t;case 2:return i>t;case 4:return!0}}function rf(e,t,n,i){var r;while(e.from==e.to||(n<1?e.from>=t:e.from>t)||(n>-1?e.to<=t:e.to<t)){let s=!i&&e instanceof Yn&&e.index<0?null:e.parent;if(!s)return e;e=s}let o=i?0:et.IgnoreOverlays;if(i){for(let s=e,l=s.parent;l;s=l,l=s.parent)if(s instanceof Yn&&s.index<0&&((r=l.enter(t,n,o))===null||r===void 0?void 0:r.from)!=s.from)e=l}for(;;){let s=e.enter(t,n,o);if(!s)return e;e=s}}class px{cursor(e=0){return new $p(this,e)}getChild(e,t=null,n=null){let i=aN(this,e,t,n);return i.length?i[0]:null}getChildren(e,t=null,n=null){return aN(this,e,t,n)}resolve(e,t=0){return rf(this,e,t,!1)}resolveInner(e,t=0){return rf(this,e,t,!0)}matchContext(e){return dx(this.parent,e)}enterUnfinishedNodesBefore(e){let t=this.childBefore(e),n=this;while(t){let i=t.lastChild;if(!i||i.to!=t.to)break;if(i.type.isError&&i.from==i.to)n=t,t=i.prevSibling;else t=i}return n}get node(){return this}get next(){return this.parent}}class Yn extends px{constructor(e,t,n,i){super();this._tree=e,this.from=t,this.index=n,this._parent=i}get type(){return this._tree.type}get name(){return this._tree.type.name}get to(){return this.from+this._tree.length}nextChild(e,t,n,i,r=0){for(let o=this;;){for(let{children:s,positions:l}=o._tree,a=t>0?s.length:-1;e!=a;e+=t){let u=s[e],c=l[e]+o.from,f;if(!(r&et.EnterBracketed&&u instanceof xt&&(f=Pa.get(u))&&!f.overlay&&f.bracketed&&n>=c&&n<=c+u.length)&&!cN(i,n,c,c+u.length))continue;if(u instanceof Vo){if(r&et.ExcludeBuffers)continue;let d=u.findChild(0,u.buffer.length,t,n-c,i);if(d>-1)return new Io(new fN(o,u,e,c),null,d)}else if(r&et.IncludeAnonymous||(!u.type.isAnonymous||mx(u))){let d;if(!(r&et.IgnoreMounts)&&(d=Pa.get(u))&&!d.overlay)return new Yn(d.tree,c,e,o);let h=new Yn(u,c,e,o);return r&et.IncludeAnonymous||!h.type.isAnonymous?h:h.nextChild(t<0?u.children.length-1:0,t,n,i,r)}}if(r&et.IncludeAnonymous||!o.type.isAnonymous)return null;if(o.index>=0)e=o.index+t;else e=t<0?-1:o._parent._tree.children.length;if(o=o._parent,!o)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,n=0){let i;if(!(n&et.IgnoreOverlays)&&(i=Pa.get(this._tree))&&i.overlay){let r=e-this.from,o=n&et.EnterBracketed&&i.bracketed;for(let{from:s,to:l}of i.overlay)if((t>0||o?s<=r:s<r)&&(t<0||o?l>=r:l>r))return new Yn(i.tree,i.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,e,t,n)}nextSignificantParent(){let e=this;while(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 aN(e,t,n,i){let r=e.cursor(),o=[];if(!r.firstChild())return o;if(n!=null){for(let s=!1;!s;)if(s=r.type.is(n),!r.nextSibling())return o}for(;;){if(i!=null&&r.type.is(i))return o;if(r.type.is(t))o.push(r.node);if(!r.nextSibling())return i==null?o:[]}}function dx(e,t,n=t.length-1){for(let i=e;n>=0;i=i.parent){if(!i)return!1;if(!i.type.isAnonymous){if(t[n]&&t[n]!=i.name)return!1;n--}}return!0}class fN{constructor(e,t,n,i){this.parent=e,this.buffer=t,this.index=n,this.start=i}}class Io extends px{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,n){super();this.context=e,this._parent=t,this.index=n,this.type=e.buffer.set.types[e.buffer.buffer[n]]}child(e,t,n){let{buffer:i}=this.context,r=i.findChild(this.index+4,i.buffer[this.index+3],e,t-this.context.start,n);return r<0?null:new Io(this.context,this,r)}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,n=0){if(n&et.ExcludeBuffers)return null;let{buffer:i}=this.context,r=i.findChild(this.index+4,i.buffer[this.index+3],t>0?1:-1,e-this.context.start,t);return r<0?null:new Io(this.context,this,r)}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];if(t<(this._parent?e.buffer[this._parent.index+3]:e.buffer.length))return new Io(this.context,this._parent,t);return this.externalSibling(1)}get prevSibling(){let{buffer:e}=this.context,t=this._parent?this._parent.index+4:0;if(this.index==t)return this.externalSibling(-1);return new Io(this.context,this._parent,e.findChild(t,this.index,-1,0,4))}get tree(){return null}toTree(){let e=[],t=[],{buffer:n}=this.context,i=this.index+4,r=n.buffer[this.index+3];if(r>i){let o=n.buffer[this.index+1];e.push(n.slice(i,r,o)),t.push(0)}return new xt(this.type,e,t,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function dN(e){if(!e.length)return null;let t=0,n=e[0];for(let o=1;o<e.length;o++){let s=e[o];if(s.from>n.from||s.to<n.to)n=s,t=o}let i=n instanceof Yn&&n.index<0?null:n.parent,r=e.slice();if(i)r[t]=i;else r.splice(t,1);return new hN(r,n)}class hN{constructor(e,t){this.heads=e,this.node=t}get next(){return dN(this.heads)}}function hV(e,t,n){let i=e.resolveInner(t,n),r=null;for(let o=i instanceof Yn?i:i.context.parent;o;o=o.parent)if(o.index<0){let s=o.parent;(r||(r=[i])).push(s.resolve(t,n)),o=s}else{let s=Pa.get(o.tree);if(s&&s.overlay&&s.overlay[0].from<=t&&s.overlay[s.overlay.length-1].to>=t){let l=new Yn(s.tree,s.overlay[0].from+o.from,-1,o);(r||(r=[i])).push(rf(l,t,n,!1))}}return r?dN(r):i}class $p{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&~et.EnterBracketed,e instanceof Yn)this.yieldNode(e);else{this._tree=e.context.parent,this.buffer=e.context;for(let n=e._parent;n;n=n._parent)this.stack.unshift(n.index);this.bufferNode=e,this.yieldBuf(e.index)}}yieldNode(e){if(!e)return!1;return this._tree=e,this.type=e.type,this.from=e.from,this.to=e.to,!0}yieldBuf(e,t){this.index=e;let{start:n,buffer:i}=this.buffer;return this.type=t||i.set.types[i.buffer[e]],this.from=n+i.buffer[e+1],this.to=n+i.buffer[e+2],!0}yield(e){if(!e)return!1;if(e instanceof Yn)return this.buffer=null,this.yieldNode(e);return this.buffer=e.context,this.yieldBuf(e.index,e.type)}toString(){return this.buffer?this.buffer.buffer.childString(this.index):this._tree.toString()}enterChild(e,t,n){if(!this.buffer)return this.yield(this._tree.nextChild(e<0?this._tree._tree.children.length-1:0,e,t,n,this.mode));let{buffer:i}=this.buffer,r=i.findChild(this.index+4,i.buffer[this.index+3],e,t-this.buffer.start,n);if(r<0)return!1;return this.stack.push(this.index),this.yieldBuf(r)}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,n=this.mode){if(!this.buffer)return this.yield(this._tree.enter(e,t,n));return n&et.ExcludeBuffers?!1:this.enterChild(1,e,t)}parent(){if(!this.buffer)return this.yieldNode(this.mode&et.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let e=this.mode&et.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent();return this.buffer=null,this.yieldNode(e)}sibling(e){if(!this.buffer)return!this._tree._parent?!1:this.yield(this._tree.index<0?null:this._tree._parent.nextChild(this._tree.index+e,e,0,4,this.mode));let{buffer:t}=this.buffer,n=this.stack.length-1;if(e<0){let i=n<0?0:this.stack[n]+4;if(this.index!=i)return this.yieldBuf(t.findChild(i,this.index,-1,0,4))}else{let i=t.buffer[this.index+3];if(i<(n<0?t.buffer.length:t.buffer[this.stack[n]+3]))return this.yieldBuf(i)}return n<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,n,{buffer:i}=this;if(i){if(e>0){if(this.index<i.buffer.buffer.length)return!1}else for(let r=0;r<this.index;r++)if(i.buffer.buffer[r+3]<this.index)return!1;({index:t,parent:n}=i)}else({index:t,_parent:n}=this._tree);for(;n;{index:t,_parent:n}=n)if(t>-1)for(let r=t+e,o=e<0?-1:n._tree.children.length;r!=o;r+=e){let s=n._tree.children[r];if(this.mode&et.IncludeAnonymous||s instanceof Vo||!s.type.isAnonymous||mx(s))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){while(this.from==this.to||(t<1?this.from>=e:this.from>e)||(t>-1?this.to<=e:this.to<e))if(!this.parent())break;while(this.enterChild(1,e,t));return this}get node(){if(!this.buffer)return this._tree;let e=this.bufferNode,t=null,n=0;if(e&&e.context==this.buffer)e:for(let i=this.index,r=this.stack.length;r>=0;){for(let o=e;o;o=o._parent)if(o.index==i){if(i==this.index)return o;t=o,n=r+1;break e}i=this.stack[--r]}for(let i=n;i<this.stack.length;i++)t=new Io(this.buffer,t,this.stack[i]);return this.bufferNode=new Io(this.buffer,t,this.index)}get tree(){return this.buffer?null:this._tree._tree}iterate(e,t){for(let n=0;;){let i=!1;if(this.type.isAnonymous||e(this)!==!1){if(this.firstChild()){n++;continue}if(!this.type.isAnonymous)i=!0}for(;;){if(i&&t)t(this);if(i=this.type.isAnonymous,!n)return;if(this.nextSibling())break;this.parent(),n--,i=!0}}}matchContext(e){if(!this.buffer)return dx(this.node.parent,e);let{buffer:t}=this.buffer,{types:n}=t.set;for(let i=e.length-1,r=this.stack.length-1;i>=0;r--){if(r<0)return dx(this._tree,e,i);let o=n[t.buffer[this.stack[r]]];if(!o.isAnonymous){if(e[i]&&e[i]!=o.name)return!1;i--}}return!0}}function mx(e){return e.children.some((t)=>t instanceof Vo||!t.type.isAnonymous||mx(t))}function pV(e){var t;let{buffer:n,nodeSet:i,maxBufferLength:r=1024,reused:o=[],minRepeatType:s=i.types.length}=e,l=Array.isArray(n)?new hx(n,n.length):n,a=i.types,u=0,c=0;function f(k,E,_,O,P,T){let{id:I,start:V,end:Y,size:N}=l,D=c,H=u;if(N<0)if(l.next(),N==-1){let He=o[I];_.push(He),O.push(V-k);return}else if(N==-3){u=I;return}else if(N==-4){c=I;return}else throw RangeError(`Unrecognized record size: ${N}`);let G=a[I],L,ee,he=V-k;if(Y-V<=r&&(ee=x(l.pos-E,P))){let He=new Uint16Array(ee.size-ee.skip),qe=l.pos-ee.size,dt=He.length;while(l.pos>qe)dt=g(ee.start,He,dt);L=new Vo(He,Y-ee.start,i),he=ee.start-k}else{let He=l.pos-N;l.next();let qe=[],dt=[],$e=I>=s?I:-1,Ae=0,tt=Y;while(l.pos>He)if($e>=0&&l.id==$e&&l.size>=0){if(l.end<=tt-r)m(qe,dt,V,Ae,l.end,tt,$e,D,H),Ae=qe.length,tt=l.end;l.next()}else if(T>2500)d(V,He,qe,dt);else f(V,He,qe,dt,$e,T+1);if($e>=0&&Ae>0&&Ae<qe.length)m(qe,dt,V,Ae,V,tt,$e,D,H);if(qe.reverse(),dt.reverse(),$e>-1&&Ae>0){let St=h(G,H);L=gx(G,qe,dt,0,qe.length,0,Y-V,St,St)}else L=b(G,qe,dt,Y-V,D-Y,H)}_.push(L),O.push(he)}function d(k,E,_,O){let P=[],T=0,I=-1;while(l.pos>E){let{id:V,start:Y,end:N,size:D}=l;if(D>4)l.next();else if(I>-1&&Y<I)break;else{if(I<0)I=N-r;P.push(V,Y,N),T++,l.next()}}if(T){let V=new Uint16Array(T*4),Y=P[P.length-2];for(let N=P.length-3,D=0;N>=0;N-=3)V[D++]=P[N],V[D++]=P[N+1]-Y,V[D++]=P[N+2]-Y,V[D++]=D;_.push(new Vo(V,P[2]-Y,i)),O.push(Y-k)}}function h(k,E){return(_,O,P)=>{let T=0,I=_.length-1,V,Y;if(I>=0&&(V=_[I])instanceof xt){if(!I&&V.type==k&&V.length==P)return V;if(Y=V.prop(ce.lookAhead))T=O[I]+V.length+Y}return b(k,_,O,P,T,E)}}function m(k,E,_,O,P,T,I,V,Y){let N=[],D=[];while(k.length>O)N.push(k.pop()),D.push(E.pop()+_-P);k.push(b(i.types[I],N,D,T-P,V-T,Y)),E.push(P-_)}function b(k,E,_,O,P,T,I){if(T){let V=[ce.contextHash,T];I=I?[V].concat(I):[V]}if(P>25){let V=[ce.lookAhead,P];I=I?[V].concat(I):[V]}return new xt(k,E,_,O,I)}function x(k,E){let _=l.fork(),O=0,P=0,T=0,I=_.end-r,V={size:0,start:0,skip:0};e:for(let Y=_.pos-k;_.pos>Y;){let N=_.size;if(_.id==E&&N>=0){V.size=O,V.start=P,V.skip=T,T+=4,O+=4,_.next();continue}let D=_.pos-N;if(N<0||D<Y||_.start<I)break;let H=_.id>=s?4:0,G=_.start;_.next();while(_.pos>D){if(_.size<0)if(_.size==-3||_.size==-4)H+=4;else break e;else if(_.id>=s)H+=4;_.next()}P=G,O+=N,T+=H}if(E<0||O==k)V.size=O,V.start=P,V.skip=T;return V.size>4?V:void 0}function g(k,E,_){let{id:O,start:P,end:T,size:I}=l;if(l.next(),I>=0&&O<s){let V=_;if(I>4){let Y=l.pos-(I-4);while(l.pos>Y)_=g(k,E,_)}E[--_]=V,E[--_]=T-k,E[--_]=P-k,E[--_]=O}else if(I==-3)u=O;else if(I==-4)c=O;return _}let v=[],w=[];while(l.pos>0)f(e.start||0,e.bufferStart||0,v,w,-1,0);let S=(t=e.length)!==null&&t!==void 0?t:v.length?w[0]+v[0].length:0;return new xt(a[e.topID],v.reverse(),w.reverse(),S)}var uN=new WeakMap;function qp(e,t){if(!e.isAnonymous||t instanceof Vo||t.type!=e)return 1;let n=uN.get(t);if(n==null){n=1;for(let i of t.children){if(i.type!=e||!(i instanceof xt)){n=1;break}n+=qp(e,i)}uN.set(t,n)}return n}function gx(e,t,n,i,r,o,s,l,a){let u=0;for(let m=i;m<r;m++)u+=qp(e,t[m]);let c=Math.ceil(u*1.5/8),f=[],d=[];function h(m,b,x,g,v){for(let w=x;w<g;){let S=w,k=b[w],E=qp(e,m[w]);w++;for(;w<g;w++){let _=qp(e,m[w]);if(E+_>=c)break;E+=_}if(w==S+1){if(E>c){let _=m[S];h(_.children,_.positions,0,_.children.length,b[S]+v);continue}f.push(m[S])}else{let _=b[w-1]+m[w-1].length-k;f.push(gx(e,m,b,S,w,k,_,null,a))}d.push(k+v-o)}}return h(t,n,i,r,0),(l||a)(f,d,s)}class Ho{constructor(e,t,n,i,r=!1,o=!1){this.from=e,this.to=t,this.tree=n,this.offset=i,this.open=(r?1:0)|(o?2:0)}get openStart(){return(this.open&1)>0}get openEnd(){return(this.open&2)>0}static addTree(e,t=[],n=!1){let i=[new Ho(0,e.length,e,0,!1,n)];for(let r of t)if(r.to>e.length)i.push(r);return i}static applyChanges(e,t,n=128){if(!t.length)return e;let i=[],r=1,o=e.length?e[0]:null;for(let s=0,l=0,a=0;;s++){let u=s<t.length?t[s]:null,c=u?u.fromA:1e9;if(c-l>=n)while(o&&o.from<c){let f=o;if(l>=f.from||c<=f.to||a){let d=Math.max(f.from,l)-a,h=Math.min(f.to,c)-a;f=d>=h?null:new Ho(d,h,f.tree,f.offset+a,s>0,!!u)}if(f)i.push(f);if(o.to>c)break;o=r<e.length?e[r++]:null}if(!u)break;l=u.toA,a=u.toA-u.toB}return i}}class vx{startParse(e,t,n){if(typeof e=="string")e=new pN(e);return n=!n?[new Fp(0,e.length)]:n.length?n.map((i)=>new Fp(i.from,i.to)):[new Fp(0,0)],this.createParse(e,t||[],n)}parse(e,t,n){let i=this.startParse(e,t,n);for(;;){let r=i.advance();if(r)return r}}}class pN{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)}}var RF=new ce({perNode:!0});var mV=0;class Wn{constructor(e,t,n,i){this.name=e,this.set=t,this.base=n,this.modified=i,this.id=mV++}toString(){let{name:e}=this;for(let t of this.modified)if(t.name)e=`${t.name}(${e})`;return e}static define(e,t){let n=typeof e=="string"?e:"?";if(e instanceof Wn)t=e;if(t===null||t===void 0?void 0:t.base)throw Error("Can not derive from a modified tag");let i=new Wn(n,[],null,[]);if(i.set.push(i),t)for(let r of t.set)i.set.push(r);return i}static defineModifier(e){let t=new Wp(e);return(n)=>{if(n.modified.indexOf(t)>-1)return n;return Wp.get(n.base||n,n.modified.concat(t).sort((i,r)=>i.id-r.id))}}}var gV=0;class Wp{constructor(e){this.name=e,this.instances=[],this.id=gV++}static get(e,t){if(!t.length)return e;let n=t[0].instances.find((s)=>s.base==e&&vV(t,s.modified));if(n)return n;let i=[],r=new Wn(e.name,i,e,t);for(let s of t)s.instances.push(r);let o=bV(t);for(let s of e.set)if(!s.modified.length)for(let l of o)i.push(Wp.get(s,l));return r}}function vV(e,t){return e.length==t.length&&e.every((n,i)=>n==t[i])}function bV(e){let t=[[]];for(let n=0;n<e.length;n++)for(let i=0,r=t.length;i<r;i++)t.push(t[i].concat(e[n]));return t.sort((n,i)=>i.length-n.length)}function vN(e){let t=Object.create(null);for(let n in e){let i=e[n];if(!Array.isArray(i))i=[i];for(let r of n.split(" "))if(r){let o=[],s=2,l=r;for(let f=0;;){if(l=="..."&&f>0&&f+3==r.length){s=1;break}let d=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(l);if(!d)throw RangeError("Invalid path: "+r);if(o.push(d[0]=="*"?"":d[0][0]=='"'?JSON.parse(d[0]):d[0]),f+=d[0].length,f==r.length)break;let h=r[f++];if(f==r.length&&h=="!"){s=0;break}if(h!="/")throw RangeError("Invalid path: "+r);l=r.slice(f)}let a=o.length-1,u=o[a];if(!u)throw RangeError("Invalid path: "+r);let c=new sf(i,s,a>0?o.slice(0,a):null);t[u]=c.sort(t[u])}}return yV.add(t)}var yV=new ce({combine(e,t){let n,i,r;while(e||t){if(!e||t&&e.depth<t.depth)r=t,t=t.next;else r=e,e=e.next;if(n&&n.mode==r.mode&&!r.context&&!n.context)continue;let o=new sf(r.tags,r.mode,r.context);if(n)n.next=o;else i=o;n=o}return i}});class sf{constructor(e,t,n,i){this.tags=e,this.mode=t,this.context=n,this.next=i}get opaque(){return this.mode==0}get inherit(){return this.mode==1}sort(e){if(!e||e.depth<this.depth)return this.next=e,this;return e.next=this.sort(e.next),e}get depth(){return this.context?this.context.length:0}}sf.empty=new sf([],2,null);function xx(e,t){let n=Object.create(null);for(let o of e)if(!Array.isArray(o.tag))n[o.tag.id]=o.class;else for(let s of o.tag)n[s.id]=o.class;let{scope:i,all:r=null}=t||{};return{style:(o)=>{let s=r;for(let l of o)for(let a of l.set){let u=n[a.id];if(u){s=s?s+" "+u:u;break}}return s},scope:i}}var U=Wn.define,Xp=U(),Uo=U(),mN=U(Uo),gN=U(Uo),jo=U(),Gp=U(jo),bx=U(jo),sr=U(),Fs=U(sr),rr=U(),or=U(),yx=U(),of=U(yx),Yp=U(),j={comment:Xp,lineComment:U(Xp),blockComment:U(Xp),docComment:U(Xp),name:Uo,variableName:U(Uo),typeName:mN,tagName:U(mN),propertyName:gN,attributeName:U(gN),className:U(Uo),labelName:U(Uo),namespace:U(Uo),macroName:U(Uo),literal:jo,string:Gp,docString:U(Gp),character:U(Gp),attributeValue:U(Gp),number:bx,integer:U(bx),float:U(bx),bool:U(jo),regexp:U(jo),escape:U(jo),color:U(jo),url:U(jo),keyword:rr,self:U(rr),null:U(rr),atom:U(rr),unit:U(rr),modifier:U(rr),operatorKeyword:U(rr),controlKeyword:U(rr),definitionKeyword:U(rr),moduleKeyword:U(rr),operator:or,derefOperator:U(or),arithmeticOperator:U(or),logicOperator:U(or),bitwiseOperator:U(or),compareOperator:U(or),updateOperator:U(or),definitionOperator:U(or),typeOperator:U(or),controlOperator:U(or),punctuation:yx,separator:U(yx),bracket:of,angleBracket:U(of),squareBracket:U(of),paren:U(of),brace:U(of),content:sr,heading:Fs,heading1:U(Fs),heading2:U(Fs),heading3:U(Fs),heading4:U(Fs),heading5:U(Fs),heading6:U(Fs),contentSeparator:U(sr),list:U(sr),quote:U(sr),emphasis:U(sr),strong:U(sr),link:U(sr),monospace:U(sr),strikethrough:U(sr),inserted:U(),deleted:U(),changed:U(),invalid:U(),meta:Yp,documentMeta:U(Yp),annotation:U(Yp),processingInstruction:U(Yp),definition:Wn.defineModifier("definition"),constant:Wn.defineModifier("constant"),function:Wn.defineModifier("function"),standard:Wn.defineModifier("standard"),local:Wn.defineModifier("local"),special:Wn.defineModifier("special")};for(let e in j){let t=j[e];if(t instanceof Wn)t.name=e}var NF=xx([{tag:j.link,class:"tok-link"},{tag:j.heading,class:"tok-heading"},{tag:j.emphasis,class:"tok-emphasis"},{tag:j.strong,class:"tok-strong"},{tag:j.keyword,class:"tok-keyword"},{tag:j.atom,class:"tok-atom"},{tag:j.bool,class:"tok-bool"},{tag:j.url,class:"tok-url"},{tag:j.labelName,class:"tok-labelName"},{tag:j.inserted,class:"tok-inserted"},{tag:j.deleted,class:"tok-deleted"},{tag:j.literal,class:"tok-literal"},{tag:j.string,class:"tok-string"},{tag:j.number,class:"tok-number"},{tag:[j.regexp,j.escape,j.special(j.string)],class:"tok-string2"},{tag:j.variableName,class:"tok-variableName"},{tag:j.local(j.variableName),class:"tok-variableName tok-local"},{tag:j.definition(j.variableName),class:"tok-variableName tok-definition"},{tag:j.special(j.variableName),class:"tok-variableName2"},{tag:j.definition(j.propertyName),class:"tok-propertyName tok-definition"},{tag:j.typeName,class:"tok-typeName"},{tag:j.namespace,class:"tok-namespace"},{tag:j.className,class:"tok-className"},{tag:j.macroName,class:"tok-macroName"},{tag:j.propertyName,class:"tok-propertyName"},{tag:j.operator,class:"tok-operator"},{tag:j.comment,class:"tok-comment"},{tag:j.meta,class:"tok-meta"},{tag:j.invalid,class:"tok-invalid"},{tag:j.punctuation,class:"tok-punctuation"}]);var wx,af=new ce;var xV=new ce;class ki{constructor(e,t,n=[],i=""){if(this.data=e,this.name=i,!pe.prototype.hasOwnProperty("tree"))Object.defineProperty(pe.prototype,"tree",{get(){return _i(this)}});this.parser=t,this.extension=[Va.of(this),pe.languageData.of((r,o,s)=>{let l=bN(r,o,s),a=l.type.prop(af);if(!a)return[];let u=r.facet(a),c=l.type.prop(xV);if(c){let f=l.resolve(o-l.from,s);for(let d of c)if(d.test(f,r)){let h=r.facet(d.facet);return d.type=="replace"?h:h.concat(u)}}return u})].concat(n)}isActiveAt(e,t,n=-1){return bN(e,t,n).type.prop(af)==this.data}findRegions(e){let t=e.facet(Va);if((t===null||t===void 0?void 0:t.data)==this.data)return[{from:0,to:e.doc.length}];if(!t||!t.allowsNesting)return[];let n=[],i=(r,o)=>{if(r.prop(af)==this.data){n.push({from:o,to:o+r.length});return}let s=r.prop(ce.mounted);if(s){if(s.tree.prop(af)==this.data){if(s.overlay)for(let l of s.overlay)n.push({from:l.from+o,to:l.to+o});else n.push({from:o,to:o+r.length});return}else if(s.overlay){let l=n.length;if(i(s.tree,s.overlay[0].from+o),n.length>l)return}}for(let l=0;l<r.children.length;l++){let a=r.children[l];if(a instanceof xt)i(a,r.positions[l]+o)}};return i(_i(e),0),n}get allowsNesting(){return!0}}ki.setState=ye.define();function bN(e,t,n){let i=e.facet(Va),r=_i(e).topNode;if(!i||i.allowsNesting){for(let o=r;o;o=o.enter(t,n,et.ExcludeBuffers|et.EnterBracketed))if(o.type.isTop)r=o}return r}function _i(e){let t=e.field(ki.state,!1);return t?t.tree:xt.empty}class kN{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 n=this.cursorPos-this.string.length;if(e<n||t>=this.cursorPos)return this.doc.sliceString(e,t);else return this.string.slice(e-n,t-n)}}var lf=null;class Qp{constructor(e,t,n=[],i,r,o,s,l){this.parser=e,this.state=t,this.fragments=n,this.tree=i,this.treeLen=r,this.viewport=o,this.skipped=s,this.scheduleOn=l,this.parse=null,this.tempSkipped=[]}static create(e,t,n){return new Qp(e,t,[],xt.empty,0,n,[],null)}startParse(){return this.parser.startParse(new kN(this.state.doc),this.fragments)}work(e,t){if(t!=null&&t>=this.state.doc.length)t=void 0;if(this.tree!=xt.empty&&this.isDone(t!==null&&t!==void 0?t:this.state.doc.length))return this.takeTree(),!0;return this.withContext(()=>{var n;if(typeof e=="number"){let i=Date.now()+e;e=()=>Date.now()>i}if(!this.parse)this.parse=this.startParse();if(t!=null&&(this.parse.stoppedAt==null||this.parse.stoppedAt>t)&&t<this.state.doc.length)this.parse.stopAt(t);for(;;){let i=this.parse.advance();if(i)if(this.fragments=this.withoutTempSkipped(Ho.addTree(i,this.fragments,this.parse.stoppedAt!=null)),this.treeLen=(n=this.parse.stoppedAt)!==null&&n!==void 0?n:this.state.doc.length,this.tree=i,this.parse=null,this.treeLen<(t!==null&&t!==void 0?t:this.state.doc.length))this.parse=this.startParse();else return!0;if(e())return!1}})}takeTree(){let e,t;if(this.parse&&(e=this.parse.parsedPos)>=this.treeLen){if(this.parse.stoppedAt==null||this.parse.stoppedAt>e)this.parse.stopAt(e);this.withContext(()=>{while(!(t=this.parse.advance()));}),this.treeLen=e,this.tree=t,this.fragments=this.withoutTempSkipped(Ho.addTree(this.tree,this.fragments,!0)),this.parse=null}}withContext(e){let t=lf;lf=this;try{return e()}finally{lf=t}}withoutTempSkipped(e){for(let t;t=this.tempSkipped.pop();)e=yN(e,t.from,t.to);return e}changes(e,t){let{fragments:n,tree:i,treeLen:r,viewport:o,skipped:s}=this;if(this.takeTree(),!e.empty){let l=[];if(e.iterChangedRanges((a,u,c,f)=>l.push({fromA:a,toA:u,fromB:c,toB:f})),n=Ho.applyChanges(n,l),i=xt.empty,r=0,o={from:e.mapPos(o.from,-1),to:e.mapPos(o.to,1)},this.skipped.length){s=[];for(let a of this.skipped){let u=e.mapPos(a.from,1),c=e.mapPos(a.to,-1);if(u<c)s.push({from:u,to:c})}}}return new Qp(this.parser,t,n,i,r,o,s,this.scheduleOn)}updateViewport(e){if(this.viewport.from==e.from&&this.viewport.to==e.to)return!1;this.viewport=e;let t=this.skipped.length;for(let n=0;n<this.skipped.length;n++){let{from:i,to:r}=this.skipped[n];if(i<e.to&&r>e.from)this.fragments=yN(this.fragments,i,r),this.skipped.splice(n--,1)}if(this.skipped.length>=t)return!1;return this.reset(),!0}reset(){if(this.parse)this.takeTree(),this.parse=null}skipUntilInView(e,t){this.skipped.push({from:e,to:t})}static getSkippingParser(e){return new class extends vx{createParse(t,n,i){let r=i[0].from,o=i[i.length-1].to;return{parsedPos:r,advance(){let l=lf;if(l){for(let a of i)l.tempSkipped.push(a);if(e)l.scheduleOn=l.scheduleOn?Promise.all([l.scheduleOn,e]):e}return this.parsedPos=o,new xt(On.none,[],[],o-r)},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 lf}}function yN(e,t,n){return Ho.applyChanges(e,[{fromA:t,toA:n,fromB:t,toB:n}])}class Ia{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),n=this.context.treeLen==e.startState.doc.length?void 0:Math.max(e.changes.mapPos(this.context.treeLen),t.viewport.to);if(!t.work(20,n))t.takeTree();return new Ia(t)}static init(e){let t=Math.min(3000,e.doc.length),n=Qp.create(e.facet(Va).parser,e,{from:0,to:t});if(!n.work(20,t))n.takeTree();return new Ia(n)}}ki.state=kn.define({create:Ia.init,update(e,t){for(let n of t.effects)if(n.is(ki.setState))return n.value;if(t.startState.facet(Va)!=t.state.facet(Va))return Ia.init(t.state);return e.apply(t)}});var _N=(e)=>{let t=setTimeout(()=>e(),500);return()=>clearTimeout(t)};if(typeof requestIdleCallback<"u")_N=(e)=>{let t=-1,n=setTimeout(()=>{t=requestIdleCallback(e,{timeout:400})},100);return()=>t<0?clearTimeout(n):cancelIdleCallback(t)};var Sx=typeof navigator<"u"&&((wx=navigator.scheduling)===null||wx===void 0?void 0:wx.isInputPending)?()=>navigator.scheduling.isInputPending():null,wV=En.fromClass(class{constructor(t){this.view=t,this.working=null,this.workScheduled=0,this.chunkEnd=-1,this.chunkBudget=-1,this.work=this.work.bind(this),this.scheduleWork()}update(t){let n=this.view.state.field(ki.state).context;if(n.updateViewport(t.view.viewport)||this.view.viewport.to>n.treeLen)this.scheduleWork();if(t.docChanged||t.selectionSet){if(this.view.hasFocus)this.chunkBudget+=50;this.scheduleWork()}this.checkAsyncSchedule(n)}scheduleWork(){if(this.working)return;let{state:t}=this.view,n=t.field(ki.state);if(n.tree!=n.context.tree||!n.context.isDone(t.doc.length))this.working=_N(this.work)}work(t){this.working=null;let n=Date.now();if(this.chunkEnd<n&&(this.chunkEnd<0||this.view.hasFocus))this.chunkEnd=n+30000,this.chunkBudget=3000;if(this.chunkBudget<=0)return;let{state:i,viewport:{to:r}}=this.view,o=i.field(ki.state);if(o.tree==o.context.tree&&o.context.isDone(r+1e5))return;let s=Date.now()+Math.min(this.chunkBudget,100,t&&!Sx?Math.max(25,t.timeRemaining()-5):1e9),l=o.context.treeLen<r&&i.doc.length>r+1000,a=o.context.work(()=>Sx&&Sx()||Date.now()>s,r+(l?0:1e5));if(this.chunkBudget-=Date.now()-n,a||this.chunkBudget<=0)o.context.takeTree(),this.view.dispatch({effects:ki.setState.of(new Ia(o.context))});if(this.chunkBudget>0&&!(a&&!l))this.scheduleWork();this.checkAsyncSchedule(o.context)}checkAsyncSchedule(t){if(t.scheduleOn)this.workScheduled++,t.scheduleOn.then(()=>this.scheduleWork()).catch((n)=>Xt(this.view.state,n)).then(()=>this.workScheduled--),t.scheduleOn=null}destroy(){if(this.working)this.working()}isWorking(){return!!(this.working||this.workScheduled>0)}},{eventHandlers:{focus(){this.scheduleWork()}}}),Va=J.define({combine(e){return e.length?e[0]:null},enables:(e)=>[ki.state,wV,W.contentAttributes.compute([e],(t)=>{let n=t.facet(e);return n&&n.name?{"data-language":n.name}:{}})]});var SV=J.define(),uf=J.define({combine:(e)=>{if(!e.length)return" ";let t=e[0];if(!t||/\S/.test(t)||Array.from(t).some((n)=>n!=t[0]))throw Error("Invalid indent unit: "+JSON.stringify(e[0]));return t}});function cf(e){let t=e.facet(uf);return t.charCodeAt(0)==9?e.tabSize*t.length:t.length}function ff(e,t){let n="",i=e.tabSize,r=e.facet(uf)[0];if(r=="\t"){while(t>=i)n+="\t",t-=i;r=" "}for(let o=0;o<t;o++)n+=r;return n}function Ex(e,t){if(e instanceof pe)e=new Ha(e);for(let i of e.state.facet(SV)){let r=i(e,t);if(r!==void 0)return r}let n=_i(e.state);return n.length>=t?_V(e,n,t):null}class Ha{constructor(e,t={}){this.state=e,this.options=t,this.unit=cf(e)}lineAt(e,t=1){let n=this.state.doc.lineAt(e),{simulateBreak:i,simulateDoubleBreak:r}=this.options;if(i!=null&&i>=n.from&&i<=n.to)if(r&&i==e)return{text:"",from:e};else if(t<0?i<e:i<=e)return{text:n.text.slice(i-n.from),from:i};else return{text:n.text.slice(0,i-n.from),from:n.from};return n}textAfterPos(e,t=1){if(this.options.simulateDoubleBreak&&e==this.options.simulateBreak)return"";let{text:n,from:i}=this.lineAt(e,t);return n.slice(e-i,Math.min(n.length,e+100-i))}column(e,t=1){let{text:n,from:i}=this.lineAt(e,t),r=this.countColumn(n,e-i),o=this.options.overrideIndentation?this.options.overrideIndentation(i):-1;if(o>-1)r+=o-this.countColumn(n,n.search(/\S|$/));return r}countColumn(e,t=e.length){return Ps(e,this.state.tabSize,t)}lineIndent(e,t=1){let{text:n,from:i}=this.lineAt(e,t),r=this.options.overrideIndentation;if(r){let o=r(i);if(o>-1)return o}return this.countColumn(n,n.search(/\S|$/))}get simulatedBreak(){return this.options.simulateBreak||null}}var kV=new ce;function _V(e,t,n){let i=t.resolveStack(n),r=t.resolveInner(n,-1).resolve(n,0).enterUnfinishedNodesBefore(n);if(r!=i.node){let o=[];for(let s=r;s&&!(s.from<i.node.from||s.to>i.node.to||s.from==i.node.from&&s.type==i.node.type);s=s.parent)o.push(s);for(let s=o.length-1;s>=0;s--)i={node:o[s],next:i}}return CN(i,e,n)}function CN(e,t,n){for(let i=e;i;i=i.next){let r=EV(i.node);if(r)return r(Ox.create(t,n,i))}return 0}function CV(e){return e.pos==e.options.simulateBreak&&e.options.simulateDoubleBreak}function EV(e){let t=e.type.prop(kV);if(t)return t;let n=e.firstChild,i;if(n&&(i=n.type.prop(ce.closedBy))){let r=e.lastChild,o=r&&i.indexOf(r.name)>-1;return(s)=>TV(s,!0,1,void 0,o&&!CV(s)?r.from:void 0)}return e.parent==null?OV:null}function OV(){return 0}class Ox extends Ha{constructor(e,t,n){super(e.state,e.options);this.base=e,this.pos=t,this.context=n}get node(){return this.context.node}static create(e,t,n){return new Ox(e,t,n)}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 n=e.resolve(t.from);while(n.parent&&n.parent.from==n.from)n=n.parent;if(AV(n,e))break;t=this.state.doc.lineAt(n.from)}return this.lineIndent(t.from)}continue(){return CN(this.context.next,this.base,this.pos)}}function AV(e,t){for(let n=t;n;n=n.parent)if(e==n)return!0;return!1}function RV(e){let t=e.node,n=t.childAfter(t.from),i=t.lastChild;if(!n)return null;let r=e.options.simulateBreak,o=e.state.doc.lineAt(n.from),s=r==null||r<=o.from?o.to:Math.min(o.to,r);for(let l=n.to;;){let a=t.childAfter(l);if(!a||a==i)return null;if(!a.type.isSkipped){if(a.from>=s)return null;let u=/^ */.exec(o.text.slice(n.to-o.from))[0].length;return{from:n.from,to:n.to+u}}l=a.to}}function TV(e,t,n,i,r){let o=e.textAfter,s=o.match(/^\s*/)[0].length,l=i&&o.slice(s,s+i.length)==i||r==e.pos+s,a=t?RV(e):null;if(a)return l?e.column(a.from):e.column(a.to);return e.baseIndent+(l?0:e.unit*n)}class Ax{constructor(e,t){this.specs=e;let n;function i(s){let l=vi.newName();return(n||(n=Object.create(null)))["."+l]=s,l}let r=typeof t.all=="string"?t.all:t.all?i(t.all):void 0,o=t.scope;this.scope=o instanceof ki?(s)=>s.prop(af)==o.data:o?(s)=>s==o:void 0,this.style=xx(e.map((s)=>({tag:s.tag,class:s.class||i(Object.assign({},s,{tag:null}))})),{all:r}).style,this.module=n?new vi(n):null,this.themeType=t.themeType}static define(e,t){return new Ax(e,t||{})}}var jF=Ax.define([{tag:j.meta,color:"#404740"},{tag:j.link,textDecoration:"underline"},{tag:j.heading,textDecoration:"underline",fontWeight:"bold"},{tag:j.emphasis,fontStyle:"italic"},{tag:j.strong,fontWeight:"bold"},{tag:j.strikethrough,textDecoration:"line-through"},{tag:j.keyword,color:"#708"},{tag:[j.atom,j.bool,j.url,j.contentSeparator,j.labelName],color:"#219"},{tag:[j.literal,j.inserted],color:"#164"},{tag:[j.string,j.deleted],color:"#a11"},{tag:[j.regexp,j.escape,j.special(j.string)],color:"#e40"},{tag:j.definition(j.variableName),color:"#00f"},{tag:j.local(j.variableName),color:"#30a"},{tag:[j.typeName,j.namespace],color:"#085"},{tag:j.className,color:"#167"},{tag:[j.special(j.variableName),j.macroName],color:"#256"},{tag:j.definition(j.propertyName),color:"#00c"},{tag:j.comment,color:"#940"},{tag:j.invalid,color:"#f00"}]);var MV=1e4,NV="()[]{}";var DV=new ce;function _x(e,t,n){let i=e.prop(t<0?ce.openedBy:ce.closedBy);if(i)return i;if(e.name.length==1){let r=n.indexOf(e.name);if(r>-1&&r%2==(t<0?1:0))return[n[r+t]]}return null}function Cx(e){let t=e.type.prop(DV);return t?t(e.node):e}function qs(e,t,n,i={}){let r=i.maxScanDistance||MV,o=i.brackets||NV,s=_i(e),l=s.resolveInner(t,n);for(let a=l;a;a=a.parent){let u=_x(a.type,n,o);if(u&&a.from<a.to){let c=Cx(a);if(c&&(n>0?t>=c.from&&t<c.to:t>c.from&&t<=c.to))return LV(e,t,n,a,c,u,o)}}return zV(e,t,n,s,l.type,r,o)}function LV(e,t,n,i,r,o,s){let l=i.parent,a={from:r.from,to:r.to},u=0,c=l===null||l===void 0?void 0:l.cursor();if(c&&(n<0?c.childBefore(i.from):c.childAfter(i.to)))do if(n<0?c.to<=i.from:c.from>=i.to){if(u==0&&o.indexOf(c.type.name)>-1&&c.from<c.to){let f=Cx(c);return{start:a,end:f?{from:f.from,to:f.to}:void 0,matched:!0}}else if(_x(c.type,n,s))u++;else if(_x(c.type,-n,s)){if(u==0){let f=Cx(c);return{start:a,end:f&&f.from<f.to?{from:f.from,to:f.to}:void 0,matched:!1}}u--}}while(n<0?c.prevSibling():c.nextSibling());return{start:a,matched:!1}}function zV(e,t,n,i,r,o,s){if(n<0?!t:t==e.doc.length)return null;let l=n<0?e.sliceDoc(t-1,t):e.sliceDoc(t,t+1),a=s.indexOf(l);if(a<0||a%2==0!=n>0)return null;let u={from:n<0?t-1:t,to:n>0?t+1:t},c=e.doc.iterRange(t,n>0?e.doc.length:0),f=0;for(let d=0;!c.next().done&&d<=o;){let h=c.value;if(n<0)d+=h.length;let m=t+d*n;for(let b=n>0?0:h.length-1,x=n>0?h.length:-1;b!=x;b+=n){let g=s.indexOf(h[b]);if(g<0||i.resolveInner(m+b,1).type!=r)continue;if(g%2==0==n>0)f++;else if(f==1)return{start:u,end:{from:m+b,to:m+b+1},matched:g>>1==a>>1};else f--}if(n>0)d+=h.length}return c.done?{start:u,matched:!1}:null}var BV=Object.create(null),xN=[On.none];var wN=[],SN=Object.create(null),PV=Object.create(null);for(let[e,t]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"]])PV[e]=IV(BV,t);function kx(e,t){if(wN.indexOf(e)>-1)return;wN.push(e),console.warn(t)}function IV(e,t){let n=[];for(let l of t.split(" ")){let a=[];for(let u of l.split(".")){let c=e[u]||j[u];if(!c)kx(u,`Unknown highlighting tag ${u}`);else if(typeof c=="function")if(!a.length)kx(u,`Modifier ${u} used at start of tag`);else a=a.map(c);else if(a.length)kx(u,`Tag ${u} used as modifier`);else a=Array.isArray(c)?c:[c]}for(let u of a)n.push(u)}if(!n.length)return 0;let i=t.replace(/ /g,"_"),r=i+" "+n.map((l)=>l.id),o=SN[r];if(o)return o.id;let s=SN[r]=On.define({id:xN.length,name:i,props:[vN({[i]:n})]});return xN.push(s),s.id}var KF={rtl:Oe.mark({class:"cm-iso",inclusive:!0,attributes:{dir:"rtl"},bidiIsolate:je.RTL}),ltr:Oe.mark({class:"cm-iso",inclusive:!0,attributes:{dir:"ltr"},bidiIsolate:je.LTR}),auto:Oe.mark({class:"cm-iso",inclusive:!0,attributes:{dir:"auto"},bidiIsolate:null})};class Nx{constructor(e,t,n,i){this.state=e,this.pos=t,this.explicit=n,this.view=i,this.abortListeners=[],this.abortOnDocChange=!1}tokenBefore(e){let t=_i(this.state).resolveInner(this.pos,-1);while(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),n=Math.max(t.from,this.pos-250),i=t.text.slice(n-t.from,this.pos-t.from),r=i.search(MN(e,!1));return r<0?null:{from:n+r,to:this.pos,text:i.slice(r)}}get aborted(){return this.abortListeners==null}addEventListener(e,t,n){if(e=="abort"&&this.abortListeners){if(this.abortListeners.push(t),n&&n.onDocChange)this.abortOnDocChange=!0}}}function EN(e){let t=Object.keys(e).join(""),n=/\w/.test(t);if(n)t=t.replace(/\w/g,"");return`[${n?"\\w":""}${t.replace(/[^\w\s]/g,"\\$&")}]`}function VV(e){let t=Object.create(null),n=Object.create(null);for(let{label:r}of e){t[r[0]]=!0;for(let o=1;o<r.length;o++)n[r[o]]=!0}let i=EN(t)+EN(n)+"*$";return[new RegExp("^"+i),new RegExp(i)]}function HV(e){let t=e.map((r)=>typeof r=="string"?{label:r}:r),[n,i]=t.every((r)=>/^\w+$/.test(r.label))?[/\w*$/,/\w+$/]:VV(t);return(r)=>{let o=r.matchBefore(i);return o||r.explicit?{from:o?o.from:r.pos,options:t,validFor:n}:null}}class Mx{constructor(e,t,n,i){this.completion=e,this.source=t,this.match=n,this.score=i}}function $s(e){return e.selection.main.from}function MN(e,t){var n;let{source:i}=e,r=t&&i[0]!="^",o=i[i.length-1]!="$";if(!r&&!o)return e;return new RegExp(`${r?"^":""}(?:${i})${o?"$":""}`,(n=e.flags)!==null&&n!==void 0?n:e.ignoreCase?"i":"")}var NN=_n.define();function UV(e,t,n,i){let{main:r}=e.selection,o=n-r.from,s=i-r.from;return{...e.changeByRange((l)=>{if(l!=r&&n!=i&&e.sliceDoc(l.from+o,l.from+s)!=e.sliceDoc(n,i))return{range:l};let a=e.toText(t);return{changes:{from:l.from+o,to:i==r.from?l.to:l.from+s,insert:a},range:R.cursor(l.from+o+a.length)}}),scrollIntoView:!0,userEvent:"input.complete"}}var ON=new WeakMap;function jV(e){if(!Array.isArray(e))return e;let t=ON.get(e);if(!t)ON.set(e,t=HV(e));return t}var Zp=ye.define(),df=ye.define();class DN{constructor(e){this.pattern=e,this.chars=[],this.folded=[],this.any=[],this.precise=[],this.byWord=[],this.score=0,this.matched=[];for(let t=0;t<e.length;){let n=Br(e,t),i=Do(n);this.chars.push(n);let r=e.slice(t,t+i),o=r.toUpperCase();this.folded.push(Br(o==r?r.toLowerCase():o,0)),t+=i}this.astral=e.length!=this.chars.length}ret(e,t){return this.score=e,this.matched=t,this}match(e){if(this.pattern.length==0)return this.ret(-100,[]);if(e.length<this.pattern.length)return null;let{chars:t,folded:n,any:i,precise:r,byWord:o}=this;if(t.length==1){let g=Br(e,0),v=Do(g),w=v==e.length?0:-100;if(g==t[0]);else if(g==n[0])w+=-200;else return null;return this.ret(w,[0,v])}let s=e.indexOf(this.pattern);if(s==0)return this.ret(e.length==this.pattern.length?0:-100,[0,this.pattern.length]);let l=t.length,a=0;if(s<0){for(let g=0,v=Math.min(e.length,200);g<v&&a<l;){let w=Br(e,g);if(w==t[a]||w==n[a])i[a++]=g;g+=Do(w)}if(a<l)return null}let u=0,c=0,f=!1,d=0,h=-1,m=-1,b=/[a-z]/.test(e),x=!0;for(let g=0,v=Math.min(e.length,200),w=0;g<v&&c<l;){let S=Br(e,g);if(s<0){if(u<l&&S==t[u])r[u++]=g;if(d<l)if(S==t[d]||S==n[d]){if(d==0)h=g;m=g+1,d++}else d=0}let k,E=S<255?S>=48&&S<=57||S>=97&&S<=122?2:S>=65&&S<=90?1:0:(k=JT(S))!=k.toLowerCase()?1:k!=k.toUpperCase()?2:0;if(!g||E==1&&b||w==0&&E!=0){if(t[c]==S||n[c]==S&&(f=!0))o[c++]=g;else if(o.length)x=!1}w=E,g+=Do(S)}if(c==l&&o[0]==0&&x)return this.result(-100+(f?-200:0),o,e);if(d==l&&h==0)return this.ret(-200-e.length+(m==e.length?0:-100),[0,m]);if(s>-1)return this.ret(-700-e.length,[s,s+this.pattern.length]);if(d==l)return this.ret(-900-e.length,[h,m]);if(c==l)return this.result(-100+(f?-200:0)+-700+(x?0:-1100),o,e);return t.length==2?null:this.result((i[0]?-700:0)+-200+-1100,i,e)}result(e,t,n){let i=[],r=0;for(let o of t){let s=o+(this.astral?Do(Br(n,o)):1);if(r&&i[r-1]==o)i[r-1]=s;else i[r++]=o,i[r++]=s}return this.ret(e-n.length,i)}}class LN{constructor(e){this.pattern=e,this.matched=[],this.score=0,this.folded=e.toLowerCase()}match(e){if(e.length<this.pattern.length)return null;let t=e.slice(0,this.pattern.length),n=t==this.pattern?0:t.toLowerCase()==this.folded?-200:null;if(n==null)return null;return this.matched=[0,t.length],this.score=n+(e.length==this.pattern.length?0:-100),this}}var wt=J.define({combine(e){return Oa(e,{activateOnTyping:!0,activateOnCompletion:()=>!1,activateOnTypingDelay:100,selectOnOpen:!0,override:null,closeOnBlur:!0,maxRenderedOptions:100,defaultKeymap:!0,tooltipClass:()=>"",optionClass:()=>"",aboveCursor:!1,icons:!0,addToOptions:[],positionInfo:KV,filterStrict:!1,compareCompletions:(t,n)=>(t.sortText||t.label).localeCompare(n.sortText||n.label),interactionDelay:75,updateSyncTime:100},{defaultKeymap:(t,n)=>t&&n,closeOnBlur:(t,n)=>t&&n,icons:(t,n)=>t&&n,tooltipClass:(t,n)=>(i)=>AN(t(i),n(i)),optionClass:(t,n)=>(i)=>AN(t(i),n(i)),addToOptions:(t,n)=>t.concat(n),filterStrict:(t,n)=>t||n})}});function AN(e,t){return e?t?e+" "+t:e:t}function KV(e,t,n,i,r,o){let s=e.textDirection==je.RTL,l=s,a=!1,u="top",c,f,d=t.left-r.left,h=r.right-t.right,m=i.right-i.left,b=i.bottom-i.top;if(l&&d<Math.min(m,h))l=!1;else if(!l&&h<Math.min(m,d))l=!0;if(m<=(l?d:h))c=Math.max(r.top,Math.min(n.top,r.bottom-b))-t.top,f=Math.min(400,l?d:h);else{a=!0,f=Math.min(400,(s?t.right:r.right-t.left)-30);let v=r.bottom-t.bottom;if(v>=b||v>t.top)c=n.bottom-t.top;else u="bottom",c=t.bottom-n.top}let x=(t.bottom-t.top)/o.offsetHeight,g=(t.right-t.left)/o.offsetWidth;return{style:`${u}: ${c/x}px; max-width: ${f/g}px`,class:"cm-completionInfo-"+(a?s?"left-narrow":"right-narrow":l?"left":"right")}}var Dx=ye.define();function FV(e){let t=e.addToOptions.slice();if(e.icons)t.push({render(n){let i=document.createElement("div");if(i.classList.add("cm-completionIcon"),n.type)i.classList.add(...n.type.split(/\s+/g).map((r)=>"cm-completionIcon-"+r));return i.setAttribute("aria-hidden","true"),i},position:20});return t.push({render(n,i,r,o){let s=document.createElement("span");s.className="cm-completionLabel";let l=n.displayLabel||n.label,a=0;for(let u=0;u<o.length;){let c=o[u++],f=o[u++];if(c>a)s.appendChild(document.createTextNode(l.slice(a,c)));let d=s.appendChild(document.createElement("span"));d.appendChild(document.createTextNode(l.slice(c,f))),d.className="cm-completionMatchedText",a=f}if(a<l.length)s.appendChild(document.createTextNode(l.slice(a)));return s},position:50},{render(n){if(!n.detail)return null;let i=document.createElement("span");return i.className="cm-completionDetail",i.textContent=n.detail,i},position:80}),t.sort((n,i)=>n.position-i.position).map((n)=>n.render)}function Rx(e,t,n){if(e<=n)return{from:0,to:e};if(t<0)t=0;if(t<=e>>1){let r=Math.floor(t/n);return{from:r*n,to:(r+1)*n}}let i=Math.ceil((e-t)/n);return{from:e-i*n,to:e-(i-1)*n}}class zN{constructor(e,t,n){this.view=e,this.stateField=t,this.applyCompletion=n,this.info=null,this.infoDestroy=null,this.placeInfoReq={read:()=>this.measureInfo(),write:(l)=>this.placeInfo(l),key:this},this.space=null,this.currentClass="";let i=e.state.field(t),{options:r,selected:o}=i.open,s=e.state.facet(wt);this.optionContent=FV(s),this.optionClass=s.optionClass,this.tooltipClass=s.tooltipClass,this.range=Rx(r.length,o,s.maxRenderedOptions),this.dom=document.createElement("div"),this.dom.className="cm-tooltip-autocomplete",this.updateTooltipClass(e.state),this.dom.addEventListener("mousedown",(l)=>{let{options:a}=e.state.field(t).open;for(let u=l.target,c;u&&u!=this.dom;u=u.parentNode)if(u.nodeName=="LI"&&(c=/-(\d+)$/.exec(u.id))&&+c[1]<a.length){this.applyCompletion(e,a[+c[1]]),l.preventDefault();return}if(l.target==this.list){let u=this.list.classList.contains("cm-completionListIncompleteTop")&&l.clientY<this.list.firstChild.getBoundingClientRect().top?this.range.from-1:this.list.classList.contains("cm-completionListIncompleteBottom")&&l.clientY>this.list.lastChild.getBoundingClientRect().bottom?this.range.to:null;if(u!=null)e.dispatch({effects:Dx.of(u)}),l.preventDefault()}}),this.dom.addEventListener("focusout",(l)=>{let a=e.state.field(this.stateField,!1);if(a&&a.tooltip&&e.state.facet(wt).closeOnBlur&&l.relatedTarget!=e.contentDOM)e.dispatch({effects:df.of(null)})}),this.showOptions(r,i.id)}mount(){this.updateSel()}showOptions(e,t){if(this.list)this.list.remove();this.list=this.dom.appendChild(this.createListBox(e,t,this.range)),this.list.addEventListener("scroll",()=>{if(this.info)this.view.requestMeasure(this.placeInfoReq)})}update(e){var t;let n=e.state.field(this.stateField),i=e.startState.field(this.stateField);if(this.updateTooltipClass(e.state),n!=i){let{options:r,selected:o,disabled:s}=n.open;if(!i.open||i.open.options!=r)this.range=Rx(r.length,o,e.state.facet(wt).maxRenderedOptions),this.showOptions(r,n.id);if(this.updateSel(),s!=((t=i.open)===null||t===void 0?void 0:t.disabled))this.dom.classList.toggle("cm-tooltip-autocomplete-disabled",!!s)}}updateTooltipClass(e){let t=this.tooltipClass(e);if(t!=this.currentClass){for(let n of this.currentClass.split(" "))if(n)this.dom.classList.remove(n);for(let n of t.split(" "))if(n)this.dom.classList.add(n);this.currentClass=t}}positioned(e){if(this.space=e,this.info)this.view.requestMeasure(this.placeInfoReq)}updateSel(){let e=this.view.state.field(this.stateField),t=e.open;if(t.selected>-1&&t.selected<this.range.from||t.selected>=this.range.to)this.range=Rx(t.options.length,t.selected,this.view.state.facet(wt).maxRenderedOptions),this.showOptions(t.options,e.id);let n=this.updateSelectedOption(t.selected);if(n){this.destroyInfo();let{completion:i}=t.options[t.selected],{info:r}=i;if(!r)return;let o=typeof r==="string"?document.createTextNode(r):r(i);if(!o)return;if("then"in o)o.then((s)=>{if(s&&this.view.state.field(this.stateField,!1)==e)this.addInfoPane(s,i)}).catch((s)=>Xt(this.view.state,s,"completion info"));else this.addInfoPane(o,i),n.setAttribute("aria-describedby",this.info.id)}}addInfoPane(e,t){this.destroyInfo();let n=this.info=document.createElement("div");if(n.className="cm-tooltip cm-completionInfo",n.id="cm-completionInfo-"+Math.floor(Math.random()*65535).toString(16),e.nodeType!=null)n.appendChild(e),this.infoDestroy=null;else{let{dom:i,destroy:r}=e;n.appendChild(i),this.infoDestroy=r||null}this.dom.appendChild(n),this.view.requestMeasure(this.placeInfoReq)}updateSelectedOption(e){let t=null;for(let n=this.list.firstChild,i=this.range.from;n;n=n.nextSibling,i++)if(n.nodeName!="LI"||!n.id)i--;else if(i==e){if(!n.hasAttribute("aria-selected"))n.setAttribute("aria-selected","true"),t=n}else if(n.hasAttribute("aria-selected"))n.removeAttribute("aria-selected"),n.removeAttribute("aria-describedby");if(t)$V(this.list,t);return t}measureInfo(){let e=this.dom.querySelector("[aria-selected]");if(!e||!this.info)return null;let t=this.dom.getBoundingClientRect(),n=this.info.getBoundingClientRect(),i=e.getBoundingClientRect(),r=this.space;if(!r){let o=this.dom.ownerDocument.documentElement;r={left:0,top:0,right:o.clientWidth,bottom:o.clientHeight}}if(i.top>Math.min(r.bottom,t.bottom)-10||i.bottom<Math.max(r.top,t.top)+10)return null;return this.view.state.facet(wt).positionInfo(this.view,t,i,n,r,this.dom)}placeInfo(e){if(this.info)if(e){if(e.style)this.info.style.cssText=e.style;this.info.className="cm-tooltip cm-completionInfo "+(e.class||"")}else this.info.style.cssText="top: -1e6px"}createListBox(e,t,n){let i=document.createElement("ul");i.id=t,i.setAttribute("role","listbox"),i.setAttribute("aria-expanded","true"),i.setAttribute("aria-label",this.view.state.phrase("Completions")),i.addEventListener("mousedown",(o)=>{if(o.target==i)o.preventDefault()});let r=null;for(let o=n.from;o<n.to;o++){let{completion:s,match:l}=e[o],{section:a}=s;if(a){let f=typeof a=="string"?a:a.name;if(f!=r&&(o>n.from||n.from==0))if(r=f,typeof a!="string"&&a.header)i.appendChild(a.header(a));else{let d=i.appendChild(document.createElement("completion-section"));d.textContent=f}}let u=i.appendChild(document.createElement("li"));u.id=t+"-"+o,u.setAttribute("role","option");let c=this.optionClass(s);if(c)u.className=c;for(let f of this.optionContent){let d=f(s,this.view.state,this.view,l);if(d)u.appendChild(d)}}if(n.from)i.classList.add("cm-completionListIncompleteTop");if(n.to<e.length)i.classList.add("cm-completionListIncompleteBottom");return i}destroyInfo(){if(this.info){if(this.infoDestroy)this.infoDestroy();this.info.remove(),this.info=null}}destroy(){this.destroyInfo()}}function qV(e,t){return(n)=>new zN(n,e,t)}function $V(e,t){let n=e.getBoundingClientRect(),i=t.getBoundingClientRect(),r=n.height/e.offsetHeight;if(i.top<n.top)e.scrollTop-=(n.top-i.top)/r;else if(i.bottom>n.bottom)e.scrollTop+=(i.bottom-n.bottom)/r}function RN(e){return(e.boost||0)*100+(e.apply?10:0)+(e.info?5:0)+(e.type?1:0)}function XV(e,t){let n=[],i=null,r=null,o=(c)=>{n.push(c);let{section:f}=c.completion;if(f){if(!i)i=[];let d=typeof f=="string"?f:f.name;if(!i.some((h)=>h.name==d))i.push(typeof f=="string"?{name:d}:f)}},s=t.facet(wt);for(let c of e)if(c.hasResult()){let f=c.result.getMatch;if(c.result.filter===!1)for(let d of c.result.options)o(new Mx(d,c.source,f?f(d):[],1e9-n.length));else{let d=t.sliceDoc(c.from,c.to),h,m=s.filterStrict?new LN(d):new DN(d);for(let b of c.result.options)if(h=m.match(b.label)){let x=!b.displayLabel?h.matched:f?f(b,h.matched):[],g=h.score+(b.boost||0);if(o(new Mx(b,c.source,x,g)),typeof b.section=="object"&&b.section.rank==="dynamic"){let{name:v}=b.section;if(!r)r=Object.create(null);r[v]=Math.max(g,r[v]||-1e9)}}}}if(i){let c=Object.create(null),f=0,d=(h,m)=>(h.rank==="dynamic"&&m.rank==="dynamic"?r[m.name]-r[h.name]:0)||(typeof h.rank=="number"?h.rank:1e9)-(typeof m.rank=="number"?m.rank:1e9)||(h.name<m.name?-1:1);for(let h of i.sort(d))f-=1e5,c[h.name]=f;for(let h of n){let{section:m}=h.completion;if(m)h.score+=c[typeof m=="string"?m:m.name]}}let l=[],a=null,u=s.compareCompletions;for(let c of n.sort((f,d)=>d.score-f.score||u(f.completion,d.completion))){let f=c.completion;if(!a||a.label!=f.label||a.detail!=f.detail||a.type!=null&&f.type!=null&&a.type!=f.type||a.apply!=f.apply||a.boost!=f.boost)l.push(c);else if(RN(c.completion)>RN(a))l[l.length-1]=c;a=c.completion}return l}class Ua{constructor(e,t,n,i,r,o){this.options=e,this.attrs=t,this.tooltip=n,this.timestamp=i,this.selected=r,this.disabled=o}setSelected(e,t){return e==this.selected||e>=this.options.length?this:new Ua(this.options,TN(t,e),this.tooltip,this.timestamp,e,this.disabled)}static build(e,t,n,i,r,o){if(i&&!o&&e.some((a)=>a.isPending))return i.setDisabled();let s=XV(e,t);if(!s.length)return i&&e.some((a)=>a.isPending)?i.setDisabled():null;let l=t.facet(wt).selectOnOpen?0:-1;if(i&&i.selected!=l&&i.selected!=-1){let a=i.options[i.selected].completion;for(let u=0;u<s.length;u++)if(s[u].completion==a){l=u;break}}return new Ua(s,TN(n,l),{pos:e.reduce((a,u)=>u.hasResult()?Math.min(a,u.from):a,1e8),create:ZV,above:r.aboveCursor},i?i.timestamp:Date.now(),l,!1)}map(e){return new Ua(this.options,this.attrs,{...this.tooltip,pos:e.mapPos(this.tooltip.pos)},this.timestamp,this.selected,this.disabled)}setDisabled(){return new Ua(this.options,this.attrs,this.tooltip,this.timestamp,this.selected,!0)}}class em{constructor(e,t,n){this.active=e,this.id=t,this.open=n}static start(){return new em(QV,"cm-ac-"+Math.floor(Math.random()*2000000).toString(36),null)}update(e){let{state:t}=e,n=t.facet(wt),r=(n.override||t.languageDataAt("autocomplete",$s(t)).map(jV)).map((l)=>(this.active.find((u)=>u.source==l)||new Qn(l,this.active.some((u)=>u.state!=0)?1:0)).update(e,n));if(r.length==this.active.length&&r.every((l,a)=>l==this.active[a]))r=this.active;let o=this.open,s=e.effects.some((l)=>l.is(Lx));if(o&&e.docChanged)o=o.map(e.changes);if(e.selection||r.some((l)=>l.hasResult()&&e.changes.touchesRange(l.from,l.to))||!GV(r,this.active)||s)o=Ua.build(r,t,this.id,o,n,s);else if(o&&o.disabled&&!r.some((l)=>l.isPending))o=null;if(!o&&r.every((l)=>!l.isPending)&&r.some((l)=>l.hasResult()))r=r.map((l)=>l.hasResult()?new Qn(l.source,0):l);for(let l of e.effects)if(l.is(Dx))o=o&&o.setSelected(l.value,this.id);return r==this.active&&o==this.open?this:new em(r,this.id,o)}get tooltip(){return this.open?this.open.tooltip:null}get attrs(){return this.open?this.open.attrs:this.active.length?YV:WV}}function GV(e,t){if(e==t)return!0;for(let n=0,i=0;;){while(n<e.length&&!e[n].hasResult())n++;while(i<t.length&&!t[i].hasResult())i++;let r=n==e.length,o=i==t.length;if(r||o)return r==o;if(e[n++].result!=t[i++].result)return!1}}var YV={"aria-autocomplete":"list"},WV={};function TN(e,t){let n={"aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":e};if(t>-1)n["aria-activedescendant"]=e+"-"+t;return n}var QV=[];function BN(e,t){if(e.isUserEvent("input.complete")){let i=e.annotation(NN);if(i&&t.activateOnCompletion(i))return 12}let n=e.isUserEvent("input.type");return n&&t.activateOnTyping?5:n?1:e.isUserEvent("delete.backward")?2:e.selection?8:e.docChanged?16:0}class Qn{constructor(e,t,n=!1){this.source=e,this.state=t,this.explicit=n}hasResult(){return!1}get isPending(){return this.state==1}update(e,t){let n=BN(e,t),i=this;if(n&8||n&16&&this.touches(e))i=new Qn(i.source,0);if(n&4&&i.state==0)i=new Qn(this.source,1);i=i.updateFor(e,n);for(let r of e.effects)if(r.is(Zp))i=new Qn(i.source,1,r.value);else if(r.is(df))i=new Qn(i.source,0);else if(r.is(Lx)){for(let o of r.value)if(o.source==i.source)i=o}return i}updateFor(e,t){return this.map(e.changes)}map(e){return this}touches(e){return e.changes.touchesRange($s(e.state))}}class ja extends Qn{constructor(e,t,n,i,r,o){super(e,3,t);this.limit=n,this.result=i,this.from=r,this.to=o}hasResult(){return!0}updateFor(e,t){var n;if(!(t&3))return this.map(e.changes);let i=this.result;if(i.map&&!e.changes.empty)i=i.map(i,e.changes);let r=e.changes.mapPos(this.from),o=e.changes.mapPos(this.to,1),s=$s(e.state);if(s>o||!i||t&2&&($s(e.startState)==this.from||s<this.limit))return new Qn(this.source,t&4?1:0);let l=e.changes.mapPos(this.limit);if(JV(i.validFor,e.state,r,o))return new ja(this.source,this.explicit,l,i,r,o);if(i.update&&(i=i.update(i,r,o,new Nx(e.state,s,!1))))return new ja(this.source,this.explicit,l,i,i.from,(n=i.to)!==null&&n!==void 0?n:$s(e.state));return new Qn(this.source,1,this.explicit)}map(e){if(e.empty)return this;let t=this.result.map?this.result.map(this.result,e):this.result;if(!t)return new Qn(this.source,0);return new ja(this.source,this.explicit,e.mapPos(this.limit),t,e.mapPos(this.from),e.mapPos(this.to,1))}touches(e){return e.changes.touchesRange(this.from,this.to)}}function JV(e,t,n,i){if(!e)return!1;let r=t.sliceDoc(n,i);return typeof e=="function"?e(r,n,i,t):MN(e,!0).test(r)}var Lx=ye.define({map(e,t){return e.map((n)=>n.map(t))}}),sn=kn.define({create(){return em.start()},update(e,t){return e.update(t)},provide:(e)=>[cx.from(e,(t)=>t.tooltip),W.contentAttributes.from(e,(t)=>t.attrs)]});function zx(e,t){let n=t.completion.apply||t.completion.label,i=e.state.field(sn).active.find((r)=>r.source==t.source);if(!(i instanceof ja))return!1;if(typeof n=="string")e.dispatch({...UV(e.state,n,i.from,i.to),annotations:NN.of(t.completion)});else n(e,t.completion,i.from,i.to);return!0}var ZV=qV(sn,zx);function Jp(e,t="option"){return(n)=>{let i=n.state.field(sn,!1);if(!i||!i.open||i.open.disabled||Date.now()-i.open.timestamp<n.state.facet(wt).interactionDelay)return!1;let r=1,o;if(t=="page"&&(o=fx(n,i.open.tooltip)))r=Math.max(2,Math.floor(o.dom.offsetHeight/o.dom.querySelector("li").offsetHeight)-1);let{length:s}=i.open.options,l=i.open.selected>-1?i.open.selected+r*(e?1:-1):e?0:s-1;if(l<0)l=t=="page"?0:s-1;else if(l>=s)l=t=="page"?s-1:0;return n.dispatch({effects:Dx.of(l)}),!0}}var eH=(e)=>{let t=e.state.field(sn,!1);if(e.state.readOnly||!t||!t.open||t.open.selected<0||t.open.disabled||Date.now()-t.open.timestamp<e.state.facet(wt).interactionDelay)return!1;return zx(e,t.open.options[t.open.selected])},Tx=(e)=>{if(!e.state.field(sn,!1))return!1;return e.dispatch({effects:Zp.of(!0)}),!0},tH=(e)=>{let t=e.state.field(sn,!1);if(!t||!t.active.some((n)=>n.state!=0))return!1;return e.dispatch({effects:df.of(null)}),!0};class PN{constructor(e,t){this.active=e,this.context=t,this.time=Date.now(),this.updates=[],this.done=void 0}}var nH=50,iH=1000,rH=En.fromClass(class{constructor(e){this.view=e,this.debounceUpdate=-1,this.running=[],this.debounceAccept=-1,this.pendingStart=!1,this.composing=0;for(let t of e.state.field(sn).active)if(t.isPending)this.startQuery(t)}update(e){let t=e.state.field(sn),n=e.state.facet(wt);if(!e.selectionSet&&!e.docChanged&&e.startState.field(sn)==t)return;let i=e.transactions.some((o)=>{let s=BN(o,n);return s&8||(o.selection||o.docChanged)&&!(s&3)});for(let o=0;o<this.running.length;o++){let s=this.running[o];if(i||s.context.abortOnDocChange&&e.docChanged||s.updates.length+e.transactions.length>nH&&Date.now()-s.time>iH){for(let l of s.context.abortListeners)try{l()}catch(a){Xt(this.view.state,a)}s.context.abortListeners=null,this.running.splice(o--,1)}else s.updates.push(...e.transactions)}if(this.debounceUpdate>-1)clearTimeout(this.debounceUpdate);if(e.transactions.some((o)=>o.effects.some((s)=>s.is(Zp))))this.pendingStart=!0;let r=this.pendingStart?50:n.activateOnTypingDelay;if(this.debounceUpdate=t.active.some((o)=>o.isPending&&!this.running.some((s)=>s.active.source==o.source))?setTimeout(()=>this.startUpdate(),r):-1,this.composing!=0){for(let o of e.transactions)if(o.isUserEvent("input.type"))this.composing=2;else if(this.composing==2&&o.selection)this.composing=3}}startUpdate(){this.debounceUpdate=-1,this.pendingStart=!1;let{state:e}=this.view,t=e.field(sn);for(let n of t.active)if(n.isPending&&!this.running.some((i)=>i.active.source==n.source))this.startQuery(n);if(this.running.length&&t.open&&t.open.disabled)this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(wt).updateSyncTime)}startQuery(e){let{state:t}=this.view,n=$s(t),i=new Nx(t,n,e.explicit,this.view),r=new PN(e,i);this.running.push(r),Promise.resolve(e.source(i)).then((o)=>{if(!r.context.aborted)r.done=o||null,this.scheduleAccept()},(o)=>{this.view.dispatch({effects:df.of(null)}),Xt(this.view.state,o)})}scheduleAccept(){if(this.running.every((e)=>e.done!==void 0))this.accept();else if(this.debounceAccept<0)this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(wt).updateSyncTime)}accept(){var e;if(this.debounceAccept>-1)clearTimeout(this.debounceAccept);this.debounceAccept=-1;let t=[],n=this.view.state.facet(wt),i=this.view.state.field(sn);for(let r=0;r<this.running.length;r++){let o=this.running[r];if(o.done===void 0)continue;if(this.running.splice(r--,1),o.done){let l=$s(o.updates.length?o.updates[0].startState:this.view.state),a=Math.min(l,o.done.from+(o.active.explicit?0:1)),u=new ja(o.active.source,o.active.explicit,a,o.done,o.done.from,(e=o.done.to)!==null&&e!==void 0?e:l);for(let c of o.updates)u=u.update(c,n);if(u.hasResult()){t.push(u);continue}}let s=i.active.find((l)=>l.source==o.active.source);if(s&&s.isPending)if(o.done==null){let l=new Qn(o.active.source,0);for(let a of o.updates)l=l.update(a,n);if(!l.isPending)t.push(l)}else this.startQuery(s)}if(t.length||i.open&&i.open.disabled)this.view.dispatch({effects:Lx.of(t)})}},{eventHandlers:{blur(e){let t=this.view.state.field(sn,!1);if(t&&t.tooltip&&this.view.state.facet(wt).closeOnBlur){let n=t.open&&fx(this.view,t.open.tooltip);if(!n||!n.dom.contains(e.relatedTarget))setTimeout(()=>this.view.dispatch({effects:df.of(null)}),10)}},compositionstart(){this.composing=1},compositionend(){if(this.composing==3)setTimeout(()=>this.view.dispatch({effects:Zp.of(!1)}),20);this.composing=0}}}),oH=typeof navigator=="object"&&/Win/.test(navigator.platform),sH=nr.highest(W.domEventHandlers({keydown(e,t){let n=t.state.field(sn,!1);if(!n||!n.open||n.open.disabled||n.open.selected<0||e.key.length>1||e.ctrlKey&&!(oH&&e.altKey)||e.metaKey)return!1;let i=n.open.options[n.open.selected],r=n.active.find((s)=>s.source==i.source),o=i.completion.commitCharacters||r.result.commitCharacters;if(o&&o.indexOf(e.key)>-1)zx(t,i);return!1}})),lH=W.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:0.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:0.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:"'\uD835\uDC65'"}},".cm-completionIcon-constant":{"&:after":{content:"'\uD835\uDC36'"}},".cm-completionIcon-type":{"&:after":{content:"'\uD835\uDC61'"}},".cm-completionIcon-enum":{"&:after":{content:"'∪'"}},".cm-completionIcon-property":{"&:after":{content:"'□'"}},".cm-completionIcon-keyword":{"&:after":{content:"'\uD83D\uDD11︎'"}},".cm-completionIcon-namespace":{"&:after":{content:"'▢'"}},".cm-completionIcon-text":{"&:after":{content:"'abc'",fontSize:"50%",verticalAlign:"middle"}}});var IN=new class extends gi{};IN.startSide=1;IN.endSide=-1;var YF=typeof navigator=="object"&&/Android\b/.test(navigator.userAgent);function VN(e={}){return[sH,sn,wt.of(e),rH,uH,lH]}var aH=[{key:"Ctrl-Space",run:Tx},{mac:"Alt-`",run:Tx},{mac:"Alt-i",run:Tx},{key:"Escape",run:tH},{key:"ArrowDown",run:Jp(!0)},{key:"ArrowUp",run:Jp(!1)},{key:"PageDown",run:Jp(!0,"page")},{key:"PageUp",run:Jp(!1,"page")},{key:"Enter",run:eH}],uH=nr.highest(Ba.computeN([wt],(e)=>e.facet(wt).defaultKeymap?[aH]:[]));var cH=(e)=>{let{state:t}=e,n=t.doc.lineAt(t.selection.main.from),i=jx(e.state,n.from);return i.line?fH(e):i.block?hH(e):!1};function Ux(e,t){return({state:n,dispatch:i})=>{if(n.readOnly)return!1;let r=e(t,n);if(!r)return!1;return i(n.update(r)),!0}}var fH=Ux(gH,0);var dH=Ux(GN,0);var hH=Ux((e,t)=>GN(e,t,mH(t)),0);function jx(e,t){let n=e.languageDataAt("commentTokens",t,1);return n.length?n[0]:{}}var hf=50;function pH(e,{open:t,close:n},i,r){let o=e.sliceDoc(i-hf,i),s=e.sliceDoc(r,r+hf),l=/\s*$/.exec(o)[0].length,a=/^\s*/.exec(s)[0].length,u=o.length-l;if(o.slice(u-t.length,u)==t&&s.slice(a,a+n.length)==n)return{open:{pos:i-l,margin:l&&1},close:{pos:r+a,margin:a&&1}};let c,f;if(r-i<=2*hf)c=f=e.sliceDoc(i,r);else c=e.sliceDoc(i,i+hf),f=e.sliceDoc(r-hf,r);let d=/^\s*/.exec(c)[0].length,h=/\s*$/.exec(f)[0].length,m=f.length-h-n.length;if(c.slice(d,d+t.length)==t&&f.slice(m,m+n.length)==n)return{open:{pos:i+d+t.length,margin:/\s/.test(c.charAt(d+t.length))?1:0},close:{pos:r-h-n.length,margin:/\s/.test(f.charAt(m-1))?1:0}};return null}function mH(e){let t=[];for(let n of e.selection.ranges){let i=e.doc.lineAt(n.from),r=n.to<=i.to?i:e.doc.lineAt(n.to);if(r.from>i.from&&r.from==n.to)r=n.to==i.to+1?i:e.doc.lineAt(n.to-1);let o=t.length-1;if(o>=0&&t[o].to>i.from)t[o].to=r.to;else t.push({from:i.from+/^\s*/.exec(i.text)[0].length,to:r.to})}return t}function GN(e,t,n=t.selection.ranges){let i=n.map((o)=>jx(t,o.from).block);if(!i.every((o)=>o))return null;let r=n.map((o,s)=>pH(t,i[s],o.from,o.to));if(e!=2&&!r.every((o)=>o))return{changes:t.changes(n.map((o,s)=>{if(r[s])return[];return[{from:o.from,insert:i[s].open+" "},{from:o.to,insert:" "+i[s].close}]}))};else if(e!=1&&r.some((o)=>o)){let o=[];for(let s=0,l;s<r.length;s++)if(l=r[s]){let a=i[s],{open:u,close:c}=l;o.push({from:u.pos-a.open.length,to:u.pos+u.margin},{from:c.pos-c.margin,to:c.pos+a.close.length})}return{changes:o}}return null}function gH(e,t,n=t.selection.ranges){let i=[],r=-1;e:for(let{from:o,to:s}of n){let l=i.length,a=1e9,u;for(let c=o;c<=s;){let f=t.doc.lineAt(c);if(u==null){if(u=jx(t,f.from).line,!u)continue e}if(f.from>r&&(o==s||s>f.from)){r=f.from;let d=/^\s*/.exec(f.text)[0].length,h=d==f.length,m=f.text.slice(d,d+u.length)==u?d:-1;if(d<f.text.length&&d<a)a=d;i.push({line:f,comment:m,token:u,indent:d,empty:h,single:!1})}c=f.to+1}if(a<1e9){for(let c=l;c<i.length;c++)if(i[c].indent<i[c].line.text.length)i[c].indent=a}if(i.length==l+1)i[l].single=!0}if(e!=2&&i.some((o)=>o.comment<0&&(!o.empty||o.single))){let o=[];for(let{line:l,token:a,indent:u,empty:c,single:f}of i)if(f||!c)o.push({from:l.from+u,insert:a+" "});let s=t.changes(o);return{changes:s,selection:t.selection.map(s,1)}}else if(e!=1&&i.some((o)=>o.comment>=0)){let o=[];for(let{line:s,comment:l,token:a}of i)if(l>=0){let u=s.from+l,c=u+a.length;if(s.text[c-s.from]==" ")c++;o.push({from:u,to:c})}return{changes:o}}return null}var Px=_n.define(),vH=_n.define(),bH=J.define(),YN=J.define({combine(e){return Oa(e,{minDepth:100,newGroupDelay:500,joinToEvent:(t,n)=>n},{minDepth:Math.max,newGroupDelay:Math.min,joinToEvent:(t,n)=>(i,r)=>t(i,r)||n(i,r)})}}),WN=kn.define({create(){return lr.empty},update(e,t){let n=t.state.facet(YN),i=t.annotation(Px);if(i){let a=ln.fromTransaction(t,i.selection),u=i.side,c=u==0?e.undone:e.done;if(a)c=nm(c,c.length,n.minDepth,a);else c=eD(c,t.startState.selection);return new lr(u==0?i.rest:c,u==0?c:i.rest)}let r=t.annotation(vH);if(r=="full"||r=="before")e=e.isolate();if(t.annotation(Ze.addToHistory)===!1)return!t.changes.empty?e.addMapping(t.changes.desc):e;let o=ln.fromTransaction(t),s=t.annotation(Ze.time),l=t.annotation(Ze.userEvent);if(o)e=e.addChanges(o,s,l,n,t);else if(t.selection)e=e.addSelection(t.startState.selection,s,l,n.newGroupDelay);if(r=="full"||r=="after")e=e.isolate();return e},toJSON(e){return{done:e.done.map((t)=>t.toJSON()),undone:e.undone.map((t)=>t.toJSON())}},fromJSON(e){return new lr(e.done.map(ln.fromJSON),e.undone.map(ln.fromJSON))}});function QN(e={}){return[WN,YN.of(e),W.domEventHandlers({beforeinput(t,n){let i=t.inputType=="historyUndo"?JN:t.inputType=="historyRedo"?Ix:null;if(!i)return!1;return t.preventDefault(),i(n)}})]}function im(e,t){return function({state:n,dispatch:i}){if(!t&&n.readOnly)return!1;let r=n.field(WN,!1);if(!r)return!1;let o=r.pop(e,n,t);if(!o)return!1;return i(o),!0}}var JN=im(0,!1),Ix=im(1,!1),yH=im(0,!0),xH=im(1,!0);class ln{constructor(e,t,n,i,r){this.changes=e,this.effects=t,this.mapped=n,this.startSelection=i,this.selectionsAfter=r}setSelAfter(e){return new ln(this.changes,this.effects,this.mapped,this.startSelection,e)}toJSON(){var e,t,n;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:(n=this.startSelection)===null||n===void 0?void 0:n.toJSON(),selectionsAfter:this.selectionsAfter.map((i)=>i.toJSON())}}static fromJSON(e){return new ln(e.changes&&ot.fromJSON(e.changes),[],e.mapped&&mi.fromJSON(e.mapped),e.startSelection&&R.fromJSON(e.startSelection),e.selectionsAfter.map(R.fromJSON))}static fromTransaction(e,t){let n=Jn;for(let i of e.startState.facet(bH)){let r=i(e);if(r.length)n=n.concat(r)}if(!n.length&&e.changes.empty)return null;return new ln(e.changes.invert(e.startState.doc),n,void 0,t||e.startState.selection,Jn)}static selection(e){return new ln(void 0,Jn,void 0,void 0,e)}}function nm(e,t,n,i){let r=t+1>n+20?t-n-1:0,o=e.slice(r,t);return o.push(i),o}function wH(e,t){let n=[],i=!1;return e.iterChangedRanges((r,o)=>n.push(r,o)),t.iterChangedRanges((r,o,s,l)=>{for(let a=0;a<n.length;){let u=n[a++],c=n[a++];if(l>=u&&s<=c)i=!0}}),i}function SH(e,t){return e.ranges.length==t.ranges.length&&e.ranges.filter((n,i)=>n.empty!=t.ranges[i].empty).length===0}function ZN(e,t){return!e.length?t:!t.length?e:e.concat(t)}var Jn=[],kH=200;function eD(e,t){if(!e.length)return[ln.selection([t])];else{let n=e[e.length-1],i=n.selectionsAfter.slice(Math.max(0,n.selectionsAfter.length-kH));if(i.length&&i[i.length-1].eq(t))return e;return i.push(t),nm(e,e.length-1,1e9,n.setSelAfter(i))}}function _H(e){let t=e[e.length-1],n=e.slice();return n[e.length-1]=t.setSelAfter(t.selectionsAfter.slice(0,t.selectionsAfter.length-1)),n}function Bx(e,t){if(!e.length)return e;let n=e.length,i=Jn;while(n){let r=CH(e[n-1],t,i);if(r.changes&&!r.changes.empty||r.effects.length){let o=e.slice(0,n);return o[n-1]=r,o}else t=r.mapped,n--,i=r.selectionsAfter}return i.length?[ln.selection(i)]:Jn}function CH(e,t,n){let i=ZN(e.selectionsAfter.length?e.selectionsAfter.map((l)=>l.map(t)):Jn,n);if(!e.changes)return ln.selection(i);let r=e.changes.map(t),o=t.mapDesc(e.changes,!0),s=e.mapped?e.mapped.composeDesc(o):o;return new ln(r,ye.mapEffects(e.effects,t),s,e.startSelection.map(o),i)}var EH=/^(input\.type|delete)($|\.)/;class lr{constructor(e,t,n=0,i=void 0){this.done=e,this.undone=t,this.prevTime=n,this.prevUserEvent=i}isolate(){return this.prevTime?new lr(this.done,this.undone):this}addChanges(e,t,n,i,r){let o=this.done,s=o[o.length-1];if(s&&s.changes&&!s.changes.empty&&e.changes&&(!n||EH.test(n))&&(!s.selectionsAfter.length&&t-this.prevTime<i.newGroupDelay&&i.joinToEvent(r,wH(s.changes,e.changes))||n=="input.type.compose"))o=nm(o,o.length-1,i.minDepth,new ln(e.changes.compose(s.changes),ZN(ye.mapEffects(e.effects,s.changes),s.effects),s.mapped,s.startSelection,Jn));else o=nm(o,o.length,i.minDepth,e);return new lr(o,Jn,t,n)}addSelection(e,t,n,i){let r=this.done.length?this.done[this.done.length-1].selectionsAfter:Jn;if(r.length>0&&t-this.prevTime<i&&n==this.prevUserEvent&&n&&/^select($|\.)/.test(n)&&SH(r[r.length-1],e))return this;return new lr(eD(this.done,e),this.undone,t,n)}addMapping(e){return new lr(Bx(this.done,e),Bx(this.undone,e),this.prevTime,this.prevUserEvent)}pop(e,t,n){let i=e==0?this.done:this.undone;if(i.length==0)return null;let r=i[i.length-1],o=r.selectionsAfter[0]||(r.startSelection?r.startSelection.map(r.changes.invertedDesc,1):t.selection);if(n&&r.selectionsAfter.length)return t.update({selection:r.selectionsAfter[r.selectionsAfter.length-1],annotations:Px.of({side:e,rest:_H(i),selection:o}),userEvent:e==0?"select.undo":"select.redo",scrollIntoView:!0});else if(!r.changes)return null;else{let s=i.length==1?Jn:i.slice(0,i.length-1);if(r.mapped)s=Bx(s,r.mapped);return t.update({changes:r.changes,selection:r.startSelection,effects:r.effects,annotations:Px.of({side:e,rest:s,selection:o}),filter:!1,userEvent:e==0?"undo":"redo",scrollIntoView:!0})}}}lr.empty=new lr(Jn,Jn);var tD=[{key:"Mod-z",run:JN,preventDefault:!0},{key:"Mod-y",mac:"Mod-Shift-z",run:Ix,preventDefault:!0},{linux:"Ctrl-Shift-z",run:Ix,preventDefault:!0},{key:"Mod-u",run:yH,preventDefault:!0},{key:"Alt-u",mac:"Mod-Shift-u",run:xH,preventDefault:!0}];function Ka(e,t){return R.create(e.ranges.map(t),e.mainIndex)}function Ci(e,t){return e.update({selection:t,scrollIntoView:!0,userEvent:"select"})}function Ei({state:e,dispatch:t},n){let i=Ka(e.selection,n);if(i.eq(e.selection,!0))return!1;return t(Ci(e,i)),!0}function rm(e,t){return R.cursor(t?e.to:e.from)}function nD(e,t){return Ei(e,(n)=>n.empty?e.moveByChar(n,t):rm(n,t))}function Ht(e){return e.textDirectionAt(e.state.selection.main.head)==je.LTR}var iD=(e)=>nD(e,!Ht(e)),rD=(e)=>nD(e,Ht(e));function oD(e,t){return Ei(e,(n)=>n.empty?e.moveByGroup(n,t):rm(n,t))}var OH=(e)=>oD(e,!Ht(e)),AH=(e)=>oD(e,Ht(e));var iq=typeof Intl<"u"&&Intl.Segmenter?new Intl.Segmenter(void 0,{granularity:"word"}):null;function RH(e,t,n){if(t.type.prop(n))return!0;let i=t.to-t.from;return i&&(i>2||/[^\s,.;:]/.test(e.sliceDoc(t.from,t.to)))||t.firstChild}function om(e,t,n){let i=_i(e).resolveInner(t.head),r=n?ce.closedBy:ce.openedBy;for(let a=t.head;;){let u=n?i.childAfter(a):i.childBefore(a);if(!u)break;if(RH(e,u,r))i=u;else a=n?u.to:u.from}let o=i.type.prop(r),s,l;if(o&&(s=n?qs(e,i.from,1):qs(e,i.to,-1))&&s.matched)l=n?s.end.to:s.end.from;else l=n?i.to:i.from;return R.cursor(l,n?-1:1)}var TH=(e)=>Ei(e,(t)=>om(e.state,t,!Ht(e))),MH=(e)=>Ei(e,(t)=>om(e.state,t,Ht(e)));function sD(e,t){return Ei(e,(n)=>{if(!n.empty)return rm(n,t);let i=e.moveVertically(n,t);return i.head!=n.head?i:e.moveToLineBoundary(n,t)})}var lD=(e)=>sD(e,!1),aD=(e)=>sD(e,!0);function uD(e){let t=e.scrollDOM.clientHeight<e.scrollDOM.scrollHeight-2,n=0,i=0,r;if(t){for(let o of e.state.facet(W.scrollMargins)){let s=o(e);if(s===null||s===void 0?void 0:s.top)n=Math.max(s===null||s===void 0?void 0:s.top,n);if(s===null||s===void 0?void 0:s.bottom)i=Math.max(s===null||s===void 0?void 0:s.bottom,i)}r=e.scrollDOM.clientHeight-n-i}else r=(e.dom.ownerDocument.defaultView||window).innerHeight;return{marginTop:n,marginBottom:i,selfScroll:t,height:Math.max(e.defaultLineHeight,r-5)}}function cD(e,t){let n=uD(e),{state:i}=e,r=Ka(i.selection,(s)=>s.empty?e.moveVertically(s,t,n.height):rm(s,t));if(r.eq(i.selection))return!1;let o;if(n.selfScroll){let s=e.coordsAtPos(i.selection.main.head),l=e.scrollDOM.getBoundingClientRect(),a=l.top+n.marginTop,u=l.bottom-n.marginBottom;if(s&&s.top>a&&s.bottom<u)o=W.scrollIntoView(r.main.head,{y:"start",yMargin:s.top-a})}return e.dispatch(Ci(i,r),{effects:o}),!0}var HN=(e)=>cD(e,!1),Vx=(e)=>cD(e,!0);function Ko(e,t,n){let i=e.lineBlockAt(t.head),r=e.moveToLineBoundary(t,n);if(r.head==t.head&&r.head!=(n?i.to:i.from))r=e.moveToLineBoundary(t,n,!1);if(!n&&r.head==i.from&&i.length){let o=/^\s*/.exec(e.state.sliceDoc(i.from,Math.min(i.from+100,i.to)))[0].length;if(o&&t.head!=i.from+o)r=R.cursor(i.from+o)}return r}var NH=(e)=>Ei(e,(t)=>Ko(e,t,!0)),DH=(e)=>Ei(e,(t)=>Ko(e,t,!1)),LH=(e)=>Ei(e,(t)=>Ko(e,t,!Ht(e))),zH=(e)=>Ei(e,(t)=>Ko(e,t,Ht(e))),BH=(e)=>Ei(e,(t)=>e.moveToLineBoundary(t,!1,!1)),PH=(e)=>Ei(e,(t)=>e.moveToLineBoundary(t,!0,!1));function IH(e,t,n){let i=!1,r=Ka(e.selection,(o)=>{let s=qs(e,o.head,-1)||qs(e,o.head,1)||o.head>0&&qs(e,o.head-1,1)||o.head<e.doc.length&&qs(e,o.head+1,-1);if(!s||!s.end)return o;i=!0;let l=s.start.from==o.head?s.end.to:s.end.from;return n?R.range(o.anchor,l):R.cursor(l)});if(!i)return!1;return t(Ci(e,r)),!0}var VH=({state:e,dispatch:t})=>IH(e,t,!1);function Zn(e,t,n){let i=Ka(e.state.selection,(r)=>{if(r.undirectional&&r.head>=r.anchor!=t)r=R.range(r.head,r.anchor);let o=n(r);return R.range(r.anchor,o.head,o.goalColumn,o.bidiLevel||void 0,o.assoc)});if(i.eq(e.state.selection))return!1;return e.dispatch(Ci(e.state,i)),!0}function fD(e,t){return Zn(e,t,(n)=>e.moveByChar(n,t))}var dD=(e)=>fD(e,!Ht(e)),hD=(e)=>fD(e,Ht(e));function pD(e,t){return Zn(e,t,(n)=>e.moveByGroup(n,t))}var HH=(e)=>pD(e,!Ht(e)),UH=(e)=>pD(e,Ht(e));var jH=(e)=>{let t=!Ht(e);return Zn(e,t,(n)=>om(e.state,n,t))},KH=(e)=>{let t=Ht(e);return Zn(e,t,(n)=>om(e.state,n,t))};function mD(e,t){return Zn(e,t,(n)=>e.moveVertically(n,t))}var gD=(e)=>mD(e,!1),vD=(e)=>mD(e,!0);function bD(e,t){return Zn(e,t,(n)=>e.moveVertically(n,t,uD(e).height))}var UN=(e)=>bD(e,!1),jN=(e)=>bD(e,!0),FH=(e)=>Zn(e,!0,(t)=>Ko(e,t,!0)),qH=(e)=>Zn(e,!1,(t)=>Ko(e,t,!1)),$H=(e)=>{let t=!Ht(e);return Zn(e,t,(n)=>Ko(e,n,t))},XH=(e)=>{let t=Ht(e);return Zn(e,t,(n)=>Ko(e,n,t))},GH=(e)=>Zn(e,!1,(t)=>R.cursor(e.lineBlockAt(t.head).from)),YH=(e)=>Zn(e,!0,(t)=>R.cursor(e.lineBlockAt(t.head).to)),KN=({state:e,dispatch:t})=>(t(Ci(e,{anchor:0})),!0),FN=({state:e,dispatch:t})=>(t(Ci(e,{anchor:e.doc.length})),!0),qN=({state:e,dispatch:t})=>(t(Ci(e,{anchor:e.selection.main.anchor,head:0})),!0),$N=({state:e,dispatch:t})=>(t(Ci(e,{anchor:e.selection.main.anchor,head:e.doc.length})),!0),WH=({state:e,dispatch:t})=>(t(e.update({selection:{anchor:0,head:e.doc.length},userEvent:"select"})),!0),QH=({state:e,dispatch:t})=>{let n=sm(e).map(({from:i,to:r})=>R.undirectionalRange(i,Math.min(r+1,e.doc.length)));return t(e.update({selection:R.create(n),userEvent:"select"})),!0},JH=({state:e,dispatch:t})=>{let n=Ka(e.selection,(i)=>{let r=_i(e),o=r.resolveStack(i.from,1);if(i.empty){let s=r.resolveStack(i.from,-1);if(s.node.from>=o.node.from&&s.node.to<=o.node.to)o=s}for(let s=o;s;s=s.next){let{node:l}=s;if((l.from<i.from&&l.to>=i.to||l.to>i.to&&l.from<=i.from)&&s.next)return R.undirectionalRange(l.from,l.to)}return i});if(n.eq(e.selection))return!1;return t(Ci(e,n)),!0};function yD(e,t){let{state:n}=e,i=n.selection,r=n.selection.ranges.slice();for(let o of n.selection.ranges){let s=n.doc.lineAt(o.head);if(t?s.to<e.state.doc.length:s.from>0)for(let l=o;;){let a=e.moveVertically(l,t);if(a.head<s.from||a.head>s.to){if(!r.some((u)=>u.head==a.head))r.push(a);break}else if(a.head==l.head)break;else l=a}}if(r.length==i.ranges.length)return!1;return e.dispatch(Ci(n,R.create(r,r.length-1))),!0}var ZH=(e)=>yD(e,!1),eU=(e)=>yD(e,!0),tU=({state:e,dispatch:t})=>{let n=e.selection,i=null;if(n.ranges.length>1)i=R.create([n.main]);else if(!n.main.empty)i=R.create([R.cursor(n.main.head)]);if(!i)return!1;return t(Ci(e,i)),!0};function pf(e,t){if(e.state.readOnly)return!1;let n="delete.selection",{state:i}=e,r=i.changeByRange((o)=>{let{from:s,to:l}=o;if(s==l){let a=t(o);if(a<s)n="delete.backward",a=tm(e,a,!1);else if(a>s)n="delete.forward",a=tm(e,a,!0);s=Math.min(s,a),l=Math.max(l,a)}else s=tm(e,s,!1),l=tm(e,l,!0);return s==l?{range:o}:{changes:{from:s,to:l},range:R.cursor(s,s<o.head?-1:1)}});if(r.changes.empty)return!1;return e.dispatch(i.update(r,{scrollIntoView:!0,userEvent:n,effects:n=="delete.selection"?W.announce.of(i.phrase("Selection deleted")):void 0})),!0}function tm(e,t,n){if(e instanceof W)for(let i of e.state.facet(W.atomicRanges).map((r)=>r(e)))i.between(t,t,(r,o)=>{if(r<t&&o>t)t=n?o:r});return t}var xD=(e,t,n)=>pf(e,(i)=>{let r=i.from,{state:o}=e,s=o.doc.lineAt(r),l,a;if(n&&!t&&r>s.from&&r<s.from+200&&!/[^ \t]/.test(l=s.text.slice(0,r-s.from))){if(l[l.length-1]=="\t")return r-1;let u=Ps(l,o.tabSize),c=u%cf(o)||cf(o);for(let f=0;f<c&&l[l.length-1-f]==" ";f++)r--;a=r}else if(a=yt(s.text,r-s.from,t,t)+s.from,a==r&&s.number!=(t?o.doc.lines:1))a+=t?1:-1;else if(!t&&/[\ufe00-\ufe0f]/.test(s.text.slice(a-s.from,r-s.from)))a=yt(s.text,a-s.from,!1,!1)+s.from;return a}),Hx=(e)=>xD(e,!1,!0);var wD=(e)=>xD(e,!0,!1),SD=(e,t)=>pf(e,(n)=>{let i=n.head,{state:r}=e,o=r.doc.lineAt(i),s=r.charCategorizer(i);for(let l=null;;){if(i==(t?o.to:o.from)){if(i==n.head&&o.number!=(t?r.doc.lines:1))i+=t?1:-1;break}let a=yt(o.text,i-o.from,t)+o.from,u=o.text.slice(Math.min(i,a)-o.from,Math.max(i,a)-o.from),c=s(u);if(l!=null&&c!=l)break;if(u!=" "||i!=n.head)l=c;i=a}return i}),kD=(e)=>SD(e,!1),nU=(e)=>SD(e,!0);var iU=(e)=>pf(e,(t)=>{let n=e.lineBlockAt(t.head).to;return t.head<n?n:Math.min(e.state.doc.length,t.head+1)});var rU=(e)=>pf(e,(t)=>{let n=e.moveToLineBoundary(t,!1).head;return t.head>n?n:Math.max(0,t.head-1)}),oU=(e)=>pf(e,(t)=>{let n=e.moveToLineBoundary(t,!0).head;return t.head<n?n:Math.min(e.state.doc.length,t.head+1)});var sU=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=e.changeByRange((i)=>({changes:{from:i.from,to:i.to,insert:de.of(["",""])},range:R.cursor(i.from)}));return t(e.update(n,{scrollIntoView:!0,userEvent:"input"})),!0},lU=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=e.changeByRange((i)=>{if(!i.empty||i.from==0||i.from==e.doc.length)return{range:i};let r=i.from,o=e.doc.lineAt(r),s=r==o.from?r-1:yt(o.text,r-o.from,!1)+o.from,l=r==o.to?r+1:yt(o.text,r-o.from,!0)+o.from;return{changes:{from:s,to:l,insert:e.doc.slice(r,l).append(e.doc.slice(s,r))},range:R.cursor(l)}});if(n.changes.empty)return!1;return t(e.update(n,{scrollIntoView:!0,userEvent:"move.character"})),!0};function sm(e){let t=[],n=-1;for(let i of e.selection.ranges){let r=e.doc.lineAt(i.from),o=e.doc.lineAt(i.to);if(!i.empty&&i.to==o.from)o=e.doc.lineAt(i.to-1);if(n>=r.number){let s=t[t.length-1];s.to=o.to,s.ranges.push(i)}else t.push({from:r.from,to:o.to,ranges:[i]});n=o.number+1}return t}function _D(e,t,n){if(e.readOnly)return!1;let i=[],r=[];for(let o of sm(e)){if(n?o.to==e.doc.length:o.from==0)continue;let s=e.doc.lineAt(n?o.to+1:o.from-1),l=s.length+1;if(n){i.push({from:o.to,to:s.to},{from:o.from,insert:s.text+e.lineBreak});for(let a of o.ranges)r.push(R.range(Math.min(e.doc.length,a.anchor+l),Math.min(e.doc.length,a.head+l)))}else{i.push({from:s.from,to:o.from},{from:o.to,insert:e.lineBreak+s.text});for(let a of o.ranges)r.push(R.range(a.anchor-l,a.head-l))}}if(!i.length)return!1;return t(e.update({changes:i,scrollIntoView:!0,selection:R.create(r,e.selection.mainIndex),userEvent:"move.line"})),!0}var Kx=({state:e,dispatch:t})=>_D(e,t,!1),Fx=({state:e,dispatch:t})=>_D(e,t,!0);function CD(e,t,n){if(e.readOnly)return!1;let i=[];for(let o of sm(e))if(n)i.push({from:o.from,insert:e.doc.slice(o.from,o.to)+e.lineBreak});else i.push({from:o.to,insert:e.lineBreak+e.doc.slice(o.from,o.to)});let r=e.changes(i);return t(e.update({changes:r,selection:e.selection.map(r,n?1:-1),scrollIntoView:!0,userEvent:"input.copyline"})),!0}var aU=({state:e,dispatch:t})=>CD(e,t,!1),uU=({state:e,dispatch:t})=>CD(e,t,!0),cU=(e)=>{if(e.state.readOnly)return!1;let{state:t}=e,n=t.changes(sm(t).map(({from:r,to:o})=>{if(r>0)r--;else if(o<t.doc.length)o++;return{from:r,to:o}})),i=Ka(t.selection,(r)=>{let o=void 0;if(e.lineWrapping){let s=e.lineBlockAt(r.head),l=e.coordsAtPos(r.head,r.assoc||1);if(l)o=s.bottom+e.documentTop-l.bottom+e.defaultLineHeight/2}return e.moveVertically(r,!0,o)}).map(n);return e.dispatch({changes:n,selection:i,scrollIntoView:!0,userEvent:"delete.line"}),!0};function fU(e,t){if(/\(\)|\[\]|\{\}/.test(e.sliceDoc(t-1,t+1)))return{from:t,to:t};let n=_i(e).resolveInner(t),i=n.childBefore(t),r=n.childAfter(t),o;if(i&&r&&i.to<=t&&r.from>=t&&(o=i.type.prop(ce.closedBy))&&o.indexOf(r.name)>-1&&e.doc.lineAt(i.to).from==e.doc.lineAt(r.from).from&&!/\S/.test(e.sliceDoc(i.to,r.from)))return{from:i.to,to:r.from};return null}var XN=ED(!1),dU=ED(!0);function ED(e){return({state:t,dispatch:n})=>{if(t.readOnly)return!1;let i=t.changeByRange((r)=>{let{from:o,to:s}=r,l=t.doc.lineAt(o),a=!e&&o==s&&fU(t,o);if(e)o=s=(s<=l.to?l:t.doc.lineAt(s)).to;let u=new Ha(t,{simulateBreak:o,simulateDoubleBreak:!!a}),c=Ex(u,o);if(c==null)c=Ps(/^\s*/.exec(t.doc.lineAt(o).text)[0],t.tabSize);while(s<l.to&&/\s/.test(l.text[s-l.from]))s++;if(a)({from:o,to:s}=a);else if(o>l.from&&o<l.from+100&&!/\S/.test(l.text.slice(0,o)))o=l.from;let f=["",ff(t,c)];if(a)f.push(ff(t,u.lineIndent(l.from,-1)));return{changes:{from:o,to:s,insert:de.of(f)},range:R.cursor(o+1+f[1].length)}});return n(t.update(i,{scrollIntoView:!0,userEvent:"input"})),!0}}function qx(e,t){let n=-1;return e.changeByRange((i)=>{let r=[];for(let s=i.from;s<=i.to;){let l=e.doc.lineAt(s);if(l.number>n&&(i.empty||i.to>l.from))t(l,r,i),n=l.number;s=l.to+1}let o=e.changes(r);return{changes:r,range:R.range(o.mapPos(i.anchor,1),o.mapPos(i.head,1))}})}var hU=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=Object.create(null),i=new Ha(e,{overrideIndentation:(o)=>{let s=n[o];return s==null?-1:s}}),r=qx(e,(o,s,l)=>{let a=Ex(i,o.from);if(a==null)return;if(!/\S/.test(o.text))a=0;let u=/^\s*/.exec(o.text)[0],c=ff(e,a);if(u!=c||l.from<o.from+u.length)n[o.from]=a,s.push({from:o.from,to:o.from+u.length,insert:c})});if(!r.changes.empty)t(e.update(r,{userEvent:"indent"}));return!0},pU=({state:e,dispatch:t})=>{if(e.readOnly)return!1;return t(e.update(qx(e,(n,i)=>{i.push({from:n.from,insert:e.facet(uf)})}),{userEvent:"input.indent"})),!0},mU=({state:e,dispatch:t})=>{if(e.readOnly)return!1;return t(e.update(qx(e,(n,i)=>{let r=/^\s*/.exec(n.text)[0];if(!r)return;let o=Ps(r,e.tabSize),s=0,l=ff(e,Math.max(0,o-cf(e)));while(s<r.length&&s<l.length&&r.charCodeAt(s)==l.charCodeAt(s))s++;i.push({from:n.from+s,to:n.from+r.length,insert:l.slice(s)})}),{userEvent:"delete.dedent"})),!0},gU=(e)=>(e.setTabFocusMode(),!0);var vU=[{key:"Ctrl-b",run:iD,shift:dD,preventDefault:!0},{key:"Ctrl-f",run:rD,shift:hD},{key:"Ctrl-p",run:lD,shift:gD},{key:"Ctrl-n",run:aD,shift:vD},{key:"Ctrl-a",run:BH,shift:GH},{key:"Ctrl-e",run:PH,shift:YH},{key:"Ctrl-d",run:wD},{key:"Ctrl-h",run:Hx},{key:"Ctrl-k",run:iU},{key:"Ctrl-Alt-h",run:kD},{key:"Ctrl-o",run:sU},{key:"Ctrl-t",run:lU},{key:"Ctrl-v",run:Vx}],bU=[{key:"ArrowLeft",run:iD,shift:dD,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:OH,shift:HH,preventDefault:!0},{mac:"Cmd-ArrowLeft",run:LH,shift:$H,preventDefault:!0},{key:"ArrowRight",run:rD,shift:hD,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:AH,shift:UH,preventDefault:!0},{mac:"Cmd-ArrowRight",run:zH,shift:XH,preventDefault:!0},{key:"ArrowUp",run:lD,shift:gD,preventDefault:!0},{mac:"Cmd-ArrowUp",run:KN,shift:qN},{mac:"Ctrl-ArrowUp",run:HN,shift:UN},{key:"ArrowDown",run:aD,shift:vD,preventDefault:!0},{mac:"Cmd-ArrowDown",run:FN,shift:$N},{mac:"Ctrl-ArrowDown",run:Vx,shift:jN},{key:"PageUp",run:HN,shift:UN},{key:"PageDown",run:Vx,shift:jN},{key:"Home",run:DH,shift:qH,preventDefault:!0},{key:"Mod-Home",run:KN,shift:qN},{key:"End",run:NH,shift:FH,preventDefault:!0},{key:"Mod-End",run:FN,shift:$N},{key:"Enter",run:XN,shift:XN},{key:"Mod-a",run:WH},{key:"Backspace",run:Hx,shift:Hx,preventDefault:!0},{key:"Delete",run:wD,preventDefault:!0},{key:"Mod-Backspace",mac:"Alt-Backspace",run:kD,preventDefault:!0},{key:"Mod-Delete",mac:"Alt-Delete",run:nU,preventDefault:!0},{mac:"Mod-Backspace",run:rU,preventDefault:!0},{mac:"Mod-Delete",run:oU,preventDefault:!0}].concat(vU.map((e)=>({mac:e.key,run:e.run,shift:e.shift}))),OD=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:TH,shift:jH},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:MH,shift:KH},{key:"Alt-ArrowUp",run:Kx},{key:"Shift-Alt-ArrowUp",run:aU},{key:"Alt-ArrowDown",run:Fx},{key:"Shift-Alt-ArrowDown",run:uU},{key:"Mod-Alt-ArrowUp",run:ZH},{key:"Mod-Alt-ArrowDown",run:eU},{key:"Escape",run:tU},{key:"Mod-Enter",run:dU},{key:"Alt-l",mac:"Ctrl-l",run:QH},{key:"Mod-i",run:JH,preventDefault:!0},{key:"Mod-[",run:mU},{key:"Mod-]",run:pU},{key:"Mod-Alt-\\",run:hU},{key:"Shift-Mod-k",run:cU},{key:"Shift-Mod-\\",run:VH},{key:"Mod-/",run:cH},{key:"Alt-A",mac:"Ctrl-A",run:dH},{key:"Ctrl-m",mac:"Shift-Alt-m",run:gU}].concat(bU);var lm=/^\s*\/\//;var Fo=/^(\s*)- /;function mf(e){let t=/(?:^|\s)\/\//.exec(e);if(t==null)return-1;return t.index+t[0].length-2}function RD(e){let t=mf(e);return t<0?{text:e,hadComment:!1}:{text:e.slice(0,t).trimEnd(),hadComment:!0}}function yU(e){let t=[],n=[];for(let i of e.split(`
34
- `)){let r=RD(i);if(r.hadComment&&r.text.trim()==="")continue;let o=Fo.exec(i);if(o!=null&&o[0].length<=r.text.length+1){let s=r.text.slice(o[0].length).trim();if(s!=="")n.push(s)}else t.push(r.text)}return{positive:t.join(`
35
- `).trim(),negative:n.join(", ")}}function am(e){let t=[],n=0;for(let i of e.split(`
36
- `))t.push({from:n,text:i}),n+=i.length+1;return t}function um(e){let t=[],n=/(?<!\\)\(((?:\\[()]|[^()])*?):\s*(-?\d*\.?\d+)\s*(?<!\\)\)/g;for(let i=n.exec(e);i!=null;i=n.exec(e)){let r=i[1]??"",o=i[2]??"1",s=i.index,l=s+i[0].length,a=s+i[0].lastIndexOf(o);t.push({from:s,to:l,innerFrom:s+1,innerTo:s+1+r.length,numFrom:a,numTo:a+o.length,weight:Number(o)})}return t}var $x=(e)=>Math.round(e*100)/100,AD=(e)=>String($x(e));function xU(e,t){let n=mf(e),i=n<0?e.length:n;if(t>i)return null;let r=t;while(r>0&&e[r-1]!==",")r--;let o=t;while(o<i&&e[o]!==",")o++;let s=Fo.exec(e);if(s!=null&&r<s[0].length)r=s[0].length;while(r<o&&/\s/.test(e[r]??""))r++;while(o>r&&/\s/.test(e[o-1]??""))o--;return r<o?{from:r,to:o}:null}function TD(e,t,n,i){let r=am(e).find((h)=>t>=h.from&&t<=h.from+h.text.length);if(r==null||n>r.from+r.text.length)return null;let o=t-r.from,s=n-r.from,l=mf(r.text);if(l>=0&&o>=l)return null;let a=um(r.text).filter((h)=>o>=h.from&&s<=h.to).sort((h,m)=>h.to-h.from-(m.to-m.from))[0];if(a!=null){let h=$x(a.weight+i),m=r.text.slice(a.innerFrom,a.innerTo);if(h===1){let b=r.from+a.from;return{changes:[{from:b,to:r.from+a.to,insert:m}],selection:{anchor:b,head:b+m.length}}}return{changes:[{from:r.from+a.numFrom,to:r.from+a.numTo,insert:AD(h)}],selection:{anchor:r.from+a.innerFrom,head:r.from+a.innerTo}}}let u;if(o===s)u=xU(r.text,o);else{let h=o,m=s;while(h<m&&/\s/.test(r.text[h]??""))h++;while(m>h&&/\s/.test(r.text[m-1]??""))m--;u=h<m?{from:h,to:m}:null}if(u==null)return null;let c=$x(1+i),f=r.from+u.from,d=r.from+u.to;return{changes:[{from:f,to:f,insert:"("},{from:d,to:d,insert:`:${AD(c)})`}],selection:{anchor:f+1,head:d+1}}}function MD(e,t,n){let i=am(e),r=n>t&&i.some((o)=>o.from===n)?n-1:n;return i.filter((o)=>o.from+o.text.length>=t&&o.from<=r)}function ND(e,t,n){let i=MD(e,t,n).filter((r)=>r.text.trim()!=="");if(i.length===0)return[];if(i.every((r)=>lm.test(r.text)))return i.map((r)=>{let o=r.text.indexOf("//"),s=r.text[o+2]===" "?3:2;return{from:r.from+o,to:r.from+o+s,insert:""}});return i.filter((r)=>!lm.test(r.text)).map((r)=>{let o=r.from+(/^\s*/.exec(r.text)?.[0].length??0);return{from:o,to:o,insert:"// "}})}function DD(e,t,n){let i=MD(e,t,n).filter((r)=>r.text.trim()!==""&&!lm.test(r.text));if(i.length===0)return[];if(i.every((r)=>Fo.test(r.text)))return i.map((r)=>{let o=Fo.exec(r.text)?.[1]?.length??0;return{from:r.from+o,to:r.from+o+2,insert:""}});return i.filter((r)=>!Fo.test(r.text)).map((r)=>{let o=r.from+(/^\s*/.exec(r.text)?.[0].length??0);return{from:o,to:o,insert:"- "}})}function LD(e){let t=[];for(let n of am(e)){let i=mf(n.text),r=i<0?n.text.length:i,o=Fo.exec(n.text);if(o!=null&&o[0].length<=r+1){let s=n.from+o[0].length-2;if(t.push({from:s,to:s+1,kind:"negative-dash"}),n.from+o[0].length<n.from+r)t.push({from:n.from+o[0].length,to:n.from+r,kind:"negative"})}for(let s of um(n.text.slice(0,r)))t.push({from:n.from+s.from,to:n.from+s.innerFrom,kind:"weight-paren"}),t.push({from:n.from+s.innerTo,to:n.from+s.numFrom,kind:"weight-paren"}),t.push({from:n.from+s.numFrom,to:n.from+s.numTo,kind:"weight-num"}),t.push({from:n.from+s.numTo,to:n.from+s.to,kind:"weight-paren"});if(i>=0)t.push({from:n.from+i,to:n.from+n.text.length,kind:"comment"})}return t.sort((n,i)=>n.from-i.from||n.to-i.to)}function zD(e){let t=e.trim(),n=um(t)[0];if(n!=null&&n.from===0&&n.to===t.length)t=t.slice(n.innerFrom,n.innerTo);return t.replace(/\\([()])/g,"$1").toLowerCase().replace(/_/g," ").replace(/\s+/g," ").trim()}function wU(e,t,n){let i=[],r=n;for(let o=n;o<=e.length;o++){if(o<e.length&&e[o]!==",")continue;let s=e.slice(r,o),l=s.length-s.trimStart().length,a=zD(s);if(a!=="")i.push({from:t+r+l,to:t+r+s.trimEnd().length,tag:a});r=o+1}return i}function BD(e,t={}){let n=[],i=[],r=[];for(let a of am(e)){if(lm.test(a.text))continue;let u=RD(a.text).text,c=Fo.exec(a.text),f=c!=null&&c[0].length<=u.length+1,d=wU(u,a.from,f?c[0].length:0);if((f?r:i).push(...d),t.weights===!1)for(let h of um(u))n.push({from:a.from+h.from,to:a.from+h.to,message:"this model ignores weights: the text inside is read, the number is not"})}let o=new Map;for(let a of t.injected??[]){let u=zD(a.tag);if(u!==""&&!o.has(u))o.set(u,a.source)}let s=(a,u)=>{let c=new Set;for(let f of a){if(c.has(f.tag))n.push({from:f.from,to:f.to,message:`'${f.tag}' is already in the ${u}`});c.add(f.tag)}};s(i,"prompt"),s(r,"negative prompt");let l=new Set(r.map((a)=>a.tag));for(let a of i){let u=o.get(a.tag);if(u!=null)n.push({from:a.from,to:a.to,message:`'${a.tag}' is already added by the lora ${u}`});if(l.has(a.tag))n.push({from:a.from,to:a.to,message:`'${a.tag}' is also in the negative prompt`})}return n.sort((a,u)=>a.from-u.from)}function PD(e){let t=yU(e).positive,n=0;for(let i of t.matchAll(/\p{L}+|\p{N}|[^\s\p{L}\p{N}]/gu)){let r=i[0];n+=/^\p{L}/u.test(r)&&r.length>8?Math.ceil(r.length/5):1}return n}function SU(e,t){let n=mf(e);if(n>=0&&t>n)return null;let i=t;while(i>0&&!/[,(]/.test(e[i-1]??""))i--;let r=Fo.exec(e);if(r!=null&&i<r[0].length)i=r[0].length;while(i<t&&/\s/.test(e[i]??""))i++;return{from:i,text:e.slice(i,t)}}function ID(e,t){let n=SU(e,t);if(n==null)return[];let i=[n],r=[];for(let o=n.from+1;o<t;o++)if(/\s/.test(e[o-1]??"")&&!/\s/.test(e[o]??""))r.push(o);for(let o of r.slice(-4))i.push({from:o,text:e.slice(o,t)});return i}function VD(e,t,n){let i=n.underscores===!0?e:e.replace(/(?<=[\p{L}\p{N})])_(?=[\p{L}\p{N}(])/gu," ");if(n.weights!==!1)i=i.replace(/(?<!\\)([()])/g,"\\$1");if(t===kU&&n.artistPrefix!=null)i=`${n.artistPrefix}${i}`;return i}var kU=1,HD={0:"general",1:"artist",3:"copyright",4:"character",5:"meta"};var cm=0.05,Xx=ye.define(),_U={comment:"pe-comment",negative:"pe-negative","negative-dash":"pe-negative-dash","weight-paren":"pe-weight-paren","weight-num":"pe-weight-num"};function UD(e,t){let n=e.state.doc.toString(),i=t(),r=LD(n).filter((o)=>o.to>o.from).map((o)=>Oe.mark({class:_U[o.kind]}).range(o.from,o.to));for(let o of BD(n,{injected:i.injected(),weights:i.weights}))if(o.to>o.from)r.push(Oe.mark({class:"pe-issue",attributes:{"data-tip":o.message}}).range(o.from,o.to));return Oe.set(r,!0)}function CU(e){return En.fromClass(class{decorations;constructor(t){this.decorations=UD(t,e)}update(t){let n=t.transactions.some((i)=>i.effects.some((r)=>r.is(Xx)));if(t.docChanged||n)this.decorations=UD(t.view,e)}},{decorations:(t)=>t.decorations})}function EU(e,t){if(t.length===0)return!1;return e.dispatch({changes:t,userEvent:"input"}),!0}function jD(e,t){return(n)=>{if(!e().weights)return!1;let i=n.state.selection.main,r=TD(n.state.doc.toString(),i.from,i.to,t);if(r==null)return!1;return n.dispatch({changes:r.changes,selection:R.single(r.selection.anchor,r.selection.head),userEvent:"input"}),!0}}var KD=(e)=>(t)=>{let n=t.state.selection.main;return EU(t,e(t.state.doc.toString(),n.from,n.to))};function OU(e){let t=jD(e,cm),n=jD(e,-cm),i=KD(DD);return nr.high(Ba.of([{key:"Mod-ArrowUp",run:t},{key:"Ctrl-ArrowUp",run:t},{key:"Mod-ArrowDown",run:n},{key:"Ctrl-ArrowDown",run:n},{key:"Mod-/",run:KD(ND)},{key:"Mod-Shift--",run:i},{key:"Mod-_",run:i},{key:"Alt-ArrowUp",run:Kx},{key:"Alt-ArrowDown",run:Fx}]))}var AU=(e)=>e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1000?`${Math.round(e/1000)}k`:String(e);function FD(e){return(t,n,i,r)=>{let o=t.state.sliceDoc(r,r+1),s=o===""||o===`
37
- `?", ":"";t.dispatch({changes:{from:i,to:r,insert:e+s},selection:{anchor:i+e.length+s.length},userEvent:"input.complete"})}}async function RU(e,t,n){if(e.tags==null)return[];let i=t.trim().toLowerCase(),r=[],o=new Set;for(let l of e.loraWords()){let a=l.word.toLowerCase();if(o.has(a)||i!==""&&!a.includes(i))continue;o.add(a),r.push({label:l.word,detail:l.source,type:"lora",boost:50,apply:FD(l.word)})}if(i==="")return r;let s=await e.searchTags(t.trim(),n);return e.onTagError(null),s.forEach((l,a)=>{let u=VD(l.name,l.category,{...e.tags,weights:e.weights});r.push({label:u,detail:`${l.alias==null?"":`← ${l.alias} · `}${AU(l.count)}`,type:`tag-${HD[l.category??-1]??"plain"}`,boost:-a,apply:FD(u)})}),r}function TU(e){return async(t)=>{let n=t.state.doc.lineAt(t.pos),i=e(),r=new AbortController;t.addEventListener("abort",()=>r.abort());for(let o of ID(n.text,t.pos-n.from)){if(o.text.trim().length<2&&!t.explicit)continue;try{let s=await RU(i,o.text,r.signal);if(s.length>0)return{from:n.from+o.from,options:s,filter:!1}}catch(s){if(r.signal.aborted)return null;return i.onTagError(s instanceof Error?s.message:String(s)),null}}return null}}var MU=W.theme({"&":{background:"var(--panel-2)",border:"1px solid var(--border)",borderRadius:"6px",color:"var(--text)",fontSize:"13px"},"&.cm-focused":{outline:"none",borderColor:"var(--accent)"},".cm-scroller":{fontFamily:"ui-monospace, SFMono-Regular, Menlo, monospace",lineHeight:"1.5",maxHeight:"18em",overflow:"auto"},".cm-content":{padding:"6px 0",caretColor:"var(--text)"},".cm-line":{padding:"0 8px"},".cm-cursor":{borderLeftColor:"var(--text)"},"&.cm-focused .cm-selectionBackground, .cm-selectionBackground, ::selection":{background:"var(--accent-dim) !important"},".cm-placeholder":{color:"var(--dim)"},".pe-comment":{color:"var(--dim)",fontStyle:"italic"},".pe-comment *":{color:"var(--dim)"},".pe-negative":{color:"var(--red)"},".pe-negative-dash":{color:"var(--red)",fontWeight:"700"},".pe-weight-paren":{opacity:"0.45"},".pe-weight-num":{color:"var(--amber)",fontWeight:"700"},".pe-issue":{textDecoration:"underline wavy var(--amber)",textUnderlineOffset:"3px"},".cm-tooltip.cm-tooltip-autocomplete":{background:"var(--panel)",border:"1px solid var(--border)",borderRadius:"6px",overflow:"hidden"},".cm-tooltip-autocomplete > ul":{fontFamily:"inherit",maxHeight:"16em"},".cm-tooltip-autocomplete > ul > li":{padding:"2px 8px",display:"flex",gap:"10px"},".cm-tooltip-autocomplete > ul > li[aria-selected]":{background:"var(--accent-dim)",color:"#fff"},".cm-completionDetail":{marginLeft:"auto",color:"var(--dim)",fontStyle:"normal"},".cm-completionIcon":{display:"none"},".cm-completionLabel":{whiteSpace:"nowrap"},".cm-completionIcon-tag-artist + .cm-completionLabel":{color:"#ff8a8b"},".cm-completionIcon-tag-copyright + .cm-completionLabel":{color:"#c797ff"},".cm-completionIcon-tag-character + .cm-completionLabel":{color:"#35c64a"},".cm-completionIcon-tag-meta + .cm-completionLabel":{color:"#ead084"},".cm-completionIcon-lora + .cm-completionLabel":{color:"var(--accent)"}},{dark:!0}),NU=OD.filter((e)=>e.key!=="Mod-Enter");function qD(e){return[W.theme({".cm-content":{minHeight:`${e.minLines*1.5}em`}}),QN(),OU(e.ctx),Ba.of([...NU,...tD]),W.lineWrapping,CU(e.ctx),VN({override:[TU(e.ctx)],icons:!0,activateOnTyping:!0}),MU,rN(e.placeholder??""),W.updateListener.of((t)=>{if(t.docChanged)e.onChange(t.state.doc.toString())})]}var DU=[`⌘↑ / ⌘↓ (or ⌃↑ / ⌃↓): weight of the selection or the tag under the cursor, ±${cm}`,"⌘/ comment lines · ⌘⇧- negative lines · ⌥↑ / ⌥↓ move lines",'"//" starts a comment · "- " line = negative prompt · ⌘⏎ generate'].join(`
38
- `),Gx=q(function(t){let n=X(null),i=X(null),[r,o]=Q(null),s=X({p:t,setTagError:o});s.current={p:t,setTagError:o};let l=t.st.form,a=JSON.stringify(l?.injectedTagsFor(t.v)??[]);Z(()=>{let c=()=>{let d=s.current.p,h=d.st.form;return{weights:d.v.desc.weights!==!1,tags:d.v.desc.tags??null,searchTags:async(m,b)=>(await JO({module:d.module,varName:d.v.name,q:m,signal:b})).hits,injected:()=>h?.injectedTagsFor(d.v)??[],loraWords:()=>h?.loraWordsFor(d.v)??[],onTagError:(m)=>s.current.setTagError(m)}};if(n.current==null)return;let f=new W({parent:n.current,state:pe.create({doc:s.current.p.value,extensions:qD({ctx:c,onChange:(d)=>s.current.p.onChange(d),minLines:s.current.p.minLines})})});return i.current=f,()=>{f.destroy(),i.current=null}},[]),Z(()=>{let c=i.current;if(c==null)return;let f=c.state.doc.toString();if(f===t.value)return;let d=Math.min(c.state.selection.main.head,t.value.length);c.dispatch({changes:{from:0,to:f.length,insert:t.value},selection:{anchor:d}})},[t.value]),Z(()=>{i.current?.dispatch({effects:Xx.of(null)})},[a]);let u=PD(t.value);return y("div",{className:"prompt-editor",children:[p("div",{ref:n}),y("div",{className:r==null?"pe-foot":"pe-foot has-error",children:[r==null?null:y("span",{className:"pe-error","data-tip":r,children:["tags: ",r]}),p("span",{className:"pe-keys","data-tip":DU,children:"keys"}),y("span",{className:"pe-tokens","data-tip":`an estimate of the CLIP tokens the positive prompt uses
39
- CLIP models read it in chunks of 75`,children:["≈ ",u," tokens"]})]})]})});function gf(e){let[t,n]=Q(!1),i=e.entries.length;return y(ie,{children:[y("button",{type:"button",className:e.compact===!0?"link":"mini",disabled:i===0,"data-tip":i===0?`every ${e.what} you submit shows here, until you close the page`:`${i} past ${e.what}s: search, preview, restore`,onClick:()=>n(!0),children:[p(B,{name:"history"}),e.compact===!0?null:" history"]}),t?p(LU,{entries:e.entries,what:e.what,onPick:(r)=>{n(!1),e.onPick(r)},onClose:()=>n(!1)}):null]})}function LU(e){let[t,n]=Q(""),[i,r]=Q(0),[o,s]=Q(()=>Date.now()),l=X(null),a=fA(e.entries,t),u=a[Math.min(i,Math.max(0,a.length-1))]??null;Z(()=>{let f=setInterval(()=>s(Date.now()),1e4);return()=>clearInterval(f)},[]),Z(()=>{let f=(d)=>{if(d.key!=="Escape")return;d.stopImmediatePropagation(),e.onClose()};return window.addEventListener("keydown",f,!0),()=>window.removeEventListener("keydown",f,!0)},[e]),Z(()=>{l.current?.querySelector(".hist-row.sel")?.scrollIntoView({block:"nearest"})},[i,t]);let c=(f)=>r((d)=>Math.max(0,Math.min(a.length-1,d+f)));return p("div",{className:"modal-overlay top hist-overlay",onClick:()=>e.onClose(),children:y("div",{className:"modal hist-modal",onClick:(f)=>f.stopPropagation(),children:[y("div",{className:"modal-head",children:[p(B,{name:"history"}),p("input",{type:"text",autoFocus:!0,placeholder:`search ${e.entries.length} past ${e.what}s, every word must match`,value:t,onChange:(f)=>{n(f.target.value),r(0)},onKeyDown:(f)=>{if(f.key==="ArrowDown")f.preventDefault(),c(1);else if(f.key==="ArrowUp")f.preventDefault(),c(-1);else if(f.key==="Enter"){if(f.preventDefault(),u!=null)e.onPick(u)}}}),p("button",{type:"button",className:"modal-close","data-tip":"close (esc)",onClick:()=>e.onClose(),children:p(B,{name:"close"})})]}),y("div",{className:"hist-cols",children:[y("div",{className:"hist-list",ref:l,children:[a.length===0?y("div",{className:"hist-empty",children:["nothing matches '",t,"'"]}):null,a.map((f,d)=>y("button",{type:"button",className:f===u?"hist-row sel":"hist-row",onMouseEnter:()=>r(d),onClick:()=>e.onPick(f),children:[p("span",{className:"hist-first",children:f.text.split(`
40
- `)[0]}),y("span",{className:"hist-meta",children:[dA(f.at,o),f.count>1?` · ${f.count}×`:"",f.source===""?"":` · ${f.source}`]})]},f.text))]}),p("div",{className:"hist-preview",children:u==null?null:y(ie,{children:[p("pre",{className:"hist-text",children:u.text}),y("div",{className:"hist-foot",children:[p("span",{className:"hint",children:"↑↓ to preview, enter or click to restore"}),y("button",{type:"button",className:"primary",onClick:()=>e.onPick(u),children:["restore this ",e.what]})]})]})})]})]})})}var zU=["off","low","medium","high"],BU={openrouter:"openrouter (cloud)",openwebui:"open webui (local)",openai:"llama.cpp / ollama / vllm (openai /v1)"},PU={openrouter:"",openwebui:"http://localhost:3000",openai:"http://localhost:8080/v1"},$D=q(function(t){let n=()=>{let r=window.prompt(`name the new ${t.kind}`,t.newName);if(r!=null)t.onCreate(r)},i=(r)=>{let o=t.status?.(r)??null;return o==null?null:p("span",{className:`enh-dot ${o.cls}`,"data-tip":o.tip})};return y("div",{className:"enh-tabs",children:[y("div",{className:"enh-tabs-title",children:[t.title,t.save==="saving"?p("span",{className:"enh-save",children:"saving…"}):null,t.save==="error"?p("span",{className:"enh-save error","data-tip":t.saveError,children:"\uD83D\uDD34 not saved"}):null]}),p("select",{className:"enh-tab-select",value:t.selected,onChange:(r)=>t.onSelect(r.target.value),children:t.names.map((r)=>p("option",{value:r,children:r},r))}),y("div",{className:"enh-tab-list",role:"tablist",children:[t.names.map((r)=>y("div",{className:r===t.selected?"enh-tab sel":"enh-tab",children:[y("button",{type:"button",role:"tab","aria-selected":r===t.selected,onClick:()=>t.onSelect(r),children:[i(r),p("span",{className:"enh-tab-name",children:r})]}),r===t.selected?p("button",{type:"button",className:t.editing?"enh-tab-edit sel":"enh-tab-edit","data-tip":t.editing?"close the editor":`edit this ${t.kind}`,onClick:()=>t.onEdit(),children:p(B,{name:"pen"})}):null]},r)),y("button",{type:"button",className:"enh-tab-new",onClick:n,children:[p(B,{name:"plus"})," new ",t.kind]})]})]})}),IU=q(function(t){let n=t.e,{configEntry:i,preset:r}=n;return y("nav",{className:"enh-side",children:[i==null?y("div",{className:"enh-tabs",children:[p("div",{className:"enh-tabs-title",children:"llm"}),y("button",{type:"button",className:"enh-tab-new",onClick:()=>n.setEditing("llm"),children:[p(B,{name:"plus"})," set up an llm"]})]}):p($D,{title:"llm",names:n.configs.map((o)=>o.name),selected:i.name,kind:"llm",newName:"my-llm",save:n.configSaveState,saveError:n.configSaveError,editing:n.editing==="llm",onEdit:()=>n.setEditing(n.editing==="llm"?null:"llm"),status:(o)=>{let s=n.configStatus.get(o);if(s==null)return null;let l=n.configStatusError.get(o);return{cls:s,tip:s==="up"?"answers":s==="checking"?"checking…":`does not answer: ${l??""}`}},onSelect:(o)=>n.selectConfig(o),onCreate:(o)=>{n.addConfig(o),n.setEditing("llm")}}),r==null?y("div",{className:"enh-tabs",children:[p("div",{className:"enh-tabs-title",children:"master prompt"}),y("button",{type:"button",className:"enh-tab-new",onClick:()=>n.addPreset("refine-prompt"),children:[p(B,{name:"plus"})," new master prompt"]})]}):p($D,{title:"master prompt",names:n.presets.map((o)=>o.name),selected:r.name,kind:"master prompt",newName:"refine-<model>-prompt",save:n.saveState,saveError:n.saveError,editing:n.editing==="preset",onEdit:()=>n.setEditing(n.editing==="preset"?null:"preset"),onSelect:(o)=>n.selectPreset(o),onCreate:(o)=>{n.addPreset(o),n.setEditing("preset")}})]})});function XD(e){let t=()=>{if(e.name==null)return;let i=window.prompt(`rename this ${e.kind} (renames the file)`,e.name);if(i!=null)e.onRename(i)},n=()=>{if(e.name==null)return;if(window.confirm(`delete ${e.kind} '${e.name}'? its file is removed.`))e.onDelete()};return y("section",{className:"enh-edit",children:[y("div",{className:"enh-edit-head",children:[y("h3",{className:"enh-h","data-tip":e.tip,children:[e.kind," ",p("span",{className:"enh-h-name",children:e.name??"new"})]}),e.name==null?null:y("span",{className:"btn-group",children:[p("button",{type:"button",onClick:()=>e.onDuplicate(),children:"duplicate"}),p("button",{type:"button",onClick:t,children:"rename"}),y("button",{type:"button",className:"quiet-danger",onClick:n,children:[p(B,{name:"trash"})," delete"]})]}),p("button",{type:"button",className:"enh-edit-close","data-tip":"done (esc), everything is already saved",onClick:()=>e.onClose(),children:"done"})]}),p("div",{className:"enh-edit-body",children:e.children})]})}var VU=q(function(t){let n=t.e,i=n.visibleModels,r=n.provider!=="openrouter",o=n.configEntry;return y(XD,{kind:"llm",name:o?.name??null,tip:o==null?"any edit creates the config file":`.comfy-ts/llm-configs/${o.name}.json, saved as you type`,onRename:(s)=>void n.renameConfig(s),onDuplicate:()=>n.duplicateConfig(),onDelete:()=>void n.deleteConfig(),onClose:()=>n.setEditing(null),children:[y("div",{className:"enh-grid",children:[p("label",{children:"provider"}),p("select",{value:n.provider,onChange:(s)=>n.setProvider(s.target.value),children:EA.map((s)=>p("option",{value:s,children:BU[s]},s))}),r?y(ie,{children:[p("label",{children:"address"}),p("input",{type:"text",placeholder:PU[n.provider],value:n.baseUrl,onChange:(s)=>n.setBaseUrl(s.target.value)})]}):null,p("label",{"data-tip":"kept in this browser only, never in a file",children:"api key"}),p("input",{type:"password",placeholder:r?"blank if none":"sk-or-v1-…",value:n.apiKey,onChange:(s)=>n.setApiKey(s.target.value)}),p("label",{children:"model"}),y("div",{className:"enh-inline",children:[i.length>0?y("select",{value:n.model,onChange:(s)=>n.setModel(s.target.value),children:[i.some((s)=>s.id===n.model)?null:y("option",{value:n.model,children:[n.model," (not in the list)"]}),i.map((s)=>p("option",{value:s.id,children:s.id},s.id))]}):p("input",{type:"text",placeholder:r?"e.g. qwen3:8b":"e.g. anthropic/claude-sonnet-5",value:n.model,onChange:(s)=>n.setModel(s.target.value)}),p("button",{type:"button",onClick:()=>void n.loadModels(),disabled:n.modelsState==="loading",children:n.modelsState==="loading"?"asking…":"list models"})]}),n.provider==="openwebui"?null:y(ie,{children:[p("label",{"data-tip":r?"off = no thinking (chat template switch), anything else = think first":"reasoning effort sent to the model",children:"thinking"}),y("div",{className:"enh-inline",children:[p("span",{className:"btn-group",children:zU.map((s)=>p("button",{type:"button",className:n.effort===s?"mode sel":"mode",onClick:()=>n.setEffort(s),children:s},s))}),y("label",{className:"row-inline","data-tip":"hide models that report no reasoning support",children:[p("input",{type:"checkbox",checked:n.thinkingOnly,onChange:()=>n.toggleThinkingOnly()}),"thinking models only"]})]})]})]}),n.modelsError!==""?y("div",{className:"error",children:["\uD83D\uDD34 ",n.modelsError]}):null,n.configsError!==""?y("div",{className:"error",children:["\uD83D\uDD34 ",n.configsError]}):null]})}),HU=q(function(t){let n=t.e.preset;return y(XD,{kind:"master prompt",name:n?.name??null,tip:n==null?void 0:`.comfy-ts/prompt-enhancers/${n.name}.md, saved as you type`,onRename:(i)=>void t.e.renamePreset(i),onDuplicate:()=>t.e.duplicatePreset(),onDelete:()=>void t.e.deletePreset(),onClose:()=>t.e.setEditing(null),children:[n==null?p("div",{className:"enh-empty",children:t.e.presetsState==="loading"?"loading…":"no master prompt yet: add one on the left"}):p("textarea",{className:"enh-text enh-master",rows:18,value:n.text,onChange:(i)=>t.e.setPresetText(i.target.value)}),t.e.presetsError!==""?y("div",{className:"error",children:["\uD83D\uDD34 ",t.e.presetsError]}):null]})}),UU=q(function(t){let n=t.e,i=n.phase==="running",r=X(null);Z(()=>{let a=r.current;if(a==null)return;a.focus(),a.setSelectionRange(a.value.length,a.value.length)},[]);let o=GD(n),s=(a)=>y("span",{className:"kbd-hint",children:[Me,s0[a]]}),l=n.result.trim()==="";return y("section",{className:"enh-job",children:[y("div",{className:"enh-actions",children:[i?p("button",{type:"button",className:"enh-big enh-go",onClick:()=>n.cancel(),children:"stop"}):y("button",{type:"button",className:"primary enh-big enh-go",onClick:o.enhance,children:[p(B,{name:"sparkle"})," enhance ",s("enhance")]}),y("button",{type:"button",className:"enh-big","data-tip":"generate the draft with this rewrite in place of the prompt: the prompt itself is not changed",onClick:()=>t.st.generate(n.tryOverride),disabled:l,children:[p(B,{name:"play",size:0.85})," try it ",y("span",{className:"kbd-hint",children:[Me,"⏎"]})]}),y("button",{type:"button",className:"accent enh-big","data-tip":"write this rewrite into the prompt and close",onClick:o.apply,disabled:l,children:["apply to prompt ",s("apply")]}),p("span",{className:"run-error","data-tip":n.error===""?void 0:n.error,children:n.error===""?"":`\uD83D\uDD34 ${n.error}`})]}),y("div",{className:"enh-label enh-label-row",children:[p("span",{children:"yours, what gets sent (the form is untouched)"}),y("span",{className:"row-inline",children:[p("button",{type:"button",className:"mini","data-tip":"replace this text with the prompt you opened the enhancer from",onClick:()=>n.usePrompt(),children:"use the prompt"}),p(gf,{entries:n.inputHistory,what:"enhance input",onPick:(a)=>n.setOriginal(a.value)})]})]}),p("textarea",{ref:r,className:"enh-text enh-box",value:n.original,onChange:(a)=>n.setOriginal(a.target.value)}),y("div",{className:"enh-label",children:[i?`rewriting… ${n.result.length} chars`:"rewrite, editable before you apply",n.thinking===""?null:y("span",{className:"enh-think-tip","data-tip":n.thinking,children:["· thinking (",n.thinking.length," chars)"]})]}),p("textarea",{className:"enh-text enh-box enh-result",value:n.result,placeholder:"press enhance",onChange:(a)=>n.setResult(a.target.value)})]})});function GD(e){return{enhance:()=>e.phase==="running"?void 0:e.run(),apply:()=>e.apply()}}var jU=q(function(t){let{e:n,st:i}=t;return Z(()=>{let r=(o)=>{if(o.key==="Escape"){if(n.editing!=null)n.setEditing(null);else n.close();return}let s=AO(o);if(s==null)return;o.preventDefault(),GD(n)[s]()};return window.addEventListener("keydown",r),()=>window.removeEventListener("keydown",r)},[n,i]),p("div",{className:"modal-overlay top",onClick:()=>n.close(),children:y("div",{className:"modal enh-modal",onClick:(r)=>r.stopPropagation(),children:[y("div",{className:"modal-head",children:[y("b",{className:"enh-title",children:[p(B,{name:"sparkle"})," enhance prompt"]}),p("button",{type:"button",className:"modal-close","data-tip":"close (esc), nothing is applied",onClick:()=>n.close(),children:p(B,{name:"close"})})]}),y("div",{className:"enh-layout",children:[p(IU,{e:n}),y("div",{className:"enh-right",children:[p("div",{className:"modal-body enh-main",children:p(UU,{e:n,st:i})}),n.editing==="llm"?p(VU,{e:n}):null,n.editing==="preset"?p(HU,{e:n}):null]})]})]})})}),Yx=q(function(t){let n=t.st.enhancer;return y(ie,{children:[y("button",{type:"button",className:t.compact===!0?"link":"mini","data-tip":"rewrite this prompt with an llm",onClick:()=>n.openFor({v:t.v,module:t.module,lane:t.lane}),children:[p(B,{name:"sparkle"}),t.compact===!0?null:" enhance",t.shortcut===!0?y("span",{className:"kbd-hint",children:[Me,Bt["open-enhancer"]]}):null]}),n.target===t.v&&n.targetLane===(t.lane??null)?p(jU,{e:n,st:t.st}):null]})});var YD=q(function(t){let[n,i]=Q(null),r=t.st.form,o=r?.loraKeywordGroups(t.v)??[];if(r==null||o.length===0)return null;return p("div",{className:"kw-prefix",children:o.map((s)=>{let l=s.parts.filter((a)=>a.on).length;return y("div",{className:"preset-box kw-box",children:[y("button",{type:"button",className:s.running?"kw-line":"kw-line stopped","aria-expanded":n===s.lora,"data-tip":`${s.lora}
21
+ */var DI=["input:not([inert]):not([inert] *)","select:not([inert]):not([inert] *)","textarea:not([inert]):not([inert] *)","a[href]:not([inert]):not([inert] *)","area[href]:not([inert]):not([inert] *)","button:not([inert]):not([inert] *)","[tabindex]:not(slot):not([inert]):not([inert] *)","audio[controls]:not([inert]):not([inert] *)","video[controls]:not([inert]):not([inert] *)",'[contenteditable]:not([contenteditable="false"]):not([inert]):not([inert] *)',"details>summary:first-of-type:not([inert]):not([inert] *)","details:not([inert]):not([inert] *)"],n0=DI.join(","),rT=typeof Element>"u",Lc=rT?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,sp=!rT&&Element.prototype.getRootNode?function(e){var t;return e===null||e===void 0?void 0:(t=e.getRootNode)===null||t===void 0?void 0:t.call(e)}:function(e){return e===null||e===void 0?void 0:e.ownerDocument},lp=function(t,n){var i;if(n===void 0)n=!0;var r=t===null||t===void 0?void 0:(i=t.getAttribute)===null||i===void 0?void 0:i.call(t,"inert"),o=r===""||r==="true",s=o||n&&t&&(typeof t.closest==="function"?t.closest("[inert]"):lp(t.parentNode));return s},LI=function(t){var n,i=t===null||t===void 0?void 0:(n=t.getAttribute)===null||n===void 0?void 0:n.call(t,"contenteditable");return i===""||i==="true"},zI=function(t,n,i){if(lp(t))return[];var r=Array.prototype.slice.apply(t.querySelectorAll(n0));if(n&&Lc.call(t,n0))r.unshift(t);return r=r.filter(i),r},i0=function(t,n,i){var r=[],o=Array.from(t);while(o.length){var s=o.shift();if(lp(s,!1))continue;if(s.tagName==="SLOT"){var l=s.assignedElements(),a=l.length?l:s.children,u=i0(a,!0,i);if(i.flatten)r.push.apply(r,u);else r.push({scopeParent:s,candidates:u})}else{var c=Lc.call(s,n0);if(c&&i.filter(s)&&(n||!t.includes(s)))r.push(s);var f=s.shadowRoot||typeof i.getShadowRoot==="function"&&i.getShadowRoot(s),d=!lp(f,!1)&&(!i.shadowRootFilter||i.shadowRootFilter(s));if(f&&d){var h=i0(f===!0?s.children:f.children,!0,i);if(i.flatten)r.push.apply(r,h);else r.push({scopeParent:s,candidates:h})}else o.unshift.apply(o,s.children)}}return r},oT=function(t){return!isNaN(parseInt(t.getAttribute("tabindex"),10))},sT=function(t){if(!t)throw Error("No node provided");if(t.tabIndex<0){if((/^(AUDIO|VIDEO|DETAILS)$/.test(t.tagName)||LI(t))&&!oT(t))return 0}return t.tabIndex},BI=function(t,n){var i=sT(t);if(i<0&&n&&!oT(t))return 0;return i},PI=function(t,n){return t.tabIndex===n.tabIndex?t.documentOrder-n.documentOrder:t.tabIndex-n.tabIndex},lT=function(t){return t.tagName==="INPUT"},II=function(t){return lT(t)&&t.type==="hidden"},HI=function(t){var n=t.tagName==="DETAILS"&&Array.prototype.slice.apply(t.children).some(function(i){return i.tagName==="SUMMARY"});return n},VI=function(t,n){for(var i=0;i<t.length;i++)if(t[i].checked&&t[i].form===n)return t[i]},UI=function(t){if(!t.name)return!0;var n=t.form||sp(t),i=function(l){return n.querySelectorAll('input[type="radio"][name="'+l+'"]')},r;if(typeof window<"u"&&typeof window.CSS<"u"&&typeof window.CSS.escape==="function")r=i(window.CSS.escape(t.name));else try{r=i(t.name)}catch(s){return console.error("Looks like you have a radio button with a name attribute containing invalid CSS selector characters and need the CSS.escape polyfill: %s",s.message),!1}var o=VI(r,t.form);return!o||o===t},KI=function(t){return lT(t)&&t.type==="radio"},jI=function(t){return KI(t)&&!UI(t)},FI=function(t){var n,i=t&&sp(t),r=(n=i)===null||n===void 0?void 0:n.host,o=!1;if(i&&i!==t){var s,l,a;o=!!((s=r)!==null&&s!==void 0&&(l=s.ownerDocument)!==null&&l!==void 0&&l.contains(r)||t!==null&&t!==void 0&&(a=t.ownerDocument)!==null&&a!==void 0&&a.contains(t));while(!o&&r){var u,c,f;i=sp(r),r=(u=i)===null||u===void 0?void 0:u.host,o=!!((c=r)!==null&&c!==void 0&&(f=c.ownerDocument)!==null&&f!==void 0&&f.contains(r))}}return o},nT=function(t){var n=t.getBoundingClientRect(),{width:i,height:r}=n;return i===0&&r===0},qI=function(t,n){var{displayCheck:i,getShadowRoot:r}=n;if(i==="full-native"){if("checkVisibility"in t){var o=t.checkVisibility({checkOpacity:!1,opacityProperty:!1,contentVisibilityAuto:!0,visibilityProperty:!0,checkVisibilityCSS:!0});return!o}}var s=getComputedStyle(t),l=s.visibility;if(l==="hidden"||l==="collapse")return!0;var a=Lc.call(t,"details>summary:first-of-type"),u=a?t.parentElement:t;if(Lc.call(u,"details:not([open]) *"))return!0;if(!i||i==="full"||i==="full-native"||i==="legacy-full"){if(typeof r==="function"){var c=t;while(t){var f=t.parentElement,d=sp(t);if(f&&!f.shadowRoot&&r(f)===!0)return nT(t);else if(t.assignedSlot)t=t.assignedSlot;else if(!f&&d!==t.ownerDocument)t=d.host;else t=f}t=c}if(FI(t))return!t.getClientRects().length;if(i!=="legacy-full")return!0}else if(i==="non-zero-area")return nT(t);return!1},$I=function(t){if(/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(t.tagName)){var n=t.parentElement;while(n){if(n.tagName==="FIELDSET"&&n.disabled){for(var i=0;i<n.children.length;i++){var r=n.children.item(i);if(r.tagName==="LEGEND")return Lc.call(n,"fieldset[disabled] *")?!0:!r.contains(t)}return!0}n=n.parentElement}}return!1},XI=function(t,n){if(n.disabled||II(n)||qI(n,t)||HI(n)||$I(n))return!1;return!0},iT=function(t,n){if(jI(n)||sT(n)<0||!XI(t,n))return!1;return!0},GI=function(t){var n=parseInt(t.getAttribute("tabindex"),10);if(isNaN(n)||n>=0)return!0;return!1},aT=function(t){var n=[],i=[];return t.forEach(function(r,o){var s=!!r.scopeParent,l=s?r.scopeParent:r,a=BI(l,s),u=s?aT(r.candidates):l;if(a===0)s?n.push.apply(n,u):n.push(l);else i.push({documentOrder:o,tabIndex:a,item:r,isScope:s,content:u})}),i.sort(PI).reduce(function(r,o){return o.isScope?r.push.apply(r,o.content):r.push(o.content),r},[]).concat(n)},r0=function(t,n){n=n||{};var i;if(n.getShadowRoot)i=i0([t],n.includeContainer,{filter:iT.bind(null,n),flatten:!1,getShadowRoot:n.getShadowRoot,shadowRootFilter:GI});else i=zI(t,n.includeContainer,iT.bind(null,n));return aT(i)};function uT(){return/apple/i.test(navigator.vendor)}function cT(e){let t=e.activeElement;while(((n=t)==null||(n=n.shadowRoot)==null?void 0:n.activeElement)!=null){var n;t=t.shadowRoot.activeElement}return t}function ap(e,t){if(!e||!t)return!1;let n=t.getRootNode==null?void 0:t.getRootNode();if(e.contains(t))return!0;if(n&&Cc(n)){let i=t;while(i){if(e===i)return!0;i=i.parentNode||i.host}}return!1}function Sa(e){if("composedPath"in e)return e.composedPath()[0];return e.target}function up(e,t){if(t==null)return!1;if("composedPath"in e)return e.composedPath().includes(t);let n=e;return n.target!=null&&t.contains(n.target)}function fT(e){return e.matches("html,body")}function ka(e){return(e==null?void 0:e.ownerDocument)||document}function zc(e,t,n){if(n===void 0)n=!0;return e.filter((r)=>{var o;return r.parentId===t&&(!n||((o=r.context)==null?void 0:o.open))}).flatMap((r)=>[r,...zc(e,r.id,n)])}function dT(e){return"nativeEvent"in e}var YI=typeof document<"u",WI=function(){},To=YI?ti:WI,QI={...ur};var JI=QI.useInsertionEffect,ZI=JI||((e)=>e());function zs(e){let t=X(()=>{});return ZI(()=>{t.current=e}),ot(function(){for(var n=arguments.length,i=Array(n),r=0;r<n;r++)i[r]=arguments[r];return t.current==null?void 0:t.current(...i)},[])}var o0=()=>({getShadowRoot:!0,displayCheck:typeof ResizeObserver==="function"&&ResizeObserver.toString().includes("[native code]")?"full":"none"});function hT(e,t){let n=r0(e,o0()),i=n.length;if(i===0)return;let r=cT(ka(e)),o=n.indexOf(r),s=o===-1?t===1?0:i-1:o+t;return n[s]}function pT(e){return hT(ka(e).body,1)||e}function mT(e){return hT(ka(e).body,-1)||e}function cp(e,t){let n=t||e.currentTarget,i=e.relatedTarget;return!i||!ap(n,i)}function gT(e){r0(e,o0()).forEach((n)=>{n.dataset.tabindex=n.getAttribute("tabindex")||"",n.setAttribute("tabindex","-1")})}function s0(e){e.querySelectorAll("[data-tabindex]").forEach((n)=>{let i=n.dataset.tabindex;if(delete n.dataset.tabindex,i)n.setAttribute("tabindex",i);else n.removeAttribute("tabindex")})}function vT(e,t,n){let{reference:i,floating:r}=e,o=zr(t),s=t0(t),l=e0(s),a=Ds(t),u=o==="y",c=i.x+i.width/2-r.width/2,f=i.y+i.height/2-r.height/2,d=i[l]/2-r[l]/2,h;switch(a){case"top":h={x:c,y:i.y-r.height};break;case"bottom":h={x:c,y:i.y+i.height};break;case"right":h={x:i.x+i.width,y:f};break;case"left":h={x:i.x-r.width,y:f};break;default:h={x:i.x,y:i.y}}let m=Dc(t);if(m)h[s]+=d*(m==="end"?1:-1)*(n&&u?-1:1);return h}async function bT(e,t){var n;if(t===void 0)t={};let{x:i,y:r,platform:o,rects:s,elements:l,strategy:a}=e,{boundary:u="clippingAncestors",rootBoundary:c="viewport",elementContext:f="floating",altBoundary:d=!1,padding:h=0}=Nc(t,e),m=tT(h),x=l[d?f==="floating"?"reference":"floating":f],g=Ls(await o.getClippingRect({element:((n=await(o.isElement==null?void 0:o.isElement(x)))!=null?n:!0)?x:x.contextElement||await(o.getDocumentElement==null?void 0:o.getDocumentElement(l.floating)),boundary:u,rootBoundary:c,strategy:a})),v=f==="floating"?{x:i,y:r,width:s.floating.width,height:s.floating.height}:s.reference,w=await(o.getOffsetParent==null?void 0:o.getOffsetParent(l.floating)),S=await(o.isElement==null?void 0:o.isElement(w))&&await(o.getScale==null?void 0:o.getScale(w))||{x:1,y:1},k=Ls(o.convertOffsetParentRelativeRectToViewportRelativeRect?await o.convertOffsetParentRelativeRectToViewportRelativeRect({elements:l,rect:v,offsetParent:w,strategy:a}):v);return{top:(g.top-k.top+m.top)/S.y,bottom:(k.bottom-g.bottom+m.bottom)/S.y,left:(g.left-k.left+m.left)/S.x,right:(k.right-g.right+m.right)/S.x}}var e8=50,yT=async(e,t,n)=>{let{placement:i="bottom",strategy:r="absolute",middleware:o=[],platform:s}=n,l=s.detectOverflow?s:{...s,detectOverflow:bT},a=await(s.isRTL==null?void 0:s.isRTL(t)),u=await s.getElementRects({reference:e,floating:t,strategy:r}),{x:c,y:f}=vT(u,i,a),d=i,h=0,m={};for(let b=0;b<o.length;b++){let x=o[b];if(!x)continue;let{name:g,fn:v}=x,{x:w,y:S,data:k,reset:E}=await v({x:c,y:f,initialPlacement:i,placement:d,strategy:r,middlewareData:m,rects:u,platform:l,elements:{reference:e,floating:t}});if(c=w!=null?w:c,f=S!=null?S:f,m[g]={...m[g],...k},E&&h<e8){if(h++,typeof E==="object"){if(E.placement)d=E.placement;if(E.rects)u=E.rects===!0?await s.getElementRects({reference:e,floating:t,strategy:r}):E.rects;({x:c,y:f}=vT(u,d,a))}b=-1}}return{x:c,y:f,placement:d,strategy:r,middlewareData:m}};var xT=function(e){if(e===void 0)e={};return{name:"flip",options:e,async fn(t){var n,i;let{placement:r,middlewareData:o,rects:s,initialPlacement:l,platform:a,elements:u}=t,{mainAxis:c=!0,crossAxis:f=!0,fallbackPlacements:d,fallbackStrategy:h="bestFit",fallbackAxisSideDirection:m="none",flipAlignment:b=!0,...x}=Nc(e,t);if((n=o.arrow)!=null&&n.alignmentOffset)return{};let g=Ds(r),v=zr(l),w=Ds(l)===l,S=await(a.isRTL==null?void 0:a.isRTL(u.floating)),k=d||(w||!b?[Ac(l)]:ZA(l)),E=m!=="none";if(!d&&E)k.push(...eT(l,b,m,S));let _=[l,...k],O=await a.detectOverflow(t,x),B=[],M=((i=o.flip)==null?void 0:i.overflows)||[];if(c)B.push(O[g]);if(f){let D=JA(r,s,S);B.push(O[D[0]],O[D[1]])}if(M=[...M,{placement:r,overflows:B}],!B.every((D)=>D<=0)){var I,H;let D=(((I=o.flip)==null?void 0:I.index)||0)+1,L=_[D];if(L){if(!(f==="alignment"?v!==zr(L):!1)||M.every((P)=>zr(P.placement)===v?P.overflows[0]>0:!0))return{data:{index:D,overflows:M},reset:{placement:L}}}let V=(H=M.filter((G)=>G.overflows[0]<=0).sort((G,P)=>G.overflows[1]-P.overflows[1])[0])==null?void 0:H.placement;if(!V)switch(h){case"bestFit":{var Y;let G=(Y=M.filter((P)=>{if(E){let ee=zr(P.placement);return ee===v||ee==="y"}return!0}).map((P)=>[P.placement,P.overflows.filter((ee)=>ee>0).reduce((ee,fe)=>ee+fe,0)]).sort((P,ee)=>P[1]-ee[1])[0])==null?void 0:Y[0];if(G)V=G;break}case"initialPlacement":V=l;break}if(r!==V)return{reset:{placement:V}}}return{}}}};var t8=new Set(["left","top"]);async function n8(e,t){let{placement:n,platform:i,elements:r}=e,o=await(i.isRTL==null?void 0:i.isRTL(r.floating)),s=Ds(n),l=Dc(n),a=zr(n)==="y",u=t8.has(s)?-1:1,c=o&&a?-1:1,f=Nc(t,e),{mainAxis:d,crossAxis:h,alignmentAxis:m}=typeof f==="number"?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:f.mainAxis||0,crossAxis:f.crossAxis||0,alignmentAxis:f.alignmentAxis};if(l&&typeof m==="number")h=l==="end"?m*-1:m;return a?{x:h*c,y:d*u}:{x:d*u,y:h*c}}var wT=function(e){if(e===void 0)e=0;return{name:"offset",options:e,async fn(t){var n,i;let{x:r,y:o,placement:s,middlewareData:l}=t,a=await n8(t,e);if(s===((n=l.offset)==null?void 0:n.placement)&&(i=l.arrow)!=null&&i.alignmentOffset)return{};return{x:r+a.x,y:o+a.y,data:{...a,placement:s}}}}},ST=function(e){if(e===void 0)e={};return{name:"shift",options:e,async fn(t){let{x:n,y:i,placement:r,platform:o}=t,{mainAxis:s=!0,crossAxis:l=!1,limiter:a={fn:(v)=>{let{x:w,y:S}=v;return{x:w,y:S}}},...u}=Nc(e,t),c={x:n,y:i},f=await o.detectOverflow(t,u),d=zr(r),h=Zy(d),m=c[h],b=c[d],x=(v,w)=>QA(w+f[v==="y"?"top":"left"],w,w-f[v==="y"?"bottom":"right"]);if(s)m=x(h,m);if(l)b=x(d,b);let g=a.fn({...t,[h]:m,[d]:b});return{...g,data:{x:g.x-n,y:g.y-i,enabled:{[h]:s,[d]:l}}}}}};function CT(e){let t=Sn(e),n=parseFloat(t.width)||0,i=parseFloat(t.height)||0,r=qn(e),o=r?e.offsetWidth:n,s=r?e.offsetHeight:i,l=Tc(n)!==o||Tc(i)!==s;if(l)n=o,i=s;return{width:n,height:i,$:l}}function a0(e){return!Qe(e)?e.contextElement:e}function _a(e){let t=a0(e);if(!qn(t))return er(1);let n=t.getBoundingClientRect(),{width:i,height:r,$:o}=CT(t),s=(o?Tc(n.width):n.width)/i,l=(o?Tc(n.height):n.height)/r;if(!s||!Number.isFinite(s))s=1;if(!l||!Number.isFinite(l))l=1;return{x:s,y:l}}var i8=er(0);function ET(e){let t=It(e);if(!xa()||!t.visualViewport)return i8;return{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function r8(e,t,n){if(t===void 0)t=!1;return!!n&&t&&n===It(e)}function Bs(e,t,n,i){if(t===void 0)t=!1;if(n===void 0)n=!1;let r=e.getBoundingClientRect(),o=a0(e),s=er(1);if(t)if(i){if(Qe(i))s=_a(i)}else s=_a(e);let l=r8(o,n,i)?ET(o):er(0),a=(r.left+l.x)/s.x,u=(r.top+l.y)/s.y,c=r.width/s.x,f=r.height/s.y;if(o&&i){let d=It(o),h=Qe(i)?It(i):i,m=d,b=rp(m);while(b&&h!==m){let x=_a(b),g=b.getBoundingClientRect(),v=Sn(b),w=g.left+(b.clientLeft+parseFloat(v.paddingLeft))*x.x,S=g.top+(b.clientTop+parseFloat(v.paddingTop))*x.y;a*=x.x,u*=x.y,c*=x.x,f*=x.y,a+=w,u+=S,m=It(b),b=rp(m)}}return Ls({width:c,height:f,x:a,y:u})}function fp(e,t){let n=Rc(e).scrollLeft;if(!t)return Bs(Ji(e)).left+n;return t.left+n}function OT(e,t){let n=e.getBoundingClientRect(),i=n.left+t.scrollLeft-fp(e,n),r=n.top+t.scrollTop;return{x:i,y:r}}function o8(e){let{elements:t,rect:n,offsetParent:i,strategy:r}=e,o=r==="fixed",s=Ji(i),l=t?Oc(t.floating):!1;if(i===s||l&&o)return n;let a={scrollLeft:0,scrollTop:0},u=er(1),c=er(0),f=qn(i);if(f||!o){if(Ao(i)!=="body"||Ec(s))a=Rc(i);if(f){let h=Bs(i);u=_a(i),c.x=h.x+i.clientLeft,c.y=h.y+i.clientTop}}let d=s&&!f&&!o?OT(s,a):er(0);return{width:n.width*u.x,height:n.height*u.y,x:n.x*u.x-a.scrollLeft*u.x+c.x+d.x,y:n.y*u.y-a.scrollTop*u.y+c.y+d.y}}function s8(e){return e.getClientRects?Array.from(e.getClientRects()):[]}function l8(e){let t=Rc(e),n=e.ownerDocument.body,i=Lr(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),r=Lr(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight),o=-t.scrollLeft+fp(e),s=-t.scrollTop;if(Sn(n).direction==="rtl")o+=Lr(e.clientWidth,n.clientWidth)-i;return{width:i,height:r,x:o,y:s}}var a8=25;function u8(e,t,n){if(n===void 0)n="viewport";let i=n==="layoutViewport",r=It(e),o=Ji(e),s=r.visualViewport,{clientWidth:l,clientHeight:a}=o,u=0,c=0;if(s){let d=!xa()||t==="fixed";if(i){if(!d)u=-s.offsetLeft,c=-s.offsetTop}else if(l=s.width,a=s.height,d)u=s.offsetLeft,c=s.offsetTop}if(fp(o)<=0){let d=o.ownerDocument,h=d.body,m=getComputedStyle(h),b=d.compatMode==="CSS1Compat"?parseFloat(m.marginLeft)+parseFloat(m.marginRight)||0:0,x=Math.abs(o.clientWidth-h.clientWidth-b),g=getComputedStyle(o).scrollbarGutter==="stable both-edges"?x/2:x;if(g<=a8)l-=g}return{width:l,height:a,x:u,y:c}}function c8(e,t){let n=Bs(e,!0,t==="fixed"),i=n.top+e.clientTop,r=n.left+e.clientLeft,o=_a(e),s=e.clientWidth*o.x,l=e.clientHeight*o.y,a=r*o.x,u=i*o.y;return{width:s,height:l,x:a,y:u}}function kT(e,t,n){let i;if(t==="viewport"||t==="layoutViewport")i=u8(e,n,t);else if(t==="document")i=l8(Ji(e));else if(Qe(t))i=c8(t,n);else{let r=ET(e);i={x:t.x-r.x,y:t.y-r.y,width:t.width,height:t.height}}return Ls(i)}function f8(e,t){let n=t.get(e);if(n)return n;let i=wn(e,[],!1).filter((l)=>Qe(l)&&Ao(l)!=="body"),r=null,o=Sn(e).position==="fixed",s=o?Qi(e):e;while(Qe(s)&&!Zi(s)){let l=Sn(s),a=ip(s),u=r?r.position:o?"fixed":"";if(!a&&(u==="fixed"||u==="absolute"&&l.position==="static"))i=i.filter((f)=>f!==s);else r=l;s=Qi(s)}return t.set(e,i),i}function d8(e){let{element:t,boundary:n,rootBoundary:i,strategy:r}=e,s=[...n==="clippingAncestors"?Oc(t)?[]:f8(t,this._c):[].concat(n),i],l=kT(t,s[0],r),{top:a,right:u,bottom:c,left:f}=l;for(let d=1;d<s.length;d++){let h=kT(t,s[d],r);a=Lr(h.top,a),u=wa(h.right,u),c=wa(h.bottom,c),f=Lr(h.left,f)}return{width:u-f,height:c-a,x:f,y:a}}function h8(e){let{width:t,height:n}=CT(e);return{width:t,height:n}}function p8(e,t,n){let i=qn(t),r=Ji(t),o=n==="fixed",s=Bs(e,!0,o,t),l={scrollLeft:0,scrollTop:0},a=er(0);if(i||!o){if(Ao(t)!=="body"||Ec(r))l=Rc(t);if(i){let d=Bs(t,!0,o,t);a.x=d.x+t.clientLeft,a.y=d.y+t.clientTop}}if(!i&&r)a.x=fp(r);let u=r&&!i&&!o?OT(r,l):er(0),c=s.left+l.scrollLeft-a.x-u.x,f=s.top+l.scrollTop-a.y-u.y;return{x:c,y:f,width:s.width,height:s.height}}function l0(e){return Sn(e).position==="static"}function _T(e,t){if(!qn(e)||Sn(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;if(Ji(e)===n)n=n.ownerDocument.body;return n}function RT(e,t){let n=It(e);if(Oc(e))return n;if(!qn(e)){let r=Qi(e);while(r&&!Zi(r)){if(Qe(r)&&!l0(r))return r;r=Qi(r)}return n}let i=_T(e,t);while(i&&$A(i)&&l0(i))i=_T(i,t);if(i&&Zi(i)&&l0(i)&&!ip(i))return n;return i||XA(e)||n}var m8=async function(e){let t=this.getOffsetParent||RT,n=this.getDimensions,i=await n(e.floating);return{reference:p8(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:i.width,height:i.height}}};function g8(e){return Sn(e).direction==="rtl"}var u0={convertOffsetParentRelativeRectToViewportRelativeRect:o8,getDocumentElement:Ji,getClippingRect:d8,getOffsetParent:RT,getElementRects:m8,getClientRects:s8,getDimensions:h8,getScale:_a,isElement:Qe,isRTL:g8};function AT(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function v8(e,t,n){let i=null,r,o=Ji(e);function s(){var c;clearTimeout(r),(c=i)==null||c.disconnect(),i=null}function l(c,f){if(c===void 0)c=!1;if(f===void 0)f=1;s();let d=e.getBoundingClientRect(),{left:h,top:m,width:b,height:x}=d;if(!c)t();if(!b||!x)return;let g=Mc(m),v=Mc(o.clientWidth-(h+b)),w=Mc(o.clientHeight-(m+x)),S=Mc(h),E={rootMargin:-g+"px "+-v+"px "+-w+"px "+-S+"px",threshold:Lr(0,wa(1,f))||1},_=!0;function O(B){let M=B[0].intersectionRatio;if(!AT(d,e.getBoundingClientRect()))return l();if(M!==f){if(!_)return l();if(!M)r=setTimeout(()=>{l(!1,0.0000001)},1000);else l(!1,M)}_=!1}try{i=new IntersectionObserver(O,{...E,root:o.ownerDocument})}catch(B){i=new IntersectionObserver(O,E)}i.observe(e)}let a=It(e),u=()=>l(n);return a.addEventListener("resize",u),l(!0),()=>{a.removeEventListener("resize",u),s()}}function Mo(e,t,n,i){if(i===void 0)i={};let{ancestorScroll:r=!0,ancestorResize:o=!0,elementResize:s=typeof ResizeObserver==="function",layoutShift:l=typeof IntersectionObserver==="function",animationFrame:a=!1}=i,u=a0(e),c=r||o?[...u?wn(u):[],...t?wn(t):[]]:[];c.forEach((g)=>{r&&g.addEventListener("scroll",n),o&&g.addEventListener("resize",n)});let f=u&&l?v8(u,n,o):null,d=-1,h=null;if(s){if(h=new ResizeObserver((g)=>{let[v]=g;if(v&&v.target===u&&h&&t)h.unobserve(t),cancelAnimationFrame(d),d=requestAnimationFrame(()=>{var w;(w=h)==null||w.observe(t)});n()}),u&&!a)h.observe(u);if(t)h.observe(t)}let m,b=a?Bs(e):null;if(a)x();function x(){let g=Bs(e);if(b&&!AT(b,g))n();b=g,m=requestAnimationFrame(x)}return n(),()=>{var g;if(c.forEach((v)=>{r&&v.removeEventListener("scroll",n),o&&v.removeEventListener("resize",n)}),f==null||f(),(g=h)==null||g.disconnect(),h=null,a)cancelAnimationFrame(m)}}var TT=wT;var MT=ST,NT=xT;var dp=(e,t,n)=>{let i=new Map,r=n!=null?n:{},o={...u0,...r.platform,_c:i};return yT(e,t,{...r,platform:o})};var y8=typeof document<"u",x8=function(){},hp=y8?ti:x8;function pp(e,t){if(e===t)return!0;if(typeof e!==typeof t)return!1;if(typeof e==="function"&&e.toString()===t.toString())return!0;let n,i,r;if(e&&t&&typeof e==="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(i=n;i--!==0;)if(!pp(e[i],t[i]))return!1;return!0}if(r=Object.keys(e),n=r.length,n!==Object.keys(t).length)return!1;for(i=n;i--!==0;)if(!{}.hasOwnProperty.call(t,r[i]))return!1;for(i=n;i--!==0;){let o=r[i];if(o==="_owner"&&e.$$typeof)continue;if(!pp(e[o],t[o]))return!1}return!0}return e!==e&&t!==t}function LT(e){if(typeof window>"u")return 1;return(e.ownerDocument.defaultView||window).devicePixelRatio||1}function DT(e,t){let n=LT(e);return Math.round(t*n)/n}function c0(e){let t=X(e);return hp(()=>{t.current=e}),t}function zT(e){if(e===void 0)e={};let{placement:t="bottom",strategy:n="absolute",middleware:i=[],platform:r,elements:{reference:o,floating:s}={},transform:l=!0,whileElementsMounted:a,open:u}=e,[c,f]=W({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[d,h]=W(i);if(!pp(d,i))h(i);let[m,b]=W(null),[x,g]=W(null),v=ot((P)=>{if(P!==E.current)E.current=P,b(P)},[]),w=ot((P)=>{if(P!==_.current)_.current=P,g(P)},[]),S=o||m,k=s||x,E=X(null),_=X(null),O=X(c),B=a!=null,M=c0(a),I=c0(r),H=c0(u),Y=ot(()=>{if(!E.current||!_.current)return;let P={placement:t,strategy:n,middleware:d};if(I.current)P.platform=I.current;dp(E.current,_.current,P).then((ee)=>{let fe={...ee,isPositioned:H.current!==!1};if(D.current&&!pp(O.current,fe))O.current=fe,Hf(()=>{f(fe)})})},[d,t,n,I,H]);hp(()=>{if(u===!1&&O.current.isPositioned)O.current.isPositioned=!1,f((P)=>({...P,isPositioned:!1}))},[u]);let D=X(!1);hp(()=>(D.current=!0,()=>{D.current=!1}),[]),hp(()=>{if(S)E.current=S;if(k)_.current=k;if(S&&k){if(M.current)return M.current(S,k,Y);Y()}},[S,k,Y,M,B]);let L=je(()=>({reference:E,floating:_,setReference:v,setFloating:w}),[v,w]),V=je(()=>({reference:S,floating:k}),[S,k]),G=je(()=>{let P={position:n,left:0,top:0};if(!V.floating)return P;let ee=DT(V.floating,c.x),fe=DT(V.floating,c.y);if(l)return{...P,transform:"translate("+ee+"px, "+fe+"px)",...LT(V.floating)>=1.5&&{willChange:"transform"}};return{position:n,left:ee,top:fe}},[n,l,V.floating,c.x,c.y]);return je(()=>({...c,update:Y,refs:L,elements:V,floatingStyles:G}),[c,Y,L,V,G])}var No=(e,t)=>{let n=TT(e);return{name:n.name,fn:n.fn,options:[e,t]}},Ps=(e,t)=>{let n=MT(e);return{name:n.name,fn:n.fn,options:[e,t]}};var Is=(e,t)=>{let n=NT(e);return{name:n.name,fn:n.fn,options:[e,t]}};var w8="data-floating-ui-focusable",BT="active",PT="selected",S8="ArrowLeft",k8="ArrowRight",_8="ArrowUp",C8="ArrowDown";var E8=[S8,k8],O8=[_8,C8],vF=[...E8,...O8];var R8={...ur},IT=!1,A8=0,HT=()=>"floating-ui-"+Math.random().toString(36).slice(2,6)+A8++;function T8(){let[e,t]=W(()=>IT?HT():void 0);return To(()=>{if(e==null)t(HT())},[]),J(()=>{IT=!0},[]),e}var M8=R8.useId,jT=M8||T8;function N8(){let e=new Map;return{emit(t,n){var i;(i=e.get(t))==null||i.forEach((r)=>r(n))},on(t,n){if(!e.has(t))e.set(t,new Set);e.get(t).add(n)},off(t,n){var i;(i=e.get(t))==null||i.delete(n)}}}var D8=jr(null),L8=jr(null),z8=()=>{var e;return((e=qr(D8))==null?void 0:e.id)||null},FT=()=>qr(L8);function d0(e){return"data-floating-ui-"+e}var B8={border:0,clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:0,position:"fixed",whiteSpace:"nowrap",width:"1px",top:0,left:0},VT=Fr(function(t,n){let[i,r]=W();To(()=>{if(uT())r("button")},[]);let o={ref:n,tabIndex:0,role:i,"aria-hidden":i?void 0:!0,[d0("focus-guard")]:"",style:B8};return p("span",{...t,...o})}),P8={clipPath:"inset(50%)",position:"fixed",top:0,left:0},qT=jr(null),UT=d0("portal");function I8(e){if(e===void 0)e={};let{id:t,root:n}=e,i=jT(),r=H8(),[o,s]=W(null),l=X(null);return To(()=>()=>{o==null||o.remove(),queueMicrotask(()=>{l.current=null})},[o]),To(()=>{if(!i)return;if(l.current)return;let a=t?document.getElementById(t):null;if(!a)return;let u=document.createElement("div");u.id=i,u.setAttribute(UT,""),a.appendChild(u),l.current=u,s(u)},[t,i]),To(()=>{if(n===null)return;if(!i)return;if(l.current)return;let a=n||(r==null?void 0:r.portalNode);if(a&&!np(a))a=a.current;a=a||document.body;let u=null;if(t)u=document.createElement("div"),u.id=t,a.appendChild(u);let c=document.createElement("div");c.id=i,c.setAttribute(UT,""),a=u||a,a.appendChild(c),l.current=c,s(c)},[t,n,i,r]),o}function Ca(e){let{children:t,id:n,root:i,preserveTabOrder:r=!0}=e,o=I8({id:n,root:i}),[s,l]=W(null),a=X(null),u=X(null),c=X(null),f=X(null),d=s==null?void 0:s.modal,h=s==null?void 0:s.open,m=!!s&&!s.modal&&s.open&&r&&!!(i||o);return J(()=>{if(!o||!r||d)return;function b(x){if(o&&cp(x))(x.type==="focusin"?s0:gT)(o)}return o.addEventListener("focusin",b,!0),o.addEventListener("focusout",b,!0),()=>{o.removeEventListener("focusin",b,!0),o.removeEventListener("focusout",b,!0)}},[o,r,d]),J(()=>{if(!o)return;if(h)return;s0(o)},[h,o]),y(qT.Provider,{value:je(()=>({preserveTabOrder:r,beforeOutsideRef:a,afterOutsideRef:u,beforeInsideRef:c,afterInsideRef:f,portalNode:o,setFocusManagerState:l}),[r,o]),children:[m&&o&&p(VT,{"data-type":"outside",ref:a,onFocus:(b)=>{if(cp(b,o)){var x;(x=c.current)==null||x.focus()}else{let g=s?s.domReference:null,v=mT(g);v==null||v.focus()}}}),m&&o&&p("span",{"aria-owns":o.id,style:P8}),o&&Hm(t,o),m&&o&&p(VT,{"data-type":"outside",ref:u,onFocus:(b)=>{if(cp(b,o)){var x;(x=f.current)==null||x.focus()}else{let g=s?s.domReference:null,v=pT(g);v==null||v.focus(),(s==null?void 0:s.closeOnFocusOut)&&(s==null||s.onOpenChange(!1,b.nativeEvent,"focus-out"))}}})]})}var H8=()=>qr(qT);var V8={pointerdown:"onPointerDown",mousedown:"onMouseDown",click:"onClick"},U8={pointerdown:"onPointerDownCapture",mousedown:"onMouseDownCapture",click:"onClickCapture"},KT=(e)=>{var t,n;return{escapeKey:typeof e==="boolean"?e:(t=e==null?void 0:e.escapeKey)!=null?t:!1,outsidePress:typeof e==="boolean"?e:(n=e==null?void 0:e.outsidePress)!=null?n:!0}};function mp(e,t){if(t===void 0)t={};let{open:n,onOpenChange:i,elements:r,dataRef:o}=e,{enabled:s=!0,escapeKey:l=!0,outsidePress:a=!0,outsidePressEvent:u="pointerdown",referencePress:c=!1,referencePressEvent:f="pointerdown",ancestorScroll:d=!1,bubbles:h,capture:m}=t,b=FT(),x=zs(typeof a==="function"?a:()=>!1),g=typeof a==="function"?x:a,v=X(!1),{escapeKey:w,outsidePress:S}=KT(h),{escapeKey:k,outsidePress:E}=KT(m),_=X(!1),O=zs((D)=>{var L;if(!n||!s||!l||D.key!=="Escape")return;if(_.current)return;let V=(L=o.current.floatingContext)==null?void 0:L.nodeId,G=b?zc(b.nodesRef.current,V):[];if(!w){if(D.stopPropagation(),G.length>0){let P=!0;if(G.forEach((ee)=>{var fe;if((fe=ee.context)!=null&&fe.open&&!ee.context.dataRef.current.__escapeKeyBubbles){P=!1;return}}),!P)return}}i(!1,dT(D)?D.nativeEvent:D,"escape-key")}),B=zs((D)=>{var L;let V=()=>{var G;O(D),(G=Sa(D))==null||G.removeEventListener("keydown",V)};(L=Sa(D))==null||L.addEventListener("keydown",V)}),M=zs((D)=>{var L;let V=o.current.insideReactTree;o.current.insideReactTree=!1;let G=v.current;if(v.current=!1,u==="click"&&G)return;if(V)return;if(typeof g==="function"&&!g(D))return;let P=Sa(D),ee="["+d0("inert")+"]",fe=ka(r.floating).querySelectorAll(ee),De=Qe(P)?P:null;while(De&&!Zi(De)){let Se=Qi(De);if(Zi(Se)||!Qe(Se))break;De=Se}if(fe.length&&Qe(P)&&!fT(P)&&!ap(P,r.floating)&&Array.from(fe).every((Se)=>!ap(De,Se)))return;if(qn(P)&&Y){let Se=Zi(P),ct=Sn(P),_t=/auto|scroll/,Xo=Se||_t.test(ct.overflowX),Qs=Se||_t.test(ct.overflowY),Qa=Xo&&P.clientWidth>0&&P.scrollWidth>P.clientWidth,Ct=Qs&&P.clientHeight>0&&P.scrollHeight>P.clientHeight,Ur=ct.direction==="rtl",Js=Ct&&(Ur?D.offsetX<=P.offsetWidth-P.clientWidth:D.offsetX>P.clientWidth),Ja=Qa&&D.offsetY>P.clientHeight;if(Js||Ja)return}let qe=(L=o.current.floatingContext)==null?void 0:L.nodeId,ht=b&&zc(b.nodesRef.current,qe).some((Se)=>{var ct;return up(D,(ct=Se.context)==null?void 0:ct.elements.floating)});if(up(D,r.floating)||up(D,r.domReference)||ht)return;let et=b?zc(b.nodesRef.current,qe):[];if(et.length>0){let Se=!0;if(et.forEach((ct)=>{var _t;if((_t=ct.context)!=null&&_t.open&&!ct.context.dataRef.current.__outsidePressBubbles){Se=!1;return}}),!Se)return}i(!1,D,"outside-press")}),I=zs((D)=>{var L;let V=()=>{var G;M(D),(G=Sa(D))==null||G.removeEventListener(u,V)};(L=Sa(D))==null||L.addEventListener(u,V)});J(()=>{if(!n||!s)return;o.current.__escapeKeyBubbles=w,o.current.__outsidePressBubbles=S;let D=-1;function L(fe){i(!1,fe,"ancestor-scroll")}function V(){window.clearTimeout(D),_.current=!0}function G(){D=window.setTimeout(()=>{_.current=!1},xa()?5:0)}let P=ka(r.floating);if(l)P.addEventListener("keydown",k?B:O,k),P.addEventListener("compositionstart",V),P.addEventListener("compositionend",G);g&&P.addEventListener(u,E?I:M,E);let ee=[];if(d){if(Qe(r.domReference))ee=wn(r.domReference);if(Qe(r.floating))ee=ee.concat(wn(r.floating));if(!Qe(r.reference)&&r.reference&&r.reference.contextElement)ee=ee.concat(wn(r.reference.contextElement))}return ee=ee.filter((fe)=>{var De;return fe!==((De=P.defaultView)==null?void 0:De.visualViewport)}),ee.forEach((fe)=>{fe.addEventListener("scroll",L)}),()=>{if(l)P.removeEventListener("keydown",k?B:O,k),P.removeEventListener("compositionstart",V),P.removeEventListener("compositionend",G);g&&P.removeEventListener(u,E?I:M,E),ee.forEach((fe)=>{fe.removeEventListener("scroll",L)}),window.clearTimeout(D)}},[o,r,l,g,u,n,i,d,s,w,S,O,k,B,M,E,I]),J(()=>{o.current.insideReactTree=!1},[o,g,u]);let H=je(()=>({onKeyDown:O,...c&&{[V8[f]]:(D)=>{i(!1,D.nativeEvent,"reference-press")},...f!=="click"&&{onClick(D){i(!1,D.nativeEvent,"reference-press")}}}}),[O,i,c,f]),Y=je(()=>{function D(L){if(L.button!==0)return;v.current=!0}return{onKeyDown:O,onMouseDown:D,onMouseUp:D,[U8[u]]:()=>{o.current.insideReactTree=!0}}},[O,u,o]);return je(()=>s?{reference:H,floating:Y}:{},[s,H,Y])}function K8(e){let{open:t=!1,onOpenChange:n,elements:i}=e,r=jT(),o=X({}),[s]=W(()=>N8()),l=z8()!=null,[a,u]=W(i.reference),c=zs((h,m,b)=>{o.current.openEvent=h?m:void 0,s.emit("openchange",{open:h,event:m,reason:b,nested:l}),n==null||n(h,m,b)}),f=je(()=>({setPositionReference:u}),[]),d=je(()=>({reference:a||i.reference||null,floating:i.floating||null,domReference:i.reference}),[a,i.reference,i.floating]);return je(()=>({dataRef:o,open:t,onOpenChange:c,elements:d,events:s,floatingId:r,refs:f}),[t,c,d,s,r,f])}function Ea(e){var t,n;let{elements:i,...r}=e===void 0?{}:e,{nodeId:o}=r,s=K8({...r,elements:{reference:(t=i==null?void 0:i.reference)!=null?t:null,floating:(n=i==null?void 0:i.floating)!=null?n:null}}),l=r.rootContext||s,a=l.elements,[u,c]=W(null),[f,d]=W(null),m=(a==null?void 0:a.domReference)||u,b=X(null),x=FT();To(()=>{if(m)b.current=m},[m]);let g=zT({...r,elements:{...a,...f&&{reference:f}}}),v=ot((_)=>{let O=Qe(_)?{getBoundingClientRect:()=>_.getBoundingClientRect(),getClientRects:()=>_.getClientRects(),contextElement:_}:_;d(O),g.refs.setReference(O)},[g.refs]),w=ot((_)=>{if(Qe(_)||_===null)b.current=_,c(_);if(Qe(g.refs.reference.current)||g.refs.reference.current===null||_!==null&&!Qe(_))g.refs.setReference(_)},[g.refs]),S=je(()=>({...g.refs,setReference:w,setPositionReference:v,domReference:b}),[g.refs,w,v]),k=je(()=>({...g.elements,domReference:m}),[g.elements,m]),E=je(()=>({...g,...l,refs:S,elements:k,nodeId:o}),[g,S,k,o,l]);return To(()=>{l.dataRef.current.floatingContext=E;let _=x==null?void 0:x.nodesRef.current.find((O)=>O.id===o);if(_)_.context=E}),je(()=>({...g,context:E,refs:S,elements:k}),[g,S,k,E])}function f0(e,t,n){let i=new Map,r=n==="item",o=e;if(r&&e){let{[BT]:s,[PT]:l,...a}=e;o=a}return{...n==="floating"&&{tabIndex:-1,[w8]:""},...o,...t.map((s)=>{let l=s?s[n]:null;if(typeof l==="function")return e?l(e):null;return l}).concat(e).reduce((s,l)=>{if(!l)return s;return Object.entries(l).forEach((a)=>{let[u,c]=a;if(r&&[BT,PT].includes(u))return;if(u.indexOf("on")===0){if(!i.has(u))i.set(u,[]);if(typeof c==="function"){var f;(f=i.get(u))==null||f.push(c),s[u]=function(){var d;for(var h=arguments.length,m=Array(h),b=0;b<h;b++)m[b]=arguments[b];return(d=i.get(u))==null?void 0:d.map((x)=>x(...m)).find((x)=>x!==void 0)}}}else s[u]=c}),s},{})}}function gp(e){if(e===void 0)e=[];let t=e.map((l)=>l==null?void 0:l.reference),n=e.map((l)=>l==null?void 0:l.floating),i=e.map((l)=>l==null?void 0:l.item),r=ot((l)=>f0(l,e,"reference"),t),o=ot((l)=>f0(l,e,"floating"),n),s=ot((l)=>f0(l,e,"item"),i);return je(()=>({getReferenceProps:r,getFloatingProps:o,getItemProps:s}),[r,o,s])}function $T(){let[e,t]=W(null),{refs:n,floatingStyles:i}=Ea({placement:e?.el.getAttribute("data-tip-side")==="right"?"right":"bottom-start",middleware:[No(6),Is(),Ps({padding:8})],whileElementsMounted:Mo,elements:{reference:e?.el??null}});if(J(()=>{let r=(s)=>{if(s.pointerType==="touch")return;let l=s.target,a=l instanceof Element?l.closest("[data-tip]"):null,u=a?.getAttribute("data-tip")??"";t((c)=>a==null||u===""?null:c?.el===a&&c.text===u?c:{el:a,text:u})},o=()=>t(null);return document.addEventListener("pointerover",r),document.addEventListener("pointerdown",o),document.addEventListener("keydown",o),window.addEventListener("scroll",o,!0),()=>{document.removeEventListener("pointerover",r),document.removeEventListener("pointerdown",o),document.removeEventListener("keydown",o),window.removeEventListener("scroll",o,!0)}},[]),e==null)return null;return p(Ca,{children:p("div",{ref:n.setFloating,style:i,className:"tooltip",role:"tooltip",children:e.text})})}var h0=[25,50,100,250,500,1000,2000],XT=q(function(t){let[n,i]=W(null),[r,o]=W(!1),s=t.st.run.memory,l=t.st.settings.memoryBudgetMb;return y(te,{children:[y("button",{type:"button",ref:i,className:r?"sel":"","data-tip":"unsaved results kept in the server memory: click to change the budget",onClick:()=>{if(!r)t.st.run.refreshMemory();o(!r)},children:[p(T,{name:"memory"}),s==null?`${l} MB`:`${Vy(s.usedBytes)}/${l} MB`]}),r&&n!=null?p(j8,{st:t.st,anchor:n,onClose:()=>o(!1)}):null]})}),j8=q(function(t){let{refs:n,floatingStyles:i,context:r}=Ea({open:!0,onOpenChange:(u)=>{if(!u)t.onClose()},placement:"bottom-end",middleware:[No(4),Is(),Ps({padding:8})],whileElementsMounted:Mo,elements:{reference:t.anchor}}),{getFloatingProps:o}=gp([mp(r)]),s=t.st.run.memory,l=t.st.settings.memoryBudgetMb,a=h0.includes(l)?h0:[...h0,l].sort((u,c)=>u-c);return p(Ca,{children:y("div",{ref:n.setFloating,style:i,className:"tab-menu memory-menu",...o(),children:[y("div",{className:"menu-row",children:[p(T,{name:"memory"}),p("span",{className:"menu-value",children:"server memory"})]}),p("p",{className:"hint memory-note",children:"Unsaved results live in the serve process only: a page reload shows them again, a server restart loses them. Past the budget, the oldest go first."}),y("label",{className:"menu-row",children:[p("span",{children:"budget"}),p("select",{className:"menu-select",value:l,onChange:(u)=>void t.st.setMemoryBudget(Number(u.target.value)),children:a.map((u)=>p("option",{value:u,children:u>=1000?`${u/1000} GB`:`${u} MB`},u))})]}),p("div",{className:"hint memory-note",children:s==null?"usage not read yet":`${Vy(s.usedBytes)} MB used by ${s.outputs} unsaved output${s.outputs===1?"":"s"}, ${s.runs} run${s.runs===1?"":"s"} kept`}),t.st.savingError!=null?p("div",{className:"error memory-note",children:t.st.savingError}):null]})})});var vp=q(function(t){let n=t.st.run.error;if(n==null)return null;return y("div",{className:"run-error-block",role:"alert",children:[p(T,{name:"warn"}),p("pre",{className:"run-error-text",children:n}),p("button",{type:"button",className:"link danger","data-tip":"dismiss",onClick:()=>t.st.run.dismissError(),children:p(T,{name:"close"})})]})});function p0(e){return{label:e.kind,count:String(Math.max(0,Math.min(999,Math.round(e.count))))}}function GT(e){let t=e.split(`
22
+ `).map((r)=>r.trim()).filter((r)=>r!==""),n=t.filter((r)=>r.startsWith("- ")).map((r)=>r.slice(2).trim());return{positive:t.filter((r)=>!r.startsWith("- ")).join(" · "),negative:n.join(" · ")}}var m0=":output";function YT(e){return[...e,":output"]}function WT(e,t){let n=t.trim();return e.find((i)=>i.text.trim()===n)?.label??null}function F8(e){let t=e.split(`
23
+ `).find((n)=>n.trim()!=="")??"";return t.length<=90?t:`${t.slice(0,89)}…`}var Bc=q(function(t){let n=t.v.desc.textPresets??[],[i,r]=W(!1);if(n.length===0)return null;let o=typeof t.v.value==="string"?t.v.value:"",s=WT(n,o);return y("div",{className:"preset-box",onKeyDown:(l)=>l.key==="Escape"?r(!1):void 0,children:[y("button",{type:"button",className:"preset-btn mini","aria-expanded":i,"data-tip":"named starting texts — picking one replaces the field",onClick:()=>r(!i),children:[p(T,{name:"tag"})," presets ▾"]}),i?y(te,{children:[p("div",{className:"preset-backdrop",onClick:()=>r(!1)}),p("div",{className:"preset-menu",children:n.map((l)=>y("button",{type:"button",className:l.label===s?"preset-item on":"preset-item",onClick:()=>{t.v.set(l.text),r(!1)},children:[y("span",{className:"preset-name",children:[l.label===s?"• ":"  ",l.label]}),p("span",{className:"preset-peek",children:F8(l.text)})]},l.label))})]}):null]})});function bp(e){if(e.icon.trimStart().startsWith("<svg"))return p("img",{className:"var-icon",alt:"",src:`data:image/svg+xml;utf8,${encodeURIComponent(e.icon)}`});return p("svg",{className:"var-icon",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",style:e.color==null?void 0:{color:e.color},"aria-hidden":"true",children:p("path",{d:e.icon})})}var QT=q(function(t){let n=typeof t.v.value==="string"?t.v.value:"",i=t.v.desc.textPresets??[];if(t.v.desc.multiline===!0){let r=Math.min(12,Math.max(3,n.split(`
24
+ `).length+1));return y("div",{children:[p("textarea",{rows:r,value:n,onChange:(o)=>t.v.set(o.target.value)}),i.length>0?p("div",{className:"row-inline",children:p(Bc,{v:t.v})}):null]})}if(i.length===0)return p("input",{type:"text",value:n,onChange:(r)=>t.v.set(r.target.value)});return y("div",{className:"row-inline",children:[p("input",{type:"text",style:{flex:1},value:n,onChange:(r)=>t.v.set(r.target.value)}),p(Bc,{v:t.v})]})}),JT=q(function(t){let n=t.v.desc.kind==="int",i=typeof t.v.value==="number"?t.v.value:0,r=t.v.desc.min,o=t.v.desc.max,s=(l)=>{let a=n?parseInt(l,10):parseFloat(l);if(Number.isFinite(a))t.v.set(a)};return y("div",{className:"row-inline",children:[p("input",{type:"number",value:i,step:n?1:"any",min:r,max:o,onChange:(l)=>s(l.target.value)}),r!=null&&o!=null?p("input",{type:"range",className:"num-range",style:{flex:1,minWidth:120,backgroundImage:q8(i,r,o)},value:i,min:r,max:o,step:n?1:(o-r)/200,onChange:(l)=>s(l.target.value)}):null,r!=null||o!=null?p("span",{className:"hint",children:`${r??"-∞"} … ${o??"∞"}`}):null]})});function q8(e,t,n){let i=n>t?(Math.min(n,Math.max(t,e))-t)/(n-t)*100:0;return`linear-gradient(90deg, var(--accent) ${i}%, var(--border) ${i}%)`}var ZT=q(function(t){return y("label",{className:"row-inline",style:{cursor:"pointer"},children:[p("input",{type:"checkbox",checked:t.v.value===!0,onChange:(n)=>t.v.set(n.target.checked)}),p("span",{className:"hint",children:t.v.value===!0?"on":"off"})]})}),eM=q(function(t){let n=t.v.desc.choices??[],i=t.v.desc.select??"one",r=Qh(t.v.value),o=t.v.desc.ui?.options??{},s=(c)=>t.v.set(XR({select:i,choices:n,value:t.v.value,c})),l=r.filter((c)=>!n.includes(c)),a=l.length>0?y("span",{className:"hint",children:[l.join(", ")," (not on this host)"]}):i==="one"&&r.length===0?p("span",{className:"hint",children:"(unset)"}):null;if($R(n)||i!=="one")return y("span",{className:"row-inline",children:[p("span",{className:"btn-group wrap",children:n.map((c)=>{let f=o[c],d=r.includes(c);return y("button",{type:"button",className:d?"sel":"","data-tip":i==="many"?`${d?"on":"off"}: click to toggle`:i==="zero-or-one"&&d?"click again to pick none":void 0,style:f?.color==null?void 0:d?{background:f.color,borderColor:f.color}:{color:f.color},onClick:()=>s(c),children:[f?.icon==null?null:p(bp,{icon:f.icon,color:void 0}),c]},c)})}),a]});let u=r[0]??"";return y("select",{value:u,onChange:(c)=>t.v.set(c.target.value),children:[n.includes(u)?null:p("option",{value:u,disabled:!0,children:u===""?"(unset)":`${u} (not on this host)`}),n.map((c)=>p("option",{value:c,children:c},c))]})});function Pc(e){let[t,n]=W(!1),i=()=>n(!1);return y("span",{className:`preset-box menu-box ${e.className??""}`,onKeyDown:(r)=>r.key==="Escape"?i():void 0,children:[p("button",{type:"button",className:"menu-btn","aria-expanded":t,"data-tip":e.tip,onClick:()=>n(!t),children:p(T,{name:"more"})}),t?y(te,{children:[p("div",{className:"preset-backdrop",onClick:i}),p("div",{className:"preset-menu menu-list",children:e.children(i)})]}):null]})}function rn(e){return y("button",{type:"button",className:"menu-item",disabled:e.disabled,"data-tip":e.tip,onClick:e.onClick,children:[p("span",{className:"menu-check",children:e.checked==null?"":e.checked?"✓":""}),e.label]})}var v0=[],rM=[];(()=>{let e="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((t)=>t?parseInt(t,36):1);for(let t=0,n=0;t<e.length;t++)(t%2?rM:v0).push(n=n+e[t])})();function $8(e){if(e<768)return!1;for(let t=0,n=v0.length;;){let i=t+n>>1;if(e<v0[i])n=i;else if(e>=rM[i])t=i+1;else return!0;if(t==n)return!1}}function tM(e){return e>=127462&&e<=127487}var nM=8205;function oM(e,t,n=!0,i=!0){return(n?sM:X8)(e,t,i)}function sM(e,t,n){if(t==e.length)return t;if(t&&lM(e.charCodeAt(t))&&aM(e.charCodeAt(t-1)))t--;let i=g0(e,t);t+=iM(i);while(t<e.length){let r=g0(e,t);if(i==nM||r==nM||n&&$8(r))t+=iM(r),i=r;else if(tM(r)){let o=0,s=t-2;while(s>=0&&tM(g0(e,s)))o++,s-=2;if(o%2==0)break;else t+=2}else break}return t}function X8(e,t,n){while(t>1){let i=sM(e,t-2,n);if(i<t)return i;t--}return 0}function g0(e,t){let n=e.charCodeAt(t);if(!aM(n)||t+1==e.length)return n;let i=e.charCodeAt(t+1);if(!lM(i))return n;return(n-55296<<10)+(i-56320)+65536}function lM(e){return e>=56320&&e<57344}function aM(e){return e>=55296&&e<56320}function iM(e){return e<65536?1:2}class he{lineAt(e){if(e<0||e>this.length)throw 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 RangeError(`Invalid line number ${e} in ${this.lines}-line document`);return this.lineInner(e,!0,1,0)}replace(e,t,n){[e,t]=Ma(this,e,t);let i=[];if(this.decompose(0,e,i,2),n.length)n.decompose(0,n.length,i,3);return this.decompose(t,this.length,i,1),tr.from(i,this.length-(t-e)+n.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,t=this.length){[e,t]=Ma(this,e,t);let n=[];return this.decompose(e,t,n,0),tr.from(n,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),n=this.length-this.scanIdentical(e,-1),i=new Aa(this),r=new Aa(e);for(let o=t,s=t;;){if(i.next(o),r.next(o),o=0,i.lineBreak!=r.lineBreak||i.done!=r.done||i.value!=r.value)return!1;if(s+=i.value.length,i.done||s>=n)return!0}}iter(e=1){return new Aa(this,e)}iterRange(e,t=this.length){return new R0(this,e,t)}iterLines(e,t){let n;if(e==null)n=this.iter();else{if(t==null)t=this.lines+1;let i=this.line(e).from;n=this.iterRange(i,Math.max(i,t==this.lines+1?this.length:t<=1?0:this.line(t-1).to))}return new A0(n)}toString(){return this.sliceString(0)}toJSON(){let e=[];return this.flatten(e),e}constructor(){}static of(e){if(e.length==0)throw RangeError("A document must have at least one line");if(e.length==1&&!e[0])return he.empty;return e.length<=32?new it(e):tr.from(it.split(e,[]))}}class it extends he{constructor(e,t=G8(e)){super();this.text=e,this.length=t}get lines(){return this.text.length}get children(){return null}lineInner(e,t,n,i){for(let r=0;;r++){let o=this.text[r],s=i+o.length;if((t?n:s)>=e)return new pM(i,s,n,o);i=s+1,n++}}decompose(e,t,n,i){let r=e<=0&&t>=this.length?this:new it(uM(this.text,e,t),Math.min(t,this.length)-Math.max(0,e));if(i&1){let o=n.pop(),s=Sp(r.text,o.text.slice(),0,r.length);if(s.length<=32)n.push(new it(s,o.length+r.length));else{let l=s.length>>1;n.push(new it(s.slice(0,l)),new it(s.slice(l)))}}else n.push(r)}replace(e,t,n){if(!(n instanceof it))return super.replace(e,t,n);[e,t]=Ma(this,e,t);let i=Sp(this.text,Sp(n.text,uM(this.text,0,e)),t),r=this.length+n.length-(t-e);if(i.length<=32)return new it(i,r);return tr.from(it.split(i,[]),r)}sliceString(e,t=this.length,n=`
25
+ `){[e,t]=Ma(this,e,t);let i="";for(let r=0,o=0;r<=t&&o<this.text.length;o++){let s=this.text[o],l=r+s.length;if(r>e&&o)i+=n;if(e<l&&t>r)i+=s.slice(Math.max(0,e-r),t-r);r=l+1}return i}flatten(e){for(let t of this.text)e.push(t)}scanIdentical(){return 0}static split(e,t){let n=[],i=-1;for(let r of e)if(n.push(r),i+=r.length+1,n.length==32)t.push(new it(n,i)),n=[],i=-1;if(i>-1)t.push(new it(n,i));return t}}class tr extends he{constructor(e,t){super();this.children=e,this.length=t,this.lines=0;for(let n of e)this.lines+=n.lines}lineInner(e,t,n,i){for(let r=0;;r++){let o=this.children[r],s=i+o.length,l=n+o.lines-1;if((t?l:s)>=e)return o.lineInner(e,t,n,i);i=s+1,n=l+1}}decompose(e,t,n,i){for(let r=0,o=0;o<=t&&r<this.children.length;r++){let s=this.children[r],l=o+s.length;if(e<=l&&t>=o){let a=i&((o<=e?1:0)|(l>=t?2:0));if(o>=e&&l<=t&&!a)n.push(s);else s.decompose(e-o,t-o,n,a)}o=l+1}}replace(e,t,n){if([e,t]=Ma(this,e,t),n.lines<this.lines)for(let i=0,r=0;i<this.children.length;i++){let o=this.children[i],s=r+o.length;if(e>=r&&t<=s){let l=o.replace(e-r,t-r,n),a=this.lines-o.lines+l.lines;if(l.lines<a>>4&&l.lines>a>>6){let u=this.children.slice();return u[i]=l,new tr(u,this.length-(t-e)+n.length)}return super.replace(r,s,l)}r=s+1}return super.replace(e,t,n)}sliceString(e,t=this.length,n=`
26
+ `){[e,t]=Ma(this,e,t);let i="";for(let r=0,o=0;r<this.children.length&&o<=t;r++){let s=this.children[r],l=o+s.length;if(o>e&&r)i+=n;if(e<l&&t>o)i+=s.sliceString(e-o,t-o,n);o=l+1}return i}flatten(e){for(let t of this.children)t.flatten(e)}scanIdentical(e,t){if(!(e instanceof tr))return 0;let n=0,[i,r,o,s]=t>0?[0,0,this.children.length,e.children.length]:[this.children.length-1,e.children.length-1,-1,-1];for(;;i+=t,r+=t){if(i==o||r==s)return n;let l=this.children[i],a=e.children[r];if(l!=a)return n+l.scanIdentical(a,t);n+=l.length+1}}static from(e,t=e.reduce((n,i)=>n+i.length+1,-1)){let n=0;for(let d of e)n+=d.lines;if(n<32){let d=[];for(let h of e)h.flatten(d);return new it(d,t)}let i=Math.max(32,n>>5),r=i<<1,o=i>>1,s=[],l=0,a=-1,u=[];function c(d){let h;if(d.lines>r&&d instanceof tr)for(let m of d.children)c(m);else if(d.lines>o&&(l>o||!l))f(),s.push(d);else if(d instanceof it&&l&&(h=u[u.length-1])instanceof it&&d.lines+h.lines<=32)l+=d.lines,a+=d.length+1,u[u.length-1]=new it(h.text.concat(d.text),h.length+1+d.length);else{if(l+d.lines>i)f();l+=d.lines,a+=d.length+1,u.push(d)}}function f(){if(l==0)return;s.push(u.length==1?u[0]:tr.from(u,a)),a=-1,l=u.length=0}for(let d of e)c(d);return f(),s.length==1?s[0]:new tr(s,t)}}he.empty=new it([""],0);function G8(e){let t=-1;for(let n of e)t+=n.length+1;return t}function Sp(e,t,n=0,i=1e9){for(let r=0,o=0,s=!0;o<e.length&&r<=i;o++){let l=e[o],a=r+l.length;if(a>=n){if(a>i)l=l.slice(0,i-r);if(r<n)l=l.slice(n-r);if(s)t[t.length-1]+=l,s=!1;else t.push(l)}r=a+1}return t}function uM(e,t,n){return Sp(e,[""],t,n)}class Aa{constructor(e,t=1){this.dir=t,this.done=!1,this.lineBreak=!1,this.value="",this.nodes=[e],this.offsets=[t>0?1:(e instanceof it?e.text.length:e.children.length)<<1]}nextInner(e,t){this.done=this.lineBreak=!1;for(;;){let n=this.nodes.length-1,i=this.nodes[n],r=this.offsets[n],o=r>>1,s=i instanceof it?i.text.length:i.children.length;if(o==(t>0?s:0)){if(n==0)return this.done=!0,this.value="",this;if(t>0)this.offsets[n-1]++;this.nodes.pop(),this.offsets.pop()}else if((r&1)==(t>0?0:1)){if(this.offsets[n]+=t,e==0)return this.lineBreak=!0,this.value=`
27
+ `,this;e--}else if(i instanceof it){let l=i.text[o+(t<0?-1:0)];if(this.offsets[n]+=t,l.length>Math.max(0,e))return this.value=e==0?l:t>0?l.slice(e):l.slice(0,l.length-e),this;e-=l.length}else{let l=i.children[o+(t<0?-1:0)];if(e>l.length)e-=l.length,this.offsets[n]+=t;else{if(t<0)this.offsets[n]--;this.nodes.push(l),this.offsets.push(t>0?1:(l instanceof it?l.text.length:l.children.length)<<1)}}}}next(e=0){if(e<0)this.nextInner(-e,-this.dir),e=this.value.length;return this.nextInner(e,this.dir)}}class R0{constructor(e,t,n){this.value="",this.done=!1,this.cursor=new Aa(e,t>n?-1:1),this.pos=t>n?e.length:0,this.from=Math.min(t,n),this.to=Math.max(t,n)}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 n=t<0?this.pos-this.from:this.to-this.pos;if(e>n)e=n;n-=e;let{value:i}=this.cursor.next(e);return this.pos+=(i.length+e)*t,this.value=i.length<=n?i:t<0?i.slice(i.length-n):i.slice(0,n),this.done=!this.value,this}next(e=0){if(e<0)e=Math.max(e,this.from-this.pos);else if(e>0)e=Math.min(e,this.to-this.pos);return this.nextInner(e,this.cursor.dir)}get lineBreak(){return this.cursor.lineBreak&&this.value!=""}}class A0{constructor(e){this.inner=e,this.afterBreak=!0,this.value="",this.done=!1}next(e=0){let{done:t,lineBreak:n,value:i}=this.inner.next(e);if(t&&this.afterBreak)this.value="",this.afterBreak=!1;else if(t)this.done=!0,this.value="";else if(n)if(this.afterBreak)this.value="";else this.afterBreak=!0,this.next();else this.value=i,this.afterBreak=!1;return this}get lineBreak(){return!1}}if(typeof Symbol<"u")he.prototype[Symbol.iterator]=function(){return this.iter()},Aa.prototype[Symbol.iterator]=R0.prototype[Symbol.iterator]=A0.prototype[Symbol.iterator]=function(){return this};class pM{constructor(e,t,n,i){this.from=e,this.to=t,this.number=n,this.text=i}get length(){return this.to-this.from}}function Ma(e,t,n){return t=Math.max(0,Math.min(e.length,t)),[t,Math.max(t,Math.min(e.length,n))]}function wt(e,t,n=!0,i=!0){return oM(e,t,n,i)}function Y8(e){return e>=56320&&e<57344}function W8(e){return e>=55296&&e<56320}function Br(e,t){let n=e.charCodeAt(t);if(!W8(n)||t+1==e.length)return n;let i=e.charCodeAt(t+1);if(!Y8(i))return n;return(n-55296<<10)+(i-56320)+65536}function mM(e){if(e<=65535)return String.fromCharCode(e);return e-=65536,String.fromCharCode((e>>10)+55296,(e&1023)+56320)}function zo(e){return e<65536?1:2}var y0=/\r\n?|\n/,qt=function(e){return e[e.Simple=0]="Simple",e[e.TrackDel=1]="TrackDel",e[e.TrackBefore=2]="TrackBefore",e[e.TrackAfter=3]="TrackAfter",e}(qt||(qt={}));class mi{constructor(e){this.sections=e}get length(){let e=0;for(let t=0;t<this.sections.length;t+=2)e+=this.sections[t];return e}get newLength(){let e=0;for(let t=0;t<this.sections.length;t+=2){let n=this.sections[t+1];e+=n<0?this.sections[t]:n}return e}get empty(){return this.sections.length==0||this.sections.length==2&&this.sections[1]<0}iterGaps(e){for(let t=0,n=0,i=0;t<this.sections.length;){let r=this.sections[t++],o=this.sections[t++];if(o<0)e(n,i,r),i+=r;else i+=o;n+=r}}iterChangedRanges(e,t=!1){x0(this,e,t)}get invertedDesc(){let e=[];for(let t=0;t<this.sections.length;){let n=this.sections[t++],i=this.sections[t++];if(i<0)e.push(n,i);else e.push(i,n)}return new mi(e)}composeDesc(e){return this.empty?e:e.empty?this:gM(this,e)}mapDesc(e,t=!1){return e.empty?this:w0(this,e,t)}mapPos(e,t=-1,n=qt.Simple){let i=0,r=0;for(let o=0;o<this.sections.length;){let s=this.sections[o++],l=this.sections[o++],a=i+s;if(l<0){if(a>e)return r+(e-i);r+=s}else{if(n!=qt.Simple&&a>=e&&(n==qt.TrackDel&&i<e&&a>e||n==qt.TrackBefore&&i<e||n==qt.TrackAfter&&a>e))return null;if(a>e||a==e&&t<0&&!s)return e==i||t<0?r:r+l;r+=l}i=a}if(e>i)throw RangeError(`Position ${e} is out of range for changeset of length ${i}`);return r}touchesRange(e,t=e){for(let n=0,i=0;n<this.sections.length&&i<=t;){let r=this.sections[n++],o=this.sections[n++],s=i+r;if(o>=0&&i<=t&&s>=e)return i<e&&s>t?"cover":!0;i=s}return!1}toString(){let e="";for(let t=0;t<this.sections.length;){let n=this.sections[t++],i=this.sections[t++];e+=(e?" ":"")+n+(i>=0?":"+i:"")}return e}toJSON(){return this.sections}static fromJSON(e){if(!Array.isArray(e)||e.length%2||e.some((t)=>typeof t!="number"))throw RangeError("Invalid JSON representation of ChangeDesc");return new mi(e)}static create(e){return new mi(e)}}class rt extends mi{constructor(e,t){super(e);this.inserted=t}apply(e){if(this.length!=e.length)throw RangeError("Applying change set to a document with the wrong length");return x0(this,(t,n,i,r,o)=>e=e.replace(i,i+(n-t),o),!1),e}mapDesc(e,t=!1){return w0(this,e,t,!0)}invert(e){let t=this.sections.slice(),n=[];for(let i=0,r=0;i<t.length;i+=2){let o=t[i],s=t[i+1];if(s>=0){t[i]=s,t[i+1]=o;let l=i>>1;while(n.length<l)n.push(he.empty);n.push(o?e.slice(r,r+o):he.empty)}r+=o}return new rt(t,n)}compose(e){return this.empty?e:e.empty?this:gM(this,e,!0)}map(e,t=!1){return e.empty?this:w0(this,e,t,!0)}iterChanges(e,t=!1){x0(this,e,t)}get desc(){return mi.create(this.sections)}filter(e){let t=[],n=[],i=[],r=new Na(this);e:for(let o=0,s=0;;){let l=o==e.length?1e9:e[o++];while(s<l||s==l&&r.len==0){if(r.done)break e;let u=Math.min(r.len,l-s);Ht(i,u,-1);let c=r.ins==-1?-1:r.off==0?r.ins:0;if(Ht(t,u,c),c>0)Lo(n,t,r.text);r.forward(u),s+=u}let a=e[o++];while(s<a){if(r.done)break e;let u=Math.min(r.len,a-s);Ht(t,u,-1),Ht(i,u,r.ins==-1?-1:r.off==0?r.ins:0),r.forward(u),s+=u}}return{changes:new rt(t,n),filtered:mi.create(i)}}toJSON(){let e=[];for(let t=0;t<this.sections.length;t+=2){let n=this.sections[t],i=this.sections[t+1];if(i<0)e.push(n);else if(i==0)e.push([n]);else e.push([n].concat(this.inserted[t>>1].toJSON()))}return e}static of(e,t,n){let i=[],r=[],o=0,s=null;function l(u=!1){if(!u&&!i.length)return;if(o<t)Ht(i,t-o,-1);let c=new rt(i,r);s=s?s.compose(c.map(s)):c,i=[],r=[],o=0}function a(u){if(Array.isArray(u))for(let c of u)a(c);else if(u instanceof rt){if(u.length!=t)throw RangeError(`Mismatched change set length (got ${u.length}, expected ${t})`);l(),s=s?s.compose(u.map(s)):u}else{let{from:c,to:f=c,insert:d}=u;if(c>f||c<0||f>t)throw RangeError(`Invalid change range ${c} to ${f} (in doc of length ${t})`);let h=!d?he.empty:typeof d=="string"?he.of(d.split(n||y0)):d,m=h.length;if(c==f&&m==0)return;if(c<o)l();if(c>o)Ht(i,c-o,-1);Ht(i,f-c,m),Lo(r,i,h),o=f}}return a(e),l(!s),s}static empty(e){return new rt(e?[e,-1]:[],[])}static fromJSON(e){if(!Array.isArray(e))throw RangeError("Invalid JSON representation of ChangeSet");let t=[],n=[];for(let i=0;i<e.length;i++){let r=e[i];if(typeof r=="number")t.push(r,-1);else if(!Array.isArray(r)||typeof r[0]!="number"||r.some((o,s)=>s&&typeof o!="string"))throw RangeError("Invalid JSON representation of ChangeSet");else if(r.length==1)t.push(r[0],0);else{while(n.length<i)n.push(he.empty);n[i]=he.of(r.slice(1)),t.push(r[0],n[i].length)}}return new rt(t,n)}static createSet(e,t){return new rt(e,t)}}function Ht(e,t,n,i=!1){if(t==0&&n<=0)return;let r=e.length-2;if(r>=0&&n<=0&&n==e[r+1])e[r]+=t;else if(r>=0&&t==0&&e[r]==0)e[r+1]+=n;else if(i)e[r]+=t,e[r+1]+=n;else e.push(t,n)}function Lo(e,t,n){if(n.length==0)return;let i=t.length-2>>1;if(i<e.length)e[e.length-1]=e[e.length-1].append(n);else{while(e.length<i)e.push(he.empty);e.push(n)}}function x0(e,t,n){let i=e.inserted;for(let r=0,o=0,s=0;s<e.sections.length;){let l=e.sections[s++],a=e.sections[s++];if(a<0)r+=l,o+=l;else{let u=r,c=o,f=he.empty;for(;;){if(u+=l,c+=a,a&&i)f=f.append(i[s-2>>1]);if(n||s==e.sections.length||e.sections[s+1]<0)break;l=e.sections[s++],a=e.sections[s++]}t(r,u,o,c,f),r=u,o=c}}}function w0(e,t,n,i=!1){let r=[],o=i?[]:null,s=new Na(e),l=new Na(t);for(let a=-1;;)if(s.done&&l.len||l.done&&s.len)throw Error("Mismatched change set lengths");else if(s.ins==-1&&l.ins==-1){let u=Math.min(s.len,l.len);Ht(r,u,-1),s.forward(u),l.forward(u)}else if(l.ins>=0&&(s.ins<0||a==s.i||s.off==0&&(l.len<s.len||l.len==s.len&&!n))){let u=l.len;Ht(r,l.ins,-1);while(u){let c=Math.min(s.len,u);if(s.ins>=0&&a<s.i&&s.len<=c){if(Ht(r,0,s.ins),o)Lo(o,r,s.text);a=s.i}s.forward(c),u-=c}l.next()}else if(s.ins>=0){let u=0,c=s.len;while(c)if(l.ins==-1){let f=Math.min(c,l.len);u+=f,c-=f,l.forward(f)}else if(l.ins==0&&l.len<c)c-=l.len,l.next();else break;if(Ht(r,u,a<s.i?s.ins:0),o&&a<s.i)Lo(o,r,s.text);a=s.i,s.forward(s.len-c)}else if(s.done&&l.done)return o?rt.createSet(r,o):mi.create(r);else throw Error("Mismatched change set lengths")}function gM(e,t,n=!1){let i=[],r=n?[]:null,o=new Na(e),s=new Na(t);for(let l=!1;;)if(o.done&&s.done)return r?rt.createSet(i,r):mi.create(i);else if(o.ins==0)Ht(i,o.len,0,l),o.next();else if(s.len==0&&!s.done){if(Ht(i,0,s.ins,l),r)Lo(r,i,s.text);s.next()}else if(o.done||s.done)throw Error("Mismatched change set lengths");else{let a=Math.min(o.len2,s.len),u=i.length;if(o.ins==-1){let c=s.ins==-1?-1:s.off?0:s.ins;if(Ht(i,a,c,l),r&&c)Lo(r,i,s.text)}else if(s.ins==-1){if(Ht(i,o.off?0:o.len,a,l),r)Lo(r,i,o.textBit(a))}else if(Ht(i,o.off?0:o.len,s.off?0:s.ins,l),r&&!s.off)Lo(r,i,s.text);l=(o.ins>a||s.ins>=0&&s.len>a)&&(l||i.length>u),o.forward2(a),s.forward(a)}}class Na{constructor(e){this.set=e,this.i=0,this.next()}next(){let{sections:e}=this.set;if(this.i<e.length)this.len=e[this.i++],this.ins=e[this.i++];else this.len=0,this.ins=-2;this.off=0}get done(){return this.ins==-2}get len2(){return this.ins<0?this.len:this.ins}get text(){let{inserted:e}=this.set,t=this.i-2>>1;return t>=e.length?he.empty:e[t]}textBit(e){let{inserted:t}=this.set,n=this.i-2>>1;return n>=t.length&&!e?he.empty:t[n].slice(this.off,e==null?void 0:this.off+e)}forward(e){if(e==this.len)this.next();else this.len-=e,this.off+=e}forward2(e){if(this.ins==-1)this.forward(e);else if(e==this.ins)this.next();else this.ins-=e,this.off+=e}}class Do{constructor(e,t,n,i){this.from=e,this.to=t,this.flags=n,this.goalColumn=i}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 n,i;if(this.empty)n=i=e.mapPos(this.from,t);else n=e.mapPos(this.from,1),i=e.mapPos(this.to,-1);return n==this.from&&i==this.to?this:new Do(n,i,this.flags,this.goalColumn)}extend(e,t=e,n=0){if(e<=this.anchor&&t>=this.anchor)return A.range(e,t,void 0,void 0,n);let i=Math.abs(e-this.anchor)>Math.abs(t-this.anchor)?e:t;return A.range(this.anchor,i,void 0,void 0,n)}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 RangeError("Invalid JSON representation for SelectionRange");return A.range(e.anchor,e.head)}static create(e,t,n,i){return new Do(e,t,n,i)}}class A{constructor(e,t){this.ranges=e,this.mainIndex=t}map(e,t=-1){if(e.empty)return this;return A.create(this.ranges.map((n)=>n.map(e,t)),this.mainIndex)}eq(e,t=!1){if(this.ranges.length!=e.ranges.length||this.mainIndex!=e.mainIndex)return!1;for(let n=0;n<this.ranges.length;n++)if(!this.ranges[n].eq(e.ranges[n],t))return!1;return!0}get main(){return this.ranges[this.mainIndex]}asSingle(){return this.ranges.length==1?this:new A([this.main],0)}addRange(e,t=!0){return A.create([e].concat(this.ranges),t?0:this.mainIndex+1)}replaceRange(e,t=this.mainIndex){let n=this.ranges.slice();return n[t]=e,A.create(n,this.mainIndex)}toJSON(){return{ranges:this.ranges.map((e)=>e.toJSON()),main:this.mainIndex}}static fromJSON(e){if(!e||!Array.isArray(e.ranges)||typeof e.main!="number"||e.main>=e.ranges.length)throw RangeError("Invalid JSON representation for EditorSelection");return new A(e.ranges.map((t)=>Do.fromJSON(t)),e.main)}static single(e,t=e){return new A([A.range(e,t)],0)}static create(e,t=0){if(e.length==0)throw RangeError("A selection needs at least one range");for(let n=0,i=0;i<e.length;i++){let r=e[i];if(r.empty?r.from<=n:r.from<n)return A.normalized(e.slice(),t);n=r.to}return new A(e,t)}static cursor(e,t=0,n,i){return Do.create(e,e,(t==0?0:t<0?8:16)|(n==null?7:Math.min(6,n)),i)}static range(e,t,n,i,r){let o=i==null?7:Math.min(6,i);if(!r&&e!=t)r=t<e?1:-1;if(r)o|=r<0?8:16;return t<e?Do.create(t,e,o|32,n):Do.create(e,t,o,n)}static undirectionalRange(e,t){return Do.create(e,t,64,void 0)}static normalized(e,t=0){let n=e[t];e.sort((i,r)=>i.from-r.from),t=e.indexOf(n);for(let i=1;i<e.length;i++){let r=e[i],o=e[i-1];if(r.empty?r.from<=o.to:r.from<o.to){let s=o.from,l=Math.max(r.to,o.to);if(i<=t)t--;e.splice(--i,2,r.anchor>r.head?A.range(l,s):A.range(s,l))}}return new A(e,t)}}function vM(e,t){for(let n of e.ranges)if(n.to>t)throw RangeError("Selection points outside of document")}var T0=0;class Z{constructor(e,t,n,i,r){this.combine=e,this.compareInput=t,this.compare=n,this.isStatic=i,this.id=T0++,this.default=e([]),this.extensions=typeof r=="function"?r(this):r}get reader(){return this}static define(e={}){return new Z(e.combine||((t)=>t),e.compareInput||((t,n)=>t===n),e.compare||(!e.combine?M0:(t,n)=>t===n),!!e.static,e.enables)}of(e){return new Hc([],this,0,e)}compute(e,t){if(this.isStatic)throw Error("Can't compute a static facet");return new Hc(e,this,1,t)}computeN(e,t){if(this.isStatic)throw Error("Can't compute a static facet");return new Hc(e,this,2,t)}from(e,t){if(!t)t=(n)=>n;return this.compute([e],(n)=>t(n.field(e)))}}function M0(e,t){return e==t||e.length==t.length&&e.every((n,i)=>n===t[i])}class Hc{constructor(e,t,n,i){this.dependencies=e,this.facet=t,this.type=n,this.value=i,this.id=T0++}dynamicSlot(e){var t;let n=this.value,i=this.facet.compareInput,r=this.id,o=e[r]>>1,s=this.type==2,l=!1,a=!1,u=[];for(let c of this.dependencies)if(c=="doc")l=!0;else if(c=="selection")a=!0;else if((((t=e[c.id])!==null&&t!==void 0?t:1)&1)==0)u.push(e[c.id]);return{create(c){return c.values[o]=n(c),1},update(c,f){if(l&&f.docChanged||a&&(f.docChanged||f.selection)||S0(c,u)){let d=n(c);if(s?!cM(d,c.values[o],i):!i(d,c.values[o]))return c.values[o]=d,1}return 0},reconfigure:(c,f)=>{let d,h=f.config.address[r];if(h!=null){let m=Cp(f,h);if(this.dependencies.every((b)=>b instanceof Z?f.facet(b)===c.facet(b):b instanceof kn?f.field(b,!1)==c.field(b,!1):!0)||(s?cM(d=n(c),m,i):i(d=n(c),m)))return c.values[o]=m,0}else d=n(c);return c.values[o]=d,1}}}get extension(){return this}}function cM(e,t,n){if(e.length!=t.length)return!1;for(let i=0;i<e.length;i++)if(!n(e[i],t[i]))return!1;return!0}function S0(e,t){let n=!1;for(let i of t)if(Vc(e,i)&1)n=!0;return n}function Q8(e,t,n){let i=n.map((a)=>e[a.id]),r=n.map((a)=>a.type),o=i.filter((a)=>!(a&1)),s=e[t.id]>>1;function l(a){let u=[];for(let c=0;c<i.length;c++){let f=Cp(a,i[c]);if(r[c]==2)for(let d of f)u.push(d);else u.push(f)}return t.combine(u)}return{create(a){for(let u of i)Vc(a,u);return a.values[s]=l(a),1},update(a,u){if(!S0(a,o))return 0;let c=l(a);if(t.compare(c,a.values[s]))return 0;return a.values[s]=c,1},reconfigure(a,u){let c=S0(a,i),f=u.config.facets[t.id],d=u.facet(t);if(f&&!c&&M0(n,f))return a.values[s]=d,0;let h=l(a);if(t.compare(h,d))return a.values[s]=d,0;return a.values[s]=h,1}}}var yp=Z.define({static:!0});class kn{constructor(e,t,n,i,r){this.id=e,this.createF=t,this.updateF=n,this.compareF=i,this.spec=r,this.provides=void 0}static define(e){let t=new kn(T0++,e.create,e.update,e.compare||((n,i)=>n===i),e);if(e.provide)t.provides=e.provide(t);return t}create(e){let t=e.facet(yp).find((n)=>n.field==this);return((t===null||t===void 0?void 0:t.create)||this.createF)(e)}slot(e){let t=e[this.id]>>1;return{create:(n)=>(n.values[t]=this.create(n),1),update:(n,i)=>{let r=n.values[t],o=this.updateF(r,i);if(this.compareF(r,o))return 0;return n.values[t]=o,1},reconfigure:(n,i)=>{let r=n.facet(yp),o=i.facet(yp),s;if((s=r.find((l)=>l.field==this))&&s!=o.find((l)=>l.field==this))return n.values[t]=s.create(n),1;if(i.config.address[this.id]!=null)return n.values[t]=i.field(this),0;return n.values[t]=this.create(n),1}}}init(e){return[this,yp.of({field:this,create:e})]}get extension(){return this}}var Hs={lowest:4,low:3,default:2,high:1,highest:0};function Ic(e){return(t)=>new N0(t,e)}var nr={highest:Ic(Hs.highest),high:Ic(Hs.high),default:Ic(Hs.default),low:Ic(Hs.low),lowest:Ic(Hs.lowest)};class N0{constructor(e,t){this.inner=e,this.prec=t}get extension(){return this}}class Ep{of(e){return new kp(this,e)}reconfigure(e){return Ep.reconfigure.of({compartment:this,extension:e})}get(e){return e.config.compartments.get(this)}}class kp{constructor(e,t){this.compartment=e,this.inner=t}get extension(){return this}}class _p{constructor(e,t,n,i,r,o){this.base=e,this.compartments=t,this.dynamicSlots=n,this.address=i,this.staticValues=r,this.facets=o,this.statusTemplate=[];while(this.statusTemplate.length<n.length)this.statusTemplate.push(0)}staticFacet(e){let t=this.address[e.id];return t==null?e.default:this.staticValues[t>>1]}static resolve(e,t,n){let i=[],r=Object.create(null),o=new Map;for(let f of J8(e,t,o))if(f instanceof kn)i.push(f);else(r[f.facet.id]||(r[f.facet.id]=[])).push(f);let s=Object.create(null),l=[],a=[];for(let f of i)s[f.id]=a.length<<1,a.push((d)=>f.slot(d));let u=n===null||n===void 0?void 0:n.config.facets;for(let f in r){let d=r[f],h=d[0].facet,m=u&&u[f]||[];if(d.every((b)=>b.type==0))if(s[h.id]=l.length<<1|1,M0(m,d))l.push(n.facet(h));else{let b=h.combine(d.map((x)=>x.value));l.push(n&&h.compare(b,n.facet(h))?n.facet(h):b)}else{for(let b of d)if(b.type==0)s[b.id]=l.length<<1|1,l.push(b.value);else s[b.id]=a.length<<1,a.push((x)=>b.dynamicSlot(x));s[h.id]=a.length<<1,a.push((b)=>Q8(b,h,d))}}let c=a.map((f)=>f(s));return new _p(e,o,c,s,l,r)}}function J8(e,t,n){let i=[[],[],[],[],[]],r=new Map;function o(s,l){let a=r.get(s);if(a!=null){if(a<=l)return;let u=i[a].indexOf(s);if(u>-1)i[a].splice(u,1);if(s instanceof kp)n.delete(s.compartment)}if(r.set(s,l),Array.isArray(s))for(let u of s)o(u,l);else if(s instanceof kp){if(n.has(s.compartment))throw RangeError("Duplicate use of compartment in extensions");let u=t.get(s.compartment)||s.inner;n.set(s.compartment,u),o(u,l)}else if(s instanceof N0)o(s.inner,s.prec);else if(s instanceof kn){if(i[l].push(s),s.provides)o(s.provides,l)}else if(s instanceof Hc){if(i[l].push(s),s.facet.extensions)o(s.facet.extensions,Hs.default)}else{let u=s.extension;if(!u)throw Error(`Unrecognized extension value in extension set (${s}).`);if(u==s)throw Error(`Unrecognized extension value in extension set (${s}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);o(u,l)}}return o(e,Hs.default),i.reduce((s,l)=>s.concat(l))}function Vc(e,t){if(t&1)return 2;let n=t>>1,i=e.status[n];if(i==4)throw Error("Cyclic dependency between fields and/or facets");if(i&2)return i;e.status[n]=4;let r=e.computeSlot(e,e.config.dynamicSlots[n]);return e.status[n]=2|r}function Cp(e,t){return t&1?e.config.staticValues[t>>1]:e.values[t>>1]}var bM=Z.define(),k0=Z.define({combine:(e)=>e.some((t)=>t),static:!0}),yM=Z.define({combine:(e)=>e.length?e[0]:void 0,static:!0}),xM=Z.define(),wM=Z.define(),SM=Z.define(),kM=Z.define({combine:(e)=>e.length?e[0]:!1});class _n{constructor(e,t){this.type=e,this.value=t}static define(){return new _M}}class _M{of(e){return new _n(this,e)}}class CM{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 CM(e.map||((t)=>t))}static mapEffects(e,t){if(!e.length)return e;let n=[];for(let i of e){let r=i.map(t);if(r)n.push(r)}return n}}ye.reconfigure=ye.define();ye.appendConfig=ye.define();class Je{constructor(e,t,n,i,r,o){if(this.startState=e,this.changes=t,this.selection=n,this.effects=i,this.annotations=r,this.scrollIntoView=o,this._doc=null,this._state=null,n)vM(n,t.newLength);if(!r.some((s)=>s.type==Je.time))this.annotations=r.concat(Je.time.of(Date.now()))}static create(e,t,n,i,r,o){return new Je(e,t,n,i,r,o)}get newDoc(){return this._doc||(this._doc=this.changes.apply(this.startState.doc))}get newSelection(){return this.selection||this.startState.selection.map(this.changes)}get state(){if(!this._state)this.startState.applyTransaction(this);return this._state}annotation(e){for(let t of this.annotations)if(t.type==e)return t.value;return}get docChanged(){return!this.changes.empty}get reconfigured(){return this.startState.config!=this.state.config}isUserEvent(e){let t=this.annotation(Je.userEvent);return!!(t&&(t==e||t.length>e.length&&t.slice(0,e.length)==e&&t[e.length]=="."))}}Je.time=_n.define();Je.userEvent=_n.define();Je.addToHistory=_n.define();Je.remote=_n.define();function Z8(e,t){let n=[];for(let i=0,r=0;;){let o,s;if(i<e.length&&(r==t.length||t[r]>=e[i]))o=e[i++],s=e[i++];else if(r<t.length)o=t[r++],s=t[r++];else return n;if(!n.length||n[n.length-1]<o)n.push(o,s);else if(n[n.length-1]<s)n[n.length-1]=s}}function EM(e,t,n){var i;let r,o,s;if(n)r=t.changes,o=rt.empty(t.changes.length),s=e.changes.compose(t.changes);else r=t.changes.map(e.changes),o=e.changes.mapDesc(t.changes,!0),s=e.changes.compose(r);return{changes:s,selection:t.selection?t.selection.map(o):(i=e.selection)===null||i===void 0?void 0:i.map(r),effects:ye.mapEffects(e.effects,r).concat(ye.mapEffects(t.effects,o)),annotations:e.annotations.length?e.annotations.concat(t.annotations):t.annotations,scrollIntoView:e.scrollIntoView||t.scrollIntoView}}function _0(e,t,n){let i=t.selection,r=Ta(t.annotations);if(t.userEvent)r=r.concat(Je.userEvent.of(t.userEvent));return{changes:t.changes instanceof rt?t.changes:rt.of(t.changes||[],n,e.facet(yM)),selection:i&&(i instanceof A?i:A.single(i.anchor,i.head)),effects:Ta(t.effects),annotations:r,scrollIntoView:!!t.scrollIntoView}}function OM(e,t,n){let i=_0(e,t.length?t[0]:{},e.doc.length);if(t.length&&t[0].filter===!1)n=!1;for(let o=1;o<t.length;o++){if(t[o].filter===!1)n=!1;let s=!!t[o].sequential;i=EM(i,_0(e,t[o],s?i.changes.newLength:e.doc.length),s)}let r=Je.create(e,i.changes,i.selection,i.effects,i.annotations,i.scrollIntoView);return t6(n?e6(r):r)}function e6(e){let t=e.startState,n=!0;for(let r of t.facet(xM)){let o=r(e);if(o===!1){n=!1;break}if(Array.isArray(o))n=n===!0?o:Z8(n,o)}if(n!==!0){let r,o;if(n===!1)o=e.changes.invertedDesc,r=rt.empty(t.doc.length);else{let s=e.changes.filter(n);r=s.changes,o=s.filtered.mapDesc(s.changes).invertedDesc}e=Je.create(t,r,e.selection&&e.selection.map(o),ye.mapEffects(e.effects,o),e.annotations,e.scrollIntoView)}let i=t.facet(wM);for(let r=i.length-1;r>=0;r--){let o=i[r](e);if(o instanceof Je)e=o;else if(Array.isArray(o)&&o.length==1&&o[0]instanceof Je)e=o[0];else e=OM(t,Ta(o),!1)}return e}function t6(e){let t=e.startState,n=t.facet(SM),i=e;for(let r=n.length-1;r>=0;r--){let o=n[r](e);if(o&&Object.keys(o).length)i=EM(i,_0(t,o,e.changes.newLength),!0)}return i==e?e:Je.create(t,e.changes,e.selection,i.effects,i.annotations,i.scrollIntoView)}var n6=[];function Ta(e){return e==null?n6:Array.isArray(e)?e:[e]}var $n=function(e){return e[e.Word=0]="Word",e[e.Space=1]="Space",e[e.Other=2]="Other",e}($n||($n={})),i6=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/,C0;try{C0=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch(e){}function r6(e){if(C0)return C0.test(e);for(let t=0;t<e.length;t++){let n=e[t];if(/\w/.test(n)||n>"€"&&(n.toUpperCase()!=n.toLowerCase()||i6.test(n)))return!0}return!1}function o6(e){return(t)=>{if(!/\S/.test(t))return $n.Space;if(r6(t))return $n.Word;for(let n=0;n<e.length;n++)if(t.indexOf(e[n])>-1)return $n.Word;return $n.Other}}class pe{constructor(e,t,n,i,r,o){if(this.config=e,this.doc=t,this.selection=n,this.values=i,this.status=e.statusTemplate.slice(),this.computeSlot=r,o)o._state=this;for(let s=0;s<this.config.dynamicSlots.length;s++)Vc(this,s<<1);this.computeSlot=null}field(e,t=!0){let n=this.config.address[e.id];if(n==null){if(t)throw RangeError("Field is not present in this state");return}return Vc(this,n),Cp(this,n)}update(...e){return OM(this,e,!0)}applyTransaction(e){let t=this.config,{base:n,compartments:i}=t;for(let s of e.effects)if(s.is(Ep.reconfigure)){if(t)i=new Map,t.compartments.forEach((l,a)=>i.set(a,l)),t=null;i.set(s.value.compartment,s.value.extension)}else if(s.is(ye.reconfigure))t=null,n=s.value;else if(s.is(ye.appendConfig))t=null,n=Ta(n).concat(s.value);let r;if(!t)t=_p.resolve(n,i,this),r=new pe(t,this.doc,this.selection,t.dynamicSlots.map(()=>null),(l,a)=>a.reconfigure(l,this),null).values;else r=e.startState.values.slice();let o=e.startState.facet(k0)?e.newSelection:e.newSelection.asSingle();new pe(t,e.newDoc,o,r,(s,l)=>l.update(s,e),e)}replaceSelection(e){if(typeof e=="string")e=this.toText(e);return this.changeByRange((t)=>({changes:{from:t.from,to:t.to,insert:e},range:A.cursor(t.from+e.length,-1)}))}changeByRange(e){let t=this.selection,n=e(t.ranges[0]),i=this.changes(n.changes),r=[n.range],o=Ta(n.effects);for(let s=1;s<t.ranges.length;s++){let l=e(t.ranges[s]),a=this.changes(l.changes),u=a.map(i);for(let f=0;f<s;f++)r[f]=r[f].map(u);let c=i.mapDesc(a,!0);r.push(l.range.map(c)),i=i.compose(u),o=ye.mapEffects(o,u).concat(ye.mapEffects(Ta(l.effects),c))}return{changes:i,selection:A.create(r,t.mainIndex),effects:o}}changes(e=[]){if(e instanceof rt)return e;return rt.of(e,this.doc.length,this.facet(pe.lineSeparator))}toText(e){return he.of(e.split(this.facet(pe.lineSeparator)||y0))}sliceDoc(e=0,t=this.doc.length){return this.doc.sliceString(e,t,this.lineBreak)}facet(e){let t=this.config.address[e.id];if(t==null)return e.default;return Vc(this,t),Cp(this,t)}toJSON(e){let t={doc:this.sliceDoc(),selection:this.selection.toJSON()};if(e)for(let n in e){let i=e[n];if(i instanceof kn&&this.config.address[i.id]!=null)t[n]=i.spec.toJSON(this.field(e[n]),this)}return t}static fromJSON(e,t={},n){if(!e||typeof e.doc!="string")throw RangeError("Invalid JSON representation for EditorState");let i=[];if(n){for(let r in n)if(Object.prototype.hasOwnProperty.call(e,r)){let o=n[r],s=e[r];i.push(o.init((l)=>o.spec.fromJSON(s,l)))}}return pe.create({doc:e.doc,selection:A.fromJSON(e.selection),extensions:t.extensions?i.concat([t.extensions]):i})}static create(e={}){let t=_p.resolve(e.extensions||[],new Map),n=e.doc instanceof he?e.doc:he.of((e.doc||"").split(t.staticFacet(pe.lineSeparator)||y0)),i=!e.selection?A.single(0):e.selection instanceof A?e.selection:A.single(e.selection.anchor,e.selection.head);if(vM(i,n.length),!t.staticFacet(k0))i=i.asSingle();return new pe(t,n,i,t.dynamicSlots.map(()=>null),(r,o)=>o.create(r),null)}get tabSize(){return this.facet(pe.tabSize)}get lineBreak(){return this.facet(pe.lineSeparator)||`
28
+ `}get readOnly(){return this.facet(kM)}phrase(e,...t){for(let n of this.facet(pe.phrases))if(Object.prototype.hasOwnProperty.call(n,e)){e=n[e];break}if(t.length)e=e.replace(/\$(\$|\d*)/g,(n,i)=>{if(i=="$")return"$";let r=+(i||1);return!r||r>t.length?n:t[r-1]});return e}languageDataAt(e,t,n=-1){let i=[];for(let r of this.facet(bM))for(let o of r(this,t,n))if(Object.prototype.hasOwnProperty.call(o,e))i.push(o[e]);return i}charCategorizer(e){let t=this.languageDataAt("wordChars",e);return o6(t.length?t[0]:"")}wordAt(e){let{text:t,from:n,length:i}=this.doc.lineAt(e),r=this.charCategorizer(e),o=e-n,s=e-n;while(o>0){let l=wt(t,o,!1);if(r(t.slice(l,o))!=$n.Word)break;o=l}while(s<i){let l=wt(t,s);if(r(t.slice(s,l))!=$n.Word)break;s=l}return o==s?null:A.range(o+n,s+n)}}pe.allowMultipleSelections=k0;pe.tabSize=Z.define({combine:(e)=>e.length?e[0]:4});pe.lineSeparator=yM;pe.readOnly=kM;pe.phrases=Z.define({compare(e,t){let n=Object.keys(e),i=Object.keys(t);return n.length==i.length&&n.every((r)=>e[r]==t[r])}});pe.languageData=bM;pe.changeFilter=xM;pe.transactionFilter=wM;pe.transactionExtender=SM;Ep.reconfigure=ye.define();function Da(e,t,n={}){let i={};for(let r of e)for(let o of Object.keys(r)){let s=r[o],l=i[o];if(l===void 0)i[o]=s;else if(l===s||s===void 0);else if(Object.hasOwnProperty.call(n,o))i[o]=n[o](l,s);else throw Error("Config merge conflict for field "+o)}for(let r in t)if(i[r]===void 0)i[r]=t[r];return i}class gi{eq(e){return this==e}range(e,t=e){return Uc.create(e,t,this)}}gi.prototype.startSide=gi.prototype.endSide=0;gi.prototype.point=!1;gi.prototype.mapMode=qt.TrackDel;function D0(e,t){return e==t||e.constructor==t.constructor&&e.eq(t)}class Uc{constructor(e,t,n){this.from=e,this.to=t,this.value=n}static create(e,t,n){return new Uc(e,t,n)}}function E0(e,t){return e.from-t.from||e.value.startSide-t.value.startSide}class L0{constructor(e,t,n,i){this.from=e,this.to=t,this.value=n,this.maxPoint=i}get length(){return Oa(this.to)}findIndex(e,t,n,i=0){let r=n?this.to:this.from;for(let o=i,s=r.length;;){if(o==s)return o;let l=o+s>>1,a=r[l]-e||(n?this.value[l].endSide:this.value[l].startSide)-t;if(l==o)return a>=0?o:s;if(a>=0)s=l;else o=l+1}}between(e,t,n,i){for(let r=this.findIndex(t,-1e9,!0),o=this.findIndex(n,1e9,!1,r);r<o;r++)if(i(this.from[r]+e,this.to[r]+e,this.value[r])===!1)return!1}map(e,t,n,i,r){let o=[],s=[],l=[],a=-1,u=-1;e:for(let c=0;c<this.value.length;c++){let f=this.value[c],d=this.from[c]+e,h=this.to[c]+e,m,b;if(d==h){let x=t.mapPos(d,f.startSide,f.mapMode);if(x==null)continue;if(m=b=x,f.startSide!=f.endSide){if(b=t.mapPos(d,f.endSide),b<m)continue}}else if(m=t.mapPos(d,f.startSide),b=t.mapPos(h,f.endSide),m>b||m==b&&f.startSide>0&&f.endSide<=0)continue;if((b-m||f.endSide-f.startSide)<0)continue;if(a<0)a=m;if(f.point)u=Math.max(u,b-m);if((m-n||f.startSide-i)>=0)o.push(f),s.push(m-a),l.push(b-a),n=b,i=f.endSide;else{if(m==b)for(let x=o.length;x>0;x--){if((m-(l[x-1]+a)||f.startSide-o[x-1].endSide)>=0){o.splice(x,0,f),s.splice(x,0,m-a),l.splice(x,0,b-a);continue e}if((m-(s[x-1]+a)||f.endSide-o[x-1].startSide)>0)break}r(m,b,f)}}return{mapped:o.length?new L0(s,l,o,u):null,pos:a}}}class ge{constructor(e,t,n,i){this.chunkPos=e,this.chunk=t,this.nextLayer=n,this.maxPoint=i}static create(e,t,n,i){return new ge(e,t,n,i)}get length(){let e=this.chunk.length-1;return e<0?0:Math.max(this.chunkEnd(e),this.nextLayer.length)}get size(){if(this.isEmpty)return 0;let e=this.nextLayer.size;for(let t of this.chunk)e+=t.value.length;return e}chunkEnd(e){return this.chunkPos[e]+this.chunk[e].length}update(e){let{add:t=[],sort:n=!1,filterFrom:i=0,filterTo:r=this.length}=e,o=e.filter;if(t.length==0&&!o)return this;if(n)t=t.slice().sort(E0);if(this.isEmpty)return t.length?ge.of(t):this;let s=new z0(this,null,-1).goto(0),l=0,a=[],u=new Vs;while(s.value||l<t.length)if(l<t.length&&(s.from-t[l].from||s.startSide-t[l].value.startSide)>=0){let c=t[l++];if(!u.addInner(c.from,c.to,c.value,!1))a.push(c)}else if(s.rangeIndex==1&&s.chunkIndex<this.chunk.length&&(l==t.length||this.chunkEnd(s.chunkIndex)<t[l].from)&&(!o||i>this.chunkEnd(s.chunkIndex)||r<this.chunkPos[s.chunkIndex])&&u.addChunk(this.chunkPos[s.chunkIndex],this.chunk[s.chunkIndex]))s.nextChunk();else{if(!o||i>s.to||r<s.from||o(s.from,s.to,s.value)){if(!u.addInner(s.from,s.to,s.value,!1))a.push(Uc.create(s.from,s.to,s.value))}s.next()}return u.finishInner(this.nextLayer.isEmpty&&!a.length?ge.empty:this.nextLayer.update({add:a,filter:o,filterFrom:i,filterTo:r}))}map(e){if(e.empty||this.isEmpty)return this;let t=[],n=[],i=-1,r,o=(l,a,u)=>{if(!r)r=new Vs;r.addRange(l,a,u,!1)};for(let l=0;l<this.chunk.length;l++){let a=this.chunkPos[l],u=this.chunk[l],c=e.touchesRange(a,a+u.length);if(c===!1)i=Math.max(i,u.maxPoint),t.push(u),n.push(e.mapPos(a));else if(c===!0){let[f,d]=!t.length?[-1,-1]:[Oa(n)+Oa(t).length,Oa(Oa(t).value).endSide],{mapped:h,pos:m}=u.map(a,e,f,d,o);if(h)i=Math.max(i,h.maxPoint),t.push(h),n.push(m)}}let s=this.nextLayer.map(e);if(r)s=r.finishInner(s);return t.length==0?s:new ge(n,t,s||ge.empty,i)}between(e,t,n){if(this.isEmpty)return;for(let i=0;i<this.chunk.length;i++){let r=this.chunkPos[i],o=this.chunk[i];if(t>=r&&e<=r+o.length&&o.between(r,e-r,t-r,n)===!1)return}this.nextLayer.between(e,t,n)}iter(e=0){return Kc.from([this]).goto(e)}get isEmpty(){return this.nextLayer==this}static iter(e,t=0){return Kc.from(e).goto(t)}static compare(e,t,n,i,r=-1){let o=e.filter((c)=>c.maxPoint>0||!c.isEmpty&&c.maxPoint>=r),s=t.filter((c)=>c.maxPoint>0||!c.isEmpty&&c.maxPoint>=r),l=fM(o,s,n),a=new Ra(o,l,r),u=new Ra(s,l,r);if(n.iterGaps((c,f,d)=>dM(a,c,u,f,d,i)),n.empty&&n.length==0)dM(a,0,u,0,0,i)}static eq(e,t,n=0,i){if(i==null)i=999999999;let r=e.filter((u)=>!u.isEmpty&&t.indexOf(u)<0),o=t.filter((u)=>!u.isEmpty&&e.indexOf(u)<0);if(r.length!=o.length)return!1;if(!r.length)return!0;let s=fM(r,o),l=new Ra(r,s,0).goto(n),a=new Ra(o,s,0).goto(n);for(;;){if(l.to!=a.to||!O0(l.active,a.active)||l.point&&(!a.point||!D0(l.point,a.point)))return!1;if(l.to>i)return!0;l.next(),a.next()}}static spans(e,t,n,i,r=-1){let o=new Ra(e,null,r).goto(t),s=t,l=o.openStart;for(;;){let a=Math.min(o.to,n);if(o.point){let u=o.activeForPoint(o.to),c=o.pointFrom<t?u.length+1:o.point.startSide<0?u.length:Math.min(u.length,l);i.point(s,a,o.point,u,c,o.pointRank),l=Math.min(o.openEnd(a),u.length)}else if(a>s)i.span(s,a,o.active,l),l=o.openEnd(a);if(o.to>n)return l+(o.point&&o.to>n?1:0);s=o.to,o.next()}}static of(e,t=!1){let n=new Vs;for(let i of e instanceof Uc?[e]:t?s6(e):e)n.add(i.from,i.to,i.value);return n.finish()}static join(e){if(!e.length)return ge.empty;let t=Oa(e);for(let n=e.length-2;n>=0;n--)for(let i=e[n];i!=ge.empty;i=i.nextLayer)t=new ge(i.chunkPos,i.chunk,t,Math.max(i.maxPoint,t.maxPoint));return t}}ge.empty=new ge([],[],null,-1);function Oa(e){return e[e.length-1]}function s6(e){if(e.length>1)for(let t=e[0],n=1;n<e.length;n++){let i=e[n];if(E0(t,i)>0)return e.slice().sort(E0);t=i}return e}ge.empty.nextLayer=ge.empty;class Vs{finishChunk(e){if(this.chunks.push(new L0(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,n){this.addRange(e,t,n,!0)}addRange(e,t,n,i){if(!this.addInner(e,t,n,i))(this.nextLayer||(this.nextLayer=new Vs)).addRange(e,t,n,i)}addInner(e,t,n,i){let r=e-this.lastTo||n.startSide-this.last.endSide;if(i&&r<=0&&(e-this.lastFrom||n.startSide-this.last.startSide)<0)throw Error("Ranges must be added sorted by `from` position and `startSide`");if(r<0)return!1;if(this.from.length==250)this.finishChunk(!0);if(this.chunkStart<0)this.chunkStart=e;if(this.from.push(e-this.chunkStart),this.to.push(t-this.chunkStart),this.last=n,this.lastFrom=e,this.lastTo=t,this.value.push(n),n.point)this.maxPoint=Math.max(this.maxPoint,t-e);return!0}addChunk(e,t){if((e-this.lastTo||t.value[0].startSide-this.last.endSide)<0)return!1;if(this.from.length)this.finishChunk(!0);this.setMaxPoint=Math.max(this.setMaxPoint,t.maxPoint),this.chunks.push(t),this.chunkPos.push(e);let n=t.value.length-1;return this.last=t.value[n],this.lastFrom=t.from[n]+e,this.lastTo=t.to[n]+e,!0}finish(){return this.finishInner(ge.empty)}finishInner(e){if(this.from.length)this.finishChunk(!1);if(this.chunks.length==0)return e;let t=ge.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(e):e,this.setMaxPoint);return this.from=null,t}}function fM(e,t,n){let i=new Map;for(let o of e)for(let s=0;s<o.chunk.length;s++)if(o.chunk[s].maxPoint<=0)i.set(o.chunk[s],o.chunkPos[s]);let r=new Set;for(let o of t)for(let s=0;s<o.chunk.length;s++){let l=i.get(o.chunk[s]);if(l!=null&&(n?n.mapPos(l):l)==o.chunkPos[s]&&!(n===null||n===void 0?void 0:n.touchesRange(l,l+o.chunk[s].length)))r.add(o.chunk[s])}return r}class z0{constructor(e,t,n,i=0){this.layer=e,this.skip=t,this.minPoint=n,this.rank=i}get startSide(){return this.value?this.value.startSide:0}get endSide(){return this.value?this.value.endSide:0}goto(e,t=-1e9){return this.chunkIndex=this.rangeIndex=0,this.gotoInner(e,t,!1),this}gotoInner(e,t,n){while(this.chunkIndex<this.layer.chunk.length){let i=this.layer.chunk[this.chunkIndex];if(!(this.skip&&this.skip.has(i)||this.layer.chunkEnd(this.chunkIndex)<e||i.maxPoint<this.minPoint))break;this.chunkIndex++,n=!1}if(this.chunkIndex<this.layer.chunk.length){let i=this.layer.chunk[this.chunkIndex].findIndex(e-this.layer.chunkPos[this.chunkIndex],t,!0);if(!n||this.rangeIndex<i)this.setRangeIndex(i)}this.next()}forward(e,t){if((this.to-e||this.endSide-t)<0)this.gotoInner(e,t,!0)}next(){for(;;)if(this.chunkIndex==this.layer.chunk.length){this.from=this.to=1e9,this.value=null;break}else{let e=this.layer.chunkPos[this.chunkIndex],t=this.layer.chunk[this.chunkIndex],n=e+t.from[this.rangeIndex];if(this.from=n,this.to=e+t.to[this.rangeIndex],this.value=t.value[this.rangeIndex],this.setRangeIndex(this.rangeIndex+1),this.minPoint<0||this.value.point&&this.to-this.from>=this.minPoint)break}}setRangeIndex(e){if(e==this.layer.chunk[this.chunkIndex].value.length){if(this.chunkIndex++,this.skip)while(this.chunkIndex<this.layer.chunk.length&&this.skip.has(this.layer.chunk[this.chunkIndex]))this.chunkIndex++;this.rangeIndex=0}else this.rangeIndex=e}nextChunk(){this.chunkIndex++,this.rangeIndex=0,this.next()}compare(e){return this.from-e.from||this.startSide-e.startSide||this.rank-e.rank||this.to-e.to||this.endSide-e.endSide}}class Kc{constructor(e){this.heap=e}static from(e,t=null,n=-1){let i=[];for(let r=0;r<e.length;r++)for(let o=e[r];!o.isEmpty;o=o.nextLayer)if(o.maxPoint>=n)i.push(new z0(o,t,n,r));return i.length==1?i[0]:new Kc(i)}get startSide(){return this.value?this.value.startSide:0}goto(e,t=-1e9){for(let n of this.heap)n.goto(e,t);for(let n=this.heap.length>>1;n>=0;n--)b0(this.heap,n);return this.next(),this}forward(e,t){for(let n of this.heap)n.forward(e,t);for(let n=this.heap.length>>1;n>=0;n--)b0(this.heap,n);if((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];if(this.from=e.from,this.to=e.to,this.value=e.value,this.rank=e.rank,e.value)e.next();b0(this.heap,0)}}}function b0(e,t){for(let n=e[t];;){let i=(t<<1)+1;if(i>=e.length)break;let r=e[i];if(i+1<e.length&&r.compare(e[i+1])>=0)r=e[i+1],i++;if(n.compare(r)<0)break;e[i]=n,e[t]=r,t=i}}class Ra{constructor(e,t,n){this.minPoint=n,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=Kc.from(e,t,n)}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){while(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){xp(this.active,e),xp(this.activeTo,e),xp(this.activeRank,e),this.minActive=hM(this.active,this.activeTo)}addActive(e){let t=0,{value:n,to:i,rank:r}=this.cursor;while(t<this.activeRank.length&&(r-this.activeRank[t]||i-this.activeTo[t])>0)t++;if(wp(this.active,t,n),wp(this.activeTo,t,i),wp(this.activeRank,t,r),e)wp(e,t,this.cursor.from);this.minActive=hM(this.active,this.activeTo)}next(){let e=this.to,t=this.point;this.point=null;let n=this.openStart<0?[]:null;for(;;){let i=this.minActive;if(i>-1&&(this.activeTo[i]-this.cursor.from||this.active[i].endSide-this.cursor.startSide)<0){if(this.activeTo[i]>e){this.to=this.activeTo[i],this.endSide=this.active[i].endSide;break}if(this.removeActive(i),n)xp(n,i)}else if(!this.cursor.value){this.to=this.endSide=1e9;break}else if(this.cursor.from>e){this.to=this.cursor.from,this.endSide=this.cursor.startSide;break}else{let r=this.cursor.value;if(!r.point)this.addActive(n),this.cursor.next();else if(t&&this.cursor.to==this.to&&this.cursor.from<this.cursor.to)this.cursor.next();else{this.point=r,this.pointFrom=this.cursor.from,this.pointRank=this.cursor.rank,this.to=this.cursor.to,this.endSide=r.endSide,this.cursor.next(),this.forward(this.to,this.endSide);break}}}if(n){this.openStart=0;for(let i=n.length-1;i>=0&&n[i]<e;i--)this.openStart++}}activeForPoint(e){if(!this.active.length)return this.active;let t=[];for(let n=this.active.length-1;n>=0;n--){if(this.activeRank[n]<this.pointRank)break;if(this.activeTo[n]>e||this.activeTo[n]==e&&this.active[n].endSide>=this.point.endSide)t.push(this.active[n])}return t.reverse()}openEnd(e){let t=0;for(let n=this.activeTo.length-1;n>=0&&this.activeTo[n]>e;n--)t++;return t}}function dM(e,t,n,i,r,o){e.goto(t),n.goto(i);let s=i+r,l=i,a=i-t,u=!!o.boundChange;for(let c=!1;;){let f=e.to+a-n.to,d=f||e.endSide-n.endSide,h=d<0?e.to+a:n.to,m=Math.min(h,s);if(e.point||n.point){if(!(e.point&&n.point&&D0(e.point,n.point)&&O0(e.activeForPoint(e.to),n.activeForPoint(n.to))))o.comparePoint(l,m,e.point,n.point);c=!1}else{if(c)o.boundChange(l),c=!1;if(m>l&&!O0(e.active,n.active))o.compareRange(l,m,e.active,n.active);if(u&&m<s&&(f||e.openEnd(h)!=n.openEnd(h)))c=!0}if(h>s)break;if(l=h,d<=0)e.next();if(d>=0)n.next()}}function O0(e,t){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!=t[n]&&!D0(e[n],t[n]))return!1;return!0}function xp(e,t){for(let n=t,i=e.length-1;n<i;n++)e[n]=e[n+1];e.pop()}function wp(e,t,n){for(let i=e.length-1;i>=t;i--)e[i+1]=e[i];e[t]=n}function hM(e,t){let n=-1,i=1e9;for(let r=0;r<t.length;r++)if((t[r]-i||e[r].endSide-e[n].endSide)<0)n=r,i=t[r];return n}function Us(e,t,n=e.length){let i=0;for(let r=0;r<n&&r<e.length;)if(e.charCodeAt(r)==9)i+=t-i%t,r++;else i++,r=wt(e,r);return i}function RM(e,t,n,i){for(let r=0,o=0;;){if(o>=t)return r;if(r==e.length)break;o+=e.charCodeAt(r)==9?n-o%n:1,r=wt(e,r)}return i===!0?-1:e.length}var AM=typeof Symbol>"u"?"__"+"ͼ":Symbol.for("ͼ"),B0=typeof Symbol>"u"?"__styleSet"+Math.floor(Math.random()*1e8):Symbol("styleSet"),TM=typeof globalThis<"u"?globalThis:typeof window<"u"?window:{};class vi{constructor(e,t){this.rules=[];let{finish:n}=t||{};function i(o){return/^@/.test(o)?[o]:o.split(/,\s*/)}function r(o,s,l,a){let u=[],c=/^@(\w+)\b/.exec(o[0]),f=c&&c[1]=="keyframes";if(c&&s==null)return l.push(o[0]+";");for(let d in s){let h=s[d];if(/&/.test(d))r(d.split(/,\s*/).map((m)=>o.map((b)=>m.replace(/&/,b))).reduce((m,b)=>m.concat(b)),h,l);else if(h&&typeof h=="object"){if(!c)throw RangeError("The value of a property ("+d+") should be a primitive value.");r(i(d),h,u,f)}else if(h!=null)u.push(d.replace(/_.*/,"").replace(/[A-Z]/g,(m)=>"-"+m.toLowerCase())+": "+h+";")}if(u.length||f)l.push((n&&!c&&!a?o.map(n):o).join(", ")+" {"+u.join(" ")+"}")}for(let o in e)r(i(o),e[o],this.rules)}getRules(){return this.rules.join(`
29
+ `)}static newName(){let e=TM[AM]||1;return TM[AM]=e+1,"ͼ"+e.toString(36)}static mount(e,t,n){let i=e[B0],r=n&&n.nonce;if(!i)i=new NM(e,r);else if(r)i.setNonce(r);i.mount(Array.isArray(t)?t:[t],e)}}var MM=new Map;class NM{constructor(e,t){let n=e.ownerDocument||e,i=n.defaultView;if(!e.head&&e.adoptedStyleSheets&&i.CSSStyleSheet){let r=MM.get(n);if(r)return e[B0]=r;this.sheet=new i.CSSStyleSheet,MM.set(n,this)}else if(this.styleTag=n.createElement("style"),t)this.styleTag.setAttribute("nonce",t);this.modules=[],e[B0]=this}mount(e,t){let n=this.sheet,i=0,r=0,o=!1;for(let s=0;s<e.length;s++){let l=e[s],a=this.modules.indexOf(l);if(a<r&&a>-1)this.modules.splice(a,1),o=!0,r--,a=-1;if(a==-1){if(this.modules.splice(r++,0,l),o=!0,n)for(let u=0;u<l.rules.length;u++)n.insertRule(l.rules[u],i++)}else{while(r<a)i+=this.modules[r++].rules.length;i+=l.rules.length,r++}}if(n){if(t.adoptedStyleSheets.indexOf(this.sheet)<0)t.adoptedStyleSheets=[this.sheet,...t.adoptedStyleSheets]}else{if(o){let l="";for(let a=0;a<this.modules.length;a++)l+=this.modules[a].getRules()+`
30
+ `;this.styleTag.textContent=l}let s=t.head||t;if(this.styleTag.parentNode!=s)s.insertBefore(this.styleTag,s.firstChild)}}setNonce(e){if(this.styleTag&&this.styleTag.getAttribute("nonce")!=e)this.styleTag.setAttribute("nonce",e)}}var Pr={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},La={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},l6=typeof navigator<"u"&&/Mac/.test(navigator.platform),a6=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(Xe=0;Xe<10;Xe++)Pr[48+Xe]=Pr[96+Xe]=String(Xe);var Xe;for(Xe=1;Xe<=24;Xe++)Pr[Xe+111]="F"+Xe;var Xe;for(Xe=65;Xe<=90;Xe++)Pr[Xe]=String.fromCharCode(Xe+32),La[Xe]=String.fromCharCode(Xe);var Xe;for(jc in Pr)if(!La.hasOwnProperty(jc))La[jc]=Pr[jc];var jc;function DM(e){var t=l6&&e.metaKey&&e.shiftKey&&!e.ctrlKey&&!e.altKey||a6&&e.shiftKey&&e.key&&e.key.length==1||e.key=="Unidentified",n=!t&&e.key||(e.shiftKey?La:Pr)[e.keyCode]||e.key||"Unidentified";if(n=="Esc")n="Escape";if(n=="Del")n="Delete";if(n=="Left")n="ArrowLeft";if(n=="Up")n="ArrowUp";if(n=="Right")n="ArrowRight";if(n=="Down")n="ArrowDown";return n}var $t=typeof navigator<"u"?navigator:{userAgent:"",vendor:"",platform:""},j0=typeof document<"u"?document:{documentElement:{style:{}}},F0=/Edge\/(\d+)/.exec($t.userAgent),u2=/MSIE \d/.test($t.userAgent),q0=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec($t.userAgent),$p=!!(u2||q0||F0),LM=!$p&&/gecko\/(\d+)/i.test($t.userAgent),P0=!$p&&/Chrome\/(\d+)/.exec($t.userAgent),zM="webkitFontSmoothing"in j0.documentElement.style,$0=!$p&&/Apple Computer/.test($t.vendor),BM=$0&&(/Mobile\/\w+/.test($t.userAgent)||$t.maxTouchPoints>2),j={mac:BM||/Mac/.test($t.platform),windows:/Win/.test($t.platform),linux:/Linux|X11/.test($t.platform),ie:$p,ie_version:u2?j0.documentMode||6:q0?+q0[1]:F0?+F0[1]:0,gecko:LM,gecko_version:LM?+(/Firefox\/(\d+)/.exec($t.userAgent)||[0,0])[1]:0,chrome:!!P0,chrome_version:P0?+P0[1]:0,ios:BM,android:/Android\b/.test($t.userAgent),webkit:zM,webkit_version:zM?+(/\bAppleWebKit\/(\d+)/.exec($t.userAgent)||[0,0])[1]:0,safari:$0,safari_version:$0?+(/\bVersion\/(\d+(\.\d+)?)/.exec($t.userAgent)||[0,0])[1]:0,tabSize:j0.documentElement.style.tabSize!=null?"tab-size":"-moz-tab-size"};function ax(e,t){for(let n in e)if(n=="class"&&t.class)t.class+=" "+e.class;else if(n=="style"&&t.style)t.style+=";"+e.style;else t[n]=e[n];return t}var Hp=Object.create(null);function ux(e,t,n){if(e==t)return!0;if(!e)e=Hp;if(!t)t=Hp;let i=Object.keys(e),r=Object.keys(t);if(i.length-(n&&i.indexOf(n)>-1?1:0)!=r.length-(n&&r.indexOf(n)>-1?1:0))return!1;for(let o of i)if(o!=n&&(r.indexOf(o)==-1||e[o]!==t[o]))return!1;return!0}function u6(e,t){for(let n=e.attributes.length-1;n>=0;n--){let i=e.attributes[n].name;if(t[i]==null)e.removeAttribute(i)}for(let n in t){let i=t[n];if(n=="style")e.style.cssText=i;else if(e.getAttribute(n)!=i)e.setAttribute(n,i)}}function PM(e,t,n){let i=!1;if(t){for(let r in t)if(!(n&&(r in n)))if(i=!0,r=="style")e.style.cssText="";else e.removeAttribute(r)}if(n){for(let r in n)if(!(t&&t[r]==n[r]))if(i=!0,r=="style")e.style.cssText=n[r];else e.setAttribute(r,n[r])}return i}function c6(e){let t=Object.create(null);for(let n=0;n<e.attributes.length;n++){let i=e.attributes[n];t[i.name]=i.value}return t}class Ho{eq(e){return!1}updateDOM(e,t,n){return!1}compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}get estimatedHeight(){return-1}get lineBreaks(){return 0}ignoreEvent(e){return!0}coordsAt(e,t,n){return null}get isHidden(){return!1}get editable(){return!1}destroy(e){}}var Gn=function(e){return e[e.Text=0]="Text",e[e.WidgetBefore=1]="WidgetBefore",e[e.WidgetAfter=2]="WidgetAfter",e[e.WidgetRange=3]="WidgetRange",e}(Gn||(Gn={}));class Ae extends gi{constructor(e,t,n,i){super();this.startSide=e,this.endSide=t,this.widget=n,this.spec=i}get heightRelevant(){return!1}static mark(e){return new nf(e)}static widget(e){let t=Math.max(-1e4,Math.min(1e4,e.side||0)),n=!!e.block;return t+=n&&!e.inlineOrder?t>0?300000000:-400000000:t>0?1e8:-1e8,new Fs(e,t,t,n,e.widget||null,!1)}static replace(e){let t=!!e.block,n,i;if(e.isBlockGap)n=-500000000,i=400000000;else{let{start:r,end:o}=c2(e,t);n=(r?t?-300000000:-1:500000000)-1,i=(o?t?200000000:1:-600000000)+1}return new Fs(e,n,i,t,e.widget||null,!0)}static line(e){return new rf(e)}static set(e,t=!1){return ge.of(e,t)}hasHeight(){return this.widget?this.widget.estimatedHeight>-1:!1}}Ae.none=ge.empty;class nf extends Ae{constructor(e){let{start:t,end:n}=c2(e);super(t?-1:500000000,n?1:-600000000,null,e);this.tagName=e.tagName||"span",this.attrs=e.class&&e.attributes?ax(e.attributes,{class:e.class}):e.class?{class:e.class}:e.attributes||Hp}eq(e){return this==e||e instanceof nf&&this.tagName==e.tagName&&ux(this.attrs,e.attrs)}range(e,t=e){if(e>=t)throw RangeError("Mark decorations may not be empty");return super.range(e,t)}}nf.prototype.point=!1;class rf extends Ae{constructor(e){super(-200000000,-200000000,null,e)}eq(e){return e instanceof rf&&this.spec.class==e.spec.class&&ux(this.spec.attributes,e.spec.attributes)}range(e,t=e){if(t!=e)throw RangeError("Line decoration ranges must be zero-length");return super.range(e,t)}}rf.prototype.mapMode=qt.TrackBefore;rf.prototype.point=!0;class Fs extends Ae{constructor(e,t,n,i,r,o){super(t,n,r,e);this.block=i,this.isReplace=o,this.mapMode=!i?qt.TrackDel:t<=0?qt.TrackBefore:qt.TrackAfter}get type(){return this.startSide!=this.endSide?Gn.WidgetRange:this.startSide<=0?Gn.WidgetBefore:Gn.WidgetAfter}get heightRelevant(){return this.block||!!this.widget&&(this.widget.estimatedHeight>=5||this.widget.lineBreaks>0)}eq(e){return e instanceof Fs&&f6(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 RangeError("Invalid range for replacement decoration");if(!this.isReplace&&t!=e)throw RangeError("Widget decorations can only have zero-length ranges");return super.range(e,t)}}Fs.prototype.point=!0;function c2(e,t=!1){let{inclusiveStart:n,inclusiveEnd:i}=e;if(n==null)n=e.inclusive;if(i==null)i=e.inclusive;return{start:n!==null&&n!==void 0?n:t,end:i!==null&&i!==void 0?i:t}}function f6(e,t){return e==t||!!(e&&t&&e.compare(t))}function Pa(e,t,n,i=0){let r=n.length-1;if(r>=0&&n[r]+i>=e)n[r]=Math.max(n[r],t);else n.push(e,t)}class Qc extends gi{constructor(e,t,n){super();this.tagName=e,this.attributes=t,this.rank=n}eq(e){return e==this||e instanceof Qc&&this.tagName==e.tagName&&ux(this.attributes,e.attributes)}static create(e){return new Qc(e.tagName,e.attributes||Hp,e.rank==null?50:Math.max(0,Math.min(e.rank,100)))}static set(e,t=!1){return ge.of(e,t)}}Qc.prototype.startSide=Qc.prototype.endSide=-1;function Jc(e){let t;if(e.nodeType==11)t=e.getSelection?e:e.ownerDocument;else t=e;return t.getSelection()}function X0(e,t){return t?e==t||e.contains(t.nodeType!=1?t.parentNode:t):!1}function Xc(e,t){if(!t.anchorNode)return!1;try{return X0(e,t.anchorNode)}catch(n){return!1}}function Gc(e){if(e.nodeType==3)return ef(e,0,e.nodeValue.length).getClientRects();else if(e.nodeType==1)return e.getClientRects();else return[]}function Yc(e,t,n,i){return n?IM(e,t,n,i,-1)||IM(e,t,n,i,1):!1}function Po(e){for(var t=0;;t++)if(e=e.previousSibling,!e)return t}function Vp(e){return e.nodeType==1&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(e.nodeName)}function IM(e,t,n,i,r){for(;;){if(e==n&&t==i)return!0;if(t==(r<0?0:Vr(e))){if(e.nodeName=="DIV")return!1;let o=e.parentNode;if(!o||o.nodeType!=1)return!1;t=Po(e)+(r<0?0:1),e=o}else if(e.nodeType==1){if(e=e.childNodes[t+(r<0?-1:0)],e.nodeType==1&&e.contentEditable=="false")return!1;t=r<0?Vr(e):0}else return!1}}function Vr(e){return e.nodeType==3?e.nodeValue.length:e.childNodes.length}function Zc(e,t){let{left:n,right:i}=e;if(n==i)return e;let r=t?n:i;return{left:r,right:r,top:e.top,bottom:e.bottom}}function d6(e){let t=e.visualViewport;if(t)return{left:0,right:t.width,top:0,bottom:t.height};return{left:0,right:e.innerWidth,top:0,bottom:e.innerHeight}}function f2(e,t){let n=t.width/e.offsetWidth,i=t.height/e.offsetHeight;if(n>0.995&&n<1.005||!isFinite(n)||Math.abs(t.width-e.offsetWidth)<1)n=1;if(i>0.995&&i<1.005||!isFinite(i)||Math.abs(t.height-e.offsetHeight)<1)i=1;return{scaleX:n,scaleY:i}}function h6(e,t,n,i,r,o,s,l){let a=e.ownerDocument,u=a.defaultView||window;for(let c=e,f=!1;c&&!f;)if(c.nodeType==1){let d,h=c==a.body,m=1,b=1;if(h)d=d6(u);else{if(/^(fixed|sticky)$/.test(getComputedStyle(c).position))f=!0;if(c.scrollHeight<=c.clientHeight&&c.scrollWidth<=c.clientWidth){c=c.assignedSlot||c.parentNode;continue}let v=c.getBoundingClientRect();({scaleX:m,scaleY:b}=f2(c,v)),d={left:v.left,right:v.left+c.clientWidth*m,top:v.top,bottom:v.top+c.clientHeight*b}}let x=0,g=0;if(r=="nearest"){if(t.top<d.top+s){if(g=t.top-(d.top+s),n>0&&t.bottom>d.bottom+g)g=t.bottom-d.bottom+s}else if(t.bottom>d.bottom-s){if(g=t.bottom-d.bottom+s,n<0&&t.top-g<d.top)g=t.top-(d.top+s)}}else{let v=t.bottom-t.top,w=d.bottom-d.top;g=(r=="center"&&v<=w?t.top+v/2-w/2:r=="start"||r=="center"&&n<0?t.top-s:t.bottom-w+s)-d.top}if(i=="nearest"){if(t.left<d.left+o){if(x=t.left-(d.left+o),n>0&&t.right>d.right+x)x=t.right-d.right+o}else if(t.right>d.right-o){if(x=t.right-d.right+o,n<0&&t.left<d.left+x)x=t.left-(d.left+o)}}else x=(i=="center"?t.left+(t.right-t.left)/2-(d.right-d.left)/2:i=="start"==l?t.left-o:t.right-(d.right-d.left)+o)-d.left;if(x||g)if(h)u.scrollBy(x,g);else{let v=0,w=0;if(g){let S=c.scrollTop;c.scrollTop+=g/b,w=(c.scrollTop-S)*b}if(x){let S=c.scrollLeft;c.scrollLeft+=x/m,v=(c.scrollLeft-S)*m}if(t={left:t.left-v,top:t.top-w,right:t.right-v,bottom:t.bottom-w},v&&Math.abs(v-x)<1)i="nearest";if(w&&Math.abs(w-g)<1)r="nearest"}if(h)break;if(t.top<d.top||t.bottom>d.bottom||t.left<d.left||t.right>d.right)t={left:Math.max(t.left,d.left),right:Math.min(t.right,d.right),top:Math.max(t.top,d.top),bottom:Math.min(t.bottom,d.bottom)};c=c.assignedSlot||c.parentNode}else if(c.nodeType==11)c=c.host;else break}function d2(e,t=!0){let n=e.ownerDocument,i=null,r=null;for(let o=e.parentNode;o;)if(o==n.body||(!t||i)&&r)break;else if(o.nodeType==1){if(!r&&o.scrollHeight>o.clientHeight)r=o;if(t&&!i&&o.scrollWidth>o.clientWidth)i=o;o=o.assignedSlot||o.parentNode}else if(o.nodeType==11)o=o.host;else break;return{x:i,y:r}}class h2{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:n}=e;this.set(t,Math.min(e.anchorOffset,t?Vr(t):0),n,Math.min(e.focusOffset,n?Vr(n):0))}set(e,t,n,i){this.anchorNode=e,this.anchorOffset=t,this.focusNode=n,this.focusOffset=i}}function p2(e){let t=[];for(let n=e;n;n=n.nodeType==11?n.host:n.parentNode)if(n.nodeType==1)t.push({node:n,left:n.scrollLeft,top:n.scrollTop});return t}function m2(e,t=!0){for(let{node:n,left:i,top:r}of e){if(t&&n.scrollTop!=r)n.scrollTop=r;if(n.scrollLeft!=i)n.scrollLeft=i}}var Ks=null;if(j.safari&&j.safari_version>=26)Ks=!1;function g2(e){if(e.setActive)return e.setActive();if(Ks)return e.focus(Ks);let t=p2(e);if(e.focus(Ks==null?{get preventScroll(){return Ks={preventScroll:!0},!0}}:void 0),!Ks)Ks=!1,m2(t)}var HM;function ef(e,t,n=t){let i=HM||(HM=document.createRange());return i.setEnd(e,n),i.setStart(e,t),i}function Ia(e,t,n,i){let r={key:t,code:t,keyCode:n,which:n,cancelable:!0};if(i)({altKey:r.altKey,ctrlKey:r.ctrlKey,shiftKey:r.shiftKey,metaKey:r.metaKey}=i);let o=new KeyboardEvent("keydown",r);o.synthetic=!0,e.dispatchEvent(o);let s=new KeyboardEvent("keyup",r);return s.synthetic=!0,e.dispatchEvent(s),o.defaultPrevented||s.defaultPrevented}function p6(e){while(e){if(e&&(e.nodeType==9||e.nodeType==11&&e.host))return e;e=e.assignedSlot||e.parentNode}return null}function m6(e,t){let{focusNode:n,focusOffset:i}=t;if(!n||t.anchorNode!=n||t.anchorOffset!=i)return!1;i=Math.min(i,Vr(n));for(;;)if(i){if(n.nodeType!=1)return!1;let r=n.childNodes[i-1];if(r.contentEditable=="false")i--;else n=r,i=Vr(n)}else if(n==e)return!0;else i=Po(n),n=n.parentNode}function v2(e){if(e instanceof Window)return e.pageYOffset>Math.max(0,e.document.documentElement.scrollHeight-e.innerHeight-4);return e.scrollTop>Math.max(1,e.scrollHeight-e.clientHeight-4)}function b2(e,t){for(let n=e,i=t;;)if(n.nodeType==3&&i>0)return{node:n,offset:i};else if(n.nodeType==1&&i>0){if(n.contentEditable=="false")return null;n=n.childNodes[i-1],i=Vr(n)}else if(n.parentNode&&!Vp(n))i=Po(n),n=n.parentNode;else return null}function y2(e,t){for(let n=e,i=t;;)if(n.nodeType==3&&i<n.nodeValue.length)return{node:n,offset:i};else if(n.nodeType==1&&i<n.childNodes.length){if(n.contentEditable=="false")return null;n=n.childNodes[i],i=0}else if(n.parentNode&&!Vp(n))i=Po(n)+1,n=n.parentNode;else return null}class xi{constructor(e,t,n=!0){this.node=e,this.offset=t,this.precise=n}static before(e,t){return new xi(e.parentNode,Po(e),t)}static after(e,t){return new xi(e.parentNode,Po(e)+1,t)}}var Ke=function(e){return e[e.LTR=0]="LTR",e[e.RTL=1]="RTL",e}(Ke||(Ke={})),qs=Ke.LTR,cx=Ke.RTL;function x2(e){let t=[];for(let n=0;n<e.length;n++)t.push(1<<+e[n]);return t}var g6=x2("88888888888888888888888888888888888666888888787833333333337888888000000000000000000000000008888880000000000000000000000000088888888888888888888888888888888888887866668888088888663380888308888800000000000000000000000800000000000000000000000000000008"),v6=x2("4444448826627288999999999992222222222222222222222222222222222222222222222229999999999999999999994444444444644222822222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222999999949999999229989999223333333333"),G0=Object.create(null),ir=[];for(let e of["()","[]","{}"]){let t=e.charCodeAt(0),n=e.charCodeAt(1);G0[t]=n,G0[n]=-t}function w2(e){return e<=247?g6[e]:1424<=e&&e<=1524?2:1536<=e&&e<=1785?v6[e-1536]:1774<=e&&e<=2220?4:8192<=e&&e<=8204?256:64336<=e&&e<=65023?4:1}var b6=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac\ufb50-\ufdff]/;class wi{get dir(){return this.level%2?cx:qs}constructor(e,t,n){this.from=e,this.to=t,this.level=n}side(e,t){return this.dir==t==e?this.to:this.from}forward(e,t){return e==(this.dir==t)}static find(e,t,n,i){let r=-1;for(let o=0;o<e.length;o++){let s=e[o];if(s.from<=t&&s.to>=t){if(s.level==n)return o;if(r<0||(i!=0?i<0?s.from<t:s.to>t:e[r].level>s.level))r=o}}if(r<0)throw RangeError("Index out of range");return r}}function S2(e,t){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++){let i=e[n],r=t[n];if(i.from!=r.from||i.to!=r.to||i.direction!=r.direction||!S2(i.inner,r.inner))return!1}return!0}var Ne=[];function y6(e,t,n,i,r){for(let o=0;o<=i.length;o++){let s=o?i[o-1].to:t,l=o<i.length?i[o].from:n,a=o?256:r;for(let u=s,c=a,f=a;u<l;u++){let d=w2(e.charCodeAt(u));if(d==512)d=c;else if(d==8&&f==4)d=16;if(Ne[u]=d==4?2:d,d&7)f=d;c=d}for(let u=s,c=a,f=a;u<l;u++){let d=Ne[u];if(d==128)if(u<l-1&&c==Ne[u+1]&&c&24)d=Ne[u]=c;else Ne[u]=256;else if(d==64){let h=u+1;while(h<l&&Ne[h]==64)h++;let m=u&&c==8||h<n&&Ne[h]==8?f==1?1:8:256;for(let b=u;b<h;b++)Ne[b]=m;u=h-1}else if(d==8&&f==1)Ne[u]=1;if(c=d,d&7)f=d}}}function x6(e,t,n,i,r){let o=r==1?2:1;for(let s=0,l=0,a=0;s<=i.length;s++){let u=s?i[s-1].to:t,c=s<i.length?i[s].from:n;for(let f=u,d,h,m;f<c;f++)if(h=G0[d=e.charCodeAt(f)])if(h<0){for(let b=l-3;b>=0;b-=3)if(ir[b+1]==-h){let x=ir[b+2],g=x&2?r:!(x&4)?0:x&1?o:r;if(g)Ne[f]=Ne[ir[b]]=g;l=b;break}}else if(ir.length==189)break;else ir[l++]=f,ir[l++]=d,ir[l++]=a;else if((m=Ne[f])==2||m==1){let b=m==r;a=b?0:1;for(let x=l-3;x>=0;x-=3){let g=ir[x+2];if(g&2)break;if(b)ir[x+2]|=2;else{if(g&4)break;ir[x+2]|=4}}}}}function w6(e,t,n,i){for(let r=0,o=i;r<=n.length;r++){let s=r?n[r-1].to:e,l=r<n.length?n[r].from:t;for(let a=s;a<l;){let u=Ne[a];if(u==256){let c=a+1;for(;;)if(c==l){if(r==n.length)break;c=n[r++].to,l=r<n.length?n[r].from:t}else if(Ne[c]==256)c++;else break;let f=o==1,d=(c<t?Ne[c]:i)==1,h=f==d?f?1:2:i;for(let m=c,b=r,x=b?n[b-1].to:e;m>a;){if(m==x)m=n[--b].from,x=b?n[b-1].to:e;Ne[--m]=h}a=c}else o=u,a++}}}function Y0(e,t,n,i,r,o,s){let l=i%2?2:1;if(i%2==r%2)for(let a=t,u=0;a<n;){let c=!0,f=!1;if(u==o.length||a<o[u].from){let b=Ne[a];if(b!=l)c=!1,f=b==16}let d=!c&&l==1?[]:null,h=c?i:i+1,m=a;e:for(;;)if(u<o.length&&m==o[u].from){if(f)break e;let b=o[u];if(!c)for(let x=b.to,g=u+1;;){if(x==n)break e;if(g<o.length&&o[g].from==x)x=o[g++].to;else if(Ne[x]==l)break e;else break}if(u++,d)d.push(b);else{if(b.from>a)s.push(new wi(a,b.from,h));let x=b.direction==qs!=!(h%2);W0(e,x?i+1:i,r,b.inner,b.from,b.to,s),a=b.to}m=b.to}else if(m==n||(c?Ne[m]!=l:Ne[m]==l))break;else m++;if(d)Y0(e,a,m,i+1,r,d,s);else if(a<m)s.push(new wi(a,m,h));a=m}else for(let a=n,u=o.length;a>t;){let c=!0,f=!1;if(!u||a>o[u-1].to){let b=Ne[a-1];if(b!=l)c=!1,f=b==16}let d=!c&&l==1?[]:null,h=c?i:i+1,m=a;e:for(;;)if(u&&m==o[u-1].to){if(f)break e;let b=o[--u];if(!c)for(let x=b.from,g=u;;){if(x==t)break e;if(g&&o[g-1].to==x)x=o[--g].from;else if(Ne[x-1]==l)break e;else break}if(d)d.push(b);else{if(b.to<a)s.push(new wi(b.to,a,h));let x=b.direction==qs!=!(h%2);W0(e,x?i+1:i,r,b.inner,b.from,b.to,s),a=b.from}m=b.from}else if(m==t||(c?Ne[m-1]!=l:Ne[m-1]==l))break;else m--;if(d)Y0(e,m,a,i+1,r,d,s);else if(m<a)s.push(new wi(m,a,h));a=m}}function W0(e,t,n,i,r,o,s){let l=t%2?2:1;y6(e,r,o,i,l),x6(e,r,o,i,l),w6(r,o,i,l),Y0(e,r,o,t,n,i,s)}function S6(e,t,n){if(!e)return[new wi(0,0,t==cx?1:0)];if(t==qs&&!n.length&&!b6.test(e))return k2(e.length);if(n.length)while(e.length>Ne.length)Ne[Ne.length]=256;let i=[],r=t==qs?0:1;return W0(e,r,r,n,0,e.length,i),i}function k2(e){return[new wi(0,e,0)]}var _2="";function k6(e,t,n,i,r){var o;if(!e.length)return null;let s=i.head-e.from,l;if(i.head==e.from&&i.assoc<0){if(!r)return null;s=t[l=0].side(!1,n)}else if(i.head==e.to&&i.assoc>0){if(r)return null;s=t[l=t.length-1].side(!0,n)}else l=wi.find(t,s,(o=i.bidiLevel)!==null&&o!==void 0?o:-1,i.assoc);let a=t[l],u=a.side(r,n);if(s==u){let d=l+=r?1:-1;if(d<0||d>=t.length)return null;a=t[l=d],s=a.side(!r,n),u=a.side(r,n)}let c=wt(e.text,s,a.forward(r,n));if(c<a.from||c>a.to)c=u;_2=e.text.slice(Math.min(s,c),Math.max(s,c));let f=l==(r?t.length-1:0)?null:t[l+(r?1:-1)];if(c==u){if(!f)return r?A.cursor(e.to,1):A.cursor(e.from,-1);if(f.level+(r?0:1)<a.level)return A.cursor(f.side(!r,n)+e.from,f.forward(r,n)?1:-1,f.level)}return A.cursor(c+e.from,a.forward(r,n)?-1:1,a.level)}function _6(e,t,n){for(let i=t;i<n;i++){let r=w2(e.charCodeAt(i));if(r==1)return qs;if(r==2||r==4)return cx}return qs}var C2=Z.define(),E2=Z.define(),O2=Z.define(),R2=Z.define(),Q0=Z.define(),A2=Z.define(),T2=Z.define(),fx=Z.define(),dx=Z.define(),M2=Z.define({combine:(e)=>e.some((t)=>t)}),C6=Z.define({combine:(e)=>e.some((t)=>t)}),N2=Z.define();class Ha{constructor(e,t,n,i,r,o=!1){this.range=e,this.y=t,this.x=n,this.yMargin=i,this.xMargin=r,this.isSnapshot=o}map(e){return e.empty?this:new Ha(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 Ha(A.cursor(e.doc.length),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}}var Op=ye.define({map:(e,t)=>e.map(t)}),D2=ye.define();function Xt(e,t,n){let i=e.facet(R2);if(i.length)i[0](t);else if(window.onerror&&window.onerror(String(t),n,void 0,void 0,t));else if(n)console.error(n+":",t);else console.error(t)}var Ir=Z.define({combine:(e)=>e.length?e[0]:!0}),E6=0,Ba=Z.define({combine(e){return e.filter((t,n)=>{for(let i=0;i<n;i++)if(e[i].plugin==t.plugin)return!1;return!0})}});class En{constructor(e,t,n,i,r){this.id=e,this.create=t,this.domEventHandlers=n,this.domEventObservers=i,this.baseExtensions=r(this),this.extension=this.baseExtensions.concat(Ba.of({plugin:this,arg:void 0}))}of(e){return this.baseExtensions.concat(Ba.of({plugin:this,arg:e}))}static define(e,t){let{eventHandlers:n,eventObservers:i,provide:r,decorations:o}=t||{};return new En(E6++,e,n,i,(s)=>{let l=[];if(o)l.push(Xp.of((a)=>{let u=a.plugin(s);return u?o(u):Ae.none}));if(r)l.push(r(s));return l})}static fromClass(e,t){return En.define((n,i)=>new e(n,i),t)}}class zp{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.spec)try{this.value=this.spec.plugin.create(e,this.spec.arg)}catch(t){Xt(e.state,t,"CodeMirror plugin crashed"),this.deactivate()}}else if(this.mustUpdate){let t=this.mustUpdate;if(this.mustUpdate=null,this.value.update)try{this.value.update(t)}catch(n){if(Xt(t.state,n,"CodeMirror plugin crashed"),this.value.destroy)try{this.value.destroy()}catch(i){}this.deactivate()}}return this}destroy(e){var t;if((t=this.value)===null||t===void 0?void 0:t.destroy)try{this.value.destroy()}catch(n){Xt(e.state,n,"CodeMirror plugin crashed")}}deactivate(){this.spec=this.value=null}}var L2=Z.define(),hx=Z.define(),Xp=Z.define(),z2=Z.define(),px=Z.define(),of=Z.define(),B2=Z.define();function VM(e,t){let n=e.state.facet(B2);if(!n.length)return n;let i=n.map((o)=>o instanceof Function?o(e):o),r=[];return ge.spans(i,t.from,t.to,{point(){},span(o,s,l,a){let u=o-t.from,c=s-t.from,f=r;for(let d=l.length-1;d>=0;d--,a--){let h=l[d].spec.bidiIsolate,m;if(h==null)h=_6(t.text,u,c);if(a>0&&f.length&&(m=f[f.length-1]).to==u&&m.direction==h)m.to=c,f=m.inner;else{let b={from:u,to:c,direction:h,inner:[]};f.push(b),f=b.inner}}}}),r}var P2=Z.define();function mx(e){let t=0,n=0,i=0,r=0;for(let o of e.state.facet(P2)){let s=o(e);if(s){if(s.left!=null)t=Math.max(t,s.left);if(s.right!=null)n=Math.max(n,s.right);if(s.top!=null)i=Math.max(i,s.top);if(s.bottom!=null)r=Math.max(r,s.bottom)}}return{left:t,right:n,top:i,bottom:r}}var Fc=Z.define();class Xn{constructor(e,t,n,i){this.fromA=e,this.toA=t,this.fromB=n,this.toB=i}join(e){return new Xn(Math.min(this.fromA,e.fromA),Math.max(this.toA,e.toA),Math.min(this.fromB,e.fromB),Math.max(this.toB,e.toB))}addToSet(e){let t=e.length,n=this;for(;t>0;t--){let i=e[t-1];if(i.fromA>n.toA)continue;if(i.toA<n.fromA)break;n=n.join(i),e.splice(t-1,1)}return e.splice(t,0,n),e}static extendWithRanges(e,t){if(t.length==0)return e;let n=[];for(let i=0,r=0,o=0;;){let s=i<e.length?e[i].fromB:1e9,l=r<t.length?t[r]:1e9,a=Math.min(s,l);if(a==1e9)break;let u=a+o,c=a,f=u;for(;;)if(r<t.length&&t[r]<=c){let d=t[r+1];r+=2,c=Math.max(c,d);for(let h=i;h<e.length&&e[h].fromB<=c;h++)o=e[h].toA-e[h].toB;f=Math.max(f,d+o)}else if(i<e.length&&e[i].fromB<=c){let d=e[i++];c=Math.max(c,d.toB),f=Math.max(f,d.toA),o=d.toA-d.toB}else break;n.push(new Xn(u,f,a,c))}return n}}class Up{constructor(e,t,n){this.view=e,this.state=t,this.transactions=n,this.flags=0,this.startState=e.state,this.changes=rt.empty(this.startState.doc.length);for(let r of n)this.changes=this.changes.compose(r.changes);let i=[];this.changes.iterChangedRanges((r,o,s,l)=>i.push(new Xn(r,o,s,l))),this.changedRanges=i}static create(e,t,n){return new Up(e,t,n)}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}}var O6=[];class Ge{constructor(e,t,n=0){this.dom=e,this.length=t,this.flags=n,this.parent=null,e.cmTile=this}get breakAfter(){return this.flags&1}get children(){return O6}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;if(t)u6(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 n=t;for(let i of this.children){if(i==e)return n;n+=i.length+i.breakAfter}throw RangeError("Invalid child in posBefore")}posAfter(e){return this.posBefore(e)+e.length}covers(e){return!0}coordsIn(e,t,n){return null}domPosFor(e,t){let n=Po(this.dom),i=this.length?e>0:t>0;return new xi(this.parent.dom,n+(i?1:0),e==0||e==this.length)}markDirty(e){if(this.flags&=-3,e)this.flags|=4;if(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 lf)return e;return null}static get(e){return e.cmTile}}class sf extends Ge{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,n=null,i,r=(e===null||e===void 0?void 0:e.node)==t?e:null,o=0;for(let s of this.children){if(s.sync(e),o+=s.length+s.breakAfter,i=n?n.nextSibling:t.firstChild,r&&i!=s.dom)r.written=!0;if(s.dom.parentNode==t)while(i&&i!=s.dom)i=UM(i);else t.insertBefore(s.dom,i);n=s.dom}if(i=n?n.nextSibling:t.firstChild,r&&i)r.written=!0;while(i)i=UM(i);this.length=o}}function UM(e){let t=e.nextSibling;return e.parentNode.removeChild(e),t}class lf extends sf{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=Ge.get(e);if(t&&this.owns(t))return t;e=e.parentNode}}blockTiles(e){for(let t=[],n=this,i=0,r=0;;)if(i==n.children.length){if(!t.length)return;if(n=n.parent,n.breakAfter)r++;i=t.pop()}else{let o=n.children[i++];if(o instanceof Hr)t.push(i),n=o,i=0;else{let s=r+o.length,l=e(o,r);if(l!==void 0)return l;r=s+o.breakAfter}}}resolveBlock(e,t){let n,i=-1,r,o=-1;if(this.blockTiles((s,l)=>{let a=l+s.length;if(e>=l&&e<=a){if(s.isWidget()&&t>=-1&&t<=1){if(s.flags&32)return!0;if(s.flags&16)n=void 0}if((l<e||e==a&&(t<-1?s.length:s.covers(1)))&&(!n||!s.isWidget()&&n.isWidget()))n=s,i=e-l;if((a>e||e==l&&(t>1?s.length:s.covers(-1)))&&(!r||!s.isWidget()&&r.isWidget()))r=s,o=e-l}}),!n&&!r)throw Error("No tile at position "+e);return n&&t<0||!r?{tile:n,offset:i}:{tile:r,offset:o}}}class Hr extends sf{constructor(e,t){super(e);this.wrapper=t}isBlock(){return!0}covers(e){if(!this.children.length)return!1;return e<0?this.children[0].covers(-1):this.lastChild.covers(1)}get domAttrs(){return this.wrapper.attributes}static of(e,t){let n=new Hr(t||document.createElement(e.tagName),e);if(!t)n.flags|=4;return n}}class Va extends sf{constructor(e,t){super(e);this.attrs=t}isLine(){return!0}static start(e,t,n){let i=new Va(t||document.createElement("div"),e);if(!t||!n)i.flags|=4;return i}get domAttrs(){return this.attrs}resolveInline(e,t,n){let i=null,r=-1,o=null,s=-1;function l(u,c){for(let f=0,d=0;f<u.children.length&&d<=c;f++){let h=u.children[f],m=d+h.length;if(m>=c){if(h.isComposite())l(h,c-d);else if((!o||o.isHidden&&(t>0&&!(o.flags&32)||n&&A6(o,h)))&&(m>c||h.flags&32&&t<=1))o=h,s=c-d;else if(d<c||h.flags&16&&!h.isHidden&&t>=-1)i=h,r=c-d}d=m}}l(this,e);let a=(t<0?i:o)||i||o;return a?{tile:a,offset:a==i?r:s}:null}coordsIn(e,t,n){let i=this.resolveInline(e,t,!0);if(!i)return R6(this);return i.tile.coordsIn(Math.max(0,i.offset),t,n)}domIn(e,t){let n=this.resolveInline(e,t);if(n){let{tile:i,offset:r}=n;if(this.dom.contains(i.dom)){if(i.isText())return new xi(i.dom,Math.min(i.dom.nodeValue.length,r));return i.domPosFor(r,i.flags&16?1:i.flags&32?-1:t)}let o=n.tile.parent,s=!1;for(let l of o.children){if(s)return new xi(l.dom,0);if(l==n.tile)s=!0}}return new xi(this.dom,0)}}function R6(e){let t=e.dom.lastChild;if(!t)return e.dom.getBoundingClientRect();let n=Gc(t);return n[n.length-1]||null}function A6(e,t){let n=e.coordsIn(0,1),i=t.coordsIn(0,1);return n&&i&&i.top<n.bottom}class on extends sf{constructor(e,t){super(e);this.mark=t}get domAttrs(){return this.mark.attrs}static of(e,t){let n=new on(t||document.createElement(e.tagName),e);if(!t)n.flags|=4;return n}}class js extends Ge{constructor(e,t){super(e,t.length);this.text=t}sync(e){if(this.flags&2)return;if(super.sync(e),this.dom.nodeValue!=this.text){if(e&&e.node==this.dom)e.written=!0;this.dom.nodeValue=this.text}}isText(){return!0}toString(){return JSON.stringify(this.text)}coordsIn(e,t,n){let i=this.dom.nodeValue.length;if(e>i)e=i;let r=e,o=e,s=0;if(e==0&&t<0||e==i&&t>=0){if(!(j.chrome||j.gecko)){if(e)r--,s=1;else if(o<i)o++,s=-1}}else if(t<0)r--;else if(o<i)o++;let l=ef(this.dom,r,o).getClientRects();if(!l.length)return null;let a=l[(s?s<0:t>=0)?0:l.length-1];if(j.safari&&!s&&a.width==0)a=Array.prototype.find.call(l,(u)=>u.width)||a;return n==null?a:Zc(a,(s?s>0:t<0)==n)}static of(e,t){let n=new js(t||document.createTextNode(e),e);if(!t)n.flags|=2;return n}}class $s extends Ge{constructor(e,t,n,i){super(e,t,i);this.widget=n}isWidget(){return!0}get isHidden(){return this.widget.isHidden}covers(e){if(this.flags&48)return!1;return(this.flags&(e<0?64:128))>0}coordsIn(e,t){return this.coordsInWidget(e,t,!1)}coordsInWidget(e,t,n){let i=this.widget.coordsAt(this.dom,e,t);if(i)return i;if(n)return Zc(this.dom.getBoundingClientRect(),this.length?e==0:t<=0);else{let r=this.dom.getClientRects(),o=null;if(!r.length)return null;let s=this.flags&16?!0:this.flags&32?!1:e>0;for(let l=s?r.length-1:0;;l+=s?-1:1)if(o=r[l],e>0?l==0:l==r.length-1||o.top<o.bottom)break;return Zc(o,!s)}}get overrideDOMText(){if(!this.length)return he.empty;let{root:e}=this;if(!e)return he.empty;let t=this.posAtStart;return e.view.state.doc.slice(t,t+this.length)}destroy(){super.destroy(),this.widget.destroy(this.dom)}static of(e,t,n,i,r){if(!r){if(r=e.toDOM(t),!e.editable)r.contentEditable="false"}return new $s(r,n,e,i)}}class tf extends Ge{constructor(e){let t=document.createElement("img");t.className="cm-widgetBuffer",t.setAttribute("aria-hidden","true");super(t,0,e)}get isHidden(){return!0}get overrideDOMText(){return he.empty}coordsIn(e,t,n){let i=this.dom.getBoundingClientRect();return n==null?i:Zc(i,t>0==n)}}class I2{constructor(e){this.index=0,this.beforeBreak=!1,this.parents=[],this.tile=e}advance(e,t,n){let{tile:i,index:r,beforeBreak:o,parents:s}=this;while(e||t>0)if(!i.isComposite()){let l=i.length;if(r<l&&e){let a=Math.min(e,l-r);if(n)n.skip(i,r,r+a);e-=a,r+=a}if(r==l)o=!!i.breakAfter,{tile:i,index:r}=s.pop(),r++;else if(!e)break}else if(o){if(!e)break;if(n)n.break();e--,o=!1}else if(r==i.children.length){if(!e&&!s.length)break;if(n)n.leave(i);o=!!i.breakAfter,{tile:i,index:r}=s.pop(),r++}else{let l=i.children[r],a=l.breakAfter;if((t>0?l.length<=e:l.length<e)&&(!n||n.skip(l,0,l.length)!==!1||!l.isComposite))o=!!a,r++,e-=l.length;else if(s.push({tile:i,index:r}),i=l,r=0,n&&l.isComposite())n.enter(l)}return this.tile=i,this.index=r,this.beforeBreak=o,this}get root(){return this.parents.length?this.parents[0].tile:this.tile}}class H2{constructor(e,t,n,i){this.from=e,this.to=t,this.wrapper=n,this.rank=i}}class V2{constructor(e,t,n){this.cache=e,this.root=t,this.blockWrappers=n,this.curLine=null,this.lastBlock=null,this.afterWidget=null,this.pos=0,this.wrappers=[],this.wrapperPos=0}addText(e,t,n,i){var r;this.flushBuffer();let o=this.ensureMarks(t,n),s=o.lastChild;if(s&&s.isText()&&!(s.flags&8)&&s.length+e.length<512){this.cache.reused.set(s,2);let l=o.children[o.children.length-1]=new js(s.dom,s.text+e);l.parent=o}else o.append(i||js.of(e,(r=this.cache.find(js))===null||r===void 0?void 0:r.dom));this.pos+=e.length,this.afterWidget=null}addComposition(e,t){let n=this.curLine;if(n.dom!=t.line.dom)n.setDOM(this.cache.reused.has(t.line)?I0(t.line.dom):t.line.dom),this.cache.reused.set(t.line,2);let i=n;for(let s=t.marks.length-1;s>=0;s--){let l=t.marks[s],a=i.lastChild;if(a instanceof on&&a.mark.eq(l.mark)){if(a.dom!=l.dom)a.setDOM(I0(l.dom));i=a}else{let{dom:u}=l;if(this.cache.reused.get(l)){if(Ge.get(l.dom))u=I0(l.dom)}let c=on.of(l.mark,u);i.append(c),i=c}this.cache.reused.set(l,2)}let r=Ge.get(e.text);if(r)this.cache.reused.set(r,2);let o=new js(e.text,e.text.nodeValue);o.flags|=8,this.pos=e.range.toB,i.append(o)}addInlineWidget(e,t,n){let i=this.afterWidget&&e.flags&48&&(this.afterWidget.flags&48)==(e.flags&48);if(!i)this.flushBuffer();let r=this.ensureMarks(t,n);if(!i&&!(e.flags&16))r.append(this.getBuffer(1));r.append(e),this.pos+=e.length,this.afterWidget=e}addMark(e,t,n){this.flushBuffer(),this.ensureMarks(t,n).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 n;if(!e)e=F2;let i=Va.start(e,t||((n=this.cache.find(Va))===null||n===void 0?void 0:n.dom),!!t);this.getBlockPos().append(this.lastBlock=this.curLine=i)}addLine(e){this.getBlockPos().append(e),this.pos+=e.length,this.lastBlock=e,this.endLine()}addBreak(){this.lastBlock.flags|=1,this.endLine(),this.pos++}addLineStartIfNotCovered(e){if(!this.blockPosCovered())this.addLineStart(e)}ensureLine(e){if(!this.curLine)this.addLineStart(e)}ensureMarks(e,t){var n;let i=this.curLine;for(let r=e.length-1;r>=0;r--){let o=e[r],s;if(t>0&&(s=i.lastChild)&&s instanceof on&&s.mark.eq(o))i=s,t--;else{let l=on.of(o,(n=this.cache.find(on,(a)=>a.mark.eq(o)))===null||n===void 0?void 0:n.dom);i.append(l),i=l,t=0}}return i}endLine(){if(this.curLine){this.flushBuffer();let e=this.curLine.lastChild;if(!e||!KM(this.curLine,!1)||e.dom.nodeName!="BR"&&e.isWidget()&&!(j.ios&&KM(this.curLine,!0)))this.curLine.append(this.cache.findWidget(H0,0,32)||new $s(H0.toDOM(),0,H0,32));this.curLine=this.afterWidget=null}}updateBlockWrappers(){if(this.wrapperPos>this.pos+1e4)this.blockWrappers.goto(this.pos),this.wrappers.length=0;for(let e=this.wrappers.length-1;e>=0;e--)if(this.wrappers[e].to<this.pos)this.wrappers.splice(e,1);for(let e=this.blockWrappers;e.value&&e.from<=this.pos;e.next())if(e.to>=this.pos){let t=e.rank*102+e.value.rank,n=new H2(e.from,e.to,e.value,t),i=this.wrappers.length;while(i>0&&(this.wrappers[i-1].rank-n.rank||this.wrappers[i-1].to-n.to)<0)i--;this.wrappers.splice(i,0,n)}this.wrapperPos=this.pos}getBlockPos(){var e;this.updateBlockWrappers();let t=this.root;for(let n of this.wrappers){let i=t.lastChild;if(n.from<this.pos&&i instanceof Hr&&i.wrapper.eq(n.wrapper))t=i;else{let r=Hr.of(n.wrapper,(e=this.cache.find(Hr,(o)=>o.wrapper.eq(n.wrapper)))===null||e===void 0?void 0:e.dom);t.append(r),t=r}}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),n=this.cache.find(tf,void 0,1);if(n)n.flags=t;return n||new tf(t)}flushBuffer(){if(this.afterWidget&&!(this.afterWidget.flags&32))this.afterWidget.parent.append(this.getBuffer(-1)),this.afterWidget=null}}class U2{constructor(e){this.skipCount=0,this.text="",this.textOff=0,this.cursor=e.iter()}skip(e){if(this.textOff+e<=this.text.length)this.textOff+=e;else this.skipCount+=e-(this.text.length-this.textOff),this.text="",this.textOff=0}next(e){if(this.textOff==this.text.length){let{value:i,lineBreak:r,done:o}=this.cursor.next(this.skipCount);if(this.skipCount=0,o)throw Error("Ran out of text content when drawing inline views");this.text=i;let s=this.textOff=Math.min(e,i.length);return r?null:i.slice(0,s)}let t=Math.min(this.text.length,this.textOff+e),n=this.text.slice(this.textOff,t);return this.textOff=t,n}}var Kp=[$s,Va,js,on,tf,Hr,lf];for(let e=0;e<Kp.length;e++)Kp[e].bucket=e;class K2{constructor(e){this.view=e,this.buckets=Kp.map(()=>[]),this.index=Kp.map(()=>0),this.reused=new Map}add(e){let t=e.constructor.bucket,n=this.buckets[t];if(n.length<6)n.push(e);else n[this.index[t]=(this.index[t]+1)%6]=e}find(e,t,n=2){let i=e.bucket,r=this.buckets[i],o=this.index[i];for(let s=0;s<r.length;s++){let l=(s+o)%r.length,a=r[l];if((!t||t(a))&&!this.reused.has(a)){if(r.splice(l,1),l<o)this.index[i]--;return this.reused.set(a,n),a}}return null}findWidget(e,t,n){let i=this.buckets[0];if(i.length)for(let r=0,o=0;;r++){if(r==i.length){if(o)return null;o=1,r=0}let s=i[r];if(!this.reused.has(s)&&(o==0?s.widget.compare(e):s.widget.constructor==e.constructor&&e.updateDOM(s.dom,this.view,s.widget))){if(i.splice(r,1),r<this.index[0])this.index[0]--;if(s.widget==e&&s.length==t&&(s.flags&497)==n)return this.reused.set(s,1),s;else return this.reused.set(s,2),new $s(s.dom,t,e,s.flags&-498|n)}}}reuse(e){return this.reused.set(e,1),e}maybeReuse(e,t=2){if(this.reused.has(e))return;return this.reused.set(e,t),e.dom}clear(){for(let e=0;e<this.buckets.length;e++)this.buckets[e].length=this.index[e]=0}}class j2{constructor(e,t,n,i,r){this.view=e,this.decorations=i,this.disallowBlockEffectsFor=r,this.openWidget=!1,this.openMarks=0,this.cache=new K2(e),this.text=new U2(e.state.doc),this.builder=new V2(this.cache,new lf(e,e.contentDOM),ge.iter(n)),this.cache.reused.set(t,2),this.old=new I2(t),this.reuseWalker={skip:(o,s,l)=>{if(this.cache.add(o),o.isComposite())return!1},enter:(o)=>this.cache.add(o),leave:()=>{},break:()=>{}}}run(e,t){let n=t&&this.getCompositionContext(t.text);for(let i=0,r=0,o=0;;){let s=o<e.length?e[o++]:null,l=s?s.fromA:this.old.root.length;if(l>i){let a=l-i;this.preserve(a,!o,!s),i=l,r+=a}if(!s)break;if(t&&s.fromA<=t.range.fromA&&s.toA>=t.range.toA)this.forward(s.fromA,t.range.fromA,t.range.fromA<t.range.toA?1:-1),this.emit(r,t.range.fromB),this.builder.flushBuffer(),this.cache.clear(),this.builder.addComposition(t,n),this.text.skip(t.range.toB-t.range.fromB),this.forward(t.range.fromA,s.toA),this.emit(t.range.toB,s.toB);else this.forward(s.fromA,s.toA),this.emit(r,s.toB);r=s.toB,i=s.toA}if(this.builder.curLine)this.builder.endLine();return this.builder.root}preserve(e,t,n){let i=N6(this.old),r=this.openMarks;this.old.advance(e,n?1:-1,{skip:(o,s,l)=>{if(o.isWidget())if(this.openWidget)this.builder.continueWidget(l-s);else{let a=l>0||s<o.length?$s.of(o.widget,this.view,l-s,o.flags&496,this.cache.maybeReuse(o)):this.cache.reuse(o);if(a.flags&256)a.flags&=-2,this.builder.addBlockWidget(a);else this.builder.ensureLine(null),this.builder.addInlineWidget(a,i,r),r=i.length}else if(o.isText()){if(this.builder.ensureLine(null),!s&&l==o.length&&!this.cache.reused.has(o))this.builder.addText(o.text,i,r,this.cache.reuse(o));else this.cache.add(o),this.builder.addText(o.text.slice(s,l),i,r);r=i.length}else if(o.isLine())o.flags&=-2,this.cache.reused.set(o,1),this.builder.addLine(o);else if(o instanceof tf)this.cache.add(o);else if(o instanceof on)this.builder.ensureLine(null),this.builder.addMark(o,i,r),this.cache.reused.set(o,1),r=i.length;else return!1;this.openWidget=!1},enter:(o)=>{if(o.isLine())this.builder.addLineStart(o.attrs,this.cache.maybeReuse(o));else if(this.cache.add(o),o instanceof on)i.unshift(o.mark);this.openWidget=!1},leave:(o)=>{if(o.isLine()){if(i.length)i.length=r=0}else if(o instanceof on)i.shift(),r=Math.min(r,i.length)},break:()=>{this.builder.addBreak(),this.openWidget=!1}}),this.text.skip(e)}emit(e,t){let n=null,i=this.builder,r=-1,o=ge.spans(this.decorations,e,t,{point:(s,l,a,u,c,f)=>{if(a instanceof Fs){if(this.disallowBlockEffectsFor[f]){if(a.block)throw RangeError("Block decorations may not be specified via plugins");if(l>this.view.state.doc.lineAt(s).to)throw RangeError("Decorations that replace line breaks may not be specified via plugins")}if(r=u.length,c>u.length)i.continueWidget(l-s);else{let d=a.widget||(a.block?Xs.block:Xs.inline),h=T6(a),m=this.cache.findWidget(d,l-s,h)||$s.of(d,this.view,l-s,h);if(a.block){if(a.startSide>0)i.addLineStartIfNotCovered(n);i.addBlockWidget(m)}else i.ensureLine(n),i.addInlineWidget(m,u,c)}n=null}else n=M6(n,a);if(l>s)this.text.skip(l-s)},span:(s,l,a,u)=>{for(let c=s;c<l;){let f=this.text.next(Math.min(512,l-c));if(f==null)i.addLineStartIfNotCovered(n),i.addBreak(),c++;else i.ensureLine(n),i.addText(f,a,c==s?u:a.length),c+=f.length;n=null}r=a.length}});if(r>-1)this.openWidget=o>r;if(!this.openWidget)i.addLineStartIfNotCovered(n);this.openMarks=o}forward(e,t,n=1){if(t-e<=10)this.old.advance(t-e,n,this.reuseWalker);else this.old.advance(5,-1,this.reuseWalker),this.old.advance(t-e-10,-1),this.old.advance(5,n,this.reuseWalker)}getCompositionContext(e){let t=[],n=null;for(let i=e.parentNode;;i=i.parentNode){let r=Ge.get(i);if(i==this.view.contentDOM)break;if(r instanceof on)t.push(r);else if(r===null||r===void 0?void 0:r.isLine())n=r;else if(r instanceof Hr);else if(i.nodeName=="DIV"&&!n)n=new Va(i,F2);else if(!n)t.push(on.of(new nf({tagName:i.nodeName.toLowerCase(),attributes:c6(i)}),i))}if(!n)return null;return{line:n,marks:t}}}function KM(e,t){let n=(i)=>{for(let r of i.children)if((t?r.isText():r.length)||n(r))return!0;return!1};return n(e)}function T6(e){let t=e.isReplace?(e.startSide<0?64:0)|(e.endSide>0?128:0):e.startSide>0?32:16;if(e.block)t|=256;return t}var F2={class:"cm-line"};function M6(e,t){let n=t.spec.attributes,i=t.spec.class;if(!n&&!i)return e;if(!e)e={class:"cm-line"};if(n)ax(n,e);if(i)e.class+=" "+i;return e}function N6(e){let t=[];for(let n=e.parents.length;n>1;n--){let i=n==e.parents.length?e.tile:e.parents[n].tile;if(i instanceof on)t.push(i.mark)}return t}function I0(e){let t=Ge.get(e);if(t)t.setDOM(e.cloneNode());return e}class Xs extends Ho{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}}Xs.inline=new Xs("span");Xs.block=new Xs("div");var H0=new class extends Ho{toDOM(){return document.createElement("br")}get isHidden(){return!0}get editable(){return!0}};class J0{constructor(e){this.view=e,this.decorations=[],this.blockWrappers=[],this.dynamicDecorationMap=[!1],this.domChanged=null,this.hasComposition=null,this.editContextFormatting=Ae.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 lf(e,e.contentDOM),this.updateInner([new Xn(0,0,0,e.state.doc.length)],null)}update(e){var t;let n=e.changedRanges;if(this.minWidth>0&&n.length)if(!n.every(({fromA:u,toA:c})=>c<this.minWidthFrom||u>this.minWidthTo))this.minWidth=this.minWidthFrom=this.minWidthTo=0;else this.minWidthFrom=e.changes.mapPos(this.minWidthFrom,1),this.minWidthTo=e.changes.mapPos(this.minWidthTo,1);this.updateEditContextFormatting(e);let i=-1;if(this.view.inputState.composing>=0&&!this.view.observer.editContext){if((t=this.domChanged)===null||t===void 0?void 0:t.newSel)i=this.domChanged.newSel.head;else if(!V6(e.changes,this.hasComposition)&&!e.selectionSet)i=e.state.selection.main.head}let r=i>-1?L6(this.view,e.changes,i):null;if(this.domChanged=null,this.hasComposition){let{from:u,to:c}=this.hasComposition;n=new Xn(u,c,e.changes.mapPos(u,-1),e.changes.mapPos(c,1)).addToSet(n.slice())}if(this.hasComposition=r?{from:r.range.fromB,to:r.range.toB}:null,(j.ie||j.chrome)&&!r&&e&&e.state.doc.lines!=e.startState.doc.lines)this.forceSelection=!0;let o=this.decorations,s=this.blockWrappers;this.updateDeco();let l=P6(o,this.decorations,e.changes);if(l.length)n=Xn.extendWithRanges(n,l);let a=I6(s,this.blockWrappers,e.changes);if(a.length)n=Xn.extendWithRanges(n,a);if(r&&!n.some((u)=>u.fromA<=r.range.fromA&&u.toA>=r.range.toA))n=r.range.addToSet(n.slice());if(this.tile.flags&2&&n.length==0)return!1;else{if(this.updateInner(n,r),e.transactions.length)this.lastUpdate=Date.now();return!0}}updateInner(e,t){this.view.viewState.mustMeasureContent=!0;let{observer:n}=this.view;n.ignore(()=>{if(t||e.length){let o=this.tile,s=new j2(this.view,o,this.blockWrappers,this.decorations,this.dynamicDecorationMap);if(t&&Ge.get(t.text))s.cache.reused.set(Ge.get(t.text),2);this.tile=s.run(e,t),Z0(o,s.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 r=j.chrome||j.ios?{node:n.selectionRange.focusNode,written:!1}:void 0;if(this.tile.sync(r),r&&(r.written||n.selectionRange.focusNode!=r.node||!this.tile.dom.contains(r.node)))this.forceSelection=!0;this.tile.dom.style.height=""});let i=[];if(this.view.viewport.from||this.view.viewport.to<this.view.state.doc.length){for(let r of this.tile.children)if(r.isWidget()&&r.widget instanceof Bp)i.push(r.dom)}n.updateGaps(i)}updateEditContextFormatting(e){this.editContextFormatting=this.editContextFormatting.map(e.changes);for(let t of e.transactions)for(let n of t.effects)if(n.is(D2))this.editContextFormatting=n.value}updateSelection(e=!1,t=!1){if(e||!this.view.observer.selectionRange.focusNode)this.view.observer.readSelectionRange();let{dom:n}=this.tile,i=this.view.root.activeElement,r=i==n,o=!r&&!(this.view.state.facet(Ir)||n.tabIndex>-1)&&Xc(n,this.view.observer.selectionRange)&&!(i&&n.contains(i));if(!(r||t||o))return;let s=this.forceSelection;this.forceSelection=!1;let l=this.view.state.selection.main,a,u;if(l.empty)u=a=this.inlineDOMNearPos(l.anchor,l.assoc||1);else u=this.inlineDOMNearPos(l.head,l.head==l.from?1:-1),a=this.inlineDOMNearPos(l.anchor,l.anchor==l.from?1:-1);if(j.gecko&&l.empty&&!this.hasComposition&&D6(a)){let f=document.createTextNode("");this.view.observer.ignore(()=>a.node.insertBefore(f,a.node.childNodes[a.offset]||null)),a=u=new xi(f,0),s=!0}let c=this.view.observer.selectionRange;if(s||!c.focusNode||(!Yc(a.node,a.offset,c.anchorNode,c.anchorOffset)||!Yc(u.node,u.offset,c.focusNode,c.focusOffset))&&!this.suppressWidgetCursorChange(c,l))this.view.observer.ignore(()=>{if(j.android&&j.chrome&&n.contains(c.focusNode)&&H6(c.focusNode,n))n.blur(),n.focus({preventScroll:!0});let f=Jc(this.view.root);if(!f);else if(l.empty){if(j.gecko){let d=z6(a.node,a.offset);if(d&&d!=3){let h=(d==1?b2:y2)(a.node,a.offset);if(h)a=new xi(h.node,h.offset)}}if(f.collapse(a.node,a.offset),l.bidiLevel!=null&&f.caretBidiLevel!==void 0)f.caretBidiLevel=l.bidiLevel}else if(f.extend){f.collapse(a.node,a.offset);try{f.extend(u.node,u.offset)}catch(d){}}else{let d=document.createRange();if(l.anchor>l.head)[a,u]=[u,a];d.setEnd(u.node,u.offset),d.setStart(a.node,a.offset),f.removeAllRanges(),f.addRange(d)}if(o&&this.view.root.activeElement==n){if(n.blur(),i)i.focus()}}),this.view.observer.setSelectionRange(a,u);this.impreciseAnchor=a.precise?null:new xi(c.anchorNode,c.anchorOffset),this.impreciseHead=u.precise?null:new xi(c.focusNode,c.focusOffset)}suppressWidgetCursorChange(e,t){return this.hasComposition&&t.empty&&Yc(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,n=Jc(e.root),{anchorNode:i,anchorOffset:r}=e.observer.selectionRange;if(!n||!t.empty||!t.assoc||!n.modify)return;let o=this.lineAt(t.head,t.assoc);if(!o)return;let s=o.posAtStart;if(t.head==s||t.head==s+o.length)return;let l=this.coordsAt(t.head,-1),a=this.coordsAt(t.head,1);if(!l||!a||l.bottom>a.top)return;let u=this.domAtPos(t.head+t.assoc,t.assoc);n.collapse(u.node,u.offset),n.modify("move",t.assoc<0?"forward":"backward","lineboundary"),e.observer.readSelectionRange();let c=e.observer.selectionRange;if(e.docView.posFromDOM(c.anchorNode,c.anchorOffset)!=t.from)n.collapse(i,r)}posFromDOM(e,t){let n=this.tile.nearest(e);if(!n)return this.tile.dom.compareDocumentPosition(e)&2?0:this.view.state.doc.length;let i=n.posAtStart;if(n.isComposite()){let r;if(e==n.dom)r=n.dom.childNodes[t];else{let o=Vr(e)==0?0:t==0?-1:1;for(;;){let s=e.parentNode;if(s==n.dom)break;if(o==0&&s.firstChild!=s.lastChild)if(e==s.firstChild)o=-1;else o=1;e=s}if(o<0)r=e;else r=e.nextSibling}if(r==n.dom.firstChild)return i;while(r&&!Ge.get(r))r=r.nextSibling;if(!r)return i+n.length;for(let o=0,s=i;;o++){let l=n.children[o];if(l.dom==r)return s;s+=l.length+l.breakAfter}}else if(n.isText())return e==n.dom?i+t:i+(t?n.length:0);else return i}domAtPos(e,t){let{tile:n,offset:i}=this.tile.resolveBlock(e,t);if(n.isWidget())return n.domPosFor(i,t);return n.domIn(i,t)}inlineDOMNearPos(e,t){let n,i=-1,r=!1,o,s=-1,l=!1;if(this.tile.blockTiles((a,u)=>{if(a.isWidget()){if(a.flags&32&&u>=e)return!0;if(a.flags&16)r=!0}else{let c=u+a.length;if(u<=e)n=a,i=e-u,r=c<e;if(c>=e&&!o)o=a,s=e-u,l=u>e;if(u>e&&o)return!0}}),!n&&!o)return this.domAtPos(e,t);if(r&&o)n=null;else if(l&&n)o=null;return n&&t<0||!o?n.domIn(i,t):o.domIn(s,t)}coordsAt(e,t,n){let{tile:i,offset:r}=this.tile.resolveBlock(e,t);if(i.isWidget()){if(i.widget instanceof Bp)return null;return i.coordsInWidget(r,t,!0)}return i.coordsIn(r,t,n)}lineAt(e,t){let{tile:n}=this.tile.resolveBlock(e,t);return n.isLine()?n:null}coordsForChar(e){let{tile:t,offset:n}=this.tile.resolveBlock(e,1);if(!t.isLine())return null;function i(r,o){if(r.isComposite())for(let s of r.children){if(s.length>=o){let l=i(s,o);if(l)return l}if(o-=s.length,o<0)break}else if(r.isText()&&o<r.length){let s=wt(r.text,o);if(s==o)return null;let l=ef(r.dom,o,s).getClientRects();for(let a=0;a<l.length;a++){let u=l[a];if(a==l.length-1||u.top<u.bottom&&u.left<u.right)return u}}return null}return i(t,n)}measureVisibleLineHeights(e){let t=[],{from:n,to:i}=e,r=this.view.contentDOM.clientWidth,o=r>Math.max(this.view.scrollDOM.clientWidth,this.minWidth)+1,s=-1,l=this.view.textDirection==Ke.LTR,a=0,u=(c,f,d)=>{for(let h=0;h<c.children.length;h++){if(f>i)break;let m=c.children[h],b=f+m.length,x=m.dom.getBoundingClientRect(),{height:g}=x;if(d&&!h)a+=x.top-d.top;if(m instanceof Hr){if(b>n)u(m,f,x)}else if(f>=n){if(a>0)t.push(-a);if(t.push(g+a),a=0,o){let v=m.dom.lastChild,w=v?Gc(v):[];if(w.length){let S=w[w.length-1],k=l?S.right-x.left:x.right-S.left;if(k>s)s=k,this.minWidth=r,this.minWidthFrom=f,this.minWidthTo=b}}}if(d&&h==c.children.length-1)a+=d.bottom-x.bottom;f=b+m.breakAfter}};return u(this.tile,0,null),t}textDirectionAt(e){let{tile:t}=this.tile.resolveBlock(e,1);return getComputedStyle(t.dom).direction=="rtl"?Ke.RTL:Ke.LTR}measureTextSize(){let e=this.tile.blockTiles((o)=>{if(o.isLine()&&o.children.length&&o.length<=20){let s=0,l;for(let a of o.children){if(!a.isText()||/[^ -~]/.test(a.text))return;let u=Gc(a.dom);if(u.length!=1)return;s+=u[0].width,l=u[0].height}if(s)return{lineHeight:o.dom.getBoundingClientRect().height,charWidth:s/o.length,textHeight:l}}});if(e)return e;let t=document.createElement("div"),n,i,r;return t.className="cm-line",t.style.width="99999px",t.style.position="absolute",t.textContent="abc def ghi jkl mno pqr stu",this.view.observer.ignore(()=>{this.tile.dom.appendChild(t);let o=Gc(t.firstChild)[0];n=t.getBoundingClientRect().height,i=o&&o.width?o.width/27:7,r=o&&o.height?o.height:n,t.remove()}),{lineHeight:n,charWidth:i,textHeight:r}}computeBlockGapDeco(){let e=[],t=this.view.viewState;for(let n=0,i=0;;i++){let r=i==t.viewports.length?null:t.viewports[i],o=r?r.from-1:this.view.state.doc.length;if(o>n){let s=(t.lineBlockAt(o).bottom-t.lineBlockAt(n).top)/this.view.scaleY;e.push(Ae.replace({widget:new Bp(s),block:!0,inclusive:!0,isBlockGap:!0}).range(n,o))}if(!r)break;n=r.to+1}return Ae.set(e)}updateDeco(){let e=1,t=this.view.state.facet(Xp).map((r)=>(this.dynamicDecorationMap[e++]=typeof r=="function")?r(this.view):r),n=!1,i=this.view.state.facet(px).map((r,o)=>{let s=typeof r=="function";if(s)n=!0;return s?r(this.view):r});if(i.length)this.dynamicDecorationMap[e++]=n,t.push(ge.join(i));this.decorations=[this.editContextFormatting,...t,this.computeBlockGapDeco(),this.view.viewState.lineGapDeco];while(e<this.decorations.length)this.dynamicDecorationMap[e++]=!1;this.blockWrappers=this.view.state.facet(z2).map((r)=>typeof r=="function"?r(this.view):r)}scrollIntoView(e){if(e.isSnapshot){let a=this.view.viewState.lineBlockAt(e.range.head);this.view.scrollDOM.scrollTop=a.top-e.yMargin,this.view.scrollDOM.scrollLeft=e.xMargin;return}for(let a of this.view.state.facet(N2))try{if(a(this.view,e.range,e))return!0}catch(u){Xt(this.view.state,u,"scroll handler")}let{range:t}=e,n=this.coordsAt(t.head,t.assoc||(t.head>t.anchor?-1:1)),i;if(!n)return;if(!t.empty&&(i=this.coordsAt(t.anchor,t.anchor>t.head?-1:1)))n={left:Math.min(n.left,i.left),top:Math.min(n.top,i.top),right:Math.max(n.right,i.right),bottom:Math.max(n.bottom,i.bottom)};let r=mx(this.view),o={left:n.left-r.left,top:n.top-r.top,right:n.right+r.right,bottom:n.bottom+r.bottom},{offsetWidth:s,offsetHeight:l}=this.view.scrollDOM;if(h6(this.view.scrollDOM,o,t.head<t.anchor?-1:1,e.x,e.y,Math.max(Math.min(e.xMargin,s),-s),Math.max(Math.min(e.yMargin,l),-l),this.view.textDirection==Ke.LTR),window.visualViewport&&window.innerHeight-window.visualViewport.height>1&&(n.top>window.visualViewport.offsetTop+window.visualViewport.height||n.bottom<window.visualViewport.offsetTop)){let a=this.view.docView.lineAt(t.head,1);if(a){let u=p2(a.dom);a.dom.scrollIntoView({block:"nearest"}),m2(u,!1)}}}lineHasWidget(e){let t=(n)=>n.isWidget()||n.children.some(t);return t(this.tile.resolveBlock(e,1).tile)}destroy(){Z0(this.tile)}}function Z0(e,t){let n=t===null||t===void 0?void 0:t.get(e);if(n!=1){if(n==null)e.destroy();for(let i of e.children)Z0(i,t)}}function D6(e){return e.node.nodeType==1&&e.node.firstChild&&(e.offset==0||e.node.childNodes[e.offset-1].contentEditable=="false")&&(e.offset==e.node.childNodes.length||e.node.childNodes[e.offset].contentEditable=="false")}function q2(e,t){let n=e.observer.selectionRange;if(!n.focusNode)return null;let i=b2(n.focusNode,n.focusOffset),r=y2(n.focusNode,n.focusOffset),o=i||r;if(r&&i&&r.node!=i.node){let l=Ge.get(r.node);if(!l||l.isText()&&l.text!=r.node.nodeValue)o=r;else if(e.docView.lastCompositionAfterCursor){let a=Ge.get(i.node);if(!(!a||a.isText()&&a.text!=i.node.nodeValue))o=r}}if(e.docView.lastCompositionAfterCursor=o!=i,!o)return null;let s=t-o.offset;return{from:s,to:s+o.node.nodeValue.length,node:o.node}}function L6(e,t,n){let i=q2(e,n);if(!i)return null;let{node:r,from:o,to:s}=i,l=r.nodeValue;if(/[\n\r]/.test(l))return null;if(e.state.doc.sliceString(i.from,i.to)!=l)return null;let a=t.invertedDesc;return{range:new Xn(a.mapPos(o),a.mapPos(s),o,s),text:r}}function z6(e,t){if(e.nodeType!=1)return 0;return(t&&e.childNodes[t-1].contentEditable=="false"?1:0)|(t<e.childNodes.length&&e.childNodes[t].contentEditable=="false"?2:0)}var B6=class{constructor(){this.changes=[]}compareRange(t,n){Pa(t,n,this.changes)}comparePoint(t,n){Pa(t,n,this.changes)}boundChange(t){Pa(t,t,this.changes)}};function P6(e,t,n){let i=new B6;return ge.compare(e,t,n,i),i.changes}class $2{constructor(){this.changes=[]}compareRange(e,t){Pa(e,t,this.changes)}comparePoint(){}boundChange(e){Pa(e,e,this.changes)}}function I6(e,t,n){let i=new $2;return ge.compare(e,t,n,i),i.changes}function H6(e,t){for(let n=e;n&&n!=t;n=n.assignedSlot||n.parentNode)if(n.nodeType==1&&n.contentEditable=="false")return!0;return!1}function V6(e,t){let n=!1;if(t)e.iterChangedRanges((i,r)=>{if(i<t.to&&r>t.from)n=!0});return n}class Bp extends Ho{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 U6(e,t,n=1){let i=e.charCategorizer(t),r=e.doc.lineAt(t),o=t-r.from;if(r.length==0)return A.cursor(t);if(o==0)n=1;else if(o==r.length)n=-1;let s=o,l=o;if(n<0)s=wt(r.text,o,!1);else l=wt(r.text,o);let a=i(r.text.slice(s,l));while(s>0){let u=wt(r.text,s,!1);if(i(r.text.slice(u,s))!=a)break;s=u}while(l<r.length){let u=wt(r.text,l);if(i(r.text.slice(l,u))!=a)break;l=u}return A.undirectionalRange(s+r.from,l+r.from)}function K6(e,t,n,i,r){let o=Math.round((i-t.left)*e.defaultCharacterWidth);if(e.lineWrapping&&n.height>e.defaultLineHeight*1.5){let l=e.viewState.heightOracle.textHeight,a=Math.floor((r-n.top-(e.defaultLineHeight-l)*0.5)/l);o+=a*e.viewState.heightOracle.lineLength}let s=e.state.sliceDoc(n.from,n.to);return n.from+RM(s,o,e.state.tabSize)}function j6(e,t,n){let i=e.lineBlockAt(t);if(Array.isArray(i.type)){let r;for(let o of i.type){if(o.from>t)break;if(o.to<t)continue;if(o.from<t&&o.to>t)return o;if(!r||o.type==Gn.Text&&(r.type!=o.type||(n<0?o.from<t:o.to>t)))r=o}return r||i}return i}function F6(e,t,n,i){let r=j6(e,t.head,t.assoc||-1),o=!i||r.type!=Gn.Text||!(e.lineWrapping||r.widgetLineBreaks)?null:e.coordsAtPos(t.assoc<0&&t.head>r.from?t.head-1:t.head);if(o){let s=e.dom.getBoundingClientRect(),l=e.textDirectionAt(r.from),a=e.posAtCoords({x:n==(l==Ke.LTR)?s.right-1:s.left+1,y:(o.top+o.bottom)/2});if(a!=null)return A.cursor(a,n?-1:1)}return A.cursor(n?r.to:r.from,n?-1:1)}function jM(e,t,n,i){let r=e.state.doc.lineAt(t.head),o=e.bidiSpans(r),s=e.textDirectionAt(r.from);for(let l=t,a=null;;){let u=k6(r,o,s,l,n),c=_2;if(!u){if(r.number==(n?e.state.doc.lines:1))return l;c=`
31
+ `,r=e.state.doc.line(r.number+(n?1:-1)),o=e.bidiSpans(r),u=n?A.cursor(r.from,-1):A.cursor(r.to,1)}if(!a){if(!i)return u;a=i(c)}else if(!a(c))return l;l=u}}function q6(e,t,n){let i=e.state.charCategorizer(t),r=i(n);return(o)=>{let s=i(o);if(r==$n.Space)r=s;return r==s}}function $6(e,t,n,i){let r=t.head,o=n?1:-1;if(r==(n?e.state.doc.length:0))return A.cursor(r,t.assoc);let s=t.goalColumn,l,a=e.contentDOM.getBoundingClientRect(),u=e.coordsAtPos(r,t.assoc||((t.empty?n:t.head==t.from)?1:-1)),c=e.documentTop;if(u){if(s==null)s=u.left-a.left;l=o<0?u.top:u.bottom}else{let m=e.viewState.lineBlockAt(r);if(s==null)s=Math.min(a.right-a.left,e.defaultCharacterWidth*(r-m.from));l=(o<0?m.top:m.bottom)+c}let f=a.left+s,d=e.viewState.heightOracle.textHeight>>1,h=i!==null&&i!==void 0?i:d;for(let m=0;;m+=d){let b=l+(h+m)*o,x=ex(e,{x:f,y:b},!1,o);if(n?b>a.bottom:b<a.top)return A.cursor(x.pos,x.assoc);let g=e.coordsAtPos(x.pos,x.assoc),v=g?(g.top+g.bottom)/2:0;if(!g||(n?v>l:v<l))return A.cursor(x.pos,x.assoc,void 0,s)}}function Wc(e,t,n){for(;;){let i=0;for(let r of e)r.between(t-1,t+1,(o,s,l)=>{if(t>o&&t<s){let a=i||n||(t-o<s-t?-1:1);t=a<0?o:s,i=a}});if(!i)return t}}function X2(e,t){let n=null;for(let i=0;i<t.ranges.length;i++){let r=t.ranges[i],o=null;if(r.empty){let s=Wc(e,r.from,0);if(s!=r.from)o=A.cursor(s,-1)}else{let s=Wc(e,r.from,-1),l=Wc(e,r.to,1);if(s!=r.from||l!=r.to)if(r.undirectional)o=A.undirectionalRange(r.from,r.to);else o=A.range(r.from==r.anchor?s:l,r.from==r.head?s:l)}if(o){if(!n)n=t.ranges.slice();n[i]=o}}return n?A.create(n,t.mainIndex):t}function V0(e,t,n){let i=Wc(e.state.facet(of).map((r)=>r(e)),n.from,t.head>n.from?-1:1);return i==n.from?n:A.cursor(i,i<n.from?1:-1)}class bi{constructor(e,t){this.pos=e,this.assoc=t}}function ex(e,t,n,i){let r=e.contentDOM.getBoundingClientRect(),o=r.top+e.viewState.paddingTop,{x:s,y:l}=t,a=l-o,u;for(;;){if(a<0)return new bi(0,1);if(a>e.viewState.docHeight)return new bi(e.state.doc.length,-1);if(u=e.elementAtHeight(a),i==null)break;if(u.type==Gn.Text){if(i<0?u.to<e.viewport.from:u.from>e.viewport.to)break;let d=e.docView.coordsAt(i<0?u.from:u.to,i>0?-1:1);if(d&&(i<0?d.top<=a+o:d.bottom>=a+o))break}let f=e.viewState.heightOracle.textHeight/2;a=i>0?u.bottom+f:u.top-f}if(e.viewport.from>=u.to||e.viewport.to<=u.from){if(n)return null;if(u.type==Gn.Text){let f=K6(e,r,u,s,l);return new bi(f,f==u.from?1:-1)}}if(u.type!=Gn.Text)return a<(u.top+u.bottom)/2?new bi(u.from,1):new bi(u.to,-1);let c=e.docView.lineAt(u.from,2);if(!c||c.length!=u.length)c=e.docView.lineAt(u.from,-2);return new G2(e,s,l,e.textDirectionAt(u.from)).scanTile(c,u.from)}class G2{constructor(e,t,n,i){this.view=e,this.x=t,this.y=n,this.baseDir=i,this.line=null,this.spans=null}bidiSpansAt(e){if(!this.line||this.line.from>e||this.line.to<e)this.line=this.view.state.doc.lineAt(e),this.spans=this.view.bidiSpans(this.line);return this}baseDirAt(e,t){let{line:n,spans:i}=this.bidiSpansAt(e);return i[wi.find(i,e-n.from,-1,t)].level==this.baseDir}dirAt(e,t){let{line:n,spans:i}=this.bidiSpansAt(e);return i[wi.find(i,e-n.from,-1,t)].dir}bidiIn(e,t){let{spans:n,line:i}=this.bidiSpansAt(e);return n.length>1||n.length&&(n[0].level!=this.baseDir||n[0].to+i.from<t)}scan(e,t,n=!1){let i=0,r=e.length-1,o=new Set,s=this.bidiIn(e[0],e[r]),l,a,u=-1,c=1e9,f;e:while(i<r){let h=r-i,m=i+r>>1;t:if(o.has(m)){for(let g=1;g<h;g++){let v=m+g;if(v>=r)v-=h;if(!o.has(v)){m=v;break t}}break e}o.add(m);let b=t(m),x=0;if(b)for(let g=0;g<b.length;g++){let v=b[g];if(v.width==0&&b.length>1)continue;if(v.bottom<this.y){if(!l||l.bottom<v.bottom)l=v;x=1}else if(v.top>this.y){if(!a||a.top>v.top)a=v;x=-1}else{let w=v.left>this.x?this.x-v.left:v.right<this.x?this.x-v.right:0,S=Math.abs(w);if(S<c)u=m,c=S,f=v;if(w)x=w<0==(this.baseDir==Ke.LTR)?-1:1}}if(x==-1&&(!s||this.baseDirAt(e[m],1)))r=m;else if(x==1&&(!s||this.baseDirAt(e[m+1],-1)))i=m+1}if(!f){if(!a&&!l)return{i:0,after:!1};let h=l&&(!a||this.y-l.bottom<a.top-this.y)?l:a;return this.y=(h.top+h.bottom)/2,this.scan(e,t,!0)}if(c&&!n){let{top:h,bottom:m}=f;if(l&&l.bottom>(h+h+m)/3)return this.y=l.bottom-1,this.scan(e,t,!0);if(a&&a.top<(h+m+m)/3)return this.y=a.top+1,this.scan(e,t,!0)}let d=(s?this.dirAt(e[u],1):this.baseDir)==Ke.LTR;return{i:u,after:this.x>(f.left+f.right)/2==d}}scanText(e,t){let n=[];for(let r=0;r<e.length;r=wt(e.text,r))n.push(t+r);n.push(t+e.length);let i=this.scan(n,(r)=>{let o=n[r]-t,s=n[r+1]-t;return ef(e.dom,o,s).getClientRects()});return i.after?new bi(n[i.i+1],-1):new bi(n[i.i],1)}scanTile(e,t){if(!e.length)return new bi(t,1);if(e.children.length==1){let s=e.children[0];if(s.isText())return this.scanText(s,t);else if(s.isComposite())return this.scanTile(s,t)}let n=[t];for(let s=0,l=t;s<e.children.length;s++)n.push(l+=e.children[s].length);let i=this.scan(n,(s)=>{let l=e.children[s];if(l.flags&48)return null;return(l.dom.nodeType==1?l.dom:ef(l.dom,0,l.length)).getClientRects()}),r=e.children[i.i],o=n[i.i];if(r.isText())return this.scanText(r,o);if(r.isComposite())return this.scanTile(r,o);return i.after?new bi(n[i.i+1],-1):new bi(o,1)}}var za="￿";class Y2{constructor(e,t){this.points=e,this.view=t,this.text="",this.lineSeparator=t.state.facet(pe.lineSeparator)}append(e){this.text+=e}lineBreak(){this.text+=za}readRange(e,t){if(!e)return this;let n=e.parentNode;for(let i=e;;){this.findPointBefore(n,i);let r=this.text.length;this.readNode(i);let o=Ge.get(i),s=i.nextSibling;if(s==t){if((o===null||o===void 0?void 0:o.breakAfter)&&!s&&n!=this.view.contentDOM)this.lineBreak();break}let l=Ge.get(s);if((o&&l?o.breakAfter:(o?o.breakAfter:Vp(i))||Vp(s)&&(i.nodeName!="BR"||(o===null||o===void 0?void 0:o.isWidget()))&&this.text.length>r)&&!G6(s,t))this.lineBreak();i=s}return this.findPointBefore(n,t),this}readTextNode(e){let t=e.nodeValue;for(let n of this.points)if(n.node==e)n.pos=this.text.length+Math.min(n.offset,t.length);for(let n=0,i=this.lineSeparator?null:/\r\n?|\n/g;;){let r=-1,o=1,s;if(this.lineSeparator)r=t.indexOf(this.lineSeparator,n),o=this.lineSeparator.length;else if(s=i.exec(t))r=s.index,o=s[0].length;if(this.append(t.slice(n,r<0?t.length:r)),r<0)break;if(this.lineBreak(),o>1){for(let l of this.points)if(l.node==e&&l.pos>this.text.length)l.pos-=o-1}n=r+o}}readNode(e){let t=Ge.get(e),n=t&&t.overrideDOMText;if(n!=null){this.findPointInside(e,n.length);for(let i=n.iter();!i.next().done;)if(i.lineBreak)this.lineBreak();else this.append(i.value)}else if(e.nodeType==3)this.readTextNode(e);else if(e.nodeName=="BR"){if(e.nextSibling)this.lineBreak()}else if(e.nodeType==1)this.readRange(e.firstChild,null)}findPointBefore(e,t){for(let n of this.points)if(n.node==e&&e.childNodes[n.offset]==t)n.pos=this.text.length}findPointInside(e,t){for(let n of this.points)if(e.nodeType==3?n.node==e:e.contains(n.node))n.pos=this.text.length+(X6(e,n.node,n.offset)?t:0)}}function X6(e,t,n){for(;;){if(!t||n<Vr(t))return!1;if(t==e)return!0;n=Po(t)+1,t=t.parentNode}}function G6(e,t){let n;for(;;e=e.nextSibling){if(e==t||!e)break;let i=Ge.get(e);if(!(i===null||i===void 0?void 0:i.isWidget()))return!1;if(i)(n||(n=[])).push(i)}if(n)for(let i of n){let r=i.overrideDOMText;if(r===null||r===void 0?void 0:r.length)return!1}return!0}class tx{constructor(e,t){this.node=e,this.offset=t,this.pos=-1}}class W2{constructor(e,t,n,i){this.typeOver=i,this.bounds=null,this.text="",this.domChanged=t>-1;let{impreciseHead:r,impreciseAnchor:o}=e.docView,s=e.state.selection;if(e.state.readOnly&&t>-1)this.newSel=null;else if(t>-1&&(this.bounds=Q2(e.docView.tile,t,n,0))){let l=r||o?[]:W6(e),a=new Y2(l,e);a.readRange(this.bounds.startDOM,this.bounds.endDOM),this.text=a.text,this.newSel=Q6(l,this.bounds.from)}else{let l=e.observer.selectionRange,a=r&&r.node==l.focusNode&&r.offset==l.focusOffset||!X0(e.contentDOM,l.focusNode)?s.main.head:e.docView.posFromDOM(l.focusNode,l.focusOffset),u=o&&o.node==l.anchorNode&&o.offset==l.anchorOffset||!X0(e.contentDOM,l.anchorNode)?s.main.anchor:e.docView.posFromDOM(l.anchorNode,l.anchorOffset),c=e.viewport;if((j.ios||j.chrome)&&a!=u&&Math.min(a,u)<=s.main.from&&Math.max(a,u)>=s.main.to&&(c.from>0||c.to<e.state.doc.length)){let f=Math.min(a,u),d=Math.max(a,u),h=c.from-f,m=c.to-d;if((h==0||h==1||f==0)&&(m==0||m==-1||d==e.state.doc.length))a=0,u=e.state.doc.length}if(e.inputState.composing>-1&&s.ranges.length>1)this.newSel=s.replaceRange(A.range(u,a));else if(e.lineWrapping&&u==a&&!(s.main.empty&&s.main.head==a)&&e.inputState.lastTouchTime>Date.now()-100){let f=e.coordsAtPos(a,-1),d=0;if(f)d=e.inputState.lastTouchY<=f.bottom?-1:1;this.newSel=A.create([A.cursor(a,d)])}else this.newSel=A.single(u,a)}}}function Q2(e,t,n,i){if(e.isComposite()){let r=-1,o=-1,s=-1,l=-1;for(let a=0,u=i,c=i;a<e.children.length;a++){let f=e.children[a],d=u+f.length;if(u<t&&d>n)return Q2(f,t,n,u);if(d>=t&&r==-1)r=a,o=u;if(u>n&&f.dom.parentNode==e.dom){s=a,l=c;break}c=d,u=d+f.breakAfter}return{from:o,to:l<0?i+e.length:l,startDOM:(r?e.children[r-1].dom.nextSibling:null)||e.dom.firstChild,endDOM:s<e.children.length&&s>=0?e.children[s].dom:null}}else if(e.isText())return{from:i,to:i+e.length,startDOM:e.dom,endDOM:e.dom.nextSibling};else return null}function J2(e,t){let n,{newSel:i}=t,{state:r}=e,o=r.selection.main,s=e.inputState.lastKeyTime>Date.now()-100?e.inputState.lastKeyCode:-1;if(t.bounds){let{from:l,to:a}=t.bounds,u=o.from,c=null;if(s===8||j.android&&t.text.length<a-l)u=o.to,c="end";let f=r.doc.sliceString(l,a,za),d,h;if(!o.empty&&o.from>=l&&o.to<=a&&(t.typeOver||f!=t.text)&&f.slice(0,o.from-l)==t.text.slice(0,o.from-l)&&f.slice(o.to-l)==t.text.slice(d=t.text.length-(f.length-(o.to-l))))n={from:o.from,to:o.to,insert:he.of(t.text.slice(o.from-l,d).split(za))};else if(h=Z2(f,t.text,u-l,c)){if(j.chrome&&s==13&&h.toB==h.from+2&&t.text.slice(h.from,h.toB)==za+za)h.toB--;n={from:l+h.from,to:l+h.toA,insert:he.of(t.text.slice(h.from,h.toB).split(za))}}}else if(i&&(!e.hasFocus&&r.facet(Ir)||jp(i,o)))i=null;if(!n&&!i)return!1;if((j.mac||j.android)&&n&&n.from==n.to&&n.from==o.head-1&&/^\. ?$/.test(n.insert.toString())&&e.contentDOM.getAttribute("autocorrect")=="off"){if(i&&n.insert.length==2)i=A.single(i.main.anchor-1,i.main.head-1);n={from:n.from,to:n.to,insert:he.of([n.insert.toString().replace("."," ")])}}else if(r.doc.lineAt(o.from).to<o.to&&e.docView.lineHasWidget(o.to)&&e.inputState.insertingTextAt>Date.now()-50)n={from:o.from,to:o.to,insert:r.toText(e.inputState.insertingText)};else if(j.chrome&&n&&n.from==n.to&&n.from==o.head&&n.insert.toString()==`
32
+ `&&e.lineWrapping){if(i)i=A.single(i.main.anchor-1,i.main.head-1);n={from:o.from,to:o.to,insert:he.of([" "])}}if(n)return gx(e,n,i,s);else if(i&&!jp(i,o)){let l=!1,a="select";if(e.inputState.lastSelectionTime>Date.now()-50){if(e.inputState.lastSelectionOrigin=="select")l=!0;if(a=e.inputState.lastSelectionOrigin,a=="select.pointer")i=X2(r.facet(of).map((u)=>u(e)),i)}return e.dispatch({selection:i,scrollIntoView:l,userEvent:a}),!0}else return!1}function gx(e,t,n,i=-1){if(j.ios&&e.inputState.flushIOSKey(t))return!0;let r=e.state.selection.main;if(j.android&&(t.to==r.to&&(t.from==r.from||t.from==r.from-1&&e.state.sliceDoc(t.from,r.from)==" ")&&t.insert.length==1&&t.insert.lines==2&&Ia(e.contentDOM,"Enter",13)||(t.from==r.from-1&&t.to==r.to&&t.insert.length==0||i==8&&t.insert.length<t.to-t.from&&t.to>r.head)&&Ia(e.contentDOM,"Backspace",8)||t.from==r.from&&t.to==r.to+1&&t.insert.length==0&&Ia(e.contentDOM,"Delete",46)))return!0;let o=t.insert.toString();if(e.inputState.composing>=0)e.inputState.composing++;let s,l=()=>s||(s=Y6(e,t,n));if(!e.state.facet(A2).some((a)=>a(e,t.from,t.to,o,l)))e.dispatch(l());return!0}function Y6(e,t,n){let i,r=e.state,o=r.selection.main,s=-1;if(t.from==t.to&&t.from<o.from||t.from>o.to){let a=t.from<o.from?-1:1,u=a<0?o.from:o.to,c=Wc(r.facet(of).map((f)=>f(e)),u,a);if(t.from==c)s=c}if(s>-1)i={changes:t,selection:A.cursor(t.from+t.insert.length,-1)};else if(t.from>=o.from&&t.to<=o.to&&t.to-t.from>=(o.to-o.from)/3&&(!n||n.main.empty&&n.main.from==t.from+t.insert.length)&&e.inputState.composing<0){let a=o.from<t.from?r.sliceDoc(o.from,t.from):"",u=o.to>t.to?r.sliceDoc(t.to,o.to):"";i=r.replaceSelection(e.state.toText(a+t.insert.sliceString(0,void 0,e.state.lineBreak)+u))}else{let a=r.changes(t),u=n&&n.main.to<=a.newLength?n.main:void 0;if(r.selection.ranges.length>1&&(e.inputState.composing>=0||e.inputState.compositionPendingChange)&&t.to<=o.to+10&&t.to>=o.to-10){let c=e.state.sliceDoc(t.from,t.to),f,d=n&&q2(e,n.main.head);if(d){let m=t.insert.length-(t.to-t.from);f={from:d.from,to:d.to-m}}else f=e.state.doc.lineAt(o.head);let h=o.to-t.to;i=r.changeByRange((m)=>{if(m.from==o.from&&m.to==o.to)return{changes:a,range:u||m.map(a)};let b=m.to-h,x=b-c.length;if(e.state.sliceDoc(x,b)!=c||b>=f.from&&x<=f.to)return{range:m};let g=r.changes({from:x,to:b,insert:t.insert}),v=m.to-o.to;return{changes:g,range:!u?m.map(g):A.range(Math.max(0,u.anchor+v),Math.max(0,u.head+v))}})}else i={changes:a,selection:u&&r.selection.replaceRange(u)}}let l="input.type";if(e.composing||e.inputState.compositionPendingChange&&e.inputState.compositionEndedAt>Date.now()-50){if(e.inputState.compositionPendingChange=!1,l+=".compose",e.inputState.compositionFirstChange)l+=".start",e.inputState.compositionFirstChange=!1}return r.update(i,{userEvent:l,scrollIntoView:!0})}function Z2(e,t,n,i){let r=Math.min(e.length,t.length),o=0;while(o<r&&e.charCodeAt(o)==t.charCodeAt(o))o++;if(o==r&&e.length==t.length)return null;let s=e.length,l=t.length;while(s>0&&l>0&&e.charCodeAt(s-1)==t.charCodeAt(l-1))s--,l--;if(i=="end"){let a=Math.max(0,o-Math.min(s,l));n-=s+a-o}if(s<o&&e.length<t.length){let a=n<=o&&n>=s?o-n:0;o-=a,l=o+(l-s),s=o}else if(l<o){let a=n<=o&&n>=l?o-n:0;o-=a,s=o+(s-l),l=o}return{from:o,toA:s,toB:l}}function W6(e){let t=[];if(e.root.activeElement!=e.contentDOM)return t;let{anchorNode:n,anchorOffset:i,focusNode:r,focusOffset:o}=e.observer.selectionRange;if(n){if(t.push(new tx(n,i)),r!=n||o!=i)t.push(new tx(r,o))}return t}function Q6(e,t){if(e.length==0)return null;let n=e[0].pos,i=e.length==2?e[1].pos:n;return n<0||i<0?null:n==i?A.create([A.cursor(i+t,-1)]):A.single(n+t,i+t)}function jp(e,t){return t.head==e.main.head&&t.anchor==e.main.anchor}class eN{setSelectionOrigin(e){this.lastSelectionOrigin=e,this.lastSelectionTime=Date.now()}constructor(e){if(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,j.safari)e.contentDOM.addEventListener("input",()=>null);if(j.gecko)dH(e.contentDOM.ownerDocument)}handleEvent(e){if(!oH(this.view,e)||this.ignoreDuringComposition(e))return;if(e.type=="keydown"&&this.keydown(e))return;if(this.view.updateState!=0)Promise.resolve().then(()=>this.runHandlers(e.type,e));else this.runHandlers(e.type,e)}runHandlers(e,t){let n=this.handlers[e];if(n){for(let i of n.observers)i(this.view,t);for(let i of n.handlers){if(t.defaultPrevented)break;if(i(this.view,t)){t.preventDefault();break}}}}ensureHandlers(e){let t=Z6(e),n=this.handlers,i=this.view.contentDOM;for(let r in t)if(r!="scroll"){let o=!t[r].handlers.length,s=n[r];if(s&&o!=!s.handlers.length)i.removeEventListener(r,this.handleEvent),s=null;if(!s)i.addEventListener(r,this.handleEvent,{passive:o})}for(let r in n)if(r!="scroll"&&!t[r])i.removeEventListener(r,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&&nN.indexOf(e.keyCode)<0)this.tabFocusMode=-1;if(j.android&&j.chrome&&!e.synthetic&&(e.keyCode==13||e.keyCode==8))return this.view.observer.delayAndroidKey(e.key,e.keyCode),!0;if(j.ios&&!e.synthetic&&!e.altKey&&!e.metaKey&&(tN.some((t)=>t.keyCode==e.keyCode)&&!e.ctrlKey||eH.indexOf(e.key)>-1&&e.ctrlKey)){let t={ctrlKey:e.ctrlKey,altKey:e.altKey,metaKey:e.metaKey,shiftKey:e.shiftKey};if(t.shiftKey&&j.ios&&!/^(off|none)$/.test(this.view.contentDOM.autocapitalize)&&J6(this.view.win))t.shiftKey=!1;let n=this.pendingIOSKey={key:e.key,keyCode:e.keyCode,mods:t};return setTimeout(()=>{if(this.pendingIOSKey==n)this.flushIOSKey()},50),!0}if(e.keyCode!=229)this.view.observer.forceFlush();return!1}flushIOSKey(e){let t=this.pendingIOSKey;if(!t||this.view.observer.pendingRecords().length)return!1;if(t.key=="Enter"&&e&&e.from<e.to&&/^\S+$/.test(e.insert.toString()))return!1;return this.pendingIOSKey=void 0,Ia(this.view.contentDOM,t.key,t.keyCode,t.mods)}ignoreDuringComposition(e){if(!/^key/.test(e.type)||e.synthetic)return!1;if(this.composing>0)return!0;if(j.safari&&!j.ios&&this.compositionPendingKey&&Date.now()-this.compositionEndedAt<100)return this.compositionPendingKey=!1,!0;return!1}startMouseSelection(e){if(this.mouseSelection)this.mouseSelection.destroy();this.mouseSelection=e}update(e){if(this.view.observer.update(e),this.mouseSelection)this.mouseSelection.update(e);if(this.draggedContent&&e.docChanged)this.draggedContent=this.draggedContent.map(e.changes);if(e.transactions.length)this.lastKeyCode=this.lastSelectionTime=0}destroy(){if(this.mouseSelection)this.mouseSelection.destroy()}}function J6(e){if(!e.visualViewport)return!1;return e.visualViewport.height*e.visualViewport.scale/e.document.documentElement.clientHeight<0.85}function FM(e,t){return(n,i)=>{try{return t.call(e,i,n)}catch(r){Xt(n.state,r)}}}function Z6(e){let t=Object.create(null);function n(i){return t[i]||(t[i]={observers:[],handlers:[]})}for(let i of e){let r=i.spec,o=r&&r.plugin.domEventHandlers,s=r&&r.plugin.domEventObservers;if(o)for(let l in o){let a=o[l];if(a)n(l).handlers.push(FM(i.value,a))}if(s)for(let l in s){let a=s[l];if(a)n(l).observers.push(FM(i.value,a))}}for(let i in Si)n(i).handlers.push(Si[i]);for(let i in Yt)n(i).observers.push(Yt[i]);return t}var tN=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Enter",keyCode:13,inputType:"insertLineBreak"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],eH="dthko",nN=[16,17,18,20,91,92,224,225],Rp=6;function Ap(e){return Math.max(0,e)*0.7+8}function tH(e,t){return Math.max(Math.abs(e.clientX-t.clientX),Math.abs(e.clientY-t.clientY))}class iN{constructor(e,t,n,i){this.view=e,this.startEvent=t,this.style=n,this.mustSelect=i,this.scrollSpeed={x:0,y:0},this.scrolling=-1,this.lastEvent=t,this.scrollParents=d2(e.contentDOM),this.atoms=e.state.facet(of).map((o)=>o(e));let r=e.contentDOM.ownerDocument;r.addEventListener("mousemove",this.move=this.move.bind(this)),r.addEventListener("mouseup",this.up=this.up.bind(this)),this.extend=t.shiftKey,this.multiple=e.state.facet(pe.allowMultipleSelections)&&nH(e,t),this.dragging=rH(e,t)&&sN(t)==1?null:!1}start(e){if(this.dragging===!1)this.select(e)}move(e){if(e.buttons==0)return this.destroy();if(this.dragging||this.dragging==null&&tH(this.startEvent,e)<10)return;this.select(this.lastEvent=e);let t=0,n=0,i=0,r=0,o=this.view.win.innerWidth,s=this.view.win.innerHeight;if(this.scrollParents.x)({left:i,right:o}=this.scrollParents.x.getBoundingClientRect());if(this.scrollParents.y)({top:r,bottom:s}=this.scrollParents.y.getBoundingClientRect());let l=mx(this.view);if(e.clientX-l.left<=i+Rp)t=-Ap(i-e.clientX);else if(e.clientX+l.right>=o-Rp)t=Ap(e.clientX-o);if(e.clientY-l.top<=r+Rp)n=-Ap(r-e.clientY);else if(e.clientY+l.bottom>=s-Rp)n=Ap(e.clientY-s);this.setScrollSpeed(t,n)}up(e){if(this.dragging==null)this.select(this.lastEvent);if(!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){if(this.scrollSpeed={x:e,y:t},e||t){if(this.scrolling<0)this.scrolling=setInterval(()=>this.scroll(),50)}else if(this.scrolling>-1)clearInterval(this.scrolling),this.scrolling=-1}scroll(){let{x:e,y:t}=this.scrollSpeed;if(e&&this.scrollParents.x)this.scrollParents.x.scrollLeft+=e,e=0;if(t&&this.scrollParents.y)this.scrollParents.y.scrollTop+=t,t=0;if(e||t)this.view.win.scrollBy(e,t);if(this.dragging===!1)this.select(this.lastEvent)}select(e){let{view:t}=this,n=X2(this.atoms,this.style.get(e,this.extend,this.multiple));if(this.mustSelect||!n.eq(t.state.selection,this.dragging===!1))this.view.dispatch({selection:n,userEvent:"select.pointer"});this.mustSelect=!1}update(e){if(e.transactions.some((t)=>t.isUserEvent("input.type")))this.destroy();else if(this.style.update(e))setTimeout(()=>this.select(this.lastEvent),20)}}function nH(e,t){let n=e.state.facet(C2);return n.length?n[0](t):j.mac?t.metaKey:t.ctrlKey}function iH(e,t){let n=e.state.facet(E2);return n.length?n[0](t):j.mac?!t.altKey:!t.ctrlKey}function rH(e,t){let{main:n}=e.state.selection;if(n.empty)return!1;let i=Jc(e.root);if(!i||i.rangeCount==0)return!0;let r=i.getRangeAt(0).getClientRects();for(let o=0;o<r.length;o++){let s=r[o];if(s.left<=t.clientX&&s.right>=t.clientX&&s.top<=t.clientY&&s.bottom>=t.clientY)return!0}return!1}function oH(e,t){if(!t.bubbles)return!0;if(t.defaultPrevented)return!1;for(let n=t.target,i;n!=e.contentDOM;n=n.parentNode)if(!n||n.nodeType==11||(i=Ge.get(n))&&i.isWidget()&&!i.isHidden&&i.widget.ignoreEvent(t))return!1;return!0}var Si=Object.create(null),Yt=Object.create(null),rN=j.ie&&j.ie_version<15||j.ios&&j.webkit_version<604;function sH(e){let t=e.dom.parentNode;if(!t)return;let n=t.appendChild(document.createElement("textarea"));n.style.cssText="position: fixed; left: -10000px; top: 10px",n.focus(),setTimeout(()=>{e.focus(),n.remove(),oN(e,n.value)},50)}function Gp(e,t,n){for(let i of e.facet(t))n=i(n,e);return n}function oN(e,t){t=Gp(e.state,fx,t);let{state:n}=e,i,r=1,o=n.toText(t),s=o.lines==n.selection.ranges.length;if(nx!=null&&n.selection.ranges.every((a)=>a.empty)&&nx==o.toString()){let a=-1;i=n.changeByRange((u)=>{let c=n.doc.lineAt(u.from);if(c.from==a)return{range:u};a=c.from;let f=n.toText((s?o.line(r++).text:t)+n.lineBreak);return{changes:{from:c.from,insert:f},range:A.cursor(u.from+f.length,-1)}})}else if(s)i=n.changeByRange((a)=>{let u=o.line(r++);return{changes:{from:a.from,to:a.to,insert:u.text},range:A.cursor(a.from+u.length,-1)}});else i=n.replaceSelection(o);e.dispatch(i,{userEvent:"input.paste",scrollIntoView:!0})}Yt.scroll=(e)=>{let t=e.inputState;if(t.lastScrollTop=e.scrollDOM.scrollTop,t.lastScrollLeft=e.scrollDOM.scrollLeft,j.ios&&!t.touchActive)t.lastIOSMomentumScroll=Date.now()};Yt.wheel=Yt.mousewheel=(e)=>{e.inputState.lastWheelEvent=Date.now()};Si.keydown=(e,t)=>{if(e.inputState.setSelectionOrigin("select"),t.keyCode==27&&e.inputState.tabFocusMode!=0)e.inputState.tabFocusMode=Date.now()+2000;return!1};Yt.touchstart=(e,t)=>{let n=e.inputState,i=t.targetTouches[0];if(n.touchActive=!0,n.lastTouchTime=Date.now(),i)n.lastTouchX=i.clientX,n.lastTouchY=i.clientY;n.setSelectionOrigin("select.pointer")};Yt.touchmove=(e)=>{e.inputState.setSelectionOrigin("select.pointer")};Yt.touchend=(e,t)=>{e.inputState.touchActive=!1};Si.mousedown=(e,t)=>{if(e.observer.flush(),e.inputState.lastTouchTime>Date.now()-2000)return!1;let n=null;for(let i of e.state.facet(O2))if(n=i(e,t),n)break;if(!n&&t.button==0)n=aH(e,t);if(n){let i=!e.hasFocus;if(e.inputState.startMouseSelection(new iN(e,t,n,i)),i)e.observer.ignore(()=>{g2(e.contentDOM);let o=e.root.activeElement;if(o&&!o.contains(e.contentDOM))o.blur()});let r=e.inputState.mouseSelection;if(r)return r.start(t),r.dragging===!1}else e.inputState.setSelectionOrigin("select.pointer");return!1};function qM(e,t,n,i){if(i==1)return A.cursor(t,n);else if(i==2)return U6(e.state,t,n);else{let r=e.docView.lineAt(t,n),o=e.state.doc.lineAt(r?r.posAtEnd:t),s=r?r.posAtStart:o.from,l=r?r.posAtEnd:o.to;if(l<e.state.doc.length&&l==o.to)l++;return A.undirectionalRange(s,l)}}var lH=j.ie&&j.ie_version<=11,$M=null,XM=0,GM=0;function sN(e){if(!lH)return e.detail;let t=$M,n=GM;return $M=e,GM=Date.now(),XM=!t||n>Date.now()-400&&Math.abs(t.clientX-e.clientX)<2&&Math.abs(t.clientY-e.clientY)<2?(XM+1)%3:1}function aH(e,t){let n=e.posAndSideAtCoords({x:t.clientX,y:t.clientY},!1),i=sN(t),r=e.state.selection;return{update(o){if(o.docChanged)n.pos=o.changes.mapPos(n.pos),r=r.map(o.changes)},get(o,s,l){let a=e.posAndSideAtCoords({x:o.clientX,y:o.clientY},!1),u,c=qM(e,a.pos,a.assoc,i);if(n.pos!=a.pos&&!s){let f=qM(e,n.pos,n.assoc,i),d=Math.min(f.from,c.from),h=Math.max(f.to,c.to);c=d<c.from?A.range(d,h,c.assoc):A.range(h,d,c.assoc)}if(s)return r.replaceRange(r.main.extend(c.from,c.to,c.assoc));else if(l&&i==1&&r.ranges.length>1&&(u=uH(r,a.pos)))return u;else if(l)return r.addRange(c);else return A.create([c])}}}function uH(e,t){for(let n=0;n<e.ranges.length;n++){let{from:i,to:r}=e.ranges[n];if(i<=t&&r>=t)return A.create(e.ranges.slice(0,n).concat(e.ranges.slice(n+1)),e.mainIndex==n?0:e.mainIndex-(e.mainIndex>n?1:0))}return null}Si.dragstart=(e,t)=>{let{selection:{main:n}}=e.state;if(t.target.draggable){let r=e.docView.tile.nearest(t.target);if(r&&r.isWidget()){let o=r.posAtStart,s=o+r.length;if(o>=n.to||s<=n.from)n=A.undirectionalRange(o,s)}}let{inputState:i}=e;if(i.mouseSelection)i.mouseSelection.dragging=!0;if(i.draggedContent=n,t.dataTransfer)t.dataTransfer.setData("Text",Gp(e.state,dx,e.state.sliceDoc(n.from,n.to))),t.dataTransfer.effectAllowed="copyMove";return!1};Si.dragend=(e)=>(e.inputState.draggedContent=null,!1);function YM(e,t,n,i){if(n=Gp(e.state,fx,n),!n)return;let r=e.posAtCoords({x:t.clientX,y:t.clientY},!1),{draggedContent:o}=e.inputState,s=i&&o&&iH(e,t)?{from:o.from,to:o.to}:null,l={from:r,insert:n},a=e.state.changes(s?[s,l]:l);e.focus(),e.dispatch({changes:a,selection:{anchor:a.mapPos(r,-1),head:a.mapPos(r,1)},userEvent:s?"move.drop":"input.drop"}),e.inputState.draggedContent=null}Si.drop=(e,t)=>{if(!t.dataTransfer)return!1;if(e.state.readOnly)return!0;let n=t.dataTransfer.files;if(n&&n.length){let i=Array(n.length),r=0,o=()=>{if(++r==n.length)YM(e,t,i.filter((s)=>s!=null).join(e.state.lineBreak),!1)};for(let s=0;s<n.length;s++){let l=new FileReader;l.onerror=o,l.onload=()=>{if(!/[\x00-\x08\x0e-\x1f]{2}/.test(l.result))i[s]=l.result;o()},l.readAsText(n[s])}return!0}else{let i=t.dataTransfer.getData("Text");if(i)return YM(e,t,i,!0),!0}return!1};Si.paste=(e,t)=>{if(e.state.readOnly)return!0;e.observer.flush();let n=rN?null:t.clipboardData;if(n)return oN(e,n.getData("text/plain")||n.getData("text/uri-list")),!0;else return sH(e),!1};function cH(e,t){let n=e.dom.parentNode;if(!n)return;let i=n.appendChild(document.createElement("textarea"));i.style.cssText="position: fixed; left: -10000px; top: 10px",i.value=t,i.focus(),i.selectionEnd=t.length,i.selectionStart=0,setTimeout(()=>{i.remove(),e.focus()},50)}function fH(e){let t=[],n=[],i=!1;for(let r of e.selection.ranges)if(!r.empty)t.push(e.sliceDoc(r.from,r.to)),n.push(r);if(!t.length){let r=-1;for(let{from:o}of e.selection.ranges){let s=e.doc.lineAt(o);if(s.number>r)t.push(s.text),n.push({from:s.from,to:Math.min(e.doc.length,s.to+1)});r=s.number}i=!0}return{text:Gp(e,dx,t.join(e.lineBreak)),ranges:n,linewise:i}}var nx=null;Si.copy=Si.cut=(e,t)=>{if(!Xc(e.contentDOM,e.observer.selectionRange))return!1;let{text:n,ranges:i,linewise:r}=fH(e.state);if(!n&&!r)return!1;if(nx=r?n:null,t.type=="cut"&&!e.state.readOnly)e.dispatch({changes:i,scrollIntoView:!0,userEvent:"delete.cut"});let o=rN?null:t.clipboardData;if(o)return o.clearData(),o.setData("text/plain",n),!0;else return cH(e,n),!1};var lN=_n.define();function aN(e,t){let n=[];for(let i of e.facet(T2)){let r=i(e,t);if(r)n.push(r)}return n.length?e.update({effects:n,annotations:lN.of(!0)}):null}function uN(e){setTimeout(()=>{let t=e.hasFocus;if(t!=e.inputState.notifiedFocused){let n=aN(e.state,t);if(n)e.dispatch(n);else e.update([])}},10)}Yt.focus=(e)=>{if(e.inputState.lastFocusTime=Date.now(),!e.scrollDOM.scrollTop&&(e.inputState.lastScrollTop||e.inputState.lastScrollLeft))e.scrollDOM.scrollTop=e.inputState.lastScrollTop,e.scrollDOM.scrollLeft=e.inputState.lastScrollLeft;uN(e)};Yt.blur=(e)=>{e.observer.clearSelectionRange(),uN(e)};Yt.compositionstart=Yt.compositionupdate=(e)=>{if(e.observer.editContext)return;if(e.inputState.compositionFirstChange==null)e.inputState.compositionFirstChange=!0;if(e.inputState.composing<0){let{main:t}=e.state.selection;if(!t.empty&&e.lineBlockAt(t.from).from!=e.lineBlockAt(t.to).from)e.dispatch({changes:e.state.selection.ranges.filter((n)=>!n.empty).map((n)=>({from:n.from,to:n.to})),userEvent:"input"});e.inputState.composing=0}};Yt.compositionend=(e)=>{if(e.observer.editContext)return;if(e.inputState.composing=-1,e.inputState.compositionEndedAt=Date.now(),e.inputState.compositionPendingKey=!0,e.inputState.compositionPendingChange=e.observer.pendingRecords().length>0,e.inputState.compositionFirstChange=null,j.chrome&&j.android)e.observer.flushSoon();else if(e.inputState.compositionPendingChange)Promise.resolve().then(()=>e.observer.flush());else setTimeout(()=>{if(e.inputState.composing<0&&e.docView.hasComposition)e.update([])},50)};Yt.contextmenu=(e)=>{e.inputState.lastContextMenu=Date.now()};Si.beforeinput=(e,t)=>{var n,i;if(t.inputType=="insertText"||t.inputType=="insertCompositionText")e.inputState.insertingText=t.data,e.inputState.insertingTextAt=Date.now();if(t.inputType=="insertReplacementText"&&e.observer.editContext){let o=(n=t.dataTransfer)===null||n===void 0?void 0:n.getData("text/plain"),s=t.getTargetRanges();if(o&&s.length){let l=s[0],a=e.posAtDOM(l.startContainer,l.startOffset),u=e.posAtDOM(l.endContainer,l.endOffset);return gx(e,{from:a,to:u,insert:e.state.toText(o)},null),!0}}let r;if(j.chrome&&j.android&&(r=tN.find((o)=>o.inputType==t.inputType))){if(e.observer.delayAndroidKey(r.key,r.keyCode),r.key=="Backspace"||r.key=="Delete"){let o=((i=window.visualViewport)===null||i===void 0?void 0:i.height)||0;setTimeout(()=>{var s;if((((s=window.visualViewport)===null||s===void 0?void 0:s.height)||0)>o+10&&e.hasFocus)e.contentDOM.blur(),e.focus()},100)}}if(j.ios&&t.inputType=="deleteContentForward")e.observer.flushSoon();if(j.safari&&t.inputType=="insertText"&&e.inputState.composing>=0)setTimeout(()=>Yt.compositionend(e,t),20);return!1};var WM=new Set;function dH(e){if(!WM.has(e))WM.add(e),e.addEventListener("copy",()=>{}),e.addEventListener("cut",()=>{})}var QM=["pre-wrap","normal","pre-line","break-spaces"],Ua=!1;function JM(){Ua=!1}class cN{constructor(e){this.lineWrapping=e,this.doc=he.empty,this.heightSamples={},this.lineHeight=14,this.charWidth=7,this.textHeight=14,this.lineLength=30}heightForGap(e,t){let n=this.doc.lineAt(t).number-this.doc.lineAt(e).number+1;if(this.lineWrapping)n+=Math.max(0,Math.ceil((t-e-n*this.lineLength*0.5)/this.lineLength));return this.lineHeight*n}heightForLine(e){if(!this.lineWrapping)return this.lineHeight;return(1+Math.max(0,Math.ceil((e-this.lineLength)/Math.max(1,this.lineLength-5))))*this.lineHeight}setDoc(e){return this.doc=e,this}mustRefreshForWrapping(e){return QM.indexOf(e)>-1!=this.lineWrapping}mustRefreshForHeights(e){let t=!1;for(let n=0;n<e.length;n++){let i=e[n];if(i<0)n++;else if(!this.heightSamples[Math.floor(i*10)])t=!0,this.heightSamples[Math.floor(i*10)]=!0}return t}refresh(e,t,n,i,r,o){let s=QM.indexOf(e)>-1,l=Math.abs(t-this.lineHeight)>0.3||this.lineWrapping!=s;if(this.lineWrapping=s,this.lineHeight=t,this.charWidth=n,this.textHeight=i,this.lineLength=r,l){this.heightSamples={};for(let a=0;a<o.length;a++){let u=o[a];if(u<0)a++;else this.heightSamples[Math.floor(u*10)]=!0}}return l}}class fN{constructor(e,t){this.from=e,this.heights=t,this.index=0}get more(){return this.index<this.heights.length}}class yi{constructor(e,t,n,i,r){this.from=e,this.length=t,this.top=n,this.height=i,this._content=r}get type(){return typeof this._content=="number"?Gn.Text:Array.isArray(this._content)?this._content:this._content.type}get to(){return this.from+this.length}get bottom(){return this.top+this.height}get widget(){return this._content instanceof Fs?this._content.widget:null}get widgetLineBreaks(){return typeof this._content=="number"?this._content:0}join(e){let t=(Array.isArray(this._content)?this._content:[this]).concat(Array.isArray(e._content)?e._content:[e]);return new yi(this.from,this.length+e.length,this.top,this.height+e.height,t)}}var Ve=function(e){return e[e.ByPos=0]="ByPos",e[e.ByHeight=1]="ByHeight",e[e.ByPosNoHeight=2]="ByPosNoHeight",e}(Ve||(Ve={})),Pp=0.001;class Gt{constructor(e,t,n=2){this.length=e,this.height=t,this.flags=n}get outdated(){return(this.flags&2)>0}set outdated(e){this.flags=(e?2:0)|this.flags&-3}setHeight(e){if(this.height!=e){if(Math.abs(this.height-e)>Pp)Ua=!0;this.height=e}}replace(e,t,n){return Gt.of(n)}decomposeLeft(e,t){t.push(this)}decomposeRight(e,t){t.push(this)}applyChanges(e,t,n,i){let r=this,o=n.doc;for(let s=i.length-1;s>=0;s--){let{fromA:l,toA:a,fromB:u,toB:c}=i[s],f=r.lineAt(l,Ve.ByPosNoHeight,n.setDoc(t),0,0),d=f.to>=a?f:r.lineAt(a,Ve.ByPosNoHeight,n,0,0);c+=d.to-a,a=d.to;while(s>0&&f.from<=i[s-1].toA)if(l=i[s-1].fromA,u=i[s-1].fromB,s--,l<f.from)f=r.lineAt(l,Ve.ByPosNoHeight,n,0,0);u+=f.from-l,l=f.from;let h=bx.build(n.setDoc(o),e,u,c);r=Fp(r,r.replace(l,a,h))}return r.updateHeight(n,0)}static empty(){return new Cn(0,0,0)}static of(e){if(e.length==1)return e[0];let t=0,n=e.length,i=0,r=0;for(;;)if(t==n)if(i>r*2){let s=e[t-1];if(s.break)e.splice(--t,1,s.left,null,s.right);else e.splice(--t,1,s.left,s.right);n+=1+s.break,i-=s.size}else if(r>i*2){let s=e[n];if(s.break)e.splice(n,1,s.left,null,s.right);else e.splice(n,1,s.left,s.right);n+=2+s.break,r-=s.size}else break;else if(i<r){let s=e[t++];if(s)i+=s.size}else{let s=e[--n];if(s)r+=s.size}let o=!1;if(e[t-1]==null)o=!0,t--;else if(e[t]==null)o=!0,n++;return new dN(Gt.of(e.slice(0,t)),o,Gt.of(e.slice(n)))}}function Fp(e,t){if(e==t)return e;if(e.constructor!=t.constructor)Ua=!0;return t}Gt.prototype.size=1;var hH=Ae.replace({});class vx extends Gt{constructor(e,t,n){super(e,t);this.deco=n,this.spaceAbove=0}mainBlock(e,t){return new yi(t,this.length,e+this.spaceAbove,this.height-this.spaceAbove,this.deco||0)}blockAt(e,t,n,i){return this.spaceAbove&&e<n+this.spaceAbove?new yi(i,0,n,this.spaceAbove,hH):this.mainBlock(n,i)}lineAt(e,t,n,i,r){let o=this.mainBlock(i,r);return this.spaceAbove?this.blockAt(0,n,i,r).join(o):o}forEachLine(e,t,n,i,r,o){if(e<=r+this.length&&t>=r)o(this.lineAt(0,Ve.ByPos,n,i,r))}setMeasuredHeight(e){let t=e.heights[e.index++];if(t<0)this.spaceAbove=-t,t=e.heights[e.index++];else this.spaceAbove=0;this.setHeight(t)}updateHeight(e,t=0,n=!1,i){if(i&&i.from<=t&&i.more)this.setMeasuredHeight(i);return this.outdated=!1,this}toString(){return`block(${this.length})`}}class Cn extends vx{constructor(e,t,n){super(e,t,null);this.collapsed=0,this.widgetHeight=0,this.breaks=0,this.spaceAbove=n}mainBlock(e,t){return new yi(t,this.length,e+this.spaceAbove,this.height-this.spaceAbove,this.breaks)}replace(e,t,n){let i=n[0];if(n.length==1&&(i instanceof Cn||i instanceof Lt&&i.flags&4)&&Math.abs(this.length-i.length)<10){if(i instanceof Lt)i=new Cn(i.length,this.height,this.spaceAbove);else i.height=this.height;if(!this.outdated)i.outdated=!1;return i}else return Gt.of(n)}updateHeight(e,t=0,n=!1,i){if(i&&i.from<=t&&i.more)this.setMeasuredHeight(i);else if(n||this.outdated)this.spaceAbove=0,this.setHeight(Math.max(this.widgetHeight,e.heightForLine(this.length-this.collapsed))+this.breaks*e.lineHeight);return this.outdated=!1,this}toString(){return`line(${this.length}${this.collapsed?-this.collapsed:""}${this.widgetHeight?":"+this.widgetHeight:""})`}}class Lt extends Gt{constructor(e){super(e,0)}heightMetrics(e,t){let n=e.doc.lineAt(t).number,i=e.doc.lineAt(t+this.length).number,r=i-n+1,o,s=0;if(e.lineWrapping){let l=Math.min(this.height,e.lineHeight*r);if(o=l/r,this.length>r+1)s=(this.height-l)/(this.length-r-1)}else o=this.height/r;return{firstLine:n,lastLine:i,perLine:o,perChar:s}}blockAt(e,t,n,i){let{firstLine:r,lastLine:o,perLine:s,perChar:l}=this.heightMetrics(t,i);if(t.lineWrapping){let a=i+(e<t.lineHeight?0:Math.round(Math.max(0,Math.min(1,(e-n)/this.height))*this.length)),u=t.doc.lineAt(a),c=s+u.length*l,f=Math.max(n,e-c/2);return new yi(u.from,u.length,f,c,0)}else{let a=Math.max(0,Math.min(o-r,Math.floor((e-n)/s))),{from:u,length:c}=t.doc.line(r+a);return new yi(u,c,n+s*a,s,0)}}lineAt(e,t,n,i,r){if(t==Ve.ByHeight)return this.blockAt(e,n,i,r);if(t==Ve.ByPosNoHeight){let{from:d,to:h}=n.doc.lineAt(e);return new yi(d,h-d,0,0,0)}let{firstLine:o,perLine:s,perChar:l}=this.heightMetrics(n,r),a=n.doc.lineAt(e),u=s+a.length*l,c=a.number-o,f=i+s*c+l*(a.from-r-c);return new yi(a.from,a.length,Math.max(i,Math.min(f,i+this.height-u)),u,0)}forEachLine(e,t,n,i,r,o){e=Math.max(e,r),t=Math.min(t,r+this.length);let{firstLine:s,perLine:l,perChar:a}=this.heightMetrics(n,r);for(let u=e,c=i;u<=t;){let f=n.doc.lineAt(u);if(u==e){let h=f.number-s;c+=l*h+a*(e-r-h)}let d=l+a*f.length;o(new yi(f.from,f.length,c,d,0)),c+=d,u=f.to+1}}replace(e,t,n){let i=this.length-t;if(i>0){let r=n[n.length-1];if(r instanceof Lt)n[n.length-1]=new Lt(r.length+i);else n.push(null,new Lt(i-1))}if(e>0){let r=n[0];if(r instanceof Lt)n[0]=new Lt(e+r.length);else n.unshift(new Lt(e-1),null)}return Gt.of(n)}decomposeLeft(e,t){t.push(new Lt(e-1),null)}decomposeRight(e,t){t.push(null,new Lt(this.length-e-1))}updateHeight(e,t=0,n=!1,i){let r=t+this.length;if(i&&i.from<=t+this.length&&i.more){let o=[],s=Math.max(t,i.from),l=-1;if(i.from>t)o.push(new Lt(i.from-t-1).updateHeight(e,t));while(s<=r&&i.more){let u=e.doc.lineAt(s).length;if(o.length)o.push(null);let c=i.heights[i.index++],f=0;if(c<0)f=-c,c=i.heights[i.index++];if(l==-1)l=c;else if(Math.abs(c-l)>=Pp)l=-2;let d=new Cn(u,c,f);d.outdated=!1,o.push(d),s+=u+1}if(s<=r)o.push(null,new Lt(r-s).updateHeight(e,s));let a=Gt.of(o);if(l<0||Math.abs(a.height-this.height)>=Pp||Math.abs(l-this.heightMetrics(e,t).perLine)>=Pp)Ua=!0;return Fp(this,a)}else if(n||this.outdated)this.setHeight(e.heightForGap(t,t+this.length)),this.outdated=!1;return this}toString(){return`gap(${this.length})`}}class dN extends Gt{constructor(e,t,n){super(e.length+(t?1:0)+n.length,e.height+n.height,(t?1:0)|(e.outdated||n.outdated?2:0));this.left=e,this.right=n,this.size=e.size+n.size}get break(){return this.flags&1}blockAt(e,t,n,i){let r=n+this.left.height;return e<r?this.left.blockAt(e,t,n,i):this.right.blockAt(e,t,r,i+this.left.length+this.break)}lineAt(e,t,n,i,r){let o=i+this.left.height,s=r+this.left.length+this.break,l=t==Ve.ByHeight?e<o:e<s,a=l?this.left.lineAt(e,t,n,i,r):this.right.lineAt(e,t,n,o,s);if(this.break||(l?a.to<s:a.from>s))return a;let u=t==Ve.ByPosNoHeight?Ve.ByPosNoHeight:Ve.ByPos;if(l)return a.join(this.right.lineAt(s,u,n,o,s));else return this.left.lineAt(s,u,n,i,r).join(a)}forEachLine(e,t,n,i,r,o){let s=i+this.left.height,l=r+this.left.length+this.break;if(this.break){if(e<l)this.left.forEachLine(e,t,n,i,r,o);if(t>=l)this.right.forEachLine(e,t,n,s,l,o)}else{let a=this.lineAt(l,Ve.ByPos,n,i,r);if(e<a.from)this.left.forEachLine(e,Math.min(t,a.from-1),n,i,r,o);if(a.to>=e&&a.from<=t)o(a);if(t>a.to)this.right.forEachLine(Math.max(e,a.to+1),t,n,s,l,o)}}replace(e,t,n){let i=this.left.length+this.break;if(t<i)return this.balanced(this.left.replace(e,t,n),this.right);if(e>this.left.length)return this.balanced(this.left,this.right.replace(e-i,t-i,n));let r=[];if(e>0)this.decomposeLeft(e,r);let o=r.length;for(let s of n)r.push(s);if(e>0)ZM(r,o-1);if(t<this.length){let s=r.length;this.decomposeRight(t,r),ZM(r,s)}return Gt.of(r)}decomposeLeft(e,t){let n=this.left.length;if(e<=n)return this.left.decomposeLeft(e,t);if(t.push(this.left),this.break){if(n++,e>=n)t.push(null)}if(e>n)this.right.decomposeLeft(e-n,t)}decomposeRight(e,t){let n=this.left.length,i=n+this.break;if(e>=i)return this.right.decomposeRight(e-i,t);if(e<n)this.left.decomposeRight(e,t);if(this.break&&e<i)t.push(null);t.push(this.right)}balanced(e,t){if(e.size>2*t.size||t.size>2*e.size)return Gt.of(this.break?[e,null,t]:[e,t]);return this.left=Fp(this.left,e),this.right=Fp(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,n=!1,i){let{left:r,right:o}=this,s=t+r.length+this.break,l=null;if(i&&i.from<=t+r.length&&i.more)l=r=r.updateHeight(e,t,n,i);else r.updateHeight(e,t,n);if(i&&i.from<=s+o.length&&i.more)l=o=o.updateHeight(e,s,n,i);else o.updateHeight(e,s,n);if(l)return this.balanced(r,o);return this.height=this.left.height+this.right.height,this.outdated=!1,this}toString(){return this.left+(this.break?" ":"-")+this.right}}function ZM(e,t){let n,i;if(e[t]==null&&(n=e[t-1])instanceof Lt&&(i=e[t+1])instanceof Lt)e.splice(t-1,3,new Lt(n.length+1+i.length))}var pH=5;class bx{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 n=Math.min(t,this.lineEnd),i=this.nodes[this.nodes.length-1];if(i instanceof Cn)i.length+=n-this.pos;else if(n>this.pos||!this.isCovered)this.nodes.push(new Cn(n-this.pos,-1,0));if(this.writtenTo=n,t>n)this.nodes.push(null),this.writtenTo++,this.lineStart=-1}this.pos=t}point(e,t,n){if(e<t||n.heightRelevant){let i=n.widget?n.widget.estimatedHeight:0,r=n.widget?n.widget.lineBreaks:0;if(i<0)i=this.oracle.lineHeight;let o=t-e;if(n.block)this.addBlock(new vx(o,i,n));else if(o||r||i>=pH)this.addLineDeco(i,r,o)}else if(t>e)this.span(e,t);if(this.lineEnd>-1&&this.lineEnd<this.pos)this.lineEnd=this.oracle.doc.lineAt(this.pos).to}enterLine(){if(this.lineStart>-1)return;let{from:e,to:t}=this.oracle.doc.lineAt(this.pos);if(this.lineStart=e,this.lineEnd=t,this.writtenTo<e){if(this.writtenTo<e-1||this.nodes[this.nodes.length-1]==null)this.nodes.push(this.blankContent(this.writtenTo,e-1));this.nodes.push(null)}if(this.pos>e)this.nodes.push(new Cn(this.pos-e,-1,0));this.writtenTo=this.pos}blankContent(e,t){let n=new Lt(t-e);if(this.oracle.doc.lineAt(e).to==t)n.flags|=4;return n}ensureLine(){this.enterLine();let e=this.nodes.length?this.nodes[this.nodes.length-1]:null;if(e instanceof Cn)return e;let t=new Cn(0,-1,0);return this.nodes.push(t),t}addBlock(e){this.enterLine();let t=e.deco;if(t&&t.startSide>0&&!this.isCovered)this.ensureLine();if(this.nodes.push(e),this.writtenTo=this.pos=this.pos+e.length,t&&t.endSide>0)this.covering=e}addLineDeco(e,t,n){let i=this.ensureLine();i.length+=n,i.collapsed+=n,i.widgetHeight=Math.max(i.widgetHeight,e),i.breaks+=t,this.writtenTo=this.pos=this.pos+n}finish(e){let t=this.nodes.length==0?null:this.nodes[this.nodes.length-1];if(this.lineStart>-1&&!(t instanceof Cn)&&!this.isCovered)this.nodes.push(new Cn(0,-1,0));else if(this.writtenTo<this.pos||t==null)this.nodes.push(this.blankContent(this.writtenTo,this.pos));let n=e;for(let i of this.nodes){if(i instanceof Cn)i.updateHeight(this.oracle,n);n+=i?i.length:1}return this.nodes}static build(e,t,n,i){let r=new bx(n,e);return ge.spans(t,n,i,r,0),r.finish(n)}}function mH(e,t,n){let i=new hN;return ge.compare(e,t,n,i,0),i.changes}class hN{constructor(){this.changes=[]}compareRange(){}comparePoint(e,t,n,i){if(e<t||n&&n.heightRelevant||i&&i.heightRelevant)Pa(e,t,this.changes,5)}}function gH(e,t){let n=e.getBoundingClientRect(),i=e.ownerDocument,r=i.defaultView||window,o=Math.max(0,n.left),s=Math.min(r.innerWidth,n.right),l=Math.max(0,n.top),a=Math.min(r.innerHeight,n.bottom);for(let u=e.parentNode;u&&u!=i.body;)if(u.nodeType==1){let c=u,f=window.getComputedStyle(c);if((c.scrollHeight>c.clientHeight||c.scrollWidth>c.clientWidth)&&f.overflow!="visible"){let d=c.getBoundingClientRect();o=Math.max(o,d.left),s=Math.min(s,d.right),l=Math.max(l,d.top),a=Math.min(u==e.parentNode?r.innerHeight:a,d.bottom)}u=f.position=="absolute"||f.position=="fixed"?c.offsetParent:c.parentNode}else if(u.nodeType==11)u=u.host;else break;return{left:o-n.left,right:Math.max(o,s)-n.left,top:l-(n.top+t),bottom:Math.max(l,a)-(n.top+t)}}function vH(e){let t=e.getBoundingClientRect(),n=e.ownerDocument.defaultView||window;return t.left<n.innerWidth&&t.right>0&&t.top<n.innerHeight&&t.bottom>0}function bH(e,t){let n=e.getBoundingClientRect();return{left:0,right:n.right-n.left,top:t,bottom:n.bottom-(n.top+t)}}class Ip{constructor(e,t,n,i){this.from=e,this.to=t,this.size=n,this.displaySize=i}static same(e,t){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++){let i=e[n],r=t[n];if(i.from!=r.from||i.to!=r.to||i.size!=r.size)return!1}return!0}draw(e,t){return Ae.replace({widget:new pN(this.displaySize*(t?e.scaleY:e.scaleX),t)}).range(this.from,this.to)}}class pN extends Ho{constructor(e,t){super();this.size=e,this.vertical=t}eq(e){return e.size==this.size&&e.vertical==this.vertical}toDOM(){let e=document.createElement("div");if(this.vertical)e.style.height=this.size+"px";else e.style.width=this.size+"px",e.style.height="2px",e.style.display="inline-block";return e}get estimatedHeight(){return this.vertical?this.size:-1}}class ix{constructor(e,t){this.view=e,this.state=t,this.pixelViewport={left:0,right:window.innerWidth,top:0,bottom:0},this.inView=!0,this.paddingTop=0,this.paddingBottom=0,this.contentDOMWidth=0,this.contentDOMHeight=0,this.editorHeight=0,this.editorWidth=0,this.scaleX=1,this.scaleY=1,this.scrollOffset=0,this.scrolledToBottom=!1,this.scrollAnchorPos=0,this.scrollAnchorHeight=-1,this.scaler=e2,this.scrollTarget=null,this.printing=!1,this.mustMeasureContent=!0,this.defaultTextDirection=Ke.LTR,this.visibleRanges=[],this.mustEnforceCursorAssoc=!1;let n=t.facet(hx).some((i)=>typeof i!="function"&&i.class=="cm-lineWrapping");this.heightOracle=new cN(n),this.stateDeco=t2(t),this.heightMap=Gt.empty().applyChanges(this.stateDeco,he.empty,this.heightOracle.setDoc(t.doc),[new Xn(0,0,0,t.doc.length)]);for(let i=0;i<2;i++)if(this.viewport=this.getViewport(0,null),!this.updateForViewport())break;this.updateViewportLines(),this.lineGaps=this.ensureLineGaps([]),this.lineGapDeco=Ae.set(this.lineGaps.map((i)=>i.draw(this,!1))),this.scrollParent=e.scrollDOM,this.computeVisibleRanges()}updateForViewport(){let e=[this.viewport],{main:t}=this.state.selection;for(let n=0;n<=1;n++){let i=n?t.head:t.anchor;if(!e.some(({from:r,to:o})=>i>=r&&i<=o)){let{from:r,to:o}=this.lineBlockAt(i);e.push(new qc(r,o))}}return this.viewports=e.sort((n,i)=>n.from-i.from),this.updateScaler()}updateScaler(){let e=this.scaler;return this.scaler=this.heightMap.height<=7000000?e2:new yx(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 n=this.stateDeco;this.stateDeco=t2(this.state);let i=e.changedRanges,r=Xn.extendWithRanges(i,mH(n,this.stateDeco,e?e.changes:rt.empty(this.state.doc.length))),o=this.heightMap.height,s=this.scrolledToBottom?null:this.scrollAnchorAt(this.scrollOffset);if(JM(),this.heightMap=this.heightMap.applyChanges(this.stateDeco,e.startState.doc,this.heightOracle.setDoc(this.state.doc),r),this.heightMap.height!=o||Ua)e.flags|=2;if(s)this.scrollAnchorPos=e.changes.mapPos(s.from,-1),this.scrollAnchorHeight=s.top;else this.scrollAnchorPos=-1,this.scrollAnchorHeight=o;let l=r.length?this.mapViewport(this.viewport,e.changes):this.viewport;if(t&&(t.range.head<l.from||t.range.head>l.to)||!this.viewportIsAppropriate(l))l=this.getViewport(0,t);let a=l.from!=this.viewport.from||l.to!=this.viewport.to;if(this.viewport=l,e.flags|=this.updateForViewport(),a||!e.changes.empty||e.flags&2)this.updateViewportLines();if(this.lineGaps.length||this.viewport.to-this.viewport.from>4000)this.updateLineGaps(this.ensureLineGaps(this.mapLineGaps(this.lineGaps,e.changes)));if(e.flags|=this.computeVisibleRanges(e.changes),t)this.scrollTarget=t;if(!this.mustEnforceCursorAssoc&&(e.selectionSet||e.focusChanged)&&e.view.lineWrapping&&e.state.selection.main.empty&&e.state.selection.main.assoc&&!e.state.facet(C6))this.mustEnforceCursorAssoc=!0}measure(){let{view:e}=this,t=e.contentDOM,n=window.getComputedStyle(t),i=this.heightOracle,r=n.whiteSpace;this.defaultTextDirection=n.direction=="rtl"?Ke.RTL:Ke.LTR;let o=this.heightOracle.mustRefreshForWrapping(r)||this.mustMeasureContent==="refresh",s=t.getBoundingClientRect(),l=o||this.mustMeasureContent||this.contentDOMHeight!=s.height;this.contentDOMHeight=s.height,this.mustMeasureContent=!1;let a=0,u=0;if(s.width&&s.height){let{scaleX:S,scaleY:k}=f2(t,s);if(S>0.005&&Math.abs(this.scaleX-S)>0.005||k>0.005&&Math.abs(this.scaleY-k)>0.005)this.scaleX=S,this.scaleY=k,a|=16,o=l=!0}let c=(parseInt(n.paddingTop)||0)*this.scaleY,f=(parseInt(n.paddingBottom)||0)*this.scaleY;if(this.paddingTop!=c||this.paddingBottom!=f)this.paddingTop=c,this.paddingBottom=f,a|=18;if(this.editorWidth!=e.scrollDOM.clientWidth){if(i.lineWrapping)l=!0;this.editorWidth=e.scrollDOM.clientWidth,a|=16}let d=d2(this.view.contentDOM,!1).y;if(d!=this.scrollParent)this.scrollParent=d,this.scrollAnchorHeight=-1,this.scrollOffset=0;let h=this.getScrollOffset();if(this.scrollOffset!=h)this.scrollAnchorHeight=-1,this.scrollOffset=h;this.scrolledToBottom=v2(this.scrollParent||e.win);let m=(this.printing?bH:gH)(t,this.paddingTop),b=m.top-this.pixelViewport.top,x=m.bottom-this.pixelViewport.bottom;this.pixelViewport=m;let g=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left;if(g!=this.inView){if(this.inView=g,g)l=!0}if(!this.inView&&!this.scrollTarget&&!vH(e.dom))return 0;let v=s.width;if(this.contentDOMWidth!=v||this.editorHeight!=e.scrollDOM.clientHeight)this.contentDOMWidth=s.width,this.editorHeight=e.scrollDOM.clientHeight,a|=16;if(l){let S=e.docView.measureVisibleLineHeights(this.viewport);if(i.mustRefreshForHeights(S))o=!0;if(o||i.lineWrapping&&Math.abs(v-this.contentDOMWidth)>i.charWidth){let{lineHeight:k,charWidth:E,textHeight:_}=e.docView.measureTextSize();if(o=k>0&&i.refresh(r,k,E,_,Math.max(5,v/E),S),o)e.docView.minWidth=0,a|=16}if(b>0&&x>0)u=Math.max(b,x);else if(b<0&&x<0)u=Math.min(b,x);JM();for(let k of this.viewports){let E=k.from==this.viewport.from?S:e.docView.measureVisibleLineHeights(k);this.heightMap=(o?Gt.empty().applyChanges(this.stateDeco,he.empty,this.heightOracle,[new Xn(0,0,0,e.state.doc.length)]):this.heightMap).updateHeight(i,0,o,new fN(k.from,E))}if(Ua)a|=2}let w=!this.viewportIsAppropriate(this.viewport,u)||this.scrollTarget&&(this.scrollTarget.range.head<this.viewport.from||this.scrollTarget.range.head>this.viewport.to);if(w){if(a&2)a|=this.updateScaler();this.viewport=this.getViewport(u,this.scrollTarget),a|=this.updateForViewport()}if(a&2||w)this.updateViewportLines();if(this.lineGaps.length||this.viewport.to-this.viewport.from>4000)this.updateLineGaps(this.ensureLineGaps(o?[]:this.lineGaps,e));if(a|=this.computeVisibleRanges(),this.mustEnforceCursorAssoc)this.mustEnforceCursorAssoc=!1,e.docView.enforceCursorAssoc();return a}get visibleTop(){return this.scaler.fromDOM(this.pixelViewport.top)}get visibleBottom(){return this.scaler.fromDOM(this.pixelViewport.bottom)}getViewport(e,t){let n=0.5-Math.max(-0.5,Math.min(0.5,e/1000/2)),i=this.heightMap,r=this.heightOracle,{visibleTop:o,visibleBottom:s}=this,l=new qc(i.lineAt(o-n*1000,Ve.ByHeight,r,0,0).from,i.lineAt(s+(1-n)*1000,Ve.ByHeight,r,0,0).to);if(t){let{head:a}=t.range;if(a<l.from||a>l.to){let u=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),c=i.lineAt(a,Ve.ByPos,r,0,0),f;if(t.y=="center")f=(c.top+c.bottom)/2-u/2;else if(t.y=="start"||t.y=="nearest"&&a<l.from)f=c.top;else f=c.bottom-u;l=new qc(i.lineAt(f-500,Ve.ByHeight,r,0,0).from,i.lineAt(f+u+500,Ve.ByHeight,r,0,0).to)}}return l}mapViewport(e,t){let n=t.mapPos(e.from,-1),i=t.mapPos(e.to,1);return new qc(this.heightMap.lineAt(n,Ve.ByPos,this.heightOracle,0,0).from,this.heightMap.lineAt(i,Ve.ByPos,this.heightOracle,0,0).to)}viewportIsAppropriate({from:e,to:t},n=0){if(!this.inView)return!0;let{top:i}=this.heightMap.lineAt(e,Ve.ByPos,this.heightOracle,0,0),{bottom:r}=this.heightMap.lineAt(t,Ve.ByPos,this.heightOracle,0,0),{visibleTop:o,visibleBottom:s}=this;return(e==0||i<=o-Math.max(10,Math.min(-n,250)))&&(t==this.state.doc.length||r>=s+Math.max(10,Math.min(n,250)))&&(i>o-2000&&r<s+2000)}mapLineGaps(e,t){if(!e.length||t.empty)return e;let n=[];for(let i of e)if(!t.touchesRange(i.from,i.to))n.push(new Ip(t.mapPos(i.from),t.mapPos(i.to),i.size,i.displaySize));return n}ensureLineGaps(e,t){let n=this.heightOracle.lineWrapping,i=n?1e4:2000,r=i>>1,o=i<<1;if(this.defaultTextDirection!=Ke.LTR&&!n)return[];let s=[],l=(u,c,f,d)=>{if(c-u<r)return;let h=this.state.selection.main,m=[h.from];if(!h.empty)m.push(h.to);for(let x of m)if(x>u&&x<c){l(u,x-10,f,d),l(x+10,c,f,d);return}let b=xH(e,(x)=>x.from>=f.from&&x.to<=f.to&&Math.abs(x.from-u)<r&&Math.abs(x.to-c)<r&&!m.some((g)=>x.from<g&&x.to>g));if(!b){if(c<f.to&&t&&n&&t.visibleRanges.some((v)=>v.from<=c&&v.to>=c)){let v=t.moveToLineBoundary(A.cursor(c),!1,!0).head;if(v>u)c=v}let x=this.gapSize(f,u,c,d),g=n||x<2000000?x:2000000;b=new Ip(u,c,x,g)}s.push(b)},a=(u)=>{if(u.length<o||u.type!=Gn.Text)return;let c=yH(u.from,u.to,this.stateDeco);if(c.total<o)return;let f=this.scrollTarget?this.scrollTarget.range.head:null,d,h;if(n){let m=i/this.heightOracle.lineLength*this.heightOracle.lineHeight,b,x;if(f!=null){let g=Mp(c,f),v=((this.visibleBottom-this.visibleTop)/2+m)/u.height;b=g-v,x=g+v}else b=(this.visibleTop-u.top-m)/u.height,x=(this.visibleBottom-u.top+m)/u.height;d=Tp(c,b),h=Tp(c,x)}else{let m=c.total*this.heightOracle.charWidth,b=i*this.heightOracle.charWidth,x=0;if(m>2000000){for(let k of e)if(k.from>=u.from&&k.from<u.to&&k.size!=k.displaySize&&k.from*this.heightOracle.charWidth+x<this.pixelViewport.left)x=k.size-k.displaySize}let g=this.pixelViewport.left+x,v=this.pixelViewport.right+x,w,S;if(f!=null){let k=Mp(c,f),E=((v-g)/2+b)/m;w=k-E,S=k+E}else w=(g-b)/m,S=(v+b)/m;d=Tp(c,w),h=Tp(c,S)}if(d>u.from)l(u.from,d,u,c);if(h<u.to)l(h,u.to,u,c)};for(let u of this.viewportLines)if(Array.isArray(u.type))u.type.forEach(a);else a(u);return s}gapSize(e,t,n,i){let r=Mp(i,n)-Mp(i,t);if(this.heightOracle.lineWrapping)return e.height*r;else return i.total*this.heightOracle.charWidth*r}updateLineGaps(e){if(!Ip.same(e,this.lineGaps))this.lineGaps=e,this.lineGapDeco=Ae.set(e.map((t)=>t.draw(this,this.heightOracle.lineWrapping)))}computeVisibleRanges(e){let t=this.stateDeco;if(this.lineGaps.length)t=t.concat(this.lineGapDeco);let n=[];ge.spans(t,this.viewport.from,this.viewport.to,{span(r,o){n.push({from:r,to:o})},point(){}},20);let i=0;if(n.length!=this.visibleRanges.length)i=12;else for(let r=0;r<n.length&&!(i&8);r++){let o=this.visibleRanges[r],s=n[r];if(o.from!=s.from||o.to!=s.to){if(i|=4,!(e&&e.mapPos(o.from,-1)==s.from&&e.mapPos(o.to,1)==s.to))i|=8}}return this.visibleRanges=n,i}lineBlockAt(e){return e>=this.viewport.from&&e<=this.viewport.to&&this.viewportLines.find((t)=>t.from<=e&&t.to>=e)||$c(this.heightMap.lineAt(e,Ve.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),Ve.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+8);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 qc{constructor(e,t){this.from=e,this.to=t}}function yH(e,t,n){let i=[],r=e,o=0;if(ge.spans(n,e,t,{span(){},point(s,l){if(s>r)i.push({from:r,to:s}),o+=s-r;r=l}},20),r<t)i.push({from:r,to:t}),o+=t-r;return{total:o,ranges:i}}function Tp({total:e,ranges:t},n){if(n<=0)return t[0].from;if(n>=1)return t[t.length-1].to;let i=Math.floor(e*n);for(let r=0;;r++){let{from:o,to:s}=t[r],l=s-o;if(i<=l)return o+i;i-=l}}function Mp(e,t){let n=0;for(let{from:i,to:r}of e.ranges){if(t<=r){n+=t-i;break}n+=r-i}return n/e.total}function xH(e,t){for(let n of e)if(t(n))return n;return}var e2={toDOM(e){return e},fromDOM(e){return e},scale:1,eq(e){return e==this}};function t2(e){let t=e.facet(Xp).filter((i)=>typeof i!="function"),n=e.facet(px).filter((i)=>typeof i!="function");if(n.length)t.push(ge.join(n));return t}class yx{constructor(e,t,n){let i=0,r=0,o=0;this.viewports=n.map(({from:s,to:l})=>{let a=t.lineAt(s,Ve.ByPos,e,0,0).top,u=t.lineAt(l,Ve.ByPos,e,0,0).bottom;return i+=u-a,{from:s,to:l,top:a,bottom:u,domTop:0,domBottom:0}}),this.scale=(7000000-i)/(t.height-i);for(let s of this.viewports)s.domTop=o+(s.top-r)*this.scale,o=s.domBottom=s.domTop+(s.bottom-s.top),r=s.bottom}toDOM(e){for(let t=0,n=0,i=0;;t++){let r=t<this.viewports.length?this.viewports[t]:null;if(!r||e<r.top)return i+(e-n)*this.scale;if(e<=r.bottom)return r.domTop+(e-r.top);n=r.bottom,i=r.domBottom}}fromDOM(e){for(let t=0,n=0,i=0;;t++){let r=t<this.viewports.length?this.viewports[t]:null;if(!r||e<r.domTop)return n+(e-i)/this.scale;if(e<=r.domBottom)return r.top+(e-r.domTop);n=r.bottom,i=r.domBottom}}eq(e){if(!(e instanceof yx))return!1;return this.scale==e.scale&&this.viewports.length==e.viewports.length&&this.viewports.every((t,n)=>t.from==e.viewports[n].from&&t.to==e.viewports[n].to)}}function $c(e,t){if(t.scale==1)return e;let n=t.toDOM(e.top),i=t.toDOM(e.bottom);return new yi(e.from,e.length,n,i-n,Array.isArray(e._content)?e._content.map((r)=>$c(r,t)):e._content)}var Np=Z.define({combine:(e)=>e.join(" ")}),rx=Z.define({combine:(e)=>e.indexOf(!0)>-1}),ox=vi.newName(),mN=vi.newName(),gN=vi.newName(),vN={"&light":"."+mN,"&dark":"."+gN};function sx(e,t,n){return new vi(t,{finish(i){return/&/.test(i)?i.replace(/&\w*/,(r)=>{if(r=="&")return e;if(!n||!n[r])throw RangeError(`Unsupported selector: ${r}`);return n[r]}):e+" "+i}})}var wH=sx("."+ox,{"&":{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:"text-top",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,<svg xmlns="http://www.w3.org/2000/svg" width="200" height="20"><path stroke="%23888" stroke-width="1" fill="none" d="M1 10H196L190 5M190 15L196 10M197 4L197 16"/></svg>')`,backgroundSize:"auto 100%",backgroundPosition:"right 90%",backgroundRepeat:"no-repeat"},".cm-trailingSpace":{backgroundColor:"#ff332255"},".cm-button":{verticalAlign:"middle",color:"inherit",fontSize:"70%",padding:".2em 1em",borderRadius:"1px"},"&light .cm-button":{backgroundImage:"linear-gradient(#eff1f5, #d9d9df)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#b4b4b4, #d0d3d6)"}},"&dark .cm-button":{backgroundImage:"linear-gradient(#393939, #111)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#111, #333)"}},".cm-textfield":{verticalAlign:"middle",color:"inherit",fontSize:"70%",border:"1px solid silver",padding:".2em .5em"},"&light .cm-textfield":{backgroundColor:"white"},"&dark .cm-textfield":{border:"1px solid #555",backgroundColor:"inherit"}},vN),SH={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},U0=j.ie&&j.ie_version<=11;class bN{constructor(e){if(this.view=e,this.active=!1,this.editContext=null,this.selectionRange=new h2,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 n of t)this.queue.push(n);if((j.ie&&j.ie_version<=11||j.ios&&e.composing)&&t.some((n)=>n.type=="childList"&&n.removedNodes.length||n.type=="characterData"&&n.oldValue.length>n.target.nodeValue.length))this.flushSoon();else this.flush()}),window.EditContext&&j.android&&e.constructor.EDIT_CONTEXT!==!1&&!(j.chrome&&j.chrome_version<126)){if(this.editContext=new yN(e),e.state.facet(Ir))e.contentDOM.editContext=this.editContext.editContext}if(U0)this.onCharData=(t)=>{this.queue.push({target:t.target,type:"characterData",oldValue:t.prevValue}),this.flushSoon()};if(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");if(typeof ResizeObserver=="function")this.resizeScroll=new ResizeObserver(()=>{var t;if(((t=this.view.docView)===null||t===void 0?void 0:t.lastUpdate)<Date.now()-75)this.onResize()}),this.resizeScroll.observe(e.scrollDOM);if(this.addWindowListeners(this.win=e.win),this.start(),typeof IntersectionObserver=="function")this.intersection=new IntersectionObserver((t)=>{if(this.parentCheck<0)this.parentCheck=setTimeout(this.listenForScroll.bind(this),1000);if(t.length>0&&t[t.length-1].intersectionRatio>0!=this.intersecting){if(this.intersecting=!this.intersecting,this.intersecting!=this.view.inView)this.onScrollChanged(document.createEvent("Event"))}},{threshold:[0,0.001]}),this.intersection.observe(this.dom),this.gapIntersection=new IntersectionObserver((t)=>{if(t.length>0&&t[t.length-1].intersectionRatio>0)this.onScrollChanged(document.createEvent("Event"))},{});this.listenForScroll(),this.readSelectionRange()}onScrollChanged(e){if(this.view.inputState.runHandlers("scroll",e),this.intersecting)this.view.measure()}onScroll(e){if(this.intersecting)this.flush(!1);if(this.editContext)this.view.requestMeasure(this.editContext.measureReq);this.onScrollChanged(e)}onResize(){if(this.resizeTimeout<0)this.resizeTimeout=setTimeout(()=>{this.resizeTimeout=-1,this.view.requestMeasure()},50)}onPrint(e){if((e.type=="change"||!e.type)&&!e.matches)return;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,n)=>t!=e[n]))){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:n}=this,i=this.selectionRange;if(n.state.facet(Ir)?n.root.activeElement!=this.dom:!Xc(this.dom,i))return;let r=i.anchorNode&&n.docView.tile.nearest(i.anchorNode);if(r&&r.isWidget()&&r.widget.ignoreEvent(e)){if(!t)this.selectionChanged=!1;return}if((j.ie&&j.ie_version<=11||j.android&&j.chrome)&&!n.state.selection.main.empty&&i.focusNode&&Yc(i.focusNode,i.focusOffset,i.anchorNode,i.anchorOffset))this.flushSoon();else this.flush(!1)}readSelectionRange(){let{view:e}=this,t=Jc(e.root);if(!t)return!1;let n=j.safari&&e.root.nodeType==11&&e.root.activeElement==this.dom&&kH(this.view,t)||t;if(!n||this.selectionRange.eq(n))return!1;let i=Xc(this.dom,n);if(i&&!this.selectionChanged&&e.inputState.lastFocusTime>Date.now()-200&&e.inputState.lastTouchTime<Date.now()-300&&m6(this.dom,n))return this.view.inputState.lastFocusTime=0,e.docView.updateSelection(),!1;if(this.selectionRange.setRange(n),i)this.selectionChanged=!0;return!0}setSelectionRange(e,t){this.selectionRange.set(e.node,e.offset,t.node,t.offset),this.selectionChanged=!1}clearSelectionRange(){this.selectionRange.set(null,0,null,0)}listenForScroll(){this.parentCheck=-1;let e=0,t=null;for(let n=this.dom;n;)if(n.nodeType==1){if(!t&&e<this.scrollTargets.length&&this.scrollTargets[e]==n)e++;else if(!t)t=this.scrollTargets.slice(0,e);if(t)t.push(n);n=n.assignedSlot||n.parentNode}else if(n.nodeType==11)n=n.host;else break;if(e<this.scrollTargets.length&&!t)t=this.scrollTargets.slice(0,e);if(t){for(let n of this.scrollTargets)n.removeEventListener("scroll",this.onScroll);for(let n of this.scrollTargets=t)n.addEventListener("scroll",this.onScroll)}}ignore(e){if(!this.active)return e();try{return this.stop(),e()}finally{this.start(),this.clear()}}start(){if(this.active)return;if(this.observer.observe(this.dom,SH),U0)this.dom.addEventListener("DOMCharacterDataModified",this.onCharData);this.active=!0}stop(){if(!this.active)return;if(this.active=!1,this.observer.disconnect(),U0)this.dom.removeEventListener("DOMCharacterDataModified",this.onCharData)}clear(){this.processRecords(),this.queue.length=0,this.selectionChanged=!1}delayAndroidKey(e,t){var n;if(!this.delayedAndroidKey){let i=()=>{let r=this.delayedAndroidKey;if(r){if(this.clearDelayedAndroidKey(),this.view.inputState.lastKeyCode=r.keyCode,this.view.inputState.lastKeyTime=Date.now(),!this.flush()&&r.force)Ia(this.dom,r.key,r.keyCode)}};this.flushingAndroidKey=this.view.win.requestAnimationFrame(i)}if(!this.delayedAndroidKey||e=="Enter")this.delayedAndroidKey={key:e,keyCode:t,force:this.lastChange<Date.now()-50||!!((n=this.delayedAndroidKey)===null||n===void 0?void 0:n.force)}}clearDelayedAndroidKey(){this.win.cancelAnimationFrame(this.flushingAndroidKey),this.delayedAndroidKey=null,this.flushingAndroidKey=-1}flushSoon(){if(this.delayedFlush<0)this.delayedFlush=this.view.win.requestAnimationFrame(()=>{this.delayedFlush=-1,this.flush()})}forceFlush(){if(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();if(e.length)this.queue=[];let t=-1,n=-1,i=!1;for(let r of e){let o=this.readMutation(r);if(!o)continue;if(o.typeOver)i=!0;if(t==-1)({from:t,to:n}=o);else t=Math.min(o.from,t),n=Math.max(o.to,n)}return{from:t,to:n,typeOver:i}}readChange(){let{from:e,to:t,typeOver:n}=this.processRecords(),i=this.selectionChanged&&Xc(this.dom,this.selectionRange);if(e<0&&!i)return null;if(e>-1)this.lastChange=Date.now();this.view.inputState.lastFocusTime=0,this.selectionChanged=!1;let r=new W2(this.view,e,t,n);return this.view.docView.domChanged={newSel:r.newSel?r.newSel.main:null},r}flush(e=!0){if(this.delayedFlush>=0||this.delayedAndroidKey)return!1;if(e)this.readSelectionRange();let t=this.readChange();if(!t)return this.view.requestMeasure(),!1;let n=this.view.state,i=J2(this.view,t);if(this.view.state==n&&(t.domChanged||t.newSel&&!jp(this.view.state.selection,t.newSel.main)))this.view.update([]);return i}readMutation(e){let t=this.view.docView.tile.nearest(e.target);if(!t||t.isWidget())return null;if(t.markDirty(e.type=="attributes"),e.type=="childList"){let n=n2(t,e.previousSibling||e.target.previousSibling,-1),i=n2(t,e.nextSibling||e.target.nextSibling,1);return{from:n?t.posAfter(n):t.posAtStart,to:i?t.posBefore(i):t.posAtEnd,typeOver:!1}}else if(e.type=="characterData")return{from:t.posAtStart,to:t.posAtEnd,typeOver:e.target.nodeValue==e.oldValue};else return null}setWindow(e){if(e!=this.win)this.removeWindowListeners(this.win),this.win=e,this.addWindowListeners(this.win)}addWindowListeners(e){if(e.addEventListener("resize",this.onResize),this.printQuery)if(this.printQuery.addEventListener)this.printQuery.addEventListener("change",this.onPrint);else this.printQuery.addListener(this.onPrint);else e.addEventListener("beforeprint",this.onPrint);e.addEventListener("scroll",this.onScroll),e.document.addEventListener("selectionchange",this.onSelectionChange)}removeWindowListeners(e){if(e.removeEventListener("scroll",this.onScroll),e.removeEventListener("resize",this.onResize),this.printQuery)if(this.printQuery.removeEventListener)this.printQuery.removeEventListener("change",this.onPrint);else this.printQuery.removeListener(this.onPrint);else e.removeEventListener("beforeprint",this.onPrint);e.document.removeEventListener("selectionchange",this.onSelectionChange)}update(e){if(this.editContext){if(this.editContext.update(e),e.startState.facet(Ir)!=e.state.facet(Ir))e.view.contentDOM.editContext=e.state.facet(Ir)?this.editContext.editContext:null}}destroy(){var e,t,n;this.stop(),(e=this.intersection)===null||e===void 0||e.disconnect(),(t=this.gapIntersection)===null||t===void 0||t.disconnect(),(n=this.resizeScroll)===null||n===void 0||n.disconnect();for(let i of this.scrollTargets)i.removeEventListener("scroll",this.onScroll);if(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 n2(e,t,n){while(t){let i=Ge.get(t);if(i&&i.parent==e)return i;let r=t.parentNode;t=r!=e.dom?r:n>0?t.nextSibling:t.previousSibling}return null}function i2(e,t){let{startContainer:n,startOffset:i,endContainer:r,endOffset:o}=t,s=e.docView.domAtPos(e.state.selection.main.anchor,1);if(Yc(s.node,s.offset,r,o))[n,i,r,o]=[r,o,n,i];return{anchorNode:n,anchorOffset:i,focusNode:r,focusOffset:o}}function kH(e,t){if(t.getComposedRanges){let r=t.getComposedRanges(e.root)[0];if(r)return i2(e,r)}let n=null;function i(r){r.preventDefault(),r.stopImmediatePropagation(),n=r.getTargetRanges()[0]}return e.contentDOM.addEventListener("beforeinput",i,!0),e.dom.ownerDocument.execCommand("indent"),e.contentDOM.removeEventListener("beforeinput",i,!0),n?i2(e,n):null}class yN{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=(n)=>{let i=e.state.selection.main,{anchor:r,head:o}=i,s=this.toEditorPos(n.updateRangeStart),l=this.toEditorPos(n.updateRangeEnd);if(e.inputState.composing>=0&&!this.composing)this.composing={contextBase:n.updateRangeStart,editorBase:s,drifted:!1};let a=l-s>n.text.length;if(s==this.from&&r<this.from)s=r;else if(l==this.to&&r>this.to)l=r;let u=Z2(e.state.sliceDoc(s,l),n.text,(a?i.from:i.to)-s,a?"end":null);if(!u){let f=A.single(this.toEditorPos(n.selectionStart),this.toEditorPos(n.selectionEnd));if(!jp(f,i))e.dispatch({selection:f,userEvent:"select"});return}let c={from:u.from+s,to:u.toA+s,insert:he.of(n.text.slice(u.from,u.toB).split(`
33
+ `))};if((j.mac||j.android)&&c.from==o-1&&/^\. ?$/.test(n.text)&&e.contentDOM.getAttribute("autocorrect")=="off")c={from:s,to:l,insert:he.of([n.text.replace("."," ")])};if(this.pendingContextChange=c,!e.state.readOnly){let f=this.to-this.from+(c.to-c.from+c.insert.length);gx(e,c,A.single(this.toEditorPos(n.selectionStart,f),this.toEditorPos(n.selectionEnd,f)))}if(this.pendingContextChange)this.revertPending(e.state),this.setSelection(e.state);if(c.from<c.to&&!c.insert.length&&e.inputState.composing>=0&&!/[\\p{Alphabetic}\\p{Number}_]/.test(t.text.slice(Math.max(0,n.updateRangeStart-1),Math.min(t.text.length,n.updateRangeStart+1))))this.handlers.compositionend(n)},this.handlers.characterboundsupdate=(n)=>{let i=[],r=null;for(let o=this.toEditorPos(n.rangeStart),s=this.toEditorPos(n.rangeEnd);o<s;o++){let l=e.coordsForChar(o);r=l&&new DOMRect(l.left,l.top,l.right-l.left,l.bottom-l.top)||r||new DOMRect,i.push(r)}t.updateCharacterBounds(n.rangeStart,i)},this.handlers.textformatupdate=(n)=>{let i=[];for(let r of n.getTextFormats()){let{underlineStyle:o,underlineThickness:s}=r;if(!/none/i.test(o)&&!/none/i.test(s)){let l=this.toEditorPos(r.rangeStart),a=this.toEditorPos(r.rangeEnd);if(l<a){let u=`text-decoration: underline ${/^[a-z]/.test(o)?o+" ":o=="Dashed"?"dashed ":o=="Squiggle"?"wavy ":""}${/thin/i.test(s)?1:2}px`;i.push(Ae.mark({attributes:{style:u}}).range(l,a))}}}e.dispatch({effects:D2.of(Ae.set(i))})},this.handlers.compositionstart=()=>{if(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:n}=this.composing;if(this.composing=null,n)this.reset(e.state)}};for(let n in this.handlers)t.addEventListener(n,this.handlers[n]);this.measureReq={read:(n)=>{let i=Jc(n.root);if(i&&i.rangeCount)this.editContext.updateSelectionBounds(i.getRangeAt(0).getBoundingClientRect())}}}applyEdits(e){let t=0,n=!1,i=this.pendingContextChange;if(e.changes.iterChanges((r,o,s,l,a)=>{if(n)return;let u=a.length-(o-r);if(i&&o>=i.to)if(i.from==r&&i.to==o&&i.insert.eq(a)){i=this.pendingContextChange=null,t+=u,this.to+=u;return}else i=null,this.revertPending(e.state);if(r+=t,o+=t,o<=this.from)this.from+=u,this.to+=u;else if(r<this.to){if(r<this.from||o>this.to||this.to-this.from+a.length>30000){n=!0;return}this.editContext.updateText(this.toContextPos(r),this.toContextPos(o),a.toString()),this.to+=u}t+=u}),i&&!n)this.revertPending(e.state);return!n}update(e){let t=this.pendingContextChange,n=e.startState.selection.main;if(this.composing&&(this.composing.drifted||!e.changes.touchesRange(n.from,n.to)&&e.transactions.some((i)=>!i.isUserEvent("input.type")&&i.changes.touchesRange(this.from,this.to))))this.composing.drifted=!0,this.composing.editorBase=e.changes.mapPos(this.composing.editorBase);else if(!this.applyEdits(e)||!this.rangeIsValid(e.state))this.pendingContextChange=null,this.reset(e.state);else if(e.docChanged||e.selectionSet||t)this.setSelection(e.state);if(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,n=this.toContextPos(Math.max(this.from,Math.min(this.to,t.anchor))),i=this.toContextPos(t.head);if(this.editContext.selectionStart!=n||this.editContext.selectionEnd!=i)this.editContext.updateSelection(n,i)}rangeIsValid(e){let{head:t}=e.selection.main;return!(this.from>0&&t-this.from<500||this.to<e.doc.length&&this.to-t<500||this.to-this.from>30000)}toEditorPos(e,t=this.to-this.from){e=Math.min(e,t);let n=this.composing;return n&&n.drifted?n.editorBase+(e-n.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 Q{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;if(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:n}=e;if(this.dispatchTransactions=e.dispatchTransactions||n&&((i)=>i.forEach((r)=>n(r,this)))||((i)=>this.update(i)),this.dispatch=this.dispatch.bind(this),this._root=e.root||p6(e.parent)||document,this.viewState=new ix(this,e.state||pe.create(e)),e.scrollTo&&e.scrollTo.is(Op))this.viewState.scrollTarget=e.scrollTo.value.clip(this.viewState.state);this.plugins=this.state.facet(Ba).map((i)=>new zp(i));for(let i of this.plugins)i.update(this);if(this.observer=new bN(this),this.inputState=new eN(this),this.inputState.ensureHandlers(this.plugins),this.docView=new J0(this),this.mountStyles(),this.updateAttrs(),this.updateState=0,this.requestMeasure(),(t=document.fonts)===null||t===void 0?void 0:t.ready)document.fonts.ready.then(()=>{this.viewState.mustMeasureContent="refresh",this.requestMeasure()})}dispatch(...e){let t=e.length==1&&e[0]instanceof Je?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 Error("Calls to EditorView.update are not allowed while an update is in progress");let t=!1,n=!1,i,r=this.state;for(let f of e){if(f.startState!=r)throw RangeError("Trying to update state with a transaction that doesn't start from the previous state.");r=f.state}if(this.destroyed){this.viewState.state=r;return}let o=this.hasFocus,s=0,l=null;if(e.some((f)=>f.annotation(lN)))this.inputState.notifiedFocused=o,s=1;else if(o!=this.inputState.notifiedFocused){if(this.inputState.notifiedFocused=o,l=aN(r,o),!l)s=1}let a=this.observer.delayedAndroidKey,u=null;if(a){if(this.observer.clearDelayedAndroidKey(),u=this.observer.readChange(),u&&!this.state.doc.eq(r.doc)||!this.state.selection.eq(r.selection))u=null}else this.observer.clear();if(r.facet(pe.phrases)!=this.state.facet(pe.phrases))return this.setState(r);i=Up.create(this,r,e),i.flags|=s;let c=this.viewState.scrollTarget;try{this.updateState=2;for(let f of e){if(c)c=c.map(f.changes);if(f.scrollIntoView){let{main:d}=f.state.selection,{x:h,y:m}=this.state.facet(Q.cursorScrollMargin);c=new Ha(d.empty?d:A.cursor(d.head,d.head>d.anchor?-1:1),"nearest","nearest",m,h)}for(let d of f.effects)if(d.is(Op))c=d.value.clip(this.state)}if(this.viewState.update(i,c),this.bidiCache=qp.update(this.bidiCache,i.changes),!i.empty)this.updatePlugins(i),this.inputState.update(i);if(t=this.docView.update(i),this.state.facet(Fc)!=this.styleModules)this.mountStyles();n=this.updateAttrs(),this.showAnnouncements(e),this.docView.updateSelection(t,e.some((f)=>f.isUserEvent("select.pointer")))}finally{this.updateState=0}if(i.startState.facet(Np)!=i.state.facet(Np))this.viewState.mustMeasureContent=!0;if(t||n||c||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)this.requestMeasure();if(t)this.docViewUpdate();if(!i.empty)for(let f of this.state.facet(Q0))try{f(i)}catch(d){Xt(this.state,d,"update listener")}if(l||u)Promise.resolve().then(()=>{if(l&&this.state==l.startState)this.dispatch(l);if(u){if(!J2(this,u)&&a.force)Ia(this.contentDOM,a.key,a.keyCode)}})}setState(e){if(this.updateState!=0)throw 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 n of this.plugins)n.destroy(this);this.viewState=new ix(this,e),this.plugins=e.facet(Ba).map((n)=>new zp(n)),this.pluginMap.clear();for(let n of this.plugins)n.update(this);this.docView.destroy(),this.docView=new J0(this),this.inputState.ensureHandlers(this.plugins),this.mountStyles(),this.updateAttrs(),this.bidiCache=[]}finally{this.updateState=0}if(t)this.focus();this.requestMeasure()}updatePlugins(e){let t=e.startState.facet(Ba),n=e.state.facet(Ba);if(t!=n){let i=[];for(let r of n){let o=t.indexOf(r);if(o<0)i.push(new zp(r));else{let s=this.plugins[o];s.mustUpdate=e,i.push(s)}}for(let r of this.plugins)if(r.mustUpdate!=e)r.destroy(this);this.plugins=i,this.pluginMap.clear()}else for(let i of this.plugins)i.mustUpdate=e;for(let i=0;i<this.plugins.length;i++)this.plugins[i].update(this);if(t!=n)this.inputState.ensureHandlers(this.plugins)}docViewUpdate(){for(let e of this.plugins){let t=e.value;if(t&&t.docViewUpdate)try{t.docViewUpdate(this)}catch(n){Xt(this.state,n,"doc view update listener")}}}measure(e=!0){if(this.destroyed)return;if(this.measureScheduled>-1)this.win.cancelAnimationFrame(this.measureScheduled);if(this.observer.delayedAndroidKey){this.measureScheduled=-1,this.requestMeasure();return}if(this.measureScheduled=0,e)this.observer.forceFlush();let t=null,n=this.viewState.scrollParent,i=this.viewState.getScrollOffset(),{scrollAnchorPos:r,scrollAnchorHeight:o,scaleY:s}=this.viewState;if(Math.abs(i-this.viewState.scrollOffset)>1)o=-1;this.viewState.scrollAnchorHeight=-1;try{for(let l=0;;l++){if(o<0){if(v2(n||this.win))r=-1,o=this.viewState.heightMap.height/this.viewState.scaleY;else{let h=this.viewState.scrollAnchorAt(i);r=h.from,o=h.top}s=this.viewState.scaleY}this.updateState=1;let a=this.viewState.measure();if(!a&&!this.measureRequests.length&&this.viewState.scrollTarget==null)break;if(l>5){console.warn(this.measureRequests.length?"Measure loop restarted more than 5 times":"Viewport failed to stabilize");break}let u=[];if(!(a&4))[this.measureRequests,u]=[u,this.measureRequests];let c=u.map((h)=>{try{return h.read(this)}catch(m){return Xt(this.state,m),r2}}),f=Up.create(this,this.state,[]),d=!1;if(f.flags|=a,!t)t=f;else t.flags|=a;if(this.updateState=2,!f.empty){if(this.updatePlugins(f),this.inputState.update(f),this.updateAttrs(),d=this.docView.update(f),d)this.docViewUpdate()}for(let h=0;h<u.length;h++)if(c[h]!=r2)try{let m=u[h];if(m.write)m.write(c[h],this)}catch(m){Xt(this.state,m)}if(d)this.docView.updateSelection(!0);if(!f.viewportChanged&&this.measureRequests.length==0){if(this.viewState.editorHeight)if(this.viewState.scrollTarget){this.docView.scrollIntoView(this.viewState.scrollTarget),this.viewState.scrollTarget=null,o=-1;continue}else{let m=(r<0?this.viewState.heightMap.height:this.viewState.lineBlockAt(r).top)/this.viewState.scaleY-o/s;if((m>1||m<-1)&&!(j.ios&&this.inputState.lastIOSMomentumScroll>Date.now()-100)&&(n==this.scrollDOM||this.hasFocus||Math.max(this.inputState.lastWheelEvent,this.inputState.lastTouchTime)>Date.now()-100)){if(i=i+m,!n)this.win.scrollBy(0,m);else if(r<0)n.scrollTop=n.scrollHeight;else n.scrollTop+=m;o=-1;continue}}break}}}finally{this.updateState=0,this.measureScheduled=-1}if(t&&!t.empty)for(let l of this.state.facet(Q0))l(t)}get themeClasses(){return ox+" "+(this.state.facet(rx)?gN:mN)+" "+this.state.facet(Np)}updateAttrs(){let e=o2(this,L2,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),t={spellcheck:"false",autocorrect:"off",autocapitalize:"off",writingsuggestions:"false",translate:"no",contenteditable:!this.state.facet(Ir)?"false":"true",class:"cm-content",style:`${j.tabSize}: ${this.state.tabSize}`,role:"textbox","aria-multiline":"true"};if(this.state.readOnly)t["aria-readonly"]="true";o2(this,hx,t);let n=this.observer.ignore(()=>{let i=PM(this.contentDOM,this.contentAttrs,t),r=PM(this.dom,this.editorAttrs,e);return i||r});return this.editorAttrs=e,this.contentAttrs=t,n}showAnnouncements(e){let t=!0;for(let n of e)for(let i of n.effects)if(i.is(Q.announce)){if(t)this.announceDOM.textContent="",this.win.clearTimeout(this.clearAnnouncement),this.clearAnnouncement=this.win.setTimeout(()=>{this.announceDOM.textContent=" "},200),t=!1;let r=this.announceDOM.appendChild(document.createElement("div"));r.textContent=i.value}}mountStyles(){this.styleModules=this.state.facet(Fc);let e=this.state.facet(Q.cspNonce);vi.mount(this.root,this.styleModules.concat(wH).reverse(),e?{nonce:e}:void 0)}readMeasured(){if(this.updateState==2)throw Error("Reading the editor layout isn't allowed during an update");if(this.updateState==0&&this.measureScheduled>-1)this.measure(!1)}requestMeasure(e){if(this.measureScheduled<0)this.measureScheduled=this.win.requestAnimationFrame(()=>this.measure());if(e){if(this.measureRequests.indexOf(e)>-1)return;if(e.key!=null){for(let t=0;t<this.measureRequests.length;t++)if(this.measureRequests[t].key===e.key){this.measureRequests[t]=e;return}}this.measureRequests.push(e)}}plugin(e){let t=this.pluginMap.get(e);if(t===void 0||t&&t.plugin!=e)this.pluginMap.set(e,t=this.plugins.find((n)=>n.plugin==e)||null);return 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,n){return V0(this,e,jM(this,e,t,n))}moveByGroup(e,t){return V0(this,e,jM(this,e,t,(n)=>q6(this,e.head,n)))}visualLineSide(e,t){return t?A.cursor(e.to,1):A.cursor(e.from,-1)}moveToLineBoundary(e,t,n=!0){return F6(this,e,t,n)}moveVertically(e,t,n){return V0(this,e,$6(this,e,t,n))}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 n=ex(this,e,t);return n&&n.pos}posAndSideAtCoords(e,t=!0){return this.readMeasured(),ex(this,e,t)}coordsAtPos(e,t=1){this.readMeasured();let n=this.state.doc.lineAt(e),i=this.bidiSpans(n),r=i[wi.find(i,e-n.from,-1,t)];if(n.length&&(e==n.from&&t<0||e==n.to&&t>0)&&r.dir!=this.textDirectionAt(n.from))if(e==n.to)e=n.from+r.from,t=1;else e=n.from+r.to,t=-1;return this.docView.coordsAt(e,t,r.dir==Ke.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){if(!this.state.facet(M2)||e<this.viewport.from||e>this.viewport.to)return this.textDirection;return this.readMeasured(),this.docView.textDirectionAt(e)}get lineWrapping(){return this.viewState.heightOracle.lineWrapping}bidiSpans(e){if(e.length>_H)return k2(e.length);let t=this.textDirectionAt(e.from),n;for(let r of this.bidiCache)if(r.from==e.from&&r.dir==t&&(r.fresh||S2(r.isolates,n=VM(this,e))))return r.order;if(!n)n=VM(this,e);let i=S6(e.text,t,n);return this.bidiCache.push(new qp(e.from,e.to,t,n,!0,i)),i}get hasFocus(){var e;return(this.dom.ownerDocument.hasFocus()||j.safari&&((e=this.inputState)===null||e===void 0?void 0:e.lastContextMenu)>Date.now()-30000)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore(()=>{g2(this.contentDOM),this.docView.updateSelection()})}setRoot(e){if(this._root!=e)this._root=e,this.observer.setWindow((e.nodeType==9?e:e.ownerDocument).defaultView||window),this.mountStyles()}destroy(){if(this.root.activeElement==this.contentDOM)this.contentDOM.blur();for(let e of this.plugins)e.destroy(this);if(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 n,i,r,o;return Op.of(new Ha(typeof e=="number"?A.cursor(e):e,(n=t.y)!==null&&n!==void 0?n:"nearest",(i=t.x)!==null&&i!==void 0?i:"nearest",(r=t.yMargin)!==null&&r!==void 0?r:5,(o=t.xMargin)!==null&&o!==void 0?o:5))}scrollSnapshot(){let{scrollTop:e,scrollLeft:t}=this.scrollDOM,n=this.viewState.scrollAnchorAt(e);return Op.of(new Ha(A.cursor(n.from),"start","start",n.top-e,t,!0))}setTabFocusMode(e){if(e==null)this.inputState.tabFocusMode=this.inputState.tabFocusMode<0?0:-1;else if(typeof e=="boolean")this.inputState.tabFocusMode=e?0:-1;else if(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 n=vi.newName(),i=[Np.of(n),Fc.of(sx(`.${n}`,e))];if(t&&t.dark)i.push(rx.of(!0));return i}static baseTheme(e){return nr.lowest(Fc.of(sx("."+ox,e,vN)))}static findFromDOM(e){var t;let n=e.querySelector(".cm-content"),i=n&&Ge.get(n)||Ge.get(e);return((t=i===null||i===void 0?void 0:i.root)===null||t===void 0?void 0:t.view)||null}}Q.styleModule=Fc;Q.inputHandler=A2;Q.clipboardInputFilter=fx;Q.clipboardOutputFilter=dx;Q.scrollHandler=N2;Q.focusChangeEffect=T2;Q.perLineTextDirection=M2;Q.exceptionSink=R2;Q.updateListener=Q0;Q.editable=Ir;Q.mouseSelectionStyle=O2;Q.dragMovesSelection=E2;Q.clickAddsSelectionRange=C2;Q.decorations=Xp;Q.blockWrappers=z2;Q.outerDecorations=px;Q.atomicRanges=of;Q.bidiIsolatedRanges=B2;Q.cursorScrollMargin=Z.define({combine:(e)=>{let t=5,n=5;for(let i of e)if(typeof i=="number")t=n=i;else({x:t,y:n}=i);return{x:t,y:n}}});Q.scrollMargins=P2;Q.darkTheme=rx;Q.cspNonce=Z.define({combine:(e)=>e.length?e[0]:""});Q.contentAttributes=hx;Q.editorAttributes=L2;Q.lineWrapping=Q.contentAttributes.of({class:"cm-lineWrapping"});Q.announce=ye.define();var _H=4096,r2={};class qp{constructor(e,t,n,i,r,o){this.from=e,this.to=t,this.dir=n,this.isolates=i,this.fresh=r,this.order=o}static update(e,t){if(t.empty&&!e.some((r)=>r.fresh))return e;let n=[],i=e.length?e[e.length-1].dir:Ke.LTR;for(let r=Math.max(0,e.length-10);r<e.length;r++){let o=e[r];if(o.dir==i&&!t.touchesRange(o.from,o.to))n.push(new qp(t.mapPos(o.from,1),t.mapPos(o.to,-1),o.dir,o.isolates,!1,o.order))}return n}}function o2(e,t,n){for(let i=e.state.facet(t),r=i.length-1;r>=0;r--){let o=i[r],s=typeof o=="function"?o(e):o;if(s)ax(s,n)}return n}var CH=j.mac?"mac":j.windows?"win":j.linux?"linux":"key";function EH(e,t){let n=e.split(/-(?!$)/),i=n[n.length-1];if(i=="Space")i=" ";let r,o,s,l;for(let a=0;a<n.length-1;++a){let u=n[a];if(/^(cmd|meta|m)$/i.test(u))l=!0;else if(/^a(lt)?$/i.test(u))r=!0;else if(/^(c|ctrl|control)$/i.test(u))o=!0;else if(/^s(hift)?$/i.test(u))s=!0;else if(/^mod$/i.test(u))if(t=="mac")l=!0;else o=!0;else throw Error("Unrecognized modifier name: "+u)}if(r)i="Alt-"+i;if(o)i="Ctrl-"+i;if(l)i="Meta-"+i;if(s)i="Shift-"+i;return i}function Dp(e,t,n){if(t.altKey)e="Alt-"+e;if(t.ctrlKey)e="Ctrl-"+e;if(t.metaKey)e="Meta-"+e;if(n!==!1&&t.shiftKey)e="Shift-"+e;return e}var OH=nr.default(Q.domEventHandlers({keydown(e,t){return MH(RH(t.state),e,t,"editor")}})),Ka=Z.define({enables:OH}),s2=new WeakMap;function RH(e){let t=e.facet(Ka),n=s2.get(t);if(!n)s2.set(t,n=TH(t.reduce((i,r)=>i.concat(r),[])));return n}var Bo=null,AH=4000;function TH(e,t=CH){let n=Object.create(null),i=Object.create(null),r=(s,l)=>{let a=i[s];if(a==null)i[s]=l;else if(a!=l)throw Error("Key binding "+s+" is used both as a regular binding and as a multi-stroke prefix")},o=(s,l,a,u,c)=>{var f,d;let h=n[s]||(n[s]=Object.create(null)),m=l.split(/ (?!$)/).map((g)=>EH(g,t));for(let g=1;g<m.length;g++){let v=m.slice(0,g).join(" ");if(r(v,!0),!h[v])h[v]={preventDefault:!0,stopPropagation:!1,run:[(w)=>{let S=Bo={view:w,prefix:v,scope:s};return setTimeout(()=>{if(Bo==S)Bo=null},AH),!0}]}}let b=m.join(" ");r(b,!1);let x=h[b]||(h[b]={preventDefault:!1,stopPropagation:!1,run:((d=(f=h._any)===null||f===void 0?void 0:f.run)===null||d===void 0?void 0:d.slice())||[]});if(a)x.run.push(a);if(u)x.preventDefault=!0;if(c)x.stopPropagation=!0};for(let s of e){let l=s.scope?s.scope.split(" "):["editor"];if(s.any)for(let u of l){let c=n[u]||(n[u]=Object.create(null));if(!c._any)c._any={preventDefault:!1,stopPropagation:!1,run:[]};let{any:f}=s;for(let d in c)c[d].run.push((h)=>f(h,lx))}let a=s[t]||s.key;if(!a)continue;for(let u of l)if(o(u,a,s.run,s.preventDefault,s.stopPropagation),s.shift)o(u,"Shift-"+a,s.shift,s.preventDefault,s.stopPropagation)}return n}var lx=null;function MH(e,t,n,i){lx=t;let r=DM(t),o=Br(r,0),s=zo(o)==r.length&&r!=" ",l="",a=!1,u=!1,c=!1;if(Bo&&Bo.view==n&&Bo.scope==i){if(l=Bo.prefix+" ",nN.indexOf(t.keyCode)<0)u=!0,Bo=null}let f=new Set,d=(x)=>{if(x){for(let g of x.run)if(!f.has(g)){if(f.add(g),g(n)){if(x.stopPropagation)c=!0;return!0}}if(x.preventDefault){if(x.stopPropagation)c=!0;u=!0}}return!1},h=e[i],m,b;if(h){if(d(h[l+Dp(r,t,!s)]))a=!0;else if(s&&(t.altKey||t.metaKey||t.ctrlKey)&&!(j.windows&&t.ctrlKey&&t.altKey)&&!(j.mac&&t.altKey&&!(t.ctrlKey||t.metaKey))&&(m=Pr[t.keyCode])&&m!=r){if(d(h[l+Dp(m,t,!0)]))a=!0;else if(t.shiftKey&&(b=La[t.keyCode])!=r&&b!=m&&d(h[l+Dp(b,t,!1)]))a=!0}else if(s&&t.shiftKey&&d(h[l+Dp(r,t,!0)]))a=!0;if(!a&&d(h._any))a=!0}if(u)a=!0;if(a&&c)t.stopPropagation();return lx=null,a}var NH=j.gecko&&j.gecko_version==153?"#ffffff01":"transparent",hq=nr.highest(Q.theme({".cm-line":{"& ::selection, &::selection":{backgroundColor:`${NH} !important`},caretColor:"transparent !important"},".cm-content":{caretColor:"transparent !important","& :focus":{caretColor:"initial !important","&::selection, & ::selection":{backgroundColor:"Highlight !important"}}}}));var pq=/x/.unicode!=null?"gu":"g";class xN extends Ho{constructor(e){super();this.content=e}toDOM(e){let t=document.createElement("span");return t.className="cm-placeholder",t.style.pointerEvents="none",t.appendChild(typeof this.content=="string"?document.createTextNode(this.content):typeof this.content=="function"?this.content(e):this.content.cloneNode(!0)),t.setAttribute("aria-hidden","true"),t}coordsAt(e){let t=e.firstChild?Gc(e.firstChild):[];if(!t.length)return null;let n=window.getComputedStyle(e.parentNode),i=Zc(t[0],n.direction!="rtl"),r=parseInt(n.lineHeight);if(i.bottom-i.top>r*1.5)return{left:i.left,right:i.right,top:i.top,bottom:i.top+r};return i}ignoreEvent(){return!1}}function wN(e){let t=En.fromClass(class{constructor(n){this.view=n,this.placeholder=e?Ae.set([Ae.widget({widget:new xN(e),side:1}).range(0)]):Ae.none}get decorations(){return this.view.state.doc.length?Ae.none:this.placeholder}},{decorations:(n)=>n.decorations});return typeof e=="string"?[t,Q.contentAttributes.of({"aria-placeholder":e})]:t}var Lp="-10000px";class SN{constructor(e,t,n,i){this.facet=t,this.createTooltipView=n,this.removeTooltipView=i,this.input=e.state.facet(t),this.tooltips=this.input.filter((o)=>o);let r=null;this.tooltipViews=this.tooltips.map((o)=>r=n(o,r))}update(e,t){var n;let i=e.state.facet(this.facet),r=i.filter((l)=>l);if(i===this.input){for(let l of this.tooltipViews)if(l.update)l.update(e);return!1}let o=[],s=t?[]:null;for(let l=0;l<r.length;l++){let a=r[l],u=-1;if(!a)continue;for(let c=0;c<this.tooltips.length;c++){let f=this.tooltips[c];if(f&&f.create==a.create)u=c}if(u<0){if(o[l]=this.createTooltipView(a,l?o[l-1]:null),s)s[l]=!!a.above}else{let c=o[l]=this.tooltipViews[u];if(s)s[l]=t[u];if(c.update)c.update(e)}}for(let l of this.tooltipViews)if(o.indexOf(l)<0)this.removeTooltipView(l),(n=l.destroy)===null||n===void 0||n.call(l);if(t)s.forEach((l,a)=>t[a]=l),t.length=s.length;return this.input=i,this.tooltips=r,this.tooltipViews=o,!0}}function DH(e){let t=e.dom.ownerDocument.documentElement;return{top:0,left:0,bottom:t.clientHeight,right:t.clientWidth}}var K0=Z.define({combine:(e)=>{var t,n,i;return{position:j.ios?"absolute":((t=e.find((r)=>r.position))===null||t===void 0?void 0:t.position)||"fixed",parent:((n=e.find((r)=>r.parent))===null||n===void 0?void 0:n.parent)||null,tooltipSpace:((i=e.find((r)=>r.tooltipSpace))===null||i===void 0?void 0:i.tooltipSpace)||DH}}}),l2=new WeakMap,kN=En.fromClass(class{constructor(e){this.view=e,this.above=[],this.inView=!0,this.madeAbsolute=!1,this.lastTransaction=0,this.measureTimeout=-1;let t=e.state.facet(K0);this.position=t.position,this.parent=t.parent,this.classes=e.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 SN(e,xx,(n,i)=>this.createTooltip(n,i),(n)=>{if(this.resizeObserver)this.resizeObserver.unobserve(n.dom);n.dom.remove()}),this.above=this.manager.tooltips.map((n)=>!!n.above),this.intersectionObserver=typeof IntersectionObserver=="function"?new IntersectionObserver((n)=>{if(Date.now()>this.lastTransaction-50&&n.length>0&&n[n.length-1].intersectionRatio<1)this.measureSoon()},{threshold:[1]}):null,this.observeIntersection(),e.win.addEventListener("resize",this.measureSoon=this.measureSoon.bind(this)),this.maybeMeasure()}createContainer(){if(this.parent)this.container=document.createElement("div"),this.container.style.position="relative",this.container.className=this.view.themeClasses,this.parent.appendChild(this.container);else this.container=this.view.dom}observeIntersection(){if(this.intersectionObserver){this.intersectionObserver.disconnect();for(let e of this.manager.tooltipViews)this.intersectionObserver.observe(e.dom)}}measureSoon(){if(this.measureTimeout<0)this.measureTimeout=setTimeout(()=>{this.measureTimeout=-1,this.maybeMeasure()},50)}update(e){if(e.transactions.length)this.lastTransaction=Date.now();let t=this.manager.update(e,this.above);if(t)this.observeIntersection();let n=t||e.geometryChanged,i=e.state.facet(K0);if(i.position!=this.position&&!this.madeAbsolute){this.position=i.position;for(let r of this.manager.tooltipViews)r.dom.style.position=this.position;n=!0}if(i.parent!=this.parent){if(this.parent)this.container.remove();this.parent=i.parent,this.createContainer();for(let r of this.manager.tooltipViews)this.container.appendChild(r.dom);n=!0}else if(this.parent&&this.view.themeClasses!=this.classes)this.classes=this.container.className=this.view.themeClasses;if(n)this.maybeMeasure()}createTooltip(e,t){let n=e.create(this.view),i=t?t.dom:null;if(n.dom.classList.add("cm-tooltip"),e.arrow&&!n.dom.querySelector(".cm-tooltip > .cm-tooltip-arrow")){let r=document.createElement("div");r.className="cm-tooltip-arrow",n.dom.appendChild(r)}if(n.dom.style.position=this.position,n.dom.style.top=Lp,n.dom.style.left="0px",this.container.insertBefore(n.dom,i),n.mount)n.mount(this.view);if(this.resizeObserver)this.resizeObserver.observe(n.dom);return n}destroy(){var e,t,n;this.view.win.removeEventListener("resize",this.measureSoon);for(let i of this.manager.tooltipViews)i.dom.remove(),(e=i.destroy)===null||e===void 0||e.call(i);if(this.parent)this.container.remove();(t=this.resizeObserver)===null||t===void 0||t.disconnect(),(n=this.intersectionObserver)===null||n===void 0||n.disconnect(),clearTimeout(this.measureTimeout)}readMeasure(){let e=1,t=1,n=!1;if(this.position=="fixed"&&this.manager.tooltipViews.length){let{dom:o}=this.manager.tooltipViews[0];if(j.safari){let s=o.getBoundingClientRect();n=Math.abs(s.top+1e4)>1||Math.abs(s.left)>1}else n=!!o.offsetParent&&o.offsetParent!=this.container.ownerDocument.body}if(n||this.position=="absolute")if(this.parent){let o=this.parent.getBoundingClientRect();if(o.width&&o.height)e=o.width/this.parent.offsetWidth,t=o.height/this.parent.offsetHeight}else({scaleX:e,scaleY:t}=this.view.viewState);let i=this.view.scrollDOM.getBoundingClientRect(),r=mx(this.view);return{visible:{left:i.left+r.left,top:i.top+r.top,right:i.right-r.right,bottom:i.bottom-r.bottom},parent:this.parent?this.container.getBoundingClientRect():this.view.dom.getBoundingClientRect(),pos:this.manager.tooltips.map((o,s)=>{let l=this.manager.tooltipViews[s];return l.getCoords?l.getCoords(o.pos):this.view.coordsAtPos(o.pos)}),size:this.manager.tooltipViews.map(({dom:o})=>o.getBoundingClientRect()),space:this.view.state.facet(K0).tooltipSpace(this.view),scaleX:e,scaleY:t,makeAbsolute:n}}writeMeasure(e){var t;if(e.makeAbsolute){this.madeAbsolute=!0,this.position="absolute";for(let l of this.manager.tooltipViews)l.dom.style.position="absolute"}let{visible:n,space:i,scaleX:r,scaleY:o}=e,s=[];for(let l=0;l<this.manager.tooltips.length;l++){let a=this.manager.tooltips[l],u=this.manager.tooltipViews[l],{dom:c}=u,f=e.pos[l],d=e.size[l];if(!f||a.clip!==!1&&(f.bottom<=Math.max(n.top,i.top)||f.top>=Math.min(n.bottom,i.bottom)||f.right<Math.max(n.left,i.left)-0.1||f.left>Math.min(n.right,i.right)+0.1)){c.style.top=Lp;continue}let h=a.arrow?u.dom.querySelector(".cm-tooltip-arrow"):null,m=h?7:0,b=d.right-d.left,x=(t=l2.get(u))!==null&&t!==void 0?t:d.bottom-d.top,g=u.offset||zH,v=this.view.textDirection==Ke.LTR,w=d.width>i.right-i.left?v?i.left:i.right-d.width:v?Math.max(i.left,Math.min(f.left-(h?14:0)+g.x,i.right-b)):Math.min(Math.max(i.left,f.left-b+(h?14:0)-g.x),i.right-b),S=this.above[l];if(!a.strictSide&&(S?f.top-x-m-g.y<i.top:f.bottom+x+m+g.y>i.bottom)&&S==i.bottom-f.bottom>f.top-i.top)S=this.above[l]=!S;let k=(S?f.top-i.top:i.bottom-f.bottom)-m;if(k<x&&u.resize!==!1){if(k<this.view.defaultLineHeight){c.style.top=Lp;continue}l2.set(u,x),c.style.height=(x=k)/o+"px"}else if(c.style.height)c.style.height="";let E=S?f.top-x-m-g.y:f.bottom+m+g.y,_=w+b;if(u.overlap!==!0){for(let O of s)if(O.left<_&&O.right>w&&O.top<E+x&&O.bottom>E)E=S?O.top-x-2-m:O.bottom+m+2}if(this.position=="absolute")c.style.top=(E-e.parent.top)/o+"px",a2(c,(w-e.parent.left)/r);else c.style.top=E/o+"px",a2(c,w/r);if(h){let O=f.left+(v?g.x:-g.x)-(w+14-7);h.style.left=O/r+"px"}if(u.overlap!==!0)s.push({left:w,top:E,right:_,bottom:E+x});if(c.classList.toggle("cm-tooltip-above",S),c.classList.toggle("cm-tooltip-below",!S),u.positioned)u.positioned(e.space)}}maybeMeasure(){if(this.manager.tooltips.length){if(this.view.inView)this.view.requestMeasure(this.measureReq);if(this.inView!=this.view.inView){if(this.inView=this.view.inView,!this.inView)for(let e of this.manager.tooltipViews)e.dom.style.top=Lp}}}},{eventObservers:{scroll(){this.maybeMeasure()}}});function a2(e,t){let n=parseInt(e.style.left,10);if(isNaN(n)||Math.abs(t-n)>1)e.style.left=t+"px"}var LH=Q.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"}}}),zH={x:0,y:0},xx=Z.define({enables:[kN,LH]});function wx(e,t){let n=e.plugin(kN);if(!n)return null;let i=n.manager.tooltips.indexOf(t);return i<0?null:n.manager.tooltipViews[i]}class Io extends gi{compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}eq(e){return!1}destroy(e){}}Io.prototype.elementClass="";Io.prototype.toDOM=void 0;Io.prototype.mapMode=qt.TrackBefore;Io.prototype.startSide=Io.prototype.endSide=-1;Io.prototype.point=!0;var BH=0;class Wp{constructor(e,t){this.from=e,this.to=t}}class ce{constructor(e={}){this.id=BH++,this.perNode=!!e.perNode,this.deserialize=e.deserialize||(()=>{throw Error("This node type doesn't define a deserialize function")}),this.combine=e.combine||null}add(e){if(this.perNode)throw RangeError("Can't add per-node props to node types");if(typeof e!="function")e=On.match(e);return(t)=>{let n=e(t);return n===void 0?null:[this,n]}}}ce.closedBy=new ce({deserialize:(e)=>e.split(" ")});ce.openedBy=new ce({deserialize:(e)=>e.split(" ")});ce.group=new ce({deserialize:(e)=>e.split(" ")});ce.isolate=new ce({deserialize:(e)=>{if(e&&e!="rtl"&&e!="ltr"&&e!="auto")throw RangeError("Invalid value for isolate: "+e);return e||"auto"}});ce.contextHash=new ce({perNode:!0});ce.lookAhead=new ce({perNode:!0});ce.mounted=new ce({perNode:!0});class ja{constructor(e,t,n,i=!1){this.tree=e,this.overlay=t,this.parser=n,this.bracketed=i}static get(e){return e&&e.props&&e.props[ce.mounted.id]}}var PH=Object.create(null);class On{constructor(e,t,n,i=0){this.name=e,this.props=t,this.id=n,this.flags=i}static define(e){let t=e.props&&e.props.length?Object.create(null):PH,n=(e.top?1:0)|(e.skipped?2:0)|(e.error?4:0)|(e.name==null?8:0),i=new On(e.name||"",t,e.id,n);if(e.props)for(let r of e.props){if(!Array.isArray(r))r=r(i);if(r){if(r[0].perNode)throw RangeError("Can't store a per-node prop on a node type");t[r[0].id]=r[1]}}return i}prop(e){return this.props[e.id]}get isTop(){return(this.flags&1)>0}get isSkipped(){return(this.flags&2)>0}get isError(){return(this.flags&4)>0}get isAnonymous(){return(this.flags&8)>0}is(e){if(typeof e=="string"){if(this.name==e)return!0;let t=this.prop(ce.group);return t?t.indexOf(e)>-1:!1}return this.id==e}static match(e){let t=Object.create(null);for(let n in e)for(let i of n.split(" "))t[i]=e[n];return(n)=>{for(let i=n.prop(ce.group),r=-1;r<(i?i.length:0);r++){let o=t[r<0?n.name:i[r]];if(o)return o}}}}On.none=new On("",Object.create(null),0,8);var Yp=new WeakMap,_N=new WeakMap,Ze;(function(e){e[e.ExcludeBuffers=1]="ExcludeBuffers",e[e.IncludeAnonymous=2]="IncludeAnonymous",e[e.IgnoreMounts=4]="IgnoreMounts",e[e.IgnoreOverlays=8]="IgnoreOverlays",e[e.EnterBracketed=16]="EnterBracketed"})(Ze||(Ze={}));class St{constructor(e,t,n,i,r){if(this.type=e,this.children=t,this.positions=n,this.length=i,this.props=null,r&&r.length){this.props=Object.create(null);for(let[o,s]of r)this.props[typeof o=="number"?o:o.id]=s}}toString(){let e=ja.get(this);if(e&&!e.overlay)return e.tree.toString();let t="";for(let n of this.children){let i=n.toString();if(i){if(t)t+=",";t+=i}}return!this.type.name?t:(/\W/.test(this.type.name)&&!this.type.isError?JSON.stringify(this.type.name):this.type.name)+(t.length?"("+t+")":"")}cursor(e=0){return new Jp(this.topNode,e)}cursorAt(e,t=0,n=0){let i=Yp.get(this)||this.topNode,r=new Jp(i);return r.moveTo(e,t),Yp.set(this,r._tree),r}get topNode(){return new Yn(this,0,0,null)}resolve(e,t=0){let n=af(Yp.get(this)||this.topNode,e,t,!1);return Yp.set(this,n),n}resolveInner(e,t=0){let n=af(_N.get(this)||this.topNode,e,t,!0);return _N.set(this,n),n}resolveStack(e,t=0){return IH(this,e,t)}iterate(e){let{enter:t,leave:n,from:i=0,to:r=this.length}=e,o=e.mode||0,s=(o&Ze.IncludeAnonymous)>0;for(let l=this.cursor(o|Ze.IncludeAnonymous);;){let a=!1;if(l.from<=r&&l.to>=i&&(!s&&l.type.isAnonymous||t(l)!==!1)){if(l.firstChild())continue;a=!0}for(;;){if(a&&n&&(s||!l.type.isAnonymous))n(l);if(l.nextSibling())break;if(!l.parent())return;a=!0}}}prop(e){return!e.perNode?this.type.prop(e):this.props?this.props[e.id]:void 0}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:Ex(On.none,this.children,this.positions,0,this.children.length,0,this.length,(t,n,i)=>new St(this.type,t,n,i,this.propValues),e.makeTree||((t,n,i)=>new St(On.none,t,n,i)))}static build(e){return HH(e)}}St.empty=new St(On.none,[],[],0);class kx{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 kx(this.buffer,this.index)}}class Uo{constructor(e,t,n){this.buffer=e,this.length=t,this.set=n}get type(){return On.none}toString(){let e=[];for(let t=0;t<this.buffer.length;)e.push(this.childString(t)),t=this.buffer[t+3];return e.join(",")}childString(e){let t=this.buffer[e],n=this.buffer[e+3],i=this.set.types[t],r=i.name;if(/\W/.test(r)&&!i.isError)r=JSON.stringify(r);if(e+=4,n==e)return r;let o=[];while(e<n)o.push(this.childString(e)),e=this.buffer[e+3];return r+"("+o.join(",")+")"}findChild(e,t,n,i,r){let{buffer:o}=this,s=-1;for(let l=e;l!=t;l=o[l+3])if(ON(r,i,o[l+1],o[l+2])){if(s=l,n>0)break}return s}slice(e,t,n){let i=this.buffer,r=new Uint16Array(t-e),o=0;for(let s=e,l=0;s<t;){r[l++]=i[s++],r[l++]=i[s++]-n;let a=r[l++]=i[s++]-n;r[l++]=i[s++]-e,o=Math.max(o,a)}return new Uo(r,o,this.set)}}function ON(e,t,n,i){switch(e){case-2:return n<t;case-1:return i>=t&&n<t;case 0:return n<t&&i>t;case 1:return n<=t&&i>t;case 2:return i>t;case 4:return!0}}function af(e,t,n,i){var r;while(e.from==e.to||(n<1?e.from>=t:e.from>t)||(n>-1?e.to<=t:e.to<t)){let s=!i&&e instanceof Yn&&e.index<0?null:e.parent;if(!s)return e;e=s}let o=i?0:Ze.IgnoreOverlays;if(i){for(let s=e,l=s.parent;l;s=l,l=s.parent)if(s instanceof Yn&&s.index<0&&((r=l.enter(t,n,o))===null||r===void 0?void 0:r.from)!=s.from)e=l}for(;;){let s=e.enter(t,n,o);if(!s)return e;e=s}}class _x{cursor(e=0){return new Jp(this,e)}getChild(e,t=null,n=null){let i=CN(this,e,t,n);return i.length?i[0]:null}getChildren(e,t=null,n=null){return CN(this,e,t,n)}resolve(e,t=0){return af(this,e,t,!1)}resolveInner(e,t=0){return af(this,e,t,!0)}matchContext(e){return Sx(this.parent,e)}enterUnfinishedNodesBefore(e){let t=this.childBefore(e),n=this;while(t){let i=t.lastChild;if(!i||i.to!=t.to)break;if(i.type.isError&&i.from==i.to)n=t,t=i.prevSibling;else t=i}return n}get node(){return this}get next(){return this.parent}}class Yn extends _x{constructor(e,t,n,i){super();this._tree=e,this.from=t,this.index=n,this._parent=i}get type(){return this._tree.type}get name(){return this._tree.type.name}get to(){return this.from+this._tree.length}nextChild(e,t,n,i,r=0){for(let o=this;;){for(let{children:s,positions:l}=o._tree,a=t>0?s.length:-1;e!=a;e+=t){let u=s[e],c=l[e]+o.from,f;if(!(r&Ze.EnterBracketed&&u instanceof St&&(f=ja.get(u))&&!f.overlay&&f.bracketed&&n>=c&&n<=c+u.length)&&!ON(i,n,c,c+u.length))continue;if(u instanceof Uo){if(r&Ze.ExcludeBuffers)continue;let d=u.findChild(0,u.buffer.length,t,n-c,i);if(d>-1)return new Vo(new RN(o,u,e,c),null,d)}else if(r&Ze.IncludeAnonymous||(!u.type.isAnonymous||Cx(u))){let d;if(!(r&Ze.IgnoreMounts)&&(d=ja.get(u))&&!d.overlay)return new Yn(d.tree,c,e,o);let h=new Yn(u,c,e,o);return r&Ze.IncludeAnonymous||!h.type.isAnonymous?h:h.nextChild(t<0?u.children.length-1:0,t,n,i,r)}}if(r&Ze.IncludeAnonymous||!o.type.isAnonymous)return null;if(o.index>=0)e=o.index+t;else e=t<0?-1:o._parent._tree.children.length;if(o=o._parent,!o)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,n=0){let i;if(!(n&Ze.IgnoreOverlays)&&(i=ja.get(this._tree))&&i.overlay){let r=e-this.from,o=n&Ze.EnterBracketed&&i.bracketed;for(let{from:s,to:l}of i.overlay)if((t>0||o?s<=r:s<r)&&(t<0||o?l>=r:l>r))return new Yn(i.tree,i.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,e,t,n)}nextSignificantParent(){let e=this;while(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 CN(e,t,n,i){let r=e.cursor(),o=[];if(!r.firstChild())return o;if(n!=null){for(let s=!1;!s;)if(s=r.type.is(n),!r.nextSibling())return o}for(;;){if(i!=null&&r.type.is(i))return o;if(r.type.is(t))o.push(r.node);if(!r.nextSibling())return i==null?o:[]}}function Sx(e,t,n=t.length-1){for(let i=e;n>=0;i=i.parent){if(!i)return!1;if(!i.type.isAnonymous){if(t[n]&&t[n]!=i.name)return!1;n--}}return!0}class RN{constructor(e,t,n,i){this.parent=e,this.buffer=t,this.index=n,this.start=i}}class Vo extends _x{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,n){super();this.context=e,this._parent=t,this.index=n,this.type=e.buffer.set.types[e.buffer.buffer[n]]}child(e,t,n){let{buffer:i}=this.context,r=i.findChild(this.index+4,i.buffer[this.index+3],e,t-this.context.start,n);return r<0?null:new Vo(this.context,this,r)}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,n=0){if(n&Ze.ExcludeBuffers)return null;let{buffer:i}=this.context,r=i.findChild(this.index+4,i.buffer[this.index+3],t>0?1:-1,e-this.context.start,t);return r<0?null:new Vo(this.context,this,r)}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];if(t<(this._parent?e.buffer[this._parent.index+3]:e.buffer.length))return new Vo(this.context,this._parent,t);return this.externalSibling(1)}get prevSibling(){let{buffer:e}=this.context,t=this._parent?this._parent.index+4:0;if(this.index==t)return this.externalSibling(-1);return new Vo(this.context,this._parent,e.findChild(t,this.index,-1,0,4))}get tree(){return null}toTree(){let e=[],t=[],{buffer:n}=this.context,i=this.index+4,r=n.buffer[this.index+3];if(r>i){let o=n.buffer[this.index+1];e.push(n.slice(i,r,o)),t.push(0)}return new St(this.type,e,t,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function AN(e){if(!e.length)return null;let t=0,n=e[0];for(let o=1;o<e.length;o++){let s=e[o];if(s.from>n.from||s.to<n.to)n=s,t=o}let i=n instanceof Yn&&n.index<0?null:n.parent,r=e.slice();if(i)r[t]=i;else r.splice(t,1);return new TN(r,n)}class TN{constructor(e,t){this.heads=e,this.node=t}get next(){return AN(this.heads)}}function IH(e,t,n){let i=e.resolveInner(t,n),r=null;for(let o=i instanceof Yn?i:i.context.parent;o;o=o.parent)if(o.index<0){let s=o.parent;(r||(r=[i])).push(s.resolve(t,n)),o=s}else{let s=ja.get(o.tree);if(s&&s.overlay&&s.overlay[0].from<=t&&s.overlay[s.overlay.length-1].to>=t){let l=new Yn(s.tree,s.overlay[0].from+o.from,-1,o);(r||(r=[i])).push(af(l,t,n,!1))}}return r?AN(r):i}class Jp{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&~Ze.EnterBracketed,e instanceof Yn)this.yieldNode(e);else{this._tree=e.context.parent,this.buffer=e.context;for(let n=e._parent;n;n=n._parent)this.stack.unshift(n.index);this.bufferNode=e,this.yieldBuf(e.index)}}yieldNode(e){if(!e)return!1;return this._tree=e,this.type=e.type,this.from=e.from,this.to=e.to,!0}yieldBuf(e,t){this.index=e;let{start:n,buffer:i}=this.buffer;return this.type=t||i.set.types[i.buffer[e]],this.from=n+i.buffer[e+1],this.to=n+i.buffer[e+2],!0}yield(e){if(!e)return!1;if(e instanceof Yn)return this.buffer=null,this.yieldNode(e);return this.buffer=e.context,this.yieldBuf(e.index,e.type)}toString(){return this.buffer?this.buffer.buffer.childString(this.index):this._tree.toString()}enterChild(e,t,n){if(!this.buffer)return this.yield(this._tree.nextChild(e<0?this._tree._tree.children.length-1:0,e,t,n,this.mode));let{buffer:i}=this.buffer,r=i.findChild(this.index+4,i.buffer[this.index+3],e,t-this.buffer.start,n);if(r<0)return!1;return this.stack.push(this.index),this.yieldBuf(r)}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,n=this.mode){if(!this.buffer)return this.yield(this._tree.enter(e,t,n));return n&Ze.ExcludeBuffers?!1:this.enterChild(1,e,t)}parent(){if(!this.buffer)return this.yieldNode(this.mode&Ze.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let e=this.mode&Ze.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent();return this.buffer=null,this.yieldNode(e)}sibling(e){if(!this.buffer)return!this._tree._parent?!1:this.yield(this._tree.index<0?null:this._tree._parent.nextChild(this._tree.index+e,e,0,4,this.mode));let{buffer:t}=this.buffer,n=this.stack.length-1;if(e<0){let i=n<0?0:this.stack[n]+4;if(this.index!=i)return this.yieldBuf(t.findChild(i,this.index,-1,0,4))}else{let i=t.buffer[this.index+3];if(i<(n<0?t.buffer.length:t.buffer[this.stack[n]+3]))return this.yieldBuf(i)}return n<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,n,{buffer:i}=this;if(i){if(e>0){if(this.index<i.buffer.buffer.length)return!1}else for(let r=0;r<this.index;r++)if(i.buffer.buffer[r+3]<this.index)return!1;({index:t,parent:n}=i)}else({index:t,_parent:n}=this._tree);for(;n;{index:t,_parent:n}=n)if(t>-1)for(let r=t+e,o=e<0?-1:n._tree.children.length;r!=o;r+=e){let s=n._tree.children[r];if(this.mode&Ze.IncludeAnonymous||s instanceof Uo||!s.type.isAnonymous||Cx(s))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){while(this.from==this.to||(t<1?this.from>=e:this.from>e)||(t>-1?this.to<=e:this.to<e))if(!this.parent())break;while(this.enterChild(1,e,t));return this}get node(){if(!this.buffer)return this._tree;let e=this.bufferNode,t=null,n=0;if(e&&e.context==this.buffer)e:for(let i=this.index,r=this.stack.length;r>=0;){for(let o=e;o;o=o._parent)if(o.index==i){if(i==this.index)return o;t=o,n=r+1;break e}i=this.stack[--r]}for(let i=n;i<this.stack.length;i++)t=new Vo(this.buffer,t,this.stack[i]);return this.bufferNode=new Vo(this.buffer,t,this.index)}get tree(){return this.buffer?null:this._tree._tree}iterate(e,t){for(let n=0;;){let i=!1;if(this.type.isAnonymous||e(this)!==!1){if(this.firstChild()){n++;continue}if(!this.type.isAnonymous)i=!0}for(;;){if(i&&t)t(this);if(i=this.type.isAnonymous,!n)return;if(this.nextSibling())break;this.parent(),n--,i=!0}}}matchContext(e){if(!this.buffer)return Sx(this.node.parent,e);let{buffer:t}=this.buffer,{types:n}=t.set;for(let i=e.length-1,r=this.stack.length-1;i>=0;r--){if(r<0)return Sx(this._tree,e,i);let o=n[t.buffer[this.stack[r]]];if(!o.isAnonymous){if(e[i]&&e[i]!=o.name)return!1;i--}}return!0}}function Cx(e){return e.children.some((t)=>t instanceof Uo||!t.type.isAnonymous||Cx(t))}function HH(e){var t;let{buffer:n,nodeSet:i,maxBufferLength:r=1024,reused:o=[],minRepeatType:s=i.types.length}=e,l=Array.isArray(n)?new kx(n,n.length):n,a=i.types,u=0,c=0;function f(k,E,_,O,B,M){let{id:I,start:H,end:Y,size:D}=l,L=c,V=u;if(D<0)if(l.next(),D==-1){let De=o[I];_.push(De),O.push(H-k);return}else if(D==-3){u=I;return}else if(D==-4){c=I;return}else throw RangeError(`Unrecognized record size: ${D}`);let G=a[I],P,ee,fe=H-k;if(Y-H<=r&&(ee=x(l.pos-E,B))){let De=new Uint16Array(ee.size-ee.skip),qe=l.pos-ee.size,ht=De.length;while(l.pos>qe)ht=g(ee.start,De,ht);P=new Uo(De,Y-ee.start,i),fe=ee.start-k}else{let De=l.pos-D;l.next();let qe=[],ht=[],et=I>=s?I:-1,Se=0,ct=Y;while(l.pos>De)if(et>=0&&l.id==et&&l.size>=0){if(l.end<=ct-r)m(qe,ht,H,Se,l.end,ct,et,L,V),Se=qe.length,ct=l.end;l.next()}else if(M>2500)d(H,De,qe,ht);else f(H,De,qe,ht,et,M+1);if(et>=0&&Se>0&&Se<qe.length)m(qe,ht,H,Se,H,ct,et,L,V);if(qe.reverse(),ht.reverse(),et>-1&&Se>0){let _t=h(G,V);P=Ex(G,qe,ht,0,qe.length,0,Y-H,_t,_t)}else P=b(G,qe,ht,Y-H,L-Y,V)}_.push(P),O.push(fe)}function d(k,E,_,O){let B=[],M=0,I=-1;while(l.pos>E){let{id:H,start:Y,end:D,size:L}=l;if(L>4)l.next();else if(I>-1&&Y<I)break;else{if(I<0)I=D-r;B.push(H,Y,D),M++,l.next()}}if(M){let H=new Uint16Array(M*4),Y=B[B.length-2];for(let D=B.length-3,L=0;D>=0;D-=3)H[L++]=B[D],H[L++]=B[D+1]-Y,H[L++]=B[D+2]-Y,H[L++]=L;_.push(new Uo(H,B[2]-Y,i)),O.push(Y-k)}}function h(k,E){return(_,O,B)=>{let M=0,I=_.length-1,H,Y;if(I>=0&&(H=_[I])instanceof St){if(!I&&H.type==k&&H.length==B)return H;if(Y=H.prop(ce.lookAhead))M=O[I]+H.length+Y}return b(k,_,O,B,M,E)}}function m(k,E,_,O,B,M,I,H,Y){let D=[],L=[];while(k.length>O)D.push(k.pop()),L.push(E.pop()+_-B);k.push(b(i.types[I],D,L,M-B,H-M,Y)),E.push(B-_)}function b(k,E,_,O,B,M,I){if(M){let H=[ce.contextHash,M];I=I?[H].concat(I):[H]}if(B>25){let H=[ce.lookAhead,B];I=I?[H].concat(I):[H]}return new St(k,E,_,O,I)}function x(k,E){let _=l.fork(),O=0,B=0,M=0,I=_.end-r,H={size:0,start:0,skip:0};e:for(let Y=_.pos-k;_.pos>Y;){let D=_.size;if(_.id==E&&D>=0){H.size=O,H.start=B,H.skip=M,M+=4,O+=4,_.next();continue}let L=_.pos-D;if(D<0||L<Y||_.start<I)break;let V=_.id>=s?4:0,G=_.start;_.next();while(_.pos>L){if(_.size<0)if(_.size==-3||_.size==-4)V+=4;else break e;else if(_.id>=s)V+=4;_.next()}B=G,O+=D,M+=V}if(E<0||O==k)H.size=O,H.start=B,H.skip=M;return H.size>4?H:void 0}function g(k,E,_){let{id:O,start:B,end:M,size:I}=l;if(l.next(),I>=0&&O<s){let H=_;if(I>4){let Y=l.pos-(I-4);while(l.pos>Y)_=g(k,E,_)}E[--_]=H,E[--_]=M-k,E[--_]=B-k,E[--_]=O}else if(I==-3)u=O;else if(I==-4)c=O;return _}let v=[],w=[];while(l.pos>0)f(e.start||0,e.bufferStart||0,v,w,-1,0);let S=(t=e.length)!==null&&t!==void 0?t:v.length?w[0]+v[0].length:0;return new St(a[e.topID],v.reverse(),w.reverse(),S)}var EN=new WeakMap;function Qp(e,t){if(!e.isAnonymous||t instanceof Uo||t.type!=e)return 1;let n=EN.get(t);if(n==null){n=1;for(let i of t.children){if(i.type!=e||!(i instanceof St)){n=1;break}n+=Qp(e,i)}EN.set(t,n)}return n}function Ex(e,t,n,i,r,o,s,l,a){let u=0;for(let m=i;m<r;m++)u+=Qp(e,t[m]);let c=Math.ceil(u*1.5/8),f=[],d=[];function h(m,b,x,g,v){for(let w=x;w<g;){let S=w,k=b[w],E=Qp(e,m[w]);w++;for(;w<g;w++){let _=Qp(e,m[w]);if(E+_>=c)break;E+=_}if(w==S+1){if(E>c){let _=m[S];h(_.children,_.positions,0,_.children.length,b[S]+v);continue}f.push(m[S])}else{let _=b[w-1]+m[w-1].length-k;f.push(Ex(e,m,b,S,w,k,_,null,a))}d.push(k+v-o)}}return h(t,n,i,r,0),(l||a)(f,d,s)}class Ko{constructor(e,t,n,i,r=!1,o=!1){this.from=e,this.to=t,this.tree=n,this.offset=i,this.open=(r?1:0)|(o?2:0)}get openStart(){return(this.open&1)>0}get openEnd(){return(this.open&2)>0}static addTree(e,t=[],n=!1){let i=[new Ko(0,e.length,e,0,!1,n)];for(let r of t)if(r.to>e.length)i.push(r);return i}static applyChanges(e,t,n=128){if(!t.length)return e;let i=[],r=1,o=e.length?e[0]:null;for(let s=0,l=0,a=0;;s++){let u=s<t.length?t[s]:null,c=u?u.fromA:1e9;if(c-l>=n)while(o&&o.from<c){let f=o;if(l>=f.from||c<=f.to||a){let d=Math.max(f.from,l)-a,h=Math.min(f.to,c)-a;f=d>=h?null:new Ko(d,h,f.tree,f.offset+a,s>0,!!u)}if(f)i.push(f);if(o.to>c)break;o=r<e.length?e[r++]:null}if(!u)break;l=u.toA,a=u.toA-u.toB}return i}}class Ox{startParse(e,t,n){if(typeof e=="string")e=new MN(e);return n=!n?[new Wp(0,e.length)]:n.length?n.map((i)=>new Wp(i.from,i.to)):[new Wp(0,0)],this.createParse(e,t||[],n)}parse(e,t,n){let i=this.startParse(e,t,n);for(;;){let r=i.advance();if(r)return r}}}class MN{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)}}var yq=new ce({perNode:!0});var VH=0;class Wn{constructor(e,t,n,i){this.name=e,this.set=t,this.base=n,this.modified=i,this.id=VH++}toString(){let{name:e}=this;for(let t of this.modified)if(t.name)e=`${t.name}(${e})`;return e}static define(e,t){let n=typeof e=="string"?e:"?";if(e instanceof Wn)t=e;if(t===null||t===void 0?void 0:t.base)throw Error("Can not derive from a modified tag");let i=new Wn(n,[],null,[]);if(i.set.push(i),t)for(let r of t.set)i.set.push(r);return i}static defineModifier(e){let t=new nm(e);return(n)=>{if(n.modified.indexOf(t)>-1)return n;return nm.get(n.base||n,n.modified.concat(t).sort((i,r)=>i.id-r.id))}}}var UH=0;class nm{constructor(e){this.name=e,this.instances=[],this.id=UH++}static get(e,t){if(!t.length)return e;let n=t[0].instances.find((s)=>s.base==e&&KH(t,s.modified));if(n)return n;let i=[],r=new Wn(e.name,i,e,t);for(let s of t)s.instances.push(r);let o=jH(t);for(let s of e.set)if(!s.modified.length)for(let l of o)i.push(nm.get(s,l));return r}}function KH(e,t){return e.length==t.length&&e.every((n,i)=>n==t[i])}function jH(e){let t=[[]];for(let n=0;n<e.length;n++)for(let i=0,r=t.length;i<r;i++)t.push(t[i].concat(e[n]));return t.sort((n,i)=>i.length-n.length)}function LN(e){let t=Object.create(null);for(let n in e){let i=e[n];if(!Array.isArray(i))i=[i];for(let r of n.split(" "))if(r){let o=[],s=2,l=r;for(let f=0;;){if(l=="..."&&f>0&&f+3==r.length){s=1;break}let d=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(l);if(!d)throw RangeError("Invalid path: "+r);if(o.push(d[0]=="*"?"":d[0][0]=='"'?JSON.parse(d[0]):d[0]),f+=d[0].length,f==r.length)break;let h=r[f++];if(f==r.length&&h=="!"){s=0;break}if(h!="/")throw RangeError("Invalid path: "+r);l=r.slice(f)}let a=o.length-1,u=o[a];if(!u)throw RangeError("Invalid path: "+r);let c=new cf(i,s,a>0?o.slice(0,a):null);t[u]=c.sort(t[u])}}return FH.add(t)}var FH=new ce({combine(e,t){let n,i,r;while(e||t){if(!e||t&&e.depth<t.depth)r=t,t=t.next;else r=e,e=e.next;if(n&&n.mode==r.mode&&!r.context&&!n.context)continue;let o=new cf(r.tags,r.mode,r.context);if(n)n.next=o;else i=o;n=o}return i}});class cf{constructor(e,t,n,i){this.tags=e,this.mode=t,this.context=n,this.next=i}get opaque(){return this.mode==0}get inherit(){return this.mode==1}sort(e){if(!e||e.depth<this.depth)return this.next=e,this;return e.next=this.sort(e.next),e}get depth(){return this.context?this.context.length:0}}cf.empty=new cf([],2,null);function Tx(e,t){let n=Object.create(null);for(let o of e)if(!Array.isArray(o.tag))n[o.tag.id]=o.class;else for(let s of o.tag)n[s.id]=o.class;let{scope:i,all:r=null}=t||{};return{style:(o)=>{let s=r;for(let l of o)for(let a of l.set){let u=n[a.id];if(u){s=s?s+" "+u:u;break}}return s},scope:i}}var U=Wn.define,Zp=U(),jo=U(),NN=U(jo),DN=U(jo),Fo=U(),em=U(Fo),Rx=U(Fo),sr=U(),Gs=U(sr),rr=U(),or=U(),Ax=U(),uf=U(Ax),tm=U(),K={comment:Zp,lineComment:U(Zp),blockComment:U(Zp),docComment:U(Zp),name:jo,variableName:U(jo),typeName:NN,tagName:U(NN),propertyName:DN,attributeName:U(DN),className:U(jo),labelName:U(jo),namespace:U(jo),macroName:U(jo),literal:Fo,string:em,docString:U(em),character:U(em),attributeValue:U(em),number:Rx,integer:U(Rx),float:U(Rx),bool:U(Fo),regexp:U(Fo),escape:U(Fo),color:U(Fo),url:U(Fo),keyword:rr,self:U(rr),null:U(rr),atom:U(rr),unit:U(rr),modifier:U(rr),operatorKeyword:U(rr),controlKeyword:U(rr),definitionKeyword:U(rr),moduleKeyword:U(rr),operator:or,derefOperator:U(or),arithmeticOperator:U(or),logicOperator:U(or),bitwiseOperator:U(or),compareOperator:U(or),updateOperator:U(or),definitionOperator:U(or),typeOperator:U(or),controlOperator:U(or),punctuation:Ax,separator:U(Ax),bracket:uf,angleBracket:U(uf),squareBracket:U(uf),paren:U(uf),brace:U(uf),content:sr,heading:Gs,heading1:U(Gs),heading2:U(Gs),heading3:U(Gs),heading4:U(Gs),heading5:U(Gs),heading6:U(Gs),contentSeparator:U(sr),list:U(sr),quote:U(sr),emphasis:U(sr),strong:U(sr),link:U(sr),monospace:U(sr),strikethrough:U(sr),inserted:U(),deleted:U(),changed:U(),invalid:U(),meta:tm,documentMeta:U(tm),annotation:U(tm),processingInstruction:U(tm),definition:Wn.defineModifier("definition"),constant:Wn.defineModifier("constant"),function:Wn.defineModifier("function"),standard:Wn.defineModifier("standard"),local:Wn.defineModifier("local"),special:Wn.defineModifier("special")};for(let e in K){let t=K[e];if(t instanceof Wn)t.name=e}var Sq=Tx([{tag:K.link,class:"tok-link"},{tag:K.heading,class:"tok-heading"},{tag:K.emphasis,class:"tok-emphasis"},{tag:K.strong,class:"tok-strong"},{tag:K.keyword,class:"tok-keyword"},{tag:K.atom,class:"tok-atom"},{tag:K.bool,class:"tok-bool"},{tag:K.url,class:"tok-url"},{tag:K.labelName,class:"tok-labelName"},{tag:K.inserted,class:"tok-inserted"},{tag:K.deleted,class:"tok-deleted"},{tag:K.literal,class:"tok-literal"},{tag:K.string,class:"tok-string"},{tag:K.number,class:"tok-number"},{tag:[K.regexp,K.escape,K.special(K.string)],class:"tok-string2"},{tag:K.variableName,class:"tok-variableName"},{tag:K.local(K.variableName),class:"tok-variableName tok-local"},{tag:K.definition(K.variableName),class:"tok-variableName tok-definition"},{tag:K.special(K.variableName),class:"tok-variableName2"},{tag:K.definition(K.propertyName),class:"tok-propertyName tok-definition"},{tag:K.typeName,class:"tok-typeName"},{tag:K.namespace,class:"tok-namespace"},{tag:K.className,class:"tok-className"},{tag:K.macroName,class:"tok-macroName"},{tag:K.propertyName,class:"tok-propertyName"},{tag:K.operator,class:"tok-operator"},{tag:K.comment,class:"tok-comment"},{tag:K.meta,class:"tok-meta"},{tag:K.invalid,class:"tok-invalid"},{tag:K.punctuation,class:"tok-punctuation"}]);var Mx,df=new ce;var qH=new ce;class ki{constructor(e,t,n=[],i=""){if(this.data=e,this.name=i,!pe.prototype.hasOwnProperty("tree"))Object.defineProperty(pe.prototype,"tree",{get(){return _i(this)}});this.parser=t,this.extension=[qa.of(this),pe.languageData.of((r,o,s)=>{let l=zN(r,o,s),a=l.type.prop(df);if(!a)return[];let u=r.facet(a),c=l.type.prop(qH);if(c){let f=l.resolve(o-l.from,s);for(let d of c)if(d.test(f,r)){let h=r.facet(d.facet);return d.type=="replace"?h:h.concat(u)}}return u})].concat(n)}isActiveAt(e,t,n=-1){return zN(e,t,n).type.prop(df)==this.data}findRegions(e){let t=e.facet(qa);if((t===null||t===void 0?void 0:t.data)==this.data)return[{from:0,to:e.doc.length}];if(!t||!t.allowsNesting)return[];let n=[],i=(r,o)=>{if(r.prop(df)==this.data){n.push({from:o,to:o+r.length});return}let s=r.prop(ce.mounted);if(s){if(s.tree.prop(df)==this.data){if(s.overlay)for(let l of s.overlay)n.push({from:l.from+o,to:l.to+o});else n.push({from:o,to:o+r.length});return}else if(s.overlay){let l=n.length;if(i(s.tree,s.overlay[0].from+o),n.length>l)return}}for(let l=0;l<r.children.length;l++){let a=r.children[l];if(a instanceof St)i(a,r.positions[l]+o)}};return i(_i(e),0),n}get allowsNesting(){return!0}}ki.setState=ye.define();function zN(e,t,n){let i=e.facet(qa),r=_i(e).topNode;if(!i||i.allowsNesting){for(let o=r;o;o=o.enter(t,n,Ze.ExcludeBuffers|Ze.EnterBracketed))if(o.type.isTop)r=o}return r}function _i(e){let t=e.field(ki.state,!1);return t?t.tree:St.empty}class VN{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 n=this.cursorPos-this.string.length;if(e<n||t>=this.cursorPos)return this.doc.sliceString(e,t);else return this.string.slice(e-n,t-n)}}var ff=null;class im{constructor(e,t,n=[],i,r,o,s,l){this.parser=e,this.state=t,this.fragments=n,this.tree=i,this.treeLen=r,this.viewport=o,this.skipped=s,this.scheduleOn=l,this.parse=null,this.tempSkipped=[]}static create(e,t,n){return new im(e,t,[],St.empty,0,n,[],null)}startParse(){return this.parser.startParse(new VN(this.state.doc),this.fragments)}work(e,t){if(t!=null&&t>=this.state.doc.length)t=void 0;if(this.tree!=St.empty&&this.isDone(t!==null&&t!==void 0?t:this.state.doc.length))return this.takeTree(),!0;return this.withContext(()=>{var n;if(typeof e=="number"){let i=Date.now()+e;e=()=>Date.now()>i}if(!this.parse)this.parse=this.startParse();if(t!=null&&(this.parse.stoppedAt==null||this.parse.stoppedAt>t)&&t<this.state.doc.length)this.parse.stopAt(t);for(;;){let i=this.parse.advance();if(i)if(this.fragments=this.withoutTempSkipped(Ko.addTree(i,this.fragments,this.parse.stoppedAt!=null)),this.treeLen=(n=this.parse.stoppedAt)!==null&&n!==void 0?n:this.state.doc.length,this.tree=i,this.parse=null,this.treeLen<(t!==null&&t!==void 0?t:this.state.doc.length))this.parse=this.startParse();else return!0;if(e())return!1}})}takeTree(){let e,t;if(this.parse&&(e=this.parse.parsedPos)>=this.treeLen){if(this.parse.stoppedAt==null||this.parse.stoppedAt>e)this.parse.stopAt(e);this.withContext(()=>{while(!(t=this.parse.advance()));}),this.treeLen=e,this.tree=t,this.fragments=this.withoutTempSkipped(Ko.addTree(this.tree,this.fragments,!0)),this.parse=null}}withContext(e){let t=ff;ff=this;try{return e()}finally{ff=t}}withoutTempSkipped(e){for(let t;t=this.tempSkipped.pop();)e=BN(e,t.from,t.to);return e}changes(e,t){let{fragments:n,tree:i,treeLen:r,viewport:o,skipped:s}=this;if(this.takeTree(),!e.empty){let l=[];if(e.iterChangedRanges((a,u,c,f)=>l.push({fromA:a,toA:u,fromB:c,toB:f})),n=Ko.applyChanges(n,l),i=St.empty,r=0,o={from:e.mapPos(o.from,-1),to:e.mapPos(o.to,1)},this.skipped.length){s=[];for(let a of this.skipped){let u=e.mapPos(a.from,1),c=e.mapPos(a.to,-1);if(u<c)s.push({from:u,to:c})}}}return new im(this.parser,t,n,i,r,o,s,this.scheduleOn)}updateViewport(e){if(this.viewport.from==e.from&&this.viewport.to==e.to)return!1;this.viewport=e;let t=this.skipped.length;for(let n=0;n<this.skipped.length;n++){let{from:i,to:r}=this.skipped[n];if(i<e.to&&r>e.from)this.fragments=BN(this.fragments,i,r),this.skipped.splice(n--,1)}if(this.skipped.length>=t)return!1;return this.reset(),!0}reset(){if(this.parse)this.takeTree(),this.parse=null}skipUntilInView(e,t){this.skipped.push({from:e,to:t})}static getSkippingParser(e){return new class extends Ox{createParse(t,n,i){let r=i[0].from,o=i[i.length-1].to;return{parsedPos:r,advance(){let l=ff;if(l){for(let a of i)l.tempSkipped.push(a);if(e)l.scheduleOn=l.scheduleOn?Promise.all([l.scheduleOn,e]):e}return this.parsedPos=o,new St(On.none,[],[],o-r)},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 ff}}function BN(e,t,n){return Ko.applyChanges(e,[{fromA:t,toA:n,fromB:t,toB:n}])}class Fa{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),n=this.context.treeLen==e.startState.doc.length?void 0:Math.max(e.changes.mapPos(this.context.treeLen),t.viewport.to);if(!t.work(20,n))t.takeTree();return new Fa(t)}static init(e){let t=Math.min(3000,e.doc.length),n=im.create(e.facet(qa).parser,e,{from:0,to:t});if(!n.work(20,t))n.takeTree();return new Fa(n)}}ki.state=kn.define({create:Fa.init,update(e,t){for(let n of t.effects)if(n.is(ki.setState))return n.value;if(t.startState.facet(qa)!=t.state.facet(qa))return Fa.init(t.state);return e.apply(t)}});var UN=(e)=>{let t=setTimeout(()=>e(),500);return()=>clearTimeout(t)};if(typeof requestIdleCallback<"u")UN=(e)=>{let t=-1,n=setTimeout(()=>{t=requestIdleCallback(e,{timeout:400})},100);return()=>t<0?clearTimeout(n):cancelIdleCallback(t)};var Nx=typeof navigator<"u"&&((Mx=navigator.scheduling)===null||Mx===void 0?void 0:Mx.isInputPending)?()=>navigator.scheduling.isInputPending():null,$H=En.fromClass(class{constructor(t){this.view=t,this.working=null,this.workScheduled=0,this.chunkEnd=-1,this.chunkBudget=-1,this.work=this.work.bind(this),this.scheduleWork()}update(t){let n=this.view.state.field(ki.state).context;if(n.updateViewport(t.view.viewport)||this.view.viewport.to>n.treeLen)this.scheduleWork();if(t.docChanged||t.selectionSet){if(this.view.hasFocus)this.chunkBudget+=50;this.scheduleWork()}this.checkAsyncSchedule(n)}scheduleWork(){if(this.working)return;let{state:t}=this.view,n=t.field(ki.state);if(n.tree!=n.context.tree||!n.context.isDone(t.doc.length))this.working=UN(this.work)}work(t){this.working=null;let n=Date.now();if(this.chunkEnd<n&&(this.chunkEnd<0||this.view.hasFocus))this.chunkEnd=n+30000,this.chunkBudget=3000;if(this.chunkBudget<=0)return;let{state:i,viewport:{to:r}}=this.view,o=i.field(ki.state);if(o.tree==o.context.tree&&o.context.isDone(r+1e5))return;let s=Date.now()+Math.min(this.chunkBudget,100,t&&!Nx?Math.max(25,t.timeRemaining()-5):1e9),l=o.context.treeLen<r&&i.doc.length>r+1000,a=o.context.work(()=>Nx&&Nx()||Date.now()>s,r+(l?0:1e5));if(this.chunkBudget-=Date.now()-n,a||this.chunkBudget<=0)o.context.takeTree(),this.view.dispatch({effects:ki.setState.of(new Fa(o.context))});if(this.chunkBudget>0&&!(a&&!l))this.scheduleWork();this.checkAsyncSchedule(o.context)}checkAsyncSchedule(t){if(t.scheduleOn)this.workScheduled++,t.scheduleOn.then(()=>this.scheduleWork()).catch((n)=>Xt(this.view.state,n)).then(()=>this.workScheduled--),t.scheduleOn=null}destroy(){if(this.working)this.working()}isWorking(){return!!(this.working||this.workScheduled>0)}},{eventHandlers:{focus(){this.scheduleWork()}}}),qa=Z.define({combine(e){return e.length?e[0]:null},enables:(e)=>[ki.state,$H,Q.contentAttributes.compute([e],(t)=>{let n=t.facet(e);return n&&n.name?{"data-language":n.name}:{}})]});var XH=Z.define(),hf=Z.define({combine:(e)=>{if(!e.length)return" ";let t=e[0];if(!t||/\S/.test(t)||Array.from(t).some((n)=>n!=t[0]))throw Error("Invalid indent unit: "+JSON.stringify(e[0]));return t}});function pf(e){let t=e.facet(hf);return t.charCodeAt(0)==9?e.tabSize*t.length:t.length}function mf(e,t){let n="",i=e.tabSize,r=e.facet(hf)[0];if(r=="\t"){while(t>=i)n+="\t",t-=i;r=" "}for(let o=0;o<t;o++)n+=r;return n}function Bx(e,t){if(e instanceof pe)e=new $a(e);for(let i of e.state.facet(XH)){let r=i(e,t);if(r!==void 0)return r}let n=_i(e.state);return n.length>=t?YH(e,n,t):null}class $a{constructor(e,t={}){this.state=e,this.options=t,this.unit=pf(e)}lineAt(e,t=1){let n=this.state.doc.lineAt(e),{simulateBreak:i,simulateDoubleBreak:r}=this.options;if(i!=null&&i>=n.from&&i<=n.to)if(r&&i==e)return{text:"",from:e};else if(t<0?i<e:i<=e)return{text:n.text.slice(i-n.from),from:i};else return{text:n.text.slice(0,i-n.from),from:n.from};return n}textAfterPos(e,t=1){if(this.options.simulateDoubleBreak&&e==this.options.simulateBreak)return"";let{text:n,from:i}=this.lineAt(e,t);return n.slice(e-i,Math.min(n.length,e+100-i))}column(e,t=1){let{text:n,from:i}=this.lineAt(e,t),r=this.countColumn(n,e-i),o=this.options.overrideIndentation?this.options.overrideIndentation(i):-1;if(o>-1)r+=o-this.countColumn(n,n.search(/\S|$/));return r}countColumn(e,t=e.length){return Us(e,this.state.tabSize,t)}lineIndent(e,t=1){let{text:n,from:i}=this.lineAt(e,t),r=this.options.overrideIndentation;if(r){let o=r(i);if(o>-1)return o}return this.countColumn(n,n.search(/\S|$/))}get simulatedBreak(){return this.options.simulateBreak||null}}var GH=new ce;function YH(e,t,n){let i=t.resolveStack(n),r=t.resolveInner(n,-1).resolve(n,0).enterUnfinishedNodesBefore(n);if(r!=i.node){let o=[];for(let s=r;s&&!(s.from<i.node.from||s.to>i.node.to||s.from==i.node.from&&s.type==i.node.type);s=s.parent)o.push(s);for(let s=o.length-1;s>=0;s--)i={node:o[s],next:i}}return KN(i,e,n)}function KN(e,t,n){for(let i=e;i;i=i.next){let r=QH(i.node);if(r)return r(Px.create(t,n,i))}return 0}function WH(e){return e.pos==e.options.simulateBreak&&e.options.simulateDoubleBreak}function QH(e){let t=e.type.prop(GH);if(t)return t;let n=e.firstChild,i;if(n&&(i=n.type.prop(ce.closedBy))){let r=e.lastChild,o=r&&i.indexOf(r.name)>-1;return(s)=>tV(s,!0,1,void 0,o&&!WH(s)?r.from:void 0)}return e.parent==null?JH:null}function JH(){return 0}class Px extends $a{constructor(e,t,n){super(e.state,e.options);this.base=e,this.pos=t,this.context=n}get node(){return this.context.node}static create(e,t,n){return new Px(e,t,n)}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 n=e.resolve(t.from);while(n.parent&&n.parent.from==n.from)n=n.parent;if(ZH(n,e))break;t=this.state.doc.lineAt(n.from)}return this.lineIndent(t.from)}continue(){return KN(this.context.next,this.base,this.pos)}}function ZH(e,t){for(let n=t;n;n=n.parent)if(e==n)return!0;return!1}function eV(e){let t=e.node,n=t.childAfter(t.from),i=t.lastChild;if(!n)return null;let r=e.options.simulateBreak,o=e.state.doc.lineAt(n.from),s=r==null||r<=o.from?o.to:Math.min(o.to,r);for(let l=n.to;;){let a=t.childAfter(l);if(!a||a==i)return null;if(!a.type.isSkipped){if(a.from>=s)return null;let u=/^ */.exec(o.text.slice(n.to-o.from))[0].length;return{from:n.from,to:n.to+u}}l=a.to}}function tV(e,t,n,i,r){let o=e.textAfter,s=o.match(/^\s*/)[0].length,l=i&&o.slice(s,s+i.length)==i||r==e.pos+s,a=t?eV(e):null;if(a)return l?e.column(a.from):e.column(a.to);return e.baseIndent+(l?0:e.unit*n)}class Ix{constructor(e,t){this.specs=e;let n;function i(s){let l=vi.newName();return(n||(n=Object.create(null)))["."+l]=s,l}let r=typeof t.all=="string"?t.all:t.all?i(t.all):void 0,o=t.scope;this.scope=o instanceof ki?(s)=>s.prop(df)==o.data:o?(s)=>s==o:void 0,this.style=Tx(e.map((s)=>({tag:s.tag,class:s.class||i(Object.assign({},s,{tag:null}))})),{all:r}).style,this.module=n?new vi(n):null,this.themeType=t.themeType}static define(e,t){return new Ix(e,t||{})}}var Nq=Ix.define([{tag:K.meta,color:"#404740"},{tag:K.link,textDecoration:"underline"},{tag:K.heading,textDecoration:"underline",fontWeight:"bold"},{tag:K.emphasis,fontStyle:"italic"},{tag:K.strong,fontWeight:"bold"},{tag:K.strikethrough,textDecoration:"line-through"},{tag:K.keyword,color:"#708"},{tag:[K.atom,K.bool,K.url,K.contentSeparator,K.labelName],color:"#219"},{tag:[K.literal,K.inserted],color:"#164"},{tag:[K.string,K.deleted],color:"#a11"},{tag:[K.regexp,K.escape,K.special(K.string)],color:"#e40"},{tag:K.definition(K.variableName),color:"#00f"},{tag:K.local(K.variableName),color:"#30a"},{tag:[K.typeName,K.namespace],color:"#085"},{tag:K.className,color:"#167"},{tag:[K.special(K.variableName),K.macroName],color:"#256"},{tag:K.definition(K.propertyName),color:"#00c"},{tag:K.comment,color:"#940"},{tag:K.invalid,color:"#f00"}]);var nV=1e4,iV="()[]{}";var rV=new ce;function Lx(e,t,n){let i=e.prop(t<0?ce.openedBy:ce.closedBy);if(i)return i;if(e.name.length==1){let r=n.indexOf(e.name);if(r>-1&&r%2==(t<0?1:0))return[n[r+t]]}return null}function zx(e){let t=e.type.prop(rV);return t?t(e.node):e}function Ys(e,t,n,i={}){let r=i.maxScanDistance||nV,o=i.brackets||iV,s=_i(e),l=s.resolveInner(t,n);for(let a=l;a;a=a.parent){let u=Lx(a.type,n,o);if(u&&a.from<a.to){let c=zx(a);if(c&&(n>0?t>=c.from&&t<c.to:t>c.from&&t<=c.to))return oV(e,t,n,a,c,u,o)}}return sV(e,t,n,s,l.type,r,o)}function oV(e,t,n,i,r,o,s){let l=i.parent,a={from:r.from,to:r.to},u=0,c=l===null||l===void 0?void 0:l.cursor();if(c&&(n<0?c.childBefore(i.from):c.childAfter(i.to)))do if(n<0?c.to<=i.from:c.from>=i.to){if(u==0&&o.indexOf(c.type.name)>-1&&c.from<c.to){let f=zx(c);return{start:a,end:f?{from:f.from,to:f.to}:void 0,matched:!0}}else if(Lx(c.type,n,s))u++;else if(Lx(c.type,-n,s)){if(u==0){let f=zx(c);return{start:a,end:f&&f.from<f.to?{from:f.from,to:f.to}:void 0,matched:!1}}u--}}while(n<0?c.prevSibling():c.nextSibling());return{start:a,matched:!1}}function sV(e,t,n,i,r,o,s){if(n<0?!t:t==e.doc.length)return null;let l=n<0?e.sliceDoc(t-1,t):e.sliceDoc(t,t+1),a=s.indexOf(l);if(a<0||a%2==0!=n>0)return null;let u={from:n<0?t-1:t,to:n>0?t+1:t},c=e.doc.iterRange(t,n>0?e.doc.length:0),f=0;for(let d=0;!c.next().done&&d<=o;){let h=c.value;if(n<0)d+=h.length;let m=t+d*n;for(let b=n>0?0:h.length-1,x=n>0?h.length:-1;b!=x;b+=n){let g=s.indexOf(h[b]);if(g<0||i.resolveInner(m+b,1).type!=r)continue;if(g%2==0==n>0)f++;else if(f==1)return{start:u,end:{from:m+b,to:m+b+1},matched:g>>1==a>>1};else f--}if(n>0)d+=h.length}return c.done?{start:u,matched:!1}:null}var lV=Object.create(null),PN=[On.none];var IN=[],HN=Object.create(null),aV=Object.create(null);for(let[e,t]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"]])aV[e]=uV(lV,t);function Dx(e,t){if(IN.indexOf(e)>-1)return;IN.push(e),console.warn(t)}function uV(e,t){let n=[];for(let l of t.split(" ")){let a=[];for(let u of l.split(".")){let c=e[u]||K[u];if(!c)Dx(u,`Unknown highlighting tag ${u}`);else if(typeof c=="function")if(!a.length)Dx(u,`Modifier ${u} used at start of tag`);else a=a.map(c);else if(a.length)Dx(u,`Tag ${u} used as modifier`);else a=Array.isArray(c)?c:[c]}for(let u of a)n.push(u)}if(!n.length)return 0;let i=t.replace(/ /g,"_"),r=i+" "+n.map((l)=>l.id),o=HN[r];if(o)return o.id;let s=HN[r]=On.define({id:PN.length,name:i,props:[LN({[i]:n})]});return PN.push(s),s.id}var Dq={rtl:Ae.mark({class:"cm-iso",inclusive:!0,attributes:{dir:"rtl"},bidiIsolate:Ke.RTL}),ltr:Ae.mark({class:"cm-iso",inclusive:!0,attributes:{dir:"ltr"},bidiIsolate:Ke.LTR}),auto:Ae.mark({class:"cm-iso",inclusive:!0,attributes:{dir:"auto"},bidiIsolate:null})};class Kx{constructor(e,t,n,i){this.state=e,this.pos=t,this.explicit=n,this.view=i,this.abortListeners=[],this.abortOnDocChange=!1}tokenBefore(e){let t=_i(this.state).resolveInner(this.pos,-1);while(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),n=Math.max(t.from,this.pos-250),i=t.text.slice(n-t.from,this.pos-t.from),r=i.search(GN(e,!1));return r<0?null:{from:n+r,to:this.pos,text:i.slice(r)}}get aborted(){return this.abortListeners==null}addEventListener(e,t,n){if(e=="abort"&&this.abortListeners){if(this.abortListeners.push(t),n&&n.onDocChange)this.abortOnDocChange=!0}}}function jN(e){let t=Object.keys(e).join(""),n=/\w/.test(t);if(n)t=t.replace(/\w/g,"");return`[${n?"\\w":""}${t.replace(/[^\w\s]/g,"\\$&")}]`}function cV(e){let t=Object.create(null),n=Object.create(null);for(let{label:r}of e){t[r[0]]=!0;for(let o=1;o<r.length;o++)n[r[o]]=!0}let i=jN(t)+jN(n)+"*$";return[new RegExp("^"+i),new RegExp(i)]}function fV(e){let t=e.map((r)=>typeof r=="string"?{label:r}:r),[n,i]=t.every((r)=>/^\w+$/.test(r.label))?[/\w*$/,/\w+$/]:cV(t);return(r)=>{let o=r.matchBefore(i);return o||r.explicit?{from:o?o.from:r.pos,options:t,validFor:n}:null}}class Ux{constructor(e,t,n,i){this.completion=e,this.source=t,this.match=n,this.score=i}}function Ws(e){return e.selection.main.from}function GN(e,t){var n;let{source:i}=e,r=t&&i[0]!="^",o=i[i.length-1]!="$";if(!r&&!o)return e;return new RegExp(`${r?"^":""}(?:${i})${o?"$":""}`,(n=e.flags)!==null&&n!==void 0?n:e.ignoreCase?"i":"")}var YN=_n.define();function dV(e,t,n,i){let{main:r}=e.selection,o=n-r.from,s=i-r.from;return{...e.changeByRange((l)=>{if(l!=r&&n!=i&&e.sliceDoc(l.from+o,l.from+s)!=e.sliceDoc(n,i))return{range:l};let a=e.toText(t);return{changes:{from:l.from+o,to:i==r.from?l.to:l.from+s,insert:a},range:A.cursor(l.from+o+a.length)}}),scrollIntoView:!0,userEvent:"input.complete"}}var FN=new WeakMap;function hV(e){if(!Array.isArray(e))return e;let t=FN.get(e);if(!t)FN.set(e,t=fV(e));return t}var om=ye.define(),gf=ye.define();class WN{constructor(e){this.pattern=e,this.chars=[],this.folded=[],this.any=[],this.precise=[],this.byWord=[],this.score=0,this.matched=[];for(let t=0;t<e.length;){let n=Br(e,t),i=zo(n);this.chars.push(n);let r=e.slice(t,t+i),o=r.toUpperCase();this.folded.push(Br(o==r?r.toLowerCase():o,0)),t+=i}this.astral=e.length!=this.chars.length}ret(e,t){return this.score=e,this.matched=t,this}match(e){if(this.pattern.length==0)return this.ret(-100,[]);if(e.length<this.pattern.length)return null;let{chars:t,folded:n,any:i,precise:r,byWord:o}=this;if(t.length==1){let g=Br(e,0),v=zo(g),w=v==e.length?0:-100;if(g==t[0]);else if(g==n[0])w+=-200;else return null;return this.ret(w,[0,v])}let s=e.indexOf(this.pattern);if(s==0)return this.ret(e.length==this.pattern.length?0:-100,[0,this.pattern.length]);let l=t.length,a=0;if(s<0){for(let g=0,v=Math.min(e.length,200);g<v&&a<l;){let w=Br(e,g);if(w==t[a]||w==n[a])i[a++]=g;g+=zo(w)}if(a<l)return null}let u=0,c=0,f=!1,d=0,h=-1,m=-1,b=/[a-z]/.test(e),x=!0;for(let g=0,v=Math.min(e.length,200),w=0;g<v&&c<l;){let S=Br(e,g);if(s<0){if(u<l&&S==t[u])r[u++]=g;if(d<l)if(S==t[d]||S==n[d]){if(d==0)h=g;m=g+1,d++}else d=0}let k,E=S<255?S>=48&&S<=57||S>=97&&S<=122?2:S>=65&&S<=90?1:0:(k=mM(S))!=k.toLowerCase()?1:k!=k.toUpperCase()?2:0;if(!g||E==1&&b||w==0&&E!=0){if(t[c]==S||n[c]==S&&(f=!0))o[c++]=g;else if(o.length)x=!1}w=E,g+=zo(S)}if(c==l&&o[0]==0&&x)return this.result(-100+(f?-200:0),o,e);if(d==l&&h==0)return this.ret(-200-e.length+(m==e.length?0:-100),[0,m]);if(s>-1)return this.ret(-700-e.length,[s,s+this.pattern.length]);if(d==l)return this.ret(-900-e.length,[h,m]);if(c==l)return this.result(-100+(f?-200:0)+-700+(x?0:-1100),o,e);return t.length==2?null:this.result((i[0]?-700:0)+-200+-1100,i,e)}result(e,t,n){let i=[],r=0;for(let o of t){let s=o+(this.astral?zo(Br(n,o)):1);if(r&&i[r-1]==o)i[r-1]=s;else i[r++]=o,i[r++]=s}return this.ret(e-n.length,i)}}class QN{constructor(e){this.pattern=e,this.matched=[],this.score=0,this.folded=e.toLowerCase()}match(e){if(e.length<this.pattern.length)return null;let t=e.slice(0,this.pattern.length),n=t==this.pattern?0:t.toLowerCase()==this.folded?-200:null;if(n==null)return null;return this.matched=[0,t.length],this.score=n+(e.length==this.pattern.length?0:-100),this}}var kt=Z.define({combine(e){return Da(e,{activateOnTyping:!0,activateOnCompletion:()=>!1,activateOnTypingDelay:100,selectOnOpen:!0,override:null,closeOnBlur:!0,maxRenderedOptions:100,defaultKeymap:!0,tooltipClass:()=>"",optionClass:()=>"",aboveCursor:!1,icons:!0,addToOptions:[],positionInfo:pV,filterStrict:!1,compareCompletions:(t,n)=>(t.sortText||t.label).localeCompare(n.sortText||n.label),interactionDelay:75,updateSyncTime:100},{defaultKeymap:(t,n)=>t&&n,closeOnBlur:(t,n)=>t&&n,icons:(t,n)=>t&&n,tooltipClass:(t,n)=>(i)=>qN(t(i),n(i)),optionClass:(t,n)=>(i)=>qN(t(i),n(i)),addToOptions:(t,n)=>t.concat(n),filterStrict:(t,n)=>t||n})}});function qN(e,t){return e?t?e+" "+t:e:t}function pV(e,t,n,i,r,o){let s=e.textDirection==Ke.RTL,l=s,a=!1,u="top",c,f,d=t.left-r.left,h=r.right-t.right,m=i.right-i.left,b=i.bottom-i.top;if(l&&d<Math.min(m,h))l=!1;else if(!l&&h<Math.min(m,d))l=!0;if(m<=(l?d:h))c=Math.max(r.top,Math.min(n.top,r.bottom-b))-t.top,f=Math.min(400,l?d:h);else{a=!0,f=Math.min(400,(s?t.right:r.right-t.left)-30);let v=r.bottom-t.bottom;if(v>=b||v>t.top)c=n.bottom-t.top;else u="bottom",c=t.bottom-n.top}let x=(t.bottom-t.top)/o.offsetHeight,g=(t.right-t.left)/o.offsetWidth;return{style:`${u}: ${c/x}px; max-width: ${f/g}px`,class:"cm-completionInfo-"+(a?s?"left-narrow":"right-narrow":l?"left":"right")}}var jx=ye.define();function mV(e){let t=e.addToOptions.slice();if(e.icons)t.push({render(n){let i=document.createElement("div");if(i.classList.add("cm-completionIcon"),n.type)i.classList.add(...n.type.split(/\s+/g).map((r)=>"cm-completionIcon-"+r));return i.setAttribute("aria-hidden","true"),i},position:20});return t.push({render(n,i,r,o){let s=document.createElement("span");s.className="cm-completionLabel";let l=n.displayLabel||n.label,a=0;for(let u=0;u<o.length;){let c=o[u++],f=o[u++];if(c>a)s.appendChild(document.createTextNode(l.slice(a,c)));let d=s.appendChild(document.createElement("span"));d.appendChild(document.createTextNode(l.slice(c,f))),d.className="cm-completionMatchedText",a=f}if(a<l.length)s.appendChild(document.createTextNode(l.slice(a)));return s},position:50},{render(n){if(!n.detail)return null;let i=document.createElement("span");return i.className="cm-completionDetail",i.textContent=n.detail,i},position:80}),t.sort((n,i)=>n.position-i.position).map((n)=>n.render)}function Hx(e,t,n){if(e<=n)return{from:0,to:e};if(t<0)t=0;if(t<=e>>1){let r=Math.floor(t/n);return{from:r*n,to:(r+1)*n}}let i=Math.ceil((e-t)/n);return{from:e-i*n,to:e-(i-1)*n}}class JN{constructor(e,t,n){this.view=e,this.stateField=t,this.applyCompletion=n,this.info=null,this.infoDestroy=null,this.placeInfoReq={read:()=>this.measureInfo(),write:(l)=>this.placeInfo(l),key:this},this.space=null,this.currentClass="";let i=e.state.field(t),{options:r,selected:o}=i.open,s=e.state.facet(kt);this.optionContent=mV(s),this.optionClass=s.optionClass,this.tooltipClass=s.tooltipClass,this.range=Hx(r.length,o,s.maxRenderedOptions),this.dom=document.createElement("div"),this.dom.className="cm-tooltip-autocomplete",this.updateTooltipClass(e.state),this.dom.addEventListener("mousedown",(l)=>{let{options:a}=e.state.field(t).open;for(let u=l.target,c;u&&u!=this.dom;u=u.parentNode)if(u.nodeName=="LI"&&(c=/-(\d+)$/.exec(u.id))&&+c[1]<a.length){this.applyCompletion(e,a[+c[1]]),l.preventDefault();return}if(l.target==this.list){let u=this.list.classList.contains("cm-completionListIncompleteTop")&&l.clientY<this.list.firstChild.getBoundingClientRect().top?this.range.from-1:this.list.classList.contains("cm-completionListIncompleteBottom")&&l.clientY>this.list.lastChild.getBoundingClientRect().bottom?this.range.to:null;if(u!=null)e.dispatch({effects:jx.of(u)}),l.preventDefault()}}),this.dom.addEventListener("focusout",(l)=>{let a=e.state.field(this.stateField,!1);if(a&&a.tooltip&&e.state.facet(kt).closeOnBlur&&l.relatedTarget!=e.contentDOM)e.dispatch({effects:gf.of(null)})}),this.showOptions(r,i.id)}mount(){this.updateSel()}showOptions(e,t){if(this.list)this.list.remove();this.list=this.dom.appendChild(this.createListBox(e,t,this.range)),this.list.addEventListener("scroll",()=>{if(this.info)this.view.requestMeasure(this.placeInfoReq)})}update(e){var t;let n=e.state.field(this.stateField),i=e.startState.field(this.stateField);if(this.updateTooltipClass(e.state),n!=i){let{options:r,selected:o,disabled:s}=n.open;if(!i.open||i.open.options!=r)this.range=Hx(r.length,o,e.state.facet(kt).maxRenderedOptions),this.showOptions(r,n.id);if(this.updateSel(),s!=((t=i.open)===null||t===void 0?void 0:t.disabled))this.dom.classList.toggle("cm-tooltip-autocomplete-disabled",!!s)}}updateTooltipClass(e){let t=this.tooltipClass(e);if(t!=this.currentClass){for(let n of this.currentClass.split(" "))if(n)this.dom.classList.remove(n);for(let n of t.split(" "))if(n)this.dom.classList.add(n);this.currentClass=t}}positioned(e){if(this.space=e,this.info)this.view.requestMeasure(this.placeInfoReq)}updateSel(){let e=this.view.state.field(this.stateField),t=e.open;if(t.selected>-1&&t.selected<this.range.from||t.selected>=this.range.to)this.range=Hx(t.options.length,t.selected,this.view.state.facet(kt).maxRenderedOptions),this.showOptions(t.options,e.id);let n=this.updateSelectedOption(t.selected);if(n){this.destroyInfo();let{completion:i}=t.options[t.selected],{info:r}=i;if(!r)return;let o=typeof r==="string"?document.createTextNode(r):r(i);if(!o)return;if("then"in o)o.then((s)=>{if(s&&this.view.state.field(this.stateField,!1)==e)this.addInfoPane(s,i)}).catch((s)=>Xt(this.view.state,s,"completion info"));else this.addInfoPane(o,i),n.setAttribute("aria-describedby",this.info.id)}}addInfoPane(e,t){this.destroyInfo();let n=this.info=document.createElement("div");if(n.className="cm-tooltip cm-completionInfo",n.id="cm-completionInfo-"+Math.floor(Math.random()*65535).toString(16),e.nodeType!=null)n.appendChild(e),this.infoDestroy=null;else{let{dom:i,destroy:r}=e;n.appendChild(i),this.infoDestroy=r||null}this.dom.appendChild(n),this.view.requestMeasure(this.placeInfoReq)}updateSelectedOption(e){let t=null;for(let n=this.list.firstChild,i=this.range.from;n;n=n.nextSibling,i++)if(n.nodeName!="LI"||!n.id)i--;else if(i==e){if(!n.hasAttribute("aria-selected"))n.setAttribute("aria-selected","true"),t=n}else if(n.hasAttribute("aria-selected"))n.removeAttribute("aria-selected"),n.removeAttribute("aria-describedby");if(t)vV(this.list,t);return t}measureInfo(){let e=this.dom.querySelector("[aria-selected]");if(!e||!this.info)return null;let t=this.dom.getBoundingClientRect(),n=this.info.getBoundingClientRect(),i=e.getBoundingClientRect(),r=this.space;if(!r){let o=this.dom.ownerDocument.documentElement;r={left:0,top:0,right:o.clientWidth,bottom:o.clientHeight}}if(i.top>Math.min(r.bottom,t.bottom)-10||i.bottom<Math.max(r.top,t.top)+10)return null;return this.view.state.facet(kt).positionInfo(this.view,t,i,n,r,this.dom)}placeInfo(e){if(this.info)if(e){if(e.style)this.info.style.cssText=e.style;this.info.className="cm-tooltip cm-completionInfo "+(e.class||"")}else this.info.style.cssText="top: -1e6px"}createListBox(e,t,n){let i=document.createElement("ul");i.id=t,i.setAttribute("role","listbox"),i.setAttribute("aria-expanded","true"),i.setAttribute("aria-label",this.view.state.phrase("Completions")),i.addEventListener("mousedown",(o)=>{if(o.target==i)o.preventDefault()});let r=null;for(let o=n.from;o<n.to;o++){let{completion:s,match:l}=e[o],{section:a}=s;if(a){let f=typeof a=="string"?a:a.name;if(f!=r&&(o>n.from||n.from==0))if(r=f,typeof a!="string"&&a.header)i.appendChild(a.header(a));else{let d=i.appendChild(document.createElement("completion-section"));d.textContent=f}}let u=i.appendChild(document.createElement("li"));u.id=t+"-"+o,u.setAttribute("role","option");let c=this.optionClass(s);if(c)u.className=c;for(let f of this.optionContent){let d=f(s,this.view.state,this.view,l);if(d)u.appendChild(d)}}if(n.from)i.classList.add("cm-completionListIncompleteTop");if(n.to<e.length)i.classList.add("cm-completionListIncompleteBottom");return i}destroyInfo(){if(this.info){if(this.infoDestroy)this.infoDestroy();this.info.remove(),this.info=null}}destroy(){this.destroyInfo()}}function gV(e,t){return(n)=>new JN(n,e,t)}function vV(e,t){let n=e.getBoundingClientRect(),i=t.getBoundingClientRect(),r=n.height/e.offsetHeight;if(i.top<n.top)e.scrollTop-=(n.top-i.top)/r;else if(i.bottom>n.bottom)e.scrollTop+=(i.bottom-n.bottom)/r}function $N(e){return(e.boost||0)*100+(e.apply?10:0)+(e.info?5:0)+(e.type?1:0)}function bV(e,t){let n=[],i=null,r=null,o=(c)=>{n.push(c);let{section:f}=c.completion;if(f){if(!i)i=[];let d=typeof f=="string"?f:f.name;if(!i.some((h)=>h.name==d))i.push(typeof f=="string"?{name:d}:f)}},s=t.facet(kt);for(let c of e)if(c.hasResult()){let f=c.result.getMatch;if(c.result.filter===!1)for(let d of c.result.options)o(new Ux(d,c.source,f?f(d):[],1e9-n.length));else{let d=t.sliceDoc(c.from,c.to),h,m=s.filterStrict?new QN(d):new WN(d);for(let b of c.result.options)if(h=m.match(b.label)){let x=!b.displayLabel?h.matched:f?f(b,h.matched):[],g=h.score+(b.boost||0);if(o(new Ux(b,c.source,x,g)),typeof b.section=="object"&&b.section.rank==="dynamic"){let{name:v}=b.section;if(!r)r=Object.create(null);r[v]=Math.max(g,r[v]||-1e9)}}}}if(i){let c=Object.create(null),f=0,d=(h,m)=>(h.rank==="dynamic"&&m.rank==="dynamic"?r[m.name]-r[h.name]:0)||(typeof h.rank=="number"?h.rank:1e9)-(typeof m.rank=="number"?m.rank:1e9)||(h.name<m.name?-1:1);for(let h of i.sort(d))f-=1e5,c[h.name]=f;for(let h of n){let{section:m}=h.completion;if(m)h.score+=c[typeof m=="string"?m:m.name]}}let l=[],a=null,u=s.compareCompletions;for(let c of n.sort((f,d)=>d.score-f.score||u(f.completion,d.completion))){let f=c.completion;if(!a||a.label!=f.label||a.detail!=f.detail||a.type!=null&&f.type!=null&&a.type!=f.type||a.apply!=f.apply||a.boost!=f.boost)l.push(c);else if($N(c.completion)>$N(a))l[l.length-1]=c;a=c.completion}return l}class Xa{constructor(e,t,n,i,r,o){this.options=e,this.attrs=t,this.tooltip=n,this.timestamp=i,this.selected=r,this.disabled=o}setSelected(e,t){return e==this.selected||e>=this.options.length?this:new Xa(this.options,XN(t,e),this.tooltip,this.timestamp,e,this.disabled)}static build(e,t,n,i,r,o){if(i&&!o&&e.some((a)=>a.isPending))return i.setDisabled();let s=bV(e,t);if(!s.length)return i&&e.some((a)=>a.isPending)?i.setDisabled():null;let l=t.facet(kt).selectOnOpen?0:-1;if(i&&i.selected!=l&&i.selected!=-1){let a=i.options[i.selected].completion;for(let u=0;u<s.length;u++)if(s[u].completion==a){l=u;break}}return new Xa(s,XN(n,l),{pos:e.reduce((a,u)=>u.hasResult()?Math.min(a,u.from):a,1e8),create:_V,above:r.aboveCursor},i?i.timestamp:Date.now(),l,!1)}map(e){return new Xa(this.options,this.attrs,{...this.tooltip,pos:e.mapPos(this.tooltip.pos)},this.timestamp,this.selected,this.disabled)}setDisabled(){return new Xa(this.options,this.attrs,this.tooltip,this.timestamp,this.selected,!0)}}class sm{constructor(e,t,n){this.active=e,this.id=t,this.open=n}static start(){return new sm(SV,"cm-ac-"+Math.floor(Math.random()*2000000).toString(36),null)}update(e){let{state:t}=e,n=t.facet(kt),r=(n.override||t.languageDataAt("autocomplete",Ws(t)).map(hV)).map((l)=>(this.active.find((u)=>u.source==l)||new Qn(l,this.active.some((u)=>u.state!=0)?1:0)).update(e,n));if(r.length==this.active.length&&r.every((l,a)=>l==this.active[a]))r=this.active;let o=this.open,s=e.effects.some((l)=>l.is(Fx));if(o&&e.docChanged)o=o.map(e.changes);if(e.selection||r.some((l)=>l.hasResult()&&e.changes.touchesRange(l.from,l.to))||!yV(r,this.active)||s)o=Xa.build(r,t,this.id,o,n,s);else if(o&&o.disabled&&!r.some((l)=>l.isPending))o=null;if(!o&&r.every((l)=>!l.isPending)&&r.some((l)=>l.hasResult()))r=r.map((l)=>l.hasResult()?new Qn(l.source,0):l);for(let l of e.effects)if(l.is(jx))o=o&&o.setSelected(l.value,this.id);return r==this.active&&o==this.open?this:new sm(r,this.id,o)}get tooltip(){return this.open?this.open.tooltip:null}get attrs(){return this.open?this.open.attrs:this.active.length?xV:wV}}function yV(e,t){if(e==t)return!0;for(let n=0,i=0;;){while(n<e.length&&!e[n].hasResult())n++;while(i<t.length&&!t[i].hasResult())i++;let r=n==e.length,o=i==t.length;if(r||o)return r==o;if(e[n++].result!=t[i++].result)return!1}}var xV={"aria-autocomplete":"list"},wV={};function XN(e,t){let n={"aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":e};if(t>-1)n["aria-activedescendant"]=e+"-"+t;return n}var SV=[];function ZN(e,t){if(e.isUserEvent("input.complete")){let i=e.annotation(YN);if(i&&t.activateOnCompletion(i))return 12}let n=e.isUserEvent("input.type");return n&&t.activateOnTyping?5:n?1:e.isUserEvent("delete.backward")?2:e.selection?8:e.docChanged?16:0}class Qn{constructor(e,t,n=!1){this.source=e,this.state=t,this.explicit=n}hasResult(){return!1}get isPending(){return this.state==1}update(e,t){let n=ZN(e,t),i=this;if(n&8||n&16&&this.touches(e))i=new Qn(i.source,0);if(n&4&&i.state==0)i=new Qn(this.source,1);i=i.updateFor(e,n);for(let r of e.effects)if(r.is(om))i=new Qn(i.source,1,r.value);else if(r.is(gf))i=new Qn(i.source,0);else if(r.is(Fx)){for(let o of r.value)if(o.source==i.source)i=o}return i}updateFor(e,t){return this.map(e.changes)}map(e){return this}touches(e){return e.changes.touchesRange(Ws(e.state))}}class Ga extends Qn{constructor(e,t,n,i,r,o){super(e,3,t);this.limit=n,this.result=i,this.from=r,this.to=o}hasResult(){return!0}updateFor(e,t){var n;if(!(t&3))return this.map(e.changes);let i=this.result;if(i.map&&!e.changes.empty)i=i.map(i,e.changes);let r=e.changes.mapPos(this.from),o=e.changes.mapPos(this.to,1),s=Ws(e.state);if(s>o||!i||t&2&&(Ws(e.startState)==this.from||s<this.limit))return new Qn(this.source,t&4?1:0);let l=e.changes.mapPos(this.limit);if(kV(i.validFor,e.state,r,o))return new Ga(this.source,this.explicit,l,i,r,o);if(i.update&&(i=i.update(i,r,o,new Kx(e.state,s,!1))))return new Ga(this.source,this.explicit,l,i,i.from,(n=i.to)!==null&&n!==void 0?n:Ws(e.state));return new Qn(this.source,1,this.explicit)}map(e){if(e.empty)return this;let t=this.result.map?this.result.map(this.result,e):this.result;if(!t)return new Qn(this.source,0);return new Ga(this.source,this.explicit,e.mapPos(this.limit),t,e.mapPos(this.from),e.mapPos(this.to,1))}touches(e){return e.changes.touchesRange(this.from,this.to)}}function kV(e,t,n,i){if(!e)return!1;let r=t.sliceDoc(n,i);return typeof e=="function"?e(r,n,i,t):GN(e,!0).test(r)}var Fx=ye.define({map(e,t){return e.map((n)=>n.map(t))}}),sn=kn.define({create(){return sm.start()},update(e,t){return e.update(t)},provide:(e)=>[xx.from(e,(t)=>t.tooltip),Q.contentAttributes.from(e,(t)=>t.attrs)]});function qx(e,t){let n=t.completion.apply||t.completion.label,i=e.state.field(sn).active.find((r)=>r.source==t.source);if(!(i instanceof Ga))return!1;if(typeof n=="string")e.dispatch({...dV(e.state,n,i.from,i.to),annotations:YN.of(t.completion)});else n(e,t.completion,i.from,i.to);return!0}var _V=gV(sn,qx);function rm(e,t="option"){return(n)=>{let i=n.state.field(sn,!1);if(!i||!i.open||i.open.disabled||Date.now()-i.open.timestamp<n.state.facet(kt).interactionDelay)return!1;let r=1,o;if(t=="page"&&(o=wx(n,i.open.tooltip)))r=Math.max(2,Math.floor(o.dom.offsetHeight/o.dom.querySelector("li").offsetHeight)-1);let{length:s}=i.open.options,l=i.open.selected>-1?i.open.selected+r*(e?1:-1):e?0:s-1;if(l<0)l=t=="page"?0:s-1;else if(l>=s)l=t=="page"?s-1:0;return n.dispatch({effects:jx.of(l)}),!0}}var CV=(e)=>{let t=e.state.field(sn,!1);if(e.state.readOnly||!t||!t.open||t.open.selected<0||t.open.disabled||Date.now()-t.open.timestamp<e.state.facet(kt).interactionDelay)return!1;return qx(e,t.open.options[t.open.selected])},Vx=(e)=>{if(!e.state.field(sn,!1))return!1;return e.dispatch({effects:om.of(!0)}),!0},EV=(e)=>{let t=e.state.field(sn,!1);if(!t||!t.active.some((n)=>n.state!=0))return!1;return e.dispatch({effects:gf.of(null)}),!0};class eD{constructor(e,t){this.active=e,this.context=t,this.time=Date.now(),this.updates=[],this.done=void 0}}var OV=50,RV=1000,AV=En.fromClass(class{constructor(e){this.view=e,this.debounceUpdate=-1,this.running=[],this.debounceAccept=-1,this.pendingStart=!1,this.composing=0;for(let t of e.state.field(sn).active)if(t.isPending)this.startQuery(t)}update(e){let t=e.state.field(sn),n=e.state.facet(kt);if(!e.selectionSet&&!e.docChanged&&e.startState.field(sn)==t)return;let i=e.transactions.some((o)=>{let s=ZN(o,n);return s&8||(o.selection||o.docChanged)&&!(s&3)});for(let o=0;o<this.running.length;o++){let s=this.running[o];if(i||s.context.abortOnDocChange&&e.docChanged||s.updates.length+e.transactions.length>OV&&Date.now()-s.time>RV){for(let l of s.context.abortListeners)try{l()}catch(a){Xt(this.view.state,a)}s.context.abortListeners=null,this.running.splice(o--,1)}else s.updates.push(...e.transactions)}if(this.debounceUpdate>-1)clearTimeout(this.debounceUpdate);if(e.transactions.some((o)=>o.effects.some((s)=>s.is(om))))this.pendingStart=!0;let r=this.pendingStart?50:n.activateOnTypingDelay;if(this.debounceUpdate=t.active.some((o)=>o.isPending&&!this.running.some((s)=>s.active.source==o.source))?setTimeout(()=>this.startUpdate(),r):-1,this.composing!=0){for(let o of e.transactions)if(o.isUserEvent("input.type"))this.composing=2;else if(this.composing==2&&o.selection)this.composing=3}}startUpdate(){this.debounceUpdate=-1,this.pendingStart=!1;let{state:e}=this.view,t=e.field(sn);for(let n of t.active)if(n.isPending&&!this.running.some((i)=>i.active.source==n.source))this.startQuery(n);if(this.running.length&&t.open&&t.open.disabled)this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(kt).updateSyncTime)}startQuery(e){let{state:t}=this.view,n=Ws(t),i=new Kx(t,n,e.explicit,this.view),r=new eD(e,i);this.running.push(r),Promise.resolve(e.source(i)).then((o)=>{if(!r.context.aborted)r.done=o||null,this.scheduleAccept()},(o)=>{this.view.dispatch({effects:gf.of(null)}),Xt(this.view.state,o)})}scheduleAccept(){if(this.running.every((e)=>e.done!==void 0))this.accept();else if(this.debounceAccept<0)this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(kt).updateSyncTime)}accept(){var e;if(this.debounceAccept>-1)clearTimeout(this.debounceAccept);this.debounceAccept=-1;let t=[],n=this.view.state.facet(kt),i=this.view.state.field(sn);for(let r=0;r<this.running.length;r++){let o=this.running[r];if(o.done===void 0)continue;if(this.running.splice(r--,1),o.done){let l=Ws(o.updates.length?o.updates[0].startState:this.view.state),a=Math.min(l,o.done.from+(o.active.explicit?0:1)),u=new Ga(o.active.source,o.active.explicit,a,o.done,o.done.from,(e=o.done.to)!==null&&e!==void 0?e:l);for(let c of o.updates)u=u.update(c,n);if(u.hasResult()){t.push(u);continue}}let s=i.active.find((l)=>l.source==o.active.source);if(s&&s.isPending)if(o.done==null){let l=new Qn(o.active.source,0);for(let a of o.updates)l=l.update(a,n);if(!l.isPending)t.push(l)}else this.startQuery(s)}if(t.length||i.open&&i.open.disabled)this.view.dispatch({effects:Fx.of(t)})}},{eventHandlers:{blur(e){let t=this.view.state.field(sn,!1);if(t&&t.tooltip&&this.view.state.facet(kt).closeOnBlur){let n=t.open&&wx(this.view,t.open.tooltip);if(!n||!n.dom.contains(e.relatedTarget))setTimeout(()=>this.view.dispatch({effects:gf.of(null)}),10)}},compositionstart(){this.composing=1},compositionend(){if(this.composing==3)setTimeout(()=>this.view.dispatch({effects:om.of(!1)}),20);this.composing=0}}}),TV=typeof navigator=="object"&&/Win/.test(navigator.platform),MV=nr.highest(Q.domEventHandlers({keydown(e,t){let n=t.state.field(sn,!1);if(!n||!n.open||n.open.disabled||n.open.selected<0||e.key.length>1||e.ctrlKey&&!(TV&&e.altKey)||e.metaKey)return!1;let i=n.open.options[n.open.selected],r=n.active.find((s)=>s.source==i.source),o=i.completion.commitCharacters||r.result.commitCharacters;if(o&&o.indexOf(e.key)>-1)qx(t,i);return!1}})),NV=Q.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:0.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:0.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:"'\uD835\uDC65'"}},".cm-completionIcon-constant":{"&:after":{content:"'\uD835\uDC36'"}},".cm-completionIcon-type":{"&:after":{content:"'\uD835\uDC61'"}},".cm-completionIcon-enum":{"&:after":{content:"'∪'"}},".cm-completionIcon-property":{"&:after":{content:"'□'"}},".cm-completionIcon-keyword":{"&:after":{content:"'\uD83D\uDD11︎'"}},".cm-completionIcon-namespace":{"&:after":{content:"'▢'"}},".cm-completionIcon-text":{"&:after":{content:"'abc'",fontSize:"50%",verticalAlign:"middle"}}});var tD=new class extends gi{};tD.startSide=1;tD.endSide=-1;var Hq=typeof navigator=="object"&&/Android\b/.test(navigator.userAgent);function nD(e={}){return[MV,sn,kt.of(e),AV,LV,NV]}var DV=[{key:"Ctrl-Space",run:Vx},{mac:"Alt-`",run:Vx},{mac:"Alt-i",run:Vx},{key:"Escape",run:EV},{key:"ArrowDown",run:rm(!0)},{key:"ArrowUp",run:rm(!1)},{key:"PageDown",run:rm(!0,"page")},{key:"PageUp",run:rm(!1,"page")},{key:"Enter",run:CV}],LV=nr.highest(Ka.computeN([kt],(e)=>e.facet(kt).defaultKeymap?[DV]:[]));var zV=(e)=>{let{state:t}=e,n=t.doc.lineAt(t.selection.main.from),i=Jx(e.state,n.from);return i.line?BV(e):i.block?IV(e):!1};function Qx(e,t){return({state:n,dispatch:i})=>{if(n.readOnly)return!1;let r=e(t,n);if(!r)return!1;return i(n.update(r)),!0}}var BV=Qx(UV,0);var PV=Qx(fD,0);var IV=Qx((e,t)=>fD(e,t,VV(t)),0);function Jx(e,t){let n=e.languageDataAt("commentTokens",t,1);return n.length?n[0]:{}}var vf=50;function HV(e,{open:t,close:n},i,r){let o=e.sliceDoc(i-vf,i),s=e.sliceDoc(r,r+vf),l=/\s*$/.exec(o)[0].length,a=/^\s*/.exec(s)[0].length,u=o.length-l;if(o.slice(u-t.length,u)==t&&s.slice(a,a+n.length)==n)return{open:{pos:i-l,margin:l&&1},close:{pos:r+a,margin:a&&1}};let c,f;if(r-i<=2*vf)c=f=e.sliceDoc(i,r);else c=e.sliceDoc(i,i+vf),f=e.sliceDoc(r-vf,r);let d=/^\s*/.exec(c)[0].length,h=/\s*$/.exec(f)[0].length,m=f.length-h-n.length;if(c.slice(d,d+t.length)==t&&f.slice(m,m+n.length)==n)return{open:{pos:i+d+t.length,margin:/\s/.test(c.charAt(d+t.length))?1:0},close:{pos:r-h-n.length,margin:/\s/.test(f.charAt(m-1))?1:0}};return null}function VV(e){let t=[];for(let n of e.selection.ranges){let i=e.doc.lineAt(n.from),r=n.to<=i.to?i:e.doc.lineAt(n.to);if(r.from>i.from&&r.from==n.to)r=n.to==i.to+1?i:e.doc.lineAt(n.to-1);let o=t.length-1;if(o>=0&&t[o].to>i.from)t[o].to=r.to;else t.push({from:i.from+/^\s*/.exec(i.text)[0].length,to:r.to})}return t}function fD(e,t,n=t.selection.ranges){let i=n.map((o)=>Jx(t,o.from).block);if(!i.every((o)=>o))return null;let r=n.map((o,s)=>HV(t,i[s],o.from,o.to));if(e!=2&&!r.every((o)=>o))return{changes:t.changes(n.map((o,s)=>{if(r[s])return[];return[{from:o.from,insert:i[s].open+" "},{from:o.to,insert:" "+i[s].close}]}))};else if(e!=1&&r.some((o)=>o)){let o=[];for(let s=0,l;s<r.length;s++)if(l=r[s]){let a=i[s],{open:u,close:c}=l;o.push({from:u.pos-a.open.length,to:u.pos+u.margin},{from:c.pos-c.margin,to:c.pos+a.close.length})}return{changes:o}}return null}function UV(e,t,n=t.selection.ranges){let i=[],r=-1;e:for(let{from:o,to:s}of n){let l=i.length,a=1e9,u;for(let c=o;c<=s;){let f=t.doc.lineAt(c);if(u==null){if(u=Jx(t,f.from).line,!u)continue e}if(f.from>r&&(o==s||s>f.from)){r=f.from;let d=/^\s*/.exec(f.text)[0].length,h=d==f.length,m=f.text.slice(d,d+u.length)==u?d:-1;if(d<f.text.length&&d<a)a=d;i.push({line:f,comment:m,token:u,indent:d,empty:h,single:!1})}c=f.to+1}if(a<1e9){for(let c=l;c<i.length;c++)if(i[c].indent<i[c].line.text.length)i[c].indent=a}if(i.length==l+1)i[l].single=!0}if(e!=2&&i.some((o)=>o.comment<0&&(!o.empty||o.single))){let o=[];for(let{line:l,token:a,indent:u,empty:c,single:f}of i)if(f||!c)o.push({from:l.from+u,insert:a+" "});let s=t.changes(o);return{changes:s,selection:t.selection.map(s,1)}}else if(e!=1&&i.some((o)=>o.comment>=0)){let o=[];for(let{line:s,comment:l,token:a}of i)if(l>=0){let u=s.from+l,c=u+a.length;if(s.text[c-s.from]==" ")c++;o.push({from:u,to:c})}return{changes:o}}return null}var Xx=_n.define(),KV=_n.define(),jV=Z.define(),dD=Z.define({combine(e){return Da(e,{minDepth:100,newGroupDelay:500,joinToEvent:(t,n)=>n},{minDepth:Math.max,newGroupDelay:Math.min,joinToEvent:(t,n)=>(i,r)=>t(i,r)||n(i,r)})}}),hD=kn.define({create(){return lr.empty},update(e,t){let n=t.state.facet(dD),i=t.annotation(Xx);if(i){let a=ln.fromTransaction(t,i.selection),u=i.side,c=u==0?e.undone:e.done;if(a)c=am(c,c.length,n.minDepth,a);else c=vD(c,t.startState.selection);return new lr(u==0?i.rest:c,u==0?c:i.rest)}let r=t.annotation(KV);if(r=="full"||r=="before")e=e.isolate();if(t.annotation(Je.addToHistory)===!1)return!t.changes.empty?e.addMapping(t.changes.desc):e;let o=ln.fromTransaction(t),s=t.annotation(Je.time),l=t.annotation(Je.userEvent);if(o)e=e.addChanges(o,s,l,n,t);else if(t.selection)e=e.addSelection(t.startState.selection,s,l,n.newGroupDelay);if(r=="full"||r=="after")e=e.isolate();return e},toJSON(e){return{done:e.done.map((t)=>t.toJSON()),undone:e.undone.map((t)=>t.toJSON())}},fromJSON(e){return new lr(e.done.map(ln.fromJSON),e.undone.map(ln.fromJSON))}});function pD(e={}){return[hD,dD.of(e),Q.domEventHandlers({beforeinput(t,n){let i=t.inputType=="historyUndo"?mD:t.inputType=="historyRedo"?Gx:null;if(!i)return!1;return t.preventDefault(),i(n)}})]}function um(e,t){return function({state:n,dispatch:i}){if(!t&&n.readOnly)return!1;let r=n.field(hD,!1);if(!r)return!1;let o=r.pop(e,n,t);if(!o)return!1;return i(o),!0}}var mD=um(0,!1),Gx=um(1,!1),FV=um(0,!0),qV=um(1,!0);class ln{constructor(e,t,n,i,r){this.changes=e,this.effects=t,this.mapped=n,this.startSelection=i,this.selectionsAfter=r}setSelAfter(e){return new ln(this.changes,this.effects,this.mapped,this.startSelection,e)}toJSON(){var e,t,n;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:(n=this.startSelection)===null||n===void 0?void 0:n.toJSON(),selectionsAfter:this.selectionsAfter.map((i)=>i.toJSON())}}static fromJSON(e){return new ln(e.changes&&rt.fromJSON(e.changes),[],e.mapped&&mi.fromJSON(e.mapped),e.startSelection&&A.fromJSON(e.startSelection),e.selectionsAfter.map(A.fromJSON))}static fromTransaction(e,t){let n=Jn;for(let i of e.startState.facet(jV)){let r=i(e);if(r.length)n=n.concat(r)}if(!n.length&&e.changes.empty)return null;return new ln(e.changes.invert(e.startState.doc),n,void 0,t||e.startState.selection,Jn)}static selection(e){return new ln(void 0,Jn,void 0,void 0,e)}}function am(e,t,n,i){let r=t+1>n+20?t-n-1:0,o=e.slice(r,t);return o.push(i),o}function $V(e,t){let n=[],i=!1;return e.iterChangedRanges((r,o)=>n.push(r,o)),t.iterChangedRanges((r,o,s,l)=>{for(let a=0;a<n.length;){let u=n[a++],c=n[a++];if(l>=u&&s<=c)i=!0}}),i}function XV(e,t){return e.ranges.length==t.ranges.length&&e.ranges.filter((n,i)=>n.empty!=t.ranges[i].empty).length===0}function gD(e,t){return!e.length?t:!t.length?e:e.concat(t)}var Jn=[],GV=200;function vD(e,t){if(!e.length)return[ln.selection([t])];else{let n=e[e.length-1],i=n.selectionsAfter.slice(Math.max(0,n.selectionsAfter.length-GV));if(i.length&&i[i.length-1].eq(t))return e;return i.push(t),am(e,e.length-1,1e9,n.setSelAfter(i))}}function YV(e){let t=e[e.length-1],n=e.slice();return n[e.length-1]=t.setSelAfter(t.selectionsAfter.slice(0,t.selectionsAfter.length-1)),n}function $x(e,t){if(!e.length)return e;let n=e.length,i=Jn;while(n){let r=WV(e[n-1],t,i);if(r.changes&&!r.changes.empty||r.effects.length){let o=e.slice(0,n);return o[n-1]=r,o}else t=r.mapped,n--,i=r.selectionsAfter}return i.length?[ln.selection(i)]:Jn}function WV(e,t,n){let i=gD(e.selectionsAfter.length?e.selectionsAfter.map((l)=>l.map(t)):Jn,n);if(!e.changes)return ln.selection(i);let r=e.changes.map(t),o=t.mapDesc(e.changes,!0),s=e.mapped?e.mapped.composeDesc(o):o;return new ln(r,ye.mapEffects(e.effects,t),s,e.startSelection.map(o),i)}var QV=/^(input\.type|delete)($|\.)/;class lr{constructor(e,t,n=0,i=void 0){this.done=e,this.undone=t,this.prevTime=n,this.prevUserEvent=i}isolate(){return this.prevTime?new lr(this.done,this.undone):this}addChanges(e,t,n,i,r){let o=this.done,s=o[o.length-1];if(s&&s.changes&&!s.changes.empty&&e.changes&&(!n||QV.test(n))&&(!s.selectionsAfter.length&&t-this.prevTime<i.newGroupDelay&&i.joinToEvent(r,$V(s.changes,e.changes))||n=="input.type.compose"))o=am(o,o.length-1,i.minDepth,new ln(e.changes.compose(s.changes),gD(ye.mapEffects(e.effects,s.changes),s.effects),s.mapped,s.startSelection,Jn));else o=am(o,o.length,i.minDepth,e);return new lr(o,Jn,t,n)}addSelection(e,t,n,i){let r=this.done.length?this.done[this.done.length-1].selectionsAfter:Jn;if(r.length>0&&t-this.prevTime<i&&n==this.prevUserEvent&&n&&/^select($|\.)/.test(n)&&XV(r[r.length-1],e))return this;return new lr(vD(this.done,e),this.undone,t,n)}addMapping(e){return new lr($x(this.done,e),$x(this.undone,e),this.prevTime,this.prevUserEvent)}pop(e,t,n){let i=e==0?this.done:this.undone;if(i.length==0)return null;let r=i[i.length-1],o=r.selectionsAfter[0]||(r.startSelection?r.startSelection.map(r.changes.invertedDesc,1):t.selection);if(n&&r.selectionsAfter.length)return t.update({selection:r.selectionsAfter[r.selectionsAfter.length-1],annotations:Xx.of({side:e,rest:YV(i),selection:o}),userEvent:e==0?"select.undo":"select.redo",scrollIntoView:!0});else if(!r.changes)return null;else{let s=i.length==1?Jn:i.slice(0,i.length-1);if(r.mapped)s=$x(s,r.mapped);return t.update({changes:r.changes,selection:r.startSelection,effects:r.effects,annotations:Xx.of({side:e,rest:s,selection:o}),filter:!1,userEvent:e==0?"undo":"redo",scrollIntoView:!0})}}}lr.empty=new lr(Jn,Jn);var bD=[{key:"Mod-z",run:mD,preventDefault:!0},{key:"Mod-y",mac:"Mod-Shift-z",run:Gx,preventDefault:!0},{linux:"Ctrl-Shift-z",run:Gx,preventDefault:!0},{key:"Mod-u",run:FV,preventDefault:!0},{key:"Alt-u",mac:"Mod-Shift-u",run:qV,preventDefault:!0}];function Ya(e,t){return A.create(e.ranges.map(t),e.mainIndex)}function Ci(e,t){return e.update({selection:t,scrollIntoView:!0,userEvent:"select"})}function Ei({state:e,dispatch:t},n){let i=Ya(e.selection,n);if(i.eq(e.selection,!0))return!1;return t(Ci(e,i)),!0}function cm(e,t){return A.cursor(t?e.to:e.from)}function yD(e,t){return Ei(e,(n)=>n.empty?e.moveByChar(n,t):cm(n,t))}function Vt(e){return e.textDirectionAt(e.state.selection.main.head)==Ke.LTR}var xD=(e)=>yD(e,!Vt(e)),wD=(e)=>yD(e,Vt(e));function SD(e,t){return Ei(e,(n)=>n.empty?e.moveByGroup(n,t):cm(n,t))}var JV=(e)=>SD(e,!Vt(e)),ZV=(e)=>SD(e,Vt(e));var Xq=typeof Intl<"u"&&Intl.Segmenter?new Intl.Segmenter(void 0,{granularity:"word"}):null;function eU(e,t,n){if(t.type.prop(n))return!0;let i=t.to-t.from;return i&&(i>2||/[^\s,.;:]/.test(e.sliceDoc(t.from,t.to)))||t.firstChild}function fm(e,t,n){let i=_i(e).resolveInner(t.head),r=n?ce.closedBy:ce.openedBy;for(let a=t.head;;){let u=n?i.childAfter(a):i.childBefore(a);if(!u)break;if(eU(e,u,r))i=u;else a=n?u.to:u.from}let o=i.type.prop(r),s,l;if(o&&(s=n?Ys(e,i.from,1):Ys(e,i.to,-1))&&s.matched)l=n?s.end.to:s.end.from;else l=n?i.to:i.from;return A.cursor(l,n?-1:1)}var tU=(e)=>Ei(e,(t)=>fm(e.state,t,!Vt(e))),nU=(e)=>Ei(e,(t)=>fm(e.state,t,Vt(e)));function kD(e,t){return Ei(e,(n)=>{if(!n.empty)return cm(n,t);let i=e.moveVertically(n,t);return i.head!=n.head?i:e.moveToLineBoundary(n,t)})}var _D=(e)=>kD(e,!1),CD=(e)=>kD(e,!0);function ED(e){let t=e.scrollDOM.clientHeight<e.scrollDOM.scrollHeight-2,n=0,i=0,r;if(t){for(let o of e.state.facet(Q.scrollMargins)){let s=o(e);if(s===null||s===void 0?void 0:s.top)n=Math.max(s===null||s===void 0?void 0:s.top,n);if(s===null||s===void 0?void 0:s.bottom)i=Math.max(s===null||s===void 0?void 0:s.bottom,i)}r=e.scrollDOM.clientHeight-n-i}else r=(e.dom.ownerDocument.defaultView||window).innerHeight;return{marginTop:n,marginBottom:i,selfScroll:t,height:Math.max(e.defaultLineHeight,r-5)}}function OD(e,t){let n=ED(e),{state:i}=e,r=Ya(i.selection,(s)=>s.empty?e.moveVertically(s,t,n.height):cm(s,t));if(r.eq(i.selection))return!1;let o;if(n.selfScroll){let s=e.coordsAtPos(i.selection.main.head),l=e.scrollDOM.getBoundingClientRect(),a=l.top+n.marginTop,u=l.bottom-n.marginBottom;if(s&&s.top>a&&s.bottom<u)o=Q.scrollIntoView(r.main.head,{y:"start",yMargin:s.top-a})}return e.dispatch(Ci(i,r),{effects:o}),!0}var iD=(e)=>OD(e,!1),Yx=(e)=>OD(e,!0);function qo(e,t,n){let i=e.lineBlockAt(t.head),r=e.moveToLineBoundary(t,n);if(r.head==t.head&&r.head!=(n?i.to:i.from))r=e.moveToLineBoundary(t,n,!1);if(!n&&r.head==i.from&&i.length){let o=/^\s*/.exec(e.state.sliceDoc(i.from,Math.min(i.from+100,i.to)))[0].length;if(o&&t.head!=i.from+o)r=A.cursor(i.from+o)}return r}var iU=(e)=>Ei(e,(t)=>qo(e,t,!0)),rU=(e)=>Ei(e,(t)=>qo(e,t,!1)),oU=(e)=>Ei(e,(t)=>qo(e,t,!Vt(e))),sU=(e)=>Ei(e,(t)=>qo(e,t,Vt(e))),lU=(e)=>Ei(e,(t)=>e.moveToLineBoundary(t,!1,!1)),aU=(e)=>Ei(e,(t)=>e.moveToLineBoundary(t,!0,!1));function uU(e,t,n){let i=!1,r=Ya(e.selection,(o)=>{let s=Ys(e,o.head,-1)||Ys(e,o.head,1)||o.head>0&&Ys(e,o.head-1,1)||o.head<e.doc.length&&Ys(e,o.head+1,-1);if(!s||!s.end)return o;i=!0;let l=s.start.from==o.head?s.end.to:s.end.from;return n?A.range(o.anchor,l):A.cursor(l)});if(!i)return!1;return t(Ci(e,r)),!0}var cU=({state:e,dispatch:t})=>uU(e,t,!1);function Zn(e,t,n){let i=Ya(e.state.selection,(r)=>{if(r.undirectional&&r.head>=r.anchor!=t)r=A.range(r.head,r.anchor);let o=n(r);return A.range(r.anchor,o.head,o.goalColumn,o.bidiLevel||void 0,o.assoc)});if(i.eq(e.state.selection))return!1;return e.dispatch(Ci(e.state,i)),!0}function RD(e,t){return Zn(e,t,(n)=>e.moveByChar(n,t))}var AD=(e)=>RD(e,!Vt(e)),TD=(e)=>RD(e,Vt(e));function MD(e,t){return Zn(e,t,(n)=>e.moveByGroup(n,t))}var fU=(e)=>MD(e,!Vt(e)),dU=(e)=>MD(e,Vt(e));var hU=(e)=>{let t=!Vt(e);return Zn(e,t,(n)=>fm(e.state,n,t))},pU=(e)=>{let t=Vt(e);return Zn(e,t,(n)=>fm(e.state,n,t))};function ND(e,t){return Zn(e,t,(n)=>e.moveVertically(n,t))}var DD=(e)=>ND(e,!1),LD=(e)=>ND(e,!0);function zD(e,t){return Zn(e,t,(n)=>e.moveVertically(n,t,ED(e).height))}var rD=(e)=>zD(e,!1),oD=(e)=>zD(e,!0),mU=(e)=>Zn(e,!0,(t)=>qo(e,t,!0)),gU=(e)=>Zn(e,!1,(t)=>qo(e,t,!1)),vU=(e)=>{let t=!Vt(e);return Zn(e,t,(n)=>qo(e,n,t))},bU=(e)=>{let t=Vt(e);return Zn(e,t,(n)=>qo(e,n,t))},yU=(e)=>Zn(e,!1,(t)=>A.cursor(e.lineBlockAt(t.head).from)),xU=(e)=>Zn(e,!0,(t)=>A.cursor(e.lineBlockAt(t.head).to)),sD=({state:e,dispatch:t})=>(t(Ci(e,{anchor:0})),!0),lD=({state:e,dispatch:t})=>(t(Ci(e,{anchor:e.doc.length})),!0),aD=({state:e,dispatch:t})=>(t(Ci(e,{anchor:e.selection.main.anchor,head:0})),!0),uD=({state:e,dispatch:t})=>(t(Ci(e,{anchor:e.selection.main.anchor,head:e.doc.length})),!0),wU=({state:e,dispatch:t})=>(t(e.update({selection:{anchor:0,head:e.doc.length},userEvent:"select"})),!0),SU=({state:e,dispatch:t})=>{let n=dm(e).map(({from:i,to:r})=>A.undirectionalRange(i,Math.min(r+1,e.doc.length)));return t(e.update({selection:A.create(n),userEvent:"select"})),!0},kU=({state:e,dispatch:t})=>{let n=Ya(e.selection,(i)=>{let r=_i(e),o=r.resolveStack(i.from,1);if(i.empty){let s=r.resolveStack(i.from,-1);if(s.node.from>=o.node.from&&s.node.to<=o.node.to)o=s}for(let s=o;s;s=s.next){let{node:l}=s;if((l.from<i.from&&l.to>=i.to||l.to>i.to&&l.from<=i.from)&&s.next)return A.undirectionalRange(l.from,l.to)}return i});if(n.eq(e.selection))return!1;return t(Ci(e,n)),!0};function BD(e,t){let{state:n}=e,i=n.selection,r=n.selection.ranges.slice();for(let o of n.selection.ranges){let s=n.doc.lineAt(o.head);if(t?s.to<e.state.doc.length:s.from>0)for(let l=o;;){let a=e.moveVertically(l,t);if(a.head<s.from||a.head>s.to){if(!r.some((u)=>u.head==a.head))r.push(a);break}else if(a.head==l.head)break;else l=a}}if(r.length==i.ranges.length)return!1;return e.dispatch(Ci(n,A.create(r,r.length-1))),!0}var _U=(e)=>BD(e,!1),CU=(e)=>BD(e,!0),EU=({state:e,dispatch:t})=>{let n=e.selection,i=null;if(n.ranges.length>1)i=A.create([n.main]);else if(!n.main.empty)i=A.create([A.cursor(n.main.head)]);if(!i)return!1;return t(Ci(e,i)),!0};function bf(e,t){if(e.state.readOnly)return!1;let n="delete.selection",{state:i}=e,r=i.changeByRange((o)=>{let{from:s,to:l}=o;if(s==l){let a=t(o);if(a<s)n="delete.backward",a=lm(e,a,!1);else if(a>s)n="delete.forward",a=lm(e,a,!0);s=Math.min(s,a),l=Math.max(l,a)}else s=lm(e,s,!1),l=lm(e,l,!0);return s==l?{range:o}:{changes:{from:s,to:l},range:A.cursor(s,s<o.head?-1:1)}});if(r.changes.empty)return!1;return e.dispatch(i.update(r,{scrollIntoView:!0,userEvent:n,effects:n=="delete.selection"?Q.announce.of(i.phrase("Selection deleted")):void 0})),!0}function lm(e,t,n){if(e instanceof Q)for(let i of e.state.facet(Q.atomicRanges).map((r)=>r(e)))i.between(t,t,(r,o)=>{if(r<t&&o>t)t=n?o:r});return t}var PD=(e,t,n)=>bf(e,(i)=>{let r=i.from,{state:o}=e,s=o.doc.lineAt(r),l,a;if(n&&!t&&r>s.from&&r<s.from+200&&!/[^ \t]/.test(l=s.text.slice(0,r-s.from))){if(l[l.length-1]=="\t")return r-1;let u=Us(l,o.tabSize),c=u%pf(o)||pf(o);for(let f=0;f<c&&l[l.length-1-f]==" ";f++)r--;a=r}else if(a=wt(s.text,r-s.from,t,t)+s.from,a==r&&s.number!=(t?o.doc.lines:1))a+=t?1:-1;else if(!t&&/[\ufe00-\ufe0f]/.test(s.text.slice(a-s.from,r-s.from)))a=wt(s.text,a-s.from,!1,!1)+s.from;return a}),Wx=(e)=>PD(e,!1,!0);var ID=(e)=>PD(e,!0,!1),HD=(e,t)=>bf(e,(n)=>{let i=n.head,{state:r}=e,o=r.doc.lineAt(i),s=r.charCategorizer(i);for(let l=null;;){if(i==(t?o.to:o.from)){if(i==n.head&&o.number!=(t?r.doc.lines:1))i+=t?1:-1;break}let a=wt(o.text,i-o.from,t)+o.from,u=o.text.slice(Math.min(i,a)-o.from,Math.max(i,a)-o.from),c=s(u);if(l!=null&&c!=l)break;if(u!=" "||i!=n.head)l=c;i=a}return i}),VD=(e)=>HD(e,!1),OU=(e)=>HD(e,!0);var RU=(e)=>bf(e,(t)=>{let n=e.lineBlockAt(t.head).to;return t.head<n?n:Math.min(e.state.doc.length,t.head+1)});var AU=(e)=>bf(e,(t)=>{let n=e.moveToLineBoundary(t,!1).head;return t.head>n?n:Math.max(0,t.head-1)}),TU=(e)=>bf(e,(t)=>{let n=e.moveToLineBoundary(t,!0).head;return t.head<n?n:Math.min(e.state.doc.length,t.head+1)});var MU=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=e.changeByRange((i)=>({changes:{from:i.from,to:i.to,insert:he.of(["",""])},range:A.cursor(i.from)}));return t(e.update(n,{scrollIntoView:!0,userEvent:"input"})),!0},NU=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=e.changeByRange((i)=>{if(!i.empty||i.from==0||i.from==e.doc.length)return{range:i};let r=i.from,o=e.doc.lineAt(r),s=r==o.from?r-1:wt(o.text,r-o.from,!1)+o.from,l=r==o.to?r+1:wt(o.text,r-o.from,!0)+o.from;return{changes:{from:s,to:l,insert:e.doc.slice(r,l).append(e.doc.slice(s,r))},range:A.cursor(l)}});if(n.changes.empty)return!1;return t(e.update(n,{scrollIntoView:!0,userEvent:"move.character"})),!0};function dm(e){let t=[],n=-1;for(let i of e.selection.ranges){let r=e.doc.lineAt(i.from),o=e.doc.lineAt(i.to);if(!i.empty&&i.to==o.from)o=e.doc.lineAt(i.to-1);if(n>=r.number){let s=t[t.length-1];s.to=o.to,s.ranges.push(i)}else t.push({from:r.from,to:o.to,ranges:[i]});n=o.number+1}return t}function UD(e,t,n){if(e.readOnly)return!1;let i=[],r=[];for(let o of dm(e)){if(n?o.to==e.doc.length:o.from==0)continue;let s=e.doc.lineAt(n?o.to+1:o.from-1),l=s.length+1;if(n){i.push({from:o.to,to:s.to},{from:o.from,insert:s.text+e.lineBreak});for(let a of o.ranges)r.push(A.range(Math.min(e.doc.length,a.anchor+l),Math.min(e.doc.length,a.head+l)))}else{i.push({from:s.from,to:o.from},{from:o.to,insert:e.lineBreak+s.text});for(let a of o.ranges)r.push(A.range(a.anchor-l,a.head-l))}}if(!i.length)return!1;return t(e.update({changes:i,scrollIntoView:!0,selection:A.create(r,e.selection.mainIndex),userEvent:"move.line"})),!0}var Zx=({state:e,dispatch:t})=>UD(e,t,!1),ew=({state:e,dispatch:t})=>UD(e,t,!0);function KD(e,t,n){if(e.readOnly)return!1;let i=[];for(let o of dm(e))if(n)i.push({from:o.from,insert:e.doc.slice(o.from,o.to)+e.lineBreak});else i.push({from:o.to,insert:e.lineBreak+e.doc.slice(o.from,o.to)});let r=e.changes(i);return t(e.update({changes:r,selection:e.selection.map(r,n?1:-1),scrollIntoView:!0,userEvent:"input.copyline"})),!0}var DU=({state:e,dispatch:t})=>KD(e,t,!1),LU=({state:e,dispatch:t})=>KD(e,t,!0),zU=(e)=>{if(e.state.readOnly)return!1;let{state:t}=e,n=t.changes(dm(t).map(({from:r,to:o})=>{if(r>0)r--;else if(o<t.doc.length)o++;return{from:r,to:o}})),i=Ya(t.selection,(r)=>{let o=void 0;if(e.lineWrapping){let s=e.lineBlockAt(r.head),l=e.coordsAtPos(r.head,r.assoc||1);if(l)o=s.bottom+e.documentTop-l.bottom+e.defaultLineHeight/2}return e.moveVertically(r,!0,o)}).map(n);return e.dispatch({changes:n,selection:i,scrollIntoView:!0,userEvent:"delete.line"}),!0};function BU(e,t){if(/\(\)|\[\]|\{\}/.test(e.sliceDoc(t-1,t+1)))return{from:t,to:t};let n=_i(e).resolveInner(t),i=n.childBefore(t),r=n.childAfter(t),o;if(i&&r&&i.to<=t&&r.from>=t&&(o=i.type.prop(ce.closedBy))&&o.indexOf(r.name)>-1&&e.doc.lineAt(i.to).from==e.doc.lineAt(r.from).from&&!/\S/.test(e.sliceDoc(i.to,r.from)))return{from:i.to,to:r.from};return null}var cD=jD(!1),PU=jD(!0);function jD(e){return({state:t,dispatch:n})=>{if(t.readOnly)return!1;let i=t.changeByRange((r)=>{let{from:o,to:s}=r,l=t.doc.lineAt(o),a=!e&&o==s&&BU(t,o);if(e)o=s=(s<=l.to?l:t.doc.lineAt(s)).to;let u=new $a(t,{simulateBreak:o,simulateDoubleBreak:!!a}),c=Bx(u,o);if(c==null)c=Us(/^\s*/.exec(t.doc.lineAt(o).text)[0],t.tabSize);while(s<l.to&&/\s/.test(l.text[s-l.from]))s++;if(a)({from:o,to:s}=a);else if(o>l.from&&o<l.from+100&&!/\S/.test(l.text.slice(0,o)))o=l.from;let f=["",mf(t,c)];if(a)f.push(mf(t,u.lineIndent(l.from,-1)));return{changes:{from:o,to:s,insert:he.of(f)},range:A.cursor(o+1+f[1].length)}});return n(t.update(i,{scrollIntoView:!0,userEvent:"input"})),!0}}function tw(e,t){let n=-1;return e.changeByRange((i)=>{let r=[];for(let s=i.from;s<=i.to;){let l=e.doc.lineAt(s);if(l.number>n&&(i.empty||i.to>l.from))t(l,r,i),n=l.number;s=l.to+1}let o=e.changes(r);return{changes:r,range:A.range(o.mapPos(i.anchor,1),o.mapPos(i.head,1))}})}var IU=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=Object.create(null),i=new $a(e,{overrideIndentation:(o)=>{let s=n[o];return s==null?-1:s}}),r=tw(e,(o,s,l)=>{let a=Bx(i,o.from);if(a==null)return;if(!/\S/.test(o.text))a=0;let u=/^\s*/.exec(o.text)[0],c=mf(e,a);if(u!=c||l.from<o.from+u.length)n[o.from]=a,s.push({from:o.from,to:o.from+u.length,insert:c})});if(!r.changes.empty)t(e.update(r,{userEvent:"indent"}));return!0},HU=({state:e,dispatch:t})=>{if(e.readOnly)return!1;return t(e.update(tw(e,(n,i)=>{i.push({from:n.from,insert:e.facet(hf)})}),{userEvent:"input.indent"})),!0},VU=({state:e,dispatch:t})=>{if(e.readOnly)return!1;return t(e.update(tw(e,(n,i)=>{let r=/^\s*/.exec(n.text)[0];if(!r)return;let o=Us(r,e.tabSize),s=0,l=mf(e,Math.max(0,o-pf(e)));while(s<r.length&&s<l.length&&r.charCodeAt(s)==l.charCodeAt(s))s++;i.push({from:n.from+s,to:n.from+r.length,insert:l.slice(s)})}),{userEvent:"delete.dedent"})),!0},UU=(e)=>(e.setTabFocusMode(),!0);var KU=[{key:"Ctrl-b",run:xD,shift:AD,preventDefault:!0},{key:"Ctrl-f",run:wD,shift:TD},{key:"Ctrl-p",run:_D,shift:DD},{key:"Ctrl-n",run:CD,shift:LD},{key:"Ctrl-a",run:lU,shift:yU},{key:"Ctrl-e",run:aU,shift:xU},{key:"Ctrl-d",run:ID},{key:"Ctrl-h",run:Wx},{key:"Ctrl-k",run:RU},{key:"Ctrl-Alt-h",run:VD},{key:"Ctrl-o",run:MU},{key:"Ctrl-t",run:NU},{key:"Ctrl-v",run:Yx}],jU=[{key:"ArrowLeft",run:xD,shift:AD,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:JV,shift:fU,preventDefault:!0},{mac:"Cmd-ArrowLeft",run:oU,shift:vU,preventDefault:!0},{key:"ArrowRight",run:wD,shift:TD,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:ZV,shift:dU,preventDefault:!0},{mac:"Cmd-ArrowRight",run:sU,shift:bU,preventDefault:!0},{key:"ArrowUp",run:_D,shift:DD,preventDefault:!0},{mac:"Cmd-ArrowUp",run:sD,shift:aD},{mac:"Ctrl-ArrowUp",run:iD,shift:rD},{key:"ArrowDown",run:CD,shift:LD,preventDefault:!0},{mac:"Cmd-ArrowDown",run:lD,shift:uD},{mac:"Ctrl-ArrowDown",run:Yx,shift:oD},{key:"PageUp",run:iD,shift:rD},{key:"PageDown",run:Yx,shift:oD},{key:"Home",run:rU,shift:gU,preventDefault:!0},{key:"Mod-Home",run:sD,shift:aD},{key:"End",run:iU,shift:mU,preventDefault:!0},{key:"Mod-End",run:lD,shift:uD},{key:"Enter",run:cD,shift:cD},{key:"Mod-a",run:wU},{key:"Backspace",run:Wx,shift:Wx,preventDefault:!0},{key:"Delete",run:ID,preventDefault:!0},{key:"Mod-Backspace",mac:"Alt-Backspace",run:VD,preventDefault:!0},{key:"Mod-Delete",mac:"Alt-Delete",run:OU,preventDefault:!0},{mac:"Mod-Backspace",run:AU,preventDefault:!0},{mac:"Mod-Delete",run:TU,preventDefault:!0}].concat(KU.map((e)=>({mac:e.key,run:e.run,shift:e.shift}))),FD=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:tU,shift:hU},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:nU,shift:pU},{key:"Alt-ArrowUp",run:Zx},{key:"Shift-Alt-ArrowUp",run:DU},{key:"Alt-ArrowDown",run:ew},{key:"Shift-Alt-ArrowDown",run:LU},{key:"Mod-Alt-ArrowUp",run:_U},{key:"Mod-Alt-ArrowDown",run:CU},{key:"Escape",run:EU},{key:"Mod-Enter",run:PU},{key:"Alt-l",mac:"Ctrl-l",run:SU},{key:"Mod-i",run:kU,preventDefault:!0},{key:"Mod-[",run:VU},{key:"Mod-]",run:HU},{key:"Mod-Alt-\\",run:IU},{key:"Shift-Mod-k",run:zU},{key:"Shift-Mod-\\",run:cU},{key:"Mod-/",run:zV},{key:"Alt-A",mac:"Ctrl-A",run:PV},{key:"Ctrl-m",mac:"Shift-Alt-m",run:UU}].concat(jU);var hm=/^\s*\/\//;var $o=/^(\s*)- /;function yf(e){let t=/(?:^|\s)\/\//.exec(e);if(t==null)return-1;return t.index+t[0].length-2}function $D(e){let t=yf(e);return t<0?{text:e,hadComment:!1}:{text:e.slice(0,t).trimEnd(),hadComment:!0}}function FU(e){let t=[],n=[];for(let i of e.split(`
34
+ `)){let r=$D(i);if(r.hadComment&&r.text.trim()==="")continue;let o=$o.exec(i);if(o!=null&&o[0].length<=r.text.length+1){let s=r.text.slice(o[0].length).trim();if(s!=="")n.push(s)}else t.push(r.text)}return{positive:t.join(`
35
+ `).trim(),negative:n.join(", ")}}function pm(e){let t=[],n=0;for(let i of e.split(`
36
+ `))t.push({from:n,text:i}),n+=i.length+1;return t}function mm(e){let t=[],n=/(?<!\\)\(((?:\\[()]|[^()])*?):\s*(-?\d*\.?\d+)\s*(?<!\\)\)/g;for(let i=n.exec(e);i!=null;i=n.exec(e)){let r=i[1]??"",o=i[2]??"1",s=i.index,l=s+i[0].length,a=s+i[0].lastIndexOf(o);t.push({from:s,to:l,innerFrom:s+1,innerTo:s+1+r.length,numFrom:a,numTo:a+o.length,weight:Number(o)})}return t}var nw=(e)=>Math.round(e*100)/100,qD=(e)=>String(nw(e));function qU(e,t){let n=yf(e),i=n<0?e.length:n;if(t>i)return null;let r=t;while(r>0&&e[r-1]!==",")r--;let o=t;while(o<i&&e[o]!==",")o++;let s=$o.exec(e);if(s!=null&&r<s[0].length)r=s[0].length;while(r<o&&/\s/.test(e[r]??""))r++;while(o>r&&/\s/.test(e[o-1]??""))o--;return r<o?{from:r,to:o}:null}function XD(e,t,n,i){let r=pm(e).find((h)=>t>=h.from&&t<=h.from+h.text.length);if(r==null||n>r.from+r.text.length)return null;let o=t-r.from,s=n-r.from,l=yf(r.text);if(l>=0&&o>=l)return null;let a=mm(r.text).filter((h)=>o>=h.from&&s<=h.to).sort((h,m)=>h.to-h.from-(m.to-m.from))[0];if(a!=null){let h=nw(a.weight+i),m=r.text.slice(a.innerFrom,a.innerTo);if(h===1){let b=r.from+a.from;return{changes:[{from:b,to:r.from+a.to,insert:m}],selection:{anchor:b,head:b+m.length}}}return{changes:[{from:r.from+a.numFrom,to:r.from+a.numTo,insert:qD(h)}],selection:{anchor:r.from+a.innerFrom,head:r.from+a.innerTo}}}let u;if(o===s)u=qU(r.text,o);else{let h=o,m=s;while(h<m&&/\s/.test(r.text[h]??""))h++;while(m>h&&/\s/.test(r.text[m-1]??""))m--;u=h<m?{from:h,to:m}:null}if(u==null)return null;let c=nw(1+i),f=r.from+u.from,d=r.from+u.to;return{changes:[{from:f,to:f,insert:"("},{from:d,to:d,insert:`:${qD(c)})`}],selection:{anchor:f+1,head:d+1}}}function GD(e,t,n){let i=pm(e),r=n>t&&i.some((o)=>o.from===n)?n-1:n;return i.filter((o)=>o.from+o.text.length>=t&&o.from<=r)}function YD(e,t,n){let i=GD(e,t,n).filter((r)=>r.text.trim()!=="");if(i.length===0)return[];if(i.every((r)=>hm.test(r.text)))return i.map((r)=>{let o=r.text.indexOf("//"),s=r.text[o+2]===" "?3:2;return{from:r.from+o,to:r.from+o+s,insert:""}});return i.filter((r)=>!hm.test(r.text)).map((r)=>{let o=r.from+(/^\s*/.exec(r.text)?.[0].length??0);return{from:o,to:o,insert:"// "}})}function WD(e,t,n){let i=GD(e,t,n).filter((r)=>r.text.trim()!==""&&!hm.test(r.text));if(i.length===0)return[];if(i.every((r)=>$o.test(r.text)))return i.map((r)=>{let o=$o.exec(r.text)?.[1]?.length??0;return{from:r.from+o,to:r.from+o+2,insert:""}});return i.filter((r)=>!$o.test(r.text)).map((r)=>{let o=r.from+(/^\s*/.exec(r.text)?.[0].length??0);return{from:o,to:o,insert:"- "}})}function QD(e){let t=[];for(let n of pm(e)){let i=yf(n.text),r=i<0?n.text.length:i,o=$o.exec(n.text);if(o!=null&&o[0].length<=r+1){let s=n.from+o[0].length-2;if(t.push({from:s,to:s+1,kind:"negative-dash"}),n.from+o[0].length<n.from+r)t.push({from:n.from+o[0].length,to:n.from+r,kind:"negative"})}for(let s of mm(n.text.slice(0,r)))t.push({from:n.from+s.from,to:n.from+s.innerFrom,kind:"weight-paren"}),t.push({from:n.from+s.innerTo,to:n.from+s.numFrom,kind:"weight-paren"}),t.push({from:n.from+s.numFrom,to:n.from+s.numTo,kind:"weight-num"}),t.push({from:n.from+s.numTo,to:n.from+s.to,kind:"weight-paren"});if(i>=0)t.push({from:n.from+i,to:n.from+n.text.length,kind:"comment"})}return t.sort((n,i)=>n.from-i.from||n.to-i.to)}function JD(e){let t=e.trim(),n=mm(t)[0];if(n!=null&&n.from===0&&n.to===t.length)t=t.slice(n.innerFrom,n.innerTo);return t.replace(/\\([()])/g,"$1").toLowerCase().replace(/_/g," ").replace(/\s+/g," ").trim()}function $U(e,t,n){let i=[],r=n;for(let o=n;o<=e.length;o++){if(o<e.length&&e[o]!==",")continue;let s=e.slice(r,o),l=s.length-s.trimStart().length,a=JD(s);if(a!=="")i.push({from:t+r+l,to:t+r+s.trimEnd().length,tag:a});r=o+1}return i}function ZD(e,t={}){let n=[],i=[],r=[];for(let a of pm(e)){if(hm.test(a.text))continue;let u=$D(a.text).text,c=$o.exec(a.text),f=c!=null&&c[0].length<=u.length+1,d=$U(u,a.from,f?c[0].length:0);if((f?r:i).push(...d),t.weights===!1)for(let h of mm(u))n.push({from:a.from+h.from,to:a.from+h.to,message:"this model ignores weights: the text inside is read, the number is not"})}let o=new Map;for(let a of t.injected??[]){let u=JD(a.tag);if(u!==""&&!o.has(u))o.set(u,a.source)}let s=(a,u)=>{let c=new Set;for(let f of a){if(c.has(f.tag))n.push({from:f.from,to:f.to,message:`'${f.tag}' is already in the ${u}`});c.add(f.tag)}};s(i,"prompt"),s(r,"negative prompt");let l=new Set(r.map((a)=>a.tag));for(let a of i){let u=o.get(a.tag);if(u!=null)n.push({from:a.from,to:a.to,message:`'${a.tag}' is already added by the lora ${u}`});if(l.has(a.tag))n.push({from:a.from,to:a.to,message:`'${a.tag}' is also in the negative prompt`})}return n.sort((a,u)=>a.from-u.from)}function eL(e){let t=FU(e).positive,n=0;for(let i of t.matchAll(/\p{L}+|\p{N}|[^\s\p{L}\p{N}]/gu)){let r=i[0];n+=/^\p{L}/u.test(r)&&r.length>8?Math.ceil(r.length/5):1}return n}function XU(e,t){let n=yf(e);if(n>=0&&t>n)return null;let i=t;while(i>0&&!/[,(]/.test(e[i-1]??""))i--;let r=$o.exec(e);if(r!=null&&i<r[0].length)i=r[0].length;while(i<t&&/\s/.test(e[i]??""))i++;return{from:i,text:e.slice(i,t)}}function tL(e,t){let n=XU(e,t);if(n==null)return[];let i=[n],r=[];for(let o=n.from+1;o<t;o++)if(/\s/.test(e[o-1]??"")&&!/\s/.test(e[o]??""))r.push(o);for(let o of r.slice(-4))i.push({from:o,text:e.slice(o,t)});return i}function nL(e,t,n){let i=n.underscores===!0?e:e.replace(/(?<=[\p{L}\p{N})])_(?=[\p{L}\p{N}(])/gu," ");if(n.weights!==!1)i=i.replace(/(?<!\\)([()])/g,"\\$1");if(t===GU&&n.artistPrefix!=null)i=`${n.artistPrefix}${i}`;return i}var GU=1,iL={0:"general",1:"artist",3:"copyright",4:"character",5:"meta"};var gm=0.05,iw=ye.define(),YU={comment:"pe-comment",negative:"pe-negative","negative-dash":"pe-negative-dash","weight-paren":"pe-weight-paren","weight-num":"pe-weight-num"};function rL(e,t){let n=e.state.doc.toString(),i=t(),r=QD(n).filter((o)=>o.to>o.from).map((o)=>Ae.mark({class:YU[o.kind]}).range(o.from,o.to));for(let o of ZD(n,{injected:i.injected(),weights:i.weights}))if(o.to>o.from)r.push(Ae.mark({class:"pe-issue",attributes:{"data-tip":o.message}}).range(o.from,o.to));return Ae.set(r,!0)}function WU(e){return En.fromClass(class{decorations;constructor(t){this.decorations=rL(t,e)}update(t){let n=t.transactions.some((i)=>i.effects.some((r)=>r.is(iw)));if(t.docChanged||n)this.decorations=rL(t.view,e)}},{decorations:(t)=>t.decorations})}function QU(e,t){if(t.length===0)return!1;return e.dispatch({changes:t,userEvent:"input"}),!0}function oL(e,t){return(n)=>{if(!e().weights)return!1;let i=n.state.selection.main,r=XD(n.state.doc.toString(),i.from,i.to,t);if(r==null)return!1;return n.dispatch({changes:r.changes,selection:A.single(r.selection.anchor,r.selection.head),userEvent:"input"}),!0}}var sL=(e)=>(t)=>{let n=t.state.selection.main;return QU(t,e(t.state.doc.toString(),n.from,n.to))};function JU(e){let t=oL(e,gm),n=oL(e,-gm),i=sL(WD);return nr.high(Ka.of([{key:"Mod-ArrowUp",run:t},{key:"Ctrl-ArrowUp",run:t},{key:"Mod-ArrowDown",run:n},{key:"Ctrl-ArrowDown",run:n},{key:"Mod-/",run:sL(YD)},{key:"Mod-Shift--",run:i},{key:"Mod-_",run:i},{key:"Alt-ArrowUp",run:Zx},{key:"Alt-ArrowDown",run:ew}]))}var ZU=(e)=>e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1000?`${Math.round(e/1000)}k`:String(e);function lL(e){return(t,n,i,r)=>{let o=t.state.sliceDoc(r,r+1),s=o===""||o===`
37
+ `?", ":"";t.dispatch({changes:{from:i,to:r,insert:e+s},selection:{anchor:i+e.length+s.length},userEvent:"input.complete"})}}async function e9(e,t,n){if(e.tags==null)return[];let i=t.trim().toLowerCase(),r=[],o=new Set;for(let l of e.loraWords()){let a=l.word.toLowerCase();if(o.has(a)||i!==""&&!a.includes(i))continue;o.add(a),r.push({label:l.word,detail:l.source,type:"lora",boost:50,apply:lL(l.word)})}if(i==="")return r;let s=await e.searchTags(t.trim(),n);return e.onTagError(null),s.forEach((l,a)=>{let u=nL(l.name,l.category,{...e.tags,weights:e.weights});r.push({label:u,detail:`${l.alias==null?"":`← ${l.alias} · `}${ZU(l.count)}`,type:`tag-${iL[l.category??-1]??"plain"}`,boost:-a,apply:lL(u)})}),r}function t9(e){return async(t)=>{let n=t.state.doc.lineAt(t.pos),i=e(),r=new AbortController;t.addEventListener("abort",()=>r.abort());for(let o of tL(n.text,t.pos-n.from)){if(o.text.trim().length<2&&!t.explicit)continue;try{let s=await e9(i,o.text,r.signal);if(s.length>0)return{from:n.from+o.from,options:s,filter:!1}}catch(s){if(r.signal.aborted)return null;return i.onTagError(s instanceof Error?s.message:String(s)),null}}return null}}var n9=Q.theme({"&":{background:"var(--panel-2)",border:"1px solid var(--border)",borderRadius:"6px",color:"var(--text)",fontSize:"13px"},"&.cm-focused":{outline:"none",borderColor:"var(--accent)"},".cm-scroller":{fontFamily:"ui-monospace, SFMono-Regular, Menlo, monospace",lineHeight:"1.5",maxHeight:"18em",overflow:"auto"},".cm-content":{padding:"6px 0",caretColor:"var(--text)"},".cm-line":{padding:"0 8px"},".cm-cursor":{borderLeftColor:"var(--text)"},"&.cm-focused .cm-selectionBackground, .cm-selectionBackground, ::selection":{background:"#c3d1f4 !important",color:"#000 !important"},".cm-placeholder":{color:"var(--dim)"},".pe-comment":{color:"var(--dim)",fontStyle:"italic"},".pe-comment *":{color:"var(--dim)"},".pe-negative":{color:"var(--red)"},".pe-negative-dash":{color:"var(--red)",fontWeight:"700"},".pe-weight-paren":{opacity:"0.45"},".pe-weight-num":{color:"var(--amber)",fontWeight:"700"},".pe-issue":{textDecoration:"underline wavy var(--amber)",textUnderlineOffset:"3px"},".cm-tooltip.cm-tooltip-autocomplete":{background:"var(--panel)",border:"1px solid var(--border)",borderRadius:"6px",overflow:"hidden"},".cm-tooltip-autocomplete > ul":{fontFamily:"inherit",maxHeight:"16em"},".cm-tooltip-autocomplete > ul > li":{padding:"2px 8px",display:"flex",gap:"10px"},".cm-tooltip-autocomplete > ul > li[aria-selected]":{background:"var(--accent-dim)",color:"#fff"},".cm-completionDetail":{marginLeft:"auto",color:"var(--dim)",fontStyle:"normal"},".cm-completionIcon":{display:"none"},".cm-completionLabel":{whiteSpace:"nowrap"},".cm-completionIcon-tag-artist + .cm-completionLabel":{color:"#ff8a8b"},".cm-completionIcon-tag-copyright + .cm-completionLabel":{color:"#c797ff"},".cm-completionIcon-tag-character + .cm-completionLabel":{color:"#35c64a"},".cm-completionIcon-tag-meta + .cm-completionLabel":{color:"#ead084"},".cm-completionIcon-lora + .cm-completionLabel":{color:"var(--accent)"}},{dark:!0}),i9=FD.filter((e)=>e.key!=="Mod-Enter");function aL(e){return[Q.theme({".cm-content":{minHeight:`${e.minLines*1.5}em`}}),pD(),JU(e.ctx),Ka.of([...i9,...bD]),Q.lineWrapping,WU(e.ctx),nD({override:[t9(e.ctx)],icons:!0,activateOnTyping:!0}),n9,wN(e.placeholder??""),Q.updateListener.of((t)=>{if(t.docChanged)e.onChange(t.state.doc.toString())})]}var r9=[`⌘↑ / ⌘↓ (or ⌃↑ / ⌃↓): weight of the selection or the tag under the cursor, ±${gm}`,"⌘/ comment lines · ⌘⇧- negative lines · ⌥↑ / ⌥↓ move lines",'"//" starts a comment · "- " line = negative prompt · ⌘⏎ generate'].join(`
38
+ `),rw=q(function(t){let n=X(null),i=X(null),[r,o]=W(null),s=X({p:t,setTagError:o});s.current={p:t,setTagError:o};let l=t.st.form,a=JSON.stringify(l?.injectedTagsFor(t.v)??[]);J(()=>{let c=()=>{let d=s.current.p,h=d.st.form;return{weights:d.v.desc.weights!==!1,tags:d.v.desc.tags??null,searchTags:async(m,b)=>(await uR({module:d.module,varName:d.v.name,q:m,signal:b})).hits,injected:()=>h?.injectedTagsFor(d.v)??[],loraWords:()=>h?.loraWordsFor(d.v)??[],onTagError:(m)=>s.current.setTagError(m)}};if(n.current==null)return;let f=new Q({parent:n.current,state:pe.create({doc:s.current.p.value,extensions:aL({ctx:c,onChange:(d)=>s.current.p.onChange(d),minLines:s.current.p.minLines})})});return i.current=f,()=>{f.destroy(),i.current=null}},[]),J(()=>{let c=i.current;if(c==null)return;let f=c.state.doc.toString();if(f===t.value)return;let d=Math.min(c.state.selection.main.head,t.value.length);c.dispatch({changes:{from:0,to:f.length,insert:t.value},selection:{anchor:d}})},[t.value]),J(()=>{i.current?.dispatch({effects:iw.of(null)})},[a]);let u=eL(t.value);return y("div",{className:"prompt-editor",children:[p("div",{ref:n}),y("div",{className:r==null?"pe-foot":"pe-foot has-error",children:[r==null?null:y("span",{className:"pe-error","data-tip":r,children:["tags: ",r]}),p("span",{className:"pe-keys","data-tip":r9,children:"keys"}),y("span",{className:"pe-tokens","data-tip":`an estimate of the CLIP tokens the positive prompt uses
39
+ CLIP models read it in chunks of 75`,children:["≈ ",u," tokens"]})]})]})});function xf(e){let[t,n]=W(!1),i=e.entries.length;return y(te,{children:[y("button",{type:"button",className:e.compact===!0?"link":"mini",disabled:i===0,"data-tip":i===0?`every ${e.what} you submit shows here, until you close the page`:`${i} past ${e.what}s: search, preview, restore`,onClick:()=>n(!0),children:[p(T,{name:"history"}),e.compact===!0?null:" history"]}),t?p(o9,{entries:e.entries,what:e.what,onPick:(r)=>{n(!1),e.onPick(r)},onClose:()=>n(!1)}):null]})}function o9(e){let[t,n]=W(""),[i,r]=W(0),[o,s]=W(()=>Date.now()),l=X(null),a=SR(e.entries,t),u=a[Math.min(i,Math.max(0,a.length-1))]??null;J(()=>{let f=setInterval(()=>s(Date.now()),1e4);return()=>clearInterval(f)},[]),J(()=>{let f=(d)=>{if(d.key!=="Escape")return;d.stopImmediatePropagation(),e.onClose()};return window.addEventListener("keydown",f,!0),()=>window.removeEventListener("keydown",f,!0)},[e]),J(()=>{l.current?.querySelector(".hist-row.sel")?.scrollIntoView({block:"nearest"})},[i,t]);let c=(f)=>r((d)=>Math.max(0,Math.min(a.length-1,d+f)));return p("div",{className:"modal-overlay top hist-overlay",onClick:()=>e.onClose(),children:y("div",{className:"modal hist-modal",onClick:(f)=>f.stopPropagation(),children:[y("div",{className:"modal-head",children:[p(T,{name:"history"}),p("input",{type:"text",autoFocus:!0,placeholder:`search ${e.entries.length} past ${e.what}s, every word must match`,value:t,onChange:(f)=>{n(f.target.value),r(0)},onKeyDown:(f)=>{if(f.key==="ArrowDown")f.preventDefault(),c(1);else if(f.key==="ArrowUp")f.preventDefault(),c(-1);else if(f.key==="Enter"){if(f.preventDefault(),u!=null)e.onPick(u)}}}),p("button",{type:"button",className:"modal-close","data-tip":"close (esc)",onClick:()=>e.onClose(),children:p(T,{name:"close"})})]}),y("div",{className:"hist-cols",children:[y("div",{className:"hist-list",ref:l,children:[a.length===0?y("div",{className:"hist-empty",children:["nothing matches '",t,"'"]}):null,a.map((f,d)=>y("button",{type:"button",className:f===u?"hist-row sel":"hist-row",onMouseEnter:()=>r(d),onClick:()=>e.onPick(f),children:[p("span",{className:"hist-first",children:f.text.split(`
40
+ `)[0]}),y("span",{className:"hist-meta",children:[kR(f.at,o),f.count>1?` · ${f.count}×`:"",f.source===""?"":` · ${f.source}`]})]},f.text))]}),p("div",{className:"hist-preview",children:u==null?null:y(te,{children:[p("pre",{className:"hist-text",children:u.text}),y("div",{className:"hist-foot",children:[p("span",{className:"hint",children:"↑↓ to preview, enter or click to restore"}),y("button",{type:"button",className:"primary",onClick:()=>e.onPick(u),children:["restore this ",e.what]})]})]})})]})]})})}var s9=["off","low","medium","high"],l9={openrouter:"openrouter (cloud)",openwebui:"open webui (local)",openai:"llama.cpp / ollama / vllm (openai /v1)"},a9={openrouter:"",openwebui:"http://localhost:3000",openai:"http://localhost:8080/v1"},uL=q(function(t){let n=()=>{let r=window.prompt(`name the new ${t.kind}`,t.newName);if(r!=null)t.onCreate(r)},i=(r)=>{let o=t.status?.(r)??null;return o==null?null:p("span",{className:`enh-dot ${o.cls}`,"data-tip":o.tip})};return y("div",{className:"enh-tabs",children:[y("div",{className:"enh-tabs-title",children:[t.title,t.save==="saving"?p("span",{className:"enh-save",children:"saving…"}):null,t.save==="error"?p("span",{className:"enh-save error","data-tip":t.saveError,children:"\uD83D\uDD34 not saved"}):null]}),p("select",{className:"enh-tab-select",value:t.selected,onChange:(r)=>t.onSelect(r.target.value),children:t.names.map((r)=>p("option",{value:r,children:r},r))}),y("div",{className:"enh-tab-list",role:"tablist",children:[t.names.map((r)=>y("div",{className:r===t.selected?"enh-tab sel":"enh-tab",children:[y("button",{type:"button",role:"tab","aria-selected":r===t.selected,onClick:()=>t.onSelect(r),children:[i(r),p("span",{className:"enh-tab-name",children:r})]}),r===t.selected?p("button",{type:"button",className:t.editing?"enh-tab-edit sel":"enh-tab-edit","data-tip":t.editing?"close the editor":`edit this ${t.kind}`,onClick:()=>t.onEdit(),children:p(T,{name:"pen"})}):null]},r)),y("button",{type:"button",className:"enh-tab-new",onClick:n,children:[p(T,{name:"plus"})," new ",t.kind]})]})]})}),u9=q(function(t){let n=t.e,{configEntry:i,preset:r}=n;return y("nav",{className:"enh-side",children:[i==null?y("div",{className:"enh-tabs",children:[p("div",{className:"enh-tabs-title",children:"llm"}),y("button",{type:"button",className:"enh-tab-new",onClick:()=>n.setEditing("llm"),children:[p(T,{name:"plus"})," set up an llm"]})]}):p(uL,{title:"llm",names:n.configs.map((o)=>o.name),selected:i.name,kind:"llm",newName:"my-llm",save:n.configSaveState,saveError:n.configSaveError,editing:n.editing==="llm",onEdit:()=>n.setEditing(n.editing==="llm"?null:"llm"),status:(o)=>{let s=n.configStatus.get(o);if(s==null)return null;let l=n.configStatusError.get(o);return{cls:s,tip:s==="up"?"answers":s==="checking"?"checking…":`does not answer: ${l??""}`}},onSelect:(o)=>n.selectConfig(o),onCreate:(o)=>{n.addConfig(o),n.setEditing("llm")}}),r==null?y("div",{className:"enh-tabs",children:[p("div",{className:"enh-tabs-title",children:"master prompt"}),y("button",{type:"button",className:"enh-tab-new",onClick:()=>n.addPreset("refine-prompt"),children:[p(T,{name:"plus"})," new master prompt"]})]}):p(uL,{title:"master prompt",names:n.presets.map((o)=>o.name),selected:r.name,kind:"master prompt",newName:"refine-<model>-prompt",save:n.saveState,saveError:n.saveError,editing:n.editing==="preset",onEdit:()=>n.setEditing(n.editing==="preset"?null:"preset"),onSelect:(o)=>n.selectPreset(o),onCreate:(o)=>{n.addPreset(o),n.setEditing("preset")}})]})});function cL(e){let t=()=>{if(e.name==null)return;let i=window.prompt(`rename this ${e.kind} (renames the file)`,e.name);if(i!=null)e.onRename(i)},n=()=>{if(e.name==null)return;if(window.confirm(`delete ${e.kind} '${e.name}'? its file is removed.`))e.onDelete()};return y("section",{className:"enh-edit",children:[y("div",{className:"enh-edit-head",children:[y("h3",{className:"enh-h","data-tip":e.tip,children:[e.kind," ",p("span",{className:"enh-h-name",children:e.name??"new"})]}),e.name==null?null:y("span",{className:"btn-group",children:[p("button",{type:"button",onClick:()=>e.onDuplicate(),children:"duplicate"}),p("button",{type:"button",onClick:t,children:"rename"}),y("button",{type:"button",className:"quiet-danger",onClick:n,children:[p(T,{name:"trash"})," delete"]})]}),p("button",{type:"button",className:"enh-edit-close","data-tip":"done (esc), everything is already saved",onClick:()=>e.onClose(),children:"done"})]}),p("div",{className:"enh-edit-body",children:e.children})]})}var c9=q(function(t){let n=t.e,i=n.visibleModels,r=n.provider!=="openrouter",o=n.configEntry;return y(cL,{kind:"llm",name:o?.name??null,tip:o==null?"any edit creates the config file":`.comfy-ts/llm-configs/${o.name}.json, saved as you type`,onRename:(s)=>void n.renameConfig(s),onDuplicate:()=>n.duplicateConfig(),onDelete:()=>void n.deleteConfig(),onClose:()=>n.setEditing(null),children:[y("div",{className:"enh-grid",children:[p("label",{children:"provider"}),p("select",{value:n.provider,onChange:(s)=>n.setProvider(s.target.value),children:PR.map((s)=>p("option",{value:s,children:l9[s]},s))}),r?y(te,{children:[p("label",{children:"address"}),p("input",{type:"text",placeholder:a9[n.provider],value:n.baseUrl,onChange:(s)=>n.setBaseUrl(s.target.value)})]}):null,p("label",{"data-tip":"kept in this browser only, never in a file",children:"api key"}),p("input",{type:"password",placeholder:r?"blank if none":"sk-or-v1-…",value:n.apiKey,onChange:(s)=>n.setApiKey(s.target.value)}),p("label",{children:"model"}),y("div",{className:"enh-inline",children:[i.length>0?y("select",{value:n.model,onChange:(s)=>n.setModel(s.target.value),children:[i.some((s)=>s.id===n.model)?null:y("option",{value:n.model,children:[n.model," (not in the list)"]}),i.map((s)=>p("option",{value:s.id,children:s.id},s.id))]}):p("input",{type:"text",placeholder:r?"e.g. qwen3:8b":"e.g. anthropic/claude-sonnet-5",value:n.model,onChange:(s)=>n.setModel(s.target.value)}),p("button",{type:"button",onClick:()=>void n.loadModels(),disabled:n.modelsState==="loading",children:n.modelsState==="loading"?"asking…":"list models"})]}),n.provider==="openwebui"?null:y(te,{children:[p("label",{"data-tip":r?"off = no thinking (chat template switch), anything else = think first":"reasoning effort sent to the model",children:"thinking"}),y("div",{className:"enh-inline",children:[p("span",{className:"btn-group",children:s9.map((s)=>p("button",{type:"button",className:n.effort===s?"mode sel":"mode",onClick:()=>n.setEffort(s),children:s},s))}),y("label",{className:"row-inline","data-tip":"hide models that report no reasoning support",children:[p("input",{type:"checkbox",checked:n.thinkingOnly,onChange:()=>n.toggleThinkingOnly()}),"thinking models only"]})]})]})]}),n.modelsError!==""?y("div",{className:"error",children:["\uD83D\uDD34 ",n.modelsError]}):null,n.configsError!==""?y("div",{className:"error",children:["\uD83D\uDD34 ",n.configsError]}):null]})}),f9=q(function(t){let n=t.e.preset;return y(cL,{kind:"master prompt",name:n?.name??null,tip:n==null?void 0:`.comfy-ts/prompt-enhancers/${n.name}.md, saved as you type`,onRename:(i)=>void t.e.renamePreset(i),onDuplicate:()=>t.e.duplicatePreset(),onDelete:()=>void t.e.deletePreset(),onClose:()=>t.e.setEditing(null),children:[n==null?p("div",{className:"enh-empty",children:t.e.presetsState==="loading"?"loading…":"no master prompt yet: add one on the left"}):p("textarea",{className:"enh-text enh-master",rows:18,value:n.text,onChange:(i)=>t.e.setPresetText(i.target.value)}),t.e.presetsError!==""?y("div",{className:"error",children:["\uD83D\uDD34 ",t.e.presetsError]}):null]})}),d9=q(function(t){let n=t.e,i=n.phase==="running",r=X(null);J(()=>{let a=r.current;if(a==null)return;a.focus(),a.setSelectionRange(a.value.length,a.value.length)},[]);let o=fL(n),s=(a)=>y("span",{className:"kbd-hint",children:[Ee,vc[a]]}),l=n.result.trim()==="";return y("section",{className:"enh-job",children:[y("div",{className:"enh-actions",children:[i?p("button",{type:"button",className:"enh-big enh-go",onClick:()=>n.cancel(),children:"stop"}):y("button",{type:"button",className:"primary enh-big enh-go",onClick:o.enhance,children:[p(T,{name:"sparkle"})," enhance ",s("enhance")]}),y("button",{type:"button",className:"enh-big","data-tip":"generate the draft with this rewrite in place of the prompt: the prompt itself is not changed",onClick:()=>t.st.generate(n.tryOverride),disabled:l,children:[p(T,{name:"play",size:0.85})," try it ",y("span",{className:"kbd-hint",children:[Ee,"⏎"]})]}),y("button",{type:"button",className:"accent enh-big","data-tip":"write this rewrite into the prompt and close",onClick:o.apply,disabled:l,children:["apply to prompt ",s("apply")]}),p("span",{className:"run-error","data-tip":n.error===""?void 0:n.error,children:n.error===""?"":`\uD83D\uDD34 ${n.error}`})]}),y("div",{className:"enh-label enh-label-row",children:[p("span",{children:"yours, what gets sent (the form is untouched)"}),y("span",{className:"row-inline",children:[p("button",{type:"button",className:"mini","data-tip":"replace this text with the prompt you opened the enhancer from",onClick:()=>n.usePrompt(),children:"use the prompt"}),p(xf,{entries:n.inputHistory,what:"enhance input",onPick:(a)=>n.setOriginal(a.value)})]})]}),p("textarea",{ref:r,className:"enh-text enh-box",value:n.original,onChange:(a)=>n.setOriginal(a.target.value)}),y("div",{className:"enh-label",children:[i?`rewriting… ${n.result.length} chars`:"rewrite, editable before you apply",n.thinking===""?null:y("span",{className:"enh-think-tip","data-tip":n.thinking,children:["· thinking (",n.thinking.length," chars)"]})]}),p("textarea",{className:"enh-text enh-box enh-result",value:n.result,placeholder:"press enhance",onChange:(a)=>n.setResult(a.target.value)})]})});function fL(e){return{enhance:()=>e.phase==="running"?void 0:e.run(),apply:()=>e.apply()}}var h9=q(function(t){let{e:n,st:i}=t;return J(()=>{let r=(o)=>{if(o.key==="Escape"){if(n.editing!=null)n.setEditing(null);else n.close();return}let s=IO(o);if(s==null)return;o.preventDefault(),fL(n)[s]()};return window.addEventListener("keydown",r),()=>window.removeEventListener("keydown",r)},[n,i]),p("div",{className:"modal-overlay top",onClick:()=>n.close(),children:y("div",{className:"modal enh-modal",onClick:(r)=>r.stopPropagation(),children:[y("div",{className:"modal-head",children:[y("b",{className:"enh-title",children:[p(T,{name:"sparkle"})," enhance prompt"]}),p("button",{type:"button",className:"modal-close","data-tip":"close (esc), nothing is applied",onClick:()=>n.close(),children:p(T,{name:"close"})})]}),y("div",{className:"enh-layout",children:[p(u9,{e:n}),y("div",{className:"enh-right",children:[p("div",{className:"modal-body enh-main",children:p(d9,{e:n,st:i})}),n.editing==="llm"?p(c9,{e:n}):null,n.editing==="preset"?p(f9,{e:n}):null]})]})]})})}),ow=q(function(t){let n=t.st.enhancer;return y(te,{children:[y("button",{type:"button",className:t.compact===!0?"link":"mini","data-tip":"rewrite this prompt with an llm",onClick:()=>n.openFor({v:t.v,module:t.module,lane:t.lane}),children:[p(T,{name:"sparkle"}),t.compact===!0?null:" enhance",t.shortcut===!0?y("span",{className:"kbd-hint",children:[Ee,xt["open-enhancer"]]}):null]}),n.target===t.v&&n.targetLane===(t.lane??null)?p(h9,{e:n,st:t.st}):null]})});var dL=q(function(t){let[n,i]=W(null),r=t.st.form,o=r?.loraKeywordGroups(t.v)??[];if(r==null||o.length===0)return null;return p("div",{className:"kw-prefix",children:o.map((s)=>{let l=s.parts.filter((a)=>a.on).length;return y("div",{className:"preset-box kw-box",children:[y("button",{type:"button",className:s.running?"kw-line":"kw-line stopped","aria-expanded":n===s.lora,"data-tip":`${s.lora}
41
41
  ${s.running?"added in front of your prompt at run time":"not running: paused, or its lane is off"}
42
- click to choose the words`,onClick:()=>i(n===s.lora?null:s.lora),children:[p("span",{className:"kw-lora",children:s.label}),p("span",{className:"kw-words",children:s.parts.filter((a)=>a.on).map((a)=>a.text).join(", ")||"no words"}),s.parts.length-l>0?y("span",{className:"kw-off",children:["+",s.parts.length-l," disabled"]}):null]}),n===s.lora?y(ie,{children:[p("div",{className:"preset-backdrop",onClick:()=>i(null)}),y("div",{className:"preset-menu kw-menu",children:[y("div",{className:"row-inline kw-menu-head",children:[p("span",{className:"kw-lora",children:s.label}),p("button",{type:"button",className:"link",onClick:()=>r.setKeywordMute(t.v,s.lora,[]),children:"all"}),p("button",{type:"button",className:"link",onClick:()=>r.setKeywordMute(t.v,s.lora,s.parts.map((a)=>a.text)),children:"none"})]}),s.parts.map((a)=>y("label",{className:"kw-item",children:[p("input",{type:"checkbox",checked:a.on,onChange:()=>r.toggleKeywordPart(t.v,s.lora,a.text)}),p("span",{children:a.text})]},a.text))]})]}):null]},s.lora)})})}),fm="application/x-comfy-lane",KU=q(function(t){let[n,i]=Q(!1),r=t.lanes[t.ix];if(r==null)return null;let o=(s)=>{t.v.set({lanes:s})};return y("div",{className:r.active?"lane-box":"lane-box off",onDragOver:(s)=>{if(s.dataTransfer.types.includes(fm))s.preventDefault()},onDrop:(s)=>{let l=Number(s.dataTransfer.getData(fm));if(s.dataTransfer.getData(fm)===""||!Number.isInteger(l)||l===t.ix)return;s.preventDefault(),o(Kh(t.lanes,l,t.ix-l))},children:[y("div",{className:"lane-bar",children:[n?p("input",{type:"text",className:"lane-name",autoFocus:!0,defaultValue:r.name,onFocus:(s)=>s.currentTarget.select(),onKeyDown:(s)=>{if(s.key==="Enter")o(pi(t.lanes,t.ix,{name:s.currentTarget.value.trim()||r.name})),i(!1);if(s.key==="Escape")i(!1)},onBlur:()=>i(!1)}):p("button",{type:"button",className:r.active?"lane-pill":"lane-pill off",draggable:!0,"data-tip":`${r.active?"in the prompt":"left out"}: click to switch, drag to reorder, double-click to rename`,onDragStart:(s)=>{s.dataTransfer.effectAllowed="move",s.dataTransfer.setData(fm,String(t.ix))},onClick:()=>o(pi(t.lanes,t.ix,{active:!r.active})),onDoubleClick:()=>i(!0),children:r.name}),y("span",{className:"lane-tools",children:[p(Yx,{v:t.v,st:t.st,module:t.module,lane:t.ix,compact:!0,shortcut:t.shortcut}),p(Dc,{tip:"lane actions",children:(s)=>y(ie,{children:[p(rn,{label:"rename",onClick:()=>{s(),i(!0)}}),p(rn,{label:"remove",disabled:t.lanes.length===1,onClick:()=>{s(),o(Fh(t.lanes,t.ix))}})]})})]})]}),p(Gx,{v:t.v,st:t.st,module:t.module,value:r.prompt,onChange:(s)=>o(pi(t.lanes,t.ix,{prompt:s})),minLines:2})]})}),WD=q(function(t){let n=t.v.value;if(Dr(n)){let r=mA(n);return y("div",{children:[p(YD,{v:t.v,st:t.st}),p("div",{className:"lanes",children:n.lanes.map((o,s)=>p(KU,{v:t.v,st:t.st,module:t.module,lanes:n.lanes,ix:s,shortcut:t.jumpTarget===!0&&s===0},s))}),y("div",{className:"row-inline lane-foot",children:[p("button",{type:"button",className:"link",onClick:()=>t.v.set({lanes:[...n.lanes,{name:gc(n.lanes),prompt:"",active:!0}]}),children:"+ lane"}),r==null?null:p("button",{type:"button",className:"link","data-tip":"back to a single prompt box",onClick:()=>t.v.set(r),children:"single box"}),p(gf,{entries:t.st.promptHistory,what:"prompt",onPick:(o)=>t.v.set(o.value)}),p("span",{className:"hint",children:"lanes merge top to bottom"})]})]})}let i=typeof n==="string"?n:"";return y("div",{children:[p(YD,{v:t.v,st:t.st}),p(Gx,{v:t.v,st:t.st,module:t.module,value:i,onChange:(r)=>t.v.set(r),minLines:4}),y("div",{className:"row-inline prompt-actions",children:[p(Nc,{v:t.v}),p(Yx,{v:t.v,st:t.st,module:t.module,shortcut:t.jumpTarget}),p(gf,{entries:t.st.promptHistory,what:"prompt",onPick:(r)=>t.v.set(r.value)}),p("button",{type:"button",className:"mini","data-tip":"split this prompt into named lanes, merged in the order they are listed",onClick:()=>t.v.set(pA(i)),children:"lanes"})]})]})});function QD(e){return{label:"Run",fill:e.isRunning?Math.max(0,Math.min(100,Math.round(e.percent??0))):null,running:e.isRunning}}function JD(e){let t=e.map(()=>null),n=0;while(n<e.length){let i=e[n]?.group;if(i==null){n++;continue}let r=n;while(r+1<e.length&&e[r+1]?.group===i)r++;let o=e.slice(n,r+1).find((s)=>s.groupColor!=null)?.groupColor??null;for(let s=n;s<=r;s++)t[s]={pos:n===r?"solo":s===n?"start":s===r?"end":"mid",color:o};n=r+1}return t}var ZD=q(function(t){let n=X(null),i=typeof t.v.value==="string"?t.v.value:"",r=/^https?:\/\//.test(i)?i:t.v.uploadedUrl,o=t.v.desc.extensions??[],s=async(l)=>{if(l==null)return;try{let a=await QO({file:l});t.v.set(a.path),t.v.setUploadedUrl(a.url)}catch(a){alert(`upload failed: ${a instanceof Error?a.message:String(a)}`)}};return y("div",{children:[y("div",{className:"row-inline",children:[p("input",{type:"text",style:{flex:1},placeholder:"local path or http(s) url",value:i,onChange:(l)=>{t.v.set(l.target.value),t.v.setUploadedUrl(null)}}),p("button",{type:"button",onClick:()=>n.current?.click(),children:"upload…"}),i!==""?p("button",{type:"button","data-tip":"clear the image",onClick:()=>{t.v.set(""),t.v.setUploadedUrl(null)},children:p(B,{name:"close"})}):null,p("input",{ref:n,type:"file",accept:o.map((l)=>`.${l}`).join(","),style:{display:"none"},onChange:(l)=>{s(l.target.files?.[0]),l.target.value=""}})]}),r!=null&&r!==""?p("div",{className:"img-preview",children:p("img",{src:r,alt:i})}):null]})});var Fa="application/x-comfy-lora",Wx="application/x-comfy-lora-lane",FU=q(function(t){let[n,i]=Q(!1),r=t.lanes[t.ix];if(r==null)return null;let o=(s)=>{t.v.set({lanes:s})};return y("div",{className:"lane-bar",onDragOver:(s)=>{let l=s.dataTransfer.types;if(l.includes(Fa)||l.includes(Wx))s.preventDefault()},onDrop:(s)=>{let l=s.dataTransfer.getData(Fa);if(l!==""){s.preventDefault(),t.onDropCard(l);return}let a=s.dataTransfer.getData(Wx),u=Number(a);if(a===""||!Number.isInteger(u)||u===t.ix)return;s.preventDefault(),o(Kh(t.lanes,u,t.ix-u))},children:[n?p("input",{type:"text",className:"lane-name",autoFocus:!0,defaultValue:r.name,onFocus:(s)=>s.currentTarget.select(),onKeyDown:(s)=>{if(s.key==="Enter")o(pi(t.lanes,t.ix,{name:s.currentTarget.value.trim()||r.name})),i(!1);if(s.key==="Escape")i(!1)},onBlur:()=>i(!1)}):p("button",{type:"button",className:r.active?"lane-pill":"lane-pill off",draggable:!0,"data-tip":`${r.active?"runs":"left out"}: click to switch, drag to reorder, double-click to rename`,onDragStart:(s)=>{s.dataTransfer.effectAllowed="move",s.dataTransfer.setData(Wx,String(t.ix))},onClick:()=>o(pi(t.lanes,t.ix,{active:!r.active})),onDoubleClick:()=>i(!0),children:r.name}),t.count===0?null:p("span",{className:"hint",children:`${t.on}/${t.count} on`}),p("span",{className:"lane-tools",children:p(Dc,{tip:"lane actions",children:(s)=>y(ie,{children:[p(rn,{label:"rename",onClick:()=>{s(),i(!0)}}),p(rn,{label:"remove",disabled:t.count>0||t.lanes.length===1,tip:t.count>0?"empty the lane first":void 0,onClick:()=>{s(),o(Fh(t.lanes,t.ix))}})]})})})]})}),eL=q(function(t){let n=ra(()=>({open:!1,filter:"",info:new Map,previewFailed:new Set,paused:new Set,target:-1,openFor(C){this.target=C,this.open=!0},setOpen(C){this.open=C},setFilter(C){this.filter=C},noteInfo(C,z){this.info.set(C,z)},notePreviewFailed(C){this.previewFailed.add(C)},details:null,setDetails(C){this.details=C},split:new Map,isSplit(C,z){return this.split.get(C)??z},setSplit(C,z){this.split.set(C,z)}})),i=Uh(t.v.value)?t.v.value:{},r=hi(i)?i:null,o=t.v.desc.options??[],s=t.v.desc.optionLabels??{},l=(C)=>s[C]??C,a=hi(i)?i.lanes.map((C,z)=>({ix:z,record:C.loras,lane:C})):[{ix:-1,record:i,lane:null}],u=(C)=>FA({record:C.record,options:o}),c=[...new Set(a.flatMap(u))],f=(C,z)=>UA(C.record[z]),d=a.reduce((C,z)=>C+u(z).filter((te)=>f(z,te)).length,0),h=a.find((C)=>C.ix===n.target)??a[0]??null,m=h==null?[]:u(h),b=(C,z)=>{let te=ha(z,o);if(r==null)t.v.set(te);else t.v.set({lanes:pi(r.lanes,C,{loras:te})})},x=new Set(t.v.desc.managerOnlyOptions??[]),g="on disk and known to the lora manager, but not in ComfyUI's list yet: it refuses the prompt. the panel refreshes the host by itself when it changes; if this stays, the models drive is probably exFAT (install extra/comfyui-fresh-model-lists) or ComfyUI needs a restart",v=(C)=>x.has(C)?p("span",{className:"lora-warn","data-tip":"on disk and known to the lora manager, but not in ComfyUI's list yet: it refuses the prompt. the panel refreshes the host by itself when it changes; if this stays, the models drive is probably exFAT (install extra/comfyui-fresh-model-lists) or ComfyUI needs a restart",children:p(B,{name:"warn",size:0.9})}):null,w=t.st.showLoraImages,S=t.v.desc.optionTriggers??{},k=(C)=>{let z=S[C];if(z==null)return p("span",{className:"chip-triggers missing","data-tip":"this lora is newer than the copy of the lora manager's list kept here: the next host refresh brings its trigger words, name and preview (it runs by itself). The lora itself runs fine",children:"trigger words not loaded yet"});if(z.state==="unfetched"){let te=t.st.loraFetching.has(C);return y("span",{className:"chip-triggers missing",children:["trigger words never fetched",p("button",{type:"button",className:"trigger-fetch",disabled:te,"data-tip":"ask the lora manager to fetch this lora's civitai metadata, trigger words included",onClick:()=>void t.st.fetchLoraTriggers(C),children:te?"fetching…":"fetch"})]})}if(z.state==="not-on-civitai"){let te=t.st.loraFetching.has(C);return y("span",{className:"chip-triggers missing","data-tip":"civitai was asked and has no version for this file: a private or local lora, so no trigger words exist there",children:["not on civitai",p("button",{type:"button",className:"trigger-fetch",disabled:te,"data-tip":"ask civitai again (it may have been published since)",onClick:()=>void t.st.fetchLoraTriggers(C),children:te?"asking…":"retry"})]})}if(z.state==="none")return p("span",{className:"chip-triggers none","data-tip":"civitai was asked, and this lora has no trigger words",children:"no trigger words"});return p("span",{className:"chip-triggers words","data-tip":E?z.words.join(`
43
- `):"titles are hidden",children:E?z.words.join(", "):`${z.words.length} trigger word${z.words.length===1?"":"s"}`})},E=t.st.showLoraTitles,_=(C,z,te)=>{let ht={...C.record};if(te==null)delete ht[z];else ht[z]=te;b(C.ix,ht)},O=(C,z,te)=>{b(C.ix,KA(C.record,z,te))},P=(C,z,te)=>{b(C.ix,$A(C.record,z,te))},T=(C,z)=>{let te=jA(C.record[z]),ht=n.isSplit(z,te.model!==te.clip),se=(An,Oi)=>{if(!Number.isFinite(Oi))return;let Ai=Math.round(Oi*100)/100;if(An==="both")return P(C,z,{model:Ai,clip:Ai});P(C,z,An==="model"?{model:Ai,clip:te.clip}:{model:te.model,clip:Ai})},Ue=(An,Oi,Ai,vf)=>y("div",{className:"st-line",children:[p("button",{type:"button",className:"st-label","data-tip":vf,onClick:()=>n.setSplit(z,!ht),children:Ai}),p("input",{type:"range",min:-1,max:2,step:0.05,value:Oi,onChange:(Gs)=>se(An,parseFloat(Gs.target.value))}),p("input",{type:"number",step:0.05,value:Oi,onChange:(Gs)=>se(An,parseFloat(Gs.target.value))})]});if(!ht)return Ue("both",te.model,"m+c","model and clip together — click to set them apart");return y(ie,{children:[Ue("model",te.model,"m","model strength — click to tie them back together"),Ue("clip",te.clip,"c","clip strength — click to tie them back together")]})},I=n.open,V=t.host,Y=c.join(`
44
- `);Z(()=>{if(!I)return;for(let C of Y.split(`
45
- `)){if(C===""||n.info.has(C))continue;n.noteInfo(C,"loading"),u0({host:V,name:C}).then((z)=>n.noteInfo(C,z)).catch(()=>n.noteInfo(C,"error"))}},[I,Y,V,n]);let N=t.st.jump,D=a[0]?.ix??-1;Z(()=>{if(!t.jumpTarget||N==null||N.kind!=="loras")return;n.openFor(D)},[N,t.jumpTarget,D,n]),Z(()=>{if(!I)return;let C=(z)=>{if(z.key==="Escape")n.setOpen(!1)};return window.addEventListener("keydown",C),()=>window.removeEventListener("keydown",C)},[I,n]);let H=n.filter.toLowerCase(),G=(C)=>C.toLowerCase().includes(H)||l(C).toLowerCase().includes(H),L=rR({names:o.filter(G),mode:t.st.loraSort,label:l,addedAt:t.v.desc.optionAddedAt??{}}),ee=t.st.loraCap,{cards:he,enterPick:He}=oR({matches:L,picked:m,cap:ee}),qe=(C)=>{let z=C.split(/[\\/]+/);return z.length<=1?"":z.slice(0,-1).join("/")},dt=(()=>{if(t.st.loraSort!=="folder")return[{folder:null,names:he}];let C=new Map;for(let z of he){let te=qe(z),ht=C.get(te);if(ht==null)C.set(te,[z]);else ht.push(z)}return[...C.entries()].map(([z,te])=>({folder:z,names:te})).sort((z,te)=>z.folder.localeCompare(te.folder))})(),$e=X(null);Z(()=>{if(!I)return;let C=$e.current;if(C==null)return;C.focus(),C.select()},[I]);let Ae=()=>{let C=He;if(C==null)return;if(h!=null)_(h,C,[1,1]);$e.current?.select()},tt=t.st.loraFormScale,St=t.st.loraPopupScale,qa=Math.round(168*tt),Xs=Math.round(120*St),qo=(C,z)=>{if(!w)return null;let te=z==null?void 0:{height:z};return n.previewFailed.has(C)?p("div",{className:"lora-thumb none",style:te,children:"no preview"}):p("img",{style:te,className:t.st.loraFill?"lora-thumb fill":"lora-thumb",loading:"lazy",src:c0({host:t.host,name:C}),alt:l(C),onError:()=>n.notePreviewFailed(C)},C)},Nt=p("span",{className:"paused-mark","aria-label":"paused",children:p(B,{name:"pause",size:2.6})}),Ur=(C,z,te)=>w?p("input",{type:"range",className:"setting-range",min:0.6,max:2,step:0.05,value:z,"data-tip":`lora image size in the ${C} ×${z.toFixed(2)}`,onChange:(ht)=>te(parseFloat(ht.target.value))}):null,$a=y(ie,{children:[p("button",{type:"button",className:w?"mode sel":"mode","data-tip":w?"hide lora images":"show lora images",onClick:()=>t.st.toggleLoraImages(),children:p(B,{name:"image"})}),p("button",{type:"button",className:E?"mode sel":"mode","data-tip":E?"hide lora titles":"show lora titles",onClick:()=>t.st.toggleLoraTitles(),children:p(B,{name:"tag"})}),p("button",{type:"button",className:t.st.showLoraTriggers?"mode sel":"mode","data-tip":t.st.showLoraTriggers?"hide the trigger words":"show the trigger words",onClick:()=>t.st.toggleLoraTriggers(),children:p(B,{name:"text"})}),w?p("button",{type:"button",className:t.st.loraFill?"mode sel":"mode","data-tip":t.st.loraFill?"fit the whole preview inside the card":"fill the card with the preview",onClick:()=>t.st.toggleLoraFill(),children:p(B,{name:t.st.loraFill?"shrink":"expand"})}):null]});return y("div",{children:[y("div",{className:"lora-actions",children:[y("button",{type:"button",className:"field-height accent",onClick:()=>n.openFor(a[0]?.ix??-1),children:[p(B,{name:"plus"})," add"]}),p(Dc,{tip:"display, lora manager, lanes",children:(C)=>y(ie,{children:[p(rn,{label:"images",checked:w,onClick:()=>t.st.toggleLoraImages()}),p(rn,{label:"titles",checked:E,onClick:()=>t.st.toggleLoraTitles()}),p(rn,{label:"fill the card",checked:t.st.loraFill,disabled:!w,onClick:()=>t.st.toggleLoraFill()}),p(rn,{label:"trigger words",checked:t.st.showLoraTriggers,onClick:()=>t.st.toggleLoraTriggers()}),w?y("label",{className:"menu-item menu-range",children:[p("span",{className:"menu-check"}),"size",Ur("form",tt,(z)=>t.st.setLoraFormScale(z))]}):null,p("div",{className:"menu-sep"}),t.hostUrl==null?null:p(rn,{label:"open the lora manager ↗",onClick:()=>{C(),window.open(`${t.hostUrl}/loras`,"_blank","noreferrer")}}),p("div",{className:"menu-sep"}),r==null?p(rn,{label:"split into lanes",onClick:()=>{C(),t.v.set(yA(i))}}):y(ie,{children:[p(rn,{label:"+ lane",onClick:()=>{C(),t.v.set({lanes:[...r.lanes,{name:gc(r.lanes),active:!0,loras:{}}]})}}),p(rn,{label:"back to a single row",disabled:jh(r)==null,tip:jh(r)==null?"only with one active lane: nothing gets merged behind your back":void 0,onClick:()=>{C();let z=jh(r);if(z!=null)t.v.set(z)}})]})]})}),c.length>0?y("span",{className:"hint",children:[c.length," in the palette · ",d," on"]}):null]}),y("div",{className:"lora-lanes",children:[!w&&!E?y("span",{className:"hint",children:[c.length," lora",c.length===1?"":"s"," in the palette"]}):a.map((C)=>{let z=u(C),te=(se,Ue)=>{let[An,Oi]=se.split(`
46
- `),Ai=Number(An);if(Oi==null||!Number.isInteger(Ai)||Oi===Ue)return;if(Ai===C.ix){let vf=Ue==null?z.length-1:z.indexOf(Ue),Gs=z.indexOf(Oi);if(Gs===-1||vf===-1)return;b(C.ix,qA({record:C.record,displayed:z,from:Gs,to:vf}))}else if(r!=null)t.v.set(SA(r,{from:Ai,name:Oi,to:C.ix,beforeName:Ue??void 0}))},ht=(se)=>{if(se.dataTransfer.types.includes(Fa))se.preventDefault()};return y("div",{className:`lora-section${C.lane==null?"":" laned"}${C.lane==null||C.lane.active?"":" off"}`,children:[C.lane==null||r==null?null:p(FU,{v:t.v,lanes:r.lanes,ix:C.ix,count:z.length,on:z.filter((se)=>f(C,se)).length,onDropCard:(se)=>te(se,null)}),y("div",{className:"row-inline lora-lane",children:[z.map((se)=>y("span",{className:`${w?"lora-chip card":"lora-chip"}${f(C,se)?"":" off"}`,style:w?{width:qa}:void 0,draggable:!0,onMouseDown:(Ue)=>{let An=Ue.target;Ue.currentTarget.draggable=An.closest("input, label, button, select, a")==null},onMouseUp:(Ue)=>{Ue.currentTarget.draggable=!0},onDragStart:(Ue)=>{Ue.dataTransfer.effectAllowed="move",Ue.dataTransfer.setData(Fa,`${C.ix}
47
- ${se}`)},onDragOver:ht,onDrop:(Ue)=>{let An=Ue.dataTransfer.getData(Fa);if(An==="")return;Ue.preventDefault(),te(An,se)},children:[y("span",{className:"chip-media",children:[y("button",{type:"button",className:"lora-toggle","data-tip":`${se}
48
- click to ${f(C,se)?"pause":"resume"}, click the title for details`,onClick:()=>O(C,se,!f(C,se)),children:[qo(se,Math.round(130*tt)),w&&!f(C,se)?Nt:null]}),p("button",{type:"button",className:"chip-remove","data-tip":"remove from the palette (the popup adds it back)",onClick:()=>_(C,se,null),children:p(B,{name:"close",size:1.35})})]}),y("span",{className:"chip-head",children:[y("label",{className:"switch","data-tip":f(C,se)?"pause this lora":"resume this lora",children:[p("input",{type:"checkbox",checked:f(C,se),onChange:(Ue)=>O(C,se,Ue.target.checked)}),p("span",{className:"track"})]}),E?p("button",{type:"button",className:"chip-title as-text","data-tip":`${se}
49
- click for its details`,onClick:()=>n.setDetails(se),children:l(se)}):null,v(se)]}),p("span",{className:"chip-controls",children:T(C,se)}),t.st.showLoraTriggers?k(se):null]},se)),C.lane==null?null:p("button",{type:"button",className:"lora-add-card","data-tip":`add loras to ${C.lane.name}`,onDragOver:ht,onDrop:(se)=>{let Ue=se.dataTransfer.getData(Fa);if(Ue==="")return;se.preventDefault(),te(Ue,null)},onClick:()=>n.openFor(C.ix),children:p(B,{name:"plus"})})]})]},C.ix)}),r==null?null:y("div",{className:"row-inline",children:[y("button",{type:"button",onClick:()=>t.v.set({lanes:[...r.lanes,{name:gc(r.lanes),active:!0,loras:{}}]}),children:[p(B,{name:"plus"})," lane"]}),p("span",{className:"hint",children:"lanes merge top to bottom · drag a card onto another lane to move it"})]})]}),n.details==null?null:p(qU,{name:n.details,host:t.host,hostUrl:t.hostUrl,label:l(n.details),showImage:w,keyword:(t.v.desc.optionKeywords??{})[n.details]??null,managerOnly:x.has(n.details),onClose:()=>n.setDetails(null)}),n.open?p("div",{className:"modal-overlay top",onClick:()=>n.setOpen(!1),children:y("div",{className:"modal loras-modal",onClick:(C)=>C.stopPropagation(),children:[y("div",{className:"modal-head",children:[p("span",{className:"btn-group",children:$a}),Ur("popup",St,(C)=>t.st.setLoraPopupScale(C)),p("input",{ref:$e,type:"text",placeholder:`search ${o.length} loras, enter adds the first`,value:n.filter,onChange:(C)=>n.setFilter(C.target.value),onKeyDown:(C)=>{if(C.key!=="Enter")return;C.preventDefault(),Ae()}}),p("button",{type:"button",className:"modal-close","data-tip":"close (esc)",onClick:()=>n.setOpen(!1),children:p(B,{name:"close"})})]}),y("div",{className:"loras-split",children:[p("div",{className:"modal-body loras-palette",children:h==null||m.length===0?p("div",{className:"hint",children:"nothing picked yet: tap a lora to add it"}):y("div",{children:[y("div",{className:"section-title",children:[h.lane==null?"your palette":`lane ${h.lane.name}`," (",m.length,")"]}),m.map((C)=>{let z=n.info.get(C);return y("div",{className:f(h,C)?"lora-active-row":"lora-active-row off",children:[qo(C),y("div",{className:"lora-active-text",children:[p("div",{className:"lora-label","data-tip":C,children:E?l(C):"···"}),t.st.showLoraTriggers&&typeof z==="object"&&z.triggerWords.length>0?p("div",{className:"hint",children:z.triggerWords.join(", ")}):p("div",{className:"hint",children:C})]}),p("input",{type:"checkbox",checked:f(h,C),"data-tip":f(h,C)?"pause (stays in the palette)":"resume",onChange:(te)=>O(h,C,te.target.checked)}),T(h,C),p("button",{type:"button",className:"chip-remove","data-tip":"remove from the list",onClick:()=>_(h,C,null),children:p(B,{name:"close",size:1.2})})]},C)})]})}),y("div",{className:"modal-body loras-gallery",children:[y("div",{className:"section-title lora-sort-head",children:["all loras — tap to add or take out",y("span",{className:"lora-sort",children:["sort",nR.map((C)=>p("button",{type:"button",className:t.st.loraSort===C.mode?"mode sel":"mode","data-tip":C.tip,onClick:()=>t.st.setLoraSort(C.mode),children:C.label},C.mode))]})]}),dt.map((C)=>y("div",{children:[C.folder==null?null:y("div",{className:"section-title",children:[C.folder===""?"loose (no folder)":`${C.folder}/`," ·"," ",C.names.length]}),p("div",{className:"lora-grid",style:{gridTemplateColumns:`repeat(auto-fill, minmax(${Xs}px, 1fr))`},children:C.names.map((z)=>{let te=m.includes(z),ht=h!=null&&f(h,z),se=sR({picked:te,on:ht});return y("div",{className:!te?"lora-card":ht?"lora-card picked":"lora-card picked off",children:[y("button",{type:"button",className:"lora-card-hit","data-tip":se==="add"?`${z}
42
+ click to choose the words`,onClick:()=>i(n===s.lora?null:s.lora),children:[p("span",{className:"kw-lora",children:s.label}),p("span",{className:"kw-words",children:s.parts.filter((a)=>a.on).map((a)=>a.text).join(", ")||"no words"}),s.parts.length-l>0?y("span",{className:"kw-off",children:["+",s.parts.length-l," disabled"]}):null]}),n===s.lora?y(te,{children:[p("div",{className:"preset-backdrop",onClick:()=>i(null)}),y("div",{className:"preset-menu kw-menu",children:[y("div",{className:"row-inline kw-menu-head",children:[p("span",{className:"kw-lora",children:s.label}),p("button",{type:"button",className:"link",onClick:()=>r.setKeywordMute(t.v,s.lora,[]),children:"all"}),p("button",{type:"button",className:"link",onClick:()=>r.setKeywordMute(t.v,s.lora,s.parts.map((a)=>a.text)),children:"none"})]}),s.parts.map((a)=>y("label",{className:"kw-item",children:[p("input",{type:"checkbox",checked:a.on,onChange:()=>r.toggleKeywordPart(t.v,s.lora,a.text)}),p("span",{children:a.text})]},a.text))]})]}):null]},s.lora)})})}),vm="application/x-comfy-lane",p9=q(function(t){let[n,i]=W(!1),r=t.lanes[t.ix];if(r==null)return null;let o=(s)=>{t.v.set({lanes:s})};return y("div",{className:r.active?"lane-box":"lane-box off",onDragOver:(s)=>{if(s.dataTransfer.types.includes(vm))s.preventDefault()},onDrop:(s)=>{let l=Number(s.dataTransfer.getData(vm));if(s.dataTransfer.getData(vm)===""||!Number.isInteger(l)||l===t.ix)return;s.preventDefault(),o(Gh(t.lanes,l,t.ix-l))},children:[y("div",{className:"lane-bar",children:[n?p("input",{type:"text",className:"lane-name",autoFocus:!0,defaultValue:r.name,onFocus:(s)=>s.currentTarget.select(),onKeyDown:(s)=>{if(s.key==="Enter")o(pi(t.lanes,t.ix,{name:s.currentTarget.value.trim()||r.name})),i(!1);if(s.key==="Escape")i(!1)},onBlur:()=>i(!1)}):p("button",{type:"button",className:r.active?"lane-pill":"lane-pill off",draggable:!0,"data-tip":`${r.active?"in the prompt":"left out"}: click to switch, drag to reorder, double-click to rename`,onDragStart:(s)=>{s.dataTransfer.effectAllowed="move",s.dataTransfer.setData(vm,String(t.ix))},onClick:()=>o(pi(t.lanes,t.ix,{active:!r.active})),onDoubleClick:()=>i(!0),children:r.name}),y("span",{className:"lane-tools",children:[p(ow,{v:t.v,st:t.st,module:t.module,lane:t.ix,compact:!0,shortcut:t.shortcut}),p(Pc,{tip:"lane actions",children:(s)=>y(te,{children:[p(rn,{label:"rename",onClick:()=>{s(),i(!0)}}),p(rn,{label:"remove",disabled:t.lanes.length===1,onClick:()=>{s(),o(Yh(t.lanes,t.ix))}})]})})]})]}),p(rw,{v:t.v,st:t.st,module:t.module,value:r.prompt,onChange:(s)=>o(pi(t.lanes,t.ix,{prompt:s})),minLines:2})]})}),hL=q(function(t){let n=t.v.value;if(Dr(n)){let r=ER(n);return y("div",{children:[p(dL,{v:t.v,st:t.st}),p("div",{className:"lanes",children:n.lanes.map((o,s)=>p(p9,{v:t.v,st:t.st,module:t.module,lanes:n.lanes,ix:s,shortcut:t.jumpTarget===!0&&s===0},s))}),y("div",{className:"row-inline lane-foot",children:[p("button",{type:"button",className:"link",onClick:()=>t.v.set({lanes:[...n.lanes,{name:kc(n.lanes),prompt:"",active:!0}]}),children:"+ lane"}),r==null?null:p("button",{type:"button",className:"link","data-tip":"back to a single prompt box",onClick:()=>t.v.set(r),children:"single box"}),p(xf,{entries:t.st.promptHistory,what:"prompt",onPick:(o)=>t.v.set(o.value)}),p("span",{className:"hint",children:"lanes merge top to bottom"})]})]})}let i=typeof n==="string"?n:"";return y("div",{children:[p(dL,{v:t.v,st:t.st}),p(rw,{v:t.v,st:t.st,module:t.module,value:i,onChange:(r)=>t.v.set(r),minLines:4}),y("div",{className:"row-inline prompt-actions",children:[p(Bc,{v:t.v}),p(ow,{v:t.v,st:t.st,module:t.module,shortcut:t.jumpTarget}),p(xf,{entries:t.st.promptHistory,what:"prompt",onPick:(r)=>t.v.set(r.value)}),p("button",{type:"button",className:"mini","data-tip":"split this prompt into named lanes, merged in the order they are listed",onClick:()=>t.v.set(CR(i)),children:"lanes"})]})]})});function pL(e){return{label:"Run",fill:e.isRunning?Math.max(0,Math.min(100,Math.round(e.percent??0))):null,running:e.isRunning}}function mL(e){let t=e.map(()=>null),n=0;while(n<e.length){let i=e[n]?.group;if(i==null){n++;continue}let r=n;while(r+1<e.length&&e[r+1]?.group===i)r++;let o=e.slice(n,r+1).find((s)=>s.groupColor!=null)?.groupColor??null;for(let s=n;s<=r;s++)t[s]={pos:n===r?"solo":s===n?"start":s===r?"end":"mid",color:o};n=r+1}return t}var gL=q(function(t){let n=X(null),i=typeof t.v.value==="string"?t.v.value:"",r=/^https?:\/\//.test(i)?i:t.v.uploadedUrl,o=t.v.desc.extensions??[],s=async(l)=>{if(l==null)return;try{let a=await aR({file:l});t.v.set(a.path),t.v.setUploadedUrl(a.url)}catch(a){alert(`upload failed: ${a instanceof Error?a.message:String(a)}`)}};return y("div",{children:[y("div",{className:"row-inline",children:[p("input",{type:"text",style:{flex:1},placeholder:"local path or http(s) url",value:i,onChange:(l)=>{t.v.set(l.target.value),t.v.setUploadedUrl(null)}}),p("button",{type:"button",onClick:()=>n.current?.click(),children:"upload…"}),i!==""?p("button",{type:"button","data-tip":"clear the image",onClick:()=>{t.v.set(""),t.v.setUploadedUrl(null)},children:p(T,{name:"close"})}):null,p("input",{ref:n,type:"file",accept:o.map((l)=>`.${l}`).join(","),style:{display:"none"},onChange:(l)=>{s(l.target.files?.[0]),l.target.value=""}})]}),r!=null&&r!==""?p("div",{className:"img-preview",children:p("img",{src:r,alt:i})}):null]})});var Wa="application/x-comfy-lora",sw="application/x-comfy-lora-lane",m9=q(function(t){let[n,i]=W(!1),r=t.lanes[t.ix];if(r==null)return null;let o=(s)=>{t.v.set({lanes:s})};return y("div",{className:"lane-bar",onDragOver:(s)=>{let l=s.dataTransfer.types;if(l.includes(Wa)||l.includes(sw))s.preventDefault()},onDrop:(s)=>{let l=s.dataTransfer.getData(Wa);if(l!==""){s.preventDefault(),t.onDropCard(l);return}let a=s.dataTransfer.getData(sw),u=Number(a);if(a===""||!Number.isInteger(u)||u===t.ix)return;s.preventDefault(),o(Gh(t.lanes,u,t.ix-u))},children:[n?p("input",{type:"text",className:"lane-name",autoFocus:!0,defaultValue:r.name,onFocus:(s)=>s.currentTarget.select(),onKeyDown:(s)=>{if(s.key==="Enter")o(pi(t.lanes,t.ix,{name:s.currentTarget.value.trim()||r.name})),i(!1);if(s.key==="Escape")i(!1)},onBlur:()=>i(!1)}):p("button",{type:"button",className:r.active?"lane-pill":"lane-pill off",draggable:!0,"data-tip":`${r.active?"runs":"left out"}: click to switch, drag to reorder, double-click to rename`,onDragStart:(s)=>{s.dataTransfer.effectAllowed="move",s.dataTransfer.setData(sw,String(t.ix))},onClick:()=>o(pi(t.lanes,t.ix,{active:!r.active})),onDoubleClick:()=>i(!0),children:r.name}),t.count===0?null:p("span",{className:"hint",children:`${t.on}/${t.count} on`}),p("span",{className:"lane-tools",children:p(Pc,{tip:"lane actions",children:(s)=>y(te,{children:[p(rn,{label:"rename",onClick:()=>{s(),i(!0)}}),p(rn,{label:"remove",disabled:t.count>0||t.lanes.length===1,tip:t.count>0?"empty the lane first":void 0,onClick:()=>{s(),o(Yh(t.lanes,t.ix))}})]})})})]})}),vL=q(function(t){let n=ua(()=>({open:!1,filter:"",info:new Map,previewFailed:new Set,paused:new Set,target:-1,openFor(C){this.target=C,this.open=!0},setOpen(C){this.open=C},setFilter(C){this.filter=C},noteInfo(C,z){this.info.set(C,z)},notePreviewFailed(C){this.previewFailed.add(C)},details:null,setDetails(C){this.details=C},split:new Map,isSplit(C,z){return this.split.get(C)??z},setSplit(C,z){this.split.set(C,z)}})),i=$h(t.v.value)?t.v.value:{},r=hi(i)?i:null,o=t.v.desc.options??[],s=t.v.desc.optionLabels??{},l=(C)=>s[C]??C,a=hi(i)?i.lanes.map((C,z)=>({ix:z,record:C.loras,lane:C})):[{ix:-1,record:i,lane:null}],u=(C)=>tA({record:C.record,options:o}),c=[...new Set(a.flatMap(u))],f=(C,z)=>JR(C.record[z]),d=a.reduce((C,z)=>C+u(z).filter((ne)=>f(z,ne)).length,0),h=a.find((C)=>C.ix===n.target)??a[0]??null,m=h==null?[]:u(h),b=(C,z)=>{let ne=ba(z,o);if(r==null)t.v.set(ne);else t.v.set({lanes:pi(r.lanes,C,{loras:ne})})},x=new Set(t.v.desc.managerOnlyOptions??[]),g="on disk and known to the lora manager, but not in ComfyUI's list yet: it refuses the prompt. the panel refreshes the host by itself when it changes; if this stays, the models drive is probably exFAT (install extra/comfyui-fresh-model-lists) or ComfyUI needs a restart",v=(C)=>x.has(C)?p("span",{className:"lora-warn","data-tip":"on disk and known to the lora manager, but not in ComfyUI's list yet: it refuses the prompt. the panel refreshes the host by itself when it changes; if this stays, the models drive is probably exFAT (install extra/comfyui-fresh-model-lists) or ComfyUI needs a restart",children:p(T,{name:"warn",size:0.9})}):null,w=t.st.showLoraImages,S=t.v.desc.optionTriggers??{},k=(C)=>{let z=S[C];if(z==null)return p("span",{className:"chip-triggers missing","data-tip":"this lora is newer than the copy of the lora manager's list kept here: the next host refresh brings its trigger words, name and preview (it runs by itself). The lora itself runs fine",children:"trigger words not loaded yet"});if(z.state==="unfetched"){let ne=t.st.loraFetching.has(C);return y("span",{className:"chip-triggers missing",children:["trigger words never fetched",p("button",{type:"button",className:"trigger-fetch",disabled:ne,"data-tip":"ask the lora manager to fetch this lora's civitai metadata, trigger words included",onClick:()=>void t.st.fetchLoraTriggers(C),children:ne?"fetching…":"fetch"})]})}if(z.state==="not-on-civitai"){let ne=t.st.loraFetching.has(C);return y("span",{className:"chip-triggers missing","data-tip":"civitai was asked and has no version for this file: a private or local lora, so no trigger words exist there",children:["not on civitai",p("button",{type:"button",className:"trigger-fetch",disabled:ne,"data-tip":"ask civitai again (it may have been published since)",onClick:()=>void t.st.fetchLoraTriggers(C),children:ne?"asking…":"retry"})]})}if(z.state==="none")return p("span",{className:"chip-triggers none","data-tip":"civitai was asked, and this lora has no trigger words",children:"no trigger words"});return p("span",{className:"chip-triggers words","data-tip":E?z.words.join(`
43
+ `):"titles are hidden",children:E?z.words.join(", "):`${z.words.length} trigger word${z.words.length===1?"":"s"}`})},E=t.st.showLoraTitles,_=(C,z,ne)=>{let pt={...C.record};if(ne==null)delete pt[z];else pt[z]=ne;b(C.ix,pt)},O=(C,z,ne)=>{b(C.ix,eA(C.record,z,ne))},B=(C,z,ne)=>{b(C.ix,iA(C.record,z,ne))},M=(C,z)=>{let ne=ZR(C.record[z]),pt=n.isSplit(z,ne.model!==ne.clip),se=(Rn,Oi)=>{if(!Number.isFinite(Oi))return;let Ri=Math.round(Oi*100)/100;if(Rn==="both")return B(C,z,{model:Ri,clip:Ri});B(C,z,Rn==="model"?{model:Ri,clip:ne.clip}:{model:ne.model,clip:Ri})},Ue=(Rn,Oi,Ri,wf)=>y("div",{className:"st-line",children:[p("button",{type:"button",className:"st-label","data-tip":wf,onClick:()=>n.setSplit(z,!pt),children:Ri}),p("input",{type:"range",min:0,max:1,step:0.05,value:Oi,onChange:(Zs)=>se(Rn,parseFloat(Zs.target.value))}),p("input",{type:"number",step:0.05,value:Oi,onChange:(Zs)=>se(Rn,parseFloat(Zs.target.value))})]});if(!pt)return Ue("both",ne.model,"m+c","model and clip together — click to set them apart");return y(te,{children:[Ue("model",ne.model,"m","model strength — click to tie them back together"),Ue("clip",ne.clip,"c","clip strength — click to tie them back together")]})},I=n.open,H=t.host,Y=c.join(`
44
+ `);J(()=>{if(!I)return;for(let C of Y.split(`
45
+ `)){if(C===""||n.info.has(C))continue;n.noteInfo(C,"loading"),my({host:H,name:C}).then((z)=>n.noteInfo(C,z)).catch(()=>n.noteInfo(C,"error"))}},[I,Y,H,n]);let D=t.st.jump,L=a[0]?.ix??-1,V=X(D?.seq??0);J(()=>{if(!t.jumpTarget||!Uh(D,"loras",V.current))return;V.current=D?.seq??0,n.openFor(L)},[D,t.jumpTarget,L,n]),J(()=>{if(!I)return;let C=(z)=>{if(z.key==="Escape")n.setOpen(!1)};return window.addEventListener("keydown",C),()=>window.removeEventListener("keydown",C)},[I,n]);let G=n.filter.toLowerCase(),P=(C)=>C.toLowerCase().includes(G)||l(C).toLowerCase().includes(G),ee=yA({names:o.filter(P),mode:t.st.loraSort,label:l,addedAt:t.v.desc.optionAddedAt??{}}),fe=t.st.loraCap,{cards:De,enterPick:qe}=xA({matches:ee,picked:m,cap:fe}),ht=(C)=>{let z=C.split(/[\\/]+/);return z.length<=1?"":z.slice(0,-1).join("/")},et=(()=>{if(t.st.loraSort!=="folder")return[{folder:null,names:De}];let C=new Map;for(let z of De){let ne=ht(z),pt=C.get(ne);if(pt==null)C.set(ne,[z]);else pt.push(z)}return[...C.entries()].map(([z,ne])=>({folder:z,names:ne})).sort((z,ne)=>z.folder.localeCompare(ne.folder))})(),Se=X(null);J(()=>{if(!I)return;let C=Se.current;if(C==null)return;C.focus(),C.select()},[I]);let ct=()=>{let C=qe;if(C==null)return;if(h!=null)_(h,C,[1,1]);Se.current?.select()},_t=t.st.loraFormScale,Xo=t.st.loraPopupScale,Qs=Math.round(168*_t),Qa=Math.round(120*Xo),Ct=(C,z)=>{if(!w)return null;let ne=z==null?void 0:{height:z};return n.previewFailed.has(C)?p("div",{className:"lora-thumb none",style:ne,children:"no preview"}):p("img",{style:ne,className:t.st.loraFill?"lora-thumb fill":"lora-thumb",loading:"lazy",src:gy({host:t.host,name:C}),alt:l(C),onError:()=>n.notePreviewFailed(C)},C)},Ur=p("span",{className:"paused-mark","aria-label":"paused",children:p(T,{name:"pause",size:2.6})}),Js=(C,z,ne)=>w?p("input",{type:"range",className:"setting-range",min:0.6,max:2,step:0.05,value:z,"data-tip":`lora image size in the ${C} ×${z.toFixed(2)}`,onChange:(pt)=>ne(parseFloat(pt.target.value))}):null,Ja=y(te,{children:[p("button",{type:"button",className:w?"mode sel":"mode","data-tip":w?"hide lora images":"show lora images",onClick:()=>t.st.toggleLoraImages(),children:p(T,{name:"image"})}),p("button",{type:"button",className:E?"mode sel":"mode","data-tip":E?"hide lora titles":"show lora titles",onClick:()=>t.st.toggleLoraTitles(),children:p(T,{name:"tag"})}),p("button",{type:"button",className:t.st.showLoraTriggers?"mode sel":"mode","data-tip":t.st.showLoraTriggers?"hide the trigger words":"show the trigger words",onClick:()=>t.st.toggleLoraTriggers(),children:p(T,{name:"text"})}),w?p("button",{type:"button",className:t.st.loraFill?"mode sel":"mode","data-tip":t.st.loraFill?"fit the whole preview inside the card":"fill the card with the preview",onClick:()=>t.st.toggleLoraFill(),children:p(T,{name:t.st.loraFill?"shrink":"expand"})}):null]});return y("div",{children:[y("div",{className:"lora-actions",children:[y("button",{type:"button",className:"field-height accent",onClick:()=>n.openFor(a[0]?.ix??-1),children:[p(T,{name:"plus"})," add"]}),p(Pc,{tip:"display, lora manager, lanes",children:(C)=>y(te,{children:[p(rn,{label:"images",checked:w,onClick:()=>t.st.toggleLoraImages()}),p(rn,{label:"titles",checked:E,onClick:()=>t.st.toggleLoraTitles()}),p(rn,{label:"fill the card",checked:t.st.loraFill,disabled:!w,onClick:()=>t.st.toggleLoraFill()}),p(rn,{label:"trigger words",checked:t.st.showLoraTriggers,onClick:()=>t.st.toggleLoraTriggers()}),w?y("label",{className:"menu-item menu-range",children:[p("span",{className:"menu-check"}),"size",Js("form",_t,(z)=>t.st.setLoraFormScale(z))]}):null,p("div",{className:"menu-sep"}),t.hostUrl==null?null:p(rn,{label:"open the lora manager ↗",onClick:()=>{C(),window.open(`${t.hostUrl}/loras`,"_blank","noreferrer")}}),p("div",{className:"menu-sep"}),r==null?p(rn,{label:"split into lanes",onClick:()=>{C(),t.v.set(TR(i))}}):y(te,{children:[p(rn,{label:"+ lane",onClick:()=>{C(),t.v.set({lanes:[...r.lanes,{name:kc(r.lanes),active:!0,loras:{}}]})}}),p(rn,{label:"back to a single row",disabled:Xh(r)==null,tip:Xh(r)==null?"only with one active lane: nothing gets merged behind your back":void 0,onClick:()=>{C();let z=Xh(r);if(z!=null)t.v.set(z)}})]})]})}),c.length>0?y("span",{className:"hint",children:[c.length," in the palette · ",d," on"]}):null]}),y("div",{className:"lora-lanes",children:[!w&&!E?y("span",{className:"hint",children:[c.length," lora",c.length===1?"":"s"," in the palette"]}):a.map((C)=>{let z=u(C),ne=(se,Ue)=>{let[Rn,Oi]=se.split(`
46
+ `),Ri=Number(Rn);if(Oi==null||!Number.isInteger(Ri)||Oi===Ue)return;if(Ri===C.ix){let wf=Ue==null?z.length-1:z.indexOf(Ue),Zs=z.indexOf(Oi);if(Zs===-1||wf===-1)return;b(C.ix,nA({record:C.record,displayed:z,from:Zs,to:wf}))}else if(r!=null)t.v.set(DR(r,{from:Ri,name:Oi,to:C.ix,beforeName:Ue??void 0}))},pt=(se)=>{if(se.dataTransfer.types.includes(Wa))se.preventDefault()};return y("div",{className:`lora-section${C.lane==null?"":" laned"}${C.lane==null||C.lane.active?"":" off"}`,children:[C.lane==null||r==null?null:p(m9,{v:t.v,lanes:r.lanes,ix:C.ix,count:z.length,on:z.filter((se)=>f(C,se)).length,onDropCard:(se)=>ne(se,null)}),y("div",{className:"row-inline lora-lane",children:[z.map((se)=>y("span",{className:`${w?"lora-chip card":"lora-chip"}${f(C,se)?"":" off"}`,style:w?{width:Qs}:void 0,draggable:!0,onMouseDown:(Ue)=>{let Rn=Ue.target;Ue.currentTarget.draggable=Rn.closest("input, label, button, select, a")==null},onMouseUp:(Ue)=>{Ue.currentTarget.draggable=!0},onDragStart:(Ue)=>{Ue.dataTransfer.effectAllowed="move",Ue.dataTransfer.setData(Wa,`${C.ix}
47
+ ${se}`)},onDragOver:pt,onDrop:(Ue)=>{let Rn=Ue.dataTransfer.getData(Wa);if(Rn==="")return;Ue.preventDefault(),ne(Rn,se)},children:[y("span",{className:"chip-media",children:[y("button",{type:"button",className:"lora-toggle","data-tip":`${se}
48
+ click to ${f(C,se)?"pause":"resume"}, click the title for details`,onClick:()=>O(C,se,!f(C,se)),children:[Ct(se,Math.round(130*_t)),w&&!f(C,se)?Ur:null]}),p("button",{type:"button",className:"chip-remove","data-tip":"remove from the palette (the popup adds it back)",onClick:()=>_(C,se,null),children:p(T,{name:"close",size:1.35})})]}),y("span",{className:"chip-head",children:[y("label",{className:"switch","data-tip":f(C,se)?"pause this lora":"resume this lora",children:[p("input",{type:"checkbox",checked:f(C,se),onChange:(Ue)=>O(C,se,Ue.target.checked)}),p("span",{className:"track"})]}),E?p("button",{type:"button",className:"chip-title as-text","data-tip":`${se}
49
+ click for its details`,onClick:()=>n.setDetails(se),children:l(se)}):null,v(se)]}),p("span",{className:"chip-controls",children:M(C,se)}),t.st.showLoraTriggers?k(se):null]},se)),C.lane==null?null:p("button",{type:"button",className:"lora-add-card","data-tip":`add loras to ${C.lane.name}`,onDragOver:pt,onDrop:(se)=>{let Ue=se.dataTransfer.getData(Wa);if(Ue==="")return;se.preventDefault(),ne(Ue,null)},onClick:()=>n.openFor(C.ix),children:p(T,{name:"plus"})})]})]},C.ix)}),r==null?null:y("div",{className:"row-inline",children:[y("button",{type:"button",onClick:()=>t.v.set({lanes:[...r.lanes,{name:kc(r.lanes),active:!0,loras:{}}]}),children:[p(T,{name:"plus"})," lane"]}),p("span",{className:"hint",children:"lanes merge top to bottom · drag a card onto another lane to move it"})]})]}),n.details==null?null:p(g9,{name:n.details,host:t.host,hostUrl:t.hostUrl,label:l(n.details),showImage:w,keyword:(t.v.desc.optionKeywords??{})[n.details]??null,managerOnly:x.has(n.details),onClose:()=>n.setDetails(null)}),n.open?p("div",{className:"modal-overlay top",onClick:()=>n.setOpen(!1),children:y("div",{className:"modal loras-modal",onClick:(C)=>C.stopPropagation(),children:[y("div",{className:"modal-head",children:[p("span",{className:"btn-group",children:Ja}),Js("popup",Xo,(C)=>t.st.setLoraPopupScale(C)),p("input",{ref:Se,type:"text",placeholder:`search ${o.length} loras, enter adds the first`,value:n.filter,onChange:(C)=>n.setFilter(C.target.value),onKeyDown:(C)=>{if(C.key!=="Enter")return;C.preventDefault(),ct()}}),p("button",{type:"button",className:"modal-close","data-tip":"close (esc)",onClick:()=>n.setOpen(!1),children:p(T,{name:"close"})})]}),y("div",{className:"loras-split",children:[p("div",{className:"modal-body loras-palette",children:h==null||m.length===0?p("div",{className:"hint",children:"nothing picked yet: tap a lora to add it"}):y("div",{children:[y("div",{className:"section-title",children:[h.lane==null?"your palette":`lane ${h.lane.name}`," (",m.length,")"]}),m.map((C)=>{let z=n.info.get(C);return y("div",{className:f(h,C)?"lora-active-row":"lora-active-row off",children:[Ct(C),y("div",{className:"lora-active-text",children:[p("div",{className:"lora-label","data-tip":C,children:E?l(C):"···"}),t.st.showLoraTriggers&&typeof z==="object"&&z.triggerWords.length>0?p("div",{className:"hint",children:z.triggerWords.join(", ")}):p("div",{className:"hint",children:C})]}),p("input",{type:"checkbox",checked:f(h,C),"data-tip":f(h,C)?"pause (stays in the palette)":"resume",onChange:(ne)=>O(h,C,ne.target.checked)}),M(h,C),p("button",{type:"button",className:"chip-remove","data-tip":"remove from the list",onClick:()=>_(h,C,null),children:p(T,{name:"close",size:1.2})})]},C)})]})}),y("div",{className:"modal-body loras-gallery",children:[y("div",{className:"section-title lora-sort-head",children:["all loras — tap to add or take out",y("span",{className:"lora-sort",children:["sort",vA.map((C)=>p("button",{type:"button",className:t.st.loraSort===C.mode?"mode sel":"mode","data-tip":C.tip,onClick:()=>t.st.setLoraSort(C.mode),children:C.label},C.mode))]})]}),et.map((C)=>y("div",{children:[C.folder==null?null:y("div",{className:"section-title",children:[C.folder===""?"loose (no folder)":`${C.folder}/`," ·"," ",C.names.length]}),p("div",{className:"lora-grid",style:{gridTemplateColumns:`repeat(auto-fill, minmax(${Qa}px, 1fr))`},children:C.names.map((z)=>{let ne=m.includes(z),pt=h!=null&&f(h,z),se=wA({picked:ne,on:pt});return y("div",{className:!ne?"lora-card":pt?"lora-card picked":"lora-card picked off",children:[y("button",{type:"button",className:"lora-card-hit","data-tip":se==="add"?`${z}
50
50
  click to add`:`${z}
51
- click to ${se}`,onClick:()=>{if(h==null)return;if(se==="add")_(h,z,[1,1]);else O(h,z,se==="resume")},children:[y("span",{className:"thumb-box",children:[qo(z,Math.round(110*St)),w&&te&&!ht?Nt:null]}),y("div",{className:"lora-label",children:[E?l(z):z.slice(0,2)+"···",v(z)]})]}),te&&h!=null?p("button",{type:"button",className:"chip-remove","data-tip":"remove from the palette",onClick:()=>_(h,z,null),children:p(B,{name:"close",size:1.35})}):null]},z)})})]},C.folder??"*")),L.length>ee?y("div",{className:"loras-more",children:["… ",L.length-ee," more — refine the filter, or draw",p("input",{type:"number",min:1,max:2000,value:ee,"data-tip":"how many cards this popup draws — each one is an image request, so the right number depends on your collection and your box. Kept in this browser",onChange:(C)=>{let z=parseInt(C.target.value,10);if(Number.isFinite(z))t.st.setLoraCap(z)}}),"at once"]}):null,L.length===0?y("div",{className:"loras-more",children:["no lora matches '",n.filter,"'"]}):null]})]}),t.v.desc.optionsFilter==null?null:y("div",{className:"modal-foot hint",children:["this workflow offers loras matching ",t.v.desc.optionsFilter]})]})}):null]})}),qU=q(function(t){let n=ra(()=>({info:"loading",about:null,aboutError:null,set(l){this.info=l},setAbout(l){this.about=l,this.aboutError=null},setAboutError(l){this.about=null,this.aboutError=l}})),{name:i,host:r}=t;Z(()=>{let l=!0;return n.set("loading"),n.setAbout(null),u0({host:r,name:i}).then((a)=>{if(l)n.set(a)}).catch((a)=>{if(l)n.set("error");Pt(`lora info for ${i}`,a)}),zO({host:r,name:i}).then((a)=>{if(l)n.setAbout(a)}).catch((a)=>{if(l)n.setAboutError(a instanceof Error?a.message:String(a));Pt(`lora details for ${i}`,a)}),()=>{l=!1}},[r,i,n]),Z(()=>{let l=(a)=>{if(a.key==="Escape")t.onClose()};return window.addEventListener("keydown",l),()=>window.removeEventListener("keydown",l)},[t]);let o=n.info,s=(l,a)=>a==null||a===""?null:y("div",{className:"detail-row",children:[p("span",{className:"detail-key",children:l}),p("span",{className:"detail-val",children:a})]});return p("div",{className:"modal-overlay",onClick:()=>t.onClose(),children:y("div",{className:"modal",onClick:(l)=>l.stopPropagation(),children:[y("div",{className:"modal-head",children:[p("b",{style:{flex:1},children:t.label}),p("button",{type:"button","data-tip":"close (esc)",onClick:()=>t.onClose(),children:p(B,{name:"close"})})]}),y("div",{className:"modal-body",children:[o==="loading"?p("div",{className:"hint",children:"reading the mirror…"}):null,o==="error"?p("div",{className:"error",children:"\uD83D\uDD34 could not read this lora's metadata"}):null,typeof o==="object"?y("div",{className:"lora-details",children:[t.showImage?p("img",{className:"detail-thumb",src:c0({host:r,name:i}),alt:t.label}):null,y("div",{className:"detail-list",children:[o.known===!1?p("div",{className:"hint",children:"newer than the copy of the lora manager's list kept here: sync reads it again"}):null,t.managerOnly?p("div",{className:"hint",children:"⚠ only the lora manager lists it, not comfy"}):null,s("file",i),s("base model",o.baseModel),s("folder",o.folder),s("trigger words",o.triggerWords.join(", ")),s("prompt keyword",t.keyword),s("tags",(o.tags??[]).join(", ")),s("notes",o.notes),s("size",o.fileSize==null?null:`${(o.fileSize/1e9).toFixed(2)} GB`),s("path",o.filePath),n.about?.description==null?null:p("div",{className:"detail-desc",children:n.about.description}),s("civitai",o.civitaiUrl==null?null:y("a",{href:o.civitaiUrl,target:"_blank",rel:"noreferrer",children:[o.civitaiVersion??"model page"," ↗"]})),n.about!=null&&n.about.examples.length>0?y("div",{children:[y("div",{className:"section-title",children:["examples (",n.about.examples.length,")"]}),p("div",{className:"detail-examples",children:n.about.examples.slice(0,8).map((l)=>p("img",{src:l,alt:"",loading:"lazy"},l))})]}):null,n.about?.examplesReason==null?null:y("div",{className:"hint",children:["no example images: ",n.about.examplesReason]}),n.aboutError==null?null:y("div",{className:"error",children:["\uD83D\uDD34 the lora manager did not answer: ",n.aboutError]}),t.hostUrl==null?null:y("a",{className:"button-link",href:`${t.hostUrl}/loras`,target:"_blank",rel:"noreferrer",children:[p(B,{name:"external"})," open in the lora manager"]})]})]}):null]})]})})});var Qx=[{mode:"=",label:"fixed",hint:"this exact seed, every run"},{mode:"+",label:"inc",hint:"one more after each run"},{mode:"?",label:"random",hint:"a fresh random seed each run"}];function $U(e){if(Qx.some((t)=>t.mode===e))return Qx;return[...Qx,e==="-"?{mode:"-",label:"dec",hint:"one less after each run"}:{mode:e,label:e,hint:`mode '${e}'`}]}var tL=q(function(t){let n=Rs(t.v.value),i=(r)=>{if(Number.isFinite(r))t.v.set({mode:n.mode,value:Math.max(0,Math.floor(r))})};return p("div",{children:y("div",{className:"row-inline",children:[p("span",{className:"btn-group field-height",children:$U(n.mode).map((r)=>p("button",{type:"button",className:n.mode===r.mode?"sel":"","data-tip":r.hint,onClick:()=>t.v.set({mode:r.mode,value:n.value}),children:r.label},r.mode))}),p("input",{type:"number",min:0,value:n.value,onChange:(r)=>i(parseInt(r.target.value,10))}),p("button",{type:"button",className:"field-height","data-tip":"roll a random seed now",onClick:()=>i(HA()),children:p(B,{name:"dice"})})]})})});function nL(e){let t=new Set(e.mine??e.defaults);return e.presets.filter((n)=>t.has(n.label))}function iL(e){let t=e.mine??e.defaults;return t.includes(e.label)?t.filter((n)=>n!==e.label):[...t,e.label]}function rL(e,t,n){if(e<=0||t<=0)return{w:n,h:n};let i=n/Math.max(e,t);return{w:Math.max(2,Math.round(e*i)),h:Math.max(2,Math.round(t*i))}}function Jx(e){let t=e.box??14,n=rL(e.width,e.height,t-2);return p("svg",{className:"aspect-icon",width:t,height:t,viewBox:`0 0 ${t} ${t}`,"aria-hidden":"true",children:p("rect",{x:(t-n.w)/2,y:(t-n.h)/2,width:n.w,height:n.h,rx:1.5,fill:"none",stroke:"currentColor",strokeWidth:1.4})})}function oL(e){return`${String(e).length+2.6}ch`}var sL=q(function(t){let[n,i]=Q(!1),r=vc(t.v.value),o=t.v.desc.presets??[],s=`${t.module}/${t.v.name}`,l=t.v.desc.starredPresets??[],a=t.st.sizeStars[s],u=nL({presets:o,defaults:l,mine:a}),c=o.find((h)=>h.width===r.width&&h.height===r.height),f=(h)=>t.v.set({width:h.width,height:h.height}),d=(h)=>{let m=h.width??r.width,b=h.height??r.height;if(Number.isFinite(m)&&Number.isFinite(b)&&m>0&&b>0)t.v.set({width:Math.floor(m),height:Math.floor(b)})};return y("div",{className:"row-inline size-row",children:[u.length>0?p("span",{className:"btn-group",children:u.map((h)=>p("button",{type:"button",className:h===c?"sel":"","data-tip":`${h.label} · ${h.width}×${h.height}`,onClick:()=>f(h),children:p(Jx,{width:h.width,height:h.height})},h.label))}):null,y("div",{className:"preset-box",onKeyDown:(h)=>h.key==="Escape"?i(!1):void 0,children:[y("button",{type:"button",className:"preset-btn size-pick","aria-expanded":n,onClick:()=>i(!n),children:[p(Jx,{width:r.width,height:r.height})," ",c?.label??"custom"," ▾"]}),n?y(ie,{children:[p("div",{className:"preset-backdrop",onClick:()=>i(!1)}),p("div",{className:"preset-menu size-menu",children:o.map((h)=>{let m=u.includes(h);return y("div",{className:h===c?"size-item on":"size-item",children:[y("button",{type:"button",className:"size-item-pick",onClick:()=>{f(h),i(!1)},children:[p(Jx,{width:h.width,height:h.height}),p("span",{className:"size-item-label",children:h.label}),y("span",{className:"hint",children:[h.width,"×",h.height]})]}),p("button",{type:"button",className:m?"size-star on":"size-star",title:m?"unstar: remove from the quick buttons":"star: add to the quick buttons",onClick:()=>t.st.setSizeStars(s,iL({defaults:l,mine:a,label:h.label})),children:m?"★":"☆"})]},h.label)})})]}):null]}),p("input",{type:"number",min:1,className:"size-num",style:{width:oL(r.width)},value:r.width,onChange:(h)=>d({width:Number(h.target.value)})}),"×",p("input",{type:"number",min:1,className:"size-num",style:{width:oL(r.height)},value:r.height,onChange:(h)=>d({height:Number(h.target.value)})}),p("button",{type:"button","data-tip":"swap width and height",onClick:()=>t.v.set({width:r.height,height:r.width}),children:p(B,{name:"swap"})})]})});var XU=q(function(t){switch(t.v.desc.kind){case"prompt":return p(WD,{v:t.v,st:t.st,module:t.module,jumpTarget:t.jumpTarget});case"text":return p(LT,{v:t.v});case"int":case"float":return p(zT,{v:t.v});case"seed":return p(tL,{v:t.v});case"toggle":return p(BT,{v:t.v});case"choice":return p(PT,{v:t.v});case"loras":return p(eL,{v:t.v,host:t.st.hostFor(t.module),st:t.st,hostUrl:t.st.hostUrlFor(t.module),jumpTarget:t.jumpTarget});case"size":return p(sL,{v:t.v,st:t.st,module:t.module});case"image":return p(ZD,{v:t.v});default:return y("div",{className:"hint",children:["unsupported var kind '",t.v.desc.kind,"' — use the json api"]})}}),GU=q(function(t){let n=X(null),i=t.st.jump,r=t.jumpKey==null?null:t.v.desc.kind;Z(()=>{if(i==null||r!=="prompt"||i.kind!=="prompt")return;let a=n.current?.querySelector(".cm-content");a?.focus(),a?.scrollIntoView({block:"nearest"})},[i,r]);let o=t.v.desc.ui,s=t.st.form?.inactiveReason(t.v)??null,l=t.v.desc.kind==="loras"||t.v.desc.kind==="prompt";return y("div",{ref:n,className:`var-row${l?" wide":""}${s==null?"":" inactive"}${t.place==null?"":` in-group group-${t.place.pos}`}`,style:{background:o?.background??(t.place==null?void 0:t.place.color??void 0),outline:o?.border==null?void 0:`1px solid ${o.border}`,outlineOffset:o?.border==null?void 0:"-1px"},onDragOver:(a)=>{if(a.dataTransfer.types.includes("application/x-comfy-var"))a.preventDefault()},onDrop:(a)=>{let u=a.dataTransfer.getData("application/x-comfy-var");if(u==="")return;a.preventDefault();let c=Number(u);if(Number.isInteger(c)&&c!==t.index)t.st.moveVar({module:t.module,names:t.names,from:c,to:t.index})},children:[p("button",{type:"button",className:"var-reset",disabled:t.v.isAtDefault,"data-tip":t.v.isAtDefault?"at the workflow default":"reset to the workflow default","aria-label":"reset to the workflow default",onClick:()=>t.v.resetToDefault(),children:p(B,{name:"refresh",size:0.95})}),y("div",{className:t.jumpKey==null?"var-label":"var-label has-kbd",draggable:!0,onDragStart:(a)=>{a.dataTransfer.effectAllowed="move",a.dataTransfer.setData("application/x-comfy-var",String(t.index))},children:[o?.description==null?null:p("span",{className:"var-help","data-tip":o.description,children:"?"}),o?.icon==null?null:p(dp,{icon:o.icon,color:o.color}),p("span",{className:"var-name","data-tip":`${t.v.desc.label??t.v.name??""}
52
- ${s??t.v.desc.kind}
53
- drag the label to reorder`,style:o?.labelColor==null?void 0:{color:o.labelColor},children:t.v.desc.label??t.v.name}),t.v.dirty?p("button",{type:"button",className:"dirty-dot","data-tip":"changed this session — click to restore the loaded value (autosaves)",onClick:()=>t.v.revert(),children:"●"}):null,t.jumpKey==null?null:p("span",{className:"var-kbd-line","data-tip":t.v.desc.kind==="loras"?"opens the loras picker":"puts the cursor in this prompt",children:y("span",{className:"kbd-hint",children:[Me,t.jumpKey]})})]}),p("div",{className:"var-control",inert:s!=null,children:p(XU,{v:t.v,host:t.host,st:t.st,module:t.module,jumpTarget:t.jumpKey!=null})})]})});function YU(e){return p("div",{className:"label-resizer",style:{left:e.st.labelWidth+2},"data-tip":"drag to resize the label column",onPointerDown:(t)=>{t.preventDefault();let n=t.clientX,i=e.st.labelWidth,r=(s)=>e.st.setLabelWidth(i+s.clientX-n,!1),o=()=>{window.removeEventListener("pointermove",r),window.removeEventListener("pointerup",o),e.st.setLabelWidth(e.st.labelWidth,!0)};window.addEventListener("pointermove",r),window.addEventListener("pointerup",o)}})}var Zx=q(function(t){let n=t.st.run,i=QD({isRunning:n.isRunning,percent:n.progressPercent}),r=oy({kind:"queue",count:n.pendingCount}).count,o=oy({kind:"results",count:n.results.length}).count;return y("span",{className:"run-bar",children:[y("span",{className:"btn-group run-split",children:[y("button",{type:"button",className:i.running?"primary running":"primary","data-tip":i.running?`running ${i.fill??0}%: click again to queue another (⌘⏎ / ctrl+⏎)`:"⌘⏎ / ctrl+⏎: click again to queue another",style:i.fill==null?void 0:{background:`linear-gradient(90deg, var(--accent) ${i.fill}%, var(--accent-dim) ${i.fill}%)`},onClick:()=>t.st.generate(),children:[p(B,{name:"play",size:0.85})," ",i.label,y("span",{className:"kbd-hint",children:[Me,"⏎"]})]}),p("button",{type:"button",className:n.isRunning?"run-stop live":"run-stop",disabled:!n.isRunning,"data-tip":"stop the run in progress (the queue behind it stays)",onClick:()=>void t.st.hostAction("interrupt"),children:p(B,{name:"stop"})})]}),y("button",{type:"button",className:"run-end",disabled:n.pendingCount===0,"data-tip":`drop the ${n.pendingCount} prompt(s) not yet sent to the host`,onClick:()=>n.clearQueue(),children:[p(B,{name:"close"})," Clear ",p("b",{className:"run-num",children:r})," queue"]}),y("button",{type:"button",className:"run-end",disabled:n.results.length===0,"data-tip":"forget every image shown here (saved files stay on disk)",onClick:()=>n.clear(),children:[p(B,{name:"trash"})," Erase ",p("b",{className:"run-num",children:o})," img"]})]})}),WU=q(function(t){let n=t.st.saveToDisk;return y("div",{className:"var-row",children:[p("div",{className:"var-label",children:p("span",{"data-tip":"save — where this workflow's images go",children:"output"})}),y("div",{className:"var-control",children:[y("div",{className:"row-inline",children:[y("label",{className:"row-inline",style:{cursor:"pointer"},children:[p("input",{type:"checkbox",checked:n,onChange:()=>void t.st.toggleSaveToDisk()}),y("span",{className:"hint",children:[p(B,{name:n?"save":"ghost",size:1})," ",n?"write to disk":"memory only"]})]}),n?y(ie,{children:[p("span",{className:"hint",children:".comfy-ts/outputs/"}),p("input",{type:"text",style:{flex:1,minWidth:120},placeholder:t.module,value:t.st.savePrefixDraft(t.module),"data-tip":"subfolder the images land in — folder names only, a/b allowed",onChange:(i)=>t.st.setSavePrefix(t.module,i.target.value)}),p("span",{className:"hint",children:"/…png"})]}):p("span",{className:"hint",children:"kept in memory and shown here, lost when the server restarts"})]}),t.st.savingError!=null?y("div",{className:"error",children:["\uD83D\uDD34 ",t.st.savingError]}):null]})]})}),lL=q(function(t){let n=t.st.form,i=X({prompt:null,loras:null});if(Z(()=>{let u=(c)=>{if(c.key==="Enter"&&(c.metaKey||c.ctrlKey)){c.preventDefault(),t.st.generate(t.st.enhancer.tryOverride);return}let f=Bh(c);if(f==null||f==="toggle-menu")return;if(t.st.enhancer.isOpen&&f!=="toggle-blur")return;if(c.preventDefault(),f==="toggle-blur")return t.st.toggleBlur();if(f==="duplicate-draft")return void t.st.duplicateCurrentDraft();if(f==="rename-draft")return t.st.startRename();if(f==="open-enhancer"){let d=t.st.form,h=d?.vars.find((m)=>m.name===i.current.prompt);if(d!=null&&h!=null)t.st.enhancer.openFor({v:h,module:d.moduleKey,lane:Dr(h.value)?0:void 0});return}t.st.requestJump(f==="focus-prompt"?"prompt":"loras")};return window.addEventListener("keydown",u),()=>window.removeEventListener("keydown",u)},[t.st]),n==null)return null;let r=t.st.orderedVars(n.moduleKey,n.vars.map((u)=>u.name)),o=r.map((u)=>n.vars.find((c)=>c.name===u)).filter((u)=>u!=null),s=JD(o.map((u)=>u.desc.ui??{})),l=OO(o.map((u)=>({name:u.name,kind:u.desc.kind,inactive:n.inactiveReason(u)!=null})));i.current=l;let a=(u)=>u===l.prompt?Bt["focus-prompt"]:u===l.loras?Bt["open-loras"]:null;return y("div",{children:[n.saveState==="error"?y("div",{className:"error",children:["\uD83D\uDD34 draft save failed: ",n.saveError]}):null,y("div",{className:"vars",style:{gridTemplateColumns:`${t.st.labelWidth}px minmax(0, 1fr)`},children:[p(YU,{st:t.st}),o.map((u,c)=>p(GU,{v:u,host:n.host,st:t.st,module:n.moduleKey,index:c,names:r,place:s[c]??null,jumpKey:a(u.name)},`${n.moduleKey}/${n.draft}/${u.name}`)),p(WU,{st:t.st,module:n.moduleKey})]}),t.st.generateInResults?null:y("div",{className:"runbar",children:[p(Zx,{st:t.st}),p("span",{className:"run-error","data-tip":t.st.run.error??void 0,children:t.st.run.error==null?"":`\uD83D\uDD34 ${t.st.run.error}`})]})]})});function aL(e){Z(()=>{let t=(n)=>{let i=WA(e.tabs,n)??QA(e.tabs,e.activeTab,n);if(i==null)return;n.preventDefault(),e.select(i)};return window.addEventListener("keydown",t),()=>window.removeEventListener("keydown",t)},[e])}var uL=q(function(t){let n=t.st.activeTab,i=t.st.tabs,[r,o]=Q(null);if(i.length===0)return null;return y("div",{className:"draft-tabs",role:"tablist",children:[i.map((s,l)=>{let a=n!=null&&n.module===s.module&&n.draft===s.draft,u=l<8?`${Me}${l+1}`:l===i.length-1?`${Me}9`:null;return y("div",{role:"tab","aria-selected":a,className:a?"draft-tab on":"draft-tab","data-tip":`${s.module} / ${s.draft}${u==null?"":`
51
+ click to ${se}`,onClick:()=>{if(h==null)return;if(se==="add")_(h,z,[1,1]);else O(h,z,se==="resume")},children:[y("span",{className:"thumb-box",children:[Ct(z,Math.round(110*Xo)),w&&ne&&!pt?Ur:null]}),y("div",{className:"lora-label",children:[E?l(z):z.slice(0,2)+"···",v(z)]})]}),ne&&h!=null?p("button",{type:"button",className:"chip-remove","data-tip":"remove from the palette",onClick:()=>_(h,z,null),children:p(T,{name:"close",size:1.35})}):null]},z)})})]},C.folder??"*")),ee.length>fe?y("div",{className:"loras-more",children:["… ",ee.length-fe," more — refine the filter, or draw",p("input",{type:"number",min:1,max:2000,value:fe,"data-tip":"how many cards this popup draws — each one is an image request, so the right number depends on your collection and your box. Kept in this browser",onChange:(C)=>{let z=parseInt(C.target.value,10);if(Number.isFinite(z))t.st.setLoraCap(z)}}),"at once"]}):null,ee.length===0?y("div",{className:"loras-more",children:["no lora matches '",n.filter,"'"]}):null]})]}),t.v.desc.optionsFilter==null?null:y("div",{className:"modal-foot hint",children:["this workflow offers loras matching ",t.v.desc.optionsFilter]})]})}):null]})}),g9=q(function(t){let n=ua(()=>({info:"loading",about:null,aboutError:null,set(l){this.info=l},setAbout(l){this.about=l,this.aboutError=null},setAboutError(l){this.about=null,this.aboutError=l}})),{name:i,host:r}=t;J(()=>{let l=!0;return n.set("loading"),n.setAbout(null),my({host:r,name:i}).then((a)=>{if(l)n.set(a)}).catch((a)=>{if(l)n.set("error");ut(`lora info for ${i}`,a)}),$O({host:r,name:i}).then((a)=>{if(l)n.setAbout(a)}).catch((a)=>{if(l)n.setAboutError(a instanceof Error?a.message:String(a));ut(`lora details for ${i}`,a)}),()=>{l=!1}},[r,i,n]),J(()=>{let l=(a)=>{if(a.key==="Escape")t.onClose()};return window.addEventListener("keydown",l),()=>window.removeEventListener("keydown",l)},[t]);let o=n.info,s=(l,a)=>a==null||a===""?null:y("div",{className:"detail-row",children:[p("span",{className:"detail-key",children:l}),p("span",{className:"detail-val",children:a})]});return p("div",{className:"modal-overlay",onClick:()=>t.onClose(),children:y("div",{className:"modal",onClick:(l)=>l.stopPropagation(),children:[y("div",{className:"modal-head",children:[p("b",{style:{flex:1},children:t.label}),p("button",{type:"button","data-tip":"close (esc)",onClick:()=>t.onClose(),children:p(T,{name:"close"})})]}),y("div",{className:"modal-body",children:[o==="loading"?p("div",{className:"hint",children:"reading the mirror…"}):null,o==="error"?p("div",{className:"error",children:"\uD83D\uDD34 could not read this lora's metadata"}):null,typeof o==="object"?y("div",{className:"lora-details",children:[t.showImage?p("img",{className:"detail-thumb",src:gy({host:r,name:i}),alt:t.label}):null,y("div",{className:"detail-list",children:[o.known===!1?p("div",{className:"hint",children:"newer than the copy of the lora manager's list kept here: sync reads it again"}):null,t.managerOnly?p("div",{className:"hint",children:"⚠ only the lora manager lists it, not comfy"}):null,s("file",i),s("base model",o.baseModel),s("folder",o.folder),s("trigger words",o.triggerWords.join(", ")),s("prompt keyword",t.keyword),s("tags",(o.tags??[]).join(", ")),s("notes",o.notes),s("size",o.fileSize==null?null:`${(o.fileSize/1e9).toFixed(2)} GB`),s("path",o.filePath),n.about?.description==null?null:p("div",{className:"detail-desc",children:n.about.description}),s("civitai",o.civitaiUrl==null?null:y("a",{href:o.civitaiUrl,target:"_blank",rel:"noreferrer",children:[o.civitaiVersion??"model page"," ↗"]})),n.about!=null&&n.about.examples.length>0?y("div",{children:[y("div",{className:"section-title",children:["examples (",n.about.examples.length,")"]}),p("div",{className:"detail-examples",children:n.about.examples.slice(0,8).map((l)=>p("img",{src:l,alt:"",loading:"lazy"},l))})]}):null,n.about?.examplesReason==null?null:y("div",{className:"hint",children:["no example images: ",n.about.examplesReason]}),n.aboutError==null?null:y("div",{className:"error",children:["\uD83D\uDD34 the lora manager did not answer: ",n.aboutError]}),t.hostUrl==null?null:y("a",{className:"button-link",href:`${t.hostUrl}/loras`,target:"_blank",rel:"noreferrer",children:[p(T,{name:"external"})," open in the lora manager"]})]})]}):null]})]})})});var lw=[{mode:"=",label:"fixed",hint:"this exact seed, every run"},{mode:"+",label:"inc",hint:"one more after each run"},{mode:"?",label:"random",hint:"a fresh random seed each run"}];function v9(e){if(lw.some((t)=>t.mode===e))return lw;return[...lw,e==="-"?{mode:"-",label:"dec",hint:"one less after each run"}:{mode:e,label:e,hint:`mode '${e}'`}]}var bL=q(function(t){let n=Ms(t.v.value),i=(r)=>{if(Number.isFinite(r))t.v.set({mode:n.mode,value:Math.max(0,Math.floor(r))})};return p("div",{children:y("div",{className:"row-inline",children:[p("span",{className:"btn-group field-height",children:v9(n.mode).map((r)=>p("button",{type:"button",className:n.mode===r.mode?"sel":"","data-tip":r.hint,onClick:()=>t.v.set({mode:r.mode,value:n.value}),children:r.label},r.mode))}),p("input",{type:"number",min:0,value:n.value,onChange:(r)=>i(parseInt(r.target.value,10))}),p("button",{type:"button",className:"field-height","data-tip":"roll a random seed now",onClick:()=>i(QR()),children:p(T,{name:"dice"})})]})})});function yL(e){let t=new Set(e.mine??e.defaults);return e.presets.filter((n)=>t.has(n.label))}function xL(e){let t=e.mine??e.defaults;return t.includes(e.label)?t.filter((n)=>n!==e.label):[...t,e.label]}function wL(e,t,n){if(e<=0||t<=0)return{w:n,h:n};let i=n/Math.max(e,t);return{w:Math.max(2,Math.round(e*i)),h:Math.max(2,Math.round(t*i))}}function aw(e){let t=e.box??14,n=wL(e.width,e.height,t-2);return p("svg",{className:"aspect-icon",width:t,height:t,viewBox:`0 0 ${t} ${t}`,"aria-hidden":"true",children:p("rect",{x:(t-n.w)/2,y:(t-n.h)/2,width:n.w,height:n.h,rx:1.5,fill:"none",stroke:"currentColor",strokeWidth:1.4})})}function SL(e){return`${String(e).length+2.6}ch`}var kL=q(function(t){let[n,i]=W(!1),r=_c(t.v.value),o=t.v.desc.presets??[],s=`${t.module}/${t.v.name}`,l=t.v.desc.starredPresets??[],a=t.st.sizeStars[s],u=yL({presets:o,defaults:l,mine:a}),c=o.find((h)=>h.width===r.width&&h.height===r.height),f=(h)=>t.v.set({width:h.width,height:h.height}),d=(h)=>{let m=h.width??r.width,b=h.height??r.height;if(Number.isFinite(m)&&Number.isFinite(b)&&m>0&&b>0)t.v.set({width:Math.floor(m),height:Math.floor(b)})};return y("div",{className:"row-inline size-row",children:[u.length>0?p("span",{className:"btn-group",children:u.map((h)=>p("button",{type:"button",className:h===c?"sel":"","data-tip":`${h.label} · ${h.width}×${h.height}`,onClick:()=>f(h),children:p(aw,{width:h.width,height:h.height})},h.label))}):null,y("div",{className:"preset-box",onKeyDown:(h)=>h.key==="Escape"?i(!1):void 0,children:[y("button",{type:"button",className:"preset-btn size-pick","aria-expanded":n,onClick:()=>i(!n),children:[p(aw,{width:r.width,height:r.height})," ",c?.label??"custom"," ▾"]}),n?y(te,{children:[p("div",{className:"preset-backdrop",onClick:()=>i(!1)}),p("div",{className:"preset-menu size-menu",children:o.map((h)=>{let m=u.includes(h);return y("div",{className:h===c?"size-item on":"size-item",children:[y("button",{type:"button",className:"size-item-pick",onClick:()=>{f(h),i(!1)},children:[p(aw,{width:h.width,height:h.height}),p("span",{className:"size-item-label",children:h.label}),y("span",{className:"hint",children:[h.width,"×",h.height]})]}),p("button",{type:"button",className:m?"size-star on":"size-star",title:m?"unstar: remove from the quick buttons":"star: add to the quick buttons",onClick:()=>t.st.setSizeStars(s,xL({defaults:l,mine:a,label:h.label})),children:m?"★":"☆"})]},h.label)})})]}):null]}),p("input",{type:"number",min:1,className:"size-num",style:{width:SL(r.width)},value:r.width,onChange:(h)=>d({width:Number(h.target.value)})}),"×",p("input",{type:"number",min:1,className:"size-num",style:{width:SL(r.height)},value:r.height,onChange:(h)=>d({height:Number(h.target.value)})}),p("button",{type:"button","data-tip":"swap width and height",onClick:()=>t.v.set({width:r.height,height:r.width}),children:p(T,{name:"swap"})})]})});var b9=q(function(t){switch(t.v.desc.kind){case"prompt":return p(hL,{v:t.v,st:t.st,module:t.module,jumpTarget:t.jumpTarget});case"text":return p(QT,{v:t.v});case"int":case"float":return p(JT,{v:t.v});case"seed":return p(bL,{v:t.v});case"toggle":return p(ZT,{v:t.v});case"choice":return p(eM,{v:t.v});case"loras":return p(vL,{v:t.v,host:t.st.hostFor(t.module),st:t.st,hostUrl:t.st.hostUrlFor(t.module),jumpTarget:t.jumpTarget});case"size":return p(kL,{v:t.v,st:t.st,module:t.module});case"image":return p(gL,{v:t.v});default:return y("div",{className:"hint",children:["unsupported var kind '",t.v.desc.kind,"' — use the json api"]})}});function _L(e){return{row:{onDragOver:(t)=>{if(t.dataTransfer.types.includes("application/x-comfy-var"))t.preventDefault()},onDrop:(t)=>{let n=t.dataTransfer.getData("application/x-comfy-var");if(n==="")return;t.preventDefault();let i=Number(n);if(Number.isInteger(i)&&i!==e.index)e.st.moveVar({module:e.module,names:e.names,from:i,to:e.index})}},handle:{draggable:!0,onDragStart:(t)=>{t.dataTransfer.effectAllowed="move",t.dataTransfer.setData("application/x-comfy-var",String(e.index))}}}}var y9=q(function(t){let n=X(null),i=t.st.jump,r=t.jumpKey==null?null:t.v.desc.kind,o=X(i?.seq??0);J(()=>{if(r!=="prompt"||!Uh(i,"prompt",o.current))return;o.current=i?.seq??0;let c=n.current?.querySelector(".cm-content");c?.focus(),c?.scrollIntoView({block:"nearest"})},[i,r]);let s=t.v.desc.ui,l=t.st.form?.inactiveReason(t.v)??null,a=t.v.desc.kind==="loras"||t.v.desc.kind==="prompt",u=_L(t);return y("div",{ref:n,className:`var-row${a?" wide":""}${l==null?"":" inactive"}${t.place==null?"":` in-group group-${t.place.pos}`}`,style:{background:s?.background??(t.place==null?void 0:t.place.color??void 0),outline:s?.border==null?void 0:`1px solid ${s.border}`,outlineOffset:s?.border==null?void 0:"-1px"},...u.row,children:[p("button",{type:"button",className:"var-reset",disabled:t.v.isAtDefault,"data-tip":t.v.isAtDefault?"at the workflow default":"reset to the workflow default","aria-label":"reset to the workflow default",onClick:()=>t.v.resetToDefault(),children:p(T,{name:"refresh",size:0.95})}),y("div",{className:t.jumpKey==null?"var-label":"var-label has-kbd",...u.handle,children:[s?.description==null?null:p("span",{className:"var-help","data-tip":s.description,children:"?"}),s?.icon==null?null:p(bp,{icon:s.icon,color:s.color}),p("span",{className:"var-name","data-tip":`${t.v.desc.label??t.v.name??""}
52
+ ${l??t.v.desc.kind}
53
+ drag the label to reorder`,style:s?.labelColor==null?void 0:{color:s.labelColor},children:t.v.desc.label??t.v.name}),t.v.dirty?p("button",{type:"button",className:"dirty-dot","data-tip":"changed this session — click to restore the loaded value (autosaves)",onClick:()=>t.v.revert(),children:"●"}):null,t.jumpKey==null?null:p("span",{className:"var-kbd-line","data-tip":t.v.desc.kind==="loras"?"opens the loras picker":"puts the cursor in this prompt",children:y("span",{className:"kbd-hint",children:[Ee,t.jumpKey]})})]}),p("div",{className:"var-control",inert:l!=null,children:p(b9,{v:t.v,host:t.host,st:t.st,module:t.module,jumpTarget:t.jumpKey!=null})})]})});function x9(e){return p("div",{className:"label-resizer",style:{left:e.st.labelWidth+2},"data-tip":"drag to resize the label column",onPointerDown:(t)=>{t.preventDefault();let n=t.clientX,i=e.st.labelWidth,r=(s)=>e.st.setLabelWidth(i+s.clientX-n,!1),o=()=>{window.removeEventListener("pointermove",r),window.removeEventListener("pointerup",o),e.st.setLabelWidth(e.st.labelWidth,!0)};window.addEventListener("pointermove",r),window.addEventListener("pointerup",o)}})}var uw=q(function(t){let n=t.st.run,i=pL({isRunning:n.isRunning,percent:n.progressPercent}),r=p0({kind:"queue",count:n.pendingCount}).count,o=p0({kind:"results",count:n.results.length}).count;return y("span",{className:"run-bar",children:[y("span",{className:"btn-group run-split",children:[y("button",{type:"button",className:i.running?"primary running":"primary","data-tip":i.running?`running ${i.fill??0}%: click again to queue another (⌘⏎ / ctrl+⏎)`:"⌘⏎ / ctrl+⏎: click again to queue another",style:i.fill==null?void 0:{background:`linear-gradient(90deg, var(--accent) ${i.fill}%, var(--accent-dim) ${i.fill}%)`},onClick:()=>t.st.generate(),children:[p(T,{name:"play",size:0.85})," ",i.label,y("span",{className:"kbd-hint",children:[Ee,"⏎"]})]}),p("button",{type:"button",className:n.isRunning?"run-stop live":"run-stop",disabled:!n.isRunning,"data-tip":"stop the run in progress (the queue behind it stays)",onClick:()=>void t.st.hostAction("interrupt"),children:p(T,{name:"stop"})})]}),y("button",{type:"button",className:"run-end",disabled:n.pendingCount===0,"data-tip":`drop the ${n.pendingCount} prompt(s) not yet sent to the host`,onClick:()=>n.clearQueue(),children:[p(T,{name:"close"})," Clear ",p("b",{className:"run-num",children:r})," queue"]}),y("button",{type:"button",className:"run-end",disabled:n.results.length===0,"data-tip":"forget every image shown here (saved files stay on disk)",onClick:()=>n.clear(),children:[p(T,{name:"trash"})," Erase ",p("b",{className:"run-num",children:o})," img"]})]})}),w9=q(function(t){let n=t.st.saveToDisk,i=_L(t);return y("div",{className:"var-row",...i.row,children:[p("div",{className:"var-label",...i.handle,children:p("span",{"data-tip":`save — where this workflow's images go
54
+ drag the label to reorder`,children:"output"})}),y("div",{className:"var-control",children:[y("div",{className:"row-inline",children:[y("label",{className:"row-inline",style:{cursor:"pointer"},children:[p("input",{type:"checkbox",checked:n,onChange:()=>void t.st.toggleSaveToDisk()}),y("span",{className:"hint",children:[p(T,{name:n?"save":"ghost",size:1})," ",n?"write to disk":"memory only"]})]}),n?y(te,{children:[p("span",{className:"hint",children:".comfy-ts/outputs/"}),p("input",{type:"text",style:{flex:1,minWidth:120},placeholder:t.module,value:t.st.savePrefixDraft(t.module),"data-tip":"subfolder the images land in — folder names only, a/b allowed",onChange:(r)=>t.st.setSavePrefix(t.module,r.target.value)}),p("span",{className:"hint",children:"/…png"})]}):p("span",{className:"hint",children:"kept in memory and shown here, lost when the server restarts"})]}),t.st.savingError!=null?y("div",{className:"error",children:["\uD83D\uDD34 ",t.st.savingError]}):null]})]})}),CL=q(function(t){let n=t.st.form,i=X({prompt:null,loras:null});if(J(()=>{let u=(c)=>{if(c.key==="Enter"&&(c.metaKey||c.ctrlKey)){c.preventDefault(),t.st.generate(t.st.enhancer.tryOverride);return}let f=Vh(c);if(f==null||f==="toggle-menu")return;if(t.st.enhancer.isOpen&&f!=="toggle-blur")return;if(c.preventDefault(),f==="toggle-blur")return t.st.toggleBlur();if(f==="duplicate-draft")return void t.st.duplicateCurrentDraft();if(f==="rename-draft")return t.st.startRename();if(f==="open-enhancer"){let d=t.st.form,h=d?.vars.find((m)=>m.name===i.current.prompt);if(d!=null&&h!=null)t.st.enhancer.openFor({v:h,module:d.moduleKey,lane:Dr(h.value)?0:void 0});return}t.st.requestJump(f==="focus-prompt"?"prompt":"loras")};return window.addEventListener("keydown",u),()=>window.removeEventListener("keydown",u)},[t.st]),n==null)return null;let r=t.st.orderedVars(n.moduleKey,YT(n.vars.map((u)=>u.name))),o=r.map((u)=>n.vars.find((c)=>c.name===u)).filter((u)=>u!=null),s=mL(r.map((u)=>n.vars.find((c)=>c.name===u)?.desc.ui??{})),l=PO(o.map((u)=>({name:u.name,kind:u.desc.kind,inactive:n.inactiveReason(u)!=null})));i.current=l;let a=(u)=>u===l.prompt?xt["focus-prompt"]:u===l.loras?xt["open-loras"]:null;return y("div",{children:[n.saveState==="error"?y("div",{className:"error",children:["\uD83D\uDD34 draft save failed: ",n.saveError]}):null,y("div",{className:"vars",style:{gridTemplateColumns:`${t.st.labelWidth}px minmax(0, 1fr)`},children:[p(x9,{st:t.st}),r.map((u,c)=>{if(u===m0)return p(w9,{st:t.st,module:n.moduleKey,index:c,names:r},m0);let f=n.vars.find((d)=>d.name===u);if(f==null)return null;return p(y9,{v:f,host:n.host,st:t.st,module:n.moduleKey,index:c,names:r,place:s[c]??null,jumpKey:a(f.name)},`${n.moduleKey}/${n.draft}/${f.name}`)})]}),t.st.generateInResults?null:p("div",{className:"runbar",children:p(uw,{st:t.st})}),t.st.layout==="off"?p(vp,{st:t.st}):null]})});function EL(e){J(()=>{let t=(n)=>{let i=lA(e.tabs,n)??aA(e.tabs,e.activeTab,n);if(i==null)return;n.preventDefault(),e.select(i)};return window.addEventListener("keydown",t),()=>window.removeEventListener("keydown",t)},[e])}var OL=q(function(t){let n=t.st.activeTab,i=t.st.tabs,[r,o]=W(null);if(i.length===0)return null;return y("div",{className:"draft-tabs",role:"tablist",children:[i.map((s,l)=>{let a=n!=null&&n.module===s.module&&n.draft===s.draft,u=l<8?`${Ee}${l+1}`:l===i.length-1?`${Ee}9`:null;return y("div",{role:"tab","aria-selected":a,className:a?"draft-tab on":"draft-tab","data-tip":`${s.module} / ${s.draft}${u==null?"":`
54
55
  ${u}`}${a?`
55
- click: rename, duplicate, delete`:""}`,onClick:(c)=>{if(a)o(c.currentTarget);else t.st.select(s)},onAuxClick:(c)=>{if(c.button!==1)return;c.preventDefault(),t.st.closeTab(s)},children:[y("span",{className:"draft-tab-name",children:[s.draft,i.some((c)=>c.draft===s.draft&&c.module!==s.module)?y("span",{className:"draft-tab-wf",children:[" · ",s.module]}):null]}),i.length>1?p("button",{type:"button",className:"draft-tab-close","aria-label":`close ${s.draft}`,onClick:(c)=>{c.stopPropagation(),t.st.closeTab(s)},children:p(B,{name:"close",size:0.8})}):null]},`${s.module}/${s.draft}`)}),r!=null&&n!=null?p(QU,{st:t.st,tab:n,anchor:r,onClose:()=>o(null)}):null]})}),QU=q(function(t){let[n,i]=Q(t.tab.draft),{refs:r,floatingStyles:o,context:s}=fp({open:!0,onOpenChange:(c)=>{if(!c)t.onClose()},placement:"bottom-start",middleware:[xa(4),Mc(),Tc({padding:8})],whileElementsMounted:ya,elements:{reference:t.anchor}}),{getFloatingProps:l}=TT([RT(s)]),a=(c)=>{t.onClose(),c()},u=()=>{let c=n.trim();a(()=>c!==""&&c!==t.tab.draft?t.st.renameDraft(c):void 0)};return p(cp,{children:y("div",{ref:r.setFloating,style:o,className:"tab-menu",...l(),children:[p("input",{type:"text",className:"head-input",autoFocus:!0,value:n,"aria-label":"draft name",placeholder:"new name, then enter",onFocus:(c)=>c.currentTarget.select(),onChange:(c)=>i(c.target.value),onKeyDown:(c)=>{if(c.key==="Enter")u();if(c.key==="Escape")t.onClose()}}),y("button",{type:"button",className:"menu-row menu-action",onClick:()=>a(()=>t.st.duplicateCurrentDraft()),children:[p(B,{name:"copy-plus"}),p("span",{children:"duplicate"}),p("span",{className:"kbd-hint",children:zh("duplicate-draft")})]}),y("button",{type:"button",className:"menu-row menu-action",onClick:()=>a(()=>t.st.newDraftFromDefaults()),children:[p(B,{name:"plus"}),p("span",{children:"new default"})]}),y("button",{type:"button",className:"menu-row menu-action danger",onClick:()=>a(()=>{if(window.confirm(`delete draft '${t.tab.draft}' of ${t.tab.module}? the file is removed.`))return t.st.deleteDraft(t.tab)}),children:[p(B,{name:"trash"}),p("span",{children:"delete"})]})]})})});function JU(){Z(()=>{let e=(t)=>{if(t.key!=="a"&&t.key!=="A")return;if(!t.metaKey&&!t.ctrlKey)return;if(t.altKey)return;let n=document.activeElement;if(!(n instanceof HTMLInputElement?n.type==="text"||n.type==="search"||n.type==="password"||n.type==="url":n instanceof HTMLTextAreaElement))return;t.preventDefault(),n.select()};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[])}function ZU(e){let t=X(null),n=X(!0);return ti(()=>{let i=t.current;if(i!=null&&n.current)i.scrollTop=i.scrollHeight},[e.text]),p("pre",{ref:t,onScroll:(i)=>{let r=i.currentTarget;n.current=r.scrollHeight-r.scrollTop-r.clientHeight<8},children:e.text})}function e9(e){let[t,n]=Q(!1),i=typeof navigator<"u"&&navigator.clipboard!=null;return Z(()=>{if(!t)return;let r=setTimeout(()=>n(!1),1500);return()=>clearTimeout(r)},[t]),p("button",{type:"button",className:"live-preview-copy",disabled:!i,"data-tip":i?t?"copied":"copy the full prompt":"copy needs localhost or https",onClick:()=>{navigator.clipboard.writeText(e.text).then(()=>n(!0),(r)=>console.error("[comfy-ts] \uD83D\uDD34 copy failed:",r))},children:p(B,{name:t?"check":"copy"})})}var t9=q(function(t){let n=t.st.form,i=n==null?[]:t.st.moduleByKey(n.moduleKey)?.previews??[];if(n==null||i.length===0)return null;return p("div",{className:"live-previews",children:i.map((r)=>{let o=`${n.moduleKey}/${r}`,s=t.st.expandedPreviews.includes(o),l=n.previews[r]??"…",a=l.split(`
56
- `).filter((c)=>c.trim()!==""),u=NT(l);return y("div",{className:"live-preview-row",children:[y("button",{type:"button",className:s?"live-preview expanded":"live-preview","data-tip":s?"click to show one line each":"click for the full text",onClick:()=>t.st.togglePreviewExpanded(o),children:[y("span",{className:"live-preview-name",children:[r,n.previewError==null?null:p("span",{className:"live-preview-error","data-tip":`preview failed: ${n.previewError}`,children:"\uD83D\uDD34"})]}),y("span",{className:"live-preview-lines",children:[!s?y(ie,{children:[p("span",{className:"live-preview-line",children:u.positive}),p("span",{className:"live-preview-line negative",children:u.negative===""?"":`− ${u.negative}`})]}):null,s&&a.map((c,f)=>c.startsWith("- ")?y("span",{className:"live-preview-line negative",children:["− ",c.slice(2)]},f):p("span",{className:"live-preview-line",children:c},f))]})]}),p(e9,{text:l})]},r)})})}),n9={full:"image",corner:"panel-corner",off:"panel-off"},i9=q(function(t){return y("div",{className:"results-head",children:[y("div",{className:"head-group-labeled",children:[p("span",{className:"group-caption",children:"while running"}),p("span",{className:"row-inline head-row",children:p("span",{className:"btn-group",children:DA.map((n)=>p("button",{type:"button",className:t.st.latentMode===n.mode?"sel":"","data-tip":n.tip,onClick:()=>t.st.setLatentMode(n.mode),children:p(B,{name:n9[n.mode]})},n.mode))})})]}),y("label",{className:"cols-field","data-tip":"results side by side: 1 is one image as wide as this panel",children:[p(B,{name:"grid"}),p("input",{type:"number",min:1,max:8,step:1,value:t.st.resultsColumns,onChange:(n)=>{let i=Number(n.target.value);if(n.target.value!==""&&Number.isFinite(i))t.st.setResultsColumns(i)}}),"cols"]}),p("span",{className:"btn-group",children:y("button",{type:"button",className:t.st.blurResults?"sel":"","data-tip":t.st.blurResults?"blurred until you hover: click for always clear":"always clear: click to blur until you hover",onClick:()=>t.st.toggleBlur(),children:[p(B,{name:t.st.blurResults?"eye-off":"eye"})," blur",y("span",{className:"kbd-hint",children:[Me,Bt["toggle-blur"]]})]})})]})}),r9=760;function o9(){let e=`(max-width: ${r9}px)`,[t,n]=Q(()=>window.matchMedia(e).matches);return Z(()=>{let i=window.matchMedia(e),r=()=>n(i.matches);return i.addEventListener("change",r),()=>i.removeEventListener("change",r)},[e]),t}var fL={getItem:(e)=>{try{return localStorage.getItem(e)}catch{return null}},setItem:(e,t)=>{try{localStorage.setItem(e,t)}catch{}}},s9=q(function(t){let n=t.left?"comfy-ts-split-left":"comfy-ts-split-right",i=r0({id:n,storage:fL}),r=p(ua,{id:"form",minSize:"30%",className:"split-panel split-form",children:t.form}),o=p(ua,{id:"results",defaultSize:"34%",minSize:"16%",className:"split-panel split-results",children:t.results});return y(Dh,{id:n,orientation:"horizontal",className:`work split split-${t.left?"left":"right"}`,defaultLayout:i.defaultLayout,onLayoutChanged:i.onLayoutChanged,children:[t.left?o:r,p(Lh,{className:"split-handle"}),t.left?r:o]},n)}),l9=48,cL=180,a9=q(function(t){let n=r0({id:"comfy-ts-menu",storage:fL}),i=CO(),[r,o]=Q(!1);return Z(()=>Tr(()=>t.st.renamingDraft!=null,(s)=>{let l=i.current;if(s&&l!=null&&l.isCollapsed())l.expand()}),[t.st,i]),Z(()=>Tr(()=>t.st.menuFoldTick,()=>{let s=i.current;if(s==null)return;if(s.isCollapsed())s.expand();else s.collapse()}),[t.st,i]),y(Dh,{id:"comfy-ts-menu",orientation:"horizontal",className:"menu-layout",defaultLayout:n.defaultLayout,onLayoutChanged:n.onLayoutChanged,children:[p(ua,{id:"menu",panelRef:i,defaultSize:220,minSize:cL,maxSize:420,collapsible:!0,collapsedSize:l9,groupResizeBehavior:"preserve-pixel-size",onResize:(s)=>o(s.inPixels<cL-1),className:"menu-panel",children:r?p(xR,{st:t.st,onExpand:()=>i.current?.expand()}):y("div",{className:"menu-col",children:[p(U0,{tip:`fold the menu to icons (${Me}B), it stays folded in this browser`,keyHint:`${Me}${Bt["toggle-menu"]}`,onBurger:()=>i.current?.collapse()}),p(j0,{st:t.st})]})}),p(Lh,{className:"split-handle"}),p(ua,{id:"main",minSize:"40%",className:"menu-main",children:t.main})]})}),u9=q(function(t){let n=t.st.form;return y("div",{className:"mobile-bar",children:[p("button",{type:"button",className:"head-icon","aria-label":"menu",onClick:()=>t.st.setMenuOpen(!0),children:p(B,{name:"menu"})}),y("button",{type:"button",className:"mobile-where",onClick:()=>t.st.omnibox.open(),children:[p("span",{className:"menu-value mobile-workflow",children:n?.moduleKey??"no workflow"}),n==null?null:y("span",{className:"mobile-draft",children:[" · ",n.draft]})]})]})}),c9=q(function(t){if(!t.st.menuOpen)return null;return p("div",{className:"drawer-overlay",onClick:()=>t.st.setMenuOpen(!1),children:y("div",{className:"drawer",onClick:(n)=>n.stopPropagation(),children:[p(U0,{tip:"close the menu",keyHint:`${Me}${Bt["toggle-menu"]}`,onBurger:()=>t.st.setMenuOpen(!1)}),p(j0,{st:t.st})]})})});function f9(e,t){Z(()=>{let n=(i)=>{if(Bh(i)!=="toggle-menu")return;if(i.preventDefault(),t)e.setMenuOpen(!e.menuOpen);else e.requestMenuFold()};return window.addEventListener("keydown",n),()=>window.removeEventListener("keydown",n)},[e,t])}var dL=q(function(t){let n=o9();if(f9(t.st,n),aL(t.st),JU(),OR(t.st),t.st.phase==="loading")return p("div",{className:"center",children:"loading…"});if(t.st.phase==="error")return p("div",{className:"center",children:y("div",{className:"error",children:["\uD83D\uDD34 ",t.st.bootError]})});let i=t.st.layout,r=y("div",{className:"form-col",children:[p(lL,{st:t.st}),t.st.showLogs?y("div",{className:"logs",children:[y("div",{className:"logs-head",children:[y("span",{children:["console · ",t.st.hostFor(t.st.form?.moduleKey??"")||"host"]}),p("button",{type:"button",className:"link",onClick:()=>t.st.toggleLogs(),children:"hide"})]}),t.st.logsError!=null?y("div",{className:"error",children:["\uD83D\uDD34 ",t.st.logsError]}):null,p(ZU,{text:t.st.logLines.join(`
57
- `)})]}):null]}),o=y("div",{className:"results-col",children:[p(i9,{st:t.st}),t.st.generateInResults?y("div",{className:"results-run",children:[p(Zx,{st:t.st}),p("span",{className:"run-error","data-tip":t.st.run.error??void 0,children:t.st.run.error==null?"":`\uD83D\uDD34 ${t.st.run.error}`})]}):null,p(t9,{st:t.st}),p(CR,{st:t.st,compact:i==="pinned"})]}),s=y(ie,{children:[t.st.formError!=null?y("div",{className:"center error",children:["\uD83D\uDD34 ",t.st.formError]}):null,t.st.formLoading&&t.st.form==null?p("div",{className:"center",children:"loading draft…"}):null,t.st.modules.length===0?p("div",{className:"center",children:"no workflow modules loaded"}):null]}),a=(i==="side"||i==="left")&&!n?p(s9,{st:t.st,left:i==="left",form:y(ie,{children:[s,r]}),results:o}):y("div",{className:"main",children:[s,y("div",{className:`work layout-${i}`,children:[r,i==="off"?y("button",{type:"button",className:"show-preview","data-tip":"show the preview panel again",onClick:()=>t.st.showPreview(),children:[p(B,{name:"panel-side"})," preview"]}):o]})]});return y("div",{className:"app",children:[n?p(u9,{st:t.st}):null,p("div",{className:"cols",children:n?a:p(a9,{st:t.st,main:y("div",{className:"tabs-col",children:[p(uL,{st:t.st}),p("div",{className:"tabs-body",children:a})]})})}),n?p(c9,{st:t.st}):null,p(AR,{st:t.st}),p(MT,{})]})});var hL=`
56
+ click: rename, duplicate, delete`:""}`,onClick:(c)=>{if(a)o(c.currentTarget);else t.st.select(s)},onAuxClick:(c)=>{if(c.button!==1)return;c.preventDefault(),t.st.closeTab(s)},children:[y("span",{className:"draft-tab-name",children:[s.draft,i.some((c)=>c.draft===s.draft&&c.module!==s.module)?y("span",{className:"draft-tab-wf",children:[" · ",s.module]}):null]}),i.length>1?p("button",{type:"button",className:"draft-tab-close","aria-label":`close ${s.draft}`,onClick:(c)=>{c.stopPropagation(),t.st.closeTab(s)},children:p(T,{name:"close",size:0.8})}):null]},`${s.module}/${s.draft}`)}),r!=null&&n!=null?p(S9,{st:t.st,tab:n,anchor:r,onClose:()=>o(null)}):null]})}),S9=q(function(t){let[n,i]=W(t.tab.draft),{refs:r,floatingStyles:o,context:s}=Ea({open:!0,onOpenChange:(c)=>{if(!c)t.onClose()},placement:"bottom-start",middleware:[No(4),Is(),Ps({padding:8})],whileElementsMounted:Mo,elements:{reference:t.anchor}}),{getFloatingProps:l}=gp([mp(s)]),a=(c)=>{t.onClose(),c()},u=()=>{let c=n.trim();a(()=>c!==""&&c!==t.tab.draft?t.st.renameDraft(c):void 0)};return p(Ca,{children:y("div",{ref:r.setFloating,style:o,className:"tab-menu",...l(),children:[p("input",{type:"text",className:"head-input",autoFocus:!0,value:n,"aria-label":"draft name",placeholder:"new name, then enter",onFocus:(c)=>c.currentTarget.select(),onChange:(c)=>i(c.target.value),onKeyDown:(c)=>{if(c.key==="Enter")u();if(c.key==="Escape")t.onClose()}}),y("button",{type:"button",className:"menu-row menu-action",onClick:()=>a(()=>t.st.duplicateCurrentDraft()),children:[p(T,{name:"copy-plus"}),p("span",{children:"duplicate"}),p("span",{className:"kbd-hint",children:Hh("duplicate-draft")})]}),y("button",{type:"button",className:"menu-row menu-action",onClick:()=>a(()=>t.st.newDraftFromDefaults()),children:[p(T,{name:"plus"}),p("span",{children:"new default"})]}),y("button",{type:"button",className:"menu-row menu-action danger",onClick:()=>a(()=>{if(window.confirm(`delete draft '${t.tab.draft}' of ${t.tab.module}? the file is removed.`))return t.st.deleteDraft(t.tab)}),children:[p(T,{name:"trash"}),p("span",{children:"delete"})]})]})})});var RL={"focus-prompt":"focus the first prompt","open-loras":"open the lora picker","open-enhancer":"open the prompt enhancer","rename-draft":"rename the draft","duplicate-draft":"duplicate the draft","toggle-menu":"fold or unfold the menu","toggle-blur":"blur or unblur the results"},AL={enhance:"enhance the prompt",apply:"apply the rewrite to the prompt"},TL=(e,t)=>/^F\d{1,2}$/.test(t)?t:`${e}${t}`;function ML(e=Ee){let t=Object.keys(RL).map((i)=>({keys:[TL(e,xt[i])],what:RL[i]})),n=Object.keys(AL).map((i)=>({keys:[TL(e,vc[i])],what:AL[i]}));return[{title:"anywhere",rows:[{keys:[`${e}⏎`],what:"run the draft"},{keys:[`${e}K`,`${e}J`],what:"search every workflow and draft"},{keys:[`${e}1 … ${e}8`],what:"open tab 1 to 8"},{keys:[`${e}9`],what:"open the last tab"},{keys:[`${e}PageUp`,`${e}PageDown`],what:"previous or next tab, wrapping"},...t,{keys:[`${e}A`],what:"select all in the field you are in"},{keys:["Esc"],what:"close the popup on top"}]},{title:"prompt editor",rows:[{keys:[`${e}↑`,`${e}↓`],what:"weight of the word or selection up or down",cm:["Mod-ArrowUp","Mod-ArrowDown","Ctrl-ArrowUp","Ctrl-ArrowDown"]},{keys:[`${e}/`],what:"comment the line in or out",cm:["Mod-/"]},{keys:[`${e}⇧-`],what:"make the line negative, or positive again",cm:["Mod-Shift--","Mod-_"]},{keys:["⌥↑","⌥↓"],what:"move the line up or down",cm:["Alt-ArrowUp","Alt-ArrowDown"]},{keys:[`${e}Z`,`${e}⇧Z`],what:"undo, redo"},{keys:["↑","↓","⏎","Esc"],what:"in the completion list: move, pick, dismiss"}]},{title:"prompt enhancer",rows:[...n,{keys:[`${e}⏎`],what:"run with the rewrite, the prompt stays as it is"}]},{title:"lightbox",rows:[{keys:["↑","↓"],what:"previous or next image of the gallery"},{keys:["scroll"],what:"zoom at the pointer, drag to pan"},{keys:["double click"],what:"back to fit"},{keys:["Esc"],what:"close"}]},{title:"search and history pickers",rows:[{keys:["↑","↓"],what:"move"},{keys:["⏎"],what:"open the pick"},{keys:["Esc"],what:"close"}]},{title:"renaming",rows:[{keys:["⏎"],what:"keep the new name"},{keys:["Esc"],what:"cancel"}]}]}var NL=q(function(t){let n=t.st.showShortcuts;if(J(()=>{if(!n)return;let i=(r)=>{if(r.key==="Escape")t.st.setShowShortcuts(!1)};return window.addEventListener("keydown",i),()=>window.removeEventListener("keydown",i)},[n,t.st]),!n)return null;return p("div",{className:"modal-overlay top",onClick:()=>t.st.setShowShortcuts(!1),children:y("div",{className:"modal shortcuts-modal",onClick:(i)=>i.stopPropagation(),children:[y("div",{className:"modal-head",children:[p(T,{name:"keyboard"}),p("span",{className:"shortcuts-title",children:"shortcuts"}),p("button",{type:"button",className:"modal-close","data-tip":"close (esc)",onClick:()=>t.st.setShowShortcuts(!1),children:p(T,{name:"close"})})]}),p("div",{className:"shortcuts-body",children:ML().map((i)=>y("section",{className:"shortcuts-group",children:[p("div",{className:"menu-title",children:i.title}),i.rows.map((r)=>y("div",{className:"shortcuts-row",children:[p("span",{className:"shortcuts-keys",children:r.keys.map((o)=>p("kbd",{children:o},o))}),p("span",{children:r.what})]},r.what))]},i.title))})]})})});function k9(){J(()=>{let e=(t)=>{if(t.key!=="a"&&t.key!=="A")return;if(!t.metaKey&&!t.ctrlKey)return;if(t.altKey)return;let n=document.activeElement;if(!(n instanceof HTMLInputElement?n.type==="text"||n.type==="search"||n.type==="password"||n.type==="url":n instanceof HTMLTextAreaElement))return;t.preventDefault(),n.select()};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[])}function _9(e){let t=X(null),n=X(!0);return ti(()=>{let i=t.current;if(i!=null&&n.current)i.scrollTop=i.scrollHeight},[e.text]),p("pre",{ref:t,onScroll:(i)=>{let r=i.currentTarget;n.current=r.scrollHeight-r.scrollTop-r.clientHeight<8},children:e.text})}function C9(e){let[t,n]=W(!1),i=typeof navigator<"u"&&navigator.clipboard!=null;return J(()=>{if(!t)return;let r=setTimeout(()=>n(!1),1500);return()=>clearTimeout(r)},[t]),p("button",{type:"button",className:"live-preview-copy",disabled:!i,"data-tip":i?t?"copied":"copy the full prompt":"copy needs localhost or https",onClick:()=>{navigator.clipboard.writeText(e.text).then(()=>n(!0),(r)=>console.error("[comfy-ts] \uD83D\uDD34 copy failed:",r))},children:p(T,{name:t?"check":"copy"})})}var E9=q(function(t){let n=t.st.form,i=n==null?[]:t.st.moduleByKey(n.moduleKey)?.previews??[];if(n==null||i.length===0)return null;return p("div",{className:"live-previews",children:i.map((r)=>{let o=`${n.moduleKey}/${r}`,s=t.st.expandedPreviews.includes(o),l=n.previews[r]??"…",a=l.split(`
57
+ `).filter((c)=>c.trim()!==""),u=GT(l);return y("div",{className:"live-preview-row",children:[y("button",{type:"button",className:s?"live-preview expanded":"live-preview","data-tip":s?"click to show one line each":"click for the full text",onClick:()=>t.st.togglePreviewExpanded(o),children:[y("span",{className:"live-preview-name",children:[r,n.previewError==null?null:p("span",{className:"live-preview-error","data-tip":`preview failed: ${n.previewError}`,children:"\uD83D\uDD34"})]}),y("span",{className:"live-preview-lines",children:[!s?y(te,{children:[p("span",{className:"live-preview-line",children:u.positive}),p("span",{className:"live-preview-line negative",children:u.negative===""?"":`− ${u.negative}`})]}):null,s&&a.map((c,f)=>c.startsWith("- ")?y("span",{className:"live-preview-line negative",children:["− ",c.slice(2)]},f):p("span",{className:"live-preview-line",children:c},f))]})]}),p(C9,{text:l})]},r)})})}),O9={full:"image",corner:"panel-corner",off:"panel-off"},R9=q(function(t){return y("div",{className:"results-head",children:[y("div",{className:"head-group-labeled",children:[p("span",{className:"group-caption",children:"while running"}),p("span",{className:"row-inline head-row",children:p("span",{className:"btn-group",children:FR.map((n)=>p("button",{type:"button",className:t.st.latentMode===n.mode?"sel":"","data-tip":n.tip,onClick:()=>t.st.setLatentMode(n.mode),children:p(T,{name:O9[n.mode]})},n.mode))})})]}),y("label",{className:"cols-field","data-tip":"results side by side: 1 is one image as wide as this panel",children:[p(T,{name:"grid"}),p("input",{type:"number",min:1,max:8,step:1,value:t.st.resultsColumns,onChange:(n)=>{let i=Number(n.target.value);if(n.target.value!==""&&Number.isFinite(i))t.st.setResultsColumns(i)}}),"cols"]}),y("span",{className:"btn-group",children:[y("button",{type:"button",className:t.st.blurResults?"sel":"","data-tip":t.st.blurResults?"blurred until you hover: click for always clear":"always clear: click to blur until you hover",onClick:()=>t.st.toggleBlur(),children:[p(T,{name:t.st.blurResults?"eye-off":"eye"})," blur",y("span",{className:"kbd-hint",children:[Ee,xt["toggle-blur"]]})]}),p(XT,{st:t.st})]})]})}),A9=760;function T9(){let e=`(max-width: ${A9}px)`,[t,n]=W(()=>window.matchMedia(e).matches);return J(()=>{let i=window.matchMedia(e),r=()=>n(i.matches);return i.addEventListener("change",r),()=>i.removeEventListener("change",r)},[e]),t}var LL={getItem:(e)=>{try{return localStorage.getItem(e)}catch{return null}},setItem:(e,t)=>{try{localStorage.setItem(e,t)}catch{}}},M9=q(function(t){let n=t.left?"comfy-ts-split-left":"comfy-ts-split-right",i=cy({id:n,storage:LL}),r=p(pa,{id:"form",minSize:"30%",className:"split-panel split-form",children:t.form}),o=p(pa,{id:"results",defaultSize:"34%",minSize:"16%",className:"split-panel split-results",children:t.results});return y(Ph,{id:n,orientation:"horizontal",className:`work split split-${t.left?"left":"right"}`,defaultLayout:i.defaultLayout,onLayoutChanged:i.onLayoutChanged,children:[t.left?o:r,p(Ih,{className:"split-handle"}),t.left?r:o]},n)}),N9=48,DL=180,D9=q(function(t){let n=cy({id:"comfy-ts-menu",storage:LL}),i=zO(),[r,o]=W(!1);return J(()=>Tr(()=>t.st.renamingDraft!=null,(s)=>{let l=i.current;if(s&&l!=null&&l.isCollapsed())l.expand()}),[t.st,i]),J(()=>Tr(()=>t.st.menuFoldTick,()=>{let s=i.current;if(s==null)return;if(s.isCollapsed())s.expand();else s.collapse()}),[t.st,i]),y(Ph,{id:"comfy-ts-menu",orientation:"horizontal",className:"menu-layout",defaultLayout:n.defaultLayout,onLayoutChanged:n.onLayoutChanged,children:[p(pa,{id:"menu",panelRef:i,defaultSize:220,minSize:DL,maxSize:420,collapsible:!0,collapsedSize:N9,groupResizeBehavior:"preserve-pixel-size",onResize:(s)=>o(s.inPixels<DL-1),className:"menu-panel",children:r?p(zA,{st:t.st,onExpand:()=>i.current?.expand()}):y("div",{className:"menu-col",children:[p(Yy,{tip:`fold the menu to icons (${Ee}B), it stays folded in this browser`,keyHint:`${Ee}${xt["toggle-menu"]}`,onBurger:()=>i.current?.collapse()}),p(Wy,{st:t.st})]})}),p(Ih,{className:"split-handle"}),p(pa,{id:"main",minSize:"40%",className:"menu-main",children:t.main})]})}),L9=q(function(t){let n=t.st.form;return y("div",{className:"mobile-bar",children:[p("button",{type:"button",className:"head-icon","aria-label":"menu",onClick:()=>t.st.setMenuOpen(!0),children:p(T,{name:"menu"})}),y("button",{type:"button",className:"mobile-where",onClick:()=>t.st.omnibox.open(),children:[p("span",{className:"menu-value mobile-workflow",children:n?.moduleKey??"no workflow"}),n==null?null:y("span",{className:"mobile-draft",children:[" · ",n.draft]})]})]})}),z9=q(function(t){if(!t.st.menuOpen)return null;return p("div",{className:"drawer-overlay",onClick:()=>t.st.setMenuOpen(!1),children:y("div",{className:"drawer",onClick:(n)=>n.stopPropagation(),children:[p(Yy,{tip:"close the menu",keyHint:`${Ee}${xt["toggle-menu"]}`,onBurger:()=>t.st.setMenuOpen(!1)}),p(Wy,{st:t.st})]})})});function B9(e,t){J(()=>{let n=(i)=>{if(Vh(i)!=="toggle-menu")return;if(i.preventDefault(),t)e.setMenuOpen(!e.menuOpen);else e.requestMenuFold()};return window.addEventListener("keydown",n),()=>window.removeEventListener("keydown",n)},[e,t])}var zL=q(function(t){let n=T9();if(B9(t.st,n),EL(t.st),k9(),FA(t.st),t.st.phase==="loading")return p("div",{className:"center",children:"loading…"});if(t.st.phase==="error")return p("div",{className:"center",children:y("div",{className:"error",children:["\uD83D\uDD34 ",t.st.bootError]})});let i=t.st.layout,r=y("div",{className:"form-col",children:[p(CL,{st:t.st}),t.st.showLogs?y("div",{className:"logs",children:[y("div",{className:"logs-head",children:[y("span",{children:["console · ",t.st.hostFor(t.st.form?.moduleKey??"")||"host"]}),p("button",{type:"button",className:"link",onClick:()=>t.st.toggleLogs(),children:"hide"})]}),t.st.logsError!=null?y("div",{className:"error",children:["\uD83D\uDD34 ",t.st.logsError]}):null,p(_9,{text:t.st.logLines.join(`
58
+ `)})]}):null]}),o=y("div",{className:"results-col",children:[p(R9,{st:t.st}),t.st.generateInResults?p("div",{className:"results-run",children:p(uw,{st:t.st})}):null,p(E9,{st:t.st}),p(vp,{st:t.st}),p(KA,{st:t.st,compact:i==="pinned"})]}),s=y(te,{children:[t.st.formError!=null?y("div",{className:"center error",children:["\uD83D\uDD34 ",t.st.formError]}):null,t.st.formLoading&&t.st.form==null?p("div",{className:"center",children:"loading draft…"}):null,t.st.modules.length===0?p("div",{className:"center",children:"no workflow modules loaded"}):null]}),a=(i==="side"||i==="left")&&!n?p(M9,{st:t.st,left:i==="left",form:y(te,{children:[s,r]}),results:o}):y("div",{className:"main",children:[s,y("div",{className:`work layout-${i}`,children:[r,i==="off"?y("button",{type:"button",className:"show-preview","data-tip":"show the preview panel again",onClick:()=>t.st.showPreview(),children:[p(T,{name:"panel-side"})," preview"]}):o]})]});return y("div",{className:"app",children:[n?p(L9,{st:t.st}):null,p("div",{className:"cols",children:n?a:p(D9,{st:t.st,main:y("div",{className:"tabs-col",children:[p(OL,{st:t.st}),p("div",{className:"tabs-body",children:a})]})})}),n?p(z9,{st:t.st}):null,p(qA,{st:t.st}),p(NL,{st:t.st}),p($T,{})]})});var BL=`
58
59
  :root {
59
60
  --bg: #101217;
60
61
  --panel: #171a21;
61
62
  --panel-2: #1d2129;
62
63
  --border: #2a2f3a;
64
+ /* the chrome (menu, tabs bar, preview side): lifted off the work area by a cool tint and a
65
+ soft top light, split from it by hairlines instead of solid bands */
66
+ --chrome: linear-gradient(180deg, #1a1f2b 0%, #151922 40%, #13161d 100%);
67
+ --chrome-flat: #171b24;
68
+ --hairline: color-mix(in srgb, var(--border) 70%, transparent);
69
+ /* a picked option (segment, mode toggle): a tint of the accent, never a solid slab */
70
+ --sel-bg: color-mix(in srgb, var(--accent) 22%, var(--panel-2));
71
+ --sel-border: color-mix(in srgb, var(--accent) 55%, transparent);
72
+ --sel-text: #c3d3fb;
63
73
  --text: #e8eaf0;
64
74
  --dim: #8b93a7;
65
75
  --accent: #7aa2f7;
@@ -142,7 +152,7 @@ button.link.load-errors { color: var(--red); font-size: 11px; }
142
152
 
143
153
  /* the menu column: the TUI header on the web, one labelled card per scope, stacked */
144
154
  .menu-layout { flex: 1; min-width: 0; height: 100%; }
145
- .menu-panel { height: 100%; overflow-y: auto; overscroll-behavior: contain; background: var(--panel); border-right: 1px solid var(--border); }
155
+ .menu-panel { height: 100%; overflow-y: auto; overscroll-behavior: contain; background: var(--chrome); }
146
156
  .menu-main { height: 100%; display: flex; min-width: 0; }
147
157
  .menu-main > .main { height: 100%; }
148
158
  /* the open drafts as tabs over the work area. The body below takes the rest: the panel group
@@ -151,20 +161,18 @@ button.link.load-errors { color: var(--red); font-size: 11px; }
151
161
  .tabs-body { flex: 1; min-height: 0; display: flex; }
152
162
  .tabs-body > .main { height: 100%; }
153
163
  .draft-tabs {
154
- display: flex; gap: 0; padding: 4px 8px 0; overflow-x: auto; flex-shrink: 0;
155
- background: var(--panel); border-bottom: 1px solid var(--border);
164
+ display: flex; gap: 0; padding: 0; overflow-x: auto; flex-shrink: 0;
165
+ background: var(--chrome-flat); border-bottom: 1px solid var(--hairline);
156
166
  }
167
+ /* square segments split by hairlines, as tall as the menu head so both bottom lines meet. The
168
+ open one wears the btn-group pick: the accent tint and an accent underline */
157
169
  .draft-tab {
158
- display: inline-flex; align-items: center; gap: 3px; max-width: 220px; padding: 3px 4px 3px 9px;
159
- font-size: 13px; color: var(--dim); cursor: pointer; user-select: none; white-space: nowrap;
160
- border: 1px solid var(--border); border-bottom: 0; border-radius: 6px 6px 0 0; margin-bottom: -1px;
161
- position: relative;
170
+ display: inline-flex; align-items: center; gap: 4px; max-width: 240px; height: 44px; padding: 0 8px 0 14px;
171
+ font-size: 14px; color: var(--dim); cursor: pointer; user-select: none; white-space: nowrap;
172
+ border-right: 1px solid var(--hairline); position: relative;
162
173
  }
163
- /* neighbours share one border line, the open tab draws its own on top */
164
- .draft-tab + .draft-tab { margin-left: -1px; }
165
- .draft-tab.on { z-index: 1; }
166
174
  .draft-tab:hover { color: var(--text); background: var(--panel-2); }
167
- .draft-tab.on { color: var(--text); background: var(--bg); border-color: var(--border); }
175
+ .draft-tab.on { color: var(--sel-text); background: var(--sel-bg); box-shadow: inset 0 -2px 0 var(--accent); }
168
176
  .draft-tab-name { overflow: hidden; text-overflow: ellipsis; }
169
177
  .draft-tab-wf { color: var(--dim); font-size: 11px; }
170
178
  .draft-tab button.draft-tab-close {
@@ -182,7 +190,7 @@ button.link.load-errors { color: var(--red); font-size: 11px; }
182
190
  .tab-menu .menu-action.danger:hover { color: var(--red); }
183
191
  .menu-col { padding: 0 0 14px; }
184
192
  /* ☰ + the name: the same height as the rail's first icon, so folding never moves it */
185
- .menu-head { display: flex; align-items: center; gap: 8px; height: 44px; padding: 0 10px; border-bottom: 1px solid var(--border); }
193
+ .menu-head { display: flex; align-items: center; gap: 8px; height: 44px; padding: 0 10px; border-bottom: 1px solid var(--hairline); }
186
194
  .menu-brand { font-weight: 700; letter-spacing: 0.01em; }
187
195
  .menu-head-key { margin-left: auto; }
188
196
  /* a full-row action (duplicate, new): reads as an entry of the list, its key at the end */
@@ -199,7 +207,7 @@ button.link.load-errors { color: var(--red); font-size: 11px; }
199
207
  .layout-tile:hover { color: var(--text); background: var(--panel-2); }
200
208
  .layout-tile.sel { color: var(--accent); border-color: var(--accent); background: var(--accent-dim); font-weight: 600; }
201
209
  .menu-sections { display: flex; flex-direction: column; }
202
- .menu-section { padding: 10px 10px 12px; border-bottom: 1px solid var(--border); display: flex; flex-direction: column; gap: 2px; }
210
+ .menu-section { padding: 10px 10px 12px; border-bottom: 1px solid var(--hairline); display: flex; flex-direction: column; gap: 2px; }
203
211
  .menu-title {
204
212
  display: flex; align-items: center; justify-content: space-between; min-height: 24px; padding: 0 4px;
205
213
  color: var(--dim); font-size: 10.5px; letter-spacing: 0.07em; text-transform: uppercase;
@@ -305,7 +313,12 @@ button.var-reset:disabled { opacity: 0.25; cursor: default; }
305
313
  /* the label IS the drag handle for its row: no separate grip to reveal or aim at */
306
314
  /* labels never wrap: one line at the height of a control, cut with an ellipsis, whole on hover.
307
315
  The icon and the (?) keep their size, only the name gives way */
308
- .var-label { display: flex; align-items: center; justify-content: flex-end; min-height: 28px; min-width: 0; cursor: grab; }
316
+ /* a drag handle never selects its text: WebKit starts a text selection instead of the drag
317
+ when the press lands on selectable text */
318
+ .var-label {
319
+ display: flex; align-items: center; justify-content: flex-end; min-height: 28px; min-width: 0; cursor: grab;
320
+ user-select: none; -webkit-user-select: none; -webkit-user-drag: element;
321
+ }
309
322
  .var-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
310
323
  /* the ⌘ key that jumps to this var, on its own line under the name */
311
324
  .var-label.has-kbd { flex-wrap: wrap; align-content: center; row-gap: 3px; }
@@ -313,7 +326,7 @@ button.var-reset:disabled { opacity: 0.25; cursor: default; }
313
326
  .var-row.inactive .var-control { opacity: 0.18; filter: grayscale(1); }
314
327
  .var-row.inactive .var-label { opacity: 0.45; }
315
328
  .var-label:active { cursor: grabbing; }
316
- .lora-chip[draggable='true'] { cursor: grab; }
329
+ .lora-chip[draggable='true'] { cursor: grab; user-select: none; -webkit-user-select: none; -webkit-user-drag: element; }
317
330
  /* the card drags from anywhere, so its own controls must keep their cursor */
318
331
  .lora-chip input, .lora-chip label, .lora-chip button { cursor: pointer; }
319
332
  .lora-chip input[type='number'] { cursor: text; }
@@ -327,6 +340,9 @@ button.var-reset:disabled { opacity: 0.25; cursor: default; }
327
340
  }
328
341
  .var-label .dirty-dot:hover { background: var(--red); }
329
342
  .var-control { min-width: 0; }
343
+ /* a one-line control sits on the label's 28px line: rows align to the top, so a shorter line
344
+ (a toggle and its word) floated above the label's centre */
345
+ .var-control > .row-inline { min-height: 28px; }
330
346
  /* a workflow's own icons: beside a label, or inside a choice button */
331
347
  .var-icon { width: 15px; height: 15px; margin-right: 5px; flex-shrink: 0; }
332
348
  .btn-group button .var-icon { margin-right: 3px; }
@@ -349,7 +365,35 @@ input[type='range'] { width: 100%; accent-color: var(--accent); }
349
365
  /* a steps or cfg slider across a whole wide row is a long drag for a small number: 320px is
350
366
  still a fine grain for 1..60, and the number box keeps its place right after it */
351
367
  .var-control input[type='range'] { max-width: 320px; }
352
- input[type='checkbox'] { accent-color: var(--accent); width: 16px; height: 16px; }
368
+ /* a number var's slider: a thin dark track, the accent up to the value, a small dot */
369
+ input[type='range'].num-range {
370
+ appearance: none; height: 16px; margin: 0; padding: 0; cursor: pointer; border-radius: 2px;
371
+ background-color: transparent; background-size: 100% 4px; background-position: center; background-repeat: no-repeat;
372
+ }
373
+ input[type='range'].num-range::-webkit-slider-runnable-track { height: 4px; background: transparent; }
374
+ input[type='range'].num-range::-webkit-slider-thumb {
375
+ appearance: none; width: 14px; height: 14px; border-radius: 50%; margin-top: -5px;
376
+ background: var(--accent); border: 2px solid var(--bg); box-shadow: 0 0 0 1px var(--accent-dim);
377
+ }
378
+ input[type='range'].num-range:hover::-webkit-slider-thumb { box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 25%, transparent); }
379
+ input[type='range'].num-range::-moz-range-track { height: 4px; background: transparent; }
380
+ input[type='range'].num-range::-moz-range-thumb {
381
+ width: 10px; height: 10px; border-radius: 50%; background: var(--accent); border: 2px solid var(--bg);
382
+ }
383
+ /* every checkbox is drawn as a toggle, the same pill as .switch: the native box was the one
384
+ control on the page still in the browser's own chrome */
385
+ input[type='checkbox'] {
386
+ appearance: none; position: relative; flex-shrink: 0; width: 36px; height: 20px; margin: 0; align-self: center;
387
+ border-radius: 999px; background: var(--panel-2); border: 1px solid var(--border); cursor: pointer;
388
+ vertical-align: middle; transition: background 0.15s, border-color 0.15s;
389
+ }
390
+ input[type='checkbox']::before {
391
+ content: ''; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%;
392
+ background: var(--dim); transition: transform 0.15s, background 0.15s;
393
+ }
394
+ input[type='checkbox']:checked { background: var(--sel-bg); border-color: var(--sel-border); }
395
+ input[type='checkbox']:checked::before { transform: translateX(16px); background: var(--accent); }
396
+ input[type='checkbox']:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
353
397
  .row-inline { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
354
398
  /* lanes (src/vars/lanes.ts): named groups merged top to bottom. Each lane is a BAND: a tinted
355
399
  strip, its name as plain small text on the left (clickable, not dressed as a button: click
@@ -464,7 +508,7 @@ button.link { border: 0; background: none; color: var(--accent); padding: 0; }
464
508
  button.link.danger { color: var(--dim); }
465
509
  button.link.danger:hover { color: var(--red); }
466
510
  button.mode { padding: 2px 7px; font-size: 12px; }
467
- button.mode.sel { background: var(--accent); border-color: var(--accent); color: #0d1117; }
511
+ button.mode.sel { background: var(--sel-bg); border-color: var(--sel-border); color: var(--sel-text); }
468
512
  /* the actions that START something (new draft, add loras): accent outline, so the eye finds
469
513
  them before the neutral ones. The lit segment of a group is a solid accent fill */
470
514
  button.accent { color: var(--accent); border-color: var(--accent-dim); }
@@ -493,6 +537,12 @@ button.accent:hover { background: var(--accent-dim); color: #fff; }
493
537
  button.run-end { display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; font-size: 13px; }
494
538
  button.run-end:not(:disabled):hover { color: #fff; background: var(--red); border-color: var(--red); }
495
539
  button.run-end:disabled { opacity: 0.45; cursor: default; }
540
+ .run-error-block {
541
+ display: flex; align-items: flex-start; gap: 8px; margin: 8px 0; padding: 8px 10px;
542
+ border: 1px solid var(--red); border-radius: 8px; color: var(--red); font-size: 12px;
543
+ }
544
+ .run-error-block > .icon { flex-shrink: 0; margin-top: 2px; }
545
+ .run-error-text { flex: 1; min-width: 0; margin: 0; font: inherit; white-space: pre-wrap; overflow-wrap: anywhere; user-select: text; }
496
546
  .run-error { flex: 1; min-width: 0; height: 1.4em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--red); font-size: 12px; }
497
547
  input[type='range'].setting-range:disabled { opacity: 0.3; }
498
548
  .live-preview-error { margin-left: 4px; }
@@ -704,6 +754,17 @@ button.live-preview-copy:not(:disabled):hover { color: var(--text); border-color
704
754
  height, so typing a filter or hiding images never moves it */
705
755
  .modal-overlay.top { align-items: flex-start; padding-top: 5vh; }
706
756
  .modal.loras-modal { height: min(86vh, 100%); max-height: none; }
757
+ .modal.shortcuts-modal { width: min(640px, 100%); max-height: min(86vh, 100%); }
758
+ .shortcuts-modal .modal-head { align-items: center; }
759
+ .shortcuts-title { flex: 1; font-weight: 600; }
760
+ .shortcuts-body { overflow-y: auto; padding: 4px 14px 14px; }
761
+ .shortcuts-group { padding-top: 10px; }
762
+ .shortcuts-row { display: flex; align-items: baseline; gap: 12px; padding: 4px 0; font-size: 13px; }
763
+ .shortcuts-keys { display: inline-flex; flex-wrap: wrap; gap: 4px; width: 200px; flex-shrink: 0; }
764
+ .shortcuts-row kbd {
765
+ font: 12px ui-monospace, SFMono-Regular, Menlo, monospace; padding: 1px 6px; border-radius: 5px;
766
+ background: var(--panel-2); border: 1px solid var(--border); border-bottom-width: 2px; color: var(--text);
767
+ }
707
768
  .modal.loras-modal { width: min(1180px, 100%); }
708
769
  /* the palette sits BESIDE the gallery, each scrolling alone: picking a lora grows the palette
709
770
  and never moves a card under the pointer. Narrow: a fixed-height strip above, same reason */
@@ -911,6 +972,17 @@ button.enh-big { font-size: 14px; padding: 8px 18px; }
911
972
  font-size: 13px; padding: 2px 8px; color: #fff; opacity: 0.85; background: rgba(0, 0, 0, 0.35);
912
973
  }
913
974
  .img-button:hover .blur-hint { display: none; }
975
+ /* an unsaved output: only the serve process holds it, so it says so where the eye lands */
976
+ .gallery .img-button, .audio-cell { position: relative; }
977
+ .ephemeral-pill {
978
+ position: absolute; left: 6px; bottom: 6px; pointer-events: auto; display: inline-flex; align-items: center; gap: 4px;
979
+ font-size: 11px; font-weight: 600; padding: 1px 7px; border-radius: 999px;
980
+ color: #1a1400; background: var(--amber); opacity: 0.92;
981
+ }
982
+ .audio-cell .ephemeral-pill { position: static; align-self: flex-start; }
983
+ .memory-menu { max-width: 300px; }
984
+ .memory-note { margin: 0; padding: 2px 4px; font-size: 12px; line-height: 1.4; }
985
+ .memory-note.error { color: var(--red); }
914
986
  /* bigger control buttons: the preview head and the menu column, one size with the form rows */
915
987
  .results-head .btn-group > button, .menu-section .btn-group > button, .menu-panel button.head-icon, .drawer button.head-icon {
916
988
  height: 28px; min-width: 28px; font-size: 13px;
@@ -966,13 +1038,16 @@ button.enh-big { font-size: 14px; padding: 8px 18px; }
966
1038
  .work.split { flex: 1; min-width: 0; height: 100%; gap: 0; align-items: stretch; }
967
1039
  .split-panel { height: 100%; overflow-y: auto; overscroll-behavior: contain; }
968
1040
  .split-form { padding: 12px 14px 14px; }
969
- .split-results { background: var(--panel); padding: 10px 12px; }
1041
+ .split-results { background: var(--chrome); padding: 10px 12px; }
970
1042
  .work.split .results-col {
971
1043
  position: static; width: auto; max-height: none; overflow: visible;
972
1044
  background: none; border: 0; border-radius: 0; padding: 0;
973
1045
  }
974
- .split-handle { width: 5px; background: var(--border); cursor: col-resize; transition: background 0.1s; }
975
- .split-handle:hover, .split-handle[data-separator-state='drag'] { background: var(--accent); }
1046
+ .split-handle {
1047
+ width: 5px; cursor: col-resize; transition: background 0.1s;
1048
+ background: linear-gradient(90deg, transparent 2px, var(--hairline) 2px, var(--hairline) 3px, transparent 3px);
1049
+ }
1050
+ .split-handle:hover, .split-handle[data-separator-state='drag'] { background: var(--accent-dim); }
976
1051
 
977
1052
  /* the placements. Each one is a BUTTON and nothing else: there is no width rule that quietly
978
1053
  moves the panel somewhere no button is showing */
@@ -1039,11 +1114,11 @@ button.enh-big { font-size: 14px; padding: 8px 18px; }
1039
1114
  }
1040
1115
  .btn-group button:first-child { border-top-left-radius: 6px; border-bottom-left-radius: 6px; }
1041
1116
  .btn-group button:last-child { border-right-width: 1px; border-top-right-radius: 6px; border-bottom-right-radius: 6px; }
1042
- .btn-group button.sel { background: var(--accent); border-color: var(--accent); color: #0d1117; font-weight: 600; }
1117
+ .btn-group button.sel { background: var(--sel-bg); border-color: var(--sel-border); color: var(--sel-text); font-weight: 600; }
1043
1118
  /* the selected segment owns the divider on both sides, else its highlight looks clipped */
1044
- .btn-group button.sel + button { border-left-color: var(--accent); }
1119
+ .btn-group button.sel + button { border-left-color: var(--sel-border); }
1045
1120
  .btn-group button:hover { background: var(--panel); }
1046
- .btn-group button.sel:hover { background: var(--accent); }
1121
+ .btn-group button.sel:hover { background: var(--sel-bg); }
1047
1122
  /* ONE height for every button a var row shows in a group or an action line: a choice, the
1048
1123
  lora toggles, a lane header, the seed modes. Before, each kind had its own padding and a
1049
1124
  choice sat visibly smaller than the toggles beside it */
@@ -1097,7 +1172,7 @@ button.head-icon.danger:hover { color: var(--red); border-color: var(--red); }
1097
1172
  content: ''; position: absolute; top: 1px; left: 1px; width: 12px; height: 12px; border-radius: 50%;
1098
1173
  background: var(--dim); transition: transform 0.15s, background 0.15s;
1099
1174
  }
1100
- .switch input:checked + .track { background: var(--accent-dim); border-color: var(--accent); }
1175
+ .switch input:checked + .track { background: var(--sel-bg); border-color: var(--sel-border); }
1101
1176
  .switch input:checked + .track::after { transform: translateX(12px); background: var(--accent); }
1102
1177
  .switch input:focus-visible + .track { outline: 2px solid var(--accent); outline-offset: 2px; }
1103
1178
 
@@ -1191,4 +1266,4 @@ button .icon + * { margin-left: 4px; }
1191
1266
  .enh-grid { grid-template-columns: minmax(0, 1fr); }
1192
1267
  .enh-grid > label { text-align: left; }
1193
1268
  }
1194
- `;var pL=document.createElement("style");pL.textContent=hL;document.head.appendChild(pL);var mL=new H0;globalThis.webst=mL;var gL=document.getElementById("root");if(gL==null)throw Error("[serve web] #root element missing from the shell html");kb(gL).render(p(dL,{st:mL}));
1269
+ `;var PL=document.createElement("style");PL.textContent=BL;document.head.appendChild(PL);var IL=new Gy;globalThis.webst=IL;var HL=document.getElementById("root");if(HL==null)throw Error("[serve web] #root element missing from the shell html");Ab(HL).render(p(zL,{st:IL}));