tolmap 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/BUILD_INFO.md +6 -6
- package/LICENSE-DISTRIBUTION.md +4 -4
- package/README.md +20 -11
- package/SOURCE-BUILD.md +4 -4
- package/SOURCE.json +6 -6
- package/THIRD_PARTY_NOTICES.md +1 -1
- package/bin/tolmap.js +5 -5
- package/lib/libigraph.so.4 +0 -0
- package/lib/tolmap +0 -0
- package/licenses/runtime/liblzma5-5.2.5-2ubuntu1.2-copyright +0 -0
- package/licenses/{web/radix-ui__react-scroll-area@1.2.18 → tree-sitter-python}/LICENSE +2 -2
- package/licenses/tree-sitter-python/PROVENANCE.md +54 -0
- package/licenses/web/THIRD_PARTY_NOTICES.md +1 -4
- package/licenses/web/{radix-ui__react-separator@1.1.15 → lezer__highlight@1.2.5}/LICENSE +5 -5
- package/licenses/web/packages.json +4 -31
- package/package.json +1 -1
- package/web/dist/assets/brand/Inter-OFL.txt +93 -0
- package/web/dist/assets/brand/tolmap-1024.png +0 -0
- package/web/dist/assets/brand/tolmap-16.png +0 -0
- package/web/dist/assets/brand/tolmap-192.png +0 -0
- package/web/dist/assets/brand/tolmap-24.png +0 -0
- package/web/dist/assets/brand/tolmap-32.png +0 -0
- package/web/dist/assets/brand/tolmap-48.png +0 -0
- package/web/dist/assets/brand/tolmap-512.png +0 -0
- package/web/dist/assets/brand/tolmap-64.png +0 -0
- package/web/dist/assets/brand/tolmap-app-icon.png +0 -0
- package/web/dist/assets/brand/tolmap-apple-touch-icon.png +0 -0
- package/web/dist/assets/brand/tolmap-lockup-dark.png +0 -0
- package/web/dist/assets/brand/tolmap-lockup-dark.svg +1 -0
- package/web/dist/assets/brand/tolmap-lockup-light.png +0 -0
- package/web/dist/assets/brand/tolmap-lockup-light.svg +1 -0
- package/web/dist/assets/brand/tolmap-lockup.svg +1 -0
- package/web/dist/assets/brand/tolmap-mark-dark.svg +1 -0
- package/web/dist/assets/brand/tolmap-mark-light.svg +1 -0
- package/web/dist/assets/brand/tolmap-mark.svg +1 -0
- package/web/dist/assets/brand/tolmap-wordmark.svg +1 -0
- package/web/dist/assets/{dist-BNhij8mV.js → dist-4cHWhShk.js} +1 -1
- package/web/dist/assets/{dist-DhiTCntv.js → dist-5LZ7afvb.js} +1 -1
- package/web/dist/assets/{dist-BjkGnrMZ.js → dist-B6hauUpI.js} +1 -1
- package/web/dist/assets/{dist-B_Er-tdr.js → dist-BQv6Yu0n.js} +1 -1
- package/web/dist/assets/{dist-BiDoRe9D.js → dist-BlbyXVQV.js} +1 -1
- package/web/dist/assets/{dist-6c4aXhbi.js → dist-C2jvlqwf.js} +1 -1
- package/web/dist/assets/{dist-Cb3YMdvA.js → dist-CPp5jjR3.js} +1 -1
- package/web/dist/assets/{dist-BpNbQKDx.js → dist-CdLdyIp9.js} +1 -1
- package/web/dist/assets/{dist-CwgAOVvQ.js → dist-CwlCG8j2.js} +1 -1
- package/web/dist/assets/{dist-BwlwqxvG.js → dist-DBLAKjXY.js} +1 -1
- package/web/dist/assets/{dist-B2ExgJ2X.js → dist-DJUfxZOQ.js} +1 -1
- package/web/dist/assets/{dist-CbwrhYdz.js → dist-DUzqZzap.js} +1 -1
- package/web/dist/assets/{dist-D9DZdvJR.js → dist-DWHed7FZ.js} +1 -1
- package/web/dist/assets/{dist-B2pJ5QS3.js → dist-DlQ5cyyx.js} +1 -1
- package/web/dist/assets/{dist-CllfLwoI.js → dist-DwkmBsGa.js} +1 -1
- package/web/dist/assets/{dist-aThlveSw.js → dist-EGtMdXiZ.js} +1 -1
- package/web/dist/assets/{dist-Du1n7ZSG.js → dist-TGOhFQVf.js} +1 -1
- package/web/dist/assets/{dist-CPKhY-Mt.js → dist-V7iSuHc2.js} +1 -1
- package/web/dist/assets/{dist-CsYenlD4.js → dist-YzcQS4mo.js} +1 -1
- package/web/dist/assets/{dist-CtZX6MYS.js → dist-rNM8br7y.js} +1 -1
- package/web/dist/assets/{dist-DTc8flxp.js → dist-sMvAEDke.js} +1 -1
- package/web/dist/assets/{dist-nRE-0GfQ.js → dist-u8pJbBs1.js} +1 -1
- package/web/dist/assets/{dist-D59573Id.js → dist-vddRFtpy.js} +1 -1
- package/web/dist/assets/index-CC0E79Qf.css +1 -0
- package/web/dist/assets/index-f5lC5if8.js +24 -0
- package/web/dist/favicon.ico +0 -0
- package/web/dist/favicon.svg +1 -1
- package/web/dist/index.html +7 -3
- package/licenses/web/radix-ui__react-toggle-group@1.1.19/LICENSE +0 -21
- package/licenses/web/radix-ui__react-toggle@1.1.18/LICENSE +0 -21
- package/web/dist/assets/index-4j3Wxxou.js +0 -24
- package/web/dist/assets/index-Cds4WK9K.css +0 -1
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/dist-BlbyXVQV.js","assets/dist-CdLdyIp9.js","assets/dist-B6hauUpI.js","assets/dist-5LZ7afvb.js","assets/dist-rNM8br7y.js","assets/dist-EGtMdXiZ.js","assets/dist-DBLAKjXY.js","assets/dist-sMvAEDke.js","assets/dist-YzcQS4mo.js","assets/dist-TGOhFQVf.js","assets/dist-CwlCG8j2.js","assets/dist-DJUfxZOQ.js","assets/dist-DWHed7FZ.js","assets/dist-CPp5jjR3.js","assets/dist-u8pJbBs1.js","assets/dist-DUzqZzap.js","assets/dist-4cHWhShk.js","assets/dist-vddRFtpy.js","assets/dist-V7iSuHc2.js","assets/dist-C2jvlqwf.js","assets/dist-DwkmBsGa.js","assets/dockerfile-DJkHQgkl.js","assets/simple-mode-DXiLM1-G.js","assets/factor-LKH5gN8L.js","assets/nsis-viPvXFiq.js","assets/pug-3K-JMW4g.js","assets/javascript-Bu8mWwtz.js","assets/dist-DlQ5cyyx.js","assets/dist-BQv6Yu0n.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),s=(e,n)=>{let r={};for(var i in e)t(r,i,{get:e[i],enumerable:!0});return n||t(r,Symbol.toStringTag,{value:`Module`}),r},c=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},l=(n,r,o)=>(o=n==null?{}:e(i(n)),c(r||!n||!n.__esModule||!a.call(n,`default`)?t(o,`default`,{value:n,enumerable:!0}):o,n));(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),t.credentials=e.crossOrigin===`use-credentials`?`include`:e.crossOrigin===`anonymous`?`omit`:`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var u=o((e=>{var t=Symbol.for(`react.element`),n=Symbol.for(`react.portal`),r=Symbol.for(`react.fragment`),i=Symbol.for(`react.strict_mode`),a=Symbol.for(`react.profiler`),o=Symbol.for(`react.provider`),s=Symbol.for(`react.context`),c=Symbol.for(`react.forward_ref`),l=Symbol.for(`react.suspense`),u=Symbol.for(`react.memo`),d=Symbol.for(`react.lazy`),f=Symbol.iterator;function p(e){return typeof e!=`object`||!e?null:(e=f&&e[f]||e[`@@iterator`],typeof e==`function`?e:null)}var m={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},h=Object.assign,g={};function _(e,t,n){this.props=e,this.context=t,this.refs=g,this.updater=n||m}_.prototype.isReactComponent={},_.prototype.setState=function(e,t){if(typeof e!=`object`&&typeof e!=`function`&&e!=null)throw Error(`setState(...): takes an object of state variables to update or a function which returns an object of state variables.`);this.updater.enqueueSetState(this,e,t,`setState`)},_.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,`forceUpdate`)};function v(){}v.prototype=_.prototype;function y(e,t,n){this.props=e,this.context=t,this.refs=g,this.updater=n||m}var b=y.prototype=new v;b.constructor=y,h(b,_.prototype),b.isPureReactComponent=!0;var x=Array.isArray,S=Object.prototype.hasOwnProperty,C={current:null},w={key:!0,ref:!0,__self:!0,__source:!0};function T(e,n,r){var i,a={},o=null,s=null;if(n!=null)for(i in n.ref!==void 0&&(s=n.ref),n.key!==void 0&&(o=``+n.key),n)S.call(n,i)&&!w.hasOwnProperty(i)&&(a[i]=n[i]);var c=arguments.length-2;if(c===1)a.children=r;else if(1<c){for(var l=Array(c),u=0;u<c;u++)l[u]=arguments[u+2];a.children=l}if(e&&e.defaultProps)for(i in c=e.defaultProps,c)a[i]===void 0&&(a[i]=c[i]);return{$$typeof:t,type:e,key:o,ref:s,props:a,_owner:C.current}}function E(e,n){return{$$typeof:t,type:e.type,key:n,ref:e.ref,props:e.props,_owner:e._owner}}function D(e){return typeof e==`object`&&!!e&&e.$$typeof===t}function O(e){var t={"=":`=0`,":":`=2`};return`$`+e.replace(/[=:]/g,function(e){return t[e]})}var k=/\/+/g;function ee(e,t){return typeof e==`object`&&e&&e.key!=null?O(``+e.key):t.toString(36)}function A(e,r,i,a,o){var s=typeof e;(s===`undefined`||s===`boolean`)&&(e=null);var c=!1;if(e===null)c=!0;else switch(s){case`string`:case`number`:c=!0;break;case`object`:switch(e.$$typeof){case t:case n:c=!0}}if(c)return c=e,o=o(c),e=a===``?`.`+ee(c,0):a,x(o)?(i=``,e!=null&&(i=e.replace(k,`$&/`)+`/`),A(o,r,i,``,function(e){return e})):o!=null&&(D(o)&&(o=E(o,i+(!o.key||c&&c.key===o.key?``:(``+o.key).replace(k,`$&/`)+`/`)+e)),r.push(o)),1;if(c=0,a=a===``?`.`:a+`:`,x(e))for(var l=0;l<e.length;l++){s=e[l];var u=a+ee(s,l);c+=A(s,r,i,u,o)}else if(u=p(e),typeof u==`function`)for(e=u.call(e),l=0;!(s=e.next()).done;)s=s.value,u=a+ee(s,l++),c+=A(s,r,i,u,o);else if(s===`object`)throw r=String(e),Error(`Objects are not valid as a React child (found: `+(r===`[object Object]`?`object with keys {`+Object.keys(e).join(`, `)+`}`:r)+`). If you meant to render a collection of children, use an array instead.`);return c}function j(e,t,n){if(e==null)return e;var r=[],i=0;return A(e,r,``,``,function(e){return t.call(n,e,i++)}),r}function M(e){if(e._status===-1){var t=e._result;t=t(),t.then(function(t){(e._status===0||e._status===-1)&&(e._status=1,e._result=t)},function(t){(e._status===0||e._status===-1)&&(e._status=2,e._result=t)}),e._status===-1&&(e._status=0,e._result=t)}if(e._status===1)return e._result.default;throw e._result}var N={current:null},te={transition:null},ne={ReactCurrentDispatcher:N,ReactCurrentBatchConfig:te,ReactCurrentOwner:C};function P(){throw Error(`act(...) is not supported in production builds of React.`)}e.Children={map:j,forEach:function(e,t,n){j(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return j(e,function(){t++}),t},toArray:function(e){return j(e,function(e){return e})||[]},only:function(e){if(!D(e))throw Error(`React.Children.only expected to receive a single React element child.`);return e}},e.Component=_,e.Fragment=r,e.Profiler=a,e.PureComponent=y,e.StrictMode=i,e.Suspense=l,e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=ne,e.act=P,e.cloneElement=function(e,n,r){if(e==null)throw Error(`React.cloneElement(...): The argument must be a React element, but you passed `+e+`.`);var i=h({},e.props),a=e.key,o=e.ref,s=e._owner;if(n!=null){if(n.ref!==void 0&&(o=n.ref,s=C.current),n.key!==void 0&&(a=``+n.key),e.type&&e.type.defaultProps)var c=e.type.defaultProps;for(l in n)S.call(n,l)&&!w.hasOwnProperty(l)&&(i[l]=n[l]===void 0&&c!==void 0?c[l]:n[l])}var l=arguments.length-2;if(l===1)i.children=r;else if(1<l){c=Array(l);for(var u=0;u<l;u++)c[u]=arguments[u+2];i.children=c}return{$$typeof:t,type:e.type,key:a,ref:o,props:i,_owner:s}},e.createContext=function(e){return e={$$typeof:s,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},e.Provider={$$typeof:o,_context:e},e.Consumer=e},e.createElement=T,e.createFactory=function(e){var t=T.bind(null,e);return t.type=e,t},e.createRef=function(){return{current:null}},e.forwardRef=function(e){return{$$typeof:c,render:e}},e.isValidElement=D,e.lazy=function(e){return{$$typeof:d,_payload:{_status:-1,_result:e},_init:M}},e.memo=function(e,t){return{$$typeof:u,type:e,compare:t===void 0?null:t}},e.startTransition=function(e){var t=te.transition;te.transition={};try{e()}finally{te.transition=t}},e.unstable_act=P,e.useCallback=function(e,t){return N.current.useCallback(e,t)},e.useContext=function(e){return N.current.useContext(e)},e.useDebugValue=function(){},e.useDeferredValue=function(e){return N.current.useDeferredValue(e)},e.useEffect=function(e,t){return N.current.useEffect(e,t)},e.useId=function(){return N.current.useId()},e.useImperativeHandle=function(e,t,n){return N.current.useImperativeHandle(e,t,n)},e.useInsertionEffect=function(e,t){return N.current.useInsertionEffect(e,t)},e.useLayoutEffect=function(e,t){return N.current.useLayoutEffect(e,t)},e.useMemo=function(e,t){return N.current.useMemo(e,t)},e.useReducer=function(e,t,n){return N.current.useReducer(e,t,n)},e.useRef=function(e){return N.current.useRef(e)},e.useState=function(e){return N.current.useState(e)},e.useSyncExternalStore=function(e,t,n){return N.current.useSyncExternalStore(e,t,n)},e.useTransition=function(){return N.current.useTransition()},e.version=`18.3.1`})),d=o(((e,t)=>{t.exports=u()})),f=o((e=>{function t(e,t){var n=e.length;e.push(t);a:for(;0<n;){var r=n-1>>>1,a=e[r];if(0<i(a,t))e[r]=t,e[n]=a,n=r;else break a}}function n(e){return e.length===0?null:e[0]}function r(e){if(e.length===0)return null;var t=e[0],n=e.pop();if(n!==t){e[0]=n;a:for(var r=0,a=e.length,o=a>>>1;r<o;){var s=2*(r+1)-1,c=e[s],l=s+1,u=e[l];if(0>i(c,n))l<a&&0>i(u,c)?(e[r]=u,e[l]=n,r=l):(e[r]=c,e[s]=n,r=s);else if(l<a&&0>i(u,n))e[r]=u,e[l]=n,r=l;else break a}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return n===0?e.id-t.id:n}if(typeof performance==`object`&&typeof performance.now==`function`){var a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,s=o.now();e.unstable_now=function(){return o.now()-s}}var c=[],l=[],u=1,d=null,f=3,p=!1,m=!1,h=!1,g=typeof setTimeout==`function`?setTimeout:null,_=typeof clearTimeout==`function`?clearTimeout:null,v=typeof setImmediate<`u`?setImmediate:null;typeof navigator<`u`&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function y(e){for(var i=n(l);i!==null;){if(i.callback===null)r(l);else if(i.startTime<=e)r(l),i.sortIndex=i.expirationTime,t(c,i);else break;i=n(l)}}function b(e){if(h=!1,y(e),!m){if(n(c)!==null)m=!0,j(x);else{var t=n(l);t!==null&&M(b,t.startTime-e)}}}function x(t,i){m=!1,h&&(h=!1,_(w),w=-1),p=!0;var a=f;try{for(y(i),d=n(c);d!==null&&(!(d.expirationTime>i)||t&&!D());){var o=d.callback;if(typeof o==`function`){d.callback=null,f=d.priorityLevel;var s=o(d.expirationTime<=i);i=e.unstable_now(),typeof s==`function`?d.callback=s:d===n(c)&&r(c),y(i)}else r(c);d=n(c)}if(d!==null)var u=!0;else{var g=n(l);g!==null&&M(b,g.startTime-i),u=!1}return u}finally{d=null,f=a,p=!1}}var S=!1,C=null,w=-1,T=5,E=-1;function D(){return!(e.unstable_now()-E<T)}function O(){if(C!==null){var t=e.unstable_now();E=t;var n=!0;try{n=C(!0,t)}finally{n?k():(S=!1,C=null)}}else S=!1}var k;if(typeof v==`function`)k=function(){v(O)};else if(typeof MessageChannel<`u`){var ee=new MessageChannel,A=ee.port2;ee.port1.onmessage=O,k=function(){A.postMessage(null)}}else k=function(){g(O,0)};function j(e){C=e,S||(S=!0,k())}function M(t,n){w=g(function(){t(e.unstable_now())},n)}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(e){e.callback=null},e.unstable_continueExecution=function(){m||p||(m=!0,j(x))},e.unstable_forceFrameRate=function(e){0>e||125<e?console.error(`forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported`):T=0<e?Math.floor(1e3/e):5},e.unstable_getCurrentPriorityLevel=function(){return f},e.unstable_getFirstCallbackNode=function(){return n(c)},e.unstable_next=function(e){switch(f){case 1:case 2:case 3:var t=3;break;default:t=f}var n=f;f=t;try{return e()}finally{f=n}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=f;f=e;try{return t()}finally{f=n}},e.unstable_scheduleCallback=function(r,i,a){var o=e.unstable_now();switch(typeof a==`object`&&a?(a=a.delay,a=typeof a==`number`&&0<a?o+a:o):a=o,r){case 1:var s=-1;break;case 2:s=250;break;case 5:s=1073741823;break;case 4:s=1e4;break;default:s=5e3}return s=a+s,r={id:u++,callback:i,priorityLevel:r,startTime:a,expirationTime:s,sortIndex:-1},a>o?(r.sortIndex=a,t(l,r),n(c)===null&&r===n(l)&&(h?(_(w),w=-1):h=!0,M(b,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,j(x))),r},e.unstable_shouldYield=D,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),p=o(((e,t)=>{t.exports=f()})),m=o((e=>{var t=d(),n=p();function r(e){for(var t=`https://reactjs.org/docs/error-decoder.html?invariant=`+e,n=1;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n]);return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}var i=new Set,a={};function o(e,t){s(e,t),s(e+`Capture`,t)}function s(e,t){for(a[e]=t,e=0;e<t.length;e++)i.add(t[e])}var c=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0,l=Object.prototype.hasOwnProperty,u=/^[: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]*$/,f={},m={};function h(e){return l.call(m,e)?!0:l.call(f,e)?!1:u.test(e)?m[e]=!0:(f[e]=!0,!1)}function g(e,t,n,r){if(n!==null&&n.type===0)return!1;switch(typeof t){case`function`:case`symbol`:return!0;case`boolean`:return r?!1:n===null?(e=e.toLowerCase().slice(0,5),e!==`data-`&&e!==`aria-`):!n.acceptsBooleans;default:return!1}}function _(e,t,n,r){if(t==null||g(e,t,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!t;case 4:return!1===t;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function v(e,t,n,r,i,a,o){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=r,this.attributeNamespace=i,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=a,this.removeEmptyString=o}var y={};`children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style`.split(` `).forEach(function(e){y[e]=new v(e,0,!1,e,null,!1,!1)}),[[`acceptCharset`,`accept-charset`],[`className`,`class`],[`htmlFor`,`for`],[`httpEquiv`,`http-equiv`]].forEach(function(e){var t=e[0];y[t]=new v(t,1,!1,e[1],null,!1,!1)}),[`contentEditable`,`draggable`,`spellCheck`,`value`].forEach(function(e){y[e]=new v(e,2,!1,e.toLowerCase(),null,!1,!1)}),[`autoReverse`,`externalResourcesRequired`,`focusable`,`preserveAlpha`].forEach(function(e){y[e]=new v(e,2,!1,e,null,!1,!1)}),`allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope`.split(` `).forEach(function(e){y[e]=new v(e,3,!1,e.toLowerCase(),null,!1,!1)}),[`checked`,`multiple`,`muted`,`selected`].forEach(function(e){y[e]=new v(e,3,!0,e,null,!1,!1)}),[`capture`,`download`].forEach(function(e){y[e]=new v(e,4,!1,e,null,!1,!1)}),[`cols`,`rows`,`size`,`span`].forEach(function(e){y[e]=new v(e,6,!1,e,null,!1,!1)}),[`rowSpan`,`start`].forEach(function(e){y[e]=new v(e,5,!1,e.toLowerCase(),null,!1,!1)});var b=/[\-:]([a-z])/g;function x(e){return e[1].toUpperCase()}`accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height`.split(` `).forEach(function(e){var t=e.replace(b,x);y[t]=new v(t,1,!1,e,null,!1,!1)}),`xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type`.split(` `).forEach(function(e){var t=e.replace(b,x);y[t]=new v(t,1,!1,e,`http://www.w3.org/1999/xlink`,!1,!1)}),[`xml:base`,`xml:lang`,`xml:space`].forEach(function(e){var t=e.replace(b,x);y[t]=new v(t,1,!1,e,`http://www.w3.org/XML/1998/namespace`,!1,!1)}),[`tabIndex`,`crossOrigin`].forEach(function(e){y[e]=new v(e,1,!1,e.toLowerCase(),null,!1,!1)}),y.xlinkHref=new v(`xlinkHref`,1,!1,`xlink:href`,`http://www.w3.org/1999/xlink`,!0,!1),[`src`,`href`,`action`,`formAction`].forEach(function(e){y[e]=new v(e,1,!1,e.toLowerCase(),null,!0,!0)});function S(e,t,n,r){var i=y.hasOwnProperty(t)?y[t]:null;(i===null?r||!(2<t.length)||t[0]!==`o`&&t[0]!==`O`||t[1]!==`n`&&t[1]!==`N`:i.type!==0)&&(_(t,n,i,r)&&(n=null),r||i===null?h(t)&&(n===null?e.removeAttribute(t):e.setAttribute(t,``+n)):i.mustUseProperty?e[i.propertyName]=n===null?i.type!==3&&``:n:(t=i.attributeName,r=i.attributeNamespace,n===null?e.removeAttribute(t):(i=i.type,n=i===3||i===4&&!0===n?``:``+n,r?e.setAttributeNS(r,t,n):e.setAttribute(t,n))))}var C=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,w=Symbol.for(`react.element`),T=Symbol.for(`react.portal`),E=Symbol.for(`react.fragment`),D=Symbol.for(`react.strict_mode`),O=Symbol.for(`react.profiler`),k=Symbol.for(`react.provider`),ee=Symbol.for(`react.context`),A=Symbol.for(`react.forward_ref`),j=Symbol.for(`react.suspense`),M=Symbol.for(`react.suspense_list`),N=Symbol.for(`react.memo`),te=Symbol.for(`react.lazy`),ne=Symbol.for(`react.offscreen`),P=Symbol.iterator;function re(e){return typeof e!=`object`||!e?null:(e=P&&e[P]||e[`@@iterator`],typeof e==`function`?e:null)}var F=Object.assign,I;function ie(e){if(I===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);I=t&&t[1]||``}return`
|
|
3
|
+
`+I+e}var ae=!1;function oe(e,t){if(!e||ae)return``;ae=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(t){if(t=function(){throw Error()},Object.defineProperty(t.prototype,"props",{set:function(){throw Error()}}),typeof Reflect==`object`&&Reflect.construct){try{Reflect.construct(t,[])}catch(e){var r=e}Reflect.construct(e,[],t)}else{try{t.call()}catch(e){r=e}e.call(t.prototype)}}else{try{throw Error()}catch(e){r=e}e()}}catch(t){if(t&&r&&typeof t.stack==`string`){for(var i=t.stack.split(`
|
|
4
|
+
`),a=r.stack.split(`
|
|
5
|
+
`),o=i.length-1,s=a.length-1;1<=o&&0<=s&&i[o]!==a[s];)s--;for(;1<=o&&0<=s;o--,s--)if(i[o]!==a[s]){if(o!==1||s!==1)do if(o--,s--,0>s||i[o]!==a[s]){var c=`
|
|
6
|
+
`+i[o].replace(` at new `,` at `);return e.displayName&&c.includes(`<anonymous>`)&&(c=c.replace(`<anonymous>`,e.displayName)),c}while(1<=o&&0<=s);break}}}finally{ae=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:``)?ie(e):``}function se(e){switch(e.tag){case 5:return ie(e.type);case 16:return ie(`Lazy`);case 13:return ie(`Suspense`);case 19:return ie(`SuspenseList`);case 0:case 2:case 15:return e=oe(e.type,!1),e;case 11:return e=oe(e.type.render,!1),e;case 1:return e=oe(e.type,!0),e;default:return``}}function ce(e){if(e==null)return null;if(typeof e==`function`)return e.displayName||e.name||null;if(typeof e==`string`)return e;switch(e){case E:return`Fragment`;case T:return`Portal`;case O:return`Profiler`;case D:return`StrictMode`;case j:return`Suspense`;case M:return`SuspenseList`}if(typeof e==`object`)switch(e.$$typeof){case ee:return(e.displayName||`Context`)+`.Consumer`;case k:return(e._context.displayName||`Context`)+`.Provider`;case A:var t=e.render;return e=e.displayName,e||=(e=t.displayName||t.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case N:return t=e.displayName||null,t===null?ce(e.type)||`Memo`:t;case te:t=e._payload,e=e._init;try{return ce(e(t))}catch{}}return null}function le(e){var t=e.type;switch(e.tag){case 24:return`Cache`;case 9:return(t.displayName||`Context`)+`.Consumer`;case 10:return(t._context.displayName||`Context`)+`.Provider`;case 18:return`DehydratedFragment`;case 11:return e=t.render,e=e.displayName||e.name||``,t.displayName||(e===``?`ForwardRef`:`ForwardRef(`+e+`)`);case 7:return`Fragment`;case 5:return t;case 4:return`Portal`;case 3:return`Root`;case 6:return`Text`;case 16:return ce(t);case 8:return t===D?`StrictMode`:`Mode`;case 22:return`Offscreen`;case 12:return`Profiler`;case 21:return`Scope`;case 13:return`Suspense`;case 19:return`SuspenseList`;case 25:return`TracingMarker`;case 1:case 0:case 17:case 2:case 14:case 15:if(typeof t==`function`)return t.displayName||t.name||null;if(typeof t==`string`)return t}return null}function ue(e){switch(typeof e){case`boolean`:case`number`:case`string`:case`undefined`:return e;case`object`:return e;default:return``}}function de(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()===`input`&&(t===`checkbox`||t===`radio`)}function fe(e){var t=de(e)?`checked`:`value`,n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=``+e[t];if(!e.hasOwnProperty(t)&&n!==void 0&&typeof n.get==`function`&&typeof n.set==`function`){var i=n.get,a=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return i.call(this)},set:function(e){r=``+e,a.call(this,e)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(e){r=``+e},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function pe(e){e._valueTracker||=fe(e)}function me(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r=``;return e&&(r=de(e)?e.checked?`true`:`false`:e.value),e=r,e!==n&&(t.setValue(e),!0)}function he(e){if(e||=typeof document<`u`?document:void 0,e===void 0)return null;try{return e.activeElement||e.body}catch{return e.body}}function ge(e,t){var n=t.checked;return F({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function _e(e,t){var n=t.defaultValue==null?``:t.defaultValue,r=t.checked==null?t.defaultChecked:t.checked;n=ue(t.value==null?n:t.value),e._wrapperState={initialChecked:r,initialValue:n,controlled:t.type===`checkbox`||t.type===`radio`?t.checked!=null:t.value!=null}}function ve(e,t){t=t.checked,t!=null&&S(e,`checked`,t,!1)}function ye(e,t){ve(e,t);var n=ue(t.value),r=t.type;if(n!=null)r===`number`?(n===0&&e.value===``||e.value!=n)&&(e.value=``+n):e.value!==``+n&&(e.value=``+n);else if(r===`submit`||r===`reset`){e.removeAttribute(`value`);return}t.hasOwnProperty(`value`)?xe(e,t.type,n):t.hasOwnProperty(`defaultValue`)&&xe(e,t.type,ue(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function be(e,t,n){if(t.hasOwnProperty(`value`)||t.hasOwnProperty(`defaultValue`)){var r=t.type;if(!(r!==`submit`&&r!==`reset`||t.value!==void 0&&t.value!==null))return;t=``+e._wrapperState.initialValue,n||t===e.value||(e.value=t),e.defaultValue=t}n=e.name,n!==``&&(e.name=``),e.defaultChecked=!!e._wrapperState.initialChecked,n!==``&&(e.name=n)}function xe(e,t,n){(t!==`number`||he(e.ownerDocument)!==e)&&(n==null?e.defaultValue=``+e._wrapperState.initialValue:e.defaultValue!==``+n&&(e.defaultValue=``+n))}var Se=Array.isArray;function Ce(e,t,n,r){if(e=e.options,t){t={};for(var i=0;i<n.length;i++)t[`$`+n[i]]=!0;for(n=0;n<e.length;n++)i=t.hasOwnProperty(`$`+e[n].value),e[n].selected!==i&&(e[n].selected=i),i&&r&&(e[n].defaultSelected=!0)}else{for(n=``+ue(n),t=null,i=0;i<e.length;i++){if(e[i].value===n){e[i].selected=!0,r&&(e[i].defaultSelected=!0);return}t!==null||e[i].disabled||(t=e[i])}t!==null&&(t.selected=!0)}}function we(e,t){if(t.dangerouslySetInnerHTML!=null)throw Error(r(91));return F({},t,{value:void 0,defaultValue:void 0,children:``+e._wrapperState.initialValue})}function Te(e,t){var n=t.value;if(n==null){if(n=t.children,t=t.defaultValue,n!=null){if(t!=null)throw Error(r(92));if(Se(n)){if(1<n.length)throw Error(r(93));n=n[0]}t=n}t??=``,n=t}e._wrapperState={initialValue:ue(n)}}function Ee(e,t){var n=ue(t.value),r=ue(t.defaultValue);n!=null&&(n=``+n,n!==e.value&&(e.value=n),t.defaultValue==null&&e.defaultValue!==n&&(e.defaultValue=n)),r!=null&&(e.defaultValue=``+r)}function De(e){var t=e.textContent;t===e._wrapperState.initialValue&&t!==``&&t!==null&&(e.value=t)}function Oe(e){switch(e){case`svg`:return`http://www.w3.org/2000/svg`;case`math`:return`http://www.w3.org/1998/Math/MathML`;default:return`http://www.w3.org/1999/xhtml`}}function ke(e,t){return e==null||e===`http://www.w3.org/1999/xhtml`?Oe(t):e===`http://www.w3.org/2000/svg`&&t===`foreignObject`?`http://www.w3.org/1999/xhtml`:e}var Ae,je=function(e){return typeof MSApp<`u`&&MSApp.execUnsafeLocalFunction?function(t,n,r,i){MSApp.execUnsafeLocalFunction(function(){return e(t,n,r,i)})}:e}(function(e,t){if(e.namespaceURI!==`http://www.w3.org/2000/svg`||`innerHTML`in e)e.innerHTML=t;else{for(Ae||=document.createElement(`div`),Ae.innerHTML=`<svg>`+t.valueOf().toString()+`</svg>`,t=Ae.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function Me(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Ne={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},Pe=[`Webkit`,`ms`,`Moz`,`O`];Object.keys(Ne).forEach(function(e){Pe.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),Ne[t]=Ne[e]})});function Fe(e,t,n){return t==null||typeof t==`boolean`||t===``?``:n||typeof t!=`number`||t===0||Ne.hasOwnProperty(e)&&Ne[e]?(``+t).trim():t+`px`}function Ie(e,t){for(var n in e=e.style,t)if(t.hasOwnProperty(n)){var r=n.indexOf(`--`)===0,i=Fe(n,t[n],r);n===`float`&&(n=`cssFloat`),r?e.setProperty(n,i):e[n]=i}}var Le=F({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function Re(e,t){if(t){if(Le[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(r(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(r(60));if(typeof t.dangerouslySetInnerHTML!=`object`||!(`__html`in t.dangerouslySetInnerHTML))throw Error(r(61))}if(t.style!=null&&typeof t.style!=`object`)throw Error(r(62))}}function ze(e,t){if(e.indexOf(`-`)===-1)return typeof t.is==`string`;switch(e){case`annotation-xml`:case`color-profile`:case`font-face`:case`font-face-src`:case`font-face-uri`:case`font-face-format`:case`font-face-name`:case`missing-glyph`:return!1;default:return!0}}var Be=null;function Ve(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var He=null,Ue=null,We=null;function Ge(e){if(e=Wi(e)){if(typeof He!=`function`)throw Error(r(280));var t=e.stateNode;t&&(t=Ki(t),He(e.stateNode,e.type,t))}}function Ke(e){Ue?We?We.push(e):We=[e]:Ue=e}function qe(){if(Ue){var e=Ue,t=We;if(We=Ue=null,Ge(e),t)for(e=0;e<t.length;e++)Ge(t[e])}}function Je(e,t){return e(t)}function Ye(){}var Xe=!1;function Ze(e,t,n){if(Xe)return e(t,n);Xe=!0;try{return Je(e,t,n)}finally{Xe=!1,(Ue!==null||We!==null)&&(Ye(),qe())}}function Qe(e,t){var n=e.stateNode;if(n===null)return null;var i=Ki(n);if(i===null)return null;n=i[t];a:switch(t){case`onClick`:case`onClickCapture`:case`onDoubleClick`:case`onDoubleClickCapture`:case`onMouseDown`:case`onMouseDownCapture`:case`onMouseMove`:case`onMouseMoveCapture`:case`onMouseUp`:case`onMouseUpCapture`:case`onMouseEnter`:(i=!i.disabled)||(e=e.type,i=e!==`button`&&e!==`input`&&e!==`select`&&e!==`textarea`),e=!i;break a;default:e=!1}if(e)return null;if(n&&typeof n!=`function`)throw Error(r(231,t,typeof n));return n}var $e=!1;if(c)try{var et={};Object.defineProperty(et,"passive",{get:function(){$e=!0}}),window.addEventListener(`test`,et,et),window.removeEventListener(`test`,et,et)}catch{$e=!1}function tt(e,t,n,r,i,a,o,s,c){var l=Array.prototype.slice.call(arguments,3);try{t.apply(n,l)}catch(e){this.onError(e)}}var nt=!1,rt=null,it=!1,L=null,at={onError:function(e){nt=!0,rt=e}};function ot(e,t,n,r,i,a,o,s,c){nt=!1,rt=null,tt.apply(at,arguments)}function st(e,t,n,i,a,o,s,c,l){if(ot.apply(this,arguments),nt){if(nt){var u=rt;nt=!1,rt=null}else throw Error(r(198));it||(it=!0,L=u)}}function ct(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,t.flags&4098&&(n=t.return),e=t.return;while(e)}return t.tag===3?n:null}function lt(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function ut(e){if(ct(e)!==e)throw Error(r(188))}function dt(e){var t=e.alternate;if(!t){if(t=ct(e),t===null)throw Error(r(188));return t===e?e:null}for(var n=e,i=t;;){var a=n.return;if(a===null)break;var o=a.alternate;if(o===null){if(i=a.return,i!==null){n=i;continue}break}if(a.child===o.child){for(o=a.child;o;){if(o===n)return ut(a),e;if(o===i)return ut(a),t;o=o.sibling}throw Error(r(188))}if(n.return!==i.return)n=a,i=o;else{for(var s=!1,c=a.child;c;){if(c===n){s=!0,n=a,i=o;break}if(c===i){s=!0,i=a,n=o;break}c=c.sibling}if(!s){for(c=o.child;c;){if(c===n){s=!0,n=o,i=a;break}if(c===i){s=!0,i=o,n=a;break}c=c.sibling}if(!s)throw Error(r(189))}}if(n.alternate!==i)throw Error(r(190))}if(n.tag!==3)throw Error(r(188));return n.stateNode.current===n?e:t}function ft(e){return e=dt(e),e===null?null:pt(e)}function pt(e){if(e.tag===5||e.tag===6)return e;for(e=e.child;e!==null;){var t=pt(e);if(t!==null)return t;e=e.sibling}return null}var mt=n.unstable_scheduleCallback,ht=n.unstable_cancelCallback,gt=n.unstable_shouldYield,_t=n.unstable_requestPaint,vt=n.unstable_now,yt=n.unstable_getCurrentPriorityLevel,bt=n.unstable_ImmediatePriority,xt=n.unstable_UserBlockingPriority,St=n.unstable_NormalPriority,Ct=n.unstable_LowPriority,wt=n.unstable_IdlePriority,Tt=null,Et=null;function Dt(e){if(Et&&typeof Et.onCommitFiberRoot==`function`)try{Et.onCommitFiberRoot(Tt,e,void 0,(e.current.flags&128)==128)}catch{}}var Ot=Math.clz32?Math.clz32:jt,kt=Math.log,At=Math.LN2;function jt(e){return e>>>=0,e===0?32:31-(kt(e)/At|0)|0}var Mt=64,Nt=4194304;function Pt(e){switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64: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 e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function Ft(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,i=e.suspendedLanes,a=e.pingedLanes,o=n&268435455;if(o!==0){var s=o&~i;s===0?(a&=o,a!==0&&(r=Pt(a))):r=Pt(s)}else o=n&~i,o===0?a!==0&&(r=Pt(a)):r=Pt(o);if(r===0)return 0;if(t!==0&&t!==r&&(t&i)===0&&(i=r&-r,a=t&-t,i>=a||i===16&&a&4194240))return t;if(r&4&&(r|=n&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=r;0<t;)n=31-Ot(t),i=1<<n,r|=e[n],t&=~i;return r}function It(e,t){switch(e){case 1:case 2:case 4:return t+250;case 8:case 16:case 32:case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return-1;case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Lt(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,i=e.expirationTimes,a=e.pendingLanes;0<a;){var o=31-Ot(a),s=1<<o,c=i[o];c===-1?((s&n)===0||(s&r)!==0)&&(i[o]=It(s,t)):c<=t&&(e.expiredLanes|=s),a&=~s}}function Rt(e){return e=e.pendingLanes&-1073741825,e===0?e&1073741824?1073741824:0:e}function zt(){var e=Mt;return Mt<<=1,!(Mt&4194240)&&(Mt=64),e}function Bt(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function Vt(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-Ot(t),e[t]=n}function Ht(e,t){var n=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var r=e.eventTimes;for(e=e.expirationTimes;0<n;){var i=31-Ot(n),a=1<<i;t[i]=0,r[i]=-1,e[i]=-1,n&=~a}}function Ut(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-Ot(n),i=1<<r;i&t|e[r]&t&&(e[r]|=t),n&=~i}}var R=0;function Wt(e){return e&=-e,1<e?4<e?e&268435455?16:536870912:4:1}var Gt,Kt,qt,Jt,Yt,Xt=!1,Zt=[],Qt=null,$t=null,en=null,tn=new Map,nn=new Map,rn=[],an=`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 submit`.split(` `);function on(e,t){switch(e){case`focusin`:case`focusout`:Qt=null;break;case`dragenter`:case`dragleave`:$t=null;break;case`mouseover`:case`mouseout`:en=null;break;case`pointerover`:case`pointerout`:tn.delete(t.pointerId);break;case`gotpointercapture`:case`lostpointercapture`:nn.delete(t.pointerId)}}function sn(e,t,n,r,i,a){return e===null||e.nativeEvent!==a?(e={blockedOn:t,domEventName:n,eventSystemFlags:r,nativeEvent:a,targetContainers:[i]},t!==null&&(t=Wi(t),t!==null&&Kt(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,i!==null&&t.indexOf(i)===-1&&t.push(i),e)}function cn(e,t,n,r,i){switch(t){case`focusin`:return Qt=sn(Qt,e,t,n,r,i),!0;case`dragenter`:return $t=sn($t,e,t,n,r,i),!0;case`mouseover`:return en=sn(en,e,t,n,r,i),!0;case`pointerover`:var a=i.pointerId;return tn.set(a,sn(tn.get(a)||null,e,t,n,r,i)),!0;case`gotpointercapture`:return a=i.pointerId,nn.set(a,sn(nn.get(a)||null,e,t,n,r,i)),!0}return!1}function ln(e){var t=Ui(e.target);if(t!==null){var n=ct(t);if(n!==null){if(t=n.tag,t===13){if(t=lt(n),t!==null){e.blockedOn=t,Yt(e.priority,function(){qt(n)});return}}else if(t===3&&n.stateNode.current.memoizedState.isDehydrated){e.blockedOn=n.tag===3?n.stateNode.containerInfo:null;return}}}e.blockedOn=null}function un(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=xn(e.domEventName,e.eventSystemFlags,t[0],e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);Be=r,n.target.dispatchEvent(r),Be=null}else return t=Wi(n),t!==null&&Kt(t),e.blockedOn=n,!1;t.shift()}return!0}function dn(e,t,n){un(e)&&n.delete(t)}function fn(){Xt=!1,Qt!==null&&un(Qt)&&(Qt=null),$t!==null&&un($t)&&($t=null),en!==null&&un(en)&&(en=null),tn.forEach(dn),nn.forEach(dn)}function pn(e,t){e.blockedOn===t&&(e.blockedOn=null,Xt||(Xt=!0,n.unstable_scheduleCallback(n.unstable_NormalPriority,fn)))}function mn(e){function t(t){return pn(t,e)}if(0<Zt.length){pn(Zt[0],e);for(var n=1;n<Zt.length;n++){var r=Zt[n];r.blockedOn===e&&(r.blockedOn=null)}}for(Qt!==null&&pn(Qt,e),$t!==null&&pn($t,e),en!==null&&pn(en,e),tn.forEach(t),nn.forEach(t),n=0;n<rn.length;n++)r=rn[n],r.blockedOn===e&&(r.blockedOn=null);for(;0<rn.length&&(n=rn[0],n.blockedOn===null);)ln(n),n.blockedOn===null&&rn.shift()}var hn=C.ReactCurrentBatchConfig,gn=!0;function _n(e,t,n,r){var i=R,a=hn.transition;hn.transition=null;try{R=1,yn(e,t,n,r)}finally{R=i,hn.transition=a}}function vn(e,t,n,r){var i=R,a=hn.transition;hn.transition=null;try{R=4,yn(e,t,n,r)}finally{R=i,hn.transition=a}}function yn(e,t,n,r){if(gn){var i=xn(e,t,n,r);if(i===null)hi(e,t,r,bn,n),on(e,r);else if(cn(i,e,t,n,r))r.stopPropagation();else if(on(e,r),t&4&&-1<an.indexOf(e)){for(;i!==null;){var a=Wi(i);if(a!==null&&Gt(a),a=xn(e,t,n,r),a===null&&hi(e,t,r,bn,n),a===i)break;i=a}i!==null&&r.stopPropagation()}else hi(e,t,r,null,n)}}var bn=null;function xn(e,t,n,r){if(bn=null,e=Ve(r),e=Ui(e),e!==null){if(t=ct(e),t===null)e=null;else if(n=t.tag,n===13){if(e=lt(t),e!==null)return e;e=null}else if(n===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null)}return bn=e,null}function Sn(e){switch(e){case`cancel`:case`click`:case`close`:case`contextmenu`:case`copy`:case`cut`:case`auxclick`:case`dblclick`:case`dragend`:case`dragstart`:case`drop`:case`focusin`:case`focusout`:case`input`:case`invalid`:case`keydown`:case`keypress`:case`keyup`:case`mousedown`:case`mouseup`:case`paste`:case`pause`:case`play`:case`pointercancel`:case`pointerdown`:case`pointerup`:case`ratechange`:case`reset`:case`resize`:case`seeked`:case`submit`:case`touchcancel`:case`touchend`:case`touchstart`:case`volumechange`:case`change`:case`selectionchange`:case`textInput`:case`compositionstart`:case`compositionend`:case`compositionupdate`:case`beforeblur`:case`afterblur`:case`beforeinput`:case`blur`:case`fullscreenchange`:case`focus`:case`hashchange`:case`popstate`:case`select`:case`selectstart`:return 1;case`drag`:case`dragenter`:case`dragexit`:case`dragleave`:case`dragover`:case`mousemove`:case`mouseout`:case`mouseover`:case`pointermove`:case`pointerout`:case`pointerover`:case`scroll`:case`toggle`:case`touchmove`:case`wheel`:case`mouseenter`:case`mouseleave`:case`pointerenter`:case`pointerleave`:return 4;case`message`:switch(yt()){case bt:return 1;case xt:return 4;case St:case Ct:return 16;case wt:return 536870912;default:return 16}default:return 16}}var Cn=null,wn=null,Tn=null;function En(){if(Tn)return Tn;var e,t=wn,n=t.length,r,i=`value`in Cn?Cn.value:Cn.textContent,a=i.length;for(e=0;e<n&&t[e]===i[e];e++);var o=n-e;for(r=1;r<=o&&t[n-r]===i[a-r];r++);return Tn=i.slice(e,1<r?1-r:void 0)}function Dn(e){var t=e.keyCode;return`charCode`in e?(e=e.charCode,e===0&&t===13&&(e=13)):e=t,e===10&&(e=13),32<=e||e===13?e:0}function On(){return!0}function kn(){return!1}function An(e){function t(t,n,r,i,a){for(var o in this._reactName=t,this._targetInst=r,this.type=n,this.nativeEvent=i,this.target=a,this.currentTarget=null,e)e.hasOwnProperty(o)&&(t=e[o],this[o]=t?t(i):i[o]);return this.isDefaultPrevented=(i.defaultPrevented==null?!1===i.returnValue:i.defaultPrevented)?On:kn,this.isPropagationStopped=kn,this}return F(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var e=this.nativeEvent;e&&(e.preventDefault?e.preventDefault():typeof e.returnValue!=`unknown`&&(e.returnValue=!1),this.isDefaultPrevented=On)},stopPropagation:function(){var e=this.nativeEvent;e&&(e.stopPropagation?e.stopPropagation():typeof e.cancelBubble!=`unknown`&&(e.cancelBubble=!0),this.isPropagationStopped=On)},persist:function(){},isPersistent:On}),t}var jn={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Mn=An(jn),Nn=F({},jn,{view:0,detail:0}),Pn=An(Nn),Fn,In,Ln,Rn=F({},Nn,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Yn,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return`movementX`in e?e.movementX:(e!==Ln&&(Ln&&e.type===`mousemove`?(Fn=e.screenX-Ln.screenX,In=e.screenY-Ln.screenY):In=Fn=0,Ln=e),Fn)},movementY:function(e){return`movementY`in e?e.movementY:In}}),zn=An(Rn),Bn=An(F({},Rn,{dataTransfer:0})),Vn=An(F({},Nn,{relatedTarget:0})),Hn=An(F({},jn,{animationName:0,elapsedTime:0,pseudoElement:0})),Un=An(F({},jn,{clipboardData:function(e){return`clipboardData`in e?e.clipboardData:window.clipboardData}})),Wn=An(F({},jn,{data:0})),Gn={Esc:`Escape`,Spacebar:` `,Left:`ArrowLeft`,Up:`ArrowUp`,Right:`ArrowRight`,Down:`ArrowDown`,Del:`Delete`,Win:`OS`,Menu:`ContextMenu`,Apps:`ContextMenu`,Scroll:`ScrollLock`,MozPrintableKey:`Unidentified`},Kn={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`},qn={Alt:`altKey`,Control:`ctrlKey`,Meta:`metaKey`,Shift:`shiftKey`};function Jn(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=qn[e])?!!t[e]:!1}function Yn(){return Jn}var Xn=An(F({},Nn,{key:function(e){if(e.key){var t=Gn[e.key]||e.key;if(t!==`Unidentified`)return t}return e.type===`keypress`?(e=Dn(e),e===13?`Enter`:String.fromCharCode(e)):e.type===`keydown`||e.type===`keyup`?Kn[e.keyCode]||`Unidentified`:``},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Yn,charCode:function(e){return e.type===`keypress`?Dn(e):0},keyCode:function(e){return e.type===`keydown`||e.type===`keyup`?e.keyCode:0},which:function(e){return e.type===`keypress`?Dn(e):e.type===`keydown`||e.type===`keyup`?e.keyCode:0}})),Zn=An(F({},Rn,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0})),Qn=An(F({},Nn,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Yn})),$n=An(F({},jn,{propertyName:0,elapsedTime:0,pseudoElement:0})),er=An(F({},Rn,{deltaX:function(e){return`deltaX`in e?e.deltaX:`wheelDeltaX`in e?-e.wheelDeltaX:0},deltaY:function(e){return`deltaY`in e?e.deltaY:`wheelDeltaY`in e?-e.wheelDeltaY:`wheelDelta`in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0})),tr=[9,13,27,32],nr=c&&`CompositionEvent`in window,rr=null;c&&`documentMode`in document&&(rr=document.documentMode);var ir=c&&`TextEvent`in window&&!rr,ar=c&&(!nr||rr&&8<rr&&11>=rr),or=` `,sr=!1;function cr(e,t){switch(e){case`keyup`:return tr.indexOf(t.keyCode)!==-1;case`keydown`:return t.keyCode!==229;case`keypress`:case`mousedown`:case`focusout`:return!0;default:return!1}}function lr(e){return e=e.detail,typeof e==`object`&&`data`in e?e.data:null}var ur=!1;function dr(e,t){switch(e){case`compositionend`:return lr(t);case`keypress`:return t.which===32?(sr=!0,or):null;case`textInput`:return e=t.data,e===or&&sr?null:e;default:return null}}function fr(e,t){if(ur)return e===`compositionend`||!nr&&cr(e,t)?(e=En(),Tn=wn=Cn=null,ur=!1,e):null;switch(e){case`paste`:return null;case`keypress`:if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case`compositionend`:return ar&&t.locale!==`ko`?null:t.data;default:return null}}var pr={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 mr(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t===`input`?!!pr[e.type]:t===`textarea`}function hr(e,t,n,r){Ke(r),t=_i(t,`onChange`),0<t.length&&(n=new Mn(`onChange`,`change`,null,n,r),e.push({event:n,listeners:t}))}var gr=null,_r=null;function vr(e){li(e,0)}function yr(e){if(me(Gi(e)))return e}function br(e,t){if(e===`change`)return t}var xr=!1;if(c){var Sr;if(c){var Cr=`oninput`in document;if(!Cr){var wr=document.createElement(`div`);wr.setAttribute(`oninput`,`return;`),Cr=typeof wr.oninput==`function`}Sr=Cr}else Sr=!1;xr=Sr&&(!document.documentMode||9<document.documentMode)}function Tr(){gr&&(gr.detachEvent(`onpropertychange`,Er),_r=gr=null)}function Er(e){if(e.propertyName===`value`&&yr(_r)){var t=[];hr(t,_r,e,Ve(e)),Ze(vr,t)}}function Dr(e,t,n){e===`focusin`?(Tr(),gr=t,_r=n,gr.attachEvent(`onpropertychange`,Er)):e===`focusout`&&Tr()}function Or(e){if(e===`selectionchange`||e===`keyup`||e===`keydown`)return yr(_r)}function kr(e,t){if(e===`click`)return yr(t)}function Ar(e,t){if(e===`input`||e===`change`)return yr(t)}function jr(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var Mr=typeof Object.is==`function`?Object.is:jr;function Nr(e,t){if(Mr(e,t))return!0;if(typeof e!=`object`||!e||typeof t!=`object`||!t)return!1;var n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(r=0;r<n.length;r++){var i=n[r];if(!l.call(t,i)||!Mr(e[i],t[i]))return!1}return!0}function Pr(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Fr(e,t){var n=Pr(e);e=0;for(var r;n;){if(n.nodeType===3){if(r=e+n.textContent.length,e<=t&&r>=t)return{node:n,offset:t-e};e=r}a:{for(;n;){if(n.nextSibling){n=n.nextSibling;break a}n=n.parentNode}n=void 0}n=Pr(n)}}function Ir(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Ir(e,t.parentNode):`contains`in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Lr(){for(var e=window,t=he();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href==`string`}catch{n=!1}if(n)e=t.contentWindow;else break;t=he(e.document)}return t}function Rr(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t===`input`&&(e.type===`text`||e.type===`search`||e.type===`tel`||e.type===`url`||e.type===`password`)||t===`textarea`||e.contentEditable===`true`)}function zr(e){var t=Lr(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&Ir(n.ownerDocument.documentElement,n)){if(r!==null&&Rr(n)){if(t=r.start,e=r.end,e===void 0&&(e=t),`selectionStart`in n)n.selectionStart=t,n.selectionEnd=Math.min(e,n.value.length);else if(e=(t=n.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var i=n.textContent.length,a=Math.min(r.start,i);r=r.end===void 0?a:Math.min(r.end,i),!e.extend&&a>r&&(i=r,r=a,a=i),i=Fr(n,a);var o=Fr(n,r);i&&o&&(e.rangeCount!==1||e.anchorNode!==i.node||e.anchorOffset!==i.offset||e.focusNode!==o.node||e.focusOffset!==o.offset)&&(t=t.createRange(),t.setStart(i.node,i.offset),e.removeAllRanges(),a>r?(e.addRange(t),e.extend(o.node,o.offset)):(t.setEnd(o.node,o.offset),e.addRange(t)))}}for(t=[],e=n;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof n.focus==`function`&&n.focus(),n=0;n<t.length;n++)e=t[n],e.element.scrollLeft=e.left,e.element.scrollTop=e.top}}var Br=c&&`documentMode`in document&&11>=document.documentMode,Vr=null,Hr=null,Ur=null,Wr=!1;function Gr(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Wr||Vr==null||Vr!==he(r)||(r=Vr,`selectionStart`in r&&Rr(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),Ur&&Nr(Ur,r)||(Ur=r,r=_i(Hr,`onSelect`),0<r.length&&(t=new Mn(`onSelect`,`select`,null,t,n),e.push({event:t,listeners:r}),t.target=Vr)))}function Kr(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n[`Webkit`+e]=`webkit`+t,n[`Moz`+e]=`moz`+t,n}var qr={animationend:Kr(`Animation`,`AnimationEnd`),animationiteration:Kr(`Animation`,`AnimationIteration`),animationstart:Kr(`Animation`,`AnimationStart`),transitionend:Kr(`Transition`,`TransitionEnd`)},Jr={},Yr={};c&&(Yr=document.createElement(`div`).style,`AnimationEvent`in window||(delete qr.animationend.animation,delete qr.animationiteration.animation,delete qr.animationstart.animation),`TransitionEvent`in window||delete qr.transitionend.transition);function Xr(e){if(Jr[e])return Jr[e];if(!qr[e])return e;var t=qr[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in Yr)return Jr[e]=t[n];return e}var Zr=Xr(`animationend`),Qr=Xr(`animationiteration`),$r=Xr(`animationstart`),ei=Xr(`transitionend`),ti=new Map,ni=`abort auxClick cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel`.split(` `);function ri(e,t){ti.set(e,t),o(t,[e])}for(var ii=0;ii<ni.length;ii++){var ai=ni[ii];ri(ai.toLowerCase(),`on`+(ai[0].toUpperCase()+ai.slice(1)))}ri(Zr,`onAnimationEnd`),ri(Qr,`onAnimationIteration`),ri($r,`onAnimationStart`),ri(`dblclick`,`onDoubleClick`),ri(`focusin`,`onFocus`),ri(`focusout`,`onBlur`),ri(ei,`onTransitionEnd`),s(`onMouseEnter`,[`mouseout`,`mouseover`]),s(`onMouseLeave`,[`mouseout`,`mouseover`]),s(`onPointerEnter`,[`pointerout`,`pointerover`]),s(`onPointerLeave`,[`pointerout`,`pointerover`]),o(`onChange`,`change click focusin focusout input keydown keyup selectionchange`.split(` `)),o(`onSelect`,`focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange`.split(` `)),o(`onBeforeInput`,[`compositionend`,`keypress`,`textInput`,`paste`]),o(`onCompositionEnd`,`compositionend focusout keydown keypress keyup mousedown`.split(` `)),o(`onCompositionStart`,`compositionstart focusout keydown keypress keyup mousedown`.split(` `)),o(`onCompositionUpdate`,`compositionupdate focusout keydown keypress keyup mousedown`.split(` `));var oi=`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(` `),si=new Set(`cancel close invalid load scroll toggle`.split(` `).concat(oi));function ci(e,t,n){var r=e.type||`unknown-event`;e.currentTarget=n,st(r,t,void 0,e),e.currentTarget=null}function li(e,t){t=!!(t&4);for(var n=0;n<e.length;n++){var r=e[n],i=r.event;r=r.listeners;a:{var a=void 0;if(t)for(var o=r.length-1;0<=o;o--){var s=r[o],c=s.instance,l=s.currentTarget;if(s=s.listener,c!==a&&i.isPropagationStopped())break a;ci(i,s,l),a=c}else for(o=0;o<r.length;o++){if(s=r[o],c=s.instance,l=s.currentTarget,s=s.listener,c!==a&&i.isPropagationStopped())break a;ci(i,s,l),a=c}}}if(it)throw e=L,it=!1,L=null,e}function ui(e,t){var n=t[Bi];n===void 0&&(n=t[Bi]=new Set);var r=e+`__bubble`;n.has(r)||(mi(t,e,2,!1),n.add(r))}function di(e,t,n){var r=0;t&&(r|=4),mi(n,e,r,t)}var fi=`_reactListening`+Math.random().toString(36).slice(2);function pi(e){if(!e[fi]){e[fi]=!0,i.forEach(function(t){t!==`selectionchange`&&(si.has(t)||di(t,!1,e),di(t,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[fi]||(t[fi]=!0,di(`selectionchange`,!1,t))}}function mi(e,t,n,r){switch(Sn(t)){case 1:var i=_n;break;case 4:i=vn;break;default:i=yn}n=i.bind(null,t,n,e),i=void 0,!$e||t!==`touchstart`&&t!==`touchmove`&&t!==`wheel`||(i=!0),r?i===void 0?e.addEventListener(t,n,!0):e.addEventListener(t,n,{capture:!0,passive:i}):i===void 0?e.addEventListener(t,n,!1):e.addEventListener(t,n,{passive:i})}function hi(e,t,n,r,i){var a=r;if(!(t&1)&&!(t&2)&&r!==null)a:for(;;){if(r===null)return;var o=r.tag;if(o===3||o===4){var s=r.stateNode.containerInfo;if(s===i||s.nodeType===8&&s.parentNode===i)break;if(o===4)for(o=r.return;o!==null;){var c=o.tag;if((c===3||c===4)&&(c=o.stateNode.containerInfo,c===i||c.nodeType===8&&c.parentNode===i))return;o=o.return}for(;s!==null;){if(o=Ui(s),o===null)return;if(c=o.tag,c===5||c===6){r=a=o;continue a}s=s.parentNode}}r=r.return}Ze(function(){var r=a,i=Ve(n),o=[];a:{var s=ti.get(e);if(s!==void 0){var c=Mn,l=e;switch(e){case`keypress`:if(Dn(n)===0)break a;case`keydown`:case`keyup`:c=Xn;break;case`focusin`:l=`focus`,c=Vn;break;case`focusout`:l=`blur`,c=Vn;break;case`beforeblur`:case`afterblur`:c=Vn;break;case`click`:if(n.button===2)break a;case`auxclick`:case`dblclick`:case`mousedown`:case`mousemove`:case`mouseup`:case`mouseout`:case`mouseover`:case`contextmenu`:c=zn;break;case`drag`:case`dragend`:case`dragenter`:case`dragexit`:case`dragleave`:case`dragover`:case`dragstart`:case`drop`:c=Bn;break;case`touchcancel`:case`touchend`:case`touchmove`:case`touchstart`:c=Qn;break;case Zr:case Qr:case $r:c=Hn;break;case ei:c=$n;break;case`scroll`:c=Pn;break;case`wheel`:c=er;break;case`copy`:case`cut`:case`paste`:c=Un;break;case`gotpointercapture`:case`lostpointercapture`:case`pointercancel`:case`pointerdown`:case`pointermove`:case`pointerout`:case`pointerover`:case`pointerup`:c=Zn}var u=!!(t&4),d=!u&&e===`scroll`,f=u?s===null?null:s+`Capture`:s;u=[];for(var p=r,m;p!==null;){m=p;var h=m.stateNode;if(m.tag===5&&h!==null&&(m=h,f!==null&&(h=Qe(p,f),h!=null&&u.push(gi(p,h,m)))),d)break;p=p.return}0<u.length&&(s=new c(s,l,null,n,i),o.push({event:s,listeners:u}))}}if(!(t&7)){a:{if(s=e===`mouseover`||e===`pointerover`,c=e===`mouseout`||e===`pointerout`,s&&n!==Be&&(l=n.relatedTarget||n.fromElement)&&(Ui(l)||l[zi]))break a;if((c||s)&&(s=i.window===i?i:(s=i.ownerDocument)?s.defaultView||s.parentWindow:window,c?(l=n.relatedTarget||n.toElement,c=r,l=l?Ui(l):null,l!==null&&(d=ct(l),l!==d||l.tag!==5&&l.tag!==6)&&(l=null)):(c=null,l=r),c!==l)){if(u=zn,h=`onMouseLeave`,f=`onMouseEnter`,p=`mouse`,(e===`pointerout`||e===`pointerover`)&&(u=Zn,h=`onPointerLeave`,f=`onPointerEnter`,p=`pointer`),d=c==null?s:Gi(c),m=l==null?s:Gi(l),s=new u(h,p+`leave`,c,n,i),s.target=d,s.relatedTarget=m,h=null,Ui(i)===r&&(u=new u(f,p+`enter`,l,n,i),u.target=m,u.relatedTarget=d,h=u),d=h,c&&l)b:{for(u=c,f=l,p=0,m=u;m;m=vi(m))p++;for(m=0,h=f;h;h=vi(h))m++;for(;0<p-m;)u=vi(u),p--;for(;0<m-p;)f=vi(f),m--;for(;p--;){if(u===f||f!==null&&u===f.alternate)break b;u=vi(u),f=vi(f)}u=null}else u=null;c!==null&&yi(o,s,c,u,!1),l!==null&&d!==null&&yi(o,d,l,u,!0)}}a:{if(s=r?Gi(r):window,c=s.nodeName&&s.nodeName.toLowerCase(),c===`select`||c===`input`&&s.type===`file`)var g=br;else if(mr(s)){if(xr)g=Ar;else{g=Or;var _=Dr}}else(c=s.nodeName)&&c.toLowerCase()===`input`&&(s.type===`checkbox`||s.type===`radio`)&&(g=kr);if(g&&=g(e,r)){hr(o,g,n,i);break a}_&&_(e,s,r),e===`focusout`&&(_=s._wrapperState)&&_.controlled&&s.type===`number`&&xe(s,`number`,s.value)}switch(_=r?Gi(r):window,e){case`focusin`:(mr(_)||_.contentEditable===`true`)&&(Vr=_,Hr=r,Ur=null);break;case`focusout`:Ur=Hr=Vr=null;break;case`mousedown`:Wr=!0;break;case`contextmenu`:case`mouseup`:case`dragend`:Wr=!1,Gr(o,n,i);break;case`selectionchange`:if(Br)break;case`keydown`:case`keyup`:Gr(o,n,i)}var v;if(nr)b:{switch(e){case`compositionstart`:var y=`onCompositionStart`;break b;case`compositionend`:y=`onCompositionEnd`;break b;case`compositionupdate`:y=`onCompositionUpdate`;break b}y=void 0}else ur?cr(e,n)&&(y=`onCompositionEnd`):e===`keydown`&&n.keyCode===229&&(y=`onCompositionStart`);y&&(ar&&n.locale!==`ko`&&(ur||y!==`onCompositionStart`?y===`onCompositionEnd`&&ur&&(v=En()):(Cn=i,wn=`value`in Cn?Cn.value:Cn.textContent,ur=!0)),_=_i(r,y),0<_.length&&(y=new Wn(y,e,null,n,i),o.push({event:y,listeners:_}),v?y.data=v:(v=lr(n),v!==null&&(y.data=v)))),(v=ir?dr(e,n):fr(e,n))&&(r=_i(r,`onBeforeInput`),0<r.length&&(i=new Wn(`onBeforeInput`,`beforeinput`,null,n,i),o.push({event:i,listeners:r}),i.data=v))}li(o,t)})}function gi(e,t,n){return{instance:e,listener:t,currentTarget:n}}function _i(e,t){for(var n=t+`Capture`,r=[];e!==null;){var i=e,a=i.stateNode;i.tag===5&&a!==null&&(i=a,a=Qe(e,n),a!=null&&r.unshift(gi(e,a,i)),a=Qe(e,t),a!=null&&r.push(gi(e,a,i))),e=e.return}return r}function vi(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5);return e||null}function yi(e,t,n,r,i){for(var a=t._reactName,o=[];n!==null&&n!==r;){var s=n,c=s.alternate,l=s.stateNode;if(c!==null&&c===r)break;s.tag===5&&l!==null&&(s=l,i?(c=Qe(n,a),c!=null&&o.unshift(gi(n,c,s))):i||(c=Qe(n,a),c!=null&&o.push(gi(n,c,s)))),n=n.return}o.length!==0&&e.push({event:t,listeners:o})}var bi=/\r\n?/g,xi=/\u0000|\uFFFD/g;function Si(e){return(typeof e==`string`?e:``+e).replace(bi,`
|
|
7
|
+
`).replace(xi,``)}function Ci(e,t,n){if(t=Si(t),Si(e)!==t&&n)throw Error(r(425))}function wi(){}var Ti=null,Ei=null;function Di(e,t){return e===`textarea`||e===`noscript`||typeof t.children==`string`||typeof t.children==`number`||typeof t.dangerouslySetInnerHTML==`object`&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var Oi=typeof setTimeout==`function`?setTimeout:void 0,ki=typeof clearTimeout==`function`?clearTimeout:void 0,Ai=typeof Promise==`function`?Promise:void 0,ji=typeof queueMicrotask==`function`?queueMicrotask:Ai===void 0?Oi:function(e){return Ai.resolve(null).then(e).catch(Mi)};function Mi(e){setTimeout(function(){throw e})}function Ni(e,t){var n=t,r=0;do{var i=n.nextSibling;if(e.removeChild(n),i&&i.nodeType===8){if(n=i.data,n===`/$`){if(r===0){e.removeChild(i),mn(t);return}r--}else n!==`$`&&n!==`$?`&&n!==`$!`||r++}n=i}while(n);mn(t)}function Pi(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t===`$`||t===`$!`||t===`$?`)break;if(t===`/$`)return null}}return e}function Fi(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n===`$`||n===`$!`||n===`$?`){if(t===0)return e;t--}else n===`/$`&&t++}e=e.previousSibling}return null}var Ii=Math.random().toString(36).slice(2),Li=`__reactFiber$`+Ii,Ri=`__reactProps$`+Ii,zi=`__reactContainer$`+Ii,Bi=`__reactEvents$`+Ii,Vi=`__reactListeners$`+Ii,Hi=`__reactHandles$`+Ii;function Ui(e){var t=e[Li];if(t)return t;for(var n=e.parentNode;n;){if(t=n[zi]||n[Li]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=Fi(e);e!==null;){if(n=e[Li])return n;e=Fi(e)}return t}e=n,n=e.parentNode}return null}function Wi(e){return e=e[Li]||e[zi],!e||e.tag!==5&&e.tag!==6&&e.tag!==13&&e.tag!==3?null:e}function Gi(e){if(e.tag===5||e.tag===6)return e.stateNode;throw Error(r(33))}function Ki(e){return e[Ri]||null}var qi=[],Ji=-1;function Yi(e){return{current:e}}function z(e){0>Ji||(e.current=qi[Ji],qi[Ji]=null,Ji--)}function Xi(e,t){Ji++,qi[Ji]=e.current,e.current=t}var Zi={},Qi=Yi(Zi),$i=Yi(!1),ea=Zi;function ta(e,t){var n=e.type.contextTypes;if(!n)return Zi;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var i={},a;for(a in n)i[a]=t[a];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=i),i}function na(e){return e=e.childContextTypes,e!=null}function ra(){z($i),z(Qi)}function ia(e,t,n){if(Qi.current!==Zi)throw Error(r(168));Xi(Qi,t),Xi($i,n)}function aa(e,t,n){var i=e.stateNode;if(t=t.childContextTypes,typeof i.getChildContext!=`function`)return n;for(var a in i=i.getChildContext(),i)if(!(a in t))throw Error(r(108,le(e)||`Unknown`,a));return F({},n,i)}function oa(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||Zi,ea=Qi.current,Xi(Qi,e),Xi($i,$i.current),!0}function sa(e,t,n){var i=e.stateNode;if(!i)throw Error(r(169));n?(e=aa(e,t,ea),i.__reactInternalMemoizedMergedChildContext=e,z($i),z(Qi),Xi(Qi,e)):z($i),Xi($i,n)}var ca=null,la=!1,ua=!1;function da(e){ca===null?ca=[e]:ca.push(e)}function fa(e){la=!0,da(e)}function pa(){if(!ua&&ca!==null){ua=!0;var e=0,t=R;try{var n=ca;for(R=1;e<n.length;e++){var r=n[e];do r=r(!0);while(r!==null)}ca=null,la=!1}catch(t){throw ca!==null&&(ca=ca.slice(e+1)),mt(bt,pa),t}finally{R=t,ua=!1}}return null}var ma=[],ha=0,ga=null,_a=0,va=[],ya=0,ba=null,xa=1,Sa=``;function Ca(e,t){ma[ha++]=_a,ma[ha++]=ga,ga=e,_a=t}function wa(e,t,n){va[ya++]=xa,va[ya++]=Sa,va[ya++]=ba,ba=e;var r=xa;e=Sa;var i=32-Ot(r)-1;r&=~(1<<i),n+=1;var a=32-Ot(t)+i;if(30<a){var o=i-i%5;a=(r&(1<<o)-1).toString(32),r>>=o,i-=o,xa=1<<32-Ot(t)+i|n<<i|r,Sa=a+e}else xa=1<<a|n<<i|r,Sa=e}function Ta(e){e.return!==null&&(Ca(e,1),wa(e,1,0))}function Ea(e){for(;e===ga;)ga=ma[--ha],ma[ha]=null,_a=ma[--ha],ma[ha]=null;for(;e===ba;)ba=va[--ya],va[ya]=null,Sa=va[--ya],va[ya]=null,xa=va[--ya],va[ya]=null}var Da=null,Oa=null,ka=!1,Aa=null;function ja(e,t){var n=nu(5,null,null,0);n.elementType=`DELETED`,n.stateNode=t,n.return=e,t=e.deletions,t===null?(e.deletions=[n],e.flags|=16):t.push(n)}function Ma(e,t){switch(e.tag){case 5:var n=e.type;return t=t.nodeType!==1||n.toLowerCase()!==t.nodeName.toLowerCase()?null:t,t!==null&&(e.stateNode=t,Da=e,Oa=Pi(t.firstChild),!0);case 6:return t=e.pendingProps===``||t.nodeType!==3?null:t,t!==null&&(e.stateNode=t,Da=e,Oa=null,!0);case 13:return t=t.nodeType===8?t:null,t!==null&&(n=ba===null?null:{id:xa,overflow:Sa},e.memoizedState={dehydrated:t,treeContext:n,retryLane:1073741824},n=nu(18,null,null,0),n.stateNode=t,n.return=e,e.child=n,Da=e,Oa=null,!0);default:return!1}}function Na(e){return!!(e.mode&1)&&!(e.flags&128)}function Pa(e){if(ka){var t=Oa;if(t){var n=t;if(!Ma(e,t)){if(Na(e))throw Error(r(418));t=Pi(n.nextSibling);var i=Da;t&&Ma(e,t)?ja(i,n):(e.flags=e.flags&-4097|2,ka=!1,Da=e)}}else{if(Na(e))throw Error(r(418));e.flags=e.flags&-4097|2,ka=!1,Da=e}}}function Fa(e){for(e=e.return;e!==null&&e.tag!==5&&e.tag!==3&&e.tag!==13;)e=e.return;Da=e}function Ia(e){if(e!==Da)return!1;if(!ka)return Fa(e),ka=!0,!1;var t;if((t=e.tag!==3)&&!(t=e.tag!==5)&&(t=e.type,t=t!==`head`&&t!==`body`&&!Di(e.type,e.memoizedProps)),t&&=Oa){if(Na(e))throw La(),Error(r(418));for(;t;)ja(e,t),t=Pi(t.nextSibling)}if(Fa(e),e.tag===13){if(e=e.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(r(317));a:{for(e=e.nextSibling,t=0;e;){if(e.nodeType===8){var n=e.data;if(n===`/$`){if(t===0){Oa=Pi(e.nextSibling);break a}t--}else n!==`$`&&n!==`$!`&&n!==`$?`||t++}e=e.nextSibling}Oa=null}}else Oa=Da?Pi(e.stateNode.nextSibling):null;return!0}function La(){for(var e=Oa;e;)e=Pi(e.nextSibling)}function Ra(){Oa=Da=null,ka=!1}function za(e){Aa===null?Aa=[e]:Aa.push(e)}var Ba=C.ReactCurrentBatchConfig;function Va(e,t,n){if(e=n.ref,e!==null&&typeof e!=`function`&&typeof e!=`object`){if(n._owner){if(n=n._owner,n){if(n.tag!==1)throw Error(r(309));var i=n.stateNode}if(!i)throw Error(r(147,e));var a=i,o=``+e;return t!==null&&t.ref!==null&&typeof t.ref==`function`&&t.ref._stringRef===o?t.ref:(t=function(e){var t=a.refs;e===null?delete t[o]:t[o]=e},t._stringRef=o,t)}if(typeof e!=`string`)throw Error(r(284));if(!n._owner)throw Error(r(290,e))}return e}function Ha(e,t){throw e=Object.prototype.toString.call(t),Error(r(31,e===`[object Object]`?`object with keys {`+Object.keys(t).join(`, `)+`}`:e))}function Ua(e){var t=e._init;return t(e._payload)}function Wa(e){function t(t,n){if(e){var r=t.deletions;r===null?(t.deletions=[n],t.flags|=16):r.push(n)}}function n(n,r){if(!e)return null;for(;r!==null;)t(n,r),r=r.sibling;return null}function i(e,t){for(e=new Map;t!==null;)t.key===null?e.set(t.index,t):e.set(t.key,t),t=t.sibling;return e}function a(e,t){return e=au(e,t),e.index=0,e.sibling=null,e}function o(t,n,r){return t.index=r,e?(r=t.alternate,r===null?(t.flags|=2,n):(r=r.index,r<n?(t.flags|=2,n):r)):(t.flags|=1048576,n)}function s(t){return e&&t.alternate===null&&(t.flags|=2),t}function c(e,t,n,r){return t===null||t.tag!==6?(t=lu(n,e.mode,r),t.return=e,t):(t=a(t,n),t.return=e,t)}function l(e,t,n,r){var i=n.type;return i===E?d(e,t,n.props.children,r,n.key):t!==null&&(t.elementType===i||typeof i==`object`&&i&&i.$$typeof===te&&Ua(i)===t.type)?(r=a(t,n.props),r.ref=Va(e,t,n),r.return=e,r):(r=ou(n.type,n.key,n.props,null,e.mode,r),r.ref=Va(e,t,n),r.return=e,r)}function u(e,t,n,r){return t===null||t.tag!==4||t.stateNode.containerInfo!==n.containerInfo||t.stateNode.implementation!==n.implementation?(t=uu(n,e.mode,r),t.return=e,t):(t=a(t,n.children||[]),t.return=e,t)}function d(e,t,n,r,i){return t===null||t.tag!==7?(t=su(n,e.mode,r,i),t.return=e,t):(t=a(t,n),t.return=e,t)}function f(e,t,n){if(typeof t==`string`&&t!==``||typeof t==`number`)return t=lu(``+t,e.mode,n),t.return=e,t;if(typeof t==`object`&&t){switch(t.$$typeof){case w:return n=ou(t.type,t.key,t.props,null,e.mode,n),n.ref=Va(e,null,t),n.return=e,n;case T:return t=uu(t,e.mode,n),t.return=e,t;case te:var r=t._init;return f(e,r(t._payload),n)}if(Se(t)||re(t))return t=su(t,e.mode,n,null),t.return=e,t;Ha(e,t)}return null}function p(e,t,n,r){var i=t===null?null:t.key;if(typeof n==`string`&&n!==``||typeof n==`number`)return i===null?c(e,t,``+n,r):null;if(typeof n==`object`&&n){switch(n.$$typeof){case w:return n.key===i?l(e,t,n,r):null;case T:return n.key===i?u(e,t,n,r):null;case te:return i=n._init,p(e,t,i(n._payload),r)}if(Se(n)||re(n))return i===null?d(e,t,n,r,null):null;Ha(e,n)}return null}function m(e,t,n,r,i){if(typeof r==`string`&&r!==``||typeof r==`number`)return e=e.get(n)||null,c(t,e,``+r,i);if(typeof r==`object`&&r){switch(r.$$typeof){case w:return e=e.get(r.key===null?n:r.key)||null,l(t,e,r,i);case T:return e=e.get(r.key===null?n:r.key)||null,u(t,e,r,i);case te:var a=r._init;return m(e,t,n,a(r._payload),i)}if(Se(r)||re(r))return e=e.get(n)||null,d(t,e,r,i,null);Ha(t,r)}return null}function h(r,a,s,c){for(var l=null,u=null,d=a,h=a=0,g=null;d!==null&&h<s.length;h++){d.index>h?(g=d,d=null):g=d.sibling;var _=p(r,d,s[h],c);if(_===null){d===null&&(d=g);break}e&&d&&_.alternate===null&&t(r,d),a=o(_,a,h),u===null?l=_:u.sibling=_,u=_,d=g}if(h===s.length)return n(r,d),ka&&Ca(r,h),l;if(d===null){for(;h<s.length;h++)d=f(r,s[h],c),d!==null&&(a=o(d,a,h),u===null?l=d:u.sibling=d,u=d);return ka&&Ca(r,h),l}for(d=i(r,d);h<s.length;h++)g=m(d,r,h,s[h],c),g!==null&&(e&&g.alternate!==null&&d.delete(g.key===null?h:g.key),a=o(g,a,h),u===null?l=g:u.sibling=g,u=g);return e&&d.forEach(function(e){return t(r,e)}),ka&&Ca(r,h),l}function g(a,s,c,l){var u=re(c);if(typeof u!=`function`)throw Error(r(150));if(c=u.call(c),c==null)throw Error(r(151));for(var d=u=null,h=s,g=s=0,_=null,v=c.next();h!==null&&!v.done;g++,v=c.next()){h.index>g?(_=h,h=null):_=h.sibling;var y=p(a,h,v.value,l);if(y===null){h===null&&(h=_);break}e&&h&&y.alternate===null&&t(a,h),s=o(y,s,g),d===null?u=y:d.sibling=y,d=y,h=_}if(v.done)return n(a,h),ka&&Ca(a,g),u;if(h===null){for(;!v.done;g++,v=c.next())v=f(a,v.value,l),v!==null&&(s=o(v,s,g),d===null?u=v:d.sibling=v,d=v);return ka&&Ca(a,g),u}for(h=i(a,h);!v.done;g++,v=c.next())v=m(h,a,g,v.value,l),v!==null&&(e&&v.alternate!==null&&h.delete(v.key===null?g:v.key),s=o(v,s,g),d===null?u=v:d.sibling=v,d=v);return e&&h.forEach(function(e){return t(a,e)}),ka&&Ca(a,g),u}function _(e,r,i,o){if(typeof i==`object`&&i&&i.type===E&&i.key===null&&(i=i.props.children),typeof i==`object`&&i){switch(i.$$typeof){case w:a:{for(var c=i.key,l=r;l!==null;){if(l.key===c){if(c=i.type,c===E){if(l.tag===7){n(e,l.sibling),r=a(l,i.props.children),r.return=e,e=r;break a}}else if(l.elementType===c||typeof c==`object`&&c&&c.$$typeof===te&&Ua(c)===l.type){n(e,l.sibling),r=a(l,i.props),r.ref=Va(e,l,i),r.return=e,e=r;break a}n(e,l);break}t(e,l),l=l.sibling}i.type===E?(r=su(i.props.children,e.mode,o,i.key),r.return=e,e=r):(o=ou(i.type,i.key,i.props,null,e.mode,o),o.ref=Va(e,r,i),o.return=e,e=o)}return s(e);case T:a:{for(l=i.key;r!==null;){if(r.key===l){if(r.tag===4&&r.stateNode.containerInfo===i.containerInfo&&r.stateNode.implementation===i.implementation){n(e,r.sibling),r=a(r,i.children||[]),r.return=e,e=r;break a}n(e,r);break}t(e,r),r=r.sibling}r=uu(i,e.mode,o),r.return=e,e=r}return s(e);case te:return l=i._init,_(e,r,l(i._payload),o)}if(Se(i))return h(e,r,i,o);if(re(i))return g(e,r,i,o);Ha(e,i)}return typeof i==`string`&&i!==``||typeof i==`number`?(i=``+i,r!==null&&r.tag===6?(n(e,r.sibling),r=a(r,i),r.return=e,e=r):(n(e,r),r=lu(i,e.mode,o),r.return=e,e=r),s(e)):n(e,r)}return _}var Ga=Wa(!0),Ka=Wa(!1),qa=Yi(null),Ja=null,Ya=null,Xa=null;function Za(){Xa=Ya=Ja=null}function Qa(e){var t=qa.current;z(qa),e._currentValue=t}function $a(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)===t?r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t):(e.childLanes|=t,r!==null&&(r.childLanes|=t)),e===n)break;e=e.return}}function eo(e,t){Ja=e,Xa=Ya=null,e=e.dependencies,e!==null&&e.firstContext!==null&&((e.lanes&t)!==0&&(Hs=!0),e.firstContext=null)}function to(e){var t=e._currentValue;if(Xa!==e){if(e={context:e,memoizedValue:t,next:null},Ya===null){if(Ja===null)throw Error(r(308));Ya=e,Ja.dependencies={lanes:0,firstContext:e}}else Ya=Ya.next=e}return t}var B=null;function V(e){B===null?B=[e]:B.push(e)}function no(e,t,n,r){var i=t.interleaved;return i===null?(n.next=n,V(t)):(n.next=i.next,i.next=n),t.interleaved=n,ro(e,r)}function ro(e,t){e.lanes|=t;var n=e.alternate;for(n!==null&&(n.lanes|=t),n=e,e=e.return;e!==null;)e.childLanes|=t,n=e.alternate,n!==null&&(n.childLanes|=t),n=e,e=e.return;return n.tag===3?n.stateNode:null}var io=!1;function ao(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function oo(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function so(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function co(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,Xc&2){var i=r.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),r.pending=t,ro(e,n)}return i=r.interleaved,i===null?(t.next=t,V(r)):(t.next=i.next,i.next=t),r.interleaved=t,ro(e,n)}function lo(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,n&4194240)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Ut(e,n)}}function uo(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var i=null,a=null;if(n=n.firstBaseUpdate,n!==null){do{var o={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};a===null?i=a=o:a=a.next=o,n=n.next}while(n!==null);a===null?i=a=t:a=a.next=t}else i=a=t;n={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:a,shared:r.shared,effects:r.effects},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}function fo(e,t,n,r){var i=e.updateQueue;io=!1;var a=i.firstBaseUpdate,o=i.lastBaseUpdate,s=i.shared.pending;if(s!==null){i.shared.pending=null;var c=s,l=c.next;c.next=null,o===null?a=l:o.next=l,o=c;var u=e.alternate;u!==null&&(u=u.updateQueue,s=u.lastBaseUpdate,s!==o&&(s===null?u.firstBaseUpdate=l:s.next=l,u.lastBaseUpdate=c))}if(a!==null){var d=i.baseState;o=0,u=l=c=null,s=a;do{var f=s.lane,p=s.eventTime;if((r&f)===f){u!==null&&(u=u.next={eventTime:p,lane:0,tag:s.tag,payload:s.payload,callback:s.callback,next:null});a:{var m=e,h=s;switch(f=t,p=n,h.tag){case 1:if(m=h.payload,typeof m==`function`){d=m.call(p,d,f);break a}d=m;break a;case 3:m.flags=m.flags&-65537|128;case 0:if(m=h.payload,f=typeof m==`function`?m.call(p,d,f):m,f==null)break a;d=F({},d,f);break a;case 2:io=!0}}s.callback!==null&&s.lane!==0&&(e.flags|=64,f=i.effects,f===null?i.effects=[s]:f.push(s))}else p={eventTime:p,lane:f,tag:s.tag,payload:s.payload,callback:s.callback,next:null},u===null?(l=u=p,c=d):u=u.next=p,o|=f;if(s=s.next,s===null){if(s=i.shared.pending,s===null)break;f=s,s=f.next,f.next=null,i.lastBaseUpdate=f,i.shared.pending=null}}while(1);if(u===null&&(c=d),i.baseState=c,i.firstBaseUpdate=l,i.lastBaseUpdate=u,t=i.shared.interleaved,t!==null){i=t;do o|=i.lane,i=i.next;while(i!==t)}else a===null&&(i.shared.lanes=0);il|=o,e.lanes=o,e.memoizedState=d}}function po(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;t<e.length;t++){var i=e[t],a=i.callback;if(a!==null){if(i.callback=null,i=n,typeof a!=`function`)throw Error(r(191,a));a.call(i)}}}var mo={},ho=Yi(mo),go=Yi(mo),_o=Yi(mo);function vo(e){if(e===mo)throw Error(r(174));return e}function yo(e,t){switch(Xi(_o,t),Xi(go,e),Xi(ho,mo),e=t.nodeType,e){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:ke(null,``);break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=ke(t,e)}z(ho),Xi(ho,t)}function bo(){z(ho),z(go),z(_o)}function xo(e){vo(_o.current);var t=vo(ho.current),n=ke(t,e.type);t!==n&&(Xi(go,e),Xi(ho,n))}function So(e){go.current===e&&(z(ho),z(go))}var Co=Yi(0);function wo(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||n.data===`$?`||n.data===`$!`))return t}else if(t.tag===19&&t.memoizedProps.revealOrder!==void 0){if(t.flags&128)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var To=[];function Eo(){for(var e=0;e<To.length;e++)To[e]._workInProgressVersionPrimary=null;To.length=0}var Do=C.ReactCurrentDispatcher,Oo=C.ReactCurrentBatchConfig,ko=0,Ao=null,jo=null,Mo=null,No=!1,Po=!1,Fo=0,Io=0;function Lo(){throw Error(r(321))}function Ro(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!Mr(e[n],t[n]))return!1;return!0}function zo(e,t,n,i,a,o){if(ko=o,Ao=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,Do.current=e===null||e.memoizedState===null?Ss:Cs,e=n(i,a),Po){o=0;do{if(Po=!1,Fo=0,25<=o)throw Error(r(301));o+=1,Mo=jo=null,t.updateQueue=null,Do.current=ws,e=n(i,a)}while(Po)}if(Do.current=xs,t=jo!==null&&jo.next!==null,ko=0,Mo=jo=Ao=null,No=!1,t)throw Error(r(300));return e}function Bo(){var e=Fo!==0;return Fo=0,e}function Vo(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Mo===null?Ao.memoizedState=Mo=e:Mo=Mo.next=e,Mo}function Ho(){if(jo===null){var e=Ao.alternate;e=e===null?null:e.memoizedState}else e=jo.next;var t=Mo===null?Ao.memoizedState:Mo.next;if(t!==null)Mo=t,jo=e;else{if(e===null)throw Error(r(310));jo=e,e={memoizedState:jo.memoizedState,baseState:jo.baseState,baseQueue:jo.baseQueue,queue:jo.queue,next:null},Mo===null?Ao.memoizedState=Mo=e:Mo=Mo.next=e}return Mo}function Uo(e,t){return typeof t==`function`?t(e):t}function Wo(e){var t=Ho(),n=t.queue;if(n===null)throw Error(r(311));n.lastRenderedReducer=e;var i=jo,a=i.baseQueue,o=n.pending;if(o!==null){if(a!==null){var s=a.next;a.next=o.next,o.next=s}i.baseQueue=a=o,n.pending=null}if(a!==null){o=a.next,i=i.baseState;var c=s=null,l=null,u=o;do{var d=u.lane;if((ko&d)===d)l!==null&&(l=l.next={lane:0,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null}),i=u.hasEagerState?u.eagerState:e(i,u.action);else{var f={lane:d,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null};l===null?(c=l=f,s=i):l=l.next=f,Ao.lanes|=d,il|=d}u=u.next}while(u!==null&&u!==o);l===null?s=i:l.next=c,Mr(i,t.memoizedState)||(Hs=!0),t.memoizedState=i,t.baseState=s,t.baseQueue=l,n.lastRenderedState=i}if(e=n.interleaved,e!==null){a=e;do o=a.lane,Ao.lanes|=o,il|=o,a=a.next;while(a!==e)}else a===null&&(n.lanes=0);return[t.memoizedState,n.dispatch]}function Go(e){var t=Ho(),n=t.queue;if(n===null)throw Error(r(311));n.lastRenderedReducer=e;var i=n.dispatch,a=n.pending,o=t.memoizedState;if(a!==null){n.pending=null;var s=a=a.next;do o=e(o,s.action),s=s.next;while(s!==a);Mr(o,t.memoizedState)||(Hs=!0),t.memoizedState=o,t.baseQueue===null&&(t.baseState=o),n.lastRenderedState=o}return[o,i]}function Ko(){}function qo(e,t){var n=Ao,i=Ho(),a=t(),o=!Mr(i.memoizedState,a);if(o&&(i.memoizedState=a,Hs=!0),i=i.queue,as(Xo.bind(null,n,i,e),[e]),i.getSnapshot!==t||o||Mo!==null&&Mo.memoizedState.tag&1){if(n.flags|=2048,es(9,Yo.bind(null,n,i,a,t),void 0,null),Zc===null)throw Error(r(349));ko&30||Jo(n,t,a)}return a}function Jo(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=Ao.updateQueue,t===null?(t={lastEffect:null,stores:null},Ao.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function Yo(e,t,n,r){t.value=n,t.getSnapshot=r,Zo(t)&&Qo(e)}function Xo(e,t,n){return n(function(){Zo(t)&&Qo(e)})}function Zo(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!Mr(e,n)}catch{return!0}}function Qo(e){var t=ro(e,1);t!==null&&wl(t,e,1,-1)}function $o(e){var t=Vo();return typeof e==`function`&&(e=e()),t.memoizedState=t.baseState=e,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Uo,lastRenderedState:e},t.queue=e,e=e.dispatch=_s.bind(null,Ao,e),[t.memoizedState,e]}function es(e,t,n,r){return e={tag:e,create:t,destroy:n,deps:r,next:null},t=Ao.updateQueue,t===null?(t={lastEffect:null,stores:null},Ao.updateQueue=t,t.lastEffect=e.next=e):(n=t.lastEffect,n===null?t.lastEffect=e.next=e:(r=n.next,n.next=e,e.next=r,t.lastEffect=e)),e}function ts(){return Ho().memoizedState}function ns(e,t,n,r){var i=Vo();Ao.flags|=e,i.memoizedState=es(1|t,n,void 0,r===void 0?null:r)}function rs(e,t,n,r){var i=Ho();r=r===void 0?null:r;var a=void 0;if(jo!==null){var o=jo.memoizedState;if(a=o.destroy,r!==null&&Ro(r,o.deps)){i.memoizedState=es(t,n,a,r);return}}Ao.flags|=e,i.memoizedState=es(1|t,n,a,r)}function is(e,t){return ns(8390656,8,e,t)}function as(e,t){return rs(2048,8,e,t)}function os(e,t){return rs(4,2,e,t)}function ss(e,t){return rs(4,4,e,t)}function cs(e,t){if(typeof t==`function`)return e=e(),t(e),function(){t(null)};if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function ls(e,t,n){return n=n==null?null:n.concat([e]),rs(4,4,cs.bind(null,t,e),n)}function us(){}function ds(e,t){var n=Ho();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&Ro(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function fs(e,t){var n=Ho();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&Ro(t,r[1])?r[0]:(e=e(),n.memoizedState=[e,t],e)}function ps(e,t,n){return ko&21?(Mr(n,t)||(n=zt(),Ao.lanes|=n,il|=n,e.baseState=!0),t):(e.baseState&&(e.baseState=!1,Hs=!0),e.memoizedState=n)}function ms(e,t){var n=R;R=n!==0&&4>n?n:4,e(!0);var r=Oo.transition;Oo.transition={};try{e(!1),t()}finally{R=n,Oo.transition=r}}function hs(){return Ho().memoizedState}function gs(e,t,n){var r=Cl(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},vs(e))ys(t,n);else if(n=no(e,t,n,r),n!==null){var i=Sl();wl(n,e,r,i),bs(n,t,r)}}function _s(e,t,n){var r=Cl(e),i={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(vs(e))ys(t,i);else{var a=e.alternate;if(e.lanes===0&&(a===null||a.lanes===0)&&(a=t.lastRenderedReducer,a!==null))try{var o=t.lastRenderedState,s=a(o,n);if(i.hasEagerState=!0,i.eagerState=s,Mr(s,o)){var c=t.interleaved;c===null?(i.next=i,V(t)):(i.next=c.next,c.next=i),t.interleaved=i;return}}catch{}n=no(e,t,i,r),n!==null&&(i=Sl(),wl(n,e,r,i),bs(n,t,r))}}function vs(e){var t=e.alternate;return e===Ao||t!==null&&t===Ao}function ys(e,t){Po=No=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function bs(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Ut(e,n)}}var xs={readContext:to,useCallback:Lo,useContext:Lo,useEffect:Lo,useImperativeHandle:Lo,useInsertionEffect:Lo,useLayoutEffect:Lo,useMemo:Lo,useReducer:Lo,useRef:Lo,useState:Lo,useDebugValue:Lo,useDeferredValue:Lo,useTransition:Lo,useMutableSource:Lo,useSyncExternalStore:Lo,useId:Lo,unstable_isNewReconciler:!1},Ss={readContext:to,useCallback:function(e,t){return Vo().memoizedState=[e,t===void 0?null:t],e},useContext:to,useEffect:is,useImperativeHandle:function(e,t,n){return n=n==null?null:n.concat([e]),ns(4194308,4,cs.bind(null,t,e),n)},useLayoutEffect:function(e,t){return ns(4194308,4,e,t)},useInsertionEffect:function(e,t){return ns(4,2,e,t)},useMemo:function(e,t){var n=Vo();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=Vo();return t=n===void 0?t:n(t),r.memoizedState=r.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},r.queue=e,e=e.dispatch=gs.bind(null,Ao,e),[r.memoizedState,e]},useRef:function(e){var t=Vo();return e={current:e},t.memoizedState=e},useState:$o,useDebugValue:us,useDeferredValue:function(e){return Vo().memoizedState=e},useTransition:function(){var e=$o(!1),t=e[0];return e=ms.bind(null,e[1]),Vo().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var i=Ao,a=Vo();if(ka){if(n===void 0)throw Error(r(407));n=n()}else{if(n=t(),Zc===null)throw Error(r(349));ko&30||Jo(i,t,n)}a.memoizedState=n;var o={value:n,getSnapshot:t};return a.queue=o,is(Xo.bind(null,i,o,e),[e]),i.flags|=2048,es(9,Yo.bind(null,i,o,n,t),void 0,null),n},useId:function(){var e=Vo(),t=Zc.identifierPrefix;if(ka){var n=Sa,r=xa;n=(r&~(1<<32-Ot(r)-1)).toString(32)+n,t=`:`+t+`R`+n,n=Fo++,0<n&&(t+=`H`+n.toString(32)),t+=`:`}else n=Io++,t=`:`+t+`r`+n.toString(32)+`:`;return e.memoizedState=t},unstable_isNewReconciler:!1},Cs={readContext:to,useCallback:ds,useContext:to,useEffect:as,useImperativeHandle:ls,useInsertionEffect:os,useLayoutEffect:ss,useMemo:fs,useReducer:Wo,useRef:ts,useState:function(){return Wo(Uo)},useDebugValue:us,useDeferredValue:function(e){return ps(Ho(),jo.memoizedState,e)},useTransition:function(){return[Wo(Uo)[0],Ho().memoizedState]},useMutableSource:Ko,useSyncExternalStore:qo,useId:hs,unstable_isNewReconciler:!1},ws={readContext:to,useCallback:ds,useContext:to,useEffect:as,useImperativeHandle:ls,useInsertionEffect:os,useLayoutEffect:ss,useMemo:fs,useReducer:Go,useRef:ts,useState:function(){return Go(Uo)},useDebugValue:us,useDeferredValue:function(e){var t=Ho();return jo===null?t.memoizedState=e:ps(t,jo.memoizedState,e)},useTransition:function(){return[Go(Uo)[0],Ho().memoizedState]},useMutableSource:Ko,useSyncExternalStore:qo,useId:hs,unstable_isNewReconciler:!1};function Ts(e,t){if(e&&e.defaultProps){for(var n in t=F({},t),e=e.defaultProps,e)t[n]===void 0&&(t[n]=e[n]);return t}return t}function Es(e,t,n,r){t=e.memoizedState,n=n(r,t),n=n==null?t:F({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var Ds={isMounted:function(e){return(e=e._reactInternals)?ct(e)===e:!1},enqueueSetState:function(e,t,n){e=e._reactInternals;var r=Sl(),i=Cl(e),a=so(r,i);a.payload=t,n!=null&&(a.callback=n),t=co(e,a,i),t!==null&&(wl(t,e,i,r),lo(t,e,i))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=Sl(),i=Cl(e),a=so(r,i);a.tag=1,a.payload=t,n!=null&&(a.callback=n),t=co(e,a,i),t!==null&&(wl(t,e,i,r),lo(t,e,i))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=Sl(),r=Cl(e),i=so(n,r);i.tag=2,t!=null&&(i.callback=t),t=co(e,i,r),t!==null&&(wl(t,e,r,n),lo(t,e,r))}};function Os(e,t,n,r,i,a,o){return e=e.stateNode,typeof e.shouldComponentUpdate==`function`?e.shouldComponentUpdate(r,a,o):t.prototype&&t.prototype.isPureReactComponent?!Nr(n,r)||!Nr(i,a):!0}function ks(e,t,n){var r=!1,i=Zi,a=t.contextType;return typeof a==`object`&&a?a=to(a):(i=na(t)?ea:Qi.current,r=t.contextTypes,a=(r=r!=null)?ta(e,i):Zi),t=new t(n,a),e.memoizedState=t.state!==null&&t.state!==void 0?t.state:null,t.updater=Ds,e.stateNode=t,t._reactInternals=e,r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=i,e.__reactInternalMemoizedMaskedChildContext=a),t}function As(e,t,n,r){e=t.state,typeof t.componentWillReceiveProps==`function`&&t.componentWillReceiveProps(n,r),typeof t.UNSAFE_componentWillReceiveProps==`function`&&t.UNSAFE_componentWillReceiveProps(n,r),t.state!==e&&Ds.enqueueReplaceState(t,t.state,null)}function js(e,t,n,r){var i=e.stateNode;i.props=n,i.state=e.memoizedState,i.refs={},ao(e);var a=t.contextType;typeof a==`object`&&a?i.context=to(a):(a=na(t)?ea:Qi.current,i.context=ta(e,a)),i.state=e.memoizedState,a=t.getDerivedStateFromProps,typeof a==`function`&&(Es(e,t,a,n),i.state=e.memoizedState),typeof t.getDerivedStateFromProps==`function`||typeof i.getSnapshotBeforeUpdate==`function`||typeof i.UNSAFE_componentWillMount!=`function`&&typeof i.componentWillMount!=`function`||(t=i.state,typeof i.componentWillMount==`function`&&i.componentWillMount(),typeof i.UNSAFE_componentWillMount==`function`&&i.UNSAFE_componentWillMount(),t!==i.state&&Ds.enqueueReplaceState(i,i.state,null),fo(e,n,i,r),i.state=e.memoizedState),typeof i.componentDidMount==`function`&&(e.flags|=4194308)}function Ms(e,t){try{var n=``,r=t;do n+=se(r),r=r.return;while(r);var i=n}catch(e){i=`
|
|
8
|
+
Error generating stack: `+e.message+`
|
|
9
|
+
`+e.stack}return{value:e,source:t,stack:i,digest:null}}function Ns(e,t,n){return{value:e,source:null,stack:n??null,digest:t??null}}function Ps(e,t){try{console.error(t.value)}catch(e){setTimeout(function(){throw e})}}var Fs=typeof WeakMap==`function`?WeakMap:Map;function Is(e,t,n){n=so(-1,n),n.tag=3,n.payload={element:null};var r=t.value;return n.callback=function(){fl||(fl=!0,pl=r),Ps(e,t)},n}function Ls(e,t,n){n=so(-1,n),n.tag=3;var r=e.type.getDerivedStateFromError;if(typeof r==`function`){var i=t.value;n.payload=function(){return r(i)},n.callback=function(){Ps(e,t)}}var a=e.stateNode;return a!==null&&typeof a.componentDidCatch==`function`&&(n.callback=function(){Ps(e,t),typeof r!=`function`&&(ml===null?ml=new Set([this]):ml.add(this));var n=t.stack;this.componentDidCatch(t.value,{componentStack:n===null?``:n})}),n}function Rs(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new Fs;var i=new Set;r.set(t,i)}else i=r.get(t),i===void 0&&(i=new Set,r.set(t,i));i.has(n)||(i.add(n),e=Yl.bind(null,e,t,n),t.then(e,e))}function zs(e){do{var t;if((t=e.tag===13)&&(t=e.memoizedState,t=t===null||t.dehydrated!==null),t)return e;e=e.return}while(e!==null);return null}function Bs(e,t,n,r,i){return e.mode&1?(e.flags|=65536,e.lanes=i,e):(e===t?e.flags|=65536:(e.flags|=128,n.flags|=131072,n.flags&=-52805,n.tag===1&&(n.alternate===null?n.tag=17:(t=so(-1,1),t.tag=2,co(n,t,1))),n.lanes|=1),e)}var Vs=C.ReactCurrentOwner,Hs=!1;function Us(e,t,n,r){t.child=e===null?Ka(t,null,n,r):Ga(t,e.child,n,r)}function Ws(e,t,n,r,i){n=n.render;var a=t.ref;return eo(t,i),r=zo(e,t,n,r,a,i),n=Bo(),e!==null&&!Hs?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~i,lc(e,t,i)):(ka&&n&&Ta(t),t.flags|=1,Us(e,t,r,i),t.child)}function Gs(e,t,n,r,i){if(e===null){var a=n.type;return typeof a==`function`&&!ru(a)&&a.defaultProps===void 0&&n.compare===null&&n.defaultProps===void 0?(t.tag=15,t.type=a,Ks(e,t,a,r,i)):(e=ou(n.type,null,r,t,t.mode,i),e.ref=t.ref,e.return=t,t.child=e)}if(a=e.child,(e.lanes&i)===0){var o=a.memoizedProps;if(n=n.compare,n=n===null?Nr:n,n(o,r)&&e.ref===t.ref)return lc(e,t,i)}return t.flags|=1,e=au(a,r),e.ref=t.ref,e.return=t,t.child=e}function Ks(e,t,n,r,i){if(e!==null){var a=e.memoizedProps;if(Nr(a,r)&&e.ref===t.ref){if(Hs=!1,t.pendingProps=r=a,(e.lanes&i)!==0)e.flags&131072&&(Hs=!0);else return t.lanes=e.lanes,lc(e,t,i)}}return Ys(e,t,n,r,i)}function qs(e,t,n){var r=t.pendingProps,i=r.children,a=e===null?null:e.memoizedState;if(r.mode===`hidden`){if(!(t.mode&1))t.memoizedState={baseLanes:0,cachePool:null,transitions:null},Xi(tl,el),el|=n;else{if(!(n&1073741824))return e=a===null?n:a.baseLanes|n,t.lanes=t.childLanes=1073741824,t.memoizedState={baseLanes:e,cachePool:null,transitions:null},t.updateQueue=null,Xi(tl,el),el|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=a===null?n:a.baseLanes,Xi(tl,el),el|=r}}else a===null?r=n:(r=a.baseLanes|n,t.memoizedState=null),Xi(tl,el),el|=r;return Us(e,t,i,n),t.child}function Js(e,t){var n=t.ref;(e===null&&n!==null||e!==null&&e.ref!==n)&&(t.flags|=512,t.flags|=2097152)}function Ys(e,t,n,r,i){var a=na(n)?ea:Qi.current;return a=ta(t,a),eo(t,i),n=zo(e,t,n,r,a,i),r=Bo(),e!==null&&!Hs?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~i,lc(e,t,i)):(ka&&r&&Ta(t),t.flags|=1,Us(e,t,n,i),t.child)}function Xs(e,t,n,r,i){if(na(n)){var a=!0;oa(t)}else a=!1;if(eo(t,i),t.stateNode===null)cc(e,t),ks(t,n,r),js(t,n,r,i),r=!0;else if(e===null){var o=t.stateNode,s=t.memoizedProps;o.props=s;var c=o.context,l=n.contextType;typeof l==`object`&&l?l=to(l):(l=na(n)?ea:Qi.current,l=ta(t,l));var u=n.getDerivedStateFromProps,d=typeof u==`function`||typeof o.getSnapshotBeforeUpdate==`function`;d||typeof o.UNSAFE_componentWillReceiveProps!=`function`&&typeof o.componentWillReceiveProps!=`function`||(s!==r||c!==l)&&As(t,o,r,l),io=!1;var f=t.memoizedState;o.state=f,fo(t,r,o,i),c=t.memoizedState,s!==r||f!==c||$i.current||io?(typeof u==`function`&&(Es(t,n,u,r),c=t.memoizedState),(s=io||Os(t,n,s,r,f,c,l))?(d||typeof o.UNSAFE_componentWillMount!=`function`&&typeof o.componentWillMount!=`function`||(typeof o.componentWillMount==`function`&&o.componentWillMount(),typeof o.UNSAFE_componentWillMount==`function`&&o.UNSAFE_componentWillMount()),typeof o.componentDidMount==`function`&&(t.flags|=4194308)):(typeof o.componentDidMount==`function`&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=c),o.props=r,o.state=c,o.context=l,r=s):(typeof o.componentDidMount==`function`&&(t.flags|=4194308),r=!1)}else{o=t.stateNode,oo(e,t),s=t.memoizedProps,l=t.type===t.elementType?s:Ts(t.type,s),o.props=l,d=t.pendingProps,f=o.context,c=n.contextType,typeof c==`object`&&c?c=to(c):(c=na(n)?ea:Qi.current,c=ta(t,c));var p=n.getDerivedStateFromProps;(u=typeof p==`function`||typeof o.getSnapshotBeforeUpdate==`function`)||typeof o.UNSAFE_componentWillReceiveProps!=`function`&&typeof o.componentWillReceiveProps!=`function`||(s!==d||f!==c)&&As(t,o,r,c),io=!1,f=t.memoizedState,o.state=f,fo(t,r,o,i);var m=t.memoizedState;s!==d||f!==m||$i.current||io?(typeof p==`function`&&(Es(t,n,p,r),m=t.memoizedState),(l=io||Os(t,n,l,r,f,m,c)||!1)?(u||typeof o.UNSAFE_componentWillUpdate!=`function`&&typeof o.componentWillUpdate!=`function`||(typeof o.componentWillUpdate==`function`&&o.componentWillUpdate(r,m,c),typeof o.UNSAFE_componentWillUpdate==`function`&&o.UNSAFE_componentWillUpdate(r,m,c)),typeof o.componentDidUpdate==`function`&&(t.flags|=4),typeof o.getSnapshotBeforeUpdate==`function`&&(t.flags|=1024)):(typeof o.componentDidUpdate!=`function`||s===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof o.getSnapshotBeforeUpdate!=`function`||s===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=m),o.props=r,o.state=m,o.context=c,r=l):(typeof o.componentDidUpdate!=`function`||s===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof o.getSnapshotBeforeUpdate!=`function`||s===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),r=!1)}return Zs(e,t,n,r,a,i)}function Zs(e,t,n,r,i,a){Js(e,t);var o=!!(t.flags&128);if(!r&&!o)return i&&sa(t,n,!1),lc(e,t,a);r=t.stateNode,Vs.current=t;var s=o&&typeof n.getDerivedStateFromError!=`function`?null:r.render();return t.flags|=1,e!==null&&o?(t.child=Ga(t,e.child,null,a),t.child=Ga(t,null,s,a)):Us(e,t,s,a),t.memoizedState=r.state,i&&sa(t,n,!0),t.child}function Qs(e){var t=e.stateNode;t.pendingContext?ia(e,t.pendingContext,t.pendingContext!==t.context):t.context&&ia(e,t.context,!1),yo(e,t.containerInfo)}function $s(e,t,n,r,i){return Ra(),za(i),t.flags|=256,Us(e,t,n,r),t.child}var ec={dehydrated:null,treeContext:null,retryLane:0};function H(e){return{baseLanes:e,cachePool:null,transitions:null}}function tc(e,t,n){var r=t.pendingProps,i=Co.current,a=!1,o=!!(t.flags&128),s;if((s=o)||(s=e!==null&&e.memoizedState===null?!1:!!(i&2)),s?(a=!0,t.flags&=-129):(e===null||e.memoizedState!==null)&&(i|=1),Xi(Co,i&1),e===null)return Pa(t),e=t.memoizedState,e!==null&&(e=e.dehydrated,e!==null)?(t.lanes=t.mode&1?e.data===`$!`?8:1073741824:1,null):(o=r.children,e=r.fallback,a?(r=t.mode,a=t.child,o={mode:`hidden`,children:o},!(r&1)&&a!==null?(a.childLanes=0,a.pendingProps=o):a=cu(o,r,0,null),e=su(e,r,n,null),a.return=t,e.return=t,a.sibling=e,t.child=a,t.child.memoizedState=H(n),t.memoizedState=ec,e):nc(t,o));if(i=e.memoizedState,i!==null&&(s=i.dehydrated,s!==null))return ic(e,t,o,r,s,i,n);if(a){a=r.fallback,o=t.mode,i=e.child,s=i.sibling;var c={mode:`hidden`,children:r.children};return!(o&1)&&t.child!==i?(r=t.child,r.childLanes=0,r.pendingProps=c,t.deletions=null):(r=au(i,c),r.subtreeFlags=i.subtreeFlags&14680064),s===null?(a=su(a,o,n,null),a.flags|=2):a=au(s,a),a.return=t,r.return=t,r.sibling=a,t.child=r,r=a,a=t.child,o=e.child.memoizedState,o=o===null?H(n):{baseLanes:o.baseLanes|n,cachePool:null,transitions:o.transitions},a.memoizedState=o,a.childLanes=e.childLanes&~n,t.memoizedState=ec,r}return a=e.child,e=a.sibling,r=au(a,{mode:`visible`,children:r.children}),!(t.mode&1)&&(r.lanes=n),r.return=t,r.sibling=null,e!==null&&(n=t.deletions,n===null?(t.deletions=[e],t.flags|=16):n.push(e)),t.child=r,t.memoizedState=null,r}function nc(e,t){return t=cu({mode:`visible`,children:t},e.mode,0,null),t.return=e,e.child=t}function rc(e,t,n,r){return r!==null&&za(r),Ga(t,e.child,null,n),e=nc(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function ic(e,t,n,i,a,o,s){if(n)return t.flags&256?(t.flags&=-257,i=Ns(Error(r(422))),rc(e,t,s,i)):t.memoizedState===null?(o=i.fallback,a=t.mode,i=cu({mode:`visible`,children:i.children},a,0,null),o=su(o,a,s,null),o.flags|=2,i.return=t,o.return=t,i.sibling=o,t.child=i,t.mode&1&&Ga(t,e.child,null,s),t.child.memoizedState=H(s),t.memoizedState=ec,o):(t.child=e.child,t.flags|=128,null);if(!(t.mode&1))return rc(e,t,s,null);if(a.data===`$!`){if(i=a.nextSibling&&a.nextSibling.dataset,i)var c=i.dgst;return i=c,o=Error(r(419)),i=Ns(o,i,void 0),rc(e,t,s,i)}if(c=(s&e.childLanes)!==0,Hs||c){if(i=Zc,i!==null){switch(s&-s){case 4:a=2;break;case 16:a=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:a=32;break;case 536870912:a=268435456;break;default:a=0}a=(a&(i.suspendedLanes|s))===0?a:0,a!==0&&a!==o.retryLane&&(o.retryLane=a,ro(e,a),wl(i,e,a,-1))}return Rl(),i=Ns(Error(r(421))),rc(e,t,s,i)}return a.data===`$?`?(t.flags|=128,t.child=e.child,t=Zl.bind(null,e),a._reactRetry=t,null):(e=o.treeContext,Oa=Pi(a.nextSibling),Da=t,ka=!0,Aa=null,e!==null&&(va[ya++]=xa,va[ya++]=Sa,va[ya++]=ba,xa=e.id,Sa=e.overflow,ba=t),t=nc(t,i.children),t.flags|=4096,t)}function ac(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),$a(e.return,t,n)}function oc(e,t,n,r,i){var a=e.memoizedState;a===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:i}:(a.isBackwards=t,a.rendering=null,a.renderingStartTime=0,a.last=r,a.tail=n,a.tailMode=i)}function sc(e,t,n){var r=t.pendingProps,i=r.revealOrder,a=r.tail;if(Us(e,t,r.children,n),r=Co.current,r&2)r=r&1|2,t.flags|=128;else{if(e!==null&&e.flags&128)a:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&ac(e,n,t);else if(e.tag===19)ac(e,n,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break a;for(;e.sibling===null;){if(e.return===null||e.return===t)break a;e=e.return}e.sibling.return=e.return,e=e.sibling}r&=1}if(Xi(Co,r),!(t.mode&1))t.memoizedState=null;else switch(i){case`forwards`:for(n=t.child,i=null;n!==null;)e=n.alternate,e!==null&&wo(e)===null&&(i=n),n=n.sibling;n=i,n===null?(i=t.child,t.child=null):(i=n.sibling,n.sibling=null),oc(t,!1,i,n,a);break;case`backwards`:for(n=null,i=t.child,t.child=null;i!==null;){if(e=i.alternate,e!==null&&wo(e)===null){t.child=i;break}e=i.sibling,i.sibling=n,n=i,i=e}oc(t,!0,n,null,a);break;case`together`:oc(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function cc(e,t){!(t.mode&1)&&e!==null&&(e.alternate=null,t.alternate=null,t.flags|=2)}function lc(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),il|=t.lanes,(n&t.childLanes)===0)return null;if(e!==null&&t.child!==e.child)throw Error(r(153));if(t.child!==null){for(e=t.child,n=au(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=au(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function uc(e,t,n){switch(t.tag){case 3:Qs(t),Ra();break;case 5:xo(t);break;case 1:na(t.type)&&oa(t);break;case 4:yo(t,t.stateNode.containerInfo);break;case 10:var r=t.type._context,i=t.memoizedProps.value;Xi(qa,r._currentValue),r._currentValue=i;break;case 13:if(r=t.memoizedState,r!==null)return r.dehydrated===null?(n&t.child.childLanes)===0?(Xi(Co,Co.current&1),e=lc(e,t,n),e===null?null:e.sibling):tc(e,t,n):(Xi(Co,Co.current&1),t.flags|=128,null);Xi(Co,Co.current&1);break;case 19:if(r=(n&t.childLanes)!==0,e.flags&128){if(r)return sc(e,t,n);t.flags|=128}if(i=t.memoizedState,i!==null&&(i.rendering=null,i.tail=null,i.lastEffect=null),Xi(Co,Co.current),r)break;return null;case 22:case 23:return t.lanes=0,qs(e,t,n)}return lc(e,t,n)}var dc=function(e,t){for(var n=t.child;n!==null;){if(n.tag===5||n.tag===6)e.appendChild(n.stateNode);else if(n.tag!==4&&n.child!==null){n.child.return=n,n=n.child;continue}if(n===t)break;for(;n.sibling===null;){if(n.return===null||n.return===t)return;n=n.return}n.sibling.return=n.return,n=n.sibling}},fc=function(e,t,n,r){var i=e.memoizedProps;if(i!==r){e=t.stateNode,vo(ho.current);var o=null;switch(n){case`input`:i=ge(e,i),r=ge(e,r),o=[];break;case`select`:i=F({},i,{value:void 0}),r=F({},r,{value:void 0}),o=[];break;case`textarea`:i=we(e,i),r=we(e,r),o=[];break;default:typeof i.onClick!=`function`&&typeof r.onClick==`function`&&(e.onclick=wi)}Re(n,r);var s;for(u in n=null,i)if(!r.hasOwnProperty(u)&&i.hasOwnProperty(u)&&i[u]!=null){if(u===`style`){var c=i[u];for(s in c)c.hasOwnProperty(s)&&(n||={},n[s]=``)}else u!==`dangerouslySetInnerHTML`&&u!==`children`&&u!==`suppressContentEditableWarning`&&u!==`suppressHydrationWarning`&&u!==`autoFocus`&&(a.hasOwnProperty(u)?o||=[]:(o||=[]).push(u,null))}for(u in r){var l=r[u];if(c=i?.[u],r.hasOwnProperty(u)&&l!==c&&(l!=null||c!=null)){if(u===`style`){if(c){for(s in c)!c.hasOwnProperty(s)||l&&l.hasOwnProperty(s)||(n||={},n[s]=``);for(s in l)l.hasOwnProperty(s)&&c[s]!==l[s]&&(n||={},n[s]=l[s])}else n||(o||=[],o.push(u,n)),n=l}else u===`dangerouslySetInnerHTML`?(l=l?l.__html:void 0,c=c?c.__html:void 0,l!=null&&c!==l&&(o||=[]).push(u,l)):u===`children`?typeof l!=`string`&&typeof l!=`number`||(o||=[]).push(u,``+l):u!==`suppressContentEditableWarning`&&u!==`suppressHydrationWarning`&&(a.hasOwnProperty(u)?(l!=null&&u===`onScroll`&&ui(`scroll`,e),o||c===l||(o=[])):(o||=[]).push(u,l))}}n&&(o||=[]).push(`style`,n);var u=o;(t.updateQueue=u)&&(t.flags|=4)}},pc=function(e,t,n,r){n!==r&&(t.flags|=4)};function mc(e,t){if(!ka)switch(e.tailMode){case`hidden`:t=e.tail;for(var n=null;t!==null;)t.alternate!==null&&(n=t),t=t.sibling;n===null?e.tail=null:n.sibling=null;break;case`collapsed`:n=e.tail;for(var r=null;n!==null;)n.alternate!==null&&(r=n),n=n.sibling;r===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:r.sibling=null}}function hc(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,r=0;if(t)for(var i=e.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags&14680064,r|=i.flags&14680064,i.return=e,i=i.sibling;else for(i=e.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags,r|=i.flags,i.return=e,i=i.sibling;return e.subtreeFlags|=r,e.childLanes=n,t}function gc(e,t,n){var i=t.pendingProps;switch(Ea(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return hc(t),null;case 1:return na(t.type)&&ra(),hc(t),null;case 3:return i=t.stateNode,bo(),z($i),z(Qi),Eo(),i.pendingContext&&(i.context=i.pendingContext,i.pendingContext=null),(e===null||e.child===null)&&(Ia(t)?t.flags|=4:e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,Aa!==null&&(Ol(Aa),Aa=null))),hc(t),null;case 5:So(t);var o=vo(_o.current);if(n=t.type,e!==null&&t.stateNode!=null)fc(e,t,n,i,o),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!i){if(t.stateNode===null)throw Error(r(166));return hc(t),null}if(e=vo(ho.current),Ia(t)){i=t.stateNode,n=t.type;var s=t.memoizedProps;switch(i[Li]=t,i[Ri]=s,e=!!(t.mode&1),n){case`dialog`:ui(`cancel`,i),ui(`close`,i);break;case`iframe`:case`object`:case`embed`:ui(`load`,i);break;case`video`:case`audio`:for(o=0;o<oi.length;o++)ui(oi[o],i);break;case`source`:ui(`error`,i);break;case`img`:case`image`:case`link`:ui(`error`,i),ui(`load`,i);break;case`details`:ui(`toggle`,i);break;case`input`:_e(i,s),ui(`invalid`,i);break;case`select`:i._wrapperState={wasMultiple:!!s.multiple},ui(`invalid`,i);break;case`textarea`:Te(i,s),ui(`invalid`,i)}for(var c in Re(n,s),o=null,s)if(s.hasOwnProperty(c)){var l=s[c];c===`children`?typeof l==`string`?i.textContent!==l&&(!0!==s.suppressHydrationWarning&&Ci(i.textContent,l,e),o=[`children`,l]):typeof l==`number`&&i.textContent!==``+l&&(!0!==s.suppressHydrationWarning&&Ci(i.textContent,l,e),o=[`children`,``+l]):a.hasOwnProperty(c)&&l!=null&&c===`onScroll`&&ui(`scroll`,i)}switch(n){case`input`:pe(i),be(i,s,!0);break;case`textarea`:pe(i),De(i);break;case`select`:case`option`:break;default:typeof s.onClick==`function`&&(i.onclick=wi)}i=o,t.updateQueue=i,i!==null&&(t.flags|=4)}else{c=o.nodeType===9?o:o.ownerDocument,e===`http://www.w3.org/1999/xhtml`&&(e=Oe(n)),e===`http://www.w3.org/1999/xhtml`?n===`script`?(e=c.createElement(`div`),e.innerHTML=`<script><\/script>`,e=e.removeChild(e.firstChild)):typeof i.is==`string`?e=c.createElement(n,{is:i.is}):(e=c.createElement(n),n===`select`&&(c=e,i.multiple?c.multiple=!0:i.size&&(c.size=i.size))):e=c.createElementNS(e,n),e[Li]=t,e[Ri]=i,dc(e,t,!1,!1),t.stateNode=e;a:{switch(c=ze(n,i),n){case`dialog`:ui(`cancel`,e),ui(`close`,e),o=i;break;case`iframe`:case`object`:case`embed`:ui(`load`,e),o=i;break;case`video`:case`audio`:for(o=0;o<oi.length;o++)ui(oi[o],e);o=i;break;case`source`:ui(`error`,e),o=i;break;case`img`:case`image`:case`link`:ui(`error`,e),ui(`load`,e),o=i;break;case`details`:ui(`toggle`,e),o=i;break;case`input`:_e(e,i),o=ge(e,i),ui(`invalid`,e);break;case`option`:o=i;break;case`select`:e._wrapperState={wasMultiple:!!i.multiple},o=F({},i,{value:void 0}),ui(`invalid`,e);break;case`textarea`:Te(e,i),o=we(e,i),ui(`invalid`,e);break;default:o=i}for(s in Re(n,o),l=o,l)if(l.hasOwnProperty(s)){var u=l[s];s===`style`?Ie(e,u):s===`dangerouslySetInnerHTML`?(u=u?u.__html:void 0,u!=null&&je(e,u)):s===`children`?typeof u==`string`?(n!==`textarea`||u!==``)&&Me(e,u):typeof u==`number`&&Me(e,``+u):s!==`suppressContentEditableWarning`&&s!==`suppressHydrationWarning`&&s!==`autoFocus`&&(a.hasOwnProperty(s)?u!=null&&s===`onScroll`&&ui(`scroll`,e):u!=null&&S(e,s,u,c))}switch(n){case`input`:pe(e),be(e,i,!1);break;case`textarea`:pe(e),De(e);break;case`option`:i.value!=null&&e.setAttribute(`value`,``+ue(i.value));break;case`select`:e.multiple=!!i.multiple,s=i.value,s==null?i.defaultValue!=null&&Ce(e,!!i.multiple,i.defaultValue,!0):Ce(e,!!i.multiple,s,!1);break;default:typeof o.onClick==`function`&&(e.onclick=wi)}switch(n){case`button`:case`input`:case`select`:case`textarea`:i=!!i.autoFocus;break a;case`img`:i=!0;break a;default:i=!1}}i&&(t.flags|=4)}t.ref!==null&&(t.flags|=512,t.flags|=2097152)}return hc(t),null;case 6:if(e&&t.stateNode!=null)pc(e,t,e.memoizedProps,i);else{if(typeof i!=`string`&&t.stateNode===null)throw Error(r(166));if(n=vo(_o.current),vo(ho.current),Ia(t)){if(i=t.stateNode,n=t.memoizedProps,i[Li]=t,(s=i.nodeValue!==n)&&(e=Da,e!==null))switch(e.tag){case 3:Ci(i.nodeValue,n,!!(e.mode&1));break;case 5:!0!==e.memoizedProps.suppressHydrationWarning&&Ci(i.nodeValue,n,!!(e.mode&1))}s&&(t.flags|=4)}else i=(n.nodeType===9?n:n.ownerDocument).createTextNode(i),i[Li]=t,t.stateNode=i}return hc(t),null;case 13:if(z(Co),i=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(ka&&Oa!==null&&t.mode&1&&!(t.flags&128))La(),Ra(),t.flags|=98560,s=!1;else if(s=Ia(t),i!==null&&i.dehydrated!==null){if(e===null){if(!s)throw Error(r(318));if(s=t.memoizedState,s=s===null?null:s.dehydrated,!s)throw Error(r(317));s[Li]=t}else Ra(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;hc(t),s=!1}else Aa!==null&&(Ol(Aa),Aa=null),s=!0;if(!s)return t.flags&65536?t:null}return t.flags&128?(t.lanes=n,t):(i=i!==null,i!==(e!==null&&e.memoizedState!==null)&&i&&(t.child.flags|=8192,t.mode&1&&(e===null||Co.current&1?nl===0&&(nl=3):Rl())),t.updateQueue!==null&&(t.flags|=4),hc(t),null);case 4:return bo(),e===null&&pi(t.stateNode.containerInfo),hc(t),null;case 10:return Qa(t.type._context),hc(t),null;case 17:return na(t.type)&&ra(),hc(t),null;case 19:if(z(Co),s=t.memoizedState,s===null)return hc(t),null;if(i=!!(t.flags&128),c=s.rendering,c===null){if(i)mc(s,!1);else{if(nl!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(c=wo(e),c!==null){for(t.flags|=128,mc(s,!1),i=c.updateQueue,i!==null&&(t.updateQueue=i,t.flags|=4),t.subtreeFlags=0,i=n,n=t.child;n!==null;)s=n,e=i,s.flags&=14680066,c=s.alternate,c===null?(s.childLanes=0,s.lanes=e,s.child=null,s.subtreeFlags=0,s.memoizedProps=null,s.memoizedState=null,s.updateQueue=null,s.dependencies=null,s.stateNode=null):(s.childLanes=c.childLanes,s.lanes=c.lanes,s.child=c.child,s.subtreeFlags=0,s.deletions=null,s.memoizedProps=c.memoizedProps,s.memoizedState=c.memoizedState,s.updateQueue=c.updateQueue,s.type=c.type,e=c.dependencies,s.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext}),n=n.sibling;return Xi(Co,Co.current&1|2),t.child}e=e.sibling}s.tail!==null&&vt()>ul&&(t.flags|=128,i=!0,mc(s,!1),t.lanes=4194304)}}else{if(!i){if(e=wo(c),e!==null){if(t.flags|=128,i=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),mc(s,!0),s.tail===null&&s.tailMode===`hidden`&&!c.alternate&&!ka)return hc(t),null}else 2*vt()-s.renderingStartTime>ul&&n!==1073741824&&(t.flags|=128,i=!0,mc(s,!1),t.lanes=4194304)}s.isBackwards?(c.sibling=t.child,t.child=c):(n=s.last,n===null?t.child=c:n.sibling=c,s.last=c)}return s.tail===null?(hc(t),null):(t=s.tail,s.rendering=t,s.tail=t.sibling,s.renderingStartTime=vt(),t.sibling=null,n=Co.current,Xi(Co,i?n&1|2:n&1),t);case 22:case 23:return Pl(),i=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==i&&(t.flags|=8192),i&&t.mode&1?el&1073741824&&(hc(t),t.subtreeFlags&6&&(t.flags|=8192)):hc(t),null;case 24:return null;case 25:return null}throw Error(r(156,t.tag))}function _c(e,t){switch(Ea(t),t.tag){case 1:return na(t.type)&&ra(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return bo(),z($i),z(Qi),Eo(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return So(t),null;case 13:if(z(Co),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(r(340));Ra()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return z(Co),null;case 4:return bo(),null;case 10:return Qa(t.type._context),null;case 22:case 23:return Pl(),null;case 24:return null;default:return null}}var vc=!1,yc=!1,bc=typeof WeakSet==`function`?WeakSet:Set,U=null;function xc(e,t){var n=e.ref;if(n!==null){if(typeof n==`function`)try{n(null)}catch(n){Jl(e,t,n)}else n.current=null}}function Sc(e,t,n){try{n()}catch(n){Jl(e,t,n)}}var Cc=!1;function wc(e,t){if(Ti=gn,e=Lr(),Rr(e)){if(`selectionStart`in e)var n={start:e.selectionStart,end:e.selectionEnd};else a:{n=(n=e.ownerDocument)&&n.defaultView||window;var i=n.getSelection&&n.getSelection();if(i&&i.rangeCount!==0){n=i.anchorNode;var a=i.anchorOffset,o=i.focusNode;i=i.focusOffset;try{n.nodeType,o.nodeType}catch{n=null;break a}var s=0,c=-1,l=-1,u=0,d=0,f=e,p=null;b:for(;;){for(var m;f!==n||a!==0&&f.nodeType!==3||(c=s+a),f!==o||i!==0&&f.nodeType!==3||(l=s+i),f.nodeType===3&&(s+=f.nodeValue.length),(m=f.firstChild)!==null;)p=f,f=m;for(;;){if(f===e)break b;if(p===n&&++u===a&&(c=s),p===o&&++d===i&&(l=s),(m=f.nextSibling)!==null)break;f=p,p=f.parentNode}f=m}n=c===-1||l===-1?null:{start:c,end:l}}else n=null}n||={start:0,end:0}}else n=null;for(Ei={focusedElem:e,selectionRange:n},gn=!1,U=t;U!==null;)if(t=U,e=t.child,t.subtreeFlags&1028&&e!==null)e.return=t,U=e;else for(;U!==null;){t=U;try{var h=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(h!==null){var g=h.memoizedProps,_=h.memoizedState,v=t.stateNode;v.__reactInternalSnapshotBeforeUpdate=v.getSnapshotBeforeUpdate(t.elementType===t.type?g:Ts(t.type,g),_)}break;case 3:var y=t.stateNode.containerInfo;y.nodeType===1?y.textContent=``:y.nodeType===9&&y.documentElement&&y.removeChild(y.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(r(163))}}catch(e){Jl(t,t.return,e)}if(e=t.sibling,e!==null){e.return=t.return,U=e;break}U=t.return}return h=Cc,Cc=!1,h}function Tc(e,t,n){var r=t.updateQueue;if(r=r===null?null:r.lastEffect,r!==null){var i=r=r.next;do{if((i.tag&e)===e){var a=i.destroy;i.destroy=void 0,a!==void 0&&Sc(t,n,a)}i=i.next}while(i!==r)}}function Ec(e,t){if(t=t.updateQueue,t=t===null?null:t.lastEffect,t!==null){var n=t=t.next;do{if((n.tag&e)===e){var r=n.create;n.destroy=r()}n=n.next}while(n!==t)}}function Dc(e){var t=e.ref;if(t!==null){var n=e.stateNode;switch(e.tag){case 5:e=n;break;default:e=n}typeof t==`function`?t(e):t.current=e}}function Oc(e){var t=e.alternate;t!==null&&(e.alternate=null,Oc(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[Li],delete t[Ri],delete t[Bi],delete t[Vi],delete t[Hi])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function kc(e){return e.tag===5||e.tag===3||e.tag===4}function Ac(e){a:for(;;){for(;e.sibling===null;){if(e.return===null||kc(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue a;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function jc(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.nodeType===8?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(n.nodeType===8?(t=n.parentNode,t.insertBefore(e,n)):(t=n,t.appendChild(e)),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=wi));else if(r!==4&&(e=e.child,e!==null))for(jc(e,t,n),e=e.sibling;e!==null;)jc(e,t,n),e=e.sibling}function Mc(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(e=e.child,e!==null))for(Mc(e,t,n),e=e.sibling;e!==null;)Mc(e,t,n),e=e.sibling}var Nc=null,Pc=!1;function Fc(e,t,n){for(n=n.child;n!==null;)Ic(e,t,n),n=n.sibling}function Ic(e,t,n){if(Et&&typeof Et.onCommitFiberUnmount==`function`)try{Et.onCommitFiberUnmount(Tt,n)}catch{}switch(n.tag){case 5:yc||xc(n,t);case 6:var r=Nc,i=Pc;Nc=null,Fc(e,t,n),Nc=r,Pc=i,Nc!==null&&(Pc?(e=Nc,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):Nc.removeChild(n.stateNode));break;case 18:Nc!==null&&(Pc?(e=Nc,n=n.stateNode,e.nodeType===8?Ni(e.parentNode,n):e.nodeType===1&&Ni(e,n),mn(e)):Ni(Nc,n.stateNode));break;case 4:r=Nc,i=Pc,Nc=n.stateNode.containerInfo,Pc=!0,Fc(e,t,n),Nc=r,Pc=i;break;case 0:case 11:case 14:case 15:if(!yc&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){i=r=r.next;do{var a=i,o=a.destroy;a=a.tag,o!==void 0&&(a&2||a&4)&&Sc(n,t,o),i=i.next}while(i!==r)}Fc(e,t,n);break;case 1:if(!yc&&(xc(n,t),r=n.stateNode,typeof r.componentWillUnmount==`function`))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(e){Jl(n,t,e)}Fc(e,t,n);break;case 21:Fc(e,t,n);break;case 22:n.mode&1?(yc=(r=yc)||n.memoizedState!==null,Fc(e,t,n),yc=r):Fc(e,t,n);break;default:Fc(e,t,n)}}function Lc(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new bc),t.forEach(function(t){var r=Ql.bind(null,e,t);n.has(t)||(n.add(t),t.then(r,r))})}}function Rc(e,t){var n=t.deletions;if(n!==null)for(var i=0;i<n.length;i++){var a=n[i];try{var o=e,s=t,c=s;a:for(;c!==null;){switch(c.tag){case 5:Nc=c.stateNode,Pc=!1;break a;case 3:Nc=c.stateNode.containerInfo,Pc=!0;break a;case 4:Nc=c.stateNode.containerInfo,Pc=!0;break a}c=c.return}if(Nc===null)throw Error(r(160));Ic(o,s,a),Nc=null,Pc=!1;var l=a.alternate;l!==null&&(l.return=null),a.return=null}catch(e){Jl(a,t,e)}}if(t.subtreeFlags&12854)for(t=t.child;t!==null;)zc(t,e),t=t.sibling}function zc(e,t){var n=e.alternate,i=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(Rc(t,e),Bc(e),i&4){try{Tc(3,e,e.return),Ec(3,e)}catch(t){Jl(e,e.return,t)}try{Tc(5,e,e.return)}catch(t){Jl(e,e.return,t)}}break;case 1:Rc(t,e),Bc(e),i&512&&n!==null&&xc(n,n.return);break;case 5:if(Rc(t,e),Bc(e),i&512&&n!==null&&xc(n,n.return),e.flags&32){var a=e.stateNode;try{Me(a,``)}catch(t){Jl(e,e.return,t)}}if(i&4&&(a=e.stateNode,a!=null)){var o=e.memoizedProps,s=n===null?o:n.memoizedProps,c=e.type,l=e.updateQueue;if(e.updateQueue=null,l!==null)try{c===`input`&&o.type===`radio`&&o.name!=null&&ve(a,o),ze(c,s);var u=ze(c,o);for(s=0;s<l.length;s+=2){var d=l[s],f=l[s+1];d===`style`?Ie(a,f):d===`dangerouslySetInnerHTML`?je(a,f):d===`children`?Me(a,f):S(a,d,f,u)}switch(c){case`input`:ye(a,o);break;case`textarea`:Ee(a,o);break;case`select`:var p=a._wrapperState.wasMultiple;a._wrapperState.wasMultiple=!!o.multiple;var m=o.value;m==null?p!==!!o.multiple&&(o.defaultValue==null?Ce(a,!!o.multiple,o.multiple?[]:``,!1):Ce(a,!!o.multiple,o.defaultValue,!0)):Ce(a,!!o.multiple,m,!1)}a[Ri]=o}catch(t){Jl(e,e.return,t)}}break;case 6:if(Rc(t,e),Bc(e),i&4){if(e.stateNode===null)throw Error(r(162));a=e.stateNode,o=e.memoizedProps;try{a.nodeValue=o}catch(t){Jl(e,e.return,t)}}break;case 3:if(Rc(t,e),Bc(e),i&4&&n!==null&&n.memoizedState.isDehydrated)try{mn(t.containerInfo)}catch(t){Jl(e,e.return,t)}break;case 4:Rc(t,e),Bc(e);break;case 13:Rc(t,e),Bc(e),a=e.child,a.flags&8192&&(o=a.memoizedState!==null,a.stateNode.isHidden=o,!o||a.alternate!==null&&a.alternate.memoizedState!==null||(ll=vt())),i&4&&Lc(e);break;case 22:if(d=n!==null&&n.memoizedState!==null,e.mode&1?(yc=(u=yc)||d,Rc(t,e),yc=u):Rc(t,e),Bc(e),i&8192){if(u=e.memoizedState!==null,(e.stateNode.isHidden=u)&&!d&&e.mode&1)for(U=e,d=e.child;d!==null;){for(f=U=d;U!==null;){switch(p=U,m=p.child,p.tag){case 0:case 11:case 14:case 15:Tc(4,p,p.return);break;case 1:xc(p,p.return);var h=p.stateNode;if(typeof h.componentWillUnmount==`function`){i=p,n=p.return;try{t=i,h.props=t.memoizedProps,h.state=t.memoizedState,h.componentWillUnmount()}catch(e){Jl(i,n,e)}}break;case 5:xc(p,p.return);break;case 22:if(p.memoizedState!==null){Wc(f);continue}}m===null?Wc(f):(m.return=p,U=m)}d=d.sibling}a:for(d=null,f=e;;){if(f.tag===5){if(d===null){d=f;try{a=f.stateNode,u?(o=a.style,typeof o.setProperty==`function`?o.setProperty(`display`,`none`,`important`):o.display=`none`):(c=f.stateNode,l=f.memoizedProps.style,s=l!=null&&l.hasOwnProperty(`display`)?l.display:null,c.style.display=Fe(`display`,s))}catch(t){Jl(e,e.return,t)}}}else if(f.tag===6){if(d===null)try{f.stateNode.nodeValue=u?``:f.memoizedProps}catch(t){Jl(e,e.return,t)}}else if((f.tag!==22&&f.tag!==23||f.memoizedState===null||f===e)&&f.child!==null){f.child.return=f,f=f.child;continue}if(f===e)break a;for(;f.sibling===null;){if(f.return===null||f.return===e)break a;d===f&&(d=null),f=f.return}d===f&&(d=null),f.sibling.return=f.return,f=f.sibling}}break;case 19:Rc(t,e),Bc(e),i&4&&Lc(e);break;case 21:break;default:Rc(t,e),Bc(e)}}function Bc(e){var t=e.flags;if(t&2){try{a:{for(var n=e.return;n!==null;){if(kc(n)){var i=n;break a}n=n.return}throw Error(r(160))}switch(i.tag){case 5:var a=i.stateNode;i.flags&32&&(Me(a,``),i.flags&=-33),Mc(e,Ac(e),a);break;case 3:case 4:var o=i.stateNode.containerInfo;jc(e,Ac(e),o);break;default:throw Error(r(161))}}catch(t){Jl(e,e.return,t)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function Vc(e,t,n){U=e,Hc(e,t,n)}function Hc(e,t,n){for(var r=!!(e.mode&1);U!==null;){var i=U,a=i.child;if(i.tag===22&&r){var o=i.memoizedState!==null||vc;if(!o){var s=i.alternate,c=s!==null&&s.memoizedState!==null||yc;s=vc;var l=yc;if(vc=o,(yc=c)&&!l)for(U=i;U!==null;)o=U,c=o.child,o.tag===22&&o.memoizedState!==null||c===null?Gc(i):(c.return=o,U=c);for(;a!==null;)U=a,Hc(a,t,n),a=a.sibling;U=i,vc=s,yc=l}Uc(e,t,n)}else i.subtreeFlags&8772&&a!==null?(a.return=i,U=a):Uc(e,t,n)}}function Uc(e){for(;U!==null;){var t=U;if(t.flags&8772){var n=t.alternate;try{if(t.flags&8772)switch(t.tag){case 0:case 11:case 15:yc||Ec(5,t);break;case 1:var i=t.stateNode;if(t.flags&4&&!yc){if(n===null)i.componentDidMount();else{var a=t.elementType===t.type?n.memoizedProps:Ts(t.type,n.memoizedProps);i.componentDidUpdate(a,n.memoizedState,i.__reactInternalSnapshotBeforeUpdate)}}var o=t.updateQueue;o!==null&&po(t,o,i);break;case 3:var s=t.updateQueue;if(s!==null){if(n=null,t.child!==null)switch(t.child.tag){case 5:n=t.child.stateNode;break;case 1:n=t.child.stateNode}po(t,s,n)}break;case 5:var c=t.stateNode;if(n===null&&t.flags&4){n=c;var l=t.memoizedProps;switch(t.type){case`button`:case`input`:case`select`:case`textarea`:l.autoFocus&&n.focus();break;case`img`:l.src&&(n.src=l.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(t.memoizedState===null){var u=t.alternate;if(u!==null){var d=u.memoizedState;if(d!==null){var f=d.dehydrated;f!==null&&mn(f)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(r(163))}yc||t.flags&512&&Dc(t)}catch(e){Jl(t,t.return,e)}}if(t===e){U=null;break}if(n=t.sibling,n!==null){n.return=t.return,U=n;break}U=t.return}}function Wc(e){for(;U!==null;){var t=U;if(t===e){U=null;break}var n=t.sibling;if(n!==null){n.return=t.return,U=n;break}U=t.return}}function Gc(e){for(;U!==null;){var t=U;try{switch(t.tag){case 0:case 11:case 15:var n=t.return;try{Ec(4,t)}catch(e){Jl(t,n,e)}break;case 1:var r=t.stateNode;if(typeof r.componentDidMount==`function`){var i=t.return;try{r.componentDidMount()}catch(e){Jl(t,i,e)}}var a=t.return;try{Dc(t)}catch(e){Jl(t,a,e)}break;case 5:var o=t.return;try{Dc(t)}catch(e){Jl(t,o,e)}}}catch(e){Jl(t,t.return,e)}if(t===e){U=null;break}var s=t.sibling;if(s!==null){s.return=t.return,U=s;break}U=t.return}}var Kc=Math.ceil,qc=C.ReactCurrentDispatcher,Jc=C.ReactCurrentOwner,Yc=C.ReactCurrentBatchConfig,Xc=0,Zc=null,Qc=null,$c=0,el=0,tl=Yi(0),nl=0,rl=null,il=0,al=0,ol=0,sl=null,cl=null,ll=0,ul=1/0,dl=null,fl=!1,pl=null,ml=null,hl=!1,gl=null,_l=0,vl=0,yl=null,bl=-1,xl=0;function Sl(){return Xc&6?vt():bl===-1?bl=vt():bl}function Cl(e){return e.mode&1?Xc&2&&$c!==0?$c&-$c:Ba.transition===null?(e=R,e===0?(e=window.event,e=e===void 0?16:Sn(e.type),e):e):(xl===0&&(xl=zt()),xl):1}function wl(e,t,n,i){if(50<vl)throw vl=0,yl=null,Error(r(185));Vt(e,n,i),(!(Xc&2)||e!==Zc)&&(e===Zc&&(!(Xc&2)&&(al|=n),nl===4&&Al(e,$c)),Tl(e,i),n===1&&Xc===0&&!(t.mode&1)&&(ul=vt()+500,la&&pa()))}function Tl(e,t){var n=e.callbackNode;Lt(e,t);var r=Ft(e,e===Zc?$c:0);if(r===0)n!==null&&ht(n),e.callbackNode=null,e.callbackPriority=0;else if(t=r&-r,e.callbackPriority!==t){if(n!=null&&ht(n),t===1)e.tag===0?fa(jl.bind(null,e)):da(jl.bind(null,e)),ji(function(){!(Xc&6)&&pa()}),n=null;else{switch(Wt(r)){case 1:n=bt;break;case 4:n=xt;break;case 16:n=St;break;case 536870912:n=wt;break;default:n=St}n=eu(n,El.bind(null,e))}e.callbackPriority=t,e.callbackNode=n}}function El(e,t){if(bl=-1,xl=0,Xc&6)throw Error(r(327));var n=e.callbackNode;if(Kl()&&e.callbackNode!==n)return null;var i=Ft(e,e===Zc?$c:0);if(i===0)return null;if(i&30||(i&e.expiredLanes)!==0||t)t=zl(e,i);else{t=i;var a=Xc;Xc|=2;var o=Ll();(Zc!==e||$c!==t)&&(dl=null,ul=vt()+500,Fl(e,t));do try{Vl();break}catch(t){Il(e,t)}while(1);Za(),qc.current=o,Xc=a,Qc===null?(Zc=null,$c=0,t=nl):t=0}if(t!==0){if(t===2&&(a=Rt(e),a!==0&&(i=a,t=Dl(e,a))),t===1)throw n=rl,Fl(e,0),Al(e,i),Tl(e,vt()),n;if(t===6)Al(e,i);else{if(a=e.current.alternate,!(i&30)&&!kl(a)&&(t=zl(e,i),t===2&&(o=Rt(e),o!==0&&(i=o,t=Dl(e,o))),t===1))throw n=rl,Fl(e,0),Al(e,i),Tl(e,vt()),n;switch(e.finishedWork=a,e.finishedLanes=i,t){case 0:case 1:throw Error(r(345));case 2:Wl(e,cl,dl);break;case 3:if(Al(e,i),(i&130023424)===i&&(t=ll+500-vt(),10<t)){if(Ft(e,0)!==0)break;if(a=e.suspendedLanes,(a&i)!==i){Sl(),e.pingedLanes|=e.suspendedLanes&a;break}e.timeoutHandle=Oi(Wl.bind(null,e,cl,dl),t);break}Wl(e,cl,dl);break;case 4:if(Al(e,i),(i&4194240)===i)break;for(t=e.eventTimes,a=-1;0<i;){var s=31-Ot(i);o=1<<s,s=t[s],s>a&&(a=s),i&=~o}if(i=a,i=vt()-i,i=(120>i?120:480>i?480:1080>i?1080:1920>i?1920:3e3>i?3e3:4320>i?4320:1960*Kc(i/1960))-i,10<i){e.timeoutHandle=Oi(Wl.bind(null,e,cl,dl),i);break}Wl(e,cl,dl);break;case 5:Wl(e,cl,dl);break;default:throw Error(r(329))}}}return Tl(e,vt()),e.callbackNode===n?El.bind(null,e):null}function Dl(e,t){var n=sl;return e.current.memoizedState.isDehydrated&&(Fl(e,t).flags|=256),e=zl(e,t),e!==2&&(t=cl,cl=n,t!==null&&Ol(t)),e}function Ol(e){cl===null?cl=e:cl.push.apply(cl,e)}function kl(e){for(var t=e;;){if(t.flags&16384){var n=t.updateQueue;if(n!==null&&(n=n.stores,n!==null))for(var r=0;r<n.length;r++){var i=n[r],a=i.getSnapshot;i=i.value;try{if(!Mr(a(),i))return!1}catch{return!1}}}if(n=t.child,t.subtreeFlags&16384&&n!==null)n.return=t,t=n;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function Al(e,t){for(t&=~ol,t&=~al,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0<t;){var n=31-Ot(t),r=1<<n;e[n]=-1,t&=~r}}function jl(e){if(Xc&6)throw Error(r(327));Kl();var t=Ft(e,0);if(!(t&1))return Tl(e,vt()),null;var n=zl(e,t);if(e.tag!==0&&n===2){var i=Rt(e);i!==0&&(t=i,n=Dl(e,i))}if(n===1)throw n=rl,Fl(e,0),Al(e,t),Tl(e,vt()),n;if(n===6)throw Error(r(345));return e.finishedWork=e.current.alternate,e.finishedLanes=t,Wl(e,cl,dl),Tl(e,vt()),null}function Ml(e,t){var n=Xc;Xc|=1;try{return e(t)}finally{Xc=n,Xc===0&&(ul=vt()+500,la&&pa())}}function Nl(e){gl!==null&&gl.tag===0&&!(Xc&6)&&Kl();var t=Xc;Xc|=1;var n=Yc.transition,r=R;try{if(Yc.transition=null,R=1,e)return e()}finally{R=r,Yc.transition=n,Xc=t,!(Xc&6)&&pa()}}function Pl(){el=tl.current,z(tl)}function Fl(e,t){e.finishedWork=null,e.finishedLanes=0;var n=e.timeoutHandle;if(n!==-1&&(e.timeoutHandle=-1,ki(n)),Qc!==null)for(n=Qc.return;n!==null;){var r=n;switch(Ea(r),r.tag){case 1:r=r.type.childContextTypes,r!=null&&ra();break;case 3:bo(),z($i),z(Qi),Eo();break;case 5:So(r);break;case 4:bo();break;case 13:z(Co);break;case 19:z(Co);break;case 10:Qa(r.type._context);break;case 22:case 23:Pl()}n=n.return}if(Zc=e,Qc=e=au(e.current,null),$c=el=t,nl=0,rl=null,ol=al=il=0,cl=sl=null,B!==null){for(t=0;t<B.length;t++)if(n=B[t],r=n.interleaved,r!==null){n.interleaved=null;var i=r.next,a=n.pending;if(a!==null){var o=a.next;a.next=i,r.next=o}n.pending=r}B=null}return e}function Il(e,t){do{var n=Qc;try{if(Za(),Do.current=xs,No){for(var i=Ao.memoizedState;i!==null;){var a=i.queue;a!==null&&(a.pending=null),i=i.next}No=!1}if(ko=0,Mo=jo=Ao=null,Po=!1,Fo=0,Jc.current=null,n===null||n.return===null){nl=1,rl=t,Qc=null;break}a:{var o=e,s=n.return,c=n,l=t;if(t=$c,c.flags|=32768,typeof l==`object`&&l&&typeof l.then==`function`){var u=l,d=c,f=d.tag;if(!(d.mode&1)&&(f===0||f===11||f===15)){var p=d.alternate;p?(d.updateQueue=p.updateQueue,d.memoizedState=p.memoizedState,d.lanes=p.lanes):(d.updateQueue=null,d.memoizedState=null)}var m=zs(s);if(m!==null){m.flags&=-257,Bs(m,s,c,o,t),m.mode&1&&Rs(o,u,t),t=m,l=u;var h=t.updateQueue;if(h===null){var g=new Set;g.add(l),t.updateQueue=g}else h.add(l);break a}if(!(t&1)){Rs(o,u,t),Rl();break a}l=Error(r(426))}else if(ka&&c.mode&1){var _=zs(s);if(_!==null){!(_.flags&65536)&&(_.flags|=256),Bs(_,s,c,o,t),za(Ms(l,c));break a}}o=l=Ms(l,c),nl!==4&&(nl=2),sl===null?sl=[o]:sl.push(o),o=s;do{switch(o.tag){case 3:o.flags|=65536,t&=-t,o.lanes|=t;var v=Is(o,l,t);uo(o,v);break a;case 1:c=l;var y=o.type,b=o.stateNode;if(!(o.flags&128)&&(typeof y.getDerivedStateFromError==`function`||b!==null&&typeof b.componentDidCatch==`function`&&(ml===null||!ml.has(b)))){o.flags|=65536,t&=-t,o.lanes|=t;var x=Ls(o,c,t);uo(o,x);break a}}o=o.return}while(o!==null)}Ul(n)}catch(e){t=e,Qc===n&&n!==null&&(Qc=n=n.return);continue}break}while(1)}function Ll(){var e=qc.current;return qc.current=xs,e===null?xs:e}function Rl(){(nl===0||nl===3||nl===2)&&(nl=4),Zc===null||!(il&268435455)&&!(al&268435455)||Al(Zc,$c)}function zl(e,t){var n=Xc;Xc|=2;var i=Ll();(Zc!==e||$c!==t)&&(dl=null,Fl(e,t));do try{Bl();break}catch(t){Il(e,t)}while(1);if(Za(),Xc=n,qc.current=i,Qc!==null)throw Error(r(261));return Zc=null,$c=0,nl}function Bl(){for(;Qc!==null;)Hl(Qc)}function Vl(){for(;Qc!==null&&!gt();)Hl(Qc)}function Hl(e){var t=$l(e.alternate,e,el);e.memoizedProps=e.pendingProps,t===null?Ul(e):Qc=t,Jc.current=null}function Ul(e){var t=e;do{var n=t.alternate;if(e=t.return,t.flags&32768){if(n=_c(n,t),n!==null){n.flags&=32767,Qc=n;return}if(e!==null)e.flags|=32768,e.subtreeFlags=0,e.deletions=null;else{nl=6,Qc=null;return}}else if(n=gc(n,t,el),n!==null){Qc=n;return}if(t=t.sibling,t!==null){Qc=t;return}Qc=t=e}while(t!==null);nl===0&&(nl=5)}function Wl(e,t,n){var r=R,i=Yc.transition;try{Yc.transition=null,R=1,Gl(e,t,n,r)}finally{Yc.transition=i,R=r}return null}function Gl(e,t,n,i){do Kl();while(gl!==null);if(Xc&6)throw Error(r(327));n=e.finishedWork;var a=e.finishedLanes;if(n===null)return null;if(e.finishedWork=null,e.finishedLanes=0,n===e.current)throw Error(r(177));e.callbackNode=null,e.callbackPriority=0;var o=n.lanes|n.childLanes;if(Ht(e,o),e===Zc&&(Qc=Zc=null,$c=0),!(n.subtreeFlags&2064)&&!(n.flags&2064)||hl||(hl=!0,eu(St,function(){return Kl(),null})),o=!!(n.flags&15990),n.subtreeFlags&15990||o){o=Yc.transition,Yc.transition=null;var s=R;R=1;var c=Xc;Xc|=4,Jc.current=null,wc(e,n),zc(n,e),zr(Ei),gn=!!Ti,Ei=Ti=null,e.current=n,Vc(n,e,a),_t(),Xc=c,R=s,Yc.transition=o}else e.current=n;if(hl&&(hl=!1,gl=e,_l=a),o=e.pendingLanes,o===0&&(ml=null),Dt(n.stateNode,i),Tl(e,vt()),t!==null)for(i=e.onRecoverableError,n=0;n<t.length;n++)a=t[n],i(a.value,{componentStack:a.stack,digest:a.digest});if(fl)throw fl=!1,e=pl,pl=null,e;return _l&1&&e.tag!==0&&Kl(),o=e.pendingLanes,o&1?e===yl?vl++:(vl=0,yl=e):vl=0,pa(),null}function Kl(){if(gl!==null){var e=Wt(_l),t=Yc.transition,n=R;try{if(Yc.transition=null,R=16>e?16:e,gl===null)var i=!1;else{if(e=gl,gl=null,_l=0,Xc&6)throw Error(r(331));var a=Xc;for(Xc|=4,U=e.current;U!==null;){var o=U,s=o.child;if(U.flags&16){var c=o.deletions;if(c!==null){for(var l=0;l<c.length;l++){var u=c[l];for(U=u;U!==null;){var d=U;switch(d.tag){case 0:case 11:case 15:Tc(8,d,o)}var f=d.child;if(f!==null)f.return=d,U=f;else for(;U!==null;){d=U;var p=d.sibling,m=d.return;if(Oc(d),d===u){U=null;break}if(p!==null){p.return=m,U=p;break}U=m}}}var h=o.alternate;if(h!==null){var g=h.child;if(g!==null){h.child=null;do{var _=g.sibling;g.sibling=null,g=_}while(g!==null)}}U=o}}if(o.subtreeFlags&2064&&s!==null)s.return=o,U=s;else b:for(;U!==null;){if(o=U,o.flags&2048)switch(o.tag){case 0:case 11:case 15:Tc(9,o,o.return)}var v=o.sibling;if(v!==null){v.return=o.return,U=v;break b}U=o.return}}var y=e.current;for(U=y;U!==null;){s=U;var b=s.child;if(s.subtreeFlags&2064&&b!==null)b.return=s,U=b;else b:for(s=y;U!==null;){if(c=U,c.flags&2048)try{switch(c.tag){case 0:case 11:case 15:Ec(9,c)}}catch(e){Jl(c,c.return,e)}if(c===s){U=null;break b}var x=c.sibling;if(x!==null){x.return=c.return,U=x;break b}U=c.return}}if(Xc=a,pa(),Et&&typeof Et.onPostCommitFiberRoot==`function`)try{Et.onPostCommitFiberRoot(Tt,e)}catch{}i=!0}return i}finally{R=n,Yc.transition=t}}return!1}function ql(e,t,n){t=Ms(n,t),t=Is(e,t,1),e=co(e,t,1),t=Sl(),e!==null&&(Vt(e,1,t),Tl(e,t))}function Jl(e,t,n){if(e.tag===3)ql(e,e,n);else for(;t!==null;){if(t.tag===3){ql(t,e,n);break}if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError==`function`||typeof r.componentDidCatch==`function`&&(ml===null||!ml.has(r))){e=Ms(n,e),e=Ls(t,e,1),t=co(t,e,1),e=Sl(),t!==null&&(Vt(t,1,e),Tl(t,e));break}}t=t.return}}function Yl(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),t=Sl(),e.pingedLanes|=e.suspendedLanes&n,Zc===e&&($c&n)===n&&(nl===4||nl===3&&($c&130023424)===$c&&500>vt()-ll?Fl(e,0):ol|=n),Tl(e,t)}function Xl(e,t){t===0&&(e.mode&1?(t=Nt,Nt<<=1,!(Nt&130023424)&&(Nt=4194304)):t=1);var n=Sl();e=ro(e,t),e!==null&&(Vt(e,t,n),Tl(e,n))}function Zl(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),Xl(e,n)}function Ql(e,t){var n=0;switch(e.tag){case 13:var i=e.stateNode,a=e.memoizedState;a!==null&&(n=a.retryLane);break;case 19:i=e.stateNode;break;default:throw Error(r(314))}i!==null&&i.delete(t),Xl(e,n)}var $l=function(e,t,n){if(e!==null){if(e.memoizedProps!==t.pendingProps||$i.current)Hs=!0;else{if((e.lanes&n)===0&&!(t.flags&128))return Hs=!1,uc(e,t,n);Hs=!!(e.flags&131072)}}else Hs=!1,ka&&t.flags&1048576&&wa(t,_a,t.index);switch(t.lanes=0,t.tag){case 2:var i=t.type;cc(e,t),e=t.pendingProps;var a=ta(t,Qi.current);eo(t,n),a=zo(null,t,i,e,a,n);var o=Bo();return t.flags|=1,typeof a==`object`&&a&&typeof a.render==`function`&&a.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,na(i)?(o=!0,oa(t)):o=!1,t.memoizedState=a.state!==null&&a.state!==void 0?a.state:null,ao(t),a.updater=Ds,t.stateNode=a,a._reactInternals=t,js(t,i,e,n),t=Zs(null,t,i,!0,o,n)):(t.tag=0,ka&&o&&Ta(t),Us(null,t,a,n),t=t.child),t;case 16:i=t.elementType;a:{switch(cc(e,t),e=t.pendingProps,a=i._init,i=a(i._payload),t.type=i,a=t.tag=iu(i),e=Ts(i,e),a){case 0:t=Ys(null,t,i,e,n);break a;case 1:t=Xs(null,t,i,e,n);break a;case 11:t=Ws(null,t,i,e,n);break a;case 14:t=Gs(null,t,i,Ts(i.type,e),n);break a}throw Error(r(306,i,``))}return t;case 0:return i=t.type,a=t.pendingProps,a=t.elementType===i?a:Ts(i,a),Ys(e,t,i,a,n);case 1:return i=t.type,a=t.pendingProps,a=t.elementType===i?a:Ts(i,a),Xs(e,t,i,a,n);case 3:a:{if(Qs(t),e===null)throw Error(r(387));i=t.pendingProps,o=t.memoizedState,a=o.element,oo(e,t),fo(t,i,null,n);var s=t.memoizedState;if(i=s.element,o.isDehydrated){if(o={element:i,isDehydrated:!1,cache:s.cache,pendingSuspenseBoundaries:s.pendingSuspenseBoundaries,transitions:s.transitions},t.updateQueue.baseState=o,t.memoizedState=o,t.flags&256){a=Ms(Error(r(423)),t),t=$s(e,t,i,n,a);break a}if(i!==a){a=Ms(Error(r(424)),t),t=$s(e,t,i,n,a);break a}for(Oa=Pi(t.stateNode.containerInfo.firstChild),Da=t,ka=!0,Aa=null,n=Ka(t,null,i,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling}else{if(Ra(),i===a){t=lc(e,t,n);break a}Us(e,t,i,n)}t=t.child}return t;case 5:return xo(t),e===null&&Pa(t),i=t.type,a=t.pendingProps,o=e===null?null:e.memoizedProps,s=a.children,Di(i,a)?s=null:o!==null&&Di(i,o)&&(t.flags|=32),Js(e,t),Us(e,t,s,n),t.child;case 6:return e===null&&Pa(t),null;case 13:return tc(e,t,n);case 4:return yo(t,t.stateNode.containerInfo),i=t.pendingProps,e===null?t.child=Ga(t,null,i,n):Us(e,t,i,n),t.child;case 11:return i=t.type,a=t.pendingProps,a=t.elementType===i?a:Ts(i,a),Ws(e,t,i,a,n);case 7:return Us(e,t,t.pendingProps,n),t.child;case 8:return Us(e,t,t.pendingProps.children,n),t.child;case 12:return Us(e,t,t.pendingProps.children,n),t.child;case 10:a:{if(i=t.type._context,a=t.pendingProps,o=t.memoizedProps,s=a.value,Xi(qa,i._currentValue),i._currentValue=s,o!==null){if(Mr(o.value,s)){if(o.children===a.children&&!$i.current){t=lc(e,t,n);break a}}else for(o=t.child,o!==null&&(o.return=t);o!==null;){var c=o.dependencies;if(c!==null){s=o.child;for(var l=c.firstContext;l!==null;){if(l.context===i){if(o.tag===1){l=so(-1,n&-n),l.tag=2;var u=o.updateQueue;if(u!==null){u=u.shared;var d=u.pending;d===null?l.next=l:(l.next=d.next,d.next=l),u.pending=l}}o.lanes|=n,l=o.alternate,l!==null&&(l.lanes|=n),$a(o.return,n,t),c.lanes|=n;break}l=l.next}}else if(o.tag===10)s=o.type===t.type?null:o.child;else if(o.tag===18){if(s=o.return,s===null)throw Error(r(341));s.lanes|=n,c=s.alternate,c!==null&&(c.lanes|=n),$a(s,n,t),s=o.sibling}else s=o.child;if(s!==null)s.return=o;else for(s=o;s!==null;){if(s===t){s=null;break}if(o=s.sibling,o!==null){o.return=s.return,s=o;break}s=s.return}o=s}}Us(e,t,a.children,n),t=t.child}return t;case 9:return a=t.type,i=t.pendingProps.children,eo(t,n),a=to(a),i=i(a),t.flags|=1,Us(e,t,i,n),t.child;case 14:return i=t.type,a=Ts(i,t.pendingProps),a=Ts(i.type,a),Gs(e,t,i,a,n);case 15:return Ks(e,t,t.type,t.pendingProps,n);case 17:return i=t.type,a=t.pendingProps,a=t.elementType===i?a:Ts(i,a),cc(e,t),t.tag=1,na(i)?(e=!0,oa(t)):e=!1,eo(t,n),ks(t,i,a),js(t,i,a,n),Zs(null,t,i,!0,e,n);case 19:return sc(e,t,n);case 22:return qs(e,t,n)}throw Error(r(156,t.tag))};function eu(e,t){return mt(e,t)}function tu(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function nu(e,t,n,r){return new tu(e,t,n,r)}function ru(e){return e=e.prototype,!(!e||!e.isReactComponent)}function iu(e){if(typeof e==`function`)return+!!ru(e);if(e!=null){if(e=e.$$typeof,e===A)return 11;if(e===N)return 14}return 2}function au(e,t){var n=e.alternate;return n===null?(n=nu(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&14680064,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function ou(e,t,n,i,a,o){var s=2;if(i=e,typeof e==`function`)ru(e)&&(s=1);else if(typeof e==`string`)s=5;else a:switch(e){case E:return su(n.children,a,o,t);case D:s=8,a|=8;break;case O:return e=nu(12,n,t,a|2),e.elementType=O,e.lanes=o,e;case j:return e=nu(13,n,t,a),e.elementType=j,e.lanes=o,e;case M:return e=nu(19,n,t,a),e.elementType=M,e.lanes=o,e;case ne:return cu(n,a,o,t);default:if(typeof e==`object`&&e)switch(e.$$typeof){case k:s=10;break a;case ee:s=9;break a;case A:s=11;break a;case N:s=14;break a;case te:s=16,i=null;break a}throw Error(r(130,e==null?e:typeof e,``))}return t=nu(s,n,t,a),t.elementType=e,t.type=i,t.lanes=o,t}function su(e,t,n,r){return e=nu(7,e,r,t),e.lanes=n,e}function cu(e,t,n,r){return e=nu(22,e,r,t),e.elementType=ne,e.lanes=n,e.stateNode={isHidden:!1},e}function lu(e,t,n){return e=nu(6,e,null,t),e.lanes=n,e}function uu(e,t,n){return t=nu(4,e.children===null?[]:e.children,e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function du(e,t,n,r,i){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Bt(0),this.expirationTimes=Bt(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Bt(0),this.identifierPrefix=r,this.onRecoverableError=i,this.mutableSourceEagerHydrationData=null}function fu(e,t,n,r,i,a,o,s,c){return e=new du(e,t,n,s,c),t===1?(t=1,!0===a&&(t|=8)):t=0,a=nu(3,null,null,t),e.current=a,a.stateNode=e,a.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},ao(a),e}function pu(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:T,key:r==null?null:``+r,children:e,containerInfo:t,implementation:n}}function mu(e){if(!e)return Zi;e=e._reactInternals;a:{if(ct(e)!==e||e.tag!==1)throw Error(r(170));var t=e;do{switch(t.tag){case 3:t=t.stateNode.context;break a;case 1:if(na(t.type)){t=t.stateNode.__reactInternalMemoizedMergedChildContext;break a}}t=t.return}while(t!==null);throw Error(r(171))}if(e.tag===1){var n=e.type;if(na(n))return aa(e,n,t)}return t}function hu(e,t,n,r,i,a,o,s,c){return e=fu(n,r,!0,e,i,a,o,s,c),e.context=mu(null),n=e.current,r=Sl(),i=Cl(n),a=so(r,i),a.callback=t??null,co(n,a,i),e.current.lanes=i,Vt(e,i,r),Tl(e,r),e}function gu(e,t,n,r){var i=t.current,a=Sl(),o=Cl(i);return n=mu(n),t.context===null?t.context=n:t.pendingContext=n,t=so(a,o),t.payload={element:e},r=r===void 0?null:r,r!==null&&(t.callback=r),e=co(i,t,o),e!==null&&(wl(e,i,o,a),lo(e,i,o)),o}function _u(e){if(e=e.current,!e.child)return null;switch(e.child.tag){case 5:return e.child.stateNode;default:return e.child.stateNode}}function vu(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function yu(e,t){vu(e,t),(e=e.alternate)&&vu(e,t)}function bu(){return null}var xu=typeof reportError==`function`?reportError:function(e){console.error(e)};function Su(e){this._internalRoot=e}Cu.prototype.render=Su.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(r(409));gu(e,t,null,null)},Cu.prototype.unmount=Su.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;Nl(function(){gu(null,e,null,null)}),t[zi]=null}};function Cu(e){this._internalRoot=e}Cu.prototype.unstable_scheduleHydration=function(e){if(e){var t=Jt();e={blockedOn:null,target:e,priority:t};for(var n=0;n<rn.length&&t!==0&&t<rn[n].priority;n++);rn.splice(n,0,e),n===0&&ln(e)}};function wu(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function Tu(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11&&(e.nodeType!==8||e.nodeValue!==` react-mount-point-unstable `))}function Eu(){}function Du(e,t,n,r,i){if(i){if(typeof r==`function`){var a=r;r=function(){var e=_u(o);a.call(e)}}var o=hu(t,r,e,0,null,!1,!1,``,Eu);return e._reactRootContainer=o,e[zi]=o.current,pi(e.nodeType===8?e.parentNode:e),Nl(),o}for(;i=e.lastChild;)e.removeChild(i);if(typeof r==`function`){var s=r;r=function(){var e=_u(c);s.call(e)}}var c=fu(e,0,!1,null,null,!1,!1,``,Eu);return e._reactRootContainer=c,e[zi]=c.current,pi(e.nodeType===8?e.parentNode:e),Nl(function(){gu(t,c,n,r)}),c}function Ou(e,t,n,r,i){var a=n._reactRootContainer;if(a){var o=a;if(typeof i==`function`){var s=i;i=function(){var e=_u(o);s.call(e)}}gu(t,o,e,i)}else o=Du(n,t,e,i,r);return _u(o)}Gt=function(e){switch(e.tag){case 3:var t=e.stateNode;if(t.current.memoizedState.isDehydrated){var n=Pt(t.pendingLanes);n!==0&&(Ut(t,n|1),Tl(t,vt()),!(Xc&6)&&(ul=vt()+500,pa()))}break;case 13:Nl(function(){var t=ro(e,1);t!==null&&wl(t,e,1,Sl())}),yu(e,1)}},Kt=function(e){if(e.tag===13){var t=ro(e,134217728);t!==null&&wl(t,e,134217728,Sl()),yu(e,134217728)}},qt=function(e){if(e.tag===13){var t=Cl(e),n=ro(e,t);n!==null&&wl(n,e,t,Sl()),yu(e,t)}},Jt=function(){return R},Yt=function(e,t){var n=R;try{return R=e,t()}finally{R=n}},He=function(e,t,n){switch(t){case`input`:if(ye(e,n),t=n.name,n.type===`radio`&&t!=null){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll(`input[name=`+JSON.stringify(``+t)+`][type="radio"]`),t=0;t<n.length;t++){var i=n[t];if(i!==e&&i.form===e.form){var a=Ki(i);if(!a)throw Error(r(90));me(i),ye(i,a)}}}break;case`textarea`:Ee(e,n);break;case`select`:t=n.value,t!=null&&Ce(e,!!n.multiple,t,!1)}},Je=Ml,Ye=Nl;var ku={usingClientEntryPoint:!1,Events:[Wi,Gi,Ki,Ke,qe,Ml]},Au={findFiberByHostInstance:Ui,bundleType:0,version:`18.3.1`,rendererPackageName:`react-dom`},ju={bundleType:Au.bundleType,version:Au.version,rendererPackageName:Au.rendererPackageName,rendererConfig:Au.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:C.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return e=ft(e),e===null?null:e.stateNode},findFiberByHostInstance:Au.findFiberByHostInstance||bu,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:`18.3.1-next-f1338f8080-20240426`};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<`u`){var Mu=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Mu.isDisabled&&Mu.supportsFiber)try{Tt=Mu.inject(ju),Et=Mu}catch{}}e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=ku,e.createPortal=function(e,t){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!wu(t))throw Error(r(200));return pu(e,t,null,n)},e.createRoot=function(e,t){if(!wu(e))throw Error(r(299));var n=!1,i=``,a=xu;return t!=null&&(!0===t.unstable_strictMode&&(n=!0),t.identifierPrefix!==void 0&&(i=t.identifierPrefix),t.onRecoverableError!==void 0&&(a=t.onRecoverableError)),t=fu(e,1,!1,null,null,n,!1,i,a),e[zi]=t.current,pi(e.nodeType===8?e.parentNode:e),new Su(t)},e.findDOMNode=function(e){if(e==null)return null;if(e.nodeType===1)return e;var t=e._reactInternals;if(t===void 0)throw typeof e.render==`function`?Error(r(188)):(e=Object.keys(e).join(`,`),Error(r(268,e)));return e=ft(t),e=e===null?null:e.stateNode,e},e.flushSync=function(e){return Nl(e)},e.hydrate=function(e,t,n){if(!Tu(t))throw Error(r(200));return Ou(null,e,t,!0,n)},e.hydrateRoot=function(e,t,n){if(!wu(e))throw Error(r(405));var i=n!=null&&n.hydratedSources||null,a=!1,o=``,s=xu;if(n!=null&&(!0===n.unstable_strictMode&&(a=!0),n.identifierPrefix!==void 0&&(o=n.identifierPrefix),n.onRecoverableError!==void 0&&(s=n.onRecoverableError)),t=hu(t,null,e,1,n??null,a,!1,o,s),e[zi]=t.current,pi(e),i)for(e=0;e<i.length;e++)n=i[e],a=n._getVersion,a=a(n._source),t.mutableSourceEagerHydrationData==null?t.mutableSourceEagerHydrationData=[n,a]:t.mutableSourceEagerHydrationData.push(n,a);return new Cu(t)},e.render=function(e,t,n){if(!Tu(t))throw Error(r(200));return Ou(null,e,t,!1,n)},e.unmountComponentAtNode=function(e){if(!Tu(e))throw Error(r(40));return e._reactRootContainer?(Nl(function(){Ou(null,null,e,!1,function(){e._reactRootContainer=null,e[zi]=null})}),!0):!1},e.unstable_batchedUpdates=Ml,e.unstable_renderSubtreeIntoContainer=function(e,t,n,i){if(!Tu(n))throw Error(r(200));if(e==null||e._reactInternals===void 0)throw Error(r(38));return Ou(e,t,n,!1,i)},e.version=`18.3.1-next-f1338f8080-20240426`})),h=o(((e,t)=>{function n(){if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<`u`&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE==`function`)try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=m()})),g=o((e=>{var t=h();e.createRoot=t.createRoot,e.hydrateRoot=t.hydrateRoot})),_=l(d(),1),v=g(),y=o((e=>{var t=d(),n=Symbol.for(`react.element`),r=Symbol.for(`react.fragment`),i=Object.prototype.hasOwnProperty,a=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,o={key:!0,ref:!0,__self:!0,__source:!0};function s(e,t,r){var s,c={},l=null,u=null;for(s in r!==void 0&&(l=``+r),t.key!==void 0&&(l=``+t.key),t.ref!==void 0&&(u=t.ref),t)i.call(t,s)&&!o.hasOwnProperty(s)&&(c[s]=t[s]);if(e&&e.defaultProps)for(s in t=e.defaultProps,t)c[s]===void 0&&(c[s]=t[s]);return{$$typeof:n,type:e,key:l,ref:u,props:c,_owner:a.current}}e.Fragment=r,e.jsx=s,e.jsxs=s})),b=o(((e,t)=>{t.exports=y()}))(),x=_.createContext(void 0),S=e=>{let t=_.useContext(x);if(e)return e;if(!t)throw Error(`No QueryClient set, use QueryClientProvider to set one`);return t},C=({client:e,children:t})=>(_.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),(0,b.jsx)(x.Provider,{value:e,children:t})),w={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},T=new class{#e=w;setTimeoutProvider(e){this.#e=e}setTimeout(e,t){return this.#e.setTimeout(e,t)}clearTimeout(e){this.#e.clearTimeout(e)}setInterval(e,t){return this.#e.setInterval(e,t)}clearInterval(e){this.#e.clearInterval(e)}};function E(e){setTimeout(e,0)}var D=typeof window>`u`||`Deno`in globalThis;function O(){}function k(e,t){return typeof e==`function`?e(t):e}function ee(e){return typeof e==`number`&&e>=0&&e!==1/0}function A(e,t){return Math.max(e+(t||0)-Date.now(),0)}function j(e,t){return typeof e==`function`?e(t):e}function M(e,t){let{type:n=`all`,exact:r,fetchStatus:i,predicate:a,queryKey:o,stale:s}=e;if(o){if(r){if(t.queryHash!==te(o,t.options))return!1}else if(!P(t.queryKey,o))return!1}if(n!==`all`){let e=t.isActive();if(n===`active`&&!e||n===`inactive`&&e)return!1}return!(typeof s==`boolean`&&t.isStale()!==s||i&&i!==t.state.fetchStatus||a&&!a(t))}function N(e,t){let{exact:n,status:r,predicate:i,mutationKey:a}=e;if(a){if(!t.options.mutationKey)return!1;if(n){if(ne(t.options.mutationKey)!==ne(a))return!1}else if(!P(t.options.mutationKey,a))return!1}return!(r&&t.state.status!==r||i&&!i(t))}function te(e,t){return(t?.queryKeyHashFn||ne)(e)}function ne(e){return JSON.stringify(e,(e,t)=>ae(t)?Object.keys(t).sort().reduce((e,n)=>(e[n]=t[n],e),{}):t)}function P(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 n=0;n<t.length;n++)if(!P(e[n],t[n]))return!1;return!0}let n=Object.keys(t);for(let r of n)if(!P(e[r],t[r]))return!1;return!0}return!1}var re=Object.prototype.hasOwnProperty;function F(e,t,n=0){if(e===t)return e;if(n>500)return t;let r=ie(e)&&ie(t);if(!r&&!(ae(e)&&ae(t)))return t;let i=(r?e:Object.keys(e)).length,a=r?t:Object.keys(t),o=a.length,s=r?Array(o):{},c=0;for(let l=0;l<o;l++){let o=r?l:a[l],u=e[o],d=t[o];if(u===d){s[o]=u,(r?l<i:re.call(e,o))&&c++;continue}if(u===null||d===null||typeof u!=`object`||typeof d!=`object`){s[o]=d;continue}let f=F(u,d,n+1);s[o]=f,f===u&&c++}return i===o&&c===i?e:s}function I(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(e[n]!==t[n])return!1;return!0}function ie(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function ae(e){if(!oe(e))return!1;let t=Object.getPrototypeOf(e),n=t?.constructor;if(n===void 0)return!0;if(typeof n!=`function`)return!1;let r=n.prototype;return!(!oe(r)||!r.hasOwnProperty(`isPrototypeOf`)||t!==Object.prototype)}function oe(e){return Object.prototype.toString.call(e)===`[object Object]`}function se(e){return new Promise(t=>{T.setTimeout(t,e)})}function ce(e,t,n){return typeof n.structuralSharing==`function`?n.structuralSharing(e,t):n.structuralSharing===!1?t:F(e,t)}function le(e,t,n=0){let r=[...e,t];return n&&r.length>n?r.slice(1):r}function ue(e,t,n=0){let r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var de=Symbol();function fe(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===de?()=>Promise.reject(Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function pe(e,t){return typeof e==`function`?e(...t):!!e}function me(e,t,n){let r=!1,i;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(i??=t(),r?i:(r=!0,i.aborted?n():i.addEventListener(`abort`,n,{once:!0}),i))}),e}var he=()=>D,ge=()=>he(),_e=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(){}},ve=new class extends _e{#e;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e();return window.addEventListener(`visibilitychange`,t,!1),()=>{window.removeEventListener(`visibilitychange`,t)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(e=>{typeof e==`boolean`?this.setFocused(e):this.onFocus()})}setFocused(e){this.#e!==e&&(this.#e=e,this.onFocus())}onFocus(){let e=this.isFocused();this.listeners.forEach(t=>{t(e)})}isFocused(){return typeof this.#e==`boolean`?this.#e:globalThis.document?.visibilityState!==`hidden`}},ye=E;function be(){let e=[],t=0,n=e=>{e()},r=e=>{e()},i=ye,a=r=>{t?e.push(r):i(()=>{n(r)})},o=()=>{let t=e;e=[],t.length&&i(()=>{r(()=>{t.forEach(e=>{n(e)})})})};return{batch:e=>{let n;t++;try{n=e()}finally{t--,t||o()}return n},batchCalls:e=>(...t)=>{a(()=>{e(...t)})},schedule:a,setNotifyFunction:e=>{n=e},setBatchNotifyFunction:e=>{r=e},setScheduler:e=>{i=e}}}var xe=be(),Se=new class extends _e{#e=!0;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e(!0),n=()=>e(!1);return window.addEventListener(`online`,t,!1),window.addEventListener(`offline`,n,!1),()=>{window.removeEventListener(`online`,t),window.removeEventListener(`offline`,n)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(this.setOnline.bind(this))}setOnline(e){this.#e!==e&&(this.#e=e,this.listeners.forEach(t=>{t(e)}))}isOnline(){return this.#e}};function Ce(e){return Math.min(1e3*2**e,3e4)}function we(e){return(e??`online`)!==`online`||Se.isOnline()}var Te=class extends Error{constructor(e){super(`CancelledError`),this.revert=e?.revert,this.silent=e?.silent}};function Ee(e){let t=!1,n=0,r,i=`pending`,a,o,s=new Promise((e,t)=>{a=e,o=t});s.catch(O);let c=()=>i!==`pending`,l=t=>{if(!c()){let n=new Te(t);h(n),e.onCancel?.(n)}},u=()=>{t=!0},d=()=>{t=!1},f=()=>ve.isFocused()&&(e.networkMode===`always`||Se.isOnline())&&e.canRun(),p=()=>we(e.networkMode)&&e.canRun(),m=e=>{c()||(r?.(),i=`resolved`,a(e))},h=e=>{c()||(r?.(),i=`rejected`,o(e))},g=()=>new Promise(t=>{r=e=>{(c()||f())&&t(e)},e.onPause?.()}).then(()=>{r=void 0,c()||e.onContinue?.()}),_=()=>{if(c())return;let r,i=n===0?e.initialPromise:void 0;try{r=i??e.fn()}catch(e){r=Promise.reject(e)}Promise.resolve(r).then(m).catch(r=>{if(c())return;let i=e.retry??(ge()?0:3),a=e.retryDelay??Ce,o=typeof a==`function`?a(n,r):a,s=i===!0||typeof i==`number`&&n<i||typeof i==`function`&&i(n,r);if(t||!s){h(r);return}n++,e.onFail?.(n,r),se(o).then(()=>f()?void 0:g()).then(()=>{t?h(r):_()})})};return{promise:s,status:()=>i,cancel:l,continue:()=>(r?.(),s),cancelRetry:u,continueRetry:d,canStart:p,start:()=>(p()?_():g().then(_),s)}}var De=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),ee(this.gcTime)&&(this.#e=T.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(ge()?1/0:3e5))}clearGcTimeout(){this.#e!==void 0&&(T.clearTimeout(this.#e),this.#e=void 0)}};function Oe(e){return{onFetch:(t,n)=>{let r=t.options,i=t.fetchOptions?.meta?.fetchMore?.direction,a=t.state.data?.pages||[],o=t.state.data?.pageParams||[],s={pages:[],pageParams:[]},c=0,l=async()=>{let n=!1,l=e=>{me(e,()=>t.signal,()=>n=!0)},u=fe(t.options,t.fetchOptions),d=async(e,r,i)=>{if(n)return Promise.reject(t.signal.reason);if(r==null&&e.pages.length)return Promise.resolve(e);let a=(()=>{let e={client:t.client,queryKey:t.queryKey,pageParam:r,direction:i?`backward`:`forward`,meta:t.options.meta};return l(e),e})(),o=await u(a),{maxPages:s}=t.options,c=i?ue:le;return{pages:c(e.pages,o,s),pageParams:c(e.pageParams,r,s)}};if(i&&a.length){let e=i===`backward`,t=e?Ae:ke,n={pages:a,pageParams:o};s=await d(n,t(r,n),e)}else{let t=e??a.length;do{let e=c===0?o[0]??r.initialPageParam:ke(r,s);if(c>0&&e==null)break;s=await d(s,e),c++}while(c<t)}return s};t.fetchFn=t.options.persister?()=>t.options.persister?.(l,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n):l}}}function ke(e,{pages:t,pageParams:n}){let r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function Ae(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}var je=class extends De{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e){super(),this.#s=!1,this.#o=e.defaultOptions,this.setOptions(e.options),this.observers=[],this.#i=e.client,this.#r=this.#i.getQueryCache(),this.queryKey=e.queryKey,this.queryHash=e.queryHash,this.#t=Pe(this.options),this.state=e.state??this.#t,this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return this.#e}get promise(){return this.#a?.promise}setOptions(e){if(this.options={...this.#o,...e},e?._type&&(this.#e=e._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){let e=Pe(this.options);e.data!==void 0&&(this.setState(Ne(e.data,e.dataUpdatedAt)),this.#t=e)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus===`idle`&&this.#r.remove(this)}setData(e,t){let n=ce(this.state.data,e,this.options);return this.#c({data:n,type:`success`,dataUpdatedAt:t?.updatedAt,manual:t?.manual}),n}setState(e){this.#c({type:`setState`,state:e})}cancel(e){let t=this.#a?.promise;return this.#a?.cancel(e),t?t.then(O).catch(O):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return this.#t}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(e=>j(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===de||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0&&this.observers.some(e=>j(e.options.staleTime,this)===`static`)}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(e=0){return this.state.data===void 0?!0:e===`static`?!1:this.state.isInvalidated?!0:!A(this.state.dataUpdatedAt,e)}onFocus(){this.observers.find(e=>e.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#a?.continue()}onOnline(){this.observers.find(e=>e.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#a?.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),this.#r.notify({type:`observerAdded`,query:this,observer:e}))}removeObserver(e){let t=this.observers.indexOf(e);t!==-1&&(this.observers.splice(t,1),this.observers.length||(this.#a&&(this.#s||this.state.fetchStatus===`paused`&&this.state.status===`pending`?this.#a.cancel({revert:!0}):this.#a.cancelRetry()),this.scheduleGc()),this.#r.notify({type:`observerRemoved`,query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||this.#c({type:`invalidate`})}async fetch(e,t){if(this.state.fetchStatus!==`idle`&&this.#a?.status()!==`rejected`){if(this.state.data!==void 0&&t?.cancelRefetch)this.cancel({silent:!0});else if(this.#a)return this.#a.continueRetry(),this.#a.promise}if(e&&this.setOptions(e),!this.options.queryFn){let e=this.observers.find(e=>e.options.queryFn);e&&this.setOptions(e.options)}let n=new AbortController,r=e=>{Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(this.#s=!0,n.signal)})},i=()=>{let e=fe(this.options,t),n=(()=>{let e={client:this.#i,queryKey:this.queryKey,meta:this.meta};return r(e),e})();return this.#s=!1,this.options.persister?this.options.persister(e,n,this):e(n)},a=(()=>{let e={fetchOptions:t,options:this.options,queryKey:this.queryKey,client:this.#i,state:this.state,fetchFn:i};return r(e),e})();(this.#e===`infinite`?Oe(this.options.pages):this.options.behavior)?.onFetch(a,this),this.#n=this.state,(this.state.fetchStatus===`idle`||this.state.fetchMeta!==a.fetchOptions?.meta)&&this.#c({type:`fetch`,meta:a.fetchOptions?.meta});let o=this.#a=Ee({initialPromise:t?.initialPromise,fn:a.fetchFn,onCancel:e=>{e instanceof Te&&e.revert&&this.setState({...this.#n,fetchStatus:`idle`}),n.abort()},onFail:(e,t)=>{this.#c({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#c({type:`pause`})},onContinue:()=>{this.#c({type:`continue`})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0});try{let e=await o.start();if(e===void 0)throw Error(`${this.queryHash} data is undefined`);return this.setData(e),this.#r.config.onSuccess?.(e,this),this.#r.config.onSettled?.(e,this.state.error,this),e}catch(e){if(e instanceof Te){if(e.silent)return this.#a.promise;if(e.revert){if(this.state.data===void 0)throw e;return this.state.data}}throw this.#c({type:`error`,error:e}),this.#r.config.onError?.(e,this),this.#r.config.onSettled?.(this.state.data,e,this),e}finally{this.#a===o&&(this.#a=void 0),this.scheduleGc()}}#c(e){let t=t=>{switch(e.type){case`failed`:return{...t,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case`pause`:return{...t,fetchStatus:`paused`};case`continue`:return{...t,fetchStatus:`fetching`};case`fetch`:return{...t,...Me(t.data,this.options),fetchMeta:e.meta??null};case`success`:let n={...t,...Ne(e.data,e.dataUpdatedAt),dataUpdateCount:t.dataUpdateCount+1,...!e.manual&&{fetchStatus:`idle`,fetchFailureCount:0,fetchFailureReason:null}};return this.#n=e.manual?n:void 0,n;case`error`:let r=e.error;return{...t,error:r,errorUpdateCount:t.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:t.fetchFailureCount+1,fetchFailureReason:r,fetchStatus:`idle`,status:`error`,isInvalidated:!0};case`invalidate`:return{...t,isInvalidated:!0};case`setState`:return{...t,...e.state}}};this.state=t(this.state),xe.batch(()=>{this.observers.slice().forEach(e=>{e.onQueryUpdate()}),this.#r.notify({query:this,type:`updated`,action:e})})}};function Me(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:we(t.networkMode)?`fetching`:`paused`,...e===void 0&&{error:null,status:`pending`}}}function Ne(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:`success`}}function Pe(e){let 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 Fe=class extends _e{#e;#t=void 0;#n=void 0;#r=void 0;#i;#a;#o;#s;#c;#l;#u;#d;#f;#p=new Set;constructor(e,t){super(),this.options=t,this.#e=e,this.#o=null,this.bindMethods(),this.setOptions(t)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#t.addObserver(this),Le(this.#t,this.options)?this.#m():this.updateResult(),this.#y())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return Re(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Re(this.#t,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#b(),this.#x(),this.#t.removeObserver(this)}setOptions(e){let t=this.options,n=this.#t;if(this.options=this.#e.defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!=`boolean`&&typeof this.options.enabled!=`function`&&typeof j(this.options.enabled,this.#t)!=`boolean`)throw Error(`Expected enabled to be a boolean or a callback that returns a boolean`);this.#S(),this.#t.setOptions(this.options),t._defaulted&&!I(this.options,t)&&this.#e.getQueryCache().notify({type:`observerOptionsUpdated`,query:this.#t,observer:this});let r=this.hasListeners();r&&ze(this.#t,n,this.options,t)&&this.#m(),this.updateResult(),r&&(this.#t!==n||j(this.options.enabled,this.#t)!==j(t.enabled,this.#t)||j(this.options.staleTime,this.#t)!==j(t.staleTime,this.#t))&&this.#g();let i=this.#_();r&&(this.#t!==n||j(this.options.enabled,this.#t)!==j(t.enabled,this.#t)||i!==this.#f)&&this.#v(i)}getOptimisticResult(e){let t=this.#e.getQueryCache().build(this.#e,e),n=this.createResult(t,e);return I(this.getCurrentResult(),n)||(this.#r=n,this.#a=this.options,this.#i=this.#t.state),n}getCurrentResult(){return this.#r}trackResult(e,t){return new Proxy(e,{get:(e,n)=>(this.trackProp(n),t?.(n),Reflect.get(e,n))})}trackProp(e){this.#p.add(e)}getCurrentQuery(){return this.#t}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){let t=this.#e.defaultQueryOptions(e),n=this.#e.getQueryCache().build(this.#e,t),r=()=>{},i,a=new Promise(e=>{i=e,r=this.#e.getQueryCache().subscribe(i=>{i.type===`updated`&&i.query.queryHash===n.queryHash&&n.state.data!==void 0&&(r(),e(this.createResult(n,t)))})});return Promise.race([n.fetch().then(()=>{let e=this.createResult(n,t);return i?.(e),e}).finally(()=>{r()}),a])}fetch(e){return this.#m({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#r))}#m(e){this.#S();let t=this.#t.fetch(this.options,e);return e?.throwOnError||(t=t.catch(O)),t}#h(e){return!ge()&&j(this.options.enabled,this.#t)!==!1&&ee(e)}#g(){this.#b();let e=j(this.options.staleTime,this.#t);if(this.#r.isStale||!this.#h(e))return;let t=A(this.#r.dataUpdatedAt,e)+1;this.#u=T.setTimeout(()=>{this.#r.isStale||this.updateResult()},t)}#_(){return j(this.options.refetchInterval,this.#t)??!1}#v(e){this.#x(),this.#f=e,this.#f!==0&&this.#h(this.#f)&&(this.#d=T.setInterval(()=>{(this.options.refetchIntervalInBackground||ve.isFocused())&&this.#m()},this.#f))}#y(){this.#g(),this.#v(this.#_())}#b(){this.#u!==void 0&&(T.clearTimeout(this.#u),this.#u=void 0)}#x(){this.#d!==void 0&&(T.clearInterval(this.#d),this.#d=void 0)}createResult(e,t){let n=this.#t,r=this.options,i=this.#r,a=this.#i,o=this.#a,s=e===n?this.#n:e.state,{state:c}=e,l={...c},u=!1,d;if(t._optimisticResults){let i=this.hasListeners(),a=!i&&Le(e,t),o=i&&ze(e,n,t,r);(a||o)&&(l={...l,...Me(c.data,e.options)}),t._optimisticResults===`isRestoring`&&(l.fetchStatus=`idle`)}let{error:f,errorUpdatedAt:p,status:m}=l;d=l.data;let h=!1;if(t.placeholderData!==void 0&&d===void 0&&m===`pending`){let e;i?.isPlaceholderData&&t.placeholderData===o?.placeholderData?(e=i.data,h=!0):e=typeof t.placeholderData==`function`?t.placeholderData(this.#l?.state.data,this.#l):t.placeholderData,e!==void 0&&(m=`success`,d=ce(i?.data,e,t),u=!0)}if(t.select&&d!==void 0&&!h){if(i&&d===a?.data&&t.select===this.#s)d=this.#c;else try{this.#s=t.select,d=t.select(d),d=ce(i?.data,d,t),this.#c=d,this.#o=null}catch(e){this.#o=e}}else d===void 0&&(this.#o=null);this.#o&&(f=this.#o,d=this.#c,p=Date.now(),m=`error`,u=!1);let g=l.fetchStatus===`fetching`,_=m===`pending`,v=m===`error`,y=_&&g,b=d!==void 0;return{status:m,fetchStatus:l.fetchStatus,isPending:_,isSuccess:m===`success`,isError:v,isInitialLoading:y,isLoading:y,data:d,dataUpdatedAt:l.dataUpdatedAt,error:f,errorUpdatedAt:p,failureCount:l.fetchFailureCount,failureReason:l.fetchFailureReason,errorUpdateCount:l.errorUpdateCount,isFetched:e.isFetched(),isFetchedAfterMount:l.dataUpdateCount>s.dataUpdateCount||l.errorUpdateCount>s.errorUpdateCount,isFetching:g,isRefetching:g&&!_,isLoadingError:v&&!b,isPaused:l.fetchStatus===`paused`,isPlaceholderData:u,isRefetchError:v&&b,isStale:Be(e,t),refetch:this.refetch,isEnabled:j(t.enabled,e)!==!1}}updateResult(){let e=this.#r,t=this.createResult(this.#t,this.options);if(this.#i=this.#t.state,this.#a=this.options,this.#i.data!==void 0&&(this.#l=this.#t),I(t,e))return;this.#r=t;let n=(()=>{if(!e)return!0;let{notifyOnChangeProps:t}=this.options,n=typeof t==`function`?t():t;if(n===`all`||!n&&!this.#p.size)return!0;let r=new Set(n??this.#p);return this.options.throwOnError&&r.add(`error`),Object.keys(this.#r).some(t=>{let n=t;return this.#r[n]!==e[n]&&r.has(n)})})();xe.batch(()=>{n&&this.listeners.forEach(e=>{e(this.#r)}),this.#e.getQueryCache().notify({query:this.#t,type:`observerResultsUpdated`})})}#S(){let e=this.#e.getQueryCache().build(this.#e,this.options);if(e===this.#t)return;let t=this.#t;this.#t=e,this.#n=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#y()}};function Ie(e,t){return j(t.enabled,e)!==!1&&e.state.data===void 0&&(e.state.status!==`error`||j(t.retryOnMount,e)!==!1)}function Le(e,t){return Ie(e,t)||e.state.data!==void 0&&Re(e,t,t.refetchOnMount)}function Re(e,t,n){if(j(t.enabled,e)!==!1&&j(t.staleTime,e)!==`static`){let r=j(n,e);return r===`always`||r!==!1&&Be(e,t)}return!1}function ze(e,t,n,r){return(e!==t||j(r.enabled,e)===!1)&&(!n.suspense||e.state.status!==`error`)&&Be(e,n)}function Be(e,t){return j(t.enabled,e)!==!1&&e.isStaleByTime(j(t.staleTime,e))}var Ve=class extends De{#e;#t;#n;#r;constructor(e){super(),this.#e=e.client,this.mutationId=e.mutationId,this.#n=e.mutationCache,this.#t=[],this.state=e.state||He(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){this.#t.includes(e)||(this.#t.push(e),this.clearGcTimeout(),this.#n.notify({type:`observerAdded`,mutation:this,observer:e}))}removeObserver(e){this.#t=this.#t.filter(t=>t!==e),this.scheduleGc(),this.#n.notify({type:`observerRemoved`,mutation:this,observer:e})}optionalRemove(){this.#t.length||(this.state.status===`pending`?this.scheduleGc():this.#n.remove(this))}continue(){return this.#r?.continue()??(this.state.status===`pending`?this.execute(this.state.variables):Promise.resolve())}async execute(e){let t=()=>{this.#i({type:`continue`})},n={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey},r=this.#r=Ee({fn:()=>this.options.mutationFn?this.options.mutationFn(e,n):Promise.reject(Error(`No mutationFn found`)),onFail:(e,t)=>{this.#i({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#i({type:`pause`})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#n.canRun(this)}),i=this.state.status===`pending`,a=!r.canStart();try{if(i)t();else{this.#i({type:`pending`,variables:e,isPaused:a}),this.#n.config.onMutate&&await this.#n.config.onMutate(e,this,n);let t=await this.options.onMutate?.(e,n);t!==this.state.context&&this.#i({type:`pending`,context:t,variables:e,isPaused:a})}let o=await r.start();return await this.#n.config.onSuccess?.(o,e,this.state.context,this,n),await this.options.onSuccess?.(o,e,this.state.context,n),await this.#n.config.onSettled?.(o,null,this.state.variables,this.state.context,this,n),await this.options.onSettled?.(o,null,e,this.state.context,n),this.#i({type:`success`,data:o}),o}catch(t){try{await this.#n.config.onError?.(t,e,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onError?.(t,e,this.state.context,n)}catch(e){Promise.reject(e)}try{await this.#n.config.onSettled?.(void 0,t,this.state.variables,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onSettled?.(void 0,t,e,this.state.context,n)}catch(e){Promise.reject(e)}throw this.#i({type:`error`,error:t}),t}finally{this.#r===r&&(this.#r=void 0),this.#n.runNext(this)}}#i(e){let t=t=>{switch(e.type){case`failed`:return{...t,failureCount:e.failureCount,failureReason:e.error};case`pause`:return{...t,isPaused:!0};case`continue`:return{...t,isPaused:!1};case`pending`:return{...t,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:`pending`,variables:e.variables,submittedAt:Date.now()};case`success`:return{...t,data:e.data,failureCount:0,failureReason:null,error:null,status:`success`,isPaused:!1};case`error`:return{...t,data:void 0,error:e.error,failureCount:t.failureCount+1,failureReason:e.error,isPaused:!1,status:`error`}}};this.state=t(this.state),xe.batch(()=>{this.#t.forEach(t=>{t.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:`updated`,action:e})})}};function He(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:`idle`,variables:void 0,submittedAt:0}}var Ue=class extends _e{#e;#t;#n;constructor(e={}){super(),this.config=e,this.#e=new Set,this.#t=new Map,this.#n=0}build(e,t,n){let r=new Ve({client:e,mutationCache:this,mutationId:++this.#n,options:e.defaultMutationOptions(t),state:n});return this.add(r),r}add(e){this.#e.add(e);let t=We(e);if(typeof t==`string`){let n=this.#t.get(t);n?n.push(e):this.#t.set(t,[e])}this.notify({type:`added`,mutation:e})}remove(e){if(this.#e.delete(e)){let t=We(e);if(typeof t==`string`){let n=this.#t.get(t);if(n){if(n.length>1){let t=n.indexOf(e);t!==-1&&n.splice(t,1)}else n[0]===e&&this.#t.delete(t)}}}this.notify({type:`removed`,mutation:e})}canRun(e){let t=We(e);if(typeof t==`string`){let n=this.#t.get(t)?.find(e=>e.state.status===`pending`);return!n||n===e}return!0}runNext(e){let t=We(e);return typeof t==`string`?(this.#t.get(t)?.find(t=>t!==e&&t.state.isPaused))?.continue()??Promise.resolve():Promise.resolve()}clear(){xe.batch(()=>{this.#e.forEach(e=>{this.notify({type:`removed`,mutation:e})}),this.#e.clear(),this.#t.clear()})}getAll(){return Array.from(this.#e)}find(e){let t={exact:!0,...e};return this.getAll().find(e=>N(t,e))}findAll(e={}){return this.getAll().filter(t=>N(e,t))}notify(e){xe.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return xe.batch(()=>Promise.all(e.map(e=>e.continue().catch(O))))}};function We(e){return e.options.scope?.id}function Ge(e,t){let n=new Set(t);return e.filter(e=>!n.has(e))}var Ke=class extends _e{#e;#t;#n;#r;#i;#a;#o;#s;#c;#l=[];constructor(e,t,n){super(),this.#e=e,this.#r=n,this.#n=[],this.#i=[],this.#t=[],this.setQueries(t)}onSubscribe(){this.listeners.size===1&&this.#i.forEach(e=>{e.subscribe(t=>{this.#m(e,t)})})}onUnsubscribe(){this.listeners.size||this.destroy()}destroy(){this.listeners=new Set,this.#i.forEach(e=>{e.destroy()})}setQueries(e,t){this.#n=e,this.#r=t,xe.batch(()=>{let e=this.#i,t=this.#p(this.#n);t.forEach(e=>e.observer.setOptions(e.defaultedQueryOptions));let n=t.map(e=>e.observer),r=n.map(e=>e.getCurrentResult()),i=e.length!==n.length,a=n.some((t,n)=>t!==e[n]),o=i||a,s=o?!0:r.some((e,t)=>{let n=this.#t[t];return!n||!I(e,n)});(o||s)&&(o&&(this.#l=t,this.#i=n),this.#t=r,this.hasListeners()&&(o&&(Ge(e,n).forEach(e=>{e.destroy()}),Ge(n,e).forEach(e=>{e.subscribe(t=>{this.#m(e,t)})})),this.#h()))})}getCurrentResult(){return this.#t}getQueries(){return this.#i.map(e=>e.getCurrentQuery())}getObservers(){return this.#i}getOptimisticResult(e,t){let n=this.#p(e),r=n.map(e=>e.observer.getOptimisticResult(e.defaultedQueryOptions)),i=n.map(e=>e.defaultedQueryOptions.queryHash);return[r,e=>this.#d(e??r,t,i),()=>this.#u(r,n)]}#u(e,t){let n=new Set;return t.map((r,i)=>{let a=e[i];return r.defaultedQueryOptions.notifyOnChangeProps?a:r.observer.trackResult(a,e=>{n.has(e)||(n.add(e),t.forEach(t=>{t.observer.trackProp(e)}))})})}#d(e,t,n){if(t){let r=this.#c,i=n!==void 0&&r!==void 0&&(r.length!==n.length||n.some((e,t)=>e!==r[t]));return(this.#t!==this.#s||i||t!==this.#o)&&(this.#o=t,this.#s=this.#t,n!==void 0&&(this.#c=n),this.#a=F(this.#a,t(e))),this.#a}return e}#f(){return!this.#r?.combine||this.#i.some((e,t)=>e.options.suspense&&this.#t[t]?.data===void 0)}#p(e){let t=new Map;this.#i.forEach(e=>{let n=e.options.queryHash;if(!n)return;let r=t.get(n);r?r.push(e):t.set(n,[e])});let n=[];return e.forEach(e=>{let r=this.#e.defaultQueryOptions(e),i=t.get(r.queryHash)?.shift()??new Fe(this.#e,r);n.push({defaultedQueryOptions:r,observer:i})}),n}#m(e,t){let n=this.#i.indexOf(e);n!==-1&&(this.#t=this.#t.slice(),this.#t[n]=t,this.#h())}#h(){if(this.hasListeners()){let e=this.#f(),t=this.#a,n=e?t:this.#d(this.#u(this.#t,this.#l),this.#r?.combine);(e||t!==n)&&xe.batch(()=>{this.listeners.forEach(e=>{e(this.#t)})})}}},qe=class extends _e{#e;constructor(e={}){super(),this.config=e,this.#e=new Map}build(e,t,n){let r=t.queryKey,i=t.queryHash??te(r,t),a=this.get(i);return a||(a=new je({client:e,queryKey:r,queryHash:i,options:e.defaultQueryOptions(t),state:n,defaultOptions:e.getQueryDefaults(r)}),this.add(a)),a}add(e){this.#e.has(e.queryHash)||(this.#e.set(e.queryHash,e),this.notify({type:`added`,query:e}))}remove(e){let t=this.#e.get(e.queryHash);t&&(e.destroy(),t===e&&this.#e.delete(e.queryHash),this.notify({type:`removed`,query:e}))}clear(){xe.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#e.get(e)}getAll(){return[...this.#e.values()]}find(e){let t={exact:!0,...e};return this.getAll().find(e=>M(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>M(e,t)):t}notify(e){xe.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){xe.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){xe.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},Je=class{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#e=e.queryCache||new qe,this.#t=e.mutationCache||new Ue,this.#n=e.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=ve.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=Se.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onOnline())}))}unmount(){this.#a--,this.#a===0&&(this.#o?.(),this.#o=void 0,this.#s?.(),this.#s=void 0)}isFetching(e){return this.#e.findAll({...e,fetchStatus:`fetching`}).length}isMutating(e){return this.#t.findAll({...e,status:`pending`}).length}getQueryData(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state.data}ensureQueryData(e){let t=this.defaultQueryOptions(e),n=this.#e.build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(j(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return this.#e.findAll(e).map(({queryKey:e,state:t})=>[e,t.data])}setQueryData(e,t,n){let r=this.defaultQueryOptions({queryKey:e}),i=this.#e.get(r.queryHash)?.state.data,a=k(t,i);if(a!==void 0)return this.#e.build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return xe.batch(()=>this.#e.findAll(e).map(({queryKey:e})=>[e,this.setQueryData(e,t,n)]))}getQueryState(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state}removeQueries(e){let t=this.#e;xe.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let n=this.#e;return xe.batch(()=>{let r=n.findAll(e),i=new Set(r);return r.forEach(e=>{e.reset()}),this.refetchQueries({type:`active`,predicate:e=>i.has(e)},t)})}cancelQueries(e,t={}){let n={revert:!0,...t},r=xe.batch(()=>this.#e.findAll(e).map(e=>e.cancel(n)));return Promise.all(r).then(O).catch(O)}invalidateQueries(e,t={}){return xe.batch(()=>(this.#e.findAll(e).forEach(e=>{e.invalidate()}),e?.refetchType===`none`?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??`active`},t)))}refetchQueries(e,t={}){let n={...t,cancelRefetch:t.cancelRefetch??!0},r=xe.batch(()=>this.#e.findAll(e).filter(e=>!e.isDisabled()&&!e.isStatic()).map(e=>{let t=e.fetch(void 0,n);return n.throwOnError||(t=t.catch(O)),e.state.fetchStatus===`paused`?Promise.resolve():t}));return Promise.all(r).then(O)}async query(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t),r=n.isStaleByTime(j(t.staleTime,n))?await n.fetch(t):n.state.data,i=t.select;return i?i(r):r}fetchQuery(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t);return n.isStaleByTime(j(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(O).catch(O)}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(O).catch(O)}ensureInfiniteQueryData(e){return e._type=`infinite`,this.ensureQueryData(e)}resumePausedMutations(){return Se.isOnline()?this.#t.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#e}getMutationCache(){return this.#t}getDefaultOptions(){return this.#n}setDefaultOptions(e){this.#n=e}setQueryDefaults(e,t){this.#r.set(ne(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#r.values()],n={};return t.forEach(t=>{P(e,t.queryKey)&&Object.assign(n,t.defaultOptions)}),n}setMutationDefaults(e,t){this.#i.set(ne(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#i.values()],n={};return t.forEach(t=>{P(e,t.mutationKey)&&Object.assign(n,t.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;let t={...this.#n.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||=te(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===de&&(t.enabled=!1),t}defaultMutationOptions(e){return e?._defaulted?e:{...this.#n.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#e.clear(),this.#t.clear()}},Ye=_.createContext(!1),Xe=()=>_.useContext(Ye);Ye.Provider;function Ze(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var Qe=_.createContext(Ze()),$e=()=>_.useContext(Qe),et=(e,t,n)=>{let r=n?.state.error&&typeof e.throwOnError==`function`?pe(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||r)&&(t.isReset()||(e.retryOnMount=!1))},tt=e=>{_.useEffect(()=>{e.clearReset()},[e])},nt=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:i})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(i&&e.data===void 0||pe(n,[e.error,r])),rt=e=>{if(e.suspense){let t=1e3,n=e=>e===`static`?e:Math.max(e??t,t),r=e.staleTime;e.staleTime=typeof r==`function`?(...e)=>n(r(...e)):n(r),typeof e.gcTime==`number`&&(e.gcTime=Math.max(e.gcTime,t))}},it=(e,t)=>e?.suspense&&t.isPending,L=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function at({queries:e,...t},n){let r=S(n),i=Xe(),a=$e(),o=t.subscribed!==!1,s=_.useMemo(()=>e.map(e=>{let t=r.defaultQueryOptions(e);return t._optimisticResults=i?`isRestoring`:o?`optimistic`:void 0,t}),[e,r,i,o]);s.forEach(e=>{rt(e);let t=r.getQueryCache().get(e.queryHash);et(e,a,t)}),tt(a);let[c]=_.useState(()=>new Ke(r,s,t)),[l,u,d]=c.getOptimisticResult(s,t.combine),f=!i&&o;_.useSyncExternalStore(_.useCallback(e=>f?c.subscribe(xe.batchCalls(e)):O,[c,f]),()=>c.getCurrentResult(),()=>c.getCurrentResult()),_.useEffect(()=>{c.setQueries(s,t)},[s,t,c]);let p=l.some((e,t)=>it(s[t],e))?l.flatMap((e,t)=>{let n=s[t];return n&&it(n,e)?L(n,new Fe(r,n),a):[]}):[];if(p.length>0)throw Promise.all(p);let m=l.find((e,t)=>{let n=s[t];return n&&nt({result:e,errorResetBoundary:a,throwOnError:n.throwOnError,query:r.getQueryCache().get(n.queryHash),suspense:n.suspense})});if(m)throw m.error;return u(d())}function ot(e,t,n){let r=Xe(),i=$e(),a=S(n),o=a.defaultQueryOptions(e),s=a.getQueryCache().get(o.queryHash),c=e.subscribed!==!1;o._optimisticResults=r?`isRestoring`:c?`optimistic`:void 0,rt(o),et(o,i,s),tt(i);let[l]=_.useState(()=>new t(a,o)),u=l.getOptimisticResult(o),d=!r&&c;if(_.useSyncExternalStore(_.useCallback(e=>{let t=d?l.subscribe(xe.batchCalls(e)):O;return l.updateResult(),t},[l,d]),()=>l.getCurrentResult(),()=>l.getCurrentResult()),_.useEffect(()=>{l.setOptions(o)},[o,l]),it(o,u))throw L(o,l,i);if(nt({result:u,errorResetBoundary:i,throwOnError:o.throwOnError,query:s,suspense:o.suspense}))throw u.error;return o.notifyOnChangeProps?u:l.trackResult(u)}function st(e,t){return ot(e,Fe,t)}var ct=_.useLayoutEffect;function lt(e){return e[e.length-1]}function ut(e,t){return typeof e==`function`?e(t):e}var dt=Object.prototype.hasOwnProperty;function ft(e){for(let t in e)if(dt.call(e,t))return!0;return!1}var pt=()=>Object.create(null),mt=(e,t)=>ht(e,t,!0);function ht(e,t,n,r=0){if(e===t)return e;if(r++>500)return t;let i=Array.isArray(e)&&Array.isArray(t);if(!i&&!(gt(e)&>(t)))return t;let a=Object.keys(e),o=a.length,s=Object.keys(t),c=s.length;if(i?o!==e.length||c!==t.length||o&<(a)!==`${o-1}`||c&<(s)!==`${c-1}`:o!==Object.getOwnPropertyNames(e).length||c!==Object.getOwnPropertyNames(t).length||Object.getOwnPropertySymbols(t).length)return t;let l=0,u,d,f;if(i){for(;l<c&&(f=l,d=e[f],u=t[f],u=d===u?d:typeof d==`object`?ht(d,u,n,r):u,u===d);l++);if(l===c&&o===c)return e}else{let i=o===c,p=!0;for(;l<c;l++){f=s[l],d=e[f];let o=t[f];u=d===o?d:typeof d==`object`?ht(d,o,n,r):o,i&&=u===d&&(a[l]===f||dt.call(e,f)),p&&=Object.is(u,o),a[l]=u}if(i)return Object.getOwnPropertySymbols(e).length?t:e;if(p)return t}let p=i?s.fill(0):n?pt():{};for(let o=0;o<c;o++)f=i?o:s[o],i?(d=e[f],o>l&&(u=t[f],u=d===u?d:typeof d==`object`?ht(d,u,n,r):u),p[f]=o<l?d:u):p[f]=a[o];return p}function gt(e){return!e||typeof e!=`object`?!1:(Object.getPrototypeOf(e)?.constructor??Object)===Object}function _t(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 i=0,a=e.length;i<a;i++){let a=e[i],o=t[i];if(a!==o&&!_t(a,o,n,r))return!1}return!0}if(gt(e)&>(t)){if(n){for(let i in t)if((r||t[i]!==void 0)&&!_t(e[i],t[i],n,r))return!1;return!0}let i=0;if(r)i=Object.keys(e).length;else for(let t in e)e[t]!==void 0&&i++;for(let a in t)if((r||t[a]!==void 0)&&(i--===0||!_t(e[a],t[a],n,r)))return!1;return i===0}return!1}var vt=/[\x00-\x1f\x7f"<>`{}]/g;function yt(e){return e.replace(vt,e=>`%`+e.charCodeAt(0).toString(16).toUpperCase().padStart(2,`0`))}function bt(e){let t;try{t=decodeURI(e)}catch{t=e.replaceAll(/%[0-9A-F]{2}/gi,e=>{try{return decodeURI(e)}catch{return e}})}return yt(t)}var xt=[`http:`,`https:`,`mailto:`,`tel:`];function St(e){if(e[0]!==`/`&&e.includes(`:`))return/^[\x00-\x20]*([a-z][a-z\d+.\t\n\r-]*:)/i.exec(e)?.[1]?.replace(/[\t\n\r]/g,``).toLowerCase()}var Ct=/^[\x00-\x20]*[\\/][\t\n\r]*[\\/]/;function wt(e,t){if(!e)return!1;if(Ct.test(e))return!0;let n=St(e);return n?!t.has(n):!1}function Tt(e){if(!e)return e;let t=e;if(/[%\\\x00-\x1f\x7f]/.test(e)){let n=/%25|%5C/gi,r=0,i;for(t=``;(i=n.exec(e))!==null;)t+=bt(e.slice(r,i.index))+i[0],r=n.lastIndex;t+=bt(r?e.slice(r):e)}return t}function Et(e){return/[\s\u0080-\uFFFF]/.test(e)?e.replace(/\s|[^\u0000-\u007F]/gu,encodeURIComponent):e}function Dt(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 Ot(){throw Error(`Invariant failed`)}function kt(e){return e.replace(/\/{2,}/g,`/`)}function At(e){return e===`/`?e:e.replace(/^\/+/,``)}function jt(e){let t=e.length;return t>1&&e[t-1]===`/`?e.replace(/\/+$/,``):e}function Mt(e){return jt(At(e))}function Nt(e,t){return e?.endsWith(`/`)&&e!==`/`&&e!==`${t}/`?e.slice(0,-1):e}function Pt(e,t,n=`never`,r){if(t.includes(`//`)&&(t=kt(t)),t.startsWith(`/`))return t.length===1||n===`preserve`?t:n===`always`?t.endsWith(`/`)?t:`${t}/`:t.endsWith(`/`)?t.slice(0,-1):t;let i=t===`.`,a;if(r){a=i?e:e+`\0`+t;let n=r.get(a);if(n)return n}let o;if(i)o=e.split(`/`);else{for(e.includes(`//`)&&(e=kt(e)),o=e.split(`/`);o.length>1&<(o)===``;)o.pop();let n=t.split(`/`);for(let e=0,t=n.length;e<t;e++){let r=n[e];r===``?e?e===t-1&&o.push(r):o=[r]:r===`..`?o.length>1?o.pop():o=[``]:r===`.`||o.push(r)}}o.length>1&&(lt(o)===``?n===`never`&&o.pop():n===`always`&&o.push(``));let s=o.join(`/`),c=(i?kt(s):s)||`/`;return a&&r&&r.set(a,c),c}function Ft(e){let t=new Map(e.map(e=>[encodeURIComponent(e),e])),n=new RegExp([...t.keys()].join(`|`).replace(/[.*()]/g,`\\$&`),`g`);return e=>e.replace(n,e=>t.get(e)??e)}function It(e){return e==null||e===``}function Lt(e,t,n){if(typeof t!=`string`)return``+(t??void 0);let r=e===`_splat`;if(r&&(!t||/^[a-zA-Z0-9\-._~!/]*$/.test(t)))return t;let i=encodeURIComponent(t);return r&&(i=i.replaceAll(`%2F`,`/`)),n?n(i):i}function Rt(e,t,n,r,i){let a=e.endsWith(`/`)?`/`:``,o=``;for(let e of t){if(typeof e==`string`){o+=e;continue}let[t,s,c,l]=e,u=t===2,d=u&&l!==void 0?l+a:l,f=n[s];if(t!==3||f!=null){if(i&&(i[s]=f,u&&(i[`*`]=f)),u&&It(f)){if(c===`/`&&!d)continue;f=``}o+=c+Lt(s,f,r)+(d||``)}}return o+a||`/`}function zt(e={}){if(e.isNotFound=!0,e.throw)throw e;return e}function Bt(e){return e?.isNotFound===!0}function Vt(){try{return sessionStorage}catch{return}}var Ht=`tsr-scroll-restoration-v1_3`,Ut=Vt();function R(){try{return JSON.parse(Ut?.getItem(`tsr-scroll-restoration-v1_3`)||`{}`)}catch{return{}}}function Wt(){try{Ut?.setItem(Ht,JSON.stringify(Gt))}catch{}}var Gt=R(),Kt=`data-scroll-restoration-id`,qt=e=>e.state.__TSR_key||e.href;function Jt(e){let t=e.getAttribute(Kt);if(t)return`[${Kt}="${t}"]`;let n=``,r=e,i;for(;i=r.parentNode;){let e=1,t=r;for(;t=t.previousElementSibling;)e++;let a=`${r.localName}:nth-child(${e})`;n=n?`${a} > ${n}`:a,r=i}return n}var Yt=!1,Xt=`window`;function Zt(e){try{return typeof e==`function`?e():document.querySelector(e)}catch{}}function Qt(e){let t=new Set;for(let n of e){if(n===Xt)continue;let e=Zt(n);e&&t.add(e)}return t}function $t(e,t){let n=t??e.options.scrollRestoration,r=e._scroll;n&&(r.restoring=!0);let i=e.options.getScrollRestorationKey||qt,a=new Set,o=e=>{let t=Gt[e]||={};for(let e of a)e===document?t[Xt]={scrollX,scrollY}:e.isConnected&&(t[Jt(e)]={scrollX:e.scrollLeft,scrollY:e.scrollTop})};n&&!r.restoration&&(r.restoration=!0,Yt=!1,history.scrollRestoration=`manual`,document.addEventListener(`scroll`,e=>{Yt||a.add(e.target)},!0),e.subscribe(`onBeforeLoad`,e=>{e.fromLocation&&o(i(e.fromLocation)),a.clear()}),addEventListener(`pagehide`,()=>{o(i(e.stores.resolvedLocation.get()??e.stores.location.get())),Wt()})),!r.reset&&(r.reset=!0,e.subscribe(`onRendered`,t=>{let n=e.options.scrollRestorationBehavior,o=e.options.scrollToTopSelectors,s=r.next,c=r.hash,l;if(a.clear(),r.next=!0,r.hash=!1,typeof e.options.scrollRestoration==`function`&&!e.options.scrollRestoration({location:e.latestLocation}))return;let u=i(t.toLocation),d=t.fromLocation&&i(t.fromLocation);if(r.restoring&&d&&d!==u){let e=Gt[d];if(e){let t=Gt[u];for(let n in e){if(n===Xt){if(s)continue}else{let e=Zt(n);if(!e||s&&o&&(l??=Qt(o),l.has(e)))continue}t||=Gt[u]={},t[n]??=e[n]}}}Yt=!0;try{let e=t.toLocation.hash,i=t.toLocation.state.__hashScrollIntoViewOptions??!0,a=!1;if(s){!e&&o&&(l??=Qt(o));let t=e&&i&&c,s=r.restoring?Gt[u]:void 0;if(s)for(let e in s){let{scrollX:r,scrollY:i}=s[e];if(e===Xt){if(t)continue;scrollTo({top:i,left:r,behavior:n}),a=!0}else{let t=Zt(e);t&&(t.scrollLeft=r,t.scrollTop=i,l?.delete(t))}}if(!e){let e={top:0,left:0,behavior:n};if(a||scrollTo(e),l)for(let t of l)t.scrollTo(e)}}!a&&e&&i&&document.getElementById(e)?.scrollIntoView(i)}finally{Yt=!1}}))}function en(e,t=String){let n;for(let r in e){let i=e[r];i!==void 0&&(n||=new URLSearchParams).set(r,t(i))}return n?n.toString():``}function tn(e){return e?e===`false`?!1:e===`true`?!0:e*0==0&&+e+``===e?+e:e:``}function nn(e){let t=new URLSearchParams(e),n=Object.create(null);for(let[e,r]of t.entries()){let t=n[e];t==null?n[e]=tn(r):Array.isArray(t)?t.push(tn(r)):n[e]=[t,tn(r)]}return n}var rn=/^(?:\s|["[{\d-]|fa|nu|tr)/,an=sn(JSON.parse),on=cn(JSON.stringify,JSON.parse);function sn(e){let t=e===JSON.parse;return n=>{n[0]===`?`&&(n=n.substring(1));let r=nn(n);for(let n in r){let i=r[n];if(typeof i==`string`){if(t&&!rn.test(i))continue;try{r[n]=e(i)}catch{}}}return r}}function cn(e,t){let n=t===JSON.parse;function r(r){if(r&&typeof r==`object`)try{return e(r)}catch{}else if(t&&typeof r==`string`){if(n&&!rn.test(r))return r;try{return t(r),e(r)}catch{}}return r}return e=>{let t=en(e,r);return t?`?${t}`:``}}var ln=`__root__`;function un(e){e.statusCode=e.statusCode||e.code||307;let t=new Headers(e.headers);e.href&&t.get(`Location`)===null&&t.set(`Location`,e.href);let n=new Response(null,{status:e.statusCode,headers:t});if(n.options=e,e.throw)throw n;return n}function dn(e){return e instanceof Response&&!!e.options}function fn(e){let t=new Map,n,r;return{get(e){let n=t.get(e);if(n)return n.visited=!0,n.value},set(i,a){let o=t.get(i);if(o){o.value=a;return}if(t.size>=e){let e=n?.next().value;for(;!e||e.visited;)e?e.visited=!1:n=t.values(),e=n.next().value;e===r&&(n=void 0),t.delete(e.key)}let s={key:i,value:a,visited:!1};r=s,t.set(i,s)},clear(){t.clear(),n=void 0,r=void 0}}}var pn=4,mn=5;function hn(e){let t=e.names;if(t)return t;let n=[];for(let t of e)typeof t!=`string`&&n.push(t[1]);return e.names=n}function gn(e,t,n){let r=e.substring(t,n);if(r.charCodeAt(0)===36)return r.length===1?[2,`_splat`,``,void 0]:[1,r.substring(1),``,``];let i=r.indexOf(`{`);if(i>=0){let a=r.indexOf(`}`,i),o=r.charCodeAt(i+1)===45,s=i+(o?3:2);if(a>=0&&r.charCodeAt(s-1)===36&&(!o||s<a)){let c=r.substring(s,a);return[o?3:c?1:2,c||`_splat`,r.substring(0,i),e.substring(t+a+1,c?n:e.length)]}}return r}function _n(e,t,n,r,i,a){let o=n,s=t.fullPath??t.from,c=t.options,l=s.length,u=s.endsWith(`/`)?l-1:l,d=c?.caseSensitive??e,f=c?.params?.parse??c?.parseParams,p,m=a?n-1:0;if(!r||s.includes(`$`)){p=a?.slice()??[];let e=lt(p);e&&typeof e!=`string`&&e[0]===2&&(p[p.length-1]=[e[0],e[1],e[2],e[3]===void 0?void 0:e[3]+s.substring(n-(s[n-2]===`/`?2:1),u)],m=l)}for(;o<l;){let e=o,t=s.indexOf(`/`,e),n=t===-1?l:t,a=gn(s,e,n);o=n+1;let c;if(typeof a==`string`){if(!r)continue;let e=a,t;d?t=r.static??=new Map:(e=a.toLowerCase(),t=r.staticInsensitive??=new Map);let n=t.get(e);if(n)c=n;else{let n=yn(r);c=n,t.set(e,n)}}else{let t=a[0],h=a[2],g=a[3]??``;if(t===2&&(n=l,o=n+1),p&&m<n&&(m<e-1&&p.push(s.substring(m,e-1)),a[2]=`/`+h,t===2&&a[3]!==void 0&&u<l&&(a[3]=g.slice(0,-1)),p.push(a),m=n),!r)continue;let _=d&&!!(h||g);d||(h=h.toLowerCase(),g=g.toLowerCase());let v=t===1?r.dynamic??=[]:t===3?r.optional??=[]:r.wildcard??=[],y=t!==2&&!f&&v.find(e=>!e.parse&&e.caseSensitive===_&&e.prefix===h&&e.suffix===g);if(y)c=y;else{let e=yn(r,t,_,h,g);c=e,v.push(e),v.length===2&&i?.push(v)}}r=c}p&&m<u&&p.push(s.substring(m,u));let h=p?.slice();if(!r)return h;if(f&&t.children&&!t.isRoot&&t.id&&t.id.charCodeAt(t.id.lastIndexOf(`/`)+1)===95){let e=yn(r,mn);(r.pathless??=[]).push(e),r=e}let g=(t.path||!t.children)&&!t.isRoot;if(g&&u<l){let e=yn(r,pn);r.index=e,r=e}return r.parse=f??null,r.priority=c?.params?.priority??0,r.route||(r.data=h,g&&(r.route=t)),[r,o,h]}function vn(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 yn(e,t=0,n,r,i){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:i}}function bn(e,t){let n=yn(),r=[];function i(e,t,n,a){let[o,s,c]=_n(!1,e,t,n,r,a);if(e.children)for(let t of e.children)i(t,s,o,c)}for(let t of e)i(t,1,n);for(let e of r)e.sort(vn);t.masksTree=n,t.flatCache=fn(1e3)}function xn(e,t){e||=`/`;let n=t.flatCache.get(e);if(n!==void 0)return n;let r=Tn(e,t.masksTree);return t.flatCache.set(e,r),r}function Sn(e,t,n,r,i){e||=`/`,r||=`/`;let a=t?`case\0${e}`:e,o=i.singleCache.get(a);return o||(o=yn(),_n(t,{from:e},1,o),i.singleCache.set(a,o)),Tn(r,o,n)}function Cn(e,t,n=!1){let r=n?e:`nofuzz\0${e}`,i=t.matchCache.get(r);if(i!==void 0)return i;e||=`/`;let a;try{a=Tn(e,t.segmentTree,n)}catch(e){if(e instanceof URIError)a=null;else throw e}return a&&(a.branch=Dn(a.route)),t.matchCache.set(r,a),a}function wn(e,t=!1){let n=yn(),r=[],i={},a={},o=0;function s(e,n,c,l){if(e.init(o),e.id in i&&Ot(),i[e.id]=e,o!==0&&e.path){let t=jt(e.fullPath);(!a[t]||e.fullPath.endsWith(`/`))&&(a[t]=e)}o++;let[u,d,f]=_n(t,e,n,c,r,l);if(e._interpolation=f,e.children)for(let t of e.children)s(t,d,u,f)}s(e,1,n);for(let e of r)e.sort(vn);return{processedTree:{segmentTree:n,singleCache:fn(1e3),matchCache:fn(1e3),flatCache:null,masksTree:null},routesById:i,routesByPath:a}}function Tn(e,t,n=!1){let r=e.split(`/`),i=kn(e,r,t,n);if(!i)return null;let[a]=En(e,r,i);return{route:i.node.route,rawParams:a}}function En(e,t,n){let r=On(n.node),i=n.node.data&&hn(n.node.data),a=Object.create(null),o=n.extract?.part??0,s=n.extract?.node??0,c=n.extract?.path??0,l=n.extract?.param??0;for(;s<r.length;o++,s++,c++){let u=r[s];if(u.kind===pn)break;if(u.kind===mn){o--,c--;continue}let d=t[o],f=c;if(d&&(c+=d.length),u.kind===1||u.kind===3){let e=i[l++];if(u.kind===3&&n.skipped&1<<s){o--,c=f-1;continue}let t=u.suffix||u.prefix?d.substring(u.prefix.length,d.length-u.suffix.length):d;(t||u.kind===1)&&(a[e]=decodeURIComponent(t))}else if(u.kind===2){let t=u,n=e.substring(f+t.prefix.length,e.length-t.suffix.length),r=decodeURIComponent(n);a[`*`]=r,a._splat=r;break}}return n.rawParams&&Object.assign(a,n.rawParams),[a,{part:o,node:s,path:c,param:l}]}function Dn(e){let t=[e];for(;e.parentRoute;)e=e.parentRoute,t.push(e);return t.reverse(),t}function On(e){let t=Array(e.depth+1);do t[e.depth]=e,e=e.parent;while(e);return t}function kn(e,t,n,r){if(e===`/`&&n.index)return{node:n.index,skipped:0};let i=!lt(t),a=i&&e!==`/`,o=t.length-+!!i,s=[{node:n,index:1,skipped:0,statics:0,dynamics:0,optionals:0}],c=null,l=null;for(;s.length;){let n=s.pop(),{node:i,index:u,skipped:d,statics:f,dynamics:p,optionals:m}=n,{extract:h,rawParams:g}=n;if(i.kind===2&&i.route&&!Nn(l,n))continue;if(i.parse){if(!Mn(e,t,n))continue;g=n.rawParams,h=n.extract}r&&i.route&&i.kind!==pn&&Nn(c,n)&&(c=n);let _=u===o;if(_&&(i.route&&(!a||i.kind===pn||i.kind===2)&&Nn(l,n)&&(l=n),!i.optional&&!i.wildcard&&!i.index&&!i.pathless))continue;let v=_?void 0:t[u],y;if(_&&i.index){let n={node:i.index,index:u,skipped:d,statics:f,dynamics:p,optionals:m,extract:h,rawParams:g},r=!0;if(i.index.parse&&(Mn(e,t,n)||(r=!1)),r){if(!p&&!m&&!d&&jn(f,o))return n;Nn(l,n)&&(l=n)}}if(i.wildcard)for(let e=i.wildcard.length-1;e>=0;e--){let n=i.wildcard[e],{prefix:r,suffix:a}=n;if(!r||!_&&(n.caseSensitive?v:y??=v.toLowerCase()).startsWith(r)){if(a){if(_)continue;let e=t.slice(u).join(`/`),i=e.slice(-a.length);if((n.caseSensitive?i:i.toLowerCase())!==a||e.length-a.length<r.length)continue}s.push({node:n,index:o,skipped:d,statics:f,dynamics:p,optionals:m,extract:h,rawParams:g})}}if(i.optional){let e=d|1<<i.depth+1;for(let t=i.optional.length-1;t>=0;t--){let n=i.optional[t];s.push({node:n,index:u,skipped:e,statics:f,dynamics:p,optionals:m,extract:h,rawParams:g})}if(!_)for(let e=i.optional.length-1;e>=0;e--){let t=i.optional[e],{prefix:n,suffix:r}=t;if(n||r){let e=t.caseSensitive?v:y??=v.toLowerCase();if(n&&!e.startsWith(n)||r&&e.indexOf(r,e.length-r.length)<n.length)continue}s.push({node:t,index:u+1,skipped:d,statics:f,dynamics:p,optionals:m+An(o,u),extract:h,rawParams:g})}}if(!_&&i.dynamic&&v)for(let e=i.dynamic.length-1;e>=0;e--){let t=i.dynamic[e],{prefix:n,suffix:r}=t;if(n||r){let e=t.caseSensitive?v:y??=v.toLowerCase();if(n&&!e.startsWith(n)||r&&e.indexOf(r,e.length-r.length)<n.length)continue}s.push({node:t,index:u+1,skipped:d,statics:f,dynamics:p+An(o,u),optionals:m,extract:h,rawParams:g})}if(!_&&i.staticInsensitive){let e=i.staticInsensitive.get(y??=v.toLowerCase());e&&s.push({node:e,index:u+1,skipped:d,statics:f+An(o,u),dynamics:p,optionals:m,extract:h,rawParams:g})}if(!_&&i.static){let e=i.static.get(v);e&&s.push({node:e,index:u+1,skipped:d,statics:f+An(o,u),dynamics:p,optionals:m,extract:h,rawParams:g})}if(i.pathless)for(let e=i.pathless.length-1;e>=0;e--){let t=i.pathless[e];s.push({node:t,index:u,skipped:d,statics:f,dynamics:p,optionals:m,extract:h,rawParams:g})}}if(l)return l;if(r&&c){let n=c.index;for(let e=0;e<c.index;e++)n+=t[e].length;let r=n===e.length?`/`:e.slice(n);return c.rawParams??=Object.create(null),c.rawParams[`**`]=decodeURIComponent(r),c}return null}function An(e,t){return 2**(e-t-1)}function jn(e,t){return e===2**(t-1)-1}function Mn(e,t,n){let r,i;try{[r,i]=En(e,t,n)}catch{return null}if(n.rawParams=r,n.extract=i,!n.node.parse)return!0;try{if(n.node.parse(r)===!1)return null}catch{}return!0}function Nn(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===pn)>(e.node.kind===pn)||t.node.kind===pn==(e.node.kind===pn)&&t.node.depth>e.node.depth)))}function Pn(e,t,n){let r=Mt(e),i=`/${r}`,a=t?i:i.toLowerCase(),o=`${a}/`,s={input:({url:e})=>{let n=t?e.pathname:e.pathname.toLowerCase();return n===a?e.pathname=`/`:n.startsWith(o)&&(e.pathname=e.pathname.slice(i.length)),e},output:({url:e})=>(e.pathname=kt(`/${r}${e.pathname}`),e)};return n?{input:({url:e})=>Fn(n,s.input({url:e})),output:({url:e})=>s.output({url:In(n,e)})}:s}function Fn(e,t){let n=e?.input?.({url:t});if(n){if(typeof n==`string`)return new URL(n);if(n instanceof URL)return n}return t}function In(e,t){let n=e?.output?.({url:t});if(n){if(typeof n==`string`)return new URL(n);if(n instanceof URL)return n}return t}function Ln(e,t){let{createMutableStore:n,createReadonlyStore:r,batch:i}=t,a=new Map,o=n(`idle`),s=n(e),c=n(void 0),l=n([]),u=r(()=>l.get().map(e=>a.get(e).get())),d=r(()=>({status:o.get(),isLoading:o.get()===`pending`,matches:u.get(),location:s.get(),resolvedLocation:c.get()}));function f(e){let t=a.get(e);return t||(t=n(void 0),a.set(e,t)),t}let p={status:o,location:s,resolvedLocation:c,ids:l,matches:u,byRoute:a,__store:d,getMatchStore:f,setMatches:m};function m(e){let t=l.get(),n=e.map(e=>e.routeId);i(()=>{Dt(t,n)||l.set(n);for(let e of t)n.includes(e)||a.get(e).set(()=>void 0);for(let t of e){let e=f(t.routeId);e.get()!==t&&e.set(t)}})}return p}var Rn=`__TSR_index`,zn=`popstate`,Bn=`beforeunload`,Vn=/^[\x00-\x20]*(?:[\\/][\t\n\r]*){2,}/;function Hn(e){let t=Vn.exec(e);return t?`/`+e.slice(t[0].length):e}function Un(e){return/[\x00-\x1f\x7f]/.test(e)&&(e=e.replace(/[\x00-\x1f\x7f]/g,e=>`
|
|
10
|
+
\r`.includes(e)?``:encodeURIComponent(e))),Hn(e)}function Wn(e){let t=e.getLocation(),n=new Set,r=r=>{t=e.getLocation(),n.forEach(e=>e({location:t,action:r}))},i=n=>{e.notifyOnIndexChange??!0?r(n):t=e.getLocation()},a=async({task:n,navigateOpts:r,...i})=>{if(r?.ignoreBlocker??!1){n();return}let a=e.getBlockers?.()??[],o=i.type===`PUSH`||i.type===`REPLACE`;if(typeof document<`u`&&a.length&&o)for(let n of a){let r=qn(i.path,i.state);if(await n.blockerFn({currentLocation:t,nextLocation:r,action:i.type})){e.onBlocked?.();return}}n()};return{get location(){return t},get length(){return e.getLength()},subscribers:n,subscribe:e=>(n.add(e),()=>{n.delete(e)}),push:(n,i,o)=>{let s=t.state[Rn];i=Gn(s+1,i),a({task:()=>{e.pushState(n,i),r({type:`PUSH`})},navigateOpts:o,type:`PUSH`,path:n,state:i})},replace:(n,i,o)=>{let s=t.state[Rn];i=Gn(s,i),a({task:()=>{e.replaceState(n,i),r({type:`REPLACE`})},navigateOpts:o,type:`REPLACE`,path:n,state:i})},go:(t,n)=>{a({task:()=>{e.go(t,n?.ignoreBlocker??!1),i({type:`GO`,index:t})},navigateOpts:n,type:`GO`})},back:t=>{a({task:()=>{e.back(t?.ignoreBlocker??!1),i({type:`BACK`})},navigateOpts:t,type:`BACK`})},forward:t=>{a({task:()=>{e.forward(t?.ignoreBlocker??!1),i({type:`FORWARD`})},navigateOpts:t,type:`FORWARD`})},canGoBack:()=>t.state[Rn]!==0,createHref:t=>e.createHref(t),block:t=>{if(!e.setBlockers)return()=>{};let n=e.getBlockers?.()??[];return e.setBlockers([...n,t]),()=>{let n=e.getBlockers?.()??[];e.setBlockers?.(n.filter(e=>e!==t))}},flush:()=>e.flush?.(),destroy:()=>e.destroy?.(),notify:r,_getBlockers:()=>e.getBlockers?.()??[]}}function Gn(e,t){let n=Jn();return{...t,key:n,__TSR_key:n,[Rn]:e}}function Kn(e){let t=e?.window??(typeof document<`u`?window:void 0),n=t.history.pushState,r=t.history.replaceState,i=[],a=()=>i,o=e=>i=e,s=t=>Un(e?.createHref?e.createHref(t):t),c=e?.parseLocation??(()=>qn(`${t.location.pathname}${t.location.search}${t.location.hash}`,t.history.state));if(!t.history.state?.__TSR_key&&!t.history.state?.key){let e=Jn();t.history.replaceState({[Rn]:0,key:e,__TSR_key:e},``)}let l=c(),u,d=!1,f=!1,p=!1,m=!1,h=()=>l,g,_=()=>{g&&(S._ignoreSubscribers=!0,(g[2]?t.history.pushState:t.history.replaceState)(g[1],``,g[0]),S._ignoreSubscribers=!1,g=void 0,u=void 0)},v=(t,n,r)=>{let i=e?.createHref?s(n):void 0,a=!!g;a||(u=l),l=qn(n,r),g=[i??l.href,r,g?.[2]||t],a||queueMicrotask(()=>_())},y=e=>{l=c(),S.notify({type:e})},b=async()=>{if(m=!1,f){f=!1;return}let e=c(),n=e.state[Rn]-l.state[Rn],r=n===1,i=n===-1,o=!r&&!i||d;d=!1;let s=o?`GO`:i?`BACK`:`FORWARD`,u=o?{type:`GO`,index:n}:{type:i?`BACK`:`FORWARD`};if(p)p=!1;else{let r=a();if(typeof document<`u`&&r.length){for(let i of r)if(await i.blockerFn({currentLocation:l,nextLocation:e,action:s})){f=!0,t.history.go(-n),S.notify(u);return}}}l=c(),S.notify(u)},x=e=>{if(m){m=!1;return}let t=!1,n=a();if(typeof document<`u`&&n.length)for(let e of n){let n=e.enableBeforeUnload??!0;if(n===!0){t=!0;break}if(typeof n==`function`&&n()===!0){t=!0;break}}if(t)return e.preventDefault(),e.returnValue=``},S=Wn({getLocation:h,getLength:()=>t.history.length,pushState:(e,t)=>v(!0,e,t),replaceState:(e,t)=>v(!1,e,t),back:e=>(e&&(p=!0,m=!0),t.history.back()),forward:e=>{e&&(p=!0,m=!0),t.history.forward()},go:(e,n)=>{d=!0,n&&(p=!0,m=!0),t.history.go(e)},createHref:e=>s(e),flush:_,destroy:()=>{t.history.pushState=n,t.history.replaceState=r,t.removeEventListener(Bn,x,{capture:!0}),t.removeEventListener(zn,b)},onBlocked:()=>{u&&l!==u&&(l=u)},getBlockers:a,setBlockers:o,notifyOnIndexChange:!1});return S._ignoreNextBeforeUnload=e=>{m=!1;try{e=new URL(e,t.document.baseURI).href,m=/^https?:/.test(e)&&(!e.includes(`#`)||e.split(`#`)[0]!==t.location.href.split(`#`)[0])}catch{}},t.addEventListener(Bn,x,{capture:!0}),t.addEventListener(zn,b),t.history.pushState=function(...e){let r=n.apply(t.history,e);return S._ignoreSubscribers||y(`PUSH`),r},t.history.replaceState=function(...e){let n=r.apply(t.history,e);return S._ignoreSubscribers||y(`REPLACE`),n},S}function qn(e,t){let n=Un(e),r=n.indexOf(`#`),i=n.indexOf(`?`);if(!t){let e=Jn();t={[Rn]:0,key:e,__TSR_key:e}}return{href:n,pathname:n.substring(0,r>0?i>0?Math.min(r,i):r:i>0?i:n.length),hash:r>-1?n.substring(r):``,search:i>-1?n.slice(i,r===-1?void 0:r):``,state:t}}function Jn(){return(Math.random()+1).toString(36).substring(7)}function Yn(e,t){return e.protocol!==`http:`&&e.protocol!==`https:`||e.origin!==t||!!e.username||!!e.password}function Xn(e){return e.pathname+e.search+e.hash}function Zn(e){return e.options.loader||e.options.beforeLoad||e.lazyFn||e.options.component?.preload||e.options.pendingComponent?.preload}function Qn(e,t){return{fromLocation:t,toLocation:e,pathChanged:t?.pathname!==e.pathname,hrefChanged:t?.href!==e.href,hashChanged:t?.hash!==e.hash}}function $n({key:e,__TSR_key:t,__TSR_index:n,__hashScrollIntoViewOptions:r,...i}){return i}function er(e){return e.findIndex(e=>e.status===`error`||e.status===`notFound`||e._notFound)+1}function tr(e,t,n,r,i,a){r&&(t=t.slice(0,r)),i&&(n=n.slice(0,i));for(let r of t){if(a&&e._tx!==a)return;n.some(e=>e.routeId===r.routeId)||e.routesById[r.routeId].options.onLeave?.(r)}for(let r of n){if(a&&e._tx!==a)return;e.routesById[r.routeId].options[t.some(e=>e.routeId===r.routeId)?`onStay`:`onEnter`]?.(r)}}var nr=class{constructor(e,t){this.tempLocationKey=`${Math.round(Math.random()*1e7)}`,this._scroll={next:!0},this.subscribers=new Set,this._cache=new Map,this._committed=[],this.startTransition=async e=>(e(),!1),this.update=e=>{let t=this.options;this.options={...t,...e},this.isServer=this.options.isServer??!1??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.history=this.options.history?this.options.history:Kn()),this.origin=this.options.origin,this.origin||=window?.origin&&window.origin!==`null`?window.origin:`http://localhost`;let n=this.options.basepath??`/`,r=this.options.rewrite,i=this.basepath!==n||t?.rewrite!==r||t?.caseSensitive!==this.options.caseSensitive;if(i&&(this.basepath=n,this.rewrite=n!==`/`&&Mt(n)?Pn(n,this.options.caseSensitive,r):r),this.history&&this.updateLatestLocation(),this.options.routeTree!==this.routeTree){this.routeTree=this.options.routeTree;let e;e=this.buildRouteTree(),this.setRoutes(e)}if(this.stores)i&&this.stores.location.set(this.latestLocation);else if(this.latestLocation){let e=this.getStoreConfig(this);this.batch=e.batch,this.stores=Ln(this.latestLocation,e),$t(this)}},this.updateLatestLocation=()=>{this.latestLocation=this.parseLocation(this.history.location,this.latestLocation)},this.buildRouteTree=()=>{let e=wn(this.routeTree,this.options.caseSensitive);return this.options.routeMasks&&bn(this.options.routeMasks,e.processedTree),{...e,resolvePathCache:fn(1e3)}},this.subscribe=(e,t)=>{let n={eventType:e,fn:t};return this.subscribers.add(n),()=>{this.subscribers.delete(n)}},this.emit=e=>{for(let t of this.subscribers)if(t.eventType===e.type)try{t.fn(e)}catch(e){console.error(e)}},this.parseLocation=(e,t)=>{let n=({pathname:e,search:n,hash:r,href:i},a)=>{if(!this.rewrite&&!/[ \x00-\x1f\x7f\u0080-\uffff]/.test(e)){let i=this.options.parseSearch(n),o=this.options.stringifySearch(i);return{href:e+o+r,publicHref:e+o+r,pathname:Tt(e),external:!1,searchStr:o,search:mt(t?.search,i),hash:Tt(r.slice(1)),state:ht(t?.state,a)}}let o=Fn(this.rewrite,new URL(i,this.origin)),s=this.options.parseSearch(o.search),c=this.options.stringifySearch(s);return o.search=c,{href:o.href.replace(o.origin,``),publicHref:i,pathname:Tt(Hn(o.pathname)),external:!!this.rewrite&&Yn(o,this.origin),searchStr:c,search:mt(t?.search,s),hash:Tt(o.hash.slice(1)),state:ht(t?.state,a)}},r=n(e,e.state),{__tempLocation:i,__tempKey:a}=r.state;if(i&&(!a||a===this.tempLocationKey)){let e=n(i,{...i.state,__tempLocation:void 0,key:r.state.key,__TSR_key:r.state.__TSR_key});return e.maskedLocation=r,e}return r},this.matchRoutes=(e,t,n)=>typeof e==`string`?this.matchRoutesInternal({pathname:e,search:t},n):this.matchRoutesInternal(e,t),this.getMatchedRoutes=e=>{let t=Object.create(null),n=Cn(jt(e),this.processedTree,!0);return n&&Object.assign(t,n.rawParams),[n?.branch||[this.routesById.__root__],t,n?.route]},this.buildLocation=e=>{{let t=this.staticLocations.get(e);if(t)return t}let t=!1,n=(n={})=>{if(n.href){let e=qn(n.href,{});n={...n,to:Fn(this.rewrite,new URL(e.pathname,this.origin)).pathname,search:this.options.parseSearch(e.search),hash:e.hash.slice(1)}}let r=n._fromLocation||this._pendingLocation||this.latestLocation,i,a=()=>(t=!0,r),o=()=>(t=!0,i??=this.matchRoutesLightweight(r)),s=n.to?`${n.to}`:`.`,c=Pt(s[0]===`/`?``:n.unsafeRelative===`path`?a().pathname:n.from??o()[1],s,this.options.trailingSlash,this.resolvePathCache),l=this.routesByPath[jt(c)],u=c.includes(`$`),d;if(l)d=l._branch??=Dn(l);else if(u)d=[];else{let[e,t,n]=this.getMatchedRoutes(c);d=e,this.options.notFoundRoute&&(!n||n.path!==`/`&&t[`**`])&&(d=[...d,this.options.notFoundRoute])}let f=u?l?._interpolation??_n(!1,{fullPath:c},0):void 0,p;for(let e of d){let t=e.options.params?.stringify??e.options.stringifyParams;if(t){let e=o()[3];if(p??=sr(n.params,e),!ft(p))break;p===e&&(p=Object.assign(pt(),p));try{Object.assign(p,t(p))}catch{}}}p??=sr(n.params,cr(n.params,f)?o()[3]:lr);let m=e.leaveParams?c:Hn(Tt(f?Rt(c,f,p,this.pathParamsDecoder):c)),h=ur(d,e._includeValidateSearch),g=()=>{let t=o()[2];if(e._includeValidateSearch&&this.options.search?.strict){let e={};d.forEach(n=>{if(n.options.validateSearch)try{Object.assign(e,or(n.options.validateSearch,{...e,...t}))}catch{}}),t=e}return t},_=h.length?dr(h,g(),n):n.search===!0?g():typeof n.search==`function`?n.search(g()):n.search||lr,v=this.options.stringifySearch(_),y=n.hash===!0?a().hash:typeof n.hash==`function`?n.hash(a().hash):n.hash||void 0,b=y?`#${y}`:``,x=n.state?n.state===!0?a().state:typeof n.state==`function`?n.state(a().state):n.state:lr,S=`${m}${v}${b}`,C,w,T=!1;if(this.rewrite){let e=new URL(S,this.origin),t=e.origin,n=In(this.rewrite,e);C=Xn(e),Yn(n,t)?(w=n.href,T=!0):w=Hn(Xn(n))}else C=Et(S),w=C;return{publicHref:w,href:C,pathname:m,search:_,searchStr:v,state:x,hash:y??``,external:T,unmaskOnReload:n.unmaskOnReload}},r=n(e);if(e.mask)r.maskedLocation=n({from:e.from,...e.mask});else if(this.options.routeMasks){let t=xn(r.pathname,this.processedTree);if(t){let i=Object.assign(pt(),t.rawParams),{from:a,params:o,...s}=t.route,c=sr(o,i);r.maskedLocation=n({from:e.from,...s,params:c})}}return!t&&e._fromLocation&&!r.maskedLocation&&this.staticLocations.set(e,r),r},this.commitLocation=async({viewTransition:e,ignoreBlocker:t,...n})=>{let r=n.maskedLocation??n;if(r.external)return rr(this,r.publicHref,{replace:n.replace,ignoreBlocker:t});let i,a=jt(this.latestLocation.href)===jt(n.href)&&_t($n(n.state),$n(this.latestLocation.state)),o=this._commitPromise,s,c=new Promise(e=>{s=e});if(c.resolve=()=>{s(),o?.resolve()},this._commitPromise=c,a)this.load();else{let{maskedLocation:r,hashScrollIntoView:a,...o}=n;r&&(o={...r,state:{...r.state,__tempKey:void 0,__tempLocation:{...o,search:o.searchStr,state:{...o.state,__tempKey:void 0,__tempLocation:void 0,__TSR_key:void 0,key:void 0}}}},(o.unmaskOnReload??this.options.unmaskOnReload??!1)&&(o.state.__tempKey=this.tempLocationKey)),o.state={...o.state,__hashScrollIntoViewOptions:a??this.options.defaultHashScrollIntoView??!0},this.shouldViewTransition=e,i=n.replace?`REPLACE`:`PUSH`,this.history[i===`REPLACE`?`replace`:`push`](o.publicHref,o.state,{ignoreBlocker:t}),this.history.subscribers.size||this.load({action:{type:i}})}return this._scroll.next=n.resetScroll??!0,this._commitPromise},this.buildAndCommitLocation=({replace:e,resetScroll:t,hashScrollIntoView:n,viewTransition:r,ignoreBlocker:i,...a}={})=>{let o=this.buildLocation({...a,_includeValidateSearch:!0});this._pendingLocation=o;let s=this.commitLocation({...o,viewTransition:r,replace:e,resetScroll:t,hashScrollIntoView:n,ignoreBlocker:i});return queueMicrotask(()=>{this._pendingLocation===o&&(this._pendingLocation=void 0)}),s},this.navigate=async({to:e,reloadDocument:t,href:n,publicHref:r,...i})=>{let a=n?St(n):void 0;if(a||t){if(e!==void 0||!n){let t=this.buildLocation({to:e,...i}),a=t.maskedLocation??t;n??=a.publicHref,r??=a.publicHref}let t=!a&&r?r:n;return rr(this,t,i)}return this.buildAndCommitLocation({...i,href:n,to:e,_isNavigate:!0})},this.load=async e=>{this.updateLatestLocation(),e?.action&&(this._scroll.hash=e.action.type===`PUSH`||e.action.type===`REPLACE`),await ri(this,e)},this.startViewTransition=e=>{let t=this.shouldViewTransition??this.options.defaultViewTransition;if(this.shouldViewTransition=void 0,t&&typeof document.startViewTransition==`function`){let n;if(typeof t==`object`&&window.CSS?.supports?.(`selector(:active-view-transition-type(a))`)){let r=this.latestLocation,i=this.stores.resolvedLocation.get(),a=typeof t.types==`function`?t.types(Qn(r,i)):t.types;if(a===!1)return e();n={update:e,types:a}}else n=e;return document.startViewTransition(n).updateCallbackDone}return e()},this.invalidate=e=>{let t=this._committed,n=e?.filter,r=this._preloads,i=new Set,a=e=>{(!n||n(e))&&i.add(e.id)};t.forEach(a),this._cache.forEach(a),r?.forEach(e=>e.forEach(a)),this._tx?.[3].forEach(a);let o=[];for(let[e,t]of r??[])t.some(e=>i.has(e.id))&&(r.delete(e),o.push(e));let s=t=>{if(i.has(t.id)){let n=this.routesById[t.routeId],r={...t,invalid:!0,...(e?.forcePending||t.status===`error`||t.status===`notFound`)&&Zn(n)?{status:`pending`,error:void 0}:void 0};return t._flight=void 0,r}return t};this._committed=t.map(s);for(let[t,n]of this._cache)i.has(t)&&(n.invalid=!0,e?.forcePending&&(n.status=`pending`));for(let e of i)this._flights?.delete(e);for(let e of o)e.abort();return this.shouldViewTransition=!1,this.load({sync:e?.sync})},this.resolveRedirect=e=>{let t=e.options,n=e.headers.get(`Location`)||t.href;if(!n){let e=this.buildLocation(t);n=(e.maskedLocation??e).publicHref||`/`}let r;if(Ct.test(n)||(r=St(n))&&!this.protocolAllowlist.has(r))throw Error(`Redirect blocked: unsafe protocol`);if(r===`http:`||r===`https:`){let e=new URL(n);e.pathname.startsWith(`//`)?n=e.href:Yn(e,this.origin)||(n=Xn(e),r=void 0)}return r&&(t.reloadDocument=!0),t.href=n,e.headers.set(`Location`,n),e},this.clearCache=e=>{let t=this._cache,n=this._preloads,r=e?.filter,i=[],a=[];for(let[e,n]of t)(!r||r(n))&&(a.push(e),i.push(n));let o=[];for(let[e,t]of n??[])(!r||t.some(r))&&(o.push(e),i.push(...t));for(let e of a)t.delete(e);for(let e of o)n.delete(e);for(let e of i){let t=e._flight;e._flight=void 0,t&&!--t[2]&&(this._flights?.get(e.id)===t&&this._flights.delete(e.id),o.push(t[1]))}for(let e of o)e.abort()},this.loadRouteChunk=gr,this.preloadRoute=e=>ii(this,e),this.matchRoute=(e,t)=>{let n={...e,to:e.to?Pt(e.from||``,e.to,this.options.trailingSlash,this.resolvePathCache):void 0,params:e.params||{},leaveParams:!0},r=this.buildLocation(n),i=this.stores.status.get()===`pending`;if(t?.pending&&!i)return!1;let a=t?.pending??!i?this.latestLocation:this.stores.resolvedLocation.get()||this.stores.location.get(),o=Sn(r.pathname,t?.caseSensitive??!1,t?.fuzzy??!1,a.pathname,this.processedTree);return!o||e.params&&!_t(o.rawParams,e.params,!0)?!1:t?.includeSearch??!0?_t(a.search,r.search,!0)?o.rawParams:!1:o.rawParams},this.getStoreConfig=t,e.pathParamsAllowedCharacters?.length&&(this.pathParamsDecoder=Ft(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??on,parseSearch:e.parseSearch??an,protocolAllowlist:e.protocolAllowlist??xt}),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;let t=this.options.notFoundRoute;t&&(t.init(99999999999),this.routesById[t.id]!==t&&(t._interpolation=_n(!1,t,0)),this.routesById[t.id]=t)}matchRoutesInternal(e,t){let[n,r,i]=this.getMatchedRoutes(e.pathname),a=n,o=!1;(i?i.path!==`/`&&r[`**`]:jt(e.pathname))&&(this.options.notFoundRoute?a=[...a,this.options.notFoundRoute]:o=!0);let s=o?fr(this.options.notFoundMode,a):void 0,c=Array(a.length),l=this._committed,u=(e,t)=>{let n=l[t];return n?.routeId===e.id?n:e===this.options.notFoundRoute?l.find(t=>t.routeId===e.id):void 0},d;for(let n=0;n<a.length;n++){let i=a[n],o=c[n-1],l,f,p;{let n=o?.search??e.search,r=o?._strictSearch??void 0;try{let e=or(i.options.validateSearch,{...n})??void 0;l={...n,...e},f={...r,...e}}catch(e){let r=e;if(e instanceof ir||(r=new ir(e.message,{cause:e})),t?.throwOnError)throw r;l=n,f={},p=r}}let m=``,h=``;try{m=i.options.loaderDeps?.({search:l})??``,h=m&&JSON.stringify(m)||``}catch(e){if(t?.throwOnError)throw e;p??=e}let g=pt(),_=i._interpolation?Rt(i.fullPath,i._interpolation,r,this.pathParamsDecoder,g):i.fullPath,v=i.id+_+h,y=u(i,n),b=this._cache.get(v)??(y?.id===v?y:void 0);d=b?._strictParams??Object.assign(g,d);let x;if(!b)try{pr(i,d)}catch(e){if(x=Bt(e)||dn(e)?e:new ar(e.message,{cause:e}),t?.throwOnError)throw x}let S=y?`stay`:`enter`,C;if(b)C={...b,cause:S,search:mt(y?y.search:b.search,l),_strictSearch:f,searchError:p};else{let e=Zn(i)?`pending`:`success`;C={id:v,ssr:i.options.ssr,index:n,routeId:i.id,params:y?.params??d,_strictParams:d,pathname:_,updatedAt:Date.now(),search:y?mt(y.search,l):l,_strictSearch:f,searchError:p,status:e,isFetching:!1,error:void 0,paramsError:x,context:{},abortController:t?._controller??new AbortController,cause:S,loaderDeps:y?ht(y.loaderDeps,m):m,invalid:!1,preload:!1,staticData:i.options.staticData||{},fullPath:i.fullPath}}let w=s===i.id;C._notFound&&!w&&(C.error=void 0),C._notFound=w,c[n]=C}for(let e=0;e<c.length;e++){let n=c[e];n.params=n.cause===`stay`?mt(n.params,d):d,t?._controller&&(n.context={})}return c}matchRoutesLightweight(e){let t=lt(this.stores.ids.get()),n=t?this.stores.byRoute.get(t).get():void 0,r=n?.id,i=this.lightweightCache.get(e);if(i&&i[0]===r)return i[1];let[a,o]=this.getMatchedRoutes(e.pathname),s=lt(a),c={...e.search};for(let e of a)try{Object.assign(c,or(e.options.validateSearch,c))}catch{}let l=n&&n.routeId===s.id&&n.pathname===e.pathname,u;if(l)u=n.params;else{let e=o;for(let t of a)try{pr(t,e)}catch{}u=e}let d=[a,s.fullPath,c,u];return this.lightweightCache.set(e,[r,d]),d}};async function rr(e,t,{replace:n,ignoreBlocker:r}){if(!wt(t,e.protocolAllowlist)){if(!r){let t=e.history._getBlockers();for(let r of t)if(r?.blockerFn&&await r.blockerFn({currentLocation:e.history.location,nextLocation:e.history.location,action:n?`REPLACE`:`PUSH`}))return}e.history._ignoreNextBeforeUnload?.(t),n?window.location.replace(t):window.location.href=t}}var ir=class extends Error{},ar=class extends Error{};function or(e,t){if(e==null)return{};if(`~standard`in e){let n=e[`~standard`].validate(t);if(n instanceof Promise)throw new ir(`Async validation not supported`);if(n.issues)throw new ir(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 sr(e,t){if(e===void 0||e===!0)return t;let 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 cr(e,t){return typeof e==`function`?!0:!t||e===!1||e===null?!1:e===void 0||e===!0||t.some(t=>typeof t!=`string`&&!dt.call(e,t[1]))}var lr=Object.freeze({});function ur(e,t){let n=[];for(let r=0;r<e.length;r++){let i=e[r].options;`search`in i?i.search?.middlewares&&n.push(...i.search.middlewares):(i.preSearchFilters||i.postSearchFilters)&&n.push(({search:e,next:t})=>{let n=t(i.preSearchFilters?i.preSearchFilters.reduce((e,t)=>t(e),e):e);return i.postSearchFilters?i.postSearchFilters.reduce((e,t)=>t(e),n):n});let a=i.validateSearch;t&&a&&n.push(({search:e,next:t,meta:n})=>{let r=t(e);try{let e=or(a,r);if(n&&e)for(let t in e)t in r||(n.defaulted||=new Map).set(t,e[t]);return{...r,...e}}catch{}return r})}return n}function dr(e,t,n){let r=(t,i,a)=>{if(t>=e.length){if(!n.search)return{};if(n.search===!0)return i;let e=ut(n.search,i);return a&&(a.explicit=e),e}return e[t]({search:i,next:(e,n)=>{if(n){let n=a||{};return{search:r(t+1,e,n),meta:n}}return r(t+1,e,a)},meta:a})};return r(0,t)}function fr(e,t){if(e!==`root`){let e;for(let n=t.length-1;n>=0;n--){let r=t[n];if(r.options.notFoundComponent)return r.id;e||=r.children&&r.id}if(e)return e}return ln}function pr(e,t){let n=e.options.params?.parse??e.options.parseParams;n&&Object.assign(t,n(t))}function mr(e,t){return e.options[t]?.preload?.()}function hr(e,t){let n=mr(e,`component`),r=mr(e,`pendingComponent`);return t&&(r?r=r.then(t):t()),n&&r?Promise.all([n,r]).then(()=>{}):n??r}function gr(e,t,n){let r=()=>t===!1?void 0:t?mr(e,t):hr(e,n),i=e._lazy;if(i)return i===!0?r():i.then(r);if(!e.lazyFn)return r();let a=e.lazyFn().then(t=>{{let{id:n,...r}=t.options;Object.assign(e.options,r),e._lazy=!0}},t=>{throw e._lazy=void 0,t});return e._lazy=a,a.then(r)}function _r(e){let t=e.findIndex(e=>e.status!==`success`||e._notFound)+1;return t&&t<e.length?e.slice(0,t):e}var vr=0,yr=1,br=2,xr=3,Sr=[4];function Cr(e){return typeof e[0]==`number`}function wr(e,t){return t.aborted?Promise.race([Promise.reject(t),e]):new Promise((n,r)=>{let i=()=>r(t);t.addEventListener(`abort`,i,{once:!0}),Promise.resolve(e).then(n,r).then(()=>t.removeEventListener(`abort`,i))})}function Tr(e,t){return e.routesById[t.routeId]}function Er(e,t,n){return dn(e)?[xr,e]:Bt(e)?(e.routeId||=n,[br,e]):t?(typeof e?.then==`function`&&(e=Error(`A Promise was thrown`,{cause:e})),[yr,e]):[vr,e]}function Dr(e,t){let n=Er(t,!0,e.id);if(n[0]!==yr)return n;try{e.options.onError?.(n[1])}catch(t){n=Er(t,!0,e.id)}return n}function Or(e,t,n,r,i){return i[0].signal.aborted?Sr:Wr(e,t,n,Dr(n,r),i)}async function kr(e,t,n,r,i,a){let[o,s]=t,c=n[0].signal,l=!!n[3];for(let i=n[6]??0;i<r;i++){let r=s[i],u=Tr(e,r);r.abortController=n[0];let d=s[i-1]?.context??e.options.context??{},f={params:r.params,location:o,navigate:t=>e.navigate({...t,_fromLocation:o}),buildLocation:e.buildLocation,cause:l?`preload`:r.cause,abortController:n[0],preload:l,matches:s,routeId:u.id};try{let e=r._ctx||=u.options.context?u.options.context({...f,deps:r.loaderDeps,context:d})||{}:void 0;r.context={...d,...e}}catch(a){return jr(e,r),[i,Or(e,t,u,a,n)]}if(c.aborted)return[i,Sr];let p=r.paramsError??r.searchError;if(p!==void 0)return jr(e,r),[i,Or(e,t,u,p,n)];let m=u.options.beforeLoad;if(!m)continue;let h=r.status;i>=a&&(r.status=`pending`,n[7]?.());try{Pr(e,r,`beforeLoad`,n[0]);let a=m({...f,search:r.search,context:r.context,...e.options.additionalContext}),o=await(typeof a?.then==`function`?wr(a,c):a);if(c.aborted)return[i,Sr];let s=Wr(e,t,u,Er(o,!1,u.id),n);if(s[0]!==vr)return jr(e,r),[i,s];r.context={...r.context,...o}}catch(a){return jr(e,r),[i,Or(e,t,u,a,n)]}finally{r.status=h,Pr(e,r,!1,n[0])}}i()}function Ar(e,t,n){if(!(!n||--n[2])){if(e._flights?.get(t.id)===n){let n=e._tx;if(n&&!n[0].signal.aborted&&!n[3].includes(t)&&n[3].some(e=>e.id===t.id)&&n[3].some(e=>e.isFetching===`beforeLoad`))return;e._flights.delete(t.id)}return n[1]}}function jr(e,t){let n=t._flight;t._flight=void 0,Ar(e,t,n)?.abort()}function Mr(e,t,n,r){let i=[];for(let a of t)if(!n?.includes(a)){let t=a._flight;if(a._flight=void 0,r&&t?.[2]===1&&e._flights?.get(a.id)===t&&n?.some(e=>e.id===a.id))t[2]=0;else{let n=Ar(e,a,t);n&&i.push(n)}}for(let e of i)e.abort()}function Nr(e){for(let t of e){let e=t._flight;e&&e[2]++}}function Pr(e,t,n,r){if(t.isFetching=n,r&&e._tx?.[0]!==r)return;let i=e.stores.byRoute.get(t.routeId),a=i?.get();a?.id===t.id&&i.set({...a,isFetching:n})}function Fr(e,t,n,r,i,a,o){let s=t[0];return{params:n.params,location:s,navigate:t=>e.navigate({...t,_fromLocation:s}),cause:o?`preload`:n.cause,abortController:i,preload:o,deps:n.loaderDeps,parentMatchPromise:a,context:n.context,route:r,...e.options.additionalContext}}async function Ir(e,t,n,r,i,a,o){let s=o[0],c=s.signal;if(c.aborted)return Sr;if(!i)return[vr,void 0];let l=n._flight;Pr(e,n,`loader`,s);try{if(!l){let s=new AbortController;l=[Promise.resolve().then(()=>i(Fr(e,t,n,r,s,a,!!o[3]))).then(e=>Er(e,!1,r.id),e=>Er(e,!0,r.id)).then(t=>(t[0]!==vr&&e._flights?.get(n.id)===l&&(e._flights.delete(n.id),l[2]||s.abort()),t[0]===yr&&l[2]?Dr(r,t[1]):t)),s,1],(e._flights??=new Map).set(n.id,l)}return n._flight=l,n.abortController=l[1],Wr(e,t,r,await wr(l[0],c),o)}catch(t){if(t!==c||!c.aborted)throw t;return jr(e,n),Sr}finally{Pr(e,n,!1,s)}}function Lr(e,t,n){t[0]!==xr&&(e.status=`success`,e.error=void 0,t[0]===vr?(e.loaderData=t[1],e.invalid=!1,e.updatedAt=Date.now(),e.preload=n):e.invalid=!0)}function Rr(e,t,n){let r=e._cache.get(t.id);if(r!==n||e._committed.some(e=>e.id===t.id&&e._flight===t._flight))return;let i={...t,_notFound:void 0,context:{}};i._flight&&i._flight[2]++,e._cache.set(t.id,i),r&&jr(e,r)}function zr(e,t){return t[0]===yr||t[0]===br?{...e,status:t[0]===yr?`error`:`notFound`,error:t[1],_flight:void 0}:e}function Br(e,t,n,r,i,a,o){let s=t[1][n],c=Tr(e,s),l=!!a[3],u=e._cache.get(s.id),d,f=!1,p;try{if(s.status===`success`&&(d=c.options.shouldReload,typeof d==`function`&&(d=d(Fr(e,t,s,c,a[0],i,l))),a[0].signal.aborted&&(p=Sr)),!p){if(s.status!==`success`)f=!0;else{let t=l||s.preload?c.options.preloadStaleTime??e.options.defaultPreloadStaleTime??3e4:c.options.staleTime??e.options.defaultStaleTime??0;f=!!(s.invalid||d||d===void 0&&Date.now()-s.updatedAt>=t&&(a[5]||s.cause===`enter`||a[2].some(e=>e.routeId===s.routeId&&e.id!==s.id)))}}}catch(n){s.invalid=!0,jr(e,s),p=Or(e,t,c,n,a)}let m=c.options.loader,h=typeof m==`function`,g=h?m:m?.handler,_=!l||c.options.preload!==!1,v=_&&m?e._flights?.get(s.id):void 0;v===s._flight||p?v=void 0:v&&!f&&!l&&d===void 0?f=!0:f||(v=void 0);let y=!(!m||!f||s.status!==`success`||l||a[4]||((h?void 0:m.staleReloadMode)??e.options.defaultStaleReloadMode)===`blocking`),b=f&&_,x=b&&!y&&(s.status!==`success`||!!m),S=n>=o?a[7]:void 0,C=c.lazyFn&&c._lazy!==!0?S:void 0;if(b&&!m&&(s.invalid=!1,s.updatedAt=Date.now()),v&&v[2]++,x){let t=s._flight;s._flight=v,Ar(e,s,t)?.abort(),n>=o&&(s.status=`pending`),S?.()}b||(s.isFetching=!1);let w=!p&&x?Ir(e,t,s,c,g,i,a).then(t=>(Lr(s,t,l),t[0]===vr&&(m&&!a[0].signal.aborted&&Rr(e,s,u),n>=o&&(s.status=`pending`)),t)):Promise.resolve(p??[vr,s.loaderData]),T=(async()=>{try{let e=gr(c,void 0,C);e&&await wr(e,a[0].signal)}catch(r){if(!t[1].some((e,t)=>t<=n&&(e.status===`error`||e.status===`notFound`||e._notFound)))return[n,Or(e,t,c,r,a)]}let r=await w;x&&r[0]===vr&&s.status===`pending`&&!a[0].signal.aborted&&(s.status=`success`,S?.())})();if(r.push([n,w,T]),!y)return w.then(e=>zr(s,e));let E={...s,status:`pending`,preload:!1,_flight:v};s.invalid=!1,s.isFetching=`loader`;let D=Ir(e,t,E,c,g,i,a).then(e=>(s.isFetching=!1,Lr(E,e,!1),e));return(t[2]??=[]).push([n,D,T,E]),D.then(e=>zr(E,e))}async function Vr(e,t,n,r,i=0){let a=n?.[1][1],o=a?.routeId?t.findIndex(e=>e.routeId===a.routeId):n?.[0]??t.length-1;o<0&&(o=0);for(let n=o;n>=0;n--){let i=Tr(e,t[n]);try{let e=gr(i,!1);e&&await wr(e,r)}catch(e){if(e===r&&r.aborted)throw e}if(i.options.notFoundComponent)return n}return a?.routeId?o:i}function Hr(e,t){t[2]&&=(Mr(e,t[2].map(e=>e[3])),void 0)}async function Ur(e,t,n,r){let i;try{await Promise.all(e.map(e=>e[1].then(async t=>{let a=e[0];if(!(r&&a>=await r)){if(t[0]>=xr)throw[a,t];!i&&t[0]!==vr&&(i=[a,t],await Promise.all((n??[]).map(e=>{if(!(e[0]<=a))return e[1].then(t=>{if(t[0]===xr)throw[e[0],t]})})))}})))}catch(e){return e}return t??i}function Wr(e,t,n,r,i,a){for(;r[0]===xr;){let o=r[1],s=o.options;try{if((s.href||o.headers.has(`Location`))&&(e.resolveRedirect(o),s.reloadDocument)||(s.reloadDocument?i[3]:i[1]>=20))return r;let n=e.buildLocation({...s,_fromLocation:t[0],_includeValidateSearch:!0}),a=n.maskedLocation??n;if(a.external){let t=o.clone();return t.options={...s},t.headers.set(`Location`,a.publicHref),e.resolveRedirect(t),i[3]?[xr,t]:[xr,t,a]}return[xr,o,n]}catch(e){r=a?[yr,e]:Dr(n,e),a=!0}}return r}async function Gr(e,t,n,r,i,a){let o=t[1],s=await i,c=!1,l=o.findIndex(e=>e._notFound),u=t=>t[1][0]===br?Vr(e,o,t,r.signal):t[0],d=l<0?o.length:l;if((s?.[1][0]??0)>=xr)d=0;else if(s){d=s[2]??=await u(s);for(let e of n){if(e[0]>=d)break;let t=await e[1];if(t[0]!==vr&&t[0]<xr&&!(`loaderData`in o[e[0]])){s=[e[0],t],d=s[2]=await u(s);break}}}for(let e of n){if(e[0]>=d)break;let t=await e[2];if(t){s=t;break}}if((s?.[1][0]??0)>=xr){let n=s[1];if(n[0]!==xr||n[1].options.reloadDocument||n[2])return Hr(e,t),n;c=!0,s=[0,[yr,Error(`Too many redirects`)]]}let f=s?s[2]??await u(s):l;if(f>=0){let i=s?.[1],l=i?.[0],u=o[f],d=i?.[1],p=()=>{i&&(u._notFound=void 0,l===yr?u.status=`error`:(d.routeId=u.routeId,u.routeId===e.routeTree.id?(u.status=`success`,u._notFound=!0):u.status=`notFound`),u.error=d,u.isFetching=!1)};p(),i||a?.();let m=Tr(e,u);try{await wr(i?Promise.resolve().then(()=>gr(m,l===yr?`errorComponent`:`notFoundComponent`)):Promise.all([gr(m),gr(m,`notFoundComponent`)]),r.signal)}catch(n){if(n===r.signal&&r.signal.aborted)return Hr(e,t),Sr}i?c&&(r.abort(),await Promise.all([...n.map(e=>e[1]),...n.map(e=>e[2]),...(t[2]??[]).map(e=>e[1])]),Hr(e,t),Mr(e,o),p()):u.status=`success`}return t}async function Kr(e,t,n,r=0,i=t[1].length){let a=t[1];for(let t=r;t<i;t++){let r=a[t],i=Tr(e,r).options;if(i.head||i.scripts)try{let t={ssr:e.options.ssr,matches:a,match:r,params:r.params,loaderData:r.loaderData},[o,s]=await wr(Promise.all([i.head?.(t),i.scripts?.(t)]),n);r.meta=o?.meta,r.links=o?.links,r.headScripts=o?.scripts,r.styles=o?.styles,r.scripts=s}catch(e){if(e===n&&n.aborted)break;console.error(e)}if(r.status!==`success`||r._notFound)break}return t}async function qr(e,t,n,r){let i=[t,n],a=r[0].signal,o;try{let t=e.stores.matches.get(),s=n.findIndex(e=>e._notFound);if(e.options.notFoundMode!==`root`&&s>=0){let t=await Vr(e,n,void 0,a,s);n[s]._notFound=void 0,n[t]._notFound=!0,s=t}let c=s<0?n.length:s+1,l=0;for(;l<c&&l!==s;){let e=n[l],i=r[2][l],a=t[l];if(i?.id!==e.id||i.status!==`success`||e.preload||a?.id!==e.id||a.status!==`success`||(l++,i._notFound||a._notFound))break}let u=[],d=r[6]??0,f=d?Promise.resolve(n[d-1]):void 0,p=()=>{for(let t=d;t<c&&!a.aborted;t++)f=Br(e,i,t,u,f,r,l)},m=await kr(e,i,r,c,p,l);if(m){if(r[4]=!0,c=m[0],m[1][0]===br){let t=await Vr(e,n,m,a);m[2]=t,c=Math.min(c,t+1)}else m[1][0]>=xr&&(c=0);p()}if(!a.aborted&&!r[3]){let t=[];for(let[n,r]of e._flights??[])r[2]||(e._flights.delete(n),t.push(r[1]));for(let e of t)e.abort()}let h=Gr(e,i,u,r[0],Ur(u,m,i[2]),r[7]);i[2]?.length&&(i[3]=Ur(i[2],void 0,void 0,h.then(e=>Cr(e)?0:_r(n).length,()=>0))),o=await h}catch(t){if(Hr(e,i),t===a&&a.aborted)return Sr;throw t}return Cr(o)?o:Kr(e,o,a,r[6]===n.length?r[6]:0)}function Jr(e,t){if(e._tx!==t)return;let n=t[3],r=e.stores.matches.get(),i=e._pending;for(let a=0;a<n.length;a++){let o=n[a],s=o.status===`success`&&!o._notFound,c=r[a]?.id===o.id&&r[a]?.status===`pending`;if(s&&!c)continue;let l=Tr(e,o),u=s||o.invalid?0:l.options.pendingMs??e.options.defaultPendingMs,d=l.options.pendingComponent??e.options.defaultPendingComponent;if(!d||typeof u!=`number`||u===1/0){i&&(i[0]=t,i[2]=0,i[4]=!0);return}let f=l.options.pendingMinMs??e.options.defaultPendingMinMs??0,p=!1;if(i?.[1]===o.id?(p=i[0]!==t,i[0]=t):(clearTimeout(i?.[3]),e._pending=i=void 0),i||(e._pending=i=[t,o.id,c?Date.now()+f:t[4]+u,void 0,c||void 0,d]),i[4]&&!p&&i[5]===d)return;if(i[5]=d,!i[4]){clearTimeout(i[3]);let n=i[2]-Date.now();if(n>0){i[3]=setTimeout(()=>Jr(e,t),n);return}i[2]=0}let m=n.map(e=>({...e,_flight:void 0}));m[a].status=`pending`;let h=i[4]=e.startTransition(()=>e.stores.setMatches(m),m).then(t=>(t&&e._pending===i&&i[4]===h&&!i[2]&&(i[2]=Date.now()+f),t));return}}function Yr(e,t){let n=e._pending;(e._tx===t||!e._tx?.[3].some(e=>e.id===n?.[1]))&&(clearTimeout(n?.[3]),e._pending=void 0)}async function Xr(e,t){let n=e._pending;if(!n)return;clearTimeout(n[3]);let r=n[2]-Date.now();if(!n[4]||r<=0||!_r(t[3]).some(e=>e.id===n[1]))return;let i;try{await wr(new Promise(e=>{i=setTimeout(e,r)}),t[0].signal)}catch{}clearTimeout(i)}function Zr(e,t){e._committed=t,e.stores.setMatches(t)}function Qr(e,t,n,r){let i=e._committed,a=e._lifecycleEnd,o=e._cache;for(let e of n)e.preload=!1,r&&(e._assetEnd=void 0);let s=_r(n).length,c=new Map;{let t=Date.now(),r=new Set;for(let e=0;e<n.length;e++){let t=n[e];(e<s||t.status===`success`)&&r.add(t.id)}for(let n of[...i,...o.values()]){if(n.status!==`success`||r.has(n.id))continue;let i=Tr(e,n);!i.options.loader||t-n.updatedAt>=(n.preload?i.options.preloadGcTime??e.options.defaultPreloadGcTime??3e5:i.options.gcTime??e.options.defaultGcTime??3e5)||c.set(n.id,o.get(n.id)===n?n:{...n,_flight:void 0,isFetching:!1,context:{}})}}t[3]=[],e._cache=c;let l=e._lifecycleEnd=er(n);Zr(e,n),Mr(e,[...o.values(),...i].filter(e=>e._flight&&c.get(e.id)!==e),n),tr(e,i,n,a,l,t)}async function $r(e,t){let n=e._tx;for(;n&&n!==t;)t=n,await n[5],n=e._tx}function ei(e,t,n){let r=n[1].options,i=n[2];if(!i)return e.navigate({...r,replace:!0,ignoreBlocker:!0});if(r.reloadDocument)return e.navigate({href:(i.maskedLocation??i).publicHref,reloadDocument:!0,replace:!0,ignoreBlocker:!0});i._redirects=t[1]+1,e._pendingLocation=i;let a=e.commitLocation({...i,viewTransition:r.viewTransition,replace:!0,resetScroll:r.resetScroll,hashScrollIntoView:r.hashScrollIntoView,ignoreBlocker:!0});return queueMicrotask(()=>{e._pendingLocation===i&&(e._pendingLocation=void 0)}),a}async function ti(e,t,n,r,i){let a=n.map(e=>({...e}));Nr(a);for(let t of r)jr(e,a[t[0]]),a[t[0]]=t[3];let o=[t[2],a],s;try{s=await Gr(e,o,r,t[0],i)}catch(t){throw Mr(e,a),t}if(Cr(s)){Mr(e,a),s[0]===xr&&e._tx===t&&e._committed===n&&await ei(e,t,s);return}if(await Kr(e,s,t[0].signal),e._tx!==t||e._committed!==n){Mr(e,a);return}for(let t of a){let n=e._cache.get(t.id);n?._flight&&n._flight===t._flight&&(e._cache.delete(t.id),jr(e,n))}Zr(e,a),Mr(e,n,a)}async function ni(e,t,n,r,i,a){let o=await qr(e,t[2],t[3],[t[0],t[1],e._committed,void 0,i,n,a,r]);if(Cr(o)){let n=o[0]===xr&&e._tx===t;if((!n||o[1].options.reloadDocument)&&Yr(e,t),Mr(e,t[3]),t[3]=[],!n)return;if(e._tx!==t){Yr(e,t);return}await ei(e,t,o);return}let s=o[1];if(e._tx===t&&await Xr(e,t),e._tx!==t){Yr(e,t),Mr(e,s),Hr(e,o);return}let c=t[2],l=Qn(c,e.stores.resolvedLocation.get()),u=o[2];await e.startViewTransition(async()=>{if(e._tx===t&&await Xr(e,t),e._tx!==t){Yr(e,t),Mr(e,s),Hr(e,o);return}let n=await e.startTransition(()=>{Yr(e,t),Qr(e,t,s,a),e._tx===t&&(e.emit({type:`onLoad`,...l}),e._tx===t&&e.emit({type:`onBeforeRouteMount`,...l}))},s);if(e._tx!==t){Hr(e,o);return}u?.length&&ti(e,t,s,u,o[3]).catch(console.error),e.batch(()=>{e.stores.resolvedLocation.set(c),e.stores.status.set(`idle`),e._tx===t&&e.emit({type:`onResolved`,...l}),n&&e._tx===t&&e.emit({type:`onRendered`,...l})}),e._tx===t&&(e._commitPromise?.resolve(),e._commitPromise=void 0)})}async function ri(e,t){let n=e._tx,r=e.stores.resolvedLocation.get(),i=r??e.stores.location.get(),a=e.latestLocation,o=e._pendingLocation,s=o?.href===a.href?o._redirects??0:0,c=e._handoff,l=c?.[0](),u=new AbortController,d=e._preflight;if(e._preflight=u,l||c?.[1](),d?.abort(),!u.signal.aborted){let t=Qn(a,r);e.emit({type:`onBeforeNavigate`,...t}),u.signal.aborted||e.emit({type:`onBeforeLoad`,...t})}if(u.signal.aborted){await $r(e,n);return}let f=i.href===a.href,p=u,m=e.matchRoutes(a,{_controller:u});Nr(m);let h=l?c[1](m):void 0;if(h?p=l:l?.abort(),u.signal.aborted){Mr(e,m),await $r(e,n);return}e._preflight=void 0;let g,_=()=>ni(e,y,f,()=>Jr(e,y),t?.sync,h),v=t?.sync?new Promise(e=>g=e):Promise.resolve().then(_),y=[p,s,a,m,Date.now(),v.then(()=>$r(e,y))];if(e._tx=y,n){for(let t of e.stores.matches.get()){if(e._tx!==y)break;t.isFetching&&Pr(e,t,!1)}n[0].abort(),Mr(e,n[3],y[3],!0)}if(e._tx!==y){Mr(e,y[3]),y[3]=[],g?.(),await $r(e,y);return}e.batch(()=>{e.stores.status.set(`pending`),e.stores.location.set(a)}),(h||!e._committed.length&&m[0]?.status!==`success`&&!m.some(e=>e._notFound))&&Jr(e,y),g?.(_()),await y[5]}async function ii(e,t){let n=e.buildLocation(t);for(let t=0;;t++){let r=e._committed,i=new AbortController,a,o,s;try{try{a=e.matchRoutes(n,{_controller:i}),Nr(a),o=(e._preloads??=new Map).set(i,a),s=await qr(e,n,a,[i,t,r,!0])}finally{o&&(o=o.delete(i),Mr(e,a)),i.abort()}if(!Cr(s))return s[1];if(!o||s.length<3)return;n=s[2]}catch(e){Bt(e)||console.error(e);return}}}var ai=`Error preloading route! ☝️`,oi=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=e=>{this.originalIndex=e,this._branch=void 0;let t=this.options,n=!t?.path&&!t?.id;this.parentRoute=this.options.getParentRoute?.(),n?this._path=ln:this.parentRoute||Ot();let r=n?ln:t?.path;r&&r!==`/`&&(r=At(r));let i=t?.id||r,a=n?ln:kt((this.parentRoute.id===`__root__`?``:this.parentRoute.id)+`/`+(i??``));r===`__root__`&&(r=`/`);let o=a===`__root__`?`/`:r===void 0?this.parentRoute.fullPath:kt(this.parentRoute.fullPath+`/`+r);this._path=r,this._id=a,this._fullPath=o,this._to=jt(o)},this.addChildren=e=>this._addFileChildren(e),this._addFileChildren=e=>(Array.isArray(e)&&(this.children=e),typeof e==`object`&&e&&(this.children=Object.values(e)),this),this._addFileTypes=()=>this,this.updateLoader=e=>(Object.assign(this.options,e),this),this.update=e=>(Object.assign(this.options,e),this),this.lazy=e=>(this.lazyFn=e,this),this.redirect=e=>un({from:this.fullPath,...e}),this.options=e||{},this.isRoot=!e?.getParentRoute,e?.id&&e?.path)throw Error(`Route cannot have both an 'id' and a 'path' option.`)}},si=class extends oi{constructor(e){super(e)}},ci=class extends _.Component{constructor(...e){super(...e),this.state={error:0},this.reset=()=>{this.setState({error:0})}}static getDerivedStateFromProps(e,t){let n=e.getResetKey();return t.error&&t.resetKey!==n?{resetKey:n,error:0}:{resetKey:n}}static getDerivedStateFromError(e){return{error:[e]}}componentDidCatch(e,t){this.props.onCatch?.(e,t)}render(){let e=this.state.error;return e?_.createElement(this.props.errorComponent??li,{error:e[0],reset:this.reset}):this.props.children}};function li({error:e}){let[t,n]=_.useState(!1);return(0,b.jsxs)(`div`,{style:{padding:`.5rem`,maxWidth:`100%`},children:[(0,b.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:`.5rem`},children:[(0,b.jsx)(`strong`,{style:{fontSize:`1rem`},children:`Something went wrong!`}),(0,b.jsx)(`button`,{style:{appearance:`none`,fontSize:`.6em`,border:`1px solid currentColor`,padding:`.1rem .2rem`,fontWeight:`bold`,borderRadius:`.25rem`},onClick:()=>n(e=>!e),children:t?`Hide Error`:`Show Error`})]}),(0,b.jsx)(`div`,{style:{height:`.25rem`}}),t?(0,b.jsx)(`div`,{children:(0,b.jsx)(`pre`,{style:{fontSize:`.7em`,border:`1px solid red`,borderRadius:`.25rem`,padding:`.3rem`,color:`red`,overflow:`auto`},children:e?.message?(0,b.jsx)(`code`,{children:e.message}):null})}):null]})}var ui=()=>!0,di=()=>!1;function fi({children:e,fallback:t=null}){return(0,b.jsx)(_.Fragment,{children:pi()?e:t})}function pi(){return _.useSyncExternalStore(mi,ui,di)}function mi(){return()=>{}}var hi=_.createContext(null);function gi(e){return _.useContext(hi)}var _i=_.createContext(void 0),vi=_.createContext(void 0);function yi({update:e,notify:t,unwatched:n}){return{link:r,unlink:i,propagate:a,checkDirty:o,shallowPropagate:s};function r(e,t,n){let r=t.depsTail;if(r!==void 0&&r.dep===e)return;let i=r===void 0?t.deps:r.nextDep;if(i!==void 0&&i.dep===e){i.version=n,t.depsTail=i;return}let a=e.subsTail;if(a!==void 0&&a.version===n&&a.sub===t)return;let o=t.depsTail=e.subsTail={version:n,dep:e,sub:t,prevDep:r,nextDep:i,prevSub:a,nextSub:void 0};i!==void 0&&(i.prevDep=o),r===void 0?t.deps=o:r.nextDep=o,a===void 0?e.subs=o:a.nextSub=o}function i(e,t=e.sub){let r=e.dep,i=e.prevDep,a=e.nextDep,o=e.nextSub,s=e.prevSub;return a===void 0?t.depsTail=i:a.prevDep=i,i===void 0?t.deps=a:i.nextDep=a,o===void 0?r.subsTail=s:o.prevSub=s,s===void 0?(r.subs=o)===void 0&&n(r):s.nextSub=o,a}function a(e){let n=e.nextSub,r;top:do{let i=e.sub,a=i.flags;if(a&60?a&12?a&4?!(a&48)&&c(e,i)?(i.flags=a|40,a&=1):a=0:i.flags=a&-9|32:a=0:i.flags=a|32,a&2&&t(i),a&1){let t=i.subs;if(t!==void 0){let i=(e=t).nextSub;i!==void 0&&(r={value:n,prev:r},n=i);continue}}if((e=n)!==void 0){n=e.nextSub;continue}for(;r!==void 0;)if(e=r.value,r=r.prev,e!==void 0){n=e.nextSub;continue top}break}while(1)}function o(t,n){let r,i=0,a=!1;top:do{let o=t.dep,c=o.flags;if(n.flags&16)a=!0;else if((c&17)==17){if(e(o)){let e=o.subs;e.nextSub!==void 0&&s(e),a=!0}}else if((c&33)==33){(t.nextSub!==void 0||t.prevSub!==void 0)&&(r={value:t,prev:r}),t=o.deps,n=o,++i;continue}if(!a){let e=t.nextDep;if(e!==void 0){t=e;continue}}for(;i--;){let i=n.subs,o=i.nextSub!==void 0;if(o?(t=r.value,r=r.prev):t=i,a){if(e(n)){o&&s(i),n=t.sub;continue}a=!1}else n.flags&=-33;n=t.sub;let c=t.nextDep;if(c!==void 0){t=c;continue top}}return a}while(1)}function s(e){do{let n=e.sub,r=n.flags;(r&48)==32&&(n.flags=r|16,(r&6)==2&&t(n))}while((e=e.nextSub)!==void 0)}function c(e,t){let n=t.depsTail;for(;n!==void 0;){if(n===e)return!0;n=n.prevDep}return!1}}function bi(e,t,n){let r=typeof e==`object`,i=r?e:void 0;return{next:(r?e.next:e)?.bind(i),error:(r?e.error:t)?.bind(i),complete:(r?e.complete:n)?.bind(i)}}var xi=[],Si=0,{link:Ci,unlink:wi,propagate:Ti,checkDirty:Ei,shallowPropagate:Di}=yi({update(e){return e._update()},notify(e){xi[ki++]=e,e.flags&=-3},unwatched(e){e.depsTail!==void 0&&(e.depsTail=void 0,e.flags=17,Ni(e))}}),Oi=0,ki=0,Ai,ji=0;function Mi(e){try{++ji,e()}finally{--ji||Pi()}}function Ni(e){let t=e.depsTail,n=t===void 0?e.deps:t.nextDep;for(;n!==void 0;)n=wi(n,e)}function Pi(){if(!(ji>0)){for(;Oi<ki;){let e=xi[Oi];xi[Oi++]=void 0,e.notify()}Oi=0,ki=0}}function Fi(e,t){let n=typeof e==`function`,r=e,i={_snapshot:n?void 0:e,subs:void 0,subsTail:void 0,deps:void 0,depsTail:void 0,flags:+!n,get(){return Ai!==void 0&&Ci(i,Ai,Si),i._snapshot},subscribe(e){let t=bi(e),n={current:!1},r=Ii(()=>{i.get(),n.current?t.next?.(i._snapshot):n.current=!0});return{unsubscribe:()=>{r.stop()}}},_update(e){let a=Ai,o=t?.compare??Object.is;if(n)Ai=i,++Si,i.depsTail=void 0;else if(e===void 0)return!1;n&&(i.flags=5);try{let t=i._snapshot,a=typeof e==`function`?e(t):e===void 0&&n?r(t):e;return t===void 0||!o(t,a)?(i._snapshot=a,!0):!1}finally{Ai=a,n&&(i.flags&=-5),Ni(i)}}};return n?(i.flags=17,i.get=function(){let e=i.flags;if(e&16||e&32&&Ei(i.deps,i)){if(i._update()){let e=i.subs;e!==void 0&&Di(e)}}else e&32&&(i.flags=e&-33);return Ai!==void 0&&Ci(i,Ai,Si),i._snapshot}):i.set=function(e){if(i._update(e)){let e=i.subs;e!==void 0&&(Ti(e),Di(e),Pi())}},i}function Ii(e){let t=()=>{let t=Ai;Ai=n,++Si,n.depsTail=void 0,n.flags=6;try{return e()}finally{Ai=t,n.flags&=-5,Ni(n)}},n={deps:void 0,depsTail:void 0,subs:void 0,subsTail:void 0,flags:6,notify(){let e=this.flags;e&16||e&32&&Ei(this.deps,this)?t():this.flags=2},stop(){this.flags=0,this.depsTail=void 0,Ni(this)}};return t(),n}var Li=o((e=>{var t=d();function n(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var r=typeof Object.is==`function`?Object.is:n,i=t.useState,a=t.useEffect,o=t.useLayoutEffect,s=t.useDebugValue;function c(e,t){var n=t(),r=i({inst:{value:n,getSnapshot:t}}),c=r[0].inst,u=r[1];return o(function(){c.value=n,c.getSnapshot=t,l(c)&&u({inst:c})},[e,n,t]),a(function(){return l(c)&&u({inst:c}),e(function(){l(c)&&u({inst:c})})},[e]),s(n),n}function l(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!r(e,n)}catch{return!0}}function u(e,t){return t()}var f=typeof window>`u`||window.document===void 0||window.document.createElement===void 0?u:c;e.useSyncExternalStore=t.useSyncExternalStore===void 0?f:t.useSyncExternalStore})),Ri=o(((e,t)=>{t.exports=Li()})),zi=o((e=>{var t=d(),n=Ri();function r(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var i=typeof Object.is==`function`?Object.is:r,a=n.useSyncExternalStore,o=t.useRef,s=t.useEffect,c=t.useMemo,l=t.useDebugValue;e.useSyncExternalStoreWithSelector=function(e,t,n,r,u){var d=o(null);if(d.current===null){var f={hasValue:!1,value:null};d.current=f}else f=d.current;d=c(function(){function e(e){if(!a){if(a=!0,o=e,e=r(e),u!==void 0&&f.hasValue){var t=f.value;if(u(t,e))return s=t}return s=e}if(t=s,i(o,e))return t;var n=r(e);return u!==void 0&&u(t,n)?(o=e,t):(o=e,s=n)}var a=!1,o,s,c=n===void 0?null:n;return[function(){return e(t())},c===null?void 0:function(){return e(c())}]},[t,n,r,u]);var p=a(e,d[0],d[1]);return s(function(){f.hasValue=!0,f.value=p},[p]),l(p),p}})),Bi=o(((e,t)=>{t.exports=zi()}))();function Vi(e,t){return e===t}function Hi(e,t=e=>e,n){let r=n?.compare??Vi,i=(0,_.useCallback)(t=>{let{unsubscribe:n}=e.subscribe(t);return n},[e]),a=(0,_.useCallback)(()=>e.get(),[e]);return(0,Bi.useSyncExternalStoreWithSelector)(i,a,a,t,r)}var Ui={};function Wi(e,t){let n=_.useRef();return r=>{let i=e?.select?e.select(r):r;return e?.structuralSharing??t.options.defaultStructuralSharing?n.current=ht(n.current,i):i}}function Gi(e){let t=gi(),n=_.useContext(e.from?vi:_i),r=e.from??n,i=t.stores.getMatchStore(r),a=Wi(e,t),o=Hi(i,e=>e?a(e):Ui);if(o!==Ui)return o;(e.shouldThrow??!0)&&Ot()}function Ki(e){return Gi({from:e.from,strict:e.strict,structuralSharing:e.structuralSharing,select:t=>e.select?e.select(t.loaderData):t.loaderData})}function qi(e){let{select:t,...n}=e;return Gi({...n,select:e=>t?t(e.loaderDeps):e.loaderDeps})}function Ji(e){return Gi({from:e.from,shouldThrow:e.shouldThrow,structuralSharing:e.structuralSharing,strict:e.strict,select:t=>{let n=e.strict===!1?t.params:t._strictParams;return e.select?e.select(n):n}})}function Yi(e){return Gi({from:e.from,strict:e.strict,shouldThrow:e.shouldThrow,structuralSharing:e.structuralSharing,select:t=>e.select?e.select(t.search):t.search})}function z(e){let t=gi();return _.useCallback(n=>t.navigate({...n,from:n.from??e?.from}),[e?.from,t])}function Xi(e){return Gi({...e,select:t=>e.select?e.select(t.context):t.context})}function Zi(...e){let t=_.useRef(e),n=t.current;return e.forEach((e,t)=>{_t(n[t],e,!1,!0)||(n[t]=e)}),t.current}function Qi(e,t){e.preloadRoute(t).catch(e=>{console.warn(e),console.warn(ai)})}var $i={compare:(e,t)=>e[0]===t[0]&&e[1]===t[1]};function ea(e,t){let n=typeof e==`string`&&St(e);if(n)return t.has(n)?e:null}function ta(e,t,n,r,i){let a=Nt(e.pathname,r),o=Nt(t.pathname,r);return(n?.exact?a!==o:!a.startsWith(o)||a.length!==o.length&&a[o.length]!==`/`)||(n?.includeSearch??!0)&&!_t(e.search,t.search,!n?.exact,n?.explicitUndefined)?!1:!n?.includeHash||i&&e.hash===t.hash}function na(e,t,n){let r=gi(),i=_.useRef(null),a=_.useCallback(e=>{if(i.current=e,typeof t==`function`)return t(e);t&&(t.current=e)},[t]),{activeOptions:o,to:s,preload:c,preloadDelay:l,hashScrollIntoView:u,replace:d,startTransition:f,resetScroll:p,viewTransition:m,ignoreBlocker:h,disabled:g,target:v,onClick:y,onBlur:b,onFocus:x,onMouseEnter:S,onMouseLeave:C,onTouchStart:w}=e,T=pi(),[E,D,O]=Zi(e.search,e.params,o),[k,ee]=_.useMemo(()=>[e,{...e}],[r,e.from,e._fromLocation,e.hash,e.to,E,D,e.state,e.mask,e.unsafeRelative]),A=_.useCallback(e=>{let t=ea(s,r.protocolAllowlist);if(t!==void 0)return[t??void 0];k._fromLocation||(ee._fromLocation=e);let n=r.buildLocation(ee),i=da(n,r,g);return[i,!g&&(!i||St(i))?void 0:ta(e,n,O,r.basepath,T)]},[O,g,T,k,ee,r,s]),[j,M]=Hi(r.stores.location,A,$i),N=M===void 0?j:void 0,te=g||j===void 0,ne=_.useRef(!1),P=e.reloadDocument||N||te?!1:c??r.options.defaultPreload,re=l??r.options.defaultPreloadDelay??0,F=_.useCallback(e=>{let t=e?.isIntersecting;if(!(t??P===`intent`)){t===!1&&la(i);return}if(!re){Qi(r,k);return}ca.has(i)||ca.set(i,setTimeout(()=>{ca.delete(i),Qi(r,k)},re))},[r,k,i,P,re]);_.useEffect(()=>{P===`render`&&!ne.current&&(ne.current=!0,Qi(r,k));let e;return P===`viewport`&&i.current&&typeof IntersectionObserver==`function`&&(e=new IntersectionObserver(e=>F(e.pop()),{rootMargin:`100px`}),e.observe(i.current)),()=>{e?.disconnect(),la(i)}},[r,k,P,F,i]);let I=oa(e,n);if(I.ref=t?a:i,N)return I.href=N,I;let ie=e=>{let t=v??e.currentTarget.getAttribute(`target`);!te&&!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)&&!e.defaultPrevented&&(!t||t===`_self`)&&e.button===0&&(e.preventDefault(),r.navigate({...k,replace:d,resetScroll:p,hashScrollIntoView:u,startTransition:f,viewTransition:m,ignoreBlocker:h}))},ae=()=>{P===`intent`&&Qi(r,k)},oe=()=>{P===`intent`&&la(i)};return I.onClick=ua(y,ie),I.onBlur=ua(b,oe),I.onFocus=ua(x,F),I.onMouseEnter=ua(S,F),I.onMouseLeave=ua(C,oe),I.onTouchStart=ua(w,ae),sa(I,e,M,j,te,n)}var ra={},ia={className:`active`},aa=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 oa(e,t){let n={};for(let r in e)aa.has(r)||r===`type`&&t!==void 0||r===`disabled`&&t===`a`||(n[r]=e[r]);return n}function sa(e,t,n,r,i,a){let{activeProps:o,inactiveProps:s,className:c,style:l,target:u}=t,d=ut(n?o:s,{})??(n?ia:ra);Object.assign(e,d),e.href=r,a!==`a`&&(e.disabled=i),e.target=u;let f=d.style;(l||f)&&(e.style=l&&f?{...l,...f}:l||f);let p=d.className;return(c||p)&&(e.className=c?p?`${c} ${p}`:c:p),i&&(e.role=`link`,e[`aria-disabled`]=!0),n&&(e[`data-status`]=`active`,e[`aria-current`]=`page`),e}var ca=new WeakMap,la=e=>{clearTimeout(ca.get(e)),ca.delete(e)},ua=(e,t)=>e?n=>n.defaultPrevented||(e(n),n.defaultPrevented||t(n)):t;function da(e,t,n){if(n)return;let r=e.maskedLocation??e,i=r.external?r.publicHref:t.history.createHref(r.publicHref)||`/`;if(!r.external&&i===r.publicHref||!wt(i,t.protocolAllowlist))return i}var fa=_.memo(_.forwardRef((e,t)=>{let n=e._asChild||`a`,r=na(e,t,n),i=typeof e.children==`function`?e.children({isActive:r[`data-status`]===`active`}):e.children;return _.createElement(n,r,i)}),pa);function pa(e,t){let n=0;for(let r in t)if(n++,e[r]!==t[r]&&(!aa.has(r)||!_t(e[r],t[r],!1,!0)))return!1;for(let t in e)n--;return n===0}var ma=class extends oi{constructor(e){super(e),this.useMatch=e=>Gi({...e,from:this.id}),this.useRouteContext=e=>Xi({...e,from:this.id}),this.useSearch=e=>Yi({...e,from:this.id}),this.useParams=e=>Ji({...e,from:this.id}),this.useLoaderDeps=e=>qi({...e,from:this.id}),this.useLoaderData=e=>Ki({...e,from:this.id}),this.useNavigate=()=>z({from:this.fullPath}),this.Link=_.forwardRef((e,t)=>(0,b.jsx)(fa,{ref:t,from:this.fullPath,...e}))}};function ha(e){return new ma(e)}var ga=class extends si{constructor(e){super(e),this.useMatch=e=>Gi({...e,from:this.id}),this.useRouteContext=e=>Xi({...e,from:this.id}),this.useSearch=e=>Yi({...e,from:this.id}),this.useParams=e=>Ji({...e,from:this.id}),this.useLoaderDeps=e=>qi({...e,from:this.id}),this.useLoaderData=e=>Ki({...e,from:this.id}),this.useNavigate=()=>z({from:this.fullPath}),this.Link=_.forwardRef((e,t)=>(0,b.jsx)(fa,{ref:t,from:this.fullPath,...e}))}};function _a(e){return new ga(e)}function va(e){let t=gi(),n=`not-found-${Hi(t.stores.location,e=>e.pathname)}-${Hi(t.stores.status)}`;return(0,b.jsx)(ci,{getResetKey:()=>n,onCatch:(t,n)=>{if(Bt(t))e.onCatch?.(t,n);else throw t},errorComponent:({error:t})=>{if(Bt(t))return e.fallback?.(t);throw t},children:e.children})}function ya(){return(0,b.jsx)(`p`,{children:`Not Found`})}function ba(e){return(0,b.jsx)(b.Fragment,{children:e.children})}function xa(e,t,n){return t.options.notFoundComponent?(0,b.jsx)(t.options.notFoundComponent,{...n}):e.options.defaultNotFoundComponent?(0,b.jsx)(e.options.defaultNotFoundComponent,{...n}):(0,b.jsx)(ya,{})}function Sa(e,t){let n=t?.options.pendingComponent??e.options.defaultPendingComponent;return n?(0,b.jsx)(n,{}):null}var Ca=(e,t)=>e[0]===t[0]&&e[1]===t[1],wa=(e,t,n)=>!t.isRoot||t.options.shellComponent||t.options.wrapInSuspense||n===!1||n===`data-only`||!e.ssr,Ta=_.memo(function({routeId:e}){let t=gi();return(0,b.jsx)(Ea,{router:t,match:Hi(t.stores.getMatchStore(e))})});function Ea({router:e,match:t}){let n=e.routesById[t.routeId],r=Sa(e,n),i=n.options.errorComponent??e.options.defaultErrorComponent,a=n.options.onCatch??e.options.defaultOnCatch,o=n.isRoot?n.options.notFoundComponent??e.options.notFoundRoute?.options.component:n.options.notFoundComponent,s=t.ssr===!1||t.ssr===`data-only`,c=wa(e,n,t.ssr)&&(n.options.wrapInSuspense??r??(n.options.errorComponent?.preload||s))?_.Suspense:ba,l=i?ci:ba,u=o?va:ba;return(0,b.jsxs)(n.isRoot?n.options.shellComponent??ba:ba,{children:[(0,b.jsx)(_i.Provider,{value:t.routeId,children:(0,b.jsx)(c,{fallback:r,children:(0,b.jsx)(l,{getResetKey:()=>t,errorComponent:i,onCatch:(e,n)=>{if(Bt(e))throw e.routeId??=t.routeId,e;a?.(e,n)},children:(0,b.jsx)(u,{fallback:e=>{if(e.routeId??=t.routeId,e.routeId!==t.routeId)throw e;return _.createElement(o,e)},children:s?(0,b.jsx)(fi,{fallback:r,children:(0,b.jsx)(Da,{match:t})}):(0,b.jsx)(Da,{match:t})})})})}),null]})}var Da=_.memo(function({match:e}){let t=gi(),n=e.routeId,r=t.routesById[n],i=_.useMemo(()=>{let i=(r.options.remountDeps??t.options.defaultRemountDeps)?.({routeId:n,loaderDeps:e.loaderDeps,params:e._strictParams,search:e._strictSearch});return i?JSON.stringify(i):void 0},[n,e.loaderDeps,e._strictParams,e._strictSearch,r.options.remountDeps,t.options.defaultRemountDeps]),a=_.useMemo(()=>{let e=r.options.component??t.options.defaultComponent;return e?(0,b.jsx)(e,{},i):(0,b.jsx)(Oa,{})},[i,r.options.component,t.options.defaultComponent]);if(e.status===`pending`){if(t.ssr&&!wa(t,r,e.ssr))return a;if(t._tx)throw t._tx[5];return Sa(t,r)}if(e.status===`notFound`)return xa(t,r,e.error);if(e.status===`error`)throw e.error;return a}),Oa=_.memo(function(){let e=gi(),t=_.useContext(_i),n,r,i;{let a=e.stores.getMatchStore(t);[n,r]=Hi(a,e=>[!!e._notFound,e.error],{compare:Ca}),i=Hi(e.stores.ids,e=>e[e.indexOf(t)+1])}if(n)return xa(e,e.routesById[t],r);if(!i)return null;let a=(0,b.jsx)(Ta,{routeId:i});return t===`__root__`?(0,b.jsx)(_.Suspense,{fallback:Sa(e),children:a}):a});function ka(e,t){let n=e[1];e.length=0,n?.(t)}function Aa({t:e}){let t=gi(),n=t._rendered??=[];return t.startTransition=(r,i)=>new Promise(a=>{ka(n,!1),n.push(i,a),e(t),_.startTransition(r)}),ct(()=>{let e=t.history.subscribe(t.load);t.updateLatestLocation();let r=t.latestLocation,i=t.buildLocation({to:r.pathname,search:!0,params:!0,hash:!0,state:!0,_includeValidateSearch:!0});if(jt(r.publicHref)!==jt(i.publicHref))return t.commitLocation({...i,replace:!0,ignoreBlocker:!0}),e;let a=t.stores.resolvedLocation.get();return a?.href===r.href&&a.state.__TSR_key===r.state.__TSR_key?n.push(t.stores.matches.get(),e=>{e&&t.emit({type:`onRendered`,...Qn(a,a)})}):t._tx||t.load({sync:!0}).catch(console.error),e},[t,t.history]),null}function ja(){let e=gi(),t=e.routesById[ln],n=Sa(e,t),r=e.ssr?ba:_.Suspense,i=(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(Aa,{t:_.useState()[1]}),(0,b.jsx)(r,{fallback:n,children:(0,b.jsx)(Ma,{})})]});return e.options.InnerWrap?(0,b.jsx)(e.options.InnerWrap,{children:i}):i}function Ma(){let e=gi(),t=e._rendered,n=Hi(e.stores.matches,e=>t[0]??e),r=n[0],i=r?.routeId;ct(()=>{t[0]===n&&ka(t,!0)},[t,n]);let a=i?(0,b.jsx)(Ta,{routeId:i}):null;return(0,b.jsx)(_i.Provider,{value:i,children:e.options.disableGlobalCatchBoundary?a:(0,b.jsx)(ci,{getResetKey:()=>r,onCatch:void 0,children:a})})}var Na=e=>({createMutableStore:Fi,createReadonlyStore:Fi,batch:Mi}),Pa=e=>new Fa(e),Fa=class extends nr{constructor(e){super(e,Na)}};function Ia({router:e,children:t,...n}){ft(n)&&e.update({...e.options,...n,context:{...e.options.context,...n.context}});let r=(0,b.jsx)(hi.Provider,{value:e,children:t});return e.options.Wrap?(0,b.jsx)(e.options.Wrap,{children:r}):r}function La({router:e,...t}){return(0,b.jsx)(Ia,{router:e,...t,children:(0,b.jsx)(ja,{})})}function Ra(e){let t=gi();return Hi(t.stores.location,Wi(e,t))}function za(e){if(!e.startsWith(`/`)||e.startsWith(`//`)||e.includes(`\\`)||[...e].some(e=>e.charCodeAt(0)<=32||e.charCodeAt(0)===127))throw Error(`Host paths must stay on this origin`);return e}function Ba(){let e=document.getElementById(`tolmap-host`);if(!e)return;let t=JSON.parse(e.textContent||`null`);if(t?.version!==1||!Array.isArray(t.repositories)||!Array.isArray(t.actions))throw Error(`Unsupported host profile`);for(let e of t.actions)za(e.path);if(t.onboarding){let e=t.onboarding;if(za(e.offered_repositories_path),za(e.batch_index_path),za(e.batch_progress_path),e.batch_progress_path.split(`{batch_id}`).length!==2)throw Error(`Batch progress path must contain {batch_id} once`);if(!e.open_sheet_parameter)throw Error(`Missing open sheet parameter`);e.install&&za(e.install.path),e.manage_access&&za(e.manage_access.path),e.sign_in&&za(e.sign_in.path),e.authorize&&za(e.authorize.path)}return t}var Va=document.querySelector(`meta[name="tolmap-personal"]`)!==null,Ha=Ba();async function Ua(e,t){let n=await fetch(e,t===void 0?void 0:{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(t)});if(!n.ok){let e=await n.json();throw Error(e.message??`Repository request failed.`)}return n.json()}function Wa({onClose:e}){let t=(0,_.useRef)(null),n=z(),[r,i]=(0,_.useState)(``),[a,o]=(0,_.useState)(),[s,c]=(0,_.useState)(new Set),[l,u]=(0,_.useState)(!1),[d,f]=(0,_.useState)();(0,_.useEffect)(()=>{t.current?.showModal()},[]);async function p(){u(!0),f(void 0);try{let e=await Ua(`/api/personal/scan?path=${encodeURIComponent(r)}`);o(e),c(new Set(e.filter(e=>!e.connected_repository_id).map(e=>e.provider_id)))}catch(e){f(e instanceof Error?e.message:`Folder could not be scanned.`)}finally{u(!1)}}async function m(){let t=a?a.filter(e=>s.has(e.provider_id)).map(e=>e.provider_id):[r.trim()];if(t.length&&t[0]){u(!0),f(void 0);try{let r=await Ua(`/api/personal/index`,{provider_ids:t});e(),r.jobs.length===1?await n({to:`/new`,search:{job:r.jobs[0].job_id}}):await n({to:`/new/batches/$batchId`,params:{batchId:r.batch_id}})}catch(e){f(e instanceof Error?e.message:`Repositories could not be added.`)}finally{u(!1)}}}return(0,b.jsxs)(`dialog`,{ref:t,"data-personal-add":!0,className:`add-repository-dialog`,"aria-labelledby":`personal-add-title`,onCancel:e,children:[(0,b.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,b.jsx)(`h2`,{id:`personal-add-title`,className:`text-section-title`,children:`Add repository`}),(0,b.jsx)(`button`,{type:`button`,"aria-label":`Close add repository`,className:`repo-control repo-control-icon`,disabled:l,onClick:e,children:`×`})]}),(0,b.jsxs)(`label`,{className:`text-small`,children:[`Local checkout, parent folder, or GitHub repository`,(0,b.jsx)(`input`,{autoFocus:!0,className:`offered-search mt-2 w-full`,value:r,disabled:l,placeholder:`/path/to/checkout or owner/repository`,onChange:e=>{i(e.target.value),o(void 0)}})]}),(0,b.jsx)(`p`,{className:`text-meta text-[var(--dim)]`,children:`Only committed source is indexed. Original checkouts stay on disk when removed from tolmap. GitHub is tried anonymously first, then with your existing git credential helper or gh login. Configure private access outside tolmap.`}),(0,b.jsx)(`button`,{type:`button`,className:`repo-control self-start`,disabled:l||!r.trim(),onClick:()=>void p(),children:`Scan folder`}),a&&(0,b.jsxs)(`div`,{className:`offered-repositories`,children:[a.length===0&&(0,b.jsx)(`p`,{children:`No checkouts found in this folder.`}),a.map(e=>(0,b.jsxs)(`label`,{className:`offered-repository`,children:[(0,b.jsx)(`input`,{type:`checkbox`,checked:s.has(e.provider_id),disabled:l||!!e.connected_repository_id,onChange:t=>c(n=>{let r=new Set(n);return t.target.checked?r.add(e.provider_id):r.delete(e.provider_id),r})}),(0,b.jsx)(`span`,{className:`min-w-0 flex-1 break-all font-mono text-small`,children:e.full_name}),e.connected_repository_id&&(0,b.jsx)(`span`,{className:`offered-badge`,children:`Mapped`})]},e.provider_id))]}),d&&(0,b.jsx)(`p`,{role:`alert`,className:`text-small text-[var(--link-out)]`,children:d}),(0,b.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,b.jsx)(`button`,{type:`button`,className:`repo-control`,disabled:l,onClick:e,children:`Cancel`}),(0,b.jsx)(`button`,{type:`button`,className:`repo-control repo-control-primary`,disabled:l||!r.trim()||a!==void 0&&s.size===0,onClick:()=>void m(),children:l?`Starting…`:a?`Map ${s.size} ${s.size===1?`repository`:`repositories`}`:`Add and map`})]})]})}function Ga(){return(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(`rect`,{x:`2`,y:`2`,width:`19`,height:`4`}),(0,b.jsx)(`rect`,{x:`26`,y:`2`,width:`4`,height:`19`}),(0,b.jsx)(`rect`,{x:`11`,y:`26`,width:`19`,height:`4`}),(0,b.jsx)(`rect`,{x:`2`,y:`11`,width:`4`,height:`19`}),(0,b.jsx)(`rect`,{x:`11`,y:`11`,width:`10`,height:`10`})]})}function Ka({className:e}){return(0,b.jsxs)(`svg`,{viewBox:`0 0 265.60267857142856 72.95089285714286`,width:`265.60267857142856`,height:`72.95089285714286`,fill:`currentColor`,role:`img`,"aria-label":`Tolmap`,className:e,children:[(0,b.jsx)(`g`,{transform:`translate(5 5) scale(1.6629464285714286)`,children:(0,b.jsx)(Ga,{})}),(0,b.jsx)(`path`,{transform:`translate(59.97767857142858 54.88839285714286)`,d:`M1.5625 -41.5625L1.5625 -46.5625L37.5000 -46.5625L37.5000 -41.5625L22.3750 -41.5625L22.3750 -0.0000L16.7500 -0.0000L16.7500 -41.5625ZM49.1250 0.7500Q44.5625 0.7500 41.1094 -1.4531Q37.6562 -3.6562 35.7344 -7.5312Q33.8125 -11.4062 33.8125 -16.4375Q33.8125 -21.5000 35.7344 -25.4062Q37.6562 -29.3125 41.1094 -31.5312Q44.5625 -33.7500 49.1250 -33.7500Q53.7188 -33.7500 57.1562 -31.5312Q60.5938 -29.3125 62.5156 -25.4062Q64.4375 -21.5000 64.4375 -16.4375Q64.4375 -11.4062 62.5156 -7.5312Q60.5938 -3.6562 57.1562 -1.4531Q53.7188 0.7500 49.1250 0.7500ZM49.1250 -4.0625Q52.2500 -4.0625 54.4688 -5.5938Q56.6875 -7.1250 57.8750 -9.9219Q59.0625 -12.7188 59.0625 -16.4375Q59.0625 -20.2188 57.8750 -23.0156Q56.6875 -25.8125 54.4688 -27.3750Q52.2500 -28.9375 49.1250 -28.9375Q46.0312 -28.9375 43.7969 -27.3906Q41.5625 -25.8438 40.3750 -23.0312Q39.1875 -20.2188 39.1875 -16.4375Q39.1875 -12.6875 40.3750 -9.9062Q41.5625 -7.1250 43.7812 -5.5938Q46.0000 -4.0625 49.1250 -4.0625ZM75.9375 -46.5625L75.9375 -0.0000L70.6250 -0.0000L70.6250 -46.5625ZM83.8125 -0.0000L83.8125 -33.0000L89.0000 -33.0000L89.0000 -26.2500L88.3438 -26.2500Q89.3125 -28.6562 90.8906 -30.2969Q92.4688 -31.9375 94.5000 -32.7812Q96.5312 -33.6250 98.7812 -33.6250Q102.6562 -33.6250 105.3594 -31.4219Q108.0625 -29.2188 108.7188 -26.2500L107.6250 -26.2500Q108.3438 -28.2812 109.8750 -29.9531Q111.4062 -31.6250 113.6406 -32.6250Q115.8750 -33.6250 118.6499 -33.6250Q121.6743 -33.6250 124.1687 -32.3125Q126.6631 -31.0000 128.1440 -28.3438Q129.6250 -25.6875 129.6250 -21.6250L129.6250 -0.0000L124.3125 -0.0000L124.3125 -21.6250Q124.3125 -25.4565 122.1592 -27.1033Q120.0059 -28.7500 117.1562 -28.7500Q114.7544 -28.7500 113.0093 -27.7495Q111.2642 -26.7490 110.3196 -25.0020Q109.3750 -23.2549 109.3750 -21.0000L109.3750 -0.0000L104.0625 -0.0000L104.0625 -22.1875Q104.0625 -25.1562 102.0781 -26.9531Q100.0938 -28.7500 97.0820 -28.7500Q95.0210 -28.7500 93.1980 -27.7812Q91.3750 -26.8125 90.2500 -24.8926Q89.1250 -22.9727 89.1250 -20.1250L89.1250 -0.0000ZM147.5625 0.5000Q144.2812 0.5000 141.6875 -0.6250Q139.0938 -1.7500 137.5781 -3.9844Q136.0625 -6.2188 136.0625 -9.5000Q136.0625 -12.3438 137.1719 -14.1250Q138.2812 -15.9062 140.1406 -16.9219Q142.0000 -17.9375 144.3594 -18.4688Q146.7188 -19.0000 149.1875 -19.3125Q152.3438 -19.7500 154.1562 -19.9688Q155.9688 -20.1875 156.7344 -20.6875Q157.5000 -21.1875 157.5000 -22.4375L157.5000 -22.7500Q157.5000 -24.5625 156.6406 -25.9531Q155.7812 -27.3438 154.1406 -28.1406Q152.5000 -28.9375 150.1875 -28.9375Q147.9062 -28.9375 146.1406 -28.1719Q144.3750 -27.4062 143.3281 -26.0938Q142.2812 -24.7812 142.1562 -23.1250L136.7500 -23.1250Q136.9062 -26.1562 138.6250 -28.5156Q140.3438 -30.8750 143.3125 -32.2500Q146.2812 -33.6250 150.1875 -33.6250Q153.0625 -33.6250 155.3906 -32.8438Q157.7188 -32.0625 159.3594 -30.6250Q161.0000 -29.1875 161.8750 -27.1875Q162.7500 -25.1875 162.7500 -22.7500L162.7500 -0.0000L157.5000 -0.0000L157.5000 -4.6875L157.3750 -4.6875Q156.7812 -3.5000 155.6250 -2.2969Q154.4688 -1.0938 152.5156 -0.2969Q150.5625 0.5000 147.5625 0.5000ZM148.3125 -4.2500Q151.5625 -4.2500 153.5938 -5.4219Q155.6250 -6.5938 156.5625 -8.4688Q157.5000 -10.3438 157.5000 -12.5000L157.5000 -16.6250Q157.1875 -16.3438 156.3594 -16.0938Q155.5312 -15.8438 154.3281 -15.6094Q153.1250 -15.3750 151.7344 -15.1562Q150.3438 -14.9375 148.9375 -14.7500Q147.0312 -14.5000 145.3281 -13.8906Q143.6250 -13.2812 142.5625 -12.1719Q141.5000 -11.0625 141.5000 -9.1875Q141.5000 -7.6562 142.3281 -6.5469Q143.1562 -5.4375 144.6875 -4.8438Q146.2188 -4.2500 148.3125 -4.2500ZM170.6250 13.0625L170.6250 -33.0000L175.8125 -33.0000L175.8125 -28.1250L175.8750 -28.1250Q176.9375 -29.9688 178.5625 -31.1875Q180.1875 -32.4062 182.1875 -33.0156Q184.1875 -33.6250 186.3125 -33.6250Q190.6250 -33.6250 193.8438 -31.4688Q197.0625 -29.3125 198.8438 -25.4531Q200.6250 -21.5938 200.6250 -16.5000Q200.6250 -11.4375 198.8438 -7.5781Q197.0625 -3.7188 193.8438 -1.5469Q190.6250 0.6250 186.3125 0.6250Q184.1875 0.6250 182.2812 0.0156Q180.3750 -0.5938 178.7812 -1.8438Q177.1875 -3.0938 176.0000 -5.0000L175.9375 -5.0000L175.9375 13.0625ZM185.5000 -4.1562Q188.3750 -4.1562 190.5625 -5.5625Q192.7500 -6.9688 194.0000 -9.7188Q195.2500 -12.4688 195.2500 -16.5000Q195.2500 -20.5625 194.0000 -23.3125Q192.7500 -26.0625 190.5625 -27.4688Q188.3750 -28.8750 185.5000 -28.8750Q182.4375 -28.8750 180.1875 -27.3438Q177.9375 -25.8125 176.7188 -23.0312Q175.5000 -20.2500 175.5000 -16.5000Q175.5000 -12.7812 176.7188 -10.0000Q177.9375 -7.2188 180.1875 -5.6875Q182.4375 -4.1562 185.5000 -4.1562Z`})]})}var qa=.035;function Ja(e,t){let n=1e9,r=1e9,i=-1e9,a=-1e9;for(let o of t)for(let t of e[o].blob)for(let[e,o]of t)e<n&&(n=e),o<r&&(r=o),e>i&&(i=e),o>a&&(a=o);return i<n?[0,0,1,1]:[n,r,i,a]}function Ya(e){let t=1e9,n=1e9,r=-1e9,i=-1e9;for(let a of e)for(let[e,o]of a)e<t&&(t=e),o<n&&(n=o),e>r&&(r=e),o>i&&(i=o);return[t,n,r,i]}function Xa(e,t){let n=new Map;for(let r of e){let e=`${Math.floor(r[0]/t)},${Math.floor(r[1]/t)}`,i=n.get(e);i||(i=[],n.set(e,i)),i.push(r)}return n}function Za(e){let t=[];for(let n of e)for(let e of n)t.push(e);return t}function Qa(e,t,n){let r=Ya(e),i=Ya(t);if(r[2]+n<i[0]||i[2]+n<r[0]||r[3]+n<i[1]||i[3]+n<r[1])return!1;let a=Za(e),o=Za(t);if(a.length===0||o.length===0)return!1;let s=Xa(a.length<=o.length?a:o,n),c=a.length<=o.length?o:a,l=n*n;for(let e of c){let t=Math.floor(e[0]/n),r=Math.floor(e[1]/n);for(let n=-1;n<=1;n++)for(let i=-1;i<=1;i++){let a=s.get(`${t+n},${r+i}`);if(a)for(let t of a){let n=e[0]-t[0],r=e[1]-t[1];if(n*n+r*r<l)return!0}}}return!1}function $a(e,t,n){return Qa(e.blob,t.blob,n)}function eo(e){let t=Object.keys(e.districts).filter(t=>B(e.districts[t])!==`unconnected`),n=Ja(e.districts,t),r=(Math.max(n[2]-n[0],n[3]-n[1])||1)*qa,i=new Map;for(let e of t)i.set(+e,[]);for(let n=0;n<t.length;n++)for(let a=n+1;a<t.length;a++)$a(e.districts[t[n]],e.districts[t[a]],r)&&(i.get(+t[n]).push(+t[a]),i.get(+t[a]).push(+t[n]));return{neighbours:i,threshold:r}}function to(e){let{neighbours:t}=eo(e),n=[...t.keys()].sort((t,n)=>e.districts[String(n)].size-e.districts[String(t)].size||t-n),r=new Map,i=[,,,,,,].fill(0);for(let e of n){let n=new Set((t.get(e)??[]).map(e=>r.get(e)).filter(e=>e!=null)),a=-1;for(let e=0;e<6;e++)if(!n.has(e)){a=e;break}if(a===-1){a=0;for(let e=1;e<6;e++)i[e]<i[a]&&(a=e)}r.set(e,a),i[a]++}return r}function B(e){return e.class===`island`||e.class===`unconnected`?e.class:`mainland`}var V=(e,t)=>e.N[t][0],no=(e,t)=>e.N[t][1],ro=(e,t)=>e.N[t][2],io=(e,t)=>e.N[t][3],ao=(e,t)=>e.C?.[t]??io(e,t),oo=(e,t)=>e.N[t][4],so=(e,t)=>e.N[t][5],co=(e,t)=>e.N[t][6],lo=(e,t)=>e.N[t].slice(7);function uo(e,t,n){if(t!==`t`)return[no(e,n),ro(e,n)];let r=lo(e,n);return[r[0]+r[2]/2,r[1]+r[3]/2]}function fo(e,t,n){if(t!==`t`){let t=e.footprint_centroids?.[n];if(t)return t}return uo(e,t,n)}function po(e,t){return e.S?.[String(t)]??[]}function mo(e,t){let n=[1e9,1e9,-1e9,-1e9],r=(e,t)=>{n[0]=Math.min(n[0],e),n[1]=Math.min(n[1],t),n[2]=Math.max(n[2],e),n[3]=Math.max(n[3],t)};for(let n=0;n<e.N.length;n++){if(B(e.districts[String(V(e,n))])===`unconnected`)continue;let i=uo(e,t,n);r(i[0],i[1])}if(t===`r`){for(let t in e.districts)if(B(e.districts[t])!==`unconnected`)for(let n of e.districts[t].blob)for(let e of n)r(e[0],e[1])}else for(let t=0;t<e.N.length;t++){if(B(e.districts[String(V(e,t))])===`unconnected`)continue;let n=lo(e,t);r(n[0]+n[2],n[1]+n[3])}return n[2]<n[0]?[0,0,1,1]:n}function ho(e,t){let n=[1e9,1e9,-1e9,-1e9],r=(e,t)=>{n[0]=Math.min(n[0],e),n[1]=Math.min(n[1],t),n[2]=Math.max(n[2],e),n[3]=Math.max(n[3],t)},i=t=>B(e.districts[String(V(e,t))])===`mainland`;for(let n=0;n<e.N.length;n++){if(!i(n))continue;let a=uo(e,t,n);r(a[0],a[1])}if(t===`r`){for(let t in e.districts)if(B(e.districts[t])===`mainland`)for(let n of e.districts[t].blob)for(let e of n)r(e[0],e[1])}else for(let t=0;t<e.N.length;t++){if(!i(t))continue;let n=lo(e,t);r(n[0]+n[2],n[1]+n[3])}return n[2]<n[0]?mo(e,t):n}var go={left:24,top:12,right:24,bottom:38};function _o(e){return e<=820?{left:16,top:110,right:16,bottom:158}:go}function vo(e,t,n=_o(e)){return[n.left,n.top,e-n.right,t-n.bottom]}function yo(e,t,n,r=_o(e)){let[,i,,a]=vo(e,t,r);return(i+a)/2}function bo(e,t,n,r=_o(t)){let[i,a,o,s]=vo(t,n,r);return Math.min((o-i)/(e[2]-e[0]||1),(s-a)/(e[3]-e[1]||1))}var xo=e=>[1,3,5].map(t=>parseInt(e.slice(t,t+2),16)),So=(e,t,n)=>e.map((e,r)=>Math.round(e+(t[r]-e)*n)),Co=null;function wo(){Co=null,ko=null}var To=.4;function Eo(e,t=To){return Co||=getComputedStyle(document.documentElement),`rgb(${So(xo(Co.getPropertyValue(`--canvas`).trim()),Array.isArray(e)?e:xo(e),t).join(`,`)})`}var Do=[`#3E6E88`,`#B8B06A`,`#C0472F`];function Oo(e){let t=xo(Do[0]),n=xo(Do[1]),r=xo(Do[2]);return Eo(e<.5?So(t,n,e*2):So(n,r,(e-.5)*2))}var ko=null,Ao=[`--H0`,`--H1`,`--H2`,`--H3`,`--H4`,`--H5`];function jo(e){if(ko?.doc===e)return ko;Co||=getComputedStyle(document.documentElement);let t=Ao.map(e=>xo(Co.getPropertyValue(e).trim())),n=xo(Co.getPropertyValue(`--canvas`).trim()),r=to(e),i=new Map;for(let[e,a]of r){let r=So(n,t[a]??t[0],To);i.set(e,`rgb(${r.join(`,`)})`)}return ko={doc:e,mixed:i,assigned:r},ko}function Mo(e,t){let{mixed:n}=jo(e);return n.get(t)??n.get(0)??`#888`}var No=[.3,.4,.5];function Po(e,t,n){if(n==null)return Mo(e,t);let{assigned:r}=jo(e);Co||=getComputedStyle(document.documentElement);let i=Ao.map(e=>xo(Co.getPropertyValue(e).trim())),a=xo(Co.getPropertyValue(`--canvas`).trim()),o=r.get(t)??0,s=No[n]??No[0];return`rgb(${So(a,i[o]??i[0],s).join(`,`)})`}function Fo(e,t){let n=[],r=1;for(let t of e)t[2]>r&&n.push({v:t[2]-r,sm:null}),n.push({v:Math.max(1,t[3]-t[2]+1),sm:t}),r=Math.max(r,t[3]+1);return t>r&&n.push({v:t-r,sm:null}),n.filter(e=>e.v>0)}function Io(e,t,n){let r=e.reduce((e,t)=>e+t.v,0)||1,i=t*n/r,a=e.map(e=>({a:Math.max(e.v*i,1e-4),sm:e.sm})),o=(e,n)=>{let r=n/t;if(r<=0)return 1/0;let i=0;for(let t of e){let e=t.a/r;i+=Math.max(e/r,r/e)}return i/e.length},s=[],c=[],l=0;for(let e of a){if(!c.length){c=[e],l=e.a;continue}o(c.concat(e),l+e.a)<=o(c,l)?(c.push(e),l+=e.a):(s.push({items:c,sum:l}),c=[e],l=e.a)}c.length&&s.push({items:c,sum:l});let u=[],d=0,f=a.reduce((e,t)=>e+t.a,0)||1;for(let e of s){let r=n*(e.sum/f),i=0;for(let n of e.items){let a=t*(n.a/(e.sum||1));u.push({x:i,y:d,w:a,h:r,sm:n.sm}),i+=a}d+=r}return u}function Lo(e){let t=0;for(let n=0;n<e.length;n++){let[r,i]=e[n],[a,o]=e[(n+1)%e.length];t+=r*o-a*i}return Math.abs(t)/2}function Ro(e){let t=0;for(let n of e.blob)t+=Lo(n);return t}function zo(e,t){let n=[1e9,1e9,-1e9,-1e9];for(let r=0;r<e.N.length;r++){if(V(e,r)!==t)continue;let i=lo(e,r);n[0]=Math.min(n[0],i[0]),n[1]=Math.min(n[1],i[1]),n[2]=Math.max(n[2],i[0]+i[2]),n[3]=Math.max(n[3],i[1]+i[3])}return[(n[0]+n[2])/2,(n[1]+n[3])/2]}var Bo=`var(--dim)`,Vo=5,Ho=.15,Uo=.8;function Wo(e){return e.split(`/`).filter(Boolean).slice(0,-1)}function Go(e){if(e.length===0)return 0;let t=0;for(;e.every(n=>t<n.length&&n[t]===e[0][t]);)t++;return t}function Ko(e,t){return e<t?-1:+(e>t)}var qo=null;function Jo(){qo=null}function Yo(e){return qo||=getComputedStyle(document.documentElement),Eo(qo.getPropertyValue(`--p${e%10}`).trim())}function Xo(e,t){return e.slice(0,t).join(`/`)||`.`}function Zo(e,t){let n=new Map,r=e.map(e=>Xo(e,t));for(let e of r)n.set(e,(n.get(e)??0)+1);let i=[...n.entries()].sort((e,t)=>t[1]-e[1]||Ko(e[0],t[0])),a=i.slice(0,10),o=new Map(a.map(([e],t)=>[e,t])),s=a.map(([e,t],n)=>({path:e,count:t,color:Yo(n),other:!1}));return i.length>10&&s.push({path:null,count:i.slice(10).reduce((e,[,t])=>e+t,0),color:Bo,other:!0}),{depth:t,groups:s,filePackages:r,fileColors:r.map(e=>{let t=o.get(e);return t==null?Bo:Yo(t)})}}function Qo(e){return{name:e.name,path:e.path,count:e.count,children:[...e.children.values()].sort((e,t)=>t.count-e.count||Ko(e.path,t.path)).map(Qo)}}function $o(e,t){let n=e.map(e=>t[e]),r=Go(n),i=n[0].slice(0,r);return{path:i.join(`/`)||`.`,parts:i,members:e}}function es(e,t){let n=new Map,r=0;for(let i of e.members){let a=t[i][e.parts.length];if(a==null){r++;continue}let o=n.get(a);o?o.push(i):n.set(a,[i])}return n.size<=1?null:{children:[...n.values()].map(e=>$o(e,t)),directCount:r}}function ts(e,t){if(e.length===0)return[];let n=Go(e.map(e=>t[e])),r=new Map,i=0;for(let a of e){let e=t[a][n];if(e==null){i++;continue}let o=r.get(e);o?o.push(a):r.set(e,[a])}let a=[...r.values()].map(e=>$o(e,t));for(a.length===0&&n>0&&(a=[$o(e,t)],i=0),a.sort((e,t)=>t.members.length-e.members.length||Ko(e.path,t.path)),a.length>Vo&&(i+=a.slice(Vo).reduce((e,t)=>e+t.members.length,0),a=a.slice(0,Vo)),i>(a[0]?.members.length??0)&&(a=[$o(e,t)],i=0);;){let n=a.map(e=>({row:e,split:es(e,t)})).filter(e=>e.split!=null).sort((e,t)=>t.row.members.length-e.row.members.length||Ko(e.row.path,t.row.path)),r=!1;for(let{row:t,split:o}of n){if(t.members.length/e.length<Ho)break;let n=a.filter(e=>e!==t).concat(o.children).sort((e,t)=>t.members.length-e.members.length||Ko(e.path,t.path)),s=n.slice(0,Vo),c=new Set(s);if(o.children.reduce((e,t)=>e+(c.has(t)?t.members.length:0),0)/t.members.length<Uo)continue;let l=i+o.directCount+n.slice(Vo).reduce((e,t)=>e+t.members.length,0);if(!(l>s[0].members.length)){a=s,i=l,r=!0;break}}if(!r)break}let o=a.map(t=>({path:t.path,count:t.members.length,share:Math.round(t.members.length/e.length*1e3)/10,other:!1})).sort((e,t)=>t.count-e.count||Ko(e.path??``,t.path??``));return i>0&&o.push({path:null,count:i,share:Math.round(i/e.length*1e3)/10,other:!0}),o}function ns(e){let t=e.F.map(Wo),n=Math.max(1,...t.map(e=>e.length)),r=Go(t),i=Math.min(n,r+1),a=new Map;for(let e=i;e<=n;e++)a.set(e,Zo(t,e));let o=i;for(;o<n&&(a.get(o)?.groups.length??0)<3;)o++;let s=new Map,c=new Map;c.set(`.`,e.F.map((e,t)=>t));for(let e=0;e<t.length;e++){let n=t[e],r=s,i=``;for(let t of n){i=i?`${i}/${t}`:t;let n=r.get(t);n||(n={name:t,path:i,count:0,children:new Map},r.set(t,n)),n.count++;let a=c.get(i);a?a.push(e):c.set(i,[e]),r=n.children}}let l=[...s.values()].sort((e,t)=>t.count-e.count||Ko(e.path,t.path)).map(Qo),u=[],d=e=>{u.push(e),e.children.forEach(d)};l.forEach(d);let f=new Map([...c].map(([e,t])=>[e,new Set(t)])),p=new Set([...c].filter(([,t])=>t.every(t=>B(e.districts[String(V(e,t))])===`island`)).map(([e])=>e)),m=new Map;for(let t=0;t<e.N.length;t++){let n=V(e,t),r=m.get(n);r?r.push(t):m.set(n,[t])}let h=new Map;for(let[e,n]of m)h.set(e,ts(n,t));let g=[];for(let[t,n]of h){if(B(e.districts[String(t)])!==`mainland`)continue;let r=m.get(t).length,i=Math.sqrt(Ro(e.districts[String(t)]));for(let a of n.filter(e=>!e.other&&e.count/r>=.08).slice(0,4)){let n=m.get(t).filter(t=>a.path===`.`||e.F[t].startsWith(`${a.path}/`));if(!n.length)continue;let r=n.map(t=>e.N[t][1]).sort((e,t)=>e-t),o=n.map(t=>e.N[t][2]).sort((e,t)=>e-t),s=e=>(e[e.length-1>>1]+e[e.length>>1])/2,c=a.path.split(`/`);g.push({district:t,path:a.path,x:s(r),y:s(o),worldSide:i,longText:c.slice(-2).join(`/`).toLowerCase()+`/`,shortText:c.at(-1).toLowerCase()+`/`})}}let _=e.N.flatMap((t,n)=>B(e.districts[String(t[0])])===`unconnected`?[n]:[]),v=new Map;for(let t of _){let n=e.F[t].split(`/`).slice(0,-1).join(`/`)||`.`,r=v.get(n)??[];r.push(t),v.set(n,r)}let y=[...v].sort((e,t)=>t[1].length-e[1].length||Ko(e[0],t[0])).map(([e,t])=>({path:e,files:t}));return{autoDepth:o,minDepth:i,maxDepth:n,groupings:a,directoryRoots:l,directories:u,filesByDirectory:f,islandOnlyDirectories:p,districtPaths:h,folderLabels:g,unconnectedFiles:_,unconnectedGroups:y}}function rs(e){return e===`.`?`(repo root)`:`${e}/`}var is={system:`light`,light:`dark`,dark:`system`};function as(e){return is[e]}var os=`tolmap:theme`,ss=`tolmap:theme-change`;function cs(e){return e===`system`||e===`light`||e===`dark`}function ls(){try{let e=window.localStorage.getItem(os);return cs(e)?e:`system`}catch{return`system`}}function us(e){try{window.localStorage.setItem(os,e)}catch{}}function ds(){return matchMedia(`(prefers-color-scheme: dark)`).matches}function fs(e){return e===`system`?ds()?`dark`:`light`:e}function ps(e){e===`system`?document.documentElement.removeAttribute(`data-theme`):document.documentElement.dataset.theme=e}function ms(e){ps(e),us(e),wo(),Jo(),window.dispatchEvent(new Event(ss))}function hs(e){let t=()=>{wo(),Jo(),e()};window.addEventListener(ss,t),window.addEventListener(`storage`,t);let n=matchMedia(`(prefers-color-scheme: dark)`);return n.addEventListener(`change`,t),()=>{window.removeEventListener(ss,t),window.removeEventListener(`storage`,t),n.removeEventListener(`change`,t)}}function gs(){return[(0,_.useSyncExternalStore)(hs,ls,()=>`system`),ms]}function _s(){return fs((0,_.useSyncExternalStore)(hs,ls,()=>`system`))}function vs(e){var t,n,r=``;if(typeof e==`string`||typeof e==`number`)r+=e;else if(typeof e==`object`){if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(n=vs(e[t]))&&(r&&(r+=` `),r+=n)}else for(n in e)e[n]&&(r&&(r+=` `),r+=n)}return r}function ys(){for(var e,t,n=0,r=``,i=arguments.length;n<i;n++)(e=arguments[n])&&(t=vs(e))&&(r&&(r+=` `),r+=t);return r}var bs=`-`,xs=e=>{let t=Ts(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:e=>{let n=e.split(bs);return n[0]===``&&n.length!==1&&n.shift(),Ss(n,t)||ws(e)},getConflictingClassGroupIds:(e,t)=>{let i=n[e]||[];return t&&r[e]?[...i,...r[e]]:i}}},Ss=(e,t)=>{if(e.length===0)return t.classGroupId;let n=e[0],r=t.nextPart.get(n),i=r?Ss(e.slice(1),r):void 0;if(i)return i;if(t.validators.length===0)return;let a=e.join(bs);return t.validators.find(({validator:e})=>e(a))?.classGroupId},Cs=/^\[(.+)\]$/,ws=e=>{if(Cs.test(e)){let t=Cs.exec(e)[1],n=t?.substring(0,t.indexOf(`:`));if(n)return`arbitrary..`+n}},Ts=e=>{let{theme:t,prefix:n}=e,r={nextPart:new Map,validators:[]};return ks(Object.entries(e.classGroups),n).forEach(([e,n])=>{Es(n,r,e,t)}),r},Es=(e,t,n,r)=>{e.forEach(e=>{if(typeof e==`string`){let r=e===``?t:Ds(t,e);r.classGroupId=n;return}if(typeof e==`function`){if(Os(e)){Es(e(r),t,n,r);return}t.validators.push({validator:e,classGroupId:n});return}Object.entries(e).forEach(([e,i])=>{Es(i,Ds(t,e),n,r)})})},Ds=(e,t)=>{let n=e;return t.split(bs).forEach(e=>{n.nextPart.has(e)||n.nextPart.set(e,{nextPart:new Map,validators:[]}),n=n.nextPart.get(e)}),n},Os=e=>e.isThemeGetter,ks=(e,t)=>t?e.map(([e,n])=>[e,n.map(e=>typeof e==`string`?t+e:typeof e==`object`?Object.fromEntries(Object.entries(e).map(([e,n])=>[t+e,n])):e)]):e,As=e=>{if(e<1)return{get:()=>void 0,set:()=>{}};let t=0,n=new Map,r=new Map,i=(i,a)=>{n.set(i,a),t++,t>e&&(t=0,r=n,n=new Map)};return{get(e){let t=n.get(e);if(t!==void 0)return t;if((t=r.get(e))!==void 0)return i(e,t),t},set(e,t){n.has(e)?n.set(e,t):i(e,t)}}},js=`!`,Ms=e=>{let{separator:t,experimentalParseClassName:n}=e,r=t.length===1,i=t[0],a=t.length,o=e=>{let n=[],o=0,s=0,c;for(let l=0;l<e.length;l++){let u=e[l];if(o===0){if(u===i&&(r||e.slice(l,l+a)===t)){n.push(e.slice(s,l)),s=l+a;continue}if(u===`/`){c=l;continue}}u===`[`?o++:u===`]`&&o--}let l=n.length===0?e:e.substring(s),u=l.startsWith(js);return{modifiers:n,hasImportantModifier:u,baseClassName:u?l.substring(1):l,maybePostfixModifierPosition:c&&c>s?c-s:void 0}};return n?e=>n({className:e,parseClassName:o}):o},Ns=e=>{if(e.length<=1)return e;let t=[],n=[];return e.forEach(e=>{e[0]===`[`?(t.push(...n.sort(),e),n=[]):n.push(e)}),t.push(...n.sort()),t},Ps=e=>({cache:As(e.cacheSize),parseClassName:Ms(e),...xs(e)}),Fs=/\s+/,Is=(e,t)=>{let{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:i}=t,a=[],o=e.trim().split(Fs),s=``;for(let e=o.length-1;e>=0;--e){let t=o[e],{modifiers:c,hasImportantModifier:l,baseClassName:u,maybePostfixModifierPosition:d}=n(t),f=!!d,p=r(f?u.substring(0,d):u);if(!p){if(!f){s=t+(s.length>0?` `+s:s);continue}if(p=r(u),!p){s=t+(s.length>0?` `+s:s);continue}f=!1}let m=Ns(c).join(`:`),h=l?m+js:m,g=h+p;if(a.includes(g))continue;a.push(g);let _=i(p,f);for(let e=0;e<_.length;++e){let t=_[e];a.push(h+t)}s=t+(s.length>0?` `+s:s)}return s};function Ls(){let e=0,t,n,r=``;for(;e<arguments.length;)(t=arguments[e++])&&(n=Rs(t))&&(r&&(r+=` `),r+=n);return r}var Rs=e=>{if(typeof e==`string`)return e;let t,n=``;for(let r=0;r<e.length;r++)e[r]&&(t=Rs(e[r]))&&(n&&(n+=` `),n+=t);return n};function zs(e,...t){let n,r,i,a=o;function o(o){return n=Ps(t.reduce((e,t)=>t(e),e())),r=n.cache.get,i=n.cache.set,a=s,s(o)}function s(e){let t=r(e);if(t)return t;let a=Is(e,n);return i(e,a),a}return function(){return a(Ls.apply(null,arguments))}}var Bs=e=>{let t=t=>t[e]||[];return t.isThemeGetter=!0,t},Vs=/^\[(?:([a-z-]+):)?(.+)\]$/i,Hs=/^\d+\/\d+$/,Us=new Set([`px`,`full`,`screen`]),Ws=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Gs=/\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$/,Ks=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,qs=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,Js=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Ys=e=>Zs(e)||Us.has(e)||Hs.test(e),Xs=e=>lc(e,`length`,uc),Zs=e=>!!e&&!Number.isNaN(Number(e)),Qs=e=>lc(e,`number`,Zs),$s=e=>!!e&&Number.isInteger(Number(e)),ec=e=>e.endsWith(`%`)&&Zs(e.slice(0,-1)),H=e=>Vs.test(e),tc=e=>Ws.test(e),nc=new Set([`length`,`size`,`percentage`]),rc=e=>lc(e,nc,dc),ic=e=>lc(e,`position`,dc),ac=new Set([`image`,`url`]),oc=e=>lc(e,ac,pc),sc=e=>lc(e,``,fc),cc=()=>!0,lc=(e,t,n)=>{let r=Vs.exec(e);return r?r[1]?typeof t==`string`?r[1]===t:t.has(r[1]):n(r[2]):!1},uc=e=>Gs.test(e)&&!Ks.test(e),dc=()=>!1,fc=e=>qs.test(e),pc=e=>Js.test(e),mc=()=>{let e=Bs(`colors`),t=Bs(`spacing`),n=Bs(`blur`),r=Bs(`brightness`),i=Bs(`borderColor`),a=Bs(`borderRadius`),o=Bs(`borderSpacing`),s=Bs(`borderWidth`),c=Bs(`contrast`),l=Bs(`grayscale`),u=Bs(`hueRotate`),d=Bs(`invert`),f=Bs(`gap`),p=Bs(`gradientColorStops`),m=Bs(`gradientColorStopPositions`),h=Bs(`inset`),g=Bs(`margin`),_=Bs(`opacity`),v=Bs(`padding`),y=Bs(`saturate`),b=Bs(`scale`),x=Bs(`sepia`),S=Bs(`skew`),C=Bs(`space`),w=Bs(`translate`),T=()=>[`auto`,`contain`,`none`],E=()=>[`auto`,`hidden`,`clip`,`visible`,`scroll`],D=()=>[`auto`,H,t],O=()=>[H,t],k=()=>[``,Ys,Xs],ee=()=>[`auto`,Zs,H],A=()=>[`bottom`,`center`,`left`,`left-bottom`,`left-top`,`right`,`right-bottom`,`right-top`,`top`],j=()=>[`solid`,`dashed`,`dotted`,`double`,`none`],M=()=>[`normal`,`multiply`,`screen`,`overlay`,`darken`,`lighten`,`color-dodge`,`color-burn`,`hard-light`,`soft-light`,`difference`,`exclusion`,`hue`,`saturation`,`color`,`luminosity`],N=()=>[`start`,`end`,`center`,`between`,`around`,`evenly`,`stretch`],te=()=>[``,`0`,H],ne=()=>[`auto`,`avoid`,`all`,`avoid-page`,`page`,`left`,`right`,`column`],P=()=>[Zs,H];return{cacheSize:500,separator:`:`,theme:{colors:[cc],spacing:[Ys,Xs],blur:[`none`,``,tc,H],brightness:P(),borderColor:[e],borderRadius:[`none`,``,`full`,tc,H],borderSpacing:O(),borderWidth:k(),contrast:P(),grayscale:te(),hueRotate:P(),invert:te(),gap:O(),gradientColorStops:[e],gradientColorStopPositions:[ec,Xs],inset:D(),margin:D(),opacity:P(),padding:O(),saturate:P(),scale:P(),sepia:te(),skew:P(),space:O(),translate:O()},classGroups:{aspect:[{aspect:[`auto`,`square`,`video`,H]}],container:[`container`],columns:[{columns:[tc]}],"break-after":[{"break-after":ne()}],"break-before":[{"break-before":ne()}],"break-inside":[{"break-inside":[`auto`,`avoid`,`avoid-page`,`avoid-column`]}],"box-decoration":[{"box-decoration":[`slice`,`clone`]}],box:[{box:[`border`,`content`]}],display:[`block`,`inline-block`,`inline`,`flex`,`inline-flex`,`table`,`inline-table`,`table-caption`,`table-cell`,`table-column`,`table-column-group`,`table-footer-group`,`table-header-group`,`table-row-group`,`table-row`,`flow-root`,`grid`,`inline-grid`,`contents`,`list-item`,`hidden`],float:[{float:[`right`,`left`,`none`,`start`,`end`]}],clear:[{clear:[`left`,`right`,`both`,`none`,`start`,`end`]}],isolation:[`isolate`,`isolation-auto`],"object-fit":[{object:[`contain`,`cover`,`fill`,`none`,`scale-down`]}],"object-position":[{object:[...A(),H]}],overflow:[{overflow:E()}],"overflow-x":[{"overflow-x":E()}],"overflow-y":[{"overflow-y":E()}],overscroll:[{overscroll:T()}],"overscroll-x":[{"overscroll-x":T()}],"overscroll-y":[{"overscroll-y":T()}],position:[`static`,`fixed`,`absolute`,`relative`,`sticky`],inset:[{inset:[h]}],"inset-x":[{"inset-x":[h]}],"inset-y":[{"inset-y":[h]}],start:[{start:[h]}],end:[{end:[h]}],top:[{top:[h]}],right:[{right:[h]}],bottom:[{bottom:[h]}],left:[{left:[h]}],visibility:[`visible`,`invisible`,`collapse`],z:[{z:[`auto`,$s,H]}],basis:[{basis:D()}],"flex-direction":[{flex:[`row`,`row-reverse`,`col`,`col-reverse`]}],"flex-wrap":[{flex:[`wrap`,`wrap-reverse`,`nowrap`]}],flex:[{flex:[`1`,`auto`,`initial`,`none`,H]}],grow:[{grow:te()}],shrink:[{shrink:te()}],order:[{order:[`first`,`last`,`none`,$s,H]}],"grid-cols":[{"grid-cols":[cc]}],"col-start-end":[{col:[`auto`,{span:[`full`,$s,H]},H]}],"col-start":[{"col-start":ee()}],"col-end":[{"col-end":ee()}],"grid-rows":[{"grid-rows":[cc]}],"row-start-end":[{row:[`auto`,{span:[$s,H]},H]}],"row-start":[{"row-start":ee()}],"row-end":[{"row-end":ee()}],"grid-flow":[{"grid-flow":[`row`,`col`,`dense`,`row-dense`,`col-dense`]}],"auto-cols":[{"auto-cols":[`auto`,`min`,`max`,`fr`,H]}],"auto-rows":[{"auto-rows":[`auto`,`min`,`max`,`fr`,H]}],gap:[{gap:[f]}],"gap-x":[{"gap-x":[f]}],"gap-y":[{"gap-y":[f]}],"justify-content":[{justify:[`normal`,...N()]}],"justify-items":[{"justify-items":[`start`,`end`,`center`,`stretch`]}],"justify-self":[{"justify-self":[`auto`,`start`,`end`,`center`,`stretch`]}],"align-content":[{content:[`normal`,...N(),`baseline`]}],"align-items":[{items:[`start`,`end`,`center`,`baseline`,`stretch`]}],"align-self":[{self:[`auto`,`start`,`end`,`center`,`stretch`,`baseline`]}],"place-content":[{"place-content":[...N(),`baseline`]}],"place-items":[{"place-items":[`start`,`end`,`center`,`baseline`,`stretch`]}],"place-self":[{"place-self":[`auto`,`start`,`end`,`center`,`stretch`]}],p:[{p:[v]}],px:[{px:[v]}],py:[{py:[v]}],ps:[{ps:[v]}],pe:[{pe:[v]}],pt:[{pt:[v]}],pr:[{pr:[v]}],pb:[{pb:[v]}],pl:[{pl:[v]}],m:[{m:[g]}],mx:[{mx:[g]}],my:[{my:[g]}],ms:[{ms:[g]}],me:[{me:[g]}],mt:[{mt:[g]}],mr:[{mr:[g]}],mb:[{mb:[g]}],ml:[{ml:[g]}],"space-x":[{"space-x":[C]}],"space-x-reverse":[`space-x-reverse`],"space-y":[{"space-y":[C]}],"space-y-reverse":[`space-y-reverse`],w:[{w:[`auto`,`min`,`max`,`fit`,`svw`,`lvw`,`dvw`,H,t]}],"min-w":[{"min-w":[H,t,`min`,`max`,`fit`]}],"max-w":[{"max-w":[H,t,`none`,`full`,`min`,`max`,`fit`,`prose`,{screen:[tc]},tc]}],h:[{h:[H,t,`auto`,`min`,`max`,`fit`,`svh`,`lvh`,`dvh`]}],"min-h":[{"min-h":[H,t,`min`,`max`,`fit`,`svh`,`lvh`,`dvh`]}],"max-h":[{"max-h":[H,t,`min`,`max`,`fit`,`svh`,`lvh`,`dvh`]}],size:[{size:[H,t,`auto`,`min`,`max`,`fit`]}],"font-size":[{text:[`base`,tc,Xs]}],"font-smoothing":[`antialiased`,`subpixel-antialiased`],"font-style":[`italic`,`not-italic`],"font-weight":[{font:[`thin`,`extralight`,`light`,`normal`,`medium`,`semibold`,`bold`,`extrabold`,`black`,Qs]}],"font-family":[{font:[cc]}],"fvn-normal":[`normal-nums`],"fvn-ordinal":[`ordinal`],"fvn-slashed-zero":[`slashed-zero`],"fvn-figure":[`lining-nums`,`oldstyle-nums`],"fvn-spacing":[`proportional-nums`,`tabular-nums`],"fvn-fraction":[`diagonal-fractions`,`stacked-fractions`],tracking:[{tracking:[`tighter`,`tight`,`normal`,`wide`,`wider`,`widest`,H]}],"line-clamp":[{"line-clamp":[`none`,Zs,Qs]}],leading:[{leading:[`none`,`tight`,`snug`,`normal`,`relaxed`,`loose`,Ys,H]}],"list-image":[{"list-image":[`none`,H]}],"list-style-type":[{list:[`none`,`disc`,`decimal`,H]}],"list-style-position":[{list:[`inside`,`outside`]}],"placeholder-color":[{placeholder:[e]}],"placeholder-opacity":[{"placeholder-opacity":[_]}],"text-alignment":[{text:[`left`,`center`,`right`,`justify`,`start`,`end`]}],"text-color":[{text:[e]}],"text-opacity":[{"text-opacity":[_]}],"text-decoration":[`underline`,`overline`,`line-through`,`no-underline`],"text-decoration-style":[{decoration:[...j(),`wavy`]}],"text-decoration-thickness":[{decoration:[`auto`,`from-font`,Ys,Xs]}],"underline-offset":[{"underline-offset":[`auto`,Ys,H]}],"text-decoration-color":[{decoration:[e]}],"text-transform":[`uppercase`,`lowercase`,`capitalize`,`normal-case`],"text-overflow":[`truncate`,`text-ellipsis`,`text-clip`],"text-wrap":[{text:[`wrap`,`nowrap`,`balance`,`pretty`]}],indent:[{indent:O()}],"vertical-align":[{align:[`baseline`,`top`,`middle`,`bottom`,`text-top`,`text-bottom`,`sub`,`super`,H]}],whitespace:[{whitespace:[`normal`,`nowrap`,`pre`,`pre-line`,`pre-wrap`,`break-spaces`]}],break:[{break:[`normal`,`words`,`all`,`keep`]}],hyphens:[{hyphens:[`none`,`manual`,`auto`]}],content:[{content:[`none`,H]}],"bg-attachment":[{bg:[`fixed`,`local`,`scroll`]}],"bg-clip":[{"bg-clip":[`border`,`padding`,`content`,`text`]}],"bg-opacity":[{"bg-opacity":[_]}],"bg-origin":[{"bg-origin":[`border`,`padding`,`content`]}],"bg-position":[{bg:[...A(),ic]}],"bg-repeat":[{bg:[`no-repeat`,{repeat:[``,`x`,`y`,`round`,`space`]}]}],"bg-size":[{bg:[`auto`,`cover`,`contain`,rc]}],"bg-image":[{bg:[`none`,{"gradient-to":[`t`,`tr`,`r`,`br`,`b`,`bl`,`l`,`tl`]},oc]}],"bg-color":[{bg:[e]}],"gradient-from-pos":[{from:[m]}],"gradient-via-pos":[{via:[m]}],"gradient-to-pos":[{to:[m]}],"gradient-from":[{from:[p]}],"gradient-via":[{via:[p]}],"gradient-to":[{to:[p]}],rounded:[{rounded:[a]}],"rounded-s":[{"rounded-s":[a]}],"rounded-e":[{"rounded-e":[a]}],"rounded-t":[{"rounded-t":[a]}],"rounded-r":[{"rounded-r":[a]}],"rounded-b":[{"rounded-b":[a]}],"rounded-l":[{"rounded-l":[a]}],"rounded-ss":[{"rounded-ss":[a]}],"rounded-se":[{"rounded-se":[a]}],"rounded-ee":[{"rounded-ee":[a]}],"rounded-es":[{"rounded-es":[a]}],"rounded-tl":[{"rounded-tl":[a]}],"rounded-tr":[{"rounded-tr":[a]}],"rounded-br":[{"rounded-br":[a]}],"rounded-bl":[{"rounded-bl":[a]}],"border-w":[{border:[s]}],"border-w-x":[{"border-x":[s]}],"border-w-y":[{"border-y":[s]}],"border-w-s":[{"border-s":[s]}],"border-w-e":[{"border-e":[s]}],"border-w-t":[{"border-t":[s]}],"border-w-r":[{"border-r":[s]}],"border-w-b":[{"border-b":[s]}],"border-w-l":[{"border-l":[s]}],"border-opacity":[{"border-opacity":[_]}],"border-style":[{border:[...j(),`hidden`]}],"divide-x":[{"divide-x":[s]}],"divide-x-reverse":[`divide-x-reverse`],"divide-y":[{"divide-y":[s]}],"divide-y-reverse":[`divide-y-reverse`],"divide-opacity":[{"divide-opacity":[_]}],"divide-style":[{divide:j()}],"border-color":[{border:[i]}],"border-color-x":[{"border-x":[i]}],"border-color-y":[{"border-y":[i]}],"border-color-s":[{"border-s":[i]}],"border-color-e":[{"border-e":[i]}],"border-color-t":[{"border-t":[i]}],"border-color-r":[{"border-r":[i]}],"border-color-b":[{"border-b":[i]}],"border-color-l":[{"border-l":[i]}],"divide-color":[{divide:[i]}],"outline-style":[{outline:[``,...j()]}],"outline-offset":[{"outline-offset":[Ys,H]}],"outline-w":[{outline:[Ys,Xs]}],"outline-color":[{outline:[e]}],"ring-w":[{ring:k()}],"ring-w-inset":[`ring-inset`],"ring-color":[{ring:[e]}],"ring-opacity":[{"ring-opacity":[_]}],"ring-offset-w":[{"ring-offset":[Ys,Xs]}],"ring-offset-color":[{"ring-offset":[e]}],shadow:[{shadow:[``,`inner`,`none`,tc,sc]}],"shadow-color":[{shadow:[cc]}],opacity:[{opacity:[_]}],"mix-blend":[{"mix-blend":[...M(),`plus-lighter`,`plus-darker`]}],"bg-blend":[{"bg-blend":M()}],filter:[{filter:[``,`none`]}],blur:[{blur:[n]}],brightness:[{brightness:[r]}],contrast:[{contrast:[c]}],"drop-shadow":[{"drop-shadow":[``,`none`,tc,H]}],grayscale:[{grayscale:[l]}],"hue-rotate":[{"hue-rotate":[u]}],invert:[{invert:[d]}],saturate:[{saturate:[y]}],sepia:[{sepia:[x]}],"backdrop-filter":[{"backdrop-filter":[``,`none`]}],"backdrop-blur":[{"backdrop-blur":[n]}],"backdrop-brightness":[{"backdrop-brightness":[r]}],"backdrop-contrast":[{"backdrop-contrast":[c]}],"backdrop-grayscale":[{"backdrop-grayscale":[l]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[u]}],"backdrop-invert":[{"backdrop-invert":[d]}],"backdrop-opacity":[{"backdrop-opacity":[_]}],"backdrop-saturate":[{"backdrop-saturate":[y]}],"backdrop-sepia":[{"backdrop-sepia":[x]}],"border-collapse":[{border:[`collapse`,`separate`]}],"border-spacing":[{"border-spacing":[o]}],"border-spacing-x":[{"border-spacing-x":[o]}],"border-spacing-y":[{"border-spacing-y":[o]}],"table-layout":[{table:[`auto`,`fixed`]}],caption:[{caption:[`top`,`bottom`]}],transition:[{transition:[`none`,`all`,``,`colors`,`opacity`,`shadow`,`transform`,H]}],duration:[{duration:P()}],ease:[{ease:[`linear`,`in`,`out`,`in-out`,H]}],delay:[{delay:P()}],animate:[{animate:[`none`,`spin`,`ping`,`pulse`,`bounce`,H]}],transform:[{transform:[``,`gpu`,`none`]}],scale:[{scale:[b]}],"scale-x":[{"scale-x":[b]}],"scale-y":[{"scale-y":[b]}],rotate:[{rotate:[$s,H]}],"translate-x":[{"translate-x":[w]}],"translate-y":[{"translate-y":[w]}],"skew-x":[{"skew-x":[S]}],"skew-y":[{"skew-y":[S]}],"transform-origin":[{origin:[`center`,`top`,`top-right`,`right`,`bottom-right`,`bottom`,`bottom-left`,`left`,`top-left`,H]}],accent:[{accent:[`auto`,e]}],appearance:[{appearance:[`none`,`auto`]}],cursor:[{cursor:[`auto`,`default`,`pointer`,`wait`,`text`,`move`,`help`,`not-allowed`,`none`,`context-menu`,`progress`,`cell`,`crosshair`,`vertical-text`,`alias`,`copy`,`no-drop`,`grab`,`grabbing`,`all-scroll`,`col-resize`,`row-resize`,`n-resize`,`e-resize`,`s-resize`,`w-resize`,`ne-resize`,`nw-resize`,`se-resize`,`sw-resize`,`ew-resize`,`ns-resize`,`nesw-resize`,`nwse-resize`,`zoom-in`,`zoom-out`,H]}],"caret-color":[{caret:[e]}],"pointer-events":[{"pointer-events":[`none`,`auto`]}],resize:[{resize:[`none`,`y`,`x`,``]}],"scroll-behavior":[{scroll:[`auto`,`smooth`]}],"scroll-m":[{"scroll-m":O()}],"scroll-mx":[{"scroll-mx":O()}],"scroll-my":[{"scroll-my":O()}],"scroll-ms":[{"scroll-ms":O()}],"scroll-me":[{"scroll-me":O()}],"scroll-mt":[{"scroll-mt":O()}],"scroll-mr":[{"scroll-mr":O()}],"scroll-mb":[{"scroll-mb":O()}],"scroll-ml":[{"scroll-ml":O()}],"scroll-p":[{"scroll-p":O()}],"scroll-px":[{"scroll-px":O()}],"scroll-py":[{"scroll-py":O()}],"scroll-ps":[{"scroll-ps":O()}],"scroll-pe":[{"scroll-pe":O()}],"scroll-pt":[{"scroll-pt":O()}],"scroll-pr":[{"scroll-pr":O()}],"scroll-pb":[{"scroll-pb":O()}],"scroll-pl":[{"scroll-pl":O()}],"snap-align":[{snap:[`start`,`end`,`center`,`align-none`]}],"snap-stop":[{snap:[`normal`,`always`]}],"snap-type":[{snap:[`none`,`x`,`y`,`both`]}],"snap-strictness":[{snap:[`mandatory`,`proximity`]}],touch:[{touch:[`auto`,`none`,`manipulation`]}],"touch-x":[{"touch-pan":[`x`,`left`,`right`]}],"touch-y":[{"touch-pan":[`y`,`up`,`down`]}],"touch-pz":[`touch-pinch-zoom`],select:[{select:[`none`,`text`,`all`,`auto`]}],"will-change":[{"will-change":[`auto`,`scroll`,`contents`,`transform`,H]}],fill:[{fill:[e,`none`]}],"stroke-w":[{stroke:[Ys,Xs,Qs]}],stroke:[{stroke:[e,`none`]}],sr:[`sr-only`,`not-sr-only`],"forced-color-adjust":[{"forced-color-adjust":[`auto`,`none`]}]},conflictingClassGroups:{overflow:[`overflow-x`,`overflow-y`],overscroll:[`overscroll-x`,`overscroll-y`],inset:[`inset-x`,`inset-y`,`start`,`end`,`top`,`right`,`bottom`,`left`],"inset-x":[`right`,`left`],"inset-y":[`top`,`bottom`],flex:[`basis`,`grow`,`shrink`],gap:[`gap-x`,`gap-y`],p:[`px`,`py`,`ps`,`pe`,`pt`,`pr`,`pb`,`pl`],px:[`pr`,`pl`],py:[`pt`,`pb`],m:[`mx`,`my`,`ms`,`me`,`mt`,`mr`,`mb`,`ml`],mx:[`mr`,`ml`],my:[`mt`,`mb`],size:[`w`,`h`],"font-size":[`leading`],"fvn-normal":[`fvn-ordinal`,`fvn-slashed-zero`,`fvn-figure`,`fvn-spacing`,`fvn-fraction`],"fvn-ordinal":[`fvn-normal`],"fvn-slashed-zero":[`fvn-normal`],"fvn-figure":[`fvn-normal`],"fvn-spacing":[`fvn-normal`],"fvn-fraction":[`fvn-normal`],"line-clamp":[`display`,`overflow`],rounded:[`rounded-s`,`rounded-e`,`rounded-t`,`rounded-r`,`rounded-b`,`rounded-l`,`rounded-ss`,`rounded-se`,`rounded-ee`,`rounded-es`,`rounded-tl`,`rounded-tr`,`rounded-br`,`rounded-bl`],"rounded-s":[`rounded-ss`,`rounded-es`],"rounded-e":[`rounded-se`,`rounded-ee`],"rounded-t":[`rounded-tl`,`rounded-tr`],"rounded-r":[`rounded-tr`,`rounded-br`],"rounded-b":[`rounded-br`,`rounded-bl`],"rounded-l":[`rounded-tl`,`rounded-bl`],"border-spacing":[`border-spacing-x`,`border-spacing-y`],"border-w":[`border-w-s`,`border-w-e`,`border-w-t`,`border-w-r`,`border-w-b`,`border-w-l`],"border-w-x":[`border-w-r`,`border-w-l`],"border-w-y":[`border-w-t`,`border-w-b`],"border-color":[`border-color-s`,`border-color-e`,`border-color-t`,`border-color-r`,`border-color-b`,`border-color-l`],"border-color-x":[`border-color-r`,`border-color-l`],"border-color-y":[`border-color-t`,`border-color-b`],"scroll-m":[`scroll-mx`,`scroll-my`,`scroll-ms`,`scroll-me`,`scroll-mt`,`scroll-mr`,`scroll-mb`,`scroll-ml`],"scroll-mx":[`scroll-mr`,`scroll-ml`],"scroll-my":[`scroll-mt`,`scroll-mb`],"scroll-p":[`scroll-px`,`scroll-py`,`scroll-ps`,`scroll-pe`,`scroll-pt`,`scroll-pr`,`scroll-pb`,`scroll-pl`],"scroll-px":[`scroll-pr`,`scroll-pl`],"scroll-py":[`scroll-pt`,`scroll-pb`],touch:[`touch-x`,`touch-y`,`touch-pz`],"touch-x":[`touch`],"touch-y":[`touch`],"touch-pz":[`touch`]},conflictingClassGroupModifiers:{"font-size":[`leading`]}}},hc=(e,{cacheSize:t,prefix:n,separator:r,experimentalParseClassName:i,extend:a={},override:o={}})=>{gc(e,`cacheSize`,t),gc(e,`prefix`,n),gc(e,`separator`,r),gc(e,`experimentalParseClassName`,i);for(let t in o)_c(e[t],o[t]);for(let t in a)vc(e[t],a[t]);return e},gc=(e,t,n)=>{n!==void 0&&(e[t]=n)},_c=(e,t)=>{if(t)for(let n in t)gc(e,n,t[n])},vc=(e,t)=>{if(t)for(let n in t){let r=t[n];r!==void 0&&(e[n]=(e[n]||[]).concat(r))}},yc=((e,...t)=>typeof e==`function`?zs(mc,e,...t):zs(()=>hc(mc(),e),...t))({extend:{classGroups:{"font-size":[{text:[`title`,`sheet-title`,`section-title`,`row`,`body`,`small`,`meta`,`label`]}]}}});function bc(...e){return yc(ys(e))}var U={system:`System`,light:`Light`,dark:`Dark`};function xc(e){return{width:e,height:e,viewBox:`0 0 15 15`,fill:`none`,stroke:`currentColor`,strokeWidth:1.3,strokeLinecap:`round`,strokeLinejoin:`round`}}function Sc({size:e}){return(0,b.jsxs)(`svg`,{...xc(e),"aria-hidden":`true`,children:[(0,b.jsx)(`circle`,{cx:`7.5`,cy:`7.5`,r:`2.6`}),(0,b.jsx)(`line`,{x1:`7.5`,y1:`0.9`,x2:`7.5`,y2:`2.4`}),(0,b.jsx)(`line`,{x1:`7.5`,y1:`12.6`,x2:`7.5`,y2:`14.1`}),(0,b.jsx)(`line`,{x1:`0.9`,y1:`7.5`,x2:`2.4`,y2:`7.5`}),(0,b.jsx)(`line`,{x1:`12.6`,y1:`7.5`,x2:`14.1`,y2:`7.5`}),(0,b.jsx)(`line`,{x1:`2.7`,y1:`2.7`,x2:`3.75`,y2:`3.75`}),(0,b.jsx)(`line`,{x1:`11.25`,y1:`11.25`,x2:`12.3`,y2:`12.3`}),(0,b.jsx)(`line`,{x1:`12.3`,y1:`2.7`,x2:`11.25`,y2:`3.75`}),(0,b.jsx)(`line`,{x1:`3.75`,y1:`11.25`,x2:`2.7`,y2:`12.3`})]})}function Cc({size:e}){return(0,b.jsx)(`svg`,{...xc(e),"aria-hidden":`true`,children:(0,b.jsx)(`path`,{d:`M 12.6 9.4 A 5.4 5.4 0 1 1 5.6 2.4 A 6.6 6.6 0 0 0 12.6 9.4 Z`,strokeLinejoin:`round`})})}function wc({size:e}){return(0,b.jsxs)(`svg`,{...xc(e),"aria-hidden":`true`,children:[(0,b.jsx)(`rect`,{x:`1.4`,y:`2.4`,width:`12.2`,height:`8`,rx:`1`}),(0,b.jsx)(`line`,{x1:`5.2`,y1:`13.1`,x2:`9.8`,y2:`13.1`}),(0,b.jsx)(`line`,{x1:`7.5`,y1:`10.4`,x2:`7.5`,y2:`13.1`})]})}var Tc={system:wc,light:Sc,dark:Cc};function Ec({className:e,iconSize:t=15}={}){let[n,r]=gs(),i=Tc[n];return(0,b.jsx)(`button`,{type:`button`,"data-theme-toggle":!0,"data-theme-choice":n,"aria-label":`Theme: ${U[n]}. Click to switch to ${U[as(n)]}.`,onClick:()=>r(as(n)),className:bc(`flex h-7 w-7 shrink-0 items-center justify-center rounded-md border border-[var(--rule)] bg-[var(--chrome2)] text-[var(--on)]`,e),children:(0,b.jsx)(i,{size:t})})}function Dc(){let[e,t]=gs();return(0,b.jsx)(`div`,{role:`group`,"aria-label":`Appearance`,"data-theme-segmented":!0,"data-theme-choice":e,className:`mt-2.5 grid grid-cols-3 rounded-[10px] border border-[var(--rule)] bg-[var(--canvas)] p-0.5`,children:[`system`,`light`,`dark`].map(n=>(0,b.jsx)(`button`,{type:`button`,"aria-pressed":e===n,"data-theme-option":n,onClick:()=>t(n),className:`h-11 rounded-[8px] text-body ${e===n?`bg-[var(--rule)] font-semibold text-[var(--on)]`:`text-[var(--dim)]`}`,children:U[n]},n))})}function Oc({action:e,children:t,className:n=`repo-control`}){return e.method===`post`?(0,b.jsx)(`form`,{method:`post`,action:za(e.path),children:(0,b.jsx)(`button`,{className:n,type:`submit`,children:t??e.label})}):(0,b.jsx)(`a`,{className:n,href:za(e.path),children:t??e.label})}function kc(){return!Ha||Ha.actions.length===0?null:(0,b.jsxs)(`details`,{className:`relative`,children:[(0,b.jsx)(`summary`,{"aria-label":`Account menu`,className:`repo-control repo-control-ghost repo-control-icon list-none`,children:`⋯`}),(0,b.jsx)(`div`,{className:`repo-menu`,children:Ha.actions.map(e=>(0,b.jsx)(Oc,{action:e,className:`repo-control repo-control-ghost`},e.path))})]})}var Ac=class extends Error{status;constructor(e){super(e===401||e===403?`Your session has expired. Sign in again to add repositories.`:`GitHub repositories are unavailable right now. Try again shortly.`),this.status=e}};async function jc(e,t){let n=await fetch(za(e),{credentials:`same-origin`,headers:t?{"Content-Type":`application/json`,Accept:`application/json`}:{Accept:`application/json`},...t?{method:`POST`,body:JSON.stringify(t)}:{}});if(!n.ok)throw new Ac(n.status);return n.json()}function Mc({onClose:e}){let t=Ha.onboarding,n=z(),r=(0,_.useRef)(null),[i,a]=(0,_.useState)(``),[o,s]=(0,_.useState)(new Set),[c,l]=(0,_.useState)(!1),[u,d]=(0,_.useState)(),f=st({queryKey:[`offered-repositories`,t.offered_repositories_path],queryFn:()=>jc(t.offered_repositories_path),retry:!1,staleTime:0,refetchOnMount:`always`});(0,_.useEffect)(()=>{r.current?.showModal()},[]);let p=f.data??[],m=p.filter(e=>!e.connected_repository_id&&o.has(e.provider_id)),h=p.filter(e=>e.full_name.toLowerCase().includes(i.trim().toLowerCase())),g=f.error instanceof Ac&&[401,403].includes(f.error.status),v=f.error instanceof Ac&&f.error.status===409,y=g?t.sign_in:v?t.authorize:void 0,x=f.isLoading?`loading`:f.isError?g?`expired`:v?`reconnect`:`unavailable`:p.length===0?`empty`:h.length===0?`search-miss`:`list`;async function S(){if(!(c||m.length===0)){l(!0),d(void 0);try{let r={provider_ids:m.map(e=>e.provider_id)},i=await jc(t.batch_index_path,r);if(i.jobs.length===0)throw Error(`No mapping jobs were started. Refresh the repository list and try again.`);e(),i.jobs.length===1?await n({to:`/new`,search:{job:i.jobs[0].job_id}}):await n({to:`/new/batches/$batchId`,params:{batchId:i.batch_id}})}catch(e){d(e instanceof Error?e.message:`Repositories could not be mapped.`)}finally{l(!1)}}}return(0,b.jsxs)(`dialog`,{ref:r,"data-add-repository":!0,"data-add-state":x,className:`add-repository-dialog`,"aria-labelledby":`add-repository-title`,onCancel:e,onClose:e,onClick:t=>{if(t.target===t.currentTarget){let n=t.currentTarget.getBoundingClientRect();(t.clientX<n.left||t.clientX>n.right||t.clientY<n.top||t.clientY>n.bottom)&&e()}},children:[(0,b.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,b.jsx)(`h2`,{id:`add-repository-title`,className:`text-section-title`,children:`Add repository`}),(0,b.jsx)(`button`,{type:`button`,className:`repo-control repo-control-ghost repo-control-icon`,onClick:e,"aria-label":`Close add repository`,children:`×`})]}),(0,b.jsx)(`label`,{className:`text-small`,htmlFor:`offered-search`,children:`Search repositories`}),(0,b.jsx)(`input`,{id:`offered-search`,type:`search`,value:i,onChange:e=>a(e.target.value),className:`offered-search`,placeholder:`owner/repository`}),(0,b.jsxs)(`div`,{className:`offered-repositories`,"aria-live":`polite`,children:[x===`loading`&&(0,b.jsx)(`p`,{role:`status`,children:`Loading repositories…`}),x===`empty`&&(0,b.jsx)(`p`,{children:`No repositories shared with tolmap yet.`}),x===`search-miss`&&(0,b.jsxs)(`p`,{children:[`No repositories match “`,i,`”.`]}),f.isError&&(0,b.jsxs)(`div`,{role:`alert`,children:[(0,b.jsx)(`p`,{children:v?`Reconnect GitHub to see your repositories.`:f.error.message}),y?(0,b.jsx)(Oc,{action:y,className:`repo-control repo-control-primary mt-3`}):!g&&!v&&(0,b.jsx)(`button`,{type:`button`,className:`repo-control mt-3`,onClick:()=>void f.refetch(),children:`Retry`})]}),h.map(e=>(0,b.jsxs)(`label`,{"data-offered-repository":!0,className:`offered-repository`,children:[(0,b.jsx)(`input`,{type:`checkbox`,disabled:!!e.connected_repository_id||c,checked:o.has(e.provider_id),onChange:t=>s(n=>{let r=new Set(n);return t.target.checked?r.add(e.provider_id):r.delete(e.provider_id),r})}),(0,b.jsx)(`span`,{className:`min-w-0 flex-1 break-words font-mono text-small`,children:e.full_name}),(0,b.jsx)(`span`,{className:`offered-badge`,children:e.visibility}),e.connected_repository_id&&(0,b.jsx)(`span`,{className:`offered-badge`,children:`Mapped`})]},e.provider_id))]}),t.manage_access&&(0,b.jsx)(Oc,{action:t.manage_access,className:`text-small text-[var(--dim)] underline underline-offset-2`,children:`Don't see it? Manage GitHub access ↗`}),u&&(0,b.jsx)(`p`,{role:`alert`,className:`text-small text-[var(--link-out)]`,children:u}),(0,b.jsxs)(`div`,{className:`flex justify-end gap-3 py-1`,children:[(0,b.jsx)(`button`,{type:`button`,className:`repo-control`,onClick:e,children:`Cancel`}),(0,b.jsx)(`button`,{type:`button`,className:`repo-control repo-control-primary`,disabled:c||m.length===0||f.isError||f.isLoading,onClick:()=>void S(),children:c?`Starting…`:`Map ${m.length} ${m.length===1?`repository`:`repositories`}`})]})]})}var Nc=(0,_.createContext)(()=>{});function Pc({children:e}){let[t,n]=(0,_.useState)(!1),r=Ra({select:e=>e.href}),i=Ha?.onboarding?.open_sheet_parameter;(0,_.useEffect)(()=>{i&&new URL(r,window.location.origin).searchParams.get(i)===`1`&&n(!0)},[r,i]);function a(){if(n(!1),i){let e=new URL(window.location.href);e.searchParams.delete(i),window.history.replaceState(window.history.state,``,e)}}return(0,b.jsxs)(Nc.Provider,{value:()=>n(!0),children:[e,t&&Ha?.onboarding&&(Va?(0,b.jsx)(Wa,{onClose:a}):(0,b.jsx)(Mc,{onClose:a}))]})}function Fc(){return(0,_.useContext)(Nc)}function Ic({compact:e=!1}={}){let t=Fc();return Ha?.onboarding?(0,b.jsxs)(`button`,{type:`button`,className:`repo-control ${e?`app-add-repository`:``}`,"aria-label":`Add repository`,onClick:t,children:[e&&(0,b.jsx)(`span`,{className:`app-add-icon`,"aria-hidden":`true`,children:`+`}),(0,b.jsx)(`span`,{className:e?`app-add-label`:void 0,children:`Add repository`})]}):null}function Lc(){let e=Ha?.onboarding?.install;return e?(0,b.jsx)(Oc,{action:e,className:`repo-control repo-control-primary`,children:`Connect GitHub`}):(0,b.jsx)(Ic,{})}function Rc(){return(0,b.jsxs)(`header`,{"data-app-shell":!0,className:`app-shell`,children:[(0,b.jsx)(fa,{to:`/`,"aria-label":`tolmap home`,className:`shrink-0`,children:(0,b.jsx)(Ka,{className:`h-7 w-auto`})}),Ha&&(0,b.jsx)(`span`,{"data-host-workspace":!0,className:`app-workspace text-small text-[var(--dim)]`,children:Ha.workspace}),(0,b.jsxs)(`div`,{className:`ml-auto flex shrink-0 items-center gap-2 py-1`,children:[!Ha?.onboarding?.install&&(0,b.jsx)(Ic,{compact:!0}),(0,b.jsx)(kc,{}),(0,b.jsx)(Ec,{className:`repo-control repo-control-icon`})]})]})}function zc(){let e=Ra({select:e=>e.pathname}),t=/^\/[^/]+\/[^/]+$/.test(e);return(0,b.jsx)(Pc,{children:Ha&&t?(0,b.jsxs)(`div`,{className:`flex h-full flex-col bg-[var(--chrome)] text-[var(--on)]`,children:[(0,b.jsx)(`div`,{className:`border-b border-[var(--rule)] px-4 py-2`,children:(0,b.jsx)(Rc,{})}),(0,b.jsx)(`div`,{className:`relative min-h-0 flex-1`,children:(0,b.jsx)(Oa,{})})]}):(0,b.jsx)(Oa,{})})}var Bc=new Map,Vc=new Map;function Hc(e,t){Bc.set(e,t);for(let t of Vc.get(e)??[])t()}function Uc(e){if(Bc.has(e)){Bc.delete(e);for(let t of Vc.get(e)??[])t()}}function Wc(e){return Bc.get(e)??null}function Gc(e,t){let n=Vc.get(e);return n||(n=new Set,Vc.set(e,n)),n.add(t),()=>{n.delete(t),n.size===0&&Vc.delete(e)}}async function Kc(e,t){let n=e.headers.get(`content-encoding`),r=e.headers.get(`content-length`),i=n&&n!==`identity`?null:r?Number(r):null,a=e.body?.getReader();if(!a){let n=await e.text();return t?.({receivedBytes:n.length,totalBytes:i}),n}let o=new TextDecoder,s=0,c=``;for(;;){let{done:e,value:n}=await a.read();if(e)break;s+=n.byteLength,c+=o.decode(n,{stream:!0}),t?.({receivedBytes:s,totalBytes:i})}return c+=o.decode(),c}var qc,Jc=0,Yc=new Map;function Xc(){return qc||(qc=new Worker(new URL(`/assets/jsonParse.worker-DEEnj3gk.js`,``+import.meta.url),{type:`module`}),qc.addEventListener(`message`,e=>{let t=Yc.get(e.data.id);t&&(Yc.delete(e.data.id),e.data.ok?t.resolve(e.data.data):t.reject(Error(e.data.error)))}),qc)}function Zc(e){let t=Jc++;return new Promise((n,r)=>{Yc.set(t,{resolve:n,reject:r}),Xc().postMessage({id:t,text:e})})}async function Qc(e,t,n){try{let r=await fetch(e);n&&await n(r),Hc(t,{phase:`downloading`,receivedBytes:0,totalBytes:null});let i=await Kc(r,e=>Hc(t,{phase:`downloading`,...e}));return Hc(t,{phase:`parsing`,receivedBytes:i.length,totalBytes:i.length}),await Zc(i)}finally{Uc(t)}}var $c=`/api`,el=class extends Error{status;code;tooLarge;retryAfterS;constructor(e,t,n,r=null){super(t?.message??n),this.name=`ApiRequestError`,this.status=e,this.code=t?.error??null,this.retryAfterS=r;let i=(t?.error??``).toLowerCase(),a=(t?.message??``).toLowerCase();this.tooLarge=i.includes(`too_large`)||i.includes(`too-large`)||i.includes(`size_limit`)||e===413||/too large|size limit|exceeds.*(limit|cap)/.test(a)}};async function tl(e){try{let t=await e.json();if(t&&typeof t==`object`)return t}catch{}return null}function nl(e){let t=e.headers.get(`retry-after`);if(!t)return null;let n=Number(t);if(Number.isFinite(n))return Math.max(0,n);let r=Date.parse(t);return Number.isFinite(r)?Math.max(0,Math.round((r-Date.now())/1e3)):null}async function rl(e,t){let n=await fetch(`${$c}${e}`,t);if(!n.ok){let t=await tl(n);throw new el(n.status,t,`${e}: ${n.status} ${n.statusText}`,nl(n))}return n.json()}async function il(e,t,n){return Qc(`${$c}${e}`,t,async t=>{if(await n?.(t),!t.ok){let n=await tl(t);throw new el(t.status,n,`${e}: ${t.status} ${t.statusText}`)}})}function al(e){return rl(`/index`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)})}function ol(e){return rl(`/jobs/${encodeURIComponent(e)}`)}function sl(e){return rl(`/jobs/${encodeURIComponent(e)}/cancel`,{method:`POST`,headers:{"Content-Type":`application/json`}})}function cl(){return rl(`/maps`)}function ll(e,t,n,r){let i=new URLSearchParams({district:String(n)});return r&&i.set(`commit`,r),il(`/maps/${encodeURIComponent(e)}/${encodeURIComponent(t)}/symbols?${i}`,`symbols:${e}/${t}:${n}`)}async function ul(e=2500){let t=new AbortController,n=setTimeout(()=>t.abort(),e);try{return(await fetch(`${$c}/healthz`,{signal:t.signal})).ok}catch{return!1}finally{clearTimeout(n)}}function dl(e){return`${$c}/jobs/${encodeURIComponent(e)}/events`}async function fl(e,t,n){let r=n,i,a=n?`?commit=${encodeURIComponent(n)}`:``;return{document:await il(`/maps/${encodeURIComponent(e)}/${encodeURIComponent(t)}${a}`,`map:${e}/${t}`,async e=>{if(r=e.headers.get(`x-tolmap-commit`)??n,e.ok&&(i=e.headers.get(`x-tolmap-map-sha256`)??void 0,!i&&globalThis.crypto?.subtle)){let t=await crypto.subtle.digest(`SHA-256`,await e.clone().arrayBuffer());i=Array.from(new Uint8Array(t),e=>e.toString(16).padStart(2,`0`)).join(``)}}),indexedCommit:r,mapSha256:i}}function pl(e,t,n){return rl(`/maps/${encodeURIComponent(e)}/${encodeURIComponent(t)}/freshness?commit=${encodeURIComponent(n)}`)}function ml(e){return e?.status===`done`||e?.status===`failed`}var hl=[500,1500,4e3];function gl(e){let[t,n]=(0,_.useState)(null),[r,i]=(0,_.useState)(`connecting`),[a,o]=(0,_.useState)(null),[s,c]=(0,_.useState)({});return(0,_.useEffect)(()=>{if(!e)return;let t=e,r=!1,a,s,l,u=0,d=null;n(null),c({}),i(`connecting`),o(null);function f(e){d=e,n(e);let t=e.progress;t&&c(e=>({...e,[t.stage]:t}))}function p(){a&&=(clearInterval(a),void 0)}function m(){if(h(),a)return;i(`poll`);let e=async()=>{try{let e=await ol(t);if(r)return;f(e),ml(e)&&p()}catch(e){r||o(e instanceof Error?e.message:String(e))}};e(),a=setInterval(e,2e3)}function h(){s&&=(clearTimeout(s),void 0)}function g(){ol(t).then(e=>{r||(f(e),!ml(e)&&_())}).catch(e=>{r||(o(e instanceof Error?e.message:String(e)),m())})}function _(){if(typeof EventSource>`u`){m();return}l=new EventSource(dl(t)),l.onopen=()=>{r||(u=0,i(`sse`))},l.onmessage=e=>{if(!r)try{let t=JSON.parse(e.data);f(t),ml(t)&&l?.close()}catch{}},l.onerror=()=>{if(l?.close(),!(r||ml(d))){if(u<hl.length){let e=hl[u];u+=1,i(`connecting`),s=setTimeout(g,e)}else m()}}}return Va?m():g(),()=>{r=!0,l?.close(),p(),h()}},[e]),{job:t,connection:r,error:a,seen:s}}function _l({value:e}){let t=Date.parse(e);if(!Number.isFinite(t))return null;let n=Math.max(0,Date.now()-t),r=Math.floor(n/864e5),i=Math.floor(n/36e5),a=Math.floor(n/6e4),o=r>0?`${r}d ago`:i>0?`${i}h ago`:a>0?`${a}m ago`:`just now`;return(0,b.jsx)(`time`,{dateTime:e,title:new Date(t).toLocaleString(),className:`font-mono`,children:o})}function vl({status:e}){if(!e)return null;let t=e.kind===`failed`?`var(--link-out)`:e.kind===`reconnect_needed`?`var(--warn)`:`var(--accent)`;return(0,b.jsxs)(`span`,{"data-repository-status":e.kind,className:`inline-flex w-fit shrink-0 items-center gap-1 h-5 rounded-[4px] px-1.5 text-[12px] leading-none`,style:{color:t,background:`color-mix(in srgb, ${t} 12%, transparent)`},title:e.kind===`failed`?e.message:void 0,children:[(0,b.jsx)(`span`,{"aria-hidden":`true`,className:`h-1.5 w-1.5 rounded-full bg-current`}),e.kind===`indexing`?`Indexing · ${e.phase}`:e.kind===`failed`?`Failed`:`Reconnect needed`]})}var yl=[`peek`,`half`,`full`],bl=.57;function xl(e){return e.safeTop+12+48}function Sl(e){let t=156+e.safeBottom,n=Math.max(t,Math.round(e.height-(xl(e)+8)));return{peek:t,half:Math.min(n,Math.max(t,Math.min(480,Math.round(e.height*bl)))),full:n}}function Cl(e,t){return{left:(e.safeLeft??0)+12,top:xl(e)+8,right:(e.safeRight??0)+12+44+8,bottom:t+8}}function wl(e,t,n){let r=yl.map(e=>n[e]),i=0;for(let t=1;t<r.length;t++)Math.abs(r[t]-e)<Math.abs(r[i]-e)&&(i=t);return Math.abs(t)>.45?t<0?yl[Math.min(r.length-1,r[i]>e?i:i+1)]:yl[Math.max(0,r[i]<e?i:i-1)]:yl[i]}function Tl(e){return e===`peek`?`half`:e===`half`?`full`:`peek`}function El(e,t,n){return Math.max(n.peek-40,Math.min(n.full,e-t))}function Dl(e){if(e.length<2)return 0;let[t,n]=e[0],[r,i]=e[e.length-1];return(i-n)/Math.max(1,r-t)}function Ol(e){return e.zone===`handle`||!e.canScroll||e.direction===`down`&&e.scrollTop<=0?`sheet`:`content`}function kl(e,t){return e<=600||t<=500}function Al(e,t){return t<=500&&e>t?`landscape`:e<=600?`phone`:e<=1100?`tablet`:`desktop`}function jl(e){return e===`tablet`||e===`desktop`}function Ml(e){return e===`phone`||e===`landscape`}function Nl(e){return e!==`desktop`}function Pl(e,t){return e?360+t.left:0}function Fl(e,t){return{left:Pl(e,t)+(e?0:t.left)+12,top:t.top+12+48+8,right:t.right+12+44+8,bottom:t.bottom+12}}function Il(e){return e===`tablet`?44:40}function Ll(e){let t=Il(e.profile);return{left:e.safe.left+(e.panelOpen?400:24),top:e.safe.top+16+44+16,right:e.safe.right+16+t+24,bottom:e.safe.bottom+72}}function Rl(e){return window.addEventListener(`resize`,e),window.addEventListener(`orientationchange`,e),()=>{window.removeEventListener(`resize`,e),window.removeEventListener(`orientationchange`,e)}}function zl(){return Al(window.innerWidth,window.innerHeight)}function Bl(){return(0,_.useSyncExternalStore)(Rl,zl,()=>`desktop`)}var Vl=[{id:`fetch`,title:`Fetch`,meaning:`Download the repository`,stages:[`clone`,`clone_objects`,`clone_deltas`,`clone_checkout`]},{id:`read`,title:`Read`,meaning:`Find the source, parse files, follow imports, read history`,stages:[`detect`,`parse`,`resolve`,`index_go`,`index_py`,`install`,`index_ts`,`history`]},{id:`map`,title:`Map`,meaning:`Group files into districts and draw them`,stages:[`blend_prune`,`partition`,`neighbourhoods`,`naming`,`regions`,`footprints`,`write_map`]},{id:`detail`,title:`Detail`,meaning:`Classes and functions for close zoom`,stages:[`symbols`,`symbol_cards`,`write`]}],Hl={clone:`Contacting the host`,clone_objects:`Downloading`,clone_deltas:`Unpacking`,clone_checkout:`Writing files`,detect:`Finding the source`,parse:`Parsing files`,resolve:`Following imports`,index_go:`Indexing Go`,index_py:`Indexing Python`,install:`Installing dependencies`,index_ts:`Indexing TypeScript`,history:`Reading history`,blend_prune:`Weighing links`,partition:`Finding districts`,neighbourhoods:`Finding neighborhoods`,naming:`Naming districts`,regions:`Drawing districts`,footprints:`Sizing files`,write_map:`Saving the map`,symbols:`Reading classes and functions`,symbol_cards:`Laying out symbols`,write:`Saving details`},Ul=new Map(Vl.flatMap(e=>e.stages.map(t=>[t,e.id])));function Wl(e){return Ul.get(e)??`read`}function Gl(e){return Vl.find(t=>t.id===e).title}function Kl(e){return!(e.id.startsWith(`index_`)&&e.state===`pending`)}function ql(e){let t=new Set,n=!1;for(let r=e.length-1;r>=0;r--){let i=e[r];i.state===`pending`?n&&t.add(i.id):n=!0}return t}function Jl(e){let t=new Map(e.stages.map(e=>[e.id,e])),n=ql(e.stages),r=e.status===`failed`;return Vl.map(i=>{let a=i.stages.map(e=>t.get(e)).filter(e=>!!e&&Kl(e)),o=a,s=[...a].reverse().find(e=>e.state===`running`),c=a.some(e=>e.state===`failed`),l=a.length>0&&a.every(e=>e.state===`done`||n.has(e.id)),u=a.some(e=>e.state!==`pending`),d;d=e.status===`queued`?`pending`:c?`failed`:s?r?`failed`:`running`:l&&a.some(e=>e.state===`done`)?`done`:u?r?`failed`:e.status===`done`?`done`:`running`:e.status===`done`?`done`:`pending`;let f=null,p=0;if(d===`running`){let t=s??a.find(e=>e.state===`pending`&&!n.has(e.id))??null;if(t){let n=e.progress&&e.progress.stage===t.id?e.progress:null,r=n?Number(n.done):null,i=n&&n.total!=null?Number(n.total):null;t.state===`running`&&r!=null&&i!=null&&i>0&&(p=Math.min(1,r/i)),f={stage:t.id,text:Hl[t.id],done:r,total:i,rate:n?.rate_per_s??null,unit:n?.unit??null,indeterminate:i==null||i<=0}}}let m=o.filter(e=>e.state===`done`||n.has(e.id)).length,h=d===`done`?1:d===`pending`||o.length===0?0:Math.min(1,(m+p)/o.length),g=a.map(e=>e.duration_s).filter(e=>e!=null);return{id:i.id,title:i.title,meaning:i.meaning,state:d,fraction:h,durationS:g.length?g.reduce((e,t)=>e+t,0):null,current:f,stages:a}})}function Yl(e){if(e.progress)return{index:e.progress.stage_index,count:e.progress.stage_count};let t=e.stages.length,n=t=>{for(let n=e.stages.length-1;n>=0;n--)if(t(e.stages[n]))return n;return-1},r=n(e=>e.state===`running`),i=r>=0?r:n(e=>e.state!==`pending`);return i>=0?{index:i+1,count:t}:null}function Xl(e){let t=[],n=e.parse;n?.total!=null&&Number(n.total)>0&&t.push(`${Zl(Number(n.total))} source files`);let r=e.history;r&&Number(r.done)>0&&t.push(`${Zl(Number(r.done))} commits read`);let i=e.regions??e.naming;if(i?.total!=null&&Number(i.total)>0){let e=Number(i.total);t.push(`${Zl(e)} ${e===1?`district`:`districts`}`)}return t}function Zl(e){return Math.round(e).toLocaleString(`en-US`)}function Ql(e,t=!1){let n=Math.max(0,Math.round(e));return n<60&&!t?`${n}s`:`${Math.floor(n/60)}m ${n%60}s`}function $l(e,t){let n=Math.max(0,Math.round(e/60)),r=Math.max(n,Math.round(t/60));return n===0&&r===0?`Less than a minute left`:n===r?`About ${n} min left`:n===0?`Up to ${r} min left`:`About ${n}–${r} min left`}function eu(e){return e<30?`Starts in about a minute`:`Starts in about ${Math.round(e/60)} min`}function tu(e){let t=e%100;return`${e}${t>=11&&t<=13?`th`:{1:`st`,2:`nd`,3:`rd`}[e%10]??`th`}`}function nu(e,t){return t===`bytes`?`${(e/1048576).toFixed(1)} MB`:Zl(e)}function ru(e){if(e.done==null||e.unit==null)return null;let t=e.unit,n=t===`bytes`?``:` ${t}`,r=e.total!=null&&e.total>0?`${nu(e.done,t)} / ${nu(e.total,t)}${n}`:`${nu(e.done,t)}${n}`;return e.rate==null||e.rate<=0?r:`${r} · ${t===`bytes`?`${(e.rate/1048576).toFixed(1)} MB/s`:`${Zl(e.rate)} ${t}/s`}`}var iu={py:`Python`,go:`Go`,ts:`TypeScript`,rs:`Rust`,rust:`Rust`};function au(e){if(!e)return null;let t=/^\s*([a-z]+) at \S+ \((\d[\d,]*) files?\b/.exec(e);if(!t)return null;let n=iu[t[1]],r=Number(t[2].replace(/,/g,``));return!n||!Number.isFinite(r)?null:`It found ${r.toLocaleString(`en-US`)} ${n} ${r===1?`file`:`files`}`}function ou(e){let t=[...e.stages].reverse(),n=t.find(e=>e.state===`failed`)??t.find(e=>e.state===`running`)??t.find(e=>e.state===`done`);return n?Gl(Wl(n.id)):null}var su=`Trying again won't change the result.`;function cu(e){let t=e.error_code??``;switch(t){case`detection_uncertain`:return{code:t,cls:`deterministic`,title:`tolmap couldn't tell where this repository's code lives`,explanation:[`${au(e.error)??`It found source files`} but no package it could name for certain. A wrong guess draws a convincing but wrong map, so it stopped instead of guessing.`,`${su} This layout needs support in tolmap itself.`],actions:[`another`,`report`]};case`detection_failed`:return{code:t,cls:`deterministic`,title:`tolmap found no Python, Go, TypeScript or Rust source here`,explanation:[`tolmap maps code written in those four languages, and it found none of them it could read in this repository.`,su],actions:[`another`]};case`cancelled`:return{code:t,cls:`user`,title:`Mapping was cancelled`,explanation:[`The job was stopped before the map was ready, so nothing was saved.`],actions:[`again`,`home`]};case`clone_failed`:return{code:t,cls:`input`,title:`tolmap couldn't download this repository`,explanation:[`It may be private, renamed or deleted, or the host didn't answer. Check the name; if it's right, trying again may work.`],actions:[`retry`,`check-name`]};case`worker_crashed`:{let n=ou(e);return{code:t,cls:`transient`,title:n?`The mapping job stopped during ${n}`:`The mapping job stopped`,explanation:[`The process mapping it ended before it finished. A very large repository can run out of memory on this server; trying again may work.`],actions:[`retry`]}}case`busy`:case`server_stopping`:return{code:t,cls:`transient`,title:`tolmap is busy right now`,explanation:[t===`server_stopping`?`The server restarted while this repository was being mapped. Try again in a moment.`:`Too many repositories are being mapped at once. Try again in a moment.`],actions:[`retry`]};default:return{code:t,cls:`bug`,title:`Something went wrong while mapping`,explanation:[`This looks like a bug in tolmap, not a problem with the repository. Trying again may work; reporting it helps fix it.`],actions:[`retry`,`report`]}}}var lu=`https://github.com/onsager-ai/tolmap/issues/new`;function uu(e){let t=`Couldn't map ${e.slug} (${e.error_code??`unknown error`})`,n=[e.slug.startsWith(`local/`)?`Repository: ${e.slug}`:`Repository: https://github.com/${e.slug}`,e.commit?`Commit: ${e.commit}`:null,`Error code: ${e.error_code??`(none)`}`,`Job: ${e.job_id}`,``,`What tolmap saw:`,"```",(e.error??`(no message)`).slice(0,2e3),"```"].filter(e=>e!=null).join(`
|
|
11
|
+
`);return`${lu}?${new URLSearchParams({title:t,body:n}).toString()}`}function du(e){let[t,n]=(0,_.useState)(()=>Date.now());return(0,_.useEffect)(()=>{if(!e)return;let t=setInterval(()=>n(Date.now()),1e3);return()=>clearInterval(t)},[e]),t}var fu={fill:`none`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`};function pu(){return(0,b.jsx)(`svg`,{width:`20`,height:`20`,viewBox:`0 0 20 20`,...fu,strokeWidth:2,"aria-hidden":!0,children:(0,b.jsx)(`path`,{d:`M12.5 4.5 7 10l5.5 5.5`})})}function mu(){return(0,b.jsx)(`svg`,{width:`16`,height:`16`,viewBox:`0 0 16 16`,...fu,strokeWidth:1.8,"aria-hidden":!0,className:`flex-none text-[var(--dim)] transition-transform group-open:rotate-180`,children:(0,b.jsx)(`path`,{d:`m4 6 4 4 4-4`})})}function hu(){return(0,b.jsxs)(`svg`,{width:`18`,height:`18`,viewBox:`0 0 18 18`,...fu,strokeWidth:1.6,"aria-hidden":!0,children:[(0,b.jsx)(`rect`,{x:`6`,y:`6`,width:`9`,height:`9`,rx:`2`}),(0,b.jsx)(`path`,{d:`M12 3.5H5A1.5 1.5 0 0 0 3.5 5v7`})]})}function gu({state:e}){let t=`inline-flex h-7 w-7 flex-none items-center justify-center rounded-full`;return e===`done`?(0,b.jsx)(`span`,{"aria-hidden":!0,className:`${t} bg-[var(--accent)] text-[var(--on-accent)]`,children:(0,b.jsx)(`svg`,{width:`14`,height:`14`,viewBox:`0 0 14 14`,...fu,strokeWidth:2.2,children:(0,b.jsx)(`path`,{d:`m3 7.2 2.6 2.6L11 4.4`})})}):e===`failed`?(0,b.jsx)(`span`,{"aria-hidden":!0,className:`${t} bg-[var(--link-out)] text-[var(--on-accent)]`,children:(0,b.jsx)(`svg`,{width:`12`,height:`12`,viewBox:`0 0 12 12`,...fu,strokeWidth:2.2,children:(0,b.jsx)(`path`,{d:`m3 3 6 6M9 3 3 9`})})}):e===`running`?(0,b.jsx)(`span`,{"aria-hidden":!0,className:`${t} relative border-2 border-[var(--rule)]`,children:(0,b.jsx)(`span`,{className:`tolmap-spin absolute -inset-[2px] rounded-full border-2 border-transparent border-t-[var(--accent)]`})}):(0,b.jsx)(`span`,{"aria-hidden":!0,className:`${t} border-2 border-[var(--rule)]`})}function _u({cls:e}){let t=e===`deterministic`?`var(--warn)`:e===`user`?`var(--dim)`:e===`bug`?`var(--link-out)`:`var(--accent)`;return(0,b.jsx)(`span`,{"aria-hidden":!0,"data-failure-icon":!0,className:`inline-flex h-14 w-14 items-center justify-center rounded-[14px]`,style:{color:t,background:`color-mix(in srgb, ${t} 16%, transparent)`},children:(0,b.jsx)(`svg`,{width:`28`,height:`28`,viewBox:`0 0 28 28`,...fu,strokeWidth:2,children:e===`deterministic`?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(`path`,{d:`M4 7.5 10 5l8 3 6-2.5v15L18 23l-8-3-6 2.5z`}),(0,b.jsx)(`path`,{d:`M12.2 11.3a2.4 2.4 0 1 1 3.3 2.2c-.8.3-1.3.9-1.3 1.7`}),(0,b.jsx)(`path`,{d:`M14.2 18.1h.01`})]}):e===`user`?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(`circle`,{cx:`14`,cy:`14`,r:`9`}),(0,b.jsx)(`path`,{d:`M10.5 10.5h7v7h-7z`})]}):e===`bug`?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(`path`,{d:`M14 4.5 25 23H3z`}),(0,b.jsx)(`path`,{d:`M14 11v5.5M14 19.6h.01`})]}):(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(`circle`,{cx:`14`,cy:`14`,r:`9`}),(0,b.jsx)(`path`,{d:`M14 9v5l3.5 2`})]})})})}function vu({narrow:e,children:t}){return(0,b.jsxs)(`div`,{className:`h-full overflow-y-auto bg-[var(--chrome)] text-[var(--on)]`,"data-index-page":!0,children:[Ha?(0,b.jsx)(`div`,{className:`px-5 pt-4`,children:(0,b.jsx)(Rc,{})}):e?(0,b.jsx)(`div`,{className:`px-3 pt-[max(env(safe-area-inset-top),12px)]`,children:(0,b.jsxs)(fa,{to:`/`,className:`inline-flex h-11 items-center gap-1.5 rounded-[12px] pl-1 pr-3 text-row text-[var(--on)]`,"aria-label":`tolmap home`,children:[(0,b.jsx)(pu,{}),(0,b.jsx)(Ka,{className:`h-7 w-auto shrink-0`})]})}):(0,b.jsxs)(`header`,{className:`flex h-14 items-center justify-between border-b border-[var(--rule)] px-5`,children:[(0,b.jsx)(fa,{to:`/`,className:`text-row text-[var(--on)]`,"aria-label":`tolmap home`,children:(0,b.jsx)(Ka,{className:`h-7 w-auto shrink-0`})}),(0,b.jsx)(Ec,{})]}),t]})}function yu({slug:e}){return e?(0,b.jsx)(`p`,{className:`break-all font-mono text-body text-[var(--dim)]`,children:e}):null}function bu({phase:e}){let t=e.state===`running`,n=e.current,r=n&&!n.indeterminate&&n.done!=null&&n.total?Math.min(100,n.done/n.total*100):null,i=n?ru(n):null;return(0,b.jsxs)(`li`,{"data-phase-row":!0,"data-phase-id":e.id,"data-phase-state":e.state,className:`flex gap-3.5 px-4 py-3.5 [&:not(:first-child)]:border-t [&:not(:first-child)]:border-[var(--rule)] ${t?`bg-[color-mix(in_srgb,var(--accent)_7%,transparent)]`:``}`,children:[(0,b.jsx)(gu,{state:e.state}),(0,b.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,b.jsxs)(`div`,{className:`flex items-baseline gap-3`,children:[(0,b.jsx)(`p`,{className:`text-row ${e.state===`pending`?`text-[var(--dim)]`:`text-[var(--on)]`}`,children:e.title}),e.state===`failed`&&(0,b.jsx)(`span`,{className:`ml-auto text-meta text-[var(--dim)]`,children:`stopped`})]}),(0,b.jsx)(`p`,{className:`text-small text-[var(--dim)]`,children:e.meaning}),t&&n&&(0,b.jsxs)(`div`,{className:`mt-3`,"data-current-step":!0,"data-stage-id":n.stage,children:[(0,b.jsx)(`div`,{className:`h-1.5 w-full overflow-hidden rounded-full bg-[var(--rule)]`,role:`progressbar`,"aria-label":`${n.text} progress`,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":r??void 0,children:(0,b.jsx)(`div`,{"data-progress-fill":!0,"data-progress-pct":r?.toFixed(1),className:r==null?`tolmap-indeterminate h-full w-1/3 rounded-full bg-[var(--accent)]`:`h-full rounded-full bg-[var(--accent)] transition-[width] duration-300`,style:r==null?void 0:{width:`${r}%`}})}),(0,b.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-baseline justify-between gap-x-3 gap-y-0.5`,children:[(0,b.jsx)(`span`,{className:`text-small text-[var(--on)]`,children:n.text}),i&&(0,b.jsx)(`span`,{className:`font-mono text-meta tabular-nums text-[var(--dim)]`,children:i})]})]})]})]})}function xu({job:e,phases:t,open:n,card:r}){let i=Yl(e),a=ql(e.stages);return(0,b.jsxs)(`details`,{open:n,"data-tech-details":!0,className:`group ${r?`rounded-[14px] border border-[var(--rule)] bg-[var(--chrome2)]`:`border-t border-[var(--rule)]`}`,children:[(0,b.jsxs)(`summary`,{className:`flex min-h-11 cursor-pointer select-none items-center justify-between gap-3 ${r?`border-b border-[var(--rule)] px-5 py-3`:`py-3`}`,children:[(0,b.jsx)(`span`,{className:`text-row`,children:`Technical details`}),(0,b.jsx)(`span`,{className:`flex items-center gap-2.5`,children:(0,b.jsx)(mu,{})})]}),(0,b.jsxs)(`div`,{className:r?`px-5 py-4`:`pb-4`,children:[i&&(0,b.jsxs)(`span`,{className:`font-mono text-meta text-[var(--dim)]`,"data-stage-position":!0,children:[`stage `,i.index,` of `,i.count]}),(0,b.jsxs)(`p`,{className:`mb-3 text-meta text-[var(--dim)]`,children:[`Running `,Ql(e.elapsed_s,!0),` · started `,new Date(e.started_at).toLocaleTimeString([],{hour:`numeric`,minute:`2-digit`})]}),(0,b.jsx)(`p`,{className:`mb-3 break-words font-mono text-meta text-[var(--dim)]`,"data-raw-stage":!0,children:e.stage}),t.map(e=>(0,b.jsxs)(`section`,{className:`mb-3 last:mb-0`,children:[(0,b.jsx)(`h3`,{className:`text-label uppercase text-[var(--dim)]`,children:e.title}),(0,b.jsx)(`ol`,{className:`mt-1`,"data-stage-timeline":!0,children:e.stages.map(e=>(0,b.jsxs)(`li`,{"data-stage-row":!0,"data-stage-id":e.id,"data-stage-state":e.state,className:`flex items-baseline justify-between gap-3 py-0.5 text-small`,children:[(0,b.jsx)(`span`,{className:e.state===`running`?`text-[var(--accent)]`:e.state===`failed`?`text-[var(--link-out)]`:e.state===`done`?`text-[var(--on)]`:`text-[var(--dim)]`,children:e.label}),(0,b.jsx)(`span`,{className:`font-mono text-meta tabular-nums text-[var(--dim)]`,children:e.state===`done`&&e.duration_s!=null?Ql(e.duration_s):e.state===`running`?`running`:e.state===`failed`?`failed`:a.has(e.id)?`skipped`:``})]},e.id))})]},e.id))]})]})}function Su({narrow:e}){let[t,n]=(0,_.useState)(null);(0,_.useEffect)(()=>{if(!t)return;let e=setTimeout(()=>n(null),2500);return()=>clearTimeout(e)},[t]);async function r(){try{await navigator.clipboard.writeText(window.location.href),n(`yes`)}catch{n(`failed`)}}return(0,b.jsxs)(`div`,{className:e?`flex flex-col gap-3`:`flex min-w-0 items-center gap-5`,children:[(0,b.jsxs)(`button`,{type:`button`,"data-copy-link":!0,onClick:()=>void r(),className:`inline-flex flex-none items-center justify-center gap-2.5 rounded-[14px] border border-[var(--rule)] bg-[var(--chrome2)] text-row text-[var(--on)] hover:bg-[color-mix(in_srgb,var(--on)_6%,var(--chrome2))] ${e?`h-[52px] w-full`:`h-11 px-5`}`,children:[(0,b.jsx)(hu,{}),(0,b.jsx)(`span`,{"aria-live":`polite`,children:t===`yes`?`Link copied`:t===`failed`?`Copy the address bar`:`Copy link`})]}),(0,b.jsx)(`p`,{className:`text-small text-[var(--dim)] ${e?`text-center`:``}`,"data-copy-note":!0,children:`You can close this page. The link keeps working, and the map opens here when it's ready.`})]})}function Cu({job:e,queued:t}){let[n,r]=(0,_.useState)(!1),[i,a]=(0,_.useState)(!1),[o,s]=(0,_.useState)(null);async function c(){if(!i){a(!0),s(null);try{await sl(e.job_id)}catch(e){s(e instanceof Error?e.message:String(e))}finally{a(!1)}}}return(0,b.jsxs)(`div`,{className:`flex flex-none flex-col items-center gap-2`,"data-cancel-area":!0,children:[n?(0,b.jsxs)(`div`,{className:`flex flex-wrap items-center justify-center gap-2 text-small`,"data-cancel-confirm":!0,children:[(0,b.jsx)(`span`,{className:`text-[var(--dim)]`,children:t?`Leave the queue?`:`Stop mapping?`}),(0,b.jsx)(`button`,{type:`button`,onClick:()=>void c(),disabled:i,className:`h-11 rounded-[12px] border border-[var(--link-out)] px-4 text-[var(--link-out)] disabled:opacity-50`,children:i?`Stopping…`:t?`Yes, leave`:`Yes, cancel`}),(0,b.jsx)(`button`,{type:`button`,onClick:()=>r(!1),disabled:i,className:`h-11 rounded-[12px] px-4 text-[var(--on)] hover:bg-[color-mix(in_srgb,var(--on)_8%,transparent)]`,children:t?`Stay`:`Keep mapping`})]}):(0,b.jsx)(`button`,{type:`button`,onClick:()=>r(!0),className:`h-11 px-4 text-body text-[var(--link-out)]`,"data-cancel-button":!0,children:t?`Leave the queue`:`Cancel mapping`}),o&&(0,b.jsxs)(`p`,{className:`text-meta text-[var(--link-out)]`,children:[`Couldn't cancel: `,o]})]})}function wu({job:e,seen:t,narrow:n,inline:r=!1}){let i=e.status===`queued`,a=du(!0),o=(0,_.useMemo)(()=>Jl(e),[e]),s=(0,_.useMemo)(()=>Xl(t),[t]),c=Math.max(0,(a-Date.parse(e.started_at))/1e3),l=e.eta?.basis===`model`?`rough estimate`:`estimate`,u=i?e.eta_start_s==null?`Waiting to start`:eu(e.eta_start_s):e.eta?$l(e.eta.low_s,e.eta.high_s):`Working out how long`,d=(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(yu,{slug:e.slug}),(0,b.jsx)(`h1`,{className:`mt-1 text-title tabular-nums text-[var(--on)]`,...i?{"data-queued-title":``}:{"data-eta-range":``},children:u}),i?(0,b.jsxs)(`p`,{className:`mt-2 text-small text-[var(--dim)]`,"data-queued-text":!0,children:[e.queue_position!=null&&(0,b.jsxs)(`span`,{className:`text-[var(--on)]`,children:[tu(e.queue_position),` in line · `]}),`waiting `,(0,b.jsx)(`span`,{className:`font-mono text-[var(--on)]`,children:Ql(c,!0)}),e.eta_start_s!=null&&` · ${l}`]}):(0,b.jsx)(`p`,{className:`mt-2 text-small text-[var(--dim)]`,"data-running-text":!0,children:e.eta?l:`Mapping your repository`}),(0,b.jsx)(`div`,{className:`mt-6 grid grid-cols-4 gap-2`,"data-phase-bar":!0,"aria-hidden":!0,children:o.map(e=>(0,b.jsx)(`div`,{className:`h-1.5 overflow-hidden rounded-full bg-[var(--rule)]`,"data-phase-segment":e.id,children:(0,b.jsx)(`div`,{className:`h-full rounded-full ${e.state===`failed`?`bg-[var(--link-out)]`:`bg-[var(--accent)]`} transition-[width] duration-300`,style:{width:`${Math.round(e.fraction*100)}%`}})},e.id))})]}),f=(0,b.jsx)(`ol`,{className:`mt-5 overflow-hidden rounded-[14px] border border-[var(--rule)]`,"data-phase-list":!0,children:o.map(e=>(0,b.jsx)(bu,{phase:e},e.id))}),p=s.length>0?(0,b.jsxs)(`p`,{className:`mt-5 text-small text-[var(--dim)]`,"data-found-so-far":!0,children:[`Found so far:`,` `,s.map((e,t)=>(0,b.jsxs)(`span`,{children:[t>0&&` · `,(0,b.jsx)(`span`,{className:`text-[var(--on)]`,children:e})]},e))]}):null;return r?(0,b.jsxs)(`section`,{"data-job-state":e.status,"aria-label":`Indexing progress`,className:`rounded-[14px] border border-[var(--rule)] p-4`,children:[(0,b.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,b.jsx)(`span`,{className:`font-mono text-small`,children:e.slug}),(0,b.jsx)(`span`,{className:`text-small font-semibold`,children:i?`Waiting to start`:o.find(e=>e.state===`running`)?.title??`Indexing`})]}),(0,b.jsxs)(`p`,{className:`mt-2 text-meta text-[var(--dim)]`,children:[e.progress?.label??e.stage,e.progress&&(0,b.jsxs)(b.Fragment,{children:[` · `,(0,b.jsxs)(`span`,{className:`font-mono`,children:[String(e.progress.done),e.progress.total!=null&&` / ${String(e.progress.total)}`]}),` `,e.progress.unit]})]}),(0,b.jsx)(`div`,{className:`mt-3 grid grid-cols-4 gap-2`,"aria-hidden":!0,children:o.map(e=>(0,b.jsx)(`div`,{className:`h-1.5 overflow-hidden rounded-full bg-[var(--rule)]`,children:(0,b.jsx)(`div`,{className:`h-full rounded-full bg-[var(--accent)]`,style:{width:`${Math.round(e.fraction*100)}%`}})},e.id))})]}):n?(0,b.jsxs)(`main`,{className:`flex min-h-[calc(100%-56px)] flex-col px-5 pb-[max(env(safe-area-inset-bottom),16px)] pt-4`,"data-job-state":e.status,children:[d,f,p,(0,b.jsx)(`div`,{className:`mt-6`,children:(0,b.jsx)(Su,{narrow:!0})}),!i&&(0,b.jsx)(`div`,{className:`mt-6`,children:(0,b.jsx)(xu,{job:e,phases:o,open:!1,card:!1})}),(0,b.jsx)(`div`,{className:`mt-auto pt-8`,children:(0,b.jsx)(Cu,{job:e,queued:i})})]}):(0,b.jsxs)(`main`,{className:`mx-auto grid w-full max-w-[1180px] grid-cols-1 gap-10 px-8 py-12 min-[960px]:grid-cols-[minmax(0,1fr)_minmax(300px,380px)] min-[960px]:gap-12`,"data-job-state":e.status,children:[(0,b.jsxs)(`div`,{className:`min-w-0`,children:[d,f,p,(0,b.jsxs)(`div`,{className:`mt-6 flex items-center justify-between gap-6`,children:[(0,b.jsx)(Su,{narrow:!1}),(0,b.jsx)(Cu,{job:e,queued:i})]})]}),(0,b.jsx)(`div`,{className:`min-w-0`,children:!i&&(0,b.jsx)(xu,{job:e,phases:o,open:!1,card:!0})})]})}function Tu({job:e,slug:t,narrow:n}){let r=z(),i=cu(e),[a,o]=(0,_.useState)(!1),[s,c]=(0,_.useState)(null),[l,u]=(0,_.useState)(null),d=du(l!=null),f=l==null?0:Math.max(0,Math.ceil((l-d)/1e3)),p=e.slug||t;async function m(){if(!(!p||a||f>0)){o(!0),c(null);try{if(Va){let t=await fetch(`/api/jobs/${encodeURIComponent(e.job_id)}/retry`,{method:`POST`,headers:{"Content-Type":`application/json`}});if(!t.ok)throw Error(`Refresh couldn't be started. Open the repository page to retry.`);let n=await t.json();await r({to:`/new`,search:{job:n.jobs[0].job_id},replace:!0});return}let t=await al({repo:p});if(t.status===`done`){let[e,n]=t.slug.split(`/`);await r({to:`/$owner/$repo`,params:{owner:e,repo:n},search:{geo:`r`,layer:`d`}})}else await r({to:`/new`,search:{job:t.job_id,slug:t.slug},replace:!0})}catch(e){e instanceof el&&e.retryAfterS!=null&&u(Date.now()+e.retryAfterS*1e3),c(e instanceof el&&e.code===`busy`?`tolmap is still busy.`:e instanceof Error?e.message:String(e))}finally{o(!1)}}}let h=`inline-flex items-center justify-center rounded-[14px] text-row ${n?`h-[52px] w-full`:`h-12 px-6`}`;function g(t,n){let r=`${h} ${n===0?`bg-[var(--accent)] text-[var(--on-accent)] hover:opacity-90 disabled:opacity-60`:`border border-[var(--rule)] bg-[var(--chrome2)] text-[var(--on)] hover:bg-[color-mix(in_srgb,var(--on)_6%,var(--chrome2))] disabled:opacity-60`}`;switch(t){case`retry`:case`again`:return(0,b.jsx)(`button`,{type:`button`,"data-failure-action":t,className:r,onClick:()=>void m(),disabled:a||f>0,children:a?`Starting…`:f>0?`Try again in ${f}s`:t===`again`?`Map it again`:`Try again`},t);case`report`:return Ha?.private?null:(0,b.jsx)(`a`,{"data-failure-action":t,className:r,href:uu(e),target:`_blank`,rel:`noopener noreferrer`,children:`Report this repository`},t);case`another`:return(0,b.jsx)(fa,{"data-failure-action":t,className:r,to:`/`,children:`Map another repository`},t);case`check-name`:return(0,b.jsx)(fa,{"data-failure-action":t,className:r,to:`/`,children:`Check the name`},t);case`home`:return(0,b.jsx)(fa,{"data-failure-action":t,className:r,to:`/`,children:`Home`},t)}}return(0,b.jsxs)(`main`,{className:n?`flex min-h-[calc(100%-56px)] flex-col px-5 pb-[max(env(safe-area-inset-bottom),20px)] pt-6`:`mx-auto w-full max-w-[680px] px-8 py-14`,"data-job-failure":!0,"data-job-failure-code":e.error_code??``,"data-failure-class":i.cls,children:[(0,b.jsx)(_u,{cls:i.cls}),(0,b.jsx)(`div`,{className:`mt-6`,children:(0,b.jsx)(yu,{slug:p})}),(0,b.jsx)(`h1`,{className:`mt-1 text-title text-[var(--on)]`,"data-failure-title":!0,children:i.title}),(0,b.jsx)(`div`,{className:`mt-4 flex flex-col gap-3 text-body text-[var(--dim)]`,"data-job-failure-explanation":!0,children:i.explanation.map(e=>(0,b.jsx)(`p`,{children:e},e))}),e.error&&(0,b.jsxs)(`details`,{open:!0,className:`group mt-6 overflow-hidden rounded-[14px] border border-[var(--rule)] bg-[var(--chrome2)]`,"data-job-failure-evidence":!0,children:[(0,b.jsxs)(`summary`,{className:`flex min-h-12 cursor-pointer select-none items-center justify-between gap-3 px-4 text-row`,children:[`What tolmap saw`,(0,b.jsx)(mu,{})]}),(0,b.jsx)(`pre`,{className:`whitespace-pre-wrap border-t border-[var(--rule)] bg-[var(--chrome)] px-4 py-3 font-mono text-small text-[var(--on)] [overflow-wrap:anywhere]`,children:e.error})]}),s&&(0,b.jsx)(`p`,{className:`mt-4 text-small text-[var(--link-out)]`,"data-retry-error":!0,children:s}),(0,b.jsx)(`div`,{className:n?`mt-auto flex flex-col gap-3 pt-10`:`mt-8 flex flex-wrap gap-3`,"data-failure-actions":!0,children:i.actions.map((e,t)=>g(e,t))})]})}function Eu(){let e=Yi({strict:!1}),t=z(),n=Ml(Bl()),{job:r,error:i,seen:a}=gl(e.job),o=r?.status,s=r?.map_ready===!0;return(0,_.useEffect)(()=>{if(!r||!o||o!==`done`&&!(s&&o!==`failed`))return;let[e,n]=r.slug.split(`/`);e&&n&&t({to:`/$owner/$repo`,params:{owner:e,repo:n},search:o===`done`?{geo:`r`,layer:`d`}:{geo:`r`,layer:`d`,job:r.job_id},replace:!0})},[o,s,r,t]),e.job?i&&!r?(0,b.jsx)(vu,{narrow:n,children:(0,b.jsxs)(Du,{children:[(0,b.jsx)(yu,{slug:e.slug}),(0,b.jsxs)(`p`,{className:`text-body text-[var(--link-out)]`,children:[`Couldn't reach the mapping service: `,i]}),(0,b.jsx)(fa,{to:`/`,className:`text-body text-[var(--accent)] underline underline-offset-2`,children:`Home`})]})}):r?(0,b.jsx)(vu,{narrow:n,children:r.status===`failed`?(0,b.jsx)(Tu,{job:r,slug:e.slug,narrow:n}):(0,b.jsx)(wu,{job:r,seen:a,narrow:n})}):(0,b.jsx)(vu,{narrow:n,children:(0,b.jsxs)(Du,{children:[(0,b.jsx)(yu,{slug:e.slug}),(0,b.jsx)(`p`,{className:`text-body text-[var(--dim)]`,children:`Connecting…`})]})}):(0,b.jsx)(vu,{narrow:n,children:(0,b.jsxs)(Du,{children:[(0,b.jsx)(`p`,{className:`text-body text-[var(--dim)]`,children:`No mapping job to show.`}),(0,b.jsx)(fa,{to:`/`,className:`text-body text-[var(--accent)] underline underline-offset-2`,children:`Map a repository`})]})})}function Du({children:e}){return(0,b.jsx)(`main`,{className:`mx-auto flex w-full max-w-[680px] flex-col gap-3 px-5 py-10`,children:e})}var Ou=`repo-control`;function ku(e){if(!e.path.startsWith(`/`)||e.path.startsWith(`//`)||e.path.includes(`\\`))throw Error(`Repository actions must stay on this origin`);return e.path}function Au({action:e,children:t}){return e.method===`GET`?(0,b.jsx)(`a`,{href:ku(e),className:`${Ou} repo-control-primary`,children:t}):null}function ju({id:e,onFinished:t}){let{job:n,seen:r,error:i}=gl(e);return(0,_.useEffect)(()=>{(n?.status===`done`||n?.status===`failed`)&&t(n)},[n,t]),i?(0,b.jsx)(`p`,{role:`alert`,className:`text-small`,children:i}):n?n.status===`failed`?(0,b.jsx)(`p`,{role:`alert`,className:`text-small text-[var(--link-out)]`,children:n.error??`Indexing failed. Your saved snapshots are still available.`}):n.status===`done`?null:(0,b.jsx)(wu,{job:n,seen:r,narrow:!0,inline:!0}):(0,b.jsx)(`p`,{role:`status`,children:`Loading indexing progress…`})}function Mu({snapshot:e,currentRevision:t,latest:n,onDelete:r}){let i=(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,b.jsx)(`span`,{className:`font-mono text-row`,children:e.commit.slice(0,8)}),n&&(0,b.jsx)(`span`,{className:`text-meta text-[var(--dim)]`,children:`Latest`})]}),(0,b.jsxs)(`span`,{className:`text-meta text-[var(--dim)]`,children:[(0,b.jsx)(_l,{value:e.indexed_at}),` · `,(0,b.jsx)(`span`,{className:`font-mono`,children:e.files.toLocaleString()}),` files · `,(0,b.jsx)(`span`,{className:`font-mono`,children:e.districts.toLocaleString()}),` districts`]}),e.core_revision&&t&&e.core_revision!==t&&(0,b.jsxs)(`span`,{className:`text-meta text-[var(--dim)]`,children:[`Mapped with a different indexer · `,(0,b.jsx)(`span`,{className:`font-mono`,children:e.core_revision.slice(0,8)})]})]}),a=`repo-snapshot flex min-w-0 flex-1 flex-col justify-center gap-0.5`;return(0,b.jsxs)(`li`,{"data-snapshot-row":!0,className:`relative flex items-center border-b border-[var(--rule)] last:border-b-0`,children:[e.reopen?.method===`GET`?(0,b.jsx)(`a`,{className:`${a} hover:bg-[var(--chrome)]`,href:ku(e.reopen),children:i}):(0,b.jsx)(`div`,{className:a,children:i}),e.delete_snapshot&&(0,b.jsxs)(`details`,{className:`relative mr-2`,children:[(0,b.jsx)(`summary`,{className:`repo-control repo-control-ghost repo-control-icon list-none`,"aria-label":`Actions for snapshot ${e.commit.slice(0,8)}`,children:`⋯`}),(0,b.jsx)(`div`,{className:`repo-menu`,children:(0,b.jsx)(`button`,{type:`button`,className:`repo-control repo-control-ghost repo-control-danger`,onClick:r,children:`Delete snapshot`})})]})]})}function Nu({confirmation:e,pending:t,error:n,onConfirm:r,onClose:i}){let a=(0,_.useRef)(null),[o,s]=(0,_.useState)(``);return(0,_.useEffect)(()=>{a.current?.showModal()},[]),(0,b.jsxs)(`dialog`,{ref:a,onCancel:e=>{e.preventDefault(),t||i()},"aria-labelledby":`repository-confirm-title`,className:`w-[calc(100%-32px)] max-w-[400px] rounded-[14px] border border-[var(--rule)] bg-[var(--chrome2)] p-5 text-[var(--on)] backdrop:bg-black/40`,children:[(0,b.jsxs)(`h2`,{id:`repository-confirm-title`,className:`text-section-title`,children:[e.title,`?`]}),(0,b.jsx)(`p`,{className:`mt-3 text-[14px] text-[var(--dim)]`,children:e.description}),e.typed&&(0,b.jsxs)(`label`,{className:`mt-4 block text-small`,children:[`Type `,(0,b.jsx)(`span`,{className:`font-mono`,children:e.typed}),` to confirm`,(0,b.jsx)(`input`,{autoFocus:!0,value:o,onChange:e=>s(e.target.value),className:`mt-2 min-h-11 w-full rounded-[12px] border border-[var(--rule)] bg-[var(--chrome)] px-3 font-mono`})]}),n&&(0,b.jsx)(`p`,{role:`alert`,className:`mt-3 text-small text-[var(--link-out)]`,children:n}),(0,b.jsxs)(`div`,{className:`mt-5 flex flex-wrap justify-end gap-2`,children:[(0,b.jsx)(`button`,{type:`button`,className:Ou,disabled:t,onClick:i,children:`Cancel`}),(0,b.jsx)(`button`,{"data-confirm-action":!0,type:`button`,className:`${Ou} repo-control-danger disabled:opacity-50`,disabled:t||!!e.typed&&o!==e.typed,onClick:r,children:t?`Working…`:e.label})]})]})}function Pu(){let{repositoryId:e}=Ji({from:`/repositories/$repositoryId/history`}),t=S(),n=st({queryKey:[`repository-history`,e],queryFn:async()=>{let t=await fetch(`${$c}/repositories/${encodeURIComponent(e)}/history`);if(!t.ok)throw Error(`Repository history couldn't be reached.`);return t.json()},retry:!1,refetchInterval:Va?e=>e.state.data?.status?.kind===`indexing`?2e3:3e4:!1}),[r,i]=(0,_.useState)(null),[a,o]=(0,_.useState)(!1),[s,c]=(0,_.useState)(null),[l,u]=(0,_.useState)(),d=n.data,f=l??(d?.status?.kind===`indexing`?d.status.job_id??void 0:void 0),p=(0,_.useCallback)(async()=>{await t.invalidateQueries({queryKey:[`catalogue`]}),await t.invalidateQueries({queryKey:[`repository-history`,e]})},[t,e]),m=(0,_.useCallback)(e=>{if(l&&e.status===`done`){window.location.assign(`/${e.slug}${e.commit?`?commit=${encodeURIComponent(e.commit)}`:``}`);return}u(void 0),p()},[l,p]);async function h(e,t=!1){o(!0),c(null);try{let n=await fetch(ku(e),{method:e.method,headers:{Accept:`application/json`,"Content-Type":`application/json`}});if(!n.ok)throw Error(`Action failed (${n.status}). Please retry.`);if(n.headers.get(`content-type`)?.includes(`application/json`)){let e=await n.json();if(e.job_id)u(e.job_id);else if(e.status===`done`&&e.slug){window.location.assign(`/${e.slug}?commit=${encodeURIComponent(e.commit??``)}`);return}}i(null),t?window.location.assign(`/`):await p()}catch(e){c(e instanceof Error?e.message:`Action failed.`)}finally{o(!1)}}function g(e){document.querySelectorAll(`details[open]`).forEach(e=>e.removeAttribute(`open`)),c(null),i(e)}return(0,b.jsx)(`div`,{className:`h-full overflow-y-auto bg-[var(--chrome)] text-[var(--on)]`,children:(0,b.jsxs)(`main`,{className:`mx-auto flex max-w-[760px] flex-col gap-6 px-5 pb-10 pt-7`,children:[Ha?(0,b.jsx)(Rc,{}):(0,b.jsxs)(`nav`,{className:`flex items-center justify-between`,children:[(0,b.jsx)(fa,{to:`/`,className:`flex min-h-11 items-center text-small text-[var(--accent)]`,children:`‹ Repositories`}),(0,b.jsx)(Ec,{className:`h-11 w-11 rounded-full`})]}),n.isLoading&&(0,b.jsx)(`p`,{children:`Loading repository…`}),n.isError&&(0,b.jsxs)(`div`,{role:`alert`,children:[(0,b.jsx)(`p`,{children:`Repository history couldn't be reached.`}),(0,b.jsx)(`button`,{className:Ou,onClick:()=>void n.refetch(),children:`Retry`})]}),d&&(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)(`header`,{"data-repository-header":!0,className:`flex flex-col gap-3`,children:[(0,b.jsx)(`h1`,{className:`break-words text-title`,children:d.name}),(0,b.jsx)(vl,{status:d.status}),(0,b.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3 py-1`,children:[d.actions.reopen&&(0,b.jsx)(Au,{action:d.actions.reopen,children:`Open latest map`}),d.actions.reindex&&(0,b.jsx)(`button`,{type:`button`,className:`${Ou} disabled:opacity-50`,disabled:a,onClick:()=>void h(d.actions.reindex),children:Va?`Refresh`:`Re-index`}),(d.actions.disconnect||d.actions.delete_repository)&&(0,b.jsxs)(`details`,{className:`relative`,children:[(0,b.jsx)(`summary`,{"aria-label":`Repository actions`,className:`repo-control repo-control-ghost repo-control-icon list-none`,children:`⋯`}),(0,b.jsxs)(`div`,{className:`repo-menu`,children:[d.actions.disconnect&&(0,b.jsx)(`button`,{className:`repo-control repo-control-ghost`,onClick:()=>g({label:`Disconnect`,title:`Disconnect ${d.name}`,description:`Saved snapshots stay, but their maps cannot be opened until you reconnect.`,action:d.actions.disconnect}),children:`Disconnect`}),d.actions.delete_repository&&(0,b.jsx)(`button`,{className:`repo-control repo-control-ghost repo-control-danger`,onClick:()=>g({label:`Delete repository`,title:`Delete ${d.name}`,description:`The repository, all snapshots, maps and stored data are removed.`,action:d.actions.delete_repository,typed:d.name,leave:!0}),children:`Delete repository`})]})]})]})]}),s&&!r&&(0,b.jsx)(`p`,{role:`alert`,className:`text-small text-[var(--link-out)]`,children:s}),(0,b.jsxs)(`section`,{className:`flex flex-col gap-3`,children:[(0,b.jsxs)(`h2`,{className:`text-section-title`,children:[`Snapshot history `,(0,b.jsx)(`span`,{className:`font-mono text-[var(--dim)]`,children:d.snapshots.length})]}),f&&(0,b.jsx)(ju,{id:f,onFinished:m},f),d.snapshots.length===0?(0,b.jsx)(`p`,{"data-history-empty":!0,className:`text-small text-[var(--dim)]`,children:`No snapshots yet. Your first map will appear here.`}):(0,b.jsx)(`ol`,{className:`rounded-[10px] border border-[var(--rule)]`,children:d.snapshots.map((e,t)=>(0,b.jsx)(Mu,{snapshot:e,latest:t===0,currentRevision:d.current_core_revision,onDelete:()=>g({label:`Delete snapshot`,title:`Delete snapshot ${e.commit.slice(0,8)}`,description:`Its map and stored data are removed. Other snapshots stay.${t===0?` The previous snapshot becomes the latest.`:``}`,action:e.delete_snapshot})},e.id))})]})]}),r&&(0,b.jsx)(Nu,{confirmation:r,pending:a,error:s,onClose:()=>i(null),onConfirm:()=>void h(r.action,r.leave)})]})})}function Fu(){return Ha?.private?Promise.resolve([]):fetch(`/maps/index.json`).then(e=>{if(e.status===404)return[];if(!e.ok)throw Error(`/maps/index.json: ${e.status} ${e.statusText}`);return e.json()})}function Iu(e,t){return Qc(`/maps/${e}/${t}.json`,`map:${e}/${t}`,n=>{if(!n.ok)throw Error(`/maps/${e}/${t}.json: ${n.status} ${n.statusText}`)})}function Lu(e,t,n){return Qc(`/maps/${e}/${t}.symbols/${n}.json`,`symbols:${e}/${t}:${n}`,r=>{if(!r.ok)throw Error(`/maps/${e}/${t}.symbols/${n}.json: ${r.status} ${r.statusText}`)})}function Ru(e){return e.repository_id?{...e,file:``,source:`service`}:{slug:e.slug,label:e.label,owner:e.owner,repo:e.repo,file:``,files:e.files,districts:e.districts,modularity:e.modularity,lang:e.lang,source:`service`,commit:e.commit}}function zu(){return st({queryKey:[`service-available`],queryFn:()=>ul(),staleTime:15e3,retry:!1,refetchOnWindowFocus:!0})}function Bu(e,t){if(![...e??[],...t??[]].some(e=>e.repository_id)){let n=new Map;for(let t of e??[])n.set(t.slug,t);for(let e of t??[])n.set(e.slug,Ru(e));return[...n.values()].sort((e,t)=>e.slug.localeCompare(t.slug))}let n=new Map;for(let t of e??[])n.set(t.slug,t);for(let e of t??[]){let t=n.get(e.slug);(t?.source!==`service`||(e.indexed_at??``)>=(t.indexed_at??``))&&n.set(e.slug,Ru(e))}let r=new Map;for(let e of n.values()){let t=e.repository_id??e.slug,n=r.get(t);(!n||(e.indexed_at??``)>(n.indexed_at??``))&&r.set(t,e)}return[...r.values()].sort((e,t)=>e.repository_id&&t.repository_id&&(t.indexed_at??``).localeCompare(e.indexed_at??``)||e.slug.localeCompare(t.slug))}function Vu(){let e=zu(),t=e.data,n=e.isLoading,r=st({queryKey:[`catalogue`,`static`],queryFn:Fu,staleTime:1/0,retry:!1}),i=st({queryKey:[`catalogue`,`service`],queryFn:cl,enabled:t===!0,staleTime:Va?0:15e3,refetchInterval:Va?e=>e.state.data?.some(e=>e.status?.kind===`indexing`)?2e3:3e4:!1,retry:!1}),a=Bu(r.data,i.data),o=r.data!==void 0||i.data!==void 0,s=!o&&(n||r.isLoading||t===!0&&i.isFetching),c=(Ha?.private||!o&&r.isError)&&(t===!1||i.isError);function l(){e.refetch(),r.refetch(),t===!0&&i.refetch()}return{data:a,isLoading:s,isError:c,error:r.error??i.error,serviceAvailable:t===!0,refetch:l}}function Hu(e,t,n={}){let{data:r,isLoading:i}=zu(),a=st({queryKey:n.commit?[`map`,`service`,e,t,n.commit]:[`map`,`service`,e,t],queryFn:()=>fl(e,t,n.commit),enabled:r===!0&&!!e&&!!t&&!n.wait,staleTime:15e3,retry:!1}),o=r===!1||r===!0&&a.isError,s=st({queryKey:[`map`,`static`,e,t],queryFn:()=>Iu(e,t),enabled:!n.commit&&!Ha?.private&&o&&!!e&&!!t,staleTime:1/0,retry:!1}),c=a.data?.document??(n.commit?void 0:s.data),l=!c&&(i||!!n.wait||r===!0&&a.isFetching||o&&s.isFetching),u=!c&&o&&(!!n.commit||Ha?.private||s.isError);return{data:c,indexedCommit:a.data?.indexedCommit,mapSha256:a.data?.mapSha256,isLoading:l,isError:u,error:s.error??a.error,source:a.data?`service`:s.data?`static`:void 0}}function Uu(e,t,n,r,i={}){let a=i.ready??!0,o=at({queries:r.map(r=>({queryKey:i.commit?[`symbols`,n,e,t,r,i.commit]:[`symbols`,n,e,t,r],queryFn:()=>n===`service`?ll(e,t,r,i.commit):Lu(e,t,r),enabled:!!n&&!!e&&!!t&&a,staleTime:1/0,retry:!1}))}),s=r.map((e,t)=>`${e}:${o[t]?.dataUpdatedAt??0}:${+!!o[t]?.isLoading}`).join(`,`)+`|${i.commit??``}|${+!!a}`;return(0,_.useMemo)(()=>{let e=new Map,t=new Set;return r.forEach((n,r)=>{let i=o[r]?.data;i?e.set(n,i):o[r]?.isLoading&&t.add(n)}),{map:e,loading:t}},[s])}var Wu=new Set([`about`,`docs`,`api`,`new`,`settings`,`assets`,`static`,`health`,`login`,`admin`,`search`,`org`]),Gu=`[A-Za-z0-9](?:[A-Za-z0-9-]{0,38}[A-Za-z0-9])?`,Ku=`[A-Za-z0-9_.-]+`,qu=RegExp(`^https?://(?:www\\.)?github\\.com/(${Gu})/(${Ku}?)(?:\\.git)?/?(?:[?#].*)?$`),Ju=RegExp(`^(${Gu})/(${Ku})$`);function Yu(e){let t=e.trim();if(!t)return null;let n=t.match(qu);if(n){let[,e,r]=n,i=r.replace(/\.git$/,``);return!e||!i?null:{owner:e,repo:i,apiValue:t}}let r=t.match(Ju);if(r){let[,e,t]=r,n=t.replace(/\.git$/,``);return n?{owner:e,repo:n,apiValue:`${e}/${n}`}:null}return null}function Xu(e){let t=Yu(e);return t?Wu.has(t.owner.toLowerCase())?{ok:!1,message:`"${t.owner}" is reserved by tolmap and can never be a repository owner`}:{ok:!0,parsed:t}:{ok:!1,message:`enter owner/name or a github.com/owner/name URL`}}function Zu(){let e=z(),{data:t}=zu(),[n,r]=(0,_.useState)(``),[i,a]=(0,_.useState)(null),[o,s]=(0,_.useState)(null),[c,l]=(0,_.useState)(!1),u=t===!1,d=Ra({select:e=>e.hash}),f=(0,_.useRef)(null);(0,_.useEffect)(()=>{d===`repo-field`&&f.current?.focus()},[d]);async function p(t){if(t.preventDefault(),u||c)return;s(null);let r=Xu(n);if(!r.ok){a(r.message);return}a(null),l(!0);try{let t=await al({repo:r.parsed.apiValue});if(t.status===`done`){let[n,r]=t.slug.split(`/`);await e({to:`/$owner/$repo`,params:{owner:n,repo:r},search:{geo:`r`,layer:`d`}})}else await e({to:`/new`,search:{job:t.job_id,slug:t.slug}})}catch(e){e instanceof el?s({message:e.code===`busy`?`The index queue is full. Please try again shortly.`:e.message,tooLarge:e.tooLarge}):s({message:e instanceof Error?e.message:String(e),tooLarge:!1})}finally{l(!1)}}return(0,b.jsxs)(`form`,{onSubmit:e=>void p(e),className:`flex flex-col gap-2`,children:[(0,b.jsx)(`label`,{htmlFor:`repo-field`,className:`text-small font-semibold`,children:`GitHub repository`}),(0,b.jsx)(`input`,{id:`repo-field`,ref:f,"data-repo-field":!0,value:n,onChange:e=>{r(e.target.value),i&&a(null)},placeholder:`owner/repo or a github.com link`,"aria-invalid":i!=null,"aria-describedby":i?`repo-field-error`:void 0,disabled:u||c,className:`h-8 rounded-[7px] border border-[var(--rule)] bg-[var(--chrome2)] px-3 font-mono text-body text-[var(--on)] outline-none placeholder:text-[var(--dim)] focus-visible:ring-2 focus-visible:ring-[var(--accent)] disabled:opacity-50`}),(0,b.jsx)(`button`,{type:`submit`,disabled:u||c||n.trim().length===0,className:`repo-control repo-control-primary self-start`,children:c?`mapping…`:`Map it`}),(0,b.jsx)(`p`,{className:`text-meta text-[var(--dim)]`,children:`A large repository can take several minutes; you can leave and come back.`}),u&&(0,b.jsx)(`p`,{className:`text-meta text-[var(--dim)]`,children:`the indexing service isn't reachable right now — the mapped repositories below still work.`}),i&&(0,b.jsx)(`p`,{id:`repo-field-error`,"data-repo-validation-error":!0,className:`text-meta text-[var(--link-out)]`,children:i}),o&&(0,b.jsxs)(`p`,{"data-repo-submit-error":!0,className:`text-meta ${o.tooLarge?`text-[var(--warn)]`:`text-[var(--link-out)]`}`,children:[o.tooLarge?`too large for the hosted index: `:``,o.message]})]})}function Qu({size:e=20,className:t,children:n}){return(0,b.jsx)(`svg`,{width:e,height:e,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,className:t,children:n})}var $u=({size:e=20})=>(0,b.jsxs)(Qu,{size:e,children:[(0,b.jsx)(`circle`,{cx:`11`,cy:`11`,r:`7`}),(0,b.jsx)(`path`,{d:`M20 20l-3.5-3.5`})]}),ed=({size:e=20})=>(0,b.jsxs)(Qu,{size:e,children:[(0,b.jsx)(`path`,{d:`M4 11l8-7 8 7`}),(0,b.jsx)(`path`,{d:`M6 9.5V20h12V9.5`})]}),td=({size:e=20})=>(0,b.jsx)(Qu,{size:e,children:(0,b.jsx)(`path`,{d:`M12 5v14M5 12h14`})}),nd=({size:e=20})=>(0,b.jsx)(Qu,{size:e,children:(0,b.jsx)(`path`,{d:`M5 12h14`})}),rd=({size:e=20})=>(0,b.jsx)(Qu,{size:e,children:(0,b.jsx)(`path`,{d:`M9 4v5H4M15 4v5h5M9 20v-5H4M15 20v-5h5`})}),id=()=>(0,b.jsxs)(Qu,{children:[(0,b.jsx)(`path`,{d:`M12 3l9 5-9 5-9-5 9-5z`}),(0,b.jsx)(`path`,{d:`M3 13l9 5 9-5`})]}),ad=()=>(0,b.jsx)(Qu,{size:18,children:(0,b.jsx)(`path`,{d:`M6 6l12 12M18 6L6 18`})}),od=({className:e}={})=>(0,b.jsx)(Qu,{size:14,className:e,children:(0,b.jsx)(`path`,{d:`M9 6l6 6-6 6`})}),sd=({size:e=22}={})=>(0,b.jsx)(Qu,{size:e,children:(0,b.jsx)(`path`,{d:`M15 5l-7 7 7 7`})}),cd=()=>(0,b.jsx)(Qu,{size:14,children:(0,b.jsx)(`path`,{d:`M6 6l12 12M18 6L6 18`})}),ld=({size:e=20})=>(0,b.jsx)(Qu,{size:e,children:(0,b.jsx)(`path`,{d:`M4 6l5-2 6 2 5-2v14l-5 2-6-2-5 2z`})}),ud=({size:e=20})=>(0,b.jsx)(Qu,{size:e,children:(0,b.jsx)(`path`,{d:`M6 3h8l4 4v14H6z`})}),dd=({size:e=20})=>(0,b.jsx)(Qu,{size:e,children:(0,b.jsx)(`path`,{d:`M8 4c-2 0-3 1-3 3v2c0 1.5-1 2.5-2 3 1 .5 2 1.5 2 3v2c0 2 1 3 3 3M16 4c2 0 3 1 3 3v2c0 1.5 1 2.5 2 3-1 .5-2 1.5-2 3v2c0 2-1 3-3 3`})}),fd=({size:e=18})=>(0,b.jsx)(Qu,{size:e,children:(0,b.jsx)(`path`,{d:`M9 4H4v5M15 4h5v5M9 20H4v-5M15 20h5v-5`})}),pd=({size:e=20})=>(0,b.jsxs)(Qu,{size:e,children:[(0,b.jsx)(`rect`,{x:`3`,y:`4`,width:`18`,height:`16`,rx:`2`}),(0,b.jsx)(`path`,{d:`M9 4v16`})]}),md=({size:e=14})=>(0,b.jsx)(Qu,{size:e,children:(0,b.jsx)(`path`,{d:`M6 9l6 6 6-6`})});function hd({repositoryId:e,name:t}){let[n,r]=(0,_.useState)(!1),[i,a]=(0,_.useState)(!1),[o,s]=(0,_.useState)(),c=z(),l=st({queryKey:[`repository-history`,e],enabled:n,queryFn:async()=>{let t=await fetch(`${$c}/repositories/${encodeURIComponent(e)}/history`);if(!t.ok)throw Error(`Repository actions couldn't be reached.`);return t.json()},retry:!1});async function u(){let e=l.data?.actions.reindex;if(e&&!i){a(!0),s(void 0);try{let t=await fetch(za(e.path),{method:e.method,headers:{Accept:`application/json`,"Content-Type":`application/json`}});if(!t.ok)throw Error(`Re-indexing couldn't be started. Try again shortly.`);let n=await t.json();n.status===`done`?window.location.assign(`/${n.slug}?commit=${encodeURIComponent(n.commit)}`):await c({to:`/new`,search:{job:n.job_id,slug:n.slug}})}catch(e){s(e instanceof Error?e.message:`Re-indexing failed.`)}finally{a(!1)}}}return(0,b.jsxs)(`details`,{className:`relative mr-2`,onToggle:e=>r(e.currentTarget.open),children:[(0,b.jsx)(`summary`,{className:`repo-control repo-control-ghost repo-control-icon list-none`,"aria-label":`Actions for ${t}`,children:`⋯`}),(0,b.jsxs)(`div`,{className:`repo-menu`,children:[l.isLoading&&(0,b.jsx)(`p`,{className:`px-2 py-1 text-meta`,children:`Loading actions…`}),l.data?.actions.reindex&&(0,b.jsx)(`button`,{type:`button`,className:`repo-control repo-control-ghost`,disabled:i,onClick:()=>void u(),children:i?`Starting…`:`Re-index`}),l.data&&!l.data.actions.reindex&&(0,b.jsx)(`p`,{className:`px-2 py-1 text-meta text-[var(--dim)]`,children:`No actions available`}),(o||l.error)&&(0,b.jsx)(`p`,{role:`alert`,className:`px-2 py-1 text-meta text-[var(--link-out)]`,children:o??l.error?.message})]})]})}function gd({m:e}){return e.repository_id?(0,b.jsxs)(`div`,{"data-catalogue-row":!0,className:`relative flex min-h-[64px] items-center border-b border-[var(--rule)] last:border-b-0`,children:[(0,b.jsxs)(fa,{to:`/repositories/$repositoryId/history`,params:{repositoryId:e.repository_id},"aria-label":`View repository ${e.label??e.slug}`,className:`flex min-h-16 min-w-0 flex-1 flex-col justify-center gap-0.5 px-4 py-2 hover:bg-[var(--chrome)]`,children:[(0,b.jsxs)(`span`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1`,children:[(0,b.jsx)(`span`,{className:`truncate font-mono text-row`,children:e.label??e.slug}),(0,b.jsx)(vl,{status:e.status})]}),(0,b.jsxs)(`span`,{className:`text-meta text-[var(--dim)]`,children:[(0,b.jsx)(`span`,{className:`font-mono`,children:e.files.toLocaleString()}),` files · `,(0,b.jsx)(`span`,{className:`font-mono`,children:e.districts.toLocaleString()}),` districts · `,e.lang,e.indexed_at&&(0,b.jsxs)(b.Fragment,{children:[` · `,(0,b.jsx)(_l,{value:e.indexed_at})]})]})]}),e.latest_snapshot_id&&(0,b.jsxs)(fa,{to:`/$owner/$repo`,params:{owner:Va?`snapshot`:e.owner,repo:Va?e.latest_snapshot_id:e.repo},search:{geo:`r`,layer:`d`},className:`repo-control repo-control-ghost mr-2`,"aria-label":`Open latest map for ${e.label??e.slug}`,children:[`Map `,(0,b.jsx)(od,{})]}),Ha&&(0,b.jsx)(hd,{repositoryId:e.repository_id,name:e.label??e.slug})]}):(0,b.jsxs)(fa,{to:`/$owner/$repo`,params:{owner:e.owner,repo:e.repo},search:{geo:`r`,layer:`d`},"data-catalogue-row":!0,className:`flex min-h-[64px] w-full items-center gap-3 border-b border-[var(--rule)] px-4 py-2.5 text-left last:border-b-0 hover:bg-[var(--chrome)]`,children:[(0,b.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[(0,b.jsx)(`span`,{className:`truncate font-mono text-row`,children:e.label??e.slug}),(0,b.jsxs)(`span`,{className:`truncate text-meta text-[var(--dim)]`,children:[(0,b.jsx)(`span`,{className:`font-mono`,children:e.files.toLocaleString()}),` files ·`,` `,(0,b.jsx)(`span`,{className:`font-mono`,children:e.districts.toLocaleString()}),` district`,e.districts===1?``:`s`,` ·`,` `,e.lang]})]}),(0,b.jsx)(`span`,{className:`flex-none text-[var(--dim)]`,"aria-hidden":`true`,children:(0,b.jsx)(od,{})})]})}function _d(){let{data:e,isLoading:t,isError:n,serviceAvailable:r,refetch:i}=Vu();return(0,b.jsx)(`div`,{className:`h-full overflow-y-auto bg-[var(--chrome)] text-[var(--on)]`,children:(0,b.jsxs)(`div`,{className:`mx-auto flex w-full max-w-[640px] flex-col gap-8 px-5 pb-10`,style:{paddingTop:`calc(28px + env(safe-area-inset-top, 0px))`},children:[(0,b.jsx)(Rc,{}),!Ha&&(0,b.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,b.jsx)(`h1`,{className:`text-title`,children:`Map a codebase`}),(0,b.jsx)(`p`,{className:`text-body text-[var(--dim)]`,children:`tolmap groups a repository's files into districts by how they import each other and change together, so you can see its structure and find what to optimize.`}),(0,b.jsx)(Zu,{})]}),(0,b.jsxs)(`div`,{className:`flex flex-col gap-2.5`,children:[(!Ha||e.length>0||t||n)&&(0,b.jsx)(`h2`,{className:`text-section-title`,children:`Mapped repositories`}),t&&(0,b.jsx)(`p`,{className:`text-small text-[var(--dim)]`,children:`loading…`}),n&&(0,b.jsxs)(`div`,{"data-catalogue-error":!0,className:`flex flex-col items-start gap-3 rounded-[14px] border border-[var(--rule)] bg-[var(--chrome2)] p-4`,children:[(0,b.jsx)(`p`,{className:`text-small text-[var(--link-out)]`,children:`tolmap's index couldn't be reached. This is usually temporary.`}),(0,b.jsx)(`button`,{type:`button`,"data-catalogue-retry":!0,onClick:()=>i(),className:`repo-control`,children:`Retry`})]}),!t&&!n&&e.length===0&&(Ha?(0,b.jsxs)(`div`,{"data-catalogue-empty":!0,className:`flex flex-col items-start gap-3 rounded-[14px] border border-[var(--rule)] p-5`,children:[(0,b.jsx)(`h1`,{className:`text-section-title`,children:`Map your first repository`}),(0,b.jsx)(`p`,{className:`text-small text-[var(--dim)]`,children:`Choose the repositories you want to explore.`}),(0,b.jsx)(Lc,{})]}):(0,b.jsx)(`p`,{"data-catalogue-empty":!0,className:`text-small text-[var(--dim)]`,children:`No repositories mapped yet — paste one above.`})),!t&&!n&&e.length>0&&(0,b.jsx)(`div`,{className:`flex flex-col rounded-[14px] border border-[var(--rule)]`,children:e.map(e=>(0,b.jsx)(gd,{m:e},e.repository_id??e.slug))}),!n&&r===!1&&e.length>0&&(0,b.jsx)(`p`,{className:`text-meta text-[var(--dim)]`,children:`showing the bundled catalogue only — the indexing service isn't reachable.`})]})]})})}function vd(){let e=Ji({strict:!1}).name??``;return(0,b.jsxs)(`div`,{className:`flex h-full flex-col items-center justify-center gap-3 bg-[var(--chrome)] p-8 text-center text-[var(--on)]`,children:[(0,b.jsxs)(`h1`,{className:`font-mono text-title`,children:[`/`,e]}),(0,b.jsxs)(`p`,{className:`max-w-sm text-small text-[var(--dim)]`,children:[`This name is reserved for tolmap itself and will never route to a GitHub owner called "`,e,`".`]}),(0,b.jsx)(fa,{to:`/`,className:`text-small text-[var(--accent)] underline underline-offset-2`,children:`back to the map index`})]})}var yd=`@debt`,bd=e=>e===yd,xd=e=>bd(e)?`Debt`:e;function Sd(e){if(e.startsWith(`cycle-cut-`))return`cycle-cut`;if(e.startsWith(`cycle-`))return`cycle`;if(e.startsWith(`hidden-coupling-`))return`hidden-coupling`}var Cd={cycle:`District cycle: its closing edges`,"cycle-cut":`Cycle cut: one bundle of a heuristic cut`,"hidden-coupling":`Hidden coupling: co-changed, no static edge`};function wd(e,t,n){let r=new Map(t.map((e,t)=>[e,t])),i=new Map;for(let t of e)if(Sd(t.name)===`cycle-cut`)for(let e of t.hops){if(!e.resolved||e.source!==`computed`)continue;let t=e.via.map(e=>r.get(e)).filter(e=>e!=null).map(n);for(let e=1;e<t.length;e++){let n=t[e-1],r=t[e];if(n===r)continue;let a=`${n}-${r}`,o=i.get(a)??{from:n,to:r,edges:0};o.edges++,i.set(a,o)}}return[...i.values()].sort((e,t)=>e.from-t.from||e.to-t.to)}function Td(e,t,n,r,i){let a=new URLSearchParams({base:n.base??``,head:n.head??``,lens:n.lens??``});return n.other_lens&&a.set(`other`,n.other_lens),st({queryKey:[`lens-comparison`,e,t,a.toString(),r,i],enabled:!!n.lens_compare&&!!n.base&&!!n.head&&!!n.lens&&!!r&&!!i,retry:!1,staleTime:0,gcTime:0,queryFn:async({signal:o})=>{let s=bd(n.lens)?`debt?${new URLSearchParams({base:n.base??``,head:n.head??``})}`:`lenses?${a}`,c=await fetch(`${$c}/compare/${encodeURIComponent(e)}/${encodeURIComponent(t)}/${s}`,{signal:o,cache:`no-store`}),l=await c.json();if(!c.ok)throw Error(l.message??`Lens comparison unavailable`);let u=l;if(u.version!==1||!u.lower_bound)throw Error(`Unsupported lens comparison version`);if(!i||u.base_map_sha256!==i||r!==n.base||e!==`snapshot`&&u.repository!==`${e}/${t}`||u.base!==n.base||u.head!==n.head||u.lens!==n.lens||u.other!==(n.other_lens??n.lens))throw Error(`Stale or mismatched lens comparison snapshot. Reload the base map.`);return u}})}function Ed(e,t){if(t.lens!==t.other){if(e.status===`removed`)return`Only in ${t.lens}`;if(e.status===`added`)return`Only in ${t.other}`;if(e.status===`shared`)return`In both`}return{added:`Added`,removed:`Removed`,broken:`Broken`,renamed:`Renamed`,moved:`Moved`,shared:`Unchanged`}[e.status]}function Dd({change:e,data:t,pick:n}){let r=[...new Set([...e.before,...e.after])],i=[...new Map(t.after.unresolved.flatMap(t=>t.renamed&&e.before.some(e=>e.split(`#`)[0]===t.renamed.from)?[[t.renamed.from,t.renamed]]:[])).values()];return(0,b.jsxs)(`li`,{"data-lens-delta":e.status,children:[(0,b.jsx)(`strong`,{children:Ed(e,t)}),(0,b.jsx)(`small`,{children:e.label}),(0,b.jsx)(`div`,{className:`lens-delta-paths`,children:r.map((t,r)=>{let i=e.targets.find(e=>e.path===t.split(`#`)[0]);return(0,b.jsxs)(`span`,{children:[r>0&&(0,b.jsx)(`span`,{"aria-hidden":`true`,children:` → `}),i?(0,b.jsx)(`button`,{onClick:()=>n(i),children:t}):(0,b.jsx)(`span`,{children:t})]},t)})}),e.status===`renamed`&&(0,b.jsx)(`small`,{children:i.length?i.map(e=>`Unresolved at head · rename commit ${e.commit.slice(0,12)}`).join(`; `):`Rename at ${t.head.slice(0,12)}`}),!e.targets.length&&(0,b.jsxs)(`small`,{children:[`No base footprint`,e.districts.length?` · districts ${e.districts.join(`, `)}`:` · unplaced`]})]})}function Od({search:e,result:t,list:n,update:r,pick:i,embedded:a=!1,expanded:o=!0,onExpand:s}){let c=!t.isFetching&&!t.error?t.data:void 0,[l,u]=(0,_.useState)(!1),d=(0,_.useRef)(null);(0,_.useEffect)(()=>{if(!c||l)return;let e=d.current;(a?e?.closest(`[data-sheet-body]`):e?.querySelector(`.lens-comparison-results`))?.scrollTo({top:0})},[c,l,a]);let f=c?c.lens!==c.other:!!e.other_lens,p=c?.changes.filter(e=>e.status!==`shared`)??[],m=c?.changes.filter(e=>e.status===`shared`)??[],h=l||!t.data,g=e=>[`area`,`stop`,`hop`].map(t=>{let n=e.filter(e=>e.kind===t);return n.length>0&&(0,b.jsxs)(`section`,{children:[(0,b.jsxs)(`h3`,{children:[t===`area`?`Area membership`:t===`stop`?`Stops`:`Hops`,` · `,n.length]}),(0,b.jsx)(`ul`,{children:n.map((e,t)=>(0,b.jsx)(Dd,{change:e,data:c,pick:i},t))})]},t)});return(0,b.jsxs)(`aside`,{ref:d,className:`comparison-panel lens-comparison-panel${a?` lens-comparison-sheet`:``}`,"aria-label":`Lens comparison`,"data-lens-comparison":!0,children:[(0,b.jsxs)(`header`,{children:[(0,b.jsx)(`h2`,{children:`Lens comparison`}),(0,b.jsx)(`button`,{onClick:()=>r({lens_compare:void 0,other_lens:void 0,compare:void 0,head:void 0,commit:e.base}),children:`Return to lens`})]}),(0,b.jsxs)(`div`,{className:`lens-comparison-summary`,"data-lens-comparison-summary":!0,"data-lens-comparison-state":!o&&c?`loaded`:void 0,children:[o&&(0,b.jsxs)(`p`,{children:[f?`${e.lens} ∩ ${e.other_lens}`:e.lens&&xd(e.lens),` · `,e.base?.slice(0,8),!f&&e.head?` → ${e.head.slice(0,8)}`:``]}),c&&(0,b.jsx)(`p`,{children:a&&!o?(0,b.jsx)(`button`,{"aria-label":`View changes`,onClick:s,children:f?`${p.length} differing · ${m.length} in both`:`${p.length} changes · ${m.length} unchanged`}):f?`${p.length} differing · ${m.length} in both`:`${p.length} changes · ${m.length} unchanged`}),a&&!o&&!c&&(0,b.jsx)(`button`,{onClick:s,children:t.error?`Stale or unavailable · View details`:`Set up comparison`})]}),o&&(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)(`div`,{className:`lens-comparison-edit${h?` is-open`:``}`,children:[(0,b.jsx)(`button`,{"aria-expanded":h,onClick:()=>u(e=>!e),children:`Edit comparison`}),h&&(0,b.jsxs)(`form`,{onSubmit:e=>{e.preventDefault();let t=new FormData(e.currentTarget),n=String(t.get(`other`)??``),i=String(t.get(`base`));u(!1),r({lens_compare:!0,compare:!0,base:i,head:n?i:String(t.get(`head`)),other_lens:n||void 0})},children:[(0,b.jsxs)(`label`,{children:[`Base commit`,(0,b.jsx)(`input`,{"aria-label":`Lens base commit`,name:`base`,required:!0,pattern:`[a-f0-9]{40}|[a-f0-9]{64}`,defaultValue:e.base??e.commit})]}),(0,b.jsxs)(`label`,{children:[`Head commit`,(0,b.jsx)(`input`,{"aria-label":`Lens head commit`,name:`head`,pattern:`[a-f0-9]{40}|[a-f0-9]{64}`,defaultValue:e.head,placeholder:`Same lens at another commit`})]}),!bd(e.lens)&&(0,b.jsxs)(`label`,{children:[`Compare with lens at base`,(0,b.jsxs)(`select`,{name:`other`,"aria-label":`Compare with lens`,defaultValue:e.other_lens??``,children:[(0,b.jsx)(`option`,{value:``,children:`Same lens across commits`}),e.other_lens&&!n?.names.includes(e.other_lens)&&(0,b.jsx)(`option`,{value:e.other_lens,children:e.other_lens}),n?.names.filter(t=>t!==e.lens).map(e=>(0,b.jsx)(`option`,{children:e},e))]})]}),(0,b.jsx)(`button`,{children:`Compare lenses`})]})]}),(0,b.jsx)(`div`,{className:`lens-comparison-results`,children:c&&(0,b.jsxs)(`div`,{"data-lens-comparison-state":`loaded`,children:[(0,b.jsx)(`p`,{className:`lens-legend`,children:f?`+ Only in ${c.other} · − Only in ${c.lens} · = In both`:`+ Added · − Removed · × Broken · ↗ Renamed · ↔ Moved`}),g(p),!p.length&&(0,b.jsx)(`p`,{children:f?`All members, stops and hops are in both lenses.`:`No changes to this lens.`}),!!m.length&&(0,b.jsxs)(`details`,{"data-lens-unchanged":!0,children:[(0,b.jsxs)(`summary`,{children:[m.length,` `,f?`in both`:`unchanged`]}),g(m)]}),(0,b.jsx)(`small`,{children:`Fixed base map · routes are lower bounds · new files have district placement only.`}),[`before`,`after`].map(e=>c[e].unresolved.length>0&&(0,b.jsxs)(`details`,{children:[(0,b.jsxs)(`summary`,{children:[c[e].unresolved.length,` unresolved `,e]}),(0,b.jsx)(`ul`,{children:c[e].unresolved.map((e,t)=>(0,b.jsxs)(`li`,{children:[(0,b.jsx)(`strong`,{children:e.kind}),` · `,e.location,(0,b.jsxs)(`p`,{children:[e.spec,`: `,e.detail]})]},t))})]},e))]})})]}),!e.base||!e.head?(0,b.jsx)(`p`,{children:`Choose two commits, or another lens at the base commit.`}):t.isPending||t.isFetching?(0,b.jsx)(`p`,{role:`status`,"data-lens-comparison-state":`loading`,children:t.isFetching&&t.data?`Revalidating; previous lens comparison is stale.`:`Computing lens comparison…`}):null,t.error&&(o?(0,b.jsxs)(`p`,{role:`alert`,"data-lens-comparison-state":`error`,children:[t.error.message,` `,(0,b.jsx)(`button`,{onClick:()=>{t.refetch()},children:`Retry`})]}):(0,b.jsx)(`span`,{role:`alert`,className:`sr-only`,"data-lens-comparison-state":`error`,children:t.error.message}))]})}async function kd(e,t){let n=await fetch(e,{signal:t});if(!n.ok){let e=await n.json();throw Error(e.message??`Lenses unavailable (${n.status})`)}return n.json()}function Ad(e,t,n,r,i){let a=`${$c}/maps/${encodeURIComponent(e)}/${encodeURIComponent(t)}`,o=`${a}/lenses`,s=n?`?commit=${n}`:``,c=st({queryKey:[`lenses`,e,t,n],enabled:i&&!!n,retry:!1,queryFn:({signal:e})=>kd(o+s,e)}),l=st({queryKey:[`lens`,e,t,n,r],enabled:i&&!!n&&!!r,retry:!1,queryFn:({signal:e})=>kd(bd(r)?`${a}/debt${s}`:`${o}/${encodeURIComponent(r)}${s}`,e)}),u=l.data&&(l.data.name!==r||n&&l.data.commit!==n);return{list:c,resolved:l,data:u?void 0:l.data,error:i&&!n?Error(`Lenses require a map with a pinned service snapshot.`):u?Error(`Lens snapshot does not match this map.`):c.error??l.error}}function jd({lenses:e,name:t,select:n,pick:r,mode:i=`full`,details:a,compare:o,walk:s,focus:c,show:l}){let{list:u,resolved:d,data:f,error:p}=e,m=(0,b.jsxs)(`div`,{className:`lens-body`,children:[i!==`sheet`&&(0,b.jsxs)(`label`,{children:[`Saved lens`,(0,b.jsxs)(`select`,{"aria-label":`Saved lens`,value:t??``,onChange:e=>n(e.target.value||void 0),children:[(0,b.jsx)(`option`,{value:``,children:`None`}),(0,b.jsx)(`optgroup`,{label:`Built-in`,children:(0,b.jsx)(`option`,{value:`@debt`,children:`Debt`})}),(0,b.jsxs)(`optgroup`,{label:`Repository`,children:[t&&!bd(t)&&!u.data?.names.includes(t)&&(0,b.jsx)(`option`,{value:t,children:t}),u.data?.names.map(e=>(0,b.jsx)(`option`,{value:e,children:e},e))]})]})]}),p?(0,b.jsx)(`p`,{role:`alert`,"data-lens-state":`error`,children:p.message}):u.isPending||t&&d.isPending?(0,b.jsx)(`p`,{role:`status`,children:`Loading lenses…`}):!u.data?.names.length&&!f?(0,b.jsx)(`p`,{"data-lens-state":`empty`,children:`No lenses at this snapshot.`}):null,f&&o&&(0,b.jsx)(`button`,{onClick:o,children:`Compare this lens`}),f&&i!==`picker`&&bd(t)&&!f.report.areas.length&&(0,b.jsx)(`p`,{"data-lens-state":`empty`,children:`No debt findings at this snapshot. Findings are lower bounds over the map's edges.`}),f&&i!==`picker`&&!(bd(t)&&!f.report.areas.length)&&(0,b.jsxs)(`div`,{"data-lens-state":f.report.unresolved.length?`unresolved`:`loaded`,children:[bd(t)&&(0,b.jsx)(`p`,{className:`lens-meta`,"data-debt-summary":!0,children:`Debt findings are lower bounds over the map's edges: district cycles, misplaced files, god files, hotspots and files with no inbound edge found. Measured values are in the notes. Red roads carry a suggested cycle cut, stronger with more cut edges, with the mark pointing along the cut; choose Show on map for one path's routes.`}),f.report.paths.map(e=>{let n=bd(t)?Sd(e.name):void 0;return(0,b.jsxs)(`section`,{children:[(0,b.jsx)(`h3`,{children:e.name}),n&&(0,b.jsx)(`p`,{className:`lens-meta`,"data-debt-path-kind":n,children:Cd[n]}),(l||s&&e.stops.length>0)&&(0,b.jsxs)(`div`,{className:`lens-path-actions`,children:[l&&(0,b.jsx)(`button`,{"aria-pressed":c===e.name,"data-lens-focus":e.name,onClick:()=>l(c===e.name?void 0:e.name),children:`Show on map`}),s&&e.stops.length>0&&(0,b.jsx)(`button`,{"data-lens-walk-start":e.name,onClick:()=>s(e.name),children:`Start walkthrough`})]}),(0,b.jsx)(`ol`,{children:e.stops.map((t,n)=>{let i=e.hops.find(e=>e.to===n);return(0,b.jsxs)(`li`,{"data-lens-stop-row":n,children:[i&&(0,b.jsxs)(`p`,{className:`lens-meta`,children:[i.resolved?i.source===`declared`?`Declared`:`Computed · ${i.edge_kind}`:`Unresolved hop`,i.reason?` — ${i.reason}`:``]}),t.target?(0,b.jsx)(`button`,{onClick:()=>r(t.target),children:t.spec}):(0,b.jsxs)(`span`,{children:[`Unresolved stop: `,t.spec]})]},n)})})]},e.name)}),(0,b.jsxs)(`p`,{className:`lens-meta`,children:[bd(t)?`Computed`:`Saved`,` at `,f.commit.slice(0,12),` · computed paths are lower bounds from available edges.`]}),(0,b.jsxs)(`p`,{className:`lens-legend`,children:[(0,b.jsx)(`i`,{className:`lens-computed`}),` Computed `,(0,b.jsx)(`i`,{className:`lens-declared`}),` Declared`]}),f.report.areas.length>0&&(0,b.jsxs)(`section`,{children:[(0,b.jsx)(`h3`,{children:`Areas`}),f.report.areas.map(e=>(0,b.jsxs)(`details`,{children:[(0,b.jsxs)(`summary`,{children:[(0,b.jsx)(`i`,{className:`lens-swatch`,style:{background:`var(--lens-${e.color})`}}),e.label,` · `,e.members.length]}),(0,b.jsx)(`ul`,{children:e.members.map((e,t)=>(0,b.jsx)(`li`,{children:(0,b.jsx)(`button`,{onClick:()=>r(e.target),children:e.spec})},t))})]},e.label))]}),f.report.notes.length>0&&(0,b.jsxs)(`section`,{children:[(0,b.jsx)(`h3`,{children:`Notes`}),f.report.notes.map((e,t)=>(0,b.jsxs)(`div`,{className:`lens-note`,children:[(0,b.jsx)(`span`,{className:`lens-meta`,children:e.target?(0,b.jsx)(`button`,{onClick:()=>r(e.target),children:e.anchor}):e.anchor}),(0,b.jsx)(`p`,{children:e.text})]},t))]}),f.report.unresolved.length>0&&(0,b.jsxs)(`section`,{role:`status`,"data-lens-unresolved":!0,children:[(0,b.jsxs)(`h3`,{children:[`Unresolved · `,f.report.unresolved.length]}),(0,b.jsx)(`ul`,{children:f.report.unresolved.map((e,t)=>(0,b.jsxs)(`li`,{children:[(0,b.jsx)(`strong`,{children:e.kind}),` · `,e.location,(0,b.jsxs)(`p`,{children:[e.spec,`: `,e.detail]})]},t))})]})]})]});return i===`sheet`?(0,b.jsxs)(`section`,{className:`lens-panel lens-sheet`,"data-lens-panel":!0,"data-lens-sheet":!0,children:[(0,b.jsxs)(`header`,{children:[(0,b.jsx)(`h2`,{children:f?.report.title??(t&&xd(t))}),a&&(0,b.jsx)(`button`,{onClick:a,children:`Details`})]}),m]}):(0,b.jsxs)(`details`,{className:`lens-panel`,open:!!t,"data-lens-panel":!0,children:[(0,b.jsxs)(`summary`,{children:[`Lenses`,t?` · ${f?.report.title??xd(t)}`:``]}),m]})}function Md(e,t,n){let r=t&&n?e?.paths.find(e=>e.name===t):void 0;if(!r||!r.stops.length)return null;let i=Math.min(r.stops.length,Math.max(1,n))-1;return{path:r,index:i,stop:r.stops[i],hop:r.hops.find(e=>e.to===i)}}function Nd(e,t,n,r){let i=e.hops.find(e=>e.to===t),a=e.stops[t-1]?.target;return!i?.resolved||!a?[]:[a,...i.source===`computed`?i.via.map(e=>n.indexOf(e)).filter(e=>e>=0).map(e=>({file:e,path:n[e],district:r(e),symbol:null})):[]]}var Pd=(e,t)=>e.file===t.file&&(e.symbol?.name??null)===(t.symbol?.name??null)&&(e.symbol?.start??null)===(t.symbol?.start??null),Fd={imports:`imports`,"imported-by":`imported by`,undirected:`linked by imports`,"same-file":`same file`};function Id({report:e,path:t,index:n,hop:r}){if(n===0)return(0,b.jsx)(`p`,{className:`lens-meta`,"data-lens-walk-hop":`start`,children:`Start of the path.`});if(!r?.resolved){let i=e.unresolved.find(e=>e.location===`paths.${t.name}.hops[${n-1}]`);return(0,b.jsxs)(`p`,{className:`lens-meta`,"data-lens-walk-hop":`unresolved`,children:[`Unresolved hop from stop `,n,i?` — ${i.detail}`:r?.source===`declared`&&r.reason?` — declared: ${r.reason}`:` — a stop on it is unresolved.`]})}return r.source===`declared`?(0,b.jsxs)(`p`,{className:`lens-meta`,"data-lens-walk-hop":`declared`,children:[(0,b.jsx)(`i`,{className:`lens-declared`}),` Declared hop from stop `,n,r.reason?` — ${r.reason}`:``]}):(0,b.jsxs)(`p`,{className:`lens-meta`,"data-lens-walk-hop":`computed`,children:[(0,b.jsx)(`i`,{className:`lens-computed`}),` Computed hop from stop `,n,` · `,Fd[r.edge_kind??``]??r.edge_kind,` · route from map edges (lower bound)`,r.via.length>2?`: ${r.via.join(` → `)}`:``]})}function Ld({report:e,name:t,step:n,go:r,exit:i,keyboard:a}){let o=Md(e,t,n);if(!o)return(0,b.jsxs)(`section`,{className:`lens-walkthrough`,"data-lens-walkthrough":!0,"data-lens-walk-state":`missing`,role:`status`,children:[(0,b.jsxs)(`p`,{children:[`Path “`,t,`” is not in this lens.`]}),(0,b.jsx)(`button`,{onClick:i,children:`End walkthrough`})]});let{path:s,index:c,stop:l,hop:u}=o,d=s.stops.length-1,f=l.target?void 0:e.unresolved.find(e=>e.location===`paths.${s.name}.stops[${c}]`),p=l.target?e.notes.filter(e=>e.target&&Pd(e.target,l.target)):[],m=l.target?c===0?`first`:c===d?`last`:`middle`:`unresolved`;return(0,b.jsxs)(`section`,{className:`lens-walkthrough`,"data-lens-walkthrough":!0,"data-lens-walk-state":m,"data-lens-walk-step":c+1,"aria-label":`Lens walkthrough`,children:[(0,b.jsxs)(`header`,{children:[(0,b.jsx)(`h3`,{children:s.name}),(0,b.jsxs)(`span`,{className:`lens-meta`,"aria-live":`polite`,children:[`Step `,c+1,` of `,s.stops.length]})]}),(0,b.jsxs)(`div`,{className:`lens-walk-controls`,children:[(0,b.jsx)(`button`,{"data-lens-walk":`previous`,disabled:c===0,onClick:()=>r(c),children:`Previous`}),(0,b.jsx)(`button`,{"data-lens-walk":`next`,disabled:c===d,onClick:()=>r(c+2),children:`Next`}),(0,b.jsx)(`button`,{"data-lens-walk":`exit`,onClick:i,children:`End`})]}),(0,b.jsx)(Id,{report:e,path:s,index:c,hop:u}),l.target?(0,b.jsx)(`p`,{className:`lens-walk-stop`,"data-lens-walk-stop":l.spec,children:l.spec}):(0,b.jsxs)(`div`,{role:`status`,"data-lens-walk-unresolved":!0,children:[(0,b.jsxs)(`p`,{className:`lens-walk-stop`,children:[`Unresolved stop: `,l.spec]}),(0,b.jsxs)(`p`,{children:[f?`${f.kind} · ${f.detail}`:`This stop did not resolve at this snapshot.`,` The map stays where it is.`]})]}),p.map((e,t)=>(0,b.jsx)(`p`,{className:`lens-note`,"data-lens-walk-note":!0,children:e.text},t)),a&&(0,b.jsx)(`p`,{className:`lens-meta`,children:`← and → also step.`})]})}function Rd(e,t,n){return[...e.status===`added`?[]:[{side:`base`,commit:t,path:e.base_path??e.path}],...e.status===`deleted`?[]:[{side:`head`,commit:n,path:e.path}]]}function zd(e){let t=new URLSearchParams({base:e.base??``,head:e.head??``});return e.max_districts!=null&&t.set(`max_districts`,String(e.max_districts)),e.max_dq!=null&&t.set(`max_dq`,String(e.max_dq)),e.report_only&&t.set(`report_only`,`true`),t}function Bd(e,t){if(e.report.version!==1||e.provenance.report_version!==1)throw Error(`Unsupported comparison report version`);if(e.report.base!==t.base||e.report.head!==t.head||e.provenance.base!==t.base||e.provenance.head!==t.head)throw Error(`Stale comparison: commit identity does not match this request`);if(!e.report.lower_bound)throw Error(`Unsupported graph coverage contract`);return e}function Vd(e,t,n){let r=zd(n).toString();return st({queryKey:[`comparison`,e,t,r],enabled:!!n.compare&&!!n.base&&!!n.head,queryFn:async({signal:i})=>{let a=await fetch(`${$c}/compare/${encodeURIComponent(e)}/${encodeURIComponent(t)}?${r}`,{signal:i,cache:`no-store`});if(!a.ok){let e=await a.json().catch(()=>null);throw Error(e?.message??`Comparison unavailable`)}return Bd(await a.json(),n)},retry:!1,staleTime:0,gcTime:0})}function Hd({search:e,data:t,pending:n,refreshing:r,error:i,update:a,retry:o,pick:s,read:c}){let l=!i&&!r?t?.report:void 0,u=t?.provenance;function d(t,n){let r=zd(e);return r.set(`compare`,`true`),r.set(`file`,t),r.set(`read`,`true`),r.set(`source_commit`,n),`?${r}`}function f(t){return(0,b.jsx)(`ul`,{children:t.map(t=>(0,b.jsxs)(`li`,{children:[(0,b.jsxs)(`button`,{className:`impact-path`,onClick:()=>s(t.base_path??t.path),children:[t.base_path?`${t.base_path} → `:``,t.path]}),(0,b.jsxs)(`small`,{children:[t.status,t.placed?` · placed by imports; no base footprint`:``]}),(0,b.jsx)(`span`,{className:`impact-sides`,children:Rd(t,e.base,e.head).map(e=>(0,b.jsxs)(`a`,{onClick:t=>{t.button===0&&!t.metaKey&&!t.ctrlKey&&!t.shiftKey&&(t.preventDefault(),c(e.path,e.commit))},href:d(e.path,e.commit),children:[e.side,` source`]},e.side))})]},t.path))})}return(0,b.jsxs)(`aside`,{className:`comparison-panel`,"aria-label":`Change impact`,onKeyDown:e=>{if(e.stopPropagation(),e.key!==`ArrowDown`&&e.key!==`ArrowUp`||e.target.matches(`input,select`))return;let t=Array.from(e.currentTarget.querySelectorAll(`button,a,input`)),n=t.indexOf(document.activeElement);n>=0&&(e.preventDefault(),t[(n+(e.key===`ArrowDown`?1:t.length-1))%t.length]?.focus())},children:[(0,b.jsxs)(`header`,{children:[(0,b.jsx)(`h2`,{children:`Change impact`}),(0,b.jsx)(`button`,{onClick:()=>a({compare:void 0,head:void 0,source_commit:void 0,read:void 0}),children:`Return to map`})]}),(0,b.jsxs)(`form`,{onSubmit:e=>{e.preventDefault();let t=new FormData(e.currentTarget);a({compare:!0,base:String(t.get(`base`)),head:String(t.get(`head`)),max_districts:t.get(`max_districts`)?Number(t.get(`max_districts`)):void 0,max_dq:t.get(`max_dq`)?Number(t.get(`max_dq`)):void 0,report_only:t.get(`report_only`)===`on`,read:void 0,source_commit:void 0})},children:[(0,b.jsxs)(`label`,{children:[`Base commit`,(0,b.jsx)(`input`,{name:`base`,"aria-label":`Base commit`,required:!0,pattern:`[a-f0-9]{40}|[a-f0-9]{64}`,defaultValue:e.base??e.commit})]}),(0,b.jsxs)(`label`,{children:[`Head commit`,(0,b.jsx)(`input`,{name:`head`,"aria-label":`Head commit`,required:!0,pattern:`[a-f0-9]{40}|[a-f0-9]{64}`,defaultValue:e.head})]}),(0,b.jsxs)(`label`,{children:[`Max districts`,(0,b.jsx)(`input`,{name:`max_districts`,type:`number`,min:`0`,step:`1`,defaultValue:e.max_districts})]}),(0,b.jsxs)(`label`,{children:[`Max Δq drop`,(0,b.jsx)(`input`,{name:`max_dq`,type:`number`,min:`0`,step:`any`,defaultValue:e.max_dq})]}),(0,b.jsxs)(`label`,{children:[(0,b.jsx)(`input`,{name:`report_only`,type:`checkbox`,defaultChecked:e.report_only}),`Report only (clear thresholds)`]}),(0,b.jsx)(`button`,{type:`submit`,children:`Compare commits`}),e.lens&&(0,b.jsx)(`button`,{type:`button`,onClick:()=>a({lens_compare:!0,base:e.base??e.commit}),children:`Compare active lens`})]}),(n||r)&&e.base&&e.head&&(0,b.jsx)(`p`,{role:`status`,children:r?`Revalidating comparison; previous result is stale.`:`Computing comparison…`}),i&&(0,b.jsxs)(`p`,{role:`alert`,children:[i.message,`. `,(0,b.jsx)(`button`,{onClick:o,children:`Retry`})]}),l&&u&&(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)(`p`,{className:`impact-commit`,children:[l.base,` → `,l.head]}),(0,b.jsxs)(`p`,{children:[`Structural signal: `,l.verdict,`. Δq `,l.delta_q,`; `,l.districts_crossed,` districts crossed.`]}),(0,b.jsx)(`p`,{children:`Lower bound: only resolvable graph references are measured. This verdict does not establish safety or grant permission.`}),(0,b.jsxs)(`p`,{children:[`Thresholds (`,l.thresholds.source,`): districts `,l.thresholds.max_districts??`off`,`, Δq drop `,l.thresholds.max_dq??`off`,`.`]}),(0,b.jsxs)(`p`,{children:[`Coverage: `,l.base_files,` base files / `,l.base_districts,` districts; `,u.indexed_changes,` indexed changes; `,u.outside_graph.length,` changes outside the graph.`]}),(0,b.jsx)(`h3`,{children:`Affected districts`}),(0,b.jsx)(`ul`,{children:l.districts.map(e=>(0,b.jsx)(`li`,{children:(0,b.jsxs)(`button`,{onClick:()=>s(void 0,e.id),children:[e.name,` · `,e.changed_files,` changed files`]})},e.id))}),(0,b.jsx)(`h3`,{children:`Changed files`}),f(l.files),(0,b.jsx)(`h3`,{children:`Unplaced files`}),(0,b.jsx)(`ul`,{children:l.unplaced_files.map(e=>(0,b.jsxs)(`li`,{children:[e,` · no base district`]},e))}),(0,b.jsx)(`h3`,{children:`Outside the graph`}),f(u.outside_graph),[`added`,`removed`].map(e=>(0,b.jsxs)(`section`,{children:[(0,b.jsxs)(`h3`,{children:[`Cross-district edges `,e]}),(0,b.jsx)(`ul`,{children:l[`edges_${e}`].map((e,t)=>(0,b.jsxs)(`li`,{children:[e.source,` → `,e.target,(0,b.jsx)(`br`,{}),`District `,e.source_district,` → `,e.target_district,` · weight `,e.weight,` · `,e.static_import?`static import`:`other graph signals`]},t))})]},e)),(0,b.jsx)(`p`,{children:`Edge weights compare within their own graph only.`}),(0,b.jsx)(`h3`,{children:`Landmark touches`}),(0,b.jsx)(`ul`,{children:l.landmark_touches.map(e=>(0,b.jsxs)(`li`,{children:[(0,b.jsxs)(`button`,{onClick:()=>s(e.file),children:[e.file,` · `,e.kind]}),(0,b.jsx)(`p`,{children:e.detail})]},`${e.file}:${e.kind}`))}),(0,b.jsxs)(`details`,{children:[(0,b.jsx)(`summary`,{children:`Immutable provenance`}),(0,b.jsxs)(`p`,{children:[`Comparison `,t.id]}),(0,b.jsxs)(`p`,{children:[`Base map: `,u.base_map_source,` · SHA-256 `,u.base_map_sha256]}),(0,b.jsxs)(`p`,{children:[`tolmap `,u.tolmap_version,` / `,u.build_revision,`; report v`,u.report_version,`; resolution `,u.resolution,`; prune `,u.prune,`; references `,u.refs,`; seed `,u.seed,`; created `,u.created_at,` (Unix seconds).`]})]})]})]})}var Ud=[],Wd=[];(()=>{let e=`lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,1n,9,16,o,,x,1i,3,,i,,7,a,2,t,3,1k,,,7,2,2,2,3,9,,a,2,q,,2,3,1k,,,5,4,2,2,3,3,,u,2,3,,b,3,1k,,,8,,3,,3,k,2,m,6,,3,1k,,,7,2,2,2,3,7,3,a,2,u,,1n,5,3,3,,4,9,,14,5,1j,,,7,,3,,4,7,2,b,2,t,3,1k,,,7,,3,,4,7,2,b,2,f,,c,4,1j,2,,7,,3,,4,9,,a,2,t,3,1y,,4,6,,,,8,i,2,1p,,,8,c,8,2q,,,a,b,7,21,2,r,,,,,,4,2,1d,k,,2,5,b,,10,9,,2u,b,,6,n,4,4,3,g,4,d,,,3,6,,f,,jj,3,qa,4,s,3,t,2,u,2,1s,w,9,,19,3,,,39,2,y,,3a,c,4,c,63,5,1l,a,,,,,2,o,2,,1c,1a,2,c,k,5,1b,h,12,9,c,3,u,d,1k,e,1c,k,48,3,,l,4,,6,,2,3,5i,1s,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,n,5,4,,2b,2,1e,i,q,i,d,,12,8,p,d,18,4,1b,e,10,,1v,e,c,,8,2,1a,,1f,,,3,2,2,5,2,,,15,5,5,2,6k,8,,2,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,1t,5,8t,2,25,6,1y,b,1d,4,3e,3,1h,f,15,,2,2,a,4,19,b,7,,1p,3,10,e,g,2,18,,c,3,1c,e,8,4,,2,2k,c,6,,2,,4d,c,l,4,1j,2,,7,2,2,2,3,9,,a,2,2,7,3,5,1v,9,,,2,,,4,,5,,,e,2,2a,i,n,,29,k,6j,7,2,9,r,2,2a,h,2y,d,2t,3,2,a,74,f,6t,6,,2,2,4,,,,2,3x,7,2,7,3,,s,a,14,7,,4,8,,9,b,1a,g,5i,8,5j,8,,8,2a,m,,e,3e,6,3,,,2,,7,,,1u,5,,2,,5,9n,4,9,2,,,1c,7,3,5,n,,44l,,6,f,8ug,i,1xc,5,1n,7,t4,,,1j,7,4,29,,b,2,f57,2,3mp,1a,2,n,f2,5,3,6,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,2s,,4g,7,af,,1p,4,e4,4,72,2,6r,,2,,7,2,5,,d6,7,31,7,240,5`.split(`,`).map(e=>e?parseInt(e,36):1);for(let t=0,n=0;t<e.length;t++)(t%2?Wd:Ud).push(n+=e[t])})();function Gd(e){if(e<768)return!1;for(let t=0,n=Ud.length;;){let r=t+n>>1;if(e<Ud[r])n=r;else if(e>=Wd[r])t=r+1;else return!0;if(t==n)return!1}}function Kd(e){return e>=127462&&e<=127487}var qd=8205;function Jd(e,t,n=!0,r=!0){return(n?Yd:Xd)(e,t,r)}function Yd(e,t,n){if(t==e.length)return t;t&&Qd(e.charCodeAt(t))&&$d(e.charCodeAt(t-1))&&t--;let r=Zd(e,t);for(t+=ef(r);t<e.length;){let i=Zd(e,t);if(r==qd||i==qd||n&&Gd(i))t+=ef(i),r=i;else if(Kd(i)){let n=0,r=t-2;for(;r>=0&&Kd(Zd(e,r));)n++,r-=2;if(n%2==0)break;t+=2}else break}return t}function Xd(e,t,n){for(;t>1;){let r=Yd(e,t-2,n);if(r<t)return r;t--}return 0}function Zd(e,t){let n=e.charCodeAt(t);if(!$d(n)||t+1==e.length)return n;let r=e.charCodeAt(t+1);return Qd(r)?(n-55296<<10)+(r-56320)+65536:n}function Qd(e){return e>=56320&&e<57344}function $d(e){return e>=55296&&e<56320}function ef(e){return e<65536?1:2}var tf=class e{lineAt(e){if(e<0||e>this.length)throw RangeError(`Invalid position ${e} in document of length ${this.length}`);return this.lineInner(e,!1,1,0)}line(e){if(e<1||e>this.lines)throw RangeError(`Invalid line number ${e} in ${this.lines}-line document`);return this.lineInner(e,!0,1,0)}replace(e,t,n){[e,t]=ff(this,e,t);let r=[];return this.decompose(0,e,r,2),n.length&&n.decompose(0,n.length,r,3),this.decompose(t,this.length,r,1),rf.from(r,this.length-(t-e)+n.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,t=this.length){[e,t]=ff(this,e,t);let n=[];return this.decompose(e,t,n,0),rf.from(n,t-e)}eq(e){if(e==this)return!0;if(e.length!=this.length||e.lines!=this.lines)return!1;let t=this.scanIdentical(e,1),n=this.length-this.scanIdentical(e,-1),r=new cf(this),i=new cf(e);for(let e=t,a=t;;){if(r.next(e),i.next(e),e=0,r.lineBreak!=i.lineBreak||r.done!=i.done||r.value!=i.value)return!1;if(a+=r.value.length,r.done||a>=n)return!0}}iter(e=1){return new cf(this,e)}iterRange(e,t=this.length){return new lf(this,e,t)}iterLines(e,t){let n;if(e==null)n=this.iter();else{t??=this.lines+1;let r=this.line(e).from;n=this.iterRange(r,Math.max(r,t==this.lines+1?this.length:t<=1?0:this.line(t-1).to))}return new uf(n)}toString(){return this.sliceString(0)}toJSON(){let e=[];return this.flatten(e),e}constructor(){}static of(t){if(t.length==0)throw RangeError(`A document must have at least one line`);return t.length==1&&!t[0]?e.empty:t.length<=32?new nf(t):rf.from(nf.split(t,[]))}},nf=class e extends tf{constructor(e,t=af(e)){super(),this.text=e,this.length=t}get lines(){return this.text.length}get children(){return null}lineInner(e,t,n,r){for(let i=0;;i++){let a=this.text[i],o=r+a.length;if((t?n:o)>=e)return new df(r,o,n,a);r=o+1,n++}}decompose(t,n,r,i){let a=t<=0&&n>=this.length?this:new e(sf(this.text,t,n),Math.min(n,this.length)-Math.max(0,t));if(i&1){let t=r.pop(),n=of(a.text,t.text.slice(),0,a.length);if(n.length<=32)r.push(new e(n,t.length+a.length));else{let t=n.length>>1;r.push(new e(n.slice(0,t)),new e(n.slice(t)))}}else r.push(a)}replace(t,n,r){if(!(r instanceof e))return super.replace(t,n,r);[t,n]=ff(this,t,n);let i=of(this.text,of(r.text,sf(this.text,0,t)),n),a=this.length+r.length-(n-t);return i.length<=32?new e(i,a):rf.from(e.split(i,[]),a)}sliceString(e,t=this.length,n=`
|
|
12
|
+
`){[e,t]=ff(this,e,t);let r=``;for(let i=0,a=0;i<=t&&a<this.text.length;a++){let o=this.text[a],s=i+o.length;i>e&&a&&(r+=n),e<s&&t>i&&(r+=o.slice(Math.max(0,e-i),t-i)),i=s+1}return r}flatten(e){for(let t of this.text)e.push(t)}scanIdentical(){return 0}static split(t,n){let r=[],i=-1;for(let a of t)r.push(a),i+=a.length+1,r.length==32&&(n.push(new e(r,i)),r=[],i=-1);return i>-1&&n.push(new e(r,i)),n}},rf=class e extends tf{constructor(e,t){super(),this.children=e,this.length=t,this.lines=0;for(let t of e)this.lines+=t.lines}lineInner(e,t,n,r){for(let i=0;;i++){let a=this.children[i],o=r+a.length,s=n+a.lines-1;if((t?s:o)>=e)return a.lineInner(e,t,n,r);r=o+1,n=s+1}}decompose(e,t,n,r){for(let i=0,a=0;a<=t&&i<this.children.length;i++){let o=this.children[i],s=a+o.length;if(e<=s&&t>=a){let i=r&(a<=e|(s>=t?2:0));a>=e&&s<=t&&!i?n.push(o):o.decompose(e-a,t-a,n,i)}a=s+1}}replace(t,n,r){if([t,n]=ff(this,t,n),r.lines<this.lines)for(let i=0,a=0;i<this.children.length;i++){let o=this.children[i],s=a+o.length;if(t>=a&&n<=s){let c=o.replace(t-a,n-a,r),l=this.lines-o.lines+c.lines;if(c.lines<l>>4&&c.lines>l>>6){let a=this.children.slice();return a[i]=c,new e(a,this.length-(n-t)+r.length)}return super.replace(a,s,c)}a=s+1}return super.replace(t,n,r)}sliceString(e,t=this.length,n=`
|
|
13
|
+
`){[e,t]=ff(this,e,t);let r=``;for(let i=0,a=0;i<this.children.length&&a<=t;i++){let o=this.children[i],s=a+o.length;a>e&&i&&(r+=n),e<s&&t>a&&(r+=o.sliceString(e-a,t-a,n)),a=s+1}return r}flatten(e){for(let t of this.children)t.flatten(e)}scanIdentical(t,n){if(!(t instanceof e))return 0;let r=0,[i,a,o,s]=n>0?[0,0,this.children.length,t.children.length]:[this.children.length-1,t.children.length-1,-1,-1];for(;;i+=n,a+=n){if(i==o||a==s)return r;let e=this.children[i],c=t.children[a];if(e!=c)return r+e.scanIdentical(c,n);r+=e.length+1}}static from(t,n=t.reduce((e,t)=>e+t.length+1,-1)){let r=0;for(let e of t)r+=e.lines;if(r<32){let e=[];for(let n of t)n.flatten(e);return new nf(e,n)}let i=Math.max(32,r>>5),a=i<<1,o=i>>1,s=[],c=0,l=-1,u=[];function d(t){let n;if(t.lines>a&&t instanceof e)for(let e of t.children)d(e);else t.lines>o&&(c>o||!c)?(f(),s.push(t)):t instanceof nf&&c&&(n=u[u.length-1])instanceof nf&&t.lines+n.lines<=32?(c+=t.lines,l+=t.length+1,u[u.length-1]=new nf(n.text.concat(t.text),n.length+1+t.length)):(c+t.lines>i&&f(),c+=t.lines,l+=t.length+1,u.push(t))}function f(){c!=0&&(s.push(u.length==1?u[0]:e.from(u,l)),l=-1,c=u.length=0)}for(let e of t)d(e);return f(),s.length==1?s[0]:new e(s,n)}};tf.empty=new nf([``],0);function af(e){let t=-1;for(let n of e)t+=n.length+1;return t}function of(e,t,n=0,r=1e9){for(let i=0,a=0,o=!0;a<e.length&&i<=r;a++){let s=e[a],c=i+s.length;c>=n&&(c>r&&(s=s.slice(0,r-i)),i<n&&(s=s.slice(n-i)),o?(t[t.length-1]+=s,o=!1):t.push(s)),i=c+1}return t}function sf(e,t,n){return of(e,[``],t,n)}var cf=class{constructor(e,t=1){this.dir=t,this.done=!1,this.lineBreak=!1,this.value=``,this.nodes=[e],this.offsets=[t>0?1:(e instanceof nf?e.text.length:e.children.length)<<1]}nextInner(e,t){for(this.done=this.lineBreak=!1;;){let n=this.nodes.length-1,r=this.nodes[n],i=this.offsets[n],a=i>>1,o=r instanceof nf?r.text.length:r.children.length;if(a==(t>0?o:0)){if(n==0)return this.done=!0,this.value=``,this;t>0&&this.offsets[n-1]++,this.nodes.pop(),this.offsets.pop()}else if((i&1)==(t>0?0:1)){if(this.offsets[n]+=t,e==0)return this.lineBreak=!0,this.value=`
|
|
14
|
+
`,this;e--}else if(r instanceof nf){let i=r.text[a+(t<0?-1:0)];if(this.offsets[n]+=t,i.length>Math.max(0,e))return this.value=e==0?i:t>0?i.slice(e):i.slice(0,i.length-e),this;e-=i.length}else{let i=r.children[a+(t<0?-1:0)];e>i.length?(e-=i.length,this.offsets[n]+=t):(t<0&&this.offsets[n]--,this.nodes.push(i),this.offsets.push(t>0?1:(i instanceof nf?i.text.length:i.children.length)<<1))}}}next(e=0){return e<0&&(this.nextInner(-e,-this.dir),e=this.value.length),this.nextInner(e,this.dir)}},lf=class{constructor(e,t,n){this.value=``,this.done=!1,this.cursor=new cf(e,t>n?-1:1),this.pos=t>n?e.length:0,this.from=Math.min(t,n),this.to=Math.max(t,n)}nextInner(e,t){if(t<0?this.pos<=this.from:this.pos>=this.to)return this.value=``,this.done=!0,this;e+=Math.max(0,t<0?this.pos-this.to:this.from-this.pos);let n=t<0?this.pos-this.from:this.to-this.pos;e>n&&(e=n),n-=e;let{value:r}=this.cursor.next(e);return this.pos+=(r.length+e)*t,this.value=r.length<=n?r:t<0?r.slice(r.length-n):r.slice(0,n),this.done=!this.value,this}next(e=0){return e<0?e=Math.max(e,this.from-this.pos):e>0&&(e=Math.min(e,this.to-this.pos)),this.nextInner(e,this.cursor.dir)}get lineBreak(){return this.cursor.lineBreak&&this.value!=``}},uf=class{constructor(e){this.inner=e,this.afterBreak=!0,this.value=``,this.done=!1}next(e=0){let{done:t,lineBreak:n,value:r}=this.inner.next(e);return t&&this.afterBreak?(this.value=``,this.afterBreak=!1):t?(this.done=!0,this.value=``):n?this.afterBreak?this.value=``:(this.afterBreak=!0,this.next()):(this.value=r,this.afterBreak=!1),this}get lineBreak(){return!1}};typeof Symbol<`u`&&(tf.prototype[Symbol.iterator]=function(){return this.iter()},cf.prototype[Symbol.iterator]=lf.prototype[Symbol.iterator]=uf.prototype[Symbol.iterator]=function(){return this});var df=class{constructor(e,t,n,r){this.from=e,this.to=t,this.number=n,this.text=r}get length(){return this.to-this.from}};function ff(e,t,n){return t=Math.max(0,Math.min(e.length,t)),[t,Math.max(t,Math.min(e.length,n))]}function pf(e,t,n=!0,r=!0){return Jd(e,t,n,r)}function mf(e){return e>=56320&&e<57344}function hf(e){return e>=55296&&e<56320}function gf(e,t){let n=e.charCodeAt(t);if(!hf(n)||t+1==e.length)return n;let r=e.charCodeAt(t+1);return mf(r)?(n-55296<<10)+(r-56320)+65536:n}function _f(e){return e<=65535?String.fromCharCode(e):(e-=65536,String.fromCharCode((e>>10)+55296,(e&1023)+56320))}function vf(e){return e<65536?1:2}var yf=/\r\n?|\n/,bf=(function(e){return e[e.Simple=0]=`Simple`,e[e.TrackDel=1]=`TrackDel`,e[e.TrackBefore=2]=`TrackBefore`,e[e.TrackAfter=3]=`TrackAfter`,e})(bf||={}),xf=class e{constructor(e){this.sections=e}get length(){let e=0;for(let t=0;t<this.sections.length;t+=2)e+=this.sections[t];return e}get newLength(){let e=0;for(let t=0;t<this.sections.length;t+=2){let n=this.sections[t+1];e+=n<0?this.sections[t]:n}return e}get empty(){return this.sections.length==0||this.sections.length==2&&this.sections[1]<0}iterGaps(e){for(let t=0,n=0,r=0;t<this.sections.length;){let i=this.sections[t++],a=this.sections[t++];a<0?(e(n,r,i),r+=i):r+=a,n+=i}}iterChangedRanges(e,t=!1){Tf(this,e,t)}get invertedDesc(){let t=[];for(let e=0;e<this.sections.length;){let n=this.sections[e++],r=this.sections[e++];r<0?t.push(n,r):t.push(r,n)}return new e(t)}composeDesc(e){return this.empty?e:e.empty?this:Df(this,e)}mapDesc(e,t=!1){return e.empty?this:Ef(this,e,t)}mapPos(e,t=-1,n=bf.Simple){let r=0,i=0;for(let a=0;a<this.sections.length;){let o=this.sections[a++],s=this.sections[a++],c=r+o;if(s<0){if(c>e)return i+(e-r);i+=o}else{if(n!=bf.Simple&&c>=e&&(n==bf.TrackDel&&r<e&&c>e||n==bf.TrackBefore&&r<e||n==bf.TrackAfter&&c>e))return null;if(c>e||c==e&&t<0&&!o)return e==r||t<0?i:i+s;i+=s}r=c}if(e>r)throw RangeError(`Position ${e} is out of range for changeset of length ${r}`);return i}touchesRange(e,t=e){for(let n=0,r=0;n<this.sections.length&&r<=t;){let i=this.sections[n++],a=this.sections[n++],o=r+i;if(a>=0&&r<=t&&o>=e)return r<e&&o>t?`cover`:!0;r=o}return!1}toString(){let e=``;for(let t=0;t<this.sections.length;){let n=this.sections[t++],r=this.sections[t++];e+=(e?` `:``)+n+(r>=0?`:`+r:``)}return e}toJSON(){return this.sections}static fromJSON(t){if(!Array.isArray(t)||t.length%2||t.some(e=>typeof e!=`number`))throw RangeError(`Invalid JSON representation of ChangeDesc`);return new e(t)}static create(t){return new e(t)}},Sf=class e extends xf{constructor(e,t){super(e),this.inserted=t}apply(e){if(this.length!=e.length)throw RangeError(`Applying change set to a document with the wrong length`);return Tf(this,(t,n,r,i,a)=>e=e.replace(r,r+(n-t),a),!1),e}mapDesc(e,t=!1){return Ef(this,e,t,!0)}invert(t){let n=this.sections.slice(),r=[];for(let e=0,i=0;e<n.length;e+=2){let a=n[e],o=n[e+1];if(o>=0){n[e]=o,n[e+1]=a;let s=e>>1;for(;r.length<s;)r.push(tf.empty);r.push(a?t.slice(i,i+a):tf.empty)}i+=a}return new e(n,r)}compose(e){return this.empty?e:e.empty?this:Df(this,e,!0)}map(e,t=!1){return e.empty?this:Ef(this,e,t,!0)}iterChanges(e,t=!1){Tf(this,e,t)}get desc(){return xf.create(this.sections)}filter(t){let n=[],r=[],i=[],a=new Of(this);done:for(let e=0,o=0;;){let s=e==t.length?1e9:t[e++];for(;o<s||o==s&&a.len==0;){if(a.done)break done;let e=Math.min(a.len,s-o);Cf(i,e,-1);let t=a.ins==-1?-1:a.off==0?a.ins:0;Cf(n,e,t),t>0&&wf(r,n,a.text),a.forward(e),o+=e}let c=t[e++];for(;o<c;){if(a.done)break done;let e=Math.min(a.len,c-o);Cf(n,e,-1),Cf(i,e,a.ins==-1?-1:a.off==0?a.ins:0),a.forward(e),o+=e}}return{changes:new e(n,r),filtered:xf.create(i)}}toJSON(){let e=[];for(let t=0;t<this.sections.length;t+=2){let n=this.sections[t],r=this.sections[t+1];r<0?e.push(n):r==0?e.push([n]):e.push([n].concat(this.inserted[t>>1].toJSON()))}return e}static of(t,n,r){let i=[],a=[],o=0,s=null;function c(t=!1){if(!t&&!i.length)return;o<n&&Cf(i,n-o,-1);let r=new e(i,a);s=s?s.compose(r.map(s)):r,i=[],a=[],o=0}function l(t){if(Array.isArray(t))for(let e of t)l(e);else if(t instanceof e){if(t.length!=n)throw RangeError(`Mismatched change set length (got ${t.length}, expected ${n})`);c(),s=s?s.compose(t.map(s)):t}else{let{from:e,to:s=e,insert:l}=t;if(e>s||e<0||s>n)throw RangeError(`Invalid change range ${e} to ${s} (in doc of length ${n})`);let u=l?typeof l==`string`?tf.of(l.split(r||yf)):l:tf.empty,d=u.length;if(e==s&&d==0)return;e<o&&c(),e>o&&Cf(i,e-o,-1),Cf(i,s-e,d),wf(a,i,u),o=s}}return l(t),c(!s),s}static empty(t){return new e(t?[t,-1]:[],[])}static fromJSON(t){if(!Array.isArray(t))throw RangeError(`Invalid JSON representation of ChangeSet`);let n=[],r=[];for(let e=0;e<t.length;e++){let i=t[e];if(typeof i==`number`)n.push(i,-1);else if(!Array.isArray(i)||typeof i[0]!=`number`||i.some((e,t)=>t&&typeof e!=`string`))throw RangeError(`Invalid JSON representation of ChangeSet`);else if(i.length==1)n.push(i[0],0);else{for(;r.length<e;)r.push(tf.empty);r[e]=tf.of(i.slice(1)),n.push(i[0],r[e].length)}}return new e(n,r)}static createSet(t,n){return new e(t,n)}};function Cf(e,t,n,r=!1){if(t==0&&n<=0)return;let i=e.length-2;i>=0&&n<=0&&n==e[i+1]?e[i]+=t:i>=0&&t==0&&e[i]==0?e[i+1]+=n:r?(e[i]+=t,e[i+1]+=n):e.push(t,n)}function wf(e,t,n){if(n.length==0)return;let r=t.length-2>>1;if(r<e.length)e[e.length-1]=e[e.length-1].append(n);else{for(;e.length<r;)e.push(tf.empty);e.push(n)}}function Tf(e,t,n){let r=e.inserted;for(let i=0,a=0,o=0;o<e.sections.length;){let s=e.sections[o++],c=e.sections[o++];if(c<0)i+=s,a+=s;else{let l=i,u=a,d=tf.empty;for(;l+=s,u+=c,c&&r&&(d=d.append(r[o-2>>1])),!(n||o==e.sections.length||e.sections[o+1]<0);)s=e.sections[o++],c=e.sections[o++];t(i,l,a,u,d),i=l,a=u}}}function Ef(e,t,n,r=!1){let i=[],a=r?[]:null,o=new Of(e),s=new Of(t);for(let e=-1;;)if(o.done&&s.len||s.done&&o.len)throw Error(`Mismatched change set lengths`);else if(o.ins==-1&&s.ins==-1){let e=Math.min(o.len,s.len);Cf(i,e,-1),o.forward(e),s.forward(e)}else if(s.ins>=0&&(o.ins<0||e==o.i||o.off==0&&(s.len<o.len||s.len==o.len&&!n))){let t=s.len;for(Cf(i,s.ins,-1);t;){let n=Math.min(o.len,t);o.ins>=0&&e<o.i&&o.len<=n&&(Cf(i,0,o.ins),a&&wf(a,i,o.text),e=o.i),o.forward(n),t-=n}s.next()}else if(o.ins>=0){let t=0,n=o.len;for(;n;)if(s.ins==-1){let e=Math.min(n,s.len);t+=e,n-=e,s.forward(e)}else if(s.ins==0&&s.len<n)n-=s.len,s.next();else break;Cf(i,t,e<o.i?o.ins:0),a&&e<o.i&&wf(a,i,o.text),e=o.i,o.forward(o.len-n)}else if(o.done&&s.done)return a?Sf.createSet(i,a):xf.create(i);else throw Error(`Mismatched change set lengths`)}function Df(e,t,n=!1){let r=[],i=n?[]:null,a=new Of(e),o=new Of(t);for(let e=!1;;)if(a.done&&o.done)return i?Sf.createSet(r,i):xf.create(r);else if(a.ins==0)Cf(r,a.len,0,e),a.next();else if(o.len==0&&!o.done)Cf(r,0,o.ins,e),i&&wf(i,r,o.text),o.next();else if(a.done||o.done)throw Error(`Mismatched change set lengths`);else{let t=Math.min(a.len2,o.len),n=r.length;if(a.ins==-1){let n=o.ins==-1?-1:o.off?0:o.ins;Cf(r,t,n,e),i&&n&&wf(i,r,o.text)}else o.ins==-1?(Cf(r,a.off?0:a.len,t,e),i&&wf(i,r,a.textBit(t))):(Cf(r,a.off?0:a.len,o.off?0:o.ins,e),i&&!o.off&&wf(i,r,o.text));e=(a.ins>t||o.ins>=0&&o.len>t)&&(e||r.length>n),a.forward2(t),o.forward(t)}}var Of=class{constructor(e){this.set=e,this.i=0,this.next()}next(){let{sections:e}=this.set;this.i<e.length?(this.len=e[this.i++],this.ins=e[this.i++]):(this.len=0,this.ins=-2),this.off=0}get done(){return this.ins==-2}get len2(){return this.ins<0?this.len:this.ins}get text(){let{inserted:e}=this.set,t=this.i-2>>1;return t>=e.length?tf.empty:e[t]}textBit(e){let{inserted:t}=this.set,n=this.i-2>>1;return n>=t.length&&!e?tf.empty:t[n].slice(this.off,e==null?void 0:this.off+e)}forward(e){e==this.len?this.next():(this.len-=e,this.off+=e)}forward2(e){this.ins==-1?this.forward(e):e==this.ins?this.next():(this.ins-=e,this.off+=e)}},kf=class e{constructor(e,t,n,r){this.from=e,this.to=t,this.flags=n,this.goalColumn=r}get anchor(){return this.flags&32?this.to:this.from}get head(){return this.flags&32?this.from:this.to}get empty(){return this.from==this.to}get assoc(){return this.flags&8?-1:this.flags&16?1:0}get undirectional(){return(this.flags&64)>0}get bidiLevel(){let e=this.flags&7;return e==7?null:e}map(t,n=-1){let r,i;return this.empty?r=i=t.mapPos(this.from,n):(r=t.mapPos(this.from,1),i=t.mapPos(this.to,-1)),r==this.from&&i==this.to?this:new e(r,i,this.flags,this.goalColumn)}extend(e,t=e,n=0){if(e<=this.anchor&&t>=this.anchor)return W.range(e,t,void 0,void 0,n);let r=Math.abs(e-this.anchor)>Math.abs(t-this.anchor)?e:t;return W.range(this.anchor,r,void 0,void 0,n)}eq(e,t=!1){return this.anchor==e.anchor&&this.head==e.head&&this.goalColumn==e.goalColumn&&(!t||!this.empty||this.assoc==e.assoc)}toJSON(){return{anchor:this.anchor,head:this.head}}static fromJSON(e){if(!e||typeof e.anchor!=`number`||typeof e.head!=`number`)throw RangeError(`Invalid JSON representation for SelectionRange`);return W.range(e.anchor,e.head)}static create(t,n,r,i){return new e(t,n,r,i)}},W=class e{constructor(e,t){this.ranges=e,this.mainIndex=t}map(t,n=-1){return t.empty?this:e.create(this.ranges.map(e=>e.map(t,n)),this.mainIndex)}eq(e,t=!1){if(this.ranges.length!=e.ranges.length||this.mainIndex!=e.mainIndex)return!1;for(let n=0;n<this.ranges.length;n++)if(!this.ranges[n].eq(e.ranges[n],t))return!1;return!0}get main(){return this.ranges[this.mainIndex]}asSingle(){return this.ranges.length==1?this:new e([this.main],0)}addRange(t,n=!0){return e.create([t].concat(this.ranges),n?0:this.mainIndex+1)}replaceRange(t,n=this.mainIndex){let r=this.ranges.slice();return r[n]=t,e.create(r,this.mainIndex)}toJSON(){return{ranges:this.ranges.map(e=>e.toJSON()),main:this.mainIndex}}static fromJSON(t){if(!t||!Array.isArray(t.ranges)||typeof t.main!=`number`||t.main>=t.ranges.length)throw RangeError(`Invalid JSON representation for EditorSelection`);return new e(t.ranges.map(e=>kf.fromJSON(e)),t.main)}static single(t,n=t){return new e([e.range(t,n)],0)}static create(t,n=0){if(t.length==0)throw RangeError(`A selection needs at least one range`);for(let r=0,i=0;i<t.length;i++){let a=t[i];if(a.empty?a.from<=r:a.from<r)return e.normalized(t.slice(),n);r=a.to}return new e(t,n)}static cursor(e,t=0,n,r){return kf.create(e,e,(t==0?0:t<0?8:16)|(n==null?7:Math.min(6,n)),r)}static range(e,t,n,r,i){let a=r==null?7:Math.min(6,r);return!i&&e!=t&&(i=t<e?1:-1),i&&(a|=i<0?8:16),t<e?kf.create(t,e,a|32,n):kf.create(e,t,a,n)}static undirectionalRange(e,t){return kf.create(e,t,64,void 0)}static normalized(t,n=0){let r=t[n];t.sort((e,t)=>e.from-t.from),n=t.indexOf(r);for(let r=1;r<t.length;r++){let i=t[r],a=t[r-1];if(i.empty?i.from<=a.to:i.from<a.to){let o=a.from,s=Math.max(i.to,a.to);r<=n&&n--,t.splice(--r,2,i.anchor>i.head?e.range(s,o):e.range(o,s))}}return new e(t,n)}};function Af(e,t){for(let n of e.ranges)if(n.to>t)throw RangeError(`Selection points outside of document`)}var jf=0,G=class e{constructor(e,t,n,r,i){this.combine=e,this.compareInput=t,this.compare=n,this.isStatic=r,this.id=jf++,this.default=e([]),this.extensions=typeof i==`function`?i(this):i}get reader(){return this}static define(t={}){return new e(t.combine||(e=>e),t.compareInput||((e,t)=>e===t),t.compare||(t.combine?(e,t)=>e===t:Mf),!!t.static,t.enables)}of(e){return new Nf([],this,0,e)}compute(e,t){if(this.isStatic)throw Error(`Can't compute a static facet`);return new Nf(e,this,1,t)}computeN(e,t){if(this.isStatic)throw Error(`Can't compute a static facet`);return new Nf(e,this,2,t)}from(e,t){return t||=e=>e,this.compute([e],n=>t(n.field(e)))}};function Mf(e,t){return e==t||e.length==t.length&&e.every((e,n)=>e===t[n])}var Nf=class{constructor(e,t,n,r){this.dependencies=e,this.facet=t,this.type=n,this.value=r,this.id=jf++}dynamicSlot(e){let t=this.value,n=this.facet.compareInput,r=this.id,i=e[r]>>1,a=this.type==2,o=!1,s=!1,c=[];for(let t of this.dependencies)t==`doc`?o=!0:t==`selection`?s=!0:(e[t.id]??1)&1||c.push(e[t.id]);return{create(e){return e.values[i]=t(e),1},update(e,r){if(o&&r.docChanged||s&&(r.docChanged||r.selection)||Ff(e,c)){let r=t(e);if(a?!Pf(r,e.values[i],n):!n(r,e.values[i]))return e.values[i]=r,1}return 0},reconfigure:(e,o)=>{let s,c=o.config.address[r];if(c!=null){let r=Jf(o,c);if(this.dependencies.every(t=>t instanceof G?o.facet(t)===e.facet(t):t instanceof Rf?o.field(t,!1)==e.field(t,!1):!0)||(a?Pf(s=t(e),r,n):n(s=t(e),r)))return e.values[i]=r,0}else s=t(e);return e.values[i]=s,1}}}get extension(){return this}};function Pf(e,t,n){if(e.length!=t.length)return!1;for(let r=0;r<e.length;r++)if(!n(e[r],t[r]))return!1;return!0}function Ff(e,t){let n=!1;for(let r of t)qf(e,r)&1&&(n=!0);return n}function If(e,t,n){let r=n.map(t=>e[t.id]),i=n.map(e=>e.type),a=r.filter(e=>!(e&1)),o=e[t.id]>>1;function s(e){let n=[];for(let t=0;t<r.length;t++){let a=Jf(e,r[t]);if(i[t]==2)for(let e of a)n.push(e);else n.push(a)}return t.combine(n)}return{create(e){for(let t of r)qf(e,t);return e.values[o]=s(e),1},update(e,n){if(!Ff(e,a))return 0;let r=s(e);return t.compare(r,e.values[o])?0:(e.values[o]=r,1)},reconfigure(e,i){let a=Ff(e,r),c=i.config.facets[t.id],l=i.facet(t);if(c&&!a&&Mf(n,c))return e.values[o]=l,0;let u=s(e);return t.compare(u,l)?(e.values[o]=l,0):(e.values[o]=u,1)}}}var Lf=G.define({static:!0}),Rf=class e{constructor(e,t,n,r,i){this.id=e,this.createF=t,this.updateF=n,this.compareF=r,this.spec=i,this.provides=void 0}static define(t){let n=new e(jf++,t.create,t.update,t.compare||((e,t)=>e===t),t);return t.provide&&(n.provides=t.provide(n)),n}create(e){return(e.facet(Lf).find(e=>e.field==this)?.create||this.createF)(e)}slot(e){let t=e[this.id]>>1;return{create:e=>(e.values[t]=this.create(e),1),update:(e,n)=>{let r=e.values[t],i=this.updateF(r,n);return this.compareF(r,i)?0:(e.values[t]=i,1)},reconfigure:(e,n)=>{let r=e.facet(Lf),i=n.facet(Lf),a;return(a=r.find(e=>e.field==this))&&a!=i.find(e=>e.field==this)?(e.values[t]=a.create(e),1):n.config.address[this.id]==null?(e.values[t]=this.create(e),1):(e.values[t]=n.field(this),0)}}}init(e){return[this,Lf.of({field:this,create:e})]}get extension(){return this}},zf={lowest:4,low:3,default:2,high:1,highest:0};function Bf(e){return t=>new Hf(t,e)}var Vf={highest:Bf(zf.highest),high:Bf(zf.high),default:Bf(zf.default),low:Bf(zf.low),lowest:Bf(zf.lowest)},Hf=class{constructor(e,t){this.inner=e,this.prec=t}get extension(){return this}},Uf=class e{of(e){return new Wf(this,e)}reconfigure(t){return e.reconfigure.of({compartment:this,extension:t})}get(e){return e.config.compartments.get(this)}},Wf=class{constructor(e,t){this.compartment=e,this.inner=t}get extension(){return this}},Gf=class e{constructor(e,t,n,r,i,a){for(this.base=e,this.compartments=t,this.dynamicSlots=n,this.address=r,this.staticValues=i,this.facets=a,this.statusTemplate=[];this.statusTemplate.length<n.length;)this.statusTemplate.push(0)}staticFacet(e){let t=this.address[e.id];return t==null?e.default:this.staticValues[t>>1]}static resolve(t,n,r){let i=[],a=Object.create(null),o=new Map;for(let e of Kf(t,n,o))e instanceof Rf?i.push(e):(a[e.facet.id]||(a[e.facet.id]=[])).push(e);let s=Object.create(null),c=[],l=[];for(let e of i)s[e.id]=l.length<<1,l.push(t=>e.slot(t));let u=r?.config.facets;for(let e in a){let t=a[e],n=t[0].facet,i=u&&u[e]||[];if(t.every(e=>e.type==0)){if(s[n.id]=c.length<<1|1,Mf(i,t))c.push(r.facet(n));else{let e=n.combine(t.map(e=>e.value));c.push(r&&n.compare(e,r.facet(n))?r.facet(n):e)}}else{for(let e of t)e.type==0?(s[e.id]=c.length<<1|1,c.push(e.value)):(s[e.id]=l.length<<1,l.push(t=>e.dynamicSlot(t)));s[n.id]=l.length<<1,l.push(e=>If(e,n,t))}}let d=l.map(e=>e(s));return new e(t,o,d,s,c,a)}};function Kf(e,t,n){let r=[[],[],[],[],[]],i=new Map;function a(e,o){let s=i.get(e);if(s!=null){if(s<=o)return;let t=r[s].indexOf(e);t>-1&&r[s].splice(t,1),e instanceof Wf&&n.delete(e.compartment)}if(i.set(e,o),Array.isArray(e))for(let t of e)a(t,o);else if(e instanceof Wf){if(n.has(e.compartment))throw RangeError(`Duplicate use of compartment in extensions`);let r=t.get(e.compartment)||e.inner;n.set(e.compartment,r),a(r,o)}else if(e instanceof Hf)a(e.inner,e.prec);else if(e instanceof Rf)r[o].push(e),e.provides&&a(e.provides,o);else if(e instanceof Nf)r[o].push(e),e.facet.extensions&&a(e.facet.extensions,zf.default);else{let t=e.extension;if(!t)throw Error(`Unrecognized extension value in extension set (${e}).`);if(t==e)throw Error(`Unrecognized extension value in extension set (${e}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);a(t,o)}}return a(e,zf.default),r.reduce((e,t)=>e.concat(t))}function qf(e,t){if(t&1)return 2;let n=t>>1,r=e.status[n];if(r==4)throw Error(`Cyclic dependency between fields and/or facets`);if(r&2)return r;e.status[n]=4;let i=e.computeSlot(e,e.config.dynamicSlots[n]);return e.status[n]=2|i}function Jf(e,t){return t&1?e.config.staticValues[t>>1]:e.values[t>>1]}var Yf=G.define(),Xf=G.define({combine:e=>e.some(e=>e),static:!0}),Zf=G.define({combine:e=>e.length?e[0]:void 0,static:!0}),Qf=G.define(),$f=G.define(),ep=G.define(),tp=G.define({combine:e=>e.length?e[0]:!1}),np=class{constructor(e,t){this.type=e,this.value=t}static define(){return new rp}},rp=class{of(e){return new np(this,e)}},ip=class{constructor(e){this.map=e}of(e){return new ap(this,e)}},ap=class e{constructor(e,t){this.type=e,this.value=t}map(t){let n=this.type.map(this.value,t);return n===void 0?void 0:n==this.value?this:new e(this.type,n)}is(e){return this.type==e}static define(e={}){return new ip(e.map||(e=>e))}static mapEffects(e,t){if(!e.length)return e;let n=[];for(let r of e){let e=r.map(t);e&&n.push(e)}return n}};ap.reconfigure=ap.define(),ap.appendConfig=ap.define();var op=class e{constructor(t,n,r,i,a,o){this.startState=t,this.changes=n,this.selection=r,this.effects=i,this.annotations=a,this.scrollIntoView=o,this._doc=null,this._state=null,r&&Af(r,n.newLength),a.some(t=>t.type==e.time)||(this.annotations=a.concat(e.time.of(Date.now())))}static create(t,n,r,i,a,o){return new e(t,n,r,i,a,o)}get newDoc(){return this._doc||=this.changes.apply(this.startState.doc)}get newSelection(){return this.selection||this.startState.selection.map(this.changes)}get state(){return this._state||this.startState.applyTransaction(this),this._state}annotation(e){for(let t of this.annotations)if(t.type==e)return t.value}get docChanged(){return!this.changes.empty}get reconfigured(){return this.startState.config!=this.state.config}isUserEvent(t){let n=this.annotation(e.userEvent);return!!(n&&(n==t||n.length>t.length&&n.slice(0,t.length)==t&&n[t.length]==`.`))}};op.time=np.define(),op.userEvent=np.define(),op.addToHistory=np.define(),op.remote=np.define();function sp(e,t){let n=[];for(let r=0,i=0;;){let a,o;if(r<e.length&&(i==t.length||t[i]>=e[r]))a=e[r++],o=e[r++];else if(i<t.length)a=t[i++],o=t[i++];else return n;!n.length||n[n.length-1]<a?n.push(a,o):n[n.length-1]<o&&(n[n.length-1]=o)}}function cp(e,t,n){let r,i,a;return n?(r=t.changes,i=Sf.empty(t.changes.length),a=e.changes.compose(t.changes)):(r=t.changes.map(e.changes),i=e.changes.mapDesc(t.changes,!0),a=e.changes.compose(r)),{changes:a,selection:t.selection?t.selection.map(i):e.selection?.map(r),effects:ap.mapEffects(e.effects,r).concat(ap.mapEffects(t.effects,i)),annotations:e.annotations.length?e.annotations.concat(t.annotations):t.annotations,scrollIntoView:e.scrollIntoView||t.scrollIntoView}}function lp(e,t,n){let r=t.selection,i=mp(t.annotations);return t.userEvent&&(i=i.concat(op.userEvent.of(t.userEvent))),{changes:t.changes instanceof Sf?t.changes:Sf.of(t.changes||[],n,e.facet(Zf)),selection:r&&(r instanceof W?r:W.single(r.anchor,r.head)),effects:mp(t.effects),annotations:i,scrollIntoView:!!t.scrollIntoView}}function up(e,t,n){let r=lp(e,t.length?t[0]:{},e.doc.length);t.length&&t[0].filter===!1&&(n=!1);for(let i=1;i<t.length;i++){t[i].filter===!1&&(n=!1);let a=!!t[i].sequential;r=cp(r,lp(e,t[i],a?r.changes.newLength:e.doc.length),a)}let i=op.create(e,r.changes,r.selection,r.effects,r.annotations,r.scrollIntoView);return fp(n?dp(i):i)}function dp(e){let t=e.startState,n=!0;for(let r of t.facet(Qf)){let t=r(e);if(t===!1){n=!1;break}Array.isArray(t)&&(n=n===!0?t:sp(n,t))}if(n!==!0){let r,i;if(n===!1)i=e.changes.invertedDesc,r=Sf.empty(t.doc.length);else{let t=e.changes.filter(n);r=t.changes,i=t.filtered.mapDesc(t.changes).invertedDesc}e=op.create(t,r,e.selection&&e.selection.map(i),ap.mapEffects(e.effects,i),e.annotations,e.scrollIntoView)}let r=t.facet($f);for(let n=r.length-1;n>=0;n--){let i=r[n](e);e=i instanceof op?i:Array.isArray(i)&&i.length==1&&i[0]instanceof op?i[0]:up(t,mp(i),!1)}return e}function fp(e){let t=e.startState,n=t.facet(ep),r=e;for(let i=n.length-1;i>=0;i--){let a=n[i](e);a&&Object.keys(a).length&&(r=cp(r,lp(t,a,e.changes.newLength),!0))}return r==e?e:op.create(t,e.changes,e.selection,r.effects,r.annotations,r.scrollIntoView)}var pp=[];function mp(e){return e==null?pp:Array.isArray(e)?e:[e]}var hp=(function(e){return e[e.Word=0]=`Word`,e[e.Space=1]=`Space`,e[e.Other=2]=`Other`,e})(hp||={}),gp=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/,_p;try{_p=RegExp(`[\\p{Alphabetic}\\p{Number}_]`,`u`)}catch{}function vp(e){if(_p)return _p.test(e);for(let t=0;t<e.length;t++){let n=e[t];if(/\w/.test(n)||n>``&&(n.toUpperCase()!=n.toLowerCase()||gp.test(n)))return!0}return!1}function yp(e){return t=>{if(!/\S/.test(t))return hp.Space;if(vp(t))return hp.Word;for(let n=0;n<e.length;n++)if(t.indexOf(e[n])>-1)return hp.Word;return hp.Other}}var bp=class e{constructor(e,t,n,r,i,a){this.config=e,this.doc=t,this.selection=n,this.values=r,this.status=e.statusTemplate.slice(),this.computeSlot=i,a&&(a._state=this);for(let e=0;e<this.config.dynamicSlots.length;e++)qf(this,e<<1);this.computeSlot=null}field(e,t=!0){let n=this.config.address[e.id];if(n==null){if(t)throw RangeError(`Field is not present in this state`);return}return qf(this,n),Jf(this,n)}update(...e){return up(this,e,!0)}applyTransaction(t){let n=this.config,{base:r,compartments:i}=n;for(let e of t.effects)e.is(Uf.reconfigure)?(n&&=(i=new Map,n.compartments.forEach((e,t)=>i.set(t,e)),null),i.set(e.value.compartment,e.value.extension)):e.is(ap.reconfigure)?(n=null,r=e.value):e.is(ap.appendConfig)&&(n=null,r=mp(r).concat(e.value));let a;n?a=t.startState.values.slice():(n=Gf.resolve(r,i,this),a=new e(n,this.doc,this.selection,n.dynamicSlots.map(()=>null),(e,t)=>t.reconfigure(e,this),null).values);let o=t.startState.facet(Xf)?t.newSelection:t.newSelection.asSingle();new e(n,t.newDoc,o,a,(e,n)=>n.update(e,t),t)}replaceSelection(e){return typeof e==`string`&&(e=this.toText(e)),this.changeByRange(t=>({changes:{from:t.from,to:t.to,insert:e},range:W.cursor(t.from+e.length,-1)}))}changeByRange(e){let t=this.selection,n=e(t.ranges[0]),r=this.changes(n.changes),i=[n.range],a=mp(n.effects);for(let n=1;n<t.ranges.length;n++){let o=e(t.ranges[n]),s=this.changes(o.changes),c=s.map(r);for(let e=0;e<n;e++)i[e]=i[e].map(c);let l=r.mapDesc(s,!0);i.push(o.range.map(l)),r=r.compose(c),a=ap.mapEffects(a,c).concat(ap.mapEffects(mp(o.effects),l))}return{changes:r,selection:W.create(i,t.mainIndex),effects:a}}changes(t=[]){return t instanceof Sf?t:Sf.of(t,this.doc.length,this.facet(e.lineSeparator))}toText(t){return tf.of(t.split(this.facet(e.lineSeparator)||yf))}sliceDoc(e=0,t=this.doc.length){return this.doc.sliceString(e,t,this.lineBreak)}facet(e){let t=this.config.address[e.id];return t==null?e.default:(qf(this,t),Jf(this,t))}toJSON(e){let t={doc:this.sliceDoc(),selection:this.selection.toJSON()};if(e)for(let n in e){let r=e[n];r instanceof Rf&&this.config.address[r.id]!=null&&(t[n]=r.spec.toJSON(this.field(e[n]),this))}return t}static fromJSON(t,n={},r){if(!t||typeof t.doc!=`string`)throw RangeError(`Invalid JSON representation for EditorState`);let i=[];if(r){for(let e in r)if(Object.prototype.hasOwnProperty.call(t,e)){let n=r[e],a=t[e];i.push(n.init(e=>n.spec.fromJSON(a,e)))}}return e.create({doc:t.doc,selection:W.fromJSON(t.selection),extensions:n.extensions?i.concat([n.extensions]):i})}static create(t={}){let n=Gf.resolve(t.extensions||[],new Map),r=t.doc instanceof tf?t.doc:tf.of((t.doc||``).split(n.staticFacet(e.lineSeparator)||yf)),i=t.selection?t.selection instanceof W?t.selection:W.single(t.selection.anchor,t.selection.head):W.single(0);return Af(i,r.length),n.staticFacet(Xf)||(i=i.asSingle()),new e(n,r,i,n.dynamicSlots.map(()=>null),(e,t)=>t.create(e),null)}get tabSize(){return this.facet(e.tabSize)}get lineBreak(){return this.facet(e.lineSeparator)||`
|
|
15
|
+
`}get readOnly(){return this.facet(tp)}phrase(t,...n){for(let n of this.facet(e.phrases))if(Object.prototype.hasOwnProperty.call(n,t)){t=n[t];break}return n.length&&(t=t.replace(/\$(\$|\d*)/g,(e,t)=>{if(t==`$`)return`$`;let r=+(t||1);return!r||r>n.length?e:n[r-1]})),t}languageDataAt(e,t,n=-1){let r=[];for(let i of this.facet(Yf))for(let a of i(this,t,n))Object.prototype.hasOwnProperty.call(a,e)&&r.push(a[e]);return r}charCategorizer(e){let t=this.languageDataAt(`wordChars`,e);return yp(t.length?t[0]:``)}wordAt(e){let{text:t,from:n,length:r}=this.doc.lineAt(e),i=this.charCategorizer(e),a=e-n,o=e-n;for(;a>0;){let e=pf(t,a,!1);if(i(t.slice(e,a))!=hp.Word)break;a=e}for(;o<r;){let e=pf(t,o);if(i(t.slice(o,e))!=hp.Word)break;o=e}return a==o?null:W.range(a+n,o+n)}};bp.allowMultipleSelections=Xf,bp.tabSize=G.define({combine:e=>e.length?e[0]:4}),bp.lineSeparator=Zf,bp.readOnly=tp,bp.phrases=G.define({compare(e,t){let n=Object.keys(e),r=Object.keys(t);return n.length==r.length&&n.every(n=>e[n]==t[n])}}),bp.languageData=Yf,bp.changeFilter=Qf,bp.transactionFilter=$f,bp.transactionExtender=ep,Uf.reconfigure=ap.define();function xp(e,t,n={}){let r={};for(let t of e)for(let e of Object.keys(t)){let i=t[e],a=r[e];if(a===void 0)r[e]=i;else if(a!==i&&i!==void 0){if(Object.hasOwnProperty.call(n,e))r[e]=n[e](a,i);else throw Error(`Config merge conflict for field `+e)}}for(let e in t)r[e]===void 0&&(r[e]=t[e]);return r}var Sp=class{eq(e){return this==e}range(e,t=e){return wp.create(e,t,this)}};Sp.prototype.startSide=Sp.prototype.endSide=0,Sp.prototype.point=!1,Sp.prototype.mapMode=bf.TrackDel;function Cp(e,t){return e==t||e.constructor==t.constructor&&e.eq(t)}var wp=class e{constructor(e,t,n){this.from=e,this.to=t,this.value=n}static create(t,n,r){return new e(t,n,r)}};function Tp(e,t){return e.from-t.from||e.value.startSide-t.value.startSide}var Ep=class e{constructor(e,t,n,r){this.from=e,this.to=t,this.value=n,this.maxPoint=r}get length(){return Op(this.to)}findIndex(e,t,n,r=0){let i=n?this.to:this.from;for(let a=r,o=i.length;;){if(a==o)return a;let r=a+o>>1,s=i[r]-e||(n?this.value[r].endSide:this.value[r].startSide)-t;if(r==a)return s>=0?a:o;s>=0?o=r:a=r+1}}between(e,t,n,r){for(let i=this.findIndex(t,-1e9,!0),a=this.findIndex(n,1e9,!1,i);i<a;i++)if(r(this.from[i]+e,this.to[i]+e,this.value[i])===!1)return!1}map(t,n,r,i,a){let o=[],s=[],c=[],l=-1,u=-1;iter:for(let e=0;e<this.value.length;e++){let d=this.value[e],f=this.from[e]+t,p=this.to[e]+t,m,h;if(f==p){let e=n.mapPos(f,d.startSide,d.mapMode);if(e==null||(m=h=e,d.startSide!=d.endSide&&(h=n.mapPos(f,d.endSide),h<m)))continue}else if(m=n.mapPos(f,d.startSide),h=n.mapPos(p,d.endSide),m>h||m==h&&d.startSide>0&&d.endSide<=0)continue;if(!((h-m||d.endSide-d.startSide)<0)){if(l<0&&(l=m),d.point&&(u=Math.max(u,h-m)),(m-r||d.startSide-i)>=0)o.push(d),s.push(m-l),c.push(h-l),r=h,i=d.endSide;else{if(m==h)for(let e=o.length;e>0;e--){if((m-(c[e-1]+l)||d.startSide-o[e-1].endSide)>=0){o.splice(e,0,d),s.splice(e,0,m-l),c.splice(e,0,h-l);continue iter}if((m-(s[e-1]+l)||d.endSide-o[e-1].startSide)>0)break}a(m,h,d)}}}return{mapped:o.length?new e(s,c,o,u):null,pos:l}}},Dp=class e{constructor(e,t,n,r){this.chunkPos=e,this.chunk=t,this.nextLayer=n,this.maxPoint=r}static create(t,n,r,i){return new e(t,n,r,i)}get length(){let e=this.chunk.length-1;return e<0?0:Math.max(this.chunkEnd(e),this.nextLayer.length)}get size(){if(this.isEmpty)return 0;let e=this.nextLayer.size;for(let t of this.chunk)e+=t.value.length;return e}chunkEnd(e){return this.chunkPos[e]+this.chunk[e].length}update(t){let{add:n=[],sort:r=!1,filterFrom:i=0,filterTo:a=this.length}=t,o=t.filter;if(n.length==0&&!o)return this;if(r&&(n=n.slice().sort(Tp)),this.isEmpty)return n.length?e.of(n):this;let s=new Mp(this,null,-1).goto(0),c=0,l=[],u=new Ap;for(;s.value||c<n.length;)if(c<n.length&&(s.from-n[c].from||s.startSide-n[c].value.startSide)>=0){let e=n[c++];u.addInner(e.from,e.to,e.value,!1)||l.push(e)}else s.rangeIndex==1&&s.chunkIndex<this.chunk.length&&(c==n.length||this.chunkEnd(s.chunkIndex)<n[c].from)&&(!o||i>this.chunkEnd(s.chunkIndex)||a<this.chunkPos[s.chunkIndex])&&u.addChunk(this.chunkPos[s.chunkIndex],this.chunk[s.chunkIndex])?s.nextChunk():((!o||i>s.to||a<s.from||o(s.from,s.to,s.value))&&(u.addInner(s.from,s.to,s.value,!1)||l.push(wp.create(s.from,s.to,s.value))),s.next());return u.finishInner(this.nextLayer.isEmpty&&!l.length?e.empty:this.nextLayer.update({add:l,filter:o,filterFrom:i,filterTo:a}))}map(t){if(t.empty||this.isEmpty)return this;let n=[],r=[],i=-1,a,o=(e,t,n)=>{a||=new Ap,a.addRange(e,t,n,!1)};for(let e=0;e<this.chunk.length;e++){let a=this.chunkPos[e],s=this.chunk[e],c=t.touchesRange(a,a+s.length);if(c===!1)i=Math.max(i,s.maxPoint),n.push(s),r.push(t.mapPos(a));else if(c===!0){let[e,c]=n.length?[Op(r)+Op(n).length,Op(Op(n).value).endSide]:[-1,-1],{mapped:l,pos:u}=s.map(a,t,e,c,o);l&&(i=Math.max(i,l.maxPoint),n.push(l),r.push(u))}}let s=this.nextLayer.map(t);return a&&(s=a.finishInner(s)),n.length==0?s:new e(r,n,s||e.empty,i)}between(e,t,n){if(!this.isEmpty){for(let r=0;r<this.chunk.length;r++){let i=this.chunkPos[r],a=this.chunk[r];if(t>=i&&e<=i+a.length&&a.between(i,e-i,t-i,n)===!1)return}this.nextLayer.between(e,t,n)}}iter(e=0){return Np.from([this]).goto(e)}get isEmpty(){return this.nextLayer==this}static iter(e,t=0){return Np.from(e).goto(t)}static compare(e,t,n,r,i=-1){let a=e.filter(e=>e.maxPoint>0||!e.isEmpty&&e.maxPoint>=i),o=t.filter(e=>e.maxPoint>0||!e.isEmpty&&e.maxPoint>=i),s=jp(a,o,n),c=new Fp(a,s,i),l=new Fp(o,s,i);n.iterGaps((e,t,n)=>Ip(c,e,l,t,n,r)),n.empty&&n.length==0&&Ip(c,0,l,0,0,r)}static eq(e,t,n=0,r){r??=1e9-1;let i=e.filter(e=>!e.isEmpty&&t.indexOf(e)<0),a=t.filter(t=>!t.isEmpty&&e.indexOf(t)<0);if(i.length!=a.length)return!1;if(!i.length)return!0;let o=jp(i,a),s=new Fp(i,o,0).goto(n),c=new Fp(a,o,0).goto(n);for(;;){if(s.to!=c.to||!Lp(s.active,c.active)||s.point&&(!c.point||!Cp(s.point,c.point)))return!1;if(s.to>r)return!0;s.next(),c.next()}}static spans(e,t,n,r,i=-1){let a=new Fp(e,null,i).goto(t),o=t,s=a.openStart;for(;;){let e=Math.min(a.to,n);if(a.point){let n=a.activeForPoint(a.to),i=a.pointFrom<t?n.length+1:a.point.startSide<0?n.length:Math.min(n.length,s);r.point(o,e,a.point,n,i,a.pointRank),s=Math.min(a.openEnd(e),n.length)}else e>o&&(r.span(o,e,a.active,s),s=a.openEnd(e));if(a.to>n)return s+(a.point&&a.to>n?1:0);o=a.to,a.next()}}static of(e,t=!1){let n=new Ap;for(let r of e instanceof wp?[e]:t?kp(e):e)n.add(r.from,r.to,r.value);return n.finish()}static join(t){if(!t.length)return e.empty;let n=Op(t);for(let r=t.length-2;r>=0;r--)for(let i=t[r];i!=e.empty;i=i.nextLayer)n=new e(i.chunkPos,i.chunk,n,Math.max(i.maxPoint,n.maxPoint));return n}};Dp.empty=new Dp([],[],null,-1);function Op(e){return e[e.length-1]}function kp(e){if(e.length>1)for(let t=e[0],n=1;n<e.length;n++){let r=e[n];if(Tp(t,r)>0)return e.slice().sort(Tp);t=r}return e}Dp.empty.nextLayer=Dp.empty;var Ap=class e{finishChunk(e){this.chunks.push(new Ep(this.from,this.to,this.value,this.maxPoint)),this.chunkPos.push(this.chunkStart),this.chunkStart=-1,this.setMaxPoint=Math.max(this.setMaxPoint,this.maxPoint),this.maxPoint=-1,e&&(this.from=[],this.to=[],this.value=[])}constructor(){this.chunks=[],this.chunkPos=[],this.chunkStart=-1,this.last=null,this.lastFrom=-1e9,this.lastTo=-1e9,this.from=[],this.to=[],this.value=[],this.maxPoint=-1,this.setMaxPoint=-1,this.nextLayer=null}add(e,t,n){this.addRange(e,t,n,!0)}addRange(t,n,r,i){this.addInner(t,n,r,i)||(this.nextLayer||=new e).addRange(t,n,r,i)}addInner(e,t,n,r){let i=e-this.lastTo||n.startSide-this.last.endSide;if(r&&i<=0&&(e-this.lastFrom||n.startSide-this.last.startSide)<0)throw Error("Ranges must be added sorted by `from` position and `startSide`");return i<0?!1:(this.from.length==250&&this.finishChunk(!0),this.chunkStart<0&&(this.chunkStart=e),this.from.push(e-this.chunkStart),this.to.push(t-this.chunkStart),this.last=n,this.lastFrom=e,this.lastTo=t,this.value.push(n),n.point&&(this.maxPoint=Math.max(this.maxPoint,t-e)),!0)}addChunk(e,t){if((e-this.lastTo||t.value[0].startSide-this.last.endSide)<0)return!1;this.from.length&&this.finishChunk(!0),this.setMaxPoint=Math.max(this.setMaxPoint,t.maxPoint),this.chunks.push(t),this.chunkPos.push(e);let n=t.value.length-1;return this.last=t.value[n],this.lastFrom=t.from[n]+e,this.lastTo=t.to[n]+e,!0}finish(){return this.finishInner(Dp.empty)}finishInner(e){if(this.from.length&&this.finishChunk(!1),this.chunks.length==0)return e;let t=Dp.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(e):e,this.setMaxPoint);return this.from=null,t}};function jp(e,t,n){let r=new Map;for(let t of e)for(let e=0;e<t.chunk.length;e++)t.chunk[e].maxPoint<=0&&r.set(t.chunk[e],t.chunkPos[e]);let i=new Set;for(let e of t)for(let t=0;t<e.chunk.length;t++){let a=r.get(e.chunk[t]);a!=null&&(n?n.mapPos(a):a)==e.chunkPos[t]&&!n?.touchesRange(a,a+e.chunk[t].length)&&i.add(e.chunk[t])}return i}var Mp=class{constructor(e,t,n,r=0){this.layer=e,this.skip=t,this.minPoint=n,this.rank=r}get startSide(){return this.value?this.value.startSide:0}get endSide(){return this.value?this.value.endSide:0}goto(e,t=-1e9){return this.chunkIndex=this.rangeIndex=0,this.gotoInner(e,t,!1),this}gotoInner(e,t,n){for(;this.chunkIndex<this.layer.chunk.length;){let t=this.layer.chunk[this.chunkIndex];if(!(this.skip&&this.skip.has(t)||this.layer.chunkEnd(this.chunkIndex)<e||t.maxPoint<this.minPoint))break;this.chunkIndex++,n=!1}if(this.chunkIndex<this.layer.chunk.length){let r=this.layer.chunk[this.chunkIndex].findIndex(e-this.layer.chunkPos[this.chunkIndex],t,!0);(!n||this.rangeIndex<r)&&this.setRangeIndex(r)}this.next()}forward(e,t){(this.to-e||this.endSide-t)<0&&this.gotoInner(e,t,!0)}next(){for(;;)if(this.chunkIndex==this.layer.chunk.length){this.from=this.to=1e9,this.value=null;break}else{let e=this.layer.chunkPos[this.chunkIndex],t=this.layer.chunk[this.chunkIndex],n=e+t.from[this.rangeIndex];if(this.from=n,this.to=e+t.to[this.rangeIndex],this.value=t.value[this.rangeIndex],this.setRangeIndex(this.rangeIndex+1),this.minPoint<0||this.value.point&&this.to-this.from>=this.minPoint)break}}setRangeIndex(e){if(e==this.layer.chunk[this.chunkIndex].value.length){if(this.chunkIndex++,this.skip)for(;this.chunkIndex<this.layer.chunk.length&&this.skip.has(this.layer.chunk[this.chunkIndex]);)this.chunkIndex++;this.rangeIndex=0}else this.rangeIndex=e}nextChunk(){this.chunkIndex++,this.rangeIndex=0,this.next()}compare(e){return this.from-e.from||this.startSide-e.startSide||this.rank-e.rank||this.to-e.to||this.endSide-e.endSide}},Np=class e{constructor(e){this.heap=e}static from(t,n=null,r=-1){let i=[];for(let e=0;e<t.length;e++)for(let a=t[e];!a.isEmpty;a=a.nextLayer)a.maxPoint>=r&&i.push(new Mp(a,n,r,e));return i.length==1?i[0]:new e(i)}get startSide(){return this.value?this.value.startSide:0}goto(e,t=-1e9){for(let n of this.heap)n.goto(e,t);for(let e=this.heap.length>>1;e>=0;e--)Pp(this.heap,e);return this.next(),this}forward(e,t){for(let n of this.heap)n.forward(e,t);for(let e=this.heap.length>>1;e>=0;e--)Pp(this.heap,e);(this.to-e||this.value.endSide-t)<0&&this.next()}next(){if(this.heap.length==0)this.from=this.to=1e9,this.value=null,this.rank=-1;else{let e=this.heap[0];this.from=e.from,this.to=e.to,this.value=e.value,this.rank=e.rank,e.value&&e.next(),Pp(this.heap,0)}}};function Pp(e,t){for(let n=e[t];;){let r=(t<<1)+1;if(r>=e.length)break;let i=e[r];if(r+1<e.length&&i.compare(e[r+1])>=0&&(i=e[r+1],r++),n.compare(i)<0)break;e[r]=n,e[t]=i,t=r}}var Fp=class{constructor(e,t,n){this.minPoint=n,this.active=[],this.activeTo=[],this.activeRank=[],this.minActive=-1,this.point=null,this.pointFrom=0,this.pointRank=0,this.to=-1e9,this.endSide=0,this.openStart=-1,this.cursor=Np.from(e,t,n)}goto(e,t=-1e9){return this.cursor.goto(e,t),this.active.length=this.activeTo.length=this.activeRank.length=0,this.minActive=-1,this.to=e,this.endSide=t,this.openStart=-1,this.next(),this}forward(e,t){for(;this.minActive>-1&&(this.activeTo[this.minActive]-e||this.active[this.minActive].endSide-t)<0;)this.removeActive(this.minActive);this.cursor.forward(e,t)}removeActive(e){Rp(this.active,e),Rp(this.activeTo,e),Rp(this.activeRank,e),this.minActive=Bp(this.active,this.activeTo)}addActive(e){let t=0,{value:n,to:r,rank:i}=this.cursor;for(;t<this.activeRank.length&&(i-this.activeRank[t]||r-this.activeTo[t])>0;)t++;zp(this.active,t,n),zp(this.activeTo,t,r),zp(this.activeRank,t,i),e&&zp(e,t,this.cursor.from),this.minActive=Bp(this.active,this.activeTo)}next(){let e=this.to,t=this.point;this.point=null;let n=this.openStart<0?[]:null;for(;;){let r=this.minActive;if(r>-1&&(this.activeTo[r]-this.cursor.from||this.active[r].endSide-this.cursor.startSide)<0){if(this.activeTo[r]>e){this.to=this.activeTo[r],this.endSide=this.active[r].endSide;break}this.removeActive(r),n&&Rp(n,r)}else if(!this.cursor.value){this.to=this.endSide=1e9;break}else if(this.cursor.from>e){this.to=this.cursor.from,this.endSide=this.cursor.startSide;break}else{let e=this.cursor.value;if(!e.point)this.addActive(n),this.cursor.next();else if(t&&this.cursor.to==this.to&&this.cursor.from<this.cursor.to)this.cursor.next();else{this.point=e,this.pointFrom=this.cursor.from,this.pointRank=this.cursor.rank,this.to=this.cursor.to,this.endSide=e.endSide,this.cursor.next(),this.forward(this.to,this.endSide);break}}}if(n){this.openStart=0;for(let t=n.length-1;t>=0&&n[t]<e;t--)this.openStart++}}activeForPoint(e){if(!this.active.length)return this.active;let t=[];for(let n=this.active.length-1;n>=0&&!(this.activeRank[n]<this.pointRank);n--)(this.activeTo[n]>e||this.activeTo[n]==e&&this.active[n].endSide>=this.point.endSide)&&t.push(this.active[n]);return t.reverse()}openEnd(e){let t=0;for(let n=this.activeTo.length-1;n>=0&&this.activeTo[n]>e;n--)t++;return t}};function Ip(e,t,n,r,i,a){e.goto(t),n.goto(r);let o=r+i,s=r,c=r-t,l=!!a.boundChange;for(let t=!1;;){let r=e.to+c-n.to,i=r||e.endSide-n.endSide,u=i<0?e.to+c:n.to,d=Math.min(u,o);if(e.point||n.point?(e.point&&n.point&&Cp(e.point,n.point)&&Lp(e.activeForPoint(e.to),n.activeForPoint(n.to))||a.comparePoint(s,d,e.point,n.point),t=!1):(t&&=(a.boundChange(s),!1),d>s&&!Lp(e.active,n.active)&&a.compareRange(s,d,e.active,n.active),l&&d<o&&(r||e.openEnd(u)!=n.openEnd(u))&&(t=!0)),u>o)break;s=u,i<=0&&e.next(),i>=0&&n.next()}}function Lp(e,t){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!=t[n]&&!Cp(e[n],t[n]))return!1;return!0}function Rp(e,t){for(let n=t,r=e.length-1;n<r;n++)e[n]=e[n+1];e.pop()}function zp(e,t,n){for(let n=e.length-1;n>=t;n--)e[n+1]=e[n];e[t]=n}function Bp(e,t){let n=-1,r=1e9;for(let i=0;i<t.length;i++)(t[i]-r||e[i].endSide-e[n].endSide)<0&&(n=i,r=t[i]);return n}function Vp(e,t,n=e.length){let r=0;for(let i=0;i<n&&i<e.length;)e.charCodeAt(i)==9?(r+=t-r%t,i++):(r++,i=pf(e,i));return r}function Hp(e,t,n,r){for(let r=0,i=0;;){if(i>=t)return r;if(r==e.length)break;i+=e.charCodeAt(r)==9?n-i%n:1,r=pf(e,r)}return r===!0?-1:e.length}for(var Up=`ͼ`,Wp=typeof Symbol>`u`?`__ͼ`:Symbol.for(Up),Gp=typeof Symbol>`u`?`__styleSet`+Math.floor(Math.random()*1e8):Symbol(`styleSet`),Kp=typeof globalThis<`u`?globalThis:typeof window<`u`?window:{},qp=class{constructor(e,t){this.rules=[];let{finish:n}=t||{};function r(e){return/^@/.test(e)?[e]:e.split(/,\s*/)}function i(e,t,a,o){let s=[],c=/^@(\w+)\b/.exec(e[0]),l=c&&c[1]==`keyframes`;if(c&&t==null)return a.push(e[0]+`;`);for(let n in t){let o=t[n];if(/&/.test(n))i(n.split(/,\s*/).map(t=>e.map(e=>t.replace(/&/,e))).reduce((e,t)=>e.concat(t)),o,a);else if(o&&typeof o==`object`){if(!c)throw RangeError(`The value of a property (`+n+`) should be a primitive value.`);i(r(n),o,s,l)}else o!=null&&s.push(n.replace(/_.*/,``).replace(/[A-Z]/g,e=>`-`+e.toLowerCase())+`: `+o+`;`)}(s.length||l)&&a.push((n&&!c&&!o?e.map(n):e).join(`, `)+` {`+s.join(` `)+`}`)}for(let t in e)i(r(t),e[t],this.rules)}getRules(){return this.rules.join(`
|
|
16
|
+
`)}static newName(){let e=Kp[Wp]||1;return Kp[Wp]=e+1,Up+e.toString(36)}static mount(e,t,n){let r=e[Gp],i=n&&n.nonce;r?i&&r.setNonce(i):r=new Yp(e,i),r.mount(Array.isArray(t)?t:[t],e)}},Jp=new Map,Yp=class{constructor(e,t){let n=e.ownerDocument||e,r=n.defaultView;if(!e.head&&e.adoptedStyleSheets&&r.CSSStyleSheet){let t=Jp.get(n);if(t)return e[Gp]=t;this.sheet=new r.CSSStyleSheet,Jp.set(n,this)}else this.styleTag=n.createElement(`style`),t&&this.styleTag.setAttribute(`nonce`,t);this.modules=[],e[Gp]=this}mount(e,t){let n=this.sheet,r=0,i=0,a=!1;for(let t=0;t<e.length;t++){let o=e[t],s=this.modules.indexOf(o);if(s<i&&s>-1&&(this.modules.splice(s,1),a=!0,i--,s=-1),s==-1){if(this.modules.splice(i++,0,o),a=!0,n)for(let e=0;e<o.rules.length;e++)n.insertRule(o.rules[e],r++)}else{for(;i<s;)r+=this.modules[i++].rules.length;r+=o.rules.length,i++}}if(n)t.adoptedStyleSheets.indexOf(this.sheet)<0&&(t.adoptedStyleSheets=[this.sheet,...t.adoptedStyleSheets]);else{if(a){let e=``;for(let t=0;t<this.modules.length;t++)e+=this.modules[t].getRules()+`
|
|
17
|
+
`;this.styleTag.textContent=e}let e=t.head||t;this.styleTag.parentNode!=e&&e.insertBefore(this.styleTag,e.firstChild)}}setNonce(e){this.styleTag&&this.styleTag.getAttribute(`nonce`)!=e&&this.styleTag.setAttribute(`nonce`,e)}},Xp={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:`'`},Zp={48:`)`,49:`!`,50:`@`,51:`#`,52:`$`,53:`%`,54:`^`,55:`&`,56:`*`,57:`(`,59:`:`,61:`+`,173:`_`,186:`:`,187:`+`,188:`<`,189:`_`,190:`>`,191:`?`,192:`~`,219:`{`,220:`|`,221:`}`,222:`"`},Qp=typeof navigator<`u`&&/Mac/.test(navigator.platform),$p=typeof navigator<`u`&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),em=0;em<10;em++)Xp[48+em]=Xp[96+em]=String(em);for(var em=1;em<=24;em++)Xp[em+111]=`F`+em;for(var em=65;em<=90;em++)Xp[em]=String.fromCharCode(em+32),Zp[em]=String.fromCharCode(em);for(var tm in Xp)Zp.hasOwnProperty(tm)||(Zp[tm]=Xp[tm]);function nm(e){var t=!(Qp&&e.metaKey&&e.shiftKey&&!e.ctrlKey&&!e.altKey||$p&&e.shiftKey&&e.key&&e.key.length==1||e.key==`Unidentified`)&&e.key||(e.shiftKey?Zp:Xp)[e.keyCode]||e.key||`Unidentified`;return t==`Esc`&&(t=`Escape`),t==`Del`&&(t=`Delete`),t==`Left`&&(t=`ArrowLeft`),t==`Up`&&(t=`ArrowUp`),t==`Right`&&(t=`ArrowRight`),t==`Down`&&(t=`ArrowDown`),t}function rm(){var e=arguments[0];typeof e==`string`&&(e=document.createElement(e));var t=1,n=arguments[1];if(n&&typeof n==`object`&&n.nodeType==null&&!Array.isArray(n)){for(var r in n)if(Object.prototype.hasOwnProperty.call(n,r)){var i=n[r];typeof i==`string`?e.setAttribute(r,i):i!=null&&(e[r]=i)}t++}for(;t<arguments.length;t++)im(e,arguments[t]);return e}function im(e,t){if(typeof t==`string`)e.appendChild(document.createTextNode(t));else if(t!=null){if(t.nodeType!=null)e.appendChild(t);else if(Array.isArray(t))for(var n=0;n<t.length;n++)im(e,t[n]);else throw RangeError(`Unsupported child node: `+t)}}var am=typeof navigator<`u`?navigator:{userAgent:``,vendor:``,platform:``},om=typeof document<`u`?document:{documentElement:{style:{}}},sm=/Edge\/(\d+)/.exec(am.userAgent),cm=/MSIE \d/.test(am.userAgent),lm=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(am.userAgent),um=!!(cm||lm||sm),dm=!um&&/gecko\/(\d+)/i.test(am.userAgent),fm=!um&&/Chrome\/(\d+)/.exec(am.userAgent),pm=`webkitFontSmoothing`in om.documentElement.style,mm=!um&&/Apple Computer/.test(am.vendor),hm=mm&&(/Mobile\/\w+/.test(am.userAgent)||am.maxTouchPoints>2),K={mac:hm||/Mac/.test(am.platform),windows:/Win/.test(am.platform),linux:/Linux|X11/.test(am.platform),ie:um,ie_version:cm?om.documentMode||6:lm?+lm[1]:sm?+sm[1]:0,gecko:dm,gecko_version:dm?+(/Firefox\/(\d+)/.exec(am.userAgent)||[0,0])[1]:0,chrome:!!fm,chrome_version:fm?+fm[1]:0,ios:hm,android:/Android\b/.test(am.userAgent),webkit:pm,webkit_version:pm?+(/\bAppleWebKit\/(\d+)/.exec(am.userAgent)||[0,0])[1]:0,safari:mm,safari_version:mm?+(/\bVersion\/(\d+(\.\d+)?)/.exec(am.userAgent)||[0,0])[1]:0,tabSize:om.documentElement.style.tabSize==null?`-moz-tab-size`:`tab-size`};function gm(e,t){for(let n in e)n==`class`&&t.class?t.class+=` `+e.class:n==`style`&&t.style?t.style+=`;`+e.style:t[n]=e[n];return t}var _m=Object.create(null);function vm(e,t,n){if(e==t)return!0;e||=_m,t||=_m;let r=Object.keys(e),i=Object.keys(t);if(r.length-0!=i.length-0)return!1;for(let a of r)if(a!=n&&(i.indexOf(a)==-1||e[a]!==t[a]))return!1;return!0}function ym(e,t){for(let n=e.attributes.length-1;n>=0;n--){let r=e.attributes[n].name;t[r]??e.removeAttribute(r)}for(let n in t){let r=t[n];n==`style`?e.style.cssText=r:e.getAttribute(n)!=r&&e.setAttribute(n,r)}}function bm(e,t,n){let r=!1;if(t)for(let i in t)n&&i in n||(r=!0,i==`style`?e.style.cssText=``:e.removeAttribute(i));if(n)for(let i in n)t&&t[i]==n[i]||(r=!0,i==`style`?e.style.cssText=n[i]:e.setAttribute(i,n[i]));return r}function xm(e){let t=Object.create(null);for(let n=0;n<e.attributes.length;n++){let r=e.attributes[n];t[r.name]=r.value}return t}var Sm=class{eq(e){return!1}updateDOM(e,t,n){return!1}compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}get estimatedHeight(){return-1}get lineBreaks(){return 0}ignoreEvent(e){return!0}coordsAt(e,t,n){return null}get isHidden(){return!1}get editable(){return!1}destroy(e){}},Cm=(function(e){return e[e.Text=0]=`Text`,e[e.WidgetBefore=1]=`WidgetBefore`,e[e.WidgetAfter=2]=`WidgetAfter`,e[e.WidgetRange=3]=`WidgetRange`,e})(Cm||={}),wm=class extends Sp{constructor(e,t,n,r){super(),this.startSide=e,this.endSide=t,this.widget=n,this.spec=r}get heightRelevant(){return!1}static mark(e){return new Tm(e)}static widget(e){let t=Math.max(-1e4,Math.min(1e4,e.side||0)),n=!!e.block;return t+=n&&!e.inlineOrder?t>0?3e8:-4e8:t>0?1e8:-1e8,new Dm(e,t,t,n,e.widget||null,!1)}static replace(e){let t=!!e.block,n,r;if(e.isBlockGap)n=-5e8,r=4e8;else{let{start:i,end:a}=Om(e,t);n=(i?t?-3e8:-1:5e8)-1,r=(a?t?2e8:1:-6e8)+1}return new Dm(e,n,r,t,e.widget||null,!0)}static line(e){return new Em(e)}static set(e,t=!1){return Dp.of(e,t)}hasHeight(){return this.widget?this.widget.estimatedHeight>-1:!1}};wm.none=Dp.empty;var Tm=class e extends wm{constructor(e){let{start:t,end:n}=Om(e);super(t?-1:5e8,n?1:-6e8,null,e),this.tagName=e.tagName||`span`,this.attrs=e.class&&e.attributes?gm(e.attributes,{class:e.class}):e.class?{class:e.class}:e.attributes||_m}eq(t){return this==t||t instanceof e&&this.tagName==t.tagName&&vm(this.attrs,t.attrs)}range(e,t=e){if(e>=t)throw RangeError(`Mark decorations may not be empty`);return super.range(e,t)}};Tm.prototype.point=!1;var Em=class e extends wm{constructor(e){super(-2e8,-2e8,null,e)}eq(t){return t instanceof e&&this.spec.class==t.spec.class&&vm(this.spec.attributes,t.spec.attributes)}range(e,t=e){if(t!=e)throw RangeError(`Line decoration ranges must be zero-length`);return super.range(e,t)}};Em.prototype.mapMode=bf.TrackBefore,Em.prototype.point=!0;var Dm=class e extends wm{constructor(e,t,n,r,i,a){super(t,n,i,e),this.block=r,this.isReplace=a,this.mapMode=r?t<=0?bf.TrackBefore:bf.TrackAfter:bf.TrackDel}get type(){return this.startSide==this.endSide?this.startSide<=0?Cm.WidgetBefore:Cm.WidgetAfter:Cm.WidgetRange}get heightRelevant(){return this.block||!!this.widget&&(this.widget.estimatedHeight>=5||this.widget.lineBreaks>0)}eq(t){return t instanceof e&&km(this.widget,t.widget)&&this.block==t.block&&this.startSide==t.startSide&&this.endSide==t.endSide}range(e,t=e){if(this.isReplace&&(e>t||e==t&&this.startSide>0&&this.endSide<=0))throw RangeError(`Invalid range for replacement decoration`);if(!this.isReplace&&t!=e)throw RangeError(`Widget decorations can only have zero-length ranges`);return super.range(e,t)}};Dm.prototype.point=!0;function Om(e,t=!1){let{inclusiveStart:n,inclusiveEnd:r}=e;return n??=e.inclusive,r??=e.inclusive,{start:n??t,end:r??t}}function km(e,t){return e==t||!!(e&&t&&e.compare(t))}function Am(e,t,n,r=0){let i=n.length-1;i>=0&&n[i]+r>=e?n[i]=Math.max(n[i],t):n.push(e,t)}var jm=class e extends Sp{constructor(e,t,n){super(),this.tagName=e,this.attributes=t,this.rank=n}eq(t){return t==this||t instanceof e&&this.tagName==t.tagName&&vm(this.attributes,t.attributes)}static create(t){return new e(t.tagName,t.attributes||_m,t.rank==null?50:Math.max(0,Math.min(t.rank,100)))}static set(e,t=!1){return Dp.of(e,t)}};jm.prototype.startSide=jm.prototype.endSide=-1;var Mm=e=>e.nodeType==1,Nm=e=>e.nodeType==3;function Pm(e){let t;return t=e.nodeType==11?e.getSelection?e:e.ownerDocument:e,t.getSelection()}function Fm(e,t){return t?e==t||e.contains(t.nodeType==1?t:t.parentNode):!1}function Im(e,t){if(!t.anchorNode)return!1;try{return Fm(e,t.anchorNode)}catch{return!1}}function Lm(e){return Nm(e)?eh(e,0,e.nodeValue.length).getClientRects():Mm(e)?e.getClientRects():[]}function Rm(e,t,n,r){return n?Vm(e,t,n,r,-1)||Vm(e,t,n,r,1):!1}function zm(e){for(var t=0;;t++)if(e=e.previousSibling,!e)return t}function Bm(e){return Mm(e)&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(e.nodeName)}function Vm(e,t,n,r,i){for(;;){if(e==n&&t==r)return!0;if(t==(i<0?0:Hm(e))){if(e.nodeName==`DIV`)return!1;let n=e.parentNode;if(!n||!Mm(n))return!1;t=zm(e)+(i<0?0:1),e=n}else if(Mm(e)){if(e=e.childNodes[t+(i<0?-1:0)],Mm(e)&&(e.nodeName==`IMG`||e.nodeName==`BR`||e.contentEditable==`false`))return!1;t=i<0?Hm(e):0}else return!1}}function Hm(e){return Nm(e)?e.nodeValue.length:e.childNodes.length}function Um(e,t){let{left:n,right:r}=e;if(n==r)return e;let i=t?n:r;return{left:i,right:i,top:e.top,bottom:e.bottom}}function Wm(e){let t=e.visualViewport;return t?{left:0,right:t.width,top:0,bottom:t.height}:{left:0,right:e.innerWidth,top:0,bottom:e.innerHeight}}function Gm(e,t){let n=t.width/e.offsetWidth,r=t.height/e.offsetHeight;return(n>.995&&n<1.005||!isFinite(n)||Math.abs(t.width-e.offsetWidth)<1)&&(n=1),(r>.995&&r<1.005||!isFinite(r)||Math.abs(t.height-e.offsetHeight)<1)&&(r=1),{scaleX:n,scaleY:r}}function Km(e,t,n,r,i,a,o,s){let c=e.ownerDocument,l=c.defaultView||window;for(let u=e,d=!1;u&&!d;)if(Mm(u)){let e,f=u==c.body,p=1,m=1;if(f)e=Wm(l);else{if(/^(fixed|sticky)$/.test(getComputedStyle(u).position)&&(d=!0),u.scrollHeight<=u.clientHeight&&u.scrollWidth<=u.clientWidth){u=u.assignedSlot||u.parentNode;continue}let t=u.getBoundingClientRect();({scaleX:p,scaleY:m}=Gm(u,t)),e={left:t.left,right:t.left+u.clientWidth*p,top:t.top,bottom:t.top+u.clientHeight*m}}let h=0,g=0;if(i==`nearest`)t.top<e.top+o?(g=t.top-(e.top+o),n>0&&t.bottom>e.bottom+g&&(g=t.bottom-e.bottom+o)):t.bottom>e.bottom-o&&(g=t.bottom-e.bottom+o,n<0&&t.top-g<e.top&&(g=t.top-(e.top+o)));else{let r=t.bottom-t.top,a=e.bottom-e.top;g=(i==`center`&&r<=a?t.top+r/2-a/2:i==`start`||i==`center`&&n<0?t.top-o:t.bottom-a+o)-e.top}if(r==`nearest`?t.left<e.left+a?(h=t.left-(e.left+a),n>0&&t.right>e.right+h&&(h=t.right-e.right+a)):t.right>e.right-a&&(h=t.right-e.right+a,n<0&&t.left<e.left+h&&(h=t.left-(e.left+a))):h=(r==`center`?t.left+(t.right-t.left)/2-(e.right-e.left)/2:r==`start`==s?t.left-a:t.right-(e.right-e.left)+a)-e.left,h||g){if(f)l.scrollBy(h,g);else{let e=0,n=0;if(g){let e=u.scrollTop;u.scrollTop+=g/m,n=(u.scrollTop-e)*m}if(h){let t=u.scrollLeft;u.scrollLeft+=h/p,e=(u.scrollLeft-t)*p}t={left:t.left-e,top:t.top-n,right:t.right-e,bottom:t.bottom-n},e&&Math.abs(e-h)<1&&(r=`nearest`),n&&Math.abs(n-g)<1&&(i=`nearest`)}}if(f)break;(t.top<e.top||t.bottom>e.bottom||t.left<e.left||t.right>e.right)&&(t={left:Math.max(t.left,e.left),right:Math.min(t.right,e.right),top:Math.max(t.top,e.top),bottom:Math.min(t.bottom,e.bottom)}),u=u.assignedSlot||u.parentNode}else if(u.nodeType==11)u=u.host;else break}function qm(e,t=!0){let n=e.ownerDocument,r=null,i=null;for(let a=e.parentNode;a&&!(a==n.body||(!t||r)&&i);)if(Mm(a))!i&&a.scrollHeight>a.clientHeight&&(i=a),t&&!r&&a.scrollWidth>a.clientWidth&&(r=a),a=a.assignedSlot||a.parentNode;else if(a.nodeType==11)a=a.host;else break;return{x:r,y:i}}var Jm=class{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}eq(e){return this.anchorNode==e.anchorNode&&this.anchorOffset==e.anchorOffset&&this.focusNode==e.focusNode&&this.focusOffset==e.focusOffset}setRange(e){let{anchorNode:t,focusNode:n}=e;this.set(t,Math.min(e.anchorOffset,t?Hm(t):0),n,Math.min(e.focusOffset,n?Hm(n):0))}set(e,t,n,r){this.anchorNode=e,this.anchorOffset=t,this.focusNode=n,this.focusOffset=r}};function Ym(e){let t=[];for(let n=e;n;n=n.nodeType==11?n.host:n.parentNode)Mm(n)&&t.push({node:n,left:n.scrollLeft,top:n.scrollTop});return t}function Xm(e,t=!0){for(let{node:n,left:r,top:i}of e)t&&n.scrollTop!=i&&(n.scrollTop=i),n.scrollLeft!=r&&(n.scrollLeft=r)}var Zm=null;K.safari&&K.safari_version>=26&&(Zm=!1);function Qm(e){if(e.setActive)return e.setActive();if(Zm)return e.focus(Zm);let t=Ym(e);e.focus(Zm==null?{get preventScroll(){return Zm={preventScroll:!0},!0}}:void 0),Zm||(Zm=!1,Xm(t))}var $m;function eh(e,t,n=t){let r=$m||=document.createRange();return r.setEnd(e,n),r.setStart(e,t),r}function th(e,t,n,r){let i={key:t,code:t,keyCode:n,which:n,cancelable:!0};r&&({altKey:i.altKey,ctrlKey:i.ctrlKey,shiftKey:i.shiftKey,metaKey:i.metaKey}=r);let a=new KeyboardEvent(`keydown`,i);a.synthetic=!0,e.dispatchEvent(a);let o=new KeyboardEvent(`keyup`,i);return o.synthetic=!0,e.dispatchEvent(o),a.defaultPrevented||o.defaultPrevented}function nh(e){for(;e;){if(e&&(e.nodeType==9||e.nodeType==11&&e.host))return e;e=e.assignedSlot||e.parentNode}return null}function rh(e,t){let n=t.focusNode,r=t.focusOffset;if(!n||t.anchorNode!=n||t.anchorOffset!=r)return!1;for(r=Math.min(r,Hm(n));;)if(r){if(!Mm(n))return!1;let e=n.childNodes[r-1];e.contentEditable==`false`?r--:(n=e,r=Hm(n))}else if(n==e)return!0;else r=zm(n),n=n.parentNode}function ih(e){return e instanceof Window?e.pageYOffset>Math.max(0,e.document.documentElement.scrollHeight-e.innerHeight-4):e.scrollTop>Math.max(1,e.scrollHeight-e.clientHeight-4)}function ah(e,t){for(let n=e,r=t;;)if(Nm(n)&&r>0)return{node:n,offset:r};else if(Mm(n)&&r>0){if(n.contentEditable==`false`)return null;n=n.childNodes[r-1],r=Hm(n)}else if(n.parentNode&&!Bm(n))r=zm(n),n=n.parentNode;else return null}function oh(e,t){for(let n=e,r=t;;)if(Nm(n)&&r<n.nodeValue.length)return{node:n,offset:r};else if(Mm(n)&&r<n.childNodes.length){if(n.contentEditable==`false`)return null;n=n.childNodes[r],r=0}else if(n.parentNode&&!Bm(n))r=zm(n)+1,n=n.parentNode;else return null}var sh=class e{constructor(e,t,n=!0){this.node=e,this.offset=t,this.precise=n}static before(t,n){return new e(t.parentNode,zm(t),n)}static after(t,n){return new e(t.parentNode,zm(t)+1,n)}},ch=(function(e){return e[e.LTR=0]=`LTR`,e[e.RTL=1]=`RTL`,e})(ch||={}),lh=ch.LTR,uh=ch.RTL;function dh(e){let t=[];for(let n=0;n<e.length;n++)t.push(1<<e[n]);return t}var fh=dh(`88888888888888888888888888888888888666888888787833333333337888888000000000000000000000000008888880000000000000000000000000088888888888888888888888888888888888887866668888088888663380888308888800000000000000000000000800000000000000000000000000000008`),ph=dh(`4444448826627288999999999992222222222222222222222222222222222222222222222229999999999999999999994444444444644222822222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222999999949999999229989999223333333333`),mh=Object.create(null),hh=[];for(let e of[`()`,`[]`,`{}`]){let t=e.charCodeAt(0),n=e.charCodeAt(1);mh[t]=n,mh[n]=-t}function gh(e){return e<=247?fh[e]:1424<=e&&e<=1524?2:1536<=e&&e<=1785?ph[e-1536]:1774<=e&&e<=2220?4:8192<=e&&e<=8204?256:64336<=e&&e<=65023?4:1}var _h=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac\ufb50-\ufdff]/,vh=class{get dir(){return this.level%2?uh:lh}constructor(e,t,n){this.from=e,this.to=t,this.level=n}side(e,t){return this.dir==t==e?this.to:this.from}forward(e,t){return e==(this.dir==t)}static find(e,t,n,r){let i=-1;for(let a=0;a<e.length;a++){let o=e[a];if(o.from<=t&&o.to>=t){if(o.level==n)return a;(i<0||(r==0?e[i].level>o.level:r<0?o.from<t:o.to>t))&&(i=a)}}if(i<0)throw RangeError(`Index out of range`);return i}};function yh(e,t){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++){let r=e[n],i=t[n];if(r.from!=i.from||r.to!=i.to||r.direction!=i.direction||!yh(r.inner,i.inner))return!1}return!0}var bh=[];function xh(e,t,n,r,i){for(let a=0;a<=r.length;a++){let o=a?r[a-1].to:t,s=a<r.length?r[a].from:n,c=a?256:i;for(let t=o,n=c,r=c;t<s;t++){let i=gh(e.charCodeAt(t));i==512?i=n:i==8&&r==4&&(i=16),bh[t]=i==4?2:i,i&7&&(r=i),n=i}for(let e=o,t=c,r=c;e<s;e++){let i=bh[e];if(i==128)e<s-1&&t==bh[e+1]&&t&24?i=bh[e]=t:bh[e]=256;else if(i==64){let i=e+1;for(;i<s&&bh[i]==64;)i++;let a=e&&t==8||i<n&&bh[i]==8?r==1?1:8:256;for(let t=e;t<i;t++)bh[t]=a;e=i-1}else i==8&&r==1&&(bh[e]=1);t=i,i&7&&(r=i)}}}function Sh(e,t,n,r,i){let a=i==1?2:1;for(let o=0,s=0,c=0;o<=r.length;o++){let l=o?r[o-1].to:t,u=o<r.length?r[o].from:n;for(let t=l,n,r,o;t<u;t++)if(r=mh[n=e.charCodeAt(t)]){if(r<0){for(let e=s-3;e>=0;e-=3)if(hh[e+1]==-r){let n=hh[e+2],r=n&2?i:n&4?n&1?a:i:0;r&&(bh[t]=bh[hh[e]]=r),s=e;break}}else if(hh.length==189)break;else hh[s++]=t,hh[s++]=n,hh[s++]=c}else if((o=bh[t])==2||o==1){let e=o==i;c=+!e;for(let t=s-3;t>=0;t-=3){let n=hh[t+2];if(n&2)break;if(e)hh[t+2]|=2;else{if(n&4)break;hh[t+2]|=4}}}}}function Ch(e,t,n,r){for(let i=0,a=r;i<=n.length;i++){let o=i?n[i-1].to:e,s=i<n.length?n[i].from:t;for(let c=o;c<s;){let o=bh[c];if(o==256){let o=c+1;for(;;)if(o==s){if(i==n.length)break;o=n[i++].to,s=i<n.length?n[i].from:t}else if(bh[o]==256)o++;else break;let l=a==1,u=l==((o<t?bh[o]:r)==1)?l?1:2:r;for(let t=o,r=i,a=r?n[r-1].to:e;t>c;)t==a&&(t=n[--r].from,a=r?n[r-1].to:e),bh[--t]=u;c=o}else a=o,c++}}}function wh(e,t,n,r,i,a,o){let s=r%2?2:1;if(r%2==i%2)for(let c=t,l=0;c<n;){let t=!0,u=!1;if(l==a.length||c<a[l].from){let e=bh[c];e!=s&&(t=!1,u=e==16)}let d=!t&&s==1?[]:null,f=t?r:r+1,p=c;run:for(;;)if(l<a.length&&p==a[l].from){if(u)break run;let m=a[l];if(!t)for(let e=m.to,t=l+1;;){if(e==n)break run;if(t<a.length&&a[t].from==e)e=a[t++].to;else if(bh[e]==s)break run;else break}l++,d?d.push(m):(m.from>c&&o.push(new vh(c,m.from,f)),Th(e,m.direction==lh==!(f%2)?r:r+1,i,m.inner,m.from,m.to,o),c=m.to),p=m.to}else if(p==n||(t?bh[p]!=s:bh[p]==s))break;else p++;d?wh(e,c,p,r+1,i,d,o):c<p&&o.push(new vh(c,p,f)),c=p}else for(let c=n,l=a.length;c>t;){let n=!0,u=!1;if(!l||c>a[l-1].to){let e=bh[c-1];e!=s&&(n=!1,u=e==16)}let d=!n&&s==1?[]:null,f=n?r:r+1,p=c;run:for(;;)if(l&&p==a[l-1].to){if(u)break run;let m=a[--l];if(!n)for(let e=m.from,n=l;;){if(e==t)break run;if(n&&a[n-1].to==e)e=a[--n].from;else if(bh[e-1]==s)break run;else break}d?d.push(m):(m.to<c&&o.push(new vh(m.to,c,f)),Th(e,m.direction==lh==!(f%2)?r:r+1,i,m.inner,m.from,m.to,o),c=m.from),p=m.from}else if(p==t||(n?bh[p-1]!=s:bh[p-1]==s))break;else p--;d?wh(e,p,c,r+1,i,d,o):p<c&&o.push(new vh(p,c,f)),c=p}}function Th(e,t,n,r,i,a,o){let s=t%2?2:1;xh(e,i,a,r,s),Sh(e,i,a,r,s),Ch(i,a,r,s),wh(e,i,a,t,n,r,o)}function Eh(e,t,n){if(!e)return[new vh(0,0,+(t==uh))];if(t==lh&&!n.length&&!_h.test(e))return Dh(e.length);if(n.length)for(;e.length>bh.length;)bh[bh.length]=256;let r=[],i=t==lh?0:1;return Th(e,i,i,n,0,e.length,r),r}function Dh(e){return[new vh(0,e,0)]}var Oh=``;function kh(e,t,n,r,i){if(!e.length)return null;let a=r.head-e.from,o;if(r.head==e.from&&r.assoc<0){if(!i)return null;a=t[o=0].side(!1,n)}else if(r.head==e.to&&r.assoc>0){if(i)return null;a=t[o=t.length-1].side(!0,n)}else o=vh.find(t,a,r.bidiLevel??-1,r.assoc);let s=t[o],c=s.side(i,n);if(a==c){let e=o+=i?1:-1;if(e<0||e>=t.length)return null;s=t[o=e],a=s.side(!i,n),c=s.side(i,n)}let l=pf(e.text,a,s.forward(i,n));(l<s.from||l>s.to)&&(l=c),Oh=e.text.slice(Math.min(a,l),Math.max(a,l));let u=o==(i?t.length-1:0)?null:t[o+(i?1:-1)];if(l==c){if(!u)return i?W.cursor(e.to,1):W.cursor(e.from,-1);if(u.level+ +!i<s.level)return W.cursor(u.side(!i,n)+e.from,u.forward(i,n)?1:-1,u.level)}return W.cursor(l+e.from,s.forward(i,n)?-1:1,s.level)}function Ah(e,t,n){for(let r=t;r<n;r++){let t=gh(e.charCodeAt(r));if(t==1)return lh;if(t==2||t==4)return uh}return lh}var jh=G.define(),Mh=G.define(),Nh=G.define(),Ph=G.define(),Fh=G.define(),Ih=G.define(),Lh=G.define(),Rh=G.define(),zh=G.define(),Bh=G.define({combine:e=>e.some(e=>e)}),Vh=G.define({combine:e=>e.some(e=>e)}),Hh=G.define(),Uh=class e{constructor(e,t,n,r,i,a=!1){this.range=e,this.y=t,this.x=n,this.yMargin=r,this.xMargin=i,this.isSnapshot=a}map(t){return t.empty?this:new e(this.range.map(t),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}clip(t){return this.range.to<=t.doc.length?this:new e(W.cursor(t.doc.length),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}},Wh=ap.define({map:(e,t)=>e.map(t)}),Gh=ap.define();function Kh(e,t,n){let r=e.facet(Ph);r.length?r[0](t):window.onerror&&window.onerror(String(t),n,void 0,void 0,t)||(n?console.error(n+`:`,t):console.error(t))}var qh=G.define({combine:e=>!e.length||e[0]}),Jh=0,Yh=G.define({combine(e){return e.filter((t,n)=>{for(let r=0;r<n;r++)if(e[r].plugin==t.plugin)return!1;return!0})}}),Xh=class e{constructor(e,t,n,r,i){this.id=e,this.create=t,this.domEventHandlers=n,this.domEventObservers=r,this.baseExtensions=i(this),this.extension=this.baseExtensions.concat(Yh.of({plugin:this,arg:void 0}))}of(e){return this.baseExtensions.concat(Yh.of({plugin:this,arg:e}))}static define(t,n){let{eventHandlers:r,eventObservers:i,provide:a,decorations:o}=n||{};return new e(Jh++,t,r,i,e=>{let t=[];return o&&t.push(eg.of(t=>{let n=t.plugin(e);return n?o(n):wm.none})),a&&t.push(a(e)),t})}static fromClass(t,n){return e.define((e,n)=>new t(e,n),n)}},Zh=class{constructor(e){this.spec=e,this.mustUpdate=null,this.value=null}get plugin(){return this.spec&&this.spec.plugin}update(e){if(!this.value){if(this.spec)try{this.value=this.spec.plugin.create(e,this.spec.arg)}catch(t){Kh(e.state,t,`CodeMirror plugin crashed`),this.deactivate()}}else if(this.mustUpdate){let e=this.mustUpdate;if(this.mustUpdate=null,this.value.update)try{this.value.update(e)}catch(t){if(Kh(e.state,t,`CodeMirror plugin crashed`),this.value.destroy)try{this.value.destroy()}catch{}this.deactivate()}}return this}destroy(e){if(this.value?.destroy)try{this.value.destroy()}catch(t){Kh(e.state,t,`CodeMirror plugin crashed`)}}deactivate(){this.spec=this.value=null}},Qh=G.define(),$h=G.define(),eg=G.define(),tg=G.define(),ng=G.define(),rg=G.define(),ig=G.define();function ag(e,t){let n=e.state.facet(ig);if(!n.length)return n;let r=n.map(t=>t instanceof Function?t(e):t),i=[];return Dp.spans(r,t.from,t.to,{point(){},span(e,n,r,a){let o=e-t.from,s=n-t.from,c=i;for(let e=r.length-1;e>=0;e--,a--){let n=r[e].spec.bidiIsolate,i;if(n??=Ah(t.text,o,s),a>0&&c.length&&(i=c[c.length-1]).to==o&&i.direction==n)i.to=s,c=i.inner;else{let e={from:o,to:s,direction:n,inner:[]};c.push(e),c=e.inner}}}}),i}var og=G.define();function sg(e){let t=0,n=0,r=0,i=0;for(let a of e.state.facet(og)){let o=a(e);o&&(o.left!=null&&(t=Math.max(t,o.left)),o.right!=null&&(n=Math.max(n,o.right)),o.top!=null&&(r=Math.max(r,o.top)),o.bottom!=null&&(i=Math.max(i,o.bottom)))}return{left:t,right:n,top:r,bottom:i}}var cg=G.define(),lg=class e{constructor(e,t,n,r){this.fromA=e,this.toA=t,this.fromB=n,this.toB=r}join(t){return new e(Math.min(this.fromA,t.fromA),Math.max(this.toA,t.toA),Math.min(this.fromB,t.fromB),Math.max(this.toB,t.toB))}addToSet(e){let t=e.length,n=this;for(;t>0;t--){let r=e[t-1];if(!(r.fromA>n.toA)){if(r.toA<n.fromA)break;n=n.join(r),e.splice(t-1,1)}}return e.splice(t,0,n),e}static extendWithRanges(t,n){if(n.length==0)return t;let r=[];for(let i=0,a=0,o=0;;){let s=i<t.length?t[i].fromB:1e9,c=a<n.length?n[a]:1e9,l=Math.min(s,c);if(l==1e9)break;let u=l+o,d=l,f=u;for(;;)if(a<n.length&&n[a]<=d){let e=n[a+1];a+=2,d=Math.max(d,e);for(let e=i;e<t.length&&t[e].fromB<=d;e++)o=t[e].toA-t[e].toB;f=Math.max(f,e+o)}else if(i<t.length&&t[i].fromB<=d){let e=t[i++];d=Math.max(d,e.toB),f=Math.max(f,e.toA),o=e.toA-e.toB}else break;r.push(new e(u,f,l,d))}return r}},ug=class e{constructor(e,t,n){this.view=e,this.state=t,this.transactions=n,this.flags=0,this.startState=e.state,this.changes=Sf.empty(this.startState.doc.length);for(let e of n)this.changes=this.changes.compose(e.changes);let r=[];this.changes.iterChangedRanges((e,t,n,i)=>r.push(new lg(e,t,n,i))),this.changedRanges=r}static create(t,n,r){return new e(t,n,r)}get viewportChanged(){return(this.flags&4)>0}get viewportMoved(){return(this.flags&8)>0}get heightChanged(){return(this.flags&2)>0}get geometryChanged(){return this.docChanged||(this.flags&18)>0}get focusChanged(){return(this.flags&1)>0}get docChanged(){return!this.changes.empty}get selectionSet(){return this.transactions.some(e=>e.selection)}get empty(){return this.flags==0&&this.transactions.length==0}},dg=[],fg=class{constructor(e,t,n=0){this.dom=e,this.length=t,this.flags=n,this.parent=null,e.cmTile=this}get breakAfter(){return this.flags&1}get children(){return dg}isWidget(){return!1}get isHidden(){return!1}isComposite(){return!1}isLine(){return!1}isText(){return!1}isBlock(){return!1}get domAttrs(){return null}sync(e){if(this.flags|=2,this.flags&4){this.flags&=-5;let e=this.domAttrs;e&&ym(this.dom,e)}}toString(){return this.constructor.name+(this.children.length?`(${this.children})`:``)+(this.breakAfter?`#`:``)}destroy(){this.parent=null}setDOM(e){this.dom=e,e.cmTile=this}get posAtStart(){return this.parent?this.parent.posBefore(this):0}get posAtEnd(){return this.posAtStart+this.length}posBefore(e,t=this.posAtStart){let n=t;for(let t of this.children){if(t==e)return n;n+=t.length+t.breakAfter}throw RangeError(`Invalid child in posBefore`)}posAfter(e){return this.posBefore(e)+e.length}covers(e){return!0}coordsIn(e,t,n){return null}domPosFor(e,t){let n=zm(this.dom),r=this.length?e>0:t>0;return new sh(this.parent.dom,n+ +!!r,e==0||e==this.length)}markDirty(e){this.flags&=-3,e&&(this.flags|=4),this.parent&&this.parent.flags&2&&this.parent.markDirty(!1)}get overrideDOMText(){return null}get root(){for(let e=this;e;e=e.parent)if(e instanceof hg)return e;return null}static get(e){return e.cmTile}},pg=class extends fg{constructor(e){super(e,0),this._children=[]}isComposite(){return!0}get children(){return this._children}get lastChild(){return this.children.length?this.children[this.children.length-1]:null}append(e){this.children.push(e),e.parent=this}sync(e){if(this.flags&2)return;super.sync(e);let t=this.dom,n=null,r,i=e?.node==t?e:null,a=0;for(let o of this.children){if(o.sync(e),a+=o.length+o.breakAfter,r=n?n.nextSibling:t.firstChild,i&&r!=o.dom&&(i.written=!0),o.dom.parentNode==t)for(;r&&r!=o.dom;)r=mg(r);else t.insertBefore(o.dom,r);n=o.dom}for(r=n?n.nextSibling:t.firstChild,i&&r&&(i.written=!0);r;)r=mg(r);this.length=a}};function mg(e){let t=e.nextSibling;return e.parentNode.removeChild(e),t}var hg=class extends pg{constructor(e,t){super(t),this.view=e}owns(e){for(;e;e=e.parent)if(e==this)return!0;return!1}isBlock(){return!0}nearest(e){for(;;){if(!e)return null;let t=fg.get(e);if(t&&this.owns(t))return t;e=e.parentNode}}blockTiles(e){for(let t=[],n=this,r=0,i=0;;)if(r==n.children.length){if(!t.length)return;n=n.parent,n.breakAfter&&i++,r=t.pop()}else{let a=n.children[r++];if(a instanceof gg)t.push(r),n=a,r=0;else{let t=i+a.length,n=e(a,i);if(n!==void 0)return n;i=t+a.breakAfter}}}resolveBlock(e,t){let n,r=-1,i,a=-1;if(this.blockTiles((o,s)=>{let c=s+o.length;if(e>=s&&e<=c){if(o.isWidget()&&t>=-1&&t<=1){if(o.flags&32)return!0;o.flags&16&&(n=void 0)}(s<e||e==c&&(t<-1?o.length:o.covers(1)))&&(!n||!o.isWidget()&&n.isWidget())&&(n=o,r=e-s),(c>e||e==s&&(t>1?o.length:o.covers(-1)))&&(!i||!o.isWidget()&&i.isWidget())&&(i=o,a=e-s)}}),!n&&!i)throw Error(`No tile at position `+e);return n&&t<0||!i?{tile:n,offset:r}:{tile:i,offset:a}}},gg=class e extends pg{constructor(e,t){super(e),this.wrapper=t}isBlock(){return!0}covers(e){return this.children.length?e<0?this.children[0].covers(-1):this.lastChild.covers(1):!1}get domAttrs(){return this.wrapper.attributes}static of(t,n){let r=new e(n||document.createElement(t.tagName),t);return n||(r.flags|=4),r}},_g=class e extends pg{constructor(e,t){super(e),this.attrs=t}isLine(){return!0}static start(t,n,r){let i=new e(n||document.createElement(`div`),t);return(!n||!r)&&(i.flags|=4),i}get domAttrs(){return this.attrs}resolveInline(e,t,n=!1){let r=null,i=-1,a=null,o=-1;function s(e,c){for(let l=0,u=0;l<e.children.length&&u<=c;l++){let d=e.children[l],f=u+d.length;f>=c&&(d.isComposite()?s(d,c-u):(!a||n&&a.isHidden&&(t>0&&!(a.flags&32)||n&&yg(a,d)))&&(f>c||d.flags&32&&t<=1)?(a=d,o=c-u):(u<c||d.flags&16&&!(n&&d.isHidden)&&t>=-1)&&(r=d,i=c-u)),u=f}}s(this,e);let c=(t<0?r:a)||r||a;return c?{tile:c,offset:c==r?i:o}:null}coordsIn(e,t,n){let r=this.resolveInline(e,t,!0);return r?r.tile.coordsIn(Math.max(0,r.offset),t,n):vg(this)}domIn(e,t){let n=this.resolveInline(e,t);if(n){let{tile:e,offset:r}=n;if(this.dom.contains(e.dom))return e.isText()?new sh(e.dom,Math.min(e.dom.nodeValue.length,r)):e.domPosFor(r,e.flags&16?1:e.flags&32?-1:t);let i=n.tile.parent,a=!1;for(let e of i.children){if(a)return new sh(e.dom,0);e==n.tile&&(a=!0)}}return new sh(this.dom,0)}};function vg(e){let t=e.dom.lastChild;if(!t)return e.dom.getBoundingClientRect();let n=Lm(t);return n[n.length-1]||null}function yg(e,t){let n=e.coordsIn(0,1),r=t.coordsIn(0,1);return n&&r&&r.top<n.bottom}var bg=class e extends pg{constructor(e,t){super(e),this.mark=t}get domAttrs(){return this.mark.attrs}static of(t,n){let r=new e(n||document.createElement(t.tagName),t);return n||(r.flags|=4),r}},xg=class e extends fg{constructor(e,t){super(e,t.length),this.text=t}sync(e){this.flags&2||(super.sync(e),this.dom.nodeValue!=this.text&&(e&&e.node==this.dom&&(e.written=!0),this.dom.nodeValue=this.text))}isText(){return!0}toString(){return JSON.stringify(this.text)}coordsIn(e,t,n){let r=this.dom.nodeValue.length;e>r&&(e=r);let i=e,a=e,o=0;e==0&&t<0||e==r&&t>=0?K.chrome||K.gecko||(e?(i--,o=1):a<r&&(a++,o=-1)):t<0?i--:a<r&&a++;let s=eh(this.dom,i,a).getClientRects();if(!s.length)return null;let c=s[(o?o<0:t>=0)?0:s.length-1];return K.safari&&!o&&c.width==0&&(c=Array.prototype.find.call(s,e=>e.width)||c),n==null?c:Um(c,(o?o>0:t<0)==n)}static of(t,n){let r=new e(n||document.createTextNode(t),t);return n||(r.flags|=2),r}},Sg=class e extends fg{constructor(e,t,n,r){super(e,t,r),this.widget=n}isWidget(){return!0}get isHidden(){return this.widget.isHidden}covers(e){return this.flags&48?!1:(this.flags&(e<0?64:128))>0}coordsIn(e,t){return this.coordsInWidget(e,t,!1)}coordsInWidget(e,t,n){let r=this.widget.coordsAt(this.dom,e,t);if(r)return r;if(n)return Um(this.dom.getBoundingClientRect(),this.length?e==0:t<=0);{let t=this.dom.getClientRects(),n=null;if(!t.length)return null;let r=this.flags&16?!0:this.flags&32?!1:e>0;for(let i=r?t.length-1:0;n=t[i],!(e>0?i==0:i==t.length-1||n.top<n.bottom);i+=r?-1:1);return Um(n,!r)}}get overrideDOMText(){if(!this.length)return tf.empty;let{root:e}=this;if(!e)return tf.empty;let t=this.posAtStart;return e.view.state.doc.slice(t,t+this.length)}destroy(){super.destroy(),this.widget.destroy(this.dom)}static of(t,n,r,i,a){return a||(a=t.toDOM(n),t.editable||(a.contentEditable=`false`)),new e(a,r,t,i)}},Cg=class extends fg{constructor(e){let t=document.createElement(`img`);t.className=`cm-widgetBuffer`,t.setAttribute(`aria-hidden`,`true`),super(t,0,e)}get isHidden(){return!0}get overrideDOMText(){return tf.empty}coordsIn(e,t,n){let r=this.dom.getBoundingClientRect();return n==null?r:Um(r,t>0==n)}},wg=class{constructor(e){this.index=0,this.beforeBreak=!1,this.parents=[],this.tile=e}advance(e,t,n){let{tile:r,index:i,beforeBreak:a,parents:o}=this;for(;e||t>0;)if(!r.isComposite()){let t=r.length;if(i<t&&e){let a=Math.min(e,t-i);n&&n.skip(r,i,i+a),e-=a,i+=a}if(i==t)a=!!r.breakAfter,{tile:r,index:i}=o.pop(),i++;else if(!e)break}else if(a){if(!e)break;n&&n.break(),e--,a=!1}else if(i==r.children.length){if(!e&&!o.length)break;n&&n.leave(r),a=!!r.breakAfter,{tile:r,index:i}=o.pop(),i++}else{let s=r.children[i],c=s.breakAfter;(t>0?s.length<=e:s.length<e)&&(!n||n.skip(s,0,s.length)!==!1||!s.isComposite)?(a=!!c,i++,e-=s.length):(o.push({tile:r,index:i}),r=s,i=0,n&&s.isComposite()&&n.enter(s))}return this.tile=r,this.index=i,this.beforeBreak=a,this}get root(){return this.parents.length?this.parents[0].tile:this.tile}},Tg=class{constructor(e,t,n,r){this.from=e,this.to=t,this.wrapper=n,this.rank=r}},Eg=class{constructor(e,t,n){this.cache=e,this.root=t,this.blockWrappers=n,this.curLine=null,this.lastBlock=null,this.afterWidget=null,this.pos=0,this.wrappers=[],this.wrapperPos=0}addText(e,t,n,r){this.flushBuffer();let i=this.ensureMarks(t,n),a=i.lastChild;if(a&&a.isText()&&!(a.flags&8)&&a.length+e.length<512){this.cache.reused.set(a,2);let t=i.children[i.children.length-1]=new xg(a.dom,a.text+e);t.parent=i}else i.append(r||xg.of(e,this.cache.find(xg)?.dom));this.pos+=e.length,this.afterWidget=null}addComposition(e,t){let n=this.curLine;n.dom!=t.line.dom&&(n.setDOM(this.cache.reused.has(t.line)?Ig(t.line.dom):t.line.dom),this.cache.reused.set(t.line,2));let r=n;for(let e=t.marks.length-1;e>=0;e--){let n=t.marks[e],i=r.lastChild;if(i instanceof bg&&i.mark.eq(n.mark))i.dom!=n.dom&&i.setDOM(Ig(n.dom)),r=i;else{let{dom:e}=n;this.cache.reused.get(n)&&fg.get(n.dom)&&(e=Ig(n.dom));let t=bg.of(n.mark,e);r.append(t),r=t}this.cache.reused.set(n,2)}let i=fg.get(e.text);i&&this.cache.reused.set(i,2);let a=new xg(e.text,e.text.nodeValue);a.flags|=8,this.pos=e.range.toB,r.append(a)}addInlineWidget(e,t,n){let r=this.afterWidget&&e.flags&48&&(this.afterWidget.flags&48)==(e.flags&48);r||this.flushBuffer();let i=this.ensureMarks(t,n);!r&&!(e.flags&16)&&i.append(this.getBuffer(1)),i.append(e),this.pos+=e.length,this.afterWidget=e}addMark(e,t,n){this.flushBuffer(),this.ensureMarks(t,n).append(e),this.pos+=e.length,this.afterWidget=null}addBlockWidget(e){this.getBlockPos().append(e),this.pos+=e.length,this.lastBlock=e,this.endLine()}continueWidget(e){let t=this.afterWidget||this.lastBlock;t.length+=e,this.pos+=e}addLineStart(e,t){e||=Ng;let n=_g.start(e,t||this.cache.find(_g)?.dom,!!t);this.getBlockPos().append(this.lastBlock=this.curLine=n)}addLine(e){this.getBlockPos().append(e),this.pos+=e.length,this.lastBlock=e,this.endLine()}addBreak(){this.lastBlock.flags|=1,this.endLine(),this.pos++}addLineStartIfNotCovered(e){this.blockPosCovered()||this.addLineStart(e)}ensureLine(e){this.curLine||this.addLineStart(e)}ensureMarks(e,t){let n=this.curLine;for(let r=e.length-1;r>=0;r--){let i=e[r],a;if(t>0&&(a=n.lastChild)&&a instanceof bg&&a.mark.eq(i))n=a,t--;else{let e=bg.of(i,this.cache.find(bg,e=>e.mark.eq(i))?.dom);n.append(e),n=e,t=0}}return n}endLine(){if(this.curLine){this.flushBuffer();let e=this.curLine.lastChild;(!e||!jg(this.curLine,!1)||e.dom.nodeName!=`BR`&&e.isWidget()&&!(K.ios&&jg(this.curLine,!0)))&&this.curLine.append(this.cache.findWidget(Rg,0,32)||new Sg(Rg.toDOM(),0,Rg,32)),this.curLine=this.afterWidget=null}}updateBlockWrappers(){this.wrapperPos>this.pos+1e4&&(this.blockWrappers.goto(this.pos),this.wrappers.length=0);for(let e=this.wrappers.length-1;e>=0;e--)this.wrappers[e].to<this.pos&&this.wrappers.splice(e,1);for(let e=this.blockWrappers;e.value&&e.from<=this.pos;e.next())if(e.to>=this.pos){let t=e.rank*102+e.value.rank,n=new Tg(e.from,e.to,e.value,t),r=this.wrappers.length;for(;r>0&&(this.wrappers[r-1].rank-n.rank||this.wrappers[r-1].to-n.to)<0;)r--;this.wrappers.splice(r,0,n)}this.wrapperPos=this.pos}getBlockPos(){this.updateBlockWrappers();let e=this.root;for(let t of this.wrappers){let n=e.lastChild;if(t.from<this.pos&&n instanceof gg&&n.wrapper.eq(t.wrapper))e=n;else{let n=gg.of(t.wrapper,this.cache.find(gg,e=>e.wrapper.eq(t.wrapper))?.dom);e.append(n),e=n}}return e}blockPosCovered(){let e=this.lastBlock;return e!=null&&!e.breakAfter&&(!e.isWidget()||(e.flags&160)>0)}getBuffer(e){let t=2|(e<0?16:32),n=this.cache.find(Cg,void 0,1);return n&&(n.flags=t),n||new Cg(t)}flushBuffer(){this.afterWidget&&!(this.afterWidget.flags&32)&&(this.afterWidget.parent.append(this.getBuffer(-1)),this.afterWidget=null)}},Dg=class{constructor(e){this.skipCount=0,this.text=``,this.textOff=0,this.cursor=e.iter()}skip(e){this.textOff+e<=this.text.length?this.textOff+=e:(this.skipCount+=e-(this.text.length-this.textOff),this.text=``,this.textOff=0)}next(e){if(this.textOff==this.text.length){let{value:t,lineBreak:n,done:r}=this.cursor.next(this.skipCount);if(this.skipCount=0,r)throw Error(`Ran out of text content when drawing inline views`);this.text=t;let i=this.textOff=Math.min(e,t.length);return n?null:t.slice(0,i)}let t=Math.min(this.text.length,this.textOff+e),n=this.text.slice(this.textOff,t);return this.textOff=t,n}},Og=[Sg,_g,xg,bg,Cg,gg,hg];for(let e=0;e<Og.length;e++)Og[e].bucket=e;var kg=class{constructor(e){this.view=e,this.buckets=Og.map(()=>[]),this.index=Og.map(()=>0),this.reused=new Map}add(e){let t=e.constructor.bucket,n=this.buckets[t];n.length<6?n.push(e):n[this.index[t]=(this.index[t]+1)%6]=e}find(e,t,n=2){let r=e.bucket,i=this.buckets[r],a=this.index[r];for(let e=0;e<i.length;e++){let o=(e+a)%i.length,s=i[o];if((!t||t(s))&&!this.reused.has(s))return i.splice(o,1),o<a&&this.index[r]--,this.reused.set(s,n),s}return null}findWidget(e,t,n){let r=this.buckets[0];if(r.length)for(let i=0,a=0;;i++){if(i==r.length){if(a)return null;a=1,i=0}let o=r[i];if(!this.reused.has(o)&&(a==0?o.widget.compare(e):o.widget.constructor==e.constructor&&e.updateDOM(o.dom,this.view,o.widget)))return r.splice(i,1),i<this.index[0]&&this.index[0]--,o.widget==e&&o.length==t&&(o.flags&497)==n?(this.reused.set(o,1),o):(this.reused.set(o,2),new Sg(o.dom,t,e,o.flags&-498|n))}}reuse(e){return this.reused.set(e,1),e}maybeReuse(e,t=2){if(!this.reused.has(e))return this.reused.set(e,t),e.dom}clear(){for(let e=0;e<this.buckets.length;e++)this.buckets[e].length=this.index[e]=0}},Ag=class{constructor(e,t,n,r,i){this.view=e,this.decorations=r,this.disallowBlockEffectsFor=i,this.openWidget=!1,this.openMarks=0,this.cache=new kg(e),this.text=new Dg(e.state.doc),this.builder=new Eg(this.cache,new hg(e,e.contentDOM),Dp.iter(n)),this.cache.reused.set(t,2),this.old=new wg(t),this.reuseWalker={skip:(e,t,n)=>{if(this.cache.add(e),e.isComposite())return!1},enter:e=>this.cache.add(e),leave:()=>{},break:()=>{}}}run(e,t){let n=t&&this.getCompositionContext(t.text);for(let r=0,i=0,a=0;;){let o=a<e.length?e[a++]:null,s=o?o.fromA:this.old.root.length;if(s>r){let e=s-r;this.preserve(e,!a,!o),r=s,i+=e}if(!o)break;t&&o.fromA<=t.range.fromA&&o.toA>=t.range.toA?(this.forward(o.fromA,t.range.fromA,t.range.fromA<t.range.toA?1:-1),this.emit(i,t.range.fromB),this.builder.flushBuffer(),this.cache.clear(),this.builder.addComposition(t,n),this.text.skip(t.range.toB-t.range.fromB),this.forward(t.range.fromA,o.toA),this.emit(t.range.toB,o.toB)):(this.forward(o.fromA,o.toA),this.emit(i,o.toB)),i=o.toB,r=o.toA}return this.builder.curLine&&this.builder.endLine(),this.builder.root}preserve(e,t,n){let r=Fg(this.old),i=this.openMarks;this.old.advance(e,n?1:-1,{skip:(e,t,n)=>{if(e.isWidget()){if(this.openWidget)this.builder.continueWidget(n-t);else{let a=n>0||t<e.length?Sg.of(e.widget,this.view,n-t,e.flags&496,this.cache.maybeReuse(e)):this.cache.reuse(e);a.flags&256?(a.flags&=-2,this.builder.addBlockWidget(a)):(this.builder.ensureLine(null),this.builder.addInlineWidget(a,r,i),i=r.length)}}else if(e.isText())this.builder.ensureLine(null),!t&&n==e.length&&!this.cache.reused.has(e)?this.builder.addText(e.text,r,i,this.cache.reuse(e)):(this.cache.add(e),this.builder.addText(e.text.slice(t,n),r,i)),i=r.length;else if(e.isLine())e.flags&=-2,this.cache.reused.set(e,1),this.builder.addLine(e);else if(e instanceof Cg)this.cache.add(e);else if(e instanceof bg)this.builder.ensureLine(null),this.builder.addMark(e,r,i),this.cache.reused.set(e,1),i=r.length;else return!1;this.openWidget=!1},enter:e=>{e.isLine()?this.builder.addLineStart(e.attrs,this.cache.maybeReuse(e)):(this.cache.add(e),e instanceof bg&&r.unshift(e.mark)),this.openWidget=!1},leave:e=>{e.isLine()?r.length&&=i=0:e instanceof bg&&(r.shift(),i=Math.min(i,r.length))},break:()=>{this.builder.addBreak(),this.openWidget=!1}}),this.text.skip(e)}emit(e,t){let n=null,r=this.builder,i=-1,a=Dp.spans(this.decorations,e,t,{point:(e,t,a,o,s,c)=>{if(a instanceof Dm){if(this.disallowBlockEffectsFor[c]){if(a.block)throw RangeError(`Block decorations may not be specified via plugins`);if(t>this.view.state.doc.lineAt(e).to)throw RangeError(`Decorations that replace line breaks may not be specified via plugins`)}if(i=o.length,s>o.length)r.continueWidget(t-e);else{let i=a.widget||(a.block?Lg.block:Lg.inline),c=Mg(a),l=this.cache.findWidget(i,t-e,c)||Sg.of(i,this.view,t-e,c);a.block?(a.startSide>0&&r.addLineStartIfNotCovered(n),r.addBlockWidget(l)):(r.ensureLine(n),r.addInlineWidget(l,o,s))}n=null}else n=Pg(n,a);t>e&&this.text.skip(t-e)},span:(e,t,a,o)=>{for(let i=e;i<t;){let s=this.text.next(Math.min(512,t-i));s==null?(r.addLineStartIfNotCovered(n),r.addBreak(),i++):(r.ensureLine(n),r.addText(s,a,i==e?o:a.length),i+=s.length),n=null}i=a.length}});i>-1&&(this.openWidget=a>i),this.openWidget||r.addLineStartIfNotCovered(n),this.openMarks=a}forward(e,t,n=1){t-e<=10?this.old.advance(t-e,n,this.reuseWalker):(this.old.advance(5,-1,this.reuseWalker),this.old.advance(t-e-10,-1),this.old.advance(5,n,this.reuseWalker))}getCompositionContext(e){let t=[],n=null;for(let r=e.parentNode;;r=r.parentNode){let e=fg.get(r);if(r==this.view.contentDOM)break;e instanceof bg?t.push(e):e?.isLine()?n=e:e instanceof gg||(r.nodeName==`DIV`&&!n?n=new _g(r,Ng):n||t.push(bg.of(new Tm({tagName:r.nodeName.toLowerCase(),attributes:xm(r)}),r)))}return n?{line:n,marks:t}:null}};function jg(e,t){let n=e=>{for(let r of e.children)if((t?r.isText():r.length)||n(r))return!0;return!1};return n(e)}function Mg(e){let t=e.isReplace?(e.startSide<0?64:0)|(e.endSide>0?128:0):e.startSide>0?32:16;return e.block&&(t|=256),t}var Ng={class:`cm-line`};function Pg(e,t){let n=t.spec.attributes,r=t.spec.class;return!n&&!r?e:(e||={class:`cm-line`},n&&gm(n,e),r&&(e.class+=` `+r),e)}function Fg(e){let t=[];for(let n=e.parents.length;n>1;n--){let r=n==e.parents.length?e.tile:e.parents[n].tile;r instanceof bg&&t.push(r.mark)}return t}function Ig(e){let t=fg.get(e);return t&&t.setDOM(e.cloneNode()),e}var Lg=class extends Sm{constructor(e){super(),this.tag=e}eq(e){return e.tag==this.tag}toDOM(){return document.createElement(this.tag)}updateDOM(e){return e.nodeName.toLowerCase()==this.tag}get isHidden(){return!0}};Lg.inline=new Lg(`span`),Lg.block=new Lg(`div`);var Rg=new class extends Sm{toDOM(){return document.createElement(`br`)}get isHidden(){return!0}get editable(){return!0}},zg=class{constructor(e){this.view=e,this.decorations=[],this.blockWrappers=[],this.dynamicDecorationMap=[!1],this.domChanged=null,this.hasComposition=null,this.editContextFormatting=wm.none,this.lastCompositionAfterCursor=!1,this.minWidth=0,this.minWidthFrom=0,this.minWidthTo=0,this.impreciseAnchor=null,this.impreciseHead=null,this.forceSelection=!1,this.lastUpdate=Date.now(),this.updateDeco(),this.tile=new hg(e,e.contentDOM),this.updateInner([new lg(0,0,0,e.state.doc.length)],null)}update(e){let t=e.changedRanges;this.minWidth>0&&t.length&&(t.every(({fromA:e,toA:t})=>t<this.minWidthFrom||e>this.minWidthTo)?(this.minWidthFrom=e.changes.mapPos(this.minWidthFrom,1),this.minWidthTo=e.changes.mapPos(this.minWidthTo,1)):this.minWidth=this.minWidthFrom=this.minWidthTo=0),this.updateEditContextFormatting(e);let n=-1;this.view.inputState.composing>=0&&!this.view.observer.editContext&&(this.domChanged?.newSel?n=this.domChanged.newSel.head:!Xg(e.changes,this.hasComposition)&&!e.selectionSet&&(n=e.state.selection.main.head));let r=n>-1?Ug(this.view,e.changes,n):null;if(this.domChanged=null,this.hasComposition){let{from:n,to:r}=this.hasComposition;t=new lg(n,r,e.changes.mapPos(n,-1),e.changes.mapPos(r,1)).addToSet(t.slice())}this.hasComposition=r?{from:r.range.fromB,to:r.range.toB}:null,(K.ie||K.chrome)&&!r&&e&&e.state.doc.lines!=e.startState.doc.lines&&(this.forceSelection=!0);let i=this.decorations,a=this.blockWrappers;this.updateDeco();let o=Kg(i,this.decorations,e.changes);o.length&&(t=lg.extendWithRanges(t,o));let s=Jg(a,this.blockWrappers,e.changes);return s.length&&(t=lg.extendWithRanges(t,s)),r&&!t.some(e=>e.fromA<=r.range.fromA&&e.toA>=r.range.toA)&&(t=r.range.addToSet(t.slice())),this.tile.flags&2&&t.length==0?!1:(this.updateInner(t,r),e.transactions.length&&(this.lastUpdate=Date.now()),!0)}updateInner(e,t){this.view.viewState.mustMeasureContent=!0;let{observer:n}=this.view;n.ignore(()=>{if(t||e.length){let n=this.tile,r=new Ag(this.view,n,this.blockWrappers,this.decorations,this.dynamicDecorationMap);t&&fg.get(t.text)&&r.cache.reused.set(fg.get(t.text),2),this.tile=r.run(e,t),Bg(n,r.cache.reused)}this.tile.dom.style.height=this.view.viewState.contentHeight/this.view.scaleY+`px`,this.tile.dom.style.flexBasis=this.minWidth?this.minWidth+`px`:``;let r=K.chrome||K.ios?{node:n.selectionRange.focusNode,written:!1}:void 0;this.tile.sync(r),r&&(r.written||n.selectionRange.focusNode!=r.node||!this.tile.dom.contains(r.node))&&(this.forceSelection=!0),this.tile.dom.style.height=``});let r=[];if(this.view.viewport.from||this.view.viewport.to<this.view.state.doc.length)for(let e of this.tile.children)e.isWidget()&&e.widget instanceof Zg&&r.push(e.dom);n.updateGaps(r)}updateEditContextFormatting(e){this.editContextFormatting=this.editContextFormatting.map(e.changes);for(let t of e.transactions)for(let e of t.effects)e.is(Gh)&&(this.editContextFormatting=e.value)}updateSelection(e=!1,t=!1){(e||!this.view.observer.selectionRange.focusNode)&&this.view.observer.readSelectionRange();let{dom:n}=this.tile,r=this.view.root.activeElement,i=r==n,a=!i&&!(this.view.state.facet(qh)||n.tabIndex>-1)&&Im(n,this.view.observer.selectionRange)&&!(r&&n.contains(r));if(!(i||t||a))return;let o=this.forceSelection;this.forceSelection=!1;let s=this.view.state.selection.main,c,l;if(s.empty?l=c=this.inlineDOMNearPos(s.anchor,s.assoc||1):(l=this.inlineDOMNearPos(s.head,s.head==s.from?1:-1),c=this.inlineDOMNearPos(s.anchor,s.anchor==s.from?1:-1)),K.gecko&&s.empty&&!this.hasComposition&&Vg(c)){let e=document.createTextNode(``);this.view.observer.ignore(()=>c.node.insertBefore(e,c.node.childNodes[c.offset]||null)),c=l=new sh(e,0),o=!0}let u=this.view.observer.selectionRange;(o||!u.focusNode||(!Rm(c.node,c.offset,u.anchorNode,u.anchorOffset)||!Rm(l.node,l.offset,u.focusNode,u.focusOffset))&&!this.suppressWidgetCursorChange(u,s))&&(this.view.observer.ignore(()=>{K.android&&K.chrome&&n.contains(u.focusNode)&&Yg(u.focusNode,n)&&(n.blur(),n.focus({preventScroll:!0}));let e=Pm(this.view.root);if(e){if(s.empty){if(K.gecko){let e=Wg(c.node,c.offset);if(e&&e!=3){let t=(e==1?ah:oh)(c.node,c.offset);t&&(c=new sh(t.node,t.offset))}}e.collapse(c.node,c.offset),s.bidiLevel!=null&&e.caretBidiLevel!==void 0&&(e.caretBidiLevel=s.bidiLevel)}else if(e.extend){e.collapse(c.node,c.offset);try{e.extend(l.node,l.offset)}catch{}}else{let t=document.createRange();s.anchor>s.head&&([c,l]=[l,c]),t.setEnd(l.node,l.offset),t.setStart(c.node,c.offset),e.removeAllRanges(),e.addRange(t)}}a&&this.view.root.activeElement==n&&(n.blur(),r&&r.focus())}),this.view.observer.setSelectionRange(c,l)),this.impreciseAnchor=c.precise?null:new sh(u.anchorNode,u.anchorOffset),this.impreciseHead=l.precise?null:new sh(u.focusNode,u.focusOffset)}suppressWidgetCursorChange(e,t){return this.hasComposition&&t.empty&&Rm(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset)&&this.posFromDOM(e.focusNode,e.focusOffset)==t.head}enforceCursorAssoc(){if(this.hasComposition)return;let{view:e}=this,t=e.state.selection.main,n=Pm(e.root),{anchorNode:r,anchorOffset:i}=e.observer.selectionRange;if(!n||!t.empty||!t.assoc||!n.modify)return;let a=this.lineAt(t.head,t.assoc);if(!a)return;let o=a.posAtStart;if(t.head==o||t.head==o+a.length)return;let s=this.coordsAt(t.head,-1),c=this.coordsAt(t.head,1);if(!s||!c||s.bottom>c.top)return;let l=this.domAtPos(t.head+t.assoc,t.assoc);n.collapse(l.node,l.offset),n.modify(`move`,t.assoc<0?`forward`:`backward`,`lineboundary`),e.observer.readSelectionRange();let u=e.observer.selectionRange;e.docView.posFromDOM(u.anchorNode,u.anchorOffset)!=t.from&&n.collapse(r,i)}posFromDOM(e,t){let n=this.tile.nearest(e);if(!n)return this.tile.dom.compareDocumentPosition(e)&2?0:this.view.state.doc.length;let r=n.posAtStart;if(n.isComposite()){let i;if(e==n.dom)i=n.dom.childNodes[t];else{let r=Hm(e)==0?0:t==0?-1:1;for(;;){let t=e.parentNode;if(t==n.dom)break;r==0&&t.firstChild!=t.lastChild&&(r=e==t.firstChild?-1:1),e=t}i=r<0?e:e.nextSibling}if(i==n.dom.firstChild)return r;for(;i&&!fg.get(i);)i=i.nextSibling;if(!i)return r+n.length;for(let e=0,t=r;;e++){let r=n.children[e];if(r.dom==i)return t;t+=r.length+r.breakAfter}}else if(n.isText())return e==n.dom?r+t:r+(t?n.length:0);else return r}domAtPos(e,t){let{tile:n,offset:r}=this.tile.resolveBlock(e,t);return n.isWidget()?n.domPosFor(r,t):n.domIn(r,t)}inlineDOMNearPos(e,t){let n,r=-1,i=!1,a,o=-1,s=!1;return this.tile.blockTiles((t,c)=>{if(t.isWidget()){if(t.flags&32&&c>=e)return!0;t.flags&16&&(i=!0)}else{let l=c+t.length;if(c<=e&&(n=t,r=e-c,i=l<e),l>=e&&!a&&(a=t,o=e-c,s=c>e),c>e&&a)return!0}}),!n&&!a?this.domAtPos(e,t):(i&&a?n=null:s&&n&&(a=null),n&&t<0||!a?n.domIn(r,t):a.domIn(o,t))}coordsAt(e,t,n){let{tile:r,offset:i}=this.tile.resolveBlock(e,t);return r.isWidget()?r.widget instanceof Zg?null:r.coordsInWidget(i,t,!0):r.coordsIn(i,t,n)}lineAt(e,t){let{tile:n}=this.tile.resolveBlock(e,t);return n.isLine()?n:null}coordsForChar(e){let{tile:t,offset:n}=this.tile.resolveBlock(e,1);if(!t.isLine())return null;function r(e,t){if(e.isComposite())for(let n of e.children){if(n.length>=t){let e=r(n,t);if(e)return e}if(t-=n.length,t<0)break}else if(e.isText()&&t<e.length){let n=pf(e.text,t);if(n==t)return null;let r=eh(e.dom,t,n).getClientRects();for(let e=0;e<r.length;e++){let t=r[e];if(e==r.length-1||t.top<t.bottom&&t.left<t.right)return t}}return null}return r(t,n)}measureVisibleLineHeights(e){let t=[],{from:n,to:r}=e,i=this.view.contentDOM.clientWidth,a=i>Math.max(this.view.scrollDOM.clientWidth,this.minWidth)+1,o=-1,s=this.view.textDirection==ch.LTR,c=0,l=(e,u,d)=>{for(let f=0;f<e.children.length&&!(u>r);f++){let r=e.children[f],p=u+r.length,m=r.dom.getBoundingClientRect(),{height:h}=m;if(d&&!f&&(c+=m.top-d.top),r instanceof gg)p>n&&l(r,u,m);else if(u>=n&&(c>0&&t.push(-c),t.push(h+c),c=0,a)){let e=r.dom.lastChild,t=e?Lm(e):[];if(t.length){let e=t[t.length-1],n=s?e.right-m.left:m.right-e.left;n>o&&(o=n,this.minWidth=i,this.minWidthFrom=u,this.minWidthTo=p)}}d&&f==e.children.length-1&&(c+=d.bottom-m.bottom),u=p+r.breakAfter}};return l(this.tile,0,null),t}textDirectionAt(e){let{tile:t}=this.tile.resolveBlock(e,1);return getComputedStyle(t.dom).direction==`rtl`?ch.RTL:ch.LTR}measureTextSize(){let e=this.tile.blockTiles(e=>{if(e.isLine()&&e.children.length&&e.length<=20){let t=0,n;for(let r of e.children){if(!r.isText()||/[^ -~]/.test(r.text))return;let e=Lm(r.dom);if(e.length!=1)return;t+=e[0].width,n=e[0].height}if(t)return{lineHeight:e.dom.getBoundingClientRect().height,charWidth:t/e.length,textHeight:n}}});if(e)return e;let t=document.createElement(`div`),n,r,i;return t.className=`cm-line`,t.style.width=`99999px`,t.style.position=`absolute`,t.textContent=`abc def ghi jkl mno pqr stu`,this.view.observer.ignore(()=>{this.tile.dom.appendChild(t);let e=Lm(t.firstChild)[0];n=t.getBoundingClientRect().height,r=e&&e.width?e.width/27:7,i=e&&e.height?e.height:n,t.remove()}),{lineHeight:n,charWidth:r,textHeight:i}}computeBlockGapDeco(){let e=[],t=this.view.viewState;for(let n=0,r=0;;r++){let i=r==t.viewports.length?null:t.viewports[r],a=i?i.from-1:this.view.state.doc.length;if(a>n){let r=(t.lineBlockAt(a).bottom-t.lineBlockAt(n).top)/this.view.scaleY;e.push(wm.replace({widget:new Zg(r),block:!0,inclusive:!0,isBlockGap:!0}).range(n,a))}if(!i)break;n=i.to+1}return wm.set(e)}updateDeco(){let e=1,t=this.view.state.facet(eg).map(t=>(this.dynamicDecorationMap[e++]=typeof t==`function`)?t(this.view):t),n=!1,r=this.view.state.facet(ng).map((e,t)=>{let r=typeof e==`function`;return r&&(n=!0),r?e(this.view):e});for(r.length&&(this.dynamicDecorationMap[e++]=n,t.push(Dp.join(r))),this.decorations=[this.editContextFormatting,...t,this.computeBlockGapDeco(),this.view.viewState.lineGapDeco];e<this.decorations.length;)this.dynamicDecorationMap[e++]=!1;this.blockWrappers=this.view.state.facet(tg).map(e=>typeof e==`function`?e(this.view):e)}scrollIntoView(e){if(e.isSnapshot){let t=this.view.viewState.lineBlockAt(e.range.head);this.view.scrollDOM.scrollTop=t.top-e.yMargin,this.view.scrollDOM.scrollLeft=e.xMargin;return}for(let t of this.view.state.facet(Hh))try{if(t(this.view,e.range,e))return!0}catch(e){Kh(this.view.state,e,`scroll handler`)}let{range:t}=e,n=this.coordsAt(t.head,t.assoc||(t.head>t.anchor?-1:1)),r;if(!n)return;!t.empty&&(r=this.coordsAt(t.anchor,t.anchor>t.head?-1:1))&&(n={left:Math.min(n.left,r.left),top:Math.min(n.top,r.top),right:Math.max(n.right,r.right),bottom:Math.max(n.bottom,r.bottom)});let i=sg(this.view),a={left:n.left-i.left,top:n.top-i.top,right:n.right+i.right,bottom:n.bottom+i.bottom},{offsetWidth:o,offsetHeight:s}=this.view.scrollDOM;if(Km(this.view.scrollDOM,a,t.head<t.anchor?-1:1,e.x,e.y,Math.max(Math.min(e.xMargin,o),-o),Math.max(Math.min(e.yMargin,s),-s),this.view.textDirection==ch.LTR),window.visualViewport&&window.innerHeight-window.visualViewport.height>1&&(n.top>window.visualViewport.offsetTop+window.visualViewport.height||n.bottom<window.visualViewport.offsetTop)){let e=this.view.docView.lineAt(t.head,1);if(e){let t=Ym(e.dom);e.dom.scrollIntoView({block:`nearest`}),Xm(t,!1)}}}lineHasWidget(e){let t=e=>e.isWidget()||e.children.some(t);return t(this.tile.resolveBlock(e,1).tile)}destroy(){Bg(this.tile)}};function Bg(e,t){let n=t?.get(e);if(n!=1){n??e.destroy();for(let n of e.children)Bg(n,t)}}function Vg(e){return Mm(e.node)&&e.node.firstChild&&(e.offset==0||e.node.childNodes[e.offset-1].contentEditable==`false`)&&(e.offset==e.node.childNodes.length||e.node.childNodes[e.offset].contentEditable==`false`)}function Hg(e,t){let n=e.observer.selectionRange;if(!n.focusNode)return null;let r=ah(n.focusNode,n.focusOffset),i=oh(n.focusNode,n.focusOffset),a=r||i;if(i&&r&&i.node!=r.node){let t=fg.get(i.node);if(!t||t.isText()&&t.text!=i.node.nodeValue)a=i;else if(e.docView.lastCompositionAfterCursor){let e=fg.get(r.node);!e||e.isText()&&e.text!=r.node.nodeValue||(a=i)}}if(e.docView.lastCompositionAfterCursor=a!=r,!a)return null;let o=t-a.offset;return{from:o,to:o+a.node.nodeValue.length,node:a.node}}function Ug(e,t,n){let r=Hg(e,n);if(!r)return null;let{node:i,from:a,to:o}=r,s=i.nodeValue;if(/[\n\r]/.test(s)||e.state.doc.sliceString(r.from,r.to)!=s)return null;let c=t.invertedDesc;return{range:new lg(c.mapPos(a),c.mapPos(o),a,o),text:i}}function Wg(e,t){return Mm(e)?(t&&e.childNodes[t-1].contentEditable==`false`?1:0)|(t<e.childNodes.length&&e.childNodes[t].contentEditable==`false`?2:0):0}var Gg=class{constructor(){this.changes=[]}compareRange(e,t){Am(e,t,this.changes)}comparePoint(e,t){Am(e,t,this.changes)}boundChange(e){Am(e,e,this.changes)}};function Kg(e,t,n){let r=new Gg;return Dp.compare(e,t,n,r),r.changes}var qg=class{constructor(){this.changes=[]}compareRange(e,t){Am(e,t,this.changes)}comparePoint(){}boundChange(e){Am(e,e,this.changes)}};function Jg(e,t,n){let r=new qg;return Dp.compare(e,t,n,r),r.changes}function Yg(e,t){for(let n=e;n&&n!=t;n=n.assignedSlot||n.parentNode)if(Mm(n)&&n.contentEditable==`false`)return!0;return!1}function Xg(e,t){let n=!1;return t&&e.iterChangedRanges((e,r)=>{e<t.to&&r>t.from&&(n=!0)}),n}var Zg=class extends Sm{constructor(e){super(),this.height=e}toDOM(){let e=document.createElement(`div`);return e.className=`cm-gap`,this.updateDOM(e),e}eq(e){return e.height==this.height}updateDOM(e){return e.style.height=this.height+`px`,!0}get editable(){return!0}get estimatedHeight(){return this.height}ignoreEvent(){return!1}};function Qg(e,t,n=1){let r=e.charCategorizer(t),i=e.doc.lineAt(t),a=t-i.from;if(i.length==0)return W.cursor(t);a==0?n=1:a==i.length&&(n=-1);let o=a,s=a;n<0?o=pf(i.text,a,!1):s=pf(i.text,a);let c=r(i.text.slice(o,s));for(;o>0;){let e=pf(i.text,o,!1);if(r(i.text.slice(e,o))!=c)break;o=e}for(;s<i.length;){let e=pf(i.text,s);if(r(i.text.slice(s,e))!=c)break;s=e}return W.undirectionalRange(o+i.from,s+i.from)}function $g(e,t,n,r,i){let a=Math.round((r-t.left)*e.defaultCharacterWidth);if(e.lineWrapping&&n.height>e.defaultLineHeight*1.5){let t=e.viewState.heightOracle.textHeight,r=Math.floor((i-n.top-(e.defaultLineHeight-t)*.5)/t);a+=r*e.viewState.heightOracle.lineLength}let o=e.state.sliceDoc(n.from,n.to);return n.from+Hp(o,a,e.state.tabSize)}function e_(e,t,n){let r=e.lineBlockAt(t);if(Array.isArray(r.type)){let e;for(let i of r.type){if(i.from>t)break;if(!(i.to<t)){if(i.from<t&&i.to>t)return i;(!e||i.type==Cm.Text&&(e.type!=i.type||(n<0?i.from<t:i.to>t)))&&(e=i)}}return e||r}return r}function t_(e,t,n,r){let i=e_(e,t.head,t.assoc||-1),a=!r||i.type!=Cm.Text||!(e.lineWrapping||i.widgetLineBreaks)?null:e.coordsAtPos(t.assoc<0&&t.head>i.from?t.head-1:t.head);if(a){let t=e.dom.getBoundingClientRect(),r=e.textDirectionAt(i.from),o=e.posAtCoords({x:n==(r==ch.LTR)?t.right-1:t.left+1,y:(a.top+a.bottom)/2});if(o!=null)return W.cursor(o,n?-1:1)}return W.cursor(n?i.to:i.from,n?-1:1)}function n_(e,t,n,r){let i=e.state.doc.lineAt(t.head),a=e.bidiSpans(i),o=e.textDirectionAt(i.from);for(let s=t,c=null;;){let t=kh(i,a,o,s,n),l=Oh;if(!t){if(i.number==(n?e.state.doc.lines:1))return s;l=`
|
|
18
|
+
`,i=e.state.doc.line(i.number+(n?1:-1)),a=e.bidiSpans(i),t=n?W.cursor(i.from,-1):W.cursor(i.to,1)}if(!c){if(!r)return t;c=r(l)}else if(!c(l))return s;s=t}}function r_(e,t,n){let r=e.state.charCategorizer(t),i=r(n);return e=>{let t=r(e);return i==hp.Space&&(i=t),i==t}}function i_(e,t,n,r){let i=t.head,a=n?1:-1;if(i==(n?e.state.doc.length:0))return W.cursor(i,t.assoc);let o=t.goalColumn,s,c=e.contentDOM.getBoundingClientRect(),l=e.coordsAtPos(i,t.assoc||((t.empty?n:t.head==t.from)?1:-1)),u=e.documentTop;if(l)o??=l.left-c.left,s=a<0?l.top:l.bottom;else{let t=e.viewState.lineBlockAt(i);o??=Math.min(c.right-c.left,e.defaultCharacterWidth*(i-t.from)),s=(a<0?t.top:t.bottom)+u}let d=c.left+o,f=e.viewState.heightOracle.textHeight>>1,p=r??f;for(let t=0;;t+=f){let r=s+(p+t)*a,i=l_(e,{x:d,y:r},!1,a);if(n?r>c.bottom:r<c.top)return W.cursor(i.pos,i.assoc);let l=e.coordsAtPos(i.pos,i.assoc),u=l?(l.top+l.bottom)/2:0;if(!l||(n?u>s:u<s))return W.cursor(i.pos,i.assoc,void 0,o)}}function a_(e,t,n){for(;;){let r=0;for(let i of e)i.between(t-1,t+1,(e,i,a)=>{if(t>e&&t<i){let a=r||n||(t-e<i-t?-1:1);t=a<0?e:i,r=a}});if(!r)return t}}function o_(e,t){let n=null;for(let r=0;r<t.ranges.length;r++){let i=t.ranges[r],a=null;if(i.empty){let t=a_(e,i.from,0);t!=i.from&&(a=W.cursor(t,-1))}else{let t=a_(e,i.from,-1),n=a_(e,i.to,1);(t!=i.from||n!=i.to)&&(a=i.undirectional?W.undirectionalRange(i.from,i.to):W.range(i.from==i.anchor?t:n,i.from==i.head?t:n))}a&&(n||=t.ranges.slice(),n[r]=a)}return n?W.create(n,t.mainIndex):t}function s_(e,t,n){let r=a_(e.state.facet(rg).map(t=>t(e)),n.from,t.head>n.from?-1:1);return r==n.from?n:W.cursor(r,r<n.from?1:-1)}var c_=class{constructor(e,t){this.pos=e,this.assoc=t}};function l_(e,t,n,r){let i=e.contentDOM.getBoundingClientRect(),a=i.top+e.viewState.paddingTop,{x:o,y:s}=t,c=s-a,l;for(;;){if(c<0)return new c_(0,1);if(c>e.viewState.docHeight)return new c_(e.state.doc.length,-1);if(l=e.elementAtHeight(c),r==null)break;if(l.type==Cm.Text){if(r<0?l.to<e.viewport.from:l.from>e.viewport.to)break;let t=e.docView.coordsAt(r<0?l.from:l.to,r>0?-1:1);if(t&&(r<0?t.top<=c+a:t.bottom>=c+a))break}let t=e.viewState.heightOracle.textHeight/2;c=r>0?l.bottom+t:l.top-t}if(e.viewport.from>=l.to||e.viewport.to<=l.from){if(n)return null;if(l.type==Cm.Text){let t=$g(e,i,l,o,s);return new c_(t,t==l.from?1:-1)}}if(l.type!=Cm.Text)return c<(l.top+l.bottom)/2?new c_(l.from,1):new c_(l.to,-1);let u=e.docView.lineAt(l.from,2);return(!u||u.length!=l.length)&&(u=e.docView.lineAt(l.from,-2)),new u_(e,o,s,e.textDirectionAt(l.from)).scanTile(u,l.from)}var u_=class{constructor(e,t,n,r){this.view=e,this.x=t,this.y=n,this.baseDir=r,this.line=null,this.spans=null}bidiSpansAt(e){return(!this.line||this.line.from>e||this.line.to<e)&&(this.line=this.view.state.doc.lineAt(e),this.spans=this.view.bidiSpans(this.line)),this}baseDirAt(e,t){let{line:n,spans:r}=this.bidiSpansAt(e);return r[vh.find(r,e-n.from,-1,t)].level==this.baseDir}dirAt(e,t){let{line:n,spans:r}=this.bidiSpansAt(e);return r[vh.find(r,e-n.from,-1,t)].dir}bidiIn(e,t){let{spans:n,line:r}=this.bidiSpansAt(e);return n.length>1||n.length&&(n[0].level!=this.baseDir||n[0].to+r.from<t)}scan(e,t,n=!1){let r=0,i=e.length-1,a=new Set,o=this.bidiIn(e[0],e[i]),s,c,l=-1,u=1e9,d;search:for(;r<i;){let n=i-r,f=r+i>>1;adjust:if(a.has(f)){for(let e=1;e<n;e++){let t=f+e;if(t>=i&&(t-=n),!a.has(t)){f=t;break adjust}}break search}a.add(f);let p=t(f),m=0;if(p)for(let e=0;e<p.length;e++){let t=p[e];if(!(t.width==0&&p.length>1)){if(t.bottom<this.y)(!s||s.bottom<t.bottom)&&(s=t),m=1;else if(t.top>this.y)(!c||c.top>t.top)&&(c=t),m=-1;else{let e=t.left>this.x?this.x-t.left:t.right<this.x?this.x-t.right:0,n=Math.abs(e);n<u&&(l=f,u=n,d=t),e&&(m=e<0==(this.baseDir==ch.LTR)?-1:1)}}}m==-1&&(!o||this.baseDirAt(e[f],1))?i=f:m==1&&(!o||this.baseDirAt(e[f+1],-1))&&(r=f+1)}if(!d){if(!c&&!s)return{i:0,after:!1};let n=s&&(!c||this.y-s.bottom<c.top-this.y)?s:c;return this.y=(n.top+n.bottom)/2,this.scan(e,t,!0)}if(u&&!n){let{top:n,bottom:r}=d;if(s&&s.bottom>(n+n+r)/3)return this.y=s.bottom-1,this.scan(e,t,!0);if(c&&c.top<(n+r+r)/3)return this.y=c.top+1,this.scan(e,t,!0)}let f=(o?this.dirAt(e[l],1):this.baseDir)==ch.LTR;return{i:l,after:this.x>(d.left+d.right)/2==f}}scanText(e,t){let n=[];for(let r=0;r<e.length;r=pf(e.text,r))n.push(t+r);n.push(t+e.length);let r=this.scan(n,r=>{let i=n[r]-t,a=n[r+1]-t;return eh(e.dom,i,a).getClientRects()});return r.after?new c_(n[r.i+1],-1):new c_(n[r.i],1)}scanTile(e,t){if(!e.length)return new c_(t,1);if(e.children.length==1){let n=e.children[0];if(n.isText())return this.scanText(n,t);if(n.isComposite())return this.scanTile(n,t)}let n=[t];for(let r=0,i=t;r<e.children.length;r++)n.push(i+=e.children[r].length);let r=this.scan(n,t=>{let n=e.children[t];return n.flags&48?null:(Mm(n.dom)?n.dom:eh(n.dom,0,n.length)).getClientRects()}),i=e.children[r.i],a=n[r.i];return i.isText()?this.scanText(i,a):i.isComposite()?this.scanTile(i,a):r.after?new c_(n[r.i+1],-1):new c_(a,1)}},d_=``,f_=class{constructor(e,t){this.points=e,this.view=t,this.text=``,this.lineSeparator=t.state.facet(bp.lineSeparator)}append(e){this.text+=e}lineBreak(){this.text+=d_}readRange(e,t){if(!e)return this;let n=e.parentNode;for(let r=e;;){this.findPointBefore(n,r);let e=this.text.length;this.readNode(r);let i=fg.get(r),a=r.nextSibling;if(a==t){i?.breakAfter&&!a&&n!=this.view.contentDOM&&this.lineBreak();break}let o=fg.get(a);(i&&o?i.breakAfter:(i?i.breakAfter:Bm(r))||Bm(a)&&(r.nodeName!=`BR`||i?.isWidget())&&this.text.length>e)&&!m_(a,t)&&this.lineBreak(),r=a}return this.findPointBefore(n,t),this}readTextNode(e){let t=e.nodeValue;for(let n of this.points)n.node==e&&(n.pos=this.text.length+Math.min(n.offset,t.length));for(let n=0,r=this.lineSeparator?null:/\r\n?|\n/g;;){let i=-1,a=1,o;if(this.lineSeparator?(i=t.indexOf(this.lineSeparator,n),a=this.lineSeparator.length):(o=r.exec(t))&&(i=o.index,a=o[0].length),this.append(t.slice(n,i<0?t.length:i)),i<0)break;if(this.lineBreak(),a>1)for(let t of this.points)t.node==e&&t.pos>this.text.length&&(t.pos-=a-1);n=i+a}}readNode(e){let t=fg.get(e),n=t&&t.overrideDOMText;if(n!=null){this.findPointInside(e,n.length);for(let e=n.iter();!e.next().done;)e.lineBreak?this.lineBreak():this.append(e.value)}else Nm(e)?this.readTextNode(e):e.nodeName==`BR`?e.nextSibling&&this.lineBreak():Mm(e)&&this.readRange(e.firstChild,null)}findPointBefore(e,t){for(let n of this.points)n.node==e&&e.childNodes[n.offset]==t&&(n.pos=this.text.length)}findPointInside(e,t){for(let n of this.points)(Nm(e)?n.node==e:e.contains(n.node))&&(n.pos=this.text.length+(p_(e,n.node,n.offset)?t:0))}};function p_(e,t,n){for(;;){if(!t||n<Hm(t))return!1;if(t==e)return!0;n=zm(t)+1,t=t.parentNode}}function m_(e,t){let n;for(;e!=t&&e;e=e.nextSibling){let t=fg.get(e);if(!t?.isWidget())return!1;t&&(n||=[]).push(t)}if(n){for(let e of n)if(e.overrideDOMText?.length)return!1}return!0}var h_=class{constructor(e,t){this.node=e,this.offset=t,this.pos=-1}},g_=class{constructor(e,t,n,r){this.typeOver=r,this.bounds=null,this.text=``,this.domChanged=t>-1;let{impreciseHead:i,impreciseAnchor:a}=e.docView,o=e.state.selection;if(e.state.readOnly&&t>-1)this.newSel=null;else if(t>-1&&(this.bounds=__(e.docView.tile,t,n,0))){let t=i||a?[]:S_(e),n=new f_(t,e);n.readRange(this.bounds.startDOM,this.bounds.endDOM),this.text=n.text,this.newSel=C_(t,this.bounds.from)}else{let t=e.observer.selectionRange,n=i&&i.node==t.focusNode&&i.offset==t.focusOffset||!Fm(e.contentDOM,t.focusNode)?o.main.head:e.docView.posFromDOM(t.focusNode,t.focusOffset),r=a&&a.node==t.anchorNode&&a.offset==t.anchorOffset||!Fm(e.contentDOM,t.anchorNode)?o.main.anchor:e.docView.posFromDOM(t.anchorNode,t.anchorOffset),s=e.viewport;if((K.ios||K.chrome)&&n!=r&&Math.min(n,r)<=o.main.from&&Math.max(n,r)>=o.main.to&&(s.from>0||s.to<e.state.doc.length)){let t=Math.min(n,r),i=Math.max(n,r),a=s.from-t,o=s.to-i;(a==0||a==1||t==0)&&(o==0||o==-1||i==e.state.doc.length)&&(n=0,r=e.state.doc.length)}if(e.inputState.composing>-1&&o.ranges.length>1)this.newSel=o.replaceRange(W.range(r,n));else if(e.lineWrapping&&r==n&&!(o.main.empty&&o.main.head==n)&&e.inputState.lastTouchTime>Date.now()-100){let t=e.coordsAtPos(n,-1),r=0;t&&(r=e.inputState.lastTouchY<=t.bottom?-1:1),this.newSel=W.create([W.cursor(n,r)])}else this.newSel=W.single(r,n)}}};function __(e,t,n,r){if(e.isComposite()){let i=-1,a=-1,o=-1,s=-1;for(let c=0,l=r,u=r;c<e.children.length;c++){let r=e.children[c],d=l+r.length;if(l<t&&d>n)return __(r,t,n,l);if(d>=t&&i==-1&&(i=c,a=l),l>n&&r.dom.parentNode==e.dom){o=c,s=u;break}u=d,l=d+r.breakAfter}return{from:a,to:s<0?r+e.length:s,startDOM:(i?e.children[i-1].dom.nextSibling:null)||e.dom.firstChild,endDOM:o<e.children.length&&o>=0?e.children[o].dom:null}}return e.isText()?{from:r,to:r+e.length,startDOM:e.dom,endDOM:e.dom.nextSibling}:null}function v_(e,t){let n,{newSel:r}=t,{state:i}=e,a=i.selection.main,o=e.inputState.lastKeyTime>Date.now()-100?e.inputState.lastKeyCode:-1;if(t.bounds){let{from:e,to:r}=t.bounds,s=a.from,c=null;(o===8||K.android&&t.text.length<r-e)&&(s=a.to,c=`end`);let l=i.doc.sliceString(e,r,d_),u,d;!a.empty&&a.from>=e&&a.to<=r&&(t.typeOver||l!=t.text)&&l.slice(0,a.from-e)==t.text.slice(0,a.from-e)&&l.slice(a.to-e)==t.text.slice(u=t.text.length-(l.length-(a.to-e)))?n={from:a.from,to:a.to,insert:tf.of(t.text.slice(a.from-e,u).split(d_))}:(d=x_(l,t.text,s-e,c))&&(K.chrome&&o==13&&d.toB==d.from+2&&t.text.slice(d.from,d.toB)==``&&d.toB--,n={from:e+d.from,to:e+d.toA,insert:tf.of(t.text.slice(d.from,d.toB).split(d_))})}else r&&(!e.hasFocus&&i.facet(qh)||w_(r,a))&&(r=null);if(!n&&!r)return!1;if((K.mac||K.android)&&n&&n.from==n.to&&n.from==a.head-1&&/^\. ?$/.test(n.insert.toString())&&e.contentDOM.getAttribute(`autocorrect`)==`off`?(r&&n.insert.length==2&&(r=W.single(r.main.anchor-1,r.main.head-1)),n={from:n.from,to:n.to,insert:tf.of([n.insert.toString().replace(`.`,` `)])}):i.doc.lineAt(a.from).to<a.to&&e.docView.lineHasWidget(a.to)&&e.inputState.insertingTextAt>Date.now()-50?n={from:a.from,to:a.to,insert:i.toText(e.inputState.insertingText)}:K.chrome&&n&&n.from==n.to&&n.from==a.head&&n.insert.toString()==`
|
|
19
|
+
`&&e.lineWrapping&&(r&&=W.single(r.main.anchor-1,r.main.head-1),n={from:a.from,to:a.to,insert:tf.of([` `])}),n)return y_(e,n,r,o);if(r&&!w_(r,a)){let t=!1,n=`select`;return e.inputState.lastSelectionTime>Date.now()-50&&(e.inputState.lastSelectionOrigin==`select`&&(t=!0),n=e.inputState.lastSelectionOrigin,n==`select.pointer`&&(r=o_(i.facet(rg).map(t=>t(e)),r))),e.dispatch({selection:r,scrollIntoView:t,userEvent:n}),!0}return!1}function y_(e,t,n,r=-1){if(K.ios&&e.inputState.flushIOSKey(t))return!0;let i=e.state.selection.main;if(K.android&&(t.to==i.to&&(t.from==i.from||t.from==i.from-1&&e.state.sliceDoc(t.from,i.from)==` `)&&t.insert.length==1&&t.insert.lines==2&&th(e.contentDOM,`Enter`,13)||(t.from==i.from-1&&t.to==i.to&&t.insert.length==0||r==8&&t.insert.length<t.to-t.from&&t.to>i.head)&&th(e.contentDOM,`Backspace`,8)||t.from==i.from&&t.to==i.to+1&&t.insert.length==0&&th(e.contentDOM,`Delete`,46)))return!0;let a=t.insert.toString();e.inputState.composing>=0&&e.inputState.composing++;let o,s=()=>o||=b_(e,t,n);return e.state.facet(Ih).some(n=>n(e,t.from,t.to,a,s))||e.dispatch(s()),!0}function b_(e,t,n){let r,i=e.state,a=i.selection.main,o=-1;if(t.from==t.to&&t.from<a.from||t.from>a.to){let n=t.from<a.from?-1:1,r=n<0?a.from:a.to,s=a_(i.facet(rg).map(t=>t(e)),r,n);t.from==s&&(o=s)}if(o>-1)r={changes:t,selection:W.cursor(t.from+t.insert.length,-1)};else if(t.from>=a.from&&t.to<=a.to&&t.to-t.from>=(a.to-a.from)/3&&(!n||n.main.empty&&n.main.from==t.from+t.insert.length)&&e.inputState.composing<0){let n=a.from<t.from?i.sliceDoc(a.from,t.from):``,o=a.to>t.to?i.sliceDoc(t.to,a.to):``;r=i.replaceSelection(e.state.toText(n+t.insert.sliceString(0,void 0,e.state.lineBreak)+o))}else{let o=i.changes(t),s=n&&n.main.to<=o.newLength?n.main:void 0;if(i.selection.ranges.length>1&&(e.inputState.composing>=0||e.inputState.compositionPendingChange)&&t.to<=a.to+10&&t.to>=a.to-10){let c=e.state.sliceDoc(t.from,t.to),l,u=n&&Hg(e,n.main.head);if(u){let e=t.insert.length-(t.to-t.from);l={from:u.from,to:u.to-e}}else l=e.state.doc.lineAt(a.head);let d=a.to-t.to;r=i.changeByRange(n=>{if(n.from==a.from&&n.to==a.to)return{changes:o,range:s||n.map(o)};let r=n.to-d,u=r-c.length;if(e.state.sliceDoc(u,r)!=c||r>=l.from&&u<=l.to)return{range:n};let f=i.changes({from:u,to:r,insert:t.insert}),p=n.to-a.to;return{changes:f,range:s?W.range(Math.max(0,s.anchor+p),Math.max(0,s.head+p)):n.map(f)}})}else r={changes:o,selection:s&&i.selection.replaceRange(s)}}let s=`input.type`;return(e.composing||e.inputState.compositionPendingChange&&e.inputState.compositionEndedAt>Date.now()-50)&&(e.inputState.compositionPendingChange=!1,s+=`.compose`,e.inputState.compositionFirstChange&&(s+=`.start`,e.inputState.compositionFirstChange=!1)),i.update(r,{userEvent:s,scrollIntoView:!0})}function x_(e,t,n,r){let i=Math.min(e.length,t.length),a=0;for(;a<i&&e.charCodeAt(a)==t.charCodeAt(a);)a++;if(a==i&&e.length==t.length)return null;let o=e.length,s=t.length;for(;o>0&&s>0&&e.charCodeAt(o-1)==t.charCodeAt(s-1);)o--,s--;if(r==`end`){let e=Math.max(0,a-Math.min(o,s));n-=o+e-a}if(o<a&&e.length<t.length){let e=n<=a&&n>=o?a-n:0;a-=e,s=a+(s-o),o=a}else if(s<a){let e=n<=a&&n>=s?a-n:0;a-=e,o=a+(o-s),s=a}return{from:a,toA:o,toB:s}}function S_(e){let t=[];if(e.root.activeElement!=e.contentDOM)return t;let{anchorNode:n,anchorOffset:r,focusNode:i,focusOffset:a}=e.observer.selectionRange;return n&&(t.push(new h_(n,r)),(i!=n||a!=r)&&t.push(new h_(i,a))),t}function C_(e,t){if(e.length==0)return null;let n=e[0].pos,r=e.length==2?e[1].pos:n;return n<0||r<0?null:n==r?W.create([W.cursor(r+t,-1)]):W.single(n+t,r+t)}function w_(e,t){return t.head==e.main.head&&t.anchor==e.main.anchor}var T_=class{setSelectionOrigin(e){this.lastSelectionOrigin=e,this.lastSelectionTime=Date.now()}constructor(e){this.view=e,this.lastKeyCode=0,this.lastKeyTime=0,this.touchActive=!1,this.lastTouchTime=0,this.lastTouchX=0,this.lastTouchY=0,this.lastFocusTime=0,this.lastScrollTop=0,this.lastScrollLeft=0,this.lastWheelEvent=0,this.pendingIOSKey=void 0,this.lastIOSMomentumScroll=0,this.tabFocusMode=-1,this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastContextMenu=0,this.scrollHandlers=[],this.handlers=Object.create(null),this.composing=-1,this.compositionFirstChange=null,this.compositionEndedAt=0,this.compositionPendingKey=!1,this.compositionPendingChange=!1,this.insertingText=``,this.insertingTextAt=0,this.mouseSelection=null,this.draggedContent=null,this.handleEvent=this.handleEvent.bind(this),this.notifiedFocused=e.hasFocus,K.safari&&e.contentDOM.addEventListener(`input`,()=>null),K.gecko&&cv(e.contentDOM.ownerDocument)}handleEvent(e){z_(this.view,e)&&!this.ignoreDuringComposition(e)&&(e.type==`keydown`&&this.keydown(e)||(this.view.updateState==0?this.runHandlers(e.type,e):Promise.resolve().then(()=>this.runHandlers(e.type,e))))}runHandlers(e,t){let n=this.handlers[e];if(n){for(let e of n.observers)e(this.view,t);for(let e of n.handlers){if(t.defaultPrevented)break;if(e(this.view,t)){t.preventDefault();break}}}}ensureHandlers(e){let t=O_(e),n=this.handlers,r=this.view.contentDOM;for(let e in t)if(e!=`scroll`){let i=!t[e].handlers.length,a=n[e];a&&i!=!a.handlers.length&&(r.removeEventListener(e,this.handleEvent),a=null),a||r.addEventListener(e,this.handleEvent,{passive:i})}for(let e in n)e!=`scroll`&&!t[e]&&r.removeEventListener(e,this.handleEvent);this.handlers=t}keydown(e){if(this.lastKeyCode=e.keyCode,this.lastKeyTime=Date.now(),e.keyCode==9&&this.tabFocusMode>-1&&(!this.tabFocusMode||Date.now()<=this.tabFocusMode))return!0;if(this.tabFocusMode>0&&e.keyCode!=27&&j_.indexOf(e.keyCode)<0&&(this.tabFocusMode=-1),K.android&&K.chrome&&!e.synthetic&&(e.keyCode==13||e.keyCode==8))return this.view.observer.delayAndroidKey(e.key,e.keyCode),!0;if(K.ios&&!e.synthetic&&!e.altKey&&!e.metaKey&&(k_.some(t=>t.keyCode==e.keyCode)&&!e.ctrlKey||A_.indexOf(e.key)>-1&&e.ctrlKey)){let t={ctrlKey:e.ctrlKey,altKey:e.altKey,metaKey:e.metaKey,shiftKey:e.shiftKey};t.shiftKey&&K.ios&&!/^(off|none)$/.test(this.view.contentDOM.autocapitalize)&&E_(this.view.win)&&(t.shiftKey=!1);let n=this.pendingIOSKey={key:e.key,keyCode:e.keyCode,mods:t};return setTimeout(()=>{this.pendingIOSKey==n&&this.flushIOSKey()},50),!0}return e.keyCode!=229&&this.view.observer.forceFlush(),!1}flushIOSKey(e){let t=this.pendingIOSKey;return!t||this.view.observer.pendingRecords().length||t.key==`Enter`&&e&&e.from<e.to&&/^\S+$/.test(e.insert.toString())?!1:(this.pendingIOSKey=void 0,th(this.view.contentDOM,t.key,t.keyCode,t.mods))}ignoreDuringComposition(e){return!/^key/.test(e.type)||e.synthetic?!1:this.composing>0?!0:K.safari&&!K.ios&&this.compositionPendingKey&&Date.now()-this.compositionEndedAt<100?(this.compositionPendingKey=!1,!0):!1}startMouseSelection(e){this.mouseSelection&&this.mouseSelection.destroy(),this.mouseSelection=e}update(e){this.view.observer.update(e),this.mouseSelection&&this.mouseSelection.update(e),this.draggedContent&&e.docChanged&&(this.draggedContent=this.draggedContent.map(e.changes)),e.transactions.length&&(this.lastKeyCode=this.lastSelectionTime=0)}destroy(){this.mouseSelection&&this.mouseSelection.destroy()}};function E_(e){return e.visualViewport?e.visualViewport.height*e.visualViewport.scale/e.document.documentElement.clientHeight<.85:!1}function D_(e,t){return(n,r)=>{try{return t.call(e,r,n)}catch(e){Kh(n.state,e)}}}function O_(e){let t=Object.create(null);function n(e){return t[e]||(t[e]={observers:[],handlers:[]})}for(let t of e){let e=t.spec,r=e&&e.plugin.domEventHandlers,i=e&&e.plugin.domEventObservers;if(r)for(let e in r){let i=r[e];i&&n(e).handlers.push(D_(t.value,i))}if(i)for(let e in i){let r=i[e];r&&n(e).observers.push(D_(t.value,r))}}for(let e in B_)n(e).handlers.push(B_[e]);for(let e in V_)n(e).observers.push(V_[e]);return t}var k_=[{key:`Backspace`,keyCode:8,inputType:`deleteContentBackward`},{key:`Enter`,keyCode:13,inputType:`insertParagraph`},{key:`Enter`,keyCode:13,inputType:`insertLineBreak`},{key:`Delete`,keyCode:46,inputType:`deleteContentForward`}],A_=`dthko`,j_=[16,17,18,20,91,92,224,225],M_=6;function N_(e){return Math.max(0,e)*.7+8}function P_(e,t){return Math.max(Math.abs(e.clientX-t.clientX),Math.abs(e.clientY-t.clientY))}var F_=class{constructor(e,t,n,r){this.view=e,this.startEvent=t,this.style=n,this.mustSelect=r,this.scrollSpeed={x:0,y:0},this.scrolling=-1,this.lastEvent=t,this.scrollParents=qm(e.contentDOM),this.atoms=e.state.facet(rg).map(t=>t(e));let i=e.contentDOM.ownerDocument;i.addEventListener(`mousemove`,this.move=this.move.bind(this)),i.addEventListener(`mouseup`,this.up=this.up.bind(this)),this.extend=t.shiftKey,this.multiple=e.state.facet(bp.allowMultipleSelections)&&I_(e,t),this.dragging=R_(e,t)&&Z_(t)==1?null:!1}start(e){this.dragging===!1&&this.select(e)}move(e){if(e.buttons==0)return this.destroy();if(this.dragging||this.dragging==null&&P_(this.startEvent,e)<10)return;this.select(this.lastEvent=e);let t=0,n=0,r=0,i=0,a=this.view.win.innerWidth,o=this.view.win.innerHeight;this.scrollParents.x&&({left:r,right:a}=this.scrollParents.x.getBoundingClientRect()),this.scrollParents.y&&({top:i,bottom:o}=this.scrollParents.y.getBoundingClientRect());let s=sg(this.view);e.clientX-s.left<=r+M_?t=-N_(r-e.clientX):e.clientX+s.right>=a-M_&&(t=N_(e.clientX-a)),e.clientY-s.top<=i+M_?n=-N_(i-e.clientY):e.clientY+s.bottom>=o-M_&&(n=N_(e.clientY-o)),this.setScrollSpeed(t,n)}up(e){this.dragging??this.select(this.lastEvent),this.dragging||e.preventDefault(),this.destroy()}destroy(){this.setScrollSpeed(0,0);let e=this.view.contentDOM.ownerDocument;e.removeEventListener(`mousemove`,this.move),e.removeEventListener(`mouseup`,this.up),this.view.inputState.mouseSelection=this.view.inputState.draggedContent=null}setScrollSpeed(e,t){this.scrollSpeed={x:e,y:t},e||t?this.scrolling<0&&(this.scrolling=setInterval(()=>this.scroll(),50)):this.scrolling>-1&&(clearInterval(this.scrolling),this.scrolling=-1)}scroll(){let{x:e,y:t}=this.scrollSpeed;e&&this.scrollParents.x&&(this.scrollParents.x.scrollLeft+=e,e=0),t&&this.scrollParents.y&&(this.scrollParents.y.scrollTop+=t,t=0),(e||t)&&this.view.win.scrollBy(e,t),this.dragging===!1&&this.select(this.lastEvent)}select(e){let{view:t}=this,n=o_(this.atoms,this.style.get(e,this.extend,this.multiple));(this.mustSelect||!n.eq(t.state.selection,this.dragging===!1))&&this.view.dispatch({selection:n,userEvent:`select.pointer`}),this.mustSelect=!1}update(e){e.transactions.some(e=>e.isUserEvent(`input.type`))?this.destroy():this.style.update(e)&&setTimeout(()=>this.select(this.lastEvent),20)}};function I_(e,t){let n=e.state.facet(jh);return n.length?n[0](t):K.mac?t.metaKey:t.ctrlKey}function L_(e,t){let n=e.state.facet(Mh);return n.length?n[0](t):K.mac?!t.altKey:!t.ctrlKey}function R_(e,t){let{main:n}=e.state.selection;if(n.empty)return!1;let r=Pm(e.root);if(!r||r.rangeCount==0)return!0;let i=r.getRangeAt(0).getClientRects();for(let e=0;e<i.length;e++){let n=i[e];if(n.left<=t.clientX&&n.right>=t.clientX&&n.top<=t.clientY&&n.bottom>=t.clientY)return!0}return!1}function z_(e,t){if(!t.bubbles)return!0;if(t.defaultPrevented)return!1;for(let n=t.target,r;n!=e.contentDOM;n=n.parentNode)if(!n||n.nodeType==11||(r=fg.get(n))&&r.isWidget()&&!r.isHidden&&r.widget.ignoreEvent(t))return!1;return!0}var B_=Object.create(null),V_=Object.create(null),H_=K.ie&&K.ie_version<15||K.ios&&K.webkit_version<604;function U_(e){let t=e.dom.parentNode;if(!t)return;let n=t.appendChild(document.createElement(`textarea`));n.style.cssText=`position: fixed; left: -10000px; top: 10px`,n.focus(),setTimeout(()=>{e.focus(),n.remove(),G_(e,n.value)},50)}function W_(e,t,n){for(let r of e.facet(t))n=r(n,e);return n}function G_(e,t){t=W_(e.state,Rh,t);let{state:n}=e,r,i=1,a=n.toText(t),o=a.lines==n.selection.ranges.length;if(rv!=null&&n.selection.ranges.every(e=>e.empty)&&rv==a.toString()){let e=-1;r=n.changeByRange(r=>{let s=n.doc.lineAt(r.from);if(s.from==e)return{range:r};e=s.from;let c=n.toText((o?a.line(i++).text:t)+n.lineBreak);return{changes:{from:s.from,insert:c},range:W.cursor(r.from+c.length,-1)}})}else r=o?n.changeByRange(e=>{let t=a.line(i++);return{changes:{from:e.from,to:e.to,insert:t.text},range:W.cursor(e.from+t.length,-1)}}):n.replaceSelection(a);e.dispatch(r,{userEvent:`input.paste`,scrollIntoView:!0})}V_.scroll=e=>{let t=e.inputState;t.lastScrollTop=e.scrollDOM.scrollTop,t.lastScrollLeft=e.scrollDOM.scrollLeft,K.ios&&!t.touchActive&&(t.lastIOSMomentumScroll=Date.now())},V_.wheel=V_.mousewheel=e=>{e.inputState.lastWheelEvent=Date.now()},B_.keydown=(e,t)=>(e.inputState.setSelectionOrigin(`select`),t.keyCode==27&&e.inputState.tabFocusMode!=0&&(e.inputState.tabFocusMode=Date.now()+2e3),!1),V_.touchstart=(e,t)=>{let n=e.inputState,r=t.targetTouches[0];n.touchActive=!0,n.lastTouchTime=Date.now(),r&&(n.lastTouchX=r.clientX,n.lastTouchY=r.clientY),n.setSelectionOrigin(`select.pointer`)},V_.touchmove=e=>{e.inputState.setSelectionOrigin(`select.pointer`)},V_.touchend=(e,t)=>{e.inputState.touchActive=!1},B_.mousedown=(e,t)=>{if(e.observer.flush(),e.inputState.lastTouchTime>Date.now()-2e3)return!1;let n=null;for(let r of e.state.facet(Nh))if(n=r(e,t),n)break;if(!n&&t.button==0&&(n=Q_(e,t)),n){let r=!e.hasFocus;e.inputState.startMouseSelection(new F_(e,t,n,r)),r&&e.observer.ignore(()=>{Qm(e.contentDOM);let t=e.root.activeElement;t&&!t.contains(e.contentDOM)&&t.blur()});let i=e.inputState.mouseSelection;if(i)return i.start(t),i.dragging===!1}else e.inputState.setSelectionOrigin(`select.pointer`);return!1};function K_(e,t,n,r){if(r==1)return W.cursor(t,n);if(r==2)return Qg(e.state,t,n);{let r=e.docView.lineAt(t,n),i=e.state.doc.lineAt(r?r.posAtEnd:t),a=r?r.posAtStart:i.from,o=r?r.posAtEnd:i.to;return o<e.state.doc.length&&o==i.to&&o++,W.undirectionalRange(a,o)}}var q_=K.ie&&K.ie_version<=11,J_=null,Y_=0,X_=0;function Z_(e){if(!q_)return e.detail;let t=J_,n=X_;return J_=e,X_=Date.now(),Y_=!t||n>Date.now()-400&&Math.abs(t.clientX-e.clientX)<2&&Math.abs(t.clientY-e.clientY)<2?(Y_+1)%3:1}function Q_(e,t){let n=e.posAndSideAtCoords({x:t.clientX,y:t.clientY},!1),r=Z_(t),i=e.state.selection;return{update(e){e.docChanged&&(n.pos=e.changes.mapPos(n.pos),i=i.map(e.changes))},get(t,a,o){let s=e.posAndSideAtCoords({x:t.clientX,y:t.clientY},!1),c,l=K_(e,s.pos,s.assoc,r);if(n.pos!=s.pos&&!a){let t=K_(e,n.pos,n.assoc,r),i=Math.min(t.from,l.from),a=Math.max(t.to,l.to);l=i<l.from?W.range(i,a,l.assoc):W.range(a,i,l.assoc)}return a?i.replaceRange(i.main.extend(l.from,l.to,l.assoc)):o&&r==1&&i.ranges.length>1&&(c=$_(i,s.pos))?c:o?i.addRange(l):W.create([l])}}}function $_(e,t){for(let n=0;n<e.ranges.length;n++){let{from:r,to:i}=e.ranges[n];if(r<=t&&i>=t)return W.create(e.ranges.slice(0,n).concat(e.ranges.slice(n+1)),e.mainIndex==n?0:e.mainIndex-+(e.mainIndex>n))}return null}B_.dragstart=(e,t)=>{let{selection:{main:n}}=e.state;if(t.target.draggable){let r=e.docView.tile.nearest(t.target);if(r&&r.isWidget()){let e=r.posAtStart,t=e+r.length;(e>=n.to||t<=n.from)&&(n=W.undirectionalRange(e,t))}}let{inputState:r}=e;return r.mouseSelection&&(r.mouseSelection.dragging=!0),r.draggedContent=n,t.dataTransfer&&(t.dataTransfer.setData(`Text`,W_(e.state,zh,e.state.sliceDoc(n.from,n.to))),t.dataTransfer.effectAllowed=`copyMove`),!1},B_.dragend=e=>(e.inputState.draggedContent=null,!1);function ev(e,t,n,r){if(n=W_(e.state,Rh,n),!n)return;let i=e.posAtCoords({x:t.clientX,y:t.clientY},!1),{draggedContent:a}=e.inputState,o=r&&a&&L_(e,t)?{from:a.from,to:a.to}:null,s={from:i,insert:n},c=e.state.changes(o?[o,s]:s);e.focus(),e.dispatch({changes:c,selection:{anchor:c.mapPos(i,-1),head:c.mapPos(i,1)},userEvent:o?`move.drop`:`input.drop`}),e.inputState.draggedContent=null}B_.drop=(e,t)=>{if(!t.dataTransfer)return!1;if(e.state.readOnly)return!0;let n=t.dataTransfer.files;if(n&&n.length){let r=Array(n.length),i=0,a=()=>{++i==n.length&&ev(e,t,r.filter(e=>e!=null).join(e.state.lineBreak),!1)};for(let e=0;e<n.length;e++){let t=new FileReader;t.onerror=a,t.onload=()=>{/[\x00-\x08\x0e-\x1f]{2}/.test(t.result)||(r[e]=t.result),a()},t.readAsText(n[e])}return!0}{let n=t.dataTransfer.getData(`Text`);if(n)return ev(e,t,n,!0),!0}return!1},B_.paste=(e,t)=>{if(e.state.readOnly)return!0;e.observer.flush();let n=H_?null:t.clipboardData;return n?(G_(e,n.getData(`text/plain`)||n.getData(`text/uri-list`)),!0):(U_(e),!1)};function tv(e,t){let n=e.dom.parentNode;if(!n)return;let r=n.appendChild(document.createElement(`textarea`));r.style.cssText=`position: fixed; left: -10000px; top: 10px`,r.value=t,r.focus(),r.selectionEnd=t.length,r.selectionStart=0,setTimeout(()=>{r.remove(),e.focus()},50)}function nv(e){let t=[],n=[],r=!1;for(let r of e.selection.ranges)r.empty||(t.push(e.sliceDoc(r.from,r.to)),n.push(r));if(!t.length){let i=-1;for(let{from:r}of e.selection.ranges){let a=e.doc.lineAt(r);a.number>i&&(t.push(a.text),n.push({from:a.from,to:Math.min(e.doc.length,a.to+1)})),i=a.number}r=!0}return{text:W_(e,zh,t.join(e.lineBreak)),ranges:n,linewise:r}}var rv=null;B_.copy=B_.cut=(e,t)=>{if(!Im(e.contentDOM,e.observer.selectionRange))return!1;let{text:n,ranges:r,linewise:i}=nv(e.state);if(!n&&!i)return!1;rv=i?n:null,t.type==`cut`&&!e.state.readOnly&&e.dispatch({changes:r,scrollIntoView:!0,userEvent:`delete.cut`});let a=H_?null:t.clipboardData;return a?(a.clearData(),a.setData(`text/plain`,n),!0):(tv(e,n),!1)};var iv=np.define();function av(e,t){let n=[];for(let r of e.facet(Lh)){let i=r(e,t);i&&n.push(i)}return n.length?e.update({effects:n,annotations:iv.of(!0)}):null}function ov(e){setTimeout(()=>{let t=e.hasFocus;if(t!=e.inputState.notifiedFocused){let n=av(e.state,t);n?e.dispatch(n):e.update([])}},10)}V_.focus=e=>{e.inputState.lastFocusTime=Date.now(),!e.scrollDOM.scrollTop&&(e.inputState.lastScrollTop||e.inputState.lastScrollLeft)&&(e.scrollDOM.scrollTop=e.inputState.lastScrollTop,e.scrollDOM.scrollLeft=e.inputState.lastScrollLeft),ov(e)},V_.blur=e=>{e.observer.clearSelectionRange(),ov(e)},V_.compositionstart=V_.compositionupdate=(e,t)=>{if(!e.observer.editContext&&(e.inputState.compositionFirstChange??(e.inputState.compositionFirstChange=!0),e.inputState.composing<0)){let{main:t}=e.state.selection;!t.empty&&e.lineBlockAt(t.from).from!=e.lineBlockAt(t.to).from&&!e.state.readOnly&&e.dispatch({changes:e.state.selection.ranges.filter(e=>!e.empty).map(e=>({from:e.from,to:e.to})),userEvent:`input`}),e.inputState.composing=0}},V_.compositionend=e=>{e.observer.editContext||(e.inputState.composing=-1,e.inputState.compositionEndedAt=Date.now(),e.inputState.compositionPendingKey=!0,e.inputState.compositionPendingChange=e.observer.pendingRecords().length>0,e.inputState.compositionFirstChange=null,K.chrome&&K.android?e.observer.flushSoon():e.inputState.compositionPendingChange?Promise.resolve().then(()=>e.observer.flush()):setTimeout(()=>{e.inputState.composing<0&&e.docView.hasComposition&&e.update([])},50))},V_.contextmenu=e=>{e.inputState.lastContextMenu=Date.now()},B_.beforeinput=(e,t)=>{if((t.inputType==`insertText`||t.inputType==`insertCompositionText`)&&(e.inputState.insertingText=t.data,e.inputState.insertingTextAt=Date.now()),t.inputType==`insertReplacementText`&&e.observer.editContext){let n=t.dataTransfer?.getData(`text/plain`),r=t.getTargetRanges();if(n&&r.length){let t=r[0];return y_(e,{from:e.posAtDOM(t.startContainer,t.startOffset),to:e.posAtDOM(t.endContainer,t.endOffset),insert:e.state.toText(n)},null),!0}}let n;if(K.chrome&&K.android&&(n=k_.find(e=>e.inputType==t.inputType))&&(e.observer.delayAndroidKey(n.key,n.keyCode),n.key==`Backspace`||n.key==`Delete`)){let t=window.visualViewport?.height||0;setTimeout(()=>{(window.visualViewport?.height||0)>t+10&&e.hasFocus&&(e.contentDOM.blur(),e.focus())},100)}return K.ios&&t.inputType==`deleteContentForward`&&e.observer.flushSoon(),K.safari&&t.inputType==`insertText`&&e.inputState.composing>=0&&setTimeout(()=>V_.compositionend(e,t),20),!1};var sv=new Set;function cv(e){sv.has(e)||(sv.add(e),e.addEventListener(`copy`,()=>{}),e.addEventListener(`cut`,()=>{}))}var lv=[`pre-wrap`,`normal`,`pre-line`,`break-spaces`],uv=!1;function dv(){uv=!1}var fv=class{constructor(e){this.lineWrapping=e,this.doc=tf.empty,this.heightSamples={},this.lineHeight=14,this.charWidth=7,this.textHeight=14,this.lineLength=30}heightForGap(e,t){let n=this.doc.lineAt(t).number-this.doc.lineAt(e).number+1;return this.lineWrapping&&(n+=Math.max(0,Math.ceil((t-e-n*this.lineLength*.5)/this.lineLength))),this.lineHeight*n}heightForLine(e){return this.lineWrapping?(1+Math.max(0,Math.ceil((e-this.lineLength)/Math.max(1,this.lineLength-5))))*this.lineHeight:this.lineHeight}setDoc(e){return this.doc=e,this}mustRefreshForWrapping(e){return lv.indexOf(e)>-1!=this.lineWrapping}mustRefreshForHeights(e){let t=!1;for(let n=0;n<e.length;n++){let r=e[n];r<0?n++:this.heightSamples[Math.floor(r*10)]||(t=!0,this.heightSamples[Math.floor(r*10)]=!0)}return t}refresh(e,t,n,r,i,a){let o=lv.indexOf(e)>-1,s=Math.abs(t-this.lineHeight)>.3||this.lineWrapping!=o;if(this.lineWrapping=o,this.lineHeight=t,this.charWidth=n,this.textHeight=r,this.lineLength=i,s){this.heightSamples={};for(let e=0;e<a.length;e++){let t=a[e];t<0?e++:this.heightSamples[Math.floor(t*10)]=!0}}return s}},pv=class{constructor(e,t){this.from=e,this.heights=t,this.index=0}get more(){return this.index<this.heights.length}},mv=class e{constructor(e,t,n,r,i){this.from=e,this.length=t,this.top=n,this.height=r,this._content=i}get type(){return typeof this._content==`number`?Cm.Text:Array.isArray(this._content)?this._content:this._content.type}get to(){return this.from+this.length}get bottom(){return this.top+this.height}get widget(){return this._content instanceof Dm?this._content.widget:null}get widgetLineBreaks(){return typeof this._content==`number`?this._content:0}join(t){let n=(Array.isArray(this._content)?this._content:[this]).concat(Array.isArray(t._content)?t._content:[t]);return new e(this.from,this.length+t.length,this.top,this.height+t.height,n)}},hv=(function(e){return e[e.ByPos=0]=`ByPos`,e[e.ByHeight=1]=`ByHeight`,e[e.ByPosNoHeight=2]=`ByPosNoHeight`,e})(hv||={}),gv=.001,_v=class e{constructor(e,t,n=2){this.length=e,this.height=t,this.flags=n}get outdated(){return(this.flags&2)>0}set outdated(e){this.flags=(e?2:0)|this.flags&-3}setHeight(e){this.height!=e&&(Math.abs(this.height-e)>gv&&(uv=!0),this.height=e)}replace(t,n,r){return e.of(r)}decomposeLeft(e,t){t.push(this)}decomposeRight(e,t){t.push(this)}applyChanges(e,t,n,r){let i=this,a=n.doc;for(let o=r.length-1;o>=0;o--){let{fromA:s,toA:c,fromB:l,toB:u}=r[o],d=i.lineAt(s,hv.ByPosNoHeight,n.setDoc(t),0,0),f=d.to>=c?d:i.lineAt(c,hv.ByPosNoHeight,n,0,0);for(u+=f.to-c,c=f.to;o>0&&d.from<=r[o-1].toA;)s=r[o-1].fromA,l=r[o-1].fromB,o--,s<d.from&&(d=i.lineAt(s,hv.ByPosNoHeight,n,0,0));l+=d.from-s,s=d.from;let p=Ev.build(n.setDoc(a),e,l,u);i=vv(i,i.replace(s,c,p))}return i.updateHeight(n,0)}static empty(){return new xv(0,0,0)}static of(t){if(t.length==1)return t[0];let n=0,r=t.length,i=0,a=0;for(;;)if(n==r){if(i>a*2){let e=t[n-1];e.break?t.splice(--n,1,e.left,null,e.right):t.splice(--n,1,e.left,e.right),r+=1+e.break,i-=e.size}else if(a>i*2){let e=t[r];e.break?t.splice(r,1,e.left,null,e.right):t.splice(r,1,e.left,e.right),r+=2+e.break,a-=e.size}else break}else if(i<a){let e=t[n++];e&&(i+=e.size)}else{let e=t[--r];e&&(a+=e.size)}let o=!1;return t[n-1]==null?(o=!0,n--):t[n]??(o=!0,r++),new Cv(e.of(t.slice(0,n)),o,e.of(t.slice(r)))}};function vv(e,t){return e==t?e:(e.constructor!=t.constructor&&(uv=!0),t)}_v.prototype.size=1;var yv=wm.replace({}),bv=class extends _v{constructor(e,t,n){super(e,t),this.deco=n,this.spaceAbove=0}mainBlock(e,t){return new mv(t,this.length,e+this.spaceAbove,this.height-this.spaceAbove,this.deco||0)}blockAt(e,t,n,r){return this.spaceAbove&&e<n+this.spaceAbove?new mv(r,0,n,this.spaceAbove,yv):this.mainBlock(n,r)}lineAt(e,t,n,r,i){let a=this.mainBlock(r,i);return this.spaceAbove?this.blockAt(0,n,r,i).join(a):a}forEachLine(e,t,n,r,i,a){e<=i+this.length&&t>=i&&a(this.lineAt(0,hv.ByPos,n,r,i))}setMeasuredHeight(e){let t=e.heights[e.index++];t<0?(this.spaceAbove=-t,t=e.heights[e.index++]):this.spaceAbove=0,this.setHeight(t)}updateHeight(e,t=0,n=!1,r){return r&&r.from<=t&&r.more&&this.setMeasuredHeight(r),this.outdated=!1,this}toString(){return`block(${this.length})`}},xv=class e extends bv{constructor(e,t,n){super(e,t,null),this.collapsed=0,this.widgetHeight=0,this.breaks=0,this.spaceAbove=n}mainBlock(e,t){return new mv(t,this.length,e+this.spaceAbove,this.height-this.spaceAbove,this.breaks)}replace(t,n,r){let i=r[0];return r.length==1&&(i instanceof e||i instanceof Sv&&i.flags&4)&&Math.abs(this.length-i.length)<10?(i instanceof Sv?i=new e(i.length,this.height,this.spaceAbove):i.height=this.height,this.outdated||(i.outdated=!1),i):_v.of(r)}updateHeight(e,t=0,n=!1,r){return r&&r.from<=t&&r.more?this.setMeasuredHeight(r):(n||this.outdated)&&(this.spaceAbove=0,this.setHeight(Math.max(this.widgetHeight,e.heightForLine(this.length-this.collapsed))+this.breaks*e.lineHeight)),this.outdated=!1,this}toString(){return`line(${this.length}${this.collapsed?-this.collapsed:``}${this.widgetHeight?`:`+this.widgetHeight:``})`}},Sv=class e extends _v{constructor(e){super(e,0)}heightMetrics(e,t){let n=e.doc.lineAt(t).number,r=e.doc.lineAt(t+this.length).number,i=r-n+1,a,o=0;if(e.lineWrapping){let t=Math.min(this.height,e.lineHeight*i);a=t/i,this.length>i+1&&(o=(this.height-t)/(this.length-i-1))}else a=this.height/i;return{firstLine:n,lastLine:r,perLine:a,perChar:o}}blockAt(e,t,n,r){let{firstLine:i,lastLine:a,perLine:o,perChar:s}=this.heightMetrics(t,r);if(t.lineWrapping){let i=r+(e<t.lineHeight?0:Math.round(Math.max(0,Math.min(1,(e-n)/this.height))*this.length)),a=t.doc.lineAt(i),c=o+a.length*s,l=Math.max(n,e-c/2);return new mv(a.from,a.length,l,c,0)}{let r=Math.max(0,Math.min(a-i,Math.floor((e-n)/o))),{from:s,length:c}=t.doc.line(i+r);return new mv(s,c,n+o*r,o,0)}}lineAt(e,t,n,r,i){if(t==hv.ByHeight)return this.blockAt(e,n,r,i);if(t==hv.ByPosNoHeight){let{from:t,to:r}=n.doc.lineAt(e);return new mv(t,r-t,0,0,0)}let{firstLine:a,perLine:o,perChar:s}=this.heightMetrics(n,i),c=n.doc.lineAt(e),l=o+c.length*s,u=c.number-a,d=r+o*u+s*(c.from-i-u);return new mv(c.from,c.length,Math.max(r,Math.min(d,r+this.height-l)),l,0)}forEachLine(e,t,n,r,i,a){e=Math.max(e,i),t=Math.min(t,i+this.length);let{firstLine:o,perLine:s,perChar:c}=this.heightMetrics(n,i);for(let l=e,u=r;l<=t;){let t=n.doc.lineAt(l);if(l==e){let n=t.number-o;u+=s*n+c*(e-i-n)}let r=s+c*t.length;a(new mv(t.from,t.length,u,r,0)),u+=r,l=t.to+1}}replace(t,n,r){let i=this.length-n;if(i>0){let t=r[r.length-1];t instanceof e?r[r.length-1]=new e(t.length+i):r.push(null,new e(i-1))}if(t>0){let n=r[0];n instanceof e?r[0]=new e(t+n.length):r.unshift(new e(t-1),null)}return _v.of(r)}decomposeLeft(t,n){n.push(new e(t-1),null)}decomposeRight(t,n){n.push(null,new e(this.length-t-1))}updateHeight(t,n=0,r=!1,i){let a=n+this.length;if(i&&i.from<=n+this.length&&i.more){let r=[],o=Math.max(n,i.from),s=-1;for(i.from>n&&r.push(new e(i.from-n-1).updateHeight(t,n));o<=a&&i.more;){let e=t.doc.lineAt(o).length;r.length&&r.push(null);let n=i.heights[i.index++],a=0;n<0&&(a=-n,n=i.heights[i.index++]),s==-1?s=n:Math.abs(n-s)>=gv&&(s=-2);let c=new xv(e,n,a);c.outdated=!1,r.push(c),o+=e+1}o<=a&&r.push(null,new e(a-o).updateHeight(t,o));let c=_v.of(r);return(s<0||Math.abs(c.height-this.height)>=gv||Math.abs(s-this.heightMetrics(t,n).perLine)>=gv)&&(uv=!0),vv(this,c)}return(r||this.outdated)&&(this.setHeight(t.heightForGap(n,n+this.length)),this.outdated=!1),this}toString(){return`gap(${this.length})`}},Cv=class extends _v{constructor(e,t,n){super(e.length+ +!!t+n.length,e.height+n.height,+!!t|(e.outdated||n.outdated?2:0)),this.left=e,this.right=n,this.size=e.size+n.size}get break(){return this.flags&1}blockAt(e,t,n,r){let i=n+this.left.height;return e<i?this.left.blockAt(e,t,n,r):this.right.blockAt(e,t,i,r+this.left.length+this.break)}lineAt(e,t,n,r,i){let a=r+this.left.height,o=i+this.left.length+this.break,s=t==hv.ByHeight?e<a:e<o,c=s?this.left.lineAt(e,t,n,r,i):this.right.lineAt(e,t,n,a,o);if(this.break||(s?c.to<o:c.from>o))return c;let l=t==hv.ByPosNoHeight?hv.ByPosNoHeight:hv.ByPos;return s?c.join(this.right.lineAt(o,l,n,a,o)):this.left.lineAt(o,l,n,r,i).join(c)}forEachLine(e,t,n,r,i,a){let o=r+this.left.height,s=i+this.left.length+this.break;if(this.break)e<s&&this.left.forEachLine(e,t,n,r,i,a),t>=s&&this.right.forEachLine(e,t,n,o,s,a);else{let c=this.lineAt(s,hv.ByPos,n,r,i);e<c.from&&this.left.forEachLine(e,Math.min(t,c.from-1),n,r,i,a),c.to>=e&&c.from<=t&&a(c),t>c.to&&this.right.forEachLine(Math.max(e,c.to+1),t,n,o,s,a)}}replace(e,t,n){let r=this.left.length+this.break;if(t<r)return this.balanced(this.left.replace(e,t,n),this.right);if(e>this.left.length)return this.balanced(this.left,this.right.replace(e-r,t-r,n));let i=[];e>0&&this.decomposeLeft(e,i);let a=i.length;for(let e of n)i.push(e);if(e>0&&wv(i,a-1),t<this.length){let e=i.length;this.decomposeRight(t,i),wv(i,e)}return _v.of(i)}decomposeLeft(e,t){let n=this.left.length;if(e<=n)return this.left.decomposeLeft(e,t);t.push(this.left),this.break&&(n++,e>=n&&t.push(null)),e>n&&this.right.decomposeLeft(e-n,t)}decomposeRight(e,t){let n=this.left.length,r=n+this.break;if(e>=r)return this.right.decomposeRight(e-r,t);e<n&&this.left.decomposeRight(e,t),this.break&&e<r&&t.push(null),t.push(this.right)}balanced(e,t){return e.size>2*t.size||t.size>2*e.size?_v.of(this.break?[e,null,t]:[e,t]):(this.left=vv(this.left,e),this.right=vv(this.right,t),this.setHeight(e.height+t.height),this.outdated=e.outdated||t.outdated,this.size=e.size+t.size,this.length=e.length+this.break+t.length,this)}updateHeight(e,t=0,n=!1,r){let{left:i,right:a}=this,o=t+i.length+this.break,s=null;return r&&r.from<=t+i.length&&r.more?s=i=i.updateHeight(e,t,n,r):i.updateHeight(e,t,n),r&&r.from<=o+a.length&&r.more?s=a=a.updateHeight(e,o,n,r):a.updateHeight(e,o,n),s?this.balanced(i,a):(this.height=this.left.height+this.right.height,this.outdated=!1,this)}toString(){return this.left+(this.break?` `:`-`)+this.right}};function wv(e,t){let n,r;e[t]==null&&(n=e[t-1])instanceof Sv&&(r=e[t+1])instanceof Sv&&e.splice(t-1,3,new Sv(n.length+1+r.length))}var Tv=5,Ev=class e{constructor(e,t){this.pos=e,this.oracle=t,this.nodes=[],this.lineStart=-1,this.lineEnd=-1,this.covering=null,this.writtenTo=e}get isCovered(){return this.covering&&this.nodes[this.nodes.length-1]==this.covering}span(e,t){if(this.lineStart>-1){let e=Math.min(t,this.lineEnd),n=this.nodes[this.nodes.length-1];n instanceof xv?n.length+=e-this.pos:(e>this.pos||!this.isCovered)&&this.nodes.push(new xv(e-this.pos,-1,0)),this.writtenTo=e,t>e&&(this.nodes.push(null),this.writtenTo++,this.lineStart=-1)}this.pos=t}point(e,t,n){if(e<t||n.heightRelevant){let r=n.widget?n.widget.estimatedHeight:0,i=n.widget?n.widget.lineBreaks:0;r<0&&(r=this.oracle.lineHeight);let a=t-e;n.block?this.addBlock(new bv(a,r,n)):(a||i||r>=Tv)&&this.addLineDeco(r,i,a)}else t>e&&this.span(e,t);this.lineEnd>-1&&this.lineEnd<this.pos&&(this.lineEnd=this.oracle.doc.lineAt(this.pos).to)}enterLine(){if(this.lineStart>-1)return;let{from:e,to:t}=this.oracle.doc.lineAt(this.pos);this.lineStart=e,this.lineEnd=t,this.writtenTo<e&&((this.writtenTo<e-1||this.nodes[this.nodes.length-1]==null)&&this.nodes.push(this.blankContent(this.writtenTo,e-1)),this.nodes.push(null)),this.pos>e&&this.nodes.push(new xv(this.pos-e,-1,0)),this.writtenTo=this.pos}blankContent(e,t){let n=new Sv(t-e);return this.oracle.doc.lineAt(e).to==t&&(n.flags|=4),n}ensureLine(){this.enterLine();let e=this.nodes.length?this.nodes[this.nodes.length-1]:null;if(e instanceof xv)return e;let t=new xv(0,-1,0);return this.nodes.push(t),t}addBlock(e){this.enterLine();let t=e.deco;t&&t.startSide>0&&!this.isCovered&&this.ensureLine(),this.nodes.push(e),this.writtenTo=this.pos+=e.length,t&&t.endSide>0&&(this.covering=e)}addLineDeco(e,t,n){let r=this.ensureLine();r.length+=n,r.collapsed+=n,r.widgetHeight=Math.max(r.widgetHeight,e),r.breaks+=t,this.writtenTo=this.pos+=n}finish(e){let t=this.nodes.length==0?null:this.nodes[this.nodes.length-1];this.lineStart>-1&&!(t instanceof xv)&&!this.isCovered?this.nodes.push(new xv(0,-1,0)):(this.writtenTo<this.pos||t==null)&&this.nodes.push(this.blankContent(this.writtenTo,this.pos));let n=e;for(let e of this.nodes)e instanceof xv&&e.updateHeight(this.oracle,n),n+=e?e.length:1;return this.nodes}static build(t,n,r,i){let a=new e(r,t);return Dp.spans(n,r,i,a,0),a.finish(r)}};function Dv(e,t,n){let r=new Ov;return Dp.compare(e,t,n,r,0),r.changes}var Ov=class{constructor(){this.changes=[]}compareRange(){}comparePoint(e,t,n,r){(e<t||n&&n.heightRelevant||r&&r.heightRelevant)&&Am(e,t,this.changes,5)}};function kv(e,t){let n=e.getBoundingClientRect(),r=e.ownerDocument,i=r.defaultView||window,a=Math.max(0,n.left),o=Math.min(i.innerWidth,n.right),s=Math.max(0,n.top),c=Math.min(i.innerHeight,n.bottom);for(let t=e.parentNode;t&&t!=r.body;)if(Mm(t)){let n=window.getComputedStyle(t);if((t.scrollHeight>t.clientHeight||t.scrollWidth>t.clientWidth)&&n.overflow!=`visible`){let n=t.getBoundingClientRect();a=Math.max(a,n.left),o=Math.min(o,n.right),s=Math.max(s,n.top),c=Math.min(t==e.parentNode?i.innerHeight:c,n.bottom)}t=n.position==`absolute`||n.position==`fixed`?t.offsetParent:t.parentNode}else if(t.nodeType==11)t=t.host;else break;return{left:a-n.left,right:Math.max(a,o)-n.left,top:s-(n.top+t),bottom:Math.max(s,c)-(n.top+t)}}function Av(e){let t=e.getBoundingClientRect(),n=e.ownerDocument.defaultView||window;return t.left<n.innerWidth&&t.right>0&&t.top<n.innerHeight&&t.bottom>0}function jv(e,t){let n=e.getBoundingClientRect();return{left:0,right:n.right-n.left,top:t,bottom:n.bottom-(n.top+t)}}var Mv=class{constructor(e,t,n,r){this.from=e,this.to=t,this.size=n,this.displaySize=r}static same(e,t){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++){let r=e[n],i=t[n];if(r.from!=i.from||r.to!=i.to||r.size!=i.size)return!1}return!0}draw(e,t){return wm.replace({widget:new Nv(this.displaySize*(t?e.scaleY:e.scaleX),t)}).range(this.from,this.to)}},Nv=class extends Sm{constructor(e,t){super(),this.size=e,this.vertical=t}eq(e){return e.size==this.size&&e.vertical==this.vertical}toDOM(){let e=document.createElement(`div`);return this.vertical?e.style.height=this.size+`px`:(e.style.width=this.size+`px`,e.style.height=`2px`,e.style.display=`inline-block`),e}get estimatedHeight(){return this.vertical?this.size:-1}},Pv=class{constructor(e,t){this.view=e,this.state=t,this.pixelViewport={left:0,right:window.innerWidth,top:0,bottom:0},this.inView=!0,this.paddingTop=0,this.paddingBottom=0,this.contentDOMWidth=0,this.contentDOMHeight=0,this.editorHeight=0,this.editorWidth=0,this.scaleX=1,this.scaleY=1,this.scrollOffset=0,this.scrolledToBottom=!1,this.scrollAnchorPos=0,this.scrollAnchorHeight=-1,this.scaler=Bv,this.scrollTarget=null,this.printing=!1,this.mustMeasureContent=!0,this.defaultTextDirection=ch.LTR,this.visibleRanges=[],this.mustEnforceCursorAssoc=!1;let n=t.facet($h).some(e=>typeof e!=`function`&&e.class==`cm-lineWrapping`);this.heightOracle=new fv(n),this.stateDeco=Vv(t),this.heightMap=_v.empty().applyChanges(this.stateDeco,tf.empty,this.heightOracle.setDoc(t.doc),[new lg(0,0,0,t.doc.length)]);for(let e=0;e<2&&(this.viewport=this.getViewport(0,null),this.updateForViewport());e++);this.updateViewportLines(),this.lineGaps=this.ensureLineGaps([]),this.lineGapDeco=wm.set(this.lineGaps.map(e=>e.draw(this,!1))),this.scrollParent=e.scrollDOM,this.computeVisibleRanges()}updateForViewport(){let e=[this.viewport],{main:t}=this.state.selection;for(let n=0;n<=1;n++){let r=n?t.head:t.anchor;if(!e.some(({from:e,to:t})=>r>=e&&r<=t)){let{from:t,to:n}=this.lineBlockAt(r);e.push(new Fv(t,n))}}return this.viewports=e.sort((e,t)=>e.from-t.from),this.updateScaler()}updateScaler(){let e=this.scaler;return this.scaler=this.heightMap.height<=7e6?Bv:new Hv(this.heightOracle,this.heightMap,this.viewports),e.eq(this.scaler)?0:2}updateViewportLines(){this.viewportLines=[],this.heightMap.forEachLine(this.viewport.from,this.viewport.to,this.heightOracle.setDoc(this.state.doc),0,0,e=>{this.viewportLines.push(Uv(e,this.scaler))})}update(e,t=null){this.state=e.state;let n=this.stateDeco;this.stateDeco=Vv(this.state);let r=e.changedRanges,i=lg.extendWithRanges(r,Dv(n,this.stateDeco,e?e.changes:Sf.empty(this.state.doc.length))),a=this.heightMap.height,o=this.scrolledToBottom?null:this.scrollAnchorAt(this.scrollOffset);dv(),this.heightMap=this.heightMap.applyChanges(this.stateDeco,e.startState.doc,this.heightOracle.setDoc(this.state.doc),i),(this.heightMap.height!=a||uv)&&(e.flags|=2),o?(this.scrollAnchorPos=e.changes.mapPos(o.from,-1),this.scrollAnchorHeight=o.top):(this.scrollAnchorPos=-1,this.scrollAnchorHeight=a);let s=i.length?this.mapViewport(this.viewport,e.changes):this.viewport;(t&&(t.range.head<s.from||t.range.head>s.to)||!this.viewportIsAppropriate(s))&&(s=this.getViewport(0,t));let c=s.from!=this.viewport.from||s.to!=this.viewport.to;this.viewport=s,e.flags|=this.updateForViewport(),(c||!e.changes.empty||e.flags&2)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(this.mapLineGaps(this.lineGaps,e.changes))),e.flags|=this.computeVisibleRanges(e.changes),t&&(this.scrollTarget=t),!this.mustEnforceCursorAssoc&&(e.selectionSet||e.focusChanged)&&e.view.lineWrapping&&e.state.selection.main.empty&&e.state.selection.main.assoc&&!e.state.facet(Vh)&&(this.mustEnforceCursorAssoc=!0)}measure(){let{view:e}=this,t=e.contentDOM,n=window.getComputedStyle(t),r=this.heightOracle,i=n.whiteSpace;this.defaultTextDirection=n.direction==`rtl`?ch.RTL:ch.LTR;let a=this.heightOracle.mustRefreshForWrapping(i)||this.mustMeasureContent===`refresh`,o=t.getBoundingClientRect(),s=a||this.mustMeasureContent||this.contentDOMHeight!=o.height;this.contentDOMHeight=o.height,this.mustMeasureContent=!1;let c=0,l=0;if(o.width&&o.height){let{scaleX:e,scaleY:n}=Gm(t,o);(e>.005&&Math.abs(this.scaleX-e)>.005||n>.005&&Math.abs(this.scaleY-n)>.005)&&(this.scaleX=e,this.scaleY=n,c|=16,a=s=!0)}let u=(parseInt(n.paddingTop)||0)*this.scaleY,d=(parseInt(n.paddingBottom)||0)*this.scaleY;(this.paddingTop!=u||this.paddingBottom!=d)&&(this.paddingTop=u,this.paddingBottom=d,c|=18),this.editorWidth!=e.scrollDOM.clientWidth&&(r.lineWrapping&&(s=!0),this.editorWidth=e.scrollDOM.clientWidth,c|=16);let f=qm(this.view.contentDOM,!1).y;f!=this.scrollParent&&(this.scrollParent=f,this.scrollAnchorHeight=-1,this.scrollOffset=0);let p=this.getScrollOffset();this.scrollOffset!=p&&(this.scrollAnchorHeight=-1,this.scrollOffset=p),this.scrolledToBottom=ih(this.scrollParent||e.win);let m=(this.printing?jv:kv)(t,this.paddingTop),h=m.top-this.pixelViewport.top,g=m.bottom-this.pixelViewport.bottom;this.pixelViewport=m;let _=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left;if(_!=this.inView&&(this.inView=_,_&&(s=!0)),!this.inView&&!this.scrollTarget&&!Av(e.dom))return 0;let v=o.width;if((this.contentDOMWidth!=v||this.editorHeight!=e.scrollDOM.clientHeight)&&(this.contentDOMWidth=o.width,this.editorHeight=e.scrollDOM.clientHeight,c|=16),s){let t=e.docView.measureVisibleLineHeights(this.viewport);if(r.mustRefreshForHeights(t)&&(a=!0),a||r.lineWrapping&&Math.abs(v-this.contentDOMWidth)>r.charWidth){let{lineHeight:n,charWidth:o,textHeight:s}=e.docView.measureTextSize();a=n>0&&r.refresh(i,n,o,s,Math.max(5,v/o),t),a&&(e.docView.minWidth=0,c|=16)}h>0&&g>0?l=Math.max(h,g):h<0&&g<0&&(l=Math.min(h,g)),dv();for(let n of this.viewports){let i=n.from==this.viewport.from?t:e.docView.measureVisibleLineHeights(n);this.heightMap=(a?_v.empty().applyChanges(this.stateDeco,tf.empty,this.heightOracle,[new lg(0,0,0,e.state.doc.length)]):this.heightMap).updateHeight(r,0,a,new pv(n.from,i))}uv&&(c|=2)}let y=!this.viewportIsAppropriate(this.viewport,l)||this.scrollTarget&&(this.scrollTarget.range.head<this.viewport.from||this.scrollTarget.range.head>this.viewport.to);return y&&(c&2&&(c|=this.updateScaler()),this.viewport=this.getViewport(l,this.scrollTarget),c|=this.updateForViewport()),(c&2||y)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(a?[]:this.lineGaps,e)),c|=this.computeVisibleRanges(),this.mustEnforceCursorAssoc&&(this.mustEnforceCursorAssoc=!1,e.docView.enforceCursorAssoc()),c}get visibleTop(){return this.scaler.fromDOM(this.pixelViewport.top)}get visibleBottom(){return this.scaler.fromDOM(this.pixelViewport.bottom)}getViewport(e,t){let n=.5-Math.max(-.5,Math.min(.5,e/1e3/2)),r=this.heightMap,i=this.heightOracle,{visibleTop:a,visibleBottom:o}=this,s=new Fv(r.lineAt(a-n*1e3,hv.ByHeight,i,0,0).from,r.lineAt(o+(1-n)*1e3,hv.ByHeight,i,0,0).to);if(t){let{head:e}=t.range;if(e<s.from||e>s.to){let n=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),a=r.lineAt(e,hv.ByPos,i,0,0),o;o=t.y==`center`?(a.top+a.bottom)/2-n/2:t.y==`start`||t.y==`nearest`&&e<s.from?a.top:a.bottom-n,s=new Fv(r.lineAt(o-500,hv.ByHeight,i,0,0).from,r.lineAt(o+n+500,hv.ByHeight,i,0,0).to)}}return s}mapViewport(e,t){let n=t.mapPos(e.from,-1),r=t.mapPos(e.to,1);return new Fv(this.heightMap.lineAt(n,hv.ByPos,this.heightOracle,0,0).from,this.heightMap.lineAt(r,hv.ByPos,this.heightOracle,0,0).to)}viewportIsAppropriate({from:e,to:t},n=0){if(!this.inView)return!0;let{top:r}=this.heightMap.lineAt(e,hv.ByPos,this.heightOracle,0,0),{bottom:i}=this.heightMap.lineAt(t,hv.ByPos,this.heightOracle,0,0),{visibleTop:a,visibleBottom:o}=this;return(e==0||r<=a-Math.max(10,Math.min(-n,250)))&&(t==this.state.doc.length||i>=o+Math.max(10,Math.min(n,250)))&&r>a-2e3&&i<o+2e3}mapLineGaps(e,t){if(!e.length||t.empty)return e;let n=[];for(let r of e)t.touchesRange(r.from,r.to)||n.push(new Mv(t.mapPos(r.from),t.mapPos(r.to),r.size,r.displaySize));return n}ensureLineGaps(e,t){let n=this.heightOracle.lineWrapping,r=n?1e4:2e3,i=r>>1,a=r<<1;if(this.defaultTextDirection!=ch.LTR&&!n)return[];let o=[],s=(r,a,c,l)=>{if(a-r<i)return;let u=this.state.selection.main,d=[u.from];u.empty||d.push(u.to);for(let e of d)if(e>r&&e<a){s(r,e-10,c,l),s(e+10,a,c,l);return}let f=zv(e,e=>e.from>=c.from&&e.to<=c.to&&Math.abs(e.from-r)<i&&Math.abs(e.to-a)<i&&!d.some(t=>e.from<t&&e.to>t));if(!f){if(a<c.to&&t&&n&&t.visibleRanges.some(e=>e.from<=a&&e.to>=a)){let e=t.moveToLineBoundary(W.cursor(a),!1,!0).head;e>r&&(a=e)}let e=this.gapSize(c,r,a,l);f=new Mv(r,a,e,n||e<2e6?e:2e6)}o.push(f)},c=t=>{if(t.length<a||t.type!=Cm.Text)return;let i=Iv(t.from,t.to,this.stateDeco);if(i.total<a)return;let o=this.scrollTarget?this.scrollTarget.range.head:null,c,l;if(n){let e=r/this.heightOracle.lineLength*this.heightOracle.lineHeight,n,a;if(o!=null){let r=Rv(i,o),s=((this.visibleBottom-this.visibleTop)/2+e)/t.height;n=r-s,a=r+s}else n=(this.visibleTop-t.top-e)/t.height,a=(this.visibleBottom-t.top+e)/t.height;c=Lv(i,n),l=Lv(i,a)}else{let n=i.total*this.heightOracle.charWidth,a=r*this.heightOracle.charWidth,s=0;if(n>2e6)for(let n of e)n.from>=t.from&&n.from<t.to&&n.size!=n.displaySize&&n.from*this.heightOracle.charWidth+s<this.pixelViewport.left&&(s=n.size-n.displaySize);let u=this.pixelViewport.left+s,d=this.pixelViewport.right+s,f,p;if(o!=null){let e=Rv(i,o),t=((d-u)/2+a)/n;f=e-t,p=e+t}else f=(u-a)/n,p=(d+a)/n;c=Lv(i,f),l=Lv(i,p)}c>t.from&&s(t.from,c,t,i),l<t.to&&s(l,t.to,t,i)};for(let e of this.viewportLines)Array.isArray(e.type)?e.type.forEach(c):c(e);return o}gapSize(e,t,n,r){let i=Rv(r,n)-Rv(r,t);return this.heightOracle.lineWrapping?e.height*i:r.total*this.heightOracle.charWidth*i}updateLineGaps(e){Mv.same(e,this.lineGaps)||(this.lineGaps=e,this.lineGapDeco=wm.set(e.map(e=>e.draw(this,this.heightOracle.lineWrapping))))}computeVisibleRanges(e){let t=this.stateDeco;this.lineGaps.length&&(t=t.concat(this.lineGapDeco));let n=[];Dp.spans(t,this.viewport.from,this.viewport.to,{span(e,t){n.push({from:e,to:t})},point(){}},20);let r=0;if(n.length!=this.visibleRanges.length)r=12;else for(let t=0;t<n.length&&!(r&8);t++){let i=this.visibleRanges[t],a=n[t];(i.from!=a.from||i.to!=a.to)&&(r|=4,e&&e.mapPos(i.from,-1)==a.from&&e.mapPos(i.to,1)==a.to||(r|=8))}return this.visibleRanges=n,r}lineBlockAt(e){return e>=this.viewport.from&&e<=this.viewport.to&&this.viewportLines.find(t=>t.from<=e&&t.to>=e)||Uv(this.heightMap.lineAt(e,hv.ByPos,this.heightOracle,0,0),this.scaler)}lineBlockAtHeight(e){return e>=this.viewportLines[0].top&&e<=this.viewportLines[this.viewportLines.length-1].bottom&&this.viewportLines.find(t=>t.top<=e&&t.bottom>=e)||Uv(this.heightMap.lineAt(this.scaler.fromDOM(e),hv.ByHeight,this.heightOracle,0,0),this.scaler)}getScrollOffset(){return this.scrollParent==this.view.scrollDOM?this.scrollParent.scrollTop*this.scaleY:(this.scrollParent?this.scrollParent.getBoundingClientRect().top:0)-this.view.contentDOM.getBoundingClientRect().top}scrollAnchorAt(e){let t=this.lineBlockAtHeight(e+8);return t.from>=this.viewport.from||this.viewportLines[0].top-e>200?t:this.viewportLines[0]}elementAtHeight(e){return Uv(this.heightMap.blockAt(this.scaler.fromDOM(e),this.heightOracle,0,0),this.scaler)}get docHeight(){return this.scaler.toDOM(this.heightMap.height)}get contentHeight(){return this.docHeight+this.paddingTop+this.paddingBottom}},Fv=class{constructor(e,t){this.from=e,this.to=t}};function Iv(e,t,n){let r=[],i=e,a=0;return Dp.spans(n,e,t,{span(){},point(e,t){e>i&&(r.push({from:i,to:e}),a+=e-i),i=t}},20),i<t&&(r.push({from:i,to:t}),a+=t-i),{total:a,ranges:r}}function Lv({total:e,ranges:t},n){if(n<=0)return t[0].from;if(n>=1)return t[t.length-1].to;let r=Math.floor(e*n);for(let e=0;;e++){let{from:n,to:i}=t[e],a=i-n;if(r<=a)return n+r;r-=a}}function Rv(e,t){let n=0;for(let{from:r,to:i}of e.ranges){if(t<=i){n+=t-r;break}n+=i-r}return n/e.total}function zv(e,t){for(let n of e)if(t(n))return n}var Bv={toDOM(e){return e},fromDOM(e){return e},scale:1,eq(e){return e==this}};function Vv(e){let t=e.facet(eg).filter(e=>typeof e!=`function`),n=e.facet(ng).filter(e=>typeof e!=`function`);return n.length&&t.push(Dp.join(n)),t}var Hv=class e{constructor(e,t,n){let r=0,i=0,a=0;this.viewports=n.map(({from:n,to:i})=>{let a=t.lineAt(n,hv.ByPos,e,0,0).top,o=t.lineAt(i,hv.ByPos,e,0,0).bottom;return r+=o-a,{from:n,to:i,top:a,bottom:o,domTop:0,domBottom:0}}),this.scale=(7e6-r)/(t.height-r);for(let e of this.viewports)e.domTop=a+(e.top-i)*this.scale,a=e.domBottom=e.domTop+(e.bottom-e.top),i=e.bottom}toDOM(e){for(let t=0,n=0,r=0;;t++){let i=t<this.viewports.length?this.viewports[t]:null;if(!i||e<i.top)return r+(e-n)*this.scale;if(e<=i.bottom)return i.domTop+(e-i.top);n=i.bottom,r=i.domBottom}}fromDOM(e){for(let t=0,n=0,r=0;;t++){let i=t<this.viewports.length?this.viewports[t]:null;if(!i||e<i.domTop)return n+(e-r)/this.scale;if(e<=i.domBottom)return i.top+(e-i.domTop);n=i.bottom,r=i.domBottom}}eq(t){return t instanceof e&&this.scale==t.scale&&this.viewports.length==t.viewports.length&&this.viewports.every((e,n)=>e.from==t.viewports[n].from&&e.to==t.viewports[n].to)}};function Uv(e,t){if(t.scale==1)return e;let n=t.toDOM(e.top),r=t.toDOM(e.bottom);return new mv(e.from,e.length,n,r-n,Array.isArray(e._content)?e._content.map(e=>Uv(e,t)):e._content)}var Wv=G.define({combine:e=>e.join(` `)}),Gv=G.define({combine:e=>e.indexOf(!0)>-1}),Kv=qp.newName(),qv=qp.newName(),Jv=qp.newName(),Yv={"&light":`.`+qv,"&dark":`.`+Jv};function Xv(e,t,n){return new qp(t,{finish(t){return/&/.test(t)?t.replace(/&\w*/,t=>{if(t==`&`)return e;if(!n||!n[t])throw RangeError(`Unsupported selector: ${t}`);return n[t]}):e+` `+t}})}var Zv=Xv(`.`+Kv,{"&":{position:`relative !important`,boxSizing:`border-box`,"&.cm-focused":{outline:`1px dotted #212121`},display:`flex !important`,flexDirection:`column`},".cm-scroller":{display:`flex !important`,alignItems:`flex-start !important`,fontFamily:`monospace`,lineHeight:1.4,height:`100%`,overflowX:`auto`,position:`relative`,zIndex:0,overflowAnchor:`none`},".cm-content":{margin:0,flexGrow:2,flexShrink:0,display:`block`,whiteSpace:`pre`,wordWrap:`normal`,boxSizing:`border-box`,minHeight:`100%`,padding:`4px 0`,outline:`none`,"&[contenteditable=true]":{WebkitUserModify:`read-write-plaintext-only`}},".cm-lineWrapping":{whiteSpace_fallback:`pre-wrap`,whiteSpace:`break-spaces`,wordBreak:`break-word`,overflowWrap:`anywhere`,flexShrink:1},"&light .cm-content":{caretColor:`black`},"&dark .cm-content":{caretColor:`white`},".cm-line":{display:`block`,padding:`0 2px 0 6px`},".cm-layer":{userSelect:`none`,position:`absolute`,left:0,top:0,contain:`size style`,"& > *":{position:`absolute`}},"&light .cm-selectionBackground":{background:`#d9d9d9`},"&dark .cm-selectionBackground":{background:`#222`},"&light.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:`#d7d4f0`},"&dark.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:`#233`},".cm-cursorLayer":{pointerEvents:`none`},"&.cm-focused > .cm-scroller > .cm-cursorLayer":{animation:`steps(1) cm-blink 1.2s infinite`},"@keyframes cm-blink":{"0%":{},"50%":{opacity:0},"100%":{}},"@keyframes cm-blink2":{"0%":{},"50%":{opacity:0},"100%":{}},".cm-cursor, .cm-dropCursor":{borderLeft:`1.2px solid black`,marginLeft:`-0.6px`,pointerEvents:`none`},".cm-cursor":{display:`none`},"&dark .cm-cursor":{borderLeftColor:`#ddd`},".cm-selectionHandle":{backgroundColor:`currentColor`,width:`1.5px`},".cm-selectionHandle-start::before, .cm-selectionHandle-end::before":{content:`""`,backgroundColor:`inherit`,borderRadius:`50%`,width:`8px`,height:`8px`,position:`absolute`,left:`-3.25px`},".cm-selectionHandle-start::before":{top:`-8px`},".cm-selectionHandle-end::before":{bottom:`-8px`},".cm-dropCursor":{position:`absolute`},"&.cm-focused > .cm-scroller > .cm-cursorLayer .cm-cursor":{display:`block`},".cm-iso":{unicodeBidi:`isolate`},".cm-announced":{position:`fixed`,top:`-10000px`},"@media print":{".cm-announced":{display:`none`}},"&light .cm-activeLine":{backgroundColor:`#cceeff44`},"&dark .cm-activeLine":{backgroundColor:`#99eeff33`},"&light .cm-specialChar":{color:`red`},"&dark .cm-specialChar":{color:`#f78`},".cm-gutters":{flexShrink:0,display:`flex`,height:`100%`,boxSizing:`border-box`,zIndex:200},".cm-gutters-before":{insetInlineStart:0},".cm-gutters-after":{insetInlineEnd:0},"&light .cm-gutters":{backgroundColor:`#f5f5f5`,color:`#6c6c6c`,border:`0px solid #ddd`,"&.cm-gutters-before":{borderRightWidth:`1px`},"&.cm-gutters-after":{borderLeftWidth:`1px`}},"&dark .cm-gutters":{backgroundColor:`#333338`,color:`#ccc`},".cm-gutter":{display:`flex !important`,flexDirection:`column`,flexShrink:0,boxSizing:`border-box`,minHeight:`100%`,overflow:`hidden`},".cm-gutterElement":{boxSizing:`border-box`},".cm-lineNumbers .cm-gutterElement":{padding:`0 3px 0 5px`,minWidth:`20px`,textAlign:`right`,whiteSpace:`nowrap`},"&light .cm-activeLineGutter":{backgroundColor:`#e2f2ff`},"&dark .cm-activeLineGutter":{backgroundColor:`#222227`},".cm-panels":{boxSizing:`border-box`,position:`sticky`,left:0,right:0,zIndex:300},"&light .cm-panels":{backgroundColor:`#f5f5f5`,color:`black`},".cm-panels-top":{top:`0`},".cm-panels-bottom":{bottom:`0`},"&light .cm-panels-top":{borderBottom:`1px solid #ddd`},"&light .cm-panels-bottom":{borderTop:`1px solid #ddd`},"&dark .cm-panels":{backgroundColor:`#333338`,color:`white`},".cm-dialog":{padding:`2px 19px 4px 6px`,position:`relative`,"& label":{fontSize:`80%`}},".cm-dialog-close":{position:`absolute`,top:`3px`,right:`4px`,backgroundColor:`inherit`,border:`none`,font:`inherit`,fontSize:`14px`,padding:`0`},".cm-tab":{display:`inline-block`,overflow:`hidden`,verticalAlign:`bottom`},".cm-widgetBuffer":{verticalAlign:`baseline`,height:`1em`,width:0,display:`inline`},".cm-placeholder":{color:`#888`,display:`inline-block`,verticalAlign:`top`,userSelect:`none`},".cm-highlightSpace":{background:`radial-gradient(circle at 50% 55%, #aaa 20%, transparent 0) no-repeat`,backgroundSize:`.4em`,backgroundPosition:`calc(min(50%, 0px)) center`},".cm-highlightTab":{backgroundImage:`url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="200" height="20"><path stroke="%23888" stroke-width="1" fill="none" d="M1 10H196L190 5M190 15L196 10M197 4L197 16"/></svg>')`,backgroundSize:`auto 100%`,backgroundPosition:`right 90%`,backgroundRepeat:`no-repeat`},".cm-trailingSpace":{backgroundColor:`#ff332255`},".cm-button":{verticalAlign:`middle`,color:`inherit`,fontSize:`70%`,padding:`.2em 1em`,borderRadius:`1px`},"&light .cm-button":{backgroundImage:`linear-gradient(#eff1f5, #d9d9df)`,border:`1px solid #888`,"&:active":{backgroundImage:`linear-gradient(#b4b4b4, #d0d3d6)`}},"&dark .cm-button":{backgroundImage:`linear-gradient(#393939, #111)`,border:`1px solid #888`,"&:active":{backgroundImage:`linear-gradient(#111, #333)`}},".cm-textfield":{verticalAlign:`middle`,color:`inherit`,fontSize:`70%`,border:`1px solid silver`,padding:`.2em .5em`},"&light .cm-textfield":{backgroundColor:`white`},"&dark .cm-textfield":{border:`1px solid #555`,backgroundColor:`inherit`}},Yv),Qv={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},$v=K.ie&&K.ie_version<=11,ey=class{constructor(e){this.view=e,this.active=!1,this.editContext=null,this.selectionRange=new Jm,this.selectionChanged=!1,this.delayedFlush=-1,this.resizeTimeout=-1,this.queue=[],this.delayedAndroidKey=null,this.flushingAndroidKey=-1,this.lastChange=0,this.scrollTargets=[],this.intersection=null,this.resizeScroll=null,this.intersecting=!1,this.gapIntersection=null,this.gaps=[],this.printQuery=null,this.parentCheck=-1,this.dom=e.contentDOM,this.observer=new MutationObserver(t=>{for(let e of t)this.queue.push(e);(K.ie&&K.ie_version<=11||K.ios&&e.composing)&&t.some(e=>e.type==`childList`&&e.removedNodes.length||e.type==`characterData`&&e.oldValue.length>e.target.nodeValue.length)?this.flushSoon():this.flush()}),window.EditContext&&K.android&&e.constructor.EDIT_CONTEXT!==!1&&!(K.chrome&&K.chrome_version<126)&&(this.editContext=new iy(e),e.state.facet(qh)&&(e.contentDOM.editContext=this.editContext.editContext)),$v&&(this.onCharData=e=>{this.queue.push({target:e.target,type:`characterData`,oldValue:e.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this),this.onResize=this.onResize.bind(this),this.onPrint=this.onPrint.bind(this),this.onScroll=this.onScroll.bind(this),window.matchMedia&&(this.printQuery=window.matchMedia(`print`)),typeof ResizeObserver==`function`&&(this.resizeScroll=new ResizeObserver(()=>{this.view.docView?.lastUpdate<Date.now()-75&&this.onResize()}),this.resizeScroll.observe(e.scrollDOM)),this.addWindowListeners(this.win=e.win),this.start(),typeof IntersectionObserver==`function`&&(this.intersection=new IntersectionObserver(e=>{this.parentCheck<0&&(this.parentCheck=setTimeout(this.listenForScroll.bind(this),1e3)),e.length>0&&e[e.length-1].intersectionRatio>0!=this.intersecting&&(this.intersecting=!this.intersecting,this.intersecting!=this.view.inView&&this.onScrollChanged(document.createEvent(`Event`)))},{threshold:[0,.001]}),this.intersection.observe(this.dom),this.gapIntersection=new IntersectionObserver(e=>{e.length>0&&e[e.length-1].intersectionRatio>0&&this.onScrollChanged(document.createEvent(`Event`))},{})),this.listenForScroll(),this.readSelectionRange()}onScrollChanged(e){this.view.inputState.runHandlers(`scroll`,e),this.intersecting&&this.view.measure()}onScroll(e){this.intersecting&&this.flush(!1),this.editContext&&this.view.requestMeasure(this.editContext.measureReq),this.onScrollChanged(e)}onResize(){this.resizeTimeout<0&&(this.resizeTimeout=setTimeout(()=>{this.resizeTimeout=-1,this.view.requestMeasure()},50))}onPrint(e){(e.type!=`change`&&e.type||e.matches)&&(this.view.viewState.printing=!0,this.view.measure(),setTimeout(()=>{this.view.viewState.printing=!1,this.view.requestMeasure()},500))}updateGaps(e){if(this.gapIntersection&&(e.length!=this.gaps.length||this.gaps.some((t,n)=>t!=e[n]))){this.gapIntersection.disconnect();for(let t of e)this.gapIntersection.observe(t);this.gaps=e}}onSelectionChange(e){let t=this.selectionChanged;if(!this.readSelectionRange()||this.delayedAndroidKey)return;let{view:n}=this,r=this.selectionRange;if(n.state.facet(qh)?n.root.activeElement!=this.dom:!Im(this.dom,r))return;let i=r.anchorNode&&n.docView.tile.nearest(r.anchorNode);if(i&&i.isWidget()&&i.widget.ignoreEvent(e)){t||(this.selectionChanged=!1);return}(K.ie&&K.ie_version<=11||K.android&&K.chrome)&&!n.state.selection.main.empty&&r.focusNode&&Rm(r.focusNode,r.focusOffset,r.anchorNode,r.anchorOffset)?this.flushSoon():this.flush(!1)}readSelectionRange(){let{view:e}=this,t=Pm(e.root);if(!t)return!1;let n=K.safari&&e.root.nodeType==11&&e.root.activeElement==this.dom&&ry(this.view,t)||t;if(!n||this.selectionRange.eq(n))return!1;let r=Im(this.dom,n);return r&&!this.selectionChanged&&e.inputState.lastFocusTime>Date.now()-200&&e.inputState.lastTouchTime<Date.now()-300&&rh(this.dom,n)?(this.view.inputState.lastFocusTime=0,e.docView.updateSelection(),!1):(this.selectionRange.setRange(n),r&&(this.selectionChanged=!0),!0)}setSelectionRange(e,t){this.selectionRange.set(e.node,e.offset,t.node,t.offset),this.selectionChanged=!1}clearSelectionRange(){this.selectionRange.set(null,0,null,0)}listenForScroll(){this.parentCheck=-1;let e=0,t=null;for(let n=this.dom;n;)if(Mm(n))!t&&e<this.scrollTargets.length&&this.scrollTargets[e]==n?e++:t||=this.scrollTargets.slice(0,e),t&&t.push(n),n=n.assignedSlot||n.parentNode;else if(n.nodeType==11)n=n.host;else break;if(e<this.scrollTargets.length&&!t&&(t=this.scrollTargets.slice(0,e)),t){for(let e of this.scrollTargets)e.removeEventListener(`scroll`,this.onScroll);for(let e of this.scrollTargets=t)e.addEventListener(`scroll`,this.onScroll)}}ignore(e){if(!this.active)return e();try{return this.stop(),e()}finally{this.start(),this.clear()}}start(){this.active||=(this.observer.observe(this.dom,Qv),$v&&this.dom.addEventListener(`DOMCharacterDataModified`,this.onCharData),!0)}stop(){this.active&&(this.active=!1,this.observer.disconnect(),$v&&this.dom.removeEventListener(`DOMCharacterDataModified`,this.onCharData))}clear(){this.processRecords(),this.queue.length=0,this.selectionChanged=!1}delayAndroidKey(e,t){if(!this.delayedAndroidKey){let e=()=>{let e=this.delayedAndroidKey;e&&(this.clearDelayedAndroidKey(),this.view.inputState.lastKeyCode=e.keyCode,this.view.inputState.lastKeyTime=Date.now(),!this.flush()&&e.force&&th(this.dom,e.key,e.keyCode))};this.flushingAndroidKey=this.view.win.requestAnimationFrame(e)}(!this.delayedAndroidKey||e==`Enter`)&&(this.delayedAndroidKey={key:e,keyCode:t,force:this.lastChange<Date.now()-50||!!this.delayedAndroidKey?.force})}clearDelayedAndroidKey(){this.win.cancelAnimationFrame(this.flushingAndroidKey),this.delayedAndroidKey=null,this.flushingAndroidKey=-1}flushSoon(){this.delayedFlush<0&&(this.delayedFlush=this.view.win.requestAnimationFrame(()=>{this.delayedFlush=-1,this.flush()}))}forceFlush(){this.delayedFlush>=0&&(this.view.win.cancelAnimationFrame(this.delayedFlush),this.delayedFlush=-1),this.flush()}pendingRecords(){for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}processRecords(){let e=this.pendingRecords();e.length&&(this.queue=[]);let t=-1,n=-1,r=!1;for(let i of e){let e=this.readMutation(i);e&&(e.typeOver&&(r=!0),t==-1?{from:t,to:n}=e:(t=Math.min(e.from,t),n=Math.max(e.to,n)))}return{from:t,to:n,typeOver:r}}readChange(){let{from:e,to:t,typeOver:n}=this.processRecords(),r=this.selectionChanged&&Im(this.dom,this.selectionRange);if(e<0&&!r)return null;e>-1&&(this.lastChange=Date.now()),this.view.inputState.lastFocusTime=0,this.selectionChanged=!1;let i=new g_(this.view,e,t,n);return this.view.docView.domChanged={newSel:i.newSel?i.newSel.main:null},i}flush(e=!0){if(this.delayedFlush>=0||this.delayedAndroidKey)return!1;e&&this.readSelectionRange();let t=this.selectionChanged,n=this.readChange();if(!n)return this.view.requestMeasure(),!1;let r=this.view.state,i=v_(this.view,n);return this.view.state==r&&(n.domChanged||t)&&this.view.update([]),i}readMutation(e){let t=this.view.docView.tile.nearest(e.target);if(!t||t.isWidget())return null;if(t.markDirty(e.type==`attributes`),e.type==`childList`){let n=ty(t,e.previousSibling||e.target.previousSibling,-1),r=ty(t,e.nextSibling||e.target.nextSibling,1);return{from:n?t.posAfter(n):t.posAtStart,to:r?t.posBefore(r):t.posAtEnd,typeOver:!1}}return e.type==`characterData`?{from:t.posAtStart,to:t.posAtEnd,typeOver:e.target.nodeValue==e.oldValue}:null}setWindow(e){e!=this.win&&(this.removeWindowListeners(this.win),this.win=e,this.addWindowListeners(this.win))}addWindowListeners(e){e.addEventListener(`resize`,this.onResize),this.printQuery?this.printQuery.addEventListener?this.printQuery.addEventListener(`change`,this.onPrint):this.printQuery.addListener(this.onPrint):e.addEventListener(`beforeprint`,this.onPrint),e.addEventListener(`scroll`,this.onScroll),e.document.addEventListener(`selectionchange`,this.onSelectionChange)}removeWindowListeners(e){e.removeEventListener(`scroll`,this.onScroll),e.removeEventListener(`resize`,this.onResize),this.printQuery?this.printQuery.removeEventListener?this.printQuery.removeEventListener(`change`,this.onPrint):this.printQuery.removeListener(this.onPrint):e.removeEventListener(`beforeprint`,this.onPrint),e.document.removeEventListener(`selectionchange`,this.onSelectionChange)}update(e){this.editContext&&(this.editContext.update(e),e.startState.facet(qh)!=e.state.facet(qh)&&(e.view.contentDOM.editContext=e.state.facet(qh)?this.editContext.editContext:null))}destroy(){var e,t,n;this.stop(),(e=this.intersection)==null||e.disconnect(),(t=this.gapIntersection)==null||t.disconnect(),(n=this.resizeScroll)==null||n.disconnect();for(let e of this.scrollTargets)e.removeEventListener(`scroll`,this.onScroll);this.removeWindowListeners(this.win),clearTimeout(this.parentCheck),clearTimeout(this.resizeTimeout),this.win.cancelAnimationFrame(this.delayedFlush),this.win.cancelAnimationFrame(this.flushingAndroidKey),this.editContext&&(this.view.contentDOM.editContext=null,this.editContext.destroy())}};function ty(e,t,n){for(;t;){let r=fg.get(t);if(r&&r.parent==e)return r;let i=t.parentNode;t=i==e.dom?n>0?t.nextSibling:t.previousSibling:i}return null}function ny(e,t){let n=t.startContainer,r=t.startOffset,i=t.endContainer,a=t.endOffset,o=e.docView.domAtPos(e.state.selection.main.anchor,1);return Rm(o.node,o.offset,i,a)&&([n,r,i,a]=[i,a,n,r]),{anchorNode:n,anchorOffset:r,focusNode:i,focusOffset:a}}function ry(e,t){if(t.getComposedRanges){let n=t.getComposedRanges(e.root)[0];if(n)return ny(e,n)}let n=null;function r(e){e.preventDefault(),e.stopImmediatePropagation(),n=e.getTargetRanges()[0]}return e.contentDOM.addEventListener(`beforeinput`,r,!0),e.dom.ownerDocument.execCommand(`indent`),e.contentDOM.removeEventListener(`beforeinput`,r,!0),n?ny(e,n):null}var iy=class{constructor(e){this.from=0,this.to=0,this.pendingContextChange=null,this.handlers=Object.create(null),this.composing=null,this.resetRange(e.state);let t=this.editContext=new window.EditContext({text:e.state.doc.sliceString(this.from,this.to),selectionStart:this.toContextPos(Math.max(this.from,Math.min(this.to,e.state.selection.main.anchor))),selectionEnd:this.toContextPos(e.state.selection.main.head)});this.handlers.textupdate=n=>{let r=e.state.selection.main,{anchor:i,head:a}=r,o=this.toEditorPos(n.updateRangeStart),s=this.toEditorPos(n.updateRangeEnd);e.inputState.composing>=0&&!this.composing&&(this.composing={contextBase:n.updateRangeStart,editorBase:o,drifted:!1});let c=s-o>n.text.length;o==this.from&&i<this.from?o=i:s==this.to&&i>this.to&&(s=i);let l=x_(e.state.sliceDoc(o,s),n.text,(c?r.from:r.to)-o,c?`end`:null);if(!l){let t=W.single(this.toEditorPos(n.selectionStart),this.toEditorPos(n.selectionEnd));w_(t,r)||e.dispatch({selection:t,userEvent:`select`});return}let u={from:l.from+o,to:l.toA+o,insert:tf.of(n.text.slice(l.from,l.toB).split(`
|
|
20
|
+
`))};if((K.mac||K.android)&&u.from==a-1&&/^\. ?$/.test(n.text)&&e.contentDOM.getAttribute(`autocorrect`)==`off`&&(u={from:o,to:s,insert:tf.of([n.text.replace(`.`,` `)])}),this.pendingContextChange=u,!e.state.readOnly){let t=this.to-this.from+(u.to-u.from+u.insert.length);y_(e,u,W.single(this.toEditorPos(n.selectionStart,t),this.toEditorPos(n.selectionEnd,t)))}this.pendingContextChange&&(this.revertPending(e.state),this.setSelection(e.state)),u.from<u.to&&!u.insert.length&&e.inputState.composing>=0&&!/[\\p{Alphabetic}\\p{Number}_]/.test(t.text.slice(Math.max(0,n.updateRangeStart-1),Math.min(t.text.length,n.updateRangeStart+1)))&&this.handlers.compositionend(n)},this.handlers.characterboundsupdate=n=>{let r=[],i=null;for(let t=this.toEditorPos(n.rangeStart),a=this.toEditorPos(n.rangeEnd);t<a;t++){let n=e.coordsForChar(t);i=n&&new DOMRect(n.left,n.top,n.right-n.left,n.bottom-n.top)||i||new DOMRect,r.push(i)}t.updateCharacterBounds(n.rangeStart,r)},this.handlers.textformatupdate=t=>{let n=[];for(let e of t.getTextFormats()){let t=e.underlineStyle,r=e.underlineThickness;if(!/none/i.test(t)&&!/none/i.test(r)){let i=this.toEditorPos(e.rangeStart),a=this.toEditorPos(e.rangeEnd);if(i<a){let e=`text-decoration: underline ${/^[a-z]/.test(t)?t+` `:t==`Dashed`?`dashed `:t==`Squiggle`?`wavy `:``}${/thin/i.test(r)?1:2}px`;n.push(wm.mark({attributes:{style:e}}).range(i,a))}}}e.dispatch({effects:Gh.of(wm.set(n))})},this.handlers.compositionstart=()=>{e.inputState.composing<0&&(e.inputState.composing=0,e.inputState.compositionFirstChange=!0)},this.handlers.compositionend=()=>{if(e.inputState.composing=-1,e.inputState.compositionFirstChange=null,this.composing){let{drifted:t}=this.composing;this.composing=null,t&&this.reset(e.state)}};for(let e in this.handlers)t.addEventListener(e,this.handlers[e]);this.measureReq={read:e=>{let t=Pm(e.root);t&&t.rangeCount&&this.editContext.updateSelectionBounds(t.getRangeAt(0).getBoundingClientRect())}}}applyEdits(e){let t=0,n=!1,r=this.pendingContextChange;return e.changes.iterChanges((i,a,o,s,c)=>{if(n)return;let l=c.length-(a-i);if(r&&a>=r.to){if(r.from==i&&r.to==a&&r.insert.eq(c)){r=this.pendingContextChange=null,t+=l,this.to+=l;return}r=null,this.revertPending(e.state)}if(i+=t,a+=t,a<=this.from)this.from+=l,this.to+=l;else if(i<this.to){if(i<this.from||a>this.to||this.to-this.from+c.length>3e4){n=!0;return}this.editContext.updateText(this.toContextPos(i),this.toContextPos(a),c.toString()),this.to+=l}t+=l}),r&&!n&&this.revertPending(e.state),!n}update(e){let t=this.pendingContextChange,n=e.startState.selection.main;this.composing&&(this.composing.drifted||!e.changes.touchesRange(n.from,n.to)&&e.transactions.some(e=>!e.isUserEvent(`input.type`)&&e.changes.touchesRange(this.from,this.to)))?(this.composing.drifted=!0,this.composing.editorBase=e.changes.mapPos(this.composing.editorBase)):!this.applyEdits(e)||!this.rangeIsValid(e.state)?(this.pendingContextChange=null,this.reset(e.state)):(e.docChanged||e.selectionSet||t)&&this.setSelection(e.state),(e.geometryChanged||e.docChanged||e.selectionSet)&&e.view.requestMeasure(this.measureReq)}resetRange(e){let{head:t}=e.selection.main;this.from=Math.max(0,t-1e4),this.to=Math.min(e.doc.length,t+1e4)}reset(e){this.resetRange(e),this.editContext.updateText(0,this.editContext.text.length,e.doc.sliceString(this.from,this.to)),this.setSelection(e)}revertPending(e){let t=this.pendingContextChange;this.pendingContextChange=null,this.editContext.updateText(this.toContextPos(t.from),this.toContextPos(t.from+t.insert.length),e.doc.sliceString(t.from,t.to))}setSelection(e){let{main:t}=e.selection,n=this.toContextPos(Math.max(this.from,Math.min(this.to,t.anchor))),r=this.toContextPos(t.head);(this.editContext.selectionStart!=n||this.editContext.selectionEnd!=r)&&this.editContext.updateSelection(n,r)}rangeIsValid(e){let{head:t}=e.selection.main;return!(this.from>0&&t-this.from<500||this.to<e.doc.length&&this.to-t<500||this.to-this.from>3e4)}toEditorPos(e,t=this.to-this.from){e=Math.min(e,t);let n=this.composing;return n&&n.drifted?n.editorBase+(e-n.contextBase):e+this.from}toContextPos(e){let t=this.composing;return t&&t.drifted?t.contextBase+(e-t.editorBase):e-this.from}destroy(){for(let e in this.handlers)this.editContext.removeEventListener(e,this.handlers[e])}},q=class e{get state(){return this.viewState.state}get viewport(){return this.viewState.viewport}get visibleRanges(){return this.viewState.visibleRanges}get inView(){return this.viewState.inView}get composing(){return!!this.inputState&&this.inputState.composing>0}get compositionStarted(){return!!this.inputState&&this.inputState.composing>=0}get root(){return this._root}get win(){return this.dom.ownerDocument.defaultView||window}constructor(e={}){this.plugins=[],this.pluginMap=new Map,this.editorAttrs={},this.contentAttrs={},this.bidiCache=[],this.destroyed=!1,this.updateState=2,this.measureScheduled=-1,this.measureRequests=[],this.clearAnnouncement=-1,this.contentDOM=document.createElement(`div`),this.scrollDOM=document.createElement(`div`),this.scrollDOM.tabIndex=-1,this.scrollDOM.className=`cm-scroller`,this.scrollDOM.appendChild(this.contentDOM),this.announceDOM=document.createElement(`div`),this.announceDOM.className=`cm-announced`,this.announceDOM.setAttribute(`aria-live`,`polite`),this.dom=document.createElement(`div`),this.dom.appendChild(this.announceDOM),this.dom.appendChild(this.scrollDOM),e.parent&&e.parent.appendChild(this.dom);let{dispatch:t}=e;this.dispatchTransactions=e.dispatchTransactions||t&&(e=>e.forEach(e=>t(e,this)))||(e=>this.update(e)),this.dispatch=this.dispatch.bind(this),this._root=e.root||nh(e.parent)||document,this.viewState=new Pv(this,e.state||bp.create(e)),e.scrollTo&&e.scrollTo.is(Wh)&&(this.viewState.scrollTarget=e.scrollTo.value.clip(this.viewState.state)),this.plugins=this.state.facet(Yh).map(e=>new Zh(e));for(let e of this.plugins)e.update(this);this.observer=new ey(this),this.inputState=new T_(this),this.inputState.ensureHandlers(this.plugins),this.docView=new zg(this),this.mountStyles(),this.updateAttrs(),this.updateState=0,this.requestMeasure(),document.fonts?.ready&&document.fonts.ready.then(()=>{this.viewState.mustMeasureContent=`refresh`,this.requestMeasure()})}dispatch(...e){let t=e.length==1&&e[0]instanceof op?e:e.length==1&&Array.isArray(e[0])?e[0]:[this.state.update(...e)];this.dispatchTransactions(t,this)}update(t){if(this.updateState!=0)throw Error(`Calls to EditorView.update are not allowed while an update is in progress`);let n=!1,r=!1,i,a=this.state;for(let e of t){if(e.startState!=a)throw RangeError(`Trying to update state with a transaction that doesn't start from the previous state.`);a=e.state}if(this.destroyed){this.viewState.state=a;return}let o=this.hasFocus,s=0,c=null;t.some(e=>e.annotation(iv))?(this.inputState.notifiedFocused=o,s=1):o!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=o,c=av(a,o),c||(s=1));let l=this.observer.delayedAndroidKey,u=null;if(l?(this.observer.clearDelayedAndroidKey(),u=this.observer.readChange(),(u&&!this.state.doc.eq(a.doc)||!this.state.selection.eq(a.selection))&&(u=null)):this.observer.clear(),a.facet(bp.phrases)!=this.state.facet(bp.phrases))return this.setState(a);i=ug.create(this,a,t),i.flags|=s;let d=this.viewState.scrollTarget;try{this.updateState=2;for(let n of t){if(d&&=d.map(n.changes),n.scrollIntoView){let{main:t}=n.state.selection,{x:r,y:i}=this.state.facet(e.cursorScrollMargin);d=new Uh(t.empty?t:W.cursor(t.head,t.head>t.anchor?-1:1),`nearest`,`nearest`,i,r)}for(let e of n.effects)e.is(Wh)&&(d=e.value.clip(this.state))}this.viewState.update(i,d),this.bidiCache=sy.update(this.bidiCache,i.changes),i.empty||(this.updatePlugins(i),this.inputState.update(i)),n=this.docView.update(i),this.state.facet(cg)!=this.styleModules&&this.mountStyles(),r=this.updateAttrs(),this.showAnnouncements(t),this.docView.updateSelection(n,t.some(e=>e.isUserEvent(`select.pointer`)))}finally{this.updateState=0}if(i.startState.facet(Wv)!=i.state.facet(Wv)&&(this.viewState.mustMeasureContent=!0),(n||r||d||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),n&&this.docViewUpdate(),!i.empty)for(let e of this.state.facet(Fh))try{e(i)}catch(e){Kh(this.state,e,`update listener`)}(c||u)&&Promise.resolve().then(()=>{c&&this.state==c.startState&&this.dispatch(c),u&&!v_(this,u)&&l.force&&th(this.contentDOM,l.key,l.keyCode)})}setState(e){if(this.updateState!=0)throw Error(`Calls to EditorView.setState are not allowed while an update is in progress`);if(this.destroyed){this.viewState.state=e;return}this.updateState=2;let t=this.hasFocus;try{for(let e of this.plugins)e.destroy(this);this.viewState=new Pv(this,e),this.plugins=e.facet(Yh).map(e=>new Zh(e)),this.pluginMap.clear();for(let e of this.plugins)e.update(this);this.docView.destroy(),this.docView=new zg(this),this.inputState.ensureHandlers(this.plugins),this.mountStyles(),this.updateAttrs(),this.bidiCache=[]}finally{this.updateState=0}t&&this.focus(),this.requestMeasure()}updatePlugins(e){let t=e.startState.facet(Yh),n=e.state.facet(Yh);if(t!=n){let r=[];for(let i of n){let n=t.indexOf(i);if(n<0)r.push(new Zh(i));else{let t=this.plugins[n];t.mustUpdate=e,r.push(t)}}for(let t of this.plugins)t.mustUpdate!=e&&t.destroy(this);this.plugins=r,this.pluginMap.clear()}else for(let t of this.plugins)t.mustUpdate=e;for(let e=0;e<this.plugins.length;e++)this.plugins[e].update(this);t!=n&&this.inputState.ensureHandlers(this.plugins)}docViewUpdate(){for(let e of this.plugins){let t=e.value;if(t&&t.docViewUpdate)try{t.docViewUpdate(this)}catch(e){Kh(this.state,e,`doc view update listener`)}}}measure(e=!0){if(this.destroyed)return;if(this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.observer.delayedAndroidKey){this.measureScheduled=-1,this.requestMeasure();return}this.measureScheduled=0,e&&this.observer.forceFlush();let t=null,n=this.viewState.scrollParent,r=this.viewState.getScrollOffset(),{scrollAnchorPos:i,scrollAnchorHeight:a,scaleY:o}=this.viewState;Math.abs(r-this.viewState.scrollOffset)>1&&(a=-1),this.viewState.scrollAnchorHeight=-1;try{for(let e=0;;e++){if(a<0){if(ih(n||this.win))i=-1,a=this.viewState.heightMap.height/this.viewState.scaleY;else{let e=this.viewState.scrollAnchorAt(r);i=e.from,a=e.top}o=this.viewState.scaleY}this.updateState=1;let s=this.viewState.measure();if(!s&&!this.measureRequests.length&&this.viewState.scrollTarget==null)break;if(e>5){console.warn(this.measureRequests.length?`Measure loop restarted more than 5 times`:`Viewport failed to stabilize`);break}let c=[];s&4||([this.measureRequests,c]=[c,this.measureRequests]);let l=c.map(e=>{try{return e.read(this)}catch(e){return Kh(this.state,e),oy}}),u=ug.create(this,this.state,[]),d=!1;u.flags|=s,t?t.flags|=s:t=u,this.updateState=2,u.empty||(this.updatePlugins(u),this.inputState.update(u),this.updateAttrs(),d=this.docView.update(u),d&&this.docViewUpdate());for(let e=0;e<c.length;e++)if(l[e]!=oy)try{let t=c[e];t.write&&t.write(l[e],this)}catch(e){Kh(this.state,e)}if(d&&this.docView.updateSelection(!0),!u.viewportChanged&&this.measureRequests.length==0){if(this.viewState.editorHeight){if(this.viewState.scrollTarget){this.docView.scrollIntoView(this.viewState.scrollTarget),this.viewState.scrollTarget=null,a=-1;continue}{let e=(i<0?this.viewState.heightMap.height:this.viewState.lineBlockAt(i).top)/this.viewState.scaleY-a/o;if((e>1||e<-1)&&!(K.ios&&this.inputState.lastIOSMomentumScroll>Date.now()-100)&&(n==this.scrollDOM||this.hasFocus||Math.max(this.inputState.lastWheelEvent,this.inputState.lastTouchTime)>Date.now()-100)){r+=e,n?i<0?n.scrollTop=n.scrollHeight:n.scrollTop+=e:this.win.scrollBy(0,e),a=-1;continue}}}break}}}finally{this.updateState=0,this.measureScheduled=-1}if(t&&!t.empty)for(let e of this.state.facet(Fh))e(t)}get themeClasses(){return Kv+` `+(this.state.facet(Gv)?Jv:qv)+` `+this.state.facet(Wv)}updateAttrs(){let e=cy(this,Qh,{class:`cm-editor`+(this.hasFocus?` cm-focused `:` `)+this.themeClasses}),t={spellcheck:`false`,autocorrect:`off`,autocapitalize:`off`,writingsuggestions:`false`,translate:`no`,contenteditable:this.state.facet(qh)?`true`:`false`,class:`cm-content`,style:`${K.tabSize}: ${this.state.tabSize}`,role:`textbox`,"aria-multiline":`true`};this.state.readOnly&&(t[`aria-readonly`]=`true`),cy(this,$h,t);let n=this.observer.ignore(()=>{let n=bm(this.contentDOM,this.contentAttrs,t),r=bm(this.dom,this.editorAttrs,e);return n||r});return this.editorAttrs=e,this.contentAttrs=t,n}showAnnouncements(t){let n=!0;for(let r of t)for(let t of r.effects)if(t.is(e.announce)){n&&=(this.announceDOM.textContent=``,this.win.clearTimeout(this.clearAnnouncement),this.clearAnnouncement=this.win.setTimeout(()=>{this.announceDOM.textContent=`\xA0`},200),!1);let e=this.announceDOM.appendChild(document.createElement(`div`));e.textContent=t.value}}mountStyles(){this.styleModules=this.state.facet(cg);let t=this.state.facet(e.cspNonce);qp.mount(this.root,this.styleModules.concat(Zv).reverse(),t?{nonce:t}:void 0)}readMeasured(){if(this.updateState==2)throw Error(`Reading the editor layout isn't allowed during an update`);this.updateState==0&&this.measureScheduled>-1&&this.measure(!1)}requestMeasure(e){if(this.measureScheduled<0&&(this.measureScheduled=this.win.requestAnimationFrame(()=>this.measure())),e){if(this.measureRequests.indexOf(e)>-1)return;if(e.key!=null){for(let t=0;t<this.measureRequests.length;t++)if(this.measureRequests[t].key===e.key){this.measureRequests[t]=e;return}}this.measureRequests.push(e)}}plugin(e){let t=this.pluginMap.get(e);return(t===void 0||t&&t.plugin!=e)&&this.pluginMap.set(e,t=this.plugins.find(t=>t.plugin==e)||null),t&&t.update(this).value}get documentTop(){return this.contentDOM.getBoundingClientRect().top+this.viewState.paddingTop}get documentPadding(){return{top:this.viewState.paddingTop,bottom:this.viewState.paddingBottom}}get scaleX(){return this.viewState.scaleX}get scaleY(){return this.viewState.scaleY}elementAtHeight(e){return this.readMeasured(),this.viewState.elementAtHeight(e)}lineBlockAtHeight(e){return this.readMeasured(),this.viewState.lineBlockAtHeight(e)}get viewportLineBlocks(){return this.viewState.viewportLines}lineBlockAt(e){return this.viewState.lineBlockAt(e)}get contentHeight(){return this.viewState.contentHeight}moveByChar(e,t,n){return s_(this,e,n_(this,e,t,n))}moveByGroup(e,t){return s_(this,e,n_(this,e,t,t=>r_(this,e.head,t)))}visualLineSide(e,t){return t?W.cursor(e.to,1):W.cursor(e.from,-1)}moveToLineBoundary(e,t,n=!0){return t_(this,e,t,n)}moveVertically(e,t,n){return s_(this,e,i_(this,e,t,n))}domAtPos(e,t=1){return this.docView.domAtPos(e,t)}posAtDOM(e,t=0){return this.docView.posFromDOM(e,t)}posAtCoords(e,t=!0){this.readMeasured();let n=l_(this,e,t);return n&&n.pos}posAndSideAtCoords(e,t=!0){return this.readMeasured(),l_(this,e,t)}coordsAtPos(e,t=1){this.readMeasured();let n=this.state.doc.lineAt(e),r=this.bidiSpans(n),i=r[vh.find(r,e-n.from,-1,t)];return n.length&&(e==n.from&&t<0||e==n.to&&t>0)&&i.dir!=this.textDirectionAt(n.from)&&(e==n.to?(e=n.from+i.from,t=1):(e=n.from+i.to,t=-1)),this.docView.coordsAt(e,t,i.dir==ch.RTL)}coordsForChar(e){return this.readMeasured(),this.docView.coordsForChar(e)}get defaultCharacterWidth(){return this.viewState.heightOracle.charWidth}get defaultLineHeight(){return this.viewState.heightOracle.lineHeight}get textDirection(){return this.viewState.defaultTextDirection}textDirectionAt(e){return!this.state.facet(Bh)||e<this.viewport.from||e>this.viewport.to?this.textDirection:(this.readMeasured(),this.docView.textDirectionAt(e))}get lineWrapping(){return this.viewState.heightOracle.lineWrapping}bidiSpans(e){if(e.length>ay)return Dh(e.length);let t=this.textDirectionAt(e.from),n;for(let r of this.bidiCache)if(r.from==e.from&&r.dir==t&&(r.fresh||yh(r.isolates,n=ag(this,e))))return r.order;n||=ag(this,e);let r=Eh(e.text,t,n);return this.bidiCache.push(new sy(e.from,e.to,t,n,!0,r)),r}get hasFocus(){return(this.dom.ownerDocument.hasFocus()||K.safari&&this.inputState?.lastContextMenu>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore(()=>{Qm(this.contentDOM),this.docView.updateSelection()})}setRoot(e){this._root!=e&&(this._root=e,this.observer.setWindow((e.nodeType==9?e:e.ownerDocument).defaultView||window),this.mountStyles())}destroy(){this.root.activeElement==this.contentDOM&&this.contentDOM.blur();for(let e of this.plugins)e.destroy(this);this.plugins=[],this.inputState.destroy(),this.docView.destroy(),this.dom.remove(),this.observer.destroy(),this.win.clearTimeout(this.clearAnnouncement),this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.destroyed=!0}static scrollIntoView(e,t={}){return Wh.of(new Uh(typeof e==`number`?W.cursor(e):e,t.y??`nearest`,t.x??`nearest`,t.yMargin??5,t.xMargin??5))}scrollSnapshot(){let{scrollTop:e,scrollLeft:t}=this.scrollDOM,n=this.viewState.scrollAnchorAt(e);return Wh.of(new Uh(W.cursor(n.from),`start`,`start`,n.top-e,t,!0))}setTabFocusMode(e){e==null?this.inputState.tabFocusMode=this.inputState.tabFocusMode<0?0:-1:typeof e==`boolean`?this.inputState.tabFocusMode=e?0:-1:this.inputState.tabFocusMode!=0&&(this.inputState.tabFocusMode=Date.now()+e)}static domEventHandlers(e){return Xh.define(()=>({}),{eventHandlers:e})}static domEventObservers(e){return Xh.define(()=>({}),{eventObservers:e})}static theme(e,t){let n=qp.newName(),r=[Wv.of(n),cg.of(Xv(`.${n}`,e))];return t&&t.dark&&r.push(Gv.of(!0)),r}static baseTheme(e){return Vf.lowest(cg.of(Xv(`.`+Kv,e,Yv)))}static findFromDOM(e){let t=e.querySelector(`.cm-content`);return(t&&fg.get(t)||fg.get(e))?.root?.view||null}};q.styleModule=cg,q.inputHandler=Ih,q.clipboardInputFilter=Rh,q.clipboardOutputFilter=zh,q.scrollHandler=Hh,q.focusChangeEffect=Lh,q.perLineTextDirection=Bh,q.exceptionSink=Ph,q.updateListener=Fh,q.editable=qh,q.mouseSelectionStyle=Nh,q.dragMovesSelection=Mh,q.clickAddsSelectionRange=jh,q.decorations=eg,q.blockWrappers=tg,q.outerDecorations=ng,q.atomicRanges=rg,q.bidiIsolatedRanges=ig,q.cursorScrollMargin=G.define({combine:e=>{let t=5,n=5;for(let r of e)typeof r==`number`?t=n=r:{x:t,y:n}=r;return{x:t,y:n}}}),q.scrollMargins=og,q.darkTheme=Gv,q.cspNonce=G.define({combine:e=>e.length?e[0]:``}),q.contentAttributes=$h,q.editorAttributes=Qh,q.lineWrapping=q.contentAttributes.of({class:`cm-lineWrapping`}),q.announce=ap.define();var ay=4096,oy={},sy=class e{constructor(e,t,n,r,i,a){this.from=e,this.to=t,this.dir=n,this.isolates=r,this.fresh=i,this.order=a}static update(t,n){if(n.empty&&!t.some(e=>e.fresh))return t;let r=[],i=t.length?t[t.length-1].dir:ch.LTR;for(let a=Math.max(0,t.length-10);a<t.length;a++){let o=t[a];o.dir==i&&!n.touchesRange(o.from,o.to)&&r.push(new e(n.mapPos(o.from,1),n.mapPos(o.to,-1),o.dir,o.isolates,!1,o.order))}return r}};function cy(e,t,n){for(let r=e.state.facet(t),i=r.length-1;i>=0;i--){let t=r[i],a=typeof t==`function`?t(e):t;a&&gm(a,n)}return n}var ly=K.mac?`mac`:K.windows?`win`:K.linux?`linux`:`key`;function uy(e,t){let n=e.split(/-(?!$)/),r=n[n.length-1];r==`Space`&&(r=` `);let i,a,o,s;for(let e=0;e<n.length-1;++e){let r=n[e];if(/^(cmd|meta|m)$/i.test(r))s=!0;else if(/^a(lt)?$/i.test(r))i=!0;else if(/^(c|ctrl|control)$/i.test(r))a=!0;else if(/^s(hift)?$/i.test(r))o=!0;else if(/^mod$/i.test(r))t==`mac`?s=!0:a=!0;else throw Error(`Unrecognized modifier name: `+r)}return i&&(r=`Alt-`+r),a&&(r=`Ctrl-`+r),s&&(r=`Meta-`+r),o&&(r=`Shift-`+r),r}function dy(e,t,n){return t.altKey&&(e=`Alt-`+e),t.ctrlKey&&(e=`Ctrl-`+e),t.metaKey&&(e=`Meta-`+e),n!==!1&&t.shiftKey&&(e=`Shift-`+e),e}var fy=Vf.default(q.domEventHandlers({keydown(e,t){return xy(hy(t.state),e,t,`editor`)}})),py=G.define({enables:fy}),my=new WeakMap;function hy(e){let t=e.facet(py),n=my.get(t);return n||my.set(t,n=yy(t.reduce((e,t)=>e.concat(t),[]))),n}function gy(e,t,n){return xy(hy(e.state),t,e,n)}var _y=null,vy=4e3;function yy(e,t=ly){let n=Object.create(null),r=Object.create(null),i=(e,t)=>{let n=r[e];if(n==null)r[e]=t;else if(n!=t)throw Error(`Key binding `+e+` is used both as a regular binding and as a multi-stroke prefix`)},a=(e,r,a,o,s)=>{let c=n[e]||(n[e]=Object.create(null)),l=r.split(/ (?!$)/).map(e=>uy(e,t));for(let t=1;t<l.length;t++){let n=l.slice(0,t).join(` `);i(n,!0),c[n]||(c[n]={preventDefault:!0,stopPropagation:!1,run:[t=>{let r=_y={view:t,prefix:n,scope:e};return setTimeout(()=>{_y==r&&(_y=null)},vy),!0}]})}let u=l.join(` `);i(u,!1);let d=c[u]||(c[u]={preventDefault:!1,stopPropagation:!1,run:(c._any?.run)?.slice()||[]});a&&d.run.push(a),o&&(d.preventDefault=!0),s&&(d.stopPropagation=!0)};for(let r of e){let e=r.scope?r.scope.split(` `):[`editor`];if(r.any)for(let t of e){let e=n[t]||(n[t]=Object.create(null));e._any||={preventDefault:!1,stopPropagation:!1,run:[]};let{any:i}=r;for(let t in e)e[t].run.push(e=>i(e,by))}let i=r[t]||r.key;if(i)for(let t of e)a(t,i,r.run,r.preventDefault,r.stopPropagation),r.shift&&a(t,`Shift-`+i,r.shift,r.preventDefault,r.stopPropagation)}return n}var by=null;function xy(e,t,n,r){by=t;let i=nm(t),a=vf(gf(i,0))==i.length&&i!=` `,o=``,s=!1,c=!1,l=!1;_y&&_y.view==n&&_y.scope==r&&(o=_y.prefix+` `,j_.indexOf(t.keyCode)<0&&(c=!0,_y=null));let u=new Set,d=e=>{if(e){for(let t of e.run)if(!u.has(t)&&(u.add(t),t(n)))return e.stopPropagation&&(l=!0),!0;e.preventDefault&&(e.stopPropagation&&(l=!0),c=!0)}return!1},f=e[r],p,m;return f&&(d(f[o+dy(i,t,!a)])?s=!0:a&&(t.altKey||t.metaKey||t.ctrlKey)&&!(K.windows&&t.ctrlKey&&t.altKey)&&!(K.mac&&t.altKey&&!(t.ctrlKey||t.metaKey))&&(p=Xp[t.keyCode])&&p!=i?(d(f[o+dy(p,t,!0)])||t.shiftKey&&(m=Zp[t.keyCode])!=i&&m!=p&&d(f[o+dy(m,t,!1)]))&&(s=!0):a&&t.shiftKey&&d(f[o+dy(i,t,!0)])&&(s=!0),!s&&d(f._any)&&(s=!0)),c&&(s=!0),s&&l&&t.stopPropagation(),by=null,s}var Sy=class e{constructor(e,t,n,r,i){this.className=e,this.left=t,this.top=n,this.width=r,this.height=i}draw(){let e=document.createElement(`div`);return e.className=this.className,this.adjust(e),e}update(e,t){return t.className==this.className&&(this.adjust(e),!0)}adjust(e){e.style.left=this.left+`px`,e.style.top=this.top+`px`,this.width!=null&&(e.style.width=this.width+`px`),e.style.height=this.height+`px`}eq(e){return this.left==e.left&&this.top==e.top&&this.width==e.width&&this.height==e.height&&this.className==e.className}static forRange(t,n,r){if(r.empty){let i=t.coordsAtPos(r.head,r.assoc||1);if(!i)return[];let a=Cy(t);return[new e(n,i.left-a.left,i.top-a.top,null,i.bottom-i.top)]}return Ty(t,n,r)}};function Cy(e){let t=e.scrollDOM.getBoundingClientRect();return{left:(e.textDirection==ch.LTR?t.left:t.right-e.scrollDOM.clientWidth*e.scaleX)-e.scrollDOM.scrollLeft*e.scaleX,top:t.top-e.scrollDOM.scrollTop*e.scaleY}}function wy(e,t,n,r){let i=e.coordsAtPos(t,n*2);if(!i)return r;let a=e.dom.getBoundingClientRect(),o=(i.top+i.bottom)/2,s=e.posAtCoords({x:a.left+1,y:o}),c=e.posAtCoords({x:a.right-1,y:o});return s==null||c==null?r:{from:Math.max(r.from,Math.min(s,c)),to:Math.min(r.to,Math.max(s,c))}}function Ty(e,t,n){if(n.to<=e.viewport.from||n.from>=e.viewport.to)return[];let r=Math.max(n.from,e.viewport.from),i=Math.min(n.to,e.viewport.to),a=e.textDirection==ch.LTR,o=e.contentDOM,s=o.getBoundingClientRect(),c=Cy(e),l=o.querySelector(`.cm-line`),u=l&&window.getComputedStyle(l),d=s.left+(u?parseInt(u.paddingLeft)+Math.min(0,parseInt(u.textIndent)):0),f=s.right-(u?parseInt(u.paddingRight):0),p=e_(e,r,1),m=e_(e,i,-1),h=p.type==Cm.Text?p:null,g=m.type==Cm.Text?m:null;if(h&&(e.lineWrapping||p.widgetLineBreaks)&&(h=wy(e,r,1,h)),g&&(e.lineWrapping||m.widgetLineBreaks)&&(g=wy(e,i,-1,g)),h&&g&&h.from==g.from&&h.to==g.to)return v(y(n.from,n.to,h));{let t=h?y(n.from,null,h):b(p,!1),r=g?y(null,n.to,g):b(m,!0),i=[];return(h||p).to<(g||m).from-(h&&g?1:0)||p.widgetLineBreaks>1&&t.bottom+e.defaultLineHeight/2<r.top?i.push(_(d,t.bottom,f,r.top)):t.bottom<r.top&&e.elementAtHeight((t.bottom+r.top)/2).type==Cm.Text&&(t.bottom=r.top=(t.bottom+r.top)/2),v(t).concat(i).concat(v(r))}function _(e,n,r,i){return new Sy(t,e-c.left,n-c.top,Math.max(0,r-e),i-n)}function v({top:e,bottom:t,horizontal:n}){let r=[];for(let i=0;i<n.length;i+=2)r.push(_(n[i],e,n[i+1],t));return r}function y(t,n,r){let i=1e9,o=-1e9,s=[];function c(t,n,c,l,u){let p=e.coordsAtPos(t,t==r.to?-2:2),m=e.coordsAtPos(c,c==r.from?2:-2);p&&m&&(i=Math.min(p.top,m.top,i),o=Math.max(p.bottom,m.bottom,o),u==ch.LTR?s.push(a&&n?d:p.left,a&&l?f:m.right):s.push(!a&&l?d:m.left,!a&&n?f:p.right))}let l=t??r.from,u=n??r.to;for(let r of e.visibleRanges)if(r.to>l&&r.from<u)for(let i=Math.max(r.from,l),a=Math.min(r.to,u);;){let r=e.state.doc.lineAt(i);for(let o of e.bidiSpans(r)){let e=o.from+r.from,s=o.to+r.from;if(e>=a)break;s>i&&c(Math.max(e,i),t==null&&e<=l,Math.min(s,a),n==null&&s>=u,o.dir)}if(i=r.to+1,i>=a)break}return s.length==0&&c(l,t==null,u,n==null,e.textDirection),{top:i,bottom:o,horizontal:s}}function b(e,t){let n=s.top+(t?e.top:e.bottom);return{top:n,bottom:n,horizontal:[]}}}function Ey(e,t){return e.constructor==t.constructor&&e.eq(t)}var Dy=class{constructor(e,t){this.view=e,this.layer=t,this.drawn=[],this.scaleX=1,this.scaleY=1,this.measureReq={read:this.measure.bind(this),write:this.draw.bind(this)},this.dom=e.scrollDOM.appendChild(document.createElement(`div`)),this.dom.classList.add(`cm-layer`),t.above&&this.dom.classList.add(`cm-layer-above`),t.class&&this.dom.classList.add(t.class),this.scale(),this.dom.setAttribute(`aria-hidden`,`true`),this.setOrder(e.state),e.requestMeasure(this.measureReq),t.mount&&t.mount(this.dom,e)}update(e){e.startState.facet(Oy)!=e.state.facet(Oy)&&this.setOrder(e.state),(this.layer.update(e,this.dom)||e.geometryChanged)&&(this.scale(),e.view.requestMeasure(this.measureReq))}docViewUpdate(e){this.layer.updateOnDocViewUpdate!==!1&&e.requestMeasure(this.measureReq)}setOrder(e){let t=0,n=e.facet(Oy);for(;t<n.length&&n[t]!=this.layer;)t++;this.dom.style.zIndex=String((this.layer.above?150:-1)-t)}measure(){return this.layer.markers(this.view)}scale(){let{scaleX:e,scaleY:t}=this.view;(e!=this.scaleX||t!=this.scaleY)&&(this.scaleX=e,this.scaleY=t,this.dom.style.transform=`scale(${1/e}, ${1/t})`)}draw(e){if(e.length!=this.drawn.length||e.some((e,t)=>!Ey(e,this.drawn[t]))){let t=this.dom.firstChild,n=0;for(let r of e)r.update&&t&&r.constructor&&this.drawn[n].constructor&&r.update(t,this.drawn[n])?(t=t.nextSibling,n++):this.dom.insertBefore(r.draw(),t);for(;t;){let e=t.nextSibling;t.remove(),t=e}this.drawn=e,K.webkit&&(this.dom.style.display=this.dom.firstChild?``:`none`)}}destroy(){this.layer.destroy&&this.layer.destroy(this.dom,this.view),this.dom.remove()}},Oy=G.define();function ky(e){return[Xh.define(t=>new Dy(t,e)),Oy.of(e)]}var Ay=!K.ios,jy=G.define({combine(e){return xp(e,{cursorBlinkRate:1200,drawRangeCursor:!0,iosSelectionHandles:!0},{cursorBlinkRate:(e,t)=>Math.min(e,t),drawRangeCursor:(e,t)=>e||t})}});function My(e={}){return[jy.of(e),Py,Iy,Ry,Vh.of(!0)]}function Ny(e){return e.startState.facet(jy)!=e.state.facet(jy)}var Py=ky({above:!0,markers(e){let{state:t}=e,n=t.facet(jy),r=[];for(let i of t.selection.ranges){let a=i==t.selection.main;if(i.empty||n.drawRangeCursor&&!(a&&K.ios&&n.iosSelectionHandles)){let t=a?`cm-cursor cm-cursor-primary`:`cm-cursor cm-cursor-secondary`,n=i.empty?i:W.cursor(i.head,i.assoc);for(let i of Sy.forRange(e,t,n))r.push(i)}}return r},update(e,t){e.transactions.some(e=>e.selection)&&(t.style.animationName=t.style.animationName==`cm-blink`?`cm-blink2`:`cm-blink`);let n=Ny(e);return n&&Fy(e.state,t),e.docChanged||e.selectionSet||n},mount(e,t){Fy(t.state,e)},class:`cm-cursorLayer`});function Fy(e,t){t.style.animationDuration=e.facet(jy).cursorBlinkRate+`ms`}var Iy=ky({above:!1,markers(e){let t=[],{main:n,ranges:r}=e.state.selection;for(let i of r)if(!i.empty&&(Ay||i!=n))for(let n of Sy.forRange(e,`cm-selectionBackground`,i))t.push(n);if(K.ios&&!n.empty&&e.state.facet(jy).iosSelectionHandles){for(let r of Sy.forRange(e,`cm-selectionHandle cm-selectionHandle-start`,W.cursor(n.from,1)))t.push(r);for(let r of Sy.forRange(e,`cm-selectionHandle cm-selectionHandle-end`,W.cursor(n.to,1)))t.push(r)}return t},update(e,t){return e.docChanged||e.selectionSet||e.viewportChanged||Ny(e)},class:`cm-selectionLayer`}),Ly=K.gecko&&K.gecko_version==153?`#ffffff01`:`transparent`,Ry=Vf.highest(q.theme({".cm-line":{...Ay?{"& ::selection, &::selection":{backgroundColor:`${Ly} !important`}}:{},caretColor:`transparent !important`},".cm-content":{caretColor:`transparent !important`,"& :focus":{caretColor:`initial !important`,...Ay?{"&::selection, & ::selection":{backgroundColor:`Highlight !important`}}:{}}}}));function zy(e,t,n,r,i){t.lastIndex=0;for(let a=e.iterRange(n,r),o=n,s;!a.next().done;o+=a.value.length)if(!a.lineBreak)for(;s=t.exec(a.value);)i(o+s.index,s)}function By(e,t){let n=e.visibleRanges;if(n.length==1&&n[0].from==e.viewport.from&&n[0].to==e.viewport.to)return n;let r=[];for(let{from:i,to:a}of n)i=Math.max(e.state.doc.lineAt(i).from,i-t),a=Math.min(e.state.doc.lineAt(a).to,a+t),r.length&&r[r.length-1].to>=i?r[r.length-1].to=a:r.push({from:i,to:a});return r}var Vy=class{constructor(e){let{regexp:t,decoration:n,decorate:r,boundary:i,maxLength:a=1e3}=e;if(!t.global)throw RangeError(`The regular expression given to MatchDecorator should have its 'g' flag set`);if(this.regexp=t,r)this.addMatch=(e,t,n,i)=>r(i,n,n+e[0].length,e,t);else if(typeof n==`function`)this.addMatch=(e,t,r,i)=>{let a=n(e,t,r);a&&i(r,r+e[0].length,a)};else if(n)this.addMatch=(e,t,r,i)=>i(r,r+e[0].length,n);else throw RangeError(`Either 'decorate' or 'decoration' should be provided to MatchDecorator`);this.boundary=i,this.maxLength=a}createDeco(e){let t=new Ap,n=t.add.bind(t);for(let{from:t,to:r}of By(e,this.maxLength))zy(e.state.doc,this.regexp,t,r,(t,r)=>this.addMatch(r,e,t,n));return t.finish()}updateDeco(e,t){let n=1e9,r=-1;return e.docChanged&&e.changes.iterChanges((t,i,a,o)=>{o>=e.view.viewport.from&&a<=e.view.viewport.to&&(n=Math.min(a,n),r=Math.max(o,r))}),e.viewportMoved||r-n>1e3?this.createDeco(e.view):r>-1?this.updateRange(e.view,t.map(e.changes),n,r):t}updateRange(e,t,n,r){for(let i of e.visibleRanges){let a=Math.max(i.from,n),o=Math.min(i.to,r);if(o>=a){let n=e.state.doc.lineAt(a),r=n.to<o?e.state.doc.lineAt(o):n,s=Math.max(i.from,n.from),c=Math.min(i.to,r.to);if(this.boundary){for(;a>n.from;a--)if(this.boundary.test(n.text[a-1-n.from])){s=a;break}for(;o<r.to;o++)if(this.boundary.test(r.text[o-r.from])){c=o;break}}let l=[],u,d=(e,t,n)=>l.push(n.range(e,t));if(n==r)for(this.regexp.lastIndex=s-n.from;(u=this.regexp.exec(n.text))&&u.index<c-n.from;)this.addMatch(u,e,u.index+n.from,d);else zy(e.state.doc,this.regexp,s,c,(t,n)=>this.addMatch(n,e,t,d));t=t.update({filterFrom:s,filterTo:c,filter:(e,t)=>e<s||t>c,add:l})}}return t}},Hy=/x/.unicode==null?`g`:`gu`,Uy=RegExp(`[\0-\b
|
|
21
|
+
--\u2028\u2029-]`,Hy),Wy={0:`null`,7:`bell`,8:`backspace`,10:`newline`,11:`vertical tab`,13:`carriage return`,27:`escape`,8203:`zero width space`,8204:`zero width non-joiner`,8205:`zero width joiner`,8206:`left-to-right mark`,8207:`right-to-left mark`,8232:`line separator`,8237:`left-to-right override`,8238:`right-to-left override`,8294:`left-to-right isolate`,8295:`right-to-left isolate`,8297:`pop directional isolate`,8233:`paragraph separator`,65279:`zero width no-break space`,65532:`object replacement`},Gy=null;function Ky(){if(Gy==null&&typeof document<`u`&&document.body){let e=document.body.style;Gy=(e.tabSize??e.MozTabSize)!=null}return Gy||!1}var qy=G.define({combine(e){let t=xp(e,{render:null,specialChars:Uy,addSpecialChars:null});return(t.replaceTabs=!Ky())&&(t.specialChars=RegExp(` |`+t.specialChars.source,Hy)),t.addSpecialChars&&(t.specialChars=RegExp(t.specialChars.source+`|`+t.addSpecialChars.source,Hy)),t}});function Jy(e={}){return[qy.of(e),Xy()]}var Yy=null;function Xy(){return Yy||=Xh.fromClass(class{constructor(e){this.view=e,this.decorations=wm.none,this.decorationCache=Object.create(null),this.decorator=this.makeDecorator(e.state.facet(qy)),this.decorations=this.decorator.createDeco(e)}makeDecorator(e){return new Vy({regexp:e.specialChars,decoration:(t,n,r)=>{let{doc:i}=n.state,a=gf(t[0],0);if(a==9){let e=i.lineAt(r),t=n.state.tabSize,a=Vp(e.text,t,r-e.from);return wm.replace({widget:new eb((t-a%t)*this.view.defaultCharacterWidth/this.view.scaleX)})}return this.decorationCache[a]||(this.decorationCache[a]=wm.replace({widget:new $y(e,a)}))},boundary:e.replaceTabs?void 0:/[^]/})}update(e){let t=e.state.facet(qy);e.startState.facet(qy)==t?this.decorations=this.decorator.updateDeco(e,this.decorations):(this.decorator=this.makeDecorator(t),this.decorations=this.decorator.createDeco(e.view))}},{decorations:e=>e.decorations})}var Zy=`•`;function Qy(e){return e>=32?Zy:e==10?``:String.fromCharCode(9216+e)}var $y=class extends Sm{constructor(e,t){super(),this.options=e,this.code=t}eq(e){return e.code==this.code}toDOM(e){let t=Qy(this.code),n=e.state.phrase(`Control character`)+` `+(Wy[this.code]||`0x`+this.code.toString(16)),r=this.options.render&&this.options.render(this.code,n,t);if(r)return r;let i=document.createElement(`span`);return i.textContent=t,i.title=n,i.setAttribute(`aria-label`,n),i.className=`cm-specialChar`,i}ignoreEvent(){return!1}},eb=class extends Sm{constructor(e){super(),this.width=e}eq(e){return e.width==this.width}toDOM(){let e=document.createElement(`span`);return e.textContent=` `,e.className=`cm-tab`,e.style.width=this.width+`px`,e}ignoreEvent(){return!1}},tb=G.define({combine(e){let t,n;for(let r of e)t||=r.topContainer,n||=r.bottomContainer;return{topContainer:t,bottomContainer:n}}});function nb(e,t){let n=e.plugin(rb),r=n?n.specs.indexOf(t):-1;return r>-1?n.panels[r]:null}var rb=Xh.fromClass(class{constructor(e){this.input=e.state.facet(ob),this.specs=this.input.filter(e=>e),this.panels=this.specs.map(t=>t(e));let t=e.state.facet(tb);this.top=new ib(e,!0,t.topContainer),this.bottom=new ib(e,!1,t.bottomContainer),this.top.sync(this.panels.filter(e=>e.top)),this.bottom.sync(this.panels.filter(e=>!e.top));for(let e of this.panels)e.dom.classList.add(`cm-panel`),e.mount&&e.mount()}update(e){let t=e.state.facet(tb);this.top.container!=t.topContainer&&(this.top.sync([]),this.top=new ib(e.view,!0,t.topContainer)),this.bottom.container!=t.bottomContainer&&(this.bottom.sync([]),this.bottom=new ib(e.view,!1,t.bottomContainer)),this.top.syncClasses(),this.bottom.syncClasses();let n=e.state.facet(ob);if(n!=this.input){let t=n.filter(e=>e),r=[],i=[],a=[],o=[];for(let n of t){let t=this.specs.indexOf(n),s;t<0?(s=n(e.view),o.push(s)):(s=this.panels[t],s.update&&s.update(e)),r.push(s),(s.top?i:a).push(s)}this.specs=t,this.panels=r,this.top.sync(i),this.bottom.sync(a);for(let e of o)e.dom.classList.add(`cm-panel`),e.mount&&e.mount()}else for(let t of this.panels)t.update&&t.update(e)}destroy(){this.top.sync([]),this.bottom.sync([])}},{provide:e=>q.scrollMargins.of(t=>{let n=t.plugin(e);return n&&{top:n.top.scrollMargin(),bottom:n.bottom.scrollMargin()}})}),ib=class{constructor(e,t,n){this.view=e,this.top=t,this.container=n,this.dom=void 0,this.classes=``,this.panels=[],this.syncClasses()}sync(e){for(let t of this.panels)t.destroy&&e.indexOf(t)<0&&t.destroy();this.panels=e,this.syncDOM()}syncDOM(){if(this.panels.length==0){this.dom&&=(this.dom.remove(),void 0);return}if(!this.dom){this.dom=document.createElement(`div`),this.dom.className=this.top?`cm-panels cm-panels-top`:`cm-panels cm-panels-bottom`;let e=this.container||this.view.dom;e.insertBefore(this.dom,this.top?e.firstChild:null)}let e=this.dom.firstChild;for(let t of this.panels)if(t.dom.parentNode==this.dom){for(;e!=t.dom;)e=ab(e);e=e.nextSibling}else this.dom.insertBefore(t.dom,e);for(;e;)e=ab(e)}scrollMargin(){return!this.dom||this.container?0:Math.max(0,this.top?this.dom.getBoundingClientRect().bottom-Math.max(0,this.view.scrollDOM.getBoundingClientRect().top):Math.min(innerHeight,this.view.scrollDOM.getBoundingClientRect().bottom)-this.dom.getBoundingClientRect().top)}syncClasses(){if(this.container&&this.classes!=this.view.themeClasses){for(let e of this.classes.split(` `))e&&this.container.classList.remove(e);for(let e of(this.classes=this.view.themeClasses).split(` `))e&&this.container.classList.add(e)}}};function ab(e){let t=e.nextSibling;return e.remove(),t}var ob=G.define({enables:rb});function sb(e,t){let n,r=new Promise(e=>n=e),i=e=>fb(e,t,n);e.state.field(lb,!1)?e.dispatch({effects:ub.of(i)}):e.dispatch({effects:ap.appendConfig.of(lb.init(()=>[i]))});let a=db.of(i);return{close:a,result:r.then(t=>((e.win.queueMicrotask||(t=>e.win.setTimeout(t,10)))(()=>{e.state.field(lb).indexOf(i)>-1&&e.dispatch({effects:a})}),t))}}function cb(e,t){let n=e.state.field(lb,!1)||[];for(let r of n){let n=nb(e,r);if(n&&n.dom.classList.contains(t))return n}return null}var lb=Rf.define({create(){return[]},update(e,t){for(let n of t.effects)n.is(ub)?e=[n.value].concat(e):n.is(db)&&(e=e.filter(e=>e!=n.value));return e},provide:e=>ob.computeN([e],t=>t.field(e))}),ub=ap.define(),db=ap.define();function fb(e,t,n){let r=t.content?t.content(e,()=>o(null)):null;if(!r){if(r=rm(`form`),t.input){let e=rm(`input`,t.input);/^(text|password|number|email|tel|url)$/.test(e.type)&&e.classList.add(`cm-textfield`),e.name||=`input`,r.appendChild(rm(`label`,(t.label||``)+`: `,e))}else r.appendChild(document.createTextNode(t.label||``));r.appendChild(document.createTextNode(` `)),r.appendChild(rm(`button`,{class:`cm-button`,type:`submit`},t.submitLabel||`OK`))}let i=r.nodeName==`FORM`?[r]:r.querySelectorAll(`form`);for(let e=0;e<i.length;e++){let t=i[e];t.addEventListener(`keydown`,e=>{e.keyCode==27?(e.preventDefault(),o(null)):e.keyCode==13&&(e.preventDefault(),o(t))}),t.addEventListener(`submit`,e=>{e.preventDefault(),o(t)})}let a=rm(`div`,r,rm(`button`,{onclick:()=>o(null),"aria-label":e.state.phrase(`close`),class:`cm-dialog-close`,type:`button`},[`×`]));t.class&&(a.className=t.class),a.classList.add(`cm-dialog`);function o(t){a.contains(a.ownerDocument.activeElement)&&e.focus(),n(t)}return{dom:a,top:t.top,mount:()=>{if(t.focus){let e;e=typeof t.focus==`string`?r.querySelector(t.focus):r.querySelector(`input`)||r.querySelector(`button`),e&&`select`in e?e.select():e&&`focus`in e&&e.focus()}}}}var pb=class extends Sp{compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}eq(e){return!1}destroy(e){}};pb.prototype.elementClass=``,pb.prototype.toDOM=void 0,pb.prototype.mapMode=bf.TrackBefore,pb.prototype.startSide=pb.prototype.endSide=-1,pb.prototype.point=!0;var mb=G.define(),hb=G.define(),gb=G.define(),_b=G.define({combine:e=>e.some(e=>e)});function vb(e){let t=[yb];return e&&e.fixed===!1&&t.push(_b.of(!0)),t}var yb=Xh.fromClass(class{constructor(e){this.view=e,this.domAfter=null,this.prevViewport=e.viewport,this.dom=document.createElement(`div`),this.dom.className=`cm-gutters cm-gutters-before`,this.dom.setAttribute(`aria-hidden`,`true`),this.dom.style.minHeight=this.view.contentHeight/this.view.scaleY+`px`,this.gutters=e.state.facet(gb).map(t=>new Cb(e,t)),this.fixed=!e.state.facet(_b);for(let e of this.gutters)e.config.side==`after`?this.getDOMAfter().appendChild(e.dom):this.dom.appendChild(e.dom);this.fixed&&(this.dom.style.position=`sticky`),this.syncGutters(!1),e.scrollDOM.insertBefore(this.dom,e.contentDOM)}getDOMAfter(){return this.domAfter||(this.domAfter=document.createElement(`div`),this.domAfter.className=`cm-gutters cm-gutters-after`,this.domAfter.setAttribute(`aria-hidden`,`true`),this.domAfter.style.minHeight=this.view.contentHeight/this.view.scaleY+`px`,this.domAfter.style.position=this.fixed?`sticky`:``,this.view.scrollDOM.appendChild(this.domAfter)),this.domAfter}update(e){if(this.updateGutters(e)){let t=this.prevViewport,n=e.view.viewport,r=Math.min(t.to,n.to)-Math.max(t.from,n.from);this.syncGutters(r<(n.to-n.from)*.8)}if(e.geometryChanged){let e=this.view.contentHeight/this.view.scaleY+`px`;this.dom.style.minHeight=e,this.domAfter&&(this.domAfter.style.minHeight=e)}this.view.state.facet(_b)!=!this.fixed&&(this.fixed=!this.fixed,this.dom.style.position=this.fixed?`sticky`:``,this.domAfter&&(this.domAfter.style.position=this.fixed?`sticky`:``)),this.prevViewport=e.view.viewport}syncGutters(e){let t=this.dom.nextSibling;e&&(this.dom.remove(),this.domAfter&&this.domAfter.remove());let n=Dp.iter(this.view.state.facet(mb),this.view.viewport.from),r=[],i=this.gutters.map(e=>new Sb(e,this.view.viewport,-this.view.documentPadding.top));for(let e of this.view.viewportLineBlocks)if(r.length&&(r=[]),Array.isArray(e.type)){let t=!0;for(let a of e.type)if(a.type==Cm.Text&&t){xb(n,r,a.from);for(let e of i)e.line(this.view,a,r);t=!1}else if(a.widget)for(let e of i)e.widget(this.view,a)}else if(e.type==Cm.Text){xb(n,r,e.from);for(let t of i)t.line(this.view,e,r)}else if(e.widget)for(let t of i)t.widget(this.view,e);for(let e of i)e.finish();e&&(this.view.scrollDOM.insertBefore(this.dom,t),this.domAfter&&this.view.scrollDOM.appendChild(this.domAfter))}updateGutters(e){let t=e.startState.facet(gb),n=e.state.facet(gb),r=e.docChanged||e.heightChanged||e.viewportChanged||!Dp.eq(e.startState.facet(mb),e.state.facet(mb),e.view.viewport.from,e.view.viewport.to);if(t==n)for(let t of this.gutters)t.update(e)&&(r=!0);else{r=!0;let i=[];for(let r of n){let n=t.indexOf(r);n<0?i.push(new Cb(this.view,r)):(this.gutters[n].update(e),i.push(this.gutters[n]))}for(let e of this.gutters)e.dom.remove(),i.indexOf(e)<0&&e.destroy();for(let e of i)e.config.side==`after`?this.getDOMAfter().appendChild(e.dom):this.dom.appendChild(e.dom);this.gutters=i}return r}destroy(){for(let e of this.gutters)e.destroy();this.dom.remove(),this.domAfter&&this.domAfter.remove()}},{provide:e=>q.scrollMargins.of(t=>{let n=t.plugin(e);if(!n||n.gutters.length==0||!n.fixed)return null;let r=n.dom.offsetWidth*t.scaleX,i=n.domAfter?n.domAfter.offsetWidth*t.scaleX:0;return t.textDirection==ch.LTR?{left:r,right:i}:{right:r,left:i}})});function bb(e){return Array.isArray(e)?e:[e]}function xb(e,t,n){for(;e.value&&e.from<=n;)e.from==n&&t.push(e.value),e.next()}var Sb=class{constructor(e,t,n){this.gutter=e,this.height=n,this.i=0,this.cursor=Dp.iter(e.markers,t.from)}addElement(e,t,n){let{gutter:r}=this,i=(t.top-this.height)/e.scaleY,a=t.height/e.scaleY;if(this.i==r.elements.length){let t=new wb(e,a,i,n);r.elements.push(t),r.dom.appendChild(t.dom)}else r.elements[this.i].update(e,a,i,n);this.height=t.bottom,this.i++}line(e,t,n){let r=[];xb(this.cursor,r,t.from),n.length&&(r=r.concat(n));let i=this.gutter.config.lineMarker(e,t,r);i&&r.unshift(i);let a=this.gutter;(r.length!=0||a.config.renderEmptyElements)&&this.addElement(e,t,r)}widget(e,t){let n=this.gutter.config.widgetMarker(e,t.widget,t),r=n?[n]:null;for(let n of e.state.facet(hb)){let i=n(e,t.widget,t);i&&(r||=[]).push(i)}r&&this.addElement(e,t,r)}finish(){let e=this.gutter;for(;e.elements.length>this.i;){let t=e.elements.pop();e.dom.removeChild(t.dom),t.destroy()}}},Cb=class{constructor(e,t){this.view=e,this.config=t,this.elements=[],this.spacer=null,this.dom=document.createElement(`div`),this.dom.className=`cm-gutter`+(this.config.class?` `+this.config.class:``);for(let n in t.domEventHandlers)this.dom.addEventListener(n,r=>{let i=r.target,a;if(i!=this.dom&&this.dom.contains(i)){for(;i.parentNode!=this.dom;)i=i.parentNode;let e=i.getBoundingClientRect();a=(e.top+e.bottom)/2}else a=r.clientY;let o=e.lineBlockAtHeight(a-e.documentTop);t.domEventHandlers[n](e,o,r)&&r.preventDefault()});this.markers=bb(t.markers(e)),t.initialSpacer&&(this.spacer=new wb(e,0,0,[t.initialSpacer(e)]),this.dom.appendChild(this.spacer.dom),this.spacer.dom.style.cssText+=`visibility: hidden; pointer-events: none`)}update(e){let t=this.markers;if(this.markers=bb(this.config.markers(e.view)),this.spacer&&this.config.updateSpacer){let t=this.config.updateSpacer(this.spacer.markers[0],e);t!=this.spacer.markers[0]&&this.spacer.update(e.view,0,0,[t])}let n=e.view.viewport;return!Dp.eq(this.markers,t,n.from,n.to)||(this.config.lineMarkerChange?this.config.lineMarkerChange(e):!1)}destroy(){for(let e of this.elements)e.destroy()}},wb=class{constructor(e,t,n,r){this.height=-1,this.above=0,this.markers=[],this.dom=document.createElement(`div`),this.dom.className=`cm-gutterElement`,this.update(e,t,n,r)}update(e,t,n,r){this.height!=t&&(this.height=t,this.dom.style.height=t+`px`),this.above!=n&&(this.dom.style.marginTop=(this.above=n)?n+`px`:``),Tb(this.markers,r)||this.setMarkers(e,r)}setMarkers(e,t){let n=`cm-gutterElement`,r=this.dom.firstChild;for(let i=0,a=0;;){let o=a,s=i<t.length?t[i++]:null,c=!1;if(s){let e=s.elementClass;e&&(n+=` `+e);for(let e=a;e<this.markers.length;e++)if(this.markers[e].compare(s)){o=e,c=!0;break}}else o=this.markers.length;for(;a<o;){let e=this.markers[a++];if(e.toDOM){e.destroy(r);let t=r.nextSibling;r.remove(),r=t}}if(!s)break;s.toDOM&&(c?r=r.nextSibling:this.dom.insertBefore(s.toDOM(e),r)),c&&a++}this.dom.className=n,this.markers=t}destroy(){this.setMarkers(null,[])}};function Tb(e,t){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!e[n].compare(t[n]))return!1;return!0}var Eb=G.define(),Db=G.define(),Ob=G.define({combine(e){return xp(e,{formatNumber:String,domEventHandlers:{}},{domEventHandlers(e,t){let n=Object.assign({},e);for(let e in t){let r=n[e],i=t[e];n[e]=r?(e,t,n)=>r(e,t,n)||i(e,t,n):i}return n}})}}),kb=class extends pb{constructor(e){super(),this.number=e}eq(e){return this.number==e.number}toDOM(){return document.createTextNode(this.number)}};function Ab(e,t){return e.state.facet(Ob).formatNumber(t,e.state)}var jb=gb.compute([Ob],e=>({class:`cm-lineNumbers`,renderEmptyElements:!1,markers(e){return e.state.facet(Eb)},lineMarker(e,t,n){return n.some(e=>e.toDOM)?null:new kb(Ab(e,e.state.doc.lineAt(t.from).number))},widgetMarker:(e,t,n)=>{for(let r of e.state.facet(Db)){let i=r(e,t,n);if(i)return i}return null},lineMarkerChange:e=>e.startState.facet(Ob)!=e.state.facet(Ob),initialSpacer(e){return new kb(Ab(e,Nb(e.state.doc.lines)))},updateSpacer(e,t){let n=Ab(t.view,Nb(t.view.state.doc.lines));return n==e.number?e:new kb(n)},domEventHandlers:e.facet(Ob).domEventHandlers,side:`before`}));function Mb(e={}){return[Ob.of(e),vb(),jb]}function Nb(e){let t=9;for(;t<e;)t=t*10+9;return t}var Pb=1024,Fb=0,Ib=class{constructor(e,t){this.from=e,this.to=t}},Lb=class{constructor(e={}){this.id=Fb++,this.perNode=!!e.perNode,this.deserialize=e.deserialize||(()=>{throw Error(`This node type doesn't define a deserialize function`)}),this.combine=e.combine||null}add(e){if(this.perNode)throw RangeError(`Can't add per-node props to node types`);return typeof e!=`function`&&(e=Bb.match(e)),t=>{let n=e(t);return n===void 0?null:[this,n]}}};Lb.closedBy=new Lb({deserialize:e=>e.split(` `)}),Lb.openedBy=new Lb({deserialize:e=>e.split(` `)}),Lb.group=new Lb({deserialize:e=>e.split(` `)}),Lb.isolate=new Lb({deserialize:e=>{if(e&&e!=`rtl`&&e!=`ltr`&&e!=`auto`)throw RangeError(`Invalid value for isolate: `+e);return e||`auto`}}),Lb.contextHash=new Lb({perNode:!0}),Lb.lookAhead=new Lb({perNode:!0}),Lb.mounted=new Lb({perNode:!0});var Rb=class{constructor(e,t,n,r=!1){this.tree=e,this.overlay=t,this.parser=n,this.bracketed=r}static get(e){return e&&e.props&&e.props[Lb.mounted.id]}},zb=Object.create(null),Bb=class e{constructor(e,t,n,r=0){this.name=e,this.props=t,this.id=n,this.flags=r}static define(t){let n=t.props&&t.props.length?Object.create(null):zb,r=+!!t.top|(t.skipped?2:0)|(t.error?4:0)|(t.name==null?8:0),i=new e(t.name||``,n,t.id,r);if(t.props){for(let e of t.props)if(Array.isArray(e)||(e=e(i)),e){if(e[0].perNode)throw RangeError(`Can't store a per-node prop on a node type`);n[e[0].id]=e[1]}}return i}prop(e){return this.props[e.id]}get isTop(){return(this.flags&1)>0}get isSkipped(){return(this.flags&2)>0}get isError(){return(this.flags&4)>0}get isAnonymous(){return(this.flags&8)>0}is(e){if(typeof e==`string`){if(this.name==e)return!0;let t=this.prop(Lb.group);return t?t.indexOf(e)>-1:!1}return this.id==e}static match(e){let t=Object.create(null);for(let n in e)for(let r of n.split(` `))t[r]=e[n];return e=>{for(let n=e.prop(Lb.group),r=-1;r<(n?n.length:0);r++){let i=t[r<0?e.name:n[r]];if(i)return i}}}};Bb.none=new Bb(``,Object.create(null),0,8);var Vb=class e{constructor(e){this.types=e;for(let t=0;t<e.length;t++)if(e[t].id!=t)throw RangeError(`Node type ids should correspond to array positions when creating a node set`)}extend(...t){let n=[];for(let e of this.types){let r=null;for(let n of t){let t=n(e);if(t){r||=Object.assign({},e.props);let n=t[1],i=t[0];i.combine&&i.id in r&&(n=i.combine(r[i.id],n)),r[i.id]=n}}n.push(r?new Bb(e.name,r,e.id,e.flags):e)}return new e(n)}},Hb=new WeakMap,Ub=new WeakMap,Wb;(function(e){e[e.ExcludeBuffers=1]=`ExcludeBuffers`,e[e.IncludeAnonymous=2]=`IncludeAnonymous`,e[e.IgnoreMounts=4]=`IgnoreMounts`,e[e.IgnoreOverlays=8]=`IgnoreOverlays`,e[e.EnterBracketed=16]=`EnterBracketed`})(Wb||={});var Gb=class e{constructor(e,t,n,r,i){if(this.type=e,this.children=t,this.positions=n,this.length=r,this.props=null,i&&i.length){this.props=Object.create(null);for(let[e,t]of i)this.props[typeof e==`number`?e:e.id]=t}}toString(){let e=Rb.get(this);if(e&&!e.overlay)return e.tree.toString();let t=``;for(let e of this.children){let n=e.toString();n&&(t&&(t+=`,`),t+=n)}return this.type.name?(/\W/.test(this.type.name)&&!this.type.isError?JSON.stringify(this.type.name):this.type.name)+(t.length?`(`+t+`)`:``):t}cursor(e=0){return new ax(this.topNode,e)}cursorAt(e,t=0,n=0){let r=new ax(Hb.get(this)||this.topNode);return r.moveTo(e,t),Hb.set(this,r._tree),r}get topNode(){return new Zb(this,0,0,null)}resolve(e,t=0){let n=Yb(Hb.get(this)||this.topNode,e,t,!1);return Hb.set(this,n),n}resolveInner(e,t=0){let n=Yb(Ub.get(this)||this.topNode,e,t,!0);return Ub.set(this,n),n}resolveStack(e,t=0){return ix(this,e,t)}iterate(e){let{enter:t,leave:n,from:r=0,to:i=this.length}=e,a=e.mode||0,o=(a&Wb.IncludeAnonymous)>0;for(let e=this.cursor(a|Wb.IncludeAnonymous);;){let a=!1;if(e.from<=i&&e.to>=r&&(!o&&e.type.isAnonymous||t(e)!==!1)){if(e.firstChild())continue;a=!0}for(;a&&n&&(o||!e.type.isAnonymous)&&n(e),!e.nextSibling();){if(!e.parent())return;a=!0}}}prop(e){return e.perNode?this.props?this.props[e.id]:void 0:this.type.prop(e)}get propValues(){let e=[];if(this.props)for(let t in this.props)e.push([+t,this.props[t]]);return e}balance(t={}){return this.children.length<=8?this:ux(Bb.none,this.children,this.positions,0,this.children.length,0,this.length,(t,n,r)=>new e(this.type,t,n,r,this.propValues),t.makeTree||((t,n,r)=>new e(Bb.none,t,n,r)))}static build(e){return sx(e)}};Gb.empty=new Gb(Bb.none,[],[],0);var Kb=class e{constructor(e,t){this.buffer=e,this.index=t}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}get pos(){return this.index}next(){this.index-=4}fork(){return new e(this.buffer,this.index)}},qb=class e{constructor(e,t,n){this.buffer=e,this.length=t,this.set=n}get type(){return Bb.none}toString(){let e=[];for(let t=0;t<this.buffer.length;)e.push(this.childString(t)),t=this.buffer[t+3];return e.join(`,`)}childString(e){let t=this.buffer[e],n=this.buffer[e+3],r=this.set.types[t],i=r.name;if(/\W/.test(i)&&!r.isError&&(i=JSON.stringify(i)),e+=4,n==e)return i;let a=[];for(;e<n;)a.push(this.childString(e)),e=this.buffer[e+3];return i+`(`+a.join(`,`)+`)`}findChild(e,t,n,r,i){let{buffer:a}=this,o=-1;for(let s=e;s!=t&&!(Jb(i,r,a[s+1],a[s+2])&&(o=s,n>0));s=a[s+3]);return o}slice(t,n,r){let i=this.buffer,a=new Uint16Array(n-t),o=0;for(let e=t,s=0;e<n;){a[s++]=i[e++],a[s++]=i[e++]-r;let n=a[s++]=i[e++]-r;a[s++]=i[e++]-t,o=Math.max(o,n)}return new e(a,o,this.set)}};function Jb(e,t,n,r){switch(e){case-2:return n<t;case-1:return r>=t&&n<t;case 0:return n<t&&r>t;case 1:return n<=t&&r>t;case 2:return r>t;case 4:return!0}}function Yb(e,t,n,r){for(;e.from==e.to||(n<1?e.from>=t:e.from>t)||(n>-1?e.to<=t:e.to<t);){let t=!r&&e instanceof Zb&&e.index<0?null:e.parent;if(!t)return e;e=t}let i=r?0:Wb.IgnoreOverlays;if(r)for(let r=e,a=r.parent;a;r=a,a=r.parent)r instanceof Zb&&r.index<0&&a.enter(t,n,i)?.from!=r.from&&(e=a);for(;;){let r=e.enter(t,n,i);if(!r)return e;e=r}}var Xb=class{cursor(e=0){return new ax(this,e)}getChild(e,t=null,n=null){let r=Qb(this,e,t,n);return r.length?r[0]:null}getChildren(e,t=null,n=null){return Qb(this,e,t,n)}resolve(e,t=0){return Yb(this,e,t,!1)}resolveInner(e,t=0){return Yb(this,e,t,!0)}matchContext(e){return $b(this.parent,e)}enterUnfinishedNodesBefore(e){let t=this.childBefore(e),n=this;for(;t;){let e=t.lastChild;if(!e||e.to!=t.to)break;e.type.isError&&e.from==e.to?(n=t,t=e.prevSibling):t=e}return n}get node(){return this}get next(){return this.parent}},Zb=class e extends Xb{constructor(e,t,n,r){super(),this._tree=e,this.from=t,this.index=n,this._parent=r}get type(){return this._tree.type}get name(){return this._tree.type.name}get to(){return this.from+this._tree.length}nextChild(t,n,r,i,a=0){for(let o=this;;){for(let{children:s,positions:c}=o._tree,l=n>0?s.length:-1;t!=l;t+=n){let l=s[t],u=c[t]+o.from,d;if(a&Wb.EnterBracketed&&l instanceof Gb&&(d=Rb.get(l))&&!d.overlay&&d.bracketed&&r>=u&&r<=u+l.length||Jb(i,r,u,u+l.length)){if(l instanceof qb){if(a&Wb.ExcludeBuffers)continue;let e=l.findChild(0,l.buffer.length,n,r-u,i);if(e>-1)return new tx(new ex(o,l,t,u),null,e)}else if(a&Wb.IncludeAnonymous||!l.type.isAnonymous||ox(l)){let s;if(!(a&Wb.IgnoreMounts)&&(s=Rb.get(l))&&!s.overlay)return new e(s.tree,u,t,o);let c=new e(l,u,t,o);return a&Wb.IncludeAnonymous||!c.type.isAnonymous?c:c.nextChild(n<0?l.children.length-1:0,n,r,i,a)}}}if(a&Wb.IncludeAnonymous||!o.type.isAnonymous||(t=o.index>=0?o.index+n:n<0?-1:o._parent._tree.children.length,o=o._parent,!o))return null}}get firstChild(){return this.nextChild(0,1,0,4)}get lastChild(){return this.nextChild(this._tree.children.length-1,-1,0,4)}childAfter(e){return this.nextChild(0,1,e,2)}childBefore(e){return this.nextChild(this._tree.children.length-1,-1,e,-2)}prop(e){return this._tree.prop(e)}enter(t,n,r=0){let i;if(!(r&Wb.IgnoreOverlays)&&(i=Rb.get(this._tree))&&i.overlay){let a=t-this.from,o=r&Wb.EnterBracketed&&i.bracketed;for(let{from:t,to:r}of i.overlay)if((n>0||o?t<=a:t<a)&&(n<0||o?r>=a:r>a))return new e(i.tree,i.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,t,n,r)}nextSignificantParent(){let e=this;for(;e.type.isAnonymous&&e._parent;)e=e._parent;return e}get parent(){return this._parent?this._parent.nextSignificantParent():null}get nextSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index+1,1,0,4):null}get prevSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index-1,-1,0,4):null}get tree(){return this._tree}toTree(){return this._tree}toString(){return this._tree.toString()}};function Qb(e,t,n,r){let i=e.cursor(),a=[];if(!i.firstChild())return a;if(n!=null){for(let e=!1;!e;)if(e=i.type.is(n),!i.nextSibling())return a}for(;;){if(r!=null&&i.type.is(r))return a;if(i.type.is(t)&&a.push(i.node),!i.nextSibling())return r==null?a:[]}}function $b(e,t,n=t.length-1){for(let r=e;n>=0;r=r.parent){if(!r)return!1;if(!r.type.isAnonymous){if(t[n]&&t[n]!=r.name)return!1;n--}}return!0}var ex=class{constructor(e,t,n,r){this.parent=e,this.buffer=t,this.index=n,this.start=r}},tx=class e extends Xb{get name(){return this.type.name}get from(){return this.context.start+this.context.buffer.buffer[this.index+1]}get to(){return this.context.start+this.context.buffer.buffer[this.index+2]}constructor(e,t,n){super(),this.context=e,this._parent=t,this.index=n,this.type=e.buffer.set.types[e.buffer.buffer[n]]}child(t,n,r){let{buffer:i}=this.context,a=i.findChild(this.index+4,i.buffer[this.index+3],t,n-this.context.start,r);return a<0?null:new e(this.context,this,a)}get firstChild(){return this.child(1,0,4)}get lastChild(){return this.child(-1,0,4)}childAfter(e){return this.child(1,e,2)}childBefore(e){return this.child(-1,e,-2)}prop(e){return this.type.prop(e)}enter(t,n,r=0){if(r&Wb.ExcludeBuffers)return null;let{buffer:i}=this.context,a=i.findChild(this.index+4,i.buffer[this.index+3],n>0?1:-1,t-this.context.start,n);return a<0?null:new e(this.context,this,a)}get parent(){return this._parent||this.context.parent.nextSignificantParent()}externalSibling(e){return this._parent?null:this.context.parent.nextChild(this.context.index+e,e,0,4)}get nextSibling(){let{buffer:t}=this.context,n=t.buffer[this.index+3];return n<(this._parent?t.buffer[this._parent.index+3]:t.buffer.length)?new e(this.context,this._parent,n):this.externalSibling(1)}get prevSibling(){let{buffer:t}=this.context,n=this._parent?this._parent.index+4:0;return this.index==n?this.externalSibling(-1):new e(this.context,this._parent,t.findChild(n,this.index,-1,0,4))}get tree(){return null}toTree(){let e=[],t=[],{buffer:n}=this.context,r=this.index+4,i=n.buffer[this.index+3];if(i>r){let a=n.buffer[this.index+1];e.push(n.slice(r,i,a)),t.push(0)}return new Gb(this.type,e,t,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}};function nx(e){if(!e.length)return null;let t=0,n=e[0];for(let r=1;r<e.length;r++){let i=e[r];(i.from>n.from||i.to<n.to)&&(n=i,t=r)}let r=n instanceof Zb&&n.index<0?null:n.parent,i=e.slice();return r?i[t]=r:i.splice(t,1),new rx(i,n)}var rx=class{constructor(e,t){this.heads=e,this.node=t}get next(){return nx(this.heads)}};function ix(e,t,n){let r=e.resolveInner(t,n),i=null;for(let e=r instanceof Zb?r:r.context.parent;e;e=e.parent)if(e.index<0){let a=e.parent;(i||=[r]).push(a.resolve(t,n)),e=a}else{let a=Rb.get(e.tree);if(a&&a.overlay&&a.overlay[0].from<=t&&a.overlay[a.overlay.length-1].to>=t){let o=new Zb(a.tree,a.overlay[0].from+e.from,-1,e);(i||=[r]).push(Yb(o,t,n,!1))}}return i?nx(i):r}var ax=class{get name(){return this.type.name}constructor(e,t=0){if(this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,this.mode=t&~Wb.EnterBracketed,e instanceof Zb)this.yieldNode(e);else{this._tree=e.context.parent,this.buffer=e.context;for(let t=e._parent;t;t=t._parent)this.stack.unshift(t.index);this.bufferNode=e,this.yieldBuf(e.index)}}yieldNode(e){return e?(this._tree=e,this.type=e.type,this.from=e.from,this.to=e.to,!0):!1}yieldBuf(e,t){this.index=e;let{start:n,buffer:r}=this.buffer;return this.type=t||r.set.types[r.buffer[e]],this.from=n+r.buffer[e+1],this.to=n+r.buffer[e+2],!0}yield(e){return e?e instanceof Zb?(this.buffer=null,this.yieldNode(e)):(this.buffer=e.context,this.yieldBuf(e.index,e.type)):!1}toString(){return this.buffer?this.buffer.buffer.childString(this.index):this._tree.toString()}enterChild(e,t,n){if(!this.buffer)return this.yield(this._tree.nextChild(e<0?this._tree._tree.children.length-1:0,e,t,n,this.mode));let{buffer:r}=this.buffer,i=r.findChild(this.index+4,r.buffer[this.index+3],e,t-this.buffer.start,n);return i<0?!1:(this.stack.push(this.index),this.yieldBuf(i))}firstChild(){return this.enterChild(1,0,4)}lastChild(){return this.enterChild(-1,0,4)}childAfter(e){return this.enterChild(1,e,2)}childBefore(e){return this.enterChild(-1,e,-2)}enter(e,t,n=this.mode){return this.buffer?n&Wb.ExcludeBuffers?!1:this.enterChild(1,e,t):this.yield(this._tree.enter(e,t,n))}parent(){if(!this.buffer)return this.yieldNode(this.mode&Wb.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let e=this.mode&Wb.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent();return this.buffer=null,this.yieldNode(e)}sibling(e){if(!this.buffer)return this._tree._parent?this.yield(this._tree.index<0?null:this._tree._parent.nextChild(this._tree.index+e,e,0,4,this.mode)):!1;let{buffer:t}=this.buffer,n=this.stack.length-1;if(e<0){let e=n<0?0:this.stack[n]+4;if(this.index!=e)return this.yieldBuf(t.findChild(e,this.index,-1,0,4))}else{let e=t.buffer[this.index+3];if(e<(n<0?t.buffer.length:t.buffer[this.stack[n]+3]))return this.yieldBuf(e)}return n<0&&this.yield(this.buffer.parent.nextChild(this.buffer.index+e,e,0,4,this.mode))}nextSibling(){return this.sibling(1)}prevSibling(){return this.sibling(-1)}atLastNode(e){let t,n,{buffer:r}=this;if(r){if(e>0){if(this.index<r.buffer.buffer.length)return!1}else for(let e=0;e<this.index;e++)if(r.buffer.buffer[e+3]<this.index)return!1;({index:t,parent:n}=r)}else({index:t,_parent:n}=this._tree);for(;n;{index:t,_parent:n}=n)if(t>-1)for(let r=t+e,i=e<0?-1:n._tree.children.length;r!=i;r+=e){let e=n._tree.children[r];if(this.mode&Wb.IncludeAnonymous||e instanceof qb||!e.type.isAnonymous||ox(e))return!1}return!0}move(e,t){if(t&&this.enterChild(e,0,4))return!0;for(;;){if(this.sibling(e))return!0;if(this.atLastNode(e)||!this.parent())return!1}}next(e=!0){return this.move(1,e)}prev(e=!0){return this.move(-1,e)}moveTo(e,t=0){for(;(this.from==this.to||(t<1?this.from>=e:this.from>e)||(t>-1?this.to<=e:this.to<e))&&this.parent(););for(;this.enterChild(1,e,t););return this}get node(){if(!this.buffer)return this._tree;let e=this.bufferNode,t=null,n=0;if(e&&e.context==this.buffer)scan:for(let r=this.index,i=this.stack.length;i>=0;){for(let a=e;a;a=a._parent)if(a.index==r){if(r==this.index)return a;t=a,n=i+1;break scan}r=this.stack[--i]}for(let e=n;e<this.stack.length;e++)t=new tx(this.buffer,t,this.stack[e]);return this.bufferNode=new tx(this.buffer,t,this.index)}get tree(){return this.buffer?null:this._tree._tree}iterate(e,t){for(let n=0;;){let r=!1;if(this.type.isAnonymous||e(this)!==!1){if(this.firstChild()){n++;continue}this.type.isAnonymous||(r=!0)}for(;;){if(r&&t&&t(this),r=this.type.isAnonymous,!n)return;if(this.nextSibling())break;this.parent(),n--,r=!0}}}matchContext(e){if(!this.buffer)return $b(this.node.parent,e);let{buffer:t}=this.buffer,{types:n}=t.set;for(let r=e.length-1,i=this.stack.length-1;r>=0;i--){if(i<0)return $b(this._tree,e,r);let a=n[t.buffer[this.stack[i]]];if(!a.isAnonymous){if(e[r]&&e[r]!=a.name)return!1;r--}}return!0}};function ox(e){return e.children.some(e=>e instanceof qb||!e.type.isAnonymous||ox(e))}function sx(e){let{buffer:t,nodeSet:n,maxBufferLength:r=Pb,reused:i=[],minRepeatType:a=n.types.length}=e,o=Array.isArray(t)?new Kb(t,t.length):t,s=n.types,c=0,l=0;function u(e,t,_,v,y,b){let{id:x,start:S,end:C,size:w}=o,T=l,E=c;if(w<0){if(o.next(),w==-1){let t=i[x];_.push(t),v.push(S-e);return}if(w==-3){c=x;return}if(w==-4){l=x;return}throw RangeError(`Unrecognized record size: ${w}`)}let D=s[x],O,k,ee=S-e;if(C-S<=r&&(k=h(o.pos-t,y))){let t=new Uint16Array(k.size-k.skip),r=o.pos-k.size,i=t.length;for(;o.pos>r;)i=g(k.start,t,i);O=new qb(t,C-k.start,n),ee=k.start-e}else{let e=o.pos-w;o.next();let t=[],n=[],i=x>=a?x:-1,s=0,c=C;for(;o.pos>e;)i>=0&&o.id==i&&o.size>=0?(o.end<=c-r&&(p(t,n,S,s,o.end,c,i,T,E),s=t.length,c=o.end),o.next()):b>2500?d(S,e,t,n):u(S,e,t,n,i,b+1);if(i>=0&&s>0&&s<t.length&&p(t,n,S,s,S,c,i,T,E),t.reverse(),n.reverse(),i>-1&&s>0){let e=f(D,E);O=ux(D,t,n,0,t.length,0,C-S,e,e)}else O=m(D,t,n,C-S,T-C,E)}_.push(O),v.push(ee)}function d(e,t,i,a){let s=[],c=0,l=-1;for(;o.pos>t;){let{id:e,start:t,end:n,size:i}=o;if(i>4)o.next();else if(l>-1&&t<l)break;else l<0&&(l=n-r),s.push(e,t,n),c++,o.next()}if(c){let t=new Uint16Array(c*4),r=s[s.length-2];for(let e=s.length-3,n=0;e>=0;e-=3)t[n++]=s[e],t[n++]=s[e+1]-r,t[n++]=s[e+2]-r,t[n++]=n;i.push(new qb(t,s[2]-r,n)),a.push(r-e)}}function f(e,t){return(n,r,i)=>{let a=0,o=n.length-1,s,c;if(o>=0&&(s=n[o])instanceof Gb){if(!o&&s.type==e&&s.length==i)return s;(c=s.prop(Lb.lookAhead))&&(a=r[o]+s.length+c)}return m(e,n,r,i,a,t)}}function p(e,t,r,i,a,o,s,c,l){let u=[],d=[];for(;e.length>i;)u.push(e.pop()),d.push(t.pop()+r-a);e.push(m(n.types[s],u,d,o-a,c-o,l)),t.push(a-r)}function m(e,t,n,r,i,a,o){if(a){let e=[Lb.contextHash,a];o=o?[e].concat(o):[e]}if(i>25){let e=[Lb.lookAhead,i];o=o?[e].concat(o):[e]}return new Gb(e,t,n,r,o)}function h(e,t){let n=o.fork(),i=0,s=0,c=0,l=n.end-r,u={size:0,start:0,skip:0};scan:for(let r=n.pos-e;n.pos>r;){let e=n.size;if(n.id==t&&e>=0){u.size=i,u.start=s,u.skip=c,c+=4,i+=4,n.next();continue}let o=n.pos-e;if(e<0||o<r||n.start<l)break;let d=n.id>=a?4:0,f=n.start;for(n.next();n.pos>o;){if(n.size<0){if(n.size==-3||n.size==-4)d+=4;else break scan}else n.id>=a&&(d+=4);n.next()}s=f,i+=e,c+=d}return(t<0||i==e)&&(u.size=i,u.start=s,u.skip=c),u.size>4?u:void 0}function g(e,t,n){let{id:r,start:i,end:s,size:u}=o;if(o.next(),u>=0&&r<a){let a=n;if(u>4){let r=o.pos-(u-4);for(;o.pos>r;)n=g(e,t,n)}t[--n]=a,t[--n]=s-e,t[--n]=i-e,t[--n]=r}else u==-3?c=r:u==-4&&(l=r);return n}let _=[],v=[];for(;o.pos>0;)u(e.start||0,e.bufferStart||0,_,v,-1,0);let y=e.length??(_.length?v[0]+_[0].length:0);return new Gb(s[e.topID],_.reverse(),v.reverse(),y)}var cx=new WeakMap;function lx(e,t){if(!e.isAnonymous||t instanceof qb||t.type!=e)return 1;let n=cx.get(t);if(n==null){n=1;for(let r of t.children){if(r.type!=e||!(r instanceof Gb)){n=1;break}n+=lx(e,r)}cx.set(t,n)}return n}function ux(e,t,n,r,i,a,o,s,c){let l=0;for(let n=r;n<i;n++)l+=lx(e,t[n]);let u=Math.ceil(l*1.5/8),d=[],f=[];function p(t,n,r,i,o){for(let s=r;s<i;){let r=s,l=n[s],m=lx(e,t[s]);for(s++;s<i;s++){let n=lx(e,t[s]);if(m+n>=u)break;m+=n}if(s==r+1){if(m>u){let e=t[r];p(e.children,e.positions,0,e.children.length,n[r]+o);continue}d.push(t[r])}else{let i=n[s-1]+t[s-1].length-l;d.push(ux(e,t,n,r,s,l,i,null,c))}f.push(l+o-a)}}return p(t,n,r,i,0),(s||c)(d,f,o)}var dx=class{constructor(){this.map=new WeakMap}setBuffer(e,t,n){let r=this.map.get(e);r||this.map.set(e,r=new Map),r.set(t,n)}getBuffer(e,t){let n=this.map.get(e);return n&&n.get(t)}set(e,t){e instanceof tx?this.setBuffer(e.context.buffer,e.index,t):e instanceof Zb&&this.map.set(e.tree,t)}get(e){return e instanceof tx?this.getBuffer(e.context.buffer,e.index):e instanceof Zb?this.map.get(e.tree):void 0}cursorSet(e,t){e.buffer?this.setBuffer(e.buffer.buffer,e.index,t):this.map.set(e.tree,t)}cursorGet(e){return e.buffer?this.getBuffer(e.buffer.buffer,e.index):this.map.get(e.tree)}},fx=class e{constructor(e,t,n,r,i=!1,a=!1){this.from=e,this.to=t,this.tree=n,this.offset=r,this.open=!!i|(a?2:0)}get openStart(){return(this.open&1)>0}get openEnd(){return(this.open&2)>0}static addTree(t,n=[],r=!1){let i=[new e(0,t.length,t,0,!1,r)];for(let e of n)e.to>t.length&&i.push(e);return i}static applyChanges(t,n,r=128){if(!n.length)return t;let i=[],a=1,o=t.length?t[0]:null;for(let s=0,c=0,l=0;;s++){let u=s<n.length?n[s]:null,d=u?u.fromA:1e9;if(d-c>=r)for(;o&&o.from<d;){let n=o;if(c>=n.from||d<=n.to||l){let t=Math.max(n.from,c)-l,r=Math.min(n.to,d)-l;n=t>=r?null:new e(t,r,n.tree,n.offset+l,s>0,!!u)}if(n&&i.push(n),o.to>d)break;o=a<t.length?t[a++]:null}if(!u)break;c=u.toA,l=u.toA-u.toB}return i}},px=class{startParse(e,t,n){return typeof e==`string`&&(e=new mx(e)),n=n?n.length?n.map(e=>new Ib(e.from,e.to)):[new Ib(0,0)]:[new Ib(0,e.length)],this.createParse(e,t||[],n)}parse(e,t,n){let r=this.startParse(e,t,n);for(;;){let e=r.advance();if(e)return e}}},mx=class{constructor(e){this.string=e}get length(){return this.string.length}chunk(e){return this.string.slice(e)}get lineChunks(){return!1}read(e,t){return this.string.slice(e,t)}};function hx(e){return(t,n,r,i)=>new bx(t,e,n,r,i)}var gx=class{constructor(e,t,n,r,i,a){this.parser=e,this.parse=t,this.overlay=n,this.bracketed=r,this.target=i,this.from=a}};function _x(e){if(!e.length||e.some(e=>e.from>=e.to))throw RangeError(`Invalid inner parse ranges given: `+JSON.stringify(e))}var vx=class{constructor(e,t,n,r,i,a,o,s){this.parser=e,this.predicate=t,this.mounts=n,this.index=r,this.start=i,this.bracketed=a,this.target=o,this.prev=s,this.depth=0,this.ranges=[]}},yx=new Lb({perNode:!0}),bx=class{constructor(e,t,n,r,i){this.nest=t,this.input=n,this.fragments=r,this.ranges=i,this.inner=[],this.innerDone=0,this.baseTree=null,this.stoppedAt=null,this.baseParse=e}advance(){if(this.baseParse){let e=this.baseParse.advance();if(!e)return null;if(this.baseParse=null,this.baseTree=e,this.startInner(),this.stoppedAt!=null)for(let e of this.inner)e.parse.stopAt(this.stoppedAt)}if(this.innerDone==this.inner.length){let e=this.baseTree;return this.stoppedAt!=null&&(e=new Gb(e.type,e.children,e.positions,e.length,e.propValues.concat([[yx,this.stoppedAt]]))),e}let e=this.inner[this.innerDone],t=e.parse.advance();if(t){this.innerDone++;let n=Object.assign(Object.create(null),e.target.props);n[Lb.mounted.id]=new Rb(t,e.overlay,e.parser,e.bracketed),e.target.props=n}return null}get parsedPos(){if(this.baseParse)return 0;let e=this.input.length;for(let t=this.innerDone;t<this.inner.length;t++)this.inner[t].from<e&&(e=Math.min(e,this.inner[t].parse.parsedPos));return e}stopAt(e){if(this.stoppedAt=e,this.baseParse)this.baseParse.stopAt(e);else for(let t=this.innerDone;t<this.inner.length;t++)this.inner[t].parse.stopAt(e)}startInner(){let e=new Tx(this.fragments),t=null,n=null,r=new ax(new Zb(this.baseTree,this.ranges[0].from,0,null),Wb.IncludeAnonymous|Wb.IgnoreMounts);scan:for(let i,a;;){let o=!0,s;if(this.stoppedAt!=null&&r.from>=this.stoppedAt)o=!1;else if(e.hasNode(r)){if(t){let e=t.mounts.find(e=>e.frag.from<=r.from&&e.frag.to>=r.to&&e.mount.overlay);if(e)for(let n of e.mount.overlay){let i=n.from+e.pos,a=n.to+e.pos;i>=r.from&&a<=r.to&&!t.ranges.some(e=>e.from<a&&e.to>i)&&t.ranges.push({from:i,to:a})}}o=!1}else if(n&&(a=xx(n.ranges,r.from,r.to)))o=a!=2;else if(!r.type.isAnonymous&&(i=this.nest(r,this.input))&&(r.from<r.to||!i.overlay)){r.tree||(Cx(r),t&&t.depth++,n&&n.depth++);let a=e.findMounts(r.from,i.parser);if(typeof i.overlay==`function`)t=new vx(i.parser,i.overlay,a,this.inner.length,r.from,!!i.bracketed,r.tree,t);else{let e=Ex(this.ranges,i.overlay||(r.from<r.to?[new Ib(r.from,r.to)]:[]));e.length&&_x(e),(e.length||!i.overlay)&&this.inner.push(new gx(i.parser,e.length?i.parser.startParse(this.input,Ox(a,e),e):i.parser.startParse(``),i.overlay?i.overlay.map(e=>new Ib(e.from-r.from,e.to-r.from)):null,!!i.bracketed,r.tree,e.length?e[0].from:r.from)),i.overlay?e.length&&(n={ranges:e,depth:0,prev:n}):o=!1}}else if(t&&(s=t.predicate(r))&&(s===!0&&(s=new Ib(r.from,r.to)),s.from<s.to)){let e=t.ranges.length-1;e>=0&&t.ranges[e].to==s.from?t.ranges[e]={from:t.ranges[e].from,to:s.to}:t.ranges.push(s)}if(o&&r.firstChild())t&&t.depth++,n&&n.depth++;else for(;!r.nextSibling();){if(!r.parent())break scan;if(t&&!--t.depth){let e=Ex(this.ranges,t.ranges);e.length&&(_x(e),this.inner.splice(t.index,0,new gx(t.parser,t.parser.startParse(this.input,Ox(t.mounts,e),e),t.ranges.map(e=>new Ib(e.from-t.start,e.to-t.start)),t.bracketed,t.target,e[0].from))),t=t.prev}n&&!--n.depth&&(n=n.prev)}}}};function xx(e,t,n){for(let r of e){if(r.from>=n)break;if(r.to>t)return r.from<=t&&r.to>=n?2:1}return 0}function Sx(e,t,n,r,i,a){if(t<n){let o=e.buffer[t+1];r.push(e.slice(t,n,o)),i.push(o-a)}}function Cx(e){let{node:t}=e,n=[],r=t.context.buffer;do n.push(e.index),e.parent();while(!e.tree);let i=e.tree,a=i.children.indexOf(r),o=i.children[a],s=o.buffer,c=[a];function l(e,r,i,a,u,d){let f=n[d],p=[],m=[];Sx(o,e,f,p,m,a);let h=s[f+1],g=s[f+2];c.push(p.length);let _=d?l(f+4,s[f+3],o.set.types[s[f]],h,g-h,d-1):t.toTree();return p.push(_),m.push(h-a),Sx(o,s[f+3],r,p,m,a),new Gb(i,p,m,u)}i.children[a]=l(0,s.length,Bb.none,0,o.length,n.length-1);for(let t of c){let n=e.tree.children[t],r=e.tree.positions[t];e.yield(new Zb(n,r+e.from,t,e._tree))}}var wx=class{constructor(e,t){this.offset=t,this.done=!1,this.cursor=e.cursor(Wb.IncludeAnonymous|Wb.IgnoreMounts|Wb.ExcludeBuffers)}moveTo(e){let{cursor:t}=this,n=e-this.offset;for(;!this.done&&t.from<n;)if(!(t.to>=n&&t.enter(n,1,Wb.IncludeAnonymous|Wb.IgnoreOverlays|Wb.ExcludeBuffers))){if(t.to<=n)t.next(!1)||(this.done=!0);else break}}hasNode(e){if(this.moveTo(e.from),!this.done&&this.cursor.from+this.offset==e.from&&this.cursor.tree)for(let t=this.cursor.tree;;){if(t==e.tree)return!0;if(t.children.length&&t.positions[0]==0&&t.children[0]instanceof Gb)t=t.children[0];else break}return!1}},Tx=class{constructor(e){if(this.fragments=e,this.curTo=0,this.fragI=0,e.length){let t=this.curFrag=e[0];this.curTo=t.tree.prop(yx)??t.to,this.inner=new wx(t.tree,-t.offset)}else this.curFrag=this.inner=null}hasNode(e){for(;this.curFrag&&e.from>=this.curTo;)this.nextFrag();return this.curFrag&&this.curFrag.from<=e.from&&this.curTo>=e.to&&this.inner.hasNode(e)}nextFrag(){if(this.fragI++,this.fragI==this.fragments.length)this.curFrag=this.inner=null;else{let e=this.curFrag=this.fragments[this.fragI];this.curTo=e.tree.prop(yx)??e.to,this.inner=new wx(e.tree,-e.offset)}}findMounts(e,t){let n=[];if(this.inner){this.inner.cursor.moveTo(e,1);for(let e=this.inner.cursor.node;e;e=e.parent){let r=e.tree?.prop(Lb.mounted);if(r&&r.parser==t)for(let t=this.fragI;t<this.fragments.length;t++){let i=this.fragments[t];if(i.from>=e.to)break;i.tree==this.curFrag.tree&&n.push({frag:i,pos:e.from-i.offset,mount:r})}}}return n}};function Ex(e,t){let n=null,r=t;for(let i=1,a=0;i<e.length;i++){let o=e[i-1].to,s=e[i].from;for(;a<r.length;a++){let e=r[a];if(e.from>=s)break;e.to<=o||(n||(r=n=t.slice()),e.from<o?(n[a]=new Ib(e.from,o),e.to>s&&n.splice(a+1,0,new Ib(s,e.to))):e.to>s?n[a--]=new Ib(s,e.to):n.splice(a--,1))}}return r}function Dx(e,t,n,r){let i=0,a=0,o=!1,s=!1,c=-1e9,l=[];for(;;){let u=i==e.length?1e9:o?e[i].to:e[i].from,d=a==t.length?1e9:s?t[a].to:t[a].from;if(o!=s){let e=Math.max(c,n),t=Math.min(u,d,r);e<t&&l.push(new Ib(e,t))}if(c=Math.min(u,d),c==1e9)break;u==c&&(o?(o=!1,i++):o=!0),d==c&&(s?(s=!1,a++):s=!0)}return l}function Ox(e,t){let n=[];for(let{pos:r,mount:i,frag:a}of e){let e=r+(i.overlay?i.overlay[0].from:0),o=e+i.tree.length,s=Math.max(a.from,e),c=Math.min(a.to,o);if(i.overlay){let o=Dx(t,i.overlay.map(e=>new Ib(e.from+r,e.to+r)),s,c);for(let t=0,r=s;;t++){let s=t==o.length,l=s?c:o[t].from;if(l>r&&n.push(new fx(r,l,i.tree,-e,a.from>=r||a.openStart,a.to<=l||a.openEnd)),s)break;r=o[t].to}}else n.push(new fx(s,c,i.tree,-e,a.from>=e||a.openStart,a.to<=o||a.openEnd))}return n}var kx=0,Ax=class e{constructor(e,t,n,r){this.name=e,this.set=t,this.base=n,this.modified=r,this.id=kx++}toString(){let{name:e}=this;for(let t of this.modified)t.name&&(e=`${t.name}(${e})`);return e}static define(t,n){let r=typeof t==`string`?t:`?`;if(t instanceof e&&(n=t),n?.base)throw Error(`Can not derive from a modified tag`);let i=new e(r,[],null,[]);if(i.set.push(i),n)for(let e of n.set)i.set.push(e);return i}static defineModifier(e){let t=new Mx(e);return e=>e.modified.indexOf(t)>-1?e:Mx.get(e.base||e,e.modified.concat(t).sort((e,t)=>e.id-t.id))}},jx=0,Mx=class e{constructor(e){this.name=e,this.instances=[],this.id=jx++}static get(t,n){if(!n.length)return t;let r=n[0].instances.find(e=>e.base==t&&Nx(n,e.modified));if(r)return r;let i=[],a=new Ax(t.name,i,t,n);for(let e of n)e.instances.push(a);let o=Px(n);for(let n of t.set)if(!n.modified.length)for(let t of o)i.push(e.get(n,t));return a}};function Nx(e,t){return e.length==t.length&&e.every((e,n)=>e==t[n])}function Px(e){let t=[[]];for(let n=0;n<e.length;n++)for(let r=0,i=t.length;r<i;r++)t.push(t[r].concat(e[n]));return t.sort((e,t)=>t.length-e.length)}function Fx(e){let t=Object.create(null);for(let n in e){let r=e[n];Array.isArray(r)||(r=[r]);for(let e of n.split(` `))if(e){let n=[],i=2,a=e;for(let t=0;;){if(a==`...`&&t>0&&t+3==e.length){i=1;break}let r=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(a);if(!r)throw RangeError(`Invalid path: `+e);if(n.push(r[0]==`*`?``:r[0][0]==`"`?JSON.parse(r[0]):r[0]),t+=r[0].length,t==e.length)break;let o=e[t++];if(t==e.length&&o==`!`){i=0;break}if(o!=`/`)throw RangeError(`Invalid path: `+e);a=e.slice(t)}let o=n.length-1,s=n[o];if(!s)throw RangeError(`Invalid path: `+e);t[s]=new Lx(r,i,o>0?n.slice(0,o):null).sort(t[s])}}return Ix.add(t)}var Ix=new Lb({combine(e,t){let n,r,i;for(;e||t;){if(!e||t&&e.depth<=t.depth?(i=t,t=t.next):(i=e,e=e.next),n&&n.mode==i.mode&&!i.context&&!n.context)continue;let a=new Lx(i.tags,i.mode,i.context);n?n.next=a:r=a,n=a}return r}}),Lx=class{constructor(e,t,n,r){this.tags=e,this.mode=t,this.context=n,this.next=r}get opaque(){return this.mode==0}get inherit(){return this.mode==1}sort(e){return!e||e.depth<this.depth?(this.next=e,this):(e.next=this.sort(e.next),e)}get depth(){return this.context?this.context.length:0}};Lx.empty=new Lx([],2,null);function Rx(e,t){let n=Object.create(null);for(let t of e)if(!Array.isArray(t.tag))n[t.tag.id]=t.class;else for(let e of t.tag)n[e.id]=t.class;let{scope:r,all:i=null}=t||{};return{style:e=>{let t=i;for(let r of e)for(let e of r.set){let r=n[e.id];if(r){t=t?t+` `+r:r;break}}return t},scope:r}}function zx(e,t){let n=null;for(let r of e){let e=r.style(t);e&&(n=n?n+` `+e:e)}return n}function Bx(e,t,n,r=0,i=e.length){let a=new Vx(r,Array.isArray(t)?t:[t],n);a.highlightRange(e.cursor(),r,i,``,a.highlighters),a.flush(i)}var Vx=class{constructor(e,t,n){this.at=e,this.highlighters=t,this.span=n,this.class=``}startSpan(e,t){t!=this.class&&(this.flush(e),e>this.at&&(this.at=e),this.class=t)}flush(e){e>this.at&&this.class&&this.span(this.at,e,this.class)}highlightRange(e,t,n,r,i){let{type:a,from:o,to:s}=e;if(o>=n||s<=t)return;a.isTop&&(i=this.highlighters.filter(e=>!e.scope||e.scope(a)));let c=r,l=Hx(e)||Lx.empty,u=zx(i,l.tags);if(u&&(c&&(c+=` `),c+=u,l.mode==1&&(r+=(r?` `:``)+u)),this.startSpan(Math.max(t,o),c),l.opaque)return;let d=e.tree&&e.tree.prop(Lb.mounted);if(d&&d.overlay){let a=e.node.enter(d.overlay[0].from+o,1),l=this.highlighters.filter(e=>!e.scope||e.scope(d.tree.type)),u=e.firstChild();for(let f=0,p=o;;f++){let m=f<d.overlay.length?d.overlay[f]:null,h=m?m.from+o:s,g=Math.max(t,p),_=Math.min(n,h);if(g<_&&u)for(;e.from<_&&(this.highlightRange(e,g,_,r,i),this.startSpan(Math.min(_,e.to),c),!(e.to>=h||!e.nextSibling())););if(!m||h>n)break;p=m.to+o,p>t&&(this.highlightRange(a.cursor(),Math.max(t,m.from+o),Math.min(n,p),``,l),this.startSpan(Math.min(n,p),c))}u&&e.parent()}else if(e.firstChild()){d&&(r=``);do if(!(e.to<=t)){if(e.from>=n)break;this.highlightRange(e,t,n,r,i),this.startSpan(Math.min(n,e.to),c)}while(e.nextSibling());e.parent()}}};function Hx(e){let t=e.type.prop(Ix);for(;t&&t.context&&!e.matchContext(t.context);)t=t.next;return t||null}var J=Ax.define,Ux=J(),Wx=J(),Gx=J(Wx),Kx=J(Wx),qx=J(),Jx=J(qx),Yx=J(qx),Xx=J(),Zx=J(Xx),Qx=J(),$x=J(),eS=J(),tS=J(eS),nS=J(),Y={comment:Ux,lineComment:J(Ux),blockComment:J(Ux),docComment:J(Ux),name:Wx,variableName:J(Wx),typeName:Gx,tagName:J(Gx),propertyName:Kx,attributeName:J(Kx),className:J(Wx),labelName:J(Wx),namespace:J(Wx),macroName:J(Wx),literal:qx,string:Jx,docString:J(Jx),character:J(Jx),attributeValue:J(Jx),number:Yx,integer:J(Yx),float:J(Yx),bool:J(qx),regexp:J(qx),escape:J(qx),color:J(qx),url:J(qx),keyword:Qx,self:J(Qx),null:J(Qx),atom:J(Qx),unit:J(Qx),modifier:J(Qx),operatorKeyword:J(Qx),controlKeyword:J(Qx),definitionKeyword:J(Qx),moduleKeyword:J(Qx),operator:$x,derefOperator:J($x),arithmeticOperator:J($x),logicOperator:J($x),bitwiseOperator:J($x),compareOperator:J($x),updateOperator:J($x),definitionOperator:J($x),typeOperator:J($x),controlOperator:J($x),punctuation:eS,separator:J(eS),bracket:tS,angleBracket:J(tS),squareBracket:J(tS),paren:J(tS),brace:J(tS),content:Xx,heading:Zx,heading1:J(Zx),heading2:J(Zx),heading3:J(Zx),heading4:J(Zx),heading5:J(Zx),heading6:J(Zx),contentSeparator:J(Xx),list:J(Xx),quote:J(Xx),emphasis:J(Xx),strong:J(Xx),link:J(Xx),monospace:J(Xx),strikethrough:J(Xx),inserted:J(),deleted:J(),changed:J(),invalid:J(),meta:nS,documentMeta:J(nS),annotation:J(nS),processingInstruction:J(nS),definition:Ax.defineModifier(`definition`),constant:Ax.defineModifier(`constant`),function:Ax.defineModifier(`function`),standard:Ax.defineModifier(`standard`),local:Ax.defineModifier(`local`),special:Ax.defineModifier(`special`)};for(let e in Y){let t=Y[e];t instanceof Ax&&(t.name=e)}Rx([{tag:Y.link,class:`tok-link`},{tag:Y.heading,class:`tok-heading`},{tag:Y.emphasis,class:`tok-emphasis`},{tag:Y.strong,class:`tok-strong`},{tag:Y.keyword,class:`tok-keyword`},{tag:Y.atom,class:`tok-atom`},{tag:Y.bool,class:`tok-bool`},{tag:Y.url,class:`tok-url`},{tag:Y.labelName,class:`tok-labelName`},{tag:Y.inserted,class:`tok-inserted`},{tag:Y.deleted,class:`tok-deleted`},{tag:Y.literal,class:`tok-literal`},{tag:Y.string,class:`tok-string`},{tag:Y.number,class:`tok-number`},{tag:[Y.regexp,Y.escape,Y.special(Y.string)],class:`tok-string2`},{tag:Y.variableName,class:`tok-variableName`},{tag:Y.local(Y.variableName),class:`tok-variableName tok-local`},{tag:Y.definition(Y.variableName),class:`tok-variableName tok-definition`},{tag:Y.special(Y.variableName),class:`tok-variableName2`},{tag:Y.definition(Y.propertyName),class:`tok-propertyName tok-definition`},{tag:Y.typeName,class:`tok-typeName`},{tag:Y.namespace,class:`tok-namespace`},{tag:Y.className,class:`tok-className`},{tag:Y.macroName,class:`tok-macroName`},{tag:Y.propertyName,class:`tok-propertyName`},{tag:Y.operator,class:`tok-operator`},{tag:Y.comment,class:`tok-comment`},{tag:Y.meta,class:`tok-meta`},{tag:Y.invalid,class:`tok-invalid`},{tag:Y.punctuation,class:`tok-punctuation`}]);function rS(e,t,n,r=0,i=0){t??(t=e.search(/[^\s\u00a0]/),t==-1&&(t=e.length));let a=i;for(let i=r;i<t;i++)e.charCodeAt(i)==9?a+=n-a%n:a++;return a}var iS=class{constructor(e,t,n,r){this.string=e,this.tabSize=t,this.indentUnit=n,this.overrideIndent=r,this.pos=0,this.start=0,this.lastColumnPos=0,this.lastColumnValue=0}eol(){return this.pos>=this.string.length}sol(){return this.pos==0}peek(){return this.string.charAt(this.pos)||void 0}next(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)}eat(e){let t=this.string.charAt(this.pos),n;if(n=typeof e==`string`?t==e:t&&(e instanceof RegExp?e.test(t):e(t)),n)return++this.pos,t}eatWhile(e){let t=this.pos;for(;this.eat(e););return this.pos>t}eatSpace(){let e=this.pos;for(;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e}skipToEnd(){this.pos=this.string.length}skipTo(e){let t=this.string.indexOf(e,this.pos);if(t>-1)return this.pos=t,!0}backUp(e){this.pos-=e}column(){return this.lastColumnPos<this.start&&(this.lastColumnValue=rS(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue}indentation(){return this.overrideIndent??rS(this.string,null,this.tabSize)}match(e,t,n){if(typeof e==`string`){let r=e=>n?e.toLowerCase():e;return r(this.string.substr(this.pos,e.length))==r(e)?(t!==!1&&(this.pos+=e.length),!0):null}{let n=this.string.slice(this.pos).match(e);return n&&n.index>0?null:(n&&t!==!1&&(this.pos+=n[0].length),n)}}current(){return this.string.slice(this.start,this.pos)}},aS=new Lb;function oS(e){return G.define({combine:e?t=>t.concat(e):void 0})}var sS=new Lb,cS=class{constructor(e,t,n=[],r=``){this.data=e,this.name=r,bp.prototype.hasOwnProperty(`tree`)||Object.defineProperty(bp.prototype,"tree",{get(){return dS(this)}}),this.parser=t,this.extension=[bS.of(this),bp.languageData.of((e,t,n)=>{let r=lS(e,t,n),i=r.type.prop(aS);if(!i)return[];let a=e.facet(i),o=r.type.prop(sS);if(o){let i=r.resolve(t-r.from,n);for(let t of o)if(t.test(i,e)){let n=e.facet(t.facet);return t.type==`replace`?n:n.concat(a)}}return a})].concat(n)}isActiveAt(e,t,n=-1){return lS(e,t,n).type.prop(aS)==this.data}findRegions(e){let t=e.facet(bS);if(t?.data==this.data)return[{from:0,to:e.doc.length}];if(!t||!t.allowsNesting)return[];let n=[],r=(e,t)=>{if(e.prop(aS)==this.data){n.push({from:t,to:t+e.length});return}let i=e.prop(Lb.mounted);if(i){if(i.tree.prop(aS)==this.data){if(i.overlay)for(let e of i.overlay)n.push({from:e.from+t,to:e.to+t});else n.push({from:t,to:t+e.length});return}if(i.overlay){let e=n.length;if(r(i.tree,i.overlay[0].from+t),n.length>e)return}}for(let n=0;n<e.children.length;n++){let i=e.children[n];i instanceof Gb&&r(i,e.positions[n]+t)}};return r(dS(e),0),n}get allowsNesting(){return!0}};cS.setState=ap.define();function lS(e,t,n){let r=e.facet(bS),i=dS(e).topNode;if(!r||r.allowsNesting)for(let e=i;e;e=e.enter(t,n,Wb.ExcludeBuffers|Wb.EnterBracketed))e.type.isTop&&(i=e);return i}var uS=class e extends cS{constructor(e,t,n){super(e,t,[],n),this.parser=t}static define(t){let n=oS(t.languageData);return new e(n,t.parser.configure({props:[aS.add(e=>e.isTop?n:void 0)]}),t.name)}configure(t,n){return new e(this.data,this.parser.configure(t),n||this.name)}get allowsNesting(){return this.parser.hasWrappers()}};function dS(e){let t=e.field(cS.state,!1);return t?t.tree:Gb.empty}var fS=class{constructor(e){this.doc=e,this.cursorPos=0,this.string=``,this.cursor=e.iter()}get length(){return this.doc.length}syncTo(e){return this.string=this.cursor.next(e-this.cursorPos).value,this.cursorPos=e+this.string.length,this.cursorPos-this.string.length}chunk(e){return this.syncTo(e),this.string}get lineChunks(){return!0}read(e,t){let n=this.cursorPos-this.string.length;return e<n||t>=this.cursorPos?this.doc.sliceString(e,t):this.string.slice(e-n,t-n)}},pS=null,mS=class e{constructor(e,t,n=[],r,i,a,o,s){this.parser=e,this.state=t,this.fragments=n,this.tree=r,this.treeLen=i,this.viewport=a,this.skipped=o,this.scheduleOn=s,this.parse=null,this.tempSkipped=[]}static create(t,n,r){return new e(t,n,[],Gb.empty,0,r,[],null)}startParse(){return this.parser.startParse(new fS(this.state.doc),this.fragments)}work(e,t){return t!=null&&t>=this.state.doc.length&&(t=void 0),this.tree!=Gb.empty&&this.isDone(t??this.state.doc.length)?(this.takeTree(),!0):this.withContext(()=>{if(typeof e==`number`){let t=Date.now()+e;e=()=>Date.now()>t}for(this.parse||=this.startParse(),t!=null&&(this.parse.stoppedAt==null||this.parse.stoppedAt>t)&&t<this.state.doc.length&&this.parse.stopAt(t);;){let n=this.parse.advance();if(n){if(this.fragments=this.withoutTempSkipped(fx.addTree(n,this.fragments,this.parse.stoppedAt!=null)),this.treeLen=this.parse.stoppedAt??this.state.doc.length,this.tree=n,this.parse=null,this.treeLen<(t??this.state.doc.length))this.parse=this.startParse();else return!0}if(e())return!1}})}takeTree(){let e,t;this.parse&&(e=this.parse.parsedPos)>=this.treeLen&&((this.parse.stoppedAt==null||this.parse.stoppedAt>e)&&this.parse.stopAt(e),this.withContext(()=>{for(;!(t=this.parse.advance()););}),this.treeLen=e,this.tree=t,this.fragments=this.withoutTempSkipped(fx.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(e){let t=pS;pS=this;try{return e()}finally{pS=t}}withoutTempSkipped(e){for(let t;t=this.tempSkipped.pop();)e=hS(e,t.from,t.to);return e}changes(t,n){let{fragments:r,tree:i,treeLen:a,viewport:o,skipped:s}=this;if(this.takeTree(),!t.empty){let e=[];if(t.iterChangedRanges((t,n,r,i)=>e.push({fromA:t,toA:n,fromB:r,toB:i})),r=fx.applyChanges(r,e),i=Gb.empty,a=0,o={from:t.mapPos(o.from,-1),to:t.mapPos(o.to,1)},this.skipped.length){s=[];for(let e of this.skipped){let n=t.mapPos(e.from,1),r=t.mapPos(e.to,-1);n<r&&s.push({from:n,to:r})}}}return new e(this.parser,n,r,i,a,o,s,this.scheduleOn)}updateViewport(e){if(this.viewport.from==e.from&&this.viewport.to==e.to)return!1;this.viewport=e;let t=this.skipped.length;for(let t=0;t<this.skipped.length;t++){let{from:n,to:r}=this.skipped[t];n<e.to&&r>e.from&&(this.fragments=hS(this.fragments,n,r),this.skipped.splice(t--,1))}return this.skipped.length>=t?!1:(this.reset(),!0)}reset(){this.parse&&=(this.takeTree(),null)}skipUntilInView(e,t){this.skipped.push({from:e,to:t})}static getSkippingParser(e){return new class extends px{createParse(t,n,r){let i=r[0].from,a=r[r.length-1].to;return{parsedPos:i,advance(){let t=pS;if(t){for(let e of r)t.tempSkipped.push(e);e&&(t.scheduleOn=t.scheduleOn?Promise.all([t.scheduleOn,e]):e)}return this.parsedPos=a,new Gb(Bb.none,[],[],a-i)},stoppedAt:null,stopAt(){}}}}}isDone(e){e=Math.min(e,this.state.doc.length);let t=this.fragments;return this.treeLen>=e&&t.length&&t[0].from==0&&t[0].to>=e}static get(){return pS}};function hS(e,t,n){return fx.applyChanges(e,[{fromA:t,toA:n,fromB:t,toB:n}])}var gS=class e{constructor(e){this.context=e,this.tree=e.tree}apply(t){if(!t.docChanged&&this.tree==this.context.tree)return this;let n=this.context.changes(t.changes,t.state),r=this.context.treeLen==t.startState.doc.length?void 0:Math.max(t.changes.mapPos(this.context.treeLen),n.viewport.to);return n.work(20,r)||n.takeTree(),new e(n)}static init(t){let n=Math.min(3e3,t.doc.length),r=mS.create(t.facet(bS).parser,t,{from:0,to:n});return r.work(20,n)||r.takeTree(),new e(r)}};cS.state=Rf.define({create:gS.init,update(e,t){for(let e of t.effects)if(e.is(cS.setState))return e.value;return t.startState.facet(bS)==t.state.facet(bS)?e.apply(t):gS.init(t.state)}});var _S=e=>{let t=setTimeout(()=>e(),500);return()=>clearTimeout(t)};typeof requestIdleCallback<`u`&&(_S=e=>{let t=-1,n=setTimeout(()=>{t=requestIdleCallback(e,{timeout:400})},100);return()=>t<0?clearTimeout(n):cancelIdleCallback(t)});var vS=typeof navigator<`u`&&navigator.scheduling?.isInputPending?()=>navigator.scheduling.isInputPending():null,yS=Xh.fromClass(class{constructor(e){this.view=e,this.working=null,this.workScheduled=0,this.chunkEnd=-1,this.chunkBudget=-1,this.work=this.work.bind(this),this.scheduleWork()}update(e){let t=this.view.state.field(cS.state).context;(t.updateViewport(e.view.viewport)||this.view.viewport.to>t.treeLen)&&this.scheduleWork(),(e.docChanged||e.selectionSet)&&(this.view.hasFocus&&(this.chunkBudget+=50),this.scheduleWork()),this.checkAsyncSchedule(t)}scheduleWork(){if(this.working)return;let{state:e}=this.view,t=e.field(cS.state);(t.tree!=t.context.tree||!t.context.isDone(e.doc.length))&&(this.working=_S(this.work))}work(e){this.working=null;let t=Date.now();if(this.chunkEnd<t&&(this.chunkEnd<0||this.view.hasFocus)&&(this.chunkEnd=t+3e4,this.chunkBudget=3e3),this.chunkBudget<=0)return;let{state:n,viewport:{to:r}}=this.view,i=n.field(cS.state);if(i.tree==i.context.tree&&i.context.isDone(r+1e5))return;let a=Date.now()+Math.min(this.chunkBudget,100,e&&!vS?Math.max(25,e.timeRemaining()-5):1e9),o=i.context.treeLen<r&&n.doc.length>r+1e3,s=i.context.work(()=>vS&&vS()||Date.now()>a,r+(o?0:1e5));this.chunkBudget-=Date.now()-t,(s||this.chunkBudget<=0)&&(i.context.takeTree(),this.view.dispatch({effects:cS.setState.of(new gS(i.context))})),this.chunkBudget>0&&(!s||o)&&this.scheduleWork(),this.checkAsyncSchedule(i.context)}checkAsyncSchedule(e){e.scheduleOn&&=(this.workScheduled++,e.scheduleOn.then(()=>this.scheduleWork()).catch(e=>Kh(this.view.state,e)).then(()=>this.workScheduled--),null)}destroy(){this.working&&this.working()}isWorking(){return!!(this.working||this.workScheduled>0)}},{eventHandlers:{focus(){this.scheduleWork()}}}),bS=G.define({combine(e){return e.length?e[0]:null},enables:e=>[cS.state,yS,q.contentAttributes.compute([e],t=>{let n=t.facet(e);return n&&n.name?{"data-language":n.name}:{}})]}),xS=class{constructor(e,t=[]){this.language=e,this.support=t,this.extension=[e,t]}},X=class e{constructor(e,t,n,r,i,a=void 0){this.name=e,this.alias=t,this.extensions=n,this.filename=r,this.loadFunc=i,this.support=a,this.loading=null}load(){return this.loading||=this.loadFunc().then(e=>this.support=e,e=>{throw this.loading=null,e})}static of(t){let{load:n,support:r}=t;if(!n){if(!r)throw RangeError(`Must pass either 'load' or 'support' to LanguageDescription.of`);n=()=>Promise.resolve(r)}return new e(t.name,(t.alias||[]).concat(t.name).map(e=>e.toLowerCase()),t.extensions||[],t.filename,n,r)}static matchFilename(e,t){for(let n of e)if(n.filename&&n.filename.test(t))return n;let n=/\.([^.]+)$/.exec(t);if(n){for(let t of e)if(t.extensions.indexOf(n[1])>-1)return t}return null}static matchLanguageName(e,t,n=!0){t=t.toLowerCase();for(let n of e)if(n.alias.some(e=>e==t))return n;if(n)for(let n of e)for(let e of n.alias){let r=t.indexOf(e);if(r>-1&&(e.length>2||!/\w/.test(t[r-1])&&!/\w/.test(t[r+e.length])))return n}return null}},SS=G.define({combine:e=>{if(!e.length)return` `;let t=e[0];if(!t||/\S/.test(t)||Array.from(t).some(e=>e!=t[0]))throw Error(`Invalid indent unit: `+JSON.stringify(e[0]));return t}});function CS(e){let t=e.facet(SS);return t.charCodeAt(0)==9?e.tabSize*t.length:t.length}var wS=new Lb;function TS(e){let t=e.node,n=t.childAfter(t.from),r=t.lastChild;if(!n)return null;let i=e.options.simulateBreak,a=e.state.doc.lineAt(n.from),o=i==null||i<=a.from?a.to:Math.min(a.to,i);for(let e=n.to;;){let i=t.childAfter(e);if(!i||i==r)return null;if(!i.type.isSkipped){if(i.from>=o)return null;let e=/^ */.exec(a.text.slice(n.to-a.from))[0].length;return{from:n.from,to:n.to+e}}e=i.to}}function ES({closing:e,align:t=!0,units:n=1}){return r=>DS(r,t,n,e)}function DS(e,t,n,r,i){let a=e.textAfter,o=a.match(/^\s*/)[0].length,s=r&&a.slice(o,o+r.length)==r||i==e.pos+o,c=t?TS(e):null;return c?s?e.column(c.from):e.column(c.to):e.baseIndent+(s?0:e.unit*n)}var OS=e=>e.baseIndent;function kS({except:e,units:t=1}={}){return n=>{let r=e&&e.test(n.textAfter);return n.baseIndent+(r?0:t*n.unit)}}var AS=G.define(),jS=new Lb;function MS(e){let t=e.firstChild,n=e.lastChild;return t&&t.to<n.from?{from:t.to,to:n.type.isError?e.to:n.from}:null}var NS=class e{constructor(e,t){this.specs=e;let n;function r(e){let t=qp.newName();return(n||=Object.create(null))[`.`+t]=e,t}let i=typeof t.all==`string`?t.all:t.all?r(t.all):void 0,a=t.scope;this.scope=a instanceof cS?e=>e.prop(aS)==a.data:a?e=>e==a:void 0,this.style=Rx(e.map(e=>({tag:e.tag,class:e.class||r(Object.assign({},e,{tag:null}))})),{all:i}).style,this.module=n?new qp(n):null,this.themeType=t.themeType}static define(t,n){return new e(t,n||{})}},PS=G.define(),FS=G.define({combine(e){return e.length?[e[0]]:null}});function IS(e){let t=e.facet(PS);return t.length?t:e.facet(FS)}function LS(e,t){let n=[zS],r;return e instanceof NS&&(e.module&&n.push(q.styleModule.of(e.module)),r=e.themeType),t?.fallback?n.push(FS.of(e)):r?n.push(PS.computeN([q.darkTheme],t=>t.facet(q.darkTheme)==(r==`dark`)?[e]:[])):n.push(PS.of(e)),n}var RS=class{constructor(e){this.markCache=Object.create(null),this.tree=dS(e.state),this.decorations=this.buildDeco(e,IS(e.state)),this.decoratedTo=e.viewport.to}update(e){let t=dS(e.state),n=IS(e.state),r=n!=IS(e.startState),{viewport:i}=e.view,a=e.changes.mapPos(this.decoratedTo,1);t.length<i.to&&!r&&t.type==this.tree.type&&a>=i.to?(this.decorations=this.decorations.map(e.changes),this.decoratedTo=a):(t!=this.tree||e.viewportChanged||r)&&(this.tree=t,this.decorations=this.buildDeco(e.view,n),this.decoratedTo=i.to)}buildDeco(e,t){if(!t||!this.tree.length)return wm.none;let n=new Ap;for(let{from:r,to:i}of e.visibleRanges)Bx(this.tree,t,(e,t,r)=>{n.add(e,t,this.markCache[r]||(this.markCache[r]=wm.mark({class:r})))},r,i);return n.finish()}},zS=Vf.high(Xh.fromClass(RS,{decorations:e=>e.decorations}));Y.meta,Y.link,Y.heading,Y.emphasis,Y.strong,Y.strikethrough,Y.keyword,Y.atom,Y.bool,Y.url,Y.contentSeparator,Y.labelName,Y.literal,Y.inserted,Y.string,Y.deleted,Y.regexp,Y.escape,Y.string,Y.variableName,Y.variableName,Y.typeName,Y.namespace,Y.className,Y.variableName,Y.macroName,Y.propertyName,Y.comment,Y.invalid;var BS=new Lb;function VS(e){return{name:e.name||``,token:e.token,blankLine:e.blankLine||(()=>{}),startState:e.startState||(()=>!0),copyState:e.copyState||HS,indent:e.indent||(()=>null),languageData:e.languageData||{},tokenTable:e.tokenTable||XS,mergeTokens:e.mergeTokens!==!1}}function HS(e){if(typeof e!=`object`)return e;let t={};for(let n in e){let r=e[n];t[n]=r instanceof Array?r.slice():r}return t}var US=new WeakMap,WS=class e extends cS{constructor(e){let t=oS(e.languageData),n=VS(e),r,i=new class extends px{createParse(e,t,n){return new JS(r,e,t,n)}};super(t,i,[],e.name),this.topNode=oC(t,this),r=this,this.streamParser=n,this.stateAfter=new Lb({perNode:!0}),this.tokenTable=e.tokenTable?new nC(n.tokenTable):rC}static define(t){return new e(t)}getIndent(e){let t,{overrideIndentation:n}=e.options;n&&(t=US.get(e.state),t!=null&&t<e.pos-1e4&&(t=void 0));let r=GS(this,e.node.tree,e.node.from,e.node.from,t??e.pos),i,a;if(r?(a=r.state,i=r.pos+1):(a=this.streamParser.startState(e.unit),i=e.node.from),e.pos-i>1e4)return null;for(;i<e.pos;){let t=e.state.doc.lineAt(i),r=Math.min(e.pos,t.to);if(t.length){let i=n?n(t.from):-1,o=new iS(t.text,e.state.tabSize,e.unit,i<0?void 0:i);for(;o.pos<r-t.from;)YS(this.streamParser.token,o,a)}else this.streamParser.blankLine(a,e.unit);if(r==e.pos)break;i=t.to+1}let o=e.lineAt(e.pos);return n&&t==null&&US.set(e.state,o.from),this.streamParser.indent(a,/^\s*(.*)/.exec(o.text)[1],e)}get allowsNesting(){return!1}};function GS(e,t,n,r,i){let a=n>=r&&n+t.length<=i&&t.prop(e.stateAfter);if(a)return{state:e.streamParser.copyState(a),pos:n+t.length};for(let a=t.children.length-1;a>=0;a--){let o=t.children[a],s=n+t.positions[a],c=o instanceof Gb&&s<i&&GS(e,o,s,r,i);if(c)return c}return null}function KS(e,t,n,r,i){if(i&&n<=0&&r>=t.length)return t;!i&&n==0&&t.type==e.topNode&&(i=!0);for(let a=t.children.length-1;a>=0;a--){let o=t.positions[a],s=t.children[a],c;if(o<r&&s instanceof Gb){if(!(c=KS(e,s,n-o,r-o,i)))break;return i?new Gb(t.type,t.children.slice(0,a).concat(c),t.positions.slice(0,a+1),o+c.length):c}}return null}function qS(e,t,n,r,i){for(let i of t){let t=i.from+(i.openStart?25:0),a=i.to-(i.openEnd?25:0),o=t<=n&&a>n&&GS(e,i.tree,0-i.offset,n,a),s;if(o&&o.pos<=r&&(s=KS(e,i.tree,n+i.offset,o.pos+i.offset,!1)))return{state:o.state,tree:s}}return{state:e.streamParser.startState(i?CS(i):4),tree:Gb.empty}}var JS=class{constructor(e,t,n,r){this.lang=e,this.input=t,this.fragments=n,this.ranges=r,this.stoppedAt=null,this.chunks=[],this.chunkPos=[],this.chunk=[],this.chunkReused=void 0,this.rangeIndex=0,this.to=r[r.length-1].to;let i=mS.get(),a=r[0].from,{state:o,tree:s}=qS(e,n,a,this.to,i?.state);this.state=o,this.parsedPos=this.chunkStart=a+s.length;for(let e=0;e<s.children.length;e++)this.chunks.push(s.children[e]),this.chunkPos.push(s.positions[e]);i&&this.parsedPos<i.viewport.from-1e5&&r.some(e=>e.from<=i.viewport.from&&e.to>=i.viewport.from)&&(this.state=this.lang.streamParser.startState(CS(i.state)),i.skipUntilInView(this.parsedPos,i.viewport.from),this.parsedPos=i.viewport.from),this.moveRangeIndex()}advance(){let e=mS.get(),t=this.stoppedAt==null?this.to:Math.min(this.to,this.stoppedAt),n=Math.min(t,this.chunkStart+512);for(e&&(n=Math.min(n,e.viewport.to));this.parsedPos<n;)this.parseLine(e);return this.chunkStart<this.parsedPos&&this.finishChunk(),this.parsedPos>=t?this.finish():e&&this.parsedPos>=e.viewport.to?(e.skipUntilInView(this.parsedPos,t),this.finish()):null}stopAt(e){this.stoppedAt=e}lineAfter(e){let t=this.input.chunk(e);if(this.input.lineChunks)t==`
|
|
22
|
+
`&&(t=``);else{let e=t.indexOf(`
|
|
23
|
+
`);e>-1&&(t=t.slice(0,e))}return e+t.length<=this.to?t:t.slice(0,this.to-e)}nextLine(){let e=this.parsedPos,t=this.lineAfter(e),n=e+t.length;for(let e=this.rangeIndex;;){let r=this.ranges[e].to;if(r>=n||(t=t.slice(0,r-(n-t.length)),e++,e==this.ranges.length))break;let i=this.ranges[e].from,a=this.lineAfter(i);t+=a,n=i+a.length}return{line:t,end:n}}skipGapsTo(e,t,n){for(;;){let r=this.ranges[this.rangeIndex].to,i=e+t;if(n>0?r>i:r>=i)break;let a=this.ranges[++this.rangeIndex].from;t+=a-r}return t}moveRangeIndex(){for(;this.ranges[this.rangeIndex].to<this.parsedPos;)this.rangeIndex++}emitToken(e,t,n,r){let i=4;if(this.ranges.length>1){r=this.skipGapsTo(t,r,1),t+=r;let e=this.chunk.length;r=this.skipGapsTo(n,r,-1),n+=r,i+=this.chunk.length-e}let a=this.chunk.length-4;return this.lang.streamParser.mergeTokens&&i==4&&a>=0&&this.chunk[a]==e&&this.chunk[a+2]==t?this.chunk[a+2]=n:this.chunk.push(e,t,n,i),r}parseLine(e){let{line:t,end:n}=this.nextLine(),r=0,{streamParser:i}=this.lang,a=new iS(t,e?e.state.tabSize:4,e?CS(e.state):2);if(a.eol())i.blankLine(this.state,a.indentUnit);else for(;!a.eol();){let e=YS(i.token,a,this.state);if(e&&(r=this.emitToken(this.lang.tokenTable.resolve(e),this.parsedPos+a.start,this.parsedPos+a.pos,r)),a.start>1e4)break}this.parsedPos=n,this.moveRangeIndex(),this.parsedPos<this.to&&this.parsedPos++}finishChunk(){let e=Gb.build({buffer:this.chunk,start:this.chunkStart,length:this.parsedPos-this.chunkStart,nodeSet:QS,topID:0,maxBufferLength:512,reused:this.chunkReused});e=new Gb(e.type,e.children,e.positions,e.length,[[this.lang.stateAfter,this.lang.streamParser.copyState(this.state)]]),this.chunks.push(e),this.chunkPos.push(this.chunkStart-this.ranges[0].from),this.chunk=[],this.chunkReused=void 0,this.chunkStart=this.parsedPos}finish(){return new Gb(this.lang.topNode,this.chunks,this.chunkPos,this.parsedPos-this.ranges[0].from).balance()}};function YS(e,t,n){t.start=t.pos;for(let r=0;r<10;r++){let r=e(t,n);if(t.pos>t.start)return r}throw Error(`Stream parser failed to advance stream.`)}var XS=Object.create(null),ZS=[Bb.none],QS=new Vb(ZS),$S=[],eC=Object.create(null),tC=Object.create(null);for(let[e,t]of[[`variable`,`variableName`],[`variable-2`,`variableName.special`],[`string-2`,`string.special`],[`def`,`variableName.definition`],[`tag`,`tagName`],[`attribute`,`attributeName`],[`type`,`typeName`],[`builtin`,`variableName.standard`],[`qualifier`,`modifier`],[`error`,`invalid`],[`header`,`heading`],[`property`,`propertyName`]])tC[e]=aC(XS,t);var nC=class{constructor(e){this.extra=e,this.table=Object.assign(Object.create(null),tC)}resolve(e){return e?this.table[e]||(this.table[e]=aC(this.extra,e)):0}},rC=new nC(XS);function iC(e,t){$S.indexOf(e)>-1||($S.push(e),console.warn(t))}function aC(e,t){let n=[];for(let r of t.split(` `)){let t=[];for(let n of r.split(`.`)){let r=e[n]||Y[n];r?typeof r==`function`?t.length?t=t.map(r):iC(n,`Modifier ${n} used at start of tag`):t.length?iC(n,`Tag ${n} used as modifier`):t=Array.isArray(r)?r:[r]:iC(n,`Unknown highlighting tag ${n}`)}for(let e of t)n.push(e)}if(!n.length)return 0;let r=t.replace(/ /g,`_`),i=r+` `+n.map(e=>e.id),a=eC[i];if(a)return a.id;let o=eC[i]=Bb.define({id:ZS.length,name:r,props:[Fx({[r]:n})]});return ZS.push(o),o.id}function oC(e,t){let n=Bb.define({id:ZS.length,name:`Document`,props:[aS.add(()=>e),wS.add(()=>e=>t.getIndent(e))],top:!0});return ZS.push(n),n}ch.RTL,ch.LTR;var sC=`modulepreload`,cC=function(e){return`/`+e},lC={},Z=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e=document.getElementsByTagName(`link`),i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}function s(e){return import.meta.resolve?import.meta.resolve(e):new URL(e,import.meta.url).href}r=o(t.map(t=>{if(t=cC(t,n),t=s(t),t in lC)return;lC[t]=!0;let r=t.endsWith(`.css`);for(let n=e.length-1;n>=0;n--){let i=e[n];if(i.href===t&&(!r||i.rel===`stylesheet`))return}let i=document.createElement(`link`);if(i.rel=r?`stylesheet`:sC,r||(i.as=`script`),i.crossOrigin=``,i.href=t,a&&i.setAttribute(`nonce`,a),document.head.appendChild(i),r)return new Promise((e,n)=>{i.addEventListener(`load`,e),i.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${t}`)))})}).filter(e=>e!==void 0))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})};function Q(e){return new xS(WS.define(e))}function uC(e){return Z(()=>import(`./dist-BlbyXVQV.js`).then(t=>t.sql({dialect:t[e]})),__vite__mapDeps([0,1,2]))}var dC=[X.of({name:`C`,extensions:[`c`,`h`,`ino`],load(){return Z(()=>import(`./dist-5LZ7afvb.js`).then(e=>e.cpp()),__vite__mapDeps([3,1]))}}),X.of({name:`C++`,alias:[`cpp`],extensions:[`cpp`,`c++`,`cc`,`cxx`,`hpp`,`h++`,`hh`,`hxx`],load(){return Z(()=>import(`./dist-5LZ7afvb.js`).then(e=>e.cpp()),__vite__mapDeps([3,1]))}}),X.of({name:`CQL`,alias:[`cassandra`],extensions:[`cql`],load(){return uC(`Cassandra`)}}),X.of({name:`CSS`,extensions:[`css`],load(){return Z(()=>import(`./dist-rNM8br7y.js`).then(e=>e.i).then(e=>e.css()),__vite__mapDeps([4,1]))}}),X.of({name:`Go`,extensions:[`go`],load(){return Z(()=>import(`./dist-EGtMdXiZ.js`).then(e=>e.go()),__vite__mapDeps([5,1,2]))}}),X.of({name:`HTML`,alias:[`xhtml`],extensions:[`html`,`htm`,`handlebars`,`hbs`],load(){return Z(()=>import(`./dist-DBLAKjXY.js`).then(e=>e.html()),__vite__mapDeps([6,1,4,7,2]))}}),X.of({name:`Java`,extensions:[`java`],load(){return Z(()=>import(`./dist-YzcQS4mo.js`).then(e=>e.java()),__vite__mapDeps([8,1]))}}),X.of({name:`JavaScript`,alias:[`ecmascript`,`js`,`node`],extensions:[`js`,`mjs`,`cjs`],load(){return Z(()=>import(`./dist-sMvAEDke.js`).then(e=>e.t).then(e=>e.javascript()),__vite__mapDeps([7,1,2]))}}),X.of({name:`Jinja`,extensions:[`j2`,`jinja`,`jinja2`],load(){return Z(()=>import(`./dist-TGOhFQVf.js`).then(e=>e.jinja()),__vite__mapDeps([9,1,6,4,7,2]))}}),X.of({name:`JSON`,alias:[`json5`],extensions:[`json`,`map`],load(){return Z(()=>import(`./dist-CwlCG8j2.js`).then(e=>e.json()),__vite__mapDeps([10,1]))}}),X.of({name:`JSX`,extensions:[`jsx`],load(){return Z(()=>import(`./dist-sMvAEDke.js`).then(e=>e.t).then(e=>e.javascript({jsx:!0})),__vite__mapDeps([7,1,2]))}}),X.of({name:`LESS`,extensions:[`less`],load(){return Z(()=>import(`./dist-DJUfxZOQ.js`).then(e=>e.less()),__vite__mapDeps([11,1,4]))}}),X.of({name:`Liquid`,extensions:[`liquid`],load(){return Z(()=>import(`./dist-DWHed7FZ.js`).then(e=>e.liquid()),__vite__mapDeps([12,1,6,4,7,2]))}}),X.of({name:`MariaDB SQL`,load(){return uC(`MariaSQL`)}}),X.of({name:`Markdown`,extensions:[`md`,`markdown`,`mkd`],load(){return Z(()=>import(`./dist-CPp5jjR3.js`).then(e=>e.markdown()),__vite__mapDeps([13,2,6,1,4,7]))}}),X.of({name:`MS SQL`,load(){return uC(`MSSQL`)}}),X.of({name:`MySQL`,load(){return uC(`MySQL`)}}),X.of({name:`PHP`,extensions:[`php`,`php3`,`php4`,`php5`,`php7`,`phtml`],load(){return Z(()=>import(`./dist-u8pJbBs1.js`).then(e=>e.php()),__vite__mapDeps([14,1,6,4,7,2]))}}),X.of({name:`PLSQL`,extensions:[`pls`],load(){return uC(`PLSQL`)}}),X.of({name:`PostgreSQL`,load(){return uC(`PostgreSQL`)}}),X.of({name:`Python`,extensions:[`BUILD`,`bzl`,`py`,`pyw`],filename:/^(BUCK|BUILD)$/,load(){return Z(()=>import(`./dist-DUzqZzap.js`).then(e=>e.python()),__vite__mapDeps([15,1,2]))}}),X.of({name:`Rust`,extensions:[`rs`],load(){return Z(()=>import(`./dist-4cHWhShk.js`).then(e=>e.rust()),__vite__mapDeps([16,1]))}}),X.of({name:`Sass`,extensions:[`sass`],load(){return Z(()=>import(`./dist-vddRFtpy.js`).then(e=>e.sass({indented:!0})),__vite__mapDeps([17,1,4]))}}),X.of({name:`SCSS`,extensions:[`scss`],load(){return Z(()=>import(`./dist-vddRFtpy.js`).then(e=>e.sass()),__vite__mapDeps([17,1,4]))}}),X.of({name:`SQL`,extensions:[`sql`],load(){return uC(`StandardSQL`)}}),X.of({name:`SQLite`,load(){return uC(`SQLite`)}}),X.of({name:`TSX`,extensions:[`tsx`],load(){return Z(()=>import(`./dist-sMvAEDke.js`).then(e=>e.t).then(e=>e.javascript({jsx:!0,typescript:!0})),__vite__mapDeps([7,1,2]))}}),X.of({name:`TypeScript`,alias:[`ts`],extensions:[`ts`,`mts`,`cts`],load(){return Z(()=>import(`./dist-sMvAEDke.js`).then(e=>e.t).then(e=>e.javascript({typescript:!0})),__vite__mapDeps([7,1,2]))}}),X.of({name:`WebAssembly`,extensions:[`wat`,`wast`],load(){return Z(()=>import(`./dist-V7iSuHc2.js`).then(e=>e.wast()),__vite__mapDeps([18,1]))}}),X.of({name:`XML`,alias:[`rss`,`wsdl`,`xsd`],extensions:[`xml`,`xsl`,`xsd`,`svg`],load(){return Z(()=>import(`./dist-C2jvlqwf.js`).then(e=>e.xml()),__vite__mapDeps([19,1]))}}),X.of({name:`YAML`,alias:[`yml`],extensions:[`yaml`,`yml`],load(){return Z(()=>import(`./dist-DwkmBsGa.js`).then(e=>e.yaml()),__vite__mapDeps([20,1]))}}),X.of({name:`APL`,extensions:[`dyalog`,`apl`],load(){return Z(()=>import(`./apl-gfMMiTNf.js`).then(e=>Q(e.apl)),[])}}),X.of({name:`PGP`,alias:[`asciiarmor`],extensions:[`asc`,`pgp`,`sig`],load(){return Z(()=>import(`./asciiarmor-C_eisQCp.js`).then(e=>Q(e.asciiArmor)),[])}}),X.of({name:`ASN.1`,extensions:[`asn`,`asn1`],load(){return Z(()=>import(`./asn1-DCl_8MCW.js`).then(e=>Q(e.asn1({}))),[])}}),X.of({name:`Asterisk`,filename:/^extensions\.conf$/i,load(){return Z(()=>import(`./asterisk-BEn0Cwpx.js`).then(e=>Q(e.asterisk)),[])}}),X.of({name:`Brainfuck`,extensions:[`b`,`bf`],load(){return Z(()=>import(`./brainfuck-D5EjA2JK.js`).then(e=>Q(e.brainfuck)),[])}}),X.of({name:`Cobol`,extensions:[`cob`,`cpy`],load(){return Z(()=>import(`./cobol-DHLQUbN7.js`).then(e=>Q(e.cobol)),[])}}),X.of({name:`C#`,alias:[`csharp`,`cs`],extensions:[`cs`],load(){return Z(()=>import(`./clike-D_6L3tnO.js`).then(e=>Q(e.csharp)),[])}}),X.of({name:`Clojure`,extensions:[`clj`,`cljc`,`cljx`],load(){return Z(()=>import(`./clojure-BflJGmDX.js`).then(e=>Q(e.clojure)),[])}}),X.of({name:`ClojureScript`,extensions:[`cljs`],load(){return Z(()=>import(`./clojure-BflJGmDX.js`).then(e=>Q(e.clojure)),[])}}),X.of({name:`Closure Stylesheets (GSS)`,extensions:[`gss`],load(){return Z(()=>import(`./css-CnaYoQib.js`).then(e=>Q(e.gss)),[])}}),X.of({name:`CMake`,extensions:[`cmake`,`cmake.in`],filename:/^CMakeLists\.txt$/,load(){return Z(()=>import(`./cmake-84nbDH0I.js`).then(e=>Q(e.cmake)),[])}}),X.of({name:`CoffeeScript`,alias:[`coffee`,`coffee-script`],extensions:[`coffee`],load(){return Z(()=>import(`./coffeescript-De_zI4J0.js`).then(e=>Q(e.coffeeScript)),[])}}),X.of({name:`Common Lisp`,alias:[`lisp`],extensions:[`cl`,`lisp`,`el`],load(){return Z(()=>import(`./commonlisp-DgAKBe0r.js`).then(e=>Q(e.commonLisp)),[])}}),X.of({name:`Cypher`,extensions:[`cyp`,`cypher`],load(){return Z(()=>import(`./cypher-p9eYesGn.js`).then(e=>Q(e.cypher)),[])}}),X.of({name:`Cython`,extensions:[`pyx`,`pxd`,`pxi`],load(){return Z(()=>import(`./python-B_1Jd8HM.js`).then(e=>Q(e.cython)),[])}}),X.of({name:`Crystal`,extensions:[`cr`],load(){return Z(()=>import(`./crystal-Bsdphhtm.js`).then(e=>Q(e.crystal)),[])}}),X.of({name:`D`,extensions:[`d`],load(){return Z(()=>import(`./d-DWkQyNnU.js`).then(e=>Q(e.d)),[])}}),X.of({name:`Dart`,extensions:[`dart`],load(){return Z(()=>import(`./clike-D_6L3tnO.js`).then(e=>Q(e.dart)),[])}}),X.of({name:`diff`,extensions:[`diff`,`patch`],load(){return Z(()=>import(`./diff-ChtP43wD.js`).then(e=>Q(e.diff)),[])}}),X.of({name:`Dockerfile`,filename:/^Dockerfile$/,load(){return Z(()=>import(`./dockerfile-DJkHQgkl.js`).then(e=>Q(e.dockerFile)),__vite__mapDeps([21,22]))}}),X.of({name:`DTD`,extensions:[`dtd`],load(){return Z(()=>import(`./dtd-DTF72YNO.js`).then(e=>Q(e.dtd)),[])}}),X.of({name:`Dylan`,extensions:[`dylan`,`dyl`,`intr`],load(){return Z(()=>import(`./dylan-BCDoL_-p.js`).then(e=>Q(e.dylan)),[])}}),X.of({name:`EBNF`,load(){return Z(()=>import(`./ebnf-D4c0_ac3.js`).then(e=>Q(e.ebnf)),[])}}),X.of({name:`ECL`,extensions:[`ecl`],load(){return Z(()=>import(`./ecl-BVIeWmwY.js`).then(e=>Q(e.ecl)),[])}}),X.of({name:`edn`,extensions:[`edn`],load(){return Z(()=>import(`./clojure-BflJGmDX.js`).then(e=>Q(e.clojure)),[])}}),X.of({name:`Eiffel`,extensions:[`e`],load(){return Z(()=>import(`./eiffel-BEjRio4Q.js`).then(e=>Q(e.eiffel)),[])}}),X.of({name:`Elm`,extensions:[`elm`],load(){return Z(()=>import(`./elm-Cshzl8qu.js`).then(e=>Q(e.elm)),[])}}),X.of({name:`Erlang`,extensions:[`erl`],load(){return Z(()=>import(`./erlang-BV0c4Hdn.js`).then(e=>Q(e.erlang)),[])}}),X.of({name:`Esper`,load(){return Z(()=>import(`./sql-DuQMFDvy.js`).then(e=>Q(e.esper)),[])}}),X.of({name:`Factor`,extensions:[`factor`],load(){return Z(()=>import(`./factor-LKH5gN8L.js`).then(e=>Q(e.factor)),__vite__mapDeps([23,22]))}}),X.of({name:`FCL`,load(){return Z(()=>import(`./fcl-ClOhbFR7.js`).then(e=>Q(e.fcl)),[])}}),X.of({name:`Forth`,extensions:[`forth`,`fth`,`4th`],load(){return Z(()=>import(`./forth-D6RzAl64.js`).then(e=>Q(e.forth)),[])}}),X.of({name:`Fortran`,extensions:[`f`,`for`,`f77`,`f90`,`f95`],load(){return Z(()=>import(`./fortran-Bt6PBEDR.js`).then(e=>Q(e.fortran)),[])}}),X.of({name:`F#`,alias:[`fsharp`],extensions:[`fs`],load(){return Z(()=>import(`./mllike-B45xgp2S.js`).then(e=>Q(e.fSharp)),[])}}),X.of({name:`Gas`,extensions:[`s`],load(){return Z(()=>import(`./gas-BHEdbvp9.js`).then(e=>Q(e.gas)),[])}}),X.of({name:`Gherkin`,extensions:[`feature`],load(){return Z(()=>import(`./gherkin-oBAE_ms0.js`).then(e=>Q(e.gherkin)),[])}}),X.of({name:`Groovy`,extensions:[`groovy`,`gradle`],filename:/^Jenkinsfile$/,load(){return Z(()=>import(`./groovy-CUpZ7dEl.js`).then(e=>Q(e.groovy)),[])}}),X.of({name:`Haskell`,extensions:[`hs`],load(){return Z(()=>import(`./haskell-BRsoo5mP.js`).then(e=>Q(e.haskell)),[])}}),X.of({name:`Haxe`,extensions:[`hx`],load(){return Z(()=>import(`./haxe-DjVOVvNP.js`).then(e=>Q(e.haxe)),[])}}),X.of({name:`HXML`,extensions:[`hxml`],load(){return Z(()=>import(`./haxe-DjVOVvNP.js`).then(e=>Q(e.hxml)),[])}}),X.of({name:`HTTP`,load(){return Z(()=>import(`./http-CLVgA2GD.js`).then(e=>Q(e.http)),[])}}),X.of({name:`IDL`,extensions:[`pro`],load(){return Z(()=>import(`./idl-BUZw3wgd.js`).then(e=>Q(e.idl)),[])}}),X.of({name:`JSON-LD`,alias:[`jsonld`],extensions:[`jsonld`],load(){return Z(()=>import(`./javascript-Bu8mWwtz.js`).then(e=>Q(e.jsonld)),[])}}),X.of({name:`Julia`,extensions:[`jl`],load(){return Z(()=>import(`./julia-CQfgDRfP.js`).then(e=>Q(e.julia)),[])}}),X.of({name:`Kotlin`,extensions:[`kt`,`kts`],load(){return Z(()=>import(`./clike-D_6L3tnO.js`).then(e=>Q(e.kotlin)),[])}}),X.of({name:`LiveScript`,alias:[`ls`],extensions:[`ls`],load(){return Z(()=>import(`./livescript-BXxG0Yva.js`).then(e=>Q(e.liveScript)),[])}}),X.of({name:`Lua`,extensions:[`lua`],load(){return Z(()=>import(`./lua-DPCEkfD_.js`).then(e=>Q(e.lua)),[])}}),X.of({name:`mIRC`,extensions:[`mrc`],load(){return Z(()=>import(`./mirc-C9zpzAZU.js`).then(e=>Q(e.mirc)),[])}}),X.of({name:`Mathematica`,extensions:[`m`,`nb`,`wl`,`wls`],load(){return Z(()=>import(`./mathematica-u8YMmbU0.js`).then(e=>Q(e.mathematica)),[])}}),X.of({name:`Modelica`,extensions:[`mo`],load(){return Z(()=>import(`./modelica-CqHI_q-D.js`).then(e=>Q(e.modelica)),[])}}),X.of({name:`MUMPS`,extensions:[`mps`],load(){return Z(()=>import(`./mumps-BSzj6Xyz.js`).then(e=>Q(e.mumps)),[])}}),X.of({name:`Mbox`,extensions:[`mbox`],load(){return Z(()=>import(`./mbox-BEMVcqjs.js`).then(e=>Q(e.mbox)),[])}}),X.of({name:`Nginx`,filename:/nginx.*\.conf$/i,load(){return Z(()=>import(`./nginx-8H7HVH4w.js`).then(e=>Q(e.nginx)),[])}}),X.of({name:`NSIS`,extensions:[`nsh`,`nsi`],load(){return Z(()=>import(`./nsis-viPvXFiq.js`).then(e=>Q(e.nsis)),__vite__mapDeps([24,22]))}}),X.of({name:`NTriples`,extensions:[`nt`,`nq`],load(){return Z(()=>import(`./ntriples-B9h1VB_g.js`).then(e=>Q(e.ntriples)),[])}}),X.of({name:`Objective-C`,alias:[`objective-c`,`objc`],extensions:[`m`],load(){return Z(()=>import(`./clike-D_6L3tnO.js`).then(e=>Q(e.objectiveC)),[])}}),X.of({name:`Objective-C++`,alias:[`objective-c++`,`objc++`],extensions:[`mm`],load(){return Z(()=>import(`./clike-D_6L3tnO.js`).then(e=>Q(e.objectiveCpp)),[])}}),X.of({name:`OCaml`,extensions:[`ml`,`mli`,`mll`,`mly`],load(){return Z(()=>import(`./mllike-B45xgp2S.js`).then(e=>Q(e.oCaml)),[])}}),X.of({name:`Octave`,extensions:[`m`],load(){return Z(()=>import(`./octave-D2Q8cUp1.js`).then(e=>Q(e.octave)),[])}}),X.of({name:`Oz`,extensions:[`oz`],load(){return Z(()=>import(`./oz-BwTct_5T.js`).then(e=>Q(e.oz)),[])}}),X.of({name:`Pascal`,extensions:[`p`,`pas`],load(){return Z(()=>import(`./pascal-Dp_KdFgX.js`).then(e=>Q(e.pascal)),[])}}),X.of({name:`Perl`,extensions:[`pl`,`pm`],load(){return Z(()=>import(`./perl-BkSkiI9m.js`).then(e=>Q(e.perl)),[])}}),X.of({name:`Pig`,extensions:[`pig`],load(){return Z(()=>import(`./pig-AF4Hwhju.js`).then(e=>Q(e.pig)),[])}}),X.of({name:`PowerShell`,extensions:[`ps1`,`psd1`,`psm1`],load(){return Z(()=>import(`./powershell-BcIto6Sf.js`).then(e=>Q(e.powerShell)),[])}}),X.of({name:`Properties files`,alias:[`ini`,`properties`],extensions:[`properties`,`ini`,`in`],load(){return Z(()=>import(`./properties-C357ku5U.js`).then(e=>Q(e.properties)),[])}}),X.of({name:`ProtoBuf`,extensions:[`proto`],load(){return Z(()=>import(`./protobuf-D1ij_kNL.js`).then(e=>Q(e.protobuf)),[])}}),X.of({name:`Pug`,alias:[`jade`],extensions:[`pug`,`jade`],load(){return Z(()=>import(`./pug-3K-JMW4g.js`).then(e=>Q(e.pug)),__vite__mapDeps([25,26]))}}),X.of({name:`Puppet`,extensions:[`pp`],load(){return Z(()=>import(`./puppet-BZyAS7I4.js`).then(e=>Q(e.puppet)),[])}}),X.of({name:`Q`,extensions:[`q`],load(){return Z(()=>import(`./q-B9NhS7L_.js`).then(e=>Q(e.q)),[])}}),X.of({name:`R`,alias:[`rscript`],extensions:[`r`,`R`],load(){return Z(()=>import(`./r-CxDmU1I4.js`).then(e=>Q(e.r)),[])}}),X.of({name:`RPM Changes`,load(){return Z(()=>import(`./rpm-gpDK5sbt.js`).then(e=>Q(e.rpmChanges)),[])}}),X.of({name:`RPM Spec`,extensions:[`spec`],load(){return Z(()=>import(`./rpm-gpDK5sbt.js`).then(e=>Q(e.rpmSpec)),[])}}),X.of({name:`Ruby`,alias:[`jruby`,`macruby`,`rake`,`rb`,`rbx`],extensions:[`rb`],filename:/^(Gemfile|Rakefile)$/,load(){return Z(()=>import(`./ruby-ChfNwlCY.js`).then(e=>Q(e.ruby)),[])}}),X.of({name:`SAS`,extensions:[`sas`],load(){return Z(()=>import(`./sas-C2OyD2Y6.js`).then(e=>Q(e.sas)),[])}}),X.of({name:`Scala`,extensions:[`scala`],load(){return Z(()=>import(`./clike-D_6L3tnO.js`).then(e=>Q(e.scala)),[])}}),X.of({name:`Scheme`,extensions:[`scm`,`ss`],load(){return Z(()=>import(`./scheme-D9qYN0V5.js`).then(e=>Q(e.scheme)),[])}}),X.of({name:`Shell`,alias:[`bash`,`sh`,`zsh`],extensions:[`sh`,`ksh`,`bash`],filename:/^PKGBUILD$/,load(){return Z(()=>import(`./shell-DwuoZtxw.js`).then(e=>Q(e.shell)),[])}}),X.of({name:`Sieve`,extensions:[`siv`,`sieve`],load(){return Z(()=>import(`./sieve-tLWDfEkZ.js`).then(e=>Q(e.sieve)),[])}}),X.of({name:`Smalltalk`,extensions:[`st`],load(){return Z(()=>import(`./smalltalk-BLp5-jwC.js`).then(e=>Q(e.smalltalk)),[])}}),X.of({name:`Solr`,load(){return Z(()=>import(`./solr-B78wSQJQ.js`).then(e=>Q(e.solr)),[])}}),X.of({name:`SML`,extensions:[`sml`,`sig`,`fun`,`smackspec`],load(){return Z(()=>import(`./mllike-B45xgp2S.js`).then(e=>Q(e.sml)),[])}}),X.of({name:`SPARQL`,alias:[`sparul`],extensions:[`rq`,`sparql`],load(){return Z(()=>import(`./sparql-Dz-mlCAC.js`).then(e=>Q(e.sparql)),[])}}),X.of({name:`Spreadsheet`,alias:[`excel`,`formula`],load(){return Z(()=>import(`./spreadsheet-CTIncYxj.js`).then(e=>Q(e.spreadsheet)),[])}}),X.of({name:`Squirrel`,extensions:[`nut`],load(){return Z(()=>import(`./clike-D_6L3tnO.js`).then(e=>Q(e.squirrel)),[])}}),X.of({name:`Stylus`,extensions:[`styl`],load(){return Z(()=>import(`./stylus-BOVgKnng.js`).then(e=>Q(e.stylus)),[])}}),X.of({name:`Swift`,extensions:[`swift`],load(){return Z(()=>import(`./swift-DKB6_1j6.js`).then(e=>Q(e.swift)),[])}}),X.of({name:`sTeX`,load(){return Z(()=>import(`./stex-DNzd62Q_.js`).then(e=>Q(e.stex)),[])}}),X.of({name:`LaTeX`,alias:[`tex`],extensions:[`text`,`ltx`,`tex`],load(){return Z(()=>import(`./stex-DNzd62Q_.js`).then(e=>Q(e.stex)),[])}}),X.of({name:`SystemVerilog`,extensions:[`v`,`sv`,`svh`],load(){return Z(()=>import(`./verilog-CjI9Y6RI.js`).then(e=>Q(e.verilog)),[])}}),X.of({name:`Tcl`,extensions:[`tcl`],load(){return Z(()=>import(`./tcl-BGfruO1u.js`).then(e=>Q(e.tcl)),[])}}),X.of({name:`Textile`,extensions:[`textile`],load(){return Z(()=>import(`./textile-C4jVoHG1.js`).then(e=>Q(e.textile)),[])}}),X.of({name:`TiddlyWiki`,load(){return Z(()=>import(`./tiddlywiki-VlUiK86J.js`).then(e=>Q(e.tiddlyWiki)),[])}}),X.of({name:`Tiki wiki`,load(){return Z(()=>import(`./tiki-AK6FwT8q.js`).then(e=>Q(e.tiki)),[])}}),X.of({name:`TOML`,extensions:[`toml`],load(){return Z(()=>import(`./toml-BPTmHmyx.js`).then(e=>Q(e.toml)),[])}}),X.of({name:`Troff`,extensions:[`1`,`2`,`3`,`4`,`5`,`6`,`7`,`8`,`9`],load(){return Z(()=>import(`./troff-C2dAgh7P.js`).then(e=>Q(e.troff)),[])}}),X.of({name:`TTCN`,extensions:[`ttcn`,`ttcn3`,`ttcnpp`],load(){return Z(()=>import(`./ttcn-PPSTk1ow.js`).then(e=>Q(e.ttcn)),[])}}),X.of({name:`TTCN_CFG`,extensions:[`cfg`],load(){return Z(()=>import(`./ttcn-cfg-2b4Gb5sE.js`).then(e=>Q(e.ttcnCfg)),[])}}),X.of({name:`Turtle`,extensions:[`ttl`],load(){return Z(()=>import(`./turtle-Cx3rYX2g.js`).then(e=>Q(e.turtle)),[])}}),X.of({name:`Web IDL`,extensions:[`webidl`],load(){return Z(()=>import(`./webidl-D5jiJvOU.js`).then(e=>Q(e.webIDL)),[])}}),X.of({name:`VB.NET`,extensions:[`vb`],load(){return Z(()=>import(`./vb-BthdM_4N.js`).then(e=>Q(e.vb)),[])}}),X.of({name:`VBScript`,extensions:[`vbs`],load(){return Z(()=>import(`./vbscript-D9f6rSsU.js`).then(e=>Q(e.vbScript)),[])}}),X.of({name:`Velocity`,extensions:[`vtl`],load(){return Z(()=>import(`./velocity-CqftRsjg.js`).then(e=>Q(e.velocity)),[])}}),X.of({name:`Verilog`,extensions:[`v`],load(){return Z(()=>import(`./verilog-CjI9Y6RI.js`).then(e=>Q(e.verilog)),[])}}),X.of({name:`VHDL`,extensions:[`vhd`,`vhdl`],load(){return Z(()=>import(`./vhdl-kS471soi.js`).then(e=>Q(e.vhdl)),[])}}),X.of({name:`XQuery`,extensions:[`xy`,`xquery`,`xq`,`xqm`,`xqy`],load(){return Z(()=>import(`./xquery-BKJx4mf9.js`).then(e=>Q(e.xQuery)),[])}}),X.of({name:`Yacas`,extensions:[`ys`],load(){return Z(()=>import(`./yacas-CXXgtw0p.js`).then(e=>Q(e.yacas)),[])}}),X.of({name:`Z80`,extensions:[`z80`],load(){return Z(()=>import(`./z80-Co3PbHdE.js`).then(e=>Q(e.z80)),[])}}),X.of({name:`MscGen`,extensions:[`mscgen`,`mscin`,`msc`],load(){return Z(()=>import(`./mscgen-qgSLujhx.js`).then(e=>Q(e.mscgen)),[])}}),X.of({name:`Xù`,extensions:[`xu`],load(){return Z(()=>import(`./mscgen-qgSLujhx.js`).then(e=>Q(e.xu)),[])}}),X.of({name:`MsGenny`,extensions:[`msgenny`],load(){return Z(()=>import(`./mscgen-qgSLujhx.js`).then(e=>Q(e.msgenny)),[])}}),X.of({name:`Vue`,extensions:[`vue`],load(){return Z(()=>import(`./dist-DlQ5cyyx.js`).then(e=>e.vue()),__vite__mapDeps([27,1,7,2,6,4]))}}),X.of({name:`Angular Template`,load(){return Z(()=>import(`./dist-BQv6Yu0n.js`).then(e=>e.angular()),__vite__mapDeps([28,1,7,2,6,4]))}})],fC=typeof String.prototype.normalize==`function`?e=>e.normalize(`NFKD`):e=>e,pC=class{constructor(e,t,n=0,r=e.length,i,a){this.test=a,this.value={from:0,to:0,precise:!1},this.done=!1,this.matches=[],this.buffer=``,this.bufferPos=0,this.iter=e.iterRange(n,r),this.bufferStart=n,this.normalize=i?e=>i(fC(e)):fC,this.query=this.normalize(t)}peek(){if(this.bufferPos==this.buffer.length){if(this.bufferStart+=this.buffer.length,this.iter.next(),this.iter.done)return-1;this.bufferPos=0,this.buffer=this.iter.value}return gf(this.buffer,this.bufferPos)}next(){for(;this.matches.length;)this.matches.pop();return this.nextOverlapping()}nextOverlapping(){for(;;){let e=this.peek();if(e<0)return this.done=!0,this;let t=_f(e),n=this.bufferStart+this.bufferPos;this.bufferPos+=vf(e);let r=this.normalize(t);if(r.length)for(let e=0,i=n,a=!0;;e++){let n=r.charCodeAt(e),o=this.match(n,i,a,this.bufferPos+this.bufferStart,e==r.length-1);if(o)return this.value=o,this;if(e==r.length-1)break;a&&e<t.length&&t.charCodeAt(e)==n?i++:a=!1}}}match(e,t,n,r,i){let a=null;for(let t=0;t<this.matches.length;){let n=this.matches[t],o=!1;this.query.charCodeAt(n.index)==e&&(n.index==this.query.length-1?a={from:n.from,to:r,precise:i&&n.precise}:(n.index++,o=!0)),o?t++:this.matches.splice(t,1)}return this.query.charCodeAt(0)==e&&(this.query.length==1?a={from:t,to:r,precise:n&&i}:this.matches.push({from:t,index:1,precise:n})),a&&this.test&&!this.test(a.from,a.to,this.buffer,this.bufferStart)&&(a=null),a}};typeof Symbol<`u`&&(pC.prototype[Symbol.iterator]=function(){return this});var mC={from:-1,to:-1,match:/.*/.exec(``),precise:!0},hC=`gm`+(/x/.unicode==null?``:`u`),gC=class{constructor(e,t,n,r=0,i=e.length){if(this.text=e,this.to=i,this.curLine=``,this.done=!1,this.value=mC,/\\[sWDnr]|\n|\r|\[\^/.test(t))return new yC(e,t,n,r,i);this.re=new RegExp(t,hC+(n?.ignoreCase?`i`:``)),this.test=n?.test,this.iter=e.iter();let a=e.lineAt(r);this.curLineStart=a.from,this.matchPos=xC(e,r),this.getLine(this.curLineStart)}getLine(e){this.iter.next(e),this.iter.lineBreak?this.curLine=``:(this.curLine=this.iter.value,this.curLineStart+this.curLine.length>this.to&&(this.curLine=this.curLine.slice(0,this.to-this.curLineStart)),this.iter.next())}nextLine(){this.curLineStart=this.curLineStart+this.curLine.length+1,this.curLineStart>this.to?this.curLine=``:this.getLine(0)}next(){for(let e=this.matchPos-this.curLineStart;;){this.re.lastIndex=e;let t=this.matchPos<=this.to&&this.re.exec(this.curLine);if(t){let n=this.curLineStart+t.index,r=n+t[0].length;if(this.matchPos=xC(this.text,r+ +(n==r)),n==this.curLineStart+this.curLine.length&&this.nextLine(),(n<r||n>this.value.to)&&(!this.test||this.test(n,r,t)))return this.value={from:n,to:r,precise:!0,match:t},this;e=this.matchPos-this.curLineStart}else if(this.curLineStart+this.curLine.length<this.to)this.nextLine(),e=0;else return this.done=!0,this}}},_C=new WeakMap,vC=class e{constructor(e,t){this.from=e,this.text=t}get to(){return this.from+this.text.length}static get(t,n,r){let i=_C.get(t);if(!i||i.from>=r||i.to<=n){let i=new e(n,t.sliceString(n,r));return _C.set(t,i),i}if(i.from==n&&i.to==r)return i;let{text:a,from:o}=i;return o>n&&(a=t.sliceString(n,o)+a,o=n),i.to<r&&(a+=t.sliceString(i.to,r)),_C.set(t,new e(o,a)),new e(n,a.slice(n-o,r-o))}},yC=class{constructor(e,t,n,r,i){this.text=e,this.to=i,this.done=!1,this.value=mC,this.matchPos=xC(e,r),this.re=new RegExp(t,hC+(n?.ignoreCase?`i`:``)),this.test=n?.test,this.flat=vC.get(e,r,this.chunkEnd(r+5e3))}chunkEnd(e){return e>=this.to?this.to:this.text.lineAt(e).to}next(){for(;;){let e=this.re.lastIndex=this.matchPos-this.flat.from,t=this.re.exec(this.flat.text);if(t&&!t[0]&&t.index==e&&(this.re.lastIndex=e+1,t=this.re.exec(this.flat.text)),t){let e=this.flat.from+t.index,n=e+t[0].length;if((this.flat.to>=this.to||t.index+t[0].length<=this.flat.text.length-10)&&(!this.test||this.test(e,n,t)))return this.value={from:e,to:n,precise:!0,match:t},this.matchPos=xC(this.text,n+ +(e==n)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=vC.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+this.flat.text.length*2))}}};typeof Symbol<`u`&&(gC.prototype[Symbol.iterator]=yC.prototype[Symbol.iterator]=function(){return this});function bC(e){try{return new RegExp(e,hC),!0}catch{return!1}}function xC(e,t){if(t>=e.length)return t;let n=e.lineAt(t),r;for(;t<n.to&&(r=n.text.charCodeAt(t-n.from))>=56320&&r<57344;)t++;return t}var SC=e=>{let t=cb(e,`cm-goto-line`);if(t){let e=t.dom.querySelector(`input[type=text]`);return e&&e.select(),!0}let{state:n}=e,r=String(n.doc.lineAt(e.state.selection.main.head).number),{close:i,result:a}=sb(e,{class:`cm-goto-line`,label:n.phrase(`Go to line`),input:{type:`text`,name:`line`,value:r},focus:!0,submitLabel:n.phrase(`go`)});return a.then(t=>{let r=t&&/^([+-])?(\d+)?(:\d+)?(%)?$/.exec(t.elements.line.value);if(!r){e.dispatch({effects:i});return}let a=n.doc.lineAt(n.selection.main.head),[,o,s,c,l]=r,u=c?+c.slice(1):0,d=s?+s:a.number;if(s&&l){let e=d/100;o&&(e=e*(o==`-`?-1:1)+a.number/n.doc.lines),d=Math.round(n.doc.lines*e)}else s&&o&&(d=d*(o==`-`?-1:1)+a.number);let f=n.doc.line(Math.max(1,Math.min(n.doc.lines,d))),p=W.cursor(f.from+Math.max(0,Math.min(u,f.length)));e.dispatch({effects:[i,q.scrollIntoView(p.from,{y:`center`})],selection:p})}),!0},CC={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},wC=G.define({combine(e){return xp(e,CC,{highlightWordAroundCursor:(e,t)=>e||t,minSelectionLength:Math.min,maxMatches:Math.min})}});function TC(e){let t=[jC,AC];return e&&t.push(wC.of(e)),t}var EC=wm.mark({class:`cm-selectionMatch`}),DC=wm.mark({class:`cm-selectionMatch cm-selectionMatch-main`});function OC(e,t,n,r){return(n==0||e(t.sliceDoc(n-1,n))!=hp.Word)&&(r==t.doc.length||e(t.sliceDoc(r,r+1))!=hp.Word)}function kC(e,t,n,r){return e(t.sliceDoc(n,n+1))==hp.Word&&e(t.sliceDoc(r-1,r))==hp.Word}var AC=Xh.fromClass(class{constructor(e){this.decorations=this.getDeco(e)}update(e){(e.selectionSet||e.docChanged||e.viewportChanged)&&(this.decorations=this.getDeco(e.view))}getDeco(e){let t=e.state.facet(wC),{state:n}=e,r=n.selection;if(r.ranges.length>1)return wm.none;let i=r.main,a,o=null;if(i.empty){if(!t.highlightWordAroundCursor)return wm.none;let e=n.wordAt(i.head);if(!e)return wm.none;o=n.charCategorizer(i.head),a=n.sliceDoc(e.from,e.to)}else{let e=i.to-i.from;if(e<t.minSelectionLength||e>200)return wm.none;if(t.wholeWords){if(a=n.sliceDoc(i.from,i.to),o=n.charCategorizer(i.head),!(OC(o,n,i.from,i.to)&&kC(o,n,i.from,i.to)))return wm.none}else if(a=n.sliceDoc(i.from,i.to),!a)return wm.none}let s=[];for(let r of e.visibleRanges){let e=new pC(n.doc,a,r.from,r.to);for(;!e.next().done;){let{from:r,to:a}=e.value;if((!o||OC(o,n,r,a))&&(i.empty&&r<=i.from&&a>=i.to?s.push(DC.range(r,a)):(r>=i.to||a<=i.from)&&s.push(EC.range(r,a)),s.length>t.maxMatches))return wm.none}}return wm.set(s)}},{decorations:e=>e.decorations}),jC=q.baseTheme({".cm-selectionMatch":{backgroundColor:`#99ff7780`},".cm-searchMatch .cm-selectionMatch":{backgroundColor:`transparent`}}),MC=({state:e,dispatch:t})=>{let{selection:n}=e,r=W.create(n.ranges.map(t=>e.wordAt(t.head)||W.cursor(t.head)),n.mainIndex);return!r.eq(n)&&(t(e.update({selection:r})),!0)};function NC(e,t){let{main:n,ranges:r}=e.selection,i=e.wordAt(n.head),a=i&&i.from==n.from&&i.to==n.to;for(let n=!1,i=new pC(e.doc,t,r[r.length-1].to);;)if(i.next(),i.done){if(n)return null;i=new pC(e.doc,t,0,Math.max(0,r[r.length-1].from-1)),n=!0}else{if(n&&r.some(e=>e.from==i.value.from))continue;if(a){let t=e.wordAt(i.value.from);if(!t||t.from!=i.value.from||t.to!=i.value.to)continue}return i.value}}var PC=({state:e,dispatch:t})=>{let{ranges:n}=e.selection;if(n.some(e=>e.from===e.to))return MC({state:e,dispatch:t});let r=e.sliceDoc(n[0].from,n[0].to);if(e.selection.ranges.some(t=>e.sliceDoc(t.from,t.to)!=r))return!1;let i=NC(e,r);return i?(t(e.update({selection:e.selection.addRange(W.range(i.from,i.to),!1),effects:q.scrollIntoView(i.to)})),!0):!1},FC=G.define({combine(e){return xp(e,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:e=>new _w(e),scrollToMatch:e=>q.scrollIntoView(e)})}});function IC(e){return e?[FC.of(e),Cw]:Cw}var LC=class{constructor(e){this.search=e.search,this.caseSensitive=!!e.caseSensitive,this.literal=!!e.literal,this.regexp=!!e.regexp,this.replace=e.replace||``,this.valid=!!this.search&&(!this.regexp||bC(this.search)),this.unquoted=this.unquote(this.search),this.wholeWord=!!e.wholeWord,this.test=e.test}unquote(e){return this.literal?e:e.replace(/\\([nrt\\])/g,(e,t)=>t==`n`?`
|
|
24
|
+
`:t==`r`?`\r`:t==`t`?` `:`\\`)}eq(e){return this.search==e.search&&this.replace==e.replace&&this.caseSensitive==e.caseSensitive&&this.regexp==e.regexp&&this.wholeWord==e.wholeWord&&this.test==e.test}create(){return this.regexp?new JC(this):new HC(this)}getCursor(e,t=0,n){let r=e.doc?e:bp.create({doc:e});return n??=r.doc.length,this.regexp?WC(this,r,t,n):BC(this,r,t,n)}},RC=class{constructor(e){this.spec=e}};function zC(e,t,n){return(r,i,a,o)=>n&&!n(r,i,a,o)?!1:e(r>=o&&i<=o+a.length?a.slice(r-o,i-o):t.doc.sliceString(r,i),t,r,i)}function BC(e,t,n,r){let i;return e.wholeWord&&(i=VC(t.doc,t.charCategorizer(t.selection.main.head))),e.test&&(i=zC(e.test,t,i)),new pC(t.doc,e.unquoted,n,r,e.caseSensitive?void 0:e=>e.toLowerCase(),i)}function VC(e,t){return(n,r,i,a)=>((a>n||a+i.length<r)&&(a=Math.max(0,n-2),i=e.sliceString(a,Math.min(e.length,r+2))),(t(GC(i,n-a))!=hp.Word||t(KC(i,n-a))!=hp.Word)&&(t(KC(i,r-a))!=hp.Word||t(GC(i,r-a))!=hp.Word))}var HC=class extends RC{constructor(e){super(e)}nextMatch(e,t,n){let r=BC(this.spec,e,n,e.doc.length).nextOverlapping();if(r.done){let n=Math.min(e.doc.length,t+this.spec.unquoted.length);r=BC(this.spec,e,0,n).nextOverlapping()}return r.done||r.value.from==t&&r.value.to==n?null:r.value}prevMatchInRange(e,t,n){for(let r=n;;){let n=Math.max(t,r-1e4-this.spec.unquoted.length),i=BC(this.spec,e,n,r),a=null;for(;!i.nextOverlapping().done;)a=i.value;if(a)return a;if(n==t)return null;r-=1e4}}prevMatch(e,t,n){let r=this.prevMatchInRange(e,0,t);return r||=this.prevMatchInRange(e,Math.max(0,n-this.spec.unquoted.length),e.doc.length),r&&(r.from!=t||r.to!=n)?r:null}getReplacement(e){return this.spec.unquote(this.spec.replace)}matchAll(e,t){let n=BC(this.spec,e,0,e.doc.length),r=[];for(;!n.next().done;){if(r.length>=t)return null;r.push(n.value)}return r}highlight(e,t,n,r){let i=BC(this.spec,e,Math.max(0,t-this.spec.unquoted.length),Math.min(n+this.spec.unquoted.length,e.doc.length));for(;!i.next().done;)r(i.value.from,i.value.to)}};function UC(e,t,n){return(r,i,a)=>(!n||n(r,i,a))&&e(a[0],t,r,i)}function WC(e,t,n,r){let i;return e.wholeWord&&(i=qC(t.charCategorizer(t.selection.main.head))),e.test&&(i=UC(e.test,t,i)),new gC(t.doc,e.search,{ignoreCase:!e.caseSensitive,test:i},n,r)}function GC(e,t){return e.slice(pf(e,t,!1),t)}function KC(e,t){return e.slice(t,pf(e,t))}function qC(e){return(t,n,r)=>!r[0].length||(e(GC(r.input,r.index))!=hp.Word||e(KC(r.input,r.index))!=hp.Word)&&(e(KC(r.input,r.index+r[0].length))!=hp.Word||e(GC(r.input,r.index+r[0].length))!=hp.Word)}var JC=class extends RC{nextMatch(e,t,n){let r=WC(this.spec,e,n,e.doc.length).next();return r.done&&(r=WC(this.spec,e,0,t).next()),r.done?null:r.value}prevMatchInRange(e,t,n){for(let r=1;;r++){let i=Math.max(t,n-r*1e4),a=WC(this.spec,e,i,n),o=null;for(;!a.next().done;)o=a.value;if(o&&(i==t||o.from>i+10))return o;if(i==t)return null}}prevMatch(e,t,n){return this.prevMatchInRange(e,0,t)||this.prevMatchInRange(e,n,e.doc.length)}getReplacement(e){return this.spec.unquote(this.spec.replace).replace(/\$([$&]|\d+)/g,(t,n)=>{if(n==`&`)return e.match[0];if(n==`$`)return`$`;for(let t=n.length;t>0;t--){let r=+n.slice(0,t);if(r>0&&r<e.match.length)return e.match[r]+n.slice(t)}return t})}matchAll(e,t){let n=WC(this.spec,e,0,e.doc.length),r=[];for(;!n.next().done;){if(r.length>=t)return null;r.push(n.value)}return r}highlight(e,t,n,r){let i=WC(this.spec,e,Math.max(0,t-250),Math.min(n+250,e.doc.length));for(;!i.next().done;)r(i.value.from,i.value.to)}},YC=ap.define(),XC=ap.define(),ZC=Rf.define({create(e){return new $C(dw(e).create(),null)},update(e,t){for(let n of t.effects)n.is(YC)?e=new $C(n.value.create(),e.panel):n.is(XC)&&(e=new $C(e.query,n.value?uw:null));return e},provide:e=>ob.from(e,e=>e.panel)});function QC(e){let t=e.field(ZC,!1);return t?t.query.spec:dw(e)}var $C=class{constructor(e,t){this.query=e,this.panel=t}},ew=wm.mark({class:`cm-searchMatch`}),tw=wm.mark({class:`cm-searchMatch cm-searchMatch-selected`}),nw=Xh.fromClass(class{constructor(e){this.view=e,this.decorations=this.highlight(e.state.field(ZC))}update(e){let t=e.state.field(ZC);(t!=e.startState.field(ZC)||e.docChanged||e.selectionSet||e.viewportChanged)&&(this.decorations=this.highlight(t))}highlight({query:e,panel:t}){if(!t||!e.spec.valid)return wm.none;let{view:n}=this,r=new Ap;for(let t=0,i=n.visibleRanges,a=i.length;t<a;t++){let{from:o,to:s}=i[t];for(;t<a-1&&s>i[t+1].from-500;)s=i[++t].to;e.highlight(n.state,o,s,(e,t)=>{let i=n.state.selection.ranges.some(n=>n.from==e&&n.to==t);r.add(e,t,i?tw:ew)})}return r.finish()}},{decorations:e=>e.decorations});function rw(e){return t=>{let n=t.state.field(ZC,!1);return n&&n.query.spec.valid?e(t,n):mw(t)}}var iw=rw((e,{query:t})=>{let{to:n}=e.state.selection.main,r=t.nextMatch(e.state,n,n);if(!r)return!1;let i=W.single(r.from,r.to),a=e.state.facet(FC);return e.dispatch({selection:i,effects:[xw(e,r),a.scrollToMatch(i.main,e)],userEvent:`select.search`}),pw(e),!0}),aw=rw((e,{query:t})=>{let{state:n}=e,{from:r}=n.selection.main,i=t.prevMatch(n,r,r);if(!i)return!1;let a=W.single(i.from,i.to),o=e.state.facet(FC);return e.dispatch({selection:a,effects:[xw(e,i),o.scrollToMatch(a.main,e)],userEvent:`select.search`}),pw(e),!0}),ow=rw((e,{query:t})=>{let n=t.matchAll(e.state,1e3);return!n||!n.length?!1:(e.dispatch({selection:W.create(n.map(e=>W.range(e.from,e.to))),userEvent:`select.search.matches`}),!0)}),sw=({state:e,dispatch:t})=>{let n=e.selection;if(n.ranges.length>1||n.main.empty)return!1;let{from:r,to:i}=n.main,a=[],o=0;for(let t=new pC(e.doc,e.sliceDoc(r,i));!t.next().done;){if(a.length>1e3)return!1;t.value.from==r&&(o=a.length),a.push(W.range(t.value.from,t.value.to))}return t(e.update({selection:W.create(a,o),userEvent:`select.search.matches`})),!0},cw=rw((e,{query:t})=>{let{state:n}=e,{from:r,to:i}=n.selection.main;if(n.readOnly)return!1;let a=t.nextMatch(n,r,r);if(!a)return!1;let o=a,s=[],c,l,u=[];o.precise?o.from==r&&o.to==i&&(l=n.toText(t.getReplacement(o)),s.push({from:o.from,to:o.to,insert:l}),o=t.nextMatch(n,o.from,o.to),u.push(q.announce.of(n.phrase(`replaced match on line $`,n.doc.lineAt(r).number)+`.`))):o=t.nextMatch(n,o.from,o.to);let d=e.state.changes(s);return o&&(c=W.single(o.from,o.to).map(d),u.push(xw(e,o)),u.push(n.facet(FC).scrollToMatch(c.main,e))),e.dispatch({changes:d,selection:c,effects:u,userEvent:`input.replace`}),!0}),lw=rw((e,{query:t})=>{if(e.state.readOnly)return!1;let n=[];for(let r of t.matchAll(e.state,1e9)){let{from:e,to:i,precise:a}=r;a&&n.push({from:e,to:i,insert:t.getReplacement(r)})}if(!n.length)return!1;let r=e.state.phrase(`replaced $ matches`,n.length)+`.`;return e.dispatch({changes:n,effects:q.announce.of(r),userEvent:`input.replace.all`}),!0});function uw(e){return e.state.facet(FC).createPanel(e)}function dw(e,t){let n=e.selection.main,r=n.empty||n.to>n.from+100?``:e.sliceDoc(n.from,n.to);if(t&&!r)return t;let i=e.facet(FC);return new LC({search:t?.literal??i.literal?r:r.replace(/\n/g,`\\n`),caseSensitive:t?.caseSensitive??i.caseSensitive,literal:t?.literal??i.literal,regexp:t?.regexp??i.regexp,wholeWord:t?.wholeWord??i.wholeWord})}function fw(e){let t=nb(e,uw);return t&&t.dom.querySelector(`[main-field]`)}function pw(e){let t=fw(e);t&&t==e.root.activeElement&&t.select()}var mw=e=>{let t=e.state.field(ZC,!1);if(t&&t.panel){let n=fw(e);if(n&&n!=e.root.activeElement){let r=dw(e.state,t.query.spec);r.valid&&e.dispatch({effects:YC.of(r)}),n.focus(),n.select()}}else e.dispatch({effects:[XC.of(!0),t?YC.of(dw(e.state,t.query.spec)):ap.appendConfig.of(Cw)]});return!0},hw=e=>{let t=e.state.field(ZC,!1);if(!t||!t.panel)return!1;let n=nb(e,uw);return n&&n.dom.contains(e.root.activeElement)&&e.focus(),e.dispatch({effects:XC.of(!1)}),!0},gw=[{key:`Mod-f`,run:mw,scope:`editor search-panel`},{key:`F3`,run:iw,shift:aw,scope:`editor search-panel`,preventDefault:!0},{key:`Mod-g`,run:iw,shift:aw,scope:`editor search-panel`,preventDefault:!0},{key:`Escape`,run:hw,scope:`editor search-panel`},{key:`Mod-Shift-l`,run:sw},{key:`Mod-Alt-g`,run:SC},{key:`Mod-d`,run:PC,preventDefault:!0}],_w=class{constructor(e){this.view=e;let t=this.query=e.state.field(ZC).query.spec;this.commit=this.commit.bind(this),this.searchField=rm(`input`,{value:t.search,placeholder:vw(e,`Find`),"aria-label":vw(e,`Find`),class:`cm-textfield`,name:`search`,form:``,"main-field":`true`,onchange:this.commit,onkeyup:this.commit}),this.replaceField=rm(`input`,{value:t.replace,placeholder:vw(e,`Replace`),"aria-label":vw(e,`Replace`),class:`cm-textfield`,name:`replace`,form:``,onchange:this.commit,onkeyup:this.commit}),this.caseField=rm(`input`,{type:`checkbox`,name:`case`,form:``,checked:t.caseSensitive,onchange:this.commit}),this.reField=rm(`input`,{type:`checkbox`,name:`re`,form:``,checked:t.regexp,onchange:this.commit}),this.wordField=rm(`input`,{type:`checkbox`,name:`word`,form:``,checked:t.wholeWord,onchange:this.commit});function n(e,t,n){return rm(`button`,{class:`cm-button`,name:e,onclick:t,type:`button`},n)}this.dom=rm(`div`,{onkeydown:e=>this.keydown(e),class:`cm-search`},[this.searchField,n(`next`,()=>iw(e),[vw(e,`next`)]),n(`prev`,()=>aw(e),[vw(e,`previous`)]),n(`select`,()=>ow(e),[vw(e,`all`)]),rm(`label`,null,[this.caseField,vw(e,`match case`)]),rm(`label`,null,[this.reField,vw(e,`regexp`)]),rm(`label`,null,[this.wordField,vw(e,`by word`)]),...e.state.readOnly?[]:[rm(`br`),this.replaceField,n(`replace`,()=>cw(e),[vw(e,`replace`)]),n(`replaceAll`,()=>lw(e),[vw(e,`replace all`)])],rm(`button`,{name:`close`,onclick:()=>hw(e),"aria-label":vw(e,`close`),type:`button`},[`×`])])}commit(){let e=new LC({search:this.searchField.value,caseSensitive:this.caseField.checked,regexp:this.reField.checked,wholeWord:this.wordField.checked,replace:this.replaceField.value});e.eq(this.query)||(this.query=e,this.view.dispatch({effects:YC.of(e)}))}keydown(e){gy(this.view,e,`search-panel`)?e.preventDefault():e.keyCode==13&&e.target==this.searchField?(e.preventDefault(),(e.shiftKey?aw:iw)(this.view)):e.keyCode==13&&e.target==this.replaceField&&(e.preventDefault(),cw(this.view))}update(e){for(let t of e.transactions)for(let e of t.effects)e.is(YC)&&!e.value.eq(this.query)&&this.setQuery(e.value)}setQuery(e){this.query=e,this.searchField.value=e.search,this.replaceField.value=e.replace,this.caseField.checked=e.caseSensitive,this.reField.checked=e.regexp,this.wordField.checked=e.wholeWord}mount(){this.searchField.select()}get pos(){return 80}get top(){return this.view.state.facet(FC).top}};function vw(e,t){return e.state.phrase(t)}var yw=30,bw=/[\s\.,:;?!]/;function xw(e,{from:t,to:n}){let r=e.state.doc.lineAt(t),i=e.state.doc.lineAt(n).to,a=Math.max(r.from,t-yw),o=Math.min(i,n+yw),s=e.state.sliceDoc(a,o);if(a!=r.from){for(let e=0;e<yw;e++)if(!bw.test(s[e+1])&&bw.test(s[e])){s=s.slice(e);break}}if(o!=i){for(let e=s.length-1;e>s.length-yw;e--)if(!bw.test(s[e-1])&&bw.test(s[e])){s=s.slice(0,e);break}}return q.announce.of(`${e.state.phrase(`current match`)}. ${s} ${e.state.phrase(`on line`)} ${r.number}.`)}var Sw=q.baseTheme({".cm-panel.cm-search":{padding:`2px 6px 4px`,position:`relative`,"& [name=close]":{position:`absolute`,top:`0`,right:`4px`,backgroundColor:`inherit`,border:`none`,font:`inherit`,padding:0,margin:0},"& input, & button, & label":{margin:`.2em .6em .2em 0`},"& input[type=checkbox]":{marginRight:`.2em`},"& label":{fontSize:`80%`,whiteSpace:`pre`}},"&light .cm-searchMatch":{backgroundColor:`#ffff0054`},"&dark .cm-searchMatch":{backgroundColor:`#00ffff8a`},"&light .cm-searchMatch-selected":{backgroundColor:`#ff6a0054`},"&dark .cm-searchMatch-selected":{backgroundColor:`#ff00ff8a`}}),Cw=[ZC,Vf.low(nw),Sw];function ww(){let e=typeof window>`u`?void 0:window.visualViewport;return e?{top:e.offsetTop,height:e.height}:null}function Tw(e){let[t,n]=(0,_.useState)(ww);return(0,_.useEffect)(()=>{if(!e)return;let t=window.visualViewport;if(!t)return;let r=()=>{let e=ww();n(t=>t&&e&&t.top===e.top&&t.height===e.height?t:e)};return r(),t.addEventListener(`resize`,r),t.addEventListener(`scroll`,r),()=>{t.removeEventListener(`resize`,r),t.removeEventListener(`scroll`,r)}},[e]),t}var Ew=NS.define([{tag:Y.keyword,color:`var(--reader-syntax-keyword)`,fontWeight:`600`},{tag:Y.string,color:`var(--reader-syntax-string)`},{tag:Y.comment,color:`var(--reader-syntax-comment)`,fontStyle:`italic`},{tag:Y.number,color:`var(--reader-syntax-number)`},{tag:Y.typeName,color:`var(--reader-syntax-type)`},{tag:[Y.function(Y.variableName),Y.function(Y.propertyName)],color:`var(--reader-syntax-function)`},{tag:[Y.definition(Y.variableName),Y.definition(Y.propertyName),Y.definition(Y.typeName)],fontWeight:`600`},{tag:Y.variableName,color:`var(--reader-syntax-variable)`},{tag:Y.operator,color:`var(--reader-syntax-operator)`},{tag:Y.meta,color:`var(--reader-syntax-meta)`},{tag:Y.invalid,color:`var(--reader-syntax-invalid)`,textDecoration:`underline`}]);function Dw(e,t,n){let r=e.state.selection,i=r.ranges.map(r=>{let i=t(e,r);return n?W.range(r.anchor,i.head,i.goalColumn):i}),a=W.create(i,r.mainIndex);return e.dispatch({selection:a,effects:q.scrollIntoView(a.main.head)}),!0}function Ow(e,t,n){return{key:e,run:e=>Dw(e,(e,r)=>!r.empty&&n!==void 0?W.cursor(n?r.to:r.from):t(e,r),!1),shift:e=>Dw(e,t,!0)}}var kw=[Ow(`ArrowLeft`,(e,t)=>e.moveByChar(t,!1),!1),Ow(`ArrowRight`,(e,t)=>e.moveByChar(t,!0),!0),Ow(`ArrowUp`,(e,t)=>e.moveVertically(t,!1)),Ow(`ArrowDown`,(e,t)=>e.moveVertically(t,!0)),Ow(`Mod-ArrowLeft`,(e,t)=>e.moveByGroup(t,!1),!1),Ow(`Mod-ArrowRight`,(e,t)=>e.moveByGroup(t,!0),!0),Ow(`Home`,(e,t)=>e.moveToLineBoundary(t,!1)),Ow(`End`,(e,t)=>e.moveToLineBoundary(t,!0)),Ow(`Mod-Home`,e=>W.cursor(0)),Ow(`Mod-End`,e=>W.cursor(e.state.doc.length)),Ow(`PageUp`,(e,t)=>e.moveVertically(t,!1,e.scrollDOM.clientHeight)),Ow(`PageDown`,(e,t)=>e.moveVertically(t,!0,e.scrollDOM.clientHeight))],Aw={missing:`This file is missing from this snapshot.`,expired:`Source for this snapshot has expired. No newer source was substituted.`,binary:`Binary or non-UTF-8 source cannot be displayed.`,large:`This file exceeds the 1 MiB reading limit.`,unsupported:`Symlinks, submodules and non-regular files cannot be displayed.`};function jw({owner:e,repo:t,path:n,commit:r,start:i=1,end:a=i,modal:o=!1,onClose:s}){let c=(0,_.useRef)(null),[l,u]=(0,_.useState)(`Search this file`),d=(0,_.useRef)(null),f=(0,_.useRef)(null),p=(0,_.useRef)(null),m=(0,_.useRef)(null),[h,g]=(0,_.useState)(null),[v,y]=(0,_.useState)(!1),[x,S]=(0,_.useState)(0),[C,w]=(0,_.useState)(`Plain text`),T=_s(),E=Tw(o);return(0,_.useEffect)(()=>{let e=document.activeElement;return p.current?.focus({preventScroll:!0}),()=>{e?.isConnected&&e.focus({preventScroll:!0})}},[]),(0,_.useEffect)(()=>{let i=new AbortController;g(null),y(!1);let a=`${$c}/maps/${encodeURIComponent(e)}/${encodeURIComponent(t)}`;return(async()=>{let e=await fetch(`${a}/provenance${r?`?commit=${encodeURIComponent(r)}`:``}`,{signal:i.signal,cache:`no-store`});if(!e.ok)throw Error(`provenance unavailable`);let t=await e.json();if(t.version!==1||!/^[a-f0-9]{40,64}$/.test(t.commit)||r&&t.commit!==r)throw Error(`snapshot mismatch`);let o=new URLSearchParams({commit:t.commit,path:n}),s=await fetch(`${a}/source?${o}`,{signal:i.signal,cache:`no-store`});if(!s.ok)throw Error(`source unavailable`);let c=await s.json();if(c.version!==1||c.repository!==t.repository||c.commit!==t.commit||c.path!==n)throw Error(`source mismatch`);i.signal.aborted||g(c)})().catch(()=>{i.signal.aborted||y(!0)}),()=>i.abort()},[e,t,n,r,x]),(0,_.useEffect)(()=>{if(!d.current||h?.status!==`ready`||h.text==null)return;u(`Search this file`);let e=!1,t=new Uf,r=new q({parent:d.current,state:bp.create({doc:h.text,extensions:[bp.readOnly.of(!0),q.editable.of(!1),bp.changeFilter.of(()=>!1),q.contentAttributes.of({tabindex:`0`,"aria-label":`Read-only source`,role:`textbox`,"aria-readonly":`true`}),q.domEventHandlers({focus:(e,t)=>(t.focus(),!1)}),Mb(),Jy(),My(),IC({top:!0}),TC(),py.of([...gw,...kw,{key:`Mod-a`,run:e=>(e.dispatch({selection:{anchor:0,head:e.state.doc.length}}),!0)}]),q.updateListener.of(e=>{if(e.transactions.some(e=>e.effects.some(e=>e.is(YC)))){let t=QC(e.state);u(t.valid?t.getCursor(e.state).next().done?`No results`:`Matches found`:`Enter text to search`)}}),LS(Ew),t.of([]),q.theme({"&":{height:`100%`,color:`var(--on)`,backgroundColor:`var(--chrome2)`},".cm-scroller":{overflow:`auto`,fontFamily:`"IBM Plex Mono", monospace`,overscrollBehavior:`contain`},".cm-gutters":{backgroundColor:`var(--chrome)`,color:`var(--dim)`,borderColor:`var(--rule)`},".cm-panels":{backgroundColor:`var(--chrome)`,color:`var(--on)`},"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, ::selection":{backgroundColor:`var(--reader-selection-bg)`}},{dark:T===`dark`})]})});f.current=r;let o=Math.max(1,Math.min(r.state.doc.lines,i)),s=Math.max(o,Math.min(r.state.doc.lines,a));r.dispatch({selection:{anchor:r.state.doc.line(o).from,head:r.state.doc.line(s).to},effects:q.scrollIntoView(r.state.doc.line(o).from,{y:`center`})});let c=X.matchFilename(dC,n);return w(h.long_line?`Plain text · long line protection`:c?.name??`Plain text`),c&&!h.long_line&&c.load().then(n=>{e||r.dispatch({effects:t.reconfigure(n)})}).catch(()=>{e||w(`Plain text · highlighting unavailable`)}),()=>{e=!0,f.current=null,r.destroy()}},[h,n,i,a,T]),(0,b.jsxs)(`section`,{ref:c,style:o&&E?{position:`fixed`,top:E.top,height:E.height,bottom:`auto`}:void 0,className:`source-reader`,"data-source-reader":!0,role:o?`dialog`:`region`,"aria-modal":o||void 0,"aria-label":`Source reader`,onKeyDownCapture:e=>{e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),c.current?.querySelector(`.cm-search`)?(f.current&&hw(f.current),m.current?.focus({preventScroll:!0})):s())},onKeyDown:e=>{if(e.stopPropagation(),!e.defaultPrevented&&o&&e.key===`Tab`){let t=Array.from(c.current?.querySelectorAll(`button:not(:disabled), input, select, [tabindex="0"]`)??[]).filter(e=>e.getClientRects().length),n=t[0],r=t.at(-1);e.shiftKey&&document.activeElement===n?(e.preventDefault(),r?.focus()):!e.shiftKey&&document.activeElement===r&&(e.preventDefault(),n?.focus())}},children:[(0,b.jsxs)(`header`,{children:[(0,b.jsx)(`button`,{ref:p,onClick:s,children:`Return to map`}),(0,b.jsx)(`strong`,{children:n}),(0,b.jsx)(`button`,{ref:m,onClick:()=>{f.current&&mw(f.current)},disabled:h?.status!==`ready`,children:`Find in file`})]}),(0,b.jsxs)(`p`,{className:`source-provenance`,children:[h?`${h.repository} · ${h.commit}`:`Snapshot source`,` · Read only`]}),!h&&!v&&(0,b.jsx)(`p`,{role:`status`,children:`Loading committed source…`}),v&&(0,b.jsxs)(`div`,{role:`alert`,children:[(0,b.jsx)(`p`,{children:`Source unavailable. Check access or restore this snapshot. No current-branch fallback was used.`}),(0,b.jsx)(`button`,{onClick:()=>S(e=>e+1),children:`Retry source`})]}),h&&h.status!==`ready`&&(0,b.jsx)(`p`,{role:`status`,children:Aw[h.status]??`Source unavailable.`}),h?.status===`ready`&&(0,b.jsxs)(`p`,{className:`source-provenance`,children:[C,` · `,h.bytes.toLocaleString(),` bytes · Lines `,i,`–`,a]}),h?.status===`ready`&&(0,b.jsx)(`p`,{className:`source-provenance`,role:`status`,"data-source-search-status":!0,children:l}),(0,b.jsx)(`div`,{className:`source-editor`,ref:d})]})}var Mw=[`class`,`func`,`method`,`interface`,`type`,`const`],Nw=[`#3A6796`,`#2F6F63`,`#4E7A33`,`#7E3F5D`,`#8A6B1C`,`#93502A`];function Pw(e){let t=new Map;for(let[n,r]of e.E){let i=V(e,n),a=V(e,r);if(i===a||B(e.districts[String(i)])!==`mainland`||B(e.districts[String(a)])!==`mainland`)continue;let o=Math.min(i,a),s=Math.max(i,a),c=`${o}-${s}`,l=t.get(c);l||(l={a:o,b:s,ab:0,ba:0,total:0},t.set(c,l)),i===o?l.ab++:l.ba++,l.total++}return t}var Fw=(e,t)=>t.total-e.total||e.a-t.a||e.b-t.b;function Iw(e,t=12,n=2){let r=[...e.values()],i=[...r].sort(Fw),a=new Set;for(let e of i.slice(0,t))a.add(`${e.a}-${e.b}`);let o=new Map;for(let e of r)for(let t of[e.a,e.b]){let n=o.get(t);n||(n=[],o.set(t,n)),n.push(e)}for(let e of o.values())for(let t of[...e].sort(Fw).slice(0,n))a.add(`${t.a}-${t.b}`);return i.filter(e=>a.has(`${e.a}-${e.b}`))}function Lw(e){return Math.sqrt(Math.max(e,0)/Math.PI)}function Rw(e,t){let n=!1;for(let r of t)for(let t=0,i=r.length-1;t<r.length;i=t++){let[a,o]=r[t],[s,c]=r[i];o>e[1]!=c>e[1]&&e[0]<(s-a)*(e[1]-o)/(c-o)+a&&(n=!n)}return n}function zw(e,t,n,r){if(!n.length||!Rw(e,n)){let n=t[0]-e[0],i=t[1]-e[1],a=Math.hypot(n,i)||1;return[e[0]+n/a*r,e[1]+i/a*r]}let i=0,a=1;for(let r=0;r<40;r++){let o=r/40;if(!Rw([e[0]+(t[0]-e[0])*o,e[1]+(t[1]-e[1])*o],n)){a=o;break}i=o}for(let r=0;r<12;r++){let r=(i+a)/2;Rw([e[0]+(t[0]-e[0])*r,e[1]+(t[1]-e[1])*r],n)?i=r:a=r}return[e[0]+(t[0]-e[0])*a,e[1]+(t[1]-e[1])*a]}function Bw(e){let{a:t,b:n,ringsA:r,ringsB:i,raWorld:a,rbWorld:o,widthPx:s,bothDirections:c,k:l,toScreen:u}=e,d=zw(t,n,r,a),f=zw(n,t,i,o),p=f[0]-d[0],m=f[1]-d[1],h=[(d[0]+f[0])/2-m*.12,(d[1]+f[1])/2+p*.12],g=a*l,_=o*l,v=s,y=Math.min(v*2.8,g*.9+v),b=Math.min(v*2.8,_*.9+v),x=[],S=[];for(let e=0;e<=24;e++){let t=e/24,n=1-t,r=n*n*d[0]+2*n*t*h[0]+t*t*f[0],i=n*n*d[1]+2*n*t*h[1]+t*t*f[1];x.push([r,i]);let a=2*n*(h[0]-d[0])+2*t*(f[0]-h[0]),o=2*n*(h[1]-d[1])+2*t*(f[1]-h[1]),s=Math.hypot(a,o)||1;a/=s,o/=s,S.push([a,o])}let C=x.map(u),w=[],T=[];for(let e=0;e<=24;e++){let t=e/24,n=Math.max(0,1-t/.22)**2,r=Math.max(0,1-(1-t)/.22)**2,i=(v+(y-v)*n+(b-v)*r)/2,[a,o]=S[e],s=-o,c=a,[l,u]=C[e];w.push([l+s*i,u+c*i]),T.push([l-s*i,u-c*i])}let E=w.concat(T.slice().reverse()),D=Math.max(v*1.1,9),O=(e,t)=>{let n=Math.round(e*24),r=Math.min(24,Math.max(0,n+t)),i=C[n],a=C[r],o=(a[0]-i[0])*t,s=(a[1]-i[1])*t,c=Math.hypot(o,s)||1;o/=c,s/=c;let l=-s,u=o,d=D;return{tip:[i[0]+o*d*.6,i[1]+s*d*.6],back1:[i[0]-o*d*.5+l*d*.7,i[1]-s*d*.5+u*d*.7],back2:[i[0]-o*d*.5-l*d*.7,i[1]-s*d*.5-u*d*.7]}},k=c?[O(.38,1),O(.62,-1)]:[O(.5,1)],[ee,A]=u(d),[j,M]=u(h),[N,te]=u(f);return{polygon:E,chevrons:k,hitD:`M${ee.toFixed(1)} ${A.toFixed(1)} Q${j.toFixed(1)} ${M.toFixed(1)} ${N.toFixed(1)} ${te.toFixed(1)}`}}function Vw(e,t=Pw(e)){return Iw(t).map(t=>Hw(e,t))}function Hw(e,t){return{...t,raWorld:Lw(Ro(e.districts[String(t.a)])),rbWorld:Lw(Ro(e.districts[String(t.b)]))}}function Uw(e){let t=new Map;if(e.P)for(let n=0;n<e.F.length;n++){let r=e.P[String(n)];if(!r||r.length<3)continue;let i=V(e,n),a=t.get(i);a||(a=[],t.set(i,a)),a.push(Lo(r))}let n=new Map;for(let[e,r]of t)r.sort((e,t)=>e-t),n.set(e,r[r.length>>1]||0);return n}function Ww(e){let t=new Map;if(!e.P)return{cell:1,grid:t};let n=[],r=new Map;for(let t=0;t<e.F.length;t++){let i=e.P[String(t)];if(!i||i.length<3)continue;let a=1/0,o=1/0,s=-1/0,c=-1/0;for(let[e,t]of i)e<a&&(a=e),t<o&&(o=t),e>s&&(s=e),t>c&&(c=t);r.set(t,[a,o,s,c]),n.push(Math.max(s-a,c-o))}if(n.length===0)return{cell:1,grid:t};n.sort((e,t)=>e-t);let i=n[n.length>>1]||1e-6,a=Math.max(i,1e-6);for(let[e,[n,i,o,s]]of r){let r=Math.floor(n/a),c=Math.floor(o/a),l=Math.floor(i/a),u=Math.floor(s/a);for(let n=r;n<=c;n++)for(let r=l;r<=u;r++){let i=`${n},${r}`,a=t.get(i);a||(a=[],t.set(i,a)),a.push(e)}}return{cell:a,grid:t}}function Gw(e,t,n){let r=n*n;for(let n=0;n<t.length;n++){let i=t[n],a=t[(n+1)%t.length],o=a[0]-i[0],s=a[1]-i[1],c=o*o+s*s,l=c===0?0:Math.max(0,Math.min(1,((e[0]-i[0])*o+(e[1]-i[1])*s)/c)),u=i[0]+l*o,d=i[1]+l*s;if((e[0]-u)**2+(e[1]-d)**2<=r)return!0}return!1}function Kw(e,t,n,r,i=0){if(!e.P)return null;let a=[n,r],o=Math.floor(n/t.cell),s=Math.floor(r/t.cell);if(i<=0){let n=t.grid.get(`${o},${s}`);if(!n)return null;for(let t of n){let n=e.P[String(t)];if(n&&Rw(a,[n]))return t}return null}let c=Math.ceil(i/t.cell),l=new Set;for(let e=o-c;e<=o+c;e++)for(let n=s-c;n<=s+c;n++)for(let r of t.grid.get(`${e},${n}`)??[])l.add(r);let u=[...l].sort((e,t)=>e-t);for(let t of u){let n=e.P[String(t)];if(n&&Rw(a,[n]))return t}if(i>0)for(let t of u){let n=e.P[String(t)];if(n&&Gw(a,n,i))return t}return null}function qw(e){let t=new Map,n=new Map;for(let[r,i]of e.E)t.has(r)||t.set(r,[]),t.get(r).push(i),n.has(i)||n.set(i,[]),n.get(i).push(r);return{adj:t,radj:n}}function Jw(e,t,n){if(e===t)return[e];let r=new Map([[e,-1]]),i=[e];for(let e=0;e<i.length;e++){let a=i[e];for(let e of n.get(a)??[])if(!r.has(e)){if(r.set(e,a),e===t){let e=[t],n=a;for(;n!==-1;)e.push(n),n=r.get(n);return e.reverse()}i.push(e)}}return null}function Yw(e,t,n,r){let i=Jw(n,r,t);if(i)return{path:i,kind:`imports`};if(i=Jw(r,n,t),i)return{path:i.slice().reverse(),kind:`imported-by`};let a=new Map;for(let[t,n]of e.E)a.has(t)||a.set(t,[]),a.get(t).push(n),a.has(n)||a.set(n,[]),a.get(n).push(t);return i=Jw(n,r,a),i?{path:i,kind:`undirected`}:null}function Xw(e,t,n,r,i){let a=[...(t.get(r)??[]).map(e=>({j:e,dir:`out`})),...(n.get(r)??[]).map(e=>({j:e,dir:`in`}))];return a.sort((t,n)=>co(e,n.j)-co(e,t.j)||t.j-n.j),{shown:a.slice(0,i),total:a.length}}function Zw(e,t,n){if(n==null||t==null||!e.U)return null;let r=e.U[`${t}:${n}`];if(!r||!r.length)return null;let i=new Set(r.map(t=>V(e,t)));return{set:new Set(r),files:r,districts:i}}var Qw=new Set([`__init__.py`,`index.ts`,`index.tsx`,`index.js`,`mod.rs`,`lib.rs`,`main.rs`,`base.py`,`types.ts`,`wraps.py`,`helper.py`,`enums.py`,`schema.py`]);function $w(e){return Qw.has(e)||/^utils\.[^./]+$/.test(e)}function eT(e){let t=e.N.map((t,n)=>co(e,n)),n=e.N.map((e,t)=>t).filter(e=>t[e]>=30);n.sort((e,n)=>t[n]-t[e]||e-n);let r=new Map,i=new Map;for(let t of n){let n=e.F[t].split(`/`).pop();r.set(t,n),i.set(n,(i.get(n)??0)+1)}let a=n.map(n=>{let a=e.F[n].split(`/`),o=r.get(n),s=($w(o)||(i.get(o)??0)>1)&&a.length>=2?`${a[a.length-2]}/${o}`:o;return{i:n,fi:t[n],name:s}});return{hubs:a,maxFi:Math.max(1,...a.map(e=>e.fi))}}function tT(e,t,n){let r=3.5+9*Math.sqrt(e/(t||1));return n?r*.72:r}var nT=[209,273,374,582,510,950,692,209,355,355,407,625,277,333,277,294,573,521,567,573,555,571,573,553,574,573,296,296,625,625,625,578,1005,682,698,728,734,677,612,796,736,267,559,662,536,847,736,788,665,788,727,673,606,731,648,924,680,655,635,296,294,296,625,485,187,545,567,519,567,548,280,556,563,225,223,514,225,860,563,570,567,567,332,510,297,562,504,723,513,504,498,353,245,353,625],rT=[205,282,407,582,524,958,710,227,356,356,407,630,288,333,288,296,574,547,571,575,566,573,575,564,575,574,315,315,630,630,630,595,1002,695,702,725,731,674,611,795,734,274,571,677,552,846,734,785,667,785,722,670,612,728,659,938,683,666,635,316,296,316,630,495,197,550,579,532,579,554,293,573,573,238,236,528,238,860,573,583,579,579,346,524,305,572,516,740,529,516,503,372,245,372,630],iT=[200,292,444,583,541,966,729,246,357,357,407,636,300,333,300,298,575,576,576,576,577,575,576,576,576,575,336,336,636,636,636,613,998,709,706,721,728,672,609,794,732,282,585,695,570,844,732,782,670,782,717,667,619,724,671,954,686,677,634,339,298,339,636,507,209,556,592,547,592,561,307,591,584,252,250,543,252,861,584,598,592,592,362,541,314,583,529,758,546,529,509,394,245,394,636],aT={"·":333,"…":965,"—":1e3,"–":500},oT=1e3,sT=`Archivo, ui-sans-serif, system-ui, sans-serif`;function cT(e,t,n=400){let r=n<=400?nT:n<=500?rT:iT,i=0;for(let n of e){let e=n.codePointAt(0),a=(e>=32&&e<=126?r[e-32]:aT[n]??oT)/1e3*t;i+=Math.max(a,Math.round(a))}return i}function lT(e,t,n=400){return cT(e,t,n)+t*.4}var uT=.06;function dT(e){let t=new Map,n=e.neighbourhoods;if(!n)return t;let r=new Map;for(let[e,t]of Object.entries(n))r.has(t.d)||r.set(t.d,[]),r.get(t.d).push(e);for(let[,e]of r){let r=1e9,i=1e9,a=-1e9,o=-1e9;for(let t of e){let[e,s,c,l]=Ya(n[t].blob);r=Math.min(r,e),i=Math.min(i,s),a=Math.max(a,c),o=Math.max(o,l)}let s=(Math.max(a-r,o-i)||1)*uT,c=[...e].sort((e,t)=>n[t].size-n[e].size||(e<t?-1:+(e>t))),l=new Map;for(let e of c)l.set(e,[]);for(let e=0;e<c.length;e++)for(let t=e+1;t<c.length;t++)Qa(n[c[e]].blob,n[c[t]].blob,s)&&(l.get(c[e]).push(c[t]),l.get(c[t]).push(c[e]));let u=[,,,].fill(0);for(let e of c){let n=new Set((l.get(e)??[]).map(e=>t.get(e)).filter(e=>e!=null)),r=-1;for(let e=0;e<3;e++)if(!n.has(e)){r=e;break}if(r===-1){r=0;for(let e=1;e<3;e++)u[e]<u[r]&&(r=e)}t.set(e,r),u[r]++}}return t}function fT(e,t){let n=e.file_neighbourhoods?.[t];return n==null?null:e.neighbourhoods?.[n]??null}function pT(e){let t=new Map,n=e.file_neighbourhoods;if(!n)return new Map;for(let r=0;r<n.length;r++){let i=n[r];if(i==null)continue;let[a,o]=fo(e,`r`,r),s=t.get(i)??[0,0,0];s[0]+=a,s[1]+=o,s[2]+=1,t.set(i,s)}let r=new Map;for(let[e,[n,i,a]]of t)r.set(e,[n/a,i/a]);return r}var mT={entry:`var(--why-entry)`,bridge:`var(--why-bridge)`,hub:`var(--why-hub)`,capital:`var(--why-capital)`,hazard:`var(--why-hazard)`};function hT(e){if(e<1e3)return String(e);let t=e>=1e6?1e6:1e3,n=e/t;return`${n<10?Math.floor(n*10)/10:Math.floor(n)}${t===1e3?`k`:`m`}`}var gT={imports:`follows imports, source → target`,"imported-by":`reverse direction — the target imports the source`,undirected:`no directed path; shown ignoring edge direction`},_T=4;function vT(e){let t=Object.keys(e.districts),n=n=>t.filter(t=>B(e.districts[t])===n).sort((t,n)=>e.districts[n].size-e.districts[t].size||Number(t)-Number(n));return{mainland:n(`mainland`),islands:n(`island`)}}function yT(e){let t=vT(e);return[...t.mainland,...t.islands].map(Number)}function bT(e){return e.split(`/`).pop()??e}function xT(e,t,n){let r=new Map;for(let[i,a]of e.E)if(i===t){let t=V(e,a);t!==n&&r.set(t,(r.get(t)??0)+1)}else if(a===t){let t=V(e,i);t!==n&&r.set(t,(r.get(t)??0)+1)}let i=null,a=-1;for(let[e,t]of r)(t>a||t===a&&(i==null||e<i))&&(i=e,a=t);return i}function ST(e,t,n){return e.L.filter(r=>r[1]===t&&V(e,r[0])===n)}function CT(e){let t=e.split(`/`).pop()??e;return t===`__init__.py`||t===`exceptions.py`||t===`errors.py`}function wT(e,t){let n=ST(e,`hub`,t)[0];if(n)return{file:n[0],fi:co(e,n[0])};let r=n=>{let r=-1,i=-1;for(let a=0;a<e.N.length;a++){if(V(e,a)!==t||n&&CT(e.F[a]))continue;let o=co(e,a);(o>i||o===i&&(r===-1||a<r))&&(i=o,r=a)}return{file:r,fi:i}},i=r(!0);return i.file===-1?r(!1):i}function TT(e,t,n){let{file:r,fi:i}=wT(e,n),a=[];r!==-1&&i>0&&a.push({kind:`most-imported`,file:r,text:`most imported: ${bT(e.F[r])} (${i})`});let o=ST(e,`entry`,n)[0];o&&a.push({kind:`entry`,file:o[0],text:`entry: ${bT(e.F[o[0]])}`});let s=ST(e,`bridge`,n)[0];if(s){let t=xT(e,s[0],n);t!=null&&a.push({kind:`bridge`,file:s[0],text:`links ${e.names[String(n)]} ↔ ${e.names[String(t)]}`})}let c=ST(e,`hazard`,n)[0];c&&a.length<3&&!a.some(e=>e.file===c[0])&&a.push({kind:`hazard`,file:c[0],text:`changes most: ${bT(e.F[c[0]])}`});let l=(t.districtPaths.get(n)??[]).find(e=>!e.other),u=l&&l.share>=40?rs(l.path):null;return{d:n,name:e.names[String(n)],size:e.districts[String(n)].size,mostly:u,keyFiles:a.slice(0,_T)}}function ET(e,t){let n=vT(e),r=n.mainland.map(n=>TT(e,t,Number(n)));return{totalFiles:e.F.length,mainland:r,islandIds:n.islands}}function DT(e){let t=new Map;if(!e.P)return t;for(let n=0;n<e.F.length;n++){let r=e.P[String(n)];r&&r.length>=3&&t.set(n,Lo(r))}return t}var OT=0,kT=1,AT=2,jT=3,MT=4,NT=5,PT=7,FT=e=>e[OT],IT=e=>e[kT],LT=e=>e[AT],RT=e=>e[jT],zT=e=>e[MT],BT=e=>e[NT],VT=e=>e[PT]===!0,HT=1e11;function UT(e){let t=[],n=0,r=0;for(let i=0;i+1<e.length;i+=2)n+=e[i],r+=e[i+1],t.push([n/HT,r/HT]);return t}function WT(e){return!e||e.length===0?null:e.map(UT)}function GT(e){let t=1/0,n=1/0,r=-1/0,i=-1/0;for(let[a,o]of e)a<t&&(t=a),a>r&&(r=a),o<n&&(n=o),o>i&&(i=o);return[t,n,r,i]}function KT(e){let t=1/0,n=1/0,r=-1/0,i=-1/0;for(let a of e){let[e,o,s,c]=GT(a);e<t&&(t=e),o<n&&(n=o),s>r&&(r=s),c>i&&(i=c)}return[t,n,r,i]}function qT(e){let t=0,n=0;for(let[r,i]of e)t+=r,n+=i;return e.length?[t/e.length,n/e.length]:[0,0]}function JT(e){let t=e.symbols.length,n=new Map;for(let r=0;r<t;r++)n.set(e.symbol_indices[r],r);let r=new Int32Array(t).fill(-1),i=Array.from({length:t},()=>[]),a=new Map;for(let o=0;o<t;o++){let t=e.symbols[o],s=BT(t),c=s>=0?n.get(s):void 0;if(c!=null&&FT(e.symbols[c])===FT(t))r[o]=c,i[c].push(o);else{let e=a.get(FT(t));e||(e=[],a.set(FT(t),e)),e.push(o)}}for(let t of a.values())t.sort((t,n)=>RT(e.symbols[t])-RT(e.symbols[n]));for(let t of i)t.sort((t,n)=>RT(e.symbols[t])-RT(e.symbols[n]));let o=e.symbol_rings?e.symbol_rings.map(e=>WT(e)):Array(t).fill(null),s=new Map;if(e.header_rings)for(let[t,r]of Object.entries(e.header_rings)){let e=n.get(Number(t)),i=WT(r);e!=null&&i&&s.set(e,i)}let c=new Map;if(e.module_rings)for(let[t,n]of Object.entries(e.module_rings)){let e=WT(n);e&&c.set(Number(t),e)}return{raw:e,globalToLocal:n,children:i,localParent:r,topByFile:a,cardRings:o,headerRings:s,moduleRings:c}}function YT(e,t,n){return n?!0:e>0&&Math.sqrt(e)*t>=40}function XT(e,t,n){return e?n?!0:t>=110:!1}function ZT(e,t){let n=[],r=e.localParent[t];for(;r>=0;)n.push(r),r=e.localParent[r];return n}function QT(e,t){let n=new Set([t]),r=[t];for(;r.length;){let t=r.pop();for(let i of e.children[t])n.has(i)||(n.add(i),r.push(i))}return n}function $T(e,t,n){let r=IT(e),i=LT(e),a=i===1||i===2||i===3,o=n&&t>0?` ▸${t}`:``;return`${r}${a?`()`:``}${o}`}function eE(e){return e===0||e===4}function tE(e){return e===3}function nE(e,t,n){let r=Math.max(n,1),i=t?11.5:Math.min(11,Math.max(8.5,Math.sqrt(r)/7)),a=e.length*i*.62;return Math.sqrt(r)>=a-6}function rE(e){return e<=0?.55:e===1?.85:.6}var iE=.25;function aE(e,t){let n=e.kinds?.[t];return n===`extends`||n===`implements`||n===`overrides`?n:`call`}function oE(e,t){return n=>{if(t.has(n))return`s:${n}`;let r=e.globalToLocal.get(n);if(r!=null){for(let n of ZT(e,r)){let r=e.raw.symbol_indices[n];if(t.has(r))return`s:${r}`}return`f:${FT(e.raw.symbols[r])}`}return`f:${n}`}}function sE(e,t,n){let r=QT(e,t),i=new Set([...r].map(t=>e.raw.symbol_indices[t])),a=new Set(ZT(e,t).map(t=>e.raw.symbol_indices[t])),o=oE(e,n),s=new Map,c=new Map;for(let[n,r,l,u]of fE(e.raw)){if(aE(e.raw,u)!==`call`)continue;let d=i.has(n);if(d!==i.has(r)){if(d){if(a.has(r)||i.has(r))continue;let n=o(r);if(n===`s:${e.raw.symbol_indices[t]}`)continue;s.set(n,(s.get(n)??0)+l)}else{if(a.has(n)||i.has(n))continue;let r=o(n);if(r===`s:${e.raw.symbol_indices[t]}`)continue;c.set(r,(c.get(r)??0)+l)}}}return{out:s,in:c}}function cE(e,t,n){let r=QT(e,t),i=new Set([...r].map(t=>e.raw.symbol_indices[t])),a=new Set(ZT(e,t).map(t=>e.raw.symbol_indices[t])),o=oE(e,n),s=e.raw.symbol_indices[t],c=new Set,l=[];for(let[t,n,,r]of e.raw.edges){let u=aE(e.raw,r);if(u===`call`)continue;let d=i.has(t);if(d===i.has(n))continue;let f,p;if(d){if(a.has(n)||i.has(n))continue;f=o(n),p=!0}else{if(a.has(t)||i.has(t))continue;f=o(t),p=!1}if(f===`s:${s}`)continue;let m=`${u}:${p}:${f}`;c.has(m)||(c.add(m),l.push({key:f,kind:u,isOut:p}))}return l}function lE(e,t){return[...e.entries()].sort((e,t)=>t[1]-e[1]).slice(0,t)}function uE(e){return 1+Math.min(3,Math.log2(1+e))*.7}var dE={0:`class`,1:`function`,2:`method`,3:`nested function`,4:`interface`,5:`type`,6:`constant`};function fE(e){let t=e.kinds?e.kinds.indexOf(`possible_implementation`):-1;return t<0?e.edges:e.edges.filter(e=>e[3]!==t)}function pE(e,t){let n=new Map;for(let[,t,r]of fE(e.raw))n.set(t,(n.get(t)??0)+r);let r=new Map;for(let[t,n,,i]of e.raw.edges){if(aE(e.raw,i)!==`extends`)continue;let a=e.globalToLocal.get(n);if(a==null)continue;let o=r.get(t)??[];o.push(IT(e.raw.symbols[a])),r.set(t,o)}let i=t=>({local:t,global:e.raw.symbol_indices[t],row:e.raw.symbols[t],refsIn:n.get(e.raw.symbol_indices[t])??0,bases:r.get(e.raw.symbol_indices[t])??[],children:e.children[t].map(i)});return(e.topByFile.get(t)??[]).map(i)}function mE(e){let t=0;for(let n of e)t+=1+mE(n.children);return t}function hE(e,t){let n=e.raw,r=n.symbol_indices[t],i=t=>{let r=e.globalToLocal.get(t);return r==null?`#${t}`:IT(n.symbols[r])},a=e=>({key:`s:${e}`,global:e,name:i(e)}),o=e=>{let t=new Map;for(let n of e)t.set(n.global,n);return[...t.values()].sort((e,t)=>e.name.localeCompare(t.name))},s=[],c=[],l=[],u=[],d=[];for(let[e,t,,i]of n.edges){let o=aE(n,i);o===`extends`?(e===r&&s.push(a(t)),t===r&&l.push(a(e))):o===`implements`?(e===r&&c.push(a(t)),t===r&&u.push(a(e))):o===`overrides`&&t===r&&d.push(a(e))}return{extends:o(s),implements:o(c),subclasses:o(l),implementedBy:o(u),overriddenBy:o(d)}}function gE(e,t,n){let r=e.topByFile.get(n)??[],i=[];for(let n of r){let r=QT(e,n),a=new Set([...r].map(t=>e.raw.symbol_indices[t])),o=new Map;for(let[n,r,i]of fE(e.raw)){if(!a.has(n)||a.has(r))continue;let s=e.globalToLocal.get(r),c,l;if(s!=null){let n=s;for(let t of ZT(e,s))n=t;c=`s:${e.raw.symbol_indices[n]}`,l=`${t.F[FT(e.raw.symbols[n])]} › ${IT(e.raw.symbols[n])}`}else c=`f:${r}`,l=t.F[r]??`file ${r}`;let u=o.get(c);u?u.count+=i:o.set(c,{count:i,label:l})}o.size!==0&&i.push({from:{local:n,global:e.raw.symbol_indices[n],row:e.raw.symbols[n],refsIn:0,bases:[],children:[]},targets:[...o.entries()].sort((e,t)=>t[1].count-e[1].count).map(([e,{count:t,label:n}])=>({key:e,count:t,label:n}))})}return i}function _E(e){return[e.title,...e.rows.map(e=>e.map(e=>typeof e==`string`?e:e.text).join(``))]}function vE(e,t=!1){return{title:e[0],titleMono:t,rows:e.slice(1).map(e=>[e])}}function yE(e,t){let{doc:n}=t,r=e.split(`:`);if(r[0]===`lc`){let e=t.lensComparison?.changes[+r[1]];return e?vE([`${e.status} ${e.kind}`,e.before.join(` → `),e.after.join(` → `),`Open base stop card`],!0):null}if(r[0]===`lh`){let e=t.lens?.paths[+r[1]],n=e?.hops[+r[2]];return n&&e?vE([e.name,n.source===`declared`?`Declared hop`:`Computed · ${n.source} · ${n.edge_kind}`,n.reason??`Lower bound from available map edges`]):null}if(r[0]===`ln`){let e=t.lens?.notes[+r[1]];return e?vE([e.anchor,e.text]):null}if(r[0]===`ls`){let e=t.lens?.paths[+r[1]]?.stops[+r[2]];return e?vE([e.spec,`Open stop card · Read selected source`],!0):null}if(r[0]===`d`){let e=+r[1],i=n.districts[String(e)];if(!i)return null;let a=t.districtPaths.get(e)?.find(e=>!e.other),o=a&&a.share>=40?rs(a.path??`.`):null;return{title:n.names[String(e)]??`District ${e}`,rows:[[{text:String(i.size),mono:!0,field:`files`},` ${i.size===1?`file`:`files`} · `,...o?[`mostly `,{text:o,mono:!0,field:`mostly`}]:[{text:`mixed folders`,field:`mostly`}]]]}}if(r[0]===`dir`)return vE([e.slice(4)+`/`,`folder highlight`],!0);if(r[0]===`r`){let e=+r[1],i=+r[2],a=t.roadPlan.find(t=>t.a===e&&t.b===i);if(!a)return null;let o=n.names[String(e)]??`district ${e}`,s=n.names[String(i)]??`district ${i}`,c=t=>t===e?o:s,l=(t.lensRoads??[]).filter(t=>t.from===e&&t.to===i||t.from===i&&t.to===e).map(e=>`Suggested cut: ${c(e.from)} → ${c(e.to)}, ${e.edges} edges (lower bound)`);return vE([`${o} ↔ ${s}`,`${o} → ${s}: ${a.ab} imports · ${s} → ${o}: ${a.ba} imports`,...l])}if(r[0]===`st`&&r[1]===`n`){let e=r[2],i=r[3],a=t.streetCache?.intra.find(t=>t.a===e&&t.b===i||t.a===i&&t.b===e);if(!a)return null;let o=n.neighbourhoods?.[e]?.label??e,s=n.neighbourhoods?.[i]?.label??i;return vE([`${o} ↔ ${s}`,`${o} → ${s}: ${a.ab} imports · ${s} → ${o}: ${a.ba} imports`])}if(r[0]===`st`&&r[1]===`c`){let e=r[2],i=+r[3],a=t.streetCache?.cross.find(t=>t.n===e&&t.d===i);if(!a)return null;let o=n.neighbourhoods?.[e]?.label??e,s=n.names[String(i)]??`district ${i}`;return vE([`${o} ↔ ${s}`,`${o} → ${s}: ${a.out} imports · ${s} → ${o}: ${a.in} imports`])}if(r[0]===`n`){let e=n.neighbourhoods?.[r[1]];return e?vE([e.label,`${e.size} files`]):null}if(r[0]===`f`){let e=+r[1],i=n.F[e];if(!i)return null;let a=t.inAdj.get(e)?.length??0,o=i.lastIndexOf(`/`),s=o<0?i:i.slice(o+1),c=o<0?`(repo root)`:i.slice(0,o),l=n.L.find(([t])=>t===e)?.[1];return{title:s,titleMono:!0,rows:[[{text:c,mono:!0,field:`path`}],[`imported by `,{text:String(a),mono:!0,field:`imported-by`},` ${a===1?`file`:`files`}`,...l?[{text:l,badge:mT[l]??`var(--dim)`,field:`landmark`}]:[]]]}}if(r[0]===`s`){let e=+r[1],t=+r[2],i=po(n,e)[t];return i?vE([i[0],Mw[i[1]]??`symbol`,`lines ${i[2]}-${i[3]}`],!0):null}if(r[0]===`hs`){let e=+r[1],n=t.symLocalByGlobal.get(e);if(!n)return null;let{decoded:i,local:a}=n,o=i.raw.symbols[a],s=i.children[a].length,{out:c,in:l}=sE(i,a,t.symVisible),u=[...c.values()].reduce((e,t)=>e+t,0),d=[...l.values()].reduce((e,t)=>e+t,0);return vE([IT(o),`${dE[LT(o)]??`symbol`}${s?` · ${s} members`:``}`,`lines ${o[3]}-${o[4]}`,`refs out ${u} (${c.size} places) · in ${d} (${l.size} places)`],!0)}return null}var bE=class{hoverCard=null;svg;HOVER;constructor(e,t){this.svg=e,this.HOVER=t}destroy(){this.hoverCard?.remove(),this.hoverCard=null}ensureCard(){if(this.hoverCard)return this.hoverCard;let e=document.createElement(`div`);return e.className=`tolmap-hover-card glass`,(this.svg.parentElement??this.svg.ownerDocument.body).appendChild(e),this.hoverCard=e,e}showCard(e){if(!this.HOVER)return;let t=this.ensureCard(),n=document.createElement(`div`);n.className=e.titleMono?`tolmap-hover-card-title mono`:`tolmap-hover-card-title`,n.textContent=e.title,t.replaceChildren(n,...e.rows.map(e=>{let t=document.createElement(`div`);t.className=`tolmap-hover-card-sub`;for(let n of e){if(typeof n==`string`){t.appendChild(document.createTextNode(n));continue}let e=document.createElement(`span`);e.textContent=n.text,n.field&&(e.dataset.hoverField=n.field),n.badge?(e.className=`tolmap-hover-card-badge`,e.style.color=n.badge,e.style.background=`color-mix(in srgb, ${n.badge} 16%, transparent)`):n.mono&&(e.className=`mono`),t.appendChild(e)}return t})),t.style.display=`block`}hideCard(){this.hoverCard&&(this.hoverCard.style.display=`none`)}positionCard(e,t,n,r){if(!this.hoverCard||this.hoverCard.style.display===`none`)return;let i=this.svg.parentElement,a=i?i.getBoundingClientRect():this.svg.getBoundingClientRect(),o=i?.clientWidth??a.width,s=i?.clientHeight??a.height,c=(i?.closest(`[data-desktop-shell]`)?.querySelector(`[data-desktop-panel][aria-hidden="false"]`))?.getBoundingClientRect(),l=c?Math.max(8,c.right-a.left+8):8;this.hoverCard.style.maxWidth=`${Math.min(300,o-l-8)}px`;let u=this.hoverCard.offsetWidth,d=this.hoverCard.offsetHeight,f=e-a.left,p=t-a.top,m=n.getBoundingClientRect(),h=n.closest(`[data-k]`)?.getAttribute(`data-k`);if(n instanceof SVGTextElement&&h?.startsWith(`d:`)){let[e,t,n,i]=[m.left,m.top,m.right,m.bottom];for(let a of r.get(h)??[]){if(!(a instanceof SVGTextElement))continue;let r=a.getBoundingClientRect();(r.width!==0||r.height!==0)&&([e,t,n,i]=[Math.min(e,r.left),Math.min(t,r.top),Math.max(n,r.right),Math.max(i,r.bottom)])}m=new DOMRect(e,t,n-e,i-t)}let g=m.left-a.left,_=m.top-a.top,v=g+m.width,y=_+m.height,b=[[v+16,Math.max(8,Math.min(s-d-8,p-d/2))],[g-16-u,Math.max(8,Math.min(s-d-8,p-d/2))],[Math.max(l,Math.min(o-u-8,f-u/2)),y+16],[Math.max(l,Math.min(o-u-8,f-u/2)),_-16-d],[f+16,p+16],[f-16-u,p+16],[f+16,p-16-d],[f-16-u,p-16-d]],x=(e,t)=>e>=l&&t>=8&&e+u<=o-8&&t+d<=s-8,S=(e,t)=>!(f>=e&&f<=e+u&&p>=t&&p<=t+d),C=(e,t)=>e+u<=g||e>=v||t+d<=_||t>=y,[w,T]=b.find(([e,t])=>x(e,t)&&S(e,t)&&C(e,t))??b.find(([e,t])=>x(e,t)&&S(e,t))??b[0];if(w=Math.max(l,Math.min(o-u-8,w)),T=Math.max(8,Math.min(s-d-8,T)),!S(w,T)){let e=f-16-u,t=f+16;e>=l?w=e:t+u<=o-8&&(w=t);let n=p-16-d,r=p+16;n>=8?T=n:r+d<=s-8&&(T=r)}this.hoverCard.style.left=`${Math.round(w)}px`,this.hoverCard.style.top=`${Math.round(T)}px`}};function xE(e){return e===`mouse`?4:10}var SE=class{pointers=new Map;mode=`idle`;panLast=[0,0];pinchIds=null;pinchStartDist=1;lastTap=null;get active(){return this.pointers.size>0}get pointerCount(){return this.pointers.size}handle(e){switch(e.type){case`down`:return this.down(e);case`move`:return this.move(e);case`up`:return this.up(e);case`cancel`:case`lostcapture`:return this.pointers.has(e.id)?this.reset():[]}}reset(){return this.pointers.clear(),this.mode=`idle`,this.pinchIds=null,this.lastTap=null,[{kind:`cancel`}]}down(e){let t=[];if(e.isPrimary&&this.pointers.size>0&&t.push(...this.reset()),this.pointers.has(e.id)||this.pointers.size>=2)return t;if(this.pointers.set(e.id,{x0:e.x,y0:e.y,x:e.x,y:e.y,t0:e.t,pointerType:e.pointerType}),this.pointers.size===1)return this.mode=`press`,t;let n=[...this.pointers.keys()];return this.pinchIds=n,this.pinchStartDist=this.spread(n),this.mode=`pinch`,this.lastTap=null,t.push({kind:`pinch-start`,ids:n,mid:this.midpoint(n)}),t}move(e){let t=this.pointers.get(e.id);if(!t)return[];switch(t.x=e.x,t.y=e.y,this.mode){case`press`:return Math.hypot(t.x-t.x0,t.y-t.y0)<=xE(t.pointerType)?[]:(this.mode=`pan`,this.lastTap=null,this.panLast=[t.x,t.y],[{kind:`pan`,id:e.id,dx:t.x-t.x0,dy:t.y-t.y0,start:!0}]);case`pan`:{let n=t.x-this.panLast[0],r=t.y-this.panLast[1];return this.panLast=[t.x,t.y],[{kind:`pan`,id:e.id,dx:n,dy:r,start:!1}]}case`pinch`:{let e=this.pinchIds;return[{kind:`pinch`,mid:this.midpoint(e),scale:this.spread(e)/this.pinchStartDist}]}default:return[]}}up(e){let t=this.pointers.get(e.id);if(!t||(t.x=e.x,t.y=e.y,this.pointers.delete(e.id),this.mode===`pinch`&&(this.mode=`residual`,this.pinchIds=null),this.pointers.size>0))return[];let n=[];if(this.mode===`press`&&Math.hypot(t.x-t.x0,t.y-t.y0)<=xE(t.pointerType)&&e.t-t.t0<500){let r=this.lastTap;r!=null&&t.pointerType!==`mouse`&&r.pointerType!==`mouse`&&t.t0-r.tUp<=300&&Math.hypot(t.x0-r.x,t.y0-r.y)<=24?(this.lastTap=null,n.push({kind:`double-tap`,x:t.x0,y:t.y0})):(this.lastTap={x:t.x0,y:t.y0,tUp:e.t,pointerType:t.pointerType},n.push({kind:`tap`,x:t.x0,y:t.y0,pointerType:t.pointerType}))}else this.lastTap=null;return this.mode=`idle`,n.push({kind:`end`}),n}midpoint([e,t]){let n=this.pointers.get(e),r=this.pointers.get(t);return[(n.x+r.x)/2,(n.y+r.y)/2]}spread([e,t]){let n=this.pointers.get(e),r=this.pointers.get(t);return Math.hypot(n.x-r.x,n.y-r.y)||1}};function CE(e,t,n){let r=n/e.k;return{tx:t[0]-(e.m[0]-e.tx0)*r,ty:t[1]-(e.m[1]-e.ty0)*r}}var wE=class{holding=!1;pending=null;hold(){this.holding=!0}get held(){return this.holding}get latest(){return this.pending}offer(e){return!this.holding||(this.pending=e,!1)}release(){this.holding=!1;let e=this.pending;return this.pending=null,e}drop(){this.pending=null}},TE=3.4,EE=20,DE=32;function OE(e,t,n,r,i,a,o=[]){let s=[...o],c=(e,t)=>[e-EE/2,t-DE,EE,DE],l=e=>s.some(t=>!(e[0]+e[2]<t[0]||e[0]>t[0]+t[2]||e[1]+e[3]<t[1]||e[1]>t[1]+t[3])),u=[],d=e=>e===`capital`||e===`hub`;if(a!=null){let t=e.L.find(([e,t])=>e===a&&!d(t));if(t){let e=n(a);e&&(s.push(c(e[0],e[1])),u.push({row:t,cx:e[0],cy:e[1]}))}}let f=[];for(let t of e.L){let[e,r,,i]=t;if(e===a||d(r))continue;let o=n(e);o&&f.push({row:t,cx:o[0],cy:o[1],rank:i})}f.sort((e,t)=>e.rank-t.rank||e.row[0]-t.row[0]);for(let e of f){let t=c(e.cx,e.cy);l(t)||(s.push(t),u.push({row:e.row,cx:e.cx,cy:e.cy}))}return u}var kE=(e,t)=>t.total-e.total||(e.a<t.a?-1:+(e.a>t.a))||(e.b<t.b?-1:+(e.b>t.b));function AE(e,t){let n=new Map,r=e.file_neighbourhoods;if(!r)return n;for(let[i,a]of e.E){if(V(e,i)!==t||V(e,a)!==t)continue;let o=r[i],s=r[a];if(o==null||s==null||o===s)continue;let c=o<s?o:s,l=o<s?s:o,u=`${c}\0${l}`,d=n.get(u);d||(d={a:c,b:l,ab:0,ba:0,total:0},n.set(u,d)),o===c?d.ab++:d.ba++,d.total++}return n}function jE(e,t=20){let n=[...e.values()],r=[...n].sort(kE),i=new Set;for(let e of r.slice(0,t))i.add(`${e.a}\0${e.b}`);let a=new Map;for(let e of n)for(let t of[e.a,e.b]){let n=a.get(t);n||(n=[],a.set(t,n)),n.push(e)}for(let e of a.values()){let t=[...e].sort(kE)[0];t&&i.add(`${t.a}\0${t.b}`)}return r.filter(e=>i.has(`${e.a}\0${e.b}`))}function ME(e,t){let n=new Map,r=e.file_neighbourhoods;if(!r)return n;for(let[i,a]of e.E){let o=V(e,i),s=V(e,a);if(o===s)continue;let c=o===t?i:s===t?a:-1;if(c===-1)continue;let l=V(e,c===i?a:i);if(B(e.districts[String(l)])!==`mainland`)continue;let u=r[c];if(u==null)continue;let d=`${u}\0${l}`,f=n.get(d);f||(f={n:u,d:l,out:0,in:0,total:0},n.set(d,f)),c===i?f.out++:f.in++,f.total++}return n}var NE=(e,t)=>t.total-e.total||(e.n<t.n?-1:+(e.n>t.n))||e.d-t.d;function PE(e,t=12){return[...e.values()].sort(NE).slice(0,t)}var FE=`http://www.w3.org/2000/svg`,IE=12,LE=120,RE=16,zE=[[0,0],[-24,0],[24,0],[0,-18],[0,18],[-24,-18],[24,-18],[-24,18],[24,18],[-48,0],[48,0],[0,-36],[0,36],[-48,-18],[48,-18],[-48,18],[48,18],[-72,0],[72,0],[0,-54],[0,54]],BE=12;function $(e,t={}){let n=document.createElementNS(FE,e);for(let e in t)n.setAttribute(e,String(t[e]));return n}function VE(e,t,n=9){let r=Math.atan2(e[1]-t[1],e[0]-t[0]),i=e[0]-Math.cos(r)*n,a=e[1]-Math.sin(r)*n,o=r+Math.PI/2,s=n*.52,c=i+Math.cos(o)*s,l=a+Math.sin(o)*s,u=i-Math.cos(o)*s,d=a-Math.sin(o)*s;return $(`path`,{d:`M${e[0].toFixed(1)} ${e[1].toFixed(1)} L${c.toFixed(1)} ${l.toFixed(1)} L${u.toFixed(1)} ${d.toFixed(1)} Z`,fill:`var(--canvas)`,stroke:`var(--ink)`,"stroke-width":1.3,"stroke-linejoin":`round`,"pointer-events":`none`})}var HE=class e{svg;callbacks;state=null;maxLoc=1;maxCh=1;maxCx=1;districtOrder=new Map;districtArea=new Map;districtWorldBounds=new Map;fileRank=new Map;unconnectedFile=new Uint8Array;drawableDistrictIds=[];labelDistrictIds=[];desktopLabelDistrictIds=[];fileLabelOrder=[];fileBasenames=[];repeatedBasenames=new Set;roadPlan=[];roadMaxTotal=1;roadFlows=new Map;drawnRoads=[];hubSet={hubs:[],maxFi:1};hasFootprints=!1;neighbourhoodShade=new Map;neighbourhoodCentroid=new Map;streetCache=null;districtMedianArea=new Map;footprintIndex=null;fileFootprintArea=new Map;symDecoded=new Map;symAsked=new Set;symVisible=new Set;symScreenAnchor=new Map;cardedFileBBox=new Map;cardLabelBoxes=[];symDecodedByDistrict=new Map;symLocalByGlobal=new Map;gSymRefs=null;gRoadsFade=null;boundsCache=null;k=1;tx=0;ty=0;VW=1e3;VH=700;cssW=1e3;cssH=700;mapBoxW=0;mapBoxH=0;insets={frame:go,safe:go,centreInSafe:!1};panTravel=0;panDismissed=!1;directFileTaps=!1;gestures=new SE;pinch=null;clickAllowed=!1;renderGate=new wE;quietTimer=null;animId=null;pendingLensStep=null;rootG=null;drawnK=1;drawnTx=0;drawnTy=0;previewRaf=null;settleTimer=null;lastDriftRedraw=0;static SETTLE_MS=140;static DRIFT_PAN_FRACTION=1/3;static DRIFT_ZOOM_LO=.67;static DRIFT_ZOOM_HI=4;static DRIFT_REDRAW_MS=250;static ISLAND_FADE_START_ZF=1;static ISLAND_FADE_VISIBLE_EPS=.05;static ISLAND_STROKE_MIN_BASE=.22;TOUCH=matchMedia(`(pointer: coarse)`).matches;onPointerDown=e=>this.pointerDown(e);onPointerMove=e=>this.pointerMove(e);onPointerUp=e=>this.pointerUp(e);onPointerCancel=e=>this.pointerCancel(e);onLostCapture=e=>this.lostCapture(e);onWheel=e=>this.wheel(e);onClick=e=>this.click(e);HOVER=matchMedia(`(hover: hover) and (pointer: fine)`).matches;onHoverMove=e=>this.hoverMove(e);onHoverLeave=()=>this.clearHover();hoverKey=null;overviewDistricts=null;overviewHighlightEls=[];overviewDimEls=[];hoverEls=[];hoverCard;hoverImportG=null;hoverImportTimer=null;outAdj=new Map;inAdj=new Map;keyElements=new Map;linkCache=null;constructor(e,t){this.svg=e,this.hoverCard=new bE(e,this.HOVER),this.callbacks=t,e.addEventListener(`pointerdown`,this.onPointerDown),e.addEventListener(`pointermove`,this.onPointerMove),e.addEventListener(`pointerup`,this.onPointerUp),e.addEventListener(`pointercancel`,this.onPointerCancel),e.addEventListener(`lostpointercapture`,this.onLostCapture),e.addEventListener(`wheel`,this.onWheel,{passive:!1}),e.addEventListener(`click`,this.onClick),this.HOVER&&(e.addEventListener(`pointermove`,this.onHoverMove),e.addEventListener(`pointerleave`,this.onHoverLeave))}destroy(){this.animId!=null&&cancelAnimationFrame(this.animId),this.cancelPendingGestureWork(),this.quietTimer!=null&&clearTimeout(this.quietTimer),this.quietTimer=null,this.svg.removeEventListener(`pointerdown`,this.onPointerDown),this.svg.removeEventListener(`pointermove`,this.onPointerMove),this.svg.removeEventListener(`pointerup`,this.onPointerUp),this.svg.removeEventListener(`pointercancel`,this.onPointerCancel),this.svg.removeEventListener(`lostpointercapture`,this.onLostCapture),this.svg.removeEventListener(`wheel`,this.onWheel),this.svg.removeEventListener(`click`,this.onClick),this.HOVER&&(this.svg.removeEventListener(`pointermove`,this.onHoverMove),this.svg.removeEventListener(`pointerleave`,this.onHoverLeave),this.clearHover(),this.hoverCard.destroy())}loadDocument(e){this.renderGate.drop(),this.overviewDistricts=null,this.clearOverviewDistrictHighlight(),this.maxLoc=Math.max(1,...e.N.map(e=>e[3])),this.maxCh=Math.max(1,...e.N.map(e=>e[5])),this.maxCx=Math.max(1,...e.N.map(e=>e[4]));let{adj:t,radj:n}=qw(e);this.outAdj=t,this.inAdj=n,this.linkCache=null,this.districtOrder.clear(),this.districtArea.clear(),this.districtWorldBounds.clear(),this.fileRank.clear(),this.fileBasenames=e.F.map(e=>e.split(`/`).pop()),this.fileLabelOrder=[...e.N.keys()].sort((t,n)=>co(e,n)+io(e,n)/50-(co(e,t)+io(e,t)/50)||t-n);let r=new Map;for(let t=0;t<e.N.length;t++){let n=`${V(e,t)}\0${this.fileBasenames[t]}`;r.set(n,(r.get(n)??0)+1)}this.repeatedBasenames=new Set([...r].filter(([,e])=>e>=3).map(([e])=>e)),this.unconnectedFile=new Uint8Array(e.N.length),this.drawableDistrictIds=Object.keys(e.districts).filter(t=>B(e.districts[t])!==`unconnected`),this.labelDistrictIds=[...this.drawableDistrictIds].sort((t,n)=>Number(B(e.districts[t])===`island`)-Number(B(e.districts[n])===`island`)||e.districts[n].size-e.districts[t].size||+t-n),this.desktopLabelDistrictIds=[...this.drawableDistrictIds].sort((t,n)=>e.districts[n].size-e.districts[t].size||+t-n),this.roadFlows=Pw(e),this.roadPlan=Vw(e,this.roadFlows),this.roadMaxTotal=Math.max(1,...this.roadPlan.map(e=>e.total)),this.hubSet=eT(e),this.hasFootprints=!!e.P,this.neighbourhoodShade=e.neighbourhoods?dT(e):new Map,this.neighbourhoodCentroid=e.neighbourhoods?pT(e):new Map,this.streetCache=null,this.districtMedianArea=this.hasFootprints?Uw(e):new Map,this.footprintIndex=this.hasFootprints?Ww(e):null,this.fileFootprintArea=this.hasFootprints?DT(e):new Map,this.symDecoded=new Map,this.symAsked=new Set,this.symVisible=new Set,this.symScreenAnchor=new Map,this.symDecodedByDistrict=new Map,this.symLocalByGlobal=new Map,this.gSymRefs=null,this.gRoadsFade=null;let i=new Set(e.L.map(([e])=>e)),a=new Map;for(let t=0;t<e.N.length;t++){let n=V(e,t);this.unconnectedFile[t]=+(B(e.districts[String(n)])===`unconnected`),a.has(n)||a.set(n,[]),a.get(n).push(t)}for(let[t,n]of a)n.sort((t,n)=>{let r=+!!i.has(t),a=+!!i.has(n);if(r!==a)return a-r;let o=co(e,t)+io(e,t)/50,s=co(e,n)+io(e,n)/50;return o===s?t-n:s-o}),this.districtOrder.set(t,n),n.forEach((e,t)=>this.fileRank.set(e,t));for(let t in e.districts){let n=e.districts[t];this.districtArea.set(+t,Ro(n));let r=1/0,i=1/0,a=-1/0,o=-1/0;for(let e of n.blob)for(let t of e)r=Math.min(r,t[0]),i=Math.min(i,t[1]),a=Math.max(a,t[0]),o=Math.max(o,t[1]);Number.isFinite(r)&&Number.isFinite(i)&&Number.isFinite(a)&&Number.isFinite(o)&&this.districtWorldBounds.set(+t,[r,i,a,o])}}dotFactor(e){let{doc:t}=this.state,n=V(t,e),r=t.districts[String(n)];if(r.size<=0)return 1;let i=(this.districtArea.get(n)??0)*this.k*this.k/30;if(i>=r.size)return 1;let a=this.fileRank.get(e)??r.size,o=Math.max(1,i*.5);return Math.min(1,Math.max(0,(i-a)/o))}hiddenFileCount(e,t){let n=this.state.doc.districts[String(e)];if(B(n)===`unconnected`||n.size<=0)return 0;let r=(this.districtArea.get(e)??0)*this.k*this.k/30;if(r>=n.size)return 0;let i=this.districtOrder.get(e)??[],a=Math.ceil(r),o=Math.max(0,i.length-a);for(let e=a;e<i.length;e++)t.has(i[e])&&o--;return o}islandFadeOpacity(t,n){if(t<=n)return 1;if(t<e.ISLAND_FADE_START_ZF){let r=e.ISLAND_FADE_START_ZF-n;return r<=1e-6?1:(e.ISLAND_FADE_START_ZF-t)/r}return Math.min(1,(t-e.ISLAND_FADE_START_ZF)/(TE-e.ISLAND_FADE_START_ZF))}islandFadeForDistrict(e,t,n,r){return B(this.state.doc.districts[String(e)])!==`island`||r.has(e)?1:this.islandFadeOpacity(t,n)}islandFadeVisible(t){return t*e.ISLAND_STROKE_MIN_BASE>e.ISLAND_FADE_VISIBLE_EPS}resize(e,t){let n=kl(this.mapBoxW,this.mapBoxH);this.mapBoxW=this.svg.clientWidth,this.mapBoxH=this.svg.clientHeight;let r=kl(this.mapBoxW,this.mapBoxH)!==n;this.cssW=e,this.cssH=t;let i=Math.max(1,360/(e||360),300/(t||300)),a=e*i,o=t*i;if(a===this.VW&&o===this.VH&&!r)return;let s=this.VW,c=this.VH;if(this.VW=a,this.VH=o,!this.state)return;this.cancelPendingGestureWork();let l=(s/2-this.tx)/this.k,u=(c/2-this.ty)/this.k;this.k=this.clampK(this.k),this.tx=this.VW/2-l*this.k,this.ty=this.VH/2-u*this.k,this.draw()}render(e){this.renderGate.offer(e)&&this.applyRender(e)}applyRender(e){this.state=e,this.cancelPendingGestureWork(),this.draw();let t=this.pendingLensStep;if(t&&e.districtSymbols.has(t.target.district)){this.pendingLensStep=null;let[e,n,r]=t.camera;(this.animId!=null||Math.abs(this.k-e)<=1e-9*e&&Math.abs(this.tx-n)<.5&&Math.abs(this.ty-r)<.5)&&this.frameLensStep(t.target,t.hop)}}bounds(){let{doc:e,geo:t}=this.state,n=this.boundsCache,r=this.viewInsets(this.insets.frame),i=`${r.left},${r.top},${r.right},${r.bottom}`;if(n&&n.doc===e&&n.geo===t&&n.vw===this.VW&&n.vh===this.VH&&n.frameKey===i)return n;let a=ho(e,t),o=mo(e,t),s={doc:e,geo:t,vw:this.VW,vh:this.VH,frameKey:i,mainland:a,world:o,fit:bo(a,this.VW,this.VH,r),full:bo(o,this.VW,this.VH,r)};return this.boundsCache=s,s}fitScale(){return this.state?this.bounds().fit:1}fullScale(){return this.state?this.bounds().full:1}frameBounds(){return this.state?this.bounds().mainland:[0,0,1,1]}fit(e,t){t&&(this.state=t,this.renderGate.drop());let n=this.frameBounds(),r=this.viewInsets(this.insets.safe),[i,,a]=vo(this.VW,this.VH,r),o=bo(n,this.VW,this.VH,r),s=i+(a-i-(n[2]-n[0])*o)/2-n[0]*o,c=yo(this.VW,this.VH,(n[3]-n[1])*o,r)-(n[1]+n[3])/2*o;e?this.glide(o,s,c):(this.cancelPendingGestureWork(),this.k=o,this.tx=s,this.ty=c,this.draw())}glide(e,t,n,r=520){let i=this.k,a=this.tx,o=this.ty,s=performance.now(),c=e=>e<.5?4*e*e*e:1-(-2*e+2)**3/2;if(matchMedia(`(prefers-reduced-motion: reduce)`).matches){this.cancelPendingGestureWork(),this.k=e,this.tx=t,this.ty=n,this.draw();return}this.animId!=null&&cancelAnimationFrame(this.animId);let l=u=>{let d=Math.min(1,(u-s)/r),f=c(d);this.k=i+(e-i)*f,this.tx=a+(t-a)*f,this.ty=o+(n-o)*f,d<1?(this.gestureFrame(),this.animId=requestAnimationFrame(l)):(this.animId=null,this.cancelPendingGestureWork(),this.draw())};this.animId=requestAnimationFrame(l)}panToPoint(e,t,n=!0){if(!this.state)return;let[r,i,a,o]=vo(this.VW,this.VH,this.viewInsets(this.insets.safe)),s=this.X(e),c=this.Y(t);if(s>=r&&s<=a&&c>=i&&c<=o)return;let[l,u]=this.moveCentre(),d=l-e*this.k,f=u-t*this.k;n?this.glide(this.k,d,f):(this.cancelPendingGestureWork(),this.tx=d,this.ty=f,this.draw())}panTo(e,t=!0){if(!this.state)return;let n=this.anchor(e);this.panToPoint(n[0],n[1],t)}panToDistrict(e,t=!0){if(!this.state)return;let n=this.state.doc.districts[e];if(!n)return;let r=this.state.geo===`t`?zo(this.state.doc,e):n.c;(!Number.isFinite(r[0])||!Number.isFinite(r[1]))&&(r=n.c),this.panToPoint(r[0],r[1],t)}frameDistricts(e){if(!this.state||e.length===0)return;let{doc:t,geo:n}=this.state,r=new Set(e),i=[1e9,1e9,-1e9,-1e9],a=(e,t)=>{Number.isFinite(e)&&Number.isFinite(t)&&(i[0]=Math.min(i[0],e),i[1]=Math.min(i[1],t),i[2]=Math.max(i[2],e),i[3]=Math.max(i[3],t))};if(n===`t`)for(let e=0;e<t.N.length;e++){if(!r.has(V(t,e)))continue;let[n,i,o,s]=lo(t,e);a(n,i),a(n+o,i+s)}else for(let e of r)for(let n of t.districts[String(e)]?.blob??[])for(let[e,t]of n)a(e,t);if(i[2]<i[0]||i[3]<i[1])return;let o=this.viewInsets(this.insets.safe),[s,c,l,u]=vo(this.VW,this.VH,o),d=this.clampK(bo(i,this.VW,this.VH,o)),f=(s+l-(i[2]-i[0])*d)/2-i[0]*d,p=(c+u-(i[3]-i[1])*d)/2-i[1]*d;this.glide(d,f,p)}highlightDistricts(e){this.overviewDistricts=e?.length?new Set(e):null,this.applyOverviewDistrictHighlight()}zoomDistrict(e){if(!this.state)return;let t=this.state.doc.districts[e],n=this.state.geo===`t`?zo(this.state.doc,e):t.c;(!Number.isFinite(n[0])||!Number.isFinite(n[1]))&&(n=t.c);let r=kl(this.mapBoxW,this.mapBoxH),i=this.fitScale()*(r?2.2:2.6),[a,o]=this.moveCentre();this.glide(i,a-n[0]*i,o-n[1]*i)}moveCentre(){if(!this.insets.centreInSafe)return[this.VW/2,this.VH/2];let[e,t,n,r]=vo(this.VW,this.VH,this.viewInsets(this.insets.safe));return[(e+n)/2,(t+r)/2]}viewInsets(e){let t=this.VW/(this.cssW||this.VW),n=this.VH/(this.cssH||this.VH);return{left:e.left*t,top:e.top*n,right:e.right*t,bottom:e.bottom*n}}chromeBoxes(){let e=this.svg.getScreenCTM();if(!e)return[];let t=e.inverse(),n=this.svg.getBoundingClientRect(),r=[`[data-command-bar]`,`[data-desktop-actions]`,`[data-desktop-panel]`,`[data-panel-tab]`,`[data-desktop-legend]`,`[data-map-controls]`,`[data-search-pill]`,`[data-control-column]`,`[data-phone-sheet]`,`[data-side-sheet]`].join(`,`),i=this.svg.createSVGPoint(),a=(e,n)=>{i.x=e,i.y=n;let r=i.matrixTransform(t);return[r.x,r.y]},o=[],s=[];return this.svg.ownerDocument.querySelectorAll(r).forEach(e=>{let t=window.getComputedStyle(e);if(t.display===`none`||t.visibility===`hidden`||e.getAttribute(`aria-hidden`)===`true`)return;let r=e.getBoundingClientRect();if(typeof e.getAnimations==`function`)for(let t of e.getAnimations())`transitionProperty`in t&&t.playState!==`finished`&&s.push(t);if(r.width<=0||r.height<=0||r.right<=n.left||r.left>=n.right||r.bottom<=n.top||r.top>=n.bottom)return;let i=[a(r.left,r.top),a(r.right,r.top),a(r.left,r.bottom),a(r.right,r.bottom)],c=i.map(([e])=>e),l=i.map(([,e])=>e),u=Math.min(...c),d=Math.min(...l);o.push([u,d,Math.max(...c)-u,Math.max(...l)-d])}),s.length&&this.repaintWhenChromeSettles(s),o}chromeSettlePending=!1;repaintWhenChromeSettles(e){this.chromeSettlePending||(this.chromeSettlePending=!0,Promise.allSettled(e.map(e=>e.finished)).then(()=>{this.chromeSettlePending=!1,this.state&&this.svg.isConnected&&!this.gestures.active&&this.draw()}))}setInsets(e){let t=!((e,t)=>e.left===t.left&&e.top===t.top&&e.right===t.right&&e.bottom===t.bottom)(e.frame,this.insets.frame);this.insets=e,t&&this.state&&!this.gestures.active&&(this.cancelPendingGestureWork(),this.k=this.clampK(this.k),this.draw())}setDirectFileTaps(e){this.directFileTaps=e}clampK(e){let t=Math.min(this.fitScale()*.5,this.fullScale());return Math.max(t,Math.min(this.fitScale()*40,e))}zoomBy(e){let[t,n]=this.moveCentre();this.zoomAbout(e,t,n)}zoomAbout(e,t,n){let r=this.clampK(this.k*e);this.glide(r,t-(t-this.tx)*(r/this.k),n-(n-this.ty)*(r/this.k),240)}px(e){return this.state?uo(this.state.doc,this.state.geo,e):[0,0]}anchor(e){return this.state?fo(this.state.doc,this.state.geo,e):[0,0]}X(e){return e*this.k+this.tx}Y(e){return e*this.k+this.ty}S(e){return e*this.k}tint(e){let{doc:t,layer:n,packageGrouping:r}=this.state;return n===`d`?Mo(t,V(t,e)):n===`c`?Oo(Math.min(1,so(t,e)/(this.maxCh||1))):n===`x`?Oo(Math.min(1,oo(t,e)/(this.maxCx||1))):r.fileColors[e]}drawLensAreas(e){let{doc:t,lens:n}=this.state;n&&n.areas.forEach((n,r)=>{let i=new Set(n.members.map(e=>e.target.district));for(let a of i)for(let i of t.districts[String(a)]?.blob??[])e.appendChild($(`path`,{d:`M`+i.map(e=>`${this.X(e[0])} ${this.Y(e[1])}`).join(`L`)+`Z`,fill:`var(--lens-${n.color})`,"fill-opacity":.22,stroke:`var(--lens-${n.color})`,"stroke-width":2,"stroke-dasharray":r%2?`6 3`:`none`,"pointer-events":`none`,"data-lens-area":n.label}))})}lensPoint(e,t){let{doc:n}=this.state;if(t){if(e.symbol){let t=this.state.districtSymbols.get(e.district),n=t?.symbols.findIndex(t=>t[0]===e.file&&(t[1]===e.symbol.name||e.symbol.name.endsWith(`.${t[1]}`))&&t[3]===e.symbol.start)??-1,r=t&&n>=0?t.symbol_indices[n]:void 0,i=r==null?void 0:this.symScreenAnchor.get(r);if(i)return i}let t=this.anchor(e.file);return[this.X(t[0]),this.Y(t[1])]}let[r,i,a,o]=Ya(n.districts[String(e.district)].blob);return[this.X((r+a)/2),this.Y((i+o)/2)]}lensTargetVisible(e,t){let n=this.fileFootprintArea.get(e.file);if(t<=1||n==null||!YT(n,this.k,!1))return!1;if(!e.symbol)return!0;let r=this.state.districtSymbols.get(e.district),i=r?.symbols.findIndex(t=>t[0]===e.file&&(t[1]===e.symbol.name||e.symbol.name.endsWith(`.${t[1]}`))&&t[3]===e.symbol.start)??-1;if(!r||i<0||!this.symVisible.has(r.symbol_indices[i]))return!1;let a=this.symDecodedByDistrict.get(e.district);if(!a)return!1;for(let e of ZT(a,i)){let t=a.cardRings[e];if(!t?.length)return!1;let[n,r,i,o]=GT(t[0]);if(Math.min(Math.abs(i-n),Math.abs(o-r))*this.k<110)return!1}return!0}frameLensStep(e,t,n=!0){if(!this.state)return;this.pendingLensStep=null;let r=this.lensStepGeometry(e),i=this.fitScale(),a=this.fileFootprintArea.get(e.file);a!=null&&a>0&&(i=Math.max(i,40/Math.sqrt(a)));for(let e of r.sides)e>0&&(i=Math.max(i,110/e));i*=1.04;let o=this.viewInsets(this.insets.safe),[s,c,l,u]=vo(this.VW,this.VH,o),d=[r.point[0],r.point[1],r.point[0],r.point[1]];for(let e of t){let[t,n]=this.lensStepGeometry(e).point;Number.isFinite(t)&&Number.isFinite(n)&&(d[0]=Math.min(d[0],t),d[1]=Math.min(d[1],n),d[2]=Math.max(d[2],t),d[3]=Math.max(d[3],n))}let f=d[2]>d[0]||d[3]>d[1],p=f?.8*Math.min((l-s)/Math.max(d[2]-d[0],1e-9),(u-c)/Math.max(d[3]-d[1],1e-9)):1/0,m=this.clampK(Math.max(i,Math.min(this.k,p))),[h,g]=f&&m<=p/.8?[(d[0]+d[2])/2,(d[1]+d[3])/2]:r.point,_=(s+l)/2-h*m,v=(c+u)/2-g*m;n?this.glide(m,_,v):(this.cancelPendingGestureWork(),this.animId!=null&&cancelAnimationFrame(this.animId),this.animId=null,this.k=m,this.tx=_,this.ty=v,this.draw()),r.pending&&(this.pendingLensStep={target:e,hop:t,camera:[m,_,v]})}lensStepGeometry(e){let t=this.anchor(e.file);if(!e.symbol)return{point:t,sides:[],pending:!1};let n=this.state.districtSymbols.get(e.district);if(!n)return{point:t,sides:[],pending:!0};let r=this.symDecoded.get(n)??JT(n);this.symDecoded.set(n,r);let i=n.symbols.findIndex(t=>t[0]===e.file&&(t[1]===e.symbol.name||e.symbol.name.endsWith(`.${t[1]}`))&&t[3]===e.symbol.start),a=i>=0?r.cardRings[i]:null;if(!a?.length)return{point:t,sides:[],pending:!1};let[o,s,c,l]=GT(a[0]),u=ZT(r,i).map(e=>{let t=r.cardRings[e]?.[0];if(!t)return 0;let[n,i,a,o]=GT(t);return Math.min(Math.abs(a-n),Math.abs(o-i))});return{point:[(o+c)/2,(s+l)/2],sides:u,pending:!1}}drawLens(e,t,n){let{doc:r,lens:i}=this.state;if(!i)return;let a=$(`g`,{"data-lens-overlay":``,"data-lens-zoom":t}),o=$(`g`,{"data-lens-markers":``});e.appendChild(a),i.paths.forEach((e,n)=>{e.hops.forEach((i,o)=>{if(!i.resolved)return;let s=e.stops[i.from]?.target,c=e.stops[i.to]?.target;if(!s||!c)return;let l=i.source===`declared`?[s.file,c.file]:i.via.map(e=>r.F.indexOf(e)),u=l.map((e,n)=>{let i=n===0?s:n===l.length-1?c:{...s,file:e,district:V(r,e),symbol:null};return this.lensPoint(i,this.lensTargetVisible(i,t))}),d=u.filter((e,t)=>t===0||e[0]!==u[t-1][0]||e[1]!==u[t-1][1]),[f,p]=d[0],m=d.length===1?`M${f} ${p}c-28 -32 28 -32 0 0`:`M`+d[0].join(` `)+d.slice(1).map((e,t)=>{let r=d[t],a=e[0]-r[0],s=e[1]-r[1],c=Math.hypot(a,s),l=(i.source===`declared`?30:14)+(o+n)%6*8;return`Q${(r[0]+e[0])/2-s/c*l} ${(r[1]+e[1])/2+a/c*l} ${e.join(` `)}`}).join(``),h=`lh:${n}:${o}`,g=i.source===`declared`?`var(--lens-declared)`:`var(--lens-computed)`;a.appendChild($(`path`,{d:m,fill:`none`,stroke:`var(--canvas)`,"stroke-width":6,"pointer-events":`none`})),a.appendChild($(`path`,{d:m,fill:`none`,stroke:g,"stroke-width":2.5,"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-dasharray":i.source===`declared`?`7 5`:`none`,"pointer-events":`none`,"data-lens-hop":i.source})),a.appendChild($(`path`,{d:m,fill:`none`,stroke:`transparent`,"stroke-width":16,"pointer-events":`stroke`,"data-k":h,"data-lens-hop-hit":i.source}))}),e.stops.forEach((e,r)=>{if(!e.target||!this.lensTargetVisible(e.target,t))return;let[i,a]=this.lensPoint(e.target,!0),s=$(`g`,{"data-k":`ls:${n}:${r}`,"data-lens-stop":e.spec});s.appendChild($(`circle`,{cx:i,cy:a,r:13,fill:`var(--chrome)`,stroke:`var(--lens-computed)`,"stroke-width":2,"pointer-events":`all`}));let c=$(`text`,{x:i,y:a+4,"text-anchor":`middle`,"font-size":12,fill:`var(--on)`,"pointer-events":`none`});c.textContent=String(r+1),s.appendChild(c),o.appendChild(s)})}),i.notes.forEach((e,n)=>{if(t<=1)return;let r=e.district;if(e.target?!this.lensTargetVisible(e.target,t):r==null)return;let i=e.target??{file:0,path:``,district:r,symbol:null},[a,s]=this.lensPoint(i,!!e.target),c=$(`g`,{"data-k":`ln:${n}`,"data-lens-note":e.anchor});c.appendChild($(`rect`,{x:a+16,y:s-12,width:24,height:24,rx:5,fill:`var(--chrome)`,stroke:`var(--dim)`,"pointer-events":`all`}));let l=$(`text`,{x:a+28,y:s+4,"text-anchor":`middle`,"font-size":12,fill:`var(--on)`,"pointer-events":`none`});l.textContent=`N`,c.appendChild(l),o.appendChild(c)}),e.appendChild(n),e.appendChild(o)}drawLensComparison(e,t,n){let{doc:r,lensComparison:i}=this.state;if(!i)return;let a=$(`g`,{"data-lens-comparison-overlay":``}),o=$(`g`,{"data-lens-comparison-markers":``});e.appendChild(a);let s={added:[`+`,`none`,`var(--lens-teal)`],removed:[`−`,`8 5`,`var(--lens-orange)`],broken:[`×`,`2 5`,`var(--lens-orange)`],renamed:[`↗`,`10 3 2 3`,`var(--lens-blue)`],moved:[`↔`,`5 3`,`var(--lens-blue)`],shared:[`=`,`none`,`var(--dim)`]},c=new Set,l=new Map;i.changes.map((e,t)=>({change:e,changeIndex:t})).sort((e,t)=>Number(e.change.status!==`shared`)-Number(t.change.status!==`shared`)).forEach(({change:e,changeIndex:n})=>{let[i,u,d]=s[e.status],f=e.status===`shared`?.22:1;if(e.status!==`shared`)for(let t of e.districts){let n=l.get(t)??new Set;n.add(e.status),l.set(t,n)}let p=`${e.status} ${e.kind} · ${e.label}: ${e.before.join(` → `)} → ${e.after.join(` → `)}`,m=t=>{t.setAttribute(`opacity`,String(f));let n=$(`title`,{});n.textContent=p,t.appendChild(n),(e.kind===`stop`?o:a).appendChild(t)};if(e.kind===`area`)for(let t of e.districts){let n=`${t}:${e.status}`;if(!c.has(n)){c.add(n);for(let n of r.districts[String(t)]?.blob??[])m($(`path`,{d:`M`+n.map(e=>`${this.X(e[0])} ${this.Y(e[1])}`).join(`L`)+`Z`,fill:d,"fill-opacity":e.status===`shared`?.04:.1,stroke:d,"stroke-width":2,"stroke-dasharray":u,"pointer-events":`none`,"data-lens-change":e.status}))}}else if(e.kind===`hop`){let n=e.targets.length>=2?e.targets.slice(0,2).map(e=>this.lensPoint(e,this.lensTargetVisible(e,t))):e.districts.map(e=>this.lensPoint({file:0,path:``,symbol:null,district:e},!1));if(n.length<1)return;let[r,i]=n[0],[a,o]=n[1]??n[0],s=r===a&&i===o?`M${r} ${i}c-30 -36 30 -36 0 0`:`M${r} ${i}Q${(r+a)/2+22} ${(i+o)/2-22} ${a} ${o}`;m($(`path`,{d:s,fill:`none`,stroke:`var(--canvas)`,"stroke-width":6,"pointer-events":`none`})),m($(`path`,{d:s,fill:`none`,stroke:d,"stroke-width":2.5,"stroke-dasharray":u,"pointer-events":`none`,"data-lens-change":e.status}))}else e.targets.forEach((r,a)=>{if(!this.lensTargetVisible(r,t))return;let[o,s]=this.lensPoint(r,!0),c=$(`g`,{"data-k":`lc:${n}:${a}`,"data-lens-change":e.status,"data-lens-comparison-stop":r.path});c.appendChild($(`circle`,{cx:o,cy:s,r:13,fill:`var(--chrome)`,stroke:d,"stroke-width":2,"stroke-dasharray":u,"pointer-events":`all`}));let l=$(`text`,{x:o,y:s+4,"text-anchor":`middle`,"font-size":12,fill:`var(--on)`,"pointer-events":`none`});l.textContent=i,c.appendChild(l),m(c)})}),e.appendChild(n);for(let[e,t]of l){let[n,r]=this.lensPoint({file:0,path:``,symbol:null,district:e},!1),i=[...t].sort(),a=$(`g`,{"data-lens-district-status":e,"pointer-events":`none`});i.forEach((e,t)=>{let[o,,c]=s[e],l=n+(t-(i.length-1)/2)*22;a.appendChild($(`circle`,{cx:l,cy:r,r:10,fill:`var(--chrome)`,stroke:c,"stroke-width":2}));let u=$(`text`,{x:l,y:r+4,"text-anchor":`middle`,"font-size":13,fill:`var(--on)`});u.textContent=o,a.appendChild(u)}),o.appendChild(a)}e.appendChild(o)}draw(){if(!window.__TOLMAP_PERF__){this.paint();return}performance.mark(`tolmap:draw:start`),this.paint(),performance.mark(`tolmap:draw:end`),performance.measure(`tolmap:draw`,`tolmap:draw:start`,`tolmap:draw:end`)}paint(){let e=this.state,t=this.svg;if(t.setAttribute(`viewBox`,`0 0 ${this.VW} ${this.VH}`),t.textContent=``,t.classList.remove(`previewing`),this.rootG=null,!e)return;let{doc:n,geo:r,layer:i,sel:a,selSym:o,selD:s,route:c,folderFiles:l,folderOnlyIslands:u}=e,d=jl(Al(this.mapBoxW,this.mapBoxH)),f=this.chromeBoxes(),p=$(`g`,{});t.appendChild(p),this.rootG=p,this.drawnK=this.k,this.drawnTx=this.tx,this.drawnTy=this.ty;let m=this.fitScale(),h=this.k/m,g=this.fullScale()/m,_=Math.sqrt(h),v=Zw(n,a,o),y=!c&&!v&&a!=null&&!this.unconnectedFile[a]?{out:this.outAdj.get(a)??[],in:this.inAdj.get(a)??[]}:null,b=l||(c?new Set(c.path):v?new Set([...v.set,a]):y?new Set([a,...y.out,...y.in]):null),x=new Set;if(d){if(a!=null){x.add(a);for(let e of this.outAdj.get(a)??[])x.add(e);for(let e of this.inAdj.get(a)??[])x.add(e)}if(c)for(let e of c.path)x.add(e);if(v)for(let e of v.set)x.add(e)}let S=new Set;if(d)for(let e of this.drawableDistrictIds){let t=n.districts[e];(this.districtArea.get(+e)??0)*this.k*this.k/Math.max(1,t.size)>=LE&&S.add(+e)}let C=y?new Set([V(n,a),...y.out.map(e=>V(n,e)),...y.in.map(e=>V(n,e))]):null,w=new Set;if(s!=null&&w.add(s),a!=null&&w.add(V(n,a)),b&&(!l||u))for(let e of b)w.add(V(n,e));if(r!==`t`){for(let e of this.drawableDistrictIds){let t=s===+e,r=B(n.districts[e])===`island`,a=C!=null&&!C.has(+e),o=r?this.islandFadeForDistrict(+e,h,g,w):1;(!r||this.islandFadeVisible(o))&&n.districts[e].blob.forEach(s=>{let c=$(`path`,{d:`M`+s.map(e=>this.X(e[0]).toFixed(1)+` `+this.Y(e[1]).toFixed(1)).join(`L`)+`Z`,fill:Mo(n,+e),"fill-opacity":(i===`d`?t?.3:a?.035:r?.07:.14:t?.16:a?.02:r?.03:.06)*o,stroke:t?`var(--hot)`:Mo(n,+e),"stroke-width":t?2.6:r?.9:1.5,"stroke-opacity":(t?1:a?.22:r?.4:.7)*o,"stroke-linejoin":`round`,class:`hit`,"pointer-events":`all`,"data-k":`d:`+e}),l=$(`title`,{});l.textContent=`${n.names[e]} — ${n.districts[e].size} files`,c.appendChild(l),p.appendChild(c)})}this.drawLensAreas(p);let e=$(`g`,{});p.appendChild(e),this.gRoadsFade=e,this.drawRoads(e),s!=null&&this.drawStreets(p,s)}else this.gRoadsFade=null;let T=r===`p`&&n.P&&h>1.9,E=r===`p`&&h>5.2,D=this.hasFootprints&&r!==`t`,O=i===`d`,k=new Map,ee=T?$(`defs`,{}):null;ee&&p.appendChild(ee);let A=new Set(n.L.map(([e])=>e));if(a!=null&&A.add(a),b)for(let e of b)A.add(e);let j=D?(()=>{let e=new Set;for(let[t,n]of this.fileFootprintArea){let r=t===a;!r&&h<=1||YT(n,this.k,r)&&e.add(t)}return a!=null&&this.fileFootprintArea.has(a)&&e.add(a),e})():null,M=[];for(let e=0;e<n.N.length;e++){if(this.unconnectedFile[e])continue;if(T&&n.P[String(e)]){let t=this.px(e),n=this.X(t[0]),r=this.Y(t[1]);if(n<-260||n>this.VW+260||r<-260||r>this.VH+260)continue;this.plot(p,ee,e,b,E);continue}if(D&&n.P[String(e)]){let t=V(n,e),r=!!j?.has(e);if(O&&!A.has(e)&&!this.districtFootprintsLarge(t)&&!r)this.batchFootprint(k,e,t,h,g,w);else{let t=this.footprint(p,e,b,h,g,w,l);r&&t&&M.push(e)}continue}if(d&&r!==`t`&&!S.has(V(n,e))&&!x.has(e)&&!j?.has(e))continue;let t=this.anchor(e),a;if(r!==`t`){let r=A.has(e)?1:this.dotFactor(e);if(r<=0)continue;let i=this.islandFadeForDistrict(V(n,e),h,g,w);if(!this.islandFadeVisible(i))continue;let o=Math.max(1.1,(1.6+5.2*Math.sqrt(io(n,e)/this.maxLoc))*_),s=this.X(t[0]),c=this.Y(t[1]),l=o+20;if(s<-l||s>this.VW+l||c<-l||c>this.VH+l)continue;let u=b&&!b.has(e)?.2:.85;a=$(`circle`,{cx:s.toFixed(1),cy:c.toFixed(1),r:o.toFixed(2),fill:this.tint(e),"fill-opacity":r===1&&i===1?u:Math.round(u*r*i*1e3)/1e3,class:`hit`,stroke:`transparent`,"stroke-width":this.TOUCH?16:0,"pointer-events":`all`,"data-k":`f:`+e})}else{let t=lo(n,e),r=this.X(t[0]),o=this.Y(t[1]),s=Math.max(this.S(t[2])-1.2,.6),c=Math.max(this.S(t[3])-1.2,.6);if(r+s<-20||r>this.VW+20||o+c<-20||o>this.VH+20)continue;a=$(`rect`,{x:r.toFixed(1),y:o.toFixed(1),width:s.toFixed(1),height:c.toFixed(1),rx:1.4,fill:this.tint(e),"fill-opacity":b&&!b.has(e)?.18:i===`d`?.8:.92,class:`hit`,stroke:`transparent`,"stroke-width":this.TOUCH?12:0,"pointer-events":`all`,"data-k":`f:`+e})}let o=$(`title`,{});o.textContent=`${n.F[e]}\n${io(n,e)} loc · churn ${so(n,e)} · cplx ${oo(n,e)}`,a.appendChild(o),l?.has(e)&&(a.tagName===`circle`?p.appendChild($(`circle`,{cx:a.getAttribute(`cx`),cy:a.getAttribute(`cy`),r:(Number(a.getAttribute(`r`))+.8).toFixed(2),fill:`none`,stroke:`var(--ink)`,"stroke-width":1.1,"pointer-events":`none`,"data-folder-highlight":e})):p.appendChild($(`rect`,{x:(Number(a.getAttribute(`x`))-.8).toFixed(1),y:(Number(a.getAttribute(`y`))-.8).toFixed(1),width:(Number(a.getAttribute(`width`))+1.6).toFixed(1),height:(Number(a.getAttribute(`height`))+1.6).toFixed(1),rx:2.4,fill:`none`,stroke:`var(--ink)`,"stroke-width":1.1,"pointer-events":`none`,"data-folder-highlight":e}))),p.appendChild(a)}let N=e=>{if(this.unconnectedFile[e])return null;let t=this.islandFadeForDistrict(V(n,e),h,g,w);if(!this.islandFadeVisible(t))return null;let r=this.anchor(e),i=this.X(r[0]),a=this.Y(r[1]);return i<-30||i>this.VW+30||a<-30||a>this.VH+30?null:[i,a]},te=this.hubCandidates(),ne=null,P=()=>{if(!ne){let e=[];for(let[t,n,r,i]of this.cardedFileBBox.values())e.push([t,n,r-t,i-n]);ne=OE(n,this.districtArea,N,this.k,h,a,[...f,...e])}return ne};if(D?(this.flushFootprintBatches(p,k,b,h,g,w),this.drawNeighbourhoodGutters(p,h,g,w,s),this.drawSymbolCardsPass(p,M,e.selHSym,f,()=>[...P().map(({cx:e,cy:t})=>[e-10,t-32,20,32]),...(te??[]).map(({cx:e,cy:t,r:n})=>[e-n-1,t-n-1,2*(n+1),2*(n+1)])],!0)):(this.cardLabelBoxes=[],this.symVisible=new Set,this.symScreenAnchor=new Map,this.symDecodedByDistrict=new Map,this.symLocalByGlobal=new Map),v&&a!=null){let e=this.anchor(a),t=this.X(e[0]),n=this.Y(e[1]);v.files.forEach(e=>{let r=this.anchor(e);p.appendChild($(`line`,{x1:this.X(r[0]).toFixed(1),y1:this.Y(r[1]).toFixed(1),x2:t.toFixed(1),y2:n.toFixed(1),stroke:`var(--hot)`,"stroke-width":1,"stroke-opacity":.34,"pointer-events":`none`}))}),v.files.forEach(e=>{let t=this.anchor(e);p.appendChild($(`circle`,{cx:this.X(t[0]).toFixed(1),cy:this.Y(t[1]).toFixed(1),r:4.6,fill:`none`,stroke:`var(--hot)`,"stroke-width":1.8,"stroke-opacity":.9,"pointer-events":`none`}))})}if(c){let e=c.path.map(e=>{let t=this.anchor(e);return[this.X(t[0]),this.Y(t[1])]});p.appendChild($(`polyline`,{points:e.map(e=>e[0].toFixed(1)+`,`+e[1].toFixed(1)).join(` `),fill:`none`,stroke:`var(--hot)`,"stroke-width":2.6,"stroke-linejoin":`round`,"stroke-linecap":`round`,"stroke-opacity":.92,"pointer-events":`none`})),e.forEach((t,n)=>p.appendChild($(`circle`,{cx:t[0].toFixed(1),cy:t[1].toFixed(1),r:n===0||n===e.length-1?6:3.6,fill:`var(--hot)`,stroke:`var(--canvas)`,"stroke-width":1.6,class:`hit`,"pointer-events":`all`,"data-k":`f:`+c.path[n]})))}if(y&&a!=null){let{shown:e}=this.getSelLinks(a),t=this.anchor(a),n=this.X(t[0]),r=this.Y(t[1]);for(let{j:t,dir:i}of e){let e=this.anchor(t);p.appendChild($(`line`,{x1:n.toFixed(1),y1:r.toFixed(1),x2:this.X(e[0]).toFixed(1),y2:this.Y(e[1]).toFixed(1),stroke:i===`out`?`var(--link-out)`:`var(--link-in)`,"stroke-width":1.4,"stroke-opacity":.55,"stroke-dasharray":i===`in`?`4 3`:`none`,"pointer-events":`none`}))}for(let{j:t,dir:n}of e)this.ring(p,t,n===`out`?`var(--link-out)`:`var(--link-in)`,m)}let re=[],F=[];re.push(...f),F=P();for(let{cx:e,cy:t}of F)re.push([e-10,t-32,20,32]);for(let{cx:e,cy:t,r:n}of te??[])re.push([e-n-1,t-n-1,2*(n+1),2*(n+1)]);re.push(...this.cardLabelBoxes);let I=$(`g`,{});this.placeDistrictLabels(I,A,g,w,re,d,!0);for(let[e,t,n,r]of this.cardedFileBBox.values())re.push([e,t,n-e,r-t]);F.forEach(({row:[e,t,r,i],cx:a,cy:o})=>{let s=this.islandFadeForDistrict(V(n,e),h,g,w),c={class:`hit`,"data-k":`f:`+e,"data-landmark-pin":e};s!==1&&(c.opacity=s.toFixed(3));let l=$(`g`,c);l.appendChild($(`path`,{d:`M ${a.toFixed(1)} ${o.toFixed(1)} l -8 -12 a 9.5 9.5 0 1 1 16 0 z`,fill:`var(--pin-fill)`,stroke:`var(--pin-ink)`,"stroke-width":1.25}));let u=$(`text`,{x:a.toFixed(1),y:(o-12.5).toFixed(1),"font-size":9.5,fill:`var(--pin-ink)`,"text-anchor":`middle`,"font-family":`IBM Plex Mono, monospace`,"font-weight":600});u.textContent=String(i),l.appendChild(u);let d=$(`title`,{});d.textContent=`${t} — ${n.F[e]}\n${r}`,l.appendChild(d),p.appendChild(l)}),a!=null&&!this.unconnectedFile[a]&&this.ring(p,a,`var(--hot)`,m);let ie=this.drawHubRings(p,te??void 0);if(p.appendChild(I),this.placeContentLabels(p,re,A,h,ie,d,!0,S,x),this.gSymRefs=$(`g`,{}),p.appendChild(this.gSymRefs),this.renderSymbolRefs(e.selHSym),this.drawLensComparison(p,h,I),this.drawLens(p,h,I),this.HOVER){this.keyElements.clear();for(let e of Array.from(t.querySelectorAll(`[data-k]`))){let t=e.getAttribute(`data-k`),n=this.keyElements.get(t);n||(n=[],this.keyElements.set(t,n)),n.push(e)}}if(this.HOVER&&this.hoverKey&&this.reapplyHover(),this.applyOverviewDistrictHighlight(),e.impactFiles?.length||e.impactDistricts?.length){let t=new Set(e.impactFiles),r=new Set(e.impactDistricts),i=$(`g`,{"pointer-events":`none`,"data-comparison-outlines":``});for(let e of Array.from(p.querySelectorAll(`path[data-k],rect[data-k],circle[data-k]`))){let[a,o]=(e.getAttribute(`data-k`)??``).split(`:`);if(!(a===`f`&&t.has(n.F[Number(o)]))&&!(a===`d`&&r.has(Number(o))))continue;let s=e.cloneNode(!1);s.removeAttribute(`data-k`),s.removeAttribute(`class`),s.setAttribute(`fill`,`none`),s.setAttribute(`stroke`,`var(--accent)`),s.setAttribute(`stroke-width`,`2`),s.setAttribute(`stroke-dasharray`,a===`d`?`6 4`:`none`),s.setAttribute(`pointer-events`,`none`),s.setAttribute(`data-impact`,a),i.appendChild(s)}p.appendChild(i)}}districtContains(e,t,n){let r=this.districtWorldBounds.get(e);if(!r||t<r[0]||n<r[1]||t>r[2]||n>r[3])return!1;for(let r of this.state.doc.districts[String(e)].blob){let e=!1;for(let i=0,a=r.length-1;i<r.length;a=i++){let[o,s]=r[i],[c,l]=r[a];s>n!=l>n&&t<(c-o)*(n-s)/(l-s)+o&&(e=!e)}if(e)return!0}return!1}desktopDistrictLabelSpot(e,t,n,r,i,a,o){let{doc:s}=this.state,c=this.districtWorldBounds.get(e);if(!c)return null;let[l,u,d,f]=c,p=lT(t,n,r?500:600),m=n*1.25,h=r?null:s.districts[String(e)].size+` files`,g=h?h.length*IE*.62:0,_=IE*1.25,v=(e,t,n,r)=>e>=0&&e+n<=this.VW&&t>=0&&t+r<=this.VH,y=(t,n)=>this.districtContains(e,(t-this.tx)/this.k,(n-this.ty)/this.k),b=(e,t,n)=>{let s=e-p/2,c=t-m;if(o&&!v(s,c,p,m)||a(s,c,p,m))return!1;if(n===0)return!0;if(r)return!i&&(s<this.X(l)||s+p>this.X(d))?!1:c>=this.Y(u)&&t<=this.Y(f);let h=t-m/2;if(!y(e,h))return!1;let g=y(e-p/4,h),_=y(e+p/4,h);return n===2?g&&_:g||_},x=(e,t,n)=>{if(!h)return!1;let r=e-g/2,i=t+RE-_;return o&&!v(r,i,g,_)||a(r,i,g,_)?!1:n===0||y(e,i+_/2)},S=[.5,.35,.65,.2,.8,.08,.92],C=e=>{let t=[];for(let n of e)for(let e of S)t.push([this.X(l+(d-l)*e),this.Y(u+(f-u)*n)]);return t},w=[this.X(s.districts[String(e)].c[0]),this.Y(s.districts[String(e)].c[1])],T=r?[{points:[w,...C(i?[.16,.3,.04,.42,.56,.72,.88]:[.16,.3,.04,.42])],fit:2}]:[{points:C([.16,.24,.08,.32,.4]),fit:2},{points:[w,...C([.5,.6,.7,.8,.9])],fit:2}],E=this.X(l),D=this.X(d),O=this.Y(u),k=this.Y(f);if(!r&&E>=0&&O>=0&&D<=this.VW&&k<=this.VH){let e=[],t=Math.min(60,Math.max(1,Math.floor((k-O)/6))),n=[7,6,8,5,9,4,10,3,11,2,12,1,13,0,14];for(let r=0;r<t;r++){let i=O+(k-O)*(r+.5)/t;for(let t of n)e.push([E+(D-E)*(t+.5)/15,i+m/2])}T.push({points:e,fit:1})}if(i){let e=Math.max(0,E),t=Math.min(this.VW,D),n=Math.max(0,O),r=Math.min(this.VH,k);if(t>e&&r>n){let i=[];for(let a=0;a<9;a++)for(let o=0;o<9;o++){let s=e+(t-e)*(o+.5)/9,c=n+(r-n)*(a+.5)/9;i.push({at:[s,c+m/2],distance:Math.hypot(s-(e+t)/2,c-(n+r)/2),index:i.length})}i.sort((e,t)=>e.distance-t.distance||e.index-t.index),T.push({points:i.map(({at:e})=>e),fit:2})}}let ee=(e,t)=>{let n=null;for(let[r,i]of e)if(b(r,i,t)){if(!h)return{at:[r,i],subtitle:!1};if(x(r,i,t))return{at:[r,i],subtitle:!0};n??={at:[r,i],subtitle:!1}}return n};for(let{points:e,fit:t}of T){let n=ee(e,t);if(n)return n}if(i)for(let{points:e}of T){let t=ee(e,0);if(t)return t}return null}placeDistrictLabels(e,t,n,r,i,a,o){let{doc:s,geo:c}=this.state,l=(e,t,n,r)=>i.some(i=>!(e+n<i[0]||e>i[0]+i[2]||t+r<i[1]||t>i[1]+i[3])),u=(t,n,r,s,c,u,d,f=!1)=>{let p=f?r.length*s*.62:lT(r,s,u??400),m=s*1.25;if(o&&(t-p/2<0||t+p/2>this.VW||n-m<0||n>this.VH)||l(t-p/2,n-m,p,m))return!1;i.push([t-p/2,n-m,p,m]);let h=$(`text`,{x:t.toFixed(1),y:n.toFixed(1),"font-size":s,"text-anchor":`middle`,fill:`var(--ink)`,"fill-opacity":c,"font-family":f?`IBM Plex Mono, monospace`:sT,"paint-order":`stroke`,stroke:`var(--canvas)`,"stroke-width":3.2,"stroke-linejoin":`round`,"data-label-box":p.toFixed(1)});return a&&(h.style.strokeWidth=`3.2px`,h.style.strokeOpacity=`1`,f&&(h.style.fillOpacity=`0.82`)),u&&h.setAttribute(`font-weight`,String(u)),d!=null&&(h.setAttribute(`class`,`hit`),h.setAttribute(`pointer-events`,`all`),h.setAttribute(`data-k`,`d:`+d)),h.textContent=r,e.appendChild(h),!0},d=kl(this.mapBoxW,this.mapBoxH),f=this.k/this.fitScale(),p=this.state.selD;p==null&&this.state.sel!=null&&(p=V(s,this.state.sel));let m=null;if(this.hoverKey){let e=/^d:(\d+)$/.exec(this.hoverKey),t=/^f:(\d+)$/.exec(this.hoverKey),n=/^hs:(\d+)$/.exec(this.hoverKey);if(e)m=Number(e[1]);else if(t&&s.N[Number(t[1])])m=V(s,Number(t[1]));else if(n){let e=this.symLocalByGlobal.get(Number(n[1])),t=e?.decoded.raw.symbols[e.local]?.[0];t!=null&&(m=V(s,t))}}let h=this.labelDistrictIds;if(a){let e=new Set(this.desktopLabelDistrictIds),t=new Set;h=[];let n=this.overviewDistricts?this.desktopLabelDistrictIds.filter(e=>this.overviewDistricts.has(Number(e))).map(Number):[];for(let r of[p,m,...n]){if(r==null)continue;let n=String(r);e.has(n)&&!t.has(n)&&(h.push(n),t.add(n))}for(let e of this.desktopLabelDistrictIds)t.has(e)||h.push(e)}else{let e=new Set(this.labelDistrictIds),t=[];for(let n of[p,m])n!=null&&e.has(String(n))&&!t.includes(String(n))&&t.push(String(n));t.length&&(h=[...t,...this.labelDistrictIds.filter(e=>!t.includes(e))])}for(let e of h){let i=B(s.districts[e])===`island`,m=i?this.islandFadeForDistrict(+e,f,n,r):1;if(i&&!this.islandFadeVisible(m))continue;let h=c===`t`?zo(s,+e):s.districts[e].c,g=this.X(h[0]),_=this.Y(h[1]),v=d?Math.min(13,Math.max(IE,10+f)):Math.min(17,Math.max(IE,12+f)),y=i?Math.max(IE,v*.75):v,b=p===+e,x=a?_:!i&&f>1?_-32:_,S=!1,C=!1;if(a&&c!==`t`){let t=this.desktopDistrictLabelSpot(+e,s.names[e],y,i,b,l,o);t&&([g,x]=t.at,S=u(g,x,s.names[e],y,(i?.5:.82)*m,i?500:600,+e),C=S&&t.subtitle)}else if(a){let t=b?[[0,0],[-28,0],[28,0],[-56,0],[56,0],[0,-18],[0,18],[0,-36],[0,36]]:[[0,0],[-24,0],[24,0],[0,-18],[0,18]],n=lT(s.names[e],y,i?500:600),r=y*1.25,a=t.map(([e,t])=>[g+e,_+t]).find(([e,t])=>{let i=[e-n/2,t-r,n,r];return(!o||i[0]>=0&&i[0]+i[2]<=this.VW&&i[1]>=0&&t<=this.VH)&&!l(...i)});a&&([g,x]=a,S=u(g,x,s.names[e],y,(i?.5:.82)*m,i?500:600,+e)),C=S}else{let t=lT(s.names[e],y,i?500:600),n=y*1.25,r=(r,i)=>{if(c===`t`)return!0;let a=i-n/2,o=t=>this.districtContains(+e,(t-this.tx)/this.k,(a-this.ty)/this.k);return o(r)&&(o(r-t/4)||o(r+t/4))},a=zE.map(([e,t])=>[g+e,x+t]).find(([e,i],a)=>{let o=[e-t/2,i-n,t,n];return o[0]<0||o[0]+o[2]>this.VW||o[1]<0||i>this.VH||l(...o)?!1:a===0||r(e,i)});!a&&b&&c!==`t`&&(a=this.desktopDistrictLabelSpot(+e,s.names[e],y,i,!0,l,!0)?.at),a&&([g,x]=a,S=u(g,x,s.names[e],y,(i?.5:.82)*m,i?500:600,+e))}let w=!a&&S&&!this.hasFootprints?this.hiddenFileCount(+e,t):0;a&&S&&C&&!i?u(g,x+RE,`${s.districts[e].size} files`,IE,.45,void 0,+e,!0):w>0?u(g,x+RE,`+${w} files`,IE,(i?.55:.7)*m,600,+e):!a&&f<1.8&&!d&&!i&&u(g,x+RE,s.districts[e].size+` files`,IE,.45,void 0,+e)}}declutterHubCandidates(e,t){let{doc:n}=this.state,r=[],i=new Map,a=new Map,o=e=>{let n=a.get(e);if(n==null){let r=(this.districtArea.get(e)??0)*this.k*this.k,i=Math.sqrt(Math.max(r,0));n=t?Math.max(1,Math.floor(i/100)):Math.max(3,Math.floor(i/50)),a.set(e,n)}return n};for(let a=0;a<e.length;a++){let s=e[a];if(!(!t&&a<12)){if(r.some(e=>Math.hypot(e.cx-s.cx,e.cy-s.cy)<e.r+s.r))continue;let e=V(n,s.hub.i);if((i.get(e)??0)>=o(e))continue}r.push(s);let c=V(n,s.hub.i);i.set(c,(i.get(c)??0)+1)}return r}hubCandidates(){let{hubs:e,maxFi:t}=this.hubSet,n=kl(this.mapBoxW,this.mapBoxH),r=[];for(let i of e){if(this.unconnectedFile[i.i])continue;let e=this.anchor(i.i),a=this.X(e[0]),o=this.Y(e[1]),s=tT(i.fi,t,n);a<-s-20||a>this.VW+s+20||o<-s-20||o>this.VH+s+20||r.push({hub:i,cx:a,cy:o,r:s})}return this.declutterHubCandidates(r,n)}drawHubRings(e,t=this.hubCandidates()){let{doc:n}=this.state;for(let{hub:r,cx:i,cy:a,r:o}of t){e.appendChild($(`circle`,{cx:i.toFixed(1),cy:a.toFixed(1),r:o.toFixed(2),fill:`none`,stroke:`var(--ink)`,"stroke-width":1.6,"pointer-events":`none`,"data-hub-ring":r.i})),e.appendChild($(`circle`,{cx:i.toFixed(1),cy:a.toFixed(1),r:1.6,fill:`var(--ink)`,"pointer-events":`none`}));let t=$(`circle`,{cx:i.toFixed(1),cy:a.toFixed(1),r:(o+(this.TOUCH?11:5)).toFixed(1),fill:`transparent`,class:`hit`,"pointer-events":`all`,"data-k":`f:`+r.i}),s=$(`title`,{});s.textContent=`${n.F[r.i]}\nhub · fan-in ${r.fi}`,t.appendChild(s),e.appendChild(t)}return t}placeHubLabels(e,t,n,r,i,a){if(n.length===0)return;let o=kl(this.mapBoxW,this.mapBoxH),s=(e,t,n,i)=>r.some(r=>!(e+n<r[0]||e>r[0]+r[2]||t+i<r[1]||t>r[1]+r[3])),c=t<1.3?0:t<2.2?8:Math.min(n.length,o?20:40),l=0;for(let{hub:t,cx:o,cy:u,r:d}of n){if(l>=c)break;let n=`${t.name} · ${t.fi}`,f=BE,p=n.length*f*.62,m=f*1.25,h=o+d+4,g=u+3.5;if(i){let e=[[h,g],[o-d-4-p,g],[o-p/2,u-d-5],[o-p/2,u+d+f+5]].find(([e,t])=>(!a||e>=4&&e+p<=this.VW-4&&t-m>=4&&t<=this.VH-4)&&!s(e,t-m,p,m));if(!e)continue;[h,g]=e}else if(s(h,g-m,p,m))continue;if(a&&(h<0||h+p>this.VW||g-m<0||g>this.VH))continue;r.push([h,g-m,p,m]);let _=$(`text`,{x:h.toFixed(1),y:g.toFixed(1),"font-size":f,"font-family":`IBM Plex Mono, monospace`,"font-weight":700,fill:`var(--ink)`,"paint-order":`stroke`,stroke:`var(--canvas)`,"stroke-width":3,"stroke-linejoin":`round`,"pointer-events":`none`,"data-label-box":p.toFixed(1)});_.textContent=n,e.appendChild(_),l++}}drawRoads(e){let{doc:t,lensRoads:n}=this.state,r=e=>[this.X(e[0]),this.Y(e[1])],i=new Map;for(let e of n??[]){let t=`${Math.min(e.from,e.to)}-${Math.max(e.from,e.to)}`;i.set(t,[...i.get(t)??[],e].sort((e,t)=>t.edges-e.edges||e.from-t.from))}let a=Math.max(1,...(n??[]).map(e=>e.edges)),o=[...this.roadPlan];for(let e of i.keys()){let n=this.roadFlows.get(e);n&&!o.some(e=>e.a===n.a&&e.b===n.b)&&o.push(Hw(t,n))}this.drawnRoads=o;for(let n of o){let o=t.districts[String(n.a)],s=t.districts[String(n.b)];if(!o||!s)continue;let c=i.get(`${n.a}-${n.b}`)?.[0],l=c?c.from===n.a:n.ab>=n.ba,u=l?o:s,d=l?s:o,f=l?n.raWorld:n.rbWorld,p=l?n.rbWorld:n.raWorld,m=Math.max(n.ab,n.ba),h=Math.min(n.ab,n.ba),g=!c&&m>0&&h/m>=.35,_=1.5+6*Math.sqrt(n.total/this.roadMaxTotal),v=Bw({a:u.c,b:d.c,ringsA:u.blob,ringsB:d.blob,raWorld:f,rbWorld:p,widthPx:_,bothDirections:g,k:this.k,toScreen:r}),y=`r:${n.a}:${n.b}`;if(e.appendChild($(`path`,{d:`M`+v.polygon.map(e=>e[0].toFixed(1)+` `+e[1].toFixed(1)).join(`L`)+`Z`,fill:c?`var(--lens-red)`:`var(--ink)`,"fill-opacity":c?(.3+.65*Math.sqrt(c.edges/a)).toFixed(3):.34,"pointer-events":`none`,...c?{"data-lens-cut-road":y,"data-lens-cut-edges":c.edges}:{},"data-k":y})),c){let t=v.chevrons[0],n=(t.back1[0]+t.back2[0])/2,r=(t.back1[1]+t.back2[1])/2,i=Math.hypot(t.tip[0]-n,t.tip[1]-r)||1,a=(t.tip[0]-n)/i,o=(t.tip[1]-r)/i,s=n+a*i*(.5/1.1),c=r+o*i*(.5/1.1),l=Math.max(_*2.2,14),u=`M${(s-a*l*.45-o*l*.6).toFixed(1)} ${(c-o*l*.45+a*l*.6).toFixed(1)}L${(s+a*l*.45).toFixed(1)} ${(c+o*l*.45).toFixed(1)}L${(s-a*l*.45+o*l*.6).toFixed(1)} ${(c-o*l*.45-a*l*.6).toFixed(1)}`,d=Math.max(2.5,l*.16);for(let[t,n]of[[`var(--canvas)`,d+3],[`var(--on)`,d]])e.appendChild($(`path`,{d:u,fill:`none`,stroke:t,"stroke-width":n.toFixed(2),"stroke-linecap":`round`,"stroke-linejoin":`round`,"pointer-events":`none`,...t===`var(--on)`?{"data-lens-cut-direction":y}:{}}))}for(let t of c?[]:v.chevrons)e.appendChild($(`path`,{d:`M${t.back1[0].toFixed(1)} ${t.back1[1].toFixed(1)}L${t.tip[0].toFixed(1)} ${t.tip[1].toFixed(1)}L${t.back2[0].toFixed(1)} ${t.back2[1].toFixed(1)}`,fill:`none`,stroke:`var(--canvas)`,"stroke-width":Math.max(_*.28,2.4).toFixed(2),"stroke-linecap":`round`,"stroke-linejoin":`round`,"pointer-events":`none`}));let b=$(`path`,{d:v.hitD,fill:`none`,stroke:`transparent`,"stroke-width":Math.max(_*1.2,12).toFixed(1),"stroke-linecap":`round`,class:`hit`,"pointer-events":`all`,"data-k":y}),x=t.names[String(n.a)]??`district ${n.a}`,S=t.names[String(n.b)]??`district ${n.b}`,C=$(`title`,{});C.textContent=`${x} → ${S}: ${n.ab} imports\n${S} → ${x}: ${n.ba} imports${c?`\nSuggested cut: ${t.names[String(c.from)]??`district ${c.from}`} → ${t.names[String(c.to)]??`district ${c.to}`}, ${c.edges} edges`:``}`,b.appendChild(C),e.appendChild(b)}}getStreetPlan(e){if(this.streetCache?.d===e)return this.streetCache;let{doc:t}=this.state,n={d:e,intra:jE(AE(t,e)),cross:PE(ME(t,e))};return this.streetCache=n,n}drawStreets(e,t){let{doc:n}=this.state;if(!n.neighbourhoods||!n.file_neighbourhoods)return;let r=this.getStreetPlan(t),i=e=>[this.X(e[0]),this.Y(e[1])],a=e=>e.blob.reduce((e,t)=>e+Lo(t),0),o=Math.max(1,...r.intra.map(e=>e.total));for(let t of r.intra){let r=n.neighbourhoods[t.a],s=n.neighbourhoods[t.b],c=this.neighbourhoodCentroid.get(t.a),l=this.neighbourhoodCentroid.get(t.b);if(!r||!s||!c||!l)continue;let u=t.ab>=t.ba,d=u?r:s,f=u?s:r,p=u?c:l,m=u?l:c,h=Math.max(t.ab,t.ba),g=Math.min(t.ab,t.ba),_=h>0&&g/h>=.35,v=.9+3*Math.sqrt(t.total/o),y=Bw({a:p,b:m,ringsA:d.blob,ringsB:f.blob,raWorld:Lw(a(d)),rbWorld:Lw(a(f)),widthPx:v,bothDirections:_,k:this.k,toScreen:i}),b=`st:n:${t.a}:${t.b}`;e.appendChild($(`path`,{d:`M`+y.polygon.map(e=>e[0].toFixed(1)+` `+e[1].toFixed(1)).join(`L`)+`Z`,fill:`var(--ink)`,"fill-opacity":.26,"pointer-events":`none`,"data-k":b}));for(let t of y.chevrons)e.appendChild($(`path`,{d:`M${t.back1[0].toFixed(1)} ${t.back1[1].toFixed(1)}L${t.tip[0].toFixed(1)} ${t.tip[1].toFixed(1)}L${t.back2[0].toFixed(1)} ${t.back2[1].toFixed(1)}`,fill:`none`,stroke:`var(--canvas)`,"stroke-width":Math.max(v*.3,2).toFixed(2),"stroke-linecap":`round`,"stroke-linejoin":`round`,"pointer-events":`none`}));let x=$(`path`,{d:y.hitD,fill:`none`,stroke:`transparent`,"stroke-width":Math.max(v*1.3,10).toFixed(1),"stroke-linecap":`round`,class:`hit`,"pointer-events":`all`,"data-k":b}),S=$(`title`,{});S.textContent=`${r.label} → ${s.label}: ${t.ab} imports\n${s.label} → ${r.label}: ${t.ba} imports`,x.appendChild(S),e.appendChild(x)}let s=Math.max(1,...r.cross.map(e=>e.total));for(let t of r.cross){let r=n.neighbourhoods[t.n],o=n.districts[String(t.d)],c=this.neighbourhoodCentroid.get(t.n);if(!r||!o||!c)continue;let l=Bw({a:c,b:o.c,ringsA:r.blob,ringsB:o.blob,raWorld:Lw(a(r)),rbWorld:Lw(Ro(o)),widthPx:.8+2*Math.sqrt(t.total/s),bothDirections:!1,k:this.k,toScreen:i}),u=`st:c:${t.n}:${t.d}`;e.appendChild($(`path`,{d:l.hitD,fill:`none`,stroke:`var(--ink)`,"stroke-width":1.1,"stroke-opacity":.32,"stroke-dasharray":`5 4`,"pointer-events":`none`}));let d=$(`path`,{d:l.hitD,fill:`none`,stroke:`transparent`,"stroke-width":12,class:`hit`,"pointer-events":`all`,"data-k":u}),f=$(`title`,{}),p=n.names[String(t.d)]??`district ${t.d}`;f.textContent=`${r.label} → ${p}: ${t.out} imports\n${p} → ${r.label}: ${t.in} imports`,d.appendChild(f),e.appendChild(d)}}footprint(e,t,n,r,i,a,o){let{doc:s,sel:c,layer:l}=this.state,u=s.P[String(t)],d=V(s,t),f=this.islandFadeForDistrict(d,r,i,a);if(!this.islandFadeVisible(f))return!1;let p=`M`,m=1e9,h=1e9,g=-1e9,_=-1e9;for(let e=0;e<u.length;e++){let t=this.X(u[e][0]),n=this.Y(u[e][1]);p+=(e?`L`:``)+t.toFixed(1)+` `+n.toFixed(1),t<m&&(m=t),t>g&&(g=t),n<h&&(h=n),n>_&&(_=n)}if(p+=`Z`,g<-20||m>this.VW+20||_<-20||h>this.VH+20)return!1;let v=!(!n||n.has(t)),y=s.file_neighbourhoods?.[t],b=y==null?null:this.neighbourhoodShade.get(y)??null,x=l===`d`?Po(s,d,b):this.tint(t),S=v?.2:.85,C=this.anchor(t),w=this.X(C[0]),T=this.Y(C[1]),E=$(`path`,{"data-cx":w.toFixed(1),"data-cy":T.toFixed(1),d:p,fill:x,"fill-opacity":f===1?S:Math.round(S*f*1e3)/1e3,stroke:`var(--canvas)`,"stroke-width":.7,"stroke-opacity":v?.35:.85,"stroke-linejoin":`round`,class:`hit`,"pointer-events":`all`,"data-k":`f:`+t,"data-footprint-cell":t,"data-footprint-district":d,"data-footprint-shade":b??`none`}),D=$(`title`,{});return D.textContent=`${s.F[t]}\n${io(s,t)} loc · churn ${so(s,t)} · cplx ${oo(s,t)}`,E.appendChild(D),e.appendChild(E),c===t&&e.appendChild($(`path`,{d:p,fill:`none`,stroke:`var(--hot)`,"stroke-width":2.2,"pointer-events":`none`})),o?.has(t)&&e.appendChild($(`path`,{d:p,fill:`none`,stroke:`var(--ink)`,"stroke-width":1.4,"pointer-events":`none`,"data-folder-highlight":t})),!0}batchFootprint(e,t,n,r,i,a){let{doc:o}=this.state,s=this.islandFadeForDistrict(n,r,i,a);if(!this.islandFadeVisible(s))return;let c=o.P[String(t)],l=`M`,u=1e9,d=1e9,f=-1e9,p=-1e9;for(let e=0;e<c.length;e++){let t=this.X(c[e][0]),n=this.Y(c[e][1]);l+=(e?`L`:``)+t.toFixed(1)+` `+n.toFixed(1),t<u&&(u=t),t>f&&(f=t),n<d&&(d=n),n>p&&(p=n)}if(l+=`Z`,f<-20||u>this.VW+20||p<-20||d>this.VH+20)return;let m=o.file_neighbourhoods?.[t],h=m==null?null:this.neighbourhoodShade.get(m)??null,g=`${n}:${h??`x`}`,_=e.get(g);_||(_={d:n,shade:h,parts:[]},e.set(g,_)),_.parts.push(l)}flushFootprintBatches(e,t,n,r,i,a){let{doc:o}=this.state,s=n!=null,c=s?.2:.85;for(let[n,{d:l,shade:u,parts:d}]of t){if(d.length===0)continue;let t=this.islandFadeForDistrict(l,r,i,a);e.appendChild($(`path`,{d:d.join(``),fill:Po(o,l,u),"fill-opacity":Math.round(c*t*1e3)/1e3,stroke:`var(--canvas)`,"stroke-width":.7,"stroke-opacity":Math.round((s?.35:.85)*t*1e3)/1e3,"stroke-linejoin":`round`,"pointer-events":`none`,"data-footprint-batch":n,"data-footprint-district":l,"data-footprint-shade":u??`none`}))}}static LARGE_FOOTPRINT_PX=24;districtFootprintsLarge(t){let n=this.districtMedianArea.get(t);return!n||n<=0||Math.sqrt(n)*this.k>=e.LARGE_FOOTPRINT_PX}drawNeighbourhoodGutters(e,t,n,r,i){let{doc:a}=this.state;if(!a.neighbourhoods)return;let o=new Map;for(let[e,t]of Object.entries(a.neighbourhoods))o.has(t.d)||o.set(t.d,[]),o.get(t.d).push(e);let s=e=>`M`+e.map(e=>this.X(e[0]).toFixed(1)+` `+this.Y(e[1]).toFixed(1)).join(`L`)+`Z`;for(let[c,l]of o){let o=a.districts[String(c)];if(!o||B(o)===`unconnected`)continue;let u=B(o)===`island`,d=u?this.islandFadeForDistrict(c,t,n,r):1;if(!u||this.islandFadeVisible(d)){if(c===i)for(let t of l){let n=a.neighbourhoods[t],r=``;for(let e of n.blob)e.length>=3&&(r+=s(e));r&&(e.appendChild($(`path`,{d:r,fill:`none`,stroke:`var(--canvas)`,"stroke-width":3.2,"stroke-opacity":.9*d,"stroke-linejoin":`round`,"pointer-events":`none`})),e.appendChild($(`path`,{d:r,fill:`none`,stroke:`var(--ink)`,"stroke-width":.7,"stroke-opacity":.35*d,"stroke-linejoin":`round`,"pointer-events":`none`,"data-k":`n:`+t})))}else{let t=``;for(let e of l){let n=a.neighbourhoods[e];for(let e of n.blob)e.length>=3&&(t+=s(e))}if(!t)continue;e.appendChild($(`path`,{d:t,fill:`none`,stroke:`var(--canvas)`,"stroke-width":3.2,"stroke-opacity":.9*d,"stroke-linejoin":`round`,"pointer-events":`none`})),e.appendChild($(`path`,{d:t,fill:`none`,stroke:`var(--ink)`,"stroke-width":.7,"stroke-opacity":.3*d,"stroke-linejoin":`round`,"pointer-events":`none`}))}}}}placeNeighbourhoodLabels(e,t,n,r){let{doc:i}=this.state;if(!i.neighbourhoods)return;let a=(e,n,r,i)=>t.some(t=>!(e+r<t[0]||e>t[0]+t[2]||n+i<t[1]||n>t[1]+t[3])),o=(n,i,o,s,c)=>{let l=lT(o,s,400),u=s*1.25;if(r&&(n-l/2<0||n+l/2>this.VW||i-u<0||i>this.VH)||a(n-l/2,i-u,l,u))return;t.push([n-l/2,i-u,l,u]);let d=$(`text`,{x:n.toFixed(1),y:i.toFixed(1),"font-size":s,"text-anchor":`middle`,fill:`var(--ink)`,"fill-opacity":.85,"font-family":sT,"paint-order":`stroke`,stroke:`var(--canvas)`,"stroke-width":3,"stroke-linejoin":`round`,class:`hit`,"pointer-events":`all`,"data-k":`n:`+c,"data-neighbourhood-label":c,"data-label-box":l.toFixed(1)});d.textContent=o,e.appendChild(d)},s=Object.keys(i.neighbourhoods).sort((e,t)=>i.neighbourhoods[t].size-i.neighbourhoods[e].size||(e<t?-1:+(e>t)));for(let e of s){let t=i.neighbourhoods[e];if(n!=null){if(t.d!==n||t.size<6)continue}else{if(t.size<4)continue;let[e,n,r,i]=Ya(t.blob);if(Math.min(r-e,i-n)*this.k<120)continue}let r=this.neighbourhoodCentroid.get(e);if(!r)continue;let a=this.X(r[0]),s=this.Y(r[1]);a<0||a>this.VW||s<0||s>this.VH||o(a,s,t.label,IE,e)}}refreshDecodedSymbols(e,t){this.symDecodedByDistrict=new Map,this.symLocalByGlobal=new Map;for(let[t,n]of e){let e=this.symDecoded.get(n);e||(e=JT(n),this.symDecoded.set(n,e)),this.symDecodedByDistrict.set(t,e);for(let t=0;t<n.symbols.length;t++)this.symLocalByGlobal.set(n.symbol_indices[t],{decoded:e,local:t})}for(let n of t)e.has(n)||this.symAsked.has(n)||(this.symAsked.add(n),this.callbacks.onNeedSymbols(n))}drawSymbolCardsPass(e,t,n,r=null,i=null,a=!1){let{doc:o}=this.state,s=new Set(t.map(e=>V(o,e)));if(this.refreshDecodedSymbols(this.state.districtSymbols,s),this.symVisible=new Set,this.symScreenAnchor=new Map,this.cardedFileBBox=new Map,this.cardLabelBoxes=[],t.length===0)return;let c=new Set;if(n!=null){let e=this.symLocalByGlobal.get(n);if(e){c.add(n);for(let t of ZT(e.decoded,e.local))c.add(e.decoded.raw.symbol_indices[t])}}let l=this.hoverKey?.startsWith(`hs:`)?Number(this.hoverKey.slice(3)):null,u=$(`g`,{});e.appendChild(u);let d=$(`g`,{}),f=[],p=e=>f.some(t=>!(e[0]+e[2]<t[0]||e[0]>t[0]+t[2]||e[1]+e[3]<t[1]||e[1]>t[1]+t[3])),m=null,h=e=>{if(!a)return!1;let t=t=>!(e[0]+e[2]<t[0]||e[0]>t[0]+t[2]||e[1]+e[3]<t[1]||e[1]>t[1]+t[3]);return e[0]<0||e[1]<0||e[0]+e[2]>this.VW||e[1]+e[3]>this.VH||r?.some(t)?!0:(m||=i?i():[],m.some(t))},g=[],_=[],v=[],y=e=>e.map(([e,t],n)=>(n?`L`:`M`)+this.X(e).toFixed(1)+` `+this.Y(t).toFixed(1)).join(``)+`Z`,b=(e,t)=>$(`path`,{d:e.map(y).join(` `),"fill-rule":`evenodd`,...t});for(let e of t){let t=V(o,e),n=this.symDecodedByDistrict.get(t);if(!n)continue;let r=this.tint(e),i=n.moduleRings.get(e);if(i){let[e,t,n,a]=KT(i),o=Math.abs(this.X(n)-this.X(e)),s=Math.abs(this.Y(a)-this.Y(t));Math.min(o,s)>=14&&u.appendChild(b([i[0]],{fill:`color-mix(in srgb, var(--canvas) ${Math.round((1-iE)*100)}%, ${r} ${Math.round(iE*100)}%)`,stroke:`var(--dim)`,"stroke-width":.8,"stroke-dasharray":`4 3`,"pointer-events":`none`}))}let a=n.topByFile.get(e)??[],s=o.P[String(e)];if(s){let t=1/0,n=-1/0,r=1/0,i=-1/0;for(let[e,a]of s){let o=this.X(e),s=this.Y(a);o<t&&(t=o),o>n&&(n=o),s<r&&(r=s),s>i&&(i=s)}_.push({cx:(t+n)/2,y0:r,widthPx:n-t,name:o.F[e].split(`/`).pop()}),this.cardedFileBBox.set(e,[t,r,n,i])}let d=(e,t)=>{let i=n.cardRings[e];if(!i||i.length===0)return null;let a=n.raw.symbol_indices[e],o=n.raw.symbols[e],s=LT(o),u=i[0],[f,p,m,h]=GT(u),_=this.X(f),v=this.X(m),y=this.Y(p),b=this.Y(h),x=Math.abs(v-_),S=Math.abs(b-y),C=Math.min(x,S);if(C<8)return null;let w=c.has(a),T=a===l,E=n.children[e],D=XT(E.length>0,C,w),O=E.length,k=$T(o,O,!D&&O>0),ee=[];if(D)for(let e of E){let n=d(e,t+1);n&&ee.push(n)}let A=qT(u),j={local:e,global:a,depth:t,kind:s,rings:i,area:x*S,centroid:A,expanded:D,memberCount:O,label:k,bold:eE(s),isException:w||T,children:ee,decoded:n,fileColor:r,won:!1,isDrawn:!1};return g.push({node:j,depth:t,area:j.area,x:(_+v)/2,y:D?Math.min(y,b)+12:this.Y(A[1]),text:k,bold:j.bold}),j},f=[];for(let e of a){let t=d(e,0);t&&f.push(t)}v.push({poly:s,roots:f})}_.sort((e,t)=>t.widthPx-e.widthPx);for(let e of _){let t=BE,n=e.name.length*t*.62,r=Math.max(70,Math.min(n,90));if(e.widthPx<r)continue;let i=[e.cx-n/2-5,e.y0-t-6,n+10,20];if(p(i)||h(i))continue;f.push(i),d.appendChild($(`rect`,{x:i[0],y:i[1],width:i[2],height:i[3],rx:3,fill:`var(--chrome)`,"fill-opacity":.92,stroke:`var(--dim)`,"stroke-width":.6,"pointer-events":`none`}));let a=$(`text`,{x:e.cx,y:e.y0-3,"text-anchor":`middle`,"font-size":t,"font-family":`IBM Plex Mono, monospace`,fill:`var(--on)`,"pointer-events":`none`,"data-label-box":n.toFixed(1),"data-symbol-card-label":``});a.textContent=e.name,d.appendChild(a)}g.sort((e,t)=>e.depth-t.depth||t.area-e.area);for(let e of g){if(!nE(e.text,e.bold,e.area))continue;let t=e.bold?11.5:Math.min(11,Math.max(8.5,Math.sqrt(Math.max(e.area,1))/7)),n=e.text.length*t*.62,r=[e.x-n/2-2,e.y-t*.85,n+4,t*1.3];if(p(r)||h(r))continue;f.push(r),e.node.won=!0;let i=$(`text`,{x:e.x,y:e.y,"text-anchor":`middle`,"font-size":t,"font-family":`IBM Plex Mono, monospace`,"font-weight":e.bold?700:500,fill:`var(--ink)`,"paint-order":`stroke`,stroke:`var(--canvas)`,"pointer-events":`none`,"data-label-for":e.node.global});i.style.strokeWidth=`2.6px`,i.textContent=e.text,d.appendChild(i)}this.cardLabelBoxes=f;let x=e=>{let t=!1;for(let n of e.children)x(n)&&(t=!0);return e.isDrawn=e.isException||e.won||t,e.isDrawn};for(let e of v)for(let t of e.roots)x(t);let S=e=>{this.symVisible.add(e.global),this.symScreenAnchor.set(e.global,[this.X(e.centroid[0]),this.Y(e.centroid[1])]);let t=rE(e.depth),n=[e.rings[0]];if(u.appendChild(b(n,{fill:`color-mix(in srgb, var(--canvas) ${Math.round((1-t)*100)}%, ${e.fileColor} ${Math.round(t*100)}%)`,stroke:`var(--ink)`,"stroke-width":e.kind===0?1.1:.7,"stroke-opacity":.45,...tE(e.kind)?{"stroke-dasharray":`3 2`}:{},class:`hit`,"pointer-events":`all`,"data-k":`hs:`+e.global,"data-sym":e.global})),this.state.selHSym===e.global&&u.appendChild($(`path`,{d:y(n[0]),fill:`none`,stroke:`var(--hot)`,"stroke-width":1.8,"pointer-events":`none`})),e.expanded&&e.memberCount>0){let n=e.decoded.headerRings.get(e.local);n&&u.appendChild(b(n,{fill:`color-mix(in srgb, var(--canvas) ${Math.round((1-Math.min(1,t+.15))*100)}%, ${e.fileColor} ${Math.round(Math.min(1,t+.15)*100)}%)`,"pointer-events":`none`}))}};for(let e of g)e.node.isDrawn&&S(e.node);for(let e of v)e.poly&&u.appendChild($(`path`,{d:y(e.poly),fill:`none`,stroke:`var(--ink)`,"stroke-width":1.6,"stroke-opacity":.55,"pointer-events":`none`}));e.appendChild(d)}renderSymbolRefs(e){if(!this.gSymRefs)return;this.gSymRefs.replaceChildren();let t=(this.hoverKey?.startsWith(`hs:`)?Number(this.hoverKey.slice(3)):null)??e,n=t==null?void 0:this.symLocalByGlobal.get(t);if(this.gRoadsFade&&(this.gRoadsFade.style.opacity=n?`0.12`:``),!n)return;let{decoded:r,local:i}=n,{out:a,in:o}=sE(r,i,this.symVisible),s=this.symScreenAnchor.get(t)??(()=>{let e=fo(this.state.doc,this.state.geo,r.raw.symbols[i][0]);return[this.X(e[0]),this.Y(e[1])]})(),c=e=>{let t=Number(e.slice(2));if(e.startsWith(`s:`)){let e=this.symScreenAnchor.get(t);if(e)return e;let n=this.symLocalByGlobal.get(t);if(!n)return null;let i=fo(this.state.doc,this.state.geo,r.raw.symbols[n.local][0]);return[this.X(i[0]),this.Y(i[1])]}let n=fo(this.state.doc,this.state.geo,t);return[this.X(n[0]),this.Y(n[1])]},l=(e,t,n)=>{let r=c(e);if(!r)return;let i=uE(t);this.gSymRefs.appendChild($(`path`,{d:`M${s[0].toFixed(1)} ${s[1].toFixed(1)} L${r[0].toFixed(1)} ${r[1].toFixed(1)}`,fill:`none`,stroke:n?`var(--link-out)`:`var(--link-in)`,"stroke-width":i,"stroke-dasharray":n?`none`:`5 3`,"pointer-events":`none`,"data-symref":n?`out`:`in`,"data-symref-target":e})),this.gSymRefs.appendChild($(`circle`,{cx:r[0].toFixed(1),cy:r[1].toFixed(1),r:e.startsWith(`f:`)?3.4:2.6,fill:n?`var(--link-out)`:`var(--link-in)`,"pointer-events":`none`,"data-symref-dot":e}))};for(let[e,t]of lE(a,120))l(e,t,!0);for(let[e,t]of lE(o,120))l(e,t,!1);for(let e of cE(r,i,this.symVisible))this.drawInheritanceLine(s,c(e.key),e);this.gSymRefs.appendChild($(`circle`,{cx:s[0].toFixed(1),cy:s[1].toFixed(1),r:3.6,fill:`var(--ink)`,stroke:`var(--canvas)`,"stroke-width":1.4,"pointer-events":`none`}))}drawInheritanceLine(e,t,n){if(!t||!this.gSymRefs)return;let r=n.kind===`overrides`;if(this.gSymRefs.appendChild($(`path`,{d:`M${e[0].toFixed(1)} ${e[1].toFixed(1)} L${t[0].toFixed(1)} ${t[1].toFixed(1)}`,fill:`none`,stroke:`var(--ink)`,"stroke-width":r?1.1:1.5,"stroke-opacity":.7,"stroke-dasharray":r?`3 2`:`none`,"pointer-events":`none`,"data-edge-kind":n.kind,"data-symref-target":n.key})),r)return;let i=n.isOut?t:e,a=n.isOut?e:t;this.gSymRefs.appendChild(VE(i,a))}hoverSymbol(e){if(e==null){this.hoverKey?.startsWith(`hs:`)&&this.setHover(null);return}this.setHover(`hs:`+e)}placeContentLabels(e,t,n,r,i,a,o,s,c){let{doc:l,geo:u}=this.state,d=(e,n,r,i)=>t.some(t=>!(e+r<t[0]||e>t[0]+t[2]||n+i<t[1]||n>t[1]+t[3])),f=(n,r,i,a,s,c,l,u)=>{let f=i.length*a*.62,p=a*1.25;if(o&&(n-f/2<0||n+f/2>this.VW||r-p<0||r>this.VH)||d(n-f/2,r-p,f,p))return!1;t.push([n-f/2,r-p,f,p]);let m=$(`text`,{x:n.toFixed(1),y:r.toFixed(1),"font-size":a,"text-anchor":`middle`,fill:`var(--ink)`,"fill-opacity":s,"font-family":`IBM Plex Mono, monospace`,"paint-order":`stroke`,stroke:`var(--canvas)`,"stroke-width":3.2,"stroke-linejoin":`round`,"data-label-box":f.toFixed(1)});return c&&m.setAttribute(`font-weight`,String(c)),l==null?u!=null&&(m.setAttribute(`class`,`hit`),m.setAttribute(`pointer-events`,`all`),m.setAttribute(`data-k`,`f:`+u)):(m.setAttribute(`class`,`hit`),m.setAttribute(`pointer-events`,`all`),m.setAttribute(`data-k`,`d:`+l)),u!=null&&m.setAttribute(`data-file-label`,String(u)),m.textContent=i,e.appendChild(m),!0},p=kl(this.mapBoxW,this.mapBoxH),m=this.k/this.fitScale();if(m>1)for(let n of this.state.folderLabels){if(this.state.activeDirectory&&this.state.activeDirectory!==n.path||n.worldSide*this.k<Math.min(this.VW,this.VH)*.25)continue;let r=this.X(n.x),i=this.Y(n.y),s=BE,c=s*1.25,l=a?[[0,0]]:[[0,0],[0,-16],[0,16],[-20,0],[20,0],[0,-32],[0,32],[-40,0],[40,0],[-20,-16],[20,-16],[-20,16],[20,16],[0,-48],[0,48],[-60,0],[60,0]],f=null;for(let e of[n.longText,n.shortText]){let t=e.length*s*.62;for(let[s,p]of l){let l=r+s,m=i+p,h=[l-t/2,m-c,t,c],g=!o||l>=t/2&&l<=this.VW-t/2&&m>=c&&m<=this.VH,_=a||u===`t`||this.districtContains(+n.district,(l-this.tx)/this.k,(m-c/2-this.ty)/this.k);if(g&&_&&!d(h[0],h[1],h[2],h[3])){f={text:e,x:l,y:m,width:t,box:h};break}}if(f)break}if(!f)continue;t.push(f.box);let p=$(`text`,{x:f.x.toFixed(1),y:f.y.toFixed(1),"font-size":s,"text-anchor":`middle`,fill:`var(--ink)`,"fill-opacity":.95,"font-weight":500,"font-family":`IBM Plex Mono, monospace`,"pointer-events":`all`,"data-k":`dir:${n.path}`,"data-folder-label":n.path,"data-folder-district":n.district,"data-label-box":f.width.toFixed(1)});p.textContent=f.text,e.appendChild(p)}if(this.placeHubLabels(e,r,i,t,a,o),this.hasFootprints&&this.placeNeighbourhoodLabels(e,t,this.state.selD,o),u===`p`&&m>5.2)return;let h=Math.round(Math.min(p?18:60,Math.max(0,(m-1.5)*(p?10:26))));if(h>0){let e=new Set,t=0;for(let r of this.fileLabelOrder){if(t>=h)break;if(this.unconnectedFile[r]||a&&u!==`t`&&!s.has(V(l,r))&&!c.has(r)||!this.hasFootprints&&u!==`t`&&!n.has(r)&&this.dotFactor(r)<=0)continue;let i=this.fileBasenames[r],d=`${V(l,r)}\0${i}`;if(this.repeatedBasenames.has(d)&&e.has(d))continue;let p=this.anchor(r),m=this.X(p[0]),g=this.Y(p[1]);if(!(o&&(m<10||m>this.VW-10||g<14||g>this.VH-6))){if(o){let e=i.length*BE*.62/2;if(m-e<0||m+e>this.VW||g-9-BE*1.25<0)continue}f(m,g-9,i,BE,.82,void 0,void 0,r)&&(t++,this.repeatedBasenames.has(d)&&e.add(d))}}}}getSelLinks(e){if(this.linkCache?.sel===e)return this.linkCache.result;let t=Xw(this.state.doc,this.outAdj,this.inAdj,e,40);return this.linkCache={sel:e,result:t},t}ring(e,t,n=`var(--hot)`,r=this.fitScale()){let{doc:i,geo:a}=this.state,o=this.anchor(t);if(a!==`t`)e.appendChild($(`circle`,{cx:this.X(o[0]).toFixed(1),cy:this.Y(o[1]).toFixed(1),r:(4+5.2*Math.sqrt(io(i,t)/this.maxLoc)*Math.sqrt(this.k/r)+3).toFixed(1),fill:`none`,stroke:n,"stroke-width":2.3,"pointer-events":`none`,"data-ring-for":`f:`+t}));else{let r=lo(i,t);e.appendChild($(`rect`,{x:(this.X(r[0])-2.5).toFixed(1),y:(this.Y(r[1])-2.5).toFixed(1),width:(this.S(r[2])+3).toFixed(1),height:(this.S(r[3])+3).toFixed(1),rx:3,fill:`none`,stroke:n,"stroke-width":2.3,"pointer-events":`none`}))}}plot(e,t,n,r,i){let{doc:a,sel:o,selSym:s,layer:c}=this.state,l=a.P[String(n)],u=!(!r||r.has(n)),d=`M`,f=1e9,p=1e9,m=-1e9,h=-1e9;for(let e=0;e<l.length;e++){let t=this.X(l[e][0]),n=this.Y(l[e][1]);d+=(e?`L`:``)+t.toFixed(1)+` `+n.toFixed(1),t<f&&(f=t),t>m&&(m=t),n<p&&(p=n),n>h&&(h=n)}d+=`Z`;let g=Mo(a,V(a,n)),_=po(a,n),v=i&&_.length>0&&m-f>26&&h-p>20;if(e.appendChild($(`path`,{d,fill:v?`var(--canvas)`:this.tint(n),"fill-opacity":u?.12:v?.96:c===`d`?.5:.82,stroke:g,"stroke-width":v?1.1:.8,"stroke-opacity":u?.2:.55,"stroke-linejoin":`round`,class:`hit`,"pointer-events":`all`,"data-k":`f:`+n})),!v){o===n&&e.appendChild($(`path`,{d,fill:`none`,stroke:`var(--hot)`,"stroke-width":2.2,"pointer-events":`none`}));return}let y=`cp`+n,b=$(`clipPath`,{id:y});b.appendChild($(`path`,{d})),t.appendChild(b);let x=$(`g`,{"clip-path":`url(#`+y+`)`});e.appendChild(x);let S=m-f,C=h-p;if(Io(Fo(_,io(a,n)),S,C).forEach(e=>{let t=e.sm?_.indexOf(e.sm):-1,r=o===n&&e.sm!=null&&s===t,i=$(`rect`,{x:(f+e.x).toFixed(1),y:(p+e.y).toFixed(1),width:Math.max(.6,e.w-1).toFixed(1),height:Math.max(.6,e.h-1).toFixed(1),fill:e.sm?Nw[e.sm[1]]||`var(--room-fallback)`:g,"fill-opacity":u?.14:e.sm?r?1:.6:.09,class:e.sm?`hit`:``,"pointer-events":e.sm?`all`:`none`,...e.sm?{"data-k":`s:`+n+`:`+t}:{}});if(e.sm){let t=$(`title`,{});t.textContent=`${e.sm[0]} (${Mw[e.sm[1]]})\n${a.F[n]}:${e.sm[2]}-${e.sm[3]}`,i.appendChild(t)}if(x.appendChild(i),r&&x.appendChild($(`rect`,{x:(f+e.x).toFixed(1),y:(p+e.y).toFixed(1),width:Math.max(.6,e.w-1).toFixed(1),height:Math.max(.6,e.h-1).toFixed(1),fill:`none`,stroke:`var(--hot)`,"stroke-width":1.8})),e.sm&&!u&&e.w>36&&e.h>12){let t=e.sm[0].split(`.`).pop(),n=Math.floor((e.w-6)/5.4);if(n>=3){let r=$(`text`,{x:(f+e.x+e.w/2).toFixed(1),y:(p+e.y+e.h/2+3.2).toFixed(1),"font-size":8.5,"text-anchor":`middle`,fill:`var(--room-label-ink)`,"fill-opacity":.95,"font-family":`IBM Plex Mono, monospace`,"pointer-events":`none`});r.textContent=t.length>n?t.slice(0,n-1)+`…`:t,x.appendChild(r)}}}),e.appendChild($(`path`,{d,fill:`none`,stroke:o===n?`var(--hot)`:g,"stroke-width":o===n?2.4:1.8,"stroke-opacity":o===n?1:.92,"stroke-linejoin":`round`,"pointer-events":`none`})),S>44&&C>26){let t=$(`text`,{x:((f+m)/2).toFixed(1),y:(p+10).toFixed(1),"font-size":9,"text-anchor":`middle`,fill:`var(--ink)`,"fill-opacity":u?.3:.9,"font-family":`IBM Plex Mono, monospace`,"paint-order":`stroke`,stroke:`var(--canvas)`,"stroke-width":3.4,"stroke-linejoin":`round`,"pointer-events":`none`,"font-weight":600});t.textContent=a.F[n].split(`/`).pop(),e.appendChild(t)}}preview(){this.previewRaf??=requestAnimationFrame(()=>{if(this.previewRaf=null,!this.rootG)return;let e=this.k/this.drawnK,t=this.tx-this.drawnTx*e,n=this.ty-this.drawnTy*e;this.rootG.setAttribute(`transform`,`translate(${t.toFixed(2)} ${n.toFixed(2)}) scale(${e.toFixed(4)})`),this.svg.classList.add(`previewing`)})}driftExceeded(){if(!this.rootG)return!0;let t=this.k/this.drawnK;if(t<e.DRIFT_ZOOM_LO||t>e.DRIFT_ZOOM_HI)return!0;let n=Math.abs(this.tx-this.drawnTx),r=Math.abs(this.ty-this.drawnTy);return n>this.VW*e.DRIFT_PAN_FRACTION||r>this.VH*e.DRIFT_PAN_FRACTION}gestureFrame(){this.HOVER&&this.clearHover();let t=performance.now();this.driftExceeded()&&t-this.lastDriftRedraw>e.DRIFT_REDRAW_MS?(this.lastDriftRedraw=t,this.previewRaf!=null&&(cancelAnimationFrame(this.previewRaf),this.previewRaf=null),this.draw()):this.preview(),this.scheduleSettle()}scheduleSettle(){this.settleTimer!=null&&clearTimeout(this.settleTimer),this.settleTimer=setTimeout(()=>{this.settleTimer=null,this.draw()},e.SETTLE_MS)}cancelPendingGestureWork(){this.settleTimer!=null&&(clearTimeout(this.settleTimer),this.settleTimer=null),this.previewRaf!=null&&(cancelAnimationFrame(this.previewRaf),this.previewRaf=null)}static IMPORT_PREVIEW_DELAY_MS=150;hoverMove(e){if(e.pointerType!==`mouse`||this.gestures.active||this.svg.classList.contains(`previewing`)){this.clearHover();return}let t=this.resolveKey(e.target,e.clientX,e.clientY);t!==this.hoverKey&&this.setHover(t),this.hoverCard.positionCard(e.clientX,e.clientY,e.target,this.keyElements)}isSelectionLinksTarget(e){let t=this.state;return!!t&&t.sel===e&&t.selSym==null&&!t.route}setHover(t){(this.hoverKey?.startsWith(`dir:`)||t?.startsWith(`dir:`))&&this.callbacks.onPreviewDirectory(t?.startsWith(`dir:`)?t.slice(4):void 0);for(let e of this.hoverEls)e.classList.remove(`hovered`);this.hoverImportTimer!=null&&(clearTimeout(this.hoverImportTimer),this.hoverImportTimer=null),this.clearImportPreview();let n=this.hoverKey;if(this.hoverKey=t,this.hoverEls=t?this.keyElements.get(t)??[]:[],(n?.startsWith(`hs:`)||t?.startsWith(`hs:`))&&this.renderSymbolRefs(this.state?.selHSym??null),t?.startsWith(`r:`)){let[,e,n]=t.split(`:`);this.hoverEls=[...this.hoverEls,...this.keyElements.get(`d:${e}`)??[],...this.keyElements.get(`d:${n}`)??[]]}if(t?.startsWith(`st:n:`)){let[,,e,n]=t.split(`:`);this.hoverEls=[...this.hoverEls,...this.keyElements.get(`n:${e}`)??[],...this.keyElements.get(`n:${n}`)??[]]}else if(t?.startsWith(`st:c:`)){let[,,e,n]=t.split(`:`);this.hoverEls=[...this.hoverEls,...this.keyElements.get(`n:${e}`)??[],...this.keyElements.get(`d:${n}`)??[]]}for(let e of this.hoverEls)e.classList.add(`hovered`);if(this.applyOverviewDistrictHighlight(),!t){this.hoverCard.hideCard();return}let r=this.hoverContent(t);if(!r){this.hoverCard.hideCard();return}if(this.hoverCard.showCard(r),t.startsWith(`f:`)){let n=+t.slice(2);this.isSelectionLinksTarget(n)||(this.hoverImportTimer=setTimeout(()=>this.drawImportPreview(n),e.IMPORT_PREVIEW_DELAY_MS))}}reapplyHover(){if(!this.hoverKey){this.applyOverviewDistrictHighlight();return}if(this.hoverEls=this.keyElements.get(this.hoverKey)??[],this.hoverKey.startsWith(`r:`)){let[,e,t]=this.hoverKey.split(`:`);this.hoverEls=[...this.hoverEls,...this.keyElements.get(`d:${e}`)??[],...this.keyElements.get(`d:${t}`)??[]]}else if(this.hoverKey.startsWith(`st:n:`)){let[,,e,t]=this.hoverKey.split(`:`);this.hoverEls=[...this.hoverEls,...this.keyElements.get(`n:${e}`)??[],...this.keyElements.get(`n:${t}`)??[]]}else if(this.hoverKey.startsWith(`st:c:`)){let[,,e,t]=this.hoverKey.split(`:`);this.hoverEls=[...this.hoverEls,...this.keyElements.get(`n:${e}`)??[],...this.keyElements.get(`d:${t}`)??[]]}for(let e of this.hoverEls)e.classList.add(`hovered`);if(this.hoverImportG=null,this.hoverImportTimer!=null&&clearTimeout(this.hoverImportTimer),this.hoverKey.startsWith(`f:`)){let t=+this.hoverKey.slice(2);this.isSelectionLinksTarget(t)||(this.hoverImportTimer=setTimeout(()=>this.drawImportPreview(t),e.IMPORT_PREVIEW_DELAY_MS))}this.applyOverviewDistrictHighlight()}clearHover(){this.hoverKey?.startsWith(`dir:`)&&this.callbacks.onPreviewDirectory(void 0);let e=this.hoverKey?.startsWith(`hs:`);for(let e of this.hoverEls)e.classList.remove(`hovered`);this.hoverEls=[],this.hoverKey=null,this.hoverImportTimer!=null&&(clearTimeout(this.hoverImportTimer),this.hoverImportTimer=null),this.clearImportPreview(),this.hoverCard.hideCard(),e&&this.renderSymbolRefs(this.state?.selHSym??null),this.applyOverviewDistrictHighlight()}clearOverviewDistrictHighlight(){let e=new Set(this.hoverEls);for(let t of this.overviewHighlightEls)e.has(t)||t.classList.remove(`hovered`);for(let e of this.overviewDimEls)e.classList.remove(`overview-dimmed`);this.overviewHighlightEls=[],this.overviewDimEls=[]}applyOverviewDistrictHighlight(){if(this.clearOverviewDistrictHighlight(),this.overviewDistricts)for(let[e,t]of this.keyElements){if(!e.startsWith(`d:`))continue;let n=Number(e.slice(2));if(this.overviewDistricts.has(n))for(let e of t)e.classList.add(`hovered`),this.overviewHighlightEls.push(e);else for(let e of t)e.classList.add(`overview-dimmed`),this.overviewDimEls.push(e)}}clearImportPreview(){this.hoverImportG?.remove(),this.hoverImportG=null}hoverContent(e){let{doc:t,lens:n,lensComparison:r,districtPaths:i}=this.state;return yE(e,{doc:t,lens:n,lensComparison:r,lensRoads:this.state.lensRoads,districtPaths:i,roadPlan:this.drawnRoads,streetCache:this.streetCache,inAdj:this.inAdj,symLocalByGlobal:this.symLocalByGlobal,symVisible:this.symVisible})}drawImportPreview(e){if(this.hoverKey!==`f:`+e)return;let{shown:t}=Xw(this.state.doc,this.outAdj,this.inAdj,e,40);if(t.length===0)return;let n=$(`g`,{class:`hover-imports`,"pointer-events":`none`}),r=this.anchor(e),i=this.X(r[0]),a=this.Y(r[1]);for(let{j:e,dir:r}of t){let t=this.anchor(e);n.appendChild($(`line`,{x1:i.toFixed(1),y1:a.toFixed(1),x2:this.X(t[0]).toFixed(1),y2:this.Y(t[1]).toFixed(1),stroke:r===`out`?`var(--link-out)`:`var(--ink)`,"stroke-width":1,"stroke-opacity":.4,"pointer-events":`none`}))}this.svg.appendChild(n),this.hoverImportG=n}toSvg(e){let t=this.svg.getBoundingClientRect();return[(e.clientX-t.left)/t.width*this.VW,(e.clientY-t.top)/t.height*this.VH]}gestureEvent(e,t){return{type:t,id:e.pointerId,x:e.clientX,y:e.clientY,t:e.timeStamp,pointerType:e.pointerType,isPrimary:e.isPrimary}}capture(e){try{this.svg.setPointerCapture(e)}catch{}}pointerDown(e){this.settleTimer!=null&&(clearTimeout(this.settleTimer),this.settleTimer=null),this.clickAllowed=!1,this.applyGestureIntents(this.gestures.handle(this.gestureEvent(e,`down`))),this.syncRenderHold()}pointerMove(e){this.gestures.active&&this.applyGestureIntents(this.gestures.handle(this.gestureEvent(e,`move`)))}pointerUp(e){this.applyGestureIntents(this.gestures.handle(this.gestureEvent(e,`up`))),this.syncRenderHold()}pointerCancel(e){this.applyGestureIntents(this.gestures.handle(this.gestureEvent(e,`cancel`))),this.syncRenderHold()}lostCapture(e){e.target===this.svg&&(this.applyGestureIntents(this.gestures.handle(this.gestureEvent(e,`lostcapture`))),this.syncRenderHold())}applyGestureIntents(e){for(let t of e)switch(t.kind){case`pan`:{t.start&&(this.svg.classList.add(`dragging`),this.callbacks.onDragStart?.(),this.capture(t.id),this.panTravel=0,this.panDismissed=!1),this.panTravel+=Math.hypot(t.dx,t.dy),!this.panDismissed&&this.panTravel>24&&(this.panDismissed=!0,this.callbacks.onPanDismiss?.());let e=this.svg.getBoundingClientRect();this.tx+=t.dx*(this.VW/(e.width||1)),this.ty+=t.dy*(this.VH/(e.height||1)),this.gestureFrame();break}case`pinch-start`:for(let e of t.ids)this.capture(e);this.pinch={m:this.toSvg({clientX:t.mid[0],clientY:t.mid[1]}),k:this.k,tx0:this.tx,ty0:this.ty};break;case`pinch`:{if(!this.pinch)break;let e=this.clampK(this.pinch.k*t.scale),n=this.toSvg({clientX:t.mid[0],clientY:t.mid[1]}),{tx:r,ty:i}=CE(this.pinch,n,e);this.tx=r,this.ty=i,this.k=e,this.gestureFrame();break}case`tap`:this.clickAllowed=!0;break;case`double-tap`:{this.clickAllowed=!1;let[e,n]=this.toSvg({clientX:t.x,clientY:t.y});this.zoomAbout(2,e,n);break}case`cancel`:case`end`:this.pinch=null,this.svg.classList.remove(`dragging`),this.rootG?.hasAttribute(`transform`)&&this.scheduleSettle()}}syncRenderHold(){if(this.gestures.active){this.quietTimer!=null&&clearTimeout(this.quietTimer),this.quietTimer=null,this.renderGate.hold();return}this.renderGate.held&&this.quietTimer==null&&(this.quietTimer=setTimeout(()=>{this.quietTimer=null,this.releaseRenders()},350))}releaseRenders(){this.quietTimer!=null&&clearTimeout(this.quietTimer),this.quietTimer=null;let e=this.renderGate.release();e&&this.applyRender(e)}wheel(e){e.preventDefault();let[t,n]=this.toSvg(e),r=Math.exp(-e.deltaY*.0016),i=this.clampK(this.k*r);this.tx=t-(t-this.tx)*(i/this.k),this.ty=n-(n-this.ty)*(i/this.k),this.k=i,this.gestureFrame()}resolveKey(e,t,n,r=!1){let i=e;for(;i&&i!==this.svg&&!i.getAttribute?.(`data-k`);)i=i.parentNode;let a=i&&i!==this.svg?i.getAttribute?.(`data-k`):null,o=!!i&&i!==this.svg&&i.tagName?.toLowerCase()===`path`&&!!a?.startsWith(`d:`);if(this.hasFootprints&&this.footprintIndex&&this.state&&(a==null||o)){let[e,i]=this.toSvg({clientX:t,clientY:n}),a=(e-this.tx)/this.k,o=(i-this.ty)/this.k,s=r?.08/this.k:0,c=Kw(this.state.doc,this.footprintIndex,a,o,s);if(c!=null)return`f:`+c}return a}click(e){let t=this.clickAllowed;this.clickAllowed=!1,t&&this.handleTap(e),this.gestures.active||this.releaseRenders()}handleTap(e){let t=this.resolveKey(e.target,e.clientX,e.clientY,!0);if(!t){this.hoverCard.hideCard(),this.callbacks.onClearSelection();return}let n=t.split(`:`);if(n[0]===`r`||n[0]===`st`||n[0]===`n`||n[0]===`lh`||n[0]===`ln`){let n=this.hoverContent(t);if(n&&this.callbacks.onTapStructure?.(t,_E(n))){this.hoverCard.hideCard();return}n&&(this.hoverCard.showCard(n),this.hoverCard.positionCard(e.clientX,e.clientY,e.target,this.keyElements));return}if(this.hoverCard.hideCard(),n[0]===`lc`){let e=this.state.lensComparison?.changes[+n[1]]?.targets[+n[2]];e&&this.callbacks.onSelectLensStop?.(e)}else if(n[0]===`ls`){let e=this.state.lens?.paths[+n[1]]?.stops[+n[2]]?.target;e&&this.callbacks.onSelectLensStop?.(e)}else n[0]===`d`?this.callbacks.onSelectDistrict(+n[1]):n[0]===`f`?this.selectFileTwoStep(+n[1]):n[0]===`s`?this.callbacks.onSelectSymbol(+n[1],+n[2]):n[0]===`hs`?this.callbacks.onSelectHierSymbol(+n[1]):n[0]===`dir`&&this.callbacks.onSelectDirectory(t.slice(4))}selectFileTwoStep(e){let t=this.renderGate.latest??this.state;if(t&&this.hasFootprints&&!this.directFileTaps){let n=V(t.doc,e);if((t.selD??(t.sel==null?null:V(t.doc,t.sel)))!==n){this.callbacks.onSelectDistrict(n);return}}this.callbacks.onSelectFile(e)}};function UE({doc:e,lens:t,lensRoads:n,lensComparison:r,impactFiles:i,impactDistricts:a,geo:o,layer:s,sel:c,selSym:l,selD:u,route:d,packageGrouping:f,districtPaths:p,folderFiles:m,folderOnlyIslands:h,folderLabels:g,activeDirectory:v,districtSymbols:y,selHSym:x,insets:S,callbacks:C,handleRef:w}){let T=(0,_.useRef)(null),E=(0,_.useRef)(null),D=(0,_.useRef)(null),O=(0,_.useRef)(C);O.current=C,(0,_.useLayoutEffect)(()=>{if(!T.current)return;let e=new HE(T.current,{onSelectLensStop:e=>O.current.onSelectLensStop?.(e),onSelectDistrict:e=>O.current.onSelectDistrict(e),onSelectFile:e=>O.current.onSelectFile(e),onSelectSymbol:(e,t)=>O.current.onSelectSymbol(e,t),onSelectHierSymbol:e=>O.current.onSelectHierSymbol(e),onClearSelection:()=>O.current.onClearSelection(),onSelectDirectory:e=>O.current.onSelectDirectory(e),onPreviewDirectory:e=>O.current.onPreviewDirectory(e),onNeedSymbols:e=>O.current.onNeedSymbols(e),onDragStart:()=>O.current.onDragStart?.(),onPanDismiss:()=>O.current.onPanDismiss?.(),onTapStructure:(e,t)=>O.current.onTapStructure?.(e,t)??!1});return D.current=e,()=>{e.destroy(),D.current=null}},[]),(0,_.useImperativeHandle)(w,()=>({fit:(e=!0)=>D.current?.fit(e),panTo:(e,t=!0)=>D.current?.panTo(e,t),panToDistrict:(e,t=!0)=>D.current?.panToDistrict(e,t),frameDistricts:e=>D.current?.frameDistricts(e),frameLensStep:(e,t,n=!0)=>D.current?.frameLensStep(e,t,n),highlightDistricts:e=>D.current?.highlightDistricts(e),zoomDistrict:e=>D.current?.zoomDistrict(e),zoomBy:e=>D.current?.zoomBy(e),hoverSymbol:e=>D.current?.hoverSymbol(e),setInsets:e=>D.current?.setInsets(e),setDirectFileTaps:e=>D.current?.setDirectFileTaps(e)}),[]);let k=(0,_.useRef)(!1),ee=(0,_.useRef)(S);ee.current=S;let A=e.repo;(0,_.useLayoutEffect)(()=>{let _=D.current;if(!_||!E.current)return;_.loadDocument(e);let b=E.current.getBoundingClientRect();_.resize(b.width,b.height),_.setInsets(ee.current);let S={doc:e,lens:t,lensRoads:n,lensComparison:r,impactFiles:i,impactDistricts:a,geo:o,layer:s,sel:c,selSym:l,selD:u,route:d,packageGrouping:f,districtPaths:p,folderFiles:m,folderOnlyIslands:h,folderLabels:g,activeDirectory:v,districtSymbols:y,selHSym:x};_.fit(!1,S),c==null?u!=null&&_.panToDistrict(u,!1):_.panTo(c,!1),k.current=!0},[A]),(0,_.useLayoutEffect)(()=>{let _=D.current;if(!_)return;if(k.current){k.current=!1;return}let b={doc:e,lens:t,lensRoads:n,lensComparison:r,impactFiles:i,impactDistricts:a,geo:o,layer:s,sel:c,selSym:l,selD:u,route:d,packageGrouping:f,districtPaths:p,folderFiles:m,folderOnlyIslands:h,folderLabels:g,activeDirectory:v,districtSymbols:y,selHSym:x};_.render(b)},[e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h,g,v,y,x]);let j=JSON.stringify(S);(0,_.useLayoutEffect)(()=>{D.current?.setInsets(ee.current)},[j]);let M=(0,_.useRef)(null);return(0,_.useEffect)(()=>{let e=E.current;if(!e)return;let t=new ResizeObserver(()=>{let t=e.getBoundingClientRect(),n=M.current;n&&n.w===t.width&&n.h===t.height||(M.current={w:t.width,h:t.height},D.current?.resize(t.width,t.height))});return t.observe(e),()=>t.disconnect()},[]),(0,b.jsx)(`div`,{ref:E,className:`absolute inset-0`,"data-fit-insets":`${S.frame.left},${S.frame.top},${S.frame.right},${S.frame.bottom}`,"data-safe-insets":`${S.safe.left},${S.safe.top},${S.safe.right},${S.safe.bottom}`,children:(0,b.jsx)(`svg`,{ref:T,className:`map-svg`,role:`img`,"aria-label":`Pannable, zoomable map of a source repository with computed districts, landmark pins and import routes`})})}var WE={type:`none`},GE={1:`d`,2:`c`,3:`x`,4:`p`};function KE(e){let t=e.focus??`page`,n=e.key;if((e.metaKey||e.ctrlKey)&&n.toLowerCase()===`k`&&!e.altKey)return{type:`search`};if(t!==`page`||e.altKey||e.metaKey||e.ctrlKey)return WE;if(n===`?`||n===`/`&&e.shiftKey)return{type:`keyboard-list`};if(n===`Escape`)return{type:`escape`};if(n===`/`&&!e.shiftKey)return{type:`search`};if(n===`[`&&!e.shiftKey)return{type:`toggle-panel`};if(n in GE)return{type:`layer`,layer:GE[n]};if(n===`+`||n===`=`&&e.shiftKey)return{type:`zoom-in`};if(n===`-`||n===`−`)return{type:`zoom-out`};if(n.toLowerCase()===`f`)return{type:`fit`};if(n.toLowerCase()===`z`)return{type:`zoom-selection`};if(n.toLowerCase()===`t`)return{type:`cycle-theme`};if(e.walkthrough&&(n===`ArrowLeft`||n===`ArrowRight`))return{type:`walk-step`,direction:n===`ArrowLeft`?-1:1};if(e.overviewOpen){if(n===`ArrowDown`)return{type:`overview-move`,direction:1};if(n===`ArrowUp`)return{type:`overview-move`,direction:-1};if(n===`Enter`)return{type:`overview-activate`}}return WE}function qE(e){return(0,_.useSyncExternalStore)(t=>Gc(e,t),()=>Wc(e),()=>null)}function JE(e){return e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(0)} KB`:`${(e/1048576).toFixed(1)} MB`}function YE({progressKey:e,label:t}){let n=qE(e);return n?n.phase===`parsing`?(0,b.jsxs)(`p`,{"data-load-progress":`parsing`,children:[`parsing `,t,`… (`,JE(n.receivedBytes),`)`]}):(0,b.jsxs)(`p`,{"data-load-progress":`downloading`,children:[`loading `,t,`… `,JE(n.receivedBytes),n.totalBytes==null?``:` / ${JE(n.totalBytes)}`]}):(0,b.jsxs)(`p`,{"data-load-progress":`idle`,children:[`loading `,t,`…`]})}function XE({value:e}){let t=e.indexed_commit?.slice(0,10),n=e.requested_commit?.slice(0,10);return(0,b.jsxs)(`div`,{role:`status`,"data-snapshot-state":e.state,children:[(0,b.jsx)(`span`,{children:t?`Viewing ${t}. `:`No complete snapshot. `}),e.state===`queued`&&(0,b.jsxs)(`span`,{children:[n,` is queued. The saved snapshot stays available.`]}),e.state===`indexing`&&(0,b.jsxs)(`span`,{children:[`Indexing `,n,`. The saved snapshot stays available.`]}),e.state===`failed`&&(0,b.jsxs)(`span`,{children:[`Indexing `,n,` failed. `,e.failure_reason,` `]}),e.state===`stale`&&(0,b.jsx)(`span`,{children:`A newer saved or requested snapshot is available.`}),e.retryable&&(0,b.jsx)(`a`,{className:`underline`,href:`/`,children:`Retry indexing`})]})}function ZE({owner:e,repo:t,commit:n,narrow:r,mapLeft:i=`env(safe-area-inset-left, 0px)`,inline:a=!1}){let{data:o}=st({queryKey:[`snapshot-freshness`,e,t,n],queryFn:()=>pl(e,t,n),enabled:!!n,retry:!1,refetchInterval:5e3});if(!o)return null;let s=a?void 0:r?{left:`calc(${i} + 12px)`,right:`calc(68px + env(safe-area-inset-right, 0px))`,top:`calc(122px + env(safe-area-inset-top, 0px))`}:{left:`calc(388px + env(safe-area-inset-left, 0px))`,top:`calc(72px + env(safe-area-inset-top, 0px))`,width:`min(380px, calc(100% - 400px - env(safe-area-inset-left, 0px) - env(safe-area-inset-right, 0px)))`};return(0,b.jsx)(`div`,{"data-snapshot-freshness-note":!0,className:`pointer-events-auto min-w-0 rounded-md border border-[var(--rule)] bg-[var(--chrome2)] p-2 text-small text-[var(--on)] ${a?``:`absolute z-20`}`,style:s,children:(0,b.jsx)(XE,{value:o})})}function QE({pending:e,failed:t,narrow:n,mapLeft:r=`env(safe-area-inset-left, 0px)`,inline:i=!1}){let[a,o]=(0,_.useState)(!1);if(!e&&(t==null||a))return null;let s=n?``:`left-1/2 top-2.5 w-max max-w-[min(380px,max(200px,calc(100%-600px)))] -translate-x-1/2`,c=n?{top:`calc(72px + env(safe-area-inset-top, 0px))`,left:`calc(${r} + 12px)`,right:`calc(68px + env(safe-area-inset-right, 0px))`}:void 0;return(0,b.jsx)(`div`,{role:`status`,"data-detail-status":e?`pending`:`failed`,style:i?void 0:c,className:`pointer-events-auto flex min-w-0 items-center gap-2.5 rounded-[12px] border border-[var(--rule)] bg-[var(--chrome2)] px-3 py-2 text-small text-[var(--on)] shadow-md ${i?``:`absolute z-20 ${s}`}`,children:e?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(`span`,{"aria-hidden":!0,className:`relative h-4 w-4 flex-none rounded-full border-2 border-[var(--rule)]`,children:(0,b.jsx)(`span`,{className:`tolmap-spin absolute -inset-[2px] rounded-full border-2 border-transparent border-t-[var(--accent)]`})}),(0,b.jsx)(`span`,{children:`Classes and functions are still being read. They appear at close zoom when ready.`})]}):(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(`span`,{className:`min-w-0`,children:`Classes and functions couldn't be read for this map.`}),(0,b.jsx)(`button`,{type:`button`,onClick:()=>o(!0),"aria-label":`Dismiss`,className:`-my-2 -mr-2 inline-flex h-11 w-11 flex-none items-center justify-center rounded-[10px] text-[var(--dim)] hover:bg-[color-mix(in_srgb,var(--on)_8%,transparent)]`,children:`×`})]})})}function $E(e){let{job:t,error:n}=gl(e),[r,i]=(0,_.useState)(void 0);r===void 0&&t?.commit&&i(t.commit);let a=t?.status===`done`||t?.status===`failed`;return{commit:r??t?.commit??void 0,waiting:!!e&&!t&&!n,detailPending:!!t&&!a,detailFailed:t?.status===`failed`?t.error??`the job failed`:null,settled:!!t&&a}}var eD=4e3;function tD(e,t){return e<t?-1:+(e>t)}function nD(e,t){return e.names[String(t)]??`District ${t}`}function rD(e,t,n){let r=e.N[t]?.[n];return typeof r==`number`&&Number.isFinite(r)&&r>=0?r:null}function iD(e){if(e.length===0)return null;let t=[...e].sort((e,t)=>e-t),n=Math.floor(t.length/2);return t.length%2==0?(t[n-1]+t[n])/2:t[n]}function aD(e,t){return tD(e.name,t.name)||e.district-t.district}function oD(e,t,n){let r=[];for(let i=0;i<e.F.length;i++){let a=V(e,i);if(!n.has(a))continue;let o=rD(e,i,t);o!=null&&r.push({file:i,district:a,name:e.F[i],value:o})}return r.sort((e,t)=>t.value-e.value||tD(e.name,t.name)||e.file-t.file).slice(0,10)}function sD(e,t){let n=vT(e),r=new Set(yT(e)),i=new Set(n.islands.map(Number)),a=new Map;for(let t=0;t<e.N.length;t++){let n=V(e,t);if(!r.has(n))continue;let i=a.get(n);i?i.push(t):a.set(n,[t])}let o={mainlandDistricts:n.mainland.length,islandDistricts:n.islands.length,files:e.F.length},s=[],c=0,l=0,u=0,d=0;for(let[t,n]of a){let r=0,a=0;for(let t of n){let n=rD(e,t,5);n!=null&&(r+=n,a++)}if(a!==0){if(c+=a,l+=r,n.length<10){i.has(t)?d++:u++;continue}s.push({district:t,name:nD(e,t),island:i.has(t),knownFiles:a,commits:r,commitsPerFile:r/a,bar:0})}}s.sort((e,t)=>t.commits-e.commits||aD(e,t));let f=s[0]?.commits??0;for(let e of s)e.bar=f>0?e.commits/f:0;let p=[],m=[],h=0,g=0;for(let[t,n]of a){let r=n.flatMap(t=>{let n=rD(e,t,4);return n==null?[]:[n]});if(r.length!==0){if(m.push(...r),n.length<10){i.has(t)?g++:h++;continue}p.push({district:t,name:nD(e,t),island:i.has(t),knownFiles:r.length,median:iD(r)})}}p.sort((e,t)=>t.median-e.median||aD(e,t));let _=Object.keys(e.coverage?.by_language??{}),v=_.length===1?_[0]:null,y=v!=null&&e.coverage?.by_language[v]?.total_files===e.F.length?v:null,b=new Set(t.groups.flatMap(e=>e.path==null?[]:[e.path])),x=t.groups.map(n=>{let a=[];for(let r=0;r<e.F.length;r++){let e=t.filePackages[r];(n.path==null?!b.has(e):e===n.path)&&a.push(r)}let o=[...new Set(a.map(t=>V(e,t)).filter(e=>r.has(e)))].sort((t,n)=>aD({district:t,name:nD(e,t)},{district:n,name:nD(e,n)}));return{path:n.path,other:n.other,files:n.count,color:n.color,language:y,districtCount:o.filter(e=>!i.has(e)).length,islandCount:o.filter(e=>i.has(e)).length,districtIds:o}}),S=new Map;for(let n=0;n<e.F.length;n++){let i=V(e,n);if(!r.has(i))continue;let a=t.filePackages[n];if(a==null)continue;let o=b.has(a)?a:null,s=S.get(i)??new Set;s.add(o),S.set(i,s)}let C=[...S].filter(([,e])=>e.size>1).map(([t,n])=>({district:t,name:nD(e,t),island:i.has(t),files:a.get(t)?.length??0,packages:[...n].sort((e,t)=>e==null?t==null?0:1:t==null?-1:tD(e,t))})).sort((e,t)=>t.packages.length-e.packages.length||aD(e,t));return{district:o,churn:{windowCommits:eD,knownFiles:c,fileCommitTouches:l,districts:s,smallDistrictCount:u,smallIslandCount:d,mostActiveDistrict:s[0]??null,files:oD(e,5,r)},complexity:{median:iD(m),districts:p,smallDistrictCount:h,smallIslandCount:g,mostComplexDistrict:p[0]??null,files:oD(e,4,r)},package:{language:y,groups:x,mixedDistricts:C}}}function cD(e,t){let n=e=>e.toLocaleString(`en-US`,{maximumFractionDigits:1});switch(t){case`d`:{let t=e.district.islandDistricts===1?`island`:`islands`;return{primary:`${e.district.mainlandDistricts} districts${e.district.islandDistricts?` + ${e.district.islandDistricts} ${t}`:``} · ${e.district.files.toLocaleString(`en-US`)} files`}}case`c`:return e.churn.knownFiles===0?{primary:`No churn data`}:{primary:`Churn · up to ${e.churn.windowCommits.toLocaleString(`en-US`)} commits`,secondary:`Merge commits excluded${e.churn.mostActiveDistrict?` · most active ${e.churn.mostActiveDistrict.island?`island`:`district`}: ${e.churn.mostActiveDistrict.name}`:``}`};case`x`:return{primary:e.complexity.median==null?`No complexity data`:`Median complexity per file · ${n(e.complexity.median)}`,...e.complexity.mostComplexDistrict?{secondary:`Most complex ${e.complexity.mostComplexDistrict.island?`island`:`district`}: ${e.complexity.mostComplexDistrict.name}`}:{}};case`p`:{let t=e.package.mixedDistricts.filter(e=>!e.island).length,n=e.package.mixedDistricts.length-t,r=n===1?`island`:`islands`;return{primary:`${e.package.groups.length.toLocaleString(`en-US`)} package groups · ${e.package.groups.reduce((e,t)=>e+t.files,0).toLocaleString(`en-US`)} files`,secondary:`${t.toLocaleString(`en-US`)} ${t===1?`district`:`districts`} + ${n.toLocaleString(`en-US`)} ${r} mix packages`}}}}function lD(e){return{py:`Python`,ts:`TypeScript`,go:`Go`,rs:`Rust`,js:`JavaScript`}[e]??e}var uD=Object.defineProperty,dD=(e,t)=>uD(e,`name`,{value:t,configurable:!0});function fD(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}dD(fD,`setRef`);function pD(...e){return t=>{let n=!1,r=e.map(e=>{let r=fD(e,t);return!n&&typeof r==`function`&&(n=!0),r});if(n)return()=>{for(let t=0;t<r.length;t++){let n=r[t];typeof n==`function`?n():fD(e[t],null)}}}}dD(pD,`composeRefs`);function mD(...e){return _.useCallback(pD(...e),e)}dD(mD,`useComposedRefs`);var hD=Object.defineProperty,gD=(e,t)=>hD(e,`name`,{value:t,configurable:!0});function _D(e){let t=_.forwardRef((t,n)=>{let{children:r,...i}=t,a=null,o=!1,s=[];ED(r)&&typeof AD==`function`&&(r=AD(r._payload)),_.Children.forEach(r,e=>{if(wD(e)){o=!0;let t=e,n=`child`in t.props?t.props.child:t.props.children;ED(n)&&typeof AD==`function`&&(n=AD(n._payload)),a=xD(t,n),s.push(a?.props?.children)}else s.push(e)}),a?a=_.cloneElement(a,void 0,s):!o&&_.Children.count(r)===1&&_.isValidElement(r)&&(a=r);let c=a?CD(a):void 0,l=mD(n,c);if(!a){if(r||r===0)throw Error(o?kD(e):OD(e));return r}let u=SD(i,a.props??{});return a.type!==_.Fragment&&(u.ref=n?l:c),_.cloneElement(a,u)});return t.displayName=`${e}.Slot`,t}gD(_D,`createSlot`);var vD=_D(`Slot`),yD=Symbol.for(`radix.slottable`);function bD(e){let t=gD(e=>`child`in e?e.children(e.child):e.children,`Slottable`);return t.displayName=`${e}.Slottable`,t.__radixId=yD,t}gD(bD,`createSlottable`);var xD=gD((e,t)=>{if(`child`in e.props){let t=e.props.child;return _.isValidElement(t)?_.cloneElement(t,void 0,e.props.children(t.props.children)):null}return _.isValidElement(t)?t:null},`getSlottableElementFromSlottable`);function SD(e,t){let n={...t};for(let r in t){let i=e[r],a=t[r];/^on[A-Z]/.test(r)?i&&a?n[r]=(...e)=>{let t=a(...e);return i(...e),t}:i&&(n[r]=i):r===`style`?n[r]={...i,...a}:r===`className`&&(n[r]=[i,a].filter(Boolean).join(` `))}return{...e,...n}}gD(SD,`mergeProps`);function CD(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}gD(CD,`getElementRef`);function wD(e){return _.isValidElement(e)&&typeof e.type==`function`&&`__radixId`in e.type&&e.type.__radixId===yD}gD(wD,`isSlottable`);var TD=Symbol.for(`react.lazy`);function ED(e){return typeof e==`object`&&!!e&&`$$typeof`in e&&e.$$typeof===TD&&`_payload`in e&&DD(e._payload)}gD(ED,`isLazyComponent`);function DD(e){return typeof e==`object`&&!!e&&`then`in e}gD(DD,`isPromiseLike`);var OD=gD(e=>`${e} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,`createSlotError`),kD=gD(e=>`${e} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,`createSlottableError`),AD=_.use,jD=e=>typeof e==`boolean`?`${e}`:e===0?`0`:e,MD=ys,ND=((e,t)=>n=>{if(t?.variants==null)return MD(e,n?.class,n?.className);let{variants:r,defaultVariants:i}=t,a=Object.keys(r).map(e=>{let t=n?.[e],a=i?.[e];if(t===null)return null;let o=jD(t)||jD(a);return r[e][o]}),o=n&&Object.entries(n).reduce((e,t)=>{let[n,r]=t;return r===void 0||(e[n]=r),e},{});return MD(e,a,t?.compoundVariants?.reduce((e,t)=>{let{class:n,className:r,...a}=t;return Object.entries(a).every(e=>{let[t,n]=e;return Array.isArray(n)?n.includes({...i,...o}[t]):{...i,...o}[t]===n})?[...e,n,r]:e},[]),n?.class,n?.className)})(`inline-flex items-center justify-center gap-1.5 whitespace-nowrap rounded-md text-small font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 disabled:pointer-events-none disabled:opacity-50`,{variants:{variant:{default:`bg-primary text-primary-foreground hover:opacity-90`,outline:`border border-border bg-transparent hover:bg-subtle hover:text-subtle-foreground`,ghost:`hover:bg-subtle hover:text-subtle-foreground`,segment:`bg-secondary text-muted-foreground hover:text-foreground data-[on=true]:bg-primary data-[on=true]:text-primary-foreground`},size:{default:`h-8 px-3 py-1.5`,sm:`h-8 px-2.5 text-meta`,icon:`h-8 w-8`}},defaultVariants:{variant:`default`,size:`default`}}),PD=_.forwardRef(({className:e,variant:t,size:n,asChild:r=!1,...i},a)=>(0,b.jsx)(r?vD:`button`,{className:bc(ND({variant:t,size:n,className:e})),ref:a,...i}));PD.displayName=`Button`;var FD=_.forwardRef(({className:e,...t},n)=>(0,b.jsx)(`input`,{ref:n,className:bc(`flex h-9 w-full rounded-md border border-border bg-background px-3 py-1.5 text-body min-[821px]:text-small placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring`,e),...t}));FD.displayName=`Input`;function ID({layout:e,doc:t,onSelectFile:n,nested:r=!0,touchTargets:i=!1,compactRows:a=!1}){return(0,b.jsx)(`div`,{className:r?`mt-2 max-h-[44vh] overflow-y-auto`:`mt-2`,"data-unconnected-list":!0,children:e.unconnectedGroups.map(e=>(0,b.jsxs)(`details`,{className:`border-t border-[var(--rule)] py-1`,children:[(0,b.jsxs)(`summary`,{className:`cursor-pointer break-all font-mono text-meta text-[var(--on)] ${r?i?`min-h-[44px]`:``:`flex ${i?`min-h-[44px]`:a?`min-h-8`:`min-h-[44px]`} items-center`}`,children:[rs(e.path),` `,(0,b.jsxs)(`span`,{className:`text-[var(--dim)]`,children:[`(`,e.files.length,`)`]})]}),e.files.map(e=>(0,b.jsx)(`button`,{type:`button`,"data-unconnected-file":e,className:`block w-full break-all py-1 pl-2 text-left font-mono text-meta text-[var(--dim)] hover:text-[var(--on)] ${r?i?`min-h-[44px]`:``:i?`min-h-[44px]`:a?`min-h-8`:`min-h-[44px]`}`,onClick:()=>n(e),children:t.F[e].split(`/`).pop()},e))]},e.path))})}function LD({layout:e,activeDirectory:t,onSelectDirectory:n,nested:r=!0,touchTargets:i=!1}){let[a,o]=(0,_.useState)(``),s=(0,_.useMemo)(()=>{let t=a.trim().toLowerCase();return t?e.directories.filter(e=>e.path.toLowerCase().includes(t)).slice(0,20):[]},[e,a]),c=e=>n(e===t?void 0:e);return(0,b.jsxs)(`div`,{className:`mt-2`,"data-folder-browser":!0,children:[(0,b.jsxs)(`div`,{className:`flex gap-1.5`,children:[(0,b.jsx)(FD,{value:a,"aria-label":`Filter folder paths`,placeholder:`filter folder paths…`,autoComplete:`off`,className:`${r?i?`h-11`:`h-8`:`h-11`} min-w-0 bg-[var(--chrome2)] px-2 font-mono text-[var(--on)]`,onChange:e=>o(e.target.value),onKeyDown:e=>{e.key===`Enter`&&s.length!==0&&(e.preventDefault(),c(s[0].path))}}),t&&(0,b.jsx)(PD,{size:`sm`,variant:`outline`,"aria-label":`Clear folder highlight`,onClick:()=>n(void 0),className:i?`h-11 min-w-[44px]`:``,children:`clear`})]}),(0,b.jsx)(`div`,{className:r?`mt-1.5 max-h-[300px] overflow-y-auto`:`mt-1.5`,"data-folder-rows-large":r?void 0:``,children:a.trim()?s.length>0?s.map(n=>(0,b.jsx)(RD,{directory:n,totalFiles:e.filesByDirectory.get(`.`)?.size??0,active:n.path===t,onPick:c},n.path)):(0,b.jsx)(`p`,{className:`px-1 py-2 text-meta italic text-[var(--dim)]`,children:`no folder matches`}):e.directoryRoots.map(n=>(0,b.jsx)(zD,{directory:n,totalFiles:e.filesByDirectory.get(`.`)?.size??0,depth:0,activeDirectory:t,onPick:c},`${n.path}:${t??``}`))})]})}function RD({directory:e,totalFiles:t,active:n,onPick:r}){return(0,b.jsxs)(`button`,{type:`button`,"data-folder-path":e.path,onClick:()=>r(e.path),"aria-pressed":n,className:`grid w-full grid-cols-[1fr_auto_auto] items-center gap-2 border-t border-[var(--rule)] px-1 py-1 text-left font-mono text-meta first:border-t-0 touch:min-h-[44px] ${n?`text-[var(--accent)]`:`text-[var(--on)]`}`,children:[(0,b.jsx)(`span`,{className:`overflow-hidden text-ellipsis whitespace-nowrap`,children:rs(e.path)}),(0,b.jsx)(`span`,{className:`text-[var(--dim)]`,children:BD(e.count,t)}),(0,b.jsx)(`span`,{className:`text-[var(--dim)]`,children:e.count.toLocaleString(`en-US`)})]})}function zD({directory:e,totalFiles:t,depth:n,activeDirectory:r,onPick:i}){let a=!!r&&(r===e.path||r.startsWith(`${e.path}/`)),[o,s]=(0,_.useState)(a);return(0,b.jsxs)(`div`,{children:[(0,b.jsxs)(`div`,{className:`grid grid-cols-[18px_1fr_auto_auto] items-center gap-x-1.5 border-t border-[var(--rule)] first:border-t-0`,children:[e.children.length>0?(0,b.jsx)(`button`,{type:`button`,"aria-label":`${o?`Collapse`:`Expand`} ${e.path}`,onClick:()=>s(e=>!e),className:`h-6 text-meta text-[var(--dim)] touch:h-11`,children:(0,b.jsx)(`span`,{className:`inline-block transition-transform ${o?`rotate-90`:``}`,children:`›`})}):(0,b.jsx)(`span`,{}),(0,b.jsxs)(`button`,{type:`button`,"data-folder-path":e.path,"aria-pressed":r===e.path,onClick:()=>i(e.path),className:`min-w-0 overflow-hidden text-ellipsis whitespace-nowrap py-1 text-left font-mono text-meta touch:min-h-[44px] ${r===e.path?`text-[var(--accent)]`:`text-[var(--on)]`}`,style:{paddingLeft:`${n*7}px`},children:[e.name,`/`]}),(0,b.jsx)(`span`,{className:`font-mono text-meta text-[var(--dim)]`,children:BD(e.count,t)}),(0,b.jsx)(`span`,{className:`pr-1 font-mono text-meta text-[var(--dim)]`,children:e.count.toLocaleString(`en-US`)})]}),o&&e.children.map(e=>(0,b.jsx)(zD,{directory:e,totalFiles:t,depth:n+1,activeDirectory:r,onPick:i},`${e.path}:${r??``}`))]})}function BD(e,t){let n=t>0?e/t*100:0;return`${n<10?n.toFixed(1):Math.round(n)}%`}function VD({doc:e,d:t,paths:n,onSelectFile:r,onSelectDistrict:i,onSelectDirectory:a,foldersExpanded:o,filesExpanded:s,onToggleFolders:c,onToggleFiles:l}){let u=[...e.N.keys()].filter(n=>V(e,n)===t).slice().sort((t,n)=>co(e,n)+io(e,n)/60-(co(e,t)+io(e,t)/60)).slice(0,6),d=e.roads.filter(e=>e[0]===t||e[1]===t).sort((e,t)=>t[2]-e[2]).slice(0,2).map(n=>({id:n[0]===t?n[1]:n[0],name:e.names[String(n[0]===t?n[1]:n[0])]}));return(0,b.jsxs)(`div`,{className:`mt-1.5 space-y-1 text-meta`,children:[d.length>0&&(0,b.jsxs)(`p`,{className:`truncate text-[var(--dim)]`,children:[`near`,` `,d.map((e,t)=>(0,b.jsxs)(`span`,{children:[t>0?`, `:``,(0,b.jsx)(`button`,{type:`button`,"data-neighbour-district":e.id,className:`text-[var(--on)] hover:text-[var(--accent)] touch:inline-flex touch:min-h-[44px] touch:items-center`,onClick:()=>i(e.id),children:e.name})]},e.id))]}),n.length>0&&(0,b.jsxs)(`div`,{"data-district-path-breakdown":!0,children:[(0,b.jsxs)(`button`,{type:`button`,"data-district-folders-toggle":!0,"aria-expanded":o,onClick:c,className:`flex w-full items-center gap-1.5 rounded-[8px] px-1 py-1 text-left text-[var(--on)] hover:bg-[var(--chrome-hover)] touch:min-h-[44px] touch:text-small`,children:[(0,b.jsx)(od,{className:`shrink-0 text-[var(--dim)] transition-transform ${o?`rotate-90`:``}`}),`folders (`,n.filter(e=>!e.other).length,`)`]}),o&&n.map((e,t)=>e.other?(0,b.jsxs)(`div`,{className:`grid grid-cols-[36px_1fr_auto] gap-1.5 border-t border-[var(--rule)] py-1 text-meta text-[var(--dim)]`,children:[(0,b.jsxs)(`b`,{className:`font-mono text-[var(--on)]`,children:[e.share,`%`]}),(0,b.jsx)(`span`,{children:`other`}),(0,b.jsxs)(`span`,{children:[`(`,e.count,` `,e.count===1?`file`:`files`,`)`]})]},`other`):(0,b.jsxs)(`button`,{type:`button`,"data-district-path":e.path,"aria-label":`Highlight folder ${e.path}`,onClick:()=>a(e.path),className:`grid w-full grid-cols-[36px_1fr_auto] items-center gap-1.5 border-t border-[var(--rule)] py-1 text-left text-meta text-[var(--on)] hover:text-[var(--accent)] touch:min-h-[44px]`,children:[(0,b.jsxs)(`b`,{className:`font-mono`,children:[e.share,`%`]}),(0,b.jsx)(`span`,{className:`overflow-hidden text-ellipsis whitespace-nowrap font-mono`,children:rs(e.path)}),(0,b.jsxs)(`span`,{className:`text-[var(--dim)]`,children:[`(`,e.count,` `,e.count===1?`file`:`files`,`)`]})]},e.path??t))]}),(0,b.jsxs)(`div`,{children:[(0,b.jsxs)(`button`,{type:`button`,"data-district-files-toggle":!0,"aria-expanded":s,onClick:l,className:`flex w-full items-center gap-1.5 rounded-[8px] px-1 py-1 text-left text-[var(--on)] hover:bg-[var(--chrome-hover)] touch:min-h-[44px] touch:text-small`,children:[(0,b.jsx)(od,{className:`shrink-0 text-[var(--dim)] transition-transform ${s?`rotate-90`:``}`}),`key files (`,u.length,`)`]}),s&&u.map(n=>(0,b.jsxs)(`button`,{"data-district-key-file":n,onClick:()=>r(n),className:`grid w-full grid-cols-[8px_1fr_auto] items-center gap-1.5 border-t border-[var(--rule)] py-1 text-left text-meta text-[var(--on)] hover:text-[var(--accent)] touch:min-h-[44px]`,children:[(0,b.jsx)(`i`,{className:`h-2 w-2 rounded-sm`,style:{background:Mo(e,t)}}),(0,b.jsx)(`span`,{className:`overflow-hidden text-ellipsis whitespace-nowrap font-mono`,children:e.F[n].split(`/`).slice(1).join(`/`)}),(0,b.jsxs)(`span`,{className:`font-mono text-[var(--dim)]`,children:[io(e,n),` lines`]})]},n))]})]})}function HD({blast:e,doc:t}){if(!e)return null;let n=e.files.length,r=e.districts.size,i=[...e.districts].map(e=>t.names[String(e)]).slice(0,4);return(0,b.jsxs)(`div`,{className:`my-2 border-l-2 border-[var(--hot)] py-1 pl-2.5 text-meta`,children:[(0,b.jsx)(`b`,{className:`font-mono text-[var(--on)]`,children:n}),` file`,n===1?``:`s`,` reference it, across`,` `,(0,b.jsx)(`b`,{className:`font-mono text-[var(--on)]`,children:r}),` district`,r===1?``:`s`,(0,b.jsxs)(`span`,{className:`block text-meta text-[var(--dim)]`,children:[i.join(` · `),e.districts.size>4?` …`:``]})]})}function UD({doc:e,i:t,sy:n,cur:r,onSelectSymbol:i,compactRows:a=!1,touchTargets:o=!1}){if(!n.length)return null;let s=io(e,t)||1,c=n.reduce((e,t)=>e+Math.max(0,t[3]-t[2]+1),0),l=Math.min(1,c/s),u=Math.max(0,1-l),d=n.map((e,t)=>({sm:e,n:t,span:e[3]-e[2]+1})).sort((e,t)=>t.span-e.span),f=d.slice(0,9);return(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)(`div`,{className:`my-2 flex h-[7px] gap-px overflow-hidden rounded-sm`,title:`${Math.round(l*100)}% of the file's lines sit inside one of its symbols`,children:[n.map((e,t)=>{let n=Math.max(0,e[3]-e[2]+1)/s;return n<=.012?null:(0,b.jsx)(`i`,{style:{flex:n,background:Nw[e[1]]}},t)}),u>.012&&(0,b.jsx)(`i`,{style:{flex:u,background:`var(--rule)`}})]}),(0,b.jsxs)(`p`,{className:`mb-1.5 text-meta text-[var(--dim)]`,children:[(0,b.jsxs)(`span`,{className:`font-mono text-[var(--on)]`,children:[Math.round(l*100),`%`]}),` of the file is inside a symbol`]}),(0,b.jsx)(`div`,{className:`mb-0.5 max-h-[148px] overflow-y-auto`,children:f.map(e=>(0,b.jsxs)(`button`,{"data-symbol-row":`${t}:${e.n}`,onClick:()=>i(t,e.n),className:`grid w-full grid-cols-[8px_1fr_auto] items-center gap-1.5 border-t border-[var(--rule)] py-1 text-left font-mono text-meta first:border-t-0 ${a?`min-h-[34px]`:o?`min-h-[44px]`:``} ${r===e.n?`text-[var(--accent)]`:`text-[var(--on)]`}`,children:[(0,b.jsx)(`i`,{className:`h-2 w-2 rounded-sm`,style:{background:Nw[e.sm[1]]}}),(0,b.jsx)(`span`,{className:`overflow-hidden text-ellipsis whitespace-nowrap`,children:e.sm[0]}),(0,b.jsxs)(`span`,{className:`text-[var(--dim)]`,children:[e.sm[2],`–`,e.sm[3]]})]},e.n))}),d.length>f.length&&(0,b.jsxs)(`div`,{className:`pt-0.5 text-meta text-[var(--dim)]`,children:[`+`,d.length-f.length,` more symbols`]})]})}function WD({label:e,items:t,dataKey:n,onSelectHierSymbol:r,max:i=6}){if(t.length===0)return null;let a=t.slice(0,i),o=t.length-a.length;return(0,b.jsxs)(`p`,{className:`mt-1 text-meta`,"data-symbol-relation":n,children:[(0,b.jsxs)(`span`,{className:`text-[var(--dim)]`,children:[e,`: `]}),a.map((e,t)=>(0,b.jsxs)(`span`,{children:[t>0?`, `:``,(0,b.jsx)(`button`,{type:`button`,"data-relation-target":e.global,className:`font-mono text-[var(--on)] underline decoration-[var(--rule)] underline-offset-2 hover:text-[var(--accent)]`,onClick:()=>r(e.global),children:e.name})]},e.global)),o>0&&(0,b.jsxs)(`span`,{className:`text-[var(--dim)]`,children:[` +`,o,` more`]})]})}function GD({decoded:e,global:t,onSelectHierSymbol:n}){let r=e.globalToLocal.get(t),i=(0,_.useMemo)(()=>r==null?null:hE(e,r),[e,r]);if(r==null||!i)return null;let a=e.raw.symbols[r],o=LT(a),s=VT(a),c=o===0||o===4,l=o===2&&s,u=c&&(i.extends.length>0||i.implements.length>0||i.subclasses.length>0||i.implementedBy.length>0)||l&&i.overriddenBy.length>0;return!s&&!u?null:(0,b.jsxs)(`div`,{className:`mt-1.5`,"data-symbol-relations":!0,children:[s&&(0,b.jsx)(`span`,{className:`inline-block rounded-[6px] bg-[var(--chrome2)] px-1.5 py-0.5 text-label uppercase text-[var(--dim)]`,"data-abstract-tag":!0,children:`abstract`}),c&&(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(WD,{label:`extends`,items:i.extends,dataKey:`extends`,onSelectHierSymbol:n}),(0,b.jsx)(WD,{label:`implements`,items:i.implements,dataKey:`implements`,onSelectHierSymbol:n}),(0,b.jsx)(WD,{label:`subclasses (${i.subclasses.length})`,items:i.subclasses,dataKey:`subclasses`,onSelectHierSymbol:n}),(0,b.jsx)(WD,{label:`implemented by (${i.implementedBy.length})`,items:i.implementedBy,dataKey:`implemented-by`,onSelectHierSymbol:n})]}),l&&(0,b.jsx)(WD,{label:`overridden by (${i.overriddenBy.length})`,items:i.overriddenBy,dataKey:`overridden-by`,onSelectHierSymbol:n})]})}function KD({outline:e,external:t,selHSym:n,onSelectHierSymbol:r,onHoverHierSymbol:i,nested:a=!0,compactRows:o=!1}){if(e.length===0&&t.length===0)return null;let s=(e,t)=>(0,b.jsxs)(`div`,{children:[(0,b.jsxs)(`button`,{type:`button`,"data-outline-row":e.global,onMouseEnter:()=>i?.(e.global),onMouseLeave:()=>i?.(null),onClick:()=>r(e.global),style:{paddingLeft:6+t*12},className:`grid w-full grid-cols-[1fr_auto] items-center gap-1.5 border-t border-[var(--rule)] py-1 text-left font-mono text-meta first:border-t-0 ${o?`min-h-[34px]`:a?``:`min-h-[44px] text-small`} ${n===e.global?`text-[var(--accent)]`:`text-[var(--on)]`}`,children:[(0,b.jsxs)(`span`,{className:`overflow-hidden text-ellipsis whitespace-nowrap ${eE(e.row[2])?`font-semibold`:``}`,children:[$T(e.row,e.children.length,!1),e.bases.length>0&&(0,b.jsxs)(`span`,{className:`font-normal italic text-[var(--dim)]`,"data-outline-bases":!0,children:[` `,`‹ `,e.bases.join(`, `),`›`]}),VT(e.row)&&(0,b.jsx)(`span`,{className:`ml-1 font-sans text-label uppercase text-[var(--dim)]`,"data-outline-abstract":!0,children:`abstract`})]}),(0,b.jsx)(`span`,{className:`text-[var(--dim)]`,title:`incoming references`,children:e.refsIn>0?`← ${e.refsIn}`:``})]}),e.children.map(e=>s(e,t+1))]},e.global);return(0,b.jsxs)(`div`,{className:`mt-2 border-t border-[var(--rule)] pt-1.5`,children:[(0,b.jsx)(`div`,{className:`mb-0.5 text-label uppercase text-[var(--dim)]`,children:`outline`}),e.length>0?(0,b.jsx)(`div`,{className:a?`mb-1.5 max-h-[180px] overflow-y-auto`:`mb-1.5`,"data-outline-tree":!0,children:e.map(e=>s(e,0))}):(0,b.jsx)(`p`,{className:`mb-1.5 text-meta text-[var(--dim)]`,children:`no top-level symbols`}),t.length>0&&(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(`div`,{className:`mb-0.5 text-label uppercase text-[var(--dim)]`,children:`external references`}),(0,b.jsx)(`div`,{className:a?`mb-1.5 max-h-[140px] overflow-y-auto`:`mb-1.5`,children:t.map(e=>(0,b.jsxs)(`div`,{className:`border-t border-[var(--rule)] py-1 font-mono text-meta first:border-t-0`,children:[(0,b.jsx)(`div`,{className:`font-semibold text-[var(--on)]`,children:$T(e.from.row,e.from.children.length,!1)}),e.targets.slice(0,8).map(e=>(0,b.jsxs)(`div`,{className:`flex justify-between gap-2 text-[var(--dim)]`,children:[(0,b.jsx)(`span`,{className:`overflow-hidden text-ellipsis whitespace-nowrap`,children:e.label}),(0,b.jsx)(`span`,{children:e.count})]},e.key)),e.targets.length>8&&(0,b.jsxs)(`div`,{className:`font-sans text-[var(--dim)]`,children:[`+`,e.targets.length-8,` more`]})]},e.from.global))})]}),(0,b.jsx)(`p`,{className:`text-meta text-[var(--dim)]`,children:`Method references are under-counted: calls through instances and inherited methods aren't resolved.`})]})}function qD({grouping:e,auto:t,minDepth:n,maxDepth:r,onDepth:i,variant:a=`float`}){return a===`sheet`?(0,b.jsxs)(`section`,{"aria-label":`Package legend`,"data-package-legend":!0,"data-package-expanded":`true`,className:`mt-2 text-meta text-[var(--dim)]`,children:[(0,b.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,b.jsx)(`span`,{className:`mr-auto text-small text-[var(--on)]`,children:`Folder depth`}),(0,b.jsx)(`button`,{type:`button`,"aria-label":`Decrease package depth`,disabled:e.depth<=n,onClick:()=>i(e.depth-1),className:`h-11 w-11 rounded-[12px] border border-[var(--rule)] bg-[var(--chrome2)] text-body text-[var(--on)] disabled:opacity-30`,children:`−`}),(0,b.jsxs)(`span`,{className:`min-w-[72px] text-center font-mono text-small`,"data-package-depth":!0,children:[e.depth,t?` · auto`:``]}),(0,b.jsx)(`button`,{type:`button`,"aria-label":`Increase package depth`,disabled:e.depth>=r,onClick:()=>i(e.depth+1),className:`h-11 w-11 rounded-[12px] border border-[var(--rule)] bg-[var(--chrome2)] text-body text-[var(--on)] disabled:opacity-30`,children:`+`})]}),(0,b.jsx)(`div`,{className:`mt-2`,"data-package-groups":!0,children:e.groups.map(e=>(0,b.jsxs)(`div`,{className:`grid min-h-[36px] grid-cols-[12px_1fr_auto] items-center gap-2 border-t border-[var(--rule)] first:border-t-0`,children:[(0,b.jsx)(`i`,{className:`h-3 w-3 rounded-sm`,style:{background:e.color}}),(0,b.jsx)(`span`,{className:`overflow-hidden text-ellipsis whitespace-nowrap font-mono text-[var(--on)]`,children:e.other?`other`:rs(e.path)}),(0,b.jsx)(`span`,{className:`font-mono`,children:e.count})]},e.path??`other`))})]}):(0,b.jsxs)(`section`,{"aria-label":`Package legend`,"data-package-legend":!0,"data-package-expanded":`true`,className:`glass w-[240px] rounded-[12px] px-2.5 py-2 text-meta text-[var(--dim)]`,children:[(0,b.jsxs)(`div`,{className:`mb-1.5 flex items-center gap-1.5`,children:[(0,b.jsx)(`b`,{className:`mr-auto text-label uppercase text-[var(--on)]`,children:`packages`}),(0,b.jsx)(`button`,{type:`button`,"aria-label":`Decrease package depth`,disabled:e.depth<=n,onClick:()=>i(e.depth-1),className:`h-6 w-6 rounded border border-[var(--rule)] text-[12px] text-[var(--on)] disabled:opacity-30 touch:h-11 touch:w-11`,children:`−`}),(0,b.jsxs)(`span`,{className:`min-w-[50px] text-center`,"data-package-depth":!0,children:[`depth `,e.depth,t?` · auto`:``]}),(0,b.jsx)(`button`,{type:`button`,"aria-label":`Increase package depth`,disabled:e.depth>=r,onClick:()=>i(e.depth+1),className:`h-6 w-6 rounded border border-[var(--rule)] text-[12px] text-[var(--on)] disabled:opacity-30 touch:h-11 touch:w-11`,children:`+`})]}),(0,b.jsx)(`div`,{className:`max-h-[190px] overflow-y-auto`,"data-package-groups":!0,children:e.groups.map(e=>(0,b.jsxs)(`div`,{className:`grid grid-cols-[8px_1fr_auto] items-center gap-1.5 border-t border-[var(--rule)] py-0.5 first:border-t-0`,children:[(0,b.jsx)(`i`,{className:`h-2 w-2 rounded-sm`,style:{background:e.color}}),(0,b.jsx)(`span`,{className:`overflow-hidden text-ellipsis whitespace-nowrap font-mono text-[var(--on)]`,children:e.other?`other`:rs(e.path)}),(0,b.jsx)(`span`,{className:`font-mono`,children:e.count})]},e.path??`other`))})]})}function JD(e,t){let n=[];for(let r=0;r<e.N.length;r++)if(e.F[r].toLowerCase().includes(t)){let i=e.F[r].split(`/`).pop().toLowerCase(),a=i.replace(/\.[a-z]+$/,``)===t?-1e3:!i.startsWith(t)*100;n.push({i:r,s:null,rank:a-co(e,r)})}for(let r in e.S??{}){let i=+r;(e.S[r]??[]).forEach((r,a)=>{let o=r[0].toLowerCase();if(o.includes(t)){let s=(e.U?.[`${i}:${a}`]??[]).length,c=o===t?-2e3:!o.startsWith(t)*100;n.push({i,s:a,rank:c-s*2-(r[3]-r[2])/20})}})}return n.sort((e,t)=>e.rank-t.rank).slice(0,14)}function YD(e,t){let n=t.trim().toLowerCase();if(!n)return[];let r=e.toLowerCase(),i=[];for(let e=r.indexOf(n);e>=0;e=r.indexOf(n,e+n.length))i.push([e,e+n.length]);return i}function XD(e,t,n){let r=[];for(let[i,a]of e){let e=Math.max(i,t),o=Math.min(a,n);e<o&&r.push([e-t,o-t])}return r}function ZD(e,t){let n=[],r=0;for(let[i,a]of[...t].sort((e,t)=>e[0]-t[0]))i<r||a>e.length||i>=a||(i>r&&n.push({text:e.slice(r,i),hit:!1}),n.push({text:e.slice(i,a),hit:!0}),r=a);return(r<e.length||n.length===0)&&n.push({text:e.slice(r),hit:!1}),n}function QD(e,t){let n=t.trim().toLowerCase();if(!n)return[];let r=[];for(let t of Object.keys(e.districts)){let i=e.districts[t];if(i.class===`unconnected`)continue;let a=(e.names[t]??``).toLowerCase(),o=a.indexOf(n);if(o<0)continue;let s=RegExp(`(^|[^a-z0-9])${n.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}`).test(a),c=a===n?0:o===0?1:s?2:3;r.push({d:Number(t),tier:c,size:i.size})}return r.sort((e,t)=>e.tier-t.tier||t.size-e.size||e.d-t.d),r.slice(0,5).map(e=>e.d)}function $D(e,t,n){return e===1?t:n}function eO(e){let t=e.lastIndexOf(`/`);return t<0?``:e.slice(0,t+1)}function tO(e){return e.slice(e.lastIndexOf(`/`)+1)}var nO={func:`function`,const:`constant`};function rO(e){let t=Mw[e]??`symbol`;return nO[t]??t}function iO(e,t,n){let r=e.names[String(t)]??`district ${t}`,i=e.districts[String(t)]?.size??0;return{key:`d${t}`,pick:{kind:`district`,d:t},name:r,detail:``,aside:`${i} ${$D(i,`file`,`files`)}`,nameMarks:YD(r,n),detailMarks:[]}}function aO(e,t,n){let r=e.F[t],i=eO(r),a=tO(r),o=YD(r,n);return{key:`f${t}`,pick:{kind:`file`,i:t},name:a,detail:i||`(repo root)`,aside:``,nameMarks:XD(o,i.length,r.length),detailMarks:i?XD(o,0,i.length):[]}}function oO(e,t,n={}){let r=t.trim().toLowerCase(),i=[];if(!r&&!n.filesOnly){let t=Object.keys(e.districts).filter(t=>e.districts[t].class!==`unconnected`).sort((t,n)=>e.districts[n].size-e.districts[t].size||Number(t)-Number(n)).slice(0,6).map(t=>iO(e,Number(t),``));return t.length&&i.push({kind:`district`,label:`Largest districts`,items:t}),{query:r,groups:i,flat:i.flatMap(e=>e.items)}}let a=n.filesOnly?[]:QD(e,r).map(t=>iO(e,t,r)),o=[],s=[];for(let t of JD(e,r)){if(t.s==null){o.push(aO(e,t.i,r));continue}if(n.filesOnly)continue;let i=e.S?.[String(t.i)]?.[t.s];if(!i)continue;let a=e.F[t.i],c=eO(a),l=tO(a),u=tO(c.slice(0,-1)),d=u?`${u}/${l}`:l;s.push({key:`s${t.i}:${t.s}`,pick:{kind:`symbol`,i:t.i,s:t.s},name:i[0],detail:`${rO(i[1])} · ${d}:${i[2]}`,aside:``,nameMarks:YD(i[0],r),detailMarks:[]})}return a.length&&i.push({kind:`district`,label:$D(a.length,`District`,`Districts`),items:a}),o.length&&i.push({kind:`file`,label:$D(o.length,`File`,`Files`),items:o}),s.length&&i.push({kind:`symbol`,label:$D(s.length,`Symbol`,`Symbols`),items:s}),{query:r,groups:i,flat:i.flatMap(e=>e.items)}}function sO(e,t,n,r=!1){let i=t.trim().toLowerCase(),a=oO(e,i,{filesOnly:r}).groups.map(e=>({...e}));if(!r){let e=n.flatMap(e=>{let t=YD(e.label,i),n=e.detail??``,r=YD(n,i);return i&&t.length===0&&r.length===0?[]:[{key:`command:${e.id}`,commandId:e.id,name:e.label,detail:n,aside:e.shortcut??``,nameMarks:t,detailMarks:r}]});e.length&&a.push({kind:`command`,label:`Commands`,items:e})}return{query:i,groups:a,flat:a.flatMap(e=>e.items)}}function cO(e){return e===`ArrowDown`||e===`ArrowUp`||e===`Enter`||e===`Escape`}function lO(e,t,n){if(n===`Escape`)return{type:`close`};if(t<=0)return n===`Enter`?{type:`none`}:{type:`move`,cursor:-1};let r=e>=0&&e<t?e:-1;switch(n){case`ArrowDown`:return{type:`move`,cursor:r<0?0:(r+1)%t};case`ArrowUp`:return{type:`move`,cursor:r<0?t-1:(r-1+t)%t};case`Enter`:return{type:`pick`,index:r<0?0:r}}}var uO=`Search districts, files and symbols`,dO=`Districts, files, classes…`,fO=`Search districts, files, classes, or type a command`;function pO({doc:e,onPick:t,variant:n=`float`,onClose:r,autoFocus:i=!1,touch:a=!1,commands:o=[],onCommand:s,pathMode:c=!1,pathEnd:l=`destination`}){let[u,d]=(0,_.useState)(``),[f,p]=(0,_.useState)(-1),[m,h]=(0,_.useState)(!1),g=(0,_.useMemo)(()=>n===`palette`?sO(e,u,o,c):oO(e,u),[e,u,n,o,c]),v=(0,_.useRef)(null),y=(0,_.useRef)(null),x=(0,_.useRef)(null),S=(0,_.useId)(),C=e=>`${S}-o${e}`,w=n===`overlay`,T=n===`palette`,E=w||T||m;(0,_.useEffect)(()=>{i&&(v.current?.focus(),h(!0))},[i]),(0,_.useEffect)(()=>{f<0||document.getElementById(C(f))?.scrollIntoView({block:`nearest`})},[f]);function D(){let e=x.current;x.current=null,e instanceof HTMLElement&&e!==v.current&&e!==document.body&&e.isConnected?e.focus({preventScroll:!0}):v.current?.blur()}function O(){if(p(-1),w||T){r?.();return}h(!1),x.current&&D(),r?.()}function k(e){if(d(``),p(-1),`commandId`in e){if(!T)return;s?.(e.commandId),r?.();return}if(T){t(e.pick),r?.();return}w||(h(!1),D()),t(e.pick)}function ee(e){if(!cO(e.key))return;if(!E&&(e.key===`ArrowDown`||e.key===`ArrowUp`)){e.preventDefault(),h(!0);return}if(!E&&e.key===`Escape`)return;let t=lO(f,g.flat.length,e.key);t.type!==`none`&&(e.preventDefault(),t.type===`move`?p(t.cursor):t.type===`pick`?k(g.flat[t.index]):O())}(0,_.useEffect)(()=>{if(n!==`float`)return;let e=e=>{if(e.key!==`/`||e.ctrlKey||e.metaKey||e.altKey||e.defaultPrevented)return;let t=e.target;t&&(t.isContentEditable||t.closest(`input, textarea, select, [contenteditable]`))||(e.preventDefault(),x.current=document.activeElement,v.current?.focus(),h(!0))};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[n]),(0,_.useEffect)(()=>{if(n!==`float`||!m)return;let e=e=>{y.current&&!y.current.contains(e.target)&&(h(!1),p(-1),x.current=null)};return document.addEventListener(`pointerdown`,e,!0),()=>document.removeEventListener(`pointerdown`,e,!0)},[n,m]);let A={ref:v,role:`combobox`,"aria-label":c?`Search files for path ${l}`:uO,"aria-expanded":E,"aria-controls":S,"aria-autocomplete":`list`,"aria-activedescendant":E&&f>=0&&f<g.flat.length?C(f):void 0,value:u,placeholder:dO,autoComplete:`off`,autoCapitalize:`off`,autoCorrect:`off`,spellCheck:!1,enterKeyHint:`search`,"data-search-input":``,onChange:e=>{d(e.target.value),p(-1),w||h(!0)},onKeyDown:ee},j=(0,b.jsx)(_O,{id:S,results:g,value:u,cursor:f,optionId:C,variant:n,onPick:k,onHover:w?void 0:p});return T?(0,b.jsxs)(`div`,{className:`absolute inset-0 z-[70] flex items-start justify-center bg-[var(--chrome-scrim)] px-4 pt-[14vh]`,"data-desktop-search":!0,children:[(0,b.jsx)(`button`,{type:`button`,"aria-label":`Close search`,tabIndex:-1,onClick:()=>O(),className:`absolute inset-0 h-full w-full cursor-default`}),(0,b.jsxs)(`section`,{role:`dialog`,"aria-modal":`true`,"aria-label":`Search and commands`,"data-search-palette":!0,className:`relative z-[1] flex w-[min(640px,100%)] flex-col overflow-hidden rounded-[16px] border border-[var(--chrome-glass-border)] bg-[var(--chrome-solid)] text-[var(--on)] shadow-[var(--chrome-shadow)]`,style:{maxHeight:`min(70vh, calc(100vh - 32px))`},onKeyDown:e=>{if(!e.defaultPrevented){if(e.key===`Escape`){e.preventDefault(),e.stopPropagation(),O();return}if(e.key===`Tab`){let t=Array.from(e.currentTarget.querySelectorAll(`input:not([disabled]), button:not([disabled]):not([tabindex='-1'])`)),n=t[0],r=t[t.length-1];e.shiftKey&&document.activeElement===n?(e.preventDefault(),r?.focus()):!e.shiftKey&&document.activeElement===r&&(e.preventDefault(),n?.focus())}}},children:[(0,b.jsxs)(`label`,{className:`flex h-14 shrink-0 items-center gap-2.5 border-b border-[var(--chrome-glass-border)] px-4 text-[var(--dim)]`,children:[(0,b.jsx)($u,{size:18}),c&&(0,b.jsx)(`span`,{"data-path-destination-tag":!0,className:`shrink-0 whitespace-nowrap rounded-[6px] px-2 py-[3px] text-meta text-[var(--accent)]`,style:{background:`color-mix(in srgb, var(--accent) 12%, transparent)`},children:l===`start`?`Path start`:`Path destination`}),(0,b.jsx)(`input`,{...A,autoFocus:!0,type:`text`,className:`h-10 min-w-0 flex-1 bg-transparent text-[16px] text-[var(--on)] outline-none placeholder:text-[var(--dim)]`,placeholder:c?l===`start`?`Search files for the start`:`Search files for the destination`:fO}),u&&(0,b.jsx)(`button`,{type:`button`,"aria-label":`Clear search`,"data-search-clear":!0,onClick:()=>{d(``),p(-1),v.current?.focus()},className:`flex h-8 w-8 shrink-0 items-center justify-center rounded-[8px] hover:bg-[var(--chrome-hover)] hover:text-[var(--on)]`,children:(0,b.jsx)(cd,{})}),(0,b.jsx)(mO,{children:`esc`})]}),(0,b.jsx)(`div`,{"data-search-results":!0,className:`min-h-0 flex-1 overflow-y-auto p-1.5`,style:{overscrollBehavior:`contain`,scrollbarWidth:`thin`},children:j}),(0,b.jsxs)(`div`,{"aria-hidden":`true`,className:`flex shrink-0 items-center gap-4 border-t border-[var(--chrome-glass-border)] px-4 py-2.5 text-meta text-[var(--dim)]`,children:[(0,b.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,b.jsx)(mO,{children:`↑`}),(0,b.jsx)(mO,{children:`↓`}),` move`]}),(0,b.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,b.jsx)(mO,{children:`↵`}),` open`]}),(0,b.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,b.jsx)(mO,{children:`esc`}),` close`]})]})]})]}):w?(0,b.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col`,children:[(0,b.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1.5 border-b border-[var(--rule)] px-3 pb-2.5`,style:{paddingTop:`calc(12px + env(safe-area-inset-top, 0px))`},children:[(0,b.jsx)(`button`,{type:`button`,"aria-label":`Close search`,onClick:()=>O(),className:`flex h-11 w-11 shrink-0 items-center justify-center rounded-full text-[var(--on)] outline-none focus-visible:ring-2 focus-visible:ring-[var(--accent)]`,children:(0,b.jsx)(sd,{})}),(0,b.jsxs)(`div`,{className:`flex h-12 min-w-0 flex-1 items-center gap-1 rounded-[24px] border-2 border-[var(--accent)] bg-[var(--chrome2)] pl-3.5 pr-0.5`,children:[(0,b.jsx)(`input`,{...A,autoFocus:!0,type:`text`,className:`h-10 min-w-0 flex-1 bg-transparent text-body text-[var(--on)] outline-none placeholder:text-[var(--dim)]`}),u&&(0,b.jsx)(`button`,{type:`button`,"aria-label":`Clear search`,"data-search-clear":!0,onClick:()=>{d(``),p(-1),v.current?.focus()},className:`flex h-11 w-11 shrink-0 items-center justify-center rounded-full outline-none focus-visible:ring-2 focus-visible:ring-[var(--accent)]`,children:(0,b.jsx)(`span`,{className:`flex h-9 w-9 items-center justify-center rounded-full bg-[var(--rule)] text-[var(--on)]`,children:(0,b.jsx)(cd,{})})})]})]}),(0,b.jsx)(`div`,{"data-search-results":!0,className:`min-h-0 flex-1 overflow-y-auto`,style:{touchAction:`pan-y`,overscrollBehavior:`contain`,paddingBottom:`calc(20px + env(safe-area-inset-bottom, 0px))`},children:j})]}):(0,b.jsxs)(`div`,{ref:y,"data-search-box":!0,className:`relative w-full`,onBlur:e=>{m&&!y.current?.contains(e.relatedTarget)&&(h(!1),p(-1))},children:[(0,b.jsxs)(`label`,{className:`flex w-full items-center gap-2 rounded-[10px] border border-[var(--rule)] bg-[var(--canvas)] px-2.5 text-[var(--dim)] focus-within:ring-2 focus-within:ring-[var(--accent)] ${a?`h-11`:`h-9`}`,children:[(0,b.jsx)($u,{size:16}),(0,b.jsx)(`input`,{...A,type:`text`,onFocus:()=>h(!0),className:`h-full min-w-0 flex-1 bg-transparent text-small text-[var(--on)] outline-none placeholder:text-[var(--dim)]`}),(0,b.jsx)(`kbd`,{"aria-hidden":`true`,className:`rounded-[5px] border border-[var(--rule)] px-1.5 font-mono text-label font-normal text-[var(--dim)] max-[899px]:hidden`,children:`/`})]}),m&&(0,b.jsx)(`div`,{"data-search-dropdown":!0,className:`absolute left-0 top-full mt-1 max-h-[min(460px,calc(100vh-140px))] w-full min-w-[min(360px,calc(100vw-24px))] overflow-y-auto rounded-[10px] border border-[var(--rule)] bg-[var(--chrome)] pb-1 shadow-lg`,style:{overscrollBehavior:`contain`},children:j})]})}function mO({children:e}){return(0,b.jsx)(`kbd`,{className:`inline-flex h-5 min-w-5 shrink-0 items-center justify-center rounded-[5px] border border-[var(--chrome-glass-border)] bg-[var(--chrome-key)] px-[5px] font-mono text-[11px] font-normal leading-none text-[var(--dim)]`,children:e})}function hO({text:e,marks:t,accent:n=!1}){return(0,b.jsx)(b.Fragment,{children:ZD(e,t).map((e,t)=>e.hit?(0,b.jsx)(`mark`,{className:`bg-transparent ${n?`font-semibold text-[var(--accent)]`:`font-bold text-[var(--on)]`}`,children:e.text},t):(0,b.jsx)(`span`,{children:e.text},t))})}var gO={district:ld,file:ud,symbol:dd};function _O({id:e,results:t,value:n,cursor:r,optionId:i,variant:a,onPick:o,onHover:s}){let c=a===`overlay`,l=a===`palette`,u=-1;return(0,b.jsxs)(b.Fragment,{children:[!t.query&&(0,b.jsx)(`p`,{"data-search-state":`empty`,className:l?`sr-only`:`text-[var(--dim)] ${c?`px-5 pt-4 text-small`:`px-3 pt-2.5 text-meta`}`,children:a===`palette`?t.groups.some(e=>e.kind===`command`)?`Type a district, file, symbol or command.`:`Type a file path to choose a destination.`:`Type a district, file, class or function name.`}),t.query&&t.flat.length===0&&(0,b.jsx)(`p`,{"data-search-state":`no-results`,role:`status`,className:`text-[var(--dim)] ${c?`px-5 py-7 text-body`:l?`px-2.5 py-6 text-small`:`px-3 py-3 text-small`}`,children:a===`palette`?n.trim()?`No results for “${n.trim()}”.`:`No files are available as a path destination.`:`No district, file or symbol matches “${n.trim()}”.`}),(0,b.jsx)(`div`,{role:`listbox`,id:e,"aria-label":`Results`,children:t.groups.map(e=>(0,b.jsxs)(`div`,{role:`group`,"aria-label":`${e.label}, ${e.items.length}`,"data-search-group":e.kind,children:[(0,b.jsxs)(`div`,{"aria-hidden":`true`,"data-search-group-header":!0,className:`flex items-baseline justify-between gap-3 uppercase text-[var(--dim)] ${c?`px-5 pb-1.5 pt-3.5 text-label`:l?`px-2.5 pb-1 pt-2.5 text-[11px] font-semibold tracking-[0.06em]`:`px-3 pb-1 pt-2.5 text-label`}`,children:[(0,b.jsx)(`span`,{children:e.label}),(0,b.jsx)(`span`,{className:`font-mono tabular-nums`,children:e.items.length})]}),e.items.map(e=>{u++;let t=u,n=t===r,a=`commandId`in e,d=a?`command`:e.pick.kind,f=a?null:gO[e.pick.kind],p=!a&&e.pick.kind!==`district`;return(0,b.jsxs)(`button`,{type:`button`,role:`option`,id:i(t),"aria-selected":n,tabIndex:-1,"data-search-option":d,"data-search-key":e.key,onMouseDown:e=>e.preventDefault(),onMouseMove:s?()=>t!==r&&s(t):void 0,onClick:()=>o(e),className:`flex w-full items-center text-left text-[var(--on)] outline-none ${c?`min-h-[56px] gap-3 border-b border-[var(--rule)] px-5 py-2`:l?`min-h-[44px] gap-3 rounded-[9px] px-2.5 py-1.5`:`min-h-[40px] gap-2.5 px-3 py-1.5 touch:min-h-[44px]`}`,style:n?{background:l?`var(--chrome-hover)`:`color-mix(in srgb, var(--accent) 14%, transparent)`}:void 0,children:[l?(0,b.jsx)(`span`,{"aria-hidden":`true`,className:`flex h-7 w-7 shrink-0 items-center justify-center rounded-[7px] bg-[var(--chrome-hover)] text-[var(--dim)]`,children:f?(0,b.jsx)(f,{size:15}):(0,b.jsx)(`span`,{className:`font-mono text-[14px] leading-none`,children:`›`})}):(0,b.jsx)(`span`,{className:`shrink-0 text-[var(--dim)]`,children:f?(0,b.jsx)(f,{size:c?20:16}):null}),(0,b.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-px`,children:[(0,b.jsx)(`span`,{"data-search-name":!0,className:`[overflow-wrap:anywhere] ${l?p?`font-mono text-[13.5px] leading-5`:`text-[14px] leading-5`:p?`font-mono ${c?`text-[15px] leading-[21px]`:`text-small`}`:c?`text-body`:`text-small`}`,children:(0,b.jsx)(hO,{text:e.name,marks:e.nameMarks,accent:l})}),e.detail&&(0,b.jsx)(`span`,{"data-search-detail":!0,className:`${a?``:`font-mono`} ${l?a?`text-[12px]`:`text-[11.5px]`:`text-meta`} text-[var(--dim)] [overflow-wrap:anywhere]`,children:(0,b.jsx)(hO,{text:e.detail,marks:e.detailMarks,accent:l})})]}),a&&e.aside?(0,b.jsx)(mO,{children:e.aside}):e.aside?(0,b.jsx)(`span`,{className:`shrink-0 font-mono text-meta text-[var(--dim)]`,children:e.aside}):l?(0,b.jsx)(`span`,{"aria-hidden":`true`,className:`shrink-0 text-[11px] text-[var(--dim)] ${n?`opacity-100`:`opacity-0`}`,children:`↵`}):null]},e.key)})]},e.kind+e.label))})]})}var vO=[{type:`overview`}];function yO(e,t){switch(t.type){case`overview`:return vO;case`map-district`:return[{type:`overview`},{type:`district`,district:t.district}];case`map-file`:return[{type:`overview`},{type:`district`,district:t.district},{type:`file`,district:t.district,file:t.file}];case`map-symbol`:return[{type:`overview`},{type:`district`,district:t.district},{type:`file`,district:t.district,file:t.file},{type:`symbol`,district:t.district,file:t.file,label:t.label,...t.symbol==null?{}:{symbol:t.symbol},...t.hierarchicalSymbol==null?{}:{hierarchicalSymbol:t.hierarchicalSymbol}}];case`push`:return e[e.length-1]?.type===t.view.type?e:[...e,t.view];case`pop`:return e.length>1?e.slice(0,-1):e;case`jump`:return t.index<0||t.index>=e.length?e:e.slice(0,t.index+1)}}function bO(e,t,n=t.repo){return e.map((e,r)=>{let i;switch(e.type){case`overview`:i=n;break;case`district`:i=t.names[String(e.district)]??`District ${e.district}`;break;case`file`:i=t.F[e.file]?.split(`/`).pop()??`File`;break;case`symbol`:i=e.label;break;case`path`:i=`Path`;break;case`quality`:i=`Map quality`}return{index:r,label:i,type:e.type}})}var xO={py:`Python`,go:`Go`,ts:`TypeScript`,rs:`Rust`},SO={indexed:`indexed by SCIP`,below_min_recall:`the index's recall against the hand-written graph was too low`,indexer_not_found:`the indexer isn't installed`,indexer_spawn_failed:`the indexer could not start`,indexer_failed:`the indexer exited with an error`,no_index_written:`the indexer exited without writing an index`,no_tsconfig:`no tracked tsconfig.json to index`,no_documents:`the index had no documents for this repository`,ingest_failed:`the index could not be read`,no_product_indexer:`no indexer runs for this language in the service`};function CO(e){return SO[e]??e.replace(/_/g,` `)}function wO(e,t){let n=t.path===`scip`;return{language:e,label:xO[e]??e,exact:n,reasonLabel:n?null:CO(t.reason),recallPercent:t.recall==null?null:Math.round(t.recall*100)}}function TO(e){if(e==null)return null;let t=e.references?Object.entries(e.references).sort(([e],[t])=>e.localeCompare(t)).map(([e,t])=>wO(e,t)):[],n=t.filter(e=>e.exact).length,r=t.length===0?`heuristic`:n===t.length?`exact`:n===0?`heuristic`:`partial`;return{status:r,label:r===`exact`?`Exact references`:r===`partial`?`Partly exact`:`Heuristic references`,languages:t}}function EO({overview:e,layer:t,className:n}){let r=cD(e,t);return(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(`h2`,{"data-overview-headline":!0,"data-overview-layer":t,className:n,children:(0,b.jsx)(DO,{text:r.primary})}),r.secondary&&(0,b.jsx)(`p`,{"data-overview-subheadline":!0,className:`mt-1.5 flex flex-wrap gap-x-1 text-meta leading-[1.45] text-[var(--dim)]`,children:r.secondary.split(` · `).map((e,t,n)=>(0,b.jsxs)(`span`,{children:[e,t<n.length-1?` ·`:``]},t))})]})}function DO({text:e}){let t=e.split(/(\d[\d,.]*\s\S+)/);return(0,b.jsx)(b.Fragment,{children:t.map((e,t)=>t%2==1?(0,b.jsx)(`span`,{className:`whitespace-nowrap`,children:e},t):e)})}function OO(e){return e.toLocaleString(`en-US`,{maximumFractionDigits:2})}function kO(e,t){return`${[...e>0?[`${e} small ${e===1?`district`:`districts`}`]:[],...t>0?[`${t} small ${t===1?`island`:`islands`}`]:[]].join(` + `)} not ranked`}function AO(e,t){let n=[...e>0?[`${e} ${e===1?`district`:`districts`}`]:[],...t>0?[`${t} ${t===1?`island`:`islands`}`]:[]];return n.length?n.join(` + `):`No District index span`}var jO=Do.map(e=>[1,3,5].map(t=>parseInt(e.slice(t,t+2),16)));function MO(e){let t=Math.max(0,Math.min(1,Number.isFinite(e)?e:0)),n=t<.5?jO[0]:jO[1],r=t<.5?jO[1]:jO[2],i=t<.5?t*2:(t-.5)*2;return`rgb(${n.map((e,t)=>Math.round(e+(r[t]-e)*i)).join(`,`)})`}function NO(e){let t=e.slice(0,4);if(t.length<=1)return t[0]??`var(--dim)`;let n=100/t.length;return`linear-gradient(90deg, ${t.map((e,t)=>`${e} ${(t*n).toFixed(2)}% ${((t+1)*n).toFixed(2)}%`).join(`, `)})`}var PO=`linear-gradient(90deg, var(--chrome-ramp-low), var(--chrome-ramp-mid), var(--chrome-ramp-high))`;function FO({value:e,sheet:t}){let n=Math.max(.04,Math.min(1,Number.isFinite(e)?e:0));return(0,b.jsx)(`span`,{"aria-hidden":`true`,className:`${t?`w-12`:`w-10`} h-1 shrink-0 overflow-hidden rounded-full bg-[var(--rule)]`,children:(0,b.jsx)(`span`,{className:`block h-full rounded-full`,style:{width:`${n*100}%`,backgroundImage:PO,backgroundSize:`${100/n}% 100%`}})})}function IO({sheet:e,touch:t,swatch:n,name:r,nameMono:i=!1,meta:a,metaMono:o=!1,value:s,valueTitle:c,bar:l,districtRow:u,fileRow:d,packageRow:f,packageDistricts:p,onHighlight:m,onSelect:h}){return(0,b.jsxs)(`button`,{type:`button`,"data-overview-district-row":u,"data-overview-file":d,"data-layer-overview-file-row":d,"data-package-overview-row":f,"data-overview-districts":p,onMouseEnter:m?()=>m(!0):void 0,onMouseLeave:m?()=>m(!1):void 0,onFocus:m?()=>m(!0):void 0,onBlur:m?()=>m(!1):void 0,onClick:h,className:`flex w-full shrink-0 items-center text-left ${e?`min-h-[64px] gap-3 border-b border-[var(--rule)] px-5 py-2.5 active:bg-[var(--chrome-hover)]`:`${t?`min-h-[64px]`:`h-[50px] min-h-[50px]`} gap-2.5 rounded-[10px] px-2.5 py-1.5 hover:bg-[var(--chrome-hover)] outline-none focus-visible:bg-[color-mix(in_srgb,var(--accent)_12%,transparent)]`}`,children:[(0,b.jsx)(`i`,{"aria-hidden":`true`,"data-package-overview-swatch":f,className:`h-2.5 w-2.5 shrink-0 rounded-[3px]`,style:{background:n}}),(0,b.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[(0,b.jsx)(`span`,{className:`truncate ${i?`font-mono font-medium ${e?`text-[15px] leading-[22px]`:`text-[13px] leading-5`}`:e?`text-row`:`text-small font-semibold`}`,children:r}),(0,b.jsx)(`span`,{className:`truncate text-meta text-[var(--dim)] ${o?`font-mono`:``}`,children:a})]}),l!=null&&(0,b.jsx)(FO,{value:l,sheet:e}),s!=null&&(0,b.jsx)(`span`,{title:c,className:`min-w-[4ch] shrink-0 text-right font-mono tabular-nums text-[var(--dim)] ${e?`text-small`:`text-meta`}`,children:s})]})}function LO({title:e,sheet:t,children:n,first:r=!1}){return(0,b.jsxs)(`section`,{className:t||r?``:`mt-4`,"data-layer-overview-section":e.toLowerCase().replaceAll(` `,`-`),children:[t?(0,b.jsx)(`h3`,{className:`px-5 pb-2.5 pt-5 text-[15px] font-semibold`,children:e}):(0,b.jsx)(`div`,{className:`flex min-h-8 items-center`,children:(0,b.jsx)(`h3`,{className:`text-small font-semibold`,children:e})}),(0,b.jsx)(`div`,{className:t?`flex flex-col border-t border-[var(--rule)]`:`-mx-2 mt-1 flex flex-col gap-px`,children:n})]})}function RO({sheet:e,children:t}){return(0,b.jsx)(`p`,{className:`text-meta text-[var(--dim)] ${e?`px-5 py-3`:`px-2.5 pb-1 pt-2`}`,children:t})}function zO(e){let t=e.lastIndexOf(`/`);return t<0?{name:e,dir:`(repo root)`}:{name:e.slice(t+1),dir:e.slice(0,t)}}function BO({doc:e,overview:t,layer:n,touch:r,sheet:i=!1,onSelectDistrict:a,onSelectFile:o,onHighlightDistricts:s,onFrameDistricts:c}){let l=e=>s?.(e),u=e=>s?t=>l(t?e:null):void 0,d=(0,_.useMemo)(()=>{let t=1,n=1,r=new Map;return e.N.forEach((e,i)=>{typeof e[5]==`number`&&e[5]>t&&(t=e[5]),typeof e[4]==`number`&&e[4]>n&&(n=e[4]);let a=r.get(e[0]);a?a.push(i):r.set(e[0],[i])}),{maxCh:t,maxCx:n,members:r}},[e]),f=(t,n)=>{let r=e.N[t]?.[n];return MO(typeof r==`number`?r/(n===5?d.maxCh:d.maxCx):0)},p=(t,n)=>{let r=(d.members.get(t)??[]).map(t=>e.N[t]?.[n]).filter(e=>typeof e==`number`&&Number.isFinite(e)).sort((e,t)=>e-t);return r.length===0?`var(--dim)`:MO(r[Math.floor((r.length-1)/2)]/(n===5?d.maxCh:d.maxCx))},m=new Map(t.package.groups.map(e=>[e.path,e.color]));return(0,b.jsxs)(`div`,{"data-layer-overview-index":n,children:[n===`c`&&(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)(LO,{first:!0,sheet:i,title:`Districts by commits`,children:[t.churn.districts.map(e=>(0,b.jsx)(IO,{sheet:i,touch:r,districtRow:e.district,swatch:p(e.district,5),name:e.name,meta:`${e.island?`Island · `:``}${OO(e.commitsPerFile)} per file · ${e.knownFiles.toLocaleString(`en-US`)} files`,value:OO(e.commits),valueTitle:`${OO(e.commits)} file commits`,bar:e.bar,onHighlight:u([e.district]),onSelect:()=>{l(null),a(e.district)}},e.district)),(t.churn.smallDistrictCount>0||t.churn.smallIslandCount>0)&&(0,b.jsx)(RO,{sheet:i,children:kO(t.churn.smallDistrictCount,t.churn.smallIslandCount)}),t.churn.districts.length===0&&t.churn.smallDistrictCount===0&&t.churn.smallIslandCount===0&&(0,b.jsx)(RO,{sheet:i,children:`Churn values are not present in this map.`})]}),(0,b.jsxs)(LO,{sheet:i,title:`Most changed files`,children:[t.churn.files.map(t=>{let{name:n,dir:a}=zO(e.F[t.file]);return(0,b.jsx)(IO,{sheet:i,touch:r,fileRow:t.file,swatch:f(t.file,5),name:n,nameMono:!0,meta:a,metaMono:!0,value:OO(t.value),valueTitle:`${OO(t.value)} commits`,onHighlight:u([t.district]),onSelect:()=>{l(null),o(t.file)}},t.file)}),t.churn.files.length===0&&(0,b.jsx)(RO,{sheet:i,children:`Churn values are not present in this map.`})]})]}),n===`x`&&(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)(LO,{first:!0,sheet:i,title:`Districts by median complexity`,children:[t.complexity.districts.map(e=>(0,b.jsx)(IO,{sheet:i,touch:r,districtRow:e.district,swatch:p(e.district,4),name:e.name,meta:`${e.island?`Island · `:``}${e.knownFiles.toLocaleString(`en-US`)} files`,value:OO(e.median),valueTitle:`Median complexity ${OO(e.median)}`,bar:t.complexity.districts[0]?.median?e.median/t.complexity.districts[0].median:0,onHighlight:u([e.district]),onSelect:()=>{l(null),a(e.district)}},e.district)),(t.complexity.smallDistrictCount>0||t.complexity.smallIslandCount>0)&&(0,b.jsx)(RO,{sheet:i,children:kO(t.complexity.smallDistrictCount,t.complexity.smallIslandCount)}),t.complexity.districts.length===0&&t.complexity.smallDistrictCount===0&&t.complexity.smallIslandCount===0&&(0,b.jsx)(RO,{sheet:i,children:`Complexity values are not present in this map.`})]}),(0,b.jsxs)(LO,{sheet:i,title:`Most complex files`,children:[t.complexity.files.map(t=>{let{name:n,dir:a}=zO(e.F[t.file]);return(0,b.jsx)(IO,{sheet:i,touch:r,fileRow:t.file,swatch:f(t.file,4),name:n,nameMono:!0,meta:a,metaMono:!0,value:OO(t.value),valueTitle:`Complexity ${OO(t.value)}`,onHighlight:u([t.district]),onSelect:()=>{l(null),o(t.file)}},t.file)}),t.complexity.files.length===0&&(0,b.jsx)(RO,{sheet:i,children:`Complexity values are not present in this map.`})]})]}),n===`p`&&(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)(LO,{first:!0,sheet:i,title:`Packages`,children:[t.package.groups.map(e=>(0,b.jsx)(IO,{sheet:i,touch:r,packageRow:e.path??`other`,packageDistricts:e.districtIds.join(`,`),swatch:e.color,name:e.other?`Other packages`:rs(e.path??`.`),nameMono:!e.other,meta:`${e.language?`${lD(e.language)} · `:``}${AO(e.districtCount,e.islandCount)}`,value:e.files.toLocaleString(`en-US`),valueTitle:`${e.files.toLocaleString(`en-US`)} files`,onHighlight:i?void 0:u(e.districtIds),onSelect:()=>{l(null),c(e.districtIds)}},e.path??`other`)),t.package.groups.length===0&&(0,b.jsx)(RO,{sheet:i,children:`Package paths are not present in this map.`})]}),(0,b.jsxs)(LO,{sheet:i,title:`Districts and islands that mix packages`,children:[t.package.mixedDistricts.map(e=>(0,b.jsx)(IO,{sheet:i,touch:r,districtRow:e.district,swatch:NO(e.packages.map(e=>m.get(e)??`var(--dim)`)),name:e.name,meta:`${e.island?`Island · `:``}${e.packages.map(e=>e==null?`Other packages`:rs(e)).join(` · `)}`,value:String(e.packages.length),valueTitle:`${e.packages.length} packages`,onHighlight:u([e.district]),onSelect:()=>{l(null),a(e.district)}},e.district)),t.package.mixedDistricts.length===0&&(0,b.jsx)(RO,{sheet:i,children:`No district mixes packages.`})]})]})]})}function VO(e,t){return(0,_.useMemo)(()=>sD(e,t),[e,t])}function HO({doc:e,sel:t,selSym:n,selD:r,selHSym:i,symbolsDoc:a,onSelectRepo:o,onSelectDistrict:s,onSelectFile:c,onSelectHierSymbol:l}){let u=(0,_.useMemo)(()=>a?JT(a):null,[a]),d=(0,_.useMemo)(()=>{if(!u||i==null)return null;let e=u.globalToLocal.get(i);if(e==null)return null;let t=[...ZT(u,e)].reverse().map(e=>({global:u.raw.symbol_indices[e],name:IT(u.raw.symbols[e])}));return t.push({global:i,name:IT(u.raw.symbols[e])}),t},[u,i]);if(t==null&&r==null)return null;let f=r??V(e,t),p=t==null?[]:po(e,t),m=t!=null&&n!=null?p[n]:null,h=t==null,g=t!=null&&m==null&&!d;return(0,b.jsxs)(`div`,{"data-breadcrumb":!0,onClick:e=>e.stopPropagation(),className:`mb-0.5 flex flex-wrap items-center gap-x-1 gap-y-0.5 text-meta text-[var(--dim)] touch:flex-nowrap touch:overflow-hidden touch:[&_*]:min-w-0 touch:[&_*]:truncate touch:[&_button]:min-h-[44px]`,children:[(0,b.jsx)(`button`,{type:`button`,className:`font-mono hover:text-[var(--on)]`,onClick:o,children:e.repo}),(0,b.jsx)(`span`,{"aria-hidden":`true`,children:`›`}),h?(0,b.jsx)(`span`,{className:`font-semibold text-[var(--on)]`,children:e.names[f]??`district ${f}`}):(0,b.jsx)(`button`,{type:`button`,className:`hover:text-[var(--on)]`,onClick:()=>s(f),children:e.names[f]??`district ${f}`}),t!=null&&(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(`span`,{"aria-hidden":`true`,children:`›`}),g?(0,b.jsx)(`span`,{className:`font-mono font-semibold text-[var(--on)]`,children:e.F[t].split(`/`).pop()}):(0,b.jsx)(`button`,{type:`button`,className:`font-mono hover:text-[var(--on)]`,onClick:()=>c(t),children:e.F[t].split(`/`).pop()})]}),m&&(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(`span`,{"aria-hidden":`true`,children:`›`}),(0,b.jsx)(`span`,{className:`font-mono font-semibold text-[var(--on)]`,children:m[0]})]}),d?.map((e,t)=>{let n=t===d.length-1;return(0,b.jsxs)(`span`,{className:`contents`,children:[(0,b.jsx)(`span`,{"aria-hidden":`true`,children:`›`}),n?(0,b.jsx)(`span`,{className:`font-mono font-semibold text-[var(--on)]`,children:e.name}):(0,b.jsx)(`button`,{type:`button`,className:`font-mono hover:text-[var(--on)]`,onClick:()=>l?.(e.global),children:e.name})]},e.global)})]})}function UO({doc:e,d:t,onSelectDistrict:n}){return(0,b.jsxs)(`button`,{type:`button`,onClick:()=>n(+t),className:`flex min-h-[44px] w-full items-center gap-1.5 px-5 text-left text-small`,children:[(0,b.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.names[t]}),(0,b.jsx)(`span`,{className:`font-mono text-meta text-[var(--dim)]`,children:e.districts[t].size})]})}function WO({label:e,ids:t,doc:n,onSelectDistrict:r}){let[i,a]=(0,_.useState)(!1);return t.length===0?null:(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)(`button`,{type:`button`,onClick:()=>a(e=>!e),"aria-expanded":i,className:`flex min-h-[44px] w-full items-center gap-1.5 px-5 text-label uppercase text-[var(--dim)]`,children:[(0,b.jsx)(`span`,{className:`inline-block text-meta transition-transform ${i?`rotate-90`:``}`,children:`›`}),t.length,` `,e]}),i&&(0,b.jsx)(`div`,{children:t.map(e=>(0,b.jsx)(UO,{doc:n,d:e,onSelectDistrict:r},e))})]})}function GO({doc:e,packageLayout:t,onPickKeyFile:n,onSelectDistrict:r}){let i=(0,_.useMemo)(()=>ET(e,t),[e,t]);return(0,b.jsxs)(`div`,{"data-district-index":!0,children:[i.mainland.map(e=>(0,b.jsx)(KO,{row:e,onPickKeyFile:n,onSelectDistrict:r},e.d)),(0,b.jsx)(WO,{label:`islands`,ids:i.islandIds,doc:e,onSelectDistrict:r})]})}function KO({row:e,onPickKeyFile:t,onSelectDistrict:n}){return(0,b.jsxs)(`div`,{"data-district-index-row":e.d,className:`border-b border-[var(--rule)]`,children:[(0,b.jsxs)(`button`,{type:`button`,onClick:()=>n(e.d),className:`flex min-h-[64px] w-full items-center gap-3 px-5 py-2.5 text-left`,children:[(0,b.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[(0,b.jsx)(`span`,{className:`truncate text-row`,children:e.name}),e.mostly&&(0,b.jsxs)(`span`,{className:`truncate text-meta text-[var(--dim)]`,children:[`mostly `,(0,b.jsx)(`span`,{className:`font-mono`,children:e.mostly})]})]}),(0,b.jsx)(`span`,{className:`flex-none font-mono text-small text-[var(--dim)]`,children:e.size})]}),e.keyFiles.map(e=>(0,b.jsx)(`button`,{type:`button`,"data-district-index-key-file":e.file,onClick:()=>t(e.file),className:`-mt-1 flex min-h-[44px] w-full items-center truncate px-5 text-left text-meta text-[var(--dim)]`,children:(0,b.jsx)(`span`,{className:`min-w-0 truncate`,children:e.text})},e.kind))]})}function qO({row:e}){return(0,b.jsxs)(`li`,{className:`py-0.5`,children:[(0,b.jsx)(`span`,{className:`text-[var(--on)]`,children:e.label}),`: `,e.exact?`exact (SCIP)`:`heuristic (hand)`,e.reasonLabel&&(0,b.jsxs)(b.Fragment,{children:[` — `,e.reasonLabel]}),e.recallPercent!=null&&(0,b.jsxs)(b.Fragment,{children:[` · recall `,e.recallPercent,`%`]})]})}function JO({children:e}){return(0,b.jsx)(`div`,{className:`text-meta text-[var(--dim)]`,children:e})}function YO({children:e,mono:t=!1,truncate:n=!0}){return(0,b.jsx)(`h3`,{className:`mt-0.5 ${n?`truncate`:`whitespace-normal`} text-sheet-title tabular-nums ${t?`font-mono text-[21px] font-medium`:``}`,children:e})}function XO({label:e,onClick:t}){return(0,b.jsx)(`button`,{type:`button`,"aria-label":e,"data-sheet-close":!0,onClick:t,className:`-mr-2.5 -mt-1.5 flex h-11 w-11 shrink-0 items-center justify-center rounded-full bg-[var(--chrome2)] text-[var(--on)]`,children:(0,b.jsx)(ad,{})})}function ZO({children:e,onClick:t,primary:n=!1,...r}){return(0,b.jsx)(`button`,{type:`button`,onClick:t,...r,className:`flex min-h-[44px] flex-1 items-center justify-center gap-2 rounded-[12px] px-2.5 text-[15px] font-medium ${n?`bg-[var(--accent)] font-semibold text-[var(--on-accent)]`:`border border-[var(--rule)] bg-[var(--chrome2)] text-[var(--on)]`}`,children:e})}function QO({title:e,aside:t,compact:n=!1}){return(0,b.jsxs)(`div`,{className:`flex items-center justify-between ${n?`mt-4 min-h-8`:`mt-5 min-h-[44px]`}`,children:[(0,b.jsx)(`h4`,{className:`text-[15px] font-semibold`,children:e}),t]})}function $O(e,t){let n=e.F[t],r=n.lastIndexOf(`/`);return{name:n.slice(r+1),dir:r>=0?n.slice(0,r+1):``}}function ek({doc:e,files:t,onSelectFile:n,dataKey:r}){return(0,b.jsx)(`div`,{className:`-mx-5 mt-1 border-t border-[var(--rule)]`,children:t.map(t=>{let{name:i,dir:a}=$O(e,t);return(0,b.jsxs)(`button`,{type:`button`,"data-sheet-file":t,"data-list":r,onClick:()=>n(t),className:`flex min-h-[52px] w-full flex-col justify-center gap-0.5 border-b border-[var(--rule)] px-5 py-1.5 text-left`,children:[(0,b.jsx)(`span`,{className:`truncate font-mono text-small`,children:i}),a&&(0,b.jsx)(`span`,{className:`truncate font-mono text-meta text-[var(--dim)]`,children:a})]},t)})})}function tk({unconnected:e,onOpen:t}){return(0,b.jsxs)(`button`,{type:`button`,"data-map-quality":!0,onClick:t,"aria-label":`${e.toLocaleString(`en-US`)} files without links. Open map quality`,className:`mt-3.5 flex min-h-[48px] w-full items-center gap-2.5 rounded-[12px] border border-[var(--rule)] bg-[var(--chrome2)] px-3 text-left text-small`,children:[(0,b.jsxs)(`span`,{className:`min-w-0 flex-1`,"data-unconnected-count":!0,children:[e.toLocaleString(`en-US`),` files without links`]}),(0,b.jsx)(nk,{})]})}function nk(){return(0,b.jsxs)(`svg`,{width:`13`,height:`13`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.8`,strokeLinecap:`round`,"aria-hidden":`true`,className:`shrink-0 text-[var(--dim)]`,children:[(0,b.jsx)(`circle`,{cx:`12`,cy:`12`,r:`9`}),(0,b.jsx)(`path`,{d:`M12 11v5M12 8h.01`})]})}function rk({doc:e,slug:t,layer:n,packageLayout:r,packageGrouping:i,activeDirectory:a,tab:o,onTab:s,onOpenQuality:c,onSelectDistrict:l,onFrameDistricts:u,onPickKeyFile:d,onSelectDirectory:f}){let p=VO(e,i);return(0,b.jsxs)(`div`,{"data-sheet-card":`overview`,children:[(0,b.jsxs)(`div`,{"data-sheet-dragzone":!0,children:[(0,b.jsx)(`div`,{className:`font-mono text-meta text-[var(--dim)]`,children:t}),n===`d`?(0,b.jsx)(`div`,{"data-overview-headline":!0,"data-overview-layer":`d`,children:(0,b.jsx)(YO,{truncate:!1,children:(0,b.jsx)(DO,{text:cD(p,`d`).primary})})}):(0,b.jsx)(EO,{overview:p,layer:n,className:`mt-0.5 text-sheet-title tabular-nums`}),a?(0,b.jsxs)(`div`,{className:`mt-3.5 flex min-h-[48px] items-center gap-2 rounded-[12px] border border-[var(--rule)] bg-[var(--chrome2)] pl-3 text-small`,children:[(0,b.jsxs)(`span`,{className:`min-w-0 flex-1 truncate`,children:[`Folder `,(0,b.jsx)(`span`,{className:`font-mono`,children:rs(a)})]}),(0,b.jsx)(`button`,{type:`button`,"aria-label":`Clear folder`,onClick:()=>f(void 0),className:`flex h-11 w-11 items-center justify-center text-[var(--dim)]`,children:(0,b.jsx)(ad,{})})]}):(0,b.jsx)(tk,{unconnected:r.unconnectedFiles.length,onOpen:c}),n===`d`&&(0,b.jsxs)(`div`,{className:`mt-5 flex items-center justify-between`,children:[(0,b.jsxs)(`h4`,{className:`text-[15px] font-semibold`,children:[o===`districts`?`Districts`:`Folders`,` `,(0,b.jsx)(`span`,{className:`font-medium text-[var(--dim)]`,children:o===`districts`?p.district.mainlandDistricts:r.directories.length})]}),(0,b.jsx)(`div`,{role:`tablist`,"aria-label":`Browse by`,className:`flex rounded-[10px] border border-[var(--rule)] bg-[var(--canvas)] p-0.5`,children:[`districts`,`folders`].map(e=>(0,b.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":o===e,"data-index-tab":e,onClick:()=>s(e),className:`h-11 rounded-[8px] px-3.5 text-small ${o===e?`bg-[var(--rule)] font-semibold text-[var(--on)]`:`text-[var(--dim)]`}`,children:e===`districts`?`Districts`:`Folders`},e))})]})]}),n===`d`?(0,b.jsx)(`div`,{className:`-mx-5 mt-2.5 border-t border-[var(--rule)]`,children:o===`districts`?(0,b.jsx)(GO,{doc:e,packageLayout:r,onPickKeyFile:d,onSelectDistrict:l}):(0,b.jsx)(`div`,{className:`px-5`,children:(0,b.jsx)(LD,{layout:r,activeDirectory:a,onSelectDirectory:f,nested:!1})})}):(0,b.jsx)(`div`,{className:`-mx-5`,children:(0,b.jsx)(BO,{doc:e,overview:p,layer:n,touch:!0,sheet:!0,onSelectDistrict:l,onSelectFile:d,onFrameDistricts:u})})]})}function ik({doc:e,packageLayout:t,onClose:n,onSelectFile:r,desktopPanel:i=!1,compactRows:a=!1,touchTargets:o=!1}){let s=TO(e.coverage),c=t.unconnectedFiles.length,l=s?.status===`exact`?`SCIP references`:s?.status===`partial`?`SCIP and hand-written references`:`Some links may be missing`;return(0,b.jsxs)(`div`,{"data-sheet-card":`quality`,"data-desktop-quality":i||void 0,children:[(0,b.jsxs)(`div`,{"data-sheet-dragzone":!0,className:`flex items-start gap-2`,children:[(0,b.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,b.jsx)(JO,{children:`Map quality`}),(0,b.jsx)(YO,{children:l})]}),!i&&(0,b.jsx)(XO,{label:`Close map quality`,onClick:n})]}),(0,b.jsx)(`p`,{className:`mt-3.5 text-body text-[var(--dim)]`,children:s?.status===`exact`?`Imports and references come from each language's own SCIP indexer.`:s?.status===`partial`?`Some imports and references come from SCIP indexes; the rest use tolmap's own import rules. tolmap can miss a link but never invents one, so every count on the map is a minimum.`:`tolmap finds links by reading import statements with its own rules, not by compiling the code. It can miss a link but never invents one, so every count on the map is a minimum.`}),(0,b.jsxs)(`section`,{className:`mt-4`,"aria-labelledby":`phone-unfollowed-heading`,children:[(0,b.jsx)(QO,{title:(0,b.jsx)(`span`,{id:`phone-unfollowed-heading`,children:`Imports it could not follow`}),compact:a}),e.coverage&&Object.keys(e.coverage.by_language).length>0?(0,b.jsx)(`div`,{className:`-mx-2 flex flex-col`,"data-quality-language-counts":!0,children:Object.entries(e.coverage.by_language).sort(([e],[t])=>e.localeCompare(t)).map(([e,t])=>{let n=s?.languages.find(t=>t.language===e);return(0,b.jsxs)(`div`,{"data-quality-language":e,className:`flex ${o?`min-h-[44px]`:a?`min-h-8`:`min-h-9`} items-center justify-between gap-2 rounded-[8px] px-2 text-small`,children:[(0,b.jsxs)(`span`,{className:`min-w-0 truncate text-[var(--on)]`,children:[ak(e),n&&(0,b.jsxs)(`span`,{className:`text-meta text-[var(--dim)]`,children:[` · `,n.exact?`SCIP`:`tolmap rules`,n.recallPercent==null?``:` · recall ${n.recallPercent}%`]})]}),(0,b.jsxs)(`span`,{className:`shrink-0 font-mono text-meta text-[var(--dim)]`,children:[t.zero_edge_files.toLocaleString(`en-US`),` of `,t.total_files.toLocaleString(`en-US`),` files`]})]},e)})}):(0,b.jsx)(`p`,{className:`text-small text-[var(--dim)]`,"data-quality-language-counts":!0,children:`Language breakdown is not present in this map document.`}),s?.languages.length?(0,b.jsx)(`ul`,{className:`mt-1 text-small text-[var(--dim)]`,"data-reference-languages":!0,children:s.languages.map(e=>(0,b.jsx)(qO,{row:e},e.language))}):null]}),s?.languages.length===0&&e.coverage?.references==null&&(0,b.jsx)(`p`,{className:`mt-1 text-meta text-[var(--dim)]`,children:`References were resolved with tolmap's hand-written rules.`}),(0,b.jsx)(QO,{title:(0,b.jsxs)(`span`,{"data-unconnected-count":!0,children:[c.toLocaleString(`en-US`),` files without links`]}),compact:a}),c>0&&(0,b.jsx)(`p`,{className:`text-small text-[var(--dim)]`,children:`Nothing imports them and they import nothing tolmap could follow, so they are listed here instead of placed on the map.`}),(0,b.jsx)(ID,{layout:t,doc:e,onSelectFile:r,nested:!1,compactRows:a,touchTargets:o})]})}function ak(e){return{py:`Python`,go:`Go`,ts:`TypeScript`,js:`JavaScript`,rs:`Rust`}[e]??e}function ok({doc:e,d:t,packageLayout:n,onClose:r,onZoomDistrict:i,onDetails:a,onSelectFile:o,onSelectDistrict:s,onSelectDirectory:c,foldersExpanded:l,filesExpanded:u,onToggleFolders:d,onToggleFiles:f,desktopPanel:p=!1}){let[m,h]=(0,_.useState)(!1),[g,v]=(0,_.useState)(!1),y=l??m,x=u??g,S=d??(()=>h(e=>!e)),C=f??(()=>v(e=>!e)),w=n.districtPaths.get(t)??[],T=w.find(e=>!e.other),E=e.districts[String(t)]?.size??0;return(0,b.jsxs)(`div`,{"data-sheet-card":`district`,children:[(0,b.jsxs)(`div`,{"data-sheet-dragzone":!0,children:[(0,b.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,b.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,b.jsx)(JO,{children:`District`}),(0,b.jsx)(YO,{children:e.names[t]??`district ${t}`}),(0,b.jsxs)(`p`,{className:`mt-1 truncate text-small text-[var(--dim)]`,"data-district-summary":!0,children:[(0,b.jsx)(`span`,{className:`text-[var(--on)]`,children:hT(E)}),` files`,T&&T.share>=40&&(0,b.jsxs)(b.Fragment,{children:[` `,`· mostly `,(0,b.jsx)(`span`,{className:`font-mono text-meta`,children:rs(T.path)})]})]})]}),!p&&(0,b.jsx)(XO,{label:`Clear selection`,onClick:r})]}),(0,b.jsxs)(`div`,{className:`mt-3 flex gap-2`,children:[(0,b.jsxs)(ZO,{"aria-label":`Zoom to district`,onClick:()=>i(t),children:[(0,b.jsx)(rd,{size:18}),`Zoom to district`]}),a&&(0,b.jsx)(ZO,{primary:!0,onClick:a,"data-sheet-details":``,children:`Details`})]})]}),(0,b.jsx)(`div`,{className:`mt-4 text-small`,children:(0,b.jsx)(VD,{doc:e,d:t,paths:w,onSelectFile:o,onSelectDistrict:s,onSelectDirectory:c,foldersExpanded:y,filesExpanded:x,onToggleFolders:S,onToggleFiles:C})})]})}function sk({dir:e}){return(0,b.jsx)(`svg`,{viewBox:`0 0 24 24`,width:`22`,height:`22`,fill:`none`,"aria-hidden":`true`,"data-ring-glyph":e,children:(0,b.jsx)(`circle`,{cx:`12`,cy:`12`,r:`7`,stroke:e===`out`?`var(--link-out)`:`var(--link-in)`,strokeWidth:`2.5`,strokeDasharray:e===`in`?`4 3`:void 0})})}function ck({outDeg:e,inDeg:t,open:n,onOpen:r}){let i=(e,t,i)=>(0,b.jsxs)(`button`,{type:`button`,"data-link-count":e,"aria-pressed":n===e,onClick:()=>r(e),className:`flex min-h-[56px] min-w-0 items-center gap-2.5 rounded-[12px] border border-[var(--rule)] bg-[var(--chrome2)] px-3 text-left`,style:{borderColor:n===e?e===`out`?`var(--link-out)`:`var(--link-in)`:void 0},children:[(0,b.jsx)(sk,{dir:e}),(0,b.jsxs)(`span`,{className:`min-w-0`,children:[(0,b.jsx)(`span`,{className:`block text-meta text-[var(--dim)]`,children:t}),(0,b.jsx)(`span`,{className:`block font-mono text-[17px] font-medium`,children:i.toLocaleString(`en-US`)})]})]});return(0,b.jsxs)(`div`,{"data-link-legend":!0,"data-link-counts":!0,className:`mt-3 grid grid-cols-2 gap-2`,children:[i(`out`,`Imports`,e),i(`in`,`Imported by`,t)]})}var lk=3;function uk({doc:e,i:t,selSym:n,selHSym:r,symbolsDoc:i,symbolsLoading:a,adj:o,radj:s,detent:c,onClose:l,onDetent:u,onSelectFile:d,onSelectSymbol:f,onSelectHierSymbol:p,onHoverHierSymbol:m,onSelectDistrict:h,onBreadcrumbRepo:g,onBreadcrumbFile:v,onPath:y,desktopPanel:x=!1,compactRows:S=x,touchTargets:C=!1}){let[w,T]=(0,_.useState)(null),E=po(e,t),D=n==null?null:E[n],O=(0,_.useMemo)(()=>i?JT(i):null,[i]),k=(0,_.useMemo)(()=>O?pE(O,t):[],[O,t]),ee=(0,_.useMemo)(()=>O?gE(O,e,t):[],[O,e,t]),A=O?mE(k):E.length,j=o.get(t)??[],M=s.get(t)??[],N=e.L.find(e=>e[0]===t),te=Zw(e,t,n),ne=B(e.districts[String(V(e,t))])===`unconnected`,P=fT(e,t),re=P?.label.match(/^(.*) (#\d+)$/),F=re?re[1]:P?.label??``,I=re?.[2],ie=O&&r!=null?(()=>{let e=O.globalToLocal.get(r);return e==null?null:O.raw.symbols[e]})():null,ae=ie?{kind:dE[LT(ie)]??`symbol`,name:IT(ie),lines:`${RT(ie)}–${zT(ie)}`}:D?{kind:Mw[D[1]]??`symbol`,name:D[0],lines:`${D[2]}–${D[3]}`}:null,oe=(0,_.useMemo)(()=>{let e=[],t=n=>n.forEach(n=>{e.push(n),n.children.length&&t(n.children)});return t(k),e.map((e,t)=>({r:e,order:t})).sort((e,t)=>t.r.refsIn-e.r.refsIn||zT(t.r.row)-RT(t.r.row)-(zT(e.r.row)-RT(e.r.row))||e.order-t.order).slice(0,lk).map(e=>e.r)},[k]),se=E.map((e,t)=>({s:e,n:t,span:e[3]-e[2]+1})).sort((e,t)=>t.span-e.span||e.n-t.n).slice(0,lk);return(0,b.jsxs)(`div`,{"data-sheet-card":ae?`symbol`:`file`,children:[(0,b.jsxs)(`div`,{"data-sheet-dragzone":!0,children:[(0,b.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,b.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[!x&&(0,b.jsx)(HO,{doc:e,sel:t,selSym:n,selD:null,selHSym:r,symbolsDoc:i,onSelectRepo:g,onSelectDistrict:h,onSelectFile:v,onSelectHierSymbol:p}),ae?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(YO,{mono:!0,children:ae.name}),(0,b.jsxs)(`p`,{className:`mt-1 truncate text-meta text-[var(--dim)]`,children:[(e=>e.charAt(0).toUpperCase()+e.slice(1))(ae.kind),` ·`,` `,(0,b.jsxs)(`span`,{className:`font-mono`,children:[e.F[t].split(`/`).pop(),`:`,ae.lines]})]})]}):(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(YO,{mono:!0,children:e.F[t].split(`/`).pop()}),(0,b.jsx)(`p`,{className:`mt-1 truncate font-mono text-meta text-[var(--dim)]`,children:e.F[t]})]})]}),!x&&(0,b.jsx)(XO,{label:`Clear selection`,onClick:l})]}),(0,b.jsx)(ck,{outDeg:j.length,inDeg:M.length,open:w,onOpen:e=>{T(t=>t===e?null:e),c===`peek`&&u(`half`)}})]}),ne&&(0,b.jsx)(`p`,{className:`mt-3 text-small text-[var(--dim)]`,children:`not connected to anything, so it isn't placed on the map`}),w&&(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(QO,{title:w===`out`?`Imports ${j.length}`:`Imported by ${M.length}`}),(0,b.jsx)(ek,{doc:e,files:(w===`out`?j:M).slice(0,50),onSelectFile:d,dataKey:w}),(w===`out`?j:M).length>50&&(0,b.jsxs)(`p`,{className:`mt-1 text-meta text-[var(--dim)]`,children:[`+`,(w===`out`?j:M).length-50,` more`]})]}),O&&r!=null&&(0,b.jsx)(`div`,{className:`text-small`,children:(0,b.jsx)(GD,{decoded:O,global:r,onSelectHierSymbol:p})}),(0,b.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-x-3.5 gap-y-1.5 text-small text-[var(--dim)]`,"data-file-facts":!0,children:[N&&(0,b.jsx)(`span`,{className:`rounded-[6px] px-2 py-0.5 text-meta font-semibold capitalize`,style:{color:mT[N[1]],background:`color-mix(in srgb, ${mT[N[1]]??`var(--dim)`} 16%, transparent)`},children:N[1]}),(0,b.jsxs)(`span`,{children:[(0,b.jsx)(`span`,{className:`font-mono text-[var(--on)]`,children:io(e,t)}),` lines`]}),(0,b.jsxs)(`span`,{children:[(0,b.jsx)(`span`,{className:`font-mono text-[var(--on)]`,children:A}),` symbols`]}),(0,b.jsxs)(`span`,{children:[(0,b.jsx)(`span`,{className:`font-mono text-[var(--on)]`,children:so(e,t)}),` commits`]})]}),P&&(0,b.jsxs)(`div`,{children:[(0,b.jsx)(QO,{title:`Neighborhood`,compact:S}),(0,b.jsx)(`p`,{className:`truncate font-mono text-small text-[var(--on)]`,title:P.label,children:F}),(0,b.jsxs)(`p`,{className:`mt-0.5 text-meta text-[var(--dim)]`,children:[I&&(0,b.jsxs)(b.Fragment,{children:[I,` · `]}),ao(e,t).toLocaleString(`en-US`),` code lines`]})]}),(0,b.jsx)(HD,{blast:te,doc:e}),O?c===`full`?(0,b.jsx)(KD,{outline:k,external:ee,selHSym:r,onSelectHierSymbol:p,onHoverHierSymbol:m,nested:!1,compactRows:S}):oe.length>0&&(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(QO,{title:`Key symbols`,aside:(0,b.jsxs)(`button`,{type:`button`,"data-all-symbols":!0,onClick:()=>u(`full`),className:`min-h-[44px] px-1 text-small text-[var(--accent)]`,children:[`All `,A]})}),oe.map(e=>(0,b.jsxs)(`button`,{type:`button`,"data-outline-row":e.global,onMouseEnter:()=>m?.(e.global),onMouseLeave:()=>m?.(null),onClick:()=>p(e.global),className:`flex ${S?`min-h-[34px]`:`min-h-[44px]`} w-full items-center justify-between gap-2 border-b border-[var(--rule)] text-left ${r===e.global?`text-[var(--accent)]`:``}`,children:[(0,b.jsx)(`span`,{className:`truncate font-mono text-small`,children:IT(e.row)}),(0,b.jsxs)(`span`,{className:`font-mono text-meta text-[var(--dim)]`,children:[RT(e.row),`–`,zT(e.row)]})]},e.global))]}):a?(0,b.jsx)(`p`,{className:`my-2 text-small text-[var(--dim)]`,"data-symbols-loading":!0,children:`loading symbols…`}):c===`full`?(0,b.jsx)(UD,{doc:e,i:t,sy:E,cur:n,onSelectSymbol:f,compactRows:S,touchTargets:C}):se.length>0&&(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(QO,{title:`Key symbols`,aside:(0,b.jsxs)(`button`,{type:`button`,"data-all-symbols":!0,onClick:()=>u(`full`),className:`min-h-[44px] px-1 text-small text-[var(--accent)]`,children:[`All `,E.length]})}),se.map(({s:e,n:r})=>(0,b.jsxs)(`button`,{type:`button`,"data-symbol-row":`${t}:${r}`,onClick:()=>f(t,r),className:`flex ${S?`min-h-[34px]`:`min-h-[44px]`} w-full items-center justify-between gap-2 border-b border-[var(--rule)] text-left ${n===r?`text-[var(--accent)]`:``}`,children:[(0,b.jsx)(`span`,{className:`truncate font-mono text-small`,children:e[0]}),(0,b.jsxs)(`span`,{className:`font-mono text-meta text-[var(--dim)]`,children:[e[2],`–`,e[3]]})]},r))]}),(0,b.jsxs)(`div`,{className:`mt-3.5 flex gap-2`,children:[(0,b.jsx)(ZO,{"data-path-start":`from`,onClick:()=>y(t,`from`),children:`Path from here`}),(0,b.jsx)(ZO,{"data-path-start":`to`,onClick:()=>y(t,`to`),children:`Path to here`})]})]})}function dk({doc:e,pick:t,route:n,ends:r,onCancel:i,onSelectFile:a,onDetent:o,pointer:s=!1}){let c=t=>e.F[t].split(`/`).pop();if(!r)return(0,b.jsx)(`div`,{"data-sheet-card":`path`,"data-path-state":`picking`,children:(0,b.jsxs)(`div`,{"data-sheet-dragzone":!0,children:[(0,b.jsx)(JO,{children:`Path`}),(0,b.jsxs)(YO,{children:[t.dir===`from`?`From `:`To `,(0,b.jsx)(`span`,{className:`font-mono text-[20px]`,children:c(t.anchor)}),` · pick `,t.dir===`from`?`a destination`:`a start`]}),s?(0,b.jsxs)(`p`,{className:`mt-1 text-small text-[var(--dim)]`,children:[`Click a file on the map, or press `,typeof navigator<`u`&&/Mac|iPhone|iPad/.test(navigator.platform||navigator.userAgent)?`⌘K`:`Ctrl K`,` to search for `,t.dir===`from`?`the destination`:`the start`,`.`]}):(0,b.jsx)(`p`,{className:`mt-1 truncate text-small text-[var(--dim)]`,children:`Tap another file on the map`}),(0,b.jsx)(`div`,{className:`mt-3 flex gap-2`,children:(0,b.jsx)(ZO,{onClick:i,"data-path-cancel":``,children:`Cancel`})})]})});let[l,u]=r,d=n?n.path.length-1:0;return(0,b.jsxs)(`div`,{"data-sheet-card":`path`,"data-path-state":n?`found`:`none`,"data-path-ends":`${l},${u}`,children:[(0,b.jsxs)(`div`,{"data-sheet-dragzone":!0,children:[(0,b.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,b.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,b.jsx)(JO,{children:n?`Path · ${d} hop${d===1?``:`s`}`:`Path`}),(0,b.jsxs)(YO,{children:[(0,b.jsx)(`span`,{className:`font-mono text-[19px]`,children:c(l)}),` → `,(0,b.jsx)(`span`,{className:`font-mono text-[19px]`,children:c(u)})]}),(0,b.jsx)(`p`,{className:`mt-1 truncate text-small text-[var(--dim)]`,children:n?gT[n.kind]:`No path between these files: nothing links them.`})]}),(0,b.jsx)(XO,{label:`Close path`,onClick:i})]}),n&&(0,b.jsx)(`div`,{className:`mt-3 flex gap-2`,children:(0,b.jsx)(ZO,{onClick:()=>o(`half`),children:`Show the files`})})]}),n&&(0,b.jsx)(`ol`,{className:`mt-3 flex flex-col border-l-2 border-[var(--accent)] pl-3.5`,"data-path-files":!0,children:n.path.map(t=>(0,b.jsx)(`li`,{children:(0,b.jsx)(`button`,{type:`button`,onClick:()=>a(t),className:`flex min-h-[44px] w-full items-center text-left font-mono text-small`,children:(0,b.jsx)(`span`,{className:`truncate`,children:e.F[t]})})},t))})]})}function fk({doc:e,card:t,onClose:n,onSelectFile:r,onSelectDistrict:i}){let{detail:a,lines:o}=t,s=a.kind===`lens`?`Lens`:a.kind===`road`?`Road`:a.kind===`street`?`Street`:`Neighborhood`,c=t=>e.F[t].split(`/`).pop();return(0,b.jsxs)(`div`,{"data-sheet-card":`structure`,"data-structure-card":a.kind,children:[(0,b.jsxs)(`div`,{"data-sheet-dragzone":!0,className:`flex items-start gap-2`,children:[(0,b.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,b.jsx)(JO,{children:s}),(0,b.jsx)(YO,{children:o[0]}),a.kind===`neighborhood`?(0,b.jsxs)(`p`,{className:`mt-1 text-small text-[var(--dim)]`,children:[o[1],a.district!=null&&(0,b.jsxs)(b.Fragment,{children:[` `,`· in`,` `,(0,b.jsx)(`button`,{type:`button`,onClick:()=>i(a.district),className:`min-h-[44px] text-[var(--on)] underline decoration-[var(--rule)] underline-offset-2`,children:e.names[a.district]??`district ${a.district}`})]})]}):(0,b.jsx)(`p`,{className:`mt-1 text-small text-[var(--dim)]`,"data-structure-summary":!0,children:o.slice(1).join(` · `)})]}),(0,b.jsx)(XO,{label:`Close`,onClick:n})]}),a.kind===`lens`?null:a.kind===`neighborhood`?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(QO,{title:`${a.files.length} files`}),(0,b.jsx)(ek,{doc:e,files:a.files.slice(0,80),onSelectFile:r})]}):(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(QO,{title:`${a.pairTotal} import${a.pairTotal===1?``:`s`} behind it`}),(0,b.jsx)(`div`,{className:`-mx-5 border-t border-[var(--rule)]`,children:a.pairs.map(([e,t],n)=>(0,b.jsxs)(`div`,{className:`flex min-h-[44px] items-center gap-1.5 border-b border-[var(--rule)] px-5 font-mono text-meta`,children:[(0,b.jsx)(`button`,{type:`button`,onClick:()=>r(e),className:`min-h-[44px] min-w-0 truncate text-left`,children:c(e)}),(0,b.jsx)(`span`,{className:`text-[var(--dim)]`,children:`→`}),(0,b.jsx)(`button`,{type:`button`,onClick:()=>r(t),className:`min-h-[44px] min-w-0 truncate text-left`,children:c(t)})]},n))}),a.pairTotal>a.pairs.length&&(0,b.jsxs)(`p`,{className:`mt-1 text-meta text-[var(--dim)]`,children:[`+`,a.pairTotal-a.pairs.length,` more`]})]})]})}function pk(e){return e.pathPick?(0,b.jsx)(dk,{doc:e.doc,pick:e.pathPick,route:e.route,ends:e.pathEnds,onCancel:e.onPathCancel,onSelectFile:e.onSelectFile,onDetent:e.onDetent,pointer:!!e.desktopPanel&&!e.touchTargets}):e.structure?(0,b.jsx)(fk,{doc:e.doc,card:e.structure,onClose:e.onCloseStructure,onSelectFile:e.onSelectFile,onSelectDistrict:e.onSelectDistrict}):e.quality?(0,b.jsx)(ik,{doc:e.doc,packageLayout:e.packageLayout,onClose:e.onCloseQuality,onSelectFile:e.onSelectFile,desktopPanel:e.desktopPanel,compactRows:e.compactRows,touchTargets:e.touchTargets}):e.sel==null?e.selD==null?null:(0,b.jsx)(ok,{doc:e.doc,d:e.selD,packageLayout:e.packageLayout,onClose:e.onClearSelection,onZoomDistrict:e.onZoomDistrict,onDetails:e.onDistrictDetails,onSelectFile:e.onSelectFile,onSelectDistrict:e.onSelectDistrict,onSelectDirectory:e.onSelectDirectory,foldersExpanded:e.districtFoldersExpanded,filesExpanded:e.districtFilesExpanded,onToggleFolders:e.onToggleDistrictFolders,onToggleFiles:e.onToggleDistrictFiles,desktopPanel:e.desktopPanel}):(0,b.jsx)(uk,{doc:e.doc,i:e.sel,selSym:e.selSym,selHSym:e.selHSym,symbolsDoc:e.symbolsDoc,symbolsLoading:e.symbolsLoading,adj:e.adj,radj:e.radj,detent:e.detent,onClose:e.onClearSelection,onDetent:e.onDetent,onSelectFile:e.onSelectFile,onSelectSymbol:e.onSelectSymbol,onSelectHierSymbol:e.onSelectHierSymbol,onHoverHierSymbol:e.onHoverHierSymbol,onSelectDistrict:e.onSelectDistrict,onBreadcrumbRepo:e.onBreadcrumbRepo,onBreadcrumbFile:e.onBreadcrumbFile,onPath:e.onPath,desktopPanel:e.desktopPanel,compactRows:e.compactRows,touchTargets:e.touchTargets},e.sel)}var mk={system:`System`,light:`Light`,dark:`Dark`},hk=[{id:`d`,label:`District`,key:`1`,icon:(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(`circle`,{cx:`8.5`,cy:`9`,r:`5`}),(0,b.jsx)(`circle`,{cx:`16.5`,cy:`9.5`,r:`3.5`}),(0,b.jsx)(`circle`,{cx:`12.5`,cy:`17`,r:`4`})]})},{id:`c`,label:`Churn`,key:`2`,icon:(0,b.jsx)(`path`,{d:`M3 12h4l3-7 4 14 3-7h4`})},{id:`x`,label:`Complexity`,key:`3`,icon:(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(`circle`,{cx:`6`,cy:`5`,r:`2`}),(0,b.jsx)(`circle`,{cx:`6`,cy:`19`,r:`2`}),(0,b.jsx)(`circle`,{cx:`18`,cy:`7`,r:`2`}),(0,b.jsx)(`path`,{d:`M6 7v10M18 9c0 5-7 4-11 8`})]})},{id:`p`,label:`Package`,key:`4`,icon:(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(`path`,{d:`M12 3l8 4.5v9L12 21l-8-4.5v-9z`}),(0,b.jsx)(`path`,{d:`M4 7.5l8 4.5 8-4.5M12 12v9`})]})}],gk=`mt-1 text-balance text-[20px] font-semibold leading-[1.25] tracking-[-.015em] tabular-nums`;function _k(e,t,n,r){let i=`${n}/${r}`,a=(e??[]).map(e=>({slug:e.slug,label:e.label,files:typeof e.files==`number`?e.files:void 0,districts:typeof e.districts==`number`?e.districts:void 0,lang:typeof e.lang==`string`&&e.lang.length>0?e.lang:void 0,current:e.slug===i})),o=a.find(e=>e.current);return o?o.files=t.F.length:a.unshift({slug:i,files:t.F.length,current:!0}),a}function vk({children:e,size:t=16}){return(0,b.jsx)(`svg`,{width:t,height:t,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.9`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:e})}function yk(){return(0,b.jsxs)(`svg`,{width:`13`,height:`13`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.8`,strokeLinecap:`round`,"aria-hidden":`true`,className:`shrink-0 text-[var(--dim)]`,children:[(0,b.jsx)(`circle`,{cx:`12`,cy:`12`,r:`9`}),(0,b.jsx)(`path`,{d:`M12 11v5M12 8h.01`})]})}function bk(e){let t=Fc(),n=z(),[r,i]=(0,_.useState)(!1),a=(0,_.useRef)(null),o=(0,_.useRef)(null),s=(0,_.useMemo)(()=>_k(e.catalogue,e.doc,e.owner,e.repo),[e.catalogue,e.doc,e.owner,e.repo]),[c,l]=gs(),u=(0,_.useMemo)(()=>[...hk.map(({id:e,label:t,key:n})=>({id:`layer:${e}`,label:`Switch to ${t} layer`,shortcut:n})),{id:`fit`,label:`Fit the map`,shortcut:`F`},{id:`quality`,label:`Open map quality`,detail:`Files without links`},{id:`theme`,label:`Cycle the theme`,detail:`${mk[c]} now, ${mk[as(c)].toLowerCase()} next`,shortcut:`T`},{id:`panel`,label:`${e.panelOpen?`Hide`:`Show`} the panel`,shortcut:`[`},...s.map(e=>({id:`repo:${e.slug}`,label:`Switch to ${e.slug}`,detail:e.current?`Current repository`:`Repository`}))],[s,e.panelOpen,c]),d=(0,_.useRef)(null),f=(0,_.useRef)(null),p=(0,_.useRef)(null),m=(0,_.useRef)(!0),h=(0,_.useRef)(null),g=(0,_.useRef)(!1),v=(0,_.useRef)(!1),y=(0,_.useRef)(!0);(0,_.useEffect)(()=>{if(g.current&&!e.searchOpen){let e=p.current;p.current=null,m.current&&(e?.isConnected?e.focus({preventScroll:!0}):d.current?.focus({preventScroll:!0})),m.current=!0}g.current=e.searchOpen},[e.searchOpen]),(0,_.useEffect)(()=>{v.current&&!e.keyboardOpen&&y.current&&h.current?.focus({preventScroll:!0}),v.current&&!e.keyboardOpen&&(y.current=!0),v.current=e.keyboardOpen},[e.keyboardOpen]),(0,_.useEffect)(()=>{if(!r)return;(o.current?.querySelector(`[role=menuitem]`))?.focus();let e=e=>{let t=e.target;!o.current?.contains(t)&&!a.current?.contains(t)&&i(!1)};return document.addEventListener(`pointerdown`,e,!0),()=>document.removeEventListener(`pointerdown`,e,!0)},[r]),(0,_.useEffect)(()=>{if(!r)return;let e=e=>{e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),i(!1),a.current?.focus({preventScroll:!0}))};return window.addEventListener(`keydown`,e,!0),()=>window.removeEventListener(`keydown`,e,!0)},[r]),(0,_.useEffect)(()=>{if(!e.searchOpen)return;let t=t=>{let n=t.target;f.current?.contains(n)||d.current?.contains(n)||(m.current=!1,p.current=null,e.onCloseSearch())};return document.addEventListener(`pointerdown`,t,!0),()=>document.removeEventListener(`pointerdown`,t,!0)},[e.searchOpen,e.onCloseSearch]),(0,_.useEffect)(()=>{function t(t){let n=t.target instanceof HTMLElement?t.target:null;if(t.defaultPrevented)return;let r=n?.closest(`[data-desktop-search], [data-search-palette]`)?`palette`:n?.closest(`[role="menu"]`)?`menu`:n?.closest(`[role="dialog"]`)?`dialog`:n?.isContentEditable||n?.closest(`input, textarea, select, [contenteditable]`)?`text`:`page`;if(KE({key:t.key,focus:r,metaKey:t.metaKey,ctrlKey:t.ctrlKey,altKey:t.altKey,shiftKey:t.shiftKey}).type===`search`){if(t.preventDefault(),e.searchOpen){m.current=!0,e.onCloseSearch();return}p.current=n&&n!==document.body?n:d.current,m.current=!0,i(!1),e.keyboardOpen&&(y.current=!1,e.onKeyboardOpen(!1)),e.onOpenSearch()}}return window.addEventListener(`keydown`,t),()=>window.removeEventListener(`keydown`,t)},[e.keyboardOpen,e.onCloseSearch,e.onKeyboardOpen,e.onOpenSearch,e.searchOpen]);function x(){if(e.searchOpen){p.current=d.current,m.current=!0,e.onCloseSearch();return}p.current=d.current,m.current=!0,i(!1),e.onOpenSearch()}function S(t=!0){m.current=t,e.onCloseSearch()}function C(t){if(t.startsWith(`layer:`)){e.onLayer(t.slice(6));return}if(t.startsWith(`repo:`)){let e=s.find(e=>e.slug===t.slice(5));e&&T(e);return}t===`fit`?e.onFit():t===`quality`?e.onOpenQuality():t===`theme`?l(as(c)):t===`panel`&&e.onPanelOpen(!e.panelOpen)}function w(e){if(e.key===`Escape`){e.preventDefault(),e.stopPropagation(),i(!1),a.current?.focus({preventScroll:!0});return}if(e.key!==`ArrowDown`&&e.key!==`ArrowUp`)return;e.preventDefault();let t=Array.from(o.current?.querySelectorAll(`[role=menuitem]`)??[]),n=t.indexOf(document.activeElement);t[n<0?e.key===`ArrowDown`?0:t.length-1:Math.max(0,Math.min(t.length-1,n+(e.key===`ArrowDown`?1:-1)))]?.focus()}function T(e){if(i(!1),e.current){a.current?.focus({preventScroll:!0});return}let[t,r]=e.slug.split(`/`);n({to:`/$owner/$repo`,params:{owner:t,repo:r},search:{geo:`r`,layer:`d`}})}let E=e=>[e.files==null?null:`${e.files.toLocaleString(`en-US`)} files`,e.districts==null?null:`${e.districts.toLocaleString(`en-US`)} districts`,e.lang==null?null:lD(e.lang)].filter(e=>e!=null).join(` · `);return(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)(`div`,{className:`glass absolute z-40 flex items-center rounded-[14px] px-1`,"data-command-bar":!0,style:{left:`calc(16px + env(safe-area-inset-left, 0px))`,top:`calc(16px + env(safe-area-inset-top, 0px))`,height:44},children:[(0,b.jsx)(fa,{to:`/`,"data-wordmark":!0,"aria-label":`tolmap home`,className:`flex items-center gap-2 rounded-[10px] pl-2 pr-2.5 font-bold text-[16px] tracking-[-.01em] hover:bg-[var(--chrome-hover)] ${e.touch?`h-11`:`h-9`}`,children:(0,b.jsx)(Ka,{className:`h-7 w-auto shrink-0`})}),(0,b.jsx)(`span`,{"aria-hidden":`true`,className:`mx-1 h-5 w-px bg-[var(--rule)]`}),(0,b.jsxs)(`button`,{ref:a,type:`button`,"data-repo-switcher":!0,"aria-haspopup":`menu`,"aria-expanded":r,"aria-label":`Repository ${e.owner}/${e.repo}`,onClick:()=>i(e=>!e),className:`flex max-w-[min(260px,calc(100vw-488px))] items-center gap-1.5 rounded-[10px] pl-2.5 pr-2 font-mono text-small hover:bg-[var(--chrome-hover)] ${e.touch?`h-11`:`h-9`}`,children:[(0,b.jsx)(`span`,{className:`truncate`,children:s.find(e=>e.current)?.label??`${e.owner}/${e.repo}`}),(0,b.jsx)(md,{})]}),r&&(0,b.jsxs)(`div`,{ref:o,role:`menu`,"aria-label":`Mapped repositories`,"data-repository-menu":!0,onKeyDown:w,className:`absolute left-[70px] top-[54px] z-[61] flex max-h-[min(520px,calc(100vh-110px))] min-w-[300px] flex-col overflow-hidden rounded-[14px] border border-[var(--chrome-glass-border)] bg-[var(--chrome-solid)] p-1.5 text-[var(--on)] shadow-[var(--chrome-shadow)]`,children:[(0,b.jsxs)(`div`,{"data-repository-list":!0,className:`min-h-0 flex-auto overflow-y-auto`,children:[(0,b.jsx)(`div`,{className:`px-2.5 pb-1 pt-1.5 text-label font-semibold uppercase tracking-[.06em] text-[var(--dim)]`,children:`Mapped repositories`}),s.map(e=>(0,b.jsxs)(`button`,{type:`button`,role:`menuitem`,"aria-current":e.current?`true`:void 0,"data-repository-row":e.slug,onClick:()=>T(e),className:`flex min-h-[48px] w-full items-center gap-2.5 rounded-[9px] px-2.5 py-1 text-left hover:bg-[var(--chrome-hover)] focus-visible:bg-[var(--chrome-hover)]`,children:[(0,b.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[(0,b.jsx)(`span`,{className:`truncate font-mono text-small`,children:e.label??e.slug}),E(e)&&(0,b.jsx)(`span`,{className:`truncate text-meta text-[var(--dim)]`,children:E(e)})]}),e.current&&(0,b.jsx)(vk,{children:(0,b.jsx)(`path`,{d:`M5 12l5 5 9-10`})})]},e.slug))]}),(0,b.jsxs)(`div`,{"data-repository-footer":!0,className:`shrink-0 border-t border-[var(--rule)] pt-1`,children:[Ha?.onboarding?(0,b.jsx)(`button`,{type:`button`,"data-repo-map-another":!0,role:`menuitem`,onClick:()=>{i(!1),t()},className:`repo-control repo-control-ghost w-full`,children:`Add repository`}):(0,b.jsxs)(fa,{to:`/`,hash:`repo-field`,replace:!0,"data-repo-map-another":!0,role:`menuitem`,onClick:()=>i(!1),className:`flex min-h-[44px] items-center gap-2.5 rounded-[9px] px-2.5 text-small hover:bg-[var(--chrome-hover)]`,children:[(0,b.jsx)(td,{size:16}),(0,b.jsx)(`span`,{children:`Map another repository`})]}),(0,b.jsxs)(fa,{to:`/`,"data-repo-home":!0,role:`menuitem`,onClick:()=>i(!1),className:`flex min-h-[44px] items-center gap-2.5 rounded-[9px] px-2.5 text-small hover:bg-[var(--chrome-hover)]`,children:[(0,b.jsx)(vk,{children:(0,b.jsx)(`path`,{d:`M4 11l8-7 8 7v9H4z`})}),(0,b.jsx)(`span`,{children:`Home`})]})]})]})]}),(0,b.jsxs)(`div`,{className:`absolute z-40 flex items-center gap-2`,"data-desktop-actions":!0,style:{right:`calc(16px + env(safe-area-inset-right, 0px))`,top:`calc(16px + env(safe-area-inset-top, 0px))`},children:[(0,b.jsx)(`div`,{role:`group`,"aria-label":`Map layer`,"data-layer-segmented":!0,className:`glass flex h-11 items-center gap-0.5 rounded-[14px] p-1`,children:hk.map(({id:t,label:n,key:r,icon:i})=>{let a=e.layer===t;return(0,b.jsxs)(`button`,{type:`button`,"data-layer":t,"aria-label":`${n} layer`,"aria-pressed":a,title:`${n} ${r}`,onClick:()=>e.onLayer(t),className:`flex items-center justify-center gap-[7px] rounded-[10px] px-3 text-small ${e.touch?`h-11 min-w-11`:`h-[34px]`} ${a?`bg-[var(--chrome2)] text-[var(--on)] shadow-[var(--chrome-segment-shadow)]`:`text-[var(--dim)] hover:text-[var(--on)]`}`,children:[(0,b.jsx)(`svg`,{width:`16`,height:`16`,viewBox:`0 0 24 24`,fill:`none`,stroke:a?`var(--accent)`:`currentColor`,strokeWidth:`1.9`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:i}),(0,b.jsx)(`span`,{className:`hidden min-[1180px]:inline`,"data-layer-label":!0,children:n})]},t)})}),(0,b.jsxs)(`div`,{className:`glass flex items-center gap-0.5 rounded-[14px] p-1`,"data-action-buttons":!0,children:[(0,b.jsx)(`button`,{ref:d,type:`button`,"data-open-desktop-search":!0,"aria-haspopup":`dialog`,"aria-expanded":e.searchOpen,"aria-label":`Search districts, files and symbols`,title:`Search ${typeof navigator<`u`&&/Mac|iPhone|iPad/.test(navigator.platform||navigator.userAgent)?`⌘K`:`Ctrl K`}`,onClick:x,className:`flex ${e.touch?`h-11 w-11`:`h-9 w-9`} items-center justify-center rounded-[10px] text-[var(--dim)] hover:bg-[var(--chrome-hover)] hover:text-[var(--on)]`,children:(0,b.jsx)($u,{size:18})}),!Ha&&(0,b.jsx)(Ec,{iconSize:18,className:`border-0 bg-transparent text-[var(--dim)] hover:bg-[var(--chrome-hover)] hover:text-[var(--on)] ${e.touch?`h-11 w-11 rounded-[10px]`:`h-9 w-9 rounded-[10px]`}`}),(0,b.jsx)(`button`,{ref:h,type:`button`,"data-open-keyboard":!0,"aria-label":`Keyboard shortcuts`,title:`Keyboard shortcuts`,"aria-haspopup":`dialog`,"aria-expanded":e.keyboardOpen,onClick:()=>e.onKeyboardOpen(!e.keyboardOpen),className:`flex ${e.touch?`h-11 w-11`:`h-9 w-9`} items-center justify-center rounded-[10px] text-[var(--dim)] hover:bg-[var(--chrome-hover)] hover:text-[var(--on)]`,children:(0,b.jsxs)(vk,{size:18,children:[(0,b.jsx)(`rect`,{x:`3`,y:`6`,width:`18`,height:`12`,rx:`2`}),(0,b.jsx)(`path`,{d:`M7 10h.01M11 10h.01M15 10h.01M7 14h10`})]})})]})]}),r&&(0,b.jsx)(`button`,{type:`button`,"aria-label":`Close repository menu`,tabIndex:-1,onClick:()=>i(!1),className:`absolute inset-0 z-[35] cursor-default bg-transparent`}),e.searchOpen&&(0,b.jsx)(`div`,{ref:f,"data-desktop-search-shell":!0,className:`absolute inset-0 z-[70]`,children:(0,b.jsx)(pO,{doc:e.doc,onPick:e.onSearchPick,onCommand:C,commands:u,pathMode:e.pathMode,pathEnd:e.pathEnd,variant:`palette`,autoFocus:!0,onClose:()=>S(),touch:e.touch})}),e.keyboardOpen&&(0,b.jsxs)(`div`,{className:`absolute inset-0 z-[70]`,"data-keyboard-dialog-layer":!0,children:[(0,b.jsx)(`button`,{type:`button`,"aria-label":`Close keyboard shortcuts`,onClick:()=>e.onKeyboardOpen(!1),className:`absolute inset-0 h-full w-full cursor-default bg-[var(--chrome-scrim)]`}),(0,b.jsx)(xk,{touch:e.touch,onClose:()=>e.onKeyboardOpen(!1)})]}),(0,b.jsx)(Tk,{onZoomIn:e.onZoomIn,onZoomOut:e.onZoomOut,onFit:e.onFit,isFullscreen:e.isFullscreen,onToggleFullscreen:e.onToggleFullscreen,size:Il(e.touch?`tablet`:`desktop`)})]})}function xk({onClose:e,touch:t}){let n=(0,_.useRef)(null),r=typeof navigator<`u`&&/Mac|iPhone|iPad/.test(navigator.platform||navigator.userAgent);return(0,_.useEffect)(()=>{n.current?.focus()},[]),(0,b.jsxs)(`section`,{ref:n,role:`dialog`,"aria-label":`Keyboard shortcuts`,"aria-modal":`true`,"data-keyboard-dialog":!0,tabIndex:-1,onKeyDown:t=>{t.key===`Escape`&&(t.preventDefault(),t.stopPropagation(),e())},className:`absolute left-1/2 top-1/2 z-[71] w-[min(560px,calc(100%-32px))] -translate-x-1/2 -translate-y-1/2 rounded-[16px] border border-[var(--chrome-glass-border)] bg-[var(--chrome-solid)] px-[22px] pb-5 pt-4 text-[var(--on)] shadow-[var(--chrome-shadow)] outline-none`,children:[(0,b.jsxs)(`div`,{className:`mb-2 flex items-center`,children:[(0,b.jsx)(`h2`,{className:`mr-auto text-[17px] font-semibold`,children:`Keyboard`}),(0,b.jsx)(`button`,{type:`button`,"aria-label":`Close keyboard shortcuts`,onClick:e,className:`-mr-2 flex items-center justify-center rounded-[10px] text-[var(--dim)] hover:bg-[var(--chrome-hover)] hover:text-[var(--on)] ${t?`h-11 w-11`:`h-9 w-9`}`,children:(0,b.jsx)(vk,{children:(0,b.jsx)(`path`,{d:`M6 6l12 12M18 6L6 18`})})})]}),(0,b.jsxs)(`div`,{className:`grid grid-cols-2 gap-x-7`,children:[(0,b.jsx)(Sk,{label:`Search and commands`,keys:r?[`⌘K`,`/`]:[`Ctrl K`,`/`]}),(0,b.jsx)(Sk,{label:`Close, or step back a card`,keys:[`esc`]}),(0,b.jsx)(Sk,{label:`Move in the index`,keys:[`↑`,`↓`]}),(0,b.jsx)(Sk,{label:`Open the highlighted row`,keys:[`↵`]}),(0,b.jsx)(Sk,{label:`Hide or show the panel`,keys:[`[`]}),(0,b.jsx)(Sk,{label:`Fit the map`,keys:[`F`]}),(0,b.jsx)(Sk,{label:`Zoom`,keys:[`+`,`−`]}),(0,b.jsx)(Sk,{label:`Zoom to the selection`,keys:[`Z`]}),(0,b.jsx)(Sk,{label:`Cycle the theme`,keys:[`T`]}),(0,b.jsx)(Sk,{label:`This list`,keys:[`?`]}),(0,b.jsx)(`div`,{className:`col-span-2`,children:(0,b.jsx)(Sk,{label:`District, Churn, Complexity, Package`,keys:[`1`,`2`,`3`,`4`]})})]}),(0,b.jsx)(`p`,{className:`mt-3 text-meta text-[var(--dim)]`,children:`Mouse: drag pans, the wheel zooms at the cursor, Shift + wheel pans sideways, double-click zooms in.`})]})}function Sk({label:e,keys:t}){return(0,b.jsxs)(`div`,{className:`flex min-h-8 items-center justify-between gap-2 border-b border-[var(--chrome-glass-border)] py-1 text-[13px]`,children:[(0,b.jsx)(`span`,{children:e}),(0,b.jsx)(`span`,{className:`flex shrink-0 gap-1`,children:t.map(e=>(0,b.jsx)(`kbd`,{className:`inline-flex h-5 min-w-5 items-center justify-center rounded-[5px] border border-[var(--chrome-glass-border)] bg-[var(--chrome-key)] px-[5px] font-mono text-[11px] font-normal leading-none text-[var(--dim)]`,children:e},e))})]})}function Ck(e){let t=(0,_.useRef)(null),[n,r]=(0,_.useState)(!1),[i,a]=(0,_.useState)(!1),o=bO(e.views,e.doc,e.repoSlug),s=e.views[e.views.length-1]??{type:`overview`},c=VO(e.doc,e.packageGrouping),l=(0,_.useRef)(e.onHighlightDistricts);l.current=e.onHighlightDistricts;let u=(0,_.useMemo)(()=>yT(e.doc).sort((t,n)=>e.doc.districts[String(n)].size-e.doc.districts[String(t)].size||t-n).map(t=>TT(e.doc,e.packageLayout,t)),[e.doc,e.packageLayout]),d=(0,_.useMemo)(()=>{let t=new Map;return e.doc.N.forEach((e,n)=>{let r=t.get(e[0])??[];r.push(n),t.set(e[0],r)}),t},[e.doc]),[f,p]=(0,_.useMemo)(()=>[Math.max(1,...e.doc.N.map(e=>e[5])),Math.max(1,...e.doc.N.map(e=>e[4]))],[e.doc]);(0,_.useEffect)(()=>{let n=t.current;n&&(e.panelOpen?n.removeAttribute(`inert`):n.setAttribute(`inert`,``))},[e.panelOpen]),(0,_.useEffect)(()=>{r(!1),a(!1)},[e.doc]),(0,_.useEffect)(()=>{l.current(null)},[e.layer,e.doc]);let m=t=>{let n=d.get(t)??[];if(e.layer===`d`)return Mo(e.doc,t);if(e.layer===`c`||e.layer===`x`){let t=n.map(t=>e.layer===`c`?so(e.doc,t):oo(e.doc,t)).sort((e,t)=>e-t);if(t.length===0)return`var(--dim)`;let r=t[Math.floor((t.length-1)/2)];return Oo(r/(e.layer===`c`?f:p))}let r=new Map;for(let t of n){let n=e.packageGrouping.fileColors[t];r.set(n,(r.get(n)??0)+1)}return[...r.entries()].sort((e,t)=>t[1]-e[1]||e[0].localeCompare(t[0]))[0]?.[0]??`var(--dim)`},h=e=>m(e),g=e.packageLayout.unconnectedFiles.length;return(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)(`section`,{ref:t,"data-desktop-panel":!0,"aria-label":`Map details`,"aria-hidden":!e.panelOpen,className:`glass desktop-panel absolute z-30 flex flex-col overflow-hidden rounded-[16px] text-[var(--on)] ${e.panelOpen?`translate-x-0 opacity-100`:`-translate-x-[calc(100%+24px)] opacity-0 pointer-events-none`}`,style:{left:`calc(16px + env(safe-area-inset-left, 0px))`,top:`calc(72px + env(safe-area-inset-top, 0px))`,width:360,maxWidth:`calc(100% - 32px - env(safe-area-inset-left, 0px) - env(safe-area-inset-right, 0px))`,maxHeight:`calc(100% - 144px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px))`},children:[(0,b.jsxs)(`div`,{className:`flex min-h-11 items-center gap-1 pl-4 pr-2.5 pt-2.5`,"data-panel-head":!0,children:[e.views.length>1&&(0,b.jsx)(`button`,{type:`button`,"data-panel-back":!0,"aria-label":`Back one card`,title:`Back Esc`,onClick:e.onBack,className:`flex h-9 w-9 shrink-0 items-center justify-center rounded-[10px] text-[var(--dim)] hover:bg-[var(--chrome-hover)] hover:text-[var(--on)] touch:h-11 touch:w-11`,children:(0,b.jsx)(sd,{size:16})}),(0,b.jsx)(`nav`,{"aria-label":`Where you are`,className:`flex min-w-0 flex-1 items-center gap-0.5 overflow-hidden whitespace-nowrap`,"data-panel-breadcrumbs":!0,children:o.map((t,n)=>{let r=n===o.length-1,i=o.length>=3&&n===0&&t.type===`overview`,a=i?`Overview · ${t.label}`:t.label;return(0,b.jsxs)(`span`,{className:`flex min-w-0 items-center gap-0.5 ${r?`shrink-0 max-w-[60%]`:`shrink`}`,children:[n>0&&(0,b.jsx)(`span`,{className:`shrink-0`,children:(0,b.jsx)(od,{})}),(0,b.jsx)(`button`,{type:`button`,"data-panel-crumb":n,"aria-current":r?`page`:void 0,"aria-label":a,title:a,onClick:()=>e.onJump(n),className:`min-w-0 max-w-full shrink truncate rounded-[6px] px-1.5 py-1 text-left text-meta hover:bg-[var(--chrome-hover)] touch:min-h-[44px] ${t.type===`overview`||t.type===`file`||t.type===`symbol`?`font-mono`:``} ${r?`text-[var(--on)]`:`text-[var(--dim)]`} ${i?`flex h-7 w-7 shrink-0 items-center justify-center px-1`:``}`,children:i?(0,b.jsx)(ed,{size:14}):t.label})]},`${t.type}-${n}`)})}),(0,b.jsx)(`button`,{type:`button`,"data-hide-panel":!0,"aria-label":`Hide panel`,title:`Hide panel [`,onClick:()=>e.onPanelOpen(!1),className:`flex h-9 w-9 shrink-0 items-center justify-center rounded-[10px] text-[var(--dim)] hover:bg-[var(--chrome-hover)] hover:text-[var(--on)] touch:h-11 touch:w-11`,children:(0,b.jsx)(pd,{size:17})})]}),(0,b.jsxs)(`div`,{"data-panel-content":!0,"data-selection-panel":s.type===`overview`?void 0:``,className:`min-h-0 overflow-y-auto px-4 pb-4 pt-1 [overscroll-behavior:contain] panel-enter`,style:{scrollbarWidth:`thin`},children:[(s.type===`overview`||s.type===`file`||s.type===`symbol`)&&e.walkthrough,s.type===`overview`&&e.lenses,s.type===`overview`?(0,b.jsx)(b.Fragment,{children:e.layer===`d`?(0,b.jsxs)(`div`,{"data-desktop-overview":!0,"data-overview-layer":`d`,children:[(0,b.jsx)(`h2`,{"data-overview-headline":!0,"data-overview-layer":`d`,className:gk,children:(0,b.jsx)(DO,{text:cD(c,`d`).primary})}),(0,b.jsxs)(`p`,{className:`mt-1.5 flex flex-wrap items-center gap-x-1 text-meta leading-[1.45] text-[var(--dim)]`,children:[`modularity `,(0,b.jsx)(`span`,{className:`font-mono`,children:e.doc.q.toFixed(3)}),` ·`,(0,b.jsxs)(`button`,{type:`button`,"data-open-map-quality":!0,onClick:e.onOpenQuality,className:`inline-flex items-center gap-1 rounded px-0.5 hover:text-[var(--on)]`,"aria-label":`${g.toLocaleString(`en-US`)} files without links. Open map quality`,children:[(0,b.jsxs)(`span`,{"data-unconnected-count":!0,children:[g.toLocaleString(`en-US`),` files without links`]}),(0,b.jsx)(yk,{})]})]}),(0,b.jsxs)(`div`,{className:`mt-4 flex min-h-8 items-center justify-between gap-2`,children:[(0,b.jsx)(`h3`,{className:`text-small font-semibold`,children:`Index`}),(0,b.jsx)(`div`,{role:`tablist`,"aria-label":`Browse by`,className:`flex rounded-[8px] bg-[var(--chrome-hover)] p-0.5`,children:[`districts`,`folders`].map(t=>(0,b.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":e.indexTab===t,"data-index-tab":t,onClick:()=>e.onIndexTab(t),className:`rounded-[6px] px-2.5 text-meta ${e.touch?`h-11`:`h-[28px]`} ${e.indexTab===t?`bg-[var(--chrome2)] font-semibold text-[var(--on)] shadow-[var(--chrome-segment-shadow)]`:`text-[var(--dim)]`}`,children:t===`districts`?`Districts`:`Folders`},t))})]}),e.indexTab===`districts`?(0,b.jsx)(`div`,{className:`-mx-2 mt-1 flex flex-col gap-px`,"data-district-index":!0,children:u.map(t=>{let n=t.keyFiles[0];return(0,b.jsxs)(`button`,{type:`button`,"data-district-index-row":t.d,"data-panel-district":t.d,onMouseEnter:()=>e.onHighlightDistricts([t.d]),onMouseLeave:()=>e.onHighlightDistricts(null),onFocus:()=>e.onHighlightDistricts([t.d]),onBlur:()=>e.onHighlightDistricts(null),onClick:()=>{e.onHighlightDistricts(null),e.onSelectDistrict(t.d)},className:`flex h-[50px] min-h-[50px] w-full shrink-0 items-center gap-2.5 rounded-[10px] px-2.5 py-1.5 text-left hover:bg-[var(--chrome-hover)] outline-none focus-visible:bg-[color-mix(in_srgb,var(--accent)_12%,transparent)]`,children:[(0,b.jsx)(`i`,{"aria-hidden":`true`,className:`h-2.5 w-2.5 shrink-0 rounded-[3px]`,style:{background:h(t.d)}}),(0,b.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[(0,b.jsx)(`span`,{className:`truncate text-small font-semibold`,children:t.name}),(0,b.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1 text-meta text-[var(--dim)]`,children:[t.mostly&&(0,b.jsxs)(`span`,{className:`min-w-0 truncate`,children:[`mostly `,(0,b.jsx)(`span`,{className:`font-mono`,children:t.mostly})]}),t.mostly&&n&&(0,b.jsx)(`span`,{className:`shrink-0`,children:`·`}),n&&(0,b.jsx)(`span`,{"data-district-index-key-file":n.file,className:`shrink-0 truncate font-mono`,children:e.doc.F[n.file]?.split(`/`).pop()})]})]}),(0,b.jsx)(`span`,{className:`shrink-0 font-mono text-meta text-[var(--dim)]`,children:t.size.toLocaleString(`en-US`)})]},t.d)})}):(0,b.jsx)(`div`,{className:`px-1`,"data-folder-tab":!0,children:(0,b.jsx)(LD,{layout:e.packageLayout,activeDirectory:e.activeDirectory,onSelectDirectory:e.onSelectDirectory,touchTargets:e.touch})})]}):(0,b.jsxs)(`div`,{"data-desktop-overview":!0,"data-overview-layer":e.layer,children:[(0,b.jsx)(EO,{overview:c,layer:e.layer,className:gk}),(0,b.jsx)(`div`,{className:`mt-4`,children:(0,b.jsx)(BO,{doc:e.doc,overview:c,layer:e.layer,touch:e.touch,onSelectDistrict:e.onSelectDistrict,onSelectFile:e.cardProps.onSelectFile,onHighlightDistricts:e.onHighlightDistricts,onFrameDistricts:e.onFrameDistricts})})]})}):(0,b.jsx)(pk,{...e.cardProps,quality:s.type===`quality`||e.cardProps.quality,desktopPanel:!0,compactRows:!e.touch,touchTargets:e.touch,districtFoldersExpanded:n,districtFilesExpanded:i,onToggleDistrictFolders:()=>r(e=>!e),onToggleDistrictFiles:()=>a(e=>!e)})]},`${s.type}-${JSON.stringify(s)}`)]}),!e.panelOpen&&(0,b.jsxs)(`button`,{type:`button`,"data-panel-tab":!0,title:`Show panel [`,"aria-label":`Show panel. ${e.panelTabLabel}`,onClick:()=>e.onPanelOpen(!0),className:`glass absolute z-30 flex h-10 max-w-[min(330px,calc(100%-32px))] items-center gap-2 rounded-[12px] px-3 text-small font-medium text-[var(--on)] hover:border-[var(--dim)] touch:h-11`,style:{left:`calc(16px + env(safe-area-inset-left, 0px))`,top:`calc(72px + env(safe-area-inset-top, 0px))`},children:[(0,b.jsx)(pd,{size:17}),(0,b.jsx)(`span`,{className:`truncate`,children:e.panelTabLabel})]}),(0,b.jsx)(wk,{layer:e.layer,packageLayout:e.packageLayout,packageGrouping:e.packageGrouping,panelOpen:e.panelOpen,onDepth:e.onDepth,packageAuto:e.packageAuto})]})}function wk({layer:e,packageLayout:t,packageGrouping:n,panelOpen:r,onDepth:i,packageAuto:a}){if(e===`d`)return null;let o={left:r?`calc(392px + env(safe-area-inset-left, 0px))`:`calc(16px + env(safe-area-inset-left, 0px))`,bottom:`calc(64px + env(safe-area-inset-bottom, 0px))`};return e===`p`?(0,b.jsx)(`div`,{className:`absolute z-20`,style:o,"data-desktop-legend":!0,children:(0,b.jsx)(qD,{grouping:n,auto:a,minDepth:t.minDepth,maxDepth:t.maxDepth,onDepth:i})}):(0,b.jsxs)(`div`,{className:`glass absolute z-20 w-[220px] rounded-[12px] px-3 py-2 text-meta text-[var(--dim)]`,style:o,"data-desktop-legend":!0,"data-ramp-legend":e,children:[(0,b.jsx)(`div`,{className:`font-semibold text-[var(--on)]`,children:e===`c`?`Commits per file`:`Complexity per file`}),(0,b.jsx)(`div`,{className:`my-1.5 h-1.5 rounded-full`,style:{background:`linear-gradient(90deg,var(--chrome-ramp-low),var(--chrome-ramp-mid),var(--chrome-ramp-high))`}}),(0,b.jsxs)(`div`,{className:`flex justify-between font-mono`,children:[(0,b.jsx)(`span`,{children:`low`}),(0,b.jsx)(`span`,{children:`high`})]})]})}function Tk({onZoomIn:e,onZoomOut:t,onFit:n,isFullscreen:r,onToggleFullscreen:i,size:a}){let o=`flex items-center justify-center border-b border-[var(--chrome-glass-border)] text-[var(--dim)] last:border-b-0 hover:bg-[var(--chrome-hover)] hover:text-[var(--on)]`;return(0,b.jsxs)(`div`,{"data-map-controls":!0,className:`glass absolute z-20 flex flex-col overflow-hidden rounded-[12px]`,style:{right:`calc(16px + env(safe-area-inset-right, 0px))`,bottom:`calc(16px + env(safe-area-inset-bottom, 0px))`},children:[(0,b.jsx)(`button`,{type:`button`,className:o,style:{width:a,height:a},onClick:e,"aria-label":`Zoom in`,children:(0,b.jsx)(td,{size:18})}),(0,b.jsx)(`button`,{type:`button`,className:o,style:{width:a,height:a},onClick:t,"aria-label":`Zoom out`,children:(0,b.jsx)(nd,{size:18})}),(0,b.jsx)(`button`,{type:`button`,className:o,style:{width:a,height:a},onClick:n,"aria-label":`Fit map`,children:(0,b.jsx)(rd,{size:18})}),(0,b.jsx)(`button`,{type:`button`,className:o,style:{width:a,height:a},onClick:i,"aria-label":r?`Exit fullscreen`:`Enter fullscreen`,"aria-pressed":r,children:(0,b.jsx)(fd,{size:18})})]})}function Ek(e){let t=document.createElement(`div`);t.style.cssText=`position:fixed;left:0;top:0;width:1px;visibility:hidden;pointer-events:none;height:env(safe-area-inset-${e},0px)`,document.body.appendChild(t);let n=t.offsetHeight;return t.remove(),n}function Dk(){let e=window.visualViewport;return{width:e?.width??window.innerWidth,height:e?.height??window.innerHeight,safeTop:Ek(`top`),safeBottom:Ek(`bottom`),safeLeft:Ek(`left`),safeRight:Ek(`right`)}}function Ok(e,t){return e.width===t.width&&e.height===t.height&&e.safeTop===t.safeTop&&e.safeBottom===t.safeBottom&&e.safeLeft===t.safeLeft&&e.safeRight===t.safeRight}function kk(){let[e,t]=(0,_.useState)(Dk);return(0,_.useEffect)(()=>{let e=()=>{let e=Dk();t(t=>Ok(t,e)?t:e)};return window.addEventListener(`resize`,e),window.visualViewport?.addEventListener(`resize`,e),e(),()=>{window.removeEventListener(`resize`,e),window.visualViewport?.removeEventListener(`resize`,e)}},[]),e}var Ak=`tolmapOverlay`;function jk(e){return e===`reader`||e===`repos`||e===`search`||e===`layers`||e===`sheet`||e===`sel`}function Mk(e,t,n,r=!1){return jk(t)?t===`reader`&&r&&n?{index:e,entries:[{kind:`sel`,index:e-1,live:!0},{kind:`reader`,index:e,live:!0}]}:{index:e,entries:[{kind:t,index:e,live:t===`sel`&&n||t===`reader`&&r}]}:{index:e,entries:[]}}function Nk(e,t,n){if(e.entries.some(e=>e.live&&e.kind===t))return{state:{...e,index:n},push:!1};let r=e.entries.filter(e=>e.index<=n);return{state:{index:n+1,entries:[...r,{kind:t,index:n+1,live:!0}]},push:!0}}function Pk(e,t){let n=-1;for(let r=e.entries.length-1;r>=0;r--)if(e.entries[r].live&&e.entries[r].kind===t){n=r;break}if(n<0)return e;let r=e.entries.map((e,t)=>t===n?{...e,live:!1}:e);return{...e,entries:r}}function Fk(e,t,n,r){let i=t<e.index,a=e.entries.filter(e=>e.index>t).sort((e,t)=>t.index-e.index),o=a.filter(e=>e.live).map(e=>e.kind),s=e.entries.filter(e=>e.index<=t),c=s.find(e=>e.index===t);!c&&jk(n)&&(c={kind:n,index:t,live:n===`sel`&&r&&!o.includes(`sel`)&&!s.some(e=>e.live&&e.kind===`sel`)},s=[...s,c]);let l=i&&o.length===0&&(a.length>0||!!c&&!c.live);return{state:{index:t,entries:s},undo:o,skipBack:l}}function Ik(e,t){let n=t.split(`:`),r=e.file_neighbourhoods??null,i=t=>{let n=[],r=0;for(let[i,a]of e.E)t(i,a)&&(r++,n.length<60&&n.push([i,a]));return{pairs:n,pairTotal:r}};if(n[0]===`r`){let t=+n[1],r=+n[2],{pairs:a,pairTotal:o}=i((n,i)=>{let a=V(e,n),o=V(e,i);return a===t&&o===r||a===r&&o===t});return{kind:`road`,pairs:a,pairTotal:o,files:[],district:null}}if(n[0]===`st`&&n[1]===`n`&&r){let e=n[2],t=n[3],{pairs:a,pairTotal:o}=i((n,i)=>r[n]===e&&r[i]===t||r[n]===t&&r[i]===e);return{kind:`street`,pairs:a,pairTotal:o,files:[],district:null}}if(n[0]===`st`&&n[1]===`c`&&r){let t=n[2],a=+n[3],{pairs:o,pairTotal:s}=i((n,i)=>r[n]===t&&V(e,i)===a||V(e,n)===a&&r[i]===t);return{kind:`street`,pairs:o,pairTotal:s,files:[],district:null}}if(n[0]===`n`){let t=n.slice(1).join(`:`),i=e.neighbourhoods?.[t];if(!i)return null;let a=[];return r&&r.forEach((e,n)=>{e===t&&a.push(n)}),a.sort((t,n)=>e.N[n][3]-e.N[t][3]||t-n),{kind:`neighborhood`,pairs:[],pairTotal:0,files:a,district:i.d}}return null}function Lk(e,t){let n=0,r=!1;if(!t||!t.contains(e))return{scrollTop:n,canScroll:r};for(let i=e;i;i=i.parentElement){let e=i,a=getComputedStyle(e).overflowY;if((a===`auto`||a===`scroll`)&&e.scrollHeight>e.clientHeight+1&&(r=!0,n+=Math.max(0,e.scrollTop)),i===t)break}return{scrollTop:n,canScroll:r}}function Rk({detent:e,heights:t,onDetent:n,children:r}){let[i,a]=(0,_.useState)(null),o=(0,_.useRef)(null),s=(0,_.useRef)(!1),c=(0,_.useRef)(null),l=(0,_.useRef)(null),u=(0,_.useRef)(e);u.current=e;let d=i??t[e];(0,_.useEffect)(()=>{e===`peek`&&c.current&&(c.current.scrollTop=0)},[e]);function f(e,t){return e.owner?e.owner:Math.abs(t)<3?null:(e.owner=Ol({detent:u.current,scrollTop:e.scrollTop,canScroll:e.canScroll,direction:t>0?`down`:`up`,zone:e.zone}),e.owner)}(0,_.useEffect)(()=>{let e=l.current;if(!e)return;let t=e=>{let t=o.current;t&&e.touches.length===1&&f(t,e.touches[0].clientY-t.y0)===`sheet`&&e.cancelable&&e.preventDefault()};return e.addEventListener(`touchmove`,t,{passive:!1}),()=>e.removeEventListener(`touchmove`,t)},[]);function p(e){if(!e.isPrimary)return;let t=e.target,n=t.closest(`[data-sheet-grabber], [data-sheet-dragzone]`)?`handle`:`content`,{scrollTop:r,canScroll:i}=Lk(t,c.current);o.current={id:e.pointerId,y0:e.clientY,h0:d,zone:n,scrollTop:r,canScroll:i,owner:null,moved:!1,samples:[[e.timeStamp,e.clientY]]}}function m(e){let n=o.current;if(!n||e.pointerId!==n.id)return;let r=e.clientY-n.y0;if(f(n,r)===`sheet`){if(!n.moved){if(Math.abs(r)<8)return;n.moved=!0;try{l.current?.setPointerCapture(e.pointerId)}catch{}}a(El(n.h0,r,t)),n.samples.push([e.timeStamp,e.clientY]),n.samples.length>6&&n.samples.shift()}}function h(e){let r=o.current;if(!r||e.pointerId!==r.id||(o.current=null,!r.moved))return;s.current=!0,setTimeout(()=>{s.current=!1},0);let i=El(r.h0,e.clientY-r.y0,t);a(null),n(wl(i,Dl(r.samples),t))}return(0,b.jsxs)(`section`,{ref:l,"aria-label":`Map details`,"data-phone-sheet":!0,"data-selection-panel":!0,"data-detent":e,"data-sheet-height":Math.round(d),onPointerDown:p,onPointerMove:m,onPointerUp:h,onPointerCancel:h,onClickCapture:e=>{s.current&&(e.stopPropagation(),e.preventDefault())},className:`absolute inset-x-0 bottom-0 z-30 flex flex-col rounded-t-[20px] border-t border-[var(--rule)] bg-[var(--chrome)] text-[var(--on)] shadow-[0_-8px_24px_rgba(0,0,0,.3)] ${i==null?`transition-[height] duration-300 ease-[cubic-bezier(.2,.8,.2,1)] motion-reduce:transition-none`:``}`,style:{height:d,touchAction:`auto`},children:[(0,b.jsx)(`button`,{type:`button`,"data-sheet-grabber":!0,"aria-expanded":e!==`peek`,"aria-label":`Sheet at ${e}; tap to ${e===`full`?`collapse`:`expand`}`,onClick:()=>{s.current||n(Tl(e))},className:`absolute left-1/2 top-0 z-10 flex h-11 w-[88px] -translate-x-1/2 items-start justify-center pt-3`,style:{touchAction:`none`},children:(0,b.jsx)(`span`,{className:`block h-[5px] w-9 rounded-[3px] bg-[var(--grabber)]`})}),(0,b.jsx)(`div`,{ref:c,"data-sheet-body":!0,className:`min-h-0 flex-1 overflow-y-auto px-5 pt-7`,style:{paddingBottom:`calc(20px + env(safe-area-inset-bottom, 0px))`,touchAction:`pan-y`,overscrollBehavior:`contain`},children:r})]})}function zk({open:e,detent:t,children:n}){return(0,b.jsx)(`section`,{"aria-label":`Map details`,"data-phone-sheet":!0,"data-side-sheet":!0,"data-selection-panel":!0,"data-detent":t,"data-side-open":e,className:`absolute inset-y-0 left-0 z-30 flex flex-col border-r border-[var(--rule)] bg-[var(--chrome)] text-[var(--on)] shadow-[8px_0_24px_rgba(0,0,0,.3)] transition-[transform,visibility] duration-300 ease-[cubic-bezier(.2,.8,.2,1)] motion-reduce:transition-none ${e?``:`invisible`}`,style:{width:`calc(360px + env(safe-area-inset-left, 0px))`,paddingLeft:`env(safe-area-inset-left, 0px)`,transform:e?`none`:`translateX(-100%)`},children:(0,b.jsx)(`div`,{"data-sheet-body":!0,className:`min-h-0 flex-1 overflow-y-auto px-5`,style:{paddingTop:`calc(16px + env(safe-area-inset-top, 0px))`,paddingBottom:`calc(20px + env(safe-area-inset-bottom, 0px))`,touchAction:`pan-y`,overscrollBehavior:`contain`},children:n})})}var Bk=178,Vk=[{id:`d`,name:`District`,meaning:`One colour per district`},{id:`c`,name:`Churn`,meaning:`How often each file changed`},{id:`x`,name:`Complexity`,meaning:`Branch points in each file`},{id:`p`,name:`Package`,meaning:`Folders, drawn over the districts`}];function Hk(e){let t=`${e.owner}/${e.repo}`,n=Tw(e.searchOpen),r=(0,_.useRef)(e.searchOpen);(0,_.useEffect)(()=>{r.current&&!e.searchOpen&&document.querySelector(`[data-open-search]`)?.focus({preventScroll:!0}),r.current=e.searchOpen},[e.searchOpen]);let i=(0,b.jsx)(pk,{doc:e.doc,packageLayout:e.packageLayout,sel:e.sel,selSym:e.selSym,selD:e.selD,selHSym:e.selHSym,symbolsDoc:e.symbolsDoc,symbolsLoading:e.symbolsLoading,adj:e.adj,radj:e.radj,detent:e.detent,onDetent:e.onDetent,quality:e.quality,onCloseQuality:()=>e.onQuality(!1),structure:e.structure,onCloseStructure:e.onCloseStructure,pathPick:e.pathPick,pathEnds:e.pathEnds,route:e.route,onPath:e.onPath,onPathCancel:e.onPathCancel,onClearSelection:e.onClearSelection,onSelectFile:e.onSelectFile,onSelectSymbol:e.onSelectSymbol,onSelectHierSymbol:e.onSelectHierSymbol,onSelectDistrict:e.onSelectDistrict,onZoomDistrict:e.onZoomDistrict,onSelectDirectory:e.onSelectDirectory,onBreadcrumbRepo:e.onBreadcrumbRepo,onBreadcrumbFile:e.onBreadcrumbFile,onDistrictDetails:e.landscape?void 0:()=>e.onDetent(`half`)}),a=(0,b.jsx)(rk,{doc:e.doc,slug:t,layer:e.layer,packageLayout:e.packageLayout,packageGrouping:e.packageGrouping,activeDirectory:e.activeDirectory,tab:e.indexTab,onTab:e.onIndexTab,onOpenQuality:()=>e.onQuality(!0),onSelectDistrict:e.onPickDistrict,onFrameDistricts:e.onFrameDistricts,onPickKeyFile:e.onPickKeyFile,onSelectDirectory:e.onSelectDirectory}),o=!!e.pathPick||!!e.structure||e.quality||e.sel!=null||e.selD!=null,s=e.comparison&&!o?e.comparison:(0,b.jsxs)(b.Fragment,{children:[e.comparison&&(0,b.jsx)(`button`,{className:`min-h-11 py-2 underline`,onClick:e.onClearSelection,children:`Back to comparison`}),!e.structure&&!e.quality&&!e.pathPick&&e.walkthrough,e.sourceAction&&(0,b.jsx)(`div`,{className:e.landscape?`pb-3`:`pt-4 pb-3`,children:e.sourceAction}),o?i:e.activeLens??a]}),c=e.landscape&&e.sideOpen?`360px + env(safe-area-inset-left, 0px)`:`env(safe-area-inset-left, 0px)`,l=`flex h-11 w-11 items-center justify-center border-b border-[var(--rule)] text-[var(--on)] last:border-b-0`;return(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)(`div`,{"data-search-pill":!0,className:`absolute z-20 flex h-12 items-center gap-1 rounded-[24px] border border-[var(--rule)] bg-[var(--chrome2)] px-0.5 shadow-[0_6px_18px_rgba(0,0,0,.25)]`,style:{top:`calc(12px + env(safe-area-inset-top, 0px))`,left:`calc(${c} + 12px)`,right:`calc(12px + env(safe-area-inset-right, 0px))`},children:[(0,b.jsxs)(`button`,{type:`button`,"aria-label":`Search ${t}`,"data-open-search":!0,onClick:e.onOpenSearch,className:`flex h-11 min-w-[96px] flex-1 items-center gap-2.5 px-2 text-left`,children:[(0,b.jsx)(`span`,{className:`shrink-0 text-[var(--dim)]`,children:(0,b.jsx)($u,{})}),(0,b.jsx)(`span`,{className:`truncate text-body text-[var(--dim)]`,children:`Search`})]}),(0,b.jsxs)(`button`,{type:`button`,"data-switch-repo":!0,"aria-label":`Repository ${t}: switch repository or go home`,"aria-haspopup":`dialog`,"aria-expanded":e.reposOpen,onClick:e.onOpenRepos,className:`flex h-11 min-w-0 max-w-[68%] shrink items-center gap-1.5 rounded-[22px] border border-[var(--rule)] bg-[var(--chrome)] pl-3.5 pr-2.5 text-[var(--on)]`,children:[(0,b.jsx)(`span`,{className:`min-w-0 truncate font-mono text-[15px]`,children:e.catalogue?.find(e=>e.slug===t)?.label??t}),(0,b.jsx)(`span`,{className:`shrink-0 text-[var(--dim)]`,children:(0,b.jsx)(md,{size:16})})]})]}),(e.landscape||e.viewportHeight-e.heights[e.detent]>=e.safeTop+68+Bk+8)&&(0,b.jsxs)(`div`,{"data-control-column":!0,className:`absolute z-20 flex w-[46px] flex-col overflow-hidden rounded-[12px] border border-[var(--rule)] bg-[var(--chrome2)] shadow-[0_6px_18px_rgba(0,0,0,.25)]`,style:{top:`calc(68px + env(safe-area-inset-top, 0px))`,right:`calc(12px + env(safe-area-inset-right, 0px))`},children:[(0,b.jsx)(`button`,{type:`button`,className:l,onClick:e.onZoomIn,"aria-label":`Zoom in`,children:(0,b.jsx)(td,{})}),(0,b.jsx)(`button`,{type:`button`,className:l,onClick:e.onZoomOut,"aria-label":`Zoom out`,children:(0,b.jsx)(nd,{})}),(0,b.jsx)(`button`,{type:`button`,className:l,onClick:e.onFit,"aria-label":`Fit map`,children:(0,b.jsx)(rd,{})}),(0,b.jsx)(`button`,{type:`button`,className:l,onClick:e.onOpenLayers,"aria-label":`Map layers`,"aria-expanded":e.layersOpen,children:(0,b.jsx)(id,{})}),e.landscape&&(0,b.jsx)(`button`,{type:`button`,className:l,onClick:e.onToggleSide,"data-side-toggle":!0,"aria-label":e.sideOpen?`Hide the side sheet`:`Show the side sheet`,"aria-expanded":e.sideOpen,style:e.sideOpen?{color:`var(--accent)`}:void 0,children:(0,b.jsx)(pd,{})})]}),e.landscape?(0,b.jsx)(zk,{open:e.sideOpen,detent:e.detent,children:s}):(0,b.jsx)(Rk,{detent:e.detent,heights:e.heights,onDetent:e.onDetent,children:s}),e.layersOpen&&(0,b.jsxs)(Uk,{kind:`layers`,label:`Map layers and display`,title:`Map layer`,closeLabel:`Close layers`,landscape:e.landscape,onClose:e.onCloseLayers,children:[e.lenses,(0,b.jsx)(`div`,{role:`radiogroup`,"aria-label":`Map layer`,className:`mt-1.5 overflow-hidden rounded-[14px] border border-[var(--rule)]`,children:Vk.map(t=>{let n=e.layer===t.id;return(0,b.jsxs)(`div`,{className:`border-b border-[var(--rule)] last:border-b-0`,style:n?{background:`color-mix(in srgb, var(--accent) 10%, transparent)`}:void 0,children:[(0,b.jsxs)(`button`,{type:`button`,role:`radio`,"aria-checked":n,"data-layer-option":t.id,onClick:()=>e.onLayer(t.id),className:`flex min-h-[60px] w-full items-center gap-3 px-3.5 py-2 text-left`,children:[(0,b.jsx)(`span`,{className:`flex h-[22px] w-[22px] shrink-0 items-center justify-center rounded-full border-2`,style:{borderColor:n?`var(--accent)`:`var(--grabber)`},children:n&&(0,b.jsx)(`span`,{className:`h-2.5 w-2.5 rounded-full bg-[var(--accent)]`})}),(0,b.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[(0,b.jsx)(`span`,{className:`text-row`,children:t.name}),(0,b.jsx)(`span`,{className:`text-meta text-[var(--dim)]`,children:t.meaning}),(t.id===`c`||t.id===`x`)&&(0,b.jsxs)(`span`,{className:`mt-1 flex items-center gap-2`,"data-ramp-legend":t.id,children:[(0,b.jsx)(`span`,{className:`h-2 w-32 shrink-0 rounded`,style:{background:`linear-gradient(90deg,${Do.join(`,`)})`}}),(0,b.jsx)(`span`,{className:`font-mono text-meta text-[var(--dim)]`,children:t.id===`c`?`1 → ${e.maxCh} commits`:`0 → ${e.maxCx}`})]})]})]}),t.id===`p`&&n&&(0,b.jsx)(`div`,{className:`px-3.5 pb-3`,children:(0,b.jsx)(qD,{grouping:e.packageGrouping,auto:e.depthAuto,minDepth:e.packageLayout.minDepth,maxDepth:e.packageLayout.maxDepth,onDepth:e.onDepth,variant:`sheet`})})]},t.id)})}),(0,b.jsx)(`h3`,{className:`mt-5 text-[15px] font-semibold`,children:`Appearance`}),(0,b.jsx)(Dc,{})]}),e.reposOpen&&(0,b.jsx)(Uk,{kind:`repo`,label:`Repositories`,title:`Repository`,closeLabel:`Close repositories`,landscape:e.landscape,onClose:e.onCloseRepos,children:(0,b.jsx)(Wk,{doc:e.doc,slug:t,catalogue:e.catalogue,onLeave:e.onCloseRepos})}),e.searchOpen&&(0,b.jsx)(`section`,{"aria-label":`Search`,"data-search-layer":!0,className:`fixed inset-x-0 top-0 z-50 h-full bg-[var(--chrome)] text-[var(--on)]`,style:n?{top:n.top,height:n.height}:void 0,children:(0,b.jsx)(pO,{doc:e.doc,variant:`overlay`,onPick:e.onSearchPick,onClose:e.onCloseSearch})})]})}function Uk({kind:e,label:t,title:n,closeLabel:r,landscape:i,onClose:a,children:o}){return(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(`div`,{[`data-${e}-scrim`]:``,className:`absolute inset-0 z-40 bg-[rgba(4,8,10,.55)]`,onClick:a}),(0,b.jsxs)(`section`,{"aria-label":t,[`data-${e}-sheet`]:``,className:`absolute z-40 overflow-y-auto border-[var(--rule)] bg-[var(--chrome)] px-5 text-[var(--on)] ${i?`inset-y-0 left-0 border-r shadow-[8px_0_24px_rgba(0,0,0,.3)]`:`inset-x-0 bottom-0 max-h-[88%] rounded-t-[20px] border-t shadow-[0_-8px_24px_rgba(0,0,0,.3)]`}`,style:{paddingBottom:`calc(20px + env(safe-area-inset-bottom, 0px))`,overscrollBehavior:`contain`,...i?{width:`calc(360px + env(safe-area-inset-left, 0px))`,paddingLeft:`calc(20px + env(safe-area-inset-left, 0px))`,paddingTop:`env(safe-area-inset-top, 0px)`}:{}},children:[(0,b.jsx)(`div`,{className:`flex justify-center`,children:(0,b.jsx)(`span`,{className:`mb-3 mt-[11px] block h-[5px] w-9 rounded-[3px] bg-[var(--grabber)]`})}),(0,b.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,b.jsx)(`h2`,{className:`min-w-0 flex-1 text-sheet-title`,children:n}),(0,b.jsx)(`button`,{type:`button`,"aria-label":r,onClick:a,className:`-mr-2.5 -mt-1.5 flex h-11 w-11 shrink-0 items-center justify-center rounded-full bg-[var(--chrome2)]`,children:(0,b.jsx)(ad,{})})]}),o]})]})}function Wk({doc:e,slug:t,catalogue:n,onLeave:r}){let i=Fc(),a=0;for(let t of Object.values(e.districts))B(t)===`mainland`&&a++;let o=(n??[]).filter(e=>e.slug!==t),s=`flex min-h-[56px] w-full items-center gap-3 border-b border-[var(--rule)] px-3.5 py-2 text-left last:border-b-0`;return(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)(`div`,{"data-repo-current":!0,className:`mt-1.5 rounded-[14px] border border-[var(--rule)] bg-[var(--chrome2)] px-3.5 py-2.5`,children:[(0,b.jsx)(`div`,{className:`text-meta text-[var(--dim)]`,children:`On screen`}),(0,b.jsx)(`div`,{className:`truncate font-mono text-row`,children:n?.find(e=>e.slug===t)?.label??t}),(0,b.jsxs)(`div`,{className:`text-meta text-[var(--dim)]`,children:[(0,b.jsx)(`span`,{className:`font-mono`,children:e.F.length.toLocaleString(`en-US`)}),` files · `,(0,b.jsx)(`span`,{className:`font-mono`,children:a}),` districts`]})]}),(0,b.jsxs)(`div`,{className:`mt-3 overflow-hidden rounded-[14px] border border-[var(--rule)]`,children:[(0,b.jsxs)(fa,{to:`/`,replace:!0,onClick:r,"data-repo-home":!0,className:s,children:[(0,b.jsx)(`span`,{className:`shrink-0 text-[var(--dim)]`,children:(0,b.jsx)(ed,{})}),(0,b.jsx)(`span`,{className:`min-w-0 flex-1 text-row`,children:`Home`})]}),Ha?.onboarding?(0,b.jsx)(`button`,{type:`button`,"data-repo-map-another":!0,className:s,onClick:()=>{r(),i()},children:`Add repository`}):(0,b.jsxs)(fa,{to:`/`,hash:`repo-field`,replace:!0,onClick:r,"data-repo-map-another":!0,className:s,children:[(0,b.jsx)(`span`,{className:`shrink-0 text-[var(--accent)]`,children:(0,b.jsx)(td,{})}),(0,b.jsx)(`span`,{className:`min-w-0 flex-1 text-row`,children:`Map another repository`})]})]}),(0,b.jsx)(`h3`,{className:`mt-5 text-[15px] font-semibold`,children:`Mapped repositories`}),o.length?(0,b.jsx)(`div`,{className:`mt-1.5 overflow-hidden rounded-[14px] border border-[var(--rule)]`,children:o.map(e=>(0,b.jsxs)(fa,{to:`/$owner/$repo`,params:{owner:e.owner,repo:e.repo},search:{geo:`r`,layer:`d`},replace:!0,onClick:r,"data-repo-row":e.slug,className:s,children:[(0,b.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,b.jsx)(`span`,{className:`truncate font-mono text-row`,children:e.label??e.slug}),(0,b.jsxs)(`span`,{className:`truncate text-meta text-[var(--dim)]`,children:[(0,b.jsx)(`span`,{className:`font-mono`,children:e.files.toLocaleString(`en-US`)}),` files · `,e.lang]})]}),(0,b.jsx)(`span`,{className:`shrink-0 text-[var(--dim)]`,"aria-hidden":`true`,children:(0,b.jsx)(od,{})})]},e.slug))}):(0,b.jsx)(`p`,{className:`mt-1.5 text-small text-[var(--dim)]`,children:n?`No other repositories are mapped yet.`:`loading…`})]})}function Gk(){let{owner:e,repo:t}=Ji({strict:!1}),n=Yi({strict:!1}),r=z(),i=Vd(e,t,{...n,compare:n.compare&&!n.lens_compare}),a=(0,_.useRef)(null),o=(0,_.useRef)(!!n.read);(0,_.useEffect)(()=>{o.current&&!n.read&&a.current?.focus({preventScroll:!0}),o.current=!!n.read},[n.read]);let{data:s}=Vu(),c=$E(n.job),{data:l,isLoading:u,isError:d,error:f,source:p,indexedCommit:m,mapSha256:h}=Hu(e,t,{commit:n.base??n.commit??c.commit,wait:c.waiting}),g=Ad(e,t,m??n.base??n.commit??c.commit,n.lens,!!l&&!c.waiting),v=Td(e,t,n,m,h),y=n.lens_compare?void 0:g.data?.report,x=!!y&&bd(n.lens),S=(0,_.useMemo)(()=>y&&x?{...y,paths:y.paths.filter(e=>e.name===n.path)}:y,[y,x,n.path]),C=(0,_.useMemo)(()=>l&&y&&x?wd(y.paths,l.F,e=>V(l,e)):void 0,[l,y,x]),w=(0,_.useRef)(null),T=(0,_.useRef)(!1);(0,_.useEffect)(()=>{!T.current&&g.data&&(T.current=!0,n.path&&n.step&&!n.lens_compare&&w.current?.(n.path,n.step,!1))},[g.data]);let[E,D]=(0,_.useState)(new Set),O=(0,_.useRef)(new Set),k=(0,_.useRef)(null),ee=e=>{O.current.add(e),k.current??=setTimeout(()=>{k.current=null;let e=O.current;O.current=new Set,D(t=>{let n=!1,r=new Set(t);for(let t of e)r.has(t)||(r.add(t),n=!0);return n?r:t})},200)};(0,_.useEffect)(()=>()=>{k.current!=null&&clearTimeout(k.current)},[]);let{map:A,loading:j}=Uu(e,t,p,[...E],{commit:m??n.base??n.commit??c.commit,ready:!c.waiting&&!c.detailPending});(0,_.useEffect)(()=>{n.job&&c.settled&&wt({job:void 0,commit:c.commit})},[n.job,c.settled]);let M=(0,_.useRef)(null),N=(0,_.useRef)(null),[te,ne]=(0,_.useState)(null),[P,re]=(0,_.useState)(null),F=Bl(),I=Ml(F),ie=F===`landscape`,ae=Nl(F),[oe,se]=(0,_.useState)(!0),[ce,le]=(0,_.useState)(()=>typeof window>`u`||window.innerWidth>=900),[ue,de]=(0,_.useReducer)(yO,vO),[fe,pe]=(0,_.useState)(!1),[me,he]=(0,_.useState)(!1),ge=(0,_.useRef)(null),[_e,ve]=gs(),ye=gi(),be=kk(),xe={top:be.safeTop,right:be.safeRight??0,bottom:be.safeBottom,left:be.safeLeft??0},Se=(0,_.useRef)(be.width);(0,_.useEffect)(()=>{let e=Se.current;(e<900&&be.width>=900||e>=900&&be.width<900)&&le(be.width>=900),Se.current=be.width},[be.width]);let Ce=Sl(be),[we,Te]=(0,_.useState)(`peek`),Ee=(0,_.useRef)(`half`),De=(0,_.useRef)(!1),[Oe,ke]=(0,_.useState)(!1),[Ae,je]=(0,_.useState)(!1),[Me,Ne]=(0,_.useState)(!1),[Pe,Fe]=(0,_.useState)(!1),[Ie,Le]=(0,_.useState)(`districts`),[Re,ze]=(0,_.useState)(null),[Be,Ve]=(0,_.useState)(null),[He,Ue]=(0,_.useState)(null),[We,Ge]=(0,_.useState)(!1),Ke=Cl(be,Ce.peek),qe=()=>Ll({profile:F,panelOpen:ce,safe:xe}),Je=()=>I?ie?{frame:Fl(!0,xe),safe:Fl(!0,xe),centreInSafe:!0}:{frame:Ke,safe:Ke,centreInSafe:!0}:{frame:qe(),safe:qe(),centreInSafe:!0};function Ye(){M.current?.setInsets(Je())}let Xe=_s(),Ze=(0,_.useMemo)(()=>l?ns(l):null,[l,Xe]);(0,_.useEffect)(()=>{function e(){Ge(!!document.fullscreenElement&&document.fullscreenElement===N.current)}return document.addEventListener(`fullscreenchange`,e),()=>document.removeEventListener(`fullscreenchange`,e)},[]);async function Qe(){if(document.fullscreenElement)try{await document.exitFullscreen()}catch{}Ge(!1)}async function $e(){let e=N.current;if(e?.requestFullscreen)try{await e.requestFullscreen();return}catch{}Ge(!0)}function et(){We?Qe():$e()}let{adj:tt,radj:nt}=(0,_.useMemo)(()=>l?qw(l):{adj:new Map,radj:new Map},[l]),{maxCh:rt,maxCx:it}=(0,_.useMemo)(()=>l?{maxCh:Math.max(1,...l.N.map(e=>e[5])),maxCx:Math.max(1,...l.N.map(e=>e[4]))}:{maxCh:1,maxCx:1},[l]),L=l&&n.file?(()=>{let e=l.F.indexOf(n.file);return e>=0?e:null})():null,at=L!=null&&n.sym!=null?n.sym:null,ot=L!=null&&n.hsym!=null?n.hsym:null,st=n.lens_compare?void 0:Md(g.data?.report,n.path,n.step)?.stop.target,ct=L!=null&&at!=null?l?.S[String(L)]?.[at]:void 0,lt=st&&st.file===L&&ct&&st.symbol&&ct[0]===st.symbol.name&&ct[2]===st.symbol.start?A.get(st.district):void 0,ut=lt?.symbols.findIndex(e=>e[0]===st.file&&(e[1]===st.symbol.name||st.symbol.name.endsWith(`.${e[1]}`))&&e[3]===st.symbol.start)??-1,dt=ot??(lt&&ut>=0?lt.symbol_indices[ut]:null),ft=(0,_.useRef)(!1);function pt(e,t,n){let r=l&&n!=null?A.get(V(l,e)):void 0,i=r&&n!=null?r.symbols[r.symbol_indices.indexOf(n)]:void 0,a=t==null?void 0:l?.S[String(e)]?.[t],o=i?.[3]??a?.[2]??1;return{line:o,end:i?.[4]??a?.[3]??o}}function mt(){if(L==null||!l)return;let{line:e,end:t}=pt(L,at,ot);I?(Ft(`reader`),wt({read:!0,line:e,end:t,commit:m??n.commit})):(ft.current=!0,r({to:`.`,search:r=>({...r,read:!0,line:e,end:t,commit:m??n.commit}),state:!0}))}function ht(){I?(It(`reader`),wt({read:void 0})):ft.current?(ft.current=!1,ye.history.back()):wt({read:void 0})}let gt=L==null&&n.d!=null?n.d:null,_t=(0,_.useRef)(ce);(0,_.useEffect)(()=>{let e=_t.current;_t.current=ce,!I&&!e&&ce&&l&&(L!=null&&B(l.districts[String(l.N[L][0])])!==`unconnected`?M.current?.panTo(L):gt!=null&&M.current?.panToDistrict(gt))},[ce,I,l,L,gt]);let vt=I?ie?{frame:Fl(!0,xe),safe:Fl(oe,xe),centreInSafe:!0}:{frame:Ke,safe:Cl(be,Ce[we===`full`?`half`:we]),centreInSafe:!0}:{frame:qe(),safe:qe(),centreInSafe:!0},yt=l&&L!=null?V(l,L):null,bt=yt==null?void 0:A.get(yt),xt=yt!=null&&!bt&&(!E.has(yt)||j.has(yt));(0,_.useEffect)(()=>{yt!=null&&D(e=>e.has(yt)?e:new Set(e).add(yt))},[yt]);let St=(0,_.useMemo)(()=>{let e=new Map;for(let t of A.values())t.symbol_indices.forEach((n,r)=>e.set(n,t.symbols[r][0]));return e},[A]);function Ct(e){if(!l)return;let t=St.get(e);if(t!=null){if(!I){let n=V(l,t),r=A.get(n),i=r?.symbol_indices.indexOf(e)??-1,a=r&&i>=0?IT(r.symbols[i]):`Symbol`;de({type:`map-symbol`,district:n,file:t,label:a,hierarchicalSymbol:e})}wt({file:l.F[t],sym:void 0,hsym:e,d:void 0,dir:void 0,...n.read?pt(t,null,e):{line:void 0,end:void 0}}),Ye(),B(l.districts[String(V(l,t))])!==`unconnected`&&M.current?.panTo(t)}}function wt(e){r({to:`.`,search:t=>({...t,sel:void 0,...e}),replace:!0,state:!0})}function Tt(e,t={}){if(l){if(!I){let n=V(l,e);if(t.symbol!=null){let r=l.S?.[String(e)]?.[t.symbol]?.[0]??`Symbol`;de({type:`map-symbol`,district:n,file:e,label:r,symbol:t.symbol})}else de({type:`map-file`,district:n,file:e})}wt({file:l.F[e],sym:t.symbol,hsym:void 0,d:void 0,dir:void 0,...n.read?pt(e,t.symbol):{line:void 0,end:void 0}}),Ye(),B(l.districts[String(l.N[e][0])])!==`unconnected`&&M.current?.panTo(e)}}function Et(e){I||de({type:`map-district`,district:e}),wt({file:void 0,sym:void 0,d:e,dir:void 0}),I||(Ye(),M.current?.panToDistrict(e))}function Dt(){I||de({type:`overview`}),Fe(!1),wt({file:void 0,sym:void 0,hsym:void 0,d:void 0,dir:void 0})}function Ot(e){if(Be&&!He&&e.kind===`file`){on(e.i);return}e.kind===`district`?(Et(e.d),Ye(),M.current?.panToDistrict(e.d)):Tt(e.i,e.kind===`symbol`?{symbol:e.s}:{})}function kt(e){re(null),ne(null),wt({file:void 0,sym:void 0,d:void 0,dir:e})}let At=(0,_.useRef)(null),jt=(0,_.useRef)(!1),Mt=(0,_.useRef)(n);jt.current||(Mt.current=n);let Nt=(0,_.useRef)(ye.history.location.pathname);Nt.current=ye.history.location.pathname;let Pt=()=>Number(ye.history.location.state.__TSR_index??0);function Ft(e){if(!I)return;let{state:t,push:n}=Nk(At.current??Mk(Pt(),null,!1),e,Pt());At.current=t,n&&(ye.history.push(ye.history.location.href,{[Ak]:e}),ye.history.flush())}function It(e){At.current&&=Pk(At.current,e)}function Lt(e){e!==we&&(e===`peek`?It(`sheet`):Ft(`sheet`),Te(e))}function Rt(){Ft(`search`),ke(!0)}function zt(){It(`search`),ke(!1)}function Bt(){Ft(`layers`),je(!0)}function Vt(){It(`layers`),je(!1)}function Ht(){Ft(`repos`),Ne(!0)}function Ut(){It(`repos`),Ne(!1)}function R(){Ve(null),Ue(null),ne(null)}function Wt(e){e.type===`overview`?(Fe(!1),R(),Dt()):e.type===`district`?(Fe(!1),R(),Et(e.district)):e.type===`file`?(Fe(!1),R(),Tt(e.file)):e.type===`symbol`?(Fe(!1),R(),e.hierarchicalSymbol==null?Tt(e.file,e.symbol==null?{}:{symbol:e.symbol}):Ct(e.hierarchicalSymbol)):e.type===`quality`&&Fe(!0)}function Gt(){if(ue.length<=1)return!1;let e=ue[ue.length-1],t=ue[ue.length-2];return de({type:`pop`}),e.type===`quality`&&Fe(!1),e.type===`path`&&R(),t&&Wt(t),!0}function Kt(e){let t=ue[e];t&&(de({type:`jump`,index:e}),Wt(t))}function qt(){Fe(!0),de({type:`push`,view:{type:`quality`}})}function Jt(){let e=N.current?.querySelector(`[data-desktop-panel]`);return!e||!ce||ue.at(-1)?.type!==`overview`?[]:Array.from(e.querySelectorAll(`[data-district-index-row], [data-overview-district-row], [data-overview-file], [data-package-overview-row]`)).filter(e=>e.getClientRects().length>0)}function Yt(e){let t=Jt();if(!t.length)return;let n=t.indexOf(document.activeElement),r=t[n<0?e>0?0:t.length-1:(n+e+t.length)%t.length];ge.current=r,r.focus({preventScroll:!0}),r.scrollIntoView({block:`nearest`})}function Xt(){let e=Jt(),t=document.activeElement;(e.includes(t)?t:ge.current&&e.includes(ge.current)?ge.current:null)?.click()}let Zt=(0,_.useRef)(()=>{});Zt.current=e=>{e===`repos`?Ne(!1):e===`search`?ke(!1):e===`layers`?je(!1):e===`reader`?wt({read:void 0}):e===`sheet`?Te(`peek`):(ze(null),R())};let Qt=L!=null||gt!=null||!!n.dir||!!Re||!!Be,$t=Qt||!!n.file&&(!l||!!n.read),en=(0,_.useRef)(Qt);en.current=Qt,(0,_.useEffect)(()=>{if(!I)return;jt.current=!1;let e=ye.history.location.state;At.current=Mk(Pt(),e[Ak],en.current||!!Mt.current.file,!!Mt.current.read)},[I,e,t]);let tn=!!n.lens&&!!n.path&&!!n.step&&!n.lens_compare;(0,_.useEffect)(()=>{I&&!jt.current&&($t?tn||Ft(`sel`):It(`sel`))},[$t,tn,I]),(0,_.useEffect)(()=>{I&&n.read&&!jt.current&&Ft(`reader`)},[I,n.read,$t]),(0,_.useEffect)(()=>{if(I)return ye.history.subscribe(({location:e,action:t})=>{if(t.type!==`BACK`&&t.type!==`FORWARD`&&t.type!==`GO`)return;if(e.pathname!==Nt.current){jt.current=!1;return}let n=e.state,i=Number(n.__TSR_index??0),a=Fk(At.current??Mk(i,null,!1),i,n[Ak],en.current);At.current=a.state;for(let e of a.undo)Zt.current(e);let o=a.undo.includes(`reader`)?{...Mt.current,read:void 0}:Mt.current,s=a.undo.includes(`sel`)?{...o,file:void 0,sym:void 0,hsym:void 0,d:void 0,dir:void 0}:o;Mt.current=s,jt.current=a.skipBack,a.skipBack?ye.history.back():r({to:`.`,search:s,replace:!0,state:!0})})},[I]),(0,_.useEffect)(()=>{if(!I)return ye.history.subscribe(({location:e,action:t})=>{if(t.type!==`BACK`&&t.type!==`GO`||e.pathname!==Nt.current||!Mt.current.read)return;ft.current=!1;let n={...Mt.current,read:void 0};Mt.current=n,r({to:`.`,search:n,replace:!0,state:!0})})},[I]);let nn=`${L}|${at}|${ot}|${gt}|${n.dir??``}`,rn=(0,_.useRef)(null);(0,_.useEffect)(()=>{if(!l)return;if(I&&rn.current==null){rn.current=nn;return}let e=rn.current!==nn;if(rn.current=nn,!I){if(L!=null&&ot!=null){let e=V(l,L),t=A.get(e),n=t?.symbol_indices.indexOf(ot)??-1;de({type:`map-symbol`,district:e,file:L,label:t&&n>=0?IT(t.symbols[n]):`Symbol`,hierarchicalSymbol:ot})}else if(L!=null&&at!=null){let e=V(l,L);de({type:`map-symbol`,district:e,file:L,label:l.S?.[String(L)]?.[at]?.[0]??`Symbol`,symbol:at})}else de(L==null?gt==null?{type:`overview`}:{type:`map-district`,district:gt}:{type:`map-file`,district:V(l,L),file:L});e&&(Fe(!1),Ve(null),Ue(null),ne(null));return}e&&(Fe(!1),ze(null),De.current?(De.current=!1,Lt(Ee.current)):Lt(`peek`),(L!=null||gt!=null)&&se(!0))},[nn,l]),(0,_.useEffect)(()=>{I&&we===`peek`&&Fe(!1)},[we]);let an=(0,_.useRef)(we);(0,_.useEffect)(()=>{let e=an.current;an.current=we,I&&!ie&&l&&we===`half`&&e===`peek`&&(L==null?gt!=null&&M.current?.panToDistrict(gt):B(l.districts[String(V(l,L))])!==`unconnected`&&M.current?.panTo(L))},[we]),(0,_.useEffect)(()=>{M.current?.setDirectFileTaps(!!Be&&!He)},[Be,He]),(0,_.useEffect)(()=>{I||(ke(!1),je(!1),Ne(!1),Te(`peek`),ze(null),Ve(null),Ue(null))},[I]);function on(e){if(!l||!Be||e===Be.anchor)return;let t=Be.dir===`from`?[Be.anchor,e]:[e,Be.anchor];Ue(t),ne(Yw(l,tt,t[0],t[1]))}function sn(){if(!(I&&Be&&!He)){if(Re){ze(null);return}if(L!=null||gt!=null||n.dir||Be){R(),Dt();return}I?Lt(`peek`):(Fe(!1),de({type:`overview`}))}}let cn=!n.lens_compare&&!!n.path&&!!n.step&&!!g.data;(0,_.useEffect)(()=>{if(I)return;function e(e){if(n.read||e.defaultPrevented)return;let t=e.target,r=t?.closest(`[data-desktop-search], [data-search-palette]`)?`palette`:t?.closest(`[role="menu"]`)?`menu`:t?.closest(`[role="dialog"]`)?`dialog`:t?.isContentEditable||t?.closest(`input, textarea, select, [contenteditable]`)?`text`:`page`,i=KE({key:e.key,focus:r,metaKey:e.metaKey,ctrlKey:e.ctrlKey,altKey:e.altKey,shiftKey:e.shiftKey,overviewOpen:ce&&ue.at(-1)?.type===`overview`,walkthrough:cn});if(i.type!==`none`&&i.type!==`search`){if(e.preventDefault(),i.type===`toggle-panel`)le(e=>!e);else if(i.type===`layer`)wt({layer:i.layer});else if(i.type===`zoom-in`)M.current?.zoomBy(1.6);else if(i.type===`zoom-out`)M.current?.zoomBy(1/1.6);else if(i.type===`fit`)M.current?.fit(!0);else if(i.type===`zoom-selection`)gt==null?l&&L!=null&&M.current?.zoomDistrict(V(l,L)):M.current?.zoomDistrict(gt);else if(i.type===`cycle-theme`)ve(as(_e));else if(i.type===`keyboard-list`)he(!0);else if(i.type===`overview-move`)Yt(i.direction);else if(i.type===`overview-activate`)Xt();else if(i.type===`walk-step`){let e=g.data?.report.paths.find(e=>e.name===n.path)?.stops.length??0,t=n.step+i.direction;t>=1&&t<=e&&w.current?.(n.path,t)}else i.type===`escape`&&(fe?pe(!1):me?he(!1):!Gt()&&We&&Qe())}}return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[I,ce,ue,fe,me,We,gt,L,l,_e,n.read,cn,n.path,n.step,g.data]);let ln={onSelectFile:e=>Be&&!He?on(e):Tt(e),onSelectSymbol:(e,t)=>Tt(e,{symbol:t}),onSelectHierSymbol:e=>Ct(e),onSelectDistrict:e=>{(!Be||He)&&Et(e)},onClearSelection:()=>sn(),onDragStart:()=>{I&&ze(null)},onPanDismiss:()=>{I&&we!==`peek`&&Lt(`peek`)},onTapStructure:(e,t)=>{if(!I||!l)return!1;let n=Ik(l,e)??(e.startsWith(`lh:`)||e.startsWith(`ln:`)?{kind:`lens`,pairs:[],pairTotal:0,files:[],district:null}:null);return n?(ze({key:e,lines:t,detail:n}),Lt(`peek`),!0):!1},onSelectDirectory:e=>kt(e),onPreviewDirectory:e=>re(e&&l?{repo:l.repo,path:e}:null),onNeedSymbols:e=>ee(e)},un=n.lens_compare?(0,b.jsx)(Od,{search:n,result:v,list:g.list.data,update:wt,pick:_n,embedded:I,expanded:!I||ie||we!==`peek`,onExpand:()=>Lt(`half`)}):n.compare?(0,b.jsx)(Hd,{search:n,data:i.data,pending:i.isPending,refreshing:i.isFetching&&!!i.data,error:i.error,retry:()=>{i.refetch()},update:wt,read:(e,t)=>{I?(Ft(`reader`),wt({file:e,source_commit:t,read:!0,line:1,end:1})):(ft.current=!0,r({to:`.`,search:n=>({...n,file:e,source_commit:t,read:!0,line:1,end:1}),state:!0}))},pick:(e,t)=>{if(wt({file:e,d:t,read:void 0,source_commit:void 0}),t!=null)M.current?.panToDistrict(t);else if(e){let t=l?.F.indexOf(e)??-1;t>=0&&M.current?.panTo(t)}}}):(0,b.jsx)(`button`,{className:`impact-launch`,onClick:()=>wt({compare:!0}),children:`Compare commits`});if(u)return(0,b.jsx)(`div`,{className:`flex h-full items-center justify-center bg-[var(--chrome)] text-small text-[var(--dim)]`,children:(0,b.jsx)(YE,{progressKey:`map:${e}/${t}`,label:`${e}/${t}`})});if(d||!l||!Ze)return(0,b.jsxs)(`div`,{className:`flex h-full flex-col items-center justify-center gap-2 bg-[var(--chrome)] p-6 text-center text-small text-[var(--link-out)]`,children:[un,(0,b.jsxs)(`p`,{children:[`couldn't load `,e,`/`,t,`.`]}),(0,b.jsx)(`p`,{className:`text-[var(--dim)]`,children:f instanceof Error?f.message:`not in the catalogue`})]});let dn=Math.max(Ze.minDepth,Math.min(Ze.maxDepth,n.depth??Ze.autoDepth)),fn=Ze.groupings.get(dn),pn=n.dir&&Ze.filesByDirectory.has(n.dir)?n.dir:void 0,mn=(P?.repo===l.repo?P.path:void 0)??pn,hn=mn?Ze.filesByDirectory.get(mn)??null:null,gn=mn?Ze.islandOnlyDirectories.has(mn):!1;function _n(e){if(!l)return;if(I&&Ae&&Vt(),I&&n.lens_compare&&(we===`half`||we===`full`)&&(Ee.current=we),e.symbol){let t=A.get(e.district),n=t?.symbols.findIndex(t=>t[0]===e.file&&(t[1]===e.symbol.name||e.symbol.name.endsWith(`.${t[1]}`))&&t[3]===e.symbol.start)??-1;if(t&&n>=0){Ct(t.symbol_indices[n]);return}}let t=e.symbol?l.S[String(e.file)]?.findIndex(t=>t[0]===e.symbol.name&&t[2]===e.symbol.start):void 0;Tt(e.file,{symbol:t!=null&&t>=0?t:void 0})}function vn(e){wt({lens:e,lens_compare:void 0,other_lens:void 0,path:void 0,step:void 0}),I&&(Vt(),Lt(`peek`))}let yn=()=>{I&&(Ae&&Vt(),Lt(`half`)),wt({lens_compare:!0,compare:!0,base:n.base??m,head:n.head})};function bn(e,t,r=!0){let i=Md(g.data?.report,e,t);if(!l||!i)return;let{path:a,index:o,stop:s}=i;if(s.target){if(_n(s.target),!I){le(!0);let e=Ll({profile:F,panelOpen:!0,safe:xe});M.current?.setInsets({frame:e,safe:e,centreInSafe:!0})}B(l.districts[String(s.target.district)])!==`unconnected`&&M.current?.frameLensStep(s.target,Nd(a,o,l.F,e=>V(l,e)),r)}else(L!=null||gt!=null||n.dir)&&Dt();wt({path:e,step:o+1})}w.current=bn;let xn=!n.lens_compare&&n.path&&n.step&&g.data?{name:n.path,step:n.step}:null,Sn=xn&&g.data?(0,b.jsx)(Ld,{report:g.data.report,name:xn.name,step:xn.step,go:e=>bn(xn.name,e),exit:()=>wt({path:void 0,step:void 0}),keyboard:!I&&!ae}):null,Cn=x?e=>wt({path:e,step:void 0}):void 0,wn=(0,b.jsx)(jd,{compare:yn,lenses:g,name:n.lens,select:vn,pick:_n,walk:I||n.lens_compare?void 0:e=>bn(e,1),focus:n.path,show:Cn,mode:I?`picker`:`full`}),Tn=n.lens?(0,b.jsx)(jd,{compare:yn,lenses:g,name:n.lens,select:vn,pick:_n,walk:n.lens_compare?void 0:e=>bn(e,1),focus:n.path,show:Cn,mode:`sheet`,details:we===`peek`?()=>Lt(`half`):void 0}):void 0,En=n.read&&n.file?(0,b.jsx)(jw,{modal:I,owner:e,repo:t,path:n.file,commit:n.source_commit??m??n.base??n.commit??c.commit,start:n.line,end:n.end,onClose:ht},JSON.stringify([e,t,n.source_commit??m??n.base??n.commit??c.commit,n.file,n.line,n.end])):null,Dn=!n.read&&L!=null&&(!n.compare||n.lens_compare)?(0,b.jsx)(`button`,{ref:a,className:`source-action${I?` source-action-sheet`:``}`,onClick:mt,children:`Read selected source`}):null,On=n.compare?{...vt,frame:{...vt.frame,right:I?vt.frame.right:380},safe:{...vt.safe,right:I?vt.safe.right:380,top:I?vt.safe.top+Math.min(be.height*(ie?.36:.28),ie?150:236)+8:vt.safe.top}}:vt,kn=(0,b.jsx)(UE,{doc:l,impactFiles:!i.isFetching&&!i.error?i.data?.report.files.map(e=>e.base_path??e.path):void 0,impactDistricts:!i.isFetching&&!i.error?i.data?.report.districts.map(e=>e.id):void 0,geo:n.geo,layer:n.layer,sel:L,selSym:at,selD:gt,route:te,lens:S,lensRoads:C,lensComparison:!v.isFetching&&!v.error?v.data:void 0,packageGrouping:fn,districtPaths:Ze.districtPaths,folderFiles:hn,folderOnlyIslands:gn,folderLabels:Ze.folderLabels,activeDirectory:pn,districtSymbols:A,selHSym:dt,insets:On,callbacks:{...ln,onSelectLensStop:_n},handleRef:M},`${e}/${t}:${n.base??n.commit??c.commit??``}`);if(I){let r=ie&&oe?`360px + env(safe-area-inset-left, 0px)`:`env(safe-area-inset-left, 0px)`;return(0,b.jsxs)(`div`,{className:`relative h-full overflow-clip bg-[var(--canvas)]`,"data-phone-shell":!0,"data-profile":F,"data-touch":``,children:[(0,b.jsx)(`div`,{ref:N,className:`absolute inset-0`,children:kn}),En,(0,b.jsxs)(`div`,{className:`pointer-events-none absolute z-20 flex flex-col gap-2`,"data-map-status-notes":!0,style:{left:`calc(${r} + 12px)`,right:`calc(68px + env(safe-area-inset-right, 0px))`,top:`calc(${c.detailPending||c.detailFailed?72:122}px + env(safe-area-inset-top, 0px))`},children:[(0,b.jsx)(QE,{pending:c.detailPending,failed:c.detailFailed,narrow:!0,mapLeft:r,inline:!0}),(0,b.jsx)(ZE,{owner:e,repo:t,commit:m,narrow:!0,mapLeft:r,inline:!0})]}),!n.lens_compare&&un,(0,b.jsx)(Hk,{comparison:n.lens_compare?un:void 0,walkthrough:Sn,lenses:wn,activeLens:Tn,sourceAction:Dn,doc:l,packageLayout:Ze,packageGrouping:fn,landscape:ie,sideOpen:oe,onToggleSide:()=>se(e=>!e),catalogue:s,owner:e,repo:t,layer:n.layer,depthAuto:n.depth==null,maxCh:rt,maxCx:it,sel:L,selSym:at,selD:gt,selHSym:ot,symbolsDoc:bt,symbolsLoading:xt,adj:tt,radj:nt,activeDirectory:pn,heights:Ce,viewportHeight:be.height,safeTop:be.safeTop,detent:we,onDetent:Lt,searchOpen:Oe,onOpenSearch:Rt,onCloseSearch:zt,onSearchPick:e=>{zt(),R(),Lt(`peek`),Ot(e)},layersOpen:Ae,onOpenLayers:Bt,onCloseLayers:Vt,reposOpen:Me,onOpenRepos:Ht,onCloseRepos:Ut,quality:Pe,onQuality:e=>{Fe(e),Lt(e?`full`:`peek`)},indexTab:pn?`folders`:Ie,onIndexTab:e=>{Le(e),we===`peek`&&Lt(`half`)},structure:Re,onCloseStructure:()=>ze(null),pathPick:Be,pathEnds:He,route:te,onPath:(e,t)=>{ne(null),Ue(null),Ve({anchor:e,dir:t}),Lt(`peek`)},onPathCancel:R,onZoomIn:()=>M.current?.zoomBy(1.6),onZoomOut:()=>M.current?.zoomBy(1/1.6),onFit:()=>M.current?.fit(!0),onLayer:e=>wt({layer:e}),onDepth:e=>wt({depth:e===Ze.autoDepth?void 0:e}),onClearSelection:()=>{n.lens_compare&&(De.current=!0),R(),Dt()},onSelectFile:e=>Tt(e),onSelectSymbol:(e,t)=>Tt(e,{symbol:t}),onSelectHierSymbol:Ct,onSelectDistrict:Et,onPickDistrict:e=>{Et(e),Ye(),M.current?.panToDistrict(e)},onPickKeyFile:e=>Tt(e),onFrameDistricts:e=>M.current?.frameDistricts(e),onZoomDistrict:e=>M.current?.zoomDistrict(e),onSelectDirectory:kt,onBreadcrumbRepo:Dt,onBreadcrumbFile:e=>wt({file:l.F[e],sym:void 0,hsym:void 0,d:void 0,dir:void 0})})]})}let An={doc:l,packageLayout:Ze,sel:L,selSym:at,selD:gt,selHSym:ot,symbolsDoc:bt,symbolsLoading:xt,adj:tt,radj:nt,detent:`full`,onDetent:e=>{},compactRows:F===`desktop`,quality:Pe,onCloseQuality:()=>Fe(!1),structure:Re,onCloseStructure:()=>ze(null),pathPick:Be,pathEnds:He,route:te,onPath:(e,t)=>{ne(null),Ue(null),Ve({anchor:e,dir:t}),de({type:`push`,view:{type:`path`}})},onPathCancel:Gt,onClearSelection:()=>{R(),Dt()},onSelectFile:e=>Tt(e),onSelectSymbol:(e,t)=>Tt(e,{symbol:t}),onSelectHierSymbol:Ct,onHoverHierSymbol:e=>M.current?.hoverSymbol(e),onSelectDistrict:Et,onZoomDistrict:e=>M.current?.zoomDistrict(e),onSelectDirectory:kt,onBreadcrumbRepo:Dt,onBreadcrumbFile:e=>wt({file:l.F[e],sym:void 0,hsym:void 0,d:void 0,dir:void 0})},jn=ue[ue.length-1]?.type===`overview`?`Districts ${Object.values(l.districts).filter(e=>B(e)===`mainland`).length.toLocaleString(`en-US`)}`:bO(ue,l,`${e}/${t}`)[ue.length-1]?.label??`Map details`,Mn=16+Il(F)+24;return(0,b.jsxs)(`div`,{ref:N,"data-map-area":!0,"data-desktop-shell":!0,"data-profile":F,"data-touch":ae?``:void 0,className:`relative h-full overflow-hidden bg-[var(--canvas)]${We?` fixed inset-0 z-50`:``}`,children:[kn,En,(0,b.jsxs)(`div`,{className:`pointer-events-none absolute z-20 flex min-w-0 flex-col gap-2`,"data-map-status-notes":!0,style:{left:`calc(400px + env(safe-area-inset-left, 0px))`,top:`calc(72px + env(safe-area-inset-top, 0px))`,width:`min(380px, calc(100% - ${400+Mn}px - env(safe-area-inset-left, 0px) - env(safe-area-inset-right, 0px)))`},children:[(0,b.jsx)(QE,{pending:c.detailPending,failed:c.detailFailed,narrow:!1,inline:!0}),(0,b.jsx)(ZE,{owner:e,repo:t,commit:m,narrow:!1,inline:!0})]}),un,!I&&Dn,(0,b.jsx)(bk,{catalogue:s,doc:l,owner:e,repo:t,layer:n.layer,onLayer:e=>wt({layer:e}),touch:ae,panelTabLabel:jn,onOpenSearch:()=>pe(!0),searchOpen:fe,onCloseSearch:()=>pe(!1),onSearchPick:Ot,pathMode:!!Be&&!He,pathEnd:Be?.dir===`to`?`start`:`destination`,panelOpen:ce,onPanelOpen:le,onOpenQuality:qt,keyboardOpen:me,onKeyboardOpen:he,onZoomIn:()=>M.current?.zoomBy(1.6),onZoomOut:()=>M.current?.zoomBy(1/1.6),onFit:()=>M.current?.fit(!0),isFullscreen:We,onToggleFullscreen:et}),(0,b.jsx)(Ck,{walkthrough:Sn,lenses:wn,doc:l,repoSlug:`${e}/${t}`,packageLayout:Ze,packageGrouping:fn,touch:ae,panelOpen:ce,panelTabLabel:jn,views:ue,layer:n.layer,indexTab:pn?`folders`:Ie,activeDirectory:pn,onIndexTab:Le,onPanelOpen:le,onBack:Gt,onJump:Kt,onOpenQuality:qt,onSelectDistrict:Et,onHighlightDistricts:e=>M.current?.highlightDistricts(e),onFrameDistricts:e=>M.current?.frameDistricts(e),onSelectDirectory:kt,onDepth:e=>wt({depth:e===Ze.autoDepth?void 0:e}),packageAuto:n.depth==null,cardProps:An})]})}function Kk(){let{batchId:e}=Ji({from:`/new/batches/$batchId`}),t=Ha?.onboarding?.batch_progress_path,n=st({queryKey:[`batch-progress`,t,e],enabled:!!t,queryFn:()=>jc(t.replace(`{batch_id}`,encodeURIComponent(e))),retry:!1,refetchInterval:e=>!e.state.data?.jobs.every(e=>e.status===`done`||e.status===`failed`)&&2e3});return(0,b.jsx)(`div`,{className:`h-full overflow-y-auto bg-[var(--chrome)] text-[var(--on)]`,children:(0,b.jsxs)(`main`,{className:`mx-auto flex max-w-[760px] flex-col gap-6 px-5 pb-10 pt-7`,children:[(0,b.jsx)(Rc,{}),(0,b.jsx)(`h1`,{className:`text-title`,children:`Mapping repositories`}),!t&&(0,b.jsx)(`p`,{role:`alert`,children:`Batch progress is not available from this host.`}),t&&n.isLoading&&(0,b.jsx)(`p`,{role:`status`,children:`Loading mapping progress…`}),n.isError&&(0,b.jsxs)(`div`,{role:`alert`,children:[(0,b.jsx)(`p`,{children:n.error.message}),(0,b.jsx)(`button`,{type:`button`,className:`repo-control mt-3`,onClick:()=>void n.refetch(),children:`Retry`})]}),n.data&&(0,b.jsx)(`ol`,{"data-batch-progress":!0,className:`overflow-hidden rounded-[10px] border border-[var(--rule)]`,children:n.data.jobs.map(e=>{let t=Jl(e).find(e=>e.state===`running`||e.state===`failed`),n=e.status===`done`,r=e.status===`failed`?`failed`:n?`done`:e.status===`queued`?`queued`:`running`,i=n?100:e.progress?Math.max(0,Math.min(99,(e.progress.stage_index-1)/e.progress.stage_count*100)):void 0;return(0,b.jsx)(`li`,{className:`border-b border-[var(--rule)] last:border-0`,children:(0,b.jsxs)(fa,{to:`/new`,search:{job:e.job_id,slug:e.slug},"data-batch-job":!0,className:`flex flex-col gap-2 px-4 py-3 hover:bg-[var(--chrome2)]`,children:[(0,b.jsxs)(`span`,{className:`flex items-baseline justify-between gap-3`,children:[(0,b.jsx)(`span`,{className:`min-w-0 break-words font-mono text-small`,children:e.slug}),(0,b.jsxs)(`span`,{className:`flex shrink-0 items-center gap-2`,children:[(0,b.jsx)(`span`,{className:`offered-badge batch-status batch-status-${r}`,children:n?`Ready`:e.status===`failed`?`Failed`:e.status===`queued`?`Queued`:t?.title??`Mapping`}),(0,b.jsx)(`span`,{"aria-hidden":`true`,className:`text-[var(--dim)]`,children:(0,b.jsx)(od,{})})]})]}),(0,b.jsx)(`progress`,{"aria-label":`Mapping ${e.slug}`,max:100,value:i,className:`batch-progress-bar`}),(0,b.jsx)(`span`,{className:`text-meta text-[var(--dim)]`,children:e.status===`failed`?e.error??`Mapping failed. Open details to retry.`:n?`Open progress to view the map`:t?.meaning??`Waiting to start`})]})},e.job_id)})}),n.data?.jobs.length===0&&(0,b.jsx)(`p`,{children:`No repositories in this batch.`})]})})}var qk=[`r`],Jk=[`d`,`c`,`x`,`p`];function Yk(e){let t=qk.includes(e.geo)?e.geo:`r`,n=Jk.includes(e.layer)?e.layer:`d`,r=e.file??e.sel,i=typeof r==`string`&&r.length>0?r:void 0,a=typeof e.dir==`string`?e.dir.trim().replace(/^\/+|\/+$/g,``):``,o=!i&&a?a:void 0,s=Number(e.sym),c=i&&Number.isInteger(s)&&s>=0?s:void 0,l=Number(e.hsym),u=i&&Number.isInteger(l)&&l>=0?l:void 0,d=Number(e.d),f=!i&&!o&&Number.isInteger(d)&&d>=0?d:void 0,p=Number(e.depth),m=Number.isInteger(p)&&p>0?p:void 0,h=typeof e.job==`string`&&e.job.length>0?e.job:void 0,g=typeof e.commit==`string`&&/^[a-f0-9]{40,64}$/.test(e.commit)?e.commit:void 0,_=typeof e.lens==`string`&&(e.lens===`@debt`||/^[a-z0-9][a-z0-9_-]{0,63}$/.test(e.lens))?e.lens:void 0,v=_!==`@debt`&&typeof e.other_lens==`string`&&/^[a-z0-9][a-z0-9_-]{0,63}$/.test(e.other_lens)?e.other_lens:void 0,y=!!_&&(e.lens_compare===!0||e.lens_compare===`true`||!!v||!!e.base&&!!e.head&&e.lens_compare!==!1&&e.lens_compare!==`false`),b=typeof e.path==`number`?String(e.path):e.path,x=_&&typeof b==`string`&&b.length>0&&b.length<=256?b:void 0,S=Number(e.step),C=x&&Number.isInteger(S)&&S>=1?S:void 0,w=!!i&&(e.read===!0||e.read===`true`),T=Math.floor(Math.max(1,Math.min(1e7,Number(e.line)||1))),E=Math.floor(Math.max(T,Math.min(1e7,Number(e.end)||T))),D=e=>typeof e==`string`&&/^(?:[a-f0-9]{40}|[a-f0-9]{64})$/.test(e)?e:void 0,O=D(e.base),k=D(e.head),ee=D(e.source_commit),A=e.compare===!0||e.compare===`true`||!!O&&!!k,j=Number(e.max_districts),M=Number(e.max_dq),N=e.max_districts!=null&&Number.isSafeInteger(j)&&j>=0?j:void 0,te=e.max_dq!=null&&Number.isFinite(M)&&M>=0?M:void 0,ne=e.report_only===!0||e.report_only===`true`;return{file:i,sym:c,hsym:u,d:f,dir:o,depth:m,geo:t,layer:n,job:h,commit:g,lens:_,lens_compare:y||void 0,other_lens:v,path:C||_===`@debt`?x:void 0,step:C,read:w,line:T,end:E,compare:A||void 0,base:O,head:k,source_commit:ee,max_districts:N,max_dq:te,report_only:ne}}var Xk=/^[^/\s]+\/[^/\s]+$/;function Zk(e){return{job:typeof e.job==`string`&&e.job.length>0?e.job:void 0,slug:typeof e.slug==`string`&&Xk.test(e.slug)?e.slug:void 0}}var Qk=_a({component:zc}),$k=ha({getParentRoute:()=>Qk,path:`/`,component:_d}),eA=[...Wu].filter(e=>e!==`new`).map(e=>ha({getParentRoute:()=>Qk,path:`/${e}`,component:vd})),tA=ha({getParentRoute:()=>Qk,path:`/new`,validateSearch:Zk,component:Eu}),nA=ha({getParentRoute:()=>Qk,path:`/new/batches/$batchId`,component:Kk}),rA=ha({getParentRoute:()=>Qk,path:`/repositories/$repositoryId/history`,component:Pu}),iA=ha({getParentRoute:()=>Qk,path:`/$owner/$repo`,beforeLoad:({params:e})=>{if(Wu.has(e.owner))throw zt()},validateSearch:Yk,component:Gk}),aA=Pa({routeTree:Qk.addChildren([$k,tA,nA,rA,...eA,iA])}),oA=new Je({defaultOptions:{queries:{refetchOnWindowFocus:!1,retry:1}}});function sA(){return(0,b.jsx)(C,{client:oA,children:(0,b.jsx)(La,{router:aA})})}(0,v.createRoot)(document.getElementById(`root`)).render((0,b.jsx)(_.StrictMode,{children:(0,b.jsx)(sA,{})}));export{hx as A,Vf as B,Wb as C,dx as D,Bb as E,np as F,op as G,ap as H,W as I,Vp as K,bp as L,q as M,Sm as N,px as O,py as P,G as R,Pb as S,Vb as T,Rf as U,Sp as V,tf as W,sS as _,mS as a,Fx as b,oS as c,MS as d,jS as f,aS as g,SS as h,xS as i,wm as j,Gb as k,ES as l,wS as m,cS as n,BS as o,AS as p,s as q,X as r,kS as s,uS as t,OS as u,dS as v,Lb as w,Y as x,Ax as y,bf as z};
|