tolmap 0.0.0-stage → 0.1.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 +17 -0
- package/LICENSE +21 -0
- package/LICENSE-DISTRIBUTION.md +49 -0
- package/README.md +49 -2
- package/SOURCE-BUILD.md +93 -0
- package/SOURCE.json +50 -0
- package/THIRD_PARTY_NOTICES.md +23 -0
- package/bin/tolmap.js +99 -0
- package/lib/libblas.so.3 +0 -0
- package/lib/libgfortran.so.5 +0 -0
- package/lib/libgmp.so.10 +0 -0
- package/lib/libgomp.so.1 +0 -0
- package/lib/libicudata.so.70 +0 -0
- package/lib/libicuuc.so.70 +0 -0
- package/lib/libigraph.so.4 +0 -0
- package/lib/liblapack.so.3 +0 -0
- package/lib/liblibleidenalg.so.1 +0 -0
- package/lib/liblzma.so.5 +0 -0
- package/lib/libquadmath.so.0 +0 -0
- package/lib/libxml2.so.2 +0 -0
- package/lib/libz.so.1 +0 -0
- package/lib/tolmap +0 -0
- package/licenses/native/igraph-1.0.0/COPYING +340 -0
- package/licenses/native/igraph-1.0.0/vendor/cs/License.txt +19 -0
- package/licenses/native/igraph-1.0.0/vendor/glpk/COPYING +674 -0
- package/licenses/native/igraph-1.0.0/vendor/glpk/amd/COPYING +502 -0
- package/licenses/native/igraph-1.0.0/vendor/glpk/colamd/COPYING +502 -0
- package/licenses/native/igraph-1.0.0/vendor/glpk/minisat/LICENSE +20 -0
- package/licenses/native/igraph-1.0.0/vendor/pcg/LICENSE.txt +19 -0
- package/licenses/native/igraph-1.0.0/vendor/qhull/COPYING.txt +39 -0
- package/licenses/native/libleidenalg-0.12.0/LICENSE +674 -0
- package/licenses/runtime/common-licenses/Apache-2.0 +202 -0
- package/licenses/runtime/common-licenses/Artistic +131 -0
- package/licenses/runtime/common-licenses/BSD +26 -0
- package/licenses/runtime/common-licenses/CC0-1.0 +121 -0
- package/licenses/runtime/common-licenses/GFDL-1.2 +397 -0
- package/licenses/runtime/common-licenses/GFDL-1.3 +451 -0
- package/licenses/runtime/common-licenses/GPL-1 +251 -0
- package/licenses/runtime/common-licenses/GPL-2 +339 -0
- package/licenses/runtime/common-licenses/GPL-3 +674 -0
- package/licenses/runtime/common-licenses/LGPL-2 +481 -0
- package/licenses/runtime/common-licenses/LGPL-2.1 +502 -0
- package/licenses/runtime/common-licenses/LGPL-3 +165 -0
- package/licenses/runtime/common-licenses/MPL-1.1 +469 -0
- package/licenses/runtime/common-licenses/MPL-2.0 +373 -0
- package/licenses/runtime/libblas3-3.10.0-2ubuntu1-copyright +96 -0
- package/licenses/runtime/libgfortran5-12.3.0-1ubuntu1~22.04.3-copyright +1512 -0
- package/licenses/runtime/libgmp10-2:6.2.1+dfsg-3ubuntu1-copyright +60 -0
- package/licenses/runtime/libgomp1-12.3.0-1ubuntu1~22.04.3-copyright +1512 -0
- package/licenses/runtime/libicu70-70.1-2-copyright +49 -0
- package/licenses/runtime/liblapack3-3.10.0-2ubuntu1-copyright +96 -0
- package/licenses/runtime/liblzma5-5.2.5-2ubuntu1.2-copyright +388 -0
- package/licenses/runtime/libquadmath0-12.3.0-1ubuntu1~22.04.3-copyright +1512 -0
- package/licenses/runtime/libxml2-2.9.13+dfsg-1ubuntu0.14-copyright +75 -0
- package/licenses/runtime/zlib1g-1:1.2.11.dfsg-2ubuntu9.2-copyright +83 -0
- package/licenses/web/THIRD_PARTY_NOTICES.md +26 -0
- package/licenses/web/class-variance-authority@0.7.1/LICENSE +190 -0
- package/licenses/web/clsx@2.1.1/license +9 -0
- package/licenses/web/codemirror__language-data@6.5.2/LICENSE +21 -0
- package/licenses/web/codemirror__language@6.13.1/LICENSE +21 -0
- package/licenses/web/codemirror__search@6.7.2/LICENSE +21 -0
- package/licenses/web/codemirror__state@6.7.6/LICENSE +21 -0
- package/licenses/web/codemirror__view@6.43.14/LICENSE +21 -0
- package/licenses/web/js-tokens@4.0.0/LICENSE +21 -0
- package/licenses/web/loose-envify@1.4.0/LICENSE +21 -0
- package/licenses/web/packages.json +182 -0
- package/licenses/web/radix-ui__react-scroll-area@1.2.18/LICENSE +21 -0
- package/licenses/web/radix-ui__react-separator@1.1.15/LICENSE +21 -0
- package/licenses/web/radix-ui__react-slot@1.3.3/LICENSE +21 -0
- package/licenses/web/radix-ui__react-toggle-group@1.1.19/LICENSE +21 -0
- package/licenses/web/radix-ui__react-toggle@1.1.18/LICENSE +21 -0
- package/licenses/web/react-dom@18.3.1/LICENSE +21 -0
- package/licenses/web/react@18.3.1/LICENSE +21 -0
- package/licenses/web/scheduler@0.23.2/LICENSE +21 -0
- package/licenses/web/tailwind-merge@2.6.1/LICENSE.md +21 -0
- package/licenses/web/tanstack__react-query@5.103.1/LICENSE +21 -0
- package/licenses/web/tanstack__react-router@1.170.38/LICENSE +21 -0
- package/package.json +37 -4
- package/web/dist/assets/apl-gfMMiTNf.js +1 -0
- package/web/dist/assets/asciiarmor-C_eisQCp.js +1 -0
- package/web/dist/assets/asn1-DCl_8MCW.js +1 -0
- package/web/dist/assets/asterisk-BEn0Cwpx.js +1 -0
- package/web/dist/assets/brainfuck-D5EjA2JK.js +1 -0
- package/web/dist/assets/clike-D_6L3tnO.js +1 -0
- package/web/dist/assets/clojure-BflJGmDX.js +1 -0
- package/web/dist/assets/cmake-84nbDH0I.js +1 -0
- package/web/dist/assets/cobol-DHLQUbN7.js +1 -0
- package/web/dist/assets/coffeescript-De_zI4J0.js +1 -0
- package/web/dist/assets/commonlisp-DgAKBe0r.js +1 -0
- package/web/dist/assets/crystal-Bsdphhtm.js +1 -0
- package/web/dist/assets/css-CnaYoQib.js +1 -0
- package/web/dist/assets/cypher-p9eYesGn.js +1 -0
- package/web/dist/assets/d-DWkQyNnU.js +1 -0
- package/web/dist/assets/diff-ChtP43wD.js +1 -0
- package/web/dist/assets/dist-6c4aXhbi.js +1 -0
- package/web/dist/assets/dist-B2ExgJ2X.js +1 -0
- package/web/dist/assets/dist-B2pJ5QS3.js +1 -0
- package/web/dist/assets/dist-BNhij8mV.js +1 -0
- package/web/dist/assets/dist-B_Er-tdr.js +1 -0
- package/web/dist/assets/dist-BiDoRe9D.js +2 -0
- package/web/dist/assets/dist-BjkGnrMZ.js +1 -0
- package/web/dist/assets/dist-BpNbQKDx.js +1 -0
- package/web/dist/assets/dist-BwlwqxvG.js +1 -0
- package/web/dist/assets/dist-CPKhY-Mt.js +1 -0
- package/web/dist/assets/dist-Cb3YMdvA.js +6 -0
- package/web/dist/assets/dist-CbwrhYdz.js +9 -0
- package/web/dist/assets/dist-CllfLwoI.js +1 -0
- package/web/dist/assets/dist-CsYenlD4.js +1 -0
- package/web/dist/assets/dist-CtZX6MYS.js +1 -0
- package/web/dist/assets/dist-CwgAOVvQ.js +1 -0
- package/web/dist/assets/dist-D59573Id.js +1 -0
- package/web/dist/assets/dist-D9DZdvJR.js +1 -0
- package/web/dist/assets/dist-DTc8flxp.js +23 -0
- package/web/dist/assets/dist-DhiTCntv.js +1 -0
- package/web/dist/assets/dist-Du1n7ZSG.js +1 -0
- package/web/dist/assets/dist-aThlveSw.js +11 -0
- package/web/dist/assets/dist-nRE-0GfQ.js +1 -0
- package/web/dist/assets/dockerfile-DJkHQgkl.js +1 -0
- package/web/dist/assets/dtd-DTF72YNO.js +1 -0
- package/web/dist/assets/dylan-BCDoL_-p.js +1 -0
- package/web/dist/assets/ebnf-D4c0_ac3.js +1 -0
- package/web/dist/assets/ecl-BVIeWmwY.js +1 -0
- package/web/dist/assets/eiffel-BEjRio4Q.js +1 -0
- package/web/dist/assets/elm-Cshzl8qu.js +1 -0
- package/web/dist/assets/erlang-BV0c4Hdn.js +1 -0
- package/web/dist/assets/factor-LKH5gN8L.js +1 -0
- package/web/dist/assets/fcl-ClOhbFR7.js +1 -0
- package/web/dist/assets/forth-D6RzAl64.js +1 -0
- package/web/dist/assets/fortran-Bt6PBEDR.js +1 -0
- package/web/dist/assets/gas-BHEdbvp9.js +1 -0
- package/web/dist/assets/gherkin-oBAE_ms0.js +1 -0
- package/web/dist/assets/groovy-CUpZ7dEl.js +1 -0
- package/web/dist/assets/haskell-BRsoo5mP.js +1 -0
- package/web/dist/assets/haxe-DjVOVvNP.js +1 -0
- package/web/dist/assets/http-CLVgA2GD.js +1 -0
- package/web/dist/assets/idl-BUZw3wgd.js +1 -0
- package/web/dist/assets/index-4j3Wxxou.js +24 -0
- package/web/dist/assets/index-Cds4WK9K.css +1 -0
- package/web/dist/assets/javascript-Bu8mWwtz.js +1 -0
- package/web/dist/assets/jsonParse.worker-DEEnj3gk.js +1 -0
- package/web/dist/assets/julia-CQfgDRfP.js +1 -0
- package/web/dist/assets/livescript-BXxG0Yva.js +1 -0
- package/web/dist/assets/lua-DPCEkfD_.js +1 -0
- package/web/dist/assets/mathematica-u8YMmbU0.js +1 -0
- package/web/dist/assets/mbox-BEMVcqjs.js +1 -0
- package/web/dist/assets/mirc-C9zpzAZU.js +1 -0
- package/web/dist/assets/mllike-B45xgp2S.js +1 -0
- package/web/dist/assets/modelica-CqHI_q-D.js +1 -0
- package/web/dist/assets/mscgen-qgSLujhx.js +1 -0
- package/web/dist/assets/mumps-BSzj6Xyz.js +1 -0
- package/web/dist/assets/nginx-8H7HVH4w.js +1 -0
- package/web/dist/assets/nsis-viPvXFiq.js +1 -0
- package/web/dist/assets/ntriples-B9h1VB_g.js +1 -0
- package/web/dist/assets/octave-D2Q8cUp1.js +1 -0
- package/web/dist/assets/oz-BwTct_5T.js +1 -0
- package/web/dist/assets/pascal-Dp_KdFgX.js +1 -0
- package/web/dist/assets/perl-BkSkiI9m.js +1 -0
- package/web/dist/assets/pig-AF4Hwhju.js +1 -0
- package/web/dist/assets/powershell-BcIto6Sf.js +1 -0
- package/web/dist/assets/properties-C357ku5U.js +1 -0
- package/web/dist/assets/protobuf-D1ij_kNL.js +1 -0
- package/web/dist/assets/pug-3K-JMW4g.js +1 -0
- package/web/dist/assets/puppet-BZyAS7I4.js +1 -0
- package/web/dist/assets/python-B_1Jd8HM.js +1 -0
- package/web/dist/assets/q-B9NhS7L_.js +1 -0
- package/web/dist/assets/r-CxDmU1I4.js +1 -0
- package/web/dist/assets/rpm-gpDK5sbt.js +1 -0
- package/web/dist/assets/ruby-ChfNwlCY.js +1 -0
- package/web/dist/assets/sas-C2OyD2Y6.js +1 -0
- package/web/dist/assets/scheme-D9qYN0V5.js +1 -0
- package/web/dist/assets/shell-DwuoZtxw.js +1 -0
- package/web/dist/assets/sieve-tLWDfEkZ.js +1 -0
- package/web/dist/assets/simple-mode-DXiLM1-G.js +1 -0
- package/web/dist/assets/smalltalk-BLp5-jwC.js +1 -0
- package/web/dist/assets/solr-B78wSQJQ.js +1 -0
- package/web/dist/assets/sparql-Dz-mlCAC.js +1 -0
- package/web/dist/assets/spreadsheet-CTIncYxj.js +1 -0
- package/web/dist/assets/sql-DuQMFDvy.js +1 -0
- package/web/dist/assets/stex-DNzd62Q_.js +1 -0
- package/web/dist/assets/stylus-BOVgKnng.js +1 -0
- package/web/dist/assets/swift-DKB6_1j6.js +1 -0
- package/web/dist/assets/tcl-BGfruO1u.js +1 -0
- package/web/dist/assets/textile-C4jVoHG1.js +1 -0
- package/web/dist/assets/tiddlywiki-VlUiK86J.js +1 -0
- package/web/dist/assets/tiki-AK6FwT8q.js +1 -0
- package/web/dist/assets/toml-BPTmHmyx.js +1 -0
- package/web/dist/assets/troff-C2dAgh7P.js +1 -0
- package/web/dist/assets/ttcn-PPSTk1ow.js +1 -0
- package/web/dist/assets/ttcn-cfg-2b4Gb5sE.js +1 -0
- package/web/dist/assets/turtle-Cx3rYX2g.js +1 -0
- package/web/dist/assets/vb-BthdM_4N.js +1 -0
- package/web/dist/assets/vbscript-D9f6rSsU.js +1 -0
- package/web/dist/assets/velocity-CqftRsjg.js +1 -0
- package/web/dist/assets/verilog-CjI9Y6RI.js +1 -0
- package/web/dist/assets/vhdl-kS471soi.js +1 -0
- package/web/dist/assets/webidl-D5jiJvOU.js +1 -0
- package/web/dist/assets/xquery-BKJx4mf9.js +1 -0
- package/web/dist/assets/yacas-CXXgtw0p.js +1 -0
- package/web/dist/assets/z80-Co3PbHdE.js +1 -0
- package/web/dist/favicon.svg +1 -0
- package/web/dist/fonts/archivo/Archivo-Bold.woff2 +0 -0
- package/web/dist/fonts/archivo/Archivo-Medium.woff2 +0 -0
- package/web/dist/fonts/archivo/Archivo-Regular.woff2 +0 -0
- package/web/dist/fonts/archivo/Archivo-SemiBold.woff2 +0 -0
- package/web/dist/fonts/archivo/OFL.txt +93 -0
- package/web/dist/fonts/ibm-plex-mono/IBMPlexMono-Bold-Latin1.woff2 +0 -0
- package/web/dist/fonts/ibm-plex-mono/IBMPlexMono-Medium-Latin1.woff2 +0 -0
- package/web/dist/fonts/ibm-plex-mono/IBMPlexMono-Regular-Latin1.woff2 +0 -0
- package/web/dist/fonts/ibm-plex-mono/IBMPlexMono-SemiBold-Latin1.woff2 +0 -0
- package/web/dist/fonts/ibm-plex-mono/OFL.txt +93 -0
- package/web/dist/icons.svg +24 -0
- package/web/dist/index.html +47 -0
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/dist-BiDoRe9D.js","assets/dist-BpNbQKDx.js","assets/dist-BjkGnrMZ.js","assets/dist-DhiTCntv.js","assets/dist-CtZX6MYS.js","assets/dist-aThlveSw.js","assets/dist-BwlwqxvG.js","assets/dist-DTc8flxp.js","assets/dist-CsYenlD4.js","assets/dist-Du1n7ZSG.js","assets/dist-CwgAOVvQ.js","assets/dist-B2ExgJ2X.js","assets/dist-D9DZdvJR.js","assets/dist-Cb3YMdvA.js","assets/dist-nRE-0GfQ.js","assets/dist-CbwrhYdz.js","assets/dist-BNhij8mV.js","assets/dist-D59573Id.js","assets/dist-CPKhY-Mt.js","assets/dist-6c4aXhbi.js","assets/dist-CllfLwoI.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-B2pJ5QS3.js","assets/dist-B_Er-tdr.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 A(e,t){return typeof e==`object`&&e&&e.key!=null?O(``+e.key):t.toString(36)}function ee(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===``?`.`+A(c,0):a,x(o)?(i=``,e!=null&&(i=e.replace(k,`$&/`)+`/`),ee(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+A(s,l);c+=ee(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+A(s,l++),c+=ee(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 ee(e,r,``,``,function(e){return t.call(n,e,i++)}),r}function te(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 M={current:null},N={transition:null},ne={ReactCurrentDispatcher:M,ReactCurrentBatchConfig:N,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:te}},e.memo=function(e,t){return{$$typeof:u,type:e,compare:t===void 0?null:t}},e.startTransition=function(e){var t=N.transition;N.transition={};try{e()}finally{N.transition=t}},e.unstable_act=P,e.useCallback=function(e,t){return M.current.useCallback(e,t)},e.useContext=function(e){return M.current.useContext(e)},e.useDebugValue=function(){},e.useDeferredValue=function(e){return M.current.useDeferredValue(e)},e.useEffect=function(e,t){return M.current.useEffect(e,t)},e.useId=function(){return M.current.useId()},e.useImperativeHandle=function(e,t,n){return M.current.useImperativeHandle(e,t,n)},e.useInsertionEffect=function(e,t){return M.current.useInsertionEffect(e,t)},e.useLayoutEffect=function(e,t){return M.current.useLayoutEffect(e,t)},e.useMemo=function(e,t){return M.current.useMemo(e,t)},e.useReducer=function(e,t,n){return M.current.useReducer(e,t,n)},e.useRef=function(e){return M.current.useRef(e)},e.useState=function(e){return M.current.useState(e)},e.useSyncExternalStore=function(e,t,n){return M.current.useSyncExternalStore(e,t,n)},e.useTransition=function(){return M.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&&te(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&&te(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 A=new MessageChannel,ee=A.port2;A.port1.onmessage=O,k=function(){ee.postMessage(null)}}else k=function(){g(O,0)};function j(e){C=e,S||(S=!0,k())}function te(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,te(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`),A=Symbol.for(`react.context`),ee=Symbol.for(`react.forward_ref`),j=Symbol.for(`react.suspense`),te=Symbol.for(`react.suspense_list`),M=Symbol.for(`react.memo`),N=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,ie;function ae(e){if(ie===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);ie=t&&t[1]||``}return`
|
|
3
|
+
`+ie+e}var oe=!1;function se(e,t){if(!e||oe)return``;oe=!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{oe=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:``)?ae(e):``}function ce(e){switch(e.tag){case 5:return ae(e.type);case 16:return ae(`Lazy`);case 13:return ae(`Suspense`);case 19:return ae(`SuspenseList`);case 0:case 2:case 15:return e=se(e.type,!1),e;case 11:return e=se(e.type.render,!1),e;case 1:return e=se(e.type,!0),e;default:return``}}function le(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 te:return`SuspenseList`}if(typeof e==`object`)switch(e.$$typeof){case A:return(e.displayName||`Context`)+`.Consumer`;case k:return(e._context.displayName||`Context`)+`.Provider`;case ee:var t=e.render;return e=e.displayName,e||=(e=t.displayName||t.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case M:return t=e.displayName||null,t===null?le(e.type)||`Memo`:t;case N:t=e._payload,e=e._init;try{return le(e(t))}catch{}}return null}function ue(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 le(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 de(e){switch(typeof e){case`boolean`:case`number`:case`string`:case`undefined`:return e;case`object`:return e;default:return``}}function fe(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()===`input`&&(t===`checkbox`||t===`radio`)}function pe(e){var t=fe(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 me(e){e._valueTracker||=pe(e)}function he(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r=``;return e&&(r=fe(e)?e.checked?`true`:`false`:e.value),e=r,e!==n&&(t.setValue(e),!0)}function ge(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 _e(e,t){var n=t.checked;return F({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function ve(e,t){var n=t.defaultValue==null?``:t.defaultValue,r=t.checked==null?t.defaultChecked:t.checked;n=de(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 ye(e,t){t=t.checked,t!=null&&S(e,`checked`,t,!1)}function be(e,t){ye(e,t);var n=de(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`)?Se(e,t.type,n):t.hasOwnProperty(`defaultValue`)&&Se(e,t.type,de(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function xe(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 Se(e,t,n){(t!==`number`||ge(e.ownerDocument)!==e)&&(n==null?e.defaultValue=``+e._wrapperState.initialValue:e.defaultValue!==``+n&&(e.defaultValue=``+n))}var Ce=Array.isArray;function we(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=``+de(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 Te(e,t){if(t.dangerouslySetInnerHTML!=null)throw Error(r(91));return F({},t,{value:void 0,defaultValue:void 0,children:``+e._wrapperState.initialValue})}function Ee(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(Ce(n)){if(1<n.length)throw Error(r(93));n=n[0]}t=n}t??=``,n=t}e._wrapperState={initialValue:de(n)}}function De(e,t){var n=de(t.value),r=de(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 Oe(e){var t=e.textContent;t===e._wrapperState.initialValue&&t!==``&&t!==null&&(e.value=t)}function ke(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 Ae(e,t){return e==null||e===`http://www.w3.org/1999/xhtml`?ke(t):e===`http://www.w3.org/2000/svg`&&t===`foreignObject`?`http://www.w3.org/1999/xhtml`:e}var je,Me=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(je||=document.createElement(`div`),je.innerHTML=`<svg>`+t.valueOf().toString()+`</svg>`,t=je.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function Ne(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Pe={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},Fe=[`Webkit`,`ms`,`Moz`,`O`];Object.keys(Pe).forEach(function(e){Fe.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),Pe[t]=Pe[e]})});function Ie(e,t,n){return t==null||typeof t==`boolean`||t===``?``:n||typeof t!=`number`||t===0||Pe.hasOwnProperty(e)&&Pe[e]?(``+t).trim():t+`px`}function Le(e,t){for(var n in e=e.style,t)if(t.hasOwnProperty(n)){var r=n.indexOf(`--`)===0,i=Ie(n,t[n],r);n===`float`&&(n=`cssFloat`),r?e.setProperty(n,i):e[n]=i}}var Re=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 ze(e,t){if(t){if(Re[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 Be(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 Ve=null;function He(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Ue=null,We=null,Ge=null;function Ke(e){if(e=Ki(e)){if(typeof Ue!=`function`)throw Error(r(280));var t=e.stateNode;t&&(t=Ji(t),Ue(e.stateNode,e.type,t))}}function I(e){We?Ge?Ge.push(e):Ge=[e]:We=e}function qe(){if(We){var e=We,t=Ge;if(Ge=We=null,Ke(e),t)for(e=0;e<t.length;e++)Ke(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,(We!==null||Ge!==null)&&(Ye(),qe())}}function Qe(e,t){var n=e.stateNode;if(n===null)return null;var i=Ji(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,at=null,ot={onError:function(e){nt=!0,rt=e}};function st(e,t,n,r,i,a,o,s,c){nt=!1,rt=null,tt.apply(ot,arguments)}function ct(e,t,n,i,a,o,s,c,l){if(st.apply(this,arguments),nt){if(nt){var u=rt;nt=!1,rt=null}else throw Error(r(198));it||(it=!0,at=u)}}function lt(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 ut(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 dt(e){if(lt(e)!==e)throw Error(r(188))}function ft(e){var t=e.alternate;if(!t){if(t=lt(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 dt(a),e;if(o===i)return dt(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 pt(e){return e=ft(e),e===null?null:mt(e)}function mt(e){if(e.tag===5||e.tag===6)return e;for(e=e.child;e!==null;){var t=mt(e);if(t!==null)return t;e=e.sibling}return null}var ht=n.unstable_scheduleCallback,gt=n.unstable_cancelCallback,_t=n.unstable_shouldYield,vt=n.unstable_requestPaint,yt=n.unstable_now,bt=n.unstable_getCurrentPriorityLevel,xt=n.unstable_ImmediatePriority,St=n.unstable_UserBlockingPriority,Ct=n.unstable_NormalPriority,wt=n.unstable_LowPriority,Tt=n.unstable_IdlePriority,Et=null,Dt=null;function Ot(e){if(Dt&&typeof Dt.onCommitFiberRoot==`function`)try{Dt.onCommitFiberRoot(Et,e,void 0,(e.current.flags&128)==128)}catch{}}var kt=Math.clz32?Math.clz32:Mt,At=Math.log,jt=Math.LN2;function Mt(e){return e>>>=0,e===0?32:31-(At(e)/jt|0)|0}var Nt=64,Pt=4194304;function Ft(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 It(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=Ft(a))):r=Ft(s)}else o=n&~i,o===0?a!==0&&(r=Ft(a)):r=Ft(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-kt(t),i=1<<n,r|=e[n],t&=~i;return r}function Lt(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 Rt(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,i=e.expirationTimes,a=e.pendingLanes;0<a;){var o=31-kt(a),s=1<<o,c=i[o];c===-1?((s&n)===0||(s&r)!==0)&&(i[o]=Lt(s,t)):c<=t&&(e.expiredLanes|=s),a&=~s}}function zt(e){return e=e.pendingLanes&-1073741825,e===0?e&1073741824?1073741824:0:e}function Bt(){var e=Nt;return Nt<<=1,!(Nt&4194240)&&(Nt=64),e}function Vt(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function Ht(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-kt(t),e[t]=n}function Ut(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-kt(n),a=1<<i;t[i]=0,r[i]=-1,e[i]=-1,n&=~a}}function Wt(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-kt(n),i=1<<r;i&t|e[r]&t&&(e[r]|=t),n&=~i}}var Gt=0;function Kt(e){return e&=-e,1<e?4<e?e&268435455?16:536870912:4:1}var qt,Jt,Yt,Xt,Zt,Qt=!1,$t=[],en=null,tn=null,nn=null,rn=new Map,an=new Map,on=[],sn=`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 cn(e,t){switch(e){case`focusin`:case`focusout`:en=null;break;case`dragenter`:case`dragleave`:tn=null;break;case`mouseover`:case`mouseout`:nn=null;break;case`pointerover`:case`pointerout`:rn.delete(t.pointerId);break;case`gotpointercapture`:case`lostpointercapture`:an.delete(t.pointerId)}}function ln(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=Ki(t),t!==null&&Jt(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,i!==null&&t.indexOf(i)===-1&&t.push(i),e)}function un(e,t,n,r,i){switch(t){case`focusin`:return en=ln(en,e,t,n,r,i),!0;case`dragenter`:return tn=ln(tn,e,t,n,r,i),!0;case`mouseover`:return nn=ln(nn,e,t,n,r,i),!0;case`pointerover`:var a=i.pointerId;return rn.set(a,ln(rn.get(a)||null,e,t,n,r,i)),!0;case`gotpointercapture`:return a=i.pointerId,an.set(a,ln(an.get(a)||null,e,t,n,r,i)),!0}return!1}function dn(e){var t=Gi(e.target);if(t!==null){var n=lt(t);if(n!==null){if(t=n.tag,t===13){if(t=ut(n),t!==null){e.blockedOn=t,Zt(e.priority,function(){Yt(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 fn(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=Cn(e.domEventName,e.eventSystemFlags,t[0],e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);Ve=r,n.target.dispatchEvent(r),Ve=null}else return t=Ki(n),t!==null&&Jt(t),e.blockedOn=n,!1;t.shift()}return!0}function pn(e,t,n){fn(e)&&n.delete(t)}function mn(){Qt=!1,en!==null&&fn(en)&&(en=null),tn!==null&&fn(tn)&&(tn=null),nn!==null&&fn(nn)&&(nn=null),rn.forEach(pn),an.forEach(pn)}function hn(e,t){e.blockedOn===t&&(e.blockedOn=null,Qt||(Qt=!0,n.unstable_scheduleCallback(n.unstable_NormalPriority,mn)))}function gn(e){function t(t){return hn(t,e)}if(0<$t.length){hn($t[0],e);for(var n=1;n<$t.length;n++){var r=$t[n];r.blockedOn===e&&(r.blockedOn=null)}}for(en!==null&&hn(en,e),tn!==null&&hn(tn,e),nn!==null&&hn(nn,e),rn.forEach(t),an.forEach(t),n=0;n<on.length;n++)r=on[n],r.blockedOn===e&&(r.blockedOn=null);for(;0<on.length&&(n=on[0],n.blockedOn===null);)dn(n),n.blockedOn===null&&on.shift()}var _n=C.ReactCurrentBatchConfig,vn=!0;function yn(e,t,n,r){var i=Gt,a=_n.transition;_n.transition=null;try{Gt=1,xn(e,t,n,r)}finally{Gt=i,_n.transition=a}}function bn(e,t,n,r){var i=Gt,a=_n.transition;_n.transition=null;try{Gt=4,xn(e,t,n,r)}finally{Gt=i,_n.transition=a}}function xn(e,t,n,r){if(vn){var i=Cn(e,t,n,r);if(i===null)_i(e,t,r,Sn,n),cn(e,r);else if(un(i,e,t,n,r))r.stopPropagation();else if(cn(e,r),t&4&&-1<sn.indexOf(e)){for(;i!==null;){var a=Ki(i);if(a!==null&&qt(a),a=Cn(e,t,n,r),a===null&&_i(e,t,r,Sn,n),a===i)break;i=a}i!==null&&r.stopPropagation()}else _i(e,t,r,null,n)}}var Sn=null;function Cn(e,t,n,r){if(Sn=null,e=He(r),e=Gi(e),e!==null){if(t=lt(e),t===null)e=null;else if(n=t.tag,n===13){if(e=ut(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 Sn=e,null}function wn(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(bt()){case xt:return 1;case St:return 4;case Ct:case wt:return 16;case Tt:return 536870912;default:return 16}default:return 16}}var Tn=null,En=null,Dn=null;function On(){if(Dn)return Dn;var e,t=En,n=t.length,r,i=`value`in Tn?Tn.value:Tn.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 Dn=i.slice(e,1<r?1-r:void 0)}function kn(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 An(){return!0}function jn(){return!1}function Mn(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)?An:jn,this.isPropagationStopped=jn,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=An)},stopPropagation:function(){var e=this.nativeEvent;e&&(e.stopPropagation?e.stopPropagation():typeof e.cancelBubble!=`unknown`&&(e.cancelBubble=!0),this.isPropagationStopped=An)},persist:function(){},isPersistent:An}),t}var Nn={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Pn=Mn(Nn),Fn=F({},Nn,{view:0,detail:0}),In=Mn(Fn),Ln,Rn,zn,Bn=F({},Fn,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Zn,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!==zn&&(zn&&e.type===`mousemove`?(Ln=e.screenX-zn.screenX,Rn=e.screenY-zn.screenY):Rn=Ln=0,zn=e),Ln)},movementY:function(e){return`movementY`in e?e.movementY:Rn}}),Vn=Mn(Bn),Hn=Mn(F({},Bn,{dataTransfer:0})),Un=Mn(F({},Fn,{relatedTarget:0})),Wn=Mn(F({},Nn,{animationName:0,elapsedTime:0,pseudoElement:0})),Gn=Mn(F({},Nn,{clipboardData:function(e){return`clipboardData`in e?e.clipboardData:window.clipboardData}})),Kn=Mn(F({},Nn,{data:0})),qn={Esc:`Escape`,Spacebar:` `,Left:`ArrowLeft`,Up:`ArrowUp`,Right:`ArrowRight`,Down:`ArrowDown`,Del:`Delete`,Win:`OS`,Menu:`ContextMenu`,Apps:`ContextMenu`,Scroll:`ScrollLock`,MozPrintableKey:`Unidentified`},Jn={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`},Yn={Alt:`altKey`,Control:`ctrlKey`,Meta:`metaKey`,Shift:`shiftKey`};function Xn(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=Yn[e])?!!t[e]:!1}function Zn(){return Xn}var Qn=Mn(F({},Fn,{key:function(e){if(e.key){var t=qn[e.key]||e.key;if(t!==`Unidentified`)return t}return e.type===`keypress`?(e=kn(e),e===13?`Enter`:String.fromCharCode(e)):e.type===`keydown`||e.type===`keyup`?Jn[e.keyCode]||`Unidentified`:``},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Zn,charCode:function(e){return e.type===`keypress`?kn(e):0},keyCode:function(e){return e.type===`keydown`||e.type===`keyup`?e.keyCode:0},which:function(e){return e.type===`keypress`?kn(e):e.type===`keydown`||e.type===`keyup`?e.keyCode:0}})),$n=Mn(F({},Bn,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0})),er=Mn(F({},Fn,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Zn})),tr=Mn(F({},Nn,{propertyName:0,elapsedTime:0,pseudoElement:0})),nr=Mn(F({},Bn,{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})),rr=[9,13,27,32],ir=c&&`CompositionEvent`in window,ar=null;c&&`documentMode`in document&&(ar=document.documentMode);var or=c&&`TextEvent`in window&&!ar,sr=c&&(!ir||ar&&8<ar&&11>=ar),cr=` `,lr=!1;function ur(e,t){switch(e){case`keyup`:return rr.indexOf(t.keyCode)!==-1;case`keydown`:return t.keyCode!==229;case`keypress`:case`mousedown`:case`focusout`:return!0;default:return!1}}function dr(e){return e=e.detail,typeof e==`object`&&`data`in e?e.data:null}var fr=!1;function pr(e,t){switch(e){case`compositionend`:return dr(t);case`keypress`:return t.which===32?(lr=!0,cr):null;case`textInput`:return e=t.data,e===cr&&lr?null:e;default:return null}}function mr(e,t){if(fr)return e===`compositionend`||!ir&&ur(e,t)?(e=On(),Dn=En=Tn=null,fr=!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 sr&&t.locale!==`ko`?null:t.data;default:return null}}var hr={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 gr(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t===`input`?!!hr[e.type]:t===`textarea`}function _r(e,t,n,r){I(r),t=yi(t,`onChange`),0<t.length&&(n=new Pn(`onChange`,`change`,null,n,r),e.push({event:n,listeners:t}))}var vr=null,yr=null;function br(e){di(e,0)}function xr(e){if(he(qi(e)))return e}function Sr(e,t){if(e===`change`)return t}var Cr=!1;if(c){var wr;if(c){var Tr=`oninput`in document;if(!Tr){var Er=document.createElement(`div`);Er.setAttribute(`oninput`,`return;`),Tr=typeof Er.oninput==`function`}wr=Tr}else wr=!1;Cr=wr&&(!document.documentMode||9<document.documentMode)}function Dr(){vr&&(vr.detachEvent(`onpropertychange`,Or),yr=vr=null)}function Or(e){if(e.propertyName===`value`&&xr(yr)){var t=[];_r(t,yr,e,He(e)),Ze(br,t)}}function kr(e,t,n){e===`focusin`?(Dr(),vr=t,yr=n,vr.attachEvent(`onpropertychange`,Or)):e===`focusout`&&Dr()}function Ar(e){if(e===`selectionchange`||e===`keyup`||e===`keydown`)return xr(yr)}function jr(e,t){if(e===`click`)return xr(t)}function Mr(e,t){if(e===`input`||e===`change`)return xr(t)}function Nr(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var Pr=typeof Object.is==`function`?Object.is:Nr;function Fr(e,t){if(Pr(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)||!Pr(e[i],t[i]))return!1}return!0}function Ir(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Lr(e,t){var n=Ir(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=Ir(n)}}function Rr(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Rr(e,t.parentNode):`contains`in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function zr(){for(var e=window,t=ge();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href==`string`}catch{n=!1}if(n)e=t.contentWindow;else break;t=ge(e.document)}return t}function Br(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 Vr(e){var t=zr(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&Rr(n.ownerDocument.documentElement,n)){if(r!==null&&Br(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=Lr(n,a);var o=Lr(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 Hr=c&&`documentMode`in document&&11>=document.documentMode,Ur=null,Wr=null,Gr=null,Kr=!1;function qr(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Kr||Ur==null||Ur!==ge(r)||(r=Ur,`selectionStart`in r&&Br(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}),Gr&&Fr(Gr,r)||(Gr=r,r=yi(Wr,`onSelect`),0<r.length&&(t=new Pn(`onSelect`,`select`,null,t,n),e.push({event:t,listeners:r}),t.target=Ur)))}function Jr(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n[`Webkit`+e]=`webkit`+t,n[`Moz`+e]=`moz`+t,n}var Yr={animationend:Jr(`Animation`,`AnimationEnd`),animationiteration:Jr(`Animation`,`AnimationIteration`),animationstart:Jr(`Animation`,`AnimationStart`),transitionend:Jr(`Transition`,`TransitionEnd`)},Xr={},Zr={};c&&(Zr=document.createElement(`div`).style,`AnimationEvent`in window||(delete Yr.animationend.animation,delete Yr.animationiteration.animation,delete Yr.animationstart.animation),`TransitionEvent`in window||delete Yr.transitionend.transition);function Qr(e){if(Xr[e])return Xr[e];if(!Yr[e])return e;var t=Yr[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in Zr)return Xr[e]=t[n];return e}var $r=Qr(`animationend`),ei=Qr(`animationiteration`),ti=Qr(`animationstart`),ni=Qr(`transitionend`),ri=new Map,ii=`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 ai(e,t){ri.set(e,t),o(t,[e])}for(var oi=0;oi<ii.length;oi++){var si=ii[oi];ai(si.toLowerCase(),`on`+(si[0].toUpperCase()+si.slice(1)))}ai($r,`onAnimationEnd`),ai(ei,`onAnimationIteration`),ai(ti,`onAnimationStart`),ai(`dblclick`,`onDoubleClick`),ai(`focusin`,`onFocus`),ai(`focusout`,`onBlur`),ai(ni,`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 ci=`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(` `),li=new Set(`cancel close invalid load scroll toggle`.split(` `).concat(ci));function ui(e,t,n){var r=e.type||`unknown-event`;e.currentTarget=n,ct(r,t,void 0,e),e.currentTarget=null}function di(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;ui(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;ui(i,s,l),a=c}}}if(it)throw e=at,it=!1,at=null,e}function fi(e,t){var n=t[Hi];n===void 0&&(n=t[Hi]=new Set);var r=e+`__bubble`;n.has(r)||(gi(t,e,2,!1),n.add(r))}function pi(e,t,n){var r=0;t&&(r|=4),gi(n,e,r,t)}var mi=`_reactListening`+Math.random().toString(36).slice(2);function hi(e){if(!e[mi]){e[mi]=!0,i.forEach(function(t){t!==`selectionchange`&&(li.has(t)||pi(t,!1,e),pi(t,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[mi]||(t[mi]=!0,pi(`selectionchange`,!1,t))}}function gi(e,t,n,r){switch(wn(t)){case 1:var i=yn;break;case 4:i=bn;break;default:i=xn}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 _i(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=Gi(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=He(n),o=[];a:{var s=ri.get(e);if(s!==void 0){var c=Pn,l=e;switch(e){case`keypress`:if(kn(n)===0)break a;case`keydown`:case`keyup`:c=Qn;break;case`focusin`:l=`focus`,c=Un;break;case`focusout`:l=`blur`,c=Un;break;case`beforeblur`:case`afterblur`:c=Un;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=Vn;break;case`drag`:case`dragend`:case`dragenter`:case`dragexit`:case`dragleave`:case`dragover`:case`dragstart`:case`drop`:c=Hn;break;case`touchcancel`:case`touchend`:case`touchmove`:case`touchstart`:c=er;break;case $r:case ei:case ti:c=Wn;break;case ni:c=tr;break;case`scroll`:c=In;break;case`wheel`:c=nr;break;case`copy`:case`cut`:case`paste`:c=Gn;break;case`gotpointercapture`:case`lostpointercapture`:case`pointercancel`:case`pointerdown`:case`pointermove`:case`pointerout`:case`pointerover`:case`pointerup`:c=$n}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(vi(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!==Ve&&(l=n.relatedTarget||n.fromElement)&&(Gi(l)||l[Vi]))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?Gi(l):null,l!==null&&(d=lt(l),l!==d||l.tag!==5&&l.tag!==6)&&(l=null)):(c=null,l=r),c!==l)){if(u=Vn,h=`onMouseLeave`,f=`onMouseEnter`,p=`mouse`,(e===`pointerout`||e===`pointerover`)&&(u=$n,h=`onPointerLeave`,f=`onPointerEnter`,p=`pointer`),d=c==null?s:qi(c),m=l==null?s:qi(l),s=new u(h,p+`leave`,c,n,i),s.target=d,s.relatedTarget=m,h=null,Gi(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=bi(m))p++;for(m=0,h=f;h;h=bi(h))m++;for(;0<p-m;)u=bi(u),p--;for(;0<m-p;)f=bi(f),m--;for(;p--;){if(u===f||f!==null&&u===f.alternate)break b;u=bi(u),f=bi(f)}u=null}else u=null;c!==null&&xi(o,s,c,u,!1),l!==null&&d!==null&&xi(o,d,l,u,!0)}}a:{if(s=r?qi(r):window,c=s.nodeName&&s.nodeName.toLowerCase(),c===`select`||c===`input`&&s.type===`file`)var g=Sr;else if(gr(s)){if(Cr)g=Mr;else{g=Ar;var _=kr}}else(c=s.nodeName)&&c.toLowerCase()===`input`&&(s.type===`checkbox`||s.type===`radio`)&&(g=jr);if(g&&=g(e,r)){_r(o,g,n,i);break a}_&&_(e,s,r),e===`focusout`&&(_=s._wrapperState)&&_.controlled&&s.type===`number`&&Se(s,`number`,s.value)}switch(_=r?qi(r):window,e){case`focusin`:(gr(_)||_.contentEditable===`true`)&&(Ur=_,Wr=r,Gr=null);break;case`focusout`:Gr=Wr=Ur=null;break;case`mousedown`:Kr=!0;break;case`contextmenu`:case`mouseup`:case`dragend`:Kr=!1,qr(o,n,i);break;case`selectionchange`:if(Hr)break;case`keydown`:case`keyup`:qr(o,n,i)}var v;if(ir)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 fr?ur(e,n)&&(y=`onCompositionEnd`):e===`keydown`&&n.keyCode===229&&(y=`onCompositionStart`);y&&(sr&&n.locale!==`ko`&&(fr||y!==`onCompositionStart`?y===`onCompositionEnd`&&fr&&(v=On()):(Tn=i,En=`value`in Tn?Tn.value:Tn.textContent,fr=!0)),_=yi(r,y),0<_.length&&(y=new Kn(y,e,null,n,i),o.push({event:y,listeners:_}),v?y.data=v:(v=dr(n),v!==null&&(y.data=v)))),(v=or?pr(e,n):mr(e,n))&&(r=yi(r,`onBeforeInput`),0<r.length&&(i=new Kn(`onBeforeInput`,`beforeinput`,null,n,i),o.push({event:i,listeners:r}),i.data=v))}di(o,t)})}function vi(e,t,n){return{instance:e,listener:t,currentTarget:n}}function yi(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(vi(e,a,i)),a=Qe(e,t),a!=null&&r.push(vi(e,a,i))),e=e.return}return r}function bi(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5);return e||null}function xi(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(vi(n,c,s))):i||(c=Qe(n,a),c!=null&&o.push(vi(n,c,s)))),n=n.return}o.length!==0&&e.push({event:t,listeners:o})}var Si=/\r\n?/g,Ci=/\u0000|\uFFFD/g;function wi(e){return(typeof e==`string`?e:``+e).replace(Si,`
|
|
7
|
+
`).replace(Ci,``)}function Ti(e,t,n){if(t=wi(t),wi(e)!==t&&n)throw Error(r(425))}function Ei(){}var Di=null,Oi=null;function ki(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 Ai=typeof setTimeout==`function`?setTimeout:void 0,ji=typeof clearTimeout==`function`?clearTimeout:void 0,Mi=typeof Promise==`function`?Promise:void 0,Ni=typeof queueMicrotask==`function`?queueMicrotask:Mi===void 0?Ai:function(e){return Mi.resolve(null).then(e).catch(Pi)};function Pi(e){setTimeout(function(){throw e})}function Fi(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),gn(t);return}r--}else n!==`$`&&n!==`$?`&&n!==`$!`||r++}n=i}while(n);gn(t)}function Ii(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 Li(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 Ri=Math.random().toString(36).slice(2),zi=`__reactFiber$`+Ri,Bi=`__reactProps$`+Ri,Vi=`__reactContainer$`+Ri,Hi=`__reactEvents$`+Ri,Ui=`__reactListeners$`+Ri,Wi=`__reactHandles$`+Ri;function Gi(e){var t=e[zi];if(t)return t;for(var n=e.parentNode;n;){if(t=n[Vi]||n[zi]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=Li(e);e!==null;){if(n=e[zi])return n;e=Li(e)}return t}e=n,n=e.parentNode}return null}function Ki(e){return e=e[zi]||e[Vi],!e||e.tag!==5&&e.tag!==6&&e.tag!==13&&e.tag!==3?null:e}function qi(e){if(e.tag===5||e.tag===6)return e.stateNode;throw Error(r(33))}function Ji(e){return e[Bi]||null}var Yi=[],Xi=-1;function Zi(e){return{current:e}}function Qi(e){0>Xi||(e.current=Yi[Xi],Yi[Xi]=null,Xi--)}function $i(e,t){Xi++,Yi[Xi]=e.current,e.current=t}var ea={},ta=Zi(ea),na=Zi(!1),ra=ea;function ia(e,t){var n=e.type.contextTypes;if(!n)return ea;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 aa(e){return e=e.childContextTypes,e!=null}function oa(){Qi(na),Qi(ta)}function sa(e,t,n){if(ta.current!==ea)throw Error(r(168));$i(ta,t),$i(na,n)}function ca(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,ue(e)||`Unknown`,a));return F({},n,i)}function la(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||ea,ra=ta.current,$i(ta,e),$i(na,na.current),!0}function ua(e,t,n){var i=e.stateNode;if(!i)throw Error(r(169));n?(e=ca(e,t,ra),i.__reactInternalMemoizedMergedChildContext=e,Qi(na),Qi(ta),$i(ta,e)):Qi(na),$i(na,n)}var da=null,fa=!1,pa=!1;function ma(e){da===null?da=[e]:da.push(e)}function ha(e){fa=!0,ma(e)}function ga(){if(!pa&&da!==null){pa=!0;var e=0,t=Gt;try{var n=da;for(Gt=1;e<n.length;e++){var r=n[e];do r=r(!0);while(r!==null)}da=null,fa=!1}catch(t){throw da!==null&&(da=da.slice(e+1)),ht(xt,ga),t}finally{Gt=t,pa=!1}}return null}var _a=[],va=0,ya=null,ba=0,xa=[],Sa=0,Ca=null,wa=1,Ta=``;function Ea(e,t){_a[va++]=ba,_a[va++]=ya,ya=e,ba=t}function Da(e,t,n){xa[Sa++]=wa,xa[Sa++]=Ta,xa[Sa++]=Ca,Ca=e;var r=wa;e=Ta;var i=32-kt(r)-1;r&=~(1<<i),n+=1;var a=32-kt(t)+i;if(30<a){var o=i-i%5;a=(r&(1<<o)-1).toString(32),r>>=o,i-=o,wa=1<<32-kt(t)+i|n<<i|r,Ta=a+e}else wa=1<<a|n<<i|r,Ta=e}function Oa(e){e.return!==null&&(Ea(e,1),Da(e,1,0))}function ka(e){for(;e===ya;)ya=_a[--va],_a[va]=null,ba=_a[--va],_a[va]=null;for(;e===Ca;)Ca=xa[--Sa],xa[Sa]=null,Ta=xa[--Sa],xa[Sa]=null,wa=xa[--Sa],xa[Sa]=null}var Aa=null,ja=null,Ma=!1,Na=null;function Pa(e,t){var n=ru(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 Fa(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,Aa=e,ja=Ii(t.firstChild),!0);case 6:return t=e.pendingProps===``||t.nodeType!==3?null:t,t!==null&&(e.stateNode=t,Aa=e,ja=null,!0);case 13:return t=t.nodeType===8?t:null,t!==null&&(n=Ca===null?null:{id:wa,overflow:Ta},e.memoizedState={dehydrated:t,treeContext:n,retryLane:1073741824},n=ru(18,null,null,0),n.stateNode=t,n.return=e,e.child=n,Aa=e,ja=null,!0);default:return!1}}function Ia(e){return!!(e.mode&1)&&!(e.flags&128)}function La(e){if(Ma){var t=ja;if(t){var n=t;if(!Fa(e,t)){if(Ia(e))throw Error(r(418));t=Ii(n.nextSibling);var i=Aa;t&&Fa(e,t)?Pa(i,n):(e.flags=e.flags&-4097|2,Ma=!1,Aa=e)}}else{if(Ia(e))throw Error(r(418));e.flags=e.flags&-4097|2,Ma=!1,Aa=e}}}function Ra(e){for(e=e.return;e!==null&&e.tag!==5&&e.tag!==3&&e.tag!==13;)e=e.return;Aa=e}function za(e){if(e!==Aa)return!1;if(!Ma)return Ra(e),Ma=!0,!1;var t;if((t=e.tag!==3)&&!(t=e.tag!==5)&&(t=e.type,t=t!==`head`&&t!==`body`&&!ki(e.type,e.memoizedProps)),t&&=ja){if(Ia(e))throw Ba(),Error(r(418));for(;t;)Pa(e,t),t=Ii(t.nextSibling)}if(Ra(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){ja=Ii(e.nextSibling);break a}t--}else n!==`$`&&n!==`$!`&&n!==`$?`||t++}e=e.nextSibling}ja=null}}else ja=Aa?Ii(e.stateNode.nextSibling):null;return!0}function Ba(){for(var e=ja;e;)e=Ii(e.nextSibling)}function Va(){ja=Aa=null,Ma=!1}function Ha(e){Na===null?Na=[e]:Na.push(e)}var Ua=C.ReactCurrentBatchConfig;function Wa(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 Ga(e,t){throw e=Object.prototype.toString.call(t),Error(r(31,e===`[object Object]`?`object with keys {`+Object.keys(t).join(`, `)+`}`:e))}function Ka(e){var t=e._init;return t(e._payload)}function qa(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=ou(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=uu(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===N&&Ka(i)===t.type)?(r=a(t,n.props),r.ref=Wa(e,t,n),r.return=e,r):(r=su(n.type,n.key,n.props,null,e.mode,r),r.ref=Wa(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=du(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=cu(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=uu(``+t,e.mode,n),t.return=e,t;if(typeof t==`object`&&t){switch(t.$$typeof){case w:return n=su(t.type,t.key,t.props,null,e.mode,n),n.ref=Wa(e,null,t),n.return=e,n;case T:return t=du(t,e.mode,n),t.return=e,t;case N:var r=t._init;return f(e,r(t._payload),n)}if(Ce(t)||re(t))return t=cu(t,e.mode,n,null),t.return=e,t;Ga(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 N:return i=n._init,p(e,t,i(n._payload),r)}if(Ce(n)||re(n))return i===null?d(e,t,n,r,null):null;Ga(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 N:var a=r._init;return m(e,t,n,a(r._payload),i)}if(Ce(r)||re(r))return e=e.get(n)||null,d(t,e,r,i,null);Ga(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),Ma&&Ea(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 Ma&&Ea(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)}),Ma&&Ea(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),Ma&&Ea(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 Ma&&Ea(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)}),Ma&&Ea(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===N&&Ka(c)===l.type){n(e,l.sibling),r=a(l,i.props),r.ref=Wa(e,l,i),r.return=e,e=r;break a}n(e,l);break}t(e,l),l=l.sibling}i.type===E?(r=cu(i.props.children,e.mode,o,i.key),r.return=e,e=r):(o=su(i.type,i.key,i.props,null,e.mode,o),o.ref=Wa(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=du(i,e.mode,o),r.return=e,e=r}return s(e);case N:return l=i._init,_(e,r,l(i._payload),o)}if(Ce(i))return h(e,r,i,o);if(re(i))return g(e,r,i,o);Ga(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=uu(i,e.mode,o),r.return=e,e=r),s(e)):n(e,r)}return _}var Ja=qa(!0),Ya=qa(!1),Xa=Zi(null),Za=null,Qa=null,$a=null;function eo(){$a=Qa=Za=null}function to(e){var t=Xa.current;Qi(Xa),e._currentValue=t}function no(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 ro(e,t){Za=e,$a=Qa=null,e=e.dependencies,e!==null&&e.firstContext!==null&&((e.lanes&t)!==0&&(Gs=!0),e.firstContext=null)}function io(e){var t=e._currentValue;if($a!==e){if(e={context:e,memoizedValue:t,next:null},Qa===null){if(Za===null)throw Error(r(308));Qa=e,Za.dependencies={lanes:0,firstContext:e}}else Qa=Qa.next=e}return t}var ao=null;function oo(e){ao===null?ao=[e]:ao.push(e)}function so(e,t,n,r){var i=t.interleaved;return i===null?(n.next=n,oo(t)):(n.next=i.next,i.next=n),t.interleaved=n,co(e,r)}function co(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 lo=!1;function uo(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function fo(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 po(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function mo(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,V&2){var i=r.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),r.pending=t,co(e,n)}return i=r.interleaved,i===null?(t.next=t,oo(r)):(t.next=i.next,i.next=t),r.interleaved=t,co(e,n)}function ho(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,Wt(e,n)}}function go(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 _o(e,t,n,r){var i=e.updateQueue;lo=!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:lo=!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);ol|=o,e.lanes=o,e.memoizedState=d}}function vo(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 yo={},bo=Zi(yo),xo=Zi(yo),So=Zi(yo);function Co(e){if(e===yo)throw Error(r(174));return e}function wo(e,t){switch($i(So,t),$i(xo,e),$i(bo,yo),e=t.nodeType,e){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:Ae(null,``);break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=Ae(t,e)}Qi(bo),$i(bo,t)}function To(){Qi(bo),Qi(xo),Qi(So)}function Eo(e){Co(So.current);var t=Co(bo.current),n=Ae(t,e.type);t!==n&&($i(xo,e),$i(bo,n))}function Do(e){xo.current===e&&(Qi(bo),Qi(xo))}var Oo=Zi(0);function ko(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 Ao=[];function jo(){for(var e=0;e<Ao.length;e++)Ao[e]._workInProgressVersionPrimary=null;Ao.length=0}var Mo=C.ReactCurrentDispatcher,No=C.ReactCurrentBatchConfig,Po=0,Fo=null,Io=null,Lo=null,Ro=!1,zo=!1,Bo=0,Vo=0;function Ho(){throw Error(r(321))}function Uo(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!Pr(e[n],t[n]))return!1;return!0}function Wo(e,t,n,i,a,o){if(Po=o,Fo=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,Mo.current=e===null||e.memoizedState===null?Ts:Es,e=n(i,a),zo){o=0;do{if(zo=!1,Bo=0,25<=o)throw Error(r(301));o+=1,Lo=Io=null,t.updateQueue=null,Mo.current=Ds,e=n(i,a)}while(zo)}if(Mo.current=ws,t=Io!==null&&Io.next!==null,Po=0,Lo=Io=Fo=null,Ro=!1,t)throw Error(r(300));return e}function L(){var e=Bo!==0;return Bo=0,e}function R(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Lo===null?Fo.memoizedState=Lo=e:Lo=Lo.next=e,Lo}function Go(){if(Io===null){var e=Fo.alternate;e=e===null?null:e.memoizedState}else e=Io.next;var t=Lo===null?Fo.memoizedState:Lo.next;if(t!==null)Lo=t,Io=e;else{if(e===null)throw Error(r(310));Io=e,e={memoizedState:Io.memoizedState,baseState:Io.baseState,baseQueue:Io.baseQueue,queue:Io.queue,next:null},Lo===null?Fo.memoizedState=Lo=e:Lo=Lo.next=e}return Lo}function Ko(e,t){return typeof t==`function`?t(e):t}function qo(e){var t=Go(),n=t.queue;if(n===null)throw Error(r(311));n.lastRenderedReducer=e;var i=Io,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((Po&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,Fo.lanes|=d,ol|=d}u=u.next}while(u!==null&&u!==o);l===null?s=i:l.next=c,Pr(i,t.memoizedState)||(Gs=!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,Fo.lanes|=o,ol|=o,a=a.next;while(a!==e)}else a===null&&(n.lanes=0);return[t.memoizedState,n.dispatch]}function Jo(e){var t=Go(),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);Pr(o,t.memoizedState)||(Gs=!0),t.memoizedState=o,t.baseQueue===null&&(t.baseState=o),n.lastRenderedState=o}return[o,i]}function Yo(){}function Xo(e,t){var n=Fo,i=Go(),a=t(),o=!Pr(i.memoizedState,a);if(o&&(i.memoizedState=a,Gs=!0),i=i.queue,cs($o.bind(null,n,i,e),[e]),i.getSnapshot!==t||o||Lo!==null&&Lo.memoizedState.tag&1){if(n.flags|=2048,rs(9,Qo.bind(null,n,i,a,t),void 0,null),$c===null)throw Error(r(349));Po&30||Zo(n,t,a)}return a}function Zo(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=Fo.updateQueue,t===null?(t={lastEffect:null,stores:null},Fo.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function Qo(e,t,n,r){t.value=n,t.getSnapshot=r,es(t)&&ts(e)}function $o(e,t,n){return n(function(){es(t)&&ts(e)})}function es(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!Pr(e,n)}catch{return!0}}function ts(e){var t=co(e,1);t!==null&&El(t,e,1,-1)}function ns(e){var t=R();return typeof e==`function`&&(e=e()),t.memoizedState=t.baseState=e,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Ko,lastRenderedState:e},t.queue=e,e=e.dispatch=bs.bind(null,Fo,e),[t.memoizedState,e]}function rs(e,t,n,r){return e={tag:e,create:t,destroy:n,deps:r,next:null},t=Fo.updateQueue,t===null?(t={lastEffect:null,stores:null},Fo.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 is(){return Go().memoizedState}function as(e,t,n,r){var i=R();Fo.flags|=e,i.memoizedState=rs(1|t,n,void 0,r===void 0?null:r)}function os(e,t,n,r){var i=Go();r=r===void 0?null:r;var a=void 0;if(Io!==null){var o=Io.memoizedState;if(a=o.destroy,r!==null&&Uo(r,o.deps)){i.memoizedState=rs(t,n,a,r);return}}Fo.flags|=e,i.memoizedState=rs(1|t,n,a,r)}function ss(e,t){return as(8390656,8,e,t)}function cs(e,t){return os(2048,8,e,t)}function ls(e,t){return os(4,2,e,t)}function us(e,t){return os(4,4,e,t)}function ds(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 fs(e,t,n){return n=n==null?null:n.concat([e]),os(4,4,ds.bind(null,t,e),n)}function ps(){}function ms(e,t){var n=Go();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&Uo(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function hs(e,t){var n=Go();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&Uo(t,r[1])?r[0]:(e=e(),n.memoizedState=[e,t],e)}function gs(e,t,n){return Po&21?(Pr(n,t)||(n=Bt(),Fo.lanes|=n,ol|=n,e.baseState=!0),t):(e.baseState&&(e.baseState=!1,Gs=!0),e.memoizedState=n)}function _s(e,t){var n=Gt;Gt=n!==0&&4>n?n:4,e(!0);var r=No.transition;No.transition={};try{e(!1),t()}finally{Gt=n,No.transition=r}}function vs(){return Go().memoizedState}function ys(e,t,n){var r=Tl(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},xs(e))Ss(t,n);else if(n=so(e,t,n,r),n!==null){var i=wl();El(n,e,r,i),Cs(n,t,r)}}function bs(e,t,n){var r=Tl(e),i={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(xs(e))Ss(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,Pr(s,o)){var c=t.interleaved;c===null?(i.next=i,oo(t)):(i.next=c.next,c.next=i),t.interleaved=i;return}}catch{}n=so(e,t,i,r),n!==null&&(i=wl(),El(n,e,r,i),Cs(n,t,r))}}function xs(e){var t=e.alternate;return e===Fo||t!==null&&t===Fo}function Ss(e,t){zo=Ro=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function Cs(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Wt(e,n)}}var ws={readContext:io,useCallback:Ho,useContext:Ho,useEffect:Ho,useImperativeHandle:Ho,useInsertionEffect:Ho,useLayoutEffect:Ho,useMemo:Ho,useReducer:Ho,useRef:Ho,useState:Ho,useDebugValue:Ho,useDeferredValue:Ho,useTransition:Ho,useMutableSource:Ho,useSyncExternalStore:Ho,useId:Ho,unstable_isNewReconciler:!1},Ts={readContext:io,useCallback:function(e,t){return R().memoizedState=[e,t===void 0?null:t],e},useContext:io,useEffect:ss,useImperativeHandle:function(e,t,n){return n=n==null?null:n.concat([e]),as(4194308,4,ds.bind(null,t,e),n)},useLayoutEffect:function(e,t){return as(4194308,4,e,t)},useInsertionEffect:function(e,t){return as(4,2,e,t)},useMemo:function(e,t){var n=R();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=R();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=ys.bind(null,Fo,e),[r.memoizedState,e]},useRef:function(e){var t=R();return e={current:e},t.memoizedState=e},useState:ns,useDebugValue:ps,useDeferredValue:function(e){return R().memoizedState=e},useTransition:function(){var e=ns(!1),t=e[0];return e=_s.bind(null,e[1]),R().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var i=Fo,a=R();if(Ma){if(n===void 0)throw Error(r(407));n=n()}else{if(n=t(),$c===null)throw Error(r(349));Po&30||Zo(i,t,n)}a.memoizedState=n;var o={value:n,getSnapshot:t};return a.queue=o,ss($o.bind(null,i,o,e),[e]),i.flags|=2048,rs(9,Qo.bind(null,i,o,n,t),void 0,null),n},useId:function(){var e=R(),t=$c.identifierPrefix;if(Ma){var n=Ta,r=wa;n=(r&~(1<<32-kt(r)-1)).toString(32)+n,t=`:`+t+`R`+n,n=Bo++,0<n&&(t+=`H`+n.toString(32)),t+=`:`}else n=Vo++,t=`:`+t+`r`+n.toString(32)+`:`;return e.memoizedState=t},unstable_isNewReconciler:!1},Es={readContext:io,useCallback:ms,useContext:io,useEffect:cs,useImperativeHandle:fs,useInsertionEffect:ls,useLayoutEffect:us,useMemo:hs,useReducer:qo,useRef:is,useState:function(){return qo(Ko)},useDebugValue:ps,useDeferredValue:function(e){return gs(Go(),Io.memoizedState,e)},useTransition:function(){return[qo(Ko)[0],Go().memoizedState]},useMutableSource:Yo,useSyncExternalStore:Xo,useId:vs,unstable_isNewReconciler:!1},Ds={readContext:io,useCallback:ms,useContext:io,useEffect:cs,useImperativeHandle:fs,useInsertionEffect:ls,useLayoutEffect:us,useMemo:hs,useReducer:Jo,useRef:is,useState:function(){return Jo(Ko)},useDebugValue:ps,useDeferredValue:function(e){var t=Go();return Io===null?t.memoizedState=e:gs(t,Io.memoizedState,e)},useTransition:function(){return[Jo(Ko)[0],Go().memoizedState]},useMutableSource:Yo,useSyncExternalStore:Xo,useId:vs,unstable_isNewReconciler:!1};function Os(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 ks(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 As={isMounted:function(e){return(e=e._reactInternals)?lt(e)===e:!1},enqueueSetState:function(e,t,n){e=e._reactInternals;var r=wl(),i=Tl(e),a=po(r,i);a.payload=t,n!=null&&(a.callback=n),t=mo(e,a,i),t!==null&&(El(t,e,i,r),ho(t,e,i))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=wl(),i=Tl(e),a=po(r,i);a.tag=1,a.payload=t,n!=null&&(a.callback=n),t=mo(e,a,i),t!==null&&(El(t,e,i,r),ho(t,e,i))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=wl(),r=Tl(e),i=po(n,r);i.tag=2,t!=null&&(i.callback=t),t=mo(e,i,r),t!==null&&(El(t,e,r,n),ho(t,e,r))}};function js(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?!Fr(n,r)||!Fr(i,a):!0}function Ms(e,t,n){var r=!1,i=ea,a=t.contextType;return typeof a==`object`&&a?a=io(a):(i=aa(t)?ra:ta.current,r=t.contextTypes,a=(r=r!=null)?ia(e,i):ea),t=new t(n,a),e.memoizedState=t.state!==null&&t.state!==void 0?t.state:null,t.updater=As,e.stateNode=t,t._reactInternals=e,r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=i,e.__reactInternalMemoizedMaskedChildContext=a),t}function Ns(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&&As.enqueueReplaceState(t,t.state,null)}function Ps(e,t,n,r){var i=e.stateNode;i.props=n,i.state=e.memoizedState,i.refs={},uo(e);var a=t.contextType;typeof a==`object`&&a?i.context=io(a):(a=aa(t)?ra:ta.current,i.context=ia(e,a)),i.state=e.memoizedState,a=t.getDerivedStateFromProps,typeof a==`function`&&(ks(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&&As.enqueueReplaceState(i,i.state,null),_o(e,n,i,r),i.state=e.memoizedState),typeof i.componentDidMount==`function`&&(e.flags|=4194308)}function Fs(e,t){try{var n=``,r=t;do n+=ce(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 Is(e,t,n){return{value:e,source:null,stack:n??null,digest:t??null}}function Ls(e,t){try{console.error(t.value)}catch(e){setTimeout(function(){throw e})}}var Rs=typeof WeakMap==`function`?WeakMap:Map;function zs(e,t,n){n=po(-1,n),n.tag=3,n.payload={element:null};var r=t.value;return n.callback=function(){ml||(ml=!0,hl=r),Ls(e,t)},n}function Bs(e,t,n){n=po(-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(){Ls(e,t)}}var a=e.stateNode;return a!==null&&typeof a.componentDidCatch==`function`&&(n.callback=function(){Ls(e,t),typeof r!=`function`&&(gl===null?gl=new Set([this]):gl.add(this));var n=t.stack;this.componentDidCatch(t.value,{componentStack:n===null?``:n})}),n}function Vs(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new Rs;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=Xl.bind(null,e,t,n),t.then(e,e))}function Hs(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 Us(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=po(-1,1),t.tag=2,mo(n,t,1))),n.lanes|=1),e)}var Ws=C.ReactCurrentOwner,Gs=!1;function Ks(e,t,n,r){t.child=e===null?Ya(t,null,n,r):Ja(t,e.child,n,r)}function qs(e,t,n,r,i){n=n.render;var a=t.ref;return ro(t,i),r=Wo(e,t,n,r,a,i),n=L(),e!==null&&!Gs?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~i,pc(e,t,i)):(Ma&&n&&Oa(t),t.flags|=1,Ks(e,t,r,i),t.child)}function Js(e,t,n,r,i){if(e===null){var a=n.type;return typeof a==`function`&&!iu(a)&&a.defaultProps===void 0&&n.compare===null&&n.defaultProps===void 0?(t.tag=15,t.type=a,Ys(e,t,a,r,i)):(e=su(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?Fr:n,n(o,r)&&e.ref===t.ref)return pc(e,t,i)}return t.flags|=1,e=ou(a,r),e.ref=t.ref,e.return=t,t.child=e}function Ys(e,t,n,r,i){if(e!==null){var a=e.memoizedProps;if(Fr(a,r)&&e.ref===t.ref){if(Gs=!1,t.pendingProps=r=a,(e.lanes&i)!==0)e.flags&131072&&(Gs=!0);else return t.lanes=e.lanes,pc(e,t,i)}}return Qs(e,t,n,r,i)}function Xs(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},$i(rl,nl),nl|=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,$i(rl,nl),nl|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=a===null?n:a.baseLanes,$i(rl,nl),nl|=r}}else a===null?r=n:(r=a.baseLanes|n,t.memoizedState=null),$i(rl,nl),nl|=r;return Ks(e,t,i,n),t.child}function Zs(e,t){var n=t.ref;(e===null&&n!==null||e!==null&&e.ref!==n)&&(t.flags|=512,t.flags|=2097152)}function Qs(e,t,n,r,i){var a=aa(n)?ra:ta.current;return a=ia(t,a),ro(t,i),n=Wo(e,t,n,r,a,i),r=L(),e!==null&&!Gs?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~i,pc(e,t,i)):(Ma&&r&&Oa(t),t.flags|=1,Ks(e,t,n,i),t.child)}function $s(e,t,n,r,i){if(aa(n)){var a=!0;la(t)}else a=!1;if(ro(t,i),t.stateNode===null)fc(e,t),Ms(t,n,r),Ps(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=io(l):(l=aa(n)?ra:ta.current,l=ia(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)&&Ns(t,o,r,l),lo=!1;var f=t.memoizedState;o.state=f,_o(t,r,o,i),c=t.memoizedState,s!==r||f!==c||na.current||lo?(typeof u==`function`&&(ks(t,n,u,r),c=t.memoizedState),(s=lo||js(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,fo(e,t),s=t.memoizedProps,l=t.type===t.elementType?s:Os(t.type,s),o.props=l,d=t.pendingProps,f=o.context,c=n.contextType,typeof c==`object`&&c?c=io(c):(c=aa(n)?ra:ta.current,c=ia(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)&&Ns(t,o,r,c),lo=!1,f=t.memoizedState,o.state=f,_o(t,r,o,i);var m=t.memoizedState;s!==d||f!==m||na.current||lo?(typeof p==`function`&&(ks(t,n,p,r),m=t.memoizedState),(l=lo||js(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 ec(e,t,n,r,a,i)}function ec(e,t,n,r,i,a){Zs(e,t);var o=!!(t.flags&128);if(!r&&!o)return i&&ua(t,n,!1),pc(e,t,a);r=t.stateNode,Ws.current=t;var s=o&&typeof n.getDerivedStateFromError!=`function`?null:r.render();return t.flags|=1,e!==null&&o?(t.child=Ja(t,e.child,null,a),t.child=Ja(t,null,s,a)):Ks(e,t,s,a),t.memoizedState=r.state,i&&ua(t,n,!0),t.child}function tc(e){var t=e.stateNode;t.pendingContext?sa(e,t.pendingContext,t.pendingContext!==t.context):t.context&&sa(e,t.context,!1),wo(e,t.containerInfo)}function nc(e,t,n,r,i){return Va(),Ha(i),t.flags|=256,Ks(e,t,n,r),t.child}var rc={dehydrated:null,treeContext:null,retryLane:0};function ic(e){return{baseLanes:e,cachePool:null,transitions:null}}function ac(e,t,n){var r=t.pendingProps,i=Oo.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),$i(Oo,i&1),e===null)return La(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=lu(o,r,0,null),e=cu(e,r,n,null),a.return=t,e.return=t,a.sibling=e,t.child=a,t.child.memoizedState=ic(n),t.memoizedState=rc,e):oc(t,o));if(i=e.memoizedState,i!==null&&(s=i.dehydrated,s!==null))return cc(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=ou(i,c),r.subtreeFlags=i.subtreeFlags&14680064),s===null?(a=cu(a,o,n,null),a.flags|=2):a=ou(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?ic(n):{baseLanes:o.baseLanes|n,cachePool:null,transitions:o.transitions},a.memoizedState=o,a.childLanes=e.childLanes&~n,t.memoizedState=rc,r}return a=e.child,e=a.sibling,r=ou(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 oc(e,t){return t=lu({mode:`visible`,children:t},e.mode,0,null),t.return=e,e.child=t}function sc(e,t,n,r){return r!==null&&Ha(r),Ja(t,e.child,null,n),e=oc(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function cc(e,t,n,i,a,o,s){if(n)return t.flags&256?(t.flags&=-257,i=Is(Error(r(422))),sc(e,t,s,i)):t.memoizedState===null?(o=i.fallback,a=t.mode,i=lu({mode:`visible`,children:i.children},a,0,null),o=cu(o,a,s,null),o.flags|=2,i.return=t,o.return=t,i.sibling=o,t.child=i,t.mode&1&&Ja(t,e.child,null,s),t.child.memoizedState=ic(s),t.memoizedState=rc,o):(t.child=e.child,t.flags|=128,null);if(!(t.mode&1))return sc(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=Is(o,i,void 0),sc(e,t,s,i)}if(c=(s&e.childLanes)!==0,Gs||c){if(i=$c,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,co(e,a),El(i,e,a,-1))}return Bl(),i=Is(Error(r(421))),sc(e,t,s,i)}return a.data===`$?`?(t.flags|=128,t.child=e.child,t=Ql.bind(null,e),a._reactRetry=t,null):(e=o.treeContext,ja=Ii(a.nextSibling),Aa=t,Ma=!0,Na=null,e!==null&&(xa[Sa++]=wa,xa[Sa++]=Ta,xa[Sa++]=Ca,wa=e.id,Ta=e.overflow,Ca=t),t=oc(t,i.children),t.flags|=4096,t)}function lc(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),no(e.return,t,n)}function uc(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 dc(e,t,n){var r=t.pendingProps,i=r.revealOrder,a=r.tail;if(Ks(e,t,r.children,n),r=Oo.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&&lc(e,n,t);else if(e.tag===19)lc(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($i(Oo,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&&ko(e)===null&&(i=n),n=n.sibling;n=i,n===null?(i=t.child,t.child=null):(i=n.sibling,n.sibling=null),uc(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&&ko(e)===null){t.child=i;break}e=i.sibling,i.sibling=n,n=i,i=e}uc(t,!0,n,null,a);break;case`together`:uc(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function fc(e,t){!(t.mode&1)&&e!==null&&(e.alternate=null,t.alternate=null,t.flags|=2)}function pc(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),ol|=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=ou(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=ou(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function mc(e,t,n){switch(t.tag){case 3:tc(t),Va();break;case 5:Eo(t);break;case 1:aa(t.type)&&la(t);break;case 4:wo(t,t.stateNode.containerInfo);break;case 10:var r=t.type._context,i=t.memoizedProps.value;$i(Xa,r._currentValue),r._currentValue=i;break;case 13:if(r=t.memoizedState,r!==null)return r.dehydrated===null?(n&t.child.childLanes)===0?($i(Oo,Oo.current&1),e=pc(e,t,n),e===null?null:e.sibling):ac(e,t,n):($i(Oo,Oo.current&1),t.flags|=128,null);$i(Oo,Oo.current&1);break;case 19:if(r=(n&t.childLanes)!==0,e.flags&128){if(r)return dc(e,t,n);t.flags|=128}if(i=t.memoizedState,i!==null&&(i.rendering=null,i.tail=null,i.lastEffect=null),$i(Oo,Oo.current),r)break;return null;case 22:case 23:return t.lanes=0,Xs(e,t,n)}return pc(e,t,n)}var hc=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}},gc=function(e,t,n,r){var i=e.memoizedProps;if(i!==r){e=t.stateNode,Co(bo.current);var o=null;switch(n){case`input`:i=_e(e,i),r=_e(e,r),o=[];break;case`select`:i=F({},i,{value:void 0}),r=F({},r,{value:void 0}),o=[];break;case`textarea`:i=Te(e,i),r=Te(e,r),o=[];break;default:typeof i.onClick!=`function`&&typeof r.onClick==`function`&&(e.onclick=Ei)}ze(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`&&fi(`scroll`,e),o||c===l||(o=[])):(o||=[]).push(u,l))}}n&&(o||=[]).push(`style`,n);var u=o;(t.updateQueue=u)&&(t.flags|=4)}},_c=function(e,t,n,r){n!==r&&(t.flags|=4)};function vc(e,t){if(!Ma)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 yc(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 bc(e,t,n){var i=t.pendingProps;switch(ka(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return yc(t),null;case 1:return aa(t.type)&&oa(),yc(t),null;case 3:return i=t.stateNode,To(),Qi(na),Qi(ta),jo(),i.pendingContext&&(i.context=i.pendingContext,i.pendingContext=null),(e===null||e.child===null)&&(za(t)?t.flags|=4:e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,Na!==null&&(Al(Na),Na=null))),yc(t),null;case 5:Do(t);var o=Co(So.current);if(n=t.type,e!==null&&t.stateNode!=null)gc(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 yc(t),null}if(e=Co(bo.current),za(t)){i=t.stateNode,n=t.type;var s=t.memoizedProps;switch(i[zi]=t,i[Bi]=s,e=!!(t.mode&1),n){case`dialog`:fi(`cancel`,i),fi(`close`,i);break;case`iframe`:case`object`:case`embed`:fi(`load`,i);break;case`video`:case`audio`:for(o=0;o<ci.length;o++)fi(ci[o],i);break;case`source`:fi(`error`,i);break;case`img`:case`image`:case`link`:fi(`error`,i),fi(`load`,i);break;case`details`:fi(`toggle`,i);break;case`input`:ve(i,s),fi(`invalid`,i);break;case`select`:i._wrapperState={wasMultiple:!!s.multiple},fi(`invalid`,i);break;case`textarea`:Ee(i,s),fi(`invalid`,i)}for(var c in ze(n,s),o=null,s)if(s.hasOwnProperty(c)){var l=s[c];c===`children`?typeof l==`string`?i.textContent!==l&&(!0!==s.suppressHydrationWarning&&Ti(i.textContent,l,e),o=[`children`,l]):typeof l==`number`&&i.textContent!==``+l&&(!0!==s.suppressHydrationWarning&&Ti(i.textContent,l,e),o=[`children`,``+l]):a.hasOwnProperty(c)&&l!=null&&c===`onScroll`&&fi(`scroll`,i)}switch(n){case`input`:me(i),xe(i,s,!0);break;case`textarea`:me(i),Oe(i);break;case`select`:case`option`:break;default:typeof s.onClick==`function`&&(i.onclick=Ei)}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=ke(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[zi]=t,e[Bi]=i,hc(e,t,!1,!1),t.stateNode=e;a:{switch(c=Be(n,i),n){case`dialog`:fi(`cancel`,e),fi(`close`,e),o=i;break;case`iframe`:case`object`:case`embed`:fi(`load`,e),o=i;break;case`video`:case`audio`:for(o=0;o<ci.length;o++)fi(ci[o],e);o=i;break;case`source`:fi(`error`,e),o=i;break;case`img`:case`image`:case`link`:fi(`error`,e),fi(`load`,e),o=i;break;case`details`:fi(`toggle`,e),o=i;break;case`input`:ve(e,i),o=_e(e,i),fi(`invalid`,e);break;case`option`:o=i;break;case`select`:e._wrapperState={wasMultiple:!!i.multiple},o=F({},i,{value:void 0}),fi(`invalid`,e);break;case`textarea`:Ee(e,i),o=Te(e,i),fi(`invalid`,e);break;default:o=i}for(s in ze(n,o),l=o,l)if(l.hasOwnProperty(s)){var u=l[s];s===`style`?Le(e,u):s===`dangerouslySetInnerHTML`?(u=u?u.__html:void 0,u!=null&&Me(e,u)):s===`children`?typeof u==`string`?(n!==`textarea`||u!==``)&&Ne(e,u):typeof u==`number`&&Ne(e,``+u):s!==`suppressContentEditableWarning`&&s!==`suppressHydrationWarning`&&s!==`autoFocus`&&(a.hasOwnProperty(s)?u!=null&&s===`onScroll`&&fi(`scroll`,e):u!=null&&S(e,s,u,c))}switch(n){case`input`:me(e),xe(e,i,!1);break;case`textarea`:me(e),Oe(e);break;case`option`:i.value!=null&&e.setAttribute(`value`,``+de(i.value));break;case`select`:e.multiple=!!i.multiple,s=i.value,s==null?i.defaultValue!=null&&we(e,!!i.multiple,i.defaultValue,!0):we(e,!!i.multiple,s,!1);break;default:typeof o.onClick==`function`&&(e.onclick=Ei)}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 yc(t),null;case 6:if(e&&t.stateNode!=null)_c(e,t,e.memoizedProps,i);else{if(typeof i!=`string`&&t.stateNode===null)throw Error(r(166));if(n=Co(So.current),Co(bo.current),za(t)){if(i=t.stateNode,n=t.memoizedProps,i[zi]=t,(s=i.nodeValue!==n)&&(e=Aa,e!==null))switch(e.tag){case 3:Ti(i.nodeValue,n,!!(e.mode&1));break;case 5:!0!==e.memoizedProps.suppressHydrationWarning&&Ti(i.nodeValue,n,!!(e.mode&1))}s&&(t.flags|=4)}else i=(n.nodeType===9?n:n.ownerDocument).createTextNode(i),i[zi]=t,t.stateNode=i}return yc(t),null;case 13:if(Qi(Oo),i=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(Ma&&ja!==null&&t.mode&1&&!(t.flags&128))Ba(),Va(),t.flags|=98560,s=!1;else if(s=za(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[zi]=t}else Va(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;yc(t),s=!1}else Na!==null&&(Al(Na),Na=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||Oo.current&1?il===0&&(il=3):Bl())),t.updateQueue!==null&&(t.flags|=4),yc(t),null);case 4:return To(),e===null&&hi(t.stateNode.containerInfo),yc(t),null;case 10:return to(t.type._context),yc(t),null;case 17:return aa(t.type)&&oa(),yc(t),null;case 19:if(Qi(Oo),s=t.memoizedState,s===null)return yc(t),null;if(i=!!(t.flags&128),c=s.rendering,c===null){if(i)vc(s,!1);else{if(il!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(c=ko(e),c!==null){for(t.flags|=128,vc(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 $i(Oo,Oo.current&1|2),t.child}e=e.sibling}s.tail!==null&&yt()>fl&&(t.flags|=128,i=!0,vc(s,!1),t.lanes=4194304)}}else{if(!i){if(e=ko(c),e!==null){if(t.flags|=128,i=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),vc(s,!0),s.tail===null&&s.tailMode===`hidden`&&!c.alternate&&!Ma)return yc(t),null}else 2*yt()-s.renderingStartTime>fl&&n!==1073741824&&(t.flags|=128,i=!0,vc(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?(yc(t),null):(t=s.tail,s.rendering=t,s.tail=t.sibling,s.renderingStartTime=yt(),t.sibling=null,n=Oo.current,$i(Oo,i?n&1|2:n&1),t);case 22:case 23:return Il(),i=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==i&&(t.flags|=8192),i&&t.mode&1?nl&1073741824&&(yc(t),t.subtreeFlags&6&&(t.flags|=8192)):yc(t),null;case 24:return null;case 25:return null}throw Error(r(156,t.tag))}function xc(e,t){switch(ka(t),t.tag){case 1:return aa(t.type)&&oa(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return To(),Qi(na),Qi(ta),jo(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return Do(t),null;case 13:if(Qi(Oo),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(r(340));Va()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return Qi(Oo),null;case 4:return To(),null;case 10:return to(t.type._context),null;case 22:case 23:return Il(),null;case 24:return null;default:return null}}var Sc=!1,Cc=!1,wc=typeof WeakSet==`function`?WeakSet:Set,z=null;function Tc(e,t){var n=e.ref;if(n!==null){if(typeof n==`function`)try{n(null)}catch(n){Yl(e,t,n)}else n.current=null}}function Ec(e,t,n){try{n()}catch(n){Yl(e,t,n)}}var Dc=!1;function Oc(e,t){if(Di=vn,e=zr(),Br(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(Oi={focusedElem:e,selectionRange:n},vn=!1,z=t;z!==null;)if(t=z,e=t.child,t.subtreeFlags&1028&&e!==null)e.return=t,z=e;else for(;z!==null;){t=z;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:Os(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){Yl(t,t.return,e)}if(e=t.sibling,e!==null){e.return=t.return,z=e;break}z=t.return}return h=Dc,Dc=!1,h}function kc(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&&Ec(t,n,a)}i=i.next}while(i!==r)}}function Ac(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 jc(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 Mc(e){var t=e.alternate;t!==null&&(e.alternate=null,Mc(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[zi],delete t[Bi],delete t[Hi],delete t[Ui],delete t[Wi])),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 Nc(e){return e.tag===5||e.tag===3||e.tag===4}function Pc(e){a:for(;;){for(;e.sibling===null;){if(e.return===null||Nc(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 Fc(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=Ei));else if(r!==4&&(e=e.child,e!==null))for(Fc(e,t,n),e=e.sibling;e!==null;)Fc(e,t,n),e=e.sibling}function Ic(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(Ic(e,t,n),e=e.sibling;e!==null;)Ic(e,t,n),e=e.sibling}var Lc=null,Rc=!1;function zc(e,t,n){for(n=n.child;n!==null;)Bc(e,t,n),n=n.sibling}function Bc(e,t,n){if(Dt&&typeof Dt.onCommitFiberUnmount==`function`)try{Dt.onCommitFiberUnmount(Et,n)}catch{}switch(n.tag){case 5:Cc||Tc(n,t);case 6:var r=Lc,i=Rc;Lc=null,zc(e,t,n),Lc=r,Rc=i,Lc!==null&&(Rc?(e=Lc,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):Lc.removeChild(n.stateNode));break;case 18:Lc!==null&&(Rc?(e=Lc,n=n.stateNode,e.nodeType===8?Fi(e.parentNode,n):e.nodeType===1&&Fi(e,n),gn(e)):Fi(Lc,n.stateNode));break;case 4:r=Lc,i=Rc,Lc=n.stateNode.containerInfo,Rc=!0,zc(e,t,n),Lc=r,Rc=i;break;case 0:case 11:case 14:case 15:if(!Cc&&(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)&&Ec(n,t,o),i=i.next}while(i!==r)}zc(e,t,n);break;case 1:if(!Cc&&(Tc(n,t),r=n.stateNode,typeof r.componentWillUnmount==`function`))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(e){Yl(n,t,e)}zc(e,t,n);break;case 21:zc(e,t,n);break;case 22:n.mode&1?(Cc=(r=Cc)||n.memoizedState!==null,zc(e,t,n),Cc=r):zc(e,t,n);break;default:zc(e,t,n)}}function Vc(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new wc),t.forEach(function(t){var r=$l.bind(null,e,t);n.has(t)||(n.add(t),t.then(r,r))})}}function B(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:Lc=c.stateNode,Rc=!1;break a;case 3:Lc=c.stateNode.containerInfo,Rc=!0;break a;case 4:Lc=c.stateNode.containerInfo,Rc=!0;break a}c=c.return}if(Lc===null)throw Error(r(160));Bc(o,s,a),Lc=null,Rc=!1;var l=a.alternate;l!==null&&(l.return=null),a.return=null}catch(e){Yl(a,t,e)}}if(t.subtreeFlags&12854)for(t=t.child;t!==null;)Hc(t,e),t=t.sibling}function Hc(e,t){var n=e.alternate,i=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(B(t,e),Uc(e),i&4){try{kc(3,e,e.return),Ac(3,e)}catch(t){Yl(e,e.return,t)}try{kc(5,e,e.return)}catch(t){Yl(e,e.return,t)}}break;case 1:B(t,e),Uc(e),i&512&&n!==null&&Tc(n,n.return);break;case 5:if(B(t,e),Uc(e),i&512&&n!==null&&Tc(n,n.return),e.flags&32){var a=e.stateNode;try{Ne(a,``)}catch(t){Yl(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&&ye(a,o),Be(c,s);var u=Be(c,o);for(s=0;s<l.length;s+=2){var d=l[s],f=l[s+1];d===`style`?Le(a,f):d===`dangerouslySetInnerHTML`?Me(a,f):d===`children`?Ne(a,f):S(a,d,f,u)}switch(c){case`input`:be(a,o);break;case`textarea`:De(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?we(a,!!o.multiple,o.multiple?[]:``,!1):we(a,!!o.multiple,o.defaultValue,!0)):we(a,!!o.multiple,m,!1)}a[Bi]=o}catch(t){Yl(e,e.return,t)}}break;case 6:if(B(t,e),Uc(e),i&4){if(e.stateNode===null)throw Error(r(162));a=e.stateNode,o=e.memoizedProps;try{a.nodeValue=o}catch(t){Yl(e,e.return,t)}}break;case 3:if(B(t,e),Uc(e),i&4&&n!==null&&n.memoizedState.isDehydrated)try{gn(t.containerInfo)}catch(t){Yl(e,e.return,t)}break;case 4:B(t,e),Uc(e);break;case 13:B(t,e),Uc(e),a=e.child,a.flags&8192&&(o=a.memoizedState!==null,a.stateNode.isHidden=o,!o||a.alternate!==null&&a.alternate.memoizedState!==null||(dl=yt())),i&4&&Vc(e);break;case 22:if(d=n!==null&&n.memoizedState!==null,e.mode&1?(Cc=(u=Cc)||d,B(t,e),Cc=u):B(t,e),Uc(e),i&8192){if(u=e.memoizedState!==null,(e.stateNode.isHidden=u)&&!d&&e.mode&1)for(z=e,d=e.child;d!==null;){for(f=z=d;z!==null;){switch(p=z,m=p.child,p.tag){case 0:case 11:case 14:case 15:kc(4,p,p.return);break;case 1:Tc(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){Yl(i,n,e)}}break;case 5:Tc(p,p.return);break;case 22:if(p.memoizedState!==null){qc(f);continue}}m===null?qc(f):(m.return=p,z=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=Ie(`display`,s))}catch(t){Yl(e,e.return,t)}}}else if(f.tag===6){if(d===null)try{f.stateNode.nodeValue=u?``:f.memoizedProps}catch(t){Yl(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:B(t,e),Uc(e),i&4&&Vc(e);break;case 21:break;default:B(t,e),Uc(e)}}function Uc(e){var t=e.flags;if(t&2){try{a:{for(var n=e.return;n!==null;){if(Nc(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&&(Ne(a,``),i.flags&=-33),Ic(e,Pc(e),a);break;case 3:case 4:var o=i.stateNode.containerInfo;Fc(e,Pc(e),o);break;default:throw Error(r(161))}}catch(t){Yl(e,e.return,t)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function Wc(e,t,n){z=e,Gc(e,t,n)}function Gc(e,t,n){for(var r=!!(e.mode&1);z!==null;){var i=z,a=i.child;if(i.tag===22&&r){var o=i.memoizedState!==null||Sc;if(!o){var s=i.alternate,c=s!==null&&s.memoizedState!==null||Cc;s=Sc;var l=Cc;if(Sc=o,(Cc=c)&&!l)for(z=i;z!==null;)o=z,c=o.child,o.tag===22&&o.memoizedState!==null||c===null?Jc(i):(c.return=o,z=c);for(;a!==null;)z=a,Gc(a,t,n),a=a.sibling;z=i,Sc=s,Cc=l}Kc(e,t,n)}else i.subtreeFlags&8772&&a!==null?(a.return=i,z=a):Kc(e,t,n)}}function Kc(e){for(;z!==null;){var t=z;if(t.flags&8772){var n=t.alternate;try{if(t.flags&8772)switch(t.tag){case 0:case 11:case 15:Cc||Ac(5,t);break;case 1:var i=t.stateNode;if(t.flags&4&&!Cc){if(n===null)i.componentDidMount();else{var a=t.elementType===t.type?n.memoizedProps:Os(t.type,n.memoizedProps);i.componentDidUpdate(a,n.memoizedState,i.__reactInternalSnapshotBeforeUpdate)}}var o=t.updateQueue;o!==null&&vo(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}vo(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&&gn(f)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(r(163))}Cc||t.flags&512&&jc(t)}catch(e){Yl(t,t.return,e)}}if(t===e){z=null;break}if(n=t.sibling,n!==null){n.return=t.return,z=n;break}z=t.return}}function qc(e){for(;z!==null;){var t=z;if(t===e){z=null;break}var n=t.sibling;if(n!==null){n.return=t.return,z=n;break}z=t.return}}function Jc(e){for(;z!==null;){var t=z;try{switch(t.tag){case 0:case 11:case 15:var n=t.return;try{Ac(4,t)}catch(e){Yl(t,n,e)}break;case 1:var r=t.stateNode;if(typeof r.componentDidMount==`function`){var i=t.return;try{r.componentDidMount()}catch(e){Yl(t,i,e)}}var a=t.return;try{jc(t)}catch(e){Yl(t,a,e)}break;case 5:var o=t.return;try{jc(t)}catch(e){Yl(t,o,e)}}}catch(e){Yl(t,t.return,e)}if(t===e){z=null;break}var s=t.sibling;if(s!==null){s.return=t.return,z=s;break}z=t.return}}var Yc=Math.ceil,Xc=C.ReactCurrentDispatcher,Zc=C.ReactCurrentOwner,Qc=C.ReactCurrentBatchConfig,V=0,$c=null,el=null,tl=0,nl=0,rl=Zi(0),il=0,al=null,ol=0,sl=0,cl=0,ll=null,ul=null,dl=0,fl=1/0,pl=null,ml=!1,hl=null,gl=null,_l=!1,vl=null,yl=0,bl=0,xl=null,Sl=-1,Cl=0;function wl(){return V&6?yt():Sl===-1?Sl=yt():Sl}function Tl(e){return e.mode&1?V&2&&tl!==0?tl&-tl:Ua.transition===null?(e=Gt,e===0?(e=window.event,e=e===void 0?16:wn(e.type),e):e):(Cl===0&&(Cl=Bt()),Cl):1}function El(e,t,n,i){if(50<bl)throw bl=0,xl=null,Error(r(185));Ht(e,n,i),(!(V&2)||e!==$c)&&(e===$c&&(!(V&2)&&(sl|=n),il===4&&Ml(e,tl)),Dl(e,i),n===1&&V===0&&!(t.mode&1)&&(fl=yt()+500,fa&&ga()))}function Dl(e,t){var n=e.callbackNode;Rt(e,t);var r=It(e,e===$c?tl:0);if(r===0)n!==null&>(n),e.callbackNode=null,e.callbackPriority=0;else if(t=r&-r,e.callbackPriority!==t){if(n!=null&>(n),t===1)e.tag===0?ha(Nl.bind(null,e)):ma(Nl.bind(null,e)),Ni(function(){!(V&6)&&ga()}),n=null;else{switch(Kt(r)){case 1:n=xt;break;case 4:n=St;break;case 16:n=Ct;break;case 536870912:n=Tt;break;default:n=Ct}n=tu(n,Ol.bind(null,e))}e.callbackPriority=t,e.callbackNode=n}}function Ol(e,t){if(Sl=-1,Cl=0,V&6)throw Error(r(327));var n=e.callbackNode;if(H()&&e.callbackNode!==n)return null;var i=It(e,e===$c?tl:0);if(i===0)return null;if(i&30||(i&e.expiredLanes)!==0||t)t=Vl(e,i);else{t=i;var a=V;V|=2;var o=zl();($c!==e||tl!==t)&&(pl=null,fl=yt()+500,Ll(e,t));do try{Ul();break}catch(t){Rl(e,t)}while(1);eo(),Xc.current=o,V=a,el===null?($c=null,tl=0,t=il):t=0}if(t!==0){if(t===2&&(a=zt(e),a!==0&&(i=a,t=kl(e,a))),t===1)throw n=al,Ll(e,0),Ml(e,i),Dl(e,yt()),n;if(t===6)Ml(e,i);else{if(a=e.current.alternate,!(i&30)&&!jl(a)&&(t=Vl(e,i),t===2&&(o=zt(e),o!==0&&(i=o,t=kl(e,o))),t===1))throw n=al,Ll(e,0),Ml(e,i),Dl(e,yt()),n;switch(e.finishedWork=a,e.finishedLanes=i,t){case 0:case 1:throw Error(r(345));case 2:Kl(e,ul,pl);break;case 3:if(Ml(e,i),(i&130023424)===i&&(t=dl+500-yt(),10<t)){if(It(e,0)!==0)break;if(a=e.suspendedLanes,(a&i)!==i){wl(),e.pingedLanes|=e.suspendedLanes&a;break}e.timeoutHandle=Ai(Kl.bind(null,e,ul,pl),t);break}Kl(e,ul,pl);break;case 4:if(Ml(e,i),(i&4194240)===i)break;for(t=e.eventTimes,a=-1;0<i;){var s=31-kt(i);o=1<<s,s=t[s],s>a&&(a=s),i&=~o}if(i=a,i=yt()-i,i=(120>i?120:480>i?480:1080>i?1080:1920>i?1920:3e3>i?3e3:4320>i?4320:1960*Yc(i/1960))-i,10<i){e.timeoutHandle=Ai(Kl.bind(null,e,ul,pl),i);break}Kl(e,ul,pl);break;case 5:Kl(e,ul,pl);break;default:throw Error(r(329))}}}return Dl(e,yt()),e.callbackNode===n?Ol.bind(null,e):null}function kl(e,t){var n=ll;return e.current.memoizedState.isDehydrated&&(Ll(e,t).flags|=256),e=Vl(e,t),e!==2&&(t=ul,ul=n,t!==null&&Al(t)),e}function Al(e){ul===null?ul=e:ul.push.apply(ul,e)}function jl(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(!Pr(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 Ml(e,t){for(t&=~cl,t&=~sl,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0<t;){var n=31-kt(t),r=1<<n;e[n]=-1,t&=~r}}function Nl(e){if(V&6)throw Error(r(327));H();var t=It(e,0);if(!(t&1))return Dl(e,yt()),null;var n=Vl(e,t);if(e.tag!==0&&n===2){var i=zt(e);i!==0&&(t=i,n=kl(e,i))}if(n===1)throw n=al,Ll(e,0),Ml(e,t),Dl(e,yt()),n;if(n===6)throw Error(r(345));return e.finishedWork=e.current.alternate,e.finishedLanes=t,Kl(e,ul,pl),Dl(e,yt()),null}function Pl(e,t){var n=V;V|=1;try{return e(t)}finally{V=n,V===0&&(fl=yt()+500,fa&&ga())}}function Fl(e){vl!==null&&vl.tag===0&&!(V&6)&&H();var t=V;V|=1;var n=Qc.transition,r=Gt;try{if(Qc.transition=null,Gt=1,e)return e()}finally{Gt=r,Qc.transition=n,V=t,!(V&6)&&ga()}}function Il(){nl=rl.current,Qi(rl)}function Ll(e,t){e.finishedWork=null,e.finishedLanes=0;var n=e.timeoutHandle;if(n!==-1&&(e.timeoutHandle=-1,ji(n)),el!==null)for(n=el.return;n!==null;){var r=n;switch(ka(r),r.tag){case 1:r=r.type.childContextTypes,r!=null&&oa();break;case 3:To(),Qi(na),Qi(ta),jo();break;case 5:Do(r);break;case 4:To();break;case 13:Qi(Oo);break;case 19:Qi(Oo);break;case 10:to(r.type._context);break;case 22:case 23:Il()}n=n.return}if($c=e,el=e=ou(e.current,null),tl=nl=t,il=0,al=null,cl=sl=ol=0,ul=ll=null,ao!==null){for(t=0;t<ao.length;t++)if(n=ao[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}ao=null}return e}function Rl(e,t){do{var n=el;try{if(eo(),Mo.current=ws,Ro){for(var i=Fo.memoizedState;i!==null;){var a=i.queue;a!==null&&(a.pending=null),i=i.next}Ro=!1}if(Po=0,Lo=Io=Fo=null,zo=!1,Bo=0,Zc.current=null,n===null||n.return===null){il=1,al=t,el=null;break}a:{var o=e,s=n.return,c=n,l=t;if(t=tl,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=Hs(s);if(m!==null){m.flags&=-257,Us(m,s,c,o,t),m.mode&1&&Vs(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)){Vs(o,u,t),Bl();break a}l=Error(r(426))}else if(Ma&&c.mode&1){var _=Hs(s);if(_!==null){!(_.flags&65536)&&(_.flags|=256),Us(_,s,c,o,t),Ha(Fs(l,c));break a}}o=l=Fs(l,c),il!==4&&(il=2),ll===null?ll=[o]:ll.push(o),o=s;do{switch(o.tag){case 3:o.flags|=65536,t&=-t,o.lanes|=t;var v=zs(o,l,t);go(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`&&(gl===null||!gl.has(b)))){o.flags|=65536,t&=-t,o.lanes|=t;var x=Bs(o,c,t);go(o,x);break a}}o=o.return}while(o!==null)}Gl(n)}catch(e){t=e,el===n&&n!==null&&(el=n=n.return);continue}break}while(1)}function zl(){var e=Xc.current;return Xc.current=ws,e===null?ws:e}function Bl(){(il===0||il===3||il===2)&&(il=4),$c===null||!(ol&268435455)&&!(sl&268435455)||Ml($c,tl)}function Vl(e,t){var n=V;V|=2;var i=zl();($c!==e||tl!==t)&&(pl=null,Ll(e,t));do try{Hl();break}catch(t){Rl(e,t)}while(1);if(eo(),V=n,Xc.current=i,el!==null)throw Error(r(261));return $c=null,tl=0,il}function Hl(){for(;el!==null;)Wl(el)}function Ul(){for(;el!==null&&!_t();)Wl(el)}function Wl(e){var t=eu(e.alternate,e,nl);e.memoizedProps=e.pendingProps,t===null?Gl(e):el=t,Zc.current=null}function Gl(e){var t=e;do{var n=t.alternate;if(e=t.return,t.flags&32768){if(n=xc(n,t),n!==null){n.flags&=32767,el=n;return}if(e!==null)e.flags|=32768,e.subtreeFlags=0,e.deletions=null;else{il=6,el=null;return}}else if(n=bc(n,t,nl),n!==null){el=n;return}if(t=t.sibling,t!==null){el=t;return}el=t=e}while(t!==null);il===0&&(il=5)}function Kl(e,t,n){var r=Gt,i=Qc.transition;try{Qc.transition=null,Gt=1,ql(e,t,n,r)}finally{Qc.transition=i,Gt=r}return null}function ql(e,t,n,i){do H();while(vl!==null);if(V&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(Ut(e,o),e===$c&&(el=$c=null,tl=0),!(n.subtreeFlags&2064)&&!(n.flags&2064)||_l||(_l=!0,tu(Ct,function(){return H(),null})),o=!!(n.flags&15990),n.subtreeFlags&15990||o){o=Qc.transition,Qc.transition=null;var s=Gt;Gt=1;var c=V;V|=4,Zc.current=null,Oc(e,n),Hc(n,e),Vr(Oi),vn=!!Di,Oi=Di=null,e.current=n,Wc(n,e,a),vt(),V=c,Gt=s,Qc.transition=o}else e.current=n;if(_l&&(_l=!1,vl=e,yl=a),o=e.pendingLanes,o===0&&(gl=null),Ot(n.stateNode,i),Dl(e,yt()),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(ml)throw ml=!1,e=hl,hl=null,e;return yl&1&&e.tag!==0&&H(),o=e.pendingLanes,o&1?e===xl?bl++:(bl=0,xl=e):bl=0,ga(),null}function H(){if(vl!==null){var e=Kt(yl),t=Qc.transition,n=Gt;try{if(Qc.transition=null,Gt=16>e?16:e,vl===null)var i=!1;else{if(e=vl,vl=null,yl=0,V&6)throw Error(r(331));var a=V;for(V|=4,z=e.current;z!==null;){var o=z,s=o.child;if(z.flags&16){var c=o.deletions;if(c!==null){for(var l=0;l<c.length;l++){var u=c[l];for(z=u;z!==null;){var d=z;switch(d.tag){case 0:case 11:case 15:kc(8,d,o)}var f=d.child;if(f!==null)f.return=d,z=f;else for(;z!==null;){d=z;var p=d.sibling,m=d.return;if(Mc(d),d===u){z=null;break}if(p!==null){p.return=m,z=p;break}z=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)}}z=o}}if(o.subtreeFlags&2064&&s!==null)s.return=o,z=s;else b:for(;z!==null;){if(o=z,o.flags&2048)switch(o.tag){case 0:case 11:case 15:kc(9,o,o.return)}var v=o.sibling;if(v!==null){v.return=o.return,z=v;break b}z=o.return}}var y=e.current;for(z=y;z!==null;){s=z;var b=s.child;if(s.subtreeFlags&2064&&b!==null)b.return=s,z=b;else b:for(s=y;z!==null;){if(c=z,c.flags&2048)try{switch(c.tag){case 0:case 11:case 15:Ac(9,c)}}catch(e){Yl(c,c.return,e)}if(c===s){z=null;break b}var x=c.sibling;if(x!==null){x.return=c.return,z=x;break b}z=c.return}}if(V=a,ga(),Dt&&typeof Dt.onPostCommitFiberRoot==`function`)try{Dt.onPostCommitFiberRoot(Et,e)}catch{}i=!0}return i}finally{Gt=n,Qc.transition=t}}return!1}function Jl(e,t,n){t=Fs(n,t),t=zs(e,t,1),e=mo(e,t,1),t=wl(),e!==null&&(Ht(e,1,t),Dl(e,t))}function Yl(e,t,n){if(e.tag===3)Jl(e,e,n);else for(;t!==null;){if(t.tag===3){Jl(t,e,n);break}if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError==`function`||typeof r.componentDidCatch==`function`&&(gl===null||!gl.has(r))){e=Fs(n,e),e=Bs(t,e,1),t=mo(t,e,1),e=wl(),t!==null&&(Ht(t,1,e),Dl(t,e));break}}t=t.return}}function Xl(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),t=wl(),e.pingedLanes|=e.suspendedLanes&n,$c===e&&(tl&n)===n&&(il===4||il===3&&(tl&130023424)===tl&&500>yt()-dl?Ll(e,0):cl|=n),Dl(e,t)}function Zl(e,t){t===0&&(e.mode&1?(t=Pt,Pt<<=1,!(Pt&130023424)&&(Pt=4194304)):t=1);var n=wl();e=co(e,t),e!==null&&(Ht(e,t,n),Dl(e,n))}function Ql(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),Zl(e,n)}function $l(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),Zl(e,n)}var eu=function(e,t,n){if(e!==null){if(e.memoizedProps!==t.pendingProps||na.current)Gs=!0;else{if((e.lanes&n)===0&&!(t.flags&128))return Gs=!1,mc(e,t,n);Gs=!!(e.flags&131072)}}else Gs=!1,Ma&&t.flags&1048576&&Da(t,ba,t.index);switch(t.lanes=0,t.tag){case 2:var i=t.type;fc(e,t),e=t.pendingProps;var a=ia(t,ta.current);ro(t,n),a=Wo(null,t,i,e,a,n);var o=L();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,aa(i)?(o=!0,la(t)):o=!1,t.memoizedState=a.state!==null&&a.state!==void 0?a.state:null,uo(t),a.updater=As,t.stateNode=a,a._reactInternals=t,Ps(t,i,e,n),t=ec(null,t,i,!0,o,n)):(t.tag=0,Ma&&o&&Oa(t),Ks(null,t,a,n),t=t.child),t;case 16:i=t.elementType;a:{switch(fc(e,t),e=t.pendingProps,a=i._init,i=a(i._payload),t.type=i,a=t.tag=au(i),e=Os(i,e),a){case 0:t=Qs(null,t,i,e,n);break a;case 1:t=$s(null,t,i,e,n);break a;case 11:t=qs(null,t,i,e,n);break a;case 14:t=Js(null,t,i,Os(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:Os(i,a),Qs(e,t,i,a,n);case 1:return i=t.type,a=t.pendingProps,a=t.elementType===i?a:Os(i,a),$s(e,t,i,a,n);case 3:a:{if(tc(t),e===null)throw Error(r(387));i=t.pendingProps,o=t.memoizedState,a=o.element,fo(e,t),_o(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=Fs(Error(r(423)),t),t=nc(e,t,i,n,a);break a}if(i!==a){a=Fs(Error(r(424)),t),t=nc(e,t,i,n,a);break a}for(ja=Ii(t.stateNode.containerInfo.firstChild),Aa=t,Ma=!0,Na=null,n=Ya(t,null,i,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling}else{if(Va(),i===a){t=pc(e,t,n);break a}Ks(e,t,i,n)}t=t.child}return t;case 5:return Eo(t),e===null&&La(t),i=t.type,a=t.pendingProps,o=e===null?null:e.memoizedProps,s=a.children,ki(i,a)?s=null:o!==null&&ki(i,o)&&(t.flags|=32),Zs(e,t),Ks(e,t,s,n),t.child;case 6:return e===null&&La(t),null;case 13:return ac(e,t,n);case 4:return wo(t,t.stateNode.containerInfo),i=t.pendingProps,e===null?t.child=Ja(t,null,i,n):Ks(e,t,i,n),t.child;case 11:return i=t.type,a=t.pendingProps,a=t.elementType===i?a:Os(i,a),qs(e,t,i,a,n);case 7:return Ks(e,t,t.pendingProps,n),t.child;case 8:return Ks(e,t,t.pendingProps.children,n),t.child;case 12:return Ks(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,$i(Xa,i._currentValue),i._currentValue=s,o!==null){if(Pr(o.value,s)){if(o.children===a.children&&!na.current){t=pc(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=po(-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),no(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),no(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}}Ks(e,t,a.children,n),t=t.child}return t;case 9:return a=t.type,i=t.pendingProps.children,ro(t,n),a=io(a),i=i(a),t.flags|=1,Ks(e,t,i,n),t.child;case 14:return i=t.type,a=Os(i,t.pendingProps),a=Os(i.type,a),Js(e,t,i,a,n);case 15:return Ys(e,t,t.type,t.pendingProps,n);case 17:return i=t.type,a=t.pendingProps,a=t.elementType===i?a:Os(i,a),fc(e,t),t.tag=1,aa(i)?(e=!0,la(t)):e=!1,ro(t,n),Ms(t,i,a),Ps(t,i,a,n),ec(null,t,i,!0,e,n);case 19:return dc(e,t,n);case 22:return Xs(e,t,n)}throw Error(r(156,t.tag))};function tu(e,t){return ht(e,t)}function nu(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 ru(e,t,n,r){return new nu(e,t,n,r)}function iu(e){return e=e.prototype,!(!e||!e.isReactComponent)}function au(e){if(typeof e==`function`)return+!!iu(e);if(e!=null){if(e=e.$$typeof,e===ee)return 11;if(e===M)return 14}return 2}function ou(e,t){var n=e.alternate;return n===null?(n=ru(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 su(e,t,n,i,a,o){var s=2;if(i=e,typeof e==`function`)iu(e)&&(s=1);else if(typeof e==`string`)s=5;else a:switch(e){case E:return cu(n.children,a,o,t);case D:s=8,a|=8;break;case O:return e=ru(12,n,t,a|2),e.elementType=O,e.lanes=o,e;case j:return e=ru(13,n,t,a),e.elementType=j,e.lanes=o,e;case te:return e=ru(19,n,t,a),e.elementType=te,e.lanes=o,e;case ne:return lu(n,a,o,t);default:if(typeof e==`object`&&e)switch(e.$$typeof){case k:s=10;break a;case A:s=9;break a;case ee:s=11;break a;case M:s=14;break a;case N:s=16,i=null;break a}throw Error(r(130,e==null?e:typeof e,``))}return t=ru(s,n,t,a),t.elementType=e,t.type=i,t.lanes=o,t}function cu(e,t,n,r){return e=ru(7,e,r,t),e.lanes=n,e}function lu(e,t,n,r){return e=ru(22,e,r,t),e.elementType=ne,e.lanes=n,e.stateNode={isHidden:!1},e}function uu(e,t,n){return e=ru(6,e,null,t),e.lanes=n,e}function du(e,t,n){return t=ru(4,e.children===null?[]:e.children,e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function fu(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=Vt(0),this.expirationTimes=Vt(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Vt(0),this.identifierPrefix=r,this.onRecoverableError=i,this.mutableSourceEagerHydrationData=null}function pu(e,t,n,r,i,a,o,s,c){return e=new fu(e,t,n,s,c),t===1?(t=1,!0===a&&(t|=8)):t=0,a=ru(3,null,null,t),e.current=a,a.stateNode=e,a.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},uo(a),e}function mu(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 hu(e){if(!e)return ea;e=e._reactInternals;a:{if(lt(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(aa(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(aa(n))return ca(e,n,t)}return t}function gu(e,t,n,r,i,a,o,s,c){return e=pu(n,r,!0,e,i,a,o,s,c),e.context=hu(null),n=e.current,r=wl(),i=Tl(n),a=po(r,i),a.callback=t??null,mo(n,a,i),e.current.lanes=i,Ht(e,i,r),Dl(e,r),e}function _u(e,t,n,r){var i=t.current,a=wl(),o=Tl(i);return n=hu(n),t.context===null?t.context=n:t.pendingContext=n,t=po(a,o),t.payload={element:e},r=r===void 0?null:r,r!==null&&(t.callback=r),e=mo(i,t,o),e!==null&&(El(e,i,o,a),ho(e,i,o)),o}function vu(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 yu(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function bu(e,t){yu(e,t),(e=e.alternate)&&yu(e,t)}function U(){return null}var xu=typeof reportError==`function`?reportError:function(e){console.error(e)};function Su(e){this._internalRoot=e}W.prototype.render=Su.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(r(409));_u(e,t,null,null)},W.prototype.unmount=Su.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;Fl(function(){_u(null,e,null,null)}),t[Vi]=null}};function W(e){this._internalRoot=e}W.prototype.unstable_scheduleHydration=function(e){if(e){var t=Xt();e={blockedOn:null,target:e,priority:t};for(var n=0;n<on.length&&t!==0&&t<on[n].priority;n++);on.splice(n,0,e),n===0&&dn(e)}};function Cu(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function wu(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11&&(e.nodeType!==8||e.nodeValue!==` react-mount-point-unstable `))}function Tu(){}function Eu(e,t,n,r,i){if(i){if(typeof r==`function`){var a=r;r=function(){var e=vu(o);a.call(e)}}var o=gu(t,r,e,0,null,!1,!1,``,Tu);return e._reactRootContainer=o,e[Vi]=o.current,hi(e.nodeType===8?e.parentNode:e),Fl(),o}for(;i=e.lastChild;)e.removeChild(i);if(typeof r==`function`){var s=r;r=function(){var e=vu(c);s.call(e)}}var c=pu(e,0,!1,null,null,!1,!1,``,Tu);return e._reactRootContainer=c,e[Vi]=c.current,hi(e.nodeType===8?e.parentNode:e),Fl(function(){_u(t,c,n,r)}),c}function Du(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=vu(o);s.call(e)}}_u(t,o,e,i)}else o=Eu(n,t,e,i,r);return vu(o)}qt=function(e){switch(e.tag){case 3:var t=e.stateNode;if(t.current.memoizedState.isDehydrated){var n=Ft(t.pendingLanes);n!==0&&(Wt(t,n|1),Dl(t,yt()),!(V&6)&&(fl=yt()+500,ga()))}break;case 13:Fl(function(){var t=co(e,1);t!==null&&El(t,e,1,wl())}),bu(e,1)}},Jt=function(e){if(e.tag===13){var t=co(e,134217728);t!==null&&El(t,e,134217728,wl()),bu(e,134217728)}},Yt=function(e){if(e.tag===13){var t=Tl(e),n=co(e,t);n!==null&&El(n,e,t,wl()),bu(e,t)}},Xt=function(){return Gt},Zt=function(e,t){var n=Gt;try{return Gt=e,t()}finally{Gt=n}},Ue=function(e,t,n){switch(t){case`input`:if(be(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=Ji(i);if(!a)throw Error(r(90));he(i),be(i,a)}}}break;case`textarea`:De(e,n);break;case`select`:t=n.value,t!=null&&we(e,!!n.multiple,t,!1)}},Je=Pl,Ye=Fl;var Ou={usingClientEntryPoint:!1,Events:[Ki,qi,Ji,I,qe,Pl]},ku={findFiberByHostInstance:Gi,bundleType:0,version:`18.3.1`,rendererPackageName:`react-dom`},Au={bundleType:ku.bundleType,version:ku.version,rendererPackageName:ku.rendererPackageName,rendererConfig:ku.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=pt(e),e===null?null:e.stateNode},findFiberByHostInstance:ku.findFiberByHostInstance||U,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 ju=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!ju.isDisabled&&ju.supportsFiber)try{Et=ju.inject(Au),Dt=ju}catch{}}e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=Ou,e.createPortal=function(e,t){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!Cu(t))throw Error(r(200));return mu(e,t,null,n)},e.createRoot=function(e,t){if(!Cu(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=pu(e,1,!1,null,null,n,!1,i,a),e[Vi]=t.current,hi(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=pt(t),e=e===null?null:e.stateNode,e},e.flushSync=function(e){return Fl(e)},e.hydrate=function(e,t,n){if(!wu(t))throw Error(r(200));return Du(null,e,t,!0,n)},e.hydrateRoot=function(e,t,n){if(!Cu(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=gu(t,null,e,1,n??null,a,!1,o,s),e[Vi]=t.current,hi(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 W(t)},e.render=function(e,t,n){if(!wu(t))throw Error(r(200));return Du(null,e,t,!1,n)},e.unmountComponentAtNode=function(e){if(!wu(e))throw Error(r(40));return e._reactRootContainer?(Fl(function(){Du(null,null,e,!1,function(){e._reactRootContainer=null,e[Vi]=null})}),!0):!1},e.unstable_batchedUpdates=Pl,e.unstable_renderSubtreeIntoContainer=function(e,t,n,i){if(!wu(n))throw Error(r(200));if(e==null||e._reactInternals===void 0)throw Error(r(38));return Du(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 A(e){return typeof e==`number`&&e>=0&&e!==1/0}function ee(e,t){return Math.max(e+(t||0)-Date.now(),0)}function j(e,t){return typeof e==`function`?e(t):e}function te(e,t){let{type:n=`all`,exact:r,fetchStatus:i,predicate:a,queryKey:o,stale:s}=e;if(o){if(r){if(t.queryHash!==N(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 M(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 N(e,t){return(t?.queryKeyHashFn||ne)(e)}function ne(e){return JSON.stringify(e,(e,t)=>oe(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=ae(e)&&ae(t);if(!r&&!(oe(e)&&oe(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 ie(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 ae(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function oe(e){if(!se(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!(!se(r)||!r.hasOwnProperty(`isPrototypeOf`)||t!==Object.prototype)}function se(e){return Object.prototype.toString.call(e)===`[object Object]`}function ce(e){return new Promise(t=>{T.setTimeout(t,e)})}function le(e,t,n){return typeof n.structuralSharing==`function`?n.structuralSharing(e,t):n.structuralSharing===!1?t:F(e,t)}function ue(e,t,n=0){let r=[...e,t];return n&&r.length>n?r.slice(1):r}function de(e,t,n=0){let r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var fe=Symbol();function pe(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===fe?()=>Promise.reject(Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function me(e,t){return typeof e==`function`?e(...t):!!e}function he(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 ge=()=>D,_e=()=>ge(),ve=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(){}},ye=new class extends ve{#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`}},be=E;function xe(){let e=[],t=0,n=e=>{e()},r=e=>{e()},i=be,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 Se=xe(),Ce=new class extends ve{#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 we(e){return Math.min(1e3*2**e,3e4)}function Te(e){return(e??`online`)!==`online`||Ce.isOnline()}var Ee=class extends Error{constructor(e){super(`CancelledError`),this.revert=e?.revert,this.silent=e?.silent}};function De(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 Ee(t);h(n),e.onCancel?.(n)}},u=()=>{t=!0},d=()=>{t=!1},f=()=>ye.isFocused()&&(e.networkMode===`always`||Ce.isOnline())&&e.canRun(),p=()=>Te(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??(_e()?0:3),a=e.retryDelay??we,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),ce(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 Oe=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),A(this.gcTime)&&(this.#e=T.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(_e()?1/0:3e5))}clearGcTimeout(){this.#e!==void 0&&(T.clearTimeout(this.#e),this.#e=void 0)}};function ke(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=>{he(e,()=>t.signal,()=>n=!0)},u=pe(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?de:ue;return{pages:c(e.pages,o,s),pageParams:c(e.pageParams,r,s)}};if(i&&a.length){let e=i===`backward`,t=e?je:Ae,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:Ae(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 Ae(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 je(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}var Me=class extends Oe{#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=Fe(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=Fe(this.options);e.data!==void 0&&(this.setState(Pe(e.data,e.dataUpdatedAt)),this.#t=e)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus===`idle`&&this.#r.remove(this)}setData(e,t){let n=le(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===fe||!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:!ee(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=pe(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`?ke(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=De({initialPromise:t?.initialPromise,fn:a.fetchFn,onCancel:e=>{e instanceof Ee&&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 Ee){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,...Ne(t.data,this.options),fetchMeta:e.meta??null};case`success`:let n={...t,...Pe(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),Se.batch(()=>{this.observers.slice().forEach(e=>{e.onQueryUpdate()}),this.#r.notify({query:this,type:`updated`,action:e})})}};function Ne(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:Te(t.networkMode)?`fetching`:`paused`,...e===void 0&&{error:null,status:`pending`}}}function Pe(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:`success`}}function Fe(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 Ie=class extends ve{#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),Re(this.#t,this.options)?this.#m():this.updateResult(),this.#y())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return ze(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return ze(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&&!ie(this.options,t)&&this.#e.getQueryCache().notify({type:`observerOptionsUpdated`,query:this.#t,observer:this});let r=this.hasListeners();r&&Be(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 ie(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!_e()&&j(this.options.enabled,this.#t)!==!1&&A(e)}#g(){this.#b();let e=j(this.options.staleTime,this.#t);if(this.#r.isStale||!this.#h(e))return;let t=ee(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||ye.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&&Re(e,t),o=i&&Be(e,n,t,r);(a||o)&&(l={...l,...Ne(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=le(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=le(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:Ve(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),ie(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)})})();Se.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 Le(e,t){return j(t.enabled,e)!==!1&&e.state.data===void 0&&(e.state.status!==`error`||j(t.retryOnMount,e)!==!1)}function Re(e,t){return Le(e,t)||e.state.data!==void 0&&ze(e,t,t.refetchOnMount)}function ze(e,t,n){if(j(t.enabled,e)!==!1&&j(t.staleTime,e)!==`static`){let r=j(n,e);return r===`always`||r!==!1&&Ve(e,t)}return!1}function Be(e,t,n,r){return(e!==t||j(r.enabled,e)===!1)&&(!n.suspense||e.state.status!==`error`)&&Ve(e,n)}function Ve(e,t){return j(t.enabled,e)!==!1&&e.isStaleByTime(j(t.staleTime,e))}var He=class extends Oe{#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||Ue(),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=De({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),Se.batch(()=>{this.#t.forEach(t=>{t.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:`updated`,action:e})})}};function Ue(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:`idle`,variables:void 0,submittedAt:0}}var We=class extends ve{#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 He({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=Ge(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=Ge(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=Ge(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=Ge(e);return typeof t==`string`?(this.#t.get(t)?.find(t=>t!==e&&t.state.isPaused))?.continue()??Promise.resolve():Promise.resolve()}clear(){Se.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=>M(t,e))}findAll(e={}){return this.getAll().filter(t=>M(e,t))}notify(e){Se.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return Se.batch(()=>Promise.all(e.map(e=>e.continue().catch(O))))}};function Ge(e){return e.options.scope?.id}function Ke(e,t){let n=new Set(t);return e.filter(e=>!n.has(e))}var I=class extends ve{#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,Se.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||!ie(e,n)});(o||s)&&(o&&(this.#l=t,this.#i=n),this.#t=r,this.hasListeners()&&(o&&(Ke(e,n).forEach(e=>{e.destroy()}),Ke(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 Ie(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)&&Se.batch(()=>{this.listeners.forEach(e=>{e(this.#t)})})}}},qe=class extends ve{#e;constructor(e={}){super(),this.config=e,this.#e=new Map}build(e,t,n){let r=t.queryKey,i=t.queryHash??N(r,t),a=this.get(i);return a||(a=new Me({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(){Se.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=>te(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>te(e,t)):t}notify(e){Se.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){Se.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){Se.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 We,this.#n=e.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=ye.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=Ce.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 Se.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;Se.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let n=this.#e;return Se.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=Se.batch(()=>this.#e.findAll(e).map(e=>e.cancel(n)));return Promise.all(r).then(O).catch(O)}invalidateQueries(e,t={}){return Se.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=Se.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 Ce.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||=N(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===fe&&(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`?me(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||me(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,at=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function ot({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 I(r,s,t)),[l,u,d]=c.getOptimisticResult(s,t.combine),f=!i&&o;_.useSyncExternalStore(_.useCallback(e=>f?c.subscribe(Se.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)?at(n,new Ie(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 st(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(Se.batchCalls(e)):O;return l.updateResult(),t},[l,d]),()=>l.getCurrentResult(),()=>l.getCurrentResult()),_.useEffect(()=>{l.setOptions(o)},[o,l]),it(o,u))throw at(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 ct(e,t){return st(e,Ie,t)}var lt=_.useLayoutEffect;function ut(e){return e[e.length-1]}function dt(e,t){return typeof e==`function`?e(t):e}var ft=Object.prototype.hasOwnProperty;function pt(e){for(let t in e)if(ft.call(e,t))return!0;return!1}var mt=()=>Object.create(null),ht=(e,t)=>gt(e,t,!0);function gt(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&&!(_t(e)&&_t(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&&ut(a)!==`${o-1}`||c&&ut(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`?gt(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`?gt(d,o,n,r):o,i&&=u===d&&(a[l]===f||ft.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?mt():{};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`?gt(d,u,n,r):u),p[f]=o<l?d:u):p[f]=a[o];return p}function _t(e){return!e||typeof e!=`object`?!1:(Object.getPrototypeOf(e)?.constructor??Object)===Object}function vt(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&&!vt(a,o,n,r))return!1}return!0}if(_t(e)&&_t(t)){if(n){for(let i in t)if((r||t[i]!==void 0)&&!vt(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||!vt(e[a],t[a],n,r)))return!1;return i===0}return!1}var yt=/[\x00-\x1f\x7f"<>`{}]/g;function bt(e){return e.replace(yt,e=>`%`+e.charCodeAt(0).toString(16).toUpperCase().padStart(2,`0`))}function xt(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 bt(t)}var St=[`http:`,`https:`,`mailto:`,`tel:`];function Ct(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 wt=/^[\x00-\x20]*[\\/][\t\n\r]*[\\/]/;function Tt(e,t){if(!e)return!1;if(wt.test(e))return!0;let n=Ct(e);return n?!t.has(n):!1}function Et(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+=xt(e.slice(r,i.index))+i[0],r=n.lastIndex;t+=xt(r?e.slice(r):e)}return t}function Dt(e){return/[\s\u0080-\uFFFF]/.test(e)?e.replace(/\s|[^\u0000-\u007F]/gu,encodeURIComponent):e}function Ot(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 kt(){throw Error(`Invariant failed`)}function At(e){return e.replace(/\/{2,}/g,`/`)}function jt(e){return e===`/`?e:e.replace(/^\/+/,``)}function Mt(e){let t=e.length;return t>1&&e[t-1]===`/`?e.replace(/\/+$/,``):e}function Nt(e){return Mt(jt(e))}function Pt(e,t){return e?.endsWith(`/`)&&e!==`/`&&e!==`${t}/`?e.slice(0,-1):e}function Ft(e,t,n=`never`,r){if(t.includes(`//`)&&(t=At(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=At(e)),o=e.split(`/`);o.length>1&&ut(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&&(ut(o)===``?n===`never`&&o.pop():n===`always`&&o.push(``));let s=o.join(`/`),c=(i?At(s):s)||`/`;return a&&r&&r.set(a,c),c}function It(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 Lt(e){return e==null||e===``}function Rt(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 zt(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&&Lt(f)){if(c===`/`&&!d)continue;f=``}o+=c+Rt(s,f,r)+(d||``)}}return o+a||`/`}function Bt(e={}){if(e.isNotFound=!0,e.throw)throw e;return e}function Vt(e){return e?.isNotFound===!0}function Ht(){try{return sessionStorage}catch{return}}var Ut=`tsr-scroll-restoration-v1_3`,Wt=Ht();function Gt(){try{return JSON.parse(Wt?.getItem(`tsr-scroll-restoration-v1_3`)||`{}`)}catch{return{}}}function Kt(){try{Wt?.setItem(Ut,JSON.stringify(qt))}catch{}}var qt=Gt(),Jt=`data-scroll-restoration-id`,Yt=e=>e.state.__TSR_key||e.href;function Xt(e){let t=e.getAttribute(Jt);if(t)return`[${Jt}="${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 Zt=!1,Qt=`window`;function $t(e){try{return typeof e==`function`?e():document.querySelector(e)}catch{}}function en(e){let t=new Set;for(let n of e){if(n===Qt)continue;let e=$t(n);e&&t.add(e)}return t}function tn(e,t){let n=t??e.options.scrollRestoration,r=e._scroll;n&&(r.restoring=!0);let i=e.options.getScrollRestorationKey||Yt,a=new Set,o=e=>{let t=qt[e]||={};for(let e of a)e===document?t[Qt]={scrollX,scrollY}:e.isConnected&&(t[Xt(e)]={scrollX:e.scrollLeft,scrollY:e.scrollTop})};n&&!r.restoration&&(r.restoration=!0,Zt=!1,history.scrollRestoration=`manual`,document.addEventListener(`scroll`,e=>{Zt||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())),Kt()})),!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=qt[d];if(e){let t=qt[u];for(let n in e){if(n===Qt){if(s)continue}else{let e=$t(n);if(!e||s&&o&&(l??=en(o),l.has(e)))continue}t||=qt[u]={},t[n]??=e[n]}}}Zt=!0;try{let e=t.toLocation.hash,i=t.toLocation.state.__hashScrollIntoViewOptions??!0,a=!1;if(s){!e&&o&&(l??=en(o));let t=e&&i&&c,s=r.restoring?qt[u]:void 0;if(s)for(let e in s){let{scrollX:r,scrollY:i}=s[e];if(e===Qt){if(t)continue;scrollTo({top:i,left:r,behavior:n}),a=!0}else{let t=$t(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{Zt=!1}}))}function nn(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 rn(e){return e?e===`false`?!1:e===`true`?!0:e*0==0&&+e+``===e?+e:e:``}function an(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]=rn(r):Array.isArray(t)?t.push(rn(r)):n[e]=[t,rn(r)]}return n}var on=/^(?:\s|["[{\d-]|fa|nu|tr)/,sn=ln(JSON.parse),cn=un(JSON.stringify,JSON.parse);function ln(e){let t=e===JSON.parse;return n=>{n[0]===`?`&&(n=n.substring(1));let r=an(n);for(let n in r){let i=r[n];if(typeof i==`string`){if(t&&!on.test(i))continue;try{r[n]=e(i)}catch{}}}return r}}function un(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&&!on.test(r))return r;try{return t(r),e(r)}catch{}}return r}return e=>{let t=nn(e,r);return t?`?${t}`:``}}var dn=`__root__`;function fn(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 pn(e){return e instanceof Response&&!!e.options}function mn(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 hn=4,gn=5;function _n(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 vn(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 yn(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=ut(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=vn(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=xn(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=xn(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=xn(r,gn);(r.pathless??=[]).push(e),r=e}let g=(t.path||!t.children)&&!t.isRoot;if(g&&u<l){let e=xn(r,hn);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 bn(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 xn(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 Sn(e,t){let n=xn(),r=[];function i(e,t,n,a){let[o,s,c]=yn(!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(bn);t.masksTree=n,t.flatCache=mn(1e3)}function Cn(e,t){e||=`/`;let n=t.flatCache.get(e);if(n!==void 0)return n;let r=Dn(e,t.masksTree);return t.flatCache.set(e,r),r}function wn(e,t,n,r,i){e||=`/`,r||=`/`;let a=t?`case\0${e}`:e,o=i.singleCache.get(a);return o||(o=xn(),yn(t,{from:e},1,o),i.singleCache.set(a,o)),Dn(r,o,n)}function Tn(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=Dn(e,t.segmentTree,n)}catch(e){if(e instanceof URIError)a=null;else throw e}return a&&(a.branch=kn(a.route)),t.matchCache.set(r,a),a}function En(e,t=!1){let n=xn(),r=[],i={},a={},o=0;function s(e,n,c,l){if(e.init(o),e.id in i&&kt(),i[e.id]=e,o!==0&&e.path){let t=Mt(e.fullPath);(!a[t]||e.fullPath.endsWith(`/`))&&(a[t]=e)}o++;let[u,d,f]=yn(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(bn);return{processedTree:{segmentTree:n,singleCache:mn(1e3),matchCache:mn(1e3),flatCache:null,masksTree:null},routesById:i,routesByPath:a}}function Dn(e,t,n=!1){let r=e.split(`/`),i=jn(e,r,t,n);if(!i)return null;let[a]=On(e,r,i);return{route:i.node.route,rawParams:a}}function On(e,t,n){let r=An(n.node),i=n.node.data&&_n(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===hn)break;if(u.kind===gn){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 kn(e){let t=[e];for(;e.parentRoute;)e=e.parentRoute,t.push(e);return t.reverse(),t}function An(e){let t=Array(e.depth+1);do t[e.depth]=e,e=e.parent;while(e);return t}function jn(e,t,n,r){if(e===`/`&&n.index)return{node:n.index,skipped:0};let i=!ut(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&&!Fn(l,n))continue;if(i.parse){if(!Pn(e,t,n))continue;g=n.rawParams,h=n.extract}r&&i.route&&i.kind!==hn&&Fn(c,n)&&(c=n);let _=u===o;if(_&&(i.route&&(!a||i.kind===hn||i.kind===2)&&Fn(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&&(Pn(e,t,n)||(r=!1)),r){if(!p&&!m&&!d&&Nn(f,o))return n;Fn(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+Mn(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+Mn(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+Mn(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+Mn(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 Mn(e,t){return 2**(e-t-1)}function Nn(e,t){return e===2**(t-1)-1}function Pn(e,t,n){let r,i;try{[r,i]=On(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 Fn(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===hn)>(e.node.kind===hn)||t.node.kind===hn==(e.node.kind===hn)&&t.node.depth>e.node.depth)))}function In(e,t,n){let r=Nt(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=At(`/${r}${e.pathname}`),e)};return n?{input:({url:e})=>Ln(n,s.input({url:e})),output:({url:e})=>s.output({url:Rn(n,e)})}:s}function Ln(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 Rn(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 zn(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(()=>{Ot(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 Bn=`__TSR_index`,Vn=`popstate`,Hn=`beforeunload`,Un=/^[\x00-\x20]*(?:[\\/][\t\n\r]*){2,}/;function Wn(e){let t=Un.exec(e);return t?`/`+e.slice(t[0].length):e}function Gn(e){return/[\x00-\x1f\x7f]/.test(e)&&(e=e.replace(/[\x00-\x1f\x7f]/g,e=>`
|
|
10
|
+
\r`.includes(e)?``:encodeURIComponent(e))),Wn(e)}function Kn(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=Yn(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[Bn];i=qn(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[Bn];i=qn(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[Bn]!==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 qn(e,t){let n=Xn();return{...t,key:n,__TSR_key:n,[Bn]:e}}function Jn(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=>Gn(e?.createHref?e.createHref(t):t),c=e?.parseLocation??(()=>Yn(`${t.location.pathname}${t.location.search}${t.location.hash}`,t.history.state));if(!t.history.state?.__TSR_key&&!t.history.state?.key){let e=Xn();t.history.replaceState({[Bn]: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=Yn(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[Bn]-l.state[Bn],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=Kn({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(Hn,x,{capture:!0}),t.removeEventListener(Vn,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(Hn,x,{capture:!0}),t.addEventListener(Vn,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 Yn(e,t){let n=Gn(e),r=n.indexOf(`#`),i=n.indexOf(`?`);if(!t){let e=Xn();t={[Bn]: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 Xn(){return(Math.random()+1).toString(36).substring(7)}function Zn(e,t){return e.protocol!==`http:`&&e.protocol!==`https:`||e.origin!==t||!!e.username||!!e.password}function Qn(e){return e.pathname+e.search+e.hash}function $n(e){return e.options.loader||e.options.beforeLoad||e.lazyFn||e.options.component?.preload||e.options.pendingComponent?.preload}function er(e,t){return{fromLocation:t,toLocation:e,pathChanged:t?.pathname!==e.pathname,hrefChanged:t?.href!==e.href,hashChanged:t?.hash!==e.hash}}function tr({key:e,__TSR_key:t,__TSR_index:n,__hashScrollIntoViewOptions:r,...i}){return i}function nr(e){return e.findIndex(e=>e.status===`error`||e.status===`notFound`||e._notFound)+1}function rr(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 ir=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:Jn()),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!==`/`&&Nt(n)?In(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=zn(this.latestLocation,e),tn(this)}},this.updateLatestLocation=()=>{this.latestLocation=this.parseLocation(this.history.location,this.latestLocation)},this.buildRouteTree=()=>{let e=En(this.routeTree,this.options.caseSensitive);return this.options.routeMasks&&Sn(this.options.routeMasks,e.processedTree),{...e,resolvePathCache:mn(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:Et(e),external:!1,searchStr:o,search:ht(t?.search,i),hash:Et(r.slice(1)),state:gt(t?.state,a)}}let o=Ln(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:Et(Wn(o.pathname)),external:!!this.rewrite&&Zn(o,this.origin),searchStr:c,search:ht(t?.search,s),hash:Et(o.hash.slice(1)),state:gt(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=Tn(Mt(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=Yn(n.href,{});n={...n,to:Ln(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=Ft(s[0]===`/`?``:n.unsafeRelative===`path`?a().pathname:n.from??o()[1],s,this.options.trailingSlash,this.resolvePathCache),l=this.routesByPath[Mt(c)],u=c.includes(`$`),d;if(l)d=l._branch??=kn(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??yn(!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??=lr(n.params,e),!pt(p))break;p===e&&(p=Object.assign(mt(),p));try{Object.assign(p,t(p))}catch{}}}p??=lr(n.params,ur(n.params,f)?o()[3]:dr);let m=e.leaveParams?c:Wn(Et(f?zt(c,f,p,this.pathParamsDecoder):c)),h=fr(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,cr(n.options.validateSearch,{...e,...t}))}catch{}}),t=e}return t},_=h.length?pr(h,g(),n):n.search===!0?g():typeof n.search==`function`?n.search(g()):n.search||dr,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:dr,S=`${m}${v}${b}`,C,w,T=!1;if(this.rewrite){let e=new URL(S,this.origin),t=e.origin,n=Rn(this.rewrite,e);C=Qn(e),Zn(n,t)?(w=n.href,T=!0):w=Wn(Qn(n))}else C=Dt(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=Cn(r.pathname,this.processedTree);if(t){let i=Object.assign(mt(),t.rawParams),{from:a,params:o,...s}=t.route,c=lr(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 ar(this,r.publicHref,{replace:n.replace,ignoreBlocker:t});let i,a=Mt(this.latestLocation.href)===Mt(n.href)&&vt(tr(n.state),tr(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?Ct(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 ar(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 ai(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(er(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`)&&$n(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(wt.test(n)||(r=Ct(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:Zn(e,this.origin)||(n=Qn(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=vr,this.preloadRoute=e=>oi(this,e),this.matchRoute=(e,t)=>{let n={...e,to:e.to?Ft(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=wn(r.pathname,t?.caseSensitive??!1,t?.fuzzy??!1,a.pathname,this.processedTree);return!o||e.params&&!vt(o.rawParams,e.params,!0)?!1:t?.includeSearch??!0?vt(a.search,r.search,!0)?o.rawParams:!1:o.rawParams},this.getStoreConfig=t,e.pathParamsAllowedCharacters?.length&&(this.pathParamsDecoder=It(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??cn,parseSearch:e.parseSearch??sn,protocolAllowlist:e.protocolAllowlist??St}),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=yn(!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[`**`]:Mt(e.pathname))&&(this.options.notFoundRoute?a=[...a,this.options.notFoundRoute]:o=!0);let s=o?mr(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=cr(i.options.validateSearch,{...n})??void 0;l={...n,...e},f={...r,...e}}catch(e){let r=e;if(e instanceof or||(r=new or(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=mt(),_=i._interpolation?zt(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{hr(i,d)}catch(e){if(x=Vt(e)||pn(e)?e:new sr(e.message,{cause:e}),t?.throwOnError)throw x}let S=y?`stay`:`enter`,C;if(b)C={...b,cause:S,search:ht(y?y.search:b.search,l),_strictSearch:f,searchError:p};else{let e=$n(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?ht(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?gt(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`?ht(n.params,d):d,t?._controller&&(n.context={})}return c}matchRoutesLightweight(e){let t=ut(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=ut(a),c={...e.search};for(let e of a)try{Object.assign(c,cr(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{hr(t,e)}catch{}u=e}let d=[a,s.fullPath,c,u];return this.lightweightCache.set(e,[r,d]),d}};async function ar(e,t,{replace:n,ignoreBlocker:r}){if(!Tt(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 or=class extends Error{},sr=class extends Error{};function cr(e,t){if(e==null)return{};if(`~standard`in e){let n=e[`~standard`].validate(t);if(n instanceof Promise)throw new or(`Async validation not supported`);if(n.issues)throw new or(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 lr(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 ur(e,t){return typeof e==`function`?!0:!t||e===!1||e===null?!1:e===void 0||e===!0||t.some(t=>typeof t!=`string`&&!ft.call(e,t[1]))}var dr=Object.freeze({});function fr(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=cr(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 pr(e,t,n){let r=(t,i,a)=>{if(t>=e.length){if(!n.search)return{};if(n.search===!0)return i;let e=dt(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 mr(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 dn}function hr(e,t){let n=e.options.params?.parse??e.options.parseParams;n&&Object.assign(t,n(t))}function gr(e,t){return e.options[t]?.preload?.()}function _r(e,t){let n=gr(e,`component`),r=gr(e,`pendingComponent`);return t&&(r?r=r.then(t):t()),n&&r?Promise.all([n,r]).then(()=>{}):n??r}function vr(e,t,n){let r=()=>t===!1?void 0:t?gr(e,t):_r(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 yr(e){let t=e.findIndex(e=>e.status!==`success`||e._notFound)+1;return t&&t<e.length?e.slice(0,t):e}var br=0,xr=1,Sr=2,Cr=3,wr=[4];function Tr(e){return typeof e[0]==`number`}function Er(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 Dr(e,t){return e.routesById[t.routeId]}function Or(e,t,n){return pn(e)?[Cr,e]:Vt(e)?(e.routeId||=n,[Sr,e]):t?(typeof e?.then==`function`&&(e=Error(`A Promise was thrown`,{cause:e})),[xr,e]):[br,e]}function kr(e,t){let n=Or(t,!0,e.id);if(n[0]!==xr)return n;try{e.options.onError?.(n[1])}catch(t){n=Or(t,!0,e.id)}return n}function Ar(e,t,n,r,i){return i[0].signal.aborted?wr:Kr(e,t,n,kr(n,r),i)}async function jr(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=Dr(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 Nr(e,r),[i,Ar(e,t,u,a,n)]}if(c.aborted)return[i,wr];let p=r.paramsError??r.searchError;if(p!==void 0)return Nr(e,r),[i,Ar(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{Ir(e,r,`beforeLoad`,n[0]);let a=m({...f,search:r.search,context:r.context,...e.options.additionalContext}),o=await(typeof a?.then==`function`?Er(a,c):a);if(c.aborted)return[i,wr];let s=Kr(e,t,u,Or(o,!1,u.id),n);if(s[0]!==br)return Nr(e,r),[i,s];r.context={...r.context,...o}}catch(a){return Nr(e,r),[i,Ar(e,t,u,a,n)]}finally{r.status=h,Ir(e,r,!1,n[0])}}i()}function Mr(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 Nr(e,t){let n=t._flight;t._flight=void 0,Mr(e,t,n)?.abort()}function Pr(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=Mr(e,a,t);n&&i.push(n)}}for(let e of i)e.abort()}function Fr(e){for(let t of e){let e=t._flight;e&&e[2]++}}function Ir(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 Lr(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 Rr(e,t,n,r,i,a,o){let s=o[0],c=s.signal;if(c.aborted)return wr;if(!i)return[br,void 0];let l=n._flight;Ir(e,n,`loader`,s);try{if(!l){let s=new AbortController;l=[Promise.resolve().then(()=>i(Lr(e,t,n,r,s,a,!!o[3]))).then(e=>Or(e,!1,r.id),e=>Or(e,!0,r.id)).then(t=>(t[0]!==br&&e._flights?.get(n.id)===l&&(e._flights.delete(n.id),l[2]||s.abort()),t[0]===xr&&l[2]?kr(r,t[1]):t)),s,1],(e._flights??=new Map).set(n.id,l)}return n._flight=l,n.abortController=l[1],Kr(e,t,r,await Er(l[0],c),o)}catch(t){if(t!==c||!c.aborted)throw t;return Nr(e,n),wr}finally{Ir(e,n,!1,s)}}function zr(e,t,n){t[0]!==Cr&&(e.status=`success`,e.error=void 0,t[0]===br?(e.loaderData=t[1],e.invalid=!1,e.updatedAt=Date.now(),e.preload=n):e.invalid=!0)}function Br(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&&Nr(e,r)}function Vr(e,t){return t[0]===xr||t[0]===Sr?{...e,status:t[0]===xr?`error`:`notFound`,error:t[1],_flight:void 0}:e}function Hr(e,t,n,r,i,a,o){let s=t[1][n],c=Dr(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(Lr(e,t,s,c,a[0],i,l))),a[0].signal.aborted&&(p=wr)),!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,Nr(e,s),p=Ar(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,Mr(e,s,t)?.abort(),n>=o&&(s.status=`pending`),S?.()}b||(s.isFetching=!1);let w=!p&&x?Rr(e,t,s,c,g,i,a).then(t=>(zr(s,t,l),t[0]===br&&(m&&!a[0].signal.aborted&&Br(e,s,u),n>=o&&(s.status=`pending`)),t)):Promise.resolve(p??[br,s.loaderData]),T=(async()=>{try{let e=vr(c,void 0,C);e&&await Er(e,a[0].signal)}catch(r){if(!t[1].some((e,t)=>t<=n&&(e.status===`error`||e.status===`notFound`||e._notFound)))return[n,Ar(e,t,c,r,a)]}let r=await w;x&&r[0]===br&&s.status===`pending`&&!a[0].signal.aborted&&(s.status=`success`,S?.())})();if(r.push([n,w,T]),!y)return w.then(e=>Vr(s,e));let E={...s,status:`pending`,preload:!1,_flight:v};s.invalid=!1,s.isFetching=`loader`;let D=Rr(e,t,E,c,g,i,a).then(e=>(s.isFetching=!1,zr(E,e,!1),e));return(t[2]??=[]).push([n,D,T,E]),D.then(e=>Vr(E,e))}async function Ur(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=Dr(e,t[n]);try{let e=vr(i,!1);e&&await Er(e,r)}catch(e){if(e===r&&r.aborted)throw e}if(i.options.notFoundComponent)return n}return a?.routeId?o:i}function Wr(e,t){t[2]&&=(Pr(e,t[2].map(e=>e[3])),void 0)}async function Gr(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]>=Cr)throw[a,t];!i&&t[0]!==br&&(i=[a,t],await Promise.all((n??[]).map(e=>{if(!(e[0]<=a))return e[1].then(t=>{if(t[0]===Cr)throw[e[0],t]})})))}})))}catch(e){return e}return t??i}function Kr(e,t,n,r,i,a){for(;r[0]===Cr;){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]?[Cr,t]:[Cr,t,a]}return[Cr,o,n]}catch(e){r=a?[xr,e]:kr(n,e),a=!0}}return r}async function qr(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]===Sr?Ur(e,o,t,r.signal):t[0],d=l<0?o.length:l;if((s?.[1][0]??0)>=Cr)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]!==br&&t[0]<Cr&&!(`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)>=Cr){let n=s[1];if(n[0]!==Cr||n[1].options.reloadDocument||n[2])return Wr(e,t),n;c=!0,s=[0,[xr,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===xr?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=Dr(e,u);try{await Er(i?Promise.resolve().then(()=>vr(m,l===xr?`errorComponent`:`notFoundComponent`)):Promise.all([vr(m),vr(m,`notFoundComponent`)]),r.signal)}catch(n){if(n===r.signal&&r.signal.aborted)return Wr(e,t),wr}i?c&&(r.abort(),await Promise.all([...n.map(e=>e[1]),...n.map(e=>e[2]),...(t[2]??[]).map(e=>e[1])]),Wr(e,t),Pr(e,o),p()):u.status=`success`}return t}async function Jr(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=Dr(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 Er(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 Yr(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 Ur(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=Hr(e,i,t,u,f,r,l)},m=await jr(e,i,r,c,p,l);if(m){if(r[4]=!0,c=m[0],m[1][0]===Sr){let t=await Ur(e,n,m,a);m[2]=t,c=Math.min(c,t+1)}else m[1][0]>=Cr&&(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=qr(e,i,u,r[0],Gr(u,m,i[2]),r[7]);i[2]?.length&&(i[3]=Gr(i[2],void 0,void 0,h.then(e=>Tr(e)?0:yr(n).length,()=>0))),o=await h}catch(t){if(Wr(e,i),t===a&&a.aborted)return wr;throw t}return Tr(o)?o:Jr(e,o,a,r[6]===n.length?r[6]:0)}function Xr(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=Dr(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(()=>Xr(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 Zr(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 Qr(e,t){let n=e._pending;if(!n)return;clearTimeout(n[3]);let r=n[2]-Date.now();if(!n[4]||r<=0||!yr(t[3]).some(e=>e.id===n[1]))return;let i;try{await Er(new Promise(e=>{i=setTimeout(e,r)}),t[0].signal)}catch{}clearTimeout(i)}function $r(e,t){e._committed=t,e.stores.setMatches(t)}function ei(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=yr(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=Dr(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=nr(n);$r(e,n),Pr(e,[...o.values(),...i].filter(e=>e._flight&&c.get(e.id)!==e),n),rr(e,i,n,a,l,t)}async function ti(e,t){let n=e._tx;for(;n&&n!==t;)t=n,await n[5],n=e._tx}function ni(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 ri(e,t,n,r,i){let a=n.map(e=>({...e}));Fr(a);for(let t of r)Nr(e,a[t[0]]),a[t[0]]=t[3];let o=[t[2],a],s;try{s=await qr(e,o,r,t[0],i)}catch(t){throw Pr(e,a),t}if(Tr(s)){Pr(e,a),s[0]===Cr&&e._tx===t&&e._committed===n&&await ni(e,t,s);return}if(await Jr(e,s,t[0].signal),e._tx!==t||e._committed!==n){Pr(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),Nr(e,n))}$r(e,a),Pr(e,n,a)}async function ii(e,t,n,r,i,a){let o=await Yr(e,t[2],t[3],[t[0],t[1],e._committed,void 0,i,n,a,r]);if(Tr(o)){let n=o[0]===Cr&&e._tx===t;if((!n||o[1].options.reloadDocument)&&Zr(e,t),Pr(e,t[3]),t[3]=[],!n)return;if(e._tx!==t){Zr(e,t);return}await ni(e,t,o);return}let s=o[1];if(e._tx===t&&await Qr(e,t),e._tx!==t){Zr(e,t),Pr(e,s),Wr(e,o);return}let c=t[2],l=er(c,e.stores.resolvedLocation.get()),u=o[2];await e.startViewTransition(async()=>{if(e._tx===t&&await Qr(e,t),e._tx!==t){Zr(e,t),Pr(e,s),Wr(e,o);return}let n=await e.startTransition(()=>{Zr(e,t),ei(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){Wr(e,o);return}u?.length&&ri(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 ai(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=er(a,r);e.emit({type:`onBeforeNavigate`,...t}),u.signal.aborted||e.emit({type:`onBeforeLoad`,...t})}if(u.signal.aborted){await ti(e,n);return}let f=i.href===a.href,p=u,m=e.matchRoutes(a,{_controller:u});Fr(m);let h=l?c[1](m):void 0;if(h?p=l:l?.abort(),u.signal.aborted){Pr(e,m),await ti(e,n);return}e._preflight=void 0;let g,_=()=>ii(e,y,f,()=>Xr(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(()=>ti(e,y))];if(e._tx=y,n){for(let t of e.stores.matches.get()){if(e._tx!==y)break;t.isFetching&&Ir(e,t,!1)}n[0].abort(),Pr(e,n[3],y[3],!0)}if(e._tx!==y){Pr(e,y[3]),y[3]=[],g?.(),await ti(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))&&Xr(e,y),g?.(_()),await y[5]}async function oi(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}),Fr(a),o=(e._preloads??=new Map).set(i,a),s=await Yr(e,n,a,[i,t,r,!0])}finally{o&&(o=o.delete(i),Pr(e,a)),i.abort()}if(!Tr(s))return s[1];if(!o||s.length<3)return;n=s[2]}catch(e){Vt(e)||console.error(e);return}}}var si=`Error preloading route! ☝️`,ci=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=dn:this.parentRoute||kt();let r=n?dn:t?.path;r&&r!==`/`&&(r=jt(r));let i=t?.id||r,a=n?dn:At((this.parentRoute.id===`__root__`?``:this.parentRoute.id)+`/`+(i??``));r===`__root__`&&(r=`/`);let o=a===`__root__`?`/`:r===void 0?this.parentRoute.fullPath:At(this.parentRoute.fullPath+`/`+r);this._path=r,this._id=a,this._fullPath=o,this._to=Mt(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=>fn({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.`)}},li=class extends ci{constructor(e){super(e)}},ui=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??di,{error:e[0],reset:this.reset}):this.props.children}};function di({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 fi=()=>!0,pi=()=>!1;function mi({children:e,fallback:t=null}){return(0,b.jsx)(_.Fragment,{children:hi()?e:t})}function hi(){return _.useSyncExternalStore(gi,fi,pi)}function gi(){return()=>{}}var _i=_.createContext(null);function vi(e){return _.useContext(_i)}var yi=_.createContext(void 0),bi=_.createContext(void 0);function xi({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 Si(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 Ci=[],wi=0,{link:Ti,unlink:Ei,propagate:Di,checkDirty:Oi,shallowPropagate:ki}=xi({update(e){return e._update()},notify(e){Ci[ji++]=e,e.flags&=-3},unwatched(e){e.depsTail!==void 0&&(e.depsTail=void 0,e.flags=17,Fi(e))}}),Ai=0,ji=0,Mi,Ni=0;function Pi(e){try{++Ni,e()}finally{--Ni||Ii()}}function Fi(e){let t=e.depsTail,n=t===void 0?e.deps:t.nextDep;for(;n!==void 0;)n=Ei(n,e)}function Ii(){if(!(Ni>0)){for(;Ai<ji;){let e=Ci[Ai];Ci[Ai++]=void 0,e.notify()}Ai=0,ji=0}}function Li(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 Mi!==void 0&&Ti(i,Mi,wi),i._snapshot},subscribe(e){let t=Si(e),n={current:!1},r=Ri(()=>{i.get(),n.current?t.next?.(i._snapshot):n.current=!0});return{unsubscribe:()=>{r.stop()}}},_update(e){let a=Mi,o=t?.compare??Object.is;if(n)Mi=i,++wi,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{Mi=a,n&&(i.flags&=-5),Fi(i)}}};return n?(i.flags=17,i.get=function(){let e=i.flags;if(e&16||e&32&&Oi(i.deps,i)){if(i._update()){let e=i.subs;e!==void 0&&ki(e)}}else e&32&&(i.flags=e&-33);return Mi!==void 0&&Ti(i,Mi,wi),i._snapshot}):i.set=function(e){if(i._update(e)){let e=i.subs;e!==void 0&&(Di(e),ki(e),Ii())}},i}function Ri(e){let t=()=>{let t=Mi;Mi=n,++wi,n.depsTail=void 0,n.flags=6;try{return e()}finally{Mi=t,n.flags&=-5,Fi(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&&Oi(this.deps,this)?t():this.flags=2},stop(){this.flags=0,this.depsTail=void 0,Fi(this)}};return t(),n}var zi=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})),Bi=o(((e,t)=>{t.exports=zi()})),Vi=o((e=>{var t=d(),n=Bi();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}})),Hi=o(((e,t)=>{t.exports=Vi()}))();function Ui(e,t){return e===t}function Wi(e,t=e=>e,n){let r=n?.compare??Ui,i=(0,_.useCallback)(t=>{let{unsubscribe:n}=e.subscribe(t);return n},[e]),a=(0,_.useCallback)(()=>e.get(),[e]);return(0,Hi.useSyncExternalStoreWithSelector)(i,a,a,t,r)}var Gi={};function Ki(e,t){let n=_.useRef();return r=>{let i=e?.select?e.select(r):r;return e?.structuralSharing??t.options.defaultStructuralSharing?n.current=gt(n.current,i):i}}function qi(e){let t=vi(),n=_.useContext(e.from?bi:yi),r=e.from??n,i=t.stores.getMatchStore(r),a=Ki(e,t),o=Wi(i,e=>e?a(e):Gi);if(o!==Gi)return o;(e.shouldThrow??!0)&&kt()}function Ji(e){return qi({from:e.from,strict:e.strict,structuralSharing:e.structuralSharing,select:t=>e.select?e.select(t.loaderData):t.loaderData})}function Yi(e){let{select:t,...n}=e;return qi({...n,select:e=>t?t(e.loaderDeps):e.loaderDeps})}function Xi(e){return qi({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 Zi(e){return qi({from:e.from,strict:e.strict,shouldThrow:e.shouldThrow,structuralSharing:e.structuralSharing,select:t=>e.select?e.select(t.search):t.search})}function Qi(e){let t=vi();return _.useCallback(n=>t.navigate({...n,from:n.from??e?.from}),[e?.from,t])}function $i(e){return qi({...e,select:t=>e.select?e.select(t.context):t.context})}function ea(...e){let t=_.useRef(e),n=t.current;return e.forEach((e,t)=>{vt(n[t],e,!1,!0)||(n[t]=e)}),t.current}function ta(e,t){e.preloadRoute(t).catch(e=>{console.warn(e),console.warn(si)})}var na={compare:(e,t)=>e[0]===t[0]&&e[1]===t[1]};function ra(e,t){let n=typeof e==`string`&&Ct(e);if(n)return t.has(n)?e:null}function ia(e,t,n,r,i){let a=Pt(e.pathname,r),o=Pt(t.pathname,r);return(n?.exact?a!==o:!a.startsWith(o)||a.length!==o.length&&a[o.length]!==`/`)||(n?.includeSearch??!0)&&!vt(e.search,t.search,!n?.exact,n?.explicitUndefined)?!1:!n?.includeHash||i&&e.hash===t.hash}function aa(e,t,n){let r=vi(),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=hi(),[E,D,O]=ea(e.search,e.params,o),[k,A]=_.useMemo(()=>[e,{...e}],[r,e.from,e._fromLocation,e.hash,e.to,E,D,e.state,e.mask,e.unsafeRelative]),ee=_.useCallback(e=>{let t=ra(s,r.protocolAllowlist);if(t!==void 0)return[t??void 0];k._fromLocation||(A._fromLocation=e);let n=r.buildLocation(A),i=ma(n,r,g);return[i,!g&&(!i||Ct(i))?void 0:ia(e,n,O,r.basepath,T)]},[O,g,T,k,A,r,s]),[j,te]=Wi(r.stores.location,ee,na),M=te===void 0?j:void 0,N=g||j===void 0,ne=_.useRef(!1),P=e.reloadDocument||M||N?!1:c??r.options.defaultPreload,re=l??r.options.defaultPreloadDelay??0,F=_.useCallback(e=>{let t=e?.isIntersecting;if(!(t??P===`intent`)){t===!1&&fa(i);return}if(!re){ta(r,k);return}da.has(i)||da.set(i,setTimeout(()=>{da.delete(i),ta(r,k)},re))},[r,k,i,P,re]);_.useEffect(()=>{P===`render`&&!ne.current&&(ne.current=!0,ta(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(),fa(i)}},[r,k,P,F,i]);let ie=la(e,n);if(ie.ref=t?a:i,M)return ie.href=M,ie;let ae=e=>{let t=v??e.currentTarget.getAttribute(`target`);!N&&!(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}))},oe=()=>{P===`intent`&&ta(r,k)},se=()=>{P===`intent`&&fa(i)};return ie.onClick=pa(y,ae),ie.onBlur=pa(b,se),ie.onFocus=pa(x,F),ie.onMouseEnter=pa(S,F),ie.onMouseLeave=pa(C,se),ie.onTouchStart=pa(w,oe),ua(ie,e,te,j,N,n)}var oa={},sa={className:`active`},ca=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 la(e,t){let n={};for(let r in e)ca.has(r)||r===`type`&&t!==void 0||r===`disabled`&&t===`a`||(n[r]=e[r]);return n}function ua(e,t,n,r,i,a){let{activeProps:o,inactiveProps:s,className:c,style:l,target:u}=t,d=dt(n?o:s,{})??(n?sa:oa);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 da=new WeakMap,fa=e=>{clearTimeout(da.get(e)),da.delete(e)},pa=(e,t)=>e?n=>n.defaultPrevented||(e(n),n.defaultPrevented||t(n)):t;function ma(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||!Tt(i,t.protocolAllowlist))return i}var ha=_.memo(_.forwardRef((e,t)=>{let n=e._asChild||`a`,r=aa(e,t,n),i=typeof e.children==`function`?e.children({isActive:r[`data-status`]===`active`}):e.children;return _.createElement(n,r,i)}),ga);function ga(e,t){let n=0;for(let r in t)if(n++,e[r]!==t[r]&&(!ca.has(r)||!vt(e[r],t[r],!1,!0)))return!1;for(let t in e)n--;return n===0}var _a=class extends ci{constructor(e){super(e),this.useMatch=e=>qi({...e,from:this.id}),this.useRouteContext=e=>$i({...e,from:this.id}),this.useSearch=e=>Zi({...e,from:this.id}),this.useParams=e=>Xi({...e,from:this.id}),this.useLoaderDeps=e=>Yi({...e,from:this.id}),this.useLoaderData=e=>Ji({...e,from:this.id}),this.useNavigate=()=>Qi({from:this.fullPath}),this.Link=_.forwardRef((e,t)=>(0,b.jsx)(ha,{ref:t,from:this.fullPath,...e}))}};function va(e){return new _a(e)}var ya=class extends li{constructor(e){super(e),this.useMatch=e=>qi({...e,from:this.id}),this.useRouteContext=e=>$i({...e,from:this.id}),this.useSearch=e=>Zi({...e,from:this.id}),this.useParams=e=>Xi({...e,from:this.id}),this.useLoaderDeps=e=>Yi({...e,from:this.id}),this.useLoaderData=e=>Ji({...e,from:this.id}),this.useNavigate=()=>Qi({from:this.fullPath}),this.Link=_.forwardRef((e,t)=>(0,b.jsx)(ha,{ref:t,from:this.fullPath,...e}))}};function ba(e){return new ya(e)}function xa(e){let t=vi(),n=`not-found-${Wi(t.stores.location,e=>e.pathname)}-${Wi(t.stores.status)}`;return(0,b.jsx)(ui,{getResetKey:()=>n,onCatch:(t,n)=>{if(Vt(t))e.onCatch?.(t,n);else throw t},errorComponent:({error:t})=>{if(Vt(t))return e.fallback?.(t);throw t},children:e.children})}function Sa(){return(0,b.jsx)(`p`,{children:`Not Found`})}function Ca(e){return(0,b.jsx)(b.Fragment,{children:e.children})}function wa(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)(Sa,{})}function Ta(e,t){let n=t?.options.pendingComponent??e.options.defaultPendingComponent;return n?(0,b.jsx)(n,{}):null}var Ea=(e,t)=>e[0]===t[0]&&e[1]===t[1],Da=(e,t,n)=>!t.isRoot||t.options.shellComponent||t.options.wrapInSuspense||n===!1||n===`data-only`||!e.ssr,Oa=_.memo(function({routeId:e}){let t=vi();return(0,b.jsx)(ka,{router:t,match:Wi(t.stores.getMatchStore(e))})});function ka({router:e,match:t}){let n=e.routesById[t.routeId],r=Ta(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=Da(e,n,t.ssr)&&(n.options.wrapInSuspense??r??(n.options.errorComponent?.preload||s))?_.Suspense:Ca,l=i?ui:Ca,u=o?xa:Ca;return(0,b.jsxs)(n.isRoot?n.options.shellComponent??Ca:Ca,{children:[(0,b.jsx)(yi.Provider,{value:t.routeId,children:(0,b.jsx)(c,{fallback:r,children:(0,b.jsx)(l,{getResetKey:()=>t,errorComponent:i,onCatch:(e,n)=>{if(Vt(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)(mi,{fallback:r,children:(0,b.jsx)(Aa,{match:t})}):(0,b.jsx)(Aa,{match:t})})})})}),null]})}var Aa=_.memo(function({match:e}){let t=vi(),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)(ja,{})},[i,r.options.component,t.options.defaultComponent]);if(e.status===`pending`){if(t.ssr&&!Da(t,r,e.ssr))return a;if(t._tx)throw t._tx[5];return Ta(t,r)}if(e.status===`notFound`)return wa(t,r,e.error);if(e.status===`error`)throw e.error;return a}),ja=_.memo(function(){let e=vi(),t=_.useContext(yi),n,r,i;{let a=e.stores.getMatchStore(t);[n,r]=Wi(a,e=>[!!e._notFound,e.error],{compare:Ea}),i=Wi(e.stores.ids,e=>e[e.indexOf(t)+1])}if(n)return wa(e,e.routesById[t],r);if(!i)return null;let a=(0,b.jsx)(Oa,{routeId:i});return t===`__root__`?(0,b.jsx)(_.Suspense,{fallback:Ta(e),children:a}):a});function Ma(e,t){let n=e[1];e.length=0,n?.(t)}function Na({t:e}){let t=vi(),n=t._rendered??=[];return t.startTransition=(r,i)=>new Promise(a=>{Ma(n,!1),n.push(i,a),e(t),_.startTransition(r)}),lt(()=>{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(Mt(r.publicHref)!==Mt(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`,...er(a,a)})}):t._tx||t.load({sync:!0}).catch(console.error),e},[t,t.history]),null}function Pa(){let e=vi(),t=e.routesById[dn],n=Ta(e,t),r=e.ssr?Ca:_.Suspense,i=(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(Na,{t:_.useState()[1]}),(0,b.jsx)(r,{fallback:n,children:(0,b.jsx)(Fa,{})})]});return e.options.InnerWrap?(0,b.jsx)(e.options.InnerWrap,{children:i}):i}function Fa(){let e=vi(),t=e._rendered,n=Wi(e.stores.matches,e=>t[0]??e),r=n[0],i=r?.routeId;lt(()=>{t[0]===n&&Ma(t,!0)},[t,n]);let a=i?(0,b.jsx)(Oa,{routeId:i}):null;return(0,b.jsx)(yi.Provider,{value:i,children:e.options.disableGlobalCatchBoundary?a:(0,b.jsx)(ui,{getResetKey:()=>r,onCatch:void 0,children:a})})}var Ia=e=>({createMutableStore:Li,createReadonlyStore:Li,batch:Pi}),La=e=>new Ra(e),Ra=class extends ir{constructor(e){super(e,Ia)}};function za({router:e,children:t,...n}){pt(n)&&e.update({...e.options,...n,context:{...e.options.context,...n.context}});let r=(0,b.jsx)(_i.Provider,{value:e,children:t});return e.options.Wrap?(0,b.jsx)(e.options.Wrap,{children:r}):r}function Ba({router:e,...t}){return(0,b.jsx)(za,{router:e,...t,children:(0,b.jsx)(Pa,{})})}function Va(e){let t=vi();return Wi(t.stores.location,Ki(e,t))}function Ha(){return(0,b.jsx)(ja,{})}var Ua=new Map,Wa=new Map;function Ga(e,t){Ua.set(e,t);for(let t of Wa.get(e)??[])t()}function Ka(e){if(Ua.has(e)){Ua.delete(e);for(let t of Wa.get(e)??[])t()}}function qa(e){return Ua.get(e)??null}function Ja(e,t){let n=Wa.get(e);return n||(n=new Set,Wa.set(e,n)),n.add(t),()=>{n.delete(t),n.size===0&&Wa.delete(e)}}async function Ya(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 Xa,Za=0,Qa=new Map;function $a(){return Xa||(Xa=new Worker(new URL(`/assets/jsonParse.worker-DEEnj3gk.js`,``+import.meta.url),{type:`module`}),Xa.addEventListener(`message`,e=>{let t=Qa.get(e.data.id);t&&(Qa.delete(e.data.id),e.data.ok?t.resolve(e.data.data):t.reject(Error(e.data.error)))}),Xa)}function eo(e){let t=Za++;return new Promise((n,r)=>{Qa.set(t,{resolve:n,reject:r}),$a().postMessage({id:t,text:e})})}async function to(e,t,n){try{let r=await fetch(e);n&&await n(r),Ga(t,{phase:`downloading`,receivedBytes:0,totalBytes:null});let i=await Ya(r,e=>Ga(t,{phase:`downloading`,...e}));return Ga(t,{phase:`parsing`,receivedBytes:i.length,totalBytes:i.length}),await eo(i)}finally{Ka(t)}}var no=`/api`,ro=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 io(e){try{let t=await e.json();if(t&&typeof t==`object`)return t}catch{}return null}function ao(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 oo(e,t){let n=await fetch(`${no}${e}`,t);if(!n.ok){let t=await io(n);throw new ro(n.status,t,`${e}: ${n.status} ${n.statusText}`,ao(n))}return n.json()}async function so(e,t){return to(`${no}${e}`,t,async t=>{if(!t.ok){let n=await io(t);throw new ro(t.status,n,`${e}: ${t.status} ${t.statusText}`)}})}function co(e){return oo(`/index`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)})}function lo(e){return oo(`/jobs/${encodeURIComponent(e)}`)}function uo(e){return oo(`/jobs/${encodeURIComponent(e)}/cancel`,{method:`POST`})}function fo(){return oo(`/maps`)}function po(e,t,n){let r=n?`?commit=${encodeURIComponent(n)}`:``;return so(`/maps/${encodeURIComponent(e)}/${encodeURIComponent(t)}${r}`,`map:${e}/${t}`)}function mo(e,t,n,r){let i=new URLSearchParams({district:String(n)});return r&&i.set(`commit`,r),so(`/maps/${encodeURIComponent(e)}/${encodeURIComponent(t)}/symbols?${i}`,`symbols:${e}/${t}:${n}`)}async function ho(e=2500){let t=new AbortController,n=setTimeout(()=>t.abort(),e);try{return(await fetch(`${no}/healthz`,{signal:t.signal})).ok}catch{return!1}finally{clearTimeout(n)}}function go(e){return`${no}/jobs/${encodeURIComponent(e)}/events`}function _o(){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`);if(t.actions.some(e=>!e.path.startsWith(`/`)||e.path.startsWith(`//`)))throw Error(`Host actions must stay on this origin`);return t}var vo=_o();function yo(){return vo?.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 bo(e,t){return to(`/maps/${e}/${t}.json`,`map:${e}/${t}`,n=>{if(!n.ok)throw Error(`/maps/${e}/${t}.json: ${n.status} ${n.statusText}`)})}function xo(e,t,n){return to(`/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 So(e){return{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 Co(){return ct({queryKey:[`service-available`],queryFn:()=>ho(),staleTime:15e3,retry:!1,refetchOnWindowFocus:!0})}function wo(e,t){let n=new Map;for(let t of e??[])n.set(t.slug,t);for(let e of t??[])n.set(e.slug,So(e));return[...n.values()].sort((e,t)=>e.slug.localeCompare(t.slug))}function To(){let e=Co(),t=e.data,n=e.isLoading,r=ct({queryKey:[`catalogue`,`static`],queryFn:yo,staleTime:1/0,retry:!1}),i=ct({queryKey:[`catalogue`,`service`],queryFn:fo,enabled:t===!0,staleTime:15e3,retry:!1}),a=wo(r.data,i.data),o=r.data!==void 0||i.data!==void 0,s=!o&&(n||r.isLoading||t===!0&&i.isFetching),c=(vo?.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 Eo(e,t,n={}){let{data:r,isLoading:i}=Co(),a=ct({queryKey:n.commit?[`map`,`service`,e,t,n.commit]:[`map`,`service`,e,t],queryFn:()=>po(e,t,n.commit),enabled:r===!0&&!!e&&!!t&&!n.wait,staleTime:15e3,retry:!1}),o=r===!1||r===!0&&a.isError,s=ct({queryKey:[`map`,`static`,e,t],queryFn:()=>bo(e,t),enabled:!vo?.private&&o&&!!e&&!!t,staleTime:1/0,retry:!1}),c=a.data??s.data;return{data:c,isLoading:!c&&(i||!!n.wait||r===!0&&a.isFetching||o&&s.isFetching),isError:!c&&o&&(vo?.private||s.isError),error:s.error??a.error,source:a.data?`service`:s.data?`static`:void 0}}function Do(e,t,n,r,i={}){let a=i.ready??!0,o=ot({queries:r.map(r=>({queryKey:i.commit?[`symbols`,n,e,t,r,i.commit]:[`symbols`,n,e,t,r],queryFn:()=>n===`service`?mo(e,t,r,i.commit):xo(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 Oo=new Set([`about`,`docs`,`api`,`new`,`settings`,`assets`,`static`,`health`,`login`,`admin`,`search`]),ko=`[A-Za-z0-9](?:[A-Za-z0-9-]{0,38}[A-Za-z0-9])?`,Ao=`[A-Za-z0-9_.-]+`,jo=RegExp(`^https?://(?:www\\.)?github\\.com/(${ko})/(${Ao}?)(?:\\.git)?/?(?:[?#].*)?$`),Mo=RegExp(`^(${ko})/(${Ao})$`);function No(e){let t=e.trim();if(!t)return null;let n=t.match(jo);if(n){let[,e,r]=n,i=r.replace(/\.git$/,``);return!e||!i?null:{owner:e,repo:i,apiValue:t}}let r=t.match(Mo);if(r){let[,e,t]=r,n=t.replace(/\.git$/,``);return n?{owner:e,repo:n,apiValue:`${e}/${n}`}:null}return null}function Po(e){let t=No(e);return t?Oo.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 Fo(){let e=Qi(),{data:t}=Co(),[n,r]=(0,_.useState)(``),[i,a]=(0,_.useState)(null),[o,s]=(0,_.useState)(null),[c,l]=(0,_.useState)(!1),u=t===!1,d=Va({select:e=>e.hash}),f=(0,_.useRef)(null),p=(0,_.useRef)(null);(0,_.useEffect)(()=>{d===`repo-field`&&(vo?p.current:f.current)?.focus()},[d]);async function m(t){if(t.preventDefault(),u||c)return;s(null);let r=vo?.repositories.find(e=>e.value===n),i=vo?r?{ok:!0,parsed:{apiValue:r.value}}:{ok:!1,message:`Choose an authorized repository.`}:Po(n);if(!i.ok){a(i.message);return}a(null),l(!0);try{let t=await co({repo:i.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 ro?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 m(e),className:`flex flex-col gap-2`,children:[(0,b.jsx)(`label`,{htmlFor:`repo-field`,className:`text-small font-semibold`,children:vo?`Authorized repository`:`GitHub repository`}),vo?(0,b.jsxs)(`select`,{ref:p,id:`repo-field`,"data-repo-field":!0,value:n,onChange:e=>r(e.target.value),disabled:u||c,className:`h-[52px] rounded-[14px] border border-[var(--rule)] bg-[var(--chrome2)] px-4 font-mono text-body text-[var(--on)] focus-visible:ring-2 focus-visible:ring-[var(--accent)]`,children:[(0,b.jsx)(`option`,{value:``,children:vo.repositories.length?`Select a repository`:`Connect a repository to begin`}),vo.repositories.map(e=>(0,b.jsx)(`option`,{value:e.value,children:e.label},e.value))]}):(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-[52px] rounded-[14px] border border-[var(--rule)] bg-[var(--chrome2)] px-4 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:`h-[52px] rounded-[14px] bg-[var(--accent)] text-body font-bold text-[var(--on-accent)] disabled:opacity-50`,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]})]})}var Io=.035;function Lo(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 Ro(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 zo(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 Bo(e){let t=[];for(let n of e)for(let e of n)t.push(e);return t}function Vo(e,t,n){let r=Ro(e),i=Ro(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=Bo(e),o=Bo(t);if(a.length===0||o.length===0)return!1;let s=zo(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 Ho(e,t,n){return Vo(e.blob,t.blob,n)}function Uo(e){let t=Object.keys(e.districts).filter(t=>L(e.districts[t])!==`unconnected`),n=Lo(e.districts,t),r=(Math.max(n[2]-n[0],n[3]-n[1])||1)*Io,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++)Ho(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 Wo(e){let{neighbours:t}=Uo(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 L(e){return e.class===`island`||e.class===`unconnected`?e.class:`mainland`}var R=(e,t)=>e.N[t][0],Go=(e,t)=>e.N[t][1],Ko=(e,t)=>e.N[t][2],qo=(e,t)=>e.N[t][3],Jo=(e,t)=>e.C?.[t]??qo(e,t),Yo=(e,t)=>e.N[t][4],Xo=(e,t)=>e.N[t][5],Zo=(e,t)=>e.N[t][6],Qo=(e,t)=>e.N[t].slice(7);function $o(e,t,n){if(t!==`t`)return[Go(e,n),Ko(e,n)];let r=Qo(e,n);return[r[0]+r[2]/2,r[1]+r[3]/2]}function es(e,t,n){if(t!==`t`){let t=e.footprint_centroids?.[n];if(t)return t}return $o(e,t,n)}function ts(e,t){return e.S?.[String(t)]??[]}function ns(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(L(e.districts[String(R(e,n))])===`unconnected`)continue;let i=$o(e,t,n);r(i[0],i[1])}if(t===`r`){for(let t in e.districts)if(L(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(L(e.districts[String(R(e,t))])===`unconnected`)continue;let n=Qo(e,t);r(n[0]+n[2],n[1]+n[3])}return n[2]<n[0]?[0,0,1,1]:n}function rs(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=>L(e.districts[String(R(e,t))])===`mainland`;for(let n=0;n<e.N.length;n++){if(!i(n))continue;let a=$o(e,t,n);r(a[0],a[1])}if(t===`r`){for(let t in e.districts)if(L(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=Qo(e,t);r(n[0]+n[2],n[1]+n[3])}return n[2]<n[0]?ns(e,t):n}var is={left:24,top:12,right:24,bottom:38};function as(e){return e<=820?{left:16,top:110,right:16,bottom:158}:is}function os(e,t,n=as(e)){return[n.left,n.top,e-n.right,t-n.bottom]}function ss(e,t,n,r=as(e)){let[,i,,a]=os(e,t,r);return(i+a)/2}function cs(e,t,n,r=as(t)){let[i,a,o,s]=os(t,n,r);return Math.min((o-i)/(e[2]-e[0]||1),(s-a)/(e[3]-e[1]||1))}var ls=e=>[1,3,5].map(t=>parseInt(e.slice(t,t+2),16)),us=(e,t,n)=>e.map((e,r)=>Math.round(e+(t[r]-e)*n)),ds=null;function fs(){ds=null,_s=null}var ps=.4;function ms(e,t=ps){return ds||=getComputedStyle(document.documentElement),`rgb(${us(ls(ds.getPropertyValue(`--canvas`).trim()),Array.isArray(e)?e:ls(e),t).join(`,`)})`}var hs=[`#3E6E88`,`#B8B06A`,`#C0472F`];function gs(e){let t=ls(hs[0]),n=ls(hs[1]),r=ls(hs[2]);return ms(e<.5?us(t,n,e*2):us(n,r,(e-.5)*2))}var _s=null,vs=[`--H0`,`--H1`,`--H2`,`--H3`,`--H4`,`--H5`];function ys(e){if(_s?.doc===e)return _s;ds||=getComputedStyle(document.documentElement);let t=vs.map(e=>ls(ds.getPropertyValue(e).trim())),n=ls(ds.getPropertyValue(`--canvas`).trim()),r=Wo(e),i=new Map;for(let[e,a]of r){let r=us(n,t[a]??t[0],ps);i.set(e,`rgb(${r.join(`,`)})`)}return _s={doc:e,mixed:i,assigned:r},_s}function bs(e,t){let{mixed:n}=ys(e);return n.get(t)??n.get(0)??`#888`}var xs=[.3,.4,.5];function Ss(e,t,n){if(n==null)return bs(e,t);let{assigned:r}=ys(e);ds||=getComputedStyle(document.documentElement);let i=vs.map(e=>ls(ds.getPropertyValue(e).trim())),a=ls(ds.getPropertyValue(`--canvas`).trim()),o=r.get(t)??0,s=xs[n]??xs[0];return`rgb(${us(a,i[o]??i[0],s).join(`,`)})`}function Cs(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 ws(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 Ts(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 Es(e){let t=0;for(let n of e.blob)t+=Ts(n);return t}function Ds(e,t){let n=[1e9,1e9,-1e9,-1e9];for(let r=0;r<e.N.length;r++){if(R(e,r)!==t)continue;let i=Qo(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 Os=`var(--dim)`,ks=5,As=.15,js=.8;function Ms(e){return e.split(`/`).filter(Boolean).slice(0,-1)}function Ns(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 Ps(e,t){return e<t?-1:+(e>t)}var Fs=null;function Is(){Fs=null}function Ls(e){return Fs||=getComputedStyle(document.documentElement),ms(Fs.getPropertyValue(`--p${e%10}`).trim())}function Rs(e,t){return e.slice(0,t).join(`/`)||`.`}function zs(e,t){let n=new Map,r=e.map(e=>Rs(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]||Ps(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:Ls(n),other:!1}));return i.length>10&&s.push({path:null,count:i.slice(10).reduce((e,[,t])=>e+t,0),color:Os,other:!0}),{depth:t,groups:s,filePackages:r,fileColors:r.map(e=>{let t=o.get(e);return t==null?Os:Ls(t)})}}function Bs(e){return{name:e.name,path:e.path,count:e.count,children:[...e.children.values()].sort((e,t)=>t.count-e.count||Ps(e.path,t.path)).map(Bs)}}function Vs(e,t){let n=e.map(e=>t[e]),r=Ns(n),i=n[0].slice(0,r);return{path:i.join(`/`)||`.`,parts:i,members:e}}function Hs(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=>Vs(e,t)),directCount:r}}function Us(e,t){if(e.length===0)return[];let n=Ns(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=>Vs(e,t));for(a.length===0&&n>0&&(a=[Vs(e,t)],i=0),a.sort((e,t)=>t.members.length-e.members.length||Ps(e.path,t.path)),a.length>ks&&(i+=a.slice(ks).reduce((e,t)=>e+t.members.length,0),a=a.slice(0,ks)),i>(a[0]?.members.length??0)&&(a=[Vs(e,t)],i=0);;){let n=a.map(e=>({row:e,split:Hs(e,t)})).filter(e=>e.split!=null).sort((e,t)=>t.row.members.length-e.row.members.length||Ps(e.row.path,t.row.path)),r=!1;for(let{row:t,split:o}of n){if(t.members.length/e.length<As)break;let n=a.filter(e=>e!==t).concat(o.children).sort((e,t)=>t.members.length-e.members.length||Ps(e.path,t.path)),s=n.slice(0,ks),c=new Set(s);if(o.children.reduce((e,t)=>e+(c.has(t)?t.members.length:0),0)/t.members.length<js)continue;let l=i+o.directCount+n.slice(ks).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||Ps(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 Ws(e){let t=e.F.map(Ms),n=Math.max(1,...t.map(e=>e.length)),r=Ns(t),i=Math.min(n,r+1),a=new Map;for(let e=i;e<=n;e++)a.set(e,zs(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||Ps(e.path,t.path)).map(Bs),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=>L(e.districts[String(R(e,t))])===`island`)).map(([e])=>e)),m=new Map;for(let t=0;t<e.N.length;t++){let n=R(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,Us(n,t));let g=[];for(let[t,n]of h){if(L(e.districts[String(t)])!==`mainland`)continue;let r=m.get(t).length,i=Math.sqrt(Es(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)=>L(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||Ps(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 Gs(e){return e===`.`?`(repo root)`:`${e}/`}var Ks={system:`light`,light:`dark`,dark:`system`};function qs(e){return Ks[e]}var Js=`tolmap:theme`,Ys=`tolmap:theme-change`;function Xs(e){return e===`system`||e===`light`||e===`dark`}function Zs(){try{let e=window.localStorage.getItem(Js);return Xs(e)?e:`system`}catch{return`system`}}function Qs(e){try{window.localStorage.setItem(Js,e)}catch{}}function $s(){return matchMedia(`(prefers-color-scheme: dark)`).matches}function ec(e){return e===`system`?$s()?`dark`:`light`:e}function tc(e){e===`system`?document.documentElement.removeAttribute(`data-theme`):document.documentElement.dataset.theme=e}function nc(e){tc(e),Qs(e),fs(),Is(),window.dispatchEvent(new Event(Ys))}function rc(e){let t=()=>{fs(),Is(),e()};window.addEventListener(Ys,t),window.addEventListener(`storage`,t);let n=matchMedia(`(prefers-color-scheme: dark)`);return n.addEventListener(`change`,t),()=>{window.removeEventListener(Ys,t),window.removeEventListener(`storage`,t),n.removeEventListener(`change`,t)}}function ic(){return[(0,_.useSyncExternalStore)(rc,Zs,()=>`system`),nc]}function ac(){return ec((0,_.useSyncExternalStore)(rc,Zs,()=>`system`))}function oc(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=oc(e[t]))&&(r&&(r+=` `),r+=n)}else for(n in e)e[n]&&(r&&(r+=` `),r+=n)}return r}function sc(){for(var e,t,n=0,r=``,i=arguments.length;n<i;n++)(e=arguments[n])&&(t=oc(e))&&(r&&(r+=` `),r+=t);return r}var cc=`-`,lc=e=>{let t=pc(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:e=>{let n=e.split(cc);return n[0]===``&&n.length!==1&&n.shift(),uc(n,t)||fc(e)},getConflictingClassGroupIds:(e,t)=>{let i=n[e]||[];return t&&r[e]?[...i,...r[e]]:i}}},uc=(e,t)=>{if(e.length===0)return t.classGroupId;let n=e[0],r=t.nextPart.get(n),i=r?uc(e.slice(1),r):void 0;if(i)return i;if(t.validators.length===0)return;let a=e.join(cc);return t.validators.find(({validator:e})=>e(a))?.classGroupId},dc=/^\[(.+)\]$/,fc=e=>{if(dc.test(e)){let t=dc.exec(e)[1],n=t?.substring(0,t.indexOf(`:`));if(n)return`arbitrary..`+n}},pc=e=>{let{theme:t,prefix:n}=e,r={nextPart:new Map,validators:[]};return _c(Object.entries(e.classGroups),n).forEach(([e,n])=>{mc(n,r,e,t)}),r},mc=(e,t,n,r)=>{e.forEach(e=>{if(typeof e==`string`){let r=e===``?t:hc(t,e);r.classGroupId=n;return}if(typeof e==`function`){if(gc(e)){mc(e(r),t,n,r);return}t.validators.push({validator:e,classGroupId:n});return}Object.entries(e).forEach(([e,i])=>{mc(i,hc(t,e),n,r)})})},hc=(e,t)=>{let n=e;return t.split(cc).forEach(e=>{n.nextPart.has(e)||n.nextPart.set(e,{nextPart:new Map,validators:[]}),n=n.nextPart.get(e)}),n},gc=e=>e.isThemeGetter,_c=(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,vc=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)}}},yc=`!`,bc=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(yc);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},xc=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},Sc=e=>({cache:vc(e.cacheSize),parseClassName:bc(e),...lc(e)}),Cc=/\s+/,wc=(e,t)=>{let{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:i}=t,a=[],o=e.trim().split(Cc),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=xc(c).join(`:`),h=l?m+yc: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 z(){let e=0,t,n,r=``;for(;e<arguments.length;)(t=arguments[e++])&&(n=Tc(t))&&(r&&(r+=` `),r+=n);return r}var Tc=e=>{if(typeof e==`string`)return e;let t,n=``;for(let r=0;r<e.length;r++)e[r]&&(t=Tc(e[r]))&&(n&&(n+=` `),n+=t);return n};function Ec(e,...t){let n,r,i,a=o;function o(o){return n=Sc(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=wc(e,n);return i(e,a),a}return function(){return a(z.apply(null,arguments))}}var Dc=e=>{let t=t=>t[e]||[];return t.isThemeGetter=!0,t},Oc=/^\[(?:([a-z-]+):)?(.+)\]$/i,kc=/^\d+\/\d+$/,Ac=new Set([`px`,`full`,`screen`]),jc=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Mc=/\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$/,Nc=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,Pc=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,Fc=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Ic=e=>Rc(e)||Ac.has(e)||kc.test(e),Lc=e=>Xc(e,`length`,Zc),Rc=e=>!!e&&!Number.isNaN(Number(e)),zc=e=>Xc(e,`number`,Rc),Bc=e=>!!e&&Number.isInteger(Number(e)),Vc=e=>e.endsWith(`%`)&&Rc(e.slice(0,-1)),B=e=>Oc.test(e),Hc=e=>jc.test(e),Uc=new Set([`length`,`size`,`percentage`]),Wc=e=>Xc(e,Uc,Qc),Gc=e=>Xc(e,`position`,Qc),Kc=new Set([`image`,`url`]),qc=e=>Xc(e,Kc,$c),Jc=e=>Xc(e,``,V),Yc=()=>!0,Xc=(e,t,n)=>{let r=Oc.exec(e);return r?r[1]?typeof t==`string`?r[1]===t:t.has(r[1]):n(r[2]):!1},Zc=e=>Mc.test(e)&&!Nc.test(e),Qc=()=>!1,V=e=>Pc.test(e),$c=e=>Fc.test(e),el=()=>{let e=Dc(`colors`),t=Dc(`spacing`),n=Dc(`blur`),r=Dc(`brightness`),i=Dc(`borderColor`),a=Dc(`borderRadius`),o=Dc(`borderSpacing`),s=Dc(`borderWidth`),c=Dc(`contrast`),l=Dc(`grayscale`),u=Dc(`hueRotate`),d=Dc(`invert`),f=Dc(`gap`),p=Dc(`gradientColorStops`),m=Dc(`gradientColorStopPositions`),h=Dc(`inset`),g=Dc(`margin`),_=Dc(`opacity`),v=Dc(`padding`),y=Dc(`saturate`),b=Dc(`scale`),x=Dc(`sepia`),S=Dc(`skew`),C=Dc(`space`),w=Dc(`translate`),T=()=>[`auto`,`contain`,`none`],E=()=>[`auto`,`hidden`,`clip`,`visible`,`scroll`],D=()=>[`auto`,B,t],O=()=>[B,t],k=()=>[``,Ic,Lc],A=()=>[`auto`,Rc,B],ee=()=>[`bottom`,`center`,`left`,`left-bottom`,`left-top`,`right`,`right-bottom`,`right-top`,`top`],j=()=>[`solid`,`dashed`,`dotted`,`double`,`none`],te=()=>[`normal`,`multiply`,`screen`,`overlay`,`darken`,`lighten`,`color-dodge`,`color-burn`,`hard-light`,`soft-light`,`difference`,`exclusion`,`hue`,`saturation`,`color`,`luminosity`],M=()=>[`start`,`end`,`center`,`between`,`around`,`evenly`,`stretch`],N=()=>[``,`0`,B],ne=()=>[`auto`,`avoid`,`all`,`avoid-page`,`page`,`left`,`right`,`column`],P=()=>[Rc,B];return{cacheSize:500,separator:`:`,theme:{colors:[Yc],spacing:[Ic,Lc],blur:[`none`,``,Hc,B],brightness:P(),borderColor:[e],borderRadius:[`none`,``,`full`,Hc,B],borderSpacing:O(),borderWidth:k(),contrast:P(),grayscale:N(),hueRotate:P(),invert:N(),gap:O(),gradientColorStops:[e],gradientColorStopPositions:[Vc,Lc],inset:D(),margin:D(),opacity:P(),padding:O(),saturate:P(),scale:P(),sepia:N(),skew:P(),space:O(),translate:O()},classGroups:{aspect:[{aspect:[`auto`,`square`,`video`,B]}],container:[`container`],columns:[{columns:[Hc]}],"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:[...ee(),B]}],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`,Bc,B]}],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`,B]}],grow:[{grow:N()}],shrink:[{shrink:N()}],order:[{order:[`first`,`last`,`none`,Bc,B]}],"grid-cols":[{"grid-cols":[Yc]}],"col-start-end":[{col:[`auto`,{span:[`full`,Bc,B]},B]}],"col-start":[{"col-start":A()}],"col-end":[{"col-end":A()}],"grid-rows":[{"grid-rows":[Yc]}],"row-start-end":[{row:[`auto`,{span:[Bc,B]},B]}],"row-start":[{"row-start":A()}],"row-end":[{"row-end":A()}],"grid-flow":[{"grid-flow":[`row`,`col`,`dense`,`row-dense`,`col-dense`]}],"auto-cols":[{"auto-cols":[`auto`,`min`,`max`,`fr`,B]}],"auto-rows":[{"auto-rows":[`auto`,`min`,`max`,`fr`,B]}],gap:[{gap:[f]}],"gap-x":[{"gap-x":[f]}],"gap-y":[{"gap-y":[f]}],"justify-content":[{justify:[`normal`,...M()]}],"justify-items":[{"justify-items":[`start`,`end`,`center`,`stretch`]}],"justify-self":[{"justify-self":[`auto`,`start`,`end`,`center`,`stretch`]}],"align-content":[{content:[`normal`,...M(),`baseline`]}],"align-items":[{items:[`start`,`end`,`center`,`baseline`,`stretch`]}],"align-self":[{self:[`auto`,`start`,`end`,`center`,`stretch`,`baseline`]}],"place-content":[{"place-content":[...M(),`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`,B,t]}],"min-w":[{"min-w":[B,t,`min`,`max`,`fit`]}],"max-w":[{"max-w":[B,t,`none`,`full`,`min`,`max`,`fit`,`prose`,{screen:[Hc]},Hc]}],h:[{h:[B,t,`auto`,`min`,`max`,`fit`,`svh`,`lvh`,`dvh`]}],"min-h":[{"min-h":[B,t,`min`,`max`,`fit`,`svh`,`lvh`,`dvh`]}],"max-h":[{"max-h":[B,t,`min`,`max`,`fit`,`svh`,`lvh`,`dvh`]}],size:[{size:[B,t,`auto`,`min`,`max`,`fit`]}],"font-size":[{text:[`base`,Hc,Lc]}],"font-smoothing":[`antialiased`,`subpixel-antialiased`],"font-style":[`italic`,`not-italic`],"font-weight":[{font:[`thin`,`extralight`,`light`,`normal`,`medium`,`semibold`,`bold`,`extrabold`,`black`,zc]}],"font-family":[{font:[Yc]}],"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`,B]}],"line-clamp":[{"line-clamp":[`none`,Rc,zc]}],leading:[{leading:[`none`,`tight`,`snug`,`normal`,`relaxed`,`loose`,Ic,B]}],"list-image":[{"list-image":[`none`,B]}],"list-style-type":[{list:[`none`,`disc`,`decimal`,B]}],"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`,Ic,Lc]}],"underline-offset":[{"underline-offset":[`auto`,Ic,B]}],"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`,B]}],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`,B]}],"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:[...ee(),Gc]}],"bg-repeat":[{bg:[`no-repeat`,{repeat:[``,`x`,`y`,`round`,`space`]}]}],"bg-size":[{bg:[`auto`,`cover`,`contain`,Wc]}],"bg-image":[{bg:[`none`,{"gradient-to":[`t`,`tr`,`r`,`br`,`b`,`bl`,`l`,`tl`]},qc]}],"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":[Ic,B]}],"outline-w":[{outline:[Ic,Lc]}],"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":[Ic,Lc]}],"ring-offset-color":[{"ring-offset":[e]}],shadow:[{shadow:[``,`inner`,`none`,Hc,Jc]}],"shadow-color":[{shadow:[Yc]}],opacity:[{opacity:[_]}],"mix-blend":[{"mix-blend":[...te(),`plus-lighter`,`plus-darker`]}],"bg-blend":[{"bg-blend":te()}],filter:[{filter:[``,`none`]}],blur:[{blur:[n]}],brightness:[{brightness:[r]}],contrast:[{contrast:[c]}],"drop-shadow":[{"drop-shadow":[``,`none`,Hc,B]}],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`,B]}],duration:[{duration:P()}],ease:[{ease:[`linear`,`in`,`out`,`in-out`,B]}],delay:[{delay:P()}],animate:[{animate:[`none`,`spin`,`ping`,`pulse`,`bounce`,B]}],transform:[{transform:[``,`gpu`,`none`]}],scale:[{scale:[b]}],"scale-x":[{"scale-x":[b]}],"scale-y":[{"scale-y":[b]}],rotate:[{rotate:[Bc,B]}],"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`,B]}],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`,B]}],"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`,B]}],fill:[{fill:[e,`none`]}],"stroke-w":[{stroke:[Ic,Lc,zc]}],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`]}}},tl=(e,{cacheSize:t,prefix:n,separator:r,experimentalParseClassName:i,extend:a={},override:o={}})=>{nl(e,`cacheSize`,t),nl(e,`prefix`,n),nl(e,`separator`,r),nl(e,`experimentalParseClassName`,i);for(let t in o)rl(e[t],o[t]);for(let t in a)il(e[t],a[t]);return e},nl=(e,t,n)=>{n!==void 0&&(e[t]=n)},rl=(e,t)=>{if(t)for(let n in t)nl(e,n,t[n])},il=(e,t)=>{if(t)for(let n in t){let r=t[n];r!==void 0&&(e[n]=(e[n]||[]).concat(r))}},al=((e,...t)=>typeof e==`function`?Ec(el,e,...t):Ec(()=>tl(el(),e),...t))({extend:{classGroups:{"font-size":[{text:[`title`,`sheet-title`,`section-title`,`row`,`body`,`small`,`meta`,`label`]}]}}});function ol(...e){return al(sc(e))}var sl={system:`System`,light:`Light`,dark:`Dark`};function cl(e){return{width:e,height:e,viewBox:`0 0 15 15`,fill:`none`,stroke:`currentColor`,strokeWidth:1.3,strokeLinecap:`round`,strokeLinejoin:`round`}}function ll({size:e}){return(0,b.jsxs)(`svg`,{...cl(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 ul({size:e}){return(0,b.jsx)(`svg`,{...cl(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 dl({size:e}){return(0,b.jsxs)(`svg`,{...cl(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 fl={system:dl,light:ll,dark:ul};function pl({className:e,iconSize:t=15}={}){let[n,r]=ic(),i=fl[n];return(0,b.jsx)(`button`,{type:`button`,"data-theme-toggle":!0,"data-theme-choice":n,"aria-label":`Theme: ${sl[n]}. Click to switch to ${sl[qs(n)]}.`,onClick:()=>r(qs(n)),className:ol(`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 ml(){let[e,t]=ic();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:sl[n]},n))})}function hl({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 gl=({size:e=20})=>(0,b.jsxs)(hl,{size:e,children:[(0,b.jsx)(`circle`,{cx:`11`,cy:`11`,r:`7`}),(0,b.jsx)(`path`,{d:`M20 20l-3.5-3.5`})]}),_l=({size:e=20})=>(0,b.jsxs)(hl,{size:e,children:[(0,b.jsx)(`path`,{d:`M4 11l8-7 8 7`}),(0,b.jsx)(`path`,{d:`M6 9.5V20h12V9.5`})]}),vl=({size:e=20})=>(0,b.jsx)(hl,{size:e,children:(0,b.jsx)(`path`,{d:`M12 5v14M5 12h14`})}),yl=({size:e=20})=>(0,b.jsx)(hl,{size:e,children:(0,b.jsx)(`path`,{d:`M5 12h14`})}),bl=({size:e=20})=>(0,b.jsx)(hl,{size:e,children:(0,b.jsx)(`path`,{d:`M9 4v5H4M15 4v5h5M9 20v-5H4M15 20v-5h5`})}),xl=()=>(0,b.jsxs)(hl,{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`})]}),Sl=()=>(0,b.jsx)(hl,{size:18,children:(0,b.jsx)(`path`,{d:`M6 6l12 12M18 6L6 18`})}),Cl=({className:e}={})=>(0,b.jsx)(hl,{size:14,className:e,children:(0,b.jsx)(`path`,{d:`M9 6l6 6-6 6`})}),wl=({size:e=22}={})=>(0,b.jsx)(hl,{size:e,children:(0,b.jsx)(`path`,{d:`M15 5l-7 7 7 7`})}),Tl=()=>(0,b.jsx)(hl,{size:14,children:(0,b.jsx)(`path`,{d:`M6 6l12 12M18 6L6 18`})}),El=({size:e=20})=>(0,b.jsx)(hl,{size:e,children:(0,b.jsx)(`path`,{d:`M4 6l5-2 6 2 5-2v14l-5 2-6-2-5 2z`})}),Dl=({size:e=20})=>(0,b.jsx)(hl,{size:e,children:(0,b.jsx)(`path`,{d:`M6 3h8l4 4v14H6z`})}),Ol=({size:e=20})=>(0,b.jsx)(hl,{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`})}),kl=({size:e=18})=>(0,b.jsx)(hl,{size:e,children:(0,b.jsx)(`path`,{d:`M9 4H4v5M15 4h5v5M9 20H4v-5M15 20h5v-5`})}),Al=({size:e=20})=>(0,b.jsxs)(hl,{size:e,children:[(0,b.jsx)(`rect`,{x:`3`,y:`4`,width:`18`,height:`16`,rx:`2`}),(0,b.jsx)(`path`,{d:`M9 4v16`})]}),jl=({size:e=14})=>(0,b.jsx)(hl,{size:e,children:(0,b.jsx)(`path`,{d:`M6 9l6 6 6-6`})});function Ml(){return vo?(0,b.jsxs)(`div`,{"data-host-workspace":!0,className:`flex flex-wrap items-center gap-3 text-small`,children:[(0,b.jsx)(`span`,{className:`mr-auto text-[var(--dim)]`,children:vo.workspace}),vo.actions.map(e=>e.method===`post`?(0,b.jsx)(`form`,{method:`post`,action:e.path,children:(0,b.jsx)(`button`,{className:`min-h-11 rounded-[12px] border border-[var(--rule)] px-3`,type:`submit`,children:e.label})},e.path):(0,b.jsx)(`a`,{className:`inline-flex min-h-11 items-center underline underline-offset-2`,href:e.path,children:e.label},e.path))]}):null}function Nl({m:e}){return(0,b.jsxs)(ha,{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)(Cl,{})})]})}function Pl(){let{data:e,isLoading:t,isError:n,serviceAvailable:r,refetch:i}=To();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.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,b.jsxs)(`span`,{className:`text-title`,children:[`tolmap`,vo?` Hub`:``]}),(0,b.jsx)(pl,{className:`h-11 w-11 rounded-full`})]}),(0,b.jsx)(Ml,{}),(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)(Fo,{})]}),(0,b.jsxs)(`div`,{className:`flex flex-col gap-2.5`,children:[(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:`flex h-11 items-center rounded-[12px] border border-[var(--rule)] bg-[var(--chrome)] px-4 text-small font-semibold text-[var(--on)]`,children:`Retry`})]}),!t&&!n&&e.length===0&&(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 overflow-hidden rounded-[14px] border border-[var(--rule)]`,children:e.map(e=>(0,b.jsx)(Nl,{m:e},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 Fl(){let e=Xi({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)(ha,{to:`/`,className:`text-small text-[var(--accent)] underline underline-offset-2`,children:`back to the map index`})]})}var Il=[],Ll=[];(()=>{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?Ll:Il).push(n+=e[t])})();function Rl(e){if(e<768)return!1;for(let t=0,n=Il.length;;){let r=t+n>>1;if(e<Il[r])n=r;else if(e>=Ll[r])t=r+1;else return!0;if(t==n)return!1}}function zl(e){return e>=127462&&e<=127487}var Bl=8205;function Vl(e,t,n=!0,r=!0){return(n?Hl:Ul)(e,t,r)}function Hl(e,t,n){if(t==e.length)return t;t&&Gl(e.charCodeAt(t))&&Kl(e.charCodeAt(t-1))&&t--;let r=Wl(e,t);for(t+=ql(r);t<e.length;){let i=Wl(e,t);if(r==Bl||i==Bl||n&&Rl(i))t+=ql(i),r=i;else if(zl(i)){let n=0,r=t-2;for(;r>=0&&zl(Wl(e,r));)n++,r-=2;if(n%2==0)break;t+=2}else break}return t}function Ul(e,t,n){for(;t>1;){let r=Hl(e,t-2,n);if(r<t)return r;t--}return 0}function Wl(e,t){let n=e.charCodeAt(t);if(!Kl(n)||t+1==e.length)return n;let r=e.charCodeAt(t+1);return Gl(r)?(n-55296<<10)+(r-56320)+65536:n}function Gl(e){return e>=56320&&e<57344}function Kl(e){return e>=55296&&e<56320}function ql(e){return e<65536?1:2}var H=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]=ru(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),Yl.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]=ru(this,e,t);let n=[];return this.decompose(e,t,n,0),Yl.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 $l(this),i=new $l(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 $l(this,e)}iterRange(e,t=this.length){return new eu(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 tu(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 Jl(t):Yl.from(Jl.split(t,[]))}},Jl=class e extends H{constructor(e,t=Xl(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 nu(r,o,n,a);r=o+1,n++}}decompose(t,n,r,i){let a=t<=0&&n>=this.length?this:new e(Ql(this.text,t,n),Math.min(n,this.length)-Math.max(0,t));if(i&1){let t=r.pop(),n=Zl(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]=ru(this,t,n);let i=Zl(this.text,Zl(r.text,Ql(this.text,0,t)),n),a=this.length+r.length-(n-t);return i.length<=32?new e(i,a):Yl.from(e.split(i,[]),a)}sliceString(e,t=this.length,n=`
|
|
11
|
+
`){[e,t]=ru(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}},Yl=class e extends H{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]=ru(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=`
|
|
12
|
+
`){[e,t]=ru(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 Jl(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 Jl&&c&&(n=u[u.length-1])instanceof Jl&&t.lines+n.lines<=32?(c+=t.lines,l+=t.length+1,u[u.length-1]=new Jl(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)}};H.empty=new Jl([``],0);function Xl(e){let t=-1;for(let n of e)t+=n.length+1;return t}function Zl(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 Ql(e,t,n){return Zl(e,[``],t,n)}var $l=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 Jl?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 Jl?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=`
|
|
13
|
+
`,this;e--}else if(r instanceof Jl){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 Jl?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)}},eu=class{constructor(e,t,n){this.value=``,this.done=!1,this.cursor=new $l(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!=``}},tu=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`&&(H.prototype[Symbol.iterator]=function(){return this.iter()},$l.prototype[Symbol.iterator]=eu.prototype[Symbol.iterator]=tu.prototype[Symbol.iterator]=function(){return this});var nu=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 ru(e,t,n){return t=Math.max(0,Math.min(e.length,t)),[t,Math.max(t,Math.min(e.length,n))]}function iu(e,t,n=!0,r=!0){return Vl(e,t,n,r)}function au(e){return e>=56320&&e<57344}function ou(e){return e>=55296&&e<56320}function su(e,t){let n=e.charCodeAt(t);if(!ou(n)||t+1==e.length)return n;let r=e.charCodeAt(t+1);return au(r)?(n-55296<<10)+(r-56320)+65536:n}function cu(e){return e<=65535?String.fromCharCode(e):(e-=65536,String.fromCharCode((e>>10)+55296,(e&1023)+56320))}function lu(e){return e<65536?1:2}var uu=/\r\n?|\n/,du=(function(e){return e[e.Simple=0]=`Simple`,e[e.TrackDel=1]=`TrackDel`,e[e.TrackBefore=2]=`TrackBefore`,e[e.TrackAfter=3]=`TrackAfter`,e})(du||={}),fu=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){gu(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:vu(this,e)}mapDesc(e,t=!1){return e.empty?this:_u(this,e,t)}mapPos(e,t=-1,n=du.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!=du.Simple&&c>=e&&(n==du.TrackDel&&r<e&&c>e||n==du.TrackBefore&&r<e||n==du.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)}},pu=class e extends fu{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 gu(this,(t,n,r,i,a)=>e=e.replace(r,r+(n-t),a),!1),e}mapDesc(e,t=!1){return _u(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(H.empty);r.push(a?t.slice(i,i+a):H.empty)}i+=a}return new e(n,r)}compose(e){return this.empty?e:e.empty?this:vu(this,e,!0)}map(e,t=!1){return e.empty?this:_u(this,e,t,!0)}iterChanges(e,t=!1){gu(this,e,t)}get desc(){return fu.create(this.sections)}filter(t){let n=[],r=[],i=[],a=new yu(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);mu(i,e,-1);let t=a.ins==-1?-1:a.off==0?a.ins:0;mu(n,e,t),t>0&&hu(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);mu(n,e,-1),mu(i,e,a.ins==-1?-1:a.off==0?a.ins:0),a.forward(e),o+=e}}return{changes:new e(n,r),filtered:fu.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&&mu(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`?H.of(l.split(r||uu)):l:H.empty,d=u.length;if(e==s&&d==0)return;e<o&&c(),e>o&&mu(i,e-o,-1),mu(i,s-e,d),hu(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(H.empty);r[e]=H.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 mu(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 hu(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(H.empty);e.push(n)}}function gu(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=H.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 _u(e,t,n,r=!1){let i=[],a=r?[]:null,o=new yu(e),s=new yu(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);mu(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(mu(i,s.ins,-1);t;){let n=Math.min(o.len,t);o.ins>=0&&e<o.i&&o.len<=n&&(mu(i,0,o.ins),a&&hu(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;mu(i,t,e<o.i?o.ins:0),a&&e<o.i&&hu(a,i,o.text),e=o.i,o.forward(o.len-n)}else if(o.done&&s.done)return a?pu.createSet(i,a):fu.create(i);else throw Error(`Mismatched change set lengths`)}function vu(e,t,n=!1){let r=[],i=n?[]:null,a=new yu(e),o=new yu(t);for(let e=!1;;)if(a.done&&o.done)return i?pu.createSet(r,i):fu.create(r);else if(a.ins==0)mu(r,a.len,0,e),a.next();else if(o.len==0&&!o.done)mu(r,0,o.ins,e),i&&hu(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;mu(r,t,n,e),i&&n&&hu(i,r,o.text)}else o.ins==-1?(mu(r,a.off?0:a.len,t,e),i&&hu(i,r,a.textBit(t))):(mu(r,a.off?0:a.len,o.off?0:o.ins,e),i&&!o.off&&hu(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 yu=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?H.empty:e[t]}textBit(e){let{inserted:t}=this.set,n=this.i-2>>1;return n>=t.length&&!e?H.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)}},bu=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 U.range(e,t,void 0,void 0,n);let r=Math.abs(e-this.anchor)>Math.abs(t-this.anchor)?e:t;return U.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 U.range(e.anchor,e.head)}static create(t,n,r,i){return new e(t,n,r,i)}},U=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=>bu.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 bu.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?bu.create(t,e,a|32,n):bu.create(e,t,a,n)}static undirectionalRange(e,t){return bu.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 xu(e,t){for(let n of e.ranges)if(n.to>t)throw RangeError(`Selection points outside of document`)}var Su=0,W=class e{constructor(e,t,n,r,i){this.combine=e,this.compareInput=t,this.compare=n,this.isStatic=r,this.id=Su++,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:Cu),!!t.static,t.enables)}of(e){return new wu([],this,0,e)}compute(e,t){if(this.isStatic)throw Error(`Can't compute a static facet`);return new wu(e,this,1,t)}computeN(e,t){if(this.isStatic)throw Error(`Can't compute a static facet`);return new wu(e,this,2,t)}from(e,t){return t||=e=>e,this.compute([e],n=>t(n.field(e)))}};function Cu(e,t){return e==t||e.length==t.length&&e.every((e,n)=>e===t[n])}var wu=class{constructor(e,t,n,r){this.dependencies=e,this.facet=t,this.type=n,this.value=r,this.id=Su++}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)||Eu(e,c)){let r=t(e);if(a?!Tu(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=zu(o,c);if(this.dependencies.every(t=>t instanceof W?o.facet(t)===e.facet(t):t instanceof ku?o.field(t,!1)==e.field(t,!1):!0)||(a?Tu(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 Tu(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 Eu(e,t){let n=!1;for(let r of t)Ru(e,r)&1&&(n=!0);return n}function Du(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=zu(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)Ru(e,t);return e.values[o]=s(e),1},update(e,n){if(!Eu(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=Eu(e,r),c=i.config.facets[t.id],l=i.facet(t);if(c&&!a&&Cu(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 Ou=W.define({static:!0}),ku=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(Su++,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(Ou).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(Ou),i=n.facet(Ou),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,Ou.of({field:this,create:e})]}get extension(){return this}},Au={lowest:4,low:3,default:2,high:1,highest:0};function ju(e){return t=>new Nu(t,e)}var Mu={highest:ju(Au.highest),high:ju(Au.high),default:ju(Au.default),low:ju(Au.low),lowest:ju(Au.lowest)},Nu=class{constructor(e,t){this.inner=e,this.prec=t}get extension(){return this}},Pu=class e{of(e){return new Fu(this,e)}reconfigure(t){return e.reconfigure.of({compartment:this,extension:t})}get(e){return e.config.compartments.get(this)}},Fu=class{constructor(e,t){this.compartment=e,this.inner=t}get extension(){return this}},Iu=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 Lu(t,n,o))e instanceof ku?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,Cu(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=>Du(e,n,t))}}let d=l.map(e=>e(s));return new e(t,o,d,s,c,a)}};function Lu(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 Fu&&n.delete(e.compartment)}if(i.set(e,o),Array.isArray(e))for(let t of e)a(t,o);else if(e instanceof Fu){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 Nu)a(e.inner,e.prec);else if(e instanceof ku)r[o].push(e),e.provides&&a(e.provides,o);else if(e instanceof wu)r[o].push(e),e.facet.extensions&&a(e.facet.extensions,Au.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,Au.default),r.reduce((e,t)=>e.concat(t))}function Ru(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 zu(e,t){return t&1?e.config.staticValues[t>>1]:e.values[t>>1]}var Bu=W.define(),Vu=W.define({combine:e=>e.some(e=>e),static:!0}),Hu=W.define({combine:e=>e.length?e[0]:void 0,static:!0}),Uu=W.define(),Wu=W.define(),Gu=W.define(),Ku=W.define({combine:e=>e.length?e[0]:!1}),qu=class{constructor(e,t){this.type=e,this.value=t}static define(){return new Ju}},Ju=class{of(e){return new qu(this,e)}},Yu=class{constructor(e){this.map=e}of(e){return new Xu(this,e)}},Xu=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 Yu(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}};Xu.reconfigure=Xu.define(),Xu.appendConfig=Xu.define();var Zu=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&&xu(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]==`.`))}};Zu.time=qu.define(),Zu.userEvent=qu.define(),Zu.addToHistory=qu.define(),Zu.remote=qu.define();function Qu(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 $u(e,t,n){let r,i,a;return n?(r=t.changes,i=pu.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:Xu.mapEffects(e.effects,r).concat(Xu.mapEffects(t.effects,i)),annotations:e.annotations.length?e.annotations.concat(t.annotations):t.annotations,scrollIntoView:e.scrollIntoView||t.scrollIntoView}}function ed(e,t,n){let r=t.selection,i=ad(t.annotations);return t.userEvent&&(i=i.concat(Zu.userEvent.of(t.userEvent))),{changes:t.changes instanceof pu?t.changes:pu.of(t.changes||[],n,e.facet(Hu)),selection:r&&(r instanceof U?r:U.single(r.anchor,r.head)),effects:ad(t.effects),annotations:i,scrollIntoView:!!t.scrollIntoView}}function td(e,t,n){let r=ed(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=$u(r,ed(e,t[i],a?r.changes.newLength:e.doc.length),a)}let i=Zu.create(e,r.changes,r.selection,r.effects,r.annotations,r.scrollIntoView);return rd(n?nd(i):i)}function nd(e){let t=e.startState,n=!0;for(let r of t.facet(Uu)){let t=r(e);if(t===!1){n=!1;break}Array.isArray(t)&&(n=n===!0?t:Qu(n,t))}if(n!==!0){let r,i;if(n===!1)i=e.changes.invertedDesc,r=pu.empty(t.doc.length);else{let t=e.changes.filter(n);r=t.changes,i=t.filtered.mapDesc(t.changes).invertedDesc}e=Zu.create(t,r,e.selection&&e.selection.map(i),Xu.mapEffects(e.effects,i),e.annotations,e.scrollIntoView)}let r=t.facet(Wu);for(let n=r.length-1;n>=0;n--){let i=r[n](e);e=i instanceof Zu?i:Array.isArray(i)&&i.length==1&&i[0]instanceof Zu?i[0]:td(t,ad(i),!1)}return e}function rd(e){let t=e.startState,n=t.facet(Gu),r=e;for(let i=n.length-1;i>=0;i--){let a=n[i](e);a&&Object.keys(a).length&&(r=$u(r,ed(t,a,e.changes.newLength),!0))}return r==e?e:Zu.create(t,e.changes,e.selection,r.effects,r.annotations,r.scrollIntoView)}var id=[];function ad(e){return e==null?id:Array.isArray(e)?e:[e]}var od=(function(e){return e[e.Word=0]=`Word`,e[e.Space=1]=`Space`,e[e.Other=2]=`Other`,e})(od||={}),sd=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/,cd;try{cd=RegExp(`[\\p{Alphabetic}\\p{Number}_]`,`u`)}catch{}function ld(e){if(cd)return cd.test(e);for(let t=0;t<e.length;t++){let n=e[t];if(/\w/.test(n)||n>``&&(n.toUpperCase()!=n.toLowerCase()||sd.test(n)))return!0}return!1}function ud(e){return t=>{if(!/\S/.test(t))return od.Space;if(ld(t))return od.Word;for(let n=0;n<e.length;n++)if(t.indexOf(e[n])>-1)return od.Word;return od.Other}}var dd=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++)Ru(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 Ru(this,n),zu(this,n)}update(...e){return td(this,e,!0)}applyTransaction(t){let n=this.config,{base:r,compartments:i}=n;for(let e of t.effects)e.is(Pu.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(Xu.reconfigure)?(n=null,r=e.value):e.is(Xu.appendConfig)&&(n=null,r=ad(r).concat(e.value));let a;n?a=t.startState.values.slice():(n=Iu.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(Vu)?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:U.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=ad(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=Xu.mapEffects(a,c).concat(Xu.mapEffects(ad(o.effects),l))}return{changes:r,selection:U.create(i,t.mainIndex),effects:a}}changes(t=[]){return t instanceof pu?t:pu.of(t,this.doc.length,this.facet(e.lineSeparator))}toText(t){return H.of(t.split(this.facet(e.lineSeparator)||uu))}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:(Ru(this,t),zu(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 ku&&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:U.fromJSON(t.selection),extensions:n.extensions?i.concat([n.extensions]):i})}static create(t={}){let n=Iu.resolve(t.extensions||[],new Map),r=t.doc instanceof H?t.doc:H.of((t.doc||``).split(n.staticFacet(e.lineSeparator)||uu)),i=t.selection?t.selection instanceof U?t.selection:U.single(t.selection.anchor,t.selection.head):U.single(0);return xu(i,r.length),n.staticFacet(Vu)||(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)||`
|
|
14
|
+
`}get readOnly(){return this.facet(Ku)}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(Bu))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 ud(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=iu(t,a,!1);if(i(t.slice(e,a))!=od.Word)break;a=e}for(;o<r;){let e=iu(t,o);if(i(t.slice(o,e))!=od.Word)break;o=e}return a==o?null:U.range(a+n,o+n)}};dd.allowMultipleSelections=Vu,dd.tabSize=W.define({combine:e=>e.length?e[0]:4}),dd.lineSeparator=Hu,dd.readOnly=Ku,dd.phrases=W.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])}}),dd.languageData=Bu,dd.changeFilter=Uu,dd.transactionFilter=Wu,dd.transactionExtender=Gu,Pu.reconfigure=Xu.define();function fd(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 pd=class{eq(e){return this==e}range(e,t=e){return hd.create(e,t,this)}};pd.prototype.startSide=pd.prototype.endSide=0,pd.prototype.point=!1,pd.prototype.mapMode=du.TrackDel;function md(e,t){return e==t||e.constructor==t.constructor&&e.eq(t)}var hd=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 gd(e,t){return e.from-t.from||e.value.startSide-t.value.startSide}var _d=class e{constructor(e,t,n,r){this.from=e,this.to=t,this.value=n,this.maxPoint=r}get length(){return yd(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}}},vd=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(gd)),this.isEmpty)return n.length?e.of(n):this;let s=new Cd(this,null,-1).goto(0),c=0,l=[],u=new xd;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(hd.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 xd,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?[yd(r)+yd(n).length,yd(yd(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 wd.from([this]).goto(e)}get isEmpty(){return this.nextLayer==this}static iter(e,t=0){return wd.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=Sd(a,o,n),c=new Ed(a,s,i),l=new Ed(o,s,i);n.iterGaps((e,t,n)=>Dd(c,e,l,t,n,r)),n.empty&&n.length==0&&Dd(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=Sd(i,a),s=new Ed(i,o,0).goto(n),c=new Ed(a,o,0).goto(n);for(;;){if(s.to!=c.to||!Od(s.active,c.active)||s.point&&(!c.point||!md(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 Ed(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 xd;for(let r of e instanceof hd?[e]:t?bd(e):e)n.add(r.from,r.to,r.value);return n.finish()}static join(t){if(!t.length)return e.empty;let n=yd(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}};vd.empty=new vd([],[],null,-1);function yd(e){return e[e.length-1]}function bd(e){if(e.length>1)for(let t=e[0],n=1;n<e.length;n++){let r=e[n];if(gd(t,r)>0)return e.slice().sort(gd);t=r}return e}vd.empty.nextLayer=vd.empty;var xd=class e{finishChunk(e){this.chunks.push(new _d(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(vd.empty)}finishInner(e){if(this.from.length&&this.finishChunk(!1),this.chunks.length==0)return e;let t=vd.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(e):e,this.setMaxPoint);return this.from=null,t}};function Sd(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 Cd=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}},wd=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 Cd(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--)Td(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--)Td(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(),Td(this.heap,0)}}};function Td(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 Ed=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=wd.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){kd(this.active,e),kd(this.activeTo,e),kd(this.activeRank,e),this.minActive=jd(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++;Ad(this.active,t,n),Ad(this.activeTo,t,r),Ad(this.activeRank,t,i),e&&Ad(e,t,this.cursor.from),this.minActive=jd(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&&kd(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 Dd(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&&md(e.point,n.point)&&Od(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&&!Od(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 Od(e,t){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!=t[n]&&!md(e[n],t[n]))return!1;return!0}function kd(e,t){for(let n=t,r=e.length-1;n<r;n++)e[n]=e[n+1];e.pop()}function Ad(e,t,n){for(let n=e.length-1;n>=t;n--)e[n+1]=e[n];e[t]=n}function jd(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 Md(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=iu(e,i));return r}function Nd(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=iu(e,r)}return r===!0?-1:e.length}for(var Pd=`ͼ`,Fd=typeof Symbol>`u`?`__ͼ`:Symbol.for(Pd),Id=typeof Symbol>`u`?`__styleSet`+Math.floor(Math.random()*1e8):Symbol(`styleSet`),Ld=typeof globalThis<`u`?globalThis:typeof window<`u`?window:{},Rd=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(`
|
|
15
|
+
`)}static newName(){let e=Ld[Fd]||1;return Ld[Fd]=e+1,Pd+e.toString(36)}static mount(e,t,n){let r=e[Id],i=n&&n.nonce;r?i&&r.setNonce(i):r=new Bd(e,i),r.mount(Array.isArray(t)?t:[t],e)}},zd=new Map,Bd=class{constructor(e,t){let n=e.ownerDocument||e,r=n.defaultView;if(!e.head&&e.adoptedStyleSheets&&r.CSSStyleSheet){let t=zd.get(n);if(t)return e[Id]=t;this.sheet=new r.CSSStyleSheet,zd.set(n,this)}else this.styleTag=n.createElement(`style`),t&&this.styleTag.setAttribute(`nonce`,t);this.modules=[],e[Id]=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()+`
|
|
16
|
+
`;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)}},Vd={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:`'`},Hd={48:`)`,49:`!`,50:`@`,51:`#`,52:`$`,53:`%`,54:`^`,55:`&`,56:`*`,57:`(`,59:`:`,61:`+`,173:`_`,186:`:`,187:`+`,188:`<`,189:`_`,190:`>`,191:`?`,192:`~`,219:`{`,220:`|`,221:`}`,222:`"`},Ud=typeof navigator<`u`&&/Mac/.test(navigator.platform),Wd=typeof navigator<`u`&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),Gd=0;Gd<10;Gd++)Vd[48+Gd]=Vd[96+Gd]=String(Gd);for(var Gd=1;Gd<=24;Gd++)Vd[Gd+111]=`F`+Gd;for(var Gd=65;Gd<=90;Gd++)Vd[Gd]=String.fromCharCode(Gd+32),Hd[Gd]=String.fromCharCode(Gd);for(var Kd in Vd)Hd.hasOwnProperty(Kd)||(Hd[Kd]=Vd[Kd]);function qd(e){var t=!(Ud&&e.metaKey&&e.shiftKey&&!e.ctrlKey&&!e.altKey||Wd&&e.shiftKey&&e.key&&e.key.length==1||e.key==`Unidentified`)&&e.key||(e.shiftKey?Hd:Vd)[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 Jd(){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++)Yd(e,arguments[t]);return e}function Yd(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++)Yd(e,t[n]);else throw RangeError(`Unsupported child node: `+t)}}var Xd=typeof navigator<`u`?navigator:{userAgent:``,vendor:``,platform:``},Zd=typeof document<`u`?document:{documentElement:{style:{}}},Qd=/Edge\/(\d+)/.exec(Xd.userAgent),$d=/MSIE \d/.test(Xd.userAgent),ef=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Xd.userAgent),tf=!!($d||ef||Qd),nf=!tf&&/gecko\/(\d+)/i.test(Xd.userAgent),rf=!tf&&/Chrome\/(\d+)/.exec(Xd.userAgent),af=`webkitFontSmoothing`in Zd.documentElement.style,of=!tf&&/Apple Computer/.test(Xd.vendor),sf=of&&(/Mobile\/\w+/.test(Xd.userAgent)||Xd.maxTouchPoints>2),G={mac:sf||/Mac/.test(Xd.platform),windows:/Win/.test(Xd.platform),linux:/Linux|X11/.test(Xd.platform),ie:tf,ie_version:$d?Zd.documentMode||6:ef?+ef[1]:Qd?+Qd[1]:0,gecko:nf,gecko_version:nf?+(/Firefox\/(\d+)/.exec(Xd.userAgent)||[0,0])[1]:0,chrome:!!rf,chrome_version:rf?+rf[1]:0,ios:sf,android:/Android\b/.test(Xd.userAgent),webkit:af,webkit_version:af?+(/\bAppleWebKit\/(\d+)/.exec(Xd.userAgent)||[0,0])[1]:0,safari:of,safari_version:of?+(/\bVersion\/(\d+(\.\d+)?)/.exec(Xd.userAgent)||[0,0])[1]:0,tabSize:Zd.documentElement.style.tabSize==null?`-moz-tab-size`:`tab-size`};function cf(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 lf=Object.create(null);function uf(e,t,n){if(e==t)return!0;e||=lf,t||=lf;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 df(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 ff(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 pf(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 mf=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){}},hf=(function(e){return e[e.Text=0]=`Text`,e[e.WidgetBefore=1]=`WidgetBefore`,e[e.WidgetAfter=2]=`WidgetAfter`,e[e.WidgetRange=3]=`WidgetRange`,e})(hf||={}),gf=class extends pd{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 _f(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 yf(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}=bf(e,t);n=(i?t?-3e8:-1:5e8)-1,r=(a?t?2e8:1:-6e8)+1}return new yf(e,n,r,t,e.widget||null,!0)}static line(e){return new vf(e)}static set(e,t=!1){return vd.of(e,t)}hasHeight(){return this.widget?this.widget.estimatedHeight>-1:!1}};gf.none=vd.empty;var _f=class e extends gf{constructor(e){let{start:t,end:n}=bf(e);super(t?-1:5e8,n?1:-6e8,null,e),this.tagName=e.tagName||`span`,this.attrs=e.class&&e.attributes?cf(e.attributes,{class:e.class}):e.class?{class:e.class}:e.attributes||lf}eq(t){return this==t||t instanceof e&&this.tagName==t.tagName&&uf(this.attrs,t.attrs)}range(e,t=e){if(e>=t)throw RangeError(`Mark decorations may not be empty`);return super.range(e,t)}};_f.prototype.point=!1;var vf=class e extends gf{constructor(e){super(-2e8,-2e8,null,e)}eq(t){return t instanceof e&&this.spec.class==t.spec.class&&uf(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)}};vf.prototype.mapMode=du.TrackBefore,vf.prototype.point=!0;var yf=class e extends gf{constructor(e,t,n,r,i,a){super(t,n,i,e),this.block=r,this.isReplace=a,this.mapMode=r?t<=0?du.TrackBefore:du.TrackAfter:du.TrackDel}get type(){return this.startSide==this.endSide?this.startSide<=0?hf.WidgetBefore:hf.WidgetAfter:hf.WidgetRange}get heightRelevant(){return this.block||!!this.widget&&(this.widget.estimatedHeight>=5||this.widget.lineBreaks>0)}eq(t){return t instanceof e&&xf(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)}};yf.prototype.point=!0;function bf(e,t=!1){let{inclusiveStart:n,inclusiveEnd:r}=e;return n??=e.inclusive,r??=e.inclusive,{start:n??t,end:r??t}}function xf(e,t){return e==t||!!(e&&t&&e.compare(t))}function Sf(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 Cf=class e extends pd{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&&uf(this.attributes,t.attributes)}static create(t){return new e(t.tagName,t.attributes||lf,t.rank==null?50:Math.max(0,Math.min(t.rank,100)))}static set(e,t=!1){return vd.of(e,t)}};Cf.prototype.startSide=Cf.prototype.endSide=-1;var wf=e=>e.nodeType==1,Tf=e=>e.nodeType==3;function Ef(e){let t;return t=e.nodeType==11?e.getSelection?e:e.ownerDocument:e,t.getSelection()}function Df(e,t){return t?e==t||e.contains(t.nodeType==1?t:t.parentNode):!1}function Of(e,t){if(!t.anchorNode)return!1;try{return Df(e,t.anchorNode)}catch{return!1}}function kf(e){return Tf(e)?Kf(e,0,e.nodeValue.length).getClientRects():wf(e)?e.getClientRects():[]}function Af(e,t,n,r){return n?Nf(e,t,n,r,-1)||Nf(e,t,n,r,1):!1}function jf(e){for(var t=0;;t++)if(e=e.previousSibling,!e)return t}function Mf(e){return wf(e)&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(e.nodeName)}function Nf(e,t,n,r,i){for(;;){if(e==n&&t==r)return!0;if(t==(i<0?0:Pf(e))){if(e.nodeName==`DIV`)return!1;let n=e.parentNode;if(!n||!wf(n))return!1;t=jf(e)+(i<0?0:1),e=n}else if(wf(e)){if(e=e.childNodes[t+(i<0?-1:0)],wf(e)&&(e.nodeName==`IMG`||e.nodeName==`BR`||e.contentEditable==`false`))return!1;t=i<0?Pf(e):0}else return!1}}function Pf(e){return Tf(e)?e.nodeValue.length:e.childNodes.length}function Ff(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 If(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 Lf(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 Rf(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(wf(u)){let e,f=u==c.body,p=1,m=1;if(f)e=If(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}=Lf(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 zf(e,t=!0){let n=e.ownerDocument,r=null,i=null;for(let a=e.parentNode;a&&!(a==n.body||(!t||r)&&i);)if(wf(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 Bf=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?Pf(t):0),n,Math.min(e.focusOffset,n?Pf(n):0))}set(e,t,n,r){this.anchorNode=e,this.anchorOffset=t,this.focusNode=n,this.focusOffset=r}};function Vf(e){let t=[];for(let n=e;n;n=n.nodeType==11?n.host:n.parentNode)wf(n)&&t.push({node:n,left:n.scrollLeft,top:n.scrollTop});return t}function Hf(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 Uf=null;G.safari&&G.safari_version>=26&&(Uf=!1);function Wf(e){if(e.setActive)return e.setActive();if(Uf)return e.focus(Uf);let t=Vf(e);e.focus(Uf==null?{get preventScroll(){return Uf={preventScroll:!0},!0}}:void 0),Uf||(Uf=!1,Hf(t))}var Gf;function Kf(e,t,n=t){let r=Gf||=document.createRange();return r.setEnd(e,n),r.setStart(e,t),r}function qf(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 Jf(e){for(;e;){if(e&&(e.nodeType==9||e.nodeType==11&&e.host))return e;e=e.assignedSlot||e.parentNode}return null}function Yf(e,t){let n=t.focusNode,r=t.focusOffset;if(!n||t.anchorNode!=n||t.anchorOffset!=r)return!1;for(r=Math.min(r,Pf(n));;)if(r){if(!wf(n))return!1;let e=n.childNodes[r-1];e.contentEditable==`false`?r--:(n=e,r=Pf(n))}else if(n==e)return!0;else r=jf(n),n=n.parentNode}function Xf(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 Zf(e,t){for(let n=e,r=t;;)if(Tf(n)&&r>0)return{node:n,offset:r};else if(wf(n)&&r>0){if(n.contentEditable==`false`)return null;n=n.childNodes[r-1],r=Pf(n)}else if(n.parentNode&&!Mf(n))r=jf(n),n=n.parentNode;else return null}function Qf(e,t){for(let n=e,r=t;;)if(Tf(n)&&r<n.nodeValue.length)return{node:n,offset:r};else if(wf(n)&&r<n.childNodes.length){if(n.contentEditable==`false`)return null;n=n.childNodes[r],r=0}else if(n.parentNode&&!Mf(n))r=jf(n)+1,n=n.parentNode;else return null}var $f=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,jf(t),n)}static after(t,n){return new e(t.parentNode,jf(t)+1,n)}},ep=(function(e){return e[e.LTR=0]=`LTR`,e[e.RTL=1]=`RTL`,e})(ep||={}),tp=ep.LTR,np=ep.RTL;function rp(e){let t=[];for(let n=0;n<e.length;n++)t.push(1<<e[n]);return t}var ip=rp(`88888888888888888888888888888888888666888888787833333333337888888000000000000000000000000008888880000000000000000000000000088888888888888888888888888888888888887866668888088888663380888308888800000000000000000000000800000000000000000000000000000008`),ap=rp(`4444448826627288999999999992222222222222222222222222222222222222222222222229999999999999999999994444444444644222822222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222999999949999999229989999223333333333`),op=Object.create(null),sp=[];for(let e of[`()`,`[]`,`{}`]){let t=e.charCodeAt(0),n=e.charCodeAt(1);op[t]=n,op[n]=-t}function cp(e){return e<=247?ip[e]:1424<=e&&e<=1524?2:1536<=e&&e<=1785?ap[e-1536]:1774<=e&&e<=2220?4:8192<=e&&e<=8204?256:64336<=e&&e<=65023?4:1}var lp=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac\ufb50-\ufdff]/,up=class{get dir(){return this.level%2?np:tp}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 dp(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||!dp(r.inner,i.inner))return!1}return!0}var fp=[];function pp(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=cp(e.charCodeAt(t));i==512?i=n:i==8&&r==4&&(i=16),fp[t]=i==4?2:i,i&7&&(r=i),n=i}for(let e=o,t=c,r=c;e<s;e++){let i=fp[e];if(i==128)e<s-1&&t==fp[e+1]&&t&24?i=fp[e]=t:fp[e]=256;else if(i==64){let i=e+1;for(;i<s&&fp[i]==64;)i++;let a=e&&t==8||i<n&&fp[i]==8?r==1?1:8:256;for(let t=e;t<i;t++)fp[t]=a;e=i-1}else i==8&&r==1&&(fp[e]=1);t=i,i&7&&(r=i)}}}function mp(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=op[n=e.charCodeAt(t)]){if(r<0){for(let e=s-3;e>=0;e-=3)if(sp[e+1]==-r){let n=sp[e+2],r=n&2?i:n&4?n&1?a:i:0;r&&(fp[t]=fp[sp[e]]=r),s=e;break}}else if(sp.length==189)break;else sp[s++]=t,sp[s++]=n,sp[s++]=c}else if((o=fp[t])==2||o==1){let e=o==i;c=+!e;for(let t=s-3;t>=0;t-=3){let n=sp[t+2];if(n&2)break;if(e)sp[t+2]|=2;else{if(n&4)break;sp[t+2]|=4}}}}}function hp(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=fp[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(fp[o]==256)o++;else break;let l=a==1,u=l==((o<t?fp[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),fp[--t]=u;c=o}else a=o,c++}}}function gp(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=fp[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(fp[e]==s)break run;else break}l++,d?d.push(m):(m.from>c&&o.push(new up(c,m.from,f)),_p(e,m.direction==tp==!(f%2)?r:r+1,i,m.inner,m.from,m.to,o),c=m.to),p=m.to}else if(p==n||(t?fp[p]!=s:fp[p]==s))break;else p++;d?gp(e,c,p,r+1,i,d,o):c<p&&o.push(new up(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=fp[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(fp[e-1]==s)break run;else break}d?d.push(m):(m.to<c&&o.push(new up(m.to,c,f)),_p(e,m.direction==tp==!(f%2)?r:r+1,i,m.inner,m.from,m.to,o),c=m.from),p=m.from}else if(p==t||(n?fp[p-1]!=s:fp[p-1]==s))break;else p--;d?gp(e,p,c,r+1,i,d,o):p<c&&o.push(new up(p,c,f)),c=p}}function _p(e,t,n,r,i,a,o){let s=t%2?2:1;pp(e,i,a,r,s),mp(e,i,a,r,s),hp(i,a,r,s),gp(e,i,a,t,n,r,o)}function vp(e,t,n){if(!e)return[new up(0,0,+(t==np))];if(t==tp&&!n.length&&!lp.test(e))return yp(e.length);if(n.length)for(;e.length>fp.length;)fp[fp.length]=256;let r=[],i=t==tp?0:1;return _p(e,i,i,n,0,e.length,r),r}function yp(e){return[new up(0,e,0)]}var bp=``;function xp(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=up.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=iu(e.text,a,s.forward(i,n));(l<s.from||l>s.to)&&(l=c),bp=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?U.cursor(e.to,1):U.cursor(e.from,-1);if(u.level+ +!i<s.level)return U.cursor(u.side(!i,n)+e.from,u.forward(i,n)?1:-1,u.level)}return U.cursor(l+e.from,s.forward(i,n)?-1:1,s.level)}function Sp(e,t,n){for(let r=t;r<n;r++){let t=cp(e.charCodeAt(r));if(t==1)return tp;if(t==2||t==4)return np}return tp}var Cp=W.define(),wp=W.define(),Tp=W.define(),Ep=W.define(),Dp=W.define(),Op=W.define(),kp=W.define(),Ap=W.define(),jp=W.define(),Mp=W.define({combine:e=>e.some(e=>e)}),Np=W.define({combine:e=>e.some(e=>e)}),Pp=W.define(),Fp=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(U.cursor(t.doc.length),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}},Ip=Xu.define({map:(e,t)=>e.map(t)}),Lp=Xu.define();function Rp(e,t,n){let r=e.facet(Ep);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 zp=W.define({combine:e=>!e.length||e[0]}),Bp=0,Vp=W.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})}}),Hp=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(Vp.of({plugin:this,arg:void 0}))}of(e){return this.baseExtensions.concat(Vp.of({plugin:this,arg:e}))}static define(t,n){let{eventHandlers:r,eventObservers:i,provide:a,decorations:o}=n||{};return new e(Bp++,t,r,i,e=>{let t=[];return o&&t.push(Kp.of(t=>{let n=t.plugin(e);return n?o(n):gf.none})),a&&t.push(a(e)),t})}static fromClass(t,n){return e.define((e,n)=>new t(e,n),n)}},Up=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){Rp(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(Rp(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){Rp(e.state,t,`CodeMirror plugin crashed`)}}deactivate(){this.spec=this.value=null}},Wp=W.define(),Gp=W.define(),Kp=W.define(),qp=W.define(),Jp=W.define(),Yp=W.define(),Xp=W.define();function Zp(e,t){let n=e.state.facet(Xp);if(!n.length)return n;let r=n.map(t=>t instanceof Function?t(e):t),i=[];return vd.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??=Sp(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 Qp=W.define();function $p(e){let t=0,n=0,r=0,i=0;for(let a of e.state.facet(Qp)){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 em=W.define(),tm=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}},nm=class e{constructor(e,t,n){this.view=e,this.state=t,this.transactions=n,this.flags=0,this.startState=e.state,this.changes=pu.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 tm(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}},rm=[],im=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 rm}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&&df(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=jf(this.dom),r=this.length?e>0:t>0;return new $f(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 sm)return e;return null}static get(e){return e.cmTile}},am=class extends im{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=om(r);else t.insertBefore(o.dom,r);n=o.dom}for(r=n?n.nextSibling:t.firstChild,i&&r&&(i.written=!0);r;)r=om(r);this.length=a}};function om(e){let t=e.nextSibling;return e.parentNode.removeChild(e),t}var sm=class extends am{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=im.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 cm)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}}},cm=class e extends am{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}},lm=class e extends am{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&&dm(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):um(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 $f(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 $f(e.dom,0);e==n.tile&&(a=!0)}}return new $f(this.dom,0)}};function um(e){let t=e.dom.lastChild;if(!t)return e.dom.getBoundingClientRect();let n=kf(t);return n[n.length-1]||null}function dm(e,t){let n=e.coordsIn(0,1),r=t.coordsIn(0,1);return n&&r&&r.top<n.bottom}var fm=class e extends am{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}},pm=class e extends im{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?G.chrome||G.gecko||(e?(i--,o=1):a<r&&(a++,o=-1)):t<0?i--:a<r&&a++;let s=Kf(this.dom,i,a).getClientRects();if(!s.length)return null;let c=s[(o?o<0:t>=0)?0:s.length-1];return G.safari&&!o&&c.width==0&&(c=Array.prototype.find.call(s,e=>e.width)||c),n==null?c:Ff(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}},mm=class e extends im{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 Ff(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 Ff(n,!r)}}get overrideDOMText(){if(!this.length)return H.empty;let{root:e}=this;if(!e)return H.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)}},hm=class extends im{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 H.empty}coordsIn(e,t,n){let r=this.dom.getBoundingClientRect();return n==null?r:Ff(r,t>0==n)}},gm=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}},_m=class{constructor(e,t,n,r){this.from=e,this.to=t,this.wrapper=n,this.rank=r}},vm=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 pm(a.dom,a.text+e);t.parent=i}else i.append(r||pm.of(e,this.cache.find(pm)?.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)?Om(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 fm&&i.mark.eq(n.mark))i.dom!=n.dom&&i.setDOM(Om(n.dom)),r=i;else{let{dom:e}=n;this.cache.reused.get(n)&&im.get(n.dom)&&(e=Om(n.dom));let t=fm.of(n.mark,e);r.append(t),r=t}this.cache.reused.set(n,2)}let i=im.get(e.text);i&&this.cache.reused.set(i,2);let a=new pm(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||=Tm;let n=lm.start(e,t||this.cache.find(lm)?.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 fm&&a.mark.eq(i))n=a,t--;else{let e=fm.of(i,this.cache.find(fm,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||!Cm(this.curLine,!1)||e.dom.nodeName!=`BR`&&e.isWidget()&&!(G.ios&&Cm(this.curLine,!0)))&&this.curLine.append(this.cache.findWidget(Am,0,32)||new mm(Am.toDOM(),0,Am,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 _m(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 cm&&n.wrapper.eq(t.wrapper))e=n;else{let n=cm.of(t.wrapper,this.cache.find(cm,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(hm,void 0,1);return n&&(n.flags=t),n||new hm(t)}flushBuffer(){this.afterWidget&&!(this.afterWidget.flags&32)&&(this.afterWidget.parent.append(this.getBuffer(-1)),this.afterWidget=null)}},ym=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}},bm=[mm,lm,pm,fm,hm,cm,sm];for(let e=0;e<bm.length;e++)bm[e].bucket=e;var xm=class{constructor(e){this.view=e,this.buckets=bm.map(()=>[]),this.index=bm.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 mm(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}},Sm=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 xm(e),this.text=new ym(e.state.doc),this.builder=new vm(this.cache,new sm(e,e.contentDOM),vd.iter(n)),this.cache.reused.set(t,2),this.old=new gm(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=Dm(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?mm.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 hm)this.cache.add(e);else if(e instanceof fm)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 fm&&r.unshift(e.mark)),this.openWidget=!1},leave:e=>{e.isLine()?r.length&&=i=0:e instanceof fm&&(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=vd.spans(this.decorations,e,t,{point:(e,t,a,o,s,c)=>{if(a instanceof yf){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?km.block:km.inline),c=wm(a),l=this.cache.findWidget(i,t-e,c)||mm.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=Em(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=im.get(r);if(r==this.view.contentDOM)break;e instanceof fm?t.push(e):e?.isLine()?n=e:e instanceof cm||(r.nodeName==`DIV`&&!n?n=new lm(r,Tm):n||t.push(fm.of(new _f({tagName:r.nodeName.toLowerCase(),attributes:pf(r)}),r)))}return n?{line:n,marks:t}:null}};function Cm(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 wm(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 Tm={class:`cm-line`};function Em(e,t){let n=t.spec.attributes,r=t.spec.class;return!n&&!r?e:(e||={class:`cm-line`},n&&cf(n,e),r&&(e.class+=` `+r),e)}function Dm(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 fm&&t.push(r.mark)}return t}function Om(e){let t=im.get(e);return t&&t.setDOM(e.cloneNode()),e}var km=class extends mf{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}};km.inline=new km(`span`),km.block=new km(`div`);var Am=new class extends mf{toDOM(){return document.createElement(`br`)}get isHidden(){return!0}get editable(){return!0}},jm=class{constructor(e){this.view=e,this.decorations=[],this.blockWrappers=[],this.dynamicDecorationMap=[!1],this.domChanged=null,this.hasComposition=null,this.editContextFormatting=gf.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 sm(e,e.contentDOM),this.updateInner([new tm(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:!Hm(e.changes,this.hasComposition)&&!e.selectionSet&&(n=e.state.selection.main.head));let r=n>-1?Fm(this.view,e.changes,n):null;if(this.domChanged=null,this.hasComposition){let{from:n,to:r}=this.hasComposition;t=new tm(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,(G.ie||G.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=Rm(i,this.decorations,e.changes);o.length&&(t=tm.extendWithRanges(t,o));let s=Bm(a,this.blockWrappers,e.changes);return s.length&&(t=tm.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 Sm(this.view,n,this.blockWrappers,this.decorations,this.dynamicDecorationMap);t&&im.get(t.text)&&r.cache.reused.set(im.get(t.text),2),this.tile=r.run(e,t),Mm(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=G.chrome||G.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 Um&&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(Lp)&&(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(zp)||n.tabIndex>-1)&&Of(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)),G.gecko&&s.empty&&!this.hasComposition&&Nm(c)){let e=document.createTextNode(``);this.view.observer.ignore(()=>c.node.insertBefore(e,c.node.childNodes[c.offset]||null)),c=l=new $f(e,0),o=!0}let u=this.view.observer.selectionRange;(o||!u.focusNode||(!Af(c.node,c.offset,u.anchorNode,u.anchorOffset)||!Af(l.node,l.offset,u.focusNode,u.focusOffset))&&!this.suppressWidgetCursorChange(u,s))&&(this.view.observer.ignore(()=>{G.android&&G.chrome&&n.contains(u.focusNode)&&Vm(u.focusNode,n)&&(n.blur(),n.focus({preventScroll:!0}));let e=Ef(this.view.root);if(e){if(s.empty){if(G.gecko){let e=Im(c.node,c.offset);if(e&&e!=3){let t=(e==1?Zf:Qf)(c.node,c.offset);t&&(c=new $f(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 $f(u.anchorNode,u.anchorOffset),this.impreciseHead=l.precise?null:new $f(u.focusNode,u.focusOffset)}suppressWidgetCursorChange(e,t){return this.hasComposition&&t.empty&&Af(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=Ef(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=Pf(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&&!im.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 Um?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=iu(e.text,t);if(n==t)return null;let r=Kf(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==ep.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 cm)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?kf(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`?ep.RTL:ep.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=kf(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=kf(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(gf.replace({widget:new Um(r),block:!0,inclusive:!0,isBlockGap:!0}).range(n,a))}if(!i)break;n=i.to+1}return gf.set(e)}updateDeco(){let e=1,t=this.view.state.facet(Kp).map(t=>(this.dynamicDecorationMap[e++]=typeof t==`function`)?t(this.view):t),n=!1,r=this.view.state.facet(Jp).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(vd.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(qp).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(Pp))try{if(t(this.view,e.range,e))return!0}catch(e){Rp(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=$p(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(Rf(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==ep.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=Vf(e.dom);e.dom.scrollIntoView({block:`nearest`}),Hf(t,!1)}}}lineHasWidget(e){let t=e=>e.isWidget()||e.children.some(t);return t(this.tile.resolveBlock(e,1).tile)}destroy(){Mm(this.tile)}};function Mm(e,t){let n=t?.get(e);if(n!=1){n??e.destroy();for(let n of e.children)Mm(n,t)}}function Nm(e){return wf(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 Pm(e,t){let n=e.observer.selectionRange;if(!n.focusNode)return null;let r=Zf(n.focusNode,n.focusOffset),i=Qf(n.focusNode,n.focusOffset),a=r||i;if(i&&r&&i.node!=r.node){let t=im.get(i.node);if(!t||t.isText()&&t.text!=i.node.nodeValue)a=i;else if(e.docView.lastCompositionAfterCursor){let e=im.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 Fm(e,t,n){let r=Pm(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 tm(c.mapPos(a),c.mapPos(o),a,o),text:i}}function Im(e,t){return wf(e)?(t&&e.childNodes[t-1].contentEditable==`false`?1:0)|(t<e.childNodes.length&&e.childNodes[t].contentEditable==`false`?2:0):0}var Lm=class{constructor(){this.changes=[]}compareRange(e,t){Sf(e,t,this.changes)}comparePoint(e,t){Sf(e,t,this.changes)}boundChange(e){Sf(e,e,this.changes)}};function Rm(e,t,n){let r=new Lm;return vd.compare(e,t,n,r),r.changes}var zm=class{constructor(){this.changes=[]}compareRange(e,t){Sf(e,t,this.changes)}comparePoint(){}boundChange(e){Sf(e,e,this.changes)}};function Bm(e,t,n){let r=new zm;return vd.compare(e,t,n,r),r.changes}function Vm(e,t){for(let n=e;n&&n!=t;n=n.assignedSlot||n.parentNode)if(wf(n)&&n.contentEditable==`false`)return!0;return!1}function Hm(e,t){let n=!1;return t&&e.iterChangedRanges((e,r)=>{e<t.to&&r>t.from&&(n=!0)}),n}var Um=class extends mf{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 Wm(e,t,n=1){let r=e.charCategorizer(t),i=e.doc.lineAt(t),a=t-i.from;if(i.length==0)return U.cursor(t);a==0?n=1:a==i.length&&(n=-1);let o=a,s=a;n<0?o=iu(i.text,a,!1):s=iu(i.text,a);let c=r(i.text.slice(o,s));for(;o>0;){let e=iu(i.text,o,!1);if(r(i.text.slice(e,o))!=c)break;o=e}for(;s<i.length;){let e=iu(i.text,s);if(r(i.text.slice(s,e))!=c)break;s=e}return U.undirectionalRange(o+i.from,s+i.from)}function Gm(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+Nd(o,a,e.state.tabSize)}function Km(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==hf.Text&&(e.type!=i.type||(n<0?i.from<t:i.to>t)))&&(e=i)}}return e||r}return r}function qm(e,t,n,r){let i=Km(e,t.head,t.assoc||-1),a=!r||i.type!=hf.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==ep.LTR)?t.right-1:t.left+1,y:(a.top+a.bottom)/2});if(o!=null)return U.cursor(o,n?-1:1)}return U.cursor(n?i.to:i.from,n?-1:1)}function Jm(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=xp(i,a,o,s,n),l=bp;if(!t){if(i.number==(n?e.state.doc.lines:1))return s;l=`
|
|
17
|
+
`,i=e.state.doc.line(i.number+(n?1:-1)),a=e.bidiSpans(i),t=n?U.cursor(i.from,-1):U.cursor(i.to,1)}if(!c){if(!r)return t;c=r(l)}else if(!c(l))return s;s=t}}function Ym(e,t,n){let r=e.state.charCategorizer(t),i=r(n);return e=>{let t=r(e);return i==od.Space&&(i=t),i==t}}function Xm(e,t,n,r){let i=t.head,a=n?1:-1;if(i==(n?e.state.doc.length:0))return U.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=th(e,{x:d,y:r},!1,a);if(n?r>c.bottom:r<c.top)return U.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 U.cursor(i.pos,i.assoc,void 0,o)}}function Zm(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 Qm(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=Zm(e,i.from,0);t!=i.from&&(a=U.cursor(t,-1))}else{let t=Zm(e,i.from,-1),n=Zm(e,i.to,1);(t!=i.from||n!=i.to)&&(a=i.undirectional?U.undirectionalRange(i.from,i.to):U.range(i.from==i.anchor?t:n,i.from==i.head?t:n))}a&&(n||=t.ranges.slice(),n[r]=a)}return n?U.create(n,t.mainIndex):t}function $m(e,t,n){let r=Zm(e.state.facet(Yp).map(t=>t(e)),n.from,t.head>n.from?-1:1);return r==n.from?n:U.cursor(r,r<n.from?1:-1)}var eh=class{constructor(e,t){this.pos=e,this.assoc=t}};function th(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 eh(0,1);if(c>e.viewState.docHeight)return new eh(e.state.doc.length,-1);if(l=e.elementAtHeight(c),r==null)break;if(l.type==hf.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==hf.Text){let t=Gm(e,i,l,o,s);return new eh(t,t==l.from?1:-1)}}if(l.type!=hf.Text)return c<(l.top+l.bottom)/2?new eh(l.from,1):new eh(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 nh(e,o,s,e.textDirectionAt(l.from)).scanTile(u,l.from)}var nh=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[up.find(r,e-n.from,-1,t)].level==this.baseDir}dirAt(e,t){let{line:n,spans:r}=this.bidiSpansAt(e);return r[up.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==ep.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)==ep.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=iu(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 Kf(e.dom,i,a).getClientRects()});return r.after?new eh(n[r.i+1],-1):new eh(n[r.i],1)}scanTile(e,t){if(!e.length)return new eh(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:(wf(n.dom)?n.dom:Kf(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 eh(n[r.i+1],-1):new eh(a,1)}},rh=``,ih=class{constructor(e,t){this.points=e,this.view=t,this.text=``,this.lineSeparator=t.state.facet(dd.lineSeparator)}append(e){this.text+=e}lineBreak(){this.text+=rh}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=im.get(r),a=r.nextSibling;if(a==t){i?.breakAfter&&!a&&n!=this.view.contentDOM&&this.lineBreak();break}let o=im.get(a);(i&&o?i.breakAfter:(i?i.breakAfter:Mf(r))||Mf(a)&&(r.nodeName!=`BR`||i?.isWidget())&&this.text.length>e)&&!oh(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=im.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 Tf(e)?this.readTextNode(e):e.nodeName==`BR`?e.nextSibling&&this.lineBreak():wf(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)(Tf(e)?n.node==e:e.contains(n.node))&&(n.pos=this.text.length+(ah(e,n.node,n.offset)?t:0))}};function ah(e,t,n){for(;;){if(!t||n<Pf(t))return!1;if(t==e)return!0;n=jf(t)+1,t=t.parentNode}}function oh(e,t){let n;for(;e!=t&&e;e=e.nextSibling){let t=im.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 sh=class{constructor(e,t){this.node=e,this.offset=t,this.pos=-1}},ch=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=lh(e.docView.tile,t,n,0))){let t=i||a?[]:mh(e),n=new ih(t,e);n.readRange(this.bounds.startDOM,this.bounds.endDOM),this.text=n.text,this.newSel=hh(t,this.bounds.from)}else{let t=e.observer.selectionRange,n=i&&i.node==t.focusNode&&i.offset==t.focusOffset||!Df(e.contentDOM,t.focusNode)?o.main.head:e.docView.posFromDOM(t.focusNode,t.focusOffset),r=a&&a.node==t.anchorNode&&a.offset==t.anchorOffset||!Df(e.contentDOM,t.anchorNode)?o.main.anchor:e.docView.posFromDOM(t.anchorNode,t.anchorOffset),s=e.viewport;if((G.ios||G.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(U.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=U.create([U.cursor(n,r)])}else this.newSel=U.single(r,n)}}};function lh(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 lh(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 uh(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||G.android&&t.text.length<r-e)&&(s=a.to,c=`end`);let l=i.doc.sliceString(e,r,rh),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:H.of(t.text.slice(a.from-e,u).split(rh))}:(d=ph(l,t.text,s-e,c))&&(G.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:H.of(t.text.slice(d.from,d.toB).split(rh))})}else r&&(!e.hasFocus&&i.facet(zp)||gh(r,a))&&(r=null);if(!n&&!r)return!1;if((G.mac||G.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=U.single(r.main.anchor-1,r.main.head-1)),n={from:n.from,to:n.to,insert:H.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)}:G.chrome&&n&&n.from==n.to&&n.from==a.head&&n.insert.toString()==`
|
|
18
|
+
`&&e.lineWrapping&&(r&&=U.single(r.main.anchor-1,r.main.head-1),n={from:a.from,to:a.to,insert:H.of([` `])}),n)return dh(e,n,r,o);if(r&&!gh(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=Qm(i.facet(Yp).map(t=>t(e)),r))),e.dispatch({selection:r,scrollIntoView:t,userEvent:n}),!0}return!1}function dh(e,t,n,r=-1){if(G.ios&&e.inputState.flushIOSKey(t))return!0;let i=e.state.selection.main;if(G.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&&qf(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)&&qf(e.contentDOM,`Backspace`,8)||t.from==i.from&&t.to==i.to+1&&t.insert.length==0&&qf(e.contentDOM,`Delete`,46)))return!0;let a=t.insert.toString();e.inputState.composing>=0&&e.inputState.composing++;let o,s=()=>o||=fh(e,t,n);return e.state.facet(Op).some(n=>n(e,t.from,t.to,a,s))||e.dispatch(s()),!0}function fh(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=Zm(i.facet(Yp).map(t=>t(e)),r,n);t.from==s&&(o=s)}if(o>-1)r={changes:t,selection:U.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&&Pm(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?U.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 ph(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 mh(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 sh(n,r)),(i!=n||a!=r)&&t.push(new sh(i,a))),t}function hh(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?U.create([U.cursor(r+t,-1)]):U.single(n+t,r+t)}function gh(e,t){return t.head==e.main.head&&t.anchor==e.main.anchor}var _h=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,G.safari&&e.contentDOM.addEventListener(`input`,()=>null),G.gecko&&eg(e.contentDOM.ownerDocument)}handleEvent(e){jh(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=bh(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&&Ch.indexOf(e.keyCode)<0&&(this.tabFocusMode=-1),G.android&&G.chrome&&!e.synthetic&&(e.keyCode==13||e.keyCode==8))return this.view.observer.delayAndroidKey(e.key,e.keyCode),!0;if(G.ios&&!e.synthetic&&!e.altKey&&!e.metaKey&&(xh.some(t=>t.keyCode==e.keyCode)&&!e.ctrlKey||Sh.indexOf(e.key)>-1&&e.ctrlKey)){let t={ctrlKey:e.ctrlKey,altKey:e.altKey,metaKey:e.metaKey,shiftKey:e.shiftKey};t.shiftKey&&G.ios&&!/^(off|none)$/.test(this.view.contentDOM.autocapitalize)&&vh(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,qf(this.view.contentDOM,t.key,t.keyCode,t.mods))}ignoreDuringComposition(e){return!/^key/.test(e.type)||e.synthetic?!1:this.composing>0?!0:G.safari&&!G.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 vh(e){return e.visualViewport?e.visualViewport.height*e.visualViewport.scale/e.document.documentElement.clientHeight<.85:!1}function yh(e,t){return(n,r)=>{try{return t.call(e,r,n)}catch(e){Rp(n.state,e)}}}function bh(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(yh(t.value,i))}if(i)for(let e in i){let r=i[e];r&&n(e).observers.push(yh(t.value,r))}}for(let e in Mh)n(e).handlers.push(Mh[e]);for(let e in Nh)n(e).observers.push(Nh[e]);return t}var xh=[{key:`Backspace`,keyCode:8,inputType:`deleteContentBackward`},{key:`Enter`,keyCode:13,inputType:`insertParagraph`},{key:`Enter`,keyCode:13,inputType:`insertLineBreak`},{key:`Delete`,keyCode:46,inputType:`deleteContentForward`}],Sh=`dthko`,Ch=[16,17,18,20,91,92,224,225],wh=6;function Th(e){return Math.max(0,e)*.7+8}function Eh(e,t){return Math.max(Math.abs(e.clientX-t.clientX),Math.abs(e.clientY-t.clientY))}var Dh=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=zf(e.contentDOM),this.atoms=e.state.facet(Yp).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(dd.allowMultipleSelections)&&Oh(e,t),this.dragging=Ah(e,t)&&Uh(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&&Eh(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=$p(this.view);e.clientX-s.left<=r+wh?t=-Th(r-e.clientX):e.clientX+s.right>=a-wh&&(t=Th(e.clientX-a)),e.clientY-s.top<=i+wh?n=-Th(i-e.clientY):e.clientY+s.bottom>=o-wh&&(n=Th(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=Qm(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 Oh(e,t){let n=e.state.facet(Cp);return n.length?n[0](t):G.mac?t.metaKey:t.ctrlKey}function kh(e,t){let n=e.state.facet(wp);return n.length?n[0](t):G.mac?!t.altKey:!t.ctrlKey}function Ah(e,t){let{main:n}=e.state.selection;if(n.empty)return!1;let r=Ef(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 jh(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=im.get(n))&&r.isWidget()&&!r.isHidden&&r.widget.ignoreEvent(t))return!1;return!0}var Mh=Object.create(null),Nh=Object.create(null),Ph=G.ie&&G.ie_version<15||G.ios&&G.webkit_version<604;function Fh(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(),Lh(e,n.value)},50)}function Ih(e,t,n){for(let r of e.facet(t))n=r(n,e);return n}function Lh(e,t){t=Ih(e.state,Ap,t);let{state:n}=e,r,i=1,a=n.toText(t),o=a.lines==n.selection.ranges.length;if(Yh!=null&&n.selection.ranges.every(e=>e.empty)&&Yh==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:U.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:U.cursor(e.from+t.length,-1)}}):n.replaceSelection(a);e.dispatch(r,{userEvent:`input.paste`,scrollIntoView:!0})}Nh.scroll=e=>{let t=e.inputState;t.lastScrollTop=e.scrollDOM.scrollTop,t.lastScrollLeft=e.scrollDOM.scrollLeft,G.ios&&!t.touchActive&&(t.lastIOSMomentumScroll=Date.now())},Nh.wheel=Nh.mousewheel=e=>{e.inputState.lastWheelEvent=Date.now()},Mh.keydown=(e,t)=>(e.inputState.setSelectionOrigin(`select`),t.keyCode==27&&e.inputState.tabFocusMode!=0&&(e.inputState.tabFocusMode=Date.now()+2e3),!1),Nh.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`)},Nh.touchmove=e=>{e.inputState.setSelectionOrigin(`select.pointer`)},Nh.touchend=(e,t)=>{e.inputState.touchActive=!1},Mh.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(Tp))if(n=r(e,t),n)break;if(!n&&t.button==0&&(n=Wh(e,t)),n){let r=!e.hasFocus;e.inputState.startMouseSelection(new Dh(e,t,n,r)),r&&e.observer.ignore(()=>{Wf(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 Rh(e,t,n,r){if(r==1)return U.cursor(t,n);if(r==2)return Wm(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++,U.undirectionalRange(a,o)}}var zh=G.ie&&G.ie_version<=11,Bh=null,Vh=0,Hh=0;function Uh(e){if(!zh)return e.detail;let t=Bh,n=Hh;return Bh=e,Hh=Date.now(),Vh=!t||n>Date.now()-400&&Math.abs(t.clientX-e.clientX)<2&&Math.abs(t.clientY-e.clientY)<2?(Vh+1)%3:1}function Wh(e,t){let n=e.posAndSideAtCoords({x:t.clientX,y:t.clientY},!1),r=Uh(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=Rh(e,s.pos,s.assoc,r);if(n.pos!=s.pos&&!a){let t=Rh(e,n.pos,n.assoc,r),i=Math.min(t.from,l.from),a=Math.max(t.to,l.to);l=i<l.from?U.range(i,a,l.assoc):U.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=Gh(i,s.pos))?c:o?i.addRange(l):U.create([l])}}}function Gh(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 U.create(e.ranges.slice(0,n).concat(e.ranges.slice(n+1)),e.mainIndex==n?0:e.mainIndex-+(e.mainIndex>n))}return null}Mh.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=U.undirectionalRange(e,t))}}let{inputState:r}=e;return r.mouseSelection&&(r.mouseSelection.dragging=!0),r.draggedContent=n,t.dataTransfer&&(t.dataTransfer.setData(`Text`,Ih(e.state,jp,e.state.sliceDoc(n.from,n.to))),t.dataTransfer.effectAllowed=`copyMove`),!1},Mh.dragend=e=>(e.inputState.draggedContent=null,!1);function Kh(e,t,n,r){if(n=Ih(e.state,Ap,n),!n)return;let i=e.posAtCoords({x:t.clientX,y:t.clientY},!1),{draggedContent:a}=e.inputState,o=r&&a&&kh(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}Mh.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&&Kh(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 Kh(e,t,n,!0),!0}return!1},Mh.paste=(e,t)=>{if(e.state.readOnly)return!0;e.observer.flush();let n=Ph?null:t.clipboardData;return n?(Lh(e,n.getData(`text/plain`)||n.getData(`text/uri-list`)),!0):(Fh(e),!1)};function qh(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 Jh(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:Ih(e,jp,t.join(e.lineBreak)),ranges:n,linewise:r}}var Yh=null;Mh.copy=Mh.cut=(e,t)=>{if(!Of(e.contentDOM,e.observer.selectionRange))return!1;let{text:n,ranges:r,linewise:i}=Jh(e.state);if(!n&&!i)return!1;Yh=i?n:null,t.type==`cut`&&!e.state.readOnly&&e.dispatch({changes:r,scrollIntoView:!0,userEvent:`delete.cut`});let a=Ph?null:t.clipboardData;return a?(a.clearData(),a.setData(`text/plain`,n),!0):(qh(e,n),!1)};var Xh=qu.define();function Zh(e,t){let n=[];for(let r of e.facet(kp)){let i=r(e,t);i&&n.push(i)}return n.length?e.update({effects:n,annotations:Xh.of(!0)}):null}function Qh(e){setTimeout(()=>{let t=e.hasFocus;if(t!=e.inputState.notifiedFocused){let n=Zh(e.state,t);n?e.dispatch(n):e.update([])}},10)}Nh.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),Qh(e)},Nh.blur=e=>{e.observer.clearSelectionRange(),Qh(e)},Nh.compositionstart=Nh.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}},Nh.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,G.chrome&&G.android?e.observer.flushSoon():e.inputState.compositionPendingChange?Promise.resolve().then(()=>e.observer.flush()):setTimeout(()=>{e.inputState.composing<0&&e.docView.hasComposition&&e.update([])},50))},Nh.contextmenu=e=>{e.inputState.lastContextMenu=Date.now()},Mh.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 dh(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(G.chrome&&G.android&&(n=xh.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 G.ios&&t.inputType==`deleteContentForward`&&e.observer.flushSoon(),G.safari&&t.inputType==`insertText`&&e.inputState.composing>=0&&setTimeout(()=>Nh.compositionend(e,t),20),!1};var $h=new Set;function eg(e){$h.has(e)||($h.add(e),e.addEventListener(`copy`,()=>{}),e.addEventListener(`cut`,()=>{}))}var tg=[`pre-wrap`,`normal`,`pre-line`,`break-spaces`],ng=!1;function rg(){ng=!1}var ig=class{constructor(e){this.lineWrapping=e,this.doc=H.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 tg.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=tg.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}},ag=class{constructor(e,t){this.from=e,this.heights=t,this.index=0}get more(){return this.index<this.heights.length}},og=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`?hf.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 yf?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)}},sg=(function(e){return e[e.ByPos=0]=`ByPos`,e[e.ByHeight=1]=`ByHeight`,e[e.ByPosNoHeight=2]=`ByPosNoHeight`,e})(sg||={}),cg=.001,lg=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)>cg&&(ng=!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,sg.ByPosNoHeight,n.setDoc(t),0,0),f=d.to>=c?d:i.lineAt(c,sg.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,sg.ByPosNoHeight,n,0,0));l+=d.from-s,s=d.from;let p=vg.build(n.setDoc(a),e,l,u);i=ug(i,i.replace(s,c,p))}return i.updateHeight(n,0)}static empty(){return new pg(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 hg(e.of(t.slice(0,n)),o,e.of(t.slice(r)))}};function ug(e,t){return e==t?e:(e.constructor!=t.constructor&&(ng=!0),t)}lg.prototype.size=1;var dg=gf.replace({}),fg=class extends lg{constructor(e,t,n){super(e,t),this.deco=n,this.spaceAbove=0}mainBlock(e,t){return new og(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 og(r,0,n,this.spaceAbove,dg):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,sg.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})`}},pg=class e extends fg{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 og(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 mg&&i.flags&4)&&Math.abs(this.length-i.length)<10?(i instanceof mg?i=new e(i.length,this.height,this.spaceAbove):i.height=this.height,this.outdated||(i.outdated=!1),i):lg.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:``})`}},mg=class e extends lg{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 og(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 og(s,c,n+o*r,o,0)}}lineAt(e,t,n,r,i){if(t==sg.ByHeight)return this.blockAt(e,n,r,i);if(t==sg.ByPosNoHeight){let{from:t,to:r}=n.doc.lineAt(e);return new og(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 og(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 og(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 lg.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)>=cg&&(s=-2);let c=new pg(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=lg.of(r);return(s<0||Math.abs(c.height-this.height)>=cg||Math.abs(s-this.heightMetrics(t,n).perLine)>=cg)&&(ng=!0),ug(this,c)}return(r||this.outdated)&&(this.setHeight(t.heightForGap(n,n+this.length)),this.outdated=!1),this}toString(){return`gap(${this.length})`}},hg=class extends lg{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==sg.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==sg.ByPosNoHeight?sg.ByPosNoHeight:sg.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,sg.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&&gg(i,a-1),t<this.length){let e=i.length;this.decomposeRight(t,i),gg(i,e)}return lg.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?lg.of(this.break?[e,null,t]:[e,t]):(this.left=ug(this.left,e),this.right=ug(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 gg(e,t){let n,r;e[t]==null&&(n=e[t-1])instanceof mg&&(r=e[t+1])instanceof mg&&e.splice(t-1,3,new mg(n.length+1+r.length))}var _g=5,vg=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 pg?n.length+=e-this.pos:(e>this.pos||!this.isCovered)&&this.nodes.push(new pg(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 fg(a,r,n)):(a||i||r>=_g)&&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 pg(this.pos-e,-1,0)),this.writtenTo=this.pos}blankContent(e,t){let n=new mg(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 pg)return e;let t=new pg(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 pg)&&!this.isCovered?this.nodes.push(new pg(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 pg&&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 vd.spans(n,r,i,a,0),a.finish(r)}};function yg(e,t,n){let r=new bg;return vd.compare(e,t,n,r,0),r.changes}var bg=class{constructor(){this.changes=[]}compareRange(){}comparePoint(e,t,n,r){(e<t||n&&n.heightRelevant||r&&r.heightRelevant)&&Sf(e,t,this.changes,5)}};function xg(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(wf(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 Sg(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 Cg(e,t){let n=e.getBoundingClientRect();return{left:0,right:n.right-n.left,top:t,bottom:n.bottom-(n.top+t)}}var wg=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 gf.replace({widget:new Tg(this.displaySize*(t?e.scaleY:e.scaleX),t)}).range(this.from,this.to)}},Tg=class extends mf{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}},Eg=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=Mg,this.scrollTarget=null,this.printing=!1,this.mustMeasureContent=!0,this.defaultTextDirection=ep.LTR,this.visibleRanges=[],this.mustEnforceCursorAssoc=!1;let n=t.facet(Gp).some(e=>typeof e!=`function`&&e.class==`cm-lineWrapping`);this.heightOracle=new ig(n),this.stateDeco=Ng(t),this.heightMap=lg.empty().applyChanges(this.stateDeco,H.empty,this.heightOracle.setDoc(t.doc),[new tm(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=gf.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 Dg(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?Mg:new Pg(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(Fg(e,this.scaler))})}update(e,t=null){this.state=e.state;let n=this.stateDeco;this.stateDeco=Ng(this.state);let r=e.changedRanges,i=tm.extendWithRanges(r,yg(n,this.stateDeco,e?e.changes:pu.empty(this.state.doc.length))),a=this.heightMap.height,o=this.scrolledToBottom?null:this.scrollAnchorAt(this.scrollOffset);rg(),this.heightMap=this.heightMap.applyChanges(this.stateDeco,e.startState.doc,this.heightOracle.setDoc(this.state.doc),i),(this.heightMap.height!=a||ng)&&(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(Np)&&(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`?ep.RTL:ep.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}=Lf(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=zf(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=Xf(this.scrollParent||e.win);let m=(this.printing?Cg:xg)(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&&!Sg(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)),rg();for(let n of this.viewports){let i=n.from==this.viewport.from?t:e.docView.measureVisibleLineHeights(n);this.heightMap=(a?lg.empty().applyChanges(this.stateDeco,H.empty,this.heightOracle,[new tm(0,0,0,e.state.doc.length)]):this.heightMap).updateHeight(r,0,a,new ag(n.from,i))}ng&&(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 Dg(r.lineAt(a-n*1e3,sg.ByHeight,i,0,0).from,r.lineAt(o+(1-n)*1e3,sg.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,sg.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 Dg(r.lineAt(o-500,sg.ByHeight,i,0,0).from,r.lineAt(o+n+500,sg.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 Dg(this.heightMap.lineAt(n,sg.ByPos,this.heightOracle,0,0).from,this.heightMap.lineAt(r,sg.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,sg.ByPos,this.heightOracle,0,0),{bottom:i}=this.heightMap.lineAt(t,sg.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 wg(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!=ep.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=jg(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(U.cursor(a),!1,!0).head;e>r&&(a=e)}let e=this.gapSize(c,r,a,l);f=new wg(r,a,e,n||e<2e6?e:2e6)}o.push(f)},c=t=>{if(t.length<a||t.type!=hf.Text)return;let i=Og(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=Ag(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=kg(i,n),l=kg(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=Ag(i,o),t=((d-u)/2+a)/n;f=e-t,p=e+t}else f=(u-a)/n,p=(d+a)/n;c=kg(i,f),l=kg(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=Ag(r,n)-Ag(r,t);return this.heightOracle.lineWrapping?e.height*i:r.total*this.heightOracle.charWidth*i}updateLineGaps(e){wg.same(e,this.lineGaps)||(this.lineGaps=e,this.lineGapDeco=gf.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=[];vd.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)||Fg(this.heightMap.lineAt(e,sg.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)||Fg(this.heightMap.lineAt(this.scaler.fromDOM(e),sg.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 Fg(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}},Dg=class{constructor(e,t){this.from=e,this.to=t}};function Og(e,t,n){let r=[],i=e,a=0;return vd.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 kg({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 Ag(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 jg(e,t){for(let n of e)if(t(n))return n}var Mg={toDOM(e){return e},fromDOM(e){return e},scale:1,eq(e){return e==this}};function Ng(e){let t=e.facet(Kp).filter(e=>typeof e!=`function`),n=e.facet(Jp).filter(e=>typeof e!=`function`);return n.length&&t.push(vd.join(n)),t}var Pg=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,sg.ByPos,e,0,0).top,o=t.lineAt(i,sg.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 Fg(e,t){if(t.scale==1)return e;let n=t.toDOM(e.top),r=t.toDOM(e.bottom);return new og(e.from,e.length,n,r-n,Array.isArray(e._content)?e._content.map(e=>Fg(e,t)):e._content)}var Ig=W.define({combine:e=>e.join(` `)}),Lg=W.define({combine:e=>e.indexOf(!0)>-1}),Rg=Rd.newName(),zg=Rd.newName(),Bg=Rd.newName(),Vg={"&light":`.`+zg,"&dark":`.`+Bg};function Hg(e,t,n){return new Rd(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 Ug=Hg(`.`+Rg,{"&":{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`}},Vg),Wg={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},Gg=G.ie&&G.ie_version<=11,Kg=class{constructor(e){this.view=e,this.active=!1,this.editContext=null,this.selectionRange=new Bf,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);(G.ie&&G.ie_version<=11||G.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&&G.android&&e.constructor.EDIT_CONTEXT!==!1&&!(G.chrome&&G.chrome_version<126)&&(this.editContext=new Xg(e),e.state.facet(zp)&&(e.contentDOM.editContext=this.editContext.editContext)),Gg&&(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(zp)?n.root.activeElement!=this.dom:!Of(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}(G.ie&&G.ie_version<=11||G.android&&G.chrome)&&!n.state.selection.main.empty&&r.focusNode&&Af(r.focusNode,r.focusOffset,r.anchorNode,r.anchorOffset)?this.flushSoon():this.flush(!1)}readSelectionRange(){let{view:e}=this,t=Ef(e.root);if(!t)return!1;let n=G.safari&&e.root.nodeType==11&&e.root.activeElement==this.dom&&Yg(this.view,t)||t;if(!n||this.selectionRange.eq(n))return!1;let r=Of(this.dom,n);return r&&!this.selectionChanged&&e.inputState.lastFocusTime>Date.now()-200&&e.inputState.lastTouchTime<Date.now()-300&&Yf(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(wf(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,Wg),Gg&&this.dom.addEventListener(`DOMCharacterDataModified`,this.onCharData),!0)}stop(){this.active&&(this.active=!1,this.observer.disconnect(),Gg&&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&&qf(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&&Of(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 ch(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=uh(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=qg(t,e.previousSibling||e.target.previousSibling,-1),r=qg(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(zp)!=e.state.facet(zp)&&(e.view.contentDOM.editContext=e.state.facet(zp)?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 qg(e,t,n){for(;t;){let r=im.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 Jg(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 Af(o.node,o.offset,i,a)&&([n,r,i,a]=[i,a,n,r]),{anchorNode:n,anchorOffset:r,focusNode:i,focusOffset:a}}function Yg(e,t){if(t.getComposedRanges){let n=t.getComposedRanges(e.root)[0];if(n)return Jg(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?Jg(e,n):null}var Xg=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=ph(e.state.sliceDoc(o,s),n.text,(c?r.from:r.to)-o,c?`end`:null);if(!l){let t=U.single(this.toEditorPos(n.selectionStart),this.toEditorPos(n.selectionEnd));gh(t,r)||e.dispatch({selection:t,userEvent:`select`});return}let u={from:l.from+o,to:l.toA+o,insert:H.of(n.text.slice(l.from,l.toB).split(`
|
|
19
|
+
`))};if((G.mac||G.android)&&u.from==a-1&&/^\. ?$/.test(n.text)&&e.contentDOM.getAttribute(`autocorrect`)==`off`&&(u={from:o,to:s,insert:H.of([n.text.replace(`.`,` `)])}),this.pendingContextChange=u,!e.state.readOnly){let t=this.to-this.from+(u.to-u.from+u.insert.length);dh(e,u,U.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(gf.mark({attributes:{style:e}}).range(i,a))}}}e.dispatch({effects:Lp.of(gf.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=Ef(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])}},K=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||Jf(e.parent)||document,this.viewState=new Eg(this,e.state||dd.create(e)),e.scrollTo&&e.scrollTo.is(Ip)&&(this.viewState.scrollTarget=e.scrollTo.value.clip(this.viewState.state)),this.plugins=this.state.facet(Vp).map(e=>new Up(e));for(let e of this.plugins)e.update(this);this.observer=new Kg(this),this.inputState=new _h(this),this.inputState.ensureHandlers(this.plugins),this.docView=new jm(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 Zu?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(Xh))?(this.inputState.notifiedFocused=o,s=1):o!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=o,c=Zh(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(dd.phrases)!=this.state.facet(dd.phrases))return this.setState(a);i=nm.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 Fp(t.empty?t:U.cursor(t.head,t.head>t.anchor?-1:1),`nearest`,`nearest`,i,r)}for(let e of n.effects)e.is(Ip)&&(d=e.value.clip(this.state))}this.viewState.update(i,d),this.bidiCache=$g.update(this.bidiCache,i.changes),i.empty||(this.updatePlugins(i),this.inputState.update(i)),n=this.docView.update(i),this.state.facet(em)!=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(Ig)!=i.state.facet(Ig)&&(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(Dp))try{e(i)}catch(e){Rp(this.state,e,`update listener`)}(c||u)&&Promise.resolve().then(()=>{c&&this.state==c.startState&&this.dispatch(c),u&&!uh(this,u)&&l.force&&qf(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 Eg(this,e),this.plugins=e.facet(Vp).map(e=>new Up(e)),this.pluginMap.clear();for(let e of this.plugins)e.update(this);this.docView.destroy(),this.docView=new jm(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(Vp),n=e.state.facet(Vp);if(t!=n){let r=[];for(let i of n){let n=t.indexOf(i);if(n<0)r.push(new Up(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){Rp(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(Xf(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 Rp(this.state,e),Qg}}),u=nm.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]!=Qg)try{let t=c[e];t.write&&t.write(l[e],this)}catch(e){Rp(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)&&!(G.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(Dp))e(t)}get themeClasses(){return Rg+` `+(this.state.facet(Lg)?Bg:zg)+` `+this.state.facet(Ig)}updateAttrs(){let e=e_(this,Wp,{class:`cm-editor`+(this.hasFocus?` cm-focused `:` `)+this.themeClasses}),t={spellcheck:`false`,autocorrect:`off`,autocapitalize:`off`,writingsuggestions:`false`,translate:`no`,contenteditable:this.state.facet(zp)?`true`:`false`,class:`cm-content`,style:`${G.tabSize}: ${this.state.tabSize}`,role:`textbox`,"aria-multiline":`true`};this.state.readOnly&&(t[`aria-readonly`]=`true`),e_(this,Gp,t);let n=this.observer.ignore(()=>{let n=ff(this.contentDOM,this.contentAttrs,t),r=ff(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(em);let t=this.state.facet(e.cspNonce);Rd.mount(this.root,this.styleModules.concat(Ug).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 $m(this,e,Jm(this,e,t,n))}moveByGroup(e,t){return $m(this,e,Jm(this,e,t,t=>Ym(this,e.head,t)))}visualLineSide(e,t){return t?U.cursor(e.to,1):U.cursor(e.from,-1)}moveToLineBoundary(e,t,n=!0){return qm(this,e,t,n)}moveVertically(e,t,n){return $m(this,e,Xm(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=th(this,e,t);return n&&n.pos}posAndSideAtCoords(e,t=!0){return this.readMeasured(),th(this,e,t)}coordsAtPos(e,t=1){this.readMeasured();let n=this.state.doc.lineAt(e),r=this.bidiSpans(n),i=r[up.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==ep.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(Mp)||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>Zg)return yp(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||dp(r.isolates,n=Zp(this,e))))return r.order;n||=Zp(this,e);let r=vp(e.text,t,n);return this.bidiCache.push(new $g(e.from,e.to,t,n,!0,r)),r}get hasFocus(){return(this.dom.ownerDocument.hasFocus()||G.safari&&this.inputState?.lastContextMenu>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore(()=>{Wf(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 Ip.of(new Fp(typeof e==`number`?U.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 Ip.of(new Fp(U.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 Hp.define(()=>({}),{eventHandlers:e})}static domEventObservers(e){return Hp.define(()=>({}),{eventObservers:e})}static theme(e,t){let n=Rd.newName(),r=[Ig.of(n),em.of(Hg(`.${n}`,e))];return t&&t.dark&&r.push(Lg.of(!0)),r}static baseTheme(e){return Mu.lowest(em.of(Hg(`.`+Rg,e,Vg)))}static findFromDOM(e){let t=e.querySelector(`.cm-content`);return(t&&im.get(t)||im.get(e))?.root?.view||null}};K.styleModule=em,K.inputHandler=Op,K.clipboardInputFilter=Ap,K.clipboardOutputFilter=jp,K.scrollHandler=Pp,K.focusChangeEffect=kp,K.perLineTextDirection=Mp,K.exceptionSink=Ep,K.updateListener=Dp,K.editable=zp,K.mouseSelectionStyle=Tp,K.dragMovesSelection=wp,K.clickAddsSelectionRange=Cp,K.decorations=Kp,K.blockWrappers=qp,K.outerDecorations=Jp,K.atomicRanges=Yp,K.bidiIsolatedRanges=Xp,K.cursorScrollMargin=W.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}}}),K.scrollMargins=Qp,K.darkTheme=Lg,K.cspNonce=W.define({combine:e=>e.length?e[0]:``}),K.contentAttributes=Gp,K.editorAttributes=Wp,K.lineWrapping=K.contentAttributes.of({class:`cm-lineWrapping`}),K.announce=Xu.define();var Zg=4096,Qg={},$g=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:ep.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 e_(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&&cf(a,n)}return n}var t_=G.mac?`mac`:G.windows?`win`:G.linux?`linux`:`key`;function n_(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 r_(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 i_=Mu.default(K.domEventHandlers({keydown(e,t){return p_(s_(t.state),e,t,`editor`)}})),a_=W.define({enables:i_}),o_=new WeakMap;function s_(e){let t=e.facet(a_),n=o_.get(t);return n||o_.set(t,n=d_(t.reduce((e,t)=>e.concat(t),[]))),n}function c_(e,t,n){return p_(s_(e.state),t,e,n)}var l_=null,u_=4e3;function d_(e,t=t_){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=>n_(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=l_={view:t,prefix:n,scope:e};return setTimeout(()=>{l_==r&&(l_=null)},u_),!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,f_))}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 f_=null;function p_(e,t,n,r){f_=t;let i=qd(t),a=lu(su(i,0))==i.length&&i!=` `,o=``,s=!1,c=!1,l=!1;l_&&l_.view==n&&l_.scope==r&&(o=l_.prefix+` `,Ch.indexOf(t.keyCode)<0&&(c=!0,l_=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+r_(i,t,!a)])?s=!0:a&&(t.altKey||t.metaKey||t.ctrlKey)&&!(G.windows&&t.ctrlKey&&t.altKey)&&!(G.mac&&t.altKey&&!(t.ctrlKey||t.metaKey))&&(p=Vd[t.keyCode])&&p!=i?(d(f[o+r_(p,t,!0)])||t.shiftKey&&(m=Hd[t.keyCode])!=i&&m!=p&&d(f[o+r_(m,t,!1)]))&&(s=!0):a&&t.shiftKey&&d(f[o+r_(i,t,!0)])&&(s=!0),!s&&d(f._any)&&(s=!0)),c&&(s=!0),s&&l&&t.stopPropagation(),f_=null,s}var m_=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=h_(t);return[new e(n,i.left-a.left,i.top-a.top,null,i.bottom-i.top)]}return __(t,n,r)}};function h_(e){let t=e.scrollDOM.getBoundingClientRect();return{left:(e.textDirection==ep.LTR?t.left:t.right-e.scrollDOM.clientWidth*e.scaleX)-e.scrollDOM.scrollLeft*e.scaleX,top:t.top-e.scrollDOM.scrollTop*e.scaleY}}function g_(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 __(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==ep.LTR,o=e.contentDOM,s=o.getBoundingClientRect(),c=h_(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=Km(e,r,1),m=Km(e,i,-1),h=p.type==hf.Text?p:null,g=m.type==hf.Text?m:null;if(h&&(e.lineWrapping||p.widgetLineBreaks)&&(h=g_(e,r,1,h)),g&&(e.lineWrapping||m.widgetLineBreaks)&&(g=g_(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==hf.Text&&(t.bottom=r.top=(t.bottom+r.top)/2),v(t).concat(i).concat(v(r))}function _(e,n,r,i){return new m_(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==ep.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 v_(e,t){return e.constructor==t.constructor&&e.eq(t)}var y_=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(b_)!=e.state.facet(b_)&&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(b_);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)=>!v_(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,G.webkit&&(this.dom.style.display=this.dom.firstChild?``:`none`)}}destroy(){this.layer.destroy&&this.layer.destroy(this.dom,this.view),this.dom.remove()}},b_=W.define();function x_(e){return[Hp.define(t=>new y_(t,e)),b_.of(e)]}var S_=!G.ios,C_=W.define({combine(e){return fd(e,{cursorBlinkRate:1200,drawRangeCursor:!0,iosSelectionHandles:!0},{cursorBlinkRate:(e,t)=>Math.min(e,t),drawRangeCursor:(e,t)=>e||t})}});function w_(e={}){return[C_.of(e),E_,O_,A_,Np.of(!0)]}function T_(e){return e.startState.facet(C_)!=e.state.facet(C_)}var E_=x_({above:!0,markers(e){let{state:t}=e,n=t.facet(C_),r=[];for(let i of t.selection.ranges){let a=i==t.selection.main;if(i.empty||n.drawRangeCursor&&!(a&&G.ios&&n.iosSelectionHandles)){let t=a?`cm-cursor cm-cursor-primary`:`cm-cursor cm-cursor-secondary`,n=i.empty?i:U.cursor(i.head,i.assoc);for(let i of m_.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=T_(e);return n&&D_(e.state,t),e.docChanged||e.selectionSet||n},mount(e,t){D_(t.state,e)},class:`cm-cursorLayer`});function D_(e,t){t.style.animationDuration=e.facet(C_).cursorBlinkRate+`ms`}var O_=x_({above:!1,markers(e){let t=[],{main:n,ranges:r}=e.state.selection;for(let i of r)if(!i.empty&&(S_||i!=n))for(let n of m_.forRange(e,`cm-selectionBackground`,i))t.push(n);if(G.ios&&!n.empty&&e.state.facet(C_).iosSelectionHandles){for(let r of m_.forRange(e,`cm-selectionHandle cm-selectionHandle-start`,U.cursor(n.from,1)))t.push(r);for(let r of m_.forRange(e,`cm-selectionHandle cm-selectionHandle-end`,U.cursor(n.to,1)))t.push(r)}return t},update(e,t){return e.docChanged||e.selectionSet||e.viewportChanged||T_(e)},class:`cm-selectionLayer`}),k_=G.gecko&&G.gecko_version==153?`#ffffff01`:`transparent`,A_=Mu.highest(K.theme({".cm-line":{...S_?{"& ::selection, &::selection":{backgroundColor:`${k_} !important`}}:{},caretColor:`transparent !important`},".cm-content":{caretColor:`transparent !important`,"& :focus":{caretColor:`initial !important`,...S_?{"&::selection, & ::selection":{backgroundColor:`Highlight !important`}}:{}}}}));function j_(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 M_(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 N_=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 xd,n=t.add.bind(t);for(let{from:t,to:r}of M_(e,this.maxLength))j_(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 j_(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}},P_=/x/.unicode==null?`g`:`gu`,F_=RegExp(`[\0-\b
|
|
20
|
+
--\u2028\u2029-]`,P_),I_={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`},L_=null;function R_(){if(L_==null&&typeof document<`u`&&document.body){let e=document.body.style;L_=(e.tabSize??e.MozTabSize)!=null}return L_||!1}var z_=W.define({combine(e){let t=fd(e,{render:null,specialChars:F_,addSpecialChars:null});return(t.replaceTabs=!R_())&&(t.specialChars=RegExp(` |`+t.specialChars.source,P_)),t.addSpecialChars&&(t.specialChars=RegExp(t.specialChars.source+`|`+t.addSpecialChars.source,P_)),t}});function B_(e={}){return[z_.of(e),H_()]}var V_=null;function H_(){return V_||=Hp.fromClass(class{constructor(e){this.view=e,this.decorations=gf.none,this.decorationCache=Object.create(null),this.decorator=this.makeDecorator(e.state.facet(z_)),this.decorations=this.decorator.createDeco(e)}makeDecorator(e){return new N_({regexp:e.specialChars,decoration:(t,n,r)=>{let{doc:i}=n.state,a=su(t[0],0);if(a==9){let e=i.lineAt(r),t=n.state.tabSize,a=Md(e.text,t,r-e.from);return gf.replace({widget:new K_((t-a%t)*this.view.defaultCharacterWidth/this.view.scaleX)})}return this.decorationCache[a]||(this.decorationCache[a]=gf.replace({widget:new G_(e,a)}))},boundary:e.replaceTabs?void 0:/[^]/})}update(e){let t=e.state.facet(z_);e.startState.facet(z_)==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 U_=`•`;function W_(e){return e>=32?U_:e==10?``:String.fromCharCode(9216+e)}var G_=class extends mf{constructor(e,t){super(),this.options=e,this.code=t}eq(e){return e.code==this.code}toDOM(e){let t=W_(this.code),n=e.state.phrase(`Control character`)+` `+(I_[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}},K_=class extends mf{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}},q_=W.define({combine(e){let t,n;for(let r of e)t||=r.topContainer,n||=r.bottomContainer;return{topContainer:t,bottomContainer:n}}});function J_(e,t){let n=e.plugin(Y_),r=n?n.specs.indexOf(t):-1;return r>-1?n.panels[r]:null}var Y_=Hp.fromClass(class{constructor(e){this.input=e.state.facet(Q_),this.specs=this.input.filter(e=>e),this.panels=this.specs.map(t=>t(e));let t=e.state.facet(q_);this.top=new X_(e,!0,t.topContainer),this.bottom=new X_(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(q_);this.top.container!=t.topContainer&&(this.top.sync([]),this.top=new X_(e.view,!0,t.topContainer)),this.bottom.container!=t.bottomContainer&&(this.bottom.sync([]),this.bottom=new X_(e.view,!1,t.bottomContainer)),this.top.syncClasses(),this.bottom.syncClasses();let n=e.state.facet(Q_);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=>K.scrollMargins.of(t=>{let n=t.plugin(e);return n&&{top:n.top.scrollMargin(),bottom:n.bottom.scrollMargin()}})}),X_=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=Z_(e);e=e.nextSibling}else this.dom.insertBefore(t.dom,e);for(;e;)e=Z_(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 Z_(e){let t=e.nextSibling;return e.remove(),t}var Q_=W.define({enables:Y_});function $_(e,t){let n,r=new Promise(e=>n=e),i=e=>iv(e,t,n);e.state.field(tv,!1)?e.dispatch({effects:nv.of(i)}):e.dispatch({effects:Xu.appendConfig.of(tv.init(()=>[i]))});let a=rv.of(i);return{close:a,result:r.then(t=>((e.win.queueMicrotask||(t=>e.win.setTimeout(t,10)))(()=>{e.state.field(tv).indexOf(i)>-1&&e.dispatch({effects:a})}),t))}}function ev(e,t){let n=e.state.field(tv,!1)||[];for(let r of n){let n=J_(e,r);if(n&&n.dom.classList.contains(t))return n}return null}var tv=ku.define({create(){return[]},update(e,t){for(let n of t.effects)n.is(nv)?e=[n.value].concat(e):n.is(rv)&&(e=e.filter(e=>e!=n.value));return e},provide:e=>Q_.computeN([e],t=>t.field(e))}),nv=Xu.define(),rv=Xu.define();function iv(e,t,n){let r=t.content?t.content(e,()=>o(null)):null;if(!r){if(r=Jd(`form`),t.input){let e=Jd(`input`,t.input);/^(text|password|number|email|tel|url)$/.test(e.type)&&e.classList.add(`cm-textfield`),e.name||=`input`,r.appendChild(Jd(`label`,(t.label||``)+`: `,e))}else r.appendChild(document.createTextNode(t.label||``));r.appendChild(document.createTextNode(` `)),r.appendChild(Jd(`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=Jd(`div`,r,Jd(`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 av=class extends pd{compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}eq(e){return!1}destroy(e){}};av.prototype.elementClass=``,av.prototype.toDOM=void 0,av.prototype.mapMode=du.TrackBefore,av.prototype.startSide=av.prototype.endSide=-1,av.prototype.point=!0;var ov=W.define(),sv=W.define(),cv=W.define(),lv=W.define({combine:e=>e.some(e=>e)});function uv(e){let t=[dv];return e&&e.fixed===!1&&t.push(lv.of(!0)),t}var dv=Hp.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(cv).map(t=>new hv(e,t)),this.fixed=!e.state.facet(lv);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(lv)!=!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=vd.iter(this.view.state.facet(ov),this.view.viewport.from),r=[],i=this.gutters.map(e=>new mv(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==hf.Text&&t){pv(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==hf.Text){pv(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(cv),n=e.state.facet(cv),r=e.docChanged||e.heightChanged||e.viewportChanged||!vd.eq(e.startState.facet(ov),e.state.facet(ov),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 hv(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=>K.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==ep.LTR?{left:r,right:i}:{right:r,left:i}})});function fv(e){return Array.isArray(e)?e:[e]}function pv(e,t,n){for(;e.value&&e.from<=n;)e.from==n&&t.push(e.value),e.next()}var mv=class{constructor(e,t,n){this.gutter=e,this.height=n,this.i=0,this.cursor=vd.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 gv(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=[];pv(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(sv)){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()}}},hv=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=fv(t.markers(e)),t.initialSpacer&&(this.spacer=new gv(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=fv(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!vd.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()}},gv=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`:``),_v(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 _v(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 vv=W.define(),yv=W.define(),bv=W.define({combine(e){return fd(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}})}}),xv=class extends av{constructor(e){super(),this.number=e}eq(e){return this.number==e.number}toDOM(){return document.createTextNode(this.number)}};function Sv(e,t){return e.state.facet(bv).formatNumber(t,e.state)}var Cv=cv.compute([bv],e=>({class:`cm-lineNumbers`,renderEmptyElements:!1,markers(e){return e.state.facet(vv)},lineMarker(e,t,n){return n.some(e=>e.toDOM)?null:new xv(Sv(e,e.state.doc.lineAt(t.from).number))},widgetMarker:(e,t,n)=>{for(let r of e.state.facet(yv)){let i=r(e,t,n);if(i)return i}return null},lineMarkerChange:e=>e.startState.facet(bv)!=e.state.facet(bv),initialSpacer(e){return new xv(Sv(e,Tv(e.state.doc.lines)))},updateSpacer(e,t){let n=Sv(t.view,Tv(t.view.state.doc.lines));return n==e.number?e:new xv(n)},domEventHandlers:e.facet(bv).domEventHandlers,side:`before`}));function wv(e={}){return[bv.of(e),uv(),Cv]}function Tv(e){let t=9;for(;t<e;)t=t*10+9;return t}var Ev=1024,Dv=0,Ov=class{constructor(e,t){this.from=e,this.to=t}},q=class{constructor(e={}){this.id=Dv++,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=jv.match(e)),t=>{let n=e(t);return n===void 0?null:[this,n]}}};q.closedBy=new q({deserialize:e=>e.split(` `)}),q.openedBy=new q({deserialize:e=>e.split(` `)}),q.group=new q({deserialize:e=>e.split(` `)}),q.isolate=new q({deserialize:e=>{if(e&&e!=`rtl`&&e!=`ltr`&&e!=`auto`)throw RangeError(`Invalid value for isolate: `+e);return e||`auto`}}),q.contextHash=new q({perNode:!0}),q.lookAhead=new q({perNode:!0}),q.mounted=new q({perNode:!0});var kv=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[q.mounted.id]}},Av=Object.create(null),jv=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):Av,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(q.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(q.group),r=-1;r<(n?n.length:0);r++){let i=t[r<0?e.name:n[r]];if(i)return i}}}};jv.none=new jv(``,Object.create(null),0,8);var Mv=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 jv(e.name,r,e.id,e.flags):e)}return new e(n)}},Nv=new WeakMap,Pv=new WeakMap,Fv;(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`})(Fv||={});var Iv=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=kv.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 Xv(this.topNode,e)}cursorAt(e,t=0,n=0){let r=new Xv(Nv.get(this)||this.topNode);return r.moveTo(e,t),Nv.set(this,r._tree),r}get topNode(){return new Hv(this,0,0,null)}resolve(e,t=0){let n=Bv(Nv.get(this)||this.topNode,e,t,!1);return Nv.set(this,n),n}resolveInner(e,t=0){let n=Bv(Pv.get(this)||this.topNode,e,t,!0);return Pv.set(this,n),n}resolveStack(e,t=0){return Yv(this,e,t)}iterate(e){let{enter:t,leave:n,from:r=0,to:i=this.length}=e,a=e.mode||0,o=(a&Fv.IncludeAnonymous)>0;for(let e=this.cursor(a|Fv.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:ty(jv.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(jv.none,t,n,r)))}static build(e){return Qv(e)}};Iv.empty=new Iv(jv.none,[],[],0);var Lv=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)}},Rv=class e{constructor(e,t,n){this.buffer=e,this.length=t,this.set=n}get type(){return jv.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&&!(zv(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 zv(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 Bv(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 Hv&&e.index<0?null:e.parent;if(!t)return e;e=t}let i=r?0:Fv.IgnoreOverlays;if(r)for(let r=e,a=r.parent;a;r=a,a=r.parent)r instanceof Hv&&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 Vv=class{cursor(e=0){return new Xv(this,e)}getChild(e,t=null,n=null){let r=Uv(this,e,t,n);return r.length?r[0]:null}getChildren(e,t=null,n=null){return Uv(this,e,t,n)}resolve(e,t=0){return Bv(this,e,t,!1)}resolveInner(e,t=0){return Bv(this,e,t,!0)}matchContext(e){return Wv(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}},Hv=class e extends Vv{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&Fv.EnterBracketed&&l instanceof Iv&&(d=kv.get(l))&&!d.overlay&&d.bracketed&&r>=u&&r<=u+l.length||zv(i,r,u,u+l.length)){if(l instanceof Rv){if(a&Fv.ExcludeBuffers)continue;let e=l.findChild(0,l.buffer.length,n,r-u,i);if(e>-1)return new Kv(new Gv(o,l,t,u),null,e)}else if(a&Fv.IncludeAnonymous||!l.type.isAnonymous||Zv(l)){let s;if(!(a&Fv.IgnoreMounts)&&(s=kv.get(l))&&!s.overlay)return new e(s.tree,u,t,o);let c=new e(l,u,t,o);return a&Fv.IncludeAnonymous||!c.type.isAnonymous?c:c.nextChild(n<0?l.children.length-1:0,n,r,i,a)}}}if(a&Fv.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&Fv.IgnoreOverlays)&&(i=kv.get(this._tree))&&i.overlay){let a=t-this.from,o=r&Fv.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 Uv(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 Wv(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 Gv=class{constructor(e,t,n,r){this.parent=e,this.buffer=t,this.index=n,this.start=r}},Kv=class e extends Vv{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&Fv.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 Iv(this.type,e,t,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}};function qv(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 Hv&&n.index<0?null:n.parent,i=e.slice();return r?i[t]=r:i.splice(t,1),new Jv(i,n)}var Jv=class{constructor(e,t){this.heads=e,this.node=t}get next(){return qv(this.heads)}};function Yv(e,t,n){let r=e.resolveInner(t,n),i=null;for(let e=r instanceof Hv?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=kv.get(e.tree);if(a&&a.overlay&&a.overlay[0].from<=t&&a.overlay[a.overlay.length-1].to>=t){let o=new Hv(a.tree,a.overlay[0].from+e.from,-1,e);(i||=[r]).push(Bv(o,t,n,!1))}}return i?qv(i):r}var Xv=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&~Fv.EnterBracketed,e instanceof Hv)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 Hv?(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&Fv.ExcludeBuffers?!1:this.enterChild(1,e,t):this.yield(this._tree.enter(e,t,n))}parent(){if(!this.buffer)return this.yieldNode(this.mode&Fv.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let e=this.mode&Fv.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&Fv.IncludeAnonymous||e instanceof Rv||!e.type.isAnonymous||Zv(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 Kv(this.buffer,t,this.stack[e]);return this.bufferNode=new Kv(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 Wv(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 Wv(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 Zv(e){return e.children.some(e=>e instanceof Rv||!e.type.isAnonymous||Zv(e))}function Qv(e){let{buffer:t,nodeSet:n,maxBufferLength:r=Ev,reused:i=[],minRepeatType:a=n.types.length}=e,o=Array.isArray(t)?new Lv(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,A=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 Rv(t,C-k.start,n),A=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=ty(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(A)}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 Rv(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 Iv){if(!o&&s.type==e&&s.length==i)return s;(c=s.prop(q.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=[q.contextHash,a];o=o?[e].concat(o):[e]}if(i>25){let e=[q.lookAhead,i];o=o?[e].concat(o):[e]}return new Iv(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 Iv(s[e.topID],_.reverse(),v.reverse(),y)}var $v=new WeakMap;function ey(e,t){if(!e.isAnonymous||t instanceof Rv||t.type!=e)return 1;let n=$v.get(t);if(n==null){n=1;for(let r of t.children){if(r.type!=e||!(r instanceof Iv)){n=1;break}n+=ey(e,r)}$v.set(t,n)}return n}function ty(e,t,n,r,i,a,o,s,c){let l=0;for(let n=r;n<i;n++)l+=ey(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=ey(e,t[s]);for(s++;s<i;s++){let n=ey(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(ty(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 ny=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 Kv?this.setBuffer(e.context.buffer,e.index,t):e instanceof Hv&&this.map.set(e.tree,t)}get(e){return e instanceof Kv?this.getBuffer(e.context.buffer,e.index):e instanceof Hv?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)}},ry=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}},iy=class{startParse(e,t,n){return typeof e==`string`&&(e=new ay(e)),n=n?n.length?n.map(e=>new Ov(e.from,e.to)):[new Ov(0,0)]:[new Ov(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}}},ay=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 oy(e){return(t,n,r,i)=>new dy(t,e,n,r,i)}var sy=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 cy(e){if(!e.length||e.some(e=>e.from>=e.to))throw RangeError(`Invalid inner parse ranges given: `+JSON.stringify(e))}var ly=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=[]}},uy=new q({perNode:!0}),dy=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 Iv(e.type,e.children,e.positions,e.length,e.propValues.concat([[uy,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[q.mounted.id]=new kv(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 gy(this.fragments),t=null,n=null,r=new Xv(new Hv(this.baseTree,this.ranges[0].from,0,null),Fv.IncludeAnonymous|Fv.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=fy(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||(my(r),t&&t.depth++,n&&n.depth++);let a=e.findMounts(r.from,i.parser);if(typeof i.overlay==`function`)t=new ly(i.parser,i.overlay,a,this.inner.length,r.from,!!i.bracketed,r.tree,t);else{let e=_y(this.ranges,i.overlay||(r.from<r.to?[new Ov(r.from,r.to)]:[]));e.length&&cy(e),(e.length||!i.overlay)&&this.inner.push(new sy(i.parser,e.length?i.parser.startParse(this.input,yy(a,e),e):i.parser.startParse(``),i.overlay?i.overlay.map(e=>new Ov(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 Ov(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=_y(this.ranges,t.ranges);e.length&&(cy(e),this.inner.splice(t.index,0,new sy(t.parser,t.parser.startParse(this.input,yy(t.mounts,e),e),t.ranges.map(e=>new Ov(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 fy(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 py(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 my(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=[];py(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),py(o,s[f+3],r,p,m,a),new Iv(i,p,m,u)}i.children[a]=l(0,s.length,jv.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 Hv(n,r+e.from,t,e._tree))}}var hy=class{constructor(e,t){this.offset=t,this.done=!1,this.cursor=e.cursor(Fv.IncludeAnonymous|Fv.IgnoreMounts|Fv.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,Fv.IncludeAnonymous|Fv.IgnoreOverlays|Fv.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 Iv)t=t.children[0];else break}return!1}},gy=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(uy)??t.to,this.inner=new hy(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(uy)??e.to,this.inner=new hy(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(q.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 _y(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 Ov(e.from,o),e.to>s&&n.splice(a+1,0,new Ov(s,e.to))):e.to>s?n[a--]=new Ov(s,e.to):n.splice(a--,1))}}return r}function vy(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 Ov(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 yy(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=vy(t,i.overlay.map(e=>new Ov(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 ry(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 ry(s,c,i.tree,-e,a.from>=e||a.openStart,a.to<=o||a.openEnd))}return n}var by=0,xy=class e{constructor(e,t,n,r){this.name=e,this.set=t,this.base=n,this.modified=r,this.id=by++}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 Cy(e);return e=>e.modified.indexOf(t)>-1?e:Cy.get(e.base||e,e.modified.concat(t).sort((e,t)=>e.id-t.id))}},Sy=0,Cy=class e{constructor(e){this.name=e,this.instances=[],this.id=Sy++}static get(t,n){if(!n.length)return t;let r=n[0].instances.find(e=>e.base==t&&wy(n,e.modified));if(r)return r;let i=[],a=new xy(t.name,i,t,n);for(let e of n)e.instances.push(a);let o=Ty(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 wy(e,t){return e.length==t.length&&e.every((e,n)=>e==t[n])}function Ty(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 Ey(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 Oy(r,i,o>0?n.slice(0,o):null).sort(t[s])}}return Dy.add(t)}var Dy=new q({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 Oy(i.tags,i.mode,i.context);n?n.next=a:r=a,n=a}return r}}),Oy=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}};Oy.empty=new Oy([],2,null);function ky(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 Ay(e,t){let n=null;for(let r of e){let e=r.style(t);e&&(n=n?n+` `+e:e)}return n}function jy(e,t,n,r=0,i=e.length){let a=new My(r,Array.isArray(t)?t:[t],n);a.highlightRange(e.cursor(),r,i,``,a.highlighters),a.flush(i)}var My=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=Ny(e)||Oy.empty,u=Ay(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(q.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 Ny(e){let t=e.type.prop(Dy);for(;t&&t.context&&!e.matchContext(t.context);)t=t.next;return t||null}var J=xy.define,Py=J(),Fy=J(),Iy=J(Fy),Ly=J(Fy),Ry=J(),zy=J(Ry),By=J(Ry),Vy=J(),Hy=J(Vy),Uy=J(),Wy=J(),Gy=J(),Ky=J(Gy),qy=J(),Y={comment:Py,lineComment:J(Py),blockComment:J(Py),docComment:J(Py),name:Fy,variableName:J(Fy),typeName:Iy,tagName:J(Iy),propertyName:Ly,attributeName:J(Ly),className:J(Fy),labelName:J(Fy),namespace:J(Fy),macroName:J(Fy),literal:Ry,string:zy,docString:J(zy),character:J(zy),attributeValue:J(zy),number:By,integer:J(By),float:J(By),bool:J(Ry),regexp:J(Ry),escape:J(Ry),color:J(Ry),url:J(Ry),keyword:Uy,self:J(Uy),null:J(Uy),atom:J(Uy),unit:J(Uy),modifier:J(Uy),operatorKeyword:J(Uy),controlKeyword:J(Uy),definitionKeyword:J(Uy),moduleKeyword:J(Uy),operator:Wy,derefOperator:J(Wy),arithmeticOperator:J(Wy),logicOperator:J(Wy),bitwiseOperator:J(Wy),compareOperator:J(Wy),updateOperator:J(Wy),definitionOperator:J(Wy),typeOperator:J(Wy),controlOperator:J(Wy),punctuation:Gy,separator:J(Gy),bracket:Ky,angleBracket:J(Ky),squareBracket:J(Ky),paren:J(Ky),brace:J(Ky),content:Vy,heading:Hy,heading1:J(Hy),heading2:J(Hy),heading3:J(Hy),heading4:J(Hy),heading5:J(Hy),heading6:J(Hy),contentSeparator:J(Vy),list:J(Vy),quote:J(Vy),emphasis:J(Vy),strong:J(Vy),link:J(Vy),monospace:J(Vy),strikethrough:J(Vy),inserted:J(),deleted:J(),changed:J(),invalid:J(),meta:qy,documentMeta:J(qy),annotation:J(qy),processingInstruction:J(qy),definition:xy.defineModifier(`definition`),constant:xy.defineModifier(`constant`),function:xy.defineModifier(`function`),standard:xy.defineModifier(`standard`),local:xy.defineModifier(`local`),special:xy.defineModifier(`special`)};for(let e in Y){let t=Y[e];t instanceof xy&&(t.name=e)}ky([{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 Jy(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 Yy=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=Jy(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue}indentation(){return this.overrideIndent??Jy(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)}},Xy=new q;function Zy(e){return W.define({combine:e?t=>t.concat(e):void 0})}var Qy=new q,$y=class{constructor(e,t,n=[],r=``){this.data=e,this.name=r,dd.prototype.hasOwnProperty(`tree`)||Object.defineProperty(dd.prototype,"tree",{get(){return nb(this)}}),this.parser=t,this.extension=[db.of(this),dd.languageData.of((e,t,n)=>{let r=eb(e,t,n),i=r.type.prop(Xy);if(!i)return[];let a=e.facet(i),o=r.type.prop(Qy);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 eb(e,t,n).type.prop(Xy)==this.data}findRegions(e){let t=e.facet(db);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(Xy)==this.data){n.push({from:t,to:t+e.length});return}let i=e.prop(q.mounted);if(i){if(i.tree.prop(Xy)==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 Iv&&r(i,e.positions[n]+t)}};return r(nb(e),0),n}get allowsNesting(){return!0}};$y.setState=Xu.define();function eb(e,t,n){let r=e.facet(db),i=nb(e).topNode;if(!r||r.allowsNesting)for(let e=i;e;e=e.enter(t,n,Fv.ExcludeBuffers|Fv.EnterBracketed))e.type.isTop&&(i=e);return i}var tb=class e extends $y{constructor(e,t,n){super(e,t,[],n),this.parser=t}static define(t){let n=Zy(t.languageData);return new e(n,t.parser.configure({props:[Xy.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 nb(e){let t=e.field($y.state,!1);return t?t.tree:Iv.empty}var rb=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)}},ib=null,ab=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,[],Iv.empty,0,r,[],null)}startParse(){return this.parser.startParse(new rb(this.state.doc),this.fragments)}work(e,t){return t!=null&&t>=this.state.doc.length&&(t=void 0),this.tree!=Iv.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(ry.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(ry.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(e){let t=ib;ib=this;try{return e()}finally{ib=t}}withoutTempSkipped(e){for(let t;t=this.tempSkipped.pop();)e=ob(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=ry.applyChanges(r,e),i=Iv.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=ob(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 iy{createParse(t,n,r){let i=r[0].from,a=r[r.length-1].to;return{parsedPos:i,advance(){let t=ib;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 Iv(jv.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 ib}};function ob(e,t,n){return ry.applyChanges(e,[{fromA:t,toA:n,fromB:t,toB:n}])}var sb=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=ab.create(t.facet(db).parser,t,{from:0,to:n});return r.work(20,n)||r.takeTree(),new e(r)}};$y.state=ku.define({create:sb.init,update(e,t){for(let e of t.effects)if(e.is($y.setState))return e.value;return t.startState.facet(db)==t.state.facet(db)?e.apply(t):sb.init(t.state)}});var cb=e=>{let t=setTimeout(()=>e(),500);return()=>clearTimeout(t)};typeof requestIdleCallback<`u`&&(cb=e=>{let t=-1,n=setTimeout(()=>{t=requestIdleCallback(e,{timeout:400})},100);return()=>t<0?clearTimeout(n):cancelIdleCallback(t)});var lb=typeof navigator<`u`&&navigator.scheduling?.isInputPending?()=>navigator.scheduling.isInputPending():null,ub=Hp.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($y.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($y.state);(t.tree!=t.context.tree||!t.context.isDone(e.doc.length))&&(this.working=cb(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($y.state);if(i.tree==i.context.tree&&i.context.isDone(r+1e5))return;let a=Date.now()+Math.min(this.chunkBudget,100,e&&!lb?Math.max(25,e.timeRemaining()-5):1e9),o=i.context.treeLen<r&&n.doc.length>r+1e3,s=i.context.work(()=>lb&&lb()||Date.now()>a,r+(o?0:1e5));this.chunkBudget-=Date.now()-t,(s||this.chunkBudget<=0)&&(i.context.takeTree(),this.view.dispatch({effects:$y.setState.of(new sb(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=>Rp(this.view.state,e)).then(()=>this.workScheduled--),null)}destroy(){this.working&&this.working()}isWorking(){return!!(this.working||this.workScheduled>0)}},{eventHandlers:{focus(){this.scheduleWork()}}}),db=W.define({combine(e){return e.length?e[0]:null},enables:e=>[$y.state,ub,K.contentAttributes.compute([e],t=>{let n=t.facet(e);return n&&n.name?{"data-language":n.name}:{}})]}),fb=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}},pb=W.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 mb(e){let t=e.facet(pb);return t.charCodeAt(0)==9?e.tabSize*t.length:t.length}var hb=new q;function gb(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 _b({closing:e,align:t=!0,units:n=1}){return r=>vb(r,t,n,e)}function vb(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?gb(e):null;return c?s?e.column(c.from):e.column(c.to):e.baseIndent+(s?0:e.unit*n)}var yb=e=>e.baseIndent;function bb({except:e,units:t=1}={}){return n=>{let r=e&&e.test(n.textAfter);return n.baseIndent+(r?0:t*n.unit)}}var xb=W.define(),Sb=new q;function Cb(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 wb=class e{constructor(e,t){this.specs=e;let n;function r(e){let t=Rd.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 $y?e=>e.prop(Xy)==a.data:a?e=>e==a:void 0,this.style=ky(e.map(e=>({tag:e.tag,class:e.class||r(Object.assign({},e,{tag:null}))})),{all:i}).style,this.module=n?new Rd(n):null,this.themeType=t.themeType}static define(t,n){return new e(t,n||{})}},Tb=W.define(),Eb=W.define({combine(e){return e.length?[e[0]]:null}});function Db(e){let t=e.facet(Tb);return t.length?t:e.facet(Eb)}function Ob(e,t){let n=[Ab],r;return e instanceof wb&&(e.module&&n.push(K.styleModule.of(e.module)),r=e.themeType),t?.fallback?n.push(Eb.of(e)):r?n.push(Tb.computeN([K.darkTheme],t=>t.facet(K.darkTheme)==(r==`dark`)?[e]:[])):n.push(Tb.of(e)),n}var kb=class{constructor(e){this.markCache=Object.create(null),this.tree=nb(e.state),this.decorations=this.buildDeco(e,Db(e.state)),this.decoratedTo=e.viewport.to}update(e){let t=nb(e.state),n=Db(e.state),r=n!=Db(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 gf.none;let n=new xd;for(let{from:r,to:i}of e.visibleRanges)jy(this.tree,t,(e,t,r)=>{n.add(e,t,this.markCache[r]||(this.markCache[r]=gf.mark({class:r})))},r,i);return n.finish()}},Ab=Mu.high(Hp.fromClass(kb,{decorations:e=>e.decorations})),jb=wb.define([{tag:Y.meta,color:`#404740`},{tag:Y.link,textDecoration:`underline`},{tag:Y.heading,textDecoration:`underline`,fontWeight:`bold`},{tag:Y.emphasis,fontStyle:`italic`},{tag:Y.strong,fontWeight:`bold`},{tag:Y.strikethrough,textDecoration:`line-through`},{tag:Y.keyword,color:`#708`},{tag:[Y.atom,Y.bool,Y.url,Y.contentSeparator,Y.labelName],color:`#219`},{tag:[Y.literal,Y.inserted],color:`#164`},{tag:[Y.string,Y.deleted],color:`#a11`},{tag:[Y.regexp,Y.escape,Y.special(Y.string)],color:`#e40`},{tag:Y.definition(Y.variableName),color:`#00f`},{tag:Y.local(Y.variableName),color:`#30a`},{tag:[Y.typeName,Y.namespace],color:`#085`},{tag:Y.className,color:`#167`},{tag:[Y.special(Y.variableName),Y.macroName],color:`#256`},{tag:Y.definition(Y.propertyName),color:`#00c`},{tag:Y.comment,color:`#940`},{tag:Y.invalid,color:`#f00`}]),Mb=new q;function Nb(e){return{name:e.name||``,token:e.token,blankLine:e.blankLine||(()=>{}),startState:e.startState||(()=>!0),copyState:e.copyState||Pb,indent:e.indent||(()=>null),languageData:e.languageData||{},tokenTable:e.tokenTable||Hb,mergeTokens:e.mergeTokens!==!1}}function Pb(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 Fb=new WeakMap,Ib=class e extends $y{constructor(e){let t=Zy(e.languageData),n=Nb(e),r,i=new class extends iy{createParse(e,t,n){return new Bb(r,e,t,n)}};super(t,i,[],e.name),this.topNode=Qb(t,this),r=this,this.streamParser=n,this.stateAfter=new q({perNode:!0}),this.tokenTable=e.tokenTable?new Jb(n.tokenTable):Yb}static define(t){return new e(t)}getIndent(e){let t,{overrideIndentation:n}=e.options;n&&(t=Fb.get(e.state),t!=null&&t<e.pos-1e4&&(t=void 0));let r=Lb(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 Yy(t.text,e.state.tabSize,e.unit,i<0?void 0:i);for(;o.pos<r-t.from;)Vb(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&&Fb.set(e.state,o.from),this.streamParser.indent(a,/^\s*(.*)/.exec(o.text)[1],e)}get allowsNesting(){return!1}};function Lb(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 Iv&&s<i&&Lb(e,o,s,r,i);if(c)return c}return null}function Rb(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 Iv){if(!(c=Rb(e,s,n-o,r-o,i)))break;return i?new Iv(t.type,t.children.slice(0,a).concat(c),t.positions.slice(0,a+1),o+c.length):c}}return null}function zb(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&&Lb(e,i.tree,0-i.offset,n,a),s;if(o&&o.pos<=r&&(s=Rb(e,i.tree,n+i.offset,o.pos+i.offset,!1)))return{state:o.state,tree:s}}return{state:e.streamParser.startState(i?mb(i):4),tree:Iv.empty}}var Bb=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=ab.get(),a=r[0].from,{state:o,tree:s}=zb(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(mb(i.state)),i.skipUntilInView(this.parsedPos,i.viewport.from),this.parsedPos=i.viewport.from),this.moveRangeIndex()}advance(){let e=ab.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==`
|
|
21
|
+
`&&(t=``);else{let e=t.indexOf(`
|
|
22
|
+
`);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 Yy(t,e?e.state.tabSize:4,e?mb(e.state):2);if(a.eol())i.blankLine(this.state,a.indentUnit);else for(;!a.eol();){let e=Vb(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=Iv.build({buffer:this.chunk,start:this.chunkStart,length:this.parsedPos-this.chunkStart,nodeSet:Wb,topID:0,maxBufferLength:512,reused:this.chunkReused});e=new Iv(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 Iv(this.lang.topNode,this.chunks,this.chunkPos,this.parsedPos-this.ranges[0].from).balance()}};function Vb(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 Hb=Object.create(null),Ub=[jv.none],Wb=new Mv(Ub),Gb=[],Kb=Object.create(null),qb=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`]])qb[e]=Zb(Hb,t);var Jb=class{constructor(e){this.extra=e,this.table=Object.assign(Object.create(null),qb)}resolve(e){return e?this.table[e]||(this.table[e]=Zb(this.extra,e)):0}},Yb=new Jb(Hb);function Xb(e,t){Gb.indexOf(e)>-1||(Gb.push(e),console.warn(t))}function Zb(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):Xb(n,`Modifier ${n} used at start of tag`):t.length?Xb(n,`Tag ${n} used as modifier`):t=Array.isArray(r)?r:[r]:Xb(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=Kb[i];if(a)return a.id;let o=Kb[i]=jv.define({id:Ub.length,name:r,props:[Ey({[r]:n})]});return Ub.push(o),o.id}function Qb(e,t){let n=jv.define({id:Ub.length,name:`Document`,props:[Xy.add(()=>e),hb.add(()=>e=>t.getIndent(e))],top:!0});return Ub.push(n),n}ep.RTL,ep.LTR;var $b=`modulepreload`,ex=function(e){return`/`+e},tx={},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=ex(t,n),t=s(t),t in tx)return;tx[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`:$b,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 fb(Ib.define(e))}function nx(e){return Z(()=>import(`./dist-BiDoRe9D.js`).then(t=>t.sql({dialect:t[e]})),__vite__mapDeps([0,1,2]))}var rx=[X.of({name:`C`,extensions:[`c`,`h`,`ino`],load(){return Z(()=>import(`./dist-DhiTCntv.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-DhiTCntv.js`).then(e=>e.cpp()),__vite__mapDeps([3,1]))}}),X.of({name:`CQL`,alias:[`cassandra`],extensions:[`cql`],load(){return nx(`Cassandra`)}}),X.of({name:`CSS`,extensions:[`css`],load(){return Z(()=>import(`./dist-CtZX6MYS.js`).then(e=>e.i).then(e=>e.css()),__vite__mapDeps([4,1]))}}),X.of({name:`Go`,extensions:[`go`],load(){return Z(()=>import(`./dist-aThlveSw.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-BwlwqxvG.js`).then(e=>e.html()),__vite__mapDeps([6,1,4,7,2]))}}),X.of({name:`Java`,extensions:[`java`],load(){return Z(()=>import(`./dist-CsYenlD4.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-DTc8flxp.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-Du1n7ZSG.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-CwgAOVvQ.js`).then(e=>e.json()),__vite__mapDeps([10,1]))}}),X.of({name:`JSX`,extensions:[`jsx`],load(){return Z(()=>import(`./dist-DTc8flxp.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-B2ExgJ2X.js`).then(e=>e.less()),__vite__mapDeps([11,1,4]))}}),X.of({name:`Liquid`,extensions:[`liquid`],load(){return Z(()=>import(`./dist-D9DZdvJR.js`).then(e=>e.liquid()),__vite__mapDeps([12,1,6,4,7,2]))}}),X.of({name:`MariaDB SQL`,load(){return nx(`MariaSQL`)}}),X.of({name:`Markdown`,extensions:[`md`,`markdown`,`mkd`],load(){return Z(()=>import(`./dist-Cb3YMdvA.js`).then(e=>e.markdown()),__vite__mapDeps([13,2,6,1,4,7]))}}),X.of({name:`MS SQL`,load(){return nx(`MSSQL`)}}),X.of({name:`MySQL`,load(){return nx(`MySQL`)}}),X.of({name:`PHP`,extensions:[`php`,`php3`,`php4`,`php5`,`php7`,`phtml`],load(){return Z(()=>import(`./dist-nRE-0GfQ.js`).then(e=>e.php()),__vite__mapDeps([14,1,6,4,7,2]))}}),X.of({name:`PLSQL`,extensions:[`pls`],load(){return nx(`PLSQL`)}}),X.of({name:`PostgreSQL`,load(){return nx(`PostgreSQL`)}}),X.of({name:`Python`,extensions:[`BUILD`,`bzl`,`py`,`pyw`],filename:/^(BUCK|BUILD)$/,load(){return Z(()=>import(`./dist-CbwrhYdz.js`).then(e=>e.python()),__vite__mapDeps([15,1,2]))}}),X.of({name:`Rust`,extensions:[`rs`],load(){return Z(()=>import(`./dist-BNhij8mV.js`).then(e=>e.rust()),__vite__mapDeps([16,1]))}}),X.of({name:`Sass`,extensions:[`sass`],load(){return Z(()=>import(`./dist-D59573Id.js`).then(e=>e.sass({indented:!0})),__vite__mapDeps([17,1,4]))}}),X.of({name:`SCSS`,extensions:[`scss`],load(){return Z(()=>import(`./dist-D59573Id.js`).then(e=>e.sass()),__vite__mapDeps([17,1,4]))}}),X.of({name:`SQL`,extensions:[`sql`],load(){return nx(`StandardSQL`)}}),X.of({name:`SQLite`,load(){return nx(`SQLite`)}}),X.of({name:`TSX`,extensions:[`tsx`],load(){return Z(()=>import(`./dist-DTc8flxp.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-DTc8flxp.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-CPKhY-Mt.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-6c4aXhbi.js`).then(e=>e.xml()),__vite__mapDeps([19,1]))}}),X.of({name:`YAML`,alias:[`yml`],extensions:[`yaml`,`yml`],load(){return Z(()=>import(`./dist-CllfLwoI.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-B2pJ5QS3.js`).then(e=>e.vue()),__vite__mapDeps([27,1,7,2,6,4]))}}),X.of({name:`Angular Template`,load(){return Z(()=>import(`./dist-B_Er-tdr.js`).then(e=>e.angular()),__vite__mapDeps([28,1,7,2,6,4]))}})],ix=typeof String.prototype.normalize==`function`?e=>e.normalize(`NFKD`):e=>e,ax=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(ix(e)):ix,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 su(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=cu(e),n=this.bufferStart+this.bufferPos;this.bufferPos+=lu(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`&&(ax.prototype[Symbol.iterator]=function(){return this});var ox={from:-1,to:-1,match:/.*/.exec(``),precise:!0},sx=`gm`+(/x/.unicode==null?``:`u`),cx=class{constructor(e,t,n,r=0,i=e.length){if(this.text=e,this.to=i,this.curLine=``,this.done=!1,this.value=ox,/\\[sWDnr]|\n|\r|\[\^/.test(t))return new dx(e,t,n,r,i);this.re=new RegExp(t,sx+(n?.ignoreCase?`i`:``)),this.test=n?.test,this.iter=e.iter();let a=e.lineAt(r);this.curLineStart=a.from,this.matchPos=px(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=px(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}}},lx=new WeakMap,ux=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=lx.get(t);if(!i||i.from>=r||i.to<=n){let i=new e(n,t.sliceString(n,r));return lx.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)),lx.set(t,new e(o,a)),new e(n,a.slice(n-o,r-o))}},dx=class{constructor(e,t,n,r,i){this.text=e,this.to=i,this.done=!1,this.value=ox,this.matchPos=px(e,r),this.re=new RegExp(t,sx+(n?.ignoreCase?`i`:``)),this.test=n?.test,this.flat=ux.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=px(this.text,n+ +(e==n)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=ux.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+this.flat.text.length*2))}}};typeof Symbol<`u`&&(cx.prototype[Symbol.iterator]=dx.prototype[Symbol.iterator]=function(){return this});function fx(e){try{return new RegExp(e,sx),!0}catch{return!1}}function px(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 mx=e=>{let t=ev(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}=$_(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=U.cursor(f.from+Math.max(0,Math.min(u,f.length)));e.dispatch({effects:[i,K.scrollIntoView(p.from,{y:`center`})],selection:p})}),!0},hx=({state:e,dispatch:t})=>{let{selection:n}=e,r=U.create(n.ranges.map(t=>e.wordAt(t.head)||U.cursor(t.head)),n.mainIndex);return!r.eq(n)&&(t(e.update({selection:r})),!0)};function gx(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 ax(e.doc,t,r[r.length-1].to);;)if(i.next(),i.done){if(n)return null;i=new ax(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 _x=({state:e,dispatch:t})=>{let{ranges:n}=e.selection;if(n.some(e=>e.from===e.to))return hx({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=gx(e,r);return i?(t(e.update({selection:e.selection.addRange(U.range(i.from,i.to),!1),effects:K.scrollIntoView(i.to)})),!0):!1},vx=W.define({combine(e){return fd(e,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:e=>new eS(e),scrollToMatch:e=>K.scrollIntoView(e)})}});function yx(e){return e?[vx.of(e),oS]:oS}var bx=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||fx(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`?`
|
|
23
|
+
`: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 jx(this):new Tx(this)}getCursor(e,t=0,n){let r=e.doc?e:dd.create({doc:e});return n??=r.doc.length,this.regexp?Dx(this,r,t,n):Cx(this,r,t,n)}},xx=class{constructor(e){this.spec=e}};function Sx(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 Cx(e,t,n,r){let i;return e.wholeWord&&(i=wx(t.doc,t.charCategorizer(t.selection.main.head))),e.test&&(i=Sx(e.test,t,i)),new ax(t.doc,e.unquoted,n,r,e.caseSensitive?void 0:e=>e.toLowerCase(),i)}function wx(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(Ox(i,n-a))!=od.Word||t(kx(i,n-a))!=od.Word)&&(t(kx(i,r-a))!=od.Word||t(Ox(i,r-a))!=od.Word))}var Tx=class extends xx{constructor(e){super(e)}nextMatch(e,t,n){let r=Cx(this.spec,e,n,e.doc.length).nextOverlapping();if(r.done){let n=Math.min(e.doc.length,t+this.spec.unquoted.length);r=Cx(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=Cx(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=Cx(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=Cx(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 Ex(e,t,n){return(r,i,a)=>(!n||n(r,i,a))&&e(a[0],t,r,i)}function Dx(e,t,n,r){let i;return e.wholeWord&&(i=Ax(t.charCategorizer(t.selection.main.head))),e.test&&(i=Ex(e.test,t,i)),new cx(t.doc,e.search,{ignoreCase:!e.caseSensitive,test:i},n,r)}function Ox(e,t){return e.slice(iu(e,t,!1),t)}function kx(e,t){return e.slice(t,iu(e,t))}function Ax(e){return(t,n,r)=>!r[0].length||(e(Ox(r.input,r.index))!=od.Word||e(kx(r.input,r.index))!=od.Word)&&(e(kx(r.input,r.index+r[0].length))!=od.Word||e(Ox(r.input,r.index+r[0].length))!=od.Word)}var jx=class extends xx{nextMatch(e,t,n){let r=Dx(this.spec,e,n,e.doc.length).next();return r.done&&(r=Dx(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=Dx(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=Dx(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=Dx(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)}},Mx=Xu.define(),Nx=Xu.define(),Px=ku.define({create(e){return new Ix(Jx(e).create(),null)},update(e,t){for(let n of t.effects)n.is(Mx)?e=new Ix(n.value.create(),e.panel):n.is(Nx)&&(e=new Ix(e.query,n.value?qx:null));return e},provide:e=>Q_.from(e,e=>e.panel)});function Fx(e){let t=e.field(Px,!1);return t?t.query.spec:Jx(e)}var Ix=class{constructor(e,t){this.query=e,this.panel=t}},Lx=gf.mark({class:`cm-searchMatch`}),Rx=gf.mark({class:`cm-searchMatch cm-searchMatch-selected`}),zx=Hp.fromClass(class{constructor(e){this.view=e,this.decorations=this.highlight(e.state.field(Px))}update(e){let t=e.state.field(Px);(t!=e.startState.field(Px)||e.docChanged||e.selectionSet||e.viewportChanged)&&(this.decorations=this.highlight(t))}highlight({query:e,panel:t}){if(!t||!e.spec.valid)return gf.none;let{view:n}=this,r=new xd;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?Rx:Lx)})}return r.finish()}},{decorations:e=>e.decorations});function Bx(e){return t=>{let n=t.state.field(Px,!1);return n&&n.query.spec.valid?e(t,n):Zx(t)}}var Vx=Bx((e,{query:t})=>{let{to:n}=e.state.selection.main,r=t.nextMatch(e.state,n,n);if(!r)return!1;let i=U.single(r.from,r.to),a=e.state.facet(vx);return e.dispatch({selection:i,effects:[iS(e,r),a.scrollToMatch(i.main,e)],userEvent:`select.search`}),Xx(e),!0}),Hx=Bx((e,{query:t})=>{let{state:n}=e,{from:r}=n.selection.main,i=t.prevMatch(n,r,r);if(!i)return!1;let a=U.single(i.from,i.to),o=e.state.facet(vx);return e.dispatch({selection:a,effects:[iS(e,i),o.scrollToMatch(a.main,e)],userEvent:`select.search`}),Xx(e),!0}),Ux=Bx((e,{query:t})=>{let n=t.matchAll(e.state,1e3);return!n||!n.length?!1:(e.dispatch({selection:U.create(n.map(e=>U.range(e.from,e.to))),userEvent:`select.search.matches`}),!0)}),Wx=({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 ax(e.doc,e.sliceDoc(r,i));!t.next().done;){if(a.length>1e3)return!1;t.value.from==r&&(o=a.length),a.push(U.range(t.value.from,t.value.to))}return t(e.update({selection:U.create(a,o),userEvent:`select.search.matches`})),!0},Gx=Bx((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(K.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=U.single(o.from,o.to).map(d),u.push(iS(e,o)),u.push(n.facet(vx).scrollToMatch(c.main,e))),e.dispatch({changes:d,selection:c,effects:u,userEvent:`input.replace`}),!0}),Kx=Bx((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:K.announce.of(r),userEvent:`input.replace.all`}),!0});function qx(e){return e.state.facet(vx).createPanel(e)}function Jx(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(vx);return new bx({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 Yx(e){let t=J_(e,qx);return t&&t.dom.querySelector(`[main-field]`)}function Xx(e){let t=Yx(e);t&&t==e.root.activeElement&&t.select()}var Zx=e=>{let t=e.state.field(Px,!1);if(t&&t.panel){let n=Yx(e);if(n&&n!=e.root.activeElement){let r=Jx(e.state,t.query.spec);r.valid&&e.dispatch({effects:Mx.of(r)}),n.focus(),n.select()}}else e.dispatch({effects:[Nx.of(!0),t?Mx.of(Jx(e.state,t.query.spec)):Xu.appendConfig.of(oS)]});return!0},Qx=e=>{let t=e.state.field(Px,!1);if(!t||!t.panel)return!1;let n=J_(e,qx);return n&&n.dom.contains(e.root.activeElement)&&e.focus(),e.dispatch({effects:Nx.of(!1)}),!0},$x=[{key:`Mod-f`,run:Zx,scope:`editor search-panel`},{key:`F3`,run:Vx,shift:Hx,scope:`editor search-panel`,preventDefault:!0},{key:`Mod-g`,run:Vx,shift:Hx,scope:`editor search-panel`,preventDefault:!0},{key:`Escape`,run:Qx,scope:`editor search-panel`},{key:`Mod-Shift-l`,run:Wx},{key:`Mod-Alt-g`,run:mx},{key:`Mod-d`,run:_x,preventDefault:!0}],eS=class{constructor(e){this.view=e;let t=this.query=e.state.field(Px).query.spec;this.commit=this.commit.bind(this),this.searchField=Jd(`input`,{value:t.search,placeholder:tS(e,`Find`),"aria-label":tS(e,`Find`),class:`cm-textfield`,name:`search`,form:``,"main-field":`true`,onchange:this.commit,onkeyup:this.commit}),this.replaceField=Jd(`input`,{value:t.replace,placeholder:tS(e,`Replace`),"aria-label":tS(e,`Replace`),class:`cm-textfield`,name:`replace`,form:``,onchange:this.commit,onkeyup:this.commit}),this.caseField=Jd(`input`,{type:`checkbox`,name:`case`,form:``,checked:t.caseSensitive,onchange:this.commit}),this.reField=Jd(`input`,{type:`checkbox`,name:`re`,form:``,checked:t.regexp,onchange:this.commit}),this.wordField=Jd(`input`,{type:`checkbox`,name:`word`,form:``,checked:t.wholeWord,onchange:this.commit});function n(e,t,n){return Jd(`button`,{class:`cm-button`,name:e,onclick:t,type:`button`},n)}this.dom=Jd(`div`,{onkeydown:e=>this.keydown(e),class:`cm-search`},[this.searchField,n(`next`,()=>Vx(e),[tS(e,`next`)]),n(`prev`,()=>Hx(e),[tS(e,`previous`)]),n(`select`,()=>Ux(e),[tS(e,`all`)]),Jd(`label`,null,[this.caseField,tS(e,`match case`)]),Jd(`label`,null,[this.reField,tS(e,`regexp`)]),Jd(`label`,null,[this.wordField,tS(e,`by word`)]),...e.state.readOnly?[]:[Jd(`br`),this.replaceField,n(`replace`,()=>Gx(e),[tS(e,`replace`)]),n(`replaceAll`,()=>Kx(e),[tS(e,`replace all`)])],Jd(`button`,{name:`close`,onclick:()=>Qx(e),"aria-label":tS(e,`close`),type:`button`},[`×`])])}commit(){let e=new bx({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:Mx.of(e)}))}keydown(e){c_(this.view,e,`search-panel`)?e.preventDefault():e.keyCode==13&&e.target==this.searchField?(e.preventDefault(),(e.shiftKey?Hx:Vx)(this.view)):e.keyCode==13&&e.target==this.replaceField&&(e.preventDefault(),Gx(this.view))}update(e){for(let t of e.transactions)for(let e of t.effects)e.is(Mx)&&!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(vx).top}};function tS(e,t){return e.state.phrase(t)}var nS=30,rS=/[\s\.,:;?!]/;function iS(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-nS),o=Math.min(i,n+nS),s=e.state.sliceDoc(a,o);if(a!=r.from){for(let e=0;e<nS;e++)if(!rS.test(s[e+1])&&rS.test(s[e])){s=s.slice(e);break}}if(o!=i){for(let e=s.length-1;e>s.length-nS;e--)if(!rS.test(s[e-1])&&rS.test(s[e])){s=s.slice(0,e);break}}return K.announce.of(`${e.state.phrase(`current match`)}. ${s} ${e.state.phrase(`on line`)} ${r.number}.`)}var aS=K.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`}}),oS=[Px,Mu.low(zx),aS],sS={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 cS({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,h]=(0,_.useState)(null),[g,v]=(0,_.useState)(!1),[y,x]=(0,_.useState)(0),[S,C]=(0,_.useState)(`Plain text`),w=ac();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;h(null),v(!1);let a=`${no}/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||h(c)})().catch(()=>{i.signal.aborted||v(!0)}),()=>i.abort()},[e,t,n,r,y]),(0,_.useEffect)(()=>{if(!d.current||m?.status!==`ready`||m.text==null)return;u(`Search this file`);let e=!1,t=new Pu,r=new K({parent:d.current,state:dd.create({doc:m.text,extensions:[dd.readOnly.of(!0),K.editable.of(!1),dd.changeFilter.of(()=>!1),K.contentAttributes.of({tabindex:`0`,"aria-label":`Read-only source`,role:`textbox`,"aria-readonly":`true`}),K.domEventHandlers({focus:(e,t)=>(t.focus(),!1)}),wv(),B_(),w_(),yx({top:!0}),a_.of([...$x,{key:`Mod-a`,run:e=>(e.dispatch({selection:{anchor:0,head:e.state.doc.length}}),!0)}]),K.updateListener.of(e=>{if(e.transactions.some(e=>e.effects.some(e=>e.is(Mx)))){let t=Fx(e.state);u(t.valid?t.getCursor(e.state).next().done?`No results`:`Matches found`:`Enter text to search`)}}),Ob(jb),t.of([]),K.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-selectionBackground, .cm-selectionBackground, ::selection":{backgroundColor:`var(--chrome-key)`}},{dark:w===`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:K.scrollIntoView(r.state.doc.line(o).from,{y:`center`})});let c=X.matchFilename(rx,n);return C(m.long_line?`Plain text · long line protection`:c?.name??`Plain text`),c&&!m.long_line&&c.load().then(n=>{e||r.dispatch({effects:t.reconfigure(n)})}).catch(()=>{e||C(`Plain text · highlighting unavailable`)}),()=>{e=!0,f.current=null,r.destroy()}},[m,n,i,a,w]),(0,b.jsxs)(`section`,{ref:c,className:`source-reader`,"data-source-reader":!0,role:o?`dialog`:`region`,"aria-modal":o||void 0,"aria-label":`Source reader`,onKeyDown:e=>{if(e.stopPropagation(),!e.defaultPrevented){if(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())}e.key===`Escape`&&!d.current?.querySelector(`.cm-search`)&&(e.preventDefault(),s())}},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`,{onClick:()=>{f.current&&Zx(f.current)},disabled:m?.status!==`ready`,children:`Find in file`})]}),(0,b.jsxs)(`p`,{className:`source-provenance`,children:[m?`${m.repository} · ${m.commit}`:`Snapshot source`,` · Read only`]}),!m&&!g&&(0,b.jsx)(`p`,{role:`status`,children:`Loading committed source…`}),g&&(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:()=>x(e=>e+1),children:`Retry source`})]}),m&&m.status!==`ready`&&(0,b.jsx)(`p`,{role:`status`,children:sS[m.status]??`Source unavailable.`}),m?.status===`ready`&&(0,b.jsxs)(`p`,{className:`source-provenance`,children:[S,` · `,m.bytes.toLocaleString(),` bytes · Lines `,i,`–`,a]}),m?.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 lS=[`class`,`func`,`method`,`interface`,`type`,`const`],uS=[`#3A6796`,`#2F6F63`,`#4E7A33`,`#7E3F5D`,`#8A6B1C`,`#93502A`];function dS(e){let t=new Map;for(let[n,r]of e.E){let i=R(e,n),a=R(e,r);if(i===a||L(e.districts[String(i)])!==`mainland`||L(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 fS=(e,t)=>t.total-e.total||e.a-t.a||e.b-t.b;function pS(e,t=12,n=2){let r=[...e.values()],i=[...r].sort(fS),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(fS).slice(0,n))a.add(`${t.a}-${t.b}`);return i.filter(e=>a.has(`${e.a}-${e.b}`))}function mS(e){return Math.sqrt(Math.max(e,0)/Math.PI)}function hS(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 gS(e,t,n,r){if(!n.length||!hS(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(!hS([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;hS([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 _S(e){let{a:t,b:n,ringsA:r,ringsB:i,raWorld:a,rbWorld:o,widthPx:s,bothDirections:c,k:l,toScreen:u}=e,d=gS(t,n,r,a),f=gS(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)],[A,ee]=u(d),[j,te]=u(h),[M,N]=u(f);return{polygon:E,chevrons:k,hitD:`M${A.toFixed(1)} ${ee.toFixed(1)} Q${j.toFixed(1)} ${te.toFixed(1)} ${M.toFixed(1)} ${N.toFixed(1)}`}}function vS(e){return pS(dS(e)).map(t=>({...t,raWorld:mS(Es(e.districts[String(t.a)])),rbWorld:mS(Es(e.districts[String(t.b)]))}))}function yS(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=R(e,n),a=t.get(i);a||(a=[],t.set(i,a)),a.push(Ts(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 bS(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 xS(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 SS(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&&hS(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&&hS(a,[n]))return t}if(i>0)for(let t of u){let n=e.P[String(t)];if(n&&xS(a,n,i))return t}return null}function CS(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 wS(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 TS(e,t,n,r){let i=wS(n,r,t);if(i)return{path:i,kind:`imports`};if(i=wS(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=wS(n,r,a),i?{path:i,kind:`undirected`}:null}function ES(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)=>Zo(e,n.j)-Zo(e,t.j)||t.j-n.j),{shown:a.slice(0,i),total:a.length}}function DS(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=>R(e,t)));return{set:new Set(r),files:r,districts:i}}var OS=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 kS(e){return OS.has(e)||/^utils\.[^./]+$/.test(e)}function AS(e){let t=e.N.map((t,n)=>Zo(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=(kS(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 jS(e,t,n){let r=3.5+9*Math.sqrt(e/(t||1));return n?r*.72:r}var MS=[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],NS=[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],PS=[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],FS={"·":333,"…":965,"—":1e3,"–":500},IS=1e3,LS=`Archivo, ui-sans-serif, system-ui, sans-serif`;function RS(e,t,n=400){let r=n<=400?MS:n<=500?NS:PS,i=0;for(let n of e){let e=n.codePointAt(0),a=(e>=32&&e<=126?r[e-32]:FS[n]??IS)/1e3*t;i+=Math.max(a,Math.round(a))}return i}function zS(e,t,n=400){return RS(e,t,n)+t*.4}var BS=.06;function VS(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]=Ro(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)*BS,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++)Vo(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 HS(e,t){let n=e.file_neighbourhoods?.[t];return n==null?null:e.neighbourhoods?.[n]??null}function US(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]=es(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 WS=4;function GS(e){let t=Object.keys(e.districts),n=n=>t.filter(t=>L(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 KS(e){let t=GS(e);return[...t.mainland,...t.islands].map(Number)}function qS(e){return e.split(`/`).pop()??e}function JS(e,t,n){let r=new Map;for(let[i,a]of e.E)if(i===t){let t=R(e,a);t!==n&&r.set(t,(r.get(t)??0)+1)}else if(a===t){let t=R(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 YS(e,t,n){return e.L.filter(r=>r[1]===t&&R(e,r[0])===n)}function XS(e){let t=e.split(`/`).pop()??e;return t===`__init__.py`||t===`exceptions.py`||t===`errors.py`}function ZS(e,t){let n=YS(e,`hub`,t)[0];if(n)return{file:n[0],fi:Zo(e,n[0])};let r=n=>{let r=-1,i=-1;for(let a=0;a<e.N.length;a++){if(R(e,a)!==t||n&&XS(e.F[a]))continue;let o=Zo(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 QS(e,t,n){let{file:r,fi:i}=ZS(e,n),a=[];r!==-1&&i>0&&a.push({kind:`most-imported`,file:r,text:`most imported: ${qS(e.F[r])} (${i})`});let o=YS(e,`entry`,n)[0];o&&a.push({kind:`entry`,file:o[0],text:`entry: ${qS(e.F[o[0]])}`});let s=YS(e,`bridge`,n)[0];if(s){let t=JS(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=YS(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: ${qS(e.F[c[0]])}`});let l=(t.districtPaths.get(n)??[]).find(e=>!e.other),u=l&&l.share>=40?Gs(l.path):null;return{d:n,name:e.names[String(n)],size:e.districts[String(n)].size,mostly:u,keyFiles:a.slice(0,WS)}}function $S(e,t){let n=GS(e),r=n.mainland.map(n=>QS(e,t,Number(n)));return{totalFiles:e.F.length,mainland:r,islandIds:n.islands}}var eC={entry:`var(--why-entry)`,bridge:`var(--why-bridge)`,hub:`var(--why-hub)`,capital:`var(--why-capital)`,hazard:`var(--why-hazard)`};function tC(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 nC={imports:`follows imports, source → target`,"imported-by":`reverse direction — the target imports the source`,undirected:`no directed path; shown ignoring edge direction`};function rC(e){return e===`mouse`?4:10}var iC=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)<=rC(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)<=rC(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 aC(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 oC=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}},sC=3.4,cC=20,lC=32;function uC(e,t,n,r,i,a,o=[]){let s=[...o],c=(e,t)=>[e-cC/2,t-lC,cC,lC],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 dC=(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 fC(e,t){let n=new Map,r=e.file_neighbourhoods;if(!r)return n;for(let[i,a]of e.E){if(R(e,i)!==t||R(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 pC(e,t=20){let n=[...e.values()],r=[...n].sort(dC),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(dC)[0];t&&i.add(`${t.a}\0${t.b}`)}return r.filter(e=>i.has(`${e.a}\0${e.b}`))}function mC(e,t){let n=new Map,r=e.file_neighbourhoods;if(!r)return n;for(let[i,a]of e.E){let o=R(e,i),s=R(e,a);if(o===s)continue;let c=o===t?i:s===t?a:-1;if(c===-1)continue;let l=R(e,c===i?a:i);if(L(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 hC=(e,t)=>t.total-e.total||(e.n<t.n?-1:+(e.n>t.n))||e.d-t.d;function gC(e,t=12){return[...e.values()].sort(hC).slice(0,t)}var _C=[`peek`,`half`,`full`],vC=.57;function yC(e){return e.safeTop+12+48}function bC(e){let t=156+e.safeBottom,n=Math.max(t,Math.round(e.height-(yC(e)+8)));return{peek:t,half:Math.min(n,Math.max(t,Math.min(480,Math.round(e.height*vC)))),full:n}}function xC(e,t){return{left:(e.safeLeft??0)+12,top:yC(e)+8,right:(e.safeRight??0)+12+44+8,bottom:t+8}}function SC(e,t,n){let r=_C.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?_C[Math.min(r.length-1,r[i]>e?i:i+1)]:_C[Math.max(0,r[i]<e?i:i-1)]:_C[i]}function CC(e){return e===`peek`?`half`:e===`half`?`full`:`peek`}function wC(e,t,n){return Math.max(n.peek-40,Math.min(n.full,e-t))}function TC(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 EC(e){return e.zone===`handle`||e.detent===`peek`||!e.canScroll?`sheet`:e.direction===`down`?e.scrollTop<=0?`sheet`:`content`:e.detent===`full`?`content`:`sheet`}function DC(e,t){return e<=600||t<=500}function OC(e,t){return t<=500&&e>t?`landscape`:e<=600?`phone`:e<=1100?`tablet`:`desktop`}function kC(e){return e===`tablet`||e===`desktop`}function AC(e){return e===`phone`||e===`landscape`}function jC(e){return e!==`desktop`}function MC(e,t){return e?360+t.left:0}function NC(e,t){return{left:MC(e,t)+(e?0:t.left)+12,top:t.top+12+48+8,right:t.right+12+44+8,bottom:t.bottom+12}}function PC(e){return e===`tablet`?44:40}function FC(e){let t=PC(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 IC(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,Ts(r))}return t}var LC=0,RC=1,zC=2,BC=3,VC=4,HC=5,UC=7,WC=e=>e[LC],GC=e=>e[RC],KC=e=>e[zC],qC=e=>e[BC],JC=e=>e[VC],YC=e=>e[HC],XC=e=>e[UC]===!0,ZC=1e11;function QC(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/ZC,r/ZC]);return t}function $C(e){return!e||e.length===0?null:e.map(QC)}function ew(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 tw(e){let t=1/0,n=1/0,r=-1/0,i=-1/0;for(let a of e){let[e,o,s,c]=ew(a);e<t&&(t=e),o<n&&(n=o),s>r&&(r=s),c>i&&(i=c)}return[t,n,r,i]}function nw(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 rw(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=YC(t),c=s>=0?n.get(s):void 0;if(c!=null&&WC(e.symbols[c])===WC(t))r[o]=c,i[c].push(o);else{let e=a.get(WC(t));e||(e=[],a.set(WC(t),e)),e.push(o)}}for(let t of a.values())t.sort((t,n)=>qC(e.symbols[t])-qC(e.symbols[n]));for(let t of i)t.sort((t,n)=>qC(e.symbols[t])-qC(e.symbols[n]));let o=e.symbol_rings?e.symbol_rings.map(e=>$C(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=$C(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=$C(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 iw(e,t,n){return n?!0:e>0&&Math.sqrt(e)*t>=40}function aw(e,t,n){return e?n?!0:t>=110:!1}function ow(e,t){let n=[],r=e.localParent[t];for(;r>=0;)n.push(r),r=e.localParent[r];return n}function sw(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 cw(e,t,n){let r=GC(e),i=KC(e),a=i===1||i===2||i===3,o=n&&t>0?` ▸${t}`:``;return`${r}${a?`()`:``}${o}`}function lw(e){return e===0||e===4}function uw(e){return e===3}function dw(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 fw(e){return e<=0?.55:e===1?.85:.6}var pw=.25;function mw(e,t){let n=e.kinds?.[t];return n===`extends`||n===`implements`||n===`overrides`?n:`call`}function hw(e,t){return n=>{if(t.has(n))return`s:${n}`;let r=e.globalToLocal.get(n);if(r!=null){for(let n of ow(e,r)){let r=e.raw.symbol_indices[n];if(t.has(r))return`s:${r}`}return`f:${WC(e.raw.symbols[r])}`}return`f:${n}`}}function gw(e,t,n){let r=sw(e,t),i=new Set([...r].map(t=>e.raw.symbol_indices[t])),a=new Set(ow(e,t).map(t=>e.raw.symbol_indices[t])),o=hw(e,n),s=new Map,c=new Map;for(let[n,r,l,u]of xw(e.raw)){if(mw(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 _w(e,t,n){let r=sw(e,t),i=new Set([...r].map(t=>e.raw.symbol_indices[t])),a=new Set(ow(e,t).map(t=>e.raw.symbol_indices[t])),o=hw(e,n),s=e.raw.symbol_indices[t],c=new Set,l=[];for(let[t,n,,r]of e.raw.edges){let u=mw(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 vw(e,t){return[...e.entries()].sort((e,t)=>t[1]-e[1]).slice(0,t)}function yw(e){return 1+Math.min(3,Math.log2(1+e))*.7}var bw={0:`class`,1:`function`,2:`method`,3:`nested function`,4:`interface`,5:`type`,6:`constant`};function xw(e){let t=e.kinds?e.kinds.indexOf(`possible_implementation`):-1;return t<0?e.edges:e.edges.filter(e=>e[3]!==t)}function Sw(e,t){let n=new Map;for(let[,t,r]of xw(e.raw))n.set(t,(n.get(t)??0)+r);let r=new Map;for(let[t,n,,i]of e.raw.edges){if(mw(e.raw,i)!==`extends`)continue;let a=e.globalToLocal.get(n);if(a==null)continue;let o=r.get(t)??[];o.push(GC(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 Cw(e){let t=0;for(let n of e)t+=1+Cw(n.children);return t}function ww(e,t){let n=e.raw,r=n.symbol_indices[t],i=t=>{let r=e.globalToLocal.get(t);return r==null?`#${t}`:GC(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=mw(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 Tw(e,t,n){let r=e.topByFile.get(n)??[],i=[];for(let n of r){let r=sw(e,n),a=new Set([...r].map(t=>e.raw.symbol_indices[t])),o=new Map;for(let[n,r,i]of xw(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 ow(e,s))n=t;c=`s:${e.raw.symbol_indices[n]}`,l=`${t.F[WC(e.raw.symbols[n])]} › ${GC(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}var Ew=`http://www.w3.org/2000/svg`;function Dw(e){return[e.title,...e.rows.map(e=>e.map(e=>typeof e==`string`?e:e.text).join(``))]}function Ow(e,t=!1){return{title:e[0],titleMono:t,rows:e.slice(1).map(e=>[e])}}var kw=12,Aw=120,jw=16,Mw=[[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]],Nw=12;function $(e,t={}){let n=document.createElementNS(Ew,e);for(let e in t)n.setAttribute(e,String(t[e]));return n}function Pw(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 Fw=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;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:is,safe:is,centreInSafe:!1};panTravel=0;panDismissed=!1;directFileTaps=!1;gestures=new iC;pinch=null;clickAllowed=!1;renderGate=new oC;quietTimer=null;animId=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=null;hoverImportG=null;hoverImportTimer=null;outAdj=new Map;inAdj=new Map;keyElements=new Map;linkCache=null;constructor(e,t){this.svg=e,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?.remove(),this.hoverCard=null)}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}=CS(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)=>Zo(e,n)+qo(e,n)/50-(Zo(e,t)+qo(e,t)/50)||t-n);let r=new Map;for(let t=0;t<e.N.length;t++){let n=`${R(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=>L(e.districts[t])!==`unconnected`),this.labelDistrictIds=[...this.drawableDistrictIds].sort((t,n)=>Number(L(e.districts[t])===`island`)-Number(L(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.roadPlan=vS(e),this.roadMaxTotal=Math.max(1,...this.roadPlan.map(e=>e.total)),this.hubSet=AS(e),this.hasFootprints=!!e.P,this.neighbourhoodShade=e.neighbourhoods?VS(e):new Map,this.neighbourhoodCentroid=e.neighbourhoods?US(e):new Map,this.streetCache=null,this.districtMedianArea=this.hasFootprints?yS(e):new Map,this.footprintIndex=this.hasFootprints?bS(e):null,this.fileFootprintArea=this.hasFootprints?IC(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=R(e,t);this.unconnectedFile[t]=+(L(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=Zo(e,t)+qo(e,t)/50,s=Zo(e,n)+qo(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,Es(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=R(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(L(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)/(sC-e.ISLAND_FADE_START_ZF))}islandFadeForDistrict(e,t,n,r){return L(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=DC(this.mapBoxW,this.mapBoxH);this.mapBoxW=this.svg.clientWidth,this.mapBoxH=this.svg.clientHeight;let r=DC(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()}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=rs(e,t),o=ns(e,t),s={doc:e,geo:t,vw:this.VW,vh:this.VH,frameKey:i,mainland:a,world:o,fit:cs(a,this.VW,this.VH,r),full:cs(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]=os(this.VW,this.VH,r),o=cs(n,this.VW,this.VH,r),s=i+(a-i-(n[2]-n[0])*o)/2-n[0]*o,c=ss(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]=os(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`?Ds(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(R(t,e)))continue;let[n,i,o,s]=Qo(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]=os(this.VW,this.VH,o),d=this.clampK(cs(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`?Ds(this.state.doc,e):t.c;(!Number.isFinite(n[0])||!Number.isFinite(n[1]))&&(n=t.c);let r=DC(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]=os(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?$o(this.state.doc,this.state.geo,e):[0,0]}anchor(e){return this.state?es(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`?bs(t,R(t,e)):n===`c`?gs(Math.min(1,Xo(t,e)/(this.maxCh||1))):n===`x`?gs(Math.min(1,Yo(t,e)/(this.maxCx||1))):r.fileColors[e]}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=kC(OC(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=DS(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)>=Aw&&S.add(+e)}let C=y?new Set([R(n,a),...y.out.map(e=>R(n,e)),...y.in.map(e=>R(n,e))]):null,w=new Set;if(s!=null&&w.add(s),a!=null&&w.add(R(n,a)),b&&(!l||u))for(let e of b)w.add(R(n,e));if(r!==`t`){for(let e of this.drawableDistrictIds){let t=s===+e,r=L(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:bs(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)`:bs(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)})}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,A=T?$(`defs`,{}):null;A&&p.appendChild(A);let ee=new Set(n.L.map(([e])=>e));if(a!=null&&ee.add(a),b)for(let e of b)ee.add(e);let j=D?(()=>{let e=new Set;for(let[t,n]of this.fileFootprintArea){let r=t===a;!r&&h<=1||iw(n,this.k,r)&&e.add(t)}return a!=null&&this.fileFootprintArea.has(a)&&e.add(a),e})():null,te=[];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,A,e,b,E);continue}if(D&&n.P[String(e)]){let t=R(n,e),r=!!j?.has(e);if(O&&!ee.has(e)&&!this.districtFootprintsLarge(t)&&!r)this.batchFootprint(k,e,t,h,g,w);else if(this.footprint(p,e,b,h,g,w,l),r){let t=this.anchor(e),n=this.X(t[0]),r=this.Y(t[1]);n>-100&&n<this.VW+100&&r>-100&&r<this.VH+100&&te.push(e)}continue}if(d&&r!==`t`&&!S.has(R(n,e))&&!x.has(e)&&!j?.has(e))continue;let t=this.anchor(e),a;if(r!==`t`){let r=ee.has(e)?1:this.dotFactor(e);if(r<=0)continue;let i=this.islandFadeForDistrict(R(n,e),h,g,w);if(!this.islandFadeVisible(i))continue;let o=Math.max(1.1,(1.6+5.2*Math.sqrt(qo(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=Qo(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${qo(n,e)} loc · churn ${Xo(n,e)} · cplx ${Yo(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 M=e=>{if(this.unconnectedFile[e])return null;let t=this.islandFadeForDistrict(R(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]},N=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=uC(n,this.districtArea,M,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,te,e.selHSym,f,()=>[...P().map(({cx:e,cy:t})=>[e-10,t-32,20,32]),...(N??[]).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 N??[])re.push([e-n-1,t-n-1,2*(n+1),2*(n+1)]);re.push(...this.cardLabelBoxes);let ie=$(`g`,{});this.placeDistrictLabels(ie,ee,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(R(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 ae=this.drawHubRings(p,N??void 0);if(p.appendChild(ie),this.placeContentLabels(p,re,ee,h,ae,d,!0,S,x),this.gSymRefs=$(`g`,{}),p.appendChild(this.gSymRefs),this.renderSymbolRefs(e.selHSym),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)}}this.HOVER&&this.hoverKey&&this.reapplyHover(),this.applyOverviewDistrictHighlight()}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=zS(t,n,r?500:600),m=n*1.25,h=r?null:s.districts[String(e)].size+` files`,g=h?h.length*kw*.62:0,_=kw*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+jw-_;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 A=(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=A(e,t);if(n)return n}if(i)for(let{points:e}of T){let t=A(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:zS(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`:LS,"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=DC(this.mapBoxW,this.mapBoxH),f=this.k/this.fitScale(),p=this.state.selD;p==null&&this.state.sel!=null&&(p=R(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=R(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=R(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=L(s.districts[e])===`island`,m=i?this.islandFadeForDistrict(+e,f,n,r):1;if(i&&!this.islandFadeVisible(m))continue;let h=c===`t`?Ds(s,+e):s.districts[e].c,g=this.X(h[0]),_=this.Y(h[1]),v=d?Math.min(13,Math.max(kw,10+f)):Math.min(17,Math.max(kw,12+f)),y=i?Math.max(kw,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=zS(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=zS(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=Mw.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+jw,`${s.districts[e].size} files`,kw,.45,void 0,+e,!0):w>0?u(g,x+jw,`+${w} files`,kw,(i?.55:.7)*m,600,+e):!a&&f<1.8&&!d&&!i&&u(g,x+jw,s.districts[e].size+` files`,kw,.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=R(n,s.hub.i);if((i.get(e)??0)>=o(e))continue}r.push(s);let c=R(n,s.hub.i);i.set(c,(i.get(c)??0)+1)}return r}hubCandidates(){let{hubs:e,maxFi:t}=this.hubSet,n=DC(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=jS(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=DC(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=Nw,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}=this.state,n=e=>[this.X(e[0]),this.Y(e[1])];for(let r of this.roadPlan){let i=t.districts[String(r.a)],a=t.districts[String(r.b)];if(!i||!a)continue;let o=r.ab>=r.ba,s=o?i:a,c=o?a:i,l=o?r.raWorld:r.rbWorld,u=o?r.rbWorld:r.raWorld,d=Math.max(r.ab,r.ba),f=Math.min(r.ab,r.ba),p=d>0&&f/d>=.35,m=1.5+6*Math.sqrt(r.total/this.roadMaxTotal),h=_S({a:s.c,b:c.c,ringsA:s.blob,ringsB:c.blob,raWorld:l,rbWorld:u,widthPx:m,bothDirections:p,k:this.k,toScreen:n}),g=`r:${r.a}:${r.b}`;e.appendChild($(`path`,{d:`M`+h.polygon.map(e=>e[0].toFixed(1)+` `+e[1].toFixed(1)).join(`L`)+`Z`,fill:`var(--ink)`,"fill-opacity":.34,"pointer-events":`none`,"data-k":g}));for(let t of h.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(m*.28,2.4).toFixed(2),"stroke-linecap":`round`,"stroke-linejoin":`round`,"pointer-events":`none`}));let _=$(`path`,{d:h.hitD,fill:`none`,stroke:`transparent`,"stroke-width":Math.max(m*1.2,12).toFixed(1),"stroke-linecap":`round`,class:`hit`,"pointer-events":`all`,"data-k":g}),v=t.names[String(r.a)]??`district ${r.a}`,y=t.names[String(r.b)]??`district ${r.b}`,b=$(`title`,{});b.textContent=`${v} → ${y}: ${r.ab} imports\n${y} → ${v}: ${r.ba} imports`,_.appendChild(b),e.appendChild(_)}}getStreetPlan(e){if(this.streetCache?.d===e)return this.streetCache;let{doc:t}=this.state,n={d:e,intra:pC(fC(t,e)),cross:gC(mC(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+Ts(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=_S({a:p,b:m,ringsA:d.blob,ringsB:f.blob,raWorld:mS(a(d)),rbWorld:mS(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=_S({a:c,b:o.c,ringsA:r.blob,ringsB:o.blob,raWorld:mS(a(r)),rbWorld:mS(Es(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=R(s,t),f=this.islandFadeForDistrict(d,r,i,a);if(!this.islandFadeVisible(f))return;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;let v=!(!n||n.has(t)),y=s.file_neighbourhoods?.[t],b=y==null?null:this.neighbourhoodShade.get(y)??null,x=l===`d`?Ss(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`,{});D.textContent=`${s.F[t]}\n${qo(s,t)} loc · churn ${Xo(s,t)} · cplx ${Yo(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}))}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:Ss(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||L(o)===`unconnected`)continue;let u=L(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=zS(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":LS,"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]=Ro(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,kw,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=rw(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=>R(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 ow(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=R(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]=tw(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-pw)*100)}%, ${r} ${Math.round(pw*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=KC(o),u=i[0],[f,p,m,h]=ew(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=aw(E.length>0,C,w),O=E.length,k=cw(o,O,!D&&O>0),A=[];if(D)for(let e of E){let n=d(e,t+1);n&&A.push(n)}let ee=nw(u),j={local:e,global:a,depth:t,kind:s,rings:i,area:x*S,centroid:ee,expanded:D,memberCount:O,label:k,bold:lw(s),isException:w||T,children:A,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(ee[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=Nw,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(!dw(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=fw(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,...uw(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}=gw(r,i,this.symVisible),s=this.symScreenAnchor.get(t)??(()=>{let e=es(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=es(this.state.doc,this.state.geo,r.raw.symbols[n.local][0]);return[this.X(i[0]),this.Y(i[1])]}let n=es(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=yw(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 vw(a,120))l(e,t,!0);for(let[e,t]of vw(o,120))l(e,t,!1);for(let e of _w(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(Pw(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=DC(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=Nw,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(R(l,r))&&!c.has(r)||!this.hasFootprints&&u!==`t`&&!n.has(r)&&this.dotFactor(r)<=0)continue;let i=this.fileBasenames[r],d=`${R(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*Nw*.62/2;if(m-e<0||m+e>this.VW||g-9-Nw*1.25<0)continue}f(m,g-9,i,Nw,.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=ES(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(qo(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=Qo(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=bs(a,R(a,n)),_=ts(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(ws(Cs(_,qo(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?uS[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]} (${lS[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.positionCard(e.clientX,e.clientY,e.target)}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.hideCard();return}let r=this.hoverContent(t);if(!r){this.hideCard();return}if(this.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.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}=this.state,n=e.split(`:`);if(n[0]===`d`){let e=+n[1],r=t.districts[String(e)];if(!r)return null;let i=this.state?.districtPaths.get(e)?.find(e=>!e.other),a=i&&i.share>=40?Gs(i.path??`.`):null;return{title:t.names[String(e)]??`District ${e}`,rows:[[{text:String(r.size),mono:!0,field:`files`},` ${r.size===1?`file`:`files`} · `,...a?[`mostly `,{text:a,mono:!0,field:`mostly`}]:[{text:`mixed folders`,field:`mostly`}]]]}}if(n[0]===`dir`)return Ow([e.slice(4)+`/`,`folder highlight`],!0);if(n[0]===`r`){let e=+n[1],r=+n[2],i=this.roadPlan.find(t=>t.a===e&&t.b===r);if(!i)return null;let a=t.names[String(e)]??`district ${e}`,o=t.names[String(r)]??`district ${r}`;return Ow([`${a} ↔ ${o}`,`${a} → ${o}: ${i.ab} imports · ${o} → ${a}: ${i.ba} imports`])}if(n[0]===`st`&&n[1]===`n`){let e=n[2],r=n[3],i=this.streetCache?.intra.find(t=>t.a===e&&t.b===r||t.a===r&&t.b===e);if(!i)return null;let a=t.neighbourhoods?.[e]?.label??e,o=t.neighbourhoods?.[r]?.label??r;return Ow([`${a} ↔ ${o}`,`${a} → ${o}: ${i.ab} imports · ${o} → ${a}: ${i.ba} imports`])}if(n[0]===`st`&&n[1]===`c`){let e=n[2],r=+n[3],i=this.streetCache?.cross.find(t=>t.n===e&&t.d===r);if(!i)return null;let a=t.neighbourhoods?.[e]?.label??e,o=t.names[String(r)]??`district ${r}`;return Ow([`${a} ↔ ${o}`,`${a} → ${o}: ${i.out} imports · ${o} → ${a}: ${i.in} imports`])}if(n[0]===`n`){let e=t.neighbourhoods?.[n[1]];return e?Ow([e.label,`${e.size} files`]):null}if(n[0]===`f`){let e=+n[1],r=t.F[e];if(!r)return null;let i=this.inAdj.get(e)?.length??0,a=r.lastIndexOf(`/`),o=a<0?r:r.slice(a+1),s=a<0?`(repo root)`:r.slice(0,a),c=t.L.find(([t])=>t===e)?.[1];return{title:o,titleMono:!0,rows:[[{text:s,mono:!0,field:`path`}],[`imported by `,{text:String(i),mono:!0,field:`imported-by`},` ${i===1?`file`:`files`}`,...c?[{text:c,badge:eC[c]??`var(--dim)`,field:`landmark`}]:[]]]}}if(n[0]===`s`){let e=+n[1],r=+n[2],i=ts(t,e)[r];return i?Ow([i[0],lS[i[1]]??`symbol`,`lines ${i[2]}-${i[3]}`],!0):null}if(n[0]===`hs`){let e=+n[1],t=this.symLocalByGlobal.get(e);if(!t)return null;let{decoded:r,local:i}=t,a=r.raw.symbols[i],o=r.children[i].length,{out:s,in:c}=gw(r,i,this.symVisible),l=[...s.values()].reduce((e,t)=>e+t,0),u=[...c.values()].reduce((e,t)=>e+t,0);return Ow([GC(a),`${bw[KC(a)]??`symbol`}${o?` · ${o} members`:``}`,`lines ${a[3]}-${a[4]}`,`refs out ${l} (${s.size} places) · in ${u} (${c.size} places)`],!0)}return null}drawImportPreview(e){if(this.hoverKey!==`f:`+e)return;let{shown:t}=ES(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}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){if(!this.hoverCard||this.hoverCard.style.display===`none`)return;let r=this.svg.parentElement,i=r?r.getBoundingClientRect():this.svg.getBoundingClientRect(),a=r?.clientWidth??i.width,o=r?.clientHeight??i.height,s=this.hoverCard.offsetWidth,c=this.hoverCard.offsetHeight,l=e-i.left,u=t-i.top,d=n.getBoundingClientRect(),f=n.closest(`[data-k]`)?.getAttribute(`data-k`);if(n instanceof SVGTextElement&&f?.startsWith(`d:`)){let[e,t,n,r]=[d.left,d.top,d.right,d.bottom];for(let i of this.keyElements.get(f)??[]){if(!(i instanceof SVGTextElement))continue;let a=i.getBoundingClientRect();(a.width!==0||a.height!==0)&&([e,t,n,r]=[Math.min(e,a.left),Math.min(t,a.top),Math.max(n,a.right),Math.max(r,a.bottom)])}d=new DOMRect(e,t,n-e,r-t)}let p=d.left-i.left,m=d.top-i.top,h=p+d.width,g=m+d.height,_=[[h+16,Math.max(8,Math.min(o-c-8,u-c/2))],[p-16-s,Math.max(8,Math.min(o-c-8,u-c/2))],[Math.max(8,Math.min(a-s-8,l-s/2)),g+16],[Math.max(8,Math.min(a-s-8,l-s/2)),m-16-c],[l+16,u+16],[l-16-s,u+16],[l+16,u-16-c],[l-16-s,u-16-c]],v=(e,t)=>e>=8&&t>=8&&e+s<=a-8&&t+c<=o-8,y=(e,t)=>!(l>=e&&l<=e+s&&u>=t&&u<=t+c),b=(e,t)=>e+s<=p||e>=h||t+c<=m||t>=g,[x,S]=_.find(([e,t])=>v(e,t)&&y(e,t)&&b(e,t))??_.find(([e,t])=>v(e,t)&&y(e,t))??_[0];if(x=Math.max(8,Math.min(a-s-8,x)),S=Math.max(8,Math.min(o-c-8,S)),!y(x,S)){let e=l-16-s,t=l+16;e>=8?x=e:t+s<=a-8&&(x=t);let n=u-16-c,r=u+16;n>=8?S=n:r+c<=o-8&&(S=r)}this.hoverCard.style.left=`${Math.round(x)}px`,this.hoverCard.style.top=`${Math.round(S)}px`}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}=aC(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=SS(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.hideCard(),this.callbacks.onClearSelection();return}let n=t.split(`:`);if(n[0]===`r`||n[0]===`st`||n[0]===`n`){let n=this.hoverContent(t);if(n&&this.callbacks.onTapStructure?.(t,Dw(n))){this.hideCard();return}n&&(this.showCard(n),this.positionCard(e.clientX,e.clientY,e.target));return}this.hideCard(),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=R(t.doc,e);if((t.selD??(t.sel==null?null:R(t.doc,t.sel)))!==n){this.callbacks.onSelectDistrict(n);return}}this.callbacks.onSelectFile(e)}};function Iw({doc:e,geo:t,layer:n,sel:r,selSym:i,selD:a,route:o,packageGrouping:s,districtPaths:c,folderFiles:l,folderOnlyIslands:u,folderLabels:d,activeDirectory:f,districtSymbols:p,selHSym:m,insets:h,callbacks:g,handleRef:v}){let y=(0,_.useRef)(null),x=(0,_.useRef)(null),S=(0,_.useRef)(null),C=(0,_.useRef)(g);C.current=g,(0,_.useLayoutEffect)(()=>{if(!y.current)return;let e=new Fw(y.current,{onSelectDistrict:e=>C.current.onSelectDistrict(e),onSelectFile:e=>C.current.onSelectFile(e),onSelectSymbol:(e,t)=>C.current.onSelectSymbol(e,t),onSelectHierSymbol:e=>C.current.onSelectHierSymbol(e),onClearSelection:()=>C.current.onClearSelection(),onSelectDirectory:e=>C.current.onSelectDirectory(e),onPreviewDirectory:e=>C.current.onPreviewDirectory(e),onNeedSymbols:e=>C.current.onNeedSymbols(e),onDragStart:()=>C.current.onDragStart?.(),onPanDismiss:()=>C.current.onPanDismiss?.(),onTapStructure:(e,t)=>C.current.onTapStructure?.(e,t)??!1});return S.current=e,()=>{e.destroy(),S.current=null}},[]),(0,_.useImperativeHandle)(v,()=>({fit:(e=!0)=>S.current?.fit(e),panTo:(e,t=!0)=>S.current?.panTo(e,t),panToDistrict:(e,t=!0)=>S.current?.panToDistrict(e,t),frameDistricts:e=>S.current?.frameDistricts(e),highlightDistricts:e=>S.current?.highlightDistricts(e),zoomDistrict:e=>S.current?.zoomDistrict(e),zoomBy:e=>S.current?.zoomBy(e),hoverSymbol:e=>S.current?.hoverSymbol(e),setInsets:e=>S.current?.setInsets(e),setDirectFileTaps:e=>S.current?.setDirectFileTaps(e)}),[]);let w=(0,_.useRef)(!1),T=(0,_.useRef)(h);T.current=h;let E=e.repo;(0,_.useLayoutEffect)(()=>{let h=S.current;if(!h||!x.current)return;h.loadDocument(e);let g=x.current.getBoundingClientRect();h.resize(g.width,g.height),h.setInsets(T.current);let _={doc:e,geo:t,layer:n,sel:r,selSym:i,selD:a,route:o,packageGrouping:s,districtPaths:c,folderFiles:l,folderOnlyIslands:u,folderLabels:d,activeDirectory:f,districtSymbols:p,selHSym:m};h.fit(!1,_),r==null?a!=null&&h.panToDistrict(a,!1):h.panTo(r,!1),w.current=!0},[E]),(0,_.useLayoutEffect)(()=>{let h=S.current;if(!h)return;if(w.current){w.current=!1;return}let g={doc:e,geo:t,layer:n,sel:r,selSym:i,selD:a,route:o,packageGrouping:s,districtPaths:c,folderFiles:l,folderOnlyIslands:u,folderLabels:d,activeDirectory:f,districtSymbols:p,selHSym:m};h.render(g)},[e,t,n,r,i,a,o,s,c,l,u,d,f,p,m]);let D=JSON.stringify(h);(0,_.useLayoutEffect)(()=>{S.current?.setInsets(T.current)},[D]);let O=(0,_.useRef)(null);return(0,_.useEffect)(()=>{let e=x.current;if(!e)return;let t=new ResizeObserver(()=>{let t=e.getBoundingClientRect(),n=O.current;n&&n.w===t.width&&n.h===t.height||(O.current={w:t.width,h:t.height},S.current?.resize(t.width,t.height))});return t.observe(e),()=>t.disconnect()},[]),(0,b.jsx)(`div`,{ref:x,className:`absolute inset-0`,"data-fit-insets":`${h.frame.left},${h.frame.top},${h.frame.right},${h.frame.bottom}`,"data-safe-insets":`${h.safe.left},${h.safe.top},${h.safe.right},${h.safe.bottom}`,children:(0,b.jsx)(`svg`,{ref:y,className:`map-svg`,role:`img`,"aria-label":`Pannable, zoomable map of a source repository with computed districts, landmark pins and import routes`})})}var Lw={type:`none`},Rw={1:`d`,2:`c`,3:`x`,4:`p`};function zw(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 Lw;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 Rw)return{type:`layer`,layer:Rw[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.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 Lw}function Bw(e){return(0,_.useSyncExternalStore)(t=>Ja(e,t),()=>qa(e),()=>null)}function Vw(e){return e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(0)} KB`:`${(e/1048576).toFixed(1)} MB`}function Hw({progressKey:e,label:t}){let n=Bw(e);return n?n.phase===`parsing`?(0,b.jsxs)(`p`,{"data-load-progress":`parsing`,children:[`parsing `,t,`… (`,Vw(n.receivedBytes),`)`]}):(0,b.jsxs)(`p`,{"data-load-progress":`downloading`,children:[`loading `,t,`… `,Vw(n.receivedBytes),n.totalBytes==null?``:` / ${Vw(n.totalBytes)}`]}):(0,b.jsxs)(`p`,{"data-load-progress":`idle`,children:[`loading `,t,`…`]})}function Uw({pending:e,failed:t,narrow:n,mapLeft:r=`env(safe-area-inset-left, 0px)`}){let[i,a]=(0,_.useState)(!1);if(!e&&(t==null||i))return null;let o=n?``:`left-1/2 top-2.5 w-max max-w-[min(380px,max(200px,calc(100%-600px)))] -translate-x-1/2`,s=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:s,className:`pointer-events-auto absolute z-20 flex 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 ${o}`,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:()=>a(!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 Ww(e){return e?.status===`done`||e?.status===`failed`}var Gw=[500,1500,4e3];function Kw(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 lo(t);if(r)return;f(e),Ww(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(){lo(t).then(e=>{r||(f(e),!Ww(e)&&_())}).catch(e=>{r||(o(e instanceof Error?e.message:String(e)),m())})}function _(){if(typeof EventSource>`u`){m();return}l=new EventSource(go(t)),l.onopen=()=>{r||(u=0,i(`sse`))},l.onmessage=e=>{if(!r)try{let t=JSON.parse(e.data);f(t),Ww(t)&&l?.close()}catch{}},l.onerror=()=>{if(l?.close(),!(r||Ww(d))){if(u<Gw.length){let e=Gw[u];u+=1,i(`connecting`),s=setTimeout(g,e)}else m()}}}return g(),()=>{r=!0,l?.close(),p(),h()}},[e]),{job:t,connection:r,error:a,seen:s}}function qw(e){let{job:t,error:n}=Kw(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 Jw=4e3;function Yw(e,t){return e<t?-1:+(e>t)}function Xw(e,t){return e.names[String(t)]??`District ${t}`}function Zw(e,t,n){let r=e.N[t]?.[n];return typeof r==`number`&&Number.isFinite(r)&&r>=0?r:null}function Qw(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 $w(e,t){return Yw(e.name,t.name)||e.district-t.district}function eT(e,t,n){let r=[];for(let i=0;i<e.F.length;i++){let a=R(e,i);if(!n.has(a))continue;let o=Zw(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||Yw(e.name,t.name)||e.file-t.file).slice(0,10)}function tT(e,t){let n=GS(e),r=new Set(KS(e)),i=new Set(n.islands.map(Number)),a=new Map;for(let t=0;t<e.N.length;t++){let n=R(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=Zw(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:Xw(e,t),island:i.has(t),knownFiles:a,commits:r,commitsPerFile:r/a,bar:0})}}s.sort((e,t)=>t.commits-e.commits||$w(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=Zw(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:Xw(e,t),island:i.has(t),knownFiles:r.length,median:Qw(r)})}}p.sort((e,t)=>t.median-e.median||$w(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=>R(e,t)).filter(e=>r.has(e)))].sort((t,n)=>$w({district:t,name:Xw(e,t)},{district:n,name:Xw(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=R(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:Xw(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:Yw(e,t))})).sort((e,t)=>t.packages.length-e.packages.length||$w(e,t));return{district:o,churn:{windowCommits:Jw,knownFiles:c,fileCommitTouches:l,districts:s,smallDistrictCount:u,smallIslandCount:d,mostActiveDistrict:s[0]??null,files:eT(e,5,r)},complexity:{median:Qw(m),districts:p,smallDistrictCount:h,smallIslandCount:g,mostComplexDistrict:p[0]??null,files:eT(e,4,r)},package:{language:y,groups:x,mixedDistricts:C}}}function nT(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 rT(e){return{py:`Python`,ts:`TypeScript`,go:`Go`,rs:`Rust`,js:`JavaScript`}[e]??e}var iT=Object.defineProperty,aT=(e,t)=>iT(e,`name`,{value:t,configurable:!0});function oT(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}aT(oT,`setRef`);function sT(...e){return t=>{let n=!1,r=e.map(e=>{let r=oT(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():oT(e[t],null)}}}}aT(sT,`composeRefs`);function cT(...e){return _.useCallback(sT(...e),e)}aT(cT,`useComposedRefs`);var lT=Object.defineProperty,uT=(e,t)=>lT(e,`name`,{value:t,configurable:!0});function dT(e){let t=_.forwardRef((t,n)=>{let{children:r,...i}=t,a=null,o=!1,s=[];bT(r)&&typeof wT==`function`&&(r=wT(r._payload)),_.Children.forEach(r,e=>{if(vT(e)){o=!0;let t=e,n=`child`in t.props?t.props.child:t.props.children;bT(n)&&typeof wT==`function`&&(n=wT(n._payload)),a=hT(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?_T(a):void 0,l=cT(n,c);if(!a){if(r||r===0)throw Error(o?CT(e):ST(e));return r}let u=gT(i,a.props??{});return a.type!==_.Fragment&&(u.ref=n?l:c),_.cloneElement(a,u)});return t.displayName=`${e}.Slot`,t}uT(dT,`createSlot`);var fT=dT(`Slot`),pT=Symbol.for(`radix.slottable`);function mT(e){let t=uT(e=>`child`in e?e.children(e.child):e.children,`Slottable`);return t.displayName=`${e}.Slottable`,t.__radixId=pT,t}uT(mT,`createSlottable`);var hT=uT((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 gT(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}}uT(gT,`mergeProps`);function _T(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)}uT(_T,`getElementRef`);function vT(e){return _.isValidElement(e)&&typeof e.type==`function`&&`__radixId`in e.type&&e.type.__radixId===pT}uT(vT,`isSlottable`);var yT=Symbol.for(`react.lazy`);function bT(e){return typeof e==`object`&&!!e&&`$$typeof`in e&&e.$$typeof===yT&&`_payload`in e&&xT(e._payload)}uT(bT,`isLazyComponent`);function xT(e){return typeof e==`object`&&!!e&&`then`in e}uT(xT,`isPromiseLike`);var ST=uT(e=>`${e} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,`createSlotError`),CT=uT(e=>`${e} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,`createSlottableError`),wT=_.use,TT=e=>typeof e==`boolean`?`${e}`:e===0?`0`:e,ET=sc,DT=((e,t)=>n=>{if(t?.variants==null)return ET(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=TT(t)||TT(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 ET(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`}}),OT=_.forwardRef(({className:e,variant:t,size:n,asChild:r=!1,...i},a)=>(0,b.jsx)(r?fT:`button`,{className:ol(DT({variant:t,size:n,className:e})),ref:a,...i}));OT.displayName=`Button`;var kT=_.forwardRef(({className:e,...t},n)=>(0,b.jsx)(`input`,{ref:n,className:ol(`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}));kT.displayName=`Input`;function AT({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:[Gs(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 jT({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)(kT,{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)(OT,{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)(MT,{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)(NT,{directory:n,totalFiles:e.filesByDirectory.get(`.`)?.size??0,depth:0,activeDirectory:t,onPick:c},`${n.path}:${t??``}`))})]})}function MT({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:Gs(e.path)}),(0,b.jsx)(`span`,{className:`text-[var(--dim)]`,children:PT(e.count,t)}),(0,b.jsx)(`span`,{className:`text-[var(--dim)]`,children:e.count.toLocaleString(`en-US`)})]})}function NT({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:PT(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)(NT,{directory:e,totalFiles:t,depth:n+1,activeDirectory:r,onPick:i},`${e.path}:${r??``}`))]})}function PT(e,t){let n=t>0?e/t*100:0;return`${n<10?n.toFixed(1):Math.round(n)}%`}function FT({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=>R(e,n)===t).slice().sort((t,n)=>Zo(e,n)+qo(e,n)/60-(Zo(e,t)+qo(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)(Cl,{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:Gs(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)(Cl,{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:bs(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:[qo(e,n),` lines`]})]},n))]})]})}function IT({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 LT({doc:e,i:t,sy:n,cur:r,onSelectSymbol:i,compactRows:a=!1,touchTargets:o=!1}){if(!n.length)return null;let s=qo(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:uS[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:uS[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 RT({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 zT({decoded:e,global:t,onSelectHierSymbol:n}){let r=e.globalToLocal.get(t),i=(0,_.useMemo)(()=>r==null?null:ww(e,r),[e,r]);if(r==null||!i)return null;let a=e.raw.symbols[r],o=KC(a),s=XC(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)(RT,{label:`extends`,items:i.extends,dataKey:`extends`,onSelectHierSymbol:n}),(0,b.jsx)(RT,{label:`implements`,items:i.implements,dataKey:`implements`,onSelectHierSymbol:n}),(0,b.jsx)(RT,{label:`subclasses (${i.subclasses.length})`,items:i.subclasses,dataKey:`subclasses`,onSelectHierSymbol:n}),(0,b.jsx)(RT,{label:`implemented by (${i.implementedBy.length})`,items:i.implementedBy,dataKey:`implemented-by`,onSelectHierSymbol:n})]}),l&&(0,b.jsx)(RT,{label:`overridden by (${i.overriddenBy.length})`,items:i.overriddenBy,dataKey:`overridden-by`,onSelectHierSymbol:n})]})}function BT({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 ${lw(e.row[2])?`font-semibold`:``}`,children:[cw(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(`, `),`›`]}),XC(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:cw(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 VT({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`:Gs(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`:Gs(e.path)}),(0,b.jsx)(`span`,{className:`font-mono`,children:e.count})]},e.path??`other`))})]})}function HT(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-Zo(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 UT(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 WT(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 GT(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 KT(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 qT(e,t,n){return e===1?t:n}function JT(e){let t=e.lastIndexOf(`/`);return t<0?``:e.slice(0,t+1)}function YT(e){return e.slice(e.lastIndexOf(`/`)+1)}var XT={func:`function`,const:`constant`};function ZT(e){let t=lS[e]??`symbol`;return XT[t]??t}function QT(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} ${qT(i,`file`,`files`)}`,nameMarks:UT(r,n),detailMarks:[]}}function $T(e,t,n){let r=e.F[t],i=JT(r),a=YT(r),o=UT(r,n);return{key:`f${t}`,pick:{kind:`file`,i:t},name:a,detail:i||`(repo root)`,aside:``,nameMarks:WT(o,i.length,r.length),detailMarks:i?WT(o,0,i.length):[]}}function eE(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=>QT(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?[]:KT(e,r).map(t=>QT(e,t,r)),o=[],s=[];for(let t of HT(e,r)){if(t.s==null){o.push($T(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=JT(a),l=YT(a),u=YT(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:`${ZT(i[1])} · ${d}:${i[2]}`,aside:``,nameMarks:UT(i[0],r),detailMarks:[]})}return a.length&&i.push({kind:`district`,label:qT(a.length,`District`,`Districts`),items:a}),o.length&&i.push({kind:`file`,label:qT(o.length,`File`,`Files`),items:o}),s.length&&i.push({kind:`symbol`,label:qT(s.length,`Symbol`,`Symbols`),items:s}),{query:r,groups:i,flat:i.flatMap(e=>e.items)}}function tE(e,t,n,r=!1){let i=t.trim().toLowerCase(),a=eE(e,i,{filesOnly:r}).groups.map(e=>({...e}));if(!r){let e=n.flatMap(e=>{let t=UT(e.label,i),n=e.detail??``,r=UT(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 nE(e){return e===`ArrowDown`||e===`ArrowUp`||e===`Enter`||e===`Escape`}function rE(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 iE=`Search districts, files and symbols`,aE=`Districts, files, classes…`,oE=`Search districts, files, classes, or type a command`;function sE({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`?tE(e,u,o,c):eE(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 A(e){if(!nE(e.key))return;if(!E&&(e.key===`ArrowDown`||e.key===`ArrowUp`)){e.preventDefault(),h(!0);return}if(!E&&e.key===`Escape`)return;let t=rE(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 ee={ref:v,role:`combobox`,"aria-label":c?`Search files for path ${l}`:iE,"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:aE,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:A},j=(0,b.jsx)(dE,{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)(gl,{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`,{...ee,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`:oE}),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)(Tl,{})}),(0,b.jsx)(cE,{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)(cE,{children:`↑`}),(0,b.jsx)(cE,{children:`↓`}),` move`]}),(0,b.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,b.jsx)(cE,{children:`↵`}),` open`]}),(0,b.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,b.jsx)(cE,{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)(wl,{})}),(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`,{...ee,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)(Tl,{})})})]})]}),(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)(gl,{size:16}),(0,b.jsx)(`input`,{...ee,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 cE({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 lE({text:e,marks:t,accent:n=!1}){return(0,b.jsx)(b.Fragment,{children:GT(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 uE={district:El,file:Dl,symbol:Ol};function dE({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:uE[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)(lE,{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)(lE,{text:e.detail,marks:e.detailMarks,accent:l})})]}),a&&e.aside?(0,b.jsx)(cE,{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 fE=[{type:`overview`}];function pE(e,t){switch(t.type){case`overview`:return fE;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 mE(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 hE={py:`Python`,go:`Go`,ts:`TypeScript`,rs:`Rust`},gE={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 _E(e){return gE[e]??e.replace(/_/g,` `)}function vE(e,t){let n=t.path===`scip`;return{language:e,label:hE[e]??e,exact:n,reasonLabel:n?null:_E(t.reason),recallPercent:t.recall==null?null:Math.round(t.recall*100)}}function yE(e){if(e==null)return null;let t=e.references?Object.entries(e.references).sort(([e],[t])=>e.localeCompare(t)).map(([e,t])=>vE(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 bE({overview:e,layer:t,className:n}){let r=nT(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)(xE,{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 xE({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 SE(e){return e.toLocaleString(`en-US`,{maximumFractionDigits:2})}function CE(e,t){return`${[...e>0?[`${e} small ${e===1?`district`:`districts`}`]:[],...t>0?[`${t} small ${t===1?`island`:`islands`}`]:[]].join(` + `)} not ranked`}function wE(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 TE=hs.map(e=>[1,3,5].map(t=>parseInt(e.slice(t,t+2),16)));function EE(e){let t=Math.max(0,Math.min(1,Number.isFinite(e)?e:0)),n=t<.5?TE[0]:TE[1],r=t<.5?TE[1]:TE[2],i=t<.5?t*2:(t-.5)*2;return`rgb(${n.map((e,t)=>Math.round(e+(r[t]-e)*i)).join(`,`)})`}function DE(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 OE=`linear-gradient(90deg, var(--chrome-ramp-low), var(--chrome-ramp-mid), var(--chrome-ramp-high))`;function kE({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:OE,backgroundSize:`${100/n}% 100%`}})})}function AE({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)(kE,{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 jE({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 ME({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 NE(e){let t=e.lastIndexOf(`/`);return t<0?{name:e,dir:`(repo root)`}:{name:e.slice(t+1),dir:e.slice(0,t)}}function PE({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 EE(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)`:EE(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)(jE,{first:!0,sheet:i,title:`Districts by commits`,children:[t.churn.districts.map(e=>(0,b.jsx)(AE,{sheet:i,touch:r,districtRow:e.district,swatch:p(e.district,5),name:e.name,meta:`${e.island?`Island · `:``}${SE(e.commitsPerFile)} per file · ${e.knownFiles.toLocaleString(`en-US`)} files`,value:SE(e.commits),valueTitle:`${SE(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)(ME,{sheet:i,children:CE(t.churn.smallDistrictCount,t.churn.smallIslandCount)}),t.churn.districts.length===0&&t.churn.smallDistrictCount===0&&t.churn.smallIslandCount===0&&(0,b.jsx)(ME,{sheet:i,children:`Churn values are not present in this map.`})]}),(0,b.jsxs)(jE,{sheet:i,title:`Most changed files`,children:[t.churn.files.map(t=>{let{name:n,dir:a}=NE(e.F[t.file]);return(0,b.jsx)(AE,{sheet:i,touch:r,fileRow:t.file,swatch:f(t.file,5),name:n,nameMono:!0,meta:a,metaMono:!0,value:SE(t.value),valueTitle:`${SE(t.value)} commits`,onHighlight:u([t.district]),onSelect:()=>{l(null),o(t.file)}},t.file)}),t.churn.files.length===0&&(0,b.jsx)(ME,{sheet:i,children:`Churn values are not present in this map.`})]})]}),n===`x`&&(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)(jE,{first:!0,sheet:i,title:`Districts by median complexity`,children:[t.complexity.districts.map(e=>(0,b.jsx)(AE,{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:SE(e.median),valueTitle:`Median complexity ${SE(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)(ME,{sheet:i,children:CE(t.complexity.smallDistrictCount,t.complexity.smallIslandCount)}),t.complexity.districts.length===0&&t.complexity.smallDistrictCount===0&&t.complexity.smallIslandCount===0&&(0,b.jsx)(ME,{sheet:i,children:`Complexity values are not present in this map.`})]}),(0,b.jsxs)(jE,{sheet:i,title:`Most complex files`,children:[t.complexity.files.map(t=>{let{name:n,dir:a}=NE(e.F[t.file]);return(0,b.jsx)(AE,{sheet:i,touch:r,fileRow:t.file,swatch:f(t.file,4),name:n,nameMono:!0,meta:a,metaMono:!0,value:SE(t.value),valueTitle:`Complexity ${SE(t.value)}`,onHighlight:u([t.district]),onSelect:()=>{l(null),o(t.file)}},t.file)}),t.complexity.files.length===0&&(0,b.jsx)(ME,{sheet:i,children:`Complexity values are not present in this map.`})]})]}),n===`p`&&(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)(jE,{first:!0,sheet:i,title:`Packages`,children:[t.package.groups.map(e=>(0,b.jsx)(AE,{sheet:i,touch:r,packageRow:e.path??`other`,packageDistricts:e.districtIds.join(`,`),swatch:e.color,name:e.other?`Other packages`:Gs(e.path??`.`),nameMono:!e.other,meta:`${e.language?`${rT(e.language)} · `:``}${wE(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)(ME,{sheet:i,children:`Package paths are not present in this map.`})]}),(0,b.jsxs)(jE,{sheet:i,title:`Districts and islands that mix packages`,children:[t.package.mixedDistricts.map(e=>(0,b.jsx)(AE,{sheet:i,touch:r,districtRow:e.district,swatch:DE(e.packages.map(e=>m.get(e)??`var(--dim)`)),name:e.name,meta:`${e.island?`Island · `:``}${e.packages.map(e=>e==null?`Other packages`:Gs(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)(ME,{sheet:i,children:`No district mixes packages.`})]})]})]})}function FE(e,t){return(0,_.useMemo)(()=>tT(e,t),[e,t])}function IE({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?rw(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=[...ow(u,e)].reverse().map(e=>({global:u.raw.symbol_indices[e],name:GC(u.raw.symbols[e])}));return t.push({global:i,name:GC(u.raw.symbols[e])}),t},[u,i]);if(t==null&&r==null)return null;let f=r??R(e,t),p=t==null?[]:ts(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 LE({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 RE({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)(LE,{doc:n,d:e,onSelectDistrict:r},e))})]})}function zE({doc:e,packageLayout:t,onPickKeyFile:n,onSelectDistrict:r}){let i=(0,_.useMemo)(()=>$S(e,t),[e,t]);return(0,b.jsxs)(`div`,{"data-district-index":!0,children:[i.mainland.map(e=>(0,b.jsx)(BE,{row:e,onPickKeyFile:n,onSelectDistrict:r},e.d)),(0,b.jsx)(RE,{label:`islands`,ids:i.islandIds,doc:e,onSelectDistrict:r})]})}function BE({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 VE({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 HE({children:e}){return(0,b.jsx)(`div`,{className:`text-meta text-[var(--dim)]`,children:e})}function UE({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 WE({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)(Sl,{})})}function GE({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 KE({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 qE(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 JE({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}=qE(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 YE({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)(XE,{})]})}function XE(){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 ZE({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=FE(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)(UE,{truncate:!1,children:(0,b.jsx)(xE,{text:nT(p,`d`).primary})})}):(0,b.jsx)(bE,{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:Gs(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)(Sl,{})})]}):(0,b.jsx)(YE,{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)(zE,{doc:e,packageLayout:r,onPickKeyFile:d,onSelectDistrict:l}):(0,b.jsx)(`div`,{className:`px-5`,children:(0,b.jsx)(jT,{layout:r,activeDirectory:a,onSelectDirectory:f,nested:!1})})}):(0,b.jsx)(`div`,{className:`-mx-5`,children:(0,b.jsx)(PE,{doc:e,overview:p,layer:n,touch:!0,sheet:!0,onSelectDistrict:l,onSelectFile:d,onFrameDistricts:u})})]})}function QE({doc:e,packageLayout:t,onClose:n,onSelectFile:r,desktopPanel:i=!1,compactRows:a=!1,touchTargets:o=!1}){let s=yE(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)(HE,{children:`Map quality`}),(0,b.jsx)(UE,{children:l})]}),!i&&(0,b.jsx)(WE,{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)(KE,{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:[$E(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)(VE,{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)(KE,{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)(AT,{layout:t,doc:e,onSelectFile:r,nested:!1,compactRows:a,touchTargets:o})]})}function $E(e){return{py:`Python`,go:`Go`,ts:`TypeScript`,js:`JavaScript`,rs:`Rust`}[e]??e}function eD({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)(HE,{children:`District`}),(0,b.jsx)(UE,{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:tC(E)}),` files`,T&&T.share>=40&&(0,b.jsxs)(b.Fragment,{children:[` `,`· mostly `,(0,b.jsx)(`span`,{className:`font-mono text-meta`,children:Gs(T.path)})]})]})]}),!p&&(0,b.jsx)(WE,{label:`Clear selection`,onClick:r})]}),(0,b.jsxs)(`div`,{className:`mt-3 flex gap-2`,children:[(0,b.jsxs)(GE,{"aria-label":`Zoom to district`,onClick:()=>i(t),children:[(0,b.jsx)(bl,{size:18}),`Zoom to district`]}),a&&(0,b.jsx)(GE,{primary:!0,onClick:a,"data-sheet-details":``,children:`Details`})]})]}),(0,b.jsx)(`div`,{className:`mt-4 text-small`,children:(0,b.jsx)(FT,{doc:e,d:t,paths:w,onSelectFile:o,onSelectDistrict:s,onSelectDirectory:c,foldersExpanded:y,filesExpanded:x,onToggleFolders:S,onToggleFiles:C})})]})}function tD({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 nD({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)(tD,{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 rD=3;function iD({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=ts(e,t),D=n==null?null:E[n],O=(0,_.useMemo)(()=>i?rw(i):null,[i]),k=(0,_.useMemo)(()=>O?Sw(O,t):[],[O,t]),A=(0,_.useMemo)(()=>O?Tw(O,e,t):[],[O,e,t]),ee=O?Cw(k):E.length,j=o.get(t)??[],te=s.get(t)??[],M=e.L.find(e=>e[0]===t),N=DS(e,t,n),ne=L(e.districts[String(R(e,t))])===`unconnected`,P=HS(e,t),re=P?.label.match(/^(.*) (#\d+)$/),F=re?re[1]:P?.label??``,ie=re?.[2],ae=O&&r!=null?(()=>{let e=O.globalToLocal.get(r);return e==null?null:O.raw.symbols[e]})():null,oe=ae?{kind:bw[KC(ae)]??`symbol`,name:GC(ae),lines:`${qC(ae)}–${JC(ae)}`}:D?{kind:lS[D[1]]??`symbol`,name:D[0],lines:`${D[2]}–${D[3]}`}:null,se=(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||JC(t.r.row)-qC(t.r.row)-(JC(e.r.row)-qC(e.r.row))||e.order-t.order).slice(0,rD).map(e=>e.r)},[k]),ce=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,rD);return(0,b.jsxs)(`div`,{"data-sheet-card":oe?`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)(IE,{doc:e,sel:t,selSym:n,selD:null,selHSym:r,symbolsDoc:i,onSelectRepo:g,onSelectDistrict:h,onSelectFile:v,onSelectHierSymbol:p}),oe?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(UE,{mono:!0,children:oe.name}),(0,b.jsxs)(`p`,{className:`mt-1 truncate text-meta text-[var(--dim)]`,children:[(e=>e.charAt(0).toUpperCase()+e.slice(1))(oe.kind),` ·`,` `,(0,b.jsxs)(`span`,{className:`font-mono`,children:[e.F[t].split(`/`).pop(),`:`,oe.lines]})]})]}):(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(UE,{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)(WE,{label:`Clear selection`,onClick:l})]}),(0,b.jsx)(nD,{outDeg:j.length,inDeg:te.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)(KE,{title:w===`out`?`Imports ${j.length}`:`Imported by ${te.length}`}),(0,b.jsx)(JE,{doc:e,files:(w===`out`?j:te).slice(0,50),onSelectFile:d,dataKey:w}),(w===`out`?j:te).length>50&&(0,b.jsxs)(`p`,{className:`mt-1 text-meta text-[var(--dim)]`,children:[`+`,(w===`out`?j:te).length-50,` more`]})]}),O&&r!=null&&(0,b.jsx)(`div`,{className:`text-small`,children:(0,b.jsx)(zT,{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:[M&&(0,b.jsx)(`span`,{className:`rounded-[6px] px-2 py-0.5 text-meta font-semibold capitalize`,style:{color:eC[M[1]],background:`color-mix(in srgb, ${eC[M[1]]??`var(--dim)`} 16%, transparent)`},children:M[1]}),(0,b.jsxs)(`span`,{children:[(0,b.jsx)(`span`,{className:`font-mono text-[var(--on)]`,children:qo(e,t)}),` lines`]}),(0,b.jsxs)(`span`,{children:[(0,b.jsx)(`span`,{className:`font-mono text-[var(--on)]`,children:ee}),` symbols`]}),(0,b.jsxs)(`span`,{children:[(0,b.jsx)(`span`,{className:`font-mono text-[var(--on)]`,children:Xo(e,t)}),` commits`]})]}),P&&(0,b.jsxs)(`div`,{children:[(0,b.jsx)(KE,{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:[ie&&(0,b.jsxs)(b.Fragment,{children:[ie,` · `]}),Jo(e,t).toLocaleString(`en-US`),` code lines`]})]}),(0,b.jsx)(IT,{blast:N,doc:e}),O?c===`full`?(0,b.jsx)(BT,{outline:k,external:A,selHSym:r,onSelectHierSymbol:p,onHoverHierSymbol:m,nested:!1,compactRows:S}):se.length>0&&(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(KE,{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 `,ee]})}),se.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:GC(e.row)}),(0,b.jsxs)(`span`,{className:`font-mono text-meta text-[var(--dim)]`,children:[qC(e.row),`–`,JC(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)(LT,{doc:e,i:t,sy:E,cur:n,onSelectSymbol:f,compactRows:S,touchTargets:C}):ce.length>0&&(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(KE,{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]})}),ce.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)(GE,{"data-path-start":`from`,onClick:()=>y(t,`from`),children:`Path from here`}),(0,b.jsx)(GE,{"data-path-start":`to`,onClick:()=>y(t,`to`),children:`Path to here`})]})]})}function aD({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)(HE,{children:`Path`}),(0,b.jsxs)(UE,{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)(GE,{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)(HE,{children:n?`Path · ${d} hop${d===1?``:`s`}`:`Path`}),(0,b.jsxs)(UE,{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?nC[n.kind]:`No path between these files: nothing links them.`})]}),(0,b.jsx)(WE,{label:`Close path`,onClick:i})]}),n&&(0,b.jsx)(`div`,{className:`mt-3 flex gap-2`,children:(0,b.jsx)(GE,{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 oD({doc:e,card:t,onClose:n,onSelectFile:r,onSelectDistrict:i}){let{detail:a,lines:o}=t,s=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)(HE,{children:s}),(0,b.jsx)(UE,{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[1]})]}),(0,b.jsx)(WE,{label:`Close`,onClick:n})]}),a.kind===`neighborhood`?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(KE,{title:`${a.files.length} files`}),(0,b.jsx)(JE,{doc:e,files:a.files.slice(0,80),onSelectFile:r})]}):(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(KE,{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 sD(e){return e.pathPick?(0,b.jsx)(aD,{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)(oD,{doc:e.doc,card:e.structure,onClose:e.onCloseStructure,onSelectFile:e.onSelectFile,onSelectDistrict:e.onSelectDistrict}):e.quality?(0,b.jsx)(QE,{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)(eD,{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)(iD,{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 cD={system:`System`,light:`Light`,dark:`Dark`},lD=[{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`})]})}],uD=`mt-1 text-balance text-[20px] font-semibold leading-[1.25] tracking-[-.015em] tabular-nums`;function dD(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 fD({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 pD(){return(0,b.jsx)(`span`,{"aria-hidden":`true`,className:`h-[18px] w-[18px] shrink-0 rounded-[6px] bg-[conic-gradient(from_200deg,var(--link-in),var(--accent),var(--link-out),var(--link-in))]`})}function mD(){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 hD(e){let t=Qi(),[n,r]=(0,_.useState)(!1),i=(0,_.useRef)(null),a=(0,_.useRef)(null),o=(0,_.useMemo)(()=>dD(e.catalogue,e.doc,e.owner,e.repo),[e.catalogue,e.doc,e.owner,e.repo]),[s,c]=ic(),l=(0,_.useMemo)(()=>[...lD.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:`${cD[s]} now, ${cD[qs(s)].toLowerCase()} next`,shortcut:`T`},{id:`panel`,label:`${e.panelOpen?`Hide`:`Show`} the panel`,shortcut:`[`},...o.map(e=>({id:`repo:${e.slug}`,label:`Switch to ${e.slug}`,detail:e.current?`Current repository`:`Repository`}))],[o,e.panelOpen,s]),u=(0,_.useRef)(null),d=(0,_.useRef)(null),f=(0,_.useRef)(null),p=(0,_.useRef)(!0),m=(0,_.useRef)(null),h=(0,_.useRef)(!1),g=(0,_.useRef)(!1),v=(0,_.useRef)(!0);(0,_.useEffect)(()=>{if(h.current&&!e.searchOpen){let e=f.current;f.current=null,p.current&&(e?.isConnected?e.focus({preventScroll:!0}):u.current?.focus({preventScroll:!0})),p.current=!0}h.current=e.searchOpen},[e.searchOpen]),(0,_.useEffect)(()=>{g.current&&!e.keyboardOpen&&v.current&&m.current?.focus({preventScroll:!0}),g.current&&!e.keyboardOpen&&(v.current=!0),g.current=e.keyboardOpen},[e.keyboardOpen]),(0,_.useEffect)(()=>{if(!n)return;(a.current?.querySelector(`[role=menuitem]`))?.focus();let e=e=>{let t=e.target;!a.current?.contains(t)&&!i.current?.contains(t)&&r(!1)};return document.addEventListener(`pointerdown`,e,!0),()=>document.removeEventListener(`pointerdown`,e,!0)},[n]),(0,_.useEffect)(()=>{if(!n)return;let e=e=>{e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),r(!1),i.current?.focus({preventScroll:!0}))};return window.addEventListener(`keydown`,e,!0),()=>window.removeEventListener(`keydown`,e,!0)},[n]),(0,_.useEffect)(()=>{if(!e.searchOpen)return;let t=t=>{let n=t.target;d.current?.contains(n)||u.current?.contains(n)||(p.current=!1,f.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 i=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(zw({key:t.key,focus:i,metaKey:t.metaKey,ctrlKey:t.ctrlKey,altKey:t.altKey,shiftKey:t.shiftKey}).type===`search`){if(t.preventDefault(),e.searchOpen){p.current=!0,e.onCloseSearch();return}f.current=n&&n!==document.body?n:u.current,p.current=!0,r(!1),e.keyboardOpen&&(v.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 y(){if(e.searchOpen){f.current=u.current,p.current=!0,e.onCloseSearch();return}f.current=u.current,p.current=!0,r(!1),e.onOpenSearch()}function x(t=!0){p.current=t,e.onCloseSearch()}function S(t){if(t.startsWith(`layer:`)){e.onLayer(t.slice(6));return}if(t.startsWith(`repo:`)){let e=o.find(e=>e.slug===t.slice(5));e&&w(e);return}t===`fit`?e.onFit():t===`quality`?e.onOpenQuality():t===`theme`?c(qs(s)):t===`panel`&&e.onPanelOpen(!e.panelOpen)}function C(e){if(e.key===`Escape`){e.preventDefault(),e.stopPropagation(),r(!1),i.current?.focus({preventScroll:!0});return}if(e.key!==`ArrowDown`&&e.key!==`ArrowUp`)return;e.preventDefault();let t=Array.from(a.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 w(e){if(r(!1),e.current){i.current?.focus({preventScroll:!0});return}let[n,a]=e.slug.split(`/`);t({to:`/$owner/$repo`,params:{owner:n,repo:a},search:{geo:`r`,layer:`d`}})}let T=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:rT(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.jsxs)(ha,{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)(pD,{}),`tolmap`]}),(0,b.jsx)(`span`,{"aria-hidden":`true`,className:`mx-1 h-5 w-px bg-[var(--rule)]`}),(0,b.jsxs)(`button`,{ref:i,type:`button`,"data-repo-switcher":!0,"aria-haspopup":`menu`,"aria-expanded":n,"aria-label":`Repository ${e.owner}/${e.repo}`,onClick:()=>r(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:o.find(e=>e.current)?.label??`${e.owner}/${e.repo}`}),(0,b.jsx)(jl,{})]}),n&&(0,b.jsxs)(`div`,{ref:a,role:`menu`,"aria-label":`Mapped repositories`,"data-repository-menu":!0,onKeyDown:C,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`}),o.map(e=>(0,b.jsxs)(`button`,{type:`button`,role:`menuitem`,"aria-current":e.current?`true`:void 0,"data-repository-row":e.slug,onClick:()=>w(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}),T(e)&&(0,b.jsx)(`span`,{className:`truncate text-meta text-[var(--dim)]`,children:T(e)})]}),e.current&&(0,b.jsx)(fD,{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:[(0,b.jsxs)(ha,{to:`/`,hash:`repo-field`,replace:!0,"data-repo-map-another":!0,role:`menuitem`,onClick:()=>r(!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)(vl,{size:16}),(0,b.jsx)(`span`,{children:`Map another repository`})]}),(0,b.jsxs)(ha,{to:`/`,"data-repo-home":!0,role:`menuitem`,onClick:()=>r(!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)(fD,{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:lD.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:u,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:y,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)(gl,{size:18})}),(0,b.jsx)(pl,{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:m,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)(fD,{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`})]})})]})]}),n&&(0,b.jsx)(`button`,{type:`button`,"aria-label":`Close repository menu`,tabIndex:-1,onClick:()=>r(!1),className:`absolute inset-0 z-[35] cursor-default bg-transparent`}),e.searchOpen&&(0,b.jsx)(`div`,{ref:d,"data-desktop-search-shell":!0,className:`absolute inset-0 z-[70]`,children:(0,b.jsx)(sE,{doc:e.doc,onPick:e.onSearchPick,onCommand:S,commands:l,pathMode:e.pathMode,pathEnd:e.pathEnd,variant:`palette`,autoFocus:!0,onClose:()=>x(),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)(gD,{touch:e.touch,onClose:()=>e.onKeyboardOpen(!1)})]}),(0,b.jsx)(bD,{onZoomIn:e.onZoomIn,onZoomOut:e.onZoomOut,onFit:e.onFit,isFullscreen:e.isFullscreen,onToggleFullscreen:e.onToggleFullscreen,size:PC(e.touch?`tablet`:`desktop`)})]})}function gD({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)(fD,{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)(_D,{label:`Search and commands`,keys:r?[`⌘K`,`/`]:[`Ctrl K`,`/`]}),(0,b.jsx)(_D,{label:`Close, or step back a card`,keys:[`esc`]}),(0,b.jsx)(_D,{label:`Move in the index`,keys:[`↑`,`↓`]}),(0,b.jsx)(_D,{label:`Open the highlighted row`,keys:[`↵`]}),(0,b.jsx)(_D,{label:`Hide or show the panel`,keys:[`[`]}),(0,b.jsx)(_D,{label:`Fit the map`,keys:[`F`]}),(0,b.jsx)(_D,{label:`Zoom`,keys:[`+`,`−`]}),(0,b.jsx)(_D,{label:`Zoom to the selection`,keys:[`Z`]}),(0,b.jsx)(_D,{label:`Cycle the theme`,keys:[`T`]}),(0,b.jsx)(_D,{label:`This list`,keys:[`?`]}),(0,b.jsx)(`div`,{className:`col-span-2`,children:(0,b.jsx)(_D,{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 _D({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 vD(e){let t=(0,_.useRef)(null),[n,r]=(0,_.useState)(!1),[i,a]=(0,_.useState)(!1),o=mE(e.views,e.doc,e.repoSlug),s=e.views[e.views.length-1]??{type:`overview`},c=FE(e.doc,e.packageGrouping),l=(0,_.useRef)(e.onHighlightDistricts);l.current=e.onHighlightDistricts;let u=(0,_.useMemo)(()=>KS(e.doc).sort((t,n)=>e.doc.districts[String(n)].size-e.doc.districts[String(t)].size||t-n).map(t=>QS(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 bs(e.doc,t);if(e.layer===`c`||e.layer===`x`){let t=n.map(t=>e.layer===`c`?Xo(e.doc,t):Yo(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 gs(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)(wl,{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)(Cl,{})}),(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)(_l,{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)(Al,{size:17})})]}),(0,b.jsx)(`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`?(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:uD,children:(0,b.jsx)(xE,{text:nT(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)(mD,{})]})]}),(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)(jT,{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)(bE,{overview:c,layer:e.layer,className:uD}),(0,b.jsx)(`div`,{className:`mt-4`,children:(0,b.jsx)(PE,{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)(sD,{...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)(Al,{size:17}),(0,b.jsx)(`span`,{className:`truncate`,children:e.panelTabLabel})]}),(0,b.jsx)(yD,{layer:e.layer,packageLayout:e.packageLayout,packageGrouping:e.packageGrouping,panelOpen:e.panelOpen,onDepth:e.onDepth,packageAuto:e.packageAuto})]})}function yD({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)(VT,{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 bD({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)(vl,{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)(yl,{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)(bl,{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)(kl,{size:18})})]})}function xD(e){return window.addEventListener(`resize`,e),window.addEventListener(`orientationchange`,e),()=>{window.removeEventListener(`resize`,e),window.removeEventListener(`orientationchange`,e)}}function SD(){return OC(window.innerWidth,window.innerHeight)}function CD(){return(0,_.useSyncExternalStore)(xD,SD,()=>`desktop`)}function wD(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 TD(){let e=window.visualViewport;return{width:e?.width??window.innerWidth,height:e?.height??window.innerHeight,safeTop:wD(`top`),safeBottom:wD(`bottom`),safeLeft:wD(`left`),safeRight:wD(`right`)}}function ED(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 DD(){let[e,t]=(0,_.useState)(TD);return(0,_.useEffect)(()=>{let e=()=>{let e=TD();t(t=>ED(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 OD=`tolmapOverlay`;function kD(e){return e===`reader`||e===`repos`||e===`search`||e===`layers`||e===`sheet`||e===`sel`}function AD(e,t,n,r=!1){return kD(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 jD(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 MD(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 ND(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&&kD(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 PD(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=R(e,n),o=R(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&&R(e,i)===a||R(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 FD(){let e=typeof window>`u`?void 0:window.visualViewport;return e?{top:e.offsetTop,height:e.height}:null}function ID(e){let[t,n]=(0,_.useState)(FD);return(0,_.useEffect)(()=>{if(!e)return;let t=window.visualViewport;if(!t)return;let r=()=>{let e=FD();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}function LD(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 RD({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=t.full,f=i??t[e];(0,_.useEffect)(()=>{e!==`full`&&c.current&&(c.current.scrollTop=0)},[e]);function p(e,t){return e.owner?e.owner:Math.abs(t)<3?null:(e.owner=EC({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&&p(t,e.touches[0].clientY-t.y0)===`sheet`&&e.cancelable&&e.preventDefault()};return e.addEventListener(`touchmove`,t,{passive:!1}),()=>e.removeEventListener(`touchmove`,t)},[]);function m(e){if(!e.isPrimary)return;let t=e.target,n=t.closest(`[data-sheet-grabber], [data-sheet-dragzone]`)?`handle`:`content`,{scrollTop:r,canScroll:i}=LD(t,c.current);o.current={id:e.pointerId,y0:e.clientY,h0:f,zone:n,scrollTop:r,canScroll:i,owner:null,moved:!1,samples:[[e.timeStamp,e.clientY]]}}function h(e){let n=o.current;if(!n||e.pointerId!==n.id)return;let r=e.clientY-n.y0;if(p(n,r)===`sheet`){if(!n.moved){if(Math.abs(r)<8)return;n.moved=!0;try{l.current?.setPointerCapture(e.pointerId)}catch{}}a(wC(n.h0,r,t)),n.samples.push([e.timeStamp,e.clientY]),n.samples.length>6&&n.samples.shift()}}function g(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=wC(r.h0,e.clientY-r.y0,t);a(null),n(SC(i,TC(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(f),onPointerDown:m,onPointerMove:h,onPointerUp:g,onPointerCancel:g,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-transform duration-300 ease-[cubic-bezier(.2,.8,.2,1)] motion-reduce:transition-none`:``}`,style:{height:d,transform:`translateY(${d-f}px)`,touchAction:e===`full`?`auto`:`none`},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(CC(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 px-5 pt-7 ${e===`full`?`overflow-y-auto`:`overflow-hidden`}`,style:{paddingBottom:`calc(20px + env(safe-area-inset-bottom, 0px))`,touchAction:e===`full`?`pan-y`:`none`,overscrollBehavior:`contain`},children:r})]})}function zD({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 BD=178,VD=[{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 HD(e){let t=`${e.owner}/${e.repo}`,n=ID(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)(sD,{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)(ZE,{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?i:a,s=e.landscape&&e.sideOpen?`360px + env(safe-area-inset-left, 0px)`:`env(safe-area-inset-left, 0px)`,c=`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(${s} + 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)(gl,{})}),(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)(jl,{size:16})})]})]}),(e.landscape||e.viewportHeight-e.heights[e.detent]>=e.safeTop+68+BD+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:c,onClick:e.onZoomIn,"aria-label":`Zoom in`,children:(0,b.jsx)(vl,{})}),(0,b.jsx)(`button`,{type:`button`,className:c,onClick:e.onZoomOut,"aria-label":`Zoom out`,children:(0,b.jsx)(yl,{})}),(0,b.jsx)(`button`,{type:`button`,className:c,onClick:e.onFit,"aria-label":`Fit map`,children:(0,b.jsx)(bl,{})}),(0,b.jsx)(`button`,{type:`button`,className:c,onClick:e.onOpenLayers,"aria-label":`Map layers`,"aria-expanded":e.layersOpen,children:(0,b.jsx)(xl,{})}),e.landscape&&(0,b.jsx)(`button`,{type:`button`,className:c,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)(Al,{})})]}),e.landscape?(0,b.jsx)(zD,{open:e.sideOpen,detent:e.detent,children:o}):(0,b.jsx)(RD,{detent:e.detent,heights:e.heights,onDetent:e.onDetent,children:o}),e.layersOpen&&(0,b.jsxs)(UD,{kind:`layers`,label:`Map layers and display`,title:`Map layer`,closeLabel:`Close layers`,landscape:e.landscape,onClose:e.onCloseLayers,children:[(0,b.jsx)(`div`,{role:`radiogroup`,"aria-label":`Map layer`,className:`mt-1.5 overflow-hidden rounded-[14px] border border-[var(--rule)]`,children:VD.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,${hs.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)(VT,{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)(ml,{})]}),e.reposOpen&&(0,b.jsx)(UD,{kind:`repo`,label:`Repositories`,title:`Repository`,closeLabel:`Close repositories`,landscape:e.landscape,onClose:e.onCloseRepos,children:(0,b.jsx)(WD,{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)(sE,{doc:e.doc,variant:`overlay`,onPick:e.onSearchPick,onClose:e.onCloseSearch})})]})}function UD({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)(Sl,{})})]}),o]})]})}function WD({doc:e,slug:t,catalogue:n,onLeave:r}){let i=0;for(let t of Object.values(e.districts))L(t)===`mainland`&&i++;let a=(n??[]).filter(e=>e.slug!==t),o=`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:i}),` districts`]})]}),(0,b.jsxs)(`div`,{className:`mt-3 overflow-hidden rounded-[14px] border border-[var(--rule)]`,children:[(0,b.jsxs)(ha,{to:`/`,replace:!0,onClick:r,"data-repo-home":!0,className:o,children:[(0,b.jsx)(`span`,{className:`shrink-0 text-[var(--dim)]`,children:(0,b.jsx)(_l,{})}),(0,b.jsx)(`span`,{className:`min-w-0 flex-1 text-row`,children:`Home`})]}),(0,b.jsxs)(ha,{to:`/`,hash:`repo-field`,replace:!0,onClick:r,"data-repo-map-another":!0,className:o,children:[(0,b.jsx)(`span`,{className:`shrink-0 text-[var(--accent)]`,children:(0,b.jsx)(vl,{})}),(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`}),a.length?(0,b.jsx)(`div`,{className:`mt-1.5 overflow-hidden rounded-[14px] border border-[var(--rule)]`,children:a.map(e=>(0,b.jsxs)(ha,{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:o,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)(Cl,{})})]},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 GD(){let{owner:e,repo:t}=Xi({strict:!1}),n=Zi({strict:!1}),r=Qi(),i=(0,_.useRef)(null),a=(0,_.useRef)(!!n.read);(0,_.useEffect)(()=>{a.current&&!n.read&&i.current?.focus({preventScroll:!0}),a.current=!!n.read},[n.read]);let{data:o}=To(),s=qw(n.job),{data:c,isLoading:l,isError:u,error:d,source:f}=Eo(e,t,{commit:n.commit??s.commit,wait:s.waiting}),[p,m]=(0,_.useState)(new Set),h=(0,_.useRef)(new Set),g=(0,_.useRef)(null),v=e=>{h.current.add(e),g.current??=setTimeout(()=>{g.current=null;let e=h.current;h.current=new Set,m(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)(()=>()=>{g.current!=null&&clearTimeout(g.current)},[]);let{map:y,loading:x}=Do(e,t,f,[...p],{commit:n.commit??s.commit,ready:!s.waiting&&!s.detailPending});(0,_.useEffect)(()=>{n.job&&s.settled&&st({job:void 0,commit:s.commit})},[n.job,s.settled]);let S=(0,_.useRef)(null),C=(0,_.useRef)(null),[w,T]=(0,_.useState)(null),[E,D]=(0,_.useState)(null),O=CD(),k=AC(O),A=O===`landscape`,ee=jC(O),[j,te]=(0,_.useState)(!0),[M,N]=(0,_.useState)(()=>typeof window>`u`||window.innerWidth>=900),[ne,P]=(0,_.useReducer)(pE,fE),[re,F]=(0,_.useState)(!1),[ie,ae]=(0,_.useState)(!1),oe=(0,_.useRef)(null),[se,ce]=ic(),le=vi(),ue=DD(),de={top:ue.safeTop,right:ue.safeRight??0,bottom:ue.safeBottom,left:ue.safeLeft??0},fe=(0,_.useRef)(ue.width);(0,_.useEffect)(()=>{let e=fe.current;(e<900&&ue.width>=900||e>=900&&ue.width<900)&&N(ue.width>=900),fe.current=ue.width},[ue.width]);let pe=bC(ue),[me,he]=(0,_.useState)(`peek`),[ge,_e]=(0,_.useState)(!1),[ve,ye]=(0,_.useState)(!1),[be,xe]=(0,_.useState)(!1),[Se,Ce]=(0,_.useState)(!1),[we,Te]=(0,_.useState)(`districts`),[Ee,De]=(0,_.useState)(null),[Oe,ke]=(0,_.useState)(null),[Ae,je]=(0,_.useState)(null),[Me,Ne]=(0,_.useState)(!1),Pe=xC(ue,pe.peek),Fe=()=>FC({profile:O,panelOpen:M,safe:de}),Ie=()=>k?A?{frame:NC(!0,de),safe:NC(!0,de),centreInSafe:!0}:{frame:Pe,safe:Pe,centreInSafe:!0}:{frame:Fe(),safe:Fe(),centreInSafe:!0};function Le(){S.current?.setInsets(Ie())}let Re=ac(),ze=(0,_.useMemo)(()=>c?Ws(c):null,[c,Re]);(0,_.useEffect)(()=>{function e(){Ne(!!document.fullscreenElement&&document.fullscreenElement===C.current)}return document.addEventListener(`fullscreenchange`,e),()=>document.removeEventListener(`fullscreenchange`,e)},[]);async function Be(){if(document.fullscreenElement)try{await document.exitFullscreen()}catch{}Ne(!1)}async function Ve(){let e=C.current;if(e?.requestFullscreen)try{await e.requestFullscreen();return}catch{}Ne(!0)}function He(){Me?Be():Ve()}let{adj:Ue,radj:We}=(0,_.useMemo)(()=>c?CS(c):{adj:new Map,radj:new Map},[c]),{maxCh:Ge,maxCx:Ke}=(0,_.useMemo)(()=>c?{maxCh:Math.max(1,...c.N.map(e=>e[5])),maxCx:Math.max(1,...c.N.map(e=>e[4]))}:{maxCh:1,maxCx:1},[c]),I=c&&n.file?(()=>{let e=c.F.indexOf(n.file);return e>=0?e:null})():null,qe=I!=null&&n.sym!=null?n.sym:null,Je=I!=null&&n.hsym!=null?n.hsym:null,Ye=(0,_.useRef)(!1);function Xe(e,t,n){let r=c&&n!=null?y.get(R(c,e)):void 0,i=r&&n!=null?r.symbols[r.symbol_indices.indexOf(n)]:void 0,a=t==null?void 0:c?.S[String(e)]?.[t],o=i?.[3]??a?.[2]??1;return{line:o,end:i?.[4]??a?.[3]??o}}function Ze(){if(I==null||!c)return;let{line:e,end:t}=Xe(I,qe,Je);k?(vt(`reader`),st({read:!0,line:e,end:t})):(Ye.current=!0,r({to:`.`,search:n=>({...n,read:!0,line:e,end:t}),state:!0}))}function Qe(){k?(yt(`reader`),st({read:void 0})):Ye.current?(Ye.current=!1,le.history.back()):st({read:void 0})}let $e=I==null&&n.d!=null?n.d:null,et=(0,_.useRef)(M);(0,_.useEffect)(()=>{let e=et.current;et.current=M,!k&&!e&&M&&c&&(I!=null&&L(c.districts[String(c.N[I][0])])!==`unconnected`?S.current?.panTo(I):$e!=null&&S.current?.panToDistrict($e))},[M,k,c,I,$e]);let tt=k?A?{frame:NC(!0,de),safe:NC(j,de),centreInSafe:!0}:{frame:Pe,safe:xC(ue,pe[me===`full`?`half`:me]),centreInSafe:!0}:{frame:Fe(),safe:Fe(),centreInSafe:!0},nt=c&&I!=null?R(c,I):null,rt=nt==null?void 0:y.get(nt),it=nt!=null&&!rt&&(!p.has(nt)||x.has(nt));(0,_.useEffect)(()=>{nt!=null&&m(e=>e.has(nt)?e:new Set(e).add(nt))},[nt]);let at=(0,_.useMemo)(()=>{let e=new Map;for(let t of y.values())t.symbol_indices.forEach((n,r)=>e.set(n,t.symbols[r][0]));return e},[y]);function ot(e){if(!c)return;let t=at.get(e);if(t!=null){if(!k){let n=R(c,t),r=y.get(n),i=r?.symbol_indices.indexOf(e)??-1,a=r&&i>=0?GC(r.symbols[i]):`Symbol`;P({type:`map-symbol`,district:n,file:t,label:a,hierarchicalSymbol:e})}st({file:c.F[t],sym:void 0,hsym:e,d:void 0,dir:void 0,...n.read?Xe(t,null,e):{line:void 0,end:void 0}}),Le(),L(c.districts[String(R(c,t))])!==`unconnected`&&S.current?.panTo(t)}}function st(e){r({to:`.`,search:t=>({...t,sel:void 0,...e}),replace:!0,state:!0})}function ct(e,t={}){if(c){if(!k){let n=R(c,e);if(t.symbol!=null){let r=c.S?.[String(e)]?.[t.symbol]?.[0]??`Symbol`;P({type:`map-symbol`,district:n,file:e,label:r,symbol:t.symbol})}else P({type:`map-file`,district:n,file:e})}st({file:c.F[e],sym:t.symbol,hsym:void 0,d:void 0,dir:void 0,...n.read?Xe(e,t.symbol):{line:void 0,end:void 0}}),Le(),L(c.districts[String(c.N[e][0])])!==`unconnected`&&S.current?.panTo(e)}}function lt(e){k||P({type:`map-district`,district:e}),st({file:void 0,sym:void 0,d:e,dir:void 0}),k||(Le(),S.current?.panToDistrict(e))}function ut(){k||P({type:`overview`}),Ce(!1),st({file:void 0,sym:void 0,hsym:void 0,d:void 0,dir:void 0})}function dt(e){if(Oe&&!Ae&&e.kind===`file`){Ht(e.i);return}e.kind===`district`?(lt(e.d),Le(),S.current?.panToDistrict(e.d)):ct(e.i,e.kind===`symbol`?{symbol:e.s}:{})}function ft(e){D(null),T(null),st({file:void 0,sym:void 0,d:void 0,dir:e})}let pt=(0,_.useRef)(null),mt=(0,_.useRef)(!1),ht=(0,_.useRef)(n);mt.current||(ht.current=n);let gt=(0,_.useRef)(le.history.location.pathname);gt.current=le.history.location.pathname;let _t=()=>Number(le.history.location.state.__TSR_index??0);function vt(e){if(!k)return;let{state:t,push:n}=jD(pt.current??AD(_t(),null,!1),e,_t());pt.current=t,n&&(le.history.push(le.history.location.href,{[OD]:e}),le.history.flush())}function yt(e){pt.current&&=MD(pt.current,e)}function bt(e){e!==me&&(e===`peek`?yt(`sheet`):vt(`sheet`),he(e))}function xt(){vt(`search`),_e(!0)}function St(){yt(`search`),_e(!1)}function Ct(){vt(`layers`),ye(!0)}function wt(){yt(`layers`),ye(!1)}function Tt(){vt(`repos`),xe(!0)}function Et(){yt(`repos`),xe(!1)}function Dt(){ke(null),je(null),T(null)}function Ot(e){e.type===`overview`?(Ce(!1),Dt(),ut()):e.type===`district`?(Ce(!1),Dt(),lt(e.district)):e.type===`file`?(Ce(!1),Dt(),ct(e.file)):e.type===`symbol`?(Ce(!1),Dt(),e.hierarchicalSymbol==null?ct(e.file,e.symbol==null?{}:{symbol:e.symbol}):ot(e.hierarchicalSymbol)):e.type===`quality`&&Ce(!0)}function kt(){if(ne.length<=1)return!1;let e=ne[ne.length-1],t=ne[ne.length-2];return P({type:`pop`}),e.type===`quality`&&Ce(!1),e.type===`path`&&Dt(),t&&Ot(t),!0}function At(e){let t=ne[e];t&&(P({type:`jump`,index:e}),Ot(t))}function jt(){Ce(!0),P({type:`push`,view:{type:`quality`}})}function Mt(){let e=C.current?.querySelector(`[data-desktop-panel]`);return!e||!M||ne.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 Nt(e){let t=Mt();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];oe.current=r,r.focus({preventScroll:!0}),r.scrollIntoView({block:`nearest`})}function Pt(){let e=Mt(),t=document.activeElement;(e.includes(t)?t:oe.current&&e.includes(oe.current)?oe.current:null)?.click()}let Ft=(0,_.useRef)(()=>{});Ft.current=e=>{e===`repos`?xe(!1):e===`search`?_e(!1):e===`layers`?ye(!1):e===`reader`?st({read:void 0}):e===`sheet`?he(`peek`):(De(null),Dt())};let It=I!=null||$e!=null||!!n.dir||!!Ee||!!Oe,Lt=It||!!n.file&&(!c||!!n.read),Rt=(0,_.useRef)(It);Rt.current=It,(0,_.useEffect)(()=>{if(!k)return;mt.current=!1;let e=le.history.location.state;pt.current=AD(_t(),e[OD],Rt.current||!!ht.current.file,!!ht.current.read)},[k,e,t]),(0,_.useEffect)(()=>{k&&!mt.current&&(Lt?vt(`sel`):yt(`sel`))},[Lt,k]),(0,_.useEffect)(()=>{k&&n.read&&!mt.current&&vt(`reader`)},[k,n.read,Lt]),(0,_.useEffect)(()=>{if(k)return le.history.subscribe(({location:e,action:t})=>{if(t.type!==`BACK`&&t.type!==`FORWARD`&&t.type!==`GO`)return;if(e.pathname!==gt.current){mt.current=!1;return}let n=e.state,i=Number(n.__TSR_index??0),a=ND(pt.current??AD(i,null,!1),i,n[OD],Rt.current);pt.current=a.state;for(let e of a.undo)Ft.current(e);let o=a.undo.includes(`reader`)?{...ht.current,read:void 0}:ht.current,s=a.undo.includes(`sel`)?{...o,file:void 0,sym:void 0,hsym:void 0,d:void 0,dir:void 0}:o;ht.current=s,mt.current=a.skipBack,a.skipBack?le.history.back():r({to:`.`,search:s,replace:!0,state:!0})})},[k]),(0,_.useEffect)(()=>{if(!k)return le.history.subscribe(({location:e,action:t})=>{if(t.type!==`BACK`&&t.type!==`GO`||e.pathname!==gt.current||!ht.current.read)return;Ye.current=!1;let n={...ht.current,read:void 0};ht.current=n,r({to:`.`,search:n,replace:!0,state:!0})})},[k]);let zt=`${I}|${qe}|${Je}|${$e}|${n.dir??``}`,Bt=(0,_.useRef)(null);(0,_.useEffect)(()=>{if(!c)return;if(k&&Bt.current==null){Bt.current=zt;return}let e=Bt.current!==zt;if(Bt.current=zt,!k){if(I!=null&&Je!=null){let e=R(c,I),t=y.get(e),n=t?.symbol_indices.indexOf(Je)??-1;P({type:`map-symbol`,district:e,file:I,label:t&&n>=0?GC(t.symbols[n]):`Symbol`,hierarchicalSymbol:Je})}else if(I!=null&&qe!=null){let e=R(c,I);P({type:`map-symbol`,district:e,file:I,label:c.S?.[String(I)]?.[qe]?.[0]??`Symbol`,symbol:qe})}else P(I==null?$e==null?{type:`overview`}:{type:`map-district`,district:$e}:{type:`map-file`,district:R(c,I),file:I});e&&(Ce(!1),ke(null),je(null),T(null));return}e&&(Ce(!1),De(null),bt(`peek`),(I!=null||$e!=null)&&te(!0))},[zt,c]),(0,_.useEffect)(()=>{k&&me===`peek`&&Ce(!1)},[me]);let Vt=(0,_.useRef)(me);(0,_.useEffect)(()=>{let e=Vt.current;Vt.current=me,k&&!A&&c&&me===`half`&&e===`peek`&&(I==null?$e!=null&&S.current?.panToDistrict($e):L(c.districts[String(R(c,I))])!==`unconnected`&&S.current?.panTo(I))},[me]),(0,_.useEffect)(()=>{S.current?.setDirectFileTaps(!!Oe&&!Ae)},[Oe,Ae]),(0,_.useEffect)(()=>{k||(_e(!1),ye(!1),xe(!1),he(`peek`),De(null),ke(null),je(null))},[k]);function Ht(e){if(!c||!Oe||e===Oe.anchor)return;let t=Oe.dir===`from`?[Oe.anchor,e]:[e,Oe.anchor];je(t),T(TS(c,Ue,t[0],t[1]))}function Ut(){if(!(k&&Oe&&!Ae)){if(Ee){De(null);return}if(I!=null||$e!=null||n.dir||Oe){Dt(),ut();return}k?bt(`peek`):(Ce(!1),P({type:`overview`}))}}(0,_.useEffect)(()=>{if(k)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=zw({key:e.key,focus:r,metaKey:e.metaKey,ctrlKey:e.ctrlKey,altKey:e.altKey,shiftKey:e.shiftKey,overviewOpen:M&&ne.at(-1)?.type===`overview`});i.type!==`none`&&i.type!==`search`&&(e.preventDefault(),i.type===`toggle-panel`?N(e=>!e):i.type===`layer`?st({layer:i.layer}):i.type===`zoom-in`?S.current?.zoomBy(1.6):i.type===`zoom-out`?S.current?.zoomBy(1/1.6):i.type===`fit`?S.current?.fit(!0):i.type===`zoom-selection`?$e==null?c&&I!=null&&S.current?.zoomDistrict(R(c,I)):S.current?.zoomDistrict($e):i.type===`cycle-theme`?ce(qs(se)):i.type===`keyboard-list`?ae(!0):i.type===`overview-move`?Nt(i.direction):i.type===`overview-activate`?Pt():i.type===`escape`&&(re?F(!1):ie?ae(!1):!kt()&&Me&&Be()))}return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[k,M,ne,re,ie,Me,$e,I,c,se,n.read]);let Wt={onSelectFile:e=>Oe&&!Ae?Ht(e):ct(e),onSelectSymbol:(e,t)=>ct(e,{symbol:t}),onSelectHierSymbol:e=>ot(e),onSelectDistrict:e=>{(!Oe||Ae)&<(e)},onClearSelection:()=>Ut(),onDragStart:()=>{k&&De(null)},onPanDismiss:()=>{k&&me!==`peek`&&bt(`peek`)},onTapStructure:(e,t)=>{if(!k||!c)return!1;let n=PD(c,e);return n?(De({key:e,lines:t,detail:n}),bt(`peek`),!0):!1},onSelectDirectory:e=>ft(e),onPreviewDirectory:e=>D(e&&c?{repo:c.repo,path:e}:null),onNeedSymbols:e=>v(e)};if(l)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)(Hw,{progressKey:`map:${e}/${t}`,label:`${e}/${t}`})});if(u||!c||!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:[(0,b.jsxs)(`p`,{children:[`couldn't load `,e,`/`,t,`.`]}),(0,b.jsx)(`p`,{className:`text-[var(--dim)]`,children:d instanceof Error?d.message:`not in the catalogue`})]});let Gt=Math.max(ze.minDepth,Math.min(ze.maxDepth,n.depth??ze.autoDepth)),Kt=ze.groupings.get(Gt),qt=n.dir&&ze.filesByDirectory.has(n.dir)?n.dir:void 0,Jt=(E?.repo===c.repo?E.path:void 0)??qt,Yt=Jt?ze.filesByDirectory.get(Jt)??null:null,Xt=Jt?ze.islandOnlyDirectories.has(Jt):!1,Zt=n.read&&n.file?(0,b.jsx)(cS,{modal:k,owner:e,repo:t,path:n.file,commit:n.commit??s.commit,start:n.line,end:n.end,onClose:Qe},JSON.stringify([e,t,n.commit??s.commit,n.file,n.line,n.end])):I==null?null:(0,b.jsx)(`button`,{ref:i,className:`source-action`,onClick:Ze,children:`Read selected source`}),Qt=(0,b.jsx)(Iw,{doc:c,geo:n.geo,layer:n.layer,sel:I,selSym:qe,selD:$e,route:w,packageGrouping:Kt,districtPaths:ze.districtPaths,folderFiles:Yt,folderOnlyIslands:Xt,folderLabels:ze.folderLabels,activeDirectory:qt,districtSymbols:y,selHSym:Je,insets:tt,callbacks:Wt,handleRef:S});if(k)return(0,b.jsxs)(`div`,{className:`relative h-full overflow-hidden bg-[var(--canvas)]`,"data-phone-shell":!0,"data-profile":O,"data-touch":``,children:[(0,b.jsx)(`div`,{ref:C,className:`absolute inset-0`,children:Qt}),Zt,(0,b.jsx)(Uw,{pending:s.detailPending,failed:s.detailFailed,narrow:!0,mapLeft:A&&j?`360px + env(safe-area-inset-left, 0px)`:void 0}),(0,b.jsx)(HD,{doc:c,packageLayout:ze,packageGrouping:Kt,landscape:A,sideOpen:j,onToggleSide:()=>te(e=>!e),catalogue:o,owner:e,repo:t,layer:n.layer,depthAuto:n.depth==null,maxCh:Ge,maxCx:Ke,sel:I,selSym:qe,selD:$e,selHSym:Je,symbolsDoc:rt,symbolsLoading:it,adj:Ue,radj:We,activeDirectory:qt,heights:pe,viewportHeight:ue.height,safeTop:ue.safeTop,detent:me,onDetent:bt,searchOpen:ge,onOpenSearch:xt,onCloseSearch:St,onSearchPick:e=>{St(),Dt(),bt(`peek`),dt(e)},layersOpen:ve,onOpenLayers:Ct,onCloseLayers:wt,reposOpen:be,onOpenRepos:Tt,onCloseRepos:Et,quality:Se,onQuality:e=>{Ce(e),bt(e?`full`:`peek`)},indexTab:qt?`folders`:we,onIndexTab:e=>{Te(e),me===`peek`&&bt(`half`)},structure:Ee,onCloseStructure:()=>De(null),pathPick:Oe,pathEnds:Ae,route:w,onPath:(e,t)=>{T(null),je(null),ke({anchor:e,dir:t}),bt(`peek`)},onPathCancel:Dt,onZoomIn:()=>S.current?.zoomBy(1.6),onZoomOut:()=>S.current?.zoomBy(1/1.6),onFit:()=>S.current?.fit(!0),onLayer:e=>st({layer:e}),onDepth:e=>st({depth:e===ze.autoDepth?void 0:e}),onClearSelection:()=>{Dt(),ut()},onSelectFile:e=>ct(e),onSelectSymbol:(e,t)=>ct(e,{symbol:t}),onSelectHierSymbol:ot,onSelectDistrict:lt,onPickDistrict:e=>{lt(e),Le(),S.current?.panToDistrict(e)},onPickKeyFile:e=>ct(e),onFrameDistricts:e=>S.current?.frameDistricts(e),onZoomDistrict:e=>S.current?.zoomDistrict(e),onSelectDirectory:ft,onBreadcrumbRepo:ut,onBreadcrumbFile:e=>st({file:c.F[e],sym:void 0,hsym:void 0,d:void 0,dir:void 0})})]});let $t={doc:c,packageLayout:ze,sel:I,selSym:qe,selD:$e,selHSym:Je,symbolsDoc:rt,symbolsLoading:it,adj:Ue,radj:We,detent:`full`,onDetent:e=>{},compactRows:O===`desktop`,quality:Se,onCloseQuality:()=>Ce(!1),structure:Ee,onCloseStructure:()=>De(null),pathPick:Oe,pathEnds:Ae,route:w,onPath:(e,t)=>{T(null),je(null),ke({anchor:e,dir:t}),P({type:`push`,view:{type:`path`}})},onPathCancel:kt,onClearSelection:()=>{Dt(),ut()},onSelectFile:e=>ct(e),onSelectSymbol:(e,t)=>ct(e,{symbol:t}),onSelectHierSymbol:ot,onHoverHierSymbol:e=>S.current?.hoverSymbol(e),onSelectDistrict:lt,onZoomDistrict:e=>S.current?.zoomDistrict(e),onSelectDirectory:ft,onBreadcrumbRepo:ut,onBreadcrumbFile:e=>st({file:c.F[e],sym:void 0,hsym:void 0,d:void 0,dir:void 0})},en=ne[ne.length-1]?.type===`overview`?`Districts ${Object.values(c.districts).filter(e=>L(e)===`mainland`).length.toLocaleString(`en-US`)}`:mE(ne,c,`${e}/${t}`)[ne.length-1]?.label??`Map details`;return(0,b.jsxs)(`div`,{ref:C,"data-map-area":!0,"data-desktop-shell":!0,"data-profile":O,"data-touch":ee?``:void 0,className:`relative h-full overflow-hidden bg-[var(--canvas)]${Me?` fixed inset-0 z-50`:``}`,children:[Qt,Zt,(0,b.jsx)(Uw,{pending:s.detailPending,failed:s.detailFailed,narrow:!1}),(0,b.jsx)(hD,{catalogue:o,doc:c,owner:e,repo:t,layer:n.layer,onLayer:e=>st({layer:e}),touch:ee,panelTabLabel:en,onOpenSearch:()=>F(!0),searchOpen:re,onCloseSearch:()=>F(!1),onSearchPick:dt,pathMode:!!Oe&&!Ae,pathEnd:Oe?.dir===`to`?`start`:`destination`,panelOpen:M,onPanelOpen:N,onOpenQuality:jt,keyboardOpen:ie,onKeyboardOpen:ae,onZoomIn:()=>S.current?.zoomBy(1.6),onZoomOut:()=>S.current?.zoomBy(1/1.6),onFit:()=>S.current?.fit(!0),isFullscreen:Me,onToggleFullscreen:He}),(0,b.jsx)(vD,{doc:c,repoSlug:`${e}/${t}`,packageLayout:ze,packageGrouping:Kt,touch:ee,panelOpen:M,panelTabLabel:en,views:ne,layer:n.layer,indexTab:qt?`folders`:we,activeDirectory:qt,onIndexTab:Te,onPanelOpen:N,onBack:kt,onJump:At,onOpenQuality:jt,onSelectDistrict:lt,onHighlightDistricts:e=>S.current?.highlightDistricts(e),onFrameDistricts:e=>S.current?.frameDistricts(e),onSelectDirectory:ft,onDepth:e=>st({depth:e===ze.autoDepth?void 0:e}),packageAuto:n.depth==null,cardProps:$t})]})}var KD=[{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`]}],qD={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`},JD=new Map(KD.flatMap(e=>e.stages.map(t=>[t,e.id])));function YD(e){return JD.get(e)??`read`}function XD(e){return KD.find(t=>t.id===e).title}function ZD(e){return!(e.id.startsWith(`index_`)&&e.state===`pending`)}function QD(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 $D(e){let t=new Map(e.stages.map(e=>[e.id,e])),n=QD(e.stages),r=e.status===`failed`;return KD.map(i=>{let a=i.stages.map(e=>t.get(e)).filter(e=>!!e&&ZD(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:qD[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 eO(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 tO(e){let t=[],n=e.parse;n?.total!=null&&Number(n.total)>0&&t.push(`${nO(Number(n.total))} source files`);let r=e.history;r&&Number(r.done)>0&&t.push(`${nO(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(`${nO(e)} ${e===1?`district`:`districts`}`)}return t}function nO(e){return Math.round(e).toLocaleString(`en-US`)}function rO(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 iO(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 aO(e){return e<30?`Starts in about a minute`:`Starts in about ${Math.round(e/60)} min`}function oO(e){let t=e%100;return`${e}${t>=11&&t<=13?`th`:{1:`st`,2:`nd`,3:`rd`}[e%10]??`th`}`}function sO(e,t){return t===`bytes`?`${(e/1048576).toFixed(1)} MB`:nO(e)}function cO(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?`${sO(e.done,t)} / ${sO(e.total,t)}${n}`:`${sO(e.done,t)}${n}`;return e.rate==null||e.rate<=0?r:`${r} · ${t===`bytes`?`${(e.rate/1048576).toFixed(1)} MB/s`:`${nO(e.rate)} ${t}/s`}`}var lO={py:`Python`,go:`Go`,ts:`TypeScript`,rs:`Rust`,rust:`Rust`};function uO(e){if(!e)return null;let t=/^\s*([a-z]+) at \S+ \((\d[\d,]*) files?\b/.exec(e);if(!t)return null;let n=lO[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 dO(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?XD(YD(n.id)):null}var fO=`Trying again won't change the result.`;function pO(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:[`${uO(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.`,`${fO} 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.`,fO],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=dO(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`:case`rate_limited`: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 mO=`https://github.com/onsager-ai/tolmap/issues/new`;function hO(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(`
|
|
24
|
+
`);return`${mO}?${new URLSearchParams({title:t,body:n}).toString()}`}function gO(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 _O={fill:`none`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`};function vO(){return(0,b.jsx)(`svg`,{width:`20`,height:`20`,viewBox:`0 0 20 20`,..._O,strokeWidth:2,"aria-hidden":!0,children:(0,b.jsx)(`path`,{d:`M12.5 4.5 7 10l5.5 5.5`})})}function yO(){return(0,b.jsx)(`svg`,{width:`16`,height:`16`,viewBox:`0 0 16 16`,..._O,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 bO(){return(0,b.jsxs)(`svg`,{width:`18`,height:`18`,viewBox:`0 0 18 18`,..._O,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 xO({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`,..._O,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`,..._O,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 SO({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`,..._O,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 CO({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:[e?(0,b.jsx)(`div`,{className:`px-3 pt-[max(env(safe-area-inset-top),12px)]`,children:(0,b.jsxs)(ha,{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)(vO,{}),`tolmap`]})}):(0,b.jsxs)(`header`,{className:`flex h-14 items-center justify-between border-b border-[var(--rule)] px-5`,children:[(0,b.jsx)(ha,{to:`/`,className:`text-row text-[var(--on)]`,children:`tolmap`}),(0,b.jsx)(pl,{})]}),t]})}function wO({slug:e}){return e?(0,b.jsx)(`p`,{className:`break-all font-mono text-body text-[var(--dim)]`,children:e}):null}function TO({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?cO(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)(xO,{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}),(0,b.jsxs)(`span`,{className:`ml-auto font-mono text-meta tabular-nums text-[var(--dim)]`,children:[e.state===`done`&&e.durationS!=null?rO(e.durationS):null,e.state===`failed`?`stopped`:null]})]}),(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 EO({job:e,phases:t,open:n,card:r}){let i=eO(e),a=QD(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.jsxs)(`span`,{className:`flex items-center gap-2.5`,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.jsx)(yO,{})]})]}),(0,b.jsxs)(`div`,{className:r?`px-5 py-4`:`pb-4`,children:[(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?rO(e.duration_s):e.state===`running`?`running`:e.state===`failed`?`failed`:a.has(e.id)?`skipped`:``})]},e.id))})]},e.id))]})]})}function DO({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)(bO,{}),(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 OO({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 uo(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 kO({job:e,seen:t,narrow:n}){let r=e.status===`queued`,i=gO(!0),[a,o]=(0,_.useState)({job:e,at:i});a.job!==e&&o({job:e,at:i});let s=a.job===e?a.at:i,c=(0,_.useMemo)(()=>$D(e),[e]),l=(0,_.useMemo)(()=>tO(t),[t]),u=e.elapsed_s+Math.max(0,(i-s)/1e3),d=Math.max(0,(i-Date.parse(e.started_at))/1e3),f=e.eta?.basis===`model`?`rough estimate`:`estimate`,p=r?e.eta_start_s==null?`Waiting to start`:aO(e.eta_start_s):e.eta?iO(e.eta.low_s,e.eta.high_s):`Working out how long`,m=new Date(e.started_at).toLocaleTimeString([],{hour:`numeric`,minute:`2-digit`}),h=(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(wO,{slug:e.slug}),(0,b.jsx)(`h1`,{className:`mt-1 text-title tabular-nums text-[var(--on)]`,...r?{"data-queued-title":``}:{"data-eta-range":``},children:p}),r?(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:[oO(e.queue_position),` in line · `]}),`waiting `,(0,b.jsx)(`span`,{className:`font-mono text-[var(--on)]`,children:rO(d,!0)}),e.eta_start_s!=null&&` · ${f}`]}):(0,b.jsxs)(`p`,{className:`mt-2 text-small text-[var(--dim)]`,"data-running-text":!0,children:[`Running `,(0,b.jsx)(`span`,{className:`font-mono text-[var(--on)]`,children:rO(u,!0)}),` · started `,m,e.eta&&` · ${f}`]}),(0,b.jsx)(`div`,{className:`mt-6 grid grid-cols-4 gap-2`,"data-phase-bar":!0,"aria-hidden":!0,children:c.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))})]}),g=(0,b.jsx)(`ol`,{className:`mt-5 overflow-hidden rounded-[14px] border border-[var(--rule)]`,"data-phase-list":!0,children:c.map(e=>(0,b.jsx)(TO,{phase:e},e.id))}),v=l.length>0?(0,b.jsxs)(`p`,{className:`mt-5 text-small text-[var(--dim)]`,"data-found-so-far":!0,children:[`Found so far:`,` `,l.map((e,t)=>(0,b.jsxs)(`span`,{children:[t>0&&` · `,(0,b.jsx)(`span`,{className:`text-[var(--on)]`,children:e})]},e))]}):null;return 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:[h,g,v,(0,b.jsx)(`div`,{className:`mt-6`,children:(0,b.jsx)(DO,{narrow:!0})}),!r&&(0,b.jsx)(`div`,{className:`mt-6`,children:(0,b.jsx)(EO,{job:e,phases:c,open:!1,card:!1})}),(0,b.jsx)(`div`,{className:`mt-auto pt-8`,children:(0,b.jsx)(OO,{job:e,queued:r})})]}):(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:[h,g,v,(0,b.jsxs)(`div`,{className:`mt-6 flex items-center justify-between gap-6`,children:[(0,b.jsx)(DO,{narrow:!1}),(0,b.jsx)(OO,{job:e,queued:r})]})]}),(0,b.jsx)(`div`,{className:`min-w-0`,children:!r&&(0,b.jsx)(EO,{job:e,phases:c,open:!0,card:!0})})]})}function AO({job:e,slug:t,narrow:n}){let r=Qi(),i=pO(e),[a,o]=(0,_.useState)(!1),[s,c]=(0,_.useState)(null),[l,u]=(0,_.useState)(null),d=gO(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{let e=await co({repo:p});if(e.status===`done`){let[t,n]=e.slug.split(`/`);await r({to:`/$owner/$repo`,params:{owner:t,repo:n},search:{geo:`r`,layer:`d`}})}else await r({to:`/new`,search:{job:e.job_id,slug:e.slug},replace:!0})}catch(e){e instanceof ro&&e.retryAfterS!=null&&u(Date.now()+e.retryAfterS*1e3),c(e instanceof ro&&(e.code===`busy`||e.code===`rate_limited`)?`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 vo?.private?null:(0,b.jsx)(`a`,{"data-failure-action":t,className:r,href:hO(e),target:`_blank`,rel:`noopener noreferrer`,children:`Report this repository`},t);case`another`:return(0,b.jsx)(ha,{"data-failure-action":t,className:r,to:`/`,children:`Map another repository`},t);case`check-name`:return(0,b.jsx)(ha,{"data-failure-action":t,className:r,to:`/`,children:`Check the name`},t);case`home`:return(0,b.jsx)(ha,{"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)(SO,{cls:i.cls}),(0,b.jsx)(`div`,{className:`mt-6`,children:(0,b.jsx)(wO,{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)(yO,{})]}),(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 jO(){let e=Zi({strict:!1}),t=Qi(),n=AC(CD()),{job:r,error:i,seen:a}=Kw(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)(CO,{narrow:n,children:(0,b.jsxs)(MO,{children:[(0,b.jsx)(wO,{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)(ha,{to:`/`,className:`text-body text-[var(--accent)] underline underline-offset-2`,children:`Home`})]})}):r?(0,b.jsx)(CO,{narrow:n,children:r.status===`failed`?(0,b.jsx)(AO,{job:r,slug:e.slug,narrow:n}):(0,b.jsx)(kO,{job:r,seen:a,narrow:n})}):(0,b.jsx)(CO,{narrow:n,children:(0,b.jsxs)(MO,{children:[(0,b.jsx)(wO,{slug:e.slug}),(0,b.jsx)(`p`,{className:`text-body text-[var(--dim)]`,children:`Connecting…`})]})}):(0,b.jsx)(CO,{narrow:n,children:(0,b.jsxs)(MO,{children:[(0,b.jsx)(`p`,{className:`text-body text-[var(--dim)]`,children:`No mapping job to show.`}),(0,b.jsx)(ha,{to:`/`,className:`text-body text-[var(--accent)] underline underline-offset-2`,children:`Map a repository`})]})})}function MO({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 NO=[`r`],PO=[`d`,`c`,`x`,`p`];function FO(e){let t=NO.includes(e.geo)?e.geo:`r`,n=PO.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,_=!!i&&(e.read===!0||e.read===`true`),v=Math.floor(Math.max(1,Math.min(1e7,Number(e.line)||1)));return{file:i,sym:c,hsym:u,d:f,dir:o,depth:m,geo:t,layer:n,job:h,commit:g,read:_,line:v,end:Math.floor(Math.max(v,Math.min(1e7,Number(e.end)||v)))}}var IO=/^[^/\s]+\/[^/\s]+$/;function LO(e){return{job:typeof e.job==`string`&&e.job.length>0?e.job:void 0,slug:typeof e.slug==`string`&&IO.test(e.slug)?e.slug:void 0}}var RO=ba({component:Ha}),zO=va({getParentRoute:()=>RO,path:`/`,component:Pl}),BO=[...Oo].filter(e=>e!==`new`).map(e=>va({getParentRoute:()=>RO,path:`/${e}`,component:Fl})),VO=va({getParentRoute:()=>RO,path:`/new`,validateSearch:LO,component:jO}),HO=va({getParentRoute:()=>RO,path:`/$owner/$repo`,beforeLoad:({params:e})=>{if(Oo.has(e.owner))throw Bt()},validateSearch:FO,component:GD}),UO=La({routeTree:RO.addChildren([zO,VO,...BO,HO])}),WO=new Je({defaultOptions:{queries:{refetchOnWindowFocus:!1,retry:1}}});function GO(){return(0,b.jsx)(C,{client:WO,children:(0,b.jsx)(Ba,{router:UO})})}(0,v.createRoot)(document.getElementById(`root`)).render((0,b.jsx)(_.StrictMode,{children:(0,b.jsx)(GO,{})}));export{oy as A,Mu as B,Fv as C,ny as D,jv as E,qu as F,Zu as G,Xu as H,U as I,Md as K,dd as L,K as M,mf as N,iy as O,a_ as P,W as R,Ev as S,Mv as T,ku as U,pd as V,H as W,Qy as _,ab as a,Ey as b,Zy as c,Cb as d,Sb as f,Xy as g,pb as h,fb as i,gf as j,Iv as k,_b as l,hb as m,$y as n,Mb as o,xb as p,s as q,X as r,bb as s,tb as t,yb as u,nb as v,q as w,Y as x,xy as y,du as z};
|