import"./modulepreload-polyfill-B5Qt9EMX.js";import{f as Av,b as zv,k as Mv}from"./bootstrap-DlNJH-GE.js";function yh(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var bh={exports:{}},qs={};/**
 * @license React
 * react-jsx-runtime.production.js
 *
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */var Nv=Symbol.for("react.transitional.element"),Rv=Symbol.for("react.fragment");function xh(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 a in t)a!=="key"&&(n[a]=t[a])}else n=t;return t=n.ref,{$$typeof:Nv,type:e,key:i,ref:t!==void 0?t:null,props:n}}qs.Fragment=Rv;qs.jsx=xh;qs.jsxs=xh;bh.exports=qs;var r=bh.exports,Sh={exports:{}},B={};/**
 * @license React
 * react.production.js
 *
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */var ju=Symbol.for("react.transitional.element"),Iv=Symbol.for("react.portal"),Uv=Symbol.for("react.fragment"),Lv=Symbol.for("react.strict_mode"),Hv=Symbol.for("react.profiler"),Bv=Symbol.for("react.consumer"),$v=Symbol.for("react.context"),qv=Symbol.for("react.forward_ref"),Yv=Symbol.for("react.suspense"),Gv=Symbol.for("react.memo"),wh=Symbol.for("react.lazy"),Vv=Symbol.for("react.activity"),Mc=Symbol.iterator;function Kv(e){return e===null||typeof e!="object"?null:(e=Mc&&e[Mc]||e["@@iterator"],typeof e=="function"?e:null)}var jh={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},kh=Object.assign,Th={};function Wi(e,t,n){this.props=e,this.context=t,this.refs=Th,this.updater=n||jh}Wi.prototype.isReactComponent={};Wi.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")};Wi.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function Eh(){}Eh.prototype=Wi.prototype;function ku(e,t,n){this.props=e,this.context=t,this.refs=Th,this.updater=n||jh}var Tu=ku.prototype=new Eh;Tu.constructor=ku;kh(Tu,Wi.prototype);Tu.isPureReactComponent=!0;var Nc=Array.isArray;function vo(){}var re={H:null,A:null,T:null,S:null},Ch=Object.prototype.hasOwnProperty;function Eu(e,t,n){var i=n.ref;return{$$typeof:ju,type:e,key:t,ref:i!==void 0?i:null,props:n}}function Xv(e,t){return Eu(e.type,t,e.props)}function Cu(e){return typeof e=="object"&&e!==null&&e.$$typeof===ju}function Qv(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(n){return t[n]})}var Rc=/\/+/g;function hr(e,t){return typeof e=="object"&&e!==null&&e.key!=null?Qv(""+e.key):t.toString(36)}function Zv(e){switch(e.status){case"fulfilled":return e.value;case"rejected":throw e.reason;default:switch(typeof e.status=="string"?e.then(vo,vo):(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 gi(e,t,n,i,a){var l=typeof e;(l==="undefined"||l==="boolean")&&(e=null);var s=!1;if(e===null)s=!0;else switch(l){case"bigint":case"string":case"number":s=!0;break;case"object":switch(e.$$typeof){case ju:case Iv:s=!0;break;case wh:return s=e._init,gi(s(e._payload),t,n,i,a)}}if(s)return a=a(e),s=i===""?"."+hr(e,0):i,Nc(a)?(n="",s!=null&&(n=s.replace(Rc,"$&/")+"/"),gi(a,t,n,"",function(d){return d})):a!=null&&(Cu(a)&&(a=Xv(a,n+(a.key==null||e&&e.key===a.key?"":(""+a.key).replace(Rc,"$&/")+"/")+s)),t.push(a)),1;s=0;var o=i===""?".":i+":";if(Nc(e))for(var u=0;u<e.length;u++)i=e[u],l=o+hr(i,u),s+=gi(i,t,n,l,a);else if(u=Kv(e),typeof u=="function")for(e=u.call(e),u=0;!(i=e.next()).done;)i=i.value,l=o+hr(i,u++),s+=gi(i,t,n,l,a);else if(l==="object"){if(typeof e.then=="function")return gi(Zv(e),t,n,i,a);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 cl(e,t,n){if(e==null)return e;var i=[],a=0;return gi(e,i,"","",function(l){return t.call(n,l,a++)}),i}function Jv(e){if(e._status===-1){var t=e._result;t=t(),t.then(function(n){(e._status===0||e._status===-1)&&(e._status=1,e._result=n)},function(n){(e._status===0||e._status===-1)&&(e._status=2,e._result=n)}),e._status===-1&&(e._status=0,e._result=t)}if(e._status===1)return e._result.default;throw e._result}var Ic=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)},Fv={map:cl,forEach:function(e,t,n){cl(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return cl(e,function(){t++}),t},toArray:function(e){return cl(e,function(t){return t})||[]},only:function(e){if(!Cu(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};B.Activity=Vv;B.Children=Fv;B.Component=Wi;B.Fragment=Uv;B.Profiler=Hv;B.PureComponent=ku;B.StrictMode=Lv;B.Suspense=Yv;B.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=re;B.__COMPILER_RUNTIME={__proto__:null,c:function(e){return re.H.useMemoCache(e)}};B.cache=function(e){return function(){return e.apply(null,arguments)}};B.cacheSignal=function(){return null};B.cloneElement=function(e,t,n){if(e==null)throw Error("The argument must be a React element, but you passed "+e+".");var i=kh({},e.props),a=e.key;if(t!=null)for(l in t.key!==void 0&&(a=""+t.key),t)!Ch.call(t,l)||l==="key"||l==="__self"||l==="__source"||l==="ref"&&t.ref===void 0||(i[l]=t[l]);var l=arguments.length-2;if(l===1)i.children=n;else if(1<l){for(var s=Array(l),o=0;o<l;o++)s[o]=arguments[o+2];i.children=s}return Eu(e.type,a,i)};B.createContext=function(e){return e={$$typeof:$v,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null},e.Provider=e,e.Consumer={$$typeof:Bv,_context:e},e};B.createElement=function(e,t,n){var i,a={},l=null;if(t!=null)for(i in t.key!==void 0&&(l=""+t.key),t)Ch.call(t,i)&&i!=="key"&&i!=="__self"&&i!=="__source"&&(a[i]=t[i]);var s=arguments.length-2;if(s===1)a.children=n;else if(1<s){for(var o=Array(s),u=0;u<s;u++)o[u]=arguments[u+2];a.children=o}if(e&&e.defaultProps)for(i in s=e.defaultProps,s)a[i]===void 0&&(a[i]=s[i]);return Eu(e,l,a)};B.createRef=function(){return{current:null}};B.forwardRef=function(e){return{$$typeof:qv,render:e}};B.isValidElement=Cu;B.lazy=function(e){return{$$typeof:wh,_payload:{_status:-1,_result:e},_init:Jv}};B.memo=function(e,t){return{$$typeof:Gv,type:e,compare:t===void 0?null:t}};B.startTransition=function(e){var t=re.T,n={};re.T=n;try{var i=e(),a=re.S;a!==null&&a(n,i),typeof i=="object"&&i!==null&&typeof i.then=="function"&&i.then(vo,Ic)}catch(l){Ic(l)}finally{t!==null&&n.types!==null&&(t.types=n.types),re.T=t}};B.unstable_useCacheRefresh=function(){return re.H.useCacheRefresh()};B.use=function(e){return re.H.use(e)};B.useActionState=function(e,t,n){return re.H.useActionState(e,t,n)};B.useCallback=function(e,t){return re.H.useCallback(e,t)};B.useContext=function(e){return re.H.useContext(e)};B.useDebugValue=function(){};B.useDeferredValue=function(e,t){return re.H.useDeferredValue(e,t)};B.useEffect=function(e,t){return re.H.useEffect(e,t)};B.useEffectEvent=function(e){return re.H.useEffectEvent(e)};B.useId=function(){return re.H.useId()};B.useImperativeHandle=function(e,t,n){return re.H.useImperativeHandle(e,t,n)};B.useInsertionEffect=function(e,t){return re.H.useInsertionEffect(e,t)};B.useLayoutEffect=function(e,t){return re.H.useLayoutEffect(e,t)};B.useMemo=function(e,t){return re.H.useMemo(e,t)};B.useOptimistic=function(e,t){return re.H.useOptimistic(e,t)};B.useReducer=function(e,t,n){return re.H.useReducer(e,t,n)};B.useRef=function(e){return re.H.useRef(e)};B.useState=function(e){return re.H.useState(e)};B.useSyncExternalStore=function(e,t,n){return re.H.useSyncExternalStore(e,t,n)};B.useTransition=function(){return re.H.useTransition()};B.version="19.2.6";Sh.exports=B;var x=Sh.exports;const Oh=yh(x);var Dh={exports:{}},Ys={},_h={exports:{}},Ah={};/**
 * @license React
 * scheduler.production.js
 *
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */(function(e){function t(O,R){var L=O.length;O.push(R);e:for(;0<L;){var ie=L-1>>>1,ue=O[ie];if(0<a(ue,R))O[ie]=R,O[L]=ue,L=ie;else break e}}function n(O){return O.length===0?null:O[0]}function i(O){if(O.length===0)return null;var R=O[0],L=O.pop();if(L!==R){O[0]=L;e:for(var ie=0,ue=O.length,en=ue>>>1;ie<en;){var tn=2*(ie+1)-1,D=O[tn],N=tn+1,V=O[N];if(0>a(D,L))N<ue&&0>a(V,D)?(O[ie]=V,O[N]=L,ie=N):(O[ie]=D,O[tn]=L,ie=tn);else if(N<ue&&0>a(V,L))O[ie]=V,O[N]=L,ie=N;else break e}}return R}function a(O,R){var L=O.sortIndex-R.sortIndex;return L!==0?L:O.id-R.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var l=performance;e.unstable_now=function(){return l.now()}}else{var s=Date,o=s.now();e.unstable_now=function(){return s.now()-o}}var u=[],d=[],g=1,p=null,h=3,f=!1,y=!1,v=!1,S=!1,c=typeof setTimeout=="function"?setTimeout:null,m=typeof clearTimeout=="function"?clearTimeout:null,w=typeof setImmediate<"u"?setImmediate:null;function b(O){for(var R=n(d);R!==null;){if(R.callback===null)i(d);else if(R.startTime<=O)i(d),R.sortIndex=R.expirationTime,t(u,R);else break;R=n(d)}}function j(O){if(v=!1,b(O),!y)if(n(u)!==null)y=!0,k||(k=!0,z());else{var R=n(d);R!==null&&te(j,R.startTime-O)}}var k=!1,T=-1,_=5,A=-1;function I(){return S?!0:!(e.unstable_now()-A<_)}function Q(){if(S=!1,k){var O=e.unstable_now();A=O;var R=!0;try{e:{y=!1,v&&(v=!1,m(T),T=-1),f=!0;var L=h;try{t:{for(b(O),p=n(u);p!==null&&!(p.expirationTime>O&&I());){var ie=p.callback;if(typeof ie=="function"){p.callback=null,h=p.priorityLevel;var ue=ie(p.expirationTime<=O);if(O=e.unstable_now(),typeof ue=="function"){p.callback=ue,b(O),R=!0;break t}p===n(u)&&i(u),b(O)}else i(u);p=n(u)}if(p!==null)R=!0;else{var en=n(d);en!==null&&te(j,en.startTime-O),R=!1}}break e}finally{p=null,h=L,f=!1}R=void 0}}finally{R?z():k=!1}}}var z;if(typeof w=="function")z=function(){w(Q)};else if(typeof MessageChannel<"u"){var C=new MessageChannel,M=C.port2;C.port1.onmessage=Q,z=function(){M.postMessage(null)}}else z=function(){c(Q,0)};function te(O,R){T=c(function(){O(e.unstable_now())},R)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(O){O.callback=null},e.unstable_forceFrameRate=function(O){0>O||125<O?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):_=0<O?Math.floor(1e3/O):5},e.unstable_getCurrentPriorityLevel=function(){return h},e.unstable_next=function(O){switch(h){case 1:case 2:case 3:var R=3;break;default:R=h}var L=h;h=R;try{return O()}finally{h=L}},e.unstable_requestPaint=function(){S=!0},e.unstable_runWithPriority=function(O,R){switch(O){case 1:case 2:case 3:case 4:case 5:break;default:O=3}var L=h;h=O;try{return R()}finally{h=L}},e.unstable_scheduleCallback=function(O,R,L){var ie=e.unstable_now();switch(typeof L=="object"&&L!==null?(L=L.delay,L=typeof L=="number"&&0<L?ie+L:ie):L=ie,O){case 1:var ue=-1;break;case 2:ue=250;break;case 5:ue=1073741823;break;case 4:ue=1e4;break;default:ue=5e3}return ue=L+ue,O={id:g++,callback:R,priorityLevel:O,startTime:L,expirationTime:ue,sortIndex:-1},L>ie?(O.sortIndex=L,t(d,O),n(u)===null&&O===n(d)&&(v?(m(T),T=-1):v=!0,te(j,L-ie))):(O.sortIndex=ue,t(u,O),y||f||(y=!0,k||(k=!0,z()))),O},e.unstable_shouldYield=I,e.unstable_wrapCallback=function(O){var R=h;return function(){var L=h;h=R;try{return O.apply(this,arguments)}finally{h=L}}}})(Ah);_h.exports=Ah;var Pv=_h.exports,zh={exports:{}},Le={};/**
 * @license React
 * react-dom.production.js
 *
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */var Wv=x;function Mh(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 nn(){}var Ue={d:{f:nn,r:function(){throw Error(Mh(522))},D:nn,C:nn,L:nn,m:nn,X:nn,S:nn,M:nn},p:0,findDOMNode:null},ey=Symbol.for("react.portal");function ty(e,t,n){var i=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:ey,key:i==null?null:""+i,children:e,containerInfo:t,implementation:n}}var wa=Wv.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function Gs(e,t){if(e==="font")return"";if(typeof t=="string")return t==="use-credentials"?t:""}Le.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=Ue;Le.createPortal=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(Mh(299));return ty(e,t,null,n)};Le.flushSync=function(e){var t=wa.T,n=Ue.p;try{if(wa.T=null,Ue.p=2,e)return e()}finally{wa.T=t,Ue.p=n,Ue.d.f()}};Le.preconnect=function(e,t){typeof e=="string"&&(t?(t=t.crossOrigin,t=typeof t=="string"?t==="use-credentials"?t:"":void 0):t=null,Ue.d.C(e,t))};Le.prefetchDNS=function(e){typeof e=="string"&&Ue.d.D(e)};Le.preinit=function(e,t){if(typeof e=="string"&&t&&typeof t.as=="string"){var n=t.as,i=Gs(n,t.crossOrigin),a=typeof t.integrity=="string"?t.integrity:void 0,l=typeof t.fetchPriority=="string"?t.fetchPriority:void 0;n==="style"?Ue.d.S(e,typeof t.precedence=="string"?t.precedence:void 0,{crossOrigin:i,integrity:a,fetchPriority:l}):n==="script"&&Ue.d.X(e,{crossOrigin:i,integrity:a,fetchPriority:l,nonce:typeof t.nonce=="string"?t.nonce:void 0})}};Le.preinitModule=function(e,t){if(typeof e=="string")if(typeof t=="object"&&t!==null){if(t.as==null||t.as==="script"){var n=Gs(t.as,t.crossOrigin);Ue.d.M(e,{crossOrigin:n,integrity:typeof t.integrity=="string"?t.integrity:void 0,nonce:typeof t.nonce=="string"?t.nonce:void 0})}}else t==null&&Ue.d.M(e)};Le.preload=function(e,t){if(typeof e=="string"&&typeof t=="object"&&t!==null&&typeof t.as=="string"){var n=t.as,i=Gs(n,t.crossOrigin);Ue.d.L(e,n,{crossOrigin:i,integrity:typeof t.integrity=="string"?t.integrity:void 0,nonce:typeof t.nonce=="string"?t.nonce:void 0,type:typeof t.type=="string"?t.type:void 0,fetchPriority:typeof t.fetchPriority=="string"?t.fetchPriority:void 0,referrerPolicy:typeof t.referrerPolicy=="string"?t.referrerPolicy:void 0,imageSrcSet:typeof t.imageSrcSet=="string"?t.imageSrcSet:void 0,imageSizes:typeof t.imageSizes=="string"?t.imageSizes:void 0,media:typeof t.media=="string"?t.media:void 0})}};Le.preloadModule=function(e,t){if(typeof e=="string")if(t){var n=Gs(t.as,t.crossOrigin);Ue.d.m(e,{as:typeof t.as=="string"&&t.as!=="script"?t.as:void 0,crossOrigin:n,integrity:typeof t.integrity=="string"?t.integrity:void 0})}else Ue.d.m(e)};Le.requestFormReset=function(e){Ue.d.r(e)};Le.unstable_batchedUpdates=function(e,t){return e(t)};Le.useFormState=function(e,t,n){return wa.H.useFormState(e,t,n)};Le.useFormStatus=function(){return wa.H.useHostTransitionStatus()};Le.version="19.2.6";function Nh(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(Nh)}catch(e){console.error(e)}}Nh(),zh.exports=Le;var Rh=zh.exports;/**
 * @license React
 * react-dom-client.production.js
 *
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */var we=Pv,Ih=x,ny=Rh;function E(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 Uh(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function Pa(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,t.flags&4098&&(n=t.return),e=t.return;while(e)}return t.tag===3?n:null}function Lh(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 Hh(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 Uc(e){if(Pa(e)!==e)throw Error(E(188))}function iy(e){var t=e.alternate;if(!t){if(t=Pa(e),t===null)throw Error(E(188));return t!==e?null:e}for(var n=e,i=t;;){var a=n.return;if(a===null)break;var l=a.alternate;if(l===null){if(i=a.return,i!==null){n=i;continue}break}if(a.child===l.child){for(l=a.child;l;){if(l===n)return Uc(a),e;if(l===i)return Uc(a),t;l=l.sibling}throw Error(E(188))}if(n.return!==i.return)n=a,i=l;else{for(var s=!1,o=a.child;o;){if(o===n){s=!0,n=a,i=l;break}if(o===i){s=!0,i=a,n=l;break}o=o.sibling}if(!s){for(o=l.child;o;){if(o===n){s=!0,n=l,i=a;break}if(o===i){s=!0,i=l,n=a;break}o=o.sibling}if(!s)throw Error(E(189))}}if(n.alternate!==i)throw Error(E(190))}if(n.tag!==3)throw Error(E(188));return n.stateNode.current===n?e:t}function Bh(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=Bh(e),t!==null)return t;e=e.sibling}return null}var oe=Object.assign,ay=Symbol.for("react.element"),dl=Symbol.for("react.transitional.element"),va=Symbol.for("react.portal"),yi=Symbol.for("react.fragment"),$h=Symbol.for("react.strict_mode"),yo=Symbol.for("react.profiler"),qh=Symbol.for("react.consumer"),$t=Symbol.for("react.context"),Ou=Symbol.for("react.forward_ref"),bo=Symbol.for("react.suspense"),xo=Symbol.for("react.suspense_list"),Du=Symbol.for("react.memo"),ln=Symbol.for("react.lazy"),So=Symbol.for("react.activity"),ly=Symbol.for("react.memo_cache_sentinel"),Lc=Symbol.iterator;function ra(e){return e===null||typeof e!="object"?null:(e=Lc&&e[Lc]||e["@@iterator"],typeof e=="function"?e:null)}var sy=Symbol.for("react.client.reference");function wo(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===sy?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case yi:return"Fragment";case yo:return"Profiler";case $h:return"StrictMode";case bo:return"Suspense";case xo:return"SuspenseList";case So:return"Activity"}if(typeof e=="object")switch(e.$$typeof){case va:return"Portal";case $t:return e.displayName||"Context";case qh:return(e._context.displayName||"Context")+".Consumer";case Ou:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case Du:return t=e.displayName||null,t!==null?t:wo(e.type)||"Memo";case ln:t=e._payload,e=e._init;try{return wo(e(t))}catch{}}return null}var ya=Array.isArray,U=Ih.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,J=ny.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Yn={pending:!1,data:null,method:null,action:null},jo=[],bi=-1;function _t(e){return{current:e}}function Te(e){0>bi||(e.current=jo[bi],jo[bi]=null,bi--)}function ae(e,t){bi++,jo[bi]=e.current,e.current=t}var Dt=_t(null),Ua=_t(null),pn=_t(null),us=_t(null);function cs(e,t){switch(ae(pn,t),ae(Ua,e),ae(Dt,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?Gd(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Gd(t),e=op(t,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}Te(Dt),ae(Dt,e)}function Hi(){Te(Dt),Te(Ua),Te(pn)}function ko(e){e.memoizedState!==null&&ae(us,e);var t=Dt.current,n=op(t,e.type);t!==n&&(ae(Ua,e),ae(Dt,n))}function ds(e){Ua.current===e&&(Te(Dt),Te(Ua)),us.current===e&&(Te(us),Qa._currentValue=Yn)}var mr,Hc;function Un(e){if(mr===void 0)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);mr=t&&t[1]||"",Hc=-1<n.stack.indexOf(`
    at`)?" (<anonymous>)":-1<n.stack.indexOf("@")?"@unknown:0:0":""}return`
`+mr+e+Hc}var gr=!1;function pr(e,t){if(!e||gr)return"";gr=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var i={DetermineComponentFrameRoot:function(){try{if(t){var p=function(){throw Error()};if(Object.defineProperty(p.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(p,[])}catch(f){var h=f}Reflect.construct(e,[],p)}else{try{p.call()}catch(f){h=f}e.call(p.prototype)}}else{try{throw Error()}catch(f){h=f}(p=e())&&typeof p.catch=="function"&&p.catch(function(){})}}catch(f){if(f&&h&&typeof f.stack=="string")return[f.stack,h.stack]}return[null,null]}};i.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var a=Object.getOwnPropertyDescriptor(i.DetermineComponentFrameRoot,"name");a&&a.configurable&&Object.defineProperty(i.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var l=i.DetermineComponentFrameRoot(),s=l[0],o=l[1];if(s&&o){var u=s.split(`
`),d=o.split(`
`);for(a=i=0;i<u.length&&!u[i].includes("DetermineComponentFrameRoot");)i++;for(;a<d.length&&!d[a].includes("DetermineComponentFrameRoot");)a++;if(i===u.length||a===d.length)for(i=u.length-1,a=d.length-1;1<=i&&0<=a&&u[i]!==d[a];)a--;for(;1<=i&&0<=a;i--,a--)if(u[i]!==d[a]){if(i!==1||a!==1)do if(i--,a--,0>a||u[i]!==d[a]){var g=`
`+u[i].replace(" at new "," at ");return e.displayName&&g.includes("<anonymous>")&&(g=g.replace("<anonymous>",e.displayName)),g}while(1<=i&&0<=a);break}}}finally{gr=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:"")?Un(n):""}function ry(e,t){switch(e.tag){case 26:case 27:case 5:return Un(e.type);case 16:return Un("Lazy");case 13:return e.child!==t&&t!==null?Un("Suspense Fallback"):Un("Suspense");case 19:return Un("SuspenseList");case 0:case 15:return pr(e.type,!1);case 11:return pr(e.type.render,!1);case 1:return pr(e.type,!0);case 31:return Un("Activity");default:return""}}function Bc(e){try{var t="",n=null;do t+=ry(e,n),n=e,e=e.return;while(e);return t}catch(i){return`
Error generating stack: `+i.message+`
`+i.stack}}var To=Object.prototype.hasOwnProperty,_u=we.unstable_scheduleCallback,vr=we.unstable_cancelCallback,oy=we.unstable_shouldYield,uy=we.unstable_requestPaint,Pe=we.unstable_now,cy=we.unstable_getCurrentPriorityLevel,Yh=we.unstable_ImmediatePriority,Gh=we.unstable_UserBlockingPriority,fs=we.unstable_NormalPriority,dy=we.unstable_LowPriority,Vh=we.unstable_IdlePriority,fy=we.log,hy=we.unstable_setDisableYieldValue,Wa=null,We=null;function dn(e){if(typeof fy=="function"&&hy(e),We&&typeof We.setStrictMode=="function")try{We.setStrictMode(Wa,e)}catch{}}var et=Math.clz32?Math.clz32:py,my=Math.log,gy=Math.LN2;function py(e){return e>>>=0,e===0?32:31-(my(e)/gy|0)|0}var fl=256,hl=262144,ml=4194304;function Ln(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&261888;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 Vs(e,t,n){var i=e.pendingLanes;if(i===0)return 0;var a=0,l=e.suspendedLanes,s=e.pingedLanes;e=e.warmLanes;var o=i&134217727;return o!==0?(i=o&~l,i!==0?a=Ln(i):(s&=o,s!==0?a=Ln(s):n||(n=o&~e,n!==0&&(a=Ln(n))))):(o=i&~l,o!==0?a=Ln(o):s!==0?a=Ln(s):n||(n=i&~e,n!==0&&(a=Ln(n)))),a===0?0:t!==0&&t!==a&&!(t&l)&&(l=a&-a,n=t&-t,l>=n||l===32&&(n&4194048)!==0)?t:a}function el(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function vy(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+5e3;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 Kh(){var e=ml;return ml<<=1,!(ml&62914560)&&(ml=4194304),e}function yr(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function tl(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function yy(e,t,n,i,a,l){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 o=e.entanglements,u=e.expirationTimes,d=e.hiddenUpdates;for(n=s&~n;0<n;){var g=31-et(n),p=1<<g;o[g]=0,u[g]=-1;var h=d[g];if(h!==null)for(d[g]=null,g=0;g<h.length;g++){var f=h[g];f!==null&&(f.lane&=-536870913)}n&=~p}i!==0&&Xh(e,i,0),l!==0&&a===0&&e.tag!==0&&(e.suspendedLanes|=l&~(s&~t))}function Xh(e,t,n){e.pendingLanes|=t,e.suspendedLanes&=~t;var i=31-et(t);e.entangledLanes|=t,e.entanglements[i]=e.entanglements[i]|1073741824|n&261930}function Qh(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var i=31-et(n),a=1<<i;a&t|e[i]&t&&(e[i]|=t),n&=~a}}function Zh(e,t){var n=t&-t;return n=n&42?1:Au(n),n&(e.suspendedLanes|t)?0:n}function Au(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 zu(e){return e&=-e,2<e?8<e?e&134217727?32:268435456:8:2}function Jh(){var e=J.p;return e!==0?e:(e=window.event,e===void 0?32:bp(e.type))}function $c(e,t){var n=J.p;try{return J.p=e,t()}finally{J.p=n}}var Dn=Math.random().toString(36).slice(2),Ce="__reactFiber$"+Dn,Ge="__reactProps$"+Dn,ea="__reactContainer$"+Dn,Eo="__reactEvents$"+Dn,by="__reactListeners$"+Dn,xy="__reactHandles$"+Dn,qc="__reactResources$"+Dn,nl="__reactMarker$"+Dn;function Mu(e){delete e[Ce],delete e[Ge],delete e[Eo],delete e[by],delete e[xy]}function xi(e){var t=e[Ce];if(t)return t;for(var n=e.parentNode;n;){if(t=n[ea]||n[Ce]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=Zd(e);e!==null;){if(n=e[Ce])return n;e=Zd(e)}return t}e=n,n=e.parentNode}return null}function ta(e){if(e=e[Ce]||e[ea]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function ba(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(E(33))}function zi(e){var t=e[qc];return t||(t=e[qc]={hoistableStyles:new Map,hoistableScripts:new Map}),t}function ke(e){e[nl]=!0}var Fh=new Set,Ph={};function ei(e,t){Bi(e,t),Bi(e+"Capture",t)}function Bi(e,t){for(Ph[e]=t,e=0;e<t.length;e++)Fh.add(t[e])}var Sy=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]*$"),Yc={},Gc={};function wy(e){return To.call(Gc,e)?!0:To.call(Yc,e)?!1:Sy.test(e)?Gc[e]=!0:(Yc[e]=!0,!1)}function Bl(e,t,n){if(wy(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 gl(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 Mt(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 rt(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function Wh(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function jy(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 a=i.get,l=i.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return a.call(this)},set:function(s){n=""+s,l.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 Co(e){if(!e._valueTracker){var t=Wh(e)?"checked":"value";e._valueTracker=jy(e,t,""+e[t])}}function em(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),i="";return e&&(i=Wh(e)?e.checked?"true":"false":e.value),e=i,e!==n?(t.setValue(e),!0):!1}function hs(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}var ky=/[\n"\\]/g;function dt(e){return e.replace(ky,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function Oo(e,t,n,i,a,l,s,o){e.name="",s!=null&&typeof s!="function"&&typeof s!="symbol"&&typeof s!="boolean"?e.type=s:e.removeAttribute("type"),t!=null?s==="number"?(t===0&&e.value===""||e.value!=t)&&(e.value=""+rt(t)):e.value!==""+rt(t)&&(e.value=""+rt(t)):s!=="submit"&&s!=="reset"||e.removeAttribute("value"),t!=null?Do(e,s,rt(t)):n!=null?Do(e,s,rt(n)):i!=null&&e.removeAttribute("value"),a==null&&l!=null&&(e.defaultChecked=!!l),a!=null&&(e.checked=a&&typeof a!="function"&&typeof a!="symbol"),o!=null&&typeof o!="function"&&typeof o!="symbol"&&typeof o!="boolean"?e.name=""+rt(o):e.removeAttribute("name")}function tm(e,t,n,i,a,l,s,o){if(l!=null&&typeof l!="function"&&typeof l!="symbol"&&typeof l!="boolean"&&(e.type=l),t!=null||n!=null){if(!(l!=="submit"&&l!=="reset"||t!=null)){Co(e);return}n=n!=null?""+rt(n):"",t=t!=null?""+rt(t):n,o||t===e.value||(e.value=t),e.defaultValue=t}i=i??a,i=typeof i!="function"&&typeof i!="symbol"&&!!i,e.checked=o?e.checked:!!i,e.defaultChecked=!!i,s!=null&&typeof s!="function"&&typeof s!="symbol"&&typeof s!="boolean"&&(e.name=s),Co(e)}function Do(e,t,n){t==="number"&&hs(e.ownerDocument)===e||e.defaultValue===""+n||(e.defaultValue=""+n)}function Mi(e,t,n,i){if(e=e.options,t){t={};for(var a=0;a<n.length;a++)t["$"+n[a]]=!0;for(n=0;n<e.length;n++)a=t.hasOwnProperty("$"+e[n].value),e[n].selected!==a&&(e[n].selected=a),a&&i&&(e[n].defaultSelected=!0)}else{for(n=""+rt(n),t=null,a=0;a<e.length;a++){if(e[a].value===n){e[a].selected=!0,i&&(e[a].defaultSelected=!0);return}t!==null||e[a].disabled||(t=e[a])}t!==null&&(t.selected=!0)}}function nm(e,t,n){if(t!=null&&(t=""+rt(t),t!==e.value&&(e.value=t),n==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=n!=null?""+rt(n):""}function im(e,t,n,i){if(t==null){if(i!=null){if(n!=null)throw Error(E(92));if(ya(i)){if(1<i.length)throw Error(E(93));i=i[0]}n=i}n==null&&(n=""),t=n}n=rt(t),e.defaultValue=n,i=e.textContent,i===n&&i!==""&&i!==null&&(e.value=i),Co(e)}function $i(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Ty=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 Vc(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||Ty.has(t)?t==="float"?e.cssFloat=n:e[t]=(""+n).trim():e[t]=n+"px"}function am(e,t,n){if(t!=null&&typeof t!="object")throw Error(E(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]="");for(var a in t)i=t[a],t.hasOwnProperty(a)&&n[a]!==i&&Vc(e,a,i)}else for(var l in t)t.hasOwnProperty(l)&&Vc(e,l,t[l])}function Nu(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 Ey=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"],["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"]]),Cy=/^[\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 $l(e){return Cy.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function qt(){}var _o=null;function Ru(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Si=null,Ni=null;function Kc(e){var t=ta(e);if(t&&(e=t.stateNode)){var n=e[Ge]||null;e:switch(e=t.stateNode,t.type){case"input":if(Oo(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;for(n=n.querySelectorAll('input[name="'+dt(""+t)+'"][type="radio"]'),t=0;t<n.length;t++){var i=n[t];if(i!==e&&i.form===e.form){var a=i[Ge]||null;if(!a)throw Error(E(90));Oo(i,a.value,a.defaultValue,a.defaultValue,a.checked,a.defaultChecked,a.type,a.name)}}for(t=0;t<n.length;t++)i=n[t],i.form===e.form&&em(i)}break e;case"textarea":nm(e,n.value,n.defaultValue);break e;case"select":t=n.value,t!=null&&Mi(e,!!n.multiple,t,!1)}}}var br=!1;function lm(e,t,n){if(br)return e(t,n);br=!0;try{var i=e(t);return i}finally{if(br=!1,(Si!==null||Ni!==null)&&(ir(),Si&&(t=Si,e=Ni,Ni=Si=null,Kc(t),e)))for(t=0;t<e.length;t++)Kc(e[t])}}function La(e,t){var n=e.stateNode;if(n===null)return null;var i=n[Ge]||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(E(231,t,typeof n));return n}var Xt=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Ao=!1;if(Xt)try{var oa={};Object.defineProperty(oa,"passive",{get:function(){Ao=!0}}),window.addEventListener("test",oa,oa),window.removeEventListener("test",oa,oa)}catch{Ao=!1}var fn=null,Iu=null,ql=null;function sm(){if(ql)return ql;var e,t=Iu,n=t.length,i,a="value"in fn?fn.value:fn.textContent,l=a.length;for(e=0;e<n&&t[e]===a[e];e++);var s=n-e;for(i=1;i<=s&&t[n-i]===a[l-i];i++);return ql=a.slice(e,1<i?1-i:void 0)}function Yl(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 pl(){return!0}function Xc(){return!1}function Ve(e){function t(n,i,a,l,s){this._reactName=n,this._targetInst=a,this.type=i,this.nativeEvent=l,this.target=s,this.currentTarget=null;for(var o in e)e.hasOwnProperty(o)&&(n=e[o],this[o]=n?n(l):l[o]);return this.isDefaultPrevented=(l.defaultPrevented!=null?l.defaultPrevented:l.returnValue===!1)?pl:Xc,this.isPropagationStopped=Xc,this}return oe(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=pl)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=pl)},persist:function(){},isPersistent:pl}),t}var ti={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Ks=Ve(ti),il=oe({},ti,{view:0,detail:0}),Oy=Ve(il),xr,Sr,ua,Xs=oe({},il,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Uu,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){return"movementX"in e?e.movementX:(e!==ua&&(ua&&e.type==="mousemove"?(xr=e.screenX-ua.screenX,Sr=e.screenY-ua.screenY):Sr=xr=0,ua=e),xr)},movementY:function(e){return"movementY"in e?e.movementY:Sr}}),Qc=Ve(Xs),Dy=oe({},Xs,{dataTransfer:0}),_y=Ve(Dy),Ay=oe({},il,{relatedTarget:0}),wr=Ve(Ay),zy=oe({},ti,{animationName:0,elapsedTime:0,pseudoElement:0}),My=Ve(zy),Ny=oe({},ti,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),Ry=Ve(Ny),Iy=oe({},ti,{data:0}),Zc=Ve(Iy),Uy={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Ly={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"},Hy={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function By(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=Hy[e])?!!t[e]:!1}function Uu(){return By}var $y=oe({},il,{key:function(e){if(e.key){var t=Uy[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=Yl(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?Ly[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Uu,charCode:function(e){return e.type==="keypress"?Yl(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?Yl(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),qy=Ve($y),Yy=oe({},Xs,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Jc=Ve(Yy),Gy=oe({},il,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Uu}),Vy=Ve(Gy),Ky=oe({},ti,{propertyName:0,elapsedTime:0,pseudoElement:0}),Xy=Ve(Ky),Qy=oe({},Xs,{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}),Zy=Ve(Qy),Jy=oe({},ti,{newState:0,oldState:0}),Fy=Ve(Jy),Py=[9,13,27,32],Lu=Xt&&"CompositionEvent"in window,ja=null;Xt&&"documentMode"in document&&(ja=document.documentMode);var Wy=Xt&&"TextEvent"in window&&!ja,rm=Xt&&(!Lu||ja&&8<ja&&11>=ja),Fc=" ",Pc=!1;function om(e,t){switch(e){case"keyup":return Py.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function um(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var wi=!1;function eb(e,t){switch(e){case"compositionend":return um(t);case"keypress":return t.which!==32?null:(Pc=!0,Fc);case"textInput":return e=t.data,e===Fc&&Pc?null:e;default:return null}}function tb(e,t){if(wi)return e==="compositionend"||!Lu&&om(e,t)?(e=sm(),ql=Iu=fn=null,wi=!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 rm&&t.locale!=="ko"?null:t.data;default:return null}}var nb={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 Wc(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!nb[e.type]:t==="textarea"}function cm(e,t,n,i){Si?Ni?Ni.push(i):Ni=[i]:Si=i,t=As(t,"onChange"),0<t.length&&(n=new Ks("onChange","change",null,n,i),e.push({event:n,listeners:t}))}var ka=null,Ha=null;function ib(e){lp(e,0)}function Qs(e){var t=ba(e);if(em(t))return e}function ed(e,t){if(e==="change")return t}var dm=!1;if(Xt){var jr;if(Xt){var kr="oninput"in document;if(!kr){var td=document.createElement("div");td.setAttribute("oninput","return;"),kr=typeof td.oninput=="function"}jr=kr}else jr=!1;dm=jr&&(!document.documentMode||9<document.documentMode)}function nd(){ka&&(ka.detachEvent("onpropertychange",fm),Ha=ka=null)}function fm(e){if(e.propertyName==="value"&&Qs(Ha)){var t=[];cm(t,Ha,e,Ru(e)),lm(ib,t)}}function ab(e,t,n){e==="focusin"?(nd(),ka=t,Ha=n,ka.attachEvent("onpropertychange",fm)):e==="focusout"&&nd()}function lb(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return Qs(Ha)}function sb(e,t){if(e==="click")return Qs(t)}function rb(e,t){if(e==="input"||e==="change")return Qs(t)}function ob(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var nt=typeof Object.is=="function"?Object.is:ob;function Ba(e,t){if(nt(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 a=n[i];if(!To.call(t,a)||!nt(e[a],t[a]))return!1}return!0}function id(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function ad(e,t){var n=id(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=id(n)}}function hm(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?hm(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function mm(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=hs(e.document);t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=hs(e.document)}return t}function Hu(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 ub=Xt&&"documentMode"in document&&11>=document.documentMode,ji=null,zo=null,Ta=null,Mo=!1;function ld(e,t,n){var i=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Mo||ji==null||ji!==hs(i)||(i=ji,"selectionStart"in i&&Hu(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}),Ta&&Ba(Ta,i)||(Ta=i,i=As(zo,"onSelect"),0<i.length&&(t=new Ks("onSelect","select",null,t,n),e.push({event:t,listeners:i}),t.target=ji)))}function An(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var ki={animationend:An("Animation","AnimationEnd"),animationiteration:An("Animation","AnimationIteration"),animationstart:An("Animation","AnimationStart"),transitionrun:An("Transition","TransitionRun"),transitionstart:An("Transition","TransitionStart"),transitioncancel:An("Transition","TransitionCancel"),transitionend:An("Transition","TransitionEnd")},Tr={},gm={};Xt&&(gm=document.createElement("div").style,"AnimationEvent"in window||(delete ki.animationend.animation,delete ki.animationiteration.animation,delete ki.animationstart.animation),"TransitionEvent"in window||delete ki.transitionend.transition);function ni(e){if(Tr[e])return Tr[e];if(!ki[e])return e;var t=ki[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in gm)return Tr[e]=t[n];return e}var pm=ni("animationend"),vm=ni("animationiteration"),ym=ni("animationstart"),cb=ni("transitionrun"),db=ni("transitionstart"),fb=ni("transitioncancel"),bm=ni("transitionend"),xm=new Map,No="abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error 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(" ");No.push("scrollEnd");function St(e,t){xm.set(e,t),ei(t,[e])}var ms=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)},st=[],Ti=0,Bu=0;function Zs(){for(var e=Ti,t=Bu=Ti=0;t<e;){var n=st[t];st[t++]=null;var i=st[t];st[t++]=null;var a=st[t];st[t++]=null;var l=st[t];if(st[t++]=null,i!==null&&a!==null){var s=i.pending;s===null?a.next=a:(a.next=s.next,s.next=a),i.pending=a}l!==0&&Sm(n,a,l)}}function Js(e,t,n,i){st[Ti++]=e,st[Ti++]=t,st[Ti++]=n,st[Ti++]=i,Bu|=i,e.lanes|=i,e=e.alternate,e!==null&&(e.lanes|=i)}function $u(e,t,n,i){return Js(e,t,n,i),gs(e)}function ii(e,t){return Js(e,null,null,t),gs(e)}function Sm(e,t,n){e.lanes|=n;var i=e.alternate;i!==null&&(i.lanes|=n);for(var a=!1,l=e.return;l!==null;)l.childLanes|=n,i=l.alternate,i!==null&&(i.childLanes|=n),l.tag===22&&(e=l.stateNode,e===null||e._visibility&1||(a=!0)),e=l,l=l.return;return e.tag===3?(l=e.stateNode,a&&t!==null&&(a=31-et(n),e=l.hiddenUpdates,i=e[a],i===null?e[a]=[t]:i.push(t),t.lane=n|536870912),l):null}function gs(e){if(50<Na)throw Na=0,tu=null,Error(E(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var Ei={};function hb(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 Je(e,t,n,i){return new hb(e,t,n,i)}function qu(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Gt(e,t){var n=e.alternate;return n===null?(n=Je(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&65011712,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 wm(e,t){e.flags&=65011714;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 Gl(e,t,n,i,a,l){var s=0;if(i=e,typeof e=="function")qu(e)&&(s=1);else if(typeof e=="string")s=y0(e,n,Dt.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case So:return e=Je(31,n,t,a),e.elementType=So,e.lanes=l,e;case yi:return Gn(n.children,a,l,t);case $h:s=8,a|=24;break;case yo:return e=Je(12,n,t,a|2),e.elementType=yo,e.lanes=l,e;case bo:return e=Je(13,n,t,a),e.elementType=bo,e.lanes=l,e;case xo:return e=Je(19,n,t,a),e.elementType=xo,e.lanes=l,e;default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case $t:s=10;break e;case qh:s=9;break e;case Ou:s=11;break e;case Du:s=14;break e;case ln:s=16,i=null;break e}s=29,n=Error(E(130,e===null?"null":typeof e,"")),i=null}return t=Je(s,n,t,a),t.elementType=e,t.type=i,t.lanes=l,t}function Gn(e,t,n,i){return e=Je(7,e,i,t),e.lanes=n,e}function Er(e,t,n){return e=Je(6,e,null,t),e.lanes=n,e}function jm(e){var t=Je(18,null,null,0);return t.stateNode=e,t}function Cr(e,t,n){return t=Je(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var sd=new WeakMap;function ft(e,t){if(typeof e=="object"&&e!==null){var n=sd.get(e);return n!==void 0?n:(t={value:e,source:t,stack:Bc(t)},sd.set(e,t),t)}return{value:e,source:t,stack:Bc(t)}}var Ci=[],Oi=0,ps=null,$a=0,ot=[],ut=0,Tn=null,Et=1,Ct="";function Ht(e,t){Ci[Oi++]=$a,Ci[Oi++]=ps,ps=e,$a=t}function km(e,t,n){ot[ut++]=Et,ot[ut++]=Ct,ot[ut++]=Tn,Tn=e;var i=Et;e=Ct;var a=32-et(i)-1;i&=~(1<<a),n+=1;var l=32-et(t)+a;if(30<l){var s=a-a%5;l=(i&(1<<s)-1).toString(32),i>>=s,a-=s,Et=1<<32-et(t)+a|n<<a|i,Ct=l+e}else Et=1<<l|n<<a|i,Ct=e}function Yu(e){e.return!==null&&(Ht(e,1),km(e,1,0))}function Gu(e){for(;e===ps;)ps=Ci[--Oi],Ci[Oi]=null,$a=Ci[--Oi],Ci[Oi]=null;for(;e===Tn;)Tn=ot[--ut],ot[ut]=null,Ct=ot[--ut],ot[ut]=null,Et=ot[--ut],ot[ut]=null}function Tm(e,t){ot[ut++]=Et,ot[ut++]=Ct,ot[ut++]=Tn,Et=t.id,Ct=t.overflow,Tn=e}var Oe=null,se=null,X=!1,vn=null,ht=!1,Ro=Error(E(519));function En(e){var t=Error(E(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw qa(ft(t,e)),Ro}function rd(e){var t=e.stateNode,n=e.type,i=e.memoizedProps;switch(t[Ce]=e,t[Ge]=i,n){case"dialog":Y("cancel",t),Y("close",t);break;case"iframe":case"object":case"embed":Y("load",t);break;case"video":case"audio":for(n=0;n<Ka.length;n++)Y(Ka[n],t);break;case"source":Y("error",t);break;case"img":case"image":case"link":Y("error",t),Y("load",t);break;case"details":Y("toggle",t);break;case"input":Y("invalid",t),tm(t,i.value,i.defaultValue,i.checked,i.defaultChecked,i.type,i.name,!0);break;case"select":Y("invalid",t);break;case"textarea":Y("invalid",t),im(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||rp(t.textContent,n)?(i.popover!=null&&(Y("beforetoggle",t),Y("toggle",t)),i.onScroll!=null&&Y("scroll",t),i.onScrollEnd!=null&&Y("scrollend",t),i.onClick!=null&&(t.onclick=qt),t=!0):t=!1,t||En(e,!0)}function od(e){for(Oe=e.return;Oe;)switch(Oe.tag){case 5:case 31:case 13:ht=!1;return;case 27:case 3:ht=!0;return;default:Oe=Oe.return}}function si(e){if(e!==Oe)return!1;if(!X)return od(e),X=!0,!1;var t=e.tag,n;if((n=t!==3&&t!==27)&&((n=t===5)&&(n=e.type,n=!(n!=="form"&&n!=="button")||su(e.type,e.memoizedProps)),n=!n),n&&se&&En(e),od(e),t===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(E(317));se=Qd(e)}else if(t===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(E(317));se=Qd(e)}else t===27?(t=se,_n(e.type)?(e=cu,cu=null,se=e):se=t):se=Oe?gt(e.stateNode.nextSibling):null;return!0}function Qn(){se=Oe=null,X=!1}function Or(){var e=vn;return e!==null&&(qe===null?qe=e:qe.push.apply(qe,e),vn=null),e}function qa(e){vn===null?vn=[e]:vn.push(e)}var Io=_t(null),ai=null,Yt=null;function rn(e,t,n){ae(Io,t._currentValue),t._currentValue=n}function Vt(e){e._currentValue=Io.current,Te(Io)}function Uo(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 Lo(e,t,n,i){var a=e.child;for(a!==null&&(a.return=e);a!==null;){var l=a.dependencies;if(l!==null){var s=a.child;l=l.firstContext;e:for(;l!==null;){var o=l;l=a;for(var u=0;u<t.length;u++)if(o.context===t[u]){l.lanes|=n,o=l.alternate,o!==null&&(o.lanes|=n),Uo(l.return,n,e),i||(s=null);break e}l=o.next}}else if(a.tag===18){if(s=a.return,s===null)throw Error(E(341));s.lanes|=n,l=s.alternate,l!==null&&(l.lanes|=n),Uo(s,n,e),s=null}else s=a.child;if(s!==null)s.return=a;else for(s=a;s!==null;){if(s===e){s=null;break}if(a=s.sibling,a!==null){a.return=s.return,s=a;break}s=s.return}a=s}}function na(e,t,n,i){e=null;for(var a=t,l=!1;a!==null;){if(!l){if(a.flags&524288)l=!0;else if(a.flags&262144)break}if(a.tag===10){var s=a.alternate;if(s===null)throw Error(E(387));if(s=s.memoizedProps,s!==null){var o=a.type;nt(a.pendingProps.value,s.value)||(e!==null?e.push(o):e=[o])}}else if(a===us.current){if(s=a.alternate,s===null)throw Error(E(387));s.memoizedState.memoizedState!==a.memoizedState.memoizedState&&(e!==null?e.push(Qa):e=[Qa])}a=a.return}e!==null&&Lo(t,e,n,i),t.flags|=262144}function vs(e){for(e=e.firstContext;e!==null;){if(!nt(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function Zn(e){ai=e,Yt=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function _e(e){return Em(ai,e)}function vl(e,t){return ai===null&&Zn(e),Em(e,t)}function Em(e,t){var n=t._currentValue;if(t={context:t,memoizedValue:n,next:null},Yt===null){if(e===null)throw Error(E(308));Yt=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else Yt=Yt.next=t;return n}var mb=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()})}},gb=we.unstable_scheduleCallback,pb=we.unstable_NormalPriority,be={$$typeof:$t,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Vu(){return{controller:new mb,data:new Map,refCount:0}}function al(e){e.refCount--,e.refCount===0&&gb(pb,function(){e.controller.abort()})}var Ea=null,Ho=0,qi=0,Ri=null;function vb(e,t){if(Ea===null){var n=Ea=[];Ho=0,qi=pc(),Ri={status:"pending",value:void 0,then:function(i){n.push(i)}}}return Ho++,t.then(ud,ud),t}function ud(){if(--Ho===0&&Ea!==null){Ri!==null&&(Ri.status="fulfilled");var e=Ea;Ea=null,qi=0,Ri=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function yb(e,t){var n=[],i={status:"pending",value:null,reason:null,then:function(a){n.push(a)}};return e.then(function(){i.status="fulfilled",i.value=t;for(var a=0;a<n.length;a++)(0,n[a])(t)},function(a){for(i.status="rejected",i.reason=a,a=0;a<n.length;a++)(0,n[a])(void 0)}),i}var cd=U.S;U.S=function(e,t){Bg=Pe(),typeof t=="object"&&t!==null&&typeof t.then=="function"&&vb(e,t),cd!==null&&cd(e,t)};var Vn=_t(null);function Ku(){var e=Vn.current;return e!==null?e:ne.pooledCache}function Vl(e,t){t===null?ae(Vn,Vn.current):ae(Vn,t.pool)}function Cm(){var e=Ku();return e===null?null:{parent:be._currentValue,pool:e}}var ia=Error(E(460)),Xu=Error(E(474)),Fs=Error(E(542)),ys={then:function(){}};function dd(e){return e=e.status,e==="fulfilled"||e==="rejected"}function Om(e,t,n){switch(n=e[n],n===void 0?e.push(t):n!==t&&(t.then(qt,qt),t=n),t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,hd(e),e;default:if(typeof t.status=="string")t.then(qt,qt);else{if(e=ne,e!==null&&100<e.shellSuspendCounter)throw Error(E(482));e=t,e.status="pending",e.then(function(i){if(t.status==="pending"){var a=t;a.status="fulfilled",a.value=i}},function(i){if(t.status==="pending"){var a=t;a.status="rejected",a.reason=i}})}switch(t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,hd(e),e}throw Kn=t,ia}}function Hn(e){try{var t=e._init;return t(e._payload)}catch(n){throw n!==null&&typeof n=="object"&&typeof n.then=="function"?(Kn=n,ia):n}}var Kn=null;function fd(){if(Kn===null)throw Error(E(459));var e=Kn;return Kn=null,e}function hd(e){if(e===ia||e===Fs)throw Error(E(483))}var Ii=null,Ya=0;function yl(e){var t=Ya;return Ya+=1,Ii===null&&(Ii=[]),Om(Ii,e,t)}function ca(e,t){t=t.props.ref,e.ref=t!==void 0?t:null}function bl(e,t){throw t.$$typeof===ay?Error(E(525)):(e=Object.prototype.toString.call(t),Error(E(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e)))}function Dm(e){function t(c,m){if(e){var w=c.deletions;w===null?(c.deletions=[m],c.flags|=16):w.push(m)}}function n(c,m){if(!e)return null;for(;m!==null;)t(c,m),m=m.sibling;return null}function i(c){for(var m=new Map;c!==null;)c.key!==null?m.set(c.key,c):m.set(c.index,c),c=c.sibling;return m}function a(c,m){return c=Gt(c,m),c.index=0,c.sibling=null,c}function l(c,m,w){return c.index=w,e?(w=c.alternate,w!==null?(w=w.index,w<m?(c.flags|=67108866,m):w):(c.flags|=67108866,m)):(c.flags|=1048576,m)}function s(c){return e&&c.alternate===null&&(c.flags|=67108866),c}function o(c,m,w,b){return m===null||m.tag!==6?(m=Er(w,c.mode,b),m.return=c,m):(m=a(m,w),m.return=c,m)}function u(c,m,w,b){var j=w.type;return j===yi?g(c,m,w.props.children,b,w.key):m!==null&&(m.elementType===j||typeof j=="object"&&j!==null&&j.$$typeof===ln&&Hn(j)===m.type)?(m=a(m,w.props),ca(m,w),m.return=c,m):(m=Gl(w.type,w.key,w.props,null,c.mode,b),ca(m,w),m.return=c,m)}function d(c,m,w,b){return m===null||m.tag!==4||m.stateNode.containerInfo!==w.containerInfo||m.stateNode.implementation!==w.implementation?(m=Cr(w,c.mode,b),m.return=c,m):(m=a(m,w.children||[]),m.return=c,m)}function g(c,m,w,b,j){return m===null||m.tag!==7?(m=Gn(w,c.mode,b,j),m.return=c,m):(m=a(m,w),m.return=c,m)}function p(c,m,w){if(typeof m=="string"&&m!==""||typeof m=="number"||typeof m=="bigint")return m=Er(""+m,c.mode,w),m.return=c,m;if(typeof m=="object"&&m!==null){switch(m.$$typeof){case dl:return w=Gl(m.type,m.key,m.props,null,c.mode,w),ca(w,m),w.return=c,w;case va:return m=Cr(m,c.mode,w),m.return=c,m;case ln:return m=Hn(m),p(c,m,w)}if(ya(m)||ra(m))return m=Gn(m,c.mode,w,null),m.return=c,m;if(typeof m.then=="function")return p(c,yl(m),w);if(m.$$typeof===$t)return p(c,vl(c,m),w);bl(c,m)}return null}function h(c,m,w,b){var j=m!==null?m.key:null;if(typeof w=="string"&&w!==""||typeof w=="number"||typeof w=="bigint")return j!==null?null:o(c,m,""+w,b);if(typeof w=="object"&&w!==null){switch(w.$$typeof){case dl:return w.key===j?u(c,m,w,b):null;case va:return w.key===j?d(c,m,w,b):null;case ln:return w=Hn(w),h(c,m,w,b)}if(ya(w)||ra(w))return j!==null?null:g(c,m,w,b,null);if(typeof w.then=="function")return h(c,m,yl(w),b);if(w.$$typeof===$t)return h(c,m,vl(c,w),b);bl(c,w)}return null}function f(c,m,w,b,j){if(typeof b=="string"&&b!==""||typeof b=="number"||typeof b=="bigint")return c=c.get(w)||null,o(m,c,""+b,j);if(typeof b=="object"&&b!==null){switch(b.$$typeof){case dl:return c=c.get(b.key===null?w:b.key)||null,u(m,c,b,j);case va:return c=c.get(b.key===null?w:b.key)||null,d(m,c,b,j);case ln:return b=Hn(b),f(c,m,w,b,j)}if(ya(b)||ra(b))return c=c.get(w)||null,g(m,c,b,j,null);if(typeof b.then=="function")return f(c,m,w,yl(b),j);if(b.$$typeof===$t)return f(c,m,w,vl(m,b),j);bl(m,b)}return null}function y(c,m,w,b){for(var j=null,k=null,T=m,_=m=0,A=null;T!==null&&_<w.length;_++){T.index>_?(A=T,T=null):A=T.sibling;var I=h(c,T,w[_],b);if(I===null){T===null&&(T=A);break}e&&T&&I.alternate===null&&t(c,T),m=l(I,m,_),k===null?j=I:k.sibling=I,k=I,T=A}if(_===w.length)return n(c,T),X&&Ht(c,_),j;if(T===null){for(;_<w.length;_++)T=p(c,w[_],b),T!==null&&(m=l(T,m,_),k===null?j=T:k.sibling=T,k=T);return X&&Ht(c,_),j}for(T=i(T);_<w.length;_++)A=f(T,c,_,w[_],b),A!==null&&(e&&A.alternate!==null&&T.delete(A.key===null?_:A.key),m=l(A,m,_),k===null?j=A:k.sibling=A,k=A);return e&&T.forEach(function(Q){return t(c,Q)}),X&&Ht(c,_),j}function v(c,m,w,b){if(w==null)throw Error(E(151));for(var j=null,k=null,T=m,_=m=0,A=null,I=w.next();T!==null&&!I.done;_++,I=w.next()){T.index>_?(A=T,T=null):A=T.sibling;var Q=h(c,T,I.value,b);if(Q===null){T===null&&(T=A);break}e&&T&&Q.alternate===null&&t(c,T),m=l(Q,m,_),k===null?j=Q:k.sibling=Q,k=Q,T=A}if(I.done)return n(c,T),X&&Ht(c,_),j;if(T===null){for(;!I.done;_++,I=w.next())I=p(c,I.value,b),I!==null&&(m=l(I,m,_),k===null?j=I:k.sibling=I,k=I);return X&&Ht(c,_),j}for(T=i(T);!I.done;_++,I=w.next())I=f(T,c,_,I.value,b),I!==null&&(e&&I.alternate!==null&&T.delete(I.key===null?_:I.key),m=l(I,m,_),k===null?j=I:k.sibling=I,k=I);return e&&T.forEach(function(z){return t(c,z)}),X&&Ht(c,_),j}function S(c,m,w,b){if(typeof w=="object"&&w!==null&&w.type===yi&&w.key===null&&(w=w.props.children),typeof w=="object"&&w!==null){switch(w.$$typeof){case dl:e:{for(var j=w.key;m!==null;){if(m.key===j){if(j=w.type,j===yi){if(m.tag===7){n(c,m.sibling),b=a(m,w.props.children),b.return=c,c=b;break e}}else if(m.elementType===j||typeof j=="object"&&j!==null&&j.$$typeof===ln&&Hn(j)===m.type){n(c,m.sibling),b=a(m,w.props),ca(b,w),b.return=c,c=b;break e}n(c,m);break}else t(c,m);m=m.sibling}w.type===yi?(b=Gn(w.props.children,c.mode,b,w.key),b.return=c,c=b):(b=Gl(w.type,w.key,w.props,null,c.mode,b),ca(b,w),b.return=c,c=b)}return s(c);case va:e:{for(j=w.key;m!==null;){if(m.key===j)if(m.tag===4&&m.stateNode.containerInfo===w.containerInfo&&m.stateNode.implementation===w.implementation){n(c,m.sibling),b=a(m,w.children||[]),b.return=c,c=b;break e}else{n(c,m);break}else t(c,m);m=m.sibling}b=Cr(w,c.mode,b),b.return=c,c=b}return s(c);case ln:return w=Hn(w),S(c,m,w,b)}if(ya(w))return y(c,m,w,b);if(ra(w)){if(j=ra(w),typeof j!="function")throw Error(E(150));return w=j.call(w),v(c,m,w,b)}if(typeof w.then=="function")return S(c,m,yl(w),b);if(w.$$typeof===$t)return S(c,m,vl(c,w),b);bl(c,w)}return typeof w=="string"&&w!==""||typeof w=="number"||typeof w=="bigint"?(w=""+w,m!==null&&m.tag===6?(n(c,m.sibling),b=a(m,w),b.return=c,c=b):(n(c,m),b=Er(w,c.mode,b),b.return=c,c=b),s(c)):n(c,m)}return function(c,m,w,b){try{Ya=0;var j=S(c,m,w,b);return Ii=null,j}catch(T){if(T===ia||T===Fs)throw T;var k=Je(29,T,null,c.mode);return k.lanes=b,k.return=c,k}finally{}}}var Jn=Dm(!0),_m=Dm(!1),sn=!1;function Qu(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Bo(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 yn(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function bn(e,t,n){var i=e.updateQueue;if(i===null)return null;if(i=i.shared,Z&2){var a=i.pending;return a===null?t.next=t:(t.next=a.next,a.next=t),i.pending=t,t=gs(e),Sm(e,null,n),t}return Js(e,i,t,n),gs(e)}function Ca(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,Qh(e,n)}}function Dr(e,t){var n=e.updateQueue,i=e.alternate;if(i!==null&&(i=i.updateQueue,n===i)){var a=null,l=null;if(n=n.firstBaseUpdate,n!==null){do{var s={lane:n.lane,tag:n.tag,payload:n.payload,callback:null,next:null};l===null?a=l=s:l=l.next=s,n=n.next}while(n!==null);l===null?a=l=t:l=l.next=t}else a=l=t;n={baseState:i.baseState,firstBaseUpdate:a,lastBaseUpdate:l,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 $o=!1;function Oa(){if($o){var e=Ri;if(e!==null)throw e}}function Da(e,t,n,i){$o=!1;var a=e.updateQueue;sn=!1;var l=a.firstBaseUpdate,s=a.lastBaseUpdate,o=a.shared.pending;if(o!==null){a.shared.pending=null;var u=o,d=u.next;u.next=null,s===null?l=d:s.next=d,s=u;var g=e.alternate;g!==null&&(g=g.updateQueue,o=g.lastBaseUpdate,o!==s&&(o===null?g.firstBaseUpdate=d:o.next=d,g.lastBaseUpdate=u))}if(l!==null){var p=a.baseState;s=0,g=d=u=null,o=l;do{var h=o.lane&-536870913,f=h!==o.lane;if(f?(K&h)===h:(i&h)===h){h!==0&&h===qi&&($o=!0),g!==null&&(g=g.next={lane:0,tag:o.tag,payload:o.payload,callback:null,next:null});e:{var y=e,v=o;h=t;var S=n;switch(v.tag){case 1:if(y=v.payload,typeof y=="function"){p=y.call(S,p,h);break e}p=y;break e;case 3:y.flags=y.flags&-65537|128;case 0:if(y=v.payload,h=typeof y=="function"?y.call(S,p,h):y,h==null)break e;p=oe({},p,h);break e;case 2:sn=!0}}h=o.callback,h!==null&&(e.flags|=64,f&&(e.flags|=8192),f=a.callbacks,f===null?a.callbacks=[h]:f.push(h))}else f={lane:h,tag:o.tag,payload:o.payload,callback:o.callback,next:null},g===null?(d=g=f,u=p):g=g.next=f,s|=h;if(o=o.next,o===null){if(o=a.shared.pending,o===null)break;f=o,o=f.next,f.next=null,a.lastBaseUpdate=f,a.shared.pending=null}}while(!0);g===null&&(u=p),a.baseState=u,a.firstBaseUpdate=d,a.lastBaseUpdate=g,l===null&&(a.shared.lanes=0),On|=s,e.lanes=s,e.memoizedState=p}}function Am(e,t){if(typeof e!="function")throw Error(E(191,e));e.call(t)}function zm(e,t){var n=e.callbacks;if(n!==null)for(e.callbacks=null,e=0;e<n.length;e++)Am(n[e],t)}var Yi=_t(null),bs=_t(0);function md(e,t){e=Ft,ae(bs,e),ae(Yi,t),Ft=e|t.baseLanes}function qo(){ae(bs,Ft),ae(Yi,Yi.current)}function Zu(){Ft=bs.current,Te(Yi),Te(bs)}var it=_t(null),mt=null;function on(e){var t=e.alternate;ae(ge,ge.current&1),ae(it,e),mt===null&&(t===null||Yi.current!==null||t.memoizedState!==null)&&(mt=e)}function Yo(e){ae(ge,ge.current),ae(it,e),mt===null&&(mt=e)}function Mm(e){e.tag===22?(ae(ge,ge.current),ae(it,e),mt===null&&(mt=e)):un()}function un(){ae(ge,ge.current),ae(it,it.current)}function Ze(e){Te(it),mt===e&&(mt=null),Te(ge)}var ge=_t(0);function xs(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||ou(n)||uu(n)))return t}else if(t.tag===19&&(t.memoizedProps.revealOrder==="forwards"||t.memoizedProps.revealOrder==="backwards"||t.memoizedProps.revealOrder==="unstable_legacy-backwards"||t.memoizedProps.revealOrder==="together")){if(t.flags&128)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 Qt=0,$=null,ee=null,ve=null,Ss=!1,Ui=!1,Fn=!1,ws=0,Ga=0,Li=null,bb=0;function he(){throw Error(E(321))}function Ju(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!nt(e[n],t[n]))return!1;return!0}function Fu(e,t,n,i,a,l){return Qt=l,$=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,U.H=e===null||e.memoizedState===null?cg:oc,Fn=!1,l=n(i,a),Fn=!1,Ui&&(l=Rm(t,n,i,a)),Nm(e),l}function Nm(e){U.H=Va;var t=ee!==null&&ee.next!==null;if(Qt=0,ve=ee=$=null,Ss=!1,Ga=0,Li=null,t)throw Error(E(300));e===null||xe||(e=e.dependencies,e!==null&&vs(e)&&(xe=!0))}function Rm(e,t,n,i){$=e;var a=0;do{if(Ui&&(Li=null),Ga=0,Ui=!1,25<=a)throw Error(E(301));if(a+=1,ve=ee=null,e.updateQueue!=null){var l=e.updateQueue;l.lastEffect=null,l.events=null,l.stores=null,l.memoCache!=null&&(l.memoCache.index=0)}U.H=dg,l=t(n,i)}while(Ui);return l}function xb(){var e=U.H,t=e.useState()[0];return t=typeof t.then=="function"?ll(t):t,e=e.useState()[0],(ee!==null?ee.memoizedState:null)!==e&&($.flags|=1024),t}function Pu(){var e=ws!==0;return ws=0,e}function Wu(e,t,n){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~n}function ec(e){if(Ss){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}Ss=!1}Qt=0,ve=ee=$=null,Ui=!1,Ga=ws=0,Li=null}function Ie(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return ve===null?$.memoizedState=ve=e:ve=ve.next=e,ve}function pe(){if(ee===null){var e=$.alternate;e=e!==null?e.memoizedState:null}else e=ee.next;var t=ve===null?$.memoizedState:ve.next;if(t!==null)ve=t,ee=e;else{if(e===null)throw $.alternate===null?Error(E(467)):Error(E(310));ee=e,e={memoizedState:ee.memoizedState,baseState:ee.baseState,baseQueue:ee.baseQueue,queue:ee.queue,next:null},ve===null?$.memoizedState=ve=e:ve=ve.next=e}return ve}function Ps(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function ll(e){var t=Ga;return Ga+=1,Li===null&&(Li=[]),e=Om(Li,e,t),t=$,(ve===null?t.memoizedState:ve.next)===null&&(t=t.alternate,U.H=t===null||t.memoizedState===null?cg:oc),e}function Ws(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return ll(e);if(e.$$typeof===$t)return _e(e)}throw Error(E(438,String(e)))}function tc(e){var t=null,n=$.updateQueue;if(n!==null&&(t=n.memoCache),t==null){var i=$.alternate;i!==null&&(i=i.updateQueue,i!==null&&(i=i.memoCache,i!=null&&(t={data:i.data.map(function(a){return a.slice()}),index:0})))}if(t==null&&(t={data:[],index:0}),n===null&&(n=Ps(),$.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]=ly;return t.index++,n}function Zt(e,t){return typeof t=="function"?t(e):t}function Kl(e){var t=pe();return nc(t,ee,e)}function nc(e,t,n){var i=e.queue;if(i===null)throw Error(E(311));i.lastRenderedReducer=n;var a=e.baseQueue,l=i.pending;if(l!==null){if(a!==null){var s=a.next;a.next=l.next,l.next=s}t.baseQueue=a=l,i.pending=null}if(l=e.baseState,a===null)e.memoizedState=l;else{t=a.next;var o=s=null,u=null,d=t,g=!1;do{var p=d.lane&-536870913;if(p!==d.lane?(K&p)===p:(Qt&p)===p){var h=d.revertLane;if(h===0)u!==null&&(u=u.next={lane:0,revertLane:0,gesture:null,action:d.action,hasEagerState:d.hasEagerState,eagerState:d.eagerState,next:null}),p===qi&&(g=!0);else if((Qt&h)===h){d=d.next,h===qi&&(g=!0);continue}else p={lane:0,revertLane:d.revertLane,gesture:null,action:d.action,hasEagerState:d.hasEagerState,eagerState:d.eagerState,next:null},u===null?(o=u=p,s=l):u=u.next=p,$.lanes|=h,On|=h;p=d.action,Fn&&n(l,p),l=d.hasEagerState?d.eagerState:n(l,p)}else h={lane:p,revertLane:d.revertLane,gesture:d.gesture,action:d.action,hasEagerState:d.hasEagerState,eagerState:d.eagerState,next:null},u===null?(o=u=h,s=l):u=u.next=h,$.lanes|=p,On|=p;d=d.next}while(d!==null&&d!==t);if(u===null?s=l:u.next=o,!nt(l,e.memoizedState)&&(xe=!0,g&&(n=Ri,n!==null)))throw n;e.memoizedState=l,e.baseState=s,e.baseQueue=u,i.lastRenderedState=l}return a===null&&(i.lanes=0),[e.memoizedState,i.dispatch]}function _r(e){var t=pe(),n=t.queue;if(n===null)throw Error(E(311));n.lastRenderedReducer=e;var i=n.dispatch,a=n.pending,l=t.memoizedState;if(a!==null){n.pending=null;var s=a=a.next;do l=e(l,s.action),s=s.next;while(s!==a);nt(l,t.memoizedState)||(xe=!0),t.memoizedState=l,t.baseQueue===null&&(t.baseState=l),n.lastRenderedState=l}return[l,i]}function Im(e,t,n){var i=$,a=pe(),l=X;if(l){if(n===void 0)throw Error(E(407));n=n()}else n=t();var s=!nt((ee||a).memoizedState,n);if(s&&(a.memoizedState=n,xe=!0),a=a.queue,ic(Hm.bind(null,i,a,e),[e]),a.getSnapshot!==t||s||ve!==null&&ve.memoizedState.tag&1){if(i.flags|=2048,Gi(9,{destroy:void 0},Lm.bind(null,i,a,n,t),null),ne===null)throw Error(E(349));l||Qt&127||Um(i,t,n)}return n}function Um(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=$.updateQueue,t===null?(t=Ps(),$.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function Lm(e,t,n,i){t.value=n,t.getSnapshot=i,Bm(t)&&$m(e)}function Hm(e,t,n){return n(function(){Bm(t)&&$m(e)})}function Bm(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!nt(e,n)}catch{return!0}}function $m(e){var t=ii(e,2);t!==null&&Ye(t,e,2)}function Go(e){var t=Ie();if(typeof e=="function"){var n=e;if(e=n(),Fn){dn(!0);try{n()}finally{dn(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Zt,lastRenderedState:e},t}function qm(e,t,n,i){return e.baseState=n,nc(e,ee,typeof i=="function"?i:Zt)}function Sb(e,t,n,i,a){if(tr(e))throw Error(E(485));if(e=t.action,e!==null){var l={payload:a,action:e,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(s){l.listeners.push(s)}};U.T!==null?n(!0):l.isTransition=!1,i(l),n=t.pending,n===null?(l.next=t.pending=l,Ym(t,l)):(l.next=n.next,t.pending=n.next=l)}}function Ym(e,t){var n=t.action,i=t.payload,a=e.state;if(t.isTransition){var l=U.T,s={};U.T=s;try{var o=n(a,i),u=U.S;u!==null&&u(s,o),gd(e,t,o)}catch(d){Vo(e,t,d)}finally{l!==null&&s.types!==null&&(l.types=s.types),U.T=l}}else try{l=n(a,i),gd(e,t,l)}catch(d){Vo(e,t,d)}}function gd(e,t,n){n!==null&&typeof n=="object"&&typeof n.then=="function"?n.then(function(i){pd(e,t,i)},function(i){return Vo(e,t,i)}):pd(e,t,n)}function pd(e,t,n){t.status="fulfilled",t.value=n,Gm(t),e.state=n,t=e.pending,t!==null&&(n=t.next,n===t?e.pending=null:(n=n.next,t.next=n,Ym(e,n)))}function Vo(e,t,n){var i=e.pending;if(e.pending=null,i!==null){i=i.next;do t.status="rejected",t.reason=n,Gm(t),t=t.next;while(t!==i)}e.action=null}function Gm(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function Vm(e,t){return t}function vd(e,t){if(X){var n=ne.formState;if(n!==null){e:{var i=$;if(X){if(se){t:{for(var a=se,l=ht;a.nodeType!==8;){if(!l){a=null;break t}if(a=gt(a.nextSibling),a===null){a=null;break t}}l=a.data,a=l==="F!"||l==="F"?a:null}if(a){se=gt(a.nextSibling),i=a.data==="F!";break e}}En(i)}i=!1}i&&(t=n[0])}}return n=Ie(),n.memoizedState=n.baseState=t,i={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Vm,lastRenderedState:t},n.queue=i,n=rg.bind(null,$,i),i.dispatch=n,i=Go(!1),l=rc.bind(null,$,!1,i.queue),i=Ie(),a={state:t,dispatch:null,action:e,pending:null},i.queue=a,n=Sb.bind(null,$,a,l,n),a.dispatch=n,i.memoizedState=e,[t,n,!1]}function yd(e){var t=pe();return Km(t,ee,e)}function Km(e,t,n){if(t=nc(e,t,Vm)[0],e=Kl(Zt)[0],typeof t=="object"&&t!==null&&typeof t.then=="function")try{var i=ll(t)}catch(s){throw s===ia?Fs:s}else i=t;t=pe();var a=t.queue,l=a.dispatch;return n!==t.memoizedState&&($.flags|=2048,Gi(9,{destroy:void 0},wb.bind(null,a,n),null)),[i,l,e]}function wb(e,t){e.action=t}function bd(e){var t=pe(),n=ee;if(n!==null)return Km(t,n,e);pe(),t=t.memoizedState,n=pe();var i=n.queue.dispatch;return n.memoizedState=e,[t,i,!1]}function Gi(e,t,n,i){return e={tag:e,create:n,deps:i,inst:t,next:null},t=$.updateQueue,t===null&&(t=Ps(),$.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 Xm(){return pe().memoizedState}function Xl(e,t,n,i){var a=Ie();$.flags|=e,a.memoizedState=Gi(1|t,{destroy:void 0},n,i===void 0?null:i)}function er(e,t,n,i){var a=pe();i=i===void 0?null:i;var l=a.memoizedState.inst;ee!==null&&i!==null&&Ju(i,ee.memoizedState.deps)?a.memoizedState=Gi(t,l,n,i):($.flags|=e,a.memoizedState=Gi(1|t,l,n,i))}function xd(e,t){Xl(8390656,8,e,t)}function ic(e,t){er(2048,8,e,t)}function jb(e){$.flags|=4;var t=$.updateQueue;if(t===null)t=Ps(),$.updateQueue=t,t.events=[e];else{var n=t.events;n===null?t.events=[e]:n.push(e)}}function Qm(e){var t=pe().memoizedState;return jb({ref:t,nextImpl:e}),function(){if(Z&2)throw Error(E(440));return t.impl.apply(void 0,arguments)}}function Zm(e,t){return er(4,2,e,t)}function Jm(e,t){return er(4,4,e,t)}function Fm(e,t){if(typeof t=="function"){e=e();var n=t(e);return function(){typeof n=="function"?n():t(null)}}if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function Pm(e,t,n){n=n!=null?n.concat([e]):null,er(4,4,Fm.bind(null,t,e),n)}function ac(){}function Wm(e,t){var n=pe();t=t===void 0?null:t;var i=n.memoizedState;return t!==null&&Ju(t,i[1])?i[0]:(n.memoizedState=[e,t],e)}function eg(e,t){var n=pe();t=t===void 0?null:t;var i=n.memoizedState;if(t!==null&&Ju(t,i[1]))return i[0];if(i=e(),Fn){dn(!0);try{e()}finally{dn(!1)}}return n.memoizedState=[i,t],i}function lc(e,t,n){return n===void 0||Qt&1073741824&&!(K&261930)?e.memoizedState=t:(e.memoizedState=n,e=qg(),$.lanes|=e,On|=e,n)}function tg(e,t,n,i){return nt(n,t)?n:Yi.current!==null?(e=lc(e,n,i),nt(e,t)||(xe=!0),e):!(Qt&42)||Qt&1073741824&&!(K&261930)?(xe=!0,e.memoizedState=n):(e=qg(),$.lanes|=e,On|=e,t)}function ng(e,t,n,i,a){var l=J.p;J.p=l!==0&&8>l?l:8;var s=U.T,o={};U.T=o,rc(e,!1,t,n);try{var u=a(),d=U.S;if(d!==null&&d(o,u),u!==null&&typeof u=="object"&&typeof u.then=="function"){var g=yb(u,i);_a(e,t,g,tt(e))}else _a(e,t,i,tt(e))}catch(p){_a(e,t,{then:function(){},status:"rejected",reason:p},tt())}finally{J.p=l,s!==null&&o.types!==null&&(s.types=o.types),U.T=s}}function kb(){}function Ko(e,t,n,i){if(e.tag!==5)throw Error(E(476));var a=ig(e).queue;ng(e,a,t,Yn,n===null?kb:function(){return ag(e),n(i)})}function ig(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:Yn,baseState:Yn,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Zt,lastRenderedState:Yn},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Zt,lastRenderedState:n},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function ag(e){var t=ig(e);t.next===null&&(t=e.alternate.memoizedState),_a(e,t.next.queue,{},tt())}function sc(){return _e(Qa)}function lg(){return pe().memoizedState}function sg(){return pe().memoizedState}function Tb(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var n=tt();e=yn(n);var i=bn(t,e,n);i!==null&&(Ye(i,t,n),Ca(i,t,n)),t={cache:Vu()},e.payload=t;return}t=t.return}}function Eb(e,t,n){var i=tt();n={lane:i,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},tr(e)?og(t,n):(n=$u(e,t,n,i),n!==null&&(Ye(n,e,i),ug(n,t,i)))}function rg(e,t,n){var i=tt();_a(e,t,n,i)}function _a(e,t,n,i){var a={lane:i,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(tr(e))og(t,a);else{var l=e.alternate;if(e.lanes===0&&(l===null||l.lanes===0)&&(l=t.lastRenderedReducer,l!==null))try{var s=t.lastRenderedState,o=l(s,n);if(a.hasEagerState=!0,a.eagerState=o,nt(o,s))return Js(e,t,a,0),ne===null&&Zs(),!1}catch{}finally{}if(n=$u(e,t,a,i),n!==null)return Ye(n,e,i),ug(n,t,i),!0}return!1}function rc(e,t,n,i){if(i={lane:2,revertLane:pc(),gesture:null,action:i,hasEagerState:!1,eagerState:null,next:null},tr(e)){if(t)throw Error(E(479))}else t=$u(e,n,i,2),t!==null&&Ye(t,e,2)}function tr(e){var t=e.alternate;return e===$||t!==null&&t===$}function og(e,t){Ui=Ss=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function ug(e,t,n){if(n&4194048){var i=t.lanes;i&=e.pendingLanes,n|=i,t.lanes=n,Qh(e,n)}}var Va={readContext:_e,use:Ws,useCallback:he,useContext:he,useEffect:he,useImperativeHandle:he,useLayoutEffect:he,useInsertionEffect:he,useMemo:he,useReducer:he,useRef:he,useState:he,useDebugValue:he,useDeferredValue:he,useTransition:he,useSyncExternalStore:he,useId:he,useHostTransitionStatus:he,useFormState:he,useActionState:he,useOptimistic:he,useMemoCache:he,useCacheRefresh:he};Va.useEffectEvent=he;var cg={readContext:_e,use:Ws,useCallback:function(e,t){return Ie().memoizedState=[e,t===void 0?null:t],e},useContext:_e,useEffect:xd,useImperativeHandle:function(e,t,n){n=n!=null?n.concat([e]):null,Xl(4194308,4,Fm.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Xl(4194308,4,e,t)},useInsertionEffect:function(e,t){Xl(4,2,e,t)},useMemo:function(e,t){var n=Ie();t=t===void 0?null:t;var i=e();if(Fn){dn(!0);try{e()}finally{dn(!1)}}return n.memoizedState=[i,t],i},useReducer:function(e,t,n){var i=Ie();if(n!==void 0){var a=n(t);if(Fn){dn(!0);try{n(t)}finally{dn(!1)}}}else a=t;return i.memoizedState=i.baseState=a,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:a},i.queue=e,e=e.dispatch=Eb.bind(null,$,e),[i.memoizedState,e]},useRef:function(e){var t=Ie();return e={current:e},t.memoizedState=e},useState:function(e){e=Go(e);var t=e.queue,n=rg.bind(null,$,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:ac,useDeferredValue:function(e,t){var n=Ie();return lc(n,e,t)},useTransition:function(){var e=Go(!1);return e=ng.bind(null,$,e.queue,!0,!1),Ie().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var i=$,a=Ie();if(X){if(n===void 0)throw Error(E(407));n=n()}else{if(n=t(),ne===null)throw Error(E(349));K&127||Um(i,t,n)}a.memoizedState=n;var l={value:n,getSnapshot:t};return a.queue=l,xd(Hm.bind(null,i,l,e),[e]),i.flags|=2048,Gi(9,{destroy:void 0},Lm.bind(null,i,l,n,t),null),n},useId:function(){var e=Ie(),t=ne.identifierPrefix;if(X){var n=Ct,i=Et;n=(i&~(1<<32-et(i)-1)).toString(32)+n,t="_"+t+"R_"+n,n=ws++,0<n&&(t+="H"+n.toString(32)),t+="_"}else n=bb++,t="_"+t+"r_"+n.toString(32)+"_";return e.memoizedState=t},useHostTransitionStatus:sc,useFormState:vd,useActionState:vd,useOptimistic:function(e){var t=Ie();t.memoizedState=t.baseState=e;var n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=n,t=rc.bind(null,$,!0,n),n.dispatch=t,[e,t]},useMemoCache:tc,useCacheRefresh:function(){return Ie().memoizedState=Tb.bind(null,$)},useEffectEvent:function(e){var t=Ie(),n={impl:e};return t.memoizedState=n,function(){if(Z&2)throw Error(E(440));return n.impl.apply(void 0,arguments)}}},oc={readContext:_e,use:Ws,useCallback:Wm,useContext:_e,useEffect:ic,useImperativeHandle:Pm,useInsertionEffect:Zm,useLayoutEffect:Jm,useMemo:eg,useReducer:Kl,useRef:Xm,useState:function(){return Kl(Zt)},useDebugValue:ac,useDeferredValue:function(e,t){var n=pe();return tg(n,ee.memoizedState,e,t)},useTransition:function(){var e=Kl(Zt)[0],t=pe().memoizedState;return[typeof e=="boolean"?e:ll(e),t]},useSyncExternalStore:Im,useId:lg,useHostTransitionStatus:sc,useFormState:yd,useActionState:yd,useOptimistic:function(e,t){var n=pe();return qm(n,ee,e,t)},useMemoCache:tc,useCacheRefresh:sg};oc.useEffectEvent=Qm;var dg={readContext:_e,use:Ws,useCallback:Wm,useContext:_e,useEffect:ic,useImperativeHandle:Pm,useInsertionEffect:Zm,useLayoutEffect:Jm,useMemo:eg,useReducer:_r,useRef:Xm,useState:function(){return _r(Zt)},useDebugValue:ac,useDeferredValue:function(e,t){var n=pe();return ee===null?lc(n,e,t):tg(n,ee.memoizedState,e,t)},useTransition:function(){var e=_r(Zt)[0],t=pe().memoizedState;return[typeof e=="boolean"?e:ll(e),t]},useSyncExternalStore:Im,useId:lg,useHostTransitionStatus:sc,useFormState:bd,useActionState:bd,useOptimistic:function(e,t){var n=pe();return ee!==null?qm(n,ee,e,t):(n.baseState=e,[e,n.queue.dispatch])},useMemoCache:tc,useCacheRefresh:sg};dg.useEffectEvent=Qm;function Ar(e,t,n,i){t=e.memoizedState,n=n(i,t),n=n==null?t:oe({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var Xo={enqueueSetState:function(e,t,n){e=e._reactInternals;var i=tt(),a=yn(i);a.payload=t,n!=null&&(a.callback=n),t=bn(e,a,i),t!==null&&(Ye(t,e,i),Ca(t,e,i))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var i=tt(),a=yn(i);a.tag=1,a.payload=t,n!=null&&(a.callback=n),t=bn(e,a,i),t!==null&&(Ye(t,e,i),Ca(t,e,i))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=tt(),i=yn(n);i.tag=2,t!=null&&(i.callback=t),t=bn(e,i,n),t!==null&&(Ye(t,e,n),Ca(t,e,n))}};function Sd(e,t,n,i,a,l,s){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(i,l,s):t.prototype&&t.prototype.isPureReactComponent?!Ba(n,i)||!Ba(a,l):!0}function wd(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&&Xo.enqueueReplaceState(t,t.state,null)}function Pn(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=oe({},n));for(var a in e)n[a]===void 0&&(n[a]=e[a])}return n}function fg(e){ms(e)}function hg(e){console.error(e)}function mg(e){ms(e)}function js(e,t){try{var n=e.onUncaughtError;n(t.value,{componentStack:t.stack})}catch(i){setTimeout(function(){throw i})}}function jd(e,t,n){try{var i=e.onCaughtError;i(n.value,{componentStack:n.stack,errorBoundary:t.tag===1?t.stateNode:null})}catch(a){setTimeout(function(){throw a})}}function Qo(e,t,n){return n=yn(n),n.tag=3,n.payload={element:null},n.callback=function(){js(e,t)},n}function gg(e){return e=yn(e),e.tag=3,e}function pg(e,t,n,i){var a=n.type.getDerivedStateFromError;if(typeof a=="function"){var l=i.value;e.payload=function(){return a(l)},e.callback=function(){jd(t,n,i)}}var s=n.stateNode;s!==null&&typeof s.componentDidCatch=="function"&&(e.callback=function(){jd(t,n,i),typeof a!="function"&&(xn===null?xn=new Set([this]):xn.add(this));var o=i.stack;this.componentDidCatch(i.value,{componentStack:o!==null?o:""})})}function Cb(e,t,n,i,a){if(n.flags|=32768,i!==null&&typeof i=="object"&&typeof i.then=="function"){if(t=n.alternate,t!==null&&na(t,n,a,!0),n=it.current,n!==null){switch(n.tag){case 31:case 13:return mt===null?Os():n.alternate===null&&me===0&&(me=3),n.flags&=-257,n.flags|=65536,n.lanes=a,i===ys?n.flags|=16384:(t=n.updateQueue,t===null?n.updateQueue=new Set([i]):t.add(i),qr(e,i,a)),!1;case 22:return n.flags|=65536,i===ys?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)),qr(e,i,a)),!1}throw Error(E(435,n.tag))}return qr(e,i,a),Os(),!1}if(X)return t=it.current,t!==null?(!(t.flags&65536)&&(t.flags|=256),t.flags|=65536,t.lanes=a,i!==Ro&&(e=Error(E(422),{cause:i}),qa(ft(e,n)))):(i!==Ro&&(t=Error(E(423),{cause:i}),qa(ft(t,n))),e=e.current.alternate,e.flags|=65536,a&=-a,e.lanes|=a,i=ft(i,n),a=Qo(e.stateNode,i,a),Dr(e,a),me!==4&&(me=2)),!1;var l=Error(E(520),{cause:i});if(l=ft(l,n),Ma===null?Ma=[l]:Ma.push(l),me!==4&&(me=2),t===null)return!0;i=ft(i,n),n=t;do{switch(n.tag){case 3:return n.flags|=65536,e=a&-a,n.lanes|=e,e=Qo(n.stateNode,i,e),Dr(n,e),!1;case 1:if(t=n.type,l=n.stateNode,(n.flags&128)===0&&(typeof t.getDerivedStateFromError=="function"||l!==null&&typeof l.componentDidCatch=="function"&&(xn===null||!xn.has(l))))return n.flags|=65536,a&=-a,n.lanes|=a,a=gg(a),pg(a,e,n,i),Dr(n,a),!1}n=n.return}while(n!==null);return!1}var uc=Error(E(461)),xe=!1;function Ee(e,t,n,i){t.child=e===null?_m(t,null,n,i):Jn(t,e.child,n,i)}function kd(e,t,n,i,a){n=n.render;var l=t.ref;if("ref"in i){var s={};for(var o in i)o!=="ref"&&(s[o]=i[o])}else s=i;return Zn(t),i=Fu(e,t,n,s,l,a),o=Pu(),e!==null&&!xe?(Wu(e,t,a),Jt(e,t,a)):(X&&o&&Yu(t),t.flags|=1,Ee(e,t,i,a),t.child)}function Td(e,t,n,i,a){if(e===null){var l=n.type;return typeof l=="function"&&!qu(l)&&l.defaultProps===void 0&&n.compare===null?(t.tag=15,t.type=l,vg(e,t,l,i,a)):(e=Gl(n.type,null,i,t,t.mode,a),e.ref=t.ref,e.return=t,t.child=e)}if(l=e.child,!cc(e,a)){var s=l.memoizedProps;if(n=n.compare,n=n!==null?n:Ba,n(s,i)&&e.ref===t.ref)return Jt(e,t,a)}return t.flags|=1,e=Gt(l,i),e.ref=t.ref,e.return=t,t.child=e}function vg(e,t,n,i,a){if(e!==null){var l=e.memoizedProps;if(Ba(l,i)&&e.ref===t.ref)if(xe=!1,t.pendingProps=i=l,cc(e,a))e.flags&131072&&(xe=!0);else return t.lanes=e.lanes,Jt(e,t,a)}return Zo(e,t,n,i,a)}function yg(e,t,n,i){var a=i.children,l=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){if(l=l!==null?l.baseLanes|n:n,e!==null){for(i=t.child=e.child,a=0;i!==null;)a=a|i.lanes|i.childLanes,i=i.sibling;i=a&~l}else i=0,t.child=null;return Ed(e,t,l,n,i)}if(n&536870912)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&Vl(t,l!==null?l.cachePool:null),l!==null?md(t,l):qo(),Mm(t);else return i=t.lanes=536870912,Ed(e,t,l!==null?l.baseLanes|n:n,n,i)}else l!==null?(Vl(t,l.cachePool),md(t,l),un(),t.memoizedState=null):(e!==null&&Vl(t,null),qo(),un());return Ee(e,t,a,n),t.child}function xa(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function Ed(e,t,n,i,a){var l=Ku();return l=l===null?null:{parent:be._currentValue,pool:l},t.memoizedState={baseLanes:n,cachePool:l},e!==null&&Vl(t,null),qo(),Mm(t),e!==null&&na(e,t,i,!0),t.childLanes=a,null}function Ql(e,t){return t=ks({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function Cd(e,t,n){return Jn(t,e.child,null,n),e=Ql(t,t.pendingProps),e.flags|=2,Ze(t),t.memoizedState=null,e}function Ob(e,t,n){var i=t.pendingProps,a=(t.flags&128)!==0;if(t.flags&=-129,e===null){if(X){if(i.mode==="hidden")return e=Ql(t,i),t.lanes=536870912,xa(null,e);if(Yo(t),(e=se)?(e=cp(e,ht),e=e!==null&&e.data==="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Tn!==null?{id:Et,overflow:Ct}:null,retryLane:536870912,hydrationErrors:null},n=jm(e),n.return=t,t.child=n,Oe=t,se=null)):e=null,e===null)throw En(t);return t.lanes=536870912,null}return Ql(t,i)}var l=e.memoizedState;if(l!==null){var s=l.dehydrated;if(Yo(t),a)if(t.flags&256)t.flags&=-257,t=Cd(e,t,n);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(E(558));else if(xe||na(e,t,n,!1),a=(n&e.childLanes)!==0,xe||a){if(i=ne,i!==null&&(s=Zh(i,n),s!==0&&s!==l.retryLane))throw l.retryLane=s,ii(e,s),Ye(i,e,s),uc;Os(),t=Cd(e,t,n)}else e=l.treeContext,se=gt(s.nextSibling),Oe=t,X=!0,vn=null,ht=!1,e!==null&&Tm(t,e),t=Ql(t,i),t.flags|=4096;return t}return e=Gt(e.child,{mode:i.mode,children:i.children}),e.ref=t.ref,t.child=e,e.return=t,e}function Zl(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(E(284));(e===null||e.ref!==n)&&(t.flags|=4194816)}}function Zo(e,t,n,i,a){return Zn(t),n=Fu(e,t,n,i,void 0,a),i=Pu(),e!==null&&!xe?(Wu(e,t,a),Jt(e,t,a)):(X&&i&&Yu(t),t.flags|=1,Ee(e,t,n,a),t.child)}function Od(e,t,n,i,a,l){return Zn(t),t.updateQueue=null,n=Rm(t,i,n,a),Nm(e),i=Pu(),e!==null&&!xe?(Wu(e,t,l),Jt(e,t,l)):(X&&i&&Yu(t),t.flags|=1,Ee(e,t,n,l),t.child)}function Dd(e,t,n,i,a){if(Zn(t),t.stateNode===null){var l=Ei,s=n.contextType;typeof s=="object"&&s!==null&&(l=_e(s)),l=new n(i,l),t.memoizedState=l.state!==null&&l.state!==void 0?l.state:null,l.updater=Xo,t.stateNode=l,l._reactInternals=t,l=t.stateNode,l.props=i,l.state=t.memoizedState,l.refs={},Qu(t),s=n.contextType,l.context=typeof s=="object"&&s!==null?_e(s):Ei,l.state=t.memoizedState,s=n.getDerivedStateFromProps,typeof s=="function"&&(Ar(t,n,s,i),l.state=t.memoizedState),typeof n.getDerivedStateFromProps=="function"||typeof l.getSnapshotBeforeUpdate=="function"||typeof l.UNSAFE_componentWillMount!="function"&&typeof l.componentWillMount!="function"||(s=l.state,typeof l.componentWillMount=="function"&&l.componentWillMount(),typeof l.UNSAFE_componentWillMount=="function"&&l.UNSAFE_componentWillMount(),s!==l.state&&Xo.enqueueReplaceState(l,l.state,null),Da(t,i,l,a),Oa(),l.state=t.memoizedState),typeof l.componentDidMount=="function"&&(t.flags|=4194308),i=!0}else if(e===null){l=t.stateNode;var o=t.memoizedProps,u=Pn(n,o);l.props=u;var d=l.context,g=n.contextType;s=Ei,typeof g=="object"&&g!==null&&(s=_e(g));var p=n.getDerivedStateFromProps;g=typeof p=="function"||typeof l.getSnapshotBeforeUpdate=="function",o=t.pendingProps!==o,g||typeof l.UNSAFE_componentWillReceiveProps!="function"&&typeof l.componentWillReceiveProps!="function"||(o||d!==s)&&wd(t,l,i,s),sn=!1;var h=t.memoizedState;l.state=h,Da(t,i,l,a),Oa(),d=t.memoizedState,o||h!==d||sn?(typeof p=="function"&&(Ar(t,n,p,i),d=t.memoizedState),(u=sn||Sd(t,n,u,i,h,d,s))?(g||typeof l.UNSAFE_componentWillMount!="function"&&typeof l.componentWillMount!="function"||(typeof l.componentWillMount=="function"&&l.componentWillMount(),typeof l.UNSAFE_componentWillMount=="function"&&l.UNSAFE_componentWillMount()),typeof l.componentDidMount=="function"&&(t.flags|=4194308)):(typeof l.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=i,t.memoizedState=d),l.props=i,l.state=d,l.context=s,i=u):(typeof l.componentDidMount=="function"&&(t.flags|=4194308),i=!1)}else{l=t.stateNode,Bo(e,t),s=t.memoizedProps,g=Pn(n,s),l.props=g,p=t.pendingProps,h=l.context,d=n.contextType,u=Ei,typeof d=="object"&&d!==null&&(u=_e(d)),o=n.getDerivedStateFromProps,(d=typeof o=="function"||typeof l.getSnapshotBeforeUpdate=="function")||typeof l.UNSAFE_componentWillReceiveProps!="function"&&typeof l.componentWillReceiveProps!="function"||(s!==p||h!==u)&&wd(t,l,i,u),sn=!1,h=t.memoizedState,l.state=h,Da(t,i,l,a),Oa();var f=t.memoizedState;s!==p||h!==f||sn||e!==null&&e.dependencies!==null&&vs(e.dependencies)?(typeof o=="function"&&(Ar(t,n,o,i),f=t.memoizedState),(g=sn||Sd(t,n,g,i,h,f,u)||e!==null&&e.dependencies!==null&&vs(e.dependencies))?(d||typeof l.UNSAFE_componentWillUpdate!="function"&&typeof l.componentWillUpdate!="function"||(typeof l.componentWillUpdate=="function"&&l.componentWillUpdate(i,f,u),typeof l.UNSAFE_componentWillUpdate=="function"&&l.UNSAFE_componentWillUpdate(i,f,u)),typeof l.componentDidUpdate=="function"&&(t.flags|=4),typeof l.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof l.componentDidUpdate!="function"||s===e.memoizedProps&&h===e.memoizedState||(t.flags|=4),typeof l.getSnapshotBeforeUpdate!="function"||s===e.memoizedProps&&h===e.memoizedState||(t.flags|=1024),t.memoizedProps=i,t.memoizedState=f),l.props=i,l.state=f,l.context=u,i=g):(typeof l.componentDidUpdate!="function"||s===e.memoizedProps&&h===e.memoizedState||(t.flags|=4),typeof l.getSnapshotBeforeUpdate!="function"||s===e.memoizedProps&&h===e.memoizedState||(t.flags|=1024),i=!1)}return l=i,Zl(e,t),i=(t.flags&128)!==0,l||i?(l=t.stateNode,n=i&&typeof n.getDerivedStateFromError!="function"?null:l.render(),t.flags|=1,e!==null&&i?(t.child=Jn(t,e.child,null,a),t.child=Jn(t,null,n,a)):Ee(e,t,n,a),t.memoizedState=l.state,e=t.child):e=Jt(e,t,a),e}function _d(e,t,n,i){return Qn(),t.flags|=256,Ee(e,t,n,i),t.child}var zr={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Mr(e){return{baseLanes:e,cachePool:Cm()}}function Nr(e,t,n){return e=e!==null?e.childLanes&~n:0,t&&(e|=Fe),e}function bg(e,t,n){var i=t.pendingProps,a=!1,l=(t.flags&128)!==0,s;if((s=l)||(s=e!==null&&e.memoizedState===null?!1:(ge.current&2)!==0),s&&(a=!0,t.flags&=-129),s=(t.flags&32)!==0,t.flags&=-33,e===null){if(X){if(a?on(t):un(),(e=se)?(e=cp(e,ht),e=e!==null&&e.data!=="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Tn!==null?{id:Et,overflow:Ct}:null,retryLane:536870912,hydrationErrors:null},n=jm(e),n.return=t,t.child=n,Oe=t,se=null)):e=null,e===null)throw En(t);return uu(e)?t.lanes=32:t.lanes=536870912,null}var o=i.children;return i=i.fallback,a?(un(),a=t.mode,o=ks({mode:"hidden",children:o},a),i=Gn(i,a,n,null),o.return=t,i.return=t,o.sibling=i,t.child=o,i=t.child,i.memoizedState=Mr(n),i.childLanes=Nr(e,s,n),t.memoizedState=zr,xa(null,i)):(on(t),Jo(t,o))}var u=e.memoizedState;if(u!==null&&(o=u.dehydrated,o!==null)){if(l)t.flags&256?(on(t),t.flags&=-257,t=Rr(e,t,n)):t.memoizedState!==null?(un(),t.child=e.child,t.flags|=128,t=null):(un(),o=i.fallback,a=t.mode,i=ks({mode:"visible",children:i.children},a),o=Gn(o,a,n,null),o.flags|=2,i.return=t,o.return=t,i.sibling=o,t.child=i,Jn(t,e.child,null,n),i=t.child,i.memoizedState=Mr(n),i.childLanes=Nr(e,s,n),t.memoizedState=zr,t=xa(null,i));else if(on(t),uu(o)){if(s=o.nextSibling&&o.nextSibling.dataset,s)var d=s.dgst;s=d,i=Error(E(419)),i.stack="",i.digest=s,qa({value:i,source:null,stack:null}),t=Rr(e,t,n)}else if(xe||na(e,t,n,!1),s=(n&e.childLanes)!==0,xe||s){if(s=ne,s!==null&&(i=Zh(s,n),i!==0&&i!==u.retryLane))throw u.retryLane=i,ii(e,i),Ye(s,e,i),uc;ou(o)||Os(),t=Rr(e,t,n)}else ou(o)?(t.flags|=192,t.child=e.child,t=null):(e=u.treeContext,se=gt(o.nextSibling),Oe=t,X=!0,vn=null,ht=!1,e!==null&&Tm(t,e),t=Jo(t,i.children),t.flags|=4096);return t}return a?(un(),o=i.fallback,a=t.mode,u=e.child,d=u.sibling,i=Gt(u,{mode:"hidden",children:i.children}),i.subtreeFlags=u.subtreeFlags&65011712,d!==null?o=Gt(d,o):(o=Gn(o,a,n,null),o.flags|=2),o.return=t,i.return=t,i.sibling=o,t.child=i,xa(null,i),i=t.child,o=e.child.memoizedState,o===null?o=Mr(n):(a=o.cachePool,a!==null?(u=be._currentValue,a=a.parent!==u?{parent:u,pool:u}:a):a=Cm(),o={baseLanes:o.baseLanes|n,cachePool:a}),i.memoizedState=o,i.childLanes=Nr(e,s,n),t.memoizedState=zr,xa(e.child,i)):(on(t),n=e.child,e=n.sibling,n=Gt(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 Jo(e,t){return t=ks({mode:"visible",children:t},e.mode),t.return=e,e.child=t}function ks(e,t){return e=Je(22,e,null,t),e.lanes=0,e}function Rr(e,t,n){return Jn(t,e.child,null,n),e=Jo(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function Ad(e,t,n){e.lanes|=t;var i=e.alternate;i!==null&&(i.lanes|=t),Uo(e.return,t,n)}function Ir(e,t,n,i,a,l){var s=e.memoizedState;s===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:i,tail:n,tailMode:a,treeForkCount:l}:(s.isBackwards=t,s.rendering=null,s.renderingStartTime=0,s.last=i,s.tail=n,s.tailMode=a,s.treeForkCount=l)}function xg(e,t,n){var i=t.pendingProps,a=i.revealOrder,l=i.tail;i=i.children;var s=ge.current,o=(s&2)!==0;if(o?(s=s&1|2,t.flags|=128):s&=1,ae(ge,s),Ee(e,t,i,n),i=X?$a:0,!o&&e!==null&&e.flags&128)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&Ad(e,n,t);else if(e.tag===19)Ad(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(a){case"forwards":for(n=t.child,a=null;n!==null;)e=n.alternate,e!==null&&xs(e)===null&&(a=n),n=n.sibling;n=a,n===null?(a=t.child,t.child=null):(a=n.sibling,n.sibling=null),Ir(t,!1,a,n,l,i);break;case"backwards":case"unstable_legacy-backwards":for(n=null,a=t.child,t.child=null;a!==null;){if(e=a.alternate,e!==null&&xs(e)===null){t.child=a;break}e=a.sibling,a.sibling=n,n=a,a=e}Ir(t,!0,n,null,l,i);break;case"together":Ir(t,!1,null,null,void 0,i);break;default:t.memoizedState=null}return t.child}function Jt(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),On|=t.lanes,!(n&t.childLanes))if(e!==null){if(na(e,t,n,!1),(n&t.childLanes)===0)return null}else return null;if(e!==null&&t.child!==e.child)throw Error(E(153));if(t.child!==null){for(e=t.child,n=Gt(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=Gt(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function cc(e,t){return e.lanes&t?!0:(e=e.dependencies,!!(e!==null&&vs(e)))}function Db(e,t,n){switch(t.tag){case 3:cs(t,t.stateNode.containerInfo),rn(t,be,e.memoizedState.cache),Qn();break;case 27:case 5:ko(t);break;case 4:cs(t,t.stateNode.containerInfo);break;case 10:rn(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,Yo(t),null;break;case 13:var i=t.memoizedState;if(i!==null)return i.dehydrated!==null?(on(t),t.flags|=128,null):n&t.child.childLanes?bg(e,t,n):(on(t),e=Jt(e,t,n),e!==null?e.sibling:null);on(t);break;case 19:var a=(e.flags&128)!==0;if(i=(n&t.childLanes)!==0,i||(na(e,t,n,!1),i=(n&t.childLanes)!==0),a){if(i)return xg(e,t,n);t.flags|=128}if(a=t.memoizedState,a!==null&&(a.rendering=null,a.tail=null,a.lastEffect=null),ae(ge,ge.current),i)break;return null;case 22:return t.lanes=0,yg(e,t,n,t.pendingProps);case 24:rn(t,be,e.memoizedState.cache)}return Jt(e,t,n)}function Sg(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps)xe=!0;else{if(!cc(e,n)&&!(t.flags&128))return xe=!1,Db(e,t,n);xe=!!(e.flags&131072)}else xe=!1,X&&t.flags&1048576&&km(t,$a,t.index);switch(t.lanes=0,t.tag){case 16:e:{var i=t.pendingProps;if(e=Hn(t.elementType),t.type=e,typeof e=="function")qu(e)?(i=Pn(e,i),t.tag=1,t=Dd(null,t,e,i,n)):(t.tag=0,t=Zo(null,t,e,i,n));else{if(e!=null){var a=e.$$typeof;if(a===Ou){t.tag=11,t=kd(null,t,e,i,n);break e}else if(a===Du){t.tag=14,t=Td(null,t,e,i,n);break e}}throw t=wo(e)||e,Error(E(306,t,""))}}return t;case 0:return Zo(e,t,t.type,t.pendingProps,n);case 1:return i=t.type,a=Pn(i,t.pendingProps),Dd(e,t,i,a,n);case 3:e:{if(cs(t,t.stateNode.containerInfo),e===null)throw Error(E(387));i=t.pendingProps;var l=t.memoizedState;a=l.element,Bo(e,t),Da(t,i,null,n);var s=t.memoizedState;if(i=s.cache,rn(t,be,i),i!==l.cache&&Lo(t,[be],n,!0),Oa(),i=s.element,l.isDehydrated)if(l={element:i,isDehydrated:!1,cache:s.cache},t.updateQueue.baseState=l,t.memoizedState=l,t.flags&256){t=_d(e,t,i,n);break e}else if(i!==a){a=ft(Error(E(424)),t),qa(a),t=_d(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}for(se=gt(e.firstChild),Oe=t,X=!0,vn=null,ht=!0,n=_m(t,null,i,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling}else{if(Qn(),i===a){t=Jt(e,t,n);break e}Ee(e,t,i,n)}t=t.child}return t;case 26:return Zl(e,t),e===null?(n=Fd(t.type,null,t.pendingProps,null))?t.memoizedState=n:X||(n=t.type,e=t.pendingProps,i=zs(pn.current).createElement(n),i[Ce]=t,i[Ge]=e,Ae(i,n,e),ke(i),t.stateNode=i):t.memoizedState=Fd(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return ko(t),e===null&&X&&(i=t.stateNode=dp(t.type,t.pendingProps,pn.current),Oe=t,ht=!0,a=se,_n(t.type)?(cu=a,se=gt(i.firstChild)):se=a),Ee(e,t,t.pendingProps.children,n),Zl(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&X&&((a=i=se)&&(i=l0(i,t.type,t.pendingProps,ht),i!==null?(t.stateNode=i,Oe=t,se=gt(i.firstChild),ht=!1,a=!0):a=!1),a||En(t)),ko(t),a=t.type,l=t.pendingProps,s=e!==null?e.memoizedProps:null,i=l.children,su(a,l)?i=null:s!==null&&su(a,s)&&(t.flags|=32),t.memoizedState!==null&&(a=Fu(e,t,xb,null,null,n),Qa._currentValue=a),Zl(e,t),Ee(e,t,i,n),t.child;case 6:return e===null&&X&&((e=n=se)&&(n=s0(n,t.pendingProps,ht),n!==null?(t.stateNode=n,Oe=t,se=null,e=!0):e=!1),e||En(t)),null;case 13:return bg(e,t,n);case 4:return cs(t,t.stateNode.containerInfo),i=t.pendingProps,e===null?t.child=Jn(t,null,i,n):Ee(e,t,i,n),t.child;case 11:return kd(e,t,t.type,t.pendingProps,n);case 7:return Ee(e,t,t.pendingProps,n),t.child;case 8:return Ee(e,t,t.pendingProps.children,n),t.child;case 12:return Ee(e,t,t.pendingProps.children,n),t.child;case 10:return i=t.pendingProps,rn(t,t.type,i.value),Ee(e,t,i.children,n),t.child;case 9:return a=t.type._context,i=t.pendingProps.children,Zn(t),a=_e(a),i=i(a),t.flags|=1,Ee(e,t,i,n),t.child;case 14:return Td(e,t,t.type,t.pendingProps,n);case 15:return vg(e,t,t.type,t.pendingProps,n);case 19:return xg(e,t,n);case 31:return Ob(e,t,n);case 22:return yg(e,t,n,t.pendingProps);case 24:return Zn(t),i=_e(be),e===null?(a=Ku(),a===null&&(a=ne,l=Vu(),a.pooledCache=l,l.refCount++,l!==null&&(a.pooledCacheLanes|=n),a=l),t.memoizedState={parent:i,cache:a},Qu(t),rn(t,be,a)):(e.lanes&n&&(Bo(e,t),Da(t,null,null,n),Oa()),a=e.memoizedState,l=t.memoizedState,a.parent!==i?(a={parent:i,cache:i},t.memoizedState=a,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=a),rn(t,be,i)):(i=l.cache,rn(t,be,i),i!==a.cache&&Lo(t,[be],n,!0))),Ee(e,t,t.pendingProps.children,n),t.child;case 29:throw t.pendingProps}throw Error(E(156,t.tag))}function Nt(e){e.flags|=4}function Ur(e,t,n,i,a){if((t=(e.mode&32)!==0)&&(t=!1),t){if(e.flags|=16777216,(a&335544128)===a)if(e.stateNode.complete)e.flags|=8192;else if(Vg())e.flags|=8192;else throw Kn=ys,Xu}else e.flags&=-16777217}function zd(e,t){if(t.type!=="stylesheet"||t.state.loading&4)e.flags&=-16777217;else if(e.flags|=16777216,!mp(t))if(Vg())e.flags|=8192;else throw Kn=ys,Xu}function xl(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag!==22?Kh():536870912,e.lanes|=t,Vi|=t)}function da(e,t){if(!X)switch(e.tailMode){case"hidden":t=e.tail;for(var n=null;t!==null;)t.alternate!==null&&(n=t),t=t.sibling;n===null?e.tail=null:n.sibling=null;break;case"collapsed":n=e.tail;for(var 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}}function le(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,i=0;if(t)for(var a=e.child;a!==null;)n|=a.lanes|a.childLanes,i|=a.subtreeFlags&65011712,i|=a.flags&65011712,a.return=e,a=a.sibling;else for(a=e.child;a!==null;)n|=a.lanes|a.childLanes,i|=a.subtreeFlags,i|=a.flags,a.return=e,a=a.sibling;return e.subtreeFlags|=i,e.childLanes=n,t}function _b(e,t,n){var i=t.pendingProps;switch(Gu(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:return n=t.stateNode,i=null,e!==null&&(i=e.memoizedState.cache),t.memoizedState.cache!==i&&(t.flags|=2048),Vt(be),Hi(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(e===null||e.child===null)&&(si(t)?Nt(t):e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,Or())),le(t),null;case 26:var a=t.type,l=t.memoizedState;return e===null?(Nt(t),l!==null?(le(t),zd(t,l)):(le(t),Ur(t,a,null,i,n))):l?l!==e.memoizedState?(Nt(t),le(t),zd(t,l)):(le(t),t.flags&=-16777217):(e=e.memoizedProps,e!==i&&Nt(t),le(t),Ur(t,a,e,i,n)),null;case 27:if(ds(t),n=pn.current,a=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==i&&Nt(t);else{if(!i){if(t.stateNode===null)throw Error(E(166));return le(t),null}e=Dt.current,si(t)?rd(t):(e=dp(a,i,n),t.stateNode=e,Nt(t))}return le(t),null;case 5:if(ds(t),a=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==i&&Nt(t);else{if(!i){if(t.stateNode===null)throw Error(E(166));return le(t),null}if(l=Dt.current,si(t))rd(t);else{var s=zs(pn.current);switch(l){case 1:l=s.createElementNS("http://www.w3.org/2000/svg",a);break;case 2:l=s.createElementNS("http://www.w3.org/1998/Math/MathML",a);break;default:switch(a){case"svg":l=s.createElementNS("http://www.w3.org/2000/svg",a);break;case"math":l=s.createElementNS("http://www.w3.org/1998/Math/MathML",a);break;case"script":l=s.createElement("div"),l.innerHTML="<script><\/script>",l=l.removeChild(l.firstChild);break;case"select":l=typeof i.is=="string"?s.createElement("select",{is:i.is}):s.createElement("select"),i.multiple?l.multiple=!0:i.size&&(l.size=i.size);break;default:l=typeof i.is=="string"?s.createElement(a,{is:i.is}):s.createElement(a)}}l[Ce]=t,l[Ge]=i;e:for(s=t.child;s!==null;){if(s.tag===5||s.tag===6)l.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=l;e:switch(Ae(l,a,i),a){case"button":case"input":case"select":case"textarea":i=!!i.autoFocus;break e;case"img":i=!0;break e;default:i=!1}i&&Nt(t)}}return le(t),Ur(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,n),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==i&&Nt(t);else{if(typeof i!="string"&&t.stateNode===null)throw Error(E(166));if(e=pn.current,si(t)){if(e=t.stateNode,n=t.memoizedProps,i=null,a=Oe,a!==null)switch(a.tag){case 27:case 5:i=a.memoizedProps}e[Ce]=t,e=!!(e.nodeValue===n||i!==null&&i.suppressHydrationWarning===!0||rp(e.nodeValue,n)),e||En(t,!0)}else e=zs(e).createTextNode(i),e[Ce]=t,t.stateNode=e}return le(t),null;case 31:if(n=t.memoizedState,e===null||e.memoizedState!==null){if(i=si(t),n!==null){if(e===null){if(!i)throw Error(E(318));if(e=t.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(E(557));e[Ce]=t}else Qn(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;le(t),e=!1}else n=Or(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=n),e=!0;if(!e)return t.flags&256?(Ze(t),t):(Ze(t),null);if(t.flags&128)throw Error(E(558))}return le(t),null;case 13:if(i=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(a=si(t),i!==null&&i.dehydrated!==null){if(e===null){if(!a)throw Error(E(318));if(a=t.memoizedState,a=a!==null?a.dehydrated:null,!a)throw Error(E(317));a[Ce]=t}else Qn(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;le(t),a=!1}else a=Or(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=a),a=!0;if(!a)return t.flags&256?(Ze(t),t):(Ze(t),null)}return Ze(t),t.flags&128?(t.lanes=n,t):(n=i!==null,e=e!==null&&e.memoizedState!==null,n&&(i=t.child,a=null,i.alternate!==null&&i.alternate.memoizedState!==null&&i.alternate.memoizedState.cachePool!==null&&(a=i.alternate.memoizedState.cachePool.pool),l=null,i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(l=i.memoizedState.cachePool.pool),l!==a&&(i.flags|=2048)),n!==e&&n&&(t.child.flags|=8192),xl(t,t.updateQueue),le(t),null);case 4:return Hi(),e===null&&vc(t.stateNode.containerInfo),le(t),null;case 10:return Vt(t.type),le(t),null;case 19:if(Te(ge),i=t.memoizedState,i===null)return le(t),null;if(a=(t.flags&128)!==0,l=i.rendering,l===null)if(a)da(i,!1);else{if(me!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(l=xs(e),l!==null){for(t.flags|=128,da(i,!1),e=l.updateQueue,t.updateQueue=e,xl(t,e),t.subtreeFlags=0,e=n,n=t.child;n!==null;)wm(n,e),n=n.sibling;return ae(ge,ge.current&1|2),X&&Ht(t,i.treeForkCount),t.child}e=e.sibling}i.tail!==null&&Pe()>Es&&(t.flags|=128,a=!0,da(i,!1),t.lanes=4194304)}else{if(!a)if(e=xs(l),e!==null){if(t.flags|=128,a=!0,e=e.updateQueue,t.updateQueue=e,xl(t,e),da(i,!0),i.tail===null&&i.tailMode==="hidden"&&!l.alternate&&!X)return le(t),null}else 2*Pe()-i.renderingStartTime>Es&&n!==536870912&&(t.flags|=128,a=!0,da(i,!1),t.lanes=4194304);i.isBackwards?(l.sibling=t.child,t.child=l):(e=i.last,e!==null?e.sibling=l:t.child=l,i.last=l)}return i.tail!==null?(e=i.tail,i.rendering=e,i.tail=e.sibling,i.renderingStartTime=Pe(),e.sibling=null,n=ge.current,ae(ge,a?n&1|2:n&1),X&&Ht(t,i.treeForkCount),e):(le(t),null);case 22:case 23:return Ze(t),Zu(),i=t.memoizedState!==null,e!==null?e.memoizedState!==null!==i&&(t.flags|=8192):i&&(t.flags|=8192),i?n&536870912&&!(t.flags&128)&&(le(t),t.subtreeFlags&6&&(t.flags|=8192)):le(t),n=t.updateQueue,n!==null&&xl(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&&Te(Vn),null;case 24:return n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),Vt(be),le(t),null;case 25:return null;case 30:return null}throw Error(E(156,t.tag))}function Ab(e,t){switch(Gu(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Vt(be),Hi(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return ds(t),null;case 31:if(t.memoizedState!==null){if(Ze(t),t.alternate===null)throw Error(E(340));Qn()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(Ze(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(E(340));Qn()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return Te(ge),null;case 4:return Hi(),null;case 10:return Vt(t.type),null;case 22:case 23:return Ze(t),Zu(),e!==null&&Te(Vn),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return Vt(be),null;case 25:return null;default:return null}}function wg(e,t){switch(Gu(t),t.tag){case 3:Vt(be),Hi();break;case 26:case 27:case 5:ds(t);break;case 4:Hi();break;case 31:t.memoizedState!==null&&Ze(t);break;case 13:Ze(t);break;case 19:Te(ge);break;case 10:Vt(t.type);break;case 22:case 23:Ze(t),Zu(),e!==null&&Te(Vn);break;case 24:Vt(be)}}function sl(e,t){try{var n=t.updateQueue,i=n!==null?n.lastEffect:null;if(i!==null){var a=i.next;n=a;do{if((n.tag&e)===e){i=void 0;var l=n.create,s=n.inst;i=l(),s.destroy=i}n=n.next}while(n!==a)}}catch(o){P(t,t.return,o)}}function Cn(e,t,n){try{var i=t.updateQueue,a=i!==null?i.lastEffect:null;if(a!==null){var l=a.next;i=l;do{if((i.tag&e)===e){var s=i.inst,o=s.destroy;if(o!==void 0){s.destroy=void 0,a=t;var u=n,d=o;try{d()}catch(g){P(a,u,g)}}}i=i.next}while(i!==l)}}catch(g){P(t,t.return,g)}}function jg(e){var t=e.updateQueue;if(t!==null){var n=e.stateNode;try{zm(t,n)}catch(i){P(e,e.return,i)}}}function kg(e,t,n){n.props=Pn(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(i){P(e,t,i)}}function Aa(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:i=e.stateNode;break;default:i=e.stateNode}typeof n=="function"?e.refCleanup=n(i):n.current=i}}catch(a){P(e,t,a)}}function Ot(e,t){var n=e.ref,i=e.refCleanup;if(n!==null)if(typeof i=="function")try{i()}catch(a){P(e,t,a)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof n=="function")try{n(null)}catch(a){P(e,t,a)}else n.current=null}function Tg(e){var t=e.type,n=e.memoizedProps,i=e.stateNode;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(a){P(e,e.return,a)}}function Lr(e,t,n){try{var i=e.stateNode;Wb(i,e.type,n,t),i[Ge]=t}catch(a){P(e,e.return,a)}}function Eg(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&_n(e.type)||e.tag===4}function Hr(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Eg(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.tag===27&&_n(e.type)||e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Fo(e,t,n){var i=e.tag;if(i===5||i===6)e=e.stateNode,t?(n.nodeType===9?n.body:n.nodeName==="HTML"?n.ownerDocument.body:n).insertBefore(e,t):(t=n.nodeType===9?n.body:n.nodeName==="HTML"?n.ownerDocument.body:n,t.appendChild(e),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=qt));else if(i!==4&&(i===27&&_n(e.type)&&(n=e.stateNode,t=null),e=e.child,e!==null))for(Fo(e,t,n),e=e.sibling;e!==null;)Fo(e,t,n),e=e.sibling}function Ts(e,t,n){var i=e.tag;if(i===5||i===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(i!==4&&(i===27&&_n(e.type)&&(n=e.stateNode),e=e.child,e!==null))for(Ts(e,t,n),e=e.sibling;e!==null;)Ts(e,t,n),e=e.sibling}function Cg(e){var t=e.stateNode,n=e.memoizedProps;try{for(var i=e.type,a=t.attributes;a.length;)t.removeAttributeNode(a[0]);Ae(t,i,n),t[Ce]=e,t[Ge]=n}catch(l){P(e,e.return,l)}}var Bt=!1,ye=!1,Br=!1,Md=typeof WeakSet=="function"?WeakSet:Set,je=null;function zb(e,t){if(e=e.containerInfo,au=Is,e=mm(e),Hu(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var i=n.getSelection&&n.getSelection();if(i&&i.rangeCount!==0){n=i.anchorNode;var a=i.anchorOffset,l=i.focusNode;i=i.focusOffset;try{n.nodeType,l.nodeType}catch{n=null;break e}var s=0,o=-1,u=-1,d=0,g=0,p=e,h=null;t:for(;;){for(var f;p!==n||a!==0&&p.nodeType!==3||(o=s+a),p!==l||i!==0&&p.nodeType!==3||(u=s+i),p.nodeType===3&&(s+=p.nodeValue.length),(f=p.firstChild)!==null;)h=p,p=f;for(;;){if(p===e)break t;if(h===n&&++d===a&&(o=s),h===l&&++g===i&&(u=s),(f=p.nextSibling)!==null)break;p=h,h=p.parentNode}p=f}n=o===-1||u===-1?null:{start:o,end:u}}else n=null}n=n||{start:0,end:0}}else n=null;for(lu={focusedElem:e,selectionRange:n},Is=!1,je=t;je!==null;)if(t=je,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,je=e;else for(;je!==null;){switch(t=je,l=t.alternate,e=t.flags,t.tag){case 0:if(e&4&&(e=t.updateQueue,e=e!==null?e.events:null,e!==null))for(n=0;n<e.length;n++)a=e[n],a.ref.impl=a.nextImpl;break;case 11:case 15:break;case 1:if(e&1024&&l!==null){e=void 0,n=t,a=l.memoizedProps,l=l.memoizedState,i=n.stateNode;try{var y=Pn(n.type,a);e=i.getSnapshotBeforeUpdate(y,l),i.__reactInternalSnapshotBeforeUpdate=e}catch(v){P(n,n.return,v)}}break;case 3:if(e&1024){if(e=t.stateNode.containerInfo,n=e.nodeType,n===9)ru(e);else if(n===1)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":ru(e);break;default:e.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if(e&1024)throw Error(E(163))}if(e=t.sibling,e!==null){e.return=t.return,je=e;break}je=t.return}}function Og(e,t,n){var i=n.flags;switch(n.tag){case 0:case 11:case 15:It(e,n),i&4&&sl(5,n);break;case 1:if(It(e,n),i&4)if(e=n.stateNode,t===null)try{e.componentDidMount()}catch(s){P(n,n.return,s)}else{var a=Pn(n.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(a,t,e.__reactInternalSnapshotBeforeUpdate)}catch(s){P(n,n.return,s)}}i&64&&jg(n),i&512&&Aa(n,n.return);break;case 3:if(It(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{zm(e,t)}catch(s){P(n,n.return,s)}}break;case 27:t===null&&i&4&&Cg(n);case 26:case 5:It(e,n),t===null&&i&4&&Tg(n),i&512&&Aa(n,n.return);break;case 12:It(e,n);break;case 31:It(e,n),i&4&&Ag(e,n);break;case 13:It(e,n),i&4&&zg(e,n),i&64&&(e=n.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(n=$b.bind(null,n),r0(e,n))));break;case 22:if(i=n.memoizedState!==null||Bt,!i){t=t!==null&&t.memoizedState!==null||ye,a=Bt;var l=ye;Bt=i,(ye=t)&&!l?Lt(e,n,(n.subtreeFlags&8772)!==0):It(e,n),Bt=a,ye=l}break;case 30:break;default:It(e,n)}}function Dg(e){var t=e.alternate;t!==null&&(e.alternate=null,Dg(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&Mu(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 ce=null,$e=!1;function Rt(e,t,n){for(n=n.child;n!==null;)_g(e,t,n),n=n.sibling}function _g(e,t,n){if(We&&typeof We.onCommitFiberUnmount=="function")try{We.onCommitFiberUnmount(Wa,n)}catch{}switch(n.tag){case 26:ye||Ot(n,t),Rt(e,t,n),n.memoizedState?n.memoizedState.count--:n.stateNode&&(n=n.stateNode,n.parentNode.removeChild(n));break;case 27:ye||Ot(n,t);var i=ce,a=$e;_n(n.type)&&(ce=n.stateNode,$e=!1),Rt(e,t,n),Ra(n.stateNode),ce=i,$e=a;break;case 5:ye||Ot(n,t);case 6:if(i=ce,a=$e,ce=null,Rt(e,t,n),ce=i,$e=a,ce!==null)if($e)try{(ce.nodeType===9?ce.body:ce.nodeName==="HTML"?ce.ownerDocument.body:ce).removeChild(n.stateNode)}catch(l){P(n,t,l)}else try{ce.removeChild(n.stateNode)}catch(l){P(n,t,l)}break;case 18:ce!==null&&($e?(e=ce,Kd(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,n.stateNode),Zi(e)):Kd(ce,n.stateNode));break;case 4:i=ce,a=$e,ce=n.stateNode.containerInfo,$e=!0,Rt(e,t,n),ce=i,$e=a;break;case 0:case 11:case 14:case 15:Cn(2,n,t),ye||Cn(4,n,t),Rt(e,t,n);break;case 1:ye||(Ot(n,t),i=n.stateNode,typeof i.componentWillUnmount=="function"&&kg(n,t,i)),Rt(e,t,n);break;case 21:Rt(e,t,n);break;case 22:ye=(i=ye)||n.memoizedState!==null,Rt(e,t,n),ye=i;break;default:Rt(e,t,n)}}function Ag(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{Zi(e)}catch(n){P(t,t.return,n)}}}function zg(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{Zi(e)}catch(n){P(t,t.return,n)}}function Mb(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new Md),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new Md),t;default:throw Error(E(435,e.tag))}}function Sl(e,t){var n=Mb(e);t.forEach(function(i){if(!n.has(i)){n.add(i);var a=qb.bind(null,e,i);i.then(a,a)}})}function He(e,t){var n=t.deletions;if(n!==null)for(var i=0;i<n.length;i++){var a=n[i],l=e,s=t,o=s;e:for(;o!==null;){switch(o.tag){case 27:if(_n(o.type)){ce=o.stateNode,$e=!1;break e}break;case 5:ce=o.stateNode,$e=!1;break e;case 3:case 4:ce=o.stateNode.containerInfo,$e=!0;break e}o=o.return}if(ce===null)throw Error(E(160));_g(l,s,a),ce=null,$e=!1,l=a.alternate,l!==null&&(l.return=null),a.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)Mg(t,e),t=t.sibling}var xt=null;function Mg(e,t){var n=e.alternate,i=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:He(t,e),Be(e),i&4&&(Cn(3,e,e.return),sl(3,e),Cn(5,e,e.return));break;case 1:He(t,e),Be(e),i&512&&(ye||n===null||Ot(n,n.return)),i&64&&Bt&&(e=e.updateQueue,e!==null&&(i=e.callbacks,i!==null&&(n=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=n===null?i:n.concat(i))));break;case 26:var a=xt;if(He(t,e),Be(e),i&512&&(ye||n===null||Ot(n,n.return)),i&4){var l=n!==null?n.memoizedState:null;if(i=e.memoizedState,n===null)if(i===null)if(e.stateNode===null){e:{i=e.type,n=e.memoizedProps,a=a.ownerDocument||a;t:switch(i){case"title":l=a.getElementsByTagName("title")[0],(!l||l[nl]||l[Ce]||l.namespaceURI==="http://www.w3.org/2000/svg"||l.hasAttribute("itemprop"))&&(l=a.createElement(i),a.head.insertBefore(l,a.querySelector("head > title"))),Ae(l,i,n),l[Ce]=e,ke(l),i=l;break e;case"link":var s=Wd("link","href",a).get(i+(n.href||""));if(s){for(var o=0;o<s.length;o++)if(l=s[o],l.getAttribute("href")===(n.href==null||n.href===""?null:n.href)&&l.getAttribute("rel")===(n.rel==null?null:n.rel)&&l.getAttribute("title")===(n.title==null?null:n.title)&&l.getAttribute("crossorigin")===(n.crossOrigin==null?null:n.crossOrigin)){s.splice(o,1);break t}}l=a.createElement(i),Ae(l,i,n),a.head.appendChild(l);break;case"meta":if(s=Wd("meta","content",a).get(i+(n.content||""))){for(o=0;o<s.length;o++)if(l=s[o],l.getAttribute("content")===(n.content==null?null:""+n.content)&&l.getAttribute("name")===(n.name==null?null:n.name)&&l.getAttribute("property")===(n.property==null?null:n.property)&&l.getAttribute("http-equiv")===(n.httpEquiv==null?null:n.httpEquiv)&&l.getAttribute("charset")===(n.charSet==null?null:n.charSet)){s.splice(o,1);break t}}l=a.createElement(i),Ae(l,i,n),a.head.appendChild(l);break;default:throw Error(E(468,i))}l[Ce]=e,ke(l),i=l}e.stateNode=i}else ef(a,e.type,e.stateNode);else e.stateNode=Pd(a,i,e.memoizedProps);else l!==i?(l===null?n.stateNode!==null&&(n=n.stateNode,n.parentNode.removeChild(n)):l.count--,i===null?ef(a,e.type,e.stateNode):Pd(a,i,e.memoizedProps)):i===null&&e.stateNode!==null&&Lr(e,e.memoizedProps,n.memoizedProps)}break;case 27:He(t,e),Be(e),i&512&&(ye||n===null||Ot(n,n.return)),n!==null&&i&4&&Lr(e,e.memoizedProps,n.memoizedProps);break;case 5:if(He(t,e),Be(e),i&512&&(ye||n===null||Ot(n,n.return)),e.flags&32){a=e.stateNode;try{$i(a,"")}catch(y){P(e,e.return,y)}}i&4&&e.stateNode!=null&&(a=e.memoizedProps,Lr(e,a,n!==null?n.memoizedProps:a)),i&1024&&(Br=!0);break;case 6:if(He(t,e),Be(e),i&4){if(e.stateNode===null)throw Error(E(162));i=e.memoizedProps,n=e.stateNode;try{n.nodeValue=i}catch(y){P(e,e.return,y)}}break;case 3:if(Pl=null,a=xt,xt=Ms(t.containerInfo),He(t,e),xt=a,Be(e),i&4&&n!==null&&n.memoizedState.isDehydrated)try{Zi(t.containerInfo)}catch(y){P(e,e.return,y)}Br&&(Br=!1,Ng(e));break;case 4:i=xt,xt=Ms(e.stateNode.containerInfo),He(t,e),Be(e),xt=i;break;case 12:He(t,e),Be(e);break;case 31:He(t,e),Be(e),i&4&&(i=e.updateQueue,i!==null&&(e.updateQueue=null,Sl(e,i)));break;case 13:He(t,e),Be(e),e.child.flags&8192&&e.memoizedState!==null!=(n!==null&&n.memoizedState!==null)&&(nr=Pe()),i&4&&(i=e.updateQueue,i!==null&&(e.updateQueue=null,Sl(e,i)));break;case 22:a=e.memoizedState!==null;var u=n!==null&&n.memoizedState!==null,d=Bt,g=ye;if(Bt=d||a,ye=g||u,He(t,e),ye=g,Bt=d,Be(e),i&8192)e:for(t=e.stateNode,t._visibility=a?t._visibility&-2:t._visibility|1,a&&(n===null||u||Bt||ye||Bn(e)),n=null,t=e;;){if(t.tag===5||t.tag===26){if(n===null){u=n=t;try{if(l=u.stateNode,a)s=l.style,typeof s.setProperty=="function"?s.setProperty("display","none","important"):s.display="none";else{o=u.stateNode;var p=u.memoizedProps.style,h=p!=null&&p.hasOwnProperty("display")?p.display:null;o.style.display=h==null||typeof h=="boolean"?"":(""+h).trim()}}catch(y){P(u,u.return,y)}}}else if(t.tag===6){if(n===null){u=t;try{u.stateNode.nodeValue=a?"":u.memoizedProps}catch(y){P(u,u.return,y)}}}else if(t.tag===18){if(n===null){u=t;try{var f=u.stateNode;a?Xd(f,!0):Xd(u.stateNode,!1)}catch(y){P(u,u.return,y)}}}else if((t.tag!==22&&t.tag!==23||t.memoizedState===null||t===e)&&t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break e;for(;t.sibling===null;){if(t.return===null||t.return===e)break e;n===t&&(n=null),t=t.return}n===t&&(n=null),t.sibling.return=t.return,t=t.sibling}i&4&&(i=e.updateQueue,i!==null&&(n=i.retryQueue,n!==null&&(i.retryQueue=null,Sl(e,n))));break;case 19:He(t,e),Be(e),i&4&&(i=e.updateQueue,i!==null&&(e.updateQueue=null,Sl(e,i)));break;case 30:break;case 21:break;default:He(t,e),Be(e)}}function Be(e){var t=e.flags;if(t&2){try{for(var n,i=e.return;i!==null;){if(Eg(i)){n=i;break}i=i.return}if(n==null)throw Error(E(160));switch(n.tag){case 27:var a=n.stateNode,l=Hr(e);Ts(e,l,a);break;case 5:var s=n.stateNode;n.flags&32&&($i(s,""),n.flags&=-33);var o=Hr(e);Ts(e,o,s);break;case 3:case 4:var u=n.stateNode.containerInfo,d=Hr(e);Fo(e,d,u);break;default:throw Error(E(161))}}catch(g){P(e,e.return,g)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function Ng(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;Ng(t),t.tag===5&&t.flags&1024&&t.stateNode.reset(),e=e.sibling}}function It(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)Og(e,t.alternate,t),t=t.sibling}function Bn(e){for(e=e.child;e!==null;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:Cn(4,t,t.return),Bn(t);break;case 1:Ot(t,t.return);var n=t.stateNode;typeof n.componentWillUnmount=="function"&&kg(t,t.return,n),Bn(t);break;case 27:Ra(t.stateNode);case 26:case 5:Ot(t,t.return),Bn(t);break;case 22:t.memoizedState===null&&Bn(t);break;case 30:Bn(t);break;default:Bn(t)}e=e.sibling}}function Lt(e,t,n){for(n=n&&(t.subtreeFlags&8772)!==0,t=t.child;t!==null;){var i=t.alternate,a=e,l=t,s=l.flags;switch(l.tag){case 0:case 11:case 15:Lt(a,l,n),sl(4,l);break;case 1:if(Lt(a,l,n),i=l,a=i.stateNode,typeof a.componentDidMount=="function")try{a.componentDidMount()}catch(d){P(i,i.return,d)}if(i=l,a=i.updateQueue,a!==null){var o=i.stateNode;try{var u=a.shared.hiddenCallbacks;if(u!==null)for(a.shared.hiddenCallbacks=null,a=0;a<u.length;a++)Am(u[a],o)}catch(d){P(i,i.return,d)}}n&&s&64&&jg(l),Aa(l,l.return);break;case 27:Cg(l);case 26:case 5:Lt(a,l,n),n&&i===null&&s&4&&Tg(l),Aa(l,l.return);break;case 12:Lt(a,l,n);break;case 31:Lt(a,l,n),n&&s&4&&Ag(a,l);break;case 13:Lt(a,l,n),n&&s&4&&zg(a,l);break;case 22:l.memoizedState===null&&Lt(a,l,n),Aa(l,l.return);break;case 30:break;default:Lt(a,l,n)}t=t.sibling}}function dc(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&&al(n))}function fc(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&al(e))}function vt(e,t,n,i){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)Rg(e,t,n,i),t=t.sibling}function Rg(e,t,n,i){var a=t.flags;switch(t.tag){case 0:case 11:case 15:vt(e,t,n,i),a&2048&&sl(9,t);break;case 1:vt(e,t,n,i);break;case 3:vt(e,t,n,i),a&2048&&(e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&al(e)));break;case 12:if(a&2048){vt(e,t,n,i),e=t.stateNode;try{var l=t.memoizedProps,s=l.id,o=l.onPostCommit;typeof o=="function"&&o(s,t.alternate===null?"mount":"update",e.passiveEffectDuration,-0)}catch(u){P(t,t.return,u)}}else vt(e,t,n,i);break;case 31:vt(e,t,n,i);break;case 13:vt(e,t,n,i);break;case 23:break;case 22:l=t.stateNode,s=t.alternate,t.memoizedState!==null?l._visibility&2?vt(e,t,n,i):za(e,t):l._visibility&2?vt(e,t,n,i):(l._visibility|=2,pi(e,t,n,i,(t.subtreeFlags&10256)!==0||!1)),a&2048&&dc(s,t);break;case 24:vt(e,t,n,i),a&2048&&fc(t.alternate,t);break;default:vt(e,t,n,i)}}function pi(e,t,n,i,a){for(a=a&&((t.subtreeFlags&10256)!==0||!1),t=t.child;t!==null;){var l=e,s=t,o=n,u=i,d=s.flags;switch(s.tag){case 0:case 11:case 15:pi(l,s,o,u,a),sl(8,s);break;case 23:break;case 22:var g=s.stateNode;s.memoizedState!==null?g._visibility&2?pi(l,s,o,u,a):za(l,s):(g._visibility|=2,pi(l,s,o,u,a)),a&&d&2048&&dc(s.alternate,s);break;case 24:pi(l,s,o,u,a),a&&d&2048&&fc(s.alternate,s);break;default:pi(l,s,o,u,a)}t=t.sibling}}function za(e,t){if(t.subtreeFlags&10256)for(t=t.child;t!==null;){var n=e,i=t,a=i.flags;switch(i.tag){case 22:za(n,i),a&2048&&dc(i.alternate,i);break;case 24:za(n,i),a&2048&&fc(i.alternate,i);break;default:za(n,i)}t=t.sibling}}var Sa=8192;function ri(e,t,n){if(e.subtreeFlags&Sa)for(e=e.child;e!==null;)Ig(e,t,n),e=e.sibling}function Ig(e,t,n){switch(e.tag){case 26:ri(e,t,n),e.flags&Sa&&e.memoizedState!==null&&b0(n,xt,e.memoizedState,e.memoizedProps);break;case 5:ri(e,t,n);break;case 3:case 4:var i=xt;xt=Ms(e.stateNode.containerInfo),ri(e,t,n),xt=i;break;case 22:e.memoizedState===null&&(i=e.alternate,i!==null&&i.memoizedState!==null?(i=Sa,Sa=16777216,ri(e,t,n),Sa=i):ri(e,t,n));break;default:ri(e,t,n)}}function Ug(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 fa(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var i=t[n];je=i,Hg(i,e)}Ug(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)Lg(e),e=e.sibling}function Lg(e){switch(e.tag){case 0:case 11:case 15:fa(e),e.flags&2048&&Cn(9,e,e.return);break;case 3:fa(e);break;case 12:fa(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,Jl(e)):fa(e);break;default:fa(e)}}function Jl(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var i=t[n];je=i,Hg(i,e)}Ug(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:Cn(8,t,t.return),Jl(t);break;case 22:n=t.stateNode,n._visibility&2&&(n._visibility&=-3,Jl(t));break;default:Jl(t)}e=e.sibling}}function Hg(e,t){for(;je!==null;){var n=je;switch(n.tag){case 0:case 11:case 15:Cn(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:al(n.memoizedState.cache)}if(i=n.child,i!==null)i.return=n,je=i;else e:for(n=e;je!==null;){i=je;var a=i.sibling,l=i.return;if(Dg(i),i===n){je=null;break e}if(a!==null){a.return=l,je=a;break e}je=l}}}var Nb={getCacheForType:function(e){var t=_e(be),n=t.data.get(e);return n===void 0&&(n=e(),t.data.set(e,n)),n},cacheSignal:function(){return _e(be).controller.signal}},Rb=typeof WeakMap=="function"?WeakMap:Map,Z=0,ne=null,G=null,K=0,F=0,Qe=null,hn=!1,aa=!1,hc=!1,Ft=0,me=0,On=0,Xn=0,mc=0,Fe=0,Vi=0,Ma=null,qe=null,Po=!1,nr=0,Bg=0,Es=1/0,Cs=null,xn=null,Se=0,Sn=null,Ki=null,Kt=0,Wo=0,eu=null,$g=null,Na=0,tu=null;function tt(){return Z&2&&K!==0?K&-K:U.T!==null?pc():Jh()}function qg(){if(Fe===0)if(!(K&536870912)||X){var e=hl;hl<<=1,!(hl&3932160)&&(hl=262144),Fe=e}else Fe=536870912;return e=it.current,e!==null&&(e.flags|=32),Fe}function Ye(e,t,n){(e===ne&&(F===2||F===9)||e.cancelPendingCommit!==null)&&(Xi(e,0),mn(e,K,Fe,!1)),tl(e,n),(!(Z&2)||e!==ne)&&(e===ne&&(!(Z&2)&&(Xn|=n),me===4&&mn(e,K,Fe,!1)),At(e))}function Yg(e,t,n){if(Z&6)throw Error(E(327));var i=!n&&(t&127)===0&&(t&e.expiredLanes)===0||el(e,t),a=i?Lb(e,t):$r(e,t,!0),l=i;do{if(a===0){aa&&!i&&mn(e,t,0,!1);break}else{if(n=e.current.alternate,l&&!Ib(n)){a=$r(e,t,!1),l=!1;continue}if(a===2){if(l=t,e.errorRecoveryDisabledLanes&l)var s=0;else s=e.pendingLanes&-536870913,s=s!==0?s:s&536870912?536870912:0;if(s!==0){t=s;e:{var o=e;a=Ma;var u=o.current.memoizedState.isDehydrated;if(u&&(Xi(o,s).flags|=256),s=$r(o,s,!1),s!==2){if(hc&&!u){o.errorRecoveryDisabledLanes|=l,Xn|=l,a=4;break e}l=qe,qe=a,l!==null&&(qe===null?qe=l:qe.push.apply(qe,l))}a=s}if(l=!1,a!==2)continue}}if(a===1){Xi(e,0),mn(e,t,0,!0);break}e:{switch(i=e,l=a,l){case 0:case 1:throw Error(E(345));case 4:if((t&4194048)!==t)break;case 6:mn(i,t,Fe,!hn);break e;case 2:qe=null;break;case 3:case 5:break;default:throw Error(E(329))}if((t&62914560)===t&&(a=nr+300-Pe(),10<a)){if(mn(i,t,Fe,!hn),Vs(i,0,!0)!==0)break e;Kt=t,i.timeoutHandle=up(Nd.bind(null,i,n,qe,Cs,Po,t,Fe,Xn,Vi,hn,l,"Throttled",-0,0),a);break e}Nd(i,n,qe,Cs,Po,t,Fe,Xn,Vi,hn,l,null,-0,0)}}break}while(!0);At(e)}function Nd(e,t,n,i,a,l,s,o,u,d,g,p,h,f){if(e.timeoutHandle=-1,p=t.subtreeFlags,p&8192||(p&16785408)===16785408){p={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:qt},Ig(t,l,p);var y=(l&62914560)===l?nr-Pe():(l&4194048)===l?Bg-Pe():0;if(y=x0(p,y),y!==null){Kt=l,e.cancelPendingCommit=y(Id.bind(null,e,t,l,n,i,a,s,o,u,g,p,null,h,f)),mn(e,l,s,!d);return}}Id(e,t,l,n,i,a,s,o,u)}function Ib(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 a=n[i],l=a.getSnapshot;a=a.value;try{if(!nt(l(),a))return!1}catch{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 mn(e,t,n,i){t&=~mc,t&=~Xn,e.suspendedLanes|=t,e.pingedLanes&=~t,i&&(e.warmLanes|=t),i=e.expirationTimes;for(var a=t;0<a;){var l=31-et(a),s=1<<l;i[l]=-1,a&=~s}n!==0&&Xh(e,n,t)}function ir(){return Z&6?!0:(rl(0),!1)}function gc(){if(G!==null){if(F===0)var e=G.return;else e=G,Yt=ai=null,ec(e),Ii=null,Ya=0,e=G;for(;e!==null;)wg(e.alternate,e),e=e.return;G=null}}function Xi(e,t){var n=e.timeoutHandle;n!==-1&&(e.timeoutHandle=-1,n0(n)),n=e.cancelPendingCommit,n!==null&&(e.cancelPendingCommit=null,n()),Kt=0,gc(),ne=e,G=n=Gt(e.current,null),K=t,F=0,Qe=null,hn=!1,aa=el(e,t),hc=!1,Vi=Fe=mc=Xn=On=me=0,qe=Ma=null,Po=!1,t&8&&(t|=t&32);var i=e.entangledLanes;if(i!==0)for(e=e.entanglements,i&=t;0<i;){var a=31-et(i),l=1<<a;t|=e[a],i&=~l}return Ft=t,Zs(),n}function Gg(e,t){$=null,U.H=Va,t===ia||t===Fs?(t=fd(),F=3):t===Xu?(t=fd(),F=4):F=t===uc?8:t!==null&&typeof t=="object"&&typeof t.then=="function"?6:1,Qe=t,G===null&&(me=1,js(e,ft(t,e.current)))}function Vg(){var e=it.current;return e===null?!0:(K&4194048)===K?mt===null:(K&62914560)===K||K&536870912?e===mt:!1}function Kg(){var e=U.H;return U.H=Va,e===null?Va:e}function Xg(){var e=U.A;return U.A=Nb,e}function Os(){me=4,hn||(K&4194048)!==K&&it.current!==null||(aa=!0),!(On&134217727)&&!(Xn&134217727)||ne===null||mn(ne,K,Fe,!1)}function $r(e,t,n){var i=Z;Z|=2;var a=Kg(),l=Xg();(ne!==e||K!==t)&&(Cs=null,Xi(e,t)),t=!1;var s=me;e:do try{if(F!==0&&G!==null){var o=G,u=Qe;switch(F){case 8:gc(),s=6;break e;case 3:case 2:case 9:case 6:it.current===null&&(t=!0);var d=F;if(F=0,Qe=null,Di(e,o,u,d),n&&aa){s=0;break e}break;default:d=F,F=0,Qe=null,Di(e,o,u,d)}}Ub(),s=me;break}catch(g){Gg(e,g)}while(!0);return t&&e.shellSuspendCounter++,Yt=ai=null,Z=i,U.H=a,U.A=l,G===null&&(ne=null,K=0,Zs()),s}function Ub(){for(;G!==null;)Qg(G)}function Lb(e,t){var n=Z;Z|=2;var i=Kg(),a=Xg();ne!==e||K!==t?(Cs=null,Es=Pe()+500,Xi(e,t)):aa=el(e,t);e:do try{if(F!==0&&G!==null){t=G;var l=Qe;t:switch(F){case 1:F=0,Qe=null,Di(e,t,l,1);break;case 2:case 9:if(dd(l)){F=0,Qe=null,Rd(t);break}t=function(){F!==2&&F!==9||ne!==e||(F=7),At(e)},l.then(t,t);break e;case 3:F=7;break e;case 4:F=5;break e;case 7:dd(l)?(F=0,Qe=null,Rd(t)):(F=0,Qe=null,Di(e,t,l,7));break;case 5:var s=null;switch(G.tag){case 26:s=G.memoizedState;case 5:case 27:var o=G;if(s?mp(s):o.stateNode.complete){F=0,Qe=null;var u=o.sibling;if(u!==null)G=u;else{var d=o.return;d!==null?(G=d,ar(d)):G=null}break t}}F=0,Qe=null,Di(e,t,l,5);break;case 6:F=0,Qe=null,Di(e,t,l,6);break;case 8:gc(),me=6;break e;default:throw Error(E(462))}}Hb();break}catch(g){Gg(e,g)}while(!0);return Yt=ai=null,U.H=i,U.A=a,Z=n,G!==null?0:(ne=null,K=0,Zs(),me)}function Hb(){for(;G!==null&&!oy();)Qg(G)}function Qg(e){var t=Sg(e.alternate,e,Ft);e.memoizedProps=e.pendingProps,t===null?ar(e):G=t}function Rd(e){var t=e,n=t.alternate;switch(t.tag){case 15:case 0:t=Od(n,t,t.pendingProps,t.type,void 0,K);break;case 11:t=Od(n,t,t.pendingProps,t.type.render,t.ref,K);break;case 5:ec(t);default:wg(n,t),t=G=wm(t,Ft),t=Sg(n,t,Ft)}e.memoizedProps=e.pendingProps,t===null?ar(e):G=t}function Di(e,t,n,i){Yt=ai=null,ec(t),Ii=null,Ya=0;var a=t.return;try{if(Cb(e,a,t,n,K)){me=1,js(e,ft(n,e.current)),G=null;return}}catch(l){if(a!==null)throw G=a,l;me=1,js(e,ft(n,e.current)),G=null;return}t.flags&32768?(X||i===1?e=!0:aa||K&536870912?e=!1:(hn=e=!0,(i===2||i===9||i===3||i===6)&&(i=it.current,i!==null&&i.tag===13&&(i.flags|=16384))),Zg(t,e)):ar(t)}function ar(e){var t=e;do{if(t.flags&32768){Zg(t,hn);return}e=t.return;var n=_b(t.alternate,t,Ft);if(n!==null){G=n;return}if(t=t.sibling,t!==null){G=t;return}G=t=e}while(t!==null);me===0&&(me=5)}function Zg(e,t){do{var n=Ab(e.alternate,e);if(n!==null){n.flags&=32767,G=n;return}if(n=e.return,n!==null&&(n.flags|=32768,n.subtreeFlags=0,n.deletions=null),!t&&(e=e.sibling,e!==null)){G=e;return}G=e=n}while(e!==null);me=6,G=null}function Id(e,t,n,i,a,l,s,o,u){e.cancelPendingCommit=null;do lr();while(Se!==0);if(Z&6)throw Error(E(327));if(t!==null){if(t===e.current)throw Error(E(177));if(l=t.lanes|t.childLanes,l|=Bu,yy(e,n,l,s,o,u),e===ne&&(G=ne=null,K=0),Ki=t,Sn=e,Kt=n,Wo=l,eu=a,$g=i,t.subtreeFlags&10256||t.flags&10256?(e.callbackNode=null,e.callbackPriority=0,Yb(fs,function(){return ep(),null})):(e.callbackNode=null,e.callbackPriority=0),i=(t.flags&13878)!==0,t.subtreeFlags&13878||i){i=U.T,U.T=null,a=J.p,J.p=2,s=Z,Z|=4;try{zb(e,t,n)}finally{Z=s,J.p=a,U.T=i}}Se=1,Jg(),Fg(),Pg()}}function Jg(){if(Se===1){Se=0;var e=Sn,t=Ki,n=(t.flags&13878)!==0;if(t.subtreeFlags&13878||n){n=U.T,U.T=null;var i=J.p;J.p=2;var a=Z;Z|=4;try{Mg(t,e);var l=lu,s=mm(e.containerInfo),o=l.focusedElem,u=l.selectionRange;if(s!==o&&o&&o.ownerDocument&&hm(o.ownerDocument.documentElement,o)){if(u!==null&&Hu(o)){var d=u.start,g=u.end;if(g===void 0&&(g=d),"selectionStart"in o)o.selectionStart=d,o.selectionEnd=Math.min(g,o.value.length);else{var p=o.ownerDocument||document,h=p&&p.defaultView||window;if(h.getSelection){var f=h.getSelection(),y=o.textContent.length,v=Math.min(u.start,y),S=u.end===void 0?v:Math.min(u.end,y);!f.extend&&v>S&&(s=S,S=v,v=s);var c=ad(o,v),m=ad(o,S);if(c&&m&&(f.rangeCount!==1||f.anchorNode!==c.node||f.anchorOffset!==c.offset||f.focusNode!==m.node||f.focusOffset!==m.offset)){var w=p.createRange();w.setStart(c.node,c.offset),f.removeAllRanges(),v>S?(f.addRange(w),f.extend(m.node,m.offset)):(w.setEnd(m.node,m.offset),f.addRange(w))}}}}for(p=[],f=o;f=f.parentNode;)f.nodeType===1&&p.push({element:f,left:f.scrollLeft,top:f.scrollTop});for(typeof o.focus=="function"&&o.focus(),o=0;o<p.length;o++){var b=p[o];b.element.scrollLeft=b.left,b.element.scrollTop=b.top}}Is=!!au,lu=au=null}finally{Z=a,J.p=i,U.T=n}}e.current=t,Se=2}}function Fg(){if(Se===2){Se=0;var e=Sn,t=Ki,n=(t.flags&8772)!==0;if(t.subtreeFlags&8772||n){n=U.T,U.T=null;var i=J.p;J.p=2;var a=Z;Z|=4;try{Og(e,t.alternate,t)}finally{Z=a,J.p=i,U.T=n}}Se=3}}function Pg(){if(Se===4||Se===3){Se=0,uy();var e=Sn,t=Ki,n=Kt,i=$g;t.subtreeFlags&10256||t.flags&10256?Se=5:(Se=0,Ki=Sn=null,Wg(e,e.pendingLanes));var a=e.pendingLanes;if(a===0&&(xn=null),zu(n),t=t.stateNode,We&&typeof We.onCommitFiberRoot=="function")try{We.onCommitFiberRoot(Wa,t,void 0,(t.current.flags&128)===128)}catch{}if(i!==null){t=U.T,a=J.p,J.p=2,U.T=null;try{for(var l=e.onRecoverableError,s=0;s<i.length;s++){var o=i[s];l(o.value,{componentStack:o.stack})}}finally{U.T=t,J.p=a}}Kt&3&&lr(),At(e),a=e.pendingLanes,n&261930&&a&42?e===tu?Na++:(Na=0,tu=e):Na=0,rl(0)}}function Wg(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,al(t)))}function lr(){return Jg(),Fg(),Pg(),ep()}function ep(){if(Se!==5)return!1;var e=Sn,t=Wo;Wo=0;var n=zu(Kt),i=U.T,a=J.p;try{J.p=32>n?32:n,U.T=null,n=eu,eu=null;var l=Sn,s=Kt;if(Se=0,Ki=Sn=null,Kt=0,Z&6)throw Error(E(331));var o=Z;if(Z|=4,Lg(l.current),Rg(l,l.current,s,n),Z=o,rl(0,!1),We&&typeof We.onPostCommitFiberRoot=="function")try{We.onPostCommitFiberRoot(Wa,l)}catch{}return!0}finally{J.p=a,U.T=i,Wg(e,t)}}function Ud(e,t,n){t=ft(n,t),t=Qo(e.stateNode,t,2),e=bn(e,t,2),e!==null&&(tl(e,2),At(e))}function P(e,t,n){if(e.tag===3)Ud(e,e,n);else for(;t!==null;){if(t.tag===3){Ud(t,e,n);break}else if(t.tag===1){var i=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof i.componentDidCatch=="function"&&(xn===null||!xn.has(i))){e=ft(n,e),n=gg(2),i=bn(t,n,2),i!==null&&(pg(n,i,t,e),tl(i,2),At(i));break}}t=t.return}}function qr(e,t,n){var i=e.pingCache;if(i===null){i=e.pingCache=new Rb;var a=new Set;i.set(t,a)}else a=i.get(t),a===void 0&&(a=new Set,i.set(t,a));a.has(n)||(hc=!0,a.add(n),e=Bb.bind(null,e,t,n),t.then(e,e))}function Bb(e,t,n){var i=e.pingCache;i!==null&&i.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,ne===e&&(K&n)===n&&(me===4||me===3&&(K&62914560)===K&&300>Pe()-nr?!(Z&2)&&Xi(e,0):mc|=n,Vi===K&&(Vi=0)),At(e)}function tp(e,t){t===0&&(t=Kh()),e=ii(e,t),e!==null&&(tl(e,t),At(e))}function $b(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),tp(e,n)}function qb(e,t){var n=0;switch(e.tag){case 31:case 13:var i=e.stateNode,a=e.memoizedState;a!==null&&(n=a.retryLane);break;case 19:i=e.stateNode;break;case 22:i=e.stateNode._retryCache;break;default:throw Error(E(314))}i!==null&&i.delete(t),tp(e,n)}function Yb(e,t){return _u(e,t)}var Ds=null,vi=null,nu=!1,_s=!1,Yr=!1,gn=0;function At(e){e!==vi&&e.next===null&&(vi===null?Ds=vi=e:vi=vi.next=e),_s=!0,nu||(nu=!0,Vb())}function rl(e,t){if(!Yr&&_s){Yr=!0;do for(var n=!1,i=Ds;i!==null;){if(e!==0){var a=i.pendingLanes;if(a===0)var l=0;else{var s=i.suspendedLanes,o=i.pingedLanes;l=(1<<31-et(42|e)+1)-1,l&=a&~(s&~o),l=l&201326741?l&201326741|1:l?l|2:0}l!==0&&(n=!0,Ld(i,l))}else l=K,l=Vs(i,i===ne?l:0,i.cancelPendingCommit!==null||i.timeoutHandle!==-1),!(l&3)||el(i,l)||(n=!0,Ld(i,l));i=i.next}while(n);Yr=!1}}function Gb(){np()}function np(){_s=nu=!1;var e=0;gn!==0&&t0()&&(e=gn);for(var t=Pe(),n=null,i=Ds;i!==null;){var a=i.next,l=ip(i,t);l===0?(i.next=null,n===null?Ds=a:n.next=a,a===null&&(vi=n)):(n=i,(e!==0||l&3)&&(_s=!0)),i=a}Se!==0&&Se!==5||rl(e),gn!==0&&(gn=0)}function ip(e,t){for(var n=e.suspendedLanes,i=e.pingedLanes,a=e.expirationTimes,l=e.pendingLanes&-62914561;0<l;){var s=31-et(l),o=1<<s,u=a[s];u===-1?(!(o&n)||o&i)&&(a[s]=vy(o,t)):u<=t&&(e.expiredLanes|=o),l&=~o}if(t=ne,n=K,n=Vs(e,e===t?n:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),i=e.callbackNode,n===0||e===t&&(F===2||F===9)||e.cancelPendingCommit!==null)return i!==null&&i!==null&&vr(i),e.callbackNode=null,e.callbackPriority=0;if(!(n&3)||el(e,n)){if(t=n&-n,t===e.callbackPriority)return t;switch(i!==null&&vr(i),zu(n)){case 2:case 8:n=Gh;break;case 32:n=fs;break;case 268435456:n=Vh;break;default:n=fs}return i=ap.bind(null,e),n=_u(n,i),e.callbackPriority=t,e.callbackNode=n,t}return i!==null&&i!==null&&vr(i),e.callbackPriority=2,e.callbackNode=null,2}function ap(e,t){if(Se!==0&&Se!==5)return e.callbackNode=null,e.callbackPriority=0,null;var n=e.callbackNode;if(lr()&&e.callbackNode!==n)return null;var i=K;return i=Vs(e,e===ne?i:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),i===0?null:(Yg(e,i,t),ip(e,Pe()),e.callbackNode!=null&&e.callbackNode===n?ap.bind(null,e):null)}function Ld(e,t){if(lr())return null;Yg(e,t,!0)}function Vb(){i0(function(){Z&6?_u(Yh,Gb):np()})}function pc(){if(gn===0){var e=qi;e===0&&(e=fl,fl<<=1,!(fl&261888)&&(fl=256)),gn=e}return gn}function Hd(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:$l(""+e)}function Bd(e,t){var n=t.ownerDocument.createElement("input");return n.name=t.name,n.value=t.value,e.id&&n.setAttribute("form",e.id),t.parentNode.insertBefore(n,t),e=new FormData(e),n.parentNode.removeChild(n),e}function Kb(e,t,n,i,a){if(t==="submit"&&n&&n.stateNode===a){var l=Hd((a[Ge]||null).action),s=i.submitter;s&&(t=(t=s[Ge]||null)?Hd(t.formAction):s.getAttribute("formAction"),t!==null&&(l=t,s=null));var o=new Ks("action","action",null,i,a);e.push({event:o,listeners:[{instance:null,listener:function(){if(i.defaultPrevented){if(gn!==0){var u=s?Bd(a,s):new FormData(a);Ko(n,{pending:!0,data:u,method:a.method,action:l},null,u)}}else typeof l=="function"&&(o.preventDefault(),u=s?Bd(a,s):new FormData(a),Ko(n,{pending:!0,data:u,method:a.method,action:l},l,u))},currentTarget:a}]})}}for(var Gr=0;Gr<No.length;Gr++){var Vr=No[Gr],Xb=Vr.toLowerCase(),Qb=Vr[0].toUpperCase()+Vr.slice(1);St(Xb,"on"+Qb)}St(pm,"onAnimationEnd");St(vm,"onAnimationIteration");St(ym,"onAnimationStart");St("dblclick","onDoubleClick");St("focusin","onFocus");St("focusout","onBlur");St(cb,"onTransitionRun");St(db,"onTransitionStart");St(fb,"onTransitionCancel");St(bm,"onTransitionEnd");Bi("onMouseEnter",["mouseout","mouseover"]);Bi("onMouseLeave",["mouseout","mouseover"]);Bi("onPointerEnter",["pointerout","pointerover"]);Bi("onPointerLeave",["pointerout","pointerover"]);ei("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));ei("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));ei("onBeforeInput",["compositionend","keypress","textInput","paste"]);ei("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));ei("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));ei("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Ka="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(" "),Zb=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Ka));function lp(e,t){t=(t&4)!==0;for(var n=0;n<e.length;n++){var i=e[n],a=i.event;i=i.listeners;e:{var l=void 0;if(t)for(var s=i.length-1;0<=s;s--){var o=i[s],u=o.instance,d=o.currentTarget;if(o=o.listener,u!==l&&a.isPropagationStopped())break e;l=o,a.currentTarget=d;try{l(a)}catch(g){ms(g)}a.currentTarget=null,l=u}else for(s=0;s<i.length;s++){if(o=i[s],u=o.instance,d=o.currentTarget,o=o.listener,u!==l&&a.isPropagationStopped())break e;l=o,a.currentTarget=d;try{l(a)}catch(g){ms(g)}a.currentTarget=null,l=u}}}}function Y(e,t){var n=t[Eo];n===void 0&&(n=t[Eo]=new Set);var i=e+"__bubble";n.has(i)||(sp(t,e,2,!1),n.add(i))}function Kr(e,t,n){var i=0;t&&(i|=4),sp(n,e,i,t)}var wl="_reactListening"+Math.random().toString(36).slice(2);function vc(e){if(!e[wl]){e[wl]=!0,Fh.forEach(function(n){n!=="selectionchange"&&(Zb.has(n)||Kr(n,!1,e),Kr(n,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[wl]||(t[wl]=!0,Kr("selectionchange",!1,t))}}function sp(e,t,n,i){switch(bp(t)){case 2:var a=j0;break;case 8:a=k0;break;default:a=Sc}n=a.bind(null,t,n,e),a=void 0,!Ao||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(a=!0),i?a!==void 0?e.addEventListener(t,n,{capture:!0,passive:a}):e.addEventListener(t,n,!0):a!==void 0?e.addEventListener(t,n,{passive:a}):e.addEventListener(t,n,!1)}function Xr(e,t,n,i,a){var l=i;if(!(t&1)&&!(t&2)&&i!==null)e:for(;;){if(i===null)return;var s=i.tag;if(s===3||s===4){var o=i.stateNode.containerInfo;if(o===a)break;if(s===4)for(s=i.return;s!==null;){var u=s.tag;if((u===3||u===4)&&s.stateNode.containerInfo===a)return;s=s.return}for(;o!==null;){if(s=xi(o),s===null)return;if(u=s.tag,u===5||u===6||u===26||u===27){i=l=s;continue e}o=o.parentNode}}i=i.return}lm(function(){var d=l,g=Ru(n),p=[];e:{var h=xm.get(e);if(h!==void 0){var f=Ks,y=e;switch(e){case"keypress":if(Yl(n)===0)break e;case"keydown":case"keyup":f=qy;break;case"focusin":y="focus",f=wr;break;case"focusout":y="blur",f=wr;break;case"beforeblur":case"afterblur":f=wr;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":f=Qc;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":f=_y;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":f=Vy;break;case pm:case vm:case ym:f=My;break;case bm:f=Xy;break;case"scroll":case"scrollend":f=Oy;break;case"wheel":f=Zy;break;case"copy":case"cut":case"paste":f=Ry;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":f=Jc;break;case"toggle":case"beforetoggle":f=Fy}var v=(t&4)!==0,S=!v&&(e==="scroll"||e==="scrollend"),c=v?h!==null?h+"Capture":null:h;v=[];for(var m=d,w;m!==null;){var b=m;if(w=b.stateNode,b=b.tag,b!==5&&b!==26&&b!==27||w===null||c===null||(b=La(m,c),b!=null&&v.push(Xa(m,b,w))),S)break;m=m.return}0<v.length&&(h=new f(h,y,null,n,g),p.push({event:h,listeners:v}))}}if(!(t&7)){e:{if(h=e==="mouseover"||e==="pointerover",f=e==="mouseout"||e==="pointerout",h&&n!==_o&&(y=n.relatedTarget||n.fromElement)&&(xi(y)||y[ea]))break e;if((f||h)&&(h=g.window===g?g:(h=g.ownerDocument)?h.defaultView||h.parentWindow:window,f?(y=n.relatedTarget||n.toElement,f=d,y=y?xi(y):null,y!==null&&(S=Pa(y),v=y.tag,y!==S||v!==5&&v!==27&&v!==6)&&(y=null)):(f=null,y=d),f!==y)){if(v=Qc,b="onMouseLeave",c="onMouseEnter",m="mouse",(e==="pointerout"||e==="pointerover")&&(v=Jc,b="onPointerLeave",c="onPointerEnter",m="pointer"),S=f==null?h:ba(f),w=y==null?h:ba(y),h=new v(b,m+"leave",f,n,g),h.target=S,h.relatedTarget=w,b=null,xi(g)===d&&(v=new v(c,m+"enter",y,n,g),v.target=w,v.relatedTarget=S,b=v),S=b,f&&y)t:{for(v=Jb,c=f,m=y,w=0,b=c;b;b=v(b))w++;b=0;for(var j=m;j;j=v(j))b++;for(;0<w-b;)c=v(c),w--;for(;0<b-w;)m=v(m),b--;for(;w--;){if(c===m||m!==null&&c===m.alternate){v=c;break t}c=v(c),m=v(m)}v=null}else v=null;f!==null&&$d(p,h,f,v,!1),y!==null&&S!==null&&$d(p,S,y,v,!0)}}e:{if(h=d?ba(d):window,f=h.nodeName&&h.nodeName.toLowerCase(),f==="select"||f==="input"&&h.type==="file")var k=ed;else if(Wc(h))if(dm)k=rb;else{k=lb;var T=ab}else f=h.nodeName,!f||f.toLowerCase()!=="input"||h.type!=="checkbox"&&h.type!=="radio"?d&&Nu(d.elementType)&&(k=ed):k=sb;if(k&&(k=k(e,d))){cm(p,k,n,g);break e}T&&T(e,h,d),e==="focusout"&&d&&h.type==="number"&&d.memoizedProps.value!=null&&Do(h,"number",h.value)}switch(T=d?ba(d):window,e){case"focusin":(Wc(T)||T.contentEditable==="true")&&(ji=T,zo=d,Ta=null);break;case"focusout":Ta=zo=ji=null;break;case"mousedown":Mo=!0;break;case"contextmenu":case"mouseup":case"dragend":Mo=!1,ld(p,n,g);break;case"selectionchange":if(ub)break;case"keydown":case"keyup":ld(p,n,g)}var _;if(Lu)e:{switch(e){case"compositionstart":var A="onCompositionStart";break e;case"compositionend":A="onCompositionEnd";break e;case"compositionupdate":A="onCompositionUpdate";break e}A=void 0}else wi?om(e,n)&&(A="onCompositionEnd"):e==="keydown"&&n.keyCode===229&&(A="onCompositionStart");A&&(rm&&n.locale!=="ko"&&(wi||A!=="onCompositionStart"?A==="onCompositionEnd"&&wi&&(_=sm()):(fn=g,Iu="value"in fn?fn.value:fn.textContent,wi=!0)),T=As(d,A),0<T.length&&(A=new Zc(A,e,null,n,g),p.push({event:A,listeners:T}),_?A.data=_:(_=um(n),_!==null&&(A.data=_)))),(_=Wy?eb(e,n):tb(e,n))&&(A=As(d,"onBeforeInput"),0<A.length&&(T=new Zc("onBeforeInput","beforeinput",null,n,g),p.push({event:T,listeners:A}),T.data=_)),Kb(p,e,d,n,g)}lp(p,t)})}function Xa(e,t,n){return{instance:e,listener:t,currentTarget:n}}function As(e,t){for(var n=t+"Capture",i=[];e!==null;){var a=e,l=a.stateNode;if(a=a.tag,a!==5&&a!==26&&a!==27||l===null||(a=La(e,n),a!=null&&i.unshift(Xa(e,a,l)),a=La(e,t),a!=null&&i.push(Xa(e,a,l))),e.tag===3)return i;e=e.return}return[]}function Jb(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function $d(e,t,n,i,a){for(var l=t._reactName,s=[];n!==null&&n!==i;){var o=n,u=o.alternate,d=o.stateNode;if(o=o.tag,u!==null&&u===i)break;o!==5&&o!==26&&o!==27||d===null||(u=d,a?(d=La(n,l),d!=null&&s.unshift(Xa(n,d,u))):a||(d=La(n,l),d!=null&&s.push(Xa(n,d,u)))),n=n.return}s.length!==0&&e.push({event:t,listeners:s})}var Fb=/\r\n?/g,Pb=/\u0000|\uFFFD/g;function qd(e){return(typeof e=="string"?e:""+e).replace(Fb,`
`).replace(Pb,"")}function rp(e,t){return t=qd(t),qd(e)===t}function W(e,t,n,i,a,l){switch(n){case"children":typeof i=="string"?t==="body"||t==="textarea"&&i===""||$i(e,i):(typeof i=="number"||typeof i=="bigint")&&t!=="body"&&$i(e,""+i);break;case"className":gl(e,"class",i);break;case"tabIndex":gl(e,"tabindex",i);break;case"dir":case"role":case"viewBox":case"width":case"height":gl(e,n,i);break;case"style":am(e,i,l);break;case"data":if(t!=="object"){gl(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=$l(""+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 l=="function"&&(n==="formAction"?(t!=="input"&&W(e,t,"name",a.name,a,null),W(e,t,"formEncType",a.formEncType,a,null),W(e,t,"formMethod",a.formMethod,a,null),W(e,t,"formTarget",a.formTarget,a,null)):(W(e,t,"encType",a.encType,a,null),W(e,t,"method",a.method,a,null),W(e,t,"target",a.target,a,null)));if(i==null||typeof i=="symbol"||typeof i=="boolean"){e.removeAttribute(n);break}i=$l(""+i),e.setAttribute(n,i);break;case"onClick":i!=null&&(e.onclick=qt);break;case"onScroll":i!=null&&Y("scroll",e);break;case"onScrollEnd":i!=null&&Y("scrollend",e);break;case"dangerouslySetInnerHTML":if(i!=null){if(typeof i!="object"||!("__html"in i))throw Error(E(61));if(n=i.__html,n!=null){if(a.children!=null)throw Error(E(60));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=$l(""+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"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":Y("beforetoggle",e),Y("toggle",e),Bl(e,"popover",i);break;case"xlinkActuate":Mt(e,"http://www.w3.org/1999/xlink","xlink:actuate",i);break;case"xlinkArcrole":Mt(e,"http://www.w3.org/1999/xlink","xlink:arcrole",i);break;case"xlinkRole":Mt(e,"http://www.w3.org/1999/xlink","xlink:role",i);break;case"xlinkShow":Mt(e,"http://www.w3.org/1999/xlink","xlink:show",i);break;case"xlinkTitle":Mt(e,"http://www.w3.org/1999/xlink","xlink:title",i);break;case"xlinkType":Mt(e,"http://www.w3.org/1999/xlink","xlink:type",i);break;case"xmlBase":Mt(e,"http://www.w3.org/XML/1998/namespace","xml:base",i);break;case"xmlLang":Mt(e,"http://www.w3.org/XML/1998/namespace","xml:lang",i);break;case"xmlSpace":Mt(e,"http://www.w3.org/XML/1998/namespace","xml:space",i);break;case"is":Bl(e,"is",i);break;case"innerText":case"textContent":break;default:(!(2<n.length)||n[0]!=="o"&&n[0]!=="O"||n[1]!=="n"&&n[1]!=="N")&&(n=Ey.get(n)||n,Bl(e,n,i))}}function iu(e,t,n,i,a,l){switch(n){case"style":am(e,i,l);break;case"dangerouslySetInnerHTML":if(i!=null){if(typeof i!="object"||!("__html"in i))throw Error(E(61));if(n=i.__html,n!=null){if(a.children!=null)throw Error(E(60));e.innerHTML=n}}break;case"children":typeof i=="string"?$i(e,i):(typeof i=="number"||typeof i=="bigint")&&$i(e,""+i);break;case"onScroll":i!=null&&Y("scroll",e);break;case"onScrollEnd":i!=null&&Y("scrollend",e);break;case"onClick":i!=null&&(e.onclick=qt);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Ph.hasOwnProperty(n))e:{if(n[0]==="o"&&n[1]==="n"&&(a=n.endsWith("Capture"),t=n.slice(2,a?n.length-7:void 0),l=e[Ge]||null,l=l!=null?l[n]:null,typeof l=="function"&&e.removeEventListener(t,l,a),typeof i=="function")){typeof l!="function"&&l!==null&&(n in e?e[n]=null:e.hasAttribute(n)&&e.removeAttribute(n)),e.addEventListener(t,i,a);break e}n in e?e[n]=i:i===!0?e.setAttribute(n,""):Bl(e,n,i)}}}function Ae(e,t,n){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Y("error",e),Y("load",e);var i=!1,a=!1,l;for(l in n)if(n.hasOwnProperty(l)){var s=n[l];if(s!=null)switch(l){case"src":i=!0;break;case"srcSet":a=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(E(137,t));default:W(e,t,l,s,n,null)}}a&&W(e,t,"srcSet",n.srcSet,n,null),i&&W(e,t,"src",n.src,n,null);return;case"input":Y("invalid",e);var o=l=s=a=null,u=null,d=null;for(i in n)if(n.hasOwnProperty(i)){var g=n[i];if(g!=null)switch(i){case"name":a=g;break;case"type":s=g;break;case"checked":u=g;break;case"defaultChecked":d=g;break;case"value":l=g;break;case"defaultValue":o=g;break;case"children":case"dangerouslySetInnerHTML":if(g!=null)throw Error(E(137,t));break;default:W(e,t,i,g,n,null)}}tm(e,l,o,u,d,s,a,!1);return;case"select":Y("invalid",e),i=s=l=null;for(a in n)if(n.hasOwnProperty(a)&&(o=n[a],o!=null))switch(a){case"value":l=o;break;case"defaultValue":s=o;break;case"multiple":i=o;default:W(e,t,a,o,n,null)}t=l,n=s,e.multiple=!!i,t!=null?Mi(e,!!i,t,!1):n!=null&&Mi(e,!!i,n,!0);return;case"textarea":Y("invalid",e),l=a=i=null;for(s in n)if(n.hasOwnProperty(s)&&(o=n[s],o!=null))switch(s){case"value":i=o;break;case"defaultValue":a=o;break;case"children":l=o;break;case"dangerouslySetInnerHTML":if(o!=null)throw Error(E(91));break;default:W(e,t,s,o,n,null)}im(e,i,a,l);return;case"option":for(u in n)if(n.hasOwnProperty(u)&&(i=n[u],i!=null))switch(u){case"selected":e.selected=i&&typeof i!="function"&&typeof i!="symbol";break;default:W(e,t,u,i,n,null)}return;case"dialog":Y("beforetoggle",e),Y("toggle",e),Y("cancel",e),Y("close",e);break;case"iframe":case"object":Y("load",e);break;case"video":case"audio":for(i=0;i<Ka.length;i++)Y(Ka[i],e);break;case"image":Y("error",e),Y("load",e);break;case"details":Y("toggle",e);break;case"embed":case"source":case"link":Y("error",e),Y("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(d in n)if(n.hasOwnProperty(d)&&(i=n[d],i!=null))switch(d){case"children":case"dangerouslySetInnerHTML":throw Error(E(137,t));default:W(e,t,d,i,n,null)}return;default:if(Nu(t)){for(g in n)n.hasOwnProperty(g)&&(i=n[g],i!==void 0&&iu(e,t,g,i,n,void 0));return}}for(o in n)n.hasOwnProperty(o)&&(i=n[o],i!=null&&W(e,t,o,i,n,null))}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 a=null,l=null,s=null,o=null,u=null,d=null,g=null;for(f in n){var p=n[f];if(n.hasOwnProperty(f)&&p!=null)switch(f){case"checked":break;case"value":break;case"defaultValue":u=p;default:i.hasOwnProperty(f)||W(e,t,f,null,i,p)}}for(var h in i){var f=i[h];if(p=n[h],i.hasOwnProperty(h)&&(f!=null||p!=null))switch(h){case"type":l=f;break;case"name":a=f;break;case"checked":d=f;break;case"defaultChecked":g=f;break;case"value":s=f;break;case"defaultValue":o=f;break;case"children":case"dangerouslySetInnerHTML":if(f!=null)throw Error(E(137,t));break;default:f!==p&&W(e,t,h,f,i,p)}}Oo(e,s,o,u,d,g,l,a);return;case"select":f=s=o=h=null;for(l in n)if(u=n[l],n.hasOwnProperty(l)&&u!=null)switch(l){case"value":break;case"multiple":f=u;default:i.hasOwnProperty(l)||W(e,t,l,null,i,u)}for(a in i)if(l=i[a],u=n[a],i.hasOwnProperty(a)&&(l!=null||u!=null))switch(a){case"value":h=l;break;case"defaultValue":o=l;break;case"multiple":s=l;default:l!==u&&W(e,t,a,l,i,u)}t=o,n=s,i=f,h!=null?Mi(e,!!n,h,!1):!!i!=!!n&&(t!=null?Mi(e,!!n,t,!0):Mi(e,!!n,n?[]:"",!1));return;case"textarea":f=h=null;for(o in n)if(a=n[o],n.hasOwnProperty(o)&&a!=null&&!i.hasOwnProperty(o))switch(o){case"value":break;case"children":break;default:W(e,t,o,null,i,a)}for(s in i)if(a=i[s],l=n[s],i.hasOwnProperty(s)&&(a!=null||l!=null))switch(s){case"value":h=a;break;case"defaultValue":f=a;break;case"children":break;case"dangerouslySetInnerHTML":if(a!=null)throw Error(E(91));break;default:a!==l&&W(e,t,s,a,i,l)}nm(e,h,f);return;case"option":for(var y in n)if(h=n[y],n.hasOwnProperty(y)&&h!=null&&!i.hasOwnProperty(y))switch(y){case"selected":e.selected=!1;break;default:W(e,t,y,null,i,h)}for(u in i)if(h=i[u],f=n[u],i.hasOwnProperty(u)&&h!==f&&(h!=null||f!=null))switch(u){case"selected":e.selected=h&&typeof h!="function"&&typeof h!="symbol";break;default:W(e,t,u,h,i,f)}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 v in n)h=n[v],n.hasOwnProperty(v)&&h!=null&&!i.hasOwnProperty(v)&&W(e,t,v,null,i,h);for(d in i)if(h=i[d],f=n[d],i.hasOwnProperty(d)&&h!==f&&(h!=null||f!=null))switch(d){case"children":case"dangerouslySetInnerHTML":if(h!=null)throw Error(E(137,t));break;default:W(e,t,d,h,i,f)}return;default:if(Nu(t)){for(var S in n)h=n[S],n.hasOwnProperty(S)&&h!==void 0&&!i.hasOwnProperty(S)&&iu(e,t,S,void 0,i,h);for(g in i)h=i[g],f=n[g],!i.hasOwnProperty(g)||h===f||h===void 0&&f===void 0||iu(e,t,g,h,i,f);return}}for(var c in n)h=n[c],n.hasOwnProperty(c)&&h!=null&&!i.hasOwnProperty(c)&&W(e,t,c,null,i,h);for(p in i)h=i[p],f=n[p],!i.hasOwnProperty(p)||h===f||h==null&&f==null||W(e,t,p,h,i,f)}function Yd(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function e0(){if(typeof performance.getEntriesByType=="function"){for(var e=0,t=0,n=performance.getEntriesByType("resource"),i=0;i<n.length;i++){var a=n[i],l=a.transferSize,s=a.initiatorType,o=a.duration;if(l&&o&&Yd(s)){for(s=0,o=a.responseEnd,i+=1;i<n.length;i++){var u=n[i],d=u.startTime;if(d>o)break;var g=u.transferSize,p=u.initiatorType;g&&Yd(p)&&(u=u.responseEnd,s+=g*(u<o?1:(o-d)/(u-d)))}if(--i,t+=8*(l+s)/(a.duration/1e3),e++,10<e)break}}if(0<e)return t/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e=="number")?e:5}var au=null,lu=null;function zs(e){return e.nodeType===9?e:e.ownerDocument}function Gd(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 op(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 su(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 Qr=null;function t0(){var e=window.event;return e&&e.type==="popstate"?e===Qr?!1:(Qr=e,!0):(Qr=null,!1)}var up=typeof setTimeout=="function"?setTimeout:void 0,n0=typeof clearTimeout=="function"?clearTimeout:void 0,Vd=typeof Promise=="function"?Promise:void 0,i0=typeof queueMicrotask=="function"?queueMicrotask:typeof Vd<"u"?function(e){return Vd.resolve(null).then(e).catch(a0)}:up;function a0(e){setTimeout(function(){throw e})}function _n(e){return e==="head"}function Kd(e,t){var n=t,i=0;do{var a=n.nextSibling;if(e.removeChild(n),a&&a.nodeType===8)if(n=a.data,n==="/$"||n==="/&"){if(i===0){e.removeChild(a),Zi(t);return}i--}else if(n==="$"||n==="$?"||n==="$~"||n==="$!"||n==="&")i++;else if(n==="html")Ra(e.ownerDocument.documentElement);else if(n==="head"){n=e.ownerDocument.head,Ra(n);for(var l=n.firstChild;l;){var s=l.nextSibling,o=l.nodeName;l[nl]||o==="SCRIPT"||o==="STYLE"||o==="LINK"&&l.rel.toLowerCase()==="stylesheet"||n.removeChild(l),l=s}}else n==="body"&&Ra(e.ownerDocument.body);n=a}while(n);Zi(t)}function Xd(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;e--}else n!=="$"&&n!=="$?"&&n!=="$~"&&n!=="$!"||e++;n=i}while(n)}function ru(e){var t=e.firstChild;for(t&&t.nodeType===10&&(t=t.nextSibling);t;){var n=t;switch(t=t.nextSibling,n.nodeName){case"HTML":case"HEAD":case"BODY":ru(n),Mu(n);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(n.rel.toLowerCase()==="stylesheet")continue}e.removeChild(n)}}function l0(e,t,n,i){for(;e.nodeType===1;){var a=n;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!i&&(e.nodeName!=="INPUT"||e.type!=="hidden"))break}else if(i){if(!e[nl])switch(t){case"meta":if(!e.hasAttribute("itemprop"))break;return e;case"link":if(l=e.getAttribute("rel"),l==="stylesheet"&&e.hasAttribute("data-precedence"))break;if(l!==a.rel||e.getAttribute("href")!==(a.href==null||a.href===""?null:a.href)||e.getAttribute("crossorigin")!==(a.crossOrigin==null?null:a.crossOrigin)||e.getAttribute("title")!==(a.title==null?null:a.title))break;return e;case"style":if(e.hasAttribute("data-precedence"))break;return e;case"script":if(l=e.getAttribute("src"),(l!==(a.src==null?null:a.src)||e.getAttribute("type")!==(a.type==null?null:a.type)||e.getAttribute("crossorigin")!==(a.crossOrigin==null?null:a.crossOrigin))&&l&&e.hasAttribute("async")&&!e.hasAttribute("itemprop"))break;return e;default:return e}}else if(t==="input"&&e.type==="hidden"){var l=a.name==null?null:""+a.name;if(a.type==="hidden"&&e.getAttribute("name")===l)return e}else return e;if(e=gt(e.nextSibling),e===null)break}return null}function s0(e,t,n){if(t==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!n||(e=gt(e.nextSibling),e===null))return null;return e}function cp(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!t||(e=gt(e.nextSibling),e===null))return null;return e}function ou(e){return e.data==="$?"||e.data==="$~"}function uu(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function r0(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 gt(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 cu=null;function Qd(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="/$"||n==="/&"){if(t===0)return gt(e.nextSibling);t--}else n!=="$"&&n!=="$!"&&n!=="$?"&&n!=="$~"&&n!=="&"||t++}e=e.nextSibling}return null}function Zd(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 dp(e,t,n){switch(t=zs(n),e){case"html":if(e=t.documentElement,!e)throw Error(E(452));return e;case"head":if(e=t.head,!e)throw Error(E(453));return e;case"body":if(e=t.body,!e)throw Error(E(454));return e;default:throw Error(E(451))}}function Ra(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);Mu(e)}var pt=new Map,Jd=new Set;function Ms(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var Wt=J.d;J.d={f:o0,r:u0,D:c0,C:d0,L:f0,m:h0,X:g0,S:m0,M:p0};function o0(){var e=Wt.f(),t=ir();return e||t}function u0(e){var t=ta(e);t!==null&&t.tag===5&&t.type==="form"?ag(t):Wt.r(e)}var la=typeof document>"u"?null:document;function fp(e,t,n){var i=la;if(i&&typeof t=="string"&&t){var a=dt(t);a='link[rel="'+e+'"][href="'+a+'"]',typeof n=="string"&&(a+='[crossorigin="'+n+'"]'),Jd.has(a)||(Jd.add(a),e={rel:e,crossOrigin:n,href:t},i.querySelector(a)===null&&(t=i.createElement("link"),Ae(t,"link",e),ke(t),i.head.appendChild(t)))}}function c0(e){Wt.D(e),fp("dns-prefetch",e,null)}function d0(e,t){Wt.C(e,t),fp("preconnect",e,t)}function f0(e,t,n){Wt.L(e,t,n);var i=la;if(i&&e&&t){var a='link[rel="preload"][as="'+dt(t)+'"]';t==="image"&&n&&n.imageSrcSet?(a+='[imagesrcset="'+dt(n.imageSrcSet)+'"]',typeof n.imageSizes=="string"&&(a+='[imagesizes="'+dt(n.imageSizes)+'"]')):a+='[href="'+dt(e)+'"]';var l=a;switch(t){case"style":l=Qi(e);break;case"script":l=sa(e)}pt.has(l)||(e=oe({rel:"preload",href:t==="image"&&n&&n.imageSrcSet?void 0:e,as:t},n),pt.set(l,e),i.querySelector(a)!==null||t==="style"&&i.querySelector(ol(l))||t==="script"&&i.querySelector(ul(l))||(t=i.createElement("link"),Ae(t,"link",e),ke(t),i.head.appendChild(t)))}}function h0(e,t){Wt.m(e,t);var n=la;if(n&&e){var i=t&&typeof t.as=="string"?t.as:"script",a='link[rel="modulepreload"][as="'+dt(i)+'"][href="'+dt(e)+'"]',l=a;switch(i){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":l=sa(e)}if(!pt.has(l)&&(e=oe({rel:"modulepreload",href:e},t),pt.set(l,e),n.querySelector(a)===null)){switch(i){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(n.querySelector(ul(l)))return}i=n.createElement("link"),Ae(i,"link",e),ke(i),n.head.appendChild(i)}}}function m0(e,t,n){Wt.S(e,t,n);var i=la;if(i&&e){var a=zi(i).hoistableStyles,l=Qi(e);t=t||"default";var s=a.get(l);if(!s){var o={loading:0,preload:null};if(s=i.querySelector(ol(l)))o.loading=5;else{e=oe({rel:"stylesheet",href:e,"data-precedence":t},n),(n=pt.get(l))&&yc(e,n);var u=s=i.createElement("link");ke(u),Ae(u,"link",e),u._p=new Promise(function(d,g){u.onload=d,u.onerror=g}),u.addEventListener("load",function(){o.loading|=1}),u.addEventListener("error",function(){o.loading|=2}),o.loading|=4,Fl(s,t,i)}s={type:"stylesheet",instance:s,count:1,state:o},a.set(l,s)}}}function g0(e,t){Wt.X(e,t);var n=la;if(n&&e){var i=zi(n).hoistableScripts,a=sa(e),l=i.get(a);l||(l=n.querySelector(ul(a)),l||(e=oe({src:e,async:!0},t),(t=pt.get(a))&&bc(e,t),l=n.createElement("script"),ke(l),Ae(l,"link",e),n.head.appendChild(l)),l={type:"script",instance:l,count:1,state:null},i.set(a,l))}}function p0(e,t){Wt.M(e,t);var n=la;if(n&&e){var i=zi(n).hoistableScripts,a=sa(e),l=i.get(a);l||(l=n.querySelector(ul(a)),l||(e=oe({src:e,async:!0,type:"module"},t),(t=pt.get(a))&&bc(e,t),l=n.createElement("script"),ke(l),Ae(l,"link",e),n.head.appendChild(l)),l={type:"script",instance:l,count:1,state:null},i.set(a,l))}}function Fd(e,t,n,i){var a=(a=pn.current)?Ms(a):null;if(!a)throw Error(E(446));switch(e){case"meta":case"title":return null;case"style":return typeof n.precedence=="string"&&typeof n.href=="string"?(t=Qi(n.href),n=zi(a).hoistableStyles,i=n.get(t),i||(i={type:"style",instance:null,count:0,state:null},n.set(t,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=Qi(n.href);var l=zi(a).hoistableStyles,s=l.get(e);if(s||(a=a.ownerDocument||a,s={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},l.set(e,s),(l=a.querySelector(ol(e)))&&!l._p&&(s.instance=l,s.state.loading=5),pt.has(e)||(n={rel:"preload",as:"style",href:n.href,crossOrigin:n.crossOrigin,integrity:n.integrity,media:n.media,hrefLang:n.hrefLang,referrerPolicy:n.referrerPolicy},pt.set(e,n),l||v0(a,e,n,s.state))),t&&i===null)throw Error(E(528,""));return s}if(t&&i!==null)throw Error(E(529,""));return null;case"script":return t=n.async,n=n.src,typeof n=="string"&&t&&typeof t!="function"&&typeof t!="symbol"?(t=sa(n),n=zi(a).hoistableScripts,i=n.get(t),i||(i={type:"script",instance:null,count:0,state:null},n.set(t,i)),i):{type:"void",instance:null,count:0,state:null};default:throw Error(E(444,e))}}function Qi(e){return'href="'+dt(e)+'"'}function ol(e){return'link[rel="stylesheet"]['+e+"]"}function hp(e){return oe({},e,{"data-precedence":e.precedence,precedence:null})}function v0(e,t,n,i){e.querySelector('link[rel="preload"][as="style"]['+t+"]")?i.loading=1:(t=e.createElement("link"),i.preload=t,t.addEventListener("load",function(){return i.loading|=1}),t.addEventListener("error",function(){return i.loading|=2}),Ae(t,"link",n),ke(t),e.head.appendChild(t))}function sa(e){return'[src="'+dt(e)+'"]'}function ul(e){return"script[async]"+e}function Pd(e,t,n){if(t.count++,t.instance===null)switch(t.type){case"style":var i=e.querySelector('style[data-href~="'+dt(n.href)+'"]');if(i)return t.instance=i,ke(i),i;var a=oe({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return i=(e.ownerDocument||e).createElement("style"),ke(i),Ae(i,"style",a),Fl(i,n.precedence,e),t.instance=i;case"stylesheet":a=Qi(n.href);var l=e.querySelector(ol(a));if(l)return t.state.loading|=4,t.instance=l,ke(l),l;i=hp(n),(a=pt.get(a))&&yc(i,a),l=(e.ownerDocument||e).createElement("link"),ke(l);var s=l;return s._p=new Promise(function(o,u){s.onload=o,s.onerror=u}),Ae(l,"link",i),t.state.loading|=4,Fl(l,n.precedence,e),t.instance=l;case"script":return l=sa(n.src),(a=e.querySelector(ul(l)))?(t.instance=a,ke(a),a):(i=n,(a=pt.get(l))&&(i=oe({},n),bc(i,a)),e=e.ownerDocument||e,a=e.createElement("script"),ke(a),Ae(a,"link",i),e.head.appendChild(a),t.instance=a);case"void":return null;default:throw Error(E(443,t.type))}else t.type==="stylesheet"&&!(t.state.loading&4)&&(i=t.instance,t.state.loading|=4,Fl(i,n.precedence,e));return t.instance}function Fl(e,t,n){for(var i=n.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),a=i.length?i[i.length-1]:null,l=a,s=0;s<i.length;s++){var o=i[s];if(o.dataset.precedence===t)l=o;else if(l!==a)break}l?l.parentNode.insertBefore(e,l.nextSibling):(t=n.nodeType===9?n.head:n,t.insertBefore(e,t.firstChild))}function yc(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.title==null&&(e.title=t.title)}function bc(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.integrity==null&&(e.integrity=t.integrity)}var Pl=null;function Wd(e,t,n){if(Pl===null){var i=new Map,a=Pl=new Map;a.set(n,i)}else a=Pl,i=a.get(n),i||(i=new Map,a.set(n,i));if(i.has(e))return i;for(i.set(e,null),n=n.getElementsByTagName(e),a=0;a<n.length;a++){var l=n[a];if(!(l[nl]||l[Ce]||e==="link"&&l.getAttribute("rel")==="stylesheet")&&l.namespaceURI!=="http://www.w3.org/2000/svg"){var s=l.getAttribute(t)||"";s=e+s;var o=i.get(s);o?o.push(l):i.set(s,[l])}}return i}function ef(e,t,n){e=e.ownerDocument||e,e.head.insertBefore(n,t==="title"?e.querySelector("head > title"):null)}function y0(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 mp(e){return!(e.type==="stylesheet"&&!(e.state.loading&3))}function b0(e,t,n,i){if(n.type==="stylesheet"&&(typeof i.media!="string"||matchMedia(i.media).matches!==!1)&&!(n.state.loading&4)){if(n.instance===null){var a=Qi(i.href),l=t.querySelector(ol(a));if(l){t=l._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(e.count++,e=Ns.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=l,ke(l);return}l=t.ownerDocument||t,i=hp(i),(a=pt.get(a))&&yc(i,a),l=l.createElement("link"),ke(l);var s=l;s._p=new Promise(function(o,u){s.onload=o,s.onerror=u}),Ae(l,"link",i),n.instance=l}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(n,t),(t=n.state.preload)&&!(n.state.loading&3)&&(e.count++,n=Ns.bind(e),t.addEventListener("load",n),t.addEventListener("error",n))}}var Zr=0;function x0(e,t){return e.stylesheets&&e.count===0&&Wl(e,e.stylesheets),0<e.count||0<e.imgCount?function(n){var i=setTimeout(function(){if(e.stylesheets&&Wl(e,e.stylesheets),e.unsuspend){var l=e.unsuspend;e.unsuspend=null,l()}},6e4+t);0<e.imgBytes&&Zr===0&&(Zr=62500*e0());var a=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&Wl(e,e.stylesheets),e.unsuspend)){var l=e.unsuspend;e.unsuspend=null,l()}},(e.imgBytes>Zr?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(i),clearTimeout(a)}}:null}function Ns(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Wl(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var Rs=null;function Wl(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,Rs=new Map,t.forEach(S0,e),Rs=null,Ns.call(e))}function S0(e,t){if(!(t.state.loading&4)){var n=Rs.get(e);if(n)var i=n.get(null);else{n=new Map,Rs.set(e,n);for(var a=e.querySelectorAll("link[data-precedence],style[data-precedence]"),l=0;l<a.length;l++){var s=a[l];(s.nodeName==="LINK"||s.getAttribute("media")!=="not all")&&(n.set(s.dataset.precedence,s),i=s)}i&&n.set(null,i)}a=t.instance,s=a.getAttribute("data-precedence"),l=n.get(s)||i,l===i&&n.set(null,a),n.set(s,a),this.count++,i=Ns.bind(this),a.addEventListener("load",i),a.addEventListener("error",i),l?l.parentNode.insertBefore(a,l.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(a,e.firstChild)),t.state.loading|=4}}var Qa={$$typeof:$t,Provider:null,Consumer:null,_currentValue:Yn,_currentValue2:Yn,_threadCount:0};function w0(e,t,n,i,a,l,s,o,u){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=yr(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=yr(0),this.hiddenUpdates=yr(null),this.identifierPrefix=i,this.onUncaughtError=a,this.onCaughtError=l,this.onRecoverableError=s,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=u,this.incompleteTransitions=new Map}function gp(e,t,n,i,a,l,s,o,u,d,g,p){return e=new w0(e,t,n,s,u,d,g,p,o),t=1,l===!0&&(t|=24),l=Je(3,null,null,t),e.current=l,l.stateNode=e,t=Vu(),t.refCount++,e.pooledCache=t,t.refCount++,l.memoizedState={element:i,isDehydrated:n,cache:t},Qu(l),e}function pp(e){return e?(e=Ei,e):Ei}function vp(e,t,n,i,a,l){a=pp(a),i.context===null?i.context=a:i.pendingContext=a,i=yn(t),i.payload={element:n},l=l===void 0?null:l,l!==null&&(i.callback=l),n=bn(e,i,t),n!==null&&(Ye(n,e,t),Ca(n,e,t))}function tf(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function xc(e,t){tf(e,t),(e=e.alternate)&&tf(e,t)}function yp(e){if(e.tag===13||e.tag===31){var t=ii(e,67108864);t!==null&&Ye(t,e,67108864),xc(e,67108864)}}function nf(e){if(e.tag===13||e.tag===31){var t=tt();t=Au(t);var n=ii(e,t);n!==null&&Ye(n,e,t),xc(e,t)}}var Is=!0;function j0(e,t,n,i){var a=U.T;U.T=null;var l=J.p;try{J.p=2,Sc(e,t,n,i)}finally{J.p=l,U.T=a}}function k0(e,t,n,i){var a=U.T;U.T=null;var l=J.p;try{J.p=8,Sc(e,t,n,i)}finally{J.p=l,U.T=a}}function Sc(e,t,n,i){if(Is){var a=du(i);if(a===null)Xr(e,t,i,Us,n),af(e,i);else if(E0(a,e,t,n,i))i.stopPropagation();else if(af(e,i),t&4&&-1<T0.indexOf(e)){for(;a!==null;){var l=ta(a);if(l!==null)switch(l.tag){case 3:if(l=l.stateNode,l.current.memoizedState.isDehydrated){var s=Ln(l.pendingLanes);if(s!==0){var o=l;for(o.pendingLanes|=2,o.entangledLanes|=2;s;){var u=1<<31-et(s);o.entanglements[1]|=u,s&=~u}At(l),!(Z&6)&&(Es=Pe()+500,rl(0))}}break;case 31:case 13:o=ii(l,2),o!==null&&Ye(o,l,2),ir(),xc(l,2)}if(l=du(i),l===null&&Xr(e,t,i,Us,n),l===a)break;a=l}a!==null&&i.stopPropagation()}else Xr(e,t,i,null,n)}}function du(e){return e=Ru(e),wc(e)}var Us=null;function wc(e){if(Us=null,e=xi(e),e!==null){var t=Pa(e);if(t===null)e=null;else{var n=t.tag;if(n===13){if(e=Lh(t),e!==null)return e;e=null}else if(n===31){if(e=Hh(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 Us=e,null}function bp(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"resize":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"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"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(cy()){case Yh:return 2;case Gh:return 8;case fs:case dy:return 32;case Vh:return 268435456;default:return 32}default:return 32}}var fu=!1,wn=null,jn=null,kn=null,Za=new Map,Ja=new Map,cn=[],T0="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 af(e,t){switch(e){case"focusin":case"focusout":wn=null;break;case"dragenter":case"dragleave":jn=null;break;case"mouseover":case"mouseout":kn=null;break;case"pointerover":case"pointerout":Za.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":Ja.delete(t.pointerId)}}function ha(e,t,n,i,a,l){return e===null||e.nativeEvent!==l?(e={blockedOn:t,domEventName:n,eventSystemFlags:i,nativeEvent:l,targetContainers:[a]},t!==null&&(t=ta(t),t!==null&&yp(t)),e):(e.eventSystemFlags|=i,t=e.targetContainers,a!==null&&t.indexOf(a)===-1&&t.push(a),e)}function E0(e,t,n,i,a){switch(t){case"focusin":return wn=ha(wn,e,t,n,i,a),!0;case"dragenter":return jn=ha(jn,e,t,n,i,a),!0;case"mouseover":return kn=ha(kn,e,t,n,i,a),!0;case"pointerover":var l=a.pointerId;return Za.set(l,ha(Za.get(l)||null,e,t,n,i,a)),!0;case"gotpointercapture":return l=a.pointerId,Ja.set(l,ha(Ja.get(l)||null,e,t,n,i,a)),!0}return!1}function xp(e){var t=xi(e.target);if(t!==null){var n=Pa(t);if(n!==null){if(t=n.tag,t===13){if(t=Lh(n),t!==null){e.blockedOn=t,$c(e.priority,function(){nf(n)});return}}else if(t===31){if(t=Hh(n),t!==null){e.blockedOn=t,$c(e.priority,function(){nf(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 es(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=du(e.nativeEvent);if(n===null){n=e.nativeEvent;var i=new n.constructor(n.type,n);_o=i,n.target.dispatchEvent(i),_o=null}else return t=ta(n),t!==null&&yp(t),e.blockedOn=n,!1;t.shift()}return!0}function lf(e,t,n){es(e)&&n.delete(t)}function C0(){fu=!1,wn!==null&&es(wn)&&(wn=null),jn!==null&&es(jn)&&(jn=null),kn!==null&&es(kn)&&(kn=null),Za.forEach(lf),Ja.forEach(lf)}function jl(e,t){e.blockedOn===t&&(e.blockedOn=null,fu||(fu=!0,we.unstable_scheduleCallback(we.unstable_NormalPriority,C0)))}var kl=null;function sf(e){kl!==e&&(kl=e,we.unstable_scheduleCallback(we.unstable_NormalPriority,function(){kl===e&&(kl=null);for(var t=0;t<e.length;t+=3){var n=e[t],i=e[t+1],a=e[t+2];if(typeof i!="function"){if(wc(i||n)===null)continue;break}var l=ta(n);l!==null&&(e.splice(t,3),t-=3,Ko(l,{pending:!0,data:a,method:n.method,action:i},i,a))}}))}function Zi(e){function t(u){return jl(u,e)}wn!==null&&jl(wn,e),jn!==null&&jl(jn,e),kn!==null&&jl(kn,e),Za.forEach(t),Ja.forEach(t);for(var n=0;n<cn.length;n++){var i=cn[n];i.blockedOn===e&&(i.blockedOn=null)}for(;0<cn.length&&(n=cn[0],n.blockedOn===null);)xp(n),n.blockedOn===null&&cn.shift();if(n=(e.ownerDocument||e).$$reactFormReplay,n!=null)for(i=0;i<n.length;i+=3){var a=n[i],l=n[i+1],s=a[Ge]||null;if(typeof l=="function")s||sf(n);else if(s){var o=null;if(l&&l.hasAttribute("formAction")){if(a=l,s=l[Ge]||null)o=s.formAction;else if(wc(a)!==null)continue}else o=s.action;typeof o=="function"?n[i+1]=o:(n.splice(i,3),i-=3),sf(n)}}}function Sp(){function e(l){l.canIntercept&&l.info==="react-transition"&&l.intercept({handler:function(){return new Promise(function(s){return a=s})},focusReset:"manual",scroll:"manual"})}function t(){a!==null&&(a(),a=null),i||setTimeout(n,20)}function n(){if(!i&&!navigation.transition){var l=navigation.currentEntry;l&&l.url!=null&&navigation.navigate(l.url,{state:l.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var i=!1,a=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),a!==null&&(a(),a=null)}}}function jc(e){this._internalRoot=e}sr.prototype.render=jc.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(E(409));var n=t.current,i=tt();vp(n,i,e,t,null,null)};sr.prototype.unmount=jc.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;vp(e.current,2,null,e,null,null),ir(),t[ea]=null}};function sr(e){this._internalRoot=e}sr.prototype.unstable_scheduleHydration=function(e){if(e){var t=Jh();e={blockedOn:null,target:e,priority:t};for(var n=0;n<cn.length&&t!==0&&t<cn[n].priority;n++);cn.splice(n,0,e),n===0&&xp(e)}};var rf=Ih.version;if(rf!=="19.2.6")throw Error(E(527,rf,"19.2.6"));J.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(E(188)):(e=Object.keys(e).join(","),Error(E(268,e)));return e=iy(t),e=e!==null?Bh(e):null,e=e===null?null:e.stateNode,e};var O0={bundleType:0,version:"19.2.6",rendererPackageName:"react-dom",currentDispatcherRef:U,reconcilerVersion:"19.2.6"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Tl=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Tl.isDisabled&&Tl.supportsFiber)try{Wa=Tl.inject(O0),We=Tl}catch{}}Ys.createRoot=function(e,t){if(!Uh(e))throw Error(E(299));var n=!1,i="",a=fg,l=hg,s=mg;return t!=null&&(t.unstable_strictMode===!0&&(n=!0),t.identifierPrefix!==void 0&&(i=t.identifierPrefix),t.onUncaughtError!==void 0&&(a=t.onUncaughtError),t.onCaughtError!==void 0&&(l=t.onCaughtError),t.onRecoverableError!==void 0&&(s=t.onRecoverableError)),t=gp(e,1,!1,null,null,n,i,null,a,l,s,Sp),e[ea]=t.current,vc(e),new jc(t)};Ys.hydrateRoot=function(e,t,n){if(!Uh(e))throw Error(E(299));var i=!1,a="",l=fg,s=hg,o=mg,u=null;return n!=null&&(n.unstable_strictMode===!0&&(i=!0),n.identifierPrefix!==void 0&&(a=n.identifierPrefix),n.onUncaughtError!==void 0&&(l=n.onUncaughtError),n.onCaughtError!==void 0&&(s=n.onCaughtError),n.onRecoverableError!==void 0&&(o=n.onRecoverableError),n.formState!==void 0&&(u=n.formState)),t=gp(e,1,!0,t,n??null,i,a,u,l,s,o,Sp),t.context=pp(null),n=t.current,i=tt(),i=Au(i),a=yn(i),a.callback=null,bn(n,a,i),n=i,t.current.lanes=n,tl(t,n),At(t),e[ea]=t.current,vc(e),new sr(t)};Ys.version="19.2.6";function wp(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(wp)}catch(e){console.error(e)}}wp(),Dh.exports=Ys;var D0=Dh.exports;class _0{_cards=[];_selected=new Set;listeners=new Set;cards(){return this._cards}selectedIds(){return this._selected}setCards(t){this._cards=[...t];const n=new Set(t.map(i=>i.id));for(const i of[...this._selected])n.has(i)||this._selected.delete(i);this.fire()}toggleSelect(t,n){n?.range?this._selected.add(t):this._selected.has(t)?this._selected.delete(t):this._selected.add(t),this.fire()}clearSelection(){this._selected.size!==0&&(this._selected.clear(),this.fire())}subscribe(t){return this.listeners.add(t),()=>this.listeners.delete(t)}fire(){for(const t of this.listeners)t()}}class A0{_open=!1;_x=0;_y=0;_actions=[];listeners=new Set;open(t,n,i){this._open=!0,this._x=t,this._y=n,this._actions=i;for(const a of this.listeners)a()}close(){if(this._open){this._open=!1,this._actions=[];for(const t of this.listeners)t()}}state(){return{open:this._open,x:this._x,y:this._y,actions:this._actions}}subscribe(t){return this.listeners.add(t),()=>this.listeners.delete(t)}}class z0{_tree=260;_detail=340;_drag=null;listeners=new Set;widths(){return{tree:this._tree,detail:this._detail}}setTreeWidth(t){this._tree=Math.max(160,Math.min(560,t)),this.fire()}setDetailWidth(t){this._detail=Math.max(200,Math.min(640,t)),this.fire()}beginDrag(t){this._drag=t,this.fire()}endDrag(){this._drag!==null&&(this._drag=null,this.fire())}isDragging(){return this._drag}subscribe(t){return this.listeners.add(t),()=>this.listeners.delete(t)}fire(){for(const t of this.listeners)t()}}class M0{_theme="vibrant-light";listeners=new Set;constructor(t){t&&(this._theme=t),typeof document<"u"&&(document.documentElement.dataset.wkmsTheme=this._theme)}current(){return this._theme}set(t){if(this._theme=t,typeof document<"u"){const n=document.documentElement;n.dataset.wkmsTheme=t}for(const n of this.listeners)n()}subscribe(t){return this.listeners.add(t),()=>this.listeners.delete(t)}}class N0{opened=[];async openTab(t,n){this.opened.push({urls:[t],newWindow:n?.newWindow,pinned:n?.pinned})}async openTabs(t,n){this.opened.push({urls:[...t],newWindow:n?.newWindow})}}class R0{async openTab(t,n){const i=globalThis.chrome;if(!i?.runtime)throw new Error("ChromeNavigationAdapter: no chrome.runtime");await i.runtime.sendMessage({kind:"wkms/open-tabs",payload:{urls:[t],newWindow:n?.newWindow,pinned:n?.pinned}})}async openTabs(t,n){const i=globalThis.chrome;if(!i?.runtime)throw new Error("ChromeNavigationAdapter: no chrome.runtime");await i.runtime.sendMessage({kind:"wkms/open-tabs",payload:{urls:[...t],newWindow:n?.newWindow}})}}class I0{nodes=new Map;expanded=new Set;selected;listeners=new Set;cachedRows=[];setNodes(t){for(const n of t)this.nodes.set(n.id,n);this.recompute()}pruneChildrenOf(t){for(const[n,i]of[...this.nodes])i.parentId===t&&this.nodes.delete(n);this.recompute()}rows(){return this.cachedRows}toggleExpand(t){this.expanded.has(t)?this.expanded.delete(t):this.expanded.add(t),this.recompute()}selectNode(t){this.selected=t,this.recompute()}selectedId(){return this.selected}async moveNode(t,n,i){}subscribe(t){return this.listeners.add(t),()=>this.listeners.delete(t)}recompute(){const t=[],n=(i,a)=>{const l=[...this.nodes.values()].filter(s=>s.parentId===i);for(const s of l){const o=this.expanded.has(s.id);t.push({id:s.id,parentId:s.parentId,depth:a,isLeaf:!s.hasChildren,isExpanded:o,data:s.data}),o&&s.hasChildren&&n(s.id,a+1)}};n(void 0,0),this.cachedRows=t;for(const i of this.listeners)i()}}const U0={maxEntries:5e3,lruTtlMs:5*6e4,pageSize:100};class L0{constructor(t,n={},i=()=>Date.now()){this.loader=t,this.now=i,this.cfg={...U0,...n}}cfg;map=new Map;listeners=new Set;hits=0;misses=0;evictions=0;invalidations=0;async getNode(t){const n=`node:${t}`,i=this.read(n);if(i!==void 0)return i;const a=await this.loader.getNode(t);return this.write(n,a,of(a)),a}async getChildren(t){const n=`kids:${t??"\0scope-root"}`,i=this.read(n);if(i!==void 0)return i;const a=await this.loader.getChildren(t);this.write(n,a,void 0);for(const l of a){const s=H0(l);s&&this.write(`node:${s}`,l,of(l))}return a}async prefetch(t){await this.getChildren(t)}invalidate(t){const n=new Set(t.ids??[]),i=t.affectedPaths??[];let a=!1;for(const[l,s]of[...this.map]){let o=!1;if(l.startsWith("node:")&&n.has(l.slice(5))&&(o=!0),l.startsWith("kids:")&&n.has(l.slice(5))&&(o=!0),!o&&s.path){for(const u of i)if(s.path===u||s.path.startsWith(u+".")||u.startsWith(s.path+".")){o=!0;break}}!o&&l.startsWith("kids:")&&i.length&&(o=!0),o&&(this.map.delete(l),a=!0)}a&&(this.invalidations++,this.fire())}subscribe(t){return this.listeners.add(t),()=>this.listeners.delete(t)}stats(){return{entries:this.map.size,hits:this.hits,misses:this.misses,evictions:this.evictions,invalidations:this.invalidations}}config(){return{...this.cfg}}read(t){const n=this.map.get(t);if(!n){this.misses++;return}if(this.cfg.lruTtlMs>0&&this.now()-n.ts>this.cfg.lruTtlMs){this.map.delete(t),this.misses++;return}return this.map.delete(t),this.map.set(t,n),this.hits++,n.value}write(t,n,i){for(this.map.delete(t),this.map.set(t,{value:n,ts:this.now(),path:i});this.map.size>this.cfg.maxEntries;){const a=this.map.keys().next().value;if(a===void 0)break;this.map.delete(a),this.evictions++}this.fire()}fire(){for(const t of this.listeners)t()}}function H0(e){return e&&typeof e=="object"&&typeof e.id=="string"?e.id:void 0}function of(e){return e&&typeof e=="object"&&typeof e.path=="string"?e.path:void 0}class B0{constructor(t){this.cache=t}rootId;childrenOf=new Map;nodeById=new Map;expanded=new Set;selected;listeners=new Set;async setRoots(t){this.rootId=t,await this.load(t),this.fire()}async refresh(){await this.load(this.rootId);for(const t of[...this.expanded])await this.load(t);this.fire()}async reload(){const t=[...this.expanded];this.rootId&&t.push(this.rootId),this.cache.invalidate({ids:t}),this.childrenOf.clear(),await this.load(this.rootId);for(const n of[...this.expanded])await this.load(n);this.fire()}visibleRows(){const t=[],n=(i,a,l)=>{const s=this.childrenOf.get(i);if(s)for(const o of s){const u=this.childrenOf.get(o.id);t.push({id:o.id,parentId:a,depth:l,isLeaf:u!==void 0&&u.length===0,isExpanded:this.expanded.has(o.id),isSelected:this.selected===o.id,kind:o.kind??"",name:o.name??o.id,data:o.data??{}}),this.expanded.has(o.id)&&n(o.id,o.id,l+1)}};return n(this.rootKey(),this.rootId,0),t}nestedTree(){const t=n=>{const i=this.childrenOf.get(n.id);let a;return i===void 0?a=[{id:`${n.id}::__lazy`,name:"…",kind:"loading",data:{},lazy:!0}]:i.length===0?a=void 0:a=i.map(t),{id:n.id,name:n.name??n.id,kind:n.kind??"",data:n.data??{},children:a,isExpanded:this.expanded.has(n.id)}};return(this.childrenOf.get(this.rootKey())??[]).map(t)}async expand(t){this.childrenOf.has(t)||await this.load(t),this.expanded.add(t),this.fire()}collapse(t){this.expanded.delete(t),this.fire()}async toggle(t){this.expanded.has(t)?this.collapse(t):await this.expand(t)}select(t){this.selected=t,this.fire()}selectedId(){return this.selected}subscribe(t){return this.listeners.add(t),()=>this.listeners.delete(t)}rootKey(){return this.rootId??""}async load(t){const n=await this.cache.getChildren(t);this.childrenOf.set(t??"",n);for(const i of n)this.nodeById.set(i.id,i)}fire(){for(const t of this.listeners)t()}}class $0{rows=[];cols=[];sort=null;filterText="";pageIndex=0;pageSize=50;listeners=new Set;setRows(t){this.rows=t.map(n=>({id:n.id,cells:{...n.cells}})),this.pageIndex=0,this.fire()}setColumns(t){this.cols=t.map(n=>({...n})),this.fire()}columns(){return this.cols.map(t=>({...t}))}sortBy(t,n){n?this.sort={key:t,dir:n}:this.sort&&this.sort.key===t?this.sort={key:t,dir:this.sort.dir==="asc"?"desc":"asc"}:this.sort={key:t,dir:"asc"},this.fire()}sortState(){return this.sort?{...this.sort}:null}setFilter(t){this.filterText=t,this.pageIndex=0,this.fire()}filter(){return this.filterText}setPage(t,n){n!=null&&n>0&&(this.pageSize=n);const i=Math.max(1,Math.ceil(this.filtered().length/this.pageSize));this.pageIndex=Math.min(Math.max(0,t),i-1),this.fire()}page(){const t=this.filtered().length;return{page:this.pageIndex,pageSize:this.pageSize,total:t,pageCount:Math.max(1,Math.ceil(t/this.pageSize))}}visibleRows(){const t=this.sorted(this.filtered()),n=this.pageIndex*this.pageSize;return t.slice(n,n+this.pageSize).map(i=>({id:i.id,cells:{...i.cells}}))}filteredCount(){return this.filtered().length}subscribe(t){return this.listeners.add(t),()=>this.listeners.delete(t)}filtered(){const t=this.filterText.trim().toLowerCase();return t?this.rows.filter(n=>Object.values(n.cells).some(i=>String(i??"").toLowerCase().includes(t))):this.rows}sorted(t){if(!this.sort)return t;const{key:n,dir:i}=this.sort,a=i==="asc"?1:-1;return[...t].sort((l,s)=>{const o=l.cells[n],u=s.cells[n];return o==null&&u==null?0:o==null?1:u==null?-1:typeof o=="number"&&typeof u=="number"?(o-u)*a:String(o).localeCompare(String(u))*a})}fire(){for(const t of this.listeners)t()}}class q0{cols=[];sort=null;filterClause=null;accRows=[];seen=new Set;cur;more=!0;listeners=new Set;setColumns(t){this.cols=t.map(n=>({...n})),this.fire()}columns(){return this.cols.map(t=>({...t}))}sortBy(t,n){n?this.sort={key:t,dir:n}:this.sort&&this.sort.key===t?this.sort={key:t,dir:this.sort.dir==="asc"?"desc":"asc"}:this.sort={key:t,dir:"asc"},this.reset()}sortState(){return this.sort?{...this.sort}:null}setFilter(t,n,i){this.filterClause=t?{field:t,op:n,value:i}:null,this.reset()}clearFilter(){this.filterClause=null,this.reset()}filter(){return this.filterClause?{...this.filterClause}:null}reset(){this.accRows=[],this.seen.clear(),this.cur=void 0,this.more=!0,this.fire()}appendPage(t){for(const n of t.rows)this.seen.has(n.id)||(this.seen.add(n.id),this.accRows.push({id:n.id,cells:{...n.cells}}));this.cur=t.nextCursor,this.more=t.hasMore,this.fire()}rows(){return this.accRows.map(t=>({id:t.id,cells:{...t.cells}}))}cursor(){return this.cur}hasMore(){return this.more}loadedCount(){return this.accRows.length}subscribe(t){return this.listeners.add(t),()=>this.listeners.delete(t)}fire(){for(const t of this.listeners)t()}}class Y0{constructor(t=()=>Date.now()){this.now=t}map=new Map;async get(t){const n=this.map.get(t);if(n){if(n.ttlSeconds!=null&&(this.now()-n.ts)/1e3>n.ttlSeconds){this.map.delete(t);return}return n.value}}async put(t,n,i){this.map.set(t,{value:n,ts:this.now(),ttlSeconds:i?.ttlSeconds,tag:i?.tag,bytes:G0(n)})}async delete(t){this.map.delete(t)}async evict(t){let n=0;if(t?.olderThanSeconds!=null){const i=this.now()-t.olderThanSeconds*1e3;for(const[a,l]of[...this.map])l.ts<i&&(this.map.delete(a),n++)}if(t?.maxBytes!=null){let i=0;for(const a of this.map.values())i+=a.bytes;for(const[a,l]of[...this.map]){if(i<=t.maxBytes)break;this.map.delete(a),i-=l.bytes,n++}}return n}async stats(){let t=0;for(const n of this.map.values())t+=n.bytes;return{entries:this.map.size,approxBytes:t}}}function G0(e){try{return JSON.stringify(e).length}catch{return 0}}class V0{constructor(t,n={}){this.ublm=t,this.session=n.sessionTabId??t.nodeId()}metas=new Map;handles=new Map;session;sessionTabId(){return this.session}register(t,n){if(!t.uid.startsWith("my.wkms.ui.")&&!t.uid.startsWith("sys.wkms.ui."))throw new Error(`UiActionRegistry: ${t.uid} must be under my.wkms.ui.* / sys.wkms.ui.*`);this.metas.has(t.uid)&&this.unregister(t.uid);const i=this.ublm.register({uid:t.uid,description:t.description,argsSchema:t.argsSchema,tags:t.tags??["wkms","ui"],routing:"node-affinity"},(a,l)=>n(a,{...l,sessionTabId:l.sessionTabId??this.session}));return this.metas.set(t.uid,t),this.handles.set(t.uid,i),()=>this.unregister(t.uid)}unregister(t){this.handles.get(t)?.unsubscribe(),this.handles.delete(t),this.metas.delete(t)}list(){return[...this.metas.values()]}async call(t,n,i={}){return this.ublm.call({kind:"uid",uid:t},n,{...i,sessionTabId:i.sessionTabId??this.session})}unregisterAll(){for(const t of[...this.handles.keys()])this.unregister(t)}}function jp(){const e=globalThis.chrome?.runtime?.sendMessage;return async(t,n)=>{if(e)try{return await e({kind:t,payload:n})}catch{return}}}function K0(e){const t=jp();return{getChildren:async n=>{const i=n?await t("wkms/scope/list_children",{scope:e,parentId:n}):await t("wkms/scope/list_roots",{scope:e});return i?.ok&&Array.isArray(i.result)?i.result:[]},getNode:async n=>{const i=await t("wkms/scope/get",{scope:e,id:n});return i?.ok?i.result:void 0}}}const X0="projectspace-root";function Q0(){const e=jp(),t=new Map,n=new Map,i=(a,l)=>l.map(s=>{t.set(s.id,a);const o=s.data??{};return typeof o.linkScope=="string"&&typeof o.linkRootId=="string"&&n.set(s.id,{scope:o.linkScope,rootId:o.linkRootId}),{...s,data:{...o,__scope:a}}});return{getChildren:async a=>{if(!a){const u=await e("wkms/scope/get",{scope:"project",id:X0}),d=u?.ok?u.result:void 0;return d?(t.set(d.id,"project"),[{...d,data:{...d.data??{},__scope:"project"}}]):[]}const l=n.get(a);if(l){const u=await e("wkms/scope/list_children",{scope:l.scope,parentId:l.rootId});return i(l.scope,u?.ok&&Array.isArray(u.result)?u.result:[])}const s=t.get(a)??"project",o=await e("wkms/scope/list_children",{scope:s,parentId:a});return i(s,o?.ok&&Array.isArray(o.result)?o.result:[])},getNode:async a=>{const l=t.get(a)??"project",s=await e("wkms/scope/get",{scope:l,id:a});return s?.ok?s.result:void 0}}}function Z0(e={surface:"test"}){const t=new I0;t.setNodes([{id:"root",parentId:void 0,data:{kind:"group",name:"Knowledge tree"},hasChildren:!0}]);const n=e.surface!=="test"&&typeof globalThis.chrome?.runtime?.sendMessage=="function"?new R0:new N0,i=new Map,a=u=>{let d=i.get(u);if(!d){const g=u==="all"?Q0():K0(u);d=new B0(new L0(g,{maxEntries:5e3,lruTtlMs:5*6e4,pageSize:200})),i.set(u,d)}return d},l=`${e.surface}-${Math.random().toString(36).slice(2,8)}`,s=new Av(new zv({nodeId:l}),{nodeId:l});s.connect();const o=new V0(s,{sessionTabId:l});return{tree:t,grid:new _0,menu:new A0,resizer:new z0,theme:new M0,navigation:n,treeUxFor:a,tableUx:new $0,listUx:new q0,cache:new Y0,ublm:s,control:o}}const kp=x.createContext(null);function J0({registry:e,children:t}){return r.jsx(kp.Provider,{value:e,children:t})}function wt(){const e=x.useContext(kp);if(!e)throw new Error("FrontendRegistry not provided");return e}function Pt(e){const[,t]=x.useState(0);return x.useEffect(()=>e.subscribe(()=>t(n=>n+1)),[e]),e}var Tp={exports:{}},Ep={};/**
 * @license React
 * use-sync-external-store-shim.production.js
 *
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */var Ji=x;function F0(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var P0=typeof Object.is=="function"?Object.is:F0,W0=Ji.useState,ex=Ji.useEffect,tx=Ji.useLayoutEffect,nx=Ji.useDebugValue;function ix(e,t){var n=t(),i=W0({inst:{value:n,getSnapshot:t}}),a=i[0].inst,l=i[1];return tx(function(){a.value=n,a.getSnapshot=t,Jr(a)&&l({inst:a})},[e,n,t]),ex(function(){return Jr(a)&&l({inst:a}),e(function(){Jr(a)&&l({inst:a})})},[e]),nx(n),n}function Jr(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!P0(e,n)}catch{return!0}}function ax(e,t){return t()}var lx=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?ax:ix;Ep.useSyncExternalStore=Ji.useSyncExternalStore!==void 0?Ji.useSyncExternalStore:lx;Tp.exports=Ep;var sx=Tp.exports;const Cp=x.createContext(null);function Ke(){const e=x.useContext(Cp);if(e===null)throw new Error("No Tree Api Provided");return e}const Op=x.createContext(null);function rx(){const e=x.useContext(Op);if(e===null)throw new Error("Provide a NodesContext");return e}const Dp=x.createContext(null);function ox(){const e=x.useContext(Dp);if(e===null)throw new Error("Provide a DnDContext");return e}const _p=x.createContext(0);function Ap(){x.useContext(_p)}function ts(e,t,n){return Math.max(Math.min(e,n),t)}function zp(e){return e&&e.isLeaf}function Mp(e){return e&&e.isInternal&&!e.isOpen}function Np(e){var t;return e&&e.isOpen&&!(!((t=e.children)===null||t===void 0)&&t.length)}const Rp=(e,t)=>{let n=e;for(;n;){if(n.id===t.id)return!0;n=n.parent}return!1},Ip=e=>{if(!e.parent)throw Error("Node does not have a parent");return e.parent.children.findIndex(t=>t.id===e.id)};function kc(e,t){if(!e)return null;if(e.id===t)return e;if(e.children)for(let n of e.children){const i=kc(n,t);if(i)return i}return null}function Ls(e,t){if(t(e),e.children)for(let n of e.children)Ls(n,t)}function Up(e){const t=Hp(e);let n;for(let i=0;i<t.length;++i)if(t[i]===e){n=ux(t,i);break}n?.focus()}function Lp(e){const t=Hp(e);let n;for(let i=0;i<t.length;++i)if(t[i]===e){n=cx(t,i);break}n?.focus()}function ux(e,t){return t+1<e.length?e[t+1]:e[0]}function cx(e,t){return t-1>=0?e[t-1]:e[e.length-1]}function Hp(e){return Array.from(document.querySelectorAll('button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"]):not([disabled]), details:not([disabled]), summary:not(:disabled)')).filter(t=>t===e||!e.contains(t))}function ns(e,t){return typeof t=="boolean"?t:typeof t=="string"?e[t]:t(e)}function Bp(e){return e===null?null:qn(e)}function qn(e){return typeof e=="string"?e:e.id}function dx(e,...t){if(e)return e(...t)}function $p(e){return new Promise((t,n)=>{let i=0;function a(){i+=1,i===100&&n(),e()?t():setTimeout(a,10)}a()})}function qp(e){var t,n;const i=e.focusedNode;return i?i.isOpen?0:i.parent?i.childIndex+1:0:(n=(t=e.root.children)===null||t===void 0?void 0:t.length)!==null&&n!==void 0?n:0}function Yp(e){const t=e.focusedNode;return t?t.isOpen?t.id:t.parent&&!t.parent.isRoot?t.parent.id:null:null}const fx=Object.freeze(Object.defineProperty({__proto__:null,access:ns,bound:ts,dfs:kc,focusNextElement:Up,focusPrevElement:Lp,getInsertIndex:qp,getInsertParentId:Yp,identify:qn,identifyNull:Bp,indexOf:Ip,isClosed:Mp,isDescendant:Rp,isItem:zp,isOpenWithEmptyChildren:Np,safeRun:dx,waitFor:$p,walk:Ls},Symbol.toStringTag,{value:"Module"})),hx={display:"flex",alignItems:"center",zIndex:1},mx={flex:1,height:"2px",background:"#4B91E2",borderRadius:"1px"},gx={width:"4px",height:"4px",boxShadow:"0 0 0 3px #4B91E2",borderRadius:"50%"},px=Oh.memo(function({top:t,left:n,indent:i}){const a={position:"absolute",pointerEvents:"none",top:t-2+"px",left:n+"px",right:i+"px"};return r.jsxs("div",{style:Object.assign(Object.assign({},hx),a),children:[r.jsx("div",{style:Object.assign({},gx)}),r.jsx("div",{style:Object.assign({},mx)})]})});function vx({node:e,attrs:t,innerRef:n,children:i}){return r.jsx("div",Object.assign({},t,{ref:n,onFocus:a=>a.stopPropagation(),onClick:e.handleClick,children:i}))}function yx(e){return r.jsxs("div",{ref:e.dragHandle,style:e.style,children:[r.jsx("span",{onClick:t=>{t.stopPropagation(),e.node.toggle()},children:e.node.isLeaf?"🌳":e.node.isOpen?"🗁":"🗀"})," ",e.node.isEditing?r.jsx(xx,Object.assign({},e)):r.jsx(bx,Object.assign({},e))]})}function bx(e){return r.jsx(r.Fragment,{children:r.jsx("span",{children:e.node.data.name})})}function xx({node:e}){const t=x.useRef();return x.useEffect(()=>{var n,i;(n=t.current)===null||n===void 0||n.focus(),(i=t.current)===null||i===void 0||i.select()},[]),r.jsx("input",{ref:t,defaultValue:e.data.name,onBlur:()=>e.reset(),onKeyDown:n=>{var i;n.key==="Escape"&&e.reset(),n.key==="Enter"&&e.submit(((i=t.current)===null||i===void 0?void 0:i.value)||"")}})}function Fr(e){return{type:"EDIT",id:e}}function Sx(e={id:null},t){return t.type==="EDIT"?Object.assign(Object.assign({},e),{id:t.id}):e}function oi(e){return{type:"FOCUS",id:e}}function wx(){return{type:"TREE_BLUR"}}function jx(e={id:null,treeFocused:!1},t){return t.type==="FOCUS"?Object.assign(Object.assign({},e),{id:t.id,treeFocused:!0}):t.type==="TREE_BLUR"?Object.assign(Object.assign({},e),{treeFocused:!1}):e}class Hs{constructor(t){this.handleClick=n=>{(n.metaKey||n.ctrlKey)&&!this.tree.props.disableMultiSelection?this.isSelected?this.deselect():this.selectMulti():n.shiftKey&&!this.tree.props.disableMultiSelection?this.selectContiguous():(this.select(),this.activate())},this.tree=t.tree,this.id=t.id,this.data=t.data,this.level=t.level,this.children=t.children,this.parent=t.parent,this.isDraggable=t.isDraggable,this.rowIndex=t.rowIndex}get isRoot(){return this.id===Fa}get isLeaf(){return!Array.isArray(this.children)}get isInternal(){return!this.isLeaf}get isOpen(){return this.isLeaf?!1:this.tree.isOpen(this.id)}get isClosed(){return this.isLeaf?!1:!this.tree.isOpen(this.id)}get isEditable(){return this.tree.isEditable(this.data)}get isSelectable(){return this.tree.isSelectable(this.data)}get isEditing(){return this.tree.editingId===this.id}get isSelected(){return this.tree.isSelected(this.id)}get isOnlySelection(){return this.isSelected&&this.tree.hasOneSelection}get isSelectedStart(){var t;return this.isSelected&&!(!((t=this.prev)===null||t===void 0)&&t.isSelected)}get isSelectedEnd(){var t;return this.isSelected&&!(!((t=this.next)===null||t===void 0)&&t.isSelected)}get isFocused(){return this.tree.isFocused(this.id)}get isDragging(){return this.tree.isDragging(this.id)}get willReceiveDrop(){return this.tree.willReceiveDrop(this.id)}get state(){return{isClosed:this.isClosed,isDragging:this.isDragging,isEditing:this.isEditing,isFocused:this.isFocused,isInternal:this.isInternal,isLeaf:this.isLeaf,isOpen:this.isOpen,isSelected:this.isSelected,isSelectedEnd:this.isSelectedEnd,isSelectedStart:this.isSelectedStart,willReceiveDrop:this.willReceiveDrop}}get childIndex(){return this.parent&&this.parent.children?this.parent.children.findIndex(t=>t.id===this.id):-1}get next(){return this.rowIndex===null?null:this.tree.at(this.rowIndex+1)}get prev(){return this.rowIndex===null?null:this.tree.at(this.rowIndex-1)}get nextSibling(){var t,n;const i=this.childIndex;return(n=(t=this.parent)===null||t===void 0?void 0:t.children[i+1])!==null&&n!==void 0?n:null}isAncestorOf(t){if(!t)return!1;let n=t;for(;n;){if(n.id===this.id)return!0;n=n.parent}return!1}select(){this.tree.select(this)}deselect(){this.tree.deselect(this)}selectMulti(){this.tree.selectMulti(this)}selectContiguous(){this.tree.selectContiguous(this)}activate(){this.tree.activate(this)}focus(){this.tree.focus(this)}toggle(){this.tree.toggle(this)}open(){this.tree.open(this)}openParents(){this.tree.openParents(this)}close(){this.tree.close(this)}submit(t){this.tree.submit(this,t)}reset(){this.tree.reset()}clone(){return new Hs(Object.assign({},this))}edit(){return this.tree.edit(this)}}const Fa="__REACT_ARBORIST_INTERNAL_ROOT__";function uf(e){var t;function n(l,s,o){const u=e.accessId(l),d=new Hs({tree:e,data:l,level:s,parent:o,id:u,children:null,isDraggable:e.isDraggable(l),rowIndex:null}),g=e.accessChildren(l);return g&&(d.children=g.map(p=>n(p,s+1,d))),d}const i=new Hs({tree:e,id:Fa,data:{id:Fa},level:-1,parent:null,children:null,isDraggable:!0,rowIndex:null}),a=(t=e.props.data)!==null&&t!==void 0?t:[];return i.children=a.map(l=>n(l,0,i)),i}const hu={open(e,t){return{type:"VISIBILITY_OPEN",id:e,filtered:t}},close(e,t){return{type:"VISIBILITY_CLOSE",id:e,filtered:t}},toggle(e,t){return{type:"VISIBILITY_TOGGLE",id:e,filtered:t}},clear(e){return{type:"VISIBILITY_CLEAR",filtered:e}}};function cf(e={},t){if(t.type==="VISIBILITY_OPEN")return Object.assign(Object.assign({},e),{[t.id]:!0});if(t.type==="VISIBILITY_CLOSE")return Object.assign(Object.assign({},e),{[t.id]:!1});if(t.type==="VISIBILITY_TOGGLE"){const n=e[t.id];return Object.assign(Object.assign({},e),{[t.id]:!n})}else return t.type==="VISIBILITY_CLEAR"?{}:e}function kx(e={filtered:{},unfiltered:{}},t){return t.type.startsWith("VISIBILITY")?t.filtered?Object.assign(Object.assign({},e),{filtered:cf(e.filtered,t)}):Object.assign(Object.assign({},e),{unfiltered:cf(e.unfiltered,t)}):e}const Fi=e=>{var t;return{nodes:{open:{filtered:{},unfiltered:(t=e?.initialOpenState)!==null&&t!==void 0?t:{}},focus:{id:null,treeFocused:!1},edit:{id:null},drag:{id:null,selectedIds:[],destinationParentId:null,destinationIndex:null},selection:{ids:new Set,anchor:null,mostRecent:null}},dnd:{cursor:{type:"none"},dragId:null,dragIds:[],parentId:null,index:-1}}},an={clear:()=>({type:"SELECTION_CLEAR"}),only:e=>({type:"SELECTION_ONLY",id:qn(e)}),add:e=>({type:"SELECTION_ADD",ids:(Array.isArray(e)?e:[e]).map(qn)}),remove:e=>({type:"SELECTION_REMOVE",ids:(Array.isArray(e)?e:[e]).map(qn)}),set:e=>Object.assign({type:"SELECTION_SET"},e),mostRecent:e=>({type:"SELECTION_MOST_RECENT",id:e===null?null:qn(e)}),anchor:e=>({type:"SELECTION_ANCHOR",id:e===null?null:qn(e)})};function Tx(e=Fi().nodes.selection,t){const n=e.ids;switch(t.type){case"SELECTION_CLEAR":return Object.assign(Object.assign({},e),{ids:new Set});case"SELECTION_ONLY":return Object.assign(Object.assign({},e),{ids:new Set([t.id])});case"SELECTION_ADD":return t.ids.length===0?e:(t.ids.forEach(i=>n.add(i)),Object.assign(Object.assign({},e),{ids:new Set(n)}));case"SELECTION_REMOVE":return t.ids.length===0?e:(t.ids.forEach(i=>n.delete(i)),Object.assign(Object.assign({},e),{ids:new Set(n)}));case"SELECTION_SET":return Object.assign(Object.assign({},e),{ids:t.ids,mostRecent:t.mostRecent,anchor:t.anchor});case"SELECTION_MOST_RECENT":return Object.assign(Object.assign({},e),{mostRecent:t.id});case"SELECTION_ANCHOR":return Object.assign(Object.assign({},e),{anchor:t.id});default:return e}}const Pi={cursor(e){return{type:"DND_CURSOR",cursor:e}},dragStart(e,t){return{type:"DND_DRAG_START",id:e,dragIds:t}},dragEnd(){return{type:"DND_DRAG_END"}},hovering(e,t){return{type:"DND_HOVERING",parentId:e,index:t}}};function Ex(e=Fi().dnd,t){switch(t.type){case"DND_CURSOR":return Object.assign(Object.assign({},e),{cursor:t.cursor});case"DND_DRAG_START":return Object.assign(Object.assign({},e),{dragId:t.id,dragIds:t.dragIds});case"DND_DRAG_END":return Fi().dnd;case"DND_HOVERING":return Object.assign(Object.assign({},e),{parentId:t.parentId,index:t.index});default:return e}}const Cx={position:"fixed",pointerEvents:"none",zIndex:100,left:0,top:0,width:"100%",height:"100%"},Ox=e=>{if(!e)return{display:"none"};const{x:t,y:n}=e;return{transform:`translate(${t}px, ${n}px)`}},Dx=e=>{if(!e)return{display:"none"};const{x:t,y:n}=e;return{transform:`translate(${t+10}px, ${n+10}px)`}};function Gp({offset:e,mouse:t,id:n,dragIds:i,isDragging:a}){return r.jsxs(_x,{isDragging:a,children:[r.jsx(Ax,{offset:e,children:r.jsx(Mx,{id:n,dragIds:i})}),r.jsx(zx,{mouse:t,count:i.length})]})}const _x=x.memo(function(t){return t.isDragging?r.jsx("div",{style:Cx,children:t.children}):null});function Ax(e){return r.jsx("div",{className:"row preview",style:Ox(e.offset),children:e.children})}function zx(e){const{count:t,mouse:n}=e;return t>1?r.jsx("div",{className:"selected-count",style:Dx(n),children:t}):null}const Mx=x.memo(function(t){const n=Ke(),i=n.get(t.id);return i?r.jsx(n.renderNode,{preview:!0,node:i,style:{paddingLeft:i.level*n.indent,opacity:.2,background:"transparent"},tree:n}):null});function mu(){return mu=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)({}).hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},mu.apply(null,arguments)}function df(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function gu(e,t){return gu=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,i){return n.__proto__=i,n},gu(e,t)}function Nx(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,gu(e,t)}var ff=Number.isNaN||function(t){return typeof t=="number"&&t!==t};function Rx(e,t){return!!(e===t||ff(e)&&ff(t))}function Ix(e,t){if(e.length!==t.length)return!1;for(var n=0;n<e.length;n++)if(!Rx(e[n],t[n]))return!1;return!0}function Pr(e,t){t===void 0&&(t=Ix);var n,i=[],a,l=!1;function s(){for(var o=[],u=0;u<arguments.length;u++)o[u]=arguments[u];return l&&n===this&&t(o,i)||(a=e.apply(this,o),l=!0,n=this,i=o),a}return s}var Ux=typeof performance=="object"&&typeof performance.now=="function",hf=Ux?function(){return performance.now()}:function(){return Date.now()};function mf(e){cancelAnimationFrame(e.id)}function Lx(e,t){var n=hf();function i(){hf()-n>=t?e.call(null):a.id=requestAnimationFrame(i)}var a={id:requestAnimationFrame(i)};return a}var Wr=-1;function gf(e){if(e===void 0&&(e=!1),Wr===-1||e){var t=document.createElement("div"),n=t.style;n.width="50px",n.height="50px",n.overflow="scroll",document.body.appendChild(t),Wr=t.offsetWidth-t.clientWidth,document.body.removeChild(t)}return Wr}var ui=null;function pf(e){if(e===void 0&&(e=!1),ui===null||e){var t=document.createElement("div"),n=t.style;n.width="50px",n.height="50px",n.overflow="scroll",n.direction="rtl";var i=document.createElement("div"),a=i.style;return a.width="100px",a.height="100px",t.appendChild(i),document.body.appendChild(t),t.scrollLeft>0?ui="positive-descending":(t.scrollLeft=1,t.scrollLeft===0?ui="negative":ui="positive-ascending"),document.body.removeChild(t),ui}return ui}var Hx=150,Bx=function(t,n){return t};function Vp(e){var t,n=e.getItemOffset,i=e.getEstimatedTotalSize,a=e.getItemSize,l=e.getOffsetForIndexAndAlignment,s=e.getStartIndexForOffset,o=e.getStopIndexForStartIndex,u=e.initInstanceProps,d=e.shouldResetStyleCacheOnItemSizeChange,g=e.validateProps;return t=function(p){Nx(h,p);function h(y){var v;return v=p.call(this,y)||this,v._instanceProps=u(v.props,df(v)),v._outerRef=void 0,v._resetIsScrollingTimeoutId=null,v.state={instance:df(v),isScrolling:!1,scrollDirection:"forward",scrollOffset:typeof v.props.initialScrollOffset=="number"?v.props.initialScrollOffset:0,scrollUpdateWasRequested:!1},v._callOnItemsRendered=void 0,v._callOnItemsRendered=Pr(function(S,c,m,w){return v.props.onItemsRendered({overscanStartIndex:S,overscanStopIndex:c,visibleStartIndex:m,visibleStopIndex:w})}),v._callOnScroll=void 0,v._callOnScroll=Pr(function(S,c,m){return v.props.onScroll({scrollDirection:S,scrollOffset:c,scrollUpdateWasRequested:m})}),v._getItemStyle=void 0,v._getItemStyle=function(S){var c=v.props,m=c.direction,w=c.itemSize,b=c.layout,j=v._getItemStyleCache(d&&w,d&&b,d&&m),k;if(j.hasOwnProperty(S))k=j[S];else{var T=n(v.props,S,v._instanceProps),_=a(v.props,S,v._instanceProps),A=m==="horizontal"||b==="horizontal",I=m==="rtl",Q=A?T:0;j[S]=k={position:"absolute",left:I?void 0:Q,right:I?Q:void 0,top:A?0:T,height:A?"100%":_,width:A?_:"100%"}}return k},v._getItemStyleCache=void 0,v._getItemStyleCache=Pr(function(S,c,m){return{}}),v._onScrollHorizontal=function(S){var c=S.currentTarget,m=c.clientWidth,w=c.scrollLeft,b=c.scrollWidth;v.setState(function(j){if(j.scrollOffset===w)return null;var k=v.props.direction,T=w;if(k==="rtl")switch(pf()){case"negative":T=-w;break;case"positive-descending":T=b-m-w;break}return T=Math.max(0,Math.min(T,b-m)),{isScrolling:!0,scrollDirection:j.scrollOffset<T?"forward":"backward",scrollOffset:T,scrollUpdateWasRequested:!1}},v._resetIsScrollingDebounced)},v._onScrollVertical=function(S){var c=S.currentTarget,m=c.clientHeight,w=c.scrollHeight,b=c.scrollTop;v.setState(function(j){if(j.scrollOffset===b)return null;var k=Math.max(0,Math.min(b,w-m));return{isScrolling:!0,scrollDirection:j.scrollOffset<k?"forward":"backward",scrollOffset:k,scrollUpdateWasRequested:!1}},v._resetIsScrollingDebounced)},v._outerRefSetter=function(S){var c=v.props.outerRef;v._outerRef=S,typeof c=="function"?c(S):c!=null&&typeof c=="object"&&c.hasOwnProperty("current")&&(c.current=S)},v._resetIsScrollingDebounced=function(){v._resetIsScrollingTimeoutId!==null&&mf(v._resetIsScrollingTimeoutId),v._resetIsScrollingTimeoutId=Lx(v._resetIsScrolling,Hx)},v._resetIsScrolling=function(){v._resetIsScrollingTimeoutId=null,v.setState({isScrolling:!1},function(){v._getItemStyleCache(-1,null)})},v}h.getDerivedStateFromProps=function(v,S){return $x(v,S),g(v),null};var f=h.prototype;return f.scrollTo=function(v){v=Math.max(0,v),this.setState(function(S){return S.scrollOffset===v?null:{scrollDirection:S.scrollOffset<v?"forward":"backward",scrollOffset:v,scrollUpdateWasRequested:!0}},this._resetIsScrollingDebounced)},f.scrollToItem=function(v,S){S===void 0&&(S="auto");var c=this.props,m=c.itemCount,w=c.layout,b=this.state.scrollOffset;v=Math.max(0,Math.min(v,m-1));var j=0;if(this._outerRef){var k=this._outerRef;w==="vertical"?j=k.scrollWidth>k.clientWidth?gf():0:j=k.scrollHeight>k.clientHeight?gf():0}this.scrollTo(l(this.props,v,S,b,this._instanceProps,j))},f.componentDidMount=function(){var v=this.props,S=v.direction,c=v.initialScrollOffset,m=v.layout;if(typeof c=="number"&&this._outerRef!=null){var w=this._outerRef;S==="horizontal"||m==="horizontal"?w.scrollLeft=c:w.scrollTop=c}this._callPropsCallbacks()},f.componentDidUpdate=function(){var v=this.props,S=v.direction,c=v.layout,m=this.state,w=m.scrollOffset,b=m.scrollUpdateWasRequested;if(b&&this._outerRef!=null){var j=this._outerRef;if(S==="horizontal"||c==="horizontal")if(S==="rtl")switch(pf()){case"negative":j.scrollLeft=-w;break;case"positive-ascending":j.scrollLeft=w;break;default:var k=j.clientWidth,T=j.scrollWidth;j.scrollLeft=T-k-w;break}else j.scrollLeft=w;else j.scrollTop=w}this._callPropsCallbacks()},f.componentWillUnmount=function(){this._resetIsScrollingTimeoutId!==null&&mf(this._resetIsScrollingTimeoutId)},f.render=function(){var v=this.props,S=v.children,c=v.className,m=v.direction,w=v.height,b=v.innerRef,j=v.innerElementType,k=v.innerTagName,T=v.itemCount,_=v.itemData,A=v.itemKey,I=A===void 0?Bx:A,Q=v.layout,z=v.outerElementType,C=v.outerTagName,M=v.style,te=v.useIsScrolling,O=v.width,R=this.state.isScrolling,L=m==="horizontal"||Q==="horizontal",ie=L?this._onScrollHorizontal:this._onScrollVertical,ue=this._getRangeToRender(),en=ue[0],tn=ue[1],D=[];if(T>0)for(var N=en;N<=tn;N++)D.push(x.createElement(S,{data:_,key:I(N,_),index:N,isScrolling:te?R:void 0,style:this._getItemStyle(N)}));var V=i(this.props,this._instanceProps);return x.createElement(z||C||"div",{className:c,onScroll:ie,ref:this._outerRefSetter,style:mu({position:"relative",height:w,width:O,overflow:"auto",WebkitOverflowScrolling:"touch",willChange:"transform",direction:m},M)},x.createElement(j||k||"div",{children:D,ref:b,style:{height:L?"100%":V,pointerEvents:R?"none":void 0,width:L?V:"100%"}}))},f._callPropsCallbacks=function(){if(typeof this.props.onItemsRendered=="function"){var v=this.props.itemCount;if(v>0){var S=this._getRangeToRender(),c=S[0],m=S[1],w=S[2],b=S[3];this._callOnItemsRendered(c,m,w,b)}}if(typeof this.props.onScroll=="function"){var j=this.state,k=j.scrollDirection,T=j.scrollOffset,_=j.scrollUpdateWasRequested;this._callOnScroll(k,T,_)}},f._getRangeToRender=function(){var v=this.props,S=v.itemCount,c=v.overscanCount,m=this.state,w=m.isScrolling,b=m.scrollDirection,j=m.scrollOffset;if(S===0)return[0,0,0,0];var k=s(this.props,j,this._instanceProps),T=o(this.props,k,j,this._instanceProps),_=!w||b==="backward"?Math.max(1,c):1,A=!w||b==="forward"?Math.max(1,c):1;return[Math.max(0,k-_),Math.max(0,Math.min(S-1,T+A)),k,T]},h}(x.PureComponent),t.defaultProps={direction:"ltr",itemData:void 0,layout:"vertical",overscanCount:2,useIsScrolling:!1},t}var $x=function(t,n){t.children,t.direction,t.height,t.layout,t.innerTagName,t.outerTagName,t.width,n.instance},qx=50,_i=function(t,n,i){var a=t,l=a.itemSize,s=i.itemMetadataMap,o=i.lastMeasuredIndex;if(n>o){var u=0;if(o>=0){var d=s[o];u=d.offset+d.size}for(var g=o+1;g<=n;g++){var p=l(g);s[g]={offset:u,size:p},u+=p}i.lastMeasuredIndex=n}return s[n]},Yx=function(t,n,i){var a=n.itemMetadataMap,l=n.lastMeasuredIndex,s=l>0?a[l].offset:0;return s>=i?Kp(t,n,l,0,i):Gx(t,n,Math.max(0,l),i)},Kp=function(t,n,i,a,l){for(;a<=i;){var s=a+Math.floor((i-a)/2),o=_i(t,s,n).offset;if(o===l)return s;o<l?a=s+1:o>l&&(i=s-1)}return a>0?a-1:0},Gx=function(t,n,i,a){for(var l=t.itemCount,s=1;i<l&&_i(t,i,n).offset<a;)i+=s,s*=2;return Kp(t,n,Math.min(i,l-1),Math.floor(i/2),a)},vf=function(t,n){var i=t.itemCount,a=n.itemMetadataMap,l=n.estimatedItemSize,s=n.lastMeasuredIndex,o=0;if(s>=i&&(s=i-1),s>=0){var u=a[s];o=u.offset+u.size}var d=i-s-1,g=d*l;return o+g},Vx=Vp({getItemOffset:function(t,n,i){return _i(t,n,i).offset},getItemSize:function(t,n,i){return i.itemMetadataMap[n].size},getEstimatedTotalSize:vf,getOffsetForIndexAndAlignment:function(t,n,i,a,l,s){var o=t.direction,u=t.height,d=t.layout,g=t.width,p=o==="horizontal"||d==="horizontal",h=p?g:u,f=_i(t,n,l),y=vf(t,l),v=Math.max(0,Math.min(y-h,f.offset)),S=Math.max(0,f.offset-h+f.size+s);switch(i==="smart"&&(a>=S-h&&a<=v+h?i="auto":i="center"),i){case"start":return v;case"end":return S;case"center":return Math.round(S+(v-S)/2);case"auto":default:return a>=S&&a<=v?a:a<S?S:v}},getStartIndexForOffset:function(t,n,i){return Yx(t,i,n)},getStopIndexForStartIndex:function(t,n,i,a){for(var l=t.direction,s=t.height,o=t.itemCount,u=t.layout,d=t.width,g=l==="horizontal"||u==="horizontal",p=g?d:s,h=_i(t,n,a),f=i+p,y=h.offset+h.size,v=n;v<o-1&&y<f;)v++,y+=_i(t,v,a).size;return v},initInstanceProps:function(t,n){var i=t,a=i.estimatedItemSize,l={itemMetadataMap:{},estimatedItemSize:a||qx,lastMeasuredIndex:-1};return n.resetAfterIndex=function(s,o){o===void 0&&(o=!0),l.lastMeasuredIndex=Math.min(l.lastMeasuredIndex,s-1),n._getItemStyleCache(-1),o&&n.forceUpdate()},l},shouldResetStyleCacheOnItemSizeChange:!1,validateProps:function(t){t.itemSize}}),Kx=Vp({getItemOffset:function(t,n){var i=t.itemSize;return n*i},getItemSize:function(t,n){var i=t.itemSize;return i},getEstimatedTotalSize:function(t){var n=t.itemCount,i=t.itemSize;return i*n},getOffsetForIndexAndAlignment:function(t,n,i,a,l,s){var o=t.direction,u=t.height,d=t.itemCount,g=t.itemSize,p=t.layout,h=t.width,f=o==="horizontal"||p==="horizontal",y=f?h:u,v=Math.max(0,d*g-y),S=Math.min(v,n*g),c=Math.max(0,n*g-y+g+s);switch(i==="smart"&&(a>=c-y&&a<=S+y?i="auto":i="center"),i){case"start":return S;case"end":return c;case"center":{var m=Math.round(c+(S-c)/2);return m<Math.ceil(y/2)?0:m>v+Math.floor(y/2)?v:m}case"auto":default:return a>=c&&a<=S?a:a<c?c:S}},getStartIndexForOffset:function(t,n){var i=t.itemCount,a=t.itemSize;return Math.max(0,Math.min(i-1,Math.floor(n/a)))},getStopIndexForStartIndex:function(t,n,i){var a=t.direction,l=t.height,s=t.itemCount,o=t.itemSize,u=t.layout,d=t.width,g=a==="horizontal"||u==="horizontal",p=n*o,h=g?d:l,f=Math.ceil((h+i-p)/o);return Math.max(0,Math.min(s-1,n+f-1))},initInstanceProps:function(t){},shouldResetStyleCacheOnItemSizeChange:!0,validateProps:function(t){t.itemSize}});function Xx(){var e,t;const n=Ke(),a=ox().cursor;if(!a||a.type!=="line")return null;const l=n.indent,s=n.rowTopPosition(a.index)+((t=(e=n.props.padding)!==null&&e!==void 0?e:n.props.paddingTop)!==null&&t!==void 0?t:0),o=l*a.level,u=n.renderCursor;return r.jsx(u,{top:s,left:o,indent:l})}var Qx=function(e,t){var n={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(n[i]=e[i]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var a=0,i=Object.getOwnPropertySymbols(e);a<i.length;a++)t.indexOf(i[a])<0&&Object.prototype.propertyIsEnumerable.call(e,i[a])&&(n[i[a]]=e[i[a]]);return n};const Zx=x.forwardRef(function(t,n){const{children:i}=t,a=Qx(t,["children"]),l=Ke();return r.jsxs("div",Object.assign({ref:n},a,{onClick:s=>{s.currentTarget===s.target&&l.deselectAll()},children:[r.jsx(Jx,{}),i]}))}),Jx=()=>{const e=Ke();return r.jsx("div",{style:{height:e.rowTopPosition(e.visibleNodes.length),width:"100%",position:"absolute",left:"0",right:"0"},children:r.jsx(Xx,{})})};var Fx=function(e,t){var n={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(n[i]=e[i]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var a=0,i=Object.getOwnPropertySymbols(e);a<i.length;a++)t.indexOf(i[a])<0&&Object.prototype.propertyIsEnumerable.call(e,i[a])&&(n[i[a]]=e[i[a]]);return n};const Px=x.forwardRef(function(t,n){var i,a,l,s,{style:o}=t,u=Fx(t,["style"]);const d=Ke(),g=(a=(i=d.props.padding)!==null&&i!==void 0?i:d.props.paddingTop)!==null&&a!==void 0?a:0,p=(s=(l=d.props.padding)!==null&&l!==void 0?l:d.props.paddingBottom)!==null&&s!==void 0?s:0;return r.jsx("div",Object.assign({ref:n,style:Object.assign(Object.assign({},o),{height:`${parseFloat(o.height)+g+p}px`})},u))});var Xp=x.createContext({dragDropManager:void 0}),ct;(function(e){e.SOURCE="SOURCE",e.TARGET="TARGET"})(ct||(ct={}));function H(e,t){for(var n=arguments.length,i=new Array(n>2?n-2:0),a=2;a<n;a++)i[a-2]=arguments[a];if(!e){var l;if(t===void 0)l=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var s=0;l=new Error(t.replace(/%s/g,function(){return i[s++]})),l.name="Invariant Violation"}throw l.framesToPop=1,l}}var Tc="dnd-core/INIT_COORDS",rr="dnd-core/BEGIN_DRAG",Ec="dnd-core/PUBLISH_DRAG_SOURCE",or="dnd-core/HOVER",ur="dnd-core/DROP",cr="dnd-core/END_DRAG";function yf(e,t){return{type:Tc,payload:{sourceClientOffset:t||null,clientOffset:e||null}}}function is(e){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?is=function(n){return typeof n}:is=function(n){return n&&typeof Symbol=="function"&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n},is(e)}function Wx(e,t,n){return t.split(".").reduce(function(i,a){return i&&i[a]?i[a]:n||null},e)}function eS(e,t){return e.filter(function(n){return n!==t})}function Qp(e){return is(e)==="object"}function tS(e,t){var n=new Map,i=function(s){n.set(s,n.has(s)?n.get(s)+1:1)};e.forEach(i),t.forEach(i);var a=[];return n.forEach(function(l,s){l===1&&a.push(s)}),a}function nS(e,t){return e.filter(function(n){return t.indexOf(n)>-1})}var iS={type:Tc,payload:{clientOffset:null,sourceClientOffset:null}};function aS(e){return function(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{publishSource:!0},a=i.publishSource,l=a===void 0?!0:a,s=i.clientOffset,o=i.getSourceClientOffset,u=e.getMonitor(),d=e.getRegistry();e.dispatch(yf(s)),lS(n,u,d);var g=oS(n,u);if(g===null){e.dispatch(iS);return}var p=null;if(s){if(!o)throw new Error("getSourceClientOffset must be defined");sS(o),p=o(g)}e.dispatch(yf(s,p));var h=d.getSource(g),f=h.beginDrag(u,g);if(f!=null){rS(f),d.pinSource(g);var y=d.getSourceType(g);return{type:rr,payload:{itemType:y,item:f,sourceId:g,clientOffset:s||null,sourceClientOffset:p||null,isSourcePublic:!!l}}}}}function lS(e,t,n){H(!t.isDragging(),"Cannot call beginDrag while dragging."),e.forEach(function(i){H(n.getSource(i),"Expected sourceIds to be registered.")})}function sS(e){H(typeof e=="function","When clientOffset is provided, getSourceClientOffset must be a function.")}function rS(e){H(Qp(e),"Item must be an object.")}function oS(e,t){for(var n=null,i=e.length-1;i>=0;i--)if(t.canDragSource(e[i])){n=e[i];break}return n}function uS(e){return function(){var n=e.getMonitor();if(n.isDragging())return{type:Ec}}}function pu(e,t){return t===null?e===null:Array.isArray(e)?e.some(function(n){return n===t}):e===t}function cS(e){return function(n){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},a=i.clientOffset;dS(n);var l=n.slice(0),s=e.getMonitor(),o=e.getRegistry();fS(l,s,o);var u=s.getItemType();return hS(l,o,u),mS(l,s,o),{type:or,payload:{targetIds:l,clientOffset:a||null}}}}function dS(e){H(Array.isArray(e),"Expected targetIds to be an array.")}function fS(e,t,n){H(t.isDragging(),"Cannot call hover while not dragging."),H(!t.didDrop(),"Cannot call hover after drop.");for(var i=0;i<e.length;i++){var a=e[i];H(e.lastIndexOf(a)===i,"Expected targetIds to be unique in the passed array.");var l=n.getTarget(a);H(l,"Expected targetIds to be registered.")}}function hS(e,t,n){for(var i=e.length-1;i>=0;i--){var a=e[i],l=t.getTargetType(a);pu(l,n)||e.splice(i,1)}}function mS(e,t,n){e.forEach(function(i){var a=n.getTarget(i);a.hover(t,i)})}function bf(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,i)}return n}function xf(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?bf(Object(n),!0).forEach(function(i){gS(e,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):bf(Object(n)).forEach(function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(n,i))})}return e}function gS(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function pS(e){return function(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},i=e.getMonitor(),a=e.getRegistry();vS(i);var l=xS(i);l.forEach(function(s,o){var u=yS(s,o,a,i),d={type:ur,payload:{dropResult:xf(xf({},n),u)}};e.dispatch(d)})}}function vS(e){H(e.isDragging(),"Cannot call drop while not dragging."),H(!e.didDrop(),"Cannot call drop twice during one drag operation.")}function yS(e,t,n,i){var a=n.getTarget(e),l=a?a.drop(i,e):void 0;return bS(l),typeof l>"u"&&(l=t===0?{}:i.getDropResult()),l}function bS(e){H(typeof e>"u"||Qp(e),"Drop result must either be an object or undefined.")}function xS(e){var t=e.getTargetIds().filter(e.canDropOnTarget,e);return t.reverse(),t}function SS(e){return function(){var n=e.getMonitor(),i=e.getRegistry();wS(n);var a=n.getSourceId();if(a!=null){var l=i.getSource(a,!0);l.endDrag(n,a),i.unpinSource()}return{type:cr}}}function wS(e){H(e.isDragging(),"Cannot call endDrag while not dragging.")}function jS(e){return{beginDrag:aS(e),publishDragSource:uS(e),hover:cS(e),drop:pS(e),endDrag:SS(e)}}function kS(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function TS(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}function ES(e,t,n){return t&&TS(e.prototype,t),e}function ma(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var CS=function(){function e(t,n){var i=this;kS(this,e),ma(this,"store",void 0),ma(this,"monitor",void 0),ma(this,"backend",void 0),ma(this,"isSetUp",!1),ma(this,"handleRefCountChange",function(){var a=i.store.getState().refCount>0;i.backend&&(a&&!i.isSetUp?(i.backend.setup(),i.isSetUp=!0):!a&&i.isSetUp&&(i.backend.teardown(),i.isSetUp=!1))}),this.store=t,this.monitor=n,t.subscribe(this.handleRefCountChange)}return ES(e,[{key:"receiveBackend",value:function(n){this.backend=n}},{key:"getMonitor",value:function(){return this.monitor}},{key:"getBackend",value:function(){return this.backend}},{key:"getRegistry",value:function(){return this.monitor.registry}},{key:"getActions",value:function(){var n=this,i=this.store.dispatch;function a(s){return function(){for(var o=arguments.length,u=new Array(o),d=0;d<o;d++)u[d]=arguments[d];var g=s.apply(n,u);typeof g<"u"&&i(g)}}var l=jS(this);return Object.keys(l).reduce(function(s,o){var u=l[o];return s[o]=a(u),s},{})}},{key:"dispatch",value:function(n){this.store.dispatch(n)}}]),e}();function at(e){return"Minified Redux error #"+e+"; visit https://redux.js.org/Errors?code="+e+" for the full message or use the non-minified dev environment for full errors. "}var Sf=function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"}(),wf=function(){return Math.random().toString(36).substring(7).split("").join(".")},jf={INIT:"@@redux/INIT"+wf(),REPLACE:"@@redux/REPLACE"+wf()};function OS(e){if(typeof e!="object"||e===null)return!1;for(var t=e;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}function Zp(e,t,n){var i;if(typeof t=="function"&&typeof n=="function"||typeof n=="function"&&typeof arguments[3]=="function")throw new Error(at(0));if(typeof t=="function"&&typeof n>"u"&&(n=t,t=void 0),typeof n<"u"){if(typeof n!="function")throw new Error(at(1));return n(Zp)(e,t)}if(typeof e!="function")throw new Error(at(2));var a=e,l=t,s=[],o=s,u=!1;function d(){o===s&&(o=s.slice())}function g(){if(u)throw new Error(at(3));return l}function p(v){if(typeof v!="function")throw new Error(at(4));if(u)throw new Error(at(5));var S=!0;return d(),o.push(v),function(){if(S){if(u)throw new Error(at(6));S=!1,d();var m=o.indexOf(v);o.splice(m,1),s=null}}}function h(v){if(!OS(v))throw new Error(at(7));if(typeof v.type>"u")throw new Error(at(8));if(u)throw new Error(at(9));try{u=!0,l=a(l,v)}finally{u=!1}for(var S=s=o,c=0;c<S.length;c++){var m=S[c];m()}return v}function f(v){if(typeof v!="function")throw new Error(at(10));a=v,h({type:jf.REPLACE})}function y(){var v,S=p;return v={subscribe:function(m){if(typeof m!="object"||m===null)throw new Error(at(11));function w(){m.next&&m.next(g())}w();var b=S(w);return{unsubscribe:b}}},v[Sf]=function(){return this},v}return h({type:jf.INIT}),i={dispatch:h,subscribe:p,getState:g,replaceReducer:f},i[Sf]=y,i}var DS=function(t,n){return t===n};function _S(e,t){return!e&&!t?!0:!e||!t?!1:e.x===t.x&&e.y===t.y}function AS(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:DS;if(e.length!==t.length)return!1;for(var i=0;i<e.length;++i)if(!n(e[i],t[i]))return!1;return!0}function kf(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,i)}return n}function Tf(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?kf(Object(n),!0).forEach(function(i){zS(e,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):kf(Object(n)).forEach(function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(n,i))})}return e}function zS(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Ef={initialSourceClientOffset:null,initialClientOffset:null,clientOffset:null};function MS(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Ef,t=arguments.length>1?arguments[1]:void 0,n=t.payload;switch(t.type){case Tc:case rr:return{initialSourceClientOffset:n.sourceClientOffset,initialClientOffset:n.clientOffset,clientOffset:n.clientOffset};case or:return _S(e.clientOffset,n.clientOffset)?e:Tf(Tf({},e),{},{clientOffset:n.clientOffset});case cr:case ur:return Ef;default:return e}}var Cc="dnd-core/ADD_SOURCE",Oc="dnd-core/ADD_TARGET",Dc="dnd-core/REMOVE_SOURCE",dr="dnd-core/REMOVE_TARGET";function NS(e){return{type:Cc,payload:{sourceId:e}}}function RS(e){return{type:Oc,payload:{targetId:e}}}function IS(e){return{type:Dc,payload:{sourceId:e}}}function US(e){return{type:dr,payload:{targetId:e}}}function Cf(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,i)}return n}function lt(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Cf(Object(n),!0).forEach(function(i){LS(e,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Cf(Object(n)).forEach(function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(n,i))})}return e}function LS(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var HS={itemType:null,item:null,sourceId:null,targetIds:[],dropResult:null,didDrop:!1,isSourcePublic:null};function BS(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:HS,t=arguments.length>1?arguments[1]:void 0,n=t.payload;switch(t.type){case rr:return lt(lt({},e),{},{itemType:n.itemType,item:n.item,sourceId:n.sourceId,isSourcePublic:n.isSourcePublic,dropResult:null,didDrop:!1});case Ec:return lt(lt({},e),{},{isSourcePublic:!0});case or:return lt(lt({},e),{},{targetIds:n.targetIds});case dr:return e.targetIds.indexOf(n.targetId)===-1?e:lt(lt({},e),{},{targetIds:eS(e.targetIds,n.targetId)});case ur:return lt(lt({},e),{},{dropResult:n.dropResult,didDrop:!0,targetIds:[]});case cr:return lt(lt({},e),{},{itemType:null,item:null,sourceId:null,dropResult:null,didDrop:!1,isSourcePublic:null,targetIds:[]});default:return e}}function $S(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0,t=arguments.length>1?arguments[1]:void 0;switch(t.type){case Cc:case Oc:return e+1;case Dc:case dr:return e-1;default:return e}}var Bs=[],_c=[];Bs.__IS_NONE__=!0;_c.__IS_ALL__=!0;function qS(e,t){if(e===Bs)return!1;if(e===_c||typeof t>"u")return!0;var n=nS(t,e);return n.length>0}function YS(){var e=arguments.length>1?arguments[1]:void 0;switch(e.type){case or:break;case Cc:case Oc:case dr:case Dc:return Bs;case rr:case Ec:case cr:case ur:default:return _c}var t=e.payload,n=t.targetIds,i=n===void 0?[]:n,a=t.prevTargetIds,l=a===void 0?[]:a,s=tS(i,l),o=s.length>0||!AS(i,l);if(!o)return Bs;var u=l[l.length-1],d=i[i.length-1];return u!==d&&(u&&s.push(u),d&&s.push(d)),s}function GS(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0;return e+1}function Of(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,i)}return n}function Df(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Of(Object(n),!0).forEach(function(i){VS(e,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Of(Object(n)).forEach(function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(n,i))})}return e}function VS(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function KS(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0;return{dirtyHandlerIds:YS(e.dirtyHandlerIds,{type:t.type,payload:Df(Df({},t.payload),{},{prevTargetIds:Wx(e,"dragOperation.targetIds",[])})}),dragOffset:MS(e.dragOffset,t),refCount:$S(e.refCount,t),dragOperation:BS(e.dragOperation,t),stateId:GS(e.stateId)}}function XS(e,t){return{x:e.x+t.x,y:e.y+t.y}}function Jp(e,t){return{x:e.x-t.x,y:e.y-t.y}}function QS(e){var t=e.clientOffset,n=e.initialClientOffset,i=e.initialSourceClientOffset;return!t||!n||!i?null:Jp(XS(t,i),n)}function ZS(e){var t=e.clientOffset,n=e.initialClientOffset;return!t||!n?null:Jp(t,n)}function JS(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function FS(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}function PS(e,t,n){return t&&FS(e.prototype,t),e}function _f(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var WS=function(){function e(t,n){JS(this,e),_f(this,"store",void 0),_f(this,"registry",void 0),this.store=t,this.registry=n}return PS(e,[{key:"subscribeToStateChange",value:function(n){var i=this,a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{handlerIds:void 0},l=a.handlerIds;H(typeof n=="function","listener must be a function."),H(typeof l>"u"||Array.isArray(l),"handlerIds, when specified, must be an array of strings.");var s=this.store.getState().stateId,o=function(){var d=i.store.getState(),g=d.stateId;try{var p=g===s||g===s+1&&!qS(d.dirtyHandlerIds,l);p||n()}finally{s=g}};return this.store.subscribe(o)}},{key:"subscribeToOffsetChange",value:function(n){var i=this;H(typeof n=="function","listener must be a function.");var a=this.store.getState().dragOffset,l=function(){var o=i.store.getState().dragOffset;o!==a&&(a=o,n())};return this.store.subscribe(l)}},{key:"canDragSource",value:function(n){if(!n)return!1;var i=this.registry.getSource(n);return H(i,"Expected to find a valid source. sourceId=".concat(n)),this.isDragging()?!1:i.canDrag(this,n)}},{key:"canDropOnTarget",value:function(n){if(!n)return!1;var i=this.registry.getTarget(n);if(H(i,"Expected to find a valid target. targetId=".concat(n)),!this.isDragging()||this.didDrop())return!1;var a=this.registry.getTargetType(n),l=this.getItemType();return pu(a,l)&&i.canDrop(this,n)}},{key:"isDragging",value:function(){return!!this.getItemType()}},{key:"isDraggingSource",value:function(n){if(!n)return!1;var i=this.registry.getSource(n,!0);if(H(i,"Expected to find a valid source. sourceId=".concat(n)),!this.isDragging()||!this.isSourcePublic())return!1;var a=this.registry.getSourceType(n),l=this.getItemType();return a!==l?!1:i.isDragging(this,n)}},{key:"isOverTarget",value:function(n){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{shallow:!1};if(!n)return!1;var a=i.shallow;if(!this.isDragging())return!1;var l=this.registry.getTargetType(n),s=this.getItemType();if(s&&!pu(l,s))return!1;var o=this.getTargetIds();if(!o.length)return!1;var u=o.indexOf(n);return a?u===o.length-1:u>-1}},{key:"getItemType",value:function(){return this.store.getState().dragOperation.itemType}},{key:"getItem",value:function(){return this.store.getState().dragOperation.item}},{key:"getSourceId",value:function(){return this.store.getState().dragOperation.sourceId}},{key:"getTargetIds",value:function(){return this.store.getState().dragOperation.targetIds}},{key:"getDropResult",value:function(){return this.store.getState().dragOperation.dropResult}},{key:"didDrop",value:function(){return this.store.getState().dragOperation.didDrop}},{key:"isSourcePublic",value:function(){return!!this.store.getState().dragOperation.isSourcePublic}},{key:"getInitialClientOffset",value:function(){return this.store.getState().dragOffset.initialClientOffset}},{key:"getInitialSourceClientOffset",value:function(){return this.store.getState().dragOffset.initialSourceClientOffset}},{key:"getClientOffset",value:function(){return this.store.getState().dragOffset.clientOffset}},{key:"getSourceClientOffset",value:function(){return QS(this.store.getState().dragOffset)}},{key:"getDifferenceFromInitialOffset",value:function(){return ZS(this.store.getState().dragOffset)}}]),e}(),ew=0;function tw(){return ew++}function as(e){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?as=function(n){return typeof n}:as=function(n){return n&&typeof Symbol=="function"&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n},as(e)}function nw(e){H(typeof e.canDrag=="function","Expected canDrag to be a function."),H(typeof e.beginDrag=="function","Expected beginDrag to be a function."),H(typeof e.endDrag=="function","Expected endDrag to be a function.")}function iw(e){H(typeof e.canDrop=="function","Expected canDrop to be a function."),H(typeof e.hover=="function","Expected hover to be a function."),H(typeof e.drop=="function","Expected beginDrag to be a function.")}function vu(e,t){if(t&&Array.isArray(e)){e.forEach(function(n){return vu(n,!1)});return}H(typeof e=="string"||as(e)==="symbol",t?"Type can only be a string, a symbol, or an array of either.":"Type can only be a string or a symbol.")}const Af=typeof global<"u"?global:self,Fp=Af.MutationObserver||Af.WebKitMutationObserver;function Pp(e){return function(){const n=setTimeout(a,0),i=setInterval(a,50);function a(){clearTimeout(n),clearInterval(i),e()}}}function aw(e){let t=1;const n=new Fp(e),i=document.createTextNode("");return n.observe(i,{characterData:!0}),function(){t=-t,i.data=t}}const lw=typeof Fp=="function"?aw:Pp;class sw{enqueueTask(t){const{queue:n,requestFlush:i}=this;n.length||(i(),this.flushing=!0),n[n.length]=t}constructor(){this.queue=[],this.pendingErrors=[],this.flushing=!1,this.index=0,this.capacity=1024,this.flush=()=>{const{queue:t}=this;for(;this.index<t.length;){const n=this.index;if(this.index++,t[n].call(),this.index>this.capacity){for(let i=0,a=t.length-this.index;i<a;i++)t[i]=t[i+this.index];t.length-=this.index,this.index=0}}t.length=0,this.index=0,this.flushing=!1},this.registerPendingError=t=>{this.pendingErrors.push(t),this.requestErrorThrow()},this.requestFlush=lw(this.flush),this.requestErrorThrow=Pp(()=>{if(this.pendingErrors.length)throw this.pendingErrors.shift()})}}class rw{call(){try{this.task&&this.task()}catch(t){this.onError(t)}finally{this.task=null,this.release(this)}}constructor(t,n){this.onError=t,this.release=n,this.task=null}}class ow{create(t){const n=this.freeTasks,i=n.length?n.pop():new rw(this.onError,a=>n[n.length]=a);return i.task=t,i}constructor(t){this.onError=t,this.freeTasks=[]}}const Wp=new sw,uw=new ow(Wp.registerPendingError);function cw(e){Wp.enqueueTask(uw.create(e))}function dw(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function fw(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}function hw(e,t,n){return t&&fw(e.prototype,t),e}function ci(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function mw(e,t){return yw(e)||vw(e,t)||pw(e,t)||gw()}function gw(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function pw(e,t){if(e){if(typeof e=="string")return zf(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return zf(e,t)}}function zf(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,i=new Array(t);n<t;n++)i[n]=e[n];return i}function vw(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var i=[],a=!0,l=!1,s,o;try{for(n=n.call(e);!(a=(s=n.next()).done)&&(i.push(s.value),!(t&&i.length===t));a=!0);}catch(u){l=!0,o=u}finally{try{!a&&n.return!=null&&n.return()}finally{if(l)throw o}}return i}}function yw(e){if(Array.isArray(e))return e}function bw(e){var t=tw().toString();switch(e){case ct.SOURCE:return"S".concat(t);case ct.TARGET:return"T".concat(t);default:throw new Error("Unknown Handler Role: ".concat(e))}}function Mf(e){switch(e[0]){case"S":return ct.SOURCE;case"T":return ct.TARGET;default:H(!1,"Cannot parse handler ID: ".concat(e))}}function Nf(e,t){var n=e.entries(),i=!1;do{var a=n.next(),l=a.done,s=mw(a.value,2),o=s[1];if(o===t)return!0;i=!!l}while(!i);return!1}var xw=function(){function e(t){dw(this,e),ci(this,"types",new Map),ci(this,"dragSources",new Map),ci(this,"dropTargets",new Map),ci(this,"pinnedSourceId",null),ci(this,"pinnedSource",null),ci(this,"store",void 0),this.store=t}return hw(e,[{key:"addSource",value:function(n,i){vu(n),nw(i);var a=this.addHandler(ct.SOURCE,n,i);return this.store.dispatch(NS(a)),a}},{key:"addTarget",value:function(n,i){vu(n,!0),iw(i);var a=this.addHandler(ct.TARGET,n,i);return this.store.dispatch(RS(a)),a}},{key:"containsHandler",value:function(n){return Nf(this.dragSources,n)||Nf(this.dropTargets,n)}},{key:"getSource",value:function(n){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;H(this.isSourceId(n),"Expected a valid source ID.");var a=i&&n===this.pinnedSourceId,l=a?this.pinnedSource:this.dragSources.get(n);return l}},{key:"getTarget",value:function(n){return H(this.isTargetId(n),"Expected a valid target ID."),this.dropTargets.get(n)}},{key:"getSourceType",value:function(n){return H(this.isSourceId(n),"Expected a valid source ID."),this.types.get(n)}},{key:"getTargetType",value:function(n){return H(this.isTargetId(n),"Expected a valid target ID."),this.types.get(n)}},{key:"isSourceId",value:function(n){var i=Mf(n);return i===ct.SOURCE}},{key:"isTargetId",value:function(n){var i=Mf(n);return i===ct.TARGET}},{key:"removeSource",value:function(n){var i=this;H(this.getSource(n),"Expected an existing source."),this.store.dispatch(IS(n)),cw(function(){i.dragSources.delete(n),i.types.delete(n)})}},{key:"removeTarget",value:function(n){H(this.getTarget(n),"Expected an existing target."),this.store.dispatch(US(n)),this.dropTargets.delete(n),this.types.delete(n)}},{key:"pinSource",value:function(n){var i=this.getSource(n);H(i,"Expected an existing source."),this.pinnedSourceId=n,this.pinnedSource=i}},{key:"unpinSource",value:function(){H(this.pinnedSource,"No source is pinned at the time."),this.pinnedSourceId=null,this.pinnedSource=null}},{key:"addHandler",value:function(n,i,a){var l=bw(n);return this.types.set(l,i),n===ct.SOURCE?this.dragSources.set(l,a):n===ct.TARGET&&this.dropTargets.set(l,a),l}}]),e}();function Sw(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:void 0,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1,a=ww(i),l=new WS(a,new xw(a)),s=new CS(a,l),o=e(s,t,n);return s.receiveBackend(o),s}function ww(e){var t=typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION__;return Zp(KS,e&&t&&t({name:"dnd-core",instanceId:"dnd-core"}))}var jw=["children"];function kw(e,t){return Ow(e)||Cw(e,t)||Ew(e,t)||Tw()}function Tw(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Ew(e,t){if(e){if(typeof e=="string")return Rf(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Rf(e,t)}}function Rf(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,i=new Array(t);n<t;n++)i[n]=e[n];return i}function Cw(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var i=[],a=!0,l=!1,s,o;try{for(n=n.call(e);!(a=(s=n.next()).done)&&(i.push(s.value),!(t&&i.length===t));a=!0);}catch(u){l=!0,o=u}finally{try{!a&&n.return!=null&&n.return()}finally{if(l)throw o}}return i}}function Ow(e){if(Array.isArray(e))return e}function Dw(e,t){if(e==null)return{};var n=_w(e,t),i,a;if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(a=0;a<l.length;a++)i=l[a],!(t.indexOf(i)>=0)&&Object.prototype.propertyIsEnumerable.call(e,i)&&(n[i]=e[i])}return n}function _w(e,t){if(e==null)return{};var n={},i=Object.keys(e),a,l;for(l=0;l<i.length;l++)a=i[l],!(t.indexOf(a)>=0)&&(n[a]=e[a]);return n}var If=0,ls=Symbol.for("__REACT_DND_CONTEXT_INSTANCE__"),Aw=x.memo(function(t){var n=t.children,i=Dw(t,jw),a=zw(i),l=kw(a,2),s=l[0],o=l[1];return x.useEffect(function(){if(o){var u=ev();return++If,function(){--If===0&&(u[ls]=null)}}},[]),r.jsx(Xp.Provider,Object.assign({value:s},{children:n}),void 0)});function zw(e){if("manager"in e){var t={dragDropManager:e.manager};return[t,!1]}var n=Mw(e.backend,e.context,e.options,e.debugMode),i=!e.context;return[n,i]}function Mw(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:ev(),n=arguments.length>2?arguments[2]:void 0,i=arguments.length>3?arguments[3]:void 0,a=t;return a[ls]||(a[ls]={dragDropManager:Sw(e,t,n,i)}),a[ls]}function ev(){return typeof global<"u"?global:window}function Nw(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Rw(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}function Iw(e,t,n){return t&&Rw(e.prototype,t),e}function Uf(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var eo=!1,to=!1,Uw=function(){function e(t){Nw(this,e),Uf(this,"internalMonitor",void 0),Uf(this,"sourceId",null),this.internalMonitor=t.getMonitor()}return Iw(e,[{key:"receiveHandlerId",value:function(n){this.sourceId=n}},{key:"getHandlerId",value:function(){return this.sourceId}},{key:"canDrag",value:function(){H(!eo,"You may not call monitor.canDrag() inside your canDrag() implementation. Read more: http://react-dnd.github.io/react-dnd/docs/api/drag-source-monitor");try{return eo=!0,this.internalMonitor.canDragSource(this.sourceId)}finally{eo=!1}}},{key:"isDragging",value:function(){if(!this.sourceId)return!1;H(!to,"You may not call monitor.isDragging() inside your isDragging() implementation. Read more: http://react-dnd.github.io/react-dnd/docs/api/drag-source-monitor");try{return to=!0,this.internalMonitor.isDraggingSource(this.sourceId)}finally{to=!1}}},{key:"subscribeToStateChange",value:function(n,i){return this.internalMonitor.subscribeToStateChange(n,i)}},{key:"isDraggingSource",value:function(n){return this.internalMonitor.isDraggingSource(n)}},{key:"isOverTarget",value:function(n,i){return this.internalMonitor.isOverTarget(n,i)}},{key:"getTargetIds",value:function(){return this.internalMonitor.getTargetIds()}},{key:"isSourcePublic",value:function(){return this.internalMonitor.isSourcePublic()}},{key:"getSourceId",value:function(){return this.internalMonitor.getSourceId()}},{key:"subscribeToOffsetChange",value:function(n){return this.internalMonitor.subscribeToOffsetChange(n)}},{key:"canDragSource",value:function(n){return this.internalMonitor.canDragSource(n)}},{key:"canDropOnTarget",value:function(n){return this.internalMonitor.canDropOnTarget(n)}},{key:"getItemType",value:function(){return this.internalMonitor.getItemType()}},{key:"getItem",value:function(){return this.internalMonitor.getItem()}},{key:"getDropResult",value:function(){return this.internalMonitor.getDropResult()}},{key:"didDrop",value:function(){return this.internalMonitor.didDrop()}},{key:"getInitialClientOffset",value:function(){return this.internalMonitor.getInitialClientOffset()}},{key:"getInitialSourceClientOffset",value:function(){return this.internalMonitor.getInitialSourceClientOffset()}},{key:"getSourceClientOffset",value:function(){return this.internalMonitor.getSourceClientOffset()}},{key:"getClientOffset",value:function(){return this.internalMonitor.getClientOffset()}},{key:"getDifferenceFromInitialOffset",value:function(){return this.internalMonitor.getDifferenceFromInitialOffset()}}]),e}();function Lw(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Hw(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}function Bw(e,t,n){return t&&Hw(e.prototype,t),e}function Lf(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var no=!1,$w=function(){function e(t){Lw(this,e),Lf(this,"internalMonitor",void 0),Lf(this,"targetId",null),this.internalMonitor=t.getMonitor()}return Bw(e,[{key:"receiveHandlerId",value:function(n){this.targetId=n}},{key:"getHandlerId",value:function(){return this.targetId}},{key:"subscribeToStateChange",value:function(n,i){return this.internalMonitor.subscribeToStateChange(n,i)}},{key:"canDrop",value:function(){if(!this.targetId)return!1;H(!no,"You may not call monitor.canDrop() inside your canDrop() implementation. Read more: http://react-dnd.github.io/react-dnd/docs/api/drop-target-monitor");try{return no=!0,this.internalMonitor.canDropOnTarget(this.targetId)}finally{no=!1}}},{key:"isOver",value:function(n){return this.targetId?this.internalMonitor.isOverTarget(this.targetId,n):!1}},{key:"getItemType",value:function(){return this.internalMonitor.getItemType()}},{key:"getItem",value:function(){return this.internalMonitor.getItem()}},{key:"getDropResult",value:function(){return this.internalMonitor.getDropResult()}},{key:"didDrop",value:function(){return this.internalMonitor.didDrop()}},{key:"getInitialClientOffset",value:function(){return this.internalMonitor.getInitialClientOffset()}},{key:"getInitialSourceClientOffset",value:function(){return this.internalMonitor.getInitialSourceClientOffset()}},{key:"getSourceClientOffset",value:function(){return this.internalMonitor.getSourceClientOffset()}},{key:"getClientOffset",value:function(){return this.internalMonitor.getClientOffset()}},{key:"getDifferenceFromInitialOffset",value:function(){return this.internalMonitor.getDifferenceFromInitialOffset()}}]),e}();function qw(e){if(typeof e.type!="string"){var t=e.type.displayName||e.type.name||"the component";throw new Error("Only native element nodes can now be passed to React DnD connectors."+"You can either wrap ".concat(t," into a <div>, or turn it into a ")+"drag source or a drop target itself.")}}function Yw(e){return function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:null,n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null;if(!x.isValidElement(t)){var i=t;return e(i,n),i}var a=t;qw(a);var l=n?function(s){return e(s,n)}:e;return Gw(a,l)}}function tv(e){var t={};return Object.keys(e).forEach(function(n){var i=e[n];if(n.endsWith("Ref"))t[n]=e[n];else{var a=Yw(i);t[n]=function(){return a}}}),t}function Hf(e,t){typeof e=="function"?e(t):e.current=t}function Gw(e,t){var n=e.ref;return H(typeof n!="string","Cannot connect React DnD to an element with an existing string ref. Please convert it to use a callback ref instead, or wrap it into a <span> or <div>. Read more: https://reactjs.org/docs/refs-and-the-dom.html#callback-refs"),n?x.cloneElement(e,{ref:function(a){Hf(n,a),Hf(t,a)}}):x.cloneElement(e,{ref:t})}function ss(e){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?ss=function(n){return typeof n}:ss=function(n){return n&&typeof Symbol=="function"&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n},ss(e)}function yu(e){return e!==null&&ss(e)==="object"&&Object.prototype.hasOwnProperty.call(e,"current")}function bu(e,t,n,i){var a=void 0;if(a!==void 0)return!!a;if(e===t)return!0;if(typeof e!="object"||!e||typeof t!="object"||!t)return!1;var l=Object.keys(e),s=Object.keys(t);if(l.length!==s.length)return!1;for(var o=Object.prototype.hasOwnProperty.bind(t),u=0;u<l.length;u++){var d=l[u];if(!o(d))return!1;var g=e[d],p=t[d];if(a=void 0,a===!1||a===void 0&&g!==p)return!1}return!0}function Vw(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Kw(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}function Xw(e,t,n){return t&&Kw(e.prototype,t),e}function ze(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Qw=function(){function e(t){var n=this;Vw(this,e),ze(this,"hooks",tv({dragSource:function(a,l){n.clearDragSource(),n.dragSourceOptions=l||null,yu(a)?n.dragSourceRef=a:n.dragSourceNode=a,n.reconnectDragSource()},dragPreview:function(a,l){n.clearDragPreview(),n.dragPreviewOptions=l||null,yu(a)?n.dragPreviewRef=a:n.dragPreviewNode=a,n.reconnectDragPreview()}})),ze(this,"handlerId",null),ze(this,"dragSourceRef",null),ze(this,"dragSourceNode",void 0),ze(this,"dragSourceOptionsInternal",null),ze(this,"dragSourceUnsubscribe",void 0),ze(this,"dragPreviewRef",null),ze(this,"dragPreviewNode",void 0),ze(this,"dragPreviewOptionsInternal",null),ze(this,"dragPreviewUnsubscribe",void 0),ze(this,"lastConnectedHandlerId",null),ze(this,"lastConnectedDragSource",null),ze(this,"lastConnectedDragSourceOptions",null),ze(this,"lastConnectedDragPreview",null),ze(this,"lastConnectedDragPreviewOptions",null),ze(this,"backend",void 0),this.backend=t}return Xw(e,[{key:"receiveHandlerId",value:function(n){this.handlerId!==n&&(this.handlerId=n,this.reconnect())}},{key:"connectTarget",get:function(){return this.dragSource}},{key:"dragSourceOptions",get:function(){return this.dragSourceOptionsInternal},set:function(n){this.dragSourceOptionsInternal=n}},{key:"dragPreviewOptions",get:function(){return this.dragPreviewOptionsInternal},set:function(n){this.dragPreviewOptionsInternal=n}},{key:"reconnect",value:function(){this.reconnectDragSource(),this.reconnectDragPreview()}},{key:"reconnectDragSource",value:function(){var n=this.dragSource,i=this.didHandlerIdChange()||this.didConnectedDragSourceChange()||this.didDragSourceOptionsChange();if(i&&this.disconnectDragSource(),!!this.handlerId){if(!n){this.lastConnectedDragSource=n;return}i&&(this.lastConnectedHandlerId=this.handlerId,this.lastConnectedDragSource=n,this.lastConnectedDragSourceOptions=this.dragSourceOptions,this.dragSourceUnsubscribe=this.backend.connectDragSource(this.handlerId,n,this.dragSourceOptions))}}},{key:"reconnectDragPreview",value:function(){var n=this.dragPreview,i=this.didHandlerIdChange()||this.didConnectedDragPreviewChange()||this.didDragPreviewOptionsChange();if(i&&this.disconnectDragPreview(),!!this.handlerId){if(!n){this.lastConnectedDragPreview=n;return}i&&(this.lastConnectedHandlerId=this.handlerId,this.lastConnectedDragPreview=n,this.lastConnectedDragPreviewOptions=this.dragPreviewOptions,this.dragPreviewUnsubscribe=this.backend.connectDragPreview(this.handlerId,n,this.dragPreviewOptions))}}},{key:"didHandlerIdChange",value:function(){return this.lastConnectedHandlerId!==this.handlerId}},{key:"didConnectedDragSourceChange",value:function(){return this.lastConnectedDragSource!==this.dragSource}},{key:"didConnectedDragPreviewChange",value:function(){return this.lastConnectedDragPreview!==this.dragPreview}},{key:"didDragSourceOptionsChange",value:function(){return!bu(this.lastConnectedDragSourceOptions,this.dragSourceOptions)}},{key:"didDragPreviewOptionsChange",value:function(){return!bu(this.lastConnectedDragPreviewOptions,this.dragPreviewOptions)}},{key:"disconnectDragSource",value:function(){this.dragSourceUnsubscribe&&(this.dragSourceUnsubscribe(),this.dragSourceUnsubscribe=void 0)}},{key:"disconnectDragPreview",value:function(){this.dragPreviewUnsubscribe&&(this.dragPreviewUnsubscribe(),this.dragPreviewUnsubscribe=void 0,this.dragPreviewNode=null,this.dragPreviewRef=null)}},{key:"dragSource",get:function(){return this.dragSourceNode||this.dragSourceRef&&this.dragSourceRef.current}},{key:"dragPreview",get:function(){return this.dragPreviewNode||this.dragPreviewRef&&this.dragPreviewRef.current}},{key:"clearDragSource",value:function(){this.dragSourceNode=null,this.dragSourceRef=null}},{key:"clearDragPreview",value:function(){this.dragPreviewNode=null,this.dragPreviewRef=null}}]),e}();function Zw(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Jw(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}function Fw(e,t,n){return t&&Jw(e.prototype,t),e}function jt(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Pw=function(){function e(t){var n=this;Zw(this,e),jt(this,"hooks",tv({dropTarget:function(a,l){n.clearDropTarget(),n.dropTargetOptions=l,yu(a)?n.dropTargetRef=a:n.dropTargetNode=a,n.reconnect()}})),jt(this,"handlerId",null),jt(this,"dropTargetRef",null),jt(this,"dropTargetNode",void 0),jt(this,"dropTargetOptionsInternal",null),jt(this,"unsubscribeDropTarget",void 0),jt(this,"lastConnectedHandlerId",null),jt(this,"lastConnectedDropTarget",null),jt(this,"lastConnectedDropTargetOptions",null),jt(this,"backend",void 0),this.backend=t}return Fw(e,[{key:"connectTarget",get:function(){return this.dropTarget}},{key:"reconnect",value:function(){var n=this.didHandlerIdChange()||this.didDropTargetChange()||this.didOptionsChange();n&&this.disconnectDropTarget();var i=this.dropTarget;if(this.handlerId){if(!i){this.lastConnectedDropTarget=i;return}n&&(this.lastConnectedHandlerId=this.handlerId,this.lastConnectedDropTarget=i,this.lastConnectedDropTargetOptions=this.dropTargetOptions,this.unsubscribeDropTarget=this.backend.connectDropTarget(this.handlerId,i,this.dropTargetOptions))}}},{key:"receiveHandlerId",value:function(n){n!==this.handlerId&&(this.handlerId=n,this.reconnect())}},{key:"dropTargetOptions",get:function(){return this.dropTargetOptionsInternal},set:function(n){this.dropTargetOptionsInternal=n}},{key:"didHandlerIdChange",value:function(){return this.lastConnectedHandlerId!==this.handlerId}},{key:"didDropTargetChange",value:function(){return this.lastConnectedDropTarget!==this.dropTarget}},{key:"didOptionsChange",value:function(){return!bu(this.lastConnectedDropTargetOptions,this.dropTargetOptions)}},{key:"disconnectDropTarget",value:function(){this.unsubscribeDropTarget&&(this.unsubscribeDropTarget(),this.unsubscribeDropTarget=void 0)}},{key:"dropTarget",get:function(){return this.dropTargetNode||this.dropTargetRef&&this.dropTargetRef.current}},{key:"clearDropTarget",value:function(){this.dropTargetRef=null,this.dropTargetNode=null}}]),e}();function Ww(e,t,n){var i=n.getRegistry(),a=i.addTarget(e,t);return[a,function(){return i.removeTarget(a)}]}function e1(e,t,n){var i=n.getRegistry(),a=i.addSource(e,t);return[a,function(){return i.removeSource(a)}]}var Wn=typeof window<"u"?x.useLayoutEffect:x.useEffect;function rs(e){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?rs=function(n){return typeof n}:rs=function(n){return n&&typeof Symbol=="function"&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n},rs(e)}function t1(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function n1(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}function i1(e,t,n){return t&&n1(e.prototype,t),e}function io(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var a1=function(){function e(t,n,i){t1(this,e),io(this,"spec",void 0),io(this,"monitor",void 0),io(this,"connector",void 0),this.spec=t,this.monitor=n,this.connector=i}return i1(e,[{key:"beginDrag",value:function(){var n,i=this.spec,a=this.monitor,l=null;return rs(i.item)==="object"?l=i.item:typeof i.item=="function"?l=i.item(a):l={},(n=l)!==null&&n!==void 0?n:null}},{key:"canDrag",value:function(){var n=this.spec,i=this.monitor;return typeof n.canDrag=="boolean"?n.canDrag:typeof n.canDrag=="function"?n.canDrag(i):!0}},{key:"isDragging",value:function(n,i){var a=this.spec,l=this.monitor,s=a.isDragging;return s?s(l):i===n.getSourceId()}},{key:"endDrag",value:function(){var n=this.spec,i=this.monitor,a=this.connector,l=n.end;l&&l(i.getItem(),i),a.reconnect()}}]),e}();function l1(e,t,n){var i=x.useMemo(function(){return new a1(e,t,n)},[t,n]);return x.useEffect(function(){i.spec=e},[e]),i}function li(){var e=x.useContext(Xp),t=e.dragDropManager;return H(t!=null,"Expected drag drop context"),t}function s1(e){return x.useMemo(function(){var t=e.type;return H(t!=null,"spec.type must be defined"),t},[e])}function r1(e,t){return d1(e)||c1(e,t)||u1(e,t)||o1()}function o1(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function u1(e,t){if(e){if(typeof e=="string")return Bf(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Bf(e,t)}}function Bf(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,i=new Array(t);n<t;n++)i[n]=e[n];return i}function c1(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var i=[],a=!0,l=!1,s,o;try{for(n=n.call(e);!(a=(s=n.next()).done)&&(i.push(s.value),!(t&&i.length===t));a=!0);}catch(u){l=!0,o=u}finally{try{!a&&n.return!=null&&n.return()}finally{if(l)throw o}}return i}}function d1(e){if(Array.isArray(e))return e}function f1(e,t,n){var i=li(),a=l1(e,t,n),l=s1(e);Wn(function(){if(l!=null){var o=e1(l,a,i),u=r1(o,2),d=u[0],g=u[1];return t.receiveHandlerId(d),n.receiveHandlerId(d),g}},[i,t,n,a,l])}function h1(e){return v1(e)||p1(e)||g1(e)||m1()}function m1(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function g1(e,t){if(e){if(typeof e=="string")return xu(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return xu(e,t)}}function p1(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function v1(e){if(Array.isArray(e))return xu(e)}function xu(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,i=new Array(t);n<t;n++)i[n]=e[n];return i}function nv(e,t){var n=h1(t||[]);return t==null&&typeof e!="function"&&n.push(e),x.useMemo(function(){return typeof e=="function"?e():e},n)}function y1(){var e=li();return x.useMemo(function(){return new Uw(e)},[e])}function b1(e,t){var n=li(),i=x.useMemo(function(){return new Qw(n.getBackend())},[n]);return Wn(function(){return i.dragSourceOptions=e||null,i.reconnect(),function(){return i.disconnectDragSource()}},[i,e]),Wn(function(){return i.dragPreviewOptions=t||null,i.reconnect(),function(){return i.disconnectDragPreview()}},[i,t]),i}var x1=function e(t,n){if(t===n)return!0;if(t&&n&&typeof t=="object"&&typeof n=="object"){if(t.constructor!==n.constructor)return!1;var i,a,l;if(Array.isArray(t)){if(i=t.length,i!=n.length)return!1;for(a=i;a--!==0;)if(!e(t[a],n[a]))return!1;return!0}if(t.constructor===RegExp)return t.source===n.source&&t.flags===n.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===n.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===n.toString();if(l=Object.keys(t),i=l.length,i!==Object.keys(n).length)return!1;for(a=i;a--!==0;)if(!Object.prototype.hasOwnProperty.call(n,l[a]))return!1;for(a=i;a--!==0;){var s=l[a];if(!e(t[s],n[s]))return!1}return!0}return t!==t&&n!==n};const S1=yh(x1);function w1(e,t){return E1(e)||T1(e,t)||k1(e,t)||j1()}function j1(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function k1(e,t){if(e){if(typeof e=="string")return $f(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return $f(e,t)}}function $f(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,i=new Array(t);n<t;n++)i[n]=e[n];return i}function T1(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var i=[],a=!0,l=!1,s,o;try{for(n=n.call(e);!(a=(s=n.next()).done)&&(i.push(s.value),!(t&&i.length===t));a=!0);}catch(u){l=!0,o=u}finally{try{!a&&n.return!=null&&n.return()}finally{if(l)throw o}}return i}}function E1(e){if(Array.isArray(e))return e}function iv(e,t,n){var i=x.useState(function(){return t(e)}),a=w1(i,2),l=a[0],s=a[1],o=x.useCallback(function(){var u=t(e);S1(l,u)||(s(u),n&&n())},[l,e,n]);return Wn(o),[l,o]}function C1(e,t){return A1(e)||_1(e,t)||D1(e,t)||O1()}function O1(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function D1(e,t){if(e){if(typeof e=="string")return qf(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return qf(e,t)}}function qf(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,i=new Array(t);n<t;n++)i[n]=e[n];return i}function _1(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var i=[],a=!0,l=!1,s,o;try{for(n=n.call(e);!(a=(s=n.next()).done)&&(i.push(s.value),!(t&&i.length===t));a=!0);}catch(u){l=!0,o=u}finally{try{!a&&n.return!=null&&n.return()}finally{if(l)throw o}}return i}}function A1(e){if(Array.isArray(e))return e}function z1(e,t,n){var i=iv(e,t,n),a=C1(i,2),l=a[0],s=a[1];return Wn(function(){var u=e.getHandlerId();if(u!=null)return e.subscribeToStateChange(s,{handlerIds:[u]})},[e,s]),l}function av(e,t,n){return z1(t,e||function(){return{}},function(){return n.reconnect()})}function M1(e){return x.useMemo(function(){return e.hooks.dragSource()},[e])}function N1(e){return x.useMemo(function(){return e.hooks.dragPreview()},[e])}function R1(e,t){var n=nv(e,t);H(!n.begin,"useDrag::spec.begin was deprecated in v14. Replace spec.begin() with spec.item(). (see more here - https://react-dnd.github.io/react-dnd/docs/api/use-drag)");var i=y1(),a=b1(n.options,n.previewOptions);return f1(n,i,a),[av(n.collect,i,a),M1(a),N1(a)]}function I1(e){var t=e.accept;return x.useMemo(function(){return H(e.accept!=null,"accept must be defined"),Array.isArray(t)?t:[t]},[t])}function U1(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function L1(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}function H1(e,t,n){return t&&L1(e.prototype,t),e}function Yf(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var B1=function(){function e(t,n){U1(this,e),Yf(this,"spec",void 0),Yf(this,"monitor",void 0),this.spec=t,this.monitor=n}return H1(e,[{key:"canDrop",value:function(){var n=this.spec,i=this.monitor;return n.canDrop?n.canDrop(i.getItem(),i):!0}},{key:"hover",value:function(){var n=this.spec,i=this.monitor;n.hover&&n.hover(i.getItem(),i)}},{key:"drop",value:function(){var n=this.spec,i=this.monitor;if(n.drop)return n.drop(i.getItem(),i)}}]),e}();function $1(e,t){var n=x.useMemo(function(){return new B1(e,t)},[t]);return x.useEffect(function(){n.spec=e},[e]),n}function q1(e,t){return K1(e)||V1(e,t)||G1(e,t)||Y1()}function Y1(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function G1(e,t){if(e){if(typeof e=="string")return Gf(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Gf(e,t)}}function Gf(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,i=new Array(t);n<t;n++)i[n]=e[n];return i}function V1(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var i=[],a=!0,l=!1,s,o;try{for(n=n.call(e);!(a=(s=n.next()).done)&&(i.push(s.value),!(t&&i.length===t));a=!0);}catch(u){l=!0,o=u}finally{try{!a&&n.return!=null&&n.return()}finally{if(l)throw o}}return i}}function K1(e){if(Array.isArray(e))return e}function X1(e,t,n){var i=li(),a=$1(e,t),l=I1(e);Wn(function(){var o=Ww(l,a,i),u=q1(o,2),d=u[0],g=u[1];return t.receiveHandlerId(d),n.receiveHandlerId(d),g},[i,t,a,n,l.map(function(s){return s.toString()}).join("|")])}function Q1(){var e=li();return x.useMemo(function(){return new $w(e)},[e])}function Z1(e){var t=li(),n=x.useMemo(function(){return new Pw(t.getBackend())},[t]);return Wn(function(){return n.dropTargetOptions=e||null,n.reconnect(),function(){return n.disconnectDropTarget()}},[e]),n}function J1(e){return x.useMemo(function(){return e.hooks.dropTarget()},[e])}function lv(e,t){var n=nv(e,t),i=Q1(),a=Z1(n.options);return X1(n,i,a),[av(n.collect,i,a),J1(a)]}function F1(e,t){return tj(e)||ej(e,t)||W1(e,t)||P1()}function P1(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function W1(e,t){if(e){if(typeof e=="string")return Vf(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Vf(e,t)}}function Vf(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,i=new Array(t);n<t;n++)i[n]=e[n];return i}function ej(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var i=[],a=!0,l=!1,s,o;try{for(n=n.call(e);!(a=(s=n.next()).done)&&(i.push(s.value),!(t&&i.length===t));a=!0);}catch(u){l=!0,o=u}finally{try{!a&&n.return!=null&&n.return()}finally{if(l)throw o}}return i}}function tj(e){if(Array.isArray(e))return e}function nj(e){var t=li(),n=t.getMonitor(),i=iv(n,e),a=F1(i,2),l=a[0],s=a[1];return x.useEffect(function(){return n.subscribeToOffsetChange(s)}),x.useEffect(function(){return n.subscribeToStateChange(s)}),l}function sv(e){var t=null,n=function(){return t==null&&(t=e()),t};return n}function ij(e,t){return e.filter(function(n){return n!==t})}function aj(e,t){var n=new Set,i=function(s){return n.add(s)};e.forEach(i),t.forEach(i);var a=[];return n.forEach(function(l){return a.push(l)}),a}function lj(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function sj(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}function rj(e,t,n){return t&&sj(e.prototype,t),e}function Kf(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var oj=function(){function e(t){lj(this,e),Kf(this,"entered",[]),Kf(this,"isNodeInDocument",void 0),this.isNodeInDocument=t}return rj(e,[{key:"enter",value:function(n){var i=this,a=this.entered.length,l=function(o){return i.isNodeInDocument(o)&&(!o.contains||o.contains(n))};return this.entered=aj(this.entered.filter(l),[n]),a===0&&this.entered.length>0}},{key:"leave",value:function(n){var i=this.entered.length;return this.entered=ij(this.entered.filter(this.isNodeInDocument),n),i>0&&this.entered.length===0}},{key:"reset",value:function(){this.entered=[]}}]),e}(),uj=sv(function(){return/firefox/i.test(navigator.userAgent)}),rv=sv(function(){return!!window.safari});function cj(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function dj(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}function fj(e,t,n){return t&&dj(e.prototype,t),e}function ga(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Xf=function(){function e(t,n){cj(this,e),ga(this,"xs",void 0),ga(this,"ys",void 0),ga(this,"c1s",void 0),ga(this,"c2s",void 0),ga(this,"c3s",void 0);for(var i=t.length,a=[],l=0;l<i;l++)a.push(l);a.sort(function(_,A){return t[_]<t[A]?-1:1});for(var s=[],o=[],u,d,g=0;g<i-1;g++)u=t[g+1]-t[g],d=n[g+1]-n[g],s.push(u),o.push(d/u);for(var p=[o[0]],h=0;h<s.length-1;h++){var f=o[h],y=o[h+1];if(f*y<=0)p.push(0);else{u=s[h];var v=s[h+1],S=u+v;p.push(3*S/((S+v)/f+(S+u)/y))}}p.push(o[o.length-1]);for(var c=[],m=[],w,b=0;b<p.length-1;b++){w=o[b];var j=p[b],k=1/s[b],T=j+p[b+1]-w-w;c.push((w-j-T)*k),m.push(T*k*k)}this.xs=t,this.ys=n,this.c1s=p,this.c2s=c,this.c3s=m}return fj(e,[{key:"interpolate",value:function(n){var i=this.xs,a=this.ys,l=this.c1s,s=this.c2s,o=this.c3s,u=i.length-1;if(n===i[u])return a[u];for(var d=0,g=o.length-1,p;d<=g;){p=Math.floor(.5*(d+g));var h=i[p];if(h<n)d=p+1;else if(h>n)g=p-1;else return a[p]}u=Math.max(0,g);var f=n-i[u],y=f*f;return a[u]+l[u]*f+s[u]*y+o[u]*f*y}}]),e}(),hj=1;function ov(e){var t=e.nodeType===hj?e:e.parentElement;if(!t)return null;var n=t.getBoundingClientRect(),i=n.top,a=n.left;return{x:a,y:i}}function El(e){return{x:e.clientX,y:e.clientY}}function mj(e){var t;return e.nodeName==="IMG"&&(uj()||!((t=document.documentElement)!==null&&t!==void 0&&t.contains(e)))}function gj(e,t,n,i){var a=e?t.width:n,l=e?t.height:i;return rv()&&e&&(l/=window.devicePixelRatio,a/=window.devicePixelRatio),{dragPreviewWidth:a,dragPreviewHeight:l}}function pj(e,t,n,i,a){var l=mj(t),s=l?e:t,o=ov(s),u={x:n.x-o.x,y:n.y-o.y},d=e.offsetWidth,g=e.offsetHeight,p=i.anchorX,h=i.anchorY,f=gj(l,t,d,g),y=f.dragPreviewWidth,v=f.dragPreviewHeight,S=function(){var T=new Xf([0,.5,1],[u.y,u.y/g*v,u.y+v-g]),_=T.interpolate(h);return rv()&&l&&(_+=(window.devicePixelRatio-1)*v),_},c=function(){var T=new Xf([0,.5,1],[u.x,u.x/d*y,u.x+y-d]);return T.interpolate(p)},m=a.offsetX,w=a.offsetY,b=m===0||m,j=w===0||w;return{x:b?m:c(),y:j?w:S()}}var uv="__NATIVE_FILE__",cv="__NATIVE_URL__",dv="__NATIVE_TEXT__",fv="__NATIVE_HTML__";const Qf=Object.freeze(Object.defineProperty({__proto__:null,FILE:uv,HTML:fv,TEXT:dv,URL:cv},Symbol.toStringTag,{value:"Module"}));function ao(e,t,n){var i=t.reduce(function(a,l){return a||e.getData(l)},"");return i??n}var di;function Cl(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Su=(di={},Cl(di,uv,{exposeProperties:{files:function(t){return Array.prototype.slice.call(t.files)},items:function(t){return t.items},dataTransfer:function(t){return t}},matchesTypes:["Files"]}),Cl(di,fv,{exposeProperties:{html:function(t,n){return ao(t,n,"")},dataTransfer:function(t){return t}},matchesTypes:["Html","text/html"]}),Cl(di,cv,{exposeProperties:{urls:function(t,n){return ao(t,n,"").split(`
`)},dataTransfer:function(t){return t}},matchesTypes:["Url","text/uri-list"]}),Cl(di,dv,{exposeProperties:{text:function(t,n){return ao(t,n,"")},dataTransfer:function(t){return t}},matchesTypes:["Text","text/plain"]}),di);function vj(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function yj(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}function bj(e,t,n){return t&&yj(e.prototype,t),e}function Zf(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var xj=function(){function e(t){vj(this,e),Zf(this,"item",void 0),Zf(this,"config",void 0),this.config=t,this.item={},this.initializeExposedProperties()}return bj(e,[{key:"initializeExposedProperties",value:function(){var n=this;Object.keys(this.config.exposeProperties).forEach(function(i){Object.defineProperty(n.item,i,{configurable:!0,enumerable:!0,get:function(){return console.warn(`Browser doesn't allow reading "`.concat(i,'" until the drop event.')),null}})})}},{key:"loadDataTransfer",value:function(n){var i=this;if(n){var a={};Object.keys(this.config.exposeProperties).forEach(function(l){a[l]={value:i.config.exposeProperties[l](n,i.config.matchesTypes),configurable:!0,enumerable:!0}}),Object.defineProperties(this.item,a)}}},{key:"canDrag",value:function(){return!0}},{key:"beginDrag",value:function(){return this.item}},{key:"isDragging",value:function(n,i){return i===n.getSourceId()}},{key:"endDrag",value:function(){}}]),e}();function Sj(e,t){var n=new xj(Su[e]);return n.loadDataTransfer(t),n}function lo(e){if(!e)return null;var t=Array.prototype.slice.call(e.types||[]);return Object.keys(Su).filter(function(n){var i=Su[n].matchesTypes;return i.some(function(a){return t.indexOf(a)>-1})})[0]||null}function wj(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function jj(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}function kj(e,t,n){return t&&jj(e.prototype,t),e}function so(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Tj=function(){function e(t,n){wj(this,e),so(this,"ownerDocument",null),so(this,"globalContext",void 0),so(this,"optionsArgs",void 0),this.globalContext=t,this.optionsArgs=n}return kj(e,[{key:"window",get:function(){if(this.globalContext)return this.globalContext;if(typeof window<"u")return window}},{key:"document",get:function(){var n;return(n=this.globalContext)!==null&&n!==void 0&&n.document?this.globalContext.document:this.window?this.window.document:void 0}},{key:"rootElement",get:function(){var n;return((n=this.optionsArgs)===null||n===void 0?void 0:n.rootElement)||this.window}}]),e}();function Jf(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,i)}return n}function Ff(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Jf(Object(n),!0).forEach(function(i){q(e,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Jf(Object(n)).forEach(function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(n,i))})}return e}function Ej(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Cj(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}function Oj(e,t,n){return t&&Cj(e.prototype,t),e}function q(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Dj=function(){function e(t,n,i){var a=this;Ej(this,e),q(this,"options",void 0),q(this,"actions",void 0),q(this,"monitor",void 0),q(this,"registry",void 0),q(this,"enterLeaveCounter",void 0),q(this,"sourcePreviewNodes",new Map),q(this,"sourcePreviewNodeOptions",new Map),q(this,"sourceNodes",new Map),q(this,"sourceNodeOptions",new Map),q(this,"dragStartSourceIds",null),q(this,"dropTargetIds",[]),q(this,"dragEnterTargetIds",[]),q(this,"currentNativeSource",null),q(this,"currentNativeHandle",null),q(this,"currentDragSourceNode",null),q(this,"altKeyPressed",!1),q(this,"mouseMoveTimeoutTimer",null),q(this,"asyncEndDragFrameId",null),q(this,"dragOverTargetIds",null),q(this,"lastClientOffset",null),q(this,"hoverRafId",null),q(this,"getSourceClientOffset",function(l){var s=a.sourceNodes.get(l);return s&&ov(s)||null}),q(this,"endDragNativeItem",function(){a.isDraggingNativeItem()&&(a.actions.endDrag(),a.currentNativeHandle&&a.registry.removeSource(a.currentNativeHandle),a.currentNativeHandle=null,a.currentNativeSource=null)}),q(this,"isNodeInDocument",function(l){return!!(l&&a.document&&a.document.body&&a.document.body.contains(l))}),q(this,"endDragIfSourceWasRemovedFromDOM",function(){var l=a.currentDragSourceNode;l==null||a.isNodeInDocument(l)||a.clearCurrentDragSourceNode()&&a.monitor.isDragging()&&a.actions.endDrag()}),q(this,"handleTopDragStartCapture",function(){a.clearCurrentDragSourceNode(),a.dragStartSourceIds=[]}),q(this,"handleTopDragStart",function(l){if(!l.defaultPrevented){var s=a.dragStartSourceIds;a.dragStartSourceIds=null;var o=El(l);a.monitor.isDragging()&&a.actions.endDrag(),a.actions.beginDrag(s||[],{publishSource:!1,getSourceClientOffset:a.getSourceClientOffset,clientOffset:o});var u=l.dataTransfer,d=lo(u);if(a.monitor.isDragging()){if(u&&typeof u.setDragImage=="function"){var g=a.monitor.getSourceId(),p=a.sourceNodes.get(g),h=a.sourcePreviewNodes.get(g)||p;if(h){var f=a.getCurrentSourcePreviewNodeOptions(),y=f.anchorX,v=f.anchorY,S=f.offsetX,c=f.offsetY,m={anchorX:y,anchorY:v},w={offsetX:S,offsetY:c},b=pj(p,h,o,m,w);u.setDragImage(h,b.x,b.y)}}try{u?.setData("application/json",{})}catch{}a.setCurrentDragSourceNode(l.target);var j=a.getCurrentSourcePreviewNodeOptions(),k=j.captureDraggingState;k?a.actions.publishDragSource():setTimeout(function(){return a.actions.publishDragSource()},0)}else if(d)a.beginDragNativeItem(d);else{if(u&&!u.types&&(l.target&&!l.target.hasAttribute||!l.target.hasAttribute("draggable")))return;l.preventDefault()}}}),q(this,"handleTopDragEndCapture",function(){a.clearCurrentDragSourceNode()&&a.monitor.isDragging()&&a.actions.endDrag()}),q(this,"handleTopDragEnterCapture",function(l){a.dragEnterTargetIds=[];var s=a.enterLeaveCounter.enter(l.target);if(!(!s||a.monitor.isDragging())){var o=l.dataTransfer,u=lo(o);u&&a.beginDragNativeItem(u,o)}}),q(this,"handleTopDragEnter",function(l){var s=a.dragEnterTargetIds;if(a.dragEnterTargetIds=[],!!a.monitor.isDragging()){a.altKeyPressed=l.altKey,s.length>0&&a.actions.hover(s,{clientOffset:El(l)});var o=s.some(function(u){return a.monitor.canDropOnTarget(u)});o&&(l.preventDefault(),l.dataTransfer&&(l.dataTransfer.dropEffect=a.getCurrentDropEffect()))}}),q(this,"handleTopDragOverCapture",function(){a.dragOverTargetIds=[]}),q(this,"handleTopDragOver",function(l){var s=a.dragOverTargetIds;if(a.dragOverTargetIds=[],!a.monitor.isDragging()){l.preventDefault(),l.dataTransfer&&(l.dataTransfer.dropEffect="none");return}a.altKeyPressed=l.altKey,a.lastClientOffset=El(l),a.hoverRafId===null&&typeof requestAnimationFrame<"u"&&(a.hoverRafId=requestAnimationFrame(function(){a.monitor.isDragging()&&a.actions.hover(s||[],{clientOffset:a.lastClientOffset}),a.hoverRafId=null}));var o=(s||[]).some(function(u){return a.monitor.canDropOnTarget(u)});o?(l.preventDefault(),l.dataTransfer&&(l.dataTransfer.dropEffect=a.getCurrentDropEffect())):a.isDraggingNativeItem()?l.preventDefault():(l.preventDefault(),l.dataTransfer&&(l.dataTransfer.dropEffect="none"))}),q(this,"handleTopDragLeaveCapture",function(l){a.isDraggingNativeItem()&&l.preventDefault();var s=a.enterLeaveCounter.leave(l.target);s&&a.isDraggingNativeItem()&&setTimeout(function(){return a.endDragNativeItem()},0)}),q(this,"handleTopDropCapture",function(l){if(a.dropTargetIds=[],a.isDraggingNativeItem()){var s;l.preventDefault(),(s=a.currentNativeSource)===null||s===void 0||s.loadDataTransfer(l.dataTransfer)}else lo(l.dataTransfer)&&l.preventDefault();a.enterLeaveCounter.reset()}),q(this,"handleTopDrop",function(l){var s=a.dropTargetIds;a.dropTargetIds=[],a.actions.hover(s,{clientOffset:El(l)}),a.actions.drop({dropEffect:a.getCurrentDropEffect()}),a.isDraggingNativeItem()?a.endDragNativeItem():a.monitor.isDragging()&&a.actions.endDrag()}),q(this,"handleSelectStart",function(l){var s=l.target;typeof s.dragDrop=="function"&&(s.tagName==="INPUT"||s.tagName==="SELECT"||s.tagName==="TEXTAREA"||s.isContentEditable||(l.preventDefault(),s.dragDrop()))}),this.options=new Tj(n,i),this.actions=t.getActions(),this.monitor=t.getMonitor(),this.registry=t.getRegistry(),this.enterLeaveCounter=new oj(this.isNodeInDocument)}return Oj(e,[{key:"profile",value:function(){var n,i;return{sourcePreviewNodes:this.sourcePreviewNodes.size,sourcePreviewNodeOptions:this.sourcePreviewNodeOptions.size,sourceNodeOptions:this.sourceNodeOptions.size,sourceNodes:this.sourceNodes.size,dragStartSourceIds:((n=this.dragStartSourceIds)===null||n===void 0?void 0:n.length)||0,dropTargetIds:this.dropTargetIds.length,dragEnterTargetIds:this.dragEnterTargetIds.length,dragOverTargetIds:((i=this.dragOverTargetIds)===null||i===void 0?void 0:i.length)||0}}},{key:"window",get:function(){return this.options.window}},{key:"document",get:function(){return this.options.document}},{key:"rootElement",get:function(){return this.options.rootElement}},{key:"setup",value:function(){var n=this.rootElement;if(n!==void 0){if(n.__isReactDndBackendSetUp)throw new Error("Cannot have two HTML5 backends at the same time.");n.__isReactDndBackendSetUp=!0,this.addEventListeners(n)}}},{key:"teardown",value:function(){var n=this.rootElement;if(n!==void 0&&(n.__isReactDndBackendSetUp=!1,this.removeEventListeners(this.rootElement),this.clearCurrentDragSourceNode(),this.asyncEndDragFrameId)){var i;(i=this.window)===null||i===void 0||i.cancelAnimationFrame(this.asyncEndDragFrameId)}}},{key:"connectDragPreview",value:function(n,i,a){var l=this;return this.sourcePreviewNodeOptions.set(n,a),this.sourcePreviewNodes.set(n,i),function(){l.sourcePreviewNodes.delete(n),l.sourcePreviewNodeOptions.delete(n)}}},{key:"connectDragSource",value:function(n,i,a){var l=this;this.sourceNodes.set(n,i),this.sourceNodeOptions.set(n,a);var s=function(d){return l.handleDragStart(d,n)},o=function(d){return l.handleSelectStart(d)};return i.setAttribute("draggable","true"),i.addEventListener("dragstart",s),i.addEventListener("selectstart",o),function(){l.sourceNodes.delete(n),l.sourceNodeOptions.delete(n),i.removeEventListener("dragstart",s),i.removeEventListener("selectstart",o),i.setAttribute("draggable","false")}}},{key:"connectDropTarget",value:function(n,i){var a=this,l=function(d){return a.handleDragEnter(d,n)},s=function(d){return a.handleDragOver(d,n)},o=function(d){return a.handleDrop(d,n)};return i.addEventListener("dragenter",l),i.addEventListener("dragover",s),i.addEventListener("drop",o),function(){i.removeEventListener("dragenter",l),i.removeEventListener("dragover",s),i.removeEventListener("drop",o)}}},{key:"addEventListeners",value:function(n){n.addEventListener&&(n.addEventListener("dragstart",this.handleTopDragStart),n.addEventListener("dragstart",this.handleTopDragStartCapture,!0),n.addEventListener("dragend",this.handleTopDragEndCapture,!0),n.addEventListener("dragenter",this.handleTopDragEnter),n.addEventListener("dragenter",this.handleTopDragEnterCapture,!0),n.addEventListener("dragleave",this.handleTopDragLeaveCapture,!0),n.addEventListener("dragover",this.handleTopDragOver),n.addEventListener("dragover",this.handleTopDragOverCapture,!0),n.addEventListener("drop",this.handleTopDrop),n.addEventListener("drop",this.handleTopDropCapture,!0))}},{key:"removeEventListeners",value:function(n){n.removeEventListener&&(n.removeEventListener("dragstart",this.handleTopDragStart),n.removeEventListener("dragstart",this.handleTopDragStartCapture,!0),n.removeEventListener("dragend",this.handleTopDragEndCapture,!0),n.removeEventListener("dragenter",this.handleTopDragEnter),n.removeEventListener("dragenter",this.handleTopDragEnterCapture,!0),n.removeEventListener("dragleave",this.handleTopDragLeaveCapture,!0),n.removeEventListener("dragover",this.handleTopDragOver),n.removeEventListener("dragover",this.handleTopDragOverCapture,!0),n.removeEventListener("drop",this.handleTopDrop),n.removeEventListener("drop",this.handleTopDropCapture,!0))}},{key:"getCurrentSourceNodeOptions",value:function(){var n=this.monitor.getSourceId(),i=this.sourceNodeOptions.get(n);return Ff({dropEffect:this.altKeyPressed?"copy":"move"},i||{})}},{key:"getCurrentDropEffect",value:function(){return this.isDraggingNativeItem()?"copy":this.getCurrentSourceNodeOptions().dropEffect}},{key:"getCurrentSourcePreviewNodeOptions",value:function(){var n=this.monitor.getSourceId(),i=this.sourcePreviewNodeOptions.get(n);return Ff({anchorX:.5,anchorY:.5,captureDraggingState:!1},i||{})}},{key:"isDraggingNativeItem",value:function(){var n=this.monitor.getItemType();return Object.keys(Qf).some(function(i){return Qf[i]===n})}},{key:"beginDragNativeItem",value:function(n,i){this.clearCurrentDragSourceNode(),this.currentNativeSource=Sj(n,i),this.currentNativeHandle=this.registry.addSource(n,this.currentNativeSource),this.actions.beginDrag([this.currentNativeHandle])}},{key:"setCurrentDragSourceNode",value:function(n){var i=this;this.clearCurrentDragSourceNode(),this.currentDragSourceNode=n;var a=1e3;this.mouseMoveTimeoutTimer=setTimeout(function(){var l;return(l=i.rootElement)===null||l===void 0?void 0:l.addEventListener("mousemove",i.endDragIfSourceWasRemovedFromDOM,!0)},a)}},{key:"clearCurrentDragSourceNode",value:function(){if(this.currentDragSourceNode){if(this.currentDragSourceNode=null,this.rootElement){var n;(n=this.window)===null||n===void 0||n.clearTimeout(this.mouseMoveTimeoutTimer||void 0),this.rootElement.removeEventListener("mousemove",this.endDragIfSourceWasRemovedFromDOM,!0)}return this.mouseMoveTimeoutTimer=null,!0}return!1}},{key:"handleDragStart",value:function(n,i){n.defaultPrevented||(this.dragStartSourceIds||(this.dragStartSourceIds=[]),this.dragStartSourceIds.unshift(i))}},{key:"handleDragEnter",value:function(n,i){this.dragEnterTargetIds.unshift(i)}},{key:"handleDragOver",value:function(n,i){this.dragOverTargetIds===null&&(this.dragOverTargetIds=[]),this.dragOverTargetIds.unshift(i)}},{key:"handleDrop",value:function(n,i){this.dropTargetIds.unshift(i)}}]),e}(),Ol;function _j(){return Ol||(Ol=new Image,Ol.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw=="),Ol}var Aj=function(t,n,i){return new Dj(t,n,i)};function zj(e,t){return typeof e=="function"?e(t):e??"NODE"}function Mj(e){return e.isDraggable&&!e.isEditing}function Nj(e){const t=Ke(),n=t.selectedIds,[i,a,l]=R1(()=>({canDrag:()=>Mj(e),type:zj(t.props.dragType,e),item:()=>{const s=t.isSelected(e.id)?Array.from(n):[e.id];return t.dispatch(Pi.dragStart(e.id,s)),{id:e.id,dragIds:s,data:e.data}},end:()=>{t.hideCursor(),t.redrawList(),t.dispatch(Pi.dragEnd())}}),[n,e,t.props.dragType]);return x.useEffect(()=>{l(_j())},[l]),a}function Rj(e,t){const n=e.getBoundingClientRect(),i=t.x-Math.round(n.x),a=t.y-Math.round(n.y),l=n.height,s=a<l/2,o=!s,u=l/4,d=a>u&&a<l-u;return{x:i,inTopHalf:s,inBottomHalf:o,inMiddle:d,atTop:!d&&s,atBottom:!d&&o}}function Ij(e,t,n,i){return e?e.isInternal?i.atTop?[t,e]:i.inMiddle?[e,e]:[e,n]:i.inTopHalf?[t,e]:[e,n]:[t,null]}function Dl(e,t){return{parentId:e||null,index:t}}function fi(e,t){return{type:"line",index:e,level:t}}function Uj(e){return{type:"highlight",id:e}}function ro(e,t){var n;let i=e;for(;i.parent&&i.level>t;)i=i.parent;const a=((n=i.parent)===null||n===void 0?void 0:n.id)||null,l=Ip(i)+1;return{parentId:a,index:l}}function hv(e){var t;const n=Rj(e.element,e.offset),i=e.indent,a=Math.round(Math.max(0,n.x-i)/i),{node:l,nextNode:s,prevNode:o}=e,[u,d]=Ij(l,o,s,n);if(l&&l.isInternal&&n.inMiddle)return{drop:Dl(l.id,null),cursor:Uj(l.id)};if(!u)return{drop:Dl((t=d?.parent)===null||t===void 0?void 0:t.id,0),cursor:fi(0,0)};if(zp(u)){const g=ts(a,d?.level||0,u.level);return{drop:ro(u,g),cursor:fi(u.rowIndex+1,g)}}if(Mp(u)){const g=ts(a,d?.level||0,u.level);return{drop:ro(u,g),cursor:fi(u.rowIndex+1,g)}}if(Np(u)){const g=ts(a,0,u.level+1);return g>u.level?{drop:Dl(u.id,0),cursor:fi(u.rowIndex+1,g)}:{drop:ro(u,g),cursor:fi(u.rowIndex+1,g)}}return{drop:Dl(u?.id,0),cursor:fi(u.rowIndex+1,u.level+1)}}function Lj(e,t){const n=Ke(),[i,a]=lv(()=>({accept:"NODE",canDrop:()=>n.canDrop(),hover:(l,s)=>{const o=s.getClientOffset();if(!e.current||!o)return;const{cursor:u,drop:d}=hv({element:e.current,offset:o,indent:n.indent,node:t,prevNode:t.prev,nextNode:t.next});d&&n.dispatch(Pi.hovering(d.parentId,d.index)),s.canDrop()?u&&n.showCursor(u):n.hideCursor()},drop:(l,s)=>{if(!s.canDrop())return null;n.drop()}}),[t,e.current,n.props]);return a}function Hj(e){const t=Ke(),n=t.at(e);if(!n)throw new Error(`Could not find node for index: ${e}`);return x.useMemo(()=>{const i=n.clone();return t.visibleNodes[e]=i,i},[...Object.values(n.state),n])}const Pf=Oh.memo(function({index:t,style:n}){Ap(),rx();const i=Ke(),a=Hj(t),l=x.useRef(null),s=Nj(a),o=Lj(l,a),u=x.useCallback(v=>{l.current=v,o(v)},[o]),d=i.indent*a.level,g=x.useMemo(()=>({paddingLeft:d}),[d]),p=x.useMemo(()=>{var v,S;return Object.assign(Object.assign({},n),{top:parseFloat(n.top)+((S=(v=i.props.padding)!==null&&v!==void 0?v:i.props.paddingTop)!==null&&S!==void 0?S:0),minWidth:"max-content"})},[n,i.props.padding,i.props.paddingTop]),h={role:"treeitem","aria-level":a.level+1,"aria-selected":a.isSelected,"aria-expanded":a.isOpen,style:p,tabIndex:-1,className:i.props.rowClassName};x.useEffect(()=>{var v;!a.isEditing&&a.isFocused&&((v=l.current)===null||v===void 0||v.focus({preventScroll:!0}))},[a.isEditing,a.isFocused,l.current]);const f=i.renderNode,y=i.renderRow;return r.jsx(y,{node:a,innerRef:u,attrs:h,children:r.jsx(f,{node:a,tree:i,style:g,dragHandle:s})})});let oo="",Wf=null;function mv(){Ap();const e=Ke();return r.jsx("div",{role:"tree","aria-label":e.props["aria-label"],"aria-labelledby":e.props["aria-labelledby"],"aria-multiselectable":!e.props.disableMultiSelection||void 0,style:{height:e.height,width:e.width,minHeight:0,minWidth:0},onContextMenu:e.props.onContextMenu,onClick:e.props.onClick,tabIndex:0,onFocus:t=>{t.currentTarget.contains(t.relatedTarget)||e.onFocus()},onBlur:t=>{t.currentTarget.contains(t.relatedTarget)||e.onBlur()},onKeyDown:t=>{var n;if(e.isEditing)return;if(t.key==="Backspace"){if(!e.props.onDelete)return;const a=Array.from(e.selectedIds);if(a.length>1){let l=e.mostRecentNode;for(;l&&l.isSelected;)l=l.nextSibling;l||(l=e.lastNode),e.focus(l,{scroll:!1}),e.delete(Array.from(a))}else{const l=e.focusedNode;if(l){const s=l.nextSibling,o=l.parent;e.focus(s||o,{scroll:!1}),e.delete(l)}}return}if(t.key==="Tab"&&!t.shiftKey){t.preventDefault(),Up(t.currentTarget);return}if(t.key==="Tab"&&t.shiftKey){t.preventDefault(),Lp(t.currentTarget);return}if(t.key==="ArrowDown"){t.preventDefault();const a=e.nextNode;if(t.metaKey){e.select(e.focusedNode),e.activate(e.focusedNode);return}else if(!t.shiftKey||e.props.disableMultiSelection){e.focus(a);return}else{if(!a)return;const l=e.focusedNode;l?l.isSelected?e.selectContiguous(a):e.selectMulti(a):e.focus(e.firstNode);return}}if(t.key==="ArrowUp"){t.preventDefault();const a=e.prevNode;if(!t.shiftKey||e.props.disableMultiSelection){e.focus(a);return}else{if(!a)return;const l=e.focusedNode;l?l.isSelected?e.selectContiguous(a):e.selectMulti(a):e.focus(e.lastNode);return}}if(t.key==="ArrowRight"){const a=e.focusedNode;if(!a)return;a.isInternal&&a.isOpen?e.focus(e.nextNode):a.isInternal&&e.open(a.id);return}if(t.key==="ArrowLeft"){const a=e.focusedNode;if(!a||a.isRoot)return;a.isInternal&&a.isOpen?e.close(a.id):!((n=a.parent)===null||n===void 0)&&n.isRoot||e.focus(a.parent);return}if(t.key==="a"&&(t.metaKey||t.ctrlKey)&&!e.props.disableMultiSelection){t.preventDefault(),e.selectAll();return}if(t.key==="a"&&!t.metaKey&&!t.ctrlKey&&e.props.onCreate){e.createLeaf();return}if(t.key==="A"&&!t.metaKey&&!t.ctrlKey){if(!e.props.onCreate)return;e.createInternal();return}if(t.key==="Home"){t.preventDefault(),e.focus(e.firstNode);return}if(t.key==="End"){t.preventDefault(),e.focus(e.lastNode);return}if(t.key==="Enter"){const a=e.focusedNode;if(!a||!a.isEditable||!e.props.onRename)return;setTimeout(()=>{a&&e.edit(a)});return}if(t.key===" "){t.preventDefault();const a=e.focusedNode;if(!a)return;a.isLeaf?(a.select(),a.activate()):a.toggle();return}if(t.key==="*"){const a=e.focusedNode;if(!a)return;e.openSiblings(a);return}if(t.key==="PageUp"){t.preventDefault(),e.pageUp();return}t.key==="PageDown"&&(t.preventDefault(),e.pageDown()),clearTimeout(Wf),oo+=t.key,Wf=setTimeout(()=>{oo=""},600);const i=e.visibleNodes.find(a=>{const l=a.data.name;return typeof l=="string"?l.toLowerCase().startsWith(oo):!1});i&&e.focus(i.id)},children:r.jsx(Bj,{})})}function Bj(){var e,t;const n=Ke(),i={className:n.props.className,outerRef:n.listEl,itemCount:n.visibleNodes.length,height:n.height,width:n.width,overscanCount:n.overscanCount,itemKey:a=>{var l;return((l=n.visibleNodes[a])===null||l===void 0?void 0:l.id)||a},outerElementType:(e=n.props.outerElementType)!==null&&e!==void 0?e:Zx,innerElementType:(t=n.props.innerElementType)!==null&&t!==void 0?t:Px,onScroll:n.props.onScroll,onItemsRendered:n.onItemsRendered.bind(n)};return typeof n.props.rowHeight=="function"?r.jsx(Vx,Object.assign({},i,{itemSize:n.rowHeightAt,ref:n.list,children:Pf})):r.jsx(Kx,Object.assign({},i,{itemSize:n.rowHeight,ref:n.list,children:Pf}))}function eh(e){return e.isFiltered?qj(e.root,e.isMatch.bind(e)):$j(e.root)}function $j(e){const t=[];function n(i){var a;i.level>=0&&t.push(i),i.isOpen&&((a=i.children)===null||a===void 0||a.forEach(n))}return n(e),t.forEach(gv),t}function qj(e,t){const n={},i=[];function a(s){if(!s.isRoot&&t(s)){n[s.id]=!0;let u=s.parent;for(;u;)n[u.id]=!0,u=u.parent}if(s.children)for(let u of s.children)a(u)}function l(s){var o;s.level>=0&&n[s.id]&&i.push(s),s.isOpen&&((o=s.children)===null||o===void 0||o.forEach(l))}return a(e),l(e),i.forEach(gv),i}function gv(e,t){e.rowIndex=t}const th=e=>e.reduce((t,n,i)=>(t[n.id]=i,t),{});var uo=function(e,t,n,i){function a(l){return l instanceof n?l:new n(function(s){s(l)})}return new(n||(n=Promise))(function(l,s){function o(g){try{d(i.next(g))}catch(p){s(p)}}function u(g){try{d(i.throw(g))}catch(p){s(p)}}function d(g){g.done?l(g.value):a(g.value).then(o,u)}d((i=i.apply(e,t||[])).next())})};const{safeRun:Me,identify:kt,identifyNull:yt}=fx;class Ia{constructor(t,n,i,a){this.store=t,this.props=n,this.list=i,this.listEl=a,this.visibleStartIndex=0,this.visibleStopIndex=0,this.rowOffsets=null,this.rowHeightAt=l=>{const s=this.props.rowHeight;if(typeof s=="function"){const o=this.at(l);return o?s(o):this.rowHeight}return s??24},this.rowTopPosition=l=>{if(typeof this.props.rowHeight!="function")return l*this.rowHeight;const s=this.getRowOffsets(),o=Math.max(0,Math.min(l,s.length-1));return s[o]},this.redrawList=(l=0)=>{this.rowOffsets=null;const s=this.list.current;s&&"resetAfterIndex"in s&&s.resetAfterIndex(Math.max(0,l))},this.root=uf(this),this.visibleNodes=eh(this),this.idToIndex=th(this.visibleNodes)}update(t){this.props=t,this.root=uf(this),this.visibleNodes=eh(this),this.idToIndex=th(this.visibleNodes),this.rowOffsets=null;const n=this.list.current;n&&"resetAfterIndex"in n&&n.resetAfterIndex(0,!1)}dispatch(t){return this.store.dispatch(t)}get state(){return this.store.getState()}get openState(){return this.state.nodes.open.unfiltered}get width(){var t;return(t=this.props.width)!==null&&t!==void 0?t:300}get height(){var t;return(t=this.props.height)!==null&&t!==void 0?t:500}get indent(){var t;return(t=this.props.indent)!==null&&t!==void 0?t:24}get rowHeight(){return typeof this.props.rowHeight=="number"?this.props.rowHeight:24}getRowOffsets(){if(this.rowOffsets)return this.rowOffsets;const t=[0];for(let n=0;n<this.visibleNodes.length;n++)t.push(t[n]+this.rowHeightAt(n));return this.rowOffsets=t,t}get overscanCount(){var t;return(t=this.props.overscanCount)!==null&&t!==void 0?t:1}get searchTerm(){return(this.props.searchTerm||"").trim()}get matchFn(){var t;const n=(t=this.props.searchMatch)!==null&&t!==void 0?t:(i,a)=>JSON.stringify(Object.values(i.data)).toLocaleLowerCase().includes(a.toLocaleLowerCase());return i=>n(i,this.searchTerm)}accessChildren(t){var n;const i=this.props.childrenAccessor||"children";return(n=ns(t,i))!==null&&n!==void 0?n:null}accessId(t){const n=this.props.idAccessor||"id",i=ns(t,n);if(!i)throw new Error("Data must contain an 'id' property or props.idAccessor must return a string");return i}get firstNode(){var t;return(t=this.visibleNodes[0])!==null&&t!==void 0?t:null}get lastNode(){var t;return(t=this.visibleNodes[this.visibleNodes.length-1])!==null&&t!==void 0?t:null}get focusedNode(){var t;return(t=this.get(this.state.nodes.focus.id))!==null&&t!==void 0?t:null}get mostRecentNode(){var t;return(t=this.get(this.state.nodes.selection.mostRecent))!==null&&t!==void 0?t:null}get nextNode(){const t=this.indexOf(this.focusedNode);return t===null?null:this.at(t+1)}get prevNode(){const t=this.indexOf(this.focusedNode);return t===null?null:this.at(t-1)}get(t){return t&&t in this.idToIndex&&this.visibleNodes[this.idToIndex[t]]||null}at(t){return this.visibleNodes[t]||null}nodesBetween(t,n){var i;if(t===null||n===null)return[];const a=(i=this.indexOf(t))!==null&&i!==void 0?i:0,l=this.indexOf(n);if(l===null)return[];const s=Math.min(a,l),o=Math.max(a,l);return this.visibleNodes.slice(s,o+1)}indexOf(t){const n=Bp(t);return n?this.idToIndex[n]:null}get editingId(){return this.state.nodes.edit.id}createInternal(){return this.create({type:"internal"})}createLeaf(){return this.create({type:"leaf"})}create(){return uo(this,arguments,void 0,function*(t={}){var n,i;const a=t.parentId===void 0?Yp(this):t.parentId,l=(n=t.index)!==null&&n!==void 0?n:qp(this),s=(i=t.type)!==null&&i!==void 0?i:"leaf",o=yield Me(this.props.onCreate,{type:s,parentId:a,index:l,parentNode:this.get(a)});o&&(this.focus(o),setTimeout(()=>{this.edit(o).then(()=>{this.select(o),this.activate(o)})}))})}delete(t){return uo(this,void 0,void 0,function*(){if(!t)return;const i=(Array.isArray(t)?t:[t]).map(kt),a=i.map(s=>this.get(s)).filter(s=>!!s),l=a.length?Math.min(...a.map(s=>{var o;return(o=s.rowIndex)!==null&&o!==void 0?o:0})):0;yield Me(this.props.onDelete,{nodes:a,ids:i}),this.redrawList(l)})}edit(t){var n,i;const a=kt(t);return this.resolveEdit({cancelled:!0}),this.scrollTo(a),this.dispatch(Fr(a)),this.redrawList((i=(n=this.get(a))===null||n===void 0?void 0:n.rowIndex)!==null&&i!==void 0?i:0),new Promise(l=>{Ia.editPromise=l})}submit(t,n){return uo(this,void 0,void 0,function*(){var i,a;if(!t)return;const l=kt(t);yield Me(this.props.onRename,{id:l,name:n,node:this.get(l)}),this.dispatch(Fr(null)),this.resolveEdit({cancelled:!1,value:n}),this.redrawList((a=(i=this.get(l))===null||i===void 0?void 0:i.rowIndex)!==null&&a!==void 0?a:0),setTimeout(()=>this.onFocus())})}reset(){this.dispatch(Fr(null)),this.resolveEdit({cancelled:!0}),this.redrawList(),setTimeout(()=>this.onFocus())}activate(t){const n=this.get(yt(t));n&&Me(this.props.onActivate,n)}resolveEdit(t){const n=Ia.editPromise;n&&n(t),Ia.editPromise=null}get selectedIds(){return this.state.nodes.selection.ids}get selectedNodes(){let t=[];for(let n of Array.from(this.selectedIds)){const i=this.get(n);i&&t.push(i)}return t}focus(t,n={}){t&&(this.props.selectionFollowsFocus?this.select(t):(this.dispatch(oi(kt(t))),n.scroll!==!1&&this.scrollTo(t),this.focusedNode&&Me(this.props.onFocus,this.focusedNode)))}pageUp(){var t,n;const i=this.visibleStartIndex,l=this.visibleStopIndex-i;let s=(n=(t=this.focusedNode)===null||t===void 0?void 0:t.rowIndex)!==null&&n!==void 0?n:0;s>i?s=i:s=Math.max(i-l,0),this.focus(this.at(s))}pageDown(){var t,n;const i=this.visibleStartIndex,a=this.visibleStopIndex,l=a-i;let s=(n=(t=this.focusedNode)===null||t===void 0?void 0:t.rowIndex)!==null&&n!==void 0?n:0;s<a?s=a:s=Math.min(s+l,this.visibleNodes.length-1),this.focus(this.at(s))}select(t,n={}){var i;if(!t)return;const a=n.focus!==!1,l=kt(t);a&&this.dispatch(oi(l)),!((i=this.get(l))===null||i===void 0)&&i.isSelectable&&this.setSelection({ids:[l],anchor:l,mostRecent:l}),this.scrollTo(l,n.align),this.focusedNode&&a&&Me(this.props.onFocus,this.focusedNode)}deselect(t){if(!t)return;const n=kt(t);this.dispatch(an.remove(n)),Me(this.props.onSelect,this.selectedNodes)}selectMulti(t,n={}){const i=this.get(yt(t));if(!i)return;const a=n.focus!==!1;a&&this.dispatch(oi(i.id)),i.isSelectable&&(this.dispatch(an.add(i.id)),this.dispatch(an.anchor(i.id)),this.dispatch(an.mostRecent(i.id))),this.scrollTo(i,n.align),this.focusedNode&&a&&Me(this.props.onFocus,this.focusedNode),Me(this.props.onSelect,this.selectedNodes)}selectContiguous(t){var n;if(!t)return;const i=kt(t);if(this.dispatch(oi(i)),!((n=this.get(i))===null||n===void 0)&&n.isSelectable){const{anchor:a,mostRecent:l}=this.state.nodes.selection,s=this.filterSelectableNodes(this.nodesBetween(a,yt(i)));this.dispatch(an.remove(this.nodesBetween(a,l))),this.dispatch(an.add(s)),this.dispatch(an.mostRecent(i))}this.scrollTo(i),this.focusedNode&&Me(this.props.onFocus,this.focusedNode),Me(this.props.onSelect,this.selectedNodes)}deselectAll(){this.setSelection({ids:[],anchor:null,mostRecent:null})}selectAll(){var t,n,i;const a=this.filterSelectableNodes(Object.keys(this.idToIndex));this.setSelection({ids:a,anchor:(t=a[0])!==null&&t!==void 0?t:null,mostRecent:(n=a[a.length-1])!==null&&n!==void 0?n:null}),this.dispatch(oi((i=this.lastNode)===null||i===void 0?void 0:i.id)),this.focusedNode&&Me(this.props.onFocus,this.focusedNode)}filterSelectableNodes(t){return t.map(n=>this.get(kt(n))).filter(n=>!!n&&n.isSelectable)}setSelection(t){var n;const i=new Set((n=t.ids)===null||n===void 0?void 0:n.map(kt)),a=yt(t.anchor),l=yt(t.mostRecent);this.dispatch(an.set({ids:i,anchor:a,mostRecent:l})),Me(this.props.onSelect,this.selectedNodes)}get cursorParentId(){const{cursor:t}=this.state.dnd;switch(t.type){case"highlight":return t.id;default:return null}}get cursorOverFolder(){return this.state.dnd.cursor.type==="highlight"}get dragNodes(){return this.state.dnd.dragIds.map(t=>this.get(t)).filter(t=>!!t)}get dragNode(){return this.get(this.state.nodes.drag.id)}get dragDestinationParent(){return this.get(this.state.nodes.drag.destinationParentId)}get dragDestinationIndex(){return this.state.nodes.drag.destinationIndex}canDrop(){var t;if(this.isFiltered)return!1;const n=(t=this.get(this.state.dnd.parentId))!==null&&t!==void 0?t:this.root,i=this.dragNodes,a=this.props.disableDrop;for(const l of i)if(!l||!n||l.isInternal&&Rp(n,l))return!1;return typeof a=="function"?!a({parentNode:n,dragNodes:this.dragNodes,index:this.state.dnd.index||0}):typeof a=="string"?!n.data[a]:typeof a=="boolean"?!a:!0}drop(){const{parentId:t,index:n,dragIds:i}=this.state.dnd;Me(this.props.onMove,{dragIds:i,parentId:t===Fa?null:t,index:n===null?0:n,dragNodes:this.dragNodes,parentNode:this.get(t)}),this.open(t)}hideCursor(){this.dispatch(Pi.cursor({type:"none"}))}showCursor(t){this.dispatch(Pi.cursor(t))}open(t,n=!0){var i,a;const l=yt(t);l&&(this.isOpen(l)||(this.dispatch(hu.open(l,this.isFiltered)),n&&this.redrawList((a=(i=this.get(l))===null||i===void 0?void 0:i.rowIndex)!==null&&a!==void 0?a:0),Me(this.props.onToggle,l)))}close(t,n=!0){var i,a;const l=yt(t);l&&this.isOpen(l)&&(this.dispatch(hu.close(l,this.isFiltered)),n&&this.redrawList((a=(i=this.get(l))===null||i===void 0?void 0:i.rowIndex)!==null&&a!==void 0?a:0),Me(this.props.onToggle,l))}toggle(t){const n=yt(t);if(n)return this.isOpen(n)?this.close(n):this.open(n)}openParents(t){const n=yt(t);if(!n)return;const i=kc(this.root,n);let a=i?.parent;for(;a;)this.open(a.id,!1),a=a.parent;this.redrawList()}openSiblings(t){const n=t.parent;if(!n)this.toggle(t.id);else if(n.children){const i=t.isOpen;for(let a of n.children)a.isInternal&&(i?this.close(a.id,!1):this.open(a.id,!1));this.redrawList(),this.scrollTo(this.focusedNode)}}openAll(){Ls(this.root,t=>{t.isInternal&&this.open(t.id,!1)}),this.redrawList()}closeAll(){Ls(this.root,t=>{t.isInternal&&this.close(t.id,!1)}),this.redrawList()}scrollTo(t,n="smart"){if(!t)return;const i=kt(t);return this.openParents(i),$p(()=>i in this.idToIndex).then(()=>{var a;const l=this.idToIndex[i];l!==void 0&&((a=this.list.current)===null||a===void 0||a.scrollToItem(l,n))}).catch(()=>{})}get isEditing(){return this.state.nodes.edit.id!==null}get isFiltered(){var t;return!!(!((t=this.props.searchTerm)===null||t===void 0)&&t.trim())}get hasFocus(){return this.state.nodes.focus.treeFocused}get hasNoSelection(){return this.state.nodes.selection.ids.size===0}get hasOneSelection(){return this.state.nodes.selection.ids.size===1}get hasMultipleSelections(){return this.state.nodes.selection.ids.size>1}isSelected(t){return t?this.state.nodes.selection.ids.has(t):!1}isOpen(t){var n,i,a;if(!t)return!1;if(t===Fa)return!0;const l=(n=this.props.openByDefault)!==null&&n!==void 0?n:!0;return this.isFiltered?(i=this.state.nodes.open.filtered[t])!==null&&i!==void 0?i:!0:(a=this.state.nodes.open.unfiltered[t])!==null&&a!==void 0?a:l}isEditable(t){return this.isActionPossible(t,this.props.disableEdit)}isDraggable(t){return this.isActionPossible(t,this.props.disableDrag)}isSelectable(t){return this.isActionPossible(t,this.props.disableSelect)}isActionPossible(t,n=()=>!1){return!ns(t,n)}isDragging(t){const n=yt(t);return n?this.state.nodes.drag.id===n:!1}isFocused(t){return this.hasFocus&&this.state.nodes.focus.id===t}isMatch(t){return this.matchFn(t)}willReceiveDrop(t){const n=yt(t);if(!n)return!1;const{destinationParentId:i,destinationIndex:a}=this.state.nodes.drag;return n===i&&a===null}onFocus(){const t=this.focusedNode||this.firstNode;t&&this.dispatch(oi(t.id))}onBlur(){this.dispatch(wx())}onItemsRendered(t){this.visibleStartIndex=t.visibleStartIndex,this.visibleStopIndex=t.visibleStopIndex}get renderContainer(){return this.props.renderContainer||mv}get renderRow(){return this.props.renderRow||vx}get renderNode(){return this.props.children||yx}get renderDragPreview(){return this.props.renderDragPreview||Gp}get renderCursor(){return this.props.renderCursor||px}}function Ne(e){return`Minified Redux error #${e}; visit https://redux.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}var Yj=typeof Symbol=="function"&&Symbol.observable||"@@observable",nh=Yj,co=()=>Math.random().toString(36).substring(7).split("").join("."),Gj={INIT:`@@redux/INIT${co()}`,REPLACE:`@@redux/REPLACE${co()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${co()}`},$s=Gj;function Vj(e){if(typeof e!="object"||e===null)return!1;let t=e;for(;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t||Object.getPrototypeOf(e)===null}function pv(e,t,n){if(typeof e!="function")throw new Error(Ne(2));if(typeof t=="function"&&typeof n=="function"||typeof n=="function"&&typeof arguments[3]=="function")throw new Error(Ne(0));if(typeof t=="function"&&typeof n>"u"&&(n=t,t=void 0),typeof n<"u"){if(typeof n!="function")throw new Error(Ne(1));return n(pv)(e,t)}let i=e,a=t,l=new Map,s=l,o=0,u=!1;function d(){s===l&&(s=new Map,l.forEach((S,c)=>{s.set(c,S)}))}function g(){if(u)throw new Error(Ne(3));return a}function p(S){if(typeof S!="function")throw new Error(Ne(4));if(u)throw new Error(Ne(5));let c=!0;d();const m=o++;return s.set(m,S),function(){if(c){if(u)throw new Error(Ne(6));c=!1,d(),s.delete(m),l=null}}}function h(S){if(!Vj(S))throw new Error(Ne(7));if(typeof S.type>"u")throw new Error(Ne(8));if(typeof S.type!="string")throw new Error(Ne(17));if(u)throw new Error(Ne(9));try{u=!0,a=i(a,S)}finally{u=!1}return(l=s).forEach(m=>{m()}),S}function f(S){if(typeof S!="function")throw new Error(Ne(10));i=S,h({type:$s.REPLACE})}function y(){const S=p;return{subscribe(c){if(typeof c!="object"||c===null)throw new Error(Ne(11));function m(){const b=c;b.next&&b.next(g())}return m(),{unsubscribe:S(m)}},[nh](){return this}}}return h({type:$s.INIT}),{dispatch:h,subscribe:p,getState:g,replaceReducer:f,[nh]:y}}function Kj(e){Object.keys(e).forEach(t=>{const n=e[t];if(typeof n(void 0,{type:$s.INIT})>"u")throw new Error(Ne(12));if(typeof n(void 0,{type:$s.PROBE_UNKNOWN_ACTION()})>"u")throw new Error(Ne(13))})}function ih(e){const t=Object.keys(e),n={};for(let l=0;l<t.length;l++){const s=t[l];typeof e[s]=="function"&&(n[s]=e[s])}const i=Object.keys(n);let a;try{Kj(n)}catch(l){a=l}return function(s={},o){if(a)throw a;let u=!1;const d={};for(let g=0;g<i.length;g++){const p=i[g],h=n[p],f=s[p],y=h(f,o);if(typeof y>"u")throw o&&o.type,new Error(Ne(14));d[p]=y,u=u||y!==f}return u=u||i.length!==Object.keys(s).length,u?d:s}}function Xj(e=Fi().nodes.drag,t){switch(t.type){case"DND_DRAG_START":return Object.assign(Object.assign({},e),{id:t.id,selectedIds:t.dragIds});case"DND_DRAG_END":return Object.assign(Object.assign({},e),{id:null,destinationParentId:null,destinationIndex:null,selectedIds:[]});case"DND_HOVERING":return t.parentId!==e.destinationParentId||t.index!=e.destinationIndex?Object.assign(Object.assign({},e),{destinationParentId:t.parentId,destinationIndex:t.index}):e;default:return e}}const Qj=ih({nodes:ih({focus:jx,edit:Sx,open:kx,selection:Tx,drag:Xj}),dnd:Ex}),Zj=Fi();function Jj({treeProps:e,imperativeHandle:t,children:n}){const i=x.useRef(null),a=x.useRef(null),l=x.useRef(pv(Qj,Fi(e))),s=sx.useSyncExternalStore(l.current.subscribe,l.current.getState,()=>Zj),o=x.useMemo(()=>new Ia(l.current,e,i,a),[]),u=x.useRef(0);return x.useMemo(()=>{u.current+=1,o.update(e)},Object.values(e)),x.useMemo(()=>{u.current+=1,o.update(o.props)},[s.nodes.open]),x.useImperativeHandle(t,()=>o),x.useEffect(()=>{o.props.selection?o.select(o.props.selection,{focus:!1}):o.deselectAll()},[o.props.selection]),x.useEffect(()=>{o.props.searchTerm||l.current.dispatch(hu.clear(!0))},[o.props.searchTerm]),r.jsx(Cp.Provider,{value:o,children:r.jsx(_p.Provider,{value:u.current,children:r.jsx(Op.Provider,{value:s.nodes,children:r.jsx(Dp.Provider,{value:s.dnd,children:r.jsx(Aw,Object.assign({},e.dndManager?{manager:e.dndManager}:{backend:e.dndBackend||Aj,options:{rootElement:o.props.dndRootElement||void 0}},{children:n}))})})})})}function Fj(){const e=Ke(),[,t]=lv(()=>({accept:"NODE",canDrop:(n,i)=>i.isOver({shallow:!0})?e.canDrop():!1,hover:(n,i)=>{if(!i.isOver({shallow:!0}))return;const a=i.getClientOffset();if(!e.listEl.current||!a)return;const{cursor:l,drop:s}=hv({element:e.listEl.current,offset:a,indent:e.indent,node:null,prevNode:e.visibleNodes[e.visibleNodes.length-1],nextNode:null});s&&e.dispatch(Pi.hovering(s.parentId,s.index)),i.canDrop()?l&&e.showCursor(l):e.hideCursor()},drop:(n,i)=>{if(!i.isOver({shallow:!0})||!i.canDrop())return null;e.drop()}}),[e]);t(e.listEl)}function Pj(e){return Fj(),e.children}function Wj(){const t=Ke().props.renderContainer||mv;return r.jsx(r.Fragment,{children:r.jsx(t,{})})}function ek(){const e=Ke(),{offset:t,mouse:n,item:i,isDragging:a}=nj(s=>({offset:s.getSourceClientOffset(),mouse:s.getClientOffset(),item:s.getItem(),isDragging:s.isDragging()})),l=e.props.renderDragPreview||Gp;return r.jsx(l,{offset:t,mouse:n,id:i?.id||null,dragIds:i?.dragIds||[],isDragging:a})}function tk(e={}){var t,n;const i=(t=e.idAccessor)!==null&&t!==void 0?t:"id",a=(n=e.childrenAccessor)!==null&&n!==void 0?n:"children";return{getId:typeof i=="function"?i:l=>l[i],getChildren:typeof a=="function"?a:l=>l[a],childrenKey:typeof a=="string"?a:"children"}}class nk{constructor(t,n={}){this.accessors=tk(n),this.root=ik(t,this.accessors)}get data(){var t,n;return(n=(t=this.root.children)===null||t===void 0?void 0:t.map(i=>i.data))!==null&&n!==void 0?n:[]}create(t){const n=t.parentId?this.find(t.parentId):this.root;if(!n)return null;n.addChild(t.data,t.index)}move(t){const n=this.find(t.id),i=t.parentId?this.find(t.parentId):this.root;!n||!i||(i.addChild(n.data,t.index),n.drop())}update(t){const n=this.find(t.id);n&&n.update(t.changes)}drop(t){const n=this.find(t.id);n&&n.drop()}find(t,n=this.root){if(!n)return null;if(n.id===t)return n;if(n.children){for(let i of n.children){const a=this.find(t,i);if(a)return a}return null}return null}}function ik(e,t){const n=new vv({},null,t,"ROOT");return n.children=e.map(i=>Ac(i,n,t)),n}function Ac(e,t,n){const i=new vv(e,t,n),a=n.getChildren(e);return a&&(i.children=a.map(l=>Ac(l,i,n))),i}class vv{constructor(t,n,i,a){this.data=t,this.parent=n,this.accessors=i,this.id=a??i.getId(t)}hasParent(){return!!this.parent}get childIndex(){return this.hasParent()?this.parent.children.indexOf(this):-1}addChild(t,n){var i,a;const l=Ac(t,this,this.accessors);this.children=(i=this.children)!==null&&i!==void 0?i:[],this.children.splice(n,0,l);const s=this.accessors.childrenKey,o=this.data;o[s]=(a=o[s])!==null&&a!==void 0?a:[],o[s].splice(n,0,t)}removeChild(t){var n,i;(n=this.children)===null||n===void 0||n.splice(t,1),(i=this.data[this.accessors.childrenKey])===null||i===void 0||i.splice(t,1)}update(t){if(this.hasParent()){const n=this.childIndex;this.parent.addChild(Object.assign(Object.assign({},this.data),t),n),this.drop()}}drop(){this.hasParent()&&this.parent.removeChild(this.childIndex)}}let ak=0;function lk(e,t={}){const[n,i]=x.useState(e),a=t.idAccessor,l=t.childrenAccessor,s=x.useMemo(()=>new nk(n,{idAccessor:a,childrenAccessor:l}),[n,a,l]),o=y=>{for(const v of y.dragIds)s.move({id:v,parentId:y.parentId,index:y.index});i(s.data)},u=({name:y,id:v})=>{s.update({id:v,changes:{name:y}}),i(s.data)},d=typeof a=="string"?a:"id",g=typeof l=="string"?l:"children";return[n,{onMove:o,onRename:u,onCreate:({parentId:y,index:v,type:S})=>{if(typeof a=="function")throw new Error("React Arborist => initialData can't create nodes when idAccessor is a function: the generated id can't be written under a key the accessor reads. Use a string idAccessor, or the controlled `data` prop with your own onCreate.");if(S==="internal"&&typeof l=="function")throw new Error("React Arborist => initialData can't create folder nodes when childrenAccessor is a function: the new children array can't be written under a key the accessor reads. Use a string childrenAccessor, or the controlled `data` prop with your own onCreate.");const c={[d]:`simple-tree-id-${ak++}`,name:""};return S==="internal"&&(c[g]=[]),s.create({parentId:y,index:v,data:c}),i(s.data),c},onDelete:y=>{y.ids.forEach(v=>s.drop({id:v})),i(s.data)}}]}function sk(e){if(e.initialData&&e.data)throw new Error("React Arborist Tree => Provide either a data or initialData prop, but not both.");if(e.initialData&&(e.onCreate||e.onDelete||e.onMove||e.onRename))throw new Error(`React Arborist Tree => You passed the initialData prop along with a data handler.
Use the data prop if you want to provide your own handlers.`);if(e.initialData){const[t,n]=lk(e.initialData,{idAccessor:e.idAccessor,childrenAccessor:e.childrenAccessor});return Object.assign(Object.assign(Object.assign({},e),n),{data:t})}else return e}function rk(e,t){const n=sk(e);return r.jsxs(Jj,{treeProps:n,imperativeHandle:t,children:[r.jsx(Pj,{children:r.jsx(Wj,{})}),r.jsx(ek,{})]})}const ok=x.forwardRef(rk);function zn(e,t){const n=globalThis.chrome?.runtime?.sendMessage;return n?n({kind:e,payload:t}).then(i=>i).catch(()=>{}):Promise.resolve(void 0)}const fo=["knowledge","tasks","inventory","project"],_l="knowledge";function uk(){return`ui-${Math.random().toString(36).slice(2,8)}-${Date.now()}`}function ck(e){const{enabled:t=!0,pollMs:n=1500,presenceLabel:i="session"}=e,a=x.useRef(uk()).current,[l,s]=x.useState([]),[o,u]=x.useState(0),d=x.useRef(e.onDelta);return d.current=e.onDelta,x.useEffect(()=>{if(!t)return;let g=!1,p;(async()=>{for(const f of fo)await zn("wkms/tree/subscribe_context",{scope:f,sessionId:`${a}:${f}`});await zn("wkms/tree/register_context_pointer",{scope:_l,sessionId:a,label:i})})();const h=async()=>{if(g)return;let f=0;for(const v of fo){const S=await zn("wkms/tree/poll_deltas",{sessionId:`${a}:${v}`}),c=S?.ok?S.result:void 0;c?.deltas?.length&&(f+=c.deltas.length)}f&&!g&&(u(v=>v+f),d.current()),await zn("wkms/tree/register_context_pointer",{scope:_l,sessionId:a,label:i});const y=await zn("wkms/tree/list_context_pointers",{scope:_l});y?.ok&&Array.isArray(y.result)&&!g&&s(y.result.filter(v=>v.sessionId!==a)),g||(p=setTimeout(h,n))};return p=setTimeout(h,n),()=>{g=!0,p&&clearTimeout(p);for(const f of fo)zn("wkms/tree/unsubscribe_context",{sessionId:`${a}:${f}`});zn("wkms/tree/clear_context_pointer",{scope:_l,sessionId:a})}},[t]),{presence:l,sessionId:a,deltaCount:o}}async function Al(e,t){try{return await globalThis.chrome?.runtime?.sendMessage({kind:e,payload:t})??{ok:!1,error:"no reply"}}catch(n){return{ok:!1,error:String(n?.message??n)}}}function dk({target:e,onClose:t}){const[n,i]=x.useState([]),[a,l]=x.useState([]),[s,o]=x.useState(""),[u,d]=x.useState("view"),[g,p]=x.useState(!1),[h,f]=x.useState("");async function y(){const[c,m]=await Promise.all([Al("wkms/auth/list_users"),Al("wkms/share/list_out",{ownerUuid:e.ownerUuid})]);c.ok&&c.result?i(c.result.filter(w=>w.userUuid!==e.ownerUuid)):f(`relay unreachable: ${c.error??"?"}`),m.ok&&m.result&&l(m.result.filter(w=>w.status==="active"))}x.useEffect(()=>{y()},[e.nodeId]);async function v(){const c=n.find(w=>w.userUuid===s);if(!c){f("pick a user");return}f("sharing…");const m=await Al("wkms/share/grant",{scope:e.scope,nodeId:e.nodeId,nodeName:e.nodeName,ownerUuid:e.ownerUuid,ownerName:e.ownerName,granteeUuid:c.userUuid,granteeName:c.displayName||c.username,permission:u,canClone:g});m.ok?(f(""),o(""),await y()):f(`failed: ${m.error}`)}async function S(c){await Al("wkms/share/revoke",{grantId:c}),await y()}return r.jsx("div",{"data-testid":"wkms-share-dialog-backdrop",style:{position:"fixed",inset:0,background:"rgba(0,0,0,.35)",display:"grid",placeItems:"center",zIndex:1e3},onClick:t,children:r.jsxs("div",{"data-testid":"wkms-share-dialog",style:{width:420,background:"var(--wkms-panel, #fff)",borderRadius:12,padding:20,display:"grid",gap:12,boxShadow:"0 8px 40px rgba(0,0,0,.25)"},onClick:c=>c.stopPropagation(),children:[r.jsxs("div",{style:{display:"flex",alignItems:"center"},children:[r.jsxs("h3",{style:{margin:0},children:["Share “",e.nodeName,"”"]}),r.jsx("button",{"data-testid":"wkms-share-close",style:{marginLeft:"auto"},onClick:t,children:"✕"})]}),r.jsxs("div",{style:{display:"grid",gap:8},children:[r.jsxs("select",{"data-testid":"wkms-share-user",value:s,onChange:c=>o(c.target.value),children:[r.jsx("option",{value:"",children:"— choose a user —"}),n.map(c=>r.jsxs("option",{value:c.userUuid,children:[c.displayName||c.username," (",c.username,")"]},c.userUuid))]}),r.jsxs("div",{style:{display:"flex",gap:8,alignItems:"center"},children:[r.jsxs("select",{"data-testid":"wkms-share-permission",value:u,onChange:c=>d(c.target.value),children:[r.jsx("option",{value:"view",children:"can view"}),r.jsx("option",{value:"comment",children:"can comment"}),r.jsx("option",{value:"edit",children:"can edit"}),r.jsx("option",{value:"manage",children:"can manage"})]}),r.jsxs("label",{style:{fontSize:12,display:"flex",gap:4,alignItems:"center"},children:[r.jsx("input",{"data-testid":"wkms-share-canclone",type:"checkbox",checked:g,onChange:c=>p(c.target.checked)}),"allow clone to own tree"]}),r.jsx("button",{"data-testid":"wkms-share-grant",className:"primary",style:{marginLeft:"auto"},onClick:()=>void v(),children:"Share"})]})]}),h?r.jsx("p",{"data-testid":"wkms-share-msg",style:{margin:0,fontSize:12},children:h}):null,r.jsxs("div",{style:{borderTop:"1px solid var(--wkms-border)",paddingTop:8},children:[r.jsx("div",{style:{fontSize:12,opacity:.7,marginBottom:4},children:"People with access"}),a.length===0?r.jsx("p",{"data-testid":"wkms-share-empty",style:{fontSize:12,opacity:.6,margin:0},children:"Not shared yet."}):r.jsx("table",{"data-testid":"wkms-share-grants",style:{width:"100%",fontSize:12},children:r.jsx("tbody",{children:a.map(c=>r.jsxs("tr",{"data-testid":`wkms-share-grant-${c.grantId}`,children:[r.jsx("td",{children:c.granteeName}),r.jsx("td",{children:r.jsxs("span",{className:"chip",children:[c.permission,c.canClone?" · clone":""]})}),r.jsx("td",{style:{textAlign:"right"},children:r.jsx("button",{"data-testid":`wkms-share-revoke-${c.grantId}`,onClick:()=>void S(c.grantId),children:"revoke"})})]},c.grantId))})})]})]})})}let wu=null;function Mn(e,t){const n=globalThis.chrome?.runtime?.sendMessage;return n?n({kind:e,payload:t}).then(i=>i).catch(()=>{}):Promise.resolve(void 0)}const zl=[{label:"Group",scope:"knowledge",kind:"group",root:"web-explorer"},{label:"WebSite",scope:"knowledge",kind:"website",root:"web-explorer"},{label:"SubSite",scope:"knowledge",kind:"sub_website",root:"web-explorer"},{label:"Folder",scope:"knowledge",kind:"folder",root:"file-explorer"},{label:"File",scope:"knowledge",kind:"file",root:"file-explorer"},{label:"subFile",scope:"knowledge",kind:"sub_file",root:"file-explorer"},{label:"Project",scope:"tasks",kind:"Project",root:"tasks-root"},{label:"Task",scope:"tasks",kind:"Task",root:"tasks-root"},{label:"Milestone",scope:"tasks",kind:"Milestone",root:"tasks-root"},{label:"PurchaseOrder",scope:"tasks",kind:"PurchaseOrder",root:"tasks-root"},{label:"Inventory",scope:"inventory",kind:"InventoryItem",root:"inventories-root"},{label:"Collection",scope:"inventory",kind:"InventoryCollection",root:"inventories-root"},{label:"InventoryType",scope:"inventory",kind:"InventoryType",root:"inventories-root"},{label:"Person",scope:"people",kind:"Person",root:"people-people"},{label:"Team",scope:"people",kind:"Team",root:"people-teams"},{label:"Role",scope:"people",kind:"Role",root:"people-roles"},{label:"PaymentMethod",scope:"people",kind:"PaymentMethod",root:"people-people"},{label:"ChatGroup",scope:"chat",kind:"ChatGroup",root:"chat-groups"},{label:"ChatChannel",scope:"chat",kind:"ChatChannel",root:"chat-groups"},{label:"ChatWindow",scope:"chat",kind:"ChatWindow",root:"chat-dms"}],fk={"web-explorer":"system-web","file-explorer":"system-file","tasks-root":"system-task","inventories-root":"system-inventory","people-people":"system-people","people-teams":"system-people","people-roles":"system-people","chat-groups":"system-chat","chat-dms":"system-chat"};function os(e){return e.data?.__scope??"project"}function hk({node:e,style:t,dragHandle:n}){const i=e.data,a=i.lazy===!0;return r.jsxs("div",{ref:n,className:"wkms-tree-row","data-testid":`wkms-tree-row-${i.id}`,"data-kind":i.kind,"data-scope":os(i),"data-selected":e.isSelected,style:{...t,display:"flex",alignItems:"center",gap:6,cursor:"pointer",paddingRight:8,background:e.isSelected?"var(--wkms-accent-soft, rgba(99,102,241,0.12))":void 0},onClick:()=>e.isInternal&&e.toggle(),onContextMenu:l=>{l.preventDefault(),wu?.(l,i)},children:[r.jsx("span",{className:"chevron",style:{width:12,opacity:.7},children:e.isLeaf?"·":e.isOpen?"▾":"▸"}),!a&&r.jsx("span",{className:"kind",children:i.kind}),r.jsx("span",{className:"name",title:i.name,style:{fontStyle:a?"italic":"normal",opacity:a?.6:1},children:i.name})]})}function mk({width:e,scope:t="all",onNavigate:n,session:i}){const a=wt(),l=a.treeUxFor(t);Pt(l);const[s,o]=x.useState(null),[u,d]=x.useState(null),g=x.useRef(null),[p,h]=x.useState(null),[f,y]=x.useState(""),v=x.useRef(new Map),S=x.useRef([]),c=x.useRef(-1),[m,w]=x.useState(0);x.useEffect(()=>{l.setRoots()},[t]),x.useEffect(()=>(wu=(D,N)=>{if(!i||i.offline)return;const V=N.data?.__linkScope??os(N),fe=N.data?.__linkRootId??N.id;o({scope:V,nodeId:fe,nodeName:N.name,ownerUuid:i.userUuid,ownerName:i.displayName||i.username})},()=>{wu=null}),[i]);const b=x.useMemo(()=>l.nestedTree(),[l,l.visibleRows()]),j=Math.max(400,(typeof window<"u"?window.innerHeight:800)-150),k=x.useMemo(()=>{const D={},N=V=>{for(const fe of V)fe.isExpanded&&(D[fe.id]=!0),fe.children&&N(fe.children)};return N(b),D},[b]),T=x.useRef(null);x.useEffect(()=>{const D=T.current;if(D)for(const N of Object.keys(k))D.isOpen(N)||D.open(N)},[k]);const _=D=>{for(const N of D)v.current.set(N.id,os(N)),N.children&&_(N.children)};_(b);const A=async D=>{const N=D.linkScope??D.scope,V=D.linkRootId??D.id,fe=await Mn("wkms/scope/list_children",{scope:N,parentId:V}),zt=fe?.ok&&Array.isArray(fe.result)?fe.result:[];a.grid.setCards(zt.map(Re=>({id:Re.id,title:Re.name??Re.id,url:Re.data?.url??void 0,summary:Re.data?.summary??"",tags:Re.data?.tags??[],favicon:Re.data?.favicon??void 0,snapshotPath:Re.data?.snapshotPath??void 0,thumbnail:Re.data?.thumbnail??void 0,metadata:{kind:Re.kind??"website",scope:N}})))},I=D=>{d(D),g.current=D,a.tree.selectNode(D.id),A(D)},{presence:Q,deltaCount:z}=ck({presenceLabel:"session",onDelta:()=>{l.reload();const D=g.current;D&&A(D)}}),C=D=>{const N=D[D.length-1]?.data;if(!N||N.lazy)return;const V={id:N.id,scope:os(N),kind:N.kind,name:N.name,linkScope:N.data?.linkScope,linkRootId:N.data?.linkRootId};I(V),n?.(),S.current[c.current]?.id!==V.id&&(S.current=S.current.slice(0,c.current+1),S.current.push(V),c.current=S.current.length-1,w(fe=>fe+1))},M=()=>{c.current<=0||(c.current-=1,w(D=>D+1),I(S.current[c.current]))},te=()=>{c.current>=S.current.length-1||(c.current+=1,w(D=>D+1),I(S.current[c.current]))},O=c.current>0,R=c.current<S.current.length-1,L=()=>{const D=document.createElement("input");D.type="file",D.accept="application/json,.json",D.onchange=async()=>{const N=D.files?.[0];if(!N)return;let V;try{V=JSON.parse(await N.text())}catch(zt){window.alert(`Not valid JSON: ${String(zt)}`);return}(await Mn("wkms/capture/import_json",{payload:V}))?.ok?(await l.reload(),window.alert("Imported.")):window.alert("Import failed")},D.click()},ie=async(D,N)=>{const V=zl[D];if(!V||!N.trim())return;const zt=(u?u.linkScope??u.scope:void 0)===V.scope,Re=zt?u.linkRootId??u.id:V.root;y(`Adding ${V.label}…`);const _v=i&&!i.offline?i.nodeUuid:void 0,zc=await Mn("wkms/scope/upsert",{scope:V.scope,parent_id:Re,kind:V.kind,name:N.trim(),originNodeUuid:_v});if(h(null),zc?.ok){const fr=fk[V.root];fr&&await l.expand(fr),zt&&u&&u.id!==fr&&await l.expand(u.id),await l.reload(),y(`Added ${V.label} "${N.trim()}"`)}else y(`Add failed: ${zc?.error??"?"}`)},ue=async D=>{if(!u||!D.trim())return;y("Renaming…");const N=await Mn("wkms/scope/get",{scope:u.scope,id:u.id}),V=N?.ok?N.result:void 0,fe=await Mn("wkms/scope/upsert",{scope:u.scope,id:u.id,parent_id:V?.parent_id,kind:V?.kind??u.kind,name:D.trim()});h(null),fe?.ok?(await l.reload(),d({...u,name:D.trim()}),y(`Renamed to "${D.trim()}"`)):y(`Rename failed: ${fe?.error??"?"}`)},en=async()=>{if(!u||!window.confirm(`Delete "${u.name}" and its descendants?`))return;y("Deleting…");const D=await Mn("wkms/scope/delete",{scope:u.scope,id:u.id});D?.ok?(await l.reload(),y(`Deleted "${u.name}"`),d(null)):y(`Delete failed: ${D?.error??"?"}`)},tn=async({dragIds:D,parentId:N})=>{for(const V of D){if(V.endsWith("::__lazy"))continue;const fe=v.current.get(V)??"project";if(!N){y("Drop onto a node to move (root-level move not supported here)");continue}const zt=v.current.get(N)??fe;if(zt!==fe){y(`Cross-system move (${fe}→${zt}) needs a reference link — skipped`);continue}const Re=await Mn("wkms/scope/move",{scope:fe,id:V,newParentId:N});if(!Re?.ok){y(`Move failed: ${Re?.error??"?"}`);return}}N&&await l.expand(N),await l.reload(),y("Moved")};return r.jsxs("aside",{className:"wkms-pane wkms-pane-tree",style:{width:e,position:"relative"},"data-testid":"wkms-tree-pane",children:[r.jsxs("div",{className:"wkms-pane-header",children:[r.jsxs("span",{style:{display:"flex",alignItems:"center",gap:6},children:["Tree",Q.length>0?r.jsxs("span",{"data-testid":"wkms-tree-presence",title:`${Q.length} other session(s) live`,style:{display:"inline-flex",alignItems:"center",gap:2},children:[Q.slice(0,4).map(D=>r.jsx("span",{"data-testid":`wkms-tree-presence-${D.sessionId}`,title:D.label??D.sessionId,style:{width:14,height:14,borderRadius:"50%",background:"var(--wkms-accent, #6366f1)",color:"#fff",fontSize:9,display:"inline-flex",alignItems:"center",justifyContent:"center"},children:(D.label??"?").slice(0,1).toUpperCase()},D.sessionId)),r.jsx("span",{style:{fontSize:10,opacity:.6},children:Q.length})]}):null,z>0?r.jsx("span",{"data-testid":"wkms-tree-live-badge",title:"live updates received",style:{fontSize:9,padding:"0 4px",borderRadius:6,background:"var(--wkms-accent-soft, rgba(99,102,241,0.18))"},children:"live"}):null]}),r.jsxs("div",{style:{display:"flex",gap:4},children:[r.jsx("button",{"data-testid":"wkms-tree-nav-back",title:"Back",disabled:!O,onClick:M,children:"◀"}),r.jsx("button",{"data-testid":"wkms-tree-nav-forward",title:"Forward",disabled:!R,onClick:te,children:"▶"}),r.jsx("button",{"data-testid":"wkms-tree-import-json",title:"Import a tabs JSON export",onClick:L,children:"Import"}),r.jsx("button",{"data-testid":"wkms-tree-add-node",title:"Add a node (under the selected node, or at a system root)",onClick:()=>h({mode:"add",kindIdx:0,name:""}),children:"+"}),r.jsx("button",{"data-testid":"wkms-tree-rename-node",title:"Rename the selected node",disabled:!u,onClick:()=>u&&h({mode:"rename",name:u.name}),children:"Rename"}),r.jsx("button",{"data-testid":"wkms-tree-delete-node",title:"Delete the selected node",disabled:!u,onClick:en,children:"Delete"}),r.jsx("button",{"data-testid":"wkms-tree-share-node",title:"Share the selected node with another user",disabled:!u||!i||i.offline,onClick:()=>u&&i&&o({scope:u.linkScope??u.scope,nodeId:u.linkRootId??u.id,nodeName:u.name,ownerUuid:i.userUuid,ownerName:i.displayName||i.username}),children:"Share"})]})]}),r.jsxs("div",{"data-testid":"wkms-tree-status",style:{fontSize:11,color:"var(--wkms-fg-muted)",padding:"2px 8px",minHeight:16},children:[u?`${u.scope} · ${u.kind} · ${u.name}`:f||"No selection",u&&f?` — ${f}`:""]}),r.jsx("div",{className:"wkms-pane-body","data-testid":"wkms-arborist-body",children:b.length===0?r.jsxs("div",{className:"empty","data-testid":"wkms-tree-empty",style:{padding:16,fontSize:12,color:"var(--wkms-fg-muted)"},children:["No nodes yet. Click ",r.jsx("em",{children:"Import"})," to load a tabs JSON export."]}):r.jsx(ok,{ref:T,data:b,idAccessor:"id",initialOpenState:k,openByDefault:!1,width:Math.max(160,e-4),height:j,rowHeight:28,indent:14,onToggle:D=>{D.endsWith("::__lazy")||l.expand(D)},onSelect:C,onMove:tn,children:hk})}),p?r.jsx("div",{"data-testid":"wkms-node-modal",style:{position:"absolute",inset:0,background:"rgba(0,0,0,0.35)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:50},onClick:D=>{D.target===D.currentTarget&&h(null)},children:r.jsxs("div",{style:{background:"var(--wkms-bg, #fff)",color:"var(--wkms-fg, #111)",padding:16,borderRadius:8,width:260,boxShadow:"0 8px 30px rgba(0,0,0,0.25)",display:"flex",flexDirection:"column",gap:8},children:[r.jsx("strong",{"data-testid":"wkms-node-modal-title",children:p.mode==="add"?"Add node":`Rename "${u?.name}"`}),p.mode==="add"?r.jsxs("label",{style:{fontSize:12,display:"flex",flexDirection:"column",gap:4},children:["Kind",r.jsx("select",{"data-testid":"wkms-node-modal-kind",value:p.kindIdx,onChange:D=>h({mode:"add",kindIdx:Number(D.target.value),name:p.name}),children:zl.map((D,N)=>r.jsxs("option",{value:N,children:[D.label," (",D.scope,")"]},D.label))})]}):null,r.jsxs("label",{style:{fontSize:12,display:"flex",flexDirection:"column",gap:4},children:["Name",r.jsx("input",{"data-testid":"wkms-node-modal-name",autoFocus:!0,value:p.name,onChange:D=>h(p.mode==="add"?{mode:"add",kindIdx:p.kindIdx,name:D.target.value}:{mode:"rename",name:D.target.value}),onKeyDown:D=>{D.key==="Enter"&&(p.mode==="add"?ie(p.kindIdx,p.name):ue(p.name))},placeholder:"Node name"})]}),p.mode==="add"&&u&&zl[p.kindIdx]?.scope!==u.scope?r.jsxs("span",{style:{fontSize:11,color:"var(--wkms-fg-muted)"},children:["Adds at the ",zl[p.kindIdx]?.scope," root (cross-system)."]}):null,r.jsxs("div",{style:{display:"flex",gap:6,justifyContent:"flex-end"},children:[r.jsx("button",{"data-testid":"wkms-node-modal-cancel",onClick:()=>h(null),children:"Cancel"}),r.jsx("button",{"data-testid":"wkms-node-modal-submit",className:"primary",onClick:()=>{p.mode==="add"?ie(p.kindIdx,p.name):ue(p.name)},children:p.mode==="add"?"Add":"Rename"})]})]})}):null,s?r.jsx(dk,{target:s,onClose:()=>o(null)}):null]})}function hi(e,t,n){let i=n.initialDeps??[],a,l=!0;function s(){var o,u,d;let g;n.key&&((o=n.debug)!=null&&o.call(n))&&(g=Date.now());const p=e();if(!(p.length!==i.length||p.some((y,v)=>i[v]!==y)))return a;i=p;let f;if(n.key&&((u=n.debug)!=null&&u.call(n))&&(f=Date.now()),a=t(...p),n.key&&((d=n.debug)!=null&&d.call(n))){const y=Math.round((Date.now()-g)*100)/100,v=Math.round((Date.now()-f)*100)/100,S=v/16,c=(m,w)=>{for(m=String(m);m.length<w;)m=" "+m;return m};console.info(`%c⏱ ${c(v,5)} /${c(y,5)} ms`,`
            font-size: .6rem;
            font-weight: bold;
            color: hsl(${Math.max(0,Math.min(120-120*S,120))}deg 100% 31%);`,n?.key)}return n?.onChange&&!(l&&n.skipInitialOnChange)&&n.onChange(a),l=!1,a}return s.updateDeps=o=>{i=o},s}function ah(e,t){if(e===void 0)throw new Error("Unexpected undefined");return e}const gk=(e,t)=>Math.abs(e-t)<1.01,pk=(e,t,n)=>{let i;return function(...a){e.clearTimeout(i),i=e.setTimeout(()=>t.apply(this,a),n)}},lh=e=>{const{offsetWidth:t,offsetHeight:n}=e;return{width:t,height:n}},vk=e=>e,yk=e=>{const t=Math.max(e.startIndex-e.overscan,0),n=Math.min(e.endIndex+e.overscan,e.count-1),i=[];for(let a=t;a<=n;a++)i.push(a);return i},bk=(e,t)=>{const n=e.scrollElement;if(!n)return;const i=e.targetWindow;if(!i)return;const a=s=>{const{width:o,height:u}=s;t({width:Math.round(o),height:Math.round(u)})};if(a(lh(n)),!i.ResizeObserver)return()=>{};const l=new i.ResizeObserver(s=>{const o=()=>{const u=s[0];if(u?.borderBoxSize){const d=u.borderBoxSize[0];if(d){a({width:d.inlineSize,height:d.blockSize});return}}a(lh(n))};e.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(o):o()});return l.observe(n,{box:"border-box"}),()=>{l.unobserve(n)}},sh={passive:!0},rh=typeof window>"u"?!0:"onscrollend"in window,xk=(e,t)=>{const n=e.scrollElement;if(!n)return;const i=e.targetWindow;if(!i)return;let a=0;const l=e.options.useScrollendEvent&&rh?()=>{}:pk(i,()=>{t(a,!1)},e.options.isScrollingResetDelay),s=g=>()=>{const{horizontal:p,isRtl:h}=e.options;a=p?n.scrollLeft*(h&&-1||1):n.scrollTop,l(),t(a,g)},o=s(!0),u=s(!1);n.addEventListener("scroll",o,sh);const d=e.options.useScrollendEvent&&rh;return d&&n.addEventListener("scrollend",u,sh),()=>{n.removeEventListener("scroll",o),d&&n.removeEventListener("scrollend",u)}},Sk=(e,t,n)=>{if(t?.borderBoxSize){const i=t.borderBoxSize[0];if(i)return Math.round(i[n.options.horizontal?"inlineSize":"blockSize"])}return e[n.options.horizontal?"offsetWidth":"offsetHeight"]},wk=(e,{adjustments:t=0,behavior:n},i)=>{var a,l;const s=e+t;(l=(a=i.scrollElement)==null?void 0:a.scrollTo)==null||l.call(a,{[i.options.horizontal?"left":"top"]:s,behavior:n})};class jk{constructor(t){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.scrollState=null,this.measurementsCache=[],this.itemSizeCache=new Map,this.laneAssignments=new Map,this.pendingMeasuredCacheIndexes=[],this.prevLanes=void 0,this.lanesChangedFlag=!1,this.lanesSettling=!1,this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this.scrollAdjustments=0,this.elementsCache=new Map,this.now=()=>{var n,i,a;return((a=(i=(n=this.targetWindow)==null?void 0:n.performance)==null?void 0:i.now)==null?void 0:a.call(i))??Date.now()},this.observer=(()=>{let n=null;const i=()=>n||(!this.targetWindow||!this.targetWindow.ResizeObserver?null:n=new this.targetWindow.ResizeObserver(a=>{a.forEach(l=>{const s=()=>{const o=l.target,u=this.indexFromElement(o);if(!o.isConnected){this.observer.unobserve(o);return}this.shouldMeasureDuringScroll(u)&&this.resizeItem(u,this.options.measureElement(o,l,this))};this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(s):s()})}));return{disconnect:()=>{var a;(a=i())==null||a.disconnect(),n=null},observe:a=>{var l;return(l=i())==null?void 0:l.observe(a,{box:"border-box"})},unobserve:a=>{var l;return(l=i())==null?void 0:l.unobserve(a)}}})(),this.range=null,this.setOptions=n=>{Object.entries(n).forEach(([i,a])=>{typeof a>"u"&&delete n[i]}),this.options={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:vk,rangeExtractor:yk,onChange:()=>{},measureElement:Sk,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:"data-index",initialMeasurementsCache:[],lanes:1,isScrollingResetDelay:150,enabled:!0,isRtl:!1,useScrollendEvent:!1,useAnimationFrameWithResizeObserver:!1,laneAssignmentMode:"estimate",...n}},this.notify=n=>{var i,a;(a=(i=this.options).onChange)==null||a.call(i,this,n)},this.maybeNotify=hi(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),n=>{this.notify(n)},{key:!1,debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{this.unsubs.filter(Boolean).forEach(n=>n()),this.unsubs=[],this.observer.disconnect(),this.rafId!=null&&this.targetWindow&&(this.targetWindow.cancelAnimationFrame(this.rafId),this.rafId=null),this.scrollState=null,this.scrollElement=null,this.targetWindow=null},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{var n;const i=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==i){if(this.cleanup(),!i){this.maybeNotify();return}this.scrollElement=i,this.scrollElement&&"ownerDocument"in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=((n=this.scrollElement)==null?void 0:n.window)??null,this.elementsCache.forEach(a=>{this.observer.observe(a)}),this.unsubs.push(this.options.observeElementRect(this,a=>{this.scrollRect=a,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,(a,l)=>{this.scrollAdjustments=0,this.scrollDirection=l?this.getScrollOffset()<a?"forward":"backward":null,this.scrollOffset=a,this.isScrolling=l,this.scrollState&&this.scheduleScrollReconcile(),this.maybeNotify()})),this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})}},this.rafId=null,this.getSize=()=>this.options.enabled?(this.scrollRect=this.scrollRect??this.options.initialRect,this.scrollRect[this.options.horizontal?"width":"height"]):(this.scrollRect=null,0),this.getScrollOffset=()=>this.options.enabled?(this.scrollOffset=this.scrollOffset??(typeof this.options.initialOffset=="function"?this.options.initialOffset():this.options.initialOffset),this.scrollOffset):(this.scrollOffset=null,0),this.getFurthestMeasurement=(n,i)=>{const a=new Map,l=new Map;for(let s=i-1;s>=0;s--){const o=n[s];if(a.has(o.lane))continue;const u=l.get(o.lane);if(u==null||o.end>u.end?l.set(o.lane,o):o.end<u.end&&a.set(o.lane,!0),a.size===this.options.lanes)break}return l.size===this.options.lanes?Array.from(l.values()).sort((s,o)=>s.end===o.end?s.index-o.index:s.end-o.end)[0]:void 0},this.getMeasurementOptions=hi(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled,this.options.lanes,this.options.laneAssignmentMode],(n,i,a,l,s,o,u)=>(this.prevLanes!==void 0&&this.prevLanes!==o&&(this.lanesChangedFlag=!0),this.prevLanes=o,this.pendingMeasuredCacheIndexes=[],{count:n,paddingStart:i,scrollMargin:a,getItemKey:l,enabled:s,lanes:o,laneAssignmentMode:u}),{key:!1}),this.getMeasurements=hi(()=>[this.getMeasurementOptions(),this.itemSizeCache],({count:n,paddingStart:i,scrollMargin:a,getItemKey:l,enabled:s,lanes:o,laneAssignmentMode:u},d)=>{if(!s)return this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),[];if(this.laneAssignments.size>n)for(const f of this.laneAssignments.keys())f>=n&&this.laneAssignments.delete(f);this.lanesChangedFlag&&(this.lanesChangedFlag=!1,this.lanesSettling=!0,this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),this.pendingMeasuredCacheIndexes=[]),this.measurementsCache.length===0&&!this.lanesSettling&&(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(f=>{this.itemSizeCache.set(f.key,f.size)}));const g=this.lanesSettling?0:this.pendingMeasuredCacheIndexes.length>0?Math.min(...this.pendingMeasuredCacheIndexes):0;this.pendingMeasuredCacheIndexes=[],this.lanesSettling&&this.measurementsCache.length===n&&(this.lanesSettling=!1);const p=this.measurementsCache.slice(0,g),h=new Array(o).fill(void 0);for(let f=0;f<g;f++){const y=p[f];y&&(h[y.lane]=f)}for(let f=g;f<n;f++){const y=l(f),v=this.laneAssignments.get(f);let S,c;const m=u==="estimate"||d.has(y);if(v!==void 0&&this.options.lanes>1){S=v;const k=h[S],T=k!==void 0?p[k]:void 0;c=T?T.end+this.options.gap:i+a}else{const k=this.options.lanes===1?p[f-1]:this.getFurthestMeasurement(p,f);c=k?k.end+this.options.gap:i+a,S=k?k.lane:f%this.options.lanes,this.options.lanes>1&&m&&this.laneAssignments.set(f,S)}const w=d.get(y),b=typeof w=="number"?w:this.options.estimateSize(f),j=c+b;p[f]={index:f,start:c,size:b,end:j,key:y,lane:S},h[S]=f}return this.measurementsCache=p,p},{key:!1,debug:()=>this.options.debug}),this.calculateRange=hi(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(n,i,a,l)=>this.range=n.length>0&&i>0?kk({measurements:n,outerSize:i,scrollOffset:a,lanes:l}):null,{key:!1,debug:()=>this.options.debug}),this.getVirtualIndexes=hi(()=>{let n=null,i=null;const a=this.calculateRange();return a&&(n=a.startIndex,i=a.endIndex),this.maybeNotify.updateDeps([this.isScrolling,n,i]),[this.options.rangeExtractor,this.options.overscan,this.options.count,n,i]},(n,i,a,l,s)=>l===null||s===null?[]:n({startIndex:l,endIndex:s,overscan:i,count:a}),{key:!1,debug:()=>this.options.debug}),this.indexFromElement=n=>{const i=this.options.indexAttribute,a=n.getAttribute(i);return a?parseInt(a,10):(console.warn(`Missing attribute name '${i}={index}' on measured element.`),-1)},this.shouldMeasureDuringScroll=n=>{var i;if(!this.scrollState||this.scrollState.behavior!=="smooth")return!0;const a=this.scrollState.index??((i=this.getVirtualItemForOffset(this.scrollState.lastTargetOffset))==null?void 0:i.index);if(a!==void 0&&this.range){const l=Math.max(this.options.overscan,Math.ceil((this.range.endIndex-this.range.startIndex)/2)),s=Math.max(0,a-l),o=Math.min(this.options.count-1,a+l);return n>=s&&n<=o}return!0},this.measureElement=n=>{if(!n){this.elementsCache.forEach((s,o)=>{s.isConnected||(this.observer.unobserve(s),this.elementsCache.delete(o))});return}const i=this.indexFromElement(n),a=this.options.getItemKey(i),l=this.elementsCache.get(a);l!==n&&(l&&this.observer.unobserve(l),this.observer.observe(n),this.elementsCache.set(a,n)),(!this.isScrolling||this.scrollState)&&this.shouldMeasureDuringScroll(i)&&this.resizeItem(i,this.options.measureElement(n,void 0,this))},this.resizeItem=(n,i)=>{var a;const l=this.measurementsCache[n];if(!l)return;const s=this.itemSizeCache.get(l.key)??l.size,o=i-s;o!==0&&(((a=this.scrollState)==null?void 0:a.behavior)!=="smooth"&&(this.shouldAdjustScrollPositionOnItemSizeChange!==void 0?this.shouldAdjustScrollPositionOnItemSizeChange(l,o,this):l.start<this.getScrollOffset()+this.scrollAdjustments)&&this._scrollToOffset(this.getScrollOffset(),{adjustments:this.scrollAdjustments+=o,behavior:void 0}),this.pendingMeasuredCacheIndexes.push(l.index),this.itemSizeCache=new Map(this.itemSizeCache.set(l.key,i)),this.notify(!1))},this.getVirtualItems=hi(()=>[this.getVirtualIndexes(),this.getMeasurements()],(n,i)=>{const a=[];for(let l=0,s=n.length;l<s;l++){const o=n[l],u=i[o];a.push(u)}return a},{key:!1,debug:()=>this.options.debug}),this.getVirtualItemForOffset=n=>{const i=this.getMeasurements();if(i.length!==0)return ah(i[yv(0,i.length-1,a=>ah(i[a]).start,n)])},this.getMaxScrollOffset=()=>{if(!this.scrollElement)return 0;if("scrollHeight"in this.scrollElement)return this.options.horizontal?this.scrollElement.scrollWidth-this.scrollElement.clientWidth:this.scrollElement.scrollHeight-this.scrollElement.clientHeight;{const n=this.scrollElement.document.documentElement;return this.options.horizontal?n.scrollWidth-this.scrollElement.innerWidth:n.scrollHeight-this.scrollElement.innerHeight}},this.getOffsetForAlignment=(n,i,a=0)=>{if(!this.scrollElement)return 0;const l=this.getSize(),s=this.getScrollOffset();i==="auto"&&(i=n>=s+l?"end":"start"),i==="center"?n+=(a-l)/2:i==="end"&&(n-=l);const o=this.getMaxScrollOffset();return Math.max(Math.min(o,n),0)},this.getOffsetForIndex=(n,i="auto")=>{n=Math.max(0,Math.min(n,this.options.count-1));const a=this.getSize(),l=this.getScrollOffset(),s=this.measurementsCache[n];if(!s)return;if(i==="auto")if(s.end>=l+a-this.options.scrollPaddingEnd)i="end";else if(s.start<=l+this.options.scrollPaddingStart)i="start";else return[l,i];if(i==="end"&&n===this.options.count-1)return[this.getMaxScrollOffset(),i];const o=i==="end"?s.end+this.options.scrollPaddingEnd:s.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(o,i,s.size),i]},this.scrollToOffset=(n,{align:i="start",behavior:a="auto"}={})=>{const l=this.getOffsetForAlignment(n,i),s=this.now();this.scrollState={index:null,align:i,behavior:a,startedAt:s,lastTargetOffset:l,stableFrames:0},this._scrollToOffset(l,{adjustments:void 0,behavior:a}),this.scheduleScrollReconcile()},this.scrollToIndex=(n,{align:i="auto",behavior:a="auto"}={})=>{n=Math.max(0,Math.min(n,this.options.count-1));const l=this.getOffsetForIndex(n,i);if(!l)return;const[s,o]=l,u=this.now();this.scrollState={index:n,align:o,behavior:a,startedAt:u,lastTargetOffset:s,stableFrames:0},this._scrollToOffset(s,{adjustments:void 0,behavior:a}),this.scheduleScrollReconcile()},this.scrollBy=(n,{behavior:i="auto"}={})=>{const a=this.getScrollOffset()+n,l=this.now();this.scrollState={index:null,align:"start",behavior:i,startedAt:l,lastTargetOffset:a,stableFrames:0},this._scrollToOffset(a,{adjustments:void 0,behavior:i}),this.scheduleScrollReconcile()},this.getTotalSize=()=>{var n;const i=this.getMeasurements();let a;if(i.length===0)a=this.options.paddingStart;else if(this.options.lanes===1)a=((n=i[i.length-1])==null?void 0:n.end)??0;else{const l=Array(this.options.lanes).fill(null);let s=i.length-1;for(;s>=0&&l.some(o=>o===null);){const o=i[s];l[o.lane]===null&&(l[o.lane]=o.end),s--}a=Math.max(...l.filter(o=>o!==null))}return Math.max(a-this.options.scrollMargin+this.options.paddingEnd,0)},this._scrollToOffset=(n,{adjustments:i,behavior:a})=>{this.options.scrollToFn(n,{behavior:a,adjustments:i},this)},this.measure=()=>{this.itemSizeCache=new Map,this.laneAssignments=new Map,this.notify(!1)},this.setOptions(t)}scheduleScrollReconcile(){if(!this.targetWindow){this.scrollState=null;return}this.rafId==null&&(this.rafId=this.targetWindow.requestAnimationFrame(()=>{this.rafId=null,this.reconcileScroll()}))}reconcileScroll(){if(!this.scrollState||!this.scrollElement)return;if(this.now()-this.scrollState.startedAt>5e3){this.scrollState=null;return}const i=this.scrollState.index!=null?this.getOffsetForIndex(this.scrollState.index,this.scrollState.align):void 0,a=i?i[0]:this.scrollState.lastTargetOffset,l=1,s=a!==this.scrollState.lastTargetOffset;if(!s&&gk(a,this.getScrollOffset())){if(this.scrollState.stableFrames++,this.scrollState.stableFrames>=l){this.scrollState=null;return}}else this.scrollState.stableFrames=0,s&&(this.scrollState.lastTargetOffset=a,this.scrollState.behavior="auto",this._scrollToOffset(a,{adjustments:void 0,behavior:"auto"}));this.scheduleScrollReconcile()}}const yv=(e,t,n,i)=>{for(;e<=t;){const a=(e+t)/2|0,l=n(a);if(l<i)e=a+1;else if(l>i)t=a-1;else return a}return e>0?e-1:0};function kk({measurements:e,outerSize:t,scrollOffset:n,lanes:i}){const a=e.length-1,l=u=>e[u].start;if(e.length<=i)return{startIndex:0,endIndex:a};let s=yv(0,a,l,n),o=s;if(i===1)for(;o<a&&e[o].end<n+t;)o++;else if(i>1){const u=Array(i).fill(0);for(;o<a&&u.some(g=>g<n+t);){const g=e[o];u[g.lane]=g.end,o++}const d=Array(i).fill(n+t);for(;s>=0&&d.some(g=>g>=n);){const g=e[s];d[g.lane]=g.start,s--}s=Math.max(0,s-s%i),o=Math.min(a,o+(i-1-o%i))}return{startIndex:s,endIndex:o}}const oh=typeof document<"u"?x.useLayoutEffect:x.useEffect;function Tk({useFlushSync:e=!0,...t}){const n=x.useReducer(()=>({}),{})[1],i={...t,onChange:(l,s)=>{var o;e&&s?Rh.flushSync(n):n(),(o=t.onChange)==null||o.call(t,l,s)}},[a]=x.useState(()=>new jk(i));return a.setOptions(i),oh(()=>a._didMount(),[]),oh(()=>a._willUpdate()),a}function Ek(e){return Tk({observeElementRect:bk,observeElementOffset:xk,scrollToFn:wk,...e})}const uh=60;async function bv(e,t){const n=globalThis.chrome?.runtime?.sendMessage;if(!n)return{ok:!1,error:"no runtime"};try{return await n({kind:e,payload:t})}catch(i){return{ok:!1,error:String(i)}}}function Ck({cardId:e,initialTags:t,onChange:n}){const[i,a]=x.useState([...t]),[l,s]=x.useState(!1),[o,u]=x.useState("");x.useEffect(()=>{a([...t])},[t.join(",")]);const d=async h=>{a(h),n(h),await bv("wkms/tags/update_node",{id:e,tags:h})},g=async()=>{const h=o.toLowerCase().trim();u(""),s(!1),!(!h||i.includes(h))&&await d([...i,h])},p=async h=>d(i.filter(f=>f!==h));return r.jsxs("div",{className:"tags","data-testid":`wkms-grid-tags-${e}`,onClick:h=>h.stopPropagation(),children:[i.map(h=>r.jsxs("span",{className:"chip","data-testid":`wkms-grid-tag-${e}-${h}`,style:{display:"inline-flex",alignItems:"center",gap:2},children:[h,r.jsx("button",{"data-testid":`wkms-grid-tag-remove-${e}-${h}`,onClick:()=>void p(h),style:{border:"none",background:"transparent",cursor:"pointer",padding:"0 2px",fontSize:12,color:"inherit"},title:`remove tag ${h}`,children:"×"})]},h)),l?r.jsx("input",{"data-testid":`wkms-grid-tag-input-${e}`,autoFocus:!0,value:o,onChange:h=>u(h.target.value),onKeyDown:h=>{h.key==="Enter"&&g(),h.key==="Escape"&&(u(""),s(!1))},onBlur:()=>void g(),placeholder:"tag…",style:{width:80,fontSize:11,padding:"2px 6px",border:"1px solid var(--wkms-border)",borderRadius:8}}):r.jsx("button",{"data-testid":`wkms-grid-tag-add-${e}`,onClick:()=>s(!0),className:"chip",style:{border:"1px dashed var(--wkms-border)",background:"transparent",cursor:"pointer"},title:"add tag",children:"+ tag"})]})}function Ok({id:e,snapshotPath:t}){const[n,i]=x.useState("");return x.useEffect(()=>{if(!t)return;let a=!1;return(async()=>{const l=await bv("wkms/object/get",{key:t});!a&&l.ok&&l.result?.base64&&i(`data:${l.result.mime??"image/png"};base64,${l.result.base64}`)})(),()=>{a=!0}},[t]),t?r.jsx("img",{"data-testid":`wkms-grid-snapshot-${e}`,src:n,alt:"",style:{width:"100%",maxHeight:120,objectFit:"cover",objectPosition:"top",borderRadius:4,border:"1px solid var(--wkms-border)",background:"var(--wkms-bg-elevated, #f0f0f0)",display:n?"block":"none"}}):null}function xv({c:e,selected:t,reg:n,cards:i,onOpenDetail:a}){const l=e.snapshotPath;return r.jsxs("div",{className:"wkms-card","data-testid":`wkms-grid-card-${e.id}`,"data-selected":t,onClick:s=>{s.ctrlKey||s.metaKey?n.grid.toggleSelect(e.id,{range:s.shiftKey}):a?.(e)},onContextMenu:s=>{s.preventDefault(),n.menu.open(s.clientX,s.clientY,[{id:"open-tab",label:"Open URL in new tab",run:()=>e.url?n.navigation.openTab(e.url):void 0},{id:"open-window",label:"Open in new window",run:()=>e.url?n.navigation.openTab(e.url,{newWindow:!0}):void 0},{id:"copy-url",label:"Copy URL",run:async()=>{e.url&&await navigator.clipboard.writeText(e.url).catch(()=>{})}}])},children:[r.jsxs("div",{className:"favicon-row",children:[e.favicon?r.jsx("img",{className:"favicon",src:e.favicon,alt:""}):r.jsx("span",{className:"favicon"}),r.jsx("span",{className:"title",children:e.title})]}),e.url?r.jsx("span",{className:"url",children:e.url}):null,r.jsx(Ok,{id:e.id,snapshotPath:l}),e.thumbnail&&!l?r.jsx("img",{"data-testid":`wkms-grid-thumb-${e.id}`,className:"thumbnail",src:e.thumbnail,alt:"",style:{width:"100%",maxHeight:140,objectFit:"cover",borderRadius:4,border:"1px solid var(--wkms-border)"}}):null,e.summary?r.jsx("span",{className:"summary",children:e.summary}):null,r.jsx(Ck,{cardId:e.id,initialTags:e.tags,onChange:s=>{n.grid.setCards(i.map(o=>o.id===e.id?{...o,tags:s}:o))}})]})}function Dk({cards:e,selected:t,reg:n,onOpenDetail:i}){const a=x.useRef(null),l=Ek({count:e.length,getScrollElement:()=>a.current,estimateSize:()=>200,overscan:10});return r.jsx("div",{ref:a,"data-testid":"wkms-grid-virtual",style:{height:"100%",overflow:"auto"},children:r.jsx("div",{style:{height:l.getTotalSize(),position:"relative",width:"100%"},children:l.getVirtualItems().map(s=>{const o=e[s.index];return r.jsx("div",{"data-index":s.index,ref:l.measureElement,style:{position:"absolute",top:0,left:0,width:"100%",transform:`translateY(${s.start}px)`,padding:4,boxSizing:"border-box"},children:r.jsx(xv,{c:o,selected:t.has(o.id),reg:n,cards:e,onOpenDetail:i})},o.id)})})})}function _k({onOpenDetail:e}={}){const t=wt(),n=Pt(t.grid),i=n.cards(),a=n.selectedIds();return r.jsxs("section",{className:"wkms-pane wkms-pane-grid","data-testid":"wkms-grid-pane",children:[r.jsxs("div",{className:"wkms-pane-header",children:[r.jsxs("span",{children:["Summary Browser (",i.length,")"]}),r.jsx("span",{style:{fontWeight:400},children:a.size>0?r.jsxs("button",{"data-testid":"wkms-open-selected-tabs",onClick:()=>t.navigation.openTabs(i.filter(l=>a.has(l.id)&&l.url).map(l=>l.url),{newWindow:!0}),children:["Open ",a.size," in new window"]}):null})]}),r.jsx("div",{className:"wkms-pane-body","data-virtualized":i.length>uh?"true":"false",children:i.length===0?r.jsx("div",{className:"empty",style:{padding:24,opacity:.6},children:"Click a group on the left to see its URLs."}):i.length>uh?r.jsx(Dk,{cards:i,selected:a,reg:t,onOpenDetail:e}):r.jsx("div",{className:"wkms-grid","data-testid":"wkms-grid-list",children:i.map(l=>r.jsx(xv,{c:l,selected:a.has(l.id),reg:t,cards:i,onOpenDetail:e},l.id))})})]})}function Ak({width:e}){const t=wt(),i=Pt(t.tree).selectedId(),a=Pt(t.grid),l=[...a.selectedIds()][0],s=a.cards().find(o=>o.id===l);return r.jsxs("aside",{className:"wkms-pane wkms-pane-detail",style:{width:e},"data-testid":"wkms-detail-pane",children:[r.jsx("div",{className:"wkms-pane-header",children:r.jsx("span",{children:s?"URL detail":i?"Group detail":"Detail"})}),r.jsx("div",{className:"wkms-pane-body",children:s?r.jsxs("div",{className:"wkms-detail-body",children:[r.jsx("h2",{"data-testid":"wkms-detail-title",children:s.title}),r.jsxs("div",{className:"meta",children:[s.url?r.jsx("div",{children:s.url}):null,s.tags.length?r.jsxs("div",{children:["tags: ",s.tags.join(", ")]}):null]}),s.summary?r.jsxs("div",{className:"field",children:[r.jsx("label",{children:"Summary"}),r.jsx("div",{children:s.summary})]}):r.jsx("div",{className:"empty",children:"No summary yet — run Analyze."}),r.jsxs("div",{className:"field",children:[r.jsx("label",{children:"Open"}),r.jsxs("div",{style:{display:"flex",gap:6},children:[r.jsx("button",{"data-testid":"wkms-detail-open-tab",onClick:()=>s.url?t.navigation.openTab(s.url):void 0,children:"New tab"}),r.jsx("button",{"data-testid":"wkms-detail-open-window",onClick:()=>s.url?t.navigation.openTab(s.url,{newWindow:!0}):void 0,children:"New window"})]})]})]}):i?r.jsxs("div",{className:"wkms-detail-body",children:[r.jsx("h2",{"data-testid":"wkms-detail-group-name",children:i}),r.jsx("div",{className:"empty",children:"Select a URL on the right to see details."})]}):r.jsx("div",{className:"wkms-detail-body",children:r.jsx("div",{className:"empty","data-testid":"wkms-detail-empty",children:"Pick a group on the left or a URL in the centre."})})})]})}function ch({onMouseDown:e,testId:t}){return r.jsx("div",{className:"wkms-gutter","data-testid":t,onMouseDown:e})}function zk(){const e=wt(),n=Pt(e.menu).state();return x.useEffect(()=>{if(!n.open)return;const i=()=>e.menu.close();let a=!1;queueMicrotask(()=>{a||(window.addEventListener("mousedown",i,!0),window.addEventListener("contextmenu",i,!0),window.addEventListener("keydown",l,!0))});function l(s){s.key==="Escape"&&i()}return()=>{a=!0,window.removeEventListener("mousedown",i,!0),window.removeEventListener("contextmenu",i,!0),window.removeEventListener("keydown",l,!0)}},[n.open,e.menu]),n.open?r.jsx("div",{className:"wkms-context-menu","data-testid":"wkms-context-menu",style:{left:n.x,top:n.y},onClick:i=>i.stopPropagation(),onMouseDown:i=>i.stopPropagation(),onContextMenu:i=>{i.preventDefault(),i.stopPropagation()},children:n.actions.map((i,a)=>i.separator?r.jsx("hr",{},`hr-${a}`):r.jsx("button",{"data-testid":`wkms-context-menu-${i.id}`,disabled:!!i.disabledReason,title:i.disabledReason??"",onClick:async()=>{await i.run(),e.menu.close()},children:i.label},i.id))}):null}function Mk(){wt();const[e,t]=x.useState([]),[n,i]=x.useState(),[a,l]=x.useState(""),[s,o]=x.useState(!1),[u,d]=x.useState([]);x.useEffect(()=>{g()},[]);async function g(){o(!0);try{const f=await globalThis.chrome?.runtime?.sendMessage({kind:"wkms/llm/list",payload:{query:a}});f?.ok&&Array.isArray(f.result)?t(f.result):t([]);const v=await globalThis.chrome?.runtime?.sendMessage({kind:"wkms/llm/providers"});v?.ok&&Array.isArray(v.result)&&d(v.result.filter(S=>S.kind==="llm").map(S=>S.modelId))}finally{o(!1)}}const p=e.find(h=>h.id===n);return r.jsxs("div",{className:"wkms-llm-panel","data-testid":"wkms-llm-panel",style:{display:"grid",gridTemplateColumns:"300px 1fr",height:"100%",minHeight:0},children:[r.jsxs("aside",{style:{borderRight:"1px solid var(--wkms-border)",overflow:"auto"},children:[r.jsxs("div",{className:"wkms-pane-header",children:[r.jsxs("span",{children:["LLM cache (",e.length,")"]}),r.jsx("button",{"data-testid":"wkms-llm-refresh",onClick:()=>void g(),children:s?"…":"↻"})]}),r.jsx("div",{style:{padding:"6px 8px"},children:r.jsx("input",{"data-testid":"wkms-llm-search",type:"search",placeholder:"Search prompts / responses (semantic when embedder bound)…",value:a,onChange:h=>l(h.target.value),onKeyDown:h=>{h.key==="Enter"&&g()}})}),r.jsxs("ul",{style:{listStyle:"none",padding:0,margin:0},children:[e.length===0?r.jsx("li",{"data-testid":"wkms-llm-empty",style:{padding:"12px",opacity:.6,fontSize:11},children:"No cached LLM calls yet. Run Analyze to populate."}):null,e.map(h=>r.jsxs("li",{"data-testid":`wkms-llm-row-${h.id}`,"data-selected":h.id===n,className:"wkms-tree-row",onClick:()=>i(h.id),style:{padding:"6px 10px",cursor:"pointer"},children:[r.jsx("span",{className:"kind",children:h.model_id}),r.jsxs("span",{style:{flex:1,fontSize:11,marginLeft:6,overflow:"hidden",textOverflow:"ellipsis"},title:`UID: r:${h.input_hash}`,children:[h.prompt_version," · ",r.jsxs("span",{"data-testid":`wkms-llm-uid-${h.id}`,style:{fontFamily:"var(--wkms-mono, ui-monospace)"},children:["r:",h.input_hash.slice(0,8)]})]}),r.jsxs("span",{style:{fontSize:9,opacity:.6},children:[h.input_tokens??"?","→",h.output_tokens??"?"]})]},h.id))]})]}),r.jsx("section",{style:{overflow:"auto",padding:"12px 16px"},children:p?r.jsxs("div",{style:{display:"grid",gap:12},children:[r.jsxs("header",{style:{display:"flex",alignItems:"center",gap:8,flexWrap:"wrap"},children:[r.jsx("strong",{"data-testid":"wkms-llm-detail-model",children:p.model_id}),r.jsx("span",{style:{fontSize:11,opacity:.6},children:p.created_at}),r.jsxs("code",{"data-testid":"wkms-llm-detail-uid",title:"Stable response UID — survives SW restart + NATS-KV mirror",style:{fontSize:11,padding:"2px 6px",background:"var(--wkms-chip)",borderRadius:4},children:["UID r:",p.input_hash]}),r.jsx("div",{style:{flex:1}}),r.jsx("label",{style:{fontSize:11},children:"Re-run with:"}),r.jsxs("select",{"data-testid":"wkms-llm-rerun-model",defaultValue:p.model_id,children:[u.length===0?r.jsx("option",{value:p.model_id,children:p.model_id}):null,u.map(h=>r.jsx("option",{value:h,children:h},h))]}),r.jsx("button",{"data-testid":"wkms-llm-rerun",className:"primary",children:"Re-run"})]}),r.jsxs("div",{className:"field",children:[r.jsx("label",{style:{fontSize:10,textTransform:"uppercase",opacity:.6},children:"Prompt (preview)"}),r.jsx("pre",{"data-testid":"wkms-llm-prompt",style:{whiteSpace:"pre-wrap",fontSize:11,padding:8,background:"var(--wkms-chip)",borderRadius:4},children:p.raw_preview})]}),r.jsxs("div",{className:"field",children:[r.jsx("label",{style:{fontSize:10,textTransform:"uppercase",opacity:.6},children:"Response (parsed)"}),r.jsx("pre",{"data-testid":"wkms-llm-response",style:{whiteSpace:"pre-wrap",fontSize:11,padding:8,background:"var(--wkms-chip)",borderRadius:4},children:p.parsed_preview??"(no parsed payload)"})]})]}):r.jsx("div",{className:"empty","data-testid":"wkms-llm-detail-empty",style:{opacity:.6},children:"Pick a cached LLM call to inspect."})})]})}async function Ml(e,t){const n=globalThis.chrome?.runtime?.sendMessage;if(n)try{return await n({kind:e,payload:t})}catch(i){return{ok:!1,error:String(i)}}}function Sv({card:e}={}){const t=wt(),n=Pt(t.grid),i=[...n.selectedIds()][0],a=e??n.cards().find(m=>m.id===i),[l,s]=x.useState({title:a?.title??"",heading:"",description:a?.summary??"",markdown:"",favicon:a?.favicon??""}),[o,u]=x.useState(""),[d,g]=x.useState([]),[p,h]=x.useState(""),[f,y]=x.useState("");if(x.useEffect(()=>{if(!a?.id)return;let m=!1;return(async()=>{const w=await Ml("wkms/page/detail",{id:a.id});if(m||!w?.ok)return;const b=w.result?.node,j=b?.metadata?.snapshotPath,k=await Ml("wkms/kv/get",{key:`wkms:scrape:${a.id}`});if(!m){if(k?.ok&&k.result){const T=k.result?.markdown??"",_=/^#\s+(.+)$/m.exec(T)?.[1]?.trim();s(A=>({...A,title:k.result?.title||b?.name||A.title,markdown:T||A.markdown,description:A.description||b?.comment||"",heading:A.heading||_||b?.name||""}))}if(w.result?.llmResponses?.length&&(g(w.result.llmResponses),u(w.result.llmResponses[0].modelId)),j){const T=await Ml("wkms/object/get",{key:j});!m&&T?.ok&&T.result?.base64&&y(`data:${T.result.mime??"image/png"};base64,${T.result.base64}`)}}})(),()=>{m=!0}},[a?.id]),!a)return r.jsx("div",{"data-testid":"wkms-page-detail-empty",style:{padding:24,opacity:.6},children:"Pick a URL from the grid to inspect its scraped + LLM data."});const v=async()=>{h("saving…");try{await globalThis.chrome?.runtime?.sendMessage({kind:"wkms/kv/put",key:`wkms:page:${a.id}:scrape`,value:l}),h("saved (overrides next analyze)")}catch(m){h(`error: ${String(m)}`)}},S=async m=>{h(`uploading ${m.name}…`);try{const w=new Uint8Array(await m.arrayBuffer());let b="";const j=32768;for(let A=0;A<w.length;A+=j)b+=String.fromCharCode.apply(null,Array.from(w.subarray(A,A+j)));const k=btoa(b),T=`pages/${a.id}/snapshot.png`,_=await Ml("wkms/object/put",{key:T,base64:k,mime:m.type||"image/png"});if(!_?.ok){h(`upload failed: ${_?.error??"unknown"}`);return}y(`data:${m.type||"image/png"};base64,${k}#v=${Date.now()}`),h(`screenshot replaced (${(_.result?.size??w.length).toLocaleString()} bytes)`)}catch(w){h(`error: ${String(w)}`)}},c=async m=>{u(m),await globalThis.chrome?.runtime?.sendMessage({kind:"wkms/kv/put",key:`wkms:page:${a.id}:active_response`,value:{model:m}})};return r.jsxs("div",{className:"wkms-page-detail","data-testid":"wkms-page-detail-panel",style:{padding:16,paddingBottom:48,display:"grid",gap:16,overflowY:"auto",overflowX:"hidden",height:"100%",minHeight:0,boxSizing:"border-box"},children:[r.jsxs("header",{style:{display:"flex",alignItems:"baseline",gap:8},children:[r.jsx("h2",{"data-testid":"wkms-page-detail-title",style:{margin:0,fontSize:14},children:a.title}),r.jsx("span",{style:{fontSize:11,opacity:.6},title:a.url,children:a.url}),r.jsx("span",{style:{marginLeft:"auto",fontSize:11,opacity:.7},children:p})]}),r.jsxs("section",{className:"field",children:[r.jsx("label",{style:{fontSize:10,textTransform:"uppercase",opacity:.7},children:"Scraped data (editable)"}),r.jsx("input",{"data-testid":"wkms-page-detail-heading",placeholder:"Heading",value:l.heading,onChange:m=>s({...l,heading:m.target.value})}),r.jsx("input",{"data-testid":"wkms-page-detail-description",placeholder:"Description",value:l.description,onChange:m=>s({...l,description:m.target.value})}),r.jsx("textarea",{"data-testid":"wkms-page-detail-markdown",placeholder:"Markdown — the next analyze sees this verbatim if you save.",value:l.markdown,onChange:m=>s({...l,markdown:m.target.value}),rows:8,style:{width:"100%",fontFamily:"monospace",fontSize:11,padding:8,background:"var(--wkms-chip)",border:"1px solid var(--wkms-border-strong)",borderRadius:4}}),r.jsx("button",{"data-testid":"wkms-page-detail-save",className:"primary",onClick:v,children:"Save overrides"})]}),r.jsxs("section",{className:"field",children:[r.jsx("label",{style:{fontSize:10,textTransform:"uppercase",opacity:.7},children:"Screenshot"}),f?r.jsx("img",{"data-testid":"wkms-page-detail-snapshot",src:f,alt:"page snapshot",style:{maxWidth:"100%",maxHeight:240,borderRadius:4,border:"1px solid var(--wkms-border)"}}):r.jsx("p",{style:{fontSize:11,opacity:.6,margin:0},children:"No snapshot yet — analyze captures one automatically."}),r.jsx("input",{"data-testid":"wkms-page-detail-screenshot-upload",type:"file",accept:"image/*",onChange:m=>{const w=m.target.files?.[0];w&&S(w)}}),r.jsx("p",{style:{fontSize:11,opacity:.6,margin:0},children:"System auto-captures via chrome.tabs.captureVisibleTab when the tab is open; upload replaces it. Re-analyze overwrites with a fresh capture."})]}),r.jsxs("section",{className:"field",children:[r.jsx("label",{style:{fontSize:10,textTransform:"uppercase",opacity:.7},children:"LLM responses for this URL"}),d.length===0?r.jsx("p",{"data-testid":"wkms-page-detail-no-responses",style:{fontSize:11,opacity:.6},children:"No LLM responses yet for this URL. Run Analyze with a configured provider."}):r.jsxs(r.Fragment,{children:[r.jsx("select",{"data-testid":"wkms-page-detail-active-model",value:o,onChange:m=>void c(m.target.value),children:d.map(m=>r.jsx("option",{value:m.modelId,children:m.modelId},m.modelId))}),r.jsx("pre",{"data-testid":"wkms-page-detail-active-response",style:{whiteSpace:"pre-wrap",fontSize:11,background:"var(--wkms-chip)",padding:8,borderRadius:4},children:d.find(m=>m.modelId===o)?.preview??""})]}),r.jsx("button",{"data-testid":"wkms-page-detail-fetch-responses",onClick:async()=>{const w=await globalThis.chrome?.runtime?.sendMessage({kind:"wkms/llm/responses-for-url",payload:{uid:a.id}});w?.ok&&Array.isArray(w.result)&&g(w.result)},children:"Refresh"})]}),r.jsxs("section",{className:"field",children:[r.jsx("label",{style:{fontSize:10,textTransform:"uppercase",opacity:.7},children:"UID + tags"}),r.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,flexWrap:"wrap"},children:[r.jsx("code",{"data-testid":"wkms-page-detail-uid",title:"Canonical URL-derived UID — stable across machines + SW restarts. Mirrored to NATS KV so reopening the extension reads the same record.",style:{fontSize:11,padding:"2px 6px",background:"var(--wkms-chip)",borderRadius:4},children:a.id}),r.jsx("span",{"data-testid":"wkms-page-detail-uid-source",style:{fontSize:10,opacity:.6},children:"persisted: SQL · KV · NATS-KV"})]}),r.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:4,marginTop:6},children:a.tags.map(m=>r.jsx("span",{className:"chip",children:m},m))})]})]})}function Nl(e,t){const n=globalThis.chrome?.runtime?.sendMessage;return n?n({kind:e,payload:t}).then(i=>i).catch(()=>{}):Promise.resolve(void 0)}const dh=new Set(["completed","failed","cancelled"]),Nk={completed:"#2e7d32",failed:"#c62828",cancelled:"#757575",in_progress:"#1565c0",blocked:"#ef6c00",pending:"#616161"};function Rk({card:e}){const t=e.id,[n,i]=x.useState(null),[a,l]=x.useState([]),[s,o]=x.useState(""),[u,d]=x.useState(!1),g=x.useRef(null);x.useEffect(()=>{let b=!1,j;const k=async()=>{const T=await Nl("wkms/agent/get",{taskId:t});if(b)return;T?.ok&&T.result&&i(T.result);const _=await Nl("wkms/agent/list_subtasks",{taskId:t});!b&&_?.ok&&Array.isArray(_.result)&&l(_.result);const A=T?.result?.data?.status??"pending";!b&&!dh.has(A)&&(j=setTimeout(k,1500))};return k(),()=>{b=!0,j&&clearTimeout(j)}},[t]);const p=n?.data?.turns??[];x.useEffect(()=>{g.current&&(g.current.scrollTop=g.current.scrollHeight)},[p.length]);const h=n?.data??{},f=h.state??"pending",y=h.status??"pending",v=h.intent??"",S=h.servedBy??"",c=!dh.has(y),m=async()=>{const b=s.trim();!b||u||(d(!0),o(""),i(j=>j&&{...j,data:{...j.data,turns:[...j.data?.turns??[],{id:`local-${Date.now()}`,role:"user",content:b}]}}),await Nl("wkms/agent/submit_chat",{ask:b,contextTaskId:t}),d(!1))},w=async()=>{await Nl("wkms/agent/cancel",{taskId:t})};return r.jsxs("div",{"data-testid":"wkms-agent-detail","data-state":f,style:{display:"flex",flexDirection:"column",height:"100%",boxSizing:"border-box"},children:[r.jsxs("header",{style:{display:"flex",alignItems:"center",gap:8,padding:"8px 12px",borderBottom:"1px solid var(--wkms-border-soft,#eee)"},children:[r.jsx("span",{style:{fontSize:11,padding:"2px 6px",background:"var(--wkms-chip)",borderRadius:4},children:"AgentTask"}),r.jsx("h2",{"data-testid":"wkms-agent-detail-name",style:{margin:0,fontSize:15,flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:n?.name??e.title}),r.jsx("span",{"data-testid":"wkms-agent-detail-state",style:{fontSize:11,padding:"2px 8px",borderRadius:10,color:"#fff",background:Nk[y]??"#616161"},children:f}),c?r.jsx("button",{"data-testid":"wkms-agent-detail-cancel",onClick:w,style:{fontSize:11},children:"Stop"}):null]}),r.jsxs("div",{style:{display:"flex",gap:12,fontSize:11,opacity:.7,padding:"4px 12px"},children:[v?r.jsxs("span",{"data-testid":"wkms-agent-detail-intent",children:["intent: ",v]}):null,S?r.jsxs("span",{"data-testid":"wkms-agent-detail-servedby",children:["by: ",S]}):null,r.jsxs("span",{children:["turns: ",p.length]})]}),r.jsxs("div",{ref:g,"data-testid":"wkms-agent-detail-thread",style:{flex:1,minHeight:0,overflow:"auto",padding:"8px 12px",display:"flex",flexDirection:"column",gap:8},children:[p.length===0?r.jsx("div",{style:{opacity:.5,fontSize:12},children:c?"Thinking…":"No turns yet."}):null,p.map((b,j)=>r.jsxs("div",{"data-testid":`wkms-agent-detail-turn-${j}`,"data-role":b.role,style:{alignSelf:b.role==="user"?"flex-end":"flex-start",maxWidth:"85%",background:b.role==="user"?"var(--wkms-chip)":"var(--wkms-input-bg,#f6f8fa)",border:"1px solid var(--wkms-border-soft,#eee)",borderRadius:8,padding:"6px 10px",fontSize:13,whiteSpace:"pre-wrap"},children:[r.jsx("div",{style:{fontSize:10,opacity:.5,marginBottom:2},children:b.role}),b.content]},b.id??j)),c&&p.length>0?r.jsx("div",{"data-testid":"wkms-agent-detail-pending",style:{alignSelf:"flex-start",fontSize:12,opacity:.5},children:"…"}):null]}),a.length>0?r.jsxs("div",{"data-testid":"wkms-agent-detail-subtasks",style:{borderTop:"1px solid var(--wkms-border-soft,#eee)",padding:"6px 12px",maxHeight:140,overflow:"auto"},children:[r.jsxs("div",{style:{fontSize:11,opacity:.6,marginBottom:4},children:["Spawned sub-tasks (",a.length,")"]}),a.map(b=>r.jsxs("div",{"data-testid":`wkms-agent-detail-subtask-${b.id}`,style:{display:"flex",gap:6,alignItems:"center",fontSize:12,padding:"2px 0"},children:[r.jsx("span",{style:{fontSize:10,padding:"1px 5px",background:"var(--wkms-chip)",borderRadius:4},children:b.kind}),r.jsx("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:b.name}),r.jsx("span",{style:{fontSize:10,opacity:.5},children:b.data?.status??""})]},b.id))]}):null,r.jsxs("div",{"data-testid":"wkms-agent-detail-composer",style:{display:"flex",gap:6,padding:"8px 12px",borderTop:"1px solid var(--wkms-border-soft,#eee)"},children:[r.jsx("textarea",{"data-testid":"wkms-agent-detail-input",value:s,onChange:b=>o(b.target.value),onKeyDown:b=>{b.key==="Enter"&&!b.shiftKey&&(b.preventDefault(),m())},placeholder:"Continue the conversation… (Enter to send, Shift+Enter for newline)",rows:2,style:{flex:1,resize:"none",fontSize:13,padding:"6px 8px",borderRadius:6,border:"1px solid var(--wkms-border)",background:"var(--wkms-input-bg,#fff)"}}),r.jsx("button",{"data-testid":"wkms-agent-detail-send",className:"primary",onClick:m,disabled:u||!s.trim(),children:"Send"})]})]})}function pa(e,t){const n=globalThis.chrome?.runtime?.sendMessage;return n?n({kind:e,payload:t}).then(i=>i).catch(()=>{}):Promise.resolve(void 0)}const Ik=[{id:"profile",label:"Profile"},{id:"roles",label:"Roles & Permissions"},{id:"payment",label:"Payment"},{id:"costing",label:"Costing & Availability"},{id:"assignments",label:"Assignments"}];function Ut({label:e,value:t,type:n,onCommit:i}){const a=t==null?"":String(t),[l,s]=x.useState(a);return x.useEffect(()=>{s(a)},[a]),r.jsxs("label",{style:{display:"flex",flexDirection:"column",gap:2,fontSize:12},children:[r.jsx("span",{style:{opacity:.7},children:e}),r.jsx("input",{"data-testid":`person-field-${e.toLowerCase().replace(/[^a-z]+/g,"-")}`,type:n??"text",value:l,onChange:o=>s(o.target.value),onBlur:()=>l!==a&&i(l),style:{fontSize:12,padding:"3px 6px"}})]})}function Uk({card:e}){const[t,n]=x.useState(null),[i,a]=x.useState("profile"),[l,s]=x.useState(null),[o,u]=x.useState([]),[d,g]=x.useState(null),[p,h]=x.useState(""),f=x.useCallback(async()=>{const c=await pa("wkms/scope/get",{scope:"people",id:e.id});c?.ok&&c.result&&n(c.result)},[e.id]);x.useEffect(()=>{f()},[f]),x.useEffect(()=>{i==="roles"&&!l&&pa("wkms/people/effective_permissions",{personId:e.id}).then(c=>{c?.ok&&c.result&&s(c.result)}),i==="payment"&&pa("wkms/scope/list_children",{scope:"people",parentId:e.id}).then(c=>{c?.ok&&Array.isArray(c.result)&&u(c.result.filter(m=>m.kind==="PaymentMethod"))}),i==="assignments"&&pa("wkms/people/assignments",{personId:e.id}).then(c=>{c?.ok&&c.result&&g(c.result)})},[i,e.id]);const y=t?.data??{},v=async(c,m)=>{if(!t)return;const w=await pa("wkms/scope/upsert",{scope:"people",id:t.id,parent_id:t.parent_id,kind:t.kind??"Person",name:t.name,data:{[c]:m}});w?.ok&&w.result?n(w.result):n({...t,data:{...y,[c]:m}}),h(c),setTimeout(()=>h(""),1500)},S=c=>{const m=Number(c);return Number.isFinite(m)?m:0};return r.jsxs("div",{"data-testid":"person-detail",style:{padding:16,display:"flex",flexDirection:"column",gap:12,height:"100%",boxSizing:"border-box",overflow:"auto"},children:[r.jsxs("header",{style:{display:"flex",alignItems:"baseline",gap:8},children:[r.jsx("span",{style:{fontSize:11,padding:"2px 6px",background:"var(--wkms-chip)",borderRadius:4},children:String(y.userType??"Person")}),r.jsx("h2",{style:{margin:0,fontSize:16},children:t?.name??e.title}),r.jsx("span",{style:{fontSize:12,opacity:.6},children:String(y.homeUnit??"")}),p?r.jsxs("span",{"data-testid":"person-saved",style:{fontSize:11,color:"var(--wkms-ok,#22a06b)"},children:["✓ saved ",p]}):null]}),r.jsx("nav",{"data-testid":"person-tabs",style:{display:"flex",gap:4,borderBottom:"1px solid var(--wkms-border-soft,#eee)"},children:Ik.map(c=>r.jsx("button",{"data-testid":`person-tab-${c.id}`,className:i===c.id?"primary":"",onClick:()=>a(c.id),style:{fontSize:12},children:c.label},c.id))}),i==="profile"?r.jsxs("section",{"data-testid":"person-section-profile",style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:10},children:[r.jsx(Ut,{label:"First Name",value:y.firstName,onCommit:c=>v("firstName",c)}),r.jsx(Ut,{label:"Last Name",value:y.lastName,onCommit:c=>v("lastName",c)}),r.jsx(Ut,{label:"Email",value:y.email,onCommit:c=>v("email",c)}),r.jsx(Ut,{label:"Phone",value:y.phone,onCommit:c=>v("phone",c)}),r.jsx(Ut,{label:"Home Unit",value:y.homeUnit,onCommit:c=>v("homeUnit",c)}),r.jsx(Ut,{label:"Joining Date",value:y.joiningDate,onCommit:c=>v("joiningDate",c)}),r.jsxs("label",{style:{display:"flex",flexDirection:"column",gap:2,fontSize:12},children:[r.jsx("span",{style:{opacity:.7},children:"User Type"}),r.jsx("select",{"data-testid":"person-field-usertype",value:String(y.userType??"Employee"),onChange:c=>v("userType",c.target.value),style:{fontSize:12,padding:"3px 6px"},children:["Employee","Vendor","Customer"].map(c=>r.jsx("option",{value:c,children:c},c))})]}),r.jsxs("label",{style:{display:"flex",flexDirection:"column",gap:2,fontSize:12},children:[r.jsx("span",{style:{opacity:.7},children:"Status"}),r.jsx("select",{"data-testid":"person-field-status",value:String(y.status??"Active"),onChange:c=>v("status",c.target.value),style:{fontSize:12,padding:"3px 6px"},children:["Active","Inactive"].map(c=>r.jsx("option",{value:c,children:c},c))})]})]}):i==="roles"?r.jsxs("section",{"data-testid":"person-tab-roles-body",style:{display:"flex",flexDirection:"column",gap:8,fontSize:12},children:[r.jsxs("div",{children:["Roles: ",r.jsx("strong",{"data-testid":"person-roleids",children:(y.roleIds??[]).join(", ")||"—"})]}),r.jsxs("div",{"data-testid":"person-permissions-preview",children:[r.jsx("span",{style:{opacity:.7},children:"Effective permissions (union of roles):"}),r.jsxs("div",{style:{display:"flex",flexWrap:"wrap",gap:4,marginTop:4},children:[(l?.permissions??[]).map(c=>r.jsx("span",{style:{padding:"2px 6px",background:"var(--wkms-chip)",borderRadius:4},children:c},c)),l&&l.permissions.length===0?r.jsx("em",{style:{opacity:.6},children:"none"}):null]})]})]}):i==="payment"?r.jsx("section",{"data-testid":"person-paymentmethods",style:{display:"flex",flexDirection:"column",gap:6,fontSize:12},children:o.length===0?r.jsx("em",{"data-testid":"person-payment-empty",style:{opacity:.6},children:"No payment methods."}):o.map(c=>r.jsxs("div",{"data-testid":`person-payment-${c.id}`,style:{display:"flex",gap:8,alignItems:"center",padding:"4px 8px",border:"1px solid var(--wkms-border-soft,#eee)",borderRadius:4},children:[r.jsx("span",{style:{fontWeight:600},children:c.name}),r.jsx("span",{style:{padding:"1px 5px",background:"var(--wkms-chip)",borderRadius:3},children:String(c.data?.method??"")}),r.jsxs("span",{style:{opacity:.7},children:["••••",String(c.data?.lastFour??"")]}),c.data?.isPrimary?r.jsx("span",{"data-testid":`person-payment-primary-${c.id}`,style:{color:"var(--wkms-ok,#22a06b)"},children:"★ primary"}):null]},c.id))}):i==="costing"?r.jsxs("section",{"data-testid":"person-tab-costing-body",style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:10},children:[r.jsx(Ut,{label:"Cost Rate",value:y.costRate,type:"number",onCommit:c=>v("costRate",S(c))}),r.jsx(Ut,{label:"Currency",value:y.currency,onCommit:c=>v("currency",c)}),r.jsx(Ut,{label:"Timezone",value:y.timezone,onCommit:c=>v("timezone",c)})]}):r.jsxs("section",{"data-testid":"person-tab-assignments-body",style:{fontSize:12},children:[r.jsxs("div",{"data-testid":"person-assignments-count",children:["Assigned to ",d?.count??0," task(s)"]}),r.jsx("ul",{children:(d?.tasks??[]).map(c=>r.jsxs("li",{"data-testid":`person-assignment-${c.id}`,children:[c.name," ",r.jsxs("span",{style:{opacity:.6},children:["(",c.kind," · ",c.status,")"]})]},c.id))})]}),r.jsx("code",{style:{fontSize:11,padding:"2px 6px",background:"var(--wkms-chip)",borderRadius:4,alignSelf:"flex-start"},children:e.id})]})}function Rl(e,t){const n=globalThis.chrome?.runtime?.sendMessage;return n?n({kind:e,payload:t}).then(i=>i).catch(()=>{}):Promise.resolve(void 0)}function Nn({label:e,value:t,type:n,onCommit:i}){const a=t==null?"":String(t),[l,s]=x.useState(a);return x.useEffect(()=>{s(a)},[a]),r.jsxs("label",{style:{display:"flex",flexDirection:"column",gap:2,fontSize:12},children:[r.jsx("span",{style:{opacity:.7},children:e}),r.jsx("input",{"data-testid":`task-field-${e.toLowerCase().replace(/[^a-z]+/g,"-")}`,type:n??"text",value:l,onChange:o=>s(o.target.value),onBlur:()=>l!==a&&i(l),style:{fontSize:12,padding:"3px 6px"}})]})}function Lk({card:e,kind:t}){const[n,i]=x.useState(null),[a,l]=x.useState([]),[s,o]=x.useState(null),[u,d]=x.useState("overview"),[g,p]=x.useState(""),h=x.useCallback(async()=>{const j=await Rl("wkms/scope/get",{scope:"tasks",id:e.id});j?.ok&&j.result&&i(j.result);const k=await Rl("wkms/scope/list_children",{scope:"tasks",parentId:e.id});k?.ok&&Array.isArray(k.result)&&l(k.result)},[e.id]);x.useEffect(()=>{h()},[h]);const f=n?.data??{},y=t==="PurchaseOrder"?e.id:f.poTaskUid||"";x.useEffect(()=>{(u==="costing"||t==="PurchaseOrder")&&y&&Rl("wkms/tasks/po_report",{poId:y}).then(j=>{j?.ok&&j.result&&o(j.result)})},[u,y,t]);const v=async(j,k)=>{if(!n)return;const T=await Rl("wkms/scope/upsert",{scope:"tasks",id:n.id,parent_id:n.parent_id,kind:n.kind??t,name:n.name,data:{[j]:k}});T?.ok&&T.result?i(T.result):i({...n,data:{...f,[j]:k}}),p(j),setTimeout(()=>p(""),1500)},S=j=>{const k=Number(j);return Number.isFinite(k)?k:0},c=t==="PurchaseOrder"?[["overview","Overview"],["report","PO Report"]]:t==="Milestone"?[["overview","Overview"],["structure","Rolled-up Tasks"]]:t==="Project"?[["overview","Overview"],["structure","Tasks"],["access","Access"]]:[["overview","Overview"],["structure","Subtasks & Dependencies"],["access","Assignment & Access"],["costing","Effort & Costing"]],m=f.checklist??[],w=f.dependsOn??[],b=t==="PurchaseOrder"?u==="report":u==="costing";return r.jsxs("div",{"data-testid":"task-detail","data-kind":t,style:{padding:16,display:"flex",flexDirection:"column",gap:12,height:"100%",boxSizing:"border-box",overflow:"auto"},children:[r.jsxs("header",{"data-testid":"task-detail-header",style:{display:"flex",alignItems:"baseline",gap:8,flexWrap:"wrap"},children:[r.jsx("span",{style:{fontSize:11,padding:"2px 6px",background:"var(--wkms-chip)",borderRadius:4},children:t}),r.jsx("h2",{style:{margin:0,fontSize:16},children:n?.name??e.title}),r.jsx("span",{"data-testid":"task-status",style:{fontSize:12,opacity:.7},children:String(f.status??"")}),f.severity?r.jsx("span",{"data-testid":"task-severity",style:{fontSize:11,padding:"1px 5px",background:"var(--wkms-chip)",borderRadius:3},children:String(f.severity)}):null,g?r.jsxs("span",{"data-testid":"task-saved",style:{fontSize:11,color:"var(--wkms-ok,#22a06b)"},children:["✓ saved ",g]}):null]}),r.jsx("nav",{"data-testid":"task-tabs",style:{display:"flex",gap:4,borderBottom:"1px solid var(--wkms-border-soft,#eee)"},children:c.map(([j,k])=>r.jsx("button",{"data-testid":`task-tab-${j}`,className:u===j?"primary":"",onClick:()=>d(j),style:{fontSize:12},children:k},j))}),u==="overview"?r.jsxs("section",{"data-testid":"task-tab-overview-body",style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:10},children:[r.jsx(Nn,{label:"Goal",value:f.goal,onCommit:j=>v("goal",j)}),r.jsx(Nn,{label:"Priority",value:f.priority,onCommit:j=>v("priority",j)}),r.jsx(Nn,{label:"Percent Complete",value:f.completionPercent,type:"number",onCommit:j=>v("completionPercent",S(j))}),r.jsx(Nn,{label:"Expected End",value:f.expectedEndDate,onCommit:j=>v("expectedEndDate",j)}),f.gitlabIssueUrl?r.jsxs("div",{style:{fontSize:12},children:["Issue: ",r.jsx("a",{href:String(f.gitlabIssueUrl),target:"_blank",rel:"noreferrer",children:String(f.gitlabIssueUrl)})]}):null,t==="PurchaseOrder"?r.jsxs(r.Fragment,{children:[r.jsx(Nn,{label:"PO Budget Hours",value:f.poBudgetHours,type:"number",onCommit:j=>v("poBudgetHours",S(j))}),r.jsx(Nn,{label:"PO Amount USD",value:f.poAmountUsd,type:"number",onCommit:j=>v("poAmountUsd",S(j))})]}):null]}):u==="structure"?r.jsxs("section",{"data-testid":"task-tab-structure-body",style:{display:"flex",flexDirection:"column",gap:10,fontSize:12},children:[r.jsxs("div",{children:[r.jsxs("strong",{children:["Subtasks (",a.filter(j=>j.kind==="Task").length,")"]}),r.jsx("ul",{children:a.filter(j=>j.kind==="Task").map(j=>r.jsxs("li",{"data-testid":`task-subtask-${j.id}`,children:[j.name," ",r.jsxs("span",{style:{opacity:.6},children:["(",String(j.data?.status??"")," · ",Number(j.data?.completionPercent??0),"%)"]})]},j.id))})]}),m.length>0?r.jsxs("div",{"data-testid":"task-checklist",children:[r.jsxs("strong",{children:["Checklist (",m.filter(j=>j.done).length,"/",m.length,")"]}),r.jsx("ul",{children:m.map(j=>r.jsxs("li",{children:[r.jsx("input",{type:"checkbox",checked:!!j.done,readOnly:!0})," ",j.text]},j.id))})]}):null,w.length>0?r.jsxs("div",{"data-testid":"task-dependson",children:[r.jsx("strong",{children:"Depends on"}),r.jsx("ul",{children:w.map(j=>r.jsxs("li",{children:[j.taskUid," ",r.jsxs("span",{style:{opacity:.6},children:["(≥",j.percentRequired??100,"%)"]})]},j.taskUid))})]}):null,(f.milestoneTasks??[]).length>0?r.jsxs("div",{"data-testid":"task-milestone-tasks",children:[r.jsx("strong",{children:"Rolled-up tasks"}),r.jsx("ul",{children:f.milestoneTasks.map(j=>r.jsx("li",{children:j},j))})]}):null]}):u==="access"?r.jsxs("section",{"data-testid":"task-tab-access-body",style:{display:"flex",flexDirection:"column",gap:6,fontSize:12},children:[r.jsxs("div",{"data-testid":"task-assignedto",children:["Assigned To: ",r.jsx("strong",{children:(f.assignedTo??[]).join(", ")||"—"})]}),r.jsxs("div",{children:["Assigned By: ",String(f.assignedBy??"—")]}),r.jsxs("div",{children:["Created By: ",String(f.createdBy??"—")]}),r.jsxs("div",{children:["Visible Only For: ",(f.visibleOnlyFor??[]).join(", ")||"everyone"]})]}):null,b?r.jsxs("section",{"data-testid":"task-po-report",style:{display:"flex",flexDirection:"column",gap:6,fontSize:12,marginTop:8},children:[t!=="PurchaseOrder"?r.jsx(Nn,{label:"Dev Effort Estimate",value:f.devEffortEstimate,type:"number",onCommit:j=>v("devEffortEstimate",S(j))}):null,s?r.jsxs("div",{style:{border:"1px solid var(--wkms-border-soft,#eee)",borderRadius:6,padding:10},children:[r.jsxs("div",{style:{fontWeight:600,marginBottom:4},children:["PO Report ",s.overBudget?r.jsx("span",{"data-testid":"task-po-over",style:{color:"var(--wkms-err,#d9534f)"},children:"· OVER BUDGET"}):null]}),r.jsxs("div",{"data-testid":"task-po-utilized",children:["Hours: ",s.utilizedHours," / ",s.budgetHours," used · ",s.leftHours," left"]}),r.jsxs("div",{"data-testid":"task-po-amount",children:[s.currency," ",s.utilizedAmount.toLocaleString()," / ",s.budgetAmount.toLocaleString()," · ",s.leftAmount.toLocaleString()," left"]}),r.jsx("table",{style:{marginTop:6,width:"100%",fontSize:11},children:r.jsx("tbody",{children:s.charged.map(j=>r.jsxs("tr",{"data-testid":`task-po-row-${j.taskUid}`,children:[r.jsx("td",{children:j.name}),r.jsxs("td",{style:{textAlign:"right"},children:[j.hours,"h"]}),r.jsxs("td",{style:{textAlign:"right"},children:[s.currency," ",j.amount.toLocaleString()]})]},j.taskUid))})})]}):r.jsx("em",{style:{opacity:.6},children:"No PO charge."})]}):null,r.jsx("code",{style:{fontSize:11,padding:"2px 6px",background:"var(--wkms-chip)",borderRadius:4,alignSelf:"flex-start"},children:e.id})]})}function Ai(e,t){const n=globalThis.chrome?.runtime?.sendMessage;return n?n({kind:e,payload:t}).then(i=>i).catch(()=>{}):Promise.resolve(void 0)}function de({label:e,value:t,type:n,testid:i,onCommit:a}){const l=t==null?"":String(t),[s,o]=x.useState(l);return x.useEffect(()=>{o(l)},[l]),r.jsxs("label",{style:{display:"flex",flexDirection:"column",gap:2,fontSize:12},children:[r.jsx("span",{style:{opacity:.7},children:e}),r.jsx("input",{"data-testid":i??`inv-field-${e.toLowerCase().replace(/[^a-z]+/g,"-")}`,type:n??"text",value:s,onChange:u=>o(u.target.value),onBlur:()=>s!==l&&a(s),style:{fontSize:12,padding:"3px 6px"}})]})}function wv({card:e,kind:t}){const[n,i]=x.useState(null),[a,l]=x.useState(""),[s,o]=x.useState([]),[u,d]=x.useState("overview"),[g,p]=x.useState(""),h=x.useCallback(async()=>{const b=await Ai("wkms/scope/get",{scope:"inventory",id:e.id});if(b?.ok&&b.result){i(b.result);const k=b.result.data?.inventoryType||"";if(k){const T=await Ai("wkms/scope/get",{scope:"inventory",id:k});T?.ok&&T.result&&l(T.result.name??k)}}const j=await Ai("wkms/scope/list_children",{scope:"inventory",parentId:e.id});j?.ok&&Array.isArray(j.result)&&o(j.result)},[e.id]);x.useEffect(()=>{h()},[h]);const f=n?.data??{},y=async(b,j)=>{if(!n)return;const k=await Ai("wkms/scope/upsert",{scope:"inventory",id:n.id,parent_id:n.parent_id,kind:n.kind??t,name:n.name,data:{[b]:j}});k?.ok&&k.result?i(k.result):i({...n,data:{...f,[b]:j}}),p(b),setTimeout(()=>p(""),1500)},v=b=>{const j=Number(b);return Number.isFinite(j)?j:0},S=Number(f.originalWeightVol??0),c=Number(f.leftWeightVol??0),m=S>0?Math.round(c/S*100):null,w=[["overview","Overview"],["logistics","Quantity & Logistics"],["lifecycle","Lifecycle & Valuation"],["ident","Identification"],["perms","Permissions"],["hierarchy","Hierarchy"]];return r.jsxs("div",{"data-testid":"inv-item-detail","data-kind":t,style:{padding:16,display:"flex",flexDirection:"column",gap:12,height:"100%",boxSizing:"border-box",overflow:"auto"},children:[r.jsxs("header",{style:{display:"flex",alignItems:"baseline",gap:8,flexWrap:"wrap"},children:[r.jsx("span",{style:{fontSize:11,padding:"2px 6px",background:"var(--wkms-chip)",borderRadius:4},children:t}),r.jsx("h2",{style:{margin:0,fontSize:16},children:n?.name??e.title}),r.jsx("span",{"data-testid":"inv-type-name",style:{fontSize:12,opacity:.7},children:a?`type: ${a}`:""}),r.jsx("span",{"data-testid":"inv-status",style:{fontSize:11,padding:"1px 5px",background:"var(--wkms-chip)",borderRadius:3},children:String(f.status??"")}),g?r.jsxs("span",{"data-testid":"inv-saved",style:{fontSize:11,color:"var(--wkms-ok,#22a06b)"},children:["✓ saved ",g]}):null]}),r.jsx("nav",{"data-testid":"inv-tabs",style:{display:"flex",gap:4,flexWrap:"wrap",borderBottom:"1px solid var(--wkms-border-soft,#eee)"},children:w.map(([b,j])=>r.jsx("button",{"data-testid":`inv-tab-${b}`,className:u===b?"primary":"",onClick:()=>d(b),style:{fontSize:12},children:j},b))}),u==="overview"?r.jsxs("section",{"data-testid":"inv-tab-overview-body",style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:10},children:[r.jsx(de,{label:"Inventory Code",value:f.inventoryCode,onCommit:b=>y("inventoryCode",b)}),r.jsx(de,{label:"SKU",value:f.sku,onCommit:b=>y("sku",b)}),r.jsx(de,{label:"Category",value:f.category,onCommit:b=>y("category",b)}),r.jsx(de,{label:"Status",value:f.status,onCommit:b=>y("status",b)}),r.jsx(de,{label:"Condition",value:f.condition,onCommit:b=>y("condition",b)}),r.jsxs("div",{style:{fontSize:12},children:["Type: ",r.jsx("strong",{children:a||String(f.inventoryType??"—")})]})]}):u==="logistics"?r.jsxs("section",{"data-testid":"inv-tab-logistics-body",style:{display:"flex",flexDirection:"column",gap:10},children:[r.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:10},children:[r.jsx(de,{label:"Quantity",value:f.quantity,type:"number",onCommit:b=>y("quantity",v(b))}),r.jsx(de,{label:"Unit",value:f.unit,onCommit:b=>y("unit",b)}),r.jsx(de,{label:"Movement Amount",testid:"inv-field-amount",value:f.amount,type:"number",onCommit:b=>y("amount",v(b))}),r.jsx(de,{label:"Movement Unit",value:f.amountUnit,onCommit:b=>y("amountUnit",b)}),r.jsx(de,{label:"Location",value:f.location,onCommit:b=>y("location",b)})]}),m!=null?r.jsxs("div",{"data-testid":"inv-depletion",style:{fontSize:12},children:["Depletion: ",c," / ",S," (",m,"% left)",r.jsx("div",{style:{height:8,background:"var(--wkms-chip)",borderRadius:4,marginTop:4},children:r.jsx("div",{style:{width:`${m}%`,height:"100%",background:"var(--wkms-ok,#22a06b)",borderRadius:4}})})]}):null]}):u==="lifecycle"?r.jsxs("section",{"data-testid":"inv-tab-lifecycle-body",style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:10},children:[r.jsx(de,{label:"Acquired",value:f.acquired,onCommit:b=>y("acquired",b)}),r.jsx(de,{label:"End Of Life",value:f.endOfLife,onCommit:b=>y("endOfLife",b)}),r.jsx(de,{label:"Cost",value:f.cost,type:"number",onCommit:b=>y("cost",v(b))}),r.jsx(de,{label:"Currency",value:f.currency,onCommit:b=>y("currency",b)}),r.jsx(de,{label:"Maintenance Instruction",value:f.maintenanceInstruction,onCommit:b=>y("maintenanceInstruction",b)})]}):u==="ident"?r.jsxs("section",{"data-testid":"inv-tab-ident-body",style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:10},children:[r.jsx(de,{label:"Brand",value:f.brand,onCommit:b=>y("brand",b)}),r.jsx(de,{label:"Barcode",value:f.barcode,onCommit:b=>y("barcode",b)}),r.jsxs("div",{style:{fontSize:12},children:["QR: ",f.qrCodeFileUid?String(f.qrCodeFileUid):r.jsx("em",{style:{opacity:.6},children:"not generated"})]})]}):u==="perms"?r.jsxs("section",{"data-testid":"inv-tab-perms-body",style:{display:"flex",flexDirection:"column",gap:6,fontSize:12},children:[r.jsxs("div",{"data-testid":"inv-assignedto",children:["Assigned To: ",r.jsx("strong",{children:(f.assignedTo??[]).join(", ")||"—"})]}),r.jsxs("div",{children:["Assigned By: ",String(f.assignedBy??"—")]}),r.jsxs("div",{children:["RBAC entries: ",(f.rbac??[]).length]})]}):r.jsxs("section",{"data-testid":"inv-tab-hierarchy-body",style:{fontSize:12},children:[r.jsxs("div",{children:["Parent: ",n?.parent_id??"—"]}),r.jsxs("div",{children:["Children (",s.length,"):"]}),r.jsx("ul",{children:s.map(b=>r.jsxs("li",{"data-testid":`inv-child-${b.id}`,children:[b.name," ",r.jsxs("span",{style:{opacity:.6},children:["(",b.kind,")"]})]},b.id))})]}),r.jsx("code",{style:{fontSize:11,padding:"2px 6px",background:"var(--wkms-chip)",borderRadius:4,alignSelf:"flex-start"},children:e.id})]})}function Hk({card:e}){const[t,n]=x.useState(null),[i,a]=x.useState("");x.useEffect(()=>{Ai("wkms/scope/get",{scope:"inventory",id:e.id}).then(u=>{u?.ok&&u.result&&n(u.result)})},[e.id]);const l=t?.data??{},s=async(u,d)=>{if(!t)return;const g=await Ai("wkms/scope/upsert",{scope:"inventory",id:t.id,parent_id:t.parent_id,kind:"InventoryType",name:t.name,data:{[u]:d}});g?.ok&&g.result?n(g.result):n({...t,data:{...l,[u]:d}}),a(u),setTimeout(()=>a(""),1500)},o=u=>{const d=Number(u);return Number.isFinite(d)?d:0};return r.jsxs("div",{"data-testid":"inv-type-detail",style:{padding:16,display:"flex",flexDirection:"column",gap:12,height:"100%",boxSizing:"border-box",overflow:"auto"},children:[r.jsxs("header",{style:{display:"flex",alignItems:"baseline",gap:8},children:[r.jsx("span",{style:{fontSize:11,padding:"2px 6px",background:"var(--wkms-chip)",borderRadius:4},children:"InventoryType"}),r.jsx("h2",{style:{margin:0,fontSize:16},children:t?.name??e.title}),i?r.jsxs("span",{style:{fontSize:11,color:"var(--wkms-ok,#22a06b)"},children:["✓ saved ",i]}):null]}),r.jsxs("section",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:10},children:[r.jsx(de,{label:"Type Code",value:l.typecode,onCommit:u=>s("typecode",u)}),r.jsx(de,{label:"Category",value:l.category,onCommit:u=>s("category",u)}),r.jsx(de,{label:"Default Cost",value:l.defaultCost,type:"number",onCommit:u=>s("defaultCost",o(u))}),r.jsx(de,{label:"Default Currency",value:l.defaultCurrency,onCommit:u=>s("defaultCurrency",u)}),r.jsx(de,{label:"Shelf Life",value:l.shelfLife,onCommit:u=>s("shelfLife",u)}),r.jsx(de,{label:"Maintenance Instruction",value:l.maintenanceInstruction,onCommit:u=>s("maintenanceInstruction",u)})]}),r.jsx("code",{style:{fontSize:11,padding:"2px 6px",background:"var(--wkms-chip)",borderRadius:4,alignSelf:"flex-start"},children:e.id})]})}function Bk(e,t,n){return t||["docx","xlsx","pptx","odt"].includes((n??"").toLowerCase())?"office":e==="application/pdf"||(n??"").toLowerCase()==="pdf"?"pdf":e.startsWith("image/")?"image":e.startsWith("audio/")||e.startsWith("video/")?"media":"blob"}function Il(e,t){const n=globalThis.chrome?.runtime?.sendMessage;return n?n({kind:e,payload:t}).then(i=>i).catch(()=>{}):Promise.resolve(void 0)}function Ul({label:e,value:t,onCommit:n}){const i=t==null?"":String(t),[a,l]=x.useState(i);return x.useEffect(()=>{l(i)},[i]),r.jsxs("label",{style:{display:"flex",flexDirection:"column",gap:2,fontSize:12},children:[r.jsx("span",{style:{opacity:.7},children:e}),r.jsx("input",{"data-testid":`file-field-${e.toLowerCase().replace(/[^a-z]+/g,"-")}`,value:a,onChange:s=>l(s.target.value),onBlur:()=>a!==i&&n(a),style:{fontSize:12,padding:"3px 6px"}})]})}function jv({card:e,kind:t}){const[n,i]=x.useState(null),[a,l]=x.useState("preview"),[s,o]=x.useState(""),[u,d]=x.useState(""),g=x.useCallback(async()=>{const S=await Il("wkms/scope/get",{scope:"knowledge",id:e.id});S?.ok&&S.result&&i(S.result)},[e.id]);x.useEffect(()=>{g()},[g]);const p=n?.data??{},h=String(p.mime??""),f=Bk(h,String(p.coEditDocId??""),String(p.fileFormat??""));x.useEffect(()=>{a==="preview"&&f==="image"&&!s&&Il("wkms/file/download",{fileId:e.id}).then(S=>{S?.ok&&S.result?.base64&&o(`data:${S.result.mime||h};base64,${S.result.base64}`)})},[a,f,e.id,s,h]);const y=async(S,c)=>{if(!n)return;const m=await Il("wkms/scope/upsert",{scope:"knowledge",id:n.id,parent_id:n.parent_id,kind:n.kind??t,name:n.name,data:{[S]:c}});m?.ok&&m.result?i(m.result):i({...n,data:{...p,[S]:c}}),d(S),setTimeout(()=>d(""),1500)},v=[["preview","Preview"],["metadata","Metadata"],["versions","Versions"],["content","Content & Embedding"],["links","Links"]];return r.jsxs("div",{"data-testid":"file-detail-root","data-kind":t,"data-preview-kind":f,style:{padding:16,display:"flex",flexDirection:"column",gap:12,height:"100%",boxSizing:"border-box",overflow:"auto"},children:[r.jsxs("header",{style:{display:"flex",alignItems:"baseline",gap:8,flexWrap:"wrap"},children:[r.jsx("span",{style:{fontSize:11,padding:"2px 6px",background:"var(--wkms-chip)",borderRadius:4},children:t}),r.jsx("h2",{style:{margin:0,fontSize:16},children:n?.name??e.title}),r.jsx("span",{"data-testid":"file-mime",style:{fontSize:12,opacity:.7},children:h||"—"}),p.docRole?r.jsx("span",{"data-testid":"file-docrole",style:{fontSize:11,padding:"1px 5px",background:"var(--wkms-chip)",borderRadius:3},children:String(p.docRole)}):null,u?r.jsxs("span",{style:{fontSize:11,color:"var(--wkms-ok,#22a06b)"},children:["✓ saved ",u]}):null]}),r.jsx("nav",{"data-testid":"file-tabs",style:{display:"flex",gap:4,flexWrap:"wrap",borderBottom:"1px solid var(--wkms-border-soft,#eee)"},children:v.map(([S,c])=>r.jsx("button",{"data-testid":`file-tab-${S}`,className:a===S?"primary":"",onClick:()=>l(S),style:{fontSize:12},children:c},S))}),a==="preview"?r.jsx("section",{"data-testid":"file-tab-preview","data-preview":f,style:{fontSize:12},children:f==="image"?s?r.jsx("img",{"data-testid":"file-preview-image",src:s,alt:n?.name,style:{maxWidth:"100%",maxHeight:360,borderRadius:6}}):r.jsx("em",{style:{opacity:.6},children:"loading image…"}):f==="office"?r.jsxs("div",{"data-testid":"file-preview-collabora",style:{padding:20,border:"1px dashed var(--wkms-border,#ccc)",borderRadius:6,textAlign:"center"},children:["OfficeDesk editor iframe (coEditDocId: ",String(p.coEditDocId||"—"),")"]}):f==="pdf"?r.jsx("div",{"data-testid":"file-preview-pdf",style:{padding:20,border:"1px dashed var(--wkms-border,#ccc)",borderRadius:6,textAlign:"center"},children:"PDF viewer"}):f==="media"?r.jsx("div",{"data-testid":"file-preview-media",children:"media player"}):r.jsxs("div",{"data-testid":"file-preview-blob",children:["Generic blob — ",r.jsx("button",{onClick:()=>void Il("wkms/file/download",{fileId:e.id}),children:"Download"})]})}):a==="metadata"?r.jsxs("section",{"data-testid":"file-tab-metadata",style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:10},children:[r.jsx(Ul,{label:"MIME",value:p.mime,onCommit:S=>y("mime",S)}),r.jsx(Ul,{label:"Format",value:p.fileFormat,onCommit:S=>y("fileFormat",S)}),r.jsxs("div",{"data-testid":"file-size",style:{fontSize:12},children:["Size: ",Number(p.sizeBytes??0).toLocaleString()," bytes"]}),r.jsxs("div",{"data-testid":"file-checksum",style:{fontSize:12},children:["Checksum: ",r.jsx("code",{style:{fontSize:10},children:String(p.checksum??"").slice(0,16)||"—"})]}),r.jsx(Ul,{label:"Doc Role",value:p.docRole,onCommit:S=>y("docRole",S)}),r.jsx(Ul,{label:"Owner",value:p.owner,onCommit:S=>y("owner",S)}),r.jsxs("div",{style:{fontSize:12},children:["Storage URI: ",r.jsx("code",{style:{fontSize:10},children:String(p.storageUri??"")||"—"})]})]}):a==="versions"?r.jsxs("section",{"data-testid":"file-tab-versions",style:{fontSize:12},children:[r.jsxs("div",{"data-testid":"file-version",children:["Version ",Number(p.version??1)]}),r.jsxs("div",{children:["Current URI: ",r.jsx("code",{style:{fontSize:10},children:String(p.storageUri??"")||"—"})]}),p.isPartial?r.jsxs("div",{"data-testid":"file-partial",style:{color:"var(--wkms-err,#d9534f)"},children:["Upload incomplete — chunk ",Number(p.uploadedChunkNumber??0)]}):r.jsx("div",{children:"Upload complete"})]}):a==="content"?r.jsxs("section",{"data-testid":"file-tab-content",style:{fontSize:12},children:[r.jsxs("div",{"data-testid":"file-embedding-status",children:["Embedding status: ",r.jsx("strong",{children:String(p.embeddingStatus??"pending")})]}),r.jsxs("div",{children:["Embedding hash: ",r.jsx("code",{style:{fontSize:10},children:String(p.embeddingUidHash??"")||"—"})]}),t==="sub_file"?r.jsxs("div",{children:["Fragment: ",String(p.fragmentKind??"")," #",Number(p.fragmentIndex??0)]}):null]}):r.jsxs("section",{"data-testid":"file-tab-links",style:{fontSize:12},children:[r.jsxs("div",{children:["Structural parent (host): ",n?.parent_id??"—"]}),r.jsxs("div",{children:["Owner: ",String(p.owner??"—")]})]}),r.jsx("code",{style:{fontSize:11,padding:"2px 6px",background:"var(--wkms-chip)",borderRadius:4,alignSelf:"flex-start"},children:e.id})]})}async function ho(e,t){try{return await globalThis.chrome?.runtime?.sendMessage({kind:e,payload:t})??{ok:!1,error:"no reply"}}catch(n){return{ok:!1,error:String(n?.message??n)}}}function kv({card:e,kind:t}){const n=e.metadata?.scope??"chat",[i,a]=x.useState([]),[l,s]=x.useState(""),[o,u]=x.useState(null),[d,g]=x.useState("");async function p(){const y=await ho("wkms/chat/list_messages",{channelScope:n,channelId:e.id});y.ok&&y.result&&a(y.result)}x.useEffect(()=>{p()},[e.id]);async function h(){if(!l.trim())return;const y=await ho("wkms/chat/post_message",{channelScope:n,channelId:e.id,authorUuid:"me",authorName:"me",body:l.trim()});y.ok?(s(""),await p()):g(`send failed: ${y.error}`)}async function f(){g("getting meet token…");const y=await ho("wkms/chat/join_token",{scope:n,nodeId:e.id,identity:"me",name:"me"});y.ok&&y.result?(u({room:y.result.room,wss:y.result.wssUrls[0]??""}),g(`meet ready — token ${y.result.token.length} chars for ${y.result.room}`)):g(`meet failed: ${y.error}`)}return r.jsxs("div",{"data-testid":"wkms-chat-detail",style:{display:"grid",gridTemplateRows:"auto 1fr auto",height:"100%",gap:8,padding:12},children:[r.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[r.jsx("h3",{style:{margin:0},children:e.title}),r.jsx("span",{className:"chip",children:t}),r.jsx("button",{"data-testid":"wkms-chat-join-meet",style:{marginLeft:"auto"},onClick:()=>void f(),children:"🎥 Join meet"})]}),o?r.jsxs("div",{"data-testid":"wkms-chat-meet-banner",style:{fontSize:12,padding:8,borderRadius:8,background:"var(--wkms-accent-soft, rgba(99,102,241,0.12))"},children:["LiveKit room ",r.jsx("code",{children:o.room})," @ ",r.jsx("code",{children:o.wss})," — audio/video renders via the LiveKit client on join."]}):null,r.jsx("div",{"data-testid":"wkms-chat-messages",style:{overflow:"auto",display:"grid",gap:6,alignContent:"start",border:"1px solid var(--wkms-border)",borderRadius:8,padding:8},children:i.length===0?r.jsx("p",{"data-testid":"wkms-chat-empty",style:{fontSize:12,opacity:.6,margin:0},children:"No messages yet — say hello."}):i.map(y=>r.jsxs("div",{"data-testid":`wkms-chat-msg-${y.id}`,style:{fontSize:13},children:[r.jsx("strong",{children:y.authorName??y.authorUuid??"?"})," ",r.jsx("span",{style:{opacity:.5,fontSize:11},children:y.sentAt?new Date(y.sentAt).toLocaleTimeString():""}),r.jsx("div",{children:y.body})]},y.id))}),d?r.jsx("div",{"data-testid":"wkms-chat-status",style:{fontSize:11,opacity:.7},children:d}):null,r.jsxs("div",{style:{display:"flex",gap:6},children:[r.jsx("input",{"data-testid":"wkms-chat-input",style:{flex:1},placeholder:"Message…",value:l,onChange:y=>s(y.target.value),onKeyDown:y=>{y.key==="Enter"&&h()}}),r.jsx("button",{"data-testid":"wkms-chat-send",className:"primary",onClick:()=>void h(),children:"Send"})]})]})}class $k{views=new Map;fallback=null;key(t,n){return`${t}:${n}`}register(t,n,i){this.views.set(this.key(t,n),i)}registerFallback(t){this.fallback=t}resolve(t,n){return this.views.get(this.key(t,n))??this.fallback}has(t,n){return this.views.has(this.key(t,n))}keys(){return[...this.views.keys()]}}const Xe=new $k;function Ll(e,t){const n=globalThis.chrome?.runtime?.sendMessage;return n?n({kind:e,payload:t}).then(i=>i).catch(()=>{}):Promise.resolve(void 0)}function qk(e,t){const n=new Set(Object.keys(e).filter(l=>!l.startsWith("__"))),i=t?Object.keys(t).filter(l=>!l.startsWith("__")):[],a=[];for(const l of i)n.has(l)?a.push({k:l,v:e[l],defaulted:!1,type:t?.[l]?.type}):a.push({k:l,v:t?.[l]?.default,defaulted:!0,type:t?.[l]?.type});for(const l of n)(!t||!(l in t))&&a.push({k:l,v:e[l],defaulted:!1});return a}function Yk(e,t,n){switch(e){case"number":{const i=Number(t);return Number.isFinite(i)?i:n}case"boolean":return t==="true";case"string[]":return t.split(",").map(i=>i.trim()).filter(Boolean);case"json":try{return JSON.parse(t)}catch{return t}default:return t}}function Gk({k:e,v:t,type:n,onPatch:i}){const a=Array.isArray(t)?t.join(", "):t==null?"":typeof t=="object"?JSON.stringify(t):String(t),[l,s]=x.useState(a),[o,u]=x.useState(!1);x.useEffect(()=>{s(a)},[a]);const d=async f=>{const y=n==="boolean"?f===!0:Yk(n,String(f),t);u(!0),await i(e,y),u(!1)},p={"data-testid":`wkms-kind-detail-input-${e}`,disabled:o};return n==="boolean"?r.jsx("input",{...p,type:"checkbox",checked:l==="true"||l==="1"||typeof t=="boolean"&&t,onChange:f=>{s(String(f.target.checked)),d(f.target.checked)}}):n==="json"||typeof a=="string"&&a.length>60?r.jsx("textarea",{...p,value:l,rows:3,style:{width:"100%",fontSize:12,fontFamily:n==="json"?"monospace":void 0},onChange:f=>s(f.target.value),onBlur:()=>l!==a&&void d(l)}):r.jsx("input",{...p,type:n==="number"?"number":"text",value:l,style:{width:"100%",fontSize:12,fontFamily:n==="number"?"monospace":void 0},onChange:f=>s(f.target.value),onBlur:()=>l!==a&&void d(l)})}function Tv({card:e,kind:t,scope:n}){const[i,a]=x.useState(null),[l,s]=x.useState(null),[o,u]=x.useState(null),[d,g]=x.useState("");x.useEffect(()=>{let y=!1;return(async()=>{const v=await Ll("wkms/scope/get",{scope:n,id:e.id});!y&&v?.ok&&v.result&&a(v.result);const S=v?.result?.kind??t,c=await Ll("wkms/tree/describe_kind",{scope:n,kind:S});!y&&c?.ok&&c.result?.schema&&s(c.result.schema);const m=await Ll("wkms/scope/list_children",{scope:n,parentId:e.id});!y&&m?.ok&&Array.isArray(m.result)&&u(m.result.length)})(),()=>{y=!0}},[e.id,n,t]);const p=i?.data??{},h=qk(p,l),f=async(y,v)=>{if(!i)return;const S=await Ll("wkms/scope/upsert",{scope:n,id:i.id,parent_id:i.parent_id,kind:i.kind??t,name:i.name??e.title,data:{[y]:v}});S?.ok&&S.result?a(S.result):a({...i,data:{...p,[y]:v}}),g(y),setTimeout(()=>g(""),1500)};return r.jsxs("div",{"data-testid":"wkms-kind-detail","data-editable":"true",style:{padding:16,display:"flex",flexDirection:"column",gap:12,overflow:"auto",height:"100%",boxSizing:"border-box"},children:[r.jsxs("header",{style:{display:"flex",alignItems:"baseline",gap:8},children:[r.jsx("span",{className:"kind",style:{fontSize:11,padding:"2px 6px",background:"var(--wkms-chip)",borderRadius:4},children:t}),r.jsx("h2",{"data-testid":"wkms-kind-detail-name",style:{margin:0,fontSize:16},children:i?.name??e.title}),o!=null?r.jsxs("span",{"data-testid":"wkms-kind-detail-children",style:{fontSize:12,opacity:.6},children:[o," children"]}):null,d?r.jsxs("span",{"data-testid":"wkms-kind-detail-saved",style:{fontSize:11,color:"var(--wkms-ok, #22a06b)"},children:["✓ saved ",d]}):null]}),r.jsx("table",{style:{fontSize:12,borderCollapse:"collapse",width:"100%"},children:r.jsx("tbody",{children:h.length===0?r.jsx("tr",{children:r.jsx("td",{"data-testid":"wkms-kind-detail-empty",style:{opacity:.6,padding:4},children:"No additional properties."})}):h.map(({k:y,v,defaulted:S,type:c})=>r.jsxs("tr",{"data-testid":`wkms-kind-detail-field-${y}`,"data-defaulted":S?"true":"false",style:{borderBottom:"1px solid var(--wkms-border-soft,#eee)"},children:[r.jsxs("td",{style:{padding:"4px 8px",opacity:.7,whiteSpace:"nowrap",verticalAlign:"top",width:"32%"},children:[y,S?r.jsx("span",{"data-testid":`wkms-kind-detail-default-${y}`,style:{fontSize:10,marginLeft:6,padding:"1px 4px",background:"var(--wkms-chip)",borderRadius:3,opacity:.8},children:"default"}):null]}),r.jsx("td",{style:{padding:"4px 8px"},children:r.jsx(Gk,{k:y,v,type:c,onPatch:f})})]},y))})}),r.jsx("code",{"data-testid":"wkms-kind-detail-uid",style:{fontSize:11,padding:"2px 6px",background:"var(--wkms-chip)",borderRadius:4,alignSelf:"flex-start"},children:e.id})]})}Xe.register("knowledge","website",{render:({card:e})=>r.jsx(Sv,{card:e}),label:"website detail"});Xe.register("knowledge","sub_website",{render:({card:e})=>r.jsx(Sv,{card:e}),label:"website detail"});Xe.register("tasks","AgentTask",{render:({card:e})=>r.jsx(Rk,{card:e}),label:"agent task"});Xe.register("people","Person",{render:({card:e})=>r.jsx(Uk,{card:e}),label:"person"});for(const e of["Task","Project","Milestone","PurchaseOrder"])Xe.register("tasks",e,{render:({card:t,kind:n})=>r.jsx(Lk,{card:t,kind:n}),label:e.toLowerCase()});Xe.register("inventory","InventoryItem",{render:({card:e,kind:t})=>r.jsx(wv,{card:e,kind:t}),label:"inventory item"});Xe.register("inventory","InventoryCollection",{render:({card:e,kind:t})=>r.jsx(wv,{card:e,kind:t}),label:"collection"});Xe.register("inventory","InventoryType",{render:({card:e})=>r.jsx(Hk,{card:e}),label:"inventory type"});Xe.register("knowledge","file",{render:({card:e,kind:t})=>r.jsx(jv,{card:e,kind:t}),label:"file"});Xe.register("knowledge","sub_file",{render:({card:e,kind:t})=>r.jsx(jv,{card:e,kind:t}),label:"fragment"});Xe.register("chat","ChatChannel",{render:({card:e,kind:t})=>r.jsx(kv,{card:e,kind:t}),label:"chat channel"});Xe.register("chat","ChatWindow",{render:({card:e,kind:t})=>r.jsx(kv,{card:e,kind:t}),label:"chat window"});Xe.registerFallback({render:({card:e,kind:t,scope:n})=>r.jsx(Tv,{card:e,kind:t,scope:n}),editable:!0});function Vk({card:e,onBack:t}){const n=e.metadata?.kind??"website",i=e.metadata?.scope??"knowledge",a=Xe.resolve(i,n);return r.jsxs("section",{className:"wkms-pane wkms-pane-center-detail","data-testid":"wkms-center-detail","data-kind":n,style:{flex:1,display:"flex",flexDirection:"column",minWidth:0},children:[r.jsxs("div",{className:"wkms-pane-header",style:{display:"flex",alignItems:"center",gap:8},children:[r.jsx("button",{"data-testid":"wkms-center-detail-back",onClick:t,children:"← Back to grid"}),r.jsx("span",{style:{fontSize:12,opacity:.7},children:a?.label??`${n} detail`})]}),r.jsx("div",{style:{flex:1,minHeight:0,overflow:"auto"},children:a?a.render({card:e,scope:i,kind:n}):r.jsx(Tv,{card:e,kind:n,scope:i})})]})}async function De(e,t){try{return await globalThis.chrome?.runtime?.sendMessage({kind:e,payload:t})??{ok:!1,error:"no reply"}}catch(n){return{ok:!1,error:String(n)}}}function Kk(){const[e,t]=x.useState("adapters"),[n,i]=x.useState(),[a,l]=x.useState([]),[s,o]=x.useState([]),[u,d]=x.useState(!1);async function g(){d(!0);try{const p=await De("wkms/admin/health");p.ok&&p.result&&i(p.result);const h=await De("wkms/admin/providers");h.ok&&h.result&&l(h.result)}finally{d(!1)}}return x.useEffect(()=>{g();const p=setInterval(g,5e3);return()=>clearInterval(p)},[]),x.useEffect(()=>{if(e!=="events")return;let p=!0;return(async()=>{for(;p;){const h=await De("wkms/admin/recent-events");h.ok&&h.result&&o(h.result),await new Promise(f=>setTimeout(f,1500))}})(),()=>{p=!1}},[e]),r.jsxs("div",{className:"wkms-admin","data-testid":"wkms-admin-panel",style:{display:"grid",gridTemplateRows:"auto 1fr",height:"100%",minHeight:0},children:[r.jsxs("header",{style:{display:"flex",gap:6,padding:"8px 12px",borderBottom:"1px solid var(--wkms-border)"},children:[["adapters","llms","relays","invites","audits","events","health","maintenance"].map(p=>r.jsx("button",{"data-testid":`wkms-admin-tab-${p}`,className:e===p?"primary":"",onClick:()=>t(p),children:p},p)),r.jsx("span",{style:{marginLeft:"auto",fontSize:11,opacity:.6},children:u?"refreshing…":n?`app ${n.appId??"?"}`:"—"})]}),r.jsxs("section",{style:{padding:16,overflow:"auto"},children:[e==="adapters"?r.jsx(Xk,{health:n}):null,e==="llms"?r.jsx(Qk,{providers:a,onChange:g}):null,e==="relays"?r.jsx(Wk,{}):null,e==="invites"?r.jsx(eT,{}):null,e==="audits"?r.jsx(Zk,{health:n}):null,e==="events"?r.jsx(Jk,{events:s}):null,e==="health"?r.jsx(Fk,{health:n}):null,e==="maintenance"?r.jsx(Pk,{}):null]})]})}function Xk({health:e}){const t=e?.bindings??[];return r.jsxs("div",{"data-testid":"wkms-admin-adapters",style:{display:"grid",gap:12},children:[r.jsx("h3",{style:{margin:0},children:"Adapters bound on this surface"}),r.jsxs("p",{style:{fontSize:11,opacity:.6},children:["Live snapshot from `sys.wkms.admin.health`. The ",r.jsx("strong",{children:"Impl"}),"column shows what is bound ",r.jsx("em",{children:"right now"})," on this surface — not the full fallback chain. Switch impls in the LLMs tab (for LLM) or the bootstrap config."]}),r.jsxs("table",{"data-testid":"wkms-admin-adapters-table",style:{width:"100%",fontSize:12,borderCollapse:"collapse"},children:[r.jsx("thead",{children:r.jsxs("tr",{children:[r.jsx("th",{align:"left",children:"Concern"}),r.jsx("th",{align:"left",children:"Impl (active)"}),r.jsx("th",{align:"left",children:"Notes"})]})}),r.jsxs("tbody",{children:[t.length===0?r.jsx("tr",{children:r.jsx("td",{colSpan:3,style:{padding:8,opacity:.6},children:"No binding info — older surface? Reload to fetch."})}):null,t.map(n=>r.jsxs("tr",{"data-testid":`wkms-admin-binding-${n.concern}`,children:[r.jsx("td",{children:n.concern}),r.jsx("td",{children:r.jsx("code",{style:{fontSize:11},children:n.impl})}),r.jsx("td",{style:{opacity:.75},children:n.notes??""})]},n.concern))]})]}),r.jsxs("p",{style:{fontSize:11,opacity:.6},children:["Surface: ",r.jsx("strong",{children:e?.surface??"?"})," · ",e?.registrySize??"?"," bound concerns · uptime ",Math.round(e?.uptimeSeconds??0),"s"]})]})}function Qk({providers:e,onChange:t}){const[n,i]=x.useState(null);return r.jsxs("div",{"data-testid":"wkms-admin-llms",style:{display:"grid",gap:12},children:[r.jsx("h3",{style:{margin:0},children:"LLM providers"}),r.jsx("p",{style:{fontSize:11,opacity:.6},children:"The first entry is the default. The rest are fallback chain — circuit breaker switches on N consecutive failures. Same OpenRouter key drives every member; each row is a model id."}),r.jsxs("table",{style:{width:"100%",fontSize:12,borderCollapse:"collapse"},children:[r.jsx("thead",{children:r.jsxs("tr",{children:[r.jsx("th",{align:"left",children:"id"}),r.jsx("th",{align:"left",children:"kind"}),r.jsx("th",{align:"left",children:"model"}),r.jsx("th",{align:"left",children:"tasks"}),r.jsx("th",{})]})}),r.jsxs("tbody",{children:[e.length===0?r.jsx("tr",{children:r.jsx("td",{colSpan:5,style:{opacity:.6,padding:16},children:"No providers configured — add one to enable Analyze."})}):null,e.map(a=>r.jsxs("tr",{"data-testid":`wkms-admin-llm-row-${a.id}`,children:[r.jsx("td",{children:a.id}),r.jsx("td",{children:a.kind}),r.jsx("td",{children:a.modelId}),r.jsx("td",{children:a.preferredTasks.join(", ")||"—"}),r.jsx("td",{children:r.jsx("button",{onClick:()=>i(a),children:"Edit"})})]},a.id))]})]}),r.jsx("button",{"data-testid":"wkms-admin-llm-add",onClick:()=>i({id:`prov-${Date.now().toString(36)}`,kind:"openrouter",modelId:"",preferredTasks:[]}),children:"Add provider"}),n?r.jsxs("div",{style:{border:"1px solid var(--wkms-border-strong)",padding:12,borderRadius:6,display:"grid",gap:8},children:[r.jsxs("h4",{style:{margin:0},children:[e.find(a=>a.id===n.id)?"Edit":"Add"," provider"]}),r.jsx("input",{"data-testid":"wkms-admin-llm-id",placeholder:"id",value:n.id,onChange:a=>i({...n,id:a.target.value})}),r.jsx("input",{"data-testid":"wkms-admin-llm-kind",placeholder:"kind (openrouter/ollama/anthropic)",value:n.kind,onChange:a=>i({...n,kind:a.target.value})}),r.jsx("input",{"data-testid":"wkms-admin-llm-model",placeholder:"model id (e.g. deepseek/deepseek-v4-pro)",value:n.modelId,onChange:a=>i({...n,modelId:a.target.value})}),r.jsx("input",{"data-testid":"wkms-admin-llm-tasks",placeholder:"preferred tasks (csv)",value:n.preferredTasks.join(","),onChange:a=>i({...n,preferredTasks:a.target.value.split(",").map(l=>l.trim()).filter(Boolean)})}),r.jsx("input",{"data-testid":"wkms-admin-llm-baseurl",placeholder:"base url (optional)",value:n.baseUrl??"",onChange:a=>i({...n,baseUrl:a.target.value||void 0})}),r.jsx("input",{"data-testid":"wkms-admin-llm-keyref",placeholder:"apiKeyRef (KV key holding the secret)",value:n.apiKeyRef??"",onChange:a=>i({...n,apiKeyRef:a.target.value||void 0})}),r.jsxs("div",{style:{display:"flex",gap:6},children:[r.jsx("button",{className:"primary","data-testid":"wkms-admin-llm-save",onClick:async()=>{await De("wkms/admin/providers/upsert",n),i(null),t()},children:"Save"}),r.jsx("button",{onClick:()=>i(null),children:"Cancel"}),r.jsx("button",{"data-testid":"wkms-admin-llm-delete",onClick:async()=>{window.confirm(`Delete provider ${n.id}?`)&&(await De("wkms/admin/providers/delete",{id:n.id}),i(null),t())},children:"Delete"})]})]}):null]})}function Zk({health:e}){const t=e?.llmAudit;return r.jsxs("div",{"data-testid":"wkms-admin-audits",style:{display:"grid",gap:12},children:[r.jsx("h3",{style:{margin:0},children:"LLM audit rollup"}),t?r.jsxs(r.Fragment,{children:[r.jsxs("div",{style:{display:"flex",gap:16,fontSize:12},children:[r.jsxs("span",{children:[r.jsx("strong",{children:t.totalCalls})," calls"]}),r.jsxs("span",{children:["cost ≈ ",r.jsxs("strong",{children:["$",t.totalCostUsd.toFixed(4)]})]})]}),r.jsxs("table",{style:{fontSize:12,borderCollapse:"collapse"},children:[r.jsx("thead",{children:r.jsxs("tr",{children:[r.jsx("th",{align:"left",children:"model"}),r.jsx("th",{align:"right",children:"calls"}),r.jsx("th",{align:"right",children:"tokens"}),r.jsx("th",{align:"right",children:"cost ($)"})]})}),r.jsx("tbody",{children:t.byModel.map(n=>r.jsxs("tr",{children:[r.jsx("td",{children:n.modelId}),r.jsx("td",{align:"right",children:n.calls}),r.jsx("td",{align:"right",children:n.tokens.toLocaleString()}),r.jsx("td",{align:"right",children:n.costUsd.toFixed(4)})]},n.modelId))})]})]}):r.jsx("p",{style:{opacity:.6},children:"No audit rows yet. Run Analyze."})]})}function Jk({events:e}){return r.jsxs("div",{"data-testid":"wkms-admin-events",style:{display:"grid",gap:8},children:[r.jsx("h3",{style:{margin:0},children:"Recent bus events (last 50)"}),r.jsxs("ol",{style:{fontSize:11,fontFamily:"monospace",listStyle:"decimal-leading-zero inside",padding:0},children:[e.length===0?r.jsx("li",{style:{opacity:.6},children:"(empty)"}):null,e.map((t,n)=>r.jsx("li",{children:t},n))]})]})}function Fk({health:e}){return e?r.jsxs("div",{"data-testid":"wkms-admin-health",style:{display:"grid",gap:8,fontSize:12},children:[r.jsxs("div",{children:[r.jsx("strong",{children:"ts"})," ",e.ts]}),r.jsxs("div",{children:[r.jsx("strong",{children:"surface"})," ",e.surface]}),r.jsxs("div",{children:[r.jsx("strong",{children:"app id"})," ",e.appId??"—"]}),r.jsxs("div",{children:[r.jsx("strong",{children:"uptime"})," ",e.uptimeSeconds.toFixed(1)," s"]}),r.jsxs("div",{children:[r.jsx("strong",{children:"registry size"})," ",e.registrySize]}),r.jsxs("div",{children:[r.jsx("strong",{children:"durable tasks"})," running=",e.durableTasks?.running??0," · failed=",e.durableTasks?.failed??0," · completed=",e.durableTasks?.completed??0]}),r.jsxs("div",{children:[r.jsx("strong",{children:"fileKv bucket"})," ",e.bucketIdentifiers?.fileKv??"—"]}),r.jsxs("div",{children:[r.jsx("strong",{children:"llmKv bucket"})," ",e.bucketIdentifiers?.llmKv??"—"]})]}):r.jsx("p",{style:{opacity:.6},"data-testid":"wkms-admin-health-empty",children:"Loading…"})}function Pk(){const[e,t]=x.useState(),[n,i]=x.useState(),[a,l]=x.useState(!1),[s,o]=x.useState(null);return r.jsxs("div",{"data-testid":"wkms-admin-maintenance",style:{display:"grid",gap:12},children:[r.jsx("h3",{style:{margin:0},children:"Maintenance"}),r.jsx("button",{"data-testid":"wkms-admin-maintenance-run",className:"primary",onClick:async()=>{const u=await De("wkms/maintenance-run",{llmCacheTtlDays:30,captureBatchTtlDays:60,archive:!0});t(u)},children:"Run maintenance now (archive + evict expired)"}),r.jsx("pre",{style:{fontSize:11,background:"var(--wkms-chip)",padding:8,borderRadius:4},children:e?JSON.stringify(e,null,2):"(click Run to archive + evict expired rows)"}),r.jsx("hr",{style:{width:"100%",opacity:.3}}),r.jsx("h3",{style:{margin:0},children:"Tags"}),a?r.jsxs("div",{style:{display:"flex",gap:8,alignItems:"center"},children:[r.jsx("span",{style:{fontSize:12},children:"This wipes every node's tags AND every capture batch's user_tags. Re-analyze will derive new tags from content. Continue?"}),r.jsx("button",{"data-testid":"wkms-admin-clear-tags-confirm",className:"primary",onClick:async()=>{const u=await De("wkms/tags/clear_all",{});i(u),l(!1);try{window.dispatchEvent(new CustomEvent("wkms:tags:cleared"))}catch{}},children:"Yes, clear all"}),r.jsx("button",{"data-testid":"wkms-admin-clear-tags-cancel",onClick:()=>l(!1),children:"Cancel"})]}):r.jsx("button",{"data-testid":"wkms-admin-clear-tags",onClick:()=>l(!0),children:"Clear all tags (admin)"}),r.jsx("pre",{style:{fontSize:11,background:"var(--wkms-chip)",padding:8,borderRadius:4},children:n?JSON.stringify(n,null,2):"(tags reset only — re-run Analyze to derive new tags from content)"}),r.jsx("hr",{style:{width:"100%",opacity:.3}}),r.jsx("h3",{style:{margin:0},children:"Smart-group dedup log"}),r.jsx("button",{"data-testid":"wkms-admin-dedup-fetch",onClick:async()=>{const u=await De("wkms/smart_groups/dedup_log",{});o(u?.result??null)},children:"Fetch last dedup pass"}),s&&s.mapping&&Object.keys(s.mapping).length>0?r.jsxs("div",{"data-testid":"wkms-admin-dedup-log",style:{display:"grid",gap:4,fontSize:11},children:[r.jsxs("div",{children:[r.jsx("strong",{children:s.candidates??0})," candidates → ",r.jsx("strong",{children:s.kept??0})," kept · llmEscalated: ",s.llmInvoked?"yes":"no"," · ts: ",s.ts??"—"]}),r.jsxs("table",{style:{width:"100%",borderCollapse:"collapse"},children:[r.jsx("thead",{children:r.jsxs("tr",{children:[r.jsx("th",{align:"left",children:"raw name"}),r.jsx("th",{align:"left",children:"→ canonical"}),r.jsx("th",{align:"left",children:"reason"})]})}),r.jsx("tbody",{children:Object.entries(s.mapping).map(([u,d])=>r.jsxs("tr",{"data-testid":`wkms-admin-dedup-row-${u}`,children:[r.jsx("td",{children:r.jsx("code",{children:u})}),r.jsx("td",{children:u===d?r.jsx("em",{style:{opacity:.5},children:"kept"}):r.jsx("strong",{children:d})}),r.jsx("td",{children:r.jsx("span",{className:"chip",children:s.reason?.[u]??"—"})})]},u))})]})]}):r.jsx("p",{"data-testid":"wkms-admin-dedup-empty",style:{fontSize:11,opacity:.6},children:s?"(no dedup pass run yet — Analyze with dedup:true to populate)":"(click Fetch to load)"})]})}function Wk(){const[e,t]=x.useState([]),[n,i]=x.useState([]),[a,l]=x.useState(null),[s,o]=x.useState("");async function u(){const h=await De("wkms/relay/list");h.ok&&h.result&&(t(h.result.relays),i(h.result.order))}x.useEffect(()=>{u()},[]);async function d(){if(!a)return;const h=await De("wkms/relay/upsert",a);h.ok?(l(null),await u()):o(`save failed: ${h.error}`)}async function g(h){(await De("wkms/relay/delete",{id:h})).ok&&await u()}async function p(h){o("testing…");const f=await De("wkms/relay/test",h?{id:h}:{});o(f.ok&&f.result?`connected ${f.result.server} (domain ${f.result.domain}) in ${f.result.connectMs}ms`:`FAILED: ${f.error}`)}return r.jsxs("div",{"data-testid":"wkms-admin-relays",style:{display:"grid",gap:12},children:[r.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[r.jsx("h3",{style:{margin:0},children:"Relay servers"}),r.jsxs("span",{className:"chip","data-testid":"wkms-admin-relay-order",children:["failover: ",n.join(" → ")||"—"]}),r.jsx("button",{"data-testid":"wkms-admin-relay-test-all",onClick:()=>void p(),children:"Test failover list"}),r.jsx("button",{"data-testid":"wkms-admin-relay-add",onClick:()=>l({id:"",name:"",wssUrl:"wss://",user:"wkmsreact",pass:"",jsDomain:"",role:"secondary",enabled:!0}),children:"+ Add relay"})]}),s?r.jsx("p",{"data-testid":"wkms-admin-relay-test-result",style:{fontSize:11,margin:0},children:s}):null,r.jsxs("table",{"data-testid":"wkms-admin-relays-table",style:{width:"100%",fontSize:12,borderCollapse:"collapse"},children:[r.jsx("thead",{children:r.jsxs("tr",{style:{textAlign:"left",opacity:.7},children:[r.jsx("th",{children:"id"}),r.jsx("th",{children:"role"}),r.jsx("th",{children:"wss endpoint"}),r.jsx("th",{children:"js domain"}),r.jsx("th",{children:"enabled"}),r.jsx("th",{})]})}),r.jsx("tbody",{children:e.map(h=>r.jsxs("tr",{"data-testid":`wkms-admin-relay-row-${h.id}`,children:[r.jsx("td",{children:r.jsx("code",{children:h.id})}),r.jsx("td",{children:h.role}),r.jsx("td",{style:{maxWidth:260,overflow:"hidden",textOverflow:"ellipsis"},children:h.wssUrl}),r.jsx("td",{children:h.jsDomain}),r.jsx("td",{children:h.enabled?"✓":"—"}),r.jsxs("td",{style:{display:"flex",gap:4},children:[r.jsx("button",{"data-testid":`wkms-admin-relay-test-${h.id}`,onClick:()=>void p(h.id),children:"test"}),r.jsx("button",{"data-testid":`wkms-admin-relay-edit-${h.id}`,onClick:()=>l({...h}),children:"edit"}),r.jsx("button",{"data-testid":`wkms-admin-relay-delete-${h.id}`,onClick:()=>void g(h.id),children:"✕"})]})]},h.id))})]}),a?r.jsxs("div",{"data-testid":"wkms-admin-relay-editor",style:{display:"grid",gap:6,maxWidth:460,padding:12,border:"1px solid var(--wkms-border)",borderRadius:8},children:[r.jsx("input",{"data-testid":"wkms-admin-relay-id",placeholder:"id (= js domain, e.g. intn2)",value:a.id,onChange:h=>l({...a,id:h.target.value,jsDomain:a.jsDomain||h.target.value})}),r.jsx("input",{"data-testid":"wkms-admin-relay-name",placeholder:"display name",value:a.name,onChange:h=>l({...a,name:h.target.value})}),r.jsx("input",{"data-testid":"wkms-admin-relay-wss",placeholder:"wss://…",value:a.wssUrl,onChange:h=>l({...a,wssUrl:h.target.value})}),r.jsx("input",{"data-testid":"wkms-admin-relay-user",placeholder:"nats user",value:a.user,onChange:h=>l({...a,user:h.target.value})}),r.jsx("input",{"data-testid":"wkms-admin-relay-pass",placeholder:"nats password (leave ••• to keep)",value:a.pass,onChange:h=>l({...a,pass:h.target.value})}),r.jsx("input",{"data-testid":"wkms-admin-relay-domain",placeholder:"jetstream domain",value:a.jsDomain,onChange:h=>l({...a,jsDomain:h.target.value})}),r.jsxs("label",{style:{display:"flex",gap:6,fontSize:12},children:["role",r.jsxs("select",{"data-testid":"wkms-admin-relay-role",value:a.role,onChange:h=>l({...a,role:h.target.value}),children:[r.jsx("option",{value:"primary",children:"primary"}),r.jsx("option",{value:"secondary",children:"secondary"})]}),r.jsx("span",{style:{marginLeft:12},children:"enabled"}),r.jsx("input",{"data-testid":"wkms-admin-relay-enabled",type:"checkbox",checked:a.enabled,onChange:h=>l({...a,enabled:h.target.checked})})]}),r.jsxs("div",{style:{display:"flex",gap:6},children:[r.jsx("button",{"data-testid":"wkms-admin-relay-save",className:"primary",onClick:()=>void d(),children:"Save"}),r.jsx("button",{"data-testid":"wkms-admin-relay-cancel",onClick:()=>l(null),children:"Cancel"})]})]}):null]})}function eT(){const[e,t]=x.useState([]),[n,i]=x.useState([]),[a,l]=x.useState([]),[s,o]=x.useState(""),[u,d]=x.useState(14),[g,p]=x.useState(""),[h,f]=x.useState(null);async function y(){const[c,m,w]=await Promise.all([De("wkms/invite/list"),De("wkms/auth/list_users"),De("wkms/auth/list_nodes")]);c.ok&&c.result?t(c.result):p(`relay unreachable: ${c.error??"?"}`),m.ok&&m.result&&i(m.result),w.ok&&w.result&&l(w.result)}x.useEffect(()=>{y()},[]);async function v(){p("minting…");const c=await De("wkms/invite/create",{ttlDays:u,note:s});c.ok&&c.result?(f(c.result),p(""),o(""),await y()):p(`mint failed: ${c.error}`)}async function S(c){(await De("wkms/invite/revoke",{inviteId:c})).ok&&await y()}return r.jsxs("div",{"data-testid":"wkms-admin-invites",style:{display:"grid",gap:14},children:[r.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,flexWrap:"wrap"},children:[r.jsx("h3",{style:{margin:0},children:"Invites"}),r.jsx("input",{"data-testid":"wkms-admin-invite-note",placeholder:"note (who is it for?)",value:s,onChange:c=>o(c.target.value),style:{width:180}}),r.jsxs("label",{style:{fontSize:12},children:["ttl days"," ",r.jsx("input",{"data-testid":"wkms-admin-invite-ttl",type:"number",min:1,max:365,value:u,onChange:c=>d(Number(c.target.value)||14),style:{width:60}})]}),r.jsx("button",{"data-testid":"wkms-admin-invite-mint",className:"primary",onClick:()=>void v(),children:"+ Mint invite"}),r.jsx("button",{"data-testid":"wkms-admin-invite-refresh",onClick:()=>void y(),children:"↻"})]}),g?r.jsx("p",{"data-testid":"wkms-admin-invite-msg",style:{fontSize:11,margin:0},children:g}):null,h?r.jsxs("p",{"data-testid":"wkms-admin-invite-minted",style:{fontSize:13,margin:0},children:["New code: ",r.jsx("code",{"data-testid":"wkms-admin-invite-minted-code",style:{userSelect:"all",fontWeight:700},children:h.code})," ","(expires ",new Date(h.expiresAt).toLocaleDateString(),") — share it with the invitee."]}):null,r.jsxs("table",{"data-testid":"wkms-admin-invites-table",style:{width:"100%",fontSize:12,borderCollapse:"collapse"},children:[r.jsx("thead",{children:r.jsxs("tr",{style:{textAlign:"left",opacity:.7},children:[r.jsx("th",{children:"code"}),r.jsx("th",{children:"status"}),r.jsx("th",{children:"note"}),r.jsx("th",{children:"expires"}),r.jsx("th",{children:"used by"}),r.jsx("th",{})]})}),r.jsx("tbody",{children:e.map(c=>r.jsxs("tr",{"data-testid":`wkms-admin-invite-row-${c.inviteId}`,children:[r.jsx("td",{children:r.jsx("code",{children:c.code})}),r.jsx("td",{children:r.jsx("span",{className:"chip","data-testid":`wkms-admin-invite-status-${c.inviteId}`,children:c.status})}),r.jsx("td",{children:c.note??"—"}),r.jsx("td",{children:new Date(c.expiresAt).toLocaleDateString()}),r.jsx("td",{children:c.usedBy?r.jsxs("code",{children:[c.usedBy.slice(0,8),"…"]}):"—"}),r.jsx("td",{children:c.status==="active"?r.jsx("button",{"data-testid":`wkms-admin-invite-revoke-${c.inviteId}`,onClick:()=>void S(c.inviteId),children:"revoke"}):null})]},c.inviteId))})]}),r.jsx("h3",{style:{margin:"8px 0 0"},children:"Users"}),r.jsxs("table",{"data-testid":"wkms-admin-users-table",style:{width:"100%",fontSize:12,borderCollapse:"collapse"},children:[r.jsx("thead",{children:r.jsxs("tr",{style:{textAlign:"left",opacity:.7},children:[r.jsx("th",{children:"username"}),r.jsx("th",{children:"display"}),r.jsx("th",{children:"role"}),r.jsx("th",{children:"status"}),r.jsx("th",{children:"uuid"})]})}),r.jsx("tbody",{children:n.map(c=>r.jsxs("tr",{"data-testid":`wkms-admin-user-row-${c.username}`,children:[r.jsx("td",{children:r.jsx("strong",{children:c.username})}),r.jsx("td",{children:c.displayName}),r.jsx("td",{children:c.role}),r.jsx("td",{children:c.status}),r.jsx("td",{children:r.jsxs("code",{children:[c.userUuid.slice(0,13),"…"]})})]},c.userUuid))})]}),r.jsx("h3",{style:{margin:"8px 0 0"},children:"Nodes"}),r.jsxs("table",{"data-testid":"wkms-admin-nodes-table",style:{width:"100%",fontSize:12,borderCollapse:"collapse"},children:[r.jsx("thead",{children:r.jsxs("tr",{style:{textAlign:"left",opacity:.7},children:[r.jsx("th",{children:"node uuid"}),r.jsx("th",{children:"owner"}),r.jsx("th",{children:"label"}),r.jsx("th",{children:"platform"}),r.jsx("th",{children:"last seen"})]})}),r.jsx("tbody",{children:a.map(c=>r.jsxs("tr",{"data-testid":`wkms-admin-node-row-${c.nodeUuid}`,children:[r.jsx("td",{children:r.jsxs("code",{children:[c.nodeUuid.slice(0,13),"…"]})}),r.jsx("td",{children:r.jsxs("code",{children:[c.userUuid.slice(0,8),"…"]})}),r.jsx("td",{children:c.label}),r.jsx("td",{style:{maxWidth:200,overflow:"hidden",textOverflow:"ellipsis"},children:c.platform}),r.jsx("td",{children:new Date(c.lastSeenAt).toLocaleString()})]},c.nodeUuid))})]})]})}async function tT(e,t){const n=globalThis.chrome?.runtime?.sendMessage;if(!n)return{ok:!1,error:"no runtime"};try{return await n({kind:e,payload:t})}catch(i){return{ok:!1,error:String(i)}}}function nT({search:e}){const t=wt(),[n,i]=x.useState(null),[a,l]=x.useState(null),[s,o]=x.useState(!1),u=`${e.query}|${[...e.tagsFilter].sort().join(",")}|${e.imageBase64?e.imageBase64.slice(0,32):""}`;x.useEffect(()=>{let g=!1;return o(!0),l(null),i(null),(async()=>{const p=await tT("wkms/search/hybrid",{query:e.query,topK:25,tagsFilter:[...e.tagsFilter],imageBase64:e.imageBase64,imageMime:e.imageMime});g||(o(!1),p.ok?i(p.result??[]):l(p.error??"search failed"))})(),()=>{g=!0}},[u]);const d=[];return e.query&&d.push(`text: "${e.query}"`),e.tagsFilter.length&&d.push(`tags: ${e.tagsFilter.map(g=>`@${g}`).join(" ")}`),e.imageBase64&&d.push("+ image"),r.jsxs("section",{className:"wkms-pane wkms-pane-grid","data-testid":"wkms-search-results-pane",children:[r.jsx("div",{className:"wkms-pane-header",children:r.jsxs("span",{children:["Search results ",n?`(${n.length})`:""," for ",r.jsx("em",{children:d.join(" · ")||"(empty)"})]})}),r.jsxs("div",{className:"wkms-pane-body",children:[s?r.jsx("div",{style:{padding:16,opacity:.7},children:"Searching…"}):null,a?r.jsx("div",{style:{padding:16,color:"var(--wkms-danger)"},"data-testid":"wkms-search-error",children:a}):null,n&&n.length===0&&!s?r.jsxs("div",{style:{padding:16,opacity:.6},"data-testid":"wkms-search-empty",children:["No hits in the knowledge graph for ",r.jsx("strong",{children:d.join(" · ")}),". Try a query about something you've imported (e.g. ",r.jsx("code",{children:"deepseek"}),", ",r.jsx("code",{children:"@gmail"}),", ",r.jsx("code",{children:"embeddings"}),")."]}):null,n&&n.length>0?r.jsx("div",{className:"wkms-grid","data-testid":"wkms-search-results-list",children:n.map(g=>r.jsxs("div",{className:"wkms-card","data-testid":`wkms-search-result-${g.id}`,onClick:()=>g.url&&t.navigation.openTab(g.url),onContextMenu:p=>{p.preventDefault(),t.menu.open(p.clientX,p.clientY,[{id:"open-tab",label:"Open URL in new tab",run:()=>g.url?t.navigation.openTab(g.url):void 0},{id:"open-window",label:"Open in new window",run:()=>g.url?t.navigation.openTab(g.url,{newWindow:!0}):void 0},{id:"copy-url",label:"Copy URL",run:async()=>{g.url&&await navigator.clipboard.writeText(g.url).catch(()=>{})}}])},children:[r.jsx("div",{className:"favicon-row",children:r.jsx("span",{className:"title",children:g.title||g.url||g.id})}),g.url?r.jsx("span",{className:"url",children:g.url}):null,g.snippet?r.jsx("span",{className:"summary",children:g.snippet}):null,r.jsxs("span",{style:{fontSize:10,opacity:.5},children:["score: ",g.score.toFixed(3)]})]},g.id))}):null]})]})}function iT({plan:e,running:t,onConfirm:n,onCancel:i}){return r.jsxs("div",{className:"wkms-batch-plan-panel","data-testid":"wkms-analyze-batch-plan",style:{position:"absolute",right:16,top:64,zIndex:50,background:"var(--wkms-bg-elevated, #fff)",border:"1px solid var(--wkms-border, #ccc)",borderRadius:8,padding:16,minWidth:460,maxWidth:640,boxShadow:"0 8px 24px rgba(0,0,0,0.12)"},children:[r.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"baseline"},children:[r.jsx("strong",{children:"Batch plan"}),r.jsxs("span",{style:{fontSize:11,opacity:.7},children:["per-site budget ",e.maxTabBudget," tok · LLM window ",e.llmWindow.toLocaleString()," tok"]})]}),r.jsxs("table",{"data-testid":"wkms-analyze-batch-table",style:{width:"100%",marginTop:12,fontSize:12,borderCollapse:"collapse"},children:[r.jsx("thead",{children:r.jsxs("tr",{children:[r.jsx("th",{style:{textAlign:"left"},children:"Batch"}),r.jsx("th",{style:{textAlign:"left"},children:"Window"}),r.jsx("th",{style:{textAlign:"right"},children:"Tabs"}),r.jsx("th",{style:{textAlign:"right"},children:"Est in"}),r.jsx("th",{style:{textAlign:"right"},children:"Est out"}),r.jsx("th",{style:{textAlign:"right"},children:"Est cost"})]})}),r.jsx("tbody",{children:e.batches.map(a=>r.jsxs("tr",{"data-testid":`wkms-analyze-batch-row-${a.no}`,children:[r.jsxs("td",{children:["#",a.no]}),r.jsx("td",{style:{opacity:.75},children:a.windowLabel??a.batchId.slice(0,16)}),r.jsx("td",{style:{textAlign:"right"},children:a.tabs}),r.jsx("td",{style:{textAlign:"right"},children:a.estInputTokens.toLocaleString()}),r.jsx("td",{style:{textAlign:"right"},children:a.estOutputTokens.toLocaleString()}),r.jsxs("td",{style:{textAlign:"right"},children:["$",a.estCostUsd.toFixed(4)]})]},`${a.batchId}-${a.no}`))}),r.jsx("tfoot",{children:r.jsxs("tr",{children:[r.jsx("td",{colSpan:5,style:{textAlign:"right",paddingTop:8,fontWeight:600},children:"Total (upper bound)"}),r.jsxs("td",{style:{textAlign:"right",paddingTop:8,fontWeight:600},"data-testid":"wkms-analyze-total-cost",children:["$",e.totalCostUsd.toFixed(4)]})]})})]}),r.jsxs("div",{style:{display:"flex",gap:8,marginTop:12,justifyContent:"flex-end"},children:[r.jsx("button",{"data-testid":"wkms-analyze-cancel",onClick:i,disabled:t,children:"Cancel"}),r.jsx("button",{"data-testid":"wkms-analyze-confirm",className:"primary",onClick:n,disabled:t||e.batches.length===0,children:t?"Running…":`Run ${e.batches.length} batch${e.batches.length===1?"":"es"}`})]})]})}function aT({onSubmit:e,onClear:t}){const[n,i]=x.useState(""),[a,l]=x.useState([]),[s,o]=x.useState(null),u=x.useRef(null),d=v=>{const S=/(^|\s)@([\w-]+)\s*$/.exec(v);if(!S)return{remaining:v};const c=S[2].toLowerCase();return{remaining:v.slice(0,S.index+S[1].length).trimEnd(),added:c}},g=v=>l(a.filter(S=>S!==v)),p=v=>{if(v.key===" "||v.key==="Tab"){const{remaining:S,added:c}=d(n);c&&!a.includes(c)&&(v.preventDefault(),l([...a,c]),i(S));return}if(v.key==="Enter"){v.preventDefault();let S=a,c=n;const{remaining:m,added:w}=d(n);w&&(S=a.includes(w)?a:[...a,w],l(S),c=m,i(m)),e({query:c.trim(),tagsFilter:S,imageBase64:s?.base64,imageMime:s?.mime});return}v.key==="Backspace"&&n.length===0&&a.length>0&&!s&&l(a.slice(0,-1))},h=async v=>{const c=Array.from(v.clipboardData?.items??[]).find(k=>k.kind==="file"&&k.type.startsWith("image/"));if(!c)return;const m=c.getAsFile();if(!m)return;v.preventDefault();const w=new Uint8Array(await m.arrayBuffer());let b="";const j=32768;for(let k=0;k<w.length;k+=j)b+=String.fromCharCode.apply(null,Array.from(w.subarray(k,k+j)));o({base64:btoa(b),mime:m.type,name:m.name||"pasted.png"})},f=()=>{i(""),l([]),o(null),t(),u.current?.focus()};x.useEffect(()=>{u.current?.focus()},[]);const y=n.length>0||a.length>0||!!s;return r.jsxs("div",{className:"wkms-search-bar","data-testid":"wkms-search-bar",style:{display:"flex",flexDirection:"column",gap:4,flexGrow:1,maxWidth:640},children:[s?r.jsxs("div",{"data-testid":"wkms-search-image-preview",style:{display:"flex",alignItems:"center",gap:8,padding:"4px 8px",background:"var(--wkms-chip)",borderRadius:6,fontSize:11},children:[r.jsx("img",{src:`data:${s.mime};base64,${s.base64}`,alt:"paste preview",style:{width:36,height:36,objectFit:"cover",borderRadius:4}}),r.jsxs("span",{style:{flexGrow:1,opacity:.8},children:[s.name??"image"," · ",(s.base64.length*3/4/1024).toFixed(1)," KB"]}),r.jsx("button",{"data-testid":"wkms-search-image-remove",onClick:()=>o(null),style:{border:"none",background:"transparent",cursor:"pointer",padding:"0 4px"},title:"remove image",children:"×"})]}):null,r.jsxs("div",{style:{display:"flex",flexWrap:"wrap",gap:4,alignItems:"center",padding:"2px 6px",background:"var(--wkms-input-bg, #fff)",border:"1px solid var(--wkms-border)",borderRadius:6},children:[a.map(v=>r.jsxs("span",{className:"chip","data-testid":`wkms-search-tag-${v}`,style:{display:"inline-flex",alignItems:"center",gap:2,padding:"2px 6px",fontSize:11,background:"var(--wkms-chip)",borderRadius:8},children:["@",v,r.jsx("button",{"data-testid":`wkms-search-tag-remove-${v}`,onClick:()=>g(v),style:{border:"none",background:"transparent",cursor:"pointer",padding:"0 2px",fontSize:12},children:"×"})]},v)),r.jsx("input",{ref:u,className:"search","data-testid":"wkms-search-input",type:"text",placeholder:a.length||s?"":"Search — text, @tag, paste an image…",value:n,onChange:v=>i(v.target.value),onKeyDown:p,onPaste:h,style:{flexGrow:1,border:"none",outline:"none",background:"transparent",fontSize:13,padding:"4px 6px",minWidth:80}}),y?r.jsx("button",{"data-testid":"wkms-search-clear",onClick:f,style:{border:"none",background:"transparent",cursor:"pointer",fontSize:11},title:"clear search",children:"Clear"}):null]})]})}function lT(e,t){const n=globalThis.chrome?.runtime?.sendMessage;return n?n({kind:e,payload:t}).then(i=>i).catch(()=>{}):Promise.resolve(void 0)}function sT({onSubmitted:e}){const[t,n]=x.useState(""),[i,a]=x.useState(null),[l,s]=x.useState(!1),o=x.useRef(null),u=async()=>{const g=t.trim();if(!g||l)return;s(!0);const p=i?[{type:"image_url",image_url:{url:`data:${i.mime};base64,${i.base64}`}}]:void 0,h=await lT("wkms/agent/submit_chat",{ask:g,...p?{attachments:p}:{}});s(!1),h?.ok&&h.result?.taskId&&(n(""),a(null),e(h.result.taskId))},d=async g=>{const h=Array.from(g.clipboardData?.items??[]).find(S=>S.kind==="file"&&S.type.startsWith("image/"))?.getAsFile();if(!h)return;g.preventDefault();const f=new Uint8Array(await h.arrayBuffer());let y="";const v=32768;for(let S=0;S<f.length;S+=v)y+=String.fromCharCode.apply(null,Array.from(f.subarray(S,S+v)));a({base64:btoa(y),mime:h.type})};return r.jsxs("div",{className:"wkms-agent-chat-bar","data-testid":"wkms-agent-chat-bar",style:{display:"flex",alignItems:"center",gap:4,flexGrow:1,maxWidth:520,padding:"2px 6px",background:"var(--wkms-input-bg,#fff)",border:"1px solid var(--wkms-border)",borderRadius:6},children:[r.jsx("span",{style:{fontSize:13,opacity:.6},children:"✦"}),i?r.jsxs("span",{"data-testid":"wkms-agent-chat-image",style:{fontSize:10,padding:"1px 5px",background:"var(--wkms-chip)",borderRadius:4},children:["img ×",r.jsx("button",{"data-testid":"wkms-agent-chat-image-remove",onClick:()=>a(null),style:{border:"none",background:"transparent",cursor:"pointer"},children:"×"})]}):null,r.jsx("input",{ref:o,"data-testid":"wkms-agent-chat-input",type:"text",placeholder:"Ask the AI assistant… (spins an AgentTask)",value:t,onChange:g=>n(g.target.value),onKeyDown:g=>{g.key==="Enter"&&(g.preventDefault(),u())},onPaste:d,style:{flexGrow:1,border:"none",outline:"none",background:"transparent",fontSize:13,padding:"4px 6px",minWidth:80}}),r.jsx("button",{"data-testid":"wkms-agent-chat-send",className:"primary",onClick:u,disabled:l||!t.trim(),style:{fontSize:12},children:l?"…":"Ask"})]})}function Rn(e,t){const n=globalThis.chrome?.runtime?.sendMessage;return n?n({kind:e,payload:t}).then(i=>i).catch(i=>({ok:!1,error:String(i)})):Promise.resolve({ok:!1,error:"no runtime"})}const mo=e=>e==="up"||e==="online"?"🟢":e==="degraded"?"🟡":"🔴";function rT(){const[e,t]=x.useState(null),[n,i]=x.useState([]),[a,l]=x.useState(null),[s,o]=x.useState(null),[u,d]=x.useState([]),[g,p]=x.useState(null),[h,f]=x.useState(""),y=x.useCallback(async()=>{f("Refreshing…");const[S,c,m,w,b,j]=await Promise.all([Rn("wkms/health/snapshot"),Rn("wkms/component/list"),Rn("wkms/audit/count"),Rn("wkms/metrics/stats"),Rn("wkms/system/adapters"),Rn("wkms/project/get")]);S.ok&&S.result&&t(S.result),c.ok&&Array.isArray(c.result)&&i(c.result),m.ok&&m.result&&l(m.result.count),w.ok&&w.result&&o(w.result),b.ok&&Array.isArray(b.result)&&d(b.result),j.ok&&j.result&&p(j.result),f("")},[]);x.useEffect(()=>{y()},[y]);const v=async()=>{f("Deploying first-choice components…"),await Rn("wkms/component/deploy",{}),await y()};return r.jsxs("section",{className:"wkms-system","data-testid":"wkms-system-panel",style:{padding:16,overflow:"auto",display:"flex",flexDirection:"column",gap:18},children:[r.jsxs("header",{style:{display:"flex",alignItems:"center",gap:12},children:[r.jsx("h2",{style:{margin:0},children:"System"}),r.jsx("button",{"data-testid":"wkms-system-refresh",onClick:()=>void y(),children:"Refresh"}),r.jsx("button",{"data-testid":"wkms-system-deploy",className:"primary",onClick:v,children:"Deploy components"}),r.jsx("span",{"data-testid":"wkms-system-busy",style:{fontSize:12,color:"var(--wkms-fg-muted)"},children:h})]}),r.jsxs("div",{"data-testid":"wkms-system-project",style:{fontSize:13,padding:"6px 10px",border:"1px solid var(--wkms-border,#ccc)",borderRadius:6,background:"var(--wkms-accent-soft, rgba(99,102,241,0.08))"},children:[r.jsx("strong",{children:"ProjectSpace:"})," ",r.jsx("span",{"data-testid":"wkms-system-project-name",children:g?.name??"…"})," ","· ",r.jsx("span",{"data-testid":"wkms-system-project-id",style:{fontFamily:"monospace"},children:g?.id??"…"}),g?.parent?r.jsxs(r.Fragment,{children:[" · parent ",r.jsx("span",{style:{fontFamily:"monospace"},children:g.parent})]}):null,r.jsx("span",{style:{marginLeft:8,color:"var(--wkms-fg-muted)"},children:"— the data + process isolation key"})]}),r.jsxs("div",{"data-testid":"wkms-system-health",children:[r.jsxs("h3",{style:{marginBottom:6},children:["Health — ",r.jsx("span",{"data-testid":"wkms-system-health-status",children:e?`${mo(e.status)} ${e.status}`:"…"})]}),r.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:6},children:(e?.checks??[]).map(S=>r.jsxs("span",{"data-testid":`wkms-system-check-${S.name}`,title:JSON.stringify(S.detail??{}),style:{fontSize:12,border:"1px solid var(--wkms-border,#ccc)",borderRadius:6,padding:"2px 8px"},children:[mo(S.status)," ",S.name]},S.name))})]}),r.jsxs("div",{"data-testid":"wkms-system-components",children:[r.jsxs("h3",{style:{marginBottom:6},children:["Components (",n.length,")"]}),r.jsxs("table",{style:{fontSize:12,borderCollapse:"collapse",width:"100%"},children:[r.jsx("thead",{children:r.jsxs("tr",{style:{textAlign:"left",opacity:.7},children:[r.jsx("th",{children:"Component"}),r.jsx("th",{children:"Role"}),r.jsx("th",{children:"Adapter"}),r.jsx("th",{children:"Phase"}),r.jsx("th",{children:"Port"}),r.jsx("th",{children:"Served by"})]})}),r.jsx("tbody",{children:n.map(S=>r.jsxs("tr",{"data-testid":`wkms-system-component-${S.name}`,"data-phase":S.phase,children:[r.jsxs("td",{children:[mo(S.phase)," ",S.name]}),r.jsx("td",{children:S.role}),r.jsx("td",{"data-testid":`wkms-system-component-adapter-${S.name}`,style:{fontFamily:"monospace"},children:S.adapter??"—"}),r.jsx("td",{children:S.phase}),r.jsx("td",{children:S.config.port??"—"}),r.jsx("td",{children:S.config.servedBy??"—"})]},S.name))})]})]}),r.jsxs("div",{"data-testid":"wkms-system-adapters",children:[r.jsxs("h3",{style:{marginBottom:6},children:["Bound adapters (",u.length,") — concern → impl"]}),r.jsxs("table",{style:{fontSize:12,borderCollapse:"collapse",width:"100%"},children:[r.jsx("thead",{children:r.jsxs("tr",{style:{textAlign:"left",opacity:.7},children:[r.jsx("th",{children:"Concern"}),r.jsx("th",{children:"Adapter impl"})]})}),r.jsx("tbody",{children:u.map(S=>r.jsxs("tr",{"data-testid":`wkms-system-adapter-${S.concern}`,children:[r.jsx("td",{children:S.concern}),r.jsx("td",{style:{fontFamily:"monospace"},children:S.impl})]},S.concern))})]})]}),r.jsxs("div",{style:{display:"flex",gap:32},children:[r.jsxs("div",{"data-testid":"wkms-system-audit",children:[r.jsx("h3",{style:{marginBottom:4},children:"Audit"}),r.jsx("span",{"data-testid":"wkms-system-audit-count",style:{fontSize:24},children:a??"…"})," ",r.jsx("span",{style:{fontSize:12,opacity:.7},children:"records"})]}),r.jsxs("div",{"data-testid":"wkms-system-metrics",children:[r.jsx("h3",{style:{marginBottom:4},children:"Metrics"}),r.jsx("span",{"data-testid":"wkms-system-metrics-samples",style:{fontSize:24},children:s?.samples??"…"})," ",r.jsxs("span",{style:{fontSize:12,opacity:.7},children:["samples / ",s?.series??"…"," series"]})]})]})]})}function oT(e,t){const n=globalThis.chrome?.runtime?.sendMessage;return n?n({kind:e,payload:t}).then(i=>i).catch(()=>({ok:!1})):Promise.resolve({ok:!1})}const uT=["inventory","tasks","knowledge"],fh={inventory:["quantity","location","sku","condition","cost"],tasks:["status","priority","assignedTo","start","end"],knowledge:["url","tags"]};function cT(){const t=wt().tableUx;Pt(t);const[n,i]=x.useState("inventory"),[a,l]=x.useState(0),s=x.useCallback(async f=>{const y=await oT("wkms/scope/subtree",{scope:f,limit:5e3}),v=y.ok&&Array.isArray(y.result)?y.result:[];l(v.length);const S=v.map(b=>({id:b.id,cells:{name:b.name??b.id,kind:b.kind??"",...b.data??{}}})),c=new Set;for(const b of S)for(const j of Object.keys(b.cells))c.add(j);const w=["name","kind",...(fh[f]??[]).filter(b=>c.has(b)),...[...c].filter(b=>b!=="name"&&b!=="kind"&&!(fh[f]??[]).includes(b))].slice(0,8).map(b=>({key:b,label:b,sortable:!0,kind:b==="quantity"||b==="cost"||b==="priority"?"number":"string"}));t.setColumns(w),t.setRows(S),t.setPage(0,50)},[t]);x.useEffect(()=>{s(n)},[n,s]);const o=t.columns(),u=t.visibleRows(),d=t.page(),g=t.sortState(),p=f=>Array.isArray(f)?f.join(", "):f==null?"":typeof f=="object"?JSON.stringify(f):String(f),h=x.useMemo(()=>o,[o]);return r.jsxs("section",{className:"wkms-table-pane","data-testid":"wkms-table-pane",style:{padding:12,overflow:"auto",display:"flex",flexDirection:"column",gap:10,flex:1},children:[r.jsxs("header",{style:{display:"flex",alignItems:"center",gap:10},children:[r.jsx("h2",{style:{margin:0,fontSize:16},children:"Table"}),r.jsx("select",{"data-testid":"wkms-table-scope",value:n,onChange:f=>i(f.target.value),children:uT.map(f=>r.jsx("option",{value:f,children:f},f))}),r.jsx("input",{"data-testid":"wkms-table-filter",placeholder:"Filter…",defaultValue:"",onChange:f=>t.setFilter(f.target.value),style:{flex:"0 0 220px"}}),r.jsxs("span",{"data-testid":"wkms-table-count",style:{fontSize:12,color:"var(--wkms-fg-muted)"},children:[t.filteredCount()," / ",a," rows"]})]}),r.jsxs("table",{"data-testid":"wkms-table",style:{fontSize:12,borderCollapse:"collapse",width:"100%"},children:[r.jsx("thead",{children:r.jsx("tr",{style:{textAlign:"left",borderBottom:"1px solid var(--wkms-border,#ccc)"},children:h.map(f=>r.jsxs("th",{"data-testid":`wkms-table-col-${f.key}`,style:{cursor:f.sortable?"pointer":"default",padding:"4px 8px",userSelect:"none"},onClick:()=>f.sortable&&t.sortBy(f.key),children:[f.label,g?.key===f.key?g.dir==="asc"?" ▲":" ▼":""]},f.key))})}),r.jsx("tbody",{"data-testid":"wkms-table-body",children:u.map(f=>r.jsx("tr",{"data-testid":`wkms-table-row-${f.id}`,style:{borderBottom:"1px solid var(--wkms-border-soft,#eee)"},children:h.map(y=>r.jsx("td",{style:{padding:"3px 8px",maxWidth:280,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},title:p(f.cells[y.key]),children:p(f.cells[y.key])},y.key))},f.id))})]}),r.jsxs("footer",{style:{display:"flex",alignItems:"center",gap:8,fontSize:12},children:[r.jsx("button",{"data-testid":"wkms-table-prev",disabled:d.page<=0,onClick:()=>t.setPage(d.page-1),children:"◀ Prev"}),r.jsxs("span",{"data-testid":"wkms-table-page",children:["Page ",d.page+1," / ",d.pageCount]}),r.jsx("button",{"data-testid":"wkms-table-next",disabled:d.page>=d.pageCount-1,onClick:()=>t.setPage(d.page+1),children:"Next ▶"})]})]})}function go(e,t){const n=globalThis.chrome?.runtime?.sendMessage;return n?n({kind:e,payload:t}).then(i=>i).catch(()=>({ok:!1})):Promise.resolve({ok:!1})}const hh=[{key:"ref",label:"Ref",sortable:!1},{key:"region",label:"Region",sortable:!0},{key:"department",label:"Department",sortable:!0},{key:"category",label:"Category",sortable:!0},{key:"vendor",label:"Vendor",sortable:!0},{key:"status",label:"Status",sortable:!0},{key:"amountUsd",label:"Amount (USD)",sortable:!0,kind:"number"},{key:"txnDate",label:"Date",sortable:!0,kind:"date"}],dT=50,fT=["region","department","category","status","vendor"];function hT(){const t=wt().listUx,[,n]=x.useState(0),[i,a]=x.useState(0),[l,s]=x.useState(!1),[o,u]=x.useState(!1);x.useEffect(()=>(t.setColumns(hh),t.sortState()||t.sortBy("txnDate","desc"),t.subscribe(()=>n(k=>k+1))),[t]);const d=x.useCallback(()=>{const j=t.filter();return j?[{field:j.field,op:j.op,value:j.value}]:void 0},[t]),g=x.useCallback(async()=>{if(l||!t.hasMore())return;s(!0);const j=t.sortState(),k=await go("wkms/rowset/page",{filter:d(),sortBy:j?.key,sortDir:j?.dir,after:t.cursor(),limit:dT});k.ok&&k.result&&t.appendPage(k.result),s(!1)},[t,l,d]),p=x.useCallback(async()=>{const j=await go("wkms/rowset/count",{filter:d()});j.ok&&j.result&&a(j.result.count)},[d]);x.useEffect(()=>{(async()=>{const j=await go("wkms/rowset/seed",{});j.ok&&j.result&&a(j.result.total),u(!0)})()},[]);const h=t.sortState(),f=JSON.stringify({f:t.filter(),s:h}),[y,v]=x.useState(null);x.useEffect(()=>{o&&y!==f&&(v(f),p(),g())},[f,o]);const S=x.useCallback(j=>{t.sortBy(j)},[t]),c=x.useCallback((j,k)=>{k?t.setFilter(j,"eq",k):t.clearFilter()},[t]),m=t.rows(),w=(j,k)=>k==="number"&&typeof j=="number"?j.toLocaleString(void 0,{minimumFractionDigits:2,maximumFractionDigits:2}):j==null?"":String(j),b=x.useMemo(()=>hh,[]);return r.jsxs("section",{className:"wkms-list-pane","data-testid":"wkms-list-pane",style:{padding:12,overflow:"auto",display:"flex",flexDirection:"column",gap:10,flex:1},children:[r.jsxs("header",{style:{display:"flex",alignItems:"center",gap:10,flexWrap:"wrap"},children:[r.jsxs("h2",{style:{margin:0,fontSize:16},children:["List ",r.jsx("span",{style:{fontSize:11,color:"var(--wkms-fg-muted)"},children:"· keyset · ledger"})]}),fT.map(j=>r.jsxs("select",{"data-testid":`wkms-list-filter-${j}`,defaultValue:"",onChange:k=>c(j,k.target.value),style:{fontSize:12},children:[r.jsxs("option",{value:"",children:[j,": all"]}),(mT[j]??[]).map(k=>r.jsx("option",{value:k,children:k},k))]},j)),r.jsxs("span",{"data-testid":"wkms-list-count",style:{fontSize:12,color:"var(--wkms-fg-muted)"},children:[m.length," loaded / ",i," match",o?"":" (seeding…)"]})]}),r.jsxs("table",{"data-testid":"wkms-list-table",style:{fontSize:12,borderCollapse:"collapse",width:"100%"},children:[r.jsx("thead",{children:r.jsx("tr",{style:{textAlign:"left",borderBottom:"1px solid var(--wkms-border,#ccc)"},children:b.map(j=>r.jsxs("th",{"data-testid":`wkms-list-col-${j.key}`,onClick:()=>j.sortable&&S(j.key),style:{cursor:j.sortable?"pointer":"default",padding:"4px 8px",userSelect:"none"},children:[j.label,h?.key===j.key?h.dir==="asc"?" ▲":" ▼":""]},j.key))})}),r.jsx("tbody",{"data-testid":"wkms-list-body",children:m.map(j=>r.jsx("tr",{"data-testid":`wkms-list-row-${j.id}`,style:{borderBottom:"1px solid var(--wkms-border-soft,#eee)"},children:b.map(k=>r.jsx("td",{style:{padding:"3px 8px",maxWidth:240,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},title:w(j.cells[k.key],k.kind),children:w(j.cells[k.key],k.kind)},k.key))},j.id))})]}),r.jsxs("footer",{style:{display:"flex",alignItems:"center",gap:8,fontSize:12},children:[r.jsx("button",{"data-testid":"wkms-list-loadmore",disabled:l||!t.hasMore(),onClick:()=>void g(),children:l?"Loading…":t.hasMore()?"Load more ▼":"All loaded"}),r.jsx("span",{"data-testid":"wkms-list-cursor",style:{color:"var(--wkms-fg-muted)"},children:t.hasMore()?"cursor → more":"end of set"})]})]})}const mT={region:["NA-East","NA-West","EU-Central","EU-North","APAC-SEA","APAC-East","LATAM","MEA"],department:["Engineering","Field-Ops","Logistics","Procurement","Facilities","R&D","Sales","Support"],category:["Hardware","Travel","Software-Licenses","Consumables","Freight","Contractor","Utilities","Training"],status:["pending","approved","reconciled","rejected","in-review"],vendor:["Acme Industrial","Globex Freight","Initech Cloud","Umbrella Supply","Soylent Logistics","Hooli Compute","Stark Hardware","Wayne Facilities","Wonka Consumables","Cyberdyne Tools"]};function Tt(e,t){const n=globalThis.chrome?.runtime?.sendMessage;return n?n({kind:e,payload:t}).then(i=>i).catch(i=>({ok:!1,error:String(i)})):Promise.resolve({ok:!1})}const mh=e=>e.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"")||`id-${Math.random().toString(36).slice(2,7)}`;function gT(){const[e,t]=x.useState([]),[n,i]=x.useState([]),[a,l]=x.useState([]),[s,o]=x.useState(""),[u,d]=x.useState(""),[g,p]=x.useState(1),[h,f]=x.useState(""),[y,v]=x.useState(""),[S,c]=x.useState(""),[m,w]=x.useState({}),b=x.useCallback(async()=>{const[C,M,te]=await Promise.all([Tt("wkms/llm/models"),Tt("wkms/llm/providers"),Tt("wkms/llm/selection_chain")]);C.ok&&C.result&&t(C.result),M.ok&&M.result&&i(M.result),te.ok&&te.result&&l(te.result)},[]);x.useEffect(()=>{b()},[b]);const j=async()=>{u.trim()&&(o(`Adding model ${u}…`),await Tt("wkms/llm/upsert_model",{id:mh(u),name:u.trim(),priority:g}),d(""),p(1),await b(),o(`Added model ${u}`))},k=async C=>{await Tt("wkms/llm/delete_model",{id:C}),await b()},T=async()=>{if(!h.trim()||!y.trim())return;const C=mh(h),M=C;o(`Adding provider ${h}…`),await Tt("wkms/llm/upsert_provider",{id:C,name:h.trim(),apiUrl:y.trim(),apiKeyRef:M,models:[]}),S.trim()&&await Tt("wkms/llm/set_secret",{apiKeyRef:M,key:S.trim()}),f(""),v(""),c(""),await b(),o(`Added provider ${h}`)},_=async C=>{await Tt("wkms/llm/delete_provider",{id:C}),await b()},A=async C=>{const M=m[C.id];if(!M||!M.modelId)return;const te={modelId:M.modelId,modelNameAtProvider:M.nameAt||M.modelId,priority:M.prio||1,costs:{inputPerM:M.inM||0,inputCacheHitPerM:0,outputPerM:M.outM||0,outputCacheHitPerM:M.outM||0}},O={...C,models:[...C.models.filter(R=>R.modelId!==M.modelId),te]};await Tt("wkms/llm/upsert_provider",O),w(R=>({...R,[C.id]:{modelId:"",nameAt:"",prio:1,inM:0,outM:0}})),await b()},I=async(C,M)=>{await Tt("wkms/llm/upsert_provider",{...C,models:C.models.filter(te=>te.modelId!==M)}),await b()},Q=(C,M)=>w(te=>({...te,[C]:{modelId:"",nameAt:"",prio:1,inM:0,outM:0,...te[C],...M}})),z={fontSize:12,padding:"2px 6px"};return r.jsxs("section",{className:"wkms-llmreg","data-testid":"wkms-llmreg-pane",style:{padding:16,overflow:"auto",display:"flex",flexDirection:"column",gap:18},children:[r.jsxs("header",{style:{display:"flex",alignItems:"center",gap:12},children:[r.jsx("h2",{style:{margin:0},children:"LLM Registry"}),r.jsx("button",{"data-testid":"wkms-llmreg-refresh",onClick:()=>void b(),children:"Refresh"}),r.jsx("span",{"data-testid":"wkms-llmreg-busy",style:{fontSize:12,color:"var(--wkms-fg-muted)"},children:s})]}),r.jsxs("div",{"data-testid":"wkms-llmreg-models",children:[r.jsxs("h3",{style:{marginBottom:6},children:["Models (",e.length,") — priority 1 = highest"]}),r.jsxs("div",{style:{display:"flex",gap:6,marginBottom:6},children:[r.jsx("input",{"data-testid":"wkms-llmreg-model-name",placeholder:"Model name",value:u,onChange:C=>d(C.target.value),style:z}),r.jsx("input",{"data-testid":"wkms-llmreg-model-priority",type:"number",min:1,max:100,value:g,onChange:C=>p(Number(C.target.value)),style:{...z,width:70}}),r.jsx("button",{"data-testid":"wkms-llmreg-add-model",className:"primary",onClick:j,children:"Add model"})]}),r.jsxs("table",{style:{fontSize:12,width:"100%",borderCollapse:"collapse"},children:[r.jsx("thead",{children:r.jsxs("tr",{style:{textAlign:"left",opacity:.7},children:[r.jsx("th",{children:"Name"}),r.jsx("th",{children:"Priority"}),r.jsx("th",{})]})}),r.jsx("tbody",{children:e.map(C=>r.jsxs("tr",{"data-testid":`wkms-llmreg-model-${C.id}`,children:[r.jsx("td",{children:C.name}),r.jsx("td",{children:C.priority}),r.jsx("td",{children:r.jsx("button",{"data-testid":`wkms-llmreg-del-model-${C.id}`,onClick:()=>void k(C.id),children:"✕"})})]},C.id))})]})]}),r.jsxs("div",{"data-testid":"wkms-llmreg-providers",children:[r.jsxs("h3",{style:{marginBottom:6},children:["Providers (",n.length,")"]}),r.jsxs("div",{style:{display:"flex",gap:6,marginBottom:8,flexWrap:"wrap"},children:[r.jsx("input",{"data-testid":"wkms-llmreg-prov-name",placeholder:"Provider name",value:h,onChange:C=>f(C.target.value),style:z}),r.jsx("input",{"data-testid":"wkms-llmreg-prov-url",placeholder:"api url (OpenAI-compatible)",value:y,onChange:C=>v(C.target.value),style:{...z,width:240}}),r.jsx("input",{"data-testid":"wkms-llmreg-prov-key",placeholder:"api key",type:"password",value:S,onChange:C=>c(C.target.value),style:z}),r.jsx("button",{"data-testid":"wkms-llmreg-add-prov",className:"primary",onClick:T,children:"Add provider"})]}),n.map(C=>r.jsxs("div",{"data-testid":`wkms-llmreg-prov-${C.id}`,style:{border:"1px solid var(--wkms-border,#ccc)",borderRadius:6,padding:8,marginBottom:8},children:[r.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[r.jsx("strong",{children:C.name})," ",r.jsx("span",{style:{fontSize:11,opacity:.7,fontFamily:"monospace"},children:C.apiUrl}),r.jsx("button",{"data-testid":`wkms-llmreg-del-prov-${C.id}`,style:{marginLeft:"auto"},onClick:()=>void _(C.id),children:"Delete provider"})]}),r.jsxs("table",{style:{fontSize:11,width:"100%",borderCollapse:"collapse",marginTop:4},children:[r.jsx("thead",{children:r.jsxs("tr",{style:{textAlign:"left",opacity:.6},children:[r.jsx("th",{children:"Model"}),r.jsx("th",{children:"Name @ provider"}),r.jsx("th",{children:"Prio"}),r.jsx("th",{children:"$in/M"}),r.jsx("th",{children:"$out/M"}),r.jsx("th",{})]})}),r.jsx("tbody",{children:C.models.map(M=>r.jsxs("tr",{"data-testid":`wkms-llmreg-bindrow-${C.id}-${M.modelId}`,children:[r.jsx("td",{children:M.modelId}),r.jsx("td",{style:{fontFamily:"monospace"},children:M.modelNameAtProvider}),r.jsx("td",{children:M.priority}),r.jsx("td",{children:M.costs.inputPerM}),r.jsx("td",{children:M.costs.outputPerM}),r.jsx("td",{children:r.jsx("button",{"data-testid":`wkms-llmreg-del-bind-${C.id}-${M.modelId}`,onClick:()=>void I(C,M.modelId),children:"✕"})})]},M.modelId))})]}),r.jsxs("div",{style:{display:"flex",gap:4,marginTop:4,flexWrap:"wrap"},children:[r.jsxs("select",{"data-testid":`wkms-llmreg-bind-model-${C.id}`,value:m[C.id]?.modelId??"",onChange:M=>Q(C.id,{modelId:M.target.value}),style:z,children:[r.jsx("option",{value:"",children:"model…"}),e.map(M=>r.jsx("option",{value:M.id,children:M.name},M.id))]}),r.jsx("input",{"data-testid":`wkms-llmreg-bind-name-${C.id}`,placeholder:"name@provider",value:m[C.id]?.nameAt??"",onChange:M=>Q(C.id,{nameAt:M.target.value}),style:z}),r.jsx("input",{"data-testid":`wkms-llmreg-bind-prio-${C.id}`,type:"number",min:1,max:100,placeholder:"prio",value:m[C.id]?.prio??1,onChange:M=>Q(C.id,{prio:Number(M.target.value)}),style:{...z,width:56}}),r.jsx("input",{"data-testid":`wkms-llmreg-bind-in-${C.id}`,type:"number",step:"0.01",placeholder:"$in/M",value:m[C.id]?.inM??0,onChange:M=>Q(C.id,{inM:Number(M.target.value)}),style:{...z,width:72}}),r.jsx("input",{"data-testid":`wkms-llmreg-bind-out-${C.id}`,type:"number",step:"0.01",placeholder:"$out/M",value:m[C.id]?.outM??0,onChange:M=>Q(C.id,{outM:Number(M.target.value)}),style:{...z,width:72}}),r.jsx("button",{"data-testid":`wkms-llmreg-add-bind-${C.id}`,onClick:()=>void A(C),children:"+ binding"})]})]},C.id))]}),r.jsxs("div",{"data-testid":"wkms-llmreg-chain",children:[r.jsxs("h3",{style:{marginBottom:6},children:["AUTO selection chain (",a.length,") — cache + retry order"]}),r.jsx("ol",{style:{fontSize:12,margin:0,paddingLeft:20},children:a.map((C,M)=>r.jsxs("li",{"data-testid":`wkms-llmreg-chain-${M}`,children:[C.model.name," → ",r.jsx("strong",{children:C.provider.name})," ",r.jsxs("span",{style:{opacity:.6},children:["(~$",C.estCostPerMTok.toFixed(3),"/M)"]})]},M))})]})]})}const bt={NAV_GO:"my.wkms.ui.nav.go",TREE_EXPAND_TO_DEPTH:"my.wkms.ui.tree.expand_to_depth",TREE_SELECT:"my.wkms.ui.tree.select",TREE_COLLAPSE:"my.wkms.ui.tree.collapse",GRID_OPEN_DETAIL:"my.wkms.ui.grid.open_detail",GRID_TOGGLE_SELECT:"my.wkms.ui.grid.toggle_select",DETAIL_CLOSE:"my.wkms.ui.detail.close",TABLE_SORT:"my.wkms.ui.table.sort",TABLE_SET_FILTER:"my.wkms.ui.table.set_filter",LIST_SET_FILTER:"my.wkms.ui.list.set_filter",OBSERVE_STATE:"my.wkms.ui.observe.state"};function Hl(e,t){const n=e.visibleRows();return{scope:t,selectedId:e.selectedId(),visibleCount:n.length,expandedIds:n.filter(i=>i.isExpanded).map(i=>i.id)}}function pT(e,t,n={}){const i=n.defaultScope??"all",a=[],l=(o,u,d,g)=>a.push(e.register({uid:o,description:u,tags:["wkms","ui",...d]},p=>g(p))),s=()=>{const o=t.currentView(),u={view:o,openDetailId:t.openDetailId()};if(o==="knowledge"){u.tree=Hl(t.treeUxFor(i),i);const d=t.grid();u.grid={cardCount:d.cards().length,selectedCount:d.selectedIds().size}}else if(o==="table"){const d=t.tableUx();u.table={sort:d.sortState(),filter:d.filter(),visibleCount:d.visibleRows().length,filteredCount:d.filteredCount()}}else if(o==="list"){const d=t.listUx?.();d&&(u.list={loadedCount:d.loadedCount(),hasMore:d.hasMore(),filter:d.filter()})}return u};return l(bt.NAV_GO,"Switch the active top-level view.",["nav"],o=>(t.setView(o.view),s())),l(bt.TREE_EXPAND_TO_DEPTH,"Expand a subtree to a given depth (drives treeUx.expand repeatedly).",["tree"],async o=>{const u=o.scope||i,d=t.treeUxFor(u);await d.setRoots(o.nodeId);for(let g=0;g<Math.max(0,o.depth);g++){const p=d.visibleRows().filter(h=>h.depth<=g&&!h.isLeaf&&!h.isExpanded);for(const h of p)await d.expand(h.id)}return{scope:u,expandedTo:o.depth,visibleCount:d.visibleRows().length,tree:Hl(d,u)}}),l(bt.TREE_SELECT,"Select a tree node by id.",["tree"],o=>{const u=t.treeUxFor(o.scope||i);return u.select(o.nodeId),{scope:o.scope||i,selectedId:u.selectedId(),tree:Hl(u,o.scope||i)}}),l(bt.TREE_COLLAPSE,"Collapse a tree node by id.",["tree"],o=>{const u=t.treeUxFor(o.scope||i);return u.collapse(o.nodeId),{scope:o.scope||i,tree:Hl(u,o.scope||i)}}),l(bt.GRID_OPEN_DETAIL,"Open a node's center detail.",["grid","detail"],o=>(t.openDetail(o.card),s())),l(bt.GRID_TOGGLE_SELECT,"Toggle a grid card's multi-select.",["grid"],o=>{const u=t.grid();return u.toggleSelect(o.cardId,o.range?{range:!0}:void 0),{selectedCount:u.selectedIds().size}}),l(bt.DETAIL_CLOSE,"Close the center detail.",["detail"],()=>(t.closeDetail(),s())),l(bt.TABLE_SORT,"Set the table sort (key + direction).",["table"],o=>{const u=t.tableUx();return u.sortBy(o.key,o.dir),{sort:u.sortState(),filter:u.filter(),visibleCount:u.visibleRows().length,filteredCount:u.filteredCount()}}),l(bt.TABLE_SET_FILTER,"Set the table text filter.",["table"],o=>{const u=t.tableUx();return u.setFilter(o.text??""),{sort:u.sortState(),filter:u.filter(),visibleCount:u.visibleRows().length,filteredCount:u.filteredCount()}}),l(bt.LIST_SET_FILTER,"Set or clear the keyset-list filter clause (resets the cursor).",["list"],o=>{const u=t.listUx?.();return u?(o.clear||!o.field?u.clearFilter():u.setFilter(o.field,o.op??"eq",o.value),{loadedCount:u.loadedCount(),hasMore:u.hasMore(),filter:u.filter()}):{error:"list view not available on this surface"}}),l(bt.OBSERVE_STATE,"Read the current UI state (view + selection + counts).",["observe"],()=>s()),()=>{for(const o of a)o()}}class vT{doc;render;waitPollMs;constructor(t={}){const n=t.document??globalThis.document;if(!n)throw new Error("DomAgentDriver: no Document available (pass { document })");this.doc=n,this.render=t.renderer,this.waitPollMs=t.waitPollMs??30}resolve(t){if(typeof t=="string")return this.doc.querySelector(`[data-testid="${gh(t)}"]`);if(t.css)return po(this.doc.querySelectorAll(t.css),t.nth);if(t.testid)return po(this.doc.querySelectorAll(`[data-testid="${gh(t.testid)}"]`),t.nth);if(t.text){const i=[...this.doc.querySelectorAll("button, a, [role='button'], [data-testid]")].filter(a=>(a.textContent??"").trim()===t.text);return po(i,t.nth)??i[t.nth??0]??null}return null}withEl(t,n){const i=this.resolve(t);if(!i)return{ok:!1,error:`element not found: ${In(t)}`};try{return n(i),{ok:!0,dom:$n(i,0)}}catch(a){return{ok:!1,error:a instanceof Error?a.message:String(a)}}}async click(t){return this.withEl(t,n=>{n.dispatchEvent(new this.doc.defaultView.MouseEvent("mousedown",{bubbles:!0,cancelable:!0})),n.dispatchEvent(new this.doc.defaultView.MouseEvent("mouseup",{bubbles:!0,cancelable:!0})),n.dispatchEvent(new this.doc.defaultView.MouseEvent("click",{bubbles:!0,cancelable:!0}))})}async dblclick(t){return this.withEl(t,n=>{n.dispatchEvent(new this.doc.defaultView.MouseEvent("dblclick",{bubbles:!0,cancelable:!0}))})}async rightclick(t){return this.withEl(t,n=>{n.dispatchEvent(new this.doc.defaultView.MouseEvent("contextmenu",{bubbles:!0,cancelable:!0,button:2}))})}async hover(t){return this.withEl(t,n=>{n.dispatchEvent(new this.doc.defaultView.MouseEvent("mouseover",{bubbles:!0})),n.dispatchEvent(new this.doc.defaultView.MouseEvent("mouseenter",{bubbles:!1}))})}async type(t,n){return this.withEl(t,i=>{const a=i;a.focus?.();const l=i instanceof this.doc.defaultView.HTMLTextAreaElement?this.doc.defaultView.HTMLTextAreaElement.prototype:this.doc.defaultView.HTMLInputElement.prototype,s=Object.getOwnPropertyDescriptor(l,"value")?.set;s?s.call(a,n):a.value=n,i.dispatchEvent(new this.doc.defaultView.Event("input",{bubbles:!0})),i.dispatchEvent(new this.doc.defaultView.Event("change",{bubbles:!0}))})}async key(t,n){const i=n?this.resolve(n):this.doc.activeElement??this.doc.body;if(!i)return{ok:!1,error:`key target not found: ${n?In(n):"activeElement"}`};const{key:a,ctrlKey:l,shiftKey:s,altKey:o,metaKey:u}=bT(t),d={key:a,ctrlKey:l,shiftKey:s,altKey:o,metaKey:u,bubbles:!0,cancelable:!0};return i.dispatchEvent(new this.doc.defaultView.KeyboardEvent("keydown",d)),i.dispatchEvent(new this.doc.defaultView.KeyboardEvent("keyup",d)),{ok:!0,dom:$n(i,0)}}async drag(t,n){const i=this.resolve(t),a=this.resolve(n);if(!i)return{ok:!1,error:`drag source not found: ${In(t)}`};if(!a)return{ok:!1,error:`drag target not found: ${In(n)}`};const l=this.doc.defaultView,s=o=>typeof l.DragEvent=="function"?new l.DragEvent(o,{bubbles:!0}):new l.Event(o,{bubbles:!0});return i.dispatchEvent(new l.MouseEvent("mousedown",{bubbles:!0})),i.dispatchEvent(s("dragstart")),a.dispatchEvent(s("dragover")),a.dispatchEvent(s("drop")),i.dispatchEvent(new l.MouseEvent("mouseup",{bubbles:!0})),{ok:!0,dom:$n(a,0)}}async scroll(t,n){return this.withEl(t,i=>{i.scrollLeft+=n.x??0,i.scrollTop+=n.y??0,i.dispatchEvent(new this.doc.defaultView.Event("scroll",{bubbles:!0}))})}async observe(t){const n=t?this.resolve(t):this.doc.body;return n?{ok:!0,dom:$n(n,t?1:2)}:{ok:!1,error:`element not found: ${t?In(t):"body"}`}}async snapshot(t={}){const n=t.selector?this.resolve(t.selector):this.doc.body;if(!n)return{ok:!1,error:`element not found: ${t.selector?In(t.selector):"body"}`};let i;if(this.render)try{i=await this.render(n,t.maxPx??2e3)}catch{}return{ok:!0,dom:$n(n,2),screenshot:i}}async waitFor(t,n={}){const i=ph()+(n.timeoutMs??5e3);for(;;){const a=this.resolve(t);if(a&&Ev(a))return{ok:!0,dom:$n(a,0)};if(ph()>=i)return{ok:!1,error:`waitFor timed out: ${In(t)}`};await xT(this.waitPollMs)}}async run(t){const n=[];for(const i of t)switch(i.action){case"click":n.push(await this.click(i.selector));break;case"dblclick":n.push(await this.dblclick(i.selector));break;case"rightclick":n.push(await this.rightclick(i.selector));break;case"hover":n.push(await this.hover(i.selector));break;case"type":n.push(await this.type(i.selector,i.text));break;case"key":n.push(await this.key(i.chord,i.selector));break;case"scroll":n.push(await this.scroll(i.selector,i.by));break;case"drag":n.push(await this.drag(i.from,i.to));break;case"observe":n.push(await this.observe(i.selector));break;case"waitFor":n.push(await this.waitFor(i.selector,{timeoutMs:i.timeoutMs}));break}return n}}function po(e,t){return e[t??0]??null}function Ev(e){const t=e.ownerDocument.defaultView?.getComputedStyle?.(e);return t&&(t.display==="none"||t.visibility==="hidden")?!1:e.isConnected}function $n(e,t){const n={};for(const l of["class","type","href","role","aria-label","aria-expanded","disabled","value","data-scope"]){const s=e.getAttribute(l);s!=null&&(n[l]=s)}let i;try{const l=e.getBoundingClientRect?.();l&&(i={x:Math.round(l.x),y:Math.round(l.y),w:Math.round(l.width),h:Math.round(l.height)})}catch{}const a={testid:e.getAttribute("data-testid")??void 0,tag:e.tagName.toLowerCase(),text:yT(e),value:e.value||void 0,attrs:n,rect:i,visible:Ev(e)};return t>0&&(a.children=[...e.children].slice(0,40).map(l=>$n(l,t-1))),a}function yT(e){const t=(e.textContent??"").trim().replace(/\s+/g," ");return t?t.slice(0,200):void 0}function In(e){return typeof e=="string"?`testid=${e}`:JSON.stringify(e)}function bT(e){const t=e.split("+").map(a=>a.trim()),n={ctrlKey:!1,shiftKey:!1,altKey:!1,metaKey:!1};let i=e;for(const a of t){const l=a.toLowerCase();l==="ctrl"||l==="control"?n.ctrlKey=!0:l==="shift"?n.shiftKey=!0:l==="alt"||l==="option"?n.altKey=!0:l==="meta"||l==="cmd"||l==="command"||l==="win"?n.metaKey=!0:i=a}return{key:i,...n}}function gh(e){return e.replace(/"/g,'\\"')}function ph(){return Date.now()}function xT(e){return new Promise(t=>setTimeout(t,e))}const ST="sys.wkms.ui.drive";function wT(e,t){return e.register({uid:ST,description:"Drive primitive DOM interactions in this session (click/type/key/observe/…) — the in-app, no-CDP, production-safe parallel to Playwright.",tags:["wkms","ui","drive","agent"],argsSchema:"v1"},async n=>{const i=n.steps?[...n.steps]:n.step?[n.step]:[],a=await t.run(i);return{observations:a,allOk:a.every(l=>l.ok)}})}class Cv{map=new Map;async put(t,n){this.map.set(t,structuredClone(n))}async get(t){const n=this.map.get(t);return n?structuredClone(n):void 0}}class jT{constructor(t=new Cv,n=()=>Date.now()){this.store=t,this.clock=n}active=null;liveHandlers=new Set;seq=0;keyCounter=0;start(t={}){const n=t.key??`rec-${(this.keyCounter++).toString(36)}-${this.clock().toString(36)}`;return this.seq=0,this.active={meta:{key:n,label:t.label,sessionTabId:t.sessionTabId,startedTMs:0},events:[],t0:this.clock()},{key:n}}record(t){if(!this.active)return;const n={...t,seq:this.seq++,tMs:this.clock()-this.active.t0};this.active.events.push(n);for(const i of[...this.liveHandlers])try{i(n)}catch{}}async stop(){if(!this.active)throw new Error("MemorySessionRecorder: stop() with no active recording");const t={meta:this.active.meta,events:this.active.events};await this.store.put(this.active.meta.key,t);const n=this.active.meta.key;return this.active=null,{key:n}}async events(t){return(await this.store.get(t))?.events??[]}observeLive(t){return this.liveHandlers.add(t),()=>this.liveHandlers.delete(t)}isRecording(){return this.active!==null}}class kT{constructor(t,n,i,a){this.store=t,this.catalog=n,this.understandFn=i,this.executor=a}async understand(t){if(!t.recordingKey)throw new Error("LlmIntentReplay.understand: recordingKey required (live-session understand = P4)");const n=await this.store.get(t.recordingKey);if(!n)throw new Error(`LlmIntentReplay: no recording ${t.recordingKey}`);return this.understandFn(n,this.catalog())}async replay(t,n={}){const{intent:i,plan:a}=await this.understand({recordingKey:t}),l=[];if(n.dryRun)for(const s of a)l.push({verb:s.verb,ok:!0,result:"(dryRun)"});else for(const s of a){const o=await this.executor(s);if(l.push({verb:s.verb,ok:o.ok,result:o.result,error:o.error}),!o.ok)break}return{ok:l.every(s=>s.ok),intent:i,steps:l}}}function TT(e){const t=e.events.filter(l=>l.source==="verb"&&l.action),n=t.map(l=>({verb:l.action,args:l.args??{},rationale:"replayed from recording"})),i=[...new Set(t.map(l=>l.action.replace(/^my\.wkms\.ui\./,"")))];return{intent:t.length?`Reproduce ${t.length} UI action(s): ${i.slice(0,6).join(", ")}`:"Empty recording (no UI actions captured)",plan:n}}function ET(e,t){const n=globalThis.chrome?.runtime?.sendMessage;return n?n({kind:e,payload:t}).then(i=>i).catch(i=>({ok:!1,error:String(i)})):Promise.resolve({ok:!1,error:"no runtime"})}function CT(e){const t=wt(),n=x.useRef(e);n.current=e;const i=x.useRef({view:e.view,detail:e.detailNode});i.current.view=e.view,i.current.detail=e.detailNode,x.useEffect(()=>{const a={setView:f=>{i.current.view=f,n.current.setView(f)},currentView:()=>i.current.view,openDetail:f=>{i.current.detail=f,n.current.setDetailNode(f)},closeDetail:()=>{i.current.detail=null,n.current.setDetailNode(null)},openDetailId:()=>i.current.detail?.id,treeUxFor:f=>t.treeUxFor(f),grid:()=>t.grid,tableUx:()=>t.tableUx,listUx:()=>t.listUx},l=pT(t.control,a,{defaultScope:"all"}),s=new vT,o=wT(t.control,s),u=new Cv,d=new jT(u),g=(f,y)=>t.ublm.call({kind:"uid",uid:f},y,{}),p=async(f,y)=>{const v=f.events.filter(c=>c.source==="verb"&&c.action).map(c=>({action:c.action,args:c.args})),S=await ET("wkms/agent/understand_intent",{events:v,catalog:y});return S.ok&&S.result&&Array.isArray(S.result.plan)&&S.result.plan.length?S.result:TT(f)},h=new kT(u,()=>t.control.list().map(f=>({uid:f.uid,description:f.description})),p,async f=>{const y=await g(f.verb,f.args??{});return y.ok?{ok:!0,result:y.result}:{ok:!1,error:y.ok?void 0:y.error}});return globalThis.__wkmsControl={sessionTabId:t.control.sessionTabId(),list:()=>t.control.list(),call:async(f,y,v)=>{const S=await t.ublm.call({kind:"uid",uid:f},y,v??{});return d.isRecording()&&d.record({source:"verb",action:f,args:y,result:S.ok?S.result:void 0}),S},drive:async f=>{const y=await t.ublm.call({kind:"uid",uid:"sys.wkms.ui.drive"},f,{});return d.isRecording()&&d.record({source:"drive",action:"sys.wkms.ui.drive",args:f}),y},recorder:{start:f=>d.start({...f,sessionTabId:t.control.sessionTabId()}),stop:()=>d.stop(),events:f=>d.events(f),isRecording:()=>d.isRecording()},understand:f=>h.understand({recordingKey:f}),replay:(f,y)=>h.replay(f,y)},()=>{l(),o();const f=globalThis;f.__wkmsControl&&delete f.__wkmsControl}},[])}async function vh(e,t){try{return await globalThis.chrome?.runtime?.sendMessage({kind:e,payload:t})??{ok:!1,error:"no reply"}}catch(n){return{ok:!1,error:String(n?.message??n)}}}function OT({onAuthed:e}){const[t,n]=x.useState("login"),[i,a]=x.useState(""),[l,s]=x.useState(""),[o,u]=x.useState(""),[d,g]=x.useState(""),[p,h]=x.useState(!1),[f,y]=x.useState("");async function v(){h(!0),y("");const c=t==="login"?await vh("wkms/auth/login",{username:i,password:l}):await vh("wkms/auth/join",{code:d.trim(),username:i,password:l,displayName:o});h(!1),c.ok&&c.result?e(c.result):y(c.error??"failed")}function S(){const c={userUuid:"local-device-owner",username:"local",displayName:"This device (offline)",role:"admin",nodeUuid:"local",loggedInAt:new Date().toISOString(),offline:!0};e(c)}return r.jsx("div",{"data-testid":"wkms-login-screen",style:{display:"grid",placeItems:"center",height:"100vh",background:"var(--wkms-bg, #f6f7fb)"},children:r.jsxs("div",{style:{width:380,display:"grid",gap:14,padding:28,borderRadius:14,background:"var(--wkms-panel, #fff)",boxShadow:"0 8px 40px rgba(0,0,0,.12)"},children:[r.jsxs("div",{style:{textAlign:"center"},children:[r.jsx("h1",{style:{margin:0,fontSize:22},"data-testid":"wkms-login-title",children:"WKMSReact"}),r.jsx("p",{style:{margin:"4px 0 0",fontSize:12,opacity:.65},children:"Your knowledge, tasks, files & inventory — synced across every device."})]}),r.jsxs("div",{style:{display:"flex",gap:6,justifyContent:"center"},children:[r.jsx("button",{"data-testid":"wkms-login-tab-login",className:t==="login"?"primary":"",onClick:()=>{n("login"),y("")},children:"Login"}),r.jsx("button",{"data-testid":"wkms-login-tab-join",className:t==="join"?"primary":"",onClick:()=>{n("join"),y("")},children:"I have an invite"})]}),t==="join"?r.jsx("input",{"data-testid":"wkms-login-invite-code",placeholder:"invite code (wkr-xxxx-xxxx-xxxx)",value:d,onChange:c=>g(c.target.value),autoFocus:!0}):null,r.jsx("input",{"data-testid":"wkms-login-username",placeholder:"username",value:i,onChange:c=>a(c.target.value),autoFocus:t==="login"}),t==="join"?r.jsx("input",{"data-testid":"wkms-login-displayname",placeholder:"display name (optional)",value:o,onChange:c=>u(c.target.value)}):null,r.jsx("input",{"data-testid":"wkms-login-password",type:"password",placeholder:t==="join"?"choose a password (min 8 chars)":"password",value:l,onChange:c=>s(c.target.value),onKeyDown:c=>{c.key==="Enter"&&!p&&v()}}),f?r.jsx("p",{"data-testid":"wkms-login-error",style:{margin:0,fontSize:12,color:"var(--wkms-danger, #c0392b)"},children:f}):null,r.jsx("button",{"data-testid":"wkms-login-submit",className:"primary",disabled:p||!i||!l||t==="join"&&!d,onClick:()=>void v(),children:p?"…":t==="login"?"Login":"Join WKMSReact"}),r.jsx("button",{"data-testid":"wkms-login-offline",style:{fontSize:11,opacity:.7,background:"none",border:"none",cursor:"pointer",textDecoration:"underline"},onClick:S,children:"Continue offline (local-only, no sync)"})]})})}async function mi(e,t){const n=globalThis.chrome?.runtime?.sendMessage;if(!n)return{ok:!1,error:"no runtime"};try{return await n({kind:e,payload:t})}catch(i){return{ok:!1,error:String(i)}}}function DT(){const e=wt(),n=Pt(e.resizer).widths(),[i,a]=x.useState("knowledge"),[l,s]=x.useState(void 0);x.useEffect(()=>{(async()=>{const z=await mi("wkms/auth/status");s(z.ok?z.result?.session??null:null)})()},[]);const[o,u]=x.useState(null),d=x.useRef(null);CT({view:i,setView:a,detailNode:o,setDetailNode:u});const[g,p]=x.useState(null),[h,f]=x.useState(null),[y,v]=x.useState(!1),[S,c]=x.useState(""),m=x.useCallback(z=>{const C=d.current;if(!C)return;const M=z.clientX-C.start;C.which==="tree"?e.resizer.setTreeWidth(C.base+M):e.resizer.setDetailWidth(C.base-M)},[e.resizer]),w=x.useCallback(()=>{d.current=null,e.resizer.endDrag(),window.removeEventListener("mousemove",m),window.removeEventListener("mouseup",w)},[e.resizer,m]),b=z=>C=>{d.current={which:z,start:C.clientX,base:n[z]},e.resizer.beginDrag(z),window.addEventListener("mousemove",m),window.addEventListener("mouseup",w)},j=Pt(e.theme);x.useEffect(()=>{typeof document<"u"&&(document.documentElement.dataset.wkmsTheme=j.current())},[j]),x.useEffect(()=>{const z=()=>{try{const C=e.grid.cards();e.grid.setCards(C.map(M=>({...M,tags:[]})))}catch{}};return window.addEventListener("wkms:tags:cleared",z),()=>window.removeEventListener("wkms:tags:cleared",z)},[e.grid]),x.useEffect(()=>{const z=async C=>{if(!((C.ctrlKey||C.metaKey)&&!C.shiftKey&&(C.key==="z"||C.key==="Z")))return;const te=C.target,O=te?.tagName?.toLowerCase();if(O==="input"||O==="textarea"||te?.isContentEditable)return;C.preventDefault();const R=await mi("wkms/versioning/undo_last"),L=R.ok&&R.result?.undone?"Undone: last change reverted":R.result?.reason?`Nothing to undo (${R.result.reason})`:"Nothing to undo";c(L)};return window.addEventListener("keydown",z),()=>window.removeEventListener("keydown",z)},[]);const k=async()=>{c("Computing batch plan…");const z=await mi("wkms/analyze/plan",{});if(!z.ok||!z.result){c(z.error??"plan failed");return}f(z.result),c(`${z.result.batches.length} batch${z.result.batches.length===1?"":"es"} planned, total ≈ $${z.result.totalCostUsd.toFixed(4)}`)},T=async()=>{if(h){v(!0),c("Dispatching…");try{const z=await mi("wkms/admin/providers"),C=z.ok?(z.result??[]).find(te=>(te.preferredTasks??[]).includes("smart_group"))?.modelId:void 0,M=[];for(const te of h.batches){const O=await mi("wkms/analyze/run_smart_group_async",{batchId:te.batchId,omitUserTagsFromPrompt:!0,...C?{modelId:C}:{}});O.ok&&O.result?.taskId&&M.push(O.result.taskId)}c(`Queued ${M.length} batch run${M.length===1?"":"s"}${C?` via ${C}`:""} — see LLM cache for results`),f(null)}finally{v(!1)}}},_=z=>{if(!z.query&&z.tagsFilter.length===0&&!z.imageBase64){p(null);return}p(z)},A=()=>p(null),I=z=>{a("knowledge"),p(null),u({id:z,title:"AgentTask",tags:[],metadata:{kind:"AgentTask",scope:"tasks"}})},Q=g!==null;return l===void 0?r.jsx("div",{"data-testid":"wkms-auth-loading",style:{display:"grid",placeItems:"center",height:"100vh",opacity:.5},children:"…"}):l===null?r.jsx(OT,{onAuthed:z=>s(z)}):r.jsxs("div",{className:"wkms-app","data-testid":"wkms-app",children:[r.jsxs("header",{className:"wkms-topbar","data-testid":"wkms-topbar",children:[r.jsx("h1",{title:"WKMSReact — Knowledge, Tasks, Files, Inventory & Chat, synced across every device",children:"WKMSReact"}),r.jsxs("nav",{style:{display:"flex",gap:4},"data-testid":"wkms-nav",children:[r.jsx("button",{"data-testid":"wkms-nav-knowledge",className:i==="knowledge"?"primary":"",onClick:()=>a("knowledge"),children:"Knowledge"}),r.jsx("button",{"data-testid":"wkms-nav-table",className:i==="table"?"primary":"",onClick:()=>a("table"),children:"Table"}),r.jsx("button",{"data-testid":"wkms-nav-list",className:i==="list"?"primary":"",onClick:()=>a("list"),children:"List"}),r.jsx("button",{"data-testid":"wkms-nav-llm",className:i==="llm"?"primary":"",onClick:()=>a("llm"),children:"LLM cache"}),r.jsx("button",{"data-testid":"wkms-nav-admin",className:i==="admin"?"primary":"",onClick:()=>a("admin"),children:"Admin"}),r.jsx("button",{"data-testid":"wkms-nav-system",className:i==="system"?"primary":"",onClick:()=>a("system"),children:"System"}),r.jsx("button",{"data-testid":"wkms-nav-llmreg",className:i==="llmreg"?"primary":"",onClick:()=>a("llmreg"),children:"LLMs"})]}),r.jsx(aT,{onSubmit:_,onClear:A}),r.jsx(sT,{onSubmitted:I}),r.jsx("div",{className:"grow"}),r.jsxs("span",{className:"chip","data-testid":"wkms-session-chip",title:l.userUuid,children:[l.offline?"offline · ":"",l.displayName||l.username]}),r.jsx("button",{"data-testid":"wkms-logout",title:"Logout",onClick:()=>{(async()=>(await mi("wkms/auth/logout"),s(null)))()},children:"⎋"}),r.jsx("button",{"data-testid":"wkms-theme-toggle",onClick:()=>{const z=j.current(),C=z==="vibrant-dark"||z==="bw-dark",te=z==="bw-light"||z==="bw-dark"?C?"bw-light":"bw-dark":C?"vibrant-light":"vibrant-dark";e.theme.set(te)},children:j.current()==="vibrant-dark"||j.current()==="bw-dark"?"Light":"Dark"}),r.jsx("button",{"data-testid":"wkms-analyze-content",className:"primary",onClick:k,disabled:y,children:y?"Analyzing…":"Analyze"})]}),h?r.jsx(iT,{plan:h,running:y,onConfirm:T,onCancel:()=>f(null)}):null,i==="knowledge"?r.jsxs("div",{className:"wkms-panes","data-testid":"wkms-panes",children:[r.jsx(mk,{width:n.tree,onNavigate:()=>u(null),session:l}),r.jsx(ch,{onMouseDown:b("tree"),testId:"wkms-gutter-tree"}),o?r.jsx(Vk,{card:o,onBack:()=>u(null)}):Q&&g?r.jsx(nT,{search:g}):r.jsx(_k,{onOpenDetail:z=>u(z)}),r.jsx(ch,{onMouseDown:b("detail"),testId:"wkms-gutter-detail"}),r.jsx(Ak,{width:n.detail})]}):i==="table"?r.jsx(cT,{}):i==="list"?r.jsx(hT,{}):i==="llm"?r.jsx(Mk,{}):i==="system"?r.jsx(rT,{}):i==="llmreg"?r.jsx(gT,{}):r.jsx(Kk,{}),r.jsxs("footer",{className:"wkms-statusbar","data-testid":"wkms-statusbar",children:[r.jsxs("span",{children:["WKMS · adapter-first · ",j.current()," · ",i,Q?` · search=${JSON.stringify({q:g?.query,tags:g?.tagsFilter,hasImage:!!g?.imageBase64})}`:""]}),r.jsx("span",{"data-testid":"wkms-analyze-status",children:S||"WKMSReact — distributed knowledge, tasks, files, inventory & chat"})]}),r.jsx(zk,{})]})}const _T=await Mv({surface:"sidepanel"}),Ov=Z0({surface:"sidepanel"}),Dv=document.getElementById("root");if(!Dv)throw new Error("#root missing");D0.createRoot(Dv).render(r.jsx(x.StrictMode,{children:r.jsx(J0,{registry:Ov,children:r.jsx(DT,{})})}));globalThis.__wkmsSidepanel={back:_T,front:Ov};
//# sourceMappingURL=sidepanel-4UqCxFRQ.js.map
