@kidlat-dakila/flightplan 0.1.7 → 0.1.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/backend/main.js +826 -1336
- package/backend/plugin/skills/live/SKILL.md +79 -0
- package/backend/plugin/skills/review/SKILL.md +8 -5
- package/frontend/assets/_branchId-Caxyy__g.js +1 -0
- package/frontend/assets/{_branchId-438YLxpk.js → _branchId-IJ4VEzEl.js} +1 -1
- package/frontend/assets/{_id-yAHjl11v.js → _id-3L9ONe4W.js} +1 -1
- package/frontend/assets/_id-CvORsoNj.js +1 -0
- package/frontend/assets/{agents-CUULznCR.js → agents-DnjhKMUc.js} +1 -1
- package/frontend/assets/agents-bla75JmI.js +1 -0
- package/frontend/assets/{create-Byti8N1q.js → create-B82q7ZMu.js} +1 -1
- package/frontend/assets/create-C9yw-thL.js +1 -0
- package/frontend/assets/{create-t6MxPYs8.js → create-CEpA1s8S.js} +1 -1
- package/frontend/assets/{create-DHjp2cB6.js → create-D0h6PRxn.js} +1 -1
- package/frontend/assets/{download-kIOYm7yl.js → download-CwWMZwNG.js} +1 -1
- package/frontend/assets/forges-BH3uXIQL.js +1 -0
- package/frontend/assets/{forges-5NgJFexV.js → forges-uSh1-w20.js} +1 -1
- package/frontend/assets/{index-DVMDfdCW.js → index--nj01XKS.js} +1 -1
- package/frontend/assets/index-0VAWT0gs.js +1 -0
- package/frontend/assets/{index-Dq71dq4Z.js → index-B0zuYONu.js} +1 -1
- package/frontend/assets/{index-WOMODjD2.js → index-BQaZ5gZR.js} +1 -1
- package/frontend/assets/{index-BUtsWXGk.js → index-BZ6iL63Z.js} +1 -1
- package/frontend/assets/{index-CRQLJ5uq.js → index-Bar8NyIm.js} +1 -1
- package/frontend/assets/{index-EFsgiJx1.js → index-BlTfCkr5.js} +1 -1
- package/frontend/assets/{index-Dz-E4Hhc.js → index-BvuPClj3.js} +1 -1
- package/frontend/assets/index-C9xsdcXo.js +1 -0
- package/frontend/assets/{index-Cjx98rmL.js → index-CJDNq1TA.js} +1 -1
- package/frontend/assets/{index-N0J0txvy.js → index-CJslcuJ0.js} +1 -1
- package/frontend/assets/index-CTKqkqZN.css +1 -0
- package/frontend/assets/{index-CAt5Gv5u.js → index-CXyB0ld0.js} +1 -1
- package/frontend/assets/{index-BDhIIxnY.js → index-CcORd1N6.js} +1 -1
- package/frontend/assets/{index-EItMs0kz.js → index-CrAQ5_e4.js} +1 -1
- package/frontend/assets/{index-CmW92SdM.js → index-DG0FDX8u.js} +1 -1
- package/frontend/assets/index-DKnoo-kT.js +455 -0
- package/frontend/assets/{index-BrL94etp.js → index-DKzDkR6v.js} +1 -1
- package/frontend/assets/{index-9MPLrKh9.js → index-DfKNJbUM.js} +40 -40
- package/frontend/assets/{index-CBObEG9P.js → index-DlUHisPA.js} +1 -1
- package/frontend/assets/{index-DYy-kFEi.js → index-Dv5cF6qF.js} +1 -1
- package/frontend/assets/{index-Qxg2C8CP.js → index-JPWJ3IiN.js} +1 -1
- package/frontend/assets/{index-RYSZy-Ra.js → index-V1avMli5.js} +1 -1
- package/frontend/assets/{index-Dk3p64fP.js → index-iRAoFOv3.js} +1 -1
- package/frontend/assets/repositories-DqGU7W63.js +1 -0
- package/frontend/assets/{repositories-VWl6aq7K.js → repositories-DuObN8PJ.js} +1 -1
- package/frontend/assets/review-BbbMUFsk.js +1 -0
- package/frontend/assets/{review-CXzRf1jk.js → review-C3k0h5Vl.js} +1 -1
- package/frontend/assets/{route--z3gnt4z.js → route-D8s8AylJ.js} +1 -1
- package/frontend/index.html +2 -2
- package/package.json +1 -2
- package/published-review/app.css +1 -1
- package/published-review/app.js +94 -96
- package/frontend/assets/_branchId-PhBseeXo.js +0 -1
- package/frontend/assets/_id-z15a_Wqg.js +0 -1
- package/frontend/assets/agents-CF_BNYuU.js +0 -1
- package/frontend/assets/create-DiPNM_Jx.js +0 -1
- package/frontend/assets/forges-Dz31lZmK.js +0 -1
- package/frontend/assets/index-BDgPH-og.js +0 -1
- package/frontend/assets/index-C8_4U9zA.js +0 -457
- package/frontend/assets/index-CSy69oc4.js +0 -1
- package/frontend/assets/index-Cmg8rxUj.css +0 -1
- package/frontend/assets/repositories-BrbB16PW.js +0 -1
- package/frontend/assets/review-BMO-QDpl.js +0 -1
|
@@ -0,0 +1,455 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-DKzDkR6v.js","assets/index-s0xxzhVW.js","assets/index-CXyB0ld0.js","assets/index-Dv5cF6qF.js","assets/index-BvuPClj3.js","assets/agents-bla75JmI.js","assets/index-BQaZ5gZR.js","assets/agents-DnjhKMUc.js","assets/index-BZ6iL63Z.js","assets/index-0VAWT0gs.js","assets/index-V1avMli5.js","assets/index-BlTfCkr5.js","assets/forges-BH3uXIQL.js","assets/forges-uSh1-w20.js","assets/index-iRAoFOv3.js","assets/repositories-DqGU7W63.js","assets/repositories-DuObN8PJ.js","assets/index-DG0FDX8u.js","assets/review-BbbMUFsk.js","assets/review-C3k0h5Vl.js","assets/index--nj01XKS.js","assets/index-CcORd1N6.js","assets/index-CqVakH8R.js","assets/index-CJslcuJ0.js","assets/index-JPWJ3IiN.js","assets/index-DfKNJbUM.js","assets/index-B0zuYONu.js","assets/index-CrAQ5_e4.js","assets/index-Bar8NyIm.js","assets/index-DlUHisPA.js","assets/index-C9xsdcXo.js","assets/index-CJDNq1TA.js","assets/_id-CvORsoNj.js","assets/_id-3L9ONe4W.js","assets/create-C9yw-thL.js","assets/create-D0h6PRxn.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
var _V=Object.defineProperty;var Bk=e=>{throw TypeError(e)};var MV=(e,t,n)=>t in e?_V(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var Ot=(e,t,n)=>MV(e,typeof t!="symbol"?t+"":t,n),u1=(e,t,n)=>t.has(e)||Bk("Cannot "+n);var J=(e,t,n)=>(u1(e,t,"read from private field"),n?n.call(e):t.get(e)),Qe=(e,t,n)=>t.has(e)?Bk("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),He=(e,t,n,r)=>(u1(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n),gt=(e,t,n)=>(u1(e,t,"access private method"),n);var m0=(e,t,n,r)=>({set _(s){He(e,t,s,n)},get _(){return J(e,t,r)}});function IV(e,t){for(var n=0;n<t.length;n++){const r=t[n];if(typeof r!="string"&&!Array.isArray(r)){for(const s in r)if(s!=="default"&&!(s in e)){const o=Object.getOwnPropertyDescriptor(r,s);o&&Object.defineProperty(e,s,o.get?o:{enumerable:!0,get:()=>r[s]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))r(s);new MutationObserver(s=>{for(const o of s)if(o.type==="childList")for(const l of o.addedNodes)l.tagName==="LINK"&&l.rel==="modulepreload"&&r(l)}).observe(document,{childList:!0,subtree:!0});function n(s){const o={};return s.integrity&&(o.integrity=s.integrity),s.referrerPolicy&&(o.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?o.credentials="include":s.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function r(s){if(s.ep)return;s.ep=!0;const o=n(s);fetch(s.href,o)}})();function n2(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var d1={exports:{}},_h={};/**
|
|
3
|
+
* @license React
|
|
4
|
+
* react-jsx-runtime.production.js
|
|
5
|
+
*
|
|
6
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
7
|
+
*
|
|
8
|
+
* This source code is licensed under the MIT license found in the
|
|
9
|
+
* LICENSE file in the root directory of this source tree.
|
|
10
|
+
*/var Hk;function LV(){if(Hk)return _h;Hk=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function n(r,s,o){var l=null;if(o!==void 0&&(l=""+o),s.key!==void 0&&(l=""+s.key),"key"in s){o={};for(var c in s)c!=="key"&&(o[c]=s[c])}else o=s;return s=o.ref,{$$typeof:e,type:r,key:l,ref:s!==void 0?s:null,props:o}}return _h.Fragment=t,_h.jsx=n,_h.jsxs=n,_h}var Fk;function DV(){return Fk||(Fk=1,d1.exports=LV()),d1.exports}var m=DV(),f1={exports:{}},at={};/**
|
|
11
|
+
* @license React
|
|
12
|
+
* react.production.js
|
|
13
|
+
*
|
|
14
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
15
|
+
*
|
|
16
|
+
* This source code is licensed under the MIT license found in the
|
|
17
|
+
* LICENSE file in the root directory of this source tree.
|
|
18
|
+
*/var $k;function jV(){if($k)return at;$k=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),s=Symbol.for("react.profiler"),o=Symbol.for("react.consumer"),l=Symbol.for("react.context"),c=Symbol.for("react.forward_ref"),u=Symbol.for("react.suspense"),f=Symbol.for("react.memo"),h=Symbol.for("react.lazy"),p=Symbol.for("react.activity"),y=Symbol.for("react.view_transition"),x=Symbol.iterator;function b(F){return F===null||typeof F!="object"?null:(F=x&&F[x]||F["@@iterator"],typeof F=="function"?F:null)}var S={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},E=Object.assign,C={};function O(F,X,te){this.props=F,this.context=X,this.refs=C,this.updater=te||S}O.prototype.isReactComponent={},O.prototype.setState=function(F,X){if(typeof F!="object"&&typeof F!="function"&&F!=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,F,X,"setState")},O.prototype.forceUpdate=function(F){this.updater.enqueueForceUpdate(this,F,"forceUpdate")};function T(){}T.prototype=O.prototype;function R(F,X,te){this.props=F,this.context=X,this.refs=C,this.updater=te||S}var k=R.prototype=new T;k.constructor=R,E(k,O.prototype),k.isPureReactComponent=!0;var M=Array.isArray;function A(){}var I={H:null,A:null,T:null,S:null},L=Object.prototype.hasOwnProperty;function D(F,X,te){var Z=te.ref;return{$$typeof:e,type:F,key:X,ref:Z!==void 0?Z:null,props:te}}function P(F,X){return D(F.type,X,F.props)}function z(F){return typeof F=="object"&&F!==null&&F.$$typeof===e}function $(F){var X={"=":"=0",":":"=2"};return"$"+F.replace(/[=:]/g,function(te){return X[te]})}var j=/\/+/g;function H(F,X){return typeof F=="object"&&F!==null&&F.key!=null?$(""+F.key):X.toString(36)}function B(F){switch(F.status){case"fulfilled":return F.value;case"rejected":throw F.reason;default:switch(typeof F.status=="string"?F.then(A,A):(F.status="pending",F.then(function(X){F.status==="pending"&&(F.status="fulfilled",F.value=X)},function(X){F.status==="pending"&&(F.status="rejected",F.reason=X)})),F.status){case"fulfilled":return F.value;case"rejected":throw F.reason}}throw F}function V(F,X,te,Z,Y){var le=typeof F;(le==="undefined"||le==="boolean")&&(F=null);var xe=!1;if(F===null)xe=!0;else switch(le){case"bigint":case"string":case"number":xe=!0;break;case"object":switch(F.$$typeof){case e:case t:xe=!0;break;case h:return xe=F._init,V(xe(F._payload),X,te,Z,Y)}}if(xe)return Y=Y(F),xe=Z===""?"."+H(F,0):Z,M(Y)?(te="",xe!=null&&(te=xe.replace(j,"$&/")+"/"),V(Y,X,te,"",function(re){return re})):Y!=null&&(z(Y)&&(Y=P(Y,te+(Y.key==null||F&&F.key===Y.key?"":(""+Y.key).replace(j,"$&/")+"/")+xe)),X.push(Y)),1;xe=0;var fe=Z===""?".":Z+":";if(M(F))for(var oe=0;oe<F.length;oe++)Z=F[oe],le=fe+H(Z,oe),xe+=V(Z,X,te,le,Y);else if(oe=b(F),typeof oe=="function")for(F=oe.call(F),oe=0;!(Z=F.next()).done;)Z=Z.value,le=fe+H(Z,oe++),xe+=V(Z,X,te,le,Y);else if(le==="object"){if(typeof F.then=="function")return V(B(F),X,te,Z,Y);throw X=String(F),Error("Objects are not valid as a React child (found: "+(X==="[object Object]"?"object with keys {"+Object.keys(F).join(", ")+"}":X)+"). If you meant to render a collection of children, use an array instead.")}return xe}function G(F,X,te){if(F==null)return F;var Z=[],Y=0;return V(F,Z,"","",function(le){return X.call(te,le,Y++)}),Z}function q(F){if(F._status===-1){var X=F._result,te=X();te.then(function(Z){(F._status===0||F._status===-1)&&(F._status=1,F._result=Z,te.status===void 0&&(te.status="fulfilled",te.value=Z))},function(Z){(F._status===0||F._status===-1)&&(F._status=2,F._result=Z,te.status===void 0&&(te.status="rejected",te.reason=Z))}),F._status===-1&&(F._status=0,F._result=te)}if(F._status===1)return F._result.default;throw F._result}var K=typeof reportError=="function"?reportError:function(F){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var X=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof F=="object"&&F!==null&&typeof F.message=="string"?String(F.message):String(F),error:F});if(!window.dispatchEvent(X))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",F);return}console.error(F)};function W(F){var X=I.T,te={};te.types=X!==null?X.types:null,I.T=te;try{var Z=F(),Y=I.S;Y!==null&&Y(te,Z),typeof Z=="object"&&Z!==null&&typeof Z.then=="function"&&Z.then(A,K)}catch(le){K(le)}finally{X!==null&&te.types!==null&&(X.types=te.types),I.T=X}}function ee(F){var X=I.T;if(X!==null){var te=X.types;te===null?X.types=[F]:te.indexOf(F)===-1&&te.push(F)}else W(ee.bind(null,F))}var ce={map:G,forEach:function(F,X,te){G(F,function(){X.apply(this,arguments)},te)},count:function(F){var X=0;return G(F,function(){X++}),X},toArray:function(F){return G(F,function(X){return X})||[]},only:function(F){if(!z(F))throw Error("React.Children.only expected to receive a single React element child.");return F}};return at.Activity=p,at.Children=ce,at.Component=O,at.Fragment=n,at.Profiler=s,at.PureComponent=R,at.StrictMode=r,at.Suspense=u,at.ViewTransition=y,at.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=I,at.__COMPILER_RUNTIME={__proto__:null,c:function(F){return I.H.useMemoCache(F)}},at.addTransitionType=ee,at.cache=function(F){return function(){return F.apply(null,arguments)}},at.cacheSignal=function(){return null},at.cloneElement=function(F,X,te){if(F==null)throw Error("The argument must be a React element, but you passed "+F+".");var Z=E({},F.props),Y=F.key;if(X!=null)for(le in X.key!==void 0&&(Y=""+X.key),X)!L.call(X,le)||le==="key"||le==="__self"||le==="__source"||le==="ref"&&X.ref===void 0||(Z[le]=X[le]);var le=arguments.length-2;if(le===1)Z.children=te;else if(1<le){for(var xe=Array(le),fe=0;fe<le;fe++)xe[fe]=arguments[fe+2];Z.children=xe}return D(F.type,Y,Z)},at.createContext=function(F){return F={$$typeof:l,_currentValue:F,_currentValue2:F,_threadCount:0,Provider:null,Consumer:null},F.Provider=F,F.Consumer={$$typeof:o,_context:F},F},at.createElement=function(F,X,te){var Z,Y={},le=null;if(X!=null)for(Z in X.key!==void 0&&(le=""+X.key),X)L.call(X,Z)&&Z!=="key"&&Z!=="__self"&&Z!=="__source"&&(Y[Z]=X[Z]);var xe=arguments.length-2;if(xe===1)Y.children=te;else if(1<xe){for(var fe=Array(xe),oe=0;oe<xe;oe++)fe[oe]=arguments[oe+2];Y.children=fe}if(F&&F.defaultProps)for(Z in xe=F.defaultProps,xe)Y[Z]===void 0&&(Y[Z]=xe[Z]);return D(F,le,Y)},at.createRef=function(){return{current:null}},at.forwardRef=function(F){return{$$typeof:c,render:F}},at.isValidElement=z,at.lazy=function(F){return{$$typeof:h,_payload:{_status:-1,_result:F},_init:q}},at.memo=function(F,X){return{$$typeof:f,type:F,compare:X===void 0?null:X}},at.startTransition=W,at.unstable_useCacheRefresh=function(){return I.H.useCacheRefresh()},at.use=function(F){return I.H.use(F)},at.useActionState=function(F,X,te){return I.H.useActionState(F,X,te)},at.useCallback=function(F,X){return I.H.useCallback(F,X)},at.useContext=function(F){return I.H.useContext(F)},at.useDebugValue=function(){},at.useDeferredValue=function(F,X){return I.H.useDeferredValue(F,X)},at.useEffect=function(F,X){return I.H.useEffect(F,X)},at.useEffectEvent=function(F){return I.H.useEffectEvent(F)},at.useId=function(){return I.H.useId()},at.useImperativeHandle=function(F,X,te){return I.H.useImperativeHandle(F,X,te)},at.useInsertionEffect=function(F,X){return I.H.useInsertionEffect(F,X)},at.useLayoutEffect=function(F,X){return I.H.useLayoutEffect(F,X)},at.useMemo=function(F,X){return I.H.useMemo(F,X)},at.useOptimistic=function(F,X){return I.H.useOptimistic(F,X)},at.useReducer=function(F,X,te){return I.H.useReducer(F,X,te)},at.useRef=function(F){return I.H.useRef(F)},at.useState=function(F){return I.H.useState(F)},at.useSyncExternalStore=function(F,X,te){return I.H.useSyncExternalStore(F,X,te)},at.useTransition=function(){return I.H.useTransition()},at.version="19.3.0",at}var Uk;function am(){return Uk||(Uk=1,f1.exports=jV()),f1.exports}var N=am();const si=n2(N),PV=IV({__proto__:null,default:si},[N]),IP=N.createContext(void 0),_o=e=>{const t=N.useContext(IP);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},zV=({client:e,children:t})=>(N.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),m.jsx(IP.Provider,{value:e,children:t})),BV={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)};var ha,t2,SP,HV=(SP=class{constructor(){Qe(this,ha,BV);Qe(this,t2,!1)}setTimeoutProvider(e){He(this,ha,e)}setTimeout(e,t){return J(this,ha).setTimeout(e,t)}clearTimeout(e){J(this,ha).clearTimeout(e)}setInterval(e,t){return J(this,ha).setInterval(e,t)}clearInterval(e){J(this,ha).clearInterval(e)}},ha=new WeakMap,t2=new WeakMap,SP);const Lc=new HV;function FV(e){setTimeout(e,0)}const $V=typeof window>"u"||"Deno"in globalThis;function Jr(){}function UV(e,t){return typeof e=="function"?e(t):e}function LP(e){return typeof e=="number"&&e>=0&&e!==1/0}function DP(e,t){return Math.max(e+(t||0)-Date.now(),0)}function fn(e,t){return typeof e=="function"?e(t):e}function Vk(e,t){const{type:n="all",exact:r,fetchStatus:s,predicate:o,queryKey:l,stale:c}=e;if(l){if(r){if(t.queryHash!==r2(l,t.options))return!1}else if(!of(t.queryKey,l))return!1}if(n!=="all"){const u=t.isActive();if(n==="active"&&!u||n==="inactive"&&u)return!1}return!(typeof c=="boolean"&&t.isStale()!==c||s&&s!==t.state.fetchStatus||o&&!o(t))}function qk(e,t){const{exact:n,status:r,predicate:s,mutationKey:o}=e;if(o){if(!t.options.mutationKey)return!1;if(n){if(ja(t.options.mutationKey)!==ja(o))return!1}else if(!of(t.options.mutationKey,o))return!1}return!(r&&t.state.status!==r||s&&!s(t))}function r2(e,t){return((t==null?void 0:t.queryKeyHashFn)||ja)(e)}function ja(e){return JSON.stringify(e,(t,n)=>Pw(n)?Object.keys(n).sort().reduce((r,s)=>(r[s]=n[s],r),{}):n)}function of(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(e&&t&&typeof e=="object"&&typeof t=="object"){if(Array.isArray(e)&&Array.isArray(t)){if(t.length>e.length)return!1;for(let r=0;r<t.length;r++)if(!of(e[r],t[r]))return!1;return!0}const n=Object.keys(t);for(const r of n)if(!of(e[r],t[r]))return!1;return!0}return!1}const VV=Object.prototype.hasOwnProperty;function jP(e,t,n=0){if(e===t)return e;if(n>500)return t;const r=Gk(e)&&Gk(t);if(!r&&!(Pw(e)&&Pw(t)))return t;const s=(r?e:Object.keys(e)).length,o=r?t:Object.keys(t),l=o.length,c=r?new Array(l):{};let u=0;for(let f=0;f<l;f++){const h=r?f:o[f],p=e[h],y=t[h];if(p===y){c[h]=p,(r?f<s:VV.call(e,h))&&u++;continue}if(p===null||y===null||typeof p!="object"||typeof y!="object"){c[h]=y;continue}const x=jP(p,y,n+1);c[h]=x,x===p&&u++}return s===l&&u===s?e:c}function ly(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(const n in e)if(e[n]!==t[n])return!1;return!0}function Gk(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function Pw(e){if(!Kk(e))return!1;const t=Object.getPrototypeOf(e),n=t==null?void 0:t.constructor;if(n===void 0)return!0;if(typeof n!="function")return!1;const r=n.prototype;return!(!Kk(r)||!r.hasOwnProperty("isPrototypeOf")||t!==Object.prototype)}function Kk(e){return Object.prototype.toString.call(e)==="[object Object]"}function qV(e){return new Promise(t=>{Lc.setTimeout(t,e)})}function zw(e,t,n){return typeof n.structuralSharing=="function"?n.structuralSharing(e,t):n.structuralSharing!==!1?jP(e,t):t}function Mx(e){return e}function GV(e,t,n=0){const r=[...e,t];return n&&r.length>n?r.slice(1):r}function KV(e,t,n=0){const r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}const ao=Symbol();function PP(e,t){return!e.queryFn&&(t!=null&&t.initialPromise)?()=>t.initialPromise:!e.queryFn||e.queryFn===ao?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function s2(e,t){return typeof e=="function"?e(...t):!!e}function YV(e,t,n){let r=!1,s;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(s??(s=t()),r||(r=!0,s.aborted?n():s.addEventListener("abort",n,{once:!0})),s)}),e}let WV=()=>$V;const o2=()=>WV();var Of=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},Fc,pa,Gd,wP,XV=(wP=class extends Of{constructor(){super();Qe(this,Fc);Qe(this,pa);Qe(this,Gd);He(this,Gd,t=>{if(typeof window<"u"&&window.addEventListener){const n=()=>t();return window.addEventListener("visibilitychange",n,!1),()=>{window.removeEventListener("visibilitychange",n)}}})}onSubscribe(){J(this,pa)||this.setEventListener(J(this,Gd))}onUnsubscribe(){var t;this.hasListeners()||((t=J(this,pa))==null||t.call(this),He(this,pa,void 0))}setEventListener(t){var n;He(this,Gd,t),(n=J(this,pa))==null||n.call(this),He(this,pa,t(r=>{typeof r=="boolean"?this.setFocused(r):this.onFocus()}))}setFocused(t){J(this,Fc)!==t&&(He(this,Fc,t),this.onFocus())}onFocus(){const t=this.isFocused();this.listeners.forEach(n=>{n(t)})}isFocused(){var t;return typeof J(this,Fc)=="boolean"?J(this,Fc):((t=globalThis.document)==null?void 0:t.visibilityState)!=="hidden"}},Fc=new WeakMap,pa=new WeakMap,Gd=new WeakMap,wP);const i2=new XV,QV=FV;function ZV(){let e=[],t=0,n=c=>{c()},r=c=>{c()},s=QV;const o=c=>{t?e.push(c):s(()=>{n(c)})},l=()=>{const c=e;e=[],c.length&&s(()=>{r(()=>{c.forEach(u=>{n(u)})})})};return{batch:c=>{let u;t++;try{u=c()}finally{t--,t||l()}return u},batchCalls:c=>(...u)=>{o(()=>{c(...u)})},schedule:o,setNotifyFunction:c=>{n=c},setBatchNotifyFunction:c=>{r=c},setScheduler:c=>{s=c}}}const Zn=ZV();var Kd,ma,Yd,EP,JV=(EP=class extends Of{constructor(){super();Qe(this,Kd,!0);Qe(this,ma);Qe(this,Yd);He(this,Yd,t=>{if(typeof window<"u"&&window.addEventListener){const n=()=>t(!0),r=()=>t(!1);return window.addEventListener("online",n,!1),window.addEventListener("offline",r,!1),()=>{window.removeEventListener("online",n),window.removeEventListener("offline",r)}}})}onSubscribe(){J(this,ma)||this.setEventListener(J(this,Yd))}onUnsubscribe(){var t;this.hasListeners()||((t=J(this,ma))==null||t.call(this),He(this,ma,void 0))}setEventListener(t){var n;He(this,Yd,t),(n=J(this,ma))==null||n.call(this),He(this,ma,t(this.setOnline.bind(this)))}setOnline(t){J(this,Kd)!==t&&(He(this,Kd,t),this.listeners.forEach(n=>{n(t)}))}isOnline(){return J(this,Kd)}},Kd=new WeakMap,ma=new WeakMap,Yd=new WeakMap,EP);const _y=new JV;function eq(e){return Math.min(1e3*2**e,3e4)}function zP(e){return(e??"online")==="online"?_y.isOnline():!0}var Bw=class extends Error{constructor(e){super("CancelledError"),this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function BP(e){let t=!1,n=0,r,s="pending",o,l;const c=new Promise((O,T)=>{o=O,l=T});c.catch(Jr);const u=()=>s!=="pending",f=O=>{var T;if(!u()){const R=new Bw(O);S(R),(T=e.onCancel)==null||T.call(e,R)}},h=()=>{t=!0},p=()=>{t=!1},y=()=>i2.isFocused()&&(e.networkMode==="always"||_y.isOnline())&&e.canRun(),x=()=>zP(e.networkMode)&&e.canRun(),b=O=>{u()||(r==null||r(),s="resolved",o(O))},S=O=>{u()||(r==null||r(),s="rejected",l(O))},E=()=>new Promise(O=>{var T;r=R=>{(u()||y())&&O(R)},(T=e.onPause)==null||T.call(e)}).then(()=>{var O;r=void 0,u()||(O=e.onContinue)==null||O.call(e)}),C=()=>{if(u())return;let O;const T=n===0?e.initialPromise:void 0;try{O=T??e.fn()}catch(R){O=Promise.reject(R)}Promise.resolve(O).then(b).catch(R=>{var L;if(u())return;const k=e.retry??(o2()?0:3),M=e.retryDelay??eq,A=typeof M=="function"?M(n,R):M,I=k===!0||typeof k=="number"&&n<k||typeof k=="function"&&k(n,R);if(t||!I){S(R);return}n++,(L=e.onFail)==null||L.call(e,n,R),qV(A).then(()=>y()?void 0:E()).then(()=>{t?S(R):C()})})};return{promise:c,status:()=>s,cancel:f,continue:()=>(r==null||r(),c),cancelRetry:h,continueRetry:p,canStart:x,start:()=>(x()?C():E().then(C),c)}}var $c,CP,HP=(CP=class{constructor(){Qe(this,$c)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),LP(this.gcTime)&&He(this,$c,Lc.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(o2()?1/0:3e5))}clearGcTimeout(){J(this,$c)!==void 0&&(Lc.clearTimeout(J(this,$c)),He(this,$c,void 0))}},$c=new WeakMap,CP);function tq(e){return{onFetch:(t,n)=>{var h,p,y,x,b;const r=t.options,s=(y=(p=(h=t.fetchOptions)==null?void 0:h.meta)==null?void 0:p.fetchMore)==null?void 0:y.direction,o=((x=t.state.data)==null?void 0:x.pages)||[],l=((b=t.state.data)==null?void 0:b.pageParams)||[];let c={pages:[],pageParams:[]},u=0;const f=async()=>{let S=!1;const E=T=>{YV(T,()=>t.signal,()=>S=!0)},C=PP(t.options,t.fetchOptions),O=async(T,R,k)=>{if(S)return Promise.reject(t.signal.reason);if(R==null&&T.pages.length)return Promise.resolve(T);const A=(()=>{const P={client:t.client,queryKey:t.queryKey,pageParam:R,direction:k?"backward":"forward",meta:t.options.meta};return E(P),P})(),I=await C(A),{maxPages:L}=t.options,D=k?KV:GV;return{pages:D(T.pages,I,L),pageParams:D(T.pageParams,R,L)}};if(s&&o.length){const T=s==="backward",R=T?nq:Yk,k={pages:o,pageParams:l};c=await O(k,R(r,k),T)}else{const T=e??o.length;do{const R=u===0?l[0]??r.initialPageParam:Yk(r,c);if(u>0&&R==null)break;c=await O(c,R),u++}while(u<T)}return c};t.options.persister?t.fetchFn=()=>{var S,E;return(E=(S=t.options).persister)==null?void 0:E.call(S,f,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n)}:t.fetchFn=f}}}function Yk(e,{pages:t,pageParams:n}){const r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function nq(e,{pages:t,pageParams:n}){var r;return t.length>0?(r=e.getPreviousPageParam)==null?void 0:r.call(e,t[0],t,n[0],n):void 0}var Wd,Uc,Xd,no,Vc,Qn,rm,qc,vo,zi,TP,rq=(TP=class extends HP{constructor(t){super();Qe(this,vo);Qe(this,Wd);Qe(this,Uc);Qe(this,Xd);Qe(this,no);Qe(this,Vc);Qe(this,Qn);Qe(this,rm);Qe(this,qc);He(this,qc,!1),He(this,rm,t.defaultOptions),this.setOptions(t.options),this.observers=[],He(this,Vc,t.client),He(this,no,J(this,Vc).getQueryCache()),this.queryKey=t.queryKey,this.queryHash=t.queryHash,He(this,Uc,Xk(this.options)),this.state=t.state??J(this,Uc),this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return J(this,Wd)}get promise(){var t;return(t=J(this,Qn))==null?void 0:t.promise}setOptions(t){if(this.options={...J(this,rm),...t},t!=null&&t._type&&He(this,Wd,t._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const n=Xk(this.options);n.data!==void 0&&(this.setState(Wk(n.data,n.dataUpdatedAt)),He(this,Uc,n))}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&J(this,no).remove(this)}setData(t,n){const r=zw(this.state.data,t,this.options);return gt(this,vo,zi).call(this,{data:r,type:"success",dataUpdatedAt:n==null?void 0:n.updatedAt,manual:n==null?void 0:n.manual}),r}setState(t){gt(this,vo,zi).call(this,{type:"setState",state:t})}cancel(t){var r,s;const n=(r=J(this,Qn))==null?void 0:r.promise;return(s=J(this,Qn))==null||s.cancel(t),n?n.then(Jr).catch(Jr):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return J(this,Uc)}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(t=>fn(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===ao||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0?this.observers.some(t=>fn(t.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(t=>t.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(t=0){return this.state.data===void 0?!0:t==="static"?!1:this.state.isInvalidated?!0:!DP(this.state.dataUpdatedAt,t)}onFocus(){var t,n;(t=this.observers.find(r=>r.shouldFetchOnWindowFocus()))==null||t.refetch({cancelRefetch:!1}),(n=J(this,Qn))==null||n.continue()}onOnline(){var t,n;(t=this.observers.find(r=>r.shouldFetchOnReconnect()))==null||t.refetch({cancelRefetch:!1}),(n=J(this,Qn))==null||n.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),J(this,no).notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){const n=this.observers.indexOf(t);n!==-1&&(this.observers.splice(n,1),this.observers.length||(J(this,Qn)&&(J(this,qc)||this.state.fetchStatus==="paused"&&this.state.status==="pending"?J(this,Qn).cancel({revert:!0}):J(this,Qn).cancelRetry()),this.scheduleGc()),J(this,no).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||gt(this,vo,zi).call(this,{type:"invalidate"})}async fetch(t,n){var f,h,p,y,x,b,S,E,C,O,T,R;if(this.state.fetchStatus!=="idle"&&((f=J(this,Qn))==null?void 0:f.status())!=="rejected"){if(this.state.data!==void 0&&(n!=null&&n.cancelRefetch))this.cancel({silent:!0});else if(J(this,Qn))return J(this,Qn).continueRetry(),J(this,Qn).promise}if(t&&this.setOptions(t),!this.options.queryFn){const k=this.observers.find(M=>M.options.queryFn);k&&this.setOptions(k.options)}const r=new AbortController,s=k=>{Object.defineProperty(k,"signal",{enumerable:!0,get:()=>(He(this,qc,!0),r.signal)})},o=()=>{const k=PP(this.options,n),A=(()=>{const I={client:J(this,Vc),queryKey:this.queryKey,meta:this.meta};return s(I),I})();return He(this,qc,!1),this.options.persister?this.options.persister(k,A,this):k(A)},c=(()=>{const k={fetchOptions:n,options:this.options,queryKey:this.queryKey,client:J(this,Vc),state:this.state,fetchFn:o};return s(k),k})();(h=J(this,Wd)==="infinite"?tq(this.options.pages):this.options.behavior)==null||h.onFetch(c,this),He(this,Xd,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((p=c.fetchOptions)==null?void 0:p.meta))&>(this,vo,zi).call(this,{type:"fetch",meta:(y=c.fetchOptions)==null?void 0:y.meta});const u=He(this,Qn,BP({initialPromise:n==null?void 0:n.initialPromise,fn:c.fetchFn,onCancel:k=>{k instanceof Bw&&k.revert&&this.setState({...J(this,Xd),fetchStatus:"idle"}),r.abort()},onFail:(k,M)=>{gt(this,vo,zi).call(this,{type:"failed",failureCount:k,error:M})},onPause:()=>{gt(this,vo,zi).call(this,{type:"pause"})},onContinue:()=>{gt(this,vo,zi).call(this,{type:"continue"})},retry:c.options.retry,retryDelay:c.options.retryDelay,networkMode:c.options.networkMode,canRun:()=>!0}));try{const k=await u.start();if(k===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(k),(b=(x=J(this,no).config).onSuccess)==null||b.call(x,k,this),(E=(S=J(this,no).config).onSettled)==null||E.call(S,k,this.state.error,this),k}catch(k){if(k instanceof Bw){if(k.silent)return J(this,Qn).promise;if(k.revert){if(this.state.data===void 0)throw k;return this.state.data}}throw gt(this,vo,zi).call(this,{type:"error",error:k}),(O=(C=J(this,no).config).onError)==null||O.call(C,k,this),(R=(T=J(this,no).config).onSettled)==null||R.call(T,this.state.data,k,this),k}finally{J(this,Qn)===u&&He(this,Qn,void 0),this.scheduleGc()}}},Wd=new WeakMap,Uc=new WeakMap,Xd=new WeakMap,no=new WeakMap,Vc=new WeakMap,Qn=new WeakMap,rm=new WeakMap,qc=new WeakMap,vo=new WeakSet,zi=function(t){const n=r=>{switch(t.type){case"failed":return{...r,fetchFailureCount:t.failureCount,fetchFailureReason:t.error};case"pause":return{...r,fetchStatus:"paused"};case"continue":return{...r,fetchStatus:"fetching"};case"fetch":return{...r,...FP(r.data,this.options),fetchMeta:t.meta??null};case"success":const s={...r,...Wk(t.data,t.dataUpdatedAt),dataUpdateCount:r.dataUpdateCount+1,...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return He(this,Xd,t.manual?s:void 0),s;case"error":const o=t.error;return{...r,error:o,errorUpdateCount:r.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:r.fetchFailureCount+1,fetchFailureReason:o,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...r,isInvalidated:!0};case"setState":return{...r,...t.state}}};this.state=n(this.state),Zn.batch(()=>{this.observers.slice().forEach(r=>{r.onQueryUpdate()}),J(this,no).notify({query:this,type:"updated",action:t})})},TP);function FP(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:zP(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function Wk(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:"success"}}function Xk(e){const t=typeof e.initialData=="function"?e.initialData():e.initialData,n=t!==void 0,r=n?typeof e.initialDataUpdatedAt=="function"?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?"success":"pending",fetchStatus:"idle"}}var Qr,kt,sm,Zr,Gc,Qd,Fi,om,Zd,Jd,Kc,Yc,ga,ef,Bt,Gh,Hw,Fw,$w,Uw,Vw,qw,Gw,Kw,NP,$P=(NP=class extends Of{constructor(t,n){super();Qe(this,Bt);Qe(this,Qr);Qe(this,kt);Qe(this,sm);Qe(this,Zr);Qe(this,Gc);Qe(this,Qd);Qe(this,Fi);Qe(this,om);Qe(this,Zd);Qe(this,Jd);Qe(this,Kc);Qe(this,Yc);Qe(this,ga);Qe(this,ef,new Set);this.options=n,He(this,Qr,t),He(this,Fi,null),this.bindMethods(),this.setOptions(n)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(J(this,kt).addObserver(this),Qk(J(this,kt),this.options)?gt(this,Bt,Gh).call(this):this.updateResult(),gt(this,Bt,Vw).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return Yw(J(this,kt),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Yw(J(this,kt),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,gt(this,Bt,qw).call(this),gt(this,Bt,Gw).call(this),J(this,kt).removeObserver(this)}setOptions(t){const n=this.options,r=J(this,kt);if(this.options=J(this,Qr).defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof fn(this.options.enabled,J(this,kt))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");gt(this,Bt,Kw).call(this),J(this,kt).setOptions(this.options),n._defaulted&&!ly(this.options,n)&&J(this,Qr).getQueryCache().notify({type:"observerOptionsUpdated",query:J(this,kt),observer:this});const s=this.hasListeners();s&&Zk(J(this,kt),r,this.options,n)&>(this,Bt,Gh).call(this),this.updateResult(),s&&(J(this,kt)!==r||fn(this.options.enabled,J(this,kt))!==fn(n.enabled,J(this,kt))||fn(this.options.staleTime,J(this,kt))!==fn(n.staleTime,J(this,kt)))&>(this,Bt,Fw).call(this);const o=gt(this,Bt,$w).call(this);s&&(J(this,kt)!==r||fn(this.options.enabled,J(this,kt))!==fn(n.enabled,J(this,kt))||o!==J(this,ga))&>(this,Bt,Uw).call(this,o)}getOptimisticResult(t){const n=J(this,Qr).getQueryCache().build(J(this,Qr),t),r=this.createResult(n,t);return ly(this.getCurrentResult(),r)||(He(this,Zr,r),He(this,Qd,this.options),He(this,Gc,J(this,kt).state)),r}getCurrentResult(){return J(this,Zr)}trackResult(t,n){return new Proxy(t,{get:(r,s)=>(this.trackProp(s),n==null||n(s),Reflect.get(r,s))})}trackProp(t){J(this,ef).add(t)}getCurrentQuery(){return J(this,kt)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const n=J(this,Qr).defaultQueryOptions(t),r=J(this,Qr).getQueryCache().build(J(this,Qr),n);let s=()=>{},o;const l=new Promise(c=>{o=c,s=J(this,Qr).getQueryCache().subscribe(u=>{u.type==="updated"&&u.query.queryHash===r.queryHash&&r.state.data!==void 0&&(s(),c(this.createResult(r,n)))})});return Promise.race([r.fetch().then(()=>{const c=this.createResult(r,n);return o==null||o(c),c}).finally(()=>{s()}),l])}fetch(t){return gt(this,Bt,Gh).call(this,{...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),J(this,Zr)))}createResult(t,n){var M;const r=J(this,kt),s=this.options,o=J(this,Zr),l=J(this,Gc),c=J(this,Qd),u=t!==r?t.state:J(this,sm),{state:f}=t;let h={...f},p=!1,y;if(n._optimisticResults){const A=this.hasListeners(),I=!A&&Qk(t,n),L=A&&Zk(t,r,n,s);(I||L)&&(h={...h,...FP(f.data,t.options)}),n._optimisticResults==="isRestoring"&&(h.fetchStatus="idle")}let{error:x,errorUpdatedAt:b,status:S}=h;y=h.data;let E=!1;if(n.placeholderData!==void 0&&y===void 0&&S==="pending"){let A;o!=null&&o.isPlaceholderData&&n.placeholderData===(c==null?void 0:c.placeholderData)?(A=o.data,E=!0):A=typeof n.placeholderData=="function"?n.placeholderData((M=J(this,Jd))==null?void 0:M.state.data,J(this,Jd)):n.placeholderData,A!==void 0&&(S="success",y=zw(o==null?void 0:o.data,A,n),p=!0)}if(n.select&&y!==void 0&&!E)if(o&&y===(l==null?void 0:l.data)&&n.select===J(this,om))y=J(this,Zd);else try{He(this,om,n.select),y=n.select(y),y=zw(o==null?void 0:o.data,y,n),He(this,Zd,y),He(this,Fi,null)}catch(A){He(this,Fi,A)}else y===void 0&&He(this,Fi,null);J(this,Fi)&&(x=J(this,Fi),y=J(this,Zd),b=Date.now(),S="error",p=!1);const C=h.fetchStatus==="fetching",O=S==="pending",T=S==="error",R=O&&C,k=y!==void 0;return{status:S,fetchStatus:h.fetchStatus,isPending:O,isSuccess:S==="success",isError:T,isInitialLoading:R,isLoading:R,data:y,dataUpdatedAt:h.dataUpdatedAt,error:x,errorUpdatedAt:b,failureCount:h.fetchFailureCount,failureReason:h.fetchFailureReason,errorUpdateCount:h.errorUpdateCount,isFetched:t.isFetched(),isFetchedAfterMount:h.dataUpdateCount>u.dataUpdateCount||h.errorUpdateCount>u.errorUpdateCount,isFetching:C,isRefetching:C&&!O,isLoadingError:T&&!k,isPaused:h.fetchStatus==="paused",isPlaceholderData:p,isRefetchError:T&&k,isStale:l2(t,n),refetch:this.refetch,isEnabled:fn(n.enabled,t)!==!1}}updateResult(){const t=J(this,Zr),n=this.createResult(J(this,kt),this.options);if(He(this,Gc,J(this,kt).state),He(this,Qd,this.options),J(this,Gc).data!==void 0&&He(this,Jd,J(this,kt)),ly(n,t))return;He(this,Zr,n);const s=(()=>{if(!t)return!0;const{notifyOnChangeProps:o}=this.options,l=typeof o=="function"?o():o;if(l==="all"||!l&&!J(this,ef).size)return!0;const c=new Set(l??J(this,ef));return this.options.throwOnError&&c.add("error"),Object.keys(J(this,Zr)).some(u=>{const f=u;return J(this,Zr)[f]!==t[f]&&c.has(f)})})();Zn.batch(()=>{s&&this.listeners.forEach(o=>{o(J(this,Zr))}),J(this,Qr).getQueryCache().notify({query:J(this,kt),type:"observerResultsUpdated"})})}onQueryUpdate(){this.updateResult(),this.hasListeners()&>(this,Bt,Vw).call(this)}},Qr=new WeakMap,kt=new WeakMap,sm=new WeakMap,Zr=new WeakMap,Gc=new WeakMap,Qd=new WeakMap,Fi=new WeakMap,om=new WeakMap,Zd=new WeakMap,Jd=new WeakMap,Kc=new WeakMap,Yc=new WeakMap,ga=new WeakMap,ef=new WeakMap,Bt=new WeakSet,Gh=function(t){gt(this,Bt,Kw).call(this);let n=J(this,kt).fetch(this.options,t);return t!=null&&t.throwOnError||(n=n.catch(Jr)),n},Hw=function(t){return!o2()&&fn(this.options.enabled,J(this,kt))!==!1&&LP(t)},Fw=function(){gt(this,Bt,qw).call(this);const t=fn(this.options.staleTime,J(this,kt));if(J(this,Zr).isStale||!gt(this,Bt,Hw).call(this,t))return;const n=DP(J(this,Zr).dataUpdatedAt,t)+1;He(this,Kc,Lc.setTimeout(()=>{J(this,Zr).isStale||this.updateResult()},n))},$w=function(){return fn(this.options.refetchInterval,J(this,kt))??!1},Uw=function(t){gt(this,Bt,Gw).call(this),He(this,ga,t),!(J(this,ga)===0||!gt(this,Bt,Hw).call(this,J(this,ga)))&&He(this,Yc,Lc.setInterval(()=>{(this.options.refetchIntervalInBackground||i2.isFocused())&>(this,Bt,Gh).call(this)},J(this,ga)))},Vw=function(){gt(this,Bt,Fw).call(this),gt(this,Bt,Uw).call(this,gt(this,Bt,$w).call(this))},qw=function(){J(this,Kc)!==void 0&&(Lc.clearTimeout(J(this,Kc)),He(this,Kc,void 0))},Gw=function(){J(this,Yc)!==void 0&&(Lc.clearInterval(J(this,Yc)),He(this,Yc,void 0))},Kw=function(){const t=J(this,Qr).getQueryCache().build(J(this,Qr),this.options);if(t===J(this,kt))return;const n=J(this,kt);He(this,kt,t),He(this,sm,t.state),this.hasListeners()&&(n==null||n.removeObserver(this),t.addObserver(this))},NP);function sq(e,t){return fn(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&fn(t.retryOnMount,e)===!1)}function Qk(e,t){return sq(e,t)||e.state.data!==void 0&&Yw(e,t,t.refetchOnMount)}function Yw(e,t,n){if(fn(t.enabled,e)!==!1&&fn(t.staleTime,e)!=="static"){const r=fn(n,e);return r==="always"||r!==!1&&l2(e,t)}return!1}function Zk(e,t,n,r){return(e!==t||fn(r.enabled,e)===!1)&&(!n.suspense||e.state.status!=="error")&&l2(e,n)}function l2(e,t){return fn(t.enabled,e)!==!1&&e.isStaleByTime(fn(t.staleTime,e))}var im,Zo,Ir,Wc,Jo,oa,OP,oq=(OP=class extends HP{constructor(t){super();Qe(this,Jo);Qe(this,im);Qe(this,Zo);Qe(this,Ir);Qe(this,Wc);He(this,im,t.client),this.mutationId=t.mutationId,He(this,Ir,t.mutationCache),He(this,Zo,[]),this.state=t.state||UP(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){J(this,Zo).includes(t)||(J(this,Zo).push(t),this.clearGcTimeout(),J(this,Ir).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){He(this,Zo,J(this,Zo).filter(n=>n!==t)),this.scheduleGc(),J(this,Ir).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){J(this,Zo).length||(this.state.status==="pending"?this.scheduleGc():J(this,Ir).remove(this))}continue(){var t;return((t=J(this,Wc))==null?void 0:t.continue())??(this.state.status==="pending"?this.execute(this.state.variables):Promise.resolve())}async execute(t){var c,u,f,h,p,y,x,b,S,E,C,O,T,R,k,M,A,I;const n=()=>{gt(this,Jo,oa).call(this,{type:"continue"})},r={client:J(this,im),meta:this.options.meta,mutationKey:this.options.mutationKey},s=He(this,Wc,BP({fn:()=>this.options.mutationFn?this.options.mutationFn(t,r):Promise.reject(new Error("No mutationFn found")),onFail:(L,D)=>{gt(this,Jo,oa).call(this,{type:"failed",failureCount:L,error:D})},onPause:()=>{gt(this,Jo,oa).call(this,{type:"pause"})},onContinue:n,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>J(this,Ir).canRun(this)})),o=this.state.status==="pending",l=!s.canStart();try{if(o)n();else{gt(this,Jo,oa).call(this,{type:"pending",variables:t,isPaused:l}),J(this,Ir).config.onMutate&&await J(this,Ir).config.onMutate(t,this,r);const D=await((u=(c=this.options).onMutate)==null?void 0:u.call(c,t,r));D!==this.state.context&>(this,Jo,oa).call(this,{type:"pending",context:D,variables:t,isPaused:l})}const L=await s.start();return await((h=(f=J(this,Ir).config).onSuccess)==null?void 0:h.call(f,L,t,this.state.context,this,r)),await((y=(p=this.options).onSuccess)==null?void 0:y.call(p,L,t,this.state.context,r)),await((b=(x=J(this,Ir).config).onSettled)==null?void 0:b.call(x,L,null,this.state.variables,this.state.context,this,r)),await((E=(S=this.options).onSettled)==null?void 0:E.call(S,L,null,t,this.state.context,r)),gt(this,Jo,oa).call(this,{type:"success",data:L}),L}catch(L){try{await((O=(C=J(this,Ir).config).onError)==null?void 0:O.call(C,L,t,this.state.context,this,r))}catch(D){Promise.reject(D)}try{await((R=(T=this.options).onError)==null?void 0:R.call(T,L,t,this.state.context,r))}catch(D){Promise.reject(D)}try{await((M=(k=J(this,Ir).config).onSettled)==null?void 0:M.call(k,void 0,L,this.state.variables,this.state.context,this,r))}catch(D){Promise.reject(D)}try{await((I=(A=this.options).onSettled)==null?void 0:I.call(A,void 0,L,t,this.state.context,r))}catch(D){Promise.reject(D)}throw gt(this,Jo,oa).call(this,{type:"error",error:L}),L}finally{J(this,Wc)===s&&He(this,Wc,void 0),J(this,Ir).runNext(this)}}},im=new WeakMap,Zo=new WeakMap,Ir=new WeakMap,Wc=new WeakMap,Jo=new WeakSet,oa=function(t){const n=r=>{switch(t.type){case"failed":return{...r,failureCount:t.failureCount,failureReason:t.error};case"pause":return{...r,isPaused:!0};case"continue":return{...r,isPaused:!1};case"pending":return{...r,context:t.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:t.isPaused,status:"pending",variables:t.variables,submittedAt:Date.now()};case"success":return{...r,data:t.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...r,data:void 0,error:t.error,failureCount:r.failureCount+1,failureReason:t.error,isPaused:!1,status:"error"}}};this.state=n(this.state),Zn.batch(()=>{J(this,Zo).forEach(r=>{r.onMutationUpdate(t)}),J(this,Ir).notify({mutation:this,type:"updated",action:t})})},OP);function UP(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var $i,So,lm,RP,iq=(RP=class extends Of{constructor(t={}){super();Qe(this,$i);Qe(this,So);Qe(this,lm);this.config=t,He(this,$i,new Set),He(this,So,new Map),He(this,lm,0)}build(t,n,r){const s=new oq({client:t,mutationCache:this,mutationId:++m0(this,lm)._,options:t.defaultMutationOptions(n),state:r});return this.add(s),s}add(t){J(this,$i).add(t);const n=g0(t);if(typeof n=="string"){const r=J(this,So).get(n);r?r.push(t):J(this,So).set(n,[t])}this.notify({type:"added",mutation:t})}remove(t){if(J(this,$i).delete(t)){const n=g0(t);if(typeof n=="string"){const r=J(this,So).get(n);if(r)if(r.length>1){const s=r.indexOf(t);s!==-1&&r.splice(s,1)}else r[0]===t&&J(this,So).delete(n)}}this.notify({type:"removed",mutation:t})}canRun(t){var r;const n=g0(t);if(typeof n=="string"){const s=(r=J(this,So).get(n))==null?void 0:r.find(o=>o.state.status==="pending");return!s||s===t}else return!0}runNext(t){var r,s;const n=g0(t);return typeof n=="string"?((s=(r=J(this,So).get(n))==null?void 0:r.find(o=>o!==t&&o.state.isPaused))==null?void 0:s.continue())??Promise.resolve():Promise.resolve()}clear(){Zn.batch(()=>{J(this,$i).forEach(t=>{this.notify({type:"removed",mutation:t})}),J(this,$i).clear(),J(this,So).clear()})}getAll(){return Array.from(J(this,$i))}find(t){const n={exact:!0,...t};return this.getAll().find(r=>qk(n,r))}findAll(t={}){return this.getAll().filter(n=>qk(t,n))}notify(t){Zn.batch(()=>{this.listeners.forEach(n=>{n(t)})})}resumePausedMutations(){const t=this.getAll().filter(n=>n.state.isPaused);return Zn.batch(()=>Promise.all(t.map(n=>n.continue().catch(Jr))))}},$i=new WeakMap,So=new WeakMap,lm=new WeakMap,RP);function g0(e){var t;return(t=e.options.scope)==null?void 0:t.id}var Ui,ya,Lr,Vi,ii,Kh,Ww,AP,lq=(AP=class extends Of{constructor(n,r){super();Qe(this,ii);Qe(this,Ui);Qe(this,ya);Qe(this,Lr);Qe(this,Vi);He(this,Ui,n),this.setOptions(r),this.bindMethods(),gt(this,ii,Kh).call(this)}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(n){var s;const r=this.options;this.options=J(this,Ui).defaultMutationOptions(n),ly(this.options,r)||J(this,Ui).getMutationCache().notify({type:"observerOptionsUpdated",mutation:J(this,Lr),observer:this}),r!=null&&r.mutationKey&&this.options.mutationKey&&ja(r.mutationKey)!==ja(this.options.mutationKey)?this.reset():((s=J(this,Lr))==null?void 0:s.state.status)==="pending"&&J(this,Lr).setOptions(this.options)}onSubscribe(){this.listeners.size===1&&J(this,Lr)&&(J(this,Lr).addObserver(this),gt(this,ii,Kh).call(this))}onUnsubscribe(){var n;this.hasListeners()||(n=J(this,Lr))==null||n.removeObserver(this)}onMutationUpdate(n){gt(this,ii,Kh).call(this),gt(this,ii,Ww).call(this,n)}getCurrentResult(){return J(this,ya)}reset(){var n;(n=J(this,Lr))==null||n.removeObserver(this),He(this,Lr,void 0),gt(this,ii,Kh).call(this),gt(this,ii,Ww).call(this)}mutate(n,r){var s;return He(this,Vi,r),(s=J(this,Lr))==null||s.removeObserver(this),He(this,Lr,J(this,Ui).getMutationCache().build(J(this,Ui),this.options)),J(this,Lr).addObserver(this),J(this,Lr).execute(n)}},Ui=new WeakMap,ya=new WeakMap,Lr=new WeakMap,Vi=new WeakMap,ii=new WeakSet,Kh=function(){var r;const n=((r=J(this,Lr))==null?void 0:r.state)??UP();He(this,ya,{...n,isPending:n.status==="pending",isSuccess:n.status==="success",isError:n.status==="error",isIdle:n.status==="idle",mutate:this.mutate,reset:this.reset})},Ww=function(n){Zn.batch(()=>{var r,s,o,l,c,u,f,h;if(J(this,Vi)&&this.hasListeners()){const p=J(this,ya).variables,y=J(this,ya).context,x={client:J(this,Ui),meta:this.options.meta,mutationKey:this.options.mutationKey};if((n==null?void 0:n.type)==="success"){try{(s=(r=J(this,Vi)).onSuccess)==null||s.call(r,n.data,p,y,x)}catch(b){Promise.reject(b)}try{(l=(o=J(this,Vi)).onSettled)==null||l.call(o,n.data,null,p,y,x)}catch(b){Promise.reject(b)}}else if((n==null?void 0:n.type)==="error"){try{(u=(c=J(this,Vi)).onError)==null||u.call(c,n.error,p,y,x)}catch(b){Promise.reject(b)}try{(h=(f=J(this,Vi)).onSettled)==null||h.call(f,void 0,n.error,p,y,x)}catch(b){Promise.reject(b)}}}this.listeners.forEach(p=>{p(J(this,ya))})})},AP),ei,kP,aq=(kP=class extends Of{constructor(t={}){super();Qe(this,ei);this.config=t,He(this,ei,new Map)}build(t,n,r){const s=n.queryKey,o=n.queryHash??r2(s,n);let l=this.get(o);return l||(l=new rq({client:t,queryKey:s,queryHash:o,options:t.defaultQueryOptions(n),state:r,defaultOptions:t.getQueryDefaults(s)}),this.add(l)),l}add(t){J(this,ei).has(t.queryHash)||(J(this,ei).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){J(this,ei).get(t.queryHash)===t&&(t.destroy(),J(this,ei).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){Zn.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return J(this,ei).get(t)}getAll(){return[...J(this,ei).values()]}find(t){const n={exact:!0,...t};return this.getAll().find(r=>Vk(n,r))}findAll(t={}){const n=this.getAll();return Object.keys(t).length>0?n.filter(r=>Vk(t,r)):n}notify(t){Zn.batch(()=>{this.listeners.forEach(n=>{n(t)})})}onFocus(){Zn.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){Zn.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},ei=new WeakMap,kP),Sn,xa,ba,tf,nf,va,rf,sf,_P,cq=(_P=class{constructor(e={}){Qe(this,Sn);Qe(this,xa);Qe(this,ba);Qe(this,tf);Qe(this,nf);Qe(this,va);Qe(this,rf);Qe(this,sf);He(this,Sn,e.queryCache||new aq),He(this,xa,e.mutationCache||new iq),He(this,ba,e.defaultOptions||{}),He(this,tf,new Map),He(this,nf,new Map),He(this,va,0)}mount(){m0(this,va)._++,J(this,va)===1&&(He(this,rf,i2.subscribe(async e=>{e&&(await this.resumePausedMutations(),J(this,Sn).onFocus())})),He(this,sf,_y.subscribe(async e=>{e&&(await this.resumePausedMutations(),J(this,Sn).onOnline())})))}unmount(){var e,t;m0(this,va)._--,J(this,va)===0&&((e=J(this,rf))==null||e.call(this),He(this,rf,void 0),(t=J(this,sf))==null||t.call(this),He(this,sf,void 0))}isFetching(e){return J(this,Sn).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return J(this,xa).findAll({...e,status:"pending"}).length}getQueryData(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=J(this,Sn).get(t.queryHash))==null?void 0:n.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),n=J(this,Sn).build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(fn(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return J(this,Sn).findAll(e).map(({queryKey:t,state:n})=>[t,n.data])}setQueryData(e,t,n){var l;const r=this.defaultQueryOptions({queryKey:e}),s=(l=J(this,Sn).get(r.queryHash))==null?void 0:l.state.data,o=UV(t,s);if(o!==void 0)return J(this,Sn).build(this,r).setData(o,{...n,manual:!0})}setQueriesData(e,t,n){return Zn.batch(()=>J(this,Sn).findAll(e).map(({queryKey:r})=>[r,this.setQueryData(r,t,n)]))}getQueryState(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=J(this,Sn).get(t.queryHash))==null?void 0:n.state}removeQueries(e){const t=J(this,Sn);Zn.batch(()=>{t.findAll(e).forEach(n=>{t.remove(n)})})}resetQueries(e,t){const n=J(this,Sn);return Zn.batch(()=>{const r=n.findAll(e),s=new Set(r);return r.forEach(o=>{o.reset()}),this.refetchQueries({type:"active",predicate:o=>s.has(o)},t)})}cancelQueries(e,t={}){const n={revert:!0,...t},r=Zn.batch(()=>J(this,Sn).findAll(e).map(s=>s.cancel(n)));return Promise.all(r).then(Jr).catch(Jr)}invalidateQueries(e,t={}){return Zn.batch(()=>(J(this,Sn).findAll(e).forEach(n=>{n.invalidate()}),(e==null?void 0:e.refetchType)==="none"?Promise.resolve():this.refetchQueries({...e,type:(e==null?void 0:e.refetchType)??(e==null?void 0:e.type)??"active"},t)))}refetchQueries(e,t={}){const n={...t,cancelRefetch:t.cancelRefetch??!0},r=Zn.batch(()=>J(this,Sn).findAll(e).filter(s=>!s.isDisabled()&&!s.isStatic()).map(s=>{let o=s.fetch(void 0,n);return n.throwOnError||(o=o.catch(Jr)),s.state.fetchStatus==="paused"?Promise.resolve():o}));return Promise.all(r).then(Jr)}async query(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const n=J(this,Sn).build(this,t),r=n.isStaleByTime(fn(t.staleTime,n))?await n.fetch(t):n.state.data,s=t.select;return s?s(r):r}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const n=J(this,Sn).build(this,t);return n.isStaleByTime(fn(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(Jr).catch(Jr)}infiniteQuery(e){return e._type="infinite",this.query(e)}fetchInfiniteQuery(e){return e._type="infinite",this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(Jr).catch(Jr)}ensureInfiniteQueryData(e){return e._type="infinite",this.ensureQueryData(e)}resumePausedMutations(){return _y.isOnline()?J(this,xa).resumePausedMutations():Promise.resolve()}getQueryCache(){return J(this,Sn)}getMutationCache(){return J(this,xa)}getDefaultOptions(){return J(this,ba)}setDefaultOptions(e){He(this,ba,e)}setQueryDefaults(e,t){J(this,tf).set(ja(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...J(this,tf).values()],n={};return t.forEach(r=>{of(e,r.queryKey)&&Object.assign(n,r.defaultOptions)}),n}setMutationDefaults(e,t){J(this,nf).set(ja(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...J(this,nf).values()],n={};return t.forEach(r=>{of(e,r.mutationKey)&&Object.assign(n,r.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;const t={...J(this,ba).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=r2(t.queryKey,t)),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!=="always"),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode="offlineFirst"),t.queryFn===ao&&(t.enabled=!1),t}defaultMutationOptions(e){return e!=null&&e._defaulted?e:{...J(this,ba).mutations,...(e==null?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){J(this,Sn).clear(),J(this,xa).clear()}},Sn=new WeakMap,xa=new WeakMap,ba=new WeakMap,tf=new WeakMap,nf=new WeakMap,va=new WeakMap,rf=new WeakMap,sf=new WeakMap,_P);const VP=N.createContext(!1),uq=()=>N.useContext(VP);VP.Provider;function dq(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}const fq=N.createContext(dq()),hq=()=>N.useContext(fq),pq=(e,t,n)=>{const r=n!=null&&n.state.error&&typeof e.throwOnError=="function"?s2(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||r)&&(t.isReset()||(e.retryOnMount=!1))},mq=e=>{N.useEffect(()=>{e.clearReset()},[e])},gq=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:s})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(s&&e.data===void 0||s2(n,[e.error,r])),yq=(e,t)=>t.state.data===void 0,xq=e=>{if(e.suspense){const n=s=>s==="static"?s:Math.max(s??1e3,1e3),r=e.staleTime;e.staleTime=typeof r=="function"?(...s)=>n(r(...s)):n(r),typeof e.gcTime=="number"&&(e.gcTime=Math.max(e.gcTime,1e3))}},bq=(e,t)=>(e==null?void 0:e.suspense)&&t.isPending,vq=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function qP(e,t,n){const r=uq(),s=hq(),o=_o(),l=o.defaultQueryOptions(e),c=o.getQueryCache().get(l.queryHash),u=e.subscribed!==!1;l._optimisticResults=r?"isRestoring":u?"optimistic":void 0,xq(l),pq(l,s,c),mq(s);const[f]=N.useState(()=>new t(o,l)),h=f.getOptimisticResult(l),p=!r&&u;if(N.useSyncExternalStore(N.useCallback(y=>{const x=p?f.subscribe(Zn.batchCalls(y)):Jr;return f.updateResult(),x},[f,p]),()=>f.getCurrentResult(),()=>f.getCurrentResult()),N.useEffect(()=>{f.setOptions(l)},[l,f]),bq(l,h))throw vq(l,f,s);if(gq({result:h,errorResetBoundary:s,throwOnError:l.throwOnError,query:c,suspense:l.suspense}))throw h.error;return l.notifyOnChangeProps?h:f.trackResult(h)}function ui(e,t){return qP(e,$P)}function Sq(e,t){return qP({...e,enabled:!0,suspense:!0,throwOnError:yq,placeholderData:void 0},$P)}function On(e,t){const n=_o(),[r]=N.useState(()=>new lq(n,e));N.useEffect(()=>{r.setOptions(e)},[r,e]);const s=N.useSyncExternalStore(N.useCallback(l=>r.subscribe(Zn.batchCalls(l)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),o=N.useCallback((...l)=>{r.mutate(l[0],l[1]).catch(Jr)},[r]);if(s.error&&s2(r.options.throwOnError,[s.error]))throw s.error;return{...s,mutate:o,mutateAsync:s.mutate}}var h1={exports:{}},Mh={},p1={exports:{}},m1={};/**
|
|
19
|
+
* @license React
|
|
20
|
+
* scheduler.production.js
|
|
21
|
+
*
|
|
22
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
23
|
+
*
|
|
24
|
+
* This source code is licensed under the MIT license found in the
|
|
25
|
+
* LICENSE file in the root directory of this source tree.
|
|
26
|
+
*/var Jk;function wq(){return Jk||(Jk=1,(function(e){function t(B,V){var G=B.length;B.push(V);e:for(;0<G;){var q=G-1>>>1,K=B[q];if(0<s(K,V))B[q]=V,B[G]=K,G=q;else break e}}function n(B){return B.length===0?null:B[0]}function r(B){if(B.length===0)return null;var V=B[0],G=B.pop();if(G!==V){B[0]=G;e:for(var q=0,K=B.length,W=K>>>1;q<W;){var ee=2*(q+1)-1,ce=B[ee],F=ee+1,X=B[F];if(0>s(ce,G))F<K&&0>s(X,ce)?(B[q]=X,B[F]=G,q=F):(B[q]=ce,B[ee]=G,q=ee);else if(F<K&&0>s(X,G))B[q]=X,B[F]=G,q=F;else break e}}return V}function s(B,V){var G=B.sortIndex-V.sortIndex;return G!==0?G:B.id-V.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var o=performance;e.unstable_now=function(){return o.now()}}else{var l=Date,c=l.now();e.unstable_now=function(){return l.now()-c}}var u=[],f=[],h=1,p=null,y=3,x=!1,b=!1,S=!1,E=!1,C=typeof setTimeout=="function"?setTimeout:null,O=typeof clearTimeout=="function"?clearTimeout:null,T=typeof setImmediate<"u"?setImmediate:null;function R(B){for(var V=n(f);V!==null;){if(V.callback===null)r(f);else if(V.startTime<=B)r(f),V.sortIndex=V.expirationTime,t(u,V);else break;V=n(f)}}function k(B){if(S=!1,R(B),!b)if(n(u)!==null)b=!0,M||(M=!0,z());else{var V=n(f);V!==null&&H(k,V.startTime-B)}}var M=!1,A=-1,I=5,L=-1;function D(){return E?!0:!(e.unstable_now()-L<I)}function P(){if(E=!1,M){var B=e.unstable_now();L=B;var V=!0;try{e:{b=!1,S&&(S=!1,O(A),A=-1),x=!0;var G=y;try{t:{for(R(B),p=n(u);p!==null&&!(p.expirationTime>B&&D());){var q=p.callback;if(typeof q=="function"){p.callback=null,y=p.priorityLevel;var K=q(p.expirationTime<=B);if(B=e.unstable_now(),typeof K=="function"){p.callback=K,R(B),V=!0;break t}p===n(u)&&r(u),R(B)}else r(u);p=n(u)}if(p!==null)V=!0;else{var W=n(f);W!==null&&H(k,W.startTime-B),V=!1}}break e}finally{p=null,y=G,x=!1}V=void 0}}finally{V?z():M=!1}}}var z;if(typeof T=="function")z=function(){T(P)};else if(typeof MessageChannel<"u"){var $=new MessageChannel,j=$.port2;$.port1.onmessage=P,z=function(){j.postMessage(null)}}else z=function(){C(P,0)};function H(B,V){A=C(function(){B(e.unstable_now())},V)}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(B){B.callback=null},e.unstable_forceFrameRate=function(B){0>B||125<B?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):I=0<B?Math.floor(1e3/B):5},e.unstable_getCurrentPriorityLevel=function(){return y},e.unstable_next=function(B){switch(y){case 1:case 2:case 3:var V=3;break;default:V=y}var G=y;y=V;try{return B()}finally{y=G}},e.unstable_requestPaint=function(){E=!0},e.unstable_runWithPriority=function(B,V){switch(B){case 1:case 2:case 3:case 4:case 5:break;default:B=3}var G=y;y=B;try{return V()}finally{y=G}},e.unstable_scheduleCallback=function(B,V,G){var q=e.unstable_now();switch(typeof G=="object"&&G!==null?(G=G.delay,G=typeof G=="number"&&0<G?q+G:q):G=q,B){case 1:var K=-1;break;case 2:K=250;break;case 5:K=1073741823;break;case 4:K=1e4;break;default:K=5e3}return K=G+K,B={id:h++,callback:V,priorityLevel:B,startTime:G,expirationTime:K,sortIndex:-1},G>q?(B.sortIndex=G,t(f,B),n(u)===null&&B===n(f)&&(S?(O(A),A=-1):S=!0,H(k,G-q))):(B.sortIndex=K,t(u,B),b||x||(b=!0,M||(M=!0,z()))),B},e.unstable_shouldYield=D,e.unstable_wrapCallback=function(B){var V=y;return function(){var G=y;y=V;try{return B.apply(this,arguments)}finally{y=G}}}})(m1)),m1}var e_;function Eq(){return e_||(e_=1,p1.exports=wq()),p1.exports}var g1={exports:{}},Sr={};/**
|
|
27
|
+
* @license React
|
|
28
|
+
* react-dom.production.js
|
|
29
|
+
*
|
|
30
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
31
|
+
*
|
|
32
|
+
* This source code is licensed under the MIT license found in the
|
|
33
|
+
* LICENSE file in the root directory of this source tree.
|
|
34
|
+
*/var t_;function Cq(){if(t_)return Sr;t_=1;var e=am();function t(h){var p="https://react.dev/errors/"+h;if(1<arguments.length){p+="?args[]="+encodeURIComponent(arguments[1]);for(var y=2;y<arguments.length;y++)p+="&args[]="+encodeURIComponent(arguments[y])}return"Minified React error #"+h+"; visit "+p+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function n(){}var r={d:{f:n,r:function(){throw Error(t(522))},D:n,C:n,L:n,m:n,X:n,S:n,M:n},p:0,findDOMNode:null},s=Symbol.for("react.portal"),o=Symbol.for("react.recoverable"),l=Symbol.for("react.optimistic_key");function c(h,p,y){var x=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:s,key:x==null?null:x===l?l:""+x,children:h,containerInfo:p,implementation:y}}var u=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function f(h,p){if(h==="font")return"";if(typeof p=="string")return p==="use-credentials"?p:""}return Sr.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=r,Sr.browser=function(h){return{$$typeof:o,_reason:h}},Sr.createPortal=function(h,p){var y=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!p||p.nodeType!==1&&p.nodeType!==9&&p.nodeType!==11)throw Error(t(299));return c(h,p,null,y)},Sr.flushSync=function(h){var p=u.T,y=r.p;try{if(u.T=null,r.p=2,h)return h()}finally{u.T=p,r.p=y,r.d.f()}},Sr.preconnect=function(h,p){typeof h=="string"&&(p?(p=p.crossOrigin,p=typeof p=="string"?p==="use-credentials"?p:"":void 0):p=null,r.d.C(h,p))},Sr.prefetchDNS=function(h){typeof h=="string"&&r.d.D(h)},Sr.preinit=function(h,p){if(typeof h=="string"&&p&&typeof p.as=="string"){var y=p.as,x=f(y,p.crossOrigin),b=typeof p.integrity=="string"?p.integrity:void 0,S=typeof p.fetchPriority=="string"?p.fetchPriority:void 0;y==="style"?r.d.S(h,typeof p.precedence=="string"?p.precedence:void 0,{crossOrigin:x,integrity:b,fetchPriority:S}):y==="script"&&r.d.X(h,{crossOrigin:x,integrity:b,fetchPriority:S,nonce:typeof p.nonce=="string"?p.nonce:void 0})}},Sr.preinitModule=function(h,p){if(typeof h=="string")if(typeof p=="object"&&p!==null){if(p.as==null||p.as==="script"){var y=f(p.as,p.crossOrigin);r.d.M(h,{crossOrigin:y,integrity:typeof p.integrity=="string"?p.integrity:void 0,nonce:typeof p.nonce=="string"?p.nonce:void 0,fetchPriority:typeof p.fetchPriority=="string"?p.fetchPriority:void 0})}}else p==null&&r.d.M(h)},Sr.preload=function(h,p){if(typeof h=="string"&&typeof p=="object"&&p!==null&&typeof p.as=="string"){var y=p.as,x=f(y,p.crossOrigin);r.d.L(h,y,{crossOrigin:x,integrity:typeof p.integrity=="string"?p.integrity:void 0,nonce:typeof p.nonce=="string"?p.nonce:void 0,type:typeof p.type=="string"?p.type:void 0,fetchPriority:typeof p.fetchPriority=="string"?p.fetchPriority:void 0,referrerPolicy:typeof p.referrerPolicy=="string"?p.referrerPolicy:void 0,imageSrcSet:typeof p.imageSrcSet=="string"?p.imageSrcSet:void 0,imageSizes:typeof p.imageSizes=="string"?p.imageSizes:void 0,media:typeof p.media=="string"?p.media:void 0})}},Sr.preloadModule=function(h,p){if(typeof h=="string")if(p){var y=f(p.as,p.crossOrigin);r.d.m(h,{as:typeof p.as=="string"&&p.as!=="script"?p.as:void 0,crossOrigin:y,integrity:typeof p.integrity=="string"?p.integrity:void 0,nonce:typeof p.nonce=="string"?p.nonce:void 0,fetchPriority:typeof p.fetchPriority=="string"?p.fetchPriority:void 0})}else r.d.m(h)},Sr.requestFormReset=function(h){r.d.r(h)},Sr.unstable_batchedUpdates=function(h,p){return h(p)},Sr.useFormState=function(h,p,y){return u.H.useFormState(h,p,y)},Sr.useFormStatus=function(){return u.H.useHostTransitionStatus()},Sr.version="19.3.0",Sr}var n_;function GP(){if(n_)return g1.exports;n_=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),g1.exports=Cq(),g1.exports}/**
|
|
35
|
+
* @license React
|
|
36
|
+
* react-dom-client.production.js
|
|
37
|
+
*
|
|
38
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
39
|
+
*
|
|
40
|
+
* This source code is licensed under the MIT license found in the
|
|
41
|
+
* LICENSE file in the root directory of this source tree.
|
|
42
|
+
*/var r_;function Tq(){if(r_)return Mh;r_=1;var e=Eq(),t=am(),n=GP();function r(i){var a="https://react.dev/errors/"+i;if(1<arguments.length){a+="?args[]="+encodeURIComponent(arguments[1]);for(var d=2;d<arguments.length;d++)a+="&args[]="+encodeURIComponent(arguments[d])}return"Minified React error #"+i+"; visit "+a+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function s(i){return!(!i||i.nodeType!==1&&i.nodeType!==9&&i.nodeType!==11)}function o(i){for(var a=i,d=a;d&&!d.alternate;)a=d,(a.flags&4098)!==0&&(i=a.return),d=a.return;for(;a.return;)a=a.return;return a.tag===3?i:null}function l(i){if(i.tag===13){var a=i.memoizedState;if(a===null&&(i=i.alternate,i!==null&&(a=i.memoizedState)),a!==null)return a.dehydrated}return null}function c(i){if(i.tag===31){var a=i.memoizedState;if(a===null&&(i=i.alternate,i!==null&&(a=i.memoizedState)),a!==null)return a.dehydrated}return null}function u(i){if(o(i)!==i)throw Error(r(188))}function f(i){var a=i.alternate;if(!a){if(a=o(i),a===null)throw Error(r(188));return a!==i?null:i}for(var d=i,g=a;;){var v=d.return;if(v===null)break;var w=v.alternate;if(w===null){if(g=v.return,g!==null){d=g;continue}break}if(v.child===w.child){for(w=v.child;w;){if(w===d)return u(v),i;if(w===g)return u(v),a;w=w.sibling}throw Error(r(188))}if(d.return!==g.return)d=v,g=w;else{for(var _=!1,U=v.child;U;){if(U===d){_=!0,d=v,g=w;break}if(U===g){_=!0,g=v,d=w;break}U=U.sibling}if(!_){for(U=w.child;U;){if(U===d){_=!0,d=w,g=v;break}if(U===g){_=!0,g=w,d=v;break}U=U.sibling}if(!_)throw Error(r(189))}}if(d.alternate!==g)throw Error(r(190))}if(d.tag!==3)throw Error(r(188));return d.stateNode.current===d?i:a}function h(i){var a=i.tag;if(a===5||a===26||a===27||a===6)return i;for(i=i.child;i!==null;){if(a=h(i),a!==null)return a;i=i.sibling}return null}function p(i,a,d,g,v,w){for(;i!==null;){if((i.tag===5||i.tag===27||i.tag===6)&&d(i,g,v,w)||(i.tag!==22||i.memoizedState===null)&&(a||i.tag!==5&&i.tag!==27)&&p(i.child,a,d,g,v,w))return!0;i=i.sibling}return!1}function y(i){for(i=i.return;i!==null;){if(i.tag===3||i.tag===5||i.tag===27)return i;i=i.return}return null}function x(i){var a=!1;for(i=i.return;i!==null&&(i.tag===4&&(a=!0),!(i.tag===3||i.tag===5||i.tag===27));)i=i.return;return a}function b(i){var a=[null,null],d=y(i);return d===null||S(a,i,d.child,{foundSelf:!1}),a}function S(i,a,d,g){for(;d!==null;){if(d===a)g.foundSelf=!0;else if(d.tag===5||d.tag===27||d.tag===6){if(g.foundSelf)return i[1]=d,!0;i[0]=d}else if((d.tag!==22||d.memoizedState===null)&&S(i,a,d.child,g))return!0;d=d.sibling}return!1}function E(i){switch(i.tag){case 5:case 27:case 6:return i.stateNode;case 3:return i.stateNode.containerInfo;default:throw Error(r(559))}}var C=null,O=null;function T(i,a,d){return i===d?!0:i===a?(C=i,!0):!1}function R(i,a,d){return i===d?(O=i,!1):i===a?(O!==null&&(C=i),!0):!1}function k(i){if(i===null)return null;do i=i===null?null:i.return;while(i&&i.tag!==5&&i.tag!==27&&i.tag!==3);return i||null}function M(i,a,d){for(var g=0,v=i;v;v=d(v))g++;v=0;for(var w=a;w;w=d(w))v++;for(;0<g-v;)i=d(i),g--;for(;0<v-g;)a=d(a),v--;for(;g--;){if(i===a||a!==null&&i===a.alternate)return i;i=d(i),a=d(a)}return null}var A=Object.assign,I=Symbol.for("react.element"),L=Symbol.for("react.transitional.element"),D=Symbol.for("react.portal"),P=Symbol.for("react.fragment"),z=Symbol.for("react.strict_mode"),$=Symbol.for("react.profiler"),j=Symbol.for("react.consumer"),H=Symbol.for("react.context"),B=Symbol.for("react.forward_ref"),V=Symbol.for("react.suspense"),G=Symbol.for("react.suspense_list"),q=Symbol.for("react.memo"),K=Symbol.for("react.lazy"),W=Symbol.for("react.activity"),ee=Symbol.for("react.legacy_hidden"),ce=Symbol.for("react.memo_cache_sentinel"),F=Symbol.for("react.view_transition"),X=Symbol.for("react.recoverable"),te=Symbol.iterator;function Z(i){return i===null||typeof i!="object"?null:(i=te&&i[te]||i["@@iterator"],typeof i=="function"?i:null)}var Y=Symbol.for("react.client.reference");function le(i){if(i==null)return null;if(typeof i=="function")return i.$$typeof===Y?null:i.displayName||i.name||null;if(typeof i=="string")return i;switch(i){case P:return"Fragment";case $:return"Profiler";case z:return"StrictMode";case V:return"Suspense";case G:return"SuspenseList";case W:return"Activity";case F:return"ViewTransition"}if(typeof i=="object")switch(i.$$typeof){case D:return"Portal";case H:return i.displayName||"Context";case j:return(i._context.displayName||"Context")+".Consumer";case B:var a=i.render;return i=i.displayName,i||(i=a.displayName||a.name||"",i=i!==""?"ForwardRef("+i+")":"ForwardRef"),i;case q:return a=i.displayName||null,a!==null?a:le(i.type)||"Memo";case K:a=i._payload,i=i._init;try{return le(i(a))}catch{}}return null}var xe=Array.isArray,fe=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,oe=n.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,re={pending:!1,data:null,method:null,action:null},he=[],Se=-1;function ke(i){return{current:i}}function be(i){0>Se||(i.current=he[Se],he[Se]=null,Se--)}function _e(i,a){Se++,he[Se]=i.current,i.current=a}var Me=ke(null),Le=ke(null),Pe=ke(null),pe=ke(null);function Ae(i,a){switch(_e(Pe,a),_e(Le,i),_e(Me,null),a.nodeType){case 9:case 11:i=(i=a.documentElement)&&(i=i.namespaceURI)?YA(i):0;break;default:if(i=a.tagName,a=a.namespaceURI)a=YA(a),i=WA(a,i);else switch(i){case"svg":i=1;break;case"math":i=2;break;default:i=0}}be(Me),_e(Me,i)}function Ee(){be(Me),be(Le),be(Pe)}function je(i){var a=i.memoizedState;a!==null&&(fd._currentValue=a.memoizedState,_e(pe,i)),a=Me.current;var d=WA(a,i.type);a!==d&&(_e(Le,i),_e(Me,d))}function Oe(i){Le.current===i&&(be(Me),be(Le)),pe.current===i&&(be(pe),fd._currentValue=re)}var ve,Fe;function Ye(i){if(ve===void 0)try{throw Error()}catch(d){var a=d.stack.trim().match(/\n( *(at )?)/);ve=a&&a[1]||"",Fe=-1<d.stack.indexOf(`
|
|
43
|
+
at`)?" (<anonymous>)":-1<d.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
44
|
+
`+ve+i+Fe}var xt=!1;function nn(i,a){if(!i||xt)return"";xt=!0;var d=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var g={DetermineComponentFrameRoot:function(){try{if(a){var Ce=function(){throw Error()};if(Object.defineProperty(Ce.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(Ce,[])}catch(ze){var se=ze}Reflect.construct(i,[],Ce)}else{try{Ce.call()}catch(ze){se=ze}Ce=!1;try{var de=Object.getOwnPropertyDescriptor(i.prototype,"props");Object.defineProperty(i.prototype,"props",{configurable:!0,set:function(){throw Error()}}),Ce=!0,new i}finally{Ce&&(de!==void 0?Object.defineProperty(i.prototype,"props",de):delete i.prototype.props)}}}else{try{throw Error()}catch(ze){se=ze}(Ce=i())&&typeof Ce.catch=="function"&&Ce.catch(function(){})}}catch(ze){if(ze&&se&&typeof ze.stack=="string")return[ze.stack,se.stack]}return[null,null]}};g.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var v=Object.getOwnPropertyDescriptor(g.DetermineComponentFrameRoot,"name");v&&v.configurable&&Object.defineProperty(g.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var w=g.DetermineComponentFrameRoot(),_=w[0],U=w[1];if(_&&U){var Q=_.split(`
|
|
45
|
+
`),ae=U.split(`
|
|
46
|
+
`);for(v=g=0;g<Q.length&&!Q[g].includes("DetermineComponentFrameRoot");)g++;for(;v<ae.length&&!ae[v].includes("DetermineComponentFrameRoot");)v++;if(g===Q.length||v===ae.length)for(g=Q.length-1,v=ae.length-1;1<=g&&0<=v&&Q[g]!==ae[v];)v--;for(;1<=g&&0<=v;g--,v--)if(Q[g]!==ae[v]){if(g!==1||v!==1)do if(g--,v--,0>v||Q[g]!==ae[v]){var ge=`
|
|
47
|
+
`+Q[g].replace(" at new "," at ");return i.displayName&&ge.includes("<anonymous>")&&(ge=ge.replace("<anonymous>",i.displayName)),ge}while(1<=g&&0<=v);break}}}finally{xt=!1,Error.prepareStackTrace=d}return(d=i?i.displayName||i.name:"")?Ye(d):""}function Te(i,a){switch(i.tag){case 26:case 27:case 5:return Ye(i.type);case 16:return Ye("Lazy");case 13:return i.child!==a&&a!==null?Ye("Suspense Fallback"):Ye("Suspense");case 19:return Ye("SuspenseList");case 0:case 15:return nn(i.type,!1);case 11:return nn(i.type.render,!1);case 1:return nn(i.type,!0);case 31:return Ye("Activity");case 30:return Ye("ViewTransition");default:return""}}function De(i){try{var a="",d=null;do a+=Te(i,d),d=i,i=i.return;while(i);return a}catch(g){return`
|
|
48
|
+
Error generating stack: `+g.message+`
|
|
49
|
+
`+g.stack}}var tt=Object.prototype.hasOwnProperty,At=e.unstable_scheduleCallback,gn=e.unstable_cancelCallback,yn=e.unstable_shouldYield,Fr=e.unstable_requestPaint,cn=e.unstable_now,cr=e.unstable_getCurrentPriorityLevel,$r=e.unstable_ImmediatePriority,Es=e.unstable_UserBlockingPriority,qn=e.unstable_NormalPriority,yt=e.unstable_LowPriority,un=e.unstable_IdlePriority,Gn=e.log,Rn=e.unstable_setDisableYieldValue,An=null,Ht=null;function Zt(i){if(typeof Gn=="function"&&Rn(i),Ht&&typeof Ht.setStrictMode=="function")try{Ht.setStrictMode(An,i)}catch{}}var Jt=Math.clz32?Math.clz32:Ln,Ur=Math.log,Kn=Math.LN2;function Ln(i){return i>>>=0,i===0?32:31-(Ur(i)/Kn|0)|0}var ur=256,dr=262144,fr=4194304;function as(i){var a=i&42;if(a!==0)return a;switch(i&-i){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 i&-i;case 262144:case 524288:case 1048576:case 2097152:return i&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return i&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return i}}function Ar(i,a,d){var g=i.pendingLanes;if(g===0)return 0;var v=0,w=i.suspendedLanes,_=i.pingedLanes;i=i.warmLanes;var U=g&134217727;return U!==0?(g=U&~w,g!==0?v=as(g):(_&=U,_!==0?v=as(_):d||(d=U&~i,d!==0&&(v=as(d))))):(U=g&~w,U!==0?v=as(U):_!==0?v=as(_):d||(d=g&~i,d!==0&&(v=as(d)))),v===0?0:a!==0&&a!==v&&(a&w)===0&&(w=v&-v,d=a&-a,w>=d||w===32&&(d&4194048)!==0)?a:v}function kr(i,a){return(i.pendingLanes&~(i.suspendedLanes&~i.pingedLanes)&a)===0}function cs(i,a){(a&8)!==0&&(a|=a&32);var d=i.entangledLanes;if(d!==0)for(i=i.entanglements,d&=a;0<d;){var g=31-Jt(d),v=1<<g;a|=i[g],d&=~v}return a}function fo(i,a){switch(i){case 1:case 2:case 4:case 8:case 64:return a+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 a+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 hr(){var i=fr;return fr<<=1,(fr&62914560)===0&&(fr=4194304),i}function Do(i){for(var a=[],d=0;31>d;d++)a.push(i);return a}function Cs(i,a){i.pendingLanes|=a,a!==268435456&&(i.suspendedLanes=0,i.pingedLanes=0,i.warmLanes=0)}function El(i,a,d,g,v,w){var _=i.pendingLanes;i.pendingLanes=d,i.suspendedLanes=0,i.pingedLanes=0,i.warmLanes=0,i.expiredLanes&=d,i.entangledLanes&=d,i.errorRecoveryDisabledLanes&=d,i.shellSuspendCounter=0;var U=i.entanglements,Q=i.expirationTimes,ae=i.hiddenUpdates;for(d=_&~d;0<d;){var ge=31-Jt(d),Ce=1<<ge;U[ge]=0,Q[ge]=-1;var se=ae[ge];if(se!==null)for(ae[ge]=null,ge=0;ge<se.length;ge++){var de=se[ge];de!==null&&(de.lane&=-536870913)}d&=~Ce}g!==0&&Ts(i,g,0),w!==0&&v===0&&i.tag!==0&&(i.suspendedLanes|=w&~(_&~a))}function Ts(i,a,d){i.pendingLanes|=a,i.suspendedLanes&=~a;var g=31-Jt(a);i.entangledLanes|=a,i.entanglements[g]=i.entanglements[g]|1073741824|d&261930}function Cl(i,a){var d=i.entangledLanes|=a;for(i=i.entanglements;d;){var g=31-Jt(d),v=1<<g;v&a|i[g]&a&&(i[g]|=a),d&=~v}}function gi(i,a){var d=a&-a;return d=(d&42)!==0?1:ho(d),(d&(i.suspendedLanes|a))!==0?0:d}function ho(i){switch(i){case 2:i=1;break;case 8:i=4;break;case 32:i=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:i=128;break;case 268435456:i=134217728;break;default:i=0}return i}function us(i){return i&=-i,2<i?8<i?(i&134217727)!==0?32:268435456:8:2}function ds(){var i=oe.p;return i!==0?i:(i=window.event,i===void 0?32:Mk(i.type))}function yi(i,a){var d=oe.p;try{return oe.p=i,a()}finally{oe.p=d}}var xn=Math.random().toString(36).slice(2),on="__reactFiber$"+xn,Yn="__reactProps$"+xn,Vr="__reactContainer$"+xn,ec="__reactEvents$"+xn,xi="__reactListeners$"+xn,Tl="__reactHandles$"+xn,jo="__reactResources$"+xn,bi="__reactMarker$"+xn,Nl="__reactLoad$"+xn;function Ol(i){delete i[on],delete i[Yn],delete i[xi],delete i[Tl]}function Ns(i){var a;if(a=i[on])return a;for(var d=i.parentNode;d;){if(a=d[Vr]||d[on]){if(d=a.alternate,a.child!==null||d!==null&&d.child!==null)for(i=fk(i);i!==null;){if(d=i[on])return d;i=fk(i)}return a}i=d,d=i.parentNode}return null}function vi(i){if(i=i[on]||i[Vr]){var a=i.tag;if(a===5||a===6||a===13||a===31||a===26||a===27||a===3)return i}return null}function me(i){var a=i.tag;if(a===5||a===26||a===27||a===6)return i.stateNode;throw Error(r(33))}function Ne(i){var a=i[jo];return a||(a=i[jo]={hoistableStyles:new Map,hoistableScripts:new Map}),a}function Re(i){i[bi]=!0}function Ke(i){i[Nl]=void 0}var lt=new Set,it={};function dt(i,a){Ft(i,a),Ft(i+"Capture",a)}function Ft(i,a){for(it[i]=a,i=0;i<a.length;i++)lt.add(a[i])}var Pt=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]*$"),Ze={},ht={};function Dt(i){return tt.call(ht,i)?!0:tt.call(Ze,i)?!1:Pt.test(i)?ht[i]=!0:(Ze[i]=!0,!1)}var rt=!1;function Wn(){var i=rt;return rt=!1,i}function bn(i,a,d){if(Dt(a))if(d===null)i.removeAttribute(a);else{switch(typeof d){case"undefined":case"function":case"symbol":i.removeAttribute(a);return;case"boolean":var g=a.toLowerCase().slice(0,5);if(g!=="data-"&&g!=="aria-"){i.removeAttribute(a);return}}i.setAttribute(a,d)}}function Os(i,a,d){if(d===null)i.removeAttribute(a);else{switch(typeof d){case"undefined":case"function":case"symbol":case"boolean":i.removeAttribute(a);return}i.setAttribute(a,d)}}function Dn(i,a,d,g){if(g===null)i.removeAttribute(d);else{switch(typeof g){case"undefined":case"function":case"symbol":case"boolean":i.removeAttribute(d);return}i.setAttributeNS(a,d,g)}}function jn(i){switch(typeof i){case"bigint":case"boolean":case"number":case"string":case"undefined":return i;case"object":return i;default:return""}}function ku(i){var a=i.type;return(i=i.nodeName)&&i.toLowerCase()==="input"&&(a==="checkbox"||a==="radio")}function Hf(i,a,d){var g=Object.getOwnPropertyDescriptor(i.constructor.prototype,a);if(!i.hasOwnProperty(a)&&typeof g<"u"&&typeof g.get=="function"&&typeof g.set=="function"){var v=g.get,w=g.set;return Object.defineProperty(i,a,{configurable:!0,get:function(){return v.call(this)},set:function(_){d=""+_,w.call(this,_)}}),Object.defineProperty(i,a,{enumerable:g.enumerable}),{getValue:function(){return d},setValue:function(_){d=""+_},stopTracking:function(){i._valueTracker=null,delete i[a]}}}}function Si(i){if(!i._valueTracker){var a=ku(i)?"checked":"value";i._valueTracker=Hf(i,a,""+i[a])}}function _u(i){if(!i)return!1;var a=i._valueTracker;if(!a)return!0;var d=a.getValue(),g="";return i&&(g=ku(i)?i.checked?"true":"false":i.value),i=g,i!==d?(a.setValue(i),!0):!1}var Qm=/[\n"\\]/g;function ln(i){return i.replace(Qm,function(a){return"\\"+a.charCodeAt(0).toString(16)+" "})}function _r(i,a,d,g,v,w,_,U){i.name="",_!=null&&typeof _!="function"&&typeof _!="symbol"&&typeof _!="boolean"?i.type=_:i.removeAttribute("type"),a!=null?_==="number"?(a===0&&i.value===""||i.value!=a)&&(i.value=""+jn(a)):i.value!==""+jn(a)&&(i.value=""+jn(a)):_!=="submit"&&_!=="reset"||i.removeAttribute("value"),a!=null?_==="number"&&i.value==a?Mu(i,jn(i.value)):Mu(i,jn(a)):d!=null?Mu(i,jn(d)):g!=null&&i.removeAttribute("value"),v==null&&w!=null&&(i.defaultChecked=!!w),v!=null&&(i.checked=v&&typeof v!="function"&&typeof v!="symbol"),U!=null&&typeof U!="function"&&typeof U!="symbol"&&typeof U!="boolean"?i.name=""+jn(U):i.removeAttribute("name")}function Rl(i,a,d,g,v,w,_,U){if(w!=null&&typeof w!="function"&&typeof w!="symbol"&&typeof w!="boolean"&&(i.type=w),a!=null||d!=null){if(!(w!=="submit"&&w!=="reset"||a!=null)){Si(i);return}d=d!=null?""+jn(d):"",a=a!=null?""+jn(a):d,U||a===i.value||(i.value=a),i.defaultValue=a}g=g??v,g=typeof g!="function"&&typeof g!="symbol"&&!!g,i.checked=U?i.checked:!!g,i.defaultChecked=!!g,_!=null&&typeof _!="function"&&typeof _!="symbol"&&typeof _!="boolean"&&(i.name=_),Si(i)}function Mu(i,a){i.defaultValue!==""+a&&(i.defaultValue=""+a)}function fs(i,a,d,g){if(i=i.options,a){a={};for(var v=0;v<d.length;v++)a["$"+d[v]]=!0;for(d=0;d<i.length;d++)v=a.hasOwnProperty("$"+i[d].value),i[d].selected!==v&&(i[d].selected=v),v&&g&&(i[d].defaultSelected=!0)}else{for(d=""+jn(d),a=null,v=0;v<i.length;v++){if(i[v].value===d){i[v].selected=!0,g&&(i[v].defaultSelected=!0);return}a!==null||i[v].disabled||(a=i[v])}a!==null&&(a.selected=!0)}}function Iu(i,a,d){if(a!=null&&(a=""+jn(a),a!==i.value&&(i.value=a),d==null)){i.defaultValue!==a&&(i.defaultValue=a);return}i.defaultValue=d!=null?""+jn(d):""}function Rs(i,a,d,g){if(a==null){if(g!=null){if(d!=null)throw Error(r(92));if(xe(g)){if(1<g.length)throw Error(r(93));g=g[0]}d=g}d==null&&(d=""),a=d}d=jn(a),i.defaultValue=d,g=i.textContent,g===d&&g!==""&&g!==null&&(i.value=g),Si(i)}function qr(i,a){if(a){var d=i.firstChild;if(d&&d===i.lastChild&&d.nodeType===3){d.nodeValue=a;return}}i.textContent=a}var Al=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 Ff(i,a,d){var g=a.indexOf("--")===0;d==null||typeof d=="boolean"||d===""?g?i.setProperty(a,""):a==="float"?i.cssFloat="":i[a]="":g?i.setProperty(a,d):typeof d!="number"||d===0||Al.has(a)?a==="float"?i.cssFloat=d:i[a]=(""+d).trim():i[a]=d+"px"}function As(i,a,d){if(a!=null&&typeof a!="object")throw Error(r(62));if(i=i.style,d!=null){for(var g in d)!d.hasOwnProperty(g)||a!=null&&a.hasOwnProperty(g)||(g.indexOf("--")===0?i.setProperty(g,""):g==="float"?i.cssFloat="":i[g]="",rt=!0);for(var v in a)g=a[v],a.hasOwnProperty(v)&&d[v]!==g&&(Ff(i,v,g),rt=!0)}else for(var w in a)a.hasOwnProperty(w)&&Ff(i,w,a[w])}function tc(i){if(i.indexOf("-")===-1)return!1;switch(i){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 $f=new Map([["acceptCharset","accept-charset"],["htmlFor","for"],["httpEquiv","http-equiv"],["crossOrigin","crossorigin"],["accentHeight","accent-height"],["alignmentBaseline","alignment-baseline"],["arabicForm","arabic-form"],["baselineShift","baseline-shift"],["capHeight","cap-height"],["clipPath","clip-path"],["clipRule","clip-rule"],["colorInterpolation","color-interpolation"],["colorInterpolationFilters","color-interpolation-filters"],["colorProfile","color-profile"],["colorRendering","color-rendering"],["dominantBaseline","dominant-baseline"],["enableBackground","enable-background"],["fillOpacity","fill-opacity"],["fillRule","fill-rule"],["floodColor","flood-color"],["floodOpacity","flood-opacity"],["fontFamily","font-family"],["fontSize","font-size"],["fontSizeAdjust","font-size-adjust"],["fontStretch","font-stretch"],["fontStyle","font-style"],["fontVariant","font-variant"],["fontWeight","font-weight"],["glyphName","glyph-name"],["glyphOrientationHorizontal","glyph-orientation-horizontal"],["glyphOrientationVertical","glyph-orientation-vertical"],["horizAdvX","horiz-adv-x"],["horizOriginX","horiz-origin-x"],["imageRendering","image-rendering"],["letterSpacing","letter-spacing"],["lightingColor","lighting-color"],["markerEnd","marker-end"],["markerMid","marker-mid"],["markerStart","marker-start"],["maskType","mask-type"],["overlinePosition","overline-position"],["overlineThickness","overline-thickness"],["paintOrder","paint-order"],["panose-1","panose-1"],["pointerEvents","pointer-events"],["renderingIntent","rendering-intent"],["shapeRendering","shape-rendering"],["stopColor","stop-color"],["stopOpacity","stop-opacity"],["strikethroughPosition","strikethrough-position"],["strikethroughThickness","strikethrough-thickness"],["strokeDasharray","stroke-dasharray"],["strokeDashoffset","stroke-dashoffset"],["strokeLinecap","stroke-linecap"],["strokeLinejoin","stroke-linejoin"],["strokeMiterlimit","stroke-miterlimit"],["strokeOpacity","stroke-opacity"],["strokeWidth","stroke-width"],["textAnchor","text-anchor"],["textDecoration","text-decoration"],["textRendering","text-rendering"],["transformOrigin","transform-origin"],["underlinePosition","underline-position"],["underlineThickness","underline-thickness"],["unicodeBidi","unicode-bidi"],["unicodeRange","unicode-range"],["unitsPerEm","units-per-em"],["vAlphabetic","v-alphabetic"],["vHanging","v-hanging"],["vIdeographic","v-ideographic"],["vMathematical","v-mathematical"],["vectorEffect","vector-effect"],["vertAdvY","vert-adv-y"],["vertOriginX","vert-origin-x"],["vertOriginY","vert-origin-y"],["wordSpacing","word-spacing"],["writingMode","writing-mode"],["xmlnsXlink","xmlns:xlink"],["xHeight","x-height"]]),Uf=/^[\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 pr(i){return Uf.test(""+i)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":i}function Gr(){}var nc=null;function rc(i){return i=i.target||i.srcElement||window,i.correspondingUseElement&&(i=i.correspondingUseElement),i.nodeType===3?i.parentNode:i}var _t=null,er=null;function Ks(i){var a=vi(i);if(a&&(i=a.stateNode)){var d=i[Yn]||null;e:switch(i=a.stateNode,a.type){case"input":if(_r(i,d.value,d.defaultValue,d.defaultValue,d.checked,d.defaultChecked,d.type,d.name),a=d.name,d.type==="radio"&&a!=null){for(d=i;d.parentNode;)d=d.parentNode;for(d=d.querySelectorAll('input[name="'+ln(""+a)+'"][type="radio"]'),a=0;a<d.length;a++){var g=d[a];if(g!==i&&g.form===i.form){var v=g[Yn]||null;if(!v)throw Error(r(90));_r(g,v.value,v.defaultValue,v.defaultValue,v.checked,v.defaultChecked,v.type,v.name)}}for(a=0;a<d.length;a++)g=d[a],g.form===i.form&&_u(g)}break e;case"textarea":Iu(i,d.value,d.defaultValue);break e;case"select":a=d.value,a!=null&&fs(i,!!d.multiple,a,!1)}}}var ks=!1;function sc(i,a,d){if(ks)return i(a,d);ks=!0;try{var g=i(a);return g}finally{if(ks=!1,(_t!==null||er!==null)&&(Qg(),_t&&(a=_t,i=er,er=_t=null,Ks(a),i)))for(a=0;a<i.length;a++)Ks(i[a])}}function wi(i,a){var d=i.stateNode;if(d===null)return null;var g=d[Yn]||null;if(g===null)return null;d=g[a];e:switch(a){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(g=!g.disabled)||(i=i.type,g=!(i==="button"||i==="input"||i==="select"||i==="textarea")),i=!g;break e;default:i=!1}if(i)return null;if(d&&typeof d!="function")throw Error(r(231,a,typeof d));return d}var mr=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),oc=!1;if(mr)try{var Vf={};Object.defineProperty(Vf,"passive",{get:function(){oc=!0}}),window.addEventListener("test",Vf,Vf),window.removeEventListener("test",Vf,Vf)}catch{oc=!1}var kl=null,Yb=null,Zm=null;function VN(){if(Zm)return Zm;var i,a=Yb,d=a.length,g,v="value"in kl?kl.value:kl.textContent,w=v.length;for(i=0;i<d&&a[i]===v[i];i++);var _=d-i;for(g=1;g<=_&&a[d-g]===v[w-g];g++);return Zm=v.slice(i,1<g?1-g:void 0)}function Jm(i){var a=i.keyCode;return"charCode"in i?(i=i.charCode,i===0&&a===13&&(i=13)):i=a,i===10&&(i=13),32<=i||i===13?i:0}function eg(){return!0}function qN(){return!1}function Kr(i){function a(d,g,v,w,_){this._reactName=d,this._targetInst=v,this.type=g,this.nativeEvent=w,this.target=_,this.currentTarget=null;for(var U in i)i.hasOwnProperty(U)&&(d=i[U],this[U]=d?d(w):w[U]);return this.isDefaultPrevented=(w.defaultPrevented!=null?w.defaultPrevented:w.returnValue===!1)?eg:qN,this.isPropagationStopped=qN,this}return A(a.prototype,{preventDefault:function(){this.defaultPrevented=!0;var d=this.nativeEvent;d&&(d.preventDefault?d.preventDefault():typeof d.returnValue!="unknown"&&(d.returnValue=!1),this.isDefaultPrevented=eg)},stopPropagation:function(){var d=this.nativeEvent;d&&(d.stopPropagation?d.stopPropagation():typeof d.cancelBubble!="unknown"&&(d.cancelBubble=!0),this.isPropagationStopped=eg)},persist:function(){},isPersistent:eg}),a}var _l={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(i){return i.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},tg=Kr(_l),qf=A({},_l,{view:0,detail:0}),nU=Kr(qf),Wb,Xb,Gf,ng=A({},qf,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Zb,button:0,buttons:0,relatedTarget:function(i){return i.relatedTarget===void 0?i.fromElement===i.srcElement?i.toElement:i.fromElement:i.relatedTarget},movementX:function(i){return"movementX"in i?i.movementX:(i!==Gf&&(Gf&&i.type==="mousemove"?(Wb=i.screenX-Gf.screenX,Xb=i.screenY-Gf.screenY):Xb=Wb=0,Gf=i),Wb)},movementY:function(i){return"movementY"in i?i.movementY:Xb}}),GN=Kr(ng),rU=A({},ng,{dataTransfer:0}),sU=Kr(rU),oU=A({},qf,{relatedTarget:0}),Qb=Kr(oU),iU=A({},_l,{animationName:0,elapsedTime:0,pseudoElement:0}),lU=Kr(iU),aU=A({},_l,{clipboardData:function(i){return"clipboardData"in i?i.clipboardData:window.clipboardData}}),cU=Kr(aU),uU=A({},_l,{data:0}),KN=Kr(uU),dU={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},fU={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"},hU={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function pU(i){var a=this.nativeEvent;return a.getModifierState?a.getModifierState(i):(i=hU[i])?!!a[i]:!1}function Zb(){return pU}var mU=A({},qf,{key:function(i){if(i.key){var a=dU[i.key]||i.key;if(a!=="Unidentified")return a}return i.type==="keypress"?(i=Jm(i),i===13?"Enter":String.fromCharCode(i)):i.type==="keydown"||i.type==="keyup"?fU[i.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Zb,charCode:function(i){return i.type==="keypress"?Jm(i):0},keyCode:function(i){return i.type==="keydown"||i.type==="keyup"?i.keyCode:0},which:function(i){return i.type==="keypress"?Jm(i):i.type==="keydown"||i.type==="keyup"?i.keyCode:0}}),gU=Kr(mU),yU=A({},ng,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),YN=Kr(yU),xU=A({},_l,{submitter:0}),bU=Kr(xU),vU=A({},qf,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Zb}),SU=Kr(vU),wU=A({},_l,{propertyName:0,elapsedTime:0,pseudoElement:0}),EU=Kr(wU),CU=A({},ng,{deltaX:function(i){return"deltaX"in i?i.deltaX:"wheelDeltaX"in i?-i.wheelDeltaX:0},deltaY:function(i){return"deltaY"in i?i.deltaY:"wheelDeltaY"in i?-i.wheelDeltaY:"wheelDelta"in i?-i.wheelDelta:0},deltaZ:0,deltaMode:0}),TU=Kr(CU),NU=A({},_l,{newState:0,oldState:0,source:0}),OU=Kr(NU),RU=[9,13,27,32],Jb=mr&&"CompositionEvent"in window,Kf=null;mr&&"documentMode"in document&&(Kf=document.documentMode);var AU=mr&&"TextEvent"in window&&!Kf,WN=mr&&(!Jb||Kf&&8<Kf&&11>=Kf),XN=" ",QN=!1;function ZN(i,a){switch(i){case"keyup":return RU.indexOf(a.keyCode)!==-1;case"keydown":return a.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function JN(i){return i=i.detail,typeof i=="object"&&"data"in i?i.data:null}var Lu=!1;function kU(i,a){switch(i){case"compositionend":return JN(a);case"keypress":return a.which!==32?null:(QN=!0,XN);case"textInput":return i=a.data,i===XN&&QN?null:i;default:return null}}function _U(i,a){if(Lu)return i==="compositionend"||!Jb&&ZN(i,a)?(i=VN(),Zm=Yb=kl=null,Lu=!1,i):null;switch(i){case"paste":return null;case"keypress":if(!(a.ctrlKey||a.altKey||a.metaKey)||a.ctrlKey&&a.altKey){if(a.char&&1<a.char.length)return a.char;if(a.which)return String.fromCharCode(a.which)}return null;case"compositionend":return WN&&a.locale!=="ko"?null:a.data;default:return null}}var MU={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 eO(i){var a=i&&i.nodeName&&i.nodeName.toLowerCase();return a==="input"?!!MU[i.type]:a==="textarea"}function tO(i,a,d,g){_t?er?er.push(g):er=[g]:_t=g,a=r0(a,"onChange"),0<a.length&&(d=new tg("onChange","change",null,d,g),i.push({event:d,listeners:a}))}var Yf=null,Wf=null;function IU(i){$A(i,0)}function rg(i){var a=me(i);if(_u(a))return i}function nO(i,a){if(i==="change")return a}var rO=!1;if(mr){var ev;if(mr){var tv="oninput"in document;if(!tv){var sO=document.createElement("div");sO.setAttribute("oninput","return;"),tv=typeof sO.oninput=="function"}ev=tv}else ev=!1;rO=ev&&(!document.documentMode||9<document.documentMode)}function oO(){Yf&&(Yf.detachEvent("onpropertychange",iO),Wf=Yf=null)}function iO(i){if(i.propertyName==="value"&&rg(Wf)){var a=[];tO(a,Wf,i,rc(i)),sc(IU,a)}}function LU(i,a,d){i==="focusin"?(oO(),Yf=a,Wf=d,Yf.attachEvent("onpropertychange",iO)):i==="focusout"&&oO()}function DU(i){if(i==="selectionchange"||i==="keyup"||i==="keydown")return rg(Wf)}function jU(i,a){if(i==="click")return rg(a)}function PU(i,a){if(i==="input"||i==="change")return rg(a)}function zU(i,a){return i===a&&(i!==0||1/i===1/a)||i!==i&&a!==a}var _s=typeof Object.is=="function"?Object.is:zU;function Xf(i,a){if(_s(i,a))return!0;if(typeof i!="object"||i===null||typeof a!="object"||a===null)return!1;var d=Object.keys(i),g=Object.keys(a);if(d.length!==g.length)return!1;for(g=0;g<d.length;g++){var v=d[g];if(!tt.call(a,v)||!_s(i[v],a[v]))return!1}return!0}function nv(i){if(i=i||(typeof document<"u"?document:void 0),typeof i>"u")return null;try{return i.activeElement||i.body}catch{return i.body}}function lO(i){for(;i&&i.firstChild;)i=i.firstChild;return i}function aO(i,a){var d=lO(i);i=0;for(var g;d;){if(d.nodeType===3){if(g=i+d.textContent.length,i<=a&&g>=a)return{node:d,offset:a-i};i=g}e:{for(;d;){if(d.nextSibling){d=d.nextSibling;break e}d=d.parentNode}d=void 0}d=lO(d)}}function cO(i,a){return i&&a?i===a?!0:i&&i.nodeType===3?!1:a&&a.nodeType===3?cO(i,a.parentNode):"contains"in i?i.contains(a):i.compareDocumentPosition?!!(i.compareDocumentPosition(a)&16):!1:!1}function uO(i){i=i!=null&&i.ownerDocument!=null&&i.ownerDocument.defaultView!=null?i.ownerDocument.defaultView:window;for(var a=nv(i.document);a instanceof i.HTMLIFrameElement;){try{var d=typeof a.contentWindow.location.href=="string"}catch{d=!1}if(d)i=a.contentWindow;else break;a=nv(i.document)}return a}function rv(i){var a=i&&i.nodeName&&i.nodeName.toLowerCase();return a&&(a==="input"&&(i.type==="text"||i.type==="search"||i.type==="tel"||i.type==="url"||i.type==="password")||a==="textarea"||i.contentEditable==="true")}var BU=mr&&"documentMode"in document&&11>=document.documentMode,Du=null,sv=null,Qf=null,ov=!1;function dO(i,a,d){var g=d.window===d?d.document:d.nodeType===9?d:d.ownerDocument;ov||Du==null||Du!==nv(g)||(g=Du,"selectionStart"in g&&rv(g)?g={start:g.selectionStart,end:g.selectionEnd}:(g=(g.ownerDocument&&g.ownerDocument.defaultView||window).getSelection(),g={anchorNode:g.anchorNode,anchorOffset:g.anchorOffset,focusNode:g.focusNode,focusOffset:g.focusOffset}),Qf&&Xf(Qf,g)||(Qf=g,g=r0(sv,"onSelect"),0<g.length&&(a=new tg("onSelect","select",null,a,d),i.push({event:a,listeners:g}),a.target=Du)))}function ic(i,a){var d={};return d[i.toLowerCase()]=a.toLowerCase(),d["Webkit"+i]="webkit"+a,d["Moz"+i]="moz"+a,d}var ju={animationend:ic("Animation","AnimationEnd"),animationiteration:ic("Animation","AnimationIteration"),animationstart:ic("Animation","AnimationStart"),transitionrun:ic("Transition","TransitionRun"),transitionstart:ic("Transition","TransitionStart"),transitioncancel:ic("Transition","TransitionCancel"),transitionend:ic("Transition","TransitionEnd")},iv={},fO={};mr&&(fO=document.createElement("div").style,"AnimationEvent"in window||(delete ju.animationend.animation,delete ju.animationiteration.animation,delete ju.animationstart.animation),"TransitionEvent"in window||delete ju.transitionend.transition);function lc(i){if(iv[i])return iv[i];if(!ju[i])return i;var a=ju[i],d;for(d in a)if(a.hasOwnProperty(d)&&d in fO)return iv[i]=a[d];return i}var hO=lc("animationend"),pO=lc("animationiteration"),mO=lc("animationstart"),HU=lc("transitionrun"),FU=lc("transitionstart"),$U=lc("transitioncancel"),gO=lc("transitionend"),yO=new Map,lv="abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error fullscreenChange fullscreenError gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");lv.push("scrollEnd");function po(i,a){yO.set(i,a),dt(a,[i])}var UU=0;function Ei(i,a){if(i.name!=null&&i.name!=="auto")return i.name;if(a.autoName!==null)return a.autoName;i=xo.identifierPrefix;var d=UU++;return i="_"+i+"t_"+d.toString(32)+"_",a.autoName=i}function xO(i){if(i==null||typeof i=="string")return i;var a=null,d=nd;if(d!==null)for(var g=0;g<d.length;g++){var v=i[d[g]];if(v!=null){if(v==="none")return"none";a=a==null?v:a+(" "+v)}}return a??i.default}function Ci(i,a){return i=xO(i),a=xO(a),a==null?i==="auto"?null:i:a==="auto"?null:a}var sg=typeof reportError=="function"?reportError:function(i){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var a=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof i=="object"&&i!==null&&typeof i.message=="string"?String(i.message):String(i),error:i});if(!window.dispatchEvent(a))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",i);return}console.error(i)},Ys=[],Pu=0,av=0;function og(){for(var i=Pu,a=av=Pu=0;a<i;){var d=Ys[a];Ys[a++]=null;var g=Ys[a];Ys[a++]=null;var v=Ys[a];Ys[a++]=null;var w=Ys[a];if(Ys[a++]=null,g!==null&&v!==null){var _=g.pending;_===null?v.next=v:(v.next=_.next,_.next=v),g.pending=v}w!==0&&bO(d,v,w)}}function ig(i,a,d,g){Ys[Pu++]=i,Ys[Pu++]=a,Ys[Pu++]=d,Ys[Pu++]=g,av|=g,i.lanes|=g,i=i.alternate,i!==null&&(i.lanes|=g)}function cv(i,a,d,g){return ig(i,a,d,g),lg(i)}function ac(i,a){return ig(i,null,null,a),lg(i)}function bO(i,a,d){i.lanes|=d;var g=i.alternate;g!==null&&(g.lanes|=d);for(var v=!1,w=i.return;w!==null;)w.childLanes|=d,g=w.alternate,g!==null&&(g.childLanes|=d),w.tag===22&&(i=w.stateNode,i===null||i._visibility&1||(v=!0)),i=w,w=w.return;return i.tag===3?(w=i.stateNode,v&&a!==null&&(v=31-Jt(d),i=w.hiddenUpdates,g=i[v],g===null?i[v]=[a]:g.push(a),a.lane=d|536870912),w):null}function lg(i){if(50<bh)throw bh=0,Xg=null,Error(r(185));for(var a=i.return;a!==null;)i=a,a=i.return;return i.tag===3?i.stateNode:null}var zu={};function VU(i,a,d,g){this.tag=i,this.key=d,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=a,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=g,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function hs(i,a,d,g){return new VU(i,a,d,g)}function uv(i){return i=i.prototype,!(!i||!i.isReactComponent)}function Ti(i,a){var d=i.alternate;return d===null?(d=hs(i.tag,a,i.key,i.mode),d.elementType=i.elementType,d.type=i.type,d.stateNode=i.stateNode,d.alternate=i,i.alternate=d):(d.pendingProps=a,d.type=i.type,d.flags=0,d.subtreeFlags=0,d.deletions=null),d.flags=i.flags&1206910976,d.childLanes=i.childLanes,d.lanes=i.lanes,d.child=i.child,d.memoizedProps=i.memoizedProps,d.memoizedState=i.memoizedState,d.updateQueue=i.updateQueue,a=i.dependencies,d.dependencies=a===null?null:{lanes:a.lanes,firstContext:a.firstContext},d.sibling=i.sibling,d.index=i.index,d.ref=i.ref,d.refCleanup=i.refCleanup,d}function vO(i,a){i.flags&=1206910978;var d=i.alternate;return d===null?(i.childLanes=0,i.lanes=a,i.child=null,i.subtreeFlags=0,i.memoizedProps=null,i.memoizedState=null,i.updateQueue=null,i.dependencies=null,i.stateNode=null):(i.childLanes=d.childLanes,i.lanes=d.lanes,i.child=d.child,i.subtreeFlags=0,i.deletions=null,i.memoizedProps=d.memoizedProps,i.memoizedState=d.memoizedState,i.updateQueue=d.updateQueue,i.type=d.type,a=d.dependencies,i.dependencies=a===null?null:{lanes:a.lanes,firstContext:a.firstContext}),i}function ag(i,a,d,g,v,w){var _=0;if(g=i,typeof g=="function")uv(g)&&(_=1);else if(typeof g=="string")_=xV(i,d,Me.current)?26:i==="html"||i==="head"||i==="body"?27:5;else e:switch(g){case W:return i=hs(31,d,a,v),i.elementType=W,i.lanes=w,i;case P:return cc(d.children,v,w,a);case z:_=8,v|=24;break;case $:return i=hs(12,d,a,v|2),i.elementType=$,i.lanes=w,i;case V:return i=hs(13,d,a,v),i.elementType=V,i.lanes=w,i;case G:return i=hs(19,d,a,v),i.elementType=G,i.lanes=w,i;case ee:case F:return i=v|32,i=hs(30,d,a,i),i.elementType=F,i.lanes=w,i.stateNode={autoName:null,paired:null,clones:null,ref:null},i;default:if(typeof g=="object"&&g!==null)switch(g.$$typeof){case H:_=10;break e;case j:_=9;break e;case B:_=11;break e;case q:_=14;break e;case K:_=16,g=null;break e}_=29,d=Error(r(130,i===null?"null":typeof i,"")),g=null}return a=hs(_,d,a,v),a.elementType=i,a.type=g,a.lanes=w,a}function cc(i,a,d,g){return i=hs(7,i,g,a),i.lanes=d,i}function dv(i,a,d){return i=hs(6,i,null,a),i.lanes=d,i}function SO(i){var a=hs(18,null,null,0);return a.stateNode=i,a}function fv(i,a,d){return a=hs(4,i.children!==null?i.children:[],i.key,a),a.lanes=d,a.stateNode={containerInfo:i.containerInfo,pendingChildren:null,implementation:i.implementation},a}var wO=new WeakMap;function Ws(i,a){if(typeof i=="object"&&i!==null){var d=wO.get(i);return d!==void 0?d:(a={value:i,source:a,stack:De(a)},wO.set(i,a),a)}return{value:i,source:a,stack:De(a)}}var Bu=[],Hu=0,cg=null,Zf=0,Xs=[],Qs=0,Ml=null,Po=1,zo="";function Ni(i,a){Bu[Hu++]=Zf,Bu[Hu++]=cg,cg=i,Zf=a}function EO(i,a,d){Xs[Qs++]=Po,Xs[Qs++]=zo,Xs[Qs++]=Ml,Ml=i;var g=Po;i=zo;var v=32-Jt(g)-1;g&=~(1<<v),d+=1;var w=32-Jt(a)+v;if(30<w){var _=v-v%5;w=(g&(1<<_)-1).toString(32),g>>=_,v-=_,Po=1<<32-Jt(a)+v|d<<v|g,zo=w+i}else Po=1<<w|d<<v|g,zo=i}function ug(i){i.return!==null&&(Ni(i,1),EO(i,1,0))}function hv(i){for(;i===cg;)cg=Bu[--Hu],Bu[Hu]=null,Zf=Bu[--Hu],Bu[Hu]=null;for(;i===Ml;)Ml=Xs[--Qs],Xs[Qs]=null,zo=Xs[--Qs],Xs[Qs]=null,Po=Xs[--Qs],Xs[Qs]=null}function CO(i,a){Xs[Qs++]=Po,Xs[Qs++]=zo,Xs[Qs++]=Ml,Po=a.id,zo=a.overflow,Ml=i}var tr=null,rn=null,vt=!1,Il=null,Zs=!1,pv=Error(r(519));function Ll(i){var a=Error(r(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Jf(Ws(a,i)),pv}function TO(i){var a=i.stateNode,d=i.type,g=i.memoizedProps;switch(a[on]=i,a[Yn]=g,d){case"dialog":Et("cancel",a),Et("close",a);break;case"iframe":case"object":case"embed":Et("load",a);break;case"video":case"audio":for(d=0;d<Sh.length;d++)Et(Sh[d],a);break;case"source":Et("error",a);break;case"img":case"image":case"link":Et("error",a),Et("load",a);break;case"details":Et("toggle",a);break;case"input":Et("invalid",a),Rl(a,g.value,g.defaultValue,g.checked,g.defaultChecked,g.type,g.name,!0);break;case"select":Et("invalid",a);break;case"textarea":Et("invalid",a),Rs(a,g.value,g.defaultValue,g.children)}d=g.children,typeof d!="string"&&typeof d!="number"&&typeof d!="bigint"||a.textContent===""+d||g.suppressHydrationWarning===!0||GA(a.textContent,d)?(g.popover!=null&&(Et("beforetoggle",a),Et("toggle",a)),g.onScroll!=null&&Et("scroll",a),g.onScrollEnd!=null&&Et("scrollend",a),g.onClick!=null&&(a.onclick=Gr),a=!0):a=!1,a||Ll(i,!0)}function dg(i){for(tr=i.return;tr;)switch(tr.tag){case 5:case 31:case 13:Zs=!1;return;case 27:case 3:Zs=!0;return;default:tr=tr.return}}function Fu(i){if(i!==tr)return!1;if(!vt)return dg(i),vt=!0,!1;var a=i.tag,d;if((d=a!==3&&a!==27)&&((d=a===5)&&(d=i.type,d=!(d!=="form"&&d!=="button")||VS(i.type,i.memoizedProps)),d=!d),d&&rn&&Ll(i),dg(i),a===13){if(i=i.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(r(317));rn=dk(i)}else if(a===31){if(i=i.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(r(317));rn=dk(i)}else a===27?(a=rn,Xl(i.type)?(i=JS,JS=null,rn=i):rn=a):rn=tr?eo(i.stateNode.nextSibling):null;return!0}function uc(){rn=tr=null,vt=!1}function mv(){var i=Il;return i!==null&&(gs===null?gs=i:gs.push.apply(gs,i),Il=null),i}function Jf(i){Il===null?Il=[i]:Il.push(i)}var gv=ke(null),dc=null,Oi=null;function Dl(i,a,d){_e(gv,a._currentValue),a._currentValue=d}function Ri(i){i._currentValue=gv.current,be(gv)}function fg(i,a,d){for(;i!==null;){var g=i.alternate;if((i.childLanes&a)!==a?(i.childLanes|=a,g!==null&&(g.childLanes|=a)):g!==null&&(g.childLanes&a)!==a&&(g.childLanes|=a),i===d)break;i=i.return}}function yv(i,a,d,g){var v=i.child;for(v!==null&&(v.return=i);v!==null;){var w=v.dependencies;if(w!==null){var _=v.child;w=w.firstContext;e:for(;w!==null;){var U=w;w=v;for(var Q=0;Q<a.length;Q++)if(U.context===a[Q]){w.lanes|=d,U=w.alternate,U!==null&&(U.lanes|=d),fg(w.return,d,i),g||(_=null);break e}w=U.next}}else if(v.tag===18){if(_=v.return,_===null)throw Error(r(341));_.lanes|=d,w=_.alternate,w!==null&&(w.lanes|=d),fg(_,d,i),_=null}else v.tag===13&&v.memoizedState!==null&&v.memoizedState.dehydrated===null?(v.lanes|=d,_=v.alternate,_!==null&&(_.lanes|=d),fg(v.return,d,i),_=v.child,_=_!==null?_.sibling:null):_=v.child;if(_!==null)_.return=v;else for(_=v;_!==null;){if(_===i){_=null;break}if(v=_.sibling,v!==null){v.return=_.return,_=v;break}_=_.return}v=_}}function fc(i,a,d,g){i=null;for(var v=a,w=!1;v!==null;){if(!w){if((v.flags&524288)!==0)w=!0;else if((v.flags&262144)!==0)break}if(v.tag===10){var _=v.alternate;if(_===null)throw Error(r(387));if(_=_.memoizedProps,_!==null){var U=v.type;_s(v.pendingProps.value,_.value)||(i!==null?i.push(U):i=[U])}}else if(v===pe.current){if(_=v.alternate,_===null)throw Error(r(387));_.memoizedState.memoizedState!==v.memoizedState.memoizedState&&(i!==null?i.push(fd):i=[fd])}v=v.return}return i!==null&&yv(a,i,d,g),a.flags|=262144,i!==null}function hg(i){for(i=i.firstContext;i!==null;){if(!_s(i.context._currentValue,i.memoizedValue))return!0;i=i.next}return!1}function hc(i){dc=i,Oi=null,i=i.dependencies,i!==null&&(i.firstContext=null)}function gr(i){return NO(dc,i)}function pg(i,a){return dc===null&&hc(i),NO(i,a)}function NO(i,a){var d=a._currentValue;if(a={context:a,memoizedValue:d,next:null},Oi===null){if(i===null)throw Error(r(308));Oi=a,i.dependencies={lanes:0,firstContext:a},i.flags|=524288}else Oi=Oi.next=a;return d}var qU=typeof AbortController<"u"?AbortController:function(){var i=[],a=this.signal={aborted:!1,addEventListener:function(d,g){i.push(g)}};this.abort=function(){a.aborted=!0,i.forEach(function(d){return d()})}},GU=e.unstable_scheduleCallback,KU=e.unstable_NormalPriority,Pn={$$typeof:H,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function xv(){return{controller:new qU,data:new Map,refCount:0}}function eh(i){i.refCount--,i.refCount===0&&GU(KU,function(){i.controller.abort()})}function OO(i,a){if((i.pendingLanes&4194048)!==0){var d=i.transitionTypes;for(d===null&&(d=i.transitionTypes=[]),i=0;i<a.length;i++){var g=a[i];d.indexOf(g)===-1&&d.push(g)}}}var th=null;function YU(i){var a=i.transitionTypes;return i.transitionTypes=null,a}var nh=null,bv=0,pc=0,$u=null;function WU(i,a){if(nh===null){var d=nh=[];bv=0,pc=DS(),$u={status:"pending",value:void 0,then:function(g){d.push(g)}}}return bv++,a.then(RO,RO),a}function RO(){if(--bv===0&&(th=null,nh!==null)){$u!==null&&($u.status="fulfilled");var i=nh;nh=null,pc=0,$u=null;for(var a=0;a<i.length;a++)(0,i[a])()}}function XU(i,a){var d=[],g={status:"pending",value:null,reason:null,then:function(v){d.push(v)}};return i.then(function(){g.status="fulfilled",g.value=a;for(var v=0;v<d.length;v++)(0,d[v])(a)},function(v){for(g.status="rejected",g.reason=v,v=0;v<d.length;v++)(0,d[v])(void 0)}),g}var AO=fe.S;fe.S=function(i,a){if(SA=cn(),typeof a=="object"&&a!==null&&typeof a.then=="function"&&WU(i,a),th!==null)for(var d=id;d!==null;)OO(d,th),d=d.next;if(d=i.types,d!==null){for(var g=id;g!==null;)OO(g,d),g=g.next;if(pc!==0){g=th,g===null&&(g=th=[]);for(var v=0;v<d.length;v++){var w=d[v];g.indexOf(w)===-1&&g.push(w)}}}AO!==null&&AO(i,a)};var mc=ke(null);function vv(){var i=mc.current;return i!==null?i:en.pooledCache}function mg(i,a){a===null?_e(mc,mc.current):_e(mc,a.pool)}function kO(){var i=vv();return i===null?null:{parent:Pn._currentValue,pool:i}}var Uu=Error(r(460)),Sv=Error(r(474)),gg=Error(r(542)),yg={then:function(){}};function _O(i){return i=i.status,i==="fulfilled"||i==="rejected"}function MO(i,a,d){switch(d=i[d],d===void 0?i.push(a):d!==a&&(a.then(Gr,Gr),a=d),a.status){case"fulfilled":return a.value;case"rejected":throw i=a.reason,LO(i),i===void 0&&!("reason"in a)?Error(r(600)):i;default:if(typeof a.status=="string")a.then(Gr,Gr);else{if(i=en,i!==null&&100<i.shellSuspendCounter)throw Error(r(482));i=a,i.status="pending",i.then(function(g){if(a.status==="pending"){var v=a;v.status="fulfilled",v.value=g}},function(g){if(a.status==="pending"){var v=a;v.status="rejected",v.reason=g}})}switch(a.status){case"fulfilled":return a.value;case"rejected":throw i=a.reason,LO(i),i}throw yc=a,Uu}}function gc(i){try{var a=i._init;return a(i._payload)}catch(d){throw d!==null&&typeof d=="object"&&typeof d.then=="function"?(yc=d,Uu):d}}var yc=null;function IO(){if(yc===null)throw Error(r(459));var i=yc;return yc=null,i}function LO(i){if(i===Uu||i===gg)throw Error(r(483))}var Vu=null,rh=0;function xg(i){var a=rh;return rh+=1,Vu===null&&(Vu=[]),MO(Vu,i,a)}function jl(i,a){a=a.props.ref,i.ref=a!==void 0?a:null}function bg(i,a){throw a.$$typeof===I?Error(r(525)):(i=Object.prototype.toString.call(a),Error(r(31,i==="[object Object]"?"object with keys {"+Object.keys(a).join(", ")+"}":i)))}function DO(i){function a(ie,ne){if(i){var ue=ie.deletions;ue===null?(ie.deletions=[ne],ie.flags|=16):ue.push(ne)}}function d(ie,ne){if(!i)return null;for(;ne!==null;)a(ie,ne),ne=ne.sibling;return null}function g(ie){for(var ne=new Map;ie!==null;)ie.key===null?ne.set(ie.index,ie):ne.set(ie.key,ie),ie=ie.sibling;return ne}function v(ie,ne){return ie=Ti(ie,ne),ie.index=0,ie.sibling=null,ie}function w(ie,ne,ue){return ie.index=ue,i?(ue=ie.alternate,ue!==null?(ue=ue.index,ue<ne?(ie.flags|=2,ne):ue):(ie.flags|=134217730,ne)):(ie.flags|=1048576,ne)}function _(ie){return i&&ie.alternate===null&&(ie.flags|=134217730),ie}function U(ie,ne,ue,we){return ne===null||ne.tag!==6?(ne=dv(ue,ie.mode,we),ne.return=ie,ne):(ne=v(ne,ue),ne.return=ie,ne)}function Q(ie,ne,ue,we){var $e=ue.type;return $e===P?(ie=ge(ie,ne,ue.props.children,we,ue.key),jl(ie,ue),ie):ne!==null&&(ne.elementType===$e||typeof $e=="object"&&$e!==null&&$e.$$typeof===K&&gc($e)===ne.type)?(ne=v(ne,ue.props),jl(ne,ue),ne.return=ie,ne):(ne=ag(ue.type,ue.key,ue.props,null,ie.mode,we),jl(ne,ue),ne.return=ie,ne)}function ae(ie,ne,ue,we){return ne===null||ne.tag!==4||ne.stateNode.containerInfo!==ue.containerInfo||ne.stateNode.implementation!==ue.implementation?(ne=fv(ue,ie.mode,we),ne.return=ie,ne):(ne=v(ne,ue.children||[]),ne.return=ie,ne)}function ge(ie,ne,ue,we,$e){return ne===null||ne.tag!==7?(ne=cc(ue,ie.mode,we,$e),ne.return=ie,ne):(ne=v(ne,ue),ne.return=ie,ne)}function Ce(ie,ne,ue){if(typeof ne=="string"&&ne!==""||typeof ne=="number"||typeof ne=="bigint")return ne=dv(""+ne,ie.mode,ue),ne.return=ie,ne;if(typeof ne=="object"&&ne!==null){switch(ne.$$typeof){case L:return ue=ag(ne.type,ne.key,ne.props,null,ie.mode,ue),jl(ue,ne),ue.return=ie,ue;case D:return ne=fv(ne,ie.mode,ue),ne.return=ie,ne;case K:return ne=gc(ne),Ce(ie,ne,ue)}if(xe(ne)||Z(ne))return ne=cc(ne,ie.mode,ue,null),ne.return=ie,ne;if(typeof ne.then=="function")return Ce(ie,xg(ne),ue);if(ne.$$typeof===H)return Ce(ie,pg(ie,ne),ue);bg(ie,ne)}return null}function se(ie,ne,ue,we){var $e=ne!==null?ne.key:null;if(typeof ue=="string"&&ue!==""||typeof ue=="number"||typeof ue=="bigint")return $e!==null?null:U(ie,ne,""+ue,we);if(typeof ue=="object"&&ue!==null){switch(ue.$$typeof){case L:return ue.key===$e?Q(ie,ne,ue,we):null;case D:return ue.key===$e?ae(ie,ne,ue,we):null;case K:return ue=gc(ue),se(ie,ne,ue,we)}if(xe(ue)||Z(ue))return $e!==null?null:ge(ie,ne,ue,we,null);if(typeof ue.then=="function")return se(ie,ne,xg(ue),we);if(ue.$$typeof===H)return se(ie,ne,pg(ie,ue),we);bg(ie,ue)}return null}function de(ie,ne,ue,we,$e){if(typeof we=="string"&&we!==""||typeof we=="number"||typeof we=="bigint")return ie=ie.get(ue)||null,U(ne,ie,""+we,$e);if(typeof we=="object"&&we!==null){switch(we.$$typeof){case L:return ie=ie.get(we.key===null?ue:we.key)||null,Q(ne,ie,we,$e);case D:return ie=ie.get(we.key===null?ue:we.key)||null,ae(ne,ie,we,$e);case K:return we=gc(we),de(ie,ne,ue,we,$e)}if(xe(we)||Z(we))return ie=ie.get(ue)||null,ge(ne,ie,we,$e,null);if(typeof we.then=="function")return de(ie,ne,ue,xg(we),$e);if(we.$$typeof===H)return de(ie,ne,ue,pg(ne,we),$e);bg(ne,we)}return null}function ze(ie,ne,ue,we){for(var $e=null,Nt=null,Xe=ne,ot=ne=0,Hn=null;Xe!==null&&ot<ue.length;ot++){Xe.index>ot?(Hn=Xe,Xe=null):Hn=Xe.sibling;var Mt=se(ie,Xe,ue[ot],we);if(Mt===null){Xe===null&&(Xe=Hn);break}i&&Xe&&Mt.alternate===null&&a(ie,Xe),ne=w(Mt,ne,ot),Nt===null?$e=Mt:Nt.sibling=Mt,Nt=Mt,Xe=Hn}if(ot===ue.length)return d(ie,Xe),vt&&Ni(ie,ot),$e;if(Xe===null){for(;ot<ue.length;ot++)Xe=Ce(ie,ue[ot],we),Xe!==null&&(ne=w(Xe,ne,ot),Nt===null?$e=Xe:Nt.sibling=Xe,Nt=Xe);return vt&&Ni(ie,ot),$e}for(Xe=g(Xe);ot<ue.length;ot++)Hn=de(Xe,ie,ot,ue[ot],we),Hn!==null&&(i&&(Mt=Hn.alternate,Mt!==null&&Xe.delete(Mt.key===null?ot:Mt.key)),ne=w(Hn,ne,ot),Nt===null?$e=Hn:Nt.sibling=Hn,Nt=Hn);return i&&Xe.forEach(function(ta){return a(ie,ta)}),vt&&Ni(ie,ot),$e}function qe(ie,ne,ue,we){if(ue==null)throw Error(r(151));for(var $e=null,Nt=null,Xe=ne,ot=ne=0,Hn=null,Mt=ue.next();Xe!==null&&!Mt.done;ot++,Mt=ue.next()){Xe.index>ot?(Hn=Xe,Xe=null):Hn=Xe.sibling;var ta=se(ie,Xe,Mt.value,we);if(ta===null){Xe===null&&(Xe=Hn);break}i&&Xe&&ta.alternate===null&&a(ie,Xe),ne=w(ta,ne,ot),Nt===null?$e=ta:Nt.sibling=ta,Nt=ta,Xe=Hn}if(Mt.done)return d(ie,Xe),vt&&Ni(ie,ot),$e;if(Xe===null){for(;!Mt.done;ot++,Mt=ue.next())Mt=Ce(ie,Mt.value,we),Mt!==null&&(ne=w(Mt,ne,ot),Nt===null?$e=Mt:Nt.sibling=Mt,Nt=Mt);return vt&&Ni(ie,ot),$e}for(Xe=g(Xe);!Mt.done;ot++,Mt=ue.next())Mt=de(Xe,ie,ot,Mt.value,we),Mt!==null&&(i&&(Hn=Mt.alternate,Hn!==null&&Xe.delete(Hn.key===null?ot:Hn.key)),ne=w(Mt,ne,ot),Nt===null?$e=Mt:Nt.sibling=Mt,Nt=Mt);return i&&Xe.forEach(function(kV){return a(ie,kV)}),vt&&Ni(ie,ot),$e}function mt(ie,ne,ue,we){if(typeof ue=="object"&&ue!==null&&ue.type===P&&ue.key===null&&ue.props.ref===void 0&&(ue=ue.props.children),typeof ue=="object"&&ue!==null){switch(ue.$$typeof){case L:e:{for(var $e=ue.key;ne!==null;){if(ne.key===$e){if($e=ue.type,$e===P){if(ne.tag===7){d(ie,ne.sibling),we=v(ne,ue.props.children),jl(we,ue),we.return=ie,ie=we;break e}}else if(ne.elementType===$e||typeof $e=="object"&&$e!==null&&$e.$$typeof===K&&gc($e)===ne.type){d(ie,ne.sibling),we=v(ne,ue.props),jl(we,ue),we.return=ie,ie=we;break e}d(ie,ne);break}else a(ie,ne);ne=ne.sibling}ue.type===P?(we=cc(ue.props.children,ie.mode,we,ue.key),jl(we,ue),we.return=ie,ie=we):(we=ag(ue.type,ue.key,ue.props,null,ie.mode,we),jl(we,ue),we.return=ie,ie=we)}return _(ie);case D:e:{for($e=ue.key;ne!==null;){if(ne.key===$e)if(ne.tag===4&&ne.stateNode.containerInfo===ue.containerInfo&&ne.stateNode.implementation===ue.implementation){d(ie,ne.sibling),we=v(ne,ue.children||[]),we.return=ie,ie=we;break e}else{d(ie,ne);break}else a(ie,ne);ne=ne.sibling}we=fv(ue,ie.mode,we),we.return=ie,ie=we}return _(ie);case K:return ue=gc(ue),mt(ie,ne,ue,we)}if(xe(ue))return ze(ie,ne,ue,we);if(Z(ue)){if($e=Z(ue),typeof $e!="function")throw Error(r(150));return ue=$e.call(ue),qe(ie,ne,ue,we)}if(typeof ue.then=="function")return mt(ie,ne,xg(ue),we);if(ue.$$typeof===H)return mt(ie,ne,pg(ie,ue),we);bg(ie,ue)}return typeof ue=="string"&&ue!==""||typeof ue=="number"||typeof ue=="bigint"?(ue=""+ue,ne!==null&&ne.tag===6?(d(ie,ne.sibling),we=v(ne,ue),we.return=ie,ie=we):(d(ie,ne),we=dv(ue,ie.mode,we),we.return=ie,ie=we),_(ie)):d(ie,ne)}return function(ie,ne,ue,we){try{rh=0;var $e=mt(ie,ne,ue,we);return Vu=null,$e}catch(Xe){if(Xe===Uu||Xe===gg)throw Xe;var Nt=hs(29,Xe,null,ie.mode);return Nt.lanes=we,Nt.return=ie,Nt}finally{}}}var xc=DO(!0),jO=DO(!1),Pl=!1;function wv(i){i.updateQueue={baseState:i.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Ev(i,a){i=i.updateQueue,a.updateQueue===i&&(a.updateQueue={baseState:i.baseState,firstBaseUpdate:i.firstBaseUpdate,lastBaseUpdate:i.lastBaseUpdate,shared:i.shared,callbacks:null})}function zl(i){return{lane:i,tag:0,payload:null,callback:null,next:null}}function Bl(i,a,d){var g=i.updateQueue;if(g===null)return null;if(g=g.shared,(zt&2)!==0){var v=g.pending;return v===null?a.next=a:(a.next=v.next,v.next=a),g.pending=a,a=lg(i),bO(i,null,d),a}return ig(i,g,a,d),lg(i)}function sh(i,a,d){if(a=a.updateQueue,a!==null&&(a=a.shared,(d&4194048)!==0)){var g=a.lanes;g&=i.pendingLanes,d|=g,a.lanes=d,Cl(i,d)}}function Cv(i,a){var d=i.updateQueue,g=i.alternate;if(g!==null&&(g=g.updateQueue,d===g)){var v=null,w=null;if(d=d.firstBaseUpdate,d!==null){do{var _={lane:d.lane,tag:d.tag,payload:d.payload,callback:null,next:null};w===null?v=w=_:w=w.next=_,d=d.next}while(d!==null);w===null?v=w=a:w=w.next=a}else v=w=a;d={baseState:g.baseState,firstBaseUpdate:v,lastBaseUpdate:w,shared:g.shared,callbacks:g.callbacks},i.updateQueue=d;return}i=d.lastBaseUpdate,i===null?d.firstBaseUpdate=a:i.next=a,d.lastBaseUpdate=a}var Tv=!1;function oh(){if(Tv){var i=$u;if(i!==null)throw i}}function ih(i,a,d,g){Tv=!1;var v=i.updateQueue;Pl=!1;var w=v.firstBaseUpdate,_=v.lastBaseUpdate,U=v.shared.pending;if(U!==null){v.shared.pending=null;var Q=U,ae=Q.next;Q.next=null,_===null?w=ae:_.next=ae,_=Q;var ge=i.alternate;ge!==null&&(ge=ge.updateQueue,U=ge.lastBaseUpdate,U!==_&&(U===null?ge.firstBaseUpdate=ae:U.next=ae,ge.lastBaseUpdate=Q))}if(w!==null){var Ce=v.baseState;_=0,ge=ae=Q=null,U=w;do{var se=U.lane&-536870913,de=se!==U.lane;if(de?(Tt&se)===se:(g&se)===se){se!==0&&se===pc&&(Tv=!0),ge!==null&&(ge=ge.next={lane:0,tag:U.tag,payload:U.payload,callback:null,next:null});e:{var ze=i,qe=U;se=a;var mt=d;switch(qe.tag){case 1:if(ze=qe.payload,typeof ze=="function"){Ce=ze.call(mt,Ce,se);break e}Ce=ze;break e;case 3:ze.flags=ze.flags&-65537|128;case 0:if(ze=qe.payload,se=typeof ze=="function"?ze.call(mt,Ce,se):ze,se==null)break e;Ce=A({},Ce,se);break e;case 2:Pl=!0}}se=U.callback,se!==null&&(i.flags|=64,de&&(i.flags|=8192),de=v.callbacks,de===null?v.callbacks=[se]:de.push(se))}else de={lane:se,tag:U.tag,payload:U.payload,callback:U.callback,next:null},ge===null?(ae=ge=de,Q=Ce):ge=ge.next=de,_|=se;if(U=U.next,U===null){if(U=v.shared.pending,U===null)break;de=U,U=de.next,de.next=null,v.lastBaseUpdate=de,v.shared.pending=null}}while(!0);ge===null&&(Q=Ce),v.baseState=Q,v.firstBaseUpdate=ae,v.lastBaseUpdate=ge,w===null&&(v.shared.lanes=0),Gl|=_,i.lanes=_,i.memoizedState=Ce}}function PO(i,a){if(typeof i!="function")throw Error(r(191,i));i.call(a)}function zO(i,a){var d=i.callbacks;if(d!==null)for(i.callbacks=null,i=0;i<d.length;i++)PO(d[i],a)}var Hl=ke(null),vg=ke(0);function BO(i,a){i=Ii,_e(vg,i),_e(Hl,a),Ii=i|a.baseLanes}function Nv(){_e(vg,Ii),_e(Hl,Hl.current)}function Ov(){Ii=vg.current,be(Hl),be(vg)}var yr=ke(null),Mr=null;function Fl(i){var a=i.alternate;_e(xr,xr.current&1),_e(yr,i),Mr===null&&(a===null||Hl.current!==null||a.memoizedState!==null)&&(Mr=i)}function Rv(i){_e(xr,xr.current),_e(yr,i),Mr===null&&(Mr=i)}function HO(i){i.tag===22?(_e(xr,xr.current),_e(yr,i),Mr===null&&(Mr=i)):$l()}function $l(){_e(xr,xr.current),_e(yr,yr.current)}function Ms(i){be(yr),Mr===i&&(Mr=null),be(xr)}var xr=ke(0);function lh(i,a){_e(yr,yr.current),_e(xr,a)}function Av(i){be(xr),be(yr),Mr===i&&(Mr=null)}function Sg(i){for(var a=i;a!==null;){if(a.tag===13){var d=a.memoizedState;if(d!==null&&(d=d.dehydrated,d===null||QS(d)||ZS(d)))return a}else if(a.tag===19&&a.memoizedProps.revealOrder!=="independent"){if((a.flags&128)!==0)return a}else if(a.child!==null){a.child.return=a,a=a.child;continue}if(a===i)break;for(;a.sibling===null;){if(a.return===null||a.return===i)return null;a=a.return}a.sibling.return=a.return,a=a.sibling}return null}var Ai=0,pt=null,Xt=null,zn=null,wg=!1,qu=!1,bc=!1,Eg=0,ah=0,Gu=null,QU=0;function Tn(){throw Error(r(321))}function kv(i,a){if(a===null)return!1;for(var d=0;d<a.length&&d<i.length;d++)if(!_s(i[d],a[d]))return!1;return!0}function _v(i,a,d,g,v,w){return Ai=w,pt=a,a.memoizedState=null,a.updateQueue=null,a.lanes=0,fe.H=i===null||i.memoizedState===null?ER:CR,bc=!1,w=d(g,v),bc=!1,qu&&(w=$O(a,d,g,v)),FO(i),w}function FO(i){fe.H=kg;var a=Xt!==null&&Xt.next!==null;if(Ai=0,zn=Xt=pt=null,wg=!1,ah=0,Gu=null,a)throw Error(r(300));i===null||Bn||(i=i.dependencies,i!==null&&hg(i)&&(Bn=!0))}function $O(i,a,d,g){pt=i;var v=0;do{if(qu&&(Gu=null),ah=0,qu=!1,25<=v)throw Error(r(301));if(v+=1,zn=Xt=null,i.updateQueue!=null){var w=i.updateQueue;w.lastEffect=null,w.events=null,w.stores=null,w.memoCache!=null&&(w.memoCache.index=0)}fe.H=o9,w=a(d,g)}while(qu);return w}function ZU(){var i=fe.H,a=i.useState()[0];return a=typeof a.then=="function"?ch(a):a,i=i.useState()[0],(Xt!==null?Xt.memoizedState:null)!==i&&(pt.flags|=1024),a}function Mv(){var i=Eg!==0;return Eg=0,i}function Iv(i,a,d){a.updateQueue=i.updateQueue,a.flags&=-2053,i.lanes&=~d}function Lv(i){if(wg){for(i=i.memoizedState;i!==null;){var a=i.queue;a!==null&&(a.pending=null),i=i.next}wg=!1}Ai=0,zn=Xt=pt=null,qu=!1,ah=Eg=0,Gu=null}function Yr(){var i={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return zn===null?pt.memoizedState=zn=i:zn=zn.next=i,zn}function kn(){if(Xt===null){var i=pt.alternate;i=i!==null?i.memoizedState:null}else i=Xt.next;var a=zn===null?pt.memoizedState:zn.next;if(a!==null)zn=a,Xt=i;else{if(i===null)throw pt.alternate===null?Error(r(467)):Error(r(310));Xt=i,i={memoizedState:Xt.memoizedState,baseState:Xt.baseState,baseQueue:Xt.baseQueue,queue:Xt.queue,next:null},zn===null?pt.memoizedState=zn=i:zn=zn.next=i}return zn}function Cg(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function ch(i){var a=ah;return ah+=1,Gu===null&&(Gu=[]),i=MO(Gu,i,a),a=pt,(zn===null?a.memoizedState:zn.next)===null&&(a=a.alternate,fe.H=a===null||a.memoizedState===null?ER:CR),i}function Tg(i){if(i!==null&&typeof i=="object"){if(typeof i.then=="function")return ch(i);if(i.$$typeof===X)return;if(i.$$typeof===H)return gr(i)}throw Error(r(438,String(i)))}function Dv(i){var a=null,d=pt.updateQueue;if(d!==null&&(a=d.memoCache),a==null){var g=pt.alternate;g!==null&&(g=g.updateQueue,g!==null&&(g=g.memoCache,g!=null&&(a={data:g.data.map(function(v){return v.slice()}),index:0})))}if(a==null&&(a={data:[],index:0}),d===null&&(d=Cg(),pt.updateQueue=d),d.memoCache=a,d=a.data[a.index],d===void 0)for(d=a.data[a.index]=Array(i),g=0;g<i;g++)d[g]=ce;return a.index++,d}function ki(i,a){return typeof a=="function"?a(i):a}function Ng(i){var a=kn();return jv(a,Xt,i)}function jv(i,a,d){var g=i.queue;if(g===null)throw Error(r(311));g.lastRenderedReducer=d;var v=i.baseQueue,w=g.pending;if(w!==null){if(v!==null){var _=v.next;v.next=w.next,w.next=_}a.baseQueue=v=w,g.pending=null}if(w=i.baseState,v===null)i.memoizedState=w;else{a=v.next;var U=_=null,Q=null,ae=a,ge=!1;do{var Ce=ae.lane&-536870913;if(Ce!==ae.lane?(Tt&Ce)===Ce:(Ai&Ce)===Ce){var se=ae.revertLane;if(se===0)Q!==null&&(Q=Q.next={lane:0,revertLane:0,gesture:null,action:ae.action,hasEagerState:ae.hasEagerState,eagerState:ae.eagerState,next:null}),Ce===pc&&(ge=!0);else if((Ai&se)===se){ae=ae.next,se===pc&&(ge=!0);continue}else Ce={lane:0,revertLane:ae.revertLane,gesture:null,action:ae.action,hasEagerState:ae.hasEagerState,eagerState:ae.eagerState,next:null},Q===null?(U=Q=Ce,_=w):Q=Q.next=Ce,pt.lanes|=se,Gl|=se;Ce=ae.action,bc&&d(w,Ce),w=ae.hasEagerState?ae.eagerState:d(w,Ce)}else se={lane:Ce,revertLane:ae.revertLane,gesture:ae.gesture,action:ae.action,hasEagerState:ae.hasEagerState,eagerState:ae.eagerState,next:null},Q===null?(U=Q=se,_=w):Q=Q.next=se,pt.lanes|=Ce,Gl|=Ce;ae=ae.next}while(ae!==null&&ae!==a);if(Q===null?_=w:Q.next=U,!_s(w,i.memoizedState)&&(Bn=!0,ge&&(d=$u,d!==null)))throw d;i.memoizedState=w,i.baseState=_,i.baseQueue=Q,g.lastRenderedState=w}return v===null&&(g.lanes=0),[i.memoizedState,g.dispatch]}function Pv(i){var a=kn(),d=a.queue;if(d===null)throw Error(r(311));d.lastRenderedReducer=i;var g=d.dispatch,v=d.pending,w=a.memoizedState;if(v!==null){d.pending=null;var _=v=v.next;do w=i(w,_.action),_=_.next;while(_!==v);_s(w,a.memoizedState)||(Bn=!0),a.memoizedState=w,a.baseQueue===null&&(a.baseState=w),d.lastRenderedState=w}return[w,g]}function UO(i,a,d){var g=pt,v=kn(),w=vt;if(w){if(d===void 0)throw Error(r(407));d=d()}else d=a();var _=!_s((Xt||v).memoizedState,d);if(_&&(v.memoizedState=d,Bn=!0),v=v.queue,Hv(GO.bind(null,g,v,i),[i]),i=v.getSnapshot!==a||_||zn!==null&&(zn.memoizedState.tag&1)!==0,Ku(i?9:8,{destroy:void 0},qO.bind(null,g,v,d,a),null),i){if(g.flags|=2048,en===null)throw Error(r(349));w||(Ai&127)!==0||VO(g,a,d)}return d}function VO(i,a,d){i.flags|=16384,i={getSnapshot:a,value:d},a=pt.updateQueue,a===null?(a=Cg(),pt.updateQueue=a,a.stores=[i]):(d=a.stores,d===null?a.stores=[i]:d.push(i))}function qO(i,a,d,g){a.value=d,a.getSnapshot=g,KO(a)&&YO(i)}function GO(i,a,d){return d(function(){KO(a)&&YO(i)})}function KO(i){var a=i.getSnapshot;i=i.value;try{var d=a();return!_s(i,d)}catch{return!0}}function YO(i){var a=ac(i,2);a!==null&&ys(a,i,2)}function zv(i){var a=Yr();if(typeof i=="function"){var d=i;if(i=d(),bc){Zt(!0);try{d()}finally{Zt(!1)}}}return a.memoizedState=a.baseState=i,a.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:ki,lastRenderedState:i},a}function WO(i,a,d,g){return i.baseState=d,jv(i,Xt,typeof g=="function"?g:ki)}function JU(i,a,d,g,v){if(Ag(i))throw Error(r(485));if(i=a.action,i!==null){var w={payload:v,action:i,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(_){w.listeners.push(_)}};fe.T!==null?d(!0):w.isTransition=!1,g(w),d=a.pending,d===null?(w.next=a.pending=w,XO(a,w)):(w.next=d.next,a.pending=d.next=w)}}function XO(i,a){var d=a.action,g=a.payload,v=i.state;if(a.isTransition){var w=fe.T,_={};_.types=w!==null?w.types:null,fe.T=_;try{var U=d(v,g),Q=fe.S;Q!==null&&Q(_,U),QO(i,a,U)}catch(ae){Bv(i,a,ae)}finally{w!==null&&_.types!==null&&(w.types=_.types),fe.T=w}}else try{w=d(v,g),QO(i,a,w)}catch(ae){Bv(i,a,ae)}}function QO(i,a,d){d!==null&&typeof d=="object"&&typeof d.then=="function"?d.then(function(g){ZO(i,a,g)},function(g){return Bv(i,a,g)}):ZO(i,a,d)}function ZO(i,a,d){a.status="fulfilled",a.value=d,JO(a),i.state=d,a=i.pending,a!==null&&(d=a.next,d===a?i.pending=null:(d=d.next,a.next=d,XO(i,d)))}function Bv(i,a,d){var g=i.pending;if(i.pending=null,g!==null){g=g.next;do a.status="rejected",a.reason=d,JO(a),a=a.next;while(a!==g)}i.action=null}function JO(i){i=i.listeners;for(var a=0;a<i.length;a++)(0,i[a])()}function eR(i,a){return a}function tR(i,a){if(vt){var d=en.formState;if(d!==null){e:{var g=pt;if(vt){if(rn){t:{for(var v=rn,w=Zs;v.nodeType!==8;){if(!w){v=null;break t}if(v=eo(v.nextSibling),v===null){v=null;break t}}w=v.data,v=w==="F!"||w==="F"?v:null}if(v){rn=eo(v.nextSibling),g=v.data==="F!";break e}}Ll(g)}g=!1}g&&(a=d[0])}}return d=Yr(),d.memoizedState=d.baseState=a,g={pending:null,lanes:0,dispatch:null,lastRenderedReducer:eR,lastRenderedState:a},d.queue=g,d=vR.bind(null,pt,g),g.dispatch=d,g=zv(!1),w=qv.bind(null,pt,!1,g.queue),g=Yr(),v={state:a,dispatch:null,action:i,pending:null},g.queue=v,d=JU.bind(null,pt,v,w,d),v.dispatch=d,g.memoizedState=i,[a,d,!1]}function nR(i){var a=kn();return rR(a,Xt,i)}function rR(i,a,d){if(a=jv(i,a,eR)[0],i=Ng(ki)[0],typeof a=="object"&&a!==null&&typeof a.then=="function")try{var g=ch(a)}catch(_){throw _===Uu?gg:_}else g=a;a=kn();var v=a.queue,w=v.dispatch;return d!==a.memoizedState&&(pt.flags|=2048,Ku(9,{destroy:void 0},e9.bind(null,v,d),null)),[g,w,i]}function e9(i,a){i.action=a}function sR(i){var a=kn(),d=Xt;if(d!==null)return rR(a,d,i);kn(),a=a.memoizedState,d=kn();var g=d.queue.dispatch;return d.memoizedState=i,[a,g,!1]}function Ku(i,a,d,g){return i={tag:i,create:d,deps:g,inst:a,next:null},a=pt.updateQueue,a===null&&(a=Cg(),pt.updateQueue=a),d=a.lastEffect,d===null?a.lastEffect=i.next=i:(g=d.next,d.next=i,i.next=g,a.lastEffect=i),i}function oR(){return kn().memoizedState}function Og(i,a,d,g){var v=Yr();pt.flags|=i,v.memoizedState=Ku(1|a,{destroy:void 0},d,g===void 0?null:g)}function Rg(i,a,d,g){var v=kn();g=g===void 0?null:g;var w=v.memoizedState.inst;Xt!==null&&g!==null&&kv(g,Xt.memoizedState.deps)?v.memoizedState=Ku(a,w,d,g):(pt.flags|=i,v.memoizedState=Ku(1|a,w,d,g))}function iR(i,a){Og(8390656,8,i,a)}function Hv(i,a){Rg(2048,8,i,a)}function t9(i){pt.flags|=4;var a=pt.updateQueue;if(a===null)a=Cg(),pt.updateQueue=a,a.events=[i];else{var d=a.events;d===null?a.events=[i]:d.push(i)}}function lR(i){var a=kn().memoizedState;return t9({ref:a,nextImpl:i}),function(){if((zt&2)!==0)throw Error(r(440));return a.impl.apply(void 0,arguments)}}function aR(i,a){return Rg(4,2,i,a)}function cR(i,a){return Rg(4,4,i,a)}function uR(i,a){if(typeof a=="function"){i=i();var d=a(i);return function(){typeof d=="function"?d():a(null)}}if(a!=null)return i=i(),a.current=i,function(){a.current=null}}function dR(i,a,d){d=d!=null?d.concat([i]):null,Rg(4,4,uR.bind(null,a,i),d)}function Fv(){}function fR(i,a){var d=kn();a=a===void 0?null:a;var g=d.memoizedState;return a!==null&&kv(a,g[1])?g[0]:(d.memoizedState=[i,a],i)}function hR(i,a){var d=kn();a=a===void 0?null:a;var g=d.memoizedState;if(a!==null&&kv(a,g[1]))return g[0];if(g=i(),bc){Zt(!0);try{i()}finally{Zt(!1)}}return d.memoizedState=[g,a],g}function $v(i,a,d){return d===void 0||(Ai&1073741824)!==0&&(Tt&261930)===0?i.memoizedState=a:(i.memoizedState=d,i=EA(),pt.lanes|=i,Gl|=i,d)}function pR(i,a,d,g){return _s(d,a)?d:Hl.current!==null?(i=$v(i,d,g),_s(i,a)||(Bn=!0),i):(Ai&106)===0||(Ai&1073741824)!==0&&(Tt&261930)===0?(Bn=!0,i.memoizedState=d):(i=EA(),pt.lanes|=i,Gl|=i,a)}function mR(i,a,d,g,v){var w=oe.p;oe.p=w!==0&&8>w?w:8;var _=fe.T,U={};U.types=_!==null?_.types:null,fe.T=U,qv(i,!1,a,d);try{var Q=v(),ae=fe.S;if(ae!==null&&ae(U,Q),Q!==null&&typeof Q=="object"&&typeof Q.then=="function"){var ge=XU(Q,g);uh(i,a,ge,js(i))}else uh(i,a,g,js(i))}catch(Ce){uh(i,a,{then:function(){},status:"rejected",reason:Ce},js())}finally{oe.p=w,_!==null&&U.types!==null&&(_.types=U.types),fe.T=_}}function n9(){}function Uv(i,a,d,g){if(i.tag!==5)throw Error(r(476));var v=gR(i).queue;mR(i,v,a,re,d===null?n9:function(){return yR(i),d(g)})}function gR(i){var a=i.memoizedState;if(a!==null)return a;a={memoizedState:re,baseState:re,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ki,lastRenderedState:re},next:null};var d={};return a.next={memoizedState:d,baseState:d,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ki,lastRenderedState:d},next:null},i.memoizedState=a,i=i.alternate,i!==null&&(i.memoizedState=a),a}function yR(i){var a=gR(i);a.next===null&&(a=i.alternate.memoizedState),uh(i,a.next.queue,{},js())}function Vv(){return gr(fd)}function xR(){return kn().memoizedState}function bR(){return kn().memoizedState}function r9(i){for(var a=i.return;a!==null;){switch(a.tag){case 24:case 3:var d=js();i=zl(d);var g=Bl(a,i,d);g!==null&&(ys(g,a,d),sh(g,a,d)),a={cache:xv()},i.payload=a;return}a=a.return}}function s9(i,a,d){var g=js();d={lane:g,revertLane:0,gesture:null,action:d,hasEagerState:!1,eagerState:null,next:null},Ag(i)?SR(a,d):(d=cv(i,a,d,g),d!==null&&(ys(d,i,g),wR(d,a,g)))}function vR(i,a,d){var g=js();uh(i,a,d,g)}function uh(i,a,d,g){var v={lane:g,revertLane:0,gesture:null,action:d,hasEagerState:!1,eagerState:null,next:null};if(Ag(i))SR(a,v);else{var w=i.alternate;if(i.lanes===0&&(w===null||w.lanes===0)&&(w=a.lastRenderedReducer,w!==null))try{var _=a.lastRenderedState,U=w(_,d);if(v.hasEagerState=!0,v.eagerState=U,_s(U,_))return ig(i,a,v,0),en===null&&og(),!1}catch{}finally{}if(d=cv(i,a,v,g),d!==null)return ys(d,i,g),wR(d,a,g),!0}return!1}function qv(i,a,d,g){if(g={lane:2,revertLane:DS(),gesture:null,action:g,hasEagerState:!1,eagerState:null,next:null},Ag(i)){if(a)throw Error(r(479))}else a=cv(i,d,g,2),a!==null&&ys(a,i,2)}function Ag(i){var a=i.alternate;return i===pt||a!==null&&a===pt}function SR(i,a){qu=wg=!0;var d=i.pending;d===null?a.next=a:(a.next=d.next,d.next=a),i.pending=a}function wR(i,a,d){if((d&4194048)!==0){var g=a.lanes;g&=i.pendingLanes,d|=g,a.lanes=d,Cl(i,d)}}var kg={readContext:gr,use:Tg,useCallback:Tn,useContext:Tn,useEffect:Tn,useImperativeHandle:Tn,useLayoutEffect:Tn,useInsertionEffect:Tn,useMemo:Tn,useReducer:Tn,useRef:Tn,useState:Tn,useDebugValue:Tn,useDeferredValue:Tn,useTransition:Tn,useSyncExternalStore:Tn,useId:Tn,useHostTransitionStatus:Tn,useFormState:Tn,useActionState:Tn,useOptimistic:Tn,useMemoCache:Tn,useCacheRefresh:Tn,useEffectEvent:Tn},ER={readContext:gr,use:Tg,useCallback:function(i,a){return Yr().memoizedState=[i,a===void 0?null:a],i},useContext:gr,useEffect:iR,useImperativeHandle:function(i,a,d){d=d!=null?d.concat([i]):null,Og(4194308,4,uR.bind(null,a,i),d)},useLayoutEffect:function(i,a){return Og(4194308,4,i,a)},useInsertionEffect:function(i,a){Og(4,2,i,a)},useMemo:function(i,a){var d=Yr();a=a===void 0?null:a;var g=i();if(bc){Zt(!0);try{i()}finally{Zt(!1)}}return d.memoizedState=[g,a],g},useReducer:function(i,a,d){var g=Yr();if(d!==void 0){var v=d(a);if(bc){Zt(!0);try{d(a)}finally{Zt(!1)}}}else v=a;return g.memoizedState=g.baseState=v,i={pending:null,lanes:0,dispatch:null,lastRenderedReducer:i,lastRenderedState:v},g.queue=i,i=i.dispatch=s9.bind(null,pt,i),[g.memoizedState,i]},useRef:function(i){var a=Yr();return i={current:i},a.memoizedState=i},useState:function(i){i=zv(i);var a=i.queue,d=vR.bind(null,pt,a);return a.dispatch=d,[i.memoizedState,d]},useDebugValue:Fv,useDeferredValue:function(i,a){var d=Yr();return $v(d,i,a)},useTransition:function(){var i=zv(!1);return i=mR.bind(null,pt,i.queue,!0,!1),Yr().memoizedState=i,[!1,i]},useSyncExternalStore:function(i,a,d){var g=pt,v=Yr();if(vt){if(d===void 0)throw Error(r(407));d=d()}else{if(d=a(),en===null)throw Error(r(349));(Tt&127)!==0||VO(g,a,d)}v.memoizedState=d;var w={value:d,getSnapshot:a};return v.queue=w,iR(GO.bind(null,g,w,i),[i]),g.flags|=2048,Ku(9,{destroy:void 0},qO.bind(null,g,w,d,a),null),d},useId:function(){var i=Yr(),a=en.identifierPrefix;if(vt){var d=zo,g=Po;d=(g&~(1<<32-Jt(g)-1)).toString(32)+d,a="_"+a+"R_"+d,d=Eg++,0<d&&(a+="H"+d.toString(32)),a+="_"}else d=QU++,a="_"+a+"r_"+d.toString(32)+"_";return i.memoizedState=a},useHostTransitionStatus:Vv,useFormState:tR,useActionState:tR,useOptimistic:function(i){var a=Yr();a.memoizedState=a.baseState=i;var d={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return a.queue=d,a=qv.bind(null,pt,!0,d),d.dispatch=a,[i,a]},useMemoCache:Dv,useCacheRefresh:function(){return Yr().memoizedState=r9.bind(null,pt)},useEffectEvent:function(i){var a=Yr(),d={impl:i};return a.memoizedState=d,function(){if((zt&2)!==0)throw Error(r(440));return d.impl.apply(void 0,arguments)}}},CR={readContext:gr,use:Tg,useCallback:fR,useContext:gr,useEffect:Hv,useImperativeHandle:dR,useInsertionEffect:aR,useLayoutEffect:cR,useMemo:hR,useReducer:Ng,useRef:oR,useState:function(){return Ng(ki)},useDebugValue:Fv,useDeferredValue:function(i,a){var d=kn();return pR(d,Xt.memoizedState,i,a)},useTransition:function(){var i=Ng(ki)[0],a=kn().memoizedState;return[typeof i=="boolean"?i:ch(i),a]},useSyncExternalStore:UO,useId:xR,useHostTransitionStatus:Vv,useFormState:nR,useActionState:nR,useOptimistic:function(i,a){var d=kn();return WO(d,Xt,i,a)},useMemoCache:Dv,useCacheRefresh:bR,useEffectEvent:lR},o9={readContext:gr,use:Tg,useCallback:fR,useContext:gr,useEffect:Hv,useImperativeHandle:dR,useInsertionEffect:aR,useLayoutEffect:cR,useMemo:hR,useReducer:Pv,useRef:oR,useState:function(){return Pv(ki)},useDebugValue:Fv,useDeferredValue:function(i,a){var d=kn();return Xt===null?$v(d,i,a):pR(d,Xt.memoizedState,i,a)},useTransition:function(){var i=Pv(ki)[0],a=kn().memoizedState;return[typeof i=="boolean"?i:ch(i),a]},useSyncExternalStore:UO,useId:xR,useHostTransitionStatus:Vv,useFormState:sR,useActionState:sR,useOptimistic:function(i,a){var d=kn();return Xt!==null?WO(d,Xt,i,a):(d.baseState=i,[i,d.queue.dispatch])},useMemoCache:Dv,useCacheRefresh:bR,useEffectEvent:lR};function Gv(i,a,d,g){a=i.memoizedState,d=d(g,a),d=d==null?a:A({},a,d),i.memoizedState=d,i.lanes===0&&(i.updateQueue.baseState=d)}var Kv={enqueueSetState:function(i,a,d){i=i._reactInternals;var g=js(),v=zl(g);v.payload=a,d!=null&&(v.callback=d),a=Bl(i,v,g),a!==null&&(ys(a,i,g),sh(a,i,g))},enqueueReplaceState:function(i,a,d){i=i._reactInternals;var g=js(),v=zl(g);v.tag=1,v.payload=a,d!=null&&(v.callback=d),a=Bl(i,v,g),a!==null&&(ys(a,i,g),sh(a,i,g))},enqueueForceUpdate:function(i,a){i=i._reactInternals;var d=js(),g=zl(d);g.tag=2,a!=null&&(g.callback=a),a=Bl(i,g,d),a!==null&&(ys(a,i,d),sh(a,i,d))}};function TR(i,a,d,g,v,w,_){return i=i.stateNode,typeof i.shouldComponentUpdate=="function"?i.shouldComponentUpdate(g,w,_):a.prototype&&a.prototype.isPureReactComponent?!Xf(d,g)||!Xf(v,w):!0}function NR(i,a,d,g){i=a.state,typeof a.componentWillReceiveProps=="function"&&a.componentWillReceiveProps(d,g),typeof a.UNSAFE_componentWillReceiveProps=="function"&&a.UNSAFE_componentWillReceiveProps(d,g),a.state!==i&&Kv.enqueueReplaceState(a,a.state,null)}function vc(i,a){var d=a;if("ref"in a){d={};for(var g in a)g!=="ref"&&(d[g]=a[g])}if(i=i.defaultProps){d===a&&(d=A({},d));for(var v in i)d[v]===void 0&&(d[v]=i[v])}return d}function OR(i){sg(i)}function RR(i){console.error(i)}function AR(i){sg(i)}function _g(i,a){try{var d=i.onUncaughtError;d(a.value,{componentStack:a.stack})}catch(g){setTimeout(function(){throw g})}}function kR(i,a,d){try{var g=i.onCaughtError;g(d.value,{componentStack:d.stack,errorBoundary:a.tag===1?a.stateNode:null})}catch(v){setTimeout(function(){throw v})}}function Yv(i,a,d){return d=zl(d),d.tag=3,d.payload={element:null},d.callback=function(){_g(i,a)},d}function _R(i){return i=zl(i),i.tag=3,i}function MR(i,a,d,g){var v=d.type.getDerivedStateFromError;if(typeof v=="function"){var w=g.value;i.payload=function(){return v(w)},i.callback=function(){kR(a,d,g)}}var _=d.stateNode;_!==null&&typeof _.componentDidCatch=="function"&&(i.callback=function(){kR(a,d,g),typeof v!="function"&&(Kl===null?Kl=new Set([this]):Kl.add(this));var U=g.stack;this.componentDidCatch(g.value,{componentStack:U!==null?U:""})})}function i9(i,a,d,g,v){if(d.flags|=32768,g!==null&&typeof g=="object"&&typeof g.then=="function"){if(a=d.alternate,a!==null&&fc(a,d,v,!0),d=yr.current,d!==null){switch(d.tag){case 31:case 13:case 19:return Mr===null?Zg():d.alternate===null&&Nn===0&&(Nn=3),d.flags&=-257,d.flags|=65536,d.lanes=v,g===yg?d.flags|=16384:(a=d.updateQueue,a===null?d.updateQueue=new Set([g]):a.add(g),MS(i,g,v)),!1;case 22:return d.flags|=65536,g===yg?d.flags|=16384:(a=d.updateQueue,a===null?(a={transitions:null,markerInstances:null,retryQueue:new Set([g])},d.updateQueue=a):(d=a.retryQueue,d===null?a.retryQueue=new Set([g]):d.add(g)),MS(i,g,v)),!1}throw Error(r(435,d.tag))}return MS(i,g,v),Zg(),!1}if(vt)return a=yr.current,a!==null?((a.flags&65536)===0&&(a.flags|=256),a.flags|=65536,a.lanes=v,g!==pv&&(i=Error(r(422),{cause:g}),Jf(Ws(i,d)))):(g!==pv&&(a=Error(r(423),{cause:g}),Jf(Ws(a,d))),i=i.current.alternate,i.flags|=65536,v&=-v,i.lanes|=v,g=Ws(g,d),v=Yv(i.stateNode,g,v),Cv(i,v),Nn!==4&&(Nn=2)),!1;var w=Error(r(520),{cause:g});if(w=Ws(w,d),xh===null?xh=[w]:xh.push(w),Nn!==4&&(Nn=2),a===null)return!0;g=Ws(g,d),d=a;do{switch(d.tag){case 3:return d.flags|=65536,i=v&-v,d.lanes|=i,i=Yv(d.stateNode,g,i),Cv(d,i),!1;case 1:if(a=d.type,w=d.stateNode,(d.flags&128)===0&&(typeof a.getDerivedStateFromError=="function"||w!==null&&typeof w.componentDidCatch=="function"&&(Kl===null||!Kl.has(w))))return d.flags|=65536,v&=-v,d.lanes|=v,v=_R(v),MR(v,i,d,g),Cv(d,v),!1;break;case 22:if(d.memoizedState!==null)return d.flags|=65536,!1}d=d.return}while(d!==null);return!1}var Wv=Error(r(461)),Bn=!1;function Xn(i,a,d,g){a.child=i===null?jO(a,null,d,g):xc(a,i.child,d,g)}function IR(i,a,d,g,v){d=d.render;var w=a.ref;if("ref"in g){var _={};for(var U in g)U!=="ref"&&(_[U]=g[U])}else _=g;return hc(a),g=_v(i,a,d,_,w,v),U=Mv(),i!==null&&!Bn?(Iv(i,a,v),_i(i,a,v)):(vt&&U&&ug(a),a.flags|=1,Xn(i,a,g,v),a.child)}function LR(i,a,d,g,v){if(i===null){var w=d.type;return typeof w=="function"&&!uv(w)&&w.defaultProps===void 0&&d.compare===null?(a.tag=15,a.type=w,DR(i,a,w,g,v)):(i=ag(d.type,null,g,a,a.mode,v),i.ref=a.ref,i.return=a,a.child=i)}if(w=i.child,!rS(i,v)){var _=w.memoizedProps;if(d=d.compare,d=d!==null?d:Xf,d(_,g)&&i.ref===a.ref)return _i(i,a,v)}return a.flags|=1,i=Ti(w,g),i.ref=a.ref,i.return=a,a.child=i}function DR(i,a,d,g,v){if(i!==null){var w=i.memoizedProps;if(Xf(w,g)&&i.ref===a.ref)if(Bn=!1,a.pendingProps=g=w,rS(i,v))(i.flags&131072)!==0&&(Bn=!0);else return a.lanes=i.lanes,_i(i,a,v)}return Xv(i,a,d,g,v)}function jR(i,a,d,g){var v=g.children,w=i!==null?i.memoizedState:null;if(i===null&&a.stateNode===null&&(a.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),g.mode==="hidden"){if((a.flags&128)!==0){if(w=w!==null?w.baseLanes|d:d,i!==null){for(g=a.child=i.child,v=0;g!==null;)v=v|g.lanes|g.childLanes,g=g.sibling;g=v&~w}else g=0,a.child=null;return PR(i,a,w,d,g)}if((d&536870912)!==0)a.memoizedState={baseLanes:0,cachePool:null},i!==null&&mg(a,w!==null?w.cachePool:null),w!==null?BO(a,w):Nv(),HO(a);else return g=a.lanes=536870912,PR(i,a,w!==null?w.baseLanes|d:d,d,g)}else w!==null?(mg(a,w.cachePool),BO(a,w),$l(),a.memoizedState=null):(i!==null&&mg(a,null),Nv(),$l());return Xn(i,a,v,d),a.child}function dh(i,a){return i!==null&&i.tag===22||a.stateNode!==null||(a.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),a.sibling}function PR(i,a,d,g,v){var w=vv();return w=w===null?null:{parent:Pn._currentValue,pool:w},a.memoizedState={baseLanes:d,cachePool:w},i!==null&&mg(a,null),Nv(),HO(a),i!==null&&fc(i,a,g,!0),a.childLanes=v,null}function Mg(i,a){return a=Ig({mode:a.mode,children:a.children},i.mode),a.ref=i.ref,i.child=a,a.return=i,a}function zR(i,a,d){return xc(a,i.child,null,d),i=Mg(a,a.pendingProps),i.flags|=2,Ms(a),a.memoizedState=null,i}function l9(i,a,d){var g=a.pendingProps,v=(a.flags&128)!==0;if(a.flags&=-129,i===null){if(vt){if(g.mode==="hidden")return i=Mg(a,g),a.lanes=536870912,i.memoizedState={baseLanes:0,cachePool:null},dh(null,i);if(Rv(a),(i=rn)?(i=uk(i,Zs),i=i!==null&&i.data==="&"?i:null,i!==null&&(a.memoizedState={dehydrated:i,treeContext:Ml!==null?{id:Po,overflow:zo}:null,retryLane:536870912,hydrationErrors:null},d=SO(i),d.return=a,a.child=d,tr=a,rn=null)):i=null,i===null)throw Ll(a);return a.lanes=536870912,null}return Mg(a,g)}var w=i.memoizedState;if(w!==null){var _=w.dehydrated;if(Rv(a),v)if(a.flags&256)a.flags&=-257,a=zR(i,a,d);else if(a.memoizedState!==null)a.child=i.child,a.flags|=128,a=null;else throw Error(r(558));else if(Bn||fc(i,a,d,!1),v=(d&i.childLanes)!==0,Bn||v){if(Hl.current===null){if(g=en,g!==null&&(_=gi(g,d),_!==0&&_!==w.retryLane))throw w.retryLane=_,ac(i,_),ys(g,i,_),Wv;Zg()}a=zR(i,a,d)}else i=w.treeContext,rn=eo(_.nextSibling),tr=a,vt=!0,Il=null,Zs=!1,i!==null&&CO(a,i),a=Mg(a,g),a.flags|=134221824;return a}return i=Ti(i.child,{mode:g.mode,children:g.children}),i.ref=a.ref,a.child=i,i.return=a,i}function Yu(i,a){var d=a.ref;if(d===null)i!==null&&i.ref!==null&&(a.flags|=4194816);else{if(typeof d!="function"&&typeof d!="object")throw Error(r(284));(i===null||i.ref!==d)&&(a.flags|=4194816)}}function Xv(i,a,d,g,v){return hc(a),d=_v(i,a,d,g,void 0,v),g=Mv(),i!==null&&!Bn?(Iv(i,a,v),_i(i,a,v)):(vt&&g&&ug(a),a.flags|=1,Xn(i,a,d,v),a.child)}function BR(i,a,d,g,v,w){return hc(a),a.updateQueue=null,d=$O(a,g,d,v),FO(i),g=Mv(),i!==null&&!Bn?(Iv(i,a,w),_i(i,a,w)):(vt&&g&&ug(a),a.flags|=1,Xn(i,a,d,w),a.child)}function HR(i,a,d,g,v){if(hc(a),a.stateNode===null){var w=zu,_=d.contextType;typeof _=="object"&&_!==null&&(w=gr(_)),w=new d(g,w),a.memoizedState=w.state!==null&&w.state!==void 0?w.state:null,w.updater=Kv,a.stateNode=w,w._reactInternals=a,w=a.stateNode,w.props=g,w.state=a.memoizedState,w.refs={},wv(a),_=d.contextType,w.context=typeof _=="object"&&_!==null?gr(_):zu,w.state=a.memoizedState,_=d.getDerivedStateFromProps,typeof _=="function"&&(Gv(a,d,_,g),w.state=a.memoizedState),typeof d.getDerivedStateFromProps=="function"||typeof w.getSnapshotBeforeUpdate=="function"||typeof w.UNSAFE_componentWillMount!="function"&&typeof w.componentWillMount!="function"||(_=w.state,typeof w.componentWillMount=="function"&&w.componentWillMount(),typeof w.UNSAFE_componentWillMount=="function"&&w.UNSAFE_componentWillMount(),_!==w.state&&Kv.enqueueReplaceState(w,w.state,null),ih(a,g,w,v),oh(),w.state=a.memoizedState),typeof w.componentDidMount=="function"&&(a.flags|=4194308),g=!0}else if(i===null){w=a.stateNode;var U=a.memoizedProps,Q=vc(d,U);w.props=Q;var ae=w.context,ge=d.contextType;_=zu,typeof ge=="object"&&ge!==null&&(_=gr(ge));var Ce=d.getDerivedStateFromProps;ge=typeof Ce=="function"||typeof w.getSnapshotBeforeUpdate=="function",U=a.pendingProps!==U,ge||typeof w.UNSAFE_componentWillReceiveProps!="function"&&typeof w.componentWillReceiveProps!="function"||(U||ae!==_)&&NR(a,w,g,_),Pl=!1;var se=a.memoizedState;w.state=se,ih(a,g,w,v),oh(),ae=a.memoizedState,U||se!==ae||Pl?(typeof Ce=="function"&&(Gv(a,d,Ce,g),ae=a.memoizedState),(Q=Pl||TR(a,d,Q,g,se,ae,_))?(ge||typeof w.UNSAFE_componentWillMount!="function"&&typeof w.componentWillMount!="function"||(typeof w.componentWillMount=="function"&&w.componentWillMount(),typeof w.UNSAFE_componentWillMount=="function"&&w.UNSAFE_componentWillMount()),typeof w.componentDidMount=="function"&&(a.flags|=4194308)):(typeof w.componentDidMount=="function"&&(a.flags|=4194308),a.memoizedProps=g,a.memoizedState=ae),w.props=g,w.state=ae,w.context=_,g=Q):(typeof w.componentDidMount=="function"&&(a.flags|=4194308),g=!1)}else{w=a.stateNode,Ev(i,a),_=a.memoizedProps,ge=vc(d,_),w.props=ge,Ce=a.pendingProps,se=w.context,ae=d.contextType,Q=zu,typeof ae=="object"&&ae!==null&&(Q=gr(ae)),U=d.getDerivedStateFromProps,(ae=typeof U=="function"||typeof w.getSnapshotBeforeUpdate=="function")||typeof w.UNSAFE_componentWillReceiveProps!="function"&&typeof w.componentWillReceiveProps!="function"||(_!==Ce||se!==Q)&&NR(a,w,g,Q),Pl=!1,se=a.memoizedState,w.state=se,ih(a,g,w,v),oh();var de=a.memoizedState;_!==Ce||se!==de||Pl||i!==null&&i.dependencies!==null&&hg(i.dependencies)?(typeof U=="function"&&(Gv(a,d,U,g),de=a.memoizedState),(ge=Pl||TR(a,d,ge,g,se,de,Q)||i!==null&&i.dependencies!==null&&hg(i.dependencies))?(ae||typeof w.UNSAFE_componentWillUpdate!="function"&&typeof w.componentWillUpdate!="function"||(typeof w.componentWillUpdate=="function"&&w.componentWillUpdate(g,de,Q),typeof w.UNSAFE_componentWillUpdate=="function"&&w.UNSAFE_componentWillUpdate(g,de,Q)),typeof w.componentDidUpdate=="function"&&(a.flags|=4),typeof w.getSnapshotBeforeUpdate=="function"&&(a.flags|=1024)):(typeof w.componentDidUpdate!="function"||_===i.memoizedProps&&se===i.memoizedState||(a.flags|=4),typeof w.getSnapshotBeforeUpdate!="function"||_===i.memoizedProps&&se===i.memoizedState||(a.flags|=1024),a.memoizedProps=g,a.memoizedState=de),w.props=g,w.state=de,w.context=Q,g=ge):(typeof w.componentDidUpdate!="function"||_===i.memoizedProps&&se===i.memoizedState||(a.flags|=4),typeof w.getSnapshotBeforeUpdate!="function"||_===i.memoizedProps&&se===i.memoizedState||(a.flags|=1024),g=!1)}return w=g,Yu(i,a),g=(a.flags&128)!==0,w||g?(w=a.stateNode,d=g&&typeof d.getDerivedStateFromError!="function"?null:w.render(),a.flags|=1,i!==null&&g?(a.child=xc(a,i.child,null,v),a.child=xc(a,null,d,v)):Xn(i,a,d,v),a.memoizedState=w.state,i=a.child):i=_i(i,a,v),i}function FR(i,a,d,g){return uc(),a.flags|=256,Xn(i,a,d,g),a.child}var Qv={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Zv(i){return{baseLanes:i,cachePool:kO()}}function Jv(i,a,d){return i=i!==null?i.childLanes&~d:0,a&&(i|=Ds),i}function $R(i,a,d){var g=a.pendingProps,v=!1,w=(a.flags&128)!==0,_;if((_=w)||(_=i!==null&&i.memoizedState===null?!1:(xr.current&2)!==0),_&&(v=!0,a.flags&=-129),_=(a.flags&32)!==0,a.flags&=-33,i===null){if(vt){if(v?Fl(a):$l(),(i=rn)?(i=uk(i,Zs),i=i!==null&&i.data!=="&"?i:null,i!==null&&(a.memoizedState={dehydrated:i,treeContext:Ml!==null?{id:Po,overflow:zo}:null,retryLane:536870912,hydrationErrors:null},d=SO(i),d.return=a,a.child=d,tr=a,rn=null)):i=null,i===null)throw Ll(a);return ZS(i)?a.lanes=32:a.lanes=536870912,null}return w=g.children,g=g.fallback,v?($l(),v=a.mode,w=Ig({mode:"hidden",children:w},v),g=cc(g,v,d,null),w.return=a,g.return=a,w.sibling=g,a.child=w,g=a.child,g.memoizedState=Zv(d),g.childLanes=Jv(i,_,d),a.memoizedState=Qv,dh(null,g)):(Fl(a),eS(a,w))}var U=i.memoizedState;if(U!==null){var Q=U.dehydrated;if(Q!==null)return a9(i,a,w,_,g,Q,U,d)}return v?($l(),v=g.fallback,w=a.mode,U=i.child,Q=U.sibling,g=Ti(U,{mode:"hidden",children:g.children}),g.subtreeFlags=U.subtreeFlags&1206910976,Q!==null?v=Ti(Q,v):(v=cc(v,w,d,null),v.flags|=2),v.return=a,g.return=a,g.sibling=v,a.child=g,dh(null,g),g=a.child,v=i.child.memoizedState,v===null?v=Zv(d):(w=v.cachePool,w!==null?(U=Pn._currentValue,w=w.parent!==U?{parent:U,pool:U}:w):w=kO(),v={baseLanes:v.baseLanes|d,cachePool:w}),g.memoizedState=v,g.childLanes=Jv(i,_,d),a.memoizedState=Qv,dh(i.child,g)):(Fl(a),d=i.child,i=d.sibling,d=Ti(d,{mode:"visible",children:g.children}),d.return=a,d.sibling=null,i!==null&&(_=a.deletions,_===null?(a.deletions=[i],a.flags|=16):_.push(i)),a.child=d,a.memoizedState=null,d)}function eS(i,a){return a=Ig({mode:"visible",children:a},i.mode),a.return=i,i.child=a}function Ig(i,a){return i=hs(22,i,null,a),i.lanes=0,i}function Lg(i,a,d){return xc(a,i.child,null,d),i=eS(a,a.pendingProps.children),i.flags|=2,a.memoizedState=null,i}function a9(i,a,d,g,v,w,_,U){if(d)return a.flags&256?(Fl(a),a.flags&=-257,Lg(i,a,U)):a.memoizedState!==null?($l(),a.child=i.child,a.flags|=128,null):($l(),w=v.fallback,_=a.mode,v=Ig({mode:"visible",children:v.children},_),w=cc(w,_,U,null),w.flags|=2,v.return=a,w.return=a,v.sibling=w,a.child=v,xc(a,i.child,null,U),v=a.child,v.memoizedState=Zv(U),v.childLanes=Jv(i,g,U),a.memoizedState=Qv,dh(null,v));if(Fl(a),ZS(w)){if(g=w.nextSibling&&w.nextSibling.dataset,g)var Q=g.dgst;return g=Q,g!==""&&(v=Error(r(419)),v.stack="",v.digest=g,Jf({value:v,source:null,stack:null})),Lg(i,a,U)}if(Bn||fc(i,a,U,!1),g=(U&i.childLanes)!==0,Bn||g){if(Hl.current!==null)return Lg(i,a,U);if(g=en,g!==null&&(v=gi(g,U),v!==0&&v!==_.retryLane))throw _.retryLane=v,ac(i,v),ys(g,i,v),Wv;return QS(w)||Zg(),Lg(i,a,U)}return QS(w)?(a.flags|=192,a.child=i.child,null):(i=_.treeContext,rn=eo(w.nextSibling),tr=a,vt=!0,Il=null,Zs=!1,i!==null&&CO(a,i),a=eS(a,v.children),a.flags|=134221824,a)}function UR(i,a,d){i.lanes|=a;var g=i.alternate;g!==null&&(g.lanes|=a),fg(i.return,a,d)}function VR(i){for(var a=null;i!==null;){var d=i.alternate;d!==null&&Sg(d)===null&&(a=i),i=i.sibling}return a}function Dg(i,a,d,g,v,w){var _=i.memoizedState;_===null?i.memoizedState={isBackwards:a,rendering:null,renderingStartTime:0,last:g,tail:d,tailMode:v,treeForkCount:w}:(_.isBackwards=a,_.rendering=null,_.renderingStartTime=0,_.last=g,_.tail=d,_.tailMode=v,_.treeForkCount=w)}function tS(i){var a=i.child;for(i.child=null;a!==null;){var d=a.sibling;a.sibling=i.child,i.child=a,a=d}}function nS(i,a,d){var g=a.pendingProps,v=g.revealOrder,w=g.tail;g=g.children;var _=xr.current;if(a.flags&128)return lh(a,_),null;var U=(_&2)!==0;if(U?(_=_&1|2,a.flags|=128):_&=1,lh(a,_),v==="backwards"&&i!==null?(tS(i),Xn(i,a,g,d),tS(i)):Xn(i,a,g,d),g=vt?Zf:0,!U&&i!==null&&(i.flags&128)!==0)e:for(i=a.child;i!==null;){if(i.tag===13)i.memoizedState!==null&&UR(i,d,a);else if(i.tag===19)UR(i,d,a);else if(i.child!==null){i.child.return=i,i=i.child;continue}if(i===a)break e;for(;i.sibling===null;){if(i.return===null||i.return===a)break e;i=i.return}i.sibling.return=i.return,i=i.sibling}switch(v){case"backwards":d=VR(a.child),d===null?(v=a.child,a.child=null):(v=d.sibling,d.sibling=null,tS(a)),Dg(a,!0,v,null,w,g);break;case"unstable_legacy-backwards":for(d=null,v=a.child,a.child=null;v!==null;){if(i=v.alternate,i!==null&&Sg(i)===null){a.child=v;break}i=v.sibling,v.sibling=d,d=v,v=i}Dg(a,!0,d,null,w,g);break;case"together":Dg(a,!1,null,null,void 0,g);break;case"independent":a.memoizedState=null;break;default:d=VR(a.child),d===null?(v=a.child,a.child=null):(v=d.sibling,d.sibling=null),Dg(a,!1,v,d,w,g)}return a.child}function qR(i,a,d){var g=a.pendingProps;return Dl(a,a.type,g.value),Xn(i,a,g.children,d),a.child}function _i(i,a,d){if(i!==null&&(a.dependencies=i.dependencies),Gl|=a.lanes,(d&a.childLanes)===0)if(i!==null){if(fc(i,a,d,!1),(d&a.childLanes)===0)return null}else return null;if(i!==null&&a.child!==i.child)throw Error(r(153));if(a.child!==null){for(i=a.child,d=Ti(i,i.pendingProps),a.child=d,d.return=a;i.sibling!==null;)i=i.sibling,d=d.sibling=Ti(i,i.pendingProps),d.return=a;d.sibling=null}return a.child}function rS(i,a){return(i.lanes&a)!==0?!0:(i=i.dependencies,!!(i!==null&&hg(i)))}function c9(i,a,d){switch(a.tag){case 3:Ae(a,a.stateNode.containerInfo),Dl(a,Pn,i.memoizedState.cache),uc();break;case 27:case 5:je(a);break;case 4:Ae(a,a.stateNode.containerInfo);break;case 10:Dl(a,a.type,a.memoizedProps.value);break;case 31:if(a.memoizedState!==null)return a.flags|=128,Rv(a),null;break;case 13:var g=a.memoizedState;if(g!==null){if(g.dehydrated!==null)return Fl(a),a.flags|=128,null;g=fc(i,a,d,!1);var v=a.child.childLanes;return g||(d&v)!==0?$R(i,a,d):(Fl(a),i=_i(i,a,d),i!==null?i.sibling:null)}Fl(a);break;case 19:if(a.flags&128)return nS(i,a,d);if(v=(i.flags&128)!==0,g=(d&a.childLanes)!==0,g||(fc(i,a,d,!1),g=(d&a.childLanes)!==0),v){if(g)return nS(i,a,d);a.flags|=128}if(v=a.memoizedState,v!==null&&(v.rendering=null,v.tail=null,v.lastEffect=null),lh(a,xr.current),g)break;return null;case 22:return a.lanes=0,jR(i,a,d,a.pendingProps);case 24:Dl(a,Pn,i.memoizedState.cache)}return _i(i,a,d)}function GR(i,a,d){if(i!==null)if(i.memoizedProps!==a.pendingProps)Bn=!0;else{if(!rS(i,d)&&(a.flags&128)===0)return Bn=!1,c9(i,a,d);Bn=(i.flags&131072)!==0}else Bn=!1,vt&&(a.flags&1048576)!==0&&EO(a,Zf,a.index);switch(a.lanes=0,a.tag){case 16:e:{var g=a.pendingProps;if(i=gc(a.elementType),a.type=i,typeof i=="function")uv(i)?(g=vc(i,g),a.tag=1,a=HR(null,a,i,g,d)):(a.tag=0,a=Xv(null,a,i,g,d));else{if(i!=null){var v=i.$$typeof;if(v===B){a.tag=11,a=IR(null,a,i,g,d);break e}else if(v===q){a.tag=14,a=LR(null,a,i,g,d);break e}else if(v===H){a.tag=10,a.type=i,a=qR(null,a,d);break e}}throw a=le(i)||i,Error(r(306,a,""))}}return a;case 0:return Xv(i,a,a.type,a.pendingProps,d);case 1:return g=a.type,v=vc(g,a.pendingProps),HR(i,a,g,v,d);case 3:e:{if(Ae(a,a.stateNode.containerInfo),i===null)throw Error(r(387));g=a.pendingProps;var w=a.memoizedState;v=w.element,Ev(i,a),ih(a,g,null,d);var _=a.memoizedState;if(g=_.cache,Dl(a,Pn,g),g!==w.cache&&yv(a,[Pn],d,!0),oh(),g=_.element,w.isDehydrated)if(w={element:g,isDehydrated:!1,cache:_.cache},a.updateQueue.baseState=w,a.memoizedState=w,a.flags&256){a=FR(i,a,g,d);break e}else if(g!==v){v=Ws(Error(r(424)),a),Jf(v),a=FR(i,a,g,d);break e}else{switch(i=a.stateNode.containerInfo,i.nodeType){case 9:i=i.body;break;default:i=i.nodeName==="HTML"?i.ownerDocument.body:i}for(rn=eo(i.firstChild),tr=a,vt=!0,Il=null,Zs=!0,d=jO(a,null,g,d),a.child=d;d;)d.flags=d.flags&-3|134221824,d=d.sibling}else{if(uc(),g===v){a=_i(i,a,d);break e}Xn(i,a,g,d)}a=a.child}return a;case 26:return Yu(i,a),i===null?(d=yk(a.type,null,a.pendingProps,null))?a.memoizedState=d:vt||(a.stateNode=XA(a.type,a.pendingProps,Pe.current,a)):a.memoizedState=yk(a.type,i.memoizedProps,a.pendingProps,i.memoizedState),null;case 27:return je(a),i===null&&vt&&(g=a.stateNode=hk(a.type,a.pendingProps,Pe.current),tr=a,Zs=!0,v=rn,Xl(a.type)?(JS=v,rn=eo(g.firstChild)):rn=v),Xn(i,a,a.pendingProps.children,d),Yu(i,a),i===null&&(a.flags|=4194304),a.child;case 5:return i===null&&vt&&((v=g=rn)&&(g=rV(g,a.type,a.pendingProps,Zs),g!==null?(a.stateNode=g,tr=a,rn=eo(g.firstChild),Zs=!1,v=!0):v=!1),v||Ll(a)),je(a),v=a.type,w=a.pendingProps,_=i!==null?i.memoizedProps:null,g=w.children,VS(v,w)?g=null:_!==null&&VS(v,_)&&(a.flags|=32),a.memoizedState!==null&&(v=_v(i,a,ZU,null,null,d),fd._currentValue=v),Yu(i,a),Xn(i,a,g,d),a.child;case 6:return i===null&&vt&&((i=d=rn)&&(d=sV(d,a.pendingProps,Zs),d!==null?(a.stateNode=d,tr=a,rn=null,i=!0):i=!1),i||Ll(a)),null;case 13:return $R(i,a,d);case 4:return Ae(a,a.stateNode.containerInfo),g=a.pendingProps,i===null?a.child=xc(a,null,g,d):Xn(i,a,g,d),a.child;case 11:return IR(i,a,a.type,a.pendingProps,d);case 7:return g=a.pendingProps,Yu(i,a),Xn(i,a,g,d),a.child;case 8:return Xn(i,a,a.pendingProps.children,d),a.child;case 12:return Xn(i,a,a.pendingProps.children,d),a.child;case 10:return qR(i,a,d);case 9:return v=a.type._context,g=a.pendingProps.children,hc(a),v=gr(v),g=g(v),a.flags|=1,Xn(i,a,g,d),a.child;case 14:return LR(i,a,a.type,a.pendingProps,d);case 15:return DR(i,a,a.type,a.pendingProps,d);case 19:return nS(i,a,d);case 31:return l9(i,a,d);case 22:return jR(i,a,d,a.pendingProps);case 24:return hc(a),g=gr(Pn),i===null?(v=vv(),v===null&&(v=en,w=xv(),v.pooledCache=w,w.refCount++,w!==null&&(v.pooledCacheLanes|=d),v=w),a.memoizedState={parent:g,cache:v},wv(a),Dl(a,Pn,v)):((i.lanes&d)!==0&&(Ev(i,a),ih(a,null,null,d),oh()),v=i.memoizedState,w=a.memoizedState,v.parent!==g?(v={parent:g,cache:g},a.memoizedState=v,a.lanes===0&&(a.memoizedState=a.updateQueue.baseState=v),Dl(a,Pn,g)):(g=w.cache,Dl(a,Pn,g),g!==v.cache&&yv(a,[Pn],d,!0))),Xn(i,a,a.pendingProps.children,d),a.child;case 30:return a.stateNode===null&&(a.stateNode={autoName:null,paired:null,clones:null,ref:null}),g=a.pendingProps,g.name!=null&&g.name!=="auto"?a.flags|=i===null?18882560:18874368:vt&&ug(a),i!==null&&i.memoizedProps.name!==g.name?a.flags|=4194816:Yu(i,a),Xn(i,a,g.children,d),a.child;case 29:throw a.pendingProps}throw Error(r(156,a.tag))}function Mi(i){i.flags|=4}function sS(i,a,d,g,v){var w;if((w=(i.mode&32)!==0)&&(w=d===null?Sk(a,g):Sk(a,g)&&(g.src!==d.src||g.srcSet!==d.srcSet)),w){if(i.flags|=16777216,(v&335544128)===v)if(i.stateNode.complete)i.flags|=8192;else if(OA())i.flags|=8192;else throw yc=yg,Sv}else i.flags&=-16777217}function KR(i,a){if(a.type!=="stylesheet"||(a.state.loading&4)!==0)i.flags&=-16777217;else if(i.flags|=16777216,!wk(a))if(OA())i.flags|=8192;else throw yc=yg,Sv}function jg(i,a){a!==null&&(i.flags|=4),i.flags&16384&&(a=i.tag!==22?hr():536870912,i.lanes|=a,Ju|=a)}function fh(i,a){if(!vt)switch(i.tailMode){case"visible":break;case"collapsed":for(var d=i.tail,g=null;d!==null;)d.alternate!==null&&(g=d),d=d.sibling;g===null?a||i.tail===null?i.tail=null:i.tail.sibling=null:g.sibling=null;break;default:for(a=i.tail,d=null;a!==null;)a.alternate!==null&&(d=a),a=a.sibling;d===null?i.tail=null:d.sibling=null}}function sn(i){var a=i.alternate!==null&&i.alternate.child===i.child,d=0,g=0;if(a)for(var v=i.child;v!==null;)d|=v.lanes|v.childLanes,g|=v.subtreeFlags&1206910976,g|=v.flags&1206910976,v.return=i,v=v.sibling;else for(v=i.child;v!==null;)d|=v.lanes|v.childLanes,g|=v.subtreeFlags,g|=v.flags,v.return=i,v=v.sibling;return i.subtreeFlags|=g,i.childLanes=d,a}function u9(i,a,d){var g=a.pendingProps;switch(hv(a),a.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return sn(a),null;case 1:return sn(a),null;case 3:return d=a.stateNode,g=null,i!==null&&(g=i.memoizedState.cache),a.memoizedState.cache!==g&&(a.flags|=2048),Ri(Pn),Ee(),d.pendingContext&&(d.context=d.pendingContext,d.pendingContext=null),(i===null||i.child===null)&&(Fu(a)?Mi(a):i===null||i.memoizedState.isDehydrated&&(a.flags&256)===0||(a.flags|=1024,mv())),sn(a),null;case 26:var v=a.type,w=a.memoizedState;return i===null?(Mi(a),w!==null?(sn(a),KR(a,w)):(sn(a),sS(a,v,null,g,d))):w?w!==i.memoizedState?(Mi(a),sn(a),KR(a,w)):(sn(a),a.flags&=-16777217):(i=i.memoizedProps,i!==g&&Mi(a),sn(a),sS(a,v,i,g,d)),null;case 27:if(Oe(a),d=Pe.current,v=a.type,i!==null&&a.stateNode!=null)i.memoizedProps!==g&&Mi(a);else{if(!g){if(a.stateNode===null)throw Error(r(166));return sn(a),a.subtreeFlags&=-33554433,null}i=Me.current,Fu(a)?TO(a):(i=hk(v,g,d),a.stateNode=i,Mi(a))}return sn(a),a.subtreeFlags&=-33554433,null;case 5:if(Oe(a),v=a.type,i!==null&&a.stateNode!=null)i.memoizedProps!==g&&Mi(a);else{if(!g){if(a.stateNode===null)throw Error(r(166));return sn(a),a.subtreeFlags&=-33554433,null}if(w=Me.current,Fu(a))TO(a);else{var _=Eh(Pe.current);switch(w){case 1:w=_.createElementNS("http://www.w3.org/2000/svg",v);break;case 2:w=_.createElementNS("http://www.w3.org/1998/Math/MathML",v);break;default:switch(v){case"svg":w=_.createElementNS("http://www.w3.org/2000/svg",v);break;case"math":w=_.createElementNS("http://www.w3.org/1998/Math/MathML",v);break;case"script":w=_.createElement("div"),w.innerHTML="<script><\/script>",w=w.removeChild(w.firstChild);break;case"select":w=typeof g.is=="string"?_.createElement("select",{is:g.is}):_.createElement("select"),g.multiple?w.multiple=!0:g.size&&(w.size=g.size);break;default:w=typeof g.is=="string"?_.createElement(v,{is:g.is}):_.createElement(v)}}w[on]=a,w[Yn]=g;e:for(_=a.child;_!==null;){if(_.tag===5||_.tag===6)w.appendChild(_.stateNode);else if(_.tag!==4&&_.tag!==27&&_.child!==null){_.child.return=_,_=_.child;continue}if(_===a)break e;for(;_.sibling===null;){if(_.return===null||_.return===a)break e;_=_.return}_.sibling.return=_.return,_=_.sibling}a.stateNode=w;e:switch(vr(w,v,g),v){case"button":case"input":case"select":case"textarea":g=!!g.autoFocus;break e;case"img":g=!0;break e;default:g=!1}g&&Mi(a)}}return sn(a),a.subtreeFlags&=-33554433,sS(a,a.type,i===null?null:i.memoizedProps,a.pendingProps,d),null;case 6:if(i&&a.stateNode!=null)i.memoizedProps!==g&&Mi(a);else{if(typeof g!="string"&&a.stateNode===null)throw Error(r(166));if(i=Pe.current,Fu(a)){if(i=a.stateNode,d=a.memoizedProps,g=null,v=tr,v!==null)switch(v.tag){case 27:case 5:g=v.memoizedProps}i[on]=a,i=!!(i.nodeValue===d||g!==null&&g.suppressHydrationWarning===!0||GA(i.nodeValue,d)),i||Ll(a,!0)}else i=Eh(i).createTextNode(g),i[on]=a,a.stateNode=i}return sn(a),null;case 31:if(d=a.memoizedState,i===null||i.memoizedState!==null){if(g=Fu(a),d!==null){if(i===null){if(!g)throw Error(r(318));if(i=a.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(r(557));i[on]=a}else uc(),(a.flags&128)===0&&(a.memoizedState=null),a.flags|=4;sn(a),i=!1}else d=mv(),i!==null&&i.memoizedState!==null&&(i.memoizedState.hydrationErrors=d),i=!0;if(!i)return a.flags&256?(Ms(a),a):(Ms(a),null);if((a.flags&128)!==0)throw Error(r(558))}return sn(a),null;case 13:if(g=a.memoizedState,i===null||i.memoizedState!==null&&i.memoizedState.dehydrated!==null){if(v=Fu(a),g!==null&&g.dehydrated!==null){if(i===null){if(!v)throw Error(r(318));if(v=a.memoizedState,v=v!==null?v.dehydrated:null,!v)throw Error(r(317));v[on]=a}else uc(),(a.flags&128)===0&&(a.memoizedState=null),a.flags|=4;sn(a),v=!1}else v=mv(),i!==null&&i.memoizedState!==null&&(i.memoizedState.hydrationErrors=v),v=!0;if(!v)return a.flags&256?(Ms(a),a):(Ms(a),null)}return Ms(a),(a.flags&128)!==0?(a.lanes=d,a):(d=g!==null,i=i!==null&&i.memoizedState!==null,d&&(g=a.child,v=null,g.alternate!==null&&g.alternate.memoizedState!==null&&g.alternate.memoizedState.cachePool!==null&&(v=g.alternate.memoizedState.cachePool.pool),w=null,g.memoizedState!==null&&g.memoizedState.cachePool!==null&&(w=g.memoizedState.cachePool.pool),w!==v&&(g.flags|=2048)),d!==i&&d&&(a.child.flags|=8192),jg(a,a.updateQueue),sn(a),null);case 4:return Ee(),i===null&&BS(a.stateNode.containerInfo),a.flags|=67108864,sn(a),null;case 10:return Ri(a.type),sn(a),null;case 19:if(Av(a),g=a.memoizedState,g===null)return sn(a),null;if(v=(a.flags&128)!==0,w=g.rendering,w===null)if(v)fh(g,!1);else{if(Nn!==0||i!==null&&(i.flags&128)!==0)for(i=a.child;i!==null;){if(w=Sg(i),w!==null){for(a.flags|=128,fh(g,!1),i=w.updateQueue,a.updateQueue=i,jg(a,i),a.subtreeFlags=0,i=d,d=a.child;d!==null;)vO(d,i),d=d.sibling;return lh(a,xr.current&1|2),vt&&Ni(a,g.treeForkCount),a.child}i=i.sibling}g.tail!==null&&cn()>Yg&&(a.flags|=128,v=!0,fh(g,!1),a.lanes=4194304)}else{if(!v)if(i=Sg(w),i!==null){if(a.flags|=128,v=!0,i=i.updateQueue,a.updateQueue=i,jg(a,i),fh(g,!0),g.tail===null&&g.tailMode!=="collapsed"&&g.tailMode!=="visible"&&!w.alternate&&!vt)return sn(a),null}else 2*cn()-g.renderingStartTime>Yg&&d!==536870912&&(a.flags|=128,v=!0,fh(g,!1),a.lanes=4194304);g.isBackwards?(w.sibling=a.child,a.child=w):(i=g.last,i!==null?i.sibling=w:a.child=w,g.last=w)}if(g.tail!==null){i=g.tail;e:{for(d=i;d!==null;){if(d.alternate!==null){d=!1;break e}d=d.sibling}d=!0}return g.rendering=i,g.tail=i.sibling,g.renderingStartTime=cn(),i.sibling=null,w=xr.current,w=v?w&1|2:w&1,g.tailMode==="visible"||g.tailMode==="collapsed"||!d||vt?lh(a,w):(d=w,_e(yr,a),_e(xr,d),Mr===null&&(Mr=a)),vt&&Ni(a,g.treeForkCount),i}return sn(a),null;case 22:case 23:return Ms(a),Ov(),g=a.memoizedState!==null,i!==null?i.memoizedState!==null!==g&&(a.flags|=8192):g&&(a.flags|=8192),g?(d&536870912)!==0&&(a.flags&128)===0&&(sn(a),a.subtreeFlags&6&&(a.flags|=8192)):sn(a),d=a.updateQueue,d!==null&&jg(a,d.retryQueue),d=null,i!==null&&i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(d=i.memoizedState.cachePool.pool),g=null,a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(g=a.memoizedState.cachePool.pool),g!==d&&(a.flags|=2048),i!==null&&be(mc),null;case 24:return d=null,i!==null&&(d=i.memoizedState.cache),a.memoizedState.cache!==d&&(a.flags|=2048),Ri(Pn),sn(a),null;case 25:return null;case 30:return a.flags|=33554432,sn(a),null}throw Error(r(156,a.tag))}function d9(i,a){switch(hv(a),a.tag){case 1:return i=a.flags,i&65536?(a.flags=i&-65537|128,a):null;case 3:return Ri(Pn),Ee(),i=a.flags,(i&65536)!==0&&(i&128)===0?(a.flags=i&-65537|128,a):null;case 26:case 27:case 5:return Oe(a),null;case 31:if(a.memoizedState!==null){if(Ms(a),a.alternate===null)throw Error(r(340));uc()}return i=a.flags,i&65536?(a.flags=i&-65537|128,a):null;case 13:if(Ms(a),i=a.memoizedState,i!==null&&i.dehydrated!==null){if(a.alternate===null)throw Error(r(340));uc()}return i=a.flags,i&65536?(a.flags=i&-65537|128,a):null;case 19:return Av(a),i=a.flags,i&65536?(a.flags=i&-65537|128,i=a.memoizedState,i!==null&&(i.rendering=null,i.tail=null),a.flags|=4,a):null;case 4:return Ee(),null;case 10:return Ri(a.type),null;case 22:case 23:return Ms(a),Ov(),i!==null&&be(mc),i=a.flags,i&65536?(a.flags=i&-65537|128,a):null;case 24:return Ri(Pn),null;case 25:return null;default:return null}}function YR(i,a){switch(hv(a),a.tag){case 3:Ri(Pn),Ee();break;case 26:case 27:case 5:Oe(a);break;case 4:Ee();break;case 31:a.memoizedState!==null&&Ms(a);break;case 13:Ms(a);break;case 19:Av(a);break;case 10:Ri(a.type);break;case 22:case 23:Ms(a),Ov(),i!==null&&be(mc);break;case 24:Ri(Pn)}}function hh(i,a){try{var d=a.updateQueue,g=d!==null?d.lastEffect:null;if(g!==null){var v=g.next;d=v;do{if((d.tag&i)===i){g=void 0;var w=d.create,_=d.inst;g=w(),_.destroy=g}d=d.next}while(d!==v)}}catch(U){qt(a,a.return,U)}}function Ul(i,a,d){try{var g=a.updateQueue,v=g!==null?g.lastEffect:null;if(v!==null){var w=v.next;g=w;do{if((g.tag&i)===i){var _=g.inst,U=_.destroy;if(U!==void 0){_.destroy=void 0,v=a;var Q=d,ae=U;try{ae()}catch(ge){qt(v,Q,ge)}}}g=g.next}while(g!==w)}}catch(ge){qt(a,a.return,ge)}}function WR(i){var a=i.updateQueue;if(a!==null){var d=i.stateNode;try{zO(a,d)}catch(g){qt(i,i.return,g)}}}function XR(i,a,d){d.props=vc(i.type,i.memoizedProps),d.state=i.memoizedState;try{d.componentWillUnmount()}catch(g){qt(i,a,g)}}function Bo(i,a){try{var d=i.ref;if(d!==null){switch(i.tag){case 26:case 27:case 5:var g=i.stateNode;break;case 30:var v=i.stateNode,w=Ei(i.memoizedProps,v);(v.ref===null||v.ref.name!==w)&&(v.ref=rk(w)),g=v.ref;break;case 7:if(i.stateNode===null){var _=new Ps(i);p(i.child,!1,tV,_,void 0,void 0),i.stateNode=_}g=i.stateNode;break;default:g=i.stateNode}typeof d=="function"?i.refCleanup=d(g):d.current=g}}catch(U){qt(i,a,U)}}function br(i,a){var d=i.ref,g=i.refCleanup;if(d!==null)if(typeof g=="function")try{g()}catch(v){qt(i,a,v)}finally{i.refCleanup=null,i=i.alternate,i!=null&&(i.refCleanup=null)}else if(typeof d=="function")try{d(null)}catch(v){qt(i,a,v)}else d.current=null}function Pg(i,a){if((i.tag===5||i.tag===27||i.tag===6)&&i.alternate===null&&a!==null)for(var d=0;d<a.length;d++)ck(i.stateNode,a[d])}function QR(i){for(var a=i.return;a!==null&&(iS(a)&&ck(i.stateNode,a.stateNode),!oS(a));)a=a.return}function ph(i){for(var a=i.return;a!==null&&(iS(a)&&nV(i.stateNode,a.stateNode),!oS(a));)a=a.return}function oS(i){return i.tag===5||i.tag===3||i.tag===27}function iS(i){return i&&i.tag===7&&i.stateNode!==null}function lS(i){var a=i.type,d=i.memoizedProps,g=i.stateNode;try{e:switch(a){case"button":case"input":case"select":case"textarea":d.autoFocus&&g.focus();break e;case"img":d.src?g.src=d.src:d.srcSet&&(g.srcset=d.srcSet)}}catch(v){qt(i,i.return,v)}}function aS(i,a,d){try{var g=i.stateNode;P9(g,i.type,d,a),g[Yn]=a}catch(v){qt(i,i.return,v)}}function ZR(i){return i.tag===5||i.tag===3||i.tag===26||i.tag===27&&Xl(i.type)||i.tag===4}function cS(i){e:for(;;){for(;i.sibling===null;){if(i.return===null||ZR(i.return))return null;i=i.return}for(i.sibling.return=i.return,i=i.sibling;i.tag!==5&&i.tag!==6&&i.tag!==18;){if(i.tag===27&&Xl(i.type)||i.flags&2||i.child===null||i.tag===4)continue e;i.child.return=i,i=i.child}if(!(i.flags&2))return i.stateNode}}function uS(i,a,d,g){var v=i.tag;if(v===5||v===6)v=i.stateNode,a?(d.nodeType===9?d.body:d.nodeName==="HTML"?d.ownerDocument.body:d).insertBefore(v,a):(a=d.nodeType===9?d.body:d.nodeName==="HTML"?d.ownerDocument.body:d,a.appendChild(v),d=d._reactRootContainer,d!=null||a.onclick!==null||(a.onclick=Gr)),Pg(i,g),rt=!0;else if(v!==4&&(v===27&&(Pg(i,g),g=null,Xl(i.type)&&(d=i.stateNode,a=null)),i=i.child,i!==null))for(uS(i,a,d,g),i=i.sibling;i!==null;)uS(i,a,d,g),i=i.sibling}function zg(i,a,d,g){var v=i.tag;if(v===5||v===6)v=i.stateNode,a?d.insertBefore(v,a):d.appendChild(v),Pg(i,g),rt=!0;else if(v!==4&&(v===27&&(Pg(i,g),g=null,Xl(i.type)&&(d=i.stateNode)),i=i.child,i!==null))for(zg(i,a,d,g),i=i.sibling;i!==null;)zg(i,a,d,g),i=i.sibling}function JR(i){var a=i.stateNode,d=i.memoizedProps;try{for(var g=i.type,v=a.attributes;v.length;)a.removeAttributeNode(v[0]);vr(a,g,d),a[on]=i,a[Yn]=d}catch(w){qt(i,i.return,w)}}var Bg=!1,Is=null;function eA(i){(i.tag===30||(i.subtreeFlags&33554432)!==0)&&(Bg=!0)}var Ho=null;function tA(){var i=Ho;return Ho=null,i}var ps=0;function Wu(i,a,d,g,v){return ps=0,nA(i.child,a,d,g,v)}function nA(i,a,d,g,v){for(var w=!1;i!==null;){if(i.tag===5){var _=i.stateNode;if(g!==null){var U=KS(_);g.push(U),U.view&&(w=!0)}else w||KS(_).view&&(w=!0);Bg=!0,tk(_,ps===0?a:a+"_"+ps,d),ps++}else(i.tag!==22||i.memoizedState===null)&&(i.tag===30&&v||nA(i.child,a,d,g,v)&&(w=!0));i=i.sibling}return w}function Fo(i,a){for(;i!==null;)i.tag===5?nk(i.stateNode,i.memoizedProps):(i.tag!==22||i.memoizedState===null)&&(i.tag===30&&a||Fo(i.child,a)),i=i.sibling}function Hg(i){if((i.subtreeFlags&18874368)!==0)for(i=i.child;i!==null;){if((i.tag!==22||i.memoizedState===null)&&(Hg(i),i.tag===30&&(i.flags&18874368)!==0&&i.stateNode.paired)){var a=i.memoizedProps;if(a.name==null||a.name==="auto")throw Error(r(544));var d=a.name;a=Ci(a.default,a.share),a!=="none"&&(Wu(i,d,a,null,!1)||Fo(i.child,!1))}i=i.sibling}}function dS(i,a){if(i.tag===30){var d=i.stateNode,g=i.memoizedProps,v=Ei(g,d),w=Ci(g.default,d.paired?g.share:g.enter);w!=="none"?Wu(i,v,w,null,!1)?(Hg(i),d.paired||a||rd(i,g.onEnter)):Fo(i.child,!1):Hg(i)}else if((i.subtreeFlags&33554432)!==0)for(i=i.child;i!==null;)dS(i,a),i=i.sibling;else Hg(i)}function fS(i){if(Is!==null&&Is.size!==0){var a=Is;if((i.subtreeFlags&18874368)!==0)for(i=i.child;i!==null;){if(i.tag!==22||i.memoizedState===null){if(i.tag===30&&(i.flags&18874368)!==0){var d=i.memoizedProps,g=d.name;if(g!=null&&g!=="auto"){var v=a.get(g);if(v!==void 0){var w=Ci(d.default,d.share);if(w!=="none"&&(Wu(i,g,w,null,!1)?(w=i.stateNode,v.paired=w,w.paired=v,rd(i,d.onShare)):Fo(i.child,!1)),a.delete(g),a.size===0)break}}}fS(i)}i=i.sibling}}}function hS(i){if(i.tag===30){var a=i.memoizedProps,d=Ei(a,i.stateNode),g=Is!==null?Is.get(d):void 0,v=Ci(a.default,g!==void 0?a.share:a.exit);v!=="none"&&(Wu(i,d,v,null,!1)?g!==void 0?(v=i.stateNode,g.paired=v,v.paired=g,Is.delete(d),rd(i,a.onShare)):rd(i,a.onExit):Fo(i.child,!1)),Is!==null&&fS(i)}else if((i.subtreeFlags&33554432)!==0)for(i=i.child;i!==null;)hS(i),i=i.sibling;else Is!==null&&fS(i)}function rA(i){for(i=i.child;i!==null;){if(i.tag===30){var a=i.memoizedProps,d=Ei(a,i.stateNode);a=Ci(a.default,a.update),i.flags&=-5,a!=="none"&&Wu(i,d,a,i.memoizedState=[],!1)}else(i.subtreeFlags&33554432)!==0&&rA(i);i=i.sibling}}function pS(i){if((i.subtreeFlags&18874368)!==0)for(i=i.child;i!==null;){if(i.tag!==22||i.memoizedState===null){if(i.tag===30&&(i.flags&18874368)!==0){var a=i.stateNode;a.paired!==null&&(a.paired=null,Fo(i.child,!1))}pS(i)}i=i.sibling}}function Fg(i){if(i.tag===30)i.stateNode.paired=null,Fo(i.child,!1),pS(i);else if((i.subtreeFlags&33554432)!==0)for(i=i.child;i!==null;)Fg(i),i=i.sibling;else pS(i)}function sA(i){for(i=i.child;i!==null;)i.tag===30?Fo(i.child,!1):(i.subtreeFlags&33554432)!==0&&sA(i),i=i.sibling}function mS(i,a,d,g,v,w,_){for(var U=!1;a!==null;){if(a.tag===5){var Q=a.stateNode;if(w!==null&&ps<w.length){var ae=w[ps],ge=KS(Q);(ae.view||ge.view)&&(U=!0);var Ce;if(Ce=(i.flags&4)===0)if(ge.clip)Ce=!0;else{Ce=ae.rect;var se=ge.rect;Ce=Ce.y!==se.y||Ce.x!==se.x||Ce.height!==se.height||Ce.width!==se.width}Ce&&(i.flags|=4),ge.abs?ge=!ae.abs:(ae=ae.rect,ge=ge.rect,ge=ae.height!==ge.height||ae.width!==ge.width),ge&&(i.flags|=32)}else i.flags|=32;(i.flags&4)!==0&&tk(Q,ps===0?d:d+"_"+ps,v),U&&(i.flags&4)!==0||(Ho===null&&(Ho=[]),Ho.push(Q,ps===0?g:g+"_"+ps,a.memoizedProps)),ps++}else(a.tag!==22||a.memoizedState===null)&&(a.tag===30&&_?i.flags|=a.flags&32:mS(i,a.child,d,g,v,w,_)&&(U=!0));a=a.sibling}return U}function oA(i,a){for(i=i.child;i!==null;){if(i.tag===30){var d=i.memoizedProps,g=i.stateNode,v=Ei(d,g),w=Ci(d.default,d.update),_;_=i.memoizedState,i.memoizedState=null,g=i;var U=i.child;ps=0,v=mS(g,U,v,v,w,_,!1),(i.flags&4)!==0&&v&&rd(i,d.onUpdate)}else(i.subtreeFlags&33554432)!==0&&oA(i);i=i.sibling}}var nr=!1,$t=!1,$o=!1,gS=!1,iA=typeof WeakSet=="function"?WeakSet:Set,rr=null,Uo=!1,mh=!1,$g=!1,yS=!1;function f9(i,a,d){if(i=i.containerInfo,$S=hd,i=uO(i),rv(i)){if("selectionStart"in i)var g={start:i.selectionStart,end:i.selectionEnd};else e:{g=(g=i.ownerDocument)&&g.defaultView||window;var v=g.getSelection&&g.getSelection();if(v&&v.rangeCount!==0){g=v.anchorNode;var w=v.anchorOffset,_=v.focusNode;v=v.focusOffset;try{g.nodeType,_.nodeType}catch{g=null;break e}var U=0,Q=-1,ae=-1,ge=0,Ce=0,se=i,de=null;t:for(;;){for(var ze;se!==g||w!==0&&se.nodeType!==3||(Q=U+w),se!==_||v!==0&&se.nodeType!==3||(ae=U+v),se.nodeType===3&&(U+=se.nodeValue.length),(ze=se.firstChild)!==null;)de=se,se=ze;for(;;){if(se===i)break t;if(de===g&&++ge===w&&(Q=U),de===_&&++Ce===v&&(ae=U),(ze=se.nextSibling)!==null)break;se=de,de=se.parentNode}se=ze}g=Q===-1||ae===-1?null:{start:Q,end:ae}}else g=null}g=g||{start:0,end:0}}else g=null;for(US={focusedElem:i,selectionRange:g},hd=!1,d=(d&335544064)===d,rr=a,a=d?9270:1024;rr!==null;){if(i=rr,d&&(g=i.deletions,g!==null))for(w=0;w<g.length;w++)d&&hS(g[w]);if(i.alternate===null&&(i.flags&2)!==0)d&&eA(i),Ug(d);else{if(i.tag===22){if(g=i.alternate,i.memoizedState!==null){g!==null&&g.memoizedState===null&&d&&hS(g),Ug(d);continue}else if(g!==null&&g.memoizedState!==null){d&&eA(i),Ug(d);continue}}g=i.child,(i.subtreeFlags&a)!==0&&g!==null?(g.return=i,rr=g):(d&&rA(i),Ug(d))}}Is=null}function Ug(i){for(;rr!==null;){var a=rr,d=i,g=a.alternate,v=a.flags;switch(a.tag){case 0:case 11:case 15:break;case 1:if((v&1024)!==0&&g!==null){d=void 0,v=g.memoizedProps,g=g.memoizedState;var w=a.stateNode;try{var _=vc(a.type,v);d=w.getSnapshotBeforeUpdate(_,g),w.__reactInternalSnapshotBeforeUpdate=d}catch(U){qt(a,a.return,U)}}break;case 3:if((v&1024)!==0){if(g=a.stateNode.containerInfo,d=g.nodeType,d===9)XS(g);else if(d===1)switch(g.nodeName){case"HEAD":case"HTML":case"BODY":XS(g);break;default:g.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;case 30:d&&g!==null&&(d=Ei(g.memoizedProps,g.stateNode),v=a.memoizedProps,v=Ci(v.default,v.update),v!=="none"&&Wu(g,d,v,g.memoizedState=[],!0));break;default:if((v&1024)!==0)throw Error(r(163))}if(g=a.sibling,g!==null){g.return=a.return,rr=g;break}rr=a.return}}function lA(i,a,d){var g=d.flags;switch(d.tag){case 0:case 11:case 15:Vo(i,d),g&4&&hh(5,d);break;case 1:if(Vo(i,d),g&4)if(i=d.stateNode,a===null)try{i.componentDidMount()}catch(_){qt(d,d.return,_)}else{var v=vc(d.type,a.memoizedProps);a=a.memoizedState;try{i.componentDidUpdate(v,a,i.__reactInternalSnapshotBeforeUpdate)}catch(_){qt(d,d.return,_)}}g&64&&WR(d),g&512&&Bo(d,d.return);break;case 3:if(Vo(i,d),g&64&&(i=d.updateQueue,i!==null)){if(a=null,d.child!==null)switch(d.child.tag){case 27:case 5:a=d.child.stateNode;break;case 1:a=d.child.stateNode}try{zO(i,a)}catch(_){qt(d,d.return,_)}}break;case 27:a===null&&g&4&&JR(d);case 26:case 5:Vo(i,d),a===null&&g&4&&lS(d),g&512&&Bo(d,d.return);break;case 12:Vo(i,d);break;case 31:Vo(i,d),g&4&&dA(i,d);break;case 13:Vo(i,d),g&4&&fA(i,d),g&64&&(i=d.memoizedState,i!==null&&(i=i.dehydrated,i!==null&&(d=C9.bind(null,d),oV(i,d))));break;case 22:if(g=d.memoizedState!==null||nr,!g){var w=a!==null&&a.memoizedState!==null||$t;a=nr,v=$t,nr=g,($t=w)&&!v?(g=2,(d.subtreeFlags&8772)!==0&&(g|=1),yo(i,d,g)):Vo(i,d),nr=a,$t=v}break;case 30:Vo(i,d),g&512&&Bo(d,d.return);break;case 7:g&512&&Bo(d,d.return);default:Vo(i,d)}}function xS(i,a){for(i=i.child;i!==null;)aA(i,a),i=i.sibling}function aA(i,a){switch(i.tag){case 5:case 26:try{var d=i.stateNode;if(a){var g=d.style;typeof g.setProperty=="function"?g.setProperty("display","none","important"):g.display="none"}else{var v=i.stateNode,w=i.memoizedProps.style,_=w!=null&&w.hasOwnProperty("display")?w.display:null;v.style.display=_==null||typeof _=="boolean"?"":(""+_).trim()}}catch(Q){qt(i,i.return,Q)}bS(i,a);break;case 6:try{i.stateNode.nodeValue=a?"":i.memoizedProps,rt=!0}catch(Q){qt(i,i.return,Q)}break;case 18:try{var U=i.stateNode;a?ek(U,!0):ek(i.stateNode,!1)}catch(Q){qt(i,i.return,Q)}break;case 22:case 23:i.memoizedState===null&&xS(i,a);break;default:xS(i,a)}}function bS(i,a){if(i.subtreeFlags&67108864)for(i=i.child;i!==null;){e:{var d=i,g=a;switch(d.tag){case 4:aA(d,g);break e;case 22:d.memoizedState===null&&bS(d,g);break e;default:bS(d,g)}}i=i.sibling}}function cA(i){var a=i.alternate;a!==null&&(i.alternate=null,cA(a)),i.child=null,i.deletions=null,i.sibling=null,i.tag===5&&(a=i.stateNode,a!==null&&Ol(a)),i.stateNode=null,i.return=null,i.dependencies=null,i.memoizedProps=null,i.memoizedState=null,i.pendingProps=null,i.stateNode=null,i.updateQueue=null}var dn=null,ms=!1;function mo(i,a,d){for(d=d.child;d!==null;)uA(i,a,d),d=d.sibling}function uA(i,a,d){if(Ht&&typeof Ht.onCommitFiberUnmount=="function")try{Ht.onCommitFiberUnmount(An,d)}catch{}switch(d.tag){case 26:$t||br(d,a),mo(i,a,d),d.memoizedState?d.memoizedState.count--:d.stateNode&&!$t&&(d=d.stateNode,d.parentNode.removeChild(d));break;case 27:$t||br(d,a),ph(d);var g=dn,v=ms;Xl(d.type)&&(dn=d.stateNode,ms=!1),mo(i,a,d),pk(d.stateNode,d.type,d.memoizedProps),dn=g,ms=v;break;case 5:$t||br(d,a),ph(d);case 6:if(d.tag===6&&ph(d),g=dn,v=ms,dn=null,mo(i,a,d),dn=g,ms=v,dn!==null)if(ms)try{(dn.nodeType===9?dn.body:dn.nodeName==="HTML"?dn.ownerDocument.body:dn).removeChild(d.stateNode),rt=!0}catch(w){qt(d,a,w)}else try{dn.removeChild(d.stateNode),rt=!0}catch(w){qt(d,a,w)}break;case 18:dn!==null&&(ms?(i=dn,JA(i.nodeType===9?i.body:i.nodeName==="HTML"?i.ownerDocument.body:i,d.stateNode),pd(i)):JA(dn,d.stateNode));break;case 4:g=dn,v=ms,dn=d.stateNode.containerInfo,ms=!0,mo(i,a,d),dn=g,ms=v;break;case 0:case 11:case 14:case 15:Ul(2,d,a),$t||Ul(4,d,a),mo(i,a,d);break;case 1:$t||(br(d,a),g=d.stateNode,typeof g.componentWillUnmount=="function"&&XR(d,a,g)),mo(i,a,d);break;case 21:mo(i,a,d);break;case 22:$t=(g=$t)||d.memoizedState!==null,mo(i,a,d),$t=g;break;case 30:br(d,a),mo(i,a,d);break;case 7:$t||br(d,a),mo(i,a,d);break;default:mo(i,a,d)}}function dA(i,a){if(a.memoizedState===null&&(i=a.alternate,i!==null&&(i=i.memoizedState,i!==null))){i=i.dehydrated;try{pd(i)}catch(d){qt(a,a.return,d)}}}function fA(i,a){if(a.memoizedState===null&&(i=a.alternate,i!==null&&(i=i.memoizedState,i!==null&&(i=i.dehydrated,i!==null))))try{pd(i)}catch(d){qt(a,a.return,d)}}function h9(i){switch(i.tag){case 31:case 13:case 19:var a=i.stateNode;return a===null&&(a=i.stateNode=new iA),a;case 22:return i=i.stateNode,a=i._retryCache,a===null&&(a=i._retryCache=new iA),a;default:throw Error(r(435,i.tag))}}function Vg(i,a){var d=h9(i);a.forEach(function(g){if(!d.has(g)){d.add(g);var v=T9.bind(null,i,g);g.then(v,v)}})}function Wr(i,a,d){var g=a.deletions;if(g!==null)for(var v=0;v<g.length;v++){var w=g[v],_=i,U=a,Q=U;e:for(;Q!==null;){switch(Q.tag){case 27:if(Xl(Q.type)){dn=Q.stateNode,ms=!1;break e}break;case 5:dn=Q.stateNode,ms=!1;break e;case 3:case 4:dn=Q.stateNode.containerInfo,ms=!0;break e}Q=Q.return}if(dn===null)throw Error(r(160));uA(_,U,w),dn=null,ms=!1,_=w.alternate,_!==null&&(_.return=null),w.return=null}if(a.subtreeFlags&13886)for(a=a.child;a!==null;)hA(a,i,d),a=a.sibling}var go=null;function hA(i,a,d){var g=i.alternate,v=i.flags;switch(i.tag){case 0:case 11:case 14:case 15:if(v&4&&(g=i.updateQueue,g=g!==null?g.events:null,g!==null))for(var w=0;w<g.length;w++){var _=g[w];_.ref.impl=_.nextImpl}Wr(a,i,d),Xr(i),v&4&&(Ul(3,i,i.return),hh(3,i),Ul(5,i,i.return));break;case 1:Wr(a,i,d),Xr(i),v&512&&($t||g===null||br(g,g.return)),v&64&&nr&&(i=i.updateQueue,i!==null&&(a=i.callbacks,a!==null&&(d=i.shared.hiddenCallbacks,i.shared.hiddenCallbacks=d===null?a:d.concat(a))));break;case 26:if(w=go,Wr(a,i,d),Xr(i),v&512&&($t||g===null||br(g,g.return)),v&4)if(v=g!==null?g.memoizedState:null,d=i.memoizedState,g===null)if(d===null)if(i.stateNode===null)if(nr)i.stateNode=XA(i.type,i.memoizedProps,a.containerInfo,i);else{e:{a=i.type,d=i.memoizedProps,v=w.ownerDocument||w;t:switch(a){case"title":g=v.getElementsByTagName("title")[0],(!g||g[bi]||g[on]||g.namespaceURI==="http://www.w3.org/2000/svg"||g.hasAttribute("itemprop"))&&(g=v.createElement(a),v.head.insertBefore(g,v.querySelector("head > title"))),vr(g,a,d),g[on]=i,Re(g),a=g;break e;case"link":if(w=vk("link","href",v).get(a+(d.href||""))){for(_=0;_<w.length;_++)if(g=w[_],g.getAttribute("href")===(d.href==null||d.href===""?null:d.href)&&g.getAttribute("rel")===(d.rel==null?null:d.rel)&&g.getAttribute("title")===(d.title==null?null:d.title)&&g.getAttribute("crossorigin")===(d.crossOrigin==null?null:d.crossOrigin)){w.splice(_,1);break t}}g=v.createElement(a),vr(g,a,d),v.head.appendChild(g);break;case"meta":if(w=vk("meta","content",v).get(a+(d.content||""))){for(_=0;_<w.length;_++)if(g=w[_],g.getAttribute("content")===(d.content==null?null:""+d.content)&&g.getAttribute("name")===(d.name==null?null:d.name)&&g.getAttribute("property")===(d.property==null?null:d.property)&&g.getAttribute("http-equiv")===(d.httpEquiv==null?null:d.httpEquiv)&&g.getAttribute("charset")===(d.charSet==null?null:d.charSet)){w.splice(_,1);break t}}g=v.createElement(a),vr(g,a,d),v.head.appendChild(g);break;default:throw Error(r(468,a))}g[on]=i,Re(g),a=g}i.stateNode=a}else nr||r1(w,i.type,i.stateNode);else i.stateNode=bk(w,d,i.memoizedProps);else v!==d?(v===null?(a=g.stateNode,a===null||$t||a.parentNode.removeChild(a)):v.count--,d===null?nr||r1(w,i.type,i.stateNode):bk(w,d,i.memoizedProps)):d===null&&i.stateNode!==null&&aS(i,i.memoizedProps,g.memoizedProps);break;case 27:Wr(a,i,d),Xr(i),v&512&&($t||g===null||br(g,g.return)),g!==null&&v&4&&aS(i,i.memoizedProps,g.memoizedProps);break;case 5:if(w=$o,$o=!1,Wr(a,i,d),$o=w,Xr(i),v&512&&($t||g===null||br(g,g.return)),i.flags&32){a=i.stateNode;try{qr(a,""),rt=!0}catch(ge){qt(i,i.return,ge)}}v&4&&i.stateNode!=null&&(a=i.memoizedProps,aS(i,a,g!==null?g.memoizedProps:a)),v&1024&&(gS=!0);break;case 6:if(Wr(a,i,d),Xr(i),v&4){if(i.stateNode===null)throw Error(r(162));a=i.memoizedProps,d=i.stateNode;try{d.nodeValue=a,rt=!0}catch(ge){qt(i,i.return,ge)}}break;case 3:if(rt=!1,o0=null,w=go,go=Ch(a.containerInfo),Wr(a,i,d),go=w,Xr(i),v&4&&g!==null&&g.memoizedState.isDehydrated)try{pd(a.containerInfo)}catch(ge){qt(i,i.return,ge)}gS&&(gS=!1,pA(i)),rt=!1;break;case 4:v=$o,$o=nr,g=Wn(),w=go,go=Ch(i.stateNode.containerInfo),Wr(a,i,d),Xr(i),go=w,rt&&mh&&($g=!0),rt=g,$o=v;break;case 12:Wr(a,i,d),Xr(i);break;case 31:Wr(a,i,d),Xr(i),v&4&&(a=i.updateQueue,a!==null&&(i.updateQueue=null,Vg(i,a)));break;case 13:Wr(a,i,d),Xr(i),i.child.flags&8192&&i.memoizedState!==null!=(g!==null&&g.memoizedState!==null)&&(Kg=cn()),v&4&&(a=i.updateQueue,a!==null&&(i.updateQueue=null,Vg(i,a)));break;case 22:w=i.memoizedState!==null,_=g!==null&&g.memoizedState!==null;var U=nr,Q=$t,ae=$o;nr=U||w,$o=ae||w,$t=Q||_,Wr(a,i,d),$t=Q,$o=ae,nr=U,Xr(i),v&8192&&(a=i.stateNode,a._visibility=w?a._visibility&-2:a._visibility|1,!w||g===null||_||nr||$t||(a=_||$t,d=nr,g=$t,nr=w||nr,$t=a,Vl(i,2),nr=d,$t=g),!w&&$o||xS(i,w)),v&4&&(a=i.updateQueue,a!==null&&(d=a.retryQueue,d!==null&&(a.retryQueue=null,Vg(i,d))));break;case 19:Wr(a,i,d),Xr(i),v&4&&(a=i.updateQueue,a!==null&&(i.updateQueue=null,Vg(i,a)));break;case 30:v&512&&($t||g===null||br(g,g.return)),v=Wn(),w=mh,_=(d&335544064)===d,U=i.memoizedProps,mh=_&&Ci(U.default,U.update)!=="none",Wr(a,i,d),Xr(i),_&&g!==null&&rt&&(i.flags|=4),mh=w,rt=v;break;case 21:break;case 7:v&512&&($t||g===null||br(g,g.return)),g&&g.stateNode!==null&&(g.stateNode._fragmentFiber=i);default:Wr(a,i,d),Xr(i)}}function Xr(i){var a=i.flags;if(a&2){try{for(var d,g=i.return;g!==null;){if(ZR(g)){d=g;break}g=g.return}g=null;for(var v=i.return;v!==null;){if(iS(v)){var w=v.stateNode;g===null?g=[w]:g.push(w)}if(oS(v))break;v=v.return}var _=g;if(d==null)throw Error(r(160));switch(d.tag){case 27:var U=d.stateNode,Q=cS(i);zg(i,Q,U,_);break;case 5:var ae=d.stateNode;d.flags&32&&(qr(ae,""),d.flags&=-33);var ge=cS(i);zg(i,ge,ae,_);break;case 3:case 4:var Ce=d.stateNode.containerInfo,se=cS(i);uS(i,se,Ce,_);break;default:throw Error(r(161))}}catch(de){qt(i,i.return,de)}i.flags&=-3}a&4096&&(i.flags&=-4097)}function pA(i){if(i.subtreeFlags&1024)for(i=i.child;i!==null;){var a=i;pA(a),a.tag===5&&a.flags&1024&&(a=a.stateNode,hd=!0,a.reset(),hd=!1),i=i.sibling}}function Xu(i,a){if(a.subtreeFlags&9270)for(a=a.child;a!==null;)mA(a,i),a=a.sibling;else oA(a)}function mA(i,a){var d=i.alternate;if(d===null)dS(i,!1);else switch(i.tag){case 3:if(yS=Uo=!1,tA(),Xu(a,i),!Uo&&!$g){if(i=Ho,i!==null)for(var g=0;g<i.length;g+=3){d=i[g];var v=i[g+1];nk(d,i[g+2]),d=d.ownerDocument.documentElement,d!==null&&d.animate({opacity:[0,0],pointerEvents:["none","none"]},{duration:0,fill:"forwards",pseudoElement:"::view-transition-group("+v+")"})}i=a.containerInfo,i=i.nodeType===9?i.documentElement:i.ownerDocument.documentElement,i!==null&&i.style.viewTransitionName===""&&(i.style.viewTransitionName="none",i.animate({opacity:[0,0],pointerEvents:["none","none"]},{duration:0,fill:"forwards",pseudoElement:"::view-transition-group(root)"}),i.animate({width:[0,0],height:[0,0]},{duration:0,fill:"forwards",pseudoElement:"::view-transition"})),yS=!0}Ho=null;break;case 5:Xu(a,i);break;case 4:g=Uo,Uo=!1,Xu(a,i),Uo&&($g=!0),Uo=g;break;case 22:i.memoizedState===null&&(d.memoizedState!==null?dS(i,!1):Xu(a,i));break;case 30:g=Uo,v=tA(),Uo=!1,Xu(a,i),Uo&&(i.flags|=4);var w=i.memoizedProps,_=i.stateNode;a=Ei(w,_),_=Ei(d.memoizedProps,_);var U=Ci(w.default,w.update);U==="none"?a=!1:(w=d.memoizedState,d.memoizedState=null,d=i.child,ps=0,a=mS(i,d,a,_,U,w,!0),ps!==(w===null?0:w.length)&&(i.flags|=32)),(i.flags&4)!==0&&a?(rd(i,i.memoizedProps.onUpdate),Ho=v):v!==null&&(v.push.apply(v,Ho),Ho=v),Uo=(i.flags&32)!==0?!0:g;break;default:Xu(a,i)}}function Vo(i,a){if(a.subtreeFlags&8772)for(a=a.child;a!==null;)lA(i,a.alternate,a),a=a.sibling}function Vl(i,a){for(i=i.child;i!==null;){var d=i,g=a;switch(d.tag){case 0:case 11:case 14:case 15:Ul(4,d,d.return),Vl(d,g);break;case 1:br(d,d.return);var v=d.stateNode;typeof v.componentWillUnmount=="function"&&XR(d,d.return,v),Vl(d,g);break;case 27:(g&2)!==0&&pk(d.stateNode,d.type,d.memoizedProps);case 5:br(d,d.return),d.tag!==5&&d.tag!==27||ph(d),Vl(d,g);break;case 6:ph(d);break;case 26:br(d,d.return),v=d.stateNode,d.memoizedState!==null||v===null||$t||v.parentNode.removeChild(v),Vl(d,g);break;case 22:d.memoizedState===null&&Vl(d,g);break;case 30:br(d,d.return),Vl(d,g);break;case 7:br(d,d.return);default:Vl(d,g)}i=i.sibling}}function yo(i,a,d){for(d=(a.subtreeFlags&8772)!==0?d:d&-2,a=a.child;a!==null;){var g=a.alternate,v=i,w=a,_=w.flags,U=(d&1)!==0;switch(w.tag){case 0:case 11:case 15:yo(v,w,d),hh(4,w);break;case 1:if(yo(v,w,d),g=w,v=g.stateNode,typeof v.componentDidMount=="function")try{v.componentDidMount()}catch(ge){qt(g,g.return,ge)}if(g=w,v=g.updateQueue,v!==null){var Q=g.stateNode;try{var ae=v.shared.hiddenCallbacks;if(ae!==null)for(v.shared.hiddenCallbacks=null,v=0;v<ae.length;v++)PO(ae[v],Q)}catch(ge){qt(g,g.return,ge)}}U&&_&64&&WR(w),Bo(w,w.return);break;case 27:(d&2)!==0&&JR(w);case 5:w.tag!==5&&w.tag!==27||QR(w),yo(v,w,d),U&&g===null&&_&4&&lS(w),Bo(w,w.return);break;case 6:QR(w);break;case 26:Q=w.stateNode,w.memoizedState!==null||Q===null||nr||r1(Ch(Q.ownerDocument),w.type,Q),yo(v,w,d),U&&g===null&&_&4&&lS(w),Bo(w,w.return);break;case 12:yo(v,w,d);break;case 31:yo(v,w,d),U&&_&4&&dA(v,w);break;case 13:yo(v,w,d),U&&_&4&&fA(v,w);break;case 22:w.memoizedState===null&&yo(v,w,d),Bo(w,w.return);break;case 30:yo(v,w,d),Bo(w,w.return);break;case 7:Bo(w,w.return);default:yo(v,w,d)}a=a.sibling}}function vS(i,a){var d=null;i!==null&&i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(d=i.memoizedState.cachePool.pool),i=null,a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(i=a.memoizedState.cachePool.pool),i!==d&&(i!=null&&i.refCount++,d!=null&&eh(d))}function SS(i,a){i=null,a.alternate!==null&&(i=a.alternate.memoizedState.cache),a=a.memoizedState.cache,a!==i&&(a.refCount++,i!=null&&eh(i))}function Js(i,a,d,g){var v=(d&335544064)===d;if(a.subtreeFlags&(v?10262:10256))for(a=a.child;a!==null;)gA(i,a,d,g),a=a.sibling;else v&&sA(a)}function gA(i,a,d,g){var v=(d&335544064)===d;v&&a.alternate===null&&a.return!==null&&a.return.alternate!==null&&Fg(a);var w=a.flags;switch(a.tag){case 0:case 11:case 15:Js(i,a,d,g),w&2048&&hh(9,a);break;case 1:Js(i,a,d,g);break;case 3:Js(i,a,d,g),v&&yS&&(i=i.containerInfo,i=i.nodeType===9?i.body:i.nodeName==="HTML"?i.ownerDocument.body:i,i.style.viewTransitionName==="root"&&(i.style.viewTransitionName=""),i=i.ownerDocument.documentElement,i!==null&&i.style.viewTransitionName==="none"&&(i.style.viewTransitionName="")),w&2048&&(w=null,a.alternate!==null&&(w=a.alternate.memoizedState.cache),a=a.memoizedState.cache,a!==w&&(a.refCount++,w!=null&&eh(w)));break;case 12:if(w&2048){Js(i,a,d,g),w=a.stateNode;try{var _=a.memoizedProps,U=_.id,Q=_.onPostCommit;typeof Q=="function"&&Q(U,a.alternate===null?"mount":"update",w.passiveEffectDuration,-0)}catch(ae){qt(a,a.return,ae)}}else Js(i,a,d,g);break;case 31:Js(i,a,d,g);break;case 13:Js(i,a,d,g);break;case 23:break;case 22:_=a.stateNode,U=a.alternate,a.memoizedState!==null?(v&&U!==null&&U.memoizedState===null&&Fg(U),_._visibility&2?Js(i,a,d,g):gh(i,a)):(v&&U!==null&&U.memoizedState!==null&&Fg(a),_._visibility&2?Js(i,a,d,g):(_._visibility|=2,Qu(i,a,d,g,(a.subtreeFlags&10256)!==0||!1))),w&2048&&vS(U,a);break;case 24:Js(i,a,d,g),w&2048&&SS(a.alternate,a);break;case 30:v&&(w=a.alternate,w!==null&&(Fo(w.child,!0),Fo(a.child,!0))),Js(i,a,d,g);break;default:Js(i,a,d,g)}}function Qu(i,a,d,g,v){for(v=v&&((a.subtreeFlags&10256)!==0||!1),a=a.child;a!==null;){var w=i,_=a,U=d,Q=g,ae=_.flags;switch(_.tag){case 0:case 11:case 15:Qu(w,_,U,Q,v),hh(8,_);break;case 23:break;case 22:var ge=_.stateNode;_.memoizedState!==null?ge._visibility&2?Qu(w,_,U,Q,v):gh(w,_):(ge._visibility|=2,Qu(w,_,U,Q,v)),v&&ae&2048&&vS(_.alternate,_);break;case 24:Qu(w,_,U,Q,v),v&&ae&2048&&SS(_.alternate,_);break;default:Qu(w,_,U,Q,v)}a=a.sibling}}function gh(i,a){if(a.subtreeFlags&10256)for(a=a.child;a!==null;){var d=i,g=a,v=g.flags;switch(g.tag){case 22:gh(d,g),v&2048&&vS(g.alternate,g);break;case 24:gh(d,g),v&2048&&SS(g.alternate,g);break;default:gh(d,g)}a=a.sibling}}var Sc=8192;function wc(i,a,d){if(i.subtreeFlags&Sc)for(i=i.child;i!==null;)yA(i,a,d),i=i.sibling}function yA(i,a,d){switch(i.tag){case 26:wc(i,a,d),i.flags&Sc&&(i.memoizedState!==null?bV(d,go,i.memoizedState,i.memoizedProps):(i=i.stateNode,(a&335544128)===a&&Ck(d,i)));break;case 5:wc(i,a,d),i.flags&Sc&&(i=i.stateNode,(a&335544128)===a&&Ck(d,i));break;case 3:case 4:var g=go;go=Ch(i.stateNode.containerInfo),wc(i,a,d),go=g;break;case 22:i.memoizedState===null&&(g=i.alternate,g!==null&&g.memoizedState!==null?(g=Sc,Sc=16777216,wc(i,a,d),Sc=g):wc(i,a,d));break;case 30:if((i.flags&Sc)!==0&&(g=i.memoizedProps.name,g!=null&&g!=="auto")){var v=i.stateNode;v.paired=null,Is===null&&(Is=new Map),Is.set(g,v)}wc(i,a,d);break;default:wc(i,a,d)}}function xA(i){var a=i.alternate;if(a!==null&&(i=a.child,i!==null)){a.child=null;do a=i.sibling,i.sibling=null,i=a;while(i!==null)}}function yh(i){var a=i.deletions;if((i.flags&16)!==0){if(a!==null)for(var d=0;d<a.length;d++){var g=a[d];rr=g,vA(g,i)}xA(i)}if(i.subtreeFlags&10256)for(i=i.child;i!==null;)bA(i),i=i.sibling}function bA(i){switch(i.tag){case 0:case 11:case 15:yh(i),i.flags&2048&&Ul(9,i,i.return);break;case 3:yh(i);break;case 12:yh(i);break;case 22:var a=i.stateNode;i.memoizedState!==null&&a._visibility&2&&(i.return===null||i.return.tag!==13)?(a._visibility&=-3,qg(i)):yh(i);break;default:yh(i)}}function qg(i){var a=i.deletions;if((i.flags&16)!==0){if(a!==null)for(var d=0;d<a.length;d++){var g=a[d];rr=g,vA(g,i)}xA(i)}for(i=i.child;i!==null;){switch(a=i,a.tag){case 0:case 11:case 15:Ul(8,a,a.return),qg(a);break;case 22:d=a.stateNode,d._visibility&2&&(d._visibility&=-3,qg(a));break;default:qg(a)}i=i.sibling}}function vA(i,a){for(;rr!==null;){var d=rr;switch(d.tag){case 0:case 11:case 15:Ul(8,d,a);break;case 23:case 22:if(d.memoizedState!==null&&d.memoizedState.cachePool!==null){var g=d.memoizedState.cachePool.pool;g!=null&&g.refCount++}break;case 24:eh(d.memoizedState.cache)}if(g=d.child,g!==null)g.return=d,rr=g;else e:for(d=i;rr!==null;){g=rr;var v=g.sibling,w=g.return;if(cA(g),g===d){rr=null;break e}if(v!==null){v.return=w,rr=v;break e}rr=w}}}var p9={getCacheForType:function(i){var a=gr(Pn),d=a.data.get(i);return d===void 0&&(d=i(),a.data.set(i,d)),d},cacheSignal:function(){return gr(Pn).controller.signal}},m9=typeof WeakMap=="function"?WeakMap:Map,zt=0,en=null,wt=null,Tt=0,Vt=0,Ls=null,ql=!1,Zu=!1,wS=!1,Ii=0,Nn=0,Gl=0,Ec=0,Gg=0,Ds=0,Ju=0,xh=null,gs=null,ES=!1,Kg=0,SA=0,Yg=1/0,Wg=null,Kl=null,vn=0,xo=null,Cc=null,qo=0,CS=0,TS=null,wA=null,ed=null,td=null,nd=null,bh=0,Xg=null;function js(){return(zt&2)!==0&&Tt!==0?Tt&-Tt:fe.T!==null?DS():ds()}function EA(){if(Ds===0)if((Tt&536870912)===0||vt){var i=dr;dr<<=1,(dr&3932160)===0&&(dr=262144),Ds=i}else Ds=536870912;return i=yr.current,i!==null&&(i.flags|=32),Ds}function rd(i,a){if(a!=null){var d=i.stateNode,g=d.ref;g===null&&(g=d.ref=rk(Ei(i.memoizedProps,d))),td===null&&(td=[]),td.push(a.bind(null,g))}}function ys(i,a,d){(i===en&&(Vt===2||Vt===9)||i.cancelPendingCommit!==null)&&(sd(i,0),Yl(i,Tt,Ds,!1)),Cs(i,d),((zt&2)===0||i!==en)&&(i===en&&((zt&2)===0&&(Ec|=d),Nn===4&&Yl(i,Tt,Ds,!1)),Go(i))}function CA(i,a,d){if((zt&6)!==0)throw Error(r(327));var g=!d&&(a&127)===0&&(a&i.expiredLanes)===0||kr(i,a),v=g?x9(i,a):OS(i,a,!0),w=g;do{if(v===0){Zu&&!g&&Yl(i,a,0,!1);break}else{if(d=i.current.alternate,w&&!g9(d)){v=OS(i,a,!1),w=!1;continue}if(v===2){if(w=a,i.errorRecoveryDisabledLanes&w)var _=0;else _=i.pendingLanes&-536870913,_=_!==0?_:_&536870912?536870912:0;if(_!==0){a=_;e:{var U=i;v=xh;var Q=U.current.memoizedState.isDehydrated;if(Q&&(sd(U,_).flags|=256),_=OS(U,_,!1),_!==2&&_!==6){if(wS&&!Q){U.errorRecoveryDisabledLanes|=w,Ec|=w,v=4;break e}w=gs,gs=v,w!==null&&(gs===null?gs=w:gs.push.apply(gs,w))}v=_}if(w=!1,v!==2)continue}}if(v===1){sd(i,0),Yl(i,a,0,!0);break}e:{switch(g=i,w=v,w){case 0:case 1:throw Error(r(345));case 4:if((a&4194048)!==a&&(a&62914560)!==a)break;case 6:Yl(g,a,Ds,!ql);break e;case 2:gs=null;break;case 3:case 5:break;default:throw Error(r(329))}if((a&62914560)===a&&(v=Kg+300-cn(),10<v)){if(Yl(g,a,Ds,!ql),Ar(g,0,!0)!==0)break e;qo=a,g.timeoutHandle=GS(TA.bind(null,g,d,gs,Wg,ES,a,Ds,Ec,Ju,ql,w,"Throttled",-0,0),v);break e}TA(g,d,gs,Wg,ES,a,Ds,Ec,Ju,ql,w,null,-0,0)}}break}while(!0);Go(i)}function TA(i,a,d,g,v,w,_,U,Q,ae,ge,Ce,se,de){i.timeoutHandle=-1;var ze=a.subtreeFlags,qe=(w&335544064)===w;if(Ce=null,(qe||ze&8192||(ze&16785408)===16785408)&&(Ce={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Gr},Is=null,yA(a,w,Ce),qe&&(ze=Ce,qe=i.containerInfo,qe=(qe.nodeType===9?qe:qe.ownerDocument).__reactViewTransition,qe!=null&&(ze.count++,ze.waitingForViewTransition=!0,ze=Oh.bind(ze),qe.finished.then(ze,ze))),ze=(w&62914560)===w?Kg-cn():(w&4194048)===w?SA-cn():0,ze=vV(Ce,ze),ze!==null)){qo=w,i.cancelPendingCommit=ze(IA.bind(null,i,a,w,d,g,v,_,U,Q,ae,ge,Ce,null,se,de)),Yl(i,w,_,!ae);return}IA(i,a,w,d,g,v,_,U,Q,ae,ge,Ce)}function g9(i){for(var a=i;;){var d=a.tag;if((d===0||d===11||d===15)&&a.flags&16384&&(d=a.updateQueue,d!==null&&(d=d.stores,d!==null)))for(var g=0;g<d.length;g++){var v=d[g],w=v.getSnapshot;v=v.value;try{if(!_s(w(),v))return!1}catch{return!1}}if(d=a.child,a.subtreeFlags&16384&&d!==null)d.return=a,a=d;else{if(a===i)break;for(;a.sibling===null;){if(a.return===null||a.return===i)return!0;a=a.return}a.sibling.return=a.return,a=a.sibling}}return!0}function Yl(i,a,d,g){a=cs(i,a),a&=~Gg,a&=~Ec,i.suspendedLanes|=a,i.pingedLanes&=~a,g&&(i.warmLanes|=a),g=i.expirationTimes;for(var v=a;0<v;){var w=31-Jt(v),_=1<<w;g[w]=-1,v&=~_}d!==0&&Ts(i,d,a)}function Qg(){return(zt&6)===0?(vh(0),!1):!0}function NS(){if(wt!==null){if(Vt===0)var i=wt.return;else i=wt,Oi=dc=null,Lv(i),Vu=null,rh=0,i=wt;for(;i!==null;)YR(i.alternate,i),i=i.return;wt=null}}function sd(i,a){var d=i.timeoutHandle;return d!==-1&&(i.timeoutHandle=-1,H9(d)),d=i.cancelPendingCommit,d!==null&&(i.cancelPendingCommit=null,d()),qo=0,NS(),en=i,wt=d=Ti(i.current,null),Tt=a,Vt=0,Ls=null,ql=!1,Zu=kr(i,a),wS=!1,Ju=Ds=Gg=Ec=Gl=Nn=0,gs=xh=null,ES=!1,Ii=cs(i,a),og(),d}function NA(i,a){pt=null,fe.H=kg,a===Uu||a===gg?(a=IO(),Vt=3):a===Sv?(a=IO(),Vt=4):Vt=a===Wv?8:a!==null&&typeof a=="object"&&typeof a.then=="function"?6:1,Ls=a,wt===null&&(Nn=1,_g(i,Ws(a,i.current)))}function OA(){var i=yr.current;return i===null?!0:(Tt&4194048)===Tt?Mr===null:(Tt&62914560)===Tt||(Tt&536870912)!==0?i===Mr:!1}function RA(){var i=fe.H;return fe.H=kg,i===null?kg:i}function AA(){var i=fe.A;return fe.A=p9,i}function Zg(){Nn=4,ql||(Tt&4194048)!==Tt&&yr.current!==null||(Zu=!0),(Gl&134217727)===0&&(Ec&134217727)===0||en===null||Yl(en,Tt,Ds,!1)}function OS(i,a,d){var g=zt;zt|=2;var v=RA(),w=AA();(en!==i||Tt!==a)&&(Wg=null,sd(i,a)),a=!1;var _=Nn;e:do try{if(Vt!==0&&wt!==null){var U=wt,Q=Ls;switch(Vt){case 8:NS(),_=6;break e;case 3:case 2:case 9:case 6:yr.current===null&&(a=!0);var ae=Vt;if(Vt=0,Ls=null,od(i,U,Q,ae),d&&Zu){_=0;break e}break;default:ae=Vt,Vt=0,Ls=null,od(i,U,Q,ae)}}y9(),_=Nn;break}catch(ge){NA(i,ge)}while(!0);return a&&i.shellSuspendCounter++,Oi=dc=null,zt=g,fe.H=v,fe.A=w,wt===null&&(en=null,Tt=0,og()),_}function y9(){for(;wt!==null;)kA(wt)}function x9(i,a){var d=zt;zt|=2;var g=RA(),v=AA();en!==i||Tt!==a?(Wg=null,Yg=cn()+500,sd(i,a)):Zu=kr(i,a);e:do try{if(Vt!==0&&wt!==null){a=wt;var w=Ls;t:switch(Vt){case 1:Vt=0,Ls=null,od(i,a,w,1);break;case 2:case 9:if(_O(w)){Vt=0,Ls=null,_A(a);break}a=function(){Vt!==2&&Vt!==9||en!==i||(Vt=7),Go(i)},w.then(a,a);break e;case 3:Vt=7;break e;case 4:Vt=5;break e;case 7:_O(w)?(Vt=0,Ls=null,_A(a)):(Vt=0,Ls=null,od(i,a,w,7));break;case 5:var _=null;switch(wt.tag){case 26:_=wt.memoizedState;case 5:case 27:var U=wt;if(_?wk(_):U.stateNode.complete){Vt=0,Ls=null;var Q=U.sibling;if(Q!==null)wt=Q;else{var ae=U.return;ae!==null?(wt=ae,Jg(ae)):wt=null}break t}}Vt=0,Ls=null,od(i,a,w,5);break;case 6:Vt=0,Ls=null,od(i,a,w,6);break;case 8:NS(),Nn=6;break e;default:throw Error(r(462))}}b9();break}catch(ge){NA(i,ge)}while(!0);return Oi=dc=null,fe.H=g,fe.A=v,zt=d,wt!==null?0:(en=null,Tt=0,og(),Nn)}function b9(){for(;wt!==null&&!yn();)kA(wt)}function kA(i){var a=GR(i.alternate,i,Ii);i.memoizedProps=i.pendingProps,a===null?Jg(i):wt=a}function _A(i){var a=i,d=a.alternate;switch(a.tag){case 15:case 0:a=BR(d,a,a.pendingProps,a.type,void 0,Tt);break;case 11:a=BR(d,a,a.pendingProps,a.type.render,a.ref,Tt);break;case 5:Lv(a);var g=a;g===tr&&(vt?(dg(g),g.tag===5&&g.stateNode!=null&&(rn=g.stateNode)):(dg(g),vt=!0));default:YR(d,a),a=wt=vO(a,Ii),a=GR(d,a,Ii)}i.memoizedProps=i.pendingProps,a===null?Jg(i):wt=a}function od(i,a,d,g){Oi=dc=null,Lv(a),Vu=null,rh=0;var v=a.return;try{if(i9(i,v,a,d,Tt)){Nn=1,_g(i,Ws(d,i.current)),wt=null;return}}catch(w){if(v!==null)throw wt=v,w;Nn=1,_g(i,Ws(d,i.current)),wt=null;return}a.flags&32768?(vt||g===1?i=!0:Zu||(Tt&536870912)!==0?i=!1:(ql=i=!0,(g===2||g===9||g===3||g===6)&&(g=yr.current,g!==null&&g.tag===13&&(g.flags|=16384))),MA(a,i)):Jg(a)}function Jg(i){var a=i;do{if((a.flags&32768)!==0){MA(a,ql);return}i=a.return;var d=u9(a.alternate,a,Ii);if(d!==null){wt=d;return}if(a=a.sibling,a!==null){wt=a;return}wt=a=i}while(a!==null);Nn===0&&(Nn=5)}function MA(i,a){do{var d=d9(i.alternate,i);if(d!==null){d.flags&=32767,wt=d;return}if(d=i.return,d!==null&&(d.flags|=32768,d.subtreeFlags=0,d.deletions=null),!a&&(i=i.sibling,i!==null)){wt=i;return}wt=i=d}while(i!==null);Nn=6,wt=null}function IA(i,a,d,g,v,w,_,U,Q,ae,ge,Ce){i.cancelPendingCommit=null;do e0();while(vn!==0);if((zt&6)!==0)throw Error(r(327));if(a!==null){if(a===i.current)throw Error(r(177));i===en&&(wt=en=null,Tt=0),Cc=a,xo=i,qo=d,TS=v,wA=g,v9(i,a,d,_,U,Q,Ce)}}function v9(i,a,d,g,v,w,_){var U=a.lanes|a.childLanes;if(CS=U,U|=av,El(i,d,U,g,v,w),td=null,(d&335544064)===d?(nd=YU(i),g=10262):(nd=null,g=10256),(a.subtreeFlags&g)!==0||(a.flags&g)!==0?(i.callbackNode=null,i.callbackPriority=0,N9(qn,function(){return _S(),null})):(i.callbackNode=null,i.callbackPriority=0),Bg=!1,g=(a.flags&13878)!==0,(a.subtreeFlags&13878)!==0||g){g=fe.T,fe.T=null,v=oe.p,oe.p=2,w=zt,zt|=4;try{f9(i,a,d)}finally{zt=w,oe.p=v,fe.T=g}}vn=1,Bg?ed=G9(_,i.containerInfo,nd,RS,AS,w9,kS,_S,S9):(RS(),AS(),kS())}function S9(i){if(vn!==0){var a=xo.onRecoverableError;a(i,{componentStack:null})}}function w9(){vn===3&&(vn=0,mA(Cc,xo),vn=4)}function RS(){if(vn===1){vn=0;var i=xo,a=Cc,d=qo,g=(a.flags&13878)!==0;if((a.subtreeFlags&13878)!==0||g){g=fe.T,fe.T=null;var v=oe.p;oe.p=2;var w=zt;zt|=4;try{mh=$g=!1,hA(a,i,d),d=US;var _=uO(i.containerInfo),U=d.focusedElem,Q=d.selectionRange;if(_!==U&&U&&U.ownerDocument&&cO(U.ownerDocument.documentElement,U)){if(Q!==null&&rv(U)){var ae=Q.start,ge=Q.end;if(ge===void 0&&(ge=ae),"selectionStart"in U)U.selectionStart=ae,U.selectionEnd=Math.min(ge,U.value.length);else{var Ce=U.ownerDocument||document,se=Ce&&Ce.defaultView||window;if(se.getSelection){var de=se.getSelection(),ze=U.textContent.length,qe=Math.min(Q.start,ze),mt=Q.end===void 0?qe:Math.min(Q.end,ze);!de.extend&&qe>mt&&(_=mt,mt=qe,qe=_);var ie=aO(U,qe),ne=aO(U,mt);if(ie&&ne&&(de.rangeCount!==1||de.anchorNode!==ie.node||de.anchorOffset!==ie.offset||de.focusNode!==ne.node||de.focusOffset!==ne.offset)){var ue=Ce.createRange();ue.setStart(ie.node,ie.offset),de.removeAllRanges(),qe>mt?(de.addRange(ue),de.extend(ne.node,ne.offset)):(ue.setEnd(ne.node,ne.offset),de.addRange(ue))}}}}for(Ce=[],de=U;de=de.parentNode;)de.nodeType===1&&Ce.push({element:de,left:de.scrollLeft,top:de.scrollTop});for(typeof U.focus=="function"&&U.focus(),U=0;U<Ce.length;U++){var we=Ce[U];we.element.scrollLeft=we.left,we.element.scrollTop=we.top}}hd=!!$S,US=$S=null}finally{zt=w,oe.p=v,fe.T=g}}i.current=a,vn=2}}function AS(){if(vn===2){vn=0;var i=xo,a=Cc,d=(a.flags&8772)!==0;if((a.subtreeFlags&8772)!==0||d){d=fe.T,fe.T=null;var g=oe.p;oe.p=2;var v=zt;zt|=4;try{lA(i,a.alternate,a)}finally{zt=v,oe.p=g,fe.T=d}}vn=3}}function kS(){if(vn===4||vn===3){vn=0;var i=ed;ed=null,Fr();var a=xo,d=Cc,g=qo,v=wA,w=(g&335544064)===g?10262:10256;if((d.subtreeFlags&w)!==0||(d.flags&w)!==0?vn=5:(vn=0,Cc=xo=null,LA(a,a.pendingLanes)),w=a.pendingLanes,w===0&&(Kl=null),us(g),d=d.stateNode,Ht&&typeof Ht.onCommitFiberRoot=="function")try{Ht.onCommitFiberRoot(An,d,void 0,(d.current.flags&128)===128)}catch{}if(v!==null){d=fe.T,w=oe.p,oe.p=2,fe.T=null;try{for(var _=a.onRecoverableError,U=0;U<v.length;U++){var Q=v[U];_(Q.value,{componentStack:Q.stack})}}finally{fe.T=d,oe.p=w}}if(v=td,_=nd,nd=null,v!==null&&(td=null,_===null&&(_=[]),i!==null))for(Q=0;Q<v.length;Q++)d=(0,v[Q])(_),d!==void 0&&i.finished.finally(d);(qo&3)!==0&&e0(),Go(a),w=a.pendingLanes,(g&261930)!==0&&(w&42)!==0?a===Xg?bh++:(bh=0,Xg=a):(bh=0,Xg=null),vh(0)}}function LA(i,a){(i.pooledCacheLanes&=a)===0&&(a=i.pooledCache,a!=null&&(i.pooledCache=null,eh(a)))}function e0(){return ed!==null&&(ed.skipTransition(),ed=null),RS(),AS(),kS(),_S()}function _S(){if(vn!==5)return!1;var i=xo,a=CS;CS=0;var d=us(qo),g=fe.T,v=oe.p;try{oe.p=32>d?32:d,fe.T=null,d=TS,TS=null;var w=xo,_=qo;if(vn=0,Cc=xo=null,qo=0,(zt&6)!==0)throw Error(r(331));var U=zt;if(zt|=4,bA(w.current),gA(w,w.current,_,d),zt=U,vh(0,!1),Ht&&typeof Ht.onPostCommitFiberRoot=="function")try{Ht.onPostCommitFiberRoot(An,w)}catch{}return!0}finally{oe.p=v,fe.T=g,LA(i,a)}}function DA(i,a,d){a=Ws(d,a),a=Yv(i.stateNode,a,2),i=Bl(i,a,2),i!==null&&(Cs(i,2),Go(i))}function qt(i,a,d){if(i.tag===3)DA(i,i,d);else for(;a!==null;){if(a.tag===3){DA(a,i,d);break}else if(a.tag===1){var g=a.stateNode;if(typeof a.type.getDerivedStateFromError=="function"||typeof g.componentDidCatch=="function"&&(Kl===null||!Kl.has(g))){i=Ws(d,i),d=_R(2),g=Bl(a,d,2),g!==null&&(MR(d,g,a,i),Cs(g,2),Go(g));break}}a=a.return}}function MS(i,a,d){var g=i.pingCache;if(g===null){g=i.pingCache=new m9;var v=new Set;g.set(a,v)}else v=g.get(a),v===void 0&&(v=new Set,g.set(a,v));v.has(d)||(wS=!0,v.add(d),i=E9.bind(null,i,a,d),a.then(i,i))}function E9(i,a,d){var g=i.pingCache;g!==null&&g.delete(a),i.pingedLanes|=i.suspendedLanes&d,i.warmLanes&=~d,en===i&&(Tt&d)===d&&((Nn===4||Nn===3&&(Tt&62914560)===Tt&&300>cn()-Kg)&&(zt&2)===0?sd(i,0):Gg|=d,Ju===Tt&&(Ju=0)),Go(i)}function jA(i,a){a===0&&(a=hr()),i=ac(i,a),i!==null&&(Cs(i,a),Go(i))}function C9(i){var a=i.memoizedState,d=0;a!==null&&(d=a.retryLane),jA(i,d)}function T9(i,a){var d=0;switch(i.tag){case 31:case 13:var g=i.stateNode,v=i.memoizedState;v!==null&&(d=v.retryLane);break;case 19:g=i.stateNode;break;case 22:g=i.stateNode._retryCache;break;default:throw Error(r(314))}g!==null&&g.delete(a),jA(i,d)}function N9(i,a){return At(i,a)}var id=null,ld=null,IS=!1,t0=!1,LS=!1,Wl=0;function Go(i){i!==ld&&i.next===null&&(ld===null?id=ld=i:ld=ld.next=i),t0=!0,IS||(IS=!0,R9())}function vh(i,a){if(!LS&&t0){LS=!0;do for(var d=!1,g=id;g!==null;){if(i!==0){var v=g.pendingLanes;if(v===0)var w=0;else{var _=g.suspendedLanes,U=g.pingedLanes;w=(1<<31-Jt(42|i)+1)-1,w&=v&~(_&~U),w=w&201326741?w&201326741|1:w?w|2:0}w!==0&&(d=!0,HA(g,w))}else w=Tt,w=Ar(g,g===en?w:0,g.cancelPendingCommit!==null||g.timeoutHandle!==-1),(w&3)===0||kr(g,w)||(d=!0,HA(g,w));g=g.next}while(d);LS=!1}}function O9(){PA()}function PA(){t0=IS=!1;var i=0;Wl!==0&&B9()&&(i=Wl);for(var a=cn(),d=null,g=id;g!==null;){var v=g.next,w=zA(g,a);w===0?(g.next=null,d===null?id=v:d.next=v,v===null&&(ld=d)):(d=g,(i!==0||(w&3)!==0)&&(t0=!0)),g=v}vn!==0&&vn!==5||vh(i),Wl!==0&&(Wl=0)}function zA(i,a){for(var d=i.suspendedLanes,g=i.pingedLanes,v=i.expirationTimes,w=i.pendingLanes&-62914561;0<w;){var _=31-Jt(w),U=1<<_,Q=v[_];Q===-1?((U&d)===0||(U&g)!==0)&&(v[_]=fo(U,a)):Q<=a&&(i.expiredLanes|=U),w&=~U}if(a=en,d=Tt,d=Ar(i,i===a?d:0,i.cancelPendingCommit!==null||i.timeoutHandle!==-1),g=i.callbackNode,d===0||i===a&&(Vt===2||Vt===9)||i.cancelPendingCommit!==null)return g!==null&&g!==null&&gn(g),i.callbackNode=null,i.callbackPriority=0;if((d&3)===0||kr(i,d)){if(a=d&-d,a===i.callbackPriority)return a;switch(g!==null&&gn(g),us(d)){case 2:case 8:d=Es;break;case 32:d=qn;break;case 268435456:d=un;break;default:d=qn}return g=BA.bind(null,i),d=At(d,g),i.callbackPriority=a,i.callbackNode=d,a}return g!==null&&g!==null&&gn(g),i.callbackPriority=2,i.callbackNode=null,2}function BA(i,a){if(vn!==0&&vn!==5)return i.callbackNode=null,i.callbackPriority=0,null;var d=i.callbackNode;if(e0()&&i.callbackNode!==d)return null;var g=Tt;return g=Ar(i,i===en?g:0,i.cancelPendingCommit!==null||i.timeoutHandle!==-1),g===0?null:(CA(i,g,a),zA(i,cn()),i.callbackNode!=null&&i.callbackNode===d?BA.bind(null,i):null)}function HA(i,a){if(e0())return null;CA(i,a,!0)}function R9(){F9(function(){(zt&6)!==0?At($r,O9):PA()})}function DS(){if(Wl===0){var i=pc;i===0&&(i=ur,ur<<=1,(ur&261888)===0&&(ur=256)),Wl=i}return Wl}function FA(i){return i==null||typeof i=="symbol"||typeof i=="boolean"?null:typeof i=="function"?i:pr(i)}function A9(i,a,d,g,v){if(a==="submit"&&d&&d.stateNode===v){var w=FA((v[Yn]||null).action),_=g.submitter;_&&(a=(a=_[Yn]||null)?FA(a.formAction):_.getAttribute("formAction"),a!==null&&(w=a,_=null));var U=new tg("action","action",null,g,v);i.push({event:U,listeners:[{instance:null,listener:function(){if(g.defaultPrevented){if(Wl!==0){var Q=new FormData(v,_);Uv(d,{pending:!0,data:Q,method:v.method,action:w},null,Q)}}else typeof w=="function"&&(U.preventDefault(),Q=new FormData(v,_),Uv(d,{pending:!0,data:Q,method:v.method,action:w},w,Q))},currentTarget:v}]})}}for(var jS=0;jS<lv.length;jS++){var PS=lv[jS],k9=PS.toLowerCase(),_9=PS[0].toUpperCase()+PS.slice(1);po(k9,"on"+_9)}po(hO,"onAnimationEnd"),po(pO,"onAnimationIteration"),po(mO,"onAnimationStart"),po("dblclick","onDoubleClick"),po("focusin","onFocus"),po("focusout","onBlur"),po(HU,"onTransitionRun"),po(FU,"onTransitionStart"),po($U,"onTransitionCancel"),po(gO,"onTransitionEnd"),Ft("onMouseEnter",["mouseout","mouseover"]),Ft("onMouseLeave",["mouseout","mouseover"]),Ft("onPointerEnter",["pointerout","pointerover"]),Ft("onPointerLeave",["pointerout","pointerover"]),dt("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),dt("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),dt("onBeforeInput",["compositionend","keypress","textInput","paste"]),dt("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),dt("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),dt("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Sh="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(" "),M9=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Sh));function $A(i,a){a=(a&4)!==0;for(var d=0;d<i.length;d++){var g=i[d],v=g.event;g=g.listeners;e:{var w=void 0;if(a)for(var _=g.length-1;0<=_;_--){var U=g[_],Q=U.instance,ae=U.currentTarget;if(U=U.listener,Q!==w&&v.isPropagationStopped())break e;w=U,v.currentTarget=ae;try{w(v)}catch(ge){sg(ge)}v.currentTarget=null,w=Q}else for(_=0;_<g.length;_++){if(U=g[_],Q=U.instance,ae=U.currentTarget,U=U.listener,Q!==w&&v.isPropagationStopped())break e;w=U,v.currentTarget=ae;try{w(v)}catch(ge){sg(ge)}v.currentTarget=null,w=Q}}}}function Et(i,a){var d=a[ec];d===void 0&&(d=a[ec]=new Set);var g=i+"__bubble";d.has(g)||(UA(a,i,2,!1),d.add(g))}function zS(i,a,d){var g=0;a&&(g|=4),UA(d,i,g,a)}var n0="_reactListening"+Math.random().toString(36).slice(2);function BS(i){if(!i[n0]){i[n0]=!0,lt.forEach(function(d){d!=="selectionchange"&&(M9.has(d)||zS(d,!1,i),zS(d,!0,i))});var a=i.nodeType===9?i:i.ownerDocument;a===null||a[n0]||(a[n0]=!0,zS("selectionchange",!1,a))}}function UA(i,a,d,g){switch(Mk(a)){case 2:var v=CV;break;case 8:v=TV;break;default:v=o1}d=v.bind(null,a,d,i),v=void 0,!oc||a!=="touchstart"&&a!=="touchmove"&&a!=="wheel"||(v=!0),g?v!==void 0?i.addEventListener(a,d,{capture:!0,passive:v}):i.addEventListener(a,d,!0):v!==void 0?i.addEventListener(a,d,{passive:v}):i.addEventListener(a,d,!1)}function HS(i,a,d,g,v){var w=g;if((a&1)===0&&(a&2)===0&&g!==null)e:for(;;){if(g===null)return;var _=g.tag;if(_===3||_===4){var U=g.stateNode.containerInfo;if(U===v)break;if(_===4)for(_=g.return;_!==null;){var Q=_.tag;if((Q===3||Q===4)&&_.stateNode.containerInfo===v)return;_=_.return}for(;U!==null;){if(_=Ns(U),_===null)return;if(Q=_.tag,Q===5||Q===6||Q===26||Q===27){g=w=_;continue e}U=U.parentNode}}g=g.return}sc(function(){var ae=w,ge=rc(d),Ce=[];e:{var se=yO.get(i);if(se!==void 0){var de=tg,ze=i;switch(i){case"keypress":if(Jm(d)===0)break e;case"keydown":case"keyup":de=gU;break;case"focusin":ze="focus",de=Qb;break;case"focusout":ze="blur",de=Qb;break;case"beforeblur":case"afterblur":de=Qb;break;case"click":if(d.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":de=GN;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":de=sU;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":de=SU;break;case hO:case pO:case mO:de=lU;break;case gO:de=EU;break;case"scroll":case"scrollend":de=nU;break;case"wheel":de=TU;break;case"copy":case"cut":case"paste":de=cU;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":de=YN;break;case"submit":de=bU;break;case"toggle":case"beforetoggle":de=OU}var qe=(a&4)!==0,mt=!qe&&(i==="scroll"||i==="scrollend"),ie=qe?se!==null?se+"Capture":null:se;qe=[];for(var ne=ae,ue;ne!==null;){var we=ne;if(ue=we.stateNode,we=we.tag,we!==5&&we!==26&&we!==27||ue===null||ie===null||(we=wi(ne,ie),we!=null&&qe.push(wh(ne,we,ue))),mt)break;ne=ne.return}0<qe.length&&(se=new de(se,ze,null,d,ge),Ce.push({event:se,listeners:qe}))}}if((a&7)===0){e:{if(de=i==="mouseover"||i==="pointerover",se=i==="mouseout"||i==="pointerout",de&&d!==nc&&(ze=d.relatedTarget||d.fromElement)&&(Ns(ze)||ze[Vr]))break e;(se||de)&&(ze=ge.window===ge?ge:(de=ge.ownerDocument)?de.defaultView||de.parentWindow:window,se?(de=d.relatedTarget||d.toElement,se=ae,de=de?Ns(de):null,de!==null&&(mt=o(de),qe=de.tag,de!==mt||qe!==5&&qe!==27&&qe!==6)&&(de=null)):(se=null,de=ae),se!==de&&(qe=GN,we="onMouseLeave",ie="onMouseEnter",ne="mouse",(i==="pointerout"||i==="pointerover")&&(qe=YN,we="onPointerLeave",ie="onPointerEnter",ne="pointer"),mt=se==null?ze:me(se),ue=de==null?ze:me(de),ze=new qe(we,ne+"leave",se,d,ge),ze.target=mt,ze.relatedTarget=ue,we=null,Ns(ge)===ae&&(qe=new qe(ie,ne+"enter",de,d,ge),qe.target=ue,qe.relatedTarget=mt,we=qe),mt=we,qe=se&&de?M(se,de,I9):null,se!==null&&VA(Ce,ze,se,qe,!1),de!==null&&mt!==null&&VA(Ce,mt,de,qe,!0)))}e:{if(se=ae?me(ae):window,de=se.nodeName&&se.nodeName.toLowerCase(),de==="select"||de==="input"&&se.type==="file")var $e=nO;else if(eO(se))if(rO)$e=PU;else{$e=DU;var Nt=LU}else de=se.nodeName,!de||de.toLowerCase()!=="input"||se.type!=="checkbox"&&se.type!=="radio"?ae&&tc(ae.elementType)&&($e=nO):$e=jU;if($e&&($e=$e(i,ae))){tO(Ce,$e,d,ge);break e}Nt&&Nt(i,se,ae)}switch(Nt=ae?me(ae):window,i){case"focusin":(eO(Nt)||Nt.contentEditable==="true")&&(Du=Nt,sv=ae,Qf=null);break;case"focusout":Qf=sv=Du=null;break;case"mousedown":ov=!0;break;case"contextmenu":case"mouseup":case"dragend":ov=!1,dO(Ce,d,ge);break;case"selectionchange":if(BU)break;case"keydown":case"keyup":dO(Ce,d,ge)}var Xe;if(Jb)e:{switch(i){case"compositionstart":var ot="onCompositionStart";break e;case"compositionend":ot="onCompositionEnd";break e;case"compositionupdate":ot="onCompositionUpdate";break e}ot=void 0}else Lu?ZN(i,d)&&(ot="onCompositionEnd"):i==="keydown"&&d.keyCode===229&&(ot="onCompositionStart");ot&&(WN&&d.locale!=="ko"&&(Lu||ot!=="onCompositionStart"?ot==="onCompositionEnd"&&Lu&&(Xe=VN()):(kl=ge,Yb="value"in kl?kl.value:kl.textContent,Lu=!0)),Nt=r0(ae,ot),0<Nt.length&&(ot=new KN(ot,i,null,d,ge),Ce.push({event:ot,listeners:Nt}),Xe?ot.data=Xe:(Xe=JN(d),Xe!==null&&(ot.data=Xe)))),(Xe=AU?kU(i,d):_U(i,d))&&(ot=r0(ae,"onBeforeInput"),0<ot.length&&(Nt=new KN("onBeforeInput","beforeinput",null,d,ge),Ce.push({event:Nt,listeners:ot}),Nt.data=Xe)),A9(Ce,i,ae,d,ge)}$A(Ce,a)})}function wh(i,a,d){return{instance:i,listener:a,currentTarget:d}}function r0(i,a){for(var d=a+"Capture",g=[];i!==null;){var v=i,w=v.stateNode;if(v=v.tag,v!==5&&v!==26&&v!==27||w===null||(v=wi(i,d),v!=null&&g.unshift(wh(i,v,w)),v=wi(i,a),v!=null&&g.push(wh(i,v,w))),i.tag===3)return g;i=i.return}return[]}function I9(i){if(i===null)return null;do i=i.return;while(i&&i.tag!==5&&i.tag!==27);return i||null}function VA(i,a,d,g,v){for(var w=a._reactName,_=[];d!==null&&d!==g;){var U=d,Q=U.alternate,ae=U.stateNode;if(U=U.tag,Q!==null&&Q===g)break;U!==5&&U!==26&&U!==27||ae===null||(Q=ae,v?(ae=wi(d,w),ae!=null&&_.unshift(wh(d,ae,Q))):v||(ae=wi(d,w),ae!=null&&_.push(wh(d,ae,Q)))),d=d.return}_.length!==0&&i.push({event:a,listeners:_})}var L9=/\r\n?/g,D9=/\u0000|\uFFFD/g;function qA(i){return(typeof i=="string"?i:""+i).replace(L9,`
|
|
50
|
+
`).replace(D9,"")}function GA(i,a){return a=qA(a),qA(i)===a}function Gt(i,a,d,g,v,w){switch(d){case"children":if(typeof g=="string")a==="body"||a==="textarea"&&g===""||qr(i,g);else if(typeof g=="number"||typeof g=="bigint")a!=="body"&&qr(i,""+g);else return;break;case"className":Os(i,"class",g);break;case"tabIndex":Os(i,"tabindex",g);break;case"dir":case"role":case"viewBox":case"width":case"height":Os(i,d,g);break;case"style":As(i,g,w);return;case"data":if(a!=="object"){Os(i,"data",g);break}case"src":case"href":if(g===""&&(a!=="a"||d!=="href")){i.removeAttribute(d);break}if(g==null||typeof g=="function"||typeof g=="symbol"||typeof g=="boolean"){i.removeAttribute(d);break}g=pr(g),i.setAttribute(d,g);break;case"action":case"formAction":if(typeof g=="function"){i.setAttribute(d,"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 w=="function"&&(d==="formAction"?(a!=="input"&&Gt(i,a,"name",v.name,v,null),Gt(i,a,"formEncType",v.formEncType,v,null),Gt(i,a,"formMethod",v.formMethod,v,null),Gt(i,a,"formTarget",v.formTarget,v,null)):(Gt(i,a,"encType",v.encType,v,null),Gt(i,a,"method",v.method,v,null),Gt(i,a,"target",v.target,v,null)));if(g==null||typeof g=="symbol"||typeof g=="boolean"){i.removeAttribute(d);break}g=pr(g),i.setAttribute(d,g);break;case"onClick":g!=null&&(i.onclick=Gr);return;case"onScroll":g!=null&&Et("scroll",i);return;case"onScrollEnd":g!=null&&Et("scrollend",i);return;case"dangerouslySetInnerHTML":if(g!=null){if(typeof g!="object"||!("__html"in g))throw Error(r(61));if(d=g.__html,d!=null){if(v.children!=null)throw Error(r(60));(w!=null?w.__html:void 0)!==d&&(i.innerHTML=d)}}break;case"multiple":i.multiple=g&&typeof g!="function"&&typeof g!="symbol";break;case"muted":i.muted=g&&typeof g!="function"&&typeof g!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(g==null||typeof g=="function"||typeof g=="boolean"||typeof g=="symbol"){i.removeAttribute("xlink:href");break}d=pr(g),i.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",d);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":g!=null&&typeof g!="function"&&typeof g!="symbol"?i.setAttribute(d,g):i.removeAttribute(d);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"credentialless":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":g&&typeof g!="function"&&typeof g!="symbol"?i.setAttribute(d,""):i.removeAttribute(d);break;case"capture":case"download":g===!0?i.setAttribute(d,""):g!==!1&&g!=null&&typeof g!="function"&&typeof g!="symbol"?i.setAttribute(d,g):i.removeAttribute(d);break;case"cols":case"rows":case"size":case"span":g!=null&&typeof g!="function"&&typeof g!="symbol"&&!isNaN(g)&&1<=g?i.setAttribute(d,g):i.removeAttribute(d);break;case"rowSpan":case"start":g==null||typeof g=="function"||typeof g=="symbol"||isNaN(g)?i.removeAttribute(d):i.setAttribute(d,g);break;case"popover":Et("beforetoggle",i),Et("toggle",i),bn(i,"popover",g);break;case"xlinkActuate":Dn(i,"http://www.w3.org/1999/xlink","xlink:actuate",g);break;case"xlinkArcrole":Dn(i,"http://www.w3.org/1999/xlink","xlink:arcrole",g);break;case"xlinkRole":Dn(i,"http://www.w3.org/1999/xlink","xlink:role",g);break;case"xlinkShow":Dn(i,"http://www.w3.org/1999/xlink","xlink:show",g);break;case"xlinkTitle":Dn(i,"http://www.w3.org/1999/xlink","xlink:title",g);break;case"xlinkType":Dn(i,"http://www.w3.org/1999/xlink","xlink:type",g);break;case"xmlBase":Dn(i,"http://www.w3.org/XML/1998/namespace","xml:base",g);break;case"xmlLang":Dn(i,"http://www.w3.org/XML/1998/namespace","xml:lang",g);break;case"xmlSpace":Dn(i,"http://www.w3.org/XML/1998/namespace","xml:space",g);break;case"is":bn(i,"is",g);break;case"innerText":case"textContent":return;default:if(!(2<d.length)||d[0]!=="o"&&d[0]!=="O"||d[1]!=="n"&&d[1]!=="N")d=$f.get(d)||d,bn(i,d,g);else return}rt=!0}function FS(i,a,d,g,v,w){switch(d){case"style":As(i,g,w);return;case"dangerouslySetInnerHTML":if(g!=null){if(typeof g!="object"||!("__html"in g))throw Error(r(61));if(d=g.__html,d!=null){if(v.children!=null)throw Error(r(60));(w!=null?w.__html:void 0)!==d&&(i.innerHTML=d)}}break;case"children":if(typeof g=="string")qr(i,g);else if(typeof g=="number"||typeof g=="bigint")qr(i,""+g);else return;break;case"onScroll":g!=null&&Et("scroll",i);return;case"onScrollEnd":g!=null&&Et("scrollend",i);return;case"onClick":g!=null&&(i.onclick=Gr);return;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":return;case"innerText":case"textContent":return;default:if(!it.hasOwnProperty(d))e:{if(d[0]==="o"&&d[1]==="n"&&(v=d.endsWith("Capture"),w=d.slice(2,v?d.length-7:void 0),a=i[Yn]||null,a=a!=null?a[d]:null,typeof a=="function"&&i.removeEventListener(w,a,v),typeof g=="function")){typeof a!="function"&&a!==null&&(d in i?i[d]=null:i.hasAttribute(d)&&i.removeAttribute(d)),i.addEventListener(w,g,v);break e}rt=!0,d in i?i[d]=g:g===!0?i.setAttribute(d,""):bn(i,d,g)}return}rt=!0}function vr(i,a,d){switch(a){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Et("error",i),Et("load",i);var g=!1,v=!1,w;for(w in d)if(d.hasOwnProperty(w)){var _=d[w];if(_!=null)switch(w){case"src":g=!0;break;case"srcSet":v=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(r(137,a));default:Gt(i,a,w,_,d,null)}}v&&Gt(i,a,"srcSet",d.srcSet,d,null),g&&Gt(i,a,"src",d.src,d,null);return;case"input":Et("invalid",i);var U=w=_=v=null,Q=null,ae=null;for(g in d)if(d.hasOwnProperty(g)){var ge=d[g];if(ge!=null)switch(g){case"name":v=ge;break;case"type":_=ge;break;case"checked":Q=ge;break;case"defaultChecked":ae=ge;break;case"value":w=ge;break;case"defaultValue":U=ge;break;case"children":case"dangerouslySetInnerHTML":if(ge!=null)throw Error(r(137,a));break;default:Gt(i,a,g,ge,d,null)}}Rl(i,w,U,Q,ae,_,v,!1);return;case"select":Et("invalid",i),g=_=w=null;for(v in d)if(d.hasOwnProperty(v)&&(U=d[v],U!=null))switch(v){case"value":w=U;break;case"defaultValue":_=U;break;case"multiple":g=U;default:Gt(i,a,v,U,d,null)}a=w,d=_,i.multiple=!!g,a!=null?fs(i,!!g,a,!1):d!=null&&fs(i,!!g,d,!0);return;case"textarea":Et("invalid",i),w=v=g=null;for(_ in d)if(d.hasOwnProperty(_)&&(U=d[_],U!=null))switch(_){case"value":g=U;break;case"defaultValue":v=U;break;case"children":w=U;break;case"dangerouslySetInnerHTML":if(U!=null)throw Error(r(91));break;default:Gt(i,a,_,U,d,null)}Rs(i,g,v,w);return;case"option":for(Q in d)if(d.hasOwnProperty(Q)&&(g=d[Q],g!=null))switch(Q){case"selected":i.selected=g&&typeof g!="function"&&typeof g!="symbol";break;default:Gt(i,a,Q,g,d,null)}return;case"dialog":Et("beforetoggle",i),Et("toggle",i),Et("cancel",i),Et("close",i);break;case"iframe":case"object":Et("load",i);break;case"video":case"audio":for(g=0;g<Sh.length;g++)Et(Sh[g],i);break;case"image":Et("error",i),Et("load",i);break;case"details":Et("toggle",i);break;case"embed":case"source":case"link":Et("error",i),Et("load",i);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(ae in d)if(d.hasOwnProperty(ae)&&(g=d[ae],g!=null))switch(ae){case"children":case"dangerouslySetInnerHTML":throw Error(r(137,a));default:Gt(i,a,ae,g,d,null)}return;default:if(tc(a)){for(ge in d)d.hasOwnProperty(ge)&&(g=d[ge],g!==void 0&&FS(i,a,ge,g,d,void 0));return}}for(U in d)d.hasOwnProperty(U)&&(g=d[U],g!=null&&Gt(i,a,U,g,d,null))}var j9={};function P9(i,a,d,g){switch(a){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var v=null,w=null,_=null,U=null,Q=null,ae=null,ge=null;for(de in d){var Ce=d[de];if(d.hasOwnProperty(de)&&Ce!=null)switch(de){case"checked":break;case"value":break;case"defaultValue":Q=Ce;default:g.hasOwnProperty(de)||Gt(i,a,de,null,g,Ce)}}for(var se in g){var de=g[se];if(Ce=d[se],g.hasOwnProperty(se)&&(de!=null||Ce!=null))switch(se){case"type":de!==Ce&&(rt=!0),w=de;break;case"name":de!==Ce&&(rt=!0),v=de;break;case"checked":de!==Ce&&(rt=!0),ae=de;break;case"defaultChecked":de!==Ce&&(rt=!0),ge=de;break;case"value":de!==Ce&&(rt=!0),_=de;break;case"defaultValue":de!==Ce&&(rt=!0),U=de;break;case"children":case"dangerouslySetInnerHTML":if(de!=null)throw Error(r(137,a));break;default:de!==Ce&&Gt(i,a,se,de,g,Ce)}}_r(i,_,U,Q,ae,ge,w,v);return;case"select":de=_=U=se=null;for(w in d)if(Q=d[w],d.hasOwnProperty(w)&&Q!=null)switch(w){case"value":break;case"multiple":de=Q;default:g.hasOwnProperty(w)||Gt(i,a,w,null,g,Q)}for(v in g)if(w=g[v],Q=d[v],g.hasOwnProperty(v)&&(w!=null||Q!=null))switch(v){case"value":w!==Q&&(rt=!0),se=w;break;case"defaultValue":w!==Q&&(rt=!0),U=w;break;case"multiple":w!==Q&&(rt=!0),_=w;default:w!==Q&&Gt(i,a,v,w,g,Q)}a=U,d=_,g=de,se!=null?fs(i,!!d,se,!1):!!g!=!!d&&(a!=null?fs(i,!!d,a,!0):fs(i,!!d,d?[]:"",!1));return;case"textarea":de=se=null;for(U in d)if(v=d[U],d.hasOwnProperty(U)&&v!=null&&!g.hasOwnProperty(U))switch(U){case"value":break;case"children":break;default:Gt(i,a,U,null,g,v)}for(_ in g)if(v=g[_],w=d[_],g.hasOwnProperty(_)&&(v!=null||w!=null))switch(_){case"value":v!==w&&(rt=!0),se=v;break;case"defaultValue":v!==w&&(rt=!0),de=v;break;case"children":break;case"dangerouslySetInnerHTML":if(v!=null)throw Error(r(91));break;default:v!==w&&Gt(i,a,_,v,g,w)}Iu(i,se,de);return;case"option":for(var ze in d)if(se=d[ze],d.hasOwnProperty(ze)&&se!=null&&!g.hasOwnProperty(ze))switch(ze){case"selected":i.selected=!1;break;default:Gt(i,a,ze,null,g,se)}for(Q in g)if(se=g[Q],de=d[Q],g.hasOwnProperty(Q)&&se!==de&&(se!=null||de!=null))switch(Q){case"selected":se!==de&&(rt=!0),i.selected=se&&typeof se!="function"&&typeof se!="symbol";break;default:Gt(i,a,Q,se,g,de)}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 qe in d)se=d[qe],d.hasOwnProperty(qe)&&se!=null&&!g.hasOwnProperty(qe)&&Gt(i,a,qe,null,g,se);for(ae in g)if(se=g[ae],de=d[ae],g.hasOwnProperty(ae)&&se!==de&&(se!=null||de!=null))switch(ae){case"children":case"dangerouslySetInnerHTML":if(se!=null)throw Error(r(137,a));break;default:Gt(i,a,ae,se,g,de)}return;default:if(tc(a)){for(var mt in d)se=d[mt],d.hasOwnProperty(mt)&&se!==void 0&&!g.hasOwnProperty(mt)&&FS(i,a,mt,void 0,g,se);for(ge in g)se=g[ge],de=d[ge],!g.hasOwnProperty(ge)||se===de||se===void 0&&de===void 0||FS(i,a,ge,se,g,de);return}}for(var ie in d)se=d[ie],d.hasOwnProperty(ie)&&se!=null&&!g.hasOwnProperty(ie)&&Gt(i,a,ie,null,g,se);for(Ce in g)se=g[Ce],de=d[Ce],!g.hasOwnProperty(Ce)||se===de||se==null&&de==null||Gt(i,a,Ce,se,g,de)}function KA(i){switch(i){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function z9(){if(typeof performance.getEntriesByType=="function"){for(var i=0,a=0,d=performance.getEntriesByType("resource"),g=0;g<d.length;g++){var v=d[g],w=v.transferSize,_=v.initiatorType,U=v.duration;if(w&&U&&KA(_)){for(_=0,U=v.responseEnd,g+=1;g<d.length;g++){var Q=d[g],ae=Q.startTime;if(ae>U)break;var ge=Q.transferSize,Ce=Q.initiatorType;ge&&KA(Ce)&&(Q=Q.responseEnd,_+=ge*(Q<U?1:(U-ae)/(Q-ae)))}if(--g,a+=8*(w+_)/(v.duration/1e3),i++,10<i)break}}if(0<i)return a/i/1e6}return navigator.connection&&(i=navigator.connection.downlink,typeof i=="number")?i:5}var $S=null,US=null;function Eh(i){return i.nodeType===9?i:i.ownerDocument}function YA(i){switch(i){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function WA(i,a){if(i===0)switch(a){case"svg":return 1;case"math":return 2;default:return 0}return i===1&&a==="foreignObject"?0:i}function XA(i,a,d,g){return d=Eh(d).createElement(i),d[on]=g,d[Yn]=a,vr(d,i,a),Re(d),d}function VS(i,a){return i==="textarea"||i==="noscript"||typeof a.children=="string"||typeof a.children=="number"||typeof a.children=="bigint"||typeof a.dangerouslySetInnerHTML=="object"&&a.dangerouslySetInnerHTML!==null&&a.dangerouslySetInnerHTML.__html!=null}var qS=null;function B9(){var i=window.event;return i&&i.type==="popstate"?i===qS?!1:(qS=i,!0):(qS=null,!1)}var GS=typeof setTimeout=="function"?setTimeout:void 0,H9=typeof clearTimeout=="function"?clearTimeout:void 0,QA=typeof Promise=="function"?Promise:void 0,ZA=typeof requestAnimationFrame=="function"?requestAnimationFrame:GS,F9=typeof queueMicrotask=="function"?queueMicrotask:typeof QA<"u"?function(i){return QA.resolve(null).then(i).catch($9)}:GS;function $9(i){setTimeout(function(){throw i})}function Xl(i){return i==="head"}function JA(i,a){var d=a,g=0;do{var v=d.nextSibling;if(i.removeChild(d),v&&v.nodeType===8)if(d=v.data,d==="/$"||d==="/&"){if(g===0){i.removeChild(v),pd(a);return}g--}else if(d==="$"||d==="$?"||d==="$~"||d==="$!"||d==="&")g++;else if(d==="html")e1(i.ownerDocument.documentElement);else if(d==="head"){d=i.ownerDocument.head,e1(d);for(var w=d.firstChild;w;){var _=w.nextSibling,U=w.nodeName;w[bi]||U==="SCRIPT"||U==="STYLE"||U==="LINK"&&w.rel.toLowerCase()==="stylesheet"||d.removeChild(w),w=_}}else d==="body"&&e1(i.ownerDocument.body);d=v}while(d);pd(a)}function ek(i,a){var d=i;i=0;do{var g=d.nextSibling;if(d.nodeType===1?a?(d._stashedDisplay=d.style.display,d.style.display="none"):(d.style.display=d._stashedDisplay||"",d.getAttribute("style")===""&&d.removeAttribute("style")):d.nodeType===3&&(a?(d._stashedText=d.nodeValue,d.nodeValue=""):d.nodeValue=d._stashedText||""),g&&g.nodeType===8)if(d=g.data,d==="/$"){if(i===0)break;i--}else d!=="$"&&d!=="$?"&&d!=="$~"&&d!=="$!"||i++;d=g}while(d)}function tk(i,a,d){if(a=CSS.escape(a)!==a?"r-"+btoa(a).replace(/=/g,""):a,i.style.viewTransitionName=a,d!=null&&(i.style.viewTransitionClass=d),d=getComputedStyle(i),d.display==="inline"){if(a=i.getClientRects(),a.length===1)var g=1;else for(var v=g=0;v<a.length;v++){var w=a[v];0<w.width&&0<w.height&&g++}g===1&&(i=i.style,i.display=a.length===1?"inline-block":"block",i.marginTop="-"+d.paddingTop,i.marginBottom="-"+d.paddingBottom)}}function nk(i,a){i=i.style,a=a.style;var d=a!=null?a.hasOwnProperty("viewTransitionName")?a.viewTransitionName:a.hasOwnProperty("view-transition-name")?a["view-transition-name"]:null:null;i.viewTransitionName=d==null||typeof d=="boolean"?"":(""+d).trim(),d=a!=null?a.hasOwnProperty("viewTransitionClass")?a.viewTransitionClass:a.hasOwnProperty("view-transition-class")?a["view-transition-class"]:null:null,i.viewTransitionClass=d==null||typeof d=="boolean"?"":(""+d).trim(),i.display==="inline-block"&&(a==null?i.display=i.margin="":(d=a.display,i.display=d==null||typeof d=="boolean"?"":d,d=a.margin,d!=null?i.margin=d:(d=a.hasOwnProperty("marginTop")?a.marginTop:a["margin-top"],i.marginTop=d==null||typeof d=="boolean"?"":d,a=a.hasOwnProperty("marginBottom")?a.marginBottom:a["margin-bottom"],i.marginBottom=a==null||typeof a=="boolean"?"":a)))}function U9(i,a,d){return d=d.ownerDocument.defaultView,{rect:i,abs:a.position==="absolute"||a.position==="fixed",clip:a.clipPath!=="none"||a.overflow!=="visible"||a.filter!=="none"||a.mask!=="none"||a.mask!=="none"||a.borderRadius!=="0px",view:0<=i.bottom&&0<=i.right&&i.top<=d.innerHeight&&i.left<=d.innerWidth}}function KS(i){var a=i.getBoundingClientRect(),d=getComputedStyle(i);return U9(a,d,i)}function V9(i){return i.documentElement.clientHeight}function q9(i){this.addEventListener("load",i),this.addEventListener("error",i)}function G9(i,a,d,g,v,w,_,U,Q){var ae=a.nodeType===9?a:a.ownerDocument;try{var ge=ae.startViewTransition({update:function(){var se=ae.defaultView,de=se.navigation&&se.navigation.transition,ze=ae.fonts.status;g();var qe=[];if(ze==="loaded"&&(V9(ae),ae.fonts.status==="loading"&&qe.push(ae.fonts.ready)),ze=qe.length,i!==null)for(var mt=i.suspenseyImages,ie=0,ne=0;ne<mt.length;ne++){var ue=mt[ne];if(!ue.complete){var we=ue.getBoundingClientRect();if(0<we.bottom&&0<we.right&&we.top<se.innerHeight&&we.left<se.innerWidth){if(ie+=Ek(ue),ie>i0){qe.length=ze;break}ue=new Promise(q9.bind(ue)),qe.push(ue)}}}if(0<qe.length)return se=Promise.race([Promise.all(qe),new Promise(function($e){return setTimeout($e,500)})]).then(v,v),(de?Promise.allSettled([de.finished,se]):se).then(w,w);if(v(),de)return de.finished.then(w,w);w()},types:d});ae.__reactViewTransition=ge;var Ce=[];return ge.ready.then(function(){for(var se=ae.documentElement.getAnimations({subtree:!0}),de=0;de<se.length;de++){var ze=se[de],qe=ze.effect,mt=qe.pseudoElement;if(mt!=null&&mt.startsWith("::view-transition")){Ce.push(ze),ze=qe.getKeyframes();for(var ie=mt=void 0,ne=!0,ue=0;ue<ze.length;ue++){var we=ze[ue],$e=we.width;if(mt===void 0)mt=$e;else if(mt!==$e){ne=!1;break}if($e=we.height,ie===void 0)ie=$e;else if(ie!==$e){ne=!1;break}delete we.width,delete we.height,we.transform==="none"&&delete we.transform}ne&&mt!==void 0&&ie!==void 0&&(qe.setKeyframes(ze),ne=getComputedStyle(qe.target,qe.pseudoElement),ne.width!==mt||ne.height!==ie)&&(ne=ze[0],ne.width=mt,ne.height=ie,ne=ze[ze.length-1],ne.width=mt,ne.height=ie,qe.setKeyframes(ze))}}_()},function(se){ae.__reactViewTransition===ge&&(ae.__reactViewTransition=null);try{if(typeof se=="object"&&se!==null)switch(se.name){case"InvalidStateError":(se.message==="View transition was skipped because document visibility state is hidden."||se.message==="Skipping view transition because document visibility state has become hidden."||se.message==="Skipping view transition because viewport size changed."||se.message==="Transition was aborted because of invalid state")&&(se=null)}se!==null&&Q(se)}finally{g(),v(),_()}}),ge.finished.finally(function(){for(var se=0;se<Ce.length;se++)Ce[se].cancel();ae.__reactViewTransition===ge&&(ae.__reactViewTransition=null),U()}),ge}catch{return g(),v(),_(),null}}function Tc(i,a){this._scope=document.documentElement,this._selector="::view-transition-"+i+"("+a+")"}Tc.prototype.animate=function(i,a){return a=typeof a=="number"?{duration:a}:A({},a),a.pseudoElement=this._selector,this._scope.animate(i,a)},Tc.prototype.getAnimations=function(){for(var i=this._scope,a=this._selector,d=i.getAnimations({subtree:!0}),g=[],v=0;v<d.length;v++){var w=d[v].effect;w!==null&&w.target===i&&w.pseudoElement===a&&g.push(d[v])}return g},Tc.prototype.getComputedStyle=function(){return getComputedStyle(this._scope,this._selector)};function rk(i){return{name:i,group:new Tc("group",i),imagePair:new Tc("image-pair",i),old:new Tc("old",i),new:new Tc("new",i)}}function Ps(i){this._fragmentFiber=i,this._observers=this._eventListeners=null}Ps.prototype.addEventListener=function(i,a,d){var g=null,v=null;if(!(d!=null&&typeof d!="boolean"&&(g=d.signal||null,g!==null&&g.aborted))){this._eventListeners===null&&(this._eventListeners=[]);var w=this._eventListeners;if(ok(w,i,a,d)===-1){var _=this,U=a;d!=null&&typeof d!="boolean"&&d.once===!0&&(U=function(Q){_.removeEventListener(i,a,d),typeof a=="function"?a.call(this,Q):a.handleEvent(Q)}),g!==null&&(v=_.removeEventListener.bind(_,i,a,d),g.addEventListener("abort",v,{once:!0}),v=g.removeEventListener.bind(g,"abort",v)),g=ad(d),w.push({type:i,listener:a,optionsOrUseCapture:d,attachedListener:U,cleanup:v}),p(this._fragmentFiber.child,!1,K9,i,U,g)}this._eventListeners=w}};function K9(i,a,d,g){return E(i).addEventListener(a,d,g),!1}Ps.prototype.removeEventListener=function(i,a,d){var g=this._eventListeners;if(g!==null&&(a=ok(g,i,a,d),a!==-1)){var v=g[a];d=v.attachedListener;var w=v.cleanup;v=ad(v.optionsOrUseCapture),p(this._fragmentFiber.child,!1,Y9,i,d,v),g.splice(a,1),w!==null&&w()}};function Y9(i,a,d,g){return E(i).removeEventListener(a,d,g),!1}function ad(i){return i!=null&&typeof i!="boolean"&&(i.once===!0||i.signal instanceof AbortSignal)?{capture:i.capture,passive:i.passive}:i}function sk(i){return i==null?"c=0":typeof i=="boolean"?"c="+(i?"1":"0"):"c="+(i.capture?"1":"0")}function ok(i,a,d,g){if(i.length===0)return-1;g=sk(g);for(var v=0;v<i.length;v++){var w=i[v];if(w.type===a&&w.listener===d&&sk(w.optionsOrUseCapture)===g)return v}return-1}Ps.prototype.dispatchEvent=function(i){var a=y(this._fragmentFiber);if(a===null)return!0;a=E(a);var d=this._eventListeners;if(d!==null&&0<d.length||!i.bubbles){var g=a.nodeType===9?a.createComment(""):document.createTextNode("");if(d)for(var v=0;v<d.length;v++){var w=d[v];g.addEventListener(w.type,w.attachedListener,ad(w.optionsOrUseCapture))}if(a.appendChild(g),i=g.dispatchEvent(i),d)for(v=0;v<d.length;v++)w=d[v],g.removeEventListener(w.type,w.attachedListener,ad(w.optionsOrUseCapture));return a.removeChild(g),i}return a.dispatchEvent(i)},Ps.prototype.focus=function(i){p(this._fragmentFiber.child,!0,ik,i,void 0,void 0)};function ik(i,a){return i.tag===6?!1:(i=E(i),iV(i,a))}Ps.prototype.focusLast=function(i){var a=[];p(this._fragmentFiber.child,!0,YS,a,void 0,void 0);for(var d=a.length-1;0<=d&&!ik(a[d],i);d--);};function YS(i,a){return a.push(i),!1}Ps.prototype.blur=function(){var i=y(this._fragmentFiber);i!==null&&(i=E(i),i=Eh(i).activeElement,i!==null&&p(this._fragmentFiber.child,!1,W9,i,void 0,void 0))};function W9(i,a){return i.tag===6?!1:(i=E(i),i===a||i.contains(a)?(a.blur(),!0):!1)}Ps.prototype.observeUsing=function(i){this._observers===null&&(this._observers=new Set),this._observers.add(i),p(this._fragmentFiber.child,!1,X9,i,void 0,void 0)};function X9(i,a){return i.tag===6||(i=E(i),a.observe(i)),!1}Ps.prototype.unobserveUsing=function(i){var a=this._observers;if(a!==null&&a.has(i)){a.delete(i),p(this._fragmentFiber.child,!1,Q9,i,void 0,void 0);for(var d=a=0;d<bo.length;d++){var g=bo[d];g.fragmentInstance===this&&g.observer===i?i.unobserve(g.instance):bo[a++]=g}bo.length=a}};function Q9(i,a){return i.tag===6||(i=E(i),a.unobserve(i)),!1}var bo=[],WS=!1;function Z9(i,a,d){bo.push({fragmentInstance:i,observer:a,instance:d}),WS||(WS=!0,lV(function(){WS=!1;var g=bo;bo=[];for(var v=0;v<g.length;v++){var w=g[v];w.observer.unobserve(w.instance)}}))}Ps.prototype.getClientRects=function(){var i=[];return p(this._fragmentFiber.child,!1,J9,i,void 0,void 0),i};function J9(i,a){if(i.tag===6){i=i.stateNode;var d=i.ownerDocument.createRange();d.selectNodeContents(i),a.push.apply(a,d.getClientRects())}else i=E(i),a.push.apply(a,i.getClientRects());return!1}Ps.prototype.getRootNode=function(i){var a=y(this._fragmentFiber);return a===null?this:E(a).getRootNode(i)},Ps.prototype.compareDocumentPosition=function(i){var a=y(this._fragmentFiber);if(a===null)return Node.DOCUMENT_POSITION_DISCONNECTED;var d=[];p(this._fragmentFiber.child,!1,YS,d,void 0,void 0);var g=E(a);if(d.length===0){if(d=g,x(this._fragmentFiber)){e:{for(a=this._fragmentFiber.return;a!==null;){if(a.tag===4){a=a.stateNode.containerInfo;break e}if(a.tag===3||a.tag===5||a.tag===27)break;a=a.return}a=null}a!=null&&(d=a)}a=this._fragmentFiber;var v=g=d.compareDocumentPosition(i);return d===i?v=Node.DOCUMENT_POSITION_CONTAINS:g&Node.DOCUMENT_POSITION_CONTAINED_BY&&(d=b(a)[1],d===null?v=Node.DOCUMENT_POSITION_PRECEDING:(i=E(d).compareDocumentPosition(i),v=i===0||i&Node.DOCUMENT_POSITION_FOLLOWING?Node.DOCUMENT_POSITION_FOLLOWING:Node.DOCUMENT_POSITION_PRECEDING)),v|=Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC}a=E(d[0]),v=E(d[d.length-1]);var w=x(this._fragmentFiber)?a.parentElement:g;if(w==null)return Node.DOCUMENT_POSITION_DISCONNECTED;g=w.compareDocumentPosition(a)&Node.DOCUMENT_POSITION_CONTAINED_BY,w=w.compareDocumentPosition(v)&Node.DOCUMENT_POSITION_CONTAINED_BY;var _=a.compareDocumentPosition(i),U=v.compareDocumentPosition(i),Q=_&Node.DOCUMENT_POSITION_CONTAINED_BY||U&Node.DOCUMENT_POSITION_CONTAINED_BY;return U=g&&w&&_&Node.DOCUMENT_POSITION_FOLLOWING&&U&Node.DOCUMENT_POSITION_PRECEDING,a=g&&a===i||w&&v===i||Q||U?Node.DOCUMENT_POSITION_CONTAINED_BY:!g&&a===i||!w&&v===i?Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC:_,a&Node.DOCUMENT_POSITION_DISCONNECTED||a&Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC||eV(a,this._fragmentFiber,d[0],d[d.length-1],i)?a:Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC};function eV(i,a,d,g,v){var w=Ns(v);if(i&Node.DOCUMENT_POSITION_CONTAINED_BY){if(d=!!w)e:{for(;w!==null;){if(w.tag===7&&(w===a||w.alternate===a)){d=!0;break e}w=w.return}d=!1}return d}if(i&Node.DOCUMENT_POSITION_CONTAINS){if(w===null)return w=v.ownerDocument,v===w||v===w.documentElement||v===w.body;e:{for(w=a,a=y(a);w!==null;){if(!(w.tag!==5&&w.tag!==3&&w.tag!==27||w!==a&&w.alternate!==a)){w=!0;break e}w=w.return}w=!1}return w}return i&Node.DOCUMENT_POSITION_PRECEDING?((a=!!w)&&!(a=w===d)&&(a=M(d,w,k),a===null?a=!1:(p(a,!0,T,w,d),w=C,C=null,a=w!==null)),a):i&Node.DOCUMENT_POSITION_FOLLOWING?((a=!!w)&&!(a=w===g)&&(a=M(g,w,k),a===null?a=!1:(p(a,!0,R,w,g),w=C,O=C=null,a=w!==null)),a):!1}function lk(i,a){var d=i.ownerDocument.createRange();d.selectNodeContents(i),i=d.getBoundingClientRect(),window.scrollTo(window.scrollX+i.left,a?window.scrollY+i.top:window.scrollY+i.bottom-window.innerHeight)}Ps.prototype.scrollIntoView=function(i){if(typeof i=="object")throw Error(r(566));var a=[];p(this._fragmentFiber.child,!1,YS,a,void 0,void 0);var d=i!==!1;if(a.length===0){var g=b(this._fragmentFiber);if(g=d?g[1]||g[0]||y(this._fragmentFiber):g[0]||g[1],g===null)return;if(g.tag===6){i=E(g),lk(i,d);return}if(g=E(g),g.nodeType!==9){if(g.nodeType===11){d="host"in g?g.host:null,d!==null&&d.scrollIntoView(i);return}g.scrollIntoView(i)}}for(g=d?a.length-1:0;g!==(d?-1:a.length);){var v=a[g];v.tag===6?(v=E(v),lk(v,d)):E(v).scrollIntoView(i),g+=d?-1:1}};function tV(i,a){return i=E(i),ak(i,a),!1}function ak(i,a){i.reactFragments==null&&(i.reactFragments=new Set),i.reactFragments.add(a)}function ck(i,a){var d=a._eventListeners;if(d!==null)for(var g=0;g<d.length;g++){var v=d[g];i.addEventListener(v.type,v.attachedListener,ad(v.optionsOrUseCapture))}i.nodeType!==3&&(d=a._observers,d!==null&&d.forEach(function(w){for(var _=0,U=0;U<bo.length;U++){var Q=bo[U];(Q.fragmentInstance!==a||Q.observer!==w||Q.instance!==i)&&(bo[_++]=Q)}bo.length=_,w.observe(i)}),ak(i,a))}function nV(i,a){var d=a._eventListeners;if(d!==null)for(var g=0;g<d.length;g++){var v=d[g];i.removeEventListener(v.type,v.attachedListener,ad(v.optionsOrUseCapture))}i.nodeType!==3&&(d=a._observers,d!==null&&d.forEach(function(w){typeof w.rootMargin=="string"?Z9(a,w,i):w.unobserve(i)}),i.reactFragments!=null&&i.reactFragments.delete(a))}function XS(i){var a=i.firstChild;for(a&&a.nodeType===10&&(a=a.nextSibling);a;){var d=a;switch(a=a.nextSibling,d.nodeName){case"HTML":case"HEAD":case"BODY":XS(d),Ol(d);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(d.rel.toLowerCase()==="stylesheet")continue}i.removeChild(d)}}function rV(i,a,d,g){for(;i.nodeType===1;){var v=d;if(i.nodeName.toLowerCase()!==a.toLowerCase()){if(!g&&(i.nodeName!=="INPUT"||i.type!=="hidden"))break}else if(g){if(!i[bi])switch(a){case"meta":if(!i.hasAttribute("itemprop"))break;return i;case"link":if(w=i.getAttribute("rel"),w==="stylesheet"&&i.hasAttribute("data-precedence"))break;if(w!==v.rel||i.getAttribute("href")!==(v.href==null||v.href===""?null:v.href)||i.getAttribute("crossorigin")!==(v.crossOrigin==null?null:v.crossOrigin)||i.getAttribute("title")!==(v.title==null?null:v.title))break;return i;case"style":if(i.hasAttribute("data-precedence"))break;return i;case"script":if(w=i.getAttribute("src"),(w!==(v.src==null?null:v.src)||i.getAttribute("type")!==(v.type==null?null:v.type)||i.getAttribute("crossorigin")!==(v.crossOrigin==null?null:v.crossOrigin))&&w&&i.hasAttribute("async")&&!i.hasAttribute("itemprop"))break;return i;default:return i}}else if(a==="input"&&i.type==="hidden"){var w=v.name==null?null:""+v.name;if(v.type==="hidden"&&i.getAttribute("name")===w)return i}else return i;if(i=eo(i.nextSibling),i===null)break}return null}function sV(i,a,d){if(a==="")return null;for(;i.nodeType!==3;)if((i.nodeType!==1||i.nodeName!=="INPUT"||i.type!=="hidden")&&!d||(i=eo(i.nextSibling),i===null))return null;return i}function uk(i,a){for(;i.nodeType!==8;)if((i.nodeType!==1||i.nodeName!=="INPUT"||i.type!=="hidden")&&!a||(i=eo(i.nextSibling),i===null))return null;return i}function QS(i){return i.data==="$?"||i.data==="$~"}function ZS(i){return i.data==="$!"||i.data==="$?"&&i.ownerDocument.readyState!=="loading"}function oV(i,a){var d=i.ownerDocument;if(i.data==="$~")i._reactRetry=a;else if(i.data!=="$?"||d.readyState!=="loading")a();else{var g=function(){a(),d.removeEventListener("DOMContentLoaded",g)};d.addEventListener("DOMContentLoaded",g),i._reactRetry=g}}function eo(i){for(;i!=null;i=i.nextSibling){var a=i.nodeType;if(a===1||a===3)break;if(a===8){if(a=i.data,a==="$"||a==="$!"||a==="$?"||a==="$~"||a==="&"||a==="F!"||a==="F")break;if(a==="/$"||a==="/&")return null}}return i}var JS=null;function dk(i){i=i.nextSibling;for(var a=0;i;){if(i.nodeType===8){var d=i.data;if(d==="/$"||d==="/&"){if(a===0)return eo(i.nextSibling);a--}else d!=="$"&&d!=="$!"&&d!=="$?"&&d!=="$~"&&d!=="&"||a++}i=i.nextSibling}return null}function fk(i){i=i.previousSibling;for(var a=0;i;){if(i.nodeType===8){var d=i.data;if(d==="$"||d==="$!"||d==="$?"||d==="$~"||d==="&"){if(a===0)return i;a--}else d!=="/$"&&d!=="/&"||a++}i=i.previousSibling}return null}function iV(i,a){function d(){g=!0}if(i.ownerDocument.activeElement===i)return!0;var g=!1;try{i.ownerDocument.addEventListener("focus",d,!0),(i.focus||HTMLElement.prototype.focus).call(i,a)}finally{i.ownerDocument.removeEventListener("focus",d,!0)}return g}function lV(i){ZA(function(){ZA(function(a){return i(a)})})}function hk(i,a,d){switch(a=Eh(d),i){case"html":if(i=a.documentElement,!i)throw Error(r(452));return i;case"head":if(i=a.head,!i)throw Error(r(453));return i;case"body":if(i=a.body,!i)throw Error(r(454));return i;default:throw Error(r(451))}}function pk(i,a,d){for(var g in d){var v=d[g];d.hasOwnProperty(g)&&v!=null&&Gt(i,a,g,null,j9,v)}d.dangerouslySetInnerHTML!=null&&(i.textContent=""),i.onclick===Gr&&(i.onclick=null),Ol(i)}function e1(i){for(var a=i.attributes;a.length;)i.removeAttributeNode(a[0]);Ol(i)}var to=new Map,mk=new Set;function Ch(i){if(typeof i.getRootNode=="function"){var a=i.getRootNode();if(a.nodeType===9||a.nodeType===11)return a}return i.nodeType===9?i:i.ownerDocument}var Li=oe.d;oe.d={f:aV,r:cV,D:uV,C:dV,L:fV,m:hV,X:mV,S:pV,M:gV};function aV(){var i=Li.f(),a=Qg();return i||a}function cV(i){var a=vi(i);a!==null&&a.tag===5&&a.type==="form"?yR(a):Li.r(i)}var cd=typeof document>"u"?null:document;function gk(i,a,d){var g=cd;if(g&&typeof a=="string"&&a){var v=ln(a);v='link[rel="'+i+'"][href="'+v+'"]',typeof d=="string"&&(v+='[crossorigin="'+d+'"]'),mk.has(v)||(mk.add(v),i={rel:i,crossOrigin:d,href:a},g.querySelector(v)===null&&(a=g.createElement("link"),vr(a,"link",i),Re(a),g.head.appendChild(a)))}}function uV(i){Li.D(i),gk("dns-prefetch",i,null)}function dV(i,a){Li.C(i,a),gk("preconnect",i,a)}function fV(i,a,d){Li.L(i,a,d);var g=cd;if(g&&i&&a){var v='link[rel="preload"][as="'+ln(a)+'"]';a==="image"&&d&&d.imageSrcSet?(v+='[imagesrcset="'+ln(d.imageSrcSet)+'"]',typeof d.imageSizes=="string"&&(v+='[imagesizes="'+ln(d.imageSizes)+'"]')):v+='[href="'+ln(i)+'"]';var w=v;switch(a){case"style":w=ud(i);break;case"script":w=dd(i)}if(!(to.has(w)||(i=A({rel:"preload",href:a==="image"&&d&&d.imageSrcSet?void 0:i,as:a},d),to.set(w,i),g.querySelector(v)!==null||a==="style"&&g.querySelector(Th(w))||a==="script"&&g.querySelector(Nh(w))))){var _=g.createElement("link");vr(_,"link",i),a==="style"&&(_[Nl]=!0,_.onload=_.onerror=function(){Ke(_)}),Re(_),g.head.appendChild(_)}}}function hV(i,a){Li.m(i,a);var d=cd;if(d&&i){var g=a&&typeof a.as=="string"?a.as:"script",v='link[rel="modulepreload"][as="'+ln(g)+'"][href="'+ln(i)+'"]',w=v;switch(g){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":w=dd(i)}if(!to.has(w)&&(i=A({rel:"modulepreload",href:i},a),to.set(w,i),d.querySelector(v)===null)){switch(g){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(d.querySelector(Nh(w)))return}g=d.createElement("link"),vr(g,"link",i),Re(g),d.head.appendChild(g)}}}function pV(i,a,d){Li.S(i,a,d);var g=cd;if(g&&i){var v=Ne(g).hoistableStyles,w=ud(i);a=a||"default";var _=v.get(w);if(!_){var U={loading:0,preload:null};if(_=g.querySelector(Th(w)))U.loading=5;else{i=A({rel:"stylesheet",href:i,"data-precedence":a},d),(d=to.get(w))&&t1(i,d);var Q=_=g.createElement("link");Re(Q),vr(Q,"link",i),Q._p=new Promise(function(ae,ge){Q.onload=ae,Q.onerror=ge}),Q.addEventListener("load",function(){U.loading|=1}),Q.addEventListener("error",function(){U.loading|=2}),U.loading|=4,s0(_,a,g)}_={type:"stylesheet",instance:_,count:1,state:U},v.set(w,_)}}}function mV(i,a){Li.X(i,a);var d=cd;if(d&&i){var g=Ne(d).hoistableScripts,v=dd(i),w=g.get(v);w||(w=d.querySelector(Nh(v)),w||(i=A({src:i,async:!0},a),(a=to.get(v))&&n1(i,a),w=d.createElement("script"),Re(w),vr(w,"link",i),d.head.appendChild(w)),w={type:"script",instance:w,count:1,state:null},g.set(v,w))}}function gV(i,a){Li.M(i,a);var d=cd;if(d&&i){var g=Ne(d).hoistableScripts,v=dd(i),w=g.get(v);w||(w=d.querySelector(Nh(v)),w||(i=A({src:i,async:!0,type:"module"},a),(a=to.get(v))&&n1(i,a),w=d.createElement("script"),Re(w),vr(w,"link",i),d.head.appendChild(w)),w={type:"script",instance:w,count:1,state:null},g.set(v,w))}}function yk(i,a,d,g){var v=(v=Pe.current)?Ch(v):null;if(!v)throw Error(r(446));switch(i){case"meta":case"title":return null;case"style":return typeof d.precedence=="string"&&typeof d.href=="string"?(d=ud(d.href),a=Ne(v).hoistableStyles,g=a.get(d),g||(g={type:"style",instance:null,count:0,state:null},a.set(d,g)),g):{type:"void",instance:null,count:0,state:null};case"link":if(d.rel==="stylesheet"&&typeof d.href=="string"&&typeof d.precedence=="string"){i=ud(d.href);var w=Ne(v).hoistableStyles,_=w.get(i);if(_||(v=v.ownerDocument||v,_={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},w.set(i,_),(w=v.querySelector(Th(i)))?w._p||(_.instance=w,_.state.loading=5):(w=to.get(i),w||(w={rel:"preload",as:"style",href:d.href,crossOrigin:d.crossOrigin,integrity:d.integrity,media:d.media,hrefLang:d.hrefLang,referrerPolicy:d.referrerPolicy},to.set(i,w)),yV(v,i,w,_.state))),a&&g===null)throw Error(r(528,""));return _}if(a&&g!==null)throw Error(r(529,""));return null;case"script":return a=d.async,d=d.src,typeof d=="string"&&a&&typeof a!="function"&&typeof a!="symbol"?(d=dd(d),a=Ne(v).hoistableScripts,g=a.get(d),g||(g={type:"script",instance:null,count:0,state:null},a.set(d,g)),g):{type:"void",instance:null,count:0,state:null};default:throw Error(r(444,i))}}function ud(i){return'href="'+ln(i)+'"'}function Th(i){return'link[rel="stylesheet"]['+i+"]"}function xk(i){return A({},i,{"data-precedence":i.precedence,precedence:null})}function yV(i,a,d,g){if(a=i.querySelector('link[rel="preload"][as="style"]['+a+"]")){if(a[Nl]!==!0){g.loading=1;return}}else a=i.createElement("link"),a[Nl]=!0,a.onload=a.onerror=Ke.bind(null,a),vr(a,"link",d),Re(a),i.head.appendChild(a);g.preload=a,a.addEventListener("load",function(){return g.loading|=1}),a.addEventListener("error",function(){return g.loading|=2})}function dd(i){return'[src="'+ln(i)+'"]'}function Nh(i){return"script[async]"+i}function bk(i,a,d){if(a.count++,a.instance===null)switch(a.type){case"style":var g=i.querySelector('style[data-href~="'+ln(d.href)+'"]');if(g)return a.instance=g,Re(g),g;var v=A({},d,{"data-href":d.href,"data-precedence":d.precedence,href:null,precedence:null});return g=(i.ownerDocument||i).createElement("style"),Re(g),vr(g,"style",v),s0(g,d.precedence,i),a.instance=g;case"stylesheet":v=ud(d.href);var w=i.querySelector(Th(v));if(w)return a.state.loading|=4,a.instance=w,Re(w),w;g=xk(d),(v=to.get(v))&&t1(g,v),w=(i.ownerDocument||i).createElement("link"),Re(w);var _=w;return _._p=new Promise(function(U,Q){_.onload=U,_.onerror=Q}),vr(w,"link",g),a.state.loading|=4,s0(w,d.precedence,i),a.instance=w;case"script":return w=dd(d.src),(v=i.querySelector(Nh(w)))?(a.instance=v,Re(v),v):(g=d,(v=to.get(w))&&(g=A({},d),n1(g,v)),i=i.ownerDocument||i,v=i.createElement("script"),Re(v),vr(v,"link",g),i.head.appendChild(v),a.instance=v);case"void":return null;default:throw Error(r(443,a.type))}else a.type==="stylesheet"&&(a.state.loading&4)===0&&(g=a.instance,a.state.loading|=4,s0(g,d.precedence,i));return a.instance}function s0(i,a,d){for(var g=d.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),v=g.length?g[g.length-1]:null,w=v,_=0;_<g.length;_++){var U=g[_];if(U.dataset.precedence===a)w=U;else if(w!==v)break}w?w.parentNode.insertBefore(i,w.nextSibling):(a=d.nodeType===9?d.head:d,a.insertBefore(i,a.firstChild))}function t1(i,a){i.crossOrigin==null&&(i.crossOrigin=a.crossOrigin),i.referrerPolicy==null&&(i.referrerPolicy=a.referrerPolicy),i.title==null&&(i.title=a.title)}function n1(i,a){i.crossOrigin==null&&(i.crossOrigin=a.crossOrigin),i.referrerPolicy==null&&(i.referrerPolicy=a.referrerPolicy),i.integrity==null&&(i.integrity=a.integrity)}var o0=null;function vk(i,a,d){if(o0===null){var g=new Map,v=o0=new Map;v.set(d,g)}else v=o0,g=v.get(d),g||(g=new Map,v.set(d,g));if(g.has(i))return g;for(g.set(i,null),d=d.getElementsByTagName(i),v=0;v<d.length;v++){var w=d[v];if(!(w[bi]||w[on]||i==="link"&&w.getAttribute("rel")==="stylesheet")&&w.namespaceURI!=="http://www.w3.org/2000/svg"){var _=w.getAttribute(a)||"";_=i+_;var U=g.get(_);U?U.push(w):g.set(_,[w])}}return g}function r1(i,a,d){i=i.ownerDocument||i,i.head.insertBefore(d,a==="title"?i.querySelector("head > title"):null)}function xV(i,a,d){if(d===1||a.itemProp!=null)return!1;switch(i){case"meta":case"title":return!0;case"style":if(typeof a.precedence!="string"||typeof a.href!="string"||a.href==="")break;return!0;case"link":if(typeof a.rel!="string"||typeof a.href!="string"||a.href===""||a.onLoad||a.onError)break;switch(a.rel){case"stylesheet":return i=a.disabled,typeof a.precedence=="string"&&i==null;default:return!0}case"script":if(a.async&&typeof a.async!="function"&&typeof a.async!="symbol"&&!a.onLoad&&!a.onError&&a.src&&typeof a.src=="string")return!0}return!1}function Sk(i,a){return i==="img"&&a.src!=null&&a.src!==""&&a.onLoad==null&&a.loading!=="lazy"}function wk(i){return!(i.type==="stylesheet"&&(i.state.loading&3)===0)}function Ek(i){return(i.width||100)*(i.height||100)*(typeof devicePixelRatio=="number"?devicePixelRatio:1)*.25}function Ck(i,a){typeof a.decode=="function"&&(i.imgCount++,a.complete||(i.imgBytes+=Ek(a),i.suspenseyImages.push(a)),i=SV.bind(i),a.decode().then(i,i))}function bV(i,a,d,g){if(d.type==="stylesheet"&&(typeof g.media!="string"||matchMedia(g.media).matches!==!1)&&(d.state.loading&4)===0){if(d.instance===null){var v=ud(g.href),w=a.querySelector(Th(v));if(w){a=w._p,a!==null&&typeof a=="object"&&typeof a.then=="function"&&(i.count++,i=Oh.bind(i),a.then(i,i)),d.state.loading|=4,d.instance=w,Re(w);return}w=a.ownerDocument||a,g=xk(g),(v=to.get(v))&&t1(g,v),w=w.createElement("link"),Re(w);var _=w;_._p=new Promise(function(U,Q){_.onload=U,_.onerror=Q}),vr(w,"link",g),d.instance=w}i.stylesheets===null&&(i.stylesheets=new Map),i.stylesheets.set(d,a),(a=d.state.preload)&&(d.state.loading&3)===0&&(i.count++,d=Oh.bind(i),a.addEventListener("load",d),a.addEventListener("error",d))}}var i0=0;function vV(i,a){return i.stylesheets&&i.count===0&&a0(i,i.stylesheets),0<i.count||0<i.imgCount?function(d){var g=setTimeout(function(){if(i.stylesheets&&a0(i,i.stylesheets),i.unsuspend){var w=i.unsuspend;i.unsuspend=null,w()}},6e4+a);0<i.imgBytes&&i0===0&&(i0=62500*z9());var v=setTimeout(function(){if(i.waitingForImages=!1,i.count===0&&(i.stylesheets&&a0(i,i.stylesheets),i.unsuspend)){var w=i.unsuspend;i.unsuspend=null,w()}},(i.imgBytes>i0?50:800)+a);return i.unsuspend=d,function(){i.unsuspend=null,clearTimeout(g),clearTimeout(v)}}:null}function Tk(i){if(i.count===0&&(i.imgCount===0||!i.waitingForImages)){if(i.stylesheets)a0(i,i.stylesheets);else if(i.unsuspend){var a=i.unsuspend;i.unsuspend=null,a()}}}function Oh(){this.count--,Tk(this)}function SV(){this.imgCount--,Tk(this)}var l0=null;function a0(i,a){i.stylesheets=null,i.unsuspend!==null&&(i.count++,l0=new Map,a.forEach(wV,i),l0=null,Oh.call(i))}function wV(i,a){if(!(a.state.loading&4)){var d=l0.get(i);if(d)var g=d.get(null);else{d=new Map,l0.set(i,d);for(var v=i.querySelectorAll("link[data-precedence],style[data-precedence]"),w=0;w<v.length;w++){var _=v[w];(_.nodeName==="LINK"||_.getAttribute("media")!=="not all")&&(d.set(_.dataset.precedence,_),g=_)}g&&d.set(null,g)}v=a.instance,_=v.getAttribute("data-precedence"),w=d.get(_)||g,w===g&&d.set(null,v),d.set(_,v),this.count++,g=Oh.bind(this),v.addEventListener("load",g),v.addEventListener("error",g),w?w.parentNode.insertBefore(v,w.nextSibling):(i=i.nodeType===9?i.head:i,i.insertBefore(v,i.firstChild)),a.state.loading|=4}}var fd={$$typeof:H,Provider:null,Consumer:null,_currentValue:re,_currentValue2:re,_threadCount:0};function EV(i,a,d,g,v,w,_,U,Q){this.tag=1,this.containerInfo=i,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=Do(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Do(0),this.hiddenUpdates=Do(null),this.identifierPrefix=g,this.onUncaughtError=v,this.onCaughtError=w,this.onRecoverableError=_,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=Q,this.transitionTypes=null,this.incompleteTransitions=new Map}function Nk(i,a,d,g,v,w,_,U,Q,ae,ge,Ce){return i=new EV(i,a,d,_,Q,ae,ge,Ce,U),a=1,w===!0&&(a|=24),w=hs(3,null,null,a),i.current=w,w.stateNode=i,a=xv(),a.refCount++,i.pooledCache=a,a.refCount++,w.memoizedState={element:g,isDehydrated:d,cache:a},wv(w),i}function Ok(i){return i?(i=zu,i):zu}function Rk(i,a,d,g,v,w){v=Ok(v),g.context===null?g.context=v:g.pendingContext=v,g=zl(a),g.payload={element:d},w=w===void 0?null:w,w!==null&&(g.callback=w),d=Bl(i,g,a),d!==null&&(ys(d,i,a),sh(d,i,a))}function Ak(i,a){if(i=i.memoizedState,i!==null&&i.dehydrated!==null){var d=i.retryLane;i.retryLane=d!==0&&d<a?d:a}}function s1(i,a){Ak(i,a),(i=i.alternate)&&Ak(i,a)}function kk(i){if(i.tag===13||i.tag===31){var a=ac(i,67108864);a!==null&&ys(a,i,67108864),s1(i,67108864)}}function _k(i){if(i.tag===13||i.tag===31){var a=js();a=ho(a);var d=ac(i,a);d!==null&&ys(d,i,a),s1(i,a)}}var hd=!0;function CV(i,a,d,g){var v=fe.T;fe.T=null;var w=oe.p;try{oe.p=2,o1(i,a,d,g)}finally{oe.p=w,fe.T=v}}function TV(i,a,d,g){var v=fe.T;fe.T=null;var w=oe.p;try{oe.p=8,o1(i,a,d,g)}finally{oe.p=w,fe.T=v}}function o1(i,a,d,g){if(hd){var v=i1(g);if(v===null)HS(i,a,g,c0,d),Ik(i,g);else if(OV(v,i,a,d,g))g.stopPropagation();else if(Ik(i,g),a&4&&-1<NV.indexOf(i)){for(;v!==null;){var w=vi(v);if(w!==null)switch(w.tag){case 3:if(w=w.stateNode,w.current.memoizedState.isDehydrated){var _=as(w.pendingLanes);if(_!==0){var U=w;for(U.pendingLanes|=2,U.entangledLanes|=2;_;){var Q=1<<31-Jt(_);U.entanglements[1]|=Q,_&=~Q}Go(w),(zt&6)===0&&(Yg=cn()+500,vh(0))}}break;case 31:case 13:U=ac(w,2),U!==null&&ys(U,w,2),Qg(),s1(w,2)}if(w=i1(g),w===null&&HS(i,a,g,c0,d),w===v)break;v=w}v!==null&&g.stopPropagation()}else HS(i,a,g,null,d)}}function i1(i){return i=rc(i),l1(i)}var c0=null;function l1(i){if(c0=null,i=Ns(i),i!==null){var a=o(i);if(a===null)i=null;else{var d=a.tag;if(d===13){if(i=l(a),i!==null)return i;i=null}else if(d===31){if(i=c(a),i!==null)return i;i=null}else if(d===3){if(a.stateNode.current.memoizedState.isDehydrated)return a.tag===3?a.stateNode.containerInfo:null;i=null}else a!==i&&(i=null)}}return c0=i,null}function Mk(i){switch(i){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"fullscreenerror":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"resize":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(cr()){case $r:return 2;case Es:return 8;case qn:case yt:return 32;case un:return 268435456;default:return 32}default:return 32}}var a1=!1,Ql=null,Zl=null,Jl=null,Rh=new Map,Ah=new Map,ea=[],NV="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 Ik(i,a){switch(i){case"focusin":case"focusout":Ql=null;break;case"dragenter":case"dragleave":Zl=null;break;case"mouseover":case"mouseout":Jl=null;break;case"pointerover":case"pointerout":Rh.delete(a.pointerId);break;case"gotpointercapture":case"lostpointercapture":Ah.delete(a.pointerId)}}function kh(i,a,d,g,v,w){return i===null||i.nativeEvent!==w?(i={blockedOn:a,domEventName:d,eventSystemFlags:g,nativeEvent:w,targetContainers:[v]},a!==null&&(a=vi(a),a!==null&&kk(a)),i):(i.eventSystemFlags|=g,a=i.targetContainers,v!==null&&a.indexOf(v)===-1&&a.push(v),i)}function OV(i,a,d,g,v){switch(a){case"focusin":return Ql=kh(Ql,i,a,d,g,v),!0;case"dragenter":return Zl=kh(Zl,i,a,d,g,v),!0;case"mouseover":return Jl=kh(Jl,i,a,d,g,v),!0;case"pointerover":var w=v.pointerId;return Rh.set(w,kh(Rh.get(w)||null,i,a,d,g,v)),!0;case"gotpointercapture":return w=v.pointerId,Ah.set(w,kh(Ah.get(w)||null,i,a,d,g,v)),!0}return!1}function Lk(i){var a=Ns(i.target);if(a!==null){var d=o(a);if(d!==null){if(a=d.tag,a===13){if(a=l(d),a!==null){i.blockedOn=a,yi(i.priority,function(){_k(d)});return}}else if(a===31){if(a=c(d),a!==null){i.blockedOn=a,yi(i.priority,function(){_k(d)});return}}else if(a===3&&d.stateNode.current.memoizedState.isDehydrated){i.blockedOn=d.tag===3?d.stateNode.containerInfo:null;return}}}i.blockedOn=null}function u0(i){if(i.blockedOn!==null)return!1;for(var a=i.targetContainers;0<a.length;){var d=i1(i.nativeEvent);if(d===null){d=i.nativeEvent;var g=new d.constructor(d.type,d);nc=g,d.target.dispatchEvent(g),nc=null}else return a=vi(d),a!==null&&kk(a),i.blockedOn=d,!1;a.shift()}return!0}function Dk(i,a,d){u0(i)&&d.delete(a)}function RV(){a1=!1,Ql!==null&&u0(Ql)&&(Ql=null),Zl!==null&&u0(Zl)&&(Zl=null),Jl!==null&&u0(Jl)&&(Jl=null),Rh.forEach(Dk),Ah.forEach(Dk)}function d0(i,a){i.blockedOn===a&&(i.blockedOn=null,a1||(a1=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,RV)))}var f0=null;function jk(i){f0!==i&&(f0=i,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){f0===i&&(f0=null);for(var a=0;a<i.length;a+=3){var d=i[a],g=i[a+1],v=i[a+2];if(typeof g!="function"){if(l1(g||d)===null)continue;break}var w=vi(d);w!==null&&(i.splice(a,3),a-=3,Uv(w,{pending:!0,data:v,method:d.method,action:g},g,v))}}))}function pd(i){function a(Q){return d0(Q,i)}Ql!==null&&d0(Ql,i),Zl!==null&&d0(Zl,i),Jl!==null&&d0(Jl,i),Rh.forEach(a),Ah.forEach(a);for(var d=0;d<ea.length;d++){var g=ea[d];g.blockedOn===i&&(g.blockedOn=null)}for(;0<ea.length&&(d=ea[0],d.blockedOn===null);)Lk(d),d.blockedOn===null&&ea.shift();if(d=(i.ownerDocument||i).$$reactFormReplay,d!=null)for(g=0;g<d.length;g+=3){var v=d[g],w=d[g+1],_=v[Yn]||null;if(typeof w=="function")_||jk(d);else if(_){var U=null;if(w&&w.hasAttribute("formAction")){if(v=w,_=w[Yn]||null)U=_.formAction;else if(l1(v)!==null)continue}else U=_.action;typeof U=="function"?d[g+1]=U:(d.splice(g,3),g-=3),jk(d)}}}function Pk(){function i(w){w.canIntercept&&w.info==="react-transition"&&w.intercept({handler:function(){return new Promise(function(_){return v=_})},focusReset:"manual",scroll:"manual"})}function a(){v!==null&&(v(),v=null),g||setTimeout(d,20)}function d(){if(!g&&!navigation.transition){var w=navigation.currentEntry;w&&w.url!=null&&navigation.navigate(w.url,{state:w.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var g=!1,v=null;return navigation.addEventListener("navigate",i),navigation.addEventListener("navigatesuccess",a),navigation.addEventListener("navigateerror",a),setTimeout(d,100),function(){g=!0,navigation.removeEventListener("navigate",i),navigation.removeEventListener("navigatesuccess",a),navigation.removeEventListener("navigateerror",a),v!==null&&(v(),v=null)}}}function c1(i){this._internalRoot=i}h0.prototype.render=c1.prototype.render=function(i){var a=this._internalRoot;if(a===null)throw Error(r(409));var d=a.current,g=js();Rk(d,g,i,a,null,null)},h0.prototype.unmount=c1.prototype.unmount=function(){var i=this._internalRoot;if(i!==null){this._internalRoot=null;var a=i.containerInfo;Rk(i.current,2,null,i,null,null),Qg(),a[Vr]=null}};function h0(i){this._internalRoot=i}h0.prototype.unstable_scheduleHydration=function(i){if(i){var a=ds();i={blockedOn:null,target:i,priority:a};for(var d=0;d<ea.length&&a!==0&&a<ea[d].priority;d++);ea.splice(d,0,i),d===0&&Lk(i)}};var zk=t.version;if(zk!=="19.3.0")throw Error(r(527,zk,"19.3.0"));oe.findDOMNode=function(i){var a=i._reactInternals;if(a===void 0)throw typeof i.render=="function"?Error(r(188)):(i=Object.keys(i).join(","),Error(r(268,i)));return i=f(a),i=i!==null?h(i):null,i=i===null?null:i.stateNode,i};var AV={bundleType:0,version:"19.3.0",rendererPackageName:"react-dom",currentDispatcherRef:fe,reconcilerVersion:"19.3.0"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var p0=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!p0.isDisabled&&p0.supportsFiber)try{An=p0.inject(AV),Ht=p0}catch{}}return Mh.createRoot=function(i,a){if(!s(i))throw Error(r(299));var d=!1,g="",v=OR,w=RR,_=AR;return a!=null&&(a.unstable_strictMode===!0&&(d=!0),a.identifierPrefix!==void 0&&(g=a.identifierPrefix),a.onUncaughtError!==void 0&&(v=a.onUncaughtError),a.onCaughtError!==void 0&&(w=a.onCaughtError),a.onRecoverableError!==void 0&&(_=a.onRecoverableError)),a=Nk(i,1,!1,null,null,d,g,null,v,w,_,Pk),i[Vr]=a.current,BS(i),new c1(a)},Mh.hydrateRoot=function(i,a,d){if(!s(i))throw Error(r(299));var g=!1,v="",w=OR,_=RR,U=AR,Q=null;return d!=null&&(d.unstable_strictMode===!0&&(g=!0),d.identifierPrefix!==void 0&&(v=d.identifierPrefix),d.onUncaughtError!==void 0&&(w=d.onUncaughtError),d.onCaughtError!==void 0&&(_=d.onCaughtError),d.onRecoverableError!==void 0&&(U=d.onRecoverableError),d.formState!==void 0&&(Q=d.formState)),a=Nk(i,1,!0,a,d??null,g,v,Q,w,_,U,Pk),a.context=Ok(null),d=a.current,g=js(),g=ho(g),v=zl(g),v.callback=null,Bl(d,v,g),d=g,a.current.lanes=d,Cs(a,d),Go(a),i[Vr]=a.current,BS(i),new h0(a)},Mh.version="19.3.0",Mh}var s_;function Nq(){if(s_)return h1.exports;s_=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),h1.exports=Tq(),h1.exports}var Oq=Nq();const o_=!1;var i_=N.use,a2=N.useLayoutEffect;function Pa(e){return e[e.length-1]}function KP(e,t){return typeof e=="function"?e(t):e}const c2=Object.prototype.hasOwnProperty;function YP(e){for(const t in e)if(c2.call(e,t))return!0;return!1}const ay=()=>Object.create(null),md=(e,t)=>Na(e,t,!0);function Na(e,t,n,r=0){if(e===t)return e;if(r++>500)return t;const s=Array.isArray(e)&&Array.isArray(t);if(!s&&!(My(e)&&My(t)))return t;const o=Object.keys(e),l=o.length,c=Object.keys(t),u=c.length;if(s?l!==e.length||u!==t.length||l&&Pa(o)!==`${l-1}`||u&&Pa(c)!==`${u-1}`:l!==Object.getOwnPropertyNames(e).length||u!==Object.getOwnPropertyNames(t).length||Object.getOwnPropertySymbols(t).length)return t;let f=0,h,p,y;if(s){for(;f<u&&(y=f,p=e[y],h=t[y],h=p===h?p:typeof p=="object"?Na(p,h,n,r):h,h===p);f++);if(f===u&&l===u)return e}else{let b=l===u,S=!0;for(;f<u;f++){y=c[f],p=e[y];const E=t[y];h=p===E?p:typeof p=="object"?Na(p,E,n,r):E,b&&(b=h===p&&(o[f]===y||c2.call(e,y))),S&&(S=Object.is(h,E)),o[f]=h}if(b)return Object.getOwnPropertySymbols(e).length?t:e;if(S)return t}const x=s?c.fill(0):n?ay():{};for(let b=0;b<u;b++)y=s?b:c[b],s?(p=e[y],b>f&&(h=t[y],h=p===h?p:typeof p=="object"?Na(p,h,n,r):h),x[y]=b<f?p:h):x[y]=o[b];return x}function My(e){var t;return!e||typeof e!="object"?!1:(((t=Object.getPrototypeOf(e))==null?void 0:t.constructor)??Object)===Object}function Qi(e,t,n,r){if(e===t)return!0;if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return!1;for(let s=0,o=e.length;s<o;s++){const l=e[s],c=t[s];if(l!==c&&!Qi(l,c,n,r))return!1}return!0}if(My(e)&&My(t)){if(n){for(const o in t)if((r||t[o]!==void 0)&&!Qi(e[o],t[o],n,r))return!1;return!0}let s=0;if(r)s=Object.keys(e).length;else for(const o in e)e[o]!==void 0&&s++;for(const o in t)if((r||t[o]!==void 0)&&(s--===0||!Qi(e[o],t[o],n,r)))return!1;return s===0}return!1}function Rq(e){return typeof(e==null?void 0:e.message)!="string"?!1:e.message.startsWith("Failed to fetch dynamically imported module")||e.message.startsWith("error loading dynamically imported module")||e.message.startsWith("Importing a module script failed")}const Aq=/[\x00-\x1f\x7f"<>`{}]/g;function kq(e){return e.replace(Aq,t=>"%"+t.charCodeAt(0).toString(16).toUpperCase().padStart(2,"0"))}function l_(e){let t;try{t=decodeURI(e)}catch{t=e.replaceAll(/%[0-9A-F]{2}/gi,n=>{try{return decodeURI(n)}catch{return n}})}return kq(t)}const _q=["http:","https:","mailto:","tel:"];function bp(e){var t,n;if(e[0]!=="/"&&e.includes(":"))return(n=(t=/^[\x00-\x20]*([a-z][a-z\d+.\t\n\r-]*:)/i.exec(e))==null?void 0:t[1])==null?void 0:n.replace(/[\t\n\r]/g,"").toLowerCase()}const WP=/^[\x00-\x20]*[\\/][\t\n\r]*[\\/]/;function XP(e,t){if(!e)return!1;if(WP.test(e))return!0;const n=bp(e);return n?!t.has(n):!1}function Ih(e){if(!e)return e;let t=e;if(/[%\\\x00-\x1f\x7f]/.test(e)){const n=/%25|%5C/gi;let r=0,s;for(t="";(s=n.exec(e))!==null;)t+=l_(e.slice(r,s.index))+s[0],r=n.lastIndex;t+=l_(r?e.slice(r):e)}return t}function Mq(e){return/[\s\u0080-\uFFFF]/.test(e)?e.replace(/\s|[^\u0000-\u007F]/gu,encodeURIComponent):e}function Iq(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function u2(){throw new Error("Invariant failed")}function Md(e){return e.replace(/\/{2,}/g,"/")}function QP(e){return e==="/"?e:e.replace(/^\/+/,"")}function ni(e){const t=e.length;return t>1&&e[t-1]==="/"?e.replace(/\/+$/,""):e}function ZP(e){return ni(QP(e))}function a_(e,t){return e!=null&&e.endsWith("/")&&e!=="/"&&e!==`${t}/`?e.slice(0,-1):e}function c_(e,t,n="never",r){if(t.includes("//")&&(t=Md(t)),t.startsWith("/"))return t.length===1||n==="preserve"?t:n==="always"?t.endsWith("/")?t:`${t}/`:t.endsWith("/")?t.slice(0,-1):t;const s=t===".";let o;if(r){o=s?e:e+"\0"+t;const f=r.get(o);if(f)return f}let l;if(s)l=e.split("/");else{for(e.includes("//")&&(e=Md(e)),l=e.split("/");l.length>1&&Pa(l)==="";)l.pop();const f=t.split("/");for(let h=0,p=f.length;h<p;h++){const y=f[h];y===""?h?h===p-1&&l.push(y):l=[y]:y===".."?l.length>1?l.pop():l=[""]:y==="."||l.push(y)}}l.length>1&&(Pa(l)===""?n==="never"&&l.pop():n==="always"&&l.push(""));const c=l.join("/"),u=(s?Md(c):c)||"/";return o&&r&&r.set(o,u),u}function Lq(e){const t=new Map(e.map(r=>[encodeURIComponent(r),r])),n=new RegExp([...t.keys()].join("|").replace(/[.*()]/g,"\\$&"),"g");return r=>r.replace(n,s=>t.get(s)??s)}function Dq(e){return e==null||e===""}function jq(e,t,n){if(typeof t!="string")return""+(t??void 0);const r=e==="_splat";if(r&&(!t||/^[a-zA-Z0-9\-._~!/]*$/.test(t)))return t;let s=encodeURIComponent(t);return r&&(s=s.replaceAll("%2F","/")),n?n(s):s}function u_(e,t,n,r,s){const o=e.endsWith("/")?"/":"";let l="";for(const c of t){if(typeof c=="string"){l+=c;continue}const[u,f,h,p]=c,y=u===2,x=y&&p!==void 0?p+o:p;let b=n[f];if(!(u===3&&b==null)){if(s&&(s[f]=b,y&&(s["*"]=b)),y&&Dq(b)){if(h==="/"&&!x)continue;b=""}l+=h+jq(f,b,r)+(x||"")}}return l+o||"/"}function lf(e){return(e==null?void 0:e.isNotFound)===!0}function Pq(){try{return sessionStorage}catch{return}}const zq="tsr-scroll-restoration-v1_3",Id=Pq();function Bq(){try{return JSON.parse((Id==null?void 0:Id.getItem("tsr-scroll-restoration-v1_3"))||"{}")}catch{return{}}}function Hq(){try{Id==null||Id.setItem(zq,JSON.stringify(ia))}catch{}}const ia=Bq(),d_="data-scroll-restoration-id",Fq=e=>e.state.__TSR_key||e.href;function $q(e){const t=e.getAttribute(d_);if(t)return`[${d_}="${t}"]`;let n="",r=e,s;for(;s=r.parentNode;){let o=1,l=r;for(;l=l.previousElementSibling;)o++;const c=`${r.localName}:nth-child(${o})`;n=n?`${c} > ${n}`:c,r=s}return n}let y0=!1;const cy="window";function Xw(e){try{return typeof e=="function"?e():document.querySelector(e)}catch{}}function f_(e){const t=new Set;for(const n of e){if(n===cy)continue;const r=Xw(n);r&&t.add(r)}return t}function Uq(e,t){const n=e.options.scrollRestoration,r=e._scroll;n&&(r.restoring=!0);const s=e.options.getScrollRestorationKey||Fq,o=new Set,l=c=>{const u=ia[c]||(ia[c]={});for(const f of o)f===document?u[cy]={scrollX,scrollY}:f.isConnected&&(u[$q(f)]={scrollX:f.scrollLeft,scrollY:f.scrollTop})};n&&!r.restoration&&(r.restoration=!0,y0=!1,history.scrollRestoration="manual",document.addEventListener("scroll",c=>{y0||o.add(c.target)},!0),e.subscribe("onBeforeLoad",c=>{c.fromLocation&&l(s(c.fromLocation)),o.clear()}),addEventListener("pagehide",()=>{l(s(e.stores.resolvedLocation.get()??e.stores.location.get())),Hq()})),!r.reset&&(r.reset=!0,e.subscribe("onRendered",c=>{var S;const u=e.options.scrollRestorationBehavior,f=e.options.scrollToTopSelectors,h=r.next,p=r.hash;let y;if(o.clear(),r.next=!0,r.hash=!1,typeof e.options.scrollRestoration=="function"&&!e.options.scrollRestoration({location:e.latestLocation}))return;const x=s(c.toLocation),b=c.fromLocation&&s(c.fromLocation);if(r.restoring&&b&&b!==x){const E=ia[b];if(E){let C=ia[x];for(const O in E){if(O===cy){if(h)continue}else{const T=Xw(O);if(!T||h&&f&&(y??(y=f_(f)),y.has(T)))continue}C||(C=ia[x]={}),C[O]??(C[O]=E[O])}}}y0=!0;try{const E=c.toLocation.hash,C=c.toLocation.state.__hashScrollIntoViewOptions??!0;let O=!1;if(h){!E&&f&&(y??(y=f_(f)));const T=E&&C&&p,R=r.restoring?ia[x]:void 0;if(R)for(const k in R){const{scrollX:M,scrollY:A}=R[k];if(k===cy){if(T)continue;scrollTo({top:A,left:M,behavior:u}),O=!0}else{const I=Xw(k);I&&(I.scrollLeft=M,I.scrollTop=A,y==null||y.delete(I))}}if(!E){const k={top:0,left:0,behavior:u};if(O||scrollTo(k),y)for(const M of y)M.scrollTo(k)}}!O&&E&&C&&((S=document.getElementById(E))==null||S.scrollIntoView(C))}finally{y0=!1}}))}function Vq(e,t=String){let n;for(const r in e){const s=e[r];s!==void 0&&(n||(n=new URLSearchParams)).set(r,t(s))}return n?n.toString():""}function y1(e){return e?e==="false"?!1:e==="true"?!0:+e*0===0&&+e+""===e?+e:e:""}function qq(e){const t=new URLSearchParams(e),n=Object.create(null);for(const[r,s]of t.entries()){const o=n[r];o==null?n[r]=y1(s):Array.isArray(o)?o.push(y1(s)):n[r]=[o,y1(s)]}return n}const JP=/^(?:\s|["[{\d-]|fa|nu|tr)/,Gq=Yq(JSON.parse),Kq=Wq(JSON.stringify,JSON.parse);function Yq(e){const t=e===JSON.parse;return n=>{n[0]==="?"&&(n=n.substring(1));const r=qq(n);for(const s in r){const o=r[s];if(typeof o=="string"){if(t&&!JP.test(o))continue;try{r[s]=e(o)}catch{}}}return r}}function Wq(e,t){const n=t===JSON.parse;function r(s){if(s&&typeof s=="object")try{return e(s)}catch{}else if(t&&typeof s=="string"){if(n&&!JP.test(s))return s;try{return t(s),e(s)}catch{}}return s}return s=>{const o=Vq(s,r);return o?`?${o}`:""}}const Ld="__root__";function Ix(e){e.statusCode=e.statusCode||e.code||307;const t=new Headers(e.headers);e.href&&t.get("Location")===null&&t.set("Location",e.href);const n=new Response(null,{status:e.statusCode,headers:t});if(n.options=e,e.throw)throw n;return n}function e4(e){return e instanceof Response&&!!e.options}function Iy(e){const t=new Map;let n,r;return{get(s){const o=t.get(s);if(o)return o.visited=!0,o.value},set(s,o){const l=t.get(s);if(l){l.value=o;return}if(t.size>=e){let u=n==null?void 0:n.next().value;for(;!u||u.visited;)u?u.visited=!1:n=t.values(),u=n.next().value;u===r&&(n=void 0),t.delete(u.key)}const c={key:s,value:o,visited:!1};r=c,t.set(s,c)},clear(){t.clear(),n=void 0,r=void 0}}}const Sa=4,t4=5;function Xq(e){const t=e.names;if(t)return t;const n=[];for(const r of e)typeof r!="string"&&n.push(r[1]);return e.names=n}function Qq(e,t,n){const r=e.substring(t,n);if(r.charCodeAt(0)===36)return r.length===1?[2,"_splat","",void 0]:[1,r.substring(1),"",""];const s=r.indexOf("{");if(s>=0){const o=r.indexOf("}",s),l=r.charCodeAt(s+1)===45,c=s+(l?3:2);if(o>=0&&r.charCodeAt(c-1)===36&&(!l||c<o)){const u=r.substring(c,o);return[l?3:u?1:2,u||"_splat",r.substring(0,s),e.substring(t+o+1,u?n:e.length)]}}return r}function vp(e,t,n,r,s,o){var C,O;let l=n;const c=t.fullPath??t.from,u=t.options,f=c.length,h=c.endsWith("/")?f-1:f,p=(u==null?void 0:u.caseSensitive)??e,y=((C=u==null?void 0:u.params)==null?void 0:C.parse)??(u==null?void 0:u.parseParams);let x,b=o?n-1:0;if(!r||c.includes("$")){x=(o==null?void 0:o.slice())??[];const T=Pa(x);T&&typeof T!="string"&&T[0]===2&&(x[x.length-1]=[T[0],T[1],T[2],T[3]===void 0?void 0:T[3]+c.substring(n-(c[n-2]==="/"?2:1),h)],b=f)}for(;l<f;){const T=l,R=c.indexOf("/",T);let k=R===-1?f:R;const M=Qq(c,T,k);l=k+1;let A;if(typeof M=="string"){if(!r)continue;let I=M,L;p?L=r.static??(r.static=new Map):(I=M.toLowerCase(),L=r.staticInsensitive??(r.staticInsensitive=new Map));const D=L.get(I);if(D)A=D;else{const P=Dc(r);A=P,L.set(I,P)}}else{const I=M[0];let L=M[2],D=M[3]??"";if(I===2&&(k=f,l=k+1),x&&b<k&&(b<T-1&&x.push(c.substring(b,T-1)),M[2]="/"+L,I===2&&M[3]!==void 0&&h<f&&(M[3]=D.slice(0,-1)),x.push(M),b=k),!r)continue;const P=p&&!!(L||D);p||(L=L.toLowerCase(),D=D.toLowerCase());const z=I===1?r.dynamic??(r.dynamic=[]):I===3?r.optional??(r.optional=[]):r.wildcard??(r.wildcard=[]),$=I!==2&&!y&&z.find(j=>!j.parse&&j.caseSensitive===P&&j.prefix===L&&j.suffix===D);if($)A=$;else{const j=Dc(r,I,P,L,D);A=j,z.push(j),z.length===2&&(s==null||s.push(z))}}r=A}x&&b<h&&x.push(c.substring(b,h));const S=x==null?void 0:x.slice();if(!r)return S;if(y&&t.children&&!t.isRoot&&t.id&&t.id.charCodeAt(t.id.lastIndexOf("/")+1)===95){const T=Dc(r,t4);(r.pathless??(r.pathless=[])).push(T),r=T}const E=(t.path||!t.children)&&!t.isRoot;if(E&&h<f){const T=Dc(r,Sa);r.index=T,r=T}return r.parse=y??null,r.priority=((O=u==null?void 0:u.params)==null?void 0:O.priority)??0,r.route||(r.data=S,E&&(r.route=t)),[r,l,S]}function n4(e,t){if(e.parse&&!t.parse)return-1;if(!e.parse&&t.parse)return 1;if(e.parse&&t.parse&&(e.priority||t.priority))return t.priority-e.priority;if(e.prefix&&t.prefix&&e.prefix!==t.prefix){if(e.prefix.startsWith(t.prefix))return-1;if(t.prefix.startsWith(e.prefix))return 1}if(e.suffix&&t.suffix&&e.suffix!==t.suffix){if(e.suffix.endsWith(t.suffix))return-1;if(t.suffix.endsWith(e.suffix))return 1}return e.prefix&&!t.prefix?-1:!e.prefix&&t.prefix?1:e.suffix&&!t.suffix?-1:!e.suffix&&t.suffix?1:e.caseSensitive&&!t.caseSensitive?-1:!e.caseSensitive&&t.caseSensitive?1:0}function Dc(e,t=0,n,r,s){return{kind:t,depth:e?e.depth+1:0,pathless:null,index:null,static:null,staticInsensitive:null,dynamic:null,optional:null,wildcard:null,route:null,data:void 0,parent:e,parse:null,priority:0,caseSensitive:n,prefix:r,suffix:s}}function Zq(e,t){const n=Dc(),r=[];function s(o,l,c,u){const[f,h,p]=vp(!1,o,l,c,r,u);if(o.children)for(const y of o.children)s(y,h,f,p)}for(const o of e)s(o,1,n);for(const o of r)o.sort(n4);t.masksTree=n,t.flatCache=Iy(1e3)}function Jq(e,t){e||(e="/");const n=t.flatCache.get(e);if(n!==void 0)return n;const r=d2(e,t.masksTree);return t.flatCache.set(e,r),r}function eG(e,t,n,r,s){e||(e="/"),r||(r="/");const o=t?`case\0${e}`:e;let l=s.singleCache.get(o);return l||(l=Dc(),vp(t,{from:e},1,l),s.singleCache.set(o,l)),d2(r,l,n)}function tG(e,t,n=!1){const r=n?e:`nofuzz\0${e}`,s=t.matchCache.get(r);if(s!==void 0)return s;e||(e="/");let o;try{o=d2(e,t.segmentTree,n)}catch(l){if(l instanceof URIError)o=null;else throw l}return o&&(o.branch=s4(o.route)),t.matchCache.set(r,o),o}function nG(e,t=!1){const n=Dc(),r=[],s={},o={};let l=0;function c(u,f,h,p){if(u.init(l),u.id in s&&u2(),s[u.id]=u,l!==0&&u.path){const S=ni(u.fullPath);(!o[S]||u.fullPath.endsWith("/"))&&(o[S]=u)}l++;const[y,x,b]=vp(t,u,f,h,r,p);if(u._interpolation=b,u.children)for(const S of u.children)c(S,x,y,b)}c(e,1,n);for(const u of r)u.sort(n4);return{processedTree:{segmentTree:n,singleCache:Iy(1e3),matchCache:Iy(1e3),flatCache:null,masksTree:null},routesById:s,routesByPath:o}}function d2(e,t,n=!1){const r=e.split("/"),s=sG(e,r,t,n);if(!s)return null;const[o]=r4(e,r,s);return{route:s.node.route,rawParams:o}}function r4(e,t,n){var h,p,y,x;const r=rG(n.node),s=n.node.data&&Xq(n.node.data),o=Object.create(null);let l=((h=n.extract)==null?void 0:h.part)??0,c=((p=n.extract)==null?void 0:p.node)??0,u=((y=n.extract)==null?void 0:y.path)??0,f=((x=n.extract)==null?void 0:x.param)??0;for(;c<r.length;l++,c++,u++){const b=r[c];if(b.kind===Sa)break;if(b.kind===t4){l--,u--;continue}const S=t[l],E=u;if(S&&(u+=S.length),b.kind===1||b.kind===3){const C=s[f++];if(b.kind===3&&n.skipped&1<<c){l--,u=E-1;continue}const O=b.suffix||b.prefix?S.substring(b.prefix.length,S.length-b.suffix.length):S;(O||b.kind===1)&&(o[C]=decodeURIComponent(O))}else if(b.kind===2){const C=b,O=e.substring(E+C.prefix.length,e.length-C.suffix.length),T=decodeURIComponent(O);o["*"]=T,o._splat=T;break}}return n.rawParams&&Object.assign(o,n.rawParams),[o,{part:l,node:c,path:u,param:f}]}function s4(e){const t=[e];for(;e.parentRoute;)e=e.parentRoute,t.push(e);return t.reverse(),t}function rG(e){const t=Array(e.depth+1);do t[e.depth]=e,e=e.parent;while(e);return t}function sG(e,t,n,r){if(e==="/"&&n.index)return{node:n.index,skipped:0};const s=!Pa(t),o=s&&e!=="/",l=t.length-(s?1:0),c=[{node:n,index:1,skipped:0,statics:0,dynamics:0,optionals:0}];let u=null,f=null;for(;c.length;){const h=c.pop(),{node:p,index:y,skipped:x,statics:b,dynamics:S,optionals:E}=h;let{extract:C,rawParams:O}=h;if(p.kind===2&&p.route&&!b0(f,h))continue;if(p.parse){if(!h_(e,t,h))continue;O=h.rawParams,C=h.extract}r&&p.route&&p.kind!==Sa&&b0(u,h)&&(u=h);const T=y===l;if(T&&(p.route&&(!o||p.kind===Sa||p.kind===2)&&b0(f,h)&&(f=h),!p.optional&&!p.wildcard&&!p.index&&!p.pathless))continue;const R=T?void 0:t[y];let k;if(T&&p.index){const M={node:p.index,index:y,skipped:x,statics:b,dynamics:S,optionals:E,extract:C,rawParams:O};let A=!0;if(p.index.parse&&(h_(e,t,M)||(A=!1)),A){if(!S&&!E&&!x&&oG(b,l))return M;b0(f,M)&&(f=M)}}if(p.wildcard)for(let M=p.wildcard.length-1;M>=0;M--){const A=p.wildcard[M],{prefix:I,suffix:L}=A;if(!(I&&(T||!(A.caseSensitive?R:k??(k=R.toLowerCase())).startsWith(I)))){if(L){if(T)continue;const D=t.slice(y).join("/"),P=D.slice(-L.length);if((A.caseSensitive?P:P.toLowerCase())!==L||D.length-L.length<I.length)continue}c.push({node:A,index:l,skipped:x,statics:b,dynamics:S,optionals:E,extract:C,rawParams:O})}}if(p.optional){const M=x|1<<p.depth+1;for(let A=p.optional.length-1;A>=0;A--){const I=p.optional[A];c.push({node:I,index:y,skipped:M,statics:b,dynamics:S,optionals:E,extract:C,rawParams:O})}if(!T)for(let A=p.optional.length-1;A>=0;A--){const I=p.optional[A],{prefix:L,suffix:D}=I;if(L||D){const P=I.caseSensitive?R:k??(k=R.toLowerCase());if(L&&!P.startsWith(L)||D&&P.indexOf(D,P.length-D.length)<L.length)continue}c.push({node:I,index:y+1,skipped:x,statics:b,dynamics:S,optionals:E+x0(l,y),extract:C,rawParams:O})}}if(!T&&p.dynamic&&R)for(let M=p.dynamic.length-1;M>=0;M--){const A=p.dynamic[M],{prefix:I,suffix:L}=A;if(I||L){const D=A.caseSensitive?R:k??(k=R.toLowerCase());if(I&&!D.startsWith(I)||L&&D.indexOf(L,D.length-L.length)<I.length)continue}c.push({node:A,index:y+1,skipped:x,statics:b,dynamics:S+x0(l,y),optionals:E,extract:C,rawParams:O})}if(!T&&p.staticInsensitive){const M=p.staticInsensitive.get(k??(k=R.toLowerCase()));M&&c.push({node:M,index:y+1,skipped:x,statics:b+x0(l,y),dynamics:S,optionals:E,extract:C,rawParams:O})}if(!T&&p.static){const M=p.static.get(R);M&&c.push({node:M,index:y+1,skipped:x,statics:b+x0(l,y),dynamics:S,optionals:E,extract:C,rawParams:O})}if(p.pathless)for(let M=p.pathless.length-1;M>=0;M--){const A=p.pathless[M];c.push({node:A,index:y,skipped:x,statics:b,dynamics:S,optionals:E,extract:C,rawParams:O})}}if(f)return f;if(r&&u){let h=u.index;for(let y=0;y<u.index;y++)h+=t[y].length;const p=h===e.length?"/":e.slice(h);return u.rawParams??(u.rawParams=Object.create(null)),u.rawParams["**"]=decodeURIComponent(p),u}return null}function x0(e,t){return 2**(e-t-1)}function oG(e,t){return e===2**(t-1)-1}function h_(e,t,n){let r,s;try{[r,s]=r4(e,t,n)}catch{return null}if(n.rawParams=r,n.extract=s,!n.node.parse)return!0;try{if(n.node.parse(r)===!1)return null}catch{}return!0}function b0(e,t){return e?t.statics>e.statics||t.statics===e.statics&&(t.dynamics>e.dynamics||t.dynamics===e.dynamics&&(t.optionals>e.optionals||t.optionals===e.optionals&&((t.node.kind===Sa)>(e.node.kind===Sa)||t.node.kind===Sa==(e.node.kind===Sa)&&t.node.depth>e.node.depth))):!0}function iG(e,t,n){const r=ZP(e),s=`/${r}`,o=t?s:s.toLowerCase(),l=`${o}/`,c={input:({url:u})=>{const f=t?u.pathname:u.pathname.toLowerCase();return f===o?u.pathname="/":f.startsWith(l)&&(u.pathname=u.pathname.slice(s.length)),u},output:({url:u})=>(u.pathname=Md(`/${r}${u.pathname}`),u)};return n?{input:({url:u})=>Qw(n,c.input({url:u})),output:({url:u})=>c.output({url:o4(n,u)})}:c}function Qw(e,t){var r;const n=(r=e==null?void 0:e.input)==null?void 0:r.call(e,{url:t});if(n){if(typeof n=="string")return new URL(n);if(n instanceof URL)return n}return t}function o4(e,t){var r;const n=(r=e==null?void 0:e.output)==null?void 0:r.call(e,{url:t});if(n){if(typeof n=="string")return new URL(n);if(n instanceof URL)return n}return t}function lG(e,t){const{createMutableStore:n,createReadonlyStore:r,batch:s}=t,o=new Map,l=n("idle"),c=n(e),u=n(void 0),f=n([]),h=r(()=>f.get().map(S=>o.get(S).get())),p=r(()=>({status:l.get(),isLoading:l.get()==="pending",matches:h.get(),location:c.get(),resolvedLocation:u.get()}));function y(S){let E=o.get(S);return E||(E=n(void 0),o.set(S,E)),E}const x={status:l,location:c,resolvedLocation:u,ids:f,matches:h,byRoute:o,__store:p,getMatchStore:y,setMatches:b};function b(S){const E=f.get(),C=S.map(O=>O.routeId);s(()=>{Iq(E,C)||f.set(C);for(const O of E)C.includes(O)||o.get(O).set(()=>{});for(const O of S){const T=y(O.routeId);T.get()!==O&&T.set(O)}})}return x}var Oa="__TSR_index",p_="popstate",m_="beforeunload",aG=/^[\x00-\x20]*(?:[\\/][\t\n\r]*){2,}/;function uy(e){const t=aG.exec(e);return t?"/"+e.slice(t[0].length):e}function i4(e){return/[\x00-\x1f\x7f]/.test(e)&&(e=e.replace(/[\x00-\x1f\x7f]/g,t=>`
|
|
51
|
+
\r`.includes(t)?"":encodeURIComponent(t))),uy(e)}function cG(e){let t=e.getLocation();const n=new Set,r=l=>{t=e.getLocation(),n.forEach(c=>c({location:t,action:l}))},s=l=>{e.notifyOnIndexChange??!0?r(l):t=e.getLocation()},o=async({task:l,navigateOpts:c,...u})=>{var p,y;if((c==null?void 0:c.ignoreBlocker)??!1){l();return}const f=((p=e.getBlockers)==null?void 0:p.call(e))??[],h=u.type==="PUSH"||u.type==="REPLACE";if(typeof document<"u"&&f.length&&h)for(const x of f){const b=Ly(u.path,u.state);if(await x.blockerFn({currentLocation:t,nextLocation:b,action:u.type})){(y=e.onBlocked)==null||y.call(e);return}}l()};return{get location(){return t},get length(){return e.getLength()},subscribers:n,subscribe:l=>(n.add(l),()=>{n.delete(l)}),push:(l,c,u)=>{const f=t.state[Oa];c=g_(f+1,c),o({task:()=>{e.pushState(l,c),r({type:"PUSH"})},navigateOpts:u,type:"PUSH",path:l,state:c})},replace:(l,c,u)=>{const f=t.state[Oa];c=g_(f,c),o({task:()=>{e.replaceState(l,c),r({type:"REPLACE"})},navigateOpts:u,type:"REPLACE",path:l,state:c})},go:(l,c)=>{o({task:()=>{e.go(l,(c==null?void 0:c.ignoreBlocker)??!1),s({type:"GO",index:l})},navigateOpts:c,type:"GO"})},back:l=>{o({task:()=>{e.back((l==null?void 0:l.ignoreBlocker)??!1),s({type:"BACK"})},navigateOpts:l,type:"BACK"})},forward:l=>{o({task:()=>{e.forward((l==null?void 0:l.ignoreBlocker)??!1),s({type:"FORWARD"})},navigateOpts:l,type:"FORWARD"})},canGoBack:()=>t.state[Oa]!==0,createHref:l=>e.createHref(l),block:l=>{var u;if(!e.setBlockers)return()=>{};const c=((u=e.getBlockers)==null?void 0:u.call(e))??[];return e.setBlockers([...c,l]),()=>{var h,p;const f=((h=e.getBlockers)==null?void 0:h.call(e))??[];(p=e.setBlockers)==null||p.call(e,f.filter(y=>y!==l))}},flush:()=>{var l;return(l=e.flush)==null?void 0:l.call(e)},destroy:()=>{var l;return(l=e.destroy)==null?void 0:l.call(e)},notify:r,_getBlockers:()=>{var l;return((l=e.getBlockers)==null?void 0:l.call(e))??[]}}}function g_(e,t){const n=f2();return{...t,key:n,__TSR_key:n,[Oa]:e}}function uG(e){var A,I;const t=typeof document<"u"?window:void 0,n=t.history.pushState,r=t.history.replaceState;let s=[];const o=()=>s,l=L=>s=L,c=L=>i4(L),u=(()=>Ly(`${t.location.pathname}${t.location.search}${t.location.hash}`,t.history.state));if(!((A=t.history.state)!=null&&A.__TSR_key)&&!((I=t.history.state)!=null&&I.key)){const L=f2();t.history.replaceState({[Oa]:0,key:L,__TSR_key:L},"")}let f=u(),h,p=!1,y=!1,x=!1,b=!1;const S=()=>f;let E;const C=()=>{E&&(M._ignoreSubscribers=!0,(E[2]?t.history.pushState:t.history.replaceState)(E[1],"",E[0]),M._ignoreSubscribers=!1,E=void 0,h=void 0)},O=(L,D,P)=>{const z=!!E;z||(h=f),f=Ly(D,P),E=[f.href,P,(E==null?void 0:E[2])||L],z||queueMicrotask(()=>C())},T=L=>{f=u(),M.notify({type:L})},R=async()=>{if(b=!1,y){y=!1;return}const L=u(),D=L.state[Oa]-f.state[Oa],P=D===1,z=D===-1,$=!P&&!z||p;p=!1;const j=$?"GO":z?"BACK":"FORWARD",H=$?{type:"GO",index:D}:{type:z?"BACK":"FORWARD"};if(x)x=!1;else{const B=o();if(typeof document<"u"&&B.length){for(const V of B)if(await V.blockerFn({currentLocation:f,nextLocation:L,action:j})){y=!0,t.history.go(-D),M.notify(H);return}}}f=u(),M.notify(H)},k=L=>{if(b){b=!1;return}let D=!1;const P=o();if(typeof document<"u"&&P.length)for(const z of P){const $=z.enableBeforeUnload??!0;if($===!0){D=!0;break}if(typeof $=="function"&&$()===!0){D=!0;break}}if(D)return L.preventDefault(),L.returnValue=""},M=cG({getLocation:S,getLength:()=>t.history.length,pushState:(L,D)=>O(!0,L,D),replaceState:(L,D)=>O(!1,L,D),back:L=>(L&&(x=!0,b=!0),t.history.back()),forward:L=>{L&&(x=!0,b=!0),t.history.forward()},go:(L,D)=>{p=!0,D&&(x=!0,b=!0),t.history.go(L)},createHref:L=>c(L),flush:C,destroy:()=>{t.history.pushState=n,t.history.replaceState=r,t.removeEventListener(m_,k,{capture:!0}),t.removeEventListener(p_,R)},onBlocked:()=>{h&&f!==h&&(f=h)},getBlockers:o,setBlockers:l,notifyOnIndexChange:!1});return M._ignoreNextBeforeUnload=L=>{b=!1;try{L=new URL(L,t.document.baseURI).href,b=/^https?:/.test(L)&&(!L.includes("#")||L.split("#")[0]!==t.location.href.split("#")[0])}catch{}},t.addEventListener(m_,k,{capture:!0}),t.addEventListener(p_,R),t.history.pushState=function(...L){const D=n.apply(t.history,L);return M._ignoreSubscribers||T("PUSH"),D},t.history.replaceState=function(...L){const D=r.apply(t.history,L);return M._ignoreSubscribers||T("REPLACE"),D},M}function Ly(e,t){const n=i4(e),r=n.indexOf("#"),s=n.indexOf("?");if(!t){const o=f2();t={[Oa]:0,key:o,__TSR_key:o}}return{href:n,pathname:n.substring(0,r>0?s>0?Math.min(r,s):r:s>0?s:n.length),hash:r>-1?n.substring(r):"",search:s>-1?n.slice(s,r===-1?void 0:r):"",state:t}}function f2(){return(Math.random()+1).toString(36).substring(7)}function x1(e,t){return e.protocol!=="http:"&&e.protocol!=="https:"||e.origin!==t||!!e.username||!!e.password}function b1(e){return e.pathname+e.search+e.hash}function y_(e){var t,n;return e.options.loader||e.options.beforeLoad||e.lazyFn||((t=e.options.component)==null?void 0:t.preload)||((n=e.options.pendingComponent)==null?void 0:n.preload)}function Lx(e,t){return{fromLocation:t,toLocation:e,pathChanged:(t==null?void 0:t.pathname)!==e.pathname,hrefChanged:(t==null?void 0:t.href)!==e.href,hashChanged:(t==null?void 0:t.hash)!==e.hash}}function x_({key:e,__TSR_key:t,__TSR_index:n,__hashScrollIntoViewOptions:r,...s}){return s}function dG(e){return e.findIndex(t=>t.status==="error"||t.status==="notFound"||t._notFound)+1}function fG(e,t,n,r,s,o){var l,c,u,f;r&&(t=t.slice(0,r)),s&&(n=n.slice(0,s));for(const h of t){if(o&&e._tx!==o)return;n.some(p=>p.routeId===h.routeId)||(c=(l=e.routesById[h.routeId].options).onLeave)==null||c.call(l,h)}for(const h of n){if(o&&e._tx!==o)return;(f=(u=e.routesById[h.routeId].options)[t.some(p=>p.routeId===h.routeId)?"onStay":"onEnter"])==null||f.call(u,h)}}var hG=class{constructor(e,t){var n;this.tempLocationKey=`${Math.round(Math.random()*1e7)}`,this._scroll={next:!0},this.subscribers=new Set,this._cache=new Map,this._committed=[],this.startTransition=async r=>(r(),!1),this.update=r=>{const s=this.options;this.options={...s,...r},this.isServer=this.options.isServer??o_??typeof document>"u",this.staticLocations=new WeakMap,this.protocolAllowlist=new Set(this.options.protocolAllowlist),(!this.history||this.options.history&&this.options.history!==this.history)&&(this.options.history?this.history=this.options.history:this.history=uG()),this.origin=this.options.origin,this.origin||(window!=null&&window.origin&&window.origin!=="null"?this.origin=window.origin:this.origin="http://localhost");const o=this.options.basepath??"/",l=this.options.rewrite,c=this.basepath!==o||(s==null?void 0:s.rewrite)!==l||(s==null?void 0:s.caseSensitive)!==this.options.caseSensitive;if(c&&(this.basepath=o,this.rewrite=o!=="/"&&ZP(o)?iG(o,this.options.caseSensitive,l):l),this.history&&this.updateLatestLocation(),this.options.routeTree!==this.routeTree||o_){this.routeTree=this.options.routeTree;let u;u=this.buildRouteTree(),this.setRoutes(u)}if(this.stores)c&&this.stores.location.set(this.latestLocation);else if(this.latestLocation){const u=this.getStoreConfig(this);this.batch=u.batch,this.stores=lG(this.latestLocation,u),Uq(this)}},this.updateLatestLocation=()=>{this.latestLocation=this.parseLocation(this.history.location,this.latestLocation)},this.buildRouteTree=()=>{const r=nG(this.routeTree,this.options.caseSensitive);return this.options.routeMasks&&Zq(this.options.routeMasks,r.processedTree),{...r,resolvePathCache:Iy(1e3)}},this.subscribe=(r,s)=>{const o={eventType:r,fn:s};return this.subscribers.add(o),()=>{this.subscribers.delete(o)}},this.emit=r=>{for(const s of this.subscribers)if(s.eventType===r.type)try{s.fn(r)}catch(o){console.error(o)}},this.parseLocation=(r,s)=>{const o=({pathname:f,search:h,hash:p,href:y},x)=>{if(!this.rewrite&&!/[ \x00-\x1f\x7f\u0080-\uffff]/.test(f)){const C=this.options.parseSearch(h),O=this.options.stringifySearch(C);return{href:f+O+p,publicHref:f+O+p,pathname:Ih(f),external:!1,searchStr:O,search:md(s==null?void 0:s.search,C),hash:Ih(p.slice(1)),state:Na(s==null?void 0:s.state,x)}}const b=Qw(this.rewrite,new URL(y,this.origin)),S=this.options.parseSearch(b.search),E=this.options.stringifySearch(S);return b.search=E,{href:b.href.replace(b.origin,""),publicHref:y,pathname:Ih(uy(b.pathname)),external:!!this.rewrite&&x1(b,this.origin),searchStr:E,search:md(s==null?void 0:s.search,S),hash:Ih(b.hash.slice(1)),state:Na(s==null?void 0:s.state,x)}},l=o(r,r.state),{__tempLocation:c,__tempKey:u}=l.state;if(c&&(!u||u===this.tempLocationKey)){const f=o(c,{...c.state,__tempLocation:void 0,key:l.state.key,__TSR_key:l.state.__TSR_key});return f.maskedLocation=l,f}return l},this.matchRoutes=(r,s,o)=>typeof r=="string"?this.matchRoutesInternal({pathname:r,search:s},o):this.matchRoutesInternal(r,s),this.getMatchedRoutes=r=>{const s=Object.create(null),o=tG(ni(r),this.processedTree,!0);return o&&Object.assign(s,o.rawParams),[(o==null?void 0:o.branch)||[this.routesById.__root__],s,o==null?void 0:o.route]},this.buildLocation=r=>{{const c=this.staticLocations.get(r);if(c)return c}let s=!1;const o=(c={})=>{var H;if(c.href){const B=Ly(c.href,{});c={...c,to:Qw(this.rewrite,new URL(B.pathname,this.origin)).pathname,search:this.options.parseSearch(B.search),hash:B.hash.slice(1)}}const u=c._fromLocation||this._pendingLocation||this.latestLocation;let f;const h=()=>(s=!0,u),p=()=>(s=!0,f??(f=this.matchRoutesLightweight(u))),y=c.to?`${c.to}`:".",x=c_(y[0]==="/"?"":c.unsafeRelative==="path"?h().pathname:c.from??p()[1],y,this.options.trailingSlash,this.resolvePathCache),b=this.routesByPath[ni(x)],S=x.includes("$");let E;if(b)E=b._branch??(b._branch=s4(b));else if(S)E=[];else{const[B,V,G]=this.getMatchedRoutes(x);E=B,this.options.notFoundRoute&&(!G||G.path!=="/"&&V["**"])&&(E=[...E,this.options.notFoundRoute])}const C=S?(b==null?void 0:b._interpolation)??vp(!1,{fullPath:x},0):void 0;let O;for(const B of E){const V=((H=B.options.params)==null?void 0:H.stringify)??B.options.stringifyParams;if(V){const G=p()[3];if(O??(O=v1(c.params,G)),!YP(O))break;O===G&&(O=Object.assign(ay(),O));try{Object.assign(O,V(O))}catch{}}}O??(O=v1(c.params,mG(c.params,C)?p()[3]:S1));const T=r.leaveParams?x:uy(Ih(C?u_(x,C,O,this.pathParamsDecoder):x)),R=gG(E,r._includeValidateSearch),k=()=>{var V;let B=p()[2];if(r._includeValidateSearch&&((V=this.options.search)!=null&&V.strict)){const G={};E.forEach(q=>{if(q.options.validateSearch)try{Object.assign(G,dy(q.options.validateSearch,{...G,...B}))}catch{}}),B=G}return B},M=R.length?yG(R,k(),c):c.search===!0?k():typeof c.search=="function"?c.search(k()):c.search||S1,A=this.options.stringifySearch(M),I=c.hash===!0?h().hash:typeof c.hash=="function"?c.hash(h().hash):c.hash||void 0,L=I?`#${I}`:"",D=c.state?c.state===!0?h().state:typeof c.state=="function"?c.state(h().state):c.state:S1,P=`${T}${A}${L}`;let z,$,j=!1;if(this.rewrite){const B=new URL(P,this.origin),V=B.origin,G=o4(this.rewrite,B);z=b1(B),x1(G,V)?($=G.href,j=!0):$=uy(b1(G))}else z=Mq(P),$=z;return{publicHref:$,href:z,pathname:T,search:M,searchStr:A,state:D,hash:I??"",external:j,unmaskOnReload:c.unmaskOnReload}},l=o(r);if(r.mask)l.maskedLocation=o({from:r.from,...r.mask});else if(this.options.routeMasks){const c=Jq(l.pathname,this.processedTree);if(c){const u=Object.assign(ay(),c.rawParams),{from:f,params:h,...p}=c.route,y=v1(h,u);l.maskedLocation=o({from:r.from,...p,params:y})}}return!s&&r._fromLocation&&!l.maskedLocation&&this.staticLocations.set(r,l),l},this.commitLocation=async({viewTransition:r,ignoreBlocker:s,...o})=>{const l=o.maskedLocation??o;if(l.external)return b_(this,l.publicHref,{replace:o.replace,ignoreBlocker:s});let c;const u=ni(this.latestLocation.href)===ni(o.href)&&Qi(x_(o.state),x_(this.latestLocation.state)),f=this._commitPromise;let h;const p=new Promise(y=>{h=y});if(p.resolve=()=>{h(),f==null||f.resolve()},this._commitPromise=p,u)this.load();else{let{maskedLocation:y,hashScrollIntoView:x,...b}=o;y&&(b={...y,state:{...y.state,__tempKey:void 0,__tempLocation:{...b,search:b.searchStr,state:{...b.state,__tempKey:void 0,__tempLocation:void 0,__TSR_key:void 0,key:void 0}}}},(b.unmaskOnReload??this.options.unmaskOnReload??!1)&&(b.state.__tempKey=this.tempLocationKey)),b.state={...b.state,__hashScrollIntoViewOptions:x??this.options.defaultHashScrollIntoView??!0},this.shouldViewTransition=r,c=o.replace?"REPLACE":"PUSH",this.history[c==="REPLACE"?"replace":"push"](b.publicHref,b.state,{ignoreBlocker:s}),this.history.subscribers.size||this.load({action:{type:c}})}return this._scroll.next=o.resetScroll??!0,this._commitPromise},this.buildAndCommitLocation=({replace:r,resetScroll:s,hashScrollIntoView:o,viewTransition:l,ignoreBlocker:c,...u}={})=>{const f=this.buildLocation({...u,_includeValidateSearch:!0});this._pendingLocation=f;const h=this.commitLocation({...f,viewTransition:l,replace:r,resetScroll:s,hashScrollIntoView:o,ignoreBlocker:c});return queueMicrotask(()=>{this._pendingLocation===f&&(this._pendingLocation=void 0)}),h},this.navigate=async({to:r,reloadDocument:s,href:o,publicHref:l,...c})=>{const u=o?bp(o):void 0;if(u||s){if(r!==void 0||!o){const h=this.buildLocation({to:r,...c}),p=h.maskedLocation??h;o??(o=p.publicHref),l??(l=p.publicHref)}return b_(this,!u&&l?l:o,c)}return this.buildAndCommitLocation({...c,href:o,to:r,_isNavigate:!0})},this.load=async r=>{this.updateLatestLocation(),r!=null&&r.action&&(this._scroll.hash=r.action.type==="PUSH"||r.action.type==="REPLACE"),await NG(this,r)},this.startViewTransition=r=>{var o,l;const s=this.shouldViewTransition??this.options.defaultViewTransition;if(this.shouldViewTransition=void 0,s&&typeof document.startViewTransition=="function"){let c;if(typeof s=="object"&&((l=(o=window.CSS)==null?void 0:o.supports)!=null&&l.call(o,"selector(:active-view-transition-type(a))"))){const u=this.latestLocation,f=this.stores.resolvedLocation.get(),h=typeof s.types=="function"?s.types(Lx(u,f)):s.types;if(h===!1)return r();c={update:r,types:h}}else c=r;return document.startViewTransition(c).updateCallbackDone}return r()},this.invalidate=r=>{var p,y;const s=this._committed,o=r==null?void 0:r.filter,l=this._preloads,c=new Set,u=x=>{(!o||o(x))&&c.add(x.id)};s.forEach(u),this._cache.forEach(u),l==null||l.forEach(x=>x.forEach(u)),(p=this._tx)==null||p[3].forEach(u);const f=[];for(const[x,b]of l??[])b.some(S=>c.has(S.id))&&(l.delete(x),f.push(x));const h=x=>{if(c.has(x.id)){const b=this.routesById[x.routeId],S={...x,invalid:!0,...(r!=null&&r.forcePending||x.status==="error"||x.status==="notFound")&&y_(b)?{status:"pending",error:void 0}:void 0};return x._flight=void 0,S}return x};this._committed=s.map(h);for(const[x,b]of this._cache)c.has(x)&&(b.invalid=!0,r!=null&&r.forcePending&&(b.status="pending"));for(const x of c)(y=this._flights)==null||y.delete(x);for(const x of f)x.abort();return this.shouldViewTransition=!1,this.load({sync:r==null?void 0:r.sync})},this.resolveRedirect=r=>{const s=r.options;let o=r.headers.get("Location")||s.href;if(!o){const c=this.buildLocation(s);o=(c.maskedLocation??c).publicHref||"/"}let l;if(WP.test(o)||(l=bp(o))&&!this.protocolAllowlist.has(l))throw new Error("Redirect blocked: unsafe protocol");if(l==="http:"||l==="https:"){const c=new URL(o);c.pathname.startsWith("//")?o=c.href:x1(c,this.origin)||(o=b1(c),l=void 0)}return l&&(s.reloadDocument=!0),s.href=o,r.headers.set("Location",o),r},this.clearCache=r=>{var h;const s=this._cache,o=this._preloads,l=r==null?void 0:r.filter,c=[],u=[];for(const[p,y]of s)(!l||l(y))&&(u.push(p),c.push(y));const f=[];for(const[p,y]of o??[])(!l||y.some(l))&&(f.push(p),c.push(...y));for(const p of u)s.delete(p);for(const p of f)o.delete(p);for(const p of c){const y=p._flight;p._flight=void 0,y&&!--y[2]&&(((h=this._flights)==null?void 0:h.get(p.id))===y&&this._flights.delete(p.id),f.push(y[1]))}for(const p of f)p.abort()},this.loadRouteChunk=Dd,this.preloadRoute=r=>OG(this,r),this.matchRoute=(r,s)=>{const o={...r,to:r.to?c_(r.from||"",r.to,this.options.trailingSlash,this.resolvePathCache):void 0,params:r.params||{},leaveParams:!0},l=this.buildLocation(o),c=this.stores.status.get()==="pending";if(s!=null&&s.pending&&!c)return!1;const u=(s==null?void 0:s.pending)??!c?this.latestLocation:this.stores.resolvedLocation.get()||this.stores.location.get(),f=eG(l.pathname,(s==null?void 0:s.caseSensitive)??!1,(s==null?void 0:s.fuzzy)??!1,u.pathname,this.processedTree);return!f||r.params&&!Qi(f.rawParams,r.params,!0)?!1:(s==null?void 0:s.includeSearch)??!0?Qi(u.search,l.search,!0)?f.rawParams:!1:f.rawParams},this.getStoreConfig=t,(n=e.pathParamsAllowedCharacters)!=null&&n.length&&(this.pathParamsDecoder=Lq(e.pathParamsAllowedCharacters)),this.update({defaultPreloadDelay:50,defaultPendingMs:1e3,defaultPendingMinMs:500,context:void 0,...e,caseSensitive:e.caseSensitive??!1,notFoundMode:e.notFoundMode??"fuzzy",stringifySearch:e.stringifySearch??Kq,parseSearch:e.parseSearch??Gq,protocolAllowlist:e.protocolAllowlist??_q}),self.__TSR_ROUTER__=this}isShell(){return!!this.options.isShell}get state(){return this.stores.__store.get()}setRoutes(e){Object.assign(this,e),this.lightweightCache=new WeakMap,this.staticLocations=new WeakMap;const t=this.options.notFoundRoute;t&&(t.init(99999999999),this.routesById[t.id]!==t&&(t._interpolation=vp(!1,t,0)),this.routesById[t.id]=t)}matchRoutesInternal(e,t){var y,x;const[n,r,s]=this.getMatchedRoutes(e.pathname);let o=n,l=!1;(s?s.path!=="/"&&r["**"]:ni(e.pathname))&&(this.options.notFoundRoute?o=[...o,this.options.notFoundRoute]:l=!0);const c=l?xG(this.options.notFoundMode,o):void 0,u=new Array(o.length),f=this._committed,h=(b,S)=>{const E=f[S];return(E==null?void 0:E.routeId)===b.id?E:b===this.options.notFoundRoute?f.find(C=>C.routeId===b.id):void 0};let p;for(let b=0;b<o.length;b++){const S=o[b],E=u[b-1];let C,O,T;{const H=(E==null?void 0:E.search)??e.search,B=(E==null?void 0:E._strictSearch)??void 0;try{const V=dy(S.options.validateSearch,{...H})??void 0;C={...H,...V},O={...B,...V}}catch(V){let G=V;if(V instanceof Dy||(G=new Dy(V.message,{cause:V})),t!=null&&t.throwOnError)throw G;C=H,O={},T=G}}let R="",k="";try{R=((x=(y=S.options).loaderDeps)==null?void 0:x.call(y,{search:C}))??"",k=R&&JSON.stringify(R)||""}catch(H){if(t!=null&&t.throwOnError)throw H;T??(T=H)}const M=ay(),A=S._interpolation?u_(S.fullPath,S._interpolation,r,this.pathParamsDecoder,M):S.fullPath,I=S.id+A+k,L=h(S,b),D=this._cache.get(I)??((L==null?void 0:L.id)===I?L:void 0);p=(D==null?void 0:D._strictParams)??Object.assign(M,p);let P;if(!D)try{v_(S,p)}catch(H){if(lf(H)||e4(H)?P=H:P=new pG(H.message,{cause:H}),t!=null&&t.throwOnError)throw P}const z=L?"stay":"enter";let $;if(D)$={...D,cause:z,search:md(L?L.search:D.search,C),_strictSearch:O,searchError:T};else{const H=y_(S)?"pending":"success";$={id:I,ssr:S.options.ssr,index:b,routeId:S.id,params:(L==null?void 0:L.params)??p,_strictParams:p,pathname:A,updatedAt:Date.now(),search:L?md(L.search,C):C,_strictSearch:O,searchError:T,status:H,isFetching:!1,error:void 0,paramsError:P,context:{},abortController:(t==null?void 0:t._controller)??new AbortController,cause:z,loaderDeps:L?Na(L.loaderDeps,R):R,invalid:!1,preload:!1,staticData:S.options.staticData||{},fullPath:S.fullPath}}const j=c===S.id;$._notFound&&!j&&($.error=void 0),$._notFound=j,u[b]=$}for(let b=0;b<u.length;b++){const S=u[b];S.params=S.cause==="stay"?md(S.params,p):p,t!=null&&t._controller&&(S.context={})}return u}matchRoutesLightweight(e){const t=Pa(this.stores.ids.get()),n=t?this.stores.byRoute.get(t).get():void 0,r=n==null?void 0:n.id,s=this.lightweightCache.get(e);if(s&&s[0]===r)return s[1];const[o,l]=this.getMatchedRoutes(e.pathname),c=Pa(o),u={...e.search};for(const y of o)try{Object.assign(u,dy(y.options.validateSearch,u))}catch{}const f=n&&n.routeId===c.id&&n.pathname===e.pathname;let h;if(f)h=n.params;else{const y=l;for(const x of o)try{v_(x,y)}catch{}h=y}const p=[o,c.fullPath,u,h];return this.lightweightCache.set(e,[r,p]),p}};async function b_(e,t,{replace:n,ignoreBlocker:r}){var s,o;if(!XP(t,e.protocolAllowlist)){if(!r){const l=e.history._getBlockers();for(const c of l)if(c!=null&&c.blockerFn&&await c.blockerFn({currentLocation:e.history.location,nextLocation:e.history.location,action:n?"REPLACE":"PUSH"}))return}(o=(s=e.history)._ignoreNextBeforeUnload)==null||o.call(s,t),n?window.location.replace(t):window.location.href=t}}var Dy=class extends Error{},pG=class extends Error{};function dy(e,t){if(e==null)return{};if("~standard"in e){const n=e["~standard"].validate(t);if(n instanceof Promise)throw new Dy("Async validation not supported");if(n.issues)throw new Dy(JSON.stringify(n.issues,void 0,2),{cause:n});return n.value}return"parse"in e?e.parse(t):typeof e=="function"?e(t):{}}function v1(e,t){if(e===void 0||e===!0)return t;const n=Object.create(null);return e===!1||e===null?n:typeof e=="function"?(Object.assign(n,t),Object.assign(n,e(n))):Object.assign(n,t,e)}function mG(e,t){return typeof e=="function"?!0:!t||e===!1||e===null?!1:e===void 0||e===!0||t.some(n=>typeof n!="string"&&!c2.call(e,n[1]))}const S1=Object.freeze({});function gG(e,t){var r;const n=[];for(let s=0;s<e.length;s++){const o=e[s].options;if("search"in o)(r=o.search)!=null&&r.middlewares&&n.push(...o.search.middlewares);else if(o.preSearchFilters||o.postSearchFilters){const c=({search:u,next:f})=>{const h=f(o.preSearchFilters?o.preSearchFilters.reduce((p,y)=>y(p),u):u);return o.postSearchFilters?o.postSearchFilters.reduce((p,y)=>y(p),h):h};n.push(c)}const l=o.validateSearch;if(t&&l){const c=({search:u,next:f,meta:h})=>{const p=f(u);try{const y=dy(l,p);if(h&&y)for(const x in y)x in p||(h.defaulted||(h.defaulted=new Map)).set(x,y[x]);return{...p,...y}}catch{}return p};n.push(c)}}return n}function yG(e,t,n){const r=(s,o,l)=>{if(s>=e.length){if(!n.search)return{};if(n.search===!0)return o;const u=KP(n.search,o);return l&&(l.explicit=u),u}const c=(u,f)=>{if(f){const h=l||{};return{search:r(s+1,u,h),meta:h}}return r(s+1,u,l)};return e[s]({search:o,next:c,meta:l})};return r(0,t)}function xG(e,t){if(e!=="root"){let n;for(let r=t.length-1;r>=0;r--){const s=t[r];if(s.options.notFoundComponent)return s.id;n||(n=s.children&&s.id)}if(n)return n}return Ld}function v_(e,t){var r;const n=((r=e.options.params)==null?void 0:r.parse)??e.options.parseParams;n&&Object.assign(t,n(t))}function Zw(e,t){var n,r;return(r=(n=e.options[t])==null?void 0:n.preload)==null?void 0:r.call(n)}function bG(e,t){const n=Zw(e,"component");let r=Zw(e,"pendingComponent");return t&&(r?r=r.then(t):t()),n&&r?Promise.all([n,r]).then(()=>{}):n??r}function Dd(e,t,n){const r=()=>t===!1?void 0:t?Zw(e,t):bG(e,n),s=e._lazy;if(s)return s===!0?r():s.then(r);if(!e.lazyFn)return r();const o=e.lazyFn().then(l=>{{const{id:c,...u}=l.options;Object.assign(e.options,u),e._lazy=!0}},l=>{throw e._lazy=void 0,l});return e._lazy=o,o.then(r)}function h2(e){const t=e.findIndex(n=>n.status!=="success"||n._notFound)+1;return t&&t<e.length?e.slice(0,t):e}const li=0,Zi=1,Dx=2,ts=3,za=[4];function Sp(e){return typeof e[0]=="number"}function xu(e,t){return t.aborted?Promise.race([Promise.reject(t),e]):new Promise((n,r)=>{const s=()=>r(t);t.addEventListener("abort",s,{once:!0}),Promise.resolve(e).then(n,r).then(()=>t.removeEventListener("abort",s))})}function bu(e,t){return e.routesById[t.routeId]}function wp(e,t,n){return e4(e)?[ts,e]:lf(e)?(e.routeId||(e.routeId=n),[Dx,e]):t?(typeof(e==null?void 0:e.then)=="function"&&(e=new Error("A Promise was thrown",{cause:e})),[Zi,e]):[li,e]}function p2(e,t){var r,s;let n=wp(t,!0,e.id);if(n[0]!==Zi)return n;try{(s=(r=e.options).onError)==null||s.call(r,n[1])}catch(o){n=wp(o,!0,e.id)}return n}function op(e,t,n,r,s){return s[0].signal.aborted?za:y2(e,t,n,p2(n,r),s)}async function vG(e,t,n,r,s,o){var h,p;const[l,c]=t,u=n[0].signal,f=!!n[3];for(let y=n[6]??0;y<r;y++){const x=c[y],b=bu(e,x);x.abortController=n[0];const S=((h=c[y-1])==null?void 0:h.context)??e.options.context??{},E={params:x.params,location:l,navigate:R=>e.navigate({...R,_fromLocation:l}),buildLocation:e.buildLocation,cause:f?"preload":x.cause,abortController:n[0],preload:f,matches:c,routeId:b.id};try{const R=x._ctx||(x._ctx=b.options.context?b.options.context({...E,deps:x.loaderDeps,context:S})||{}:void 0);x.context={...S,...R}}catch(R){return qi(e,x),[y,op(e,t,b,R,n)]}if(u.aborted)return[y,za];const C=x.paramsError??x.searchError;if(C!==void 0)return qi(e,x),[y,op(e,t,b,C,n)];const O=b.options.beforeLoad;if(!O)continue;const T=x.status;y>=o&&(x.status="pending",(p=n[7])==null||p.call(n));try{Ep(e,x,"beforeLoad",n[0]);const R=O({...E,search:x.search,context:x.context,...e.options.additionalContext}),k=await(typeof(R==null?void 0:R.then)=="function"?xu(R,u):R);if(u.aborted)return[y,za];const M=y2(e,t,b,wp(k,!1,b.id),n);if(M[0]!==li)return qi(e,x),[y,M];x.context={...x.context,...k}}catch(R){return qi(e,x),[y,op(e,t,b,R,n)]}finally{x.status=T,Ep(e,x,!1,n[0])}}s()}function m2(e,t,n){var r;if(!(!n||--n[2])){if(((r=e._flights)==null?void 0:r.get(t.id))===n){const s=e._tx;if(s&&!s[0].signal.aborted&&!s[3].includes(t)&&s[3].some(o=>o.id===t.id)&&s[3].some(o=>o.isFetching==="beforeLoad"))return;e._flights.delete(t.id)}return n[1]}}function qi(e,t){var r;const n=t._flight;t._flight=void 0,(r=m2(e,t,n))==null||r.abort()}function bs(e,t,n,r){var o;const s=[];for(const l of t)if(!(n!=null&&n.includes(l))){const c=l._flight;if(l._flight=void 0,r&&(c==null?void 0:c[2])===1&&((o=e._flights)==null?void 0:o.get(l.id))===c&&(n!=null&&n.some(u=>u.id===l.id)))c[2]=0;else{const u=m2(e,l,c);u&&s.push(u)}}for(const l of s)l.abort()}function g2(e){for(const t of e){const n=t._flight;n&&n[2]++}}function Ep(e,t,n,r){var l;if(t.isFetching=n,r&&((l=e._tx)==null?void 0:l[0])!==r)return;const s=e.stores.byRoute.get(t.routeId),o=s==null?void 0:s.get();(o==null?void 0:o.id)===t.id&&s.set({...o,isFetching:n})}function l4(e,t,n,r,s,o,l){const c=t[0];return{params:n.params,location:c,navigate:u=>e.navigate({...u,_fromLocation:c}),cause:l?"preload":n.cause,abortController:s,preload:l,deps:n.loaderDeps,parentMatchPromise:o,context:n.context,route:r,...e.options.additionalContext}}async function S_(e,t,n,r,s,o,l){const c=l[0],u=c.signal;if(u.aborted)return za;if(!s)return[li,void 0];let f=n._flight;Ep(e,n,"loader",c);try{if(!f){const h=new AbortController;f=[Promise.resolve().then(()=>s(l4(e,t,n,r,h,o,!!l[3]))).then(p=>wp(p,!1,r.id),p=>wp(p,!0,r.id)).then(p=>{var y;return p[0]!==li&&((y=e._flights)==null?void 0:y.get(n.id))===f&&(e._flights.delete(n.id),f[2]||h.abort()),p[0]===Zi&&f[2]?p2(r,p[1]):p}),h,1],(e._flights??(e._flights=new Map)).set(n.id,f)}return n._flight=f,n.abortController=f[1],y2(e,t,r,await xu(f[0],u),l)}catch(h){if(h!==u||!u.aborted)throw h;return qi(e,n),za}finally{Ep(e,n,!1,c)}}function w_(e,t,n){t[0]!==ts&&(e.status="success",e.error=void 0,t[0]===li?(e.loaderData=t[1],e.invalid=!1,e.updatedAt=Date.now(),e.preload=n):e.invalid=!0)}function SG(e,t,n){const r=e._cache.get(t.id);if(r!==n||e._committed.some(o=>o.id===t.id&&o._flight===t._flight))return;const s={...t,_notFound:void 0,context:{}};s._flight&&s._flight[2]++,e._cache.set(t.id,s),r&&qi(e,r)}function E_(e,t){return t[0]===Zi||t[0]===Dx?{...e,status:t[0]===Zi?"error":"notFound",error:t[1],_flight:void 0}:e}function wG(e,t,n,r,s,o,l){var z,$;const c=t[1][n],u=bu(e,c),f=!!o[3],h=e._cache.get(c.id);let p,y=!1,x;try{if(c.status==="success"&&(p=u.options.shouldReload,typeof p=="function"&&(p=p(l4(e,t,c,u,o[0],s,f))),o[0].signal.aborted&&(x=za)),!x)if(c.status!=="success")y=!0;else{const j=f||c.preload?u.options.preloadStaleTime??e.options.defaultPreloadStaleTime??3e4:u.options.staleTime??e.options.defaultStaleTime??0;y=!!(c.invalid||p||p===void 0&&Date.now()-c.updatedAt>=j&&(o[5]||c.cause==="enter"||o[2].some(H=>H.routeId===c.routeId&&H.id!==c.id)))}}catch(j){c.invalid=!0,qi(e,c),x=op(e,t,u,j,o)}const b=u.options.loader,S=typeof b=="function",E=S?b:b==null?void 0:b.handler,C=!f||u.options.preload!==!1;let O=C&&b?(z=e._flights)==null?void 0:z.get(c.id):void 0;O===c._flight||x?O=void 0:O&&!y&&!f&&p===void 0?y=!0:y||(O=void 0);const T=!!(b&&y&&c.status==="success"&&!f&&!o[4]&&((S?void 0:b.staleReloadMode)??e.options.defaultStaleReloadMode)!=="blocking"),R=y&&C,k=R&&!T&&(c.status!=="success"||!!b),M=n>=l?o[7]:void 0,A=u.lazyFn&&u._lazy!==!0?M:void 0;if(R&&!b&&(c.invalid=!1,c.updatedAt=Date.now()),O&&O[2]++,k){const j=c._flight;c._flight=O,($=m2(e,c,j))==null||$.abort(),n>=l&&(c.status="pending"),M==null||M()}R||(c.isFetching=!1);const I=!x&&k?S_(e,t,c,u,E,s,o).then(j=>(w_(c,j,f),j[0]===li&&(b&&!o[0].signal.aborted&&SG(e,c,h),n>=l&&(c.status="pending")),j)):Promise.resolve(x??[li,c.loaderData]),L=(async()=>{try{const H=Dd(u,void 0,A);H&&await xu(H,o[0].signal)}catch(H){if(!t[1].some((B,V)=>V<=n&&(B.status==="error"||B.status==="notFound"||B._notFound)))return[n,op(e,t,u,H,o)]}const j=await I;k&&j[0]===li&&c.status==="pending"&&!o[0].signal.aborted&&(c.status="success",M==null||M())})();if(r.push([n,I,L]),!T)return I.then(j=>E_(c,j));const D={...c,status:"pending",preload:!1,_flight:O};c.invalid=!1,c.isFetching="loader";const P=S_(e,t,D,u,E,s,o).then(j=>(c.isFetching=!1,w_(D,j,!1),j));return(t[2]??(t[2]=[])).push([n,P,L,D]),P.then(j=>E_(D,j))}async function Jw(e,t,n,r,s=0){const o=n==null?void 0:n[1][1];let l=o!=null&&o.routeId?t.findIndex(c=>c.routeId===o.routeId):(n==null?void 0:n[0])??t.length-1;l<0&&(l=0);for(let c=l;c>=0;c--){const u=bu(e,t[c]);try{const f=Dd(u,!1);f&&await xu(f,r)}catch(f){if(f===r&&r.aborted)throw f}if(u.options.notFoundComponent)return c}return o!=null&&o.routeId?l:s}function Xc(e,t){t[2]&&(bs(e,t[2].map(n=>n[3])),t[2]=void 0)}async function C_(e,t,n,r){let s;try{await Promise.all(e.map(o=>o[1].then(async l=>{const c=o[0];if(!(r&&c>=await r)){if(l[0]>=ts)throw[c,l];!s&&l[0]!==li&&(s=[c,l],await Promise.all((n??[]).map(u=>{if(!(u[0]<=c))return u[1].then(f=>{if(f[0]===ts)throw[u[0],f]})})))}})))}catch(o){return o}return t??s}function y2(e,t,n,r,s,o){for(;r[0]===ts;){const l=r[1],c=l.options;try{if((c.href||l.headers.has("Location"))&&(e.resolveRedirect(l),c.reloadDocument)||(c.reloadDocument?s[3]:s[1]>=20))return r;const u=e.buildLocation({...c,_fromLocation:t[0],_includeValidateSearch:!0}),f=u.maskedLocation??u;if(f.external){const h=l.clone();return h.options={...c},h.headers.set("Location",f.publicHref),e.resolveRedirect(h),s[3]?[ts,h]:[ts,h,f]}return[ts,l,u]}catch(u){r=o?[Zi,u]:p2(n,u),o=!0}}return r}async function a4(e,t,n,r,s,o){const l=t[1];let c=await s,u=!1;const f=l.findIndex(x=>x._notFound),h=x=>x[1][0]===Dx?Jw(e,l,x,r.signal):x[0];let p=f<0?l.length:f;if(((c==null?void 0:c[1][0])??0)>=ts)p=0;else if(c){p=c[2]??(c[2]=await h(c));for(const x of n){if(x[0]>=p)break;const b=await x[1];if(b[0]!==li&&b[0]<ts&&!("loaderData"in l[x[0]])){c=[x[0],b],p=c[2]=await h(c);break}}}for(const x of n){if(x[0]>=p)break;const b=await x[2];if(b){c=b;break}}if(((c==null?void 0:c[1][0])??0)>=ts){const x=c[1];if(x[0]!==ts||x[1].options.reloadDocument||x[2])return Xc(e,t),x;u=!0,c=[0,[Zi,new Error("Too many redirects")]]}const y=c?c[2]??await h(c):f;if(y>=0){const x=c==null?void 0:c[1],b=x==null?void 0:x[0],S=l[y],E=x==null?void 0:x[1],C=()=>{x&&(S._notFound=void 0,b===Zi?S.status="error":(E.routeId=S.routeId,S.routeId===e.routeTree.id?(S.status="success",S._notFound=!0):S.status="notFound"),S.error=E,S.isFetching=!1)};C(),x||o==null||o();const O=bu(e,S);try{await xu(x?Promise.resolve().then(()=>Dd(O,b===Zi?"errorComponent":"notFoundComponent")):Promise.all([Dd(O),Dd(O,"notFoundComponent")]),r.signal)}catch(T){if(T===r.signal&&r.signal.aborted)return Xc(e,t),za}x?u&&(r.abort(),await Promise.all([...n.map(T=>T[1]),...n.map(T=>T[2]),...(t[2]??[]).map(T=>T[1])]),Xc(e,t),bs(e,l),C()):S.status="success"}return t}async function c4(e,t,n,r=0,s=t[1].length){var l,c;const o=t[1];for(let u=r;u<s;u++){const f=o[u],h=bu(e,f).options;if(h.head||h.scripts)try{const p={ssr:e.options.ssr,matches:o,match:f,params:f.params,loaderData:f.loaderData},[y,x]=await xu(Promise.all([(l=h.head)==null?void 0:l.call(h,p),(c=h.scripts)==null?void 0:c.call(h,p)]),n);f.meta=y==null?void 0:y.meta,f.links=y==null?void 0:y.links,f.headScripts=y==null?void 0:y.scripts,f.styles=y==null?void 0:y.styles,f.scripts=x}catch(p){if(p===n&&n.aborted)break;console.error(p)}if(f.status!=="success"||f._notFound)break}return t}async function u4(e,t,n,r){var c;const s=[t,n],o=r[0].signal;let l;try{const u=e.stores.matches.get();let f=n.findIndex(O=>O._notFound);if(e.options.notFoundMode!=="root"&&f>=0){const O=await Jw(e,n,void 0,o,f);n[f]._notFound=void 0,n[O]._notFound=!0,f=O}let h=f<0?n.length:f+1,p=0;for(;p<h&&p!==f;){const O=n[p],T=r[2][p],R=u[p];if((T==null?void 0:T.id)!==O.id||T.status!=="success"||O.preload||(R==null?void 0:R.id)!==O.id||R.status!=="success"||(p++,T._notFound||R._notFound))break}const y=[],x=r[6]??0;let b=x?Promise.resolve(n[x-1]):void 0;const S=()=>{for(let O=x;O<h&&!o.aborted;O++)b=wG(e,s,O,y,b,r,p)},E=await vG(e,s,r,h,S,p);if(E){if(r[4]=!0,h=E[0],E[1][0]===Dx){const O=await Jw(e,n,E,o);E[2]=O,h=Math.min(h,O+1)}else E[1][0]>=ts&&(h=0);S()}if(!o.aborted&&!r[3]){const O=[];for(const[T,R]of e._flights??[])R[2]||(e._flights.delete(T),O.push(R[1]));for(const T of O)T.abort()}const C=a4(e,s,y,r[0],C_(y,E,s[2]),r[7]);(c=s[2])!=null&&c.length&&(s[3]=C_(s[2],void 0,void 0,C.then(O=>Sp(O)?0:h2(n).length,()=>0))),l=await C}catch(u){if(Xc(e,s),u===o&&o.aborted)return za;throw u}return Sp(l)?l:c4(e,l,o,r[6]===n.length?r[6]:0)}function eE(e,t){var o,l;if(e._tx!==t)return;const n=t[3],r=e.stores.matches.get();let s=e._pending;for(let c=0;c<n.length;c++){const u=n[c],f=u.status==="success"&&!u._notFound,h=((o=r[c])==null?void 0:o.id)===u.id&&((l=r[c])==null?void 0:l.status)==="pending";if(f&&!h)continue;const p=bu(e,u),y=f||u.invalid?0:p.options.pendingMs??e.options.defaultPendingMs,x=p.options.pendingComponent??e.options.defaultPendingComponent;if(!x||typeof y!="number"||y===1/0){s&&(s[0]=t,s[2]=0,s[4]=!0);return}const b=p.options.pendingMinMs??e.options.defaultPendingMinMs??0;let S=!1;if((s==null?void 0:s[1])===u.id?(S=s[0]!==t,s[0]=t):(clearTimeout(s==null?void 0:s[3]),e._pending=s=void 0),s||(e._pending=s=[t,u.id,h?Date.now()+b:t[4]+y,void 0,h||void 0,x]),s[4]&&!S&&s[5]===x)return;if(s[5]=x,!s[4]){clearTimeout(s[3]);const O=s[2]-Date.now();if(O>0){s[3]=setTimeout(()=>eE(e,t),O);return}s[2]=0}const E=n.map(O=>({...O,_flight:void 0}));E[c].status="pending";const C=s[4]=e.startTransition(()=>e.stores.setMatches(E),E).then(O=>(O&&e._pending===s&&s[4]===C&&!s[2]&&(s[2]=Date.now()+b),O));return}}function Lh(e,t){var r;const n=e._pending;(e._tx===t||!((r=e._tx)!=null&&r[3].some(s=>s.id===(n==null?void 0:n[1]))))&&(clearTimeout(n==null?void 0:n[3]),e._pending=void 0)}async function T_(e,t){const n=e._pending;if(!n)return;clearTimeout(n[3]);const r=n[2]-Date.now();if(!n[4]||r<=0||!h2(t[3]).some(o=>o.id===n[1]))return;let s;try{await xu(new Promise(o=>{s=setTimeout(o,r)}),t[0].signal)}catch{}clearTimeout(s)}function d4(e,t){e._committed=t,e.stores.setMatches(t)}function EG(e,t,n,r){const s=e._committed,o=e._lifecycleEnd,l=e._cache;for(const h of n)h.preload=!1,r&&(h._assetEnd=void 0);const c=h2(n).length,u=new Map;{const h=Date.now(),p=new Set;for(let y=0;y<n.length;y++){const x=n[y];(y<c||x.status==="success")&&p.add(x.id)}for(const y of[...s,...l.values()]){if(y.status!=="success"||p.has(y.id))continue;const x=bu(e,y);!x.options.loader||h-y.updatedAt>=(y.preload?x.options.preloadGcTime??e.options.defaultPreloadGcTime??3e5:x.options.gcTime??e.options.defaultGcTime??3e5)||u.set(y.id,l.get(y.id)===y?y:{...y,_flight:void 0,isFetching:!1,context:{}})}}t[3]=[],e._cache=u;const f=e._lifecycleEnd=dG(n);d4(e,n),bs(e,[...l.values(),...s].filter(h=>h._flight&&u.get(h.id)!==h),n),fG(e,s,n,o,f,t)}async function v0(e,t){let n=e._tx;for(;n&&n!==t;)t=n,await n[5],n=e._tx}function f4(e,t,n){const r=n[1].options,s=n[2];if(!s)return e.navigate({...r,replace:!0,ignoreBlocker:!0});if(r.reloadDocument)return e.navigate({href:(s.maskedLocation??s).publicHref,reloadDocument:!0,replace:!0,ignoreBlocker:!0});s._redirects=t[1]+1,e._pendingLocation=s;const o=e.commitLocation({...s,viewTransition:r.viewTransition,replace:!0,resetScroll:r.resetScroll,hashScrollIntoView:r.hashScrollIntoView,ignoreBlocker:!0});return queueMicrotask(()=>{e._pendingLocation===s&&(e._pendingLocation=void 0)}),o}async function CG(e,t,n,r,s){const o=n.map(u=>({...u}));g2(o);for(const u of r)qi(e,o[u[0]]),o[u[0]]=u[3];const l=[t[2],o];let c;try{c=await a4(e,l,r,t[0],s)}catch(u){throw bs(e,o),u}if(Sp(c)){bs(e,o),c[0]===ts&&e._tx===t&&e._committed===n&&await f4(e,t,c);return}if(await c4(e,c,t[0].signal),e._tx!==t||e._committed!==n){bs(e,o);return}for(const u of o){const f=e._cache.get(u.id);f!=null&&f._flight&&f._flight===u._flight&&(e._cache.delete(u.id),qi(e,f))}d4(e,o),bs(e,n,o)}async function TG(e,t,n,r,s,o){const l=await u4(e,t[2],t[3],[t[0],t[1],e._committed,void 0,s,n,o,r]);if(Sp(l)){const p=l[0]===ts&&e._tx===t;if((!p||l[1].options.reloadDocument)&&Lh(e,t),bs(e,t[3]),t[3]=[],!p)return;if(e._tx!==t){Lh(e,t);return}await f4(e,t,l);return}const c=l[1];if(e._tx===t&&await T_(e,t),e._tx!==t){Lh(e,t),bs(e,c),Xc(e,l);return}const u=t[2],f=Lx(u,e.stores.resolvedLocation.get()),h=l[2];await e.startViewTransition(async()=>{var x;if(e._tx===t&&await T_(e,t),e._tx!==t){Lh(e,t),bs(e,c),Xc(e,l);return}const p=()=>{Lh(e,t),EG(e,t,c,o),e._tx===t&&(e.emit({type:"onLoad",...f}),e._tx===t&&e.emit({type:"onBeforeRouteMount",...f}))},y=await e.startTransition(p,c);if(e._tx!==t){Xc(e,l);return}h!=null&&h.length&&CG(e,t,c,h,l[3]).catch(console.error),e.batch(()=>{e.stores.resolvedLocation.set(u),e.stores.status.set("idle"),e._tx===t&&e.emit({type:"onResolved",...f}),y&&e._tx===t&&e.emit({type:"onRendered",...f})}),e._tx===t&&((x=e._commitPromise)==null||x.resolve(),e._commitPromise=void 0)})}async function NG(e,t){var R;const n=e._tx,r=e.stores.resolvedLocation.get(),s=r??e.stores.location.get(),o=e.latestLocation,l=e._pendingLocation,c=(l==null?void 0:l.href)===o.href?l._redirects??0:0,u=e._handoff,f=u==null?void 0:u[0](),h=new AbortController,p=e._preflight;if(e._preflight=h,f||u==null||u[1](),p==null||p.abort(),!h.signal.aborted){const k=Lx(o,r);e.emit({type:"onBeforeNavigate",...k}),h.signal.aborted||e.emit({type:"onBeforeLoad",...k})}if(h.signal.aborted){await v0(e,n);return}const y=s.href===o.href;let x=h;const b=e.matchRoutes(o,{_controller:h});g2(b);const S=f?u[1](b):void 0;if(S?x=f:f==null||f.abort(),h.signal.aborted){bs(e,b),await v0(e,n);return}e._preflight=void 0;let E;const C=()=>TG(e,T,y,()=>eE(e,T),t==null?void 0:t.sync,S),O=t!=null&&t.sync?new Promise(k=>E=k):Promise.resolve().then(C),T=[x,c,o,b,Date.now(),O.then(()=>v0(e,T))];if(e._tx=T,n){for(const k of e.stores.matches.get()){if(e._tx!==T)break;k.isFetching&&Ep(e,k,!1)}n[0].abort(),bs(e,n[3],T[3],!0)}if(e._tx!==T){bs(e,T[3]),T[3]=[],E==null||E(),await v0(e,T);return}e.batch(()=>{e.stores.status.set("pending"),e.stores.location.set(o)}),(S||!e._committed.length&&((R=b[0])==null?void 0:R.status)!=="success"&&!b.some(k=>k._notFound))&&eE(e,T),E==null||E(C()),await T[5]}async function OG(e,t){let n=e.buildLocation(t);for(let r=0;;r++){const s=e._committed,o=new AbortController;let l,c,u;try{try{l=e.matchRoutes(n,{_controller:o}),g2(l),c=(e._preloads??(e._preloads=new Map)).set(o,l),u=await u4(e,n,l,[o,r,s,!0])}finally{c&&(c=c.delete(o),bs(e,l)),o.abort()}if(!Sp(u))return u[1];if(!c||u.length<3)return;n=u[2]}catch(f){lf(f)||console.error(f);return}}}const RG="Error preloading route! ☝️";var h4=class{get to(){return this._to}get id(){return this._id}get path(){return this._path}get fullPath(){return this._fullPath}constructor(e){if(this.init=t=>{var u,f;this.originalIndex=t,this._branch=void 0;const n=this.options,r=!(n!=null&&n.path)&&!(n!=null&&n.id);this.parentRoute=(f=(u=this.options).getParentRoute)==null?void 0:f.call(u),r?this._path=Ld:this.parentRoute||u2();let s=r?Ld:n==null?void 0:n.path;s&&s!=="/"&&(s=QP(s));const o=(n==null?void 0:n.id)||s,l=r?Ld:Md((this.parentRoute.id==="__root__"?"":this.parentRoute.id)+"/"+(o??""));s==="__root__"&&(s="/");const c=l==="__root__"?"/":s===void 0?this.parentRoute.fullPath:Md(this.parentRoute.fullPath+"/"+s);this._path=s,this._id=l,this._fullPath=c,this._to=ni(c)},this.addChildren=t=>this._addFileChildren(t),this._addFileChildren=t=>(Array.isArray(t)&&(this.children=t),typeof t=="object"&&t!==null&&(this.children=Object.values(t)),this),this._addFileTypes=()=>this,this.updateLoader=t=>(Object.assign(this.options,t),this),this.update=t=>(Object.assign(this.options,t),this),this.lazy=t=>(this.lazyFn=t,this),this.redirect=t=>Ix({from:this.fullPath,...t}),this.options=e||{},this.isRoot=!(e!=null&&e.getParentRoute),e!=null&&e.id&&(e!=null&&e.path))throw new Error("Route cannot have both an 'id' and a 'path' option.")}},AG=class extends h4{constructor(e){super(e)}},x2=class extends N.Component{constructor(...e){super(...e),this.state={error:0},this.reset=()=>{this.setState({error:0})}}static getDerivedStateFromProps(e,t){const n=e.getResetKey();return t.error&&t.resetKey!==n?{resetKey:n,error:0}:{resetKey:n}}static getDerivedStateFromError(e){return{error:[e]}}componentDidCatch(e,t){var n,r;(r=(n=this.props).onCatch)==null||r.call(n,e,t)}render(){const e=this.state.error;return e?N.createElement(this.props.errorComponent??kG,{error:e[0],reset:this.reset}):this.props.children}};function kG({error:e}){const[t,n]=N.useState(!1);return m.jsxs("div",{style:{padding:".5rem",maxWidth:"100%"},children:[m.jsxs("div",{style:{display:"flex",alignItems:"center",gap:".5rem"},children:[m.jsx("strong",{style:{fontSize:"1rem"},children:"Something went wrong!"}),m.jsx("button",{style:{appearance:"none",fontSize:".6em",border:"1px solid currentColor",padding:".1rem .2rem",fontWeight:"bold",borderRadius:".25rem"},onClick:()=>n(r=>!r),children:t?"Hide Error":"Show Error"})]}),m.jsx("div",{style:{height:".25rem"}}),t?m.jsx("div",{children:m.jsx("pre",{style:{fontSize:".7em",border:"1px solid red",borderRadius:".25rem",padding:".3rem",color:"red",overflow:"auto"},children:e!=null&&e.message?m.jsx("code",{children:e.message}):null})}):null]})}var _G=()=>!0,MG=()=>!1;function IG({children:e,fallback:t=null}){return m.jsx(si.Fragment,{children:p4()?e:t})}function p4(){return si.useSyncExternalStore(LG,_G,MG)}function LG(){return()=>{}}var m4=N.createContext(null);function qs(e){return N.useContext(m4)}var jx=N.createContext(void 0),DG=N.createContext(void 0);function jG({update:e,notify:t,unwatched:n}){return{link:r,unlink:s,propagate:o,checkDirty:l,shallowPropagate:c};function r(f,h,p){const y=h.depsTail;if(y!==void 0&&y.dep===f)return;const x=y!==void 0?y.nextDep:h.deps;if(x!==void 0&&x.dep===f){x.version=p,h.depsTail=x;return}const b=f.subsTail;if(b!==void 0&&b.version===p&&b.sub===h)return;const S=h.depsTail=f.subsTail={version:p,dep:f,sub:h,prevDep:y,nextDep:x,prevSub:b,nextSub:void 0};x!==void 0&&(x.prevDep=S),y!==void 0?y.nextDep=S:h.deps=S,b!==void 0?b.nextSub=S:f.subs=S}function s(f,h=f.sub){const p=f.dep,y=f.prevDep,x=f.nextDep,b=f.nextSub,S=f.prevSub;return x!==void 0?x.prevDep=y:h.depsTail=y,y!==void 0?y.nextDep=x:h.deps=x,b!==void 0?b.prevSub=S:p.subsTail=S,S!==void 0?S.nextSub=b:(p.subs=b)===void 0&&n(p),x}function o(f){let h=f.nextSub,p;e:do{const y=f.sub;let x=y.flags;if(x&60?x&12?x&4?!(x&48)&&u(f,y)?(y.flags=x|40,x&=1):x=0:y.flags=x&-9|32:x=0:y.flags=x|32,x&2&&t(y),x&1){const b=y.subs;if(b!==void 0){const S=(f=b).nextSub;S!==void 0&&(p={value:h,prev:p},h=S);continue}}if((f=h)!==void 0){h=f.nextSub;continue}for(;p!==void 0;)if(f=p.value,p=p.prev,f!==void 0){h=f.nextSub;continue e}break}while(!0)}function l(f,h){let p,y=0,x=!1;e:do{const b=f.dep,S=b.flags;if(h.flags&16)x=!0;else if((S&17)===17){if(e(b)){const E=b.subs;E.nextSub!==void 0&&c(E),x=!0}}else if((S&33)===33){(f.nextSub!==void 0||f.prevSub!==void 0)&&(p={value:f,prev:p}),f=b.deps,h=b,++y;continue}if(!x){const E=f.nextDep;if(E!==void 0){f=E;continue}}for(;y--;){const E=h.subs,C=E.nextSub!==void 0;if(C?(f=p.value,p=p.prev):f=E,x){if(e(h)){C&&c(E),h=f.sub;continue}x=!1}else h.flags&=-33;h=f.sub;const O=f.nextDep;if(O!==void 0){f=O;continue e}}return x}while(!0)}function c(f){do{const h=f.sub,p=h.flags;(p&48)===32&&(h.flags=p|16,(p&6)===2&&t(h))}while((f=f.nextSub)!==void 0)}function u(f,h){let p=h.depsTail;for(;p!==void 0;){if(p===f)return!0;p=p.prevDep}return!1}}function PG(e,t,n){var o,l,c;const r=typeof e=="object",s=r?e:void 0;return{next:(o=r?e.next:e)==null?void 0:o.bind(s),error:(l=r?e.error:t)==null?void 0:l.bind(s),complete:(c=r?e.complete:n)==null?void 0:c.bind(s)}}const tE=[];let fy=0;const{link:N_,unlink:zG,propagate:BG,checkDirty:g4,shallowPropagate:O_}=jG({update(e){return e._update()},notify(e){tE[nE++]=e,e.flags&=-3},unwatched(e){e.depsTail!==void 0&&(e.depsTail=void 0,e.flags=17,jy(e))}});let S0=0,nE=0,Xo,rE=0;function HG(e){try{++rE,e()}finally{--rE||y4()}}function jy(e){const t=e.depsTail;let n=t!==void 0?t.nextDep:e.deps;for(;n!==void 0;)n=zG(n,e)}function y4(){if(!(rE>0)){for(;S0<nE;){const e=tE[S0];tE[S0++]=void 0,e.notify()}S0=0,nE=0}}function R_(e,t){const n=typeof e=="function",r=e,s={_snapshot:n?void 0:e,subs:void 0,subsTail:void 0,deps:void 0,depsTail:void 0,flags:n?0:1,get(){return Xo!==void 0&&N_(s,Xo,fy),s._snapshot},subscribe(o){const l=PG(o),c={current:!1},u=FG(()=>{var f;s.get(),c.current?(f=l.next)==null||f.call(l,s._snapshot):c.current=!0});return{unsubscribe:()=>{u.stop()}}},_update(o){const l=Xo,c=(t==null?void 0:t.compare)??Object.is;if(n)Xo=s,++fy,s.depsTail=void 0;else if(o===void 0)return!1;n&&(s.flags=5);try{const u=s._snapshot,f=typeof o=="function"?o(u):o===void 0&&n?r(u):o;return u===void 0||!c(u,f)?(s._snapshot=f,!0):!1}finally{Xo=l,n&&(s.flags&=-5),jy(s)}}};return n?(s.flags=17,s.get=function(){const o=s.flags;if(o&16||o&32&&g4(s.deps,s)){if(s._update()){const l=s.subs;l!==void 0&&O_(l)}}else o&32&&(s.flags=o&-33);return Xo!==void 0&&N_(s,Xo,fy),s._snapshot}):s.set=function(o){if(s._update(o)){const l=s.subs;l!==void 0&&(BG(l),O_(l),y4())}},s}function FG(e){const t=()=>{const r=Xo;Xo=n,++fy,n.depsTail=void 0,n.flags=6;try{return e()}finally{Xo=r,n.flags&=-5,jy(n)}},n={deps:void 0,depsTail:void 0,subs:void 0,subsTail:void 0,flags:6,notify(){const r=this.flags;r&16||r&32&&g4(this.deps,this)?t():this.flags=2},stop(){this.flags=0,this.depsTail=void 0,jy(this)}};return t(),n}var w1={exports:{}},E1={},C1={exports:{}},T1={};/**
|
|
52
|
+
* @license React
|
|
53
|
+
* use-sync-external-store-shim.production.js
|
|
54
|
+
*
|
|
55
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
56
|
+
*
|
|
57
|
+
* This source code is licensed under the MIT license found in the
|
|
58
|
+
* LICENSE file in the root directory of this source tree.
|
|
59
|
+
*/var A_;function $G(){if(A_)return T1;A_=1;var e=am();function t(p,y){return p===y&&(p!==0||1/p===1/y)||p!==p&&y!==y}var n=typeof Object.is=="function"?Object.is:t,r=e.useState,s=e.useEffect,o=e.useLayoutEffect,l=e.useDebugValue;function c(p,y){var x=y(),b=r({inst:{value:x,getSnapshot:y}}),S=b[0].inst,E=b[1];return o(function(){S.value=x,S.getSnapshot=y,u(S)&&E({inst:S})},[p,x,y]),s(function(){return u(S)&&E({inst:S}),p(function(){u(S)&&E({inst:S})})},[p]),l(x),x}function u(p){var y=p.getSnapshot;p=p.value;try{var x=y();return!n(p,x)}catch{return!0}}function f(p,y){return y()}var h=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?f:c;return T1.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:h,T1}var k_;function x4(){return k_||(k_=1,C1.exports=$G()),C1.exports}/**
|
|
60
|
+
* @license React
|
|
61
|
+
* use-sync-external-store-shim/with-selector.production.js
|
|
62
|
+
*
|
|
63
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
64
|
+
*
|
|
65
|
+
* This source code is licensed under the MIT license found in the
|
|
66
|
+
* LICENSE file in the root directory of this source tree.
|
|
67
|
+
*/var __;function UG(){if(__)return E1;__=1;var e=am(),t=x4();function n(f,h){return f===h&&(f!==0||1/f===1/h)||f!==f&&h!==h}var r=typeof Object.is=="function"?Object.is:n,s=t.useSyncExternalStore,o=e.useRef,l=e.useEffect,c=e.useMemo,u=e.useDebugValue;return E1.useSyncExternalStoreWithSelector=function(f,h,p,y,x){var b=o(null);if(b.current===null){var S={hasValue:!1,value:null};b.current=S}else S=b.current;b=c(function(){function C(M){if(!O){if(O=!0,T=M,M=y(M),x!==void 0&&S.hasValue){var A=S.value;if(x(A,M))return R=A}return R=M}if(A=R,r(T,M))return A;var I=y(M);return x!==void 0&&x(A,I)?(T=M,A):(T=M,R=I)}var O=!1,T,R,k=p===void 0?null:p;return[function(){return C(h())},k===null?void 0:function(){return C(k())}]},[h,p,y,x]);var E=s(f,b[0],b[1]);return l(function(){S.hasValue=!0,S.value=E},[E]),u(E),E},E1}var M_;function VG(){return M_||(M_=1,w1.exports=UG()),w1.exports}var b2=VG();const qG=n2(b2);function GG(e,t){return e===t}function ll(e,t=r=>r,n){const r=(n==null?void 0:n.compare)??GG,s=N.useCallback(l=>{const{unsubscribe:c}=e.subscribe(l);return c},[e]),o=N.useCallback(()=>e.get(),[e]);return b2.useSyncExternalStoreWithSelector(s,o,o,t,r)}var I_={};function b4(e,t){const n=N.useRef();return r=>{const s=e!=null&&e.select?e.select(r):r;return(e==null?void 0:e.structuralSharing)??t.options.defaultStructuralSharing?n.current=Na(n.current,s):s}}function vu(e){const t=qs(),n=N.useContext(e.from?DG:jx),r=e.from??n,s=t.stores.getMatchStore(r),o=b4(e,t),l=ll(s,c=>c?o(c):I_);if(l!==I_)return l;(e.shouldThrow??!0)&&u2()}function v4(e){return vu({from:e.from,strict:e.strict,structuralSharing:e.structuralSharing,select:t=>e.select?e.select(t.loaderData):t.loaderData})}function S4(e){const{select:t,...n}=e;return vu({...n,select:r=>t?t(r.loaderDeps):r.loaderDeps})}function w4(e){return vu({from:e.from,shouldThrow:e.shouldThrow,structuralSharing:e.structuralSharing,strict:e.strict,select:t=>{const n=e.strict===!1?t.params:t._strictParams;return e.select?e.select(n):n}})}function E4(e){return vu({from:e.from,strict:e.strict,shouldThrow:e.shouldThrow,structuralSharing:e.structuralSharing,select:t=>e.select?e.select(t.search):t.search})}function cm(e){const t=qs();return N.useCallback(n=>t.navigate({...n,from:n.from??(e==null?void 0:e.from)}),[e==null?void 0:e.from,t])}function Gke(e){const t=qs(),n=cm(),r=N.useRef(null);return a2(()=>{r.current!==e&&(n(e),r.current=e)},[t,e,n]),null}function C4(e){return vu({...e,select:t=>e.select?e.select(t.context):t.context})}function KG(...e){const t=N.useRef(e),n=t.current;return e.forEach((r,s)=>{Qi(n[s],r,!1,!0)||(n[s]=r)}),t.current}function w0(e,t){e.preloadRoute(t).catch(n=>{console.warn(n),console.warn(RG)})}var YG={compare:(e,t)=>e[0]===t[0]&&e[1]===t[1]};function WG(e,t){const n=typeof e=="string"&&bp(e);if(n)return t.has(n)?e:null}function XG(e,t,n,r,s){const o=a_(e.pathname,r),l=a_(t.pathname,r);return(n!=null&&n.exact?o!==l:!(o.startsWith(l)&&(o.length===l.length||o[l.length]==="/")))||((n==null?void 0:n.includeSearch)??!0)&&!Qi(e.search,t.search,!(n!=null&&n.exact),n==null?void 0:n.explicitUndefined)?!1:n!=null&&n.includeHash?s&&e.hash===t.hash:!0}function QG(e,t,n){const r=qs(),s=N.useRef(null),o=N.useCallback(Z=>{if(s.current=Z,typeof t=="function")return t(Z);t&&(t.current=Z)},[t]),{activeOptions:l,to:c,preload:u,preloadDelay:f,hashScrollIntoView:h,replace:p,startTransition:y,resetScroll:x,viewTransition:b,ignoreBlocker:S,disabled:E,target:C,onClick:O,onBlur:T,onFocus:R,onMouseEnter:k,onMouseLeave:M,onTouchStart:A}=e,I=p4(),[L,D,P]=KG(e.search,e.params,l),[z,$]=N.useMemo(()=>[e,{...e}],[r,e.from,e._fromLocation,e.hash,e.to,L,D,e.state,e.mask,e.unsafeRelative]),j=N.useCallback(Z=>{const Y=WG(c,r.protocolAllowlist);if(Y!==void 0)return[Y??void 0];z._fromLocation||($._fromLocation=Z);const le=r.buildLocation($),xe=nK(le,r,E);return[xe,!E&&(!xe||bp(xe))?void 0:XG(Z,le,P,r.basepath,I)]},[P,E,I,z,$,r,c]),[H,B]=ll(r.stores.location,j,YG),V=B===void 0?H:void 0,G=E||H===void 0,q=N.useRef(!1),K=e.reloadDocument||V||G?!1:u??r.options.defaultPreload,W=f??r.options.defaultPreloadDelay??0,ee=N.useCallback(Z=>{const Y=Z==null?void 0:Z.isIntersecting;if(!(Y??K==="intent")){Y===!1&&N1(s);return}if(!W){w0(r,z);return}ip.has(s)||ip.set(s,setTimeout(()=>{ip.delete(s),w0(r,z)},W))},[r,z,s,K,W]);N.useEffect(()=>{K==="render"&&!q.current&&(q.current=!0,w0(r,z));let Z;return K==="viewport"&&s.current&&typeof IntersectionObserver=="function"&&(Z=new IntersectionObserver(Y=>ee(Y.pop()),{rootMargin:"100px"}),Z.observe(s.current)),()=>{Z==null||Z.disconnect(),N1(s)}},[r,z,K,ee,s]);const ce=eK(e,n);if(ce.ref=t?o:s,V)return ce.href=V,ce;const F=Z=>{const Y=C??Z.currentTarget.getAttribute("target");!G&&!(Z.metaKey||Z.altKey||Z.ctrlKey||Z.shiftKey)&&!Z.defaultPrevented&&(!Y||Y==="_self")&&Z.button===0&&(Z.preventDefault(),r.navigate({...z,replace:p,resetScroll:x,hashScrollIntoView:h,startTransition:y,viewTransition:b,ignoreBlocker:S}))},X=()=>{K==="intent"&&w0(r,z)},te=()=>{K==="intent"&&N1(s)};return ce.onClick=gd(O,F),ce.onBlur=gd(T,te),ce.onFocus=gd(R,ee),ce.onMouseEnter=gd(k,ee),ce.onMouseLeave=gd(M,te),ce.onTouchStart=gd(A,X),tK(ce,e,B,H,G,n)}var ZG={},JG={className:"active"},T4=new Set(["to","params","search","hash","state","mask","from","unsafeRelative","_fromLocation","reloadDocument","preload","preloadDelay","preloadIntentProximity","hashScrollIntoView","replace","startTransition","resetScroll","viewTransition","ignoreBlocker","activeProps","inactiveProps","activeOptions","_asChild"]);function eK(e,t){const n={};for(const r in e)T4.has(r)||r==="type"&&t!==void 0||r==="disabled"&&t==="a"||(n[r]=e[r]);return n}function tK(e,t,n,r,s,o){const{activeProps:l,inactiveProps:c,className:u,style:f,target:h}=t,p=KP(n?l:c,{})??(n?JG:ZG);Object.assign(e,p),e.href=r,o!=="a"&&(e.disabled=s),e.target=h;const y=p.style;(f||y)&&(e.style=f&&y?{...f,...y}:f||y);const x=p.className;return(u||x)&&(e.className=u?x?`${u} ${x}`:u:x),s&&(e.role="link",e["aria-disabled"]=!0),n&&(e["data-status"]="active",e["aria-current"]="page"),e}var ip=new WeakMap,N1=e=>{clearTimeout(ip.get(e)),ip.delete(e)},gd=(e,t)=>e?n=>n.defaultPrevented||(e(n),n.defaultPrevented||t(n)):t;function nK(e,t,n){if(n)return;const r=e.maskedLocation??e,s=r.external?r.publicHref:t.history.createHref(r.publicHref)||"/";if(!((r.external||s!==r.publicHref)&&XP(s,t.protocolAllowlist)))return s}var ri=N.memo(N.forwardRef((e,t)=>{const n=e._asChild||"a",r=QG(e,t,n),s=typeof e.children=="function"?e.children({isActive:r["data-status"]==="active"}):e.children;return N.createElement(n,r,s)}),rK);function rK(e,t){let n=0;for(const r in t)if(n++,e[r]!==t[r]&&(!T4.has(r)||!Qi(e[r],t[r],!1,!0)))return!1;for(const r in e)n--;return n===0}var sK=class extends h4{constructor(t){super(t),this.useMatch=n=>vu({...n,from:this.id}),this.useRouteContext=n=>C4({...n,from:this.id}),this.useSearch=n=>E4({...n,from:this.id}),this.useParams=n=>w4({...n,from:this.id}),this.useLoaderDeps=n=>S4({...n,from:this.id}),this.useLoaderData=n=>v4({...n,from:this.id}),this.useNavigate=()=>cm({from:this.fullPath}),this.Link=si.forwardRef((n,r)=>m.jsx(ri,{ref:r,from:this.fullPath,...n}))}};function oK(e){return new sK(e)}function iK(){return e=>aK(e)}var lK=class extends AG{constructor(e){super(e),this.useMatch=t=>vu({...t,from:this.id}),this.useRouteContext=t=>C4({...t,from:this.id}),this.useSearch=t=>E4({...t,from:this.id}),this.useParams=t=>w4({...t,from:this.id}),this.useLoaderDeps=t=>S4({...t,from:this.id}),this.useLoaderData=t=>v4({...t,from:this.id}),this.useNavigate=()=>cm({from:this.fullPath}),this.Link=si.forwardRef((t,n)=>m.jsx(ri,{ref:n,from:this.fullPath,...t}))}};function aK(e){return new lK(e)}function ws(e){return t=>{const n=oK(t);return n.isRoot=!1,n}}function mn(e,t){let n,r,s;const o=()=>(n||(s=void 0,n=e().then(c=>{n=void 0,l.preload=void 0,r=c[t??"default"]}).catch(c=>{n=void 0,s=c})),n),l=function(u){if(s){if(Rq(s)&&typeof sessionStorage<"u"){const f=`tanstack_router_reload:${s.message}`;if(!sessionStorage.getItem(f))throw sessionStorage.setItem(f,"1"),window.location.reload(),new Promise(()=>{})}throw s}if(!r)if(i_)i_(o());else throw o();return N.createElement(r,u)};return l.preload=o,l}function cK(e){const t=qs(),n=`not-found-${ll(t.stores.location,r=>r.pathname)}-${ll(t.stores.status)}`;return m.jsx(x2,{getResetKey:()=>n,onCatch:(r,s)=>{var o;if(lf(r))(o=e.onCatch)==null||o.call(e,r,s);else throw r},errorComponent:({error:r})=>{var s;if(lf(r))return(s=e.fallback)==null?void 0:s.call(e,r);throw r},children:e.children})}function uK(){return m.jsx("p",{children:"Not Found"})}function Ed(e){return m.jsx(m.Fragment,{children:e.children})}function N4(e,t,n){return t.options.notFoundComponent?m.jsx(t.options.notFoundComponent,{...n}):e.options.defaultNotFoundComponent?m.jsx(e.options.defaultNotFoundComponent,{...n}):m.jsx(uK,{})}function Px(e,t){const n=(t==null?void 0:t.options.pendingComponent)??e.options.defaultPendingComponent;return n?m.jsx(n,{}):null}var dK=(e,t)=>e[0]===t[0]&&e[1]===t[1],O4=(e,t,n)=>!t.isRoot||t.options.shellComponent||t.options.wrapInSuspense||n===!1||n==="data-only"||!e.ssr,R4=N.memo(function({routeId:t}){const n=qs();return m.jsx(fK,{router:n,match:ll(n.stores.getMatchStore(t))})});function fK({router:e,match:t}){var p,y;const n=e.routesById[t.routeId],r=Px(e,n),s=n.options.errorComponent??e.options.defaultErrorComponent,o=n.options.onCatch??e.options.defaultOnCatch,l=n.isRoot?n.options.notFoundComponent??((p=e.options.notFoundRoute)==null?void 0:p.options.component):n.options.notFoundComponent,c=t.ssr===!1||t.ssr==="data-only",u=O4(e,n,t.ssr)&&(n.options.wrapInSuspense??r??(((y=n.options.errorComponent)==null?void 0:y.preload)||c))?N.Suspense:Ed,f=s?x2:Ed,h=l?cK:Ed;return m.jsxs(n.isRoot?n.options.shellComponent??Ed:Ed,{children:[m.jsx(jx.Provider,{value:t.routeId,children:m.jsx(u,{fallback:r,children:m.jsx(f,{getResetKey:()=>t,errorComponent:s,onCatch:(x,b)=>{if(lf(x))throw x.routeId??(x.routeId=t.routeId),x;o==null||o(x,b)},children:m.jsx(h,{fallback:x=>{if(x.routeId??(x.routeId=t.routeId),x.routeId!==t.routeId)throw x;return N.createElement(l,x)},children:c?m.jsx(IG,{fallback:r,children:m.jsx(L_,{match:t})}):m.jsx(L_,{match:t})})})})}),null]})}var L_=N.memo(function({match:t}){const n=qs(),r=t.routeId,s=n.routesById[r],o=N.useMemo(()=>{var u;const c=(u=s.options.remountDeps??n.options.defaultRemountDeps)==null?void 0:u({routeId:r,loaderDeps:t.loaderDeps,params:t._strictParams,search:t._strictSearch});return c?JSON.stringify(c):void 0},[r,t.loaderDeps,t._strictParams,t._strictSearch,s.options.remountDeps,n.options.defaultRemountDeps]),l=N.useMemo(()=>{const c=s.options.component??n.options.defaultComponent;return c?m.jsx(c,{},o):m.jsx(A4,{})},[o,s.options.component,n.options.defaultComponent]);if(t.status==="pending"){if(n.ssr&&!O4(n,s,t.ssr))return l;if(n._tx)throw n._tx[5];return Px(n,s)}if(t.status==="notFound")return N4(n,s,t.error);if(t.status==="error")throw t.error;return l}),A4=N.memo(function(){const t=qs(),n=N.useContext(jx);let r,s,o;{const c=t.stores.getMatchStore(n);[r,s]=ll(c,u=>[!!u._notFound,u.error],{compare:dK}),o=ll(t.stores.ids,u=>u[u.indexOf(n)+1])}if(r)return N4(t,t.routesById[n],s);if(!o)return null;const l=m.jsx(R4,{routeId:o});return n===Ld?m.jsx(N.Suspense,{fallback:Px(t),children:l}):l});function k4(e,t){const n=e[1];e.length=0,n==null||n(t)}function hK({t:e}){const t=qs(),n=t._rendered??(t._rendered=[]);return t.startTransition=(r,s)=>new Promise(o=>{k4(n,!1),n.push(s,o),e(t),N.startTransition(r)}),a2(()=>{const r=t.history.subscribe(t.load);t.updateLatestLocation();const s=t.latestLocation,o=t.buildLocation({to:s.pathname,search:!0,params:!0,hash:!0,state:!0,_includeValidateSearch:!0});if(ni(s.publicHref)!==ni(o.publicHref))return t.commitLocation({...o,replace:!0,ignoreBlocker:!0}),r;const l=t.stores.resolvedLocation.get();return(l==null?void 0:l.href)===s.href&&l.state.__TSR_key===s.state.__TSR_key?n.push(t.stores.matches.get(),c=>{c&&t.emit({type:"onRendered",...Lx(l,l)})}):t._tx||t.load({sync:!0}).catch(console.error),r},[t,t.history]),null}function pK(){const e=qs(),t=e.routesById[Ld],n=Px(e,t),r=e.ssr?Ed:N.Suspense,s=m.jsxs(m.Fragment,{children:[m.jsx(hK,{t:N.useState()[1]}),m.jsx(r,{fallback:n,children:m.jsx(mK,{})})]});return e.options.InnerWrap?m.jsx(e.options.InnerWrap,{children:s}):s}function mK(){const e=qs(),t=e._rendered,n=ll(e.stores.matches,l=>t[0]??l),r=n[0],s=r==null?void 0:r.routeId;a2(()=>{t[0]===n&&k4(t,!0)},[t,n]);const o=s?m.jsx(R4,{routeId:s}):null;return m.jsx(jx.Provider,{value:s,children:e.options.disableGlobalCatchBoundary?o:m.jsx(x2,{getResetKey:()=>r,onCatch:void 0,children:o})})}function O1(e){const t=qs();return ll(t.stores.matches,b4(e,t))}var gK=e=>({createMutableStore:R_,createReadonlyStore:R_,batch:HG}),yK=e=>new xK(e),xK=class extends hG{constructor(e){super(e,gK)}};function bK({router:e,children:t,...n}){YP(n)&&e.update({...e.options,...n,context:{...e.options.context,...n.context}});const r=m.jsx(m4.Provider,{value:e,children:t});return e.options.Wrap?m.jsx(e.options.Wrap,{children:r}):r}function vK({router:e,...t}){return m.jsx(bK,{router:e,...t,children:m.jsx(pK,{})})}const _4=N.createContext(null),M4="flightplan.color-theme",I4="(prefers-color-scheme: dark)",SK=e=>e==="light"||e==="dark",wK=()=>{try{const e=localStorage.getItem(M4);return SK(e)?e:null}catch{return null}},EK=e=>{try{return localStorage.setItem(M4,e),!0}catch{return!1}},CK=e=>{document.documentElement.setAttribute("data-theme",e)},TK=e=>e==="dark"?"light":"dark",NK=e=>{const t=window.matchMedia(I4);return t.addEventListener("change",e),()=>{t.removeEventListener("change",e)}},OK=()=>window.matchMedia(I4).matches?"dark":"light",sE=()=>{const[e,t]=N.useState(wK),n=N.useSyncExternalStore(NK,OK),r=e??n;return{theme:r,onToggle:()=>{const s=TK(r);EK(s),CK(s),t(s)}}},D_=160,L4=({src:e})=>m.jsx("img",{src:e,alt:"",width:D_,height:D_,className:"size-40"});function zx(){return typeof window<"u"}function Or(e){return v2(e)?(e.nodeName||"").toLowerCase():"#document"}function pn(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function fl(e){var t;return(t=(v2(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function v2(e){return zx()?e instanceof Node||e instanceof pn(e).Node:!1}function St(e){return zx()?e instanceof Element||e instanceof pn(e).Element:!1}function Yt(e){return zx()?e instanceof HTMLElement||e instanceof pn(e).HTMLElement:!1}function af(e){return!zx()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof pn(e).ShadowRoot}function um(e){const{overflow:t,overflowX:n,overflowY:r,display:s}=$s(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&s!=="inline"&&s!=="contents"}function RK(e){return/^(table|td|th)$/.test(Or(e))}function Bx(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const AK=/transform|translate|scale|rotate|perspective|filter/,kK=/paint|layout|strict|content/,Nc=e=>!!e&&e!=="none";let R1;function S2(e){const t=St(e)?$s(e):e;return Nc(t.transform)||Nc(t.translate)||Nc(t.scale)||Nc(t.rotate)||Nc(t.perspective)||!w2()&&(Nc(t.backdropFilter)||Nc(t.filter))||AK.test(t.willChange||"")||kK.test(t.contain||"")}function _K(e){let t=al(e);for(;Yt(t)&&!Ji(t);){if(S2(t))return t;if(Bx(t))return null;t=al(t)}return null}function w2(){return R1==null&&(R1=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),R1}function Ji(e){return/^(html|body|#document)$/.test(Or(e))}function $s(e){return pn(e).getComputedStyle(e)}function Hx(e){return St(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function al(e){if(Or(e)==="html")return e;const t=e.assignedSlot||e.parentNode||af(e)&&e.host||fl(e);return af(t)?t.host:t}function D4(e){const t=al(e);return Ji(t)?(e.ownerDocument||e).body:Yt(t)&&um(t)?t:D4(t)}function Cp(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const s=D4(e),o=s===((r=e.ownerDocument)==null?void 0:r.body),l=pn(s);if(o){const c=oE(l);return t.concat(l,l.visualViewport||[],um(s)?s:[],c&&n?Cp(c):[])}else return t.concat(s,Cp(s,[],n))}function oE(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}const E2={...PV},j_={};function Rr(e,t){const n=N.useRef(j_);return n.current===j_&&(n.current=e(t)),n}const A1=E2.useInsertionEffect,MK=A1&&A1!==E2.useLayoutEffect?A1:e=>e();function Ve(e){const t=Rr(IK).current;return t.next=e,MK(t.effect),t.trampoline}function IK(){const e={next:void 0,callback:LK,trampoline:(...t)=>{var n;return(n=e.callback)==null?void 0:n.call(e,...t)},effect:()=>{e.callback=e.next}};return e}function LK(){}const DK=()=>{},Be=typeof document<"u"?N.useLayoutEffect:DK;function iE(e,t){if(e&&!t)return e;if(!e&&t)return t;if(e||t)return{...e,...t}}const C2={};function el(e,t,n,r,s){if(!n&&!r&&!s&&!e)return Py(t);let o=Py(e);return t&&(o=Yh(o,t)),n&&(o=Yh(o,n)),r&&(o=Yh(o,r)),s&&(o=Yh(o,s)),o}function jK(e){if(e.length===0)return C2;if(e.length===1)return Py(e[0]);let t=Py(e[0]);for(let n=1;n<e.length;n+=1)t=Yh(t,e[n]);return t}function Py(e){return T2(e)?{...P4(e,C2)}:PK(e)}function Yh(e,t){return T2(t)?P4(t,e):zK(e,t)}function PK(e){const t={...e};for(const n in t){const r=t[n];j4(n,r)&&(t[n]=z4(r))}return t}function zK(e,t){if(!t)return e;for(const n in t){const r=t[n];switch(n){case"style":{e[n]=iE(e.style,r);break}case"className":{e[n]=B4(e.className,r);break}default:j4(n,r)?e[n]=BK(e[n],r):e[n]=r}}return e}function j4(e,t){const n=e.charCodeAt(0),r=e.charCodeAt(1),s=e.charCodeAt(2);return n===111&&r===110&&s>=65&&s<=90&&(typeof t=="function"||typeof t>"u")}function T2(e){return typeof e=="function"}function P4(e,t){return T2(e)?e(t):e??C2}function BK(e,t){return t?e?(...n)=>{const r=n[0];if(H4(r)){const o=r;zy(o);const l=t(...n);return o.baseUIHandlerPrevented||e==null||e(...n),l}const s=t(...n);return e==null||e(...n),s}:z4(t):e}function z4(e){return e&&((...t)=>{const n=t[0];return H4(n)&&zy(n),e(...t)})}function zy(e){return e.preventBaseUIHandler=()=>{e.baseUIHandlerPrevented=!0},e}function B4(e,t){return t?e?t+" "+e:t:e}function H4(e){return e!=null&&typeof e=="object"&&"nativeEvent"in e}function HK(e,t){return function(r,...s){const o=new URL(e);return o.searchParams.set("code",r.toString()),s.forEach(l=>o.searchParams.append("args[]",l)),`${t} error #${r}; visit ${o} for the full message.`}}const Wt=HK("https://base-ui.com/production-error","Base UI"),F4=N.createContext(void 0);function N2(e=!1){const t=N.useContext(F4);if(t===void 0&&!e)throw new Error(Wt(16));return t}function FK(e){const{focusableWhenDisabled:t,disabled:n,composite:r=!1,tabIndex:s=0,isNativeButton:o}=e,l=r&&t!==!1,c=r&&t===!1;return{props:N.useMemo(()=>{const f={onKeyDown(h){n&&t&&h.key!=="Tab"&&h.preventDefault()}};return r||(f.tabIndex=s,!o&&n&&(f.tabIndex=t?s:-1)),(o&&(t||l)||!o&&n)&&(f["aria-disabled"]=n),o&&(!t||c)&&(f.disabled=n),f},[r,n,t,l,c,o,s])}}function jt(e){return(e==null?void 0:e.ownerDocument)||document}function hy(e,t,{detail:n=0}={}){e.dispatchEvent(new(pn(e)).PointerEvent("click",{bubbles:!0,cancelable:!0,composed:!0,detail:n,shiftKey:t.shiftKey,ctrlKey:t.ctrlKey,altKey:t.altKey,metaKey:t.metaKey}))}function Su(e={}){const{disabled:t=!1,focusableWhenDisabled:n,tabIndex:r=0,native:s=!0,composite:o}=e,l=N.useRef(null),c=N2(!0),u=o??c!==void 0,{props:f}=FK({focusableWhenDisabled:n,disabled:t,composite:u,tabIndex:r,isNativeButton:s}),h=N.useCallback(()=>{const x=l.current;k1(x)&&u&&t&&f.disabled===void 0&&x.disabled&&(x.disabled=!1)},[t,f.disabled,u]);Be(h,[h]);const p=N.useCallback((x={})=>{const{onClick:b,onMouseDown:S,onKeyUp:E,onKeyDown:C,onPointerDown:O,...T}=x;return el({onClick(R){if(t){R.preventDefault();return}b==null||b(R)},onMouseDown(R){t||S==null||S(R)},onKeyDown(R){if(t||(zy(R),C==null||C(R),R.baseUIHandlerPrevented))return;const k=R.target===R.currentTarget,M=R.currentTarget,A=k1(M),I=!s&&$K(M),L=k&&(s?A:!I),D=R.key==="Enter",P=R.key===" ",z=M.getAttribute("role"),$=(z==null?void 0:z.startsWith("menuitem"))||z==="option"||z==="gridcell";if(k&&u&&P){if(R.defaultPrevented&&$)return;R.preventDefault(),(!s||A)&&(R.preventBaseUIHandler(),hy(M,R));return}if(!L||s||!P&&!D){k&&I&&P&&R.preventDefault();return}R.defaultPrevented||(R.preventDefault(),D&&(R.preventBaseUIHandler(),hy(M,R)))},onKeyUp(R){if(!t){if(zy(R),E==null||E(R),R.target===R.currentTarget&&s&&u&&k1(R.currentTarget)&&R.key===" "){R.preventDefault();return}R.baseUIHandlerPrevented||R.target===R.currentTarget&&!s&&!u&&!R.defaultPrevented&&R.key===" "&&(R.preventBaseUIHandler(),hy(R.currentTarget,R))}},onPointerDown(R){if(t){R.preventDefault();return}O==null||O(R)}},s?{type:"button"}:{role:"button"},f,T)},[t,f,u,s]),y=Ve(x=>{l.current=x,h()});return{getButtonProps:p,buttonRef:y}}function k1(e){return Yt(e)&&e.tagName==="BUTTON"}function $K(e){return Yt(e)&&e.tagName==="A"&&!!e.href}function Ba(e,t,n,r){const s=Rr($4).current;return VK(s,e,t,n,r)&&U4(s,[e,t,n,r]),s.callback}function UK(e){const t=Rr($4).current;return qK(t,e)&&U4(t,e),t.callback}function $4(){return{callback:null,cleanup:null,refs:[]}}function VK(e,t,n,r,s){return e.refs[0]!==t||e.refs[1]!==n||e.refs[2]!==r||e.refs[3]!==s}function qK(e,t){return e.refs.length!==t.length||e.refs.some((n,r)=>n!==t[r])}function U4(e,t){if(e.refs=t,t.every(n=>n==null)){e.callback=null;return}e.callback=n=>{if(e.cleanup&&(e.cleanup(),e.cleanup=null),n!=null){const r=Array(t.length).fill(null);for(let s=0;s<t.length;s+=1){const o=t[s];if(o!=null)switch(typeof o){case"function":{const l=o(n);typeof l=="function"&&(r[s]=l);break}case"object":{o.current=n;break}}}e.cleanup=()=>{for(let s=0;s<t.length;s+=1){const o=t[s];if(o!=null)switch(typeof o){case"function":{const l=r[s];typeof l=="function"?l():o(null);break}case"object":{o.current=null;break}}}}}}}const GK=parseInt(N.version,10);function O2(e){return GK>=e}function P_(e){if(!N.isValidElement(e))return null;const t=e,n=t.props;return(O2(19)?n==null?void 0:n.ref:t.ref)??null}function Fn(){}const Ha=Object.freeze([]),hn=Object.freeze({});function KK(e,t){const n={};for(const r in e){const s=e[r];if(t!=null&&t.hasOwnProperty(r)){const o=t[r](s);o!=null&&Object.assign(n,o);continue}s===!0?n[`data-${r.toLowerCase()}`]="":s&&(n[`data-${r.toLowerCase()}`]=s.toString())}return n}function YK(e,t){return typeof e=="function"?e(t):e}function V4(e,t){return typeof e=="function"?e(t):e}function Lt(e,t,n={}){let r=t.render;n.enabled!==!1&&(r=ZK(r));const s=WK(t,n,r);if(n.enabled===!1)return null;const o=n.state??hn;return JK(e,r,s,o)}function WK(e,t,n){const{className:r,style:s}=e,{state:o=hn,ref:l,props:c,stateAttributesMapping:u,enabled:f=!0}=t,h=f?YK(r,o):void 0,p=f?V4(s,o):void 0,y=f?KK(o,u):hn,x=f&&c?XK(c):void 0,b=f?iE(y,x)??{}:hn;return typeof document<"u"&&(f?Array.isArray(l)?b.ref=UK([b.ref,P_(n),...l]):b.ref=Ba(b.ref,P_(n),l):Ba(null,null)),f?(h!==void 0&&(b.className=B4(b.className,h)),p!==void 0&&(b.style=iE(b.style,p)),b):hn}function XK(e){return Array.isArray(e)?jK(e):el(void 0,e)}const QK=Symbol.for("react.lazy");function ZK(e){if((e==null?void 0:e.$$typeof)!==QK)return e;const t=N.Children.toArray(e)[0];return N.isValidElement(t)?t:e}function JK(e,t,n,r){if(t){if(typeof t=="function")return t(n,r);const s=el(n,t.props);return s.ref=n.ref,N.cloneElement(t,s)}if(e&&typeof e=="string")return eY(e,n);throw new Error(Wt(8))}function eY(e,t){return e==="button"?N.createElement("button",{type:"button",...t,key:t.key}):e==="img"?N.createElement("img",{alt:"",...t,key:t.key}):N.createElement(e,t)}const tY=N.forwardRef(function(t,n){const{render:r,className:s,disabled:o=!1,focusableWhenDisabled:l=!1,nativeButton:c=!0,style:u,...f}=t,{getButtonProps:h,buttonRef:p}=Su({disabled:o,focusableWhenDisabled:l,native:c});return Lt("button",t,{state:{disabled:o},ref:[n,p],props:[f,h]})});function q4(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e)){var s=e.length;for(t=0;t<s;t++)e[t]&&(n=q4(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function nY(){for(var e,t,n=0,r="",s=arguments.length;n<s;n++)(e=arguments[n])&&(t=q4(e))&&(r&&(r+=" "),r+=t);return r}const z_=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,B_=nY,rY=(e,t)=>n=>{var r;if((t==null?void 0:t.variants)==null)return B_(e,n==null?void 0:n.class,n==null?void 0:n.className);const{variants:s,defaultVariants:o}=t,l=Object.keys(s).map(f=>{const h=n==null?void 0:n[f],p=o==null?void 0:o[f];if(h===null)return null;const y=z_(h)||z_(p);return s[f][y]}),c=n&&Object.entries(n).reduce((f,h)=>{let[p,y]=h;return y===void 0||(f[p]=y),f},{}),u=t==null||(r=t.compoundVariants)===null||r===void 0?void 0:r.reduce((f,h)=>{let{class:p,className:y,...x}=h;return Object.entries(x).every(b=>{let[S,E]=b;return Array.isArray(E)?E.includes({...o,...c}[S]):{...o,...c}[S]===E})?[...f,p,y]:f},[]);return B_(e,l,u,n==null?void 0:n.class,n==null?void 0:n.className)},G4=48,hi=(e,t=0)=>{const n=new Int32Array(e.length);for(let r=0;r<e.length;r++)n[r]=e.charCodeAt(r)-G4-t;return n},Fx=e=>{const t=new Int32Array(e.length+1);for(let n=0;n<e.length;n++)t[n+1]=t[n]+e[n];return t},Fa=e=>{const t=new Int32Array(e.length);let n=0;for(let r=0;r<e.length;r++){const s=e.charCodeAt(r)-G4;n+=s>>>1^-(s&1),t[r]=n}return t},sY=384,oY=[],Ac=Fx(hi("E0500002005282000000002000150000020021820000011200000003022202000300004200120000200420001200021200301200010400162000010000220021010:2192001200220012000220012000200200200400010200040000000000400200108200110100000022010313000162002000020020012020080213000228200000000082000000000120002000120020020040101020300130001001010")),iY=Fx(hi(":11111111211111119311546544411119731869:671397415686432441111111111161114151214313433415:78311132233313187211117221449443411141111151152226611131111112212518142224214215421421542142424242516171151615616347111111111197911327451111111111111111111113134714133513411111311111111111111111111112444411111342312715245411117:3")),lY="@containerabcdefghinlmoprstunderlineviawzccentlignnimatespectuto-colsrowsaglorightnessckdrop-sisbcontrastfiltergrayscalehue-rotateinvertopacityslurrightnessaturateepia-coniclinearpositionradialsizeockurrderttom-belrstxyespacing-xyaretoursorlnt-umnsendspantartainentrasteividerop-shadowurationcorationlay-xyasendillexontromlter-featuresstretchapr-xyayscaleidow-colsrowsue-rotatedentlinesetvert-beringsxyeshadoweiadingftnest-clamp-imageabein-lrstxyskx--b-coniclpositionrsizet-x-y-fromto-fromto-inearfromto-fromto-adialfromto-fromtofromtofromtofromtoblockhinlinew-screenesblockhinlinewbjectpacityrutlinederigin-offsetbelrstxyesrspective-originaceholderioghtng-offsettateundedw-xyz-belrstlreseslr-endspantartaturatecepiahizekewpace-taleroll-xyz-barmpbelrstxyesbelrstxyes-thumbrackadowrink-xyxyartrokeabextora-shadowpckingnsformitionlate-xyz-offsetill-changeoom",aY=(()=>{const e=Ac.length-1,t=new Int32Array(e);for(let s=e-1;s>=0;s--){let o=1,l=s+1;for(let c=Ac[s];c<Ac[s+1];c++)o+=t[l],l+=t[l];t[s]=o}const n=new Int32Array(Ac[e]);let r=0;for(let s=0;s<e;s++){let o=s+1;for(let l=Ac[s];l<Ac[s+1];l++)n[r++]=o,o+=t[o]}return n})(),cY=hi("02000000000000900<=0?000B000F00F00ŏI0J0LNPRTVX0000]_a00000000000000000000000rst0000000zŏ00000000000
ŏ0000000ŏ00000000000000000000000000000000000000000000000000000000000000Ë000000000000000000000Þ000000000000000000ð0000000ø0ùúûüýþÿĀāĂ㥹Ć000000000000000000000000000000000000000000ħ0ĨĪ00000000000000000000ļĽ00000Ŭ000000",1),uY=Fx(hi("123333359346463635126536711576")),dY=hi("93203242332583253248325D>E?F@03263243255B:032523853:0325B:8GA032542H<C=12727B:0328432553;D>E?3257D>032585:0325B:;0328B:032"),fY=hi("012113445661666666789111:5;;;;;;;;444;;;:62999<1161=62>>?61:21@ABCD4446996:64E:::;:?::64:F114GHHIHHHHIHH1HH1HH1HHHHHH::EEJ4444::EE4444441691;644444114244444:;K6666555555555555555999666664444444444444444444444226?6:66644L9M?D:111::::6DE199"),hY=Fa("020200202020020020020020020020200200200200200200200002020202001003040106000200200200200200200200200200200200200200200200200200200200200200200200200200200200020020020020020020002020200202002002002002002002002002002020002002020020200220200200200200200200200200200200020020020000200020002000200200200020020020002000200200200020020202002020202000200200020022000200200020020002002000200220002002000200W0Z00020020002002020002002000200g0j0002002000200200020020002002000200200020020002000200002000002002002002002000200020000200002002002002002002002020020020200200200200200200200200202020020020020020020020020002002002020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020002002002002002002000200200200200200200200200200020202020002000200020002002002002000020200200"),pY=(()=>{const e=new Int32Array(319).fill(-1),t=Fa("02422242:222222242224222242442222222422222244442242226224222426222422442462222422622222222626222462242622422622422424242422222222422222222242422222222222222222622442224222222222222224424442262222222222222222222226224222424242422224422422422222"),n=Fa("02222222222222222222202222222222222222222222221422222222222222222222222222222222222Y\\222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222221422222222222222222222222222222222222222Ŀł222222222222222222");for(let r=0;r<t.length;r++)e[t[r]]=n[r];return e})(),mY="container |break-after- all auto avoid avoid-page column left page right|break-before- all auto avoid avoid-page column left page right|break-inside-a uto void void-column void-page|box-decoration- clone slice|box- border content| contents flow-root hidden table table-caption table-cell table-column table-column-group table-footer-group table-header-group table-row table-row-group| not-sr-only sr-only|float- end left none right start|clear- both end left none right start|isolat e ion-auto|overflow- auto clip hidden scroll visible|overflow-x- auto clip hidden scroll visible|overflow-y- auto clip hidden scroll visible|overscroll- auto contain none|overscroll-x- auto contain none|overscroll-y- auto contain none| absolute fixed relative static sticky| collapse invisible visible|justify- around baseline between center center-safe end end-safe evenly normal start stretch|justify-items- center center-safe end end-safe normal start stretch|justify-self- auto center center-safe end end-safe start stretch|items- baseline baseline-last center center-safe end end-safe start stretch|self- auto baseline baseline-last center center-safe end end-safe start stretch|place-content- around baseline between center center-safe end end-safe evenly start stretch|place-items- baseline center center-safe end end-safe start stretch|place-self- auto center center-safe end end-safe start stretch| antialiased subpixel-antialiased| italic not-italic|normal-nums |ordinal |slashed-zero | lining-nums oldstyle-nums| proportional-nums tabular-nums| diagonal-fractions stacked-fractions| no-underline overline| capitalize lowercase normal-case uppercase|truncate |whitespace- break-spaces normal nowrap pre pre-line pre-wrap|break- all keep normal words|wrap- anywhere break-word normal|hyphens- auto manual none|mix-blend- color color-burn color-dodge darken difference exclusion hard-light hue lighten luminosity multiply normal overlay plus-darker plus-lighter saturation screen soft-light|table- auto fixed|caption- bottom top|backface- hidden visible|appearance- auto none|scheme- dark light light-dark normal only-dark only-light|field-sizing- content fixed|pointer-events- auto none|resize -none -x -y|snap- align-none center end start|snap- always normal|snap- both none x y|snap- mandatory proximity|touch- auto manipulation none|touch-pan- left right x|touch-pan- down up y|touch-pinch-zoom |select- all auto none text|forced-color-adjust- auto none| normal size| baseline bottom middle sub super text-bottom text-top top| bounce none ping pulse spin| auto square video| auto fr max min px|none | auto full px| fixed local scroll|clip- border content padding text|origin- border content padding| bottom bottom-left bottom-right center left left-bottom left-top right right-bottom right-top top top-left top-right| no-repeat repeat repeat-round repeat-space repeat-x repeat-y| auto contain cover| gradient-to-b gradient-to-bl gradient-to-br gradient-to-l gradient-to-r gradient-to-t gradient-to-tl gradient-to-tr none|blend- color color-burn color-dodge darken difference exclusion hard-light hue lighten luminosity multiply normal overlay saturation screen soft-light|to- b bl br l r t tl tr| auto dvh fit full lh lvh max min px screen svh| dashed dotted double hidden none solid| collapse separate|px |auto |full | content none strict| inline-size size|layout |paint |style | around baseline between center center-safe end end-safe evenly normal start stretch| alias all-scroll auto cell col-resize context-menu copy crosshair default e-resize ew-resize grab grabbing help move n-resize ne-resize nesw-resize no-drop none not-allowed ns-resize nw-resize nwse-resize pointer progress row-resize s-resize se-resize sw-resize text vertical-text w-resize wait zoom-in zoom-out| dashed dotted double solid wavy| auto from-font|reverse |initial | in in-out initial linear out| col col-reverse row row-reverse| nowrap wrap wrap-reverse| auto initial none| black bold extrabold extralight light medium normal semibold thin| condensed expanded extra-condensed extra-expanded normal semi-condensed semi-expanded ultra-condensed ultra-expanded|flow- col col-dense dense row row-dense| none subgrid| auto dvh dvw fit full lh lvh lvw max min px screen svh svw| block flex grid table| auto dvw fit full lvw max min px screen svw| loose none normal px relaxed snug tight|through |item | inside outside| decimal disc none| auto px| clip-border clip-content clip-fill clip-padding clip-stroke clip-view no-clip| add exclude intersect subtract| alpha luminance match|origin- border content fill padding stroke view|type- alpha luminance| circle ellipse| closest-corner closest-side farthest-corner farthest-side|at- bottom bottom-left bottom-right center left left-bottom left-top right right-bottom right-top top top-left top-right| dvh fit full lh lvh max min none px screen svh| auto dvh dvw fit full lh lvh lvw max min none px screen svh svw| dvw fit full lvw max min none px screen svw| auto dvh dvw fit full lvh lvw max min none prose px svh svw| auto dvh dvw fit full lvh lvw max min none px screen svh svw| contain cover fill none scale-down| first last none| distant dramatic midrange near none normal|inset | full none|3d | auto smooth|gutter- auto both stable| auto none thin| inner none| auto dvh dvw fit full lvh lvw max min px svh svw|base | center end justify left right start| clip ellipsis| balance nowrap pretty wrap| normal tight tighter wide wider widest| cpu gpu none| 3d flat| all colors none opacity shadow transform| discrete normal| full px| auto dvh dvw fit full lvh lvw max min px screen svh svw| auto contents scroll transform".split("|").map(e=>{const t=e.split(" "),n=t.shift();for(let r=0;r<t.length;r++)t[r]=n+t[r];return t}),H_=Fa("0000000000000000000000000000000000000000000000000000000000000262242:6@200000006:240B428:4422400002046044222426220026642642462026224222824220022400000000\\00N222422242222222224062242222222422226264222422222222222222442804222422222222222222222222220<4<0204260002444020204224422"),gY=Fa("ɠ222222222222222222222222222222222222222222222222222222222222˕4222226>ʶ22ʷʺʷ2ʸʷ42ʴ2ʓ22>621422ɶ222ɹɼɷɺɷɺ22ɱ42222ɨ2ɧ26622ɘɓ244ƸƵ222]d24242ǖǓƚÄȫ2263ȨȥȨ2222222ǣ222222222222222222ǂƽ2ƾƵ2222222422222ƜƑ22222222222222222222144Ŧţ22Ţş222222222222222222222ĸ2ı68ĦģĦɡŰ4Ġ«®ĝ822ĔđĔ2ē2222622"),yY=Fa("02222222222222222222222222222222222222222222222222222222222222222202022222222222EH2200IL021042222Y\\222IL0cf2e10j2222U00X202[^2y0000120|{~22
:22|22222222222G000qOVI00000}2>40000B00000I¨©000¬00000000000000021M®00°000000000000000000000222HGHa1º222¿2À2222ÉÌ000°2±"),K4=new Int32Array(995),Y4=new Int32Array(995),W4=new Int32Array(995);let lE="";const aE=new Int32Array(1038);{const e=new Map;let t=0,n=0;for(let r=0;r<H_.length;r++)for(const s of mY[yY[r]]){let o=e.get(s);o===void 0&&(o=t++,e.set(s,o),aE[o*2]=lE.length,aE[o*2+1]=s.length,lE+=s),K4[n]=H_[r],Y4[n]=gY[r],W4[n]=o,n++}}const xY=Fa("0b2N:222@R>F@286¦2@H2D266226FB22B2>BD\\6N22222Z222D222p"),bY=Fx(hi("1::24444432:442:44:44>222222:44:4421322511111311111114")),vY=Fa("24A;33N=C@H4A;33N=C@<27;83:;8393NQ:3NQʰ222ˉºŴŽ2R2=18cƴÅŇ=cĞÛC1ƈǝȈ:ħ25=11D3A@4=<1;1DEr25;11B3?<6;:371BCn9@7=<8192>2E121@9@EHE@9>2T25511<398454131<=V25511<398454131<=ƧNž2Đå242L222290000f22500ɛ000ǘ222"),SY=hi("ij"),wY=hi(""),EY=hi("1"),CY="* ** after backdrop before details-content file first-letter first-line marker placeholder selection";var TY={GROUP_COUNT:sY,customValidatorNames:oY,edgeStart:Ac,labelStart:iY,labelText:lY,edgeTarget:aY,nodeGroup:cY,nodeVlist:pY,vlistPat:uY,vlistOps:dY,vlistRef:fY,vlistGroup:hY,litAnchor:K4,litGroup:Y4,litPool:W4,poolOffsets:aE,poolText:lE,adjGid:xY,adjStart:bY,adjTgt:vY,patGid:SY,patTgt:wY,postfixLookupGroups:EY,orderSensitiveModifiers:CY};const NY="line"in new Error,Ko=-1,Oc=-1,_1=(e,t,n)=>{let r=2166136261;for(let s=t;s<n;s++)r=Math.imul(r^e.charCodeAt(s),16777619);return r},py=(e,t,n)=>{const r=n-t;let s=Math.imul(r,2654435761)^e.charCodeAt(t);if(r>3){const o=r>>2,l=r>>1;s=Math.imul(s^e.charCodeAt(t+1)<<8^e.charCodeAt(t+2)<<16^e.charCodeAt(t+o),2246822507),s=Math.imul(s^e.charCodeAt(t+l)<<8^e.charCodeAt(t+l+o)<<16^e.charCodeAt(n-3),3266489909),s^=e.charCodeAt(n-2)<<8^e.charCodeAt(n-1)<<16;for(let c=t+3,u=n-4;c<t+8&&c<u;c++,u--)s=Math.imul(s^e.charCodeAt(c)^e.charCodeAt(u)<<8,16777619)}return s^s>>>15|0},OY=(e,t,n={})=>{const{GROUP_COUNT:r,edgeStart:s,labelStart:o,labelText:l,edgeTarget:c,nodeGroup:u,nodeVlist:f,vlistPat:h,vlistOps:p,vlistRef:y,vlistGroup:x,litAnchor:b,litGroup:S,litPool:E,poolOffsets:C,poolText:O,adjGid:T,adjStart:R,adjTgt:k,patGid:M,patTgt:A,postfixLookupGroups:I,customValidatorNames:L,orderSensitiveModifiers:D}=e,P=new Int32Array(r).fill(-1);for(let me=0;me<T.length;me++)P[T[me]]=me;let z=0;for(let me=0;me+1<R.length;me++){const Ne=R[me+1]-R[me];Ne>z&&(z=Ne)}let $=32;for(;$<2*(1+z+M.length);)$<<=1;const j=new Int32Array(y.length+1);for(let me=0;me<y.length;me++)j[me+1]=j[me]+h[y[me]+1]-h[y[me]];const H=new Uint8Array(r);for(let me=0;me<I.length;me++)H[I[me]]=1;const B=s.length-1,V=new Uint8Array(B);let G=0,q=!0;for(let me=0;me<b.length;me++){V[b[me]]=1;const Ne=C[E[me]*2+1];Ne>G&&(G=Ne);const Re=O.charCodeAt(C[E[me]*2]);(Re===91||Re===40)&&(q=!1)}let K=1;for(;K<b.length*2;)K<<=1;const W=new Int32Array(K).fill(-1);for(let me=0;me<b.length;me++){const Ne=C[E[me]*2];let Re=(_1(O,Ne,Ne+C[E[me]*2+1])^Math.imul(b[me],2654435761)|0)&K-1;for(;W[Re]!==-1;)Re=Re+1&K-1;W[Re]=me}const ee=(me,Ne,Re,Ke)=>{let lt=(_1(Ne,Re,Ke)^Math.imul(me,2654435761)|0)&K-1;const it=Ke-Re;for(;;){const dt=W[lt];if(dt===-1)return-1;if(b[dt]===me&&C[E[dt]*2+1]===it){const Ft=C[E[dt]*2];let Pt=!0;for(let Ze=0;Ze<it;Ze++)if(O.charCodeAt(Ft+Ze)!==Ne.charCodeAt(Re+Ze)){Pt=!1;break}if(Pt)return S[dt]}lt=lt+1&K-1}},ce=n.cacheSize??8192,F=n.prefix??e.prefix??"",X=F===""?"":F+":",te=X.length,Z=(L??[]).map(me=>{throw new Error("cn: missing validator "+me)}),Y=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,le=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,xe=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,fe=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/;let oe=0,re=-1,he=-1,Se=-1,ke=-1;const be=me=>me>=97&&me<=122||me>=65&&me<=90||me>=48&&me<=57||me===95,_e=me=>/\s/.test(String.fromCharCode(me)),Me=(me,Ne,Re)=>{if(oe=0,re=-1,Re-Ne<3)return;const Ke=me.charCodeAt(Ne),lt=me.charCodeAt(Re-1);if(Ke===91&<===93)oe=1;else if(Ke===40&<===41)oe=2;else return;Se=Ne+1,ke=Re-1;let it=Ne+1;if(be(me.charCodeAt(it))){for(it++;it<Re-1;){const dt=me.charCodeAt(it);if(!be(dt)&&dt!==45)break;it++}it<Re-2&&me.charCodeAt(it)===58&&(re=Ne+1,he=it,Se=it+1)}},Le=(me,Ne,Re,Ke)=>{if(Re-Ne!==Ke.length)return!1;for(let lt=0;lt<Ke.length;lt++)if(me.charCodeAt(Ne+lt)!==Ke.charCodeAt(lt))return!1;return!0},Pe=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,pe=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Ae=me=>!!me&&!Number.isNaN(Number(me)),Ee=(me,Ne,Re)=>{if(Re-Ne<11||!Le(me,Ne,Ne+10,"@container"))return!1;if(me.charCodeAt(Ne+10)===47)return Re-Ne>=12;const Ke=me.charCodeAt(Ne+11);return Ke===115&&Re-Ne>=17&&Le(me,Ne+10,Ne+16,"-size/")||Ke===110&&Re-Ne>=19&&Le(me,Ne+10,Ne+18,"-normal/")},je=[1,1,1,1,1,1,1,1,2,2,2,2,2,2,2],Oe="length|number|number weight|family-name|position percentage|length size bg-size|image url|shadow|length|family-name|position percentage|length size bg-size|image url|shadow|number weight".split("|").map(me=>me.split(" ")),ve=[2,3,1,0,0,0,4,5,0,0,0,0,0,1,1],Fe=(me,Ne,Re,Ke)=>{if(me>=10){if(me>=25)return Z[me-25](Ne.slice(Re,Ke));const lt=me-10;if(oe!==je[lt])return!1;if(re>=0){for(const it of Oe[lt])if(Le(Ne,re,he,it))return!0;return!1}switch(ve[lt]){case 0:return!1;case 1:return!0;case 2:{const it=Ne.slice(Se,ke);return Y.test(it)&&!le.test(it)}case 3:return Ae(Ne.slice(Se,ke));case 4:return fe.test(Ne.slice(Se,ke));default:return xe.test(Ne.slice(Se,ke))}}switch(me){case 0:return!0;case 1:return oe===0;case 2:return oe===1;case 3:return oe===2;case 4:return Pe.test(Ne.slice(Re,Ke));case 5:return Ae(Ne.slice(Re,Ke));case 6:{const lt=Ne.slice(Re,Ke);return!!lt&&Number.isInteger(Number(lt))}case 7:return Ke>Re&&Ne.charCodeAt(Ke-1)===37&&Ae(Ne.slice(Re,Ke-1));case 8:return pe.test(Ne.slice(Re,Ke));default:return Ee(Ne,Re,Ke)}},Ye=new Set(typeof D=="string"?D.split(" "):D),xt=(me,Ne,Re,Ke,lt,it)=>{const dt=_1(Ne,Re,Ke)^(lt?2654435769:0)|0;let Ft=me.get(dt);if(Ft!==void 0)e:for(let ht=0;ht<Ft.length;ht++){const Dt=Ft[ht];if(!(Dt.imp!==lt||Dt.k.length!==Ke-Re)){for(let rt=0;rt<Dt.k.length;rt++)if(Dt.k.charCodeAt(rt)!==Ne.charCodeAt(Re+rt))continue e;return Dt.id}}else me.set(dt,Ft=[]);const Pt=Ne.slice(Re,Ke),Ze=it(Pt);return Ft.push({k:Pt,imp:lt,id:Ze}),Ze};let nn=new Map,Te=new Map,De=2;const tt=4096,At=(me,Ne)=>{const Re=[];let Ke=0,lt=0,it=0;for(let Ze=0;Ze<me.length;Ze++){const ht=me.charCodeAt(Ze);Ke===0&<===0&&ht===58?(Re.push(me.slice(it,Ze)),it=Ze+1):ht===91?Ke++:ht===93?Ke--:ht===40?lt++:ht===41&<--}Re.push(me.slice(it));let dt=Re[0];if(Re.length>1){const Ze=[];let ht=[];for(const Dt of Re)Dt.charCodeAt(0)===91||Ye.has(Dt)?(ht.length&&(Ze.push(...ht.sort()),ht=[]),Ze.push(Dt)):ht.push(Dt);ht.length&&Ze.push(...ht.sort()),dt=Ze.join(":")}const Ft=Ne?dt+" !":dt;let Pt=Te.get(Ft);return Pt===void 0&&Te.set(Ft,Pt=De++),Pt};let gn=new Map,yn=r;const Fr=r+4096,cn=()=>yn++,cr=2097152,$r=8192,Es=new Int32Array($r),qn=new Array($r).fill(null),yt=new Int32Array($r),un=new Int32Array($r),Gn=new Uint8Array($r);let Rn=0;const An=(me,Ne,Re,Ke,lt,it,dt,Ft)=>{let Pt=me;if(qn[me]!==null)if(qn[me|1]===null)Pt=me|1;else if((Rn++&3)===0)Pt=me|Rn>>2&1;else return;qn[Pt]=Ne.slice(Re,Ke),Es[Pt]=lt,yt[Pt]=it,un[Pt]=dt,Gn[Pt]=Ft},Ht=()=>qn.fill(null);let Zt=256,Jt=[new Int32Array(Zt),new Int32Array(Zt),new Int32Array(Zt),new Int32Array(Zt)],[Ur,Kn,Ln,ur]=Jt,dr=new Uint8Array(Zt),fr=new Uint8Array(Zt);const as=()=>{Zt*=2,Jt=Jt.map(Ne=>{const Re=new Int32Array(Zt);return Re.set(Ne),Re}),[Ur,Kn,Ln,ur]=Jt;const me=new Uint8Array(Zt);me.set(dr),dr=me,fr=new Uint8Array(Zt)};let Ar=64,kr=new Int32Array(Ar),cs=new Int32Array(Ar);const fo=new Int32Array(r);let hr=2048,Do=21,Cs=new Float64Array(hr),El=new Int32Array(hr),Ts=0;const Cl=(me,Ne)=>{if(me===0&&Ne<r)return fo[Ne]===Ts?1:(fo[Ne]=Ts,0);const Re=me*2097152+Ne+1;let Ke=Math.imul(Re,2654435761)>>>Do;for(;El[Ke]===Ts;){if(Cs[Ke]===Re)return 1;Ke=Ke+1&hr-1}return Cs[Ke]=Re,El[Ke]=Ts,0},gi=(me,Ne,Re,Ke,lt)=>{if(Re-Ne>=2&&me.charCodeAt(Ne)===91&&me.charCodeAt(Re-1)===93){let it=-1;for(let dt=Ne+1;dt<Re-1;dt++)if(me.charCodeAt(dt)===58){it=dt;break}return it===-1||it===Ne+1?Ko:xt(gn,me,Ne+1,it,0,cn)}if(Ke>=0&&u[Ke]>=0)return u[Ke];for(let it=lt-1;it>=0;it--){const dt=cs[it];if(dt>Re)continue;const Ft=kr[it],Pt=Re-dt;if(V[Ft]===1&&Pt>0&&Pt<=G){const bn=me.charCodeAt(dt);if(q===!1||bn!==91&&bn!==40){const Os=ee(Ft,me,dt,Re);if(Os>=0)return Os}}const Ze=f[Ft];if(Ze<0)continue;const ht=y[Ze],Dt=h[ht],rt=h[ht+1];if(Dt===rt)continue;Me(me,dt,Re);const Wn=j[Ze]-Dt;for(let bn=Dt;bn<rt;bn++)if(Fe(p[bn],me,dt,Re))return x[Wn+bn]}return Ko},ho=me=>{const Ne=me.length;let Re=0,Ke=0,lt=!1;(De>tt||nn.size>tt)&&(nn=new Map,Te=new Map,De=2,Ht()),yn>Fr&&(gn=new Map,yn=r,Ht());let it=0;for(;it<Ne;){let Ze=me.charCodeAt(it);if(Ze===32||Ze>=9&&Ze<=13||Ze>=160&&_e(Ze)){Ze!==32&&(lt=!0),it++;continue}const ht=it;let Dt=0;for(;it<Ne;){if(Ze=me.charCodeAt(it),Ze<=32){if(Ze===32)break;if(Ze>=9&&Ze<=13){lt=!0;break}}else if(Ze>=160&&_e(Ze)){lt=!0;break}Dt=Math.imul(Dt^Ze,16777619),it++}const rt=it,Wn=rt-ht;Re===Zt&&as();const bn=Re++;Ur[bn]=ht,Kn[bn]=rt,Ke+=Wn,Dt^=Math.imul(Wn,2654435761);const Os=Dt^Dt>>>15|0,Dn=Os&8190;{let _t=-1;if(Es[Dn]===Os&&qn[Dn]!==null&&qn[Dn].length===Wn?_t=Dn:Es[Dn|1]===Os&&qn[Dn|1]!==null&&qn[Dn|1].length===Wn&&(_t=Dn|1),_t>=0){const er=qn[_t];let Ks=!0;for(let ks=0;ks<Wn;ks++)if(er.charCodeAt(ks)!==me.charCodeAt(ht+ks)){Ks=!1;break}if(Ks){Ln[bn]=yt[_t],ur[bn]=un[_t],dr[bn]=Gn[_t];continue}}}let jn=ht;if(te!==0){if(rt-ht<=te||!me.startsWith(X,ht)){Ln[bn]=Ko,An(Dn,me,ht,rt,Os,Ko,0,0);continue}jn=ht+te}let ku=0,Hf=0,Si=-1,_u=-1;for(let _t=jn;_t<rt;_t++){const er=me.charCodeAt(_t);if(ku===0&&Hf===0){if(er===58){Si=_t;continue}if(er===47){_u=_t;continue}}er===91?ku++:er===93?ku--:er===40?Hf++:er===41&&Hf--}const Qm=Si>=jn?Si+1:jn;let ln=Qm,_r=rt,Rl=!1,Mu=0;_r>ln&&me.charCodeAt(_r-1)===33?(Rl=!0,_r--):_r>ln&&me.charCodeAt(ln)===33&&(Rl=!0,ln++,Mu=1);let fs=-1;_u>Qm&&(fs=_u+Mu,fs>=_r&&(fs=-1));let Iu=ln;_r-ln>1&&me.charCodeAt(ln)===45&&(Iu=ln+1);let Rs=0,qr=0,Al=0,Ff=-1,As=0;(f[0]>=0||V[0]===1)&&(kr[0]=0,cs[0]=Iu,As=1);let tc=Oc,$f=0;for(let _t=Iu;_t<_r;_t++)if(_t===fs&&(tc=qr<Al?Oc:Rs,$f=As),Rs!==Oc){const er=me.charCodeAt(_t);let Ks=-1;if(qr<Al)l.charCodeAt(qr)===er?(qr++,qr===Al&&(Ks=Rs=Ff)):Rs=Oc;else{const ks=s[Rs],sc=s[Rs+1];let wi=Oc;for(let mr=ks;mr<sc;mr++){const oc=o[mr];if(l.charCodeAt(oc)===er){o[mr+1]-oc===1?Ks=wi=c[mr]:(qr=oc+1,Al=o[mr+1],Ff=c[mr],wi=Rs);break}}Rs=wi}if(Ks>=0&&(f[Ks]>=0||V[Ks]===1)&&_t+1<_r&&me.charCodeAt(_t+1)===45){if(As===Ar){Ar*=2;const ks=new Int32Array(Ar);ks.set(kr),kr=ks;const sc=new Int32Array(Ar);sc.set(cs),cs=sc}kr[As]=Ks,cs[As]=_t+2,As++}}fs===_r&&(tc=qr<Al?Oc:Rs,$f=As);const Uf=qr<Al?Oc:Rs;let pr,Gr=!1;if(fs>=0)if(Gr=!0,pr=gi(me,ln,fs,tc,$f),pr!==Ko&&pr<r&&H[pr]){const _t=gi(me,ln,_r,Uf,As);_t!==Ko&&_t!==pr&&(pr=_t,Gr=!1)}else pr===Ko&&(pr=gi(me,ln,_r,Uf,As),Gr=!1);else pr=gi(me,ln,_r,Uf,As);let nc=0,rc=0;pr===Ko?Ln[bn]=Ko:(rc=Gr?1:0,nc=jn>=Si?Rl?1:0:xt(nn,me,jn,Si,Rl?1:0,_t=>At(_t,Rl)),Ln[bn]=pr,dr[bn]=rc,ur[bn]=nc),An(Dn,me,ht,rt,Os,pr,nc,rc)}if(Re===0)return"";if(Re===1)return Ur[0]===0&&Kn[0]===Ne?me:me.slice(Ur[0],Kn[0]);if(Re*$>hr){for(;Re*$>hr;)hr<<=1,Do--;Cs=new Float64Array(hr),El=new Int32Array(hr)}if(De>=cr||yn>=cr)throw new Error("cn: too many distinct classes in one merge");Ts=Ts+1|0,Ts===0&&(fo.fill(0),El.fill(0),Ts=1);let dt=!1;for(let Ze=Re-1;Ze>=0;Ze--){const ht=Ln[Ze];if(ht===Ko){fr[Ze]=1;continue}const Dt=ur[Ze];if(Cl(Dt,ht)===1){fr[Ze]=0,dt=!0;continue}if(fr[Ze]=1,ht<r){const rt=P[ht];if(rt>=0)for(let Wn=R[rt];Wn<R[rt+1];Wn++)Cl(Dt,k[Wn]);if(dr[Ze]&1)for(let Wn=0;Wn<M.length;Wn++)M[Wn]===ht&&Cl(Dt,A[Wn])}}if(!dt&&!lt&&Ne===Ke+Re-1)return me;let Ft="",Pt=0;for(;Pt<Re;){if(!fr[Pt]){Pt++;continue}const Ze=Ur[Pt];let ht=Kn[Pt],Dt=Pt+1;for(;Dt<Re&&fr[Dt]&&Ur[Dt]===ht+1&&me.charCodeAt(ht)===32;)ht=Kn[Dt],Dt++;Ft.length>0&&(Ft+=" "),Ft+=me.slice(Ze,ht),Pt=Dt}return Ft},us=16384,ds=new Int32Array(us*2);let yi=0,xn=1,on=Object.create(null),Yn=Object.create(null),Vr=new Map,ec=new Map,xi=0,Tl=0;const jo=()=>{yi^=us,xn=xn+1|0,Tl=0},bi=me=>{let Ne=on[me];if(Ne!==void 0)return Ne;const Re=py(me,0,me.length),Ke=(Re&16383)+yi,lt=ds[Ke]===(Re^xn)||ds[Ke^us]===(Re^xn-1);return lt&&(Ne=Yn[me],Ne!==void 0)?(on[me]=Ne,Ne):(Ne=ho(me),lt?(on[me]=Ne,++xi>ce&&(xi=0,Yn=on,on=Object.create(null),jo())):(ds[Ke]=Re^xn,++Tl>us&&jo()),Ne)},Nl=me=>{let Ne=Vr.get(me);if(Ne!==void 0)return Ne;const Re=py(me,0,me.length),Ke=(Re&16383)+yi,lt=ds[Ke]===(Re^xn)||ds[Ke^us]===(Re^xn-1);return lt&&(Ne=ec.get(me),Ne!==void 0)?(Vr.set(me,Ne),Ne):(Ne=ho(me),lt?(Vr.set(me,Ne),++xi>ce&&(xi=0,ec=Vr,Vr=new Map,jo())):(ds[Ke]=Re^xn,++Tl>us&&jo()),Ne)},Ol=me=>{const Ne=py(me,0,me.length),Re=(Ne&16383)+yi;return ds[Re]===(Ne^xn)||ds[Re^us]===(Ne^xn-1)?!0:(ds[Re]=Ne^xn,++Tl>us&&jo(),!1)},Ns=ce===0?ho:NY?me=>{const Ne=Vr.get(me);return Ne!==void 0?Ne:Nl(me)}:bi;return{merge:function(){return arguments.length===1&&typeof arguments[0]=="string"?Ns(arguments[0]):Ns(AY.apply(null,arguments))},mergeString:Ns,seenBefore:ce===0?()=>!1:Ol,mergeUncached:ho}},By=(e,t)=>{if(!e)return"";if(typeof e=="string")return e;let n="";if(typeof e.length=="number"&&(!t||Array.isArray(e))){const r=e;for(let s=0;s<r.length;s++){const o=r[s];if(!o)continue;const l=typeof o=="string"?o:By(o,t);l&&(n&&(n+=" "),n+=l)}return n}if(t){if(typeof e=="number")return""+e;if(typeof e=="object")for(const r in e)e[r]&&(n&&(n+=" "),n+=r)}return n},RY=(e,t)=>{let n="";for(let r=0;r<e.length;r++){const s=e[r];if(!s)continue;const o=typeof s=="string"?s:By(s,t);o&&(n&&(n+=" "),n+=o)}return n},AY=function(){return RY(arguments,!1)},kY=256,F_=16,_Y=1024,M1=4096,MY=(e,t)=>{const n=t===void 0?()=>!0:t.seenBefore,r=t===void 0?e:t.mergeUncached;let s=new Map,o=new Map,l=0,c=null,u=null,f=[],h=[],p=0;const y=(C,O,T)=>{u===null&&(u=new Array(M1).fill(""),f=new Array(M1).fill(""),h=new Array(M1).fill(""));const R=py(C,0,C.length)&4094;if(u[R]===C&&f[R]===O)return h[R];if(u[R|1]===C&&f[R|1]===O)return h[R|1];const k=e(T?O+" "+C:C),M=u[R]===""?R:R|(u[R|1]===""?1:p++&1);return u[M]=C,f[M]=O,h[M]=k,k},x=(C,O,T,R)=>{let k=0;if(O){if(O!==C.a0)return!1;k=1}if(T){if(T!==(k===0?C.a0:C.a1))return!1;k++}if(R){if(R!==(k===0?C.a0:k===1?C.a1:C.a2))return!1;k++}return k===C.t},b=(C,O)=>{const T=C.a;let R=0;for(let k=0;k<O.length;k++){const M=O[k];if(M){if(M!==T[R])return!1;R++}}return R===C.t},S=(C,O)=>{const T=C.length,R=c===null?null:c.n;if(!O){if(R!==null&&b(R,C))return c=R,R.r;if(c!==null&&c!==R&&b(c,C))return c.r}let k="",M=-1,A=0,I=!1;for(let P=0;P<T;P++){let z=C[P];if(z){if(typeof z!="string"){if(z=C[P]=By(z,!0),!z)continue;I=!0}M<0&&(k=z,M=P),A++}}if(A===0)return"";if(A===1)return e(k);if(I){if(R!==null&&b(R,C))return c=R,R.r;if(c!==null&&c!==R&&b(c,C))return c.r}let L=s.get(k);L===void 0&&(L=o.get(k),L!==void 0&&s.set(k,L));let D=null;if(L!==void 0){if(L.skip>0){L.skip--,c=null;let z=k;for(let $=M+1;$<T;$++){const j=C[$];j&&(z+=" "+j)}return y(z,"",!1)}const P=L.e;e:for(let z=0;z<P.length;z++){const $=P[z];if($.t!==A)continue;const j=$.a;let H=1;for(let B=M+1;B<T;B++){const V=C[B];if(V&&V!==j[H++])continue e}D=$;break}D!==null&&(L.miss=0)}if(D===null){let P=k;const z=[k];for(let j=M+1;j<T;j++){const H=C[j];H&&(P+=" "+H,z.push(H))}if(!n(P))return r(P);D={r:e(P),t:z.length,a0:z[0],a1:z[1],a2:z[2]??"",a:z,n:null},L===void 0?s.set(k,L={e:[],miss:0,skip:0,at:0}):++L.miss>F_&&(L.miss=F_,L.skip=_Y,L.e.length=0,L.at=0);const $=L.e;$.length<kY?$.push(D):($[L.at]=D,L.at=L.at+1&255),++l>1e3&&(l=0,o=s,s=new Map)}return c!==null&&c!==D&&(c.n=D),c=D,D.r},E=C=>Array.isArray(C)?S(C.slice(),!1):e(By(C,!0));return function(C,O,T){const R=arguments.length;if((R|1)===3){const A=c;if(A!==null){const I=A.n;if(I!==null&&x(I,C,O,T))return c=I,I.r;if(A!==I&&x(A,C,O,T))return A.r}if(R===2&&typeof O=="string"&&O!==""){const I=s.get(C);if(I!==void 0&&I.skip>0)return I.skip--,c=null,y(O,C,!0)}return S([C,O,T],!0)}if(R===1)return typeof C=="string"?e(C):E(C);const k=c;if(k!==null){const A=k.n;if(A!==null){const I=A.a;let L=0,D=!0;for(let P=0;P<R;P++){const z=arguments[P];if(z){if(z!==I[L]){D=!1;break}L++}}if(D&&L===A.t)return c=A,A.r}if(k!==A){const I=k.a;let L=0,D=!0;for(let P=0;P<R;P++){const z=arguments[P];if(z){if(z!==I[L]){D=!1;break}L++}}if(D&&L===k.t)return k.r}}const M=[];for(let A=0;A<R;A++)M.push(arguments[A]);return S(M,!0)}},$_=OY(TY),ye=MY($_.mergeString,$_),IY=rY("group/button inline-flex shrink-0 items-center justify-center rounded-lg border border-transparent bg-clip-padding text-sm font-normal whitespace-nowrap transition-all outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 active:not-aria-[haspopup]:translate-y-px disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",{variants:{variant:{default:"bg-primary font-bold text-primary-foreground hover:bg-[color-mix(in_oklch,var(--primary),var(--foreground)_12%)]",outline:"border-input bg-card hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-[color-mix(in_oklch,var(--secondary),var(--foreground)_5%)] aria-expanded:bg-secondary aria-expanded:text-secondary-foreground",ghost:"hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:hover:bg-muted/50",destructive:"bg-destructive/10 text-destructive hover:bg-destructive/20 focus-visible:border-destructive/40 focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:hover:bg-destructive/30 dark:focus-visible:ring-destructive/40",link:"text-foreground underline-offset-4 hover:underline"},size:{default:"h-8 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",xs:"h-6 gap-1 rounded-[min(var(--radius-md),10px)] px-2 text-xs in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3",sm:"h-7 gap-1 rounded-[min(var(--radius-md),12px)] px-2.5 text-[0.8rem] in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3.5",lg:"h-9 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",icon:"size-8","icon-xs":"size-6 rounded-[min(var(--radius-md),10px)] in-data-[slot=button-group]:rounded-lg [&_svg:not([class*='size-'])]:size-3","icon-sm":"size-7 rounded-[min(var(--radius-md),12px)] in-data-[slot=button-group]:rounded-lg","icon-lg":"size-9"}},defaultVariants:{variant:"default",size:"default"}});function st({className:e,variant:t="default",size:n="default",children:r,...s}){return m.jsx(tY,{"data-slot":"button",className:ye(IY({variant:t,size:n,className:e})),...s,children:typeof r=="string"?m.jsx("span",{className:"text-box-cap",children:r}):r})}const LY="/server-error.svg",DY="The backend did not say what went wrong.",jY=e=>e instanceof Error?e.message:DY,X4=({heading:e,error:t,className:n,children:r})=>{const s=qs();return m.jsxs("section",{role:"alert",className:ye("mx-auto flex max-w-prose flex-col items-center text-center",n),children:[m.jsx(L4,{src:LY}),m.jsx("h1",{className:"mt-4 text-2xl font-bold tracking-[-0.01em]",children:e}),m.jsx("p",{className:"mt-2 text-muted-foreground",children:jY(t)}),m.jsxs("div",{className:"mt-4 flex items-center gap-4",children:[m.jsx(st,{onClick:()=>{s.invalidate()},children:"Try again"}),r]})]})};function Rf(e){const t={subscribe(n){let r=null,s=!1,o=!1,l=!1;function c(){if(r===null){l=!0;return}o||(o=!0,typeof r=="function"?r():r&&r.unsubscribe())}return r=e({next(u){var f;s||(f=n.next)===null||f===void 0||f.call(n,u)},error(u){var f;s||(s=!0,(f=n.error)===null||f===void 0||f.call(n,u),c())},complete(){var u;s||(s=!0,(u=n.complete)===null||u===void 0||u.call(n),c())}}),l&&c(),{unsubscribe:c}},pipe(...n){return n.reduce(PY,t)}};return t}function PY(e,t){return t(e)}function zY(e){const t=new AbortController;return new Promise((n,r)=>{let s=!1;function o(){s||(s=!0,l.unsubscribe())}t.signal.addEventListener("abort",()=>{r(t.signal.reason)});const l=e.subscribe({next(c){s=!0,n(c),o()},error(c){r(c)},complete(){t.abort(),o()}})})}function BY(e){return t=>{let n=0,r=null;const s=[];function o(){r||(r=t.subscribe({next(c){for(const f of s){var u;(u=f.next)===null||u===void 0||u.call(f,c)}},error(c){for(const f of s){var u;(u=f.error)===null||u===void 0||u.call(f,c)}},complete(){for(const u of s){var c;(c=u.complete)===null||c===void 0||c.call(u)}}}))}function l(){if(n===0&&r){const c=r;r=null,c.unsubscribe()}}return Rf(c=>(n++,s.push(c),o(),{unsubscribe(){n--,l();const u=s.findIndex(f=>f===c);u>-1&&s.splice(u,1)}}))}}function Q4(e){let t=e;const n=[],r=l=>{t!==void 0&&l.next(t),n.push(l)},s=l=>{n.splice(n.indexOf(l),1)},o=Rf(l=>(r(l),()=>{s(l)}));return o.next=l=>{if(t!==l){t=l;for(const c of n)c.next(l)}},o.get=()=>t,o}function Z4(e){return Rf(t=>{function n(r=0,s=e.op){const o=e.links[r];if(!o)throw new Error("No more links to execute - did you forget to add an ending link?");return o({op:s,next(l){return n(r+1,l)}})}return n().subscribe(t)})}function U_(e){return Array.isArray(e)?e:[e]}function HY(e){return t=>{const n=U_(e.true).map(s=>s(t)),r=U_(e.false).map(s=>s(t));return s=>Rf(o=>{const l=e.condition(s.op)?n:r;return Z4({op:s.op,links:l}).subscribe(o)})}}function Tp(e){"@babel/helpers - typeof";return Tp=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Tp(e)}function FY(e,t){if(Tp(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(Tp(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function $Y(e){var t=FY(e,"string");return Tp(t)=="symbol"?t:t+""}function jr(e,t,n){return(t=$Y(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function V_(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,r)}return n}function Mn(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?V_(Object(n),!0).forEach(function(r){jr(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):V_(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function $a(e){return!!e&&!Array.isArray(e)&&typeof e=="object"}function UY(e){return typeof e=="function"}function J4(){return Object.create(null)}const VY=typeof Symbol=="function"&&!!Symbol.asyncIterator;function qY(e){return VY&&$a(e)&&Symbol.asyncIterator in e}const R2=e=>e(),E0={INTERNAL_SERVER_ERROR:-32603,BAD_GATEWAY:-32603,SERVICE_UNAVAILABLE:-32603,GATEWAY_TIMEOUT:-32603},GY=[E0.BAD_GATEWAY,E0.SERVICE_UNAVAILABLE,E0.GATEWAY_TIMEOUT,E0.INTERNAL_SERVER_ERROR],e3=()=>{},q_=e=>{Object.freeze&&Object.freeze(e)};function t3(e,t,n){var r;const s=t.join(".");return(r=n[s])!==null&&r!==void 0||(n[s]=new Proxy(e3,{get(o,l){if(!(typeof l!="string"||l==="then"))return t3(e,[...t,l],n)},apply(o,l,c){const u=t[t.length-1];if(u==="valueOf"||u==="toString"||u==="toJSON")return`tRPC.proxy(${t.slice(0,-1).join(".")})`;let f={args:c,path:t};return u==="call"?f={args:c.length>=2?[c[1]]:[],path:t.slice(0,-1)}:u==="apply"&&(f={args:c.length>=2?c[1]:[],path:t.slice(0,-1)}),q_(f.args),q_(f.path),e(f)}})),n[s]}const n3=e=>t3(e,[],J4()),KY=e=>new Proxy(e3,{get(t,n){if(n!=="then")return e(n)}});function Np(e){"@babel/helpers - typeof";return Np=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Np(e)}function YY(e,t){if(Np(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(Np(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function WY(e){var t=YY(e,"string");return Np(t)=="symbol"?t:t+""}function jc(e,t,n){return(t=WY(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function G_(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,r)}return n}function C0(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?G_(Object(n),!0).forEach(function(r){jc(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):G_(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var XY=class extends Error{constructor(e){super(QY(e)),Object.assign(this,e)}};function QY(e){if("message"in e)return String(e.message)}function ZY(e){if(e instanceof Error)return e;const t=typeof e;if(!(t==="undefined"||t==="function"||e===null)){if(t!=="object")return new Error(String(e));if($a(e))return new XY(e)}}var K_=class extends Error{constructor(e){var t,n,r;const s=ZY(e.cause),o=(t=(n=e.message)!==null&&n!==void 0?n:s==null?void 0:s.message)!==null&&t!==void 0?t:e.code;super(o,{cause:s}),jc(this,"cause",void 0),jc(this,"code",void 0),this.code=e.code,this.name="TRPCError",(r=this.cause)!==null&&r!==void 0||(this.cause=s)}};function JY(e,t){if("error"in e){const n=t.deserialize(e.error);return{ok:!1,error:C0(C0({},e),{},{error:n})}}return{ok:!0,result:C0(C0({},e.result),(!e.result.type||e.result.type==="data")&&{type:"data",data:t.deserialize(e.result.data)})}}var I1=class extends Error{constructor(){super("Unable to transform response from server")}};function eW(e,t){let n;try{n=JY(e,t)}catch{throw new I1}if(!n.ok&&(!$a(n.error.error)||typeof n.error.error.code!="number"))throw new I1;if(n.ok&&!$a(n.result))throw new I1;return n}function tW(e){return typeof e=="function"}async function nW(e,t){const{_def:n}=e;let r=n.procedures[t];for(;!r;){const s=Object.keys(n.lazy).find(o=>t===o||t.startsWith(o+"."));if(!s)return null;await n.lazy[s].load(),r=n.procedures[t]}return r}async function rW(e){const{type:t,path:n}=e,r=await nW(e.router,n);if(!r||!tW(r)||r._def.type!==t&&!e.allowMethodOverride)throw new K_({code:"NOT_FOUND",message:`No "${t}"-procedure on path "${n}"`});/* istanbul ignore if -- @preserve */if(r._def.type!==t&&e.allowMethodOverride&&r._def.type==="subscription")throw new K_({code:"METHOD_NOT_SUPPORTED",message:"Method override is not supported for subscriptions"});return r(e)}let r3;const L1=new WeakMap,sW=()=>{};r3=Symbol.toStringTag;var s3=class kc{constructor(t){jc(this,"promise",void 0),jc(this,"subscribers",[]),jc(this,"settlement",null),jc(this,r3,"Unpromise"),typeof t=="function"?this.promise=new Promise(t):this.promise=t;const n=this.promise.then(r=>{const{subscribers:s}=this;this.subscribers=null,this.settlement={status:"fulfilled",value:r},s==null||s.forEach(({resolve:o})=>{o(r)})});"catch"in n&&n.catch(r=>{const{subscribers:s}=this;this.subscribers=null,this.settlement={status:"rejected",reason:r},s==null||s.forEach(({reject:o})=>{o(r)})})}subscribe(){let t,n;const{settlement:r}=this;if(r===null){if(this.subscribers===null)throw new Error("Unpromise settled but still has subscribers");const s=iW();this.subscribers=lW(this.subscribers,s),t=s.promise,n=()=>{this.subscribers!==null&&(this.subscribers=cW(this.subscribers,s))}}else{const{status:s}=r;s==="fulfilled"?t=Promise.resolve(r.value):t=Promise.reject(r.reason),n=sW}return Object.assign(t,{unsubscribe:n})}then(t,n){const r=this.subscribe(),{unsubscribe:s}=r;return Object.assign(r.then(t,n),{unsubscribe:s})}catch(t){const n=this.subscribe(),{unsubscribe:r}=n;return Object.assign(n.catch(t),{unsubscribe:r})}finally(t){const n=this.subscribe(),{unsubscribe:r}=n;return Object.assign(n.finally(t),{unsubscribe:r})}static proxy(t){const n=kc.getSubscribablePromise(t);return typeof n<"u"?n:kc.createSubscribablePromise(t)}static createSubscribablePromise(t){const n=new kc(t);return L1.set(t,n),L1.set(n,n),n}static getSubscribablePromise(t){return L1.get(t)}static resolve(t){const n=typeof t=="object"&&t!==null&&"then"in t&&typeof t.then=="function"?t:Promise.resolve(t);return kc.proxy(n).subscribe()}static async any(t){const n=(Array.isArray(t)?t:[...t]).map(kc.resolve);try{return await Promise.any(n)}finally{n.forEach(({unsubscribe:r})=>{r()})}}static async race(t){const n=(Array.isArray(t)?t:[...t]).map(kc.resolve);try{return await Promise.race(n)}finally{n.forEach(({unsubscribe:r})=>{r()})}}static async raceReferences(t){const n=t.map(oW);try{return await Promise.race(n)}finally{for(const r of n)r.unsubscribe()}}};function oW(e){return s3.proxy(e).then(()=>[e])}function iW(){let e,t;return{promise:new Promise((n,r)=>{e=n,t=r}),resolve:e,reject:t}}function lW(e,t){return[...e,t]}function aW(e,t){return[...e.slice(0,t),...e.slice(t+1)]}function cW(e,t){const n=e.indexOf(t);return n!==-1?aW(e,n):e}var Y_,W_,X_,Q_;(W_=(Y_=Symbol).dispose)!==null&&W_!==void 0||(Y_.dispose=Symbol());(Q_=(X_=Symbol).asyncDispose)!==null&&Q_!==void 0||(X_.asyncDispose=Symbol());function uW(e,t){const n=e,r=n[Symbol.dispose];return n[Symbol.dispose]=()=>{t(),r==null||r.call(n)},n}function dW(e,t){const n=e,r=n[Symbol.asyncDispose];return n[Symbol.asyncDispose]=async()=>{await t(),await(r==null?void 0:r.call(n))},n}const o3=Symbol();function fW(e){let t=null;return uW({start(){if(t)throw new Error("Timer already started");return new Promise(n=>{t=setTimeout(()=>n(o3),e)})}},()=>{t&&clearTimeout(t)})}function i3(){var e=typeof SuppressedError=="function"?SuppressedError:function(s,o){var l=Error();return l.name="SuppressedError",l.error=s,l.suppressed=o,l},t={},n=[];function r(s,o){if(o!=null){if(Object(o)!==o)throw new TypeError("using declarations can only be used with objects, functions, null, or undefined.");if(s)var l=o[Symbol.asyncDispose||Symbol.for("Symbol.asyncDispose")];if(l===void 0&&(l=o[Symbol.dispose||Symbol.for("Symbol.dispose")],s))var c=l;if(typeof l!="function")throw new TypeError("Object is not disposable.");c&&(l=function(){try{c.call(o)}catch(f){return Promise.reject(f)}}),n.push({v:o,d:l,a:s})}else s&&n.push({d:o,a:s});return o}return{e:t,u:r.bind(null,!1),a:r.bind(null,!0),d:function(){var o,l=this.e,c=0;function u(){for(;o=n.pop();)try{if(!o.a&&c===1)return c=0,n.push(o),Promise.resolve().then(u);if(o.d){var h=o.d.call(o.v);if(o.a)return c|=2,Promise.resolve(h).then(u,f)}else c|=1}catch(p){return f(p)}if(c===1)return l!==t?Promise.reject(l):Promise.resolve();if(l!==t)throw l}function f(h){return l=l!==t?new e(h,l):h,u()}return u()}}}function l3(e,t){this.v=e,this.k=t}function Z_(e){return new l3(e,0)}function hW(e){return function(){return new Wh(e.apply(this,arguments))}}function Wh(e){var t,n;function r(o,l){try{var c=e[o](l),u=c.value,f=u instanceof l3;Promise.resolve(f?u.v:u).then(function(h){if(f){var p=o==="return"?"return":"next";if(!u.k||h.done)return r(p,h);h=e[p](h).value}s(c.done?"return":"normal",h)},function(h){r("throw",h)})}catch(h){s("throw",h)}}function s(o,l){switch(o){case"return":t.resolve({value:l,done:!0});break;case"throw":t.reject(l);break;default:t.resolve({value:l,done:!1})}(t=t.next)?r(t.key,t.arg):n=null}this._invoke=function(o,l){return new Promise(function(c,u){var f={key:o,arg:l,resolve:c,reject:u,next:null};n?n=n.next=f:(t=n=f,r(o,l))})},typeof e.return!="function"&&(this.return=void 0)}Wh.prototype[typeof Symbol=="function"&&Symbol.asyncIterator||"@@asyncIterator"]=function(){return this},Wh.prototype.next=function(e){return this._invoke("next",e)},Wh.prototype.throw=function(e){return this._invoke("throw",e)},Wh.prototype.return=function(e){return this._invoke("return",e)};const pW="ping",mW="serialized-error",gW="connected",yW="return";async function xW(e){try{var t=i3();const n=t.u(fW(e.timeoutMs)),r=await s3.race([e.promise,n.start()]);return r===o3?await e.onTimeout():r}catch(n){t.e=n}finally{t.d()}}function bW(e){const{deserialize:t=c=>c}=e;let n=J4();const r=e.signal;let s=null;const o=()=>new ReadableStream({async start(c){const[u,f]=await Promise.all([e.url(),e.init()]),h=s=new e.EventSource(u,f);c.enqueue({type:"connecting",eventSource:s,event:null}),h.addEventListener(gW,y=>{const x=JSON.parse(y.data);n=x,c.enqueue({type:"connected",options:x,eventSource:h})}),h.addEventListener(mW,y=>{const x=y;c.enqueue({type:"serialized-error",error:t(JSON.parse(x.data)),eventSource:h})}),h.addEventListener(pW,()=>{c.enqueue({type:"ping",eventSource:h})}),h.addEventListener(yW,()=>{h.close(),c.close(),s=null}),h.addEventListener("error",y=>{h.readyState===h.CLOSED?c.error(y):c.enqueue({type:"connecting",eventSource:h,event:y})}),h.addEventListener("message",y=>{const x=y,b={data:t(JSON.parse(x.data))};x.lastEventId&&(b.id=x.lastEventId),c.enqueue({type:"data",data:b,eventSource:h})});const p=()=>{try{h.close(),c.close()}catch{}};r.aborted?p():r.addEventListener("abort",p)},cancel(){s==null||s.close()}}),l=()=>{let c=o(),u=c.getReader();async function f(){await u.cancel(),s=null}return dW({read(){return u.read()},async recreate(){await f(),c=o(),u=c.getReader()}},f)};return R2(hW(function*(){try{var c=i3();const u=c.a(l());for(;;){let f=u.read();const h=n.reconnectAfterInactivityMs;h&&(f=xW({promise:f,timeoutMs:h,onTimeout:async()=>{const y={value:{type:"timeout",ms:h,eventSource:s},done:!1};return await u.recreate(),y}}));const p=yield Z_(f);if(p.done)return p.value;yield p.value}}catch(u){c.e=u}finally{yield Z_(c.d())}}))}function vW(e){return e instanceof wa}function SW(e){return $a(e)&&$a(e.error)&&typeof e.error.code=="number"&&typeof e.error.message=="string"}function wW(e,t){return typeof e=="string"?e:$a(e)&&typeof e.message=="string"?e.message:t}var wa=class my extends Error{constructor(t,n){var r,s;const o=n==null?void 0:n.cause;super(t,{cause:o}),jr(this,"cause",void 0),jr(this,"shape",void 0),jr(this,"data",void 0),jr(this,"meta",void 0),this.meta=n==null?void 0:n.meta,this.cause=o,this.shape=n==null||(r=n.result)===null||r===void 0?void 0:r.error,this.data=n==null||(s=n.result)===null||s===void 0?void 0:s.error.data,this.name="TRPCClientError",Object.setPrototypeOf(this,my.prototype)}static from(t,n={}){const r=t;return vW(r)?(n.meta&&(r.meta=Mn(Mn({},r.meta),n.meta)),r):SW(r)?new my(r.error.message,Mn(Mn({},n),{},{result:r,cause:n.cause})):new my(wW(r,"Unknown error"),Mn(Mn({},n),{},{cause:r}))}};function a3(e){const t=e;return t?"input"in t?t:{input:t,output:t}:{input:{serialize:n=>n,deserialize:n=>n},output:{serialize:n=>n,deserialize:n=>n}}}const J_=e=>typeof e=="function";function EW(e){if(e)return e;if(typeof window<"u"&&J_(window.fetch))return window.fetch.bind(window);if(typeof globalThis<"u"&&J_(globalThis.fetch))return globalThis.fetch;throw new Error("No fetch implementation found")}function CW(...e){const t=new AbortController,n=e.length;let r=0;const s=()=>{++r===n&&t.abort()};for(const o of e)o!=null&&o.aborted?s():o==null||o.addEventListener("abort",s,{once:!0});return t.signal}function c3(...e){const t=new AbortController;for(const n of e)n!=null&&n.aborted?t.abort():n==null||n.addEventListener("abort",()=>t.abort(),{once:!0});return t.signal}function TW(e){return{url:e.url.toString(),fetch:e.fetch,transformer:a3(e.transformer),methodOverride:e.methodOverride}}function NW(e){const t={};for(let n=0;n<e.length;n++){const r=e[n];t[n]=r}return t}const OW={query:"GET",mutation:"POST",subscription:"PATCH"};function u3(e){return"input"in e?e.transformer.input.serialize(e.input):NW(e.inputs.map(t=>e.transformer.input.serialize(t)))}const A2=e=>{const t=e.url.split("?");let n=t[0].replace(/\/$/,"")+"/"+e.path;const r=[];if(t[1]&&r.push(t[1]),"inputs"in e&&r.push("batch=1"),e.type==="query"||e.type==="subscription"){const s=u3(e);s!==void 0&&e.methodOverride!=="POST"&&r.push(`input=${encodeURIComponent(JSON.stringify(s))}`)}return r.length&&(n+="?"+r.join("&")),n},RW=e=>{if(e.type==="query"&&e.methodOverride!=="POST")return;const t=u3(e);return t!==void 0?JSON.stringify(t):void 0},AW=e=>IW(Mn(Mn({},e),{},{contentTypeHeader:"application/json",getUrl:A2,getBody:RW}));var kW=class extends Error{constructor(){const e="AbortError";super(e),this.name=e,this.message=e}};const _W=e=>{var t;if(e!=null&&e.aborted)throw(t=e.throwIfAborted)===null||t===void 0||t.call(e),typeof DOMException<"u"?new DOMException("AbortError","AbortError"):new kW};async function MW(e){var t,n;_W(e.signal);const r=e.getUrl(e),s=e.getBody(e),o=(t=e.methodOverride)!==null&&t!==void 0?t:OW[e.type],l=await(async()=>{const u=await e.headers();return Symbol.iterator in u?Object.fromEntries(u):u})(),c=Mn(Mn(Mn({},e.contentTypeHeader&&o!=="GET"?{"content-type":e.contentTypeHeader}:{}),e.trpcAcceptHeader?{[(n=e.trpcAcceptHeaderKey)!==null&&n!==void 0?n:"trpc-accept"]:e.trpcAcceptHeader}:void 0),l);return EW(e.fetch)(r,{method:o,signal:e.signal,body:s,headers:c})}async function IW(e){const t={},n=await MW(e);t.response=n;const r=await n.json();return t.responseJSON=r,{json:r,meta:t}}const eM=()=>{throw new Error("Something went wrong. Please submit an issue at https://github.com/trpc/trpc/issues/new")};function tM(e){let t=null,n=null;const r=()=>{clearTimeout(n),n=null,t=null};function s(c){const u=[[]];let f=0;for(;;){const y=c[f];if(!y)break;const x=u[u.length-1];if(y.aborted){var h;(h=y.reject)===null||h===void 0||h.call(y,new Error("Aborted")),f++;continue}if(e.validate(x.concat(y).map(b=>b.key))){x.push(y),f++;continue}if(x.length===0){var p;(p=y.reject)===null||p===void 0||p.call(y,new Error("Input is too big for a single dispatch")),f++;continue}u.push([])}return u}function o(){const c=s(t);r();for(const u of c){if(!u.length)continue;const f={items:u};for(const h of u)h.batch=f;e.fetch(f.items.map(h=>h.key)).then(async h=>{await Promise.all(h.map(async(y,x)=>{const b=f.items[x];try{var S;const C=await Promise.resolve(y);(S=b.resolve)===null||S===void 0||S.call(b,C)}catch(C){var E;(E=b.reject)===null||E===void 0||E.call(b,C)}b.batch=null,b.reject=null,b.resolve=null}));for(const y of f.items){var p;(p=y.reject)===null||p===void 0||p.call(y,new Error("Missing result")),y.batch=null}}).catch(h=>{for(const y of f.items){var p;(p=y.reject)===null||p===void 0||p.call(y,h),y.batch=null}})}}function l(c){var u;const f={aborted:!1,key:c,batch:null,resolve:eM,reject:eM},h=new Promise((p,y)=>{var x;f.reject=y,f.resolve=p,(x=t)!==null&&x!==void 0||(t=[]),t.push(f)});return(u=n)!==null&&u!==void 0||(n=setTimeout(o)),h}return{load:l}}function LW(e){var t,n;const r=TW(e),s=(t=e.maxURLLength)!==null&&t!==void 0?t:1/0,o=(n=e.maxItems)!==null&&n!==void 0?n:1/0;return()=>{const l=u=>({validate(f){if(s===1/0&&o===1/0)return!0;if(f.length>o)return!1;const h=f.map(y=>y.path).join(","),p=f.map(y=>y.input);return A2(Mn(Mn({},r),{},{type:u,path:h,inputs:p,signal:null})).length<=s},async fetch(f){const h=f.map(b=>b.path).join(","),p=f.map(b=>b.input),y=CW(...f.map(b=>b.signal)),x=await AW(Mn(Mn({},r),{},{path:h,inputs:p,type:u,headers(){return e.headers?typeof e.headers=="function"?e.headers({opList:f}):e.headers:{}},signal:y}));return(Array.isArray(x.json)?x.json:f.map(()=>x.json)).map(b=>({meta:x.meta,json:b}))}}),c={query:tM(l("query")),mutation:tM(l("mutation"))};return({op:u})=>Rf(f=>{/* istanbul ignore if -- @preserve */if(u.type==="subscription")throw new Error("Subscriptions are unsupported by `httpLink` - use `httpSubscriptionLink` or `wsLink`");const h=new AbortController,p=c[u.type].load(Mn(Mn({},u),{},{signal:c3(u.signal,h.signal)}));let y=!1,x;return p.then(b=>{y=!0,x=b;const S=eW(b.json,r.transformer.output);if(!S.ok){f.error(wa.from(S.error,{meta:b.meta}));return}f.next({context:b.meta,result:S.result}),f.complete()}).catch(b=>{y=!0,f.error(wa.from(b,{meta:x==null?void 0:x.meta}))}),()=>{y||h.abort()}})}}const Op=(e,...t)=>typeof e=="function"?e(...t):e;function DW(){let e,t;return{promise:new Promise((n,r)=>{e=n,t=r}),resolve:e,reject:t}}async function jW(e){const t=await Op(e.url);return e.connectionParams?t+`${t.includes("?")?"&":"?"}connectionParams=1`:t}async function PW(e,t){const n={method:"connectionParams",data:await Op(e)};return t.encode(n)}function zW(e){const{promise:t,resolve:n,reject:r}=DW();return e.addEventListener("open",()=>{e.removeEventListener("error",r),n()}),e.addEventListener("error",r),t}function BW(e,{intervalMs:t,pongTimeoutMs:n}){let r,s;function o(){r=setTimeout(()=>{e.send("PING"),s=setTimeout(()=>{e.close()},n)},t)}function l(){clearTimeout(r),o()}function c(){clearTimeout(s),l()}e.addEventListener("open",o),e.addEventListener("message",({data:u})=>{clearTimeout(r),o(),u==="PONG"&&c()}),e.addEventListener("close",()=>{clearTimeout(r),clearTimeout(s)})}var HW=class cE{constructor(t){var n;if(jr(this,"id",++cE.connectCount),jr(this,"WebSocketPonyfill",void 0),jr(this,"urlOptions",void 0),jr(this,"keepAliveOpts",void 0),jr(this,"encoder",void 0),jr(this,"wsObservable",Q4(null)),jr(this,"openPromise",null),this.WebSocketPonyfill=(n=t.WebSocketPonyfill)!==null&&n!==void 0?n:WebSocket,!this.WebSocketPonyfill)throw new Error("No WebSocket implementation found - you probably don't want to use this on the server, but if you do you need to pass a `WebSocket`-ponyfill");this.urlOptions=t.urlOptions,this.keepAliveOpts=t.keepAlive,this.encoder=t.encoder}get ws(){return this.wsObservable.get()}set ws(t){this.wsObservable.next(t)}isOpen(){return!!this.ws&&this.ws.readyState===this.WebSocketPonyfill.OPEN&&!this.openPromise}isClosed(){return!!this.ws&&(this.ws.readyState===this.WebSocketPonyfill.CLOSING||this.ws.readyState===this.WebSocketPonyfill.CLOSED)}async open(){if(this.openPromise)return this.openPromise;this.id=++cE.connectCount;const t=jW(this.urlOptions).then(n=>new this.WebSocketPonyfill(n));this.openPromise=t.then(async n=>{this.ws=n,n.binaryType="arraybuffer",n.addEventListener("message",function({data:r}){r==="PING"&&this.send("PONG")}),this.keepAliveOpts.enabled&&BW(n,this.keepAliveOpts),n.addEventListener("close",()=>{this.ws===n&&(this.ws=null)}),await zW(n),this.urlOptions.connectionParams&&n.send(await PW(this.urlOptions.connectionParams,this.encoder))});try{await this.openPromise}finally{this.openPromise=null}}async close(){try{await this.openPromise}finally{var t;(t=this.ws)===null||t===void 0||t.close()}}};jr(HW,"connectCount",0);var d3=class{constructor(e){jr(this,"links",void 0),jr(this,"runtime",void 0),jr(this,"requestId",void 0),this.requestId=0,this.runtime={},this.links=e.links.map(t=>t(this.runtime))}$request(e){var t;return Z4({links:this.links,op:Mn(Mn({},e),{},{context:(t=e.context)!==null&&t!==void 0?t:{},id:++this.requestId})}).pipe(BY())}async requestAsPromise(e){try{const t=this.$request(e);return(await zY(t)).result.data}catch(t){throw wa.from(t)}}query(e,t,n){return this.requestAsPromise({type:"query",path:e,input:t,context:n==null?void 0:n.context,signal:n==null?void 0:n.signal})}mutation(e,t,n){return this.requestAsPromise({type:"mutation",path:e,input:t,context:n==null?void 0:n.context,signal:n==null?void 0:n.signal})}subscription(e,t,n){return this.$request({type:"subscription",path:e,input:t,context:n.context,signal:n.signal}).subscribe({next(r){switch(r.result.type){case"state":var s;(s=n.onConnectionStateChange)===null||s===void 0||s.call(n,r.result);break;case"started":var o;(o=n.onStarted)===null||o===void 0||o.call(n,{context:r.context});break;case"stopped":var l;(l=n.onStopped)===null||l===void 0||l.call(n);break;case"data":case void 0:var c;(c=n.onData)===null||c===void 0||c.call(n,r.result.data)}},error(r){var s;(s=n.onError)===null||s===void 0||s.call(n,r)},complete(){var r;(r=n.onComplete)===null||r===void 0||r.call(n)}})}};const f3=Symbol.for("trpc_untypedClient"),FW={query:"query",mutate:"mutation",subscribe:"subscription"},$W=e=>FW[e];function UW(e){const t=n3(({path:n,args:r})=>{const s=[...n],o=$W(s.pop()),l=s.join(".");return e[o](l,...r)});return KY(n=>n===f3?e:t[n])}function VW(e){return UW(new d3(e))}function qW(e){return e[f3]}function GW(e,t){return!t||e!=null&&typeof e!="object"?e:Mn(Mn({},e??{}),{},{lastEventId:t})}function KW(e){var t,n,r,s=2;for(typeof Symbol<"u"&&(n=Symbol.asyncIterator,r=Symbol.iterator);s--;){if(n&&(t=e[n])!=null)return t.call(e);if(r&&(t=e[r])!=null)return new gy(t.call(e));n="@@asyncIterator",r="@@iterator"}throw new TypeError("Object is not async iterable")}function gy(e){function t(n){if(Object(n)!==n)return Promise.reject(new TypeError(n+" is not an object."));var r=n.done;return Promise.resolve(n.value).then(function(s){return{value:s,done:r}})}return gy=function(r){this.s=r,this.n=r.next},gy.prototype={s:null,n:null,next:function(){return t(this.n.apply(this.s,arguments))},return:function(r){var s=this.s.return;return s===void 0?Promise.resolve({value:r,done:!0}):t(s.apply(this.s,arguments))},throw:function(r){var s=this.s.return;return s===void 0?Promise.reject(r):t(s.apply(this.s,arguments))}},new gy(e)}async function YW(e){let t=await Op(e.url);if(e.connectionParams){const n=await Op(e.connectionParams),r=t.includes("?")?"&":"?";t+=r+"connectionParams="+encodeURIComponent(JSON.stringify(n))}return t}function WW(e){const t=a3(e.transformer);return()=>({op:n})=>Rf(r=>{var s;const{type:o,path:l,input:c}=n;/* istanbul ignore if -- @preserve */if(o!=="subscription")throw new Error("httpSubscriptionLink only supports subscriptions");let u;const f=new AbortController,h=c3(n.signal,f.signal),p=bW({url:async()=>A2({transformer:t,url:await YW(e),input:GW(c,u),path:l,type:o,signal:null}),init:()=>Op(e.eventSourceOptions,{op:n}),signal:h,deserialize:b=>t.output.deserialize(b),EventSource:(s=e.EventSource)!==null&&s!==void 0?s:globalThis.EventSource}),y=Q4({type:"state",state:"connecting",error:null}),x=y.subscribe({next(b){r.next({result:b})}});return R2(async()=>{var b=!1,S=!1,E;try{for(var C=KW(p),O;b=!(O=await C.next()).done;b=!1){const T=O.value;switch(T.type){case"ping":break;case"data":const R=T.data;let k;R.id?(u=R.id,k={id:R.id,data:R}):k={data:R.data},r.next({result:k,context:{eventSource:T.eventSource}});break;case"connected":r.next({result:{type:"started"},context:{eventSource:T.eventSource}}),y.next({type:"state",state:"pending",error:null});break;case"serialized-error":{const M=wa.from({error:T.error});if(GY.includes(T.error.code)){y.next({type:"state",state:"connecting",error:M});break}throw M}case"connecting":{const M=y.get(),A=T.event&&wa.from(T.event);if(!A&&M.state==="connecting")break;y.next({type:"state",state:"connecting",error:A});break}case"timeout":y.next({type:"state",state:"connecting",error:new wa(`Timeout of ${T.ms}ms reached while waiting for a response`)})}}}catch(T){S=!0,E=T}finally{try{b&&C.return!=null&&await C.return()}finally{if(S)throw E}}r.next({result:{type:"stopped"}}),y.next({type:"state",state:"idle",error:null}),r.complete()}).catch(b=>{r.error(wa.from(b))}),()=>{r.complete(),f.abort(),x.unsubscribe()}})}function Rp(e){"@babel/helpers - typeof";return Rp=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Rp(e)}function XW(e,t){if(Rp(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(Rp(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function QW(e){var t=XW(e,"string");return Rp(t)=="symbol"?t:t+""}function ZW(e,t,n){return(t=QW(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function nM(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,r)}return n}function Ct(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?nM(Object(n),!0).forEach(function(r){ZW(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):nM(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function JW(e){var t,n,r,s=2;for(typeof Symbol<"u"&&(n=Symbol.asyncIterator,r=Symbol.iterator);s--;){if(n&&(t=e[n])!=null)return t.call(e);if(r&&(t=e[r])!=null)return new yy(t.call(e));n="@@asyncIterator",r="@@iterator"}throw new TypeError("Object is not async iterable")}function yy(e){function t(n){if(Object(n)!==n)return Promise.reject(new TypeError(n+" is not an object."));var r=n.done;return Promise.resolve(n.value).then(function(s){return{value:s,done:r}})}return yy=function(r){this.s=r,this.n=r.next},yy.prototype={s:null,n:null,next:function(){return t(this.n.apply(this.s,arguments))},return:function(r){var s=this.s.return;return s===void 0?Promise.resolve({value:r,done:!0}):t(s.apply(this.s,arguments))},throw:function(r){var s=this.s.return;return s===void 0?Promise.reject(r):t(s.apply(this.s,arguments))}},new yy(e)}function eX(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.includes(r))continue;n[r]=e[r]}return n}function tX(e,t){if(e==null)return{};var n,r,s=eX(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],t.includes(n)||{}.propertyIsEnumerable.call(e,n)&&(s[n]=e[n])}return s}const nX=["cursor","direction"];function $x(e){return{path:e.path.join(".")}}function rX(e){return e.length>=3}function sX(e){return rX(e)?{type:"prefixed",prefix:e[0],path:e[1],args:e[2]}:{type:"unprefixed",prefix:void 0,path:e[0],args:e[1]}}function k2(e,t,n){var r;const s=sX(e);let o=(r=s.args)===null||r===void 0?void 0:r.input;if(n){var l,c;o=Ct(Ct(Ct({},(l=(c=s.args)===null||c===void 0?void 0:c.input)!==null&&l!==void 0?l:{}),n.pageParam!==void 0?{cursor:n.pageParam}:{}),{},{direction:n.direction})}return[s.path.join("."),o,t==null?void 0:t.trpc]}async function oX(e,t,n){const r=t.getQueryCache().build(t,{queryKey:n});r.setState({data:[],status:"success"});const s=[];var o=!1,l=!1,c;try{for(var u=JW(e),f;o=!(f=await u.next()).done;o=!1){const h=f.value;s.push(h),r.setState({data:[...s]})}}catch(h){l=!0,c=h}finally{try{o&&u.return!=null&&await u.return()}finally{if(l)throw c}}return s}function Di(e){const t=R2(()=>{const{input:n,type:r}=e,s=e.path.flatMap(o=>o.split("."));if(!n&&r==="any")return s.length?[s]:[];if(r==="infinite"&&$a(n)&&("direction"in n||"cursor"in n)){const{cursor:o,direction:l}=n;return[s,{input:tX(n,nX),type:"infinite"}]}return[s,Ct(Ct({},typeof n<"u"&&n!==ao&&{input:n}),r&&r!=="any"&&{type:r})]});return e.prefix&&t.unshift([e.prefix]),t}function h3(e){const t=[e.path.flatMap(n=>n.split("."))];return e.prefix&&t.unshift([e.prefix]),t}function _2(e){return UY(e)?e():e}function iX(e){var t;const{input:n,query:r,path:s,queryKey:o,opts:l}=e,c=n===ao,u=async f=>{var h;const p=Ct(Ct({},l),{},{trpc:Ct(Ct({},l==null?void 0:l.trpc),!(l==null||(h=l.trpc)===null||h===void 0)&&h.abortOnUnmount?{signal:f.signal}:{signal:null})});return await r(...k2(o,p,{direction:f.direction,pageParam:f.pageParam}))};return Object.assign(Ct(Ct({},l??{}),{},{queryKey:o,queryFn:c?ao:u,initialPageParam:(t=l==null?void 0:l.initialCursor)!==null&&t!==void 0?t:n==null?void 0:n.cursor}),{trpc:$x({path:s})})}function lX(e){var t,n;const{mutate:r,path:s,prefix:o,opts:l,overrides:c}=e,u=_2(e.queryClient),f=h3({path:s,prefix:(t=l==null?void 0:l.keyPrefix)!==null&&t!==void 0?t:o}),h=u.defaultMutationOptions(u.getMutationDefaults(f)),p=(n=c==null?void 0:c.onSuccess)!==null&&n!==void 0?n:(x=>x.originalFn()),y=async x=>await r(...k2([...f,{input:x}],l));return Ct(Ct({},l),{},{mutationKey:f,mutationFn:y,onSuccess(...x){var b,S;return p({originalFn:()=>{var C,O,T;return(C=l==null||(O=l.onSuccess)===null||O===void 0?void 0:O.call(l,...x))!==null&&C!==void 0?C:h==null||(T=h.onSuccess)===null||T===void 0?void 0:T.call(h,...x)},queryClient:u,meta:(b=(S=l==null?void 0:l.meta)!==null&&S!==void 0?S:h==null?void 0:h.meta)!==null&&b!==void 0?b:{}})},trpc:$x({path:s})})}function aX(e){const{input:t,query:n,path:r,queryKey:s,opts:o}=e,l=_2(e.queryClient),c=t===ao,u=async f=>{var h;const p=Ct(Ct({},o),{},{trpc:Ct(Ct({},o==null?void 0:o.trpc),!(o==null||(h=o.trpc)===null||h===void 0)&&h.abortOnUnmount?{signal:f.signal}:{signal:null})}),y=f.queryKey,x=await n(...k2(y,p));return qY(x)?oX(x,l,y):x};return Object.assign(Ct(Ct({},o),{},{queryKey:s,queryFn:c?ao:u}),{trpc:$x({path:r})})}const cX=e=>{const{subscribe:t,path:n,queryKey:r,input:s,opts:o={}}=e,l="enabled"in o?!!o.enabled:s!==ao,c=u=>t(n.join("."),s===ao?void 0:s,u);return Ct(Ct({},o),{},{enabled:l,subscribe:c,queryKey:r,trpc:$x({path:n})})};function uX(e){const t=N.useRef(e);t.current=e;const n=N.useRef(new Set([])),r=N.useCallback(p=>{n.current.add(p)},[]),s=N.useRef(()=>{}),o=N.useCallback(()=>{var p;if((p=s.current)===null||p===void 0||p.call(s),h(l),!e.enabled)return;const y=e.subscribe({onStarted:()=>{var x,b;(x=(b=t.current).onStarted)===null||x===void 0||x.call(b),h(S=>Ct(Ct({},S),{},{status:"pending",error:null}))},onData:x=>{var b,S;(b=(S=t.current).onData)===null||b===void 0||b.call(S,x),h(E=>Ct(Ct({},E),{},{status:"pending",data:x,error:null}))},onError:x=>{var b,S;(b=(S=t.current).onError)===null||b===void 0||b.call(S,x),h(E=>Ct(Ct({},E),{},{status:"error",error:x}))},onConnectionStateChange:x=>{var b,S;(b=(S=t.current).onConnectionStateChange)===null||b===void 0||b.call(S,x),h(E=>{switch(x.state){case"connecting":return Ct(Ct({},E),{},{status:"connecting",error:x.error});case"pending":return E;case"idle":return Ct(Ct({},E),{},{status:"idle",data:void 0,error:null})}})}});s.current=()=>{y.unsubscribe()}},[ja(e.queryKey),e.enabled]),l=N.useCallback(()=>e.enabled?{data:void 0,error:null,status:"connecting",reset:o}:{data:void 0,error:null,status:"idle",reset:o},[e.enabled,o]),c=N.useRef(l()),[u,f]=N.useState(rM(c,r));u.reset=o;const h=N.useCallback(p=>{const y=c.current,x=c.current=p(y);let b=!1;for(const S of n.current)if(y[S]!==x[S]){b=!0;break}b&&f(rM(c,r))},[r]);return N.useEffect(()=>{if(e.enabled)return o(),()=>{var p;(p=s.current)===null||p===void 0||p.call(s)}},[o,e.enabled]),u}function rM(e,t){return new Proxy(e.current,{get(n,r){return t(r),e.current[r]}})}function p3(e){const t=e.keyPrefix,n=r=>(s,o,l)=>"router"in e?Promise.resolve(_2(e.ctx)).then(c=>rW({router:e.router,path:s,getRawInput:async()=>o,ctx:c,type:r,signal:void 0,batchIndex:0})):(e.client instanceof d3?e.client:qW(e.client))[r](s,o,l);return n3(({args:r,path:s})=>{const o=[...s],l=o.pop(),[c,u]=r;return{"~types":void 0,pathKey:()=>Di({path:o,type:"any",prefix:t}),pathFilter:()=>Ct(Ct({},c),{},{queryKey:Di({path:o,type:"any",prefix:t})}),queryOptions:()=>aX({input:c,opts:u,path:o,queryClient:e.queryClient,queryKey:Di({path:o,input:c,type:"query",prefix:t}),query:n("query")}),queryKey:()=>Di({path:o,input:c,type:"query",prefix:t}),queryFilter:()=>Ct(Ct({},u),{},{queryKey:Di({path:o,input:c,type:"query",prefix:t})}),infiniteQueryOptions:()=>iX({input:c,opts:u,path:o,queryClient:e.queryClient,queryKey:Di({path:o,input:c,type:"infinite",prefix:t}),query:n("query")}),infiniteQueryKey:()=>Di({path:o,input:c,type:"infinite",prefix:t}),infiniteQueryFilter:()=>Ct(Ct({},u),{},{queryKey:Di({path:o,input:c,type:"infinite",prefix:t})}),mutationOptions:()=>{var f;return lX({opts:c,path:o,prefix:t,queryClient:e.queryClient,mutate:n("mutation"),overrides:(f=e.overrides)===null||f===void 0?void 0:f.mutations})},mutationKey:()=>h3({path:o,prefix:t}),subscriptionOptions:()=>cX({opts:u,path:o,input:c,queryKey:Di({path:o,input:c,type:"any",prefix:t}),subscribe:n("subscription")})}[l]()})}function dX(){const e=N.createContext(null),t=N.createContext(null),n=o=>{const l=N.useMemo(()=>p3({client:o.trpcClient,queryClient:o.queryClient,keyPrefix:o.keyPrefix}),[o.trpcClient,o.queryClient,o.keyPrefix]);return N.createElement(e.Provider,{value:o.trpcClient},N.createElement(t.Provider,{value:l},o.children))};n.displayName="TRPCProvider";function r(){const o=N.useContext(t);if(!o)throw new Error("useTRPC() can only be used inside of a <TRPCProvider>");return o}function s(){const o=N.useContext(e);if(!o)throw new Error("useTRPCClient() can only be used inside of a <TRPCProvider>");return o}return{TRPCProvider:n,useTRPC:r,useTRPCClient:s}}const sM="/api/trpc",{TRPCProvider:fX,useTRPC:is}=dX(),hX=()=>[HY({condition:e=>e.type==="subscription",true:WW({url:sM}),false:LW({url:sM})})],pX=e=>VW({links:e}),mX=(e,t)=>p3({client:e,queryClient:t}),gX=2e4,yX=()=>{const e=is(),t=ui({...e.updateNotice.queryOptions({}),staleTime:"static"}).data??null,[n,r]=N.useState(!1),[s,o]=N.useState(!1),l=t!==null&&!n;N.useEffect(()=>{if(!l)return;const f=window.setTimeout(()=>{r(!0)},gX);return()=>{window.clearTimeout(f)}},[l]);const c=N.useCallback(()=>{t!==null&&navigator.clipboard.writeText(t.command).then(()=>{o(!0)},()=>{o(!1)})},[t]),u=N.useCallback(()=>{r(!0)},[]);return{notice:l?t:null,isCopied:s,copy:c,close:u}},uE=[{label:"Agent integration",icon:"agents",link:m.jsx(ri,{to:"/settings/agents"})},{label:"Git integration",icon:"forges",link:m.jsx(ri,{to:"/settings/forges"})},{label:"Prompt configurations",icon:"configurations",link:m.jsx(ri,{to:"/settings/profiles"})},{label:"Repositories",icon:"repositories",link:m.jsx(ri,{to:"/settings/repositories"})},{label:"Review configuration",icon:"review",link:m.jsx(ri,{to:"/settings/review"})}],xX=({logoSrc:e,name:t})=>m.jsx("img",{src:e,alt:t,width:"32",height:"32",className:"size-8"});/**
|
|
68
|
+
* @license lucide-react v1.49.0 - ISC
|
|
69
|
+
*
|
|
70
|
+
* This source code is licensed under the ISC license.
|
|
71
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
72
|
+
*/const bX=e=>e==null?void 0:e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();/**
|
|
73
|
+
* @license lucide-react v1.49.0 - ISC
|
|
74
|
+
*
|
|
75
|
+
* This source code is licensed under the ISC license.
|
|
76
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
77
|
+
*/function vX(e,t,n=[]){if(t==null)throw new Error("[lucide]: iconNode is required when icon name is used");return{name:bX(e),size:24,node:t,...n.length>0?{aliases:n}:{}}}/**
|
|
78
|
+
* @license lucide-react v1.49.0 - ISC
|
|
79
|
+
*
|
|
80
|
+
* This source code is licensed under the ISC license.
|
|
81
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
82
|
+
*/const SX=e=>{let t="",n=!1;for(const r of e){if(r==="-"||r==="_"||r<=" "){n=t.length>0;continue}t.length===0?t+=r.toLowerCase():t+=n?r.toUpperCase():r,n=!1}return t};/**
|
|
83
|
+
* @license lucide-react v1.49.0 - ISC
|
|
84
|
+
*
|
|
85
|
+
* This source code is licensed under the ISC license.
|
|
86
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
87
|
+
*/const wX=e=>{const t=SX(e);return t.charAt(0).toUpperCase()+t.slice(1)};/**
|
|
88
|
+
* @license lucide-react v1.49.0 - ISC
|
|
89
|
+
*
|
|
90
|
+
* This source code is licensed under the ISC license.
|
|
91
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
92
|
+
*/const dE=(...e)=>e.filter((t,n,r)=>!!t&&t.trim()!==""&&r.indexOf(t)===n).join(" ").trim();/**
|
|
93
|
+
* @license lucide-react v1.49.0 - ISC
|
|
94
|
+
*
|
|
95
|
+
* This source code is licensed under the ISC license.
|
|
96
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
97
|
+
*/const Rc={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":2,"stroke-linecap":"round","stroke-linejoin":"round"};/**
|
|
98
|
+
* @license lucide-react v1.49.0 - ISC
|
|
99
|
+
*
|
|
100
|
+
* This source code is licensed under the ISC license.
|
|
101
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
102
|
+
*/function D1(e){return e!=null}function EX(e,t={}){var y,x;const n=t.attributeNames??{},r=b=>n[b]??b,s=e.size??e.width??Rc.width,o=e.size??e.height??Rc.height,l=((y=e.aliases)==null?void 0:y.filter(b=>typeof b=="string"&&b.trim()!=="").map(b=>`lucide-${b}`))??[],c=[...e.name?[`lucide-${e.name}`]:[],...l],u=((x=t.className)==null?void 0:x.split(" ").filter(Boolean))??[],f=t.includeDefaultClasses===!1?dE(...u):dE("lucide",...c,...u),h=t.absoluteStrokeWidth?Number(t.strokeWidth??Rc["stroke-width"])*Number(e.size??e.width??Rc.width)/Number(t.size??t.width??Rc.width):t.strokeWidth??Rc["stroke-width"];return["svg",{...Object.entries(Rc).reduce((b,[S,E])=>(b[r(S)]=E,b),{}),..."color"in t&&t.color&&{[r("stroke")]:t.color},..."size"in t&&D1(t.size)&&{[r("width")]:t.size,[r("height")]:t.size},..."width"in t&&D1(t.width)&&{[r("width")]:t.width},..."height"in t&&D1(t.height)&&{[r("height")]:t.height},[r("stroke-width")]:h,...f&&{[r("class")]:f},[r("viewBox")]:`0 0 ${s} ${o}`,...t.hasA11yProp===!1?{[r("aria-hidden")]:"true"}:{},..."attributes"in t&&t.attributes},e.node.map(b=>{const[S,E,C]=b,O=t.nonScalingStroke?{[r("vector-effect")]:"non-scaling-stroke",...E}:E;return C?[S,O,C]:[S,O]})]}/**
|
|
103
|
+
* @license lucide-react v1.49.0 - ISC
|
|
104
|
+
*
|
|
105
|
+
* This source code is licensed under the ISC license.
|
|
106
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
107
|
+
*/function CX(e,t={}){return EX(e,{...t,attributeNames:{...t.attributeNames,class:"className","stroke-width":"strokeWidth","stroke-linecap":"strokeLinecap","stroke-linejoin":"strokeLinejoin","vector-effect":"vectorEffect"}})}/**
|
|
108
|
+
* @license lucide-react v1.49.0 - ISC
|
|
109
|
+
*
|
|
110
|
+
* This source code is licensed under the ISC license.
|
|
111
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
112
|
+
*/const TX=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0;return!1},NX=N.createContext({}),OX=()=>N.useContext(NX),RX=N.forwardRef(({color:e,size:t,width:n,height:r,strokeWidth:s,absoluteStrokeWidth:o,nonScalingStroke:l,className:c="",children:u,iconNode:f=[],icon:h={node:f,aliases:[],size:24},...p},y)=>{const{size:x=24,strokeWidth:b=2,absoluteStrokeWidth:S=!1,nonScalingStroke:E=!1,color:C="currentColor",className:O=""}=OX()??{},T=!!u||TX(p),[R,k,M=[]]=CX(h,{color:e??C,width:n??t??x,height:r??t??x,strokeWidth:s??b,absoluteStrokeWidth:o??S,nonScalingStroke:l??E,className:dE(O,c),hasA11yProp:T,attributes:p});return N.createElement(R,{ref:y,...k},[...M.map(([A,I])=>N.createElement(A,I)),...Array.isArray(u)?u:[u]])});/**
|
|
113
|
+
* @license lucide-react v1.49.0 - ISC
|
|
114
|
+
*
|
|
115
|
+
* This source code is licensed under the ISC license.
|
|
116
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
117
|
+
*/function ut(e,t=[],n=[]){const r=typeof e=="string"?vX(e,t,n):e,s=N.forwardRef(({className:o,...l},c)=>N.createElement(RX,{ref:c,icon:r,className:o,...l}));return r.name&&(s.displayName=wX(r.name)),s}/**
|
|
118
|
+
* @license lucide-react v1.49.0 - ISC
|
|
119
|
+
*
|
|
120
|
+
* This source code is licensed under the ISC license.
|
|
121
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
122
|
+
*/const m3={name:"anchor",size:24,node:[["path",{d:"M12 6v16",key:"nqf5sj"}],["path",{d:"m19 13 2-1a9 9 0 0 1-18 0l2 1",key:"y7qv08"}],["path",{d:"M9 11h6",key:"1fldmi"}],["circle",{cx:"12",cy:"4",r:"2",key:"muu5ef"}]]};m3.node;const g3=ut(m3);/**
|
|
123
|
+
* @license lucide-react v1.49.0 - ISC
|
|
124
|
+
*
|
|
125
|
+
* This source code is licensed under the ISC license.
|
|
126
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
127
|
+
*/const y3={name:"app-window",size:24,node:[["rect",{x:"2",y:"4",width:"20",height:"16",rx:"2",key:"izxlao"}],["path",{d:"M10 4v4",key:"pp8u80"}],["path",{d:"M2 8h20",key:"d11cs7"}],["path",{d:"M6 4v4",key:"1svtjw"}]]};y3.node;const AX=ut(y3);/**
|
|
128
|
+
* @license lucide-react v1.49.0 - ISC
|
|
129
|
+
*
|
|
130
|
+
* This source code is licensed under the ISC license.
|
|
131
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
132
|
+
*/const x3={name:"arrow-up-down",size:24,node:[["path",{d:"m21 16-4 4-4-4",key:"f6ql7i"}],["path",{d:"M17 20V4",key:"1ejh1v"}],["path",{d:"m3 8 4-4 4 4",key:"11wl7u"}],["path",{d:"M7 4v16",key:"1glfcx"}]]};x3.node;const kX=ut(x3);/**
|
|
133
|
+
* @license lucide-react v1.49.0 - ISC
|
|
134
|
+
*
|
|
135
|
+
* This source code is licensed under the ISC license.
|
|
136
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
137
|
+
*/const b3={name:"arrow-up-right",size:24,node:[["path",{d:"M7 7h10v10",key:"1tivn9"}],["path",{d:"M7 17 17 7",key:"1vkiza"}]]};b3.node;const fE=ut(b3);/**
|
|
138
|
+
* @license lucide-react v1.49.0 - ISC
|
|
139
|
+
*
|
|
140
|
+
* This source code is licensed under the ISC license.
|
|
141
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
142
|
+
*/const v3={name:"bot",size:24,node:[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]]};v3.node;const _X=ut(v3);/**
|
|
143
|
+
* @license lucide-react v1.49.0 - ISC
|
|
144
|
+
*
|
|
145
|
+
* This source code is licensed under the ISC license.
|
|
146
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
147
|
+
*/const S3={name:"braces",size:24,node:[["path",{d:"M8 3H7a2 2 0 0 0-2 2v5a2 2 0 0 1-2 2 2 2 0 0 1 2 2v5c0 1.1.9 2 2 2h1",key:"ezmyqa"}],["path",{d:"M16 21h1a2 2 0 0 0 2-2v-5c0-1.1.9-2 2-2a2 2 0 0 1-2-2V5a2 2 0 0 0-2-2h-1",key:"e1hn23"}]],aliases:["curly-braces"]};S3.node;const MX=ut(S3);/**
|
|
148
|
+
* @license lucide-react v1.49.0 - ISC
|
|
149
|
+
*
|
|
150
|
+
* This source code is licensed under the ISC license.
|
|
151
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
152
|
+
*/const w3={name:"check",size:24,node:[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]};w3.node;const wu=ut(w3);/**
|
|
153
|
+
* @license lucide-react v1.49.0 - ISC
|
|
154
|
+
*
|
|
155
|
+
* This source code is licensed under the ISC license.
|
|
156
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
157
|
+
*/const E3={name:"chevron-down",size:24,node:[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]};E3.node;const su=ut(E3);/**
|
|
158
|
+
* @license lucide-react v1.49.0 - ISC
|
|
159
|
+
*
|
|
160
|
+
* This source code is licensed under the ISC license.
|
|
161
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
162
|
+
*/const C3={name:"chevron-right",size:24,node:[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]};C3.node;const Ux=ut(C3);/**
|
|
163
|
+
* @license lucide-react v1.49.0 - ISC
|
|
164
|
+
*
|
|
165
|
+
* This source code is licensed under the ISC license.
|
|
166
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
167
|
+
*/const T3={name:"chevron-up",size:24,node:[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]};T3.node;const N3=ut(T3);/**
|
|
168
|
+
* @license lucide-react v1.49.0 - ISC
|
|
169
|
+
*
|
|
170
|
+
* This source code is licensed under the ISC license.
|
|
171
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
172
|
+
*/const O3={name:"chevrons-down-up",size:24,node:[["path",{d:"m7 20 5-5 5 5",key:"13a0gw"}],["path",{d:"m7 4 5 5 5-5",key:"1kwcof"}]]};O3.node;const IX=ut(O3);/**
|
|
173
|
+
* @license lucide-react v1.49.0 - ISC
|
|
174
|
+
*
|
|
175
|
+
* This source code is licensed under the ISC license.
|
|
176
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
177
|
+
*/const R3={name:"chevrons-up-down",size:24,node:[["path",{d:"m7 15 5 5 5-5",key:"1hf1tw"}],["path",{d:"m7 9 5-5 5 5",key:"sgt6xg"}]]};R3.node;const A3=ut(R3);/**
|
|
178
|
+
* @license lucide-react v1.49.0 - ISC
|
|
179
|
+
*
|
|
180
|
+
* This source code is licensed under the ISC license.
|
|
181
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
182
|
+
*/const k3={name:"circle-check",size:24,node:[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m16 9-5.5 5.5L8 12",key:"xofnsj"}]],aliases:["check-circle-2"]};k3.node;const LX=ut(k3);/**
|
|
183
|
+
* @license lucide-react v1.49.0 - ISC
|
|
184
|
+
*
|
|
185
|
+
* This source code is licensed under the ISC license.
|
|
186
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
187
|
+
*/const _3={name:"circle-dashed",size:24,node:[["path",{d:"M10.1 2.182a10 10 0 0 1 3.8 0",key:"5ilxe3"}],["path",{d:"M13.9 21.818a10 10 0 0 1-3.8 0",key:"11zvb9"}],["path",{d:"M17.609 3.721a10 10 0 0 1 2.69 2.7",key:"1iw5b2"}],["path",{d:"M2.182 13.9a10 10 0 0 1 0-3.8",key:"c0bmvh"}],["path",{d:"M20.279 17.609a10 10 0 0 1-2.7 2.69",key:"1ruxm7"}],["path",{d:"M21.818 10.1a10 10 0 0 1 0 3.8",key:"qkgqxc"}],["path",{d:"M3.721 6.391a10 10 0 0 1 2.7-2.69",key:"1mcia2"}],["path",{d:"M6.391 20.279a10 10 0 0 1-2.69-2.7",key:"1fvljs"}]]};_3.node;const DX=ut(_3);/**
|
|
188
|
+
* @license lucide-react v1.49.0 - ISC
|
|
189
|
+
*
|
|
190
|
+
* This source code is licensed under the ISC license.
|
|
191
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
192
|
+
*/const M3={name:"circle-x",size:24,node:[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]],aliases:["x-circle"]};M3.node;const jX=ut(M3);/**
|
|
193
|
+
* @license lucide-react v1.49.0 - ISC
|
|
194
|
+
*
|
|
195
|
+
* This source code is licensed under the ISC license.
|
|
196
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
197
|
+
*/const I3={name:"copy",size:24,node:[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]};I3.node;const PX=ut(I3);/**
|
|
198
|
+
* @license lucide-react v1.49.0 - ISC
|
|
199
|
+
*
|
|
200
|
+
* This source code is licensed under the ISC license.
|
|
201
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
202
|
+
*/const L3={name:"crosshair",size:24,node:[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"22",x2:"18",y1:"12",y2:"12",key:"l9bcsi"}],["line",{x1:"6",x2:"2",y1:"12",y2:"12",key:"13hhkx"}],["line",{x1:"12",x2:"12",y1:"6",y2:"2",key:"10w3f3"}],["line",{x1:"12",x2:"12",y1:"22",y2:"18",key:"15g9kq"}]]};L3.node;const zX=ut(L3);/**
|
|
203
|
+
* @license lucide-react v1.49.0 - ISC
|
|
204
|
+
*
|
|
205
|
+
* This source code is licensed under the ISC license.
|
|
206
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
207
|
+
*/const D3={name:"database",size:24,node:[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]]};D3.node;const Cd=ut(D3);/**
|
|
208
|
+
* @license lucide-react v1.49.0 - ISC
|
|
209
|
+
*
|
|
210
|
+
* This source code is licensed under the ISC license.
|
|
211
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
212
|
+
*/const j3={name:"external-link",size:24,node:[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]]};j3.node;const P3=ut(j3);/**
|
|
213
|
+
* @license lucide-react v1.49.0 - ISC
|
|
214
|
+
*
|
|
215
|
+
* This source code is licensed under the ISC license.
|
|
216
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
217
|
+
*/const z3={name:"file-text",size:24,node:[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]]};z3.node;const BX=ut(z3);/**
|
|
218
|
+
* @license lucide-react v1.49.0 - ISC
|
|
219
|
+
*
|
|
220
|
+
* This source code is licensed under the ISC license.
|
|
221
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
222
|
+
*/const B3={name:"folder-git-2",size:24,node:[["path",{d:"M18 19a5 5 0 0 1-5-5v8",key:"sz5oeg"}],["path",{d:"M9 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v5",key:"1w6njk"}],["circle",{cx:"13",cy:"12",r:"2",key:"1j92g6"}],["circle",{cx:"20",cy:"19",r:"2",key:"1obnsp"}]]};B3.node;const HX=ut(B3);/**
|
|
223
|
+
* @license lucide-react v1.49.0 - ISC
|
|
224
|
+
*
|
|
225
|
+
* This source code is licensed under the ISC license.
|
|
226
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
227
|
+
*/const H3={name:"git-branch",size:24,node:[["path",{d:"M15 6a9 9 0 0 0-9 9V3",key:"1cii5b"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}]]};H3.node;const FX=ut(H3);/**
|
|
228
|
+
* @license lucide-react v1.49.0 - ISC
|
|
229
|
+
*
|
|
230
|
+
* This source code is licensed under the ISC license.
|
|
231
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
232
|
+
*/const F3={name:"git-merge",size:24,node:[["circle",{cx:"18",cy:"18",r:"3",key:"1xkwt0"}],["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["path",{d:"M6 21V9a9 9 0 0 0 9 9",key:"7kw0sc"}]]};F3.node;const $X=ut(F3);/**
|
|
233
|
+
* @license lucide-react v1.49.0 - ISC
|
|
234
|
+
*
|
|
235
|
+
* This source code is licensed under the ISC license.
|
|
236
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
237
|
+
*/const $3={name:"loader-circle",size:24,node:[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],aliases:["loader-2"]};$3.node;const hE=ut($3);/**
|
|
238
|
+
* @license lucide-react v1.49.0 - ISC
|
|
239
|
+
*
|
|
240
|
+
* This source code is licensed under the ISC license.
|
|
241
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
242
|
+
*/const U3={name:"maximize-2",size:24,node:[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"m21 3-7 7",key:"1l2asr"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M9 21H3v-6",key:"wtvkvv"}]]};U3.node;const UX=ut(U3);/**
|
|
243
|
+
* @license lucide-react v1.49.0 - ISC
|
|
244
|
+
*
|
|
245
|
+
* This source code is licensed under the ISC license.
|
|
246
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
247
|
+
*/const V3={name:"message-square",size:24,node:[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}]]};V3.node;const VX=ut(V3);/**
|
|
248
|
+
* @license lucide-react v1.49.0 - ISC
|
|
249
|
+
*
|
|
250
|
+
* This source code is licensed under the ISC license.
|
|
251
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
252
|
+
*/const q3={name:"messages-square",size:24,node:[["path",{d:"M16 10a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 14.286V4a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2z",key:"1n2ejm"}],["path",{d:"M20 9a2 2 0 0 1 2 2v10.286a.71.71 0 0 1-1.212.502l-2.202-2.202A2 2 0 0 0 17.172 19H10a2 2 0 0 1-2-2v-1",key:"1qfcsi"}]]};q3.node;const qX=ut(q3);/**
|
|
253
|
+
* @license lucide-react v1.49.0 - ISC
|
|
254
|
+
*
|
|
255
|
+
* This source code is licensed under the ISC license.
|
|
256
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
257
|
+
*/const G3={name:"minimize-2",size:24,node:[["path",{d:"m14 10 7-7",key:"oa77jy"}],["path",{d:"M20 10h-6V4",key:"mjg0md"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M4 14h6v6",key:"rmj7iw"}]]};G3.node;const GX=ut(G3);/**
|
|
258
|
+
* @license lucide-react v1.49.0 - ISC
|
|
259
|
+
*
|
|
260
|
+
* This source code is licensed under the ISC license.
|
|
261
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
262
|
+
*/const K3={name:"moon",size:24,node:[["path",{d:"M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401",key:"kfwtm"}]]};K3.node;const KX=ut(K3);/**
|
|
263
|
+
* @license lucide-react v1.49.0 - ISC
|
|
264
|
+
*
|
|
265
|
+
* This source code is licensed under the ISC license.
|
|
266
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
267
|
+
*/const Y3={name:"mouse-pointer-click",size:24,node:[["path",{d:"M14 4.1 12 6",key:"ita8i4"}],["path",{d:"m5.1 8-2.9-.8",key:"1go3kf"}],["path",{d:"m6 12-1.9 2",key:"mnht97"}],["path",{d:"M7.2 2.2 8 5.1",key:"1cfko1"}],["path",{d:"M9.037 9.69a.498.498 0 0 1 .653-.653l11 4.5a.5.5 0 0 1-.074.949l-4.349 1.041a1 1 0 0 0-.74.739l-1.04 4.35a.5.5 0 0 1-.95.074z",key:"s0h3yz"}]]};Y3.node;const oM=ut(Y3);/**
|
|
268
|
+
* @license lucide-react v1.49.0 - ISC
|
|
269
|
+
*
|
|
270
|
+
* This source code is licensed under the ISC license.
|
|
271
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
272
|
+
*/const W3={name:"pen-line",size:24,node:[["path",{d:"M13 21h8",key:"1jsn5i"}],["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}]],aliases:["edit-3"]};W3.node;const YX=ut(W3);/**
|
|
273
|
+
* @license lucide-react v1.49.0 - ISC
|
|
274
|
+
*
|
|
275
|
+
* This source code is licensed under the ISC license.
|
|
276
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
277
|
+
*/const X3={name:"pencil",size:24,node:[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]]};X3.node;const Q3=ut(X3);/**
|
|
278
|
+
* @license lucide-react v1.49.0 - ISC
|
|
279
|
+
*
|
|
280
|
+
* This source code is licensed under the ISC license.
|
|
281
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
282
|
+
*/const Z3={name:"plus",size:24,node:[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]};Z3.node;const M2=ut(Z3);/**
|
|
283
|
+
* @license lucide-react v1.49.0 - ISC
|
|
284
|
+
*
|
|
285
|
+
* This source code is licensed under the ISC license.
|
|
286
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
287
|
+
*/const J3={name:"route",size:24,node:[["circle",{cx:"6",cy:"19",r:"3",key:"1kj8tv"}],["path",{d:"M9 19h8.5a3.5 3.5 0 0 0 0-7h-11a3.5 3.5 0 0 1 0-7H15",key:"1d8sl"}],["circle",{cx:"18",cy:"5",r:"3",key:"gq8acd"}]]};J3.node;const j1=ut(J3);/**
|
|
288
|
+
* @license lucide-react v1.49.0 - ISC
|
|
289
|
+
*
|
|
290
|
+
* This source code is licensed under the ISC license.
|
|
291
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
292
|
+
*/const e5={name:"settings",size:24,node:[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]};e5.node;const t5=ut(e5);/**
|
|
293
|
+
* @license lucide-react v1.49.0 - ISC
|
|
294
|
+
*
|
|
295
|
+
* This source code is licensed under the ISC license.
|
|
296
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
297
|
+
*/const n5={name:"sliders-horizontal",size:24,node:[["path",{d:"M10 5H3",key:"1qgfaw"}],["path",{d:"M12 19H3",key:"yhmn1j"}],["path",{d:"M14 3v4",key:"1sua03"}],["path",{d:"M16 17v4",key:"1q0r14"}],["path",{d:"M21 12h-9",key:"1o4lsq"}],["path",{d:"M21 19h-5",key:"1rlt1p"}],["path",{d:"M21 5h-7",key:"1oszz2"}],["path",{d:"M8 10v4",key:"tgpxqk"}],["path",{d:"M8 12H3",key:"a7s4jb"}]]};n5.node;const jd=ut(n5);/**
|
|
298
|
+
* @license lucide-react v1.49.0 - ISC
|
|
299
|
+
*
|
|
300
|
+
* This source code is licensed under the ISC license.
|
|
301
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
302
|
+
*/const r5={name:"sun",size:24,node:[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]]};r5.node;const WX=ut(r5);/**
|
|
303
|
+
* @license lucide-react v1.49.0 - ISC
|
|
304
|
+
*
|
|
305
|
+
* This source code is licensed under the ISC license.
|
|
306
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
307
|
+
*/const s5={name:"trash",size:24,node:[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],aliases:["trash-2"]};s5.node;const I2=ut(s5);/**
|
|
308
|
+
* @license lucide-react v1.49.0 - ISC
|
|
309
|
+
*
|
|
310
|
+
* This source code is licensed under the ISC license.
|
|
311
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
312
|
+
*/const o5={name:"triangle-alert",size:24,node:[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]],aliases:["alert-triangle"]};o5.node;const XX=ut(o5);/**
|
|
313
|
+
* @license lucide-react v1.49.0 - ISC
|
|
314
|
+
*
|
|
315
|
+
* This source code is licensed under the ISC license.
|
|
316
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
317
|
+
*/const i5={name:"user-plus",size:24,node:[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["line",{x1:"19",x2:"19",y1:"8",y2:"14",key:"1bvyxn"}],["line",{x1:"22",x2:"16",y1:"11",y2:"11",key:"1shjgl"}]]};i5.node;const QX=ut(i5);/**
|
|
318
|
+
* @license lucide-react v1.49.0 - ISC
|
|
319
|
+
*
|
|
320
|
+
* This source code is licensed under the ISC license.
|
|
321
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
322
|
+
*/const l5={name:"workflow",size:24,node:[["rect",{width:"8",height:"8",x:"3",y:"3",rx:"2",key:"by2w9f"}],["path",{d:"M7 11v4a2 2 0 0 0 2 2h4",key:"xkn7yn"}],["rect",{width:"8",height:"8",x:"13",y:"13",rx:"2",key:"1cgmvn"}]]};l5.node;const L2=ut(l5);/**
|
|
323
|
+
* @license lucide-react v1.49.0 - ISC
|
|
324
|
+
*
|
|
325
|
+
* This source code is licensed under the ISC license.
|
|
326
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
327
|
+
*/const a5={name:"x",size:24,node:[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]};a5.node;const Vx=ut(a5);/**
|
|
328
|
+
* @license lucide-react v1.49.0 - ISC
|
|
329
|
+
*
|
|
330
|
+
* This source code is licensed under the ISC license.
|
|
331
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
332
|
+
*/const c5={name:"zap",size:24,node:[["path",{d:"M15.914 4a1.5 1.5 0 00-2.474-1.561l-9 9A1.5 1.5 0 005.5 14h4.002a.5.5 0 01.471.666L8.086 20a1.5 1.5 0 002.475 1.56l9-9A1.5 1.5 0 0018.5 10h-3.997a.5.5 0 01-.472-.667z",key:"1v7up4"}]]};c5.node;const pE=ut(c5);/**
|
|
333
|
+
* @license lucide-react v1.49.0 - ISC
|
|
334
|
+
*
|
|
335
|
+
* This source code is licensed under the ISC license.
|
|
336
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
337
|
+
*/const u5={name:"zoom-in",size:24,node:[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"11",x2:"11",y1:"8",y2:"14",key:"1vmskp"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]]};u5.node;const ZX=ut(u5);/**
|
|
338
|
+
* @license lucide-react v1.49.0 - ISC
|
|
339
|
+
*
|
|
340
|
+
* This source code is licensed under the ISC license.
|
|
341
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
342
|
+
*/const d5={name:"zoom-out",size:24,node:[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]]};d5.node;const JX=ut(d5),f5=N.createContext(void 0);function qx(e){const t=N.useContext(f5);if(t===void 0&&!e)throw new Error(Wt(33));return t}const h5=N.createContext(void 0);function hl(e){const t=N.useContext(h5);if(t===void 0&&!e)throw new Error(Wt(36));return t}const D2="data-starting-style",eQ="data-ending-style",tQ={[D2]:""},nQ={[eQ]:""},dm={transitionStatus(e){return e==="starting"?tQ:e==="ending"?nQ:null}},rQ="data-open",sQ="data-closed",oQ="data-anchor-hidden",p5="data-popup-open",iQ="data-pressed",lQ={[p5]:""},aQ={[p5]:"",[iQ]:""},cQ={[rQ]:""},uQ={[sQ]:""},dQ={[oQ]:""},fm={open(e){return e?lQ:null}},mE={open(e){return e?aQ:null}},Af={open(e){return e?cQ:uQ},anchorHidden(e){return e?dQ:null}},hm={...Af,...dm},fQ=N.createContext(void 0);function j2(e=!0){const t=N.useContext(fQ);if(t===void 0&&!e)throw new Error(Wt(25));return t}const pm="none",di="trigger-press",wn="trigger-hover",Pd="trigger-focus",P2="outside-press",z2="item-press",m5="close-press",ou="focus-out",mm="escape-key",Ap="list-navigation",hQ="cancel-open",Rd="sibling-open",pQ="disabled",iu="imperative-action";function B2({controlled:e,default:t,name:n,state:r="value"}){const{current:s}=N.useRef(e!==void 0),[o,l]=N.useState(t),c=s&&e!==void 0?e:o,u=N.useCallback(f=>{s||l(f)},[]);return[c,u]}const g5=N.createContext(void 0);function mQ(){const e=N.useContext(g5);if(e===void 0)throw new Error(Wt(30));return e}function gQ(){return typeof navigator>"u"?{userAgent:"",platform:"",maxTouchPoints:0}:{userAgent:navigator.userAgent,platform:navigator.platform??"",maxTouchPoints:navigator.maxTouchPoints??0}}const{userAgent:yQ,platform:xQ,maxTouchPoints:bQ}=gQ(),Gx=yQ.toLowerCase(),kp=xQ.toLowerCase(),Kx=/^i(os$|p)/.test(kp)||kp==="macintel"&&bQ>1,iM="android",gE=kp===iM||Gx.includes(iM),H2=!Kx&&kp.startsWith("mac");kp.startsWith("win");const vQ=H2||Kx;var MP;const Ka=typeof CSS<"u"&&!!((MP=CSS.supports)!=null&&MP.call(CSS,"-webkit-backdrop-filter:none"));!Ka&&Gx.includes("firefox");!Ka&&Gx.includes("chrom");const y5=vQ,F2=/jsdom|happydom/.test(Gx);function SQ(e){const{closeOnClick:t,highlighted:n,id:r,nodeId:s,store:o,typingRef:l,itemRef:c,itemMetadata:u}=e,{events:f}=o.useState("floatingTreeRoot"),h=o.useState("open"),p=j2(!0),y=p!==void 0;return N.useMemo(()=>({id:r,role:"menuitem",tabIndex:h&&n?0:-1,onKeyDown(x){x.key===" "&&(l!=null&&l.current)&&x.preventDefault()},onMouseMove(x){s&&f.emit("itemhover",{nodeId:s,target:x.currentTarget})},onClick(x){t&&f.emit("close",{domEvent:x,reason:z2})},onMouseUp(x){if(p){const b=p.initialCursorPointRef.current;if(p.initialCursorPointRef.current=null,y&&b&&Math.abs(x.clientX-b.x)<=1&&Math.abs(x.clientY-b.y)<=1||y&&!H2&&x.button===2)return}c.current&&o.context.allowMouseUpTriggerRef.current&&(!y||x.button===2)&&u.type==="regular-item"&&hy(c.current,x,{detail:1})}}),[t,n,r,f,s,h,o,l,c,p,y,u])}const x5={type:"regular-item"};function $2(e){const{closeOnClick:t,disabled:n,highlighted:r,id:s,store:o,typingRef:l=o.context.typingRef,nativeButton:c,itemMetadata:u,nodeId:f}=e,h=N.useRef(null),{getButtonProps:p,buttonRef:y}=Su({disabled:n,focusableWhenDisabled:!0,native:c,composite:!0}),x=SQ({closeOnClick:t,highlighted:r,id:s,nodeId:f,store:o,typingRef:l,itemRef:h,itemMetadata:u}),b=N.useCallback(E=>el(x,{onMouseEnter(){u.type==="submenu-trigger"&&u.setActive()}},E,p),[x,p,u]),S=Ba(h,y);return N.useMemo(()=>({getItemProps:b,itemRef:S}),[b,S])}const b5=N.createContext({register:()=>{},unregister:()=>{},subscribeMapChange:()=>()=>{},nextIndexRef:{current:0}});function wQ(){return N.useContext(b5)}function Yx(e={}){const{guess:t,label:n,metadata:r,textRef:s,index:o}=e,{register:l,unregister:c,subscribeMapChange:u,nextIndexRef:f}=wQ(),h=N.useRef(-1),[p,y]=N.useState(o==null&&t?()=>{if(h.current===-1){const E=f.current;f.current+=1,h.current=E}return h.current}:-1),x=o??p,b=N.useRef(null),S=N.useCallback(E=>{const C=b.current;C&&c(C),b.current=E,E&&l(E,{metadata:r??null,index:o??null,label:n,textRef:s})},[o,l,c,r,n,s]);return Be(()=>{if(o==null)return u(E=>{var O;const C=b.current?(O=E.get(b.current))==null?void 0:O.index:null;C!=null&&y(C)})},[o,u]),{ref:S,index:x}}let lM=0;function EQ(e,t="mui"){const[n,r]=N.useState(e),s=e||n;return N.useEffect(()=>{n==null&&(lM+=1,r(`${t}-${lM}`))},[n,t]),s}const aM=E2.useId;function cf(e,t){if(aM!==void 0){const n=aM();return e??(t?`${t}-${n}`:n)}return EQ(e,t)}function ls(e){return cf(e,"base-ui")}const CQ="data-checked",TQ="data-unchecked",v5={checked(e){return e?{[CQ]:""}:{[TQ]:""}},...dm};function ct(e,t,n,r){let s=!1,o=!1;const l=r??hn;return{reason:e,event:t??new Event("base-ui"),cancel(){s=!0},allowPropagation(){o=!0},get isCanceled(){return s},get isPropagationAllowed(){return o},trigger:n,...l}}const S5=N.forwardRef(function(t,n){const{render:r,className:s,id:o,label:l,nativeButton:c=!1,disabled:u=!1,closeOnClick:f=!1,checked:h,defaultChecked:p,onCheckedChange:y,style:x,...b}=t,S=Yx({guess:!0,label:l}),E=qx(!0),C=ls(o),{store:O}=hl(),T=O.useState("disabled"),R=u||T,k=O.useState("isActive",S.index),M=O.useState("itemProps"),[A,I]=B2({controlled:h,default:p??!1,name:"MenuCheckboxItem",state:"checked"}),{getItemProps:L,itemRef:D}=$2({closeOnClick:f,disabled:R,highlighted:k,id:C,store:O,nativeButton:c,nodeId:E==null?void 0:E.context.nodeId,itemMetadata:x5}),P=N.useMemo(()=>({disabled:R,highlighted:k,checked:A}),[R,k,A]);function z(j){const H=ct(z2,j.nativeEvent,void 0,{preventUnmountOnClose:Fn});y==null||y(!A,H),!H.isCanceled&&I(B=>!B)}const $=Lt("div",t,{state:P,stateAttributesMapping:v5,props:[M,{role:"menuitemcheckbox","aria-checked":A,onClick:z},b,L],ref:[D,n,S.ref]});return m.jsx(g5.Provider,{value:P,children:$})});function U2(e){N.useEffect(e,Ha)}const T0=null;class NQ{constructor(){Ot(this,"callbacks",[]);Ot(this,"callbacksCount",0);Ot(this,"nextId",1);Ot(this,"startId",1);Ot(this,"isScheduled",!1);Ot(this,"tick",t=>{var s;this.isScheduled=!1;const n=this.callbacks,r=this.callbacksCount;if(this.callbacks=[],this.callbacksCount=0,this.startId=this.nextId,r>0)for(let o=0;o<n.length;o+=1)(s=n[o])==null||s.call(n,t)})}request(t){const n=this.nextId;return this.nextId+=1,this.callbacks.push(t),this.callbacksCount+=1,(!this.isScheduled||!1)&&(requestAnimationFrame(this.tick),this.isScheduled=!0),n}cancel(t){const n=t-this.startId;n<0||n>=this.callbacks.length||this.callbacks[n]!==null&&(this.callbacks[n]=null,this.callbacksCount-=1)}}let N0=new NQ;class xs{constructor(){Ot(this,"currentId",T0);Ot(this,"cancel",()=>{this.currentId!==T0&&(N0.cancel(this.currentId),this.currentId=T0)});Ot(this,"disposeEffect",()=>this.cancel)}static create(){return new xs}static request(t){return N0.request(t)}static cancel(t){return N0.cancel(t)}request(t){this.cancel(),this.currentId=N0.request(()=>{this.currentId=T0,t()})}}function _p(){const e=Rr(xs.create).current;return U2(e.disposeEffect),e}function V2(e,t=!1,n=!1,r=!1){const[s,o]=N.useState(e&&t?"idle":void 0),[l,c]=N.useState(e&&!r);return e&&!l&&(c(!0),o("starting")),!e&&l&&s!=="ending"&&!n&&o("ending"),!e&&!l&&s==="ending"&&o(void 0),Be(()=>{if(!e&&l&&s!=="ending"&&n){const u=xs.request(()=>{o("ending")});return()=>{xs.cancel(u)}}},[e,l,s,n]),Be(()=>{if(!e||t)return;const u=xs.request(()=>{o(void 0)});return()=>{xs.cancel(u)}},[t,e]),Be(()=>{if(!e||!t)return;e&&l&&s!=="idle"&&o("starting");const u=xs.request(()=>{o("idle")});return()=>{xs.cancel(u)}},[t,e,l,s]),{mounted:l,setMounted:c,transitionStatus:s}}var Us=GP();const Yke=n2(Us);function Bi(e){return e==null?e:"current"in e?e.current:e}let O0=null;function OQ(e){if(!O0){const t=[];O0=t,queueMicrotask(()=>{O0=null,Us.flushSync(()=>{for(const n of t)n()})})}O0.push(e)}function gm(e,t=!1,n=!1){const r=_p();return Ve((s,o=null)=>{r.cancel();const l=Bi(e);if(l==null)return;const c=l,u=()=>{if(!n){Us.flushSync(s);return}OQ(()=>{o!=null&&o.aborted||s()})};if(typeof c.getAnimations!="function"||globalThis.BASE_UI_ANIMATIONS_DISABLED){s();return}function f(){Promise.all(c.getAnimations().map(h=>h.finished)).then(()=>{o!=null&&o.aborted||u()},()=>{if(o!=null&&o.aborted)return;if(c.getAnimations().some(p=>p.pending||p.playState!=="finished")){f();return}u()})}if(t){const h=D2;if(!c.hasAttribute(h)){r.request(f);return}const p=new MutationObserver(()=>{c.hasAttribute(h)||(p.disconnect(),f())});p.observe(c,{attributes:!0,attributeFilter:[h]}),o==null||o.addEventListener("abort",()=>p.disconnect(),{once:!0});return}r.request(f)})}function Ya(e){const{enabled:t=!0,open:n,ref:r,batch:s=!1,onComplete:o}=e,l=Ve(o),c=gm(r,n,s);N.useEffect(()=>{if(!t)return;const u=new AbortController;return c(l,u.signal),()=>{u.abort()}},[t,n,l,c])}const w5=N.forwardRef(function(t,n){const{render:r,className:s,style:o,keepMounted:l=!1,...c}=t,u=mQ(),f=N.useRef(null),{transitionStatus:h,mounted:p,setMounted:y}=V2(u.checked);Ya({batch:!0,enabled:!u.checked,open:u.checked,ref:f,onComplete(){u.checked||y(!1)}});const x={checked:u.checked,disabled:u.disabled,highlighted:u.highlighted,transitionStatus:h};return Lt("span",t,{state:x,ref:[n,f],stateAttributesMapping:v5,props:{"aria-hidden":!0,...c},enabled:l||p})}),E5=N.createContext(void 0);function RQ(){const e=N.useContext(E5);if(e===void 0)throw new Error(Wt(31));return e}const AQ=N.forwardRef(function(t,n){const{render:r,className:s,style:o,...l}=t,[c,u]=N.useState(void 0),f=Lt("div",t,{ref:n,props:{role:"group","aria-labelledby":c,...l}});return m.jsx(E5.Provider,{value:u,children:f})}),kQ=N.forwardRef(function(t,n){const{render:r,className:s,style:o,id:l,...c}=t,u=ls(l),f=RQ();return Be(()=>(f(u),()=>{f(h=>h===u?void 0:h)}),[f,u]),Lt("div",t,{ref:n,props:{id:u,"aria-hidden":!0,...c}})}),C5=N.forwardRef(function(t,n){const{render:r,className:s,id:o,label:l,nativeButton:c=!1,disabled:u=!1,closeOnClick:f=!0,style:h,...p}=t,y=Yx({guess:!0,label:l}),x=qx(!0),b=ls(o),{store:S}=hl(),E=S.useState("disabled"),C=u||E,O=S.useState("isActive",y.index),T=S.useState("itemProps"),{getItemProps:R,itemRef:k}=$2({closeOnClick:f,disabled:C,highlighted:O,id:b,store:S,nativeButton:c,nodeId:x==null?void 0:x.context.nodeId,itemMetadata:x5});return Lt("div",t,{state:{disabled:C,highlighted:O},props:[T,p,R],ref:[k,n,y.ref]})}),Dh=0;class co{constructor(){Ot(this,"currentId",Dh);Ot(this,"clear",()=>{this.currentId!==Dh&&(clearTimeout(this.currentId),this.currentId=Dh)});Ot(this,"disposeEffect",()=>this.clear)}static create(){return new co}start(t,n){this.clear(),this.currentId=setTimeout(()=>{this.currentId=Dh,n()},t)}isStarted(){return this.currentId!==Dh}}function ns(){const e=Rr(co.create).current;return U2(e.disposeEffect),e}function Qo(e){e.preventDefault(),e.stopPropagation()}function _Q(e){return"nativeEvent"in e}function q2(e){return e.pointerType===""&&e.isTrusted?!0:gE&&e.pointerType?e.type==="click"&&e.buttons===1:e.detail===0&&!e.pointerType}function G2(e){return F2?!1:!gE&&e.width===0&&e.height===0||gE&&e.width===1&&e.height===1&&e.pressure===0&&e.detail===0&&e.pointerType==="mouse"||e.width<1&&e.height<1&&e.pressure===0&&e.detail===0&&e.pointerType==="touch"}function Ra(e,t){const n=["mouse","pen"];return t||n.push("",void 0),n.includes(e)}function MQ(e){const t=e.type;return t==="click"||t==="mousedown"||t==="keydown"||t==="keyup"}function es(e){var n;let t=e.activeElement;for(;((n=t==null?void 0:t.shadowRoot)==null?void 0:n.activeElement)!=null;)t=t.shadowRoot.activeElement;return t}function Je(e,t){var r;if(!e||!t)return!1;const n=(r=t.getRootNode)==null?void 0:r.call(t);if(e.contains(t))return!0;if(n&&af(n)){let s=t;for(;s;){if(e===s)return!0;s=s.parentNode||s.host}}return!1}function Nr(e){return"composedPath"in e?e.composedPath()[0]??e.target:e.target}const yE="data-base-ui-focusable",T5="input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])",Wx="ArrowLeft",Xx="ArrowRight",N5="ArrowUp",K2="ArrowDown",xE="data-trigger-disabled";function Hy(e,t){if(!St(e))return!1;const n=e;if(t.hasElement(n))return!n.hasAttribute(xE);for(const[,r]of t.entries())if(Je(r,n))return!r.hasAttribute(xE);return!1}function P1(e,t){if(t==null)return!1;if("composedPath"in e)return e.composedPath().includes(t);const n=e;return n.target!=null&&t.contains(n.target)}function IQ(e){return e.matches("html,body")}function Qx(e){return Yt(e)&&e.matches(T5)}function LQ(e){return(e==null?void 0:e.closest(`button,a[href],[role="button"],select,[tabindex]:not([tabindex="-1"]),${T5}`))!=null}function bE(e){return e?e.getAttribute("role")==="combobox"&&Qx(e):!1}function DQ(e){if(!e||F2)return!0;try{return e.matches(":focus-visible")}catch{return!0}}function vE(e){return e?e.hasAttribute(yE)?e:e.querySelector(`[${yE}]`)||e:null}function jQ(e,t){return t!=null&&!Ra(t)?0:typeof e=="function"?e():e}function Mp(e,t,n){const r=jQ(e,n);return typeof r=="number"?r:r==null?void 0:r[t]}function cM(e){return typeof e=="function"?e():e}function O5(e,t){return t||e==="click"||e==="mousedown"}function PQ(e){return(e==null?void 0:e.includes("mouse"))&&e!=="mousedown"}const zQ=N.createContext({hasProvider:!1,timeoutMs:0,delayRef:{current:0},initialDelayRef:{current:0},timeout:new co,currentIdRef:{current:null},currentContextRef:{current:null}});function BQ(e,t){e.current=t.current}function HQ(e,t={open:!1}){const{open:n}=t,r="rootStore"in e?e.rootStore:e,s=r.useState("floatingId"),o=N.useContext(zQ),{currentIdRef:l,delayRef:c,timeoutMs:u,initialDelayRef:f,currentContextRef:h,hasProvider:p,timeout:y}=o,[x,b]=N.useState(!1),S=N.useRef(n);return Be(()=>{S.current=n},[n]),Be(()=>{function E(){var C;(C=h.current)==null||C.setIsInstantPhase(!1),l.current=null,h.current=null,c.current=f.current,y.clear()}if(l.current&&!n&&l.current===s){if(b(!1),u){const C=s;return y.start(u,()=>{r.select("open")||l.current&&l.current!==C||E()}),()=>{(S.current||l.current!==C)&&y.clear()}}E()}},[n,s,l,c,u,f,h,y,r]),Be(()=>{if(!n)return;const E=h.current,C=l.current;y.clear(),h.current={onOpenChange:r.setOpen,setIsInstantPhase:b},l.current=s,c.current={open:0,close:Mp(f.current,"close")},C!==null&&C!==s?(b(!0),E==null||E.setIsInstantPhase(!0),E==null||E.onOpenChange(!1,ct(pm))):(b(!1),E==null||E.setIsInstantPhase(!1))},[n,s,r,l,c,f,h,y]),Be(()=>()=>{if(l.current===s){if(h.current=null,!S.current)return;l.current=null,BQ(c,f),y.clear()}},[h,l,c,s,f,y]),N.useMemo(()=>({activeIdRef:l,hasProvider:p,delayRef:c,isInstantPhase:x}),[l,p,c,x])}function bt(e,t,n,r){return e.addEventListener(t,n,r),()=>{e.removeEventListener(t,n,r)}}function ai(...e){return()=>{for(let t=0;t<e.length;t+=1){const n=e[t];n&&n()}}}function In(e){const t=Rr(FQ,e).current;return t.next=e,Be(t.effect),t}function FQ(e){const t={current:e,next:e,effect:()=>{t.current=t.next}};return t}const $Q={clipPath:"inset(50%)",overflow:"hidden",whiteSpace:"nowrap",border:0,padding:0,width:1,height:1,margin:-1},UQ={...$Q,position:"fixed",top:0,left:0},Ua=N.forwardRef(function(t,n){const[r,s]=N.useState();Be(()=>{y5&&Ka&&s("button")},[]);const o={tabIndex:0,role:r};return m.jsx("span",{...t,ref:n,style:UQ,"aria-hidden":r?void 0:!0,...o,"data-base-ui-focus-guard":""})}),uf=Math.min,tl=Math.max,Fy=Math.round,R0=Math.floor,nl=e=>({x:e,y:e}),VQ={left:"right",right:"left",bottom:"top",top:"bottom"};function R5(e,t,n){return tl(e,uf(t,n))}function Va(e,t){return typeof e=="function"?e(t):e}function oo(e){return e.split("-")[0]}function cl(e){return e.split("-")[1]}function Y2(e){return e==="x"?"y":"x"}function W2(e){return e==="y"?"height":"width"}function so(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function X2(e){return Y2(so(e))}function qQ(e,t,n){n===void 0&&(n=!1);const r=cl(e),s=X2(e),o=W2(s);let l=s==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[o]>t.floating[o]&&(l=$y(l)),[l,$y(l)]}function GQ(e){const t=$y(e);return[SE(e),t,SE(t)]}function SE(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const uM=["left","right"],dM=["right","left"],KQ=["top","bottom"],YQ=["bottom","top"];function WQ(e,t,n){switch(e){case"top":case"bottom":return n?t?dM:uM:t?uM:dM;case"left":case"right":return t?KQ:YQ;default:return[]}}function XQ(e,t,n,r){const s=cl(e);let o=WQ(oo(e),n==="start",r);return s&&(o=o.map(l=>l+"-"+s),t&&(o=o.concat(o.map(SE)))),o}function $y(e){const t=oo(e);return VQ[t]+e.slice(t.length)}function QQ(e){var t,n,r,s;return{top:(t=e.top)!=null?t:0,right:(n=e.right)!=null?n:0,bottom:(r=e.bottom)!=null?r:0,left:(s=e.left)!=null?s:0}}function A5(e){return typeof e!="number"?QQ(e):{top:e,right:e,bottom:e,left:e}}function Uy(e){const{x:t,y:n,width:r,height:s}=e;return{width:r,height:s,top:n,left:t,right:t+r,bottom:n+s,x:t,y:n}}function lp(e,t){return t<0||t>=e.length}function xy(e,t){return Gi(e.current,{disabledIndices:t})}function wE(e,t){return Gi(e.current,{decrement:!0,startingIndex:e.current.length,disabledIndices:t})}function Gi(e,{startingIndex:t=-1,decrement:n=!1,disabledIndices:r,amount:s=1}={}){let o=t;do o+=n?-s:s;while(o>=0&&o<=e.length-1&&zd(e,o,r));return o}function zd(e,t,n){if(typeof n=="function"?n(t):(n==null?void 0:n.includes(t))??!1)return!0;const s=e[t];return s?!Zx(s)||s.matches(":disabled")?!0:!n&&(s.hasAttribute("disabled")||s.getAttribute("aria-disabled")==="true"):!1}function ZQ(e){return e.visibility==="hidden"||e.visibility==="collapse"}function Zx(e,t=e?$s(e):null){return!e||!e.isConnected||!t||ZQ(t)?!1:typeof e.checkVisibility=="function"?e.checkVisibility():t.display!=="none"&&t.display!=="contents"}const JQ='a[href],button,input,select,textarea,summary,details,iframe,object,embed,[tabindex],[contenteditable]:not([contenteditable="false"]),audio[controls],video[controls]';function eZ(e){const t=e.assignedSlot;if(t)return t;if(e.parentElement)return e.parentElement;const n=e.getRootNode();return af(n)?n.host:null}function EE(e){for(const t of Array.from(e.children))if(Or(t)==="summary")return t;return null}function tZ(e,t){const n=EE(t);return!!n&&(e===n||Je(n,e))}function k5(e){const t=e?Or(e):"";return e!=null&&e.matches(JQ)&&(t!=="summary"||e.parentElement!=null&&Or(e.parentElement)==="details"&&EE(e.parentElement)===e)&&(t!=="details"||EE(e)==null)&&(t!=="input"||e.type!=="hidden")}function _5(e){if(!k5(e)||!e.isConnected||e.matches(":disabled"))return!1;for(let t=e;t;t=eZ(t)){const n=t!==e,r=Or(t)==="slot";if(t.hasAttribute("inert")||n&&Or(t)==="details"&&!t.open&&!tZ(e,t)||t.hasAttribute("hidden")||!r&&!nZ(t,n))return!1}return!0}function nZ(e,t){const n=$s(e);return t?n.display!=="none":Zx(e,n)}function M5(e){const t=e.tabIndex;if(t<0){const n=Or(e);if(n==="details"||n==="audio"||n==="video"||Yt(e)&&e.isContentEditable)return 0}return t}function z1(e){if(Or(e)!=="input")return null;const t=e;return t.type==="radio"&&t.name!==""?t:null}function rZ(e,t){const n=z1(e);if(!n)return!0;const r=t.find(s=>{const o=z1(s);return(o==null?void 0:o.name)===n.name&&o.form===n.form&&o.checked});return r?r===n:t.find(s=>{const o=z1(s);return(o==null?void 0:o.name)===n.name&&o.form===n.form})===n}function I5(e){if(Yt(e)&&Or(e)==="slot"){const t=e.assignedElements({flatten:!0});if(t.length>0)return t}return Yt(e)&&e.shadowRoot?Array.from(e.shadowRoot.children):Array.from(e.children)}function L5(e,t){I5(e).forEach(n=>{k5(n)&&t.push(n),L5(n,t)})}function D5(e,t,n){I5(e).forEach(r=>{Yt(r)&&r.matches(t)&&n.push(r),D5(r,t,n)})}function Q2(e){return _5(e)&&M5(e)>=0}function j5(e){const t=[];return L5(e,t),t.filter(_5)}function ym(e){const t=j5(e);return t.filter(n=>M5(n)>=0&&rZ(n,t))}function P5(e,t){const n=ym(e),r=n.length;if(r===0)return;const s=es(jt(e)),o=n.indexOf(s),l=o===-1?t===1?0:r-1:o+t;return n[l]}function Z2(e){return P5(jt(e).body,1)||e}function z5(e){return P5(jt(e).body,-1)||e}function B5(e,t){if(!e)return null;const n=ym(jt(e).body),r=n.length;if(r===0)return null;const s=n.indexOf(e);if(s===-1)return null;const o=(s+t+r)%r;return n[o]}function sZ(e){return B5(e,1)}function oZ(e){return B5(e,-1)}function Bd(e,t){const n=t||e.currentTarget,r=e.relatedTarget;return!r||!Je(n,r)}function iZ(e){ym(e).forEach(n=>{n.dataset.tabindex=n.getAttribute("tabindex")||"",n.setAttribute("tabindex","-1")})}function fM(e){const t=[];D5(e,"[data-tabindex]",t),t.forEach(n=>{const r=n.dataset.tabindex;delete n.dataset.tabindex,r?n.setAttribute("tabindex",r):n.removeAttribute("tabindex")})}function qa(e,t,n=!0){return e.filter(s=>s.parentId===t).flatMap(s=>{var o;return[...!n||(o=s.context)!=null&&o.open?[s]:[],...qa(e,s.id,n)]})}function hM(e,t){var s;let n=[],r=(s=e.find(o=>o.id===t))==null?void 0:s.parentId;for(;r;){const o=e.find(l=>l.id===r);r=o==null?void 0:o.parentId,o&&(n=n.concat(o))}return n}function Ip(e){return`data-base-ui-${e}`}let A0=0;function by(e,t={}){const{preventScroll:n=!1,sync:r=!1,shouldFocus:s}=t;cancelAnimationFrame(A0);function o(){s&&!s()||e==null||e.focus({preventScroll:n})}if(r)return o(),Fn;const l=requestAnimationFrame(o);return A0=l,()=>{A0===l&&(cancelAnimationFrame(l),A0=0)}}const B1={inert:new WeakMap,"aria-hidden":new WeakMap},pM="data-base-ui-inert",CE={inert:new WeakSet,"aria-hidden":new WeakSet};let jh=new WeakMap,H1=0;function lZ(e){return CE[e]}function H5(e){return e?af(e)?e.host:H5(e.parentNode):null}const mM=(e,t)=>t.map(n=>{if(e.contains(n))return n;const r=H5(n);return e.contains(r)?r:null}).filter(n=>n!=null),gM=e=>{const t=new Set;return e.forEach(n=>{let r=n;for(;r&&!t.has(r);)t.add(r),r=r.parentNode}),t},yM=(e,t,n)=>{const r=[],s=o=>{!o||n.has(o)||Array.from(o.children).forEach(l=>{Or(l)!=="script"&&(t.has(l)?s(l):r.push(l))})};return s(e),r};function aZ(e,t,n,r,{mark:s=!0}){let o=null;r?o="inert":n&&(o="aria-hidden");let l=null,c=null;const u=mM(t,e),f=s?yM(t,gM(u),new Set(u)):[],h=[],p=[];if(o){const y=B1[o],x=lZ(o);c=x,l=y;const b=mM(t,Array.from(t.querySelectorAll("[aria-live]"))),S=u.concat(b);yM(t,gM(S),new Set(S)).forEach(C=>{const O=C.getAttribute(o),T=O!==null&&O!=="false",R=(y.get(C)||0)+1;y.set(C,R),h.push(C),R===1&&T&&x.add(C),T||C.setAttribute(o,o==="inert"?"":"true")})}return s&&f.forEach(y=>{const x=(jh.get(y)||0)+1;jh.set(y,x),p.push(y),x===1&&y.setAttribute(pM,"")}),H1+=1,()=>{l&&h.forEach(y=>{const b=(l.get(y)||0)-1;l.set(y,b),b||(!(c!=null&&c.has(y))&&o&&y.removeAttribute(o),c==null||c.delete(y))}),s&&p.forEach(y=>{const x=(jh.get(y)||0)-1;jh.set(y,x),x||y.removeAttribute(pM)}),H1-=1,H1||(B1.inert=new WeakMap,B1["aria-hidden"]=new WeakMap,CE.inert=new WeakSet,CE["aria-hidden"]=new WeakSet,jh=new WeakMap)}}function xM(e,t={}){const{ariaHidden:n=!1,inert:r=!1,mark:s=!0}=t,o=jt(e[0]).body;return aZ(e,o,n,r,{mark:s})}const cZ=500,F5=500,uZ={style:{transition:"none"}},J2="data-base-ui-click-trigger",dZ={fallbackAxisSide:"none"},Jx={fallbackAxisSide:"end"},fZ={clipPath:"inset(50%)",position:"fixed",top:0,left:0},$5=N.createContext(null),U5=()=>N.useContext($5),hZ=Ip("portal");function V5(e={}){const{ref:t,container:n,componentProps:r=hn,elementProps:s}=e,o=cf(),l=U5(),c=l==null?void 0:l.portalNode,[u,f]=N.useState(null),[h,p]=N.useState(null),y=Ve(E=>{E!==null&&p(E)}),x=N.useRef(null);Be(()=>{if(n===null){x.current&&(x.current=null,p(null),f(null));return}const E=(n&&(v2(n)?n:n.current))??c??document.body;if(E==null){x.current&&(x.current=null,p(null),f(null));return}x.current!==E&&(x.current=E,p(null),f(E))},[n,c]);const b=Lt("div",r,{ref:[t,y],props:[{id:o,[hZ]:""},s]}),S=u&&b?Us.createPortal(b,u):null;return{node:h,nodeId:N.isValidElement(b)?b.props.id:void 0,subtree:S}}const eT=N.forwardRef(function(t,n){const{render:r,className:s,style:o,children:l,container:c,portalOwnerRole:u,...f}=t,{node:h,nodeId:p,subtree:y}=V5({container:c,ref:n,componentProps:t,elementProps:f}),x=N.useRef(null),b=N.useRef(null),S=N.useRef(null),E=N.useRef(null),[C,O]=N.useState(null),T=N.useRef(!1),R=C==null?void 0:C.modal,k=C==null?void 0:C.open,M=!!C&&!C.modal&&C.open&&!!h;N.useEffect(()=>{if(!h||R)return;function I(L){h&&L.relatedTarget&&Bd(L)&&(L.type==="focusin"?T.current&&(fM(h),T.current=!1):(iZ(h),T.current=!0))}return ai(bt(h,"focusin",I,!0),bt(h,"focusout",I,!0))},[h,R]),Be(()=>{!h||k!==!0||!T.current||(fM(h),T.current=!1)},[k,h]);const A=N.useMemo(()=>({beforeOutsideRef:x,afterOutsideRef:b,beforeInsideRef:S,afterInsideRef:E,portalNode:h,setFocusManagerState:O}),[h]);return m.jsxs(N.Fragment,{children:[y,m.jsxs($5.Provider,{value:A,children:[M&&h&&m.jsx(Ua,{"data-type":"outside",ref:x,onFocus:I=>{var L;if(Bd(I,h))(L=S.current)==null||L.focus();else{const D=C?C.domReference:null,P=z5(D);P==null||P.focus()}}}),M&&h&&m.jsx("span",{role:u,"aria-owns":p,style:fZ}),h&&Us.createPortal(l,h),M&&h&&m.jsx(Ua,{"data-type":"outside",ref:b,onFocus:I=>{var L;if(Bd(I,h))(L=E.current)==null||L.focus();else{const D=C?C.domReference:null,P=Z2(D);P==null||P.focus(),C!=null&&C.closeOnFocusOut&&(C==null||C.onOpenChange(!1,ct(ou,I.nativeEvent)))}}})]})]})});function q5(){const e=new Map;return{emit(t,n){var r;(r=e.get(t))==null||r.forEach(s=>s(n))},on(t,n){e.has(t)||e.set(t,new Set),e.get(t).add(n)},off(t,n){var r;(r=e.get(t))==null||r.delete(n)}}}class tT{constructor(){Ot(this,"nodesRef",{current:[]});Ot(this,"events",q5())}addNode(t){this.nodesRef.current.push(t)}removeNode(t){const n=this.nodesRef.current.findIndex(r=>r===t);n!==-1&&this.nodesRef.current.splice(n,1)}}const G5=N.createContext(null),K5=N.createContext(null),Eu=()=>{var e;return((e=N.useContext(G5))==null?void 0:e.id)||null},pl=e=>{const t=N.useContext(K5);return e??t};function xm(e){const t=cf(),n=pl(e),r=Eu();return Be(()=>{if(!t)return;const s={id:t,parentId:r};return n==null||n.addNode(s),()=>{n==null||n.removeNode(s)}},[n,t,r]),t}function eb(e){const{children:t,id:n}=e,r=Eu();return m.jsx(G5.Provider,{value:N.useMemo(()=>({id:n,parentId:r}),[n,r]),children:t})}function tb(e){const{children:t,externalTree:n}=e,r=Rr(()=>n??new tT).current;return m.jsx(K5.Provider,{value:r,children:t})}function pZ(e,t){const n=pn(Nr(e));return e instanceof n.KeyboardEvent?"keyboard":e instanceof n.FocusEvent?t||"keyboard":"pointerType"in e?e.pointerType||"keyboard":"touches"in e?"touch":e instanceof n.MouseEvent?t||(e.detail===0?"keyboard":"mouse"):""}const bM=20;let Ea=[];function nT(){Ea=Ea.filter(e=>{var t;return(t=e.deref())==null?void 0:t.isConnected})}function vM(e){nT(),e&&Or(e)!=="body"&&(Ea.push(new WeakRef(e)),Ea.length>bM&&(Ea=Ea.slice(-bM)))}function SM(){var e;return nT(),(e=Ea[Ea.length-1])==null?void 0:e.deref()}function mZ(e){return e?Q2(e)?e:ym(e)[0]||e:null}function wM(e){var s;if(e.hasAttribute("tabindex")&&!e.hasAttribute("data-tabindex")||!((s=e.getAttribute("role"))!=null&&s.includes("dialog")))return;const n=j5(e).filter(o=>{const l=o.getAttribute("data-tabindex")||"";return Q2(o)||o.hasAttribute("data-tabindex")&&!l.startsWith("-")}),r=e.getAttribute("tabindex");n.length===0?r!=="0"&&(e.setAttribute("tabindex","0"),e.setAttribute("data-tabindex","0")):(r!=="-1"||e.hasAttribute("data-tabindex")&&e.getAttribute("data-tabindex")!=="-1")&&(e.setAttribute("tabindex","-1"),e.setAttribute("data-tabindex","-1"))}function rT(e){const{context:t,children:n,disabled:r=!1,initialFocus:s=!0,returnFocus:o=!0,restoreFocus:l=!1,modal:c=!0,closeOnFocusOut:u=!0,openInteractionType:f="",nextFocusableElement:h,previousFocusableElement:p,beforeContentFocusGuardRef:y,externalTree:x,getInsideElements:b}=e,S="rootStore"in t?t.rootStore:t,E=S.useState("open"),C=S.useState("domReferenceElement"),O=S.useState("floatingElement"),{events:T,dataRef:R}=S.context,k=Ve(()=>{var oe;return(oe=R.current.floatingContext)==null?void 0:oe.nodeId}),M=s===!1,A=bE(C)&&M,I=In(s),L=In(o),D=In(f),P=In(E),z=pl(x),$=U5(),j=N.useRef(!1),H=N.useRef(!1),B=N.useRef(!1),V=N.useRef(null),G=N.useRef(""),q=N.useRef(""),K=N.useRef(null),W=N.useRef(null),ee=Ba(K,y,$==null?void 0:$.beforeInsideRef),ce=Ba(W,$==null?void 0:$.afterInsideRef),F=ns(),X=ns(),te=_p(),Z=$!=null,Y=vE(O),le=Ve((oe=Y)=>oe?ym(oe):[]),xe=Ve(()=>(b==null?void 0:b().filter(oe=>oe!=null))??[]);N.useEffect(()=>{if(r||!c)return;function oe(he){he.key==="Tab"&&Je(Y,es(jt(Y)))&&le().length===0&&!A&&Qo(he)}const re=jt(Y);return bt(re,"keydown",oe)},[r,Y,c,A,le]),N.useEffect(()=>{if(r||!E)return;const oe=jt(Y);function re(){B.current=!1}function he(ke){const be=Nr(ke),_e=xe(),Me=Je(O,be)||Je(C,be)||Je($==null?void 0:$.portalNode,be)||_e.some(Le=>Le===be||Je(Le,be));B.current=!Me,q.current=ke.pointerType||"keyboard",be!=null&&be.closest(`[${J2}]`)&&(H.current=!0,X.start(0,()=>{H.current=!1}))}function Se(){q.current="keyboard"}return ai(bt(oe,"pointerdown",he,!0),bt(oe,"pointerup",re,!0),bt(oe,"pointercancel",re,!0),bt(oe,"keydown",Se,!0),re)},[r,O,C,Y,E,$,X,xe]),N.useEffect(()=>{if(r||!u)return;const oe=jt(Y);function re(){H.current=!0,X.start(0,()=>{H.current=!1})}function he(_e){const Me=Nr(_e);Q2(Me)&&(V.current=Me)}function Se(_e){const Me=_e.relatedTarget,Le=_e.currentTarget,Pe=Nr(_e);c&&Me==null&&Pe!=null&&Je(O,Pe)&&vM(Pe),queueMicrotask(()=>{const pe=k(),Ae=S.context.triggerElements,Ee=xe(),je=(Me==null?void 0:Me.hasAttribute(Ip("focus-guard")))&&[K.current,W.current,$==null?void 0:$.beforeInsideRef.current,$==null?void 0:$.afterInsideRef.current,$==null?void 0:$.beforeOutsideRef.current,$==null?void 0:$.afterOutsideRef.current,Bi(p),Bi(h)].includes(Me),Oe=!(Je(C,Me)||Je(O,Me)||Je(Me,O)||Je($==null?void 0:$.portalNode,Me)||Ee.some(ve=>ve===Me||Je(ve,Me))||Ae.hasMatchingElement(ve=>Je(ve,Me))||je||z&&(qa(z.nodesRef.current,pe).find(ve=>{var Fe,Ye;return Je((Fe=ve.context)==null?void 0:Fe.elements.floating,Me)||Je((Ye=ve.context)==null?void 0:Ye.elements.domReference,Me)})||hM(z.nodesRef.current,pe).find(ve=>{var Fe,Ye,xt;return[(Fe=ve.context)==null?void 0:Fe.elements.floating,vE((Ye=ve.context)==null?void 0:Ye.elements.floating)].includes(Me)||((xt=ve.context)==null?void 0:xt.elements.domReference)===Me})));if(Le===C&&Y&&wM(Y),l&&Le!==C&&!Zx(Pe)&&es(oe)===oe.body){if(Yt(Y)&&(Y.focus(),l==="popup")){te.request(()=>{Y.focus()});return}const ve=le(),Fe=V.current,Ye=(Fe&&ve.includes(Fe)?Fe:null)||ve[ve.length-1]||Y;Yt(Ye)&&Ye.focus()}if(R.current.insideReactTree){R.current.insideReactTree=!1;return}(A||!c)&&Me&&Oe&&!H.current&&(A||Me!==SM())&&(j.current=!0,S.setOpen(!1,ct(ou,_e)))})}function ke(){B.current||(R.current.insideReactTree=!0,F.start(0,()=>{R.current.insideReactTree=!1}))}const be=Yt(C)?C:null;if(!(!O&&!be))return ai(be&&bt(be,"focusout",Se),be&&bt(be,"pointerdown",re),O&&bt(O,"focusin",he),O&&bt(O,"focusout",Se),O&&$&&bt(O,"focusout",ke,!0))},[r,C,O,Y,c,z,$,S,u,l,le,A,k,R,F,X,te,h,p,xe]),N.useEffect(()=>{var Le,Pe,pe;if(r||!O||!E)return;const oe=Array.from(((Le=$==null?void 0:$.portalNode)==null?void 0:Le.querySelectorAll(`[${Ip("portal")}]`))||[]),he=(pe=(Pe=(z?hM(z.nodesRef.current,k()):[]).find(Ae=>{var Ee;return bE(((Ee=Ae.context)==null?void 0:Ee.elements.domReference)||null)}))==null?void 0:Pe.context)==null?void 0:pe.elements.domReference,ke=[...[O,...oe,K.current,W.current,$==null?void 0:$.beforeOutsideRef.current,$==null?void 0:$.afterOutsideRef.current,...xe()],he,Bi(p),Bi(h),A?C:null].filter(Ae=>Ae!=null),be=xM(ke,{ariaHidden:c||A,mark:!1}),_e=[O,...oe].filter(Ae=>Ae!=null),Me=xM(_e);return()=>{Me(),be()}},[E,r,C,O,c,$,A,z,k,h,p,xe]),Be(()=>{if(!E||r||!Yt(Y))return;G.current="",q.current="";const oe=jt(Y),re=es(oe);queueMicrotask(()=>{const he=I.current,Se=typeof he=="function"?he(D.current||""):he;if(Se===void 0||Se===!1||Je(Y,re))return;let be=null;const _e=()=>(be==null&&(be=le(Y)),be[0]||Y);let Me;Se===!0||Se===null?Me=_e():Me=Bi(Se),Me=Me||_e();const Le=Je(Y,es(oe));by(Me,{preventScroll:Me===Y,shouldFocus(){if(!P.current)return!1;if(Le)return!0;const Pe=es(oe);return!(Pe!==Me&&Je(Y,Pe))}})})},[r,E,Y,le,I,D,P]),Be(()=>{if(r||!Y)return;const oe=jt(Y),re=es(oe),he=D.current==null;vM(re);function Se(be){if(be.open||(G.current=pZ(be.nativeEvent,q.current)),be.reason===wn&&be.nativeEvent.type==="mouseleave"&&(j.current=!0),be.reason===P2)if(be.nested)j.current=!1;else if(q2(be.nativeEvent)||G2(be.nativeEvent))j.current=!1;else{let _e=!1;jt(Y).createElement("div").focus({get preventScroll(){return _e=!0,!1}}),_e?j.current=!1:j.current=!0}}T.on("openchange",Se);function ke(be){const _e=L.current;let Me=typeof _e=="function"?_e(be):_e;if(Me===void 0||Me===!1)return null;Me===null&&(Me=!0);const Le=C!=null&&C.isConnected?C:null,Pe=re!=null&&re.isConnected&&Or(re)!=="body"?re:null;let pe=he?Pe||Le:Le||Pe;return pe||(pe=SM()||null),typeof Me=="boolean"?pe:Bi(Me)||pe||null}return()=>{T.off("openchange",Se);const be=es(oe),_e=xe(),Me=Je(O,be)||_e.some(Ae=>Ae===be||Je(Ae,be))||z&&qa(z.nodesRef.current,k(),!1).some(Ae=>{var Ee;return Je((Ee=Ae.context)==null?void 0:Ee.elements.floating,be)}),Le=L.current,Pe=G.current,pe=ke(Pe);queueMicrotask(()=>{const Ae=mZ(pe),Ee=typeof Le!="boolean";if(Le&&!j.current&&Yt(Ae)&&(!(!Ee&&Ae!==be&&be!==oe.body)||Me)){const je={preventScroll:!0};Pe==="keyboard"&&(je.focusVisible=!0),Ae.focus(je)}j.current=!1})}},[r,O,Y,L,D,T,z,C,k,xe]),Be(()=>{if(!Ka||E||!O)return;const oe=es(jt(O));!Yt(oe)||!Qx(oe)||Je(O,oe)&&oe.blur()},[E,O]),Be(()=>{if(!(r||!$))return $.setFocusManagerState({modal:c,closeOnFocusOut:u,open:E,onOpenChange:S.setOpen,domReference:C}),()=>{$.setFocusManagerState(null)}},[r,$,c,E,S,u,C]),Be(()=>{if(!(r||!Y))return wM(Y),()=>{queueMicrotask(nT)}},[r,Y]);const fe=!r&&(c?!A:!0)&&(Z||c);return m.jsxs(N.Fragment,{children:[fe&&m.jsx(Ua,{"data-type":"inside",ref:ee,onFocus:oe=>{var re;if(c){const he=le();by(he[he.length-1])}else if($!=null&&$.portalNode)if(j.current=!1,Bd(oe,$.portalNode)){const he=Z2(C);he==null||he.focus()}else(re=Bi(p??$.beforeOutsideRef))==null||re.focus()}}),n,fe&&m.jsx(Ua,{"data-type":"inside",ref:ce,onFocus:oe=>{var re;if(c)by(le()[0]);else if($!=null&&$.portalNode)if(u&&(j.current=!0),Bd(oe,$.portalNode)){const he=z5(C);he==null||he.focus()}else(re=Bi(h??$.afterOutsideRef))==null||re.focus()}})]})}function nb(e,t={}){const{enabled:n=!0,event:r="click",toggle:s=!0,ignoreMouse:o=!1,stickIfOpen:l=!0,touchOpenDelay:c=0,reason:u=di}=t,f="rootStore"in e?e.rootStore:e,h=f.context.dataRef,p=N.useRef(void 0),y=_p(),x=ns(),b=N.useMemo(()=>{function S(C,O,T,R){const k=ct(u,O,T);C&&R==="touch"&&c>0?x.start(c,()=>{f.setOpen(!0,k)}):f.setOpen(C,k)}function E(C,O,T){const R=h.current.openEvent,k=f.select("domReferenceElement")!==O;return C&&k||!C||!s?!0:R&&l?!T(R.type):!1}return{onPointerDown(C){p.current=Ra(C.pointerType,!0)&&G2(C.nativeEvent)?"virtual":C.pointerType},onMouseDown(C){const O=p.current,T=C.nativeEvent,R=f.select("open");if(C.button!==0||r==="click"||Ra(O,!0)&&o)return;const k=E(R,C.currentTarget,I=>I==="click"||I==="mousedown"),M=Nr(T);if(Qx(M)){S(k,T,M,O);return}const A=C.currentTarget;y.request(()=>{S(k,T,A,O)})},onClick(C){if(r==="mousedown-only")return;const O=p.current;if(r==="mousedown"&&O){p.current=void 0;return}if(Ra(O,!0)&&o)return;const T=f.select("open"),R=E(T,C.currentTarget,k=>k==="click"||k==="mousedown"||k==="keydown"||k==="keyup");S(R,C.nativeEvent,C.currentTarget,O)},onKeyDown(){p.current=void 0}}},[h,r,o,u,f,l,s,y,x,c]);return N.useMemo(()=>n?{reference:b}:hn,[n,b])}function gZ(e,t){let n=null,r=null,s=!1;return{contextElement:e||void 0,getBoundingClientRect(){var x;const o=(e==null?void 0:e.getBoundingClientRect())||{width:0,height:0,x:0,y:0},l=t.axis==="x"||t.axis==="both",c=t.axis==="y"||t.axis==="both",u=["mouseenter","mousemove"].includes(((x=t.dataRef.current.openEvent)==null?void 0:x.type)||"")&&t.pointerType!=="touch";let f=o.width,h=o.height,p=o.x,y=o.y;return n==null&&t.x&&l&&(n=o.x-t.x),r==null&&t.y&&c&&(r=o.y-t.y),p-=n||0,y-=r||0,f=0,h=0,!s||u?(f=t.axis==="y"?o.width:0,h=t.axis==="x"?o.height:0,p=l&&t.x!=null?t.x:p,y=c&&t.y!=null?t.y:y):s&&!u&&(h=t.axis==="x"?o.height:h,f=t.axis==="y"?o.width:f),s=!0,{width:f,height:h,x:p,y,top:y,right:p+f,bottom:y+h,left:p}}}}function EM(e){return e!=null&&e.clientX!=null}function yZ(e,t={}){const{enabled:n=!0,axis:r="both"}=t,s="rootStore"in e?e.rootStore:e,o=s.useState("open"),l=s.useState("floatingElement"),c=s.useState("domReferenceElement"),u=s.context.dataRef,f=N.useRef(!1),h=N.useRef(null),[p,y]=N.useState(),[x,b]=N.useState([]),S=Ve(R=>{s.set("positionReference",R)}),E=Ve((R,k,M)=>{f.current||u.current.openEvent&&!EM(u.current.openEvent)||s.set("positionReference",gZ(M??c,{x:R,y:k,axis:r,dataRef:u,pointerType:p}))}),C=Ve(R=>{o?h.current||(E(R.clientX,R.clientY,R.currentTarget),b([])):E(R.clientX,R.clientY,R.currentTarget)}),O=Ra(p)?l:o;N.useEffect(()=>{if(!n){S(c);return}if(!O)return;function R(){var A;(A=h.current)==null||A.call(h),h.current=null}const k=pn(l);function M(A){const I=Nr(A);Je(l,I)?R():E(A.clientX,A.clientY)}return!u.current.openEvent||EM(u.current.openEvent)?h.current=bt(k,"mousemove",M):S(c),R},[O,n,l,u,c,s,E,S,x]),N.useEffect(()=>()=>{s.set("positionReference",null)},[s]),N.useEffect(()=>{n&&!l&&(f.current=!1)},[n,l]),N.useEffect(()=>{!n&&o&&(f.current=!0)},[n,o]);const T=N.useMemo(()=>{function R(k){y(k.pointerType)}return{onPointerDown:R,onPointerEnter:R,onMouseMove:C,onMouseEnter:C}},[C]);return N.useMemo(()=>n?{reference:T,trigger:T}:{},[n,T])}function xZ(){return!1}function bZ(e){return{escapeKey:typeof e=="boolean"?e:(e==null?void 0:e.escapeKey)??!1,outsidePress:typeof e=="boolean"?e:(e==null?void 0:e.outsidePress)??!0}}function bm(e,t={}){const{enabled:n=!0,escapeKey:r=!0,outsidePress:s=!0,outsidePressEvent:o="sloppy",referencePress:l=xZ,bubbles:c,externalTree:u}=t,f="rootStore"in e?e.rootStore:e,h=f.useState("open"),p=f.useState("floatingElement"),{dataRef:y,events:x}=f.context,b=pl(u),S=Ve(typeof s=="function"?s:()=>!1),E=typeof s=="function"?S:s,C=E!==!1,O=Ve(()=>o),{escapeKey:T,outsidePress:R}=bZ(c),k=N.useRef(!1),M=N.useRef(!1),A=N.useRef(!1),I=N.useRef(!1),L=N.useRef(!1),D=N.useRef(""),P=N.useRef(null),z=ns(),$=ns(),j=Ve(()=>{$.clear(),y.current.insideReactTree=!1}),H=Ve(F=>{var Z;const X=(Z=y.current.floatingContext)==null?void 0:Z.nodeId;return(b?qa(b.nodesRef.current,X):[]).some(Y=>{var le;return((le=Y.context)==null?void 0:le.open)&&!Y.context.dataRef.current[F]})}),B=Ve(F=>P1(F,f.select("floatingElement"))||P1(F,f.select("domReferenceElement"))),V=Ve(F=>{l()&&f.setOpen(!1,ct(di,F.nativeEvent))}),G=Ve(F=>{if(!h||!n||!r||F.key!=="Escape"||L.current||!T&&H("__escapeKeyBubbles"))return;const X=_Q(F)?F.nativeEvent:F,te=ct(mm,X);f.setOpen(!1,te),te.isCanceled||F.preventDefault(),!T&&!te.isPropagationAllowed&&F.stopPropagation()}),q=Ve(()=>{y.current.insideReactTree=!0,$.start(0,j)}),K=Ve(F=>{if(!h||!n||F.button!==0)return;const X=Nr(F.nativeEvent);Je(f.select("floatingElement"),X)&&(k.current||(k.current=!0,M.current=!1))}),W=Ve(F=>{!h||!n||(F.defaultPrevented||F.nativeEvent.defaultPrevented)&&k.current&&(M.current=!0)});N.useEffect(()=>{function F(X){X.open||(I.current=!1)}return x.on("openchange",F),()=>{x.off("openchange",F)}},[x]),N.useEffect(()=>{if(!h||!n)return h||(I.current=!1),j;y.current.__escapeKeyBubbles=T,y.current.__outsidePressBubbles=R;const F=new co,X=new co,te=jt(p);function Z(){F.clear(),L.current=!0}function Y(){F.start(Ka?5:0,()=>{L.current=!1})}function le(){A.current=!0,X.start(0,()=>{A.current=!1})}function xe(){k.current=!1,M.current=!1}function fe(){const Oe=D.current,ve=Oe==="pen"||!Oe?"mouse":Oe,Fe=O(),Ye=typeof Fe=="function"?Fe():Fe;return typeof Ye=="string"?Ye:Ye[ve]}function oe(Oe){const ve=fe();return ve==="intentional"&&Oe.type!=="click"||ve==="sloppy"&&Oe.type==="click"}function re(Oe){var Ye;const ve=(Ye=y.current.floatingContext)==null?void 0:Ye.nodeId,Fe=b&&qa(b.nodesRef.current,ve).some(xt=>{var nn;return P1(Oe,(nn=xt.context)==null?void 0:nn.elements.floating)});return B(Oe)||Fe}function he(Oe){if(oe(Oe)){Oe.type!=="click"&&!B(Oe)&&(X.clear(),A.current=!1),j();return}if(y.current.insideReactTree){j();return}const ve=Nr(Oe),Fe=`[${Ip("inert")}]`,Ye=St(ve)?ve.getRootNode():null,xt=Array.from((af(Ye)?Ye:jt(f.select("floatingElement"))).querySelectorAll(Fe)),nn=f.context.triggerElements;if(ve&&(nn.hasElement(ve)||nn.hasMatchingElement(De=>Je(De,ve))))return;let Te=St(ve)?ve:null;for(;Te&&!Ji(Te);){const De=al(Te);if(Ji(De)||!St(De))break;Te=De}if(!(xt.length&&St(ve)&&!IQ(ve)&&!Je(ve,f.select("floatingElement"))&&xt.every(De=>!Je(Te,De)))){if(Yt(ve)&&!("touches"in Oe)){const De=Ji(ve),tt=$s(ve),At=/auto|scroll/,gn=De||At.test(tt.overflowX),yn=De||At.test(tt.overflowY),Fr=gn&&ve.clientWidth>0&&ve.scrollWidth>ve.clientWidth,cn=yn&&ve.clientHeight>0&&ve.scrollHeight>ve.clientHeight,cr=tt.direction==="rtl",$r=cn&&(cr?Oe.offsetX<=ve.offsetWidth-ve.clientWidth:Oe.offsetX>ve.clientWidth),Es=Fr&&Oe.offsetY>ve.clientHeight;if($r||Es)return}if(!re(Oe)){if(fe()==="intentional"){if(Oe.detail!==0&&!q2(Oe)&&!I.current)return;if(A.current){X.clear(),A.current=!1;return}}typeof E=="function"&&!E(Oe)||H("__outsidePressBubbles")||(f.setOpen(!1,ct(P2,Oe)),j())}}}function Se(Oe){fe()!=="sloppy"||Oe.pointerType==="touch"||!f.select("open")||!n||B(Oe)||he(Oe)}function ke(Oe){if(fe()!=="sloppy"||!f.select("open")||!n||B(Oe))return;const ve=Oe.touches[0];ve&&(P.current={startTime:Date.now(),startX:ve.clientX,startY:ve.clientY,dismissOnTouchEnd:!1,dismissOnMouseDown:!0},z.start(1e3,()=>{P.current&&(P.current.dismissOnTouchEnd=!1,P.current.dismissOnMouseDown=!1)}))}function be(Oe,ve){const Fe=Nr(Oe);if(!Fe)return;const Ye=bt(Fe,Oe.type,()=>{ve(Oe),Ye()})}function _e(Oe){D.current="touch",be(Oe,ke)}function Me(Oe){z.clear(),Oe.type==="pointerdown"&&(Oe.button===0&&(I.current=!0),D.current=Oe.pointerType),!(Oe.type==="mousedown"&&P.current&&!P.current.dismissOnMouseDown)&&be(Oe,ve=>{ve.type==="pointerdown"?Se(ve):he(ve)})}function Le(Oe){if(Oe.type==="pointercancel"&&(I.current=!1),!k.current)return;const ve=M.current;if(xe(),fe()==="intentional"){if(Oe.type==="pointercancel"){ve&&le();return}if(!re(Oe)){if(ve){le();return}typeof E=="function"&&!E(Oe)||(X.clear(),A.current=!0,j())}}}function Pe(Oe){if(fe()!=="sloppy"||!P.current||B(Oe))return;const ve=Oe.touches[0];if(!ve)return;const Fe=Math.abs(ve.clientX-P.current.startX),Ye=Math.abs(ve.clientY-P.current.startY),xt=Math.sqrt(Fe*Fe+Ye*Ye);xt>5&&(P.current.dismissOnTouchEnd=!0),xt>10&&(he(Oe),z.clear(),P.current=null)}function pe(Oe){be(Oe,Pe)}function Ae(Oe){fe()!=="sloppy"||!P.current||B(Oe)||(P.current.dismissOnTouchEnd&&he(Oe),z.clear(),P.current=null)}function Ee(Oe){be(Oe,Ae)}const je=ai(r&&ai(bt(te,"keydown",G),bt(te,"compositionstart",Z),bt(te,"compositionend",Y)),C&&ai(bt(te,"click",Me,!0),bt(te,"pointerdown",Me,!0),bt(te,"pointerup",Le,!0),bt(te,"pointercancel",Le,!0),bt(te,"mousedown",Me,!0),bt(te,"mouseup",Le,!0),bt(te,"touchstart",_e,{capture:!0,passive:!0}),bt(te,"touchmove",pe,{capture:!0,passive:!0}),bt(te,"touchend",Ee,{capture:!0,passive:!0})));return()=>{je(),F.clear(),X.clear(),xe(),A.current=!1,j()}},[y,p,r,C,E,h,n,T,R,G,j,O,H,B,b,f,z]);const ee=N.useMemo(()=>({onKeyDown:G,onPointerDown:V,onClick:V}),[G,V]),ce=N.useMemo(()=>({onKeyDown:G,onPointerDown:W,onMouseDown:W,onClickCapture:q,onMouseDownCapture(F){q(),K(F)},onPointerDownCapture(F){q(),K(F)},onMouseUpCapture:q,onTouchEndCapture:q,onTouchMoveCapture:q}),[G,q,K,W]);return N.useMemo(()=>n?{reference:ee,floating:ce,trigger:ee}:{},[n,ee,ce])}function CM(e,t,n){let{reference:r,floating:s}=e;const o=so(t),l=X2(t),c=W2(l),u=oo(t),f=o==="y",h=r.x+r.width/2-s.width/2,p=r.y+r.height/2-s.height/2,y=r[c]/2-s[c]/2;let x;switch(u){case"top":x={x:h,y:r.y-s.height};break;case"bottom":x={x:h,y:r.y+r.height};break;case"right":x={x:r.x+r.width,y:p};break;case"left":x={x:r.x-s.width,y:p};break;default:x={x:r.x,y:r.y}}const b=cl(t);return b&&(x[l]+=y*(b==="end"?1:-1)*(n&&f?-1:1)),x}async function vZ(e,t){var n;t===void 0&&(t={});const{x:r,y:s,platform:o,rects:l,elements:c,strategy:u}=e,{boundary:f="clippingAncestors",rootBoundary:h="viewport",elementContext:p="floating",altBoundary:y=!1,padding:x=0}=Va(t,e),b=A5(x),E=c[y?p==="floating"?"reference":"floating":p],C=Uy(await o.getClippingRect({element:(n=await(o.isElement==null?void 0:o.isElement(E)))==null||n?E:E.contextElement||await(o.getDocumentElement==null?void 0:o.getDocumentElement(c.floating)),boundary:f,rootBoundary:h,strategy:u})),O=p==="floating"?{x:r,y:s,width:l.floating.width,height:l.floating.height}:l.reference,T=await(o.getOffsetParent==null?void 0:o.getOffsetParent(c.floating)),R=await(o.isElement==null?void 0:o.isElement(T))&&await(o.getScale==null?void 0:o.getScale(T))||{x:1,y:1},k=Uy(o.convertOffsetParentRelativeRectToViewportRelativeRect?await o.convertOffsetParentRelativeRectToViewportRelativeRect({elements:c,rect:O,offsetParent:T,strategy:u}):O);return{top:(C.top-k.top+b.top)/R.y,bottom:(k.bottom-C.bottom+b.bottom)/R.y,left:(C.left-k.left+b.left)/R.x,right:(k.right-C.right+b.right)/R.x}}const SZ=50,wZ=async(e,t,n)=>{const{placement:r="bottom",strategy:s="absolute",middleware:o=[],platform:l}=n,c=l.detectOverflow?l:{...l,detectOverflow:vZ},u=await(l.isRTL==null?void 0:l.isRTL(t));let f=await l.getElementRects({reference:e,floating:t,strategy:s}),{x:h,y:p}=CM(f,r,u),y=r,x=0;const b={};for(let S=0;S<o.length;S++){const E=o[S];if(!E)continue;const{name:C,fn:O}=E,{x:T,y:R,data:k,reset:M}=await O({x:h,y:p,initialPlacement:r,placement:y,strategy:s,middlewareData:b,rects:f,platform:c,elements:{reference:e,floating:t}});h=T??h,p=R??p,b[C]={...b[C],...k},M&&x<SZ&&(x++,typeof M=="object"&&(M.placement&&(y=M.placement),M.rects&&(f=M.rects===!0?await l.getElementRects({reference:e,floating:t,strategy:s}):M.rects),{x:h,y:p}=CM(f,y,u)),S=-1)}return{x:h,y:p,placement:y,strategy:s,middlewareData:b}},EZ=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:s,middlewareData:o,rects:l,initialPlacement:c,platform:u,elements:f}=t,{mainAxis:h=!0,crossAxis:p=!0,fallbackPlacements:y,fallbackStrategy:x="bestFit",fallbackAxisSideDirection:b="none",flipAlignment:S=!0,...E}=Va(e,t);if((n=o.arrow)!=null&&n.alignmentOffset)return{};const C=oo(s),O=so(c),T=oo(c)===c,R=await(u.isRTL==null?void 0:u.isRTL(f.floating)),k=y||(T||!S?[$y(c)]:GQ(c)),M=b!=="none";!y&&M&&k.push(...XQ(c,S,b,R));const A=[c,...k],I=await u.detectOverflow(t,E),L=[];let D=((r=o.flip)==null?void 0:r.overflows)||[];if(h&&L.push(I[C]),p){const j=qQ(s,l,R);L.push(I[j[0]],I[j[1]])}if(D=[...D,{placement:s,overflows:L}],!L.every(j=>j<=0)){var P,z;const j=(((P=o.flip)==null?void 0:P.index)||0)+1,H=A[j];if(H&&(!(p==="alignment"?O!==so(H):!1)||D.every(G=>so(G.placement)===O?G.overflows[0]>0:!0)))return{data:{index:j,overflows:D},reset:{placement:H}};let B=(z=D.filter(V=>V.overflows[0]<=0).sort((V,G)=>V.overflows[1]-G.overflows[1])[0])==null?void 0:z.placement;if(!B)switch(x){case"bestFit":{var $;const V=($=D.filter(G=>{if(M){const q=so(G.placement);return q===O||q==="y"}return!0}).map(G=>[G.placement,G.overflows.filter(q=>q>0).reduce((q,K)=>q+K,0)]).sort((G,q)=>G[1]-q[1])[0])==null?void 0:$[0];V&&(B=V);break}case"initialPlacement":B=c;break}if(s!==B)return{reset:{placement:B}}}return{}}}},Y5=new Set(["left","top"]);async function CZ(e,t){const{placement:n,platform:r,elements:s}=e,o=await(r.isRTL==null?void 0:r.isRTL(s.floating)),l=oo(n),c=cl(n),u=so(n)==="y",f=Y5.has(l)?-1:1,h=o&&u?-1:1,p=Va(t,e);let{mainAxis:y,crossAxis:x,alignmentAxis:b}=typeof p=="number"?{mainAxis:p,crossAxis:0,alignmentAxis:null}:{mainAxis:p.mainAxis||0,crossAxis:p.crossAxis||0,alignmentAxis:p.alignmentAxis};return c&&typeof b=="number"&&(x=c==="end"?b*-1:b),u?{x:x*h,y:y*f}:{x:y*f,y:x*h}}const TZ=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:s,y:o,placement:l,middlewareData:c}=t,u=await CZ(t,e);return l===((n=c.offset)==null?void 0:n.placement)&&(r=c.arrow)!=null&&r.alignmentOffset?{}:{x:s+u.x,y:o+u.y,data:{...u,placement:l}}}}},NZ=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:s,platform:o}=t,{mainAxis:l=!0,crossAxis:c=!1,limiter:u={fn:O=>{let{x:T,y:R}=O;return{x:T,y:R}}},...f}=Va(e,t),h={x:n,y:r},p=await o.detectOverflow(t,f),y=so(s),x=Y2(y);let b=h[x],S=h[y];const E=(O,T)=>R5(T+p[O==="y"?"top":"left"],T,T-p[O==="y"?"bottom":"right"]);l&&(b=E(x,b)),c&&(S=E(y,S));const C=u.fn({...t,[x]:b,[y]:S});return{...C,data:{x:C.x-n,y:C.y-r,enabled:{[x]:l,[y]:c}}}}}},OZ=function(e){return e===void 0&&(e={}),{options:e,fn(t){var n,r;const{x:s,y:o,placement:l,rects:c,middlewareData:u}=t,{offset:f=0,mainAxis:h=!0,crossAxis:p=!0}=Va(e,t),y={x:s,y:o},x=so(l),b=Y2(x);let S=y[b],E=y[x];const C=Va(f,t),O=typeof C=="number"?{mainAxis:C,crossAxis:0}:{mainAxis:(n=C.mainAxis)!=null?n:0,crossAxis:(r=C.crossAxis)!=null?r:0};if(h){const k=b==="y"?"height":"width",M=c.reference[b]-c.floating[k]+O.mainAxis,A=c.reference[b]+c.reference[k]-O.mainAxis;S<M?S=M:S>A&&(S=A)}if(p){var T,R;const k=b==="y"?"width":"height",M=Y5.has(oo(l)),A=c.reference[x]-c.floating[k]+(M&&((T=u.offset)==null?void 0:T[x])||0)+(M?0:O.crossAxis),I=c.reference[x]+c.reference[k]+(M?0:((R=u.offset)==null?void 0:R[x])||0)-(M?O.crossAxis:0);E<A?E=A:E>I&&(E=I)}return{[b]:S,[x]:E}}}},RZ=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){const{placement:n,rects:r,platform:s,elements:o}=t,{apply:l=()=>{},...c}=Va(e,t),u=await s.detectOverflow(t,c),f=oo(n),h=cl(n),p=so(n)==="y",{width:y,height:x}=r.floating;let b,S;f==="top"||f==="bottom"?(b=f,S=h===(await(s.isRTL==null?void 0:s.isRTL(o.floating))?"start":"end")?"left":"right"):(S=f,b=h==="end"?"top":"bottom");const E=x-u.top-u.bottom,C=y-u.left-u.right,O=uf(x-u[b],E),T=uf(y-u[S],C),R=t.middlewareData.shift,k=!R;let M=O,A=T;R!=null&&R.enabled.x&&(A=C),R!=null&&R.enabled.y&&(M=E),k&&!h&&(p?A=y-2*tl(u.left,u.right):M=x-2*tl(u.top,u.bottom)),await l({...t,availableWidth:A,availableHeight:M});const I=await s.getDimensions(o.floating);return y!==I.width||x!==I.height?{reset:{rects:!0}}:{}}}};function W5(e){const t=$s(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const s=Yt(e),o=s?e.offsetWidth:n,l=s?e.offsetHeight:r,c=Fy(n)!==o||Fy(r)!==l;return c&&(n=o,r=l),{width:n,height:r,$:c}}function sT(e){return St(e)?e:e.contextElement}function Hd(e){const t=sT(e);if(!Yt(t))return nl(1);const n=t.getBoundingClientRect(),{width:r,height:s,$:o}=W5(t);let l=(o?Fy(n.width):n.width)/r,c=(o?Fy(n.height):n.height)/s;return(!l||!Number.isFinite(l))&&(l=1),(!c||!Number.isFinite(c))&&(c=1),{x:l,y:c}}const AZ=nl(0);function X5(e){const t=pn(e);return!w2()||!t.visualViewport?AZ:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function kZ(e,t,n){return t===void 0&&(t=!1),!!n&&t&&n===pn(e)}function lu(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const s=e.getBoundingClientRect(),o=sT(e);let l=nl(1);t&&(r?St(r)&&(l=Hd(r)):l=Hd(e));const c=kZ(o,n,r)?X5(o):nl(0);let u=(s.left+c.x)/l.x,f=(s.top+c.y)/l.y,h=s.width/l.x,p=s.height/l.y;if(o&&r){const y=pn(o),x=St(r)?pn(r):r;let b=y,S=oE(b);for(;S&&x!==b;){const E=Hd(S),C=S.getBoundingClientRect(),O=$s(S),T=C.left+(S.clientLeft+parseFloat(O.paddingLeft))*E.x,R=C.top+(S.clientTop+parseFloat(O.paddingTop))*E.y;u*=E.x,f*=E.y,h*=E.x,p*=E.y,u+=T,f+=R,b=pn(S),S=oE(b)}}return Uy({width:h,height:p,x:u,y:f})}function rb(e,t){const n=Hx(e).scrollLeft;return t?t.left+n:lu(fl(e)).left+n}function Q5(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-rb(e,n),s=n.top+t.scrollTop;return{x:r,y:s}}function _Z(e){let{elements:t,rect:n,offsetParent:r,strategy:s}=e;const o=s==="fixed",l=fl(r),c=t?Bx(t.floating):!1;if(r===l||c&&o)return n;let u={scrollLeft:0,scrollTop:0},f=nl(1);const h=nl(0),p=Yt(r);if((p||!o)&&((Or(r)!=="body"||um(l))&&(u=Hx(r)),p)){const x=lu(r);f=Hd(r),h.x=x.x+r.clientLeft,h.y=x.y+r.clientTop}const y=l&&!p&&!o?Q5(l,u):nl(0);return{width:n.width*f.x,height:n.height*f.y,x:n.x*f.x-u.scrollLeft*f.x+h.x+y.x,y:n.y*f.y-u.scrollTop*f.y+h.y+y.y}}function MZ(e){return e.getClientRects?Array.from(e.getClientRects()):[]}function IZ(e){const t=Hx(e),n=e.ownerDocument.body,r=tl(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),s=tl(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight);let o=-t.scrollLeft+rb(e);const l=-t.scrollTop;return $s(n).direction==="rtl"&&(o+=tl(e.clientWidth,n.clientWidth)-r),{width:r,height:s,x:o,y:l}}const LZ=25;function DZ(e,t,n){n===void 0&&(n="viewport");const r=n==="layoutViewport",s=pn(e),o=fl(e),l=s.visualViewport;let c=o.clientWidth,u=o.clientHeight,f=0,h=0;if(l){const y=!w2()||t==="fixed";r?y||(f=-l.offsetLeft,h=-l.offsetTop):(c=l.width,u=l.height,y&&(f=l.offsetLeft,h=l.offsetTop))}if(rb(o)<=0){const y=o.ownerDocument,x=y.body,b=getComputedStyle(x),S=y.compatMode==="CSS1Compat"&&parseFloat(b.marginLeft)+parseFloat(b.marginRight)||0,E=Math.abs(o.clientWidth-x.clientWidth-S),C=getComputedStyle(o).scrollbarGutter==="stable both-edges"?E/2:E;C<=LZ&&(c-=C)}return{width:c,height:u,x:f,y:h}}function jZ(e,t){const n=lu(e,!0,t==="fixed"),r=n.top+e.clientTop,s=n.left+e.clientLeft,o=Hd(e),l=e.clientWidth*o.x,c=e.clientHeight*o.y,u=s*o.x,f=r*o.y;return{width:l,height:c,x:u,y:f}}function TM(e,t,n){let r;if(t==="viewport"||t==="layoutViewport")r=DZ(e,n,t);else if(t==="document")r=IZ(fl(e));else if(St(t))r=jZ(t,n);else{const s=X5(e);r={x:t.x-s.x,y:t.y-s.y,width:t.width,height:t.height}}return Uy(r)}function PZ(e,t){const n=t.get(e);if(n)return n;let r=Cp(e,[],!1).filter(c=>St(c)&&Or(c)!=="body"),s=null;const o=$s(e).position==="fixed";let l=o?al(e):e;for(;St(l)&&!Ji(l);){const c=$s(l),u=S2(l),f=s?s.position:o?"fixed":"";!u&&(f==="fixed"||f==="absolute"&&c.position==="static")?r=r.filter(p=>p!==l):s=c,l=al(l)}return t.set(e,r),r}function zZ(e){let{element:t,boundary:n,rootBoundary:r,strategy:s}=e;const l=[...n==="clippingAncestors"?Bx(t)?[]:PZ(t,this._c):[].concat(n),r],c=TM(t,l[0],s);let u=c.top,f=c.right,h=c.bottom,p=c.left;for(let y=1;y<l.length;y++){const x=TM(t,l[y],s);u=tl(x.top,u),f=uf(x.right,f),h=uf(x.bottom,h),p=tl(x.left,p)}return{width:f-p,height:h-u,x:p,y:u}}function BZ(e){const{width:t,height:n}=W5(e);return{width:t,height:n}}function HZ(e,t,n){const r=Yt(t),s=fl(t),o=n==="fixed",l=lu(e,!0,o,t);let c={scrollLeft:0,scrollTop:0};const u=nl(0);if((r||!o)&&((Or(t)!=="body"||um(s))&&(c=Hx(t)),r)){const y=lu(t,!0,o,t);u.x=y.x+t.clientLeft,u.y=y.y+t.clientTop}!r&&s&&(u.x=rb(s));const f=s&&!r&&!o?Q5(s,c):nl(0),h=l.left+c.scrollLeft-u.x-f.x,p=l.top+c.scrollTop-u.y-f.y;return{x:h,y:p,width:l.width,height:l.height}}function F1(e){return $s(e).position==="static"}function NM(e,t){if(!Yt(e)||$s(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return fl(e)===n&&(n=n.ownerDocument.body),n}function Z5(e,t){const n=pn(e);if(Bx(e))return n;if(!Yt(e)){let s=al(e);for(;s&&!Ji(s);){if(St(s)&&!F1(s))return s;s=al(s)}return n}let r=NM(e,t);for(;r&&RK(r)&&F1(r);)r=NM(r,t);return r&&Ji(r)&&F1(r)&&!S2(r)?n:r||_K(e)||n}const FZ=async function(e){const t=this.getOffsetParent||Z5,n=this.getDimensions,r=await n(e.floating);return{reference:HZ(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function $Z(e){return $s(e).direction==="rtl"}const UZ={convertOffsetParentRelativeRectToViewportRelativeRect:_Z,getDocumentElement:fl,getClippingRect:zZ,getOffsetParent:Z5,getElementRects:FZ,getClientRects:MZ,getDimensions:BZ,getScale:Hd,isElement:St,isRTL:$Z};function J5(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function VZ(e,t,n){let r=null,s;const o=fl(e);function l(){var h;clearTimeout(s),(h=r)==null||h.disconnect(),r=null}function c(h,p){h===void 0&&(h=!1),p===void 0&&(p=1),l();const y=e.getBoundingClientRect(),{left:x,top:b,width:S,height:E}=y;if(h||t(),!S||!E)return;const C=R0(b),O=R0(o.clientWidth-(x+S)),T=R0(o.clientHeight-(b+E)),R=R0(x),M={rootMargin:-C+"px "+-O+"px "+-T+"px "+-R+"px",threshold:tl(0,uf(1,p))||1};let A=!0;function I(L){const D=L[0].intersectionRatio;if(!J5(y,e.getBoundingClientRect()))return c();if(D!==p){if(!A)return c();D?c(!1,D):s=setTimeout(()=>{c(!1,1e-7)},1e3)}A=!1}try{r=new IntersectionObserver(I,{...M,root:o.ownerDocument})}catch{r=new IntersectionObserver(I,M)}r.observe(e)}const u=pn(e),f=()=>c(n);return u.addEventListener("resize",f),c(!0),()=>{u.removeEventListener("resize",f),l()}}function OM(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:s=!0,ancestorResize:o=!0,elementResize:l=typeof ResizeObserver=="function",layoutShift:c=typeof IntersectionObserver=="function",animationFrame:u=!1}=r,f=sT(e),h=s||o?[...f?Cp(f):[],...t?Cp(t):[]]:[];h.forEach(C=>{s&&C.addEventListener("scroll",n),o&&C.addEventListener("resize",n)});const p=f&&c?VZ(f,n,o):null;let y=-1,x=null;l&&(x=new ResizeObserver(C=>{let[O]=C;O&&O.target===f&&x&&t&&(x.unobserve(t),cancelAnimationFrame(y),y=requestAnimationFrame(()=>{var T;(T=x)==null||T.observe(t)})),n()}),f&&!u&&x.observe(f),t&&x.observe(t));let b,S=u?lu(e):null;u&&E();function E(){const C=lu(e);S&&!J5(S,C)&&n(),S=C,b=requestAnimationFrame(E)}return n(),()=>{var C;h.forEach(O=>{s&&O.removeEventListener("scroll",n),o&&O.removeEventListener("resize",n)}),p==null||p(),(C=x)==null||C.disconnect(),x=null,u&&cancelAnimationFrame(b)}}const qZ=TZ,GZ=NZ,KZ=EZ,YZ=RZ,WZ=OZ,XZ=(e,t,n)=>{const r=new Map,s=n??{},o={...UZ,...s.platform,_c:r};return wZ(e,t,{...s,platform:o})};var QZ=typeof document<"u",ZZ=function(){},vy=QZ?N.useLayoutEffect:ZZ;function Vy(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,r,s;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!Vy(e[r],t[r]))return!1;return!0}if(s=Object.keys(e),n=s.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,s[r]))return!1;for(r=n;r--!==0;){const o=s[r];if(!(o==="_owner"&&e.$$typeof)&&!Vy(e[o],t[o]))return!1}return!0}return e!==e&&t!==t}function ez(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function RM(e,t){const n=ez(e);return Math.round(t*n)/n}function $1(e){const t=N.useRef(e);return vy(()=>{t.current=e}),t}function JZ(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:s,elements:{reference:o,floating:l}={},transform:c=!0,whileElementsMounted:u,open:f}=e,[h,p]=N.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[y,x]=N.useState(r);Vy(y,r)||x(r);const[b,S]=N.useState(null),[E,C]=N.useState(null),O=N.useCallback(G=>{G!==M.current&&(M.current=G,S(G))},[]),T=N.useCallback(G=>{G!==A.current&&(A.current=G,C(G))},[]),R=o||b,k=l||E,M=N.useRef(null),A=N.useRef(null),I=N.useRef(h),L=u!=null,D=$1(u),P=$1(s),z=$1(f),$=N.useCallback(()=>{if(!M.current||!A.current)return;const G={placement:t,strategy:n,middleware:y};P.current&&(G.platform=P.current),XZ(M.current,A.current,G).then(q=>{const K={...q,isPositioned:z.current!==!1};j.current&&!Vy(I.current,K)&&(I.current=K,Us.flushSync(()=>{p(K)}))})},[y,t,n,P,z]);vy(()=>{f===!1&&I.current.isPositioned&&(I.current.isPositioned=!1,p(G=>({...G,isPositioned:!1})))},[f]);const j=N.useRef(!1);vy(()=>(j.current=!0,()=>{j.current=!1}),[]),vy(()=>{if(R&&(M.current=R),k&&(A.current=k),R&&k){if(D.current)return D.current(R,k,$);$()}},[R,k,$,D,L]);const H=N.useMemo(()=>({reference:M,floating:A,setReference:O,setFloating:T}),[O,T]),B=N.useMemo(()=>({reference:R,floating:k}),[R,k]),V=N.useMemo(()=>{const G={position:n,left:0,top:0};if(!B.floating)return G;const q=RM(B.floating,h.x),K=RM(B.floating,h.y);return c?{...G,transform:"translate("+q+"px, "+K+"px)",...ez(B.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:q,top:K}},[n,c,B.floating,h.x,h.y]);return N.useMemo(()=>({...h,update:$,refs:H,elements:B,floatingStyles:V}),[h,$,H,B,V])}const eJ=(e,t)=>{const n=qZ(e);return{name:n.name,fn:n.fn,options:[e,t]}},tJ=(e,t)=>{const n=GZ(e);return{name:n.name,fn:n.fn,options:[e,t]}},nJ=(e,t)=>({fn:WZ(e).fn,options:[e,t]}),rJ=(e,t)=>{const n=KZ(e);return{name:n.name,fn:n.fn,options:[e,t]}},sJ=(e,t)=>{const n=YZ(e);return{name:n.name,fn:n.fn,options:[e,t]}};function qy(e,t,n,r){return{left:e,top:t,right:n,bottom:r,x:e,y:t,width:n-e,height:r-t}}function oJ(e){return{left:e.left,top:e.top,right:e.right,bottom:e.bottom,width:e.width,height:e.height}}function tz(e){const t=[];let n,r=Number.POSITIVE_INFINITY,s=Number.POSITIVE_INFINITY,o=Number.NEGATIVE_INFINITY,l=Number.NEGATIVE_INFINITY;for(const c of Array.from(e).sort((u,f)=>u.top-f.top)){if(r=Math.min(r,c.left),s=Math.min(s,c.top),o=Math.max(o,c.right),l=Math.max(l,c.bottom),!n||c.top-n.top>n.height/2)t.push(oJ(c));else{const u=t[t.length-1];u.left=Math.min(u.left,c.left),u.right=Math.max(u.right,c.right),u.bottom=Math.max(u.bottom,c.bottom),u.width=u.right-u.left,u.height=u.bottom-u.top}n=c}return{lines:t,fallback:qy(r,s,o,l)}}function nz(e,t,n){return e.findIndex(r=>t>r.left-2&&t<r.right+2&&n>r.top-2&&n<r.bottom+2)}function AM(e){return qy(e.left,e.top,e.right,e.bottom)}function iJ(e,t,n){const{lines:r}=tz(e.getClientRects());if(r.length<2)return;const s=nz(r,t,n);return{x:t,y:n,lineIndex:s===-1?void 0:s,element:e}}function lJ(e,t,n){const{lines:r,fallback:s}=tz(e.getClientRects());if(r.length<2)return null;const o=n==null?void 0:n.x,l=n==null?void 0:n.y,c=t[0];if((n==null?void 0:n.lineIndex)!=null&&r[n.lineIndex])return AM(r[n.lineIndex]);if(o!=null&&l!=null){const b=nz(r,o,l);if(b!==-1)return AM(r[b])}if(r.length===2&&r[0].left>r[1].right&&o!=null&&l!=null)return s;if(c==="t"||c==="b"){const b=r[0],S=r[r.length-1],E=c==="t"?b:S;return qy(E.left,b.top,E.right,S.bottom)}const u=c==="l";let f=r[0].left,h=r[0].right,p=u?Number.POSITIVE_INFINITY:Number.NEGATIVE_INFINITY,y=r[0],x=r[0];for(const b of r){f=Math.min(f,b.left),h=Math.max(h,b.right);const S=u?b.left:b.right;u&&S<p||!u&&S>p?(p=S,y=b,x=b):S===p&&(x=b)}return qy(f,y.top,h,x.bottom)}function aJ(e){return"contextElement"in e&&e.contextElement?e.contextElement:St(e)?e:void 0}function cJ(e,t){function n(s){rz(e,s.currentTarget,s.clientX,s.clientY)}function r(s){t||n(s)}return{onFocus(){e.current=void 0},onMouseEnter:r,onMouseMove:r}}function rz(e,t,n,r){const s=iJ(t,n,r);return e.current=s,s}function uJ(e){return{name:"inline",async fn(t){const n=t.elements.reference;if(typeof(n==null?void 0:n.getClientRects)!="function")return{};const r=aJ(n),s=e.current,o=(s==null?void 0:s.element)===n||(s==null?void 0:s.element)===r?s:void 0,l=lJ(n,t.placement,o);if(!l||typeof t.platform.getElementRects!="function")return{};const c=await t.platform.getElementRects({reference:{contextElement:r,getBoundingClientRect(){return l}},floating:t.elements.floating,strategy:t.strategy});return t.rects.reference.x===c.reference.x&&t.rects.reference.y===c.reference.y&&t.rects.reference.width===c.reference.width&&t.rects.reference.height===c.reference.height?{}:{reset:{rects:c}}}}}class dJ{constructor(t,n,r=!0){Ot(this,"attachedStores",[]);Ot(this,"attachedStoreValue",null);Ot(this,"storeListeners",new Set);this.fallbackStore=t,this.componentName=n,this.throwOnMissingTrigger=r}get attachedStore(){return this.attachedStoreValue}get store(){return this.attachedStoreValue??this.fallbackStore}get serverStore(){return this.fallbackStore}subscribeStore(t){return this.storeListeners.add(t),()=>{this.storeListeners.delete(t)}}attachStore(t){return this.attachedStores.push(t),this.setActiveStore(t),()=>{const n=this.attachedStores.lastIndexOf(t);n!==-1&&this.attachedStores.splice(n,1),this.setActiveStore(this.attachedStores[this.attachedStores.length-1]??null)}}setActiveStore(t){this.attachedStoreValue!==t&&(this.attachedStoreValue=t,this.storeListeners.forEach(n=>{n()}))}openByTrigger(t){const n=this.attachedStore;if(n===null)return;let r;if(t){for(let s=this.attachedStores.length-1;s>=0&&!r;s-=1)r=this.attachedStores[s].context.triggerElements.getById(t);r??(r=this.fallbackStore.context.triggerElements.getById(t))}if(t&&!r&&this.throwOnMissingTrigger)throw new Error(Wt(99,this.componentName,t,this.componentName));n.setOpen(!0,ct(iu,void 0,r))}closePopup(){const t=this.attachedStore;t!==null&&t.setOpen(!1,ct(iu))}}var oT=x4();const TE=[];let NE;function fJ(){return NE}function hJ(e){TE.push(e)}function kf(e){const t=(n,r)=>{const s=Rr(pJ).current;let o;try{NE=s;for(const l of TE)l.before(s);o=e(n,r);for(const l of TE)l.after(s);s.didInitialize=!0}finally{NE=void 0}return o};return t.displayName=e.displayName||e.name,t}function vm(e){return N.forwardRef(kf(e))}function pJ(){return{didInitialize:!1}}const mJ=O2(19),gJ=mJ?xJ:bJ;function sz(e,t,n,r,s){return gJ(e,t,n,r,s)}function yJ(e,t,n,r,s){const o=N.useCallback(()=>t(e.getSnapshot(),n,r,s),[e,t,n,r,s]);return oT.useSyncExternalStore(e.subscribe,o,o)}hJ({before(e){e.syncIndex=0,e.didInitialize||(e.syncTick=1,e.syncHooks=[],e.didChangeStore=!0,e.getSnapshot=()=>{let t=!1;for(let n=0;n<e.syncHooks.length;n+=1){const r=e.syncHooks[n],s=r.selector(r.store.state,r.a1,r.a2,r.a3);Object.is(r.value,s)||(t=!0,r.value=s)}return t&&(e.syncTick+=1),e.syncTick})},after(e){e.syncHooks.length>0&&(e.didChangeStore&&(e.didChangeStore=!1,e.subscribe=t=>{const n=new Set;for(const s of e.syncHooks)n.add(s.store);const r=[];for(const s of n)r.push(s.subscribe(t));return()=>{for(const s of r)s()}}),oT.useSyncExternalStore(e.subscribe,e.getSnapshot,e.getSnapshot))}});function xJ(e,t,n,r,s){const o=fJ();if(!o)return yJ(e,t,n,r,s);const l=o.syncIndex;o.syncIndex+=1;let c;return o.didInitialize?(c=o.syncHooks[l],(c.store!==e||c.selector!==t||!Object.is(c.a1,n)||!Object.is(c.a2,r)||!Object.is(c.a3,s))&&(c.store!==e&&(o.didChangeStore=!0),c.store=e,c.selector=t,c.a1=n,c.a2=r,c.a3=s,c.value=t(e.getSnapshot(),n,r,s))):(c={store:e,selector:t,a1:n,a2:r,a3:s,value:t(e.getSnapshot(),n,r,s)},o.syncHooks.push(c)),c.value}function bJ(e,t,n,r,s){return b2.useSyncExternalStoreWithSelector(e.subscribe,e.getSnapshot,e.getSnapshot,o=>t(o,n,r,s))}class vJ{constructor(t){Ot(this,"subscribe",t=>(this.listeners.add(t),()=>{this.listeners.delete(t)}));Ot(this,"getSnapshot",()=>this.state);this.state=t,this.listeners=new Set,this.updateTick=0}static create(t){return new this(t)}setState(t){if(this.state===t)return;this.state=t,this.updateTick+=1;const n=this.updateTick;for(const r of this.listeners){if(n!==this.updateTick)return;r(t)}}update(t){for(const n in t)if(!Object.is(this.state[n],t[n])){this.setState({...this.state,...t});return}}set(t,n){Object.is(this.state[t],n)||this.setState({...this.state,[t]:n})}notifyAll(){const t={...this.state};this.setState(t)}use(t,n,r,s){return sz(this,t,n,r,s)}}class Cu extends vJ{constructor(t,n={},r){super(t),this.context=n,this.selectors=r}useSyncedValue(t,n){N.useDebugValue(t);const r=this;Be(()=>{r.state[t]!==n&&r.set(t,n)},[r,t,n])}useSyncedValueWithCleanup(t,n){const r=this;Be(()=>(r.state[t]!==n&&r.set(t,n),()=>{r.set(t,void 0)}),[r,t,n])}useSyncedValues(t){const n=this,r=Object.values(t);Be(()=>{n.update(t)},[n,...r])}useControlledProp(t,n){N.useDebugValue(t);const r=this,s=n!==void 0;Be(()=>{s&&!Object.is(r.state[t],n)&&r.setState({...r.state,[t]:n})},[r,t,n,s])}select(t,n,r,s){const o=this.selectors[t];return o(this.state,n,r,s)}useState(t,n,r,s){return N.useDebugValue(t),sz(this,this.selectors[t],n,r,s)}useContextCallback(t,n){N.useDebugValue(t);const r=Ve(n??Fn);this.context[t]=r}useStateSetter(t){const n=N.useRef(void 0);return n.current===void 0&&(n.current=r=>{this.set(t,r)}),n.current}observe(t,n){let r;typeof t=="function"?r=t:r=this.selectors[t];let s=r(this.state);return n(s,s,this),this.subscribe(o=>{const l=r(o);if(!Object.is(s,l)){const c=s;s=l,n(l,c,this)}})}}const SJ={open:e=>e.open,transitionStatus:e=>e.transitionStatus,domReferenceElement:e=>e.domReferenceElement,referenceElement:e=>e.positionReference??e.referenceElement,floatingElement:e=>e.floatingElement,floatingId:e=>e.floatingId};class oz extends Cu{constructor(n){const{syncOnly:r,nested:s,onOpenChange:o,triggerElements:l,...c}=n;super({...c,positionReference:c.referenceElement,domReferenceElement:c.referenceElement},{onOpenChange:o,dataRef:{current:{}},events:q5(),nested:s,triggerElements:l},SJ);Ot(this,"syncOpenEvent",(n,r)=>{(!n||!this.state.open||r!=null&&MQ(r))&&(this.context.dataRef.current.openEvent=n?r:void 0)});Ot(this,"dispatchOpenChange",(n,r)=>{this.syncOpenEvent(n,r.event);const s={open:n,reason:r.reason,nativeEvent:r.event,nested:this.context.nested,triggerElement:r.trigger};this.context.events.emit("openchange",s)});Ot(this,"setOpen",(n,r)=>{var s,o,l,c;if(this.syncOnly){(o=(s=this.context).onOpenChange)==null||o.call(s,n,r);return}this.dispatchOpenChange(n,r),(c=(l=this.context).onOpenChange)==null||c.call(l,n,r)});this.syncOnly=r}}function iz(e){const{popupStore:t,treatPopupAsFloatingElement:n=!1,floatingRootContext:r,floatingId:s,nested:o,onOpenChange:l}=e,c=t.useState("open"),u=t.useState("activeTriggerElement"),f=t.useState(n?"popupElement":"positionerElement"),h=t.context.triggerElements,p=l,y=N.useRef(null);r===void 0&&y.current===null&&(y.current=new oz({open:c,transitionStatus:void 0,referenceElement:u,floatingElement:f,triggerElements:h,onOpenChange:p,floatingId:s,syncOnly:!0,nested:o}));const x=r??y.current;return t.useSyncedValue("floatingId",s),Be(()=>{const b={open:c,floatingId:s,referenceElement:u,floatingElement:f};St(u)&&(b.domReferenceElement=u),x.state.positionReference===x.state.referenceElement&&(b.positionReference=u),x.update(b)},[c,s,u,f,x]),x.context.onOpenChange=p,x.context.nested=o,x}const Sm={tabIndex:-1,[yE]:""};function lz(e){return t=>t==="touch"?e.current:!0}function sb(e,t=!1){const n=cf(),r=Eu()!=null,s=Rr(()=>e(n,r)).current;return iz({popupStore:s,treatPopupAsFloatingElement:t,floatingRootContext:s.state.floatingRootContext,floatingId:n,nested:r,onOpenChange:s.setOpen}),s}function wm({handle:e,store:t}){return Be(()=>e.attachStore(t),[e,t]),null}function kM(e){const t=e.context.triggerElements.size;e.select("open")&&e.state.triggerCount!==t&&e.set("triggerCount",t)}function az(e,t){const n=N.useRef(null);return Ve(r=>{const s=n.current;if(s!==null){if(s.element===r&&s.store===t&&s.id===e)return;n.current=null;const o=s.store;o.context.triggerElements.getById(s.id)===s.element&&(o.context.triggerElements.delete(s.id),kM(o))}r!==null&&e!==void 0&&(n.current={store:t,id:e,element:r},t.context.triggerElements.add(e,r),kM(t))})}function ob(e,t,n,r=!1){let s=e.preventUnmountingOnClose;t?s=!1:r&&(s=!0);const o=(n==null?void 0:n.id)??null;let l=e.activeTriggerId,c=e.activeTriggerElement;return(o||t)&&(l=o,c=n??null),{open:t,preventUnmountingOnClose:s,activeTriggerId:l,activeTriggerElement:c}}function iT(e){let t=!1;return e.preventUnmountOnClose=()=>{t=!0},()=>t}function cz(e,t,n,r={}){var h,p,y;const s=n.reason,o=s===wn,l=t&&s===Pd,c=!t&&(s===di||s===mm),u=iT(n);if((p=(h=e.context).onOpenChange)==null||p.call(h,t,n),n.isCanceled)return;(y=r.onBeforeDispatch)==null||y.call(r),e.state.floatingRootContext.dispatchOpenChange(t,n);const f=()=>{const x=ob(e.state,t,n.trigger,u()),b={...r.extraState,...x};l?b.instantType="focus":c?b.instantType="dismiss":o&&(b.instantType=void 0),e.update(b)};o?Us.flushSync(f):f()}function Em(e,t,n,r){const s=n.useState("isMountedByTrigger",e),o=az(e,n),l=Ve(u=>{const f=n.select("open"),h=n.select("activeTriggerId");if(h===e){const p={activeTriggerElement:u,...f?r:null};n.update(p);return}if(h==null&&f){const p={activeTriggerId:e??null,activeTriggerElement:u,...r};n.update(p)}}),c=Ve(u=>{o(u),u&&l(u)});return Be(()=>(c(t.current),()=>c(null)),[c,t,n,e]),Be(()=>{if(s){const u={activeTriggerElement:t.current,...r};n.update(u)}},[s,n,t,...Object.values(r)]),{registerTrigger:c,isMountedByThisTrigger:s}}function Cm(e,t={}){const{closeOnActiveTriggerUnmount:n=!1}=t,r=N.useRef(null),s=e.useState("open"),o=e.useState("triggerCount"),l=e.useState("activeTriggerId"),c=e.useState("activeTriggerElement");Be(()=>{if(!s){r.current=null,e.state.triggerCount!==0&&e.set("triggerCount",0);return}const u=e.context.triggerElements.size,f={};e.state.triggerCount!==u&&(f.triggerCount=u);const h=e.select("activeTriggerId");let p=null;if(h){const y=e.context.triggerElements.getById(h);if(y)r.current=h,y!==e.state.activeTriggerElement&&(f.activeTriggerElement=y);else{for(const[x,b]of e.context.triggerElements.entries())if(b===e.state.activeTriggerElement){f.activeTriggerId=x,f.activeTriggerElement=b,r.current=x;break}f.activeTriggerId===void 0&&(r.current===h?p=h:r.current=null)}}else r.current=null;if(!p&&!h&&u===1){const y=e.context.triggerElements.entries().next();if(!y.done){const[x,b]=y.value;f.activeTriggerId=x,f.activeTriggerElement=b,r.current=x}}(f.triggerCount!==void 0||f.activeTriggerId!==void 0||f.activeTriggerElement!==void 0)&&e.update(f),p&&n&&queueMicrotask(()=>{if(e.select("open")&&e.select("activeTriggerId")===p&&!e.context.triggerElements.getById(p)){const y=ct(pm);e.setOpen(!1,y),y.isCanceled||e.update({activeTriggerId:null,activeTriggerElement:null})}})},[s,e,o,l,c,n])}function Tm(e,t,n,r){const{mounted:s,setMounted:o,transitionStatus:l}=V2(e,!1,!1,r),c=t.useState("preventUnmountingOnClose"),u=e?!1:c;t.useSyncedValues({mounted:s,transitionStatus:l,preventUnmountingOnClose:u});const f=Ve(()=>{var h,p;o(!1),t.update({activeTriggerId:null,activeTriggerElement:null,mounted:!1,preventUnmountingOnClose:!1}),n==null||n(),(p=(h=t.context).onOpenChangeComplete)==null||p.call(h,!1)});return Ya({enabled:s&&!e&&!u,open:e,ref:t.context.popupRef,onComplete(){e||f()}}),{forceUnmount:f,transitionStatus:l}}function Nm(e,t){e.useSyncedValues(t),Be(()=>()=>{e.update({activeTriggerProps:hn,inactiveTriggerProps:hn,popupProps:hn})},[e])}function uz(e,t){Be(()=>{!t&&e.state.openMethod!==null&&e.set("openMethod",null)},[t,e]),Be(()=>()=>{e.state.openMethod!==null&&e.set("openMethod",null)},[e])}class _f{constructor(){this.idMap=new Map}add(t,n){this.idMap.set(t,n)}delete(t){this.idMap.delete(t)}hasElement(t){for(const n of this.idMap.values())if(n===t)return!0;return!1}hasMatchingElement(t){for(const n of this.idMap.values())if(t(n))return!0;return!1}getById(t){return this.idMap.get(t)}entries(){return this.idMap.entries()}elements(){return this.idMap.values()}get size(){return this.idMap.size}}function Om(e,t,n=!1){return{open:!1,openProp:void 0,mounted:!1,transitionStatus:void 0,floatingRootContext:new oz({open:!1,transitionStatus:void 0,floatingElement:null,referenceElement:null,triggerElements:e,floatingId:t,syncOnly:!0,nested:n,onOpenChange:void 0}),floatingId:t,triggerCount:0,preventUnmountingOnClose:!1,payload:void 0,activeTriggerId:null,activeTriggerElement:null,triggerIdProp:void 0,popupElement:null,positionerElement:null,activeTriggerProps:hn,inactiveTriggerProps:hn,popupProps:hn}}const ap=e=>e.triggerIdProp??e.activeTriggerId,lT=e=>e.openProp??e.open,_M=e=>{var n;return(((n=e.popupElement)==null?void 0:n.id)??e.floatingId)||void 0};function dz(e,t){return t!==void 0&&lT(e)&&ap(e)===t}function wJ(e,t){return dz(e,t)?!0:t!==void 0&&lT(e)&&ap(e)==null&&e.triggerCount===1}const Rm={open:lT,mounted:e=>e.mounted,transitionStatus:e=>e.transitionStatus,floatingRootContext:e=>e.floatingRootContext,triggerCount:e=>e.triggerCount,preventUnmountingOnClose:e=>e.preventUnmountingOnClose,payload:e=>e.payload,activeTriggerId:ap,activeTriggerElement:e=>e.mounted?e.activeTriggerElement:null,popupId:_M,isTriggerActive:(e,t)=>t!==void 0&&ap(e)===t,isOpenedByTrigger:(e,t)=>dz(e,t),isMountedByTrigger:(e,t)=>t!==void 0&&ap(e)===t&&e.mounted,triggerProps:(e,t)=>t?e.activeTriggerProps:e.inactiveTriggerProps,triggerPopupId:(e,t)=>wJ(e,t)?_M(e):void 0,popupProps:e=>e.popupProps,popupElement:e=>e.popupElement,positionerElement:e=>e.positionerElement};function Am(e){const t=N.useCallback(r=>e===void 0?Fn:e.subscribeStore(r),[e]),n=N.useCallback(()=>e===void 0?void 0:e.store,[e]);return oT.useSyncExternalStore(t,n,()=>e==null?void 0:e.serverStore)}function EJ(e){return CJ(e,e.rootContext)}function CJ(e,t){const{nodeId:n,externalTree:r}=e,s=t.useState("referenceElement"),o=t.useState("floatingElement"),l=t.useState("domReferenceElement"),c=t.useState("open"),u=t.useState("floatingId"),[f,h]=N.useState(null),[p,y]=N.useState(void 0),[x,b]=N.useState(void 0),S=N.useRef(null),E=pl(r),C=N.useMemo(()=>({reference:s,floating:o,domReference:l}),[s,o,l]),O=JZ({...e,elements:{...C,...f&&{reference:f}}}),T=St(p)?p:null,R=x===void 0?t.state.floatingElement:x;t.useSyncedValue("referenceElement",p??null),t.useSyncedValue("domReferenceElement",p===void 0?l:T),t.useSyncedValue("floatingElement",R);const k=N.useCallback(P=>{const z=St(P)?{getBoundingClientRect:()=>P.getBoundingClientRect(),getClientRects:()=>P.getClientRects(),contextElement:P}:P;h(z),O.refs.setReference(z)},[O.refs]),M=N.useCallback(P=>{(St(P)||P===null)&&(S.current=P,y(P)),(St(O.refs.reference.current)||O.refs.reference.current===null||P!==null&&!St(P))&&O.refs.setReference(P)},[O.refs,y]),A=N.useCallback(P=>{b(P),O.refs.setFloating(P)},[O.refs]),I=N.useMemo(()=>({...O.refs,setReference:M,setFloating:A,setPositionReference:k,domReference:S}),[O.refs,M,A,k]),L=N.useMemo(()=>({...O.elements,domReference:l}),[O.elements,l]),D=N.useMemo(()=>({...O,dataRef:t.context.dataRef,open:c,onOpenChange:t.setOpen,events:t.context.events,floatingId:u,refs:I,elements:L,nodeId:n,rootStore:t}),[O,I,L,n,t,c,u]);return Be(()=>{l&&(S.current=l)},[l]),Be(()=>{t.context.dataRef.current.floatingContext=D;const P=E==null?void 0:E.nodesRef.current.find(z=>z.id===n);P&&(P.context=D)}),N.useMemo(()=>({...O,context:D,refs:I,elements:L,rootStore:t}),[O,I,L,D,t])}const U1=H2&&Ka;function aT(e,t={}){const{enabled:n=!0,delay:r}=t,s="rootStore"in e?e.rootStore:e,{events:o,dataRef:l}=s.context,c=N.useRef(!1),u=N.useRef(null),f=N.useRef(!0),h=ns();N.useEffect(()=>{const y=s.select("domReferenceElement");if(!n)return;const x=pn(y);function b(){const C=s.select("domReferenceElement");!s.select("open")&&Yt(C)&&C===es(jt(C))&&(c.current=!0,u.current=C)}function S(){f.current=!0}function E(){f.current=!1}return ai(bt(x,"blur",b),U1&&bt(x,"keydown",S,!0),U1&&bt(x,"pointerdown",E,!0))},[s,n]),N.useEffect(()=>{if(!n)return;function y(x){if(x.reason===di||x.reason===mm){const b=s.select("domReferenceElement");St(b)&&(u.current=b,c.current=!0)}}return o.on("openchange",y),()=>{o.off("openchange",y)}},[o,n,s]);const p=N.useMemo(()=>{function y(){c.current=!1,u.current=null}return{onMouseLeave(){y()},onFocus(x){const b=x.currentTarget;if(c.current){if(u.current===b)return;y()}const S=Nr(x.nativeEvent);if(St(S)){if(U1&&!x.relatedTarget){if(!f.current&&!Qx(S))return}else if(!DQ(S))return}const E=Hy(x.relatedTarget,s.context.triggerElements),{nativeEvent:C,currentTarget:O}=x,T=typeof r=="function"?r():r;if(s.select("open")&&E||T===0||T===void 0){s.setOpen(!0,ct(Pd,C,O));return}h.start(T,()=>{c.current||s.setOpen(!0,ct(Pd,C,O))})},onBlur(x){y();const b=x.relatedTarget,S=x.nativeEvent,E=St(b)&&b.hasAttribute(Ip("focus-guard"))&&b.getAttribute("data-type")==="outside";h.start(0,()=>{var R;const C=s.select("domReferenceElement"),O=es(jt(C));!b&&O===C||Je((R=l.current.floatingContext)==null?void 0:R.refs.floating.current,O)||Je(C,O)||E||Hy(b??O,s.context.triggerElements)||s.setOpen(!1,ct(Pd,S))})}}},[l,r,s,h]);return N.useMemo(()=>n?{reference:p,trigger:p}:{},[n,p])}class cT{constructor(){Ot(this,"dispose",()=>{this.openChangeTimeout.clear(),this.restTimeout.clear()});Ot(this,"disposeEffect",()=>this.dispose);this.pointerType=void 0,this.interactedInside=!1,this.handler=void 0,this.blockMouseMove=!0,this.performedPointerEventsMutation=!1,this.pointerEventsScopeElement=null,this.pointerEventsReferenceElement=null,this.pointerEventsFloatingElement=null,this.restTimeoutPending=!1,this.openChangeTimeout=new co,this.restTimeout=new co,this.handleCloseOptions=void 0}static create(){return new cT}}const Gy=new WeakMap;function Ky(e){var n,r,s;if(!e.performedPointerEventsMutation)return;const t=e.pointerEventsScopeElement;t&&Gy.get(t)===e&&((n=e.pointerEventsScopeElement)==null||n.style.removeProperty("pointer-events"),(r=e.pointerEventsReferenceElement)==null||r.style.removeProperty("pointer-events"),(s=e.pointerEventsFloatingElement)==null||s.style.removeProperty("pointer-events"),Gy.delete(t)),e.performedPointerEventsMutation=!1,e.pointerEventsScopeElement=null,e.pointerEventsReferenceElement=null,e.pointerEventsFloatingElement=null}function fz(e,t){const{scopeElement:n,referenceElement:r,floatingElement:s}=t,o=Gy.get(n);o&&o!==e&&Ky(o),Ky(e),e.performedPointerEventsMutation=!0,e.pointerEventsScopeElement=n,e.pointerEventsReferenceElement=r,e.pointerEventsFloatingElement=s,Gy.set(n,e),n.style.pointerEvents="none",r.style.pointerEvents="auto",s.style.pointerEvents="auto"}function uT(e){const t=e.context.dataRef.current,n=Rr(()=>t.hoverInteractionState??cT.create()).current;return t.hoverInteractionState||(t.hoverInteractionState=n),U2(t.hoverInteractionState.disposeEffect),t.hoverInteractionState}function ib(e,t={}){const{enabled:n=!0,closeDelay:r=0,nodeId:s}=t,o="rootStore"in e?e.rootStore:e,l=o.useState("open"),c=o.useState("floatingElement"),u=o.useState("domReferenceElement"),{dataRef:f}=o.context,h=pl(),p=Eu(),y=uT(o),x=ns(),b=Ve(()=>{var C;return O5((C=f.current.openEvent)==null?void 0:C.type,y.interactedInside)}),S=Ve(()=>{var C;return PQ((C=f.current.openEvent)==null?void 0:C.type)}),E=Ve(()=>{Ky(y)});Be(()=>{l||(y.pointerType=void 0,y.restTimeoutPending=!1,y.interactedInside=!1,E())},[l,y,E]),N.useEffect(()=>E,[E]),Be(()=>{var C,O,T,R,k;if(n&&l&&(C=y.handleCloseOptions)!=null&&C.blockPointerEvents&&S()&&St(u)&&c){const M=u,A=c,I=jt(c),L=(T=(O=h==null?void 0:h.nodesRef.current.find($=>$.id===p))==null?void 0:O.context)==null?void 0:T.elements.floating;L&&(L.style.pointerEvents="");const D=y.pointerEventsScopeElement!==A?y.pointerEventsScopeElement:null,P=L!==A?L:null,z=((k=(R=y.handleCloseOptions)==null?void 0:R.getScope)==null?void 0:k.call(R))??D??P??M.closest("[data-rootownerid]")??I.body;return fz(y,{scopeElement:z,referenceElement:M,floatingElement:A}),()=>{E()}}},[n,l,u,c,y,S,h,p,E]),N.useEffect(()=>{if(!n)return;function C(){return!!(h&&p&&qa(h.nodesRef.current,p).length>0)}function O(I){const L=Mp(r,"close",y.pointerType),D=()=>{o.setOpen(!1,ct(wn,I)),h==null||h.events.emit("floating.closed",I)};L?y.openChangeTimeout.start(L,D):(y.openChangeTimeout.clear(),D())}function T(I){const L=Nr(I);if(!LQ(L)){y.interactedInside=!1;return}y.interactedInside=(L==null?void 0:L.closest("[aria-haspopup]"))!=null}function R(){y.openChangeTimeout.clear(),x.clear(),h==null||h.events.off("floating.closed",M),E()}function k(I){var z;if(C()&&h){h.events.on("floating.closed",M);return}if(Hy(I.relatedTarget,o.context.triggerElements))return;const L=((z=f.current.floatingContext)==null?void 0:z.nodeId)??s,D=I.relatedTarget;if(!(h&&L&&St(D)&&qa(h.nodesRef.current,L,!1).some($=>{var j;return Je((j=$.context)==null?void 0:j.elements.floating,D)}))){if(y.handler){y.handler(I);return}E(),S()&&!b()&&O(I)}}function M(I){!h||!p||C()||x.start(0,()=>{h.events.off("floating.closed",M),o.setOpen(!1,ct(wn,I)),h.events.emit("floating.closed",I)})}const A=c;return ai(A&&bt(A,"mouseenter",R),A&&bt(A,"mouseleave",k),A&&bt(A,"pointerdown",T,!0),()=>{h==null||h.events.off("floating.closed",M)})},[n,c,o,f,r,s,S,b,E,y,h,p,x])}const TJ={current:null};function km(e,t={}){const{enabled:n=!0,delay:r=0,handleClose:s=null,mouseOnly:o=!1,restMs:l=0,move:c=!0,triggerElementRef:u=TJ,externalTree:f,isActiveTrigger:h=!0,getHandleCloseContext:p,isClosing:y,shouldOpen:x,guardStaleOpen:b=!1}=t,S="rootStore"in e?e.rootStore:e,{dataRef:E,events:C}=S.context,O=pl(f),T=uT(S),R=N.useRef(!1),k=In(s),M=In(r),A=In(l),I=In(n),L=In(x),D=In(y),P=Ve(()=>{var B;return O5((B=E.current.openEvent)==null?void 0:B.type,T.interactedInside)}),z=Ve(()=>{var B;return((B=L.current)==null?void 0:B.call(L))!==!1}),$=Ve((B,V,G)=>{const q=S.context.triggerElements;if(q.hasElement(V))return!B||!Je(B,V);if(!St(G))return!1;const K=G;return q.hasMatchingElement(W=>Je(W,K))&&(!B||!Je(B,K))}),j=Ve(()=>{if(!T.handler)return;jt(S.select("domReferenceElement")).removeEventListener("mousemove",T.handler),T.handler=void 0}),H=Ve(()=>{Ky(T)});return h&&(T.handleCloseOptions=s==null?void 0:s.__options),N.useEffect(()=>j,[j]),N.useEffect(()=>{if(!n)return;function B(V){V.open?R.current=!1:(R.current=V.reason===wn,j(),T.openChangeTimeout.clear(),T.restTimeout.clear(),T.blockMouseMove=!0,T.restTimeoutPending=!1)}return C.on("openchange",B),()=>{C.off("openchange",B)}},[n,C,T,j]),N.useEffect(()=>{if(!n)return;function B(ee,ce=!0){const F=Mp(M.current,"close",T.pointerType);F?T.openChangeTimeout.start(F,()=>{S.setOpen(!1,ct(wn,ee)),O==null||O.events.emit("floating.closed",ee)}):ce&&(T.openChangeTimeout.clear(),S.setOpen(!1,ct(wn,ee)),O==null||O.events.emit("floating.closed",ee))}const V=u.current??(h?S.select("domReferenceElement"):null);if(!St(V))return;function G(ee){var be;if(T.openChangeTimeout.clear(),T.blockMouseMove=!1,o&&!Ra(T.pointerType))return;const ce=cM(A.current),F=Mp(M.current,"open",T.pointerType),X=Nr(ee),te=ee.currentTarget??null,Z=S.select("domReferenceElement");let Y=te;if(St(X)&&!S.context.triggerElements.hasElement(X)){for(const _e of S.context.triggerElements.elements())if(Je(_e,X)){Y=_e;break}}St(te)&&St(Z)&&!S.context.triggerElements.hasElement(te)&&Je(te,Z)&&(Y=Z);const le=Y==null?!1:$(Z,Y,X),xe=S.select("open"),fe=((be=D.current)==null?void 0:be.call(D))??S.select("transitionStatus")==="ending",oe=!xe&&fe&&R.current,re=!le&&St(Y)&&St(Z)&&Je(Z,Y)&&oe,he=ce>0&&!F,Se=le&&(xe||oe)||re,ke=!xe||le;if(Se){z()&&S.setOpen(!0,ct(wn,ee,Y));return}he||(F?T.openChangeTimeout.start(F,()=>{ke&&z()&&S.setOpen(!0,ct(wn,ee,Y))}):ke&&z()&&S.setOpen(!0,ct(wn,ee,Y)))}function q(ee){if(P()){H();return}j();const ce=S.select("domReferenceElement"),F=jt(ce);T.restTimeout.clear(),T.restTimeoutPending=!1;const X=E.current.floatingContext??(p==null?void 0:p());if(Hy(ee.relatedTarget,S.context.triggerElements))return;if(k.current&&X){S.select("open")||T.openChangeTimeout.clear();const Z=u.current;T.handler=k.current({...X,tree:O,x:ee.clientX,y:ee.clientY,onClose(){H(),j(),I.current&&!P()&&Z===S.select("domReferenceElement")&&B(ee,!0)}}),F.addEventListener("mousemove",T.handler),T.handler(ee);return}(T.pointerType==="touch"?!Je(S.select("floatingElement"),ee.relatedTarget):!0)&&B(ee)}function K(ee){Je(V,ee.relatedTarget)||(T.openChangeTimeout.clear(),T.restTimeout.clear(),T.restTimeoutPending=!1)}const W=b?bt(V,"mouseout",K):void 0;return c?ai(bt(V,"mousemove",G,{once:!0}),bt(V,"mouseenter",G),bt(V,"mouseleave",q),W):ai(bt(V,"mouseenter",G),bt(V,"mouseleave",q),W)},[j,H,E,M,S,n,k,T,h,$,P,o,c,A,u,O,I,p,D,z,b]),N.useMemo(()=>{if(!n)return;function B(V){T.pointerType=V.pointerType}return{onPointerDown:B,onPointerEnter:B,onMouseMove(V){var X,te,Z;const{nativeEvent:G}=V,q=V.currentTarget,K=S.select("domReferenceElement"),W=S.select("open"),ee=$(K,q,V.target);if(o&&!Ra(T.pointerType))return;if(W&&ee&&((X=T.handleCloseOptions)!=null&&X.blockPointerEvents)){const Y=S.select("floatingElement");if(Y){const le=((Z=(te=T.handleCloseOptions)==null?void 0:te.getScope)==null?void 0:Z.call(te))??q.ownerDocument.body;fz(T,{scopeElement:le,referenceElement:q,floatingElement:Y})}}const ce=cM(A.current);if(W&&!ee||ce===0||!ee&&T.restTimeoutPending&&V.movementX**2+V.movementY**2<2)return;T.restTimeout.clear();function F(){if(T.restTimeoutPending=!1,P())return;const Y=S.select("open");!T.blockMouseMove&&(!Y||ee)&&z()&&S.setOpen(!0,ct(wn,G,q))}T.pointerType==="touch"?Us.flushSync(()=>{F()}):ee&&W?F():(T.restTimeoutPending=!0,T.restTimeout.start(ce,F))}}},[n,T,P,$,o,S,A,z])}const NJ="Escape";function MM(e){return Ka&&e.movementX===0&&e.movementY===0}function lb(e,t,n){switch(e){case"vertical":return t;case"horizontal":return n;default:return t||n}}function k0(e,t){return lb(t,e===N5||e===K2,e===Wx||e===Xx)}function V1(e,t,n){return lb(t,e===K2,n?e===Wx:e===Xx)||e==="Enter"||e===" "||e===""}function OJ(e,t,n){return lb(t,n?e===Wx:e===Xx,e===K2)}function RJ(e,t,n,r){const s=n?e===Xx:e===Wx,o=e===N5;return t==="both"||t==="horizontal"&&r?e===NJ:lb(t,s,o)}function AJ(e,t){const{listRef:n,activeIndex:r,onNavigate:s=()=>{},enabled:o=!0,selectedIndex:l=null,allowEscape:c=!1,loopFocus:u=!1,nested:f=!1,rtl:h=!1,virtual:p=!1,focusItemOnOpen:y="auto",focusItemOnHover:x=!0,openOnArrowKeyDown:b=!0,disabledIndices:S=void 0,orientation:E="vertical",parentOrientation:C,id:O,resetOnPointerLeave:T=!0,externalTree:R,grid:k}=t,M=k!=null,A="rootStore"in e?e.rootStore:e,I=A.useState("open"),L=A.useState("floatingElement"),D=A.useState("domReferenceElement"),P=A.context.dataRef,z=vE(L),$=bE(D),j=In(z),H=Eu(),B=pl(R),V=N.useRef(y),G=N.useRef(l??-1),q=N.useRef(null),K=N.useRef(!0),W=Ve(Ee=>{s(G.current===-1?null:G.current,Ee)}),ee=N.useRef(!!L),ce=N.useRef(I),F=N.useRef(!1),X=N.useRef(!1),te=N.useRef(null),Z=In(S),Y=In(I),le=In(l),xe=In(T),fe=_p(),oe=_p(),re=Ve(()=>{function Ee(Fe){p?B==null||B.events.emit("virtualfocus",Fe):te.current=by(Fe,{sync:F.current,preventScroll:!0})}const je=n.current[G.current],Oe=X.current;je&&Ee(je),(F.current?Fe=>Fe():Fe=>fe.request(Fe))(()=>{var xt;const Fe=n.current[G.current]||je;if(!Fe)return;je||Ee(Fe),Me&&(Oe||!K.current)&&((xt=Fe.scrollIntoView)==null||xt.call(Fe,{block:"nearest",inline:"nearest"}))})});Be(()=>{P.current.orientation=E},[P,E]),Be(()=>{o&&(I&&L?(G.current=l??-1,V.current&&l!=null&&(X.current=!0,W())):ee.current&&(G.current=-1,W()))},[o,I,L,l,W]),Be(()=>{if(o){if(!I){F.current=!1;return}if(L)if(r==null){if(F.current=!1,le.current!=null)return;if(ee.current&&(G.current=-1,re()),(!ce.current||!ee.current)&&V.current&&(q.current!=null||V.current===!0&&q.current==null)){let Ee=0;const je=()=>{n.current[0]==null?(Ee<2&&(Ee?ve=>oe.request(ve):queueMicrotask)(je),Ee+=1):(G.current=q.current==null||V1(q.current,E,h)||f?xy(n):wE(n),q.current=null,W())};je()}}else lp(n.current,r)||(G.current=r,re(),X.current=!1)}},[o,I,L,r,le,f,n,E,h,W,re,oe]),Be(()=>{var Fe,Ye;if(!o||L||!B||p||!ee.current)return;const Ee=B.nodesRef.current,je=(Ye=(Fe=Ee.find(xt=>xt.id===H))==null?void 0:Fe.context)==null?void 0:Ye.elements.floating,Oe=es(jt(D??je??null)),ve=Ee.some(xt=>xt.context&&Je(xt.context.elements.floating,Oe));je&&!ve&&K.current&&je.focus({preventScroll:!0})},[o,L,D,B,H,p]),Be(()=>{ce.current=I,ee.current=!!L}),Be(()=>{I||(q.current=null,V.current=y)},[I,y]);const he=r!=null,Se=Ve(Ee=>{if(!Y.current)return;const je=n.current.indexOf(Ee.currentTarget);je!==-1&&(G.current!==je||r!==je)&&(G.current=je,W(Ee))}),ke=Ve(()=>{var Ee,je,Oe;return C??((Oe=(je=(Ee=B==null?void 0:B.nodesRef.current.find(ve=>ve.id===H))==null?void 0:Ee.context)==null?void 0:je.dataRef)==null?void 0:Oe.current.orientation)}),be=Ve(()=>xy(n,Z.current)),_e=Ve(Ee=>{if(K.current=!1,F.current=!0,Ee.which===229||!Y.current&&Ee.currentTarget===j.current)return;if(f&&RJ(Ee.key,E,h,M)){k0(Ee.key,ke())||Qo(Ee),A.setOpen(!1,ct(Ap,Ee.nativeEvent)),Yt(D)&&(p?B==null||B.events.emit("virtualfocus",D):D.focus());return}const je=G.current,Oe=xy(n,S),ve=wE(n,S);if($||(Ee.key==="Home"&&(Qo(Ee),G.current=Oe,W(Ee)),Ee.key==="End"&&(Qo(Ee),G.current=ve,W(Ee))),k!=null){const Fe=k(Ee,G.current,n,E,u,h,S,Oe,ve);if(Fe!=null&&(G.current=Fe,W(Ee)),E==="both")return}if(k0(Ee.key,E)){if(Qo(Ee),I&&!p&&es(Ee.currentTarget.ownerDocument)===Ee.currentTarget){G.current=V1(Ee.key,E,h)?Oe:ve,W(Ee);return}V1(Ee.key,E,h)?u?je>=ve?c&&je!==n.current.length?G.current=-1:(F.current=!1,G.current=Oe):G.current=Gi(n.current,{startingIndex:je,disabledIndices:S}):G.current=Math.min(ve,Gi(n.current,{startingIndex:je,disabledIndices:S})):u?je<=Oe?c&&je!==-1?G.current=n.current.length:(F.current=!1,G.current=ve):G.current=Gi(n.current,{startingIndex:je,decrement:!0,disabledIndices:S}):G.current=Math.max(Oe,Gi(n.current,{startingIndex:je,decrement:!0,disabledIndices:S})),lp(n.current,G.current)&&(G.current=-1),W(Ee)}}),Me=N.useMemo(()=>({onFocus(je){F.current=!0,Se(je)},onClick:({currentTarget:je})=>je.focus({preventScroll:!0}),onMouseMove(je){MM(je)||(F.current=!0,X.current=!1,x&&Se(je))},onPointerLeave(je){var ve;if(!Y.current||!K.current||je.pointerType==="touch")return;F.current=!0;const Oe=je.relatedTarget;if(!(!x||n.current.includes(Oe))&&xe.current&&((ve=te.current)==null||ve.call(te),te.current=null,G.current=-1,W(je),!p)){const Fe=j.current,Ye=es(jt(Fe));Fe&&Je(Fe,Ye)&&Fe.focus({preventScroll:!0})}}}),[Se,Y,j,x,n,W,xe,p]),Le=N.useMemo(()=>p&&I&&he&&{"aria-activedescendant":`${O}-${r}`},[p,I,he,O,r]),Pe=N.useMemo(()=>({...$?{}:Le,onKeyDown(Ee){if(Ee.key==="Tab"&&Ee.shiftKey&&I&&!p){const je=Nr(Ee.nativeEvent);if(je&&!Je(j.current,je))return;Qo(Ee),A.setOpen(!1,ct(ou,Ee.nativeEvent)),Yt(D)&&D.focus();return}_e(Ee)},onPointerMove(Ee){MM(Ee)||(K.current=!0)}}),[Le,_e,j,$,A,I,p,D]),pe=N.useMemo(()=>{function Ee(ve){A.setOpen(!0,ct(Ap,ve.nativeEvent,ve.currentTarget))}function je(ve){y==="auto"&&q2(ve.nativeEvent)&&(V.current=!p)}function Oe(ve){V.current=y,y==="auto"&&G2(ve.nativeEvent)&&(V.current=!0)}return{onKeyDown(ve){const Fe=A.select("open");K.current=!1;const Ye=ve.key.startsWith("Arrow"),xt=OJ(ve.key,ke(),h),nn=k0(ve.key,E),Te=(f?xt:nn)||ve.key==="Enter"||ve.key.trim()==="";if(p&&Fe)return _e(ve);if(!(!Fe&&!b&&Ye)){if(Te){const De=k0(ve.key,ke());q.current=f&&De?null:ve.key}if(f){xt&&(Qo(ve),Fe?(G.current=be(),W(ve)):Ee(ve));return}nn&&(le.current!=null&&(G.current=le.current),Qo(ve),!Fe&&b?Ee(ve):_e(ve),Fe&&W(ve))}},onFocus(ve){A.select("open")&&!p&&(G.current=-1,W(ve))},onPointerDown:Oe,onPointerEnter:Oe,onMouseDown:je,onClick:je}},[_e,y,be,f,W,A,b,E,ke,h,le,p]),Ae=N.useMemo(()=>({...Le,...pe}),[Le,pe]);return N.useMemo(()=>o?{reference:Ae,floating:Pe,item:Me,trigger:pe}:{},[o,Ae,Pe,pe,Me])}function kJ(e,t){const{listRef:n,elementsRef:r,activeIndex:s,onMatch:o,disabledIndices:l,onTyping:c,enabled:u=!0,resetMs:f=750,selectedIndex:h=null}=t,p="rootStore"in e?e.rootStore:e,y=p.useState("open"),x=ns(),b=N.useRef(""),S=N.useRef(h??s??-1),E=N.useRef(null),C=Ve(R=>{function k(j){return r==null?void 0:r.current[j]}function M(j){const H=k(j);return H&&!Zx(H)||H!=null&&H.matches(":disabled")?!1:l==null||!zd(Ha,j,l)}function A(j,H,B=0){if(j.length===0)return-1;const V=(B%j.length+j.length)%j.length,G=H.toLowerCase();for(let q=0;q<j.length;q+=1){const K=(V+q)%j.length,W=j[K];if(!(!(W!=null&&W.toLowerCase().startsWith(G))||!M(K)))return K}return-1}const I=n.current;if(b.current.length>0&&R.key===" "&&(Qo(R),c==null||c(!0)),b.current.length>0&&b.current[0]!==" "&&A(I,b.current)===-1&&R.key!==" "&&(c==null||c(!1)),I==null||R.key.length!==1||R.ctrlKey||R.metaKey||R.altKey)return;y&&R.key!==" "&&(Qo(R),c==null||c(!0));const L=b.current==="";L&&(S.current=h??s??-1),I.every((j,H)=>{var B,V;return j&&M(H)?((B=j[0])==null?void 0:B.toLowerCase())!==((V=j[1])==null?void 0:V.toLowerCase()):!0})&&b.current===R.key&&(b.current="",S.current=E.current),b.current+=R.key,x.start(f,()=>{b.current="",S.current=E.current,c==null||c(!1)});const z=((L?h??s??-1:S.current)??0)+1,$=A(I,b.current,z);$!==-1?(o==null||o($),E.current=$):R.key!==" "&&(b.current="",c==null||c(!1))}),O=Ve(R=>{const k=R.relatedTarget,M=p.select("domReferenceElement"),A=p.select("floatingElement");Je(M,k)||Je(A,k)||(x.clear(),b.current="",S.current=E.current,c==null||c(!1))});Be(()=>{!y&&h!==null||(x.clear(),E.current=null,b.current!==""&&(b.current=""))},[y,h,x]);const T=N.useMemo(()=>({onKeyDown:C,onBlur:O}),[C,O]);return N.useMemo(()=>u?{reference:T,floating:T}:{},[u,T])}const IM=.1,_J=IM*IM,Qt=.5;function _0(e,t,n,r,s,o){return r>=t!=o>=t&&e<=(s-n)*(t-r)/(o-r)+n}function M0(e,t,n,r,s,o,l,c,u,f){let h=!1;return _0(e,t,n,r,s,o)&&(h=!h),_0(e,t,s,o,l,c)&&(h=!h),_0(e,t,l,c,u,f)&&(h=!h),_0(e,t,u,f,n,r)&&(h=!h),h}function MJ(e,t,n){return e>=n.x&&e<=n.x+n.width&&t>=n.y&&t<=n.y+n.height}function I0(e,t,n,r,s,o){const l=Math.min(n,s),c=Math.max(n,s),u=Math.min(r,o),f=Math.max(r,o);return e>=l&&e<=c&&t>=u&&t<=f}function _m(e={}){const{blockPointerEvents:t=!1}=e,n=new co,r=({x:s,y:o,placement:l,elements:c,onClose:u,nodeId:f,tree:h})=>{const p=l==null?void 0:l.split("-")[0];let y=!1,x=null,b=null,S=typeof performance<"u"?performance.now():0;function E(O,T){const R=performance.now(),k=R-S;if(x===null||b===null||k===0)return x=O,b=T,S=R,!1;const M=O-x,A=T-b,I=M*M+A*A,L=k*k*_J;return x=O,b=T,S=R,I<L}function C(){n.clear(),u()}return function(T){n.clear();const R=c.domReference,k=c.floating;if(!R||!k||p==null||s==null||o==null)return;const{clientX:M,clientY:A}=T,I=Nr(T),L=T.type==="mouseleave",D=Je(k,I),P=Je(R,I);if(D&&(y=!0,!L))return;if(P&&(y=!1,!L)){y=!0;return}if(L&&St(T.relatedTarget)&&Je(k,T.relatedTarget))return;function z(){return!!(h&&qa(h.nodesRef.current,f).length>0)}function $(){z()||C()}if(z())return;const j=R.getBoundingClientRect(),H=k.getBoundingClientRect(),B=s>H.right-H.width/2,V=o>H.bottom-H.height/2,G=H.width>j.width,q=H.height>j.height,K=(G?j:H).left,W=(G?j:H).right,ee=(q?j:H).top,ce=(q?j:H).bottom;if(p==="top"&&o>=j.bottom-1||p==="bottom"&&o<=j.top+1||p==="left"&&s>=j.right-1||p==="right"&&s<=j.left+1){$();return}let F=!1;switch(p){case"top":F=I0(M,A,K,j.top+1,W,H.bottom-1);break;case"bottom":F=I0(M,A,K,H.top+1,W,j.bottom-1);break;case"left":F=I0(M,A,H.right-1,ce,j.left+1,ee);break;case"right":F=I0(M,A,j.right-1,ce,H.left+1,ee);break}if(F)return;if(y&&!MJ(M,A,j)){$();return}if(!L&&E(M,A)){$();return}let X=!1;switch(p){case"top":{const te=G?Qt/2:Qt*4,Z=G||B?s+te:s-te,Y=G?s-te:B?s+te:s-te,le=o+Qt+1,xe=B||G?H.bottom-Qt:H.top,fe=B?G?H.bottom-Qt:H.top:H.bottom-Qt;X=M0(M,A,Z,le,Y,le,H.left,xe,H.right,fe);break}case"bottom":{const te=G?Qt/2:Qt*4,Z=G||B?s+te:s-te,Y=G?s-te:B?s+te:s-te,le=o-Qt,xe=B||G?H.top+Qt:H.bottom,fe=B?G?H.top+Qt:H.bottom:H.top+Qt;X=M0(M,A,Z,le,Y,le,H.left,xe,H.right,fe);break}case"left":{const te=q?Qt/2:Qt*4,Z=q||V?o+te:o-te,Y=q?o-te:V?o+te:o-te,le=s+Qt+1,xe=V||q?H.right-Qt:H.left,fe=V?q?H.right-Qt:H.left:H.right-Qt;X=M0(M,A,xe,H.top,fe,H.bottom,le,Z,le,Y);break}case"right":{const te=q?Qt/2:Qt*4,Z=q||V?o+te:o-te,Y=q?o-te:V?o+te:o-te,le=s-Qt,xe=V||q?H.left+Qt:H.right,fe=V?q?H.left+Qt:H.right:H.left+Qt;X=M0(M,A,le,Z,le,Y,xe,H.top,fe,H.bottom);break}}X?y||n.start(40,$):$()}};return r.__options={...e,blockPointerEvents:t},r}const IJ=N.createContext(void 0);function hz(e){return N.useContext(IJ)}const OE="ArrowUp",RE="ArrowDown",AE="ArrowLeft",kE="ArrowRight",_E="Home",ME="End",ab=new Set([OE,RE,AE,kE,_E,ME]),LJ="Shift",DJ=[LJ,"Control","Alt","Meta"];function jJ(e){return Yt(e)&&e.tagName==="INPUT"}function LM(e){return!!(jJ(e)&&e.selectionStart!=null||Yt(e)&&e.tagName==="TEXTAREA")}function DM(e,t,n,r){if(!e||!t||!t.scrollTo)return;let s=e.scrollLeft,o=e.scrollTop;const l=e.clientWidth<e.scrollWidth,c=e.clientHeight<e.scrollHeight;if(l&&r!=="vertical"){const u=jM(e,t,"left"),f=L0(e),h=L0(t);n==="ltr"&&(u+t.offsetWidth+h.scrollMarginRight>e.scrollLeft+e.clientWidth-f.scrollPaddingRight?s=u+t.offsetWidth+h.scrollMarginRight-e.clientWidth+f.scrollPaddingRight:u-h.scrollMarginLeft<e.scrollLeft+f.scrollPaddingLeft&&(s=u-h.scrollMarginLeft-f.scrollPaddingLeft)),n==="rtl"&&(u-h.scrollMarginLeft<e.scrollLeft+f.scrollPaddingLeft?s=u-h.scrollMarginLeft-f.scrollPaddingLeft:u+t.offsetWidth+h.scrollMarginRight>e.scrollLeft+e.clientWidth-f.scrollPaddingRight&&(s=u+t.offsetWidth+h.scrollMarginRight-e.clientWidth+f.scrollPaddingRight))}if(c&&r!=="horizontal"){const u=jM(e,t,"top"),f=L0(e),h=L0(t);u-h.scrollMarginTop<e.scrollTop+f.scrollPaddingTop?o=u-h.scrollMarginTop-f.scrollPaddingTop:u+t.offsetHeight+h.scrollMarginBottom>e.scrollTop+e.clientHeight-f.scrollPaddingBottom&&(o=u+t.offsetHeight+h.scrollMarginBottom-e.clientHeight+f.scrollPaddingBottom)}e.scrollTo({left:s,top:o,behavior:"auto"})}function jM(e,t,n){const r=n==="left"?"offsetLeft":"offsetTop";let s=0;for(;t.offsetParent&&(s+=t[r],t.offsetParent!==e);)t=t.offsetParent;return s}function L0(e){const t=getComputedStyle(e);return{scrollMarginTop:parseFloat(t.scrollMarginTop)||0,scrollMarginRight:parseFloat(t.scrollMarginRight)||0,scrollMarginBottom:parseFloat(t.scrollMarginBottom)||0,scrollMarginLeft:parseFloat(t.scrollMarginLeft)||0,scrollPaddingTop:parseFloat(t.scrollPaddingTop)||0,scrollPaddingRight:parseFloat(t.scrollPaddingRight)||0,scrollPaddingBottom:parseFloat(t.scrollPaddingBottom)||0,scrollPaddingLeft:parseFloat(t.scrollPaddingLeft)||0}}function Mm(e){return e==="starting"?uZ:hn}const dT=N.forwardRef(function(t,n){const{render:r,className:s,style:o,finalFocus:l,...c}=t,{store:u}=hl(),{side:f,align:h}=qx(),p=hz()!=null,y=u.useState("open"),x=u.useState("transitionStatus"),b=u.useState("popupProps"),S=u.useState("mounted"),E=u.useState("instantType"),C=u.useState("activeTriggerElement"),O=u.useState("parent"),T=u.useState("lastOpenChangeReason"),R=u.useState("rootId"),k=u.useState("floatingRootContext"),M=u.useState("floatingTreeRoot"),A=u.useState("closeDelay"),I=u.useState("hoverEnabled"),L=u.useState("disabled"),D=u.useState("openMethod"),P=O.type==="context-menu";Ya({open:y,ref:u.context.popupRef,onComplete(){var B,V;y&&((V=(B=u.context).onOpenChangeComplete)==null||V.call(B,!0))}}),N.useEffect(()=>{function B(V){u.setOpen(!1,ct(V.reason,V.domEvent))}return M.events.on("close",B),()=>{M.events.off("close",B)}},[M.events,u]),ib(k,{enabled:I&&!L&&!P&&O.type!=="menubar",closeDelay:A});const z=u.useStateSetter("popupElement"),$={transitionStatus:x,side:f,align:h,open:y,nested:O.type==="menu",instant:E},j=Lt("div",t,{state:$,ref:[n,u.context.popupRef,z],stateAttributesMapping:hm,props:[b,{onKeyDown(B){p&&ab.has(B.key)&&B.stopPropagation()}},Mm(x),c,{"data-rootownerid":R}]});let H=O.type===void 0||P;return(C||O.type==="menubar"&&T!==P2)&&(H=!0),m.jsx(rT,{context:k,openInteractionType:D,modal:P,disabled:!S,returnFocus:l===void 0?H:l,initialFocus:O.type!=="menu",restoreFocus:!0,externalTree:O.type!=="menubar"?M:void 0,previousFocusableElement:C,nextFocusableElement:O.type===void 0?u.context.triggerFocusTargetRef:void 0,beforeContentFocusGuardRef:O.type===void 0?u.context.beforeContentFocusGuardRef:void 0,children:j})}),pz=N.createContext(void 0);function PJ(){const e=N.useContext(pz);if(e===void 0)throw new Error(Wt(32));return e}const fT=N.forwardRef(function(t,n){const{keepMounted:r=!1,...s}=t,{store:o,parent:l}=hl();if(!(o.useState("mounted")||r))return null;const f=l.type==="menu"||l.type==="menubar"?"group":void 0;return m.jsx(pz.Provider,{value:r,children:m.jsx(eT,{ref:n,...s,portalOwnerRole:f})})});function hT(e){return O2(19)?e:e?"true":void 0}const zJ=N.createContext(void 0);function pT(){const e=N.useContext(zJ);return(e==null?void 0:e.direction)??"ltr"}const BJ=e=>({name:"arrow",options:e,async fn(t){var q,K;const{x:n,y:r,placement:s,rects:o,platform:l,elements:c,middlewareData:u}=t,{element:f,padding:h=0,offsetParent:p="real"}=Va(e,t)||{};if(f==null)return{};const y=A5(h),x={x:n,y:r},b=X2(s),S=W2(b),E=await l.getDimensions(f),C=b==="y",O=C?"top":"left",T=C?"bottom":"right",R=C?"clientHeight":"clientWidth",k=o.reference[S]+o.reference[b]-x[b]-o.floating[S],M=x[b]-o.reference[b],A=p==="real"?await((q=l.getOffsetParent)==null?void 0:q.call(l,f)):c.floating;let I=c.floating[R]||o.floating[S];(!I||!await((K=l.isElement)==null?void 0:K.call(l,A)))&&(I=c.floating[R]||o.floating[S]);const L=k/2-M/2,D=I/2-E[S]/2-1,P=Math.min(y[O],D),z=Math.min(y[T],D),$=P,j=I-E[S]-z,H=I/2-E[S]/2+L,B=R5($,H,j),V=!u.arrow&&cl(s)!=null&&H!==B&&o.reference[S]/2-(H<$?P:z)-E[S]/2<0,G=V?H<$?H-$:H-j:0;return{[b]:x[b]+G,data:{[b]:B,centerOffset:H-B-G,...V&&{alignmentOffset:G}},reset:V}}}),HJ=(e,t)=>{const{name:n,fn:r}=BJ(e);return{name:n,fn:r,options:[e,t]}},FJ={name:"hide",async fn(e){const{width:t,height:n,x:r,y:s}=e.rects.reference,o=t===0&&n===0&&r===0&&s===0,l=await e.platform.detectOverflow(e,{elementContext:"reference"});return{data:{referenceHidden:l.top-n>=0||l.right-t>=0||l.bottom-n>=0||l.left-t>=0||o}}}},$J={sideX:"left",sideY:"top"},UJ="--available-width",VJ="--available-height",qJ="--anchor-width",GJ="--anchor-height",KJ="--transform-origin",PM=UJ,zM=VJ;function mz(e,t,n){const r=e==="inline-start"||e==="inline-end";return{top:"top",right:r?n?"inline-start":"inline-end":"right",bottom:"bottom",left:r?n?"inline-end":"inline-start":"left"}[t]}function BM(e,t,n){const{rects:r,placement:s}=e;return{side:mz(t,oo(s),n),align:cl(s)||"center",anchor:{width:r.reference.width,height:r.reference.height},positioner:{width:r.floating.width,height:r.floating.height}}}function cb(e){return YJ(e,EJ)}function YJ(e,t){var Es,qn;const{anchor:n,positionMethod:r="absolute",side:s="bottom",sideOffset:o=0,align:l="center",alignOffset:c=0,collisionBoundary:u,collisionPadding:f=5,sticky:h=!1,arrowPadding:p=5,disableAnchorTracking:y=!1,inline:x,keepMounted:b=!1,floatingRootContext:S,mounted:E,collisionAvoidance:C,shift:O,nodeId:T,adaptiveOrigin:R,lazyFlip:k=!1,externalTree:M}=e,[A,I]=N.useState(null);!E&&A!==null&&I(null);const L=C.side||"flip",D=C.align||"flip",P=C.fallbackAxisSide||"end",z=(O==null?void 0:O.crossAxis)??!1,$=O==null?void 0:O.rootBoundary,j=typeof n=="function"?n:void 0,H=Ve(j),B=j?H:n,V=In(n),G=In(E),K=pT()==="rtl",W=A||{top:"top",right:"right",bottom:"bottom",left:"left","inline-end":K?"left":"right","inline-start":K?"right":"left"}[s],ee=l==="center"?W:`${W}-${l}`;let ce=f;typeof ce=="number"?ce={top:ce,right:ce,bottom:ce,left:ce}:ce&&(ce={top:ce.top||0,right:ce.right||0,bottom:ce.bottom||0,left:ce.left||0});const F=1,X=s==="bottom"?F:0,te=s==="top"?F:0,Z=s==="right"?F:0,Y=s==="left"?F:0,le={boundary:u==="clipping-ancestors"?"clippingAncestors":u,padding:ce},xe=N.useRef(null),fe=In(o),oe=In(c),re=typeof o!="function"?o:0,he=typeof c!="function"?c:0,Se=[];x&&Se.push(x),Se.push(eJ(yt=>{const un=BM(yt,s,K),Gn=typeof fe.current=="function"?fe.current(un):fe.current,Rn=typeof oe.current=="function"?oe.current(un):oe.current;return{mainAxis:Gn,crossAxis:Rn,alignmentAxis:Rn}},[re,he,K,s]));const ke=D==="none"&&L!=="shift",be=!ke&&(h||z||L==="shift"),_e=L==="none"?null:rJ({...le,padding:{top:ce.top+F+X,right:ce.right+F+Y,bottom:ce.bottom+F+te,left:ce.left+F+Z},mainAxis:!z&&L==="flip",crossAxis:D==="flip"?"alignment":!1,fallbackAxisSideDirection:P}),Me=ke?null:tJ({...le,rootBoundary:$,mainAxis:D!=="none",crossAxis:be,limiter:h||z?void 0:nJ(yt=>{if(!xe.current)return{};const{width:un,height:Gn}=xe.current.getBoundingClientRect(),Rn=so(oo(yt.placement)),An=Rn==="y"?un:Gn,Ht=Rn==="y"?ce.left+ce.right:ce.top+ce.bottom;return{offset:An/2+Ht/2}})},[le,h,z,$,ce,D]);L==="shift"||D==="shift"||l==="center"?Se.push(Me,_e):Se.push(_e,Me),Se.push(sJ({...le,apply({elements:{floating:yt},availableWidth:un,availableHeight:Gn,rects:Rn}){if(!G.current)return;const An=yt.style;An.setProperty(PM,`${un}px`),An.setProperty(zM,`${Gn}px`);const Ht=pn(yt).devicePixelRatio||1,{x:Zt,y:Jt,width:Ur,height:Kn}=Rn.reference,Ln=(Math.round((Zt+Ur)*Ht)-Math.round(Zt*Ht))/Ht,ur=(Math.round((Jt+Kn)*Ht)-Math.round(Jt*Ht))/Ht;An.setProperty(qJ,`${Ln}px`),An.setProperty(GJ,`${ur}px`)}}),HJ(yt=>({element:xe.current||jt(yt.elements.floating).createElement("div"),padding:xe.current?p:0,offsetParent:"floating"}),[p]),{name:"transformOrigin",fn(yt){var as,Ar,kr,cs,fo,hr;const{elements:{floating:un},middlewareData:Gn,placement:Rn,platform:An,rects:Ht,y:Zt}=yt,Jt=oo(Rn),Ur=cl(Rn),Kn=so(Jt)==="y",Ln=xe.current,ur=typeof o=="function"?o(BM(yt,s,K)):o;let dr;if(!Ln&&Ur&&Math.abs(Kn?((as=Gn.shift)==null?void 0:as.x)||0:((Ar=Gn.shift)==null?void 0:Ar.y)||0)<=1)dr=Ur==="start"===(Kn&&((kr=An.isRTL)==null?void 0:kr.call(An,un))===!0)?"100%":"0%";else{const Do=Kn?((cs=Gn.arrow)==null?void 0:cs.x)||0:((fo=Gn.arrow)==null?void 0:fo.y)||0,Cs=Kn?(Ln==null?void 0:Ln.clientWidth)||0:(Ln==null?void 0:Ln.clientHeight)||0;dr=`${Do+Cs/2}px`}let fr=Jt==="top"||Jt==="left"?`calc(100% + ${ur}px)`:`${-ur}px`;return be&&Kn&&Math.abs(((hr=Gn.shift)==null?void 0:hr.y)||0)>ur&&(fr=`${Ht.reference.y+Ht.reference.height/2-Zt}px`),un.style.setProperty(KJ,Kn?`${dr} ${fr}`:`${fr} ${dr}`),{}}},FJ,R),Be(()=>{!E&&S&&S.update({referenceElement:null,floatingElement:null,domReferenceElement:null,positionReference:null})},[E,S]);const Le=N.useMemo(()=>({ancestorScroll:!y,elementResize:!y&&typeof ResizeObserver<"u",layoutShift:!y&&typeof IntersectionObserver<"u"}),[y]),{refs:Pe,elements:pe,x:Ae,y:Ee,middlewareData:je,update:Oe,placement:ve,context:Fe,isPositioned:Ye,floatingStyles:xt}=t({rootContext:S,open:b?E:void 0,placement:ee,middleware:Se,strategy:r,whileElementsMounted:b?void 0:(...yt)=>OM(...yt,Le),nodeId:T,externalTree:M}),{sideX:nn,sideY:Te}=je.adaptiveOrigin||$J,De=Ye?r:"fixed",tt=N.useMemo(()=>{let yt;return Ye?R?yt={position:De,[nn]:Ae,[Te]:Ee}:yt={...xt,position:De}:yt={position:De,top:0,left:0},yt[PM]="100vw",yt[zM]="100vh",Ye||(yt.opacity=0),yt},[R,De,nn,Ae,Te,Ee,xt,Ye]),At=N.useRef(null);Be(()=>{if(!E)return;const yt=V.current,un=typeof yt=="function"?yt():yt,Rn=(HM(un)?un.current:un)||null||null;Rn!==At.current&&(Pe.setPositionReference(Rn),At.current=Rn)},[E,Pe,B,V]),N.useEffect(()=>{if(!E)return;const yt=V.current;typeof yt!="function"&&HM(yt)&&yt.current!==At.current&&(Pe.setPositionReference(yt.current),At.current=yt.current)},[E,Pe,B,V]),N.useEffect(()=>{if(b&&E&&pe.reference&&pe.floating)return OM(pe.reference,pe.floating,Oe,Le)},[b,E,pe,Oe,Le]);const gn=oo(ve),yn=mz(s,gn,K),Fr=cl(ve)||"center",cn=!!((Es=je.hide)!=null&&Es.referenceHidden);Be(()=>{k&&E&&Ye&&gn!==W&&I(gn)},[k,E,Ye,gn,W]);const cr=N.useMemo(()=>{var yt,un;return{position:"absolute",top:(yt=je.arrow)==null?void 0:yt.y,left:(un=je.arrow)==null?void 0:un.x}},[je.arrow]),$r=((qn=je.arrow)==null?void 0:qn.centerOffset)!==0;return N.useMemo(()=>({positionerStyles:tt,arrowStyles:cr,arrowRef:xe,arrowUncentered:$r,side:yn,align:Fr,physicalSide:gn,anchorHidden:cn,refs:Pe,context:Fe,isPositioned:Ye,update:Oe}),[tt,cr,xe,$r,yn,Fr,gn,cn,Pe,Fe,Ye,Oe])}function HM(e){return e!=null&&"current"in e}function gz(e){const{children:t,elementsRef:n,labelsRef:r,onMapChange:s}=e,o=Ve(s),[,l]=N.useState(!1),c=Rr(XJ).current,u=Rr(WJ).current,f=N.useRef(0),h=N.useRef(!0),p=N.useRef(null),y=N.useRef(null),x=Ve(()=>{h.current||(h.current=!0,l(k=>!k))}),b=Ve((k,M)=>{u.set(k,M),x()}),S=Ve(k=>{u.delete(k),x()}),E=Ve(k=>{const M=new Map;return n.current.length=0,r&&(r.current.length=0),k.forEach(A=>{var I,L;M.set(A.element,{...A.registration.metadata??{},index:A.index}),n.current[A.index]=A.element,r&&(r.current[A.index]=A.registration.label!==void 0?A.registration.label:((L=(I=A.registration.textRef)==null?void 0:I.current)==null?void 0:L.textContent)??A.element.textContent)}),f.current=n.current.length,M});function C(k){var I;if((I=y.current)==null||I.disconnect(),y.current=null,typeof MutationObserver!="function"||k.length<2)return;const M=new MutationObserver(L=>{if(!JJ(L))return;let D=null;for(const P of k)if(P.isConnected){if(D&&yz(D,P)>0){M.disconnect(),x();return}D=P}});y.current=M;const A=new Set;for(let L=1;L<k.length;L+=1){const D=ZJ(k[L-1],k[L]);D&&A.add(D)}A.forEach(L=>M.observe(L,{childList:!0}))}const O=Ve(()=>{const[k,M]=QJ(u),A=E(k),I=p.current,L=!I||I.length!==k.length||k.some((D,P)=>{const z=I[P];return D.index!==z.index||D.element!==z.element||D.registration.index!==z.registration.index||D.registration.metadata!==z.registration.metadata});C(M),p.current=k,h.current=!1,L&&(c.forEach(D=>D(A)),o(A))});Be(()=>(!h.current&&p.current&&E(p.current),()=>{n.current=[],r&&(r.current=[])}),[n,r,E]),Be(()=>{h.current&&O()}),Be(()=>()=>{var k;(k=y.current)==null||k.disconnect(),h.current=!0},[]);const T=Ve(k=>(c.add(k),()=>{c.delete(k)})),R=N.useMemo(()=>({register:b,unregister:S,subscribeMapChange:T,nextIndexRef:f}),[b,S,T,f]);return m.jsx(b5.Provider,{value:R,children:t})}function WJ(){return new Map}function XJ(){return new Set}function QJ(e){const t=new Set,n=[],r=[];e.forEach((o,l)=>{if(!l.isConnected)return;const c=o.index,u={index:c??-1,element:l,registration:o};c===null?r.push(u):c>=0&&(t.add(c),n.push(u))});let s=0;return r.sort((o,l)=>yz(o.element,l.element)),r.forEach(o=>{for(;t.has(s);)s+=1;o.index=s,n.push(o),s+=1}),t.size>0&&n.sort((o,l)=>o.index-l.index),[n,r.map(o=>o.element)]}function ZJ(e,t){let n=e.parentElement;for(;n&&!n.contains(t);)n=n.parentElement;return n}function JJ(e){for(const t of e)for(let n=0;n<t.removedNodes.length;n+=1)if(t.removedNodes[n].isConnected)return!0;return!1}function yz(e,t){return e.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_FOLLOWING?-1:1}const mT=N.forwardRef(function(t,n){const{cutout:r,...s}=t;let o;if(r){const l=r.getBoundingClientRect();o=`polygon(0% 0%,100% 0%,100% 100%,0% 100%,0% 0%,${l.left}px ${l.top}px,${l.left}px ${l.bottom}px,${l.right}px ${l.bottom}px,${l.right}px ${l.top}px,${l.left}px ${l.top}px)`}return m.jsx("div",{ref:n,role:"presentation","data-base-ui-inert":"",...s,style:{position:"fixed",inset:0,userSelect:"none",WebkitUserSelect:"none",clipPath:o}})});function ub(e,t,{styles:n,transitionStatus:r,props:s,refs:o,hidden:l,inert:c=!1}){const u={...n};return c&&(u.pointerEvents="none"),Lt("div",e,{state:t,ref:o,props:[{role:"presentation",hidden:l,style:u},Mm(r),s],stateAttributesMapping:Af})}let FM={},$M={},UM="";function db(e,t){return um(e)?e:t}function VM(e,t,n){return/hidden|clip/.test(e.getComputedStyle(db(t,n)).overflowY)}function eee(e){if(typeof document>"u")return!1;const t=jt(e);return pn(t).innerWidth-t.documentElement.clientWidth>0}function tee(e){if(!(typeof CSS<"u"&&CSS.supports&&CSS.supports("scrollbar-gutter","stable"))||typeof document>"u")return!1;const n=jt(e),r=n.documentElement,s=n.body,o=db(r,s),l=o.style.overflowY,c=r.style.scrollbarGutter;r.style.scrollbarGutter="stable",o.style.overflowY="scroll";const u=o.offsetWidth;o.style.overflowY="hidden";const f=o.offsetWidth;return o.style.overflowY=l,r.style.scrollbarGutter=c,u===f}function nee(e){const t=jt(e),n=t.documentElement,r=t.body,s=db(n,r),o={overflowY:s.style.overflowY,overflowX:s.style.overflowX};return Object.assign(s.style,{overflowY:"hidden",overflowX:"hidden"}),()=>{Object.assign(s.style,o)}}function ree(e){var x;const t=jt(e),n=t.documentElement,r=t.body,s=pn(n);let o=0,l=0,c=!1;const u=xs.create();if(Ka&&(((x=s.visualViewport)==null?void 0:x.scale)??1)!==1)return()=>{};function f(){const b=s.getComputedStyle(n),S=s.getComputedStyle(r),O=(b.scrollbarGutter||"").includes("both-edges")?"stable both-edges":"stable";o=n.scrollTop,l=n.scrollLeft,FM={scrollbarGutter:n.style.scrollbarGutter,overflowY:n.style.overflowY,overflowX:n.style.overflowX},UM=n.style.scrollBehavior,$M={position:r.style.position,height:r.style.height,width:r.style.width,boxSizing:r.style.boxSizing,overflowY:r.style.overflowY,overflowX:r.style.overflowX,scrollBehavior:r.style.scrollBehavior};const T=n.scrollHeight>n.clientHeight,R=n.scrollWidth>n.clientWidth,k=b.overflowY==="scroll"||S.overflowY==="scroll",M=b.overflowX==="scroll"||S.overflowX==="scroll",A=Math.max(0,s.innerWidth-r.clientWidth),I=Math.max(0,s.innerHeight-r.clientHeight),L=parseFloat(S.marginTop)+parseFloat(S.marginBottom),D=parseFloat(S.marginLeft)+parseFloat(S.marginRight),P=db(n,r);if(c=tee(e),c){n.style.scrollbarGutter=O,P.style.overflowY="hidden",P.style.overflowX="hidden";return}Object.assign(n.style,{scrollbarGutter:O,overflowY:"hidden",overflowX:"hidden"}),(T||k)&&(n.style.overflowY="scroll"),(R||M)&&(n.style.overflowX="scroll"),Object.assign(r.style,{position:"relative",height:L||I?`calc(100dvh - ${L+I}px)`:"100dvh",width:D||A?`calc(100vw - ${D+A}px)`:"100vw",boxSizing:"border-box",overflowY:"hidden",overflowX:"hidden",scrollBehavior:"unset"}),r.scrollTop=o,r.scrollLeft=l,n.setAttribute("data-base-ui-scroll-locked",""),n.style.scrollBehavior="unset"}function h(){Object.assign(n.style,FM),Object.assign(r.style,$M),c||(n.scrollTop=o,n.scrollLeft=l,n.removeAttribute("data-base-ui-scroll-locked"),n.style.scrollBehavior=UM)}function p(){h(),u.request(f)}f();const y=bt(s,"resize",p);return()=>{u.cancel(),h(),typeof s.removeEventListener=="function"&&y()}}class see{constructor(){Ot(this,"lockCount",0);Ot(this,"restore",null);Ot(this,"timeoutLock",co.create());Ot(this,"timeoutUnlock",co.create());Ot(this,"release",()=>{this.lockCount-=1,this.lockCount===0&&this.restore&&this.timeoutUnlock.start(0,this.unlock)});Ot(this,"unlock",()=>{var t;this.lockCount===0&&this.restore&&((t=this.restore)==null||t.call(this),this.restore=null)})}acquire(t){return this.lockCount+=1,this.lockCount===1&&this.restore===null&&this.timeoutLock.start(0,()=>this.lock(t)),this.release}lock(t){if(this.lockCount===0||this.restore!==null)return;const n=jt(t),r=n.documentElement,s=n.body,o=pn(r);if(VM(o,r,s)){const c=new o.MutationObserver(()=>{VM(o,r,s)||(c.disconnect(),this.restore=null,this.lock(t))}),u={attributes:!0};c.observe(r,u),c.observe(s,u),this.restore=()=>c.disconnect();return}const l=Kx||!eee(t);this.restore=l?nee(t):ree(t)}}const oee=new see;function xz(e=!0,t=null){Be(()=>{if(e)return oee.acquire(t)},[e,t])}const iee=20;function bz(e,t,n,r){const[s,o]=N.useState(!1);Be(()=>{if(!e||!t||n==null){o(!1);return}const l=jt(n).documentElement.clientWidth,c=n.offsetWidth;o(l>0&&c>0&&c>=l-iee)},[e,t,n]),xz(e&&(!t||s),r)}const gT=N.forwardRef(function(t,n){var Le;const{anchor:r,positionMethod:s="absolute",className:o,render:l,side:c,align:u,sideOffset:f=0,alignOffset:h=0,collisionBoundary:p="clipping-ancestors",collisionPadding:y=5,arrowPadding:x=5,sticky:b=!1,disableAnchorTracking:S=!1,collisionAvoidance:E=dZ,style:C,...O}=t,{store:T}=hl(),R=PJ(),k=j2(!0),M=T.useState("parent"),A=T.useState("floatingRootContext"),I=T.useState("floatingTreeRoot"),L=T.useState("mounted"),D=T.useState("open"),P=T.useState("modal"),z=T.useState("openMethod"),$=T.useState("activeTriggerElement"),j=T.useState("transitionStatus"),H=T.useState("positionerElement"),B=T.useState("instantType"),V=T.useState("adaptiveOrigin"),G=T.useState("lastOpenChangeReason"),q=T.useState("floatingNodeId"),K=T.useState("floatingParentNodeId"),W=A.useState("domReferenceElement"),ee=N.useRef(null),ce=gm(H);let F=r,X=f,te=h,Z=u,Y=E;M.type==="context-menu"&&(F=r??((Le=M.context)==null?void 0:Le.anchor),Z=Z??"start",!c&&Z!=="center"&&(te=t.alignOffset??2,X=t.sideOffset??-5));let le=c,xe=Z;M.type==="menu"?(le=le??"inline-end",xe=xe??"start",Y=t.collisionAvoidance??Jx):M.type==="menubar"&&(le=le??(M.context.orientation==="vertical"?"inline-end":"bottom"),xe=xe??"start");const fe=M.type==="context-menu",oe=cb({anchor:F,floatingRootContext:A,positionMethod:k?"fixed":s,mounted:L,side:le,sideOffset:X,align:xe,alignOffset:te,arrowPadding:fe?0:x,collisionBoundary:p,collisionPadding:y,sticky:b,nodeId:q,keepMounted:R,disableAnchorTracking:S,collisionAvoidance:Y,shift:fe?{crossAxis:!("side"in Y&&Y.side==="flip"),rootBoundary:"layoutViewport"}:void 0,externalTree:I,adaptiveOrigin:V});N.useEffect(()=>{function Pe(pe){pe.open&&(pe.parentNodeId===q&&T.set("hoverEnabled",!1),pe.nodeId!==q&&pe.parentNodeId===T.select("floatingParentNodeId")&&T.setOpen(!1,ct(Rd)))}return I.events.on("menuopenchange",Pe),()=>{I.events.off("menuopenchange",Pe)}},[T,I.events,q]),N.useEffect(()=>{if(T.select("floatingParentNodeId")==null)return;function Pe(pe){if(pe.open||pe.nodeId!==T.select("floatingParentNodeId"))return;const Ae=pe.reason??Rd;T.setOpen(!1,ct(Ae))}return I.events.on("menuopenchange",Pe),()=>{I.events.off("menuopenchange",Pe)}},[I.events,T]);const re=ns();N.useEffect(()=>{D||re.clear()},[D,re]),N.useEffect(()=>{function Pe(pe){if(!(!D||pe.nodeId!==T.select("floatingParentNodeId")))if(pe.target&&$&&$!==pe.target){const Ae=T.select("closeDelay");Ae>0?re.isStarted()||re.start(Ae,()=>{T.setOpen(!1,ct(Rd))}):T.setOpen(!1,ct(Rd))}else re.clear()}return I.events.on("itemhover",Pe),()=>{I.events.off("itemhover",Pe)}},[I.events,D,$,T,re]),N.useEffect(()=>{const Pe={open:D,nodeId:q,parentNodeId:K,reason:T.select("lastOpenChangeReason")};I.events.emit("menuopenchange",Pe)},[I.events,D,T,q,K]),Be(()=>{const Pe=W,pe=ee.current;if(Pe&&(ee.current=Pe),pe&&Pe&&Pe!==pe){T.set("instantType",void 0);const Ae=new AbortController;return ce(()=>{T.set("instantType","trigger-change")},Ae.signal),()=>{Ae.abort()}}},[W,ce,T]);const he={open:D,side:oe.side,align:oe.align,anchorHidden:oe.anchorHidden,nested:M.type==="menu",instant:B},Se=M.type==="menubar"&&M.context.modal;bz(D&&(Se||P&&G!==wn),z==="touch",H,$);const be=ub(t,he,{styles:oe.positionerStyles,transitionStatus:j,props:O,refs:[n,T.useStateSetter("positionerElement")],hidden:!L,inert:!D}),_e=L&&M.type!=="menu"&&(M.type!=="menubar"&&P&&G!==wn||M.type==="menubar"&&M.context.modal);let Me=null;return M.type==="menubar"?Me=M.context.contentElement:M.type===void 0&&(Me=$),m.jsxs(f5.Provider,{value:oe,children:[_e&&m.jsx(mT,{ref:M.type==="context-menu"||M.type==="nested-context-menu"?M.context.internalBackdropRef:null,inert:hT(!D),cutout:Me}),m.jsx(eb,{id:q,children:m.jsx(gz,{elementsRef:T.context.itemDomElements,labelsRef:T.context.itemLabels,children:be})})]})}),vz=N.createContext(null);function yT(e){const t=N.useContext(vz);if(t===null&&!e)throw new Error(Wt(5));return t}function lee(e){const t=N.useRef(""),n=N.useCallback(s=>{s.defaultPrevented||(t.current=s.pointerType,e(s,s.pointerType))},[e]);return{onClick:N.useCallback(s=>{if(s.detail===0){e(s,"keyboard");return}"pointerType"in s?e(s,s.pointerType):e(s,t.current),t.current=""},[e]),onPointerDown:n}}function Sz(e,t){const n=N.useRef(e),r=Ve(t);Be(()=>{n.current!==e&&r(n.current),n.current=e},[e,r])}function xT(e,t){const n=Ve((o,l)=>{(typeof e=="function"?e():e)||t(l||(Kx?"touch":""))}),{onClick:r,onPointerDown:s}=lee(n);return N.useMemo(()=>({onClick:r,onPointerDown:s}),[r,s])}function aee(e){const[t,n]=N.useState(null),r=xT(e,n);return Sz(e,s=>{s&&!e&&n(null)}),N.useMemo(()=>({openMethod:t,triggerProps:r}),[t,r])}class cee extends Cu{setState(t){}update(t){}set(t,n){}notifyAll(){}}const uee={...Rm,disabled:e=>e.parent.type==="menubar"&&e.parent.context.disabled||e.disabled,modal:e=>(e.parent.type===void 0||e.parent.type==="context-menu")&&(e.modal??!0),openMethod:e=>e.openMethod,allowMouseEnter:e=>e.allowMouseEnter,highlightItemOnHover:e=>e.highlightItemOnHover,parent:e=>e.parent,rootId:e=>e.parent.type==="menu"?e.parent.store.select("rootId"):e.parent.type!==void 0?e.parent.context.rootId:e.rootId,activeIndex:e=>e.activeIndex,isActive:(e,t)=>e.activeIndex===t,hoverEnabled:e=>e.hoverEnabled,instantType:e=>e.instantType,lastOpenChangeReason:e=>e.openChangeReason,floatingTreeRoot:e=>e.parent.type==="menu"?e.parent.store.select("floatingTreeRoot"):e.floatingTreeRoot,floatingNodeId:e=>e.floatingNodeId,floatingParentNodeId:e=>e.floatingParentNodeId,itemProps:e=>e.itemProps,closeDelay:e=>e.closeDelay,adaptiveOrigin:e=>e.adaptiveOrigin,keyboardEventRelay:e=>{if(e.keyboardEventRelay)return e.keyboardEventRelay;if(e.parent.type==="menu")return e.parent.store.select("keyboardEventRelay")}};class dee extends Cu{constructor(n,r,s=!1){const o=new _f,l=hee(o,r,s,n);super(l,fee(o),uee);Ot(this,"unsubscribeParentListener",null);this.unsubscribeParentListener=this.observe("parent",c=>{var u;if((u=this.unsubscribeParentListener)==null||u.call(this),c.type==="menu"){let f=c.store.select("rootId"),h=c.store.select("floatingTreeRoot"),p=c.store.select("keyboardEventRelay");this.unsubscribeParentListener=c.store.subscribe(()=>{const y=c.store.select("rootId"),x=c.store.select("floatingTreeRoot"),b=c.store.select("keyboardEventRelay");f===y&&h===x&&p===b||(f=y,h=x,p=b,this.notifyAll())}),this.context.allowMouseUpTriggerRef=c.store.context.allowMouseUpTriggerRef;return}c.type!==void 0&&(this.context.allowMouseUpTriggerRef=c.context.allowMouseUpTriggerRef),this.unsubscribeParentListener=null})}setOpen(n,r){this.state.floatingRootContext.context.events.emit("setOpen",{open:n,eventDetails:r})}}function fee(e){return{positionerRef:N.createRef(),popupRef:N.createRef(),typingRef:{current:!1},itemDomElements:{current:[]},itemLabels:{current:[]},allowMouseUpTriggerRef:{current:!1},triggerFocusTargetRef:N.createRef(),beforeContentFocusGuardRef:N.createRef(),onOpenChangeComplete:void 0,triggerElements:e}}function hee(e,t,n=!1,r){return{...Om(e,t,n),disabled:!1,modal:!0,openMethod:null,allowMouseEnter:!1,highlightItemOnHover:!0,parent:{type:void 0},rootId:void 0,activeIndex:null,hoverEnabled:!0,instantType:void 0,openChangeReason:null,floatingTreeRoot:new tT,floatingNodeId:void 0,floatingParentNodeId:null,itemProps:hn,keyboardEventRelay:void 0,closeDelay:0,adaptiveOrigin:void 0,...r}}const wz=N.createContext(void 0);function Ez(){return N.useContext(wz)}const bT=kf(function(t){const{children:n,open:r,onOpenChange:s,onOpenChangeComplete:o,defaultOpen:l=!1,disabled:c=!1,modal:u,loopFocus:f=!0,orientation:h="vertical",actionsRef:p,closeParentOnEsc:y=!1,handle:x,triggerId:b,defaultTriggerId:S=null,highlightItemOnHover:E=!0}=t,C=j2(!0),O=hl(!0),T=yT(!0),R=Ez(),k=N.useMemo(()=>R&&O?{type:"menu",store:O.store}:T?{type:"menubar",context:T}:C&&!O?{type:"context-menu",context:C}:{type:void 0},[C,O,T,R]),M=cf(),A=cf(),I=Eu(),L=k.type==="menu"?k.store:void 0,D=(r??l)&&(L==null?void 0:L.state.transitionStatus)==="starting",P=Rr(()=>D?L==null?void 0:L.state.instantType:void 0).current,z=pee({open:l,openProp:r,activeTriggerId:S,triggerIdProp:b,parent:k,disabled:c,highlightItemOnHover:E,modal:k.type===void 0?u:void 0,rootId:M,instantType:P},A,I!=null);z.useControlledProp("openProp",r),z.useControlledProp("triggerIdProp",b),z.useContextCallback("onOpenChangeComplete",o);const $=z.useState("floatingTreeRoot"),j=xm($),H=z.useState("open"),B=z.useState("activeTriggerElement"),V=z.useState("positionerElement"),G=z.useState("hoverEnabled"),q=z.useState("disabled"),K=z.useState("lastOpenChangeReason"),W=z.useState("parent"),ee=z.useState("activeIndex"),ce=z.useState("payload"),F=z.useState("floatingParentNodeId"),X=N.useRef(null),te=N.useRef(W.type!=="context-menu"),Z=ns(),Y=N.useRef(!0),le=ns(),xe=F!=null,{openMethod:fe,triggerProps:oe}=aee(H);z.useSyncedValues({disabled:c,highlightItemOnHover:E,modal:W.type===void 0?u:void 0,openMethod:fe,rootId:M}),Cm(z);const{forceUnmount:re,transitionStatus:he}=Tm(H,z,()=>{z.set("allowMouseEnter",!1)},D),Se=gm(z.context.popupRef);N.useEffect(()=>{if(P===void 0)return;const De=()=>{z.state.instantType===P&&z.set("instantType",void 0)};if(!H){De();return}if(he!==void 0)return;if(z.context.popupRef.current==null){De();return}const tt=new AbortController;return Se(De,tt.signal),()=>{tt.abort()}},[P,H,he,Se,z]),Be(()=>{C&&!O?z.update({parent:{type:"context-menu",context:C},floatingNodeId:j,floatingParentNodeId:I}):O&&z.update({floatingNodeId:j,floatingParentNodeId:I})},[C,O,j,I,z]),N.useEffect(()=>{if(H||(X.current=null),W.type==="context-menu"){if(!H){Z.clear(),te.current=!1;return}Z.start(500,()=>{te.current=!0})}},[Z,H,W.type]),Be(()=>{!H&&!G&&z.set("hoverEnabled",!0)},[H,G,z]);const ke=Ve((De,tt)=>{const At=tt.reason;if(!De&&!z.select("open")||H===De&&tt.trigger===B&&K===At)return;const gn=iT(tt);if(!De&&tt.trigger==null&&(tt.trigger=B??void 0),s==null||s(De,tt),tt.isCanceled)return;z.state.floatingRootContext.dispatchOpenChange(De,tt);const yn=tt.event;if(De===!1&&(yn==null?void 0:yn.type)==="click"&&yn.pointerType==="touch"&&!Y.current)return;De&&At===Pd?(Y.current=!1,le.start(300,()=>{Y.current=!0})):(Y.current=!0,le.clear());const Fr=(At===di||At===z2)&&yn.detail===0,cn=!De&&(At===mm||At==null);X.current=tt.event;const cr=ob(z.state,De,tt.trigger,gn());cr.openChangeReason=At,W.type==="menubar"&&(At===Pd||At===ou||At===wn||At===Ap||At===Rd)?cr.instantType="group":Fr||cn?cr.instantType=Fr?"click":"dismiss":cr.instantType=void 0,z.update(cr)}),be=iz({popupStore:z,floatingRootContext:z.state.floatingRootContext,floatingId:A,nested:I!=null,onOpenChange:ke}),_e=be.context.events;Be(()=>{const De=({open:tt,eventDetails:At})=>ke(tt,At);return _e.on("setOpen",De),()=>{_e==null||_e.off("setOpen",De)}},[_e,ke]);const Me=N.useCallback(()=>{z.setOpen(!1,ct(iu))},[z]);N.useImperativeHandle(p,()=>({unmount:re,close:Me}),[re,Me]);let Le;W.type==="context-menu"&&(Le=W.context),N.useImperativeHandle(Le==null?void 0:Le.positionerRef,()=>V,[V]),N.useImperativeHandle(Le==null?void 0:Le.actionsRef,()=>({setOpen:ke}),[ke]);const Pe=bm(be,{enabled:!q,bubbles:{escapeKey:y&&W.type==="menu"},outsidePress(){var De;return W.type!=="context-menu"||((De=X.current)==null?void 0:De.type)==="contextmenu"?!0:te.current},externalTree:xe?$:void 0}),pe=pT(),Ae=N.useCallback(De=>{z.select("activeIndex")!==De&&z.set("activeIndex",De)},[z]),Ee=AJ(be,{enabled:!q,listRef:z.context.itemDomElements,activeIndex:ee,nested:W.type!==void 0,loopFocus:f,orientation:h,parentOrientation:W.type==="menubar"?W.context.orientation:void 0,rtl:pe==="rtl",disabledIndices:Ha,onNavigate:Ae,openOnArrowKeyDown:W.type!=="context-menu",externalTree:xe?$:void 0,focusItemOnHover:E}),je=N.useCallback(De=>{z.context.typingRef.current=De},[z]),Oe=kJ(be,{enabled:!q,listRef:z.context.itemLabels,elementsRef:z.context.itemDomElements,activeIndex:ee,resetMs:cZ,onMatch:De=>{H&&De!==ee&&z.set("activeIndex",De)},onTyping:je}),ve=N.useMemo(()=>{const De=el(Oe.reference,Ee.reference,Pe.reference,{onMouseMove(){z.set("allowMouseEnter",!0)}},oe);return De["aria-haspopup"]="menu",De["aria-expanded"]=H,De},[z,Oe.reference,Ee.reference,Pe.reference,oe,H]),Fe=N.useMemo(()=>{const De=el(Ee.trigger,Pe.trigger,oe);return De["aria-haspopup"]="menu",De["aria-expanded"]=!1,De},[Ee.trigger,Pe.trigger,oe]);Rr(()=>(z.update({inactiveTriggerProps:Fe}),null));const Ye=N.useMemo(()=>el(Sm,{id:A,role:"menu","aria-orientation":h==="horizontal"?"horizontal":void 0,"aria-labelledby":B==null?void 0:B.id,onMouseMove(){z.set("allowMouseEnter",!0),W.type==="menu"&&z.set("hoverEnabled",!1)},onClick(){z.select("hoverEnabled")&&z.set("hoverEnabled",!1)},onKeyDown(De){const tt=z.select("keyboardEventRelay");tt&&!De.isPropagationStopped()&&tt(De)}},Oe.floating,Ee.floating,Pe.floating),[B,A,h,W.type,z,Oe.floating,Ee.floating,Pe.floating]),xt=Ee.item??hn;Nm(z,{floatingRootContext:be,activeTriggerProps:ve,inactiveTriggerProps:Fe,popupProps:Ye,itemProps:xt});const nn=N.useMemo(()=>({store:z,parent:k}),[z,k]),Te=m.jsxs(h5.Provider,{value:nn,children:[x&&m.jsx(wm,{handle:x,store:z}),typeof n=="function"?n({payload:ce}):n]});return W.type===void 0||W.type==="context-menu"?m.jsx(tb,{externalTree:$,children:Te}):Te});function pee(e,t,n){return Rr(()=>new dee(e,t,n)).current}function mee(e){const t=hl().store,n=N.useMemo(()=>({parentMenu:t}),[t]);return m.jsx(wz.Provider,{value:n,children:m.jsx(bT,{...e})})}const D0=5;function gee(e,t){const n=yee(t);return e.clientX>=n.left-D0&&e.clientX<=n.right+D0&&e.clientY>=n.top-D0&&e.clientY<=n.bottom+D0}function yee(e){const t=e.getBoundingClientRect(),n=pn(e);if(F2)return t;const r=n.getComputedStyle(e,"::before"),s=n.getComputedStyle(e,"::after");if(!(r.content!=="none"||s.content!=="none"))return t;const l=parseFloat(r.width)||0,c=parseFloat(r.height)||0,u=parseFloat(s.width)||0,f=parseFloat(s.height)||0,h=Math.max(t.width,l,u),p=Math.max(t.height,c,f),y=h-t.width,x=p-t.height;return{left:t.left-y/2,right:t.right+y/2,top:t.top-x/2,bottom:t.bottom+x/2}}function xee(e={}){const{highlightItemOnHover:t,highlightedIndex:n,onHighlightedIndexChange:r}=N2(),{ref:s,index:o}=Yx(e),l=n===o,c=N.useRef(null),u=Ba(s,c);return{compositeProps:{tabIndex:l?0:-1,onFocus(){r(o)},onMouseMove(){const h=c.current;if(!t||!h)return;const p=h.hasAttribute("disabled")||h.ariaDisabled==="true";!l&&!p&&h.focus()}},compositeRef:u,index:o}}function bee(e){const{render:t,className:n,style:r,state:s=hn,props:o=Ha,refs:l=Ha,metadata:c,stateAttributesMapping:u,tag:f="div",...h}=e,{compositeProps:p,compositeRef:y}=xee({metadata:c});return Lt(f,e,{state:s,ref:[y,...l],props:[p,...o,h],stateAttributesMapping:u})}function Cz(e){if(Yt(e)&&e.hasAttribute("data-rootownerid"))return e.getAttribute("data-rootownerid");if(!Ji(e))return Cz(al(e))}function Tz(e,t){const n=N.useRef(null);function r(o){Us.flushSync(()=>{e.setOpen(!1,ct(ou,o.nativeEvent,o.currentTarget))});const l=oZ(n.current);l==null||l.focus()}function s(o){var c;const l=e.select("positionerElement");if(l&&Bd(o,l))(c=e.context.beforeContentFocusGuardRef.current)==null||c.focus();else{Us.flushSync(()=>{e.setOpen(!1,ct(ou,o.nativeEvent,o.currentTarget))});let u=sZ(e.context.triggerFocusTargetRef.current||t.current);for(;u!==null&&Je(l,u);){const f=u;if(u=Z2(u),u===f)break}u==null||u.focus()}}return{preFocusGuardRef:n,handlePreFocusGuardFocus:r,handleFocusTargetFocus:s}}function vee(e){const{enabled:t=!0,mouseDownAction:n,open:r}=e,s=N.useRef(!1);return N.useMemo(()=>t?{onMouseDown:o=>{(n==="open"&&!r||n==="close"&&r)&&(s.current=!0,jt(o.currentTarget).addEventListener("click",()=>{s.current=!1},{once:!0}))},onClick:o=>{s.current&&(s.current=!1,o.preventBaseUIHandler())}}:hn,[t,n,r])}const Nz=vm(function(t,n){const{render:r,className:s,style:o,disabled:l=!1,nativeButton:c=!0,id:u,openOnHover:f,delay:h=100,closeDelay:p=0,handle:y,payload:x,...b}=t,S=hl(!0),C=Am(y)??(S==null?void 0:S.store);if(!C)throw new Error(Wt(85));const O=ls(u),T=C.useState("isTriggerActive",O),R=C.useState("floatingRootContext"),k=C.useState("isOpenedByTrigger",O),M=C.useState("triggerPopupId",O),A=N.useRef(null),I=wee(),L=N2(!0),D=pl(),P=N.useMemo(()=>D??new tT,[D]),z=xm(P),$=Eu(),{registerTrigger:j,isMountedByThisTrigger:H}=Em(O,A,C,{payload:x,closeDelay:p,parent:I,floatingTreeRoot:P,floatingNodeId:z,floatingParentNodeId:$,keyboardEventRelay:L==null?void 0:L.relayKeyboardEvent}),B=I.type==="menubar",V=C.useState("disabled"),G=l||V||B&&I.context.disabled,{getButtonProps:q,buttonRef:K}=Su({disabled:G,native:c});N.useEffect(()=>{!k&&I.type===void 0&&(C.context.allowMouseUpTriggerRef.current=!1)},[C,k,I.type]);const W=N.useRef(null),ee=ns(),ce=Ve(Le=>{if(!W.current)return;ee.clear(),C.context.allowMouseUpTriggerRef.current=!1;const Pe=Le.target;Je(W.current,Pe)||Je(C.select("positionerElement"),Pe)||Pe===W.current||Pe!=null&&Cz(Pe)===C.select("rootId")||gee(Le,W.current)||P.events.emit("close",{domEvent:Le,reason:hQ})});N.useEffect(()=>{k&&C.select("lastOpenChangeReason")===wn&&jt(W.current).addEventListener("mouseup",ce,{once:!0})},[k,ce,C]);const F=B&&I.context.hasSubmenuOpen,te=km(R,{enabled:(f??F)&&!G&&(!B||F&&!H),handleClose:_m({blockPointerEvents:!B}),mouseOnly:!0,move:!1,restMs:I.type===void 0?h:void 0,delay:{close:p},triggerElementRef:A,externalTree:P,isActiveTrigger:T,isClosing:()=>C.select("transitionStatus")==="ending"}),Z=See(k,C.select("lastOpenChangeReason")),Y=nb(R,{enabled:!G,event:k&&B?"click":"mousedown",toggle:!0,ignoreMouse:!1,stickIfOpen:I.type===void 0?Z:!1}),le=aT(R,{enabled:!G&&F}),xe=vee({open:k,enabled:B,mouseDownAction:"open"}),fe=N.useMemo(()=>el(le.reference,Y.reference),[le.reference,Y.reference]),oe=C.useState("triggerProps",H),{preFocusGuardRef:re,handlePreFocusGuardFocus:he,handleFocusTargetFocus:Se}=Tz(C,A),ke={disabled:G,open:k},be=[W,n,K,j,A],_e=[fe,te??hn,oe,{"aria-haspopup":"menu","aria-controls":M,id:O,onMouseDown:Le=>{if(C.select("open"))return;ee.start(200,()=>{C.context.allowMouseUpTriggerRef.current=!0}),jt(Le.currentTarget).addEventListener("mouseup",ce,{once:!0})}},B?{role:"menuitem"}:{},xe,b,q],Me=Lt("button",t,{enabled:!B,stateAttributesMapping:mE,state:ke,ref:be,props:_e});return B?m.jsx(bee,{tag:"button",render:r,className:s,style:o,state:ke,refs:be,props:_e,stateAttributesMapping:mE}):k?m.jsxs(N.Fragment,{children:[m.jsx(Ua,{ref:re,onFocus:he},`${O}-pre-focus-guard`),m.jsx(N.Fragment,{children:Me},O),m.jsx(Ua,{ref:C.context.triggerFocusTargetRef,onFocus:Se},`${O}-post-focus-guard`)]}):m.jsx(N.Fragment,{children:Me},O)});function See(e,t){const n=ns(),[r,s]=N.useState(!1);return Be(()=>{e&&t===wn?(s(!0),n.start(F5,()=>{s(!1)})):e||(n.clear(),s(!1))},[e,t,n]),r}function wee(){const e=yT(!0);return N.useMemo(()=>e?{type:"menubar",context:e}:{type:void 0},[e])}const Oz=N.forwardRef(function(t,n){const{className:r,render:s,orientation:o="horizontal",style:l,...c}=t;return Lt("div",t,{state:{orientation:o},ref:n,props:[{role:"separator","aria-orientation":o},c]})});function Eee(e){return e==null||e.hasAttribute("disabled")||e.getAttribute("aria-disabled")==="true"}const Cee={"aria-expanded":void 0},Tee=N.forwardRef(function(t,n){const{render:r,className:s,style:o,label:l,id:c,nativeButton:u=!1,openOnHover:f=!0,delay:h=100,closeDelay:p=0,disabled:y=!1,...x}=t,b=Ez();if(!(b!=null&&b.parentMenu))throw new Error(Wt(37));const S=Yx({guess:!0,label:l}),E=qx(),{store:C}=hl(),O=ls(c),T=C.useState("open"),R=C.useState("floatingRootContext"),k=C.useState("floatingTreeRoot"),M=C.useState("triggerPopupId",O),A=az(O,C),I=Ve(fe=>{A(fe),fe!==null&&C.select("open")&&C.select("activeTriggerId")==null&&C.update({activeTriggerId:O??null,activeTriggerElement:fe,closeDelay:p})}),L=N.useRef(null),D=N.useCallback(fe=>{L.current=fe,C.set("activeTriggerElement",fe)},[C]);Be(()=>(I(L.current),()=>I(null)),[I,O,C]),C.useSyncedValue("closeDelay",p);const P=b.parentMenu,z=C.useState("disabled"),$=P.useState("disabled"),j=y||z||$,H=P.useState("itemProps"),B=P.useState("isActive",S.index),V=N.useMemo(()=>({type:"submenu-trigger",setActive(){P.select("highlightItemOnHover")&&P.set("activeIndex",S.index)}}),[P,S.index]),{getItemProps:G,itemRef:q}=$2({closeOnClick:!1,disabled:j,highlighted:B,id:O,store:C,typingRef:P.context.typingRef,nativeButton:u,itemMetadata:V,nodeId:E==null?void 0:E.context.nodeId}),K=C.useState("hoverEnabled"),W=km(R,{enabled:K&&f&&!j,handleClose:_m({blockPointerEvents:!0}),mouseOnly:!0,move:!0,restMs:h,delay:{open:h,close:p},shouldOpen:h>0?()=>P.select("allowMouseEnter"):void 0,triggerElementRef:L,externalTree:k,isClosing:()=>C.select("transitionStatus")==="ending",guardStaleOpen:!0}),ce=nb(R,{enabled:!j,event:"mousedown",toggle:!f,ignoreMouse:f,stickIfOpen:!1}).reference??hn,F=C.useState("triggerProps",!0);delete F.id;const X={disabled:j,highlighted:B,open:T},te=C.useState("openMethod"),Y=C.useState("lastOpenChangeReason")===Ap||te==="keyboard";return Lt("div",t,{state:X,stateAttributesMapping:fm,props:[ce,W,F,H,T&&Y&&y5?Cee:void 0,{"aria-controls":M,tabIndex:T||B?0:-1,onBlur(){B&&P.set("activeIndex",null)}},x,G],ref:[n,S.ref,q,I,D]})}),Rz="relative flex cursor-default items-center gap-2 rounded-md px-2 py-1.5 text-sm outline-hidden select-none focus:bg-muted data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0";function Az({...e}){return m.jsx(bT,{"data-slot":"dropdown-menu",...e})}function kz({...e}){return m.jsx(Nz,{"data-slot":"dropdown-menu-trigger",...e})}function _z({align:e="start",alignOffset:t=0,side:n="bottom",sideOffset:r=4,className:s,...o}){return m.jsx(fT,{children:m.jsx(gT,{className:"isolate z-50 outline-none",align:e,alignOffset:t,side:n,sideOffset:r,children:m.jsx(dT,{"data-slot":"dropdown-menu-content",className:ye("z-50 max-h-(--available-height) min-w-56 origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-lg border border-foreground bg-popover p-1 text-popover-foreground outline-none duration-150 data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0",s),...o})})})}function Fd({className:e,...t}){return m.jsx(C5,{"data-slot":"dropdown-menu-item",className:ye(Rz,e),...t})}function Wke({className:e,children:t,checked:n,...r}){return m.jsxs(S5,{"data-slot":"dropdown-menu-checkbox-item",className:ye(Rz,e),checked:n,...r,children:[m.jsx("span",{className:"pointer-events-none flex size-4 shrink-0 items-center justify-center rounded-sm border border-input bg-card","data-slot":"dropdown-menu-checkbox-item-indicator",children:m.jsx(w5,{children:m.jsx(wu,{className:"size-3",strokeWidth:3})})}),t]})}function Mz({className:e,...t}){return m.jsx(Oz,{"data-slot":"dropdown-menu-separator",className:ye("-mx-1 my-1 h-px bg-border",e),...t})}const qM="Settings",Nee="Explain this review",Oee="Delete",Ree="Switch to dark mode",Aee="Switch to light mode",kee="flex size-8 shrink-0 items-center justify-center rounded-md text-sign-muted hover:bg-sign-foreground/10 hover:text-sign-foreground focus-visible:outline-2 focus-visible:outline-sign-foreground aria-expanded:bg-sign-foreground/15 aria-expanded:text-sign-foreground",_ee={agents:_X,forges:$X,configurations:BX,repositories:HX,review:jd},Mee=({useThemeToggle:e})=>{const{theme:t,onToggle:n}=e(),r=t==="dark"?WX:KX;return m.jsxs(Fd,{onClick:n,children:[m.jsx(r,{"aria-hidden":"true",className:"size-3.5"}),t==="dark"?Aee:Ree]})},Iee=({actions:e})=>m.jsxs(m.Fragment,{children:[e.forgeLink===null?null:m.jsxs(Fd,{render:m.jsx("a",{href:e.forgeLink.href,target:"_blank",rel:"noreferrer","aria-label":e.forgeLink.label}),children:[m.jsx(P3,{"aria-hidden":"true",className:"size-3.5"}),e.forgeLink.label]}),e.onWriteUp===null?null:m.jsxs(Fd,{onClick:e.onWriteUp,children:[m.jsx(YX,{"aria-hidden":"true",className:"size-3.5"}),Nee]}),m.jsxs(Fd,{className:"text-destructive focus:bg-destructive/10",onClick:e.onDelete,children:[m.jsx(I2,{"aria-hidden":"true",className:"size-3.5"}),Oee]}),m.jsx(Mz,{})]}),IE=({links:e,useThemeToggle:t,reviewActions:n=null})=>m.jsxs(Az,{children:[m.jsx(kz,{"aria-label":qM,title:qM,className:kee,children:m.jsx(t5,{"aria-hidden":"true",className:"size-4"})}),m.jsxs(_z,{align:"end",children:[n===null?null:m.jsx(Iee,{actions:n}),m.jsx(Mee,{useThemeToggle:t}),m.jsx(Mz,{}),e.map(({label:r,icon:s,link:o})=>{const l=_ee[s];return m.jsxs(Fd,{render:o,children:[m.jsx(l,{"aria-hidden":"true",className:"size-3.5"}),r]},r)})]})]}),Lee={column:"max-w-5xl px-4 sm:px-6",full:"px-6"},Dee=({brand:e,width:t="column",children:n})=>m.jsx("header",{className:"sticky top-0 z-40 bg-sign text-sign-foreground",children:m.jsxs("div",{className:ye("mx-auto flex h-14 w-full items-center justify-between gap-6",Lee[t]),children:[e,n]})}),Iz=N.createContext(void 0);function Im(e){const t=N.useContext(Iz);if(t===void 0&&!e)throw new Error(Wt(72));return t}const jee={...Rm,disabled:e=>e.disabled,instantType:e=>e.instantType,isInstantPhase:e=>e.isInstantPhase,trackCursorAxis:e=>e.trackCursorAxis,disableHoverablePopup:e=>e.disableHoverablePopup,lastOpenChangeReason:e=>e.openChangeReason,closeOnClick:e=>e.closeOnClick,closeDelay:e=>e.closeDelay,adaptiveOrigin:e=>e.adaptiveOrigin};class Pee extends Cu{constructor(n,r,s){const o=new _f;super(zee(n,o,r,s),Bee(o),jee);Ot(this,"setOpen",(n,r)=>{cz(this,n,r,{extraState:{openChangeReason:r.reason}})})}cancelPendingOpen(n){this.state.floatingRootContext.dispatchOpenChange(!1,ct(di,n))}}function zee(e,t,n,r=!1){return{...Om(t,n,r),disabled:!1,instantType:void 0,isInstantPhase:!1,trackCursorAxis:"none",disableHoverablePopup:!1,openChangeReason:null,closeOnClick:!0,closeDelay:0,adaptiveOrigin:void 0,...e}}function Bee(e){return{popupRef:N.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerElements:e}}const Hee=kf(function(t){const{disabled:n=!1,defaultOpen:r=!1,open:s,disableHoverablePopup:o=!1,trackCursorAxis:l="none",actionsRef:c,onOpenChange:u,onOpenChangeComplete:f,handle:h,triggerId:p,defaultTriggerId:y=null,children:x}=t,b=sb((P,z)=>new Pee({open:r,openProp:s,activeTriggerId:y,triggerIdProp:p},P,z));b.useControlledProp("openProp",s),b.useControlledProp("triggerIdProp",p),b.useContextCallback("onOpenChange",u),b.useContextCallback("onOpenChangeComplete",f);const S=b.useState("open"),E=!n&&S,C=b.useState("activeTriggerId"),O=b.useState("mounted"),T=b.useState("payload");b.useSyncedValues({trackCursorAxis:l,disableHoverablePopup:o,disabled:n}),Cm(b,{closeOnActiveTriggerUnmount:!0});const{forceUnmount:R,transitionStatus:k}=Tm(E,b),M=b.useState("isInstantPhase"),A=b.useState("instantType"),I=b.useState("lastOpenChangeReason"),L=N.useRef(null);Be(()=>{S&&n&&b.setOpen(!1,ct(pQ))},[S,n,b]),Be(()=>{k==="ending"&&I===pm||k!=="ending"&&M?(A!=="delay"&&(L.current=A),b.set("instantType","delay")):L.current!==null&&(b.set("instantType",L.current),L.current=null)},[k,M,I,A,b]),Be(()=>{E&&C==null&&b.set("payload",void 0)},[b,C,E]),N.useImperativeHandle(c,()=>({unmount:R,close:()=>b.setOpen(!1,ct(iu))}),[R,b]);const D=E||O||!n&&l!=="none";return m.jsxs(Iz.Provider,{value:b,children:[h&&m.jsx(wm,{handle:h,store:b}),D&&m.jsx(Fee,{store:b,disabled:n,trackCursorAxis:l}),typeof x=="function"?x({payload:T}):x]})});function Fee({store:e,disabled:t,trackCursorAxis:n}){const r=e.useState("floatingRootContext"),s=bm(r,{enabled:!t,referencePress:()=>e.select("closeOnClick")}),o=yZ(r,{enabled:!t&&n!=="none",axis:n==="none"?void 0:n}),l=N.useMemo(()=>el(o.reference,s.reference),[o.reference,s.reference]);return Nm(e,{activeTriggerProps:l,inactiveTriggerProps:l,popupProps:s.floating??hn}),null}const $ee=N.createContext(void 0);function Uee(){return N.useContext($ee)}const Vee=600,Lz="data-base-ui-tooltip-trigger";function GM(e){if("composedPath"in e){const n=e.composedPath();for(let r=0;r<n.length;r+=1){const s=n[r];if(St(s))return s}}const t=e.target;return St(t)?t:null}function qee(e){let t=e;for(;t;){const n=t.closest(`[${Lz}]`);if(n)return n;const r=t.getRootNode();t="host"in r&&St(r.host)?r.host:null}return null}const Gee=vm(function(t,n){const{render:r,className:s,style:o,handle:l,payload:c,disabled:u,delay:f,closeOnClick:h=!0,closeDelay:p,id:y,...x}=t,b=Im(!0),E=Am(l)??b;if(!E)throw new Error(Wt(82));const C=ls(y),O=E.useState("isTriggerActive",C),T=E.useState("isOpenedByTrigger",C),R=E.useState("floatingRootContext"),k=N.useRef(null),M=p??0,{registerTrigger:A,isMountedByThisTrigger:I}=Em(C,k,E,{payload:c,closeOnClick:h,closeDelay:M}),L=Uee(),{activeIdRef:D,delayRef:P,isInstantPhase:z,hasProvider:$}=HQ(R,{open:T}),j=uT(R);E.useSyncedValue("isInstantPhase",z);const H=E.useState("disabled"),B=u??H,V=In(B),G=E.useState("trackCursorAxis"),q=E.useState("disableHoverablePopup"),K=N.useRef(!1),W=ns(),ee=N.useRef(void 0);function ce(){return $&&D.current!=null?0:f??L??Vee}function F(re){const he=k.current;if(!he||!re)return!1;const Se=qee(re);return Se!==null&&Se!==he&&Je(he,Se)}function X(re){const he=F(re);return K.current=he,he&&(j.openChangeTimeout.clear(),j.restTimeout.clear(),j.restTimeoutPending=!1,W.clear()),he}const te=km(R,{enabled:!B,mouseOnly:!0,move:!1,handleClose:!q&&G!=="both"?_m():null,restMs:ce,delay(){return p==null&&$?{close:Mp(P.current,"close")}:{close:M}},triggerElementRef:k,isActiveTrigger:O,isClosing:()=>E.select("transitionStatus")==="ending",shouldOpen(){return!K.current}}),Z=aT(R,{enabled:!B}).reference,Y=re=>{const he=K.current,Se=GM(re),ke=X(Se),be=k.current,_e=be&&Se&&Je(be,Se);if(ke&&E.select("open")&&E.select("lastOpenChangeReason")===wn){E.setOpen(!1,ct(wn,re));return}if(he&&!ke&&_e&&!V.current&&!E.select("open")&&be&&Ra(ee.current)){const Me=()=>{!K.current&&!V.current&&!E.select("open")&&E.setOpen(!0,ct(wn,re,be))},Le=ce();Le===0?(W.clear(),Me()):W.start(Le,Me)}},le=E.useState("triggerProps",I);return Lt("button",t,{state:{open:T},ref:[n,A,k],props:[te,Z,I||G!=="none"?le:void 0,{onMouseOver(re){Y(re.nativeEvent)},onFocus(re){F(GM(re.nativeEvent))&&re.preventBaseUIHandler()},onMouseLeave(){K.current=!1,W.clear(),ee.current=void 0},onPointerEnter(re){ee.current=re.pointerType},onPointerDown(re){ee.current=re.pointerType,E.set("closeOnClick",h),h&&!E.select("open")&&E.cancelPendingOpen(re.nativeEvent)},onClick(re){h&&!E.select("open")&&E.cancelPendingOpen(re.nativeEvent)},id:C,[xE]:B?"":void 0,[Lz]:B?void 0:""},x],stateAttributesMapping:fm})}),Dz=N.createContext(void 0);function Kee(){const e=N.useContext(Dz);if(e===void 0)throw new Error(Wt(70));return e}const jz=N.forwardRef(function(t,n){const{children:r,container:s,className:o,render:l,style:c,...u}=t,{node:f,subtree:h}=V5({container:s,ref:n,componentProps:t,elementProps:u});return!h&&!f?null:m.jsxs(N.Fragment,{children:[h,f&&Us.createPortal(r,f)]})}),Yee=N.forwardRef(function(t,n){const{keepMounted:r=!1,...s}=t;return Im().useState("mounted")||r?m.jsx(Dz.Provider,{value:r,children:m.jsx(jz,{ref:n,...s})}):null}),Pz=N.createContext(void 0);function zz(){const e=N.useContext(Pz);if(e===void 0)throw new Error(Wt(71));return e}const Wee=N.forwardRef(function(t,n){const{render:r,className:s,anchor:o,positionMethod:l="absolute",side:c="top",align:u="center",sideOffset:f=0,alignOffset:h=0,collisionBoundary:p="clipping-ancestors",collisionPadding:y=5,arrowPadding:x=5,sticky:b=!1,disableAnchorTracking:S=!1,collisionAvoidance:E=Jx,style:C,...O}=t,T=Im(),R=Kee(),k=T.useState("open"),M=T.useState("mounted"),A=T.useState("trackCursorAxis"),I=T.useState("disableHoverablePopup"),L=T.useState("floatingRootContext"),D=T.useState("instantType"),P=T.useState("transitionStatus"),z=T.useState("adaptiveOrigin"),$=cb({anchor:o,positionMethod:l,floatingRootContext:L,mounted:M,side:c,sideOffset:f,align:u,alignOffset:h,collisionBoundary:p,collisionPadding:y,sticky:b,arrowPadding:x,disableAnchorTracking:S,keepMounted:R,collisionAvoidance:E,adaptiveOrigin:z}),j=N.useMemo(()=>({open:k,side:$.side,align:$.align,anchorHidden:$.anchorHidden,instant:A!=="none"?"tracking-cursor":D}),[k,$.side,$.align,$.anchorHidden,A,D]),H=ub(t,j,{styles:$.positionerStyles,transitionStatus:P,props:O,refs:[n,T.useStateSetter("positionerElement")],hidden:!M,inert:!k||A==="both"||I});return m.jsx(Pz.Provider,{value:$,children:H})}),Xee=N.forwardRef(function(t,n){const{render:r,className:s,style:o,...l}=t,c=Im(),{side:u,align:f}=zz(),h=c.useState("open"),p=c.useState("instantType"),y=c.useState("transitionStatus"),x=c.useState("popupProps"),b=c.useState("floatingRootContext"),S=c.useState("disabled"),E=c.useState("closeDelay");Ya({open:h,ref:c.context.popupRef,onComplete(){var R,k;h&&((k=(R=c.context).onOpenChangeComplete)==null||k.call(R,!0))}}),ib(b,{enabled:!S,closeDelay:E});const C=c.useStateSetter("popupElement");return Lt("div",t,{state:{open:h,side:u,align:f,instant:p,transitionStatus:y},ref:[n,c.context.popupRef,C],props:[Sm,x,Mm(y),l],stateAttributesMapping:hm})}),Qee=N.forwardRef(function(t,n){const{render:r,className:s,style:o,...l}=t,c=Im(),{arrowRef:u,side:f,align:h,arrowUncentered:p,arrowStyles:y}=zz(),x=c.useState("open"),b=c.useState("instantType");return Lt("div",t,{state:{open:x,side:f,align:h,uncentered:p,instant:b},ref:[n,u],props:[{style:y,"aria-hidden":!0},l],stateAttributesMapping:Af})});function Bz({...e}){return m.jsx(Hee,{"data-slot":"tooltip",...e})}function Hz({...e}){return m.jsx(Gee,{"data-slot":"tooltip-trigger",...e})}function Fz({className:e,side:t="top",sideOffset:n=4,align:r="center",alignOffset:s=0,children:o,...l}){return m.jsx(Yee,{children:m.jsx(Wee,{align:r,alignOffset:s,side:t,sideOffset:n,className:"isolate z-50",children:m.jsxs(Xee,{"data-slot":"tooltip-content",className:ye("z-50 inline-flex w-fit max-w-xs origin-(--transform-origin) items-center gap-1.5 rounded-md bg-foreground px-3 py-1.5 text-xs text-background has-data-[slot=kbd]:pr-1.5 data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 **:data-[slot=kbd]:relative **:data-[slot=kbd]:isolate **:data-[slot=kbd]:z-50 **:data-[slot=kbd]:rounded-sm data-[state=delayed-open]:animate-in data-[state=delayed-open]:fade-in-0 data-[state=delayed-open]:zoom-in-95 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",e),...l,children:[o,m.jsx(Qee,{className:"z-50 size-2.5 translate-y-[calc(-50%-2px)] rotate-45 rounded-[2px] bg-foreground fill-foreground data-[side=bottom]:top-1 data-[side=inline-end]:top-1/2! data-[side=inline-end]:-left-1 data-[side=inline-end]:-translate-y-1/2 data-[side=inline-start]:top-1/2! data-[side=inline-start]:-right-1 data-[side=inline-start]:-translate-y-1/2 data-[side=left]:top-1/2! data-[side=left]:-right-1 data-[side=left]:-translate-y-1/2 data-[side=right]:top-1/2! data-[side=right]:-left-1 data-[side=right]:-translate-y-1/2 data-[side=top]:-bottom-2.5"})]})})})}const Zee={previous:N3,next:su,fold:su,unfold:Ux,close:Vx,settings:t5,edit:Q3,delete:I2,add:M2,remove:jX,copy:PX,copied:wu,zoomIn:ZX,zoomOut:JX,fullScreen:UX,leaveFullScreen:GX},Jee=/[A-Z]/g,ete=e=>`${e.replace(Jee,t=>`-${t.toLowerCase()}`)}-icon-action`,or=({icon:e,label:t,isDisabled:n=!1,variant:r="ghost",className:s,actionId:o,onClick:l})=>{const c=Zee[e];return m.jsxs(Bz,{children:[m.jsx(Hz,{render:m.jsx(st,{variant:r,size:"icon-sm","aria-label":t,disabled:n,"data-user-action-id":o??ete(e),className:s,onClick:l}),children:m.jsx(c,{"aria-hidden":"true"})}),m.jsx(Fz,{children:t})]})},Wa=({href:e,label:t,className:n})=>m.jsxs("a",{href:e,target:"_blank",rel:"noreferrer",className:ye("inline-flex items-center gap-1 rounded-sm text-sm text-[var(--line,var(--muted-foreground))] hover:text-foreground",n),children:[m.jsx("span",{children:t}),m.jsx(P3,{"aria-hidden":"true",className:"size-3.5"})]}),tte=({notice:e,isCopied:t,onCopy:n,onClose:r})=>m.jsxs("section",{role:"status","aria-label":e.title,className:"fixed right-4 bottom-4 z-[60] flex w-[min(24rem,calc(100vw-2rem))] flex-col gap-2 rounded-lg border border-foreground bg-popover p-3 text-sm text-popover-foreground duration-150 animate-in fade-in-0",children:[m.jsxs("div",{className:"flex items-start gap-2",children:[m.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-0.5",children:[m.jsx("p",{className:"font-bold",children:e.title}),m.jsx("p",{className:"text-muted-foreground",children:e.description})]}),m.jsx(or,{icon:"close",label:e.closeLabel,actionId:"close-update-toast",onClick:r})]}),m.jsxs("div",{className:"flex items-center gap-2 rounded-sm bg-muted py-1 pr-1 pl-3",children:[m.jsx("pre",{className:"min-w-0 flex-1 overflow-x-auto font-mono text-[0.8125rem] leading-5 select-all",children:m.jsx("code",{children:e.command})}),m.jsx(or,{icon:t?"copied":"copy",label:t?e.copiedLabel:e.copyLabel,actionId:"copy-update-command",onClick:n})]}),m.jsx(Wa,{href:e.releaseNotesUrl,label:e.releaseNotesLabel,className:"self-start"})]}),nte="/logo.svg",rte="Flight Plan",ste="/setup/",ote="mx-auto max-w-5xl px-4 pt-8 pb-16 sm:px-6",ite="/not-found.svg",lte=()=>{const[e,t]=N.useState(null),n=O1({select:l=>l.some(c=>c.staticData.isFullWidth===!0)}),r=O1({select:l=>l.some(c=>c.routeId===ste)}),s=O1({select:l=>l.some(c=>c.staticData.hasPageSettingsMenu===!0)}),o=yX();return m.jsx(_4,{value:e,children:m.jsxs("div",{className:"min-h-screen bg-background text-foreground",children:[m.jsxs(Dee,{width:n?"full":"column",brand:m.jsx(ri,{to:"/",className:"shrink-0 rounded-sm",children:m.jsx(xX,{logoSrc:nte,name:rte})}),children:[m.jsx("div",{ref:t,className:"flex min-w-0 flex-1 items-center border-l border-sign-foreground/20 pl-6 empty:hidden"}),r||s?null:m.jsx(IE,{links:uE,useThemeToggle:sE})]}),m.jsx("main",{className:ye("w-full",n?"":ote),children:m.jsx(A4,{})}),o.notice===null?null:m.jsx(tte,{notice:o.notice,isCopied:o.isCopied,onCopy:o.copy,onClose:o.close})]})})},ate=()=>m.jsxs("section",{className:"mx-auto flex max-w-prose flex-col items-center text-center",children:[m.jsx(L4,{src:ite}),m.jsx("h1",{className:"mt-4 text-2xl font-bold tracking-[-0.01em]",children:"PAN-PAN! We couldn't locate this page!"}),m.jsx("p",{className:"mt-2 text-muted-foreground",children:"The address does not match any page of Flight Plan."}),m.jsx(ri,{to:"/",className:"mt-4 inline-block underline",children:"Go to your repositories"})]}),cte=({error:e})=>m.jsx("main",{className:"min-h-screen bg-background px-4 pt-16 text-foreground",children:m.jsx(X4,{heading:"MAYDAY! MAYDAY! Flight Plan could not start",error:e})}),Tu=iK()({beforeLoad:async({context:{queryClient:e,trpc:t},location:n})=>{const r=await e.query({...t.setup.gate.queryOptions({path:n.pathname}),staleTime:"static"});r.redirectTo!==null&&Ix({to:r.redirectTo,throw:!0})},component:lte,notFoundComponent:ate,errorComponent:cte}),ute="modulepreload",dte=function(e){return"/"+e},KM={},Ut=function(t,n,r){let s=Promise.resolve();if(n&&n.length>0){let l=function(f){return Promise.all(f.map(h=>Promise.resolve(h).then(p=>({status:"fulfilled",value:p}),p=>({status:"rejected",reason:p}))))};document.getElementsByTagName("link");const c=document.querySelector("meta[property=csp-nonce]"),u=(c==null?void 0:c.nonce)||(c==null?void 0:c.getAttribute("nonce"));s=l(n.map(f=>{if(f=dte(f),f in KM)return;KM[f]=!0;const h=f.endsWith(".css"),p=h?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${f}"]${p}`))return;const y=document.createElement("link");if(y.rel=h?"stylesheet":ute,h||(y.as="script"),y.crossOrigin="",y.href=f,u&&y.setAttribute("nonce",u),document.head.appendChild(y),h)return new Promise((x,b)=>{y.addEventListener("load",x),y.addEventListener("error",()=>b(new Error(`Unable to preload CSS for ${f}`)))})}))}function o(l){const c=new Event("vite:preloadError",{cancelable:!0});if(c.payload=l,window.dispatchEvent(c),!c.defaultPrevented)throw l}return s.then(l=>{for(const c of l||[])c.status==="rejected"&&o(c.reason);return t().catch(o)})},fte=[{id:"first",stopWidths:["w-3/5","w-2/5","w-1/2"]},{id:"second",stopWidths:["w-2/5","w-3/5"]}],hte=()=>m.jsxs("div",{role:"status","aria-busy":"true",children:[m.jsx("span",{className:"sr-only",children:"Loading your repositories"}),m.jsxs("div",{"aria-hidden":"true",className:"motion-safe:animate-pulse",children:[m.jsx("div",{className:"mb-6 h-9 w-48 rounded-sm bg-muted"}),fte.map(e=>m.jsxs("div",{className:"grid grid-cols-[2.5rem_minmax(0,1fr)] border-t-2 border-foreground pt-5 pb-6",children:[m.jsxs("span",{className:"flex flex-col items-center",children:[m.jsx("span",{className:"size-7 rounded-full bg-muted"}),m.jsx("span",{className:"w-1 flex-1 bg-muted"})]}),m.jsxs("div",{className:"flex flex-col gap-4 pb-1",children:[m.jsx("span",{className:"h-6 w-40 rounded-sm bg-muted"}),e.stopWidths.map(t=>m.jsx("span",{className:`h-5 rounded-sm bg-muted ${t}`},t))]})]},e.id))]})]}),pte=()=>Ut(()=>import("./index-DKzDkR6v.js"),__vite__mapDeps([0,1])),mte=()=>Ut(()=>import("./index-CXyB0ld0.js"),__vite__mapDeps([2,1,3,4])),YM=e=>Array.isArray(e)?e.filter(t=>typeof t=="string"):void 0,gte=ws()({validateSearch:e=>({status:YM(e.status),author:YM(e.author),fixtureCase:typeof e.fixtureCase=="string"?e.fixtureCase:void 0}),loaderDeps:({search:e})=>({statuses:e.status??null,authors:e.author??null,fixtureCase:e.fixtureCase}),loader:async({context:{queryClient:e,trpc:t},deps:n})=>{await e.query({...t.repository.list.queryOptions(n),staleTime:"static"})},component:mn(mte,"component"),pendingComponent:hte,errorComponent:mn(pte,"errorComponent")}),yte=()=>Ut(()=>import("./route-D8s8AylJ.js"),[]),xte=ws()({component:mn(yte,"component")}),bte=ws()({beforeLoad:()=>{Ix({to:"/settings/agents",throw:!0})}}),vte={section:"agents"},Ste=["w-2/5","w-3/5","w-1/2"],Nu=()=>m.jsxs("div",{role:"status","aria-busy":"true",children:[m.jsx("span",{className:"sr-only",children:"Loading the settings"}),m.jsxs("div",{"aria-hidden":"true",className:"flex flex-col gap-4 motion-safe:animate-pulse",children:[m.jsx("span",{className:"h-8 w-56 rounded-sm bg-muted"}),m.jsx("span",{className:"h-5 w-4/5 rounded-sm bg-muted"}),Ste.map(e=>m.jsx("span",{className:`h-6 rounded-sm bg-muted ${e}`},e))]})]}),wte=()=>Ut(()=>import("./agents-bla75JmI.js"),__vite__mapDeps([5,6])),Ete=()=>Ut(()=>import("./agents-DnjhKMUc.js"),__vite__mapDeps([7,8,9,10,4,11])),Cte=ws()({loader:async({context:{queryClient:e,trpc:t}})=>{await e.query({...t.settings.get.queryOptions(vte),staleTime:"static"})},component:mn(Ete,"component"),pendingComponent:Nu,errorComponent:mn(wte,"errorComponent")}),Tte={section:"forges"},Nte=()=>Ut(()=>import("./forges-BH3uXIQL.js"),__vite__mapDeps([12,6])),Ote=()=>Ut(()=>import("./forges-uSh1-w20.js"),__vite__mapDeps([13,8,14,11])),Rte=ws()({loader:async({context:{queryClient:e,trpc:t}})=>{await e.query({...t.settings.get.queryOptions(Tte),staleTime:"static"})},component:mn(Ote,"component"),pendingComponent:Nu,errorComponent:mn(Nte,"errorComponent")}),Ate={section:"repositories"},kte=()=>Ut(()=>import("./repositories-DqGU7W63.js"),__vite__mapDeps([15,6])),_te=()=>Ut(()=>import("./repositories-DuObN8PJ.js"),__vite__mapDeps([16,3,4,17,11])),Mte=ws()({loader:async({context:{queryClient:e,trpc:t}})=>{await e.query({...t.settings.get.queryOptions(Ate),staleTime:"static"})},component:mn(_te,"component"),pendingComponent:Nu,errorComponent:mn(kte,"errorComponent")}),Ite={section:"review"},Lte=()=>Ut(()=>import("./review-BbbMUFsk.js"),__vite__mapDeps([18,6])),Dte=()=>Ut(()=>import("./review-C3k0h5Vl.js"),__vite__mapDeps([19,8,20,10,11])),jte=ws()({loader:async({context:{queryClient:e,trpc:t}})=>{await e.query({...t.settings.get.queryOptions(Ite),staleTime:"static"})},component:mn(Dte,"component"),pendingComponent:Nu,errorComponent:mn(Lte,"errorComponent")}),Pte=["first","second","third","fourth"],zte=["w-2/5","w-3/5","w-1/2"],Bte=()=>m.jsxs("div",{role:"status","aria-busy":"true",children:[m.jsx("span",{className:"sr-only",children:"Loading the setup"}),m.jsxs("div",{"aria-hidden":"true",className:"grid gap-x-10 gap-y-8 motion-safe:animate-pulse lg:grid-cols-[17rem_minmax(0,1fr)]",children:[m.jsx("span",{className:"h-9 w-64 rounded-sm bg-muted lg:col-span-2"}),m.jsx("div",{children:Pte.map(e=>m.jsxs("div",{className:"grid min-h-22 grid-cols-[2.5rem_minmax(0,1fr)]",children:[m.jsxs("span",{className:"flex flex-col items-center",children:[m.jsx("span",{className:"size-5 rounded-full bg-muted"}),m.jsx("span",{className:"w-1 flex-1 bg-muted"})]}),m.jsx("span",{className:"h-5 w-32 rounded-sm bg-muted"})]},e))}),m.jsxs("div",{className:"flex flex-col gap-4",children:[m.jsx("span",{className:"h-8 w-56 rounded-sm bg-muted"}),m.jsx("span",{className:"h-5 w-4/5 rounded-sm bg-muted"}),zte.map(e=>m.jsx("span",{className:`h-6 rounded-sm bg-muted ${e}`},e))]})]})]}),Hte=()=>Ut(()=>import("./index-CcORd1N6.js"),__vite__mapDeps([21,22])),Fte=()=>Ut(()=>import("./index-CJslcuJ0.js"),__vite__mapDeps([23,22,3,4,17,9,10,20,14])),$te=ws()({validateSearch:e=>({step:typeof e.step=="string"?e.step:void 0}),loaderDeps:({search:e})=>({step:e.step??null}),loader:async({context:{queryClient:e,trpc:t},deps:n})=>{const r=await e.query({...t.setup.get.queryOptions(n),staleTime:"static"});n.step!==r.form.step&&(e.setQueryData(t.setup.get.queryKey({step:r.form.step}),r),Ix({to:"/setup",search:{step:r.form.step},replace:!0,throw:!0}))},component:mn(Fte,"component"),pendingComponent:Bte,errorComponent:mn(Hte,"errorComponent")}),Ute=e=>({artifactUrl:e.artifact,repositoryName:e.repository,targetId:e.target}),Vte=()=>Ut(()=>import("./download-CwWMZwNG.js"),[]),q1=e=>typeof e=="string"?e:"",qte=ws()({validateSearch:e=>({artifact:q1(e.artifact),repository:q1(e.repository),target:q1(e.target)}),loaderDeps:({search:e})=>e,loader:async({context:{queryClient:e,trpc:t},deps:n})=>{const r=Ute(n),s=await e.query({...t.review.importForm.queryOptions(r),staleTime:"static"});if(!s.startsAtOnce)return{importId:s.isImporting?s.importId:null,refusal:null};const o=await e.getMutationCache().build(e,t.review.import.mutationOptions()).execute(r);return await e.invalidateQueries(t.review.importForm.pathFilter()),{importId:o.importId,refusal:o.importId===null?o.message:null}},component:mn(Vte,"component")}),Yo="rounded-sm bg-muted motion-safe:animate-pulse",Gte=()=>m.jsxs("div",{"aria-busy":"true","aria-label":"Opening the review",className:"grid grid-cols-[13rem_minmax(0,1fr)] gap-x-8 px-6 pt-4",children:[m.jsx("div",{className:"col-span-2 border-b pb-3",children:m.jsx("div",{className:`h-5 w-64 ${Yo}`})}),m.jsxs("div",{className:"flex flex-col gap-4 pt-6",children:[m.jsx("div",{className:`h-5 w-28 ${Yo}`}),m.jsx("div",{className:`h-5 w-40 ${Yo}`}),m.jsx("div",{className:`h-5 w-32 ${Yo}`}),m.jsx("div",{className:`h-5 w-36 ${Yo}`})]}),m.jsxs("div",{className:"flex flex-col gap-3 pt-6",children:[m.jsx("div",{className:`h-6 w-32 ${Yo}`}),m.jsx("div",{className:`h-5 w-full max-w-[70ch] ${Yo}`}),m.jsx("div",{className:`h-5 w-full max-w-[64ch] ${Yo}`}),m.jsx("div",{className:`h-5 w-full max-w-[52ch] ${Yo}`}),m.jsx("div",{className:`mt-8 h-64 w-full ${Yo}`})]})]}),Kte={blue:"[--line:var(--line-blue)]",green:"[--line:var(--line-green)]",magenta:"[--line:var(--line-magenta)]",violet:"[--line:var(--line-violet)]",teal:"[--line:var(--line-teal)]",lime:"[--line:var(--line-lime)]"},Yte={...Kte,primary:"[--line:var(--primary)]"},Wte=({lineColor:e})=>m.jsx("span",{"aria-hidden":"true",className:ye("pointer-events-none absolute inset-x-0 bottom-0 h-1 bg-(--line)",Yte[e])}),$z=3,Xte=1,Mf=2,vT=.5,Qte=.3,Zte=1.5,G1={added:"var(--diff-added)",modified:"var(--line-blue)",deleted:"var(--diff-removed)"},Uz=e=>(e+$z+Xte)*Mf,WM=e=>e==="plain",Jte=e=>Math.max(Zte,e*Qte),Vz=({centre:e,radius:t})=>{const n=t*vT;return`M${String(e-n)} ${String(e)}h${String(n*Mf)}`},ene=e=>{const t=e.radius*vT;return`${Vz(e)}M${String(e.centre)} ${String(e.centre-t)}v${String(t*Mf)}`},tne=({centre:e,radius:t})=>{const n=t*vT,r=n*Mf;return`M${String(e-n)} ${String(e-n)}l${String(r)} ${String(r)}m0 ${String(-r)}l${String(-r)} ${String(r)}`},nne=({centre:e,radius:t})=>`M${String(e)} ${String(e-t)}a${String(t)} ${String(t)} 0 0 1 0 ${String(t*Mf)}z`,K1=({path:e,radius:t})=>m.jsx("path",{d:e,strokeWidth:Jte(t),className:"fill-none stroke-background [stroke-linecap:round]"}),Y1=({shape:{centre:e,radius:t},ink:n,children:r=null})=>m.jsxs(m.Fragment,{children:[m.jsx("circle",{cx:e,cy:e,r:t,fill:n}),m.jsx("circle",{cx:e,cy:e,r:t+$z,stroke:n,className:"fill-none [stroke-width:1.5]"}),r]}),rne=(e,t)=>{const{centre:n,radius:r}=t;switch(e){case"added":return m.jsx(Y1,{shape:t,ink:G1.added,children:m.jsx(K1,{path:ene(t),radius:r})});case"modified":return m.jsx(Y1,{shape:t,ink:G1.modified});case"deleted":return m.jsx(Y1,{shape:t,ink:G1.deleted,children:m.jsx(K1,{path:Vz(t),radius:r})});case"breaks":return m.jsxs(m.Fragment,{children:[m.jsx("circle",{cx:n,cy:n,r,className:"fill-destructive"}),m.jsx(K1,{path:tne(t),radius:r})]});case"behaviour-changes":return m.jsxs(m.Fragment,{children:[m.jsx("circle",{cx:n,cy:n,r,className:"fill-background stroke-foreground [stroke-width:2]"}),m.jsx("path",{d:nne(t),className:"fill-foreground"})]});case"plain":return m.jsx("circle",{cx:n,cy:n,r,className:"fill-muted-foreground"})}},ST=({mark:e,radius:t,className:n})=>{const r=Uz(t);return m.jsx("svg",{"aria-hidden":"true",width:r,height:r,viewBox:`0 0 ${String(r)} ${String(r)}`,"data-mark":e,className:ye("shrink-0",n),children:rne(e,{centre:r/Mf,radius:t})})},qz=N.createContext(void 0);function Xa(e){const t=N.useContext(qz);if(!e&&t===void 0)throw new Error(Wt(27));return t}const sne=N.forwardRef(function(t,n){const{render:r,className:s,style:o,forceRender:l=!1,...c}=t,u=Xa(),f=u.useState("open"),h=u.useState("nested"),p=u.useState("mounted"),y=u.useState("transitionStatus");return Lt("div",t,{state:{open:f,transitionStatus:y},ref:[u.context.backdropRef,n],stateAttributesMapping:hm,props:[{role:"presentation",hidden:!p,style:{userSelect:"none",WebkitUserSelect:"none"}},c],enabled:l||!h})}),wT=N.forwardRef(function(t,n){const{render:r,className:s,style:o,disabled:l=!1,nativeButton:c=!0,...u}=t,f=Xa(),h=f.useState("open"),{getButtonProps:p,buttonRef:y}=Su({disabled:l,native:c}),x={disabled:l};function b(S){h&&f.setOpen(!1,ct(m5,S.nativeEvent))}return Lt("button",t,{state:x,ref:[n,y],props:[{onClick:b},u,p]})}),one=N.forwardRef(function(t,n){const{render:r,className:s,style:o,id:l,...c}=t,u=Xa(),f=ls(l);return u.useSyncedValueWithCleanup("descriptionElementId",f),Lt("p",t,{ref:n,props:[{id:f},c]})}),Gz=N.createContext(void 0);function ine(){const e=N.useContext(Gz);if(e===void 0)throw new Error(Wt(26));return e}const lne="--nested-dialogs",ane="data-nested-dialog-open",cne={...Af,...dm,nestedDialogOpen(e){return e?{[ane]:""}:null}},Kz=N.forwardRef(function(t,n){const{render:r,className:s,style:o,finalFocus:l,initialFocus:c,...u}=t,f=Xa(),h=f.useState("descriptionElementId"),p=f.useState("disablePointerDismissal"),y=f.useState("floatingRootContext"),x=f.useState("popupProps"),b=f.useState("modal"),S=f.useState("mounted"),E=f.useState("nested"),C=f.useState("nestedOpenDialogCount"),O=f.useState("open"),T=f.useState("openMethod"),R=f.useState("titleElementId"),k=f.useState("transitionStatus"),M=f.useState("role"),A=y.useState("floatingId");ine(),Ya({open:O,ref:f.context.popupRef,onComplete(){var $,j;O&&((j=($=f.context).onOpenChangeComplete)==null||j.call($,!0))}});const I=c===void 0?lz(f.context.popupRef):c,L=C>0,D=f.useStateSetter("popupElement"),z=Lt("div",t,{state:{open:O,nested:E,transitionStatus:k,nestedDialogOpen:L},props:[x,{id:A,"aria-labelledby":R,"aria-describedby":h,role:M,...Sm,hidden:!S,onKeyDown($){ab.has($.key)&&$.stopPropagation()},style:{[lne]:C}},u],ref:[n,f.context.popupRef,D],stateAttributesMapping:cne});return m.jsx(rT,{context:y,openInteractionType:T,disabled:!S,closeOnFocusOut:!p,initialFocus:I,returnFocus:l,modal:b!==!1,restoreFocus:"popup",children:z})}),Yz=N.forwardRef(function(t,n){const{keepMounted:r=!1,...s}=t,o=Xa(),l=o.useState("mounted"),c=o.useState("modal"),u=o.useState("open");return l||r?m.jsx(Gz.Provider,{value:r,children:m.jsxs(eT,{ref:n,...s,children:[l&&c===!0&&m.jsx(mT,{ref:o.context.internalBackdropRef,inert:hT(!u)}),t.children]})}):null});function une({store:e,parentContext:t,isDrawer:n}){const r=e.useState("open"),s=e.useState("disablePointerDismissal"),o=e.useState("modal"),l=e.useState("popupElement"),c=e.useState("floatingRootContext"),[u,f]=N.useState(0),[h,p]=N.useState(0),y=u===0,x=bm(c,{outsidePressEvent(){return e.context.internalBackdropRef.current||e.context.backdropRef.current?"intentional":{mouse:o==="trap-focus"?"sloppy":"intentional",touch:"sloppy"}},outsidePress(b){if(!e.context.outsidePressEnabledRef.current||"button"in b&&b.button!==0)return!1;if("touches"in b){if(b.type==="touchend"){if(b.changedTouches.length!==1||b.touches.length!==0)return!1}else if(b.touches.length!==1)return!1}const S=Nr(b);if(y&&!s){if(o){const E=e.context.internalBackdropRef.current,C=e.context.backdropRef.current;return E||C?E===S||C===S||Je(S,l)&&!(S!=null&&S.hasAttribute("data-base-ui-portal")):!0}return!0}return!1},escapeKey:y});return xz(r&&o===!0,l),e.useContextCallback("onNestedDialogOpen",(b,S)=>{f(b),p(S)}),Be(()=>(t!=null&&t.onNestedDialogOpen&&(r?t.onNestedDialogOpen(u+1,h+(n?1:0)):t.onNestedDialogOpen(0,0)),()=>{t!=null&&t.onNestedDialogOpen&&r&&t.onNestedDialogOpen(0,0)}),[n,r,u,h,t]),Nm(e,{activeTriggerProps:x.reference,inactiveTriggerProps:x.trigger,popupProps:x.floating,nestedOpenDialogCount:u,nestedOpenDrawerCount:h}),null}const dne={...Rm,modal:e=>e.modal,nested:e=>e.nested,nestedOpenDialogCount:e=>e.nestedOpenDialogCount,nestedOpenDrawerCount:e=>e.nestedOpenDrawerCount,disablePointerDismissal:e=>e.disablePointerDismissal,openMethod:e=>e.openMethod,descriptionElementId:e=>e.descriptionElementId,titleElementId:e=>e.titleElementId,viewportElement:e=>e.viewportElement,role:e=>e.role};class fne extends Cu{constructor(n,r,s){const o=new _f,l=hne(n,o,r,s);super(l,pne(o),dne);Ot(this,"setOpen",(n,r)=>{var s,o;r.preventUnmountOnClose=()=>{this.set("preventUnmountingOnClose",!0)},!n&&r.trigger==null&&this.state.activeTriggerId!=null&&(r.trigger=this.state.activeTriggerElement??void 0),(o=(s=this.context).onOpenChange)==null||o.call(s,n,r),!r.isCanceled&&(this.state.floatingRootContext.dispatchOpenChange(n,r),this.update(ob(this.state,n,r.trigger)))})}}function hne(e,t,n,r=!1){return{...Om(t,n,r),modal:!0,disablePointerDismissal:!1,viewportElement:null,descriptionElementId:void 0,titleElementId:void 0,openMethod:null,nested:!1,nestedOpenDialogCount:0,nestedOpenDrawerCount:0,role:"dialog",...e}}function pne(e){return{popupRef:N.createRef(),backdropRef:N.createRef(),internalBackdropRef:N.createRef(),outsidePressEnabledRef:{current:!0},triggerElements:e,onOpenChange:void 0,onOpenChangeComplete:void 0}}function mne(e,t){const{children:n,open:r,defaultOpen:s=!1,onOpenChange:o,onOpenChangeComplete:l,disablePointerDismissal:c=!1,modal:u=!0,actionsRef:f,handle:h,triggerId:p,defaultTriggerId:y=null}=t,x=e==="drawer",b=u,S=c,E="dialog",C=Xa(!0),O=C!=null,T={modal:b,disablePointerDismissal:S,nested:O,role:E},R=sb((D,P)=>new fne({open:s,openProp:r,activeTriggerId:y,triggerIdProp:p,...T},D,P),!0);R.useControlledProp("openProp",r),R.useControlledProp("triggerIdProp",p),R.useSyncedValues(T),R.useContextCallback("onOpenChange",o),R.useContextCallback("onOpenChangeComplete",l);const k=R.useState("open"),M=R.useState("mounted"),A=R.useState("payload");uz(R,k),Cm(R);const{forceUnmount:I}=Tm(k,R);N.useImperativeHandle(f,()=>({unmount:I,close:()=>R.setOpen(!1,ct(iu))}),[I,R]);const L=k||M;return m.jsxs(qz.Provider,{value:R,children:[h&&m.jsx(wm,{handle:h,store:R}),L&&m.jsx(une,{store:R,parentContext:C==null?void 0:C.context,isDrawer:x}),typeof n=="function"?n({payload:A}):n]})}const Wz=kf(function(t){return mne("dialog",t)}),gne=N.forwardRef(function(t,n){const{render:r,className:s,style:o,id:l,...c}=t,u=Xa(),f=ls(l);return u.useSyncedValueWithCleanup("titleElementId",f),Lt("h2",t,{ref:n,props:[{id:f},c]})}),yne=vm(function(t,n){const{render:r,className:s,style:o,disabled:l=!1,nativeButton:c=!0,id:u,payload:f,handle:h,...p}=t,y=Xa(!0),b=Am(h)??y;if(!b)throw new Error(Wt(79));const S=ls(u),E=b.useState("floatingRootContext"),C=b.useState("isOpenedByTrigger",S),O=b.useState("triggerPopupId",S),T=N.useRef(null),{registerTrigger:R,isMountedByThisTrigger:k}=Em(S,T,b,{payload:f}),{getButtonProps:M,buttonRef:A}=Su({disabled:l,native:c}),I=nb(E),L=xT(()=>b.select("open"),z=>{b.set("openMethod",z)}),D={disabled:l,open:C},P=b.useState("triggerProps",k);return Lt("button",t,{state:D,ref:[A,n,R,T],props:[I.reference,P,L,{[J2]:"",id:S,"aria-haspopup":"dialog","aria-expanded":C,"aria-controls":O},p,M],stateAttributesMapping:fm})}),Xz="data-composite-item-active";function xne(e){const{loopFocus:t=!0,orientation:n="both",grid:r,onLoop:s,direction:o,highlightedIndex:l,onHighlightedIndexChange:c,rootRef:u,enableHomeAndEndKeys:f=!1,stopEventPropagation:h,disabledIndices:p,modifierKeys:y=Ha}=e,[x,b]=N.useState(0),S=r!=null,E=N.useRef(null),C=Ba(E,u),O=N.useRef([]),T=N.useRef(!1),R=N.useRef(null),k=l??x,M=Ve((P,z=!1)=>{if(R.current=O.current[P]??null,(c??b)(P),z){const $=O.current[P];DM(E.current,$,o,n)}}),A=Ve(P=>{var H;if(P.size===0)return;if(T.current){const B=O.current,V=B.indexOf(R.current);if(V===-1){const G=B[k];!G||zd(B,k,p)?M(bne(B,p)):R.current=G}else V!==k&&M(V);return}T.current=!0;const z=Array.from(P.keys()),$=z.find(B=>B==null?void 0:B.hasAttribute(Xz))??null,j=$?((H=P.get($))==null?void 0:H.index)??-1:-1;if(j!==-1)M(j);else if(zd(z,k,p)){const B=Gi(z,{disabledIndices:p});lp(z,B)||M(B)}DM(E.current,$,o,n)});Be(()=>{if(p==null||l!=null||!T.current)return;const P=O.current;if(zd(P,k,p)){const z=Gi(P,{disabledIndices:p});lp(P,z)||M(z)}},[p,l,k,O,M]);const I=Ve((P,z,$)=>s?s(P,z,$,O):$),L=Ve(P=>{const z=P.key===_E||P.key===ME;if(!ab.has(P.key)||!f&&z||vne(P,y)||!E.current)return;const j=o==="rtl",H=j?AE:kE,B=j?kE:AE,V=n==="vertical"?RE:H,G=n==="vertical"?OE:B,q=Nr(P.nativeEvent);if(q!=null&&LM(q)&&!Eee(q)){const X=q.selectionStart,te=q.selectionEnd,Z=q.value;if(X==null||P.shiftKey||X!==te||P.key!==G&&X<Z.length||P.key!==V&&X>0)return}let K=k;const W=xy(O,p),ee=wE(O,p);r!=null&&(K=r({disabledIndices:p,elementsRef:O,event:P,highlightedIndex:k,loopFocus:t,maxIndex:ee,minIndex:W,onLoop:I,orientation:n,rtl:j}));const ce=n!=="vertical"&&P.key===H||n!=="horizontal"&&P.key===RE,F=n!=="vertical"&&P.key===B||n!=="horizontal"&&P.key===OE;f&&(P.key===_E?K=W:P.key===ME&&(K=ee)),K===k&&(ce||F)&&(t&&K===ee&&ce?(K=W,s&&(K=s(P,k,K,O))):t&&K===W&&F?(K=ee,s&&(K=s(P,k,K,O))):K=Gi(O.current,{startingIndex:K,decrement:F,disabledIndices:p})),K!==k&&!lp(O.current,K)&&(h&&P.stopPropagation(),(S||z||ce||F)&&P.preventDefault(),M(K,!0),queueMicrotask(()=>{var X;(X=O.current[K])==null||X.focus()}))});return{props:{ref:C,onFocus(P){const z=E.current,$=Nr(P.nativeEvent);!z||$==null||!LM($)||$.setSelectionRange(0,$.value.length)},onKeyDown:L},highlightedIndex:k,onHighlightedIndexChange:M,elementsRef:O,onMapChange:A,relayKeyboardEvent:L}}function bne(e,t){let n=-1;for(let r=0;r<e.length;r+=1){const s=e[r];if(!(!s||zd(e,r,t))){if(s.hasAttribute(Xz))return r;n===-1&&(n=r)}}return Math.max(n,0)}function vne(e,t){for(const n of DJ)if(!t.includes(n)&&e.getModifierState(n))return!0;return!1}function Sne(e){const{render:t,className:n,style:r,refs:s=Ha,props:o=Ha,state:l=hn,stateAttributesMapping:c,highlightedIndex:u,onHighlightedIndexChange:f,orientation:h,grid:p,loopFocus:y,onLoop:x,enableHomeAndEndKeys:b,onMapChange:S,stopEventPropagation:E=!0,rootRef:C,disabledIndices:O,modifierKeys:T,highlightItemOnHover:R=!1,tag:k="div",...M}=e,A=pT(),{props:I,highlightedIndex:L,onHighlightedIndexChange:D,elementsRef:P,onMapChange:z,relayKeyboardEvent:$}=xne({grid:p,loopFocus:y,onLoop:x,orientation:h,highlightedIndex:u,onHighlightedIndexChange:f,rootRef:C,stopEventPropagation:E,enableHomeAndEndKeys:b,direction:A,disabledIndices:O,modifierKeys:T}),j=Lt(k,e,{state:l,ref:s,props:[I,...o,M],stateAttributesMapping:c}),H=N.useMemo(()=>({highlightedIndex:L,onHighlightedIndexChange:D,highlightItemOnHover:R,relayKeyboardEvent:$}),[L,D,R,$]);return m.jsx(F4.Provider,{value:H,children:m.jsx(gz,{elementsRef:P,onMapChange:B=>{S==null||S(B),z(B)},children:j})})}const wne="data-has-submenu-open",Ene={hasSubmenuOpen(e){return e?{[wne]:""}:null}},Cne=N.forwardRef(function(t,n){const{orientation:r="horizontal",loopFocus:s=!0,render:o,className:l,modal:c=!0,disabled:u=!1,id:f,style:h,...p}=t,[y,x]=N.useState(null),[b,S]=N.useState(!1),E=ls(f),C={orientation:r,modal:c,hasSubmenuOpen:b},O=N.useRef(null),T=N.useRef(!1),R=N.useMemo(()=>({contentElement:y,setContentElement:x,setHasSubmenuOpen:S,hasSubmenuOpen:b,modal:c,disabled:u,orientation:r,allowMouseUpTriggerRef:T,rootId:E}),[y,b,c,u,r,E]);return m.jsx(vz.Provider,{value:R,children:m.jsx(tb,{children:m.jsx(Tne,{children:m.jsx(Sne,{render:o,className:l,style:h,state:C,stateAttributesMapping:Ene,refs:[n,x,O],props:[{role:"menubar",id:E,"aria-orientation":r},p],orientation:r,loopFocus:s,enableHomeAndEndKeys:!0,highlightItemOnHover:b})})})})});function Tne(e){const t=xm(),{events:n}=pl(),r=yT();return N.useEffect(()=>{function s(o){!o.nodeId||o.parentNodeId!==t||(o.open?r.hasSubmenuOpen||r.setHasSubmenuOpen(!0):o.reason!==Rd&&o.reason!==Ap&&r.setHasSubmenuOpen(!1))}return n.on("menuopenchange",s),()=>{n.off("menuopenchange",s)}},[n,t,r]),m.jsx(eb,{id:t,children:e.children})}const ET="relative flex cursor-default items-center gap-2 rounded-md px-2 py-1.5 text-sm outline-hidden select-none data-highlighted:bg-muted data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0",Qz="z-50 max-h-(--available-height) min-w-56 origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-lg border border-foreground bg-popover p-1 text-popover-foreground outline-none duration-150 data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0";function Zz({className:e,...t}){return m.jsx(Cne,{"data-slot":"menubar",className:ye("flex items-center",e),...t})}function Jz({...e}){return m.jsx(bT,{"data-slot":"menubar-menu",...e})}function eB({...e}){return m.jsx(Nz,{"data-slot":"menubar-trigger",...e})}function tB({align:e="start",alignOffset:t=0,side:n="bottom",sideOffset:r=8,className:s,...o}){return m.jsx(fT,{children:m.jsx(gT,{className:"isolate z-50 outline-none",align:e,alignOffset:t,side:n,sideOffset:r,children:m.jsx(dT,{"data-slot":"menubar-content",className:ye(Qz,s),...o})})})}function cp({...e}){return m.jsx(AQ,{"data-slot":"menubar-group",...e})}function up({className:e,...t}){return m.jsx(kQ,{"data-slot":"menubar-label",className:ye("truncate px-2 pt-2 pb-1 text-xs text-muted-foreground",e),...t})}function Nne({className:e,...t}){return m.jsx(C5,{"data-slot":"menubar-item",className:ye(ET,e),...t})}function One({className:e,children:t,checked:n,...r}){return m.jsxs(S5,{"data-slot":"menubar-checkbox-item",className:ye(ET,"group/checkbox",e),checked:n,...r,children:[m.jsx("span",{className:"pointer-events-none flex size-4 shrink-0 items-center justify-center rounded-sm border border-input bg-card group-data-checked/checkbox:border-(--line,var(--primary-text)) group-data-checked/checkbox:bg-(--line,var(--primary-text)) group-data-checked/checkbox:text-line-foreground","data-slot":"menubar-checkbox-item-indicator",children:m.jsx(w5,{children:m.jsx(wu,{className:"size-3",strokeWidth:3})})}),t]})}function LE({className:e,...t}){return m.jsx(Oz,{"data-slot":"menubar-separator",className:ye("-mx-1 my-1 h-px bg-border",e),...t})}function nB({...e}){return m.jsx(mee,{"data-slot":"menubar-sub",...e})}function rB({className:e,children:t,...n}){return m.jsxs(Tee,{"data-slot":"menubar-sub-trigger",className:ye(ET,"data-popup-open:bg-muted",e),...n,children:[t,m.jsx(Ux,{"aria-hidden":"true",className:"ml-auto size-4 text-muted-foreground"})]})}function sB({className:e,...t}){return m.jsx(fT,{children:m.jsx(gT,{className:"isolate z-50 outline-none",side:"right",align:"start",sideOffset:4,alignOffset:-4,children:m.jsx(dT,{"data-slot":"menubar-sub-content",className:ye(Qz,e),...t})})})}function oB({className:e,...t}){return m.jsx("kbd",{"data-slot":"menubar-shortcut",className:ye("inline-grid h-[1.125rem] min-w-[1.125rem] place-items-center rounded-sm border border-b-2 border-current/35 px-1 font-mono text-[0.6875rem] leading-none font-bold uppercase opacity-80",e),...t})}const XM=e=>{let t;const n=new Set,r=(f,h)=>{const p=typeof f=="function"?f(t):f;if(!Object.is(p,t)){const y=t;t=h??(typeof p!="object"||p===null)?p:Object.assign({},t,p),n.forEach(x=>x(t,y))}},s=()=>t,c={setState:r,getState:s,getInitialState:()=>u,subscribe:f=>(n.add(f),()=>n.delete(f))},u=t=e(r,s,c);return c},iB=(e=>e?XM(e):XM),Rne=e=>e;function CT(e,t=Rne){const n=si.useSyncExternalStore(e.subscribe,si.useCallback(()=>t(e.getState()),[e,t]),si.useCallback(()=>t(e.getInitialState()),[e,t]));return si.useDebugValue(n),n}function lB(e,t){let n;try{n=e()}catch{return}return{getItem:s=>{var o;const l=u=>u===null?null:JSON.parse(u,void 0),c=(o=n.getItem(s))!=null?o:null;return c instanceof Promise?c.then(l):l(c)},setItem:(s,o)=>n.setItem(s,JSON.stringify(o,void 0)),removeItem:s=>n.removeItem(s)}}const DE=e=>t=>{try{const n=e(t);return n instanceof Promise?n:{then(r){return DE(r)(n)},catch(r){return this}}}catch(n){return{then(r){return this},catch(r){return DE(r)(n)}}}},Ane=(e,t)=>(n,r,s)=>{let o={storage:lB(()=>window.localStorage),partialize:E=>E,version:0,merge:(E,C)=>({...C,...E}),...t},l=!1,c=0;const u=new Set,f=new Set;let h=o.storage;if(!h)return e((...E)=>{console.warn(`[zustand persist middleware] Unable to update item '${o.name}', the given storage is currently unavailable.`),n(...E)},r,s);const p=()=>{const E=o.partialize({...r()});return h.setItem(o.name,{state:E,version:o.version})},y=s.setState;s.setState=(E,C)=>(y(E,C),p());const x=e((...E)=>(n(...E),p()),r,s);s.getInitialState=()=>x;let b;const S=()=>{var E,C;if(!h)return;const O=++c;l=!1,u.forEach(R=>{var k;return R((k=r())!=null?k:x)});const T=((C=o.onRehydrateStorage)==null?void 0:C.call(o,(E=r())!=null?E:x))||void 0;return DE(h.getItem.bind(h))(o.name).then(R=>{if(R)if(typeof R.version=="number"&&R.version!==o.version){if(o.migrate){const k=o.migrate(R.state,R.version);return k instanceof Promise?k.then(M=>[!0,M]):[!0,k]}console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}else return[!1,R.state];return[!1,void 0]}).then(R=>{var k;if(O!==c)return;const[M,A]=R;if(b=o.merge(A,(k=r())!=null?k:x),n(b,!0),M)return p()}).then(()=>{O===c&&(T==null||T(r(),void 0),b=r(),l=!0,f.forEach(R=>R(b)))}).catch(R=>{O===c&&(T==null||T(void 0,R))})};return s.persist={setOptions:E=>{o={...o,...E},E.storage&&(h=E.storage)},clearStorage:()=>{++c,h==null||h.removeItem(o.name)},getOptions:()=>o,rehydrate:()=>S(),hasHydrated:()=>l,onHydrate:E=>(u.add(E),()=>{u.delete(E)}),onFinishHydration:E=>(f.add(E),()=>{f.delete(E)})},o.skipHydration||S(),b||x},kne=Ane,aB="teammate",_ne=864e5,Mne={firstSeenAt:null,isOff:!1,tooltips:{},deferredAt:{},actions:{}},Ine={clickCount:0,hoverCount:0,firstClickedAt:null,firstHoveredAt:null},cB="click",Lne=1,Dne="days",jne=["viewVisible","tooltipDependent","preFeatureUse","postFeatureUse","dayBound","tooltipAndDay","reviewMode","dependsOnValues","userDeferred"],uB=e=>"actionIds"in e?e:{actionIds:e},TT=(e,t)=>e.actions[t]??Ine,Pne=(e,t)=>t==="click"?e.clickCount:t==="hover"?e.hoverCount:e.clickCount+e.hoverCount,zne=(e,t)=>{if(t==="click")return e.firstClickedAt;if(t==="hover")return e.firstHoveredAt;const n=[e.firstClickedAt,e.firstHoveredAt].filter(r=>r!==null);return n.length===0?null:Math.min(...n)},fb=(e,t,n,r)=>{var s,o;return((o=(s=e.tooltips[t])==null?void 0:s[n])==null?void 0:o[r])===!0},jE=(e,t,n,r)=>{const{actionIds:s,use:o=cB,times:l=Lne}=uB(r);return s.some(u=>fb(e,t,n,u))?!0:s.reduce((u,f)=>u+Pne(TT(e,f),o),0)>=l},Bne=(e,t)=>{const{actionIds:n,use:r=cB}=uB(t),s=n.map(o=>zne(TT(e,o),r)).filter(o=>o!==null);return s.length===0?null:Math.min(...s)},Hne=(e,t,n,r)=>{const s=TT(e,t),o=n==="click"?{...s,clickCount:s.clickCount+1,firstClickedAt:s.firstClickedAt??r}:{...s,hoverCount:s.hoverCount+1,firstHoveredAt:s.firstHoveredAt??r};return{...e,actions:{...e.actions,[t]:o}}},dB=(e,t,n)=>{const r=e.tooltips[t]??{},s=Object.fromEntries(jne.flatMap(o=>{const l=n[o];return l===void 0?[]:[[o,{...r[o],...l}]]}));return{...e,tooltips:{...e.tooltips,[t]:{...r,...s}}}},Fne=(e,t,n,r)=>({...dB(e,t,{userDeferred:{[n]:!0}}),deferredAt:{...e.deferredAt,[t]:e.deferredAt[t]??r}}),$ne=(e,t)=>e.firstSeenAt===null?{...e,firstSeenAt:t}:e,fB=(e,t)=>{var n;return Object.values(((n=e.tooltips[t])==null?void 0:n.userDeferred)??{}).some(r=>r)},hB=(e,t,n)=>fB(e,t)||(n==null?void 0:n.preFeatureUse)!==void 0&&jE(e,t,"preFeatureUse",n.preFeatureUse),Une=(e,t,n)=>{if(!hB(e,t,n))return null;const r=[e.deferredAt[t]??null,(n==null?void 0:n.preFeatureUse)===void 0?null:Bne(e,n.preFeatureUse)].filter(s=>s!==null);return r.length===0?e.firstSeenAt:Math.min(...r)},pB=(e,t,n)=>e!==null&&n-e>=t*_ne,Vne=(e,t,n,r)=>n.some(s=>r.visibleViewIds.includes(s)||fb(e,t,"viewVisible",s)),mB=(e,t,n,r,s)=>r.every(o=>fb(e,t,n,o)||hB(e,o,s.triggersById[o])),qne=(e,t,n,r)=>{if(!mB(e,t,"tooltipAndDay",n.tooltipDependent,r))return!1;const s=n.tooltipDependent.map(l=>Une(e,l,r.triggersById[l])),o=s.some(l=>l===null)?null:Math.max(...s.filter(l=>l!==null));return pB(o,n.dayBound,r.now)},Gne=e=>Object.values(e).every(t=>t),Kne=(e,t,n,r)=>[["userDeferred",!fB(e,t)],["viewVisible",n.viewVisible===void 0||Vne(e,t,n.viewVisible,r)],["tooltipDependent",n.tooltipDependent===void 0||mB(e,t,"tooltipDependent",n.tooltipDependent,r)],["preFeatureUse",n.preFeatureUse===void 0||!jE(e,t,"preFeatureUse",n.preFeatureUse)],["postFeatureUse",n.postFeatureUse===void 0||jE(e,t,"postFeatureUse",n.postFeatureUse)],["dayBound",n.dayBound===void 0||fb(e,t,"dayBound",Dne)||pB(e.firstSeenAt,n.dayBound,r.now)],["tooltipAndDay",n.tooltipAndDay===void 0||qne(e,t,n.tooltipAndDay,r)],["reviewMode",(n.reviewMode??aB)===r.reviewMode],["dependsOnValues",n.dependsOnValues===void 0||Gne(n.dependsOnValues)]].filter(([,o])=>!o).map(([o])=>o),Yne=(e,t,n,r)=>!e.isOff&&Kne(e,t,n,r).length===0,Wne="flightplan-guide-tooltips",Xne=1,Qne=e=>{try{return window.localStorage.getItem(e)}catch{return null}},Zne=(e,t)=>{try{return window.localStorage.setItem(e,t),!0}catch{return!1}},Jne=e=>{try{return window.localStorage.removeItem(e),!0}catch{return!1}},ere={getItem:Qne,setItem:Zne,removeItem:Jne},Ph=e=>({firstSeenAt:e.firstSeenAt,isOff:e.isOff,tooltips:e.tooltips,deferredAt:e.deferredAt,actions:e.actions}),tre=(e,t)=>Object.fromEntries(Object.entries(e).filter(([n])=>n!==t)),nre=(e,t)=>e.includes(t)?e:[...e,t],rre=(e,t)=>e.length===t.length&&e.every((n,r)=>n===t[r]),zr=iB()(kne((e,t)=>({...Mne,visibleViewIds:[],reviewMode:aB,triggersById:{},shownTooltipIds:[],sendEvent:(n,r)=>{if(n==="view"){e(s=>({visibleViewIds:nre(s.visibleViewIds,r)}));return}e(s=>Hne(Ph(s),r,n==="user-action"?"click":"hover",Date.now()))},updateTooltipState:(n,r)=>{e(s=>dB(Ph(s),n,r))},deferTooltip:(n,r)=>{e(s=>Fne(Ph(s),n,r,Date.now()))},turnTipsOff:()=>{e({isOff:!0})},recordFirstVisit:()=>{t().firstSeenAt===null&&e(n=>$ne(Ph(n),Date.now()))},setVisibleViewIds:n=>{rre(t().visibleViewIds,n)||e({visibleViewIds:n})},setReviewMode:n=>{e({reviewMode:n})},registerTriggers:(n,r)=>{e(s=>({triggersById:{...s.triggersById,[n]:r}}))},unregisterTriggers:n=>{e(r=>({triggersById:tre(r.triggersById,n)}))},showTooltip:n=>{e(r=>({shownTooltipIds:[...r.shownTooltipIds.filter(s=>s!==n),n]}))},hideTooltip:n=>{e(r=>({shownTooltipIds:r.shownTooltipIds.filter(s=>s!==n)}))}}),{name:Wne,version:Xne,storage:lB(()=>ere),partialize:Ph})),gB=5e3,sre=6e4,ore="[data-user-action-id]",ire="data-user-action-id",lre=()=>{const[e,t]=N.useState(()=>Date.now());return N.useEffect(()=>{const n=setInterval(()=>{t(Date.now())},sre);return()=>{clearInterval(n)}},[]),e},are=(e,t)=>{const[n,r]=N.useState(!1);return N.useEffect(()=>{if(!e)return;const s=setTimeout(()=>{r(!0)},t);return()=>{clearTimeout(s),r(!1)}},[e,t]),e&&n},cre=(e,{delay:t=gB,triggers:n})=>{const r=lre(),s=N.useRef(n),o=JSON.stringify(n);N.useLayoutEffect(()=>{s.current=n}),N.useEffect(()=>(zr.getState().registerTriggers(e,s.current),()=>{zr.getState().unregisterTriggers(e)}),[e,o]);const l=CT(zr,c=>Yne(c,e,n,{now:r,visibleViewIds:c.visibleViewIds,reviewMode:c.reviewMode,triggersById:c.triggersById}));return{showTooltip:are(l,t),updateTooltipState:c=>{zr.getState().updateTooltipState(e,c)}}},PE=e=>e instanceof Element?e.closest(ore):null,yB=e=>(e==null?void 0:e.getAttribute(ire))??null,QM=e=>{const t=yB(PE(e.target));t!==null&&zr.getState().sendEvent("user-action",t)},ZM=e=>{const t=PE(e.target);if(t===null||t===PE(e.relatedTarget))return;const n=yB(t);n!==null&&zr.getState().sendEvent("user-hover",n)},W1=e=>{e!==null&&zr.getState().sendEvent("user-action",e)},ure=e=>{N.useEffect(()=>{zr.getState().setReviewMode(e)},[e]),N.useEffect(()=>(zr.getState().recordFirstVisit(),document.addEventListener("click",QM,!0),document.addEventListener("pointerover",ZM,!0),()=>{document.removeEventListener("click",QM,!0),document.removeEventListener("pointerover",ZM,!0)}),[])},j0=0,JM=(e,t,n,r)=>Math.max(0,Math.min(t,r)-Math.max(e,n)),xB=(e,t)=>{const n=(e.bottom-e.top)*(e.right-e.left);return n<=0?0:JM(e.top,e.bottom,t.top,t.bottom)*JM(e.left,e.right,t.left,t.right)/n},bB=(e,t)=>xB(e,t)>0,dre=(e,t)=>e.reduce((n,r,s)=>{const o=xB(r,t);return o>n.share?{index:s,share:o}:n},{index:null,share:0}).index,fre=e=>e.placement==="dominant"||e.isOnScreen&&(e.placement==="inside-dominant"||e.placement==="free"),hre=e=>[...new Set(e.filter(fre).map(t=>t.viewId))],vB=()=>({top:0,bottom:window.innerHeight,left:0,right:window.innerWidth}),zE=e=>{const{top:t,bottom:n,left:r,right:s}=e.getBoundingClientRect();return{top:t,bottom:n,left:r,right:s}},SB=(e,t,n="")=>{const r=N.useEffectEvent(t),s=N.useRef(j0);N.useEffect(()=>{if(!e)return;const o=()=>{s.current=j0,r()},l=()=>{s.current===j0&&(s.current=requestAnimationFrame(o))},c=new MutationObserver(l);return c.observe(document.body,{childList:!0,subtree:!0}),window.addEventListener("scroll",l,{passive:!0,capture:!0}),window.addEventListener("resize",l),l(),()=>{cancelAnimationFrame(s.current),s.current=j0,c.disconnect(),window.removeEventListener("scroll",l,{capture:!0}),window.removeEventListener("resize",l)}},[e,n])},BE="[data-view-section-id]",pre="data-view-section-id",X1=`
|
|
343
|
+
`,mre=(e,t)=>t!==""&&e.contains(document.getElementById(t)),gre=(e,t)=>t.has(e.id)||[...t].some(n=>mre(e,n)),yre=(e,t,n)=>{var s;return e===t?"dominant":(t==null?void 0:t.contains(e))===!0?"inside-dominant":(((s=e.parentElement)==null?void 0:s.closest(BE))??null)===null&&!gre(e,n)?"free":"elsewhere"},xre=(e,t)=>{var s;const n=e===null?null:((s=document.getElementById(e))==null?void 0:s.closest(BE))??null,r=vB();return[...document.querySelectorAll(BE)].map(o=>({viewId:o.getAttribute(pre)??"",placement:yre(o,n,t),isOnScreen:bB(zE(o),r)}))},bre=(e,t)=>{const n=t.join(X1);SB(!0,()=>{const r=new Set(n.split(X1));zr.getState().setVisibleViewIds(hre(xre(e,r)))},`${e??""}${X1}${n}`)},Un=({key:e,actionId:t=null,label:n,shortLabel:r=null,description:s=null,isPressed:o=!1,isPrimary:l=!1,isDisabled:c=!1,disabledHint:u=null,onRun:f})=>({kind:"button",key:e,actionId:t,label:n,shortLabel:r,description:s,isPressed:o,isPrimary:l,isDisabled:c,disabledHint:u,onRun:f}),eI=e=>[e.id,e.label,e.detailLabel,e.detailTone,e.isChecked,e.isDisabled].join("|"),vre=e=>e.kind==="choice"?eI(e):["submenu",e.id,e.label,e.heading,e.valueLabel,...e.choices.map(eI)].join("|"),Sre=e=>{var t;return e.kind==="position"?`position|${e.label}`:e.kind==="button"?["button",e.key,e.label,e.shortLabel,e.description,e.isPressed,e.isPrimary,e.isDisabled,e.disabledHint].join("|"):["menu",e.key,e.label,(t=e.badge)==null?void 0:t.label,e.heading,...e.itemGroups.flat().map(vre)].join("|")},wB=e=>e.map(t=>t.map(Sre).join(`
|
|
344
|
+
`)).join(`
|
|
345
|
+
|
|
346
|
+
`),NT=(e,t)=>e.flat().find(n=>n.kind!=="position"&&n.key===t)??null,wre={anchorId:null,share:0,height:0},Ere=(e,t)=>Math.max(0,Math.min(e.bottom,t.bottom)-Math.max(e.top,t.top)),Cre=(e,t)=>{const n=Ere(e,t),r=n/Math.max(1,t.bottom-t.top),s=n/Math.max(1,e.bottom-e.top);return{anchorId:e.anchorId,share:Math.max(r,s),height:n}},Tre=(e,t)=>e.share>t.share||e.share===t.share&&e.height>t.height,Nre=(e,t)=>e.map(n=>Cre(n,t)).filter(n=>n.height>0).reduce((n,r)=>Tre(r,n)?r:n,wre).anchorId,Ore=e=>[...e.groups.flatMap(t=>t.sections.map(n=>n.anchorId)),...e.sections.map(t=>t.anchorId)],tI=e=>t=>({...t,isHere:t.anchorId===e}),Rre=(e,t)=>{const n=e.groups.find(r=>r.sections.some(s=>s.anchorId===t))??e.groups.at(0)??null;return{heading:(n==null?void 0:n.label)??null,sections:((n==null?void 0:n.sections)??[]).map(tI(t)),otherGroups:e.groups.filter(r=>r!==n),looseSections:e.sections.map(tI(t))}},EB="a",OT="d",If="g",Are="ctrl+g",kre="Back",_re="Next",CB={back:null,next:null},Mre="Segment",Ire=(e,t)=>`${Mre} (${String(e+1)}/${String(t)})`,Lre=e=>[...e.groups.flatMap((t,n)=>t.sections.map(r=>({section:r,segmentLabel:Ire(n,e.groups.length)}))),...e.sections.map(t=>({section:t,segmentLabel:null}))],Dre=(e,t)=>e.segmentLabel!==t.segmentLabel&&e.segmentLabel!==null?e.segmentLabel:e.section.label,jre={key:EB,prefix:kre,actionId:"back-section-action"},Pre={key:OT,prefix:_re,actionId:"next-section-action"},nI=({key:e,prefix:t,actionId:n},r,s,o)=>s===void 0?null:Un({key:e,actionId:n,label:`${t}: ${Dre(s,r)}`,shortLabel:t,onRun:()=>{o(s.section.anchorId)}}),TB=(e,t,n)=>{const r=Lre(e),s=r.findIndex(l=>l.section.anchorId===t);if(s===-1)return CB;const o=r[s];return{back:nI(jre,o,r[s-1],n),next:nI(Pre,o,r[s+1],n)}},zre=(e,t)=>{const n=[t.back,t.next].filter(r=>r!==null).filter(r=>NT(e,r.key)===null);return n.length===0?[...e]:[n,...e]},RT=N.createContext(null),hb=N.createContext(null),AT=(e,t)=>{const n=N.use(RT),r=N.useRef(t),s=wB(t);N.useLayoutEffect(()=>{r.current=t}),N.useEffect(()=>{if(!(n===null||e===null))return n.register(e,()=>r.current)},[n,e]),N.useEffect(()=>{n==null||n.notify()},[n,s])},Bre=(e,t,n)=>{var o;const r=((o=N.use(RT))==null?void 0:o.onFullScreenOwnerChange)??null,s=N.useRef(n);N.useLayoutEffect(()=>{s.current=n}),N.useEffect(()=>{if(!(r===null||e===null||!t))return r({anchorId:e,onLeave:()=>{s.current()}}),()=>{r(null)}},[r,e,t])},Hre=e=>{const t=N.use(hb);return t===null?CB:TB(t.rail,e,t.onJump)},Fre="input, textarea, select, [contenteditable]:not([contenteditable='false']), [role='textbox'], [role='searchbox'], [role='combobox']",$re="[role='dialog']:not([data-navigator-scope]), [role='alertdialog']",Ure="[aria-modal='true']:not([data-navigator-scope])",Vre="ctrl+",qre=e=>e instanceof Element&&e.closest(Fre)!==null,Gre=e=>e instanceof Element&&e.closest($re)!==null,NB=e=>!e.defaultPrevented&&!e.repeat&&!e.isComposing&&!e.metaKey&&!e.altKey&&!qre(e.target)&&!Gre(e.target)&&document.querySelector(Ure)===null,Kre=e=>e.ctrlKey?`${Vre}${e.key.toLowerCase()}`:e.key.toLowerCase(),Yre=56,Wre="[data-pinned-row]",Xre={"data-pinned-row":""},kT=()=>Math.max(Yre,...[...document.querySelectorAll(Wre)].map(e=>e.getBoundingClientRect().bottom)),Ad="w",rI="Jump to",OB="jump-to-action",Qre="Review navigator",Zre="Here",Jre="Other segments",ese=180,tse=3e3,P0=0,HE=`
|
|
347
|
+
`,nse=[[["↑","↓"],"move"],[["→"],"sections"],[["↵"],"jump"],[["esc"],"close"]],rse=[[["↑","↓"],"move"],[["space"],"tick"],[["esc"],"close"]],sse=[[["↑","↓"],"move"],[["→"],"open"],[["space"],"tick"],[["esc"],"close"]],ose=new Map,ise=[],pb="inline-flex h-[1.875rem] shrink-0 cursor-pointer items-center gap-1.5 rounded-[0.3rem] px-[0.4375rem] outline-none transition-colors duration-[180ms] ease-out hover:bg-sign-foreground/10 focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-ring disabled:pointer-events-none disabled:opacity-45 aria-pressed:bg-sign-foreground aria-pressed:font-bold aria-pressed:text-sign data-[flash=true]:bg-sign-foreground/25",RB="bg-primary font-bold text-primary-foreground hover:bg-[color-mix(in_oklab,var(--primary)_88%,var(--primary-foreground))]",lse="h-4 min-w-4 text-[0.625rem] normal-case",ase={added:"font-semibold text-diff-added",modified:"font-semibold text-line-blue",deleted:"font-semibold text-diff-removed"},cse=(e,t,n)=>new Map([...e,[t,n]]),use=(e,t,n)=>e.get(t)===n?new Map([...e].filter(([r])=>r!==t)):e,dse=e=>e.flatMap(t=>{const n=document.getElementById(t);if(n===null)return[];const{top:r,bottom:s}=n.getBoundingClientRect();return[{anchorId:t,top:r,bottom:s}]}),fse=e=>{const[t,n]=N.useState(null),r=N.useRef(P0),s=e.join(HE);return N.useEffect(()=>{const o=s===""?[]:s.split(HE),l=()=>{r.current=P0,n(Nre(dse(o),{top:kT(),bottom:window.innerHeight}))},c=()=>{r.current===P0&&(r.current=requestAnimationFrame(l))},u=new ResizeObserver(c);return u.observe(document.body),c(),window.addEventListener("scroll",c,{passive:!0}),window.addEventListener("resize",c),()=>{cancelAnimationFrame(r.current),r.current=P0,u.disconnect(),window.removeEventListener("scroll",c),window.removeEventListener("resize",c)}},[s]),t},sI=e=>{var t;(t=document.getElementById(e))==null||t.scrollIntoView({block:"start"})},hse=(e,{fullScreenOwner:t,onSectionJump:n},r)=>{if(r(null),n==null||n(e),t===null){sI(e);return}t.onLeave(),requestAnimationFrame(()=>{sI(e)})},pse=({rail:e,onSectionJump:t,children:n})=>{const[r,s]=N.useState(null),[o,l]=N.useState(ose),[c,u]=N.useState(null),[f,h]=N.useState(null),[p,y]=N.useState(null),[x]=N.useState(()=>({register:(D,P)=>(l(z=>cse(z,D,P)),()=>{l(z=>use(z,D,P))}),notify:()=>{l(D=>new Map(D))},onFullScreenOwnerChange:u})),b=Ore(e),S=fse(b),E=(c==null?void 0:c.anchorId)??S;bre(E,b);const C=E===null?void 0:o.get(E),O=(C==null?void 0:C())??ise,T=N.useRef({fullScreenOwner:c,onSectionJump:t}),[R]=N.useState(()=>D=>{hse(D,T.current,h)});N.useLayoutEffect(()=>{T.current={fullScreenOwner:c,onSectionJump:t}});const k=N.useMemo(()=>zre(O,TB(e,E,R)),[O,e,E,R]),M=D=>{y(D),setTimeout(()=>{y(P=>P===D?null:P)},ese)},A=D=>{s(D),setTimeout(()=>{s(P=>P===D?null:P)},tse)},I=N.useEffectEvent(D=>{if(!NB(D))return;const P=Kre(D);if(f!==null){if(P!==f)return;D.preventDefault(),h(null);return}if(P===Ad){D.preventDefault(),M(P),h(Ad),W1(OB);return}const z=NT(k,P);z!==null&&(D.preventDefault(),M(P),z.kind==="menu"?(h(z.key),W1(z.actionId??null)):z.isDisabled?z.disabledHint!==null&&A(z.key):(z.onRun(),W1(z.actionId)))});N.useEffect(()=>{const D=P=>{I(P)};return window.addEventListener("keydown",D,!0),()=>{window.removeEventListener("keydown",D,!0)}},[]);const L=N.useMemo(()=>({rail:e,dominantAnchorId:E,groups:k,fullScreenOwner:c,openMenuKey:f,flashedKey:p,hintedKey:r,onHintedKeyChange:s,onHint:A,onOpenMenuKeyChange:h,onJump:R}),[e,E,k,c,f,p,r,R]);return m.jsx(RT,{value:x,children:m.jsx(hb,{value:L,children:n})})},Lm=({label:e,className:t})=>m.jsx(oB,{"aria-hidden":"true",className:t,children:e}),oI=["full","short","keys"],mb=({label:e,shortLabel:t,density:n})=>n==="full"?m.jsx("span",{children:e}):n==="keys"?m.jsx("span",{className:"sr-only",children:e}):m.jsxs(m.Fragment,{children:[m.jsx("span",{"aria-hidden":"true",children:t??e}),m.jsx("span",{className:"sr-only",children:e})]}),_T=(e,t)=>t==="full"?void 0:e,AB=({hints:e})=>m.jsx("div",{className:"-mx-1 mt-1 flex max-w-[21rem] flex-wrap items-center gap-x-3 gap-y-1.5 border-t px-3 pt-2 pb-1.5 text-[0.6875rem] text-muted-foreground",children:e.map(([t,n])=>m.jsxs("span",{className:"inline-flex items-center gap-1",children:[t.map(r=>m.jsx(Lm,{label:r,className:lse},r)),n]},n))}),mse=()=>m.jsx("span",{"aria-hidden":"true",className:"mx-1 h-5 w-px shrink-0 bg-sign-foreground/20"}),gse=({isHere:e})=>m.jsx("span",{"aria-hidden":"true",className:ye("size-3.5 shrink-0 rounded-full border-[2.5px] border-muted-foreground",e&&"border-(--line,var(--primary-text)) bg-(--line,var(--primary-text))")}),yse=()=>m.jsx("span",{"aria-hidden":"true",className:"size-[11px] shrink-0 rounded-[2px] bg-(--line,var(--primary-text))"}),Q1=({section:e,onJump:t})=>m.jsxs(Nne,{onClick:()=>{t(e.anchorId)},children:[m.jsx(gse,{isHere:e.isHere}),m.jsx("span",{className:"min-w-0 flex-1 truncate",children:e.label}),e.isHere?m.jsx("span",{className:"text-xs text-muted-foreground",children:Zre}):null]}),xse=({navigator:e,density:t})=>{const n=Rre(e.rail,e.dominantAnchorId),r=e.openMenuKey===Ad;return m.jsx(Zz,{modal:!1,children:m.jsxs(Jz,{open:r,onOpenChange:s=>{e.onOpenMenuKeyChange(s?Ad:null)},children:[m.jsxs(eB,{"data-flash":e.flashedKey===Ad,"data-user-action-id":OB,title:_T(rI,t),className:ye(pb,"pl-2.5 data-popup-open:bg-sign-foreground/15"),children:[m.jsx(mb,{label:rI,shortLabel:null,density:t}),m.jsx(N3,{"aria-hidden":"true",className:"size-3.5"}),m.jsx(Lm,{label:Ad})]}),m.jsxs(tB,{side:"top",sideOffset:12,className:"max-w-[21rem] min-w-[17rem]",children:[m.jsxs(cp,{children:[n.heading===null?null:m.jsx(up,{children:n.heading}),n.sections.map(s=>m.jsx(Q1,{section:s,onJump:e.onJump},s.anchorId))]}),n.otherGroups.length===0?null:m.jsxs(m.Fragment,{children:[m.jsx(LE,{}),m.jsxs(cp,{children:[m.jsx(up,{children:Jre}),n.otherGroups.map(s=>m.jsxs(nB,{children:[m.jsxs(rB,{children:[m.jsx(yse,{}),m.jsx("span",{className:"min-w-0 flex-1 truncate",children:s.label})]}),m.jsx(sB,{className:"max-w-[21rem] min-w-[15rem]",children:m.jsxs(cp,{children:[s.label===null?null:m.jsx(up,{children:s.label}),s.sections.map(o=>m.jsx(Q1,{section:{...o,isHere:!1},onJump:e.onJump},o.anchorId))]})})]},s.anchorId))]})]}),n.looseSections.length===0?null:m.jsxs(m.Fragment,{children:[m.jsx(LE,{}),n.looseSections.map(s=>m.jsx(Q1,{section:s,onJump:e.onJump},s.anchorId))]}),m.jsx(AB,{hints:nse})]})]})})},bse=({control:e,isFlashed:t,density:n})=>m.jsxs("button",{type:"button","aria-pressed":e.isPrimary?void 0:e.isPressed,disabled:e.isDisabled,title:e.description??_T(e.label,n),"data-flash":t,"data-user-action-id":e.actionId??void 0,className:ye(pb,e.isPrimary&&RB),onClick:e.onRun,children:[m.jsx(mb,{label:e.label,shortLabel:e.shortLabel,density:n}),m.jsx(Lm,{label:e.key})]}),vse=({control:e,isFlashed:t,density:n,hint:r,navigator:s})=>{const o=N.useId();return m.jsxs(m.Fragment,{children:[m.jsx("span",{id:o,hidden:!0,children:r}),m.jsxs(Bz,{open:s.hintedKey===e.key,onOpenChange:l=>{s.onHintedKeyChange(l?e.key:null)},children:[m.jsxs(Hz,{closeOnClick:!1,render:m.jsx("button",{type:"button","aria-pressed":e.isPrimary?void 0:e.isPressed,"aria-disabled":"true","aria-describedby":o,"data-flash":t,"data-user-action-id":e.actionId??void 0,className:ye(pb,e.isPrimary&&RB,"aria-disabled:cursor-default aria-disabled:opacity-45"),onClick:()=>{s.onHint(e.key)}}),children:[m.jsx(mb,{label:e.label,shortLabel:e.shortLabel,density:n}),m.jsx(Lm,{label:e.key})]}),m.jsx(Fz,{sideOffset:12,children:r})]})]})},kB=({choice:e})=>m.jsxs(One,{checked:e.isChecked,disabled:e.isDisabled,onCheckedChange:e.onToggle,children:[e.marker,m.jsx("span",{className:"flex-1",children:e.label}),m.jsx("span",{className:ye("text-xs tabular-nums",e.detailTone===null?"text-muted-foreground":ase[e.detailTone]),children:e.detailLabel})]}),Sse=({submenu:e})=>m.jsxs(nB,{children:[m.jsxs(rB,{children:[m.jsx("span",{className:"flex-1",children:e.label}),e.valueLabel===null?null:m.jsx("span",{className:"max-w-32 truncate text-xs text-muted-foreground",children:e.valueLabel})]}),m.jsx(sB,{className:"min-w-[15rem]",children:m.jsxs(cp,{children:[m.jsx(up,{children:e.heading}),e.choices.map(t=>m.jsx(kB,{choice:t},t.id))]})})]}),wse=({badge:e})=>m.jsxs(m.Fragment,{children:[m.jsx("span",{"aria-hidden":"true",className:"inline-flex h-4 min-w-4 items-center justify-center rounded-full bg-sign-foreground px-1 text-[0.625rem] leading-none font-bold text-sign tabular-nums group-data-popup-open:bg-sign group-data-popup-open:text-sign-foreground",children:e.count}),m.jsx("span",{className:"sr-only",children:e.label})]}),Ese=e=>e.itemGroups.flat().some(t=>t.kind==="submenu"),Cse=({control:e,navigator:t,density:n})=>m.jsx(Zz,{modal:!1,children:m.jsxs(Jz,{open:t.openMenuKey===e.key,onOpenChange:r=>{t.onOpenMenuKeyChange(r?e.key:null)},children:[m.jsxs(eB,{"data-flash":t.flashedKey===e.key,"data-user-action-id":e.actionId,title:_T(e.label,n),className:ye(pb,"group data-popup-open:bg-sign-foreground data-popup-open:font-bold data-popup-open:text-sign"),children:[m.jsx(mb,{label:e.label,shortLabel:null,density:n}),e.badge===null?null:m.jsx(wse,{badge:e.badge}),m.jsx(Lm,{label:e.key})]}),m.jsxs(tB,{side:"top",sideOffset:12,className:"min-w-[17rem]",children:[m.jsxs(cp,{children:[m.jsx(up,{children:e.heading}),e.itemGroups.map((r,s)=>m.jsxs("div",{children:[s===0?null:m.jsx(LE,{}),r.map(o=>o.kind==="choice"?m.jsx(kB,{choice:o},o.id):m.jsx(Sse,{submenu:o},o.id))]},r.map(o=>o.id).join(HE)))]}),m.jsx(AB,{hints:Ese(e)?sse:rse})]})]})}),Tse=({control:e,navigator:t,density:n})=>{if(e.kind==="position")return m.jsx("span",{className:"min-w-16 px-1 text-center tabular-nums",children:e.label});if(e.kind==="menu")return m.jsx(Cse,{control:e,navigator:t,density:n});const r=t.flashedKey===e.key;return e.isDisabled&&e.disabledHint!==null?m.jsx(vse,{control:e,isFlashed:r,density:n,hint:e.disabledHint,navigator:t}):m.jsx(bse,{control:e,isFlashed:r,density:n})},FE="position",iI=e=>e.kind==="position"?FE:e.key,lI="calc(var(--navigator-inset-left, 0px) + (100% - var(--navigator-inset-left, 0px) - var(--navigator-inset-right, 0px)) / 2)",Nse="1.5rem",Ose=2,Rse="100% - var(--navigator-inset-right, 1.5rem)",Ase=e=>{if(e===null)return lI;const t=`${String(e/Ose)}px`;return`clamp(calc(${Nse} + ${t}), ${lI}, calc(${Rse} - ${t}))`},aI=e=>{const[t,n]=N.useState(null);return N.useEffect(()=>{if(e===null)return;const r=new ResizeObserver(()=>{n(e.offsetWidth)});return r.observe(e),()=>{r.disconnect()}},[e]),t},kse={signature:"",densityIndex:0},_se=(e,t,n)=>{const[r,s]=N.useState(kse),o=`${n}|${String(t)}`,l=r.signature===o?r.densityIndex:0;return N.useEffect(()=>{if(e===null||t===null||l===oI.length-1)return;const c=new ResizeObserver(()=>{e.offsetWidth>t&&s({signature:o,densityIndex:l+1})});return c.observe(e),()=>{c.disconnect()}},[e,t,o,l]),oI[l]},_B=({place:e="page",...t})=>{const n=N.use(hb),[r,s]=N.useState(null),[o,l]=N.useState(null),c=aI(r),u=aI(o),f=((n==null?void 0:n.groups)??[]).filter(p=>p.length>0),h=_se(r,u,wB(f));return n===null||e==="page"&&n.fullScreenOwner!==null?null:m.jsxs(m.Fragment,{children:[m.jsx("div",{"aria-hidden":"true",ref:l,className:"pointer-events-none fixed bottom-0 left-6 h-0 right-[var(--navigator-inset-right,1.5rem)]"}),m.jsx("div",{"aria-hidden":"true",className:"fixed bottom-0 left-0 right-[var(--navigator-band-right,0px)] z-40 h-11 bg-sign",children:m.jsx("span",{className:"absolute inset-x-0 top-0 h-1 bg-(--line,var(--primary-text))"})}),m.jsxs("div",{ref:s,role:"toolbar","aria-label":Qre,...t,style:{...t.style,left:Ase(c)},className:ye("fixed bottom-0 z-40 flex h-10 -translate-x-1/2 items-center px-1 text-[0.8rem] whitespace-nowrap text-sign-foreground transition-[left] duration-200 ease-out",t.className),children:[m.jsx(xse,{navigator:n,density:h}),m.jsx("div",{className:"flex items-center duration-[180ms] animate-in fade-in-0",children:f.map(p=>m.jsxs("div",{className:"flex items-center gap-0.5",children:[m.jsx(mse,{}),p.map(y=>m.jsx(Tse,{control:y,navigator:n,density:h},iI(y)))]},p.map(iI).find(y=>y!==FE)??FE))},n.dominantAnchorId??"")]})]})},gb=1.25,Mse=1,Ise=3,MB=gb**-4,IB=gb**Ise,Lse=.002,Dse=16,jse=1,Pse=2,cI=2,MT=e=>Math.min(IB,Math.max(MB,e)),zse=e=>MT(e*gb),Bse=e=>MT(e/gb),Hse=({deltaY:e,deltaMode:t},n)=>t===jse?e*Dse:t===Pse?e*n:e,Fse=(e,t)=>MT(e*Math.exp(-t*Lse)),uI=({paneWidth:e,paneHeight:t,width:n,height:r,isCentred:s},o)=>{const l=(e-n*o)/cI,c=(t-r*o)/cI;return s?{x:l,y:c}:{x:Math.max(0,l),y:0}},$se=(e,t,n,r,s)=>{const o=uI(s,n),l=uI(s,r),c=r/n,u=(f,h,p)=>f-(f-h)*c-p;return{x:u(e.x,o.x+t.x,l.x),y:u(e.y,o.y+t.y,l.y)}},LB="escape-key",Use=e=>e instanceof HTMLElement&&e.getAttribute("aria-expanded")==="true",Xke=e=>(t,n)=>{t||(n.reason===LB&&Use(n.event.target)?n.cancel():e())},Vse={x:0,y:0},qse=0,Gse=4,dI=["pointerup","pointercancel"],Kse=(e,t)=>({x:t.x-e.x,y:t.y-e.y}),Yse=(e,t)=>({x:e.x+t.x,y:e.y+t.y}),Wse=({x:e,y:t})=>Math.hypot(e,t)>=Gse,fI=({clientX:e,clientY:t})=>({x:e,y:t}),Xse=()=>{const[e,t]=N.useState(Vse),[n,r]=N.useState(!1),s=N.useRef(!1);return{offset:e,isDragging:n,startDrag:c=>{if(c.button!==qse)return;s.current=!1;const u=fI(c),f=e,h=y=>{const x=Kse(u,fI(y));!s.current&&!Wse(x)||(s.current=!0,r(!0),t(Yse(f,x)))},p=()=>{window.removeEventListener("pointermove",h),dI.forEach(y=>{window.removeEventListener(y,p)}),r(!1)};window.addEventListener("pointermove",h),dI.forEach(y=>{window.addEventListener(y,p)})},swallowClickAfterDrag:c=>{s.current&&(s.current=!1,c.stopPropagation(),c.preventDefault())},panTo:t}},DB="flight-plan:layout:v1",jB="flight-plan:layout-saved",hI=[jB,"storage"],Yy={diagramPanelWidthPx:null},Qse=e=>{if(typeof e!="object"||e===null||!("diagramPanelWidthPx"in e))return Yy;const{diagramPanelWidthPx:t}=e;return typeof t=="number"&&Number.isFinite(t)?{diagramPanelWidthPx:t}:Yy},Zse=e=>{try{return e===null?Yy:Qse(JSON.parse(e))}catch{return Yy}},Jse=()=>{try{return window.localStorage.getItem(DB)}catch{return null}},eoe=()=>null,toe=e=>(hI.forEach(t=>{window.addEventListener(t,e)}),()=>{hI.forEach(t=>{window.removeEventListener(t,e)})}),noe=e=>{try{window.localStorage.setItem(DB,JSON.stringify(e))}catch{return}window.dispatchEvent(new Event(jB))},roe=()=>{const e=N.useSyncExternalStore(toe,Jse,eoe);return N.useMemo(()=>Zse(e),[e])},soe=0,IT=320,ooe=.8,pI=32,mI=["pointerup","pointercancel"],gI={ArrowLeft:pI,ArrowRight:-pI},PB=e=>Math.max(IT,Math.round(e*ooe)),yI=(e,t)=>Math.round(Math.min(PB(t),Math.max(IT,e))),ioe=e=>{const{diagramPanelWidthPx:t}=roe(),[n,r]=N.useState(null),s=n!==null,o=f=>{noe({diagramPanelWidthPx:f})};return{widthPx:n??t,isResizing:s,narrowestPx:IT,startResize:f=>{if(f.button!==soe)return;f.preventDefault();const h=f.clientX,p=e(),y=S=>yI(p+h-S,window.innerWidth),x=S=>{r(y(S.clientX))},b=S=>{window.removeEventListener("pointermove",x),mI.forEach(E=>{window.removeEventListener(E,b)}),r(null),o(y(S.clientX))};r(Math.round(p)),window.addEventListener("pointermove",x),mI.forEach(S=>{window.addEventListener(S,b)})},resizeByKey:f=>{Object.hasOwn(gI,f.key)&&(f.preventDefault(),o(yI(e()+gI[f.key],window.innerWidth)))},resetWidth:()=>{o(null)}}},loe=2,aoe=160,coe="70vh",uoe="Side panel width",doe=669,foe="Its own width",hoe="Drag to resize, double-click to reset",poe="Zoom in",moe="Zoom out",xI="Full screen",bI="Leave full screen",goe="f",zB="--line",yoe=e=>e===null?"":getComputedStyle(e).getPropertyValue(zB),xoe=e=>t=>{const n=yoe(e.current);t!==null&&n!==""&&t.style.setProperty(zB,n)},boe=({label:e,width:t,height:n,zoom:r,offset:s,isDragging:o,isCentred:l,children:c,onDragStart:u,onClickCapture:f})=>m.jsx("div",{role:"group","aria-label":e,"data-dragging":o,className:ye("size-full cursor-grab touch-none overflow-clip bg-[radial-gradient(circle,var(--border)_1px,transparent_1px)] bg-size-[16px_16px] select-none data-[dragging=true]:cursor-grabbing",l&&"flex items-center justify-center"),style:{backgroundPosition:`${String(s.x)}px ${String(s.y)}px`},onPointerDown:u,onClickCapture:f,children:m.jsx("div",{className:l?"shrink-0":"mx-auto",style:{width:t*r,height:n*r,transform:`translate(${String(s.x)}px, ${String(s.y)}px)`},children:m.jsx("div",{className:"relative origin-top-left",style:{width:t,height:n,transform:`scale(${String(r)})`},children:c})})}),BB="pointer-events-none z-10 flex justify-end px-2",voe=`${BB} sticky top-[calc(var(--pinned-height,var(--band-height,0px))+0.5rem)] mt-2`,Soe=`${BB} absolute inset-x-0 top-2`,HB=({label:e,width:t,height:n,isFullScreen:r,isCentred:s=!1,panel:o,actions:l=null,navigation:c=null,renderCanvas:u=null,children:f=null,onFullScreenChange:h,onPanelClose:p})=>{const[y,x]=N.useState(Mse),{offset:b,isDragging:S,startDrag:E,swallowClickAfterDrag:C,panTo:O}=Xse(),T=N.useRef(null),R=N.useRef(null),k=N.useRef(null),M=K=>{k.current=K,xoe(T)(K)},A=()=>{var K;return((K=R.current)==null?void 0:K.getBoundingClientRect().width)??0},{widthPx:I,isResizing:L,narrowestPx:D,startResize:P,resizeByKey:z,resetWidth:$}=ioe(A),j=(K,W)=>{K.preventDefault();const ee=W.getBoundingClientRect(),ce=Fse(y,Hse(K,ee.height));if(ce===y)return;const F={x:K.clientX-ee.left,y:K.clientY-ee.top};O($se(F,b,y,ce,{paneWidth:ee.width,paneHeight:ee.height,width:t,height:n,isCentred:s})),x(ce)},H=K=>{if(K===null)return;const W=ee=>{j(ee,K)};return K.addEventListener("wheel",W,{passive:!1}),()=>{K.removeEventListener("wheel",W)}},B=(K,W)=>{!K&&W.reason===LB&&o!==null?p():h(K)},V=[Un({key:goe,actionId:"full-screen-action",label:r?bI:xI,isPressed:r,onRun:()=>{h(!r)}})];AT((c==null?void 0:c.anchorId)??null,c===null?[]:[...c.groups,V]),Bre((c==null?void 0:c.anchorId)??null,r,()=>{h(!1)});const G=m.jsxs("div",{className:"pointer-events-auto flex items-center gap-0.5 rounded-md border border-input bg-card p-0.5",children:[l===null?null:m.jsxs(m.Fragment,{children:[l,m.jsx("span",{"aria-hidden":"true",className:"mx-0.5 h-4 w-px bg-border"})]}),m.jsx(or,{icon:"zoomIn",label:poe,isDisabled:y>=IB,onClick:()=>{x(zse)}}),m.jsx(or,{icon:"zoomOut",label:moe,isDisabled:y<=MB,onClick:()=>{x(Bse)}}),m.jsx(or,{icon:r?"leaveFullScreen":"fullScreen",label:r?bI:xI,onClick:()=>{h(!r)}})]}),q=u===null?m.jsx(boe,{label:e,width:t,height:n,zoom:y,offset:b,isDragging:S,isCentred:s,onDragStart:E,onClickCapture:C,children:f}):u({zoom:y,offset:b,onPan:O});return m.jsxs(m.Fragment,{children:[m.jsx("div",{ref:T,className:"relative flex flex-col justify-start rounded-md border",style:{height:Math.max(aoe,n*y+loe),maxHeight:coe},children:r?null:m.jsxs(m.Fragment,{children:[m.jsx("div",{ref:H,className:"absolute inset-0",children:q}),m.jsx("div",{className:voe,children:G})]})}),m.jsx(Wz,{open:r,onOpenChange:B,children:m.jsx(Yz,{children:m.jsxs(Kz,{ref:M,initialFocus:k,"aria-label":e,"data-navigator-scope":"",className:"fixed inset-0 z-50 flex bg-background text-foreground outline-none duration-150 data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0",children:[m.jsxs("div",{ref:H,className:"relative min-w-0 flex-1",children:[m.jsx("div",{className:Soe,children:G}),q,m.jsx(_B,{place:"full-screen"})]}),o===null?null:m.jsx("div",{role:"slider",tabIndex:0,"aria-orientation":"horizontal","aria-label":uoe,"aria-valuemin":D,"aria-valuemax":PB(window.innerWidth),"aria-valuenow":I??doe,"aria-valuetext":I===null?foe:`${String(I)} pixels`,title:hoe,"data-resizing":L,className:"relative z-10 w-px shrink-0 cursor-col-resize touch-none bg-border transition-colors duration-[180ms] ease-out after:absolute after:inset-y-0 after:-right-1 after:-left-1 hover:bg-foreground focus-visible:bg-ring focus-visible:outline-2 focus-visible:outline-ring data-[resizing=true]:bg-foreground",onPointerDown:P,onKeyDown:z,onDoubleClick:$}),m.jsx("aside",{ref:R,style:I===null?void 0:{width:I},className:ye("w-[min(41.8rem,52.8vw)] max-w-[80vw] min-w-80 shrink-0 overflow-y-auto bg-background duration-200 ease-out animate-in slide-in-from-right-8",o===null?"hidden":""),children:o})]})})})]})};function woe(e){return!FB(e)}function FB(e){return e.hasOwnProperty("lineNumber")}function Eoe(e,t,n){if(t==="children")e.children=n||e.children;else if(t==="_ref")e._ref=n||e._ref;else if(t==="data")e.data=e.data?{...e.data,...n}:n;else if(t==="className")e.className=[e.className,n].join(" ").trim();else if(t==="style")e.style={...e.style,...n};else if(typeof n=="function"){const r=e[t];e[t]=r?(...s)=>{r(...s),n(...s)}:n}else{if(n===void 0||typeof n!="object"&&n===e[t])return;if(!(t in e))e[t]=n;else throw new Error(`Didn’t know how to merge prop '${t}'. Only 'className', 'style', and event handlers are supported`)}}function LT(...e){return e.length===1?e[0]:e.reduce((t,n)=>{for(const r in n)Eoe(t,r,n[r]);return t},{})}const $B=({merge:e,...t})=>{const{_stack:n,...r}=LT(e,t),[s,...o]=n;if(s)return m.jsx(s,{_stack:o,...r});{const{_ref:l,data:c,children:u,...f}=r;return m.jsx("pre",{...f,ref:l,"data-ch":!0,children:m.jsx("div",{style:{minWidth:"fit-content"},children:u})})}},Wy=({merge:e,...t})=>{const{_stack:n,...r}=LT(e,t),[s,...o]=n;if(s){const{Component:l,annotation:c}=s;return m.jsx(l,{_stack:o,...r,annotation:c})}else{const{lineNumber:l,totalLines:c,indentation:u,data:f,annotation:h,...p}=r;return m.jsx("div",{...p})}},Coe=({merge:e,...t})=>{const{_stack:n,...r}=LT(e,t),[s,...o]=n;if(s){const{Component:l,annotation:c}=s;return m.jsx(l,{_stack:o,...r,annotation:c})}else{const{value:l,data:c,...u}=r;return m.jsx("span",{...u,children:l})}},Toe=e=>{const t=N.useRef(null),n=e._ref||t;return m.jsx($B,{merge:e,_ref:n})};function Noe(e,t){let n=e;for(let r=t.length-1;r>=0;r--){const s=t[r];n=Ooe(n,s)}return n}function Ooe(e,t){const{fromColumn:n,toColumn:r}=t,s=[n,r];let o=$E(e,s[0]);o=$E(o,s[1]+1);let l=[],c=[],u=[];return o.forEach(f=>{f.range[1]<s[0]?l.push(f):f.range[0]>s[1]?u.push(f):c.push(f)}),[...l,{annotation:t,content:c,range:[c[0].range[0],c[c.length-1].range[1]]},...u]}function $E(e,t){const n=e.findIndex(s=>s.range[0]<t&&t<=s.range[1]);if(n===-1)return e;const r=e[n];if(UB(r)){const s=$E(r.content,t);let o=[],l=[];for(const c of s)c.range[1]<t?o.push(c):l.push(c);return[...e.slice(0,n),{...r,content:o,range:[r.range[0],t-1]},{...r,content:l,range:[t,r.range[1]]},...e.slice(n+1)]}return[...e.slice(0,n),{...r,value:r.value.slice(0,t-r.range[0]),range:[r.range[0],t-1]},{...r,value:r.value.slice(t-r.range[0]),range:[t,r.range[1]]},...e.slice(n+1)]}function UB(e){return e.content!==void 0}function VB({content:e,handlers:t,annotationStack:n}){return e.map((r,s)=>UB(r)?m.jsx(Aoe,{annotationStack:n,handlers:t,group:r},s):r.style?m.jsx(Roe,{annotationStack:n,handlers:t,token:r},s):r.value)}function Roe({handlers:e,token:t,annotationStack:n}){const r=koe(e,n);return m.jsx(Coe,{merge:{_stack:r,style:t.style,value:t.value}})}function Aoe({group:e,handlers:t,annotationStack:n}){var r;const{annotation:s,content:o}=e,{name:l}=s,c=VB({content:o,handlers:t,annotationStack:[...n,s]}),u=(r=t.find(f=>f.name===l))===null||r===void 0?void 0:r.Inline;return u?m.jsx(u,{annotation:s,children:c}):c}function koe(e,t){const n=[];return e.forEach(({name:r,Token:s,AnnotatedToken:o})=>{const l=t.filter(c=>c.name===r);o&&l.forEach(c=>n.push({Component:o,annotation:c})),s&&(l.length||n.push({Component:s}),l.forEach(c=>n.push({Component:s,annotation:c})))}),n}const _oe=" ";function Moe(e){const t=[[]],n=e.slice();let r=1;for(;n.length;){const o=n.shift();if(typeof o=="string"){const[l,...c]=o.split(`
|
|
348
|
+
`);if(l){let u=r;r+=l.length,t[t.length-1].push({value:l,range:[u,r]})}c.length&&(t[t.length-1].push({value:`
|
|
349
|
+
`,range:[r,r+1]}),t.push([]),r=1,n.unshift(c.join(`
|
|
350
|
+
`)))}else{const[l,c,u={}]=o;let f=r;r+=l.length,t[t.length-1].push({value:l,style:{color:c,...u},range:[f,r]})}}const s=t.length;return t.map((o,l)=>{var c,u,f;return{tokens:o,range:[l+1,l+1],lineNumber:l+1,indentation:((f=(u=(c=o[0])===null||c===void 0?void 0:c.value)===null||u===void 0?void 0:u.replace(/\t/g,_oe).match(/^\s*/))===null||f===void 0?void 0:f[0].length)||0,totalLines:s}})}function Ioe(e,t){let n=e;for(let r=t.length-1;r>=0;r--){const s=t[r];n=Loe(n,s)}return n}function Loe(e,t){const{fromLineNumber:n,toLineNumber:r}=t,s=[n,r];let o=UE(e,s[0]);o=UE(o,s[1]+1);let l=[],c=[],u=[];return o.forEach(f=>{f.range[1]<s[0]?l.push(f):f.range[0]>s[1]?u.push(f):c.push(f)}),[...l,{annotation:t,lines:c,range:[c[0].range[0],c[c.length-1].range[1]]},...u]}function UE(e,t){const n=e.findIndex(c=>qB(c)&&c.range[0]<t&&t<=c.range[1]);if(n===-1)return e;const r=e[n],s=UE(r.lines,t);let o=[],l=[];return s.forEach(c=>{c.range[1]<t?o.push(c):l.push(c)}),[...e.slice(0,n),{...r,lines:o,range:[r.range[0],t-1]},{...r,lines:l,range:[t,r.range[1]]},...e.slice(n+1)]}function qB(e){return e.annotation!==void 0}function GB({linesOrGroups:e,handlers:t,inlineAnnotations:n,annotationStack:r=[]}){return e.map(s=>qB(s)?m.jsx(joe,{group:s,handlers:t,inlineAnnotations:n,annotationStack:r},s.range[0]):m.jsx(Doe,{line:s,handlers:t,inlineAnnotations:n,annotationStack:r},s.lineNumber))}function Doe({line:e,handlers:t,inlineAnnotations:n,annotationStack:r=[]}){const{lineNumber:s,totalLines:o,indentation:l}=e,c=n.filter(y=>y.lineNumber===s),u=Noe(e.tokens,c),f=Poe(t,r);let h=VB({content:u,handlers:t,annotationStack:r});const p={lineNumber:s,indentation:l,totalLines:o,_stack:f};return m.jsx(Wy,{merge:p,children:h},s)}function joe({group:e,handlers:t,inlineAnnotations:n,annotationStack:r}){var s;const{annotation:o,lines:l}=e,{name:c}=o,u=(s=t.find(h=>h.name===c))===null||s===void 0?void 0:s.Block,f=GB({linesOrGroups:l,handlers:t,inlineAnnotations:n,annotationStack:[...r,o]});return u?m.jsx(u,{annotation:o,children:f}):f}function Poe(e,t){const n=[];return e.forEach(({name:r,Line:s,AnnotatedLine:o})=>{const l=t.filter(c=>c.name===r);o&&l.forEach(c=>{n.push({Component:o,annotation:c})}),s&&(l.length||n.push({Component:s}),l.forEach(c=>{n.push({Component:s,annotation:c})}))}),n}const zoe=N.forwardRef(({code:e,handlers:t=[],...n},r)=>{let{tokens:s,themeName:o,lang:l,annotations:c}=e;if(!s)throw new Error("Missing tokens in code block. Use the `highlight` function to generate the tokens.");t.filter(y=>y.transform).forEach(y=>{c=c.flatMap(x=>y.name!=x.name?x:y.transform(x)||[])});const u=new Set(c.map(y=>y.name)),f=t.filter(y=>!y.onlyIfAnnotated||u.has(y.name)),p={_stack:Hoe(f),_ref:r};return m.jsx($B,{merge:p,"data-theme":o,"data-lang":l,...n,children:m.jsx(Boe,{tokens:s,handlers:f,annotations:c})})});function Boe({tokens:e,handlers:t,annotations:n}){const r=Moe(e),s=n.filter(woe),o=n.filter(FB),l=Ioe(r,s);return GB({linesOrGroups:l,handlers:t,inlineAnnotations:o})}function Hoe(e){const t=e.map(({Pre:r})=>r).filter(Boolean),n=e.map(({PreWithRef:r})=>r).filter(Boolean);return n.length>0&&n.unshift(Toe),[...t,...n]}function Foe(e){const{open:t,defaultOpen:n=!1,onOpenChange:r,disabled:s}=e,[o,l]=B2({controlled:t,default:n,name:"Collapsible",state:"open"}),{mounted:c,setMounted:u,transitionStatus:f}=V2(o,!0,!0),h=ls(),[p,y]=N.useState(),x=p===null?void 0:p??h,b=Ve(S=>{const E=!o,C=ct(di,S.nativeEvent);r(E,C),!C.isCanceled&&l(E)});return N.useMemo(()=>({defaultPanelId:h,disabled:s,handleTrigger:b,mounted:c,open:o,panelId:x,setMounted:u,setOpen:l,setPanelIdState:y,transitionStatus:f}),[h,s,b,c,o,x,u,l,y,f])}const KB=N.createContext(void 0);function YB(){const e=N.useContext(KB);if(e===void 0)throw new Error(Wt(15));return e}const $oe="data-open",Uoe="data-closed",Voe=D2,qoe="data-panel-open",Goe={[$oe]:""},Koe={[Uoe]:""},Yoe={open(e){return e?{[qoe]:""}:null}},Woe={open(e){return e?Goe:Koe}},WB={...Woe,...dm},Xoe=N.forwardRef(function(t,n){const{render:r,className:s,defaultOpen:o=!1,disabled:l=!1,onOpenChange:c,open:u,style:f,...h}=t,p=Ve(c),y=Foe({open:u,defaultOpen:o,onOpenChange:p,disabled:l}),x=N.useMemo(()=>({open:y.open,disabled:y.disabled,transitionStatus:y.transitionStatus}),[y.open,y.disabled,y.transitionStatus]),b=N.useMemo(()=>({...y,onOpenChange:p,state:x}),[y,p,x]),S=Lt("div",t,{state:x,ref:n,props:h,stateAttributesMapping:WB});return m.jsx(KB.Provider,{value:b,children:S})}),Qoe={...Yoe,...dm},Zoe=N.forwardRef(function(t,n){const{panelId:r,open:s,handleTrigger:o,state:l,disabled:c}=YB(),{className:u,disabled:f=c,render:h,nativeButton:p=!0,style:y,...x}=t,{getButtonProps:b,buttonRef:S}=Su({disabled:f,focusableWhenDisabled:!0,native:p});return Lt("button",t,{state:l,ref:[n,S],props:[{"aria-controls":s?r:void 0,"aria-expanded":s,onClick:o},x,b],stateAttributesMapping:Qoe})}),zh={height:void 0,width:void 0};function Joe(e){const{externalRef:t,hiddenUntilFound:n,id:r,keepMounted:s,mounted:o,onOpenChange:l,open:c,setMounted:u,setOpen:f,transitionStatus:h}=e,p=N.useRef(null),y=N.useRef(null),[x,b]=N.useState(zh),S=N.useRef(zh),E=N.useRef(!1),C=N.useRef(c),O=N.useRef(!1),[T,R]=N.useState(!1),k=N.useRef(null),M=Ba(t,p),A=In(c),I=gm(p),L=!c&&!o,D=T?"idle":h,P=c&&(C.current||O.current),z=!c&&o&&y.current==="css-animation"&&x.height===void 0&&x.width===void 0?S.current:x,$=n&&L&&y.current!=="css-animation",j=Ve((q,K=!0)=>{K&&(S.current=q),b(q)}),H=Ve(()=>{var q;(q=k.current)==null||q.call(k),k.current=null}),B=Ve(q=>{H(),k.current=()=>{k.current=null,q()}}),V=Ve(()=>{c&&o&&y.current==="css-animation"&&(O.current=!0)});Be(()=>{!T||h==="starting"||R(!1)},[T,h]),N.useEffect(()=>()=>{V(),H()},[V,H]),Be(()=>{const q=p.current;if(!q)return;!c&&k.current&&H();const K=eie(q,P);if(y.current=K,c&&h==="idle"&&C.current&&K==="css-animation"){S.current=yd(q);return}if(c&&h==="starting"){const ce=E.current;if(E.current=!1,K==="none"){j(yd(q)),R(!0);return}if(K==="css-transition"){const te=tie(q);if(j(yd(q)),!ce)return te;const Z=z0(q,"transition-duration","0s");return B(Z),R(!0),te}j(yd(q));const F=z0(q,"animation-name","none");if(!ce){F();return}const X=z0(q,"animation-duration","0s");F(),B(X),R(!0);return}if(!c&&o&&(h==="idle"||h==="starting")){if(C.current=!1,O.current=!1,K==="none"){j(zh,!1),u(!1);return}j(yd(q));return}if(h!=="ending")return;if(K==="none"){u(!1);return}const W=yd(q);if(!(W.height>0||W.width>0)){u(!1);return}j(W),K==="css-animation"&&z0(q,"animation-name","none")()},[o,c,H,j,u,B,P,h]),Ya({enabled:c&&o&&D==="idle",open:!0,ref:p,onComplete(){c&&j(zh,!1)}}),N.useEffect(()=>{if(c||!o||D!=="ending"||!p.current)return;const K=new AbortController;let W=-1;function ee(){A.current||(u(!1),j(zh,!1))}return W=xs.request(()=>{I(ee,K.signal)}),()=>{xs.cancel(W),K.abort()}},[A,o,c,D,I,j,u]),Be(()=>{const q=p.current;!q||!n||!L||q.setAttribute("hidden","until-found")},[L,n]),N.useEffect(function(){const K=p.current;if(!K)return;function W(ee){const ce=ct(pm,ee);l(!0,ce),!ce.isCanceled&&(E.current=!0,f(!0))}return bt(K,"beforematch",W)},[l,f]);const G=s||n||o||c;return{height:z.height,props:{...$?{[Voe]:""}:void 0,hidden:L,id:r},ref:M,shouldPreventOpenAnimation:P,shouldRender:G,transitionStatus:D,width:z.width}}function yd(e){return{height:e.scrollHeight,width:e.scrollWidth}}function eie(e,t){const n=pn(e).getComputedStyle(e),r=(n.animationName.split(",").map(o=>o.trim()).some(o=>o!==""&&o!=="none")||t)&&vI(n.animationDuration),s=vI(n.transitionDuration);return r&&s||s?"css-transition":r?"css-animation":"none"}function vI(e){return e.split(",").map(t=>t.trim()).some(t=>t!==""&&Number.parseFloat(t)>0)}function z0(e,t,n){const r=e.style.getPropertyValue(t),s=e.style.getPropertyPriority(t);return e.style.setProperty(t,n),()=>{if(r===""){e.style.removeProperty(t);return}e.style.setProperty(t,r,s)}}function tie(e){const t={"justify-content":e.style.justifyContent,"align-items":e.style.alignItems,"align-content":e.style.alignContent,"justify-items":e.style.justifyItems};Object.keys(t).forEach(s=>{e.style.setProperty(s,"initial","important")});function n(){Object.entries(t).forEach(([s,o])=>{if(o===""){e.style.removeProperty(s);return}e.style.setProperty(s,o)})}const r=xs.request(n);return()=>{xs.cancel(r),n()}}const nie="--collapsible-panel-height",rie="--collapsible-panel-width",sie=N.forwardRef(function(t,n){const{className:r,hiddenUntilFound:s,keepMounted:o,render:l,id:c,style:u,...f}=t,{defaultPanelId:h,mounted:p,onOpenChange:y,open:x,setMounted:b,setPanelIdState:S,setOpen:E,state:C,transitionStatus:O}=YB(),T=s??!1,R=o??!1,k=c||void 0,M=k??h;Be(()=>(S(V=>k??(V===null?void 0:V)),()=>{S(V=>V===k?null:V)}),[k,S]);const{height:A,props:I,ref:L,shouldPreventOpenAnimation:D,shouldRender:P,transitionStatus:z,width:$}=Joe({externalRef:n,hiddenUntilFound:T,id:M,keepMounted:R,mounted:p,onOpenChange:y,open:x,setMounted:b,setOpen:E,transitionStatus:O}),j={...C,transitionStatus:z},H=V4(u,j),B=Lt("div",{...t,style:void 0},{state:j,ref:L,props:[I,{style:{[nie]:A===void 0?"auto":`${A}px`,[rie]:$===void 0?"auto":`${$}px`}},f,H?{style:H}:void 0,D?{style:{animationName:"none"}}:void 0],stateAttributesMapping:WB});return P?B:null});function oie({...e}){return m.jsx(Xoe,{"data-slot":"collapsible",...e})}function iie({...e}){return m.jsx(Zoe,{"data-slot":"collapsible-trigger",...e})}function lie({...e}){return m.jsx(sie,{"data-slot":"collapsible-content",...e})}const XB=N.createContext(void 0);function Lf(e){const t=N.useContext(XB);if(t===void 0&&!e)throw new Error(Wt(50));return t}const aie=600,QB=300,ZB={...Rm,instantType:e=>e.instantType,adaptiveOrigin:e=>e.adaptiveOrigin,closeDelay:e=>e.closeDelay};class cie extends Cu{constructor(n,r,s){const o=new _f;super(JB(n,o,r,s),e6(o),ZB);Ot(this,"setOpen",(n,r)=>{const{inlineRectCoordsRef:s}=this.context;cz(this,n,r,{onBeforeDispatch(){var l;const o=r.event;n&&r.reason===wn&&r.trigger&&"clientX"in o&&"clientY"in o&&((l=s.current)==null?void 0:l.element)!==r.trigger&&rz(s,r.trigger,o.clientX,o.clientY)}})})}}function uie(){const e=new _f;return new cee(Object.freeze(JB(void 0,e)),Object.freeze(e6(e)),ZB)}function JB(e,t,n,r=!1){return{...Om(t,n,r),instantType:void 0,adaptiveOrigin:void 0,closeDelay:QB,...e}}function e6(e){return{popupRef:N.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerElements:e,inlineRectCoordsRef:{current:void 0}}}function SI(e){const{open:t,defaultOpen:n=!1,onOpenChange:r,onOpenChangeComplete:s,actionsRef:o,handle:l,triggerId:c,defaultTriggerId:u=null,children:f}=e,h=sb((C,O)=>new cie({open:n,openProp:t,activeTriggerId:u,triggerIdProp:c},C,O));h.useControlledProp("openProp",t),h.useControlledProp("triggerIdProp",c),h.useContextCallback("onOpenChange",r),h.useContextCallback("onOpenChangeComplete",s);const p=h.useState("open"),y=h.useState("activeTriggerId"),x=h.useState("mounted"),b=h.useState("payload");Cm(h,{closeOnActiveTriggerUnmount:!0});const{forceUnmount:S}=Tm(p,h,()=>{h.context.inlineRectCoordsRef.current=void 0});Be(()=>{p&&y==null&&h.set("payload",void 0)},[h,y,p]),N.useImperativeHandle(o,()=>({unmount:S,close:()=>h.setOpen(!1,ct(iu))}),[S,h]);const E=p||x;return m.jsxs(XB.Provider,{value:h,children:[l&&m.jsx(wm,{handle:l,store:h}),E&&m.jsx(die,{store:h}),typeof f=="function"?f({payload:b}):f]})}function die({store:e}){const t=e.useState("floatingRootContext"),n=bm(t);return Nm(e,{activeTriggerProps:n.reference,inactiveTriggerProps:n.trigger,popupProps:n.floating}),null}const fie=kf(function(t){return Lf(!0)?m.jsx(SI,{...t}):m.jsx(tb,{children:m.jsx(SI,{...t})})}),t6=N.createContext(void 0);function hie(){const e=N.useContext(t6);if(e===void 0)throw new Error(Wt(48));return e}const pie=N.forwardRef(function(t,n){const{keepMounted:r=!1,...s}=t;return Lf().useState("mounted")||r?m.jsx(t6.Provider,{value:r,children:m.jsx(jz,{ref:n,...s})}):null}),mie=vm(function(t,n){const{render:r,className:s,delay:o,closeDelay:l,id:c,payload:u,handle:f,style:h,...p}=t,y=Lf(!0),b=Am(f)??y;if(!b)throw new Error(Wt(89));const S=ls(c),E=b.useState("isTriggerActive",S),C=b.useState("isOpenedByTrigger",S),O=b.useState("floatingRootContext"),T=b.context.inlineRectCoordsRef,R=N.useRef(null),k=o??aie,M=l??QB,{registerTrigger:A,isMountedByThisTrigger:I}=Em(S,R,b,{payload:u,closeDelay:M}),L=km(O,{mouseOnly:!0,move:!1,handleClose:_m(),delay:()=>({open:k,close:M}),triggerElementRef:R,isActiveTrigger:E,isClosing:()=>b.select("transitionStatus")==="ending"}),D=aT(O,{delay:k}),P={open:C},z=b.useState("triggerProps",I),$=cJ(T,C);return Lt("a",t,{state:P,ref:[n,A,R],props:[L,D.reference,z,$,{id:S},p],stateAttributesMapping:fm})}),n6=N.createContext(void 0);function r6(){const e=N.useContext(n6);if(e===void 0)throw new Error(Wt(49));return e}const gie=N.forwardRef(function(t,n){const{render:r,className:s,anchor:o,positionMethod:l="absolute",side:c="bottom",align:u="center",sideOffset:f=0,alignOffset:h=0,collisionBoundary:p="clipping-ancestors",collisionPadding:y=5,arrowPadding:x=5,sticky:b=!1,disableAnchorTracking:S=!1,collisionAvoidance:E=Jx,style:C,...O}=t,T=Lf(),R=hie(),k=xm(),M=T.useState("open"),A=T.useState("mounted"),I=T.useState("floatingRootContext"),L=T.useState("instantType"),D=T.useState("transitionStatus"),P=T.useState("adaptiveOrigin"),z=T.context.inlineRectCoordsRef,$=cb({anchor:o,floatingRootContext:I,positionMethod:l,mounted:A,side:c,sideOffset:f,align:u,alignOffset:h,arrowPadding:x,collisionBoundary:p,collisionPadding:y,sticky:b,disableAnchorTracking:S,keepMounted:R,nodeId:k,collisionAvoidance:E,adaptiveOrigin:P,inline:uJ(z)}),j=$.update;Be(()=>{M&&A&&j()},[M,A,j]);const H={open:M,side:$.side,align:$.align,anchorHidden:$.anchorHidden,instant:L},B=ub(t,H,{styles:$.positionerStyles,transitionStatus:D,props:O,refs:[n,T.useStateSetter("positionerElement")],hidden:!A,inert:!M});return m.jsx(n6.Provider,{value:$,children:m.jsx(eb,{id:k,children:B})})}),yie=N.forwardRef(function(t,n){const{className:r,render:s,style:o,...l}=t,c=Lf(),{side:u,align:f}=r6(),h=c.useState("open"),p=c.useState("instantType"),y=c.useState("transitionStatus"),x=c.useState("popupProps"),b=c.useState("floatingRootContext"),S=c.useState("closeDelay");return Ya({open:h,ref:c.context.popupRef,onComplete(){var O,T;h&&((T=(O=c.context).onOpenChangeComplete)==null||T.call(O,!0))}}),ib(b,{closeDelay:S}),Lt("div",t,{state:{open:h,side:u,align:f,instant:p,transitionStatus:y},ref:[n,c.context.popupRef,c.useStateSetter("popupElement")],props:[Sm,x,Mm(y),l],stateAttributesMapping:hm})}),xie=N.forwardRef(function(t,n){const{render:r,className:s,style:o,...l}=t,c=Lf(),{arrowRef:u,side:f,align:h,arrowUncentered:p,arrowStyles:y}=r6(),b={open:c.useState("open"),side:f,align:h,uncentered:p};return Lt("div",t,{state:b,ref:[u,n],props:[{style:y,"aria-hidden":!0},l],stateAttributesMapping:Af})});class bie extends dJ{constructor(){super(uie(),"PreviewCard")}open(t){this.openByTrigger(t)}close(){this.closePopup()}get isOpen(){var t;return((t=this.attachedStore)==null?void 0:t.select("open"))??!1}}function vie(){return new bie}const s6=vie;function Dm({...e}){return m.jsx(fie,{"data-slot":"hover-card",...e})}function jm({...e}){return m.jsx(mie,{"data-slot":"hover-card-trigger",...e})}function yb({className:e,side:t="bottom",sideOffset:n=6,align:r="start",alignOffset:s=0,anchor:o,collisionAvoidance:l,collisionPadding:c=8,...u}){return m.jsx(pie,{"data-slot":"hover-card-portal",children:m.jsx(gie,{align:r,alignOffset:s,side:t,sideOffset:n,anchor:o,collisionAvoidance:l,collisionPadding:c,className:"isolate z-50",children:m.jsx(yie,{"data-slot":"hover-card-content",className:ye("z-50 origin-(--transform-origin) rounded-lg border border-foreground bg-popover text-sm text-popover-foreground outline-hidden duration-150 data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0",e),...u})})})}function o6({className:e,...t}){return m.jsx(xie,{"data-slot":"hover-card-arrow",className:ye("size-2.5 rotate-45 border-foreground bg-popover data-[side=bottom]:-top-[5px] data-[side=bottom]:border-t data-[side=bottom]:border-l data-[side=top]:-bottom-[5px] data-[side=top]:border-r data-[side=top]:border-b",e),...t})}const Sie={plain:void 0,keyword:"var(--color-syntax-keyword)",string:"var(--color-syntax-string)",number:"var(--color-syntax-number)",comment:"var(--color-syntax-quiet)",function:"var(--color-syntax-function)",type:"var(--color-syntax-type)",property:void 0,constant:"var(--color-syntax-number)",tag:"var(--color-syntax-type)",punctuation:void 0},wie={context:"",added:"bg-diff-added/12",removed:"bg-diff-removed/10"},Eie={context:"",added:"+",removed:"-"},Cie={context:"",added:"text-diff-added",removed:"text-diff-removed"},wI={context:"",added:"added",removed:"removed"},i6=`
|
|
351
|
+
`,Tie="line",l6="mark",a6="definition",c6="collapse",u6="collapseTrigger",d6="collapseContent",f6="col-[-2/-1] row-start-1",Nie=ye(f6,"sticky right-2 flex items-center gap-1 self-center justify-self-end rounded-md bg-code pl-1 font-sans","opacity-0 transition-opacity duration-[180ms] ease-out group-hover/line:opacity-100 focus-within:opacity-100","data-[open=false]:opacity-100 has-[[aria-pressed=true]]:opacity-100"),Oie=150,Rie={},Aie="group-has-data-[focused=true]/code:opacity-55 data-[focused=true]:opacity-100",kie="flex size-4 items-center justify-center rounded-sm bg-(--line) text-line-foreground opacity-0 group-hover/line:opacity-100 focus-visible:opacity-100",_ie="absolute top-0.5 left-1",Mie="mt-1",Iie="grid-cols-[3.25rem_1.25rem_1fr]",Lie="grid-cols-[1.25rem_1.25rem_3.25rem_1.25rem_1fr]",Die=ye("-ml-1 pl-2 transition-[background-color,box-shadow] duration-[180ms] ease-out","data-[marked=true]:bg-[color-mix(in_oklab,var(--line,var(--color-primary))_6%,transparent)]","data-[marked=true]:shadow-[inset_2px_0_0_color-mix(in_oklab,var(--line,var(--color-primary))_70%,transparent)]"),jie="rounded-sm bg-[color-mix(in_oklab,var(--line,var(--color-primary))_22%,transparent)] outline outline-1 outline-[var(--line,var(--color-primary))]",Pie="max-h-48 shrink-0 overflow-y-auto border-b px-3 py-2.5 text-foreground [contain:inline-size]",zie="rounded-sm underline decoration-muted-foreground decoration-dotted underline-offset-[0.25em] hover:bg-muted focus-visible:bg-muted",Bie="flex max-h-[30rem] w-max min-w-[min(20rem,calc(100vw-2rem))] max-w-[min(64rem,calc(100vw-2rem))] flex-col overflow-hidden font-sans whitespace-normal",h6="flex items-baseline justify-between gap-4 border-b px-3 py-2",Hie="flex flex-wrap items-baseline gap-x-4 gap-y-1 border-t px-3 py-1.5 text-xs [contain:inline-size]",Fie="[data-reference]",$ie="[data-code-block]",Uie="[data-reference-scope]",Vie=":",qie=new Map([["ArrowLeft",-1],["ArrowRight",1]]),Gie="data-[selected=true]:bg-primary/20",Kie="data-[commented=true]:shadow-[inset_3px_0_0_var(--line,var(--color-primary))]",VE="pr-2 text-right text-syntax-quiet tabular-nums select-none",Yie="cursor-pointer hover:text-foreground focus-visible:outline-2 focus-visible:outline-ring aria-pressed:font-bold aria-pressed:text-foreground",p6={},Xy=new Set,m6=new Set,Wie=[],g6=new Set,Xie={lines:[],definitions:p6,definitionCard:s6(),isWrapped:!1,selectedLineLabels:Xy,commentedLineKeys:Xy,markedLines:m6,openRootBlockIds:g6,tabStopReferenceKey:null},Qie=":",y6=({side:e,lineLabel:t})=>`${e}${Qie}${t}`,qE=e=>e.mark==="removed"?e.removedNumberLabel===""?null:{side:"old",lineLabel:e.removedNumberLabel}:e.numberLabel===""?null:{side:"new",lineLabel:e.numberLabel},Df=N.createContext(Xie),x6=(e,t)=>`${String(e)}${Vie}${String(t)}`,b6=(e,t)=>e.flatMap((n,r)=>n.references.filter(s=>Object.hasOwn(t,s.definitionId)).map(s=>x6(r+1,s.fromColumn))),Zie=(e,t)=>b6(e,t).length>0,Jie=e=>{const t=qie.get(e.key),n=e.currentTarget.closest(Uie)??e.currentTarget.closest($ie);if(t===void 0||n===null)return;const r=[...n.querySelectorAll(Fie)],s=r.indexOf(e.currentTarget)+t;s<0||s>=r.length||(e.preventDefault(),r[s].focus())},ele=e=>e.kind==="usages"?e.countLabel:`Defined in ${e.pathLabel}, ${e.rangeLabel}`,tle=({text:e,kind:t})=>[e,Sie[t]],nle=e=>e.flatMap((t,n)=>[...t.tokens.map(tle),...n===e.length-1?[]:[i6]]),rle=({rootBlockId:e,fromLine:t,toLine:n,hasTrigger:r})=>({name:c6,query:e,fromLineNumber:t,toLineNumber:n,data:{hasTrigger:r}}),sle=(e,t)=>[...t.map(rle),...e.flatMap((n,r)=>[...n.marks.map(s=>({name:l6,query:"",lineNumber:r+1,...s})),...n.references.map(({definitionId:s,...o})=>({name:a6,query:s,lineNumber:r+1,...o}))])],ole=(e,t)=>{const n=e.map(r=>r.tokens.map(s=>s.text).join("")).join(i6);return{value:n,code:n,annotations:sle(e,t),tokens:nle(e),lang:"",meta:"",themeName:"",style:Rie}},EI=e=>{const t=e.data;return typeof t=="object"&&t!==null&&"hasTrigger"in t&&t.hasTrigger===!0},ile=e=>{const{fromLineNumber:t,toLineNumber:n}=e,r=EI(e)?t+1:t;return[e,...EI(e)?[{...e,name:u6,toLineNumber:t}]:[],...r>n?[]:[{...e,name:d6,fromLineNumber:r}]]},lle=({annotation:e,children:t})=>{const{openRootBlockIds:n,onRootBlockOpenChange:r}=N.use(Df);return m.jsx(oie,{open:n.has(e.query),className:"contents",onOpenChange:s=>{r==null||r(e.query,s)},children:t})},ale={name:c6,transform:ile,Block:lle},cle={name:u6,AnnotatedLine:({annotation:e,...t})=>m.jsx(Wy,{merge:t,data:{...t.data,triggeredRootBlockId:e.query}})},ule={name:d6,Block:({children:e})=>m.jsx(lie,{children:e})},dle=e=>typeof(e==null?void 0:e.triggeredRootBlockId)=="string"?e.triggeredRootBlockId:null,fle=({numberLabel:e,isSelected:t})=>{const{selectLineLabel:n,onSelectLine:r}=N.use(Df);return r===void 0||n===void 0||e===""?m.jsx("span",{className:VE,children:e}):m.jsx("button",{type:"button","aria-label":`${n} ${e}`,"aria-pressed":t,className:ye(VE,Yie),onClick:s=>{r(e,s.shiftKey)},children:e})},hle={name:Tie,Line:e=>{const{lines:t,isWrapped:n,addCommentLabel:r,selectedLineLabels:s,commentedLineKeys:o,markedLines:l,renderLineExtra:c,renderLineThreads:u,renderWaypointLane:f,renderThreadMark:h,renderCollapseControls:p,openRootBlockIds:y,onAddComment:x}=N.use(Df),b=t.find((M,A)=>A===e.lineNumber-1),S=dle(e.data);if(b===void 0)return m.jsx(Wy,{merge:e});const E=s.has(b.numberLabel),C=qE(b),O=C===null?"":`${wI[b.mark]} ${C.lineLabel}`.trim(),T=f!==void 0,R=C===null||h===void 0?null:h(C),k=x===void 0||r===void 0||C===null?null:m.jsx("button",{type:"button","aria-label":`${r} ${O}`,title:r,className:ye(kie,T?Mie:_ie),onClick:M=>{x(C,M.shiftKey)},children:m.jsx(M2,{"aria-hidden":"true",className:"size-3",strokeWidth:3})});return m.jsxs(m.Fragment,{children:[m.jsxs("div",{"data-line":b.numberLabel,"data-mark":b.mark,"data-focused":b.isFocused,"data-selected":E,"data-commented":C!==null&&o.has(y6(C)),"data-comment-side":x===void 0||C==null?void 0:C.side,"data-comment-line":x===void 0||C==null?void 0:C.lineLabel,className:ye("group/line relative grid min-h-6 pr-4",T?Lie:Iie,wie[b.mark],Aie,Gie,Kie),children:[T?m.jsxs(m.Fragment,{children:[f(b),m.jsx("span",{className:"flex justify-center",children:R??k})]}):null,b.mark==="removed"&&b.removedNumberLabel!==""?m.jsx("span",{className:VE,children:b.removedNumberLabel}):m.jsx(fle,{numberLabel:b.numberLabel,isSelected:E}),m.jsxs("span",{"data-diff-mark":"",className:ye("text-center font-bold select-none",Cie[b.mark]),children:[m.jsx("span",{"aria-hidden":"true",children:Eie[b.mark]}),m.jsx("span",{className:"sr-only",children:wI[b.mark]})]}),m.jsx(Wy,{merge:e,"data-marked":l.has(b),className:ye(f6,Die,n?"wrap-anywhere whitespace-pre-wrap":"whitespace-pre")}),T?null:k,S===null||p===void 0?null:m.jsx("span",{"data-collapse-controls":"","data-open":y.has(S),className:Nie,children:p(S)})]}),c===void 0||b.numberLabel===""?null:c(b.numberLabel),u===void 0||C===null?null:u(C)]})}},ple={name:l6,Inline:({children:e})=>m.jsx("mark",{className:ye("text-inherit",jie),children:e})},mle=({declaration:e})=>{const{renderDefinitionDescription:t}=N.use(Df),n=`${e.pathLabel}, ${e.rangeLabel}`;return m.jsxs(m.Fragment,{children:[m.jsxs("div",{className:h6,children:[m.jsx("span",{className:"min-w-0 font-mono text-[0.8125rem] wrap-anywhere",children:e.pathLabel}),m.jsx("span",{className:"shrink-0 text-xs text-muted-foreground tabular-nums",children:e.rangeLabel})]}),e.description===null||t===void 0?null:m.jsx("div",{className:Pie,children:t(e.description)}),e.lines.length===0?null:m.jsx(Ou,{lines:e.lines,label:n,className:"flex-1 overflow-y-auto"}),e.note===null&&e.forgeLink===null?null:m.jsxs("div",{className:Hie,children:[e.note===null?null:m.jsx("span",{className:"text-muted-foreground",children:e.note}),e.forgeLink===null?null:m.jsx(Wa,{href:e.forgeLink.href,label:e.forgeLink.label})]})]})},gle=({usages:e})=>m.jsxs(m.Fragment,{children:[m.jsxs("div",{className:h6,children:[m.jsx("span",{className:"min-w-0 font-mono text-[0.8125rem] wrap-anywhere",children:e.nameLabel}),m.jsx("span",{className:"shrink-0 text-xs text-muted-foreground tabular-nums",children:e.countLabel})]}),e.files.length===0?null:m.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto",children:e.files.map(t=>m.jsxs("section",{"aria-label":t.pathLabel,className:"border-b last:border-b-0",children:[m.jsxs("div",{className:"flex flex-wrap items-baseline justify-between gap-x-4 gap-y-1 px-3 py-1.5 text-xs",children:[m.jsx("span",{className:"min-w-0 font-mono wrap-anywhere",children:t.pathLabel}),t.forgeLink===null?null:m.jsx(Wa,{href:t.forgeLink.href,label:t.forgeLink.label})]}),m.jsx(Ou,{lines:t.lines,label:`${e.nameLabel} in ${t.pathLabel}`})]},t.pathLabel))}),e.note===null?null:m.jsx("p",{className:"px-3 py-2 text-xs text-muted-foreground [contain:inline-size]",children:e.note})]}),yle={name:a6,Inline:({annotation:e,children:t})=>{const{definitions:n,definitionCard:r,tabStopReferenceKey:s}=N.use(Df);if(!Object.hasOwn(n,e.query))return m.jsx(m.Fragment,{children:t});const o=n[e.query],l=x6(e.lineNumber,e.fromColumn)===s;return m.jsx(jm,{handle:r,payload:o,delay:Oie,render:m.jsx("span",{}),tabIndex:l?0:-1,"data-reference":"","aria-description":ele(o),onKeyDown:Jie,className:zie,children:t})}},xle=({handle:e})=>m.jsx(Dm,{handle:e,children:({payload:t})=>t===void 0?null:m.jsx(yb,{className:Bie,children:t.kind==="usages"?m.jsx(gle,{usages:t}):m.jsx(mle,{declaration:t})})}),ble=[ale,ule,cle,hle,ple,yle];function Ou({lines:e,definitions:t=p6,label:n,path:r,className:s,isWrapped:o=!1,hasReferenceTabStop:l=!0,addCommentLabel:c,selectLineLabel:u,selectedLineLabels:f=Xy,commentedLineKeys:h=Xy,markedLines:p=m6,renderLineExtra:y,renderLineThreads:x,renderWaypointLane:b,renderThreadMark:S,renderDefinitionDescription:E,collapses:C=Wie,openRootBlockIds:O=g6,renderCollapseControls:T,onRootBlockOpenChange:R,onAddComment:k,onSelectLine:M}){const A=N.useMemo(()=>b6(e,t),[e,t]),I=l?A.at(0)??null:null,[L]=N.useState(()=>s6()),D=N.useMemo(()=>({lines:e,definitions:t,definitionCard:L,tabStopReferenceKey:I,isWrapped:o,addCommentLabel:c,selectLineLabel:u,selectedLineLabels:f,commentedLineKeys:h,markedLines:p,renderLineExtra:y,renderLineThreads:x,renderWaypointLane:b,renderThreadMark:S,renderDefinitionDescription:E,openRootBlockIds:O,renderCollapseControls:T,onRootBlockOpenChange:R,onAddComment:k,onSelectLine:M}),[e,t,L,I,o,c,u,f,h,p,y,x,b,S,E,O,T,R,k,M]),P=N.useMemo(()=>ole(e,C),[e,C]);return m.jsx("div",{role:"group","aria-label":n,"data-path":r,"data-code-block":"",className:ye("group/code overflow-x-auto bg-code py-2 font-mono text-sm leading-6",s),children:m.jsxs(Df,{value:D,children:[m.jsx(zoe,{code:P,handlers:ble,className:ye("m-0 grid",o?"":"min-w-max")}),A.length===0?null:m.jsx(xle,{handle:L})]})})}const v6=({title:e,titleKind:t="plain",kindLabel:n,target:r,codeViews:s=null,children:o,onClose:l})=>m.jsxs("section",{"aria-label":e,className:"flex min-h-full flex-col",children:[m.jsxs("div",{className:"sticky top-0 z-10 flex items-start gap-3 border-b bg-background px-4 py-3",children:[m.jsxs("div",{className:"min-w-0 flex-1",children:[m.jsx("p",{className:"text-xs text-muted-foreground",children:n}),m.jsx("h3",{className:ye("text-base leading-6 font-bold wrap-anywhere",t==="code"&&"font-mono text-[0.8125rem] leading-5"),children:e})]}),m.jsx(or,{icon:"close",label:"Close the code panel",onClick:l})]}),m.jsx("div",{className:"flex flex-col gap-3 px-4 py-4 text-sm empty:hidden",children:o}),s,r===null?null:m.jsxs("div",{className:"border-t",children:[m.jsxs("div",{className:"flex flex-wrap items-baseline justify-between gap-x-4 gap-y-1 px-4 py-2",children:[m.jsx("span",{className:"min-w-0 font-mono text-[0.8125rem] wrap-anywhere",children:r.pathLabel}),m.jsx("span",{className:"text-xs text-muted-foreground tabular-nums",children:r.rangeLabel})]}),m.jsx(Ou,{lines:r.lines,label:`${r.pathLabel}, ${r.rangeLabel}`,isWrapped:!0,className:"border-y"}),r.forgeLink===null?null:m.jsx(Wa,{href:r.forgeLink.href,label:r.forgeLink.label,className:"mx-4 my-2 text-xs"})]})]}),S6=150,vle="rounded-sm underline decoration-primary-text/60 decoration-1 underline-offset-[0.3em] transition-colors duration-[180ms] ease-out hover:text-primary-text hover:decoration-primary-text",Sle="font-mono text-[0.875em]",wle=e=>{var t;return e.anchorId===null?(t=e.forgeLink)==null?void 0:t.href:`#${e.anchorId}`},w6=({target:e})=>m.jsxs(yb,{className:"flex max-h-[26.25rem] w-[min(42.5rem,calc(100vw-2rem))] flex-col overflow-hidden",children:[m.jsxs("div",{className:"flex items-baseline justify-between gap-4 border-b px-3 py-2",children:[m.jsx("span",{className:"min-w-0 font-mono text-[0.8125rem] wrap-anywhere",children:e.pathLabel}),m.jsx("span",{className:"shrink-0 text-xs text-muted-foreground tabular-nums",children:e.rangeLabel})]}),m.jsx(Ou,{lines:e.lines,label:`${e.pathLabel}, ${e.rangeLabel}`,className:"min-h-0 flex-1 overflow-y-auto"}),e.forgeLink===null?null:m.jsx("div",{className:"border-t px-3 py-1.5",children:m.jsx(Wa,{href:e.forgeLink.href,label:e.forgeLink.label,className:"text-xs"})})]}),Ele=({target:e,isCode:t,children:n,onOpen:r})=>{const{anchorId:s}=e;return m.jsxs(Dm,{children:[m.jsx(jm,{delay:S6,href:wle(e),target:s===null?"_blank":void 0,rel:s===null?"noreferrer":void 0,className:ye(vle,t?Sle:""),onClick:o=>{s!==null&&(o.preventDefault(),r(s))},children:n}),m.jsx(w6,{target:e})]})},E6=N.createContext(null),Cle="Expand all",Tle="Collapse all",Nle="q",CI=new Set,C6=e=>e.kind==="accordion"?e.sections.map(t=>t.label):e.kind==="quote"?e.blocks.flatMap(C6):[],Ole=e=>e.flatMap(C6),Rle=(e,t)=>new Set(e.has(t)?[...e].filter(n=>n!==t):[...e,t]),Ale=(e,t)=>{const[n,r]=N.useState(CI),s=Ole(t),o=s.length>0&&s.every(c=>n.has(c)),l=s.length===0?[]:[[Un({key:Nle,actionId:"expand-context-action",label:o?Tle:Cle,onRun:()=>{r(o?CI:new Set(s))}})]];return AT(e,l),{openLabels:n,onToggle:c=>{r(u=>Rle(u,c))}}},jf=e=>e.map((t,n)=>({key:String(n),item:t})),TI=4,kle=e=>e.inlines.flatMap(t=>t.kind==="code-link"?[t.text]:[]),_le=e=>e.inlines.flatMap(t=>t.kind==="code"?[t.text]:[]),Mle=e=>[...kle(e),..._le(e)].slice(0,1),Ile=e=>{const t=e.flatMap(r=>r.kind==="list"?r.items:[]);if(t.length===0)return null;const n=t.flatMap(Mle);return{names:n.slice(0,TI),moreCount:Math.max(0,n.length-TI)}},T6="flex flex-wrap items-end gap-x-6 border-b border-border",N6="-mb-px cursor-pointer border-b-2 border-transparent pb-2 text-sm font-bold text-muted-foreground transition-colors duration-[180ms] ease-out hover:text-foreground focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring aria-selected:border-[var(--line,var(--color-primary))] aria-selected:text-foreground",Z1=0,O6=(e,t,n)=>{const r=n-1;return e==="ArrowRight"?t===r?Z1:t+1:e==="ArrowLeft"?t===Z1?r:t-1:e==="Home"?Z1:e==="End"?r:null},Lle="pt-4 text-[1.1875rem] leading-7 font-semibold tracking-[-0.01em] text-foreground first:pt-0",NI="flex flex-col gap-2 pl-5",OI="rounded-sm bg-muted box-decoration-clone px-1.5 py-0.5 font-mono text-[0.875em]",Dle="rounded-sm underline decoration-1 underline-offset-[0.3em] hover:text-primary-text",jle="flex flex-col gap-4 border-l-2 border-border pl-4 text-muted-foreground",Ple="overflow-x-auto rounded-md bg-code px-4 py-3 font-mono text-sm leading-6",zle=({inline:e,codeLinks:t,onOpenCodeLink:n})=>e.kind==="text"?e.text:e.kind==="strong"?m.jsx("strong",{className:"font-bold",children:e.text}):e.kind==="emphasis"?m.jsx("em",{children:e.text}):e.kind==="code"?m.jsx("code",{className:OI,children:e.text}):e.kind==="link"?m.jsx("a",{href:e.href,target:"_blank",rel:"noreferrer",className:Dle,children:e.text}):e.linkId===null||!Object.hasOwn(t,e.linkId)?e.isCode?m.jsx("code",{className:OI,children:e.text}):e.text:m.jsx(Ele,{target:t[e.linkId],isCode:e.isCode,onOpen:n,children:e.text}),df=({inlines:e,codeLinks:t,onOpenCodeLink:n})=>jf(e).map(({key:r,item:s})=>m.jsx(zle,{inline:s,codeLinks:t,onOpenCodeLink:n},r)),Pm=({blocks:e,codeLinks:t,onOpenCodeLink:n})=>jf(e).map(({key:r,item:s})=>m.jsx(Kle,{block:s,codeLinks:t,onOpenCodeLink:n},r)),Ble=({item:e,codeLinks:t,onOpenCodeLink:n})=>m.jsxs("li",{className:e.blocks.length===0?"":"space-y-2",children:[e.inlines.length===0?null:m.jsx("span",{children:m.jsx(df,{inlines:e.inlines,codeLinks:t,onOpenCodeLink:n})}),m.jsx(Pm,{blocks:e.blocks,codeLinks:t,onOpenCodeLink:n})]}),RI=(e,t)=>`${e}-tab-${String(t)}`,AI=(e,t)=>`${e}-panel-${String(t)}`,Hle=({tabs:e,codeLinks:t,onOpenCodeLink:n})=>{const r=N.useId(),[s,o]=N.useState(0),l=N.useRef([]),c=e.at(s)??e[0],u=f=>{var p;const h=O6(f.key,s,e.length);h!==null&&(f.preventDefault(),o(h),(p=l.current[h])==null||p.focus())};return m.jsxs("div",{className:"flex flex-col gap-4",children:[m.jsx("div",{role:"tablist",className:T6,children:jf(e).map(({key:f,item:h},p)=>m.jsx("button",{ref:y=>{l.current[p]=y},type:"button",role:"tab",id:RI(r,p),"aria-selected":p===s,"aria-controls":AI(r,p),tabIndex:p===s?0:-1,className:N6,onClick:()=>{o(p)},onKeyDown:u,children:h.label},f))}),m.jsx("div",{role:"tabpanel",id:AI(r,s),"aria-labelledby":RI(r,s),className:"flex flex-col gap-4",children:m.jsx(Pm,{blocks:c.blocks,codeLinks:t,onOpenCodeLink:n})})]})},Fle="See change details",$le="Hide change details",Ule="cursor-pointer rounded-sm text-sm text-foreground underline decoration-1 underline-offset-[0.3em] hover:text-primary-text focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring",Vle=({summary:e})=>m.jsxs(m.Fragment,{children:[m.jsx("span",{className:"font-mono text-[0.875em]",children:e.names.join(", ")}),e.moreCount>0?m.jsx("span",{children:`+ ${String(e.moreCount)} more`}):null]}),qle=({section:e,codeLinks:t,onOpenCodeLink:n})=>{const r=N.useId(),s=N.use(E6),[o,l]=N.useState(!1),c=s===null?o:s.openLabels.has(e.label),u=`${r}-name`,f=`${r}-panel`,h=Ile(e.blocks),p=m.jsx("button",{type:"button","aria-expanded":c,"aria-controls":f,className:Ule,onClick:()=>{s===null?l(y=>!y):s.onToggle(e.label)},children:c?$le:Fle});return m.jsxs("section",{"aria-labelledby":u,className:"flex flex-col gap-2 py-3",children:[m.jsx("h4",{id:u,className:"text-sm font-bold text-foreground",children:e.label}),m.jsxs("p",{className:"flex flex-wrap items-baseline gap-x-2 text-sm text-muted-foreground",children:[!c&&h!==null?m.jsx(Vle,{summary:h}):null,p]}),c?m.jsx("div",{id:f,className:"flex flex-col gap-4",children:m.jsx(Pm,{blocks:e.blocks,codeLinks:t,onOpenCodeLink:n})}):null]})},Gle=({sections:e,codeLinks:t,onOpenCodeLink:n})=>m.jsx("div",{className:"flex flex-col divide-y divide-border border-y border-border",children:jf(e).map(({key:r,item:s})=>m.jsx(qle,{section:s,codeLinks:t,onOpenCodeLink:n},r))});function Kle({block:e,codeLinks:t,onOpenCodeLink:n}){if(e.kind==="heading")return m.jsx("h3",{className:Lle,children:m.jsx(df,{inlines:e.inlines,codeLinks:t,onOpenCodeLink:n})});if(e.kind==="paragraph")return m.jsx("p",{children:m.jsx(df,{inlines:e.inlines,codeLinks:t,onOpenCodeLink:n})});if(e.kind==="quote")return m.jsx("blockquote",{className:jle,children:m.jsx(Pm,{blocks:e.blocks,codeLinks:t,onOpenCodeLink:n})});if(e.kind==="accordion")return m.jsx(Gle,{sections:e.sections,codeLinks:t,onOpenCodeLink:n});if(e.kind==="tabs")return m.jsx(Hle,{tabs:e.tabs,codeLinks:t,onOpenCodeLink:n});if(e.kind==="code-block")return m.jsx("pre",{"data-language":e.language??void 0,className:Ple,children:m.jsx("code",{children:e.text})});const r=jf(e.items).map(({key:s,item:o})=>m.jsx(Ble,{item:o,codeLinks:t,onOpenCodeLink:n},s));return e.isOrdered?m.jsx("ol",{className:ye(NI,"list-decimal"),children:r}):m.jsx("ul",{className:ye(NI,"list-disc"),children:r})}const uo=({blocks:e,codeLinks:t,onOpenCodeLink:n,className:r})=>m.jsx("div",{className:ye("flex max-w-[68ch] flex-col gap-4 text-base leading-[1.7] text-pretty",r),children:m.jsx(Pm,{blocks:e,codeLinks:t,onOpenCodeLink:n})}),Yle=({blocks:e,codeLinks:t,onOpenCodeLink:n})=>m.jsx(uo,{blocks:e,codeLinks:t,onOpenCodeLink:n,className:"gap-2 text-sm leading-6"}),R6=N.createContext(null),Wle="block h-[0.7em] rounded-[0.225rem] bg-foreground/10 motion-safe:animate-pulse",Xle="w-3/5",A6=({label:e,lineCount:t=1,className:n,caption:r=null})=>{const s=Array.from({length:t},(o,l)=>l);return m.jsxs("span",{"data-unwritten":"true",className:ye("flex min-w-0 flex-col justify-center gap-[0.6em] py-[0.3em]",n),children:[m.jsx("span",{className:"sr-only",children:e}),s.map(o=>m.jsx("span",{"aria-hidden":"true",className:ye(Wle,t>1&&o===t-1?Xle:"")},o)),r]})},ul=({isPending:e,lineCount:t,className:n,caption:r,children:s})=>{const o=N.use(R6);return!e||o===null?m.jsx(m.Fragment,{children:s}):m.jsx(A6,{label:o,lineCount:t,className:n,caption:r})},Qle=3,Zle=({className:e})=>m.jsx(DX,{"aria-hidden":"true",className:ye("size-3.5 shrink-0 text-muted-foreground",e)}),Pf=({label:e,className:t})=>m.jsxs("span",{className:ye("inline-flex items-center gap-1.5 text-sm text-muted-foreground",t),children:[m.jsx(Zle,{}),e]}),Lp=({label:e,keyLabel:t,icon:n=null,variant:r="outline",actionId:s,onClick:o})=>m.jsxs(st,{type:"button",variant:r,size:"xs","data-user-action-id":s,onClick:o,children:[n,e,t===null?null:m.jsx("kbd",{"aria-hidden":"true",className:"inline-grid h-4 min-w-4 place-items-center rounded-sm border border-b-2 border-current/35 px-1 font-mono text-[0.625rem] leading-none font-bold uppercase opacity-80",children:t})]}),k6=({label:e})=>m.jsx(A6,{label:e,lineCount:Qle,className:"text-sm"}),_6=({hint:e,label:t,isBeingWritten:n,buttonLabel:r,onWriteUp:s})=>m.jsxs("div",{className:"flex flex-col gap-2",children:[e===null?null:m.jsx("p",{className:"text-foreground",children:e}),n?m.jsx(k6,{label:t}):m.jsxs(m.Fragment,{children:[m.jsx(Pf,{label:t}),s===null?null:m.jsx("div",{children:m.jsx(Lp,{label:r,keyLabel:If,actionId:"explain-part-action",onClick:s})})]})]}),Jle=({x:e,y:t})=>`${String(e)} ${String(t)}`,GE=e=>e.map((t,n)=>`${n===0?"M":"L"} ${Jle(t)}`).join(" "),eae={nodeIds:new Set,edgeIds:new Set},KE=(e,t)=>{if(t===null)return eae;const n=e.filter(r=>r.from===t||r.to===t);return{nodeIds:new Set([t,...n.flatMap(r=>[r.from,r.to])]),edgeIds:new Set(n.map(r=>r.id))}},M6=(e,t,n)=>{if(n.length===0)return t;const r=[...new Set(e.filter(s=>n.includes(s.from)).map(s=>s.to))].filter(s=>!t.has(s));return M6(e,new Set([...t,...r]),r)},Qy=(e,t)=>M6(e,new Set(t),t),tae=e=>e.map(({id:t,from:n,to:r})=>({id:t,from:r,to:n})),nae=(e,t)=>new Set([...Qy(tae(e),[t]),...Qy(e,[t])]),rae=(e,t,n)=>{const r=e.filter(o=>!t.includes(o.from)&&!t.includes(o.to)),s=Qy(r,n.filter(o=>!t.includes(o)));return new Set([...Qy(e,t)].filter(o=>!s.has(o)))},sae=2,oae="M1 1.5 8 5 1 8.5z",iae="group absolute flex -translate-x-1/2 flex-col items-center rounded-sm text-center transition-opacity duration-[180ms] ease-out data-[standing=far]:opacity-25",lae="mt-0.5 rounded-sm bg-background px-1 font-mono text-[0.6875rem] leading-4 whitespace-nowrap text-muted-foreground transition-colors duration-[180ms] ease-out group-hover:text-foreground group-data-[quiet=false]:text-foreground group-data-[standing=focal]:font-bold group-data-[standing=focal]:text-foreground group-data-[standing=near]:text-foreground",aae="fill-none stroke-current opacity-55 transition-[color,opacity] duration-[180ms] ease-out [stroke-width:1.25] data-[standing=far]:opacity-15 data-[standing=near]:text-foreground data-[standing=near]:opacity-100",cae="Not assessed yet.",uae="The agent is assessing this file.",I6="Assess this file",dae="block w-full rounded-sm px-2 py-1 text-left font-mono text-[0.8125rem] leading-5 wrap-anywhere hover:bg-muted",kI=(e,t,n)=>n?e?"focal":t?"near":"far":"plain",_I=({list:e,onSelect:t})=>m.jsxs("div",{className:"flex flex-col gap-1",children:[m.jsx("h4",{className:"text-xs font-bold text-muted-foreground tabular-nums",children:e.heading}),e.files.length===0?m.jsx("p",{className:"text-muted-foreground",children:e.emptyLabel}):m.jsx("ul",{className:"-mx-2 flex flex-col",children:e.files.map(n=>m.jsx("li",{children:m.jsx("button",{type:"button",className:dae,onClick:()=>{t(n.id)},children:n.label})},n.id))})]}),YE=e=>e.isUnassessed&&e.assessment!==null,fae=(e,t)=>e===null||t===null||!YE(e)||e.isBeingWritten?[]:[Un({key:If,actionId:"explain-blast-file-action",label:I6,onRun:()=>{t(e.path)}})],hae=(e,t)=>e.length===0?[t]:[...e.slice(0,-1),[...e[e.length-1],...t]],pae=({title:e,board:t,codeLinks:n,authoring:r,navigation:s=null,onWriteUpFile:o=null,onOpenCodeLink:l,onOpenFile:c})=>{const u=N.useId(),[f,h]=N.useState(null),[p,y]=N.useState(null),[x,b]=N.useState(!1),[S,E]=N.useState(null),C=t.nodes.find(D=>D.id===f)??null,O=p??f,T=t.edges.map(D=>({id:D.id,from:D.importerId,to:D.importedId})),R=KE(T,O),k=O!==null,M=r!==null&&(C==null?void 0:C.assessment)!=null,A=M&&S===f,I=()=>{E(null)},L=()=>{h(null),I()};return m.jsxs(HB,{label:e,width:t.width,height:t.height,isFullScreen:x,isCentred:!0,navigation:s===null?null:{...s,groups:hae(s.groups,fae(C,o))},onFullScreenChange:D=>{b(D),D||L()},onPanelClose:L,panel:C===null?null:m.jsxs(v6,{title:C.path,titleKind:"code",kindLabel:C.markLabel,target:null,onClose:L,children:[A?r.renderImpactEditor(C,I):null,A||!YE(C)?null:m.jsx(_6,{hint:C.impactNote,label:C.isBeingWritten?uae:cae,isBeingWritten:C.isBeingWritten,buttonLabel:I6,onWriteUp:o===null?null:()=>{o(C.path)}}),A||YE(C)||C.impactNote===null?null:m.jsx(ul,{isPending:C.isUnassessed,lineCount:2,children:m.jsx("p",{className:"text-muted-foreground",children:C.impactNote})}),A||C.impactReason===null?null:m.jsx(uo,{blocks:C.impactReason,codeLinks:n,onOpenCodeLink:l}),M&&!A?m.jsx(st,{variant:"link",size:"sm",className:"self-start px-0",onClick:()=>{E(C.id)},children:r.editLabel}):null,m.jsx(_I,{list:C.importers,onSelect:h}),m.jsx(_I,{list:C.imports,onSelect:h}),C.fileLink===null?null:m.jsx("button",{type:"button",className:"self-start rounded-md border border-input bg-card px-2.5 py-1 text-[0.8rem] hover:bg-muted",onClick:()=>{const{anchorId:D}=C.fileLink??{anchorId:null};b(!1),L(),D!==null&&c(D)},children:C.fileLink.label})]}),children:[m.jsxs("svg",{"aria-hidden":"true",width:t.width,height:t.height,viewBox:`0 0 ${String(t.width)} ${String(t.height)}`,className:"pointer-events-none absolute inset-0 text-muted-foreground",children:[m.jsx("defs",{children:m.jsx("marker",{id:u,viewBox:"0 0 10 10",refX:"8",refY:"5",markerWidth:"7",markerHeight:"7",orient:"auto-start-reverse",children:m.jsx("path",{d:oae,fill:"context-stroke"})})}),t.edges.map(D=>m.jsx("path",{d:GE(D.points),"data-standing":kI(!1,R.edgeIds.has(D.id),k),markerEnd:`url(#${u})`,className:aae},D.id))]}),t.nodes.map(D=>m.jsxs("button",{type:"button",title:D.path,"aria-pressed":D.id===f,"data-user-action-id":"blast-diagram-card-action","data-mark":D.mark,"data-quiet":WM(D.mark),"data-standing":kI(D.id===O,R.nodeIds.has(D.id),k),className:iae,style:{left:D.x,top:D.y-Uz(D.radius)/sae},onPointerEnter:()=>{y(D.id)},onPointerLeave:()=>{y(null)},onFocus:()=>{y(D.id)},onBlur:()=>{y(null)},onClick:()=>{h(D.id),b(!0)},children:[m.jsx(ST,{mark:D.mark,radius:D.radius}),m.jsx("span",{className:lae,children:D.label}),WM(D.mark)?null:m.jsx("span",{className:"rounded-sm bg-background px-1 text-[0.6875rem] leading-4 text-muted-foreground",children:D.markLabel})]},D.id))]})},mae={plain:"",code:"font-mono text-[0.94em]"},gae="not-last:after:ml-[0.5em] not-last:after:font-sans not-last:after:content-['•']",ff=({segments:e,className:t})=>m.jsx("span",{className:ye("flex flex-wrap gap-x-[0.5em]",t),children:e.map(n=>m.jsx("span",{className:ye("min-w-0 wrap-anywhere",gae,mae[n.kind]),children:n.text},`${n.kind}:${n.text}`))}),yae=4,xae=2,bae={"export-bound":"e","import-bound":"q"},vae=({anchorId:e,heading:t,defaultViewId:n,assessmentForm:r,views:s,codeLinks:o,writeUpNotice:l=null,onWriteUpFile:c=null,renderImpactEditor:u,onOpenCodeLink:f,onOpenFile:h})=>{const[p,y]=N.useState(null),x=s.find(b=>b.id===(p??n))??s.at(0);return x===void 0?null:m.jsxs("section",{id:e,"aria-labelledby":`${e}-heading`,"data-view-section-id":"blast-diagram-section",className:"scroll-mt-(--section-scroll-margin) border-t pt-6 pb-8",children:[m.jsxs("div",{className:"flex items-center gap-3 pb-4",children:[m.jsx("h2",{id:`${e}-heading`,className:"text-2xl leading-9 font-semibold tracking-[-0.02em] text-foreground",children:t}),l===null?null:m.jsx(Pf,{label:l})]}),m.jsxs("div",{className:"flex flex-col gap-y-1 pb-2 text-sm",children:[m.jsx(ff,{segments:x.summary.map(b=>({text:b,kind:"plain"})),className:"tabular-nums"}),m.jsxs("ul",{className:"flex flex-wrap items-center gap-x-5 gap-y-1 text-muted-foreground",children:[x.legend.map(b=>m.jsxs("li",{className:"flex items-center gap-1.5",children:[m.jsx(ST,{mark:b.mark,radius:yae}),b.label]},b.mark)),m.jsxs("li",{className:"flex items-center gap-1.5",children:[m.jsxs("svg",{"aria-hidden":"true",width:"22",height:"10",viewBox:"0 0 22 10",className:"shrink-0",children:[m.jsx("path",{d:"M1 5h14",className:"fill-none stroke-current [stroke-width:1.25]"}),m.jsx("path",{d:"M14 1.5 21 5 14 8.5z",className:"fill-current"})]}),x.edgeLegendLabel]})]})]}),m.jsx(pae,{title:t,board:x.board,codeLinks:o,onWriteUpFile:c,navigation:{anchorId:e,groups:s.length<xae?[]:[s.map(b=>Un({key:bae[b.id],actionId:"blast-view-action",label:b.label,description:b.description,isPressed:b.id===x.id,onRun:()=>{y(b.id)}}))]},authoring:u===null?null:{editLabel:r.editLabel,renderImpactEditor:(b,S)=>b.assessment===null?null:u({path:b.path,assessment:b.assessment,form:r,onClose:S})},onOpenCodeLink:f,onOpenFile:h})]})},Sae={pickedLabels:[],text:""},wae="No answer",Eae="mt-0.5 size-4 shrink-0 accent-(--primary)",Cae="min-h-12 w-full resize-none rounded-lg border border-input bg-card px-2.5 py-1.5 text-sm outline-none placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/40",Tae="max-h-40 overflow-auto rounded-sm bg-muted px-1.5 py-1 font-mono text-[0.6875rem] leading-4 whitespace-pre-wrap wrap-anywhere",Nae={open:"font-bold text-signal-text",answered:"text-muted-foreground",withdrawn:"text-muted-foreground italic"},Oae=(e,t,n,r)=>{if(!n.allowsMultiple)return r?[t]:[];const s=e.filter(o=>o!==t);return r?[...s,t]:s},Rae=(e,t)=>({questionId:e.id,pickedLabels:t.pickedLabels,text:t.text.trim()===""?null:t.text}),L6=({detail:e})=>e===null?null:m.jsx("pre",{className:Tae,children:e}),Aae=({question:e,draft:t,onDraftChange:n})=>{const r=N.useId(),s=N.useId();return m.jsxs("fieldset",{className:"flex flex-col gap-2",children:[m.jsx("legend",{className:"pb-1 text-sm font-bold",children:e.prompt}),m.jsx(L6,{detail:e.detail}),e.options.map(o=>m.jsxs("label",{className:"flex cursor-pointer items-start gap-2 text-sm",children:[m.jsx("input",{type:e.allowsMultiple?"checkbox":"radio",name:r,checked:t.pickedLabels.includes(o.label),className:Eae,onChange:l=>{n({...t,pickedLabels:Oae(t.pickedLabels,o.label,e,l.target.checked)})}}),m.jsxs("span",{className:"min-w-0",children:[m.jsx("span",{className:"block",children:o.label}),o.description===""?null:m.jsx("span",{className:"block text-xs text-muted-foreground",children:o.description})]})]},o.label)),m.jsx("label",{htmlFor:s,className:"text-xs text-muted-foreground",children:e.textLabel}),m.jsx("textarea",{id:s,value:t.text,className:Cae,onChange:o=>{n({...t,text:o.target.value})}})]})},kae=({question:e})=>m.jsxs("div",{className:"flex flex-col gap-1",children:[m.jsx("p",{className:"text-sm font-bold",children:e.prompt}),m.jsx(L6,{detail:e.detail}),m.jsx("p",{className:"text-sm",children:e.answerLabel??wae})]}),_ae=({batch:e,isAnswering:t,problem:n,onAnswer:r})=>{const[s,o]=N.useState({}),l=u=>s[u.id]??Sae,c=e.status==="open";return m.jsxs("section",{"aria-label":e.heading,"data-status":e.status,className:ye("flex flex-col gap-3 rounded-lg border px-3 py-2.5 text-sm",c?"border-signal":""),children:[m.jsxs("div",{className:"flex flex-col",children:[m.jsxs("p",{className:"flex items-baseline gap-2",children:[m.jsx("span",{className:"font-bold",children:e.heading}),m.jsx("span",{className:"text-xs text-muted-foreground tabular-nums",children:e.timeLabel})]}),m.jsx("p",{className:ye("text-xs",Nae[e.status]),children:e.statusLabel})]}),c?m.jsxs("form",{className:"flex flex-col gap-4",onSubmit:u=>{u.preventDefault(),r(e.questions.map(f=>Rae(f,l(f))))},children:[e.questions.map(u=>m.jsx(Aae,{question:u,draft:l(u),onDraftChange:f=>{o(h=>({...h,[u.id]:f}))}},u.id)),n===null?null:m.jsx("p",{role:"alert",className:"text-sm text-destructive",children:n}),m.jsx(st,{type:"submit",size:"sm",disabled:t,className:"self-end",children:e.submitLabel})]}):e.questions.map(u=>m.jsx(kae,{question:u},u.id))]})},Mae=({label:e,options:t,value:n,className:r,errorMessage:s=null,isLabelHidden:o=!1,onChange:l})=>{const c=N.useId(),u=N.useId();return m.jsxs("div",{className:ye("grid gap-1.5",r),children:[m.jsx("label",{htmlFor:c,className:o?"sr-only":"text-sm font-bold",children:e}),m.jsxs("div",{className:"relative",children:[m.jsx("select",{id:c,value:n,"aria-invalid":s!==null,"aria-describedby":s===null?void 0:u,className:"h-8 w-full cursor-pointer appearance-none rounded-lg border border-input bg-card pr-8 pl-2.5 text-sm transition-colors duration-[180ms] ease-out outline-none hover:bg-muted focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/40 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20",onChange:f=>{l(f.target.value)},children:t.map(f=>m.jsx("option",{value:f.value,children:f.label},f.value))}),m.jsx(su,{"aria-hidden":"true",className:"pointer-events-none absolute top-1/2 right-2.5 size-4 -translate-y-1/2 text-muted-foreground"})]}),s===null?null:m.jsx("p",{id:u,role:"alert",className:"text-sm text-destructive",children:s})]})},Iae="Remove the reference",Lae="min-h-16 w-full resize-none rounded-lg border border-input bg-card px-2.5 py-1.5 text-sm outline-none placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/40",D6="self-start rounded-sm bg-muted px-1.5 py-0.5 font-mono text-[0.6875rem] leading-4 wrap-anywhere",Dae={online:"fill-(--line) stroke-(--line) [stroke-width:2]",offline:"fill-background stroke-muted-foreground [stroke-width:2]"},jae=({message:e,codeLinks:t,onOpenCodeLink:n})=>m.jsxs(m.Fragment,{children:[m.jsxs("p",{className:"flex items-baseline gap-2",children:[m.jsx("span",{className:"font-bold",children:e.authorLabel}),m.jsx("span",{className:"text-xs text-muted-foreground tabular-nums",children:e.timeLabel})]}),e.reference===null?null:m.jsx("p",{className:D6,children:e.reference}),m.jsx(uo,{blocks:e.body,codeLinks:t,onOpenCodeLink:n})]}),Pae=({conversation:e,modelChoice:t,codeLinks:n,reference:r,isSending:s,sendProblem:o,answering:l,onSend:c,onAnswer:u,onChooseModel:f,onClearReference:h,onOpenCodeLink:p,onClose:y})=>{var T;const[x,b]=N.useState(""),S=N.useRef(null),E=((T=e.entries.at(-1))==null?void 0:T.id)??null,C=t!==null;N.useEffect(()=>{const R=S.current;R==null||R.scrollTo({top:R.scrollHeight})},[E,C]);const O=()=>{c(x),b("")};return m.jsxs("aside",{"aria-label":e.heading,className:"fixed top-14 right-0 bottom-0 z-30 flex w-(--chat-width) flex-col border-l bg-background duration-200 ease-out animate-in slide-in-from-right-8",children:[m.jsxs("div",{className:"flex items-start gap-3 border-b px-4 py-3",children:[m.jsxs("div",{className:"min-w-0 flex-1",children:[m.jsx("h2",{className:"text-base leading-6 font-bold",children:e.heading}),m.jsxs("p",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:[m.jsx("svg",{"aria-hidden":"true",viewBox:"0 0 12 12","data-state":e.agentState,className:"size-3",children:m.jsx("circle",{cx:"6",cy:"6",r:"4",className:ye("transition-[fill,stroke] duration-[180ms] ease-out",Dae[e.agentState])})}),m.jsx("span",{role:"status",children:e.agentStateLabel})]})]}),m.jsx(or,{icon:"close",label:e.closeLabel,onClick:y})]}),t===null?null:m.jsxs("div",{className:"flex flex-col gap-1 border-b px-4 py-2",children:[m.jsx(Mae,{label:t.label,options:t.options,value:t.selectedModel,onChange:f}),m.jsx("p",{className:"text-xs text-muted-foreground",children:t.hint})]}),m.jsxs("ol",{ref:S,"aria-live":"polite",className:"flex min-h-0 flex-1 flex-col gap-4 overflow-y-auto px-4 py-4",children:[e.emptyMessage===null?null:m.jsx("li",{className:"text-sm text-muted-foreground",children:e.emptyMessage}),e.entries.map(R=>{var k;return m.jsx("li",{"data-author":R.kind==="message"?R.author:void 0,className:"flex flex-col gap-1 text-sm",children:R.kind==="message"?m.jsx(jae,{message:R,codeLinks:n,onOpenCodeLink:p}):m.jsx(_ae,{batch:R,isAnswering:l.pendingBatchId===R.id,problem:((k=l.rejection)==null?void 0:k.batchId)===R.id?l.rejection.message:null,onAnswer:M=>{u(R.id,M)}})},R.id)})]}),m.jsxs("form",{className:"flex flex-col gap-2 border-t px-4 py-3",onSubmit:R=>{R.preventDefault(),O()},children:[r===null?null:m.jsxs("p",{className:"flex items-start gap-1",children:[m.jsx("span",{className:ye(D6,"flex-1"),children:r}),m.jsx(or,{icon:"close",label:Iae,className:"size-5",onClick:h})]}),m.jsx("textarea",{"aria-label":e.placeholder,placeholder:e.placeholder,value:x,className:Lae,onChange:R=>{b(R.target.value)},onKeyDown:R=>{R.key!=="Enter"||R.shiftKey||x.trim()===""||(R.preventDefault(),O())}}),o===null?null:m.jsx("p",{role:"alert",className:"text-xs text-destructive",children:o}),m.jsx(st,{type:"submit",size:"sm",disabled:s||x.trim()==="",className:"self-end",children:e.sendLabel})]})]})},zf=({imageUrl:e,monogram:t,className:n})=>{const[r,s]=N.useState(!1),o=ye("size-5 shrink-0 rounded-full border border-input bg-card",n);return e===null||r?m.jsx("span",{"aria-hidden":"true",className:ye(o,"inline-flex items-center justify-center text-[0.625rem] leading-none font-bold"),children:m.jsx("span",{className:"text-box-cap",children:t})}):m.jsx("img",{src:e,alt:"",className:ye(o,"object-cover"),onError:()=>{s(!0)}})},zae={},Bae="Show",Hae="Hide",Fae="my-1.5 mr-4 ml-28 flex max-w-[52rem] flex-col gap-3 rounded-md border border-input bg-card p-3 font-sans whitespace-normal",j6="text-xs text-muted-foreground underline decoration-1 underline-offset-[0.3em] hover:text-foreground disabled:opacity-50",$ae=()=>{},DT=({label:e,submitLabel:t,postNowLabel:n=null,cancelLabel:r,hint:s=null,isSubmitting:o,shouldFocus:l=!1,className:c,renderEditor:u,onSubmit:f,onPostNow:h,onCancel:p})=>{const[y,x]=N.useState(""),[b,S]=N.useState(0),E=o||y.trim()==="",C=O=>{O(y.trim()),x(""),S(T=>T+1)};return m.jsxs("form",{className:ye("flex flex-col gap-2",c),onSubmit:O=>{O.preventDefault(),C(f)},children:[m.jsx("div",{children:u({label:e,shouldFocus:l,onChange:x})},b),m.jsxs("div",{className:"flex items-center justify-end gap-2",children:[s===null?null:m.jsx("p",{className:"mr-auto text-xs text-muted-foreground",children:s}),r===null||p===void 0?null:m.jsx(st,{type:"button",variant:"ghost",size:"sm",onClick:p,children:r}),n===null||h===void 0?null:m.jsx(st,{type:"button",variant:"outline",size:"sm",disabled:E,onClick:()=>{C(h)},children:n}),m.jsx(st,{type:"submit",size:"sm",disabled:E,children:t})]})]})},P6=({comment:e,verdictLabel:t=null,locationLabel:n=null,isActionPending:r=!1,className:s,onDiscard:o})=>m.jsxs("article",{className:ye("grid grid-cols-[1.75rem_minmax(0,1fr)] gap-x-2 gap-y-1 text-sm",s),children:[m.jsx(zf,{imageUrl:e.author.avatarUrl,monogram:e.author.monogram,className:"mt-0.5 size-6"}),m.jsxs("div",{className:"flex min-w-0 flex-col gap-1",children:[m.jsxs("p",{className:"flex flex-wrap items-baseline gap-x-2",children:[m.jsx("span",{className:"font-bold",children:e.author.name}),t===null?null:m.jsx("span",{children:t}),m.jsx("span",{className:"text-xs text-muted-foreground tabular-nums",children:e.timeLabel}),e.pendingLabel===null?null:m.jsx("span",{className:"text-xs font-bold text-signal-text",children:e.pendingLabel}),e.discardLabel===null||o===void 0?null:m.jsx("button",{type:"button",disabled:r,className:j6,onClick:()=>{o(e.id)},children:e.discardLabel})]}),n===null?null:m.jsx("p",{className:"font-mono text-xs text-muted-foreground wrap-anywhere",children:n}),m.jsx(uo,{blocks:e.body,codeLinks:zae,onOpenCodeLink:$ae})]})]}),Uae=({comments:e,label:t,rangeLabel:n,statusLabel:r,resolution:s,canReply:o,replyPlaceholder:l,submitLabel:c,cancelLabel:u,isSubmitting:f,renderEditor:h,onReply:p,onResolve:y,onDiscard:x})=>{const[b,S]=N.useState(!1),[E,C]=N.useState(!1),O=r!==null&&!E;return m.jsxs("section",{"aria-label":t,className:Fae,children:[n===null&&r===null?null:m.jsxs("p",{className:"flex flex-wrap items-baseline gap-x-3 text-xs text-muted-foreground",children:[n===null?null:m.jsx("span",{className:"tabular-nums",children:n}),r===null?null:m.jsx("span",{className:"font-bold text-foreground",children:r}),r===null?null:m.jsx("button",{type:"button","aria-expanded":!O,className:j6,onClick:()=>{C(T=>!T)},children:O?Bae:Hae})]}),O?null:e.map(T=>m.jsx(P6,{comment:T,isActionPending:f,onDiscard:x},T.id)),O||!b?null:m.jsx(DT,{label:`${l}, ${t}`,submitLabel:c,cancelLabel:u,isSubmitting:f,shouldFocus:!0,className:"pl-9",renderEditor:h,onSubmit:T=>{p(T),S(!1)},onCancel:()=>{S(!1)}}),O||b||!o&&s===null?null:m.jsxs("div",{className:"ml-9 flex flex-wrap items-center gap-3",children:[o?m.jsx("button",{type:"button",className:"h-8 min-w-48 flex-1 rounded-lg border border-input bg-background px-2.5 text-left text-sm text-muted-foreground hover:bg-muted",onClick:()=>{S(!0)},children:l}):null,s===null?null:m.jsx(st,{type:"button",variant:"outline",size:"sm",disabled:f,onClick:()=>{y(s.isResolving)},children:s.label})]})]})},Vae={bug:"text-destructive",risk:"text-risk-text",nit:"text-nit",question:"text-muted-foreground","core-change":"text-signal-text"},qae="M8 1a7 7 0 1 0 0 14A7 7 0 1 0 8 1z",Gae="M8 4 4 8l4 4 4-4z",Kae="M8 4.25 4.5 10.5h7z",Yae="M8 5.6 10.4 8 8 10.4 5.6 8z",Wae="M6.45 6.55a1.6 1.6 0 1 1 2.25 1.45c-.45.2-.7.5-.7.95",Xae="M5.9 10.1 10.1 5.9",J1=5.75,MI=({hole:e,className:t})=>m.jsx("path",{d:`${qae}${e}`,fillRule:"evenodd",className:t}),z6=({kind:e})=>e==="bug"?m.jsx(MI,{hole:Gae,className:"fill-destructive"}):e==="core-change"?m.jsx(MI,{hole:Kae,className:"fill-signal"}):e==="risk"?m.jsxs(m.Fragment,{children:[m.jsx("circle",{cx:"8",cy:"8",r:J1,className:"fill-none stroke-risk [stroke-width:2.5]"}),m.jsx("path",{d:Yae,className:"fill-risk"})]}):e==="question"?m.jsxs(m.Fragment,{children:[m.jsx("circle",{cx:"8",cy:"8",r:J1,className:"fill-none stroke-foreground [stroke-width:2]"}),m.jsx("path",{d:Wae,className:"fill-none stroke-foreground [stroke-linecap:round] [stroke-width:1.5]"}),m.jsx("circle",{cx:"8",cy:"11.05",r:"0.8",className:"fill-foreground"})]}):m.jsxs(m.Fragment,{children:[m.jsx("circle",{cx:"8",cy:"8",r:J1,className:"fill-none stroke-nit [stroke-width:1.5]"}),m.jsx("path",{d:Xae,className:"fill-none stroke-nit [stroke-linecap:round] [stroke-width:2]"})]}),B6=({kind:e,className:t})=>m.jsx("svg",{"aria-hidden":"true",viewBox:"0 0 16 16","data-kind":e,className:ye("size-3.5 shrink-0",t),children:m.jsx(z6,{kind:e})}),Aa=({kind:e,label:t,className:n})=>m.jsxs("span",{className:ye("inline-flex shrink-0 items-center gap-1 text-xs font-bold",Vae[e],n),children:[m.jsx(B6,{kind:e}),m.jsx("span",{className:"text-box-cap",children:t})]}),xb=({label:e,accessibleLabel:t,isReviewed:n,isDisabled:r=!1,className:s,onChange:o})=>m.jsxs("button",{type:"button","aria-label":t,"aria-pressed":n,disabled:r,"data-user-action-id":"review-toggle-action",className:ye("group/review inline-flex h-7 shrink-0 items-center gap-1.5 rounded-md px-2 text-[0.8rem] hover:bg-muted disabled:opacity-50",s),onClick:()=>{o(!n)},children:[m.jsx("span",{"aria-hidden":"true",className:"inline-flex size-4 items-center justify-center rounded-full border-[1.5px] border-muted-foreground text-line-foreground transition-colors duration-[180ms] ease-out group-aria-pressed/review:border-(--line) group-aria-pressed/review:bg-(--line)",children:m.jsx(wu,{className:"size-3 opacity-0 transition-opacity duration-[180ms] ease-out group-aria-pressed/review:opacity-100",strokeWidth:3})}),m.jsx("span",{className:"text-box-cap",children:e})]}),II="not-last:after:ml-1 not-last:after:font-normal not-last:after:text-muted-foreground not-last:after:content-['•']",Zy=8,Qae=[[1,1],[-1,1],[-1,-1],[1,-1]],Zae=6.25,Jae=8.25,ece=2,LI=([e,t],n)=>[Zy+e*n*Math.SQRT1_2,Zy+t*n*Math.SQRT1_2].map(r=>r.toFixed(ece)).join(" "),tce=(e,t,n)=>`M${LI(e,t)}L${LI(e,n)}`,H6=({innerRadius:e,outerRadius:t,className:n})=>m.jsx("path",{d:Qae.map(r=>tce(r,e,t)).join(""),className:ye("fill-none stroke-foreground [stroke-linecap:round] [stroke-width:1.6]",n)}),nce=({className:e})=>m.jsxs("svg",{"aria-hidden":"true",viewBox:"0 0 16 16","data-kind":"spotlight",className:ye("size-3.5 shrink-0",e),children:[m.jsx("circle",{cx:Zy,cy:Zy,r:"4.5",className:"fill-none stroke-foreground [stroke-width:1.75]"}),m.jsx(H6,{innerRadius:Zae,outerRadius:Jae,className:"[stroke-width:1.5]"})]}),jT=({spotlight:e,className:t})=>m.jsxs("span",{className:ye("inline-flex min-w-0 shrink-0 items-center gap-1 text-xs font-bold text-foreground",t),children:[m.jsx(nce,{}),m.jsxs("span",{className:"flex flex-wrap gap-x-1 text-box-cap",children:[m.jsx("span",{className:II,children:e.label}),e.classifications.map(n=>m.jsx("span",{className:ye("font-normal text-muted-foreground",II),children:n.label},n.key))]})]}),rce="[data-line]",sce="[data-diff-mark]",F6="[data-reference-scope]",oce="[data-file-header]",ice="[data-gutter-mark]",lce=28,B0=8,ace=new Map([["ArrowUp",-1],["ArrowDown",1]]),cce=150,uce=1e3,WE="data-gutter-card-owner",XE="flight-plan:gutter-card-owner",DI=()=>document.documentElement.getAttribute(WE),dce=()=>null,jI=e=>{e===null?document.documentElement.removeAttribute(WE):document.documentElement.setAttribute(WE,e),window.dispatchEvent(new Event(XE))},fce=e=>(window.addEventListener(XE,e),()=>{window.removeEventListener(XE,e)}),$6=e=>{const t=N.useSyncExternalStore(fce,DI,dce),n=N.useCallback(()=>{jI(e)},[e]),r=N.useCallback(()=>{DI()===e&&jI(null)},[e]);return{isOwner:t===e,claim:n,release:r}},hce=e=>{const t=new AbortController,n=()=>{t.signal.aborted||(t.abort(),e())},r=setTimeout(n,cce),s=()=>{clearTimeout(r),setTimeout(n,uce)};return window.addEventListener("scroll",s,{once:!0,passive:!0,capture:!0,signal:t.signal}),window.addEventListener("scrollend",n,{once:!0,capture:!0,signal:t.signal}),()=>{clearTimeout(r),t.abort()}},pce=(e,t)=>{const n=N.useRef(t);N.useEffect(()=>{n.current=t}),N.useEffect(()=>{n.current(e)},[e])},U6=8,V6="w-[min(56rem,calc(100vw-2rem))]",q6="max-w-none gap-2 text-sm leading-6",G6={side:"flip",align:"shift",fallbackAxisSide:"none"},mce=e=>{const t=(e==null?void 0:e.closest(rce))??null,n=(t==null?void 0:t.querySelector(sce))??null;return t===null||n===null?e:{contextElement:t,getBoundingClientRect:()=>{const r=t.getBoundingClientRect();return new DOMRect(n.getBoundingClientRect().right,r.top,lce,r.height)}}},gce=1,yce=e=>{var s;const t=((s=e==null?void 0:e.closest(F6))==null?void 0:s.querySelector(oce))??null;if(t===null)return 0;const n=Number.parseFloat(getComputedStyle(t).top)||0,r=t.getBoundingClientRect();return r.top<=n+gce?r.bottom:n},K6=e=>({anchor:()=>mce(e),collisionPadding:{top:yce(e)+B0,right:B0,bottom:B0,left:B0}}),Y6=(e,t)=>{N.useEffect(()=>{if(e)return window.addEventListener("scroll",t,{passive:!0,capture:!0}),()=>{window.removeEventListener("scroll",t,{capture:!0})}},[e,t])},W6=e=>{const t=ace.get(e.key),n=e.currentTarget.closest(F6);if(t===void 0||n===null)return;const r=[...n.querySelectorAll(ice)],s=r.indexOf(e.currentTarget)+t;s<0||s>=r.length||(e.preventDefault(),r[s].focus())},xce=150,bce="Click or press Enter to open",vce=["pending","open","resolved"],Sce={},ew="M3 2.6h8a1.4 1.4 0 0 1 1.4 1.4v4.5a1.4 1.4 0 0 1-1.4 1.4H6.4L4.2 11.7V9.9H3a1.4 1.4 0 0 1-1.4-1.4V4A1.4 1.4 0 0 1 3 2.6z",wce=ye("relative z-1 grid size-[1.125rem] shrink-0 place-items-center rounded-sm","transition-[background-color] duration-[180ms] ease-out hover:bg-muted aria-expanded:bg-muted","focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring"),Ece={open:"font-bold text-foreground",pending:"font-bold text-signal-text",resolved:"font-bold text-foreground"},Cce=()=>{},Tce=e=>vce.find(t=>e.some(n=>n.mark.kind===t))??"open",Nce=({kind:e})=>m.jsxs("svg",{"aria-hidden":"true",viewBox:"0 0 14 14","data-kind":e,className:"size-3.5 shrink-0",children:[e==="open"?m.jsx("path",{d:ew,className:"fill-muted-foreground"}):null,e==="pending"?m.jsxs(m.Fragment,{children:[m.jsx("path",{d:ew,className:"fill-none stroke-signal-text stroke-[1.5]"}),m.jsx("circle",{cx:"7",cy:"6.25",r:"1.6",className:"fill-signal"})]}):null,e==="resolved"?m.jsx("path",{d:ew,className:"fill-none stroke-muted-foreground stroke-1 [stroke-dasharray:2_1.4]"}):null]}),Oce=({thread:e})=>{const t=e.comments.at(0);return m.jsxs("section",{"aria-label":e.mark.label,className:"flex flex-col gap-1.5 px-3 py-2.5 not-first:border-t",children:[m.jsxs("p",{className:"flex flex-wrap gap-x-[0.5em] text-xs text-muted-foreground tabular-nums",children:[m.jsx("span",{className:ye(Ece[e.mark.kind],"after:ml-[0.5em] after:font-normal after:text-muted-foreground after:content-['•']"),children:e.mark.label}),m.jsx("span",{children:e.linesLabel})]}),t===void 0?null:m.jsxs("div",{className:"grid grid-cols-[1.5rem_minmax(0,1fr)] gap-x-2.5",children:[m.jsx(zf,{imageUrl:t.author.avatarUrl,monogram:t.author.monogram,className:"size-6"}),m.jsxs("div",{className:"flex min-w-0 flex-col gap-0.5",children:[m.jsxs("p",{className:"flex items-baseline gap-2 text-sm",children:[m.jsx("span",{className:"font-semibold",children:t.author.name}),m.jsx("span",{className:"text-xs text-muted-foreground",children:t.timeLabel})]}),m.jsx("div",{className:"line-clamp-2",children:m.jsx(uo,{blocks:t.body.slice(0,1),codeLinks:Sce,onOpenCodeLink:Cce,className:q6})})]})]})]})},Rce=({threads:e,isOpen:t,isTabStop:n,onToggle:r})=>{const s=N.useRef(null),[o,l]=N.useState(null),{isOwner:c,claim:u,release:f}=$6(`thread:${e.map(x=>x.id).join(" ")}`),h=c&&o!==null&&!t,p=N.useCallback(()=>{l(null),f()},[f]),y=Tce(e);return Y6(h,p),m.jsxs(Dm,{open:h,onOpenChange:x=>{if(!x){p();return}l(K6(s.current)),u()},children:[m.jsx(jm,{delay:xce,render:m.jsx("button",{ref:s,type:"button"}),"aria-label":e.map(x=>`${x.mark.label}, ${x.linesLabel}`).join("; "),"aria-expanded":t,tabIndex:n?0:-1,"data-gutter-mark":"","data-thread-mark":y,className:wce,onKeyDown:W6,onClick:()=>{p(),r()},children:m.jsx(Nce,{kind:y})}),o===null?null:m.jsxs(yb,{side:"top",align:"start",sideOffset:U6,anchor:o.anchor,collisionPadding:o.collisionPadding,collisionAvoidance:G6,className:ye("flex flex-col font-sans",V6),children:[m.jsx(o6,{}),e.map(x=>m.jsx(Oce,{thread:x},x.id)),m.jsx("p",{className:"border-t px-3 py-2 text-xs text-muted-foreground",children:bce})]})]})},Ace=({finding:e,codeLinks:t,onOpenCodeLink:n})=>{const[r,s]=N.useState(!1),{solution:o,trace:l}=e;return m.jsxs("article",{className:"flex flex-col gap-2 border-t pt-3 text-base leading-[1.7]",children:[m.jsxs("h4",{className:"flex items-baseline gap-2",children:[m.jsx(Aa,{kind:e.kind,label:e.kindLabel,className:"translate-y-px"}),m.jsx("span",{className:"font-semibold",children:m.jsx(df,{inlines:e.title,codeLinks:t,onOpenCodeLink:n})})]}),m.jsx(uo,{blocks:e.reading,codeLinks:t,onOpenCodeLink:n}),l===null?null:m.jsxs("div",{className:"flex flex-col gap-1",children:[m.jsx("p",{className:"text-xs font-bold text-muted-foreground",children:e.traceLabel}),m.jsx("ol",{className:"flex max-w-[66ch] list-decimal flex-col gap-1.5 pl-5 text-base leading-[1.7]",children:jf(l).map(({key:c,item:u})=>m.jsx("li",{children:m.jsx(df,{inlines:u,codeLinks:t,onOpenCodeLink:n})},c))})]}),o===null?null:m.jsxs("div",{className:"flex flex-col items-start gap-2",children:[m.jsx(st,{variant:"outline",size:"sm","aria-expanded":r,onClick:()=>{s(c=>!c)},children:r?o.hideLabel:o.showLabel}),r?m.jsx(Ou,{lines:o.lines,label:o.showLabel,className:"w-full rounded-md border"}):null]})]})},kce=["ml-18","ml-24","ml-30"],_ce="ml-36",Mce=["ml-28","ml-34","ml-40"],Ice="ml-46",Lce=(e,t)=>t?Mce.find((n,r)=>r===e)??Ice:kce.find((n,r)=>r===e)??_ce,Dce=({waypoint:e,isOpen:t,isCurrent:n,isReviewPending:r,isGuttered:s=!1,codeLinks:o,actions:l,onOpenCodeLink:c,onToggle:u,onReviewedChange:f})=>m.jsxs("section",{id:e.anchorId,"aria-label":e.title,"data-current":n,"data-reviewed":e.isReviewed,"data-view-section-id":"waypoint-box-section",className:ye("my-1.5 mr-4 scroll-mt-(--waypoint-scroll-margin) rounded-md border border-input bg-background font-sans whitespace-normal transition-[border-color,outline-color,opacity] duration-[180ms] ease-out data-[current=true]:border-(--line) data-[current=true]:outline-1 data-[current=true]:outline-(--line) data-[reviewed=true]:opacity-60",Lce(e.depth,s)),children:[m.jsxs("div",{className:"flex items-center gap-1 pr-1",children:[m.jsxs("button",{type:"button","aria-expanded":t,className:"flex min-w-0 flex-1 items-center gap-2 rounded-md px-2.5 py-2 text-left",onClick:u,children:[m.jsx(Ux,{"aria-hidden":"true",className:ye("size-4 shrink-0 text-muted-foreground transition-transform duration-[180ms] ease-out",t?"rotate-90":"")}),e.chip===null?null:m.jsx(Aa,{kind:e.chip.kind,label:e.chip.label}),e.coreChangeLabel===null?null:m.jsx(Aa,{kind:"core-change",label:e.coreChangeLabel}),e.spotlight===null?null:m.jsx(jT,{spotlight:e.spotlight}),m.jsx(ul,{isPending:e.isDraft,className:"w-56 text-[0.9375rem]",children:m.jsx("span",{className:ye("min-w-0 truncate text-[0.9375rem]",e.isDraft?"font-mono text-sm text-muted-foreground":"font-semibold"),children:e.title})}),m.jsx("span",{className:"ml-auto shrink-0 pl-2 text-xs text-muted-foreground tabular-nums",children:e.positionLabel})]}),l,f===null?null:m.jsx(xb,{label:e.reviewLabel,isReviewed:e.isReviewed,isDisabled:r,onChange:f})]}),t?m.jsxs("div",{className:"flex flex-col gap-3 border-t px-4 pt-3.5 pb-4 text-base leading-[1.7]",children:[e.reading===null?m.jsx(ul,{isPending:!0,lineCount:3,children:m.jsx("p",{className:"text-muted-foreground",children:e.unwrittenLabel})}):m.jsx(uo,{blocks:e.reading,codeLinks:o,onOpenCodeLink:c}),e.coreChange===null||e.coreChangeLabel===null?null:m.jsxs("div",{className:"flex flex-col gap-2 border-t pt-3",children:[m.jsx(Aa,{kind:"core-change",label:e.coreChangeLabel}),m.jsx(uo,{blocks:e.coreChange,codeLinks:o,onOpenCodeLink:c})]}),e.findings.map(h=>m.jsx(Ace,{finding:h,codeLinks:o,onOpenCodeLink:c},h.id))]}):null]}),jce="#D97757",Pce={claude:jce,codex:"currentColor",cursor:"currentColor"},zce={claude:"m4.7144 15.9555 4.7174-2.6471.079-.2307-.079-.1275h-.2307l-.7893-.0486-2.6956-.0729-2.3375-.0971-2.2646-.1214-.5707-.1215-.5343-.7042.0546-.3522.4797-.3218.686.0608 1.5179.1032 2.2767.1578 1.6514.0972 2.4468.255h.3886l.0546-.1579-.1336-.0971-.1032-.0972L6.973 9.8356l-2.55-1.6879-1.3356-.9714-.7225-.4918-.3643-.4614-.1578-1.0078.6557-.7225.8803.0607.2246.0607.8925.686 1.9064 1.4754 2.4893 1.8336.3643.3035.1457-.1032.0182-.0728-.164-.2733-1.3539-2.4467-1.445-2.4893-.6435-1.032-.17-.6194c-.0607-.255-.1032-.4674-.1032-.7285L6.287.1335 6.6997 0l.9957.1336.419.3642.6192 1.4147 1.0018 2.2282 1.5543 3.0296.4553.8985.2429.8318.091.255h.1579v-.1457l.1275-1.706.2368-2.0947.2307-2.6957.0789-.7589.3764-.9107.7468-.4918.5828.2793.4797.686-.0668.4433-.2853 1.8517-.5586 2.9021-.3643 1.9429h.2125l.2429-.2429.9835-1.3053 1.6514-2.0643.7286-.8196.85-.9046.5464-.4311h1.0321l.759 1.1293-.34 1.1657-1.0625 1.3478-.8804 1.1414-1.2628 1.7-.7893 1.36.0729.1093.1882-.0183 2.8535-.607 1.5421-.2794 1.8396-.3157.8318.3886.091.3946-.3278.8075-1.967.4857-2.3072.4614-3.4364.8136-.0425.0304.0486.0607 1.5482.1457.6618.0364h1.621l3.0175.2247.7892.522.4736.6376-.079.4857-1.2142.6193-1.6393-.3886-3.825-.9107-1.3113-.3279h-.1822v.1093l1.0929 1.0686 2.0035 1.8092 2.5075 2.3314.1275.5768-.3218.4554-.34-.0486-2.2039-1.6575-.85-.7468-1.9246-1.621h-.1275v.17l.4432.6496 2.3436 3.5214.1214 1.0807-.17.3521-.6071.2125-.6679-.1214-1.3721-1.9246L14.38 17.959l-1.1414-1.9428-.1397.079-.674 7.2552-.3156.3703-.7286.2793-.6071-.4614-.3218-.7468.3218-1.4753.3886-1.9246.3157-1.53.2853-1.9004.17-.6314-.0121-.0425-.1397.0182-1.4328 1.9672-2.1796 2.9446-1.7243 1.8456-.4128.164-.7164-.3704.0667-.6618.4008-.5889 2.386-3.0357 1.4389-1.882.929-1.0868-.0062-.1579h-.0546l-6.3385 4.1164-1.1293.1457-.4857-.4554.0608-.7467.2307-.2429 1.9064-1.3114Z",codex:"M22.2819 9.8211a5.9847 5.9847 0 0 0-.5157-4.9108 6.0462 6.0462 0 0 0-6.5098-2.9A6.0651 6.0651 0 0 0 4.9807 4.1818a5.9847 5.9847 0 0 0-3.9977 2.9 6.0462 6.0462 0 0 0 .7427 7.0966 5.98 5.98 0 0 0 .511 4.9107 6.051 6.051 0 0 0 6.5146 2.9001A5.9847 5.9847 0 0 0 13.2599 24a6.0557 6.0557 0 0 0 5.7718-4.2058 5.9894 5.9894 0 0 0 3.9977-2.9001 6.0557 6.0557 0 0 0-.7475-7.0729zm-9.022 12.6081a4.4755 4.4755 0 0 1-2.8764-1.0408l.1419-.0804 4.7783-2.7582a.7948.7948 0 0 0 .3927-.6813v-6.7369l2.02 1.1686a.071.071 0 0 1 .038.052v5.5826a4.504 4.504 0 0 1-4.4945 4.4944zm-9.6607-4.1254a4.4708 4.4708 0 0 1-.5346-3.0137l.142.0852 4.783 2.7582a.7712.7712 0 0 0 .7806 0l5.8428-3.3685v2.3324a.0804.0804 0 0 1-.0332.0615L9.74 19.9502a4.4992 4.4992 0 0 1-6.1408-1.6464zM2.3408 7.8956a4.485 4.485 0 0 1 2.3655-1.9728V11.6a.7664.7664 0 0 0 .3879.6765l5.8144 3.3543-2.0201 1.1685a.0757.0757 0 0 1-.071 0l-4.8303-2.7865A4.504 4.504 0 0 1 2.3408 7.872zm16.5963 3.8558L13.1038 8.364 15.1192 7.2a.0757.0757 0 0 1 .071 0l4.8303 2.7913a4.4944 4.4944 0 0 1-.6765 8.1042v-5.6772a.79.79 0 0 0-.407-.667zm2.0107-3.0231l-.142-.0852-4.7735-2.7818a.7759.7759 0 0 0-.7854 0L9.409 9.2297V6.8974a.0662.0662 0 0 1 .0284-.0615l4.8303-2.7866a4.4992 4.4992 0 0 1 6.6802 4.66zM8.3065 12.863l-2.02-1.1638a.0804.0804 0 0 1-.038-.0567V6.0742a4.4992 4.4992 0 0 1 7.3757-3.4537l-.142.0805L8.704 5.459a.7948.7948 0 0 0-.3927.6813zm1.0976-2.3654l2.602-1.4998 2.6069 1.4998v2.9994l-2.5974 1.4997-2.6067-1.4997Z",cursor:"M11.503.131 1.891 5.678a.84.84 0 0 0-.42.726v11.188c0 .3.162.575.42.724l9.609 5.55a1 1 0 0 0 .998 0l9.61-5.55a.84.84 0 0 0 .42-.724V6.404a.84.84 0 0 0-.42-.726L12.497.131a1.01 1.01 0 0 0-.996 0M2.657 6.338h18.55c.263 0 .43.287.297.515L12.23 22.918c-.062.107-.229.064-.229-.06V12.335a.59.59 0 0 0-.295-.51l-9.11-5.257c-.109-.063-.064-.23.061-.23"},Bce=({agent:e,className:t})=>m.jsx("svg",{"aria-hidden":"true",viewBox:"0 0 24 24","data-agent-mark":e,className:ye("size-3.5 shrink-0",t),children:m.jsx("path",{d:zce[e],fill:Pce[e]})}),Hce=["core-change","bug","risk","nit","question"],Jy="explain-waypoint-action",PT="explain-code-block-action",Fce="s",zT="c",$ce="f",Uce="q",Vce="e",X6="r",qce="Add comment",Q6="Write description",Gce="Explain this line",Kce="Explain the whole code block",Yce="Explain",Wce="Explain block",Xce="Collapse all",Qce="Expand all",Zce="Collapse file",Jce="Expand file",eue="Expand waypoint",tue="Collapse waypoint",nue="reviewed",bb=`Pick a waypoint first: press ${OT.toUpperCase()} to step to the next one.`,rue="This waypoint has no lines on the page to comment on.",PI=(e,t,n)=>e||t===null?n:t,sue=e=>{const{stepping:t}=e.controls,n=e.positionLabel===null?[]:[{kind:"position",label:e.positionLabel}];return[PI(e.canStepBack,e.sectionSteps.back,Un({key:EB,actionId:"previous-waypoint-action",label:t.previousLabel,isDisabled:!e.canStepBack,onRun:e.onPrevious})),...n,PI(e.canStepForward,e.sectionSteps.next,Un({key:OT,actionId:"next-waypoint-action",label:t.nextLabel,isDisabled:!e.canStepForward,onRun:e.onNext}))]},oue=e=>{const{onCurrentReviewedChange:t,currentWaypoint:n}=e;if(t===null)return[];const r=(n==null?void 0:n.isReviewed)===!0,{currentReview:s}=e.controls;return[Un({key:Fce,actionId:"mark-reviewed-action",label:r?s.reviewedLabel:s.markLabel,isPressed:r,isPrimary:!r,isDisabled:n===null,disabledHint:bb,onRun:()=>{t(!r)}})]},iue=(e,t)=>[Un({key:zT,actionId:"write-description-action",label:Q6,isDisabled:!t,disabledHint:bb,onRun:e})],lue=e=>{const{onCommentOnCurrent:t,onDescribeCurrent:n,currentWaypoint:r}=e;return n!==null?iue(n,r!==null):t===null?[]:[Un({key:zT,actionId:"add-comment-action",label:qce,isDisabled:(r==null?void 0:r.canComment)!==!0,disabledHint:r===null?bb:rue,onRun:t})]},aue=e=>{const{onWriteUpCurrent:t,currentWaypoint:n}=e;if(t===null||(n==null?void 0:n.canWriteUp)!==!0)return[];const r=Un({key:If,actionId:Jy,label:e.agentLabel===null?Gce:`Let ${e.agentLabel} explain`,shortLabel:Yce,onRun:()=>{t("line")}}),s=Un({key:Are,actionId:PT,label:Kce,shortLabel:Wce,onRun:()=>{t("block")}});return n.canWriteUpBlock?[r,s]:[r]},cue=e=>[...oue(e),...lue(e),...aue(e)],uue=e=>{const{onShowReviewedChange:t}=e,n=e.controls.reviewedToggle;return t===null?[]:[{kind:"choice",id:nue,label:n.label,detailLabel:n.countLabel,detailTone:null,marker:e.markerOf("reviewed"),isChecked:n.isShown,isDisabled:!n.isAvailable&&!n.isShown,onToggle:()=>{t(!n.isShown)}}]},due=e=>Hce.some(t=>t===e),fue=(e,t)=>n=>({kind:"choice",id:n.key,label:n.label,detailLabel:n.detailLabel,detailTone:n.detailChange,marker:due(n.key)?e.markerOf(n.key):null,isChecked:n.isSelected,isDisabled:!1,onToggle:()=>{t(n.toggledKeys.length===0?null:n.toggledKeys)}}),hue=e=>{const{onFilterChange:t}=e;if(t===null)return[];const{filter:n}=e.controls,r=fue(e,t),s=l=>({kind:"submenu",id:l.id,label:l.label,heading:l.heading,valueLabel:l.valueLabel,choices:l.options.map(r)}),o=n.groups.map(l=>[...l.options.map(r),...l.more===null?[]:[s(l.more)]]);return[{kind:"menu",key:$ce,actionId:"filter-action",label:n.buttonLabel,badge:n.badge,heading:n.heading,itemGroups:[...o,n.submenus.map(s),uue(e)].filter(l=>l.length>0)}]},pue=e=>{const{isFileCollapsed:t,currentWaypoint:n}=e,r=(n==null?void 0:n.isOpen)===!0,s=t===null?[]:[Un({key:Vce,actionId:"collapse-file-action",label:t?Jce:Zce,onRun:()=>{e.onFileCollapsedChange(!t)}})];return[Un({key:Uce,actionId:"collapse-files-action",label:e.areFilesCollapsed?Qce:Xce,onRun:()=>{e.onFilesCollapsedChange(!e.areFilesCollapsed)}}),...s,Un({key:X6,actionId:"expand-waypoint-action",label:r?tue:eue,isDisabled:n===null,disabledHint:bb,onRun:()=>{e.onCurrentOpenChange(!r)}})]},mue=e=>[sue(e),cue(e),hue(e),pue(e)].filter(t=>t.length>0),vb=N.createContext(null),gue=150,yue="Expand",xue="pointer-events-none absolute left-1/2 -ml-px w-0.5 transition-[opacity,background-color] duration-[180ms] ease-out",bue={solid:"bg-waypoint",faint:"bg-waypoint opacity-50",quiet:"bg-muted-foreground opacity-35"},tw="top-0 h-[0.1875rem]",zI="top-[1.3125rem] bottom-0",vue="inset-y-0",Sue="top-0 h-3",wue=ye("relative z-1 grid size-[1.125rem] shrink-0 scroll-mt-[calc(var(--waypoint-scroll-margin)+14rem)] place-items-center rounded-full","transition-[background-color,opacity] duration-[180ms] ease-out hover:bg-muted aria-expanded:bg-muted data-[reviewed=true]:opacity-45","focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring"),QE=5.75,Eue=7,Cue=2.25,Tue=8,Nue=9.5,Oue=11.75,Rue="M5 8.25 7.1 10.25 11 5.9",Aue="[stroke-dasharray:2.4_2.1]",kue=ye("flex flex-col font-sans",V6),_ue="This line of code is not explained or checked for issues yet.",Mue="This waypoint does not have any description or explanation.",Iue="Explain this line",Lue="Explain the whole code block",Due="Ctrl+G",jue=e=>e===null?_ue:`${e.label} has not explained this line of code or checked it for issues yet.`,Pue=e=>`${(e==null?void 0:e.label)??"The agent"} is explaining this line.`,zue=({reach:e,isJoinedAbove:t},n)=>{const r=t?[tw]:[];return e==="start"?[...r,zI]:e==="single"?r:e==="middle"?n?[tw,zI]:[vue]:[n?tw:Sue]},Bue=({stem:e,hasMark:t,children:n})=>{const r=e===null?[]:zue(e,t);return m.jsxs("span",{className:"relative flex flex-col items-center gap-0.5 self-stretch pt-[0.1875rem]",children:[r.map(s=>m.jsx("span",{"aria-hidden":"true",className:ye(xue,e===null?null:bue[e.tone],s)},s)),n]})},Hue=({isCurrent:e})=>e?m.jsxs(m.Fragment,{children:[m.jsx("circle",{cx:"8",cy:"8",r:QE,className:"fill-none stroke-waypoint [stroke-width:2.5]"}),m.jsx("circle",{cx:"8",cy:"8",r:Cue,className:"fill-waypoint"})]}):m.jsx("circle",{cx:"8",cy:"8",r:QE,className:"fill-none stroke-muted-foreground [stroke-width:2.5]"}),Fue=()=>m.jsxs(m.Fragment,{children:[m.jsx("circle",{cx:"8",cy:"8",r:Eue,className:"fill-waypoint"}),m.jsx("path",{"data-reviewed-glyph":"",d:Rue,className:"fill-none stroke-code [stroke-linecap:round] [stroke-linejoin:round] [stroke-width:2]"})]}),$ue=({isBeingWritten:e})=>m.jsx("circle",{"data-being-written":e,cx:"8",cy:"8",r:QE,className:ye("origin-center fill-none stroke-muted-foreground [stroke-width:2] [transform-box:fill-box]",Aue,e?"motion-safe:animate-spin":"")}),Uue=({waypoint:e,isCurrent:t})=>e.isReviewed?m.jsx(Fue,{}):e.mark.kind!=="plain"?m.jsx(z6,{kind:e.mark.kind}):e.reading===null?m.jsx($ue,{isBeingWritten:e.isBeingWritten}):m.jsx(Hue,{isCurrent:t}),Vue=e=>!e.isReviewed&&e.mark.kind==="plain"&&e.reading!==null,que=({waypoint:e,isCurrent:t})=>m.jsxs("svg",{"aria-hidden":"true",viewBox:"0 0 16 16",className:"size-4 shrink-0 overflow-visible",children:[m.jsx(Uue,{waypoint:e,isCurrent:t}),t&&!Vue(e)?m.jsx("circle",{cx:"8",cy:"8",r:Tue,className:"fill-none stroke-waypoint [stroke-width:1.25]"}):null,e.spotlight===null?null:m.jsx(H6,{innerRadius:Nue,outerRadius:Oue})]}),Gue=({waypoint:e,isAuthored:t})=>{const n=N.use(vb);return m.jsxs("div",{className:"flex flex-col gap-2 border-t px-3 py-2",children:[e.hint===null?null:m.jsx("p",{className:"text-sm text-foreground",children:e.hint}),e.isBeingWritten?m.jsx(k6,{label:Pue(n)}):m.jsx(Pf,{label:t?Mue:jue(n)})]})},Kue=e=>e===null?Iue:`Let ${e.label} explain`,Yue=({writeUp:e})=>{const t=N.use(vb);return m.jsxs(m.Fragment,{children:[m.jsx(Lp,{label:Kue(t),keyLabel:If,icon:t===null?null:m.jsx(Bce,{agent:t.name}),actionId:Jy,onClick:e.onLine}),e.onBlock===null?null:m.jsx(Lp,{label:Lue,keyLabel:Due,actionId:PT,onClick:e.onBlock})]})},Wue=({waypoint:e,isReviewPending:t,codeLinks:n,writeUp:r,onOpenCodeLink:s,onReviewedChange:o,onWriteDescription:l,onExpand:c})=>{var p;const u=((p=e.reading)==null?void 0:p.slice(0,1))??null,f=r!==null&&u===null&&!e.isBeingWritten,h=[e.rangeLabel,e.positionLabel].filter(y=>y!==null).map(y=>({text:y,kind:"plain"}));return m.jsxs(m.Fragment,{children:[m.jsxs("div",{className:"flex flex-col gap-1 px-3 pt-2.5 pb-2",children:[e.chip===null&&e.coreChangeLabel===null&&e.spotlight===null?null:m.jsxs("div",{className:"flex flex-wrap gap-x-3 gap-y-1",children:[e.chip===null?null:m.jsx(Aa,{kind:e.chip.kind,label:e.chip.label}),e.coreChangeLabel===null?null:m.jsx(Aa,{kind:"core-change",label:e.coreChangeLabel}),e.spotlight===null?null:m.jsx(jT,{spotlight:e.spotlight})]}),m.jsx("p",{className:ye("leading-5",e.isDraft?"font-mono text-muted-foreground":"font-semibold"),children:e.title}),m.jsx(ff,{segments:h,className:"text-xs text-muted-foreground tabular-nums"})]}),u===null?m.jsx(Gue,{waypoint:e,isAuthored:l!==null}):m.jsx("div",{className:"line-clamp-3 border-t px-3 py-2",children:m.jsx(uo,{blocks:u,codeLinks:n,onOpenCodeLink:s,className:q6})}),m.jsxs("div",{className:"flex min-h-9 flex-wrap items-center gap-1.5 border-t p-1 text-xs",children:[f?m.jsx(Yue,{writeUp:r}):null,l===null||u!==null||e.isBeingWritten?null:m.jsx(Lp,{label:Q6,keyLabel:zT,actionId:"write-description-action",onClick:l}),m.jsx(Lp,{label:yue,keyLabel:X6,variant:"ghost",actionId:"expand-waypoint-action",onClick:c}),o===null?null:m.jsx(xb,{label:e.reviewLabel,isReviewed:e.isReviewed,isDisabled:t,className:"ml-auto text-foreground",onChange:o})]})]})},Xue=({waypoint:e,isOpen:t,isCurrent:n,isReviewPending:r,isTabStop:s,previewRequest:o,codeLinks:l,writeUp:c,onWriteDescription:u=null,onOpenCodeLink:f,onToggle:h,onReviewedChange:p,onPreviewChange:y})=>{const x=N.useRef(null),[b,S]=N.useState(null),{isOwner:E,claim:C,release:O}=$6(`waypoint:${e.id}`),T=E&&b!==null&&!t,R=N.useCallback(()=>{S(K6(x.current)),C()},[C]),k=N.useCallback(()=>{S(null),O()},[O]),M=()=>{k(),h()};return Y6(T,k),pce(T,y),N.useEffect(()=>o===null?void 0:hce(R),[o,R]),m.jsxs(Dm,{open:T,onOpenChange:A=>{A?R():k()},children:[m.jsx(jm,{delay:gue,render:m.jsx("button",{ref:x,type:"button"}),id:t?void 0:e.anchorId,"aria-label":e.mark.label,"aria-expanded":t,tabIndex:s?0:-1,"data-gutter-mark":"","data-waypoint-mark":e.id,"data-user-action-id":"waypoint-mark-action","data-current":n,"data-reviewed":e.isReviewed,className:wue,onKeyDown:W6,onClick:M,children:m.jsx(que,{waypoint:e,isCurrent:n})}),b===null?null:m.jsxs(yb,{side:"top",align:"start",sideOffset:U6,anchor:b.anchor,collisionPadding:b.collisionPadding,collisionAvoidance:G6,"data-view-section-id":"waypoint-card-section",className:kue,children:[m.jsx(o6,{}),m.jsx(Wue,{waypoint:e,isReviewPending:r,codeLinks:l,writeUp:c,onWriteDescription:u===null?null:()=>{k(),u()},onOpenCodeLink:f,onReviewedChange:p,onExpand:M})]})]})},BI={middle:3,start:2,end:1,single:0},HI={solid:2,faint:1,quiet:0},Que=({placed:e,pending:t},n)=>{if(n.kind==="waypoint")return{placed:e,pending:n.waypoint.lines===null?t:[...t,n.waypoint]};if(n.kind==="gap")return{placed:e,pending:[]};const r=n.lines.at(0);return r===void 0||t.length===0?{placed:e,pending:t}:{placed:new Map([...e,[r,t]]),pending:[]}},Zue=e=>e.reduce(Que,{placed:new Map,pending:[]}).placed,Z6=e=>e.flatMap(t=>t.kind==="lines"?[...t.lines]:t.kind==="gap"?[null]:[]),Jue=(e,t,n)=>{const r=e.slice(t),s=r.indexOf(null),o=s===-1?r:r.slice(0,s),l=o.findIndex(c=>(c==null?void 0:c.numberLabel)===String(n));return t+(l===-1?o.length-1:l)},ede=(e,t,n)=>t===n?"single":e===t?"start":e===n?"end":"middle",tde=(e,t)=>({reach:e,tone:t,isJoinedAbove:t==="solid"&&(e==="start"||e==="single")}),nde=(e,t)=>t===void 0?!0:e.tone!==t.tone?HI[e.tone]>HI[t.tone]:BI[e.reach]>BI[t.reach],FI=(e,t,n)=>{const r=Z6(e);return[...t].flatMap(([o,l])=>l.flatMap(c=>{const u=n(c.id);if(u===null||c.lines===null)return[];const f=r.indexOf(o),h=Jue(r,f,c.lines.lineEnd);return r.slice(f,h+1).flatMap((p,y)=>p===null?[]:[[p,tde(ede(f+y,f,h),u)]])})).reduce((o,[l,c])=>nde(c,o.get(l))?new Map([...o,[l,c]]):o,new Map)},$I=10,rde=new Set,J6=new Set,sde=new Set,ode="[data-waypoint-mark]",ide=new Set(["auto","scroll"]),lde="transition-opacity duration-[180ms] ease-out data-[unfocused=true]:opacity-45",ade=(e,t)=>{const n=e.findIndex(o=>o.kind==="waypoint"&&o.waypoint.id===t);if(n===-1)return rde;const r=e.slice(n+1),s=r.findIndex(o=>o.kind!=="lines");return new Set((s===-1?r:r.slice(0,s)).map(o=>o.id))},cde=(e,t)=>{var n;return((n=e.find(r=>r.kind==="lines"&&Zie(r.lines,t)))==null?void 0:n.id)??null},ude=(e,t)=>e.flatMap(n=>n.kind==="waypoint"&&n.waypoint.id===t?[n.rootBlockId]:[]).at(0)??null,dde=(e,t,n)=>{const r=ude(e,t);return{onLine:()=>{n({kind:"waypoint",waypointId:t})},onBlock:r===null?null:()=>{n({kind:"root-block",rootBlockId:r})}}},fde=e=>{const t=Number.parseInt(e.startLineLabel,$I),n=Number.parseInt(e.lineLabel,$I);return Array.from({length:Math.max(n-t,0)+1},(r,s)=>y6({side:e.side,lineLabel:String(t+s)}))},UI=(e,t)=>e.side===t.side&&e.lineLabel===t.lineLabel,VI=e=>e.startLineLabel===e.lineLabel?e.lineLabel:`${e.startLineLabel} to ${e.lineLabel}`,hde=(e,t)=>e!==null&&t!==null&&e.side===t.side&&e.lineLabel===t.lineLabel,pde=(e,t)=>new Set([...[...e].filter(n=>!t.includes(n)),...t.filter(n=>!e.has(n))]),qI=(e,t)=>e.startsOpen!==t.has(e.id),BT=e=>e.isReviewed||e.isFoldedByFilter,mde=e=>new Set(e.filter(BT).map(t=>t.id)),gde=(e,t)=>BT(e)?t.has(e.id):!t.has(e.id),yde=(e,t,n)=>{const r=[...e].filter(o=>o!==t.id),s=BT(t)?n:!n;return new Set(s?[...r,t.id]:r)},xde=(e,t)=>new Set(e.filter(n=>gde(n,t)).map(n=>n.id)),bde=(e,t)=>[...[...e].filter(n=>!t.has(n)),...[...t].filter(n=>!e.has(n))],vde=e=>{const t=mde(e),[n,r]=N.useState({foldedIds:t,toggledIds:J6}),s=bde(n.foldedIds,t);return s.length>0&&r({foldedIds:t,toggledIds:new Set([...n.toggledIds].filter(o=>!s.includes(o)))}),{openRootBlockIds:xde(e,n.toggledIds),onRootBlockOpenChange:(o,l)=>{const c=e.find(u=>u.id===o);c!==void 0&&r(u=>({...u,toggledIds:yde(u.toggledIds,c,l)}))}}},Sde=(e,t)=>e!==null&&!t.has(e),GI=(e,t)=>{var n;return((n=[...(e==null?void 0:e.querySelectorAll(ode))??[]].find(r=>r.dataset.waypointMark===t))==null?void 0:n.getBoundingClientRect().top)??null},wde=e=>ide.has(getComputedStyle(e).overflowY)&&e.scrollHeight>e.clientHeight,e8=e=>{const t=(e==null?void 0:e.parentElement)??null;return t===null?window:wde(t)?t:e8(t)},Ede=(e,t)=>{const n=N.useRef(null);return N.useLayoutEffect(()=>{const r=n.current;n.current=null;const s=r===null?null:GI(e.current,r.waypointId);r!==null&&s!==null&&e8(e.current).scrollBy(0,s-r.top)},[e,t]),r=>{const s=GI(e.current,r);n.current=s===null?null:{waypointId:r,top:s}}},t8=({path:e,label:t,rows:n,rootBlocks:r,threads:s,previewVisit:o=null,openWaypointIds:l,currentWaypointId:c,focusedWaypointId:u,isCollapsed:f=!1,isWrapped:h=!1,isReviewPending:p,commenting:y,codeLinks:x,codeDefinitions:b,onOpenCodeLink:S,onToggleWaypoint:E,onWaypointReviewedChange:C,onRootBlockReviewedChange:O,onWriteUp:T=null,authoring:R=null})=>{const k=N.useRef(null),[M,A]=N.useState(null),[I,L]=N.useState(J6),{openRootBlockIds:D,onRootBlockOpenChange:P}=vde(r),z=Ede(k,l);if(f)return null;const $=Zue(n),j=re=>re===null?sde:new Set(FI(n,$,he=>he===re?"faint":null).keys()),H=j(u),B=H.size===0?ade(n,u):new Set(n.filter(re=>re.kind==="lines"&&re.lines.some(he=>H.has(he))).map(re=>re.id)),V=cde(n,b),G=B.size>0,q=(y==null?void 0:y.composingRange)??null,K=new Set([...s,...q===null?[]:[q]].flatMap(fde)),W=new Set([...$.values()].flat().map(re=>re.id)),ce=FI(n,$,re=>l.has(re)?"solid":re===c?"faint":"quiet"),F=j(M),X=re=>s.filter(he=>UI(he,re)),te=Z6(n).find(re=>{if(re===null)return!1;const he=qE(re);return $.has(re)||he!==null&&X(he).length>0})??null,Z=te===null?null:qE(te),Y=re=>m.jsx(Yle,{blocks:re,codeLinks:x,onOpenCodeLink:S}),le=re=>{const he=$.get(re)??[];return m.jsx(Bue,{stem:ce.get(re)??null,hasMark:he.length>0,children:he.map((Se,ke)=>m.jsx(Xue,{waypoint:Se,isOpen:l.has(Se.id),isCurrent:Se.id===c,isReviewPending:p,isTabStop:re===te&&ke===0,previewRequest:(o==null?void 0:o.waypointId)===Se.id?o.count:null,codeLinks:x,writeUp:T===null?null:dde(n,Se.id,T),onWriteDescription:R===null?null:()=>{R.onWriteDescription(Se.id)},onOpenCodeLink:S,onToggle:()=>{z(Se.id),E(Se.id)},onReviewedChange:C===null?null:be=>{C(Se.id,be)},onPreviewChange:be=>{A(_e=>be?Se.id:_e===Se.id?null:_e)}},Se.id))})},xe=re=>{const he=y===null?[]:X(re);return he.length===0?null:m.jsx(Rce,{threads:he,isOpen:he.some(Se=>qI(Se,I)),isTabStop:hde(re,Z)&&te!==null&&!$.has(te),onToggle:()=>{L(Se=>pde(Se,he.map(ke=>ke.id)))}})},fe=re=>{const he=r.find(ke=>ke.id===re);if(he===void 0)return null;const Se=D.has(re);return m.jsxs(m.Fragment,{children:[he.coreChangeLabel===null?null:m.jsx(Aa,{kind:"core-change",label:he.coreChangeLabel}),he.spotlight===null?null:m.jsx(jT,{spotlight:he.spotlight}),O===null?null:m.jsx(xb,{label:he.reviewLabel,accessibleLabel:he.reviewName,isReviewed:he.isReviewed,isDisabled:p,className:"h-6",onChange:ke=>{O(re,ke)}}),m.jsx(iie,{"aria-label":Se?he.collapseLabel:he.expandLabel,className:"flex size-6 shrink-0 items-center justify-center rounded-md text-muted-foreground hover:bg-muted hover:text-foreground",children:m.jsx(su,{"aria-hidden":"true",className:ye("size-4 transition-transform duration-[180ms] ease-out",Se?"":"-rotate-90")})})]})},oe=re=>y===null?null:m.jsxs(m.Fragment,{children:[X(re).filter(he=>qI(he,I)).map(he=>m.jsx(Uae,{comments:he.comments,label:`${e} ${VI(he)}`,rangeLabel:he.rangeLabel,statusLabel:he.statusLabel,resolution:he.resolution,canReply:he.canReply,replyPlaceholder:y.composer.replyPlaceholder,submitLabel:y.composer.replyLabel,cancelLabel:y.composer.cancelLabel,isSubmitting:y.isCommentPending,renderEditor:y.renderCommentEditor,onReply:Se=>{y.onReply(he.id,Se)},onResolve:Se=>{y.onResolveThread(he.id,Se)},onDiscard:y.onDiscardComment},he.id)),q!==null&&UI(q,re)?m.jsx(DT,{label:`${y.composer.placeholder}, ${e} ${VI(q)}`,submitLabel:y.composer.submitLabel,postNowLabel:y.composer.postNowLabel,cancelLabel:y.composer.cancelLabel,hint:y.composer.rangeHint,isSubmitting:y.isCommentPending,shouldFocus:!0,className:"my-1.5 mr-4 ml-28 max-w-[52rem] rounded-md border border-input bg-card p-3 font-sans whitespace-normal",renderEditor:y.renderCommentEditor,onSubmit:he=>{y.onAddComment(e,q,he)},onPostNow:he=>{y.onPostComment(e,q,he)},onCancel:()=>{y.onStartComment(e,null,!1)}}):null]});return m.jsx("div",{ref:k,children:n.map(re=>{if(re.kind==="lines"){const be=B.has(re.id);return m.jsx("div",{"data-unfocused":G&&!be,"data-waypoint-focus":be?u??void 0:void 0,className:lde,children:m.jsx(Ou,{lines:re.lines,definitions:b,hasReferenceTabStop:re.id===V,renderDefinitionDescription:Y,path:e,label:t,isWrapped:h,className:"py-0",collapses:re.collapses,openRootBlockIds:D,renderCollapseControls:fe,onRootBlockOpenChange:P,commentedLineKeys:K,markedLines:F,renderLineThreads:oe,renderWaypointLane:le,renderThreadMark:xe,...y===null?{}:{addCommentLabel:y.composer.addLabel,onAddComment:(_e,Me)=>{y.onStartComment(e,_e,Me)}}})},re.id)}if(Sde(re.rootBlockId,D))return null;if(re.kind==="gap")return m.jsx("p",{className:"border-y bg-muted/60 py-0.5 pl-28 font-mono text-xs text-muted-foreground first-of-type:border-t-0 last:border-b-0",children:re.label},re.id);const he=W.has(re.waypoint.id),Se=l.has(re.waypoint.id),ke=(R==null?void 0:R.editedWaypointId)===re.waypoint.id;return he&&!Se&&!ke?null:m.jsxs("div",{"data-waypoint-focus":re.waypoint.id===u?u:void 0,className:"relative bg-code",children:[he?m.jsx("span",{"aria-hidden":"true",className:"pointer-events-none absolute top-5 bottom-0 left-[calc(0.625rem-1px)] w-0.5 bg-(--line)"}):null,ke?R.renderEditor(re.waypoint.id):m.jsx(Dce,{waypoint:re.waypoint,isOpen:Se,isCurrent:re.waypoint.id===c,isReviewPending:p,isGuttered:!0,codeLinks:x,actions:R==null?void 0:R.renderActions(re.waypoint.id),onOpenCodeLink:S,onToggle:()=>{E(re.waypoint.id)},onReviewedChange:C===null?null:be=>{C(re.waypoint.id,be)}})]},re.id)})})},Cde="Collapse file",Tde="Expand file",Nde=({file:e,previewVisit:t=null,openWaypointIds:n,currentWaypointId:r,focusedWaypointId:s,isCollapsed:o,isReviewPending:l,composer:c,composingRange:u,isCommentPending:f,renderCommentEditor:h,codeLinks:p,codeDefinitions:y,onOpenCodeLink:x,onToggleWaypoint:b,onCollapsedChange:S,onWaypointReviewedChange:E,onFileReviewedChange:C,onRootBlockReviewedChange:O,onStartComment:T,onAddComment:R,onPostComment:k,onReply:M,onResolveThread:A,onDiscardComment:I,onWriteUp:L=null,authoring:D=null,headerActions:P=null})=>{const z=c===null?null:{composer:c,composingRange:u,isCommentPending:f,renderCommentEditor:h,onStartComment:T,onAddComment:R,onPostComment:k,onReply:M,onResolveThread:A,onDiscardComment:I};return m.jsx("article",{id:e.anchorId,"aria-label":e.title,"data-reviewed":e.isReviewed,"data-reference-scope":"",className:ye("scroll-mt-(--waypoint-scroll-margin) pt-6",o?"":"[contain-intrinsic-size:auto_32rem] [content-visibility:auto]"),children:m.jsxs("div",{className:"overflow-clip rounded-md border",children:[m.jsxs("div",{"data-file-header":"",className:ye("sticky top-(--file-header-top) z-10 flex h-11 items-center gap-3 bg-muted pr-1 pl-1.5",o?"":"border-b"),children:[m.jsx("button",{type:"button","aria-expanded":!o,"aria-label":`${o?Tde:Cde}: ${e.path}`,"data-user-action-id":"collapse-file-action",className:"flex size-7 shrink-0 items-center justify-center rounded-md text-muted-foreground hover:bg-background hover:text-foreground",onClick:()=>{S(!o)},children:m.jsx(Ux,{"aria-hidden":"true",className:ye("size-4 transition-transform duration-[180ms] ease-out",o?"":"rotate-90")})}),m.jsxs("div",{className:"flex min-w-0 flex-col justify-center",children:[m.jsx("h3",{className:"truncate text-[0.9375rem] leading-5 font-semibold",children:e.title}),m.jsx("p",{className:"truncate font-mono text-xs leading-4 text-muted-foreground",title:e.path,children:e.path})]}),m.jsx("span",{className:"flex-1"}),m.jsx(ff,{segments:e.countLabels.map($=>({text:$,kind:"plain"})),className:"hidden shrink justify-end text-xs text-muted-foreground tabular-nums md:flex"}),e.forgeLink===null?null:m.jsx(Wa,{href:e.forgeLink.href,label:e.forgeLink.label,className:"shrink-0 text-xs"}),C===null?null:m.jsx(xb,{label:e.reviewLabel,isReviewed:e.isReviewed,isDisabled:l,onChange:$=>{C(e.path,$)}}),P]}),m.jsx(t8,{path:e.path,label:e.path,rows:e.rows,rootBlocks:e.rootBlocks,threads:e.threads,previewVisit:t,openWaypointIds:n,currentWaypointId:r,focusedWaypointId:s,isCollapsed:o,isReviewPending:l,commenting:z,codeLinks:p,codeDefinitions:y,onOpenCodeLink:x,onToggleWaypoint:b,onWaypointReviewedChange:E,onRootBlockReviewedChange:O,onWriteUp:L,authoring:D})]})})};function ml({...e}){return m.jsx(Wz,{"data-slot":"dialog",...e})}function Qke({...e}){return m.jsx(yne,{"data-slot":"dialog-trigger",...e})}function Ode({...e}){return m.jsx(Yz,{"data-slot":"dialog-portal",...e})}function Zke({...e}){return m.jsx(wT,{"data-slot":"dialog-close",...e})}function Rde({className:e,...t}){return m.jsx(sne,{"data-slot":"dialog-overlay",className:ye("fixed inset-0 isolate z-50 bg-sign/40 duration-150 data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0",e),...t})}function gl({className:e,children:t,showCloseButton:n=!0,...r}){return m.jsxs(Ode,{children:[m.jsx(Rde,{}),m.jsxs(Kz,{"data-slot":"dialog-content",className:ye("fixed top-1/2 left-1/2 z-50 grid w-full max-w-[calc(100%-2rem)] -translate-x-1/2 -translate-y-1/2 gap-4 rounded-lg border border-foreground bg-popover p-5 text-sm text-popover-foreground duration-150 outline-none sm:max-w-md data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0",e),...r,children:[t,n&&m.jsxs(wT,{"data-slot":"dialog-close",render:m.jsx(st,{variant:"ghost",className:"absolute top-2 right-2",size:"icon-sm"}),children:[m.jsx(Vx,{}),m.jsx("span",{className:"sr-only",children:"Close"})]})]})]})}function yl({className:e,...t}){return m.jsx("div",{"data-slot":"dialog-header",className:ye("flex flex-col gap-2",e),...t})}function xl({className:e,showCloseButton:t=!1,children:n,...r}){return m.jsxs("div",{"data-slot":"dialog-footer",className:ye("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",e),...r,children:[n,t&&m.jsx(wT,{render:m.jsx(st,{variant:"outline"}),children:"Close"})]})}function bl({className:e,...t}){return m.jsx(gne,{"data-slot":"dialog-title",className:ye("font-heading text-lg leading-7 font-bold",e),...t})}function vl({className:e,...t}){return m.jsx(one,{"data-slot":"dialog-description",className:ye("text-sm text-muted-foreground *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground",e),...t})}const n8="grid gap-2 border-t border-border pt-4",r8="text-muted-foreground",Ade="copy-launch-agent-prompt",kde=({option:e,isOpening:t,problem:n,onOpenTerminal:r})=>m.jsxs("section",{"aria-label":e.label,className:n8,children:[m.jsxs(st,{type:"button",className:"justify-self-start",disabled:t,"aria-busy":t,onClick:r,children:[t?m.jsx(hE,{"aria-hidden":"true",className:"motion-safe:animate-spin"}):null,e.label]}),m.jsx("p",{className:r8,children:e.description}),n===null?null:m.jsx("p",{role:"alert",className:"text-destructive",children:n})]}),_de=({option:e,onCopy:t})=>{const n=N.useId();return m.jsxs("section",{"aria-labelledby":n,className:n8,children:[m.jsx("h3",{id:n,className:"font-bold",children:e.label}),m.jsx("p",{className:r8,children:e.description}),m.jsxs("div",{className:"flex items-center gap-2 rounded-sm bg-muted py-1 pr-1 pl-3",children:[m.jsx("pre",{className:"min-w-0 flex-1 overflow-x-auto font-mono text-[0.8125rem] leading-5 select-all",children:m.jsx("code",{children:e.prompt})}),m.jsx(or,{icon:"copy",label:e.copyLabel,actionId:Ade,onClick:()=>{t(e.prompt,e.copiedMessage)}})]})]})},Mde=({content:e,isOpening:t,problem:n,onOpenTerminal:r,onCopy:s,onClose:o})=>m.jsx(ml,{open:!0,onOpenChange:l=>{l||o()},children:m.jsxs(gl,{className:"sm:max-w-lg",children:[m.jsxs(yl,{children:[m.jsx(bl,{children:e.title}),m.jsx(vl,{children:e.description})]}),e.terminal===null?null:m.jsx(kde,{option:e.terminal,isOpening:t,problem:n,onOpenTerminal:r}),m.jsx(_de,{option:e.manual,onCopy:s}),m.jsx(xl,{children:m.jsx(st,{type:"button",variant:"ghost",onClick:o,children:e.closeLabel})})]})}),Ide=({order:e,sections:t})=>m.jsx(m.Fragment,{children:e.map(n=>m.jsx(N.Fragment,{children:t[n]},n))}),s8=N.createContext(void 0);function Ru(e){const t=N.useContext(s8);if(t===void 0&&!e)throw new Error(Wt(47));return t}const Lde={...Rm,disabled:e=>e.disabled,instantType:e=>e.instantType,openMethod:e=>e.openMethod,openChangeReason:e=>e.openChangeReason,modal:e=>e.modal,focusManagerModal:e=>e.focusManagerModal,stickIfOpen:e=>e.stickIfOpen,titleElementId:e=>e.titleElementId,descriptionElementId:e=>e.descriptionElementId,openOnHover:e=>e.openOnHover,closeDelay:e=>e.closeDelay,adaptiveOrigin:e=>e.adaptiveOrigin};class Dde extends Cu{constructor(n,r,s){const o=new _f;super(jde(n,o,r,s),Pde(o),Lde);Ot(this,"setOpen",(n,r)=>{var p,y;const s=r.reason===wn,o=r.reason===di&&r.event.detail===0,l=!n&&(r.reason===mm||r.reason==null),c=iT(r),u=this.select("activeTriggerId");if(!n&&r.reason===m5&&r.trigger==null&&u!=null&&(r.trigger=this.context.triggerElements.getById(u)??this.select("activeTriggerElement")??void 0),(y=(p=this.context).onOpenChange)==null||y.call(p,n,r),r.isCanceled)return;this.state.floatingRootContext.dispatchOpenChange(n,r);const f=()=>{const x=ob(this.state,n,r.trigger,c());x.openChangeReason=r.reason,this.update(x)};s?(this.set("stickIfOpen",!0),this.context.stickIfOpenTimeout.start(F5,()=>{this.set("stickIfOpen",!1)}),Us.flushSync(f)):f();let h;o?h="click":l?h="dismiss":r.reason===ou&&(h="focus"),this.set("instantType",h)})}}function jde(e,t,n,r=!1){const s={...Om(t,n,r),disabled:!1,modal:!1,focusManagerModal:!1,instantType:void 0,openMethod:null,openChangeReason:null,titleElementId:void 0,descriptionElementId:void 0,stickIfOpen:!0,openOnHover:!1,closeDelay:0,adaptiveOrigin:void 0,...e};return s.open&&(e==null?void 0:e.mounted)===void 0&&(s.mounted=!0),s}function Pde(e){return{popupRef:N.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerFocusTargetRef:N.createRef(),beforeContentFocusGuardRef:N.createRef(),stickIfOpenTimeout:new co,triggerElements:e}}const KI=kf(function({props:t}){const{children:n,open:r,defaultOpen:s=!1,onOpenChange:o,onOpenChangeComplete:l,modal:c=!1,handle:u,triggerId:f,defaultTriggerId:h=null}=t,p=zde(u,{modal:c,open:s,openProp:r,activeTriggerId:h,triggerIdProp:f});p.useControlledProp("openProp",r),p.useControlledProp("triggerIdProp",f);const y=p.useState("open"),x=p.useState("mounted"),b=p.useState("payload");p.useContextCallback("onOpenChange",o),p.useContextCallback("onOpenChangeComplete",l),uz(p,y),Cm(p);const{forceUnmount:S}=Tm(y,p,()=>{p.update({stickIfOpen:!0,openChangeReason:null})});p.useSyncedValues({modal:c}),N.useEffect(()=>{y||p.context.stickIfOpenTimeout.clear()},[p,y]),N.useImperativeHandle(t.actionsRef,()=>({unmount:S,close:()=>p.setOpen(!1,ct(iu))}),[S,p]);const E=y||x;return m.jsxs(s8.Provider,{value:p,children:[u&&m.jsx(wm,{handle:u,store:p}),E&&m.jsx(Bde,{store:p,modal:c}),typeof n=="function"?n({payload:b}):n]})});function HT(e){return Ru(!0)?m.jsx(KI,{props:e}):m.jsx(tb,{children:m.jsx(KI,{props:e})})}function zde(e,t){const n=sb((r,s)=>new Dde(t,r,s));return N.useEffect(()=>n.context.stickIfOpenTimeout.disposeEffect(),[n]),n}function Bde({store:e,modal:t}){const n=e.useState("floatingRootContext"),r=bm(n,{outsidePressEvent:{mouse:t==="trap-focus"?"sloppy":"intentional",touch:"sloppy"}}),s=r.reference,o=r.floating;return Nm(e,{activeTriggerProps:s,inactiveTriggerProps:s,popupProps:o}),null}const Hde=300,Sb=vm(function(t,n){const{render:r,className:s,style:o,disabled:l=!1,nativeButton:c=!0,handle:u,payload:f,openOnHover:h=!1,delay:p=Hde,closeDelay:y=0,id:x,...b}=t,S=Ru(!0),C=Am(u)??S;if(!C)throw new Error(Wt(74));const O=ls(x),T=C.useState("isTriggerActive",O),R=C.useState("floatingRootContext"),k=C.useState("isOpenedByTrigger",O),M=C.useState("triggerPopupId",O),A=N.useRef(null),{registerTrigger:I,isMountedByThisTrigger:L}=Em(O,A,C,{payload:f,disabled:l,openOnHover:h,closeDelay:y}),D=C.useState("openChangeReason"),P=C.useState("stickIfOpen"),z=C.useState("openMethod"),$=C.useState("focusManagerModal"),j=km(R,{enabled:!l&&h&&(z!=="touch"||D!==di),mouseOnly:!0,move:!1,handleClose:_m(),restMs:p,delay:{close:y},triggerElementRef:A,isActiveTrigger:T,isClosing:()=>C.select("transitionStatus")==="ending"}),H=nb(R,{stickIfOpen:P}),B=xT(()=>C.select("open"),Z=>{C.set("openMethod",Z)}),V=C.useState("triggerProps",L),{getButtonProps:G,buttonRef:q}=Su({disabled:l,native:c}),K={open(Z){return Z&&D===di?mE.open(Z):fm.open(Z)}},{preFocusGuardRef:W,handlePreFocusGuardFocus:ee,handleFocusTargetFocus:ce}=Tz(C,A),X=Lt("button",t,{state:{disabled:l,open:k},ref:[q,n,I,A],props:[H.reference,j,V,B,{[J2]:"",id:O,"aria-haspopup":"dialog","aria-expanded":k,"aria-controls":M},b,G],stateAttributesMapping:K}),te=m.jsx(N.Fragment,{children:X},O);return L&&!$?m.jsxs(N.Fragment,{children:[m.jsx(Ua,{ref:W,onFocus:ee}),te,m.jsx(Ua,{ref:C.context.triggerFocusTargetRef,onFocus:ce})]}):te}),o8=N.createContext(void 0);function Fde(){const e=N.useContext(o8);if(e===void 0)throw new Error(Wt(45));return e}const FT=N.forwardRef(function(t,n){const{keepMounted:r=!1,...s}=t;return Ru().useState("mounted")||r?m.jsx(o8.Provider,{value:r,children:m.jsx(eT,{ref:n,...s})}):null}),i8=N.createContext(void 0);function l8(){const e=N.useContext(i8);if(!e)throw new Error(Wt(46));return e}const $T=N.forwardRef(function(t,n){const{render:r,className:s,style:o,anchor:l,positionMethod:c,side:u,align:f,sideOffset:h,alignOffset:p,collisionBoundary:y="clipping-ancestors",collisionPadding:x,arrowPadding:b,sticky:S,disableAnchorTracking:E=!1,collisionAvoidance:C=Jx,...O}=t,T=Ru(),R=Fde(),k=xm(),M=T.useState("floatingRootContext"),A=T.useState("mounted"),I=T.useState("open"),L=T.useState("openChangeReason"),D=T.useState("activeTriggerElement"),P=T.useState("modal"),z=T.useState("openMethod"),$=T.useState("positionerElement"),j=T.useState("instantType"),H=T.useState("transitionStatus"),B=T.useState("adaptiveOrigin"),V=N.useRef(null),G=gm($),q=cb({anchor:l,floatingRootContext:M,positionMethod:c,mounted:A,side:u,sideOffset:h,align:f,alignOffset:p,arrowPadding:b,collisionBoundary:y,collisionPadding:x,sticky:S,disableAnchorTracking:E,keepMounted:R,nodeId:k,collisionAvoidance:C,adaptiveOrigin:B}),K=M.useState("domReferenceElement");Be(()=>{const X=K,te=V.current;if(X&&(V.current=X),te&&X&&X!==te){T.set("instantType",void 0);const Z=new AbortController;return G(()=>{T.set("instantType","trigger-change")},Z.signal),()=>{Z.abort()}}},[K,G,T]);const W=P===!0&&L!==wn;bz(I&&W,z==="touch",$,D);const ee=T.useStateSetter("positionerElement"),ce={open:I,side:q.side,align:q.align,anchorHidden:q.anchorHidden,instant:j},F=ub(t,ce,{styles:q.positionerStyles,transitionStatus:H,props:O,refs:[n,ee],hidden:!A,inert:!I});return m.jsxs(i8.Provider,{value:q,children:[A&&W&&m.jsx(mT,{inert:hT(!I),cutout:D}),m.jsx(eb,{id:k,children:F})]})}),$de=N.createContext(void 0);function Ude(){const[e,t]=N.useState(0),n=Ve(()=>(t(s=>s+1),()=>{t(s=>Math.max(0,s-1))}));return{context:N.useMemo(()=>({register:n}),[n]),hasClosePart:e>0}}const UT=N.forwardRef(function(t,n){const{render:r,className:s,style:o,initialFocus:l,finalFocus:c,...u}=t,f=Ru(),h=l8(),p=hz()!=null,{context:y,hasClosePart:x}=Ude(),b=f.useState("open"),S=f.useState("openMethod"),E=f.useState("instantType"),C=f.useState("transitionStatus"),O=f.useState("popupProps"),T=f.useState("titleElementId"),R=f.useState("descriptionElementId"),k=f.useState("modal"),M=f.useState("mounted"),A=f.useState("openChangeReason"),I=f.useState("activeTriggerElement"),L=f.useState("floatingRootContext"),D=L.useState("floatingId"),P=f.useState("disabled"),z=f.useState("openOnHover"),$=f.useState("closeDelay");Ya({open:b,ref:f.context.popupRef,onComplete(){var q,K;b&&((K=(q=f.context).onOpenChangeComplete)==null||K.call(q,!0))}}),ib(L,{enabled:z&&!P,closeDelay:$});const j=l===void 0?lz(f.context.popupRef):l,H=k!==!1&&x;f.useSyncedValue("focusManagerModal",H);const B=f.useStateSetter("popupElement"),V={open:b,side:h.side,align:h.align,instant:E,transitionStatus:C},G=Lt("div",t,{state:V,ref:[n,f.context.popupRef,B],props:[O,{id:D,role:"dialog",...Sm,"aria-labelledby":T,"aria-describedby":R,onKeyDown(q){p&&ab.has(q.key)&&q.stopPropagation()}},Mm(C),u],stateAttributesMapping:hm});return m.jsx(rT,{context:L,openInteractionType:S,modal:H,disabled:!M||A===wn,initialFocus:j,returnFocus:c,restoreFocus:"popup",previousFocusableElement:Yt(I)?I:void 0,nextFocusableElement:f.context.triggerFocusTargetRef,beforeContentFocusGuardRef:f.context.beforeContentFocusGuardRef,children:m.jsx($de.Provider,{value:y,children:G})})}),Vde=N.forwardRef(function(t,n){const{render:r,className:s,style:o,...l}=t,u=Ru().useState("open"),{arrowRef:f,side:h,align:p,arrowUncentered:y,arrowStyles:x}=l8();return Lt("div",t,{state:{open:u,side:h,align:p,uncentered:y},ref:[n,f],props:[{style:x,"aria-hidden":!0},l],stateAttributesMapping:Af})}),VT=N.forwardRef(function(t,n){const{render:r,className:s,style:o,...l}=t,c=Ru(),u=ls(l.id);return c.useSyncedValueWithCleanup("titleElementId",u),Lt("h2",t,{ref:n,props:[{id:u},l]})}),hf="inline-flex h-7 shrink-0 items-center gap-1.5 rounded-md border border-sign-foreground/35 px-2.5 text-[0.8rem] text-sign-foreground hover:bg-sign-foreground/10 aria-expanded:bg-sign-foreground/15 aria-pressed:bg-sign-foreground aria-pressed:text-sign disabled:opacity-50",qde="border-primary bg-primary font-bold text-primary-foreground hover:bg-primary/85 aria-expanded:bg-primary/85",a8="z-50 flex w-96 origin-(--transform-origin) flex-col gap-3 rounded-lg border border-foreground bg-popover p-4 text-sm text-popover-foreground outline-none duration-150 data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0",Gde="max-h-[min(44rem,calc(100vh-5rem))] w-[34rem] overflow-y-auto",Kde="shrink-0 text-xs text-muted-foreground underline decoration-1 underline-offset-[0.3em] hover:text-foreground disabled:opacity-50",qT=({trigger:e,children:t,className:n,onOpen:r})=>m.jsxs(HT,{onOpenChange:s=>{s&&(r==null||r())},children:[e,m.jsx(FT,{children:m.jsx($T,{align:"end",sideOffset:10,className:"isolate z-50",children:m.jsx(UT,{className:ye(a8,n),children:t})})})]}),Yde=({label:e,isPressed:t,onClick:n})=>m.jsxs("button",{type:"button","aria-pressed":t,"data-user-action-id":"chat-action",className:hf,onClick:n,children:[m.jsx(qX,{"aria-hidden":"true",className:"size-3.5"}),m.jsx("span",{className:"text-box-cap",children:e})]}),Wde=({label:e,isPending:t,onClick:n})=>m.jsxs("button",{type:"button",disabled:t,"data-user-action-id":"complete-review-action",className:hf,onClick:n,children:[m.jsx(LX,{"aria-hidden":"true",className:"size-3.5"}),m.jsx("span",{className:"text-box-cap",children:e})]}),Xde=({label:e,onClick:t})=>m.jsxs("button",{type:"button","data-user-action-id":"unassigned-files-action",className:ye(hf,"font-bold text-signal"),onClick:t,children:[m.jsx(XX,{"aria-hidden":"true",className:"size-3.5"}),m.jsx("span",{className:"text-box-cap",children:e})]}),Qde=({draft:e,isSubmitting:t,isDiscarding:n,errorMessage:r,submissionCount:s,renderEditor:o,onSubmit:l,onDiscard:c})=>{const u=N.useId(),[f,h]=N.useState(""),[p,y]=N.useState(null),x=e.verdicts.map(S=>S.key),b=x.find(S=>S===p)??x.at(0)??null;return!e.isAvailable||b===null?m.jsx("button",{type:"button",disabled:!0,title:e.unavailableReason??void 0,className:hf,children:m.jsx("span",{className:"text-box-cap",children:e.buttonLabel})}):m.jsx(qT,{className:Gde,trigger:m.jsxs(Sb,{"data-user-action-id":"submit-review-action",className:ye(hf,qde),children:[m.jsx("span",{className:"text-box-cap",children:e.buttonLabel}),m.jsx(su,{"aria-hidden":"true",className:"size-3.5"})]}),children:m.jsxs("form",{className:"flex flex-col gap-3",onSubmit:S=>{S.preventDefault(),l(b,f.trim())},children:[m.jsx(VT,{className:"text-base leading-6 font-bold",children:e.heading}),m.jsx("div",{children:o({label:e.bodyPlaceholder,shouldFocus:!1,onChange:h})},s),m.jsx("fieldset",{className:"flex flex-col gap-2",children:e.verdicts.map(S=>m.jsxs("label",{className:"grid cursor-pointer grid-cols-[1.25rem_minmax(0,1fr)] gap-x-2",children:[m.jsx("input",{type:"radio",name:u,checked:b===S.key,className:"mt-1 size-3.5 accent-(--primary)",onChange:()=>{y(S.key)}}),m.jsx("span",{className:"font-bold",children:S.label}),m.jsx("span",{className:"col-start-2 text-muted-foreground",children:S.description})]},S.key))}),m.jsx("p",{className:"text-muted-foreground tabular-nums",children:e.pendingLabel}),e.pendingComments.length===0?null:m.jsx("ul",{className:"flex flex-col",children:e.pendingComments.map(S=>m.jsxs("li",{className:"flex items-start justify-between gap-3 border-t py-2 first:border-t-0 first:pt-0",children:[m.jsxs("div",{className:"flex min-w-0 flex-col gap-0.5",children:[m.jsx("span",{className:"font-mono text-xs text-muted-foreground wrap-anywhere",children:S.locationLabel}),m.jsx("span",{className:"truncate",children:S.excerpt}),S.staleLabel===null?null:m.jsx("span",{className:"text-destructive",children:S.staleLabel})]}),m.jsx("button",{type:"button","aria-label":`${S.discardLabel}: ${S.locationLabel}`,disabled:n,className:Kde,onClick:()=>{c(S.id)},children:S.discardLabel})]},S.id))}),r===null?null:m.jsx("p",{role:"alert",className:"text-destructive",children:r}),m.jsx(st,{type:"submit",disabled:t,className:"self-end",children:e.submitLabel})]})})},YI="size-3.5 motion-safe:animate-spin",Zde=({sharing:e,publishingKey:t,onPublish:n})=>{const r=o=>o.isPending||o.key===t,s=e.options.some(r);return m.jsx(qT,{trigger:m.jsxs(Sb,{"aria-busy":s,"data-user-action-id":"share-action",className:hf,children:[m.jsx("span",{className:"text-box-cap",children:e.buttonLabel}),s?m.jsx(hE,{"aria-hidden":"true",className:YI}):m.jsx(su,{"aria-hidden":"true",className:"size-3.5"})]}),children:m.jsx("ul",{className:"flex flex-col",children:e.options.map(o=>m.jsxs("li",{className:"flex flex-col gap-1.5 border-t py-3 first:border-t-0 first:pt-0 last:pb-0",children:[m.jsxs("div",{className:"flex items-start justify-between gap-3",children:[m.jsx("p",{className:"font-bold",children:o.label}),m.jsxs(st,{variant:"outline",size:"sm","aria-busy":r(o),disabled:!o.isAvailable||s,onClick:()=>{n(o.key)},children:[r(o)?m.jsx(hE,{"aria-hidden":"true",className:YI}):null,r(o)?o.pendingLabel:o.actionLabel]})]}),m.jsx("p",{className:"text-muted-foreground",children:o.description}),o.statusLabel===null||o.link===null?null:m.jsxs("p",{className:"flex flex-wrap items-center gap-x-3 tabular-nums",children:[o.statusLabel,m.jsx(Wa,{href:o.link.href,label:o.link.label})]})]},o.key))})})},Jde="Okay, got it!",WI="Close this tip",efe="Keep showing tips?",tfe="Tips point out features you have not tried yet. You can stop them for good.",nfe="Keep tips",rfe="Stop tips",XI="↵",sfe="Enter",ofe="Escape",ife=12,lfe=16,afe="button, a[href], summary, [role='button'], [role='menu'], [role='menuitem'], [role='menubar'], [role='listbox'], [role='option']",cfe="relative w-[22rem] max-w-[calc(100vw-2rem)] rounded-md bg-sign px-4 pt-[1.125rem] pb-3.5 text-sign-foreground outline-none dark:ring-1 dark:ring-sign-foreground/20 duration-[180ms] data-open:animate-in data-open:fade-in-0 motion-reduce:animate-none",ufe="absolute inset-x-0 top-0 h-1 rounded-t-md bg-(--line,var(--primary-text))",dfe="size-2.5 rotate-45 rounded-[2px] bg-sign data-[side=bottom]:-top-1 data-[side=left]:-right-1 data-[side=right]:-left-1 data-[side=top]:-bottom-1",ffe="absolute top-3.5 right-2.5 grid size-6 cursor-pointer place-items-center rounded-[0.3rem] text-sign-muted transition-colors duration-[180ms] ease-out hover:bg-sign-foreground/10 hover:text-sign-foreground focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-ring",QI="inline-flex h-7 cursor-pointer items-center gap-1.5 rounded-[0.3rem] bg-primary px-2.5 text-[0.8rem] font-bold text-primary-foreground transition-colors duration-[180ms] ease-out hover:bg-[color-mix(in_oklab,var(--primary)_88%,var(--primary-foreground))] focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-ring",hfe="inline-flex h-7 cursor-pointer items-center rounded-[0.3rem] px-2.5 text-[0.8rem] text-sign-muted transition-colors duration-[180ms] ease-out hover:bg-sign-foreground/10 hover:text-sign-foreground focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-ring",ZE=({label:e})=>m.jsx(oB,{"aria-hidden":"true",className:"mx-0.5 align-[0.05rem]",children:e}),ZI=e=>typeof e=="string"?`text:${e}`:`keycap:${e.keycap}`,H0=({parts:e})=>m.jsx(m.Fragment,{children:e.map(t=>typeof t=="string"?m.jsx("span",{children:t},ZI(t)):m.jsxs("span",{children:[m.jsx("span",{className:"sr-only",children:t.keycap}),m.jsx(ZE,{label:t.keycap})]},ZI(t)))}),pfe=e=>NB(e)&&!e.ctrlKey&&!e.shiftKey&&!(e.target instanceof Element&&e.target.closest(afe)!==null),mfe=e=>zr.getState().shownTooltipIds.at(-1)===e,gfe=(e,t)=>{const n=[...document.querySelectorAll(e)],r=vB();if(t!==null&&n.includes(t)&&bB(zE(t),r))return t;const s=dre(n.map(zE),r);return s===null?null:n[s]},yfe=(e,t)=>{const[n,r]=N.useState(null);return SB(t,()=>{r(s=>gfe(e,s))},e),t?n:null},xfe=(e,t)=>{N.useEffect(()=>{if(t)return zr.getState().showTooltip(e),()=>{zr.getState().hideTooltip(e)}},[e,t])},bfe=(e,t)=>{const n=N.useEffectEvent(t);N.useEffect(()=>{if(!e)return;const r=s=>{n(s)};return window.addEventListener("keydown",r,!0),()=>{window.removeEventListener("keydown",r,!0)}},[e])},na=({id:e,title:t=null,content:n,anchorSelector:r,side:s="top",delay:o=gB,triggers:l})=>{const{showTooltip:c}=cre(e,{delay:o,triggers:l}),[u,f]=N.useState("tip"),h=yfe(r,c),p=c&&h!==null,y=()=>{zr.getState().deferTooltip(e,u==="prompt"?"close-button":"got-it")},x=()=>{zr.getState().deferTooltip(e,"close-button"),zr.getState().turnTipsOff()};xfe(e,p),bfe(p,S=>{!mfe(e)||!pfe(S)||(S.key===sfe&&(S.preventDefault(),y()),S.key===ofe&&(S.preventDefault(),u==="tip"?f("prompt"):y()))});const b=u==="tip"?t:efe;return m.jsx(HT,{open:p,modal:!1,children:m.jsx(FT,{children:m.jsx($T,{anchor:h,side:s,sideOffset:ife,collisionPadding:lfe,className:"isolate z-50 data-[anchor-hidden]:hidden",children:m.jsxs(UT,{initialFocus:!1,finalFocus:!1,"aria-live":"polite","aria-label":b??void 0,"data-guide-tooltip":e,"data-navigator-scope":"",className:cfe,children:[m.jsx("span",{"aria-hidden":"true",className:ufe}),u==="tip"?m.jsx("button",{type:"button","aria-label":WI,title:WI,"data-user-action-id":"guide-tooltip-close-action",className:ffe,onClick:()=>{f("prompt")},children:m.jsx(Vx,{"aria-hidden":"true",className:"size-3.5"})}):null,b===null?null:m.jsx("p",{className:"pr-7 text-base leading-6 font-bold",children:b}),m.jsx("div",{className:ye("text-sm leading-[1.375rem] text-sign-foreground/88",b!==null&&"mt-1"),children:u==="tip"?n:tfe}),m.jsx("div",{className:"mt-3.5 flex items-center justify-end gap-2",children:u==="tip"?m.jsxs("button",{type:"button","data-user-action-id":"guide-tooltip-got-it-action",className:QI,onClick:y,children:[Jde,m.jsx(ZE,{label:XI})]}):m.jsxs(m.Fragment,{children:[m.jsx("button",{type:"button","data-user-action-id":"guide-tips-stop-action",className:hfe,onClick:x,children:rfe}),m.jsxs("button",{type:"button","data-user-action-id":"guide-tips-keep-action",className:QI,onClick:y,children:[nfe,m.jsx(ZE,{label:XI})]})]})}),m.jsx(Vde,{className:dfe})]})})})})},vfe="the agent",JI=["next-waypoint-action","previous-waypoint-action"],Sfe=5,wfe="[role='toolbar']",_c=e=>`[data-user-action-id="${e}"]`,nw=e=>`${wfe} ${_c(e)}`,Efe=({reviewMode:e})=>{ure(e);const t=N.use(hb),n=N.use(vb),r=(n==null?void 0:n.label)??vfe,s=t!==null&&NT(t.groups,If)!==null;return m.jsxs(m.Fragment,{children:[m.jsx(na,{id:"jump-to-action-tooltip",title:"Jump to any section",content:m.jsx(H0,{parts:["Press ",{keycap:"W"}," to see every section of this review and go straight to one."]}),anchorSelector:_c("jump-to-action"),triggers:{viewVisible:["context-section"],preFeatureUse:["jump-to-action"]}}),m.jsx(na,{id:"change-overview-card-tooltip",title:"Each card is a changed code block",content:"Hover a card to see its code. Press it to read that code in the Code Walkthrough.",anchorSelector:_c("change-overview-card-action"),triggers:{viewVisible:["change-overview-section"],preFeatureUse:{actionIds:["change-overview-card-action"],use:"click-or-hover"},dayBound:1}}),m.jsx(na,{id:"trace-diagram-card-tooltip",title:"Open a card to read its code",content:"Press a card to see its code beside the diagram, with what it does in this change.",anchorSelector:`${_c("trace-diagram-card-action")}[data-change]`,triggers:{viewVisible:["trace-diagram-section"],preFeatureUse:["trace-diagram-card-action"]}}),m.jsx(na,{id:"blast-diagram-card-tooltip",title:"See how a file is affected",content:"Press a file to see what the change does to it and why.",anchorSelector:`${_c("blast-diagram-card-action")}[data-mark="added"], ${_c("blast-diagram-card-action")}[data-mark="modified"]`,triggers:{viewVisible:["blast-diagram-section"],preFeatureUse:["blast-diagram-card-action"],postFeatureUse:["trace-diagram-card-action"]}}),m.jsx(na,{id:"code-view-rail-tooltip",title:"Marks show the lines to read",content:"Hover a mark beside the code to preview its waypoint. Press the mark to open it.",anchorSelector:_c("waypoint-mark-action"),side:"right",triggers:{viewVisible:["code-walkthrough-section"],preFeatureUse:{actionIds:["waypoint-mark-action"],use:"click-or-hover"}}}),m.jsx(na,{id:"generate-agent-writing",title:`Let ${r} explain this line`,content:m.jsx(H0,{parts:["This waypoint has no explanation yet. Press ",{keycap:"G"},` and ${r} writes one for you.`]}),anchorSelector:nw(Jy),triggers:{viewVisible:["waypoint-card-section","waypoint-box-section"],preFeatureUse:[Jy,PT],dependsOnValues:{isWaypointMissingDescription:s}}}),m.jsx(na,{id:"next-waypoint-tooltip",title:"Step through the waypoints",content:m.jsx(H0,{parts:["Press ",{keycap:"D"}," for the next waypoint and ",{keycap:"A"}," for the one before."]}),anchorSelector:nw("next-waypoint-action"),triggers:{viewVisible:["code-walkthrough-section"],preFeatureUse:JI,postFeatureUse:{actionIds:["waypoint-mark-action"],use:"click-or-hover"}}}),m.jsx(na,{id:"filter-waypoint-tooltip",title:"Filter the waypoints",content:m.jsx(H0,{parts:["Press ",{keycap:"F"}," to show only the waypoints with a finding, a Core change or your Spotlight."]}),anchorSelector:nw("filter-action"),triggers:{viewVisible:["code-walkthrough-section"],tooltipDependent:["next-waypoint-tooltip"],preFeatureUse:["filter-action"],postFeatureUse:{actionIds:JI,times:Sfe}}})]})},Cfe="data-valid",Tfe="data-invalid",Nfe={badInput:!1,customError:!1,patternMismatch:!1,rangeOverflow:!1,rangeUnderflow:!1,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valid:null,valueMissing:!1},Ofe={valid:null,touched:!1,dirty:!1,filled:!1,focused:!1},Rfe={disabled:!1,...Ofe},Afe={valid(e){return e===null?null:e?{[Cfe]:""}:{[Tfe]:""}}},kfe={invalid:void 0,name:void 0,validityData:{state:Nfe,errors:[],error:"",value:"",initialValue:null},setValidityData:Fn,disabled:void 0,setTouched:Fn,setDirty:Fn,setFilled:Fn,setFocused:Fn,validationMode:"onSubmit",shouldValidateOnChange:()=>!1,state:Rfe,registerFieldControl:Fn,validation:{getValidationProps:(e,t=hn)=>t,inputRef:{current:null},registeredInputs:new Map,registerInput:Fn,getInputControl:()=>null,commit:async()=>{},change:Fn}},_fe=N.createContext(kfe);function c8(e=!0){const t=N.useContext(_fe);if(t.setValidityData===Fn&&!e)throw new Error(Wt(28));return t}const Mfe=N.createContext({elementRef:{current:null},formRef:{current:{fields:new Map}},errors:{},clearErrors:Fn,validationMode:"onSubmit",submitCountRef:{current:0}});function Ife(){return N.useContext(Mfe)}const Lfe=N.createContext({controlId:void 0,registerControlId:Fn,resetControlId:Fn,labelId:void 0,setLabelId:Fn,messageIds:[],setMessageIds:Fn,getDescriptionProps:e=>e});function u8(){return N.useContext(Lfe)}function Dfe(e={}){const{id:t,enabled:n=!0}=e,{controlId:r,registerControlId:s,resetControlId:o}=u8(),l=ls(),c=Rr(()=>Symbol()),u=N.useRef(!1),f=N.useRef(!1),h=Ve(()=>{!u.current||s===Fn||(u.current=!1,s(c.current,void 0))});return Be(()=>{if(!n||s===Fn){h();return}let p;if(t!==void 0)f.current=!0,p=t;else if(f.current)p=l;else{o();return}if(p===void 0){h();return}u.current=!0,s(c.current,p)},[t,n,s,o,l,c,h]),Be(()=>h,[h]),(n?r:void 0)??t??l}function jfe(e,t,n,r,s=!0,o){const{registerFieldControl:l}=c8(),c=Rr(()=>Symbol());Be(()=>{const u=c.current;if(!s){l(u,void 0);return}l(u,{controlRef:e,getValue:r,id:t,name:o,value:n})},[e,s,r,t,o,l,c,n]),Be(()=>{const u=c.current;return()=>{l(u,void 0)}},[l,c])}const Pfe=N.forwardRef(function(t,n){const{render:r,className:s,id:o,name:l,value:c,disabled:u=!1,onValueChange:f,defaultValue:h,autoFocus:p=!1,style:y,...x}=t,{state:b,name:S,disabled:E,setTouched:C,setDirty:O,validityData:T,setFocused:R,setFilled:k,validationMode:M,validation:A}=c8(),{clearErrors:I,elementRef:L,submitCountRef:D}=Ife(),P=E||u,z=S??l,$={...b,disabled:P},{labelId:j}=u8(),H=Dfe({id:o}),[B]=B2({controlled:c,default:h,name:"FieldControl",state:"value"}),V=c!==void 0,G=V?B:void 0,q=G==null?void 0:String(G),K=Ve(()=>{var F;return(F=A.inputRef.current)==null?void 0:F.value});jfe(A.inputRef,H,q,K,!P,l),Be(()=>{var X;const F=q??((X=A.inputRef.current)==null?void 0:X.value);F!==void 0&&k(F!=="")},[q,A.inputRef,k]),Sz(q,()=>{q!==void 0&&(I(z),O(q!==(T.initialValue??"")),A.change(q))});const W=N.useRef(null),ee=ns();return Be(()=>{p&&W.current===es(jt(W.current))&&R(!0)},[p,R]),Lt("input",t,{ref:[n,W],state:$,props:[{id:H,disabled:P,name:z,ref:A.inputRef,"aria-labelledby":j,autoFocus:p,...V?{value:G}:{defaultValue:h},onChange(F){const X=F.currentTarget.value,te=ct(pm,F.nativeEvent);f==null||f(X,te),!V&&(O(X!==(T.initialValue??"")),k(X!==""),!F.nativeEvent.defaultPrevented&&!te.isCanceled&&(I(z),A.change(X)))},onFocus(){R(!0)},onBlur(F){if(C(!0),R(!1),M==="onBlur"){const X=F.currentTarget.value;A.commit(X),V&&queueMicrotask(()=>{var Z;const te=(Z=A.inputRef.current)==null?void 0:Z.value;te!==void 0&&te!==X&&te!==(T.initialValue??"")&&A.commit(te)})}},onKeyDown(F){if(F.currentTarget.tagName==="INPUT"&&F.key==="Enter"){C(!0);const X=F.currentTarget.value,te=F.currentTarget.form;if(te&&te===L.current&&!F.defaultPrevented){const Z=F.currentTarget,Y=D.current;ee.start(0,()=>{D.current===Y&&A.commit(Z.value)})}else A.commit(X)}}},x,F=>A.getValidationProps(P,F)],stateAttributesMapping:Afe})}),zfe=N.forwardRef(function(t,n){return m.jsx(Pfe,{ref:n,...t})});function zm({className:e,type:t,...n}){return m.jsx(zfe,{type:t,"data-slot":"input",className:ye("h-8 w-full min-w-0 rounded-lg border border-input bg-card px-2.5 py-1 text-base transition-colors outline-none placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/40 disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 md:text-sm",e),...n})}const F0="transition-[fill,stroke,stroke-dasharray,stroke-width,opacity] duration-[180ms] ease-out",Bh="[stroke-dasharray:44_0] [stroke-width:3]",Bfe="[stroke-dasharray:4_3.33] [stroke-width:3]",Hfe="[stroke-dasharray:44_0] [stroke-width:1.5]",Ffe={"no-review":ye("fill-background stroke-muted-foreground",Bh),"awaiting-review":ye("fill-background stroke-signal",Bh),"awaiting-reply":ye("fill-background stroke-signal",Bh),stale:ye("fill-background stroke-muted-foreground",Bfe),draft:ye("fill-background stroke-muted-foreground",Hfe),closed:ye("fill-muted-foreground stroke-muted-foreground",Bh),merged:ye("fill-(--line) stroke-(--line)",Bh)},GT="opacity-100",sr="opacity-0",$fe={"no-review":sr,"awaiting-review":GT,"awaiting-reply":sr,stale:sr,draft:sr,closed:sr,merged:sr},Ufe={"no-review":sr,"awaiting-review":sr,"awaiting-reply":GT,stale:sr,draft:sr,closed:sr,merged:sr},Vfe={"no-review":sr,"awaiting-review":sr,"awaiting-reply":sr,stale:sr,draft:sr,closed:GT,merged:sr},qfe="stroke-signal",eL="font-bold text-signal-text",$0="text-muted-foreground",Jke={"no-review":"text-foreground","awaiting-review":eL,"awaiting-reply":eL,stale:$0,draft:$0,closed:$0,merged:$0},dp=({status:e,tone:t="status",className:n})=>m.jsxs("svg",{"aria-hidden":"true",viewBox:"0 0 20 20","data-status":e,className:ye("size-5 shrink-0",n),children:[m.jsx("circle",{cx:"10",cy:"10",r:"7",className:ye(F0,Ffe[e],t==="signal"?qfe:"")}),m.jsx("path",{d:"M10 4.5a5.5 5.5 0 0 1 0 11z",className:ye("fill-signal",F0,$fe[e])}),m.jsx("circle",{cx:"10",cy:"10",r:"2.75",className:ye("fill-signal",F0,Ufe[e])}),m.jsx("rect",{x:"5",y:"8.5",width:"10",height:"3",rx:"1",className:ye("fill-background",F0,Vfe[e])})]}),Gfe="flex max-w-full min-w-0 items-center gap-1.5 rounded-md px-1.5 py-0.5 hover:bg-sign-foreground/10 focus-visible:outline-2 focus-visible:outline-sign-foreground data-popup-open:bg-sign-foreground/10",Kfe="flex w-full items-start gap-2.5 rounded-md px-2 py-1.5 text-left outline-none hover:bg-muted focus-visible:bg-muted aria-[current=page]:bg-muted",Yfe=({target:e,isCurrent:t,onSwitch:n})=>m.jsx("li",{children:m.jsxs("button",{type:"button","aria-current":t?"page":void 0,className:Kfe,onClick:()=>{n(e.id)},children:[m.jsx(dp,{status:e.branchStatus,className:"mt-1 size-3.5"}),m.jsxs("span",{className:"flex min-w-0 flex-1 flex-col",children:[m.jsx(ff,{segments:[e.title],className:"font-bold"}),m.jsxs("span",{className:"flex min-w-0 flex-wrap items-center gap-x-1.5 gap-y-0.5 text-xs text-muted-foreground",children:[e.author===null?null:m.jsxs(m.Fragment,{children:[m.jsx(zf,{imageUrl:e.author.avatarUrl,monogram:e.author.monogram,className:"size-4"}),m.jsx("span",{className:"shrink-0",children:e.author.name})]}),m.jsx(ff,{segments:e.details})]})]}),m.jsx("span",{className:"sr-only",children:e.statusLabel}),t?m.jsx(wu,{"aria-hidden":"true",className:"mt-0.5 size-4 shrink-0"}):null]})}),Wfe=({switching:e,onSwitch:t})=>{const{switcher:n}=e;return n===null?m.jsx("p",{className:"text-muted-foreground",children:e.placeholder}):m.jsxs(m.Fragment,{children:[m.jsx(VT,{className:"text-base leading-6 font-bold",children:n.heading}),m.jsx(zm,{type:"search",value:e.query,placeholder:n.searchPlaceholder,"aria-label":n.searchPlaceholder,onChange:r=>{e.onSearch(r.target.value)}}),n.emptyLabel===null?null:m.jsx("p",{className:"text-muted-foreground",children:n.emptyLabel}),m.jsx("ul",{"aria-label":n.heading,className:"-mx-2 flex max-h-80 flex-col overflow-y-auto",children:n.targets.map(r=>m.jsx(Yfe,{target:r,isCurrent:r.id===n.currentTargetId,onSwitch:t},r.id))})]})},JE=({title:e,className:t,icon:n=null,switching:r})=>{const[s,o]=N.useState(!1);if(r===null)return m.jsxs(m.Fragment,{children:[n,m.jsx("h1",{className:ye("min-w-0 truncate",t),title:e,children:e})]});const l=c=>{var u;o(!1),c!==((u=r.switcher)==null?void 0:u.currentTargetId)&&r.onSwitch(c)};return m.jsx("h1",{className:ye("-mx-1.5 flex min-w-0",t),children:m.jsxs(HT,{open:s,onOpenChange:c=>{o(c),c&&r.onOpen()},children:[m.jsxs(Sb,{className:Gfe,title:e,children:[n,m.jsx("span",{className:"min-w-0 truncate",children:e}),m.jsx(su,{"aria-hidden":"true",className:"size-3.5 shrink-0 text-sign-muted"})]}),m.jsx(FT,{children:m.jsx($T,{align:"start",sideOffset:10,className:"isolate z-50",children:m.jsx(UT,{className:ye(a8,"max-w-[calc(100vw-2rem)] font-sans font-normal"),children:m.jsx(Wfe,{switching:r,onSwitch:l})})})})]})})},Xfe={pending:null,commented:VX,approved:wu,"changes-requested":Vx},Qfe={pending:"border-sign-muted bg-sign",commented:"border-sign bg-sign-muted text-sign",approved:"border-sign bg-sign-foreground text-sign","changes-requested":"border-sign bg-destructive text-sign-foreground"},d8="border-sign-foreground bg-sign-foreground text-sign",f8="inline-flex h-7 shrink-0 items-center gap-1.5 rounded-md border border-sign-foreground/35 px-2.5 text-[0.8rem] text-sign-foreground hover:bg-sign-foreground/10",eC="font-bold text-signal",Xh="text-sign-muted",Zfe={"no-review":"text-sign-foreground","awaiting-review":eC,"awaiting-reply":eC,stale:Xh,draft:Xh,closed:Xh,merged:Xh},tL=({freshness:e})=>m.jsx("span",{className:ye("shrink-0 text-sm",e.isOutOfDate?eC:Xh),children:e.label}),nL="inline-flex h-7 shrink-0 items-center gap-1.5 rounded-md px-2 text-sm text-sign-muted",Jfe="cursor-pointer hover:bg-sign-foreground/10 hover:text-sign-foreground focus-visible:outline-2 focus-visible:outline-sign-foreground",ehe="size-2 shrink-0 rounded-full",the="bg-diff-added",nhe="bg-sign-muted",rL=({status:e})=>m.jsxs(m.Fragment,{children:[m.jsx("span",{"aria-hidden":"true","data-online":e.isOnline,className:ye(ehe,e.isOnline?the:nhe)}),e.label]}),rhe=({status:e})=>{if(e===null)return null;const{onClick:t}=e;return t===null?m.jsx("span",{className:nL,children:m.jsx(rL,{status:e})}):m.jsx("button",{type:"button",className:ye(nL,Jfe),onClick:t,children:m.jsx(rL,{status:e})})},she="relative block rounded-full focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-sign-foreground",sL=({reviewer:e})=>{const t=Xfe[e.state];return m.jsxs(m.Fragment,{children:[m.jsx(zf,{imageUrl:e.avatarUrl,monogram:e.monogram,className:ye("size-6",d8)}),m.jsx("span",{"aria-hidden":"true","data-state":e.state,className:ye("absolute -right-1 -bottom-1 flex size-3.5 items-center justify-center rounded-full border",Qfe[e.state]),children:t===null?null:m.jsx(t,{className:"size-2.5",strokeWidth:3})}),m.jsx("span",{className:"sr-only",children:e.stateLabel})]})},ohe=({reviewer:e,requesting:t})=>{const{request:n}=e;return n===null||t===null?m.jsx("li",{className:"relative",title:e.stateLabel,children:m.jsx(sL,{reviewer:e})}):m.jsx("li",{title:e.stateLabel,children:m.jsxs(Az,{children:[m.jsx(kz,{className:she,children:m.jsx(sL,{reviewer:e})}),m.jsx(_z,{align:"end",children:m.jsx(Fd,{disabled:t.isPending,onClick:()=>{n.isRemoving?t.onRemove(n.login):t.onRequest(n.login)},children:n.label})})]})})},ihe=({labels:e,requesting:t})=>{var n;return m.jsxs(qT,{onOpen:t.onOpen,trigger:m.jsx(Sb,{"aria-label":e.buttonLabel,title:e.buttonLabel,className:ye(f8,"px-1.5"),children:m.jsx(QX,{"aria-hidden":"true",className:"size-3.5"})}),children:[m.jsx(VT,{className:"text-base leading-6 font-bold",children:e.heading}),m.jsx(zm,{type:"search",value:t.query,placeholder:e.searchPlaceholder,"aria-label":e.searchPlaceholder,onChange:r=>{t.onSearch(r.target.value)}}),((n=t.options)==null?void 0:n.length)===0?m.jsx("p",{className:"text-muted-foreground",children:e.emptyLabel}):null,m.jsx("ul",{className:"flex max-h-72 flex-col overflow-y-auto",children:(t.options??[]).map(r=>m.jsxs("li",{className:"flex items-center gap-2 border-t py-2 first:border-t-0 first:pt-0 last:pb-0",children:[m.jsx(zf,{imageUrl:r.avatarUrl,monogram:r.monogram,className:"size-6"}),m.jsxs("span",{className:"flex min-w-0 flex-1 flex-col",children:[m.jsx("span",{className:"truncate font-bold",children:r.name}),m.jsx("span",{className:"truncate text-xs text-muted-foreground",children:r.detail})]}),m.jsx(st,{type:"button",variant:"outline",size:"sm","aria-label":`${e.requestLabel} ${r.name}`,disabled:t.isPending,onClick:()=>{t.onRequest(r.login)},children:e.requestLabel})]},r.login))})]})},tC=({segments:e})=>e===null?null:m.jsx(ff,{segments:e,className:"shrink-0 flex-nowrap text-sm text-sign-muted tabular-nums"}),h8="font-mono text-[0.94rem] font-bold",p8="text-base font-bold",m8=m.jsx(FX,{"aria-hidden":"true",className:"size-4 shrink-0 text-sign-muted"}),lhe="shrink-0 rounded-sm border border-sign-foreground/35 px-1.5 py-0.5 text-xs font-bold text-sign-foreground",ahe=({title:e,isBranch:t,label:n,changedFiles:r=null,switching:s=null,actions:o})=>m.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-3",children:[m.jsx(JE,{title:e,className:t?h8:p8,icon:t?m8:null,switching:s}),m.jsx("span",{className:lhe,children:n}),m.jsx(tC,{segments:r}),m.jsx("span",{className:"flex-1"}),o]}),che=({header:e,changedFiles:t,requesting:n,switching:r,actions:s})=>e.kind==="branch"?m.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-3",children:[m.jsx(JE,{title:e.branch,className:h8,icon:m8,switching:r}),e.artifactFreshness===null?null:m.jsx(tL,{freshness:e.artifactFreshness}),m.jsx(tC,{segments:t}),m.jsx("span",{className:"flex-1"}),m.jsx("span",{className:"shrink-0 text-sm text-sign-muted",children:e.forgeMessage}),m.jsx("a",{href:e.action.href,className:f8,children:m.jsx("span",{className:"text-box-cap",children:e.action.label})}),s]}):m.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-3",children:[m.jsxs("span",{className:"shrink-0",title:e.author.name,children:[m.jsx(zf,{imageUrl:e.author.avatarUrl,monogram:e.author.monogram,className:ye("size-7 text-xs",d8)}),m.jsx("span",{className:"sr-only",children:e.author.name})]}),m.jsx(JE,{title:e.title,className:p8,switching:r}),m.jsxs("span",{className:"flex shrink-0 items-center gap-1.5",children:[m.jsx(dp,{status:e.status}),m.jsx("span",{className:ye("text-sm",Zfe[e.status]),children:e.statusLabel})]}),e.artifactFreshness===null?null:m.jsx(tL,{freshness:e.artifactFreshness}),m.jsx(tC,{segments:t}),m.jsx("span",{className:"flex-1"}),e.reviewersEmptyLabel===null?m.jsx("ul",{"aria-label":"Reviewers",className:"flex shrink-0 gap-2.5",children:e.reviewers.map(o=>m.jsx(ohe,{reviewer:o,requesting:n},o.name))}):m.jsx("span",{className:"shrink-0 text-sm text-sign-muted",children:e.reviewersEmptyLabel}),e.reviewerRequest===null||n===null?null:m.jsx(ihe,{labels:e.reviewerRequest,requesting:n}),s]}),uhe=({header:e,changedFiles:t=null,authorLabel:n=null,reviewerRequesting:r=null,targetSwitching:s=null,agentStatus:o=null,actions:l})=>{const c=m.jsxs(m.Fragment,{children:[m.jsx(rhe,{status:o}),l]});return n===null?m.jsx(che,{header:e,changedFiles:t,requesting:r,switching:s,actions:c}):m.jsx(ahe,{title:e.kind==="branch"?e.branch:e.title,isBranch:e.kind==="branch",label:n,changedFiles:t,switching:s,actions:c})},dhe=({message:e})=>m.jsx("div",{role:"status",className:"pointer-events-none fixed bottom-4 left-1/2 z-[60] -translate-x-1/2",children:e===null?null:m.jsx("p",{className:"rounded-lg border border-foreground bg-popover px-3 py-2 text-sm text-popover-foreground duration-150 animate-in fade-in-0",children:e})});function Vn(e){if(typeof e=="string"||typeof e=="number")return""+e;let t="";if(Array.isArray(e))for(let n=0,r;n<e.length;n++)(r=Vn(e[n]))!==""&&(t+=(t&&" ")+r);else for(let n in e)e[n]&&(t+=(t&&" ")+n);return t}var fhe={value:()=>{}};function wb(){for(var e=0,t=arguments.length,n={},r;e<t;++e){if(!(r=arguments[e]+"")||r in n||/[\s.]/.test(r))throw new Error("illegal type: "+r);n[r]=[]}return new Sy(n)}function Sy(e){this._=e}function hhe(e,t){return e.trim().split(/^|\s+/).map(function(n){var r="",s=n.indexOf(".");if(s>=0&&(r=n.slice(s+1),n=n.slice(0,s)),n&&!t.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:r}})}Sy.prototype=wb.prototype={constructor:Sy,on:function(e,t){var n=this._,r=hhe(e+"",n),s,o=-1,l=r.length;if(arguments.length<2){for(;++o<l;)if((s=(e=r[o]).type)&&(s=phe(n[s],e.name)))return s;return}if(t!=null&&typeof t!="function")throw new Error("invalid callback: "+t);for(;++o<l;)if(s=(e=r[o]).type)n[s]=oL(n[s],e.name,t);else if(t==null)for(s in n)n[s]=oL(n[s],e.name,null);return this},copy:function(){var e={},t=this._;for(var n in t)e[n]=t[n].slice();return new Sy(e)},call:function(e,t){if((s=arguments.length-2)>0)for(var n=new Array(s),r=0,s,o;r<s;++r)n[r]=arguments[r+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(o=this._[e],r=0,s=o.length;r<s;++r)o[r].value.apply(t,n)},apply:function(e,t,n){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var r=this._[e],s=0,o=r.length;s<o;++s)r[s].value.apply(t,n)}};function phe(e,t){for(var n=0,r=e.length,s;n<r;++n)if((s=e[n]).name===t)return s.value}function oL(e,t,n){for(var r=0,s=e.length;r<s;++r)if(e[r].name===t){e[r]=fhe,e=e.slice(0,r).concat(e.slice(r+1));break}return n!=null&&e.push({name:t,value:n}),e}var nC="http://www.w3.org/1999/xhtml";const iL={svg:"http://www.w3.org/2000/svg",xhtml:nC,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Eb(e){var t=e+="",n=t.indexOf(":");return n>=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),iL.hasOwnProperty(t)?{space:iL[t],local:e}:e}function mhe(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===nC&&t.documentElement.namespaceURI===nC?t.createElement(e):t.createElementNS(n,e)}}function ghe(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function g8(e){var t=Eb(e);return(t.local?ghe:mhe)(t)}function yhe(){}function KT(e){return e==null?yhe:function(){return this.querySelector(e)}}function xhe(e){typeof e!="function"&&(e=KT(e));for(var t=this._groups,n=t.length,r=new Array(n),s=0;s<n;++s)for(var o=t[s],l=o.length,c=r[s]=new Array(l),u,f,h=0;h<l;++h)(u=o[h])&&(f=e.call(u,u.__data__,h,o))&&("__data__"in u&&(f.__data__=u.__data__),c[h]=f);return new Vs(r,this._parents)}function bhe(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function vhe(){return[]}function y8(e){return e==null?vhe:function(){return this.querySelectorAll(e)}}function She(e){return function(){return bhe(e.apply(this,arguments))}}function whe(e){typeof e=="function"?e=She(e):e=y8(e);for(var t=this._groups,n=t.length,r=[],s=[],o=0;o<n;++o)for(var l=t[o],c=l.length,u,f=0;f<c;++f)(u=l[f])&&(r.push(e.call(u,u.__data__,f,l)),s.push(u));return new Vs(r,s)}function x8(e){return function(){return this.matches(e)}}function b8(e){return function(t){return t.matches(e)}}var Ehe=Array.prototype.find;function Che(e){return function(){return Ehe.call(this.children,e)}}function The(){return this.firstElementChild}function Nhe(e){return this.select(e==null?The:Che(typeof e=="function"?e:b8(e)))}var Ohe=Array.prototype.filter;function Rhe(){return Array.from(this.children)}function Ahe(e){return function(){return Ohe.call(this.children,e)}}function khe(e){return this.selectAll(e==null?Rhe:Ahe(typeof e=="function"?e:b8(e)))}function _he(e){typeof e!="function"&&(e=x8(e));for(var t=this._groups,n=t.length,r=new Array(n),s=0;s<n;++s)for(var o=t[s],l=o.length,c=r[s]=[],u,f=0;f<l;++f)(u=o[f])&&e.call(u,u.__data__,f,o)&&c.push(u);return new Vs(r,this._parents)}function v8(e){return new Array(e.length)}function Mhe(){return new Vs(this._enter||this._groups.map(v8),this._parents)}function ex(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}ex.prototype={constructor:ex,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,t){return this._parent.insertBefore(e,t)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}};function Ihe(e){return function(){return e}}function Lhe(e,t,n,r,s,o){for(var l=0,c,u=t.length,f=o.length;l<f;++l)(c=t[l])?(c.__data__=o[l],r[l]=c):n[l]=new ex(e,o[l]);for(;l<u;++l)(c=t[l])&&(s[l]=c)}function Dhe(e,t,n,r,s,o,l){var c,u,f=new Map,h=t.length,p=o.length,y=new Array(h),x;for(c=0;c<h;++c)(u=t[c])&&(y[c]=x=l.call(u,u.__data__,c,t)+"",f.has(x)?s[c]=u:f.set(x,u));for(c=0;c<p;++c)x=l.call(e,o[c],c,o)+"",(u=f.get(x))?(r[c]=u,u.__data__=o[c],f.delete(x)):n[c]=new ex(e,o[c]);for(c=0;c<h;++c)(u=t[c])&&f.get(y[c])===u&&(s[c]=u)}function jhe(e){return e.__data__}function Phe(e,t){if(!arguments.length)return Array.from(this,jhe);var n=t?Dhe:Lhe,r=this._parents,s=this._groups;typeof e!="function"&&(e=Ihe(e));for(var o=s.length,l=new Array(o),c=new Array(o),u=new Array(o),f=0;f<o;++f){var h=r[f],p=s[f],y=p.length,x=zhe(e.call(h,h&&h.__data__,f,r)),b=x.length,S=c[f]=new Array(b),E=l[f]=new Array(b),C=u[f]=new Array(y);n(h,p,S,E,C,x,t);for(var O=0,T=0,R,k;O<b;++O)if(R=S[O]){for(O>=T&&(T=O+1);!(k=E[T])&&++T<b;);R._next=k||null}}return l=new Vs(l,r),l._enter=c,l._exit=u,l}function zhe(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function Bhe(){return new Vs(this._exit||this._groups.map(v8),this._parents)}function Hhe(e,t,n){var r=this.enter(),s=this,o=this.exit();return typeof e=="function"?(r=e(r),r&&(r=r.selection())):r=r.append(e+""),t!=null&&(s=t(s),s&&(s=s.selection())),n==null?o.remove():n(o),r&&s?r.merge(s).order():s}function Fhe(e){for(var t=e.selection?e.selection():e,n=this._groups,r=t._groups,s=n.length,o=r.length,l=Math.min(s,o),c=new Array(s),u=0;u<l;++u)for(var f=n[u],h=r[u],p=f.length,y=c[u]=new Array(p),x,b=0;b<p;++b)(x=f[b]||h[b])&&(y[b]=x);for(;u<s;++u)c[u]=n[u];return new Vs(c,this._parents)}function $he(){for(var e=this._groups,t=-1,n=e.length;++t<n;)for(var r=e[t],s=r.length-1,o=r[s],l;--s>=0;)(l=r[s])&&(o&&l.compareDocumentPosition(o)^4&&o.parentNode.insertBefore(l,o),o=l);return this}function Uhe(e){e||(e=Vhe);function t(p,y){return p&&y?e(p.__data__,y.__data__):!p-!y}for(var n=this._groups,r=n.length,s=new Array(r),o=0;o<r;++o){for(var l=n[o],c=l.length,u=s[o]=new Array(c),f,h=0;h<c;++h)(f=l[h])&&(u[h]=f);u.sort(t)}return new Vs(s,this._parents).order()}function Vhe(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function qhe(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function Ghe(){return Array.from(this)}function Khe(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],s=0,o=r.length;s<o;++s){var l=r[s];if(l)return l}return null}function Yhe(){let e=0;for(const t of this)++e;return e}function Whe(){return!this.node()}function Xhe(e){for(var t=this._groups,n=0,r=t.length;n<r;++n)for(var s=t[n],o=0,l=s.length,c;o<l;++o)(c=s[o])&&e.call(c,c.__data__,o,s);return this}function Qhe(e){return function(){this.removeAttribute(e)}}function Zhe(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Jhe(e,t){return function(){this.setAttribute(e,t)}}function epe(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function tpe(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function npe(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,n)}}function rpe(e,t){var n=Eb(e);if(arguments.length<2){var r=this.node();return n.local?r.getAttributeNS(n.space,n.local):r.getAttribute(n)}return this.each((t==null?n.local?Zhe:Qhe:typeof t=="function"?n.local?npe:tpe:n.local?epe:Jhe)(n,t))}function S8(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function spe(e){return function(){this.style.removeProperty(e)}}function ope(e,t,n){return function(){this.style.setProperty(e,t,n)}}function ipe(e,t,n){return function(){var r=t.apply(this,arguments);r==null?this.style.removeProperty(e):this.style.setProperty(e,r,n)}}function lpe(e,t,n){return arguments.length>1?this.each((t==null?spe:typeof t=="function"?ipe:ope)(e,t,n??"")):pf(this.node(),e)}function pf(e,t){return e.style.getPropertyValue(t)||S8(e).getComputedStyle(e,null).getPropertyValue(t)}function ape(e){return function(){delete this[e]}}function cpe(e,t){return function(){this[e]=t}}function upe(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function dpe(e,t){return arguments.length>1?this.each((t==null?ape:typeof t=="function"?upe:cpe)(e,t)):this.node()[e]}function w8(e){return e.trim().split(/^|\s+/)}function YT(e){return e.classList||new E8(e)}function E8(e){this._node=e,this._names=w8(e.getAttribute("class")||"")}E8.prototype={add:function(e){var t=this._names.indexOf(e);t<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};function C8(e,t){for(var n=YT(e),r=-1,s=t.length;++r<s;)n.add(t[r])}function T8(e,t){for(var n=YT(e),r=-1,s=t.length;++r<s;)n.remove(t[r])}function fpe(e){return function(){C8(this,e)}}function hpe(e){return function(){T8(this,e)}}function ppe(e,t){return function(){(t.apply(this,arguments)?C8:T8)(this,e)}}function mpe(e,t){var n=w8(e+"");if(arguments.length<2){for(var r=YT(this.node()),s=-1,o=n.length;++s<o;)if(!r.contains(n[s]))return!1;return!0}return this.each((typeof t=="function"?ppe:t?fpe:hpe)(n,t))}function gpe(){this.textContent=""}function ype(e){return function(){this.textContent=e}}function xpe(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function bpe(e){return arguments.length?this.each(e==null?gpe:(typeof e=="function"?xpe:ype)(e)):this.node().textContent}function vpe(){this.innerHTML=""}function Spe(e){return function(){this.innerHTML=e}}function wpe(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function Epe(e){return arguments.length?this.each(e==null?vpe:(typeof e=="function"?wpe:Spe)(e)):this.node().innerHTML}function Cpe(){this.nextSibling&&this.parentNode.appendChild(this)}function Tpe(){return this.each(Cpe)}function Npe(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function Ope(){return this.each(Npe)}function Rpe(e){var t=typeof e=="function"?e:g8(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function Ape(){return null}function kpe(e,t){var n=typeof e=="function"?e:g8(e),r=t==null?Ape:typeof t=="function"?t:KT(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})}function _pe(){var e=this.parentNode;e&&e.removeChild(this)}function Mpe(){return this.each(_pe)}function Ipe(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Lpe(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Dpe(e){return this.select(e?Lpe:Ipe)}function jpe(e){return arguments.length?this.property("__data__",e):this.node().__data__}function Ppe(e){return function(t){e.call(this,t,this.__data__)}}function zpe(e){return e.trim().split(/^|\s+/).map(function(t){var n="",r=t.indexOf(".");return r>=0&&(n=t.slice(r+1),t=t.slice(0,r)),{type:t,name:n}})}function Bpe(e){return function(){var t=this.__on;if(t){for(var n=0,r=-1,s=t.length,o;n<s;++n)o=t[n],(!e.type||o.type===e.type)&&o.name===e.name?this.removeEventListener(o.type,o.listener,o.options):t[++r]=o;++r?t.length=r:delete this.__on}}}function Hpe(e,t,n){return function(){var r=this.__on,s,o=Ppe(t);if(r){for(var l=0,c=r.length;l<c;++l)if((s=r[l]).type===e.type&&s.name===e.name){this.removeEventListener(s.type,s.listener,s.options),this.addEventListener(s.type,s.listener=o,s.options=n),s.value=t;return}}this.addEventListener(e.type,o,n),s={type:e.type,name:e.name,value:t,listener:o,options:n},r?r.push(s):this.__on=[s]}}function Fpe(e,t,n){var r=zpe(e+""),s,o=r.length,l;if(arguments.length<2){var c=this.node().__on;if(c){for(var u=0,f=c.length,h;u<f;++u)for(s=0,h=c[u];s<o;++s)if((l=r[s]).type===h.type&&l.name===h.name)return h.value}return}for(c=t?Hpe:Bpe,s=0;s<o;++s)this.each(c(r[s],t,n));return this}function N8(e,t,n){var r=S8(e),s=r.CustomEvent;typeof s=="function"?s=new s(t,n):(s=r.document.createEvent("Event"),n?(s.initEvent(t,n.bubbles,n.cancelable),s.detail=n.detail):s.initEvent(t,!1,!1)),e.dispatchEvent(s)}function $pe(e,t){return function(){return N8(this,e,t)}}function Upe(e,t){return function(){return N8(this,e,t.apply(this,arguments))}}function Vpe(e,t){return this.each((typeof t=="function"?Upe:$pe)(e,t))}function*qpe(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],s=0,o=r.length,l;s<o;++s)(l=r[s])&&(yield l)}var O8=[null];function Vs(e,t){this._groups=e,this._parents=t}function Bm(){return new Vs([[document.documentElement]],O8)}function Gpe(){return this}Vs.prototype=Bm.prototype={constructor:Vs,select:xhe,selectAll:whe,selectChild:Nhe,selectChildren:khe,filter:_he,data:Phe,enter:Mhe,exit:Bhe,join:Hhe,merge:Fhe,selection:Gpe,order:$he,sort:Uhe,call:qhe,nodes:Ghe,node:Khe,size:Yhe,empty:Whe,each:Xhe,attr:rpe,style:lpe,property:dpe,classed:mpe,text:bpe,html:Epe,raise:Tpe,lower:Ope,append:Rpe,insert:kpe,remove:Mpe,clone:Dpe,datum:jpe,on:Fpe,dispatch:Vpe,[Symbol.iterator]:qpe};function zs(e){return typeof e=="string"?new Vs([[document.querySelector(e)]],[document.documentElement]):new Vs([[e]],O8)}function Kpe(e){let t;for(;t=e.sourceEvent;)e=t;return e}function wo(e,t){if(e=Kpe(e),t===void 0&&(t=e.currentTarget),t){var n=t.ownerSVGElement||t;if(n.createSVGPoint){var r=n.createSVGPoint();return r.x=e.clientX,r.y=e.clientY,r=r.matrixTransform(t.getScreenCTM().inverse()),[r.x,r.y]}if(t.getBoundingClientRect){var s=t.getBoundingClientRect();return[e.clientX-s.left-t.clientLeft,e.clientY-s.top-t.clientTop]}}return[e.pageX,e.pageY]}const Ype={passive:!1},Dp={capture:!0,passive:!1};function rw(e){e.stopImmediatePropagation()}function $d(e){e.preventDefault(),e.stopImmediatePropagation()}function R8(e){var t=e.document.documentElement,n=zs(e).on("dragstart.drag",$d,Dp);"onselectstart"in t?n.on("selectstart.drag",$d,Dp):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function A8(e,t){var n=e.document.documentElement,r=zs(e).on("dragstart.drag",null);t&&(r.on("click.drag",$d,Dp),setTimeout(function(){r.on("click.drag",null)},0)),"onselectstart"in n?r.on("selectstart.drag",null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}const U0=e=>()=>e;function rC(e,{sourceEvent:t,subject:n,target:r,identifier:s,active:o,x:l,y:c,dx:u,dy:f,dispatch:h}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},identifier:{value:s,enumerable:!0,configurable:!0},active:{value:o,enumerable:!0,configurable:!0},x:{value:l,enumerable:!0,configurable:!0},y:{value:c,enumerable:!0,configurable:!0},dx:{value:u,enumerable:!0,configurable:!0},dy:{value:f,enumerable:!0,configurable:!0},_:{value:h}})}rC.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function Wpe(e){return!e.ctrlKey&&!e.button}function Xpe(){return this.parentNode}function Qpe(e,t){return t??{x:e.x,y:e.y}}function Zpe(){return navigator.maxTouchPoints||"ontouchstart"in this}function k8(){var e=Wpe,t=Xpe,n=Qpe,r=Zpe,s={},o=wb("start","drag","end"),l=0,c,u,f,h,p=0;function y(R){R.on("mousedown.drag",x).filter(r).on("touchstart.drag",E).on("touchmove.drag",C,Ype).on("touchend.drag touchcancel.drag",O).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function x(R,k){if(!(h||!e.call(this,R,k))){var M=T(this,t.call(this,R,k),R,k,"mouse");M&&(zs(R.view).on("mousemove.drag",b,Dp).on("mouseup.drag",S,Dp),R8(R.view),rw(R),f=!1,c=R.clientX,u=R.clientY,M("start",R))}}function b(R){if($d(R),!f){var k=R.clientX-c,M=R.clientY-u;f=k*k+M*M>p}s.mouse("drag",R)}function S(R){zs(R.view).on("mousemove.drag mouseup.drag",null),A8(R.view,f),$d(R),s.mouse("end",R)}function E(R,k){if(e.call(this,R,k)){var M=R.changedTouches,A=t.call(this,R,k),I=M.length,L,D;for(L=0;L<I;++L)(D=T(this,A,R,k,M[L].identifier,M[L]))&&(rw(R),D("start",R,M[L]))}}function C(R){var k=R.changedTouches,M=k.length,A,I;for(A=0;A<M;++A)(I=s[k[A].identifier])&&($d(R),I("drag",R,k[A]))}function O(R){var k=R.changedTouches,M=k.length,A,I;for(h&&clearTimeout(h),h=setTimeout(function(){h=null},500),A=0;A<M;++A)(I=s[k[A].identifier])&&(rw(R),I("end",R,k[A]))}function T(R,k,M,A,I,L){var D=o.copy(),P=wo(L||M,k),z,$,j;if((j=n.call(R,new rC("beforestart",{sourceEvent:M,target:y,identifier:I,active:l,x:P[0],y:P[1],dx:0,dy:0,dispatch:D}),A))!=null)return z=j.x-P[0]||0,$=j.y-P[1]||0,function H(B,V,G){var q=P,K;switch(B){case"start":s[I]=H,K=l++;break;case"end":delete s[I],--l;case"drag":P=wo(G||V,k),K=l;break}D.call(B,R,new rC(B,{sourceEvent:V,subject:j,target:y,identifier:I,active:K,x:P[0]+z,y:P[1]+$,dx:P[0]-q[0],dy:P[1]-q[1],dispatch:D}),A)}}return y.filter=function(R){return arguments.length?(e=typeof R=="function"?R:U0(!!R),y):e},y.container=function(R){return arguments.length?(t=typeof R=="function"?R:U0(R),y):t},y.subject=function(R){return arguments.length?(n=typeof R=="function"?R:U0(R),y):n},y.touchable=function(R){return arguments.length?(r=typeof R=="function"?R:U0(!!R),y):r},y.on=function(){var R=o.on.apply(o,arguments);return R===o?y:R},y.clickDistance=function(R){return arguments.length?(p=(R=+R)*R,y):Math.sqrt(p)},y}function WT(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function _8(e,t){var n=Object.create(e.prototype);for(var r in t)n[r]=t[r];return n}function Hm(){}var jp=.7,tx=1/jp,Ud="\\s*([+-]?\\d+)\\s*",Pp="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",ci="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",Jpe=/^#([0-9a-f]{3,8})$/,eme=new RegExp(`^rgb\\(${Ud},${Ud},${Ud}\\)$`),tme=new RegExp(`^rgb\\(${ci},${ci},${ci}\\)$`),nme=new RegExp(`^rgba\\(${Ud},${Ud},${Ud},${Pp}\\)$`),rme=new RegExp(`^rgba\\(${ci},${ci},${ci},${Pp}\\)$`),sme=new RegExp(`^hsl\\(${Pp},${ci},${ci}\\)$`),ome=new RegExp(`^hsla\\(${Pp},${ci},${ci},${Pp}\\)$`),lL={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};WT(Hm,au,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:aL,formatHex:aL,formatHex8:ime,formatHsl:lme,formatRgb:cL,toString:cL});function aL(){return this.rgb().formatHex()}function ime(){return this.rgb().formatHex8()}function lme(){return M8(this).formatHsl()}function cL(){return this.rgb().formatRgb()}function au(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=Jpe.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?uL(t):n===3?new vs(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?V0(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?V0(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=eme.exec(e))?new vs(t[1],t[2],t[3],1):(t=tme.exec(e))?new vs(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=nme.exec(e))?V0(t[1],t[2],t[3],t[4]):(t=rme.exec(e))?V0(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=sme.exec(e))?hL(t[1],t[2]/100,t[3]/100,1):(t=ome.exec(e))?hL(t[1],t[2]/100,t[3]/100,t[4]):lL.hasOwnProperty(e)?uL(lL[e]):e==="transparent"?new vs(NaN,NaN,NaN,0):null}function uL(e){return new vs(e>>16&255,e>>8&255,e&255,1)}function V0(e,t,n,r){return r<=0&&(e=t=n=NaN),new vs(e,t,n,r)}function ame(e){return e instanceof Hm||(e=au(e)),e?(e=e.rgb(),new vs(e.r,e.g,e.b,e.opacity)):new vs}function sC(e,t,n,r){return arguments.length===1?ame(e):new vs(e,t,n,r??1)}function vs(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}WT(vs,sC,_8(Hm,{brighter(e){return e=e==null?tx:Math.pow(tx,e),new vs(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?jp:Math.pow(jp,e),new vs(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new vs(Qc(this.r),Qc(this.g),Qc(this.b),nx(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:dL,formatHex:dL,formatHex8:cme,formatRgb:fL,toString:fL}));function dL(){return`#${Pc(this.r)}${Pc(this.g)}${Pc(this.b)}`}function cme(){return`#${Pc(this.r)}${Pc(this.g)}${Pc(this.b)}${Pc((isNaN(this.opacity)?1:this.opacity)*255)}`}function fL(){const e=nx(this.opacity);return`${e===1?"rgb(":"rgba("}${Qc(this.r)}, ${Qc(this.g)}, ${Qc(this.b)}${e===1?")":`, ${e})`}`}function nx(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Qc(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Pc(e){return e=Qc(e),(e<16?"0":"")+e.toString(16)}function hL(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new Eo(e,t,n,r)}function M8(e){if(e instanceof Eo)return new Eo(e.h,e.s,e.l,e.opacity);if(e instanceof Hm||(e=au(e)),!e)return new Eo;if(e instanceof Eo)return e;e=e.rgb();var t=e.r/255,n=e.g/255,r=e.b/255,s=Math.min(t,n,r),o=Math.max(t,n,r),l=NaN,c=o-s,u=(o+s)/2;return c?(t===o?l=(n-r)/c+(n<r)*6:n===o?l=(r-t)/c+2:l=(t-n)/c+4,c/=u<.5?o+s:2-o-s,l*=60):c=u>0&&u<1?0:l,new Eo(l,c,u,e.opacity)}function ume(e,t,n,r){return arguments.length===1?M8(e):new Eo(e,t,n,r??1)}function Eo(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}WT(Eo,ume,_8(Hm,{brighter(e){return e=e==null?tx:Math.pow(tx,e),new Eo(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?jp:Math.pow(jp,e),new Eo(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*t,s=2*n-r;return new vs(sw(e>=240?e-240:e+120,s,r),sw(e,s,r),sw(e<120?e+240:e-120,s,r),this.opacity)},clamp(){return new Eo(pL(this.h),q0(this.s),q0(this.l),nx(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const e=nx(this.opacity);return`${e===1?"hsl(":"hsla("}${pL(this.h)}, ${q0(this.s)*100}%, ${q0(this.l)*100}%${e===1?")":`, ${e})`}`}}));function pL(e){return e=(e||0)%360,e<0?e+360:e}function q0(e){return Math.max(0,Math.min(1,e||0))}function sw(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}const XT=e=>()=>e;function dme(e,t){return function(n){return e+n*t}}function fme(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(r){return Math.pow(e+r*t,n)}}function hme(e){return(e=+e)==1?I8:function(t,n){return n-t?fme(t,n,e):XT(isNaN(t)?n:t)}}function I8(e,t){var n=t-e;return n?dme(e,n):XT(isNaN(e)?t:e)}const rx=(function e(t){var n=hme(t);function r(s,o){var l=n((s=sC(s)).r,(o=sC(o)).r),c=n(s.g,o.g),u=n(s.b,o.b),f=I8(s.opacity,o.opacity);return function(h){return s.r=l(h),s.g=c(h),s.b=u(h),s.opacity=f(h),s+""}}return r.gamma=e,r})(1);function pme(e,t){t||(t=[]);var n=e?Math.min(t.length,e.length):0,r=t.slice(),s;return function(o){for(s=0;s<n;++s)r[s]=e[s]*(1-o)+t[s]*o;return r}}function mme(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function gme(e,t){var n=t?t.length:0,r=e?Math.min(n,e.length):0,s=new Array(r),o=new Array(n),l;for(l=0;l<r;++l)s[l]=fp(e[l],t[l]);for(;l<n;++l)o[l]=t[l];return function(c){for(l=0;l<r;++l)o[l]=s[l](c);return o}}function yme(e,t){var n=new Date;return e=+e,t=+t,function(r){return n.setTime(e*(1-r)+t*r),n}}function ti(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}function xme(e,t){var n={},r={},s;(e===null||typeof e!="object")&&(e={}),(t===null||typeof t!="object")&&(t={});for(s in t)s in e?n[s]=fp(e[s],t[s]):r[s]=t[s];return function(o){for(s in n)r[s]=n[s](o);return r}}var oC=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,ow=new RegExp(oC.source,"g");function bme(e){return function(){return e}}function vme(e){return function(t){return e(t)+""}}function L8(e,t){var n=oC.lastIndex=ow.lastIndex=0,r,s,o,l=-1,c=[],u=[];for(e=e+"",t=t+"";(r=oC.exec(e))&&(s=ow.exec(t));)(o=s.index)>n&&(o=t.slice(n,o),c[l]?c[l]+=o:c[++l]=o),(r=r[0])===(s=s[0])?c[l]?c[l]+=s:c[++l]=s:(c[++l]=null,u.push({i:l,x:ti(r,s)})),n=ow.lastIndex;return n<t.length&&(o=t.slice(n),c[l]?c[l]+=o:c[++l]=o),c.length<2?u[0]?vme(u[0].x):bme(t):(t=u.length,function(f){for(var h=0,p;h<t;++h)c[(p=u[h]).i]=p.x(f);return c.join("")})}function fp(e,t){var n=typeof t,r;return t==null||n==="boolean"?XT(t):(n==="number"?ti:n==="string"?(r=au(t))?(t=r,rx):L8:t instanceof au?rx:t instanceof Date?yme:mme(t)?pme:Array.isArray(t)?gme:typeof t.valueOf!="function"&&typeof t.toString!="function"||isNaN(t)?xme:ti)(e,t)}var mL=180/Math.PI,iC={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function D8(e,t,n,r,s,o){var l,c,u;return(l=Math.sqrt(e*e+t*t))&&(e/=l,t/=l),(u=e*n+t*r)&&(n-=e*u,r-=t*u),(c=Math.sqrt(n*n+r*r))&&(n/=c,r/=c,u/=c),e*r<t*n&&(e=-e,t=-t,u=-u,l=-l),{translateX:s,translateY:o,rotate:Math.atan2(t,e)*mL,skewX:Math.atan(u)*mL,scaleX:l,scaleY:c}}var G0;function Sme(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?iC:D8(t.a,t.b,t.c,t.d,t.e,t.f)}function wme(e){return e==null||(G0||(G0=document.createElementNS("http://www.w3.org/2000/svg","g")),G0.setAttribute("transform",e),!(e=G0.transform.baseVal.consolidate()))?iC:(e=e.matrix,D8(e.a,e.b,e.c,e.d,e.e,e.f))}function j8(e,t,n,r){function s(f){return f.length?f.pop()+" ":""}function o(f,h,p,y,x,b){if(f!==p||h!==y){var S=x.push("translate(",null,t,null,n);b.push({i:S-4,x:ti(f,p)},{i:S-2,x:ti(h,y)})}else(p||y)&&x.push("translate("+p+t+y+n)}function l(f,h,p,y){f!==h?(f-h>180?h+=360:h-f>180&&(f+=360),y.push({i:p.push(s(p)+"rotate(",null,r)-2,x:ti(f,h)})):h&&p.push(s(p)+"rotate("+h+r)}function c(f,h,p,y){f!==h?y.push({i:p.push(s(p)+"skewX(",null,r)-2,x:ti(f,h)}):h&&p.push(s(p)+"skewX("+h+r)}function u(f,h,p,y,x,b){if(f!==p||h!==y){var S=x.push(s(x)+"scale(",null,",",null,")");b.push({i:S-4,x:ti(f,p)},{i:S-2,x:ti(h,y)})}else(p!==1||y!==1)&&x.push(s(x)+"scale("+p+","+y+")")}return function(f,h){var p=[],y=[];return f=e(f),h=e(h),o(f.translateX,f.translateY,h.translateX,h.translateY,p,y),l(f.rotate,h.rotate,p,y),c(f.skewX,h.skewX,p,y),u(f.scaleX,f.scaleY,h.scaleX,h.scaleY,p,y),f=h=null,function(x){for(var b=-1,S=y.length,E;++b<S;)p[(E=y[b]).i]=E.x(x);return p.join("")}}}var Eme=j8(Sme,"px, ","px)","deg)"),Cme=j8(wme,", ",")",")"),Tme=1e-12;function gL(e){return((e=Math.exp(e))+1/e)/2}function Nme(e){return((e=Math.exp(e))-1/e)/2}function Ome(e){return((e=Math.exp(2*e))-1)/(e+1)}const wy=(function e(t,n,r){function s(o,l){var c=o[0],u=o[1],f=o[2],h=l[0],p=l[1],y=l[2],x=h-c,b=p-u,S=x*x+b*b,E,C;if(S<Tme)C=Math.log(y/f)/t,E=function(A){return[c+A*x,u+A*b,f*Math.exp(t*A*C)]};else{var O=Math.sqrt(S),T=(y*y-f*f+r*S)/(2*f*n*O),R=(y*y-f*f-r*S)/(2*y*n*O),k=Math.log(Math.sqrt(T*T+1)-T),M=Math.log(Math.sqrt(R*R+1)-R);C=(M-k)/t,E=function(A){var I=A*C,L=gL(k),D=f/(n*O)*(L*Ome(t*I+k)-Nme(k));return[c+D*x,u+D*b,f*L/gL(t*I+k)]}}return E.duration=C*1e3*t/Math.SQRT2,E}return s.rho=function(o){var l=Math.max(.001,+o),c=l*l,u=c*c;return e(l,c,u)},s})(Math.SQRT2,2,4);var mf=0,Qh=0,Hh=0,P8=1e3,sx,Zh,ox=0,cu=0,Cb=0,zp=typeof performance=="object"&&performance.now?performance:Date,z8=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function QT(){return cu||(z8(Rme),cu=zp.now()+Cb)}function Rme(){cu=0}function ix(){this._call=this._time=this._next=null}ix.prototype=B8.prototype={constructor:ix,restart:function(e,t,n){if(typeof e!="function")throw new TypeError("callback is not a function");n=(n==null?QT():+n)+(t==null?0:+t),!this._next&&Zh!==this&&(Zh?Zh._next=this:sx=this,Zh=this),this._call=e,this._time=n,lC()},stop:function(){this._call&&(this._call=null,this._time=1/0,lC())}};function B8(e,t,n){var r=new ix;return r.restart(e,t,n),r}function Ame(){QT(),++mf;for(var e=sx,t;e;)(t=cu-e._time)>=0&&e._call.call(void 0,t),e=e._next;--mf}function yL(){cu=(ox=zp.now())+Cb,mf=Qh=0;try{Ame()}finally{mf=0,_me(),cu=0}}function kme(){var e=zp.now(),t=e-ox;t>P8&&(Cb-=t,ox=e)}function _me(){for(var e,t=sx,n,r=1/0;t;)t._call?(r>t._time&&(r=t._time),e=t,t=t._next):(n=t._next,t._next=null,t=e?e._next=n:sx=n);Zh=e,lC(r)}function lC(e){if(!mf){Qh&&(Qh=clearTimeout(Qh));var t=e-cu;t>24?(e<1/0&&(Qh=setTimeout(yL,e-zp.now()-Cb)),Hh&&(Hh=clearInterval(Hh))):(Hh||(ox=zp.now(),Hh=setInterval(kme,P8)),mf=1,z8(yL))}}function xL(e,t,n){var r=new ix;return t=t==null?0:+t,r.restart(s=>{r.stop(),e(s+t)},t,n),r}var Mme=wb("start","end","cancel","interrupt"),Ime=[],H8=0,bL=1,aC=2,Ey=3,vL=4,cC=5,Cy=6;function Tb(e,t,n,r,s,o){var l=e.__transition;if(!l)e.__transition={};else if(n in l)return;Lme(e,n,{name:t,index:r,group:s,on:Mme,tween:Ime,time:o.time,delay:o.delay,duration:o.duration,ease:o.ease,timer:null,state:H8})}function ZT(e,t){var n=Mo(e,t);if(n.state>H8)throw new Error("too late; already scheduled");return n}function pi(e,t){var n=Mo(e,t);if(n.state>Ey)throw new Error("too late; already running");return n}function Mo(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function Lme(e,t,n){var r=e.__transition,s;r[t]=n,n.timer=B8(o,0,n.time);function o(f){n.state=bL,n.timer.restart(l,n.delay,n.time),n.delay<=f&&l(f-n.delay)}function l(f){var h,p,y,x;if(n.state!==bL)return u();for(h in r)if(x=r[h],x.name===n.name){if(x.state===Ey)return xL(l);x.state===vL?(x.state=Cy,x.timer.stop(),x.on.call("interrupt",e,e.__data__,x.index,x.group),delete r[h]):+h<t&&(x.state=Cy,x.timer.stop(),x.on.call("cancel",e,e.__data__,x.index,x.group),delete r[h])}if(xL(function(){n.state===Ey&&(n.state=vL,n.timer.restart(c,n.delay,n.time),c(f))}),n.state=aC,n.on.call("start",e,e.__data__,n.index,n.group),n.state===aC){for(n.state=Ey,s=new Array(y=n.tween.length),h=0,p=-1;h<y;++h)(x=n.tween[h].value.call(e,e.__data__,n.index,n.group))&&(s[++p]=x);s.length=p+1}}function c(f){for(var h=f<n.duration?n.ease.call(null,f/n.duration):(n.timer.restart(u),n.state=cC,1),p=-1,y=s.length;++p<y;)s[p].call(e,h);n.state===cC&&(n.on.call("end",e,e.__data__,n.index,n.group),u())}function u(){n.state=Cy,n.timer.stop(),delete r[t];for(var f in r)return;delete e.__transition}}function Ty(e,t){var n=e.__transition,r,s,o=!0,l;if(n){t=t==null?null:t+"";for(l in n){if((r=n[l]).name!==t){o=!1;continue}s=r.state>aC&&r.state<cC,r.state=Cy,r.timer.stop(),r.on.call(s?"interrupt":"cancel",e,e.__data__,r.index,r.group),delete n[l]}o&&delete e.__transition}}function Dme(e){return this.each(function(){Ty(this,e)})}function jme(e,t){var n,r;return function(){var s=pi(this,e),o=s.tween;if(o!==n){r=n=o;for(var l=0,c=r.length;l<c;++l)if(r[l].name===t){r=r.slice(),r.splice(l,1);break}}s.tween=r}}function Pme(e,t,n){var r,s;if(typeof n!="function")throw new Error;return function(){var o=pi(this,e),l=o.tween;if(l!==r){s=(r=l).slice();for(var c={name:t,value:n},u=0,f=s.length;u<f;++u)if(s[u].name===t){s[u]=c;break}u===f&&s.push(c)}o.tween=s}}function zme(e,t){var n=this._id;if(e+="",arguments.length<2){for(var r=Mo(this.node(),n).tween,s=0,o=r.length,l;s<o;++s)if((l=r[s]).name===e)return l.value;return null}return this.each((t==null?jme:Pme)(n,e,t))}function JT(e,t,n){var r=e._id;return e.each(function(){var s=pi(this,r);(s.value||(s.value={}))[t]=n.apply(this,arguments)}),function(s){return Mo(s,r).value[t]}}function F8(e,t){var n;return(typeof t=="number"?ti:t instanceof au?rx:(n=au(t))?(t=n,rx):L8)(e,t)}function Bme(e){return function(){this.removeAttribute(e)}}function Hme(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Fme(e,t,n){var r,s=n+"",o;return function(){var l=this.getAttribute(e);return l===s?null:l===r?o:o=t(r=l,n)}}function $me(e,t,n){var r,s=n+"",o;return function(){var l=this.getAttributeNS(e.space,e.local);return l===s?null:l===r?o:o=t(r=l,n)}}function Ume(e,t,n){var r,s,o;return function(){var l,c=n(this),u;return c==null?void this.removeAttribute(e):(l=this.getAttribute(e),u=c+"",l===u?null:l===r&&u===s?o:(s=u,o=t(r=l,c)))}}function Vme(e,t,n){var r,s,o;return function(){var l,c=n(this),u;return c==null?void this.removeAttributeNS(e.space,e.local):(l=this.getAttributeNS(e.space,e.local),u=c+"",l===u?null:l===r&&u===s?o:(s=u,o=t(r=l,c)))}}function qme(e,t){var n=Eb(e),r=n==="transform"?Cme:F8;return this.attrTween(e,typeof t=="function"?(n.local?Vme:Ume)(n,r,JT(this,"attr."+e,t)):t==null?(n.local?Hme:Bme)(n):(n.local?$me:Fme)(n,r,t))}function Gme(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function Kme(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function Yme(e,t){var n,r;function s(){var o=t.apply(this,arguments);return o!==r&&(n=(r=o)&&Kme(e,o)),n}return s._value=t,s}function Wme(e,t){var n,r;function s(){var o=t.apply(this,arguments);return o!==r&&(n=(r=o)&&Gme(e,o)),n}return s._value=t,s}function Xme(e,t){var n="attr."+e;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(t==null)return this.tween(n,null);if(typeof t!="function")throw new Error;var r=Eb(e);return this.tween(n,(r.local?Yme:Wme)(r,t))}function Qme(e,t){return function(){ZT(this,e).delay=+t.apply(this,arguments)}}function Zme(e,t){return t=+t,function(){ZT(this,e).delay=t}}function Jme(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?Qme:Zme)(t,e)):Mo(this.node(),t).delay}function ege(e,t){return function(){pi(this,e).duration=+t.apply(this,arguments)}}function tge(e,t){return t=+t,function(){pi(this,e).duration=t}}function nge(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?ege:tge)(t,e)):Mo(this.node(),t).duration}function rge(e,t){if(typeof t!="function")throw new Error;return function(){pi(this,e).ease=t}}function sge(e){var t=this._id;return arguments.length?this.each(rge(t,e)):Mo(this.node(),t).ease}function oge(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!="function")throw new Error;pi(this,e).ease=n}}function ige(e){if(typeof e!="function")throw new Error;return this.each(oge(this._id,e))}function lge(e){typeof e!="function"&&(e=x8(e));for(var t=this._groups,n=t.length,r=new Array(n),s=0;s<n;++s)for(var o=t[s],l=o.length,c=r[s]=[],u,f=0;f<l;++f)(u=o[f])&&e.call(u,u.__data__,f,o)&&c.push(u);return new dl(r,this._parents,this._name,this._id)}function age(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,n=e._groups,r=t.length,s=n.length,o=Math.min(r,s),l=new Array(r),c=0;c<o;++c)for(var u=t[c],f=n[c],h=u.length,p=l[c]=new Array(h),y,x=0;x<h;++x)(y=u[x]||f[x])&&(p[x]=y);for(;c<r;++c)l[c]=t[c];return new dl(l,this._parents,this._name,this._id)}function cge(e){return(e+"").trim().split(/^|\s+/).every(function(t){var n=t.indexOf(".");return n>=0&&(t=t.slice(0,n)),!t||t==="start"})}function uge(e,t,n){var r,s,o=cge(t)?ZT:pi;return function(){var l=o(this,e),c=l.on;c!==r&&(s=(r=c).copy()).on(t,n),l.on=s}}function dge(e,t){var n=this._id;return arguments.length<2?Mo(this.node(),n).on.on(e):this.each(uge(n,e,t))}function fge(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function hge(){return this.on("end.remove",fge(this._id))}function pge(e){var t=this._name,n=this._id;typeof e!="function"&&(e=KT(e));for(var r=this._groups,s=r.length,o=new Array(s),l=0;l<s;++l)for(var c=r[l],u=c.length,f=o[l]=new Array(u),h,p,y=0;y<u;++y)(h=c[y])&&(p=e.call(h,h.__data__,y,c))&&("__data__"in h&&(p.__data__=h.__data__),f[y]=p,Tb(f[y],t,n,y,f,Mo(h,n)));return new dl(o,this._parents,t,n)}function mge(e){var t=this._name,n=this._id;typeof e!="function"&&(e=y8(e));for(var r=this._groups,s=r.length,o=[],l=[],c=0;c<s;++c)for(var u=r[c],f=u.length,h,p=0;p<f;++p)if(h=u[p]){for(var y=e.call(h,h.__data__,p,u),x,b=Mo(h,n),S=0,E=y.length;S<E;++S)(x=y[S])&&Tb(x,t,n,S,y,b);o.push(y),l.push(h)}return new dl(o,l,t,n)}var gge=Bm.prototype.constructor;function yge(){return new gge(this._groups,this._parents)}function xge(e,t){var n,r,s;return function(){var o=pf(this,e),l=(this.style.removeProperty(e),pf(this,e));return o===l?null:o===n&&l===r?s:s=t(n=o,r=l)}}function $8(e){return function(){this.style.removeProperty(e)}}function bge(e,t,n){var r,s=n+"",o;return function(){var l=pf(this,e);return l===s?null:l===r?o:o=t(r=l,n)}}function vge(e,t,n){var r,s,o;return function(){var l=pf(this,e),c=n(this),u=c+"";return c==null&&(u=c=(this.style.removeProperty(e),pf(this,e))),l===u?null:l===r&&u===s?o:(s=u,o=t(r=l,c))}}function Sge(e,t){var n,r,s,o="style."+t,l="end."+o,c;return function(){var u=pi(this,e),f=u.on,h=u.value[o]==null?c||(c=$8(t)):void 0;(f!==n||s!==h)&&(r=(n=f).copy()).on(l,s=h),u.on=r}}function wge(e,t,n){var r=(e+="")=="transform"?Eme:F8;return t==null?this.styleTween(e,xge(e,r)).on("end.style."+e,$8(e)):typeof t=="function"?this.styleTween(e,vge(e,r,JT(this,"style."+e,t))).each(Sge(this._id,e)):this.styleTween(e,bge(e,r,t),n).on("end.style."+e,null)}function Ege(e,t,n){return function(r){this.style.setProperty(e,t.call(this,r),n)}}function Cge(e,t,n){var r,s;function o(){var l=t.apply(this,arguments);return l!==s&&(r=(s=l)&&Ege(e,l,n)),r}return o._value=t,o}function Tge(e,t,n){var r="style."+(e+="");if(arguments.length<2)return(r=this.tween(r))&&r._value;if(t==null)return this.tween(r,null);if(typeof t!="function")throw new Error;return this.tween(r,Cge(e,t,n??""))}function Nge(e){return function(){this.textContent=e}}function Oge(e){return function(){var t=e(this);this.textContent=t??""}}function Rge(e){return this.tween("text",typeof e=="function"?Oge(JT(this,"text",e)):Nge(e==null?"":e+""))}function Age(e){return function(t){this.textContent=e.call(this,t)}}function kge(e){var t,n;function r(){var s=e.apply(this,arguments);return s!==n&&(t=(n=s)&&Age(s)),t}return r._value=e,r}function _ge(e){var t="text";if(arguments.length<1)return(t=this.tween(t))&&t._value;if(e==null)return this.tween(t,null);if(typeof e!="function")throw new Error;return this.tween(t,kge(e))}function Mge(){for(var e=this._name,t=this._id,n=U8(),r=this._groups,s=r.length,o=0;o<s;++o)for(var l=r[o],c=l.length,u,f=0;f<c;++f)if(u=l[f]){var h=Mo(u,t);Tb(u,e,n,f,l,{time:h.time+h.delay+h.duration,delay:0,duration:h.duration,ease:h.ease})}return new dl(r,this._parents,e,n)}function Ige(){var e,t,n=this,r=n._id,s=n.size();return new Promise(function(o,l){var c={value:l},u={value:function(){--s===0&&o()}};n.each(function(){var f=pi(this,r),h=f.on;h!==e&&(t=(e=h).copy(),t._.cancel.push(c),t._.interrupt.push(c),t._.end.push(u)),f.on=t}),s===0&&o()})}var Lge=0;function dl(e,t,n,r){this._groups=e,this._parents=t,this._name=n,this._id=r}function U8(){return++Lge}var ji=Bm.prototype;dl.prototype={constructor:dl,select:pge,selectAll:mge,selectChild:ji.selectChild,selectChildren:ji.selectChildren,filter:lge,merge:age,selection:yge,transition:Mge,call:ji.call,nodes:ji.nodes,node:ji.node,size:ji.size,empty:ji.empty,each:ji.each,on:dge,attr:qme,attrTween:Xme,style:wge,styleTween:Tge,text:Rge,textTween:_ge,remove:hge,tween:zme,delay:Jme,duration:nge,ease:sge,easeVarying:ige,end:Ige,[Symbol.iterator]:ji[Symbol.iterator]};function Dge(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var jge={time:null,delay:0,duration:250,ease:Dge};function Pge(e,t){for(var n;!(n=e.__transition)||!(n=n[t]);)if(!(e=e.parentNode))throw new Error(`transition ${t} not found`);return n}function zge(e){var t,n;e instanceof dl?(t=e._id,e=e._name):(t=U8(),(n=jge).time=QT(),e=e==null?null:e+"");for(var r=this._groups,s=r.length,o=0;o<s;++o)for(var l=r[o],c=l.length,u,f=0;f<c;++f)(u=l[f])&&Tb(u,e,t,f,l,n||Pge(u,t));return new dl(r,this._parents,e,t)}Bm.prototype.interrupt=Dme;Bm.prototype.transition=zge;const K0=e=>()=>e;function Bge(e,{sourceEvent:t,target:n,transform:r,dispatch:s}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:r,enumerable:!0,configurable:!0},_:{value:s}})}function Ki(e,t,n){this.k=e,this.x=t,this.y=n}Ki.prototype={constructor:Ki,scale:function(e){return e===1?this:new Ki(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new Ki(this.k,this.x+this.k*e,this.y+this.k*t)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var Nb=new Ki(1,0,0);V8.prototype=Ki.prototype;function V8(e){for(;!e.__zoom;)if(!(e=e.parentNode))return Nb;return e.__zoom}function iw(e){e.stopImmediatePropagation()}function Fh(e){e.preventDefault(),e.stopImmediatePropagation()}function Hge(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function Fge(){var e=this;return e instanceof SVGElement?(e=e.ownerSVGElement||e,e.hasAttribute("viewBox")?(e=e.viewBox.baseVal,[[e.x,e.y],[e.x+e.width,e.y+e.height]]):[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]):[[0,0],[e.clientWidth,e.clientHeight]]}function SL(){return this.__zoom||Nb}function $ge(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function Uge(){return navigator.maxTouchPoints||"ontouchstart"in this}function Vge(e,t,n){var r=e.invertX(t[0][0])-n[0][0],s=e.invertX(t[1][0])-n[1][0],o=e.invertY(t[0][1])-n[0][1],l=e.invertY(t[1][1])-n[1][1];return e.translate(s>r?(r+s)/2:Math.min(0,r)||Math.max(0,s),l>o?(o+l)/2:Math.min(0,o)||Math.max(0,l))}function q8(){var e=Hge,t=Fge,n=Vge,r=$ge,s=Uge,o=[0,1/0],l=[[-1/0,-1/0],[1/0,1/0]],c=250,u=wy,f=wb("start","zoom","end"),h,p,y,x=500,b=150,S=0,E=10;function C(j){j.property("__zoom",SL).on("wheel.zoom",I,{passive:!1}).on("mousedown.zoom",L).on("dblclick.zoom",D).filter(s).on("touchstart.zoom",P).on("touchmove.zoom",z).on("touchend.zoom touchcancel.zoom",$).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}C.transform=function(j,H,B,V){var G=j.selection?j.selection():j;G.property("__zoom",SL),j!==G?k(j,H,B,V):G.interrupt().each(function(){M(this,arguments).event(V).start().zoom(null,typeof H=="function"?H.apply(this,arguments):H).end()})},C.scaleBy=function(j,H,B,V){C.scaleTo(j,function(){var G=this.__zoom.k,q=typeof H=="function"?H.apply(this,arguments):H;return G*q},B,V)},C.scaleTo=function(j,H,B,V){C.transform(j,function(){var G=t.apply(this,arguments),q=this.__zoom,K=B==null?R(G):typeof B=="function"?B.apply(this,arguments):B,W=q.invert(K),ee=typeof H=="function"?H.apply(this,arguments):H;return n(T(O(q,ee),K,W),G,l)},B,V)},C.translateBy=function(j,H,B,V){C.transform(j,function(){return n(this.__zoom.translate(typeof H=="function"?H.apply(this,arguments):H,typeof B=="function"?B.apply(this,arguments):B),t.apply(this,arguments),l)},null,V)},C.translateTo=function(j,H,B,V,G){C.transform(j,function(){var q=t.apply(this,arguments),K=this.__zoom,W=V==null?R(q):typeof V=="function"?V.apply(this,arguments):V;return n(Nb.translate(W[0],W[1]).scale(K.k).translate(typeof H=="function"?-H.apply(this,arguments):-H,typeof B=="function"?-B.apply(this,arguments):-B),q,l)},V,G)};function O(j,H){return H=Math.max(o[0],Math.min(o[1],H)),H===j.k?j:new Ki(H,j.x,j.y)}function T(j,H,B){var V=H[0]-B[0]*j.k,G=H[1]-B[1]*j.k;return V===j.x&&G===j.y?j:new Ki(j.k,V,G)}function R(j){return[(+j[0][0]+ +j[1][0])/2,(+j[0][1]+ +j[1][1])/2]}function k(j,H,B,V){j.on("start.zoom",function(){M(this,arguments).event(V).start()}).on("interrupt.zoom end.zoom",function(){M(this,arguments).event(V).end()}).tween("zoom",function(){var G=this,q=arguments,K=M(G,q).event(V),W=t.apply(G,q),ee=B==null?R(W):typeof B=="function"?B.apply(G,q):B,ce=Math.max(W[1][0]-W[0][0],W[1][1]-W[0][1]),F=G.__zoom,X=typeof H=="function"?H.apply(G,q):H,te=u(F.invert(ee).concat(ce/F.k),X.invert(ee).concat(ce/X.k));return function(Z){if(Z===1)Z=X;else{var Y=te(Z),le=ce/Y[2];Z=new Ki(le,ee[0]-Y[0]*le,ee[1]-Y[1]*le)}K.zoom(null,Z)}})}function M(j,H,B){return!B&&j.__zooming||new A(j,H)}function A(j,H){this.that=j,this.args=H,this.active=0,this.sourceEvent=null,this.extent=t.apply(j,H),this.taps=0}A.prototype={event:function(j){return j&&(this.sourceEvent=j),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(j,H){return this.mouse&&j!=="mouse"&&(this.mouse[1]=H.invert(this.mouse[0])),this.touch0&&j!=="touch"&&(this.touch0[1]=H.invert(this.touch0[0])),this.touch1&&j!=="touch"&&(this.touch1[1]=H.invert(this.touch1[0])),this.that.__zoom=H,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(j){var H=zs(this.that).datum();f.call(j,this.that,new Bge(j,{sourceEvent:this.sourceEvent,target:C,transform:this.that.__zoom,dispatch:f}),H)}};function I(j,...H){if(!e.apply(this,arguments))return;var B=M(this,H).event(j),V=this.__zoom,G=Math.max(o[0],Math.min(o[1],V.k*Math.pow(2,r.apply(this,arguments)))),q=wo(j);if(B.wheel)(B.mouse[0][0]!==q[0]||B.mouse[0][1]!==q[1])&&(B.mouse[1]=V.invert(B.mouse[0]=q)),clearTimeout(B.wheel);else{if(V.k===G)return;B.mouse=[q,V.invert(q)],Ty(this),B.start()}Fh(j),B.wheel=setTimeout(K,b),B.zoom("mouse",n(T(O(V,G),B.mouse[0],B.mouse[1]),B.extent,l));function K(){B.wheel=null,B.end()}}function L(j,...H){if(y||!e.apply(this,arguments))return;var B=j.currentTarget,V=M(this,H,!0).event(j),G=zs(j.view).on("mousemove.zoom",ee,!0).on("mouseup.zoom",ce,!0),q=wo(j,B),K=j.clientX,W=j.clientY;R8(j.view),iw(j),V.mouse=[q,this.__zoom.invert(q)],Ty(this),V.start();function ee(F){if(Fh(F),!V.moved){var X=F.clientX-K,te=F.clientY-W;V.moved=X*X+te*te>S}V.event(F).zoom("mouse",n(T(V.that.__zoom,V.mouse[0]=wo(F,B),V.mouse[1]),V.extent,l))}function ce(F){G.on("mousemove.zoom mouseup.zoom",null),A8(F.view,V.moved),Fh(F),V.event(F).end()}}function D(j,...H){if(e.apply(this,arguments)){var B=this.__zoom,V=wo(j.changedTouches?j.changedTouches[0]:j,this),G=B.invert(V),q=B.k*(j.shiftKey?.5:2),K=n(T(O(B,q),V,G),t.apply(this,H),l);Fh(j),c>0?zs(this).transition().duration(c).call(k,K,V,j):zs(this).call(C.transform,K,V,j)}}function P(j,...H){if(e.apply(this,arguments)){var B=j.touches,V=B.length,G=M(this,H,j.changedTouches.length===V).event(j),q,K,W,ee;for(iw(j),K=0;K<V;++K)W=B[K],ee=wo(W,this),ee=[ee,this.__zoom.invert(ee),W.identifier],G.touch0?!G.touch1&&G.touch0[2]!==ee[2]&&(G.touch1=ee,G.taps=0):(G.touch0=ee,q=!0,G.taps=1+!!h);h&&(h=clearTimeout(h)),q&&(G.taps<2&&(p=ee[0],h=setTimeout(function(){h=null},x)),Ty(this),G.start())}}function z(j,...H){if(this.__zooming){var B=M(this,H).event(j),V=j.changedTouches,G=V.length,q,K,W,ee;for(Fh(j),q=0;q<G;++q)K=V[q],W=wo(K,this),B.touch0&&B.touch0[2]===K.identifier?B.touch0[0]=W:B.touch1&&B.touch1[2]===K.identifier&&(B.touch1[0]=W);if(K=B.that.__zoom,B.touch1){var ce=B.touch0[0],F=B.touch0[1],X=B.touch1[0],te=B.touch1[1],Z=(Z=X[0]-ce[0])*Z+(Z=X[1]-ce[1])*Z,Y=(Y=te[0]-F[0])*Y+(Y=te[1]-F[1])*Y;K=O(K,Math.sqrt(Z/Y)),W=[(ce[0]+X[0])/2,(ce[1]+X[1])/2],ee=[(F[0]+te[0])/2,(F[1]+te[1])/2]}else if(B.touch0)W=B.touch0[0],ee=B.touch0[1];else return;B.zoom("touch",n(T(K,W,ee),B.extent,l))}}function $(j,...H){if(this.__zooming){var B=M(this,H).event(j),V=j.changedTouches,G=V.length,q,K;for(iw(j),y&&clearTimeout(y),y=setTimeout(function(){y=null},x),q=0;q<G;++q)K=V[q],B.touch0&&B.touch0[2]===K.identifier?delete B.touch0:B.touch1&&B.touch1[2]===K.identifier&&delete B.touch1;if(B.touch1&&!B.touch0&&(B.touch0=B.touch1,delete B.touch1),B.touch0)B.touch0[1]=this.__zoom.invert(B.touch0[0]);else if(B.end(),B.taps===2&&(K=wo(K,this),Math.hypot(p[0]-K[0],p[1]-K[1])<E)){var W=zs(this).on("dblclick.zoom");W&&W.apply(this,arguments)}}}return C.wheelDelta=function(j){return arguments.length?(r=typeof j=="function"?j:K0(+j),C):r},C.filter=function(j){return arguments.length?(e=typeof j=="function"?j:K0(!!j),C):e},C.touchable=function(j){return arguments.length?(s=typeof j=="function"?j:K0(!!j),C):s},C.extent=function(j){return arguments.length?(t=typeof j=="function"?j:K0([[+j[0][0],+j[0][1]],[+j[1][0],+j[1][1]]]),C):t},C.scaleExtent=function(j){return arguments.length?(o[0]=+j[0],o[1]=+j[1],C):[o[0],o[1]]},C.translateExtent=function(j){return arguments.length?(l[0][0]=+j[0][0],l[1][0]=+j[1][0],l[0][1]=+j[0][1],l[1][1]=+j[1][1],C):[[l[0][0],l[0][1]],[l[1][0],l[1][1]]]},C.constrain=function(j){return arguments.length?(n=j,C):n},C.duration=function(j){return arguments.length?(c=+j,C):c},C.interpolate=function(j){return arguments.length?(u=j,C):u},C.on=function(){var j=f.on.apply(f,arguments);return j===f?C:j},C.clickDistance=function(j){return arguments.length?(S=(j=+j)*j,C):Math.sqrt(S)},C.tapDistance=function(j){return arguments.length?(E=+j,C):E},C}const ko={error001:(e="react")=>`Seems like you have not used ${e==="svelte"?"SvelteFlowProvider":"ReactFlowProvider"} as an ancestor. Help: https://${e}flow.dev/error#001`,error002:()=>"It looks like you've created a new nodeTypes or edgeTypes object. If this wasn't on purpose please define the nodeTypes/edgeTypes outside of the component or memoize them.",error003:e=>`Node type "${e}" not found. Using fallback type "default".`,error004:()=>"The parent container needs a width and a height to render the graph.",error005:()=>"Only child nodes can use a parent extent.",error006:()=>"Can't create edge. An edge needs a source and a target.",error007:e=>`The old edge with id=${e} does not exist.`,error009:e=>`Marker type "${e}" doesn't exist.`,error008:(e,{id:t,sourceHandle:n,targetHandle:r})=>`Couldn't create edge for ${e} handle id: "${e==="source"?n:r}", edge id: ${t}.`,error010:()=>"Handle: No node id found. Make sure to only use a Handle inside a custom Node.",error011:e=>`Edge type "${e}" not found. Using fallback type "default".`,error012:e=>`Node with id "${e}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`,error013:(e="react")=>`It seems that you haven't loaded the styles. Please import '@xyflow/${e}/dist/style.css' or base.css to make sure everything is working properly.`,error014:()=>"useNodeConnections: No node ID found. Call useNodeConnections inside a custom Node or provide a node ID.",error015:()=>"It seems that you are trying to drag a node that is not initialized. Please use onNodesChange as explained in the docs.",error016:e=>`Edge with id "${e}" does not exist, it may have been removed. This can happen when an edge is deleted before the "onEdgeClick" handler is called.`},Bp=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],G8=["Enter"," ","Escape"],K8={"node.a11yDescription.default":"Press enter or space to select a node. Press delete to remove it and escape to cancel.","node.a11yDescription.keyboardDisabled":"Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.","node.a11yDescription.ariaLiveMessage":({direction:e,x:t,y:n})=>`Moved selected node ${e}. New position, x: ${t}, y: ${n}`,"edge.a11yDescription.default":"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.","controls.ariaLabel":"Control Panel","controls.zoomIn.ariaLabel":"Zoom In","controls.zoomOut.ariaLabel":"Zoom Out","controls.fitView.ariaLabel":"Fit View","controls.interactive.ariaLabel":"Toggle Interactivity","minimap.ariaLabel":"Mini Map","handle.ariaLabel":"Handle"};var gf;(function(e){e.Strict="strict",e.Loose="loose"})(gf||(gf={}));var Zc;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(Zc||(Zc={}));var Hp;(function(e){e.Partial="partial",e.Full="full"})(Hp||(Hp={}));const Y8={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null};var da;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(da||(da={}));var lx;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(lx||(lx={}));var Ge;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(Ge||(Ge={}));const wL={[Ge.Left]:Ge.Right,[Ge.Right]:Ge.Left,[Ge.Top]:Ge.Bottom,[Ge.Bottom]:Ge.Top},W8=e=>!!e&&typeof e=="object"&&"id"in e&&"source"in e&&"target"in e,qge=e=>!!e&&typeof e=="object"&&"id"in e&&"position"in e&&!("source"in e)&&!("target"in e),eN=e=>!!e&&typeof e=="object"&&"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e),Fm=(e,t=[0,0])=>{const{width:n,height:r}=Io(e),s=e.origin??t,o=n*s[0],l=r*s[1];return{x:e.position.x-o,y:e.position.y-l}},Gge=(e,t={nodeOrigin:[0,0]})=>{if(e.length===0)return{x:0,y:0,width:0,height:0};let n=!1;const r=e.reduce((s,o)=>{const l=typeof o=="string";let c=!t.nodeLookup&&!l?o:void 0;return t.nodeLookup&&(c=l?t.nodeLookup.get(o):eN(o)?o:t.nodeLookup.get(o.id)),c?(n=!0,Ob(s,ax(c,t.nodeOrigin))):s},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return n?Rb(r):{x:0,y:0,width:0,height:0}},$m=(e,t={})=>{let n={x:1/0,y:1/0,x2:-1/0,y2:-1/0},r=!1;return e.forEach(s=>{(t.filter===void 0||t.filter(s))&&(n=Ob(n,ax(s)),r=!0)}),r?Rb(n):{x:0,y:0,width:0,height:0}},tN=(e,t,[n,r,s]=[0,0,1],o=!1,l=!1)=>{const c=(t.x-n)/s,u=(t.y-r)/s,f=t.width/s,h=t.height/s,p=[];for(const y of e.values()){const{measured:x,selectable:b=!0,hidden:S=!1}=y;if(l&&!b||S)continue;const E=x.width??y.width??y.initialWidth??0,C=x.height??y.height??y.initialHeight??0,{x:O,y:T}=y.internals.positionAbsolute,R=J8(c,u,f,h,O,T,E,C),k=E*C,M=o&&R>0;(!y.internals.handleBounds||M||R>=k||y.dragging)&&p.push(y)}return p},Kge=(e,t)=>{const n=new Set;return e.forEach(r=>{n.add(r.id)}),t.filter(r=>n.has(r.source)||n.has(r.target))};function Yge(e,t){const n=new Map,r=t!=null&&t.nodes?new Set(t.nodes.map(s=>s.id)):null;return e.forEach(s=>{let o;if(t!=null&&t.includeHiddenNodes){const{width:l,height:c}=Io(s);o=l>0&&c>0}else o=!!(s.measured.width&&s.measured.height&&!s.hidden);o&&(!r||r.has(s.id))&&n.set(s.id,s)}),n}async function Wge({nodes:e,width:t,height:n,panZoom:r,minZoom:s,maxZoom:o},l){if(e.size===0)return!0;const c=Yge(e,l),u=$m(c),f=rN(u,t,n,(l==null?void 0:l.minZoom)??s,(l==null?void 0:l.maxZoom)??o,(l==null?void 0:l.padding)??.1);return await r.setViewport(f,{duration:l==null?void 0:l.duration,ease:l==null?void 0:l.ease,interpolate:l==null?void 0:l.interpolate}),!0}function X8({nodeId:e,nextPosition:t,nodeLookup:n,nodeOrigin:r=[0,0],nodeExtent:s,onError:o}){const l=n.get(e),c=l.parentId?n.get(l.parentId):void 0,{x:u,y:f}=c?c.internals.positionAbsolute:{x:0,y:0},h=l.origin??r;let p=l.extent||s;if(l.extent==="parent"&&!l.expandParent)if(!c)o==null||o("005",ko.error005());else{const{width:x,height:b}=Io(c);x&&b&&(p=[[u,f],[u+x,f+b]])}else c&&du(l.extent)&&(p=[[l.extent[0][0]+u,l.extent[0][1]+f],[l.extent[1][0]+u,l.extent[1][1]+f]]);const y=du(p)?uu(t,p,l.measured):t;return(l.measured.width===void 0||l.measured.height===void 0)&&(o==null||o("015",ko.error015())),{position:{x:y.x-u+(l.measured.width??0)*h[0],y:y.y-f+(l.measured.height??0)*h[1]},positionAbsolute:y}}async function Xge({nodesToRemove:e=[],edgesToRemove:t=[],nodes:n,edges:r,onBeforeDelete:s}){const o=new Set(e.map(y=>y.id)),l=[];for(const y of n){if(y.deletable===!1)continue;const x=o.has(y.id),b=!x&&y.parentId&&l.find(S=>S.id===y.parentId);(x||b)&&l.push(y)}const c=new Set(t.map(y=>y.id)),u=r.filter(y=>y.deletable!==!1),h=Kge(l,u);for(const y of u)c.has(y.id)&&!h.find(b=>b.id===y.id)&&h.push(y);if(!s)return{edges:h,nodes:l};const p=await s({nodes:l,edges:h});return typeof p=="boolean"?p?{edges:h,nodes:l}:{edges:[],nodes:[]}:p}const yf=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),uu=(e={x:0,y:0},t,n)=>({x:yf(e.x,t[0][0],t[1][0]-((n==null?void 0:n.width)??0)),y:yf(e.y,t[0][1],t[1][1]-((n==null?void 0:n.height)??0))});function Q8(e,t,n){const{width:r,height:s}=Io(n),{x:o,y:l}=n.internals.positionAbsolute;return uu(e,[[o,l],[o+r,l+s]],t)}const EL=(e,t,n)=>e<t?yf(Math.abs(e-t),1,t)/t:e>n?-yf(Math.abs(e-n),1,t)/t:0,nN=(e,t,n=15,r=40)=>{const s=EL(e.x,r,t.width-r)*n,o=EL(e.y,r,t.height-r)*n;return[s,o]},Ob=(e,t)=>({x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x2,t.x2),y2:Math.max(e.y2,t.y2)}),uC=({x:e,y:t,width:n,height:r})=>({x:e,y:t,x2:e+n,y2:t+r}),Rb=({x:e,y:t,x2:n,y2:r})=>({x:e,y:t,width:n-e,height:r-t}),Fp=(e,t=[0,0])=>{var s,o;const{x:n,y:r}=eN(e)?e.internals.positionAbsolute:Fm(e,t);return{x:n,y:r,width:((s=e.measured)==null?void 0:s.width)??e.width??e.initialWidth??0,height:((o=e.measured)==null?void 0:o.height)??e.height??e.initialHeight??0}},ax=(e,t=[0,0])=>{var s,o;const{x:n,y:r}=eN(e)?e.internals.positionAbsolute:Fm(e,t);return{x:n,y:r,x2:n+(((s=e.measured)==null?void 0:s.width)??e.width??e.initialWidth??0),y2:r+(((o=e.measured)==null?void 0:o.height)??e.height??e.initialHeight??0)}},Z8=(e,t)=>Rb(Ob(uC(e),uC(t))),J8=(e,t,n,r,s,o,l,c)=>{const u=Math.max(0,Math.min(e+n,s+l)-Math.max(e,s)),f=Math.max(0,Math.min(t+r,o+c)-Math.max(t,o));return Math.ceil(u*f)},cx=(e,t)=>J8(e.x,e.y,e.width,e.height,t.x,t.y,t.width,t.height),CL=e=>To(e.width)&&To(e.height)&&To(e.x)&&To(e.y),To=e=>!isNaN(e)&&isFinite(e),eH=(e,t)=>(n,r)=>{},Um=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),Vm=({x:e,y:t},[n,r,s],o=!1,l=[1,1])=>{const c={x:(e-n)/s,y:(t-r)/s};return o?Um(c,l):c},xf=({x:e,y:t},[n,r,s])=>({x:e*s+n,y:t*s+r});function xd(e,t){if(typeof e=="number")return Math.floor((t-t/(1+e))*.5);if(typeof e=="string"&&e.endsWith("px")){const n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(n)}if(typeof e=="string"&&e.endsWith("%")){const n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(t*n*.01)}return console.error(`The padding value "${e}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}function Qge(e,t,n){if(typeof e=="string"||typeof e=="number"){const r=xd(e,n),s=xd(e,t);return{top:r,right:s,bottom:r,left:s,x:s*2,y:r*2}}if(typeof e=="object"){const r=xd(e.top??e.y??0,n),s=xd(e.bottom??e.y??0,n),o=xd(e.left??e.x??0,t),l=xd(e.right??e.x??0,t);return{top:r,right:l,bottom:s,left:o,x:o+l,y:r+s}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function Zge(e,t,n,r,s,o){const{x:l,y:c}=xf(e,[t,n,r]),{x:u,y:f}=xf({x:e.x+e.width,y:e.y+e.height},[t,n,r]),h=s-u,p=o-f;return{left:Math.floor(l),top:Math.floor(c),right:Math.floor(h),bottom:Math.floor(p)}}const rN=(e,t,n,r,s,o)=>{const l=Qge(o,t,n),c=(t-l.x)/e.width,u=(n-l.y)/e.height,f=Math.min(c,u),h=yf(f,r,s),p=e.x+e.width/2,y=e.y+e.height/2,x=t/2-p*h,b=n/2-y*h,S=Zge(e,x,b,h,t,n),E={left:Math.min(S.left-l.left,0),top:Math.min(S.top-l.top,0),right:Math.min(S.right-l.right,0),bottom:Math.min(S.bottom-l.bottom,0)};return{x:x-E.left+E.right,y:b-E.top+E.bottom,zoom:h}},$p=()=>{var e;return typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)==null?void 0:e.indexOf("Mac"))>=0};function du(e){return e!=null&&e!=="parent"}function Io(e){var t,n;return{width:((t=e.measured)==null?void 0:t.width)??e.width??e.initialWidth??0,height:((n=e.measured)==null?void 0:n.height)??e.height??e.initialHeight??0}}function tH(e){var t,n;return(((t=e.measured)==null?void 0:t.width)??e.width??e.initialWidth)!==void 0&&(((n=e.measured)==null?void 0:n.height)??e.height??e.initialHeight)!==void 0}function nH(e,t={width:0,height:0},n,r,s){const o={...e},l=r.get(n);if(l){const c=l.origin||s;o.x+=l.internals.positionAbsolute.x-(t.width??0)*c[0],o.y+=l.internals.positionAbsolute.y-(t.height??0)*c[1]}return o}function TL(e,t){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}function Jge(){let e,t;return{promise:new Promise((r,s)=>{e=r,t=s}),resolve:e,reject:t}}function e0e(e){return{...K8,...e||{}}}function rH(e){return e===null?null:e?"valid":"invalid"}function hp(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:r,containerBounds:s}){const{x:o,y:l}=No(e),c=Vm({x:o-((s==null?void 0:s.left)??0),y:l-((s==null?void 0:s.top)??0)},r),{x:u,y:f}=n?Um(c,t):c;return{xSnapped:u,ySnapped:f,...c}}const sN=e=>({width:e.offsetWidth,height:e.offsetHeight}),sH=e=>{var t;return((t=e==null?void 0:e.getRootNode)==null?void 0:t.call(e))||(window==null?void 0:window.document)},t0e=["INPUT","SELECT","TEXTAREA"];function oH(e){var r,s;const t=((s=(r=e.composedPath)==null?void 0:r.call(e))==null?void 0:s[0])||e.target;return(t==null?void 0:t.nodeType)!==1?!1:t0e.includes(t.nodeName)||t.hasAttribute("contenteditable")||!!t.closest(".nokey")}const iH=e=>"clientX"in e,No=(e,t)=>{var o,l;const n=iH(e),r=n?e.clientX:(o=e.touches)==null?void 0:o[0].clientX,s=n?e.clientY:(l=e.touches)==null?void 0:l[0].clientY;return{x:r-((t==null?void 0:t.left)??0),y:s-((t==null?void 0:t.top)??0)}},NL=(e,t,n,r,s)=>{const o=t.querySelectorAll(`.${e}`);return!o||!o.length?null:Array.from(o).map(l=>{const c=l.getBoundingClientRect();return{id:l.getAttribute("data-handleid"),type:e,nodeId:s,position:l.getAttribute("data-handlepos"),x:(c.left-n.left)/r,y:(c.top-n.top)/r,...sN(l)}})};function lH({sourceX:e,sourceY:t,targetX:n,targetY:r,sourceControlX:s,sourceControlY:o,targetControlX:l,targetControlY:c}){const u=e*.125+s*.375+l*.375+n*.125,f=t*.125+o*.375+c*.375+r*.125,h=Math.abs(u-e),p=Math.abs(f-t);return[u,f,h,p]}function Y0(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function OL({pos:e,x1:t,y1:n,x2:r,y2:s,c:o}){switch(e){case Ge.Left:return[t-Y0(t-r,o),n];case Ge.Right:return[t+Y0(r-t,o),n];case Ge.Top:return[t,n-Y0(n-s,o)];case Ge.Bottom:return[t,n+Y0(s-n,o)]}}function aH({sourceX:e,sourceY:t,sourcePosition:n=Ge.Bottom,targetX:r,targetY:s,targetPosition:o=Ge.Top,curvature:l=.25}){const[c,u]=OL({pos:n,x1:e,y1:t,x2:r,y2:s,c:l}),[f,h]=OL({pos:o,x1:r,y1:s,x2:e,y2:t,c:l}),[p,y,x,b]=lH({sourceX:e,sourceY:t,targetX:r,targetY:s,sourceControlX:c,sourceControlY:u,targetControlX:f,targetControlY:h});return[`M${e},${t} C${c},${u} ${f},${h} ${r},${s}`,p,y,x,b]}function cH({sourceX:e,sourceY:t,targetX:n,targetY:r}){const s=Math.abs(n-e)/2,o=n<e?n+s:n-s,l=Math.abs(r-t)/2,c=r<t?r+l:r-l;return[o,c,s,l]}function n0e({sourceNode:e,targetNode:t,selected:n=!1,zIndex:r=0,elevateOnSelect:s=!1,zIndexMode:o="basic"}){if(o==="manual")return r;const l=s&&n?r+1e3:r,c=Math.max(e.parentId||s&&e.selected?e.internals.z:0,t.parentId||s&&t.selected?t.internals.z:0);return l+c}function r0e({sourceNode:e,targetNode:t,width:n,height:r,transform:s}){const o=Ob(ax(e),ax(t));o.x===o.x2&&(o.x2+=1),o.y===o.y2&&(o.y2+=1);const l={x:-s[0]/s[2],y:-s[1]/s[2],width:n/s[2],height:r/s[2]};return cx(l,Rb(o))>0}const s0e=({source:e,sourceHandle:t,target:n,targetHandle:r})=>`xy-edge__${e}${t||""}-${n}${r||""}`,o0e=(e,t)=>t.some(n=>n.source===e.source&&n.target===e.target&&(n.sourceHandle===e.sourceHandle||!n.sourceHandle&&!e.sourceHandle)&&(n.targetHandle===e.targetHandle||!n.targetHandle&&!e.targetHandle)),i0e=(e,t,n={})=>{var o;if(!e.source||!e.target)return(o=n.onError)==null||o.call(n,"006",ko.error006()),t;const r=n.getEdgeId||s0e;let s;return W8(e)?s={...e}:s={...e,id:r(e)},o0e(s,t)?t:(s.sourceHandle===null&&delete s.sourceHandle,s.targetHandle===null&&delete s.targetHandle,t.concat(s))};function uH({sourceX:e,sourceY:t,targetX:n,targetY:r}){const[s,o,l,c]=cH({sourceX:e,sourceY:t,targetX:n,targetY:r});return[`M ${e},${t}L ${n},${r}`,s,o,l,c]}const RL={[Ge.Left]:{x:-1,y:0},[Ge.Right]:{x:1,y:0},[Ge.Top]:{x:0,y:-1},[Ge.Bottom]:{x:0,y:1}},l0e=({source:e,sourcePosition:t=Ge.Bottom,target:n})=>t===Ge.Left||t===Ge.Right?e.x<n.x?{x:1,y:0}:{x:-1,y:0}:e.y<n.y?{x:0,y:1}:{x:0,y:-1},AL=(e,t)=>Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function a0e({source:e,sourcePosition:t=Ge.Bottom,target:n,targetPosition:r=Ge.Top,center:s,offset:o,stepPosition:l}){const c=RL[t],u=RL[r],f={x:e.x+c.x*o,y:e.y+c.y*o},h={x:n.x+u.x*o,y:n.y+u.y*o},p=l0e({source:f,sourcePosition:t,target:h}),y=p.x!==0?"x":"y",x=p[y];let b=[],S,E;const C={x:0,y:0},O={x:0,y:0},[,,T,R]=cH({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(c[y]*u[y]===-1){y==="x"?(S=s.x??f.x+(h.x-f.x)*l,E=s.y??(f.y+h.y)/2):(S=s.x??(f.x+h.x)/2,E=s.y??f.y+(h.y-f.y)*l);const I=[{x:S,y:f.y},{x:S,y:h.y}],L=[{x:f.x,y:E},{x:h.x,y:E}];c[y]===x?b=y==="x"?I:L:b=y==="x"?L:I}else{const I=[{x:f.x,y:h.y}],L=[{x:h.x,y:f.y}];if(y==="x"?b=c.x===x?L:I:b=c.y===x?I:L,t===r){const j=Math.abs(e[y]-n[y]);if(j<=o){const H=Math.min(o-1,o-j);c[y]===x?C[y]=(f[y]>e[y]?-1:1)*H:O[y]=(h[y]>n[y]?-1:1)*H}}if(t!==r){const j=y==="x"?"y":"x",H=c[y]===u[j],B=f[j]>h[j],V=f[j]<h[j];(c[y]===1&&(!H&&B||H&&V)||c[y]!==1&&(!H&&V||H&&B))&&(b=y==="x"?I:L)}const D={x:f.x+C.x,y:f.y+C.y},P={x:h.x+O.x,y:h.y+O.y},z=Math.max(Math.abs(D.x-b[0].x),Math.abs(P.x-b[0].x)),$=Math.max(Math.abs(D.y-b[0].y),Math.abs(P.y-b[0].y));z>=$?(S=(D.x+P.x)/2,E=b[0].y):(S=b[0].x,E=(D.y+P.y)/2)}const k={x:f.x+C.x,y:f.y+C.y},M={x:h.x+O.x,y:h.y+O.y};return[[e,...k.x!==b[0].x||k.y!==b[0].y?[k]:[],...b,...M.x!==b[b.length-1].x||M.y!==b[b.length-1].y?[M]:[],n],S,E,T,R]}function c0e(e,t,n,r){const s=Math.min(AL(e,t)/2,AL(t,n)/2,r),{x:o,y:l}=t;if(e.x===o&&o===n.x||e.y===l&&l===n.y)return`L${o} ${l}`;if(e.y===l){const f=e.x<n.x?-1:1,h=e.y<n.y?1:-1;return`L ${o+s*f},${l}Q ${o},${l} ${o},${l+s*h}`}const c=e.x<n.x?1:-1,u=e.y<n.y?-1:1;return`L ${o},${l+s*u}Q ${o},${l} ${o+s*c},${l}`}function dC({sourceX:e,sourceY:t,sourcePosition:n=Ge.Bottom,targetX:r,targetY:s,targetPosition:o=Ge.Top,borderRadius:l=5,centerX:c,centerY:u,offset:f=20,stepPosition:h=.5}){const[p,y,x,b,S]=a0e({source:{x:e,y:t},sourcePosition:n,target:{x:r,y:s},targetPosition:o,center:{x:c,y:u},offset:f,stepPosition:h});let E=`M${p[0].x} ${p[0].y}`;for(let C=1;C<p.length-1;C++)E+=c0e(p[C-1],p[C],p[C+1],l);return E+=`L${p[p.length-1].x} ${p[p.length-1].y}`,[E,y,x,b,S]}function kL(e){var t;return e&&!!(e.internals.handleBounds||(t=e.handles)!=null&&t.length)&&!!(e.measured.width||e.width||e.initialWidth)}function u0e(e){var p;const{sourceNode:t,targetNode:n}=e;if(!kL(t)||!kL(n))return null;const r=t.internals.handleBounds||_L(t.handles),s=n.internals.handleBounds||_L(n.handles),o=ML((r==null?void 0:r.source)??[],e.sourceHandle),l=ML(e.connectionMode===gf.Strict?(s==null?void 0:s.target)??[]:((s==null?void 0:s.target)??[]).concat((s==null?void 0:s.source)??[]),e.targetHandle);if(!o||!l)return(p=e.onError)==null||p.call(e,"008",ko.error008(o?"target":"source",{id:e.id,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle})),null;const c=(o==null?void 0:o.position)||Ge.Bottom,u=(l==null?void 0:l.position)||Ge.Top,f=fu(t,o,c),h=fu(n,l,u);return{sourceX:f.x,sourceY:f.y,targetX:h.x,targetY:h.y,sourcePosition:c,targetPosition:u}}function _L(e){if(!e)return null;const t=[],n=[];for(const r of e)r.width=r.width??1,r.height=r.height??1,r.type==="source"?t.push(r):r.type==="target"&&n.push(r);return{source:t,target:n}}function fu(e,t,n=Ge.Left,r=!1){const s=((t==null?void 0:t.x)??0)+e.internals.positionAbsolute.x,o=((t==null?void 0:t.y)??0)+e.internals.positionAbsolute.y,{width:l,height:c}=t??Io(e);if(r)return{x:s+l/2,y:o+c/2};switch((t==null?void 0:t.position)??n){case Ge.Top:return{x:s+l/2,y:o};case Ge.Right:return{x:s+l,y:o+c/2};case Ge.Bottom:return{x:s+l/2,y:o+c};case Ge.Left:return{x:s,y:o+c/2}}}function ML(e,t){return e&&(t?e.find(n=>n.id===t):e[0])||null}function fC(e,t){return e?typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(r=>`${r}=${e[r]}`).join("&")}`:""}function d0e(e,{id:t,defaultColor:n,defaultMarkerStart:r,defaultMarkerEnd:s}){const o=new Set;return e.reduce((l,c)=>([c.markerStart||r,c.markerEnd||s].forEach(u=>{if(u&&typeof u=="object"){const f=fC(u,t);o.has(f)||(l.push({id:f,color:u.color||n,...u}),o.add(f))}}),l),[]).sort((l,c)=>l.id.localeCompare(c.id))}const dH=1e3,f0e=10,oN={nodeOrigin:[0,0],nodeExtent:Bp,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},h0e={...oN,checkEquality:!0};function iN(e,t){const n={...e};for(const r in t)t[r]!==void 0&&(n[r]=t[r]);return n}function p0e(e,t,n){const r=iN(oN,n);for(const s of e.values())if(s.parentId)aN(s,e,t,r);else{const o=Fm(s,r.nodeOrigin),l=du(s.extent)?s.extent:r.nodeExtent,c=uu(o,l,Io(s));s.internals.positionAbsolute=c}}function m0e(e,t){if(!e.handles)return e.measured?t==null?void 0:t.internals.handleBounds:void 0;const n=[],r=[];for(const s of e.handles){const o={id:s.id,width:s.width??1,height:s.height??1,nodeId:e.id,x:s.x,y:s.y,position:s.position,type:s.type};s.type==="source"?n.push(o):s.type==="target"&&r.push(o)}return{source:n,target:r}}function lN(e){return e==="manual"}function hC(e,t,n,r={}){var h,p;const s=iN(h0e,r),o={i:0},l=new Map(t),c=s!=null&&s.elevateNodesOnSelect&&!lN(s.zIndexMode)?dH:0;let u=e.length>0,f=!1;t.clear(),n.clear();for(const y of e){let x=l.get(y.id);if(s.checkEquality&&y===(x==null?void 0:x.internals.userNode))t.set(y.id,x);else{const b=Fm(y,s.nodeOrigin),S=du(y.extent)?y.extent:s.nodeExtent,E=uu(b,S,Io(y));x={...s.defaults,...y,measured:{width:(h=y.measured)==null?void 0:h.width,height:(p=y.measured)==null?void 0:p.height},internals:{positionAbsolute:E,handleBounds:m0e(y,x),z:fH(y,c,s.zIndexMode),userNode:y}},t.set(y.id,x)}(x.measured===void 0||x.measured.width===void 0||x.measured.height===void 0)&&!x.hidden&&(u=!1),y.parentId&&aN(x,t,n,r,o),f||(f=y.selected??!1)}return{nodesInitialized:u,hasSelectedNodes:f}}function g0e(e,t){if(!e.parentId)return;const n=t.get(e.parentId);n?n.set(e.id,e):t.set(e.parentId,new Map([[e.id,e]]))}function aN(e,t,n,r,s){const{elevateNodesOnSelect:o,nodeOrigin:l,nodeExtent:c,zIndexMode:u}=iN(oN,r),f=e.parentId,h=t.get(f);if(!h){console.warn(`Parent node ${f} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);return}g0e(e,n),s&&!h.parentId&&h.internals.rootParentIndex===void 0&&u==="auto"&&(h.internals.rootParentIndex=++s.i,h.internals.z=h.internals.z+s.i*f0e),s&&h.internals.rootParentIndex!==void 0&&(s.i=h.internals.rootParentIndex);const p=o&&!lN(u)?dH:0,{x:y,y:x,z:b}=y0e(e,h,l,c,p,u),{positionAbsolute:S}=e.internals,E=y!==S.x||x!==S.y;(E||b!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:E?{x:y,y:x}:S,z:b}})}function fH(e,t,n){const r=To(e.zIndex)?e.zIndex:0;return lN(n)?r:r+(e.selected?t:0)}function y0e(e,t,n,r,s,o){const{x:l,y:c}=t.internals.positionAbsolute,u=Io(e),f=Fm(e,n),h=du(e.extent)?uu(f,e.extent,u):f;let p=uu({x:l+h.x,y:c+h.y},r,u);e.extent==="parent"&&(p=Q8(p,u,t));const y=fH(e,s,o),x=t.internals.z??0;return{x:p.x,y:p.y,z:x>=y?x+1:y}}function cN(e,t,n,r=[0,0]){var l;const s=[],o=new Map;for(const c of e){const u=t.get(c.parentId);if(!u)continue;const f=((l=o.get(c.parentId))==null?void 0:l.expandedRect)??Fp(u),h=Z8(f,c.rect);o.set(c.parentId,{expandedRect:h,parent:u})}return o.size>0&&o.forEach(({expandedRect:c,parent:u},f)=>{var T;const h=u.internals.positionAbsolute,p=Io(u),y=u.origin??r,x=c.x<h.x?Math.round(Math.abs(h.x-c.x)):0,b=c.y<h.y?Math.round(Math.abs(h.y-c.y)):0,S=Math.max(p.width,Math.round(c.width)),E=Math.max(p.height,Math.round(c.height)),C=(S-p.width)*y[0],O=(E-p.height)*y[1];(x>0||b>0||C||O)&&(s.push({id:f,type:"position",position:{x:u.position.x-x+C,y:u.position.y-b+O}}),(T=n.get(f))==null||T.forEach(R=>{e.some(k=>k.id===R.id)||s.push({id:R.id,type:"position",position:{x:R.position.x+x,y:R.position.y+b}})})),(p.width<c.width||p.height<c.height||x||b)&&s.push({id:f,type:"dimensions",setAttributes:!0,dimensions:{width:S+(x?y[0]*x-C:0),height:E+(b?y[1]*b-O:0)}})}),s}function x0e(e,t,n,r,s,o,l){const c=r==null?void 0:r.querySelector(".xyflow__viewport");let u=!1;if(!c)return{changes:[],updatedInternals:u};const f=[],h=window.getComputedStyle(c),{m22:p}=new window.DOMMatrixReadOnly(h.transform),y=[];for(const x of e.values()){const b=t.get(x.id);if(!b)continue;if(b.hidden){t.set(b.id,{...b,internals:{...b.internals,handleBounds:void 0}}),u=!0;continue}const S=sN(x.nodeElement),E=b.measured.width!==S.width||b.measured.height!==S.height;if(!!(S.width&&S.height&&(E||!b.internals.handleBounds||x.force))){const O=x.nodeElement.getBoundingClientRect(),T=du(b.extent)?b.extent:o;let{positionAbsolute:R}=b.internals;if(b.parentId&&b.extent==="parent"){const M=t.get(b.parentId);M&&(R=Q8(R,S,M))}else T&&(R=uu(R,T,S));const k={...b,measured:S,internals:{...b.internals,positionAbsolute:R,handleBounds:{source:NL("source",x.nodeElement,O,p,b.id),target:NL("target",x.nodeElement,O,p,b.id)}}};t.set(b.id,k),b.parentId&&aN(k,t,n,{nodeOrigin:s,zIndexMode:l}),u=!0,E&&(f.push({id:b.id,type:"dimensions",dimensions:S}),b.expandParent&&b.parentId&&y.push({id:b.id,parentId:b.parentId,rect:Fp(k,s)}))}}if(y.length>0){const x=cN(y,t,n,s);f.push(...x)}return{changes:f,updatedInternals:u}}async function b0e({delta:e,panZoom:t,transform:n,translateExtent:r,width:s,height:o}){if(!t||!e.x&&!e.y)return!1;const l=await t.setViewportConstrained({x:n[0]+e.x,y:n[1]+e.y,zoom:n[2]},[[0,0],[s,o]],r);return!!l&&(l.x!==n[0]||l.y!==n[1]||l.k!==n[2])}function IL(e,t,n,r,s,o){let l=s;const c=r.get(l)||new Map;r.set(l,c.set(n,t)),l=`${s}-${e}`;const u=r.get(l)||new Map;if(r.set(l,u.set(n,t)),o){l=`${s}-${e}-${o}`;const f=r.get(l)||new Map;r.set(l,f.set(n,t))}}function hH(e,t,n){e.clear(),t.clear();for(const r of n){const{source:s,target:o,sourceHandle:l=null,targetHandle:c=null}=r,u={edgeId:r.id,source:s,target:o,sourceHandle:l,targetHandle:c},f=`${s}-${l}--${o}-${c}`,h=`${o}-${c}--${s}-${l}`;IL("source",u,h,e,s,l),IL("target",u,f,e,o,c),t.set(r.id,r)}}function pH(e,t){if(!e.parentId)return!1;const n=t.get(e.parentId);return n?n.selected?!0:pH(n,t):!1}function LL(e,t,n){var s;let r=e;do{if((s=r==null?void 0:r.matches)!=null&&s.call(r,t))return!0;if(r===n)return!1;r=r==null?void 0:r.parentElement}while(r);return!1}function v0e(e,t,n,r){const s=new Map;for(const[o,l]of e)if((l.selected||l.id===r)&&(!l.parentId||!pH(l,e))&&(l.draggable||t&&typeof l.draggable>"u")){const c=e.get(o);c&&s.set(o,{id:o,position:c.position||{x:0,y:0},distance:{x:n.x-c.internals.positionAbsolute.x,y:n.y-c.internals.positionAbsolute.y},extent:c.extent,parentId:c.parentId,origin:c.origin,expandParent:c.expandParent,internals:{positionAbsolute:c.internals.positionAbsolute||{x:0,y:0}},measured:{width:c.measured.width??0,height:c.measured.height??0}})}return s}function lw({nodeId:e,dragItems:t,nodeLookup:n,dragging:r=!0}){var l,c,u;const s=[];for(const[f,h]of t){const p=(l=n.get(f))==null?void 0:l.internals.userNode;p&&s.push({...p,position:h.position,dragging:r})}if(!e)return[s[0],s];const o=(c=n.get(e))==null?void 0:c.internals.userNode;return[o?{...o,position:((u=t.get(e))==null?void 0:u.position)||o.position,dragging:r}:s[0],s]}function S0e({dragItems:e,snapGrid:t,x:n,y:r}){const s=e.values().next().value;if(!s)return null;const o={x:n-s.distance.x,y:r-s.distance.y},l=Um(o,t);return{x:l.x-o.x,y:l.y-o.y}}function w0e({onNodeMouseDown:e,getStoreItems:t,onDragStart:n,onDrag:r,onDragStop:s}){let o={x:null,y:null},l=0,c=new Map,u=!1,f={x:0,y:0},h=null,p=!1,y=null,x=!1,b=!1,S=null;function E({noDragClassName:O,handleSelector:T,domNode:R,isSelectable:k,nodeId:M,nodeClickDistance:A=0}){y=zs(R);function I({x:z,y:$}){const{nodeLookup:j,nodeExtent:H,snapGrid:B,snapToGrid:V,nodeOrigin:G,onNodeDrag:q,onSelectionDrag:K,onError:W,updateNodePositions:ee}=t();o={x:z,y:$};let ce=!1;const F=c.size>1,X=F&&H?uC($m(c)):null,te=F&&V?S0e({dragItems:c,snapGrid:B,x:z,y:$}):null;for(const[Z,Y]of c){if(!j.has(Z))continue;let le={x:z-Y.distance.x,y:$-Y.distance.y};V&&(le=te?{x:Math.round(le.x+te.x),y:Math.round(le.y+te.y)}:Um(le,B));let xe=null;if(F&&H&&!Y.extent&&X){const{positionAbsolute:re}=Y.internals,he=re.x-X.x+H[0][0],Se=re.x+Y.measured.width-X.x2+H[1][0],ke=re.y-X.y+H[0][1],be=re.y+Y.measured.height-X.y2+H[1][1];xe=[[he,ke],[Se,be]]}const{position:fe,positionAbsolute:oe}=X8({nodeId:Z,nextPosition:le,nodeLookup:j,nodeExtent:xe||H,nodeOrigin:G,onError:W});ce=ce||Y.position.x!==fe.x||Y.position.y!==fe.y,Y.position=fe,Y.internals.positionAbsolute=oe}if(b=b||ce,!!ce&&(ee(c,!0),S&&(r||q||!M&&K))){const[Z,Y]=lw({nodeId:M,dragItems:c,nodeLookup:j});r==null||r(S,c,Z,Y),q==null||q(S,Z,Y),M||K==null||K(S,Y)}}async function L(){if(!h)return;const{transform:z,panBy:$,autoPanSpeed:j,autoPanOnNodeDrag:H}=t();if(!H){u=!1,cancelAnimationFrame(l);return}const[B,V]=nN(f,h,j);(B!==0||V!==0)&&(o.x=(o.x??0)-B/z[2],o.y=(o.y??0)-V/z[2],await $({x:B,y:V})&&I(o)),l=requestAnimationFrame(L)}function D(z){var F;const{nodeLookup:$,multiSelectionActive:j,nodesDraggable:H,transform:B,snapGrid:V,snapToGrid:G,selectNodesOnDrag:q,onNodeDragStart:K,onSelectionDragStart:W,unselectNodesAndEdges:ee}=t();p=!0,(!q||!k)&&!j&&M&&((F=$.get(M))!=null&&F.selected||ee()),k&&q&&M&&(e==null||e(M));const ce=hp(z.sourceEvent,{transform:B,snapGrid:V,snapToGrid:G,containerBounds:h});if(o=ce,c=v0e($,H,ce,M),c.size>0&&(n||K||!M&&W)){const[X,te]=lw({nodeId:M,dragItems:c,nodeLookup:$});n==null||n(z.sourceEvent,c,X,te),K==null||K(z.sourceEvent,X,te),M||W==null||W(z.sourceEvent,te)}}const P=k8().clickDistance(A).on("start",z=>{const{domNode:$,nodeDragThreshold:j,transform:H,snapGrid:B,snapToGrid:V}=t();h=($==null?void 0:$.getBoundingClientRect())||null,x=!1,b=!1,S=z.sourceEvent,j===0&&D(z),o=hp(z.sourceEvent,{transform:H,snapGrid:B,snapToGrid:V,containerBounds:h}),f=No(z.sourceEvent,h)}).on("drag",z=>{const{autoPanOnNodeDrag:$,transform:j,snapGrid:H,snapToGrid:B,nodeDragThreshold:V,nodeLookup:G}=t(),q=hp(z.sourceEvent,{transform:j,snapGrid:H,snapToGrid:B,containerBounds:h});if(S=z.sourceEvent,(z.sourceEvent.type==="touchmove"&&z.sourceEvent.touches.length>1||M&&!G.has(M))&&(x=!0),!x){if(!u&&$&&p&&(u=!0,L()),!p){const K=No(z.sourceEvent,h),W=K.x-f.x,ee=K.y-f.y;Math.sqrt(W*W+ee*ee)>V&&D(z)}(o.x!==q.xSnapped||o.y!==q.ySnapped)&&c&&p&&(f=No(z.sourceEvent,h),I(q))}}).on("end",z=>{if(!p||x){x&&c.size>0&&t().updateNodePositions(c,!1);return}if(u=!1,p=!1,cancelAnimationFrame(l),c.size>0){const{nodeLookup:$,updateNodePositions:j,onNodeDragStop:H,onSelectionDragStop:B}=t();if(b&&(j(c,!1),b=!1),s||H||!M&&B){const[V,G]=lw({nodeId:M,dragItems:c,nodeLookup:$,dragging:!1});s==null||s(z.sourceEvent,c,V,G),H==null||H(z.sourceEvent,V,G),M||B==null||B(z.sourceEvent,G)}}}).filter(z=>{const $=z.target;return!z.button&&(!O||!LL($,`.${O}`,R))&&(!T||LL($,T,R))});y.call(P)}function C(){y==null||y.on(".drag",null)}return{update:E,destroy:C}}function E0e(e,t,n){const r=[],s={x:e.x-n,y:e.y-n,width:n*2,height:n*2};for(const o of t.values())cx(s,Fp(o))>0&&r.push(o);return r}const C0e=250;function T0e(e,t,n,r){var c,u;let s=[],o=1/0;const l=E0e(e,n,t+C0e);for(const f of l){const h=[...((c=f.internals.handleBounds)==null?void 0:c.source)??[],...((u=f.internals.handleBounds)==null?void 0:u.target)??[]];for(const p of h){if(r.nodeId===p.nodeId&&r.type===p.type&&r.id===p.id)continue;const{x:y,y:x}=fu(f,p,p.position,!0),b=Math.sqrt(Math.pow(y-e.x,2)+Math.pow(x-e.y,2));b>t||(b<o?(s=[{...p,x:y,y:x}],o=b):b===o&&s.push({...p,x:y,y:x}))}}if(!s.length)return null;if(s.length>1){const f=r.type==="source"?"target":"source";return s.find(h=>h.type===f)??s[0]}return s[0]}function mH(e,t,n,r,s,o=!1){var f,h,p;const l=r.get(e);if(!l)return null;const c=s==="strict"?(f=l.internals.handleBounds)==null?void 0:f[t]:[...((h=l.internals.handleBounds)==null?void 0:h.source)??[],...((p=l.internals.handleBounds)==null?void 0:p.target)??[]],u=(n?c==null?void 0:c.find(y=>y.id===n):c==null?void 0:c[0])??null;return u&&o?{...u,...fu(l,u,u.position,!0)}:u}function gH(e,t){return e||(t!=null&&t.classList.contains("target")?"target":t!=null&&t.classList.contains("source")?"source":null)}function N0e(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}const yH=()=>!0;function O0e(e,{connectionMode:t,connectionRadius:n,handleId:r,nodeId:s,edgeUpdaterType:o,isTarget:l,domNode:c,nodeLookup:u,lib:f,autoPanOnConnect:h,flowId:p,panBy:y,cancelConnection:x,onConnectStart:b,onConnect:S,onConnectEnd:E,isValidConnection:C=yH,onReconnectEnd:O,updateConnection:T,getTransform:R,getFromHandle:k,autoPanSpeed:M,dragThreshold:A=1,handleDomNode:I}){const L=sH(e.target);let D=0,P;const{x:z,y:$}=No(e),j=gH(o,I),H=c==null?void 0:c.getBoundingClientRect();let B=!1;if(!H||!j)return;const V=mH(s,j,r,u,t);if(!V)return;let G=No(e,H),q=!1,K=null,W=!1,ee=null;function ce(){if(!h||!H)return;const[fe,oe]=nN(G,H,M);y({x:fe,y:oe}),D=requestAnimationFrame(ce)}const F={...V,nodeId:s,type:j,position:V.position},X=u.get(s);let Z={inProgress:!0,isValid:null,from:fu(X,F,Ge.Left,!0),fromHandle:F,fromPosition:F.position,fromNode:X,to:G,toHandle:null,toPosition:wL[F.position],toNode:null,pointer:G};function Y(){B=!0,T(Z),b==null||b(e,{nodeId:s,handleId:r,handleType:j})}A===0&&Y();function le(fe){if(!B){const{x:be,y:_e}=No(fe),Me=be-z,Le=_e-$;if(!(Me*Me+Le*Le>A*A))return;Y()}if(!k()||!F){xe(fe);return}const oe=R();G=No(fe,H),P=T0e(Vm(G,oe,!1,[1,1]),n,u,F),q||(ce(),q=!0);const re=xH(fe,{handle:P,connectionMode:t,fromNodeId:s,fromHandleId:r,fromType:l?"target":"source",isValidConnection:C,doc:L,lib:f,flowId:p,nodeLookup:u});ee=re.handleDomNode,K=re.connection,W=N0e(!!P,re.isValid);const he=u.get(s),Se=he?fu(he,F,Ge.Left,!0):Z.from,ke={...Z,from:Se,isValid:W,to:re.toHandle&&W?xf({x:re.toHandle.x,y:re.toHandle.y},oe):G,toHandle:re.toHandle,toPosition:W&&re.toHandle?re.toHandle.position:wL[F.position],toNode:re.toHandle?u.get(re.toHandle.nodeId):null,pointer:G};T(ke),Z=ke}function xe(fe){if(!("touches"in fe&&fe.touches.length>0)){if(B){(P||ee)&&K&&W&&(S==null||S(K));const{inProgress:oe,...re}=Z,he={...re,toPosition:Z.toHandle?Z.toPosition:null};E==null||E(fe,he),o&&(O==null||O(fe,he))}x(),cancelAnimationFrame(D),q=!1,W=!1,K=null,ee=null,L.removeEventListener("mousemove",le),L.removeEventListener("mouseup",xe),L.removeEventListener("touchmove",le),L.removeEventListener("touchend",xe)}}L.addEventListener("mousemove",le),L.addEventListener("mouseup",xe),L.addEventListener("touchmove",le),L.addEventListener("touchend",xe)}function xH(e,{handle:t,connectionMode:n,fromNodeId:r,fromHandleId:s,fromType:o,doc:l,lib:c,flowId:u,isValidConnection:f=yH,nodeLookup:h}){const p=o==="target",y=t?l.querySelector(`.${c}-flow__handle[data-id="${u}-${t==null?void 0:t.nodeId}-${t==null?void 0:t.id}-${t==null?void 0:t.type}"]`):null,{x,y:b}=No(e),S=l.elementFromPoint(x,b),E=S!=null&&S.classList.contains(`${c}-flow__handle`)?S:y,C={handleDomNode:E,isValid:!1,connection:null,toHandle:null};if(E){const O=gH(void 0,E),T=E.getAttribute("data-nodeid"),R=E.getAttribute("data-handleid"),k=E.classList.contains("connectable"),M=E.classList.contains("connectableend");if(!T||!O)return C;const A={source:p?T:r,sourceHandle:p?R:s,target:p?r:T,targetHandle:p?s:R};C.connection=A;const L=k&&M&&(n===gf.Strict?p&&O==="source"||!p&&O==="target":T!==r||R!==s);C.isValid=L&&f(A),C.toHandle=mH(T,O,R,h,n,!0)}return C}const pC={onPointerDown:O0e,isValid:xH};function R0e({domNode:e,panZoom:t,getTransform:n,getViewScale:r}){const s=zs(e);function o({translateExtent:c,width:u,height:f,zoomStep:h=1,pannable:p=!0,zoomable:y=!0,inversePan:x=!1}){const b=T=>{if(T.sourceEvent.type!=="wheel"||!t)return;const R=n(),k=T.sourceEvent.ctrlKey&&$p()?10:1,M=-T.sourceEvent.deltaY*(T.sourceEvent.deltaMode===1?.05:T.sourceEvent.deltaMode?1:.002)*h,A=R[2]*Math.pow(2,M*k);t.scaleTo(A)};let S=[0,0];const E=T=>{(T.sourceEvent.type==="mousedown"||T.sourceEvent.type==="touchstart")&&(S=[T.sourceEvent.clientX??T.sourceEvent.touches[0].clientX,T.sourceEvent.clientY??T.sourceEvent.touches[0].clientY])},C=T=>{const R=n();if(T.sourceEvent.type!=="mousemove"&&T.sourceEvent.type!=="touchmove"||!t)return;const k=[T.sourceEvent.clientX??T.sourceEvent.touches[0].clientX,T.sourceEvent.clientY??T.sourceEvent.touches[0].clientY],M=[k[0]-S[0],k[1]-S[1]];S=k;const A=r()*Math.max(R[2],Math.log(R[2]))*(x?-1:1),I={x:R[0]-M[0]*A,y:R[1]-M[1]*A},L=[[0,0],[u,f]];t.setViewportConstrained({x:I.x,y:I.y,zoom:R[2]},L,c)},O=q8().on("start",E).on("zoom",p?C:null).on("zoom.wheel",y?b:null);s.call(O,{})}function l(){s.on("zoom",null)}return{update:o,destroy:l,pointer:wo}}const Ab=e=>({x:e.x,y:e.y,zoom:e.k}),aw=({x:e,y:t,zoom:n})=>Nb.translate(e,t).scale(n),aa=(e,t)=>e.target.closest(`.${t}`),bH=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),A0e=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,cw=(e,t=0,n=A0e,r=()=>{})=>{const s=typeof t=="number"&&t>0;return s||r(),s?e.transition().duration(t).ease(n).on("end",r):e},vH=e=>{const t=e.ctrlKey&&$p()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function k0e({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:r,panOnScrollMode:s,panOnScrollSpeed:o,zoomOnPinch:l,onPanZoomStart:c,onPanZoom:u,onPanZoomEnd:f}){return h=>{if(aa(h,t))return h.ctrlKey&&h.preventDefault(),!1;h.preventDefault(),h.stopImmediatePropagation();const p=n.property("__zoom").k||1;if(h.ctrlKey&&l){const E=wo(h),C=vH(h),O=p*Math.pow(2,C);r.scaleTo(n,O,E,h);return}const y=h.deltaMode===1?20:1;let x=s===Zc.Vertical?0:h.deltaX*y,b=s===Zc.Horizontal?0:h.deltaY*y;!$p()&&h.shiftKey&&s!==Zc.Vertical&&(x=h.deltaY*y,b=0),r.translateBy(n,-(x/p)*o,-(b/p)*o,{internal:!0});const S=Ab(n.property("__zoom"));clearTimeout(e.panScrollTimeout),e.isPanScrolling?u==null||u(h,S):(e.isPanScrolling=!0,c==null||c(h,S)),e.panScrollTimeout=setTimeout(()=>{f==null||f(h,S),e.isPanScrolling=!1},150)}}function _0e({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(r,s){const o=r.type==="wheel",l=!t&&o&&!r.ctrlKey,c=aa(r,e);if(r.ctrlKey&&o&&c&&r.preventDefault(),l||c)return null;r.preventDefault(),n.call(this,r,s)}}function M0e({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return r=>{var o,l,c;if((o=r.sourceEvent)!=null&&o.internal)return;const s=Ab(r.transform);e.mouseButton=((l=r.sourceEvent)==null?void 0:l.button)||0,e.isZoomingOrPanning=!0,e.prevViewport=s,((c=r.sourceEvent)==null?void 0:c.type)==="mousedown"&&t(!0),n&&(n==null||n(r.sourceEvent,s))}}function I0e({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:r,onPanZoom:s}){return o=>{var l,c;e.usedRightMouseButton=!!(n&&bH(t,e.mouseButton??0)),(l=o.sourceEvent)!=null&&l.sync||r([o.transform.x,o.transform.y,o.transform.k]),s&&!((c=o.sourceEvent)!=null&&c.internal)&&(s==null||s(o.sourceEvent,Ab(o.transform)))}}function L0e({zoomPanValues:e,panOnDrag:t,panOnScroll:n,onDraggingChange:r,onPanZoomEnd:s,onPaneContextMenu:o}){return l=>{var c;if(!((c=l.sourceEvent)!=null&&c.internal)&&(e.isZoomingOrPanning=!1,o&&bH(t,e.mouseButton??0)&&!e.usedRightMouseButton&&l.sourceEvent&&o(l.sourceEvent),e.usedRightMouseButton=!1,r(!1),s)){const u=Ab(l.transform);e.prevViewport=u,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{s==null||s(l.sourceEvent,u)},n?150:0)}}}function D0e({panActivationKeyPressed:e,zoomActivationKeyPressed:t,zoomOnScroll:n,zoomOnPinch:r,panOnDrag:s,panOnScroll:o,zoomOnDoubleClick:l,userSelectionActive:c,noWheelClassName:u,noPanClassName:f,lib:h,connectionInProgress:p}){return y=>{var C;const x=t||n,b=r&&y.ctrlKey,S=y.type==="wheel";if(y.button===1&&y.type==="mousedown"&&(aa(y,`${h}-flow__node`)||aa(y,`${h}-flow__edge`)||aa(y,`${h}-flow__selection`)||aa(y,`${h}-flow__nodesselection`)))return!0;if(!s&&!x&&!o&&!l&&!r||c||p&&!S||aa(y,u)&&S||aa(y,f)&&(!S||o&&S&&!t)||!r&&y.ctrlKey&&S)return!1;if(!r&&y.type==="touchstart"&&((C=y.touches)==null?void 0:C.length)>1)return y.preventDefault(),!1;if(!x&&!o&&!b&&S||!s&&(y.type==="mousedown"||y.type==="touchstart")||Array.isArray(s)&&!s.includes(y.button)&&y.type==="mousedown")return!1;const E=Array.isArray(s)&&s.includes(y.button)||!y.button||y.button<=1;return(!y.ctrlKey||S||e)&&E}}function j0e({domNode:e,minZoom:t,maxZoom:n,translateExtent:r,viewport:s,onPanZoom:o,onPanZoomStart:l,onPanZoomEnd:c,onDraggingChange:u}){const f={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},h=e.getBoundingClientRect();let p=[[0,0],[h.width,h.height]];const y=typeof ResizeObserver<"u"?new ResizeObserver($=>{const j=$[0];j&&(p=[[0,0],[j.contentRect.width,j.contentRect.height]])}):null;y==null||y.observe(e);const x=q8().extent(()=>p).scaleExtent([t,n]).translateExtent(r),b=zs(e).call(x);R({x:s.x,y:s.y,zoom:yf(s.zoom,t,n)},[[0,0],[h.width,h.height]],r);const S=b.on("wheel.zoom"),E=b.on("dblclick.zoom");x.wheelDelta(vH);async function C($,j){return b?new Promise(H=>{x==null||x.interpolate((j==null?void 0:j.interpolate)==="linear"?fp:wy).transform(cw(b,j==null?void 0:j.duration,j==null?void 0:j.ease,()=>H(!0)),$)}):!1}function O({noWheelClassName:$,noPanClassName:j,onPaneContextMenu:H,userSelectionActive:B,panOnScroll:V,panOnDrag:G,panOnScrollMode:q,panOnScrollSpeed:K,preventScrolling:W,zoomOnPinch:ee,zoomOnScroll:ce,zoomOnDoubleClick:F,panActivationKeyPressed:X=!1,zoomActivationKeyPressed:te,lib:Z,onTransformChange:Y,connectionInProgress:le,paneClickDistance:xe,selectionOnDrag:fe}){B&&!f.isZoomingOrPanning&&T();const oe=V&&!te&&!B;x.clickDistance(fe?1/0:!To(xe)||xe<0?0:xe);const re=oe?k0e({zoomPanValues:f,noWheelClassName:$,d3Selection:b,d3Zoom:x,panOnScrollMode:q,panOnScrollSpeed:K,zoomOnPinch:ee,onPanZoomStart:l,onPanZoom:o,onPanZoomEnd:c}):_0e({noWheelClassName:$,preventScrolling:W,d3ZoomHandler:S});b.on("wheel.zoom",re,{passive:!1});const he=M0e({zoomPanValues:f,onDraggingChange:u,onPanZoomStart:l});x.on("start",he);const Se=I0e({zoomPanValues:f,panOnDrag:G,onPaneContextMenu:!!H,onPanZoom:o,onTransformChange:Y});x.on("zoom",Se);const ke=L0e({zoomPanValues:f,panOnDrag:G,panOnScroll:V,onPaneContextMenu:H,onPanZoomEnd:c,onDraggingChange:u});x.on("end",ke);const be=D0e({panActivationKeyPressed:X,zoomActivationKeyPressed:te,panOnDrag:G,zoomOnScroll:ce,panOnScroll:V,zoomOnDoubleClick:F,zoomOnPinch:ee,userSelectionActive:B,noPanClassName:j,noWheelClassName:$,lib:Z,connectionInProgress:le});x.filter(be),F?b.on("dblclick.zoom",E):b.on("dblclick.zoom",null)}function T(){x.on("zoom",null)}async function R($,j,H){const B=aw($),V=x==null?void 0:x.constrain()(B,j,H);return V&&await C(V),V}async function k($,j){const H=aw($);return await C(H,j),H}function M($){if(b){const j=aw($),H=b.property("__zoom");(H.k!==$.zoom||H.x!==$.x||H.y!==$.y)&&(x==null||x.transform(b,j,null,{sync:!0}))}}function A(){const $=b?V8(b.node()):{x:0,y:0,k:1};return{x:$.x,y:$.y,zoom:$.k}}async function I($,j){return b?new Promise(H=>{x==null||x.interpolate((j==null?void 0:j.interpolate)==="linear"?fp:wy).scaleTo(cw(b,j==null?void 0:j.duration,j==null?void 0:j.ease,()=>H(!0)),$)}):!1}async function L($,j){return b?new Promise(H=>{x==null||x.interpolate((j==null?void 0:j.interpolate)==="linear"?fp:wy).scaleBy(cw(b,j==null?void 0:j.duration,j==null?void 0:j.ease,()=>H(!0)),$)}):!1}function D($){x==null||x.scaleExtent($)}function P($){x==null||x.translateExtent($)}function z($){const j=!To($)||$<0?0:$;x==null||x.clickDistance(j)}return{update:O,destroy:T,setViewport:k,setViewportConstrained:R,getViewport:A,scaleTo:I,scaleBy:L,setScaleExtent:D,setTranslateExtent:P,syncViewport:M,setClickDistance:z}}var bf;(function(e){e.Line="line",e.Handle="handle"})(bf||(bf={}));function P0e({width:e,prevWidth:t,height:n,prevHeight:r,affectsX:s,affectsY:o}){const l=e-t,c=n-r,u=[l>0?1:l<0?-1:0,c>0?1:c<0?-1:0];return l&&s&&(u[0]=u[0]*-1),c&&o&&(u[1]=u[1]*-1),u}function DL(e){const t=e.includes("right")||e.includes("left"),n=e.includes("bottom")||e.includes("top"),r=e.includes("left"),s=e.includes("top");return{isHorizontal:t,isVertical:n,affectsX:r,affectsY:s}}function ra(e,t){return Math.max(0,t-e)}function sa(e,t){return Math.max(0,e-t)}function W0(e,t,n){return Math.max(0,t-e,e-n)}function jL(e,t){return e?!t:t}function z0e(e,t,n,r,s,o,l,c){let{affectsX:u,affectsY:f}=t;const{isHorizontal:h,isVertical:p}=t,y=h&&p,{xSnapped:x,ySnapped:b}=n,{minWidth:S,maxWidth:E,minHeight:C,maxHeight:O}=r,{x:T,y:R,width:k,height:M,aspectRatio:A}=e;let I=Math.floor(h?x-e.pointerX:0),L=Math.floor(p?b-e.pointerY:0);const D=k+(u?-I:I),P=M+(f?-L:L),z=-o[0]*k,$=-o[1]*M;let j=W0(D,S,E),H=W0(P,C,O);if(l){let G=0,q=0;u&&I<0?G=ra(T+I+z,l[0][0]):!u&&I>0&&(G=sa(T+D+z,l[1][0])),f&&L<0?q=ra(R+L+$,l[0][1]):!f&&L>0&&(q=sa(R+P+$,l[1][1])),j=Math.max(j,G),H=Math.max(H,q)}if(c){let G=0,q=0;u&&I>0?G=sa(T+I,c[0][0]):!u&&I<0&&(G=ra(T+D,c[1][0])),f&&L>0?q=sa(R+L,c[0][1]):!f&&L<0&&(q=ra(R+P,c[1][1])),j=Math.max(j,G),H=Math.max(H,q)}if(s){if(h){const G=W0(D/A,C,O)*A;if(j=Math.max(j,G),l){let q=0;!u&&!f||u&&!f&&y?q=sa(R+$+D/A,l[1][1])*A:q=ra(R+$+(u?I:-I)/A,l[0][1])*A,j=Math.max(j,q)}if(c){let q=0;!u&&!f||u&&!f&&y?q=ra(R+D/A,c[1][1])*A:q=sa(R+(u?I:-I)/A,c[0][1])*A,j=Math.max(j,q)}}if(p){const G=W0(P*A,S,E)/A;if(H=Math.max(H,G),l){let q=0;!u&&!f||f&&!u&&y?q=sa(T+P*A+z,l[1][0])/A:q=ra(T+(f?L:-L)*A+z,l[0][0])/A,H=Math.max(H,q)}if(c){let q=0;!u&&!f||f&&!u&&y?q=ra(T+P*A,c[1][0])/A:q=sa(T+(f?L:-L)*A,c[0][0])/A,H=Math.max(H,q)}}}L=L+(L<0?H:-H),I=I+(I<0?j:-j),s&&(y?D>P*A?L=(jL(u,f)?-I:I)/A:I=(jL(u,f)?-L:L)*A:h?(L=I/A,f=u):(I=L*A,u=f));const B=u?T+I:T,V=f?R+L:R;return{width:k+(u?-I:I),height:M+(f?-L:L),x:o[0]*I*(u?-1:1)+B,y:o[1]*L*(f?-1:1)+V}}const SH={width:0,height:0,x:0,y:0},B0e={...SH,pointerX:0,pointerY:0,aspectRatio:1};function H0e(e,t,n){const r=t.position.x+e.position.x,s=t.position.y+e.position.y,o=e.measured.width??0,l=e.measured.height??0,c=n[0]*o,u=n[1]*l;return[[r-c,s-u],[r+o-c,s+l-u]]}function F0e({domNode:e,nodeId:t,getStoreItems:n,onChange:r,onEnd:s}){const o=zs(e);let l={controlDirection:DL("bottom-right"),boundaries:{minWidth:0,minHeight:0,maxWidth:Number.MAX_VALUE,maxHeight:Number.MAX_VALUE},resizeDirection:void 0,keepAspectRatio:!1};function c({controlPosition:f,boundaries:h,keepAspectRatio:p,resizeDirection:y,onResizeStart:x,onResize:b,onResizeEnd:S,shouldResize:E}){let C={...SH},O={...B0e};l={boundaries:h,resizeDirection:y,keepAspectRatio:p,controlDirection:DL(f)};let T,R=null,k=[],M,A,I,L=!1;const D=k8().on("start",P=>{const{nodeLookup:z,transform:$,snapGrid:j,snapToGrid:H,nodeOrigin:B,paneDomNode:V}=n();if(T=z.get(t),!T)return;R=(V==null?void 0:V.getBoundingClientRect())??null;const{xSnapped:G,ySnapped:q}=hp(P.sourceEvent,{transform:$,snapGrid:j,snapToGrid:H,containerBounds:R});C={width:T.measured.width??0,height:T.measured.height??0,x:T.position.x??0,y:T.position.y??0},O={...C,pointerX:G,pointerY:q,aspectRatio:C.width/C.height},M=void 0,A=du(T.extent)?T.extent:void 0,T.parentId&&(T.extent==="parent"||T.expandParent)&&(M=z.get(T.parentId)),M&&T.extent==="parent"&&(A=[[0,0],[M.measured.width,M.measured.height]]),k=[],I=void 0;for(const[K,W]of z)if(W.parentId===t&&(k.push({id:K,position:{...W.position},extent:W.extent}),W.extent==="parent"||W.expandParent)){const ee=H0e(W,T,W.origin??B);I?I=[[Math.min(ee[0][0],I[0][0]),Math.min(ee[0][1],I[0][1])],[Math.max(ee[1][0],I[1][0]),Math.max(ee[1][1],I[1][1])]]:I=ee}x==null||x(P,{...C})}).on("drag",P=>{const{transform:z,snapGrid:$,snapToGrid:j,nodeOrigin:H}=n(),B=hp(P.sourceEvent,{transform:z,snapGrid:$,snapToGrid:j,containerBounds:R}),V=[];if(!T)return;const{x:G,y:q,width:K,height:W}=C,ee={},ce=T.origin??H,{width:F,height:X,x:te,y:Z}=z0e(O,l.controlDirection,B,l.boundaries,l.keepAspectRatio,ce,A,I),Y=F!==K,le=X!==W,xe=te!==G&&Y,fe=Z!==q&≤if(!xe&&!fe&&!Y&&!le)return;if((xe||fe||ce[0]===1||ce[1]===1)&&(ee.x=xe?te:C.x,ee.y=fe?Z:C.y,C.x=ee.x,C.y=ee.y,k.length>0)){const Se=te-G,ke=Z-q;for(const be of k)be.position={x:be.position.x-Se+ce[0]*(F-K),y:be.position.y-ke+ce[1]*(X-W)},V.push(be)}if((Y||le)&&(ee.width=Y&&(!l.resizeDirection||l.resizeDirection==="horizontal")?F:C.width,ee.height=le&&(!l.resizeDirection||l.resizeDirection==="vertical")?X:C.height,C.width=ee.width,C.height=ee.height),M&&T.expandParent){const Se=ce[0]*(ee.width??0);ee.x&&ee.x<Se&&(C.x=Se,O.x=O.x-(ee.x-Se));const ke=ce[1]*(ee.height??0);ee.y&&ee.y<ke&&(C.y=ke,O.y=O.y-(ee.y-ke))}const oe=P0e({width:C.width,prevWidth:K,height:C.height,prevHeight:W,affectsX:l.controlDirection.affectsX,affectsY:l.controlDirection.affectsY}),re={...C,direction:oe};(E==null?void 0:E(P,re))!==!1&&(L=!0,b==null||b(P,re),r(ee,V))}).on("end",P=>{L&&(S==null||S(P,{...C}),s==null||s({...C}),L=!1)});o.call(D)}function u(){o.on(".drag",null)}return{update:c,destroy:u}}const $0e={},PL=e=>{let t;const n=new Set,r=(h,p)=>{const y=typeof h=="function"?h(t):h;if(!Object.is(y,t)){const x=t;t=p??(typeof y!="object"||y===null)?y:Object.assign({},t,y),n.forEach(b=>b(t,x))}},s=()=>t,u={setState:r,getState:s,getInitialState:()=>f,subscribe:h=>(n.add(h),()=>n.delete(h)),destroy:()=>{($0e?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),n.clear()}},f=t=e(r,s,u);return u},U0e=e=>e?PL(e):PL,{useDebugValue:V0e}=si,{useSyncExternalStoreWithSelector:q0e}=qG,G0e=e=>e;function wH(e,t=G0e,n){const r=q0e(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return V0e(r),r}const zL=(e,t)=>{const n=U0e(e),r=(s,o=t)=>wH(n,s,o);return Object.assign(r,n),r},K0e=(e,t)=>e?zL(e,t):zL;function Cn(e,t){if(Object.is(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(const[r,s]of e)if(!Object.is(s,t.get(r)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const r of e)if(!t.has(r))return!1;return!0}const n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(const r of n)if(!Object.prototype.hasOwnProperty.call(t,r)||!Object.is(e[r],t[r]))return!1;return!0}const kb=N.createContext(null),Y0e=kb.Provider,EH=ko.error001("react");function It(e,t){const n=N.useContext(kb);if(n===null)throw new Error(EH);return wH(n,e,t)}function an(){const e=N.useContext(kb);if(e===null)throw new Error(EH);return N.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}const BL={display:"none"},W0e={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},CH="react-flow__node-desc",TH="react-flow__edge-desc",X0e="react-flow__aria-live",Q0e=e=>e.ariaLiveMessage,Z0e=e=>e.ariaLabelConfig;function J0e({rfId:e}){const t=It(Q0e);return m.jsx("div",{id:`${X0e}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:W0e,children:t})}function eye({rfId:e,disableKeyboardA11y:t}){const n=It(Z0e);return m.jsxs(m.Fragment,{children:[m.jsx("div",{id:`${CH}-${e}`,style:BL,children:t?n["node.a11yDescription.default"]:n["node.a11yDescription.keyboardDisabled"]}),m.jsx("div",{id:`${TH}-${e}`,style:BL,children:n["edge.a11yDescription.default"]}),!t&&m.jsx(J0e,{rfId:e})]})}const _b=N.forwardRef(({position:e="top-left",children:t,className:n,style:r,...s},o)=>{const l=`${e}`.split("-");return m.jsx("div",{className:Vn(["react-flow__panel",n,...l]),style:r,ref:o,...s,children:t})});_b.displayName="Panel";const HL="https://reactflow.dev?utm_source=attribution";function tye({proOptions:e,position:t="bottom-right"}){return N.useEffect(()=>{},[]),e!=null&&e.hideAttribution?null:m.jsx(_b,{position:t,className:"react-flow__attribution","data-message":`Please only hide this attribution when you are subscribed to React Flow Pro: ${HL}`,children:m.jsx("a",{href:HL,target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution",children:"React Flow"})})}const nye=e=>{const t=[],n=[];for(const[,r]of e.nodeLookup)r.selected&&t.push(r.internals.userNode);for(const[,r]of e.edgeLookup)r.selected&&n.push(r);return{selectedNodes:t,selectedEdges:n}},X0=e=>e.id;function rye(e,t){return Cn(e.selectedNodes.map(X0),t.selectedNodes.map(X0))&&Cn(e.selectedEdges.map(X0),t.selectedEdges.map(X0))}function sye({onSelectionChange:e}){const t=an(),{selectedNodes:n,selectedEdges:r}=It(nye,rye);return N.useEffect(()=>{const s={nodes:n,edges:r};e==null||e(s),t.getState().onSelectionChangeHandlers.forEach(o=>o(s))},[n,r,e]),null}const oye=e=>!!e.onSelectionChangeHandlers;function iye({onSelectionChange:e}){const t=It(oye);return e||t?m.jsx(sye,{onSelectionChange:e}):null}const NH=[0,0],lye={x:0,y:0,zoom:1},aye=["nodes","edges","defaultNodes","defaultEdges","onConnect","onConnectStart","onConnectEnd","onClickConnectStart","onClickConnectEnd","nodesDraggable","autoPanOnNodeFocus","nodesConnectable","nodesFocusable","edgesFocusable","edgesReconnectable","elevateNodesOnSelect","elevateEdgesOnSelect","minZoom","maxZoom","nodeExtent","onNodesChange","onEdgesChange","elementsSelectable","connectionMode","snapGrid","snapToGrid","translateExtent","connectOnClick","defaultEdgeOptions","fitView","fitViewOptions","onNodesDelete","onEdgesDelete","onDelete","onNodeDrag","onNodeDragStart","onNodeDragStop","onSelectionDrag","onSelectionDragStart","onSelectionDragStop","onMoveStart","onMove","onMoveEnd","noPanClassName","nodeOrigin","autoPanOnConnect","autoPanOnNodeDrag","onError","connectionRadius","isValidConnection","selectNodesOnDrag","nodeDragThreshold","connectionDragThreshold","onBeforeDelete","debug","autoPanSpeed","ariaLabelConfig","zIndexMode"],FL=[...aye,"rfId"],cye=e=>({setNodes:e.setNodes,setEdges:e.setEdges,setMinZoom:e.setMinZoom,setMaxZoom:e.setMaxZoom,setTranslateExtent:e.setTranslateExtent,setNodeExtent:e.setNodeExtent,reset:e.reset,setDefaultNodesAndEdges:e.setDefaultNodesAndEdges}),$L={translateExtent:Bp,nodeOrigin:NH,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1"};function uye(e){const{setNodes:t,setEdges:n,setMinZoom:r,setMaxZoom:s,setTranslateExtent:o,setNodeExtent:l,reset:c,setDefaultNodesAndEdges:u}=It(cye,Cn),f=an();N.useEffect(()=>(u(e.defaultNodes,e.defaultEdges),()=>{h.current=$L,c()}),[]);const h=N.useRef($L);return N.useEffect(()=>{for(const p of FL){const y=e[p],x=h.current[p];y!==x&&(typeof e[p]>"u"||(p==="nodes"?t(y):p==="edges"?n(y):p==="minZoom"?r(y):p==="maxZoom"?s(y):p==="translateExtent"?o(y):p==="nodeExtent"?l(y):p==="ariaLabelConfig"?f.setState({ariaLabelConfig:e0e(y)}):p==="fitView"?f.setState({fitViewQueued:y}):p==="fitViewOptions"?f.setState({fitViewOptions:y}):f.setState({[p]:y})))}h.current=e},FL.map(p=>e[p])),null}function UL(){return typeof window>"u"||!window.matchMedia?null:window.matchMedia("(prefers-color-scheme: dark)")}function dye(e){var r;const[t,n]=N.useState(e==="system"?null:e);return N.useEffect(()=>{if(e!=="system"){n(e);return}const s=UL(),o=()=>n(s!=null&&s.matches?"dark":"light");return o(),s==null||s.addEventListener("change",o),()=>{s==null||s.removeEventListener("change",o)}},[e]),t!==null?t:(r=UL())!=null&&r.matches?"dark":"light"}const VL=typeof document<"u"?document:null;function Up(e=null,t={target:VL,actInsideInputWithModifier:!0}){const[n,r]=N.useState(!1),s=N.useRef(!1),o=N.useRef(new Set([])),[l,c]=N.useMemo(()=>{if(e!==null){const f=(Array.isArray(e)?e:[e]).filter(p=>typeof p=="string").map(p=>p.replace(/\+/g,`
|
|
352
|
+
`).replace(`
|
|
353
|
+
|
|
354
|
+
`,`
|
|
355
|
+
+`).split(`
|
|
356
|
+
`)),h=f.reduce((p,y)=>p.concat(...y),[]);return[f,h]}return[[],[]]},[e]);return N.useEffect(()=>{const u=(t==null?void 0:t.target)??VL,f=(t==null?void 0:t.actInsideInputWithModifier)??!0;if(e!==null){const h=x=>{var E,C;if(s.current=x.ctrlKey||x.metaKey||x.shiftKey||x.altKey,(!s.current||s.current&&!f)&&oH(x))return!1;const S=GL(x.code,c);if(o.current.add(x[S]),qL(l,o.current,!1)){const O=((C=(E=x.composedPath)==null?void 0:E.call(x))==null?void 0:C[0])||x.target,T=(O==null?void 0:O.nodeName)==="BUTTON"||(O==null?void 0:O.nodeName)==="A";t.preventDefault!==!1&&(s.current||!T)&&x.preventDefault(),r(!0)}},p=x=>{const b=GL(x.code,c);qL(l,o.current,!0)?(r(!1),o.current.clear()):o.current.delete(x[b]),x.key==="Meta"&&o.current.clear(),s.current=!1},y=()=>{o.current.clear(),r(!1)};return u==null||u.addEventListener("keydown",h),u==null||u.addEventListener("keyup",p),window.addEventListener("blur",y),window.addEventListener("contextmenu",y),()=>{u==null||u.removeEventListener("keydown",h),u==null||u.removeEventListener("keyup",p),window.removeEventListener("blur",y),window.removeEventListener("contextmenu",y)}}},[e,r]),n}function qL(e,t,n){return e.filter(r=>n||r.length===t.size).some(r=>r.every(s=>t.has(s)))}function GL(e,t){return t.includes(e)?"code":"key"}const fye=()=>{const e=an();return N.useMemo(()=>({zoomIn:async t=>{const{panZoom:n}=e.getState();return n?n.scaleBy(1.2,t):!1},zoomOut:async t=>{const{panZoom:n}=e.getState();return n?n.scaleBy(1/1.2,t):!1},zoomTo:async(t,n)=>{const{panZoom:r}=e.getState();return r?r.scaleTo(t,n):!1},getZoom:()=>e.getState().transform[2],setViewport:async(t,n)=>{const{transform:[r,s,o],panZoom:l}=e.getState();return l?(await l.setViewport({x:t.x??r,y:t.y??s,zoom:t.zoom??o},n),!0):!1},getViewport:()=>{const[t,n,r]=e.getState().transform;return{x:t,y:n,zoom:r}},setCenter:async(t,n,r)=>e.getState().setCenter(t,n,r),fitBounds:async(t,n)=>{const{width:r,height:s,minZoom:o,maxZoom:l,panZoom:c}=e.getState(),u=rN(t,r,s,o,l,(n==null?void 0:n.padding)??.1);return c?(await c.setViewport(u,{duration:n==null?void 0:n.duration,ease:n==null?void 0:n.ease,interpolate:n==null?void 0:n.interpolate}),!0):!1},screenToFlowPosition:(t,n={})=>{const{transform:r,snapGrid:s,snapToGrid:o,domNode:l}=e.getState();if(!l)return t;const{x:c,y:u}=l.getBoundingClientRect(),f={x:t.x-c,y:t.y-u},h=n.snapGrid??s,p=n.snapToGrid??o;return Vm(f,r,p,h)},flowToScreenPosition:t=>{const{transform:n,domNode:r}=e.getState();if(!r)return t;const{x:s,y:o}=r.getBoundingClientRect(),l=xf(t,n);return{x:l.x+s,y:l.y+o}}}),[])};function OH(e,t){const n=[],r=new Map,s=[];for(const o of e)if(o.type==="add"){s.push(o);continue}else if(o.type==="remove"||o.type==="replace")r.set(o.id,[o]);else{const l=r.get(o.id);l?l.push(o):r.set(o.id,[o])}for(const o of t){const l=r.get(o.id);if(!l){n.push(o);continue}if(l[0].type==="remove")continue;if(l[0].type==="replace"){n.push({...l[0].item});continue}const c={...o};for(const u of l)hye(u,c);n.push(c)}return s.length&&s.forEach(o=>{o.index!==void 0?n.splice(o.index,0,{...o.item}):n.push({...o.item})}),n}function hye(e,t){switch(e.type){case"select":{t.selected=e.selected;break}case"position":{typeof e.position<"u"&&(t.position=e.position),typeof e.dragging<"u"&&(t.dragging=e.dragging);break}case"dimensions":{typeof e.dimensions<"u"&&(t.measured={...e.dimensions},e.setAttributes&&((e.setAttributes===!0||e.setAttributes==="width")&&(t.width=e.dimensions.width),(e.setAttributes===!0||e.setAttributes==="height")&&(t.height=e.dimensions.height))),typeof e.resizing=="boolean"&&(t.resizing=e.resizing);break}}}function pye(e,t){return OH(e,t)}function mye(e,t){return OH(e,t)}function Mc(e,t){return{id:e,type:"select",selected:t}}function kd(e,t=new Set,n=!1){const r=[];for(const[s,o]of e){const l=t.has(s);!(o.selected===void 0&&!l)&&o.selected!==l&&(n&&(o.selected=l),r.push(Mc(o.id,l)))}return r}function KL({items:e=[],lookup:t}){var s;const n=[],r=new Map(e.map(o=>[o.id,o]));for(const[o,l]of e.entries()){const c=t.get(l.id),u=((s=c==null?void 0:c.internals)==null?void 0:s.userNode)??c;u!==void 0&&u!==l&&n.push({id:l.id,item:l,type:"replace"}),u===void 0&&n.push({item:l,type:"add",index:o})}for(const[o]of t)r.get(o)===void 0&&n.push({id:o,type:"remove"});return n}function YL(e){return{id:e.id,type:"remove"}}const gye=eH();function yye(e,t,n={}){return i0e(e,t,{...n,onError:n.onError??gye})}const WL=e=>qge(e),xye=e=>W8(e);function RH(e){return N.forwardRef(e)}const AH=typeof window<"u"?N.useLayoutEffect:N.useEffect;function XL(e){const[t,n]=N.useState(BigInt(0)),[r]=N.useState(()=>bye(()=>n(s=>s+BigInt(1))));return AH(()=>{const s=r.get();s.length&&(e(s),r.reset())},[t]),r}function bye(e){let t=[];return{get:()=>t,reset:()=>{t=[]},push:n=>{t.push(n),e()}}}const kH=N.createContext(null);function vye({children:e}){const t=an(),n=N.useCallback(c=>{const{nodes:u=[],setNodes:f,hasDefaultNodes:h,onNodesChange:p,nodeLookup:y,fitViewQueued:x,onNodesChangeMiddlewareMap:b}=t.getState();let S=u;for(const C of c)S=typeof C=="function"?C(S):C;let E=KL({items:S,lookup:y});for(const C of b.values())E=C(E);h&&f(S),E.length>0?p==null||p(E):x&&window.requestAnimationFrame(()=>{const{fitViewQueued:C,nodes:O,setNodes:T}=t.getState();C&&T(O)})},[]),r=XL(n),s=N.useCallback(c=>{const{edges:u=[],setEdges:f,hasDefaultEdges:h,onEdgesChange:p,edgeLookup:y}=t.getState();let x=u;for(const b of c)x=typeof b=="function"?b(x):b;h?f(x):p&&p(KL({items:x,lookup:y}))},[]),o=XL(s),l=N.useMemo(()=>({nodeQueue:r,edgeQueue:o}),[]);return m.jsx(kH.Provider,{value:l,children:e})}function Sye(){const e=N.useContext(kH);if(!e)throw new Error("useBatchContext must be used within a BatchProvider");return e}const wye=e=>!!e.panZoom;function Mb(){const e=fye(),t=an(),n=Sye(),r=It(wye),s=N.useMemo(()=>{const o=p=>t.getState().nodeLookup.get(p),l=p=>{n.nodeQueue.push(p)},c=p=>{n.edgeQueue.push(p)},u=p=>{var C,O;const{nodeLookup:y,nodeOrigin:x}=t.getState(),b=WL(p)?p:y.get(p.id),S=b.parentId?nH(b.position,b.measured,b.parentId,y,x):b.position,E={...b,position:S,width:((C=b.measured)==null?void 0:C.width)??b.width,height:((O=b.measured)==null?void 0:O.height)??b.height};return Fp(E)},f=(p,y,x={replace:!1})=>{l(b=>b.map(S=>{if(S.id===p){const E=typeof y=="function"?y(S):y;return x.replace&&WL(E)?E:{...S,...E}}return S}))},h=(p,y,x={replace:!1})=>{c(b=>b.map(S=>{if(S.id===p){const E=typeof y=="function"?y(S):y;return x.replace&&xye(E)?E:{...S,...E}}return S}))};return{getNodes:()=>t.getState().nodes.map(p=>({...p})),getNode:p=>{var y;return(y=o(p))==null?void 0:y.internals.userNode},getInternalNode:o,getEdges:()=>{const{edges:p=[]}=t.getState();return p.map(y=>({...y}))},getEdge:p=>t.getState().edgeLookup.get(p),setNodes:l,setEdges:c,addNodes:p=>{const y=Array.isArray(p)?p:[p];n.nodeQueue.push(x=>[...x,...y])},addEdges:p=>{const y=Array.isArray(p)?p:[p];n.edgeQueue.push(x=>[...x,...y])},toObject:()=>{const{nodes:p=[],edges:y=[],transform:x}=t.getState(),[b,S,E]=x;return{nodes:p.map(C=>({...C})),edges:y.map(C=>({...C})),viewport:{x:b,y:S,zoom:E}}},deleteElements:async({nodes:p=[],edges:y=[]})=>{const{nodes:x,edges:b,onNodesDelete:S,onEdgesDelete:E,triggerNodeChanges:C,triggerEdgeChanges:O,onDelete:T,onBeforeDelete:R}=t.getState(),{nodes:k,edges:M}=await Xge({nodesToRemove:p,edgesToRemove:y,nodes:x,edges:b,onBeforeDelete:R}),A=M.length>0,I=k.length>0;if(A){const L=M.map(YL);E==null||E(M),O(L)}if(I){const L=k.map(YL);S==null||S(k),C(L)}return(I||A)&&(T==null||T({nodes:k,edges:M})),{deletedNodes:k,deletedEdges:M}},getIntersectingNodes:(p,y=!0,x)=>{const b=CL(p),S=b?p:u(p),E=x!==void 0;return S?(x||t.getState().nodes).filter(C=>{const O=t.getState().nodeLookup.get(C.id);if(O&&!b&&(C.id===p.id||!O.internals.positionAbsolute))return!1;const T=Fp(E?C:O),R=cx(T,S);return y&&R>0||R>=T.width*T.height||R>=S.width*S.height}):[]},isNodeIntersecting:(p,y,x=!0)=>{const S=CL(p)?p:u(p);if(!S)return!1;const E=cx(S,y);return x&&E>0||E>=y.width*y.height||E>=S.width*S.height},updateNode:f,updateNodeData:(p,y,x={replace:!1})=>{f(p,b=>{const S=typeof y=="function"?y(b):y;return x.replace?{...b,data:S}:{...b,data:{...b.data,...S}}},x)},updateEdge:h,updateEdgeData:(p,y,x={replace:!1})=>{h(p,b=>{const S=typeof y=="function"?y(b):y;return x.replace?{...b,data:S}:{...b,data:{...b.data,...S}}},x)},getNodesBounds:p=>{const{nodeLookup:y,nodeOrigin:x}=t.getState();return Gge(p,{nodeLookup:y,nodeOrigin:x})},getHandleConnections:({type:p,id:y,nodeId:x})=>{var b;return Array.from(((b=t.getState().connectionLookup.get(`${x}-${p}${y?`-${y}`:""}`))==null?void 0:b.values())??[])},getNodeConnections:({type:p,handleId:y,nodeId:x})=>{var b;return Array.from(((b=t.getState().connectionLookup.get(`${x}${p?y?`-${p}-${y}`:`-${p}`:""}`))==null?void 0:b.values())??[])},fitView:async p=>{const y=t.getState().fitViewResolver??Jge();return t.setState({fitViewQueued:!0,fitViewOptions:p,fitViewResolver:y}),n.nodeQueue.push(x=>[...x]),y.promise}}},[]);return N.useMemo(()=>({...s,...e,viewportInitialized:r}),[r])}const QL=e=>e.selected,Eye=typeof window<"u"?window:void 0;function Cye({deleteKeyCode:e,multiSelectionKeyCode:t}){const n=an(),{deleteElements:r}=Mb(),s=Up(e,{actInsideInputWithModifier:!1}),o=Up(t,{target:Eye});N.useEffect(()=>{if(s){const{edges:l,nodes:c}=n.getState();r({nodes:c.filter(QL),edges:l.filter(QL)}),n.setState({nodesSelectionActive:!1})}},[s]),N.useEffect(()=>{n.setState({multiSelectionActive:o})},[o])}function Tye(e){const t=an();N.useEffect(()=>{const n=()=>{var s,o,l,c;if(!e.current||!(((o=(s=e.current).checkVisibility)==null?void 0:o.call(s))??!0))return!1;const r=sN(e.current);(r.height===0||r.width===0)&&((c=(l=t.getState()).onError)==null||c.call(l,"004",ko.error004())),t.setState({width:r.width||500,height:r.height||500})};if(e.current){n(),window.addEventListener("resize",n);const r=new ResizeObserver(()=>n());return r.observe(e.current),()=>{window.removeEventListener("resize",n),r&&e.current&&r.unobserve(e.current)}}},[])}const Ib={position:"absolute",width:"100%",height:"100%",top:0,left:0},Nye=e=>({userSelectionActive:e.userSelectionActive,lib:e.lib,connectionInProgress:e.connection.inProgress});function Oye({onPaneContextMenu:e,zoomOnScroll:t=!0,zoomOnPinch:n=!0,panOnScroll:r=!1,panActivationKeyPressed:s,panOnScrollSpeed:o=.5,panOnScrollMode:l=Zc.Free,zoomOnDoubleClick:c=!0,panOnDrag:u=!0,defaultViewport:f,translateExtent:h,minZoom:p,maxZoom:y,zoomActivationKeyCode:x,preventScrolling:b=!0,children:S,noWheelClassName:E,noPanClassName:C,onViewportChange:O,isControlledViewport:T,paneClickDistance:R,selectionOnDrag:k}){const M=an(),A=N.useRef(null),{userSelectionActive:I,lib:L,connectionInProgress:D}=It(Nye,Cn),P=Up(x),z=N.useRef();Tye(A);const $=N.useCallback(j=>{O==null||O({x:j[0],y:j[1],zoom:j[2]}),T||M.setState({transform:j})},[O,T]);return N.useEffect(()=>{if(A.current){z.current=j0e({domNode:A.current,minZoom:p,maxZoom:y,translateExtent:h,viewport:f,onDraggingChange:V=>M.setState(G=>G.paneDragging===V?G:{paneDragging:V}),onPanZoomStart:(V,G)=>{const{onViewportChangeStart:q,onMoveStart:K}=M.getState();K==null||K(V,G),q==null||q(G)},onPanZoom:(V,G)=>{const{onViewportChange:q,onMove:K}=M.getState();K==null||K(V,G),q==null||q(G)},onPanZoomEnd:(V,G)=>{const{onViewportChangeEnd:q,onMoveEnd:K}=M.getState();K==null||K(V,G),q==null||q(G)}});const{x:j,y:H,zoom:B}=z.current.getViewport();return M.setState({panZoom:z.current,transform:[j,H,B],domNode:A.current.closest(".react-flow")}),()=>{var V;(V=z.current)==null||V.destroy()}}},[]),N.useEffect(()=>{var j;(j=z.current)==null||j.update({onPaneContextMenu:e,zoomOnScroll:t,zoomOnPinch:n,panOnScroll:r,panActivationKeyPressed:s,panOnScrollSpeed:o,panOnScrollMode:l,zoomOnDoubleClick:c,panOnDrag:u,zoomActivationKeyPressed:P,preventScrolling:b,noPanClassName:C,userSelectionActive:I,noWheelClassName:E,lib:L,onTransformChange:$,connectionInProgress:D,selectionOnDrag:k,paneClickDistance:R})},[e,t,n,r,s,o,l,c,u,P,b,C,I,E,L,$,D,k,R]),m.jsx("div",{className:"react-flow__renderer",ref:A,style:Ib,children:S})}const Rye=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function Aye(){const{userSelectionActive:e,userSelectionRect:t}=It(Rye,Cn);return e&&t?m.jsx("div",{className:"react-flow__selection react-flow__container",style:{width:t.width,height:t.height,transform:`translate(${t.x}px, ${t.y}px)`}}):null}const uw=(e,t)=>n=>{n.target===t.current&&(e==null||e(n))},kye=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,dragging:e.paneDragging,panBy:e.panBy,autoPanSpeed:e.autoPanSpeed});function _ye({isSelecting:e,selectionKeyPressed:t,selectionMode:n=Hp.Full,panOnDrag:r,autoPanOnSelection:s,paneClickDistance:o,selectionOnDrag:l,onSelectionStart:c,onSelectionEnd:u,onPaneClick:f,onPaneContextMenu:h,onPaneScroll:p,onPaneMouseEnter:y,onPaneMouseMove:x,onPaneMouseLeave:b,children:S}){const E=N.useRef(0),C=an(),{userSelectionActive:O,elementsSelectable:T,dragging:R,panBy:k,autoPanSpeed:M}=It(kye,Cn),A=T&&(e||O),I=N.useRef(null),L=N.useRef(),D=N.useRef(new Set),P=N.useRef(new Set),z=N.useRef(!1),$=N.useRef(!1),j=N.useRef({x:0,y:0}),H=N.useRef(!1),B=Y=>{if($.current||z.current||C.getState().connection.inProgress){$.current=!1,z.current=!1;return}f==null||f(Y),C.getState().resetSelectedElements(),C.setState({nodesSelectionActive:!1})},V=Y=>{if(Array.isArray(r)&&(r!=null&&r.includes(2))){Y.preventDefault();return}h==null||h(Y)},G=p?Y=>p(Y):void 0,q=Y=>{$.current&&(Y.stopPropagation(),$.current=!1)},K=Y=>{var be,_e;if(Y.pointerType==="touch"&&r!==!1&&!t)return;const{domNode:le,transform:xe}=C.getState();if(L.current=le==null?void 0:le.getBoundingClientRect(),!L.current)return;const fe=Y.target===I.current;if(!fe&&!!Y.target.closest(".nokey")||!e||!(l&&fe||t)||Y.button!==0||!Y.isPrimary)return;(_e=(be=Y.target)==null?void 0:be.setPointerCapture)==null||_e.call(be,Y.pointerId),$.current=!1;const{x:he,y:Se}=No(Y.nativeEvent,L.current),ke=Vm({x:he,y:Se},xe);C.setState({userSelectionRect:{width:0,height:0,startX:ke.x,startY:ke.y,x:he,y:Se}}),fe||(Y.stopPropagation(),Y.preventDefault())};function W(Y,le){const{userSelectionRect:xe}=C.getState();if(!xe)return;const{transform:fe,nodeLookup:oe,edgeLookup:re,connectionLookup:he,triggerNodeChanges:Se,triggerEdgeChanges:ke,defaultEdgeOptions:be}=C.getState(),_e={x:xe.startX,y:xe.startY},{x:Me,y:Le}=xf(_e,fe),Pe={startX:_e.x,startY:_e.y,x:Y<Me?Y:Me,y:le<Le?le:Le,width:Math.abs(Y-Me),height:Math.abs(le-Le)},pe=D.current,Ae=P.current;D.current=new Set(tN(oe,Pe,fe,n===Hp.Partial,!0).map(je=>je.id)),P.current=new Set;const Ee=(be==null?void 0:be.selectable)??!0;for(const je of D.current){const Oe=he.get(je);if(Oe)for(const{edgeId:ve}of Oe.values()){const Fe=re.get(ve);Fe&&(Fe.selectable??Ee)&&P.current.add(ve)}}if(!TL(pe,D.current)){const je=kd(oe,D.current,!0);Se(je)}if(!TL(Ae,P.current)){const je=kd(re,P.current);ke(je)}C.setState({userSelectionRect:Pe,userSelectionActive:!0,nodesSelectionActive:!1})}function ee(){if(!s||!L.current)return;const[Y,le]=nN(j.current,L.current,M);k({x:Y,y:le}).then(xe=>{if(!$.current||!xe){E.current=requestAnimationFrame(ee);return}const{x:fe,y:oe}=j.current;W(fe,oe),E.current=requestAnimationFrame(ee)})}const ce=()=>{cancelAnimationFrame(E.current),E.current=0,H.current=!1};N.useEffect(()=>()=>ce(),[]);const F=Y=>{const{userSelectionRect:le,transform:xe,resetSelectedElements:fe}=C.getState();if(!L.current||!le)return;const{x:oe,y:re}=No(Y.nativeEvent,L.current);j.current={x:oe,y:re};const he=xf({x:le.startX,y:le.startY},xe);if(!$.current){const Se=t?0:o;if(Math.hypot(oe-he.x,re-he.y)<=Se)return;fe(),c==null||c(Y)}$.current=!0,H.current||(ee(),H.current=!0),W(oe,re)},X=Y=>{var le,xe;if(!A){Y.target===I.current&&C.getState().connection.inProgress&&(z.current=!0);return}Y.button===0&&((xe=(le=Y.target)==null?void 0:le.releasePointerCapture)==null||xe.call(le,Y.pointerId),!O&&Y.target===I.current&&C.getState().userSelectionRect&&(B==null||B(Y)),C.setState({userSelectionActive:!1,userSelectionRect:null}),$.current&&(u==null||u(Y),C.setState({nodesSelectionActive:D.current.size>0})),ce())},te=Y=>{var le,xe;(xe=(le=Y.target)==null?void 0:le.releasePointerCapture)==null||xe.call(le,Y.pointerId),ce()},Z=r===!0||Array.isArray(r)&&r.includes(0);return m.jsxs("div",{className:Vn(["react-flow__pane",{draggable:Z,dragging:R,selection:e}]),onClick:A?void 0:uw(B,I),onContextMenu:uw(V,I),onWheel:uw(G,I),onPointerEnter:A?void 0:y,onPointerMove:A?F:x,onPointerUp:X,onPointerCancel:A?te:void 0,onPointerDownCapture:A?K:void 0,onClickCapture:A?q:void 0,onPointerLeave:b,ref:I,style:Ib,children:[S,m.jsx(Aye,{})]})}function mC({id:e,store:t,unselect:n=!1,nodeRef:r}){const{addSelectedNodes:s,unselectNodesAndEdges:o,multiSelectionActive:l,nodeLookup:c,onError:u}=t.getState(),f=c.get(e);if(!f){u==null||u("012",ko.error012(e));return}t.setState({nodesSelectionActive:!1}),f.selected?(n||f.selected&&l)&&(o({nodes:[f],edges:[]}),requestAnimationFrame(()=>{var h;return(h=r==null?void 0:r.current)==null?void 0:h.blur()})):s([e])}function _H({nodeRef:e,disabled:t=!1,noDragClassName:n,handleSelector:r,nodeId:s,isSelectable:o,nodeClickDistance:l}){const c=an(),[u,f]=N.useState(!1),h=N.useRef();return N.useEffect(()=>{if(!t)return h.current=w0e({getStoreItems:()=>c.getState(),onNodeMouseDown:p=>{mC({id:p,store:c,nodeRef:e})},onDragStart:()=>{f(!0)},onDragStop:()=>{f(!1)}}),()=>{var p;(p=h.current)==null||p.destroy(),h.current=void 0}},[t,c,e]),N.useEffect(()=>{t||!e.current||!h.current||h.current.update({noDragClassName:n,handleSelector:r,domNode:e.current,isSelectable:o,nodeId:s,nodeClickDistance:l})},[n,r,t,o,e,s,l]),u}const Mye=e=>t=>t.selected&&(t.draggable||e&&typeof t.draggable>"u");function MH(){const e=an();return N.useCallback(n=>{const{nodeExtent:r,snapToGrid:s,snapGrid:o,nodesDraggable:l,onError:c,updateNodePositions:u,nodeLookup:f,nodeOrigin:h}=e.getState(),p=new Map,y=Mye(l),x=s?o[0]:5,b=s?o[1]:5,S=n.direction.x*x*n.factor,E=n.direction.y*b*n.factor;for(const[,C]of f){if(!y(C))continue;let O={x:C.internals.positionAbsolute.x+S,y:C.internals.positionAbsolute.y+E};s&&(O=Um(O,o));const{position:T,positionAbsolute:R}=X8({nodeId:C.id,nextPosition:O,nodeLookup:f,nodeExtent:r,nodeOrigin:h,onError:c});C.position=T,C.internals.positionAbsolute=R,p.set(C.id,C)}u(p)},[])}const uN=N.createContext(null),Iye=uN.Provider;uN.Consumer;const IH=()=>N.useContext(uN),Lye=e=>({connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName,rfId:e.rfId}),LH=N.createContext(null);function Dye({children:e}){const t=It(Lye,Cn);return m.jsx(LH.Provider,{value:t,children:e})}function jye(){const e=N.useContext(LH);if(!e)throw new Error("useHandleConfig must be used within a HandleConfigProvider");return e}const Pye={connectingFrom:!1,connectingTo:!1,clickConnecting:!1,isPossibleEndHandle:!0,connectionInProcess:!1,clickConnectionInProcess:!1,valid:!1},zye=(e,t,n)=>r=>{const{connectionClickStartHandle:s,connectionMode:o,connection:l}=r,{fromHandle:c,toHandle:u,isValid:f}=l;if(!c&&!s)return Pye;const h=(u==null?void 0:u.nodeId)===e&&(u==null?void 0:u.id)===t&&(u==null?void 0:u.type)===n;return{connectingFrom:(c==null?void 0:c.nodeId)===e&&(c==null?void 0:c.id)===t&&(c==null?void 0:c.type)===n,connectingTo:h,clickConnecting:(s==null?void 0:s.nodeId)===e&&(s==null?void 0:s.id)===t&&(s==null?void 0:s.type)===n,isPossibleEndHandle:o===gf.Strict?(c==null?void 0:c.type)!==n:e!==(c==null?void 0:c.nodeId)||t!==(c==null?void 0:c.id),connectionInProcess:!!c,clickConnectionInProcess:!!s,valid:h&&f}};function Bye({type:e="source",position:t=Ge.Top,isValidConnection:n,isConnectable:r=!0,isConnectableStart:s=!0,isConnectableEnd:o=!0,id:l,onConnect:c,children:u,className:f,onMouseDown:h,onTouchStart:p,...y},x){var H,B;const b=l||null,S=e==="target",E=an(),C=IH(),{connectOnClick:O,noPanClassName:T,rfId:R}=jye(),{connectingFrom:k,connectingTo:M,clickConnecting:A,isPossibleEndHandle:I,connectionInProcess:L,clickConnectionInProcess:D,valid:P}=It(zye(C,b,e),Cn);C||(B=(H=E.getState()).onError)==null||B.call(H,"010",ko.error010());const z=V=>{const{defaultEdgeOptions:G,onConnect:q,hasDefaultEdges:K}=E.getState(),W={...G,...V};if(K){const{edges:ee,setEdges:ce,onError:F}=E.getState();ce(yye(W,ee,{onError:F}))}q==null||q(W),c==null||c(W)},$=V=>{if(!C)return;const G=iH(V.nativeEvent);if(s&&(G&&V.button===0||!G)){const q=E.getState();pC.onPointerDown(V.nativeEvent,{handleDomNode:V.currentTarget,autoPanOnConnect:q.autoPanOnConnect,connectionMode:q.connectionMode,connectionRadius:q.connectionRadius,domNode:q.domNode,nodeLookup:q.nodeLookup,lib:q.lib,isTarget:S,handleId:b,nodeId:C,flowId:q.rfId,panBy:q.panBy,cancelConnection:q.cancelConnection,onConnectStart:q.onConnectStart,onConnectEnd:(...K)=>{var W,ee;return(ee=(W=E.getState()).onConnectEnd)==null?void 0:ee.call(W,...K)},updateConnection:q.updateConnection,onConnect:z,isValidConnection:n||((...K)=>{var W,ee;return((ee=(W=E.getState()).isValidConnection)==null?void 0:ee.call(W,...K))??!0}),getTransform:()=>E.getState().transform,getFromHandle:()=>E.getState().connection.fromHandle,autoPanSpeed:q.autoPanSpeed,dragThreshold:q.connectionDragThreshold})}G?h==null||h(V):p==null||p(V)},j=V=>{const{onClickConnectStart:G,onClickConnectEnd:q,connectionClickStartHandle:K,connectionMode:W,isValidConnection:ee,lib:ce,rfId:F,nodeLookup:X,connection:te}=E.getState();if(!C||!K&&!s)return;if(!K){G==null||G(V.nativeEvent,{nodeId:C,handleId:b,handleType:e}),E.setState({connectionClickStartHandle:{nodeId:C,type:e,id:b}});return}const Z=sH(V.target),Y=n||ee,{connection:le,isValid:xe}=pC.isValid(V.nativeEvent,{handle:{nodeId:C,id:b,type:e},connectionMode:W,fromNodeId:K.nodeId,fromHandleId:K.id||null,fromType:K.type,isValidConnection:Y,flowId:F,doc:Z,lib:ce,nodeLookup:X});xe&&le&&z(le);const fe=structuredClone(te);delete fe.inProgress,fe.toPosition=fe.toHandle?fe.toHandle.position:null,q==null||q(V,fe),E.setState({connectionClickStartHandle:null})};return m.jsx("div",{"data-handleid":b,"data-nodeid":C,"data-handlepos":t,"data-id":`${R}-${C}-${b}-${e}`,className:Vn(["react-flow__handle",`react-flow__handle-${t}`,"nodrag",T,f,{source:!S,target:S,connectable:r,connectablestart:s,connectableend:o,clickconnecting:A,connectingfrom:k,connectingto:M,valid:P,connectionindicator:r&&(!L||I)&&(L||D?o:s)}]),onMouseDown:$,onTouchStart:$,onClick:O?j:void 0,ref:x,...y,children:u})}const hu=N.memo(RH(Bye));function Hye({data:e,isConnectable:t,sourcePosition:n=Ge.Bottom}){return m.jsxs(m.Fragment,{children:[e==null?void 0:e.label,m.jsx(hu,{type:"source",position:n,isConnectable:t})]})}function Fye({data:e,isConnectable:t,targetPosition:n=Ge.Top,sourcePosition:r=Ge.Bottom}){return m.jsxs(m.Fragment,{children:[m.jsx(hu,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label,m.jsx(hu,{type:"source",position:r,isConnectable:t})]})}function $ye(){return null}function Uye({data:e,isConnectable:t,targetPosition:n=Ge.Top}){return m.jsxs(m.Fragment,{children:[m.jsx(hu,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label]})}const ux={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},ZL={input:Hye,default:Fye,output:Uye,group:$ye};function Vye(e){var t,n,r,s;return e.internals.handleBounds===void 0?{width:e.width??e.initialWidth??((t=e.style)==null?void 0:t.width),height:e.height??e.initialHeight??((n=e.style)==null?void 0:n.height)}:{width:e.width??((r=e.style)==null?void 0:r.width),height:e.height??((s=e.style)==null?void 0:s.height)}}const qye=e=>{const{width:t,height:n,x:r,y:s}=$m(e.nodeLookup,{filter:o=>!!o.selected});return{width:To(t)?t:null,height:To(n)?n:null,userSelectionActive:e.userSelectionActive,transformString:`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]}) translate(${r}px,${s}px)`}};function Gye({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:n}){const r=an(),{width:s,height:o,transformString:l,userSelectionActive:c}=It(qye,Cn),u=MH(),f=N.useRef(null);N.useEffect(()=>{var x;n||(x=f.current)==null||x.focus({preventScroll:!0})},[n]);const h=!c&&s!==null&&o!==null;if(_H({nodeRef:f,disabled:!h}),!h)return null;const p=e?x=>{const b=r.getState().nodes.filter(S=>S.selected);e(x,b)}:void 0,y=x=>{Object.prototype.hasOwnProperty.call(ux,x.key)&&(x.preventDefault(),u({direction:ux[x.key],factor:x.shiftKey?4:1}))};return m.jsx("div",{className:Vn(["react-flow__nodesselection","react-flow__container",t]),style:{transform:l},children:m.jsx("div",{ref:f,className:"react-flow__nodesselection-rect",onContextMenu:p,tabIndex:n?void 0:-1,onKeyDown:n?void 0:y,style:{width:s,height:o}})})}const JL=typeof window<"u"?window:void 0,Kye=e=>({nodesSelectionActive:e.nodesSelectionActive,userSelectionActive:e.userSelectionActive});function DH({children:e,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:s,onPaneContextMenu:o,onPaneScroll:l,paneClickDistance:c,deleteKeyCode:u,selectionKeyCode:f,selectionOnDrag:h,selectionMode:p,onSelectionStart:y,onSelectionEnd:x,multiSelectionKeyCode:b,panActivationKeyCode:S,zoomActivationKeyCode:E,elementsSelectable:C,zoomOnScroll:O,zoomOnPinch:T,panOnScroll:R,panOnScrollSpeed:k,panOnScrollMode:M,zoomOnDoubleClick:A,panOnDrag:I,autoPanOnSelection:L,defaultViewport:D,translateExtent:P,minZoom:z,maxZoom:$,preventScrolling:j,onSelectionContextMenu:H,noWheelClassName:B,noPanClassName:V,disableKeyboardA11y:G,onViewportChange:q,isControlledViewport:K}){const{nodesSelectionActive:W,userSelectionActive:ee}=It(Kye,Cn),ce=Up(f,{target:JL}),F=Up(S,{target:JL}),X=F||I,te=F||R,Z=h&&X!==!0,Y=ce||ee||Z;return Cye({deleteKeyCode:u,multiSelectionKeyCode:b}),m.jsx(Oye,{onPaneContextMenu:o,elementsSelectable:C,zoomOnScroll:O,zoomOnPinch:T,panOnScroll:te,panActivationKeyPressed:F,panOnScrollSpeed:k,panOnScrollMode:M,zoomOnDoubleClick:A,panOnDrag:!ce&&X,defaultViewport:D,translateExtent:P,minZoom:z,maxZoom:$,zoomActivationKeyCode:E,preventScrolling:j,noWheelClassName:B,noPanClassName:V,onViewportChange:q,isControlledViewport:K,paneClickDistance:c,selectionOnDrag:Z,children:m.jsxs(_ye,{onSelectionStart:y,onSelectionEnd:x,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:s,onPaneContextMenu:o,onPaneScroll:l,panOnDrag:X,autoPanOnSelection:L,isSelecting:!!Y,selectionMode:p,selectionKeyPressed:ce,paneClickDistance:c,selectionOnDrag:Z,children:[e,W&&m.jsx(Gye,{onSelectionContextMenu:H,noPanClassName:V,disableKeyboardA11y:G})]})})}DH.displayName="FlowRenderer";const Yye=N.memo(DH),Wye=e=>t=>e?tN(t.nodeLookup,{x:0,y:0,width:t.width,height:t.height},t.transform,!0).map(n=>n.id):Array.from(t.nodeLookup.keys());function Xye(e){return It(N.useCallback(Wye(e),[e]),Cn)}const Qye=e=>e.updateNodeInternals;function Zye(){const e=It(Qye),[t]=N.useState(()=>typeof ResizeObserver>"u"?null:new ResizeObserver(n=>{const r=new Map;n.forEach(s=>{const o=s.target.getAttribute("data-id");r.set(o,{id:o,nodeElement:s.target,force:!0})}),e(r)}));return N.useEffect(()=>()=>{t==null||t.disconnect()},[t]),t}function Jye({node:e,nodeType:t,hasDimensions:n,resizeObserver:r}){const s=an(),o=N.useRef(null),l=N.useRef(null),c=N.useRef(e.sourcePosition),u=N.useRef(e.targetPosition),f=N.useRef(t),h=n&&!!e.internals.handleBounds;return N.useEffect(()=>{o.current&&!e.hidden&&(!h||l.current!==o.current)&&(l.current&&(r==null||r.unobserve(l.current)),r==null||r.observe(o.current),l.current=o.current)},[h,e.hidden]),N.useEffect(()=>()=>{l.current&&(r==null||r.unobserve(l.current),l.current=null)},[]),N.useEffect(()=>{if(o.current){const p=f.current!==t,y=c.current!==e.sourcePosition,x=u.current!==e.targetPosition;(p||y||x)&&(f.current=t,c.current=e.sourcePosition,u.current=e.targetPosition,s.getState().updateNodeInternals(new Map([[e.id,{id:e.id,nodeElement:o.current,force:!0}]])))}},[e.id,t,e.sourcePosition,e.targetPosition]),o}function exe({id:e,onClick:t,onMouseEnter:n,onMouseMove:r,onMouseLeave:s,onContextMenu:o,onDoubleClick:l,nodesDraggable:c,elementsSelectable:u,nodesConnectable:f,nodesFocusable:h,resizeObserver:p,noDragClassName:y,noPanClassName:x,disableKeyboardA11y:b,rfId:S,nodeTypes:E,nodeClickDistance:C,onError:O}){const{node:T,internals:R,isParent:k}=It(Y=>{const le=Y.nodeLookup.get(e),xe=Y.parentLookup.has(e);return{node:le,internals:le.internals,isParent:xe}},Cn);let M=T.type||"default",A=(E==null?void 0:E[M])||ZL[M];A===void 0&&(O==null||O("003",ko.error003(M)),M="default",A=(E==null?void 0:E.default)||ZL.default);const I=!!(T.draggable||c&&typeof T.draggable>"u"),L=!!(T.selectable||u&&typeof T.selectable>"u"),D=!!(T.connectable||f&&typeof T.connectable>"u"),P=!!(T.focusable||h&&typeof T.focusable>"u"),z=an(),$=tH(T),j=Jye({node:T,nodeType:M,hasDimensions:$,resizeObserver:p}),H=_H({nodeRef:j,disabled:T.hidden||!I,noDragClassName:y,handleSelector:T.dragHandle,nodeId:e,isSelectable:L,nodeClickDistance:C}),B=MH();if(T.hidden)return null;const V=Io(T),G=Vye(T),q=L||I||t||n||r||s,K=n?Y=>n(Y,{...R.userNode}):void 0,W=r?Y=>r(Y,{...R.userNode}):void 0,ee=s?Y=>s(Y,{...R.userNode}):void 0,ce=o?Y=>o(Y,{...R.userNode}):void 0,F=l?Y=>l(Y,{...R.userNode}):void 0,X=Y=>{const{selectNodesOnDrag:le,nodeDragThreshold:xe}=z.getState();L&&(!le||!I||xe>0)&&mC({id:e,store:z,nodeRef:j}),t&&t(Y,{...R.userNode})},te=Y=>{if(!(oH(Y.nativeEvent)||b)){if(G8.includes(Y.key)&&L){const le=Y.key==="Escape";mC({id:e,store:z,unselect:le,nodeRef:j})}else if(I&&T.selected&&Object.prototype.hasOwnProperty.call(ux,Y.key)){Y.preventDefault();const{ariaLabelConfig:le}=z.getState();z.setState({ariaLiveMessage:le["node.a11yDescription.ariaLiveMessage"]({direction:Y.key.replace("Arrow","").toLowerCase(),x:~~R.positionAbsolute.x,y:~~R.positionAbsolute.y})}),B({direction:ux[Y.key],factor:Y.shiftKey?4:1})}}},Z=()=>{var he;if(b||!((he=j.current)!=null&&he.matches(":focus-visible")))return;const{transform:Y,width:le,height:xe,autoPanOnNodeFocus:fe,setCenter:oe}=z.getState();if(!fe)return;tN(new Map([[e,T]]),{x:0,y:0,width:le,height:xe},Y,!0).length>0||oe(T.position.x+V.width/2,T.position.y+V.height/2,{zoom:Y[2]})};return m.jsx("div",{className:Vn(["react-flow__node",`react-flow__node-${M}`,{[x]:I},T.className,{selected:T.selected,selectable:L,parent:k,draggable:I,dragging:H}]),ref:j,style:{zIndex:R.z,transform:`translate(${R.positionAbsolute.x}px,${R.positionAbsolute.y}px)`,pointerEvents:q?"all":"none",visibility:$?"visible":"hidden",...T.style,...G},"data-id":e,"data-testid":`rf__node-${e}`,onMouseEnter:K,onMouseMove:W,onMouseLeave:ee,onContextMenu:ce,onClick:X,onDoubleClick:F,onKeyDown:P?te:void 0,tabIndex:P?0:void 0,onFocus:P?Z:void 0,role:T.ariaRole??(P?"group":void 0),"aria-roledescription":"node","aria-describedby":b?void 0:`${CH}-${S}`,"aria-label":T.ariaLabel,...T.domAttributes,children:m.jsx(Iye,{value:e,children:m.jsx(A,{id:e,data:T.data,type:M,positionAbsoluteX:R.positionAbsolute.x,positionAbsoluteY:R.positionAbsolute.y,selected:T.selected??!1,selectable:L,draggable:I,deletable:T.deletable??!0,isConnectable:D,sourcePosition:T.sourcePosition,targetPosition:T.targetPosition,dragging:H,dragHandle:T.dragHandle,zIndex:R.z,parentId:T.parentId,...V})})})}var txe=N.memo(exe);const nxe=e=>({nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,onError:e.onError});function jH(e){const{nodesConnectable:t,nodesFocusable:n,elementsSelectable:r,onError:s}=It(nxe,Cn),o=Xye(e.onlyRenderVisibleElements),l=Zye();return m.jsx("div",{className:"react-flow__nodes",style:Ib,children:o.map(c=>m.jsx(txe,{id:c,nodeTypes:e.nodeTypes,nodeExtent:e.nodeExtent,onClick:e.onNodeClick,onMouseEnter:e.onNodeMouseEnter,onMouseMove:e.onNodeMouseMove,onMouseLeave:e.onNodeMouseLeave,onContextMenu:e.onNodeContextMenu,onDoubleClick:e.onNodeDoubleClick,noDragClassName:e.noDragClassName,noPanClassName:e.noPanClassName,rfId:e.rfId,disableKeyboardA11y:e.disableKeyboardA11y,resizeObserver:l,nodesDraggable:e.nodesDraggable??!0,nodesConnectable:t,nodesFocusable:n,elementsSelectable:r,nodeClickDistance:e.nodeClickDistance,onError:s},c))})}jH.displayName="NodeRenderer";const rxe=N.memo(jH);function sxe(e){return It(N.useCallback(n=>{if(!e)return n.edges.map(s=>s.id);const r=[];if(n.width&&n.height)for(const s of n.edges){const o=n.nodeLookup.get(s.source),l=n.nodeLookup.get(s.target);o&&l&&r0e({sourceNode:o,targetNode:l,width:n.width,height:n.height,transform:n.transform})&&r.push(s.id)}return r},[e]),Cn)}const oxe=({color:e="none",strokeWidth:t=1})=>{const n={strokeWidth:t,...e&&{stroke:e}};return m.jsx("polyline",{className:"arrow",style:n,strokeLinecap:"round",fill:"none",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4"})},ixe=({color:e="none",strokeWidth:t=1})=>{const n={strokeWidth:t,...e&&{stroke:e,fill:e}};return m.jsx("polyline",{className:"arrowclosed",style:n,strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"})},eD={[lx.Arrow]:oxe,[lx.ArrowClosed]:ixe};function lxe(e){const t=an();return N.useMemo(()=>{var s,o;return Object.prototype.hasOwnProperty.call(eD,e)?eD[e]:((o=(s=t.getState()).onError)==null||o.call(s,"009",ko.error009(e)),null)},[e])}const axe=({id:e,type:t,color:n,width:r=12.5,height:s=12.5,markerUnits:o="strokeWidth",strokeWidth:l,orient:c="auto-start-reverse"})=>{const u=lxe(t);return u?m.jsx("marker",{className:"react-flow__arrowhead",id:e,markerWidth:`${r}`,markerHeight:`${s}`,viewBox:"-10 -10 20 20",markerUnits:o,orient:c,refX:"0",refY:"0",children:m.jsx(u,{color:n,strokeWidth:l})}):null},PH=({defaultColor:e,rfId:t})=>{const n=It(o=>o.edges),r=It(o=>o.defaultEdgeOptions),s=N.useMemo(()=>d0e(n,{id:t,defaultColor:e,defaultMarkerStart:r==null?void 0:r.markerStart,defaultMarkerEnd:r==null?void 0:r.markerEnd}),[n,r,t,e]);return s.length?m.jsx("svg",{className:"react-flow__marker","aria-hidden":"true",children:m.jsx("defs",{children:s.map(o=>m.jsx(axe,{id:o.id,type:o.type,color:o.color,width:o.width,height:o.height,markerUnits:o.markerUnits,strokeWidth:o.strokeWidth,orient:o.orient},o.id))})}):null};PH.displayName="MarkerDefinitions";var cxe=N.memo(PH);function zH({x:e,y:t,label:n,labelStyle:r,labelShowBg:s=!0,labelBgStyle:o,labelBgPadding:l=[2,4],labelBgBorderRadius:c=2,children:u,className:f,...h}){const[p,y]=N.useState({x:1,y:0,width:0,height:0}),x=Vn(["react-flow__edge-textwrapper",f]),b=N.useRef(null);return N.useEffect(()=>{if(b.current){const S=b.current.getBBox();y({x:S.x,y:S.y,width:S.width,height:S.height})}},[n]),n?m.jsxs("g",{transform:`translate(${e-p.width/2} ${t-p.height/2})`,className:x,visibility:p.width?"visible":"hidden",...h,children:[s&&m.jsx("rect",{width:p.width+2*l[0],x:-l[0],y:-l[1],height:p.height+2*l[1],className:"react-flow__edge-textbg",style:o,rx:c,ry:c}),m.jsx("text",{className:"react-flow__edge-text",y:p.height/2,dy:"0.3em",ref:b,style:r,children:n}),u]}):null}zH.displayName="EdgeText";const uxe=N.memo(zH);function Lb({path:e,labelX:t,labelY:n,label:r,labelStyle:s,labelShowBg:o,labelBgStyle:l,labelBgPadding:c,labelBgBorderRadius:u,interactionWidth:f=20,...h}){return m.jsxs(m.Fragment,{children:[m.jsx("path",{...h,d:e,fill:"none",className:Vn(["react-flow__edge-path",h.className])}),f?m.jsx("path",{d:e,fill:"none",strokeOpacity:0,strokeWidth:f,className:"react-flow__edge-interaction"}):null,r&&To(t)&&To(n)?m.jsx(uxe,{x:t,y:n,label:r,labelStyle:s,labelShowBg:o,labelBgStyle:l,labelBgPadding:c,labelBgBorderRadius:u}):null]})}function tD({pos:e,x1:t,y1:n,x2:r,y2:s}){return e===Ge.Left||e===Ge.Right?[.5*(t+r),n]:[t,.5*(n+s)]}function BH({sourceX:e,sourceY:t,sourcePosition:n=Ge.Bottom,targetX:r,targetY:s,targetPosition:o=Ge.Top}){const[l,c]=tD({pos:n,x1:e,y1:t,x2:r,y2:s}),[u,f]=tD({pos:o,x1:r,y1:s,x2:e,y2:t}),[h,p,y,x]=lH({sourceX:e,sourceY:t,targetX:r,targetY:s,sourceControlX:l,sourceControlY:c,targetControlX:u,targetControlY:f});return[`M${e},${t} C${l},${c} ${u},${f} ${r},${s}`,h,p,y,x]}function HH(e){return N.memo(({id:t,sourceX:n,sourceY:r,targetX:s,targetY:o,sourcePosition:l,targetPosition:c,label:u,labelStyle:f,labelShowBg:h,labelBgStyle:p,labelBgPadding:y,labelBgBorderRadius:x,style:b,markerEnd:S,markerStart:E,interactionWidth:C})=>{const[O,T,R]=BH({sourceX:n,sourceY:r,sourcePosition:l,targetX:s,targetY:o,targetPosition:c}),k=e.isInternal?void 0:t;return m.jsx(Lb,{id:k,path:O,labelX:T,labelY:R,label:u,labelStyle:f,labelShowBg:h,labelBgStyle:p,labelBgPadding:y,labelBgBorderRadius:x,style:b,markerEnd:S,markerStart:E,interactionWidth:C})})}const dxe=HH({isInternal:!1}),FH=HH({isInternal:!0});dxe.displayName="SimpleBezierEdge";FH.displayName="SimpleBezierEdgeInternal";function $H(e){return N.memo(({id:t,sourceX:n,sourceY:r,targetX:s,targetY:o,label:l,labelStyle:c,labelShowBg:u,labelBgStyle:f,labelBgPadding:h,labelBgBorderRadius:p,style:y,sourcePosition:x=Ge.Bottom,targetPosition:b=Ge.Top,markerEnd:S,markerStart:E,pathOptions:C,interactionWidth:O})=>{const[T,R,k]=dC({sourceX:n,sourceY:r,sourcePosition:x,targetX:s,targetY:o,targetPosition:b,borderRadius:C==null?void 0:C.borderRadius,offset:C==null?void 0:C.offset,stepPosition:C==null?void 0:C.stepPosition}),M=e.isInternal?void 0:t;return m.jsx(Lb,{id:M,path:T,labelX:R,labelY:k,label:l,labelStyle:c,labelShowBg:u,labelBgStyle:f,labelBgPadding:h,labelBgBorderRadius:p,style:y,markerEnd:S,markerStart:E,interactionWidth:O})})}const UH=$H({isInternal:!1}),VH=$H({isInternal:!0});UH.displayName="SmoothStepEdge";VH.displayName="SmoothStepEdgeInternal";function qH(e){return N.memo(({id:t,...n})=>{var s;const r=e.isInternal?void 0:t;return m.jsx(UH,{...n,id:r,pathOptions:N.useMemo(()=>{var o;return{borderRadius:0,offset:(o=n.pathOptions)==null?void 0:o.offset}},[(s=n.pathOptions)==null?void 0:s.offset])})})}const fxe=qH({isInternal:!1}),GH=qH({isInternal:!0});fxe.displayName="StepEdge";GH.displayName="StepEdgeInternal";function KH(e){return N.memo(({id:t,sourceX:n,sourceY:r,targetX:s,targetY:o,label:l,labelStyle:c,labelShowBg:u,labelBgStyle:f,labelBgPadding:h,labelBgBorderRadius:p,style:y,markerEnd:x,markerStart:b,interactionWidth:S})=>{const[E,C,O]=uH({sourceX:n,sourceY:r,targetX:s,targetY:o}),T=e.isInternal?void 0:t;return m.jsx(Lb,{id:T,path:E,labelX:C,labelY:O,label:l,labelStyle:c,labelShowBg:u,labelBgStyle:f,labelBgPadding:h,labelBgBorderRadius:p,style:y,markerEnd:x,markerStart:b,interactionWidth:S})})}const hxe=KH({isInternal:!1}),YH=KH({isInternal:!0});hxe.displayName="StraightEdge";YH.displayName="StraightEdgeInternal";function WH(e){return N.memo(({id:t,sourceX:n,sourceY:r,targetX:s,targetY:o,sourcePosition:l=Ge.Bottom,targetPosition:c=Ge.Top,label:u,labelStyle:f,labelShowBg:h,labelBgStyle:p,labelBgPadding:y,labelBgBorderRadius:x,style:b,markerEnd:S,markerStart:E,pathOptions:C,interactionWidth:O})=>{const[T,R,k]=aH({sourceX:n,sourceY:r,sourcePosition:l,targetX:s,targetY:o,targetPosition:c,curvature:C==null?void 0:C.curvature}),M=e.isInternal?void 0:t;return m.jsx(Lb,{id:M,path:T,labelX:R,labelY:k,label:u,labelStyle:f,labelShowBg:h,labelBgStyle:p,labelBgPadding:y,labelBgBorderRadius:x,style:b,markerEnd:S,markerStart:E,interactionWidth:O})})}const pxe=WH({isInternal:!1}),XH=WH({isInternal:!0});pxe.displayName="BezierEdge";XH.displayName="BezierEdgeInternal";const nD={default:XH,straight:YH,step:GH,smoothstep:VH,simplebezier:FH},rD={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null,zIndex:void 0},mxe=(e,t,n)=>n===Ge.Left?e-t:n===Ge.Right?e+t:e,gxe=(e,t,n)=>n===Ge.Top?e-t:n===Ge.Bottom?e+t:e,sD="react-flow__edgeupdater";function oD({position:e,centerX:t,centerY:n,radius:r=10,onMouseDown:s,onMouseEnter:o,onMouseOut:l,type:c}){return m.jsx("circle",{onMouseDown:s,onMouseEnter:o,onMouseOut:l,className:Vn([sD,`${sD}-${c}`]),cx:mxe(t,r,e),cy:gxe(n,r,e),r,stroke:"transparent",fill:"transparent"})}function yxe({isReconnectable:e,reconnectRadius:t,edge:n,sourceX:r,sourceY:s,targetX:o,targetY:l,sourcePosition:c,targetPosition:u,onReconnect:f,onReconnectStart:h,onReconnectEnd:p,setReconnecting:y,setUpdateHover:x}){const b=an(),S=(R,k)=>{if(R.button!==0)return;const{autoPanOnConnect:M,domNode:A,connectionMode:I,connectionRadius:L,lib:D,onConnectStart:P,cancelConnection:z,nodeLookup:$,rfId:j,panBy:H,updateConnection:B}=b.getState(),V=k.type==="target",G=(W,ee)=>{y(!1),p==null||p(W,n,k.type,ee)},q=W=>f==null?void 0:f(n,W),K=(W,ee)=>{y(!0),h==null||h(R,n,k.type),P==null||P(W,ee)};pC.onPointerDown(R.nativeEvent,{autoPanOnConnect:M,connectionMode:I,connectionRadius:L,domNode:A,handleId:k.id,nodeId:k.nodeId,nodeLookup:$,isTarget:V,edgeUpdaterType:k.type,lib:D,flowId:j,cancelConnection:z,panBy:H,isValidConnection:(...W)=>{var ee,ce;return((ce=(ee=b.getState()).isValidConnection)==null?void 0:ce.call(ee,...W))??!0},onConnect:q,onConnectStart:K,onConnectEnd:(...W)=>{var ee,ce;return(ce=(ee=b.getState()).onConnectEnd)==null?void 0:ce.call(ee,...W)},onReconnectEnd:G,updateConnection:B,getTransform:()=>b.getState().transform,getFromHandle:()=>b.getState().connection.fromHandle,dragThreshold:b.getState().connectionDragThreshold,handleDomNode:R.currentTarget})},E=R=>S(R,{nodeId:n.target,id:n.targetHandle??null,type:"target"}),C=R=>S(R,{nodeId:n.source,id:n.sourceHandle??null,type:"source"}),O=()=>x(!0),T=()=>x(!1);return m.jsxs(m.Fragment,{children:[(e===!0||e==="source")&&m.jsx(oD,{position:c,centerX:r,centerY:s,radius:t,onMouseDown:E,onMouseEnter:O,onMouseOut:T,type:"source"}),(e===!0||e==="target")&&m.jsx(oD,{position:u,centerX:o,centerY:l,radius:t,onMouseDown:C,onMouseEnter:O,onMouseOut:T,type:"target"})]})}function xxe({id:e,edgesFocusable:t,edgesReconnectable:n,elementsSelectable:r,onClick:s,onDoubleClick:o,onContextMenu:l,onMouseEnter:c,onMouseMove:u,onMouseLeave:f,reconnectRadius:h,onReconnect:p,onReconnectStart:y,onReconnectEnd:x,rfId:b,edgeTypes:S,noPanClassName:E,onError:C,disableKeyboardA11y:O}){let T=It(oe=>oe.edgeLookup.get(e));const R=It(oe=>oe.defaultEdgeOptions);T=R?{...R,...T}:T;let k=T.type||"default",M=(S==null?void 0:S[k])||nD[k];M===void 0&&(C==null||C("011",ko.error011(k)),k="default",M=(S==null?void 0:S.default)||nD.default);const A=!!(T.focusable||t&&typeof T.focusable>"u"),I=typeof p<"u"&&(T.reconnectable||n&&typeof T.reconnectable>"u"),L=!!(T.selectable||r&&typeof T.selectable>"u"),D=N.useRef(null),[P,z]=N.useState(!1),[$,j]=N.useState(!1),H=an(),{zIndex:B=T.zIndex,sourceX:V,sourceY:G,targetX:q,targetY:K,sourcePosition:W,targetPosition:ee}=It(N.useCallback(oe=>{const re=oe.nodeLookup.get(T.source),he=oe.nodeLookup.get(T.target);if(!re||!he)return rD;const Se=u0e({id:e,sourceNode:re,targetNode:he,sourceHandle:T.sourceHandle||null,targetHandle:T.targetHandle||null,connectionMode:oe.connectionMode,onError:C}),ke=n0e({selected:T.selected,zIndex:T.zIndex,sourceNode:re,targetNode:he,elevateOnSelect:oe.elevateEdgesOnSelect,zIndexMode:oe.zIndexMode});return{...Se||rD,zIndex:ke}},[T.source,T.target,T.sourceHandle,T.targetHandle,T.selected,T.zIndex,C]),Cn),ce=N.useMemo(()=>T.markerStart?`url('#${fC(T.markerStart,b)}')`:void 0,[T.markerStart,b]),F=N.useMemo(()=>T.markerEnd?`url('#${fC(T.markerEnd,b)}')`:void 0,[T.markerEnd,b]);if(T.hidden||V===null||G===null||q===null||K===null)return null;const X=oe=>{var ke;const{addSelectedEdges:re,unselectNodesAndEdges:he,multiSelectionActive:Se}=H.getState();L&&(H.setState({nodesSelectionActive:!1}),T.selected&&Se?(he({nodes:[],edges:[T]}),(ke=D.current)==null||ke.blur()):re([e])),s&&s(oe,T)},te=o?oe=>{o(oe,{...T})}:void 0,Z=l?oe=>{l(oe,{...T})}:void 0,Y=c?oe=>{c(oe,{...T})}:void 0,le=u?oe=>{u(oe,{...T})}:void 0,xe=f?oe=>{f(oe,{...T})}:void 0,fe=oe=>{var re;if(!O&&G8.includes(oe.key)&&L){const{unselectNodesAndEdges:he,addSelectedEdges:Se}=H.getState();oe.key==="Escape"?((re=D.current)==null||re.blur(),he({edges:[T]})):Se([e])}};return m.jsx("svg",{style:{zIndex:B},children:m.jsxs("g",{className:Vn(["react-flow__edge",`react-flow__edge-${k}`,T.className,E,{selected:T.selected,animated:T.animated,inactive:!L&&!s,updating:P,selectable:L}]),onClick:X,onDoubleClick:te,onContextMenu:Z,onMouseEnter:Y,onMouseMove:le,onMouseLeave:xe,onKeyDown:A?fe:void 0,tabIndex:A?0:void 0,role:T.ariaRole??(A?"group":"img"),"aria-roledescription":"edge","data-id":e,"data-testid":`rf__edge-${e}`,"aria-label":T.ariaLabel===null?void 0:T.ariaLabel||`Edge from ${T.source} to ${T.target}`,"aria-describedby":A?`${TH}-${b}`:void 0,ref:D,...T.domAttributes,children:[!$&&m.jsx(M,{id:e,source:T.source,target:T.target,type:T.type,selected:T.selected,animated:T.animated,selectable:L,deletable:T.deletable??!0,label:T.label,labelStyle:T.labelStyle,labelShowBg:T.labelShowBg,labelBgStyle:T.labelBgStyle,labelBgPadding:T.labelBgPadding,labelBgBorderRadius:T.labelBgBorderRadius,sourceX:V,sourceY:G,targetX:q,targetY:K,sourcePosition:W,targetPosition:ee,data:T.data,style:T.style,sourceHandleId:T.sourceHandle,targetHandleId:T.targetHandle,markerStart:ce,markerEnd:F,pathOptions:"pathOptions"in T?T.pathOptions:void 0,interactionWidth:T.interactionWidth}),I&&m.jsx(yxe,{edge:T,isReconnectable:I,reconnectRadius:h,onReconnect:p,onReconnectStart:y,onReconnectEnd:x,sourceX:V,sourceY:G,targetX:q,targetY:K,sourcePosition:W,targetPosition:ee,setUpdateHover:z,setReconnecting:j})]})})}var bxe=N.memo(xxe);const vxe=e=>({edgesFocusable:e.edgesFocusable,edgesReconnectable:e.edgesReconnectable,elementsSelectable:e.elementsSelectable,connectionMode:e.connectionMode,onError:e.onError});function QH({defaultMarkerColor:e,onlyRenderVisibleElements:t,rfId:n,edgeTypes:r,noPanClassName:s,onReconnect:o,onEdgeContextMenu:l,onEdgeMouseEnter:c,onEdgeMouseMove:u,onEdgeMouseLeave:f,onEdgeClick:h,reconnectRadius:p,onEdgeDoubleClick:y,onReconnectStart:x,onReconnectEnd:b,disableKeyboardA11y:S}){const{edgesFocusable:E,edgesReconnectable:C,elementsSelectable:O,onError:T}=It(vxe,Cn),R=sxe(t);return m.jsxs("div",{className:"react-flow__edges",children:[m.jsx(cxe,{defaultColor:e,rfId:n}),R.map(k=>m.jsx(bxe,{id:k,edgesFocusable:E,edgesReconnectable:C,elementsSelectable:O,noPanClassName:s,onReconnect:o,onContextMenu:l,onMouseEnter:c,onMouseMove:u,onMouseLeave:f,onClick:h,reconnectRadius:p,onDoubleClick:y,onReconnectStart:x,onReconnectEnd:b,rfId:n,onError:T,edgeTypes:r,disableKeyboardA11y:S},k))]})}QH.displayName="EdgeRenderer";const Sxe=N.memo(QH),iD=e=>`translate(${e[0]}px,${e[1]}px) scale(${e[2]})`;function wxe({children:e}){const t=an(),n=N.useRef(null),[r]=N.useState(()=>t.getState().transform);return AH(()=>{let s=null;const o=()=>{const l=t.getState().transform;s&&l[0]===s[0]&&l[1]===s[1]&&l[2]===s[2]||(s=l,n.current&&(n.current.style.transform=iD(l)))};return o(),t.subscribe(o)},[t]),m.jsx("div",{ref:n,className:"react-flow__viewport xyflow__viewport react-flow__container",style:{transform:iD(r)},children:e})}function Exe(e){const t=Mb(),n=N.useRef(!1);N.useEffect(()=>{!n.current&&t.viewportInitialized&&e&&(setTimeout(()=>e(t),1),n.current=!0)},[e,t.viewportInitialized])}const Cxe=e=>{var t;return(t=e.panZoom)==null?void 0:t.syncViewport};function Txe(e){const t=It(Cxe),n=an();return N.useEffect(()=>{e&&(t==null||t(e),n.setState({transform:[e.x,e.y,e.zoom]}))},[e,t]),null}function Nxe(e){return e.connection.inProgress?{...e.connection,to:Vm(e.connection.to,e.transform)}:{...e.connection}}function Oxe(e){return Nxe}function Rxe(e){const t=Oxe();return It(t,Cn)}const Axe=e=>({nodesConnectable:e.nodesConnectable,isValid:e.connection.isValid,inProgress:e.connection.inProgress,width:e.width,height:e.height});function kxe({containerStyle:e,style:t,type:n,component:r}){const{nodesConnectable:s,width:o,height:l,isValid:c,inProgress:u}=It(Axe,Cn);return!(o&&s&&u)?null:m.jsx("svg",{style:e,width:o,height:l,className:"react-flow__connectionline react-flow__container",children:m.jsx("g",{className:Vn(["react-flow__connection",rH(c)]),children:m.jsx(ZH,{style:t,type:n,CustomComponent:r,isValid:c})})})}const ZH=({style:e,type:t=da.Bezier,CustomComponent:n,isValid:r})=>{const{inProgress:s,from:o,fromNode:l,fromHandle:c,fromPosition:u,to:f,toNode:h,toHandle:p,toPosition:y,pointer:x}=Rxe();if(!s)return;if(n)return m.jsx(n,{connectionLineType:t,connectionLineStyle:e,fromNode:l,fromHandle:c,fromX:o.x,fromY:o.y,toX:f.x,toY:f.y,fromPosition:u,toPosition:y,connectionStatus:rH(r),toNode:h,toHandle:p,pointer:x});let b="";const S={sourceX:o.x,sourceY:o.y,sourcePosition:u,targetX:f.x,targetY:f.y,targetPosition:y};switch(t){case da.Bezier:[b]=aH(S);break;case da.SimpleBezier:[b]=BH(S);break;case da.Step:[b]=dC({...S,borderRadius:0});break;case da.SmoothStep:[b]=dC(S);break;default:[b]=uH(S)}return m.jsx("path",{d:b,fill:"none",className:"react-flow__connection-path",style:e})};ZH.displayName="ConnectionLine";const _xe={};function lD(e=_xe){N.useRef(e),an(),N.useEffect(()=>{},[e])}function Mxe(){an(),N.useRef(!1),N.useEffect(()=>{},[])}function JH({nodeTypes:e,edgeTypes:t,onInit:n,onNodeClick:r,onEdgeClick:s,onNodeDoubleClick:o,onEdgeDoubleClick:l,onNodeMouseEnter:c,onNodeMouseMove:u,onNodeMouseLeave:f,onNodeContextMenu:h,onSelectionContextMenu:p,onSelectionStart:y,onSelectionEnd:x,connectionLineType:b,connectionLineStyle:S,connectionLineComponent:E,connectionLineContainerStyle:C,selectionKeyCode:O,selectionOnDrag:T,selectionMode:R,multiSelectionKeyCode:k,panActivationKeyCode:M,zoomActivationKeyCode:A,deleteKeyCode:I,onlyRenderVisibleElements:L,elementsSelectable:D,defaultViewport:P,translateExtent:z,minZoom:$,maxZoom:j,preventScrolling:H,defaultMarkerColor:B,zoomOnScroll:V,zoomOnPinch:G,panOnScroll:q,panOnScrollSpeed:K,panOnScrollMode:W,zoomOnDoubleClick:ee,panOnDrag:ce,autoPanOnSelection:F,onPaneClick:X,onPaneMouseEnter:te,onPaneMouseMove:Z,onPaneMouseLeave:Y,onPaneScroll:le,onPaneContextMenu:xe,paneClickDistance:fe,nodeClickDistance:oe,onEdgeContextMenu:re,onEdgeMouseEnter:he,onEdgeMouseMove:Se,onEdgeMouseLeave:ke,reconnectRadius:be,onReconnect:_e,onReconnectStart:Me,onReconnectEnd:Le,noDragClassName:Pe,noWheelClassName:pe,noPanClassName:Ae,disableKeyboardA11y:Ee,nodeExtent:je,rfId:Oe,viewport:ve,onViewportChange:Fe,nodesDraggable:Ye}){return lD(e),lD(t),Mxe(),Exe(n),Txe(ve),m.jsx(Yye,{onPaneClick:X,onPaneMouseEnter:te,onPaneMouseMove:Z,onPaneMouseLeave:Y,onPaneContextMenu:xe,onPaneScroll:le,paneClickDistance:fe,deleteKeyCode:I,selectionKeyCode:O,selectionOnDrag:T,selectionMode:R,onSelectionStart:y,onSelectionEnd:x,multiSelectionKeyCode:k,panActivationKeyCode:M,zoomActivationKeyCode:A,elementsSelectable:D,zoomOnScroll:V,zoomOnPinch:G,zoomOnDoubleClick:ee,panOnScroll:q,panOnScrollSpeed:K,panOnScrollMode:W,panOnDrag:ce,autoPanOnSelection:F,defaultViewport:P,translateExtent:z,minZoom:$,maxZoom:j,onSelectionContextMenu:p,preventScrolling:H,noDragClassName:Pe,noWheelClassName:pe,noPanClassName:Ae,disableKeyboardA11y:Ee,onViewportChange:Fe,isControlledViewport:!!ve,children:m.jsxs(wxe,{children:[m.jsx(Sxe,{edgeTypes:t,onEdgeClick:s,onEdgeDoubleClick:l,onReconnect:_e,onReconnectStart:Me,onReconnectEnd:Le,onlyRenderVisibleElements:L,onEdgeContextMenu:re,onEdgeMouseEnter:he,onEdgeMouseMove:Se,onEdgeMouseLeave:ke,reconnectRadius:be,defaultMarkerColor:B,noPanClassName:Ae,disableKeyboardA11y:Ee,rfId:Oe}),m.jsx(kxe,{style:S,type:b,component:E,containerStyle:C}),m.jsx("div",{className:"react-flow__edgelabel-renderer"}),m.jsx(rxe,{nodeTypes:e,onNodeClick:r,onNodeDoubleClick:o,onNodeMouseEnter:c,onNodeMouseMove:u,onNodeMouseLeave:f,onNodeContextMenu:h,nodeClickDistance:oe,onlyRenderVisibleElements:L,noPanClassName:Ae,noDragClassName:Pe,disableKeyboardA11y:Ee,nodeExtent:je,rfId:Oe,nodesDraggable:Ye}),m.jsx("div",{className:"react-flow__viewport-portal"})]})})}JH.displayName="GraphView";const Ixe=N.memo(JH),Lxe=eH(),aD=({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:s,height:o,fitView:l,fitViewOptions:c,minZoom:u=.5,maxZoom:f=2,nodeOrigin:h,nodeExtent:p,zIndexMode:y="basic"}={})=>{const x=new Map,b=new Map,S=new Map,E=new Map,C=r??t??[],O=n??e??[],T=h??[0,0],R=p??Bp;hH(S,E,C);const{nodesInitialized:k}=hC(O,x,b,{nodeOrigin:T,nodeExtent:R,zIndexMode:y});let M=[0,0,1];if(l&&s&&o){const A=$m(x,{filter:P=>!!((P.width||P.initialWidth)&&(P.height||P.initialHeight))}),{x:I,y:L,zoom:D}=rN(A,s,o,u,f,(c==null?void 0:c.padding)??.1);M=[I,L,D]}return{rfId:"1",width:s??0,height:o??0,transform:M,nodes:O,nodesInitialized:k,nodeLookup:x,parentLookup:b,edges:C,edgeLookup:E,connectionLookup:S,onNodesChange:null,onEdgesChange:null,hasDefaultNodes:n!==void 0,hasDefaultEdges:r!==void 0,panZoom:null,minZoom:u,maxZoom:f,translateExtent:Bp,nodeExtent:R,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionMode:gf.Strict,domNode:null,paneDragging:!1,noPanClassName:"nopan",nodeOrigin:T,nodeDragThreshold:1,connectionDragThreshold:1,snapGrid:[15,15],snapToGrid:!1,nodesDraggable:!0,nodesConnectable:!0,nodesFocusable:!0,edgesFocusable:!0,edgesReconnectable:!0,elementsSelectable:!0,elevateNodesOnSelect:!0,elevateEdgesOnSelect:!0,selectNodesOnDrag:!0,multiSelectionActive:!1,fitViewQueued:l??!1,fitViewOptions:c,fitViewResolver:null,connection:{...Y8},connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,autoPanOnNodeFocus:!0,autoPanSpeed:15,connectionRadius:20,onError:Lxe,isValidConnection:void 0,onSelectionChangeHandlers:[],lib:"react",debug:!1,ariaLabelConfig:K8,zIndexMode:y,defaultEdgeOptions:void 0,onNodesChangeMiddlewareMap:new Map,onEdgesChangeMiddlewareMap:new Map,onNodesDelete:void 0,onEdgesDelete:void 0,onDelete:void 0,onBeforeDelete:void 0,onViewportChangeStart:void 0,onViewportChange:void 0,onViewportChangeEnd:void 0,onNodeDragStart:void 0,onNodeDrag:void 0,onNodeDragStop:void 0,onSelectionDragStart:void 0,onSelectionDrag:void 0,onSelectionDragStop:void 0,onMoveStart:void 0,onMove:void 0,onMoveEnd:void 0,onConnect:void 0,onConnectStart:void 0,onConnectEnd:void 0,onClickConnectStart:void 0,onClickConnectEnd:void 0}},Dxe=({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:s,height:o,fitView:l,fitViewOptions:c,minZoom:u,maxZoom:f,nodeOrigin:h,nodeExtent:p,zIndexMode:y})=>K0e((x,b)=>{async function S(){const{nodeLookup:E,panZoom:C,fitViewOptions:O,fitViewResolver:T,width:R,height:k,minZoom:M,maxZoom:A}=b();C&&(await Wge({nodes:E,width:R,height:k,panZoom:C,minZoom:M,maxZoom:A},O),T==null||T.resolve(!0),x({fitViewResolver:null}))}return{...aD({nodes:e,edges:t,width:s,height:o,fitView:l,fitViewOptions:c,minZoom:u,maxZoom:f,nodeOrigin:h,nodeExtent:p,defaultNodes:n,defaultEdges:r,zIndexMode:y}),setNodes:E=>{const{nodeLookup:C,parentLookup:O,nodeOrigin:T,nodeExtent:R,elevateNodesOnSelect:k,fitViewQueued:M,zIndexMode:A,nodesSelectionActive:I}=b(),{nodesInitialized:L,hasSelectedNodes:D}=hC(E,C,O,{nodeOrigin:T,nodeExtent:R,elevateNodesOnSelect:k,checkEquality:!0,zIndexMode:A}),P=I&&D;M&&L?(S(),x({nodes:E,nodesInitialized:L,fitViewQueued:!1,fitViewOptions:void 0,nodesSelectionActive:P})):x({nodes:E,nodesInitialized:L,nodesSelectionActive:P})},setEdges:E=>{const{connectionLookup:C,edgeLookup:O}=b();hH(C,O,E),x({edges:E})},setDefaultNodesAndEdges:(E,C)=>{if(E){const{setNodes:O}=b();O(E),x({hasDefaultNodes:!0})}if(C){const{setEdges:O}=b();O(C),x({hasDefaultEdges:!0})}},updateNodeInternals:E=>{const{triggerNodeChanges:C,nodeLookup:O,parentLookup:T,domNode:R,nodeOrigin:k,nodeExtent:M,debug:A,fitViewQueued:I,zIndexMode:L}=b(),{changes:D,updatedInternals:P}=x0e(E,O,T,R,k,M,L);P&&(p0e(O,T,{nodeOrigin:k,nodeExtent:M,zIndexMode:L}),I?(S(),x({fitViewQueued:!1,fitViewOptions:void 0})):x({}),(D==null?void 0:D.length)>0&&(A&&console.log("React Flow: trigger node changes",D),C==null||C(D)))},updateNodePositions:(E,C=!1)=>{const O=[];let T=[];const{nodeLookup:R,triggerNodeChanges:k,connection:M,updateConnection:A,onNodesChangeMiddlewareMap:I}=b();for(const[L,D]of E){const P=R.get(L),z=!!(P!=null&&P.expandParent&&(P!=null&&P.parentId)&&(D!=null&&D.position)),$={id:L,type:"position",position:z?{x:Math.max(0,D.position.x),y:Math.max(0,D.position.y)}:D.position,dragging:C};if(P&&M.inProgress&&M.fromNode.id===P.id){const j=fu(P,M.fromHandle,Ge.Left,!0);A({...M,from:j})}z&&P.parentId&&O.push({id:L,parentId:P.parentId,rect:{...D.internals.positionAbsolute,width:D.measured.width??0,height:D.measured.height??0}}),T.push($)}if(O.length>0){const{parentLookup:L,nodeOrigin:D}=b(),P=cN(O,R,L,D);T.push(...P)}for(const L of I.values())T=L(T);k(T)},triggerNodeChanges:E=>{const{onNodesChange:C,setNodes:O,nodes:T,hasDefaultNodes:R,debug:k}=b();if(E!=null&&E.length){if(R){const M=pye(E,T);O(M)}k&&console.log("React Flow: trigger node changes",E),C==null||C(E)}},triggerEdgeChanges:E=>{const{onEdgesChange:C,setEdges:O,edges:T,hasDefaultEdges:R,debug:k}=b();if(E!=null&&E.length){if(R){const M=mye(E,T);O(M)}k&&console.log("React Flow: trigger edge changes",E),C==null||C(E)}},addSelectedNodes:E=>{const{multiSelectionActive:C,edgeLookup:O,nodeLookup:T,triggerNodeChanges:R,triggerEdgeChanges:k}=b();if(C){const M=E.map(A=>Mc(A,!0));R(M);return}R(kd(T,new Set([...E]),!0)),k(kd(O))},addSelectedEdges:E=>{const{multiSelectionActive:C,edgeLookup:O,nodeLookup:T,triggerNodeChanges:R,triggerEdgeChanges:k}=b();if(C){const M=E.map(A=>Mc(A,!0));k(M);return}k(kd(O,new Set([...E]))),R(kd(T,new Set,!0))},unselectNodesAndEdges:({nodes:E,edges:C}={})=>{const{edges:O,nodes:T,nodeLookup:R,triggerNodeChanges:k,triggerEdgeChanges:M}=b(),A=E||T,I=C||O,L=[];for(const P of A){if(!P.selected)continue;const z=R.get(P.id);z&&(z.selected=!1),L.push(Mc(P.id,!1))}const D=[];for(const P of I)P.selected&&D.push(Mc(P.id,!1));k(L),M(D)},setMinZoom:E=>{const{panZoom:C,maxZoom:O}=b();C==null||C.setScaleExtent([E,O]),x({minZoom:E})},setMaxZoom:E=>{const{panZoom:C,minZoom:O}=b();C==null||C.setScaleExtent([O,E]),x({maxZoom:E})},setTranslateExtent:E=>{var C;(C=b().panZoom)==null||C.setTranslateExtent(E),x({translateExtent:E})},resetSelectedElements:()=>{const{edges:E,nodes:C,triggerNodeChanges:O,triggerEdgeChanges:T,elementsSelectable:R}=b();if(!R)return;const k=C.reduce((A,I)=>I.selected?[...A,Mc(I.id,!1)]:A,[]),M=E.reduce((A,I)=>I.selected?[...A,Mc(I.id,!1)]:A,[]);O(k),T(M)},setNodeExtent:E=>{const{nodes:C,nodeLookup:O,parentLookup:T,nodeOrigin:R,elevateNodesOnSelect:k,nodeExtent:M,zIndexMode:A}=b();E[0][0]===M[0][0]&&E[0][1]===M[0][1]&&E[1][0]===M[1][0]&&E[1][1]===M[1][1]||(hC(C,O,T,{nodeOrigin:R,nodeExtent:E,elevateNodesOnSelect:k,checkEquality:!1,zIndexMode:A}),x({nodeExtent:E}))},panBy:E=>{const{transform:C,width:O,height:T,panZoom:R,translateExtent:k}=b();return b0e({delta:E,panZoom:R,transform:C,translateExtent:k,width:O,height:T})},setCenter:async(E,C,O)=>{const{width:T,height:R,maxZoom:k,panZoom:M}=b();if(!M)return!1;const A=typeof(O==null?void 0:O.zoom)<"u"?O.zoom:k;return await M.setViewport({x:T/2-E*A,y:R/2-C*A,zoom:A},{duration:O==null?void 0:O.duration,ease:O==null?void 0:O.ease,interpolate:O==null?void 0:O.interpolate}),!0},cancelConnection:()=>{x({connection:{...Y8}})},updateConnection:E=>{x({connection:E})},reset:()=>x({...aD()})}},Object.is);function eF({initialNodes:e,initialEdges:t,defaultNodes:n,defaultEdges:r,initialWidth:s,initialHeight:o,initialMinZoom:l,initialMaxZoom:c,initialFitViewOptions:u,fitView:f,nodeOrigin:h,nodeExtent:p,zIndexMode:y,children:x}){const[b]=N.useState(()=>Dxe({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:s,height:o,fitView:f,minZoom:l,maxZoom:c,fitViewOptions:u,nodeOrigin:h,nodeExtent:p,zIndexMode:y}));return m.jsx(Y0e,{value:b,children:m.jsx(vye,{children:m.jsx(Dye,{children:x})})})}function jxe({children:e,nodes:t,edges:n,defaultNodes:r,defaultEdges:s,width:o,height:l,fitView:c,fitViewOptions:u,minZoom:f,maxZoom:h,nodeOrigin:p,nodeExtent:y,zIndexMode:x}){return N.useContext(kb)?m.jsx(m.Fragment,{children:e}):m.jsx(eF,{initialNodes:t,initialEdges:n,defaultNodes:r,defaultEdges:s,initialWidth:o,initialHeight:l,fitView:c,initialFitViewOptions:u,initialMinZoom:f,initialMaxZoom:h,nodeOrigin:p,nodeExtent:y,zIndexMode:x,children:e})}const Pxe={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0};function zxe({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,className:s,nodeTypes:o,edgeTypes:l,onNodeClick:c,onEdgeClick:u,onInit:f,onMove:h,onMoveStart:p,onMoveEnd:y,onConnect:x,onConnectStart:b,onConnectEnd:S,onClickConnectStart:E,onClickConnectEnd:C,onNodeMouseEnter:O,onNodeMouseMove:T,onNodeMouseLeave:R,onNodeContextMenu:k,onNodeDoubleClick:M,onNodeDragStart:A,onNodeDrag:I,onNodeDragStop:L,onNodesDelete:D,onEdgesDelete:P,onDelete:z,onSelectionChange:$,onSelectionDragStart:j,onSelectionDrag:H,onSelectionDragStop:B,onSelectionContextMenu:V,onSelectionStart:G,onSelectionEnd:q,onBeforeDelete:K,connectionMode:W,connectionLineType:ee=da.Bezier,connectionLineStyle:ce,connectionLineComponent:F,connectionLineContainerStyle:X,deleteKeyCode:te="Backspace",selectionKeyCode:Z="Shift",selectionOnDrag:Y=!1,selectionMode:le=Hp.Full,panActivationKeyCode:xe="Space",multiSelectionKeyCode:fe=$p()?"Meta":"Control",zoomActivationKeyCode:oe=$p()?"Meta":"Control",snapToGrid:re,snapGrid:he,onlyRenderVisibleElements:Se=!1,selectNodesOnDrag:ke,nodesDraggable:be,autoPanOnNodeFocus:_e,nodesConnectable:Me,nodesFocusable:Le,nodeOrigin:Pe=NH,edgesFocusable:pe,edgesReconnectable:Ae,elementsSelectable:Ee=!0,defaultViewport:je=lye,minZoom:Oe=.5,maxZoom:ve=2,translateExtent:Fe=Bp,preventScrolling:Ye=!0,nodeExtent:xt,defaultMarkerColor:nn="#b1b1b7",zoomOnScroll:Te=!0,zoomOnPinch:De=!0,panOnScroll:tt=!1,panOnScrollSpeed:At=.5,panOnScrollMode:gn=Zc.Free,zoomOnDoubleClick:yn=!0,panOnDrag:Fr=!0,onPaneClick:cn,onPaneMouseEnter:cr,onPaneMouseMove:$r,onPaneMouseLeave:Es,onPaneScroll:qn,onPaneContextMenu:yt,paneClickDistance:un=1,nodeClickDistance:Gn=0,children:Rn,onReconnect:An,onReconnectStart:Ht,onReconnectEnd:Zt,onEdgeContextMenu:Jt,onEdgeDoubleClick:Ur,onEdgeMouseEnter:Kn,onEdgeMouseMove:Ln,onEdgeMouseLeave:ur,reconnectRadius:dr=10,onNodesChange:fr,onEdgesChange:as,noDragClassName:Ar="nodrag",noWheelClassName:kr="nowheel",noPanClassName:cs="nopan",fitView:fo,fitViewOptions:hr,connectOnClick:Do,attributionPosition:Cs,proOptions:El,defaultEdgeOptions:Ts,elevateNodesOnSelect:Cl=!0,elevateEdgesOnSelect:gi=!1,disableKeyboardA11y:ho=!1,autoPanOnConnect:us,autoPanOnNodeDrag:ds,autoPanOnSelection:yi=!0,autoPanSpeed:xn,connectionRadius:on,isValidConnection:Yn,onError:Vr,style:ec,id:xi,nodeDragThreshold:Tl,connectionDragThreshold:jo,viewport:bi,onViewportChange:Nl,width:Ol,height:Ns,colorMode:vi="light",debug:me,onScroll:Ne,ariaLabelConfig:Re,zIndexMode:Ke="basic",...lt},it){const dt=xi||"1",Ft=dye(vi),Pt=N.useCallback(Ze=>{Ze.currentTarget.scrollTo({top:0,left:0,behavior:"instant"}),Ne==null||Ne(Ze)},[Ne]);return m.jsx("div",{"data-testid":"rf__wrapper",...lt,onScroll:Pt,style:{...ec,...Pxe},ref:it,className:Vn(["react-flow",s,Ft]),id:xi,role:"application",children:m.jsxs(jxe,{nodes:e,edges:t,width:Ol,height:Ns,fitView:fo,fitViewOptions:hr,minZoom:Oe,maxZoom:ve,nodeOrigin:Pe,nodeExtent:xt,zIndexMode:Ke,children:[m.jsx(uye,{nodes:e,edges:t,defaultNodes:n,defaultEdges:r,onConnect:x,onConnectStart:b,onConnectEnd:S,onClickConnectStart:E,onClickConnectEnd:C,nodesDraggable:be,autoPanOnNodeFocus:_e,nodesConnectable:Me,nodesFocusable:Le,edgesFocusable:pe,edgesReconnectable:Ae,elementsSelectable:Ee,elevateNodesOnSelect:Cl,elevateEdgesOnSelect:gi,minZoom:Oe,maxZoom:ve,nodeExtent:xt,onNodesChange:fr,onEdgesChange:as,snapToGrid:re,snapGrid:he,connectionMode:W,translateExtent:Fe,connectOnClick:Do,defaultEdgeOptions:Ts,fitView:fo,fitViewOptions:hr,onNodesDelete:D,onEdgesDelete:P,onDelete:z,onNodeDragStart:A,onNodeDrag:I,onNodeDragStop:L,onSelectionDrag:H,onSelectionDragStart:j,onSelectionDragStop:B,onMove:h,onMoveStart:p,onMoveEnd:y,noPanClassName:cs,nodeOrigin:Pe,rfId:dt,autoPanOnConnect:us,autoPanOnNodeDrag:ds,autoPanSpeed:xn,onError:Vr,connectionRadius:on,isValidConnection:Yn,selectNodesOnDrag:ke,nodeDragThreshold:Tl,connectionDragThreshold:jo,onBeforeDelete:K,debug:me,ariaLabelConfig:Re,zIndexMode:Ke}),m.jsx(Ixe,{onInit:f,onNodeClick:c,onEdgeClick:u,onNodeMouseEnter:O,onNodeMouseMove:T,onNodeMouseLeave:R,onNodeContextMenu:k,onNodeDoubleClick:M,nodeTypes:o,edgeTypes:l,connectionLineType:ee,connectionLineStyle:ce,connectionLineComponent:F,connectionLineContainerStyle:X,selectionKeyCode:Z,selectionOnDrag:Y,selectionMode:le,deleteKeyCode:te,multiSelectionKeyCode:fe,panActivationKeyCode:xe,zoomActivationKeyCode:oe,onlyRenderVisibleElements:Se,defaultViewport:je,translateExtent:Fe,minZoom:Oe,maxZoom:ve,preventScrolling:Ye,zoomOnScroll:Te,zoomOnPinch:De,zoomOnDoubleClick:yn,panOnScroll:tt,panOnScrollSpeed:At,panOnScrollMode:gn,panOnDrag:Fr,autoPanOnSelection:yi,onPaneClick:cn,onPaneMouseEnter:cr,onPaneMouseMove:$r,onPaneMouseLeave:Es,onPaneScroll:qn,onPaneContextMenu:yt,paneClickDistance:un,nodeClickDistance:Gn,onSelectionContextMenu:V,onSelectionStart:G,onSelectionEnd:q,onReconnect:An,onReconnectStart:Ht,onReconnectEnd:Zt,onEdgeContextMenu:Jt,onEdgeDoubleClick:Ur,onEdgeMouseEnter:Kn,onEdgeMouseMove:Ln,onEdgeMouseLeave:ur,reconnectRadius:dr,defaultMarkerColor:nn,noDragClassName:Ar,noWheelClassName:kr,noPanClassName:cs,rfId:dt,disableKeyboardA11y:ho,nodeExtent:xt,viewport:bi,onViewportChange:Nl,nodesDraggable:be}),m.jsx(iye,{onSelectionChange:$}),Rn,m.jsx(tye,{proOptions:El,position:Cs}),m.jsx(eye,{rfId:dt,disableKeyboardA11y:ho})]})})}var Bxe=RH(zxe);function Hxe({dimensions:e,lineWidth:t,variant:n,className:r}){return m.jsx("path",{strokeWidth:t,d:`M${e[0]/2} 0 V${e[1]} M0 ${e[1]/2} H${e[0]}`,className:Vn(["react-flow__background-pattern",n,r])})}function Fxe({radius:e,className:t}){return m.jsx("circle",{cx:e,cy:e,r:e,className:Vn(["react-flow__background-pattern","dots",t])})}var ka;(function(e){e.Lines="lines",e.Dots="dots",e.Cross="cross"})(ka||(ka={}));const $xe={[ka.Dots]:1,[ka.Lines]:1,[ka.Cross]:6},Uxe=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function tF({id:e,variant:t=ka.Dots,gap:n=20,size:r,lineWidth:s=1,offset:o=0,color:l,bgColor:c,style:u,className:f,patternClassName:h}){const p=N.useRef(null),{transform:y,patternId:x}=It(Uxe,Cn),b=r||$xe[t],S=t===ka.Dots,E=t===ka.Cross,C=Array.isArray(n)?n:[n,n],O=[C[0]*y[2]||1,C[1]*y[2]||1],T=b*y[2],R=Array.isArray(o)?o:[o,o],k=E?[T,T]:O,M=[R[0]*y[2]+k[0]/2,R[1]*y[2]+k[1]/2],A=`${x}${e||""}`;return m.jsxs("svg",{className:Vn(["react-flow__background",f]),style:{...u,...Ib,"--xy-background-color-props":c,"--xy-background-pattern-color-props":l},ref:p,"data-testid":"rf__background",children:[m.jsx("pattern",{id:A,x:y[0]%O[0],y:y[1]%O[1],width:O[0],height:O[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${M[0]},-${M[1]})`,children:S?m.jsx(Fxe,{radius:T/2,className:h}):m.jsx(Hxe,{dimensions:k,lineWidth:s,variant:t,className:h})}),m.jsx("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${A})`})]})}tF.displayName="Background";N.memo(tF);function Vxe(){return m.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32",children:m.jsx("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"})})}function qxe(){return m.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5",children:m.jsx("path",{d:"M0 0h32v4.2H0z"})})}function Gxe(){return m.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30",children:m.jsx("path",{d:"M3.692 4.63c0-.53.4-.938.939-.938h5.215V0H4.708C2.13 0 0 2.054 0 4.63v5.216h3.692V4.631zM27.354 0h-5.2v3.692h5.17c.53 0 .984.4.984.939v5.215H32V4.631A4.624 4.624 0 0027.354 0zm.954 24.83c0 .532-.4.94-.939.94h-5.215v3.768h5.215c2.577 0 4.631-2.13 4.631-4.707v-5.139h-3.692v5.139zm-23.677.94c-.531 0-.939-.4-.939-.94v-5.138H0v5.139c0 2.577 2.13 4.707 4.708 4.707h5.138V25.77H4.631z"})})}function Kxe(){return m.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:m.jsx("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0 8 0 4.571 3.429 4.571 7.619v3.048H3.048A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047zm4.724-13.866H7.467V7.619c0-2.59 2.133-4.724 4.723-4.724 2.591 0 4.724 2.133 4.724 4.724v3.048z"})})}function Yxe(){return m.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:m.jsx("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0c-4.114 1.828-1.37 2.133.305 2.438 1.676.305 4.42 2.59 4.42 5.181v3.048H3.047A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047z"})})}function Q0({children:e,className:t,...n}){return m.jsx("button",{type:"button",className:Vn(["react-flow__controls-button",t]),...n,children:e})}const Wxe=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom,ariaLabelConfig:e.ariaLabelConfig});function nF({style:e,showZoom:t=!0,showFitView:n=!0,showInteractive:r=!0,fitViewOptions:s,onZoomIn:o,onZoomOut:l,onFitView:c,onInteractiveChange:u,className:f,children:h,position:p="bottom-left",orientation:y="vertical","aria-label":x}){const b=an(),{isInteractive:S,minZoomReached:E,maxZoomReached:C,ariaLabelConfig:O}=It(Wxe,Cn),{zoomIn:T,zoomOut:R,fitView:k}=Mb(),M=()=>{T(),o==null||o()},A=()=>{R(),l==null||l()},I=()=>{k(s),c==null||c()},L=()=>{b.setState({nodesDraggable:!S,nodesConnectable:!S,elementsSelectable:!S}),u==null||u(!S)},D=y==="horizontal"?"horizontal":"vertical";return m.jsxs(_b,{className:Vn(["react-flow__controls",D,f]),position:p,style:e,"data-testid":"rf__controls","aria-label":x??O["controls.ariaLabel"],children:[t&&m.jsxs(m.Fragment,{children:[m.jsx(Q0,{onClick:M,className:"react-flow__controls-zoomin",title:O["controls.zoomIn.ariaLabel"],"aria-label":O["controls.zoomIn.ariaLabel"],disabled:C,children:m.jsx(Vxe,{})}),m.jsx(Q0,{onClick:A,className:"react-flow__controls-zoomout",title:O["controls.zoomOut.ariaLabel"],"aria-label":O["controls.zoomOut.ariaLabel"],disabled:E,children:m.jsx(qxe,{})})]}),n&&m.jsx(Q0,{className:"react-flow__controls-fitview",onClick:I,title:O["controls.fitView.ariaLabel"],"aria-label":O["controls.fitView.ariaLabel"],children:m.jsx(Gxe,{})}),r&&m.jsx(Q0,{className:"react-flow__controls-interactive",onClick:L,title:O["controls.interactive.ariaLabel"],"aria-label":O["controls.interactive.ariaLabel"],children:S?m.jsx(Yxe,{}):m.jsx(Kxe,{})}),h]})}nF.displayName="Controls";N.memo(nF);function Xxe({id:e,x:t,y:n,width:r,height:s,style:o,color:l,strokeColor:c,strokeWidth:u,className:f,borderRadius:h,shapeRendering:p,selected:y,onClick:x}){const{background:b,backgroundColor:S}=o||{},E=l||b||S;return m.jsx("rect",{className:Vn(["react-flow__minimap-node",{selected:y},f]),x:t,y:n,rx:h,ry:h,width:r,height:s,style:{fill:E,stroke:c,strokeWidth:u},shapeRendering:p,onClick:x?C=>x(C,e):void 0})}const Qxe=N.memo(Xxe),Zxe=e=>e.nodes.map(t=>t.id),dw=e=>e instanceof Function?e:()=>e;function Jxe({nodeStrokeColor:e,nodeColor:t,nodeClassName:n="",nodeBorderRadius:r=5,nodeStrokeWidth:s,nodeComponent:o=Qxe,onClick:l}){const c=It(Zxe,Cn),u=dw(t),f=dw(e),h=dw(n),p=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision";return m.jsx(m.Fragment,{children:c.map(y=>m.jsx(tbe,{id:y,nodeColorFunc:u,nodeStrokeColorFunc:f,nodeClassNameFunc:h,nodeBorderRadius:r,nodeStrokeWidth:s,NodeComponent:o,onClick:l,shapeRendering:p},y))})}function ebe({id:e,nodeColorFunc:t,nodeStrokeColorFunc:n,nodeClassNameFunc:r,nodeBorderRadius:s,nodeStrokeWidth:o,shapeRendering:l,NodeComponent:c,onClick:u}){const{node:f,x:h,y:p,width:y,height:x}=It(b=>{const S=b.nodeLookup.get(e);if(!S)return{node:void 0,x:0,y:0,width:0,height:0};const E=S.internals.userNode,{x:C,y:O}=S.internals.positionAbsolute,{width:T,height:R}=Io(E);return{node:E,x:C,y:O,width:T,height:R}},Cn);return!f||f.hidden||!tH(f)?null:m.jsx(c,{x:h,y:p,width:y,height:x,style:f.style,selected:!!f.selected,className:r(f),color:t(f),borderRadius:s,strokeColor:n(f),strokeWidth:o,shapeRendering:l,onClick:u,id:f.id})}const tbe=N.memo(ebe);var nbe=N.memo(Jxe);const rbe=200,sbe=150,obe=e=>!e.hidden,ibe=e=>{const t={x:-e.transform[0]/e.transform[2],y:-e.transform[1]/e.transform[2],width:e.width/e.transform[2],height:e.height/e.transform[2]};let n=!1;for(const r of e.nodeLookup.values())if(!r.hidden){n=!0;break}return{viewBB:t,boundingRect:n?Z8($m(e.nodeLookup,{filter:obe}),t):t,rfId:e.rfId,panZoom:e.panZoom,translateExtent:e.translateExtent,flowWidth:e.width,flowHeight:e.height,ariaLabelConfig:e.ariaLabelConfig}},cD=(e,t)=>e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height,lbe=(e,t)=>cD(e.viewBB,t.viewBB)&&cD(e.boundingRect,t.boundingRect)&&e.rfId===t.rfId&&e.panZoom===t.panZoom&&e.translateExtent===t.translateExtent&&e.flowWidth===t.flowWidth&&e.flowHeight===t.flowHeight&&e.ariaLabelConfig===t.ariaLabelConfig,abe="react-flow__minimap-desc";function rF({style:e,className:t,nodeStrokeColor:n,nodeColor:r,nodeClassName:s="",nodeBorderRadius:o=5,nodeStrokeWidth:l,nodeComponent:c,bgColor:u,maskColor:f,maskStrokeColor:h,maskStrokeWidth:p,position:y="bottom-right",onClick:x,onNodeClick:b,pannable:S=!1,zoomable:E=!1,ariaLabel:C,inversePan:O,zoomStep:T=1,offsetScale:R=5}){const k=an(),M=N.useRef(null),{boundingRect:A,panZoom:I,viewBB:L,rfId:D,translateExtent:P,flowWidth:z,flowHeight:$,ariaLabelConfig:j}=It(ibe,lbe),H=(e==null?void 0:e.width)??rbe,B=(e==null?void 0:e.height)??sbe,V=A.width/H,G=A.height/B,q=Math.max(V,G),K=q*H,W=q*B,ee=R*q,ce=A.x-(K-A.width)/2-ee,F=A.y-(W-A.height)/2-ee,X=K+ee*2,te=W+ee*2,Z=`${abe}-${D}`,Y=N.useRef(0),le=N.useRef();Y.current=q,N.useEffect(()=>{const he=k.getState().panZoom;if(M.current&&he)return le.current=R0e({domNode:M.current,panZoom:he,getTransform:()=>k.getState().transform,getViewScale:()=>Y.current}),()=>{var Se;(Se=le.current)==null||Se.destroy()}},[I]),N.useEffect(()=>{var he;(he=le.current)==null||he.update({translateExtent:P,width:z,height:$,inversePan:O,pannable:S,zoomStep:T,zoomable:E})},[S,E,O,T,P,z,$]);const xe=x?he=>{var be;const[Se,ke]=((be=le.current)==null?void 0:be.pointer(he))||[0,0];x(he,{x:Se,y:ke})}:void 0,fe=N.useCallback((he,Se)=>{const ke=k.getState().nodeLookup.get(Se).internals.userNode;b==null||b(he,ke)},[b]),oe=b?fe:void 0,re=C??j["minimap.ariaLabel"];return m.jsx(_b,{position:y,style:{...e,"--xy-minimap-background-color-props":typeof u=="string"?u:void 0,"--xy-minimap-mask-background-color-props":typeof f=="string"?f:void 0,"--xy-minimap-mask-stroke-color-props":typeof h=="string"?h:void 0,"--xy-minimap-mask-stroke-width-props":typeof p=="number"?p*q:void 0,"--xy-minimap-node-background-color-props":typeof r=="string"?r:void 0,"--xy-minimap-node-stroke-color-props":typeof n=="string"?n:void 0,"--xy-minimap-node-stroke-width-props":typeof l=="number"?l:void 0},className:Vn(["react-flow__minimap",t]),"data-testid":"rf__minimap",children:m.jsxs("svg",{width:H,height:B,viewBox:`${ce} ${F} ${X} ${te}`,className:"react-flow__minimap-svg",role:"img","aria-labelledby":Z,ref:M,onClick:xe,children:[re&&m.jsx("title",{id:Z,children:re}),m.jsx(nbe,{onClick:oe,nodeColor:r,nodeStrokeColor:n,nodeBorderRadius:o,nodeClassName:s,nodeStrokeWidth:l,nodeComponent:c}),m.jsx("path",{className:"react-flow__minimap-mask",d:`M${ce-ee},${F-ee}h${X+ee*2}v${te+ee*2}h${-X-ee*2}z
|
|
357
|
+
M${L.x},${L.y}h${L.width}v${L.height}h${-L.width}z`,fillRule:"evenodd",pointerEvents:"none"})]})})}rF.displayName="MiniMap";N.memo(rF);const cbe=e=>t=>e?`${Math.max(1/t.transform[2],1)}`:void 0,ube={[bf.Line]:"right",[bf.Handle]:"bottom-right"};function dbe({nodeId:e,position:t,variant:n=bf.Handle,className:r,style:s=void 0,children:o,color:l,minWidth:c=10,minHeight:u=10,maxWidth:f=Number.MAX_VALUE,maxHeight:h=Number.MAX_VALUE,keepAspectRatio:p=!1,resizeDirection:y,autoScale:x=!0,shouldResize:b,onResizeStart:S,onResize:E,onResizeEnd:C}){const O=IH(),T=typeof e=="string"?e:O,R=an(),k=N.useRef(null),M=n===bf.Handle,A=It(N.useCallback(cbe(M&&x),[M,x]),Cn),I=N.useRef(null),L=t??ube[n];N.useEffect(()=>{if(!(!k.current||!T))return I.current||(I.current=F0e({domNode:k.current,nodeId:T,getStoreItems:()=>{const{nodeLookup:P,transform:z,snapGrid:$,snapToGrid:j,nodeOrigin:H,domNode:B}=R.getState();return{nodeLookup:P,transform:z,snapGrid:$,snapToGrid:j,nodeOrigin:H,paneDomNode:B}},onChange:(P,z)=>{const{triggerNodeChanges:$,nodeLookup:j,parentLookup:H,nodeOrigin:B}=R.getState(),V=[],G={x:P.x,y:P.y},q=j.get(T);if(q&&q.expandParent&&q.parentId){const K=q.origin??B,W=P.width??q.measured.width??0,ee=P.height??q.measured.height??0,ce={id:q.id,parentId:q.parentId,rect:{width:W,height:ee,...nH({x:P.x??q.position.x,y:P.y??q.position.y},{width:W,height:ee},q.parentId,j,K)}},F=cN([ce],j,H,B);V.push(...F),G.x=P.x?Math.max(K[0]*W,P.x):void 0,G.y=P.y?Math.max(K[1]*ee,P.y):void 0}if(G.x!==void 0&&G.y!==void 0){const K={id:T,type:"position",position:{...G}};V.push(K)}if(P.width!==void 0&&P.height!==void 0){const W={id:T,type:"dimensions",resizing:!0,setAttributes:y?y==="horizontal"?"width":"height":!0,dimensions:{width:P.width,height:P.height}};V.push(W)}for(const K of z){const W={...K,type:"position"};V.push(W)}$(V)},onEnd:({width:P,height:z})=>{const $={id:T,type:"dimensions",resizing:!1,dimensions:{width:P,height:z}};R.getState().triggerNodeChanges([$])}})),I.current.update({controlPosition:L,boundaries:{minWidth:c,minHeight:u,maxWidth:f,maxHeight:h},keepAspectRatio:p,resizeDirection:y,onResizeStart:S,onResize:E,onResizeEnd:C,shouldResize:b}),()=>{var P;(P=I.current)==null||P.destroy()}},[L,c,u,f,h,p,S,E,C,b]);const D=L.split("-");return m.jsx("div",{className:Vn(["react-flow__resize-control","nodrag",...D,n,r]),ref:k,style:{...s,scale:A,...l&&{[M?"backgroundColor":"borderColor"]:l}},children:o})}N.memo(dbe);const fbe="Cancel",hbe=({title:e,description:t,confirmLabel:n,onConfirm:r,onCancel:s})=>m.jsx(ml,{open:!0,onOpenChange:o=>{o||s()},children:m.jsxs(gl,{showCloseButton:!1,children:[m.jsxs(yl,{children:[m.jsx(bl,{children:e}),m.jsx(vl,{children:t})]}),m.jsxs(xl,{children:[m.jsx(st,{type:"button",variant:"ghost",onClick:s,children:fbe}),m.jsx(st,{type:"button",variant:"destructive",onClick:r,children:n})]})]})}),pbe={trigger:"",call:"",value:"[stroke-dasharray:7_5]",data:"[stroke-dasharray:1_6] [stroke-linecap:round]"},mbe="M1 1 9 5 1 9z",gbe="fill-current stroke-current [stroke-linejoin:round] [stroke-width:1.5]",ybe="fill-background stroke-current [stroke-linejoin:round] [stroke-width:1.5]",xbe=["selected","hovered"],sF={selected:"text-primary",hovered:"text-primary/60"},oF=(e,t)=>t===null?e:`${e}-${t}`,uD=({baseId:e,isAssumed:t,emphasis:n})=>m.jsx("marker",{id:oF(e,n),viewBox:"0 0 10 10",refX:"9",refY:"5",markerWidth:"7",markerHeight:"7",orient:"auto-start-reverse",className:n===null?void 0:sF[n],children:m.jsx("path",{d:mbe,className:t?ybe:gbe})}),bbe="fill-none stroke-current [stroke-linejoin:round] [stroke-width:2]",vbe=()=>{const e=N.useId();return{proven:`${e}-proven`,assumed:`${e}-assumed`}},Sbe=({markers:e})=>m.jsx("defs",{children:[null,...xbe].map(t=>m.jsxs(N.Fragment,{children:[m.jsx(uD,{baseId:e.proven,isAssumed:!1,emphasis:t}),m.jsx(uD,{baseId:e.assumed,isAssumed:!0,emphasis:t})]},t??"plain"))}),wbe=({path:e,kind:t,isAssumed:n,emphasis:r=null,hasArrow:s=!0,markers:o})=>m.jsx("path",{d:e,"data-kind":t,"data-assumed":n,"data-emphasis":r??void 0,markerEnd:s?`url(#${oF(n?o.assumed:o.proven,r)})`:void 0,className:ye(bbe,pbe[t],"transition-colors duration-[180ms] ease-out",r!==null&&sF[r])}),Ebe=new Set,Cbe=[],Tbe=[],Nbe=(e,t)=>new Set(e.has(t)?[...e].filter(n=>n!==t):[...e,t]),Obe='[data-focused="true"]',Rbe=(e,t)=>{const n=Number.parseInt(e,10);return t.some(([r,s])=>r<=n&&n<=s)},Abe=(e,t)=>t===null?e:e.map(n=>({...n,isFocused:Rbe(n.numberLabel,t)})),kbe=({id:e,rows:t},n)=>t.map(r=>r.kind==="lines"?{...r,lines:Abe(r.lines,n)}:r.kind==="waypoint"?{...r,waypoint:{...r.waypoint,anchorId:`${e}-${r.waypoint.anchorId}`}}:r),_be=({view:e,focusedLines:t=null,isReviewPending:n,codeLinks:r,codeDefinitions:s,onOpenCodeLink:o,onWaypointReviewedChange:l})=>{const[c,u]=N.useState(Ebe),f=`${e.pathLabel}, ${e.rangeLabel}`,h=N.useRef(null);return N.useEffect(()=>{var p,y;t!==null&&((y=(p=h.current)==null?void 0:p.querySelector(Obe))==null||y.scrollIntoView({block:"center"}))},[t]),m.jsxs("section",{ref:h,"aria-label":`${e.heading}, ${f}`,"data-reference-scope":"",className:"border-t",children:[m.jsxs("h4",{className:"px-4 pt-3 text-xs text-muted-foreground",children:[m.jsx("span",{className:"font-bold",children:e.heading}),e.countLabel===null?null:m.jsx("span",{className:"tabular-nums",children:` • ${e.countLabel}`})]}),m.jsxs("div",{className:"flex flex-wrap items-baseline justify-between gap-x-4 gap-y-1 px-4 py-2",children:[m.jsx("span",{className:"min-w-0 font-mono text-[0.8125rem] wrap-anywhere",children:e.pathLabel}),m.jsx("span",{className:"text-xs text-muted-foreground tabular-nums",children:e.rangeLabel})]}),m.jsx("div",{className:"border-y bg-code",children:m.jsx(t8,{path:e.pathLabel,label:f,rows:kbe(e,t),rootBlocks:Cbe,threads:Tbe,openWaypointIds:c,currentWaypointId:null,focusedWaypointId:null,isWrapped:!0,isReviewPending:n,commenting:null,codeLinks:r,codeDefinitions:s,onOpenCodeLink:o,onToggleWaypoint:p=>{u(y=>Nbe(y,p))},onWaypointReviewedChange:l,onRootBlockReviewedChange:null})}),e.note===null&&e.forgeLink===null?null:m.jsxs("div",{className:"flex flex-wrap items-baseline gap-x-4 gap-y-1 px-4 py-2 text-xs",children:[e.note===null?null:m.jsx("span",{className:"text-muted-foreground",children:e.note}),e.forgeLink===null?null:m.jsx(Wa,{href:e.forgeLink.href,label:e.forgeLink.label})]})]})},dN=264,Qa=96,Mbe=36,Ibe=48,Lbe=16,Dbe=20,jbe=4,vf=24,Vp=18,Pbe=6,zbe=6,dx=10,Bbe=8,fN=96,qm=32,oi=24,io=2,iF=dN-dx*io,hN={nodes:[],rows:[],lanes:[]},Db=e=>e.reduce((t,n)=>t+n,0),Hbe={heading:Lbe,row:Mbe,"two-line-row":Ibe},dD=1,lF=({kind:e,lineCount:t=dD})=>e==="parameters"?t*Dbe+(t-dD)*jbe:Hbe[e],aF="card",Fbe=e=>e.kind!==aF,cF=e=>{const t=new Map(e.children.map(r=>[r.id,r])),n=new Set(e.rows.filter(r=>r.kind===aF).map(r=>r.id));return[...e.rows.flatMap(r=>{if(Fbe(r))return[{kind:"row",row:r}];const s=t.get(r.id);return s===void 0?[]:[{kind:"card",node:s}]}),...e.children.filter(r=>!n.has(r.id)).map(r=>({kind:"card",node:r}))]},uF=e=>(e.kind==="row"?lF(e.row):Gm(e.node).height)+zbe,Gm=e=>{const t=e.children.map(Gm);return{width:Math.max(dN,...t.map(n=>n.width+dx*io)),height:Qa+Db(cF(e).map(uF))+Bbe}},dF=(e,t,n,r)=>{const{height:s}=Gm(e),o={x:t.x+dx,width:t.width-dx*io},l=(u,f)=>u.kind==="row"?{nodes:[],rows:[{id:u.row.id,kind:u.row.kind,nodeId:e.id,...o,y:f,height:lF(u.row)}],lanes:[]}:dF(u.node,{...o,y:f},n+1,r),{placed:c}=cF(e).reduce(({top:u,placed:f},h)=>({top:u+uF(h),placed:pN([f,l(h,u)])}),{top:t.y+Qa,placed:hN});return{nodes:[{id:e.id,topId:r,depth:n,...t,height:s},...c.nodes],rows:c.rows,lanes:[]}},fF=e=>[e.id,...e.children.flatMap(fF)],pN=e=>({nodes:e.flatMap(t=>t.nodes),rows:e.flatMap(t=>t.rows),lanes:e.flatMap(t=>t.lanes)}),$be=(e,t)=>{const n=new Map(e.flatMap(r=>fF(r).map(s=>[s,r.id])));return t.flatMap(r=>{const s=n.get(r.from),o=n.get(r.to);return s===void 0||o===void 0||s===o?[]:[{edge:r,from:s,to:o}]})},Ube={visitedIds:new Set,closingLinks:[]},hF=(e,t,n,r)=>{if(r.visitedIds.has(e))return r;const s=[...t,e];return n.filter(o=>o.from===e).reduce((o,l)=>s.includes(l.to)?{...o,closingLinks:[...o.closingLinks,l]}:hF(l.to,s,n,o),{...r,visitedIds:new Set([...r.visitedIds,e])})},Vbe=(e,t)=>{const n=new Set(t.map(o=>o.to)),r=[...e.filter(o=>!n.has(o.id)),...e.filter(o=>n.has(o.id))].map(o=>o.id),{closingLinks:s}=r.reduce((o,l)=>hF(l,[],t,o),Ube);return t.filter(o=>!s.includes(o))},qbe=(e,t,n)=>new Map([...e].map(([r,s])=>{const o=t.filter(l=>l.to===r).map(l=>(e.get(l.from)??0)+1);return[r,Math.min(n,Math.max(s,...o))]})),Gbe=e=>{const t=[...new Set(e.values())].sort((n,r)=>n-r);return new Map([...e].map(([n,r])=>[n,t.indexOf(r)]))},Kbe=(e,t)=>{const n=Vbe(e,t);return Gbe(e.reduce(r=>qbe(r,n,e.length-1),new Map(e.map(r=>[r.id,0]))))},fx=(e,t)=>e.get(t)??0,Ybe=({from:e,to:t},n,r)=>fx(r,e)<n&&n<fx(r,t),gC=e=>e.y+Qa/io,yC=e=>e.y+e.height/io,Wbe=({from:e,fromRowId:t},{nodes:n,rows:r})=>{const s=t===null?void 0:r.find(l=>l.id===t);if(s!==void 0)return yC(s);const o=n.find(l=>l.id===e);return o===void 0?null:gC(o)},xC=({y:e,edgeIds:t},n)=>e+t.indexOf(n)*Vp,hx=e=>(e.length-1)*Vp,pF=(e,t,n)=>{const r=n.lanes.find(s=>s.toId===e.to&&s.column===t-1&&s.edgeIds.includes(e.edge.id));return r===void 0?Wbe(e.edge,n):xC(r,e.edge.id)},Xbe=(e,t,n,r,s)=>n.filter(o=>o.to===e&&fx(r,o.from)<t).flatMap(o=>pF(o,t,s)??[]),Qbe=(e,t,n,r)=>{const s=t.filter(o=>o.to===e).map((o,l)=>({link:o,index:l,comingFrom:pF(o,n,r)??0})).sort((o,l)=>o.comingFrom-l.comingFrom||o.index-l.index).map(({link:o})=>o.edge.id);return{node:null,toId:e,height:hx(s),anchorHeight:hx(s),edgeIds:s}},Zbe=(e,t,n,r,s)=>{const o=n.filter(c=>Ybe(c,t,r)),l=[...new Set(o.map(c=>c.to))];return[...e.filter(c=>fx(r,c.id)===t).map(c=>({node:c,toId:c.id,height:Gm(c).height,anchorHeight:Qa,edgeIds:[]})),...l.map(c=>Qbe(c,o,t,s))]},Jbe=({toId:e,anchorHeight:t},n)=>{const r=n(e);return r.length===0?oi:Db(r)/r.length-t/io},eve=({node:e,toId:t,edgeIds:n},r,s)=>e===null?{...hN,lanes:[{toId:t,column:r,x:s.x,width:s.width,y:s.y,edgeIds:n}]}:dF(e,s,0,e.id),mF=e=>e.reduce(({bottom:t,offsets:n},{item:r})=>({bottom:t+r.height+qm,offsets:[...n,t]}),{bottom:0,offsets:[]}).offsets,tve=({members:e})=>Db(e.map(({item:t})=>t.height))+qm*(e.length-1),nve=e=>{const t=mF(e);return Db(e.map(({top:n},r)=>n-t[r]))/e.length},rve=(e,t)=>e.top+tve(e)+qm>t.top,sve=(e,t)=>{const n=[...e.members,...t.members];return{members:n,top:nve(n)}},gF=(e,t)=>{const n=e.at(-1);return n!==void 0&&rve(n,t)?gF(e.slice(0,-1),sve(n,t)):[...e,t]},ove=e=>e.reduce((t,n)=>gF(t,{members:[n],top:n.top}),[]),ive=(e,t,n,r)=>{const s=e.map((l,c)=>({item:l,index:c,top:Jbe(l,r)})).sort((l,c)=>l.top-c.top||l.index-c.index),o=Math.max(dN,...e.flatMap(({node:l})=>l===null?[]:[Gm(l).width]));return pN(ove(s).flatMap(l=>{const c=Math.round(l.top),u=mF(l.members);return l.members.map(({item:f},h)=>eve(f,t,{x:n,y:c+u[h],width:o}))}))},lve=({nodes:e,lanes:t})=>Math.min(...e.map(n=>n.y),...t.map(n=>n.y)),ave=({nodes:e,rows:t,lanes:n},r)=>({nodes:e.map(s=>({...s,y:s.y+r})),rows:t.map(s=>({...s,y:s.y+r})),lanes:n.map(s=>({...s,y:s.y+r}))}),cve=e=>ave(e,oi-lve(e)),yF=({nodes:e,lanes:t})=>Math.max(oi-fN,...e.map(n=>n.x+n.width),...t.map(n=>n.x+n.width)),uve=(e,t,n)=>[...new Set(n.values())].sort((s,o)=>s-o).reduce((s,o)=>{const l=Zbe(e,o,t,n,s),c=ive(l,o,yF(s)+fN,u=>Xbe(u,o,t,n,s));return pN([s,c])},hN),dve=({edge:e},t)=>t.filter(n=>n.edgeIds.includes(e.id)).sort((n,r)=>n.column-r.column).flatMap(n=>[{x:n.x,y:xC(n,e.id)},{x:n.x+n.width,y:xC(n,e.id)}]),fve=(e,{nodes:t,rows:n,lanes:r})=>{const s=new Map(t.map(l=>[l.id,l])),o=new Map(n.map(l=>[l.id,l]));return e.flatMap(l=>{const{edge:c}=l,u=s.get(c.from),f=s.get(c.to),h=s.get(l.from),p=s.get(l.to);if(u===void 0||f===void 0||h===void 0||p===void 0)return[];const y=c.fromRowId===null?void 0:o.get(c.fromRowId),x=c.toRowId===null?void 0:o.get(c.toRowId);return[{link:l,start:{x:h.x+h.width,y:y===void 0?gC(u):yC(y)},lanePoints:dve(l,r),end:{x:p.x,y:x===void 0?gC(f):yC(x)},fromRow:y,toRow:x}]})},fD=({link:e,toRow:t})=>(t==null?void 0:t.id)??e.edge.to,hD=({start:e,lanePoints:t})=>t.length===0?e.y:t[t.length-1].y,hve=(e,t)=>{const n=t.filter(l=>fD(l)===fD(e)).map((l,c)=>({other:l,index:c})).sort((l,c)=>hD(l.other)-hD(c.other)||l.index-c.index),r=(e.toRow===void 0?Qa:e.toRow.height)-Pbe*io,s=n.length<io?0:Math.min(Vp,r/(n.length-1)),o=n.findIndex(({other:l})=>l===e);return Math.round((o-(n.length-1)/io)*s)},xF=({start:e,end:t})=>e.x>=t.x,pve=(e,t,{nodes:n,lanes:r})=>Math.max(...n.filter(s=>s.x<t&&s.x+s.width>e).map(s=>s.y+s.height),...r.filter(s=>s.x<t&&s.x+s.width>e).map(s=>s.y+hx(s.edgeIds))),mve=(e,t,n,r)=>{const s=n.filter(xF),o=e.start.x+vf+s.indexOf(e)*Vp,l=t.x-vf,c=Math.max(...s.map(u=>pve(u.end.x,u.start.x,r)))+qm/io+s.indexOf(e)*Vp;return[{x:o,y:e.start.y},{x:o,y:c},{x:l,y:c},{x:l,y:t.y}]},gve=(e,t,n)=>{const{link:r,start:s,lanePoints:o,fromRow:l,toRow:c}=e,u={x:e.end.x,y:e.end.y+hve(e,t)},f=xF(e)?mve(e,u,t,n):[...o,{x:u.x-vf,y:u.y}];return{...r.edge,points:[s,...f,u],fromRowPoints:l===void 0?null:[{x:l.x+l.width,y:s.y},s],toRowPoints:c===void 0?null:[u,{x:c.x,y:u.y}]}},yve=(e,t)=>{const n=fve(e,t);return n.map(r=>gve(r,n,t))},xve=(e,t)=>{if(e.length===0)return{width:oi*io,height:oi*io,nodes:[],rows:[],edges:[]};const n=$be(e,t),r=Kbe(e,n),s=cve(uve(e,n,r)),o=yve(n,s),l=o.flatMap(c=>c.points);return{width:Math.max(yF(s),...l.map(c=>c.x))+oi,height:Math.max(...s.nodes.map(c=>c.y+c.height),...s.lanes.map(c=>c.y+hx(c.edgeIds)),...l.map(c=>c.y))+oi,nodes:s.nodes,rows:s.rows,edges:o}},bF=2,pD={x:0,y:0},bC="left",mD=({x:e,y:t})=>e===0&&t===0,_d=(e,t)=>({...e,x:e.x+t.x,y:e.y+t.y}),bve=(e,t,n)=>{const r=t.map(c=>{var u;return(((u=n.get(c.id))==null?void 0:u.x)??c.x)+c.width}),s=Math.max(...r)+fN,o=t.map(c=>{var u;return((u=n.get(c.id))==null?void 0:u.y)??c.y}),l=e.reduce(({bottom:c,positions:u},f)=>({bottom:c+f.height+qm,positions:[...u,[f.id,{x:s,y:c}]]}),{bottom:Math.max(oi,Math.min(...o)),positions:[]});return new Map(l.positions)},vve=(e,{x:t,y:n,width:r,height:s})=>{const o=[["left",Math.abs(e.x-t)],["top",Math.abs(e.y-n)],["bottom",Math.abs(e.y-(n+s))]],l=e.x>t+r/bF,[c]=[...o].filter(([u])=>u!=="left"||!l).sort(([,u],[,f])=>u-f);return c[0]},Sve=(e,t)=>{const n=e.nodes.filter(o=>o.depth===0),r=n.filter(o=>t.has(o.id)),s=n.filter(o=>!t.has(o.id));return r.length===0||s.length===0?t:new Map([...t,...bve(s,r,t)])},wve=(e,t)=>{const n=e.x+e.width/bF;return t==="top"?[{x:n,y:e.y-vf},{x:n,y:e.y}]:[{x:n,y:e.y+e.height+vf},{x:n,y:e.y+e.height}]},Eve=(e,t,n,r,s)=>{const o=_d(e.points[0],t),l=e.fromRowPoints===null?null:e.fromRowPoints.map(u=>_d(u,t));if(r!==bC&&s!==void 0)return{...e,points:[o,...wve(s,r)],fromRowPoints:l,toRowPoints:null};const c=_d(e.points[e.points.length-1],n);return{...e,points:[o,{x:c.x-vf,y:c.y},c],fromRowPoints:l,toRowPoints:e.toRowPoints===null?null:e.toRowPoints.map(u=>_d(u,n))}},Cve=(e,t,n)=>{const r=e.nodes.filter(h=>h.depth===0),s=new Map(r.map(h=>{const p=t.get(h.id);return[h.id,p===void 0?pD:{x:p.x-h.x,y:p.y-h.y}]})),o=h=>s.get(h)??pD,l=e.nodes.map(h=>_d(h,o(h.topId))),c=new Map(l.map(h=>[h.id,h])),u=h=>{var p;return o(((p=c.get(h))==null?void 0:p.topId)??h)},f=e.edges.map(h=>{const p=u(h.from),y=u(h.to),x=n.get(h.id)??bC;return mD(p)&&mD(y)&&x===bC?h:Eve(h,p,y,x,c.get(h.to))});return{width:Math.max(e.width,...l.map(h=>h.x+h.width+oi)),height:Math.max(e.height,...l.map(h=>h.y+h.height+oi)),nodes:l,rows:e.rows.map(h=>_d(h,u(h.nodeId))),edges:f}},Tve={x:0,y:0},vF=e=>e.flatMap(t=>[...t.children.map(n=>[n.id,t.id]),...vF(t.children)]),px=(e,t)=>({...e,x:e.x-t.x,y:e.y-t.y}),mx=(e,t)=>`${e}:${t}`,Nve=({id:e,from:t,to:n,points:r,fromRowPoints:s,toRowPoints:o})=>[{id:e,edgeId:e,source:t,target:n,points:r,hasArrow:o===null,isAboveNodes:!1},...s===null?[]:[{id:`${e}:from-row`,edgeId:e,source:t,target:t,points:s,hasArrow:!1,isAboveNodes:!0}],...o===null?[]:[{id:`${e}:to-row`,edgeId:e,source:n,target:n,points:o,hasArrow:!0,isAboveNodes:!0}]],Ove=e=>{const t=e.flatMap(Nve);return[...t.filter(n=>!n.isAboveNodes),...t.filter(n=>n.isAboveNodes)]},Rve=(e,t)=>t.flatMap(({id:n,source:r,target:s,points:o})=>[...r===e.id?[{id:mx(n,"source"),type:"source",...px(o[0],e)}]:[],...s===e.id?[{id:mx(n,"target"),type:"target",...px(o[o.length-1],e)}]:[]]),Ave=({id:e,edgeId:t,source:n,target:r,points:s,hasArrow:o,isAboveNodes:l})=>({id:e,edgeId:t,source:n,target:r,sourceHandleId:mx(e,"source"),targetHandleId:mx(e,"target"),bends:s.slice(1,-1),hasArrow:o,isAboveNodes:l}),kve=(e,t)=>{const n=new Map(vF(e)),r=new Map(t.nodes.map(o=>[o.id,o])),s=Ove(t.edges);return{frames:t.nodes.map(o=>{const l=n.get(o.id)??null,c=l===null?void 0:r.get(l);return{id:o.id,parentId:c===void 0?null:c.id,depth:o.depth,position:px({x:o.x,y:o.y},c??Tve),width:o.width,height:o.height,rows:t.rows.filter(u=>u.nodeId===o.id).map(u=>px(u,o)),handles:Rve(o,s)}}),lines:s.map(Ave)}},_ve="Not explained yet.",Mve="The agent is explaining this card.",SF="Explain this card",gx={"root-argument-value":jd,call:fE,request:fE,component:AX,hook:g3,class:MX,"root-variable":jd,config:jd,state:Cd,derived:Cd,data:Cd,"data-fetch":Cd,cache:Cd,"render-event":oM,"code-event":oM,effect:pE,"component-effect":pE,route:j1,resolver:j1,middleware:j1},mN={added:"border-diff-added",modified:"border-line-blue"},Ive={added:"text-diff-added",modified:"text-line-blue"},Lve={selected:"border-primary outline outline-primary",hovered:"border-primary/60 outline outline-primary/60"},wF={selected:"bg-accent outline outline-primary",hovered:"outline outline-primary/60"},gD={collapsedNodeIds:[],focusedNodeId:null},Dve="call",rl=2,EF="trace-node",CF="trace-new-card",vC="trace-new-card",SC="new-card:line-end",yD="trace-new-card-line",Jh=32,xD="Create Card",jve="nodrag nopan flex size-full items-center justify-center rounded-full border border-dashed border-primary bg-card text-primary transition-colors duration-[180ms] ease-out hover:bg-accent disabled:opacity-60",wC="trace-line",fw=1e3,Pve=4,TF={source:Ge.Right,target:Ge.Left},NF="right-auto bottom-auto size-0 min-h-0 min-w-0 transform-none border-0 bg-transparent",zve="size-full bg-[radial-gradient(circle,var(--border)_1px,transparent_1px)] bg-size-[16px_16px] select-none data-[measured=false]:invisible",Bve={hideAttribution:!0},EC="text-muted-foreground",bD={pointerEvents:"all"},Hve="absolute inset-0 rounded-md transition-colors duration-[180ms] ease-out",Fve="flex w-full flex-col rounded-md text-left",$ve="flex h-7 shrink-0 items-center gap-2 rounded-t-md border-b border-input bg-foreground/5 px-2.5",Uve="flex min-h-0 flex-1 flex-col justify-center gap-1 px-3",vD={argument:jd,property:jd,state:Cd,hook:g3,effect:pE,call:fE},OF="absolute flex items-center gap-2 rounded border border-input bg-card px-2 text-left transition-colors duration-[180ms] ease-out hover:bg-accent",Vve="absolute top-1 right-1 z-10 hidden gap-0.5 rounded-md border border-input bg-card p-0.5 group-focus-within:flex group-hover:flex data-[pinned=true]:flex",Z0="flex size-6 items-center justify-center rounded text-foreground transition-colors duration-[180ms] ease-out hover:bg-accent aria-pressed:text-primary-text",qve="Parameters",Gve=":parameters",Kve=6.7,Yve=14,Wve=4,Xve="absolute flex flex-wrap content-start gap-1",Qve="flex h-5 max-w-full items-center rounded-sm border bg-muted px-1.5 font-mono text-[0.6875rem] leading-4 text-muted-foreground",Zve="absolute flex items-end px-0.5 text-[0.625rem] leading-3 font-bold tracking-wide text-muted-foreground uppercase",SD="Show only the paths through this node",Jve="Hide the nodes this node leads to",eSe="Show the nodes this node leads to again",wD="Modify this card",ED="Delete this card and the cards it points to",tSe="Remove the selected line",nSe="Add card",RF="Clear diagram",AF="Remove diagram",rSe="This diagram has no card yet.",sSe="c",oSe="k",iSe="l",lSe={clear:{title:"Clear this diagram?",description:"Every card, every line and the description go. The diagram stays, empty.",confirmLabel:RF},remove:{title:"Remove this diagram?",description:"The diagram goes from this segment with its cards, its lines and its description.",confirmLabel:AF}},aSe="Draw a line from this row",kF=["left","top","bottom"],cSe={left:Ge.Left,top:Ge.Top,bottom:Ge.Bottom},uSe={left:"End a line on the left of this card",top:"End a line on the top of this card",bottom:"End a line on the bottom of this card"},qp="row:",dSe="side:",CD=5,TD=10,fSe="nodrag right-auto bottom-auto z-10 size-2.5 min-h-0 min-w-0 transform-none rounded-full border border-primary bg-card opacity-60 transition-opacity duration-[180ms] ease-out hover:opacity-100",hSe="cursor-pointer fill-none stroke-transparent [stroke-width:14]",pSe=new Map,mSe=".react-flow__node",gSe=28,ySe={stroke:"var(--primary)",strokeWidth:2},xSe="Collapse all",bSe="Expand all",vSe="q",gN=e=>e.flatMap(t=>[t,...gN(t.children)]),SSe=":heading:",_F=(e,t)=>[e.id,String(t)].join(SSe),MF=e=>e.blockLists.flatMap(({kind:t,label:n,blocks:r})=>r.map(s=>({kind:t,kindLabel:n,block:s}))),wSe=e=>e.rowGroups.flatMap(({label:t},n)=>t===null?[]:[{id:_F(e,n),label:t}]),ESe=e=>Math.min(iF,e.length*Kve+Yve),CSe=e=>e.reduce(({lineCount:t,lineWidth:n},r)=>{const s=ESe(r),o=n===0?s:n+Wve+s;return o<=iF?{lineCount:t,lineWidth:o}:{lineCount:t+1,lineWidth:s}},{lineCount:1,lineWidth:0}).lineCount,TSe=e=>`${e.id}${Gve}`,NSe=e=>e.parameters.length===0?[]:[{id:TSe(e),kind:"parameters",lineCount:CSe(e.parameters)}],OSe=({isDraft:e})=>e?"row":"two-line-row",RSe=e=>{const t=new Map([...e.blockLists.flatMap(({blocks:n})=>n),...e.triggerLabels].map(n=>[n.id,n]));return[...NSe(e),...e.rowGroups.flatMap(({label:n,rowIds:r,childIds:s},o)=>[...n===null?[]:[{id:_F(e,o),kind:"heading"}],...r.flatMap(l=>{const c=t.get(l);return c===void 0?[]:[{id:l,kind:OSe(c)}]}),...s.map(l=>({id:l,kind:"card"}))])]},IF=e=>({id:e.id,rows:RSe(e),children:e.children.map(IF)}),ASe=e=>new Map(e.flatMap(t=>gN([t]).map(n=>[n.id,t.id]))),kSe=(e,t)=>e.flatMap(n=>{const r=t.get(n.from),s=t.get(n.to);return r===void 0||s===void 0||r===s?[]:[{id:n.id,from:r,to:s}]}),ND=(e,t,{collapsedNodeIds:n,focusedNodeId:r})=>{const s=e.filter(u=>t.every(f=>f.to!==u.id)).map(u=>u.id),o=[...rae(t,n,s)].filter(u=>!n.includes(u)),l=r===null?null:nae(t,r),c=l===null?[]:e.filter(u=>!l.has(u.id)).map(u=>u.id);return new Set([...o,...c])},_Se=(e,t)=>e.includes(t)?e.filter(n=>n!==t):[...e,t],OD=(e,t,n)=>t.has(e)?"selected":n.has(e)?"hovered":null,MSe=(e,t)=>{const n=e===null?"border":"border-2";return t!==null?ye(n,Lve[t]):ye(n,e===null?"border-input":mN[e])},yx=({x:e,y:t,width:n,height:r})=>({left:e,top:t,width:n,height:r}),ISe=({hint:e})=>e===null?null:m.jsx("span",{className:"line-clamp-2 text-[0.75rem] leading-4 text-muted-foreground",children:e}),LSe=(e,t)=>e===null||t===null||!e.isDraft||e.isBeingWritten?[]:[Un({key:If,actionId:"explain-trace-card-action",label:SF,onRun:()=>{t(e.id)}})],DSe=(e,t,n)=>e===null?[]:[Un({key:sSe,actionId:"add-card-action",label:nSe,onRun:e.onAddCard}),Un({key:oSe,actionId:"clear-diagram-action",label:RF,isDisabled:e.isPending||t===0,disabledHint:t===0?rSe:null,onRun:()=>{n("clear")}}),Un({key:iSe,actionId:"remove-diagram-action",label:AF,isDisabled:e.isPending,onRun:()=>{n("remove")}})],jSe=(e,t)=>t==="clear"?e.onClearDiagram:e.onRemoveDiagram,PSe=({node:e,cardActions:t,depth:n,emphasis:r,isSelected:s,isCollapsed:o,isFocusedOn:l,onSelect:c,onHoverChange:u,onFocusToggle:f,onCollapseToggle:h})=>{const p=Object.hasOwn(gx,e.type)?gx[e.type]:L2,y=o?A3:IX,x=o?eSe:Jve;return m.jsxs("div",{"data-node-id":e.id,"data-type":e.type,"data-change":e.change??void 0,"data-emphasis":r??void 0,className:ye("group",Hve,n%rl===1?"bg-muted":"bg-card",MSe(e.change,r)),children:[m.jsxs("button",{type:"button","aria-pressed":s,"data-user-action-id":"trace-diagram-card-action","data-change":e.change??void 0,className:Fve,style:{height:Qa},onMouseEnter:()=>{u(!0)},onMouseLeave:()=>{u(!1)},onFocus:()=>{u(!0)},onBlur:()=>{u(!1)},onClick:c,children:[m.jsxs("span",{"data-node-header":e.id,className:$ve,children:[m.jsx(p,{"aria-hidden":"true",className:"size-3.5 shrink-0 text-muted-foreground"}),m.jsx("span",{className:"max-w-[60%] shrink-0 truncate font-mono text-[0.75rem] leading-4 font-bold",children:e.name}),m.jsx("span",{title:e.shortPath,className:"ml-auto min-w-0 truncate font-mono text-[0.6875rem] leading-4 text-muted-foreground",children:e.shortPath})]}),m.jsxs("span",{className:Uve,children:[m.jsxs("span",{className:"flex min-w-0 items-center gap-1 text-[0.6875rem] leading-4 text-muted-foreground",children:[m.jsx("span",{className:"shrink-0",children:e.typeLabel}),e.classification.label===e.typeLabel?null:m.jsx("span",{className:"min-w-0 truncate before:mr-1 before:content-['•']",children:e.classification.label}),e.change===null||e.changedLabel===null?null:m.jsx("span",{className:ye("ml-auto font-bold",Ive[e.change]),children:e.changedLabel})]}),m.jsx(ul,{isPending:e.isDraft,lineCount:2,className:"w-full gap-1 py-0 text-[0.8125rem] [&>[aria-hidden]]:my-[0.2em]",children:e.isDraft?m.jsx(ISe,{hint:e.hint}):m.jsx("span",{className:"line-clamp-2 text-[0.8125rem] leading-4 font-bold",children:e.label})})]})]}),n>0&&t===null?null:m.jsxs("div",{role:"toolbar","aria-label":e.label,"data-pinned":l||o,className:ye("nodrag",Vve),children:[t===null?null:m.jsxs(m.Fragment,{children:[m.jsx("button",{type:"button","aria-label":`${wD}: ${e.label}`,title:wD,className:Z0,onClick:t.onEdit,children:m.jsx(Q3,{"aria-hidden":"true",className:"size-3.5"})}),m.jsx("button",{type:"button",disabled:t.isPending,"aria-label":`${ED}: ${e.label}`,title:ED,className:Z0,onClick:t.onRemove,children:m.jsx(I2,{"aria-hidden":"true",className:"size-3.5"})})]}),n>0?null:m.jsxs(m.Fragment,{children:[m.jsx("button",{type:"button","aria-pressed":l,"aria-label":`${SD}: ${e.label}`,title:SD,className:Z0,onClick:f,children:m.jsx(zX,{"aria-hidden":"true",className:"size-3.5"})}),m.jsx("button",{type:"button","aria-pressed":o,"aria-label":`${x}: ${e.label}`,title:x,className:Z0,onClick:h,children:m.jsx(y,{"aria-hidden":"true",className:"size-3.5"})})]})]})]})},zSe=({trigger:e,placed:t,emphasis:n,onSelect:r,onHoverChange:s})=>{const o=Object.hasOwn(gx,e.type)?gx[e.type]:L2;return m.jsxs("button",{type:"button","data-trigger-id":e.id,"data-change":e.change??void 0,"aria-label":`${e.typeLabel}: ${e.label}`,title:e.isDraft?e.hint??void 0:void 0,className:ye(OF,e.change!==null&&mN[e.change],n!==null&&wF[n]),style:yx(t),onMouseEnter:()=>{s(!0)},onMouseLeave:()=>{s(!1)},onFocus:()=>{s(!0)},onBlur:()=>{s(!1)},onClick:r,children:[m.jsx(o,{"aria-hidden":"true",className:"size-3.5 shrink-0 text-muted-foreground"}),m.jsxs("span",{className:"flex min-w-0 flex-col",children:[m.jsx(ul,{isPending:e.isDraft,className:"h-4 w-24 py-0 text-[0.75rem]",children:m.jsx("span",{className:ye("truncate text-[0.75rem] leading-4",e.isDraft?"font-mono text-muted-foreground":"font-bold"),children:e.label})}),e.isDraft?null:m.jsx("span",{className:"truncate font-mono text-[0.6875rem] leading-4 text-muted-foreground",children:e.name})]})]})},BSe=({row:{kind:e,kindLabel:t,block:n},placed:r,emphasis:s,onSelect:o,onHoverChange:l})=>{const c=Object.hasOwn(vD,e)?vD[e]:L2;return m.jsxs("button",{type:"button","data-block-id":n.id,"data-block-kind":e,"data-change":n.change??void 0,"aria-label":`${t}: ${n.label}`,title:n.isDraft?n.hint??void 0:void 0,className:ye(OF,n.change!==null&&mN[n.change],s!==null&&wF[s]),style:yx(r),onMouseEnter:()=>{l(!0)},onMouseLeave:()=>{l(!1)},onFocus:()=>{l(!0)},onBlur:()=>{l(!1)},onClick:o,children:[m.jsx(c,{"aria-hidden":"true",className:"size-3.5 shrink-0 text-muted-foreground"}),m.jsxs("span",{className:"flex min-w-0 flex-col",children:[m.jsx(ul,{isPending:n.isDraft,className:"h-4 w-24 py-0 text-[0.75rem]",children:m.jsx("span",{className:ye("truncate text-[0.75rem] leading-4",n.isDraft?"font-mono text-muted-foreground":"font-bold"),children:n.label})}),n.isDraft?null:m.jsx("span",{className:"truncate font-mono text-[0.6875rem] leading-4 text-muted-foreground",children:n.name})]})]})},LF=e=>`${qp}${e}`,yN=e=>`${dSe}${e}`,HSe=(e,{width:t,height:n})=>e==="left"?{x:0,y:Qa/rl}:{x:t/rl,y:e==="top"?0:n},RD=({x:e,y:t})=>({x:e-CD,y:t-CD}),DF=e=>[...e.rows.filter(t=>t.kind!=="heading"&&t.kind!=="parameters").map(t=>({id:LF(t.id),type:"source",position:Ge.Right,title:aSe,...RD({x:e.width,y:t.y+t.height/rl})})),...kF.map(t=>({id:yN(t),type:"target",position:cSe[t],title:uSe[t],...RD(HSe(t,e))}))],FSe=({data:{node:e,frame:t,cardActions:n,emphasis:r,isSelected:s,isCollapsed:o,isFocusedOn:l,onSelect:c,onHoverChange:u,onFocusToggle:f,onCollapseToggle:h}})=>{const p=new Map(wSe(e).map(b=>[b.id,b])),y=new Map(MF(e).map(b=>[b.block.id,b])),x=new Map(e.triggerLabels.map(b=>[b.id,b]));return m.jsxs(m.Fragment,{children:[m.jsx(PSe,{node:e,cardActions:n,depth:t.depth,emphasis:r,isSelected:s,isCollapsed:o,isFocusedOn:l,onSelect:()=>{c(null)},onHoverChange:u,onFocusToggle:f,onCollapseToggle:h}),t.rows.flatMap(b=>{const S=p.get(b.id),E=y.get(b.id),C=x.get(b.id);if(S!==void 0)return[m.jsx("span",{"data-row-heading":e.id,className:Zve,style:yx(b),children:S.label},b.id)];if(b.kind==="parameters")return[m.jsx("ul",{"aria-label":qve,className:Xve,style:yx(b),children:e.parameters.map(T=>m.jsx("li",{title:T,className:Qve,children:m.jsx("span",{className:"truncate",children:T})},T))},b.id)];const O=()=>{c(b.id)};return E!==void 0?[m.jsx(BSe,{row:E,placed:b,emphasis:r,onSelect:O,onHoverChange:u},b.id)]:C===void 0?[]:[m.jsx(zSe,{trigger:C,placed:b,emphasis:r,onSelect:O,onHoverChange:u},b.id)]}),t.handles.map(b=>m.jsx(hu,{id:b.id,type:b.type,position:TF[b.type],isConnectable:!1,className:NF,style:{left:b.x,top:b.y}},b.id)),n===null?null:DF(t).map(b=>m.jsx(hu,{id:b.id,type:b.type,position:b.position,title:b.title,className:fSe,style:{left:b.x,top:b.y}},b.id))]})},AD=({x:e,y:t})=>({x:Math.round(e),y:Math.round(t)}),$Se=({sourceX:e,sourceY:t,targetX:n,targetY:r,data:s})=>s===void 0?null:m.jsxs(m.Fragment,{children:[m.jsx(wbe,{path:GE([{x:e,y:t},...s.bends,{x:n,y:r}].map(AD)),kind:Dve,isAssumed:!1,emphasis:s.emphasis,hasArrow:s.hasArrow,markers:s.markers}),s.isSelectable?m.jsx("path",{d:GE([{x:e,y:t},...s.bends,{x:n,y:r}].map(AD)),className:hSe}):null]}),USe=({data:{isPending:e,onCreate:t}})=>m.jsxs(m.Fragment,{children:[m.jsx("button",{type:"button",disabled:e,"aria-label":xD,title:xD,className:jve,onClick:t,children:m.jsx(M2,{"aria-hidden":"true",className:"size-4"})}),m.jsx(hu,{id:SC,type:"target",position:Ge.Left,isConnectable:!1,className:NF,style:{left:0,top:Jh/rl}})]}),VSe={[EF]:FSe,[CF]:USe},qSe={[wC]:$Se},GSe=e=>e.width,kD=({source:e,target:t})=>e!==t,KSe=e=>{const t="changedTouches"in e?e.changedTouches.item(0):e;return t===null?null:{x:t.clientX,y:t.clientY}},YSe=(e,{isValid:t,fromNode:n,fromHandle:r})=>{var f;const s=KSe(e);if(t===!0||s===null||n===null)return null;const o=r.id??null;if((o==null?void 0:o.startsWith(qp))!==!0)return null;const l=((f=document.elementFromPoint(s.x,s.y))==null?void 0:f.closest(mSe))??null,c=(l==null?void 0:l.dataset.id)??null;if(l===null||c===null||c===vC)return{kind:"board",line:{from:n.id,fromRowId:o.slice(qp.length)},point:s};const u=yN(vve(s,l.getBoundingClientRect()));return{kind:"card",connection:{source:n.id,sourceHandle:o,target:c,targetHandle:u}}},WSe=({label:e,authoring:t,moving:n,width:r,view:{zoom:s,offset:o,onPan:l},nodes:c,edges:u,markers:f})=>{const h=It(GSe),{screenToFlowPosition:p}=Mb(),y=Math.max(0,(h-r*s)/rl),x=(S,E)=>{const C=YSe(S,E);(C==null?void 0:C.kind)==="card"&&kD(C.connection)&&(t==null||t.onConnect(C.connection)),(C==null?void 0:C.kind)==="board"&&(t==null||t.onLineDropOnBoard(C.line,C.point,p))},b=S=>{S.forEach(E=>{E.type==="position"&&E.position!==void 0&&(n==null||n.onCardDrag(E.id,E.position))})};return m.jsx("div",{role:"group","aria-label":e,"data-measured":h>0,className:zve,style:{backgroundPosition:`${String(o.x)}px ${String(o.y)}px`},children:m.jsx(Bxe,{nodes:c,edges:u,nodeTypes:VSe,edgeTypes:qSe,viewport:{x:y+o.x,y:o.y,zoom:s},onViewportChange:({x:S,y:E})=>{l({x:S-y,y:E})},zIndexMode:"manual",paneClickDistance:Pve,nodesDraggable:n!==null,nodesConnectable:t!==null,isValidConnection:kD,onNodesChange:n===null?void 0:b,onNodeDragStop:n===null?void 0:(S,E)=>{n.onCardDrop(E.id,E.position)},onConnect:t===null?void 0:t.onConnect,onConnectEnd:t===null?void 0:x,connectionRadius:gSe,connectionLineStyle:ySe,onEdgeClick:t===null?void 0:(S,E)=>{E.data!==void 0&&t.onLineSelect(E.data.edgeId)},onPaneClick:t===null?void 0:t.onBoardClick,nodesFocusable:!1,edgesFocusable:!1,elementsSelectable:!1,zoomOnScroll:!1,zoomOnPinch:!1,zoomOnDoubleClick:!1,preventScrolling:!1,deleteKeyCode:null,disableKeyboardA11y:!0,proOptions:Bve,children:m.jsx("svg",{"aria-hidden":"true",className:ye("absolute size-0",EC),children:m.jsx(Sbe,{markers:f})})})})},XSe=({source:e,sourceHandle:t,target:n,targetHandle:r})=>{const s=kF.find(o=>yN(o)===r);return(t==null?void 0:t.startsWith(qp))!==!0||s===void 0?null:{from:e,fromRowId:t.slice(qp.length),to:n,toSide:s}},QSe=({title:e,nodes:t,edges:n,codeLinks:r,codeDefinitions:s,isReviewPending:o,authoring:l=null,cardMoving:c=null,navigatorAnchorId:u=null,onWriteUpNode:f=null,onOpenCodeLink:h,onWaypointReviewedChange:p})=>{var xt,nn;const[y,x]=N.useState(pSe),[b,S]=N.useState(null),[E,C]=N.useState(null),[O,T]=N.useState(null),[R,k]=N.useState(null),[M,A]=N.useState(null),[I,L]=N.useState(gD),[D,P]=N.useState(!1),[z,$]=N.useState(null),j=vbe(),{collapsedNodeIds:H,focusedNodeId:B}=I,V=ASe(t),G=kSe(n,V),q=ND(t,G,I),K=t.filter(Te=>!q.has(Te.id)),W=gN(K),ee=new Set(W.map(Te=>Te.id)),ce=n.filter(Te=>ee.has(Te.from)&&ee.has(Te.to)),F=K.map(IF),X=xve(F,ce),te=new Map(t.flatMap(Te=>Te.position===null?[]:[[Te.id,Te.position]])),Z=new Map([...Sve(X,te),...y]),Y=Cve(X,Z,new Map(ce.map(Te=>[Te.id,Te.toSide]))),le=ce.find(Te=>Te.id===b)??null,xe=Y.nodes.filter(Te=>Te.depth===0).map(Te=>({nodeId:Te.id,x:Te.x,y:Te.y})),fe=c===null?null:{onCardDrag:(Te,De)=>{x(tt=>new Map([...tt,[Te,De]]))},onCardDrop:(Te,De)=>{c.onMoveCards(xe.map(tt=>tt.nodeId===Te?{nodeId:Te,x:De.x,y:De.y}:tt))}},oe=l===null?null:{onLineDropOnBoard:(Te,De,tt)=>{C({...Te,end:tt(De),cardCount:t.length})},onConnect:Te=>{const De=XSe(Te);De!==null&&l.onDrawLine(De)},onLineSelect:S,onBoardClick:()=>{S(null),C(null)}},re=l!==null&&E!==null&&E.cardCount===t.length&&ee.has(E.from)?E:null,he=kve(F,Y),Se=new Map(W.map(Te=>[Te.id,Te])),ke=new Map(W.flatMap(Te=>MF(Te).map(De=>[De.block.id,De]))),be=new Map(W.flatMap(Te=>Te.triggerLabels.map(De=>[De.id,De]))),_e=KE(ce,O),Me=KE(ce,M),Le=O===null?null:Se.get(O)??null,Pe=(Le==null?void 0:Le.codeLinkId)==null||!Object.hasOwn(r,Le.codeLinkId)?null:r[Le.codeLinkId],pe=R===null?null:((xt=ke.get(R))==null?void 0:xt.block.lines)??((nn=be.get(R))==null?void 0:nn.lines)??null,Ae=(Te,De)=>{T(Te),k(De),P(!0)},Ee=Te=>{L(Te),A(null);const De=O===null?void 0:V.get(O);De!==void 0&&ND(t,G,Te).has(De)&&T(null)},je=t.filter(Te=>G.some(De=>De.from===Te.id)).map(Te=>Te.id),Oe=he.frames.flatMap(Te=>{const De=Se.get(Te.id);return De===void 0?[]:[{id:Te.id,type:EF,...Te.parentId===null?{}:{parentId:Te.parentId},position:Te.position,width:Te.width,height:Te.height,zIndex:Te.depth,draggable:c!==null&&Te.depth===0,style:bD,handles:[...Te.handles.map(({id:tt,type:At,x:gn,y:yn})=>({id:tt,type:At,position:TF[At],x:gn,y:yn,width:0,height:0})),...l===null?[]:DF(Te).map(({id:tt,type:At,position:gn,x:yn,y:Fr})=>({id:tt,type:At,position:gn,x:yn,y:Fr,width:TD,height:TD}))],data:{node:De,frame:Te,cardActions:l===null?null:{isPending:l.isPending,onEdit:()=>{l.onEditCard(Te.id)},onRemove:()=>{l.onRemoveCard(Te.id)}},emphasis:OD(Te.id,_e.nodeIds,Me.nodeIds),isSelected:Te.id===O,isCollapsed:H.includes(Te.id),isFocusedOn:Te.id===B,onSelect:tt=>{Ae(Te.id,tt)},onHoverChange:tt=>{A(tt?Te.id:null)},onFocusToggle:()=>{Ee({...I,focusedNodeId:Te.id===B?null:Te.id})},onCollapseToggle:()=>{Ee({...I,collapsedNodeIds:_Se(H,Te.id)})}}}]}),ve=he.lines.map(Te=>({id:Te.id,type:wC,source:Te.source,target:Te.target,sourceHandle:Te.sourceHandleId,targetHandle:Te.targetHandleId,zIndex:Te.isAboveNodes?fw:0,className:ye(EC,l!==null&&Te.isAboveNodes&&"pointer-events-none"),domAttributes:{"aria-hidden":!0},data:{edgeId:Te.edgeId,isSelectable:l!==null&&!Te.isAboveNodes,bends:Te.bends,emphasis:Te.edgeId===b?"selected":OD(Te.edgeId,_e.edgeIds,Me.edgeIds),hasArrow:Te.hasArrow,markers:j}})),Fe=l===null||re===null?[]:[{id:vC,type:CF,position:{x:re.end.x,y:re.end.y-Jh/rl},width:Jh,height:Jh,zIndex:fw,draggable:!1,style:bD,handles:[{id:SC,type:"target",position:Ge.Left,x:0,y:Jh/rl,width:0,height:0}],data:{isPending:l.isPending,onCreate:()=>{const{from:Te,fromRowId:De,end:tt}=re;l.onAddCardAtLineEnd({from:Te,fromRowId:De,position:{x:tt.x,y:tt.y-Qa/rl},places:xe})}}}],Ye=re===null?[]:[{id:yD,type:wC,source:re.from,target:vC,sourceHandle:LF(re.fromRowId),targetHandle:SC,zIndex:fw,className:ye(EC,"pointer-events-none"),domAttributes:{"aria-hidden":!0},data:{edgeId:yD,isSelectable:!1,bends:[],emphasis:null,hasArrow:!0,markers:j}}];return m.jsxs(m.Fragment,{children:[m.jsx(HB,{label:e,width:Y.width,height:Y.height,isFullScreen:D,onFullScreenChange:Te=>{P(Te),Te||T(null)},onPanelClose:()=>{T(null)},navigation:u===null?null:{anchorId:u,groups:[[Un({key:vSe,actionId:"collapse-trace-cards-action",label:H.length===0?xSe:bSe,onRun:()=>{Ee(H.length===0?{collapsedNodeIds:je,focusedNodeId:null}:gD)}}),...LSe(Le,f)],DSe(l,t.length,$)]},actions:l===null||le===null?null:m.jsx(or,{icon:"delete",label:tSe,isDisabled:l.isPending,onClick:()=>{l.onRemoveLine({edgeId:le.id,from:le.from,to:le.to}),S(null)}}),panel:Le===null?null:m.jsxs(v6,{title:Le.label,kindLabel:Le.typeLabel,target:Le.codeViews.length===0?Pe:null,codeViews:Le.codeViews.map(Te=>m.jsx(_be,{view:Te,focusedLines:pe,isReviewPending:o,codeLinks:r,codeDefinitions:s,onOpenCodeLink:h,onWaypointReviewedChange:p},Te.id)),onClose:()=>{T(null)},children:[Le.isDraft?m.jsx(_6,{hint:Le.hint,label:Le.isBeingWritten?Mve:_ve,isBeingWritten:Le.isBeingWritten,buttonLabel:SF,onWriteUp:f===null?null:()=>{f(Le.id)}}):null,Le.description===null?null:m.jsx(uo,{blocks:Le.description,codeLinks:r,onOpenCodeLink:h})]}),renderCanvas:Te=>m.jsx(eF,{children:m.jsx(WSe,{label:e,authoring:oe,moving:fe,width:Y.width,view:Te,nodes:[...Oe,...Fe],edges:[...ve,...Ye],markers:j})})}),l===null||z===null?null:m.jsx(hbe,{...lSe[z],onConfirm:()=>{jSe(l,z)(),$(null)},onCancel:()=>{$(null)}})]})},ZSe="Add a diagram",CC="trace-diagram-section",JSe="Edit",e1e="This segment has no Trace Diagram.",t1e=3,hw="max-w-[55rem] pb-4",n1e=({heading:e,diagram:t,codeLinks:n,editing:r,renderEditor:s,onOpenCodeLink:o})=>(r==null?void 0:r.isWriting)===!0&&s!==null?m.jsx("div",{className:"pb-4",children:s({label:`${e} description`,markdown:t.descriptionMarkdown,isSaving:r.isSaving,errorMessage:r.errorMessage,onSave:r.onSave,onCancel:r.onCancel})}):t.description===null?m.jsx(ul,{isPending:!0,lineCount:t1e,className:ye(hw,"text-base"),children:m.jsx("p",{className:ye(hw,"text-muted-foreground"),children:t.descriptionHint??t.unwrittenLabel})}):m.jsx(uo,{blocks:t.description,codeLinks:n,className:hw,onOpenCodeLink:o}),r1e=[],s1e={authoringOf:()=>null,cardMovingOf:()=>null,writeUpOf:()=>null},jF=({anchorId:e,heading:t,diagram:n,codeLinks:r,codeDefinitions:s,isReviewPending:o,authoring:l,cardMoving:c,onWriteUpNode:u,renderDescriptionEditor:f,onOpenCodeLink:h,onWaypointReviewedChange:p})=>m.jsxs(m.Fragment,{children:[m.jsx(n1e,{heading:t,diagram:n,codeLinks:r,editing:(l==null?void 0:l.description)??null,renderEditor:f,onOpenCodeLink:h}),m.jsx(QSe,{title:n.title,nodes:n.nodes,edges:n.edges,codeLinks:r,codeDefinitions:s,isReviewPending:o,authoring:(l==null?void 0:l.board)??null,cardMoving:c,navigatorAnchorId:e,onWriteUpNode:u,onOpenCodeLink:h,onWaypointReviewedChange:p})]}),o1e=({tabs:e,tabEditing:t,...n})=>{const[r,s]=N.useState(0),o=e.at(r)??e[0],l=c=>{var f;const u=O6(c.key,r,e.length);u!==null&&(c.preventDefault(),s(u),(f=c.currentTarget.parentElement)==null||f.querySelectorAll("[role=tab]").item(u).focus())};return m.jsxs(m.Fragment,{children:[m.jsx("div",{role:"tablist","aria-label":n.heading,className:ye(T6,"mb-4"),children:e.map((c,u)=>m.jsx("button",{type:"button",role:"tab","aria-selected":u===r,"aria-controls":u===r?o.diagram.anchorId:void 0,tabIndex:u===r?0:-1,className:N6,onClick:()=>{s(u)},onKeyDown:l,children:c.label},c.id))}),m.jsx("section",{id:o.diagram.anchorId,role:"tabpanel","aria-label":o.label,"data-view-section-id":CC,className:"scroll-mt-(--section-scroll-margin)",children:m.jsx(jF,{...n,diagram:o.diagram,authoring:t.authoringOf(o.id),cardMoving:t.cardMovingOf(o.id),onWriteUpNode:t.writeUpOf(o.id)},o.id)})]})},i1e=({anchorId:e,heading:t,diagram:n,tabs:r=r1e,tabEditing:s=null,codeLinks:o,codeDefinitions:l,isReviewPending:c,writeUpNotice:u=null,onWriteUpNode:f=null,authoring:h=null,cardMoving:p=null,renderDescriptionEditor:y=null,onOpenCodeLink:x,onWaypointReviewedChange:b})=>{const S=h!==null&&n!==null&&y!==null&&!h.description.isWriting,E={anchorId:e,heading:t,codeLinks:o,codeDefinitions:l,isReviewPending:c,renderDescriptionEditor:y,onOpenCodeLink:x,onWaypointReviewedChange:b};return m.jsxs("section",{id:e,"aria-labelledby":`${e}-heading`,"data-view-section-id":CC,className:"scroll-mt-(--section-scroll-margin) border-t pt-6 pb-8",children:[m.jsxs("div",{className:"flex items-center gap-3 pb-4",children:[m.jsx("h2",{id:`${e}-heading`,className:"text-2xl leading-9 font-semibold tracking-[-0.02em] text-foreground",children:t}),u===null?null:m.jsx(Pf,{label:u}),h!==null&&n===null&&r.length===0?m.jsx(st,{variant:"link",size:"sm",disabled:h.board.isPending,onClick:h.onAddDiagram,children:ZSe}):null,S?m.jsx(st,{variant:"link",size:"sm",onClick:h.description.onEdit,children:JSe}):null]}),h!==null&&n===null&&r.length===0?m.jsx("p",{className:"text-muted-foreground",children:e1e}):null,r.length===0?null:m.jsx(o1e,{...E,tabs:r,tabEditing:s??s1e}),n===null||r.length>0?null:m.jsx("section",{id:n.anchorId,"aria-label":n.title,"data-view-section-id":CC,className:"scroll-mt-(--section-scroll-margin)",children:m.jsx(jF,{...E,diagram:n,authoring:h,cardMoving:p,onWriteUpNode:f})})]})},l1e="flex w-full max-w-xl cursor-pointer items-start gap-3 rounded-lg border border-input bg-card px-3 py-2.5 text-left transition-colors duration-[180ms] ease-out outline-none hover:bg-muted focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/40 aria-expanded:bg-muted",_D=({option:e})=>m.jsxs(m.Fragment,{children:[m.jsx("span",{className:"block font-bold",children:e.label}),e.summary===null?null:m.jsx("span",{className:"block text-sm",children:e.summary}),m.jsx("span",{className:"block text-sm text-muted-foreground",children:e.description})]}),PF=({label:e,dialogTitle:t,dialogDescription:n,chooseLabel:r,cancelLabel:s,options:o,selectedKey:l,onChoose:c})=>{const u=N.useId(),[f,h]=N.useState(!1),[p,y]=N.useState(l),x=o.find(E=>E.key===l),b=()=>{y(l),h(!0)},S=()=>{c(p),h(!1)};return m.jsxs(m.Fragment,{children:[m.jsxs("button",{type:"button","aria-haspopup":"dialog","aria-expanded":f,"aria-label":x===void 0?e:`${e}, ${x.label}`,className:l1e,onClick:b,children:[m.jsx("span",{className:"min-w-0 flex-1",children:x===void 0?null:m.jsx(_D,{option:x})}),m.jsx(A3,{"aria-hidden":"true",className:"mt-1 size-4 shrink-0 text-muted-foreground"})]}),m.jsx(ml,{open:f,onOpenChange:h,children:m.jsxs(gl,{className:"sm:max-w-xl",children:[m.jsxs(yl,{children:[m.jsx(bl,{children:t}),m.jsx(vl,{children:n})]}),m.jsxs("fieldset",{children:[m.jsx("legend",{className:"sr-only",children:e}),m.jsx("ul",{className:"max-h-[60dvh] overflow-y-auto border-t border-border",children:o.map(E=>m.jsx("li",{className:"border-b border-border py-3",children:m.jsxs("label",{className:"flex cursor-pointer items-start gap-3 text-base",children:[m.jsx("input",{type:"radio",name:u,checked:p===E.key,className:"mt-1 size-4 shrink-0 accent-(--primary)",onChange:()=>{y(E.key)}}),m.jsxs("span",{className:"min-w-0",children:[m.jsx(_D,{option:E}),E.note===null?null:m.jsx("span",{className:"block text-sm text-muted-foreground",children:E.note})]})]})},E.key))})]}),m.jsxs(xl,{children:[m.jsx(st,{type:"button",variant:"ghost",onClick:()=>{h(!1)},children:s}),m.jsx(st,{type:"button",onClick:S,children:r})]})]})})]})},a1e="Prompt configuration",c1e="Choose a prompt configuration",u1e="It sets the tone the agent writes in and how it words each part.",d1e="Choose",f1e="Cancel",h1e=e=>({key:e.configurationId,label:e.label,summary:e.bestFor,description:e.description,note:e.note}),p1e=({options:e,value:t,onChange:n})=>m.jsx(PF,{label:a1e,dialogTitle:c1e,dialogDescription:u1e,chooseLabel:d1e,cancelLabel:f1e,options:e.map(h1e),selectedKey:t,onChoose:n}),m1e="Code Walkthrough order",g1e="Choose a Code Walkthrough order",y1e="It decides which changed file you read first.",x1e="Choose",b1e="Cancel",zF=[{value:"imports-bottom-up",label:"Building blocks first",description:"Start with the files the rest of the change depends on, then read the code that uses them."},{value:"imports-top-down",label:"Entry points first",description:"Start where the change is used, like pages and routes, then follow it down to the details."},{value:"important-first",label:"Most important first",description:"Start with the heart of the change and the topics you care about most, then read the rest."}],v1e=zF.map(e=>({key:e.value,label:e.label,summary:null,description:e.description,note:null})),S1e=e=>{var t;return((t=zF.find(n=>n.value===e))==null?void 0:t.value)??null},w1e=({value:e,onChange:t})=>m.jsx(PF,{label:m1e,dialogTitle:g1e,dialogDescription:y1e,chooseLabel:x1e,cancelLabel:b1e,options:v1e,selectedKey:e,onChoose:n=>{const r=S1e(n);r!==null&&t(r)}}),BF=e=>t=>{t.preventDefault(),e()},E1e="Configure",C1e="Not now",T1e="Explain",N1e="Starting…",O1e="Parts to explain",R1e="Prompt configuration",A1e="Code Walkthrough order",HF="Total",k1e="Split this review into segments",pw="pb-2 font-bold",_1e="border-b border-border py-2.5",MD="pt-2 text-destructive",M1e=e=>`Ask ${e} to explain this review?`,I1e=e=>`Flight Plan built this review from the code. ${e} can write the context, the labels, the explanations and the findings.`,FF=e=>e.sections.filter(t=>t.isChosen).map(t=>t.section),L1e=(e,t,n)=>n?[...e,t]:e.filter(r=>r!==t),TC=(e,t)=>(e==null?void 0:e.field)===t?e.message:null,D1e=({plan:e})=>m.jsxs("dl",{className:"grid grid-cols-[auto_minmax(0,1fr)] gap-x-6 gap-y-1.5 border-y border-border py-3",children:[e.summary.map(t=>m.jsxs("div",{className:"contents",children:[m.jsx("dt",{className:"text-muted-foreground",children:t.label}),m.jsx("dd",{className:"font-bold",children:t.value})]},t.label)),m.jsx("dt",{className:"text-muted-foreground",children:HF}),m.jsx("dd",{className:"font-bold tabular-nums",children:e.totalLabel})]}),j1e=({plan:e})=>m.jsxs("p",{className:"flex items-baseline justify-between gap-6 pr-1",children:[m.jsx("span",{className:"text-muted-foreground",children:HF}),m.jsx("span",{className:"font-bold tabular-nums",children:e.totalLabel})]}),P1e=({plan:e,problem:t,configurationId:n,walkthroughOrder:r,isSegmented:s,onSectionsChange:o,onConfigurationChange:l,onWalkthroughOrderChange:c,onSegmentedChange:u})=>{const f=TC(t,"sections"),h=TC(t,"configuration"),p=FF(e);return m.jsxs("div",{className:"grid max-h-[60dvh] gap-5 overflow-y-auto pr-1",children:[m.jsxs("fieldset",{children:[m.jsx("legend",{className:pw,children:O1e}),m.jsx("ul",{className:"border-t border-border",children:e.sections.map(y=>m.jsx("li",{className:_1e,children:m.jsxs("label",{className:"flex cursor-pointer items-center gap-3",children:[m.jsx("input",{type:"checkbox",checked:y.isChosen,className:"size-4 shrink-0 accent-(--primary)",onChange:x=>{o(L1e(p,y.section,x.target.checked))}}),m.jsx("span",{className:"flex-1 font-bold",children:y.label}),m.jsx("span",{className:"text-muted-foreground tabular-nums",children:y.countLabel})]})},y.section))}),f===null?null:m.jsx("p",{role:"alert",className:MD,children:f})]}),m.jsxs("div",{children:[m.jsx("p",{className:pw,children:R1e}),m.jsx(p1e,{options:e.configurations,value:n,onChange:l}),h===null?null:m.jsx("p",{role:"alert",className:MD,children:h})]}),m.jsxs("div",{children:[m.jsx("p",{className:pw,children:A1e}),m.jsx(w1e,{value:r,onChange:c})]}),m.jsxs("label",{className:"flex cursor-pointer items-center gap-3",children:[m.jsx("input",{type:"checkbox",checked:s,className:"size-4 shrink-0 accent-(--primary)",onChange:y=>{u(y.target.checked)}}),m.jsx("span",{className:"font-bold",children:k1e})]})]})},z1e=({plan:e,problem:t,isPending:n,onSectionsChange:r,onSubmit:s,onClose:o})=>{const[l,c]=N.useState(!1),[u,f]=N.useState(e.configurationId),[h,p]=N.useState(e.walkthroughOrder),[y,x]=N.useState(e.isSegmented),b=TC(t,"agent"),S=l||t!==null&&t.field!=="agent";return m.jsx(ml,{open:!0,onOpenChange:E=>{E||o()},children:m.jsxs(gl,{className:"sm:max-w-xl",children:[m.jsxs(yl,{children:[m.jsx(bl,{children:M1e(e.agentLabel)}),m.jsx(vl,{children:I1e(e.agentLabel)})]}),m.jsxs("form",{className:"grid gap-4",onSubmit:BF(()=>{s({sections:FF(e),configurationId:u,walkthroughOrder:h,isSegmented:y})}),children:[S?m.jsxs(m.Fragment,{children:[m.jsx(P1e,{plan:e,problem:t,configurationId:u,walkthroughOrder:h,isSegmented:y,onSectionsChange:r,onConfigurationChange:f,onWalkthroughOrderChange:p,onSegmentedChange:x}),m.jsx(j1e,{plan:e})]}):m.jsx(D1e,{plan:e}),b===null?null:m.jsx("p",{role:"alert",className:"text-destructive",children:b}),m.jsxs(xl,{className:"items-center",children:[S?null:m.jsx(st,{type:"button",variant:"link",className:"mr-auto px-0",onClick:()=>{c(!0)},children:E1e}),m.jsx(st,{type:"button",variant:"ghost",onClick:o,children:C1e}),m.jsx(st,{type:"submit",disabled:n,children:n?N1e:T1e})]})]})]})})},B1e=[],H1e="Reading the code blocks…",F1e=(e,t)=>{var s,o,l;const n=is(),r=ui(n.review.cardBlocks.queryOptions(t===null?ao:{...e,path:t}));return{blocks:((s=r.data)==null?void 0:s.blocks)??B1e,message:((o=r.error)==null?void 0:o.message)??((l=r.data)==null?void 0:l.message)??(r.isPending&&t!==null?H1e:null)}},$1e="Loading the file…",$F=(e,t)=>{var s,o;const n=is(),r=ui(n.review.fileCode.queryOptions(t===null?ao:{...e,path:t}));return{lines:((s=r.data)==null?void 0:s.lines)??null,statusMessage:((o=r.error)==null?void 0:o.message)??(r.isPending&&t!==null?$1e:null)}},U1e=[],xN=(e,t)=>{var c,u,f;const n=is(),[r,s]=N.useState(""),o=N.useDeferredValue(r),l=ui({...n.review.searchFiles.queryOptions({...e,query:o,scope:t}),placeholderData:Mx});return{query:r,files:((c=l.data)==null?void 0:c.options)??U1e,message:((u=l.data)==null?void 0:u.message)??null,errorMessage:((f=l.error)==null?void 0:f.message)??null,onQueryChange:s}},V1e=(e,t,n)=>e!==null&&n?{anchorLine:e.anchorLine,headLine:t}:{anchorLine:t,headLine:t},q1e=({anchorLine:e,headLine:t})=>({lineStart:Math.min(e,t),lineEnd:Math.max(e,t)}),G1e=(e,t)=>e!==null&&t>=e.lineStart&&t<=e.lineEnd,K1e=e=>new Set(e===null?[]:Array.from({length:e.lineEnd-e.lineStart+1},(t,n)=>String(e.lineStart+n))),Gp=({lineStart:e,lineEnd:t})=>e===t?`Line ${String(e)}`:`Lines ${String(e)} to ${String(t)}`,Y1e={"toggle-off":{isShownAtFirst:!1,canToggle:!0},"toggle-on":{isShownAtFirst:!0,canToggle:!0},"always-on":{isShownAtFirst:!0,canToggle:!1},"always-off":{isShownAtFirst:!1,canToggle:!1}},W1e="Show waypoints",X1e="Hide waypoints",Q1e="Select line",Z1e="Clear",J1e="[data-line]",xx=10,UF="my-1.5 mr-4 ml-18 rounded-md border border-input bg-background font-sans whitespace-normal",ID=e=>{const t=e instanceof Element?e:(e==null?void 0:e.parentElement)??null;return(t==null?void 0:t.closest(J1e))??null},LD=e=>Number.parseInt((e==null?void 0:e.dataset.line)??"",xx),ewe=e=>{const t=window.getSelection();if(e===null||t===null||t.isCollapsed)return null;const n=ID(t.anchorNode),r=ID(t.focusNode);if(n===null||r===null||!e.contains(n)||!e.contains(r))return null;const s=LD(n),o=LD(r);return Number.isNaN(s)||Number.isNaN(o)?null:{anchorLine:s,headLine:o}},twe=(e,t)=>{var n;(n=e==null?void 0:e.querySelector(`[data-line="${String(t)}"]`))==null||n.scrollIntoView({block:"center"})},nwe=(e,t)=>t===null?e:e.map(n=>({...n,isFocused:G1e(t,Number.parseInt(n.numberLabel,xx))})),rwe=({waypoint:e})=>m.jsxs("section",{"aria-label":e.title,className:ye(UF,"flex items-center gap-2 px-2.5 py-2"),children:[e.coreChangeLabel===null?null:m.jsx(Aa,{kind:"core-change",label:e.coreChangeLabel}),m.jsx("span",{className:"min-w-0 truncate text-[0.9375rem] font-semibold",children:e.title}),m.jsx("span",{className:"ml-auto shrink-0 pl-2 text-xs text-muted-foreground tabular-nums",children:Gp(e)})]}),VF=({path:e,lines:t,statusMessage:n,waypoints:r,waypointOptions:s,highlightButtonLabel:o,focusOn:l,className:c,renderWaypoint:u,onHighlightCode:f})=>{const h=N.useRef(null),{isShownAtFirst:p,canToggle:y}=Y1e[s],[x,b]=N.useState(p),[S,E]=N.useState(null),C=y?x:p,O=N.useMemo(()=>S===null?null:q1e(S),[S]),T=N.useMemo(()=>K1e(O),[O]),R=N.useMemo(()=>t===null?null:nwe(t,l),[t,l]),k=(l==null?void 0:l.lineStart)??null,M=t!==null;N.useEffect(()=>{k!==null&&M&&twe(h.current,k)},[k,M]);const A=(P,z)=>{E($=>V1e($,Number.parseInt(P,xx),z))},I=()=>{const P=f===null?null:ewe(h.current);P!==null&&E(P)},L=P=>{f==null||f(P),E(null)},D=P=>{const z=Number.parseInt(P,xx);return m.jsxs(m.Fragment,{children:[(O==null?void 0:O.lineEnd)===z?m.jsxs("div",{role:"toolbar","aria-label":Gp(O),className:ye(UF,"flex items-center gap-2 px-2.5 py-1.5"),children:[m.jsx("span",{className:"text-sm text-muted-foreground tabular-nums",children:Gp(O)}),m.jsx("span",{className:"flex-1"}),m.jsx(st,{type:"button",variant:"ghost",size:"sm",onClick:()=>{E(null)},children:Z1e}),m.jsx(st,{type:"button",size:"sm",onClick:()=>{L(O)},children:o})]}):null,C?r.filter($=>$.lineEnd===z).map($=>u===void 0?m.jsx(rwe,{waypoint:$},$.id):m.jsx("div",{children:u($)},$.id)):null]})};return m.jsxs("div",{className:ye("flex min-h-0 flex-col overflow-hidden rounded-md border",c),children:[m.jsxs("div",{className:"flex h-10 shrink-0 items-center gap-3 border-b bg-muted pr-1 pl-3",children:[m.jsx("p",{className:"min-w-0 flex-1 truncate font-mono text-xs text-muted-foreground",title:e,children:e}),y?m.jsx(st,{type:"button",variant:"ghost",size:"sm","aria-pressed":x,onClick:()=>{b(P=>!P)},children:x?X1e:W1e}):null]}),R===null?m.jsx("p",{role:"status",className:"px-3 py-2.5 text-sm text-muted-foreground",children:n}):m.jsx("div",{ref:h,role:"presentation",className:"min-h-0 flex-1 overflow-y-auto bg-code",onMouseUp:I,children:m.jsx(Ou,{lines:R,label:e,path:e,className:"py-0",renderLineExtra:D,...f===null?{}:{selectLineLabel:Q1e,selectedLineLabels:T,onSelectLine:A}})})]})},swe="flex cursor-default items-center gap-2 rounded-md px-2 py-1.5 text-sm select-none aria-disabled:text-muted-foreground aria-selected:bg-muted",owe=(e,t,n)=>t===0?null:e===null?n===1?0:t-1:(e+n+t)%t,iwe=({label:e,hint:t,placeholder:n,value:r,suggestions:s,message:o,errorMessage:l,isLiteral:c=!1,className:u,onValueChange:f,onSelect:h,onOpen:p,onEnter:y})=>{const x=N.useId(),b=N.useId(),S=N.useId(),E=N.useId(),[C,O]=N.useState(!1),[T,R]=N.useState(null),k=T===null?void 0:s[T],M=C&&(s.length>0||o!==null),A=l!==null,I=()=>{O(!1),R(null)},L=z=>{z.isDisabled||(h(z.id),I())},D=z=>{O(!0),R($=>owe($,s.length,z))},P=z=>{z.key==="ArrowDown"?(z.preventDefault(),D(1)):z.key==="ArrowUp"?(z.preventDefault(),D(-1)):z.key==="Enter"?(z.preventDefault(),C&&k!==void 0?L(k):y==null||y()):z.key==="Escape"&&I()};return m.jsxs("div",{className:ye("grid gap-1.5",u),children:[m.jsx("label",{htmlFor:x,className:"text-sm font-bold",children:e}),t===null?null:m.jsx("p",{id:S,className:"text-sm text-muted-foreground",children:t}),m.jsxs("div",{className:"relative",children:[m.jsx(zm,{id:x,role:"combobox",value:r,placeholder:n,autoComplete:"off",spellCheck:!1,"aria-expanded":M,"aria-controls":b,"aria-autocomplete":"list","aria-activedescendant":k===void 0?void 0:`${b}-${k.id}`,"aria-invalid":A,"aria-describedby":ye(t===null?"":S,A?E:"")||void 0,className:c?"font-mono placeholder:font-sans":"",onChange:z=>{f(z.target.value),O(!0),R(null)},onFocus:()=>{O(!0),p==null||p()},onBlur:I,onKeyDown:P}),m.jsxs("div",{id:b,role:"listbox","aria-label":e,hidden:!M,className:"absolute inset-x-0 top-full z-30 mt-1 max-h-72 overflow-y-auto rounded-lg border border-foreground bg-popover p-1 text-popover-foreground",children:[s.map(z=>m.jsxs("div",{id:`${b}-${z.id}`,role:"option",tabIndex:-1,"aria-selected":z.id===(k==null?void 0:k.id),"aria-disabled":z.isDisabled,className:swe,onMouseDown:$=>{$.preventDefault()},onClick:()=>{L(z)},onKeyDown:$=>{$.key==="Enter"&&L(z)},children:[z.marker,m.jsx("span",{className:ye("min-w-0 wrap-anywhere",c?"font-mono text-[0.94em]":""),children:z.label}),z.detail===null?null:m.jsx("span",{className:"min-w-0 flex-1 truncate text-muted-foreground",children:z.detail}),z.stateLabel===null?null:m.jsx("span",{className:"ml-auto shrink-0 text-muted-foreground",children:z.stateLabel})]},z.id)),s.length===0&&o!==null?m.jsx("div",{role:"presentation",className:"px-2 py-1.5 text-sm text-muted-foreground",children:o}):null]})]}),A?m.jsx("p",{id:E,role:"alert",className:"text-sm text-destructive",children:l}):null]})},lwe="/",awe=({path:e,stateLabel:t})=>{const n=e.lastIndexOf(lwe);return{id:e,label:e.slice(n+1),detail:n<0?null:e.slice(0,n),stateLabel:t,isDisabled:!1}},bN=({label:e,hint:t,placeholder:n,query:r,files:s,message:o,errorMessage:l,className:c,onQueryChange:u,onSelect:f})=>m.jsx(iwe,{label:e,hint:t,placeholder:n,value:r,suggestions:s.map(awe),message:o,errorMessage:l,isLiteral:!0,className:c,onValueChange:u,onSelect:f}),cwe="Add a card",DD="Pick a file, then the code the card stands for: one of its code blocks, or the lines you select in the code.",uwe="File",dwe="Search the files of the repository",jD="Code blocks",fwe="Use these lines",hwe="Pick a code block on the left, or select lines in the code: click a line number, then another with Shift.",pwe="Prefill the rows of the card from the code",mwe="Add card",gwe="Adding…",PD="size-4 accent-(--primary)",ywe="flex w-full flex-col rounded-md border border-input px-2.5 py-1.5 text-left transition-colors duration-[180ms] ease-out hover:bg-accent disabled:cursor-not-allowed disabled:opacity-60 aria-pressed:border-primary aria-pressed:bg-accent",xwe=({reviewKey:e,addition:{segmentId:t,note:n,isSaving:r,errorMessage:s,onSubmit:o,onClose:l}})=>{const c=xN(e,"repository"),[u,f]=N.useState(null),[h,p]=N.useState(null),[y,x]=N.useState(!0),[b,S]=N.useState(!1),E=$F(e,u),{blocks:C,message:O}=F1e({...e,segmentId:t},u),T=(h==null?void 0:h.kind)==="block"?C.find(A=>A.id===h.blockId)??null:null,R=(h==null?void 0:h.kind)==="lines"?h:T,k=A=>{f(A),p(null),S(!1),c.onQueryChange(A)},M=()=>{u===null||h===null||o({path:u,source:h,isPrefilled:y,hasChildComponents:b&&(T==null?void 0:T.childComponentsLabel)!=null})};return m.jsx(ml,{open:!0,onOpenChange:A=>{A||l()},children:m.jsxs(gl,{className:"h-[calc(100dvh-4rem)] grid-rows-[auto_auto_minmax(0,1fr)_auto_auto] sm:max-w-[min(90rem,calc(100vw-4rem))]",children:[m.jsxs(yl,{children:[m.jsx(bl,{children:cwe}),m.jsx(vl,{children:n===null?DD:`${DD} ${n}`})]}),m.jsx(bN,{label:uwe,hint:null,placeholder:dwe,query:c.query,files:c.files,message:c.message,errorMessage:c.errorMessage,onQueryChange:c.onQueryChange,onSelect:k}),u===null?m.jsx("span",{}):m.jsxs("div",{className:"grid min-h-0 grid-cols-[16rem_minmax(0,1fr)] gap-3",children:[m.jsxs("section",{"aria-label":jD,className:"flex min-h-0 flex-col gap-2",children:[m.jsx("h3",{className:"text-sm font-bold",children:jD}),O===null?null:m.jsx("p",{role:"status",className:"text-sm text-muted-foreground",children:O}),m.jsx("ul",{className:"grid min-h-0 content-start gap-1 overflow-y-auto",children:C.map(A=>m.jsx("li",{children:m.jsxs("button",{type:"button","aria-pressed":(T==null?void 0:T.id)===A.id,disabled:A.heldLabel!==null,className:ywe,onClick:()=>{p({kind:"block",blockId:A.id})},children:[m.jsx("span",{className:"truncate font-mono text-[0.8125rem] font-bold",title:A.name,children:A.name}),m.jsx("span",{className:"text-xs text-muted-foreground tabular-nums",children:A.heldLabel??A.detail})]})},A.id))})]}),m.jsxs("div",{className:"flex min-h-0 flex-col gap-2",children:[m.jsx(VF,{path:u,lines:E.lines,statusMessage:E.statusMessage,waypoints:[],waypointOptions:"always-off",highlightButtonLabel:fwe,focusOn:R,className:"flex-1",onHighlightCode:A=>{p({kind:"lines",...A})}}),m.jsx("p",{role:"status",className:"text-sm text-muted-foreground",children:R===null?hwe:[(T==null?void 0:T.name)??null,Gp(R)].filter(A=>A!==null).join(", ")})]})]}),m.jsxs("div",{className:"grid gap-1.5",children:[m.jsxs("label",{className:"flex items-center gap-2 text-sm",children:[m.jsx("input",{type:"checkbox",checked:y,className:PD,onChange:A=>{x(A.target.checked)}}),pwe]}),(T==null?void 0:T.childComponentsLabel)==null?null:m.jsxs("label",{className:"flex items-center gap-2 text-sm",children:[m.jsx("input",{type:"checkbox",checked:b,className:PD,onChange:A=>{S(A.target.checked)}}),T.childComponentsLabel]}),s===null?null:m.jsx("p",{role:"alert",className:"text-sm text-destructive",children:s})]}),m.jsxs(xl,{children:[m.jsx(st,{type:"button",variant:"ghost",onClick:l,children:"Cancel"}),m.jsx(st,{type:"button",disabled:u===null||h===null||r,onClick:M,children:r?gwe:mwe})]})]})})},bwe="Done",zD=({title:e,description:t,entries:n,isPending:r,onMove:s,onClose:o})=>m.jsx(ml,{open:!0,onOpenChange:l=>{l||o()},children:m.jsxs(gl,{children:[m.jsxs(yl,{children:[m.jsx(bl,{children:e}),m.jsx(vl,{children:t})]}),m.jsx("ol",{"aria-label":e,className:"grid max-h-96 gap-1 overflow-y-auto",children:n.map(l=>m.jsxs("li",{className:"flex items-center gap-2 rounded-md border px-2.5 py-1.5",children:[m.jsxs("span",{className:"flex min-w-0 flex-1 flex-col",children:[m.jsx("span",{className:"truncate font-semibold",title:l.heading,children:l.heading}),m.jsx("span",{className:"text-xs text-muted-foreground tabular-nums",children:l.detailLabel})]}),m.jsx(or,{icon:"previous",label:`Move ${l.heading} up`,isDisabled:!l.canMoveUp||r,onClick:()=>{s(l.id,"up")}}),m.jsx(or,{icon:"next",label:`Move ${l.heading} down`,isDisabled:!l.canMoveDown||r,onClick:()=>{s(l.id,"down")}})]},l.id))}),m.jsx(xl,{children:m.jsx(st,{type:"button",onClick:o,children:bwe})})]})});var BD=Object.defineProperty,vwe=(e,t)=>{let n={};for(var r in e)BD(n,r,{get:e[r],enumerable:!0});return BD(n,Symbol.toStringTag,{value:"Module"}),n};function wr(e){this.content=e}wr.prototype={constructor:wr,find:function(e){for(var t=0;t<this.content.length;t+=2)if(this.content[t]===e)return t;return-1},get:function(e){var t=this.find(e);return t==-1?void 0:this.content[t+1]},update:function(e,t,n){var r=n&&n!=e?this.remove(n):this,s=r.find(e),o=r.content.slice();return s==-1?o.push(n||e,t):(o[s+1]=t,n&&(o[s]=n)),new wr(o)},remove:function(e){var t=this.find(e);if(t==-1)return this;var n=this.content.slice();return n.splice(t,2),new wr(n)},addToStart:function(e,t){return new wr([e,t].concat(this.remove(e).content))},addToEnd:function(e,t){var n=this.remove(e).content.slice();return n.push(e,t),new wr(n)},addBefore:function(e,t,n){var r=this.remove(t),s=r.content.slice(),o=r.find(e);return s.splice(o==-1?s.length:o,0,t,n),new wr(s)},forEach:function(e){for(var t=0;t<this.content.length;t+=2)e(this.content[t],this.content[t+1])},prepend:function(e){return e=wr.from(e),e.size?new wr(e.content.concat(this.subtract(e).content)):this},append:function(e){return e=wr.from(e),e.size?new wr(this.subtract(e).content.concat(e.content)):this},subtract:function(e){var t=this;e=wr.from(e);for(var n=0;n<e.content.length;n+=2)t=t.remove(e.content[n]);return t},toObject:function(){var e={};return this.forEach(function(t,n){e[t]=n}),e},get size(){return this.content.length>>1}};wr.from=function(e){if(e instanceof wr)return e;var t=[];if(e)for(var n in e)t.push(n,e[n]);return new wr(t)};function qF(e,t,n){for(let r=0;;r++){if(r==e.childCount||r==t.childCount)return e.childCount==t.childCount?null:n;let s=e.child(r),o=t.child(r);if(s==o){n+=s.nodeSize;continue}if(!s.sameMarkup(o))return n;if(s.isText&&s.text!=o.text){let l=s.text,c=o.text,u=0;for(;l[u]==c[u];u++)n++;return u&&u<l.length&&u<c.length&&YF(l.charCodeAt(u-1))&&KF(l.charCodeAt(u))&&n--,n}if(s.content.size||o.content.size){let l=qF(s.content,o.content,n+1);if(l!=null)return l}n+=s.nodeSize}}function GF(e,t,n,r){for(let s=e.childCount,o=t.childCount;;){if(s==0||o==0)return s==o?null:{a:n,b:r};let l=e.child(--s),c=t.child(--o),u=l.nodeSize;if(l==c){n-=u,r-=u;continue}if(!l.sameMarkup(c))return{a:n,b:r};if(l.isText&&l.text!=c.text){let f=l.text,h=c.text,p=f.length,y=h.length;for(;p>0&&y>0&&f[p-1]==h[y-1];)p--,y--,n--,r--;return p&&y&&p<f.length&&YF(f.charCodeAt(p-1))&&KF(f.charCodeAt(p))&&(n++,r++),{a:n,b:r}}if(l.content.size||c.content.size){let f=GF(l.content,c.content,n-1,r-1);if(f)return f}n-=u,r-=u}}function KF(e){return e>=56320&&e<57344}function YF(e){return e>=55296&&e<56320}class Ie{constructor(t,n){if(this.content=t,this.size=n||0,n==null)for(let r=0;r<t.length;r++)this.size+=t[r].nodeSize}nodesBetween(t,n,r,s=0,o){for(let l=0,c=0;c<n;l++){let u=this.content[l],f=c+u.nodeSize;if(f>t&&r(u,s+c,o||null,l)!==!1&&u.content.size){let h=c+1;u.nodesBetween(Math.max(0,t-h),Math.min(u.content.size,n-h),r,s+h)}c=f}}descendants(t){this.nodesBetween(0,this.size,t)}textBetween(t,n,r,s){let o="",l=!0;return this.nodesBetween(t,n,(c,u)=>{let f=c.isText?c.text.slice(Math.max(t,u)-u,n-u):c.isLeaf?s?typeof s=="function"?s(c):s:c.type.spec.leafText?c.type.spec.leafText(c):"":"";c.isBlock&&(c.isLeaf&&f||c.isTextblock)&&r&&(l?l=!1:o+=r),o+=f},0),o}append(t){if(!t.size)return this;if(!this.size)return t;let n=this.lastChild,r=t.firstChild,s=this.content.slice(),o=0;for(n.isText&&n.sameMarkup(r)&&(s[s.length-1]=n.withText(n.text+r.text),o=1);o<t.content.length;o++)s.push(t.content[o]);return new Ie(s,this.size+t.size)}cut(t,n=this.size){if(t==0&&n==this.size)return this;let r=[],s=0;if(n>t)for(let o=0,l=0;l<n;o++){let c=this.content[o],u=l+c.nodeSize;u>t&&((l<t||u>n)&&(c.isText?c=c.cut(Math.max(0,t-l),Math.min(c.text.length,n-l)):c=c.cut(Math.max(0,t-l-1),Math.min(c.content.size,n-l-1))),r.push(c),s+=c.nodeSize),l=u}return new Ie(r,s)}cutByIndex(t,n){return t==n?Ie.empty:t==0&&n==this.content.length?this:new Ie(this.content.slice(t,n))}replaceChild(t,n){let r=this.content[t];if(r==n)return this;let s=this.content.slice(),o=this.size+n.nodeSize-r.nodeSize;return s[t]=n,new Ie(s,o)}addToStart(t){return new Ie([t].concat(this.content),this.size+t.nodeSize)}addToEnd(t){return new Ie(this.content.concat(t),this.size+t.nodeSize)}eq(t){if(this.content.length!=t.content.length)return!1;for(let n=0;n<this.content.length;n++)if(!this.content[n].eq(t.content[n]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(t){let n=this.content[t];if(!n)throw new RangeError("Index "+t+" out of range for "+this);return n}maybeChild(t){return this.content[t]||null}forEach(t){for(let n=0,r=0;n<this.content.length;n++){let s=this.content[n];t(s,r,n),r+=s.nodeSize}}findDiffStart(t,n=0){return qF(this,t,n)}findDiffEnd(t,n=this.size,r=t.size){return GF(this,t,n,r)}findIndex(t){if(t==0)return J0(0,t);if(t==this.size)return J0(this.content.length,t);if(t>this.size||t<0)throw new RangeError(`Position ${t} outside of fragment (${this})`);for(let n=0,r=0;;n++){let s=this.child(n),o=r+s.nodeSize;if(o>=t)return o==t?J0(n+1,o):J0(n,r);r=o}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(t=>t.toJSON()):null}static fromJSON(t,n){if(!n)return Ie.empty;if(!Array.isArray(n))throw new RangeError("Invalid input for Fragment.fromJSON");return Ie.fromArray(n.map(t.nodeFromJSON))}static fromArray(t){if(!t.length)return Ie.empty;let n,r=0;for(let s=0;s<t.length;s++){let o=t[s];r+=o.nodeSize,s&&o.isText&&t[s-1].sameMarkup(o)?(n||(n=t.slice(0,s)),n[n.length-1]=o.withText(n[n.length-1].text+o.text)):n&&n.push(o)}return new Ie(n||t,r)}static from(t){if(!t)return Ie.empty;if(t instanceof Ie)return t;if(Array.isArray(t))return this.fromArray(t);if(t.attrs)return new Ie([t],t.nodeSize);throw new RangeError("Can not convert "+t+" to a Fragment"+(t.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}Ie.empty=new Ie([],0);const mw={index:0,offset:0};function J0(e,t){return mw.index=e,mw.offset=t,mw}function bx(e,t){if(e===t)return!0;if(!(e&&typeof e=="object")||!(t&&typeof t=="object"))return!1;let n=Array.isArray(e);if(Array.isArray(t)!=n)return!1;if(n){if(e.length!=t.length)return!1;for(let r=0;r<e.length;r++)if(!bx(e[r],t[r]))return!1}else{for(let r in e)if(!(r in t)||!bx(e[r],t[r]))return!1;for(let r in t)if(!(r in e))return!1}return!0}let tn=class NC{constructor(t,n){this.type=t,this.attrs=n}addToSet(t){let n,r=!1;for(let s=0;s<t.length;s++){let o=t[s];if(this.eq(o))return t;if(this.type.excludes(o.type))n||(n=t.slice(0,s));else{if(o.type.excludes(this.type))return t;!r&&o.type.rank>this.type.rank&&(n||(n=t.slice(0,s)),n.push(this),r=!0),n&&n.push(o)}}return n||(n=t.slice()),r||n.push(this),n}removeFromSet(t){for(let n=0;n<t.length;n++)if(this.eq(t[n]))return t.slice(0,n).concat(t.slice(n+1));return t}isInSet(t){for(let n=0;n<t.length;n++)if(this.eq(t[n]))return!0;return!1}eq(t){return this==t||this.type==t.type&&bx(this.attrs,t.attrs)}toJSON(){let t={type:this.type.name};for(let n in this.attrs){t.attrs=this.attrs;break}return t}static fromJSON(t,n){if(!n)throw new RangeError("Invalid input for Mark.fromJSON");let r=t.marks[n.type];if(!r)throw new RangeError(`There is no mark type ${n.type} in this schema`);return r.create(n.attrs)}static sameSet(t,n){if(t==n)return!0;if(t.length!=n.length)return!1;for(let r=0;r<t.length;r++)if(!t[r].eq(n[r]))return!1;return!0}static setFrom(t){if(!t||Array.isArray(t)&&t.length==0)return NC.none;if(t instanceof NC)return[t];let n=t.slice();return n.sort((r,s)=>r.type.rank-s.type.rank),n}};tn.none=[];class Kp extends Error{}class Ue{constructor(t,n,r){this.content=t,this.openStart=n,this.openEnd=r}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(t,n){let r=XF(this.content,t+this.openStart,n,this.openStart+1,this.openEnd+1);return r&&new Ue(r,this.openStart,this.openEnd)}removeBetween(t,n){return new Ue(WF(this.content,t+this.openStart,n+this.openStart),this.openStart,this.openEnd)}eq(t){return this.content.eq(t.content)&&this.openStart==t.openStart&&this.openEnd==t.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let t={content:this.content.toJSON()};return this.openStart>0&&(t.openStart=this.openStart),this.openEnd>0&&(t.openEnd=this.openEnd),t}static fromJSON(t,n){if(!n)return Ue.empty;let r=n.openStart||0,s=n.openEnd||0;if(typeof r!="number"||typeof s!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new Ue(Ie.fromJSON(t,n.content),r,s)}static maxOpen(t,n=!0){let r=0,s=0;for(let o=t.firstChild;o&&!o.isLeaf&&(n||!o.type.spec.isolating);o=o.firstChild)r++;for(let o=t.lastChild;o&&!o.isLeaf&&(n||!o.type.spec.isolating);o=o.lastChild)s++;return new Ue(t,r,s)}}Ue.empty=new Ue(Ie.empty,0,0);function WF(e,t,n){let{index:r,offset:s}=e.findIndex(t),o=e.maybeChild(r),{index:l,offset:c}=e.findIndex(n);if(s==t||o.isText){if(c!=n&&!e.child(l).isText)throw new RangeError("Removing non-flat range");return e.cut(0,t).append(e.cut(n))}if(r!=l)throw new RangeError("Removing non-flat range");return e.replaceChild(r,o.copy(WF(o.content,t-s-1,n-s-1)))}function XF(e,t,n,r,s,o){let{index:l,offset:c}=e.findIndex(t),u=e.maybeChild(l);if(c==t||u.isText)return o&&r<=0&&s<=0&&!o.canReplace(l,l,n)?null:e.cut(0,t).append(n).append(e.cut(t));let f=XF(u.content,t-c-1,n,l==0?r-1:0,l==e.childCount-1?s-1:0,u);return f&&e.replaceChild(l,u.copy(f))}function Swe(e,t,n){if(n.openStart>e.depth)throw new Kp("Inserted content deeper than insertion position");if(e.depth-n.openStart!=t.depth-n.openEnd)throw new Kp("Inconsistent open depths");return QF(e,t,n,0)}function QF(e,t,n,r){let s=e.index(r),o=e.node(r);if(s==t.index(r)&&r<e.depth-n.openStart){let l=QF(e,t,n,r+1);return o.copy(o.content.replaceChild(s,l))}else if(n.content.size)if(!n.openStart&&!n.openEnd&&e.depth==r&&t.depth==r){let l=e.parent,c=l.content;return eu(l,c.cut(0,e.parentOffset).append(n.content).append(c.cut(t.parentOffset)))}else{let{start:l,end:c}=wwe(n,e);return eu(o,JF(e,l,c,t,r))}else return eu(o,vx(e,t,r))}function ZF(e,t){if(!t.type.compatibleContent(e.type))throw new Kp("Cannot join "+t.type.name+" onto "+e.type.name)}function OC(e,t,n){let r=e.node(n);return ZF(r,t.node(n)),r}function Jc(e,t){let n=t.length-1;n>=0&&e.isText&&e.sameMarkup(t[n])?t[n]=e.withText(t[n].text+e.text):t.push(e)}function pp(e,t,n,r){let s=(t||e).node(n),o=0,l=t?t.index(n):s.childCount;e&&(o=e.index(n),e.depth>n?o++:e.textOffset&&(Jc(e.nodeAfter,r),o++));for(let c=o;c<l;c++)Jc(s.child(c),r);t&&t.depth==n&&t.textOffset&&Jc(t.nodeBefore,r)}function eu(e,t){if(!e.type.validContent(t))throw new Kp("Invalid content for node "+e.type.name);return e.copy(t)}function JF(e,t,n,r,s){let o=e.depth>s&&OC(e,t,s+1),l=r.depth>s&&OC(n,r,s+1),c=[];return pp(null,e,s,c),o&&l&&t.index(s)==n.index(s)?(ZF(o,l),Jc(eu(o,JF(e,t,n,r,s+1)),c)):(o&&Jc(eu(o,vx(e,t,s+1)),c),pp(t,n,s,c),l&&Jc(eu(l,vx(n,r,s+1)),c)),pp(r,null,s,c),new Ie(c)}function vx(e,t,n){let r=[];if(pp(null,e,n,r),e.depth>n){let s=OC(e,t,n+1);Jc(eu(s,vx(e,t,n+1)),r)}return pp(t,null,n,r),new Ie(r)}function wwe(e,t){let n=t.depth-e.openStart,s=t.node(n).copy(e.content);for(let o=n-1;o>=0;o--)s=t.node(o).copy(Ie.from(s));return{start:s.resolveNoCache(e.openStart+n),end:s.resolveNoCache(s.content.size-e.openEnd-n)}}class Yp{constructor(t,n,r){this.pos=t,this.path=n,this.parentOffset=r,this.depth=n.length/3-1}resolveDepth(t){return t==null?this.depth:t<0?this.depth+t:t}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(t){return this.path[this.resolveDepth(t)*3]}index(t){return this.path[this.resolveDepth(t)*3+1]}indexAfter(t){return t=this.resolveDepth(t),this.index(t)+(t==this.depth&&!this.textOffset?0:1)}start(t){return t=this.resolveDepth(t),t==0?0:this.path[t*3-1]+1}end(t){return t=this.resolveDepth(t),this.start(t)+this.node(t).content.size}before(t){if(t=this.resolveDepth(t),!t)throw new RangeError("There is no position before the top-level node");return t==this.depth+1?this.pos:this.path[t*3-1]}after(t){if(t=this.resolveDepth(t),!t)throw new RangeError("There is no position after the top-level node");return t==this.depth+1?this.pos:this.path[t*3-1]+this.path[t*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let t=this.parent,n=this.index(this.depth);if(n==t.childCount)return null;let r=this.pos-this.path[this.path.length-1],s=t.child(n);return r?t.child(n).cut(r):s}get nodeBefore(){let t=this.index(this.depth),n=this.pos-this.path[this.path.length-1];return n?this.parent.child(t).cut(0,n):t==0?null:this.parent.child(t-1)}posAtIndex(t,n){n=this.resolveDepth(n);let r=this.path[n*3],s=n==0?0:this.path[n*3-1]+1;for(let o=0;o<t;o++)s+=r.child(o).nodeSize;return s}marks(){let t=this.parent,n=this.index();if(t.content.size==0)return tn.none;if(this.textOffset)return t.child(n).marks;let r=t.maybeChild(n-1),s=t.maybeChild(n);if(!r){let c=r;r=s,s=c}let o=r.marks;for(var l=0;l<o.length;l++)o[l].type.spec.inclusive===!1&&(!s||!o[l].isInSet(s.marks))&&(o=o[l--].removeFromSet(o));return o}marksAcross(t){let n=this.parent.maybeChild(this.index());if(!n||!n.isInline)return null;let r=n.marks,s=t.parent.maybeChild(t.index());for(var o=0;o<r.length;o++)r[o].type.spec.inclusive===!1&&(!s||!r[o].isInSet(s.marks))&&(r=r[o--].removeFromSet(r));return r}sharedDepth(t){for(let n=this.depth;n>0;n--)if(this.start(n)<=t&&this.end(n)>=t)return n;return 0}blockRange(t=this,n){if(t.pos<this.pos)return t.blockRange(this);for(let r=this.depth-(this.parent.inlineContent||this.pos==t.pos?1:0);r>=0;r--)if(t.pos<=this.end(r)&&(!n||n(this.node(r))))return new Sx(this,t,r);return null}sameParent(t){return this.pos-this.parentOffset==t.pos-t.parentOffset}max(t){return t.pos>this.pos?t:this}min(t){return t.pos<this.pos?t:this}toString(){let t="";for(let n=1;n<=this.depth;n++)t+=(t?"/":"")+this.node(n).type.name+"_"+this.index(n-1);return t+":"+this.parentOffset}static resolve(t,n){if(!(n>=0&&n<=t.content.size))throw new RangeError("Position "+n+" out of range");let r=[],s=0,o=n;for(let l=t;;){let{index:c,offset:u}=l.content.findIndex(o),f=o-u;if(r.push(l,c,s+u),!f||(l=l.child(c),l.isText))break;o=f-1,s+=u+1}return new Yp(n,r,o)}static resolveCached(t,n){let r=HD.get(t);if(r)for(let o=0;o<r.elts.length;o++){let l=r.elts[o];if(l.pos==n)return l}else HD.set(t,r=new Ewe);let s=r.elts[r.i]=Yp.resolve(t,n);return r.i=(r.i+1)%Cwe,s}}class Ewe{constructor(){this.elts=[],this.i=0}}const Cwe=12,HD=new WeakMap;class Sx{constructor(t,n,r){this.$from=t,this.$to=n,this.depth=r}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}}const Twe=Object.create(null);let tu=class RC{constructor(t,n,r,s=tn.none){this.type=t,this.attrs=n,this.marks=s,this.content=r||Ie.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(t){return this.content.child(t)}maybeChild(t){return this.content.maybeChild(t)}forEach(t){this.content.forEach(t)}nodesBetween(t,n,r,s=0){this.content.nodesBetween(t,n,r,s,this)}descendants(t){this.nodesBetween(0,this.content.size,t)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(t,n,r,s){return this.content.textBetween(t,n,r,s)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(t){return this==t||this.sameMarkup(t)&&this.content.eq(t.content)}sameMarkup(t){return this.hasMarkup(t.type,t.attrs,t.marks)}hasMarkup(t,n,r){return this.type==t&&bx(this.attrs,n||t.defaultAttrs||Twe)&&tn.sameSet(this.marks,r||tn.none)}copy(t=null){return t==this.content?this:new RC(this.type,this.attrs,t,this.marks)}mark(t){return t==this.marks?this:new RC(this.type,this.attrs,this.content,t)}cut(t,n=this.content.size){return t==0&&n==this.content.size?this:this.copy(this.content.cut(t,n))}slice(t,n=this.content.size,r=!1){if(t==n)return Ue.empty;let s=this.resolve(t),o=this.resolve(n),l=r?0:s.sharedDepth(n),c=s.start(l),f=s.node(l).content.cut(s.pos-c,o.pos-c);return new Ue(f,s.depth-l,o.depth-l)}replace(t,n,r){return Swe(this.resolve(t),this.resolve(n),r)}nodeAt(t){for(let n=this;;){let{index:r,offset:s}=n.content.findIndex(t);if(n=n.maybeChild(r),!n)return null;if(s==t||n.isText)return n;t-=s+1}}childAfter(t){let{index:n,offset:r}=this.content.findIndex(t);return{node:this.content.maybeChild(n),index:n,offset:r}}childBefore(t){if(t==0)return{node:null,index:0,offset:0};let{index:n,offset:r}=this.content.findIndex(t);if(r<t)return{node:this.content.child(n),index:n,offset:r};let s=this.content.child(n-1);return{node:s,index:n-1,offset:r-s.nodeSize}}resolve(t){return Yp.resolveCached(this,t)}resolveNoCache(t){return Yp.resolve(this,t)}rangeHasMark(t,n,r){let s=!1;return n>t&&this.nodesBetween(t,n,o=>(r.isInSet(o.marks)&&(s=!0),!s)),s}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let t=this.type.name;return this.content.size&&(t+="("+this.content.toStringInner()+")"),e$(this.marks,t)}contentMatchAt(t){let n=this.type.contentMatch.matchFragment(this.content,0,t);if(!n)throw new Error("Called contentMatchAt on a node with invalid content");return n}canReplace(t,n,r=Ie.empty,s=0,o=r.childCount){let l=this.contentMatchAt(t).matchFragment(r,s,o),c=l&&l.matchFragment(this.content,n);if(!c||!c.validEnd)return!1;for(let u=s;u<o;u++)if(!this.type.allowsMarks(r.child(u).marks))return!1;return!0}canReplaceWith(t,n,r,s){if(s&&!this.type.allowsMarks(s))return!1;let o=this.contentMatchAt(t).matchType(r),l=o&&o.matchFragment(this.content,n);return l?l.validEnd:!1}canAppend(t){return t.content.size?this.canReplace(this.childCount,this.childCount,t.content):this.type.compatibleContent(t.type)}check(){this.type.checkContent(this.content),FD(this.type.attrs,this.attrs,"node",this.type.name);let t=tn.none;for(let n=0;n<this.marks.length;n++){let r=this.marks[n];FD(r.type.attrs,r.attrs,"mark",r.type.name),t=r.addToSet(t)}if(!tn.sameSet(t,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(n=>n.type.name)}`);this.content.forEach(n=>n.check())}toJSON(){let t={type:this.type.name};for(let n in this.attrs){t.attrs=this.attrs;break}return this.content.size&&(t.content=this.content.toJSON()),this.marks.length&&(t.marks=this.marks.map(n=>n.toJSON())),t}static fromJSON(t,n){if(!n)throw new RangeError("Invalid input for Node.fromJSON");let r;if(n.marks){if(!Array.isArray(n.marks))throw new RangeError("Invalid mark data for Node.fromJSON");r=n.marks.map(t.markFromJSON)}if(n.type=="text"){if(typeof n.text!="string")throw new RangeError("Invalid text node in JSON");return t.text(n.text,r)}let s=Ie.fromJSON(t,n.content);return t.nodeType(n.type).create(n.attrs,s,r)}};tu.prototype.text=void 0;class wx extends tu{constructor(t,n,r,s){if(super(t,n,null,s),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):e$(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(t,n){return this.text.slice(t,n)}get nodeSize(){return this.text.length}mark(t){return t==this.marks?this:new wx(this.type,this.attrs,this.text,t)}withText(t){return t==this.text?this:new wx(this.type,this.attrs,t,this.marks)}cut(t=0,n=this.text.length){return t==0&&n==this.text.length?this:this.withText(this.text.slice(t,n))}eq(t){return this.sameMarkup(t)&&this.text==t.text}toJSON(){let t=super.toJSON();return t.text=this.text,t}}function e$(e,t){for(let n=e.length-1;n>=0;n--)t=e[n].type.name+"("+t+")";return t}function FD(e,t,n,r){for(let s in t)if(!(s in e))throw new RangeError(`Unsupported attribute ${s} for ${n} of type ${r}`);for(let s in e)e[s].validate&&e[s].validate(t[s])}class pu{constructor(t){this.validEnd=t,this.next=[],this.wrapCache=[]}static parse(t,n){let r=new Nwe(t,n);if(r.next==null)return pu.empty;let s=t$(r);r.next&&r.err("Unexpected trailing text");let o=Iwe(Mwe(s));return Lwe(o,r),o}matchType(t){for(let n=0;n<this.next.length;n++)if(this.next[n].type==t)return this.next[n].next;return null}matchFragment(t,n=0,r=t.childCount){let s=this;for(let o=n;s&&o<r;o++)s=s.matchType(t.child(o).type);return s}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let t=0;t<this.next.length;t++){let{type:n}=this.next[t];if(!(n.isText||n.hasRequiredAttrs()))return n}return null}compatible(t){for(let n=0;n<this.next.length;n++)for(let r=0;r<t.next.length;r++)if(this.next[n].type==t.next[r].type)return!0;return!1}fillBefore(t,n=!1,r=0){let s=[this];function o(l,c){let u=l.matchFragment(t,r);if(u&&(!n||u.validEnd))return Ie.from(c.map(f=>f.createAndFill()));for(let f=0;f<l.next.length;f++){let{type:h,next:p}=l.next[f];if(!(h.isText||h.hasRequiredAttrs())&&s.indexOf(p)==-1){s.push(p);let y=o(p,c.concat(h));if(y)return y}}return null}return o(this,[])}findWrapping(t){for(let r=0;r<this.wrapCache.length;r+=2)if(this.wrapCache[r]==t)return this.wrapCache[r+1];let n=this.computeWrapping(t);return this.wrapCache.push(t,n),n}computeWrapping(t){let n=Object.create(null),r=[{match:this,type:null,via:null}];for(;r.length;){let s=r.shift(),o=s.match;if(o.matchType(t)){let l=[];for(let c=s;c.type;c=c.via)l.push(c.type);return l.reverse()}for(let l=0;l<o.next.length;l++){let{type:c,next:u}=o.next[l];!c.isLeaf&&!c.hasRequiredAttrs()&&!(c.name in n)&&(!s.type||u.validEnd)&&(r.push({match:c.contentMatch,type:c,via:s}),n[c.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(t){if(t>=this.next.length)throw new RangeError(`There's no ${t}th edge in this content match`);return this.next[t]}toString(){let t=[];function n(r){t.push(r);for(let s=0;s<r.next.length;s++)t.indexOf(r.next[s].next)==-1&&n(r.next[s].next)}return n(this),t.map((r,s)=>{let o=s+(r.validEnd?"*":" ")+" ";for(let l=0;l<r.next.length;l++)o+=(l?", ":"")+r.next[l].type.name+"->"+t.indexOf(r.next[l].next);return o}).join(`
|
|
358
|
+
`)}}pu.empty=new pu(!0);class Nwe{constructor(t,n){this.string=t,this.nodeTypes=n,this.inline=null,this.pos=0,this.tokens=t.split(/\s*(?=\b|\W|$)/),this.tokens[this.tokens.length-1]==""&&this.tokens.pop(),this.tokens[0]==""&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(t){return this.next==t&&(this.pos++||!0)}err(t){throw new SyntaxError(t+" (in content expression '"+this.string+"')")}}function t$(e){let t=[];do t.push(Owe(e));while(e.eat("|"));return t.length==1?t[0]:{type:"choice",exprs:t}}function Owe(e){let t=[];do t.push(Rwe(e));while(e.next&&e.next!=")"&&e.next!="|");return t.length==1?t[0]:{type:"seq",exprs:t}}function Rwe(e){let t=_we(e);for(;;)if(e.eat("+"))t={type:"plus",expr:t};else if(e.eat("*"))t={type:"star",expr:t};else if(e.eat("?"))t={type:"opt",expr:t};else if(e.eat("{"))t=Awe(e,t);else break;return t}function $D(e){/\D/.test(e.next)&&e.err("Expected number, got '"+e.next+"'");let t=Number(e.next);return e.pos++,t}function Awe(e,t){let n=$D(e),r=n;return e.eat(",")&&(e.next!="}"?r=$D(e):r=-1),e.eat("}")||e.err("Unclosed braced range"),{type:"range",min:n,max:r,expr:t}}function kwe(e,t){let n=e.nodeTypes,r=n[t];if(r)return[r];let s=[];for(let o in n){let l=n[o];l.isInGroup(t)&&s.push(l)}return s.length==0&&e.err("No node type or group '"+t+"' found"),s}function _we(e){if(e.eat("(")){let t=t$(e);return e.eat(")")||e.err("Missing closing paren"),t}else if(/\W/.test(e.next))e.err("Unexpected token '"+e.next+"'");else{let t=kwe(e,e.next).map(n=>(e.inline==null?e.inline=n.isInline:e.inline!=n.isInline&&e.err("Mixing inline and block content"),{type:"name",value:n}));return e.pos++,t.length==1?t[0]:{type:"choice",exprs:t}}}function Mwe(e){let t=[[]];return s(o(e,0),n()),t;function n(){return t.push([])-1}function r(l,c,u){let f={term:u,to:c};return t[l].push(f),f}function s(l,c){l.forEach(u=>u.to=c)}function o(l,c){if(l.type=="choice")return l.exprs.reduce((u,f)=>u.concat(o(f,c)),[]);if(l.type=="seq")for(let u=0;;u++){let f=o(l.exprs[u],c);if(u==l.exprs.length-1)return f;s(f,c=n())}else if(l.type=="star"){let u=n();return r(c,u),s(o(l.expr,u),u),[r(u)]}else if(l.type=="plus"){let u=n();return s(o(l.expr,c),u),s(o(l.expr,u),u),[r(u)]}else{if(l.type=="opt")return[r(c)].concat(o(l.expr,c));if(l.type=="range"){let u=c;for(let f=0;f<l.min;f++){let h=n();s(o(l.expr,u),h),u=h}if(l.max==-1)s(o(l.expr,u),u);else for(let f=l.min;f<l.max;f++){let h=n();r(u,h),s(o(l.expr,u),h),u=h}return[r(u)]}else{if(l.type=="name")return[r(c,void 0,l.value)];throw new Error("Unknown expr type")}}}}function n$(e,t){return t-e}function UD(e,t){let n=[];return r(t),n.sort(n$);function r(s){let o=e[s];if(o.length==1&&!o[0].term)return r(o[0].to);n.push(s);for(let l=0;l<o.length;l++){let{term:c,to:u}=o[l];!c&&n.indexOf(u)==-1&&r(u)}}}function Iwe(e){let t=Object.create(null);return n(UD(e,0));function n(r){let s=[];r.forEach(l=>{e[l].forEach(({term:c,to:u})=>{if(!c)return;let f;for(let h=0;h<s.length;h++)s[h][0]==c&&(f=s[h][1]);UD(e,u).forEach(h=>{f||s.push([c,f=[]]),f.indexOf(h)==-1&&f.push(h)})})});let o=t[r.join(",")]=new pu(r.indexOf(e.length-1)>-1);for(let l=0;l<s.length;l++){let c=s[l][1].sort(n$);o.next.push({type:s[l][0],next:t[c.join(",")]||n(c)})}return o}}function Lwe(e,t){for(let n=0,r=[e];n<r.length;n++){let s=r[n],o=!s.validEnd,l=[];for(let c=0;c<s.next.length;c++){let{type:u,next:f}=s.next[c];l.push(u.name),o&&!(u.isText||u.hasRequiredAttrs())&&(o=!1),r.indexOf(f)==-1&&r.push(f)}o&&t.err("Only non-generatable nodes ("+l.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function r$(e){let t=Object.create(null);for(let n in e){let r=e[n];if(!r.hasDefault)return null;t[n]=r.default}return t}function s$(e,t){let n=Object.create(null);for(let r in e){let s=e[r],o=t&&t[r];if(o===void 0)if(s.hasDefault)o=s.default;else throw new RangeError("No value supplied for attribute "+r);else s.validate&&s.validate(o);n[r]=o}return n}function o$(e,t){let n=Object.create(null);if(t)for(let r in t)n[r]=new jwe(e,r,t[r]);return n}let VD=class i${constructor(t,n,r){this.name=t,this.schema=n,this.spec=r,this.markSet=null,this.groups=r.group?r.group.split(" "):[],this.attrs=o$(t,r.attrs),this.defaultAttrs=r$(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(r.inline||t=="text"),this.isText=t=="text"}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==pu.empty}get isAtom(){return this.isLeaf||!!this.spec.atom}isInGroup(t){return this.groups.indexOf(t)>-1}get whitespace(){return this.spec.whitespace||(this.spec.code?"pre":"normal")}hasRequiredAttrs(){for(let t in this.attrs)if(this.attrs[t].isRequired)return!0;return!1}compatibleContent(t){return this==t||this.contentMatch.compatible(t.contentMatch)}computeAttrs(t){return!t&&this.defaultAttrs?this.defaultAttrs:s$(this.attrs,t)}create(t=null,n,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new tu(this,this.computeAttrs(t),Ie.from(n),tn.setFrom(r))}createChecked(t=null,n,r){return n=Ie.from(n),this.checkContent(n),new tu(this,this.computeAttrs(t),n,tn.setFrom(r))}createAndFill(t=null,n,r){if(t=this.computeAttrs(t),n=Ie.from(n),n.size){let l=this.contentMatch.fillBefore(n);if(!l)return null;n=l.append(n)}let s=this.contentMatch.matchFragment(n),o=s&&s.fillBefore(Ie.empty,!0);return o?new tu(this,t,n.append(o),tn.setFrom(r)):null}validContent(t){let n=this.contentMatch.matchFragment(t);if(!n||!n.validEnd)return!1;for(let r=0;r<t.childCount;r++)if(!this.allowsMarks(t.child(r).marks))return!1;return!0}checkContent(t){if(!this.validContent(t))throw new RangeError(`Invalid content for node ${this.name}: ${t.toString().slice(0,50)}`)}checkAttrs(t){}allowsMarkType(t){return this.markSet==null||this.markSet.indexOf(t)>-1}allowsMarks(t){if(this.markSet==null)return!0;for(let n=0;n<t.length;n++)if(!this.allowsMarkType(t[n].type))return!1;return!0}allowedMarks(t){if(this.markSet==null)return t;let n;for(let r=0;r<t.length;r++)this.allowsMarkType(t[r].type)?n&&n.push(t[r]):n||(n=t.slice(0,r));return n?n.length?n:tn.none:t}static compile(t,n){let r=Object.create(null);t.forEach((o,l)=>r[o]=new i$(o,n,l));let s=n.spec.topNode||"doc";if(!r[s])throw new RangeError("Schema is missing its top node type ('"+s+"')");if(!r.text)throw new RangeError("Every schema needs a 'text' type");for(let o in r.text.attrs)throw new RangeError("The text node type should not have attributes");return r}};function Dwe(e,t,n){let r=n.split("|");return s=>{let o=s===null?"null":typeof s;if(r.indexOf(o)<0)throw new RangeError(`Expected value of type ${r} for attribute ${t} on type ${e}, got ${o}`)}}class jwe{constructor(t,n,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate=typeof r.validate=="string"?Dwe(t,n,r.validate):r.validate}get isRequired(){return!this.hasDefault}}class jb{constructor(t,n,r,s){this.name=t,this.rank=n,this.schema=r,this.spec=s,this.attrs=o$(t,s.attrs),this.excluded=null;let o=r$(this.attrs);this.instance=o?new tn(this,o):null}create(t=null){return!t&&this.instance?this.instance:new tn(this,s$(this.attrs,t))}static compile(t,n){let r=Object.create(null),s=0;return t.forEach((o,l)=>r[o]=new jb(o,s++,n,l)),r}removeFromSet(t){for(var n=0;n<t.length;n++)t[n].type==this&&(t=t.slice(0,n).concat(t.slice(n+1)),n--);return t}isInSet(t){for(let n=0;n<t.length;n++)if(t[n].type==this)return t[n]}excludes(t){return this.excluded.indexOf(t)>-1}}class l${constructor(t){this.linebreakReplacement=null,this.cached=Object.create(null);let n=this.spec={};for(let s in t)n[s]=t[s];n.nodes=wr.from(t.nodes),n.marks=wr.from(t.marks||{}),this.nodes=VD.compile(this.spec.nodes,this),this.marks=jb.compile(this.spec.marks,this);let r=Object.create(null);for(let s in this.nodes){if(s in this.marks)throw new RangeError(s+" can not be both a node and a mark");let o=this.nodes[s],l=o.spec.content||"",c=o.spec.marks;if(o.contentMatch=r[l]||(r[l]=pu.parse(l,this.nodes)),o.inlineContent=o.contentMatch.inlineContent,o.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!o.isInline||!o.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=o}o.markSet=c=="_"?null:c?qD(this,c.split(" ")):c==""||!o.inlineContent?[]:null}for(let s in this.marks){let o=this.marks[s],l=o.spec.excludes;o.excluded=l==null?[o]:l==""?[]:qD(this,l.split(" "))}this.nodeFromJSON=s=>tu.fromJSON(this,s),this.markFromJSON=s=>tn.fromJSON(this,s),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(t,n=null,r,s){if(typeof t=="string")t=this.nodeType(t);else if(t instanceof VD){if(t.schema!=this)throw new RangeError("Node type from different schema used ("+t.name+")")}else throw new RangeError("Invalid node type: "+t);return t.createChecked(n,r,s)}text(t,n){let r=this.nodes.text;return new wx(r,r.defaultAttrs,t,tn.setFrom(n))}mark(t,n){return typeof t=="string"&&(t=this.marks[t]),t.create(n)}nodeType(t){let n=this.nodes[t];if(!n)throw new RangeError("Unknown node type: "+t);return n}}function qD(e,t){let n=[];for(let r=0;r<t.length;r++){let s=t[r],o=e.marks[s],l=o;if(o)n.push(o);else for(let c in e.marks){let u=e.marks[c];(s=="_"||u.spec.group&&u.spec.group.split(" ").indexOf(s)>-1)&&n.push(l=u)}if(!l)throw new SyntaxError("Unknown mark type: '"+t[r]+"'")}return n}function Pwe(e){return e.tag!=null}function zwe(e){return e.style!=null}class sl{constructor(t,n){this.schema=t,this.rules=n,this.tags=[],this.styles=[];let r=this.matchedStyles=[];n.forEach(s=>{if(Pwe(s))this.tags.push(s);else if(zwe(s)){let o=/[^=]*/.exec(s.style)[0];r.indexOf(o)<0&&r.push(o),this.styles.push(s)}}),this.normalizeLists=!this.tags.some(s=>{if(!/^(ul|ol)\b/.test(s.tag)||!s.node)return!1;let o=t.nodes[s.node];return o.contentMatch.matchType(o)})}parse(t,n={}){let r=new KD(this,n,!1);return r.addAll(t,tn.none,n.from,n.to),r.finish()}parseSlice(t,n={}){let r=new KD(this,n,!0);return r.addAll(t,tn.none,n.from,n.to),Ue.maxOpen(r.finish())}matchTag(t,n,r){for(let s=r?this.tags.indexOf(r)+1:0;s<this.tags.length;s++){let o=this.tags[s];if(Fwe(t,o.tag)&&(o.namespace===void 0||t.namespaceURI==o.namespace)&&(!o.context||n.matchesContext(o.context))){if(o.getAttrs){let l=o.getAttrs(t);if(l===!1)continue;o.attrs=l||void 0}return o}}}matchStyle(t,n,r,s){for(let o=s?this.styles.indexOf(s)+1:0;o<this.styles.length;o++){let l=this.styles[o],c=l.style;if(!(c.indexOf(t)!=0||l.context&&!r.matchesContext(l.context)||c.length>t.length&&(c.charCodeAt(t.length)!=61||c.slice(t.length+1)!=n))){if(l.getAttrs){let u=l.getAttrs(n);if(u===!1)continue;l.attrs=u||void 0}return l}}}static schemaRules(t){let n=[];function r(s){let o=s.priority==null?50:s.priority,l=0;for(;l<n.length;l++){let c=n[l];if((c.priority==null?50:c.priority)<o)break}n.splice(l,0,s)}for(let s in t.marks){let o=t.marks[s].spec.parseDOM;o&&o.forEach(l=>{r(l=YD(l)),l.mark||l.ignore||l.clearMark||(l.mark=s)})}for(let s in t.nodes){let o=t.nodes[s].spec.parseDOM;o&&o.forEach(l=>{r(l=YD(l)),l.node||l.ignore||l.mark||(l.node=s)})}return n}static fromSchema(t){return t.cached.domParser||(t.cached.domParser=new sl(t,sl.schemaRules(t)))}}const a$={address:!0,article:!0,aside:!0,blockquote:!0,body:!0,canvas:!0,dd:!0,div:!0,dl:!0,fieldset:!0,figcaption:!0,figure:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,li:!0,noscript:!0,ol:!0,output:!0,p:!0,pre:!0,section:!0,table:!0,tfoot:!0,ul:!0},Bwe={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},c$={ol:!0,ul:!0},Wp=1,AC=2,mp=4;function GD(e,t,n){return t!=null?(t?Wp:0)|(t==="full"?AC:0):e&&e.whitespace=="pre"?Wp|AC:n&~mp}class ey{constructor(t,n,r,s,o,l){this.type=t,this.attrs=n,this.marks=r,this.solid=s,this.options=l,this.content=[],this.activeMarks=tn.none,this.match=o||(l&mp?null:t.contentMatch)}findWrapping(t){if(!this.match){if(!this.type)return[];let n=this.type.contentMatch.fillBefore(Ie.from(t));if(n)this.match=this.type.contentMatch.matchFragment(n);else{let r=this.type.contentMatch,s;return(s=r.findWrapping(t.type))?(this.match=r,s):null}}return this.match.findWrapping(t.type)}finish(t){if(!(this.options&Wp)){let r=this.content[this.content.length-1],s;if(r&&r.isText&&(s=/[ \t\r\n\u000c]+$/.exec(r.text))){let o=r;r.text.length==s[0].length?this.content.pop():this.content[this.content.length-1]=o.withText(o.text.slice(0,o.text.length-s[0].length))}}let n=Ie.from(this.content);return!t&&this.match&&(n=n.append(this.match.fillBefore(Ie.empty,!0))),this.type?this.type.create(this.attrs,n,this.marks):n}inlineContext(t){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:t.parentNode&&!a$.hasOwnProperty(t.parentNode.nodeName.toLowerCase())}}class KD{constructor(t,n,r){this.parser=t,this.options=n,this.isOpen=r,this.open=0,this.localPreserveWS=!1;let s=n.topNode,o,l=GD(null,n.preserveWhitespace,0)|(r?mp:0);s?o=new ey(s.type,s.attrs,tn.none,!0,n.topMatch||s.type.contentMatch,l):r?o=new ey(null,null,tn.none,!0,null,l):o=new ey(t.schema.topNodeType,null,tn.none,!0,null,l),this.nodes=[o],this.find=n.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(t,n){t.nodeType==3?this.addTextNode(t,n):t.nodeType==1&&this.addElement(t,n)}addTextNode(t,n){let r=t.nodeValue,s=this.top,o=s.options&AC?"full":this.localPreserveWS||(s.options&Wp)>0,{schema:l}=this.parser;if(o==="full"||s.inlineContext(t)||/[^ \t\r\n\u000c]/.test(r)){if(o)if(o==="full")r=r.replace(/\r\n?/g,`
|
|
359
|
+
`);else if(l.linebreakReplacement&&/[\r\n]/.test(r)&&this.top.findWrapping(l.linebreakReplacement.create())){let c=r.split(/\r?\n|\r/);for(let u=0;u<c.length;u++)u&&this.insertNode(l.linebreakReplacement.create(),n,!0),c[u]&&this.insertNode(l.text(c[u]),n,!/\S/.test(c[u]));r=""}else r=r.replace(/\r?\n|\r/g," ");else if(r=r.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(r)&&this.open==this.nodes.length-1){let c=s.content[s.content.length-1],u=t.previousSibling;(!c||u&&u.nodeName=="BR"||c.isText&&/[ \t\r\n\u000c]$/.test(c.text))&&(r=r.slice(1))}r&&this.insertNode(l.text(r),n,!/\S/.test(r)),this.findInText(t)}else this.findInside(t)}addElement(t,n,r){let s=this.localPreserveWS,o=this.top;(t.tagName=="PRE"||/pre/.test(t.style&&t.style.whiteSpace))&&(this.localPreserveWS=!0);let l=t.nodeName.toLowerCase(),c;c$.hasOwnProperty(l)&&this.parser.normalizeLists&&Hwe(t);let u=this.options.ruleFromNode&&this.options.ruleFromNode(t)||(c=this.parser.matchTag(t,this,r));e:if(u?u.ignore:Bwe.hasOwnProperty(l))this.findInside(t),this.ignoreFallback(t,n);else if(!u||u.skip||u.closeParent){u&&u.closeParent?this.open=Math.max(0,this.open-1):u&&u.skip.nodeType&&(t=u.skip);let f,h=this.needsBlock;if(a$.hasOwnProperty(l))o.content.length&&o.content[0].isInline&&this.open&&(this.open--,o=this.top),f=!0,o.type||(this.needsBlock=!0);else if(!t.firstChild){this.leafFallback(t,n);break e}let p=u&&u.skip?n:this.readStyles(t,n);p&&this.addAll(t,p),f&&this.sync(o),this.needsBlock=h}else{let f=this.readStyles(t,n);f&&this.addElementByRule(t,u,f,u.consuming===!1?c:void 0)}this.localPreserveWS=s}leafFallback(t,n){t.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(t.ownerDocument.createTextNode(`
|
|
360
|
+
`),n)}ignoreFallback(t,n){t.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"),n,!0)}readStyles(t,n){let r=t.style;if(r&&r.length)for(let s=0;s<this.parser.matchedStyles.length;s++){let o=this.parser.matchedStyles[s],l=r.getPropertyValue(o);if(l)for(let c=void 0;;){let u=this.parser.matchStyle(o,l,this,c);if(!u)break;if(u.ignore)return null;if(u.clearMark?n=n.filter(f=>!u.clearMark(f)):n=n.concat(this.parser.schema.marks[u.mark].create(u.attrs)),u.consuming===!1)c=u;else break}}return n}addElementByRule(t,n,r,s){let o,l;if(n.node)if(l=this.parser.schema.nodes[n.node],l.isLeaf)this.insertNode(l.create(n.attrs),r,t.nodeName=="BR")||this.leafFallback(t,r);else{let u=this.enter(l,n.attrs||null,r,n.preserveWhitespace);u&&(o=!0,r=u)}else{let u=this.parser.schema.marks[n.mark];r=r.concat(u.create(n.attrs))}let c=this.top;if(l&&l.isLeaf)this.findInside(t);else if(s)this.addElement(t,r,s);else if(n.getContent)this.findInside(t),n.getContent(t,this.parser.schema).forEach(u=>this.insertNode(u,r,!1));else{let u=t;typeof n.contentElement=="string"?u=t.querySelector(n.contentElement):typeof n.contentElement=="function"?u=n.contentElement(t):n.contentElement&&(u=n.contentElement),this.findAround(t,u,!0),this.addAll(u,r),this.findAround(t,u,!1)}o&&this.sync(c)&&this.open--}addAll(t,n,r,s){let o=r||0;for(let l=r?t.childNodes[r]:t.firstChild,c=s==null?null:t.childNodes[s];l!=c;l=l.nextSibling,++o)this.findAtPoint(t,o),this.addDOM(l,n);this.findAtPoint(t,o)}findPlace(t,n,r){let s,o;for(let l=this.open,c=0;l>=0;l--){let u=this.nodes[l],f=u.findWrapping(t);if(f&&(!s||s.length>f.length+c)&&(s=f,o=u,!f.length))break;if(u.solid){if(r)break;c+=2}}if(!s)return null;this.sync(o);for(let l=0;l<s.length;l++)n=this.enterInner(s[l],null,n,!1);return n}insertNode(t,n,r){if(t.isInline&&this.needsBlock&&!this.top.type){let o=this.textblockFromContext();o&&(n=this.enterInner(o,null,n))}let s=this.findPlace(t,n,r);if(s){this.closeExtra();let o=this.top;o.match&&(o.match=o.match.matchType(t.type));let l=tn.none;for(let c of s.concat(t.marks))(o.type?o.type.allowsMarkType(c.type):WD(c.type,t.type))&&(l=c.addToSet(l));return o.content.push(t.mark(l)),!0}return!1}enter(t,n,r,s){let o=this.findPlace(t.create(n),r,!1);return o&&(o=this.enterInner(t,n,r,!0,s)),o}enterInner(t,n,r,s=!1,o){this.closeExtra();let l=this.top;l.match=l.match&&l.match.matchType(t);let c=GD(t,o,l.options);l.options&mp&&l.content.length==0&&(c|=mp);let u=tn.none;return r=r.filter(f=>(l.type?l.type.allowsMarkType(f.type):WD(f.type,t))?(u=f.addToSet(u),!1):!0),this.nodes.push(new ey(t,n,u,s,null,c)),this.open++,r}closeExtra(t=!1){let n=this.nodes.length-1;if(n>this.open){for(;n>this.open;n--)this.nodes[n-1].content.push(this.nodes[n].finish(t));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(!!(this.isOpen||this.options.topOpen))}sync(t){for(let n=this.open;n>=0;n--){if(this.nodes[n]==t)return this.open=n,!0;this.localPreserveWS&&(this.nodes[n].options|=Wp)}return!1}get currentPos(){this.closeExtra();let t=0;for(let n=this.open;n>=0;n--){let r=this.nodes[n].content;for(let s=r.length-1;s>=0;s--)t+=r[s].nodeSize;n&&t++}return t}findAtPoint(t,n){if(this.find)for(let r=0;r<this.find.length;r++)this.find[r].node==t&&this.find[r].offset==n&&(this.find[r].pos=this.currentPos)}findInside(t){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].pos==null&&t.nodeType==1&&t.contains(this.find[n].node)&&(this.find[n].pos=this.currentPos)}findAround(t,n,r){if(t!=n&&this.find)for(let s=0;s<this.find.length;s++)this.find[s].pos==null&&t.nodeType==1&&t.contains(this.find[s].node)&&n.compareDocumentPosition(this.find[s].node)&(r?2:4)&&(this.find[s].pos=this.currentPos)}findInText(t){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].node==t&&(this.find[n].pos=this.currentPos-(t.nodeValue.length-this.find[n].offset))}matchesContext(t){if(t.indexOf("|")>-1)return t.split(/\s*\|\s*/).some(this.matchesContext,this);let n=t.split("/"),r=this.options.context,s=!this.isOpen&&(!r||r.parent.type==this.nodes[0].type),o=-(r?r.depth+1:0)+(s?0:1),l=(c,u)=>{for(;c>=0;c--){let f=n[c];if(f==""){if(c==n.length-1||c==0)continue;for(;u>=o;u--)if(l(c-1,u))return!0;return!1}else{let h=u>0||u==0&&s?this.nodes[u].type:r&&u>=o?r.node(u-o).type:null;if(!h||h.name!=f&&!h.isInGroup(f))return!1;u--}}return!0};return l(n.length-1,this.open)}textblockFromContext(){let t=this.options.context;if(t)for(let n=t.depth;n>=0;n--){let r=t.node(n).contentMatchAt(t.indexAfter(n)).defaultType;if(r&&r.isTextblock&&r.defaultAttrs)return r}for(let n in this.parser.schema.nodes){let r=this.parser.schema.nodes[n];if(r.isTextblock&&r.defaultAttrs)return r}}}function Hwe(e){for(let t=e.firstChild,n=null;t;t=t.nextSibling){let r=t.nodeType==1?t.nodeName.toLowerCase():null;r&&c$.hasOwnProperty(r)&&n?(n.appendChild(t),t=n):r=="li"?n=t:r&&(n=null)}}function Fwe(e,t){return(e.matches||e.msMatchesSelector||e.webkitMatchesSelector||e.mozMatchesSelector).call(e,t)}function YD(e){let t={};for(let n in e)t[n]=e[n];return t}function WD(e,t){let n=t.schema.nodes;for(let r in n){let s=n[r];if(!s.allowsMarkType(e))continue;let o=[],l=c=>{o.push(c);for(let u=0;u<c.edgeCount;u++){let{type:f,next:h}=c.edge(u);if(f==t||o.indexOf(h)<0&&l(h))return!0}};if(l(s.contentMatch))return!0}}class Au{constructor(t,n){this.nodes=t,this.marks=n}serializeFragment(t,n={},r){r||(r=ty(n).createDocumentFragment());let s=r,o=[];return t.forEach(l=>{if(o.length||l.marks.length){let c=0,u=0;for(;c<o.length&&u<l.marks.length;){let f=l.marks[u];if(!this.marks[f.type.name]){u++;continue}if(!f.eq(o[c][0])||f.type.spec.spanning===!1)break;c++,u++}for(;c<o.length;)s=o.pop()[1];for(;u<l.marks.length;){let f=l.marks[u++],h=this.serializeMark(f,l.isInline,n);h&&(o.push([f,s]),s.appendChild(h.dom),s=h.contentDOM||h.dom)}}s.appendChild(this.serializeNodeInner(l,n))}),r}serializeNodeInner(t,n){if(t.isText)return ty(n).createTextNode(t.text);let{dom:r,contentDOM:s}=Ny(ty(n),this.nodes[t.type.name](t),null,t.attrs);if(s){if(t.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(t.content,n,s)}return r}serializeNode(t,n={}){let r=this.serializeNodeInner(t,n);for(let s=t.marks.length-1;s>=0;s--){let o=this.serializeMark(t.marks[s],t.isInline,n);o&&((o.contentDOM||o.dom).appendChild(r),r=o.dom)}return r}serializeMark(t,n,r={}){let s=this.marks[t.type.name];return s&&Ny(ty(r),s(t,n),null,t.attrs)}static renderSpec(t,n,r=null,s){return typeof n=="string"?{dom:t.createTextNode(n)}:Ny(t,n,r,s)}static fromSchema(t){return t.cached.domSerializer||(t.cached.domSerializer=new Au(this.nodesFromSchema(t),this.marksFromSchema(t)))}static nodesFromSchema(t){let n=XD(t.nodes);return n.text||(n.text=r=>r.text),n}static marksFromSchema(t){return XD(t.marks)}}function XD(e){let t={};for(let n in e){let r=e[n].spec.toDOM;r&&(t[n]=r)}return t}function ty(e){return e.document||window.document}const QD=new WeakMap;function $we(e){let t=QD.get(e);return t===void 0&&QD.set(e,t=Uwe(e)),t}function Uwe(e){let t=null;function n(r){if(r&&typeof r=="object")if(Array.isArray(r))if(typeof r[0]=="string")t||(t=[]),t.push(r);else for(let s=0;s<r.length;s++)n(r[s]);else for(let s in r)n(r[s])}return n(e),t}function Ny(e,t,n,r){if(t.nodeType==1)return{dom:t};if(t.dom&&t.dom.nodeType==1)return t;let s=t[0],o;if(typeof s!="string")throw new RangeError("Invalid array passed to renderSpec");if(r&&(o=$we(r))&&o.indexOf(t)>-1)throw new RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");let l=s.indexOf(" ");l>0&&(n=s.slice(0,l),s=s.slice(l+1));let c,u=n?e.createElementNS(n,s):e.createElement(s),f=t[1],h=1;if(f&&typeof f=="object"&&f.nodeType==null&&!Array.isArray(f)){h=2;for(let p in f)if(f[p]!=null){let y=p.indexOf(" ");y>0?u.setAttributeNS(p.slice(0,y),p.slice(y+1),f[p]):p=="style"&&u.style?u.style.cssText=f[p]:u.setAttribute(p,f[p])}}for(let p=h;p<t.length;p++){let y=t[p];if(y===0){if(p<t.length-1||p>h)throw new RangeError("Content hole must be the only child of its parent node");return{dom:u,contentDOM:u}}else if(typeof y=="string")u.appendChild(e.createTextNode(y));else{let{dom:x,contentDOM:b}=Ny(e,y,n,r);if(u.appendChild(x),b){if(c)throw new RangeError("Multiple content holes");c=b}}}return{dom:u,contentDOM:c}}const u$=65535,d$=Math.pow(2,16);function Vwe(e,t){return e+t*d$}function ZD(e){return e&u$}function qwe(e){return(e-(e&u$))/d$}const f$=1,h$=2,Oy=4,p$=8;class kC{constructor(t,n,r){this.pos=t,this.delInfo=n,this.recover=r}get deleted(){return(this.delInfo&p$)>0}get deletedBefore(){return(this.delInfo&(f$|Oy))>0}get deletedAfter(){return(this.delInfo&(h$|Oy))>0}get deletedAcross(){return(this.delInfo&Oy)>0}}class Bs{constructor(t,n=!1){if(this.ranges=t,this.inverted=n,!t.length&&Bs.empty)return Bs.empty}recover(t){let n=0,r=ZD(t);if(!this.inverted)for(let s=0;s<r;s++)n+=this.ranges[s*3+2]-this.ranges[s*3+1];return this.ranges[r*3]+n+qwe(t)}mapResult(t,n=1){return this._map(t,n,!1)}map(t,n=1){return this._map(t,n,!0)}_map(t,n,r){let s=0,o=this.inverted?2:1,l=this.inverted?1:2;for(let c=0;c<this.ranges.length;c+=3){let u=this.ranges[c]-(this.inverted?s:0);if(u>t)break;let f=this.ranges[c+o],h=this.ranges[c+l],p=u+f;if(t<=p){let y=f?t==u?-1:t==p?1:n:n,x=u+s+(y<0?0:h);if(r)return x;let b=t==(n<0?u:p)?null:Vwe(c/3,t-u),S=0;return f&&(S|=t==u?h$:t==p?f$:Oy,(n<0?t!=u:t!=p)&&(S|=p$)),new kC(x,S,b)}s+=h-f}return r?t+s:new kC(t+s,0,null)}touches(t,n){let r=0,s=ZD(n),o=this.inverted?2:1,l=this.inverted?1:2;for(let c=0;c<this.ranges.length;c+=3){let u=this.ranges[c]-(this.inverted?r:0);if(u>t)break;let f=this.ranges[c+o],h=u+f;if(t<=h&&c==s*3)return!0;r+=this.ranges[c+l]-f}return!1}forEach(t){let n=this.inverted?2:1,r=this.inverted?1:2;for(let s=0,o=0;s<this.ranges.length;s+=3){let l=this.ranges[s],c=l-(this.inverted?o:0),u=l+(this.inverted?0:o),f=this.ranges[s+n],h=this.ranges[s+r];t(c,c+f,u,u+h),o+=h-f}}invert(){return new Bs(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(t){return t==0?Bs.empty:new Bs(t<0?[0,-t,0]:[0,0,t])}}Bs.empty=new Bs([]);class Xp{constructor(t,n,r=0,s=t?t.length:0){this.mirror=n,this.from=r,this.to=s,this._maps=t||[],this.ownData=!(t||n)}get maps(){return this._maps}slice(t=0,n=this.maps.length){return new Xp(this._maps,this.mirror,t,n)}appendMap(t,n){this.ownData||(this._maps=this._maps.slice(),this.mirror=this.mirror&&this.mirror.slice(),this.ownData=!0),this.to=this._maps.push(t),n!=null&&this.setMirror(this._maps.length-1,n)}appendMapping(t){for(let n=0,r=this._maps.length;n<t._maps.length;n++){let s=t.getMirror(n);this.appendMap(t._maps[n],s!=null&&s<n?r+s:void 0)}}getMirror(t){if(this.mirror){for(let n=0;n<this.mirror.length;n++)if(this.mirror[n]==t)return this.mirror[n+(n%2?-1:1)]}}setMirror(t,n){this.mirror||(this.mirror=[]),this.mirror.push(t,n)}appendMappingInverted(t){for(let n=t.maps.length-1,r=this._maps.length+t._maps.length;n>=0;n--){let s=t.getMirror(n);this.appendMap(t._maps[n].invert(),s!=null&&s>n?r-s-1:void 0)}}invert(){let t=new Xp;return t.appendMappingInverted(this),t}map(t,n=1){if(this.mirror)return this._map(t,n,!0);for(let r=this.from;r<this.to;r++)t=this._maps[r].map(t,n);return t}mapResult(t,n=1){return this._map(t,n,!1)}_map(t,n,r){let s=0;for(let o=this.from;o<this.to;o++){let l=this._maps[o],c=l.mapResult(t,n);if(c.recover!=null){let u=this.getMirror(o);if(u!=null&&u>o&&u<this.to){o=u,t=this._maps[u].recover(c.recover);continue}}s|=c.delInfo,t=c.pos}return r?t:new kC(t,s,null)}}const gw=Object.create(null);class Hr{getMap(){return Bs.empty}merge(t){return null}static fromJSON(t,n){if(!n||!n.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=gw[n.stepType];if(!r)throw new RangeError(`No step type ${n.stepType} defined`);return r.fromJSON(t,n)}static jsonID(t,n){if(t in gw)throw new RangeError("Duplicate use of step JSON ID "+t);return gw[t]=n,n.prototype.jsonID=t,n}}class $n{constructor(t,n){this.doc=t,this.failed=n}static ok(t){return new $n(t,null)}static fail(t){return new $n(null,t)}static fromReplace(t,n,r,s){try{return $n.ok(t.replace(n,r,s))}catch(o){if(o instanceof Kp)return $n.fail(o.message);throw o}}}function vN(e,t,n){let r=[];for(let s=0;s<e.childCount;s++){let o=e.child(s);o.content.size&&(o=o.copy(vN(o.content,t,o))),o.isInline&&(o=t(o,n,s)),r.push(o)}return Ie.fromArray(r)}class Ca extends Hr{constructor(t,n,r){super(),this.from=t,this.to=n,this.mark=r}apply(t){let n=t.slice(this.from,this.to),r=t.resolve(this.from),s=r.node(r.sharedDepth(this.to)),o=new Ue(vN(n.content,(l,c)=>!l.isAtom||!c.type.allowsMarkType(this.mark.type)?l:l.mark(this.mark.addToSet(l.marks)),s),n.openStart,n.openEnd);return $n.fromReplace(t,this.from,this.to,o)}invert(){return new Oo(this.from,this.to,this.mark)}map(t){let n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new Ca(n.pos,r.pos,this.mark)}merge(t){return t instanceof Ca&&t.mark.eq(this.mark)&&this.from<=t.to&&this.to>=t.from?new Ca(Math.min(this.from,t.from),Math.max(this.to,t.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(t,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new Ca(n.from,n.to,t.markFromJSON(n.mark))}}Hr.jsonID("addMark",Ca);class Oo extends Hr{constructor(t,n,r){super(),this.from=t,this.to=n,this.mark=r}apply(t){let n=t.slice(this.from,this.to),r=new Ue(vN(n.content,s=>s.mark(this.mark.removeFromSet(s.marks)),t),n.openStart,n.openEnd);return $n.fromReplace(t,this.from,this.to,r)}invert(){return new Ca(this.from,this.to,this.mark)}map(t){let n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new Oo(n.pos,r.pos,this.mark)}merge(t){return t instanceof Oo&&t.mark.eq(this.mark)&&this.from<=t.to&&this.to>=t.from?new Oo(Math.min(this.from,t.from),Math.max(this.to,t.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(t,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new Oo(n.from,n.to,t.markFromJSON(n.mark))}}Hr.jsonID("removeMark",Oo);class Ta extends Hr{constructor(t,n){super(),this.pos=t,this.mark=n}apply(t){let n=t.nodeAt(this.pos);if(!n)return $n.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return $n.fromReplace(t,this.pos,this.pos+1,new Ue(Ie.from(r),0,n.isLeaf?0:1))}invert(t){let n=t.nodeAt(this.pos);if(n){let r=this.mark.addToSet(n.marks);if(r.length==n.marks.length){for(let s=0;s<n.marks.length;s++)if(!n.marks[s].isInSet(r))return new Ta(this.pos,n.marks[s]);return new Ta(this.pos,this.mark)}}return new mu(this.pos,this.mark)}map(t){let n=t.mapResult(this.pos,1);return n.deletedAfter?null:new Ta(n.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(t,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new Ta(n.pos,t.markFromJSON(n.mark))}}Hr.jsonID("addNodeMark",Ta);class mu extends Hr{constructor(t,n){super(),this.pos=t,this.mark=n}apply(t){let n=t.nodeAt(this.pos);if(!n)return $n.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.removeFromSet(n.marks));return $n.fromReplace(t,this.pos,this.pos+1,new Ue(Ie.from(r),0,n.isLeaf?0:1))}invert(t){let n=t.nodeAt(this.pos);return!n||!this.mark.isInSet(n.marks)?this:new Ta(this.pos,this.mark)}map(t){let n=t.mapResult(this.pos,1);return n.deletedAfter?null:new mu(n.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(t,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new mu(n.pos,t.markFromJSON(n.mark))}}Hr.jsonID("removeNodeMark",mu);class _n extends Hr{constructor(t,n,r,s=!1){super(),this.from=t,this.to=n,this.slice=r,this.structure=s}apply(t){return this.structure&&_C(t,this.from,this.to)?$n.fail("Structure replace would overwrite content"):$n.fromReplace(t,this.from,this.to,this.slice)}getMap(){return new Bs([this.from,this.to-this.from,this.slice.size])}invert(t){return new _n(this.from,this.from+this.slice.size,t.slice(this.from,this.to))}map(t){let n=t.mapResult(this.to,-1),r=this.from==this.to&&_n.MAP_BIAS<0?n:t.mapResult(this.from,1);return r.deletedAcross&&n.deletedAcross?null:new _n(r.pos,Math.max(r.pos,n.pos),this.slice,this.structure)}merge(t){if(!(t instanceof _n)||t.structure||this.structure)return null;if(this.from+this.slice.size==t.from&&!this.slice.openEnd&&!t.slice.openStart){let n=this.slice.size+t.slice.size==0?Ue.empty:new Ue(this.slice.content.append(t.slice.content),this.slice.openStart,t.slice.openEnd);return new _n(this.from,this.to+(t.to-t.from),n,this.structure)}else if(t.to==this.from&&!this.slice.openStart&&!t.slice.openEnd){let n=this.slice.size+t.slice.size==0?Ue.empty:new Ue(t.slice.content.append(this.slice.content),t.slice.openStart,this.slice.openEnd);return new _n(t.from,this.to,n,this.structure)}else return null}toJSON(){let t={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(t.slice=this.slice.toJSON()),this.structure&&(t.structure=!0),t}static fromJSON(t,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new _n(n.from,n.to,Ue.fromJSON(t,n.slice),!!n.structure)}}_n.MAP_BIAS=1;Hr.jsonID("replace",_n);class ir extends Hr{constructor(t,n,r,s,o,l,c=!1){super(),this.from=t,this.to=n,this.gapFrom=r,this.gapTo=s,this.slice=o,this.insert=l,this.structure=c}apply(t){if(this.structure&&(_C(t,this.from,this.gapFrom)||_C(t,this.gapTo,this.to)))return $n.fail("Structure gap-replace would overwrite content");let n=t.slice(this.gapFrom,this.gapTo);if(n.openStart||n.openEnd)return $n.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,n.content);return r?$n.fromReplace(t,this.from,this.to,r):$n.fail("Content does not fit in gap")}getMap(){return new Bs([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(t){let n=this.gapTo-this.gapFrom;return new ir(this.from,this.from+this.slice.size+n,this.from+this.insert,this.from+this.insert+n,t.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(t){let n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1),s=this.from==this.gapFrom?n.pos:t.map(this.gapFrom,-1),o=this.to==this.gapTo?r.pos:t.map(this.gapTo,1);return n.deletedAcross&&r.deletedAcross||s<n.pos||o>r.pos?null:new ir(n.pos,r.pos,s,o,this.slice,this.insert,this.structure)}toJSON(){let t={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(t.slice=this.slice.toJSON()),this.structure&&(t.structure=!0),t}static fromJSON(t,n){if(typeof n.from!="number"||typeof n.to!="number"||typeof n.gapFrom!="number"||typeof n.gapTo!="number"||typeof n.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new ir(n.from,n.to,n.gapFrom,n.gapTo,Ue.fromJSON(t,n.slice),n.insert,!!n.structure)}}Hr.jsonID("replaceAround",ir);function _C(e,t,n){let r=e.resolve(t),s=n-t,o=r.depth;for(;s>0&&o>0&&r.indexAfter(o)==r.node(o).childCount;)o--,s--;if(s>0){let l=r.node(o).maybeChild(r.indexAfter(o));for(;s>0;){if(!l||l.isLeaf)return!0;l=l.firstChild,s--}}return!1}function Gwe(e,t,n,r){let s=[],o=[],l,c;e.doc.nodesBetween(t,n,(u,f,h)=>{if(!u.isInline)return;let p=u.marks;if(!r.isInSet(p)&&h.type.allowsMarkType(r.type)){let y=Math.max(f,t),x=Math.min(f+u.nodeSize,n),b=r.addToSet(p);for(let S=0;S<p.length;S++)p[S].isInSet(b)||(l&&l.to==y&&l.mark.eq(p[S])?l.to=x:s.push(l=new Oo(y,x,p[S])));c&&c.to==y?c.to=x:o.push(c=new Ca(y,x,r))}}),s.forEach(u=>e.step(u)),o.forEach(u=>e.step(u))}function Kwe(e,t,n,r){let s=[],o=0;e.doc.nodesBetween(t,n,(l,c)=>{if(!l.isInline)return;o++;let u=null;if(r instanceof jb){let f=l.marks,h;for(;h=r.isInSet(f);)(u||(u=[])).push(h),f=h.removeFromSet(f)}else r?r.isInSet(l.marks)&&(u=[r]):u=l.marks;if(u&&u.length){let f=Math.min(c+l.nodeSize,n);for(let h=0;h<u.length;h++){let p=u[h],y;for(let x=0;x<s.length;x++){let b=s[x];b.step==o-1&&p.eq(s[x].style)&&(y=b)}y?(y.to=f,y.step=o):s.push({style:p,from:Math.max(c,t),to:f,step:o})}}}),s.forEach(l=>e.step(new Oo(l.from,l.to,l.style)))}function SN(e,t,n,r=n.contentMatch,s=!0){let o=e.doc.nodeAt(t),l=[],c=t+1;for(let u=0;u<o.childCount;u++){let f=o.child(u),h=c+f.nodeSize,p=r.matchType(f.type);if(!p)l.push(new _n(c,h,Ue.empty));else{r=p;for(let y=0;y<f.marks.length;y++)n.allowsMarkType(f.marks[y].type)||e.step(new Oo(c,h,f.marks[y]));if(s&&f.isText&&n.whitespace!="pre"){let y,x=/\r?\n|\r/g,b;for(;y=x.exec(f.text);)b||(b=new Ue(Ie.from(n.schema.text(" ",n.allowedMarks(f.marks))),0,0)),l.push(new _n(c+y.index,c+y.index+y[0].length,b))}}c=h}if(!r.validEnd){let u=r.fillBefore(Ie.empty,!0);e.replace(c,c,new Ue(u,0,0))}for(let u=l.length-1;u>=0;u--)e.step(l[u])}function Ywe(e,t,n){return(t==0||e.canReplace(t,e.childCount))&&(n==e.childCount||e.canReplace(0,n))}function Bf(e){let n=e.parent.content.cutByIndex(e.startIndex,e.endIndex);for(let r=e.depth,s=0,o=0;;--r){let l=e.$from.node(r),c=e.$from.index(r)+s,u=e.$to.indexAfter(r)-o;if(r<e.depth&&l.canReplace(c,u,n))return r;if(r==0||l.type.spec.isolating||!Ywe(l,c,u))break;c&&(s=1),u<l.childCount&&(o=1)}return null}function Wwe(e,t,n){let{$from:r,$to:s,depth:o}=t,l=r.before(o+1),c=s.after(o+1),u=l,f=c,h=Ie.empty,p=0;for(let b=o,S=!1;b>n;b--)S||r.index(b)>0?(S=!0,h=Ie.from(r.node(b).copy(h)),p++):u--;let y=Ie.empty,x=0;for(let b=o,S=!1;b>n;b--)S||s.after(b+1)<s.end(b)?(S=!0,y=Ie.from(s.node(b).copy(y)),x++):f++;e.step(new ir(u,f,l,c,new Ue(h.append(y),p,x),h.size-p,!0))}function wN(e,t,n=null,r=e){let s=Xwe(e,t),o=s&&Qwe(r,t);return o?s.map(JD).concat({type:t,attrs:n}).concat(o.map(JD)):null}function JD(e){return{type:e,attrs:null}}function Xwe(e,t){let{parent:n,startIndex:r,endIndex:s}=e,o=n.contentMatchAt(r).findWrapping(t);if(!o)return null;let l=o.length?o[0]:t;return n.canReplaceWith(r,s,l)?o:null}function Qwe(e,t){let{parent:n,startIndex:r,endIndex:s}=e,o=n.child(r),l=t.contentMatch.findWrapping(o.type);if(!l)return null;let u=(l.length?l[l.length-1]:t).contentMatch;for(let f=r;u&&f<s;f++)u=u.matchType(n.child(f).type);return!u||!u.validEnd?null:l}function Zwe(e,t,n){let r=Ie.empty;for(let l=n.length-1;l>=0;l--){if(r.size){let c=n[l].type.contentMatch.matchFragment(r);if(!c||!c.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}r=Ie.from(n[l].type.create(n[l].attrs,r))}let s=t.start,o=t.end;e.step(new ir(s,o,s,o,new Ue(r,0,0),n.length,!0))}function Jwe(e,t,n,r,s){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let o=e.steps.length;e.doc.nodesBetween(t,n,(l,c)=>{let u=typeof s=="function"?s(l):s;if(l.isTextblock&&!l.hasMarkup(r,u)&&eEe(e.doc,e.mapping.slice(o).map(c),r)){let f=null;if(r.schema.linebreakReplacement){let x=r.whitespace=="pre",b=!!r.contentMatch.matchType(r.schema.linebreakReplacement);x&&!b?f=!1:!x&&b&&(f=!0)}f===!1&&g$(e,l,c,o),SN(e,e.mapping.slice(o).map(c,1),r,void 0,f===null);let h=e.mapping.slice(o),p=h.map(c,1),y=h.map(c+l.nodeSize,1);return e.step(new ir(p,y,p+1,y-1,new Ue(Ie.from(r.create(u,null,l.marks)),0,0),1,!0)),f===!0&&m$(e,l,c,o),!1}})}function m$(e,t,n,r){t.forEach((s,o)=>{if(s.isText){let l,c=/\r?\n|\r/g;for(;l=c.exec(s.text);){let u=e.mapping.slice(r).map(n+1+o+l.index);e.replaceWith(u,u+1,t.type.schema.linebreakReplacement.create())}}})}function g$(e,t,n,r){t.forEach((s,o)=>{if(s.type==s.type.schema.linebreakReplacement){let l=e.mapping.slice(r).map(n+1+o);e.replaceWith(l,l+1,t.type.schema.text(`
|
|
361
|
+
`))}})}function eEe(e,t,n){let r=e.resolve(t),s=r.index();return r.parent.canReplaceWith(s,s+1,n)}function tEe(e,t,n,r,s){let o=e.doc.nodeAt(t);if(!o)throw new RangeError("No node at given position");n||(n=o.type);let l=n.create(r,null,s||o.marks);if(o.isLeaf)return e.replaceWith(t,t+o.nodeSize,l);if(!n.validContent(o.content))throw new RangeError("Invalid content for node type "+n.name);e.step(new ir(t,t+o.nodeSize,t+1,t+o.nodeSize-1,new Ue(Ie.from(l),0,0),1,!0))}function ol(e,t,n=1,r){let s=e.resolve(t),o=s.depth-n,l=r&&r[r.length-1]||s.parent;if(o<0||s.parent.type.spec.isolating||!s.parent.canReplace(s.index(),s.parent.childCount)||!l.type.validContent(s.parent.content.cutByIndex(s.index(),s.parent.childCount)))return!1;for(let f=s.depth-1,h=n-2;f>o;f--,h--){let p=s.node(f),y=s.index(f);if(p.type.spec.isolating)return!1;let x=p.content.cutByIndex(y,p.childCount),b=r&&r[h+1];b&&(x=x.replaceChild(0,b.type.create(b.attrs)));let S=r&&r[h]||p;if(!p.canReplace(y+1,p.childCount)||!S.type.validContent(x))return!1}let c=s.indexAfter(o),u=r&&r[0];return s.node(o).canReplaceWith(c,c,u?u.type:s.node(o+1).type)}function nEe(e,t,n=1,r){let s=e.doc.resolve(t),o=Ie.empty,l=Ie.empty;for(let c=s.depth,u=s.depth-n,f=n-1;c>u;c--,f--){o=Ie.from(s.node(c).copy(o));let h=r&&r[f];l=Ie.from(h?h.type.create(h.attrs,l):s.node(c).copy(l))}e.step(new _n(t,t,new Ue(o.append(l),n,n),!0))}function Za(e,t){let n=e.resolve(t),r=n.index();return y$(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)}function rEe(e,t){t.content.size||e.type.compatibleContent(t.type);let n=e.contentMatchAt(e.childCount),{linebreakReplacement:r}=e.type.schema;for(let s=0;s<t.childCount;s++){let o=t.child(s),l=o.type==r?e.type.schema.nodes.text:o.type;if(n=n.matchType(l),!n||!e.type.allowsMarks(o.marks))return!1}return n.validEnd}function y$(e,t){return!!(e&&t&&!e.isLeaf&&rEe(e,t))}function Pb(e,t,n=-1){let r=e.resolve(t);for(let s=r.depth;;s--){let o,l,c=r.index(s);if(s==r.depth?(o=r.nodeBefore,l=r.nodeAfter):n>0?(o=r.node(s+1),c++,l=r.node(s).maybeChild(c)):(o=r.node(s).maybeChild(c-1),l=r.node(s+1)),o&&!o.isTextblock&&y$(o,l)&&r.node(s).canReplace(c,c+1))return t;if(s==0)break;t=n<0?r.before(s):r.after(s)}}function sEe(e,t,n){let r=null,{linebreakReplacement:s}=e.doc.type.schema,o=e.doc.resolve(t-n),l=o.node().type;if(s&&l.inlineContent){let h=l.whitespace=="pre",p=!!l.contentMatch.matchType(s);h&&!p?r=!1:!h&&p&&(r=!0)}let c=e.steps.length;if(r===!1){let h=e.doc.resolve(t+n);g$(e,h.node(),h.before(),c)}l.inlineContent&&SN(e,t+n-1,l,o.node().contentMatchAt(o.index()),r==null);let u=e.mapping.slice(c),f=u.map(t-n);if(e.step(new _n(f,u.map(t+n,-1),Ue.empty,!0)),r===!0){let h=e.doc.resolve(f);m$(e,h.node(),h.before(),e.steps.length)}return e}function oEe(e,t,n){let r=e.resolve(t);if(r.parent.canReplaceWith(r.index(),r.index(),n))return t;if(r.parentOffset==0)for(let s=r.depth-1;s>=0;s--){let o=r.index(s);if(r.node(s).canReplaceWith(o,o,n))return r.before(s+1);if(o>0)return null}if(r.parentOffset==r.parent.content.size)for(let s=r.depth-1;s>=0;s--){let o=r.indexAfter(s);if(r.node(s).canReplaceWith(o,o,n))return r.after(s+1);if(o<r.node(s).childCount)return null}return null}function iEe(e,t,n){let r=e.resolve(t);if(!n.content.size)return t;let s=n.content;for(let o=0;o<n.openStart;o++)s=s.firstChild.content;for(let o=1;o<=(n.openStart==0&&n.size?2:1);o++)for(let l=r.depth;l>=0;l--){let c=l==r.depth?0:r.pos<=(r.start(l+1)+r.end(l+1))/2?-1:1,u=r.index(l)+(c>0?1:0),f=r.node(l),h=!1;if(o==1)h=f.canReplace(u,u,s);else{let p=f.contentMatchAt(u).findWrapping(s.firstChild.type);h=p&&f.canReplaceWith(u,u,p[0])}if(h)return c==0?r.pos:c<0?r.before(l+1):r.after(l+1)}return null}function zb(e,t,n=t,r=Ue.empty){if(t==n&&!r.size)return null;let s=e.resolve(t),o=e.resolve(n);return x$(s,o,r)?new _n(t,n,r):new lEe(s,o,r).fit()}function x$(e,t,n){return!n.openStart&&!n.openEnd&&e.start()==t.start()&&e.parent.canReplace(e.index(),t.index(),n.content)}class lEe{constructor(t,n,r){this.$from=t,this.$to=n,this.unplaced=r,this.frontier=[],this.placed=Ie.empty;for(let s=0;s<=t.depth;s++){let o=t.node(s);this.frontier.push({type:o.type,match:o.contentMatchAt(t.indexAfter(s))})}for(let s=t.depth;s>0;s--)this.placed=Ie.from(t.node(s).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let f=this.findFittable();f?this.placeNodes(f):this.openMore()||this.dropNode()}let t=this.mustMoveInline(),n=this.placed.size-this.depth-this.$from.depth,r=this.$from,s=this.close(t<0?this.$to:r.doc.resolve(t));if(!s)return null;let o=this.placed,l=r.depth,c=s.depth;for(;l&&c&&o.childCount==1;)o=o.firstChild.content,l--,c--;let u=new Ue(o,l,c);return t>-1?new ir(r.pos,t,this.$to.pos,this.$to.end(),u,n):u.size||r.pos!=this.$to.pos?new _n(r.pos,s.pos,u):null}findFittable(){let t=this.unplaced.openStart;for(let n=this.unplaced.content,r=0,s=this.unplaced.openEnd;r<t;r++){let o=n.firstChild;if(n.childCount>1&&(s=0),o.type.spec.isolating&&s<=r){t=r;break}n=o.content}for(let n=1;n<=2;n++)for(let r=n==1?t:this.unplaced.openStart;r>=0;r--){let s,o=null;r?(o=ej(this.unplaced.content,r-1).firstChild,s=o.content):s=this.unplaced.content;let l=s.firstChild;for(let c=this.depth;c>=0;c--){let{type:u,match:f}=this.frontier[c],h,p=null;if(n==1&&(l?f.matchType(l.type)||(p=f.fillBefore(Ie.from(l),!1)):o&&u.compatibleContent(o.type)))return{sliceDepth:r,frontierDepth:c,parent:o,inject:p};if(n==2&&l&&(h=f.findWrapping(l.type)))return{sliceDepth:r,frontierDepth:c,parent:o,wrap:h};if(o&&f.matchType(o.type))break}}}openMore(){let{content:t,openStart:n,openEnd:r}=this.unplaced;return tj(t,-1)<=n?!1:(this.unplaced.size>1&&tj(t,1)>r&&r++,this.unplaced=new Ue(t,n+1,r),!0)}dropNode(){let{content:t,openStart:n,openEnd:r}=this.unplaced,s=ej(t,n);if(s.childCount<=1&&n>0){let o=t.size-n<=n+s.size;this.unplaced=new Ue(ep(t,n-1,1),n-1,o?n-1:r)}else this.unplaced=new Ue(ep(t,n,1),n,r)}placeNodes({sliceDepth:t,frontierDepth:n,parent:r,inject:s,wrap:o}){for(;this.depth>n;)this.closeFrontierNode();if(o)for(let S=0;S<o.length;S++)this.openFrontierNode(o[S]);let l=this.unplaced,c=r?r.content:l.content,u=l.openStart-t,f=0,h=[],{match:p,type:y}=this.frontier[n];if(s){for(let S=0;S<s.childCount;S++)h.push(s.child(S));p=p.matchFragment(s)}let x=c.size+t-(l.content.size-l.openEnd);for(;f<c.childCount;){let S=c.child(f),E=p.matchType(S.type);if(!E)break;f++,(f>1||u==0||S.content.size)&&(p=E,h.push(b$(S.mark(y.allowedMarks(S.marks)),f==1?u:0,f==c.childCount?x:-1)))}let b=f==c.childCount;b||(x=-1),this.placed=tp(this.placed,n,Ie.from(h)),this.frontier[n].match=p,b&&x<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let S=0,E=c;S<x;S++){let C=E.lastChild;this.frontier.push({type:C.type,match:C.contentMatchAt(C.childCount)}),E=C.content}this.unplaced=b?t==0?Ue.empty:new Ue(ep(l.content,t-1,1),t-1,x<0?l.openEnd:t-1):new Ue(ep(l.content,t,f),l.openStart,l.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let t=this.frontier[this.depth],n;if(!t.type.isTextblock||!yw(this.$to,this.$to.depth,t.type,t.match,!1)||this.$to.depth==this.depth&&(n=this.findCloseLevel(this.$to))&&n.depth==this.depth)return-1;let{depth:r}=this.$to,s=this.$to.after(r);for(;r>1&&s==this.$to.end(--r);)++s;return s}findCloseLevel(t){e:for(let n=Math.min(this.depth,t.depth);n>=0;n--){let{match:r,type:s}=this.frontier[n],o=n<t.depth&&t.end(n+1)==t.pos+(t.depth-(n+1)),l=yw(t,n,s,r,o);if(l){for(let c=n-1;c>=0;c--){let{match:u,type:f}=this.frontier[c],h=yw(t,c,f,u,!0);if(!h||h.childCount)continue e}return{depth:n,fit:l,move:o?t.doc.resolve(t.after(n+1)):t}}}}close(t){let n=this.findCloseLevel(t);if(!n)return null;for(;this.depth>n.depth;)this.closeFrontierNode();n.fit.childCount&&(this.placed=tp(this.placed,n.depth,n.fit)),t=n.move;for(let r=n.depth+1;r<=t.depth;r++){let s=t.node(r),o=s.type.contentMatch.fillBefore(s.content,!0,t.index(r));this.openFrontierNode(s.type,s.attrs,o)}return t}openFrontierNode(t,n=null,r){let s=this.frontier[this.depth];s.match=s.match.matchType(t),this.placed=tp(this.placed,this.depth,Ie.from(t.create(n,r))),this.frontier.push({type:t,match:t.contentMatch})}closeFrontierNode(){let n=this.frontier.pop().match.fillBefore(Ie.empty,!0);n.childCount&&(this.placed=tp(this.placed,this.frontier.length,n))}}function ep(e,t,n){return t==0?e.cutByIndex(n,e.childCount):e.replaceChild(0,e.firstChild.copy(ep(e.firstChild.content,t-1,n)))}function tp(e,t,n){return t==0?e.append(n):e.replaceChild(e.childCount-1,e.lastChild.copy(tp(e.lastChild.content,t-1,n)))}function ej(e,t){for(let n=0;n<t;n++)e=e.firstChild.content;return e}function b$(e,t,n){if(t<=0)return e;let r=e.content;return t>1&&(r=r.replaceChild(0,b$(r.firstChild,t-1,r.childCount==1?n-1:0))),t>0&&(r=e.type.contentMatch.fillBefore(r).append(r),n<=0&&(r=r.append(e.type.contentMatch.matchFragment(r).fillBefore(Ie.empty,!0)))),e.copy(r)}function yw(e,t,n,r,s){let o=e.node(t),l=s?e.indexAfter(t):e.index(t);if(l==o.childCount&&!n.compatibleContent(o.type))return null;let c=r.fillBefore(o.content,!0,l);return c&&!aEe(n,o.content,l)?c:null}function aEe(e,t,n){for(let r=n;r<t.childCount;r++)if(!e.allowsMarks(t.child(r).marks))return!0;return!1}function cEe(e){return e.spec.defining||e.spec.definingForContent}function tj(e,t){for(let n=0;;n++){let r=t<0?e.firstChild:e.lastChild;if(!r||r.isAtom)return n;e=r.content}}function uEe(e,t,n,r){if(!r.size)return e.deleteRange(t,n);let s=e.doc.resolve(t),o=e.doc.resolve(n);if(x$(s,o,r))return e.step(new _n(t,n,r));let l=S$(s,o);l[l.length-1]==0&&l.pop();let c=-(s.depth+1);l.unshift(c);for(let y=s.depth,x=s.pos-1;y>0;y--,x--){let b=s.node(y).type.spec;if(b.defining||b.definingAsContext||b.isolating)break;l.indexOf(y)>-1?c=y:s.before(y)==x&&l.splice(1,0,-y)}let u=l.indexOf(c),f=[],h=r.openStart;for(let y=r.content,x=0;;x++){let b=y.firstChild;if(f.push(b),x==r.openStart)break;y=b.content}for(let y=h-1;y>=0;y--){let x=f[y],b=cEe(x.type);if(b&&!x.sameMarkup(s.node(Math.abs(c)-1)))h=y;else if(b||!x.type.isTextblock)break}for(let y=r.openStart;y>=0;y--){let x=(y+h+1)%(r.openStart+1),b=f[x];if(b)for(let S=0;S<l.length;S++){let E=l[(S+u)%l.length],C=!0;E<0&&(C=!1,E=-E);let O=s.node(E-1),T=s.index(E-1);if(O.canReplaceWith(T,T,b.type,b.marks))return e.replace(s.before(E),C?o.after(E):n,new Ue(v$(r.content,0,r.openStart,x),x,r.openEnd))}}let p=e.steps.length;for(let y=l.length-1;y>=0&&(e.replace(t,n,r),!(e.steps.length>p));y--){let x=l[y];x<0||(t=s.before(x),n=o.after(x))}}function v$(e,t,n,r,s){if(t<n){let o=e.firstChild;e=e.replaceChild(0,o.copy(v$(o.content,t+1,n,r,o)))}if(t>r){let o=s.contentMatchAt(0),l=o.fillBefore(e).append(e);e=l.append(o.matchFragment(l).fillBefore(Ie.empty,!0))}return e}function dEe(e,t,n,r){if(!r.isInline&&t==n&&e.doc.resolve(t).parent.content.size){let s=oEe(e.doc,t,r.type);s!=null&&(t=n=s)}e.replaceRange(t,n,new Ue(Ie.from(r),0,0))}function fEe(e,t,n){let r=e.doc.resolve(t),s=e.doc.resolve(n);if(r.parent.isTextblock&&s.parent.isTextblock&&r.start()!=s.start()&&r.parentOffset==0&&s.parentOffset==0){let l=r.sharedDepth(n),c=!1;for(let u=r.depth;u>l;u--)r.node(u).type.spec.isolating&&(c=!0);for(let u=s.depth;u>l;u--)s.node(u).type.spec.isolating&&(c=!0);if(!c){for(let u=r.depth;u>0&&t==r.start(u);u--)t=r.before(u);for(let u=s.depth;u>0&&n==s.start(u);u--)n=s.before(u);r=e.doc.resolve(t),s=e.doc.resolve(n)}}let o=S$(r,s);for(let l=0;l<o.length;l++){let c=o[l],u=l==o.length-1;if(u&&c==0||r.node(c).type.contentMatch.validEnd)return e.delete(r.start(c),s.end(c));if(c>0&&(u||r.node(c-1).canReplace(r.index(c-1),s.indexAfter(c-1))))return e.delete(r.before(c),s.after(c))}for(let l=1;l<=r.depth&&l<=s.depth;l++)if(t-r.start(l)==r.depth-l&&n>r.end(l)&&s.end(l)-n!=s.depth-l&&r.start(l-1)==s.start(l-1)&&r.node(l-1).canReplace(r.index(l-1),s.index(l-1)))return e.delete(r.before(l),n);e.delete(t,n)}function S$(e,t){let n=[],r=Math.min(e.depth,t.depth);for(let s=r;s>=0;s--){let o=e.start(s);if(o<e.pos-(e.depth-s)||t.end(s)>t.pos+(t.depth-s)||e.node(s).type.spec.isolating||t.node(s).type.spec.isolating)break;(o==t.start(s)||s==e.depth&&s==t.depth&&e.parent.inlineContent&&t.parent.inlineContent&&s&&t.start(s-1)==o-1)&&n.push(s)}return n}class Vd extends Hr{constructor(t,n,r){super(),this.pos=t,this.attr=n,this.value=r}apply(t){let n=t.nodeAt(this.pos);if(!n)return $n.fail("No node at attribute step's position");let r=Object.create(null);for(let o in n.attrs)r[o]=n.attrs[o];r[this.attr]=this.value;let s=n.type.create(r,null,n.marks);return $n.fromReplace(t,this.pos,this.pos+1,new Ue(Ie.from(s),0,n.isLeaf?0:1))}getMap(){return Bs.empty}invert(t){return new Vd(this.pos,this.attr,t.nodeAt(this.pos).attrs[this.attr])}map(t){let n=t.mapResult(this.pos,1);return n.deletedAfter?null:new Vd(n.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(t,n){if(typeof n.pos!="number"||typeof n.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new Vd(n.pos,n.attr,n.value)}}Hr.jsonID("attr",Vd);class Qp extends Hr{constructor(t,n){super(),this.attr=t,this.value=n}apply(t){let n=Object.create(null);for(let s in t.attrs)n[s]=t.attrs[s];n[this.attr]=this.value;let r=t.type.create(n,t.content,t.marks);return $n.ok(r)}getMap(){return Bs.empty}invert(t){return new Qp(this.attr,t.attrs[this.attr])}map(t){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(t,n){if(typeof n.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new Qp(n.attr,n.value)}}Hr.jsonID("docAttr",Qp);let Sf=class extends Error{};Sf=function e(t){let n=Error.call(this,t);return n.__proto__=e.prototype,n};Sf.prototype=Object.create(Error.prototype);Sf.prototype.constructor=Sf;Sf.prototype.name="TransformError";class w${constructor(t){this.doc=t,this.steps=[],this.docs=[],this.mapping=new Xp}get before(){return this.docs.length?this.docs[0]:this.doc}step(t){let n=this.maybeStep(t);if(n.failed)throw new Sf(n.failed);return this}maybeStep(t){let n=t.apply(this.doc);return n.failed||this.addStep(t,n.doc),n}get docChanged(){return this.steps.length>0}changedRange(){let t=1e9,n=-1e9;for(let r=0;r<this.mapping.maps.length;r++){let s=this.mapping.maps[r];r&&(t=s.map(t,1),n=s.map(n,-1)),s.forEach((o,l,c,u)=>{t=Math.min(t,c),n=Math.max(n,u)})}return t==1e9?null:{from:t,to:n}}addStep(t,n){this.docs.push(this.doc),this.steps.push(t),this.mapping.appendMap(t.getMap()),this.doc=n}replace(t,n=t,r=Ue.empty){let s=zb(this.doc,t,n,r);return s&&this.step(s),this}replaceWith(t,n,r){return this.replace(t,n,new Ue(Ie.from(r),0,0))}delete(t,n){return this.replace(t,n,Ue.empty)}insert(t,n){return this.replaceWith(t,t,n)}replaceRange(t,n,r){return uEe(this,t,n,r),this}replaceRangeWith(t,n,r){return dEe(this,t,n,r),this}deleteRange(t,n){return fEe(this,t,n),this}lift(t,n){return Wwe(this,t,n),this}join(t,n=1){return sEe(this,t,n),this}wrap(t,n){return Zwe(this,t,n),this}setBlockType(t,n=t,r,s=null){return Jwe(this,t,n,r,s),this}setNodeMarkup(t,n,r=null,s){return tEe(this,t,n,r,s),this}setNodeAttribute(t,n,r){return this.step(new Vd(t,n,r)),this}setDocAttribute(t,n){return this.step(new Qp(t,n)),this}addNodeMark(t,n){return this.step(new Ta(t,n)),this}removeNodeMark(t,n){let r=this.doc.nodeAt(t);if(!r)throw new RangeError("No node at position "+t);if(n instanceof tn)n.isInSet(r.marks)&&this.step(new mu(t,n));else{let s=r.marks,o,l=[];for(;o=n.isInSet(s);)l.push(new mu(t,o)),s=o.removeFromSet(s);for(let c=l.length-1;c>=0;c--)this.step(l[c])}return this}split(t,n=1,r){return nEe(this,t,n,r),this}addMark(t,n,r){return Gwe(this,t,n,r),this}removeMark(t,n,r){return Kwe(this,t,n,r),this}clearIncompatible(t,n,r){return SN(this,t,n,r),this}}const xw=Object.create(null);class Rt{constructor(t,n,r){this.$anchor=t,this.$head=n,this.ranges=r||[new hEe(t.min(n),t.max(n))]}get anchor(){return this.$anchor.pos}get head(){return this.$head.pos}get from(){return this.$from.pos}get to(){return this.$to.pos}get $from(){return this.ranges[0].$from}get $to(){return this.ranges[0].$to}get empty(){let t=this.ranges;for(let n=0;n<t.length;n++)if(t[n].$from.pos!=t[n].$to.pos)return!1;return!0}content(){return this.$from.doc.slice(this.from,this.to,!0)}replace(t,n=Ue.empty){let r=n.content.lastChild,s=null;for(let c=0;c<n.openEnd;c++)s=r,r=r.lastChild;let o=t.steps.length,l=this.ranges;for(let c=0;c<l.length;c++){let{$from:u,$to:f}=l[c],h=t.mapping.slice(o);t.replaceRange(h.map(u.pos),h.map(f.pos),c?Ue.empty:n),c==0&&sj(t,o,(r?r.isInline:s&&s.isTextblock)?-1:1)}}replaceWith(t,n){let r=t.steps.length,s=this.ranges;for(let o=0;o<s.length;o++){let{$from:l,$to:c}=s[o],u=t.mapping.slice(r),f=u.map(l.pos),h=u.map(c.pos);o?t.deleteRange(f,h):(t.replaceRangeWith(f,h,n),sj(t,r,n.isInline?-1:1))}}static findFrom(t,n,r=!1){let s=t.parent.inlineContent?new ft(t):Td(t.node(0),t.parent,t.pos,t.index(),n,r);if(s)return s;for(let o=t.depth-1;o>=0;o--){let l=n<0?Td(t.node(0),t.node(o),t.before(o+1),t.index(o),n,r):Td(t.node(0),t.node(o),t.after(o+1),t.index(o)+1,n,r);if(l)return l}return null}static near(t,n=1){return this.findFrom(t,n)||this.findFrom(t,-n)||new Hs(t.node(0))}static atStart(t){return Td(t,t,0,0,1)||new Hs(t)}static atEnd(t){return Td(t,t,t.content.size,t.childCount,-1)||new Hs(t)}static fromJSON(t,n){if(!n||!n.type)throw new RangeError("Invalid input for Selection.fromJSON");let r=xw[n.type];if(!r)throw new RangeError(`No selection type ${n.type} defined`);return r.fromJSON(t,n)}static jsonID(t,n){if(t in xw)throw new RangeError("Duplicate use of selection JSON ID "+t);return xw[t]=n,n.prototype.jsonID=t,n}getBookmark(){return ft.between(this.$anchor,this.$head).getBookmark()}}Rt.prototype.visible=!0;class hEe{constructor(t,n){this.$from=t,this.$to=n}}let nj=!1;function rj(e){!nj&&!e.parent.inlineContent&&(nj=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+e.parent.type.name+")"))}class ft extends Rt{constructor(t,n=t){rj(t),rj(n),super(t,n)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(t,n){let r=t.resolve(n.map(this.head));if(!r.parent.inlineContent)return Rt.near(r);let s=t.resolve(n.map(this.anchor));return new ft(s.parent.inlineContent?s:r,r)}replace(t,n=Ue.empty){if(super.replace(t,n),n==Ue.empty){let r=this.$from.marksAcross(this.$to);r&&t.ensureMarks(r)}}eq(t){return t instanceof ft&&t.anchor==this.anchor&&t.head==this.head}getBookmark(){return new Bb(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(t,n){if(typeof n.anchor!="number"||typeof n.head!="number")throw new RangeError("Invalid input for TextSelection.fromJSON");return new ft(t.resolve(n.anchor),t.resolve(n.head))}static create(t,n,r=n){let s=t.resolve(n);return new this(s,r==n?s:t.resolve(r))}static between(t,n,r){let s=t.pos-n.pos;if((!r||s)&&(r=s>=0?1:-1),!n.parent.inlineContent){let o=Rt.findFrom(n,r,!0)||Rt.findFrom(n,-r,!0);if(o)n=o.$head;else return Rt.near(n,r)}return t.parent.inlineContent||(s==0?t=n:(t=(Rt.findFrom(t,-r,!0)||Rt.findFrom(t,r,!0)).$anchor,t.pos<n.pos!=s<0&&(t=n))),new ft(t,n)}}Rt.jsonID("text",ft);class Bb{constructor(t,n){this.anchor=t,this.head=n}map(t){return new Bb(t.map(this.anchor),t.map(this.head))}resolve(t){return ft.between(t.resolve(this.anchor),t.resolve(this.head))}}class nt extends Rt{constructor(t){let n=t.nodeAfter,r=t.node(0).resolve(t.pos+n.nodeSize);super(t,r),this.node=n}map(t,n){let{deleted:r,pos:s}=n.mapResult(this.anchor),o=t.resolve(s);return r?Rt.near(o):new nt(o)}content(){return new Ue(Ie.from(this.node),0,0)}eq(t){return t instanceof nt&&t.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new EN(this.anchor)}static fromJSON(t,n){if(typeof n.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new nt(t.resolve(n.anchor))}static create(t,n){return new nt(t.resolve(n))}static isSelectable(t){return!t.isText&&t.type.spec.selectable!==!1}}nt.prototype.visible=!1;Rt.jsonID("node",nt);class EN{constructor(t){this.anchor=t}map(t){let{deleted:n,pos:r}=t.mapResult(this.anchor);return n?new Bb(r,r):new EN(r)}resolve(t){let n=t.resolve(this.anchor),r=n.nodeAfter;return r&&nt.isSelectable(r)?new nt(n):Rt.near(n)}}class Hs extends Rt{constructor(t){super(t.resolve(0),t.resolve(t.content.size))}replace(t,n=Ue.empty){if(n==Ue.empty){t.delete(0,t.doc.content.size);let r=Rt.atStart(t.doc);r.eq(t.selection)||t.setSelection(r)}else super.replace(t,n)}toJSON(){return{type:"all"}}static fromJSON(t){return new Hs(t)}map(t){return new Hs(t)}eq(t){return t instanceof Hs}getBookmark(){return pEe}}Rt.jsonID("all",Hs);const pEe={map(){return this},resolve(e){return new Hs(e)}};function Td(e,t,n,r,s,o=!1){if(t.inlineContent)return ft.create(e,n);for(let l=r-(s>0?0:1);s>0?l<t.childCount:l>=0;l+=s){let c=t.child(l);if(c.isAtom){if(!o&&nt.isSelectable(c))return nt.create(e,n-(s<0?c.nodeSize:0))}else{let u=Td(e,c,n+s,s<0?c.childCount:0,s,o);if(u)return u}n+=c.nodeSize*s}return null}function sj(e,t,n){let r=e.steps.length-1;if(r<t)return;let s=e.steps[r];if(!(s instanceof _n||s instanceof ir))return;let o=e.mapping.maps[r],l;o.forEach((c,u,f,h)=>{l==null&&(l=h)}),e.setSelection(Rt.near(e.doc.resolve(l),n))}const oj=1,ny=2,ij=4;class mEe extends w${constructor(t){super(t.doc),this.curSelectionFor=0,this.updated=0,this.meta=Object.create(null),this.time=Date.now(),this.curSelection=t.selection,this.storedMarks=t.storedMarks}get selection(){return this.curSelectionFor<this.steps.length&&(this.curSelection=this.curSelection.map(this.doc,this.mapping.slice(this.curSelectionFor)),this.curSelectionFor=this.steps.length),this.curSelection}setSelection(t){if(t.$from.doc!=this.doc)throw new RangeError("Selection passed to setSelection must point at the current document");return this.curSelection=t,this.curSelectionFor=this.steps.length,this.updated=(this.updated|oj)&~ny,this.storedMarks=null,this}get selectionSet(){return(this.updated&oj)>0}setStoredMarks(t){return this.storedMarks=t,this.updated|=ny,this}ensureMarks(t){return tn.sameSet(this.storedMarks||this.selection.$from.marks(),t)||this.setStoredMarks(t),this}addStoredMark(t){return this.ensureMarks(t.addToSet(this.storedMarks||this.selection.$head.marks()))}removeStoredMark(t){return this.ensureMarks(t.removeFromSet(this.storedMarks||this.selection.$head.marks()))}get storedMarksSet(){return(this.updated&ny)>0}addStep(t,n){super.addStep(t,n),this.updated=this.updated&~ny,this.storedMarks=null}setTime(t){return this.time=t,this}replaceSelection(t){return this.selection.replace(this,t),this}replaceSelectionWith(t,n=!0){let r=this.selection;return n&&(t=t.mark(this.storedMarks||(r.empty?r.$from.marks():r.$from.marksAcross(r.$to)||tn.none))),r.replaceWith(this,t),this}deleteSelection(){return this.selection.replace(this),this}insertText(t,n,r){let s=this.doc.type.schema;if(n==null)return t?this.replaceSelectionWith(s.text(t),!0):this.deleteSelection();{if(r==null&&(r=n),!t)return this.deleteRange(n,r);let o=this.storedMarks;if(!o){let l=this.doc.resolve(n);o=r==n?l.marks():l.marksAcross(this.doc.resolve(r))}return this.replaceRangeWith(n,r,s.text(t,o)),!this.selection.empty&&this.selection.to==n+t.length&&this.setSelection(Rt.near(this.selection.$to)),this}}setMeta(t,n){return this.meta[typeof t=="string"?t:t.key]=n,this}getMeta(t){return this.meta[typeof t=="string"?t:t.key]}get isGeneric(){for(let t in this.meta)return!1;return!0}scrollIntoView(){return this.updated|=ij,this}get scrolledIntoView(){return(this.updated&ij)>0}}function lj(e,t){return!t||!e?e:e.bind(t)}class np{constructor(t,n,r){this.name=t,this.init=lj(n.init,r),this.apply=lj(n.apply,r)}}const gEe=[new np("doc",{init(e){return e.doc||e.schema.topNodeType.createAndFill()},apply(e){return e.doc}}),new np("selection",{init(e,t){return e.selection||Rt.atStart(t.doc)},apply(e){return e.selection}}),new np("storedMarks",{init(e){return e.storedMarks||null},apply(e,t,n,r){return r.selection.$cursor?e.storedMarks:null}}),new np("scrollToSelection",{init(){return 0},apply(e,t){return e.scrolledIntoView?t+1:t}})];class bw{constructor(t,n){this.schema=t,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=gEe.slice(),n&&n.forEach(r=>{if(this.pluginsByKey[r.key])throw new RangeError("Adding different instances of a keyed plugin ("+r.key+")");this.plugins.push(r),this.pluginsByKey[r.key]=r,r.spec.state&&this.fields.push(new np(r.key,r.spec.state,r))})}}class Yi{constructor(t){this.config=t}get schema(){return this.config.schema}get plugins(){return this.config.plugins}apply(t){return this.applyTransaction(t).state}filterTransaction(t,n=-1){for(let r=0;r<this.config.plugins.length;r++)if(r!=n){let s=this.config.plugins[r];if(s.spec.filterTransaction&&!s.spec.filterTransaction.call(s,t,this))return!1}return!0}applyTransaction(t){if(!this.filterTransaction(t))return{state:this,transactions:[]};let n=[t],r=this.applyInner(t),s=null;for(;;){let o=!1;for(let l=0;l<this.config.plugins.length;l++){let c=this.config.plugins[l];if(c.spec.appendTransaction){let u=s?s[l].n:0,f=s?s[l].state:this,h=u<n.length&&c.spec.appendTransaction.call(c,u?n.slice(u):n,f,r);if(h&&r.filterTransaction(h,l)){if(h.setMeta("appendedTransaction",t),!s){s=[];for(let p=0;p<this.config.plugins.length;p++)s.push(p<l?{state:r,n:n.length}:{state:this,n:0})}n.push(h),r=r.applyInner(h),o=!0}s&&(s[l]={state:r,n:n.length})}}if(!o)return{state:r,transactions:n}}}applyInner(t){if(!t.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");let n=new Yi(this.config),r=this.config.fields;for(let s=0;s<r.length;s++){let o=r[s];n[o.name]=o.apply(t,this[o.name],this,n)}return n}get tr(){return new mEe(this)}static create(t){let n=new bw(t.doc?t.doc.type.schema:t.schema,t.plugins),r=new Yi(n);for(let s=0;s<n.fields.length;s++)r[n.fields[s].name]=n.fields[s].init(t,r);return r}reconfigure(t){let n=new bw(this.schema,t.plugins),r=n.fields,s=new Yi(n);for(let o=0;o<r.length;o++){let l=r[o].name;s[l]=this.hasOwnProperty(l)?this[l]:r[o].init(t,s)}return s}toJSON(t){let n={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(n.storedMarks=this.storedMarks.map(r=>r.toJSON())),t&&typeof t=="object")for(let r in t){if(r=="doc"||r=="selection")throw new RangeError("The JSON fields `doc` and `selection` are reserved");let s=t[r],o=s.spec.state;o&&o.toJSON&&(n[r]=o.toJSON.call(s,this[s.key]))}return n}static fromJSON(t,n,r){if(!n)throw new RangeError("Invalid input for EditorState.fromJSON");if(!t.schema)throw new RangeError("Required config field 'schema' missing");let s=new bw(t.schema,t.plugins),o=new Yi(s);return s.fields.forEach(l=>{if(l.name=="doc")o.doc=tu.fromJSON(t.schema,n.doc);else if(l.name=="selection")o.selection=Rt.fromJSON(o.doc,n.selection);else if(l.name=="storedMarks")n.storedMarks&&(o.storedMarks=n.storedMarks.map(t.schema.markFromJSON));else{if(r)for(let c in r){let u=r[c],f=u.spec.state;if(u.key==l.name&&f&&f.fromJSON&&Object.prototype.hasOwnProperty.call(n,c)){o[l.name]=f.fromJSON.call(u,t,n[c],o);return}}o[l.name]=l.init(t,o)}}),o}}function E$(e,t,n){for(let r in e){let s=e[r];s instanceof Function?s=s.bind(t):r=="handleDOMEvents"&&(s=E$(s,t,{})),n[r]=s}return n}class Gs{constructor(t){this.spec=t,this.props={},t.props&&E$(t.props,this,this.props),this.key=t.key?t.key.key:C$("plugin")}getState(t){return t[this.key]}}const vw=Object.create(null);function C$(e){return e in vw?e+"$"+ ++vw[e]:(vw[e]=0,e+"$")}class Lo{constructor(t="key"){this.key=C$(t)}get(t){return t.config.pluginsByKey[this.key]}getState(t){return t[this.key]}}const T$=(e,t)=>e.selection.empty?!1:(t&&t(e.tr.deleteSelection().scrollIntoView()),!0);function N$(e,t){let{$cursor:n}=e.selection;return!n||(t?!t.endOfTextblock("backward",e):n.parentOffset>0)?null:n}const O$=(e,t,n)=>{let r=N$(e,n);if(!r)return!1;let s=CN(r);if(!s){let l=r.blockRange(),c=l&&Bf(l);return c==null?!1:(t&&t(e.tr.lift(l,c).scrollIntoView()),!0)}let o=s.nodeBefore;if(j$(e,s,t,-1))return!0;if(r.parent.content.size==0&&(wf(o,"end")||nt.isSelectable(o)))for(let l=r.depth;;l--){let c=zb(e.doc,r.before(l),r.after(l),Ue.empty);if(c&&c.slice.size<c.to-c.from){if(t){let u=e.tr.step(c);u.setSelection(wf(o,"end")?Rt.findFrom(u.doc.resolve(u.mapping.map(s.pos,-1)),-1):nt.create(u.doc,s.pos-o.nodeSize)),t(u.scrollIntoView())}return!0}if(l==1||r.node(l-1).childCount>1)break}return o.isAtom&&s.depth==r.depth-1?(t&&t(e.tr.delete(s.pos-o.nodeSize,s.pos).scrollIntoView()),!0):!1},yEe=(e,t,n)=>{let r=N$(e,n);if(!r)return!1;let s=CN(r);return s?R$(e,s,t):!1},xEe=(e,t,n)=>{let r=k$(e,n);if(!r)return!1;let s=TN(r);return s?R$(e,s,t):!1};function R$(e,t,n){let r=t.nodeBefore,s=r,o=t.pos-1;for(;!s.isTextblock;o--){if(s.type.spec.isolating)return!1;let h=s.lastChild;if(!h)return!1;s=h}let l=t.nodeAfter,c=l,u=t.pos+1;for(;!c.isTextblock;u++){if(c.type.spec.isolating)return!1;let h=c.firstChild;if(!h)return!1;c=h}let f=zb(e.doc,o,u,Ue.empty);if(!f||f.from!=o||f instanceof _n&&f.slice.size>=u-o)return!1;if(n){let h=e.tr.step(f);h.setSelection(ft.create(h.doc,o)),n(h.scrollIntoView())}return!0}function wf(e,t,n=!1){for(let r=e;r;r=t=="start"?r.firstChild:r.lastChild){if(r.isTextblock)return!0;if(n&&r.childCount!=1)return!1}return!1}const A$=(e,t,n)=>{let{$head:r,empty:s}=e.selection,o=r;if(!s)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("backward",e):r.parentOffset>0)return!1;o=CN(r)}let l=o&&o.nodeBefore;return!l||!nt.isSelectable(l)?!1:(t&&t(e.tr.setSelection(nt.create(e.doc,o.pos-l.nodeSize)).scrollIntoView()),!0)};function CN(e){if(!e.parent.type.spec.isolating)for(let t=e.depth-1;t>=0;t--){if(e.index(t)>0)return e.doc.resolve(e.before(t+1));if(e.node(t).type.spec.isolating)break}return null}function k$(e,t){let{$cursor:n}=e.selection;return!n||(t?!t.endOfTextblock("forward",e):n.parentOffset<n.parent.content.size)?null:n}const _$=(e,t,n)=>{let r=k$(e,n);if(!r)return!1;let s=TN(r);if(!s)return!1;let o=s.nodeAfter;if(j$(e,s,t,1))return!0;if(r.parent.content.size==0&&(wf(o,"start")||nt.isSelectable(o))){let l=zb(e.doc,r.before(),r.after(),Ue.empty);if(l&&l.slice.size<l.to-l.from){if(t){let c=e.tr.step(l);c.setSelection(wf(o,"start")?Rt.findFrom(c.doc.resolve(c.mapping.map(s.pos)),1):nt.create(c.doc,c.mapping.map(s.pos))),t(c.scrollIntoView())}return!0}}return o.isAtom&&s.depth==r.depth-1?(t&&t(e.tr.delete(s.pos,s.pos+o.nodeSize).scrollIntoView()),!0):!1},M$=(e,t,n)=>{let{$head:r,empty:s}=e.selection,o=r;if(!s)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("forward",e):r.parentOffset<r.parent.content.size)return!1;o=TN(r)}let l=o&&o.nodeAfter;return!l||!nt.isSelectable(l)?!1:(t&&t(e.tr.setSelection(nt.create(e.doc,o.pos)).scrollIntoView()),!0)};function TN(e){if(!e.parent.type.spec.isolating)for(let t=e.depth-1;t>=0;t--){let n=e.node(t);if(e.index(t)+1<n.childCount)return e.doc.resolve(e.after(t+1));if(n.type.spec.isolating)break}return null}const bEe=(e,t)=>{let n=e.selection,r=n instanceof nt,s;if(r){if(n.node.isTextblock||!Za(e.doc,n.from))return!1;s=n.from}else if(s=Pb(e.doc,n.from,-1),s==null)return!1;if(t){let o=e.tr.join(s);r&&o.setSelection(nt.create(o.doc,s-e.doc.resolve(s).nodeBefore.nodeSize)),t(o.scrollIntoView())}return!0},vEe=(e,t)=>{let n=e.selection,r;if(n instanceof nt){if(n.node.isTextblock||!Za(e.doc,n.to))return!1;r=n.to}else if(r=Pb(e.doc,n.to,1),r==null)return!1;return t&&t(e.tr.join(r).scrollIntoView()),!0},SEe=(e,t)=>{let{$from:n,$to:r}=e.selection,s=n.blockRange(r),o=s&&Bf(s);return o==null?!1:(t&&t(e.tr.lift(s,o).scrollIntoView()),!0)},I$=(e,t)=>{let{$head:n,$anchor:r}=e.selection;return!n.parent.type.spec.code||!n.sameParent(r)?!1:(t&&t(e.tr.insertText(`
|
|
362
|
+
`).scrollIntoView()),!0)};function NN(e){for(let t=0;t<e.edgeCount;t++){let{type:n}=e.edge(t);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}const wEe=(e,t)=>{let{$head:n,$anchor:r}=e.selection;if(!n.parent.type.spec.code||!n.sameParent(r))return!1;let s=n.node(-1),o=n.indexAfter(-1),l=NN(s.contentMatchAt(o));if(!l||!s.canReplaceWith(o,o,l))return!1;if(t){let c=n.after(),u=e.tr.replaceWith(c,c,l.createAndFill());u.setSelection(Rt.near(u.doc.resolve(c),1)),t(u.scrollIntoView())}return!0},L$=(e,t)=>{let n=e.selection,{$from:r,$to:s}=n;if(n instanceof Hs||r.parent.inlineContent||s.parent.inlineContent)return!1;let o=NN(s.parent.contentMatchAt(s.indexAfter()));if(!o||!o.isTextblock)return!1;if(t){let l=(!r.parentOffset&&s.index()<s.parent.childCount?r:s).pos,c=e.tr.insert(l,o.createAndFill());c.setSelection(ft.create(c.doc,l+1)),t(c.scrollIntoView())}return!0},D$=(e,t)=>{let{$cursor:n}=e.selection;if(!n||n.parent.content.size)return!1;if(n.depth>1&&n.after()!=n.end(-1)){let o=n.before();if(ol(e.doc,o))return t&&t(e.tr.split(o).scrollIntoView()),!0}let r=n.blockRange(),s=r&&Bf(r);return s==null?!1:(t&&t(e.tr.lift(r,s).scrollIntoView()),!0)};function EEe(e){return(t,n)=>{if(t.selection instanceof nt&&t.selection.node.isBlock){let{$from:x}=t.selection;return!x.parentOffset||!ol(t.doc,x.pos)?!1:(n&&n(t.tr.split(x.pos).scrollIntoView()),!0)}if(!t.selection.$from.depth)return!1;let r=t.tr;!t.selection.empty&&(t.selection instanceof ft||t.selection instanceof Hs)&&r.deleteSelection();let{$from:s}=r.selection,o=r.steps.length,l=[],c,u,f=!1,h=!1;for(let x=s.depth;;x--)if(s.node(x).isBlock){f=s.end(x)==s.pos+(s.depth-x),h=s.start(x)==s.pos-(s.depth-x),u=NN(s.node(x-1).contentMatchAt(s.indexAfter(x-1))),l.unshift(f&&u?{type:u}:null),c=x;break}else{if(x==1)return!1;l.unshift(null)}let p=s.pos,y=ol(r.doc,p,l.length,l);if(y||(l[0]=u?{type:u}:null,y=ol(r.doc,p,l.length,l)),!y)return!1;if(r.split(p,l.length,l),!f&&h&&s.node(c).type!=u){let x=r.mapping.slice(o),b=x.map(s.before(c)),S=r.doc.resolve(b);u&&s.node(c-1).canReplaceWith(S.index(),S.index()+1,u)&&r.setNodeMarkup(x.map(s.before(c)),u)}return n&&n(r.scrollIntoView()),!0}}const CEe=EEe(),TEe=(e,t)=>{let{$from:n,to:r}=e.selection,s,o=n.sharedDepth(r);return o==0?!1:(s=n.before(o),t&&t(e.tr.setSelection(nt.create(e.doc,s))),!0)};function NEe(e,t,n){let r=t.nodeBefore,s=t.nodeAfter,o=t.index();return!r||!s||!r.type.compatibleContent(s.type)?!1:!r.content.size&&t.parent.canReplace(o-1,o)?(n&&n(e.tr.delete(t.pos-r.nodeSize,t.pos).scrollIntoView()),!0):!t.parent.canReplace(o,o+1)||!(s.isTextblock||Za(e.doc,t.pos))?!1:(n&&n(e.tr.join(t.pos).scrollIntoView()),!0)}function j$(e,t,n,r){let s=t.nodeBefore,o=t.nodeAfter,l,c,u=s.type.spec.isolating||o.type.spec.isolating;if(!u&&NEe(e,t,n))return!0;let f=!u&&t.parent.canReplace(t.index(),t.index()+1);if(f&&(l=(c=s.contentMatchAt(s.childCount)).findWrapping(o.type))&&c.matchType(l[0]||o.type).validEnd){if(n){let x=t.pos+o.nodeSize,b=Ie.empty;for(let C=l.length-1;C>=0;C--)b=Ie.from(l[C].create(null,b));b=Ie.from(s.copy(b));let S=e.tr.step(new ir(t.pos-1,x,t.pos,x,new Ue(b,1,0),l.length,!0)),E=S.doc.resolve(x+2*l.length);E.nodeAfter&&E.nodeAfter.type==s.type&&Za(S.doc,E.pos)&&S.join(E.pos),n(S.scrollIntoView())}return!0}let h=o.type.spec.isolating||r>0&&u?null:Rt.findFrom(t,1),p=h&&h.$from.blockRange(h.$to),y=p&&Bf(p);if(y!=null&&y>=t.depth)return n&&n(e.tr.lift(p,y).scrollIntoView()),!0;if(f&&wf(o,"start",!0)&&wf(s,"end")){let x=s,b=[];for(;b.push(x),!x.isTextblock;)x=x.lastChild;let S=o,E=1;for(;!S.isTextblock;S=S.firstChild)E++;if(x.canReplace(x.childCount,x.childCount,S.content)){if(n){let C=Ie.empty;for(let T=b.length-1;T>=0;T--)C=Ie.from(b[T].copy(C));let O=e.tr.step(new ir(t.pos-b.length,t.pos+o.nodeSize,t.pos+E,t.pos+o.nodeSize-E,new Ue(C,b.length,0),0,!0));n(O.scrollIntoView())}return!0}}return!1}function P$(e){return function(t,n){let r=t.selection,s=e<0?r.$from:r.$to,o=s.depth;for(;s.node(o).isInline;){if(!o)return!1;o--}return s.node(o).isTextblock?(n&&n(t.tr.setSelection(ft.create(t.doc,e<0?s.start(o):s.end(o)))),!0):!1}}const OEe=P$(-1),REe=P$(1);function AEe(e,t=null){return function(n,r){let{$from:s,$to:o}=n.selection,l=s.blockRange(o),c=l&&wN(l,e,t);return c?(r&&r(n.tr.wrap(l,c).scrollIntoView()),!0):!1}}function aj(e,t=null){return function(n,r){let s=!1;for(let o=0;o<n.selection.ranges.length&&!s;o++){let{$from:{pos:l},$to:{pos:c}}=n.selection.ranges[o];n.doc.nodesBetween(l,c,(u,f)=>{if(s)return!1;if(!(!u.isTextblock||u.hasMarkup(e,t)))if(u.type==e)s=!0;else{let h=n.doc.resolve(f),p=h.index();s=h.parent.canReplaceWith(p,p+1,e)}})}if(!s)return!1;if(r){let o=n.tr;for(let l=0;l<n.selection.ranges.length;l++){let{$from:{pos:c},$to:{pos:u}}=n.selection.ranges[l];o.setBlockType(c,u,e,t)}r(o.scrollIntoView())}return!0}}function ON(...e){return function(t,n,r){for(let s=0;s<e.length;s++)if(e[s](t,n,r))return!0;return!1}}ON(T$,O$,A$);ON(T$,_$,M$);ON(I$,L$,D$,CEe);typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<"u"&&os.platform&&os.platform()=="darwin";function kEe(e,t=null){return function(n,r){let{$from:s,$to:o}=n.selection,l=s.blockRange(o);if(!l)return!1;let c=r?n.tr:null;return _Ee(c,l,e,t)?(r&&r(c.scrollIntoView()),!0):!1}}function _Ee(e,t,n,r=null){let s=!1,o=t,l=t.$from.doc;if(t.depth>=2&&t.$from.node(t.depth-1).type.compatibleContent(n)&&t.startIndex==0){if(t.$from.index(t.depth-1)==0)return!1;let u=l.resolve(t.start-2);o=new Sx(u,u,t.depth),t.endIndex<t.parent.childCount&&(t=new Sx(t.$from,l.resolve(t.$to.end(t.depth)),t.depth)),s=!0}let c=wN(o,n,r,t);return c?(e&&MEe(e,t,c,s,n),!0):!1}function MEe(e,t,n,r,s){let o=Ie.empty;for(let h=n.length-1;h>=0;h--)o=Ie.from(n[h].type.create(n[h].attrs,o));e.step(new ir(t.start-(r?2:0),t.end,t.start,t.end,new Ue(o,0,0),n.length,!0));let l=0;for(let h=0;h<n.length;h++)n[h].type==s&&(l=h+1);let c=n.length-l,u=t.start+n.length-(r?2:0),f=t.parent;for(let h=t.startIndex,p=t.endIndex,y=!0;h<p;h++,y=!1)!y&&ol(e.doc,u,c)&&(e.split(u,c),u+=2*c),u+=f.child(h).nodeSize;return e}function IEe(e){return function(t,n){let{$from:r,$to:s}=t.selection,o=r.blockRange(s,l=>l.childCount>0&&l.firstChild.type==e);return o?n?r.node(o.depth-1).type==e?LEe(t,n,e,o):DEe(t,n,o):!0:!1}}function LEe(e,t,n,r){let s=e.tr,o=r.end,l=r.$to.end(r.depth);o<l&&(s.step(new ir(o-1,l,o,l,new Ue(Ie.from(n.create(null,r.parent.copy())),1,0),1,!0)),r=new Sx(s.doc.resolve(r.$from.pos),s.doc.resolve(l),r.depth));const c=Bf(r);if(c==null)return!1;s.lift(r,c);let u=s.doc.resolve(s.mapping.map(o,-1)-1);return Za(s.doc,u.pos)&&u.nodeBefore.type==u.nodeAfter.type&&s.join(u.pos),t(s.scrollIntoView()),!0}function DEe(e,t,n){let r=e.tr,s=n.parent;for(let x=n.end,b=n.endIndex-1,S=n.startIndex;b>S;b--)x-=s.child(b).nodeSize,r.delete(x-1,x+1);let o=r.doc.resolve(n.start),l=o.nodeAfter;if(r.mapping.map(n.end)!=n.start+o.nodeAfter.nodeSize)return!1;let c=n.startIndex==0,u=n.endIndex==s.childCount,f=o.node(-1),h=o.index(-1);if(!f.canReplace(h+(c?0:1),h+1,l.content.append(u?Ie.empty:Ie.from(s))))return!1;let p=o.pos,y=p+l.nodeSize;return r.step(new ir(p-(c?1:0),y+(u?1:0),p+1,y-1,new Ue((c?Ie.empty:Ie.from(s.copy(Ie.empty))).append(u?Ie.empty:Ie.from(s.copy(Ie.empty))),c?0:1,u?0:1),c?0:1)),t(r.scrollIntoView()),!0}function jEe(e){return function(t,n){let{$from:r,$to:s}=t.selection,o=r.blockRange(s,f=>f.childCount>0&&f.firstChild.type==e);if(!o)return!1;let l=o.startIndex;if(l==0)return!1;let c=o.parent,u=c.child(l-1);if(u.type!=e)return!1;if(n){let f=u.lastChild&&u.lastChild.type==c.type,h=Ie.from(f?e.create():null),p=new Ue(Ie.from(e.create(null,Ie.from(c.type.create(null,h)))),f?3:1,0),y=o.start,x=o.end;n(t.tr.step(new ir(y-(f?3:1),x,y,x,p,1,!0)).scrollIntoView())}return!0}}const Er=function(e){for(var t=0;;t++)if(e=e.previousSibling,!e)return t},Ef=function(e){let t=e.assignedSlot||e.parentNode;return t&&t.nodeType==11?t.host:t};let MC=null;const Hi=function(e,t,n){let r=MC||(MC=document.createRange());return r.setEnd(e,n??e.nodeValue.length),r.setStart(e,t||0),r},PEe=function(){MC=null},gu=function(e,t,n,r){return n&&(cj(e,t,n,r,-1)||cj(e,t,n,r,1))},zEe=/^(img|br|input|textarea|hr)$/i;function cj(e,t,n,r,s){for(var o;;){if(e==n&&t==r)return!0;if(t==(s<0?0:Pr(e))){let l=e.parentNode;if(!l||!et(l)||Km(e)||zEe.test(e.nodeName)||e.contentEditable=="false")return!1;t=Er(e)+(s<0?0:1),e=l}else if(et(e)){let l=e.childNodes[t+(s<0?-1:0)];if(et(l)&&l.contentEditable=="false")if(!((o=l.pmViewDesc)===null||o===void 0)&&o.ignoreForSelection)t+=s;else return!1;else e=l,t=s<0?Pr(e):0}else return!1}}function Pr(e){return e.nodeType==3?e.nodeValue.length:e.childNodes.length}function et(e){return e.nodeType==1}function Jn(e){return e.nodeType==3}function yu(e,t){return t?e.contains(et(t)?t:t.parentNode):!1}function BEe(e,t){for(;;){if(Jn(e)&&t)return e;if(et(e)&&t>0){if(e.contentEditable=="false")return null;e=e.childNodes[t-1],t=Pr(e)}else if(e.parentNode&&!Km(e))t=Er(e),e=e.parentNode;else return null}}function HEe(e,t){for(;;){if(Jn(e)&&t<e.nodeValue.length)return e;if(et(e)&&t<e.childNodes.length){if(e.contentEditable=="false")return null;e=e.childNodes[t],t=0}else if(e.parentNode&&!Km(e))t=Er(e)+1,e=e.parentNode;else return null}}function FEe(e,t,n){for(let r=t==0,s=t==Pr(e);r||s;){if(e==n)return!0;let o=Er(e);if(e=e.parentNode,!e)return!1;r=r&&o==0,s=s&&o==Pr(e)}}function Km(e){let t;for(let n=e;n&&!(t=n.pmViewDesc);n=n.parentNode);return t&&t.node&&t.node.isBlock&&(t.dom==e||t.contentDOM==e)}const Hb=function(e){return e.focusNode&&gu(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset)};function Ic(e,t){let n=document.createEvent("Event");return n.initEvent("keydown",!0,!0),n.keyCode=e,n.key=n.code=t,n}function $Ee(e){let t=e.activeElement;for(;t&&t.shadowRoot;)t=t.shadowRoot.activeElement;return t}function UEe(e,t,n){if(e.caretPositionFromPoint)try{let r=e.caretPositionFromPoint(t,n);if(r)return{node:r.offsetNode,offset:Math.min(Pr(r.offsetNode),r.offset)}}catch{}if(e.caretRangeFromPoint){let r=e.caretRangeFromPoint(t,n);if(r)return{node:r.startContainer,offset:Math.min(Pr(r.startContainer),r.startOffset)}}}const fi=typeof navigator<"u"?navigator:null,uj=typeof document<"u"?document:null,Ja=fi&&fi.userAgent||"",IC=/Edge\/(\d+)/.exec(Ja),z$=/MSIE \d/.exec(Ja),LC=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Ja),Ss=!!(z$||LC||IC),_a=z$?document.documentMode:LC?+LC[1]:IC?+IC[1]:0,Fs=!Ss&&/gecko\/(\d+)/i.test(Ja);Fs&&+(/Firefox\/(\d+)/.exec(Ja)||[0,0])[1];const DC=!Ss&&/Chrome\/(\d+)/.exec(Ja),Tr=!!DC,B$=DC?+DC[1]:0,Br=!Ss&&!!fi&&/Apple Computer/.test(fi.vendor),Cf=Br&&(/Mobile\/\w+/.test(Ja)||!!fi&&fi.maxTouchPoints>2),ro=Cf||(fi?/Mac/.test(fi.platform):!1),H$=fi?/Win/.test(fi.platform):!1,Wi=/Android \d/.test(Ja),Fb=!!uj&&"webkitFontSmoothing"in uj.documentElement.style,VEe=Fb?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function qEe(e){let t=e.defaultView&&e.defaultView.visualViewport;return t?{left:0,right:t.width,top:0,bottom:t.height}:{left:0,right:e.documentElement.clientWidth,top:0,bottom:e.documentElement.clientHeight}}function Pi(e,t){return typeof e=="number"?e:e[t]}function GEe(e){let t=e.getBoundingClientRect(),n=t.width/e.offsetWidth||1,r=t.height/e.offsetHeight||1;return{left:t.left,right:t.left+e.clientWidth*n,top:t.top,bottom:t.top+e.clientHeight*r}}function dj(e,t,n){if(!jC(t)&&t.left==0)return;let r=e.someProp("scrollThreshold")||0,s=e.someProp("scrollMargin")||5,o=e.dom.ownerDocument;for(let l=n||e.dom;l;){if(!et(l)){l=Ef(l);continue}let c=l==o.body,u=c?qEe(o):GEe(l),f=0,h=0;if(t.top<u.top+Pi(r,"top")?h=-(u.top-t.top+Pi(s,"top")):t.bottom>u.bottom-Pi(r,"bottom")&&(h=t.bottom-t.top>u.bottom-u.top?t.top+Pi(s,"top")-u.top:t.bottom-u.bottom+Pi(s,"bottom")),t.left<u.left+Pi(r,"left")?f=-(u.left-t.left+Pi(s,"left")):t.right>u.right-Pi(r,"right")&&(f=t.right-u.right+Pi(s,"right")),f||h)if(c)o.defaultView.scrollBy(f,h);else{let y=l.scrollLeft,x=l.scrollTop;h&&(l.scrollTop+=h),f&&(l.scrollLeft+=f);let b=l.scrollLeft-y,S=l.scrollTop-x;t={left:t.left-b,top:t.top-S,right:t.right-b,bottom:t.bottom-S}}let p=c?"fixed":getComputedStyle(l).position;if(/^(fixed|sticky)$/.test(p))break;l=p=="absolute"?l.offsetParent:Ef(l)}}function KEe(e){let t=e.dom.getBoundingClientRect(),n=Math.max(0,t.top),r,s;for(let o=(t.left+t.right)/2,l=n+1;l<Math.min(innerHeight,t.bottom);l+=5){let c=e.root.elementFromPoint(o,l);if(!c||c==e.dom||!e.dom.contains(c))continue;let u=c.getBoundingClientRect();if(u.top>=n-20){r=c,s=u.top;break}}return{refDOM:r,refTop:s,stack:F$(e.dom)}}function F$(e){let t=[],n=e.ownerDocument;for(let r=e;r&&(t.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),e!=n);r=Ef(r));return t}function YEe({refDOM:e,refTop:t,stack:n}){let r=e?e.getBoundingClientRect().top:0;$$(n,r==0?0:r-t)}function $$(e,t){for(let n=0;n<e.length;n++){let{dom:r,top:s,left:o}=e[n];r.scrollTop!=s+t&&(r.scrollTop=s+t),r.scrollLeft!=o&&(r.scrollLeft=o)}}let bd=null;function WEe(e){if(e.setActive)return e.setActive();if(bd)return e.focus(bd);let t=F$(e);e.focus(bd==null?{get preventScroll(){return bd={preventScroll:!0},!0}}:void 0),bd||(bd=!1,$$(t,0))}function U$(e,t){let n,r=2e8,s,o=0,l=t.top,c=t.top,u,f;for(let h=e.firstChild,p=0;h;h=h.nextSibling,p++){let y;if(et(h))y=h.getClientRects();else if(Jn(h))y=Hi(h).getClientRects();else continue;for(let x=0;x<y.length;x++){let b=y[x];if(b.top<=l&&b.bottom>=c){l=Math.max(b.bottom,l),c=Math.min(b.top,c);let S=b.left>t.left?b.left-t.left:b.right<t.left?t.left-b.right:0;if(S<r){n=h,r=S,s=S&&Jn(n)?{left:b.right<t.left?b.right:b.left,top:t.top}:t,et(h)&&S&&(o=p+(t.left>=(b.left+b.right)/2?1:0));continue}}else b.top>t.top&&!u&&b.left<=t.left&&b.right>=t.left&&(u=h,f={left:Math.max(b.left,Math.min(b.right,t.left)),top:b.top});!n&&(t.left>=b.right&&t.top>=b.top||t.left>=b.left&&t.top>=b.bottom)&&(o=p+1)}}return!n&&u&&(n=u,s=f,r=0),n&&Jn(n)?XEe(n,s):!n||r?{node:e,offset:o}:U$(n,s)}function XEe(e,t){let n=e.nodeValue.length,r=document.createRange(),s;for(let o=0;o<n;o++){r.setEnd(e,o+1),r.setStart(e,o);let l=la(r,1);if(l.top!=l.bottom&&RN(t,l)){s={node:e,offset:o+(t.left>=(l.left+l.right)/2?1:0)};break}}return r.detach(),s||{node:e,offset:0}}function RN(e,t){return e.left>=t.left-1&&e.left<=t.right+1&&e.top>=t.top-1&&e.top<=t.bottom+1}function QEe(e,t){let n=e.parentNode;return n&&/^li$/i.test(n.nodeName)&&t.left<e.getBoundingClientRect().left?n:e}function ZEe(e,t,n){let{node:r,offset:s}=U$(t,n),o=-1;if(et(r)&&!r.firstChild){let l=r.getBoundingClientRect();o=l.left!=l.right&&n.left>(l.left+l.right)/2?1:-1}return e.docView.posFromDOM(r,s,o)}function JEe(e,t,n,r){let s=-1;for(let o=t,l=!1;o!=e.dom;){let c=e.docView.nearestDesc(o,!0),u;if(!c)return null;if(et(c.dom)&&(c.node.isBlock&&c.parent||!c.contentDOM)&&((u=c.dom.getBoundingClientRect()).width||u.height)&&(c.node.isBlock&&c.parent&&!/^T(R|BODY|HEAD|FOOT)$/.test(c.dom.nodeName)&&(!l&&u.left>r.left||u.top>r.top?s=c.posBefore:(!l&&u.right<r.left||u.bottom<r.top)&&(s=c.posAfter),l=!0),!c.contentDOM&&s<0&&!c.node.isText))return(c.node.isBlock?r.top<(u.top+u.bottom)/2:r.left<(u.left+u.right)/2)?c.posBefore:c.posAfter;o=c.dom.parentNode}return s>-1?s:e.docView.posFromDOM(t,n,-1)}function V$(e,t,n){let r=e.childNodes.length;if(r&&n.top<n.bottom)for(let s=Math.max(0,Math.min(r-1,Math.floor(r*(t.top-n.top)/(n.bottom-n.top))-2)),o=s;;){let l=e.childNodes[o];if(et(l)){let c=l.getClientRects();for(let u=0;u<c.length;u++){let f=c[u];if(RN(t,f))return V$(l,t,f)}}if((o=(o+1)%r)==s)break}return e}function eCe(e,t){let n=e.dom.ownerDocument,r,s=0,o=UEe(n,t.left,t.top);o&&({node:r,offset:s}=o);let l=(e.root.elementFromPoint?e.root:n).elementFromPoint(t.left,t.top),c;if(!l||!e.dom.contains(l)){let f=e.dom.getBoundingClientRect();if(!RN(t,f)||(l=V$(e.dom,t,f),!l))return null}if(Br)for(let f=l;r&&f;f=Ef(f))f.draggable&&(r=void 0);if(l=QEe(l,t),r){if(Fs&&et(r)&&(s=Math.min(s,r.childNodes.length),s<r.childNodes.length)){let h=r.childNodes[s],p;h.nodeName=="IMG"&&(p=h.getBoundingClientRect()).right<=t.left&&p.bottom>t.top&&s++}let f;Fb&&s&&et(r)&&et(f=r.childNodes[s-1])&&f.contentEditable=="false"&&f.getBoundingClientRect().top>=t.top&&s--,r==e.dom&&s==r.childNodes.length-1&&et(r.lastChild)&&t.top>r.lastChild.getBoundingClientRect().bottom?c=e.state.doc.content.size:(s==0||!et(r)||r.childNodes[s-1].nodeName!="BR")&&(c=JEe(e,r,s,t))}c==null&&(c=ZEe(e,l,t));let u=e.docView.nearestDesc(l,!0);return{pos:c,inside:u?u.posAtStart-u.border:-1}}function jC(e){return e.top<e.bottom||e.left<e.right}function la(e,t){let n=e.getClientRects();if(n.length){let r=n[t<0?0:n.length-1];if(jC(r))return r}return Array.prototype.find.call(n,jC)||e.getBoundingClientRect()}const tCe=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function q$(e,t,n){let{node:r,offset:s,atom:o}=e.docView.domFromPos(t,n<0?-1:1),l=Fb||Fs;if(Jn(r))if(l&&(tCe.test(r.nodeValue)||(n<0?!s:s==r.nodeValue.length))){let u=la(Hi(r,s,s),n);if(Fs&&s&&/\s/.test(r.nodeValue[s-1])&&s<r.nodeValue.length){let f=la(Hi(r,s-1,s-1),-1);if(f.top==u.top){let h=la(Hi(r,s,s+1),-1);if(h.top!=u.top)return $h(h,h.left<f.left)}}return u}else{let u=s,f=s,h=n<0?1:-1;return n<0&&!s?(f++,h=-1):n>=0&&s==r.nodeValue.length?(u--,h=1):n<0?u--:f++,$h(la(Hi(r,u,f),h),h<0)}if(!e.state.doc.resolve(t-(o||0)).parent.inlineContent){if(o==null&&s&&(n<0||s==Pr(r))){let u=r.childNodes[s-1];if(et(u))return Sw(u.getBoundingClientRect(),!1)}if(o==null&&s<Pr(r)){let u=r.childNodes[s];if(et(u))return Sw(u.getBoundingClientRect(),!0)}return Sw(r.getBoundingClientRect(),n>=0)}if(o==null&&s&&(n<0||s==Pr(r))){let u=r.childNodes[s-1],f=Jn(u)?Hi(u,Pr(u)-(l?0:1)):et(u)&&(u.nodeName!="BR"||!u.nextSibling)?u:null;if(f)return $h(la(f,1),!1)}if(o==null&&s<Pr(r)){let u=r.childNodes[s];for(;u.pmViewDesc&&u.pmViewDesc.ignoreForCoords;)u=u.nextSibling;let f=u?Jn(u)?Hi(u,0,l?0:1):et(u)?u:null:null;if(f)return $h(la(f,-1),!0)}return $h(la(Jn(r)?Hi(r):r,-n),n>=0)}function $h(e,t){if(e.width==0)return e;let n=t?e.left:e.right;return{top:e.top,bottom:e.bottom,left:n,right:n}}function Sw(e,t){if(e.height==0)return e;let n=t?e.top:e.bottom;return{top:n,bottom:n,left:e.left,right:e.right}}function G$(e,t,n){let r=e.state,s=e.root.activeElement;r!=t&&e.updateState(t),s!=e.dom&&e.focus();try{return n()}finally{r!=t&&e.updateState(r),s!=e.dom&&s&&s.focus()}}function nCe(e,t,n){let r=t.selection,s=n=="up"?r.$from:r.$to;return G$(e,t,()=>{let{node:o}=e.docView.domFromPos(s.pos,n=="up"?-1:1);for(;;){let c=e.docView.nearestDesc(o,!0);if(!c)break;if(c.node.isBlock){o=c.contentDOM||c.dom;break}o=c.dom.parentNode}let l=q$(e,s.pos,1);for(let c=o.firstChild;c;c=c.nextSibling){let u;if(et(c))u=c.getClientRects();else if(Jn(c))u=Hi(c,0,c.nodeValue.length).getClientRects();else continue;for(let f=0;f<u.length;f++){let h=u[f];if(h.bottom>h.top+1&&(n=="up"?l.top-h.top>(h.bottom-l.top)*2:h.bottom-l.bottom>(l.bottom-h.top)*2))return!1}}return!0})}const rCe=/[\u0590-\u08ac]/;function sCe(e,t,n){let{$head:r}=t.selection;if(!r.parent.isTextblock)return!1;let s=r.parentOffset,o=!s,l=s==r.parent.content.size,c=e.domSelection();return c?!rCe.test(r.parent.textContent)||!c.modify?n=="left"||n=="backward"?o:l:G$(e,t,()=>{let{focusNode:u,focusOffset:f,anchorNode:h,anchorOffset:p}=e.domSelectionRange(),y=c.caretBidiLevel;c.modify("move",n,"character");let x=r.depth?e.docView.domAfterPos(r.before()):e.dom,{focusNode:b,focusOffset:S}=e.domSelectionRange(),E=b&&!yu(x,b)||u==b&&f==S;try{c.collapse(h,p),u&&(u!=h||f!=p)&&c.extend&&c.extend(u,f)}catch{}return y!=null&&(c.caretBidiLevel=y),E}):r.pos==r.start()||r.pos==r.end()}let fj=null,hj=null,pj=!1;function oCe(e,t,n){return fj==t&&hj==n?pj:(fj=t,hj=n,pj=n=="up"||n=="down"?nCe(e,t,n):sCe(e,t,n))}const lo=0,mj=1,zc=2,Ao=3;class Ym{constructor(t,n,r,s){this.parent=t,this.children=n,this.dom=r,this.contentDOM=s,this.dirty=lo,r.pmViewDesc=this}matchesWidget(t){return!1}matchesMark(t){return!1}matchesNode(t,n,r){return!1}matchesHack(t){return!1}parseRule(t){return null}stopEvent(t){return!1}get size(){let t=0;for(let n=0;n<this.children.length;n++)t+=this.children[n].size;return t}get border(){return 0}destroy(){this.parent=void 0,this.dom.pmViewDesc==this&&(this.dom.pmViewDesc=void 0);for(let t=0;t<this.children.length;t++)this.children[t].destroy()}posBeforeChild(t){for(let n=0,r=this.posAtStart;;n++){let s=this.children[n];if(s==t)return r;r+=s.size}}get posBefore(){return this.parent.posBeforeChild(this)}get posAtStart(){return this.parent?this.parent.posBeforeChild(this)+this.border:0}get posAfter(){return this.posBefore+this.size}get posAtEnd(){return this.posAtStart+this.size-2*this.border}localPosFromDOM(t,n,r){if(this.contentDOM&&yu(this.contentDOM,t))if(r<0){let o,l;if(t==this.contentDOM)o=t.childNodes[n-1];else{for(;t.parentNode!=this.contentDOM;)t=t.parentNode;o=t.previousSibling}for(;o&&!((l=o.pmViewDesc)&&l.parent==this);)o=o.previousSibling;return o?this.posBeforeChild(l)+l.size:this.posAtStart}else{let o,l;if(t==this.contentDOM)o=t.childNodes[n];else{for(;t.parentNode!=this.contentDOM;)t=t.parentNode;o=t.nextSibling}for(;o&&!((l=o.pmViewDesc)&&l.parent==this);)o=o.nextSibling;return o?this.posBeforeChild(l):this.posAtEnd}let s;if(t==this.dom&&this.contentDOM)s=n>Er(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))s=!!(t.compareDocumentPosition(this.contentDOM)&4);else if(this.dom.firstChild){if(n==0)for(let o=t;;o=o.parentNode){if(o==this.dom){s=!1;break}if(o.previousSibling)break}if(s==null&&n==t.childNodes.length)for(let o=t;;o=o.parentNode){if(o==this.dom){s=!0;break}if(o.nextSibling)break}}return s??r>0?this.posAtEnd:this.posAtStart}nearestDesc(t,n=!1){for(let r=!0,s=t;s;s=s.parentNode){let o=this.getDesc(s),l;if(o&&(!n||o.node))if(r&&(l=o.nodeDOM)&&!(et(l)?yu(l,t):l==t))r=!1;else return o}}getDesc(t){let n=t.pmViewDesc;for(let r=n;r;r=r.parent)if(r==this)return n}posFromDOM(t,n,r){for(let s=t;s;s=s.parentNode){let o=this.getDesc(s);if(o)return o.localPosFromDOM(t,n,r)}return-1}descAt(t){for(let n=0,r=0;n<this.children.length;n++){let s=this.children[n],o=r+s.size;if(r==t&&o!=r){for(;!s.border&&s.children.length;)for(let l=0;l<s.children.length;l++){let c=s.children[l];if(c.size){s=c;break}}return s}if(t<o)return s.descAt(t-r-s.border);r=o}}domFromPos(t,n){if(!this.contentDOM)return{node:this.dom,offset:0,atom:t+1};let r=0,s=0;for(let o=0;r<this.children.length;r++){let l=this.children[r],c=o+l.size;if(c>t){s=t-o;break}o=c}if(s)return this.children[r].domFromPos(s-this.children[r].border,n);for(;r>0;r--){let o=this.children[r-1];if(o.size||!(o instanceof Y$||o instanceof K$&&o.side>=0))break}if(n<=0){let o,l=!0;for(;o=r?this.children[r-1]:null,!(!o||o.dom.parentNode==this.contentDOM);r--,l=!1);return o&&n&&l&&!o.border&&!o.domAtom?o.domFromPos(o.size,n):{node:this.contentDOM,offset:o?Er(o.dom)+1:0}}else{let o,l=!0;for(;o=r<this.children.length?this.children[r]:null,!(!o||o.dom.parentNode==this.contentDOM);r++,l=!1);return o&&l&&!o.border&&!o.domAtom?o.domFromPos(0,n):{node:this.contentDOM,offset:o?Er(o.dom):this.contentDOM.childNodes.length}}}parseRange(t,n,r=0){if(this.children.length==0)return{node:this.contentDOM,from:t,to:n,fromOffset:0,toOffset:this.contentDOM.childNodes.length};let s=-1,o=-1;for(let l=r,c=0;;c++){let u=this.children[c],f=l+u.size;if(s==-1&&t<=f){let h=l+u.border;if(t>=h&&n<=f-u.border&&u.node&&u.contentDOM&&this.contentDOM.contains(u.contentDOM))return u.parseRange(t,n,h);t=l;for(let p=c;p>0;p--){let y=this.children[p-1];if(y.size&&y.dom.parentNode==this.contentDOM&&!y.emptyChildAt(1)){s=Er(y.dom)+1;break}t-=y.size}s==-1&&(s=0)}if(s>-1&&(f>n||c==this.children.length-1)){n=f;for(let h=c+1;h<this.children.length;h++){let p=this.children[h];if(p.size&&p.dom.parentNode==this.contentDOM&&!p.emptyChildAt(-1)){o=Er(p.dom);break}n+=p.size}o==-1&&(o=this.contentDOM.childNodes.length);break}l=f}return{node:this.contentDOM,from:t,to:n,fromOffset:s,toOffset:o}}emptyChildAt(t){if(this.border||!this.contentDOM||!this.children.length)return!1;let n=this.children[t<0?0:this.children.length-1];return n.size==0||n.emptyChildAt(t)}domAfterPos(t){let{node:n,offset:r}=this.domFromPos(t,0);if(!et(n)||r==n.childNodes.length)throw new RangeError("No node after pos "+t);return n.childNodes[r]}setSelection(t,n,r,s=!1){let o=Math.min(t,n),l=Math.max(t,n);for(let x=0,b=0;x<this.children.length;x++){let S=this.children[x],E=b+S.size;if(o>b&&l<E)return S.setSelection(t-b-S.border,n-b-S.border,r,s);b=E}let c=this.domFromPos(t,t?-1:1),u=n==t?c:this.domFromPos(n,n?-1:1),f=r.root.getSelection(),h=r.domSelectionRange(),p=!1;if((Fs||Br)&&t==n){let{node:x,offset:b}=c;if(Jn(x)){if(p=!!(b&&x.nodeValue[b-1]==`
|
|
363
|
+
`),p&&b==x.nodeValue.length)for(let S=x,E;S;S=S.parentNode){if(E=S.nextSibling){E.nodeName=="BR"&&(c=u={node:E.parentNode,offset:Er(E)+1});break}let C=S.pmViewDesc;if(C&&C.node&&C.node.isBlock)break}}else{let S=x.childNodes[b-1];p=S&&(S.nodeName=="BR"||S.contentEditable=="false")}}if(Fs&&h.focusNode&&h.focusNode!=u.node&&et(h.focusNode)){let x=h.focusNode.childNodes[h.focusOffset];x&&x.contentEditable=="false"&&(s=!0)}if(!(s||p&&Br)&&gu(c.node,c.offset,h.anchorNode,h.anchorOffset)&&gu(u.node,u.offset,h.focusNode,h.focusOffset))return;let y=!1;if((f.extend||t==n)&&!(p&&Fs)){f.collapse(c.node,c.offset);try{t!=n&&f.extend(u.node,u.offset),y=!0}catch{}}if(!y){if(t>n){let b=c;c=u,u=b}let x=document.createRange();x.setEnd(u.node,u.offset),x.setStart(c.node,c.offset),f.removeAllRanges(),f.addRange(x)}}ignoreMutation(t){return!this.contentDOM&&t.type!="selection"}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(t,n){for(let r=0,s=0;s<this.children.length;s++){let o=this.children[s],l=r+o.size;if(r==l?t<=l&&n>=r:t<l&&n>r){let c=r+o.border,u=l-o.border;if(t>=c&&n<=u){this.dirty=t==r||n==l?zc:mj,t==c&&n==u&&(o.contentLost||o.dom.parentNode!=this.contentDOM)?o.dirty=Ao:o.markDirty(t-c,n-c);return}else o.dirty=o.dom==o.contentDOM&&o.dom.parentNode==this.contentDOM&&!o.children.length?zc:Ao}r=l}this.dirty=zc}markParentsDirty(){let t=1;for(let n=this.parent;n;n=n.parent,t++){let r=t==1?zc:mj;n.dirty<r&&(n.dirty=r)}}get domAtom(){return!1}get ignoreForCoords(){return!1}get ignoreForSelection(){return!1}isText(t){return!1}}class K$ extends Ym{constructor(t,n,r,s){let o,l=n.type.toDOM;if(typeof l=="function"&&(l=l(r,()=>{if(!o)return s;if(o.parent)return o.parent.posBeforeChild(o)})),!n.type.spec.raw){let c=et(l)?l:document.createElement("span");c!=l&&c.appendChild(l),c.hasAttribute("contenteditable")||(c.contentEditable="false"),c.classList.add("ProseMirror-widget")}super(t,[],l,null),this.widget=n,this.widget=n,o=this}matchesWidget(t){return this.dirty==lo&&t.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(t){let n=this.widget.spec.stopEvent;return n?n(t):!1}ignoreMutation(t){return t.type!="selection"||this.widget.spec.ignoreSelection}destroy(){this.widget.type.destroy(this.dom),super.destroy()}get domAtom(){return!0}get ignoreForSelection(){return!!this.widget.type.spec.relaxedSide}get side(){return this.widget.type.side}}class iCe extends Ym{constructor(t,n,r,s){super(t,[],n,null),this.textDOM=r,this.text=s}get size(){return this.text.length}localPosFromDOM(t,n){return t!=this.textDOM?this.posAtStart+(n?this.size:0):this.posAtStart+n}domFromPos(t){return{node:this.textDOM,offset:t}}ignoreMutation(t){return t.type==="characterData"&&t.target.nodeValue==t.oldValue}}class Ma extends Ym{constructor(t,n,r,s,o){super(t,[],r,s),this.mark=n,this.spec=o}static create(t,n,r,s){let o=s.nodeViews[n.type.name],l=o&&o(n,s,r);return(!l||!l.dom)&&(l=Au.renderSpec(document,n.type.spec.toDOM(n,r),null,n.attrs)),new Ma(t,n,l.dom,l.contentDOM||l.dom,l)}parseRule(){return this.dirty&Ao||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(t){return this.dirty!=Ao&&this.mark.eq(t)}markDirty(t,n){if(super.markDirty(t,n),this.dirty!=lo){let r=this.parent;for(;!r.node;)r=r.parent;r.dirty<this.dirty&&(r.dirty=this.dirty),this.dirty=lo}}slice(t,n,r){let s=Ma.create(this.parent,this.mark,!0,r),o=this.children,l=this.size;n<l&&(o=zC(o,n,l,r)),t>0&&(o=zC(o,0,t,r));for(let c=0;c<o.length;c++)o[c].parent=s;return s.children=o,s}ignoreMutation(t){return this.spec.ignoreMutation?this.spec.ignoreMutation(t):super.ignoreMutation(t)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}}class Ia extends Ym{constructor(t,n,r,s,o,l,c){super(t,[],o,l),this.node=n,this.outerDeco=r,this.innerDeco=s,this.nodeDOM=c}static create(t,n,r,s,o,l){let c=o.nodeViews[n.type.name],u,f=c&&c(n,o,()=>{if(!u)return l;if(u.parent)return u.parent.posBeforeChild(u)},r,s),h=f&&f.dom,p=f&&f.contentDOM;if(n.isText){if(!h)h=document.createTextNode(n.text);else if(!Jn(h))throw new RangeError("Text must be rendered as a DOM text node")}else h||({dom:h,contentDOM:p}=Au.renderSpec(document,n.type.spec.toDOM(n),null,n.attrs));!p&&!n.isText&&h.nodeName!="BR"&&(h.hasAttribute("contenteditable")||(h.contentEditable="false"),n.type.spec.draggable&&(h.draggable=!0));let y=h;return h=Q$(h,r,n),f?u=new lCe(t,n,r,s,h,p||null,y,f):n.isText?new $b(t,n,r,s,h,y):new Ia(t,n,r,s,h,p||null,y)}parseRule(t){if(this.node.type.spec.reparseInView)return null;let n={node:this.node.type.name,attrs:this.node.attrs};if(this.node.type.whitespace=="pre"&&(n.preserveWhitespace="full"),!this.contentDOM)n.getContent=()=>this.node.content;else if(!this.contentLost)n.contentElement=this.contentDOM;else{for(let r=this.children.length-1;r>=0;r--){let s=this.children[r];if(this.dom.contains(s.dom.parentNode)){n.contentElement=s.dom.parentNode;break}}if(!n.contentElement){let r=t&&t.find(s=>et(s)&&t.indexOf(s.parentNode)<0&&this.dom.contains(s));r?n.contentElement=r:n.getContent=()=>Ie.empty}}return n}matchesNode(t,n,r){return this.dirty==lo&&t.eq(this.node)&&Ex(n,this.outerDeco)&&r.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return this.node.isLeaf?0:1}updateChildren(t,n){let r=this.node.inlineContent,s=n,o=t.composing?this.localCompositionInfo(t,n):null,l=o&&o.pos>-1?o:null,c=o&&o.pos<0,u=new cCe(this,l&&l.node,t),f=this.node.inlineContent,h=f&&this.node.isBlock;fCe(this.node,this.innerDeco,(p,y,x)=>{p.spec.marks?u.syncToMarks(p.spec.marks,r,t,y):p.type.side>=0&&!x&&u.syncToMarks(y==this.node.childCount?tn.none:this.node.child(y).marks,r,t,y),u.placeWidget(p,t,s)},(p,y,x,b)=>{u.syncToMarks(p.marks,r,t,b),h&&p.isAtom&&!p.isText&&u.addHackNode("IMG",u.top);let S;u.findNodeMatch(p,y,x,b)||c&&t.state.selection.from>s&&t.state.selection.to<s+p.nodeSize&&(S=u.findIndexWithChild(o.node))>-1&&u.updateNodeAt(p,y,x,S,t)||u.updateNextNode(p,y,x,t,b,s)||u.addNode(p,y,x,t,s),s+=p.nodeSize,f&&(h=p.isAtom&&!p.isText)}),u.syncToMarks([],r,t,0),this.node.isTextblock&&u.addTextblockHacks(),u.destroyRest(),(u.changed||this.dirty==zc)&&(l&&this.protectLocalComposition(t,l),W$(this.contentDOM,this.children,t),Cf&&hCe(this.dom))}localCompositionInfo(t,n){let{from:r,to:s}=t.state.selection;if(!(t.state.selection instanceof ft)||r<n||s>n+this.node.content.size)return null;let o=t.input.compositionNode;if(!o||!this.dom.contains(o.parentNode))return null;if(this.node.inlineContent){let l=o.nodeValue,c=pCe(this.node.content,l,r-n,s-n);return c<0?null:{node:o,pos:c,text:l}}else return{node:o,pos:-1,text:""}}protectLocalComposition(t,{node:n,pos:r,text:s}){if(this.getDesc(n))return;let o=n;for(;o.parentNode!=this.contentDOM;o=o.parentNode){for(;o.previousSibling;)o.parentNode.removeChild(o.previousSibling);for(;o.nextSibling;)o.parentNode.removeChild(o.nextSibling);o.pmViewDesc&&(o.pmViewDesc=void 0)}let l=new iCe(this,o,n,s);t.input.compositionNodes.push(l),this.children=zC(this.children,r,r+s.length,t,l)}update(t,n,r,s){return this.dirty==Ao||!t.sameMarkup(this.node)?!1:(this.updateInner(t,n,r,s),!0)}updateInner(t,n,r,s){this.updateOuterDeco(n),this.node=t,this.innerDeco=r,this.contentDOM&&this.updateChildren(s,this.posAtStart),this.dirty=lo}updateOuterDeco(t){if(Ex(t,this.outerDeco))return;let n=!et(this.nodeDOM),r=this.dom;this.dom=X$(this.dom,this.nodeDOM,PC(this.outerDeco,this.node,n),PC(t,this.node,n)),this.dom!=r&&(r.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=t}selectNode(){et(this.nodeDOM)&&(this.nodeDOM.classList.add("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&(this.nodeDOM.draggable=!0))}deselectNode(){et(this.nodeDOM)&&(this.nodeDOM.classList.remove("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&this.nodeDOM.removeAttribute("draggable"))}get domAtom(){return this.node.isAtom}}function gj(e,t,n,r,s){Q$(r,t,e);let o=new Ia(void 0,e,t,n,r,r,r);return o.contentDOM&&o.updateChildren(s,0),o}class $b extends Ia{constructor(t,n,r,s,o,l){super(t,n,r,s,o,null,l)}parseRule(){let t=this.nodeDOM.parentNode;for(;t&&t!=this.dom&&!t.pmIsDeco;)t=t.parentNode;return{skip:t||!0}}update(t,n,r,s){return this.dirty==Ao||this.dirty!=lo&&!this.inParent()||!t.sameMarkup(this.node)?!1:(this.updateOuterDeco(n),(this.dirty!=lo||t.text!=this.node.text)&&t.text!=this.nodeDOM.nodeValue&&(this.nodeDOM.nodeValue=t.text,s.trackWrites==this.nodeDOM&&(s.trackWrites=null)),this.node=t,this.dirty=lo,!0)}inParent(){let t=this.parent.contentDOM;for(let n=this.nodeDOM;n;n=n.parentNode)if(n==t)return!0;return!1}domFromPos(t){return{node:this.nodeDOM,offset:t}}localPosFromDOM(t,n,r){return t==this.nodeDOM?this.posAtStart+Math.min(n,this.node.text.length):super.localPosFromDOM(t,n,r)}ignoreMutation(t){return t.type!="characterData"&&t.type!="selection"}slice(t,n,r){let s=this.node.cut(t,n),o=document.createTextNode(s.text);return new $b(this.parent,s,this.outerDeco,this.innerDeco,o,o)}markDirty(t,n){super.markDirty(t,n),this.dom!=this.nodeDOM&&(t==0||n==this.nodeDOM.nodeValue.length)&&(this.dirty=Ao)}get domAtom(){return!1}isText(t){return this.node.text==t}}class Y$ extends Ym{parseRule(){return{ignore:!0}}matchesHack(t){return this.dirty==lo&&this.dom.nodeName==t}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class lCe extends Ia{constructor(t,n,r,s,o,l,c,u){super(t,n,r,s,o,l,c),this.spec=u}update(t,n,r,s){if(this.dirty==Ao)return!1;if(this.spec.update&&(this.node.type==t.type||this.spec.multiType)){let o=this.spec.update(t,n,r);return o&&this.updateInner(t,n,r,s),o}else return!this.contentDOM&&!t.isLeaf?!1:super.update(t,n,r,s)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(t,n,r,s){this.spec.setSelection?this.spec.setSelection(t,n,r.root):super.setSelection(t,n,r,s)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}stopEvent(t){return this.spec.stopEvent?this.spec.stopEvent(t):!1}ignoreMutation(t){return this.spec.ignoreMutation?this.spec.ignoreMutation(t):super.ignoreMutation(t)}}function W$(e,t,n){let r=e.firstChild,s=!1;for(let o=0;o<t.length;o++){let l=t[o],c=l.dom;if(c.parentNode==e){for(;c!=r;)r=yj(r),s=!0;r=r.nextSibling}else s=!0,e.insertBefore(c,r);if(l instanceof Ma){let u=r?r.previousSibling:e.lastChild;W$(l.contentDOM,l.children,n),r=u?u.nextSibling:e.firstChild}}for(;r;)r=yj(r),s=!0;s&&n.trackWrites==e&&(n.trackWrites=null)}const gp=function(e){e&&(this.nodeName=e)};gp.prototype=Object.create(null);const Bc=[new gp];function PC(e,t,n){if(e.length==0)return Bc;let r=n?Bc[0]:new gp,s=[r];for(let o=0;o<e.length;o++){let l=e[o].type.attrs;if(l){l.nodeName&&s.push(r=new gp(l.nodeName));for(let c in l){let u=l[c];u!=null&&(n&&s.length==1&&s.push(r=new gp(t.isInline?"span":"div")),c=="class"?r.class=(r.class?r.class+" ":"")+u:c=="style"?r.style=(r.style?r.style+";":"")+u:c!="nodeName"&&(r[c]=u))}}}return s}function X$(e,t,n,r){if(n==Bc&&r==Bc)return t;let s=t;for(let o=0;o<r.length;o++){let l=r[o],c=n[o];if(o){let u;c&&c.nodeName==l.nodeName&&s!=e&&(u=s.parentNode)&&u.nodeName.toLowerCase()==l.nodeName||(u=document.createElement(l.nodeName),u.pmIsDeco=!0,u.appendChild(s),c=Bc[0]),s=u}aCe(s,c||Bc[0],l)}return s}function aCe(e,t,n){for(let r in t)r!="class"&&r!="style"&&r!="nodeName"&&!(r in n)&&e.removeAttribute(r);for(let r in n)r!="class"&&r!="style"&&r!="nodeName"&&n[r]!=t[r]&&e.setAttribute(r,n[r]);if(t.class!=n.class){let r=t.class?t.class.split(" ").filter(Boolean):[],s=n.class?n.class.split(" ").filter(Boolean):[];for(let o=0;o<r.length;o++)s.indexOf(r[o])==-1&&e.classList.remove(r[o]);for(let o=0;o<s.length;o++)r.indexOf(s[o])==-1&&e.classList.add(s[o]);e.classList.length==0&&e.removeAttribute("class")}if(t.style!=n.style){if(t.style){let r=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g,s;for(;s=r.exec(t.style);)e.style.removeProperty(s[1])}n.style&&(e.style.cssText+=n.style)}}function Q$(e,t,n){return X$(e,e,Bc,PC(t,n,!et(e)))}function Ex(e,t){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!e[n].type.eq(t[n].type))return!1;return!0}function yj(e){let t=e.nextSibling;return e.parentNode.removeChild(e),t}class cCe{constructor(t,n,r){this.lock=n,this.view=r,this.index=0,this.stack=[],this.changed=!1,this.top=t,this.preMatch=uCe(t.node.content,t)}destroyBetween(t,n){if(t!=n){for(let r=t;r<n;r++)this.top.children[r].destroy();this.top.children.splice(t,n-t),this.changed=!0}}destroyRest(){this.destroyBetween(this.index,this.top.children.length)}syncToMarks(t,n,r,s){let o=0,l=this.stack.length>>1,c=Math.min(l,t.length);for(;o<c&&(o==l-1?this.top:this.stack[o+1<<1]).matchesMark(t[o])&&t[o].type.spec.spanning!==!1;)o++;for(;o<l;)this.destroyRest(),this.top.dirty=lo,this.index=this.stack.pop(),this.top=this.stack.pop(),l--;for(;l<t.length;){this.stack.push(this.top,this.index+1);let u=-1,f=this.top.children.length;s<this.preMatch.index&&(f=Math.min(this.index+3,f));for(let h=this.index;h<f;h++){let p=this.top.children[h];if(p.matchesMark(t[l])&&!this.isLocked(p.dom)){u=h;break}}if(u<0&&this.index<this.top.children.length){let h=this.top.children[this.index];h instanceof Ma&&h.dirty!=Ao&&h.mark.type==t[l].type&&h.spec.update&&!this.isLocked(h.dom)&&h.spec.update(t[l])&&(h.mark=t[l],u=this.index,this.changed=!0)}if(u>-1)u>this.index&&(this.changed=!0,this.destroyBetween(this.index,u)),this.top=this.top.children[this.index];else{let h=Ma.create(this.top,t[l],n,r);this.top.children.splice(this.index,0,h),this.top=h,this.changed=!0}this.index=0,l++}}findNodeMatch(t,n,r,s){let o=-1,l;if(s>=this.preMatch.index&&(l=this.preMatch.matches[s-this.preMatch.index]).parent==this.top&&l.matchesNode(t,n,r))o=this.top.children.indexOf(l,this.index);else for(let c=this.index,u=Math.min(this.top.children.length,c+5);c<u;c++){let f=this.top.children[c];if(f.matchesNode(t,n,r)&&!this.preMatch.matched.has(f)){o=c;break}}return o<0?!1:(this.destroyBetween(this.index,o),this.index++,!0)}updateNodeAt(t,n,r,s,o){let l=this.top.children[s];return l.dirty==Ao&&l.dom==l.contentDOM&&(l.dirty=zc),l.update(t,n,r,o)?(this.destroyBetween(this.index,s),this.index++,!0):!1}findIndexWithChild(t){for(;;){let n=t.parentNode;if(!n)return-1;if(n==this.top.contentDOM){let r=t.pmViewDesc;if(r){for(let s=this.index;s<this.top.children.length;s++)if(this.top.children[s]==r)return s}return-1}t=n}}updateNextNode(t,n,r,s,o,l){for(let c=this.index;c<this.top.children.length;c++){let u=this.top.children[c];if(u instanceof Ia){let f=this.preMatch.matched.get(u);if(f!=null&&f!=o)return!1;let h=u.dom,p,y=this.isLocked(h)&&!(t.isText&&u.node&&u.node.isText&&u.nodeDOM.nodeValue==t.text&&u.dirty!=Ao&&Ex(n,u.outerDeco));if(!y&&u.update(t,n,r,s))return this.destroyBetween(this.index,c),u.dom!=h&&(this.changed=!0),this.index++,!0;if(!y&&(p=this.recreateWrapper(u,t,n,r,s,l)))return this.destroyBetween(this.index,c),this.top.children[this.index]=p,p.contentDOM&&(p.dirty=zc,p.updateChildren(s,l+1),p.dirty=lo),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(t,n,r,s,o,l){if(t.dirty||n.isAtom||!t.children.length||!t.node.content.eq(n.content)||!Ex(r,t.outerDeco)||!s.eq(t.innerDeco))return null;let c=Ia.create(this.top,n,r,s,o,l);if(c.contentDOM){c.children=t.children,t.children=[];for(let u of c.children)u.parent=c}return t.destroy(),c}addNode(t,n,r,s,o){let l=Ia.create(this.top,t,n,r,s,o);l.contentDOM&&l.updateChildren(s,o+1),this.top.children.splice(this.index++,0,l),this.changed=!0}placeWidget(t,n,r){let s=this.index<this.top.children.length?this.top.children[this.index]:null;if(s&&s.matchesWidget(t)&&(t==s.widget||!s.widget.type.toDOM.parentNode))this.index++;else{let o=new K$(this.top,t,n,r);this.top.children.splice(this.index++,0,o),this.changed=!0}}addTextblockHacks(){let t=this.top.children[this.index-1],n=this.top;for(;t instanceof Ma;)n=t,t=n.children[n.children.length-1];(!t||!(t instanceof $b)||/\n$/.test(t.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(t.node.text))&&((Br||Tr)&&t&&t.dom.contentEditable=="false"&&this.addHackNode("IMG",n),this.addHackNode("BR",this.top))}addHackNode(t,n){if(n==this.top&&this.index<n.children.length&&n.children[this.index].matchesHack(t))this.index++;else{let r=document.createElement(t);t=="IMG"&&(r.className="ProseMirror-separator",r.alt=""),t=="BR"&&(r.className="ProseMirror-trailingBreak");let s=new Y$(this.top,[],r,null);n!=this.top?n.children.push(s):n.children.splice(this.index++,0,s),this.changed=!0}}isLocked(t){return this.lock&&(t==this.lock||et(t)&&t.contains(this.lock.parentNode))}}function uCe(e,t){let n=t,r=n.children.length,s=e.childCount,o=new Map,l=[];e:for(;s>0;){let c;for(;;)if(r){let f=n.children[r-1];if(f instanceof Ma)n=f,r=f.children.length;else{c=f,r--;break}}else{if(n==t)break e;r=n.parent.children.indexOf(n),n=n.parent}let u=c.node;if(u){if(u!=e.child(s-1))break;--s,o.set(c,s),l.push(c)}}return{index:s,matched:o,matches:l.reverse()}}function dCe(e,t){return e.type.side-t.type.side}function fCe(e,t,n,r){let s=t.locals(e),o=0;if(s.length==0){for(let f=0;f<e.childCount;f++){let h=e.child(f);r(h,s,t.forChild(o,h),f),o+=h.nodeSize}return}let l=0,c=[],u=null;for(let f=0;;){let h,p;for(;l<s.length&&s[l].to==o;){let E=s[l++];E.widget&&(h?(p||(p=[h])).push(E):h=E)}if(h)if(p){p.sort(dCe);for(let E=0;E<p.length;E++)n(p[E],f,!!u)}else n(h,f,!!u);let y,x;if(u)x=-1,y=u,u=null;else if(f<e.childCount)x=f,y=e.child(f++);else break;for(let E=0;E<c.length;E++)c[E].to<=o&&c.splice(E--,1);for(;l<s.length&&s[l].from<=o&&s[l].to>o;)c.push(s[l++]);let b=o+y.nodeSize;if(y.isText){let E=b;l<s.length&&s[l].from<E&&(E=s[l].from);for(let C=0;C<c.length;C++)c[C].to<E&&(E=c[C].to);E<b&&(u=y.cut(E-o),y=y.cut(0,E-o),b=E,x=-1)}else for(;l<s.length&&s[l].to<b;)l++;let S=y.isInline&&!y.isLeaf?c.filter(E=>!E.inline):c.slice();r(y,S,t.forChild(o,y),x),o=b}}function hCe(e){if(e.nodeName=="UL"||e.nodeName=="OL"){let t=e.style.cssText;e.style.cssText=t+"; list-style: square !important",window.getComputedStyle(e).listStyle,e.style.cssText=t}}function pCe(e,t,n,r){for(let s=0,o=0;s<e.childCount&&o<=r;){let l=e.child(s++),c=o;if(o+=l.nodeSize,!l.isText)continue;let u=l.text;for(;s<e.childCount;){let f=e.child(s++);if(o+=f.nodeSize,!f.isText)break;u+=f.text}if(o>=n){if(o>=r&&u.slice(r-t.length-c,r-c)==t)return r-t.length;let f=c<r?u.lastIndexOf(t,r-c-1):-1;if(f>=0&&f+t.length+c>=n)return c+f;if(n==r&&u.length>=r+t.length-c&&u.slice(r-c,r-c+t.length)==t)return r}}return-1}function zC(e,t,n,r,s){let o=[];for(let l=0,c=0;l<e.length;l++){let u=e[l],f=c,h=c+=u.size;f>=n||h<=t?o.push(u):(f<t&&o.push(u.slice(0,t-f,r)),s&&(o.push(s),s=void 0),h>n&&o.push(u.slice(n-f,u.size,r)))}return o}function AN(e,t=null){let n=e.domSelectionRange(),r=e.state.doc;if(!n.focusNode)return null;let s=e.docView.nearestDesc(n.focusNode),o=s&&s.size==0,l=e.docView.posFromDOM(n.focusNode,n.focusOffset,1);if(l<0)return null;let c=r.resolve(l),u,f;if(Hb(n)){for(u=l;s&&!s.node;)s=s.parent;if(s&&s.node.isAtom&&nt.isSelectable(s.node)&&s.parent&&!(s.node.isInline&&FEe(n.focusNode,n.focusOffset,s.dom))){let p=s.posBefore;f=new nt(l==p?c:r.resolve(p))}else if(Fs&&t=="key"&&l>e.state.selection.to&&et(n.focusNode)&&n.focusOffset==n.focusNode.childNodes.length&&s&&s.posAtStart>e.state.selection.to)for(let p=n.focusNode;;p=p.parentNode){if(getComputedStyle(p).overflow!="visible"){f=Rt.findFrom(r.resolve(s.posAtStart),1);break}if(p==s.dom||p.nextSibling||!p.parentNode||!et(p.parentNode))break}}else{if(n instanceof e.dom.ownerDocument.defaultView.Selection&&n.rangeCount>1){let p=l,y=l;for(let x=0;x<n.rangeCount;x++){let b=n.getRangeAt(x);p=Math.min(p,e.docView.posFromDOM(b.startContainer,b.startOffset,1)),y=Math.max(y,e.docView.posFromDOM(b.endContainer,b.endOffset,-1))}if(p<0)return null;[u,l]=y==e.state.selection.anchor?[y,p]:[p,y],c=r.resolve(l)}else u=e.docView.posFromDOM(n.anchorNode,n.anchorOffset,1);if(u<0)return null}let h=r.resolve(u);if(!f){let p=t=="pointer"||e.state.selection.head<c.pos&&!o?1:-1;f=kN(e,h,c,p)}return f}function Z$(e){return e.editable?e.hasFocus():e7(e)&&document.activeElement&&document.activeElement.contains(e.dom)}function il(e,t=!1){let n=e.state.selection;if(J$(e,n),!Z$(e))return;let r=e.input.mouseDown;if(!t&&Tr&&r){let s=e.domSelectionRange(),o=e.domObserver.currentSelection;if(s.anchorNode&&o.anchorNode&&gu(s.anchorNode,s.anchorOffset,o.anchorNode,o.anchorOffset)&&r.delaySelUpdate()){e.domObserver.setCurSelection();return}}if(e.domObserver.disconnectSelection(),e.cursorWrapper)gCe(e);else{let{anchor:s,head:o}=n,l,c;xj&&!(n instanceof ft)&&(n.$from.parent.inlineContent||(l=bj(e,n.from)),!n.empty&&!n.$from.parent.inlineContent&&(c=bj(e,n.to))),e.docView.setSelection(s,o,e,t),xj&&(l&&vj(l),c&&vj(c)),n.visible?e.dom.classList.remove("ProseMirror-hideselection"):(e.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&mCe(e))}e.domObserver.setCurSelection(),e.domObserver.connectSelection()}const xj=Br||Tr&&B$<63;function bj(e,t){let{node:n,offset:r}=e.docView.domFromPos(t,0),s=r<n.childNodes.length?n.childNodes[r]:null,o=r?n.childNodes[r-1]:null;if(Br&&s&&s.contentEditable=="false")return ww(s);if((!s||s.contentEditable=="false")&&(!o||o.contentEditable=="false")){if(s)return ww(s);if(o)return ww(o)}}function ww(e){return e.contentEditable="true",Br&&e.draggable&&(e.draggable=!1,e.wasDraggable=!0),e}function vj(e){e.contentEditable="false",e.wasDraggable&&(e.draggable=!0,e.wasDraggable=null)}function mCe(e){let t=e.dom.ownerDocument;t.removeEventListener("selectionchange",e.input.hideSelectionGuard);let n=e.domSelectionRange(),r=n.anchorNode,s=n.anchorOffset;t.addEventListener("selectionchange",e.input.hideSelectionGuard=()=>{(n.anchorNode!=r||n.anchorOffset!=s)&&(t.removeEventListener("selectionchange",e.input.hideSelectionGuard),setTimeout(()=>{(!Z$(e)||e.state.selection.visible)&&e.dom.classList.remove("ProseMirror-hideselection")},20))})}function gCe(e){let t=e.domSelection();if(!t)return;let n=e.cursorWrapper.dom,r=n.nodeName=="IMG";r?t.collapse(n.parentNode,Er(n)+1):t.collapse(n,0),!r&&!e.state.selection.visible&&Ss&&_a<=11&&(n.disabled=!0,n.disabled=!1)}function J$(e,t){if(t instanceof nt){let n=e.docView.descAt(t.from);n!=e.lastSelectedViewDesc&&(Sj(e),n&&n.selectNode(),e.lastSelectedViewDesc=n)}else Sj(e)}function Sj(e){e.lastSelectedViewDesc&&(e.lastSelectedViewDesc.parent&&e.lastSelectedViewDesc.deselectNode(),e.lastSelectedViewDesc=void 0)}function kN(e,t,n,r){return e.someProp("createSelectionBetween",s=>s(e,t,n))||ft.between(t,n,r)}function wj(e){return e.editable&&!e.hasFocus()?!1:e7(e)}function e7(e){let t=e.domSelectionRange();if(!t.anchorNode)return!1;try{return yu(e.dom,t.anchorNode)&&(e.editable||yu(e.dom,t.focusNode))}catch{return!1}}function yCe(e){let t=e.docView.domFromPos(e.state.selection.anchor,0),n=e.domSelectionRange();return gu(t.node,t.offset,n.anchorNode,n.anchorOffset)}function BC(e,t){let{$anchor:n,$head:r}=e.selection,s=t>0?n.max(r):n.min(r),o=s.parent.inlineContent?s.depth?e.doc.resolve(t>0?s.after():s.before()):null:s;return o&&Rt.findFrom(o,t)}function ca(e,t){return e.dispatch(e.state.tr.setSelection(t).scrollIntoView()),!0}function Ej(e,t,n){let r=e.state.selection;if(r instanceof ft)if(n.indexOf("s")>-1){let{$head:s}=r,o=s.textOffset?null:t<0?s.nodeBefore:s.nodeAfter;if(!o||o.isText||!o.isLeaf)return!1;let l=e.state.doc.resolve(s.pos+o.nodeSize*(t<0?-1:1));return ca(e,new ft(r.$anchor,l))}else if(r.empty){if(e.endOfTextblock(t>0?"forward":"backward")){let s=BC(e.state,t);return s&&s instanceof nt?ca(e,s):!1}else if(!(ro&&n.indexOf("m")>-1)){let s=r.$head,o=s.textOffset?null:t<0?s.nodeBefore:s.nodeAfter,l;if(!o||o.isText)return!1;let c=t<0?s.pos-o.nodeSize:s.pos;return o.isAtom||(l=e.docView.descAt(c))&&!l.contentDOM?nt.isSelectable(o)?ca(e,new nt(t<0?e.state.doc.resolve(s.pos-o.nodeSize):s)):ca(e,new ft(e.state.doc.resolve(t<0?c:c+o.nodeSize))):!1}}else return!1;else{if(r instanceof nt&&r.node.isInline)return ca(e,new ft(t>0?r.$to:r.$from));{let s=BC(e.state,t);return s?ca(e,s):!1}}}function yp(e,t){let n=e.pmViewDesc;return n?n.size==0&&(t<0||e.nextSibling||e.nodeName!="BR"):et(e)&&e.contentEditable=="false"}function vd(e,t){return t<0?xCe(e):bCe(e)}function xCe(e){let t=e.domSelectionRange(),n=t.focusNode,r=t.focusOffset;if(!n)return;let s,o,l=!1;for(Fs&&et(n)&&r<Pr(n)&&yp(n.childNodes[r],-1)&&(l=!0);;)if(r>0){if(!et(n))break;let c=n.childNodes[r-1];if(yp(c,-1))s=n,o=--r;else if(Jn(c))n=c,r=n.nodeValue.length;else break}else{if(t7(n))break;{let c=n.previousSibling;for(;c&&yp(c,-1);)s=n.parentNode,o=Er(c),c=c.previousSibling;if(c)n=c,r=Pr(n);else{if(n=n.parentNode,n==e.dom)break;r=0}}}l?HC(e,n,r):s&&HC(e,s,o)}function bCe(e){let t=e.domSelectionRange(),n=t.focusNode,r=t.focusOffset;if(!n)return;let s=Pr(n),o,l;for(;;)if(r<s){if(!et(n))break;let c=n.childNodes[r];if(yp(c,1))o=n,l=++r;else break}else{if(t7(n))break;{let c=n.nextSibling;for(;c&&yp(c,1);)o=c.parentNode,l=Er(c)+1,c=c.nextSibling;if(c)n=c,r=0,s=Pr(n);else{if(n=n.parentNode,n==e.dom)break;r=s=0}}}o&&HC(e,o,l)}function t7(e){let t=e.pmViewDesc;return t&&t.node&&t.node.isBlock}function vCe(e,t){for(;e&&t==e.childNodes.length&&!Km(e);)t=Er(e)+1,e=e.parentNode;for(;e&&t<e.childNodes.length;){let n=e.childNodes[t];if(Jn(n))return n;if(et(n)&&n.contentEditable=="false")break;e=n,t=0}}function SCe(e,t){for(;e&&!t&&!Km(e);)t=Er(e),e=e.parentNode;for(;e&&t;){let n=e.childNodes[t-1];if(Jn(n))return n;if(et(n)&&n.contentEditable=="false")break;e=n,t=e.childNodes.length}}function HC(e,t,n){if(!Jn(t)){let o,l;(l=vCe(t,n))?(t=l,n=0):(o=SCe(t,n))&&(t=o,n=o.nodeValue.length)}let r=e.domSelection();if(!r)return;if(Hb(r)){let o=document.createRange();o.setEnd(t,n),o.setStart(t,n),r.removeAllRanges(),r.addRange(o)}else r.extend&&r.extend(t,n);e.domObserver.setCurSelection();let{state:s}=e;setTimeout(()=>{e.state==s&&il(e)},50)}function Cj(e,t){let n=e.state.doc.resolve(t);if(!(Tr||H$)&&n.parent.inlineContent){let s=e.coordsAtPos(t);if(t>n.start()){let o=e.coordsAtPos(t-1),l=(o.top+o.bottom)/2;if(l>s.top&&l<s.bottom&&Math.abs(o.left-s.left)>1)return o.left<s.left?"ltr":"rtl"}if(t<n.end()){let o=e.coordsAtPos(t+1),l=(o.top+o.bottom)/2;if(l>s.top&&l<s.bottom&&Math.abs(o.left-s.left)>1)return o.left>s.left?"ltr":"rtl"}}return getComputedStyle(e.dom).direction=="rtl"?"rtl":"ltr"}function Tj(e,t,n){let r=e.state.selection;if(r instanceof ft&&!r.empty||n.indexOf("s")>-1||ro&&n.indexOf("m")>-1)return!1;let{$from:s,$to:o}=r;if(!s.parent.inlineContent||e.endOfTextblock(t<0?"up":"down")){let l=BC(e.state,t);if(l&&l instanceof nt)return ca(e,l)}if(!s.parent.inlineContent){let l=t<0?s:o,c=r instanceof Hs?Rt.near(l,t):Rt.findFrom(l,t);return c?ca(e,c):!1}return!1}function Nj(e,t){if(!(e.state.selection instanceof ft))return!0;let{$head:n,$anchor:r,empty:s}=e.state.selection;if(!n.sameParent(r))return!0;if(!s)return!1;if(e.endOfTextblock(t>0?"forward":"backward"))return!0;let o=!n.textOffset&&(t<0?n.nodeBefore:n.nodeAfter);if(o&&!o.isText){let l=e.state.tr;return t<0?l.delete(n.pos-o.nodeSize,n.pos):l.delete(n.pos,n.pos+o.nodeSize),e.dispatch(l),!0}return!1}function Oj(e,t,n){e.domObserver.stop(),t.contentEditable=n,e.domObserver.start()}function wCe(e){if(!Br||e.state.selection.$head.parentOffset>0)return!1;let{focusNode:t,focusOffset:n}=e.domSelectionRange();if(t&&et(t)&&n==0&&t.firstChild&&et(t.firstChild)&&t.firstChild.contentEditable=="false"){let r=t.firstChild;Oj(e,r,"true"),setTimeout(()=>Oj(e,r,"false"),20)}return!1}function ECe(e){let t="";return e.ctrlKey&&(t+="c"),e.metaKey&&(t+="m"),e.altKey&&(t+="a"),e.shiftKey&&(t+="s"),t}function CCe(e,t){let n=t.keyCode,r=ECe(t);if(n==8||ro&&n==72&&r=="c")return Nj(e,-1)||vd(e,-1);if(n==46&&!t.shiftKey||ro&&n==68&&r=="c")return Nj(e,1)||vd(e,1);if(n==13||n==27)return!0;if(n==37||ro&&n==66&&r=="c"){let s=n==37?Cj(e,e.state.selection.from)=="ltr"?-1:1:-1;return Ej(e,s,r)||vd(e,s)}else if(n==39||ro&&n==70&&r=="c"){let s=n==39?Cj(e,e.state.selection.from)=="ltr"?1:-1:1;return Ej(e,s,r)||vd(e,s)}else{if(n==38||ro&&n==80&&r=="c")return Tj(e,-1,r)||vd(e,-1);if(n==40||ro&&n==78&&r=="c")return wCe(e)||Tj(e,1,r)||vd(e,1);if(r==(ro?"m":"c")&&(n==66||n==73||n==89||n==90))return!0}return!1}function _N(e,t){e.someProp("transformCopied",x=>{t=x(t,e)});let n=[],{content:r,openStart:s,openEnd:o}=t;for(;s>1&&o>1&&r.childCount==1&&r.firstChild.childCount==1;){s--,o--;let x=r.firstChild;n.push(x.type.name,x.attrs!=x.type.defaultAttrs?x.attrs:null),r=x.content}let l=e.someProp("clipboardSerializer")||Au.fromSchema(e.state.schema),c=l7(),u=c.createElement("div");u.appendChild(l.serializeFragment(r,{document:c}));let f=u.firstChild,h,p=0;for(;f&&et(f)&&(h=i7[f.nodeName.toLowerCase()]);){for(let x=h.length-1;x>=0;x--){let b=c.createElement(h[x]);for(;u.firstChild;)b.appendChild(u.firstChild);u.appendChild(b),p++}f=u.firstChild}f&&et(f)&&f.setAttribute("data-pm-slice",`${s} ${o}${p?` -${p}`:""} ${JSON.stringify(n)}`);let y=e.someProp("clipboardTextSerializer",x=>x(t,e))||t.content.textBetween(0,t.content.size,`
|
|
364
|
+
|
|
365
|
+
`);return{dom:u,text:y,slice:t}}function n7(e,t,n,r,s){let o=s.parent.type.spec.code,l,c;if(!n&&!t)return null;let u=!!t&&(r||o||!n);if(u){if(e.someProp("transformPastedText",y=>{t=y(t,o||r,e)}),o)return c=new Ue(Ie.from(e.state.schema.text(t.replace(/\r\n?/g,`
|
|
366
|
+
`))),0,0),e.someProp("transformPasted",y=>{c=y(c,e,!0)}),c;let p=e.someProp("clipboardTextParser",y=>y(t,s,r,e));if(p)c=p;else{let y=s.marks(),{schema:x}=e.state,b=Au.fromSchema(x);l=document.createElement("div"),t.split(/(?:\r\n?|\n)+/).forEach(S=>{let E=l.appendChild(document.createElement("p"));S&&E.appendChild(b.serializeNode(x.text(S,y)))})}}else e.someProp("transformPastedHTML",p=>{n=p(n,e)}),l=RCe(n),Fb&&ACe(l);let f=l&&l.querySelector("[data-pm-slice]"),h=f&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(f.getAttribute("data-pm-slice")||"");if(h&&h[3])for(let p=+h[3];p>0;p--){let y=l.firstChild;for(;y&&!et(y);)y=y.nextSibling;if(!y)break;l=y}if(c||(c=(e.someProp("clipboardParser")||e.someProp("domParser")||sl.fromSchema(e.state.schema)).parseSlice(l,{preserveWhitespace:!!(u||h),context:s,ruleFromNode(y){return y.nodeName=="BR"&&!y.nextSibling&&y.parentNode&&!TCe.test(y.parentNode.nodeName)?{ignore:!0}:null}})),h)c=kCe(Rj(c,+h[1],+h[2]),h[4]);else if(c=Ue.maxOpen(NCe(c.content,s),!0),c.openStart||c.openEnd){let p=0,y=0;for(let x=c.content.firstChild;p<c.openStart&&!x.type.spec.isolating;p++,x=x.firstChild);for(let x=c.content.lastChild;y<c.openEnd&&!x.type.spec.isolating;y++,x=x.lastChild);c=Rj(c,p,y)}return e.someProp("transformPasted",p=>{c=p(c,e,u)}),c}const TCe=/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var)$/i;function NCe(e,t){if(e.childCount<2)return e;for(let n=t.depth;n>=0;n--){let s=t.node(n).contentMatchAt(t.index(n)),o,l=[];if(e.forEach(c=>{if(!l)return;let u=s.findWrapping(c.type),f;if(!u)return l=null;if(f=l.length&&o.length&&s7(u,o,c,l[l.length-1],0))l[l.length-1]=f;else{l.length&&(l[l.length-1]=o7(l[l.length-1],o.length));let h=r7(c,u);l.push(h),s=s.matchType(h.type),o=u}}),l)return Ie.from(l)}return e}function r7(e,t,n=0){for(let r=t.length-1;r>=n;r--)e=t[r].create(null,Ie.from(e));return e}function s7(e,t,n,r,s){if(s<e.length&&s<t.length&&e[s]==t[s]){let o=s7(e,t,n,r.lastChild,s+1);if(o)return r.copy(r.content.replaceChild(r.childCount-1,o));if(r.contentMatchAt(r.childCount).matchType(s==e.length-1?n.type:e[s+1]))return r.copy(r.content.append(Ie.from(r7(n,e,s+1))))}}function o7(e,t){if(t==0)return e;let n=e.content.replaceChild(e.childCount-1,o7(e.lastChild,t-1)),r=e.contentMatchAt(e.childCount).fillBefore(Ie.empty,!0);return e.copy(n.append(r))}function FC(e,t,n,r,s,o){let l=t<0?e.firstChild:e.lastChild,c=l.content;return e.childCount>1&&(o=0),s<r-1&&(c=FC(c,t,n,r,s+1,o)),s>=n&&(c=t<0?l.contentMatchAt(0).fillBefore(c,o<=s).append(c):c.append(l.contentMatchAt(l.childCount).fillBefore(Ie.empty,!0))),e.replaceChild(t<0?0:e.childCount-1,l.copy(c))}function Rj(e,t,n){return t<e.openStart&&(e=new Ue(FC(e.content,-1,t,e.openStart,0,e.openEnd),t,e.openEnd)),n<e.openEnd&&(e=new Ue(FC(e.content,1,n,e.openEnd,0,0),e.openStart,n)),e}const i7={thead:["table"],tbody:["table"],tfoot:["table"],caption:["table"],colgroup:["table"],col:["table","colgroup"],tr:["table","tbody"],td:["table","tbody","tr"],th:["table","tbody","tr"]};function l7(){return document.implementation.createHTMLDocument("title")}let Uh=null;function OCe(e){let t=window.trustedTypes;if(!t)return e;if(!Uh){if(Uh=t.defaultPolicy)try{return Uh.createHTML(e)}catch{}Uh=t.createPolicy("ProseMirrorClipboard",{createHTML:n=>n})}return Uh.createHTML(e)}function RCe(e){let t=/^(\s*<meta [^>]*>)*/.exec(e);t&&(e=e.slice(t[0].length));let n=l7(),r=n.body,s=/<([a-z][^>\s]+)/i.exec(e),o;if((o=s&&i7[s[1].toLowerCase()])&&(e=o.map(l=>"<"+l+">").join("")+e+o.map(l=>"</"+l+">").reverse().join("")),r.innerHTML=OCe(e),o)for(let l=0;l<o.length;l++)r=r.querySelector(o[l])||r;for(let l=0;l<n.styleSheets.length;l++){let c=n.styleSheets[l];for(let u=0;u<c.rules.length;u++){let f=c.rules[u];if(f instanceof CSSStyleRule){let h=r.querySelectorAll(f.selectorText);for(let p=0;p<h.length;p++)h[p].style.cssText+=f.style.cssText}}}return r}function ACe(e){let t=e.querySelectorAll(Tr?"span:not([class]):not([style])":"span.Apple-converted-space");for(let n=0;n<t.length;n++){let r=t[n];r.childNodes.length==1&&r.textContent==" "&&r.parentNode&&r.parentNode.replaceChild(e.ownerDocument.createTextNode(" "),r)}}function kCe(e,t){if(!e.size)return e;let n=e.content.firstChild.type.schema,r;try{r=JSON.parse(t)}catch{return e}let{content:s,openStart:o,openEnd:l}=e;for(let c=r.length-2;c>=0;c-=2){let u=n.nodes[r[c]];if(!u||u.hasRequiredAttrs())break;try{s=Ie.from(u.create(r[c+1],s))}catch{break}o++,l++}return new Ue(s,o,l)}const rs={},ss={},_Ce={touchstart:!0,touchmove:!0};class MCe{constructor(){this.shiftKey=!1,this.mouseDown=null,this.lastKeyCode=null,this.lastKeyCodeTime=0,this.lastClick={time:0,x:0,y:0,type:"",button:0},this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastIOSEnter=0,this.lastIOSEnterFallbackTimeout=-1,this.lastFocus=0,this.lastTouch=0,this.lastChromeDelete=0,this.composing=!1,this.compositionNode=null,this.composingTimeout=-1,this.compositionNodes=[],this.compositionEndedAt=-2e8,this.compositionID=1,this.badSafariComposition=!1,this.compositionPendingChanges=0,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}}function ICe(e){for(let t in rs){let n=rs[t];e.dom.addEventListener(t,e.input.eventHandlers[t]=r=>{DCe(e,r)&&!MN(e,r)&&(e.editable||!(r.type in ss))&&n(e,r)},_Ce[t]?{passive:!0}:void 0)}Br&&e.dom.addEventListener("input",()=>null),$C(e)}function Xi(e,t){e.input.lastSelectionOrigin=t,e.input.lastSelectionTime=Date.now()}function LCe(e){e.input.mouseDown&&e.input.mouseDown.done(),e.domObserver.stop();for(let t in e.input.eventHandlers)e.dom.removeEventListener(t,e.input.eventHandlers[t]);clearTimeout(e.input.composingTimeout),clearTimeout(e.input.lastIOSEnterFallbackTimeout)}function $C(e){e.someProp("handleDOMEvents",t=>{for(let n in t)e.input.eventHandlers[n]||e.dom.addEventListener(n,e.input.eventHandlers[n]=r=>MN(e,r))})}function MN(e,t){return e.someProp("handleDOMEvents",n=>{let r=n[t.type];return r?r(e,t)||t.defaultPrevented:!1})}function DCe(e,t){if(!t.bubbles)return!0;if(t.defaultPrevented)return!1;for(let n=t.target;n!=e.dom;n=n.parentNode)if(!n||n.nodeType==11||n.pmViewDesc&&n.pmViewDesc.stopEvent(t))return!1;return!0}function jCe(e,t){!MN(e,t)&&rs[t.type]&&(e.editable||!(t.type in ss))&&rs[t.type](e,t)}ss.keydown=(e,t)=>{let n=t;if(e.input.shiftKey=n.keyCode==16||n.shiftKey,!d7(e)&&(e.input.lastKeyCode=n.keyCode,e.input.lastKeyCodeTime=Date.now(),!(Wi&&Tr&&n.keyCode==13)))if(n.keyCode!=229&&e.domObserver.forceFlush(),Cf&&n.keyCode==13&&!n.ctrlKey&&!n.altKey&&!n.metaKey){let r=Date.now();e.input.lastIOSEnter=r,e.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{e.input.lastIOSEnter==r&&(e.someProp("handleKeyDown",s=>s(e,Ic(13,"Enter"))),e.input.lastIOSEnter=0)},200)}else e.someProp("handleKeyDown",r=>r(e,n))||CCe(e,n)?n.preventDefault():Xi(e,"key")};ss.keyup=(e,t)=>{t.keyCode==16&&(e.input.shiftKey=!1)};ss.keypress=(e,t)=>{let n=t;if(d7(e)||!n.charCode||n.ctrlKey&&!n.altKey||ro&&n.metaKey)return;if(e.someProp("handleKeyPress",s=>s(e,n))){n.preventDefault();return}let r=e.state.selection;if(!(r instanceof ft)||!r.$from.sameParent(r.$to)){let s=String.fromCharCode(n.charCode),o=()=>e.state.tr.insertText(s).scrollIntoView();!/[\r\n]/.test(s)&&!e.someProp("handleTextInput",l=>l(e,r.$from.pos,r.$to.pos,s,o))&&e.dispatch(o()),n.preventDefault()}};function Wm(e){return{left:e.clientX,top:e.clientY}}function PCe(e,t){let n=t.x-e.clientX,r=t.y-e.clientY;return n*n+r*r<100}function IN(e,t,n,r,s){if(r==-1)return!1;let o=e.state.doc.resolve(r);for(let l=o.depth+1;l>0;l--)if(e.someProp(t,c=>l>o.depth?c(e,n,o.nodeAfter,o.before(l),s,!0):c(e,n,o.node(l),o.before(l),s,!1)))return!0;return!1}function Xm(e,t,n){if(e.focused||e.focus(),e.state.selection.eq(t))return;let r=e.state.tr.setSelection(t);r.setMeta("pointer",!0),e.dispatch(r)}function zCe(e,t){if(t==-1)return!1;let n=e.state.doc.resolve(t),r=n.nodeAfter;return r&&r.isAtom&&nt.isSelectable(r)?(Xm(e,new nt(n)),!0):!1}function BCe(e,t){if(t==-1)return!1;let n=e.state.selection,r,s;n instanceof nt&&(r=n.node);let o=e.state.doc.resolve(t);for(let l=o.depth+1;l>0;l--){let c=l>o.depth?o.nodeAfter:o.node(l);if(nt.isSelectable(c)){r&&n.$from.depth>0&&l>=n.$from.depth&&o.before(n.$from.depth+1)==n.$from.pos?s=o.before(n.$from.depth):s=o.before(l);break}}return s!=null?(Xm(e,nt.create(e.state.doc,s)),!0):!1}function HCe(e,t,n,r,s){return IN(e,"handleClickOn",t,n,r)||e.someProp("handleClick",o=>o(e,t,r))||(s?BCe(e,n):zCe(e,n))}function FCe(e,t,n,r){return IN(e,"handleDoubleClickOn",t,n,r)||e.someProp("handleDoubleClick",s=>s(e,t,r))}function $Ce(e,t,n,r){return IN(e,"handleTripleClickOn",t,n,r)||e.someProp("handleTripleClick",s=>s(e,t,r))||UCe(e,n,r)}function UCe(e,t,n){if(n.button!=0)return!1;let r=a7(e,t,!0),s=e.state.doc;return r?(Xm(e,r),r instanceof ft&&s.eq(e.state.doc)&&(e.input.mouseDown=new qCe(e,r)),!0):!1}function a7(e,t,n){let r=e.state.doc;if(t==-1)return r.inlineContent?ft.create(r,0,r.content.size):null;let s=r.resolve(t);for(let o=s.depth+1;o>0;o--){let l=o>s.depth?s.nodeAfter:s.node(o),c=s.before(o);if(l.inlineContent)return ft.create(r,c+1,c+1+l.content.size);if(n&&nt.isSelectable(l))return nt.create(r,c)}return null}function LN(e){return Cx(e)}const c7=ro?"metaKey":"ctrlKey";rs.mousedown=(e,t)=>{let n=t;e.input.shiftKey=n.shiftKey;let r=LN(e),s=Date.now(),o="singleClick";s-e.input.lastClick.time<500&&PCe(n,e.input.lastClick)&&!n[c7]&&e.input.lastClick.button==n.button&&(e.input.lastClick.type=="singleClick"?o="doubleClick":e.input.lastClick.type=="doubleClick"&&(o="tripleClick")),e.input.lastClick={time:s,x:n.clientX,y:n.clientY,type:o,button:n.button},e.input.mouseDown&&e.input.mouseDown.done();let l=e.posAtCoords(Wm(n));l&&(o=="singleClick"?e.input.mouseDown=new VCe(e,l,n,!!r):(o=="doubleClick"?FCe:$Ce)(e,l.pos,l.inside,n)?n.preventDefault():Xi(e,"pointer"))};class u7{constructor(t){this.view=t,this.mightDrag=null,t.root.addEventListener("mouseup",this.up=this.up.bind(this)),t.root.addEventListener("mousemove",this.move=this.move.bind(this))}up(t){this.done()}move(t){t.buttons==0&&this.done()}done(){this.view.root.removeEventListener("mouseup",this.up),this.view.root.removeEventListener("mousemove",this.move),this.view.input.mouseDown==this&&(this.view.input.mouseDown=null)}delaySelUpdate(){return!1}}class VCe extends u7{constructor(t,n,r,s){super(t),this.pos=n,this.event=r,this.flushed=s,this.delayedSelectionSync=!1,this.startDoc=t.state.doc,this.selectNode=!!r[c7],this.allowDefault=r.shiftKey;let o,l;if(n.inside>-1)o=t.state.doc.nodeAt(n.inside),l=n.inside;else{let h=t.state.doc.resolve(n.pos);o=h.parent,l=h.depth?h.before():0}const c=s?null:r.target,u=c?t.docView.nearestDesc(c,!0):null;this.target=u&&et(u.nodeDOM)?u.nodeDOM:null;let{selection:f}=t.state;r.button==0&&(o.type.spec.draggable&&o.type.spec.selectable!==!1||f instanceof nt&&f.from<=l&&f.to>l)&&(this.mightDrag={node:o,pos:l,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&Fs&&!this.target.hasAttribute("contentEditable"))}),this.target&&this.mightDrag&&(this.mightDrag.addAttr||this.mightDrag.setUneditable)&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&(this.target.draggable=!0),this.mightDrag.setUneditable&&setTimeout(()=>{this.view.input.mouseDown==this&&this.target.setAttribute("contentEditable","false")},20),this.view.domObserver.start()),Xi(t,"pointer")}done(){super.done(),this.mightDrag&&this.target&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&this.target.removeAttribute("draggable"),this.mightDrag.setUneditable&&this.target.removeAttribute("contentEditable"),this.view.domObserver.start()),this.delayedSelectionSync&&setTimeout(()=>{this.view.isDestroyed||il(this.view)})}up(t){if(this.done(),!this.view.dom.contains(t.target))return;let n=this.pos;this.view.state.doc!=this.startDoc&&(n=this.view.posAtCoords(Wm(t))),this.updateAllowDefault(t),this.allowDefault||!n?Xi(this.view,"pointer"):HCe(this.view,n.pos,n.inside,t,this.selectNode)?t.preventDefault():t.button==0&&(this.flushed||Br&&this.mightDrag&&!this.mightDrag.node.isAtom||Tr&&!this.view.state.selection.visible&&Math.min(Math.abs(n.pos-this.view.state.selection.from),Math.abs(n.pos-this.view.state.selection.to))<=2)?(Xm(this.view,Rt.near(this.view.state.doc.resolve(n.pos))),t.preventDefault()):Xi(this.view,"pointer")}move(t){this.updateAllowDefault(t),Xi(this.view,"pointer"),super.move(t)}updateAllowDefault(t){!this.allowDefault&&(Math.abs(this.event.x-t.clientX)>4||Math.abs(this.event.y-t.clientY)>4)&&(this.allowDefault=!0)}delaySelUpdate(){return this.allowDefault?(this.delayedSelectionSync=!0,!0):!1}}class qCe extends u7{constructor(t,n){super(t),this.startSelection=n,this.startDoc=t.state.doc}move(t){if(t.buttons==0||this.view.isDestroyed||!this.view.state.doc.eq(this.startDoc)){this.done();return}t.preventDefault(),Xi(this.view,"pointer");let n=this.view.posAtCoords(Wm(t)),r=n&&a7(this.view,n.inside,!1);if(!r)return;let{doc:s}=this.view.state,o=this.startSelection,[l,c]=r.from<o.from?[o.to,r.from]:[o.from,r.to];Xm(this.view,ft.create(s,l,c))}}rs.touchstart=e=>{e.input.lastTouch=Date.now(),LN(e),Xi(e,"pointer")};rs.touchmove=e=>{e.input.lastTouch=Date.now(),Xi(e,"pointer")};rs.contextmenu=e=>LN(e);function d7(e,t){return e.composing?!0:Br&&Math.abs(Date.now()-e.input.compositionEndedAt)<500?(e.input.compositionEndedAt=-2e8,!0):!1}const GCe=Wi?5e3:-1;ss.compositionstart=ss.compositionupdate=e=>{if(!e.composing){e.domObserver.flush();let{state:t}=e,n=t.selection.$to;if(t.selection instanceof ft&&t.selection.empty&&(t.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(r=>r.type.spec.inclusive===!1)||Tr&&H$&&KCe(e)))e.markCursor=e.state.storedMarks||n.marks(),Cx(e,!0),e.markCursor=null;else if(Cx(e,!t.selection.empty),Fs&&t.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length){let r=e.domSelectionRange();for(let s=r.focusNode,o=r.focusOffset;s&&et(s)&&o!=0;){let l=o<0?s.lastChild:s.childNodes[o-1];if(!l)break;if(Jn(l)){let c=e.domSelection();c&&c.collapse(l,l.nodeValue.length);break}else s=l,o=-1}}e.input.composing=!0}f7(e,GCe)};function KCe(e){let{focusNode:t,focusOffset:n}=e.domSelectionRange();if(!t||!et(t)||n>=t.childNodes.length)return!1;let r=t.childNodes[n];return et(r)&&r.contentEditable=="false"}ss.compositionend=(e,t)=>{e.composing&&(e.input.composing=!1,e.input.compositionEndedAt=Date.now(),e.input.compositionPendingChanges=e.domObserver.pendingRecords().length?e.input.compositionID:0,e.input.compositionNode=null,e.input.badSafariComposition?e.domObserver.forceFlush():e.input.compositionPendingChanges&&Promise.resolve().then(()=>e.domObserver.flush()),e.input.compositionID++,f7(e,20))};function f7(e,t){clearTimeout(e.input.composingTimeout),t>-1&&(e.input.composingTimeout=setTimeout(()=>Cx(e),t))}function h7(e){for(e.composing&&(e.input.composing=!1,e.input.compositionEndedAt=Date.now());e.input.compositionNodes.length>0;)e.input.compositionNodes.pop().markParentsDirty()}function YCe(e){let t=e.domSelectionRange();if(!t.focusNode)return null;let n=BEe(t.focusNode,t.focusOffset),r=HEe(t.focusNode,t.focusOffset);if(n&&r&&n!=r){let s=r.pmViewDesc,o=e.domObserver.lastChangedTextNode;if(n==o||r==o)return o;if(!s||!s.isText(r.nodeValue))return r;if(e.input.compositionNode==r){let l=n.pmViewDesc;if(!(!l||!l.isText(n.nodeValue)))return r}}return n||r}function Cx(e,t=!1){if(!(Wi&&e.domObserver.flushingSoon>=0)){if(e.domObserver.forceFlush(),h7(e),t||e.docView&&e.docView.dirty){let n=AN(e),r=e.state.selection;return n&&!n.eq(r)?e.dispatch(e.state.tr.setSelection(n)):(e.markCursor||t)&&!r.$from.node(r.$from.sharedDepth(r.to)).inlineContent?e.dispatch(e.state.tr.deleteSelection()):e.updateState(e.state),!0}return!1}}function WCe(e,t){if(!e.dom.parentNode)return;let n=e.dom.parentNode.appendChild(document.createElement("div"));n.appendChild(t),n.style.cssText="position: fixed; left: -10000px; top: 10px";let r=getSelection(),s=document.createRange();s.selectNodeContents(t),e.dom.blur(),r.removeAllRanges(),r.addRange(s),setTimeout(()=>{n.parentNode&&n.parentNode.removeChild(n),e.focus()},50)}const Zp=Ss&&_a<15||Cf&&VEe<604;rs.copy=ss.cut=(e,t)=>{let n=t,r=e.state.selection,s=n.type=="cut";if(r.empty)return;let o=Zp?null:n.clipboardData,l=r.content(),{dom:c,text:u}=_N(e,l);o?(n.preventDefault(),o.clearData(),o.setData("text/html",c.innerHTML),o.setData("text/plain",u)):WCe(e,c),s&&e.dispatch(e.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function XCe(e){return e.openStart==0&&e.openEnd==0&&e.content.childCount==1?e.content.firstChild:null}function QCe(e,t){if(!e.dom.parentNode)return;let n=e.input.shiftKey||e.state.selection.$from.parent.type.spec.code,r=e.dom.parentNode.appendChild(document.createElement(n?"textarea":"div"));n||(r.contentEditable="true"),r.style.cssText="position: fixed; left: -10000px; top: 10px",r.focus();let s=e.input.shiftKey&&e.input.lastKeyCode!=45;setTimeout(()=>{e.focus(),r.parentNode&&r.parentNode.removeChild(r),n?Jp(e,r.value,null,s,t):Jp(e,r.textContent,r.innerHTML,s,t)},50)}function Jp(e,t,n,r,s){let o=n7(e,t,n,r,e.state.selection.$from);if(e.someProp("handlePaste",u=>u(e,s,o||Ue.empty)))return!0;if(!o)return!1;let l=XCe(o),c=l?e.state.tr.replaceSelectionWith(l,r):e.state.tr.replaceSelection(o);return e.dispatch(c.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function p7(e){let t=e.getData("text/plain")||e.getData("Text");if(t)return t;let n=e.getData("text/uri-list");return n?n.replace(/\r?\n/g," "):""}ss.paste=(e,t)=>{let n=t;if(e.composing&&!Wi)return;let r=Zp?null:n.clipboardData,s=e.input.shiftKey&&e.input.lastKeyCode!=45;r&&Jp(e,p7(r),r.getData("text/html"),s,n)?n.preventDefault():QCe(e,n)};class m7{constructor(t,n,r){this.slice=t,this.move=n,this.node=r}}const ZCe=ro?"altKey":"ctrlKey";function g7(e,t){let n;return e.someProp("dragCopies",r=>{n=n||r(t)}),n!=null?!n:!t[ZCe]}rs.dragstart=(e,t)=>{let n=t,r=e.input.mouseDown;if(r&&r.done(),!n.dataTransfer)return;let s=e.state.selection,o=s.empty?null:e.posAtCoords(Wm(n)),l;if(!(o&&o.pos>=s.from&&o.pos<=(s instanceof nt?s.to-1:s.to))){if(r&&r.mightDrag)l=nt.create(e.state.doc,r.mightDrag.pos);else if(n.target&&et(n.target)){let p=e.docView.nearestDesc(n.target,!0);p&&p.node.type.spec.draggable&&p!=e.docView&&(l=nt.create(e.state.doc,p.posBefore))}}let c=(l||e.state.selection).content(),{dom:u,text:f,slice:h}=_N(e,c);(!n.dataTransfer.files.length||!Tr||B$>120)&&n.dataTransfer.clearData(),n.dataTransfer.setData(Zp?"Text":"text/html",u.innerHTML),n.dataTransfer.effectAllowed="copyMove",Zp||n.dataTransfer.setData("text/plain",f),e.dragging=new m7(h,g7(e,n),l)};rs.dragend=e=>{let t=e.dragging;window.setTimeout(()=>{e.dragging==t&&(e.dragging=null)},50)};ss.dragover=ss.dragenter=(e,t)=>t.preventDefault();ss.drop=(e,t)=>{try{JCe(e,t,e.dragging)}finally{e.dragging=null}};function JCe(e,t,n){if(!t.dataTransfer)return;let r=e.posAtCoords(Wm(t));if(!r)return;let s=e.state.doc.resolve(r.pos),o=n&&n.slice;o?e.someProp("transformPasted",x=>{o=x(o,e,!1)}):o=n7(e,p7(t.dataTransfer),Zp?null:t.dataTransfer.getData("text/html"),!1,s);let l=!!(n&&g7(e,t));if(e.someProp("handleDrop",x=>x(e,t,o||Ue.empty,l))){t.preventDefault();return}if(!o)return;t.preventDefault();let c=o?iEe(e.state.doc,s.pos,o):s.pos;c==null&&(c=s.pos);let u=e.state.tr;if(l){let{node:x}=n;x?x.replace(u):u.deleteSelection()}let f=u.mapping.map(c),h=o.openStart==0&&o.openEnd==0&&o.content.childCount==1,p=u.doc;if(h?u.replaceRangeWith(f,f,o.content.firstChild):u.replaceRange(f,f,o),u.doc.eq(p))return;let y=u.doc.resolve(f);if(h&&nt.isSelectable(o.content.firstChild)&&y.nodeAfter&&y.nodeAfter.sameMarkup(o.content.firstChild))u.setSelection(new nt(y));else{let x=u.mapping.map(c);u.mapping.maps[u.mapping.maps.length-1].forEach((b,S,E,C)=>x=C),u.setSelection(kN(e,y,u.doc.resolve(x)))}e.focus(),e.dispatch(u.setMeta("uiEvent","drop"))}rs.focus=e=>{e.input.lastFocus=Date.now(),e.focused||(e.domObserver.stop(),e.dom.classList.add("ProseMirror-focused"),e.domObserver.start(),e.focused=!0,setTimeout(()=>{e.docView&&e.hasFocus()&&!e.domObserver.currentSelection.eq(e.domSelectionRange())&&il(e)},20))};rs.blur=(e,t)=>{let n=t;e.focused&&(e.domObserver.stop(),e.dom.classList.remove("ProseMirror-focused"),e.domObserver.start(),n.relatedTarget&&e.dom.contains(n.relatedTarget)&&e.domObserver.currentSelection.clear(),e.focused=!1)};rs.beforeinput=(e,t)=>{if(Wi&&t.inputType=="deleteContentBackward"){e.domObserver.flushSoon();let{domChangeCount:r}=e.input;setTimeout(()=>{if(e.input.domChangeCount!=r||(e.dom.blur(),e.focus(),e.someProp("handleKeyDown",o=>o(e,Ic(8,"Backspace")))))return;let{$cursor:s}=e.state.selection;s&&s.pos>0&&e.dispatch(e.state.tr.delete(s.pos-1,s.pos).scrollIntoView())},50)}};for(let e in ss)rs[e]=ss[e];function em(e,t){if(e==t)return!0;for(let n in e)if(e[n]!==t[n])return!1;for(let n in t)if(!(n in e))return!1;return!0}class Tx{constructor(t,n){this.toDOM=t,this.spec=n||nu,this.side=this.spec.side||0}map(t,n,r,s){let{pos:o,deleted:l}=t.mapResult(n.from+s,this.side<0?-1:1);return l?null:new Ro(o-r,o-r,this)}valid(){return!0}eq(t){return this==t||t instanceof Tx&&(this.spec.key&&this.spec.key==t.spec.key||this.toDOM==t.toDOM&&em(this.spec,t.spec))}destroy(t){this.spec.destroy&&this.spec.destroy(t)}}class La{constructor(t,n){this.attrs=t,this.spec=n||nu}map(t,n,r,s){let o=t.map(n.from+s,this.spec.inclusiveStart?-1:1)-r,l=t.map(n.to+s,this.spec.inclusiveEnd?1:-1)-r;return o>=l?null:new Ro(o,l,this)}valid(t,n){return n.from<n.to}eq(t){return this==t||t instanceof La&&em(this.attrs,t.attrs)&&em(this.spec,t.spec)}static is(t){return t.type instanceof La}destroy(){}}class DN{constructor(t,n){this.attrs=t,this.spec=n||nu}map(t,n,r,s){let o=t.mapResult(n.from+s,1);if(o.deleted)return null;let l=t.mapResult(n.to+s,-1);return l.deleted||l.pos<=o.pos?null:new Ro(o.pos-r,l.pos-r,this)}valid(t,n){let{index:r,offset:s}=t.content.findIndex(n.from),o;return s==n.from&&!(o=t.child(r)).isText&&s+o.nodeSize==n.to}eq(t){return this==t||t instanceof DN&&em(this.attrs,t.attrs)&&em(this.spec,t.spec)}destroy(){}}class Ro{constructor(t,n,r){this.from=t,this.to=n,this.type=r}copy(t,n){return new Ro(t,n,this.type)}eq(t,n=0){return this.type.eq(t.type)&&this.from+n==t.from&&this.to+n==t.to}map(t,n,r){return this.type.map(t,this,n,r)}static widget(t,n,r){return new Ro(t,t,new Tx(n,r))}static inline(t,n,r,s){return new Ro(t,n,new La(r,s))}static node(t,n,r,s){return new Ro(t,n,new DN(r,s))}get spec(){return this.type.spec}get inline(){return this.type instanceof La}get widget(){return this.type instanceof Tx}}const Nd=[],nu={};class En{constructor(t,n){this.local=t.length?t:Nd,this.children=n.length?n:Nd}static create(t,n){return n.length?Nx(n,t,0,nu):Dr}find(t,n,r){let s=[];return this.findInner(t??0,n??1e9,s,0,r),s}findInner(t,n,r,s,o){for(let l=0;l<this.local.length;l++){let c=this.local[l];c.from<=n&&c.to>=t&&(!o||o(c.spec))&&r.push(c.copy(c.from+s,c.to+s))}for(let l=0;l<this.children.length;l+=3)if(this.children[l]<n&&this.children[l+1]>t){let c=this.children[l]+1;this.children[l+2].findInner(t-c,n-c,r,s+c,o)}}map(t,n,r){return this==Dr||t.maps.length==0?this:this.mapInner(t,n,0,0,r||nu)}mapInner(t,n,r,s,o){let l;for(let c=0;c<this.local.length;c++){let u=this.local[c].map(t,r,s);u&&u.type.valid(n,u)?(l||(l=[])).push(u):o.onRemove&&o.onRemove(this.local[c].spec)}return this.children.length?e2e(this.children,l||[],t,n,r,s,o):l?new En(l.sort(ru),Nd):Dr}add(t,n){return n.length?this==Dr?En.create(t,n):this.addInner(t,n,0):this}addInner(t,n,r){let s,o=0;t.forEach((c,u)=>{let f=u+r,h;if(h=x7(n,c,f)){for(s||(s=this.children.slice());o<s.length&&s[o]<u;)o+=3;s[o]==u?s[o+2]=s[o+2].addInner(c,h,f+1):s.splice(o,0,u,u+c.nodeSize,Nx(h,c,f+1,nu)),o+=3}});let l=y7(o?b7(n):n,-r);for(let c=0;c<l.length;c++)l[c].type.valid(t,l[c])||l.splice(c--,1);return new En(l.length?this.local.concat(l).sort(ru):this.local,s||this.children)}remove(t){return t.length==0||this==Dr?this:this.removeInner(t,0)}removeInner(t,n){let r=this.children,s=this.local;for(let o=0;o<r.length;o+=3){let l,c=r[o]+n,u=r[o+1]+n;for(let h=0,p;h<t.length;h++)(p=t[h])&&p.from>c&&p.to<u&&(t[h]=null,(l||(l=[])).push(p));if(!l)continue;r==this.children&&(r=this.children.slice());let f=r[o+2].removeInner(l,c+1);f!=Dr?r[o+2]=f:(r.splice(o,3),o-=3)}if(s.length){for(let o=0,l;o<t.length;o++)if(l=t[o])for(let c=0;c<s.length;c++)s[c].eq(l,n)&&(s==this.local&&(s=this.local.slice()),s.splice(c--,1))}return r==this.children&&s==this.local?this:s.length||r.length?new En(s,r):Dr}forChild(t,n){if(this==Dr)return this;if(n.isLeaf)return En.empty;let r,s;for(let c=0;c<this.children.length;c+=3)if(this.children[c]>=t){this.children[c]==t&&(r=this.children[c+2]);break}let o=t+1,l=o+n.content.size;for(let c=0;c<this.local.length;c++){let u=this.local[c];if(u.from<l&&u.to>o&&u.type instanceof La){let f=Math.max(o,u.from)-o,h=Math.min(l,u.to)-o;f<h&&(s||(s=[])).push(u.copy(f,h))}}if(s){let c=new En(s.sort(ru),Nd);return r?new fa([c,r]):c}return r||Dr}eq(t){if(this==t)return!0;if(!(t instanceof En)||this.local.length!=t.local.length||this.children.length!=t.children.length)return!1;for(let n=0;n<this.local.length;n++)if(!this.local[n].eq(t.local[n]))return!1;for(let n=0;n<this.children.length;n+=3)if(this.children[n]!=t.children[n]||this.children[n+1]!=t.children[n+1]||!this.children[n+2].eq(t.children[n+2]))return!1;return!0}locals(t){return jN(this.localsInner(t))}localsInner(t){if(this==Dr)return Nd;if(t.inlineContent||!this.local.some(La.is))return this.local;let n=[];for(let r=0;r<this.local.length;r++)this.local[r].type instanceof La||n.push(this.local[r]);return n}forEachSet(t){t(this)}}En.empty=new En([],[]);En.removeOverlap=jN;const Dr=En.empty;class fa{constructor(t){this.members=t}map(t,n){const r=this.members.map(s=>s.map(t,n,nu));return fa.from(r)}forChild(t,n){if(n.isLeaf)return En.empty;let r=[];for(let s=0;s<this.members.length;s++){let o=this.members[s].forChild(t,n);o!=Dr&&(o instanceof fa?r=r.concat(o.members):r.push(o))}return fa.from(r)}eq(t){if(!(t instanceof fa)||t.members.length!=this.members.length)return!1;for(let n=0;n<this.members.length;n++)if(!this.members[n].eq(t.members[n]))return!1;return!0}locals(t){let n,r=!0;for(let s=0;s<this.members.length;s++){let o=this.members[s].localsInner(t);if(o.length)if(!n)n=o;else{r&&(n=n.slice(),r=!1);for(let l=0;l<o.length;l++)n.push(o[l])}}return n?jN(r?n:n.sort(ru)):Nd}static from(t){switch(t.length){case 0:return Dr;case 1:return t[0];default:return new fa(t.every(n=>n instanceof En)?t:t.reduce((n,r)=>n.concat(r instanceof En?r:r.members),[]))}}forEachSet(t){for(let n=0;n<this.members.length;n++)this.members[n].forEachSet(t)}}function e2e(e,t,n,r,s,o,l){let c=e.slice();for(let f=0,h=o;f<n.maps.length;f++){let p=0;n.maps[f].forEach((y,x,b,S)=>{let E=S-b-(x-y);for(let C=0;C<c.length;C+=3){let O=c[C+1];if(O<0||y>O+h-p)continue;let T=c[C]+h-p;x>=T?c[C+1]=y<=T?-2:-1:y>=h&&E&&(c[C]+=E,c[C+1]+=E)}p+=E}),h=n.maps[f].map(h,-1)}let u=!1;for(let f=0;f<c.length;f+=3)if(c[f+1]<0){if(c[f+1]==-2){u=!0,c[f+1]=-1;continue}let h=n.map(e[f]+o),p=h-s;if(p<0||p>=r.content.size){u=!0;continue}let y=n.map(e[f+1]+o,-1),x=y-s,{index:b,offset:S}=r.content.findIndex(p),E=r.maybeChild(b);if(E&&S==p&&S+E.nodeSize==x){let C=c[f+2].mapInner(n,E,h+1,e[f]+o+1,l);C!=Dr?(c[f]=p,c[f+1]=x,c[f+2]=C):(c[f+1]=-2,u=!0)}else u=!0}if(u){let f=t2e(c,e,t,n,s,o,l),h=Nx(f,r,0,l);t=h.local;for(let p=0;p<c.length;p+=3)c[p+1]<0&&(c.splice(p,3),p-=3);for(let p=0,y=0;p<h.children.length;p+=3){let x=h.children[p];for(;y<c.length&&c[y]<x;)y+=3;c.splice(y,0,h.children[p],h.children[p+1],h.children[p+2])}}return new En(t.sort(ru),c)}function y7(e,t){if(!t||!e.length)return e;let n=[];for(let r=0;r<e.length;r++){let s=e[r];n.push(new Ro(s.from+t,s.to+t,s.type))}return n}function t2e(e,t,n,r,s,o,l){function c(u,f){for(let h=0;h<u.local.length;h++){let p=u.local[h].map(r,s,f);p?n.push(p):l.onRemove&&l.onRemove(u.local[h].spec)}for(let h=0;h<u.children.length;h+=3)c(u.children[h+2],u.children[h]+f+1)}for(let u=0;u<e.length;u+=3)e[u+1]==-1&&c(e[u+2],t[u]+o+1);return n}function x7(e,t,n){if(t.isLeaf)return null;let r=n+t.nodeSize,s=null;for(let o=0,l;o<e.length;o++)(l=e[o])&&l.from>n&&l.to<r&&((s||(s=[])).push(l),e[o]=null);return s}function b7(e){let t=[];for(let n=0;n<e.length;n++)e[n]!=null&&t.push(e[n]);return t}function Nx(e,t,n,r){let s=[],o=!1;t.forEach((c,u)=>{let f=x7(e,c,u+n);if(f){o=!0;let h=Nx(f,c,n+u+1,r);h!=Dr&&s.push(u,u+c.nodeSize,h)}});let l=y7(o?b7(e):e,-n).sort(ru);for(let c=0;c<l.length;c++)l[c].type.valid(t,l[c])||(r.onRemove&&r.onRemove(l[c].spec),l.splice(c--,1));return l.length||s.length?new En(l,s):Dr}function ru(e,t){return e.from-t.from||e.to-t.to}function jN(e){let t=e;for(let n=0;n<t.length-1;n++){let r=t[n];if(r.from!=r.to)for(let s=n+1;s<t.length;s++){let o=t[s];if(o.from==r.from){o.to!=r.to&&(t==e&&(t=e.slice()),t[s]=o.copy(o.from,r.to),Aj(t,s+1,o.copy(r.to,o.to)));continue}else{o.from<r.to&&(t==e&&(t=e.slice()),t[n]=r.copy(r.from,o.from),Aj(t,s,r.copy(o.from,r.to)));break}}}return t}function Aj(e,t,n){for(;t<e.length&&ru(n,e[t])>0;)t++;e.splice(t,0,n)}function Ew(e){let t=[];return e.someProp("decorations",n=>{let r=n(e.state);r&&r!=Dr&&t.push(r)}),e.cursorWrapper&&t.push(En.create(e.state.doc,[e.cursorWrapper.deco])),fa.from(t)}const n2e={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},r2e=Ss&&_a<=11;class s2e{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}set(t){this.anchorNode=t.anchorNode,this.anchorOffset=t.anchorOffset,this.focusNode=t.focusNode,this.focusOffset=t.focusOffset}clear(){this.anchorNode=this.focusNode=null}eq(t){return t.anchorNode==this.anchorNode&&t.anchorOffset==this.anchorOffset&&t.focusNode==this.focusNode&&t.focusOffset==this.focusOffset}}class o2e{constructor(t,n){this.view=t,this.handleDOMChange=n,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new s2e,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(r=>{for(let s=0;s<r.length;s++)this.queue.push(r[s]);Ss&&_a<=11&&r.some(s=>s.type=="childList"&&s.removedNodes.length||s.type=="characterData"&&s.oldValue.length>s.target.nodeValue.length)?this.flushSoon():Br&&t.composing&&r.some(s=>s.type=="childList"&&s.target.nodeName=="TR")?(t.input.badSafariComposition=!0,this.flushSoon()):this.flush()}),r2e&&(this.onCharData=r=>{this.queue.push({target:r.target,type:"characterData",oldValue:r.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this)}flushSoon(){this.flushingSoon<0&&(this.flushingSoon=window.setTimeout(()=>{this.flushingSoon=-1,this.flush()},20))}forceFlush(){this.flushingSoon>-1&&(window.clearTimeout(this.flushingSoon),this.flushingSoon=-1,this.flush())}start(){this.observer&&(this.observer.takeRecords(),this.observer.observe(this.view.dom,n2e)),this.onCharData&&this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.connectSelection()}stop(){if(this.observer){let t=this.observer.takeRecords();if(t.length){for(let n=0;n<t.length;n++)this.queue.push(t[n]);window.setTimeout(()=>this.flush(),20)}this.observer.disconnect()}this.onCharData&&this.view.dom.removeEventListener("DOMCharacterDataModified",this.onCharData),this.disconnectSelection()}connectSelection(){this.view.dom.ownerDocument.addEventListener("selectionchange",this.onSelectionChange)}disconnectSelection(){this.view.dom.ownerDocument.removeEventListener("selectionchange",this.onSelectionChange)}suppressSelectionUpdates(){this.suppressingSelectionUpdates=!0,setTimeout(()=>this.suppressingSelectionUpdates=!1,50)}onSelectionChange(){if(wj(this.view)){if(this.suppressingSelectionUpdates)return il(this.view);if(Ss&&_a<=11&&!this.view.state.selection.empty){let t=this.view.domSelectionRange();if(t.focusNode&&gu(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset))return this.flushSoon()}this.flush()}}setCurSelection(){this.currentSelection.set(this.view.domSelectionRange())}ignoreSelectionChange(t){if(!t.focusNode)return!0;let n=new Set,r;for(let o=t.focusNode;o;o=Ef(o))n.add(o);for(let o=t.anchorNode;o;o=Ef(o))if(n.has(o)){r=o;break}let s=r&&this.view.docView.nearestDesc(r);if(s&&s.ignoreMutation({type:"selection",target:Jn(r)?r.parentNode:r}))return this.setCurSelection(),!0}pendingRecords(){if(this.observer)for(let t of this.observer.takeRecords())this.queue.push(t);return this.queue}flush(){let{view:t}=this;if(!t.docView||this.flushingSoon>-1)return;let n=this.pendingRecords();n.length&&(this.queue=[]);let r=t.domSelectionRange(),s=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(r)&&wj(t)&&!this.ignoreSelectionChange(r),o=-1,l=-1,c=!1,u=[];if(t.editable)for(let h=0;h<n.length;h++){let p=this.registerMutation(n[h],u);p&&(o=o<0?p.from:Math.min(p.from,o),l=l<0?p.to:Math.max(p.to,l),p.typeOver&&(c=!0))}if(u.some(h=>h.nodeName=="BR")&&(t.input.lastKeyCode==8||t.input.lastKeyCode==46||Tr&&(t.composing||t.input.compositionEndedAt>Date.now()-50)&&n.some(h=>h.type=="childList"&&h.removedNodes.length))){for(let h of u)if(h.nodeName=="BR"&&h.parentNode){let p=h.nextSibling;for(;p&&et(p);){if(p.contentEditable=="false"){h.parentNode.removeChild(h);break}p=p.firstChild}}}else if(Fs&&u.length){let h=u.filter(p=>p.nodeName=="BR");if(h.length==2){let[p,y]=h;p.parentNode&&p.parentNode.parentNode==y.parentNode?y.remove():p.remove()}else{let{focusNode:p}=this.currentSelection;for(let y of h){let x=y.parentNode;x&&x.nodeName=="LI"&&(!p||a2e(t,p)!=x)&&y.remove()}}}let f=null;o<0&&s&&t.input.lastFocus>Date.now()-200&&Math.max(t.input.lastTouch,t.input.lastClick.time)<Date.now()-300&&Hb(r)&&(f=AN(t))&&f.eq(Rt.near(t.state.doc.resolve(0),1))?(t.input.lastFocus=0,il(t),this.currentSelection.set(r),t.scrollToSelection()):(o>-1||s)&&(o>-1&&(t.docView.markDirty(o,l),i2e(t)),t.input.badSafariComposition&&(t.input.badSafariComposition=!1,c2e(t,u)),this.handleDOMChange(o,l,c,u),t.docView&&t.docView.dirty?t.updateState(t.state):this.currentSelection.eq(r)||il(t),this.currentSelection.set(r))}registerMutation(t,n){if(n.indexOf(t.target)>-1)return null;let r=this.view.docView.nearestDesc(t.target);if(t.type=="attributes"&&(r==this.view.docView||t.attributeName=="contenteditable"||t.attributeName=="style"&&!t.oldValue&&!t.target.getAttribute("style"))||!r||r.ignoreMutation(t))return null;if(t.type=="childList"){for(let h=0;h<t.addedNodes.length;h++){let p=t.addedNodes[h];n.push(p),Jn(p)&&(this.lastChangedTextNode=p)}if(r.contentDOM&&r.contentDOM!=r.dom&&!r.contentDOM.contains(t.target))return{from:r.posBefore,to:r.posAfter};let s=t.previousSibling,o=t.nextSibling;if(Ss&&_a<=11&&t.addedNodes.length)for(let h=0;h<t.addedNodes.length;h++){let{previousSibling:p,nextSibling:y}=t.addedNodes[h];(!p||Array.prototype.indexOf.call(t.addedNodes,p)<0)&&(s=p),(!y||Array.prototype.indexOf.call(t.addedNodes,y)<0)&&(o=y)}let l=s&&s.parentNode==t.target?Er(s)+1:0,c=r.localPosFromDOM(t.target,l,-1),u=o&&o.parentNode==t.target?Er(o):t.target.childNodes.length,f=r.localPosFromDOM(t.target,u,1);return{from:c,to:f}}else return t.type=="attributes"?{from:r.posAtStart-r.border,to:r.posAtEnd+r.border}:(this.lastChangedTextNode=t.target,{from:r.posAtStart,to:r.posAtEnd,typeOver:t.target.nodeValue==t.oldValue})}}let kj=new WeakMap,_j=!1;function i2e(e){if(!kj.has(e)&&(kj.set(e,null),["normal","nowrap","pre-line"].indexOf(getComputedStyle(e.dom).whiteSpace)!==-1)){if(e.requiresGeckoHackNode=Fs,_j)return;console.warn("ProseMirror expects the CSS white-space property to be set, preferably to 'pre-wrap'. It is recommended to load style/prosemirror.css from the prosemirror-view package."),_j=!0}}function Mj(e,t){let n=t.startContainer,r=t.startOffset,s=t.endContainer,o=t.endOffset,l=e.domAtPos(e.state.selection.anchor);return gu(l.node,l.offset,s,o)&&([n,r,s,o]=[s,o,n,r]),{anchorNode:n,anchorOffset:r,focusNode:s,focusOffset:o}}function l2e(e,t){if(t.getComposedRanges){let s=t.getComposedRanges(e.root)[0];if(s)return Mj(e,s)}let n;function r(s){s.preventDefault(),s.stopImmediatePropagation(),n=s.getTargetRanges()[0]}return e.dom.addEventListener("beforeinput",r,!0),document.execCommand("indent"),e.dom.removeEventListener("beforeinput",r,!0),n?Mj(e,n):null}function a2e(e,t){for(let n=t.parentNode;n&&n!=e.dom;n=n.parentNode){let r=e.docView.nearestDesc(n,!0);if(r&&r.node.isBlock)return n}return null}function c2e(e,t){var n;let{focusNode:r,focusOffset:s}=e.domSelectionRange();for(let o of t)if(((n=o.parentNode)===null||n===void 0?void 0:n.nodeName)=="TR"){let l=o.nextSibling;for(;l&&l.nodeName!="TD"&&l.nodeName!="TH";)l=l.nextSibling;if(l){let c=l;for(;;){let u=c.firstChild;if(!u||!et(u)||u.contentEditable=="false"||/^(BR|IMG)$/.test(u.nodeName))break;c=u}c.insertBefore(o,c.firstChild),r==o&&e.domSelection().collapse(o,s)}else o.parentNode.removeChild(o)}}function u2e(e,t,n,r){let{node:s,fromOffset:o,toOffset:l,from:c,to:u}=e.docView.parseRange(t,n),f=e.domSelectionRange(),h,p=f.anchorNode;if(p&&yu(e.dom,p)&&(h=[{node:p,offset:f.anchorOffset}],Hb(f)||h.push({node:f.focusNode,offset:f.focusOffset})),Tr&&e.input.lastKeyCode===8)for(let C=l;C>o;C--){let O=s.childNodes[C-1],T=O.pmViewDesc;if(O.nodeName=="BR"&&!T){l=C;break}if(!T||T.size)break}let y=e.state.doc,x=e.someProp("domParser")||sl.fromSchema(e.state.schema),b=y.resolve(c),S=null,E=x.parse(s,{topNode:b.parent,topMatch:b.parent.contentMatchAt(b.index()),topOpen:!0,from:o,to:l,preserveWhitespace:b.parent.type.whitespace=="pre"?"full":!0,findPositions:h,ruleFromNode:d2e(r),context:b});if(h&&h[0].pos!=null){let C=h[0].pos,O=h[1]&&h[1].pos;O==null&&(O=C),S={anchor:C+c,head:O+c}}return{doc:E,sel:S,from:c,to:u}}const d2e=e=>t=>{let n=t.pmViewDesc;if(n)return n.parseRule(e);if(t.nodeName=="BR"&&t.parentNode){if(Br&&/^(ul|ol)$/i.test(t.parentNode.nodeName)){let r=document.createElement("div");return r.appendChild(document.createElement("li")),{skip:r}}else if(t.parentNode.lastChild==t||Br&&/^(tr|table)$/i.test(t.parentNode.nodeName))return{ignore:!0}}else if(t.nodeName=="IMG"&&t.getAttribute("mark-placeholder"))return{ignore:!0};return null},f2e=/^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|dfn|em|i|img|ins|kbd|label|map|mark|meter|output|q|ruby|s|samp|small|span|strong|su[bp]|time|u|tt|var)$/i;function h2e(e,t,n,r,s){let o=e.input.compositionPendingChanges||(e.composing?e.input.compositionID:0);if(e.input.compositionPendingChanges=0,t<0){let A=e.input.lastSelectionTime>Date.now()-50?e.input.lastSelectionOrigin:null,I=AN(e,A);if(I&&!e.state.selection.eq(I)){if(Tr&&Wi&&e.input.lastKeyCode===13&&Date.now()-100<e.input.lastKeyCodeTime&&e.someProp("handleKeyDown",D=>D(e,Ic(13,"Enter"))))return;let L=e.state.tr.setSelection(I);A=="pointer"?L.setMeta("pointer",!0):A=="key"&&L.scrollIntoView(),o&&L.setMeta("composition",o),e.dispatch(L)}return}let l=e.state.doc.resolve(t),c=l.sharedDepth(n);t=l.before(c+1),n=e.state.doc.resolve(n).after(c+1);let u=e.state.selection,f=u2e(e,t,n,s),h=e.state.doc,p=h.slice(f.from,f.to),y,x;e.input.lastKeyCode===8&&Date.now()-100<e.input.lastKeyCodeTime?(y=e.state.selection.to,x="end"):(y=e.state.selection.from,x="start"),e.input.lastKeyCode=null;let b=y2e(p.content,f.doc.content,f.from,y,x);if(b&&e.input.domChangeCount++,(Cf&&e.input.lastIOSEnter>Date.now()-225||Wi)&&s.some(A=>et(A)&&!f2e.test(A.nodeName))&&(!b||b.endA>=b.endB)&&e.someProp("handleKeyDown",A=>A(e,Ic(13,"Enter")))){e.input.lastIOSEnter=0;return}if(!b)if(r&&u instanceof ft&&!u.empty&&u.$head.sameParent(u.$anchor)&&!e.composing&&!(f.sel&&f.sel.anchor!=f.sel.head))b={start:u.from,endA:u.to,endB:u.to};else{if(f.sel){let A=Ij(e,e.state.doc,f.sel);if(A&&!A.eq(e.state.selection)){let I=e.state.tr.setSelection(A);o&&I.setMeta("composition",o),e.dispatch(I)}}return}e.state.selection.from<e.state.selection.to&&b.start==b.endB&&e.state.selection instanceof ft&&(b.start>e.state.selection.from&&b.start<=e.state.selection.from+2&&e.state.selection.from>=f.from?b.start=e.state.selection.from:b.endA<e.state.selection.to&&b.endA>=e.state.selection.to-2&&e.state.selection.to<=f.to&&(b.endB+=e.state.selection.to-b.endA,b.endA=e.state.selection.to)),Ss&&_a<=11&&b.endB==b.start+1&&b.endA==b.start&&b.start>f.from&&f.doc.textBetween(b.start-f.from-1,b.start-f.from+1)==" "&&(b.start--,b.endA--,b.endB--);let S=f.doc.resolveNoCache(b.start-f.from),E=f.doc.resolveNoCache(b.endB-f.from),C=h.resolve(b.start),O=S.sameParent(E)&&S.parent.inlineContent&&C.end()>=b.endA;if((Cf&&e.input.lastIOSEnter>Date.now()-225&&(!O||s.some(A=>A.nodeName=="DIV"||A.nodeName=="P"))||!O&&g2e(f.doc,S.pos,E.pos))&&e.someProp("handleKeyDown",A=>A(e,Ic(13,"Enter")))){e.input.lastIOSEnter=0;return}if(e.state.selection.anchor>b.start&&m2e(h,b.start,b.endA,S,E)&&e.someProp("handleKeyDown",A=>A(e,Ic(8,"Backspace")))){Wi&&Tr&&e.domObserver.suppressSelectionUpdates();return}Tr&&b.endB==b.start&&(e.input.lastChromeDelete=Date.now()),Wi&&!O&&S.start()!=E.start()&&E.parentOffset==0&&S.depth==E.depth&&f.sel&&f.sel.anchor==f.sel.head&&f.sel.head==b.endA&&(b.endB-=2,E=f.doc.resolveNoCache(b.endB-f.from),setTimeout(()=>{e.someProp("handleKeyDown",function(A){return A(e,Ic(13,"Enter"))})},20));let T=b.start,R=b.endA,k=A=>{let I=A||e.state.tr.replace(T,R,f.doc.slice(b.start-f.from,b.endB-f.from));if(f.sel){let L=Ij(e,I.doc,f.sel);L&&!(Tr&&e.composing&&L.empty&&(b.start!=b.endB||e.input.lastChromeDelete<Date.now()-100)&&(L.head==T||L.head==I.mapping.map(R)-1)||Ss&&L.empty&&L.head==T)&&I.setSelection(L)}return o&&I.setMeta("composition",o),I.scrollIntoView()},M;if(O)if(S.pos==E.pos){Ss&&_a<=11&&S.parentOffset==0&&(e.domObserver.suppressSelectionUpdates(),setTimeout(()=>il(e),20));let A=k(e.state.tr.delete(T,R)),I=h.resolve(b.start).marksAcross(h.resolve(b.endA));I&&A.ensureMarks(I),e.dispatch(A)}else if(b.endA==b.endB&&(M=p2e(S.parent.content.cut(S.parentOffset,E.parentOffset),C.parent.content.cut(C.parentOffset,b.endA-C.start())))){let A=k(e.state.tr);M.type=="add"?A.addMark(T,R,M.mark):A.removeMark(T,R,M.mark),e.dispatch(A)}else if(S.parent.child(S.index()).isText&&S.index()==E.index()-(E.textOffset?0:1)){let A=S.parent.textBetween(S.parentOffset,E.parentOffset),I=()=>k(e.state.tr.insertText(A,T,R));e.someProp("handleTextInput",L=>L(e,T,R,A,I))||e.dispatch(I())}else e.dispatch(k());else e.dispatch(k())}function Ij(e,t,n){return Math.max(n.anchor,n.head)>t.content.size?null:kN(e,t.resolve(n.anchor),t.resolve(n.head))}function p2e(e,t){let n=e.firstChild.marks,r=t.firstChild.marks,s=n,o=r,l,c,u;for(let h=0;h<r.length;h++)s=r[h].removeFromSet(s);for(let h=0;h<n.length;h++)o=n[h].removeFromSet(o);if(s.length==1&&o.length==0)c=s[0],l="add",u=h=>h.mark(c.addToSet(h.marks));else if(s.length==0&&o.length==1)c=o[0],l="remove",u=h=>h.mark(c.removeFromSet(h.marks));else return null;let f=[];for(let h=0;h<t.childCount;h++)f.push(u(t.child(h)));if(Ie.from(f).eq(e))return{mark:c,type:l}}function m2e(e,t,n,r,s){if(n-t<=s.pos-r.pos||Cw(r,!0,!1)<s.pos)return!1;let o=e.resolve(t);if(!r.parent.isTextblock){let c=o.nodeAfter;return c!=null&&n==t+c.nodeSize}if(o.parentOffset<o.parent.content.size||!o.parent.isTextblock)return!1;let l=e.resolve(Cw(o,!0,!0));return!l.parent.isTextblock||l.pos>n||Cw(l,!0,!1)<n?!1:r.parent.content.cut(r.parentOffset).eq(l.parent.content)}function g2e(e,t,n){let r=0,s=0;return e.nodesBetween(t,n,(o,l)=>{o.isTextblock&&l>=t&&l<n?r++:(o.isText?/\S/.test(o.text.slice(Math.max(0,t-l),Math.min(o.nodeSize,n-l))):o.isLeaf)&&s++}),s==0&&r==1}function Cw(e,t,n){let r=e.depth,s=t?e.end():e.pos;for(;r>0&&(t||e.indexAfter(r)==e.node(r).childCount);)r--,s++,t=!1;if(n){let o=e.node(r).maybeChild(e.indexAfter(r));for(;o&&!o.isLeaf;)o=o.firstChild,s++}return s}function y2e(e,t,n,r,s){let o=e.findDiffStart(t,n),l=n+e.size,c=n+t.size;if(o==null)return null;let{a:u,b:f}=e.findDiffEnd(t,l,c);if(s=="end"){let h=Math.max(0,o-Math.min(u,f));r-=u+h-o}if(u<o&&l<c){let h=r<=o&&r>=u?o-r:0;o-=h,f=o+(f-u),u=o}else if(f<o){let h=r<=o&&r>=f?o-r:0;o-=h,u=o+(u-f),f=o}return{start:o,endA:u,endB:f}}class v7{constructor(t,n){this._root=null,this.focused=!1,this.trackWrites=null,this.mounted=!1,this.markCursor=null,this.cursorWrapper=null,this.lastSelectedViewDesc=void 0,this.input=new MCe,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=n,this.state=n.state,this.directPlugins=n.plugins||[],this.directPlugins.forEach(zj),this.dispatch=this.dispatch.bind(this),this.dom=t&&t.mount||document.createElement("div"),t&&(t.appendChild?t.appendChild(this.dom):typeof t=="function"?t(this.dom):t.mount&&(this.mounted=!0)),this.editable=jj(this),Dj(this),this.nodeViews=Pj(this),this.docView=gj(this.state.doc,Lj(this),Ew(this),this.dom,this),this.domObserver=new o2e(this,(r,s,o,l)=>h2e(this,r,s,o,l)),this.domObserver.start(),ICe(this),this.updatePluginViews()}get composing(){return this.input.composing}get props(){if(this._props.state!=this.state){let t=this._props;this._props={};for(let n in t)this._props[n]=t[n];this._props.state=this.state}return this._props}update(t){t.handleDOMEvents!=this._props.handleDOMEvents&&$C(this);let n=this._props;this._props=t,t.plugins&&(t.plugins.forEach(zj),this.directPlugins=t.plugins),this.updateStateInner(t.state,n)}setProps(t){let n={};for(let r in this._props)n[r]=this._props[r];n.state=this.state;for(let r in t)n[r]=t[r];this.update(n)}updateState(t){this.updateStateInner(t,this._props)}updateStateInner(t,n){var r;let s=this.state,o=!1,l=!1;t.storedMarks&&this.composing&&(h7(this),l=!0),this.state=t;let c=s.plugins!=t.plugins||this._props.plugins!=n.plugins;if(c||this._props.plugins!=n.plugins||this._props.nodeViews!=n.nodeViews){let x=Pj(this);b2e(x,this.nodeViews)&&(this.nodeViews=x,o=!0)}(c||n.handleDOMEvents!=this._props.handleDOMEvents)&&$C(this),this.editable=jj(this),Dj(this);let u=Ew(this),f=Lj(this),h=s.plugins!=t.plugins&&!s.doc.eq(t.doc)?"reset":t.scrollToSelection>s.scrollToSelection?"to selection":"preserve",p=o||!this.docView.matchesNode(t.doc,f,u);(p||!t.selection.eq(s.selection))&&(l=!0);let y=h=="preserve"&&l&&this.dom.style.overflowAnchor==null&&KEe(this);if(l){this.domObserver.stop();let x=p&&(Ss||Tr)&&!this.composing&&!s.selection.empty&&!t.selection.empty&&x2e(s.selection,t.selection);if(p){let S=Tr?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=YCe(this)),(o||!this.docView.update(t.doc,f,u,this))&&(this.docView.updateOuterDeco(f),this.docView.destroy(),this.docView=gj(t.doc,f,u,this.dom,this)),S&&(!this.trackWrites||!this.dom.contains(this.trackWrites))&&(x=!0)}let b=this.input.mouseDown;x||!(b&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&yCe(this)&&b.delaySelUpdate())?il(this,x):(J$(this,t.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(s),!((r=this.dragging)===null||r===void 0)&&r.node&&!s.doc.eq(t.doc)&&this.updateDraggedNode(this.dragging,s),h=="reset"?this.dom.scrollTop=0:h=="to selection"?this.scrollToSelection():y&&YEe(y)}scrollToSelection(){let t=this.domSelectionRange().focusNode;if(!(!t||!yu(this.dom,t))){if(!this.someProp("handleScrollToSelection",n=>n(this)))if(this.state.selection instanceof nt){let n=this.docView.domAfterPos(this.state.selection.from);et(n)&&dj(this,n.getBoundingClientRect(),t)}else dj(this,this.coordsAtPos(this.state.selection.head,1),t)}}destroyPluginViews(){let t;for(;t=this.pluginViews.pop();)t.destroy&&t.destroy()}updatePluginViews(t){if(!t||t.plugins!=this.state.plugins||this.directPlugins!=this.prevDirectPlugins){this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(let n=0;n<this.directPlugins.length;n++){let r=this.directPlugins[n];r.spec.view&&this.pluginViews.push(r.spec.view(this))}for(let n=0;n<this.state.plugins.length;n++){let r=this.state.plugins[n];r.spec.view&&this.pluginViews.push(r.spec.view(this))}}else for(let n=0;n<this.pluginViews.length;n++){let r=this.pluginViews[n];r.update&&r.update(this,t)}}updateDraggedNode(t,n){let r=t.node,s=-1;if(r.from<this.state.doc.content.size&&this.state.doc.nodeAt(r.from)==r.node)s=r.from;else{let o=r.from+(this.state.doc.content.size-n.doc.content.size);(o>0&&o<this.state.doc.content.size&&this.state.doc.nodeAt(o))==r.node&&(s=o)}this.dragging=new m7(t.slice,t.move,s<0?void 0:nt.create(this.state.doc,s))}someProp(t,n){let r=this._props&&this._props[t],s;if(r!=null&&(s=n?n(r):r))return s;for(let l=0;l<this.directPlugins.length;l++){let c=this.directPlugins[l].props[t];if(c!=null&&(s=n?n(c):c))return s}let o=this.state.plugins;if(o)for(let l=0;l<o.length;l++){let c=o[l].props[t];if(c!=null&&(s=n?n(c):c))return s}}hasFocus(){if(Ss){let t=this.root.activeElement;if(t==this.dom)return!0;if(!t||!this.dom.contains(t))return!1;for(;t&&this.dom!=t&&this.dom.contains(t);){if(t.contentEditable=="false")return!1;t=t.parentElement}return!0}return this.root.activeElement==this.dom}focus(){this.domObserver.stop(),this.editable&&WEe(this.dom),il(this),this.domObserver.start()}get root(){let t=this._root;if(t==null){for(let n=this.dom.parentNode;n;n=n.parentNode)if(n.nodeType==9||n.nodeType==11&&n.host)return n.getSelection||(Object.getPrototypeOf(n).getSelection=()=>n.ownerDocument.getSelection()),this._root=n}return t||document}updateRoot(){this._root=null}posAtCoords(t){return eCe(this,t)}coordsAtPos(t,n=1){return q$(this,t,n)}domAtPos(t,n=0){return this.docView.domFromPos(t,n)}nodeDOM(t){let n=this.docView.descAt(t);return n?n.nodeDOM:null}posAtDOM(t,n,r=-1){let s=this.docView.posFromDOM(t,n,r);if(s==null)throw new RangeError("DOM position not inside the editor");return s}endOfTextblock(t,n){return oCe(this,n||this.state,t)}pasteHTML(t,n){return Jp(this,"",t,!1,n||new ClipboardEvent("paste"))}pasteText(t,n){return Jp(this,t,null,!0,n||new ClipboardEvent("paste"))}serializeForClipboard(t){return _N(this,t)}destroy(){this.docView&&(LCe(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],Ew(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,PEe())}get isDestroyed(){return this.docView==null}dispatchEvent(t){return jCe(this,t)}domSelectionRange(){let t=this.dom.isConnected!==!1&&this.domSelection();return t?Br&&this.root.nodeType===11&&$Ee(this.dom.ownerDocument)==this.dom&&l2e(this,t)||t:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}v7.prototype.dispatch=function(e){let t=this._props.dispatchTransaction;t?t.call(this,e):this.updateState(this.state.apply(e))};function Lj(e){let t=Object.create(null);return t.class="ProseMirror",t.contenteditable=String(e.editable),e.someProp("attributes",n=>{if(typeof n=="function"&&(n=n(e.state)),n)for(let r in n)r=="class"?t.class+=" "+n[r]:r=="style"?t.style=(t.style?t.style+";":"")+n[r]:!t[r]&&r!="contenteditable"&&r!="nodeName"&&(t[r]=String(n[r]))}),t.translate||(t.translate="no"),[Ro.node(0,e.state.doc.content.size,t)]}function Dj(e){if(e.markCursor){let t=document.createElement("img");t.className="ProseMirror-separator",t.setAttribute("mark-placeholder","true"),t.setAttribute("alt",""),e.cursorWrapper={dom:t,deco:Ro.widget(e.state.selection.from,t,{raw:!0,marks:e.markCursor})}}else e.cursorWrapper=null}function jj(e){return!e.someProp("editable",t=>t(e.state)===!1)}function x2e(e,t){let n=Math.min(e.$anchor.sharedDepth(e.head),t.$anchor.sharedDepth(t.head));return e.$anchor.start(n)!=t.$anchor.start(n)}function Pj(e){let t=Object.create(null);function n(r){for(let s in r)Object.prototype.hasOwnProperty.call(t,s)||(t[s]=r[s])}return e.someProp("nodeViews",n),e.someProp("markViews",n),t}function b2e(e,t){let n=0,r=0;for(let s in e){if(e[s]!=t[s])return!0;n++}for(let s in t)r++;return n!=r}function zj(e){if(e.spec.state||e.spec.filterTransaction||e.spec.appendTransaction)throw new RangeError("Plugins passed directly to the view must not have a state component")}var Ga={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},Ox={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},v2e=typeof navigator<"u"&&/Mac/.test(navigator.platform),S2e=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var Cr=0;Cr<10;Cr++)Ga[48+Cr]=Ga[96+Cr]=String(Cr);for(var Cr=1;Cr<=24;Cr++)Ga[Cr+111]="F"+Cr;for(var Cr=65;Cr<=90;Cr++)Ga[Cr]=String.fromCharCode(Cr+32),Ox[Cr]=String.fromCharCode(Cr);for(var Tw in Ga)Ox.hasOwnProperty(Tw)||(Ox[Tw]=Ga[Tw]);function w2e(e){var t=v2e&&e.metaKey&&e.shiftKey&&!e.ctrlKey&&!e.altKey||S2e&&e.shiftKey&&e.key&&e.key.length==1||e.key=="Unidentified",n=!t&&e.key||(e.shiftKey?Ox:Ga)[e.keyCode]||e.key||"Unidentified";return n=="Esc"&&(n="Escape"),n=="Del"&&(n="Delete"),n=="Left"&&(n="ArrowLeft"),n=="Up"&&(n="ArrowUp"),n=="Right"&&(n="ArrowRight"),n=="Down"&&(n="ArrowDown"),n}const E2e=typeof navigator<"u"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),C2e=typeof navigator<"u"&&/Win/.test(navigator.platform);function T2e(e){let t=e.split(/-(?!$)/),n=t[t.length-1];n=="Space"&&(n=" ");let r,s,o,l;for(let c=0;c<t.length-1;c++){let u=t[c];if(/^(cmd|meta|m)$/i.test(u))l=!0;else if(/^a(lt)?$/i.test(u))r=!0;else if(/^(c|ctrl|control)$/i.test(u))s=!0;else if(/^s(hift)?$/i.test(u))o=!0;else if(/^mod$/i.test(u))E2e?l=!0:s=!0;else throw new Error("Unrecognized modifier name: "+u)}return r&&(n="Alt-"+n),s&&(n="Ctrl-"+n),l&&(n="Meta-"+n),o&&(n="Shift-"+n),n}function N2e(e){let t=Object.create(null);for(let n in e)t[T2e(n)]=e[n];return t}function Nw(e,t,n=!0){return t.altKey&&(e="Alt-"+e),t.ctrlKey&&(e="Ctrl-"+e),t.metaKey&&(e="Meta-"+e),n&&t.shiftKey&&(e="Shift-"+e),e}function O2e(e){return new Gs({props:{handleKeyDown:R2e(e)}})}function R2e(e){let t=N2e(e);return function(n,r){let s=w2e(r),o,l=t[Nw(s,r)];if(l&&l(n.state,n.dispatch,n))return!0;if(s.length==1&&s!=" "){if(r.shiftKey){let c=t[Nw(s,r,!1)];if(c&&c(n.state,n.dispatch,n))return!0}if((r.altKey||r.metaKey||r.ctrlKey)&&!(C2e&&r.ctrlKey&&r.altKey)&&(o=Ga[r.keyCode])&&o!=s){let c=t[Nw(o,r)];if(c&&c(n.state,n.dispatch,n))return!0}}return!1}}var Rx=200,lr=function(){};lr.prototype.append=function(t){return t.length?(t=lr.from(t),!this.length&&t||t.length<Rx&&this.leafAppend(t)||this.length<Rx&&t.leafPrepend(this)||this.appendInner(t)):this};lr.prototype.prepend=function(t){return t.length?lr.from(t).append(this):this};lr.prototype.appendInner=function(t){return new A2e(this,t)};lr.prototype.slice=function(t,n){return t===void 0&&(t=0),n===void 0&&(n=this.length),t>=n?lr.empty:this.sliceInner(Math.max(0,t),Math.min(this.length,n))};lr.prototype.get=function(t){if(!(t<0||t>=this.length))return this.getInner(t)};lr.prototype.forEach=function(t,n,r){n===void 0&&(n=0),r===void 0&&(r=this.length),n<=r?this.forEachInner(t,n,r,0):this.forEachInvertedInner(t,n,r,0)};lr.prototype.map=function(t,n,r){n===void 0&&(n=0),r===void 0&&(r=this.length);var s=[];return this.forEach(function(o,l){return s.push(t(o,l))},n,r),s};lr.from=function(t){return t instanceof lr?t:t&&t.length?new S7(t):lr.empty};var S7=(function(e){function t(r){e.call(this),this.values=r}e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t;var n={length:{configurable:!0},depth:{configurable:!0}};return t.prototype.flatten=function(){return this.values},t.prototype.sliceInner=function(s,o){return s==0&&o==this.length?this:new t(this.values.slice(s,o))},t.prototype.getInner=function(s){return this.values[s]},t.prototype.forEachInner=function(s,o,l,c){for(var u=o;u<l;u++)if(s(this.values[u],c+u)===!1)return!1},t.prototype.forEachInvertedInner=function(s,o,l,c){for(var u=o-1;u>=l;u--)if(s(this.values[u],c+u)===!1)return!1},t.prototype.leafAppend=function(s){if(this.length+s.length<=Rx)return new t(this.values.concat(s.flatten()))},t.prototype.leafPrepend=function(s){if(this.length+s.length<=Rx)return new t(s.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(t.prototype,n),t})(lr);lr.empty=new S7([]);var A2e=(function(e){function t(n,r){e.call(this),this.left=n,this.right=r,this.length=n.length+r.length,this.depth=Math.max(n.depth,r.depth)+1}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},t.prototype.getInner=function(r){return r<this.left.length?this.left.get(r):this.right.get(r-this.left.length)},t.prototype.forEachInner=function(r,s,o,l){var c=this.left.length;if(s<c&&this.left.forEachInner(r,s,Math.min(o,c),l)===!1||o>c&&this.right.forEachInner(r,Math.max(s-c,0),Math.min(this.length,o)-c,l+c)===!1)return!1},t.prototype.forEachInvertedInner=function(r,s,o,l){var c=this.left.length;if(s>c&&this.right.forEachInvertedInner(r,s-c,Math.max(o,c)-c,l+c)===!1||o<c&&this.left.forEachInvertedInner(r,Math.min(s,c),o,l)===!1)return!1},t.prototype.sliceInner=function(r,s){if(r==0&&s==this.length)return this;var o=this.left.length;return s<=o?this.left.slice(r,s):r>=o?this.right.slice(r-o,s-o):this.left.slice(r,o).append(this.right.slice(0,s-o))},t.prototype.leafAppend=function(r){var s=this.right.leafAppend(r);if(s)return new t(this.left,s)},t.prototype.leafPrepend=function(r){var s=this.left.leafPrepend(r);if(s)return new t(s,this.right)},t.prototype.appendInner=function(r){return this.left.depth>=Math.max(this.right.depth,r.depth)+1?new t(this.left,new t(this.right,r)):new t(this,r)},t})(lr);const k2e=500;class Co{constructor(t,n){this.items=t,this.eventCount=n}popEvent(t,n){if(this.eventCount==0)return null;let r=this.items.length;for(;;r--)if(this.items.get(r-1).selection){--r;break}let s,o;n&&(s=this.remapping(r,this.items.length),o=s.maps.length);let l=t.tr,c,u,f=[],h=[];return this.items.forEach((p,y)=>{if(!p.step){s||(s=this.remapping(r,y+1),o=s.maps.length),o--,h.push(p);return}if(s){h.push(new Wo(p.map));let x=p.step.map(s.slice(o)),b;x&&l.maybeStep(x).doc&&(b=l.mapping.maps[l.mapping.maps.length-1],f.push(new Wo(b,void 0,void 0,f.length+h.length))),o--,b&&s.appendMap(b,o)}else l.maybeStep(p.step);if(p.selection)return c=s?p.selection.map(s.slice(o)):p.selection,u=new Co(this.items.slice(0,r).append(h.reverse().concat(f)),this.eventCount-1),!1},this.items.length,0),{remaining:u,transform:l,selection:c}}addTransform(t,n,r,s){let o=[],l=this.eventCount,c=this.items,u=!s&&c.length?c.get(c.length-1):null;for(let h=0;h<t.steps.length;h++){let p=t.steps[h].invert(t.docs[h]),y=new Wo(t.mapping.maps[h],p,n),x;(x=u&&u.merge(y))&&(y=x,h?o.pop():c=c.slice(0,c.length-1)),o.push(y),n&&(l++,n=void 0),s||(u=y)}let f=l-r.depth;return f>M2e&&(c=_2e(c,f),l-=f),new Co(c.append(o),l)}remapping(t,n){let r=new Xp;return this.items.forEach((s,o)=>{let l=s.mirrorOffset!=null&&o-s.mirrorOffset>=t?r.maps.length-s.mirrorOffset:void 0;r.appendMap(s.map,l)},t,n),r}addMaps(t){return this.eventCount==0?this:new Co(this.items.append(t.map(n=>new Wo(n))),this.eventCount)}rebased(t,n){if(!this.eventCount)return this;n=Math.min(this.items.length,n);let r=[],s=this.items.length-n,o=t.mapping,l=t.steps.length,c=this.eventCount;this.items.forEach(y=>{y.selection&&c--},s);let u=n;this.items.forEach(y=>{let x=o.getMirror(--u);if(x==null)return;l=Math.min(l,x);let b=o.maps[x];if(y.step){let S=t.steps[x].invert(t.docs[x]),E=y.selection&&y.selection.map(o.slice(u+1,x));E&&c++,r.push(new Wo(b,S,E))}else r.push(new Wo(b))},s);let f=[];for(let y=n;y<l;y++)f.push(new Wo(o.maps[y]));let h=this.items.slice(0,s).append(f).append(r),p=new Co(h,c);return p.emptyItemCount()>k2e&&(p=p.compress(this.items.length-r.length)),p}emptyItemCount(){let t=0;return this.items.forEach(n=>{n.step||t++}),t}compress(t=this.items.length){let n=this.remapping(0,t),r=n.maps.length,s=[],o=0;return this.items.forEach((l,c)=>{if(c>=t)s.push(l),l.selection&&o++;else if(l.step){let u=l.step.map(n.slice(r)),f=u&&u.getMap();if(r--,f&&n.appendMap(f,r),u){let h=l.selection&&l.selection.map(n.slice(r));h&&o++;let p=new Wo(f.invert(),u,h),y,x=s.length-1;(y=s.length&&s[x].merge(p))?s[x]=y:s.push(p)}}else l.map&&r--},this.items.length,0),new Co(lr.from(s.reverse()),o)}}Co.empty=new Co(lr.empty,0);function _2e(e,t){let n;return e.forEach((r,s)=>{if(r.selection&&t--==0)return n=s,!1}),e.slice(n)}class Wo{constructor(t,n,r,s){this.map=t,this.step=n,this.selection=r,this.mirrorOffset=s}merge(t){if(this.step&&t.step&&!t.selection){let n=t.step.merge(this.step);if(n)return new Wo(n.getMap().invert(),n,this.selection)}}}class ua{constructor(t,n,r,s,o){this.done=t,this.undone=n,this.prevRanges=r,this.prevTime=s,this.prevComposition=o}}const M2e=20;function I2e(e,t,n,r){let s=n.getMeta(Da),o;if(s)return s.historyState;n.getMeta(w7)&&(e=new ua(e.done,e.undone,null,0,-1));let l=n.getMeta("appendedTransaction");if(n.steps.length==0)return e;if(l&&l.getMeta(Da))return l.getMeta(Da).redo?new ua(e.done.addTransform(n,void 0,r,Ry(t)),e.undone,Bj(n.mapping.maps),e.prevTime,e.prevComposition):new ua(e.done,e.undone.addTransform(n,void 0,r,Ry(t)),null,e.prevTime,e.prevComposition);if(n.getMeta("addToHistory")!==!1&&!(l&&l.getMeta("addToHistory")===!1)){let c=n.getMeta("composition"),u=e.prevTime==0||!l&&e.prevComposition!=c&&(e.prevTime<(n.time||0)-r.newGroupDelay||!L2e(n,e.prevRanges)),f=l?Ow(e.prevRanges,n.mapping):Bj(n.mapping.maps);return new ua(e.done.addTransform(n,u?t.selection.getBookmark():void 0,r,Ry(t)),Co.empty,f,n.time,c??e.prevComposition)}else return(o=n.getMeta("rebased"))?new ua(e.done.rebased(n,o),e.undone.rebased(n,o),Ow(e.prevRanges,n.mapping),e.prevTime,e.prevComposition):new ua(e.done.addMaps(n.mapping.maps),e.undone.addMaps(n.mapping.maps),Ow(e.prevRanges,n.mapping),e.prevTime,e.prevComposition)}function L2e(e,t){if(!t)return!1;if(!e.docChanged)return!0;let n=!1;return e.mapping.maps[0].forEach((r,s)=>{for(let o=0;o<t.length;o+=2)r<=t[o+1]&&s>=t[o]&&(n=!0)}),n}function Bj(e){let t=[];for(let n=e.length-1;n>=0&&t.length==0;n--)e[n].forEach((r,s,o,l)=>t.push(o,l));return t}function Ow(e,t){if(!e)return null;let n=[];for(let r=0;r<e.length;r+=2){let s=t.map(e[r],1),o=t.map(e[r+1],-1);s<=o&&n.push(s,o)}return n}function D2e(e,t,n){let r=Ry(t),s=Da.get(t).spec.config,o=(n?e.undone:e.done).popEvent(t,r);if(!o)return null;let l=o.selection.resolve(o.transform.doc),c=(n?e.done:e.undone).addTransform(o.transform,t.selection.getBookmark(),s,r),u=new ua(n?c:o.remaining,n?o.remaining:c,null,0,-1);return o.transform.setSelection(l).setMeta(Da,{redo:n,historyState:u})}let Rw=!1,Hj=null;function Ry(e){let t=e.plugins;if(Hj!=t){Rw=!1,Hj=t;for(let n=0;n<t.length;n++)if(t[n].spec.historyPreserveItems){Rw=!0;break}}return Rw}function j2e(e){return e.setMeta(w7,!0)}const Da=new Lo("history"),w7=new Lo("closeHistory");function e_e(e={}){return e={depth:e.depth||100,newGroupDelay:e.newGroupDelay||500},new Gs({key:Da,state:{init(){return new ua(Co.empty,Co.empty,null,0,-1)},apply(t,n,r){return I2e(n,r,t,e)}},config:e,props:{handleDOMEvents:{beforeinput(t,n){let r=n.inputType,s=r=="historyUndo"?P2e:r=="historyRedo"?z2e:null;return!s||!t.editable?!1:(n.preventDefault(),s(t.state,t.dispatch))}}}})}function E7(e,t){return(n,r)=>{let s=Da.getState(n);if(!s||(e?s.undone:s.done).eventCount==0)return!1;if(r){let o=D2e(s,n,e);o&&r(t?o.scrollIntoView():o)}return!0}}const P2e=E7(!1,!0),z2e=E7(!0,!0);function t_e(e){return e.getMeta(Da)!=null}function Ub(e){const{state:t,transaction:n}=e;let{selection:r}=n,{doc:s}=n,{storedMarks:o}=n;return{...t,apply:t.apply.bind(t),applyTransaction:t.applyTransaction.bind(t),plugins:t.plugins,schema:t.schema,reconfigure:t.reconfigure.bind(t),toJSON:t.toJSON.bind(t),get storedMarks(){return o},get selection(){return r},get doc(){return s},get tr(){return r=n.selection,s=n.doc,o=n.storedMarks,n}}}var qd=class C7{constructor(t){this.editor=t.editor,this.rawCommands=this.editor.extensionManager.commands,this.customState=t.state}get hasCustomState(){return!!this.customState}get state(){return this.customState||this.editor.state}get commands(){const{rawCommands:t,editor:n,state:r}=this,{view:s}=n,{tr:o}=r,l=this.buildProps(o);return Object.fromEntries(Object.entries(t).map(([c,u])=>[c,(...h)=>{const p=u(...h)(l);return!o.getMeta("preventDispatch")&&!this.hasCustomState&&s.dispatch(o),p}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(t,n=!0){const{rawCommands:r,editor:s,state:o}=this,{view:l}=s,c=[],u=!!t,f=t||o.tr,h=()=>(!u&&n&&!f.getMeta("preventDispatch")&&!this.hasCustomState&&l.dispatch(f),c.every(y=>y===!0)),p={...Object.fromEntries(Object.entries(r).map(([y,x])=>[y,(...S)=>{const E=this.buildProps(f,n),C=x(...S)(E);return c.push(C),p}])),run:h};return p}static createFakeChain(){const t=new Proxy({},{get:(n,r)=>{if(r!=="then")return r==="run"?()=>!1:()=>t}});return t}createCan(t){const{rawCommands:n,state:r}=this,s=!1,o=t||r.tr,l=this.buildProps(o,s);return{...Object.fromEntries(Object.entries(n).map(([c,u])=>[c,(...f)=>u(...f)({...l,dispatch:void 0})])),chain:()=>this.createChain(o,s)}}static createFallbackCan(){const t=C7.createFakeChain();return new Proxy({chain:()=>t},{get:(n,r)=>{if(r!=="then")return r==="chain"?n.chain:()=>!1}})}buildProps(t,n=!0){const{rawCommands:r,editor:s,state:o}=this,{view:l}=s,c={tr:t,editor:s,view:l,state:Ub({state:o,transaction:t}),dispatch:n?()=>{}:void 0,chain:()=>this.createChain(t,n),can:()=>this.createCan(t),get commands(){return Object.fromEntries(Object.entries(r).map(([u,f])=>[u,(...h)=>f(...h)(c)]))}};return c}};const B2e=()=>({editor:e,view:t})=>(requestAnimationFrame(()=>{if(!e.isDestroyed){var n;t.dom.blur(),(n=window)===null||n===void 0||(n=n.getSelection())===null||n===void 0||n.removeAllRanges()}}),!0),H2e=(e=!0)=>({commands:t})=>t.setContent("",{emitUpdate:e}),F2e=()=>({state:e,tr:t,dispatch:n})=>{const{selection:r}=t,{ranges:s}=r;return n&&s.forEach(({$from:o,$to:l})=>{e.doc.nodesBetween(o.pos,l.pos,(c,u)=>{if(c.type.isText)return;const{doc:f,mapping:h}=t,p=f.resolve(h.map(u)),y=f.resolve(h.map(u+c.nodeSize)),x=p.blockRange(y);if(!x)return;const b=Bf(x);if(c.type.isTextblock){const{defaultType:S}=p.parent.contentMatchAt(p.index());t.setNodeMarkup(x.start,S)}(b||b===0)&&t.lift(x,b)})}),!0},$2e=e=>t=>e(t),U2e=()=>({state:e,dispatch:t})=>L$(e,t),V2e=(e,t)=>({editor:n,tr:r})=>{const{state:s}=n,o=s.doc.slice(e.from,e.to);r.deleteRange(e.from,e.to);const l=r.mapping.map(t);return r.insert(l,o.content),r.setSelection(new ft(r.doc.resolve(Math.max(l-1,0)))),!0},q2e=()=>({tr:e,dispatch:t})=>{const{selection:n}=e,r=n.$anchor.node();if(r.content.size>0)return!1;const s=e.selection.$anchor;for(let o=s.depth;o>0;o-=1)if(s.node(o).type===r.type){if(t){const l=s.before(o),c=s.after(o);e.delete(l,c).scrollIntoView()}return!0}return!1};function ar(e,t){if(typeof e=="string"){if(!t.nodes[e])throw Error(`There is no node type named '${e}'. Maybe you forgot to add the extension?`);return t.nodes[e]}return e}const G2e=e=>({tr:t,state:n,dispatch:r})=>{const s=ar(e,n.schema),o=t.selection.$anchor;for(let l=o.depth;l>0;l-=1)if(o.node(l).type===s){if(r){const c=o.before(l),u=o.after(l);t.delete(c,u).scrollIntoView()}return!0}return!1},K2e=e=>({tr:t,dispatch:n})=>{const{from:r,to:s}=e;return n&&t.delete(r,s),!0},Y2e=e=>e.content?/^text(\*|\+)/.test(e.content):!1,Fj=(e,t,n)=>{if(!e.parent.isInline||n==="left"&&e.pos>e.start()||n==="right"&&e.pos<e.end())return e.pos;const r=t.nodes[e.parent.type.name].spec;return Y2e(r)?n==="left"?e.start()-1:e.end()+1:e.pos},W2e=(e,t,n)=>({from:Fj(e,n,"left"),to:Fj(t,n,"right")}),X2e=()=>({state:e,dispatch:t})=>{if(e.selection.empty)return!1;if(t){const n=e.tr,{ranges:r}=e.selection,s=n.steps.length;r.forEach(o=>{const l=n.mapping.slice(s),c=n.doc.resolve(l.map(o.$from.pos)),u=n.doc.resolve(l.map(o.$to.pos)),{from:f,to:h}=W2e(c,u,e.schema);n.deleteRange(f,h)}),n.selection.empty||n.setSelection(ft.near(n.doc.resolve(n.selection.from))),n.scrollIntoView(),t(n)}return!0},Q2e=()=>({commands:e})=>e.keyboardShortcut("Enter"),Z2e=()=>({state:e,dispatch:t})=>wEe(e,t);function PN(e){return Object.prototype.toString.call(e)==="[object RegExp]"}function Ax(e,t,n={strict:!0}){const r=Object.keys(t);return r.length?r.every(s=>n.strict?t[s]===e[s]:PN(t[s])?t[s].test(e[s]):t[s]===e[s]):!0}function T7(e,t,n={}){return e.find(r=>r.type===t&&Ax(Object.fromEntries(Object.keys(n).map(s=>[s,r.attrs[s]])),n))}function $j(e,t,n={}){return!!T7(e,t,n)}function zN(e,t,n){if(!e||!t)return;let r=e.parent.childAfter(e.parentOffset);if((!r.node||!r.node.marks.some(u=>u.type===t))&&(r=e.parent.childBefore(e.parentOffset)),!r.node||!r.node.marks.some(u=>u.type===t))return;if(!n){const u=r.node.marks.find(f=>f.type===t);u&&(n=u.attrs)}if(!T7([...r.node.marks],t,n))return;let s=r.index,o=e.start()+r.offset,l=s+1,c=o+r.node.nodeSize;for(;s>0&&$j([...e.parent.child(s-1).marks],t,n);)s-=1,o-=e.parent.child(s).nodeSize;for(;l<e.parent.childCount&&$j([...e.parent.child(l).marks],t,n);)c+=e.parent.child(l).nodeSize,l+=1;return{from:o,to:c}}function Sl(e,t){if(typeof e=="string"){if(!t.marks[e])throw Error(`There is no mark type named '${e}'. Maybe you forgot to add the extension?`);return t.marks[e]}return e}const J2e=(e,t)=>({tr:n,state:r,dispatch:s})=>{const o=Sl(e,r.schema),{doc:l,selection:c}=n,{$from:u,from:f,to:h}=c;if(s){const p=zN(u,o,t);if(p&&p.from<=f&&p.to>=h){const y=ft.create(l,p.from,p.to);n.setSelection(y)}}return!0},eTe=e=>t=>{const n=typeof e=="function"?e(t):e;for(let r=0;r<n.length;r+=1)if(n[r](t))return!0;return!1};function N7(e){return e instanceof ft}function Hc(e=0,t=0,n=0){return Math.min(Math.max(e,t),n)}function UC(e,t=null){if(!t)return null;const n=Rt.atStart(e),r=Rt.atEnd(e);if(t==="start"||t===!0)return n;if(t==="end")return r;const s=n.from,o=r.to;return t==="all"?ft.create(e,Hc(0,s,o),Hc(e.content.size,s,o)):ft.create(e,Hc(t,s,o),Hc(t,s,o))}function VC(){return["Android"].includes(navigator.platform)||/android/i.test(navigator.userAgent)}function tm(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}function tTe(){return typeof navigator<"u"?/^((?!chrome|android).)*safari/i.test(navigator.userAgent):!1}const nTe=(e=null,t={})=>({editor:n,view:r,tr:s,dispatch:o})=>{t={scrollIntoView:!0,...t};const l=()=>{(tm()||VC())&&r.dom.focus(),tTe()&&!tm()&&!VC()&&r.dom.focus({preventScroll:!0}),requestAnimationFrame(()=>{n.isDestroyed||(r.focus(),t!=null&&t.scrollIntoView&&n.commands.scrollIntoView())})};try{if(r.hasFocus()&&e===null||e===!1)return!0}catch{return!1}if(o&&e===null&&!N7(n.state.selection))return l(),!0;const c=UC(s.doc,e)||n.state.selection,u=n.state.selection.eq(c);return o&&(u||s.setSelection(c),u&&s.storedMarks&&s.setStoredMarks(s.storedMarks),l()),!0},rTe=(e,t)=>n=>e.every((r,s)=>t(r,{...n,index:s})),sTe=(e,t)=>({tr:n,commands:r})=>r.insertContentAt({from:n.selection.from,to:n.selection.to},e,t),O7=e=>{const t=e.childNodes;for(let n=t.length-1;n>=0;n-=1){const r=t[n];r.nodeType===3&&r.nodeValue&&/^(\n\s\s|\n)$/.test(r.nodeValue)?e.removeChild(r):r.nodeType===1&&O7(r)}return e};function rp(e){if(typeof window>"u")throw new Error("[tiptap error]: there is no window object available, so this function cannot be used");const t=`<body>${e}</body>`,n=new window.DOMParser().parseFromString(t,"text/html").body;return O7(n)}function R7(e){return typeof(e==null?void 0:e.nodesBetween)=="function"}function Tf(e,t,n){if(R7(e))return e;const r=typeof e=="object"&&e!==null;n={slice:!0,parseOptions:{},...n};const s=typeof e=="string";if(r)try{if(Array.isArray(e)&&e.length>0)return Ie.fromArray(e.map(l=>t.nodeFromJSON(l)));const o=t.nodeFromJSON(e);return n.errorOnInvalidContent&&o.check(),o}catch(o){if(n.errorOnInvalidContent)throw new Error("[tiptap error]: Invalid JSON content",{cause:o});return console.warn("[tiptap warn]: Invalid content.","Passed value:",e,"Error:",o),Tf("",t,n)}if(s){if(n.errorOnInvalidContent){let l=!1,c="";const u=new l$({topNode:t.spec.topNode,marks:t.spec.marks,nodes:t.spec.nodes.append({__tiptap__private__unknown__catch__all__node:{content:"inline*",group:"block",parseDOM:[{tag:"*",getAttrs:f=>(l=!0,c=typeof f=="string"?f:f.outerHTML,null)}]}})});if(n.slice?sl.fromSchema(u).parseSlice(rp(e),n.parseOptions):sl.fromSchema(u).parse(rp(e),n.parseOptions),n.errorOnInvalidContent&&l)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${c}`)})}const o=sl.fromSchema(t);return n.slice?o.parseSlice(rp(e),n.parseOptions).content:o.parse(rp(e),n.parseOptions)}return Tf("",t,n)}function A7(e){return!("type"in e)}function k7(e,t,n){const r=e.steps.length-1;if(r<t)return;const s=e.steps[r];if(!(s instanceof _n||s instanceof ir))return;const o=e.mapping.maps[r];let l=0;o.forEach((c,u,f,h)=>{l===0&&(l=h)}),e.setSelection(Rt.near(e.doc.resolve(l),n))}const oTe=(e,t,n)=>({tr:r,dispatch:s,editor:o})=>{if(s){n={parseOptions:o.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...n};let c;const u=E=>{o.emit("contentError",{editor:o,error:E,disableCollaboration:()=>{"collaboration"in o.storage&&typeof o.storage.collaboration=="object"&&o.storage.collaboration&&(o.storage.collaboration.isDisabled=!0)}})},f={preserveWhitespace:"full",...n.parseOptions};if(!n.errorOnInvalidContent&&!o.options.enableContentCheck&&o.options.emitContentError)try{Tf(t,o.schema,{parseOptions:f,errorOnInvalidContent:!0})}catch(E){u(E)}try{var l;c=Tf(t,o.schema,{parseOptions:f,errorOnInvalidContent:(l=n.errorOnInvalidContent)!==null&&l!==void 0?l:o.options.enableContentCheck})}catch(E){return u(E),!1}let{from:h,to:p}=typeof e=="number"?{from:e,to:e}:{from:e.from,to:e.to},y=!0,x=!0;const b=A7(c)?c.content:[c];if(b.forEach(E=>{E.check(),y=y?E.isText&&E.marks.length===0:!1,x=x?E.isBlock:!1}),h===p&&x){const{parent:E}=r.doc.resolve(h);E.isTextblock&&!E.type.spec.code&&!E.childCount&&(h-=1,p+=1)}let S;if(y)Array.isArray(t)?S=t.map(E=>E.text||"").join(""):R7(t)?S=b.map(E=>{var C;return(C=E.text)!==null&&C!==void 0?C:""}).join(""):typeof t=="object"&&t&&t.text?S=t.text:S=t,r.insertText(S,h,p);else{S=Ie.from(b);const E=r.doc.resolve(h),C=E.node(),O=E.parentOffset===0,T=C.isText||C.isTextblock,R=C.content.size>0;O&&T&&R&&x&&(h=Math.max(0,h-1)),r.replaceWith(h,p,b)}n.updateSelection&&k7(r,r.steps.length-1,-1),n.applyInputRules&&r.setMeta("applyInputRules",{from:h,text:S}),n.applyPasteRules&&r.setMeta("applyPasteRules",{from:h,text:S})}return!0};function _7(e){for(let t=0;t<e.edgeCount;t+=1){const{type:n}=e.edge(t);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}const iTe=(e={})=>({tr:t,dispatch:n,editor:r})=>{const{pos:s,attrs:o,content:l,updateSelection:c=!0}=e;let u;typeof s=="number"?u=t.doc.resolve(s):s?u=s:u=t.selection.$from;const f=_7(u.parent.contentMatchAt(u.index()));if(!f)return!1;const h=Object.keys(f.spec.attrs||{}),p=o?Object.fromEntries(Object.entries(o).filter(([x])=>h.includes(x))):{};let y;if(l){const x=Tf(l,r.schema);y=f.createAndFill(p,x)}else y=f.createAndFill(p);return y?(n&&(t.insert(u.pos,y),c&&k7(t,t.steps.length-1,-1)),!0):!1},lTe=()=>({state:e,dispatch:t})=>bEe(e,t),aTe=()=>({state:e,dispatch:t})=>vEe(e,t),cTe=()=>({state:e,dispatch:t})=>O$(e,t),uTe=()=>({state:e,dispatch:t})=>_$(e,t),M7=(e,t)=>{const n=e.resolve(t),r=n.nodeBefore,s=n.nodeAfter;return!r||!s?!1:!r.type.spec.isolating&&!s.type.spec.isolating},dTe=()=>({state:e,dispatch:t,tr:n})=>{try{const r=Pb(e.doc,e.selection.$from.pos,-1);return r==null||!M7(e.doc,r)?!1:(n.join(r,2),t&&t(n),!0)}catch{return!1}},fTe=()=>({state:e,dispatch:t,tr:n})=>{try{const r=Pb(e.doc,e.selection.$from.pos,1);return r==null||!M7(e.doc,r)?!1:(n.join(r,2),t&&t(n),!0)}catch{return!1}},hTe=()=>({state:e,dispatch:t})=>yEe(e,t),pTe=()=>({state:e,dispatch:t})=>xEe(e,t);function I7(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function mTe(e){const t=e.split(/-(?!$)/);let n=t[t.length-1];n==="Space"&&(n=" ");let r,s,o,l;for(let c=0;c<t.length-1;c+=1){const u=t[c];if(/^(cmd|meta|m)$/i.test(u))l=!0;else if(/^a(lt)?$/i.test(u))r=!0;else if(/^(c|ctrl|control)$/i.test(u))s=!0;else if(/^s(hift)?$/i.test(u))o=!0;else if(/^mod$/i.test(u))tm()||I7()?l=!0:s=!0;else throw new Error(`Unrecognized modifier name: ${u}`)}return r&&(n=`Alt-${n}`),s&&(n=`Ctrl-${n}`),l&&(n=`Meta-${n}`),o&&(n=`Shift-${n}`),n}const gTe=e=>({editor:t,view:n,tr:r,dispatch:s})=>{const o=mTe(e).split(/-(?!$)/),l=o.find(f=>!["Alt","Ctrl","Meta","Shift"].includes(f)),c=new KeyboardEvent("keydown",{key:l==="Space"?" ":l,altKey:o.includes("Alt"),ctrlKey:o.includes("Ctrl"),metaKey:o.includes("Meta"),shiftKey:o.includes("Shift"),bubbles:!0,cancelable:!0}),u=t.captureTransaction(()=>{n.someProp("handleKeyDown",f=>f(n,c))});return u==null||u.steps.forEach(f=>{const h=f.map(r.mapping);h&&s&&r.maybeStep(h)}),!0};function nm(e,t,n={}){const{from:r,to:s,empty:o}=e.selection,l=t?ar(t,e.schema):null,c=[];e.doc.nodesBetween(r,s,(h,p)=>{if(h.isText)return;const y=Math.max(r,p),x=Math.min(s,p+h.nodeSize);c.push({node:h,from:y,to:x})});const u=s-r,f=c.filter(h=>l?l.name===h.node.type.name:!0).filter(h=>Ax(h.node.attrs,n,{strict:!1}));return o?!!f.length:f.reduce((h,p)=>h+p.to-p.from,0)>=u}const yTe=(e,t={})=>({state:n,dispatch:r})=>nm(n,ar(e,n.schema),t)?SEe(n,r):!1,xTe=()=>({state:e,dispatch:t})=>D$(e,t),bTe=e=>({state:t,dispatch:n})=>{const r=ar(e,t.schema);return IEe(r)(t,n)},vTe=()=>({state:e,dispatch:t})=>I$(e,t);function Vb(e,t){return t.nodes[e]?"node":t.marks[e]?"mark":null}function Uj(e,t){const n=typeof t=="string"?[t]:t;return Object.keys(e).reduce((r,s)=>(n.includes(s)||(r[s]=e[s]),r),{})}const STe=(e,t)=>({tr:n,state:r,dispatch:s})=>{let o=null,l=null;const c=Vb(typeof e=="string"?e:e.name,r.schema);if(!c)return!1;c==="node"&&(o=ar(e,r.schema)),c==="mark"&&(l=Sl(e,r.schema));let u=!1;return n.selection.ranges.forEach(f=>{r.doc.nodesBetween(f.$from.pos,f.$to.pos,(h,p)=>{o&&o===h.type&&(u=!0,s&&n.setNodeMarkup(p,void 0,Uj(h.attrs,t))),l&&h.marks.length&&h.marks.forEach(y=>{l===y.type&&(u=!0,s&&n.addMark(p,p+h.nodeSize,l.create(Uj(y.attrs,t))))})})}),u},wTe=()=>({tr:e,dispatch:t})=>(t&&e.scrollIntoView(),!0),ETe=()=>({tr:e,dispatch:t})=>{if(t){const n=new Hs(e.doc);e.setSelection(n)}return!0},CTe=()=>({state:e,dispatch:t})=>A$(e,t),TTe=()=>({state:e,dispatch:t})=>M$(e,t),NTe=()=>({state:e,dispatch:t})=>TEe(e,t),OTe=()=>({state:e,dispatch:t})=>REe(e,t),RTe=()=>({state:e,dispatch:t})=>OEe(e,t);function qC(e,t,n={},r={}){return Tf(e,t,{slice:!1,parseOptions:n,errorOnInvalidContent:r.errorOnInvalidContent})}const ATe=(e,{errorOnInvalidContent:t,emitUpdate:n=!0,parseOptions:r={}}={})=>({editor:s,tr:o,dispatch:l,commands:c})=>{const{doc:u}=o;if(r.preserveWhitespace!=="full"){const f=qC(e,s.schema,r,{errorOnInvalidContent:t??s.options.enableContentCheck});if(l){const h=A7(f)?f.content:[f];o.replaceWith(0,u.content.size,h).setMeta("preventUpdate",!n)}return!0}return l&&o.setMeta("preventUpdate",!n),c.insertContentAt({from:0,to:u.content.size},e,{parseOptions:r,errorOnInvalidContent:t??s.options.enableContentCheck})};function L7(e,t){const n=Sl(t,e.schema),{from:r,to:s,empty:o}=e.selection,l=[];o?(e.storedMarks&&l.push(...e.storedMarks),l.push(...e.selection.$head.marks())):e.doc.nodesBetween(r,s,u=>{l.push(...u.marks)});const c=l.find(u=>u.type.name===n.name);return c?{...c.attrs}:{}}function kTe(e,t){const n=new w$(e);return t.forEach(r=>{r.steps.forEach(s=>{n.step(s)})}),n}function n_e(e,t){const n=[];return e.descendants((r,s)=>{t(r)&&n.push({node:r,pos:s})}),n}function r_e(e,t,n){const r=[];return e.nodesBetween(t.from,t.to,(s,o)=>{n(s)&&r.push({node:s,pos:o})}),r}function _Te(e,t){for(let n=e.depth;n>0;n-=1){const r=e.node(n);if(t(r))return{pos:n>0?e.before(n):0,start:e.start(n),depth:n,node:r}}}function qb(e){return t=>_Te(t.$from,e)}function We(e,t,n){return e.config[t]===void 0&&e.parent?We(e.parent,t,n):typeof e.config[t]=="function"?e.config[t].bind({...n,parent:e.parent?We(e.parent,t,n):null}):e.config[t]}function BN(e){return e.map(t=>{const n=We(t,"addExtensions",{name:t.name,options:t.options,storage:t.storage});return n?[t,...BN(n())]:t}).flat(10)}function HN(e,t){const n=Au.fromSchema(t).serializeFragment(e),r=document.implementation.createHTMLDocument().createElement("div");return r.appendChild(n),r.innerHTML}function GC(e){return typeof e=="function"}function Kt(e,t=void 0,...n){return GC(e)?t?e.bind(t)(...n):e(...n):e}function MTe(e={}){return Object.keys(e).length===0&&e.constructor===Object}function Nf(e){return{baseExtensions:e.filter(t=>t.type==="extension"),nodeExtensions:e.filter(t=>t.type==="node"),markExtensions:e.filter(t=>t.type==="mark")}}function D7(e){const t=[],{nodeExtensions:n,markExtensions:r}=Nf(e),s=[...n,...r],o={default:null,validate:void 0,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1},l=n.filter(f=>f.name!=="text").map(f=>f.name),c=r.map(f=>f.name),u=[...l,...c];return e.forEach(f=>{const h=We(f,"addGlobalAttributes",{name:f.name,options:f.options,storage:f.storage,extensions:s});h&&h().forEach(p=>{let y;Array.isArray(p.types)?y=p.types:p.types==="*"?y=u:p.types==="nodes"?y=l:p.types==="marks"?y=c:y=[],y.forEach(x=>{Object.entries(p.attributes).forEach(([b,S])=>{t.push({type:x,name:b,attribute:{...o,...S}})})})})}),s.forEach(f=>{const h=We(f,"addAttributes",{name:f.name,options:f.options,storage:f.storage});if(!h)return;const p=h();Object.entries(p).forEach(([y,x])=>{const b={...o,...x};typeof(b==null?void 0:b.default)=="function"&&(b.default=b.default()),b!=null&&b.isRequired&&(b==null?void 0:b.default)===void 0&&delete b.default,t.push({type:f.name,name:y,attribute:b})})}),t}function ITe(e){const t=[];let n="",r=!1,s=!1,o=0;const l=e.length;for(let c=0;c<l;c+=1){const u=e[c];if(u==="'"&&!s){r=!r,n+=u;continue}if(u==='"'&&!r){s=!s,n+=u;continue}if(!r&&!s){if(u==="("){o+=1,n+=u;continue}if(u===")"&&o>0){o-=1,n+=u;continue}if(u===";"&&o===0){t.push(n),n="";continue}}n+=u}return n&&t.push(n),t}function Vj(e){const t=[],n=ITe(e||""),r=n.length;for(let s=0;s<r;s+=1){const o=n[s],l=o.indexOf(":");if(l===-1)continue;const c=o.slice(0,l).trim(),u=o.slice(l+1).trim();c&&u&&t.push([c,u])}return t}function LTe(...e){return e.filter(t=>!!t).reduce((t,n)=>{const r={...t};return Object.entries(n).forEach(([s,o])=>{if(s==="__proto__"){Object.defineProperty(r,s,{configurable:!0,enumerable:!0,value:o,writable:!0});return}if(!r[s]){r[s]=o;return}if(s==="class"){const l=o?String(o).split(" "):[],c=r[s]?r[s].split(" "):[],u=l.filter(f=>!c.includes(f));r[s]=[...c,...u].join(" ")}else if(s==="style"){const l=new Map([...Vj(r[s]),...Vj(o)]);r[s]=Array.from(l.entries()).map(([c,u])=>`${c}: ${u}`).join("; ")}else r[s]=o}),r},{})}function kx(e,t){return t.filter(n=>n.type===e.type.name).filter(n=>n.attribute.rendered).map(n=>n.attribute.renderHTML?n.attribute.renderHTML(e.attrs)||{}:{[n.name]:e.attrs[n.name]}).reduce((n,r)=>LTe(n,r),{})}function DTe(e){return typeof e!="string"?e:e.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(e):e==="true"?!0:e==="false"?!1:e}function qj(e,t){return"style"in e?e:{...e,getAttrs:n=>{const r=e.getAttrs?e.getAttrs(n):e.attrs;if(r===!1)return!1;const s=t.reduce((o,l)=>{const c=l.attribute.parseHTML?l.attribute.parseHTML(n):DTe(n.getAttribute(l.name));return c==null?o:{...o,[l.name]:c}},{});return{...r,...s}}}}function Gj(e){return Object.fromEntries(Object.entries(e).filter(([t,n])=>t==="attrs"&&MTe(n)?!1:n!=null))}function Kj(e){var t,n;const r={};return!(!(e==null||(t=e.attribute)===null||t===void 0)&&t.isRequired)&&"default"in((e==null?void 0:e.attribute)||{})&&(r.default=e.attribute.default),(e==null||(n=e.attribute)===null||n===void 0?void 0:n.validate)!==void 0&&(r.validate=e.attribute.validate),[e.name,r]}function j7(e,t){var n;const r=D7(e),{nodeExtensions:s,markExtensions:o}=Nf(e),l=(n=s.find(f=>We(f,"topNode")))===null||n===void 0?void 0:n.name,c=Object.fromEntries(s.map(f=>{const h=r.filter(E=>E.type===f.name),p={name:f.name,options:f.options,storage:f.storage,editor:t},y=Gj({...e.reduce((E,C)=>{const O=We(C,"extendNodeSchema",p);return{...E,...O?O(f):{}}},{}),content:Kt(We(f,"content",p)),marks:Kt(We(f,"marks",p)),group:Kt(We(f,"group",p)),inline:Kt(We(f,"inline",p)),atom:Kt(We(f,"atom",p)),selectable:Kt(We(f,"selectable",p)),draggable:Kt(We(f,"draggable",p)),code:Kt(We(f,"code",p)),whitespace:Kt(We(f,"whitespace",p)),linebreakReplacement:Kt(We(f,"linebreakReplacement",p)),defining:Kt(We(f,"defining",p)),isolating:Kt(We(f,"isolating",p)),attrs:Object.fromEntries(h.map(Kj))}),x=Kt(We(f,"parseHTML",p));x&&(y.parseDOM=x.map(E=>qj(E,h)));const b=We(f,"renderHTML",p);b&&(y.toDOM=E=>b({node:E,HTMLAttributes:kx(E,h)}));const S=We(f,"renderText",p);return S&&(y.toText=S),[f.name,y]})),u=Object.fromEntries(o.map(f=>{const h=r.filter(S=>S.type===f.name),p={name:f.name,options:f.options,storage:f.storage,editor:t},y=Gj({...e.reduce((S,E)=>{const C=We(E,"extendMarkSchema",p);return{...S,...C?C(f):{}}},{}),inclusive:Kt(We(f,"inclusive",p)),excludes:Kt(We(f,"excludes",p)),group:Kt(We(f,"group",p)),spanning:Kt(We(f,"spanning",p)),code:Kt(We(f,"code",p)),attrs:Object.fromEntries(h.map(Kj))}),x=Kt(We(f,"parseHTML",p));x&&(y.parseDOM=x.map(S=>qj(S,h)));const b=We(f,"renderHTML",p);return b&&(y.toDOM=S=>b({mark:S,HTMLAttributes:kx(S,h)})),[f.name,y]}));return new l$({topNode:l,nodes:c,marks:u})}function jTe(e){const t=e.filter((n,r)=>e.indexOf(n)!==r);return Array.from(new Set(t))}function xp(e){return e.sort((n,r)=>{const s=We(n,"priority")||100,o=We(r,"priority")||100;return s>o?-1:s<o?1:0})}function FN(e){const t=xp(BN(e)),n=jTe(t.map(r=>r.name));return n.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${n.map(r=>`'${r}'`).join(", ")}]. This can lead to issues.`),t}function PTe(e,t){return j7(FN(e),t)}function s_e(e,t){const n=PTe(t),r=rp(e);return sl.fromSchema(n).parse(r).toJSON()}function P7(e,t,n){const{from:r,to:s}=t,{blockSeparator:o=`
|
|
367
|
+
|
|
368
|
+
`,textSerializers:l={}}=n||{};let c="";return e.nodesBetween(r,s,(u,f,h,p)=>{u.isBlock&&f>r&&(c+=o);const y=l==null?void 0:l[u.type.name];if(y)return h&&(c+=y({node:u,pos:f,parent:h,index:p,range:t})),!1;if(u.isText){var x;c+=u==null||(x=u.text)===null||x===void 0?void 0:x.slice(Math.max(r,f)-f,s-f)}}),c}function zTe(e,t){return P7(e,{from:0,to:e.content.size},t)}function z7(e){return Object.fromEntries(Object.entries(e.nodes).filter(([,t])=>t.spec.toText).map(([t,n])=>[t,n.spec.toText]))}function BTe(e,t){const n=ar(t,e.schema),{from:r,to:s}=e.selection,o=[];e.doc.nodesBetween(r,s,c=>{o.push(c)});const l=o.reverse().find(c=>c.type.name===n.name);return l?{...l.attrs}:{}}function HTe(e,t){const n=Vb(typeof t=="string"?t:t.name,e.schema);return n==="node"?BTe(e,t):n==="mark"?L7(e,t):{}}function FTe(e,t=JSON.stringify){const n={};return e.filter(r=>{const s=t(r);return Object.prototype.hasOwnProperty.call(n,s)?!1:n[s]=!0})}function $Te(e){const t=FTe(e);return t.length===1?t:t.filter((n,r)=>!t.filter((s,o)=>o!==r).some(s=>n.oldRange.from>=s.oldRange.from&&n.oldRange.to<=s.oldRange.to&&n.newRange.from>=s.newRange.from&&n.newRange.to<=s.newRange.to))}function B7(e){const{mapping:t,steps:n}=e,r=[];return t.maps.forEach((s,o)=>{const l=[];if(s.ranges.length)s.forEach((c,u)=>{l.push({from:c,to:u})});else{const{from:c,to:u}=n[o];if(c===void 0||u===void 0)return;l.push({from:c,to:u})}l.forEach(({from:c,to:u})=>{const f=t.slice(o).map(c,-1),h=t.slice(o).map(u),p=t.invert().map(f,-1),y=t.invert().map(h);r.push({oldRange:{from:p,to:y},newRange:{from:f,to:h}})})}),$Te(r)}function H7(e,t,n){const r=[];return e===t?n.resolve(e).marks().forEach(s=>{const o=zN(n.resolve(e),s.type);o&&r.push({mark:s,...o})}):n.nodesBetween(e,t,(s,o)=>{!s||(s==null?void 0:s.nodeSize)===void 0||r.push(...s.marks.map(l=>({from:o,to:o+s.nodeSize,mark:l})))}),r}const o_e=(e,t,n,r=20)=>{const s=e.doc.resolve(n);let o=r,l=null;for(;o>0&&l===null;){const c=s.node(o);(c==null?void 0:c.type.name)===t?l=c:o-=1}return[l,o]},i_e=e=>{const t=e.depth-1;if(t<0)return null;const n=e.index(t);return n===0?null:e.node(t).child(n-1)};function Sd(e,t){return t.nodes[e]||t.marks[e]||null}function Ay(e,t,n){return Object.fromEntries(Object.entries(n).filter(([r])=>{const s=e.find(o=>o.type===t&&o.name===r);return s?s.attribute.keepOnSplit:!1}))}const UTe=(e,t=500)=>{let n="";const r=e.parentOffset;return e.parent.nodesBetween(Math.max(0,r-t),r,(s,o,l,c)=>{var u,f;const h=((u=(f=s.type.spec).toText)===null||u===void 0?void 0:u.call(f,{node:s,pos:o,parent:l,index:c}))||s.textContent||"%leaf%";n+=s.isAtom&&!s.isText?h:h.slice(0,Math.max(0,r-o))}),n};function KC(e,t,n={}){const{empty:r,ranges:s}=e.selection,o=t?Sl(t,e.schema):null;if(r)return!!(e.storedMarks||e.selection.$from.marks()).filter(h=>o?o.name===h.type.name:!0).find(h=>Ax(h.attrs,n,{strict:!1}));let l=0;const c=[];if(s.forEach(({$from:h,$to:p})=>{const y=h.pos,x=p.pos;e.doc.nodesBetween(y,x,(b,S)=>{if(o&&b.inlineContent&&!b.type.allowsMarkType(o))return!1;if(!b.isText&&!b.marks.length)return;const E=Math.max(y,S),C=Math.min(x,S+b.nodeSize),O=C-E;l+=O,c.push(...b.marks.map(T=>({mark:T,from:E,to:C})))})}),l===0)return!1;const u=c.filter(h=>o?o.name===h.mark.type.name:!0).filter(h=>Ax(h.mark.attrs,n,{strict:!1})).reduce((h,p)=>h+p.to-p.from,0),f=c.filter(h=>o?h.mark.type!==o&&h.mark.type.excludes(o):!0).reduce((h,p)=>h+p.to-p.from,0);return(u>0?u+f:u)>=l}function VTe(e,t,n={}){if(!t)return nm(e,null,n)||KC(e,null,n);const r=Vb(t,e.schema);return r==="node"?nm(e,t,n):r==="mark"?KC(e,t,n):!1}const l_e=(e,t)=>{const{$from:n,$to:r,$anchor:s}=e.selection;if(t){const o=qb(c=>c.type.name===t)(e.selection);if(!o)return!1;const l=e.doc.resolve(o.pos+1);return s.pos+1===l.end()}return!(r.parentOffset<r.parent.nodeSize-2||n.pos!==r.pos)},a_e=e=>{const{$from:t,$to:n}=e.selection;return!(t.parentOffset>0||t.pos!==n.pos)};function Yj(e,t){return Array.isArray(t)?t.some(n=>(typeof n=="string"?n:n.name)===e.name):t}function Aw(e,t){const{nodeExtensions:n}=Nf(t),r=n.find(o=>o.name===e);if(!r)return!1;const s=Kt(We(r,"group",{name:r.name,options:r.options,storage:r.storage}));return typeof s!="string"?!1:s.split(" ").includes("list")}function $N(e,{checkChildren:t=!0,ignoreWhitespace:n=!1}={}){if(n){if(e.type.name==="hardBreak")return!0;if(e.isText){var r;return!/\S/.test((r=e.text)!==null&&r!==void 0?r:"")}}if(e.isText)return!e.text;if(e.isAtom||e.isLeaf)return!1;if(e.content.childCount===0)return!0;if(t){let s=!0;return e.content.forEach(o=>{s!==!1&&($N(o,{ignoreWhitespace:n,checkChildren:t})||(s=!1))}),s}return!1}function c_e(e){return e instanceof nt}var F7=class $7{constructor(t){this.position=t}static fromJSON(t){return new $7(t.position)}toJSON(){return{position:this.position}}};function qTe(e,t){const n=t.mapping.mapResult(e.position);return{position:new F7(n.pos),mapResult:n}}function GTe(e){return new F7(e)}function KTe(e,t,n){const{selection:r}=t;let s=null;if(N7(r)&&(s=r.$cursor),s){var o;const c=(o=e.storedMarks)!==null&&o!==void 0?o:s.marks();return s.parent.type.allowsMarkType(n)&&(!!n.isInSet(c)||!c.some(u=>u.type.excludes(n)))}const{ranges:l}=r;return l.some(({$from:c,$to:u})=>{let f=c.depth===0?e.doc.inlineContent&&e.doc.type.allowsMarkType(n):!1;return e.doc.nodesBetween(c.pos,u.pos,(h,p,y)=>{if(f)return!1;if(h.isInline){const x=!y||y.type.allowsMarkType(n),b=!!n.isInSet(h.marks)||!h.marks.some(S=>S.type.excludes(n));f=x&&b}return!f}),f})}const YTe=(e,t={})=>({tr:n,state:r,dispatch:s})=>{const{selection:o}=n,{empty:l,ranges:c}=o,u=Sl(e,r.schema);if(s)if(l){const f=L7(r,u);n.addStoredMark(u.create({...f,...t}))}else c.forEach(f=>{const h=f.$from.pos,p=f.$to.pos;r.doc.nodesBetween(h,p,(y,x)=>{const b=Math.max(x,h),S=Math.min(x+y.nodeSize,p);y.marks.find(E=>E.type===u)?y.marks.forEach(E=>{u===E.type&&n.addMark(b,S,u.create({...E.attrs,...t}))}):n.addMark(b,S,u.create(t))})});return KTe(r,n,u)},WTe=(e,t)=>({tr:n})=>(n.setMeta(e,t),!0),XTe=(e,t={})=>({state:n,dispatch:r,chain:s})=>{const o=ar(e,n.schema);let l;return n.selection.$anchor.sameParent(n.selection.$head)&&(l=n.selection.$anchor.parent.attrs),o.isTextblock?s().command(({commands:c})=>aj(o,{...l,...t})(n)?!0:c.clearNodes()).command(({state:c})=>aj(o,{...l,...t})(c,r)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},QTe=e=>({tr:t,dispatch:n})=>{if(n){const{doc:r}=t,s=Hc(e,0,r.content.size),o=nt.create(r,s);t.setSelection(o)}return!0},ZTe=(e,t)=>({tr:n,state:r,dispatch:s})=>{const{selection:o}=r;let l,c;return typeof t=="number"?(l=t,c=t):t&&"from"in t&&"to"in t?(l=t.from,c=t.to):(l=o.from,c=o.to),s&&n.doc.nodesBetween(l,c,(u,f)=>{u.isText||n.setNodeMarkup(f,void 0,{...u.attrs,dir:e})}),!0},JTe=e=>({tr:t,dispatch:n})=>{if(n){const{doc:r}=t,{from:s,to:o}=typeof e=="number"?{from:e,to:e}:e,l=ft.atStart(r).from,c=ft.atEnd(r).to,u=Hc(s,l,c),f=Hc(o,l,c),h=ft.create(r,u,f);t.setSelection(h)}return!0},eNe=e=>({state:t,dispatch:n})=>{const r=ar(e,t.schema);return jEe(r)(t,n)};function Wj(e,t){const n=e.storedMarks||e.selection.$to.parentOffset&&e.selection.$from.marks();if(n){const r=n.filter(s=>t==null?void 0:t.includes(s.type.name));e.tr.ensureMarks(r)}}const tNe=({keepMarks:e=!0}={})=>({tr:t,state:n,dispatch:r,editor:s})=>{const{selection:o,doc:l}=t,{$from:c,$to:u}=o,f=s.extensionManager.attributes,h=Ay(f,c.node().type.name,c.node().attrs);if(o instanceof nt&&o.node.isBlock)return!c.parentOffset||!ol(l,c.pos)?!1:(r&&(e&&Wj(n,s.extensionManager.splittableMarks),t.split(c.pos).scrollIntoView()),!0);if(!c.parent.isBlock)return!1;const p=u.parentOffset===u.parent.content.size,y=c.depth===0?void 0:_7(c.node(-1).contentMatchAt(c.indexAfter(-1)));let x=p&&y?[{type:y,attrs:h}]:void 0;const b=o instanceof ft&&!o.empty?Yi.create({doc:t.doc,selection:o}).tr.deleteSelection():null,S=b?b.doc:t.doc,E=b?b.mapping.map(c.pos):c.pos;let C=ol(S,E,1,x);if(!x&&!C&&ol(S,E,1,y?[{type:y}]:void 0)&&(C=!0,x=y?[{type:y,attrs:h}]:void 0),r){if(C){const O=t.steps.length;if(o instanceof ft&&t.deleteSelection(),t.split(t.mapping.slice(O).map(c.pos),1,x),y&&!p&&!c.parentOffset&&c.parent.type!==y){const T=t.mapping.slice(O).map(c.before()),R=t.doc.resolve(T);c.node(-1).canReplaceWith(R.index(),R.index()+1,y)&&t.setNodeMarkup(t.mapping.slice(O).map(c.before()),y)}}e&&Wj(n,s.extensionManager.splittableMarks),t.scrollIntoView()}return C},nNe=(e,t={})=>({tr:n,state:r,dispatch:s,editor:o})=>{const l=ar(e,r.schema),{$from:c,$to:u}=r.selection,f=r.selection.node;if(f&&f.isBlock||c.depth<2||!c.sameParent(u))return!1;const h=c.node(-1);if(h.type!==l)return!1;const p=o.extensionManager.attributes;if(c.parent.content.size===0&&c.node(-1).childCount===c.indexAfter(-1)){if(c.depth===2||c.node(-3).type!==l||c.index(-2)!==c.node(-2).childCount-1)return!1;if(s){var y;let R=Ie.empty;const k=c.index(-1)?1:c.index(-2)?2:3;for(let P=c.depth-k;P>=c.depth-3;P-=1)R=Ie.from(c.node(P).copy(R));const M=c.indexAfter(-1)<c.node(-2).childCount?1:c.indexAfter(-2)<c.node(-3).childCount?2:3,A={...Ay(p,c.node().type.name,c.node().attrs),...t},I=((y=l.contentMatch.defaultType)===null||y===void 0?void 0:y.createAndFill(A))||void 0;R=R.append(Ie.from(l.createAndFill(null,I)||void 0));const L=c.before(c.depth-(k-1));n.replace(L,c.after(-M),new Ue(R,4-k,0));let D=-1;n.doc.nodesBetween(L,n.doc.content.size,(P,z)=>{if(D>-1)return!1;P.isTextblock&&P.content.size===0&&(D=z+1)}),D>-1&&n.setSelection(ft.near(n.doc.resolve(D))),n.scrollIntoView()}return!0}const x=u.pos===c.end()?h.contentMatchAt(0).defaultType:null,b={...Ay(p,h.type.name,h.attrs),...t},S={...Ay(p,c.node().type.name,c.node().attrs),...t},E=c.parentOffset===0&&c.index(-1)===0,C=c.before(-1);n.delete(c.pos,u.pos);const O=E?h.attrs:b,T=x?[{type:l,attrs:O},{type:x,attrs:S}]:[{type:l,attrs:O}];if(!ol(n.doc,c.pos,2))return!1;if(s){const{selection:R,storedMarks:k}=r,{splittableMarks:M}=o.extensionManager,A=k||R.$to.parentOffset&&R.$from.marks();if(n.split(c.pos,2,T).scrollIntoView(),E&&n.setNodeMarkup(C,void 0,b),!A||!s)return!0;const I=A.filter(L=>M.includes(L.type.name));n.ensureMarks(I)}return!0};function Xj(e){return!e||e==="1"?null:e}function U7(e,t){return Xj(e)===Xj(t)}const kw=(e,t)=>{const n=qb(o=>o.type===t)(e.selection);if(!n)return!0;const r=e.doc.resolve(Math.max(0,n.pos-1)).before(n.depth);if(r===void 0)return!0;const s=e.doc.nodeAt(r);return!(n.node.type===(s==null?void 0:s.type)&&Za(e.doc,n.pos))||!U7(n.node.attrs.type,s==null?void 0:s.attrs.type)||e.join(n.pos),!0},_w=(e,t)=>{const n=qb(o=>o.type===t)(e.selection);if(!n)return!0;const r=e.doc.resolve(n.start).after(n.depth);if(r===void 0)return!0;const s=e.doc.nodeAt(r);return!(n.node.type===(s==null?void 0:s.type)&&Za(e.doc,r))||!U7(n.node.attrs.type,s==null?void 0:s.attrs.type)||e.join(r),!0};function rNe(e){const t=e.doc,n=t.firstChild;if(!n)return null;const r=t.resolve(1),s=t.resolve(n.nodeSize-1);return ft.between(r,s)}const sNe=(e,t,n,r={})=>({editor:s,tr:o,state:l,dispatch:c,chain:u,commands:f,can:h})=>{const{extensions:p,splittableMarks:y}=s.extensionManager,x=ar(e,l.schema),b=ar(t,l.schema),{selection:S,storedMarks:E}=l,{$from:C,$to:O}=S,T=C.blockRange(O),R=E||S.$to.parentOffset&&S.$from.marks();if(!T)return!1;const k=qb($=>Aw($.type.name,p))(S),M=S.from===0&&S.to===l.doc.content.size,A=l.doc.content.content,I=A.length===1?A[0]:null,L=M&&I&&Aw(I.type.name,p)?{node:I,pos:0}:null,D=k??L,P=!!k&&T.depth>=1&&T.depth-k.depth<=1,z=!!L;if((P||z)&&D){if(D.node.type===x)return M&&z?u().command(({tr:$,dispatch:j})=>{const H=rNe($);return H?($.setSelection(H),j&&j($),!0):!1}).liftListItem(b).run():f.liftListItem(b);if(Aw(D.node.type.name,p)&&x.validContent(D.node.content))return u().command(()=>(o.setNodeMarkup(D.pos,x),!0)).command(()=>kw(o,x)).command(()=>_w(o,x)).run()}return!n||!R||!c?u().command(()=>h().wrapInList(x,r)?!0:f.clearNodes()).wrapInList(x,r).command(()=>kw(o,x)).command(()=>_w(o,x)).run():u().command(()=>{const $=h().wrapInList(x,r),j=R.filter(H=>y.includes(H.type.name));return o.ensureMarks(j),$?!0:f.clearNodes()}).wrapInList(x,r).command(()=>kw(o,x)).command(()=>_w(o,x)).run()},oNe=(e,t={},n={})=>({state:r,commands:s})=>{const{extendEmptyMarkRange:o=!1}=n,l=Sl(e,r.schema);return KC(r,l,t)?s.unsetMark(l,{extendEmptyMarkRange:o}):s.setMark(l,t)},iNe=(e,t,n={})=>({state:r,commands:s})=>{const o=ar(e,r.schema),l=ar(t,r.schema),c=nm(r,o,n);let u;return r.selection.$anchor.sameParent(r.selection.$head)&&(u=r.selection.$anchor.parent.attrs),c?s.setNode(l,u):s.setNode(o,{...u,...n})},lNe=(e,t={})=>({state:n,commands:r})=>{const s=ar(e,n.schema);return nm(n,s,t)?r.lift(s):r.wrapIn(s,t)},aNe=()=>({state:e,dispatch:t})=>{const n=e.plugins;for(let r=0;r<n.length;r+=1){const s=n[r];let o;if(s.spec.isInputRules&&(o=s.getState(e))){if(t){const l=e.tr,c=o.transform;for(let u=c.steps.length-1;u>=0;u-=1)l.step(c.steps[u].invert(c.docs[u]));if(o.text){const u=l.doc.resolve(o.from).marks();l.replaceWith(o.from,o.to,e.schema.text(o.text,u))}else l.delete(o.from,o.to)}return!0}}return!1},cNe=(e={})=>({tr:t,dispatch:n,editor:r})=>{const{ignoreClearable:s=!1}=e,{selection:o}=t,{empty:l,ranges:c}=o;if(l)return!0;const{nonClearableMarks:u}=r.extensionManager;if(n){const f=Object.values(r.schema.marks).filter(h=>s||!u.includes(h.name));c.forEach(h=>{for(const p of f)t.removeMark(h.$from.pos,h.$to.pos,p)})}return!0},uNe=(e,t={})=>({tr:n,state:r,dispatch:s})=>{const{extendEmptyMarkRange:o=!1}=t,{selection:l}=n,c=Sl(e,r.schema),{$from:u,empty:f,ranges:h}=l;if(!s)return!0;if(f&&o){var p;let{from:y,to:x}=l;const b=zN(u,c,(p=u.marks().find(S=>S.type===c))===null||p===void 0?void 0:p.attrs);b&&(y=b.from,x=b.to),n.removeMark(y,x,c)}else h.forEach(y=>{n.removeMark(y.$from.pos,y.$to.pos,c)});return n.removeStoredMark(c),!0},dNe=e=>({tr:t,state:n,dispatch:r})=>{const{selection:s}=n;let o,l;return typeof e=="number"?(o=e,l=e):e&&"from"in e&&"to"in e?(o=e.from,l=e.to):(o=s.from,l=s.to),r&&t.doc.nodesBetween(o,l,(c,u)=>{if(c.isText)return;const f={...c.attrs};delete f.dir,t.setNodeMarkup(u,void 0,f)}),!0},fNe=(e,t={})=>({tr:n,state:r,dispatch:s})=>{let o=null,l=null;const c=Vb(typeof e=="string"?e:e.name,r.schema);if(!c)return!1;c==="node"&&(o=ar(e,r.schema)),c==="mark"&&(l=Sl(e,r.schema));let u=!1;return n.selection.ranges.forEach(f=>{const h=f.$from.pos,p=f.$to.pos;let y,x,b,S;n.selection.empty?r.doc.nodesBetween(h,p,(E,C)=>{o&&o===E.type&&(u=!0,b=Math.max(C,h),S=Math.min(C+E.nodeSize,p),y=C,x=E)}):r.doc.nodesBetween(h,p,(E,C)=>{C<h&&o&&o===E.type&&(u=!0,b=Math.max(C,h),S=Math.min(C+E.nodeSize,p),y=C,x=E),C>=h&&C<=p&&(o&&o===E.type&&(u=!0,s&&n.setNodeMarkup(C,void 0,{...E.attrs,...t})),l&&E.marks.length&&E.marks.forEach(O=>{if(l===O.type&&(u=!0,s)){const T=Math.max(C,h),R=Math.min(C+E.nodeSize,p);n.addMark(T,R,l.create({...O.attrs,...t}))}}))}),x&&(y!==void 0&&s&&n.setNodeMarkup(y,void 0,{...x.attrs,...t}),l&&x.marks.length&&x.marks.forEach(E=>{l===E.type&&s&&n.addMark(b,S,l.create({...E.attrs,...t}))}))}),u},Od=new Lo("__tiptap_decorations__"),hNe=e=>({tr:t,dispatch:n})=>(n&&t.setMeta(Od,{type:"force",name:e}),!0),pNe=(e,t={})=>({state:n,dispatch:r})=>{const s=ar(e,n.schema);return AEe(s,t)(n,r)},mNe=(e,t={})=>({state:n,dispatch:r})=>{const s=ar(e,n.schema);return kEe(s,t)(n,r)};var gNe=vwe({blur:()=>B2e,clearContent:()=>H2e,clearNodes:()=>F2e,command:()=>$2e,createParagraphNear:()=>U2e,cut:()=>V2e,deleteCurrentNode:()=>q2e,deleteNode:()=>G2e,deleteRange:()=>K2e,deleteSelection:()=>X2e,enter:()=>Q2e,exitCode:()=>Z2e,extendMarkRange:()=>J2e,first:()=>eTe,focus:()=>nTe,forEach:()=>rTe,insertContent:()=>sTe,insertContentAt:()=>oTe,insertDefaultBlock:()=>iTe,joinBackward:()=>cTe,joinDown:()=>aTe,joinForward:()=>uTe,joinItemBackward:()=>dTe,joinItemForward:()=>fTe,joinTextblockBackward:()=>hTe,joinTextblockForward:()=>pTe,joinUp:()=>lTe,keyboardShortcut:()=>gTe,lift:()=>yTe,liftEmptyBlock:()=>xTe,liftListItem:()=>bTe,newlineInCode:()=>vTe,resetAttributes:()=>STe,scrollIntoView:()=>wTe,selectAll:()=>ETe,selectNodeBackward:()=>CTe,selectNodeForward:()=>TTe,selectParentNode:()=>NTe,selectTextblockEnd:()=>OTe,selectTextblockStart:()=>RTe,setContent:()=>ATe,setMark:()=>YTe,setMeta:()=>WTe,setNode:()=>XTe,setNodeSelection:()=>QTe,setTextDirection:()=>ZTe,setTextSelection:()=>JTe,sinkListItem:()=>eNe,splitBlock:()=>tNe,splitListItem:()=>nNe,toggleList:()=>sNe,toggleMark:()=>oNe,toggleNode:()=>iNe,toggleWrap:()=>lNe,undoInputRule:()=>aNe,unsetAllMarks:()=>cNe,unsetMark:()=>uNe,unsetTextDirection:()=>dNe,updateAttributes:()=>fNe,updateDecorations:()=>hNe,wrapIn:()=>pNe,wrapInList:()=>mNe});const Vh=new WeakMap;function yNe(e,t){var n;Vh.set(e,((n=Vh.get(e))!==null&&n!==void 0?n:0)+1);try{return t()}finally{var r;const s=((r=Vh.get(e))!==null&&r!==void 0?r:1)-1;s>0?Vh.set(e,s):Vh.delete(e)}}var xNe=class{constructor(){this.callbacks={}}on(e,t){return this.callbacks[e]||(this.callbacks[e]=[]),this.callbacks[e].push(t),this}emit(e,...t){const n=this.callbacks[e];return n&&n.forEach(r=>r.apply(this,t)),this}off(e,t){const n=this.callbacks[e];return n&&(t?this.callbacks[e]=n.filter(r=>r!==t):delete this.callbacks[e]),this}once(e,t){const n=(...r)=>{this.off(e,n),t.apply(this,r)};return this.on(e,n)}removeAllListeners(){this.callbacks={}}};function bNe(e){return e.kind==="widget"}function V7(e,t){const n=[],r=new Set;for(const s of e)s.kind==="widget"&&bNe(s)&&r.add(s.key),n.push(s.toPMDecoration(t));return{decorations:n,widgetKeys:r}}function vNe(e,t,n){const{decorations:r,widgetKeys:s}=V7(t,n);return{set:En.create(e,r),widgetKeys:s}}function q7({position:e,from:t,to:n,docSize:r}){return e<t?!1:e<n?!0:e===n&&n===r}function SNe({decorations:e,from:t,to:n,docSize:r,extensionName:s,warnedExtensions:o}){return e.filter(l=>q7({position:l.anchor,from:t,to:n,docSize:r})?!0:(l.anchor===n||o.has(s)||(o.add(s),console.warn(`[tiptap warn]: Extension "${s}" returned a decoration outside the requested range [${t}, ${n}). It was ignored.`)),!1))}function wNe(e){var t;const n=(t=e.spec)===null||t===void 0?void 0:t.key;return typeof n=="string"?n:void 0}function G7(e){return e.jsonID==="attr"}function ENe(e){let t=!1;if(e.getMap().forEach(()=>{t=!0}),t||G7(e))return!0;const n=e;return typeof n.from=="number"&&typeof n.to=="number"}function CNe(e,t){let n=null,r=0,s=0;for(let o=0;o<e.childCount&&!(s>t.to);o+=1){const l=s+e.child(o).nodeSize;l>=t.from&&(n===null&&(n=s),r=l),s=l}return n===null?null:{from:n,to:r}}function TNe(e,t){if(e.steps.some(o=>!ENe(o)))return{type:"full"};const n=B7(e).map(({newRange:o})=>o);e.steps.forEach((o,l)=>{if(!G7(o))return;const c=e.mapping.slice(l);n.push({from:c.map(o.pos,-1),to:c.map(o.pos+1)})});const r=[];for(const o of n){const l=CNe(t,o);l&&r.push(l)}r.sort((o,l)=>o.from-l.from);const s=[];for(const o of r){const l=s[s.length-1];l&&o.from<=l.to?l.to=Math.max(l.to,o.to):s.push({...o})}return{type:"ranges",ranges:s}}function K7(e,t,n,r){return e.map(t,n,{onRemove:s=>{const o=s==null?void 0:s.key;typeof o=="string"&&r.delete(o)}})}function NNe(e,t,n){var r,s;const o=(r=t.decorationSetsByExtension[e])!==null&&r!==void 0?r:En.empty,l=new Set((s=t.widgetKeysByExtension[e])!==null&&s!==void 0?s:[]);return{set:K7(o,n.mapping,n.doc,l),widgetKeys:l}}function Qj(e,t){const n=Object.values(t).flatMap(r=>r.find());return En.create(e,n)}function Zj(e){const t=new Set;for(const n of Object.values(e))for(const r of n)t.add(r);return t}function ONe(e,t){var n;switch((n=t.update)!==null&&n!==void 0?n:"document"){case"document":if(t.createInRange)throw new Error(`[tiptap error]: Extension "${e}" provides createInRange() but does not use the "changedRanges" decoration update strategy.`);return;case"changedRanges":if(!t.createInRange)throw new Error(`[tiptap error]: Extension "${e}" uses the "changedRanges" decoration update strategy but does not provide createInRange().`);return;case"manual":if(t.createInRange)throw new Error(`[tiptap error]: Extension "${e}" uses the "manual" decoration update strategy, which is not compatible with createInRange(). createInRange() requires the "changedRanges" strategy.`);if(t.shouldUpdate)throw new Error(`[tiptap error]: Extension "${e}" cannot combine the "manual" decoration update strategy with shouldUpdate().`);return;default:throw new Error(`[tiptap error]: Extension "${e}" uses an unknown decoration update strategy. Expected "document", "changedRanges", or "manual".`)}}function RNe(e,t,n){return n?!0:e.update==="manual"?!1:e.shouldUpdate?e.shouldUpdate(t):t.tr.docChanged}const ANe=new Set;var kNe=class{constructor(e){this.warnedWidgetKeys=new Set,this.warnedOutOfRangeExtensions=new Set,this.handleBeforeTransaction=({nextState:t})=>{const n=Od.getState(t);n&&this.warnDuplicateWidgetKeys(n)},this.editor=e.editor,this.entries=this.resolveEntries(e.entries),this.entries.forEach(({name:t,spec:n})=>ONe(t,n)),this.plugin=this.entries.length>0?this.createPlugin():null,this.editor.on("beforeTransaction",this.handleBeforeTransaction)}destroy(){this.editor.off("beforeTransaction",this.handleBeforeTransaction)}liveWidgetKeys(){var e,t;return(e=(t=Od.getState(this.editor.state))===null||t===void 0?void 0:t.widgetKeys)!==null&&e!==void 0?e:ANe}get mountedView(){return this.editor.isDestroyed?null:this.editor.view}resolveEntries(e){const t=[];for(const{name:n,addDecorations:r}of e){const s=r();s&&t.push({name:n,spec:s})}return t}createPlugin(){const{editor:e,entries:t}=this;return new Gs({key:Od,state:{init:(n,r)=>{const s={},o={};for(const{name:c,spec:u}of t){const{set:f,widgetKeys:h}=this.buildFullSet(c,u,r);s[c]=f,o[c]=h}const l={decorationSetsByExtension:s,widgetKeysByExtension:o,mergedDecorationSet:this.buildMergedSet(r.doc,s),widgetKeys:Zj(o)};return this.warnDuplicateWidgetKeys(l),l},apply:(n,r,s,o)=>{const l=n.getMeta(Od),c=(l==null?void 0:l.type)==="force"&&!l.name,u=(l==null?void 0:l.type)==="force"?l.name:void 0,f={},h={},p=new Set;return yNe(e,()=>{for(const{name:y,spec:x}of t){const b=c||u===y;if(RNe(x,{editor:e,tr:n,oldState:s,newState:o},b))if(x.update==="changedRanges"&&n.docChanged&&!b){const S=this.applyChangedRangesRecompute(y,x,r,n,o);f[y]=S.set,h[y]=S.widgetKeys,p.add(y)}else{const{set:S,widgetKeys:E}=this.buildFullSet(y,x,o);f[y]=S,h[y]=E,p.add(y)}else{const S=NNe(y,r,n);f[y]=S.set,h[y]=S.widgetKeys}}}),p.size===0&&!n.docChanged?r:{decorationSetsByExtension:f,widgetKeysByExtension:h,mergedDecorationSet:this.mergeAfterApply({entries:t,previous:r,tr:n,decorationSetsByExtension:f,recomputedNames:p}),widgetKeys:Zj(h)}}},props:{decorations(n){var r,s;return(r=(s=Od.getState(n))===null||s===void 0?void 0:s.mergedDecorationSet)!==null&&r!==void 0?r:En.empty}}})}applyChangedRangesRecompute(e,t,n,r,s){const o=TNe(r,s.doc);return o.type==="full"?this.buildFullSet(e,t,s):this.rebuildRanges(e,t,n,r,s,o.ranges)}rebuildRanges(e,t,n,r,s,o){var l,c;const u=(l=n.decorationSetsByExtension[e])!==null&&l!==void 0?l:En.empty,f=new Set((c=n.widgetKeysByExtension[e])!==null&&c!==void 0?c:[]);let h=K7(u,r.mapping,r.doc,f);const p=s.doc.content.size;for(const{from:y,to:x}of o){const b=h.find(y,x).filter(C=>q7({position:C.from,from:y,to:x,docSize:p}));for(const C of b){const O=wNe(C);O&&f.delete(O)}h=h.remove(b);const{decorations:S,widgetKeys:E}=V7(SNe({decorations:this.runCreate(e,"createInRange",()=>t.createInRange({editor:this.editor,state:s,view:this.mountedView,from:y,to:x})),from:y,to:x,docSize:p,extensionName:e,warnedExtensions:this.warnedOutOfRangeExtensions}),e);h=h.add(s.doc,S);for(const C of E)f.add(C)}return{set:h,widgetKeys:f}}buildFullSet(e,t,n){const r=this.runCreate(e,"create",()=>t.create({editor:this.editor,state:n,view:this.mountedView}));return vNe(n.doc,r,e)}runCreate(e,t,n){try{return n()}catch(r){return console.error(`[tiptap error]: Extension "${e}" threw in \`addDecorations().${t}()\`. Its decorations were dropped for this update.`,r),[]}}warnDuplicateWidgetKeys(e){}buildMergedSet(e,t){const n=Object.keys(t);return n.length===1?t[n[0]]:Qj(e,t)}mergeAfterApply({entries:e,previous:t,tr:n,decorationSetsByExtension:r,recomputedNames:s}){return e.length===1?r[e[0].name]:s.size===0?t.mergedDecorationSet.map(n.mapping,n.doc):Qj(n.doc,r)}};function _Ne(e,t){if(e===t)return!0;if(!e||!t)return!1;const n=Object.keys(e),r=Object.keys(t);return n.length!==r.length?!1:n.every(s=>Object.prototype.hasOwnProperty.call(t,s)&&Object.is(e[s],t[s]))}function u_e(e,t){const{selection:n}=e,{$from:r}=n;if(n instanceof nt){const o=r.index();return r.parent.canReplaceWith(o,o+1,t)}let s=r.depth;for(;s>=0;){const o=r.index(s);if(r.node(s).contentMatchAt(o).matchType(t))return!0;s-=1}return!1}function MNe(e,t,n){const r=document.querySelector("style[data-tiptap-style]");if(r!==null)return r;const s=document.createElement("style");return t&&s.setAttribute("nonce",t),s.setAttribute("data-tiptap-style",""),s.innerHTML=e,document.getElementsByTagName("head")[0].appendChild(s),s}const INe={lt:"<",gt:">",quot:'"',amp:"&"};function d_e(e){return e.replace(/&(?:#(\d{1,7})|#[xX]([0-9a-fA-F]{1,6})|(lt|gt|quot|amp));/g,(t,n,r,s)=>n!==void 0?Jj(Number(n)):r!==void 0?Jj(parseInt(r,16)):INe[s])}const LNe=new Map([[128,8364],[130,8218],[131,402],[132,8222],[133,8230],[134,8224],[135,8225],[136,710],[137,8240],[138,352],[139,8249],[140,338],[142,381],[145,8216],[146,8217],[147,8220],[148,8221],[149,8226],[150,8211],[151,8212],[152,732],[153,8482],[154,353],[155,8250],[156,339],[158,382],[159,376]]);function Jj(e){var t;return e===0||e>1114111||e>=55296&&e<=57343?"�":String.fromCodePoint((t=LNe.get(e))!==null&&t!==void 0?t:e)}function f_e(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}function DNe(e){return typeof e=="number"}function jNe(e){return Object.prototype.toString.call(e).slice(8,-1)}function ry(e){return jNe(e)!=="Object"?!1:e.constructor===Object&&Object.getPrototypeOf(e)===Object.prototype}function h_e(e,t,n){const r=e.split(`
|
|
369
|
+
`),s=[];let o="",l=0;const c=t.baseIndentSize||2;for(;l<r.length;){const h=r[l],p=h.match(t.itemPattern);if(!p){if(s.length>0)break;if(h.trim()===""){l+=1,o=`${o}${h}
|
|
370
|
+
`;continue}else return}const y=t.extractItemData(p),{indentLevel:x,mainContent:b}=y;o=`${o}${h}
|
|
371
|
+
`;const S=[b];for(l+=1;l<r.length;){var u;const T=r[l];if(T.trim()===""){var f;const R=r.slice(l+1).findIndex(k=>k.trim()!=="");if(R===-1)break;if((((f=r[l+1+R].match(/^(\s*)/))===null||f===void 0||(f=f[1])===null||f===void 0?void 0:f.length)||0)>x){S.push(T),o=`${o}${T}
|
|
372
|
+
`,l+=1;continue}else break}if((((u=T.match(/^(\s*)/))===null||u===void 0||(u=u[1])===null||u===void 0?void 0:u.length)||0)>x)S.push(T),o=`${o}${T}
|
|
373
|
+
`,l+=1;else break}let E;const C=S.slice(1);if(C.length>0){const T=C.map(R=>R.slice(x+c)).join(`
|
|
374
|
+
`);T.trim()&&(t.customNestedParser?E=t.customNestedParser(T):E=n.blockTokens(T))}const O=t.createToken(y,E);s.push(O)}if(s.length!==0)return{items:s,raw:o}}const eP=4;function tP(e){let t=0;for(const n of e)t=n===" "?t+eP-t%eP:t+1;return t}function p_e(e,t,n,r,s){if(!e||!Array.isArray(e.content))return"";const o=typeof n=="function"?n(r):n,[l,...c]=e.content;let u=`${o}${t.renderChildren([l])}`;return c&&c.length>0&&c.forEach((f,h)=>{var p,y;const x=(p=(y=t.renderChild)===null||y===void 0?void 0:y.call(t,f,h+1))!==null&&p!==void 0?p:t.renderChildren([f]);if(x!=null){const b=E=>{if(!(s!=null&&s.alignNestedToPrefix))return t.indent(E);const C=t.indent(""),O=tP(o);return(tP(C)>=O?C:" ".repeat(O))+E},S=x.split(`
|
|
375
|
+
`).map(E=>b(E||"")).join(`
|
|
376
|
+
`);u+=f.type==="paragraph"?`
|
|
377
|
+
|
|
378
|
+
${S}`:`
|
|
379
|
+
${S}`}}),u}function nP(e){return typeof e.type=="string"?e.type:e.type.name}function m_e(e,t){if(e.length!==t.length)return!1;const n=Array.from({length:t.length},()=>!1);return e.every(r=>{const s=nP(r),o=t.findIndex((l,c)=>!n[c]&&s===nP(l)&&_Ne(r.attrs,l.attrs));return o===-1?!1:(n[o]=!0,!0)})}function Y7(e,t){const n={...e};return ry(e)&&ry(t)&&Object.keys(t).forEach(r=>{ry(t[r])&&ry(e[r])?n[r]=Y7(e[r],t[r]):n[r]=t[r]}),n}function PNe(e,t,n={}){const{state:r}=t,{doc:s,tr:o}=r,l=e;s.descendants((c,u)=>{const f=o.mapping.map(u),h=o.mapping.map(u)+c.nodeSize;let p=null;if(c.marks.forEach(x=>{if(x!==l)return!1;p=x}),!p)return;let y=!1;if(Object.keys(n).forEach(x=>{n[x]!==p.attrs[x]&&(y=!0)}),y){const x=e.type.create({...e.attrs,...n});o.removeMark(f,h,e.type),o.addMark(f,h,x)}}),o.docChanged&&t.view.dispatch(o)}var Gb=class{constructor(e){var t;this.find=e.find,this.handler=e.handler,this.undoable=(t=e.undoable)!==null&&t!==void 0?t:!0}};const zNe=(e,t)=>{if(PN(t))return t.exec(e);const n=t(e);if(!n)return null;const r=[n.text];return r.index=n.index,r.input=e,r.data=n.data,n.replaceWith&&(n.text.includes(n.replaceWith)||console.warn('[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".'),r.push(n.replaceWith)),r};function BNe(e){const{editor:t,from:n,to:r,text:s,insertText:o}=e;if(!o)return{inputTransaction:null,tr:t.view.state.tr};const l=t.view.state.tr.insertText(s,n,r);return{inputTransaction:l,tr:Yi.create({doc:l.doc,selection:l.selection,storedMarks:l.storedMarks}).tr}}function HNe(e){const{editor:t,from:n,to:r,text:s,rule:o,match:l,plugin:c,insertText:u}=e,{view:f}=t,{inputTransaction:h,tr:p}=BNe({editor:t,from:n,to:r,text:s,insertText:u}),y=h?n+s.length:r,x=Ub({state:f.state,transaction:p}),b={from:n-(l[0].length-s.length),to:y},{commands:S,chain:E,can:C}=new qd({editor:t,state:x});return o.handler({state:x,range:b,match:l,commands:S,chain:E,can:C})===null||!p.steps.length?!1:(h&&(f.dispatch(h),!f.state.doc.eq(h.doc))||(j2e(p),p.setMeta("inputRule",!0),o.undoable&&p.setMeta(c,{transform:p,from:n,to:y,text:s}),f.dispatch(p)),!0)}function FNe(e,t,n){const r=t[0].length-n.length;if(r<=0)return!0;const s=e.parentOffset-r;return s>=0&&e.parent.textBetween(s,e.parentOffset)===t[0].slice(0,r)}function sy(e){var t;const{editor:n,from:r,to:s,text:o,rules:l,plugin:c,insertText:u}=e,{view:f}=n;if(f.composing)return!1;const h=f.state.doc.resolve(r);if(h.parent.type.spec.code||!((t=h.nodeBefore||h.nodeAfter)===null||t===void 0)&&t.marks.find(y=>y.type.spec.code))return!1;const p=UTe(h)+o;for(const y of l){const x=zNe(p,y.find);if(!(!x||!FNe(h,x,o))&&HNe({editor:n,from:r,to:s,text:o,rule:y,match:x,plugin:c,insertText:u}))return!0}return!1}function $Ne(e){const{editor:t,rules:n}=e,r=new Gs({state:{init(){return null},apply(s,o,l){const c=s.getMeta(r);if(c)return c;const u=s.getMeta("applyInputRules");return u&&setTimeout(()=>{let{text:f}=u;typeof f=="string"?f=f:f=HN(Ie.from(f),l.schema);const{from:h}=u,p=h+f.length;sy({editor:t,from:h,to:p,text:f,rules:n,plugin:r})}),s.selectionSet||s.docChanged?null:o}},props:{handleTextInput(s,o,l,c){return sy({editor:t,from:o,to:l,text:c,rules:n,plugin:r,insertText:!0})},handleDOMEvents:{compositionend:s=>(setTimeout(()=>{const{$cursor:o}=s.state.selection;o&&sy({editor:t,from:o.pos,to:o.pos,text:"",rules:n,plugin:r})}),!1)},handleKeyDown(s,o){if(o.key!=="Enter")return!1;const{$cursor:l}=s.state.selection;return l?sy({editor:t,from:l.pos,to:l.pos,text:`
|
|
380
|
+
`,rules:n,plugin:r}):!1}},isInputRules:!0});return r}var UN=class{constructor(e={}){this.type="extendable",this.parent=null,this.child=null,this.name="",this.config={name:this.name},this.config={...this.config,...e},this.name=this.config.name}get options(){return{...Kt(We(this,"addOptions",{name:this.name}))}}get storage(){return{...Kt(We(this,"addStorage",{name:this.name,options:this.options}))}}configure(e={}){const t=this.extend({...this.config,addOptions:()=>Y7(this.options,e)});return t.name=this.name,t.parent=this.parent,this.child=null,t}extend(e={}){const t=new this.constructor({...this.config,...e});return t.parent=this,this.child=t,t.name="name"in e?e.name:t.parent.name,t}},UNe=class W7 extends UN{constructor(...t){super(...t),this.type="mark"}static create(t={}){const n=typeof t=="function"?t():t;return new W7(n)}static handleExit({editor:t,mark:n}){const{tr:r}=t.state,s=t.state.selection.$from;if(s.pos===s.end()){const o=s.marks();if(!o.find(c=>(c==null?void 0:c.type.name)===n.name))return!1;const l=o.find(c=>(c==null?void 0:c.type.name)===n.name);return l&&r.removeStoredMark(l),r.insertText(" ",s.pos),t.view.dispatch(r),!0}return!1}configure(t){return super.configure(t)}extend(t){const n=typeof t=="function"?t():t;return super.extend(n)}},VNe=class{constructor(e){this.find=e.find,this.handler=e.handler}};const qNe=(e,t,n)=>{if(PN(t))return[...e.matchAll(t)];const r=t(e,n);return r?r.map(s=>{const o=[s.text];return o.index=s.index,o.input=e,o.data=s.data,s.replaceWith&&(s.text.includes(s.replaceWith)||console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'),o.push(s.replaceWith)),o}):[]};function GNe(e){const{editor:t,state:n,from:r,to:s,rule:o,pasteEvent:l,dropEvent:c}=e,{commands:u,chain:f,can:h}=new qd({editor:t,state:n}),p=[];return n.doc.nodesBetween(r,s,(y,x)=>{var b,S,E,C;if(!((b=y.type)===null||b===void 0||(b=b.spec)===null||b===void 0)&&b.code||!(y.isText||y.isTextblock||y.isInline))return;const O=(S=(E=(C=y.content)===null||C===void 0?void 0:C.size)!==null&&E!==void 0?E:y.nodeSize)!==null&&S!==void 0?S:0,T=Math.max(r,x),R=Math.min(s,x+O);if(T>=R)return;const k=y.isText?y.text||"":y.textBetween(T-x,R-x,void 0,"");qNe(k,o.find,l).forEach(M=>{if(M.index===void 0)return;const A=T+M.index+1,I=A+M[0].length,L={from:n.tr.mapping.map(A),to:n.tr.mapping.map(I)},D=o.handler({state:n,range:L,match:M,commands:u,chain:f,can:h,pasteEvent:l,dropEvent:c});p.push(D)})}),p.every(y=>y!==null)}let wd=null;const KNe=e=>{var t;const n=new ClipboardEvent("paste",{clipboardData:new DataTransfer});return(t=n.clipboardData)===null||t===void 0||t.setData("text/html",e),n};function YNe(e){const{editor:t,rules:n}=e;let r=null,s=!1,o=!1,l=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,c;try{c=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{c=null}const u=({state:f,from:h,to:p,rule:y,pasteEvt:x})=>{const b=f.tr,S=Ub({state:f,transaction:b});if(!(!GNe({editor:t,state:S,from:Math.max(h-1,0),to:p.b-1,rule:y,pasteEvent:x,dropEvent:c})||!b.steps.length)){try{c=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{c=null}return l=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,b}};return t.on("destroy",()=>{wd===t&&(wd=null)}),n.map(f=>new Gs({view(h){const p=x=>{var b;r=!((b=h.dom.parentElement)===null||b===void 0)&&b.contains(x.target)?h.dom.parentElement:null,r&&(wd=t)},y=()=>{wd&&(wd=null)};return window.addEventListener("dragstart",p),window.addEventListener("dragend",y),{destroy(){window.removeEventListener("dragstart",p),window.removeEventListener("dragend",y)}}},props:{handleDOMEvents:{drop:(h,p)=>{if(o=r===h.dom.parentElement,c=p,!o){const y=wd;y!=null&&y.isEditable&&setTimeout(()=>{if(y.isDestroyed)return;const x=y.state.selection;x&&y.commands.deleteRange({from:x.from,to:x.to})},10)}return!1},paste:(h,p)=>{var y;const x=(y=p.clipboardData)===null||y===void 0?void 0:y.getData("text/html");return l=p,s=!!(x!=null&&x.includes("data-pm-slice")),!1}}},appendTransaction:(h,p,y)=>{const x=h[0],b=x.getMeta("uiEvent")==="paste"&&!s,S=x.getMeta("uiEvent")==="drop"&&!o,E=x.getMeta("applyPasteRules"),C=!!E;if(!b&&!S&&!C)return;if(C){let{text:R}=E;typeof R=="string"?R=R:R=HN(Ie.from(R),y.schema);const{from:k}=E,M=k+R.length,A=KNe(R);return u({rule:f,state:y,from:k,to:{b:M},pasteEvt:A})}const O=p.doc.content.findDiffStart(y.doc.content),T=p.doc.content.findDiffEnd(y.doc.content);if(!(!DNe(O)||!T||O===T.b))return u({rule:f,state:y,from:O,to:T,pasteEvt:l})}}))}var Kb=class{constructor(e,t){this.splittableMarks=[],this.nonClearableMarks=[],this.decorationManager=null,this.editor=t,this.baseExtensions=e,this.extensions=FN(e),this.schema=j7(this.extensions,t),this.setupExtensions()}get commands(){return this.extensions.reduce((e,t)=>{const n=We(t,"addCommands",{name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:this.editor,type:Sd(t.name,this.schema)});return n?{...e,...n()}:e},{})}get plugins(){const{editor:e}=this,t=xp([...this.extensions].reverse()).flatMap(r=>{const s={name:r.name,options:r.options,storage:this.editor.extensionStorage[r.name],editor:e,type:Sd(r.name,this.schema)},o=[],l=We(r,"addKeyboardShortcuts",s);let c={};if(r.type==="mark"&&We(r,"exitable",s)&&(c.ArrowRight=()=>UNe.handleExit({editor:e,mark:r})),l){const y=Object.fromEntries(Object.entries(l()).map(([x,b])=>[x,()=>b({editor:e})]));c={...c,...y}}const u=O2e(c);o.push(u);const f=We(r,"addInputRules",s);if(Yj(r,e.options.enableInputRules)&&f){const y=f();if(y&&y.length){const x=$Ne({editor:e,rules:y}),b=Array.isArray(x)?x:[x];o.push(...b)}}const h=We(r,"addPasteRules",s);if(Yj(r,e.options.enablePasteRules)&&h){const y=h();if(y&&y.length){const x=YNe({editor:e,rules:y});o.push(...x)}}const p=We(r,"addProseMirrorPlugins",s);if(p){const y=p();o.push(...y)}return o}),n=this.createDecorationPlugin();return n&&t.push(n),t}createDecorationPlugin(){var e;const{editor:t}=this;(e=this.decorationManager)===null||e===void 0||e.destroy();const n=[];return this.extensions.forEach(r=>{const s=We(r,"addDecorations",{name:r.name,options:r.options,storage:this.editor.extensionStorage[r.name],editor:t,type:Sd(r.name,this.schema)});s&&n.push({name:r.name,addDecorations:s})}),this.decorationManager=new kNe({editor:t,entries:n}),this.decorationManager.plugin}get attributes(){return D7(this.extensions)}get nodeViews(){const{editor:e}=this,{nodeExtensions:t}=Nf(this.extensions);return Object.fromEntries(t.filter(n=>!!We(n,"addNodeView")).map(n=>{const r=this.attributes.filter(c=>c.type===n.name),s=We(n,"addNodeView",{name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:e,type:ar(n.name,this.schema)});if(!s)return[];const o=s();if(!o)return[];const l=(c,u,f,h,p)=>{const y=kx(c,r);return o({node:c,view:u,getPos:f,decorations:h,innerDecorations:p,editor:e,extension:n,HTMLAttributes:y})};return[n.name,l]}))}dispatchTransaction(e){const{editor:t}=this;return xp([...this.extensions].reverse()).reduceRight((n,r)=>{const s={name:r.name,options:r.options,storage:this.editor.extensionStorage[r.name],editor:t,type:Sd(r.name,this.schema)},o=We(r,"dispatchTransaction",s);return o?l=>{o.call(s,{transaction:l,next:n})}:n},e)}transformPastedHTML(e){const{editor:t}=this;return xp([...this.extensions]).reduce((n,r)=>{const s={name:r.name,options:r.options,storage:this.editor.extensionStorage[r.name],editor:t,type:Sd(r.name,this.schema)},o=We(r,"transformPastedHTML",s);return o?(l,c)=>{const u=n(l,c);return o.call(s,u)}:n},e||(n=>n))}get markViews(){const{editor:e}=this,{markExtensions:t}=Nf(this.extensions);return Object.fromEntries(t.filter(n=>!!We(n,"addMarkView")).map(n=>{const r=this.attributes.filter(l=>l.type===n.name),s=We(n,"addMarkView",{name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:e,type:Sl(n.name,this.schema)});if(!s)return[];const o=(l,c,u)=>{const f=kx(l,r);return s()({mark:l,view:c,inline:u,editor:e,extension:n,HTMLAttributes:f,updateAttributes:h=>{PNe(l,e,h)}})};return[n.name,o]}))}destroy(){var e;(e=this.decorationManager)===null||e===void 0||e.destroy(),this.extensions.forEach(t=>{let n=t;for(;n.parent;){const r=n.parent;r.child===n&&(r.child=null),n=r}}),this.extensions=[],this.baseExtensions=[],this.decorationManager=null,this.schema=null,this.editor=null}setupExtensions(){const e=this.extensions;this.editor.extensionStorage=Object.fromEntries(e.map(t=>[t.name,t.storage])),e.forEach(t=>{const n={name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:this.editor,type:Sd(t.name,this.schema)};if(t.type==="mark"){var r,s;(!((r=Kt(We(t,"keepOnSplit",n)))!==null&&r!==void 0)||r)&&this.splittableMarks.push(t.name),!((s=Kt(We(t,"clearable",n)))!==null&&s!==void 0)||s||this.nonClearableMarks.push(t.name)}const o=We(t,"onBeforeCreate",n),l=We(t,"onCreate",n),c=We(t,"onUpdate",n),u=We(t,"onSelectionUpdate",n),f=We(t,"onTransaction",n),h=We(t,"onFocus",n),p=We(t,"onBlur",n),y=We(t,"onDestroy",n);o&&this.editor.on("beforeCreate",o),l&&this.editor.on("create",l),c&&this.editor.on("update",c),u&&this.editor.on("selectionUpdate",u),f&&this.editor.on("transaction",f),h&&this.editor.on("focus",h),p&&this.editor.on("blur",p),y&&this.editor.on("destroy",y)})}};Kb.resolve=FN;Kb.sort=xp;Kb.flatten=BN;var mi=class X7 extends UN{constructor(...t){super(...t),this.type="extension"}static create(t={}){const n=typeof t=="function"?t():t;return new X7(n)}configure(t){return super.configure(t)}extend(t){const n=typeof t=="function"?t():t;return super.extend(n)}};const WNe=mi.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new Gs({key:new Lo("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{const{editor:e}=this,{state:t,schema:n}=e,{doc:r,selection:s}=t,o=z7(n),{blockSeparator:l}=this.options,c={...l!==void 0?{blockSeparator:l}:{},textSerializers:o};return[...s.ranges].sort((u,f)=>u.$from.pos-f.$from.pos).map(({$from:u,$to:f})=>P7(r,{from:u.pos,to:f.pos},c)).join(l??`
|
|
381
|
+
|
|
382
|
+
`)}}})]}}),XNe=mi.create({name:"commands",addCommands(){return{...gNe}}}),QNe=mi.create({name:"delete",onUpdate({transaction:e,appendedTransactions:t}){var n,r;const s=()=>{var o,l,c;if((o=(l=this.editor.options.coreExtensionOptions)===null||l===void 0||(l=l.delete)===null||l===void 0||(c=l.filterTransaction)===null||c===void 0?void 0:c.call(l,e))!==null&&o!==void 0?o:e.getMeta("y-sync$"))return;const u=kTe(e.before,[e,...t]);B7(u).forEach(h=>{u.mapping.mapResult(h.oldRange.from).deletedAfter&&u.mapping.mapResult(h.oldRange.to).deletedBefore&&u.before.nodesBetween(h.oldRange.from,h.oldRange.to,(p,y)=>{const x=y+p.nodeSize-2,b=h.oldRange.from<=y&&x<=h.oldRange.to;this.editor.emit("delete",{type:"node",node:p,from:y,to:x,newFrom:u.mapping.map(y),newTo:u.mapping.map(x),deletedRange:h.oldRange,newRange:h.newRange,partial:!b,editor:this.editor,transaction:e,combinedTransform:u})})});const f=u.mapping;u.steps.forEach((h,p)=>{if(h instanceof Oo){var y,x;const b=f.slice(p).map(h.from,-1),S=f.slice(p).map(h.to),E=f.invert().map(b,-1),C=f.invert().map(S),O=b>0?(y=u.doc.nodeAt(b-1))===null||y===void 0?void 0:y.marks.some(R=>R.eq(h.mark)):!1,T=(x=u.doc.nodeAt(S))===null||x===void 0?void 0:x.marks.some(R=>R.eq(h.mark));this.editor.emit("delete",{type:"mark",mark:h.mark,from:h.from,to:h.to,deletedRange:{from:E,to:C},newRange:{from:b,to:S},partial:!!(T||O),editor:this.editor,transaction:e,combinedTransform:u})}})};!((n=(r=this.editor.options.coreExtensionOptions)===null||r===void 0||(r=r.delete)===null||r===void 0?void 0:r.async)!==null&&n!==void 0)||n?setTimeout(s,0):s()}}),ZNe=mi.create({name:"drop",addProseMirrorPlugins(){return[new Gs({key:new Lo("tiptapDrop"),props:{handleDrop:(e,t,n,r)=>{this.editor.emit("drop",{editor:this.editor,event:t,slice:n,moved:r})}}})]}}),JNe=mi.create({name:"editable",addProseMirrorPlugins(){return[new Gs({key:new Lo("editable"),props:{editable:()=>this.editor.options.editable}})]}}),eOe=new Lo("focusEvents"),tOe=mi.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:e}=this;return[new Gs({key:eOe,props:{handleDOMEvents:{focus:(t,n)=>{e.isFocused=!0;const r=e.state.tr.setMeta("focus",{event:n}).setMeta("addToHistory",!1);return t.dispatch(r),!1},blur:(t,n)=>{e.isFocused=!1;const r=e.state.tr.setMeta("blur",{event:n}).setMeta("addToHistory",!1);return t.dispatch(r),!1}}}})]}}),nOe=mi.create({name:"keymap",addKeyboardShortcuts(){const e=()=>this.editor.commands.first(({commands:l})=>[()=>l.undoInputRule(),()=>l.command(({tr:c})=>{const{selection:u,doc:f}=c,{empty:h,$anchor:p}=u,{pos:y,parent:x}=p,b=p.parent.isTextblock&&y>0?c.doc.resolve(y-1):p,S=b.parent.type.spec.isolating,E=p.pos-p.parentOffset,C=S&&b.parent.childCount===1?E===p.pos:Rt.atStart(f).from===y;return!h||!x.type.isTextblock||x.textContent.length||!C||C&&p.parent.type.name==="paragraph"?!1:l.clearNodes()}),()=>l.deleteSelection(),()=>l.joinBackward(),()=>l.selectNodeBackward()]),t=()=>this.editor.commands.first(({commands:l})=>[()=>l.deleteSelection(),()=>l.deleteCurrentNode(),()=>l.joinForward(),()=>l.selectNodeForward()]),r={Enter:()=>this.editor.commands.first(({commands:l})=>[()=>l.newlineInCode(),()=>l.createParagraphNear(),()=>l.liftEmptyBlock(),()=>l.splitBlock()]),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:e,"Mod-Backspace":e,"Shift-Backspace":e,Delete:t,"Mod-Delete":t,"Mod-a":()=>this.editor.commands.selectAll()},s={...r},o={...r,"Ctrl-h":e,"Alt-Backspace":e,"Ctrl-d":t,"Ctrl-Alt-Backspace":t,"Alt-Delete":t,"Alt-d":t,"Ctrl-a":()=>this.editor.commands.selectTextblockStart(),"Ctrl-e":()=>this.editor.commands.selectTextblockEnd()};return tm()||I7()?o:s},addProseMirrorPlugins(){return[new Gs({key:new Lo("clearDocument"),appendTransaction:(e,t,n)=>{if(e.some(x=>x.getMeta("composition")))return;const r=e.some(x=>x.docChanged)&&!t.doc.eq(n.doc),s=e.some(x=>x.getMeta("preventClearDocument"));if(!r||s)return;const{empty:o,from:l,to:c}=t.selection,u=Rt.atStart(t.doc).from,f=Rt.atEnd(t.doc).to;if(o||!(l===u&&c===f)||!$N(n.doc))return;const h=n.tr,p=Ub({state:n,transaction:h}),{commands:y}=new qd({editor:this.editor,state:p});if(y.clearNodes(),!!h.steps.length)return h}})]}}),rOe=mi.create({name:"paste",addProseMirrorPlugins(){return[new Gs({key:new Lo("tiptapPaste"),props:{handlePaste:(e,t,n)=>{this.editor.emit("paste",{editor:this.editor,event:t,slice:n})}}})]}}),sOe=mi.create({name:"tabindex",addOptions(){return{value:void 0}},addProseMirrorPlugins(){return[new Gs({key:new Lo("tabindex"),props:{attributes:()=>{var e;return!this.editor.isEditable&&this.options.value===void 0?{}:{tabindex:(e=this.options.value)!==null&&e!==void 0?e:"0"}}}})]}}),oOe=mi.create({name:"textDirection",addOptions(){return{direction:void 0}},addGlobalAttributes(){if(!this.options.direction)return[];const{nodeExtensions:e}=Nf(this.extensions);return[{types:e.filter(t=>t.name!=="text").map(t=>t.name),attributes:{dir:{default:this.options.direction,parseHTML:t=>{const n=t.getAttribute("dir");return n&&(n==="ltr"||n==="rtl"||n==="auto")?n:this.options.direction},renderHTML:t=>t.dir?{dir:t.dir}:{}}}}]},addProseMirrorPlugins(){return[new Gs({key:new Lo("textDirection"),props:{attributes:()=>{const e=this.options.direction;return e?{dir:e}:{}}}})]}});let rP=!1;function iOe(e){if(rP)return;rP=!0;let t;try{t=_n.fromJSON(e,{from:0,to:0}).slice.content}catch{return}t instanceof Ie||console.warn("[tiptap warn]: prosemirror-model is loaded more than once. Wrapping and splitting nodes will fail. Deduplicate it in your lock file, or alias it to a single copy in your bundler.")}var lOe=class sp{get name(){return this.node.type.name}constructor(t,n,r=!1,s=null){this.currentNode=null,this.actualDepth=null,this.isBlock=r,this.resolvedPos=t,this.editor=n,this.currentNode=s}get node(){return this.currentNode||this.resolvedPos.node()}get element(){return this.editor.view.domAtPos(this.pos).node}get depth(){var t;return(t=this.actualDepth)!==null&&t!==void 0?t:this.resolvedPos.depth}get pos(){return this.resolvedPos.pos}get content(){return this.node.content}set content(t){let n=this.from,r=this.to;if(this.isBlock){if(this.content.size===0){console.error(`You can’t set content on a block node. Tried to set content on ${this.name} at ${this.pos}`);return}n=this.from+1,r=this.to-1}this.editor.commands.insertContentAt({from:n,to:r},t)}get attributes(){return this.node.attrs}get textContent(){return this.node.textContent}get size(){return this.node.nodeSize}get from(){return this.isBlock?this.pos:this.resolvedPos.start(this.resolvedPos.depth)}get range(){return{from:this.from,to:this.to}}get to(){return this.isBlock?this.pos+this.size:this.resolvedPos.end(this.resolvedPos.depth)+(this.node.isText?0:1)}get parent(){if(this.depth===0)return null;const t=this.resolvedPos.start(this.resolvedPos.depth-1),n=this.resolvedPos.doc.resolve(t);return new sp(n,this.editor)}get before(){let t=this.resolvedPos.doc.resolve(this.from-(this.isBlock?1:2));return t.depth!==this.depth&&(t=this.resolvedPos.doc.resolve(this.from-3)),new sp(t,this.editor)}get after(){let t=this.resolvedPos.doc.resolve(this.to+(this.isBlock?2:1));return t.depth!==this.depth&&(t=this.resolvedPos.doc.resolve(this.to+3)),new sp(t,this.editor)}get children(){const t=[];return this.node.content.forEach((n,r)=>{const s=n.isBlock&&!n.isTextblock,o=n.isAtom&&!n.isText,l=n.isInline,c=this.pos+r+(o?0:1);if(c<0||c>this.resolvedPos.doc.nodeSize-2)return;const u=this.resolvedPos.doc.resolve(c);if(!s&&!l&&u.depth<=this.depth)return;const f=new sp(u,this.editor,s,s||l?n:null);s&&(f.actualDepth=this.depth+1),t.push(f)}),t}get firstChild(){return this.children[0]||null}get lastChild(){const t=this.children;return t[t.length-1]||null}closest(t,n={}){let r=null,s=this.parent;for(;s&&!r;){if(s.node.type.name===t)if(Object.keys(n).length>0){const o=s.node.attrs,l=Object.keys(n);for(let c=0;c<l.length;c+=1){const u=l[c];if(o[u]!==n[u])break}}else r=s;s=s.parent}return r}querySelector(t,n={}){return this.querySelectorAll(t,n,!0)[0]||null}querySelectorAll(t,n={},r=!1){let s=[];if(!this.children||this.children.length===0)return s;const o=Object.keys(n);return this.children.forEach(l=>{r&&s.length>0||(l.node.type.name===t&&o.every(c=>n[c]===l.node.attrs[c])&&s.push(l),!(r&&s.length>0)&&(s=s.concat(l.querySelectorAll(t,n,r))))}),s}setAttribute(t){const{tr:n}=this.editor.state;n.setNodeMarkup(this.from,void 0,{...this.node.attrs,...t}),this.editor.view.dispatch(n)}};const aOe=`.ProseMirror {
|
|
383
|
+
position: relative;
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
.ProseMirror {
|
|
387
|
+
word-wrap: break-word;
|
|
388
|
+
white-space: pre-wrap;
|
|
389
|
+
white-space: break-spaces;
|
|
390
|
+
-webkit-font-variant-ligatures: none;
|
|
391
|
+
font-variant-ligatures: none;
|
|
392
|
+
font-feature-settings: "liga" 0; /* the above doesn't seem to work in Edge */
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
.ProseMirror [contenteditable="false"] {
|
|
396
|
+
white-space: normal;
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
.ProseMirror [contenteditable="false"] [contenteditable="true"] {
|
|
400
|
+
white-space: pre-wrap;
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
.ProseMirror pre {
|
|
404
|
+
white-space: pre-wrap;
|
|
405
|
+
}
|
|
406
|
+
|
|
407
|
+
img.ProseMirror-separator {
|
|
408
|
+
display: inline !important;
|
|
409
|
+
border: none !important;
|
|
410
|
+
margin: 0 !important;
|
|
411
|
+
width: 0 !important;
|
|
412
|
+
height: 0 !important;
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
.ProseMirror-gapcursor {
|
|
416
|
+
display: none;
|
|
417
|
+
pointer-events: none;
|
|
418
|
+
position: absolute;
|
|
419
|
+
margin: 0;
|
|
420
|
+
}
|
|
421
|
+
|
|
422
|
+
.ProseMirror-gapcursor:after {
|
|
423
|
+
content: "";
|
|
424
|
+
display: block;
|
|
425
|
+
position: absolute;
|
|
426
|
+
top: -2px;
|
|
427
|
+
width: 20px;
|
|
428
|
+
border-top: 1px solid black;
|
|
429
|
+
animation: ProseMirror-cursor-blink 1.1s steps(2, start) infinite;
|
|
430
|
+
}
|
|
431
|
+
|
|
432
|
+
@keyframes ProseMirror-cursor-blink {
|
|
433
|
+
to {
|
|
434
|
+
visibility: hidden;
|
|
435
|
+
}
|
|
436
|
+
}
|
|
437
|
+
|
|
438
|
+
.ProseMirror-hideselection *::selection {
|
|
439
|
+
background: transparent;
|
|
440
|
+
}
|
|
441
|
+
|
|
442
|
+
.ProseMirror-hideselection *::-moz-selection {
|
|
443
|
+
background: transparent;
|
|
444
|
+
}
|
|
445
|
+
|
|
446
|
+
.ProseMirror-hideselection * {
|
|
447
|
+
caret-color: transparent;
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
.ProseMirror-focused .ProseMirror-gapcursor {
|
|
451
|
+
display: block;
|
|
452
|
+
}`;var g_e=class extends xNe{constructor(e={}){super(),this.css=null,this.className="tiptap",this.editorView=null,this.isFocused=!1,this.destroyed=!1,this.isInitialized=!1,this.extensionStorage={},this.instanceId=Math.random().toString(36).slice(2,9),this.hasWarnedStaleDecorationRead=!1,this.options={element:typeof document<"u"?document.createElement("div"):null,content:"",injectCSS:!0,injectNonce:void 0,extensions:[],autofocus:!1,editable:!0,textDirection:void 0,editorProps:{},parseOptions:{},coreExtensionOptions:{},enableInputRules:!0,enablePasteRules:!0,enableCoreExtensions:!0,enableContentCheck:!1,emitContentError:!1,onBeforeCreate:()=>null,onCreate:()=>null,onMount:()=>null,onUnmount:()=>null,onUpdate:()=>null,onSelectionUpdate:()=>null,onTransaction:()=>null,onFocus:()=>null,onBlur:()=>null,onDestroy:()=>null,onContentError:({error:n})=>{throw n},onPaste:()=>null,onDrop:()=>null,onDelete:()=>null,enableExtensionDispatchTransaction:!0},this.isCapturingTransaction=!1,this.capturedTransaction=null,this.utils={getUpdatedPosition:qTe,createMappablePosition:GTe},this.setOptions(e),this.createExtensionManager(),this.createCommandManager(),this.createSchema(),this.on("beforeCreate",this.options.onBeforeCreate),this.emit("beforeCreate",{editor:this}),this.on("mount",this.options.onMount),this.on("unmount",this.options.onUnmount),this.on("contentError",this.options.onContentError),this.on("create",this.options.onCreate),this.on("update",this.options.onUpdate),this.on("selectionUpdate",this.options.onSelectionUpdate),this.on("transaction",this.options.onTransaction),this.on("focus",this.options.onFocus),this.on("blur",this.options.onBlur),this.on("destroy",this.options.onDestroy),this.on("drop",({event:n,slice:r,moved:s})=>this.options.onDrop(n,r,s)),this.on("paste",({event:n,slice:r})=>this.options.onPaste(n,r)),this.on("delete",this.options.onDelete);const t=this.createDoc();if(!this.editorState){const n=UC(t,this.options.autofocus);this.editorState=Yi.create({doc:t,schema:this.schema,selection:n||void 0})}iOe(this.schema),this.options.element&&this.mount(this.options.element)}mount(e){if(typeof document>"u")throw new Error("[tiptap error]: The editor cannot be mounted because there is no 'document' defined in this environment.");this.createView(e),this.emit("mount",{editor:this}),this.css&&!document.head.contains(this.css)&&document.head.appendChild(this.css),window.setTimeout(()=>{this.isDestroyed||(this.options.autofocus!==!1&&this.options.autofocus!==null&&this.commands.focus(this.options.autofocus),this.emit("create",{editor:this}),this.isInitialized=!0)},0)}unmount(){if(this.editorView){this.editorState=this.editorView.state;const e=this.editorView.dom;e!=null&&e.editor&&delete e.editor,this.editorView.destroy()}if(this.editorView=null,this.isInitialized=!1,this.css&&!document.querySelectorAll(`.${this.className}`).length)try{typeof this.css.remove=="function"?this.css.remove():this.css.parentNode&&this.css.parentNode.removeChild(this.css)}catch(e){console.warn("Failed to remove CSS element:",e)}this.css=null,this.emit("unmount",{editor:this})}get storage(){return this.extensionStorage}get commands(){return this.commandManager.commands}chain(){return this.commandManager?this.commandManager.chain():qd.createFakeChain()}can(){return this.commandManager?this.commandManager.can():qd.createFallbackCan()}injectCSS(){this.options.injectCSS&&typeof document<"u"&&(this.css=MNe(aOe,this.options.injectNonce))}setOptions(e={}){this.options={...this.options,...e},!(!this.editorView||!this.state||this.isDestroyed)&&(this.options.editorProps&&this.view.setProps({...this.options.editorProps,attributes:this.getEditorViewAttributes()}),this.view.updateState(this.state))}setEditable(e,t=!0){this.setOptions({editable:e}),t&&this.emit("update",{editor:this,transaction:this.state.tr,appendedTransactions:[]})}get isEditable(){return this.options.editable&&this.view&&this.view.editable}get view(){return this.editorView?this.editorView:new Proxy({state:this.editorState,updateState:e=>{this.editorState=e},dispatch:e=>{this.dispatchTransaction(e)},composing:!1,dragging:null,editable:!0,isDestroyed:!1},{get:(e,t)=>{if(this.editorView)return this.editorView[t];if(t==="state")return this.editorState;if(t in e)return Reflect.get(e,t);throw new Error(`[tiptap error]: The editor view is not available. Cannot access view['${t}']. The editor may not be mounted yet.`)}})}get state(){return this.editorView&&(this.editorState=this.view.state),this.editorState}registerPlugin(e,t){const n=GC(t)?t(e,[...this.state.plugins]):[...this.state.plugins,e],r=this.state.reconfigure({plugins:n});return this.view.updateState(r),r}unregisterPlugin(e){if(this.isDestroyed)return;const t=this.state.plugins;let n=t;if([].concat(e).forEach(s=>{const o=typeof s=="string"?`${s}$`:s.key;n=n.filter(l=>!l.key.startsWith(o))}),t.length===n.length)return;const r=this.state.reconfigure({plugins:n});return this.view.updateState(r),r}createExtensionManager(){var e,t;const n=[...this.options.enableCoreExtensions?[JNe,WNe.configure({blockSeparator:(e=this.options.coreExtensionOptions)===null||e===void 0||(e=e.clipboardTextSerializer)===null||e===void 0?void 0:e.blockSeparator}),XNe,tOe,nOe,sOe.configure({value:(t=this.options.coreExtensionOptions)===null||t===void 0||(t=t.tabindex)===null||t===void 0?void 0:t.value}),ZNe,rOe,QNe,oOe.configure({direction:this.options.textDirection})].filter(r=>typeof this.options.enableCoreExtensions=="object"?this.options.enableCoreExtensions[r.name]!==!1:!0):[],...this.options.extensions].filter(r=>["extension","node","mark"].includes(r==null?void 0:r.type));this.extensionManager=new Kb(n,this)}createCommandManager(){this.commandManager=new qd({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createDoc(){let e;try{e=qC(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:this.options.enableContentCheck})}catch(t){if(!(t instanceof Error)||!["[tiptap error]: Invalid JSON content","[tiptap error]: Invalid HTML content"].includes(t.message))throw t;const n=qC(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1});return this.editorState=Yi.create({doc:n,schema:this.schema,selection:UC(n,this.options.autofocus)||void 0}),this.emit("contentError",{editor:this,error:t,disableCollaboration:()=>{"collaboration"in this.storage&&typeof this.storage.collaboration=="object"&&this.storage.collaboration&&(this.storage.collaboration.isDisabled=!0),this.options.extensions=this.options.extensions.filter(r=>r.name!=="collaboration"),this.createExtensionManager()}}),this.editorState.doc}return e}getEditorViewAttributes(){var e;const t=(e=this.options.editorProps)===null||e===void 0?void 0:e.attributes;return GC(t)?n=>({role:"textbox",...t(n)}):{role:"textbox",...t}}createView(e){const{editorProps:t,enableExtensionDispatchTransaction:n}=this.options,r=t.dispatchTransaction||this.dispatchTransaction.bind(this),s=n?this.extensionManager.dispatchTransaction(r):r,o=t.transformPastedHTML,l=this.extensionManager.transformPastedHTML(o);this.editorView=new v7(e,{...t,attributes:this.getEditorViewAttributes(),dispatchTransaction:s,transformPastedHTML:l,state:this.editorState,markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews});const c=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(c),this.prependClass(),this.injectCSS();const u=this.view.dom;u.editor=this}createNodeViews(){this.view.isDestroyed||this.view.setProps({markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews})}prependClass(){this.view.dom.className=`${this.className} ${this.view.dom.className}`}captureTransaction(e){this.isCapturingTransaction=!0,e(),this.isCapturingTransaction=!1;const t=this.capturedTransaction;return this.capturedTransaction=null,t}dispatchTransaction(e){if(this.view.isDestroyed)return;if(this.isCapturingTransaction){if(!this.capturedTransaction){this.capturedTransaction=e;return}e.steps.forEach(f=>{var h;return(h=this.capturedTransaction)===null||h===void 0?void 0:h.step(f)});return}const{state:t,transactions:n}=this.state.applyTransaction(e),r=!this.state.selection.eq(t.selection),s=n.includes(e),o=this.state;if(this.emit("beforeTransaction",{editor:this,transaction:e,nextState:t}),!s)return;this.view.updateState(t),this.emit("transaction",{editor:this,transaction:e,appendedTransactions:n.slice(1)}),r&&this.emit("selectionUpdate",{editor:this,transaction:e});const l=n.findLast(f=>f.getMeta("focus")||f.getMeta("blur")),c=l==null?void 0:l.getMeta("focus"),u=l==null?void 0:l.getMeta("blur");c&&this.emit("focus",{editor:this,event:c.event,transaction:l}),u&&this.emit("blur",{editor:this,event:u.event,transaction:l}),!(e.getMeta("preventUpdate")||!n.some(f=>f.docChanged)||o.doc.eq(t.doc))&&this.emit("update",{editor:this,transaction:e,appendedTransactions:n.slice(1)})}getAttributes(e){return HTe(this.state,e)}isActive(e,t){const n=typeof e=="string"?e:null,r=typeof e=="string"?t:e;return VTe(this.state,n,r)}getJSON(){return this.state.doc.toJSON()}getHTML(){return HN(this.state.doc.content,this.schema)}getText(e){const{blockSeparator:t=`
|
|
453
|
+
|
|
454
|
+
`,textSerializers:n={}}=e||{};return zTe(this.state.doc,{blockSeparator:t,textSerializers:{...z7(this.schema),...n}})}get isEmpty(){return $N(this.state.doc)}destroy(){this.destroyed||(this.destroyed=!0,this.emit("destroy"),this.unmount(),this.removeAllListeners(),this.extensionManager.destroy(),this.extensionManager=null,this.schema=null,this.commandManager=null,this.extensionStorage={})}get isDestroyed(){var e,t;return(e=(t=this.editorView)===null||t===void 0?void 0:t.isDestroyed)!==null&&e!==void 0?e:!0}$node(e,t){var n;return((n=this.$doc)===null||n===void 0?void 0:n.querySelector(e,t))||null}$nodes(e,t){var n;return((n=this.$doc)===null||n===void 0?void 0:n.querySelectorAll(e,t))||null}$pos(e){const t=this.state.doc.resolve(e),n=e>0&&t.nodeAfter&&!t.nodeAfter.isText&&t.nodeAfter.isAtom?t.nodeAfter:null;return new lOe(t,this,!1,n)}get $doc(){return this.$pos(0)}};function y_e(e){return new Gb({find:e.find,handler:({state:t,range:n,match:r})=>{const s=Kt(e.getAttributes,void 0,r);if(s===!1||s===null)return null;const{tr:o}=t,l=r[r.length-1],c=r[0];if(l){const u=c.search(/\S/),f=n.from+c.indexOf(l),h=f+l.length;if(H7(n.from,n.to,t.doc).filter(y=>y.mark.type.excluded.find(x=>x===e.type&&x!==y.mark.type)).filter(y=>y.to>f).length)return null;h<n.to&&o.delete(h,n.to),f>n.from&&o.delete(n.from+u,f);const p=n.from+u+l.length;o.addMark(n.from+u,p,e.type.create(s||{})),o.removeStoredMark(e.type)}},undoable:e.undoable})}function x_e(e){return new Gb({find:e.find,handler:({state:t,range:n,match:r})=>{const s=Kt(e.getAttributes,void 0,r)||{},{tr:o}=t,l=n.from;let c=n.to;const u=e.type.create(s);if(r[1]){let f=l+r[0].lastIndexOf(r[1]);f>c?f=c:c=f+r[1].length;const h=r[0][r[0].length-1];o.insertText(h,l+r[0].length-1),o.replaceWith(f,c,u)}else if(r[0]){const f=e.type.isInline?l:l-1;o.insert(f,e.type.create(s)).delete(o.mapping.map(l),o.mapping.map(c))}o.scrollIntoView()},undoable:e.undoable})}function b_e(e){return new Gb({find:e.find,handler:({state:t,range:n,match:r})=>{const s=t.doc.resolve(n.from),o=Kt(e.getAttributes,void 0,r)||{};if(!s.node(-1).canReplaceWith(s.index(-1),s.indexAfter(-1),e.type))return null;t.tr.delete(n.from,n.to).setBlockType(n.from,n.from,e.type,o)},undoable:e.undoable})}function v_e(e){return new Gb({find:e.find,handler:({state:t,range:n,match:r,chain:s})=>{const o=Kt(e.getAttributes,void 0,r)||{},l=t.tr.delete(n.from,n.to),c=l.doc.resolve(n.from).blockRange(),u=c&&wN(c,e.type,o);if(!u)return null;if(l.wrap(c,u),e.keepMarks&&e.editor){const{selection:h,storedMarks:p}=t,{splittableMarks:y}=e.editor.extensionManager,x=p||h.$to.parentOffset&&h.$from.marks();if(x){const b=x.filter(S=>y.includes(S.type.name));l.ensureMarks(b)}}if(e.keepAttributes){const h=e.type.name==="bulletList"||e.type.name==="orderedList"?"listItem":"taskList";s().updateAttributes(h,o).run()}const f=l.doc.resolve(n.from-1).nodeBefore;f&&f.type===e.type&&Za(l.doc,n.from-1)&&(!e.joinPredicate||e.joinPredicate(r,f))&&l.join(n.from-1)},undoable:e.undoable})}var cOe=class Q7 extends UN{constructor(...t){super(...t),this.type="node"}static create(t={}){const n=typeof t=="function"?t():t;return new Q7(n)}configure(t){return super.configure(t)}extend(t){const n=typeof t=="function"?t():t;return super.extend(n)}},S_e=class{constructor(e,t,n){this.isDragging=!1,this.component=e,this.editor=t.editor,this.options={stopEvent:null,ignoreMutation:null,...n},this.extension=t.extension,this.node=t.node,this.decorations=t.decorations,this.innerDecorations=t.innerDecorations,this.view=t.view,this.HTMLAttributes=t.HTMLAttributes,this.getPos=()=>{try{return t.getPos()}catch{return}},this.mount()}mount(){}get dom(){return this.editor.view.dom}get contentDOM(){return null}onDragStart(e){var t,n;const{view:r}=this.editor,s=e.target,o=s.nodeType===3?(t=s.parentElement)===null||t===void 0?void 0:t.closest("[data-drag-handle]"):s.closest("[data-drag-handle]");if(!this.dom||!((n=this.contentDOM)===null||n===void 0)&&n.contains(s)||!o)return;let l=0,c=0;if(this.dom!==o){var u,f,h,p;const O=this.dom.getBoundingClientRect(),T=o.getBoundingClientRect(),R=(u=e.offsetX)!==null&&u!==void 0?u:(f=e.nativeEvent)===null||f===void 0?void 0:f.offsetX,k=(h=e.offsetY)!==null&&h!==void 0?h:(p=e.nativeEvent)===null||p===void 0?void 0:p.offsetY;l=T.x-O.x+R,c=T.y-O.y+k}const y=this.dom.cloneNode(!0);try{const O=this.dom.getBoundingClientRect();y.style.width=`${Math.round(O.width)}px`,y.style.height=`${Math.round(O.height)}px`,y.style.boxSizing="border-box",y.style.pointerEvents="none"}catch{}let x=null;try{var b;x=document.createElement("div"),x.style.position="absolute",x.style.top="-9999px",x.style.left="-9999px",x.style.pointerEvents="none",x.appendChild(y),document.body.appendChild(x),(b=e.dataTransfer)===null||b===void 0||b.setDragImage(y,l,c)}finally{x&&setTimeout(()=>{try{x==null||x.remove()}catch{}},0)}const S=this.getPos();if(typeof S!="number")return;const E=nt.create(r.state.doc,S),C=r.state.tr.setSelection(E);r.dispatch(C)}stopEvent(e){var t;if(!this.dom)return!1;if(typeof this.options.stopEvent=="function")return this.options.stopEvent({event:e});const n=e.target;if(!(this.dom.contains(n)&&!(!((t=this.contentDOM)===null||t===void 0)&&t.contains(n))))return!1;const r=e.type.startsWith("drag"),s=e.type==="dragover"||e.type==="dragenter",o=e.type==="drop";if((["INPUT","BUTTON","SELECT","TEXTAREA"].includes(n.tagName)||n.isContentEditable)&&!o&&!r)return!0;const{isEditable:l}=this.editor,{isDragging:c}=this,u=!!this.node.type.spec.draggable,f=nt.isSelectable(this.node),h=e.type==="copy",p=e.type==="paste",y=e.type==="cut",x=e.type==="mousedown";if(!u&&f&&r&&e.target===this.dom&&e.preventDefault(),u&&r&&!c&&e.target===this.dom)return e.preventDefault(),!1;if(u&&l&&!c&&x){const b=n.closest("[data-drag-handle]");b&&(this.dom===b||this.dom.contains(b))&&(this.isDragging=!0,document.addEventListener("dragend",()=>{this.isDragging=!1},{once:!0}),document.addEventListener("drop",()=>{this.isDragging=!1},{once:!0}),document.addEventListener("mouseup",()=>{this.isDragging=!1},{once:!0}))}return!(c||s||o||h||p||y||x&&f)}ignoreMutation(e){return this.dom?this.contentDOM?typeof this.options.ignoreMutation=="function"?this.options.ignoreMutation({mutation:e}):this.node.isLeaf||this.node.isAtom?!0:e.type==="selection"||this.contentDOM.contains(e.target)&&e.type==="childList"&&(tm()||VC())&&this.editor.isFocused&&[...Array.from(e.addedNodes),...Array.from(e.removedNodes)].every(t=>t.isContentEditable)?!1:this.contentDOM===e.target&&e.type==="attributes"?!0:!this.contentDOM.contains(e.target):e.type!=="selection":!0}updateAttributes(e){this.editor.commands.command(({tr:t})=>{const n=this.getPos();return typeof n!="number"?!1:(t.setNodeMarkup(n,void 0,{...this.node.attrs,...e}),!0)})}deleteNode(){const e=this.getPos();if(typeof e!="number")return;const t=e+this.node.nodeSize;this.editor.commands.deleteRange({from:e,to:t})}};function w_e(e){return new VNe({find:e.find,handler:({state:t,range:n,match:r,pasteEvent:s})=>{const o=Kt(e.getAttributes,void 0,r,s);if(o===!1||o===null)return null;const{tr:l}=t,c=r[r.length-1],u=r[0];let f=n.to;if(c){const h=u.search(/\S/),p=n.from+u.indexOf(c),y=p+c.length;if(H7(n.from,n.to,t.doc).filter(x=>x.mark.type.excluded.find(b=>b===e.type&&b!==x.mark.type)).filter(x=>x.to>p).length)return null;y<n.to&&l.delete(y,n.to),p>n.from&&l.delete(n.from+h,p),f=n.from+h+c.length,l.addMark(n.from+h,f,e.type.create(o||{})),r.index!==void 0&&r.input!==void 0&&r.index+r[0].length>=r.input.length||l.removeStoredMark(e.type)}}})}const oy="codeLink",Mw="data-code-link",sP="data-code",uOe=/^\[(`?)([^\]`\n]+)\1\]\(code:([^)\s]+)\)/,dOe=/\[[^\]\n]*\]\(code:/,fOe="rounded-sm border border-border bg-muted px-1.5 py-0.5 text-[0.875em] data-code:font-mono",hOe=/^[^\]`\n]+$/,pOe=/^[^)\s]+$/,mOe="#",gOe=({lineStart:e,lineEnd:t})=>e===t?`L${String(e)}`:`L${String(e)}-${String(t)}`,yOe=({path:e,range:t,label:n,isCode:r})=>{const s=n.trim();return hOe.test(s)&&pOe.test(e)?{linkId:`${e}${mOe}${gOe(t)}`,label:s,isCode:r}:null},oP=e=>typeof e=="string"?e:"",Iw=e=>({linkId:oP(e==null?void 0:e.linkId),label:oP(e==null?void 0:e.label),isCode:(e==null?void 0:e.isCode)===!0}),xOe=({linkId:e,label:t,isCode:n})=>`[${n?`\`${t}\``:t}](code:${e})`,bOe=e=>{const t=uOe.exec(e);return t===null?null:{raw:t[0],isCode:t[1]!=="",label:t[2],linkId:t[3]}},E_e=cOe.create({name:oy,group:"inline",inline:!0,atom:!0,selectable:!0,addAttributes:()=>({linkId:{default:""},label:{default:""},isCode:{default:!1}}),parseHTML:()=>[{tag:`span[${Mw}]`,getAttrs:e=>({linkId:e.getAttribute(Mw)??"",label:e.textContent,isCode:e.hasAttribute(sP)})}],renderHTML:({node:e})=>{const{linkId:t,label:n,isCode:r}=Iw(e.attrs);return["span",{[Mw]:t,...r?{[sP]:""}:{},class:fOe,title:t},n]},markdownTokenizer:{name:oy,level:"inline",start:e=>e.search(dOe),tokenize:e=>{const t=bOe(e);return t===null?void 0:{type:oy,...t}}},parseMarkdown:e=>({type:oy,attrs:Iw(e)}),renderMarkdown:e=>xOe(Iw(e.attrs))}),vOe="Link to code",SOe="Pick a file of the Flight Plan, select the lines the link points at, and name the link.",wOe="File",EOe="Search the files of the Flight Plan",COe="Link these lines",TOe="Select the lines in the code: click a line number, then another with Shift.",NOe="Label",OOe="Show the label as code",ROe="Write a label without a backtick or a closing square bracket.",qh=({reviewKey:e,selectedText:t,onInsert:n,onClose:r})=>{const s=N.useId(),o=xN(e,"flight-plan"),[l,c]=N.useState(null),[u,f]=N.useState(null),[h,p]=N.useState(t),[y,x]=N.useState(!1),b=$F(e,l),S=l===null||u===null?null:yOe({path:l,range:u,label:h,isCode:y}),E=l!==null&&u!==null&&h.trim()!==""&&S===null,C=O=>{c(O),f(null),o.onQueryChange(O)};return m.jsx(ml,{open:!0,onOpenChange:O=>{O||r()},children:m.jsxs(gl,{className:"h-[calc(100dvh-4rem)] grid-rows-[auto_auto_minmax(0,1fr)_auto_auto] sm:max-w-[min(90rem,calc(100vw-4rem))]",children:[m.jsxs(yl,{children:[m.jsx(bl,{children:vOe}),m.jsx(vl,{children:SOe})]}),m.jsx(bN,{label:wOe,hint:null,placeholder:EOe,query:o.query,files:o.files,message:o.message,errorMessage:o.errorMessage,onQueryChange:o.onQueryChange,onSelect:C}),l===null?m.jsx("span",{}):m.jsxs("div",{className:"flex min-h-0 flex-col gap-2",children:[m.jsx(VF,{path:l,lines:b.lines,statusMessage:b.statusMessage,waypoints:[],waypointOptions:"always-off",highlightButtonLabel:COe,focusOn:u,className:"flex-1",onHighlightCode:f}),m.jsx("p",{role:"status",className:"text-sm text-muted-foreground",children:u===null?TOe:Gp(u)})]}),m.jsxs("div",{className:"grid gap-1.5",children:[m.jsx("label",{htmlFor:s,className:"text-sm font-bold",children:NOe}),m.jsx(zm,{id:s,value:h,"aria-invalid":E,onChange:O=>{p(O.target.value)}}),E?m.jsx("p",{role:"alert",className:"text-sm text-destructive",children:ROe}):null,m.jsxs("label",{className:"flex items-center gap-2 text-sm",children:[m.jsx("input",{type:"checkbox",checked:y,className:"size-4 accent-(--primary)",onChange:O=>{x(O.target.checked)}}),OOe]})]}),m.jsxs(xl,{children:[m.jsx(st,{type:"button",variant:"ghost",onClick:r,children:"Cancel"}),m.jsx(st,{type:"button",disabled:S===null,onClick:()=>{S!==null&&n(S)},children:"Insert"})]})]})})},AOe=({choice:e,isPending:t,onComplete:n,onClose:r})=>{const s=N.useId(),[o,l]=N.useState(e.selectedId);return m.jsx(ml,{open:!0,onOpenChange:c=>{c||r()},children:m.jsxs(gl,{className:"sm:max-w-xl",children:[m.jsxs(yl,{children:[m.jsx(bl,{children:e.title}),m.jsx(vl,{children:e.description})]}),e.emptyMessage===null?m.jsxs("fieldset",{children:[m.jsx("legend",{className:"sr-only",children:e.title}),m.jsx("ul",{className:"max-h-[60dvh] overflow-y-auto border-t border-border",children:e.options.map(c=>m.jsxs("li",{className:"border-b border-border py-3",children:[m.jsxs("label",{className:"flex cursor-pointer items-start gap-3 text-base",children:[m.jsx("input",{type:"radio",name:s,checked:o===c.id,className:"mt-1 size-4 shrink-0 accent-(--primary)",onChange:()=>{l(c.id)}}),m.jsx("span",{className:"min-w-0 font-bold",children:c.label})]}),m.jsx("span",{className:"block pl-7 text-sm text-muted-foreground",children:c.detail})]},c.id))})]}):m.jsx("p",{className:"text-muted-foreground",children:e.emptyMessage}),m.jsxs(xl,{children:[m.jsx(st,{type:"button",variant:"ghost",onClick:r,children:e.cancelLabel}),m.jsx(st,{type:"button",variant:"outline",disabled:t,onClick:()=>{n(null)},children:e.skipLabel}),e.emptyMessage===null?m.jsx(st,{type:"button",disabled:t||o===null,onClick:()=>{n(o)},children:e.confirmLabel}):null]})]})})},kOe=4,Lw="change-overview-card-action",_Oe={added:"[--change:var(--diff-added)]",modified:"[--change:var(--line-blue)]",deleted:"[--change:var(--diff-removed)]"},MOe="relative grid h-full w-full min-w-0 gap-0.5 rounded-[0.3rem] border border-[color-mix(in_oklab,var(--change)_55%,transparent)] bg-(--plate-fill) px-3 pt-3.5 pb-2.5 text-left [--plate-fill:color-mix(in_oklab,var(--change)_8%,var(--card))]",IOe="cursor-pointer transition-[border-color,box-shadow] duration-[180ms] ease-out hover:border-(--change) hover:ring-1 hover:ring-(--change) focus-visible:ring-3 focus-visible:ring-ring/40 focus-visible:outline-none",LOe="absolute -top-2 right-2.5 flex items-center gap-1 bg-[linear-gradient(to_bottom,var(--background)_50%,var(--plate-fill)_50%)] px-1.5 text-xs leading-4 font-bold text-(--change)",DOe=({card:e})=>m.jsxs(m.Fragment,{children:[m.jsxs("span",{className:LOe,children:[m.jsx(ST,{mark:e.change,radius:kOe}),e.changeLabel]}),m.jsx("span",{className:"truncate font-mono text-sm font-bold text-foreground",children:e.label}),m.jsxs("span",{className:"flex min-w-0 items-baseline gap-1.5 text-xs leading-4 text-muted-foreground",children:[m.jsx("span",{className:"shrink-0",children:e.typeLabel}),m.jsx("span",{"aria-hidden":"true",children:"•"}),m.jsx("span",{title:e.path,className:"min-w-0 truncate font-mono [direction:rtl]",children:m.jsx("bdi",{children:e.path})})]})]}),jOe=({card:e,onOpenWaypoint:t})=>{const{waypointAnchorId:n,change:r,preview:s}=e,o=n!==null,l=ye(MOe,_Oe[r],o?IOe:""),c=o?()=>{t(n)}:void 0,u=m.jsx(DOe,{card:e});return s===null?o?m.jsx("button",{type:"button","data-user-action-id":Lw,className:l,onClick:c,children:u}):m.jsx("div",{"data-user-action-id":Lw,className:l,children:u}):m.jsxs(Dm,{children:[m.jsx(jm,{delay:S6,render:o?m.jsx("button",{type:"button"}):m.jsx("div",{}),"data-user-action-id":Lw,className:l,onClick:c,children:u}),m.jsx(w6,{target:s})]})},POe=({heading:e,emptyMessage:t,rows:n,onOpenWaypoint:r})=>{const s=N.useId();return m.jsxs("section",{"aria-labelledby":s,"data-view-section-id":"change-overview-section",className:"pt-6",children:[m.jsx("h3",{id:s,className:"pb-3 text-base leading-6 font-bold text-foreground",children:e}),t===null?null:m.jsx("p",{className:"text-muted-foreground",children:t}),n.length===0?null:m.jsx("ul",{className:"grid gap-5",children:n.map(o=>m.jsxs("li",{"aria-label":o.classification.label,children:[m.jsx("span",{className:"text-sm leading-5 font-bold text-foreground",children:o.classification.label}),m.jsx("ul",{className:"grid grid-cols-[repeat(auto-fill,minmax(15rem,1fr))] gap-x-3 gap-y-5 pt-4",children:o.cards.map(l=>m.jsx("li",{className:"min-w-0",children:m.jsx(jOe,{card:l,onOpenWaypoint:r})},l.id))})]},o.classification.key))})]})},zOe="max-w-[85ch]",BOe=({anchorId:e,heading:t,writeUpNotice:n=null,action:r=null,children:s})=>m.jsxs("section",{id:e,"aria-labelledby":`${e}-heading`,"data-view-section-id":"context-section",className:"scroll-mt-(--section-scroll-margin) pt-6 pb-8",children:[m.jsxs("div",{className:"flex items-center gap-3 pb-4",children:[m.jsx("h2",{id:`${e}-heading`,className:"text-2xl leading-9 font-semibold tracking-[-0.02em] text-foreground",children:t}),n===null?null:m.jsx(Pf,{label:n}),r]}),s]}),HOe=N.lazy(async()=>await Ut(()=>import("./index-JPWJ3IiN.js"),__vite__mapDeps([24,25]))),FOe="Loading the editor…",$Oe=({anchorId:e,heading:t,context:n,markdown:r,isDraft:s,unwrittenLabel:o,writeUpNotice:l,changeOverview:c,codeLinks:u,editing:f,renderCodeLinkDialog:h,onOpenCodeLink:p})=>{const y=(f==null?void 0:f.isWriting)===!0,x=Ale(e,n);return m.jsxs(BOe,{anchorId:e,heading:t,writeUpNotice:l,action:f===null||y?null:m.jsx(st,{variant:"link",size:"sm",onClick:f.onEdit,children:"Edit"}),children:[f!==null&&y?m.jsx(N.Suspense,{fallback:m.jsx("p",{className:"text-sm text-muted-foreground",children:FOe}),children:m.jsx(HOe,{label:t,markdown:r,isSaving:f.isSaving,errorMessage:f.errorMessage,renderCodeLinkDialog:h,onSave:f.onSave,onCancel:f.onCancel})}):null,!y&&s?m.jsx(ul,{isPending:!0,lineCount:4,className:"max-w-[55rem] text-base",children:m.jsx("p",{className:"text-muted-foreground",children:o})}):null,!y&&!s?m.jsx(E6,{value:x,children:m.jsx(uo,{blocks:n,codeLinks:u,className:zOe,onOpenCodeLink:p})}):null,m.jsx(POe,{...c,onOpenWaypoint:p})]})},UOe=({anchorId:e,heading:t,emptyMessage:n,entries:r,placeholder:s,submitLabel:o,isSubmitting:l,renderEditor:c,onComment:u})=>m.jsxs("section",{id:e,"aria-labelledby":`${e}-heading`,"data-view-section-id":"conversation-section",className:"scroll-mt-(--section-scroll-margin) border-t pt-6 pb-8",children:[m.jsx("h2",{id:`${e}-heading`,className:"pb-4 text-2xl leading-9 font-semibold tracking-[-0.02em] text-foreground",children:t}),m.jsxs("div",{className:"flex max-w-[52rem] flex-col",children:[n===null?null:m.jsx("p",{className:"pb-4 text-muted-foreground",children:n}),r.map(f=>m.jsx(P6,{comment:f,verdictLabel:f.verdictLabel,locationLabel:f.locationLabel,className:"border-t py-3 first:border-t-0 first:pt-0"},f.id)),m.jsx(DT,{label:s,submitLabel:o,cancelLabel:null,isSubmitting:l,className:"border-t pt-4",renderEditor:c,onSubmit:u})]})]}),VOe=140,qOe=120,iy=0,YC=`
|
|
455
|
+
`,GOe={currentAnchorId:null,aboveAnchorIds:new Set},iP=e=>e===""?[]:e.split(YC),KOe=e=>e.reduce((t,n)=>{const r=document.getElementById(n);return r!==null&&r.getBoundingClientRect().top<=VOe?n:t},e.at(0)??null),YOe=e=>{var n;const t=(n=document.getElementById(e))==null?void 0:n.getBoundingClientRect();return t!==void 0&&t.height>0&&t.top<qOe},WOe=e=>({currentAnchorId:KOe(e.sectionAnchorIds),aboveAnchorIds:new Set(e.waypointAnchorIds.filter(YOe))}),XOe=(e,t)=>e.size===t.size&&[...e].every(n=>t.has(n)),QOe=(e,t)=>e.currentAnchorId===t.currentAnchorId&&XOe(e.aboveAnchorIds,t.aboveAnchorIds),ZOe=(e,t)=>{const[n]=N.useState(()=>iB(()=>GOe)),r=N.useRef(iy),s=e.join(YC),o=t.join(YC);return N.useEffect(()=>{const l={sectionAnchorIds:iP(s),waypointAnchorIds:iP(o)},c=()=>{r.current=iy;const f=WOe(l);QOe(n.getState(),f)||n.setState(f,!0)},u=()=>{r.current===iy&&(r.current=requestAnimationFrame(c))};return c(),window.addEventListener("scroll",u,{passive:!0}),window.addEventListener("resize",u),()=>{cancelAnimationFrame(r.current),r.current=iy,window.removeEventListener("scroll",u),window.removeEventListener("resize",u)}},[n,s,o]),n},JOe=e=>CT(e),eRe=e=>CT(e,t=>t.currentAnchorId),WC="grid grid-cols-[2.5rem_1fr] items-center rounded-sm py-1.5 pr-2 text-sm hover:bg-muted",lP="transition-[fill,stroke] duration-[180ms] ease-out",tRe="relative flex flex-col before:absolute before:top-4 before:bottom-4 before:left-[calc(1.25rem-2px)] before:w-1 before:bg-(--line)",aP=({sections:e,currentAnchorId:t})=>m.jsx("ol",{className:tRe,children:e.map(n=>m.jsxs("li",{className:"relative flex flex-col",children:[m.jsxs("a",{href:`#${n.anchorId}`,"aria-current":n.anchorId===t?"location":void 0,"data-user-action-id":"rail-section-action",className:ye(WC,"group/stop text-muted-foreground aria-[current]:font-semibold aria-[current]:text-primary-text"),children:[m.jsx("svg",{"aria-hidden":"true",viewBox:"0 0 20 20",className:"size-5 justify-self-center",children:m.jsx("circle",{cx:"10",cy:"10",r:"7",className:ye(lP,"fill-background stroke-muted-foreground [stroke-width:3] group-aria-[current]/stop:fill-(--line) group-aria-[current]/stop:stroke-(--line)")})}),m.jsx("span",{className:"leading-5",children:n.label})]}),n.children.map(r=>m.jsxs("a",{href:`#${r.anchorId}`,"aria-current":r.anchorId===t?"location":void 0,"data-user-action-id":"rail-file-action",className:ye(WC,"group/stop py-1 text-[0.8125rem] text-muted-foreground aria-[current]:text-primary-text"),children:[m.jsx("svg",{"aria-hidden":"true",viewBox:"0 0 20 20",className:"size-5 justify-self-center",children:m.jsx("circle",{cx:"10",cy:"10",r:"3.5",className:ye(lP,"fill-background stroke-(--line) [stroke-width:2] group-aria-[current]/stop:fill-(--line)")})}),m.jsx("span",{className:"leading-4",children:r.label})]},r.anchorId))]},n.anchorId))}),nRe="Arrange",rRe=({label:e,groups:t,sections:n,currentAnchorId:r,onEditGroup:s=null,onArrangeGroups:o=null})=>m.jsxs("nav",{"aria-label":e,className:"flex flex-col gap-2",children:[o===null?null:m.jsxs(st,{variant:"ghost",size:"sm",className:"self-end",onClick:o,children:[m.jsx(kX,{"aria-hidden":"true"}),nRe]}),t.map(l=>m.jsxs("div",{className:"flex flex-col",children:[l.label===null?null:m.jsxs("div",{className:"flex items-start",children:[m.jsxs("a",{href:`#${l.anchorId}`,"data-user-action-id":"rail-segment-action",className:ye(WC,"min-w-0 flex-1 items-start"),children:[m.jsx("svg",{"aria-hidden":"true",viewBox:"0 0 20 20",className:"mt-0.5 size-5 justify-self-center",children:m.jsx("rect",{x:"3.5",y:"3.5",width:"13",height:"13",rx:"2.5",className:"fill-(--line)"})}),m.jsxs("span",{className:"flex min-w-0 flex-col",children:[m.jsx("span",{className:"leading-5 font-semibold text-foreground",children:l.label}),m.jsx("span",{className:"text-xs leading-4 text-muted-foreground tabular-nums",children:l.detailLabel})]})]}),s===null?null:m.jsx(or,{icon:"edit",label:`Edit ${l.label}`,className:"shrink-0 text-muted-foreground",onClick:()=>{s(l.anchorId)}})]}),m.jsx(aP,{sections:l.sections,currentAnchorId:r})]},l.anchorId)),m.jsx("div",{className:"border-t pt-2",children:m.jsx(aP,{sections:n,currentAnchorId:r})})]}),sRe=({readingPosition:e,...t})=>m.jsx(rRe,{...t,currentAnchorId:eRe(e)}),oRe="Arrange files",iRe=()=>m.jsx("span",{"aria-hidden":"true",className:"inline-flex size-3.5 shrink-0 items-center justify-center rounded-full bg-waypoint text-line-foreground",children:m.jsx(wu,{className:"size-2.5",strokeWidth:3.5})}),lRe=e=>e==="reviewed"?m.jsx(iRe,{}):m.jsx(B6,{kind:e}),aRe=({anchorId:e,heading:t,coverageLabel:n,emptyMessage:r,writeUpNotice:s=null,navigation:o,children:l,onArrangeFiles:c})=>{const u=Hre(e);return AT(e,mue({...o,markerOf:lRe,sectionSteps:u})),m.jsxs("section",{id:e,"aria-labelledby":`${e}-heading`,"data-view-section-id":"code-walkthrough-section",className:"scroll-mt-(--section-scroll-margin) border-t pt-6 pb-10",children:[m.jsxs("div",{className:"flex items-center gap-3",children:[m.jsx("h2",{id:`${e}-heading`,className:"shrink-0 text-2xl leading-9 font-semibold tracking-[-0.02em] whitespace-nowrap text-foreground",children:t}),m.jsx("p",{className:"min-w-0 truncate text-sm text-muted-foreground tabular-nums",children:n}),s===null?null:m.jsx(Pf,{label:s,className:"shrink-0"}),m.jsx("span",{className:"flex-1"}),c===null?null:m.jsx(st,{variant:"link",size:"sm",onClick:c,children:oRe})]}),r===null?null:m.jsx("p",{className:"pt-6 text-muted-foreground",children:r}),l]})},cRe=({readingPosition:e,navigationOf:t,...n})=>m.jsx(aRe,{...n,navigation:t(JOe(e))}),uRe={},dRe=()=>{},cP="flex flex-wrap items-center gap-x-3 gap-y-1 border-b py-2.5 text-sm",fRe="sticky top-(--band-height) z-20 flex h-(--strip-height) items-center gap-3 border-b bg-background text-sm whitespace-nowrap",hRe=({staleNotice:e,unassignedFiles:t,progress:n,onShowUnassignedFiles:r,onCopyPrompt:s})=>m.jsxs(m.Fragment,{children:[e===null?null:m.jsxs("div",{role:"status",className:cP,children:[m.jsx(dp,{status:"stale",tone:"signal"}),m.jsx("p",{className:"font-bold text-signal-text [&_code]:bg-transparent [&_code]:px-0",children:m.jsx(df,{inlines:e.message,codeLinks:uRe,onOpenCodeLink:dRe})}),m.jsx(st,{variant:"outline",size:"sm",onClick:()=>{s(e.prompt,e.copiedMessage)},children:e.promptLabel})]}),t===null?null:m.jsxs("div",{role:"status",className:cP,children:[m.jsx(dp,{status:"stale",tone:"signal"}),m.jsx("p",{className:"font-bold text-signal-text",children:t.message}),m.jsx(st,{variant:"outline",size:"sm",onClick:r,children:t.actionLabel})]}),n===null?null:m.jsxs("div",{role:"status",...Xre,className:fRe,children:[m.jsx(dp,{status:n.isWriting?"awaiting-review":"stale",tone:n.isWriting?"status":"signal",className:n.isWriting?"motion-safe:animate-pulse":""}),m.jsx("p",{className:"font-bold text-signal-text",children:n.label}),m.jsx("progress",{"aria-label":n.countLabel,value:n.writtenCount,max:n.totalCount,className:"h-1.5 w-40 shrink-0 appearance-none overflow-hidden rounded-[0.225rem] bg-muted [&::-moz-progress-bar]:bg-signal [&::-webkit-progress-bar]:bg-muted [&::-webkit-progress-value]:bg-signal [&::-webkit-progress-value]:transition-[width] [&::-webkit-progress-value]:duration-300"}),m.jsx("p",{className:"text-foreground tabular-nums",children:n.countLabel}),m.jsx("p",{className:"min-w-0 truncate text-muted-foreground",children:n.message}),n.prompt===null?null:m.jsx(st,{variant:"outline",size:"sm",onClick:()=>{n.prompt!==null&&s(n.prompt.text,n.prompt.copiedMessage)},children:n.prompt.label})]})]}),pRe="Label",mRe="Files",gRe="No files yet.",yRe="Add a file",xRe="Search the changed files",bRe="Close",vRe="Delete",Z7=({reviewKey:e,legend:t,label:n,paths:r,isSaving:s,isDeleting:o,errorMessage:l,onSave:c,onDelete:u,onClose:f})=>{const h=N.useId(),p=N.useId(),y=xN(e,"changed"),[x,b]=N.useState(n),[S,E]=N.useState(r),C=O=>{E(T=>T.includes(O)?T:[...T,O]),y.onQueryChange("")};return m.jsxs("form",{"aria-label":t,onSubmit:BF(()=>{c({title:x,paths:S})}),className:"relative mt-6 grid max-w-[44rem] gap-4 rounded-lg border border-foreground p-4",children:[m.jsx(or,{icon:"close",label:bRe,className:"absolute top-2 right-2",onClick:f}),m.jsxs("div",{className:"grid gap-1.5 pr-8",children:[m.jsx("label",{htmlFor:h,className:"text-sm font-bold",children:pRe}),m.jsx(zm,{id:h,value:x,onChange:O=>{b(O.target.value)}})]}),m.jsxs("div",{className:"grid gap-1.5",children:[m.jsx("p",{id:p,className:"text-sm font-bold",children:mRe}),S.length===0?m.jsx("p",{className:"text-sm text-muted-foreground",children:gRe}):m.jsx("ul",{"aria-labelledby":p,className:"grid gap-0.5",children:S.map(O=>m.jsxs("li",{className:"flex items-center justify-between gap-2",children:[m.jsx("span",{className:"min-w-0 truncate font-mono text-[0.8rem]",title:O,children:O}),m.jsx(or,{icon:"close",label:`Remove ${O}`,onClick:()=>{E(T=>T.filter(R=>R!==O))}})]},O))})]}),m.jsx(bN,{label:yRe,hint:null,placeholder:xRe,query:y.query,files:y.files,message:y.message,errorMessage:y.errorMessage,onQueryChange:y.onQueryChange,onSelect:C}),l===null?null:m.jsx("p",{role:"alert",className:"text-sm text-destructive",children:l}),m.jsxs("div",{className:"flex justify-end gap-2",children:[u===null?null:m.jsx(st,{type:"button",variant:"destructive",disabled:o,onClick:u,children:vRe}),m.jsx(st,{type:"submit",disabled:s,children:s?"Saving…":"Save"})]})]})},SRe=({heading:e,detailLabel:t,children:n=null})=>m.jsxs("div",{className:"flex items-baseline gap-3 pt-6",children:[m.jsx("h2",{className:"text-[1.75rem] leading-9 font-semibold tracking-[-0.02em] text-foreground",children:e}),n,t===null?null:m.jsx("p",{className:"text-sm text-muted-foreground tabular-nums",children:t})]}),wRe="text-[1.75rem] leading-9 font-semibold tracking-[-0.02em] text-foreground",ERe="text-sm text-muted-foreground tabular-nums",CRe="Edit segment",TRe=({reviewKey:e,heading:t,isTitleDraft:n,detailLabel:r,outline:s,authoring:o})=>o===null?t===null?null:m.jsx(SRe,{heading:t,detailLabel:r,children:m.jsx(ul,{isPending:n,className:"w-64 self-center text-[1.75rem]",children:null})}):o.writing.isWriting?m.jsx(Z7,{reviewKey:e,legend:s.heading,label:s.label,paths:s.paths,isSaving:o.writing.isSaving,isDeleting:o.isPending,errorMessage:o.writing.errorMessage,onSave:o.writing.onSave,onDelete:o.onRemove,onClose:o.writing.onCancel}):m.jsxs("div",{className:"flex items-center gap-3 pt-6",children:[m.jsx("h2",{className:wRe,children:s.heading}),m.jsx("p",{className:ERe,children:s.detailLabel}),m.jsx(st,{variant:"link",size:"sm",onClick:o.writing.onEdit,children:CRe})]}),NRe=({selection:e,onComment:t,onAsk:n})=>e===null||e.commentRange===null&&n===null?null:m.jsxs("div",{role:"toolbar","aria-label":"Selected code",className:"fixed z-50 flex -translate-y-full gap-0.5 rounded-lg border border-foreground bg-popover p-1 duration-150 animate-in fade-in-0",style:{left:e.left,top:e.top},onMouseDown:r=>{r.preventDefault()},children:[e.commentRange===null?null:m.jsx(st,{variant:"ghost",size:"sm",onClick:()=>{e.commentRange!==null&&t(e.path,e.commentRange)},children:"Add comment"}),n===null?null:m.jsx(st,{variant:"ghost",size:"sm",onClick:()=>{n(e)},children:"Ask the agent"})]}),ORe=({heading:e,message:t,children:n})=>m.jsxs("div",{className:"grid grid-cols-[2.5rem_minmax(0,1fr)] pt-10",children:[m.jsxs("span",{"aria-hidden":"true",className:"flex flex-col items-center",children:[m.jsx("span",{className:"h-9 w-1 bg-(--line)"}),m.jsx("span",{className:"h-1 w-4 bg-(--line)"})]}),m.jsxs("div",{className:"pt-5",children:[m.jsx("h2",{className:"text-xl leading-7 font-semibold tracking-[-0.01em] text-foreground",children:e}),m.jsx("p",{className:"max-w-[62ch] text-muted-foreground",children:t}),n]})]}),RRe="Close",ARe="Cancel",kRe=({title:e,description:t,paths:n,confirmation:r,onClose:s})=>m.jsx(ml,{open:!0,onOpenChange:o=>{o||s()},children:m.jsxs(gl,{children:[m.jsxs(yl,{children:[m.jsx(bl,{children:e}),m.jsx(vl,{children:(r==null?void 0:r.warning)??t})]}),m.jsx("ul",{"aria-label":e,className:"grid max-h-80 gap-1 overflow-y-auto",children:n.map(o=>m.jsx("li",{className:"font-mono text-[0.8rem] break-all",children:o},o))}),m.jsxs(xl,{children:[m.jsx(st,{type:"button",variant:"ghost",onClick:s,children:r===null?RRe:ARe}),r===null?null:m.jsx(st,{type:"button",onClick:r.onConfirm,children:r.confirmLabel})]})]})}),_Re=(e,t)=>{var S,E;const n=is(),r=_o(),[s,o]=N.useState(!1),[l,c]=N.useState(null),u=uX(n.conversation.watch.subscriptionOptions(e,{enabled:s})),f=ui({...n.conversation.modelChoice.queryOptions(e),enabled:s}),h=C=>{t(C.message)},p=On(n.conversation.sendMessage.mutationOptions({onSuccess:C=>{C.kind==="sent"&&c(null)},onError:h})),y=On(n.conversation.answerQuestions.mutationOptions({onSuccess:async()=>{await r.invalidateQueries(n.review.get.pathFilter())},onError:h})),x=On(n.conversation.chooseModel.mutationOptions({onSuccess:async C=>{C.kind==="rejected"&&t(C.message),await r.invalidateQueries(n.conversation.modelChoice.pathFilter())},onError:h})),b=((S=y.data)==null?void 0:S.kind)==="rejected"&&y.variables!==void 0?{batchId:y.variables.batchId,message:y.data.message}:null;return{isOpen:s,reference:l,conversation:u.data,modelChoice:f.data??null,isSending:p.isPending,sendProblem:((E=p.data)==null?void 0:E.kind)==="rejected"?p.data.message:null,answering:{pendingBatchId:y.isPending?y.variables.batchId:null,rejection:b},onToggle:()=>{o(C=>!C)},onClose:()=>{o(!1)},onAsk:C=>{c(C),o(!0)},onClearReference:()=>{c(null)},onSend:C=>{p.mutate({...e,body:C,reference:l})},onAnswer:(C,O)=>{y.mutate({...e,batchId:C,answers:O.map(T=>({...T,pickedLabels:[...T.pickedLabels]}))})},onChooseModel:C=>{x.mutate({...e,model:C})}}},MRe="[data-line]",IRe="[data-path]",LRe=6,XC=10,uP=e=>{const t=e instanceof Element?e:(e==null?void 0:e.parentElement)??null;return(t==null?void 0:t.closest(MRe))??null},dP=e=>Number.parseInt(e.dataset.line??"",XC),fP=e=>{const{commentSide:t,commentLine:n}=e.dataset;return(t==="old"||t==="new")&&n!==void 0?{side:t,lineLabel:n}:null},DRe=(e,t)=>{if(t===null)return null;const n=Number.parseInt(t.lineLabel,XC),r=(e==null?void 0:e.side)===t.side?Number.parseInt(e.lineLabel,XC):n;return{side:t.side,startLineLabel:String(Math.min(r,n)),lineLabel:String(Math.max(r,n))}},hP=()=>{const e=window.getSelection();if(e===null||e.isCollapsed||e.rangeCount===0)return null;const t=uP(e.anchorNode),n=uP(e.focusNode),r=(t==null?void 0:t.closest(IRe))??null,s=r==null?void 0:r.dataset.path;if(t===null||n===null||r===null||s===void 0||!r.contains(n))return null;const o=dP(t),l=dP(n);if(Number.isNaN(o)||Number.isNaN(l))return null;const c=e.getRangeAt(0).getBoundingClientRect();return{path:s,lineStart:o,lineEnd:l,commentRange:DRe(fP(t),fP(n)),left:c.left,top:c.top-LRe}},jRe=()=>{const[e,t]=N.useState(null);return N.useEffect(()=>{const n=()=>{t(hP())},r=()=>{t(null)},s=()=>{hP()===null&&t(null)};return document.addEventListener("selectionchange",s),document.addEventListener("mouseup",n),document.addEventListener("keyup",n),window.addEventListener("scroll",r,{passive:!0}),()=>{document.removeEventListener("selectionchange",s),document.removeEventListener("mouseup",n),document.removeEventListener("keyup",n),window.removeEventListener("scroll",r)}},[]),e},J7=()=>"Notification"in window,PRe=()=>{J7()&&Notification.permission==="default"&&Notification.requestPermission()},zRe=(e,{title:t,body:n})=>{if(!J7()||Notification.permission!=="granted")return;const r=new Notification(t,{body:n,tag:e});r.addEventListener("click",()=>{window.focus(),r.close()})},BRe=(e,t,n,r)=>{const s=N.useRef(null);N.useEffect(()=>{if(t){s.current=e;return}n===null||s.current!==e||(s.current=null,r(n.title),zRe(e,n))},[e,t,n,r])},HRe=e=>{var f,h;const t=is(),n=_o(),[r,s]=N.useState([]),o=p=>{s(y=>y.filter(x=>x!==p))},l=On(t.review.editContext.mutationOptions({onSuccess:async(p,{segmentId:y})=>{p.kind==="saved"&&(await n.invalidateQueries(t.review.get.pathFilter()),o(y))}})),u=(((f=l.data)==null?void 0:f.kind)==="rejected"?l.data.message:null)??((h=l.error)==null?void 0:h.message)??null;return p=>{var x;const y=((x=l.variables)==null?void 0:x.segmentId)===p;return{isWriting:r.includes(p),isSaving:y&&l.isPending,errorMessage:y?u:null,onEdit:()=>{y&&l.reset(),s(b=>[...b,p])},onSave:b=>{l.mutate({...e,segmentId:p,context:b})},onCancel:()=>{y&&l.reset(),o(p)}}}},FRe=5e3,$Re=(e,t,n)=>{var x,b;const r=is(),[s,o]=N.useState("unchecked"),{data:l}=ui({...r.review.liveAgent.queryOptions(e),refetchInterval:FRe,refetchIntervalInBackground:!0}),c=ui({...r.review.writeUpPlan.queryOptions({...e,sections:null}),enabled:t}),u=((x=c.data)==null?void 0:x.kind)==="plan"?c.data.isOffered:null,f=(l==null?void 0:l.kind)==="live"?l:null,h=f!==null&&!f.isOnline;s==="unchecked"&&f!==null&&u!==null&&o(u&&h?"open":"closed");const p=On(r.review.openAgentTerminal.mutationOptions({onSuccess:S=>{S.kind==="opened"&&(o("closed"),n.onMessage(S.message))},onError:S=>{n.onMessage(S.message)}})),y=()=>{p.reset(),o("open")};return{status:f===null?null:{isOnline:f.isOnline,label:f.statusLabel,onClick:f.isOnline?null:y},dialog:s==="open"&&h?f.dialog:null,isOpening:p.isPending,problem:((b=p.data)==null?void 0:b.kind)==="rejected"?p.data.message:null,onAgentAction:()=>{h&&y()},onOpenTerminal:()=>{p.mutate(e)},onClose:()=>{o("closed")}}},URe=10,VRe="Review submitted",_x=e=>Number.parseInt(e,URe),pP=(e,t)=>({path:e,side:t.side,startLine:_x(t.startLineLabel),endLine:_x(t.lineLabel)}),qRe=(e,t,n,r)=>{if(n===null)return null;const s={path:t,anchorLineLabel:n.lineLabel,range:{side:n.side,startLineLabel:n.lineLabel,lineLabel:n.lineLabel}};if(!r||(e==null?void 0:e.path)!==t||e.range.side!==n.side)return s;const o=_x(e.anchorLineLabel),l=_x(n.lineLabel);return{...e,range:{side:n.side,startLineLabel:String(Math.min(o,l)),lineLabel:String(Math.max(o,l))}}},GRe=(e,t)=>{var L;const n=is(),r=_o(),[s,o]=N.useState(null),[l,c]=N.useState(0),[u,f]=N.useState(""),[h,p]=N.useState(!1),y=N.useDeferredValue(u),x=async()=>{await r.invalidateQueries(n.review.get.pathFilter())},b=async()=>{await Promise.all([x(),r.invalidateQueries(n.review.searchReviewers.pathFilter())])},S=D=>{t(D.message)},E={onSuccess:x,onError:S},C=On(n.review.addComment.mutationOptions({onSuccess:async()=>{o(null),await x()},onError:S})),O=On(n.review.discardComment.mutationOptions(E)),T=On(n.review.replyToThread.mutationOptions(E)),R=On(n.review.resolveThread.mutationOptions(E)),k=On(n.review.submit.mutationOptions({onSuccess:async()=>{c(D=>D+1),t(VRe),await Promise.all([x(),r.invalidateQueries(n.repository.list.pathFilter())])}})),M=On(n.review.requestReviewer.mutationOptions({onSuccess:b,onError:S})),A=On(n.review.removeReviewRequest.mutationOptions({onSuccess:b,onError:S})),I=ui({...n.review.searchReviewers.queryOptions({...e,query:y}),enabled:h,placeholderData:Mx});return{composingRangeOf:D=>(s==null?void 0:s.path)===D?s.range:null,isCommentPending:C.isPending||T.isPending||R.isPending||O.isPending,isSubmitting:k.isPending,isDiscarding:O.isPending,submissionCount:l,submissionError:((L=k.error)==null?void 0:L.message)??null,reviewerRequesting:{query:u,options:I.data??null,isPending:M.isPending||A.isPending,onOpen:()=>{p(!0)},onSearch:f,onRequest:D=>{M.mutate({...e,login:D})},onRemove:D=>{A.mutate({...e,login:D})}},onStartComment:(D,P,z)=>{o($=>qRe($,D,P,z))},onStartRangeComment:(D,P)=>{o({path:D,anchorLineLabel:P.startLineLabel,range:P})},onAddComment:(D,P,z)=>{C.mutate({...e,position:pP(D,P),body:z,shouldPostNow:!1})},onPostComment:(D,P,z)=>{C.mutate({...e,position:pP(D,P),body:z,shouldPostNow:!0})},onComment:D=>{C.mutate({...e,position:null,body:D,shouldPostNow:!0})},onReply:(D,P)=>{T.mutate({...e,threadId:D,body:P})},onResolveThread:(D,P)=>{R.mutate({...e,threadId:D,isResolved:P})},onDiscardComment:D=>{O.mutate({...e,commentId:D})},onSubmit:(D,P)=>{k.mutate({...e,verdict:D,body:P})}}},mP=e=>e.kind==="add"||e.kind==="change",KRe=(e,t)=>{var S,E,C;const n=is(),r=_o(),[s,o]=N.useState([]),[l,c]=N.useState(!1),u=O=>{o(T=>T.filter(R=>R!==O))},f=On(n.review.editSegments.mutationOptions({onSuccess:async(O,{edit:T})=>{if(O.kind==="rejected"){mP(T)||t(O.message);return}await r.invalidateQueries(n.review.get.pathFilter()),T.kind==="add"&&c(!1),(T.kind==="change"||T.kind==="remove")&&u(T.segmentId)},onError:(O,{edit:T})=>{mP(T)||t(O.message)}})),h=O=>{f.mutate({...e,edit:"paths"in O?{...O,paths:[...O.paths]}:O})},p=((S=f.variables)==null?void 0:S.edit)??null,x=(((E=f.data)==null?void 0:E.kind)==="rejected"?f.data.message:null)??((C=f.error)==null?void 0:C.message)??null,b=(p==null?void 0:p.kind)==="add";return{isPending:f.isPending,onMove:(O,T)=>{h({kind:"move",segmentId:O,direction:T})},addition:{isWriting:l,isSaving:b&&f.isPending,errorMessage:b?x:null,onEdit:()=>{b&&f.reset(),c(!0)},onSave:O=>{h({kind:"add",...O})},onCancel:()=>{b&&f.reset(),c(!1)}},authoringOf:O=>{const T=(p==null?void 0:p.kind)==="change"&&p.segmentId===O;return{writing:{isWriting:s.includes(O),isSaving:T&&f.isPending,errorMessage:T?x:null,onEdit:()=>{T&&f.reset(),o(R=>R.includes(O)?R:[...R,O])},onSave:R=>{h({kind:"change",segmentId:O,...R})},onCancel:()=>{T&&f.reset(),u(O)}},isPending:f.isPending,onRemove:()=>{h({kind:"remove",segmentId:O})}}}}},YRe="Loading the branches…",WRe=e=>{var f;const t=is(),n=cm(),[r,s]=N.useState(!1),[o,l]=N.useState(""),c=N.useDeferredValue(o),u=ui({...t.review.targetSwitcher.queryOptions({...e,query:c}),enabled:r,placeholderData:Mx});return{switcher:u.data??null,placeholder:((f=u.error)==null?void 0:f.message)??YRe,query:o,onOpen:()=>{s(!0),u.refetch()},onSearch:l,onSwitch:h=>{l(""),n({to:"/pr-reviews/$repoName/$branchId",params:{repoName:e.repositoryName,branchId:h}})}}},XRe=2500,QRe=()=>{const[e,t]=N.useState(null);N.useEffect(()=>{if(e===null)return;const r=window.setTimeout(()=>{t(null)},XRe);return()=>{window.clearTimeout(r)}},[e]);const n=N.useCallback(r=>{t({message:r})},[]);return[(e==null?void 0:e.message)??null,n]},ZRe="The line you drew ends at this card.",JRe=["add-card","change-card","describe"],gP=e=>JRe.includes(e.kind),eAe=(e,t)=>{var R,k,M;const n=is(),r=_o(),[s,o]=N.useState(null),[l,c]=N.useState(null),[u,f]=N.useState([]),h=A=>{f(I=>I.filter(L=>L!==A))},p=On(n.review.editTrace.mutationOptions({onSuccess:async(A,{segmentId:I,edit:L})=>{if(A.kind==="rejected"){gP(L)||t(A.message);return}await Promise.all([r.invalidateQueries(n.review.get.pathFilter()),r.invalidateQueries(n.review.cardForm.pathFilter()),r.invalidateQueries(n.review.cardBlocks.pathFilter())]),L.kind==="add-card"&&(o(null),c(A.nodeId===null?null:{segmentId:I,nodeId:A.nodeId})),L.kind==="change-card"&&c(null),L.kind==="describe"&&h(I)},onError:(A,{edit:I})=>{gP(I)||t(A.message)}})),y=(A,I)=>{p.mutate({...e,segmentId:A,edit:I})},x=((R=p.variables)==null?void 0:R.edit)??null,S=(((k=p.data)==null?void 0:k.kind)==="rejected"?p.data.message:null)??((M=p.error)==null?void 0:M.message)??null,E=(x==null?void 0:x.kind)==="add-card",C=A=>{E&&p.reset(),o(A)},O=(x==null?void 0:x.kind)==="change-card",T=A=>{var I;return(x==null?void 0:x.kind)==="describe"&&((I=p.variables)==null?void 0:I.segmentId)===A};return{cardMovingOf:A=>({onMoveCards:I=>{y(A,{kind:"move-cards",places:[...I]})}}),authoringOf:A=>({board:{isPending:p.isPending,onAddCard:()=>{C({segmentId:A,lineEnd:null})},onClearDiagram:()=>{y(A,{kind:"clear-diagram"})},onRemoveDiagram:()=>{y(A,{kind:"remove-diagram"})},onAddCardAtLineEnd:I=>{C({segmentId:A,lineEnd:{...I,places:[...I.places]}})},onDrawLine:I=>{y(A,{kind:"add-line",...I})},onRemoveLine:I=>{y(A,{kind:"remove-line",...I})},onEditCard:I=>{O&&p.reset(),c({segmentId:A,nodeId:I})},onRemoveCard:I=>{y(A,{kind:"remove-card",nodeId:I})}},description:{isWriting:u.includes(A),isSaving:T(A)&&p.isPending,errorMessage:T(A)?S:null,onEdit:()=>{T(A)&&p.reset(),f(I=>[...I,A])},onSave:I=>{y(A,{kind:"describe",description:I})},onCancel:()=>{T(A)&&p.reset(),h(A)}},onAddDiagram:()=>{y(A,{kind:"add-diagram"})}}),cardAddition:s===null?null:{segmentId:s.segmentId,note:s.lineEnd===null?null:ZRe,isSaving:E&&p.isPending,errorMessage:E?S:null,onSubmit:A=>{y(s.segmentId,{kind:"add-card",...A,...s.lineEnd===null?{}:{lineEnd:s.lineEnd}})},onClose:()=>{o(null)}},cardChange:l===null?null:{...l,isSaving:O&&p.isPending,errorMessage:O?S:null,onSave:A=>{y(l.segmentId,{kind:"change-card",nodeId:l.nodeId,...A})},onClose:()=>{c(null)}}}},tAe=(e,t)=>{const n=is(),r=_o(),s=On(n.review.editWalkthrough.mutationOptions({onSuccess:async o=>{o.kind==="rejected"?t(o.message):await r.invalidateQueries(n.review.get.pathFilter())},onError:o=>{t(o.message)}}));return{isPending:s.isPending,onMoveFile:(o,l,c,u)=>{s.mutate({...e,segmentId:o,edit:{kind:"move-file",path:l,direction:c,shownPaths:[...u]}})},onRemoveFile:(o,l)=>{s.mutate({...e,segmentId:o,edit:{kind:"remove-file",path:l}})},onRemoveWaypoint:(o,l)=>{s.mutate({...e,segmentId:o,edit:{kind:"remove-waypoint",waypointId:l}})}}},nAe=e=>[...e.groups.flatMap(t=>{var n;return[...t.options,...((n=t.more)==null?void 0:n.options)??[]]}),...e.submenus.flatMap(t=>t.options)],rAe=e=>nAe(e).filter(t=>t.isSelected).map(t=>t.key),sAe=(e,t)=>e.length===t.length&&e.every(n=>t.includes(n)),oAe=(e,t)=>e.every(n=>sAe(rAe(n.walkthrough.controls.filter),t)),iAe=e=>e.flatMap(t=>t.walkthrough.files).flatMap(t=>t.rows).flatMap(t=>t.kind==="waypoint"&&!t.waypoint.isReviewed?[t.waypoint.id]:[]).at(0)??null,lAe=new Set,aAe=[],QC=e=>{var n;const t=(n=document.getElementById(e))==null?void 0:n.getBoundingClientRect();return t!==void 0&&t.height>0&&t.top<kT()},ZC=e=>{var t;(t=document.getElementById(e))==null||t.scrollIntoView({block:"start",behavior:"instant"})},cAe=e=>{const[t,n]=N.useState(null),r=N.useRef(null);return N.useLayoutEffect(()=>{t!==null&&ZC(t.anchorId)},[t]),N.useLayoutEffect(()=>{const s=r.current;s!==null&&(r.current=null,ZC(s))},[e]),{holdPlace:s=>{s!==null&&QC(s)&&n(o=>({anchorId:s,count:((o==null?void 0:o.count)??0)+1}))},holdPlaceThroughRefresh:s=>{r.current=QC(s)?s:null}}},uAe=(e,t)=>{const n=N.useRef(null);return N.useLayoutEffect(()=>{const r=n.current;if(r===null||!oAe(e,r.keys))return;n.current=null;const s=iAe(e);s!==null?t(s):r.heldAnchorId!==null&&ZC(r.heldAnchorId)},[e,t]),(r,s)=>{n.current={keys:r,heldAnchorId:QC(s)?s:null}}},dAe=(e,t)=>e.rows.some(n=>n.kind==="waypoint"&&n.waypoint.id===t),fAe=(e,t)=>{var n;return((n=e.flatMap(r=>r.walkthrough.files).find(r=>dAe(r,t)))==null?void 0:n.anchorId)??null},hAe=(e,t)=>e.flatMap(n=>n.walkthrough.files).flatMap(n=>n.rows.flatMap(r=>r.kind==="waypoint"&&r.waypoint.id===t?[{path:n.path,waypoint:r.waypoint,rootBlockId:r.rootBlockId}]:[])).at(0)??null,pAe=e=>({side:"new",startLineLabel:String(e.lineStart),lineLabel:String(e.lineEnd)}),mAe=e=>e.reading===null&&!e.isBeingWritten,gAe=(e,t)=>t==="line"?{kind:"waypoint",waypointId:e.waypoint.id}:e.rootBlockId===null?null:{kind:"root-block",rootBlockId:e.rootBlockId},yP=(e,t,n)=>new Set(n?[...e,...t]:[...e].filter(r=>!t.includes(r))),yAe=(e,t)=>{var n,r;return((n=e.find(s=>s.anchorId===t))==null?void 0:n.anchorId)??((r=e.at(0))==null?void 0:r.anchorId)??null},xAe=(e,t,n)=>{const r=fAe(e,t.currentWaypointId),[s,o]=N.useState({collapsedAnchorIds:lAe,holdingAnchorId:r});s.holdingAnchorId!==r&&o({collapsedAnchorIds:r===null?s.collapsedAnchorIds:yP(s.collapsedAnchorIds,[r],!1),holdingAnchorId:r});const{collapsedAnchorIds:l}=s,{holdPlace:c,holdPlaceThroughRefresh:u}=cAe(e),f=uAe(e,t.onVisitWaypoint),h=(R,k,M)=>{c(M),o(A=>({...A,collapsedAnchorIds:yP(A.collapsedAnchorIds,R,k)}))},p=hAe(e,t.currentWaypointId),y=(p==null?void 0:p.waypoint)??null,{onReviewedChange:x,onFilterChange:b,onShowReviewedChange:S,onCommentOnWaypoint:E,onWriteDescription:C,onWriteUp:O,agentLabel:T}=n;return{isFileCollapsed:R=>l.has(R),onFileCollapsedChange:(R,k)=>{h([R],k,R)},navigationOf:(R,k)=>{const{controls:M}=R.walkthrough,A=R.walkthrough.files.map(D=>D.anchorId),I=yAe(R.walkthrough.files,k.currentAnchorId),L=t.steppingOf(R,k.aboveAnchorIds);return{controls:M,positionLabel:L.positionLabel,canStepBack:L.canStepBack,canStepForward:L.canStepForward,currentWaypoint:y===null?null:{isReviewed:y.isReviewed,isOpen:t.openWaypointIds.has(y.id),canComment:y.lines!==null,canWriteUp:mAe(y),canWriteUpBlock:(p==null?void 0:p.rootBlockId)!=null},areFilesCollapsed:A.length>0&&A.every(D=>l.has(D)),isFileCollapsed:I===null?null:l.has(I),onPrevious:L.onPrevious,onNext:L.onNext,onCurrentReviewedChange:x===null?null:D=>{y!==null&&(D&&!M.reviewedToggle.isShown&&L.onNext(),x(y.id,D))},onCommentOnCurrent:E===null?null:()=>{(p==null?void 0:p.waypoint.lines)!=null&&E(p.path,pAe(p.waypoint.lines))},onDescribeCurrent:C===null?null:()=>{y!==null&&C(y.id)},agentLabel:T,onWriteUpCurrent:O===null?null:D=>{const P=p===null?null:gAe(p,D);P!==null&&O(P)},onFilterChange:b===null?null:D=>{f(D??aAe,R.walkthrough.anchorId),b(D)},onShowReviewedChange:S===null?null:D=>{u(R.walkthrough.anchorId),S(D)},onFilesCollapsedChange:D=>{h(A,D,R.walkthrough.anchorId)},onFileCollapsedChange:D=>{I!==null&&h([I],D,I)},onCurrentOpenChange:t.onCurrentOpenChange}}}},bAe=N.lazy(async()=>await Ut(()=>import("./index-B0zuYONu.js"),__vite__mapDeps([26,25]))),vAe="Loading the editor…",SAe="Remove the file from the walkthrough",xP="Edit the waypoint",wAe="Remove the waypoint",EAe="my-1.5 mr-4 ml-28 rounded-md border border-foreground bg-background p-4 font-sans whitespace-normal",bP=(e,t)=>e.rows.flatMap(n=>n.kind==="waypoint"&&n.waypoint.id===t?[n.waypoint]:[]).at(0)??null,CAe=(e,t)=>{const[n,r]=N.useState(null),s=()=>{r(null)},o=(c,u)=>m.jsx("div",{id:u.anchorId,className:EAe,children:m.jsx(N.Suspense,{fallback:m.jsx("p",{className:"text-muted-foreground",children:vAe}),children:m.jsx(bAe,{reviewKey:e,segmentId:c,waypointId:u.id,legend:`${xP}: ${u.title}`,text:u.text,renderCodeLinkDialog:t.renderCodeLinkDialog,onClose:s})})}),l=(c,u)=>m.jsxs(m.Fragment,{children:[m.jsx(or,{icon:"edit",label:`${xP}: ${u.title}`,onClick:()=>{r(u.id)}}),m.jsx(or,{icon:"delete",label:`${wAe}: ${u.title}`,isDisabled:t.isPending,onClick:()=>{t.onRemoveWaypoint(c,u.id)}})]});return{onWriteDescription:r,authoringOf:(c,u)=>({editedWaypointId:n,renderEditor:f=>{const h=bP(u,f);return h===null?null:o(c,h)},renderActions:f=>{const h=bP(u,f);return h===null?null:l(c,h)},onWriteDescription:r}),headerActionsOf:(c,u)=>m.jsx(or,{icon:"remove",label:`${SAe}: ${u.path}`,isDisabled:t.isPending,onClick:()=>{t.onRemoveFile(c,u.path)}})}},TAe=160,NAe=.33,OAe=900,vP="data-waypoint-focus",JC=e=>{var t;(t=document.getElementById(e))==null||t.scrollIntoView({block:"start"})},RAe=e=>[...document.querySelectorAll(`[${vP}]`)].filter(t=>t.getAttribute(vP)===e),AAe=e=>{const t=RAe(e).map(o=>o.getBoundingClientRect());if(t.length===0)return 0;const n=Math.min(...t.map(o=>o.top)),r=Math.max(...t.map(o=>o.bottom));return Math.max(0,Math.min(r,window.innerHeight)-Math.max(n,kT()))/Math.max(1,r-n)},ky=e=>e.walkthrough.files.flatMap(t=>t.rows.flatMap(n=>n.kind==="waypoint"?[n.waypoint]:[])),kAe=e=>e.flatMap(ky).map(t=>t.anchorId),_Ae=(e,t,n)=>{var r,s;return t===null?{previousId:((r=e.filter(o=>n.has(o.anchorId)).at(-1))==null?void 0:r.id)??null,nextId:((s=e.find(o=>!n.has(o.anchorId)))==null?void 0:s.id)??null}:{previousId:t.previousId,nextId:t.nextId}},MAe=(e,t,n)=>{const r=N.useRef(null);N.useEffect(()=>{if(r.current=null,e===null)return;const s=()=>{r.current??(r.current=window.scrollY)},o=()=>{const c=r.current;if(c===null)return;(Math.abs(window.scrollY-c)>TAe||AAe(e)<NAe)&&n()},l=setTimeout(s,OAe);return window.addEventListener("scrollend",s),window.addEventListener("scroll",o,{passive:!0}),()=>{clearTimeout(l),window.removeEventListener("scrollend",s),window.removeEventListener("scroll",o)}},[e,t,n])},IAe=e=>()=>{e(null)},LAe=e=>e===null||e.isOpening?null:{waypointId:e.waypointId,count:e.count},DAe=e=>{const[t,n]=N.useState(()=>new Set),[r,s]=N.useState(null),[o,l]=N.useState(null),[c,u]=N.useState(null),[f]=N.useState(()=>IAe(l)),h=e.flatMap(ky);N.useEffect(()=>{c!==null&&JC(c.anchorId)},[c]),MAe(o,c,f);const p=(y,x)=>{const b=h.find(S=>S.id===y);b!==void 0&&(s(b.id),l(b.id),x&&n(S=>new Set([...S,b.id])),u(S=>({anchorId:b.anchorId,waypointId:b.id,isOpening:x,count:((S==null?void 0:S.count)??0)+1})))};return{openWaypointIds:t,previewVisit:LAe(c),currentWaypointId:r,focusedWaypointId:o,steppingOf:(y,x)=>{const b=ky(y),S=b.find(C=>C.id===r)??null,E=_Ae(b,S,x);return{positionLabel:(S==null?void 0:S.positionLabel)??null,canStepBack:E.previousId!==null,canStepForward:E.nextId!==null,onPrevious:()=>{p(E.previousId,!1)},onNext:()=>{p(E.nextId,!1)}}},onSectionEntered:y=>{const x=e.find(S=>S.walkthrough.anchorId===y),b=x===void 0?void 0:ky(x).at(0);b!==void 0&&(s(b.id),l(null))},onVisitWaypoint:y=>{p(y,!1)},onToggleWaypoint:y=>{s(y),n(x=>new Set(x.has(y)?[...x].filter(b=>b!==y):[...x,y]))},onCurrentOpenChange:y=>{y||n(x=>new Set([...x].filter(b=>b!==r))),p(r,y)},onOpenCodeLink:y=>{const x=h.find(b=>b.anchorId===y);x===void 0?JC(y):p(x.id,!0)}}},jAe=(e,t)=>e==="open"||e==="unasked"&&!t,PAe=(e,t,n)=>{var S,E;const r=is(),s=_o(),[o,l]=N.useState("unasked"),[c,u]=N.useState(null),f=ui({...r.review.writeUpPlan.queryOptions({...e,sections:c}),enabled:t,placeholderData:Mx}),h=((S=f.data)==null?void 0:S.kind)==="plan"?f.data:null,p=async()=>{await Promise.all([s.invalidateQueries(r.review.get.pathFilter()),s.invalidateQueries(r.review.writeUpPlan.pathFilter())])},y=()=>{l("closed"),u(null)},x=On(r.review.declineWriteUp.mutationOptions({onSuccess:p})),b=On(r.review.writeUp.mutationOptions({onSuccess:async C=>{C.kind!=="rejected"&&(y(),C.kind==="started"&&C.prompt!==null?n.onCopy(C.prompt,C.message):n.onMessage(C.message),C.kind==="started"&&C.prompt===null&&n.onAgentAsked(),await p())},onError:C=>{n.onMessage(C.message)}}));return{plan:h!==null&&jAe(o,h.isOffered)?h:null,canWriteUp:h!==null,agent:h===null?null:{name:h.agent,label:h.agentLabel},problem:((E=b.data)==null?void 0:E.kind)==="rejected"?b.data:null,isPending:b.isPending,onOpen:()=>{b.reset(),l("open")},onSectionsChange:u,onSubmit:C=>{PRe(),b.mutate({...e,...C})},onClose:()=>{h!==null&&!h.isOffered&&x.mutate(e),y()}}},zAe=(e,t)=>{const n=is(),r=_o(),s=On(n.review.requestWriteUp.mutationOptions({onSuccess:async o=>{o.kind==="started"&&o.prompt!==null?t.onCopy(o.prompt,o.message):t.onMessage(o.message),o.kind==="started"&&o.prompt===null&&t.onAgentAsked(),await r.invalidateQueries(n.review.get.pathFilter())},onError:o=>{t.onMessage(o.message)}}));return o=>{s.mutate({...e,target:o})}},BAe=N.lazy(async()=>await Ut(()=>import("./index-CrAQ5_e4.js"),__vite__mapDeps([27,25]))),HAe=N.lazy(async()=>await Ut(()=>import("./index-Bar8NyIm.js"),__vite__mapDeps([28,25]))),FAe=N.lazy(async()=>await Ut(()=>import("./index-JPWJ3IiN.js"),__vite__mapDeps([24,25]))),$Ae=N.lazy(async()=>await Ut(()=>import("./index-DlUHisPA.js"),__vite__mapDeps([29,25]))),UAe=5e3,VAe="The backend did not say what went wrong.",qAe="Could not copy to the clipboard",e2="Loading the editor…",GAe="Add a segment",KAe="New segment",YAe="This Flight Plan has no segments yet.",WAe="Publish anyway",XAe="Arrange segments",QAe="Move a segment up or down. The order is saved as you go.",ZAe="Arrange files",JAe="Move a file up or down in the Code Walkthrough. The order is saved as you go.",eke=[],Dw=[],tke="[--line:var(--primary-text)]",nke="[--band-height:3.5rem] [--pinned-height:calc(var(--band-height)+var(--strip-height,0px))] [--section-scroll-margin:calc(var(--pinned-height)+1rem)] [--file-header-top:var(--pinned-height)] [--waypoint-scroll-margin:calc(var(--pinned-height)+3.5rem)] [--chat-width:26rem] [--navigator-inset-left:calc(1.5rem+13rem+2rem)]",rke="[--strip-height:2.75rem]",ske="[--navigator-inset-right:1.5rem]",oke="[--navigator-inset-right:calc(var(--chat-width)+1.5rem)] [--navigator-band-right:var(--chat-width)]",ike=({writingLabel:e,agent:t,children:n})=>m.jsx(R6,{value:e,children:m.jsx(vb,{value:t,children:n})}),jw=e=>m.jsx(N.Suspense,{fallback:m.jsx("p",{className:"text-sm text-muted-foreground",children:e2}),children:m.jsx($Ae,{...e})}),eU=(e,t)=>({repositoryName:e.repoName,targetId:e.branchId,filterKeys:[...t.filter??[]],isShowingReviewed:t.reviewed===!0}),C_e=({params:e,search:t,onSearchChange:n})=>{var Me,Le,Pe;const r=is(),s=_o(),o=cm(),l=N.use(_4),c={repositoryName:e.repoName,targetId:e.branchId},{data:u}=Sq({...r.review.get.queryOptions(eU(e,t)),refetchInterval:UAe,refetchIntervalInBackground:!0}),[f,h]=N.useState(null),[p,y]=N.useState(!1),[x,b]=N.useState(!1),[S,E]=N.useState(null),[C,O]=QRe(),{isOwn:T}=u,R=u.kind==="artifact"?u.progress:null;BRe(`${e.repoName}/${e.branchId}`,R!==null,u.kind==="artifact"?u.completion:null,O);const k=jRe(),M=HRe(c),A=KRe(c,O),I=eAe(c,O),L=tAe(c,O),D=CAe(c,{isPending:L.isPending,renderCodeLinkDialog:pe=>m.jsx(qh,{reviewKey:c,...pe}),onRemoveFile:L.onRemoveFile,onRemoveWaypoint:L.onRemoveWaypoint}),P=GRe(c,O),z=_Re(c,O),$=WRe(c),j=async()=>{await s.invalidateQueries(r.review.get.pathFilter())},H=pe=>{O(pe.message)},B=(pe,Ae)=>{navigator.clipboard.writeText(pe).then(()=>{O(Ae)},()=>{O(qAe)})},V=$Re(c,u.kind==="artifact",{onMessage:O}),G={onMessage:O,onCopy:B,onAgentAsked:V.onAgentAction},q=PAe(c,u.kind==="artifact",G),K=zAe(c,G),W=q.canWriteUp?K:null,ee=On(r.review.setReviewed.mutationOptions({onSuccess:j,onError:H})),ce=On(r.review.publish.mutationOptions({onSuccess:async({message:pe})=>{O(pe),await j()},onError:H})),F=pe=>{pe==="claude"&&V.onAgentAction(),ce.mutate({...c,destination:pe})},X=On(r.review.markComplete.mutationOptions({onSuccess:async({message:pe,targetId:Ae})=>{O(pe),b(!1),await j(),Ae!==e.branchId&&o({to:"/pr-reviews/$repoName/$branchId",params:{repoName:e.repoName,branchId:Ae}})},onError:H})),te=On(r.review.delete.mutationOptions({onSuccess:async()=>{s.removeQueries(r.review.get.pathFilter()),await o({to:"/"})},onError:H})),Z=u.kind==="artifact"?u:null,Y=(Z==null?void 0:Z.segments.find(pe=>pe.id===S))??null,le=DAe((Z==null?void 0:Z.segments)??Dw),{openWaypointIds:xe,currentWaypointId:fe}=le,oe=le.onOpenCodeLink,re=le.onToggleWaypoint,he=[...(Z==null?void 0:Z.rail.groups.flatMap(pe=>pe.sections))??[],...(Z==null?void 0:Z.rail.sections)??[]],Se=ZOe(he.flatMap(pe=>[pe.anchorId,...pe.children.map(Ae=>Ae.anchorId)]),kAe((Z==null?void 0:Z.segments)??Dw)),ke=xAe((Z==null?void 0:Z.segments)??Dw,le,{onReviewedChange:T?null:(pe,Ae)=>{ee.mutate({...c,subject:{kind:"waypoint",id:pe},isReviewed:Ae})},onFilterChange:pe=>{n({filter:pe===null?void 0:[...pe]})},onShowReviewedChange:T?null:pe=>{n({reviewed:pe?!0:void 0})},onCommentOnWaypoint:T||(Z==null?void 0:Z.composer)==null?null:P.onStartRangeComment,onWriteDescription:T?D.onWriteDescription:null,onWriteUp:W,agentLabel:((Me=q.agent)==null?void 0:Me.label)??null}),be=pe=>{const Ae=Z==null?void 0:Z.segments.find(Ee=>Ee.anchorId===pe);Ae!==void 0&&(A.authoringOf(Ae.id).writing.onEdit(),JC(pe))},_e=(pe,Ae)=>{s.query({...r.review.codeReference.queryOptions({...c,path:pe.path,lineStart:pe.lineStart,lineEnd:pe.lineEnd}),staleTime:"static"}).then(Ae,Ee=>{O(Ee instanceof Error?Ee.message:VAe)})};return m.jsxs("div",{className:ye("px-6 pb-24 transition-[margin] duration-200 ease-out",z.isOpen?["mr-(--chat-width)",oke]:ske,tke,nke,R===null?null:rke),children:[m.jsx("title",{children:u.shell.documentTitle}),l===null?null:Us.createPortal(m.jsxs(m.Fragment,{children:[m.jsx(Wte,{lineColor:"primary"}),m.jsx(uhe,{header:u.shell.header,changedFiles:u.kind==="missing"?u.changedFiles:null,authorLabel:u.shell.authorLabel,reviewerRequesting:P.reviewerRequesting,targetSwitching:$,agentStatus:V.status,actions:u.kind==="missing"?m.jsx(IE,{links:uE,useThemeToggle:sE}):m.jsxs(m.Fragment,{children:[m.jsx(Yde,{label:u.chatLabel,isPressed:z.isOpen,onClick:z.onToggle}),!T||u.unassignedFiles===null?null:m.jsx(Xde,{label:u.unassignedFiles.label,onClick:()=>{h({kind:"list"})}}),u.completeAction===null?null:m.jsx(Wde,{label:u.completeAction.label,isPending:X.isPending,onClick:()=>{var pe;((pe=u.completeAction)==null?void 0:pe.pullRequestChoice)==null?X.mutate({...c,pullRequestTargetId:null}):b(!0)}}),u.sharing===null?null:m.jsx(Zde,{sharing:u.sharing,publishingKey:ce.isPending?ce.variables.destination:null,onPublish:pe=>{u.unassignedFiles===null?F(pe):h({kind:"publish",destination:pe})}}),u.reviewDraft===null?null:m.jsx(Qde,{draft:u.reviewDraft,isSubmitting:P.isSubmitting,isDiscarding:P.isDiscarding,errorMessage:P.submissionError,submissionCount:P.submissionCount,renderEditor:jw,onSubmit:P.onSubmit,onDiscard:P.onDiscardComment}),m.jsx(IE,{links:uE,useThemeToggle:sE,reviewActions:{forgeLink:u.shell.header.kind==="pull-request"?u.shell.header.forgeLink:null,onWriteUp:q.canWriteUp?q.onOpen:null,onDelete:()=>{te.mutate(c)}}})]})})]}),l),u.kind==="missing"?m.jsx("div",{className:"max-w-208",children:m.jsx(ORe,{heading:u.heading,message:u.message})}):null,u.kind==="missing"?null:m.jsx(pse,{rail:u.rail,onSectionJump:le.onSectionEntered,children:m.jsxs(ike,{writingLabel:((Le=u.progress)==null?void 0:Le.isWriting)===!0?u.progress.label:null,agent:q.agent,children:[m.jsx(hRe,{staleNotice:u.staleNotice,unassignedFiles:T?null:u.unassignedFiles,progress:u.progress,onShowUnassignedFiles:()=>{h({kind:"list"})},onCopyPrompt:B}),m.jsxs("div",{className:"grid grid-cols-[13rem_minmax(0,1fr)] gap-x-8",children:[m.jsx("aside",{className:"sticky top-[calc(var(--pinned-height)+0.5rem)] max-h-[calc(100dvh-var(--pinned-height)-1rem)] self-start overflow-y-auto pt-5 pb-4",children:m.jsx(sRe,{label:"Review sections",groups:u.rail.groups,sections:u.rail.sections,readingPosition:Se,onEditGroup:T?be:null,onArrangeGroups:T&&u.segments.some(pe=>pe.outline.canMoveUp)?()=>{y(!0)}:null})}),m.jsxs("div",{className:"min-w-0",children:[u.segments.map(pe=>m.jsxs("section",{id:pe.anchorId,"aria-label":(T?pe.outline.heading:pe.heading)??void 0,className:"scroll-mt-(--section-scroll-margin) not-first:border-t-4 not-first:border-foreground",children:[m.jsx(TRe,{reviewKey:c,heading:pe.heading,isTitleDraft:pe.isTitleDraft,detailLabel:pe.detailLabel,outline:pe.outline,authoring:T&&pe.heading!==null?A.authoringOf(pe.id):null}),m.jsx(Ide,{order:pe.sectionOrder,sections:{context:m.jsx($Oe,{...pe.context,writeUpNotice:pe.writeUpNotices.context,codeLinks:u.codeLinks,editing:T?M(pe.id):null,renderCodeLinkDialog:Ae=>m.jsx(qh,{reviewKey:c,...Ae}),onOpenCodeLink:oe}),traceDiagram:m.jsx(i1e,{...pe.traceDiagram,writeUpNotice:pe.writeUpNotices.traceDiagram,codeLinks:u.codeLinks,codeDefinitions:u.codeDefinitions,isReviewPending:ee.isPending,authoring:T?I.authoringOf(pe.id):null,cardMoving:u.canMoveCards?I.cardMovingOf(pe.id):null,onWriteUpNode:W===null?null:Ae=>{W({kind:"trace-node",segmentId:pe.id,nodeId:Ae})},tabEditing:{authoringOf:Ae=>T?I.authoringOf(Ae):null,cardMovingOf:Ae=>u.canMoveCards?I.cardMovingOf(Ae):null,writeUpOf:Ae=>W===null?null:Ee=>{W({kind:"trace-node",segmentId:Ae,nodeId:Ee})}},renderDescriptionEditor:T?Ae=>m.jsx(N.Suspense,{fallback:m.jsx("p",{className:"text-sm text-muted-foreground",children:e2}),children:m.jsx(FAe,{...Ae,renderCodeLinkDialog:Ee=>m.jsx(qh,{reviewKey:c,...Ee})})}):null,onOpenCodeLink:oe,onWaypointReviewedChange:T?null:(Ae,Ee)=>{ee.mutate({...c,subject:{kind:"waypoint",id:Ae},isReviewed:Ee})}}),blastDiagram:m.jsx(m.Fragment,{children:pe.blastDiagram===null?null:m.jsx(vae,{...pe.blastDiagram,writeUpNotice:pe.writeUpNotices.blastDiagram,onWriteUpFile:W===null?null:Ae=>{W({kind:"blast-file",segmentId:pe.id,path:Ae})},codeLinks:u.codeLinks,renderImpactEditor:T?Ae=>m.jsx(N.Suspense,{fallback:m.jsx("p",{className:"text-muted-foreground",children:e2}),children:m.jsx(HAe,{...Ae,reviewKey:c,renderCodeLinkDialog:Ee=>m.jsx(qh,{reviewKey:c,...Ee})},Ae.path)}):null,onOpenCodeLink:oe,onOpenFile:oe})}),walkthrough:m.jsx(cRe,{anchorId:pe.walkthrough.anchorId,heading:pe.walkthrough.heading,coverageLabel:pe.walkthrough.coverageLabel,emptyMessage:pe.walkthrough.emptyMessage,writeUpNotice:pe.writeUpNotices.walkthrough,readingPosition:Se,navigationOf:Ae=>ke.navigationOf(pe,Ae),onArrangeFiles:T&&pe.walkthrough.fileOrder.length>1?()=>{E(pe.id)}:null,children:pe.walkthrough.files.map(Ae=>m.jsx(Nde,{file:Ae,openWaypointIds:xe,currentWaypointId:fe,focusedWaypointId:le.focusedWaypointId,previewVisit:le.previewVisit,isCollapsed:ke.isFileCollapsed(Ae.anchorId),isReviewPending:ee.isPending,composer:T?null:u.composer,composingRange:P.composingRangeOf(Ae.path),isCommentPending:P.isCommentPending,renderCommentEditor:jw,codeLinks:u.codeLinks,codeDefinitions:u.codeDefinitions,onOpenCodeLink:oe,onToggleWaypoint:re,onCollapsedChange:Ee=>{ke.onFileCollapsedChange(Ae.anchorId,Ee)},onWaypointReviewedChange:T?null:(Ee,je)=>{ee.mutate({...c,subject:{kind:"waypoint",id:Ee},isReviewed:je})},onFileReviewedChange:T?null:(Ee,je)=>{ee.mutate({...c,subject:{kind:"file",path:Ee},isReviewed:je})},onRootBlockReviewedChange:T?null:(Ee,je)=>{ee.mutate({...c,subject:{kind:"root-block",id:Ee},isReviewed:je})},onStartComment:P.onStartComment,onAddComment:P.onAddComment,onPostComment:P.onPostComment,onReply:P.onReply,onResolveThread:P.onResolveThread,onDiscardComment:P.onDiscardComment,onWriteUp:W,authoring:T?D.authoringOf(pe.id,Ae):null,headerActions:T?D.headerActionsOf(pe.id,Ae):null},Ae.anchorId))})}})]},pe.id)),T&&u.segments.length===0&&!A.addition.isWriting?m.jsx("p",{className:"pt-6 text-muted-foreground",children:YAe}):null,T&&A.addition.isWriting?m.jsx(Z7,{reviewKey:c,legend:KAe,label:"",paths:eke,isSaving:A.addition.isSaving,isDeleting:!1,errorMessage:A.addition.errorMessage,onSave:A.addition.onSave,onDelete:null,onClose:A.addition.onCancel}):null,T&&!A.addition.isWriting&&u.segments.every(pe=>pe.heading!==null)?m.jsx(st,{variant:"outline",className:"mt-6",onClick:A.addition.onEdit,children:GAe}):null,u.conversation===null||u.composer===null?null:m.jsx(UOe,{anchorId:u.conversation.anchorId,heading:u.conversation.heading,emptyMessage:u.conversation.emptyMessage,entries:u.conversation.entries,placeholder:u.composer.placeholder,submitLabel:u.composer.commentLabel,isSubmitting:P.isCommentPending,renderEditor:jw,onComment:P.onComment})]})]}),p&&T?m.jsx(zD,{title:XAe,description:QAe,entries:u.segments.map(pe=>({id:pe.id,...pe.outline})),isPending:A.isPending,onMove:A.onMove,onClose:()=>{y(!1)}}):null,!T||Y===null?null:m.jsx(zD,{title:ZAe,description:JAe,entries:Y.walkthrough.fileOrder.map(pe=>({id:pe.path,...pe})),isPending:L.isPending,onMove:(pe,Ae)=>{L.onMoveFile(Y.id,pe,Ae,Y.walkthrough.fileOrder.map(Ee=>Ee.path))},onClose:()=>{E(null)}}),!T||I.cardAddition===null?null:m.jsx(xwe,{reviewKey:c,addition:I.cardAddition}),!T||I.cardChange===null?null:m.jsx(N.Suspense,{fallback:null,children:m.jsx(BAe,{reviewKey:c,change:I.cardChange,renderCodeLinkDialog:pe=>m.jsx(qh,{reviewKey:c,...pe})})}),q.plan===null?null:m.jsx(z1e,{plan:q.plan,problem:q.problem,isPending:q.isPending,onSectionsChange:q.onSectionsChange,onSubmit:q.onSubmit,onClose:q.onClose}),x&&((Pe=u.completeAction)==null?void 0:Pe.pullRequestChoice)!=null?m.jsx(AOe,{choice:u.completeAction.pullRequestChoice,isPending:X.isPending,onComplete:pe=>{X.mutate({...c,pullRequestTargetId:pe})},onClose:()=>{b(!1)}}):null,f===null||u.unassignedFiles===null?null:m.jsx(kRe,{title:u.unassignedFiles.title,description:u.unassignedFiles.description,paths:u.unassignedFiles.paths,confirmation:f.kind==="list"?null:{warning:u.unassignedFiles.publishWarning,confirmLabel:WAe,onConfirm:()=>{F(f.destination),h(null)}},onClose:()=>{h(null)}}),m.jsx(NRe,{selection:k,onComment:(pe,Ae)=>{var Ee;P.onStartRangeComment(pe,Ae),(Ee=window.getSelection())==null||Ee.removeAllRanges()},onAsk:pe=>{_e(pe,({reference:Ae})=>{z.onAsk(Ae),V.onAgentAction()})}}),z.isOpen&&z.conversation!==void 0?m.jsx(Pae,{conversation:z.conversation,modelChoice:z.modelChoice,codeLinks:u.codeLinks,reference:z.reference,isSending:z.isSending,sendProblem:z.sendProblem,answering:z.answering,onSend:pe=>{z.onSend(pe),V.onAgentAction()},onAnswer:(pe,Ae)=>{z.onAnswer(pe,Ae),V.onAgentAction()},onChooseModel:z.onChooseModel,onClearReference:z.onClearReference,onOpenCodeLink:oe,onClose:z.onClose}):null,m.jsx(_B,{}),m.jsx(Efe,{reviewMode:T?"user":"teammate"})]})}),V.dialog===null?null:m.jsx(Mde,{content:V.dialog,isOpening:V.isOpening,problem:V.problem,onOpenTerminal:V.onOpenTerminal,onCopy:B,onClose:V.onClose}),m.jsx(dhe,{message:C})]})},T_e=({error:e})=>m.jsx(X4,{heading:"MAYDAY! MAYDAY! We couldn't open this review",error:e,className:"px-6 pt-8",children:m.jsx(ri,{to:"/",className:"underline",children:"Go to your repositories"})}),lke=e=>Array.isArray(e)?e.filter(t=>typeof t=="string"):void 0,ake=e=>({filter:lke(e.filter),reviewed:e.reviewed===!0?!0:void 0}),cke=()=>Ut(()=>import("./_branchId-Caxyy__g.js"),[]),uke=()=>Ut(()=>import("./_branchId-IJ4VEzEl.js"),[]),dke=ws()({staticData:{isFullWidth:!0,hasPageSettingsMenu:!0},validateSearch:ake,loaderDeps:({search:e})=>e,loader:async({context:{queryClient:e,trpc:t},params:n,deps:r})=>{await e.query({...t.review.get.queryOptions(eU(n,r)),staleTime:"static"})},component:mn(uke,"component"),pendingComponent:Gte,errorComponent:mn(cke,"errorComponent")}),fke=()=>Ut(()=>import("./create-CEpA1s8S.js"),[]),hke=()=>Ut(()=>import("./create-B82q7ZMu.js"),[]),pke=ws()({loader:async({context:{queryClient:e,trpc:t},params:n})=>{await e.query({...t.review.creationForm.queryOptions({repositoryName:n.repoName}),staleTime:"static"})},component:mn(hke,"component"),errorComponent:mn(fke,"errorComponent")}),mke=()=>Ut(()=>import("./index-C9xsdcXo.js"),__vite__mapDeps([30,6])),gke=()=>Ut(()=>import("./index-CJDNq1TA.js"),__vite__mapDeps([31,11])),yke=ws()({loader:async({context:{queryClient:e,trpc:t}})=>{await e.query({...t.configuration.list.queryOptions(),staleTime:"static"})},component:mn(gke,"component"),pendingComponent:Nu,errorComponent:mn(mke,"errorComponent")}),xke=()=>Ut(()=>import("./_id-CvORsoNj.js"),__vite__mapDeps([32,6])),bke=()=>Ut(()=>import("./_id-3L9ONe4W.js"),__vite__mapDeps([33,25])),vke=ws()({validateSearch:e=>typeof e.field=="string"?{field:e.field}:{},loaderDeps:({search:e})=>({field:e.field??null}),loader:async({context:{queryClient:e,trpc:t},params:n,deps:r})=>{await e.query({...t.configuration.get.queryOptions({id:n.id,field:r.field}),staleTime:"static"})},component:mn(bke,"component"),pendingComponent:Nu,errorComponent:mn(xke,"errorComponent")}),Ske=()=>Ut(()=>import("./create-C9yw-thL.js"),__vite__mapDeps([34,6])),wke=()=>Ut(()=>import("./create-D0h6PRxn.js"),__vite__mapDeps([35,11])),Eke=ws()({loader:async({context:{queryClient:e,trpc:t}})=>{await e.query({...t.configuration.creationForm.queryOptions(),staleTime:"static"})},component:mn(wke,"component"),pendingComponent:Nu,errorComponent:mn(Ske,"errorComponent")}),Cke=gte.update({id:"/",path:"/",getParentRoute:()=>Tu}),wl=xte.update({id:"/settings",path:"/settings",getParentRoute:()=>Tu}),Tke=bte.update({id:"/",path:"/",getParentRoute:()=>wl}),Nke=Cte.update({id:"/agents",path:"/agents",getParentRoute:()=>wl}),Oke=Rte.update({id:"/forges",path:"/forges",getParentRoute:()=>wl}),Rke=Mte.update({id:"/repositories",path:"/repositories",getParentRoute:()=>wl}),Ake=jte.update({id:"/review",path:"/review",getParentRoute:()=>wl}),kke=$te.update({id:"/setup/",path:"/setup/",getParentRoute:()=>Tu}),_ke=qte.update({id:"/artifact/claude/download",path:"/artifact/claude/download",getParentRoute:()=>Tu}),Mke=dke.update({id:"/pr-reviews/$repoName/$branchId",path:"/pr-reviews/$repoName/$branchId",getParentRoute:()=>Tu}),Ike=pke.update({id:"/pr-reviews/$repoName/create",path:"/pr-reviews/$repoName/create",getParentRoute:()=>Tu}),Lke=yke.update({id:"/profiles/",path:"/profiles/",getParentRoute:()=>wl}),Dke=vke.update({id:"/profiles/$id",path:"/profiles/$id",getParentRoute:()=>wl}),jke=Eke.update({id:"/profiles/create",path:"/profiles/create",getParentRoute:()=>wl}),Pke={SettingsAgentsRoute:Nke,SettingsForgesRoute:Oke,SettingsRepositoriesRoute:Rke,SettingsReviewRoute:Ake,SettingsIndexRoute:Tke,SettingsProfilesIdRoute:Dke,SettingsProfilesCreateRoute:jke,SettingsProfilesIndexRoute:Lke},zke=wl._addFileChildren(Pke),Bke={IndexRoute:Cke,SettingsRouteRoute:zke,SetupIndexRoute:kke,ArtifactClaudeDownloadRoute:_ke,PrReviewsRepoNameBranchIdRoute:Mke,PrReviewsRepoNameCreateRoute:Ike},Hke=Tu._addFileChildren(Bke)._addFileTypes(),Fke=(e,t)=>yK({routeTree:Hke,context:e,defaultPreload:"intent",defaultPreloadStaleTime:0,...t===void 0?{}:{history:t}}),$ke=({queryClient:e,trpcClient:t,history:n})=>{const r=Fke({queryClient:e,trpc:mX(t,e)},n);return m.jsx(zV,{client:e,children:m.jsx(fX,{trpcClient:t,queryClient:e,children:m.jsx(vK,{router:r})})})},tU=document.getElementById("root");if(!tU)throw new Error("Missing #root element in index.html");const Uke=$ke({queryClient:new cq,trpcClient:pX(hX())});Oq.createRoot(tU).render(m.jsx(N.StrictMode,{children:Uke}));export{Zke as $,zf as A,st as B,su as C,ml as D,Kte as E,Sq as F,_4 as G,vu as H,or as I,Us as J,Wte as K,ff as L,vte as M,Tte as N,A4 as O,Ate as P,Ite as Q,gte as R,iwe as S,jf as T,$te as U,oie as V,iie as W,lie as X,zm as Y,Mae as Z,Qke as _,gl as a,Gb as a$,p1e as a0,w1e as a1,ut as a2,rY as a3,hE as a4,qte as a5,Ute as a6,Gke as a7,T_e as a8,dke as a9,Gs as aA,N7 as aB,Yke as aC,tm as aD,VC as aE,cOe as aF,v_e as aG,LTe as aH,Ue as aI,ft as aJ,UNe as aK,w_e as aL,y_e as aM,b_e as aN,Rt as aO,x_e as aP,u_e as aQ,c_e as aR,nt as aS,kTe as aT,t_e as aU,_n as aV,B7 as aW,r_e as aX,H7 as aY,HTe as aZ,VNe as a_,C_e as aa,cm as ab,pke as ac,vke as ad,$F as ae,Gp as af,VF as ag,mi as ah,gNe as ai,xp as aj,BN as ak,Kt as al,We as am,d_e as an,m_e as ao,s_e as ap,PTe as aq,f_e as ar,_Ne as as,oT as at,si as au,g_e as av,b2 as aw,Lo as ax,S_e as ay,kx as az,yl as b,p_e as b0,nm as b1,i_e as b2,Ie as b3,a_e as b4,l_e as b5,o_e as b6,ar as b7,h_e as b8,iEe as b9,R2e as ba,En as bb,Ro as bc,e_e as bd,z2e as be,P2e as bf,$N as bg,M2 as bh,T6 as bi,N6 as bj,Vx as bk,O6 as bl,n_e as bm,E_e as bn,oy as bo,bl as c,vl as d,xl as e,Xke as f,is as g,_o as h,ui as i,m as j,On as k,Mx as l,Az as m,kz as n,_z as o,Wke as p,Mz as q,N as r,BF as s,Fd as t,qs as u,IY as v,dp as w,ri as x,Jke as y,ye as z};
|