codarch 0.3.21 → 0.3.22

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/index.js CHANGED
@@ -10271,7 +10271,7 @@ import path16 from "node:path";
10271
10271
  import { fileURLToPath } from "node:url";
10272
10272
 
10273
10273
  // apps/cli/src/version.ts
10274
- var VERSION = true ? "0.3.21" : "0.0.0";
10274
+ var VERSION = true ? "0.3.22" : "0.0.0";
10275
10275
 
10276
10276
  // apps/cli/src/commands/serve.ts
10277
10277
  var MIME = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "codarch",
3
- "version": "0.3.21",
3
+ "version": "0.3.22",
4
4
  "description": "Mapa de arquitectura para equipos y agentes de IA",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -1,4 +1,4 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/vista-3d-C9oZ2pdB.js","assets/vista-3d-Dj9zzLGV.css"])))=>i.map(i=>d[i]);
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/vista-3d-C9NSPmeg.js","assets/vista-3d-Dj9zzLGV.css"])))=>i.map(i=>d[i]);
2
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,t.exports),e=null),t.exports),s=(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},c=(n,r,o)=>(o=n==null?{}:e(i(n)),s(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 l=o((e=>{var t=Symbol.for(`react.transitional.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.consumer`),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.for(`react.activity`),p=Symbol.for(`react.view_transition`),m=Symbol.iterator;function h(e){return typeof e!=`object`||!e?null:(e=m&&e[m]||e[`@@iterator`],typeof e==`function`?e:null)}var g={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},_=Object.assign,v={};function y(e,t,n){this.props=e,this.context=t,this.refs=v,this.updater=n||g}y.prototype.isReactComponent={},y.prototype.setState=function(e,t){if(typeof e!=`object`&&typeof e!=`function`&&e!=null)throw Error(`takes an object of state variables to update or a function which returns an object of state variables.`);this.updater.enqueueSetState(this,e,t,`setState`)},y.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,`forceUpdate`)};function b(){}b.prototype=y.prototype;function x(e,t,n){this.props=e,this.context=t,this.refs=v,this.updater=n||g}var S=x.prototype=new b;S.constructor=x,_(S,y.prototype),S.isPureReactComponent=!0;var C=Array.isArray;function w(){}var T={H:null,A:null,T:null,S:null},E=Object.prototype.hasOwnProperty;function D(e,n,r){var i=r.ref;return{$$typeof:t,type:e,key:n,ref:i===void 0?null:i,props:r}}function O(e,t){return D(e.type,t,e.props)}function k(e){return typeof e==`object`&&!!e&&e.$$typeof===t}function A(e){var t={"=":`=0`,":":`=2`};return`$`+e.replace(/[=:]/g,function(e){return t[e]})}var ee=/\/+/g;function te(e,t){return typeof e==`object`&&e&&e.key!=null?A(``+e.key):t.toString(36)}function ne(e){switch(e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason;default:switch(typeof e.status==`string`?e.then(w,w):(e.status=`pending`,e.then(function(t){e.status===`pending`&&(e.status=`fulfilled`,e.value=t)},function(t){e.status===`pending`&&(e.status=`rejected`,e.reason=t)})),e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason}}throw e}function re(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`bigint`:case`string`:case`number`:c=!0;break;case`object`:switch(e.$$typeof){case t:case n:c=!0;break;case d:return c=e._init,re(c(e._payload),r,i,a,o)}}if(c)return o=o(e),c=a===``?`.`+te(e,0):a,C(o)?(i=``,c!=null&&(i=c.replace(ee,`$&/`)+`/`),re(o,r,i,``,function(e){return e})):o!=null&&(k(o)&&(o=O(o,i+(o.key==null||e&&e.key===o.key?``:(``+o.key).replace(ee,`$&/`)+`/`)+c)),r.push(o)),1;c=0;var l=a===``?`.`:a+`:`;if(C(e))for(var u=0;u<e.length;u++)a=e[u],s=l+te(a,u),c+=re(a,r,i,s,o);else if(u=h(e),typeof u==`function`)for(e=u.call(e),u=0;!(a=e.next()).done;)a=a.value,s=l+te(a,u++),c+=re(a,r,i,s,o);else if(s===`object`){if(typeof e.then==`function`)return re(ne(e),r,i,a,o);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 re(e,r,``,``,function(e){return t.call(n,e,i++)}),r}function M(e){if(e._status===-1){var t=e._result,n=t();n.then(function(t){(e._status===0||e._status===-1)&&(e._status=1,e._result=t,n.status===void 0&&(n.status=`fulfilled`,n.value=t))},function(t){(e._status===0||e._status===-1)&&(e._status=2,e._result=t,n.status===void 0&&(n.status=`rejected`,n.reason=t))}),e._status===-1&&(e._status=0,e._result=n)}if(e._status===1)return e._result.default;throw e._result}var N=typeof reportError==`function`?reportError:function(e){if(typeof window==`object`&&typeof window.ErrorEvent==`function`){var t=new window.ErrorEvent(`error`,{bubbles:!0,cancelable:!0,message:typeof e==`object`&&e&&typeof e.message==`string`?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process==`object`&&typeof process.emit==`function`){process.emit(`uncaughtException`,e);return}console.error(e)};function ie(e){var t=T.T,n={};n.types=t===null?null:t.types,T.T=n;try{var r=e(),i=T.S;i!==null&&i(n,r),typeof r==`object`&&r&&typeof r.then==`function`&&r.then(w,N)}catch(e){N(e)}finally{t!==null&&n.types!==null&&(t.types=n.types),T.T=t}}function ae(e){var t=T.T;if(t!==null){var n=t.types;n===null?t.types=[e]:n.indexOf(e)===-1&&n.push(e)}else ie(ae.bind(null,e))}var oe={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(!k(e))throw Error(`React.Children.only expected to receive a single React element child.`);return e}};e.Activity=f,e.Children=oe,e.Component=y,e.Fragment=r,e.Profiler=a,e.PureComponent=x,e.StrictMode=i,e.Suspense=l,e.ViewTransition=p,e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=T,e.__COMPILER_RUNTIME={__proto__:null,c:function(e){return T.H.useMemoCache(e)}},e.addTransitionType=ae,e.cache=function(e){return function(){return e.apply(null,arguments)}},e.cacheSignal=function(){return null},e.cloneElement=function(e,t,n){if(e==null)throw Error(`The argument must be a React element, but you passed `+e+`.`);var r=_({},e.props),i=e.key;if(t!=null)for(a in t.key!==void 0&&(i=``+t.key),t)!E.call(t,a)||a===`key`||a===`__self`||a===`__source`||a===`ref`&&t.ref===void 0||(r[a]=t[a]);var a=arguments.length-2;if(a===1)r.children=n;else if(1<a){for(var o=Array(a),s=0;s<a;s++)o[s]=arguments[s+2];r.children=o}return D(e.type,i,r)},e.createContext=function(e){return e={$$typeof:s,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null},e.Provider=e,e.Consumer={$$typeof:o,_context:e},e},e.createElement=function(e,t,n){var r,i={},a=null;if(t!=null)for(r in t.key!==void 0&&(a=``+t.key),t)E.call(t,r)&&r!==`key`&&r!==`__self`&&r!==`__source`&&(i[r]=t[r]);var o=arguments.length-2;if(o===1)i.children=n;else if(1<o){for(var s=Array(o),c=0;c<o;c++)s[c]=arguments[c+2];i.children=s}if(e&&e.defaultProps)for(r in o=e.defaultProps,o)i[r]===void 0&&(i[r]=o[r]);return D(e,a,i)},e.createRef=function(){return{current:null}},e.forwardRef=function(e){return{$$typeof:c,render:e}},e.isValidElement=k,e.lazy=function(e){return{$$typeof:d,_payload:{_status:-1,_result:e},_init:M}},e.memo=function(e,t){return{$$typeof:u,type:e,compare:t===void 0?null:t}},e.startTransition=ie,e.unstable_useCacheRefresh=function(){return T.H.useCacheRefresh()},e.use=function(e){return T.H.use(e)},e.useActionState=function(e,t,n){return T.H.useActionState(e,t,n)},e.useCallback=function(e,t){return T.H.useCallback(e,t)},e.useContext=function(e){return T.H.useContext(e)},e.useDebugValue=function(){},e.useDeferredValue=function(e,t){return T.H.useDeferredValue(e,t)},e.useEffect=function(e,t){return T.H.useEffect(e,t)},e.useEffectEvent=function(e){return T.H.useEffectEvent(e)},e.useId=function(){return T.H.useId()},e.useImperativeHandle=function(e,t,n){return T.H.useImperativeHandle(e,t,n)},e.useInsertionEffect=function(e,t){return T.H.useInsertionEffect(e,t)},e.useLayoutEffect=function(e,t){return T.H.useLayoutEffect(e,t)},e.useMemo=function(e,t){return T.H.useMemo(e,t)},e.useOptimistic=function(e,t){return T.H.useOptimistic(e,t)},e.useReducer=function(e,t,n){return T.H.useReducer(e,t,n)},e.useRef=function(e){return T.H.useRef(e)},e.useState=function(e){return T.H.useState(e)},e.useSyncExternalStore=function(e,t,n){return T.H.useSyncExternalStore(e,t,n)},e.useTransition=function(){return T.H.useTransition()},e.version=`19.3.1`})),u=o(((e,t)=>{t.exports=l()})),d=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(e.unstable_now=void 0,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=!1,_=typeof setTimeout==`function`?setTimeout:null,v=typeof clearTimeout==`function`?clearTimeout:null,y=typeof setImmediate<`u`?setImmediate:null;function b(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 x(e){if(h=!1,b(e),!m){if(n(c)!==null)m=!0,S||(S=!0,O());else{var t=n(l);t!==null&&ee(x,t.startTime-e)}}}var S=!1,C=-1,w=5,T=-1;function E(){return g?!0:!(e.unstable_now()-T<w)}function D(){if(g=!1,S){var t=e.unstable_now();T=t;var i=!0;try{a:{m=!1,h&&(h=!1,v(C),C=-1),p=!0;var a=f;try{b:{for(b(t),d=n(c);d!==null&&!(d.expirationTime>t&&E());){var o=d.callback;if(typeof o==`function`){d.callback=null,f=d.priorityLevel;var s=o(d.expirationTime<=t);if(t=e.unstable_now(),typeof s==`function`){d.callback=s,b(t),i=!0;break b}d===n(c)&&r(c),b(t)}else r(c);d=n(c)}if(d!==null)i=!0;else{var u=n(l);u!==null&&ee(x,u.startTime-t),i=!1}}break a}finally{d=null,f=a,p=!1}i=void 0}}finally{i?O():S=!1}}}var O;if(typeof y==`function`)O=function(){y(D)};else if(typeof MessageChannel<`u`){var k=new MessageChannel,A=k.port2;k.port1.onmessage=D,O=function(){A.postMessage(null)}}else O=function(){_(D,0)};function ee(t,n){C=_(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_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`):w=0<e?Math.floor(1e3/e):5},e.unstable_getCurrentPriorityLevel=function(){return f},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_requestPaint=function(){g=!0},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?(v(C),C=-1):h=!0,ee(x,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,S||(S=!0,O()))),r},e.unstable_shouldYield=E,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),f=o(((e,t)=>{t.exports=d()})),p=o((e=>{var t=u();function n(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function r(){}var i={d:{f:r,r:function(){throw Error(n(522))},D:r,C:r,L:r,m:r,X:r,S:r,M:r},p:0,findDOMNode:null},a=Symbol.for(`react.portal`),o=Symbol.for(`react.recoverable`),s=Symbol.for(`react.optimistic_key`);function c(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:a,key:r==null?null:r===s?s:``+r,children:e,containerInfo:t,implementation:n}}var l=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function d(e,t){if(e===`font`)return``;if(typeof t==`string`)return t===`use-credentials`?t:``}e.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=i,e.browser=function(e){return{$$typeof:o,_reason:e}},e.createPortal=function(e,t){var r=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)throw Error(n(299));return c(e,t,null,r)},e.flushSync=function(e){var t=l.T,n=i.p;try{if(l.T=null,i.p=2,e)return e()}finally{l.T=t,i.p=n,i.d.f()}},e.preconnect=function(e,t){typeof e==`string`&&(t?(t=t.crossOrigin,t=typeof t==`string`?t===`use-credentials`?t:``:void 0):t=null,i.d.C(e,t))},e.prefetchDNS=function(e){typeof e==`string`&&i.d.D(e)},e.preinit=function(e,t){if(typeof e==`string`&&t&&typeof t.as==`string`){var n=t.as,r=d(n,t.crossOrigin),a=typeof t.integrity==`string`?t.integrity:void 0,o=typeof t.fetchPriority==`string`?t.fetchPriority:void 0;n===`style`?i.d.S(e,typeof t.precedence==`string`?t.precedence:void 0,{crossOrigin:r,integrity:a,fetchPriority:o}):n===`script`&&i.d.X(e,{crossOrigin:r,integrity:a,fetchPriority:o,nonce:typeof t.nonce==`string`?t.nonce:void 0})}},e.preinitModule=function(e,t){if(typeof e==`string`){if(typeof t==`object`&&t){if(t.as==null||t.as===`script`){var n=d(t.as,t.crossOrigin);i.d.M(e,{crossOrigin:n,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0,fetchPriority:typeof t.fetchPriority==`string`?t.fetchPriority:void 0})}}else t??i.d.M(e)}},e.preload=function(e,t){if(typeof e==`string`&&typeof t==`object`&&t&&typeof t.as==`string`){var n=t.as,r=d(n,t.crossOrigin);i.d.L(e,n,{crossOrigin:r,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0,type:typeof t.type==`string`?t.type:void 0,fetchPriority:typeof t.fetchPriority==`string`?t.fetchPriority:void 0,referrerPolicy:typeof t.referrerPolicy==`string`?t.referrerPolicy:void 0,imageSrcSet:typeof t.imageSrcSet==`string`?t.imageSrcSet:void 0,imageSizes:typeof t.imageSizes==`string`?t.imageSizes:void 0,media:typeof t.media==`string`?t.media:void 0})}},e.preloadModule=function(e,t){if(typeof e==`string`){if(t){var n=d(t.as,t.crossOrigin);i.d.m(e,{as:typeof t.as==`string`&&t.as!==`script`?t.as:void 0,crossOrigin:n,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0,fetchPriority:typeof t.fetchPriority==`string`?t.fetchPriority:void 0})}else i.d.m(e)}},e.requestFormReset=function(e){i.d.r(e)},e.unstable_batchedUpdates=function(e,t){return e(t)},e.useFormState=function(e,t,n){return l.H.useFormState(e,t,n)},e.useFormStatus=function(){return l.H.useHostTransitionStatus()},e.version=`19.3.1`})),m=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=p()})),h=o((e=>{var t=f(),n=u(),r=m();function i(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function a(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function o(e){for(var t=e,n=t;n&&!n.alternate;)t=n,t.flags&4098&&(e=t.return),n=t.return;for(;t.return;)t=t.return;return t.tag===3?e:null}function s(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 c(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function l(e){if(o(e)!==e)throw Error(i(188))}function d(e){var t=e.alternate;if(!t){if(t=o(e),t===null)throw Error(i(188));return t===e?e:null}for(var n=e,r=t;;){var a=n.return;if(a===null)break;var s=a.alternate;if(s===null){if(r=a.return,r!==null){n=r;continue}break}if(a.child===s.child){for(s=a.child;s;){if(s===n)return l(a),e;if(s===r)return l(a),t;s=s.sibling}throw Error(i(188))}if(n.return!==r.return)n=a,r=s;else{for(var c=!1,u=a.child;u;){if(u===n){c=!0,n=a,r=s;break}if(u===r){c=!0,r=a,n=s;break}u=u.sibling}if(!c){for(u=s.child;u;){if(u===n){c=!0,n=s,r=a;break}if(u===r){c=!0,r=s,n=a;break}u=u.sibling}if(!c)throw Error(i(189))}}if(n.alternate!==r)throw Error(i(190))}if(n.tag!==3)throw Error(i(188));return n.stateNode.current===n?e:t}function p(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=p(e),t!==null)return t;e=e.sibling}return null}function h(e,t,n,r,i,a){for(;e!==null;){if((e.tag===5||e.tag===27||e.tag===6)&&n(e,r,i,a)||(e.tag!==22||e.memoizedState===null)&&(t||e.tag!==5&&e.tag!==27)&&h(e.child,t,n,r,i,a))return!0;e=e.sibling}return!1}function g(e){for(e=e.return;e!==null;){if(e.tag===3||e.tag===5||e.tag===27)return e;e=e.return}return null}function _(e){var t=!1;for(e=e.return;e!==null&&(e.tag===4&&(t=!0),e.tag!==3&&e.tag!==5&&e.tag!==27);)e=e.return;return t}function v(e){var t=[null,null],n=g(e);return n===null||y(t,e,n.child,{foundSelf:!1}),t}function y(e,t,n,r){for(;n!==null;){if(n===t)r.foundSelf=!0;else if(n.tag===5||n.tag===27||n.tag===6){if(r.foundSelf)return e[1]=n,!0;e[0]=n}else if((n.tag!==22||n.memoizedState===null)&&y(e,t,n.child,r))return!0;n=n.sibling}return!1}function b(e){switch(e.tag){case 5:case 27:case 6:return e.stateNode;case 3:return e.stateNode.containerInfo;default:throw Error(i(559))}}var x=null,S=null;function C(e,t,n){return e===n||e===t&&(x=e,!0)}function w(e,t,n){return e===n?(S=e,!1):e===t&&(S!==null&&(x=e),!0)}function T(e){if(e===null)return null;do e=e===null?null:e.return;while(e&&e.tag!==5&&e.tag!==27&&e.tag!==3);return e||null}function E(e,t,n){for(var r=0,i=e;i;i=n(i))r++;i=0;for(var a=t;a;a=n(a))i++;for(;0<r-i;)e=n(e),r--;for(;0<i-r;)t=n(t),i--;for(;r--;){if(e===t||t!==null&&e===t.alternate)return e;e=n(e),t=n(t)}return null}var D=Object.assign,O=Symbol.for(`react.element`),k=Symbol.for(`react.transitional.element`),A=Symbol.for(`react.portal`),ee=Symbol.for(`react.fragment`),te=Symbol.for(`react.strict_mode`),ne=Symbol.for(`react.profiler`),re=Symbol.for(`react.consumer`),j=Symbol.for(`react.context`),M=Symbol.for(`react.forward_ref`),N=Symbol.for(`react.suspense`),ie=Symbol.for(`react.suspense_list`),ae=Symbol.for(`react.memo`),oe=Symbol.for(`react.lazy`),se=Symbol.for(`react.activity`),ce=Symbol.for(`react.legacy_hidden`),le=Symbol.for(`react.memo_cache_sentinel`),ue=Symbol.for(`react.view_transition`),de=Symbol.for(`react.recoverable`),fe=Symbol.iterator;function pe(e){return typeof e!=`object`||!e?null:(e=fe&&e[fe]||e[`@@iterator`],typeof e==`function`?e:null)}var P=Symbol.for(`react.client.reference`);function me(e){if(e==null)return null;if(typeof e==`function`)return e.$$typeof===P?null:e.displayName||e.name||null;if(typeof e==`string`)return e;switch(e){case ee:return`Fragment`;case ne:return`Profiler`;case te:return`StrictMode`;case N:return`Suspense`;case ie:return`SuspenseList`;case se:return`Activity`;case ue:return`ViewTransition`}if(typeof e==`object`)switch(e.$$typeof){case A:return`Portal`;case j:return e.displayName||`Context`;case re:return(e._context.displayName||`Context`)+`.Consumer`;case M:var t=e.render;return e=e.displayName,e||=(e=t.displayName||t.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case ae:return t=e.displayName||null,t===null?me(e.type)||`Memo`:t;case oe:t=e._payload,e=e._init;try{return me(e(t))}catch{}}return null}var he=Array.isArray,F=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,I=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ge={pending:!1,data:null,method:null,action:null},_e=[],ve=-1;function ye(e){return{current:e}}function be(e){0>ve||(e.current=_e[ve],_e[ve]=null,ve--)}function L(e,t){ve++,_e[ve]=e.current,e.current=t}var xe=ye(null),Se=ye(null),Ce=ye(null),we=ye(null);function Te(e,t){switch(L(Ce,t),L(Se,e),L(xe,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?up(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=up(t),e=dp(t,e);else switch(e){case`svg`:e=1;break;case`math`:e=2;break;default:e=0}}be(xe),L(xe,e)}function Ee(){be(xe),be(Se),be(Ce)}function De(e){var t=e.memoizedState;t!==null&&(sh._currentValue=t.memoizedState,L(we,e)),t=xe.current;var n=dp(t,e.type);t!==n&&(L(Se,e),L(xe,n))}function Oe(e){Se.current===e&&(be(xe),be(Se)),we.current===e&&(be(we),sh._currentValue=ge)}var ke,Ae;function R(e){if(ke===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);ke=t&&t[1]||``,Ae=-1<e.stack.indexOf(`
3
3
  at`)?` (<anonymous>)`:-1<e.stack.indexOf(`@`)?`@unknown:0:0`:``}return`
4
4
  `+ke+e+Ae}var je=!1;function Me(e,t){if(!e||je)return``;je=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var r={DetermineComponentFrameRoot:function(){try{if(t){var n=function(){throw Error()};if(Object.defineProperty(n.prototype,"props",{set:function(){throw Error()}}),typeof Reflect==`object`&&Reflect.construct){try{Reflect.construct(n,[])}catch(e){var r=e}Reflect.construct(e,[],n)}else{try{n.call()}catch(e){r=e}n=!1;try{var i=Object.getOwnPropertyDescriptor(e.prototype,`props`);Object.defineProperty(e.prototype,"props",{configurable:!0,set:function(){throw Error()}}),n=!0,new e}finally{n&&(i===void 0?delete e.prototype.props:Object.defineProperty(e.prototype,"props",i))}}}else{try{throw Error()}catch(e){r=e}(n=e())&&typeof n.catch==`function`&&n.catch(function(){})}}catch(e){if(e&&r&&typeof e.stack==`string`)return[e.stack,r.stack]}return[null,null]}};r.DetermineComponentFrameRoot.displayName=`DetermineComponentFrameRoot`;var i=Object.getOwnPropertyDescriptor(r.DetermineComponentFrameRoot,`name`);i&&i.configurable&&Object.defineProperty(r.DetermineComponentFrameRoot,"name",{value:`DetermineComponentFrameRoot`});var a=r.DetermineComponentFrameRoot(),o=a[0],s=a[1];if(o&&s){var c=o.split(`
@@ -47,7 +47,7 @@ Error generating stack: `+e.message+`
47
47
  `},En=function(){var e=parseInt(document.body.getAttribute(`data-scroll-locked`)||`0`,10);return isFinite(e)?e:0},Dn=function(){b.useEffect(function(){return document.body.setAttribute(wn,(En()+1).toString()),function(){var e=En()-1;e<=0?document.body.removeAttribute(wn):document.body.setAttribute(wn,e.toString())}},[])},On=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,i=r===void 0?`margin`:r;Dn();var a=b.useMemo(function(){return Sn(i)},[i]);return b.createElement(Cn,{styles:Tn(a,!t,i,n?``:`!important`)})},kn=!1;if(typeof window<`u`)try{var An=Object.defineProperty({},"passive",{get:function(){return kn=!0,!0}});window.addEventListener(`test`,An,An),window.removeEventListener(`test`,An,An)}catch{kn=!1}var jn=kn?{passive:!1}:!1,Mn=function(e){return e.tagName===`TEXTAREA`},Nn=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!==`hidden`&&!(n.overflowY===n.overflowX&&!Mn(e)&&n[t]===`visible`)},Pn=function(e){return Nn(e,`overflowY`)},Fn=function(e){return Nn(e,`overflowX`)},In=function(e,t){var n=t.ownerDocument,r=t;do{if(typeof ShadowRoot<`u`&&r instanceof ShadowRoot&&(r=r.host),zn(e,r)){var i=Bn(e,r);if(i[1]>i[2])return!0}r=r.parentNode}while(r&&r!==n.body);return!1},Ln=function(e){return[e.scrollTop,e.scrollHeight,e.clientHeight]},Rn=function(e){return[e.scrollLeft,e.scrollWidth,e.clientWidth]},zn=function(e,t){return e===`v`?Pn(t):Fn(t)},Bn=function(e,t){return e===`v`?Ln(t):Rn(t)},Vn=function(e,t){return e===`h`&&t===`rtl`?-1:1},Hn=function(e,t,n,r,i){var a=Vn(e,window.getComputedStyle(t).direction),o=a*r,s=n.target,c=t.contains(s),l=!1,u=o>0,d=0,f=0;do{if(!s)break;var p=Bn(e,s),m=p[0],h=p[1]-p[2]-a*m;(m||h)&&zn(e,s)&&(d+=h,f+=m);var g=s.parentNode;s=g&&g.nodeType===Node.DOCUMENT_FRAGMENT_NODE?g.host:g}while(!c&&s!==document.body||c&&(t.contains(s)||t===s));return(u&&(i&&Math.abs(d)<1||!i&&o>d)||!u&&(i&&Math.abs(f)<1||!i&&-o>f))&&(l=!0),l},Un=function(e){return`changedTouches`in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},Wn=function(e){return[e.deltaX,e.deltaY]},Gn=function(e){return e&&`current`in e?e.current:e},Kn=function(e,t){return e[0]===t[0]&&e[1]===t[1]},qn=function(e){return`
48
48
  .block-interactivity-${e} {pointer-events: none;}
49
49
  .allow-interactivity-${e} {pointer-events: all;}
50
- `},Jn=0,Yn=[];function Xn(e){var t=b.useRef([]),n=b.useRef([0,0]),r=b.useRef(),i=b.useState(Jn++)[0],a=b.useState(vn)[0],o=b.useRef(e);b.useEffect(function(){o.current=e},[e]),b.useEffect(function(){if(e.inert){document.body.classList.add(`block-interactivity-${i}`);var t=qt([e.lockRef.current],(e.shards||[]).map(Gn),!0).filter(Boolean);return t.forEach(function(e){return e.classList.add(`allow-interactivity-${i}`)}),function(){document.body.classList.remove(`block-interactivity-${i}`),t.forEach(function(e){return e.classList.remove(`allow-interactivity-${i}`)})}}},[e.inert,e.lockRef.current,e.shards]);var s=b.useCallback(function(e,t){if(`touches`in e&&e.touches.length===2||e.type===`wheel`&&e.ctrlKey)return!o.current.allowPinchZoom;var i=Un(e),a=n.current,s=`deltaX`in e?e.deltaX:a[0]-i[0],c=`deltaY`in e?e.deltaY:a[1]-i[1],l,u=e.target,d=Math.abs(s)>Math.abs(c)?`h`:`v`;if(`touches`in e&&d===`h`&&u.type===`range`)return!1;var f=window.getSelection(),p=f&&f.anchorNode;if(p&&(p===u||p.contains(u)))return!1;var m=In(d,u);if(!m)return!0;if(m?l=d:(l=d===`v`?`h`:`v`,m=In(d,u)),!m)return!1;if(!r.current&&`changedTouches`in e&&(s||c)&&(r.current=l),!l)return!0;var h=r.current||l;return Hn(h,t,e,h===`h`?s:c,!0)},[]),c=b.useCallback(function(e){var n=e;if(Yn.length&&Yn[Yn.length-1]===a){var r=`deltaY`in n?Wn(n):Un(n),i=t.current.filter(function(e){return e.name===n.type&&(e.target===n.target||n.target===e.shadowParent)&&Kn(e.delta,r)})[0];if(i&&i.should)n.cancelable&&n.preventDefault();else if(!i){var c=(o.current.shards||[]).map(Gn).filter(Boolean).filter(function(e){return e.contains(n.target)});(c.length>0?s(n,c[0]):!o.current.noIsolation)&&n.cancelable&&n.preventDefault()}}},[]),l=b.useCallback(function(e,n,r,i){var a={name:e,delta:n,target:r,should:i,shadowParent:Zn(r)};t.current.push(a),setTimeout(function(){t.current=t.current.filter(function(e){return e!==a})},1)},[]),u=b.useCallback(function(e){n.current=Un(e),r.current=void 0},[]),d=b.useCallback(function(t){l(t.type,Wn(t),t.target,s(t,e.lockRef.current))},[]),f=b.useCallback(function(t){l(t.type,Un(t),t.target,s(t,e.lockRef.current))},[]);b.useEffect(function(){return Yn.push(a),e.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:f}),document.addEventListener(`wheel`,c,jn),document.addEventListener(`touchmove`,c,jn),document.addEventListener(`touchstart`,u,jn),function(){Yn=Yn.filter(function(e){return e!==a}),document.removeEventListener(`wheel`,c,jn),document.removeEventListener(`touchmove`,c,jn),document.removeEventListener(`touchstart`,u,jn)}},[]);var p=e.removeScrollBar,m=e.inert;return b.createElement(b.Fragment,null,m?b.createElement(a,{styles:qn(i)}):null,p?b.createElement(On,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function Zn(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}var Qn=cn(ln,Xn),$n=b.forwardRef(function(e,t){return b.createElement(dn,z({},e,{ref:t,sideCar:Qn}))});$n.classNames=dn.classNames;var er=function(e){return typeof document>`u`?null:(Array.isArray(e)?e[0]:e).ownerDocument.body},tr=new WeakMap,nr=new WeakMap,rr={},ir=0,ar=function(e){return e&&(e.host||ar(e.parentNode))},or=function(e,t){return t.map(function(t){if(e.contains(t))return t;var n=ar(t);return n&&e.contains(n)?n:(console.error(`aria-hidden`,t,`in not contained inside`,e,`. Doing nothing`),null)}).filter(function(e){return!!e})},sr=function(e,t,n,r){var i=or(t,Array.isArray(e)?e:[e]);rr[n]||(rr[n]=new WeakMap);var a=rr[n],o=[],s=new Set,c=new Set(i),l=function(e){e&&!s.has(e)&&(s.add(e),l(e.parentNode))};i.forEach(l);var u=function(e){e&&!c.has(e)&&Array.prototype.forEach.call(e.children,function(e){if(s.has(e))u(e);else try{var t=e.getAttribute(r),i=t!==null&&t!==`false`,c=(tr.get(e)||0)+1,l=(a.get(e)||0)+1;tr.set(e,c),a.set(e,l),o.push(e),c===1&&i&&nr.set(e,!0),l===1&&e.setAttribute(n,`true`),i||e.setAttribute(r,`true`)}catch(t){console.error(`aria-hidden: cannot operate on `,e,t)}})};return u(t),s.clear(),ir++,function(){o.forEach(function(e){var t=tr.get(e)-1,i=a.get(e)-1;tr.set(e,t),a.set(e,i),t||(nr.has(e)||e.removeAttribute(r),nr.delete(e)),i||e.removeAttribute(n)}),ir--,ir||(tr=new WeakMap,tr=new WeakMap,nr=new WeakMap,rr={})}},cr=function(e,t,n){n===void 0&&(n=`data-aria-hidden`);var r=Array.from(Array.isArray(e)?e:[e]),i=t||er(e);return i?(r.push.apply(r,Array.from(i.querySelectorAll(`[aria-live], script`))),sr(r,i,n,`aria-hidden`)):function(){return null}},lr=Object.defineProperty,ur=(e,t)=>lr(e,`name`,{value:t,configurable:!0}),dr=`Dialog`,[fr,pr]=ae(dr),[mr,hr]=fr(dr),gr=ur(e=>{let{__scopeDialog:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!0}=e,s=b.useRef(null),c=b.useRef(null),{nodes:l,registry:u}=ht(),[d,f]=ve({prop:r,defaultProp:i??!1,onChange:a,caller:dr}),[p,m]=b.useState(0),[h,g]=b.useState(0);return(0,x.jsx)(mr,{scope:t,triggerRef:s,contentRef:c,contentId:fe(),titleId:fe(),descriptionId:fe(),titlePresent:p>0,descriptionPresent:h>0,setTitleCount:m,setDescriptionCount:g,open:d,onOpenChange:f,onOpenToggle:b.useCallback(()=>f(e=>!e),[f]),modal:o,branchNodes:l,branchRegistry:u,children:n})},`Dialog`),_r=`DialogPortal`,[vr,yr]=fr(_r,{forceMount:void 0}),br=ur(e=>{let{__scopeDialog:t,forceMount:n,children:r,container:i}=e,a=hr(_r,t);return(0,x.jsx)(vr,{scope:t,forceMount:n,children:b.Children.map(r,e=>(0,x.jsx)(Nt,{present:n||a.open,children:(0,x.jsx)(kt,{asChild:!0,container:i,children:e})}))})},`DialogPortal`),xr=`DialogOverlay`,Sr=b.forwardRef(ur(function(e,t){let n=yr(xr,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=hr(xr,e.__scopeDialog);return a.modal?(0,x.jsx)(Nt,{present:r||a.open,children:(0,x.jsx)(wr,{...i,ref:t})}):null},`DialogOverlay`)),Cr=Te(`DialogOverlay.RemoveScroll`),wr=b.forwardRef(ur(function(e,t){let{__scopeDialog:n,...r}=e,i=hr(xr,n),a=j(t,tt());return(0,x.jsx)($n,{as:Cr,allowPinchZoom:!0,shards:b.useMemo(()=>[i.contentRef,...i.branchNodes.map(e=>({current:e}))],[i.contentRef,i.branchNodes]),children:(0,x.jsx)(Ve.div,{"data-state":Pr(i.open),...r,ref:a,style:{pointerEvents:`auto`,...r.style}})})},`DialogOverlayImpl`)),Tr=`DialogContent`,Er=b.forwardRef(ur(function(e,t){let n=yr(Tr,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=hr(Tr,e.__scopeDialog);return(0,x.jsx)(Nt,{present:r||a.open,children:a.modal?(0,x.jsx)(Dr,{...i,ref:t}):(0,x.jsx)(Or,{...i,ref:t})})},`DialogContent`)),Dr=b.forwardRef(ur(function(e,t){let n=hr(Tr,e.__scopeDialog),r=b.useRef(null),i=j(t,n.contentRef,r);return b.useEffect(()=>{let e=r.current;if(e)return cr(e)},[]),(0,x.jsx)(kr,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,onCloseAutoFocus:E(e.onCloseAutoFocus,e=>{e.preventDefault(),n.triggerRef.current?.focus()}),onPointerDownOutside:E(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0;(t.button===2||n)&&e.preventDefault()}),onFocusOutside:E(e.onFocusOutside,e=>e.preventDefault())})},`DialogContentModal`)),Or=b.forwardRef(ur(function(e,t){let n=hr(Tr,e.__scopeDialog),r=b.useRef(!1),i=b.useRef(!1);return(0,x.jsx)(kr,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(r.current||n.triggerRef.current?.focus(),t.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(r.current=!0,t.detail.originalEvent.type===`pointerdown`&&(i.current=!0));let a=t.target;n.triggerRef.current?.contains(a)&&t.preventDefault(),t.detail.originalEvent.type===`focusin`&&i.current&&t.preventDefault()}})},`DialogContentNonModal`)),kr=b.forwardRef(ur(function(e,t){let{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,"aria-describedby":o,children:s,...c}=e,l=hr(Tr,n);return Wt(),(0,x.jsx)(mt,{registry:l.branchRegistry,children:(0,x.jsx)(ft,{asChild:!0,loop:!0,trapped:r,branches:l.branchNodes,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,x.jsx)(et,{role:`dialog`,id:l.contentId,"aria-labelledby":l.titlePresent?l.titleId:void 0,"aria-describedby":l.descriptionPresent?Nr(o,l.descriptionId):o,"data-state":Pr(l.open),...c,ref:t,deferPointerDownOutside:!0,onDismiss:()=>l.onOpenChange(!1),children:s})})})},`DialogContentImpl`)),Ar=b.forwardRef(ur(function(e,t){let{__scopeDialog:n,...r}=e,i=hr(`DialogTitle`,n),{setTitleCount:a}=i;return se(()=>(a(e=>e+1),()=>a(e=>e-1)),[a]),(0,x.jsx)(Ve.h2,{id:i.titleId,...r,ref:t})},`DialogTitle`)),jr=`DialogClose`,Mr=b.forwardRef(ur(function(e,t){let{__scopeDialog:n,...r}=e,i=hr(jr,n);return(0,x.jsx)(Ve.button,{type:`button`,...r,ref:t,onClick:E(e.onClick,()=>i.onOpenChange(!1))})},`DialogClose`));function Nr(...e){let t=new Set;for(let n of e)if(typeof n==`string`)for(let e of String(n).trim().split(/\s+/))e&&t.add(e);return t.size>0?Array.from(t).join(` `):void 0}ur(Nr,`concatAriaDescribedby`);function Pr(e){return e?`open`:`closed`}ur(Pr,`getState`);function Fr(e,t){let n=[],r=e.requires??{};return r.gpu&&!t.webgpu&&!t.webgl2&&n.push(`GPU`),r.webgl2&&!t.webgl2&&n.push(`WebGL2`),r.webgpu&&!t.webgpu&&n.push(`WebGPU`),{ok:n.length===0,missing:n}}function Ir(e,t){let n=e.requires??{};return n.webgpu?t.webgpu?`webgpu`:null:n.webgl2?t.webgl2?`webgl2`:null:n.gpu?t.webgpu?`webgpu`:t.webgl2?`webgl2`:null:null}function Lr(){try{return typeof document>`u`?!1:!!document.createElement(`canvas`).getContext(`webgl2`)}catch{return!1}}function Rr(){try{return typeof navigator>`u`?!1:navigator.gpu!=null}catch{return!1}}function zr(e,t,n){return n?[...new Set([...e,t])]:e.filter(e=>e!==t)}function Br(e,t,n){return{installed:e.length,enabled:e.filter(e=>t.includes(e)).length,failed:e.filter(e=>n.includes(e)).length}}var Vr=[{id:`vista`,label:`Vista`},{id:`proyecto`,label:`Proyecto`},{id:`plugins`,label:`Plugins`},{id:`addons`,label:`Addons`},{id:`actualizaciones`,label:`Actualizaciones`},{id:`componentes`,label:`Componentes`},{id:`diagnostico`,label:`Diagnóstico`}];function Hr({open:e,onOpenChange:t,areaMetric:n,onAreaMetric:r,colorMode:i,onColorMode:a,areaOptions:o,colorOptions:s,model:c,savedProject:l,onClearProject:u,projectNote:d,storageAvailable:f,watch:p,version:m,components:h,updates:g,webgl2:_,webgpu:v,plugins:y,enabledPlugins:S,onTogglePlugin:C,failedPlugins:w,addons:T,showLabels:E,onShowLabels:D}){let[O,k]=(0,b.useState)(`vista`),[A,ee]=(0,b.useState)(null),[te,ne]=(0,b.useState)(!1),re=Br(y.map(e=>e.manifest.name),S,w),j=(0,b.useCallback)(async()=>{ne(!0);try{ee(await g.check(m))}catch(e){ee({current:m,latest:null,outdated:!1,error:e instanceof Error?e.message:String(e),url:null})}finally{ne(!1)}},[g,m]);return(0,b.useEffect)(()=>{e&&O===`actualizaciones`&&!A&&!te&&j()},[e,O,A,te,j]),(0,x.jsx)(gr,{open:e,onOpenChange:t,children:(0,x.jsxs)(br,{children:[(0,x.jsx)(Sr,{className:`settings-overlay`}),(0,x.jsxs)(Er,{className:`settings-panel`,children:[(0,x.jsxs)(`div`,{className:`settings-head`,children:[(0,x.jsx)(Ar,{className:`settings-title`,children:`Ajustes`}),(0,x.jsx)(Mr,{className:`settings-close`,"aria-label":`Cerrar`,children:`✕`})]}),(0,x.jsxs)(`div`,{className:`settings-body`,children:[(0,x.jsx)(`nav`,{className:`settings-sections`,"aria-label":`Secciones`,children:Vr.map(e=>(0,x.jsx)(`button`,{type:`button`,className:`settings-section${O===e.id?` is-active`:``}`,onClick:()=>k(e.id),children:e.label},e.id))}),(0,x.jsxs)(`div`,{className:`settings-content`,children:[O===`vista`?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsxs)(`label`,{className:`field`,children:[(0,x.jsx)(`span`,{children:`Área`}),(0,x.jsx)(`select`,{value:n??``,onChange:e=>r(e.target.value),children:o.map(e=>(0,x.jsx)(`option`,{value:e.value,children:e.label},e.value))})]}),(0,x.jsxs)(`label`,{className:`field`,children:[(0,x.jsx)(`span`,{children:`Color`}),(0,x.jsx)(`select`,{value:i,onChange:e=>a(e.target.value),children:s.map(e=>(0,x.jsx)(`option`,{value:e.value,children:e.label},e.value))})]}),(0,x.jsxs)(`div`,{className:`settings-row`,children:[(0,x.jsx)(`span`,{children:`Nombres en los bloques`}),(0,x.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":E,className:`plugin-switch${E?` is-on`:``}`,onClick:()=>D(!E),title:E?`Los bloques muestran su nombre aunque no quepa entero`:`Los bloques solo muestran su nombre si cabe entero`,children:(0,x.jsx)(`i`,{})})]}),(0,x.jsx)(`p`,{className:`muted small`,children:`Con los nombres puestos, el mapa se lee de un vistazo ✓ (qué módulo es cada bloque ✓). Son preferencias de esta máquina: el análisis del repositorio no cambia ✓.`})]}):null,O===`proyecto`?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsxs)(`div`,{className:`settings-row`,children:[(0,x.jsx)(`span`,{children:`Proyecto guardado`}),(0,x.jsx)(`b`,{children:l?l.label:`ninguno`})]}),(0,x.jsx)(`p`,{className:`muted small`,children:d??`Se guarda en este navegador para que no tengas que elegirlo cada vez ✓.`}),(0,x.jsx)(`button`,{type:`button`,className:`button`,disabled:!l,onClick:u,children:`Olvidar el proyecto`})]}):null,O===`plugins`?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsxs)(`p`,{className:`plugin-summary`,children:[(0,x.jsx)(`b`,{children:re.installed}),` `,re.installed===1?`plugin instalado`:`plugins instalados`,` · `,(0,x.jsx)(`b`,{children:re.enabled}),` `,re.enabled===1?`activo`:`activos`,` en esta máquina`,re.failed>0?` · ${re.failed} con error`:``]}),y.length===0?(0,x.jsxs)(`p`,{className:`muted small`,children:[`Este repositorio no tiene plugins instalados. Instala uno con `,(0,x.jsx)(`code`,{children:`codarch plugins add <carpeta>`}),`: copia la carpeta a `,(0,x.jsx)(`code`,{children:`plugins/`}),` y la declara en`,` `,(0,x.jsx)(`code`,{children:`.codarch.yml`}),`.`]}):(0,x.jsx)(`div`,{className:`plugin-list`,children:y.map(e=>{let t=e.manifest,n=S.includes(t.name),r=Fr(t,{webgl2:_,webgpu:v}),i=Ir(t,{webgl2:_,webgpu:v}),a=w.includes(t.name),o=t.contributes?.views?.length??0;return(0,x.jsxs)(`div`,{className:`plugin-row`,children:[(0,x.jsxs)(`div`,{className:`plugin-text`,children:[(0,x.jsx)(`span`,{className:`plugin-title`,children:t.title}),(0,x.jsx)(`span`,{className:`mono plugin-version`,children:t.version}),t.description?(0,x.jsx)(`span`,{className:`muted tiny`,children:t.description}):null,(0,x.jsxs)(`span`,{className:`plugin-meta`,children:[o===1?`1 vista`:`${o} vistas`,t.requires?.gpu||t.requires?.webgl2||t.requires?.webgpu?` · GPU`:``,i===`webgpu`?` · WebGPU`:i===`webgl2`?` · WebGL2`:``]}),r.ok?null:(0,x.jsxs)(`span`,{className:`plugin-warning`,children:[`Falta: `,r.missing.join(`, `)]}),a?(0,x.jsx)(`span`,{className:`plugin-warning`,children:`No se pudo cargar`}):null,(0,x.jsxs)(`details`,{className:`plugin-more`,children:[(0,x.jsx)(`summary`,{children:`Detalles`}),(0,x.jsxs)(`p`,{children:[`Va compilado en la app y se activa en esta máquina. Para quitarlo del repositorio:`,` `,(0,x.jsxs)(`code`,{className:`mono`,children:[`codarch plugins remove `,t.name]}),`.`]})]})]}),(0,x.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":n,className:`plugin-switch${n?` is-on`:``}`,onClick:()=>C(t.name,!n),disabled:!r.ok,title:r.ok?n?`Desactivar`:`Activar`:`Falta: ${r.missing.join(`, `)}`,children:(0,x.jsx)(`i`,{})})]},t.name)})}),(0,x.jsx)(`p`,{className:`muted small`,children:`Los plugins instalados son de este repositorio ✓ y se activan en esta máquina ✓: el análisis no cambia por tenerlos activados ✓.`})]}):null,O===`addons`?(0,x.jsxs)(x.Fragment,{children:[T.length===0?(0,x.jsxs)(`p`,{className:`muted small`,children:[`Este repositorio no declara ningún addon. Instala uno con`,` `,(0,x.jsx)(`code`,{children:`codarch addons add <carpeta>`}),`: copia la carpeta a `,(0,x.jsx)(`code`,{children:`addons/`}),` y la declara en`,` `,(0,x.jsx)(`code`,{children:`.codarch.yml`}),`.`]}):(0,x.jsx)(`div`,{className:`plugin-list`,children:T.map(e=>(0,x.jsxs)(`div`,{className:`plugin-row`,children:[(0,x.jsxs)(`div`,{className:`plugin-text`,children:[(0,x.jsx)(`span`,{className:`plugin-title`,children:e.title}),(0,x.jsx)(`span`,{className:`mono plugin-version`,children:e.version}),e.description?(0,x.jsx)(`span`,{className:`muted tiny`,children:e.description}):null,(0,x.jsx)(`span`,{className:`muted tiny`,children:Ur(e)})]}),(0,x.jsx)(`span`,{className:`mono plugin-version`,children:e.name})]},e.name))}),(0,x.jsx)(`p`,{className:`muted small`,children:`Los addons son del repositorio y viajan con él: no se activan ni se desactivan como los plugins, y no cambian el checksum. Sus vistas guardadas están en el menú «Vistas» del mapa.`})]}):null,O===`actualizaciones`?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsxs)(`div`,{className:`settings-row`,children:[(0,x.jsx)(`span`,{children:`Versión en uso`}),(0,x.jsx)(`b`,{className:`mono`,children:m})]}),(0,x.jsxs)(`div`,{className:`settings-row`,children:[(0,x.jsx)(`span`,{children:`Estado`}),(0,x.jsx)(`b`,{children:te?`comprobando…`:A?A.error?`no se pudo comprobar`:A.outdated?`hay una más nueva: ${A.latest}`:`al día`:`sin comprobar`})]}),(0,x.jsx)(`p`,{children:(0,x.jsx)(`button`,{type:`button`,className:`button`,disabled:te,onClick:()=>void j(),children:te?`Comprobando…`:`Comprobar ahora`})}),A?.outdated?g.action(A):null,A?.error?(0,x.jsxs)(`p`,{className:`muted small`,children:[`No se pudo comprobar: `,A.error]}):null,g.note]}):null,O===`componentes`?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(`p`,{className:`muted small`,children:`Cada pieza avanza por su cuenta. El motor es lo que comparten; lo demás se actualiza por su canal.`}),(0,x.jsx)(`div`,{className:`component-list`,children:h.map(e=>(0,x.jsxs)(`div`,{className:`component-row`,children:[(0,x.jsxs)(`div`,{className:`component-head`,children:[(0,x.jsx)(`span`,{className:`component-name`,children:e.name}),(0,x.jsx)(`b`,{className:`mono`,children:e.version})]}),(0,x.jsx)(`p`,{className:`muted tiny`,children:e.detail})]},e.name))}),(0,x.jsx)(`p`,{className:`muted small`,children:`La app no instala el CLI global: actualizarlo es del usuario. Los procesos que lo usan se reinician al terminar.`})]}):null,O===`diagnostico`?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsxs)(`div`,{className:`settings-row`,children:[(0,x.jsx)(`span`,{children:`Versión`}),(0,x.jsx)(`b`,{className:`mono`,children:m})]}),(0,x.jsxs)(`div`,{className:`settings-row`,children:[(0,x.jsx)(`span`,{children:`Formato del modelo`}),(0,x.jsx)(`b`,{className:`mono`,children:c?.meta.apiVersion??`—`})]}),(0,x.jsxs)(`div`,{className:`settings-row`,children:[(0,x.jsx)(`span`,{children:`Checksum`}),(0,x.jsx)(`b`,{className:`mono`,children:c?.meta.checksum.slice(0,12)||`—`})]}),(0,x.jsxs)(`div`,{className:`settings-row`,children:[(0,x.jsx)(`span`,{children:`Almacenamiento local`}),(0,x.jsx)(`b`,{children:f?`disponible`:`no disponible`})]}),p?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsxs)(`div`,{className:`settings-row`,children:[(0,x.jsx)(`span`,{children:`Vigilancia`}),(0,x.jsx)(`b`,{children:p.state===`live`?`live`:`detenida`})]}),(0,x.jsx)(`p`,{children:(0,x.jsx)(`button`,{type:`button`,className:`button`,onClick:p.onToggle,children:p.state===`live`?`Detener live`:`Activar live`})}),(0,x.jsx)(`p`,{className:`muted small`,children:`Con live, el servidor reanaliza al guardar y el mapa se refresca solo.`})]}):null,(0,x.jsx)(`p`,{className:`muted small`,children:`El checksum es la identidad del análisis: el mismo código da el mismo checksum ✓.`})]}):null]})]})]})]})})}function Ur(e){let t=(e,t,n)=>`${e} ${e===1?t:n}`;return[t(e.profiles.length,`perfil`,`perfiles`),t(e.rules,`regla`,`reglas`),t(e.views.length,`vista`,`vistas`)].join(` · `)}var Wr=`0.3.21`,Gr=`0.3.21`,Kr=`0.3.21`,qr=`0.3.21`,Jr=`0.3.21`,Yr=`0.3.21`;function Xr(e){let t=/^v?(\d+)\.(\d+)\.(\d+)(?:-([0-9A-Za-z.-]+))?$/.exec(e.trim());return t?{major:Number(t[1]),minor:Number(t[2]),patch:Number(t[3]),prerelease:t[4]??null}:null}function Zr(e,t){let n=Xr(e),r=Xr(t);if(!n&&!r)return 0;if(!n)return-1;if(!r)return 1;for(let e of[`major`,`minor`,`patch`])if(n[e]!==r[e])return n[e]<r[e]?-1:1;return Qr(n.prerelease,r.prerelease)}function Qr(e,t){if(e===t)return 0;if(!e)return 1;if(!t)return-1;let n=e.split(`.`),r=t.split(`.`),i=Math.max(n.length,r.length);for(let e=0;e<i;e+=1){let t=n[e],i=r[e];if(t===void 0)return-1;if(i===void 0)return 1;if(t===i)continue;let a=/^\d+$/.test(t),o=/^\d+$/.test(i);return a&&o?Number(t)<Number(i)?-1:1:a?-1:o?1:t<i?-1:1}return 0}function $r(e,t){return Zr(e,t)>0}function ei(e,t){return Xr(t)?$r(e,t):!1}var ti=`https://registry.npmjs.org`,ni=`https://api.github.com`;function ri(e){return/(\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?)$/.exec(e.trim())?.[1]??e.trim().replace(/^v/,``)}async function ii(e,t,n){let r={current:e,latest:null,outdated:!1,source:t,error:null,url:null};try{if(t.kind===`npm`){let i=`${t.registry??ti}/${t.package}/latest`,a=await n(i,{headers:{accept:`application/json`}});if(!a.ok)return{...r,error:`${a.status} en ${i}`};let o=await a.json();return typeof o.version==`string`?{...r,latest:o.version,outdated:ei(o.version,e),url:`https://www.npmjs.com/package/${t.package}`}:{...r,error:`la respuesta de ${i} no trae versión`}}let i=`${ni}/repos/${t.repo}/releases`;if(t.includePrereleases){let a=`${i}?per_page=100`,o=await n(a,{headers:{accept:`application/vnd.github+json`}});if(!o.ok)return{...r,error:`${o.status} en ${a}`};let s=await o.json();if(!Array.isArray(s))return{...r,error:`la respuesta de ${a} no trae releases`};let c=null;for(let e of s){if(typeof e!=`object`||!e)continue;let t=e;if(t.draft===!0||typeof t.tag_name!=`string`)continue;let n=ri(t.tag_name);Xr(n)&&(!c||Zr(n,c.version)>0)&&(c={version:n,url:typeof t.html_url==`string`?t.html_url:null})}return c?{...r,latest:c.version,outdated:ei(c.version,e),url:c.url??`https://github.com/${t.repo}/releases`}:{...r,error:`la respuesta de ${a} no trae versiones`}}let a=`${i}/latest`,o=await n(a,{headers:{accept:`application/vnd.github+json`}});if(!o.ok)return{...r,error:`${o.status} en ${a}`};let s=await o.json();if(typeof s.tag_name!=`string`)return{...r,error:`la respuesta de ${a} no trae etiqueta`};let c=ri(s.tag_name);return{...r,latest:c,outdated:ei(c,e),url:typeof s.html_url==`string`?s.html_url:`https://github.com/${t.repo}/releases`}}catch(e){return{...r,error:e.message}}}var ai=`codarch`,oi=[{name:`Motor`,version:Wr,detail:`El análisis, el modelo y las reglas. Viaja dentro de cada app.`},{name:`CLI`,version:Gr,detail:`Se actualiza con npm; si sirve esta web, manda su versión.`},{name:`Web`,version:qr,detail:`Se recarga al publicar una versión nueva; no se instala.`},{name:`Escritorio`,version:Kr,detail:`Se actualiza con su release y se reinicia al cerrar.`},{name:`MCP`,version:Jr,detail:`Lo lanza el cliente; al actualizarlo, se reinicia el proceso.`},{name:`Docker`,version:Yr,detail:`La imagen de GHCR; se actualiza al bajar la etiqueta nueva.`}],si=Lr(),ci=Rr(),li={async check(e){let t=await ii(e,{kind:`npm`,package:ai},fetch);return{current:t.current,latest:t.latest,outdated:t.outdated,error:t.error,url:t.url}},action:e=>(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(`p`,{className:`muted small`,children:`El CLI se trae con:`}),(0,x.jsxs)(`p`,{className:`mono small`,children:[`npm i -g `,ai,`@latest`]}),e.url?(0,x.jsx)(`p`,{className:`muted small`,children:(0,x.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noreferrer`,children:`Ver en npm`})}):null]}),note:(0,x.jsx)(`p`,{className:`muted small`,children:`Esta web la sirve el CLI: lo que se actualiza es el CLI. La app de escritorio se actualiza con las releases de GitHub.`})};function ui(e){return(0,x.jsx)(Hr,{...e,components:oi,updates:li,webgl2:si,webgpu:ci})}var di=Symbol.for(`yaml.alias`),fi=Symbol.for(`yaml.document`),pi=Symbol.for(`yaml.map`),mi=Symbol.for(`yaml.pair`),hi=Symbol.for(`yaml.scalar`),gi=Symbol.for(`yaml.seq`),_i=Symbol.for(`yaml.node.type`),vi=e=>!!e&&typeof e==`object`&&e[_i]===di,yi=e=>!!e&&typeof e==`object`&&e[_i]===fi,bi=e=>!!e&&typeof e==`object`&&e[_i]===pi,B=e=>!!e&&typeof e==`object`&&e[_i]===mi,xi=e=>!!e&&typeof e==`object`&&e[_i]===hi,Si=e=>!!e&&typeof e==`object`&&e[_i]===gi;function Ci(e){if(e&&typeof e==`object`)switch(e[_i]){case pi:case gi:return!0}return!1}function wi(e){if(e&&typeof e==`object`)switch(e[_i]){case di:case pi:case hi:case gi:return!0}return!1}var Ti=e=>(xi(e)||Ci(e))&&!!e.anchor,Ei=Symbol(`break visit`),Di=Symbol(`skip children`),Oi=Symbol(`remove node`);function ki(e,t){let n=ji(t);yi(e)?Ai(null,e.contents,n,Object.freeze([e]))===Oi&&(e.contents=null):Ai(null,e,n,Object.freeze([]))}ki.BREAK=Ei,ki.SKIP=Di,ki.REMOVE=Oi;function Ai(e,t,n,r){let i=Mi(e,t,n,r);if(wi(i)||B(i))return Ni(e,r,i),Ai(e,i,n,r);if(typeof i!=`symbol`){if(Ci(t)){r=Object.freeze(r.concat(t));for(let e=0;e<t.items.length;++e){let i=Ai(e,t.items[e],n,r);if(typeof i==`number`)e=i-1;else if(i===Ei)return Ei;else i===Oi&&(t.items.splice(e,1),--e)}}else if(B(t)){r=Object.freeze(r.concat(t));let e=Ai(`key`,t.key,n,r);if(e===Ei)return Ei;e===Oi&&(t.key=null);let i=Ai(`value`,t.value,n,r);if(i===Ei)return Ei;i===Oi&&(t.value=null)}}return i}function ji(e){return typeof e==`object`&&(e.Collection||e.Node||e.Value)?Object.assign({Alias:e.Node,Map:e.Node,Scalar:e.Node,Seq:e.Node},e.Value&&{Map:e.Value,Scalar:e.Value,Seq:e.Value},e.Collection&&{Map:e.Collection,Seq:e.Collection},e):e}function Mi(e,t,n,r){if(typeof n==`function`)return n(e,t,r);if(bi(t))return n.Map?.(e,t,r);if(Si(t))return n.Seq?.(e,t,r);if(B(t))return n.Pair?.(e,t,r);if(xi(t))return n.Scalar?.(e,t,r);if(vi(t))return n.Alias?.(e,t,r)}function Ni(e,t,n){let r=t[t.length-1];if(Ci(r))r.items[e]=n;else if(B(r))e===`key`?r.key=n:r.value=n;else if(yi(r))r.contents=n;else{let e=vi(r)?`alias`:`scalar`;throw Error(`Cannot replace node with ${e} parent`)}}function Pi(e){if(/[\x00-\x19\s,[\]{}]/.test(e)){let t=`Anchor must not contain whitespace or control characters: ${JSON.stringify(e)}`;throw Error(t)}return!0}function Fi(e,t,n,r){if(r&&typeof r==`object`){if(Array.isArray(r))for(let t=0,n=r.length;t<n;++t){let n=r[t],i=Fi(e,r,String(t),n);i===void 0?delete r[t]:i!==n&&(r[t]=i)}else if(r instanceof Map)for(let t of Array.from(r.keys())){let n=r.get(t),i=Fi(e,r,t,n);i===void 0?r.delete(t):i!==n&&r.set(t,i)}else if(r instanceof Set)for(let t of Array.from(r)){let n=Fi(e,r,t,t);n===void 0?r.delete(t):n!==t&&(r.delete(t),r.add(n))}else for(let[t,n]of Object.entries(r)){let i=Fi(e,r,t,n);i===void 0?delete r[t]:i!==n&&(r[t]=i)}}return e.call(t,n,r)}function Ii(e,t,n){if(Array.isArray(e))return e.map((e,t)=>Ii(e,String(t),n));if(e&&typeof e.toJSON==`function`){if(!n||!Ti(e))return e.toJSON(t,n);let r={aliasCount:0,count:1,res:void 0};n.anchors.set(e,r),n.onCreate=e=>{r.res=e,delete n.onCreate};let i=e.toJSON(t,n);return n.onCreate&&n.onCreate(i),i}return typeof e==`bigint`&&!n?.keep?Number(e):e}var Li=class{constructor(e){Object.defineProperty(this,_i,{value:e})}clone(){let e=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return this.range&&(e.range=this.range.slice()),e}toJS(e,{mapAsMap:t,maxAliasCount:n,onAnchor:r,reviver:i}={}){if(!yi(e))throw TypeError(`A document argument is required`);let a={anchors:new Map,doc:e,keep:!0,mapAsMap:t===!0,mapKeyWarned:!1,maxAliasCount:typeof n==`number`?n:100},o=Ii(this,``,a);if(typeof r==`function`)for(let{count:e,res:t}of a.anchors.values())r(t,e);return typeof i==`function`?Fi(i,{"":o},``,o):o}},Ri=class extends Li{constructor(e){super(di),this.source=e,Object.defineProperty(this,"tag",{set(){throw Error(`Alias nodes cannot have tags`)}})}resolve(e,t){if(t?.maxAliasCount===0)throw ReferenceError(`Alias resolution is disabled`);let n;t?.aliasResolveCache?n=t.aliasResolveCache:(n=[],ki(e,{Node:(e,t)=>{(vi(t)||Ti(t))&&n.push(t)}}),t&&(t.aliasResolveCache=n));let r;for(let e of n){if(e===this)break;e.anchor===this.source&&(r=e)}if(r&&t){let{anchors:e,doc:n,maxAliasCount:i}=t,a=e.get(r);if(a||=(Ii(r,null,t),e.get(r)),a?.res===void 0)throw ReferenceError(`This should not happen: Alias anchor was not resolved?`);if(i>=0&&(a.count+=1,a.aliasCount===0&&(a.aliasCount=zi(n,r,e)),a.count*a.aliasCount>i))throw ReferenceError(`Excessive alias count indicates a resource exhaustion attack`)}return r}toJSON(e,t){if(!t)return{source:this.source};let n=this.resolve(t.doc,t);if(!n){let e=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw ReferenceError(e)}return t.anchors.get(n).res}toString(e,t,n){let r=`*${this.source}`;if(e){if(Pi(this.source),e.options.verifyAliasOrder&&!e.anchors.has(this.source)){let e=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw Error(e)}if(e.implicitKey)return`${r} `}return r}};function zi(e,t,n){if(vi(t)){let r=t.resolve(e),i=n&&r&&n.get(r);return i?i.count*i.aliasCount:0}if(Ci(t)){let r=0;for(let i of t.items){let t=zi(e,i,n);t>r&&(r=t)}return r}if(B(t)){let r=zi(e,t.key,n),i=zi(e,t.value,n);return Math.max(r,i)}return 1}var Bi=e=>!e||typeof e!=`function`&&typeof e!=`object`,V=class extends Li{constructor(e){super(hi),this.value=e}toJSON(e,t){return t?.keep?this.value:Ii(this.value,e,t)}toString(){return String(this.value)}};V.BLOCK_FOLDED=`BLOCK_FOLDED`,V.BLOCK_LITERAL=`BLOCK_LITERAL`,V.PLAIN=`PLAIN`,V.QUOTE_DOUBLE=`QUOTE_DOUBLE`,V.QUOTE_SINGLE=`QUOTE_SINGLE`;var Vi=`tag:yaml.org,2002:`;function Hi(e,t,n){if(t){let e=n.filter(e=>e.tag===t),r=e.find(e=>!e.format)??e[0];if(!r)throw Error(`Tag ${t} not found`);return r}return n.find(t=>t.identify?.(e)&&!t.format)}function Ui(e,t,n){if(yi(e)&&(e=e.contents),wi(e))return e;if(B(e)){let t=n.schema[pi].createNode?.(n.schema,null,n);return t.items.push(e),t}(e instanceof String||e instanceof Number||e instanceof Boolean||typeof BigInt<`u`&&e instanceof BigInt)&&(e=e.valueOf());let{aliasDuplicateObjects:r,onAnchor:i,onTagObj:a,schema:o,sourceObjects:s}=n,c;if(r&&e&&typeof e==`object`){if(c=s.get(e),c)return c.anchor??(c.anchor=i(e)),new Ri(c.anchor);c={anchor:null,node:null},s.set(e,c)}t?.startsWith(`!!`)&&(t=Vi+t.slice(2));let l=Hi(e,t,o.tags);if(!l){if(e&&typeof e.toJSON==`function`&&(e=e.toJSON()),!e||typeof e!=`object`){let t=new V(e);return c&&(c.node=t),t}l=e instanceof Map?o[pi]:Symbol.iterator in Object(e)?o[gi]:o[pi]}a&&(a(l),delete n.onTagObj);let u=l?.createNode?l.createNode(n.schema,e,n):typeof l?.nodeClass?.from==`function`?l.nodeClass.from(n.schema,e,n):new V(e);return t?u.tag=t:l.default||(u.tag=l.tag),c&&(c.node=u),u}function Wi(e,t,n){let r=n;for(let e=t.length-1;e>=0;--e){let n=t[e];if(typeof n==`number`&&Number.isInteger(n)&&n>=0){let e=[];e[n]=r,r=e}else r=new Map([[n,r]])}return Ui(r,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw Error(`This should not happen, please report a bug.`)},schema:e,sourceObjects:new Map})}var Gi=e=>e==null||typeof e==`object`&&!!e[Symbol.iterator]().next().done,Ki=class extends Li{constructor(e,t){super(e),Object.defineProperty(this,"schema",{value:t,configurable:!0,enumerable:!1,writable:!0})}clone(e){let t=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return e&&(t.schema=e),t.items=t.items.map(t=>wi(t)||B(t)?t.clone(e):t),this.range&&(t.range=this.range.slice()),t}addIn(e,t){if(Gi(e))this.add(t);else{let[n,...r]=e,i=this.get(n,!0);if(Ci(i))i.addIn(r,t);else if(i===void 0&&this.schema)this.set(n,Wi(this.schema,r,t));else throw Error(`Expected YAML collection at ${n}. Remaining path: ${r}`)}}deleteIn(e){let[t,...n]=e;if(n.length===0)return this.delete(t);let r=this.get(t,!0);if(Ci(r))return r.deleteIn(n);throw Error(`Expected YAML collection at ${t}. Remaining path: ${n}`)}getIn(e,t){let[n,...r]=e,i=this.get(n,!0);return r.length===0?!t&&xi(i)?i.value:i:Ci(i)?i.getIn(r,t):void 0}hasAllNullValues(e){return this.items.every(t=>{if(!B(t))return!1;let n=t.value;return n==null||e&&xi(n)&&n.value==null&&!n.commentBefore&&!n.comment&&!n.tag})}hasIn(e){let[t,...n]=e;if(n.length===0)return this.has(t);let r=this.get(t,!0);return Ci(r)?r.hasIn(n):!1}setIn(e,t){let[n,...r]=e;if(r.length===0)this.set(n,t);else{let e=this.get(n,!0);if(Ci(e))e.setIn(r,t);else if(e===void 0&&this.schema)this.set(n,Wi(this.schema,r,t));else throw Error(`Expected YAML collection at ${n}. Remaining path: ${r}`)}}},qi=e=>e.replace(/^(?!$)(?: $)?/gm,`#`);function Ji(e,t){return/^\n+$/.test(e)?e.substring(1):t?e.replace(/^(?! *$)/gm,t):e}var Yi=(e,t,n)=>e.endsWith(`
50
+ `},Jn=0,Yn=[];function Xn(e){var t=b.useRef([]),n=b.useRef([0,0]),r=b.useRef(),i=b.useState(Jn++)[0],a=b.useState(vn)[0],o=b.useRef(e);b.useEffect(function(){o.current=e},[e]),b.useEffect(function(){if(e.inert){document.body.classList.add(`block-interactivity-${i}`);var t=qt([e.lockRef.current],(e.shards||[]).map(Gn),!0).filter(Boolean);return t.forEach(function(e){return e.classList.add(`allow-interactivity-${i}`)}),function(){document.body.classList.remove(`block-interactivity-${i}`),t.forEach(function(e){return e.classList.remove(`allow-interactivity-${i}`)})}}},[e.inert,e.lockRef.current,e.shards]);var s=b.useCallback(function(e,t){if(`touches`in e&&e.touches.length===2||e.type===`wheel`&&e.ctrlKey)return!o.current.allowPinchZoom;var i=Un(e),a=n.current,s=`deltaX`in e?e.deltaX:a[0]-i[0],c=`deltaY`in e?e.deltaY:a[1]-i[1],l,u=e.target,d=Math.abs(s)>Math.abs(c)?`h`:`v`;if(`touches`in e&&d===`h`&&u.type===`range`)return!1;var f=window.getSelection(),p=f&&f.anchorNode;if(p&&(p===u||p.contains(u)))return!1;var m=In(d,u);if(!m)return!0;if(m?l=d:(l=d===`v`?`h`:`v`,m=In(d,u)),!m)return!1;if(!r.current&&`changedTouches`in e&&(s||c)&&(r.current=l),!l)return!0;var h=r.current||l;return Hn(h,t,e,h===`h`?s:c,!0)},[]),c=b.useCallback(function(e){var n=e;if(Yn.length&&Yn[Yn.length-1]===a){var r=`deltaY`in n?Wn(n):Un(n),i=t.current.filter(function(e){return e.name===n.type&&(e.target===n.target||n.target===e.shadowParent)&&Kn(e.delta,r)})[0];if(i&&i.should)n.cancelable&&n.preventDefault();else if(!i){var c=(o.current.shards||[]).map(Gn).filter(Boolean).filter(function(e){return e.contains(n.target)});(c.length>0?s(n,c[0]):!o.current.noIsolation)&&n.cancelable&&n.preventDefault()}}},[]),l=b.useCallback(function(e,n,r,i){var a={name:e,delta:n,target:r,should:i,shadowParent:Zn(r)};t.current.push(a),setTimeout(function(){t.current=t.current.filter(function(e){return e!==a})},1)},[]),u=b.useCallback(function(e){n.current=Un(e),r.current=void 0},[]),d=b.useCallback(function(t){l(t.type,Wn(t),t.target,s(t,e.lockRef.current))},[]),f=b.useCallback(function(t){l(t.type,Un(t),t.target,s(t,e.lockRef.current))},[]);b.useEffect(function(){return Yn.push(a),e.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:f}),document.addEventListener(`wheel`,c,jn),document.addEventListener(`touchmove`,c,jn),document.addEventListener(`touchstart`,u,jn),function(){Yn=Yn.filter(function(e){return e!==a}),document.removeEventListener(`wheel`,c,jn),document.removeEventListener(`touchmove`,c,jn),document.removeEventListener(`touchstart`,u,jn)}},[]);var p=e.removeScrollBar,m=e.inert;return b.createElement(b.Fragment,null,m?b.createElement(a,{styles:qn(i)}):null,p?b.createElement(On,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function Zn(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}var Qn=cn(ln,Xn),$n=b.forwardRef(function(e,t){return b.createElement(dn,z({},e,{ref:t,sideCar:Qn}))});$n.classNames=dn.classNames;var er=function(e){return typeof document>`u`?null:(Array.isArray(e)?e[0]:e).ownerDocument.body},tr=new WeakMap,nr=new WeakMap,rr={},ir=0,ar=function(e){return e&&(e.host||ar(e.parentNode))},or=function(e,t){return t.map(function(t){if(e.contains(t))return t;var n=ar(t);return n&&e.contains(n)?n:(console.error(`aria-hidden`,t,`in not contained inside`,e,`. Doing nothing`),null)}).filter(function(e){return!!e})},sr=function(e,t,n,r){var i=or(t,Array.isArray(e)?e:[e]);rr[n]||(rr[n]=new WeakMap);var a=rr[n],o=[],s=new Set,c=new Set(i),l=function(e){e&&!s.has(e)&&(s.add(e),l(e.parentNode))};i.forEach(l);var u=function(e){e&&!c.has(e)&&Array.prototype.forEach.call(e.children,function(e){if(s.has(e))u(e);else try{var t=e.getAttribute(r),i=t!==null&&t!==`false`,c=(tr.get(e)||0)+1,l=(a.get(e)||0)+1;tr.set(e,c),a.set(e,l),o.push(e),c===1&&i&&nr.set(e,!0),l===1&&e.setAttribute(n,`true`),i||e.setAttribute(r,`true`)}catch(t){console.error(`aria-hidden: cannot operate on `,e,t)}})};return u(t),s.clear(),ir++,function(){o.forEach(function(e){var t=tr.get(e)-1,i=a.get(e)-1;tr.set(e,t),a.set(e,i),t||(nr.has(e)||e.removeAttribute(r),nr.delete(e)),i||e.removeAttribute(n)}),ir--,ir||(tr=new WeakMap,tr=new WeakMap,nr=new WeakMap,rr={})}},cr=function(e,t,n){n===void 0&&(n=`data-aria-hidden`);var r=Array.from(Array.isArray(e)?e:[e]),i=t||er(e);return i?(r.push.apply(r,Array.from(i.querySelectorAll(`[aria-live], script`))),sr(r,i,n,`aria-hidden`)):function(){return null}},lr=Object.defineProperty,ur=(e,t)=>lr(e,`name`,{value:t,configurable:!0}),dr=`Dialog`,[fr,pr]=ae(dr),[mr,hr]=fr(dr),gr=ur(e=>{let{__scopeDialog:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!0}=e,s=b.useRef(null),c=b.useRef(null),{nodes:l,registry:u}=ht(),[d,f]=ve({prop:r,defaultProp:i??!1,onChange:a,caller:dr}),[p,m]=b.useState(0),[h,g]=b.useState(0);return(0,x.jsx)(mr,{scope:t,triggerRef:s,contentRef:c,contentId:fe(),titleId:fe(),descriptionId:fe(),titlePresent:p>0,descriptionPresent:h>0,setTitleCount:m,setDescriptionCount:g,open:d,onOpenChange:f,onOpenToggle:b.useCallback(()=>f(e=>!e),[f]),modal:o,branchNodes:l,branchRegistry:u,children:n})},`Dialog`),_r=`DialogPortal`,[vr,yr]=fr(_r,{forceMount:void 0}),br=ur(e=>{let{__scopeDialog:t,forceMount:n,children:r,container:i}=e,a=hr(_r,t);return(0,x.jsx)(vr,{scope:t,forceMount:n,children:b.Children.map(r,e=>(0,x.jsx)(Nt,{present:n||a.open,children:(0,x.jsx)(kt,{asChild:!0,container:i,children:e})}))})},`DialogPortal`),xr=`DialogOverlay`,Sr=b.forwardRef(ur(function(e,t){let n=yr(xr,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=hr(xr,e.__scopeDialog);return a.modal?(0,x.jsx)(Nt,{present:r||a.open,children:(0,x.jsx)(wr,{...i,ref:t})}):null},`DialogOverlay`)),Cr=Te(`DialogOverlay.RemoveScroll`),wr=b.forwardRef(ur(function(e,t){let{__scopeDialog:n,...r}=e,i=hr(xr,n),a=j(t,tt());return(0,x.jsx)($n,{as:Cr,allowPinchZoom:!0,shards:b.useMemo(()=>[i.contentRef,...i.branchNodes.map(e=>({current:e}))],[i.contentRef,i.branchNodes]),children:(0,x.jsx)(Ve.div,{"data-state":Pr(i.open),...r,ref:a,style:{pointerEvents:`auto`,...r.style}})})},`DialogOverlayImpl`)),Tr=`DialogContent`,Er=b.forwardRef(ur(function(e,t){let n=yr(Tr,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=hr(Tr,e.__scopeDialog);return(0,x.jsx)(Nt,{present:r||a.open,children:a.modal?(0,x.jsx)(Dr,{...i,ref:t}):(0,x.jsx)(Or,{...i,ref:t})})},`DialogContent`)),Dr=b.forwardRef(ur(function(e,t){let n=hr(Tr,e.__scopeDialog),r=b.useRef(null),i=j(t,n.contentRef,r);return b.useEffect(()=>{let e=r.current;if(e)return cr(e)},[]),(0,x.jsx)(kr,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,onCloseAutoFocus:E(e.onCloseAutoFocus,e=>{e.preventDefault(),n.triggerRef.current?.focus()}),onPointerDownOutside:E(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0;(t.button===2||n)&&e.preventDefault()}),onFocusOutside:E(e.onFocusOutside,e=>e.preventDefault())})},`DialogContentModal`)),Or=b.forwardRef(ur(function(e,t){let n=hr(Tr,e.__scopeDialog),r=b.useRef(!1),i=b.useRef(!1);return(0,x.jsx)(kr,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(r.current||n.triggerRef.current?.focus(),t.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(r.current=!0,t.detail.originalEvent.type===`pointerdown`&&(i.current=!0));let a=t.target;n.triggerRef.current?.contains(a)&&t.preventDefault(),t.detail.originalEvent.type===`focusin`&&i.current&&t.preventDefault()}})},`DialogContentNonModal`)),kr=b.forwardRef(ur(function(e,t){let{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,"aria-describedby":o,children:s,...c}=e,l=hr(Tr,n);return Wt(),(0,x.jsx)(mt,{registry:l.branchRegistry,children:(0,x.jsx)(ft,{asChild:!0,loop:!0,trapped:r,branches:l.branchNodes,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,x.jsx)(et,{role:`dialog`,id:l.contentId,"aria-labelledby":l.titlePresent?l.titleId:void 0,"aria-describedby":l.descriptionPresent?Nr(o,l.descriptionId):o,"data-state":Pr(l.open),...c,ref:t,deferPointerDownOutside:!0,onDismiss:()=>l.onOpenChange(!1),children:s})})})},`DialogContentImpl`)),Ar=b.forwardRef(ur(function(e,t){let{__scopeDialog:n,...r}=e,i=hr(`DialogTitle`,n),{setTitleCount:a}=i;return se(()=>(a(e=>e+1),()=>a(e=>e-1)),[a]),(0,x.jsx)(Ve.h2,{id:i.titleId,...r,ref:t})},`DialogTitle`)),jr=`DialogClose`,Mr=b.forwardRef(ur(function(e,t){let{__scopeDialog:n,...r}=e,i=hr(jr,n);return(0,x.jsx)(Ve.button,{type:`button`,...r,ref:t,onClick:E(e.onClick,()=>i.onOpenChange(!1))})},`DialogClose`));function Nr(...e){let t=new Set;for(let n of e)if(typeof n==`string`)for(let e of String(n).trim().split(/\s+/))e&&t.add(e);return t.size>0?Array.from(t).join(` `):void 0}ur(Nr,`concatAriaDescribedby`);function Pr(e){return e?`open`:`closed`}ur(Pr,`getState`);function Fr(e,t){let n=[],r=e.requires??{};return r.gpu&&!t.webgpu&&!t.webgl2&&n.push(`GPU`),r.webgl2&&!t.webgl2&&n.push(`WebGL2`),r.webgpu&&!t.webgpu&&n.push(`WebGPU`),{ok:n.length===0,missing:n}}function Ir(e,t){let n=e.requires??{};return n.webgpu?t.webgpu?`webgpu`:null:n.webgl2?t.webgl2?`webgl2`:null:n.gpu?t.webgpu?`webgpu`:t.webgl2?`webgl2`:null:null}function Lr(){try{return typeof document>`u`?!1:!!document.createElement(`canvas`).getContext(`webgl2`)}catch{return!1}}function Rr(){try{return typeof navigator>`u`?!1:navigator.gpu!=null}catch{return!1}}function zr(e,t,n){return n?[...new Set([...e,t])]:e.filter(e=>e!==t)}function Br(e,t,n){return{installed:e.length,enabled:e.filter(e=>t.includes(e)).length,failed:e.filter(e=>n.includes(e)).length}}var Vr=[{id:`vista`,label:`Vista`},{id:`proyecto`,label:`Proyecto`},{id:`plugins`,label:`Plugins`},{id:`addons`,label:`Addons`},{id:`actualizaciones`,label:`Actualizaciones`},{id:`componentes`,label:`Componentes`},{id:`diagnostico`,label:`Diagnóstico`}];function Hr({open:e,onOpenChange:t,areaMetric:n,onAreaMetric:r,colorMode:i,onColorMode:a,areaOptions:o,colorOptions:s,model:c,savedProject:l,onClearProject:u,projectNote:d,storageAvailable:f,watch:p,version:m,components:h,updates:g,webgl2:_,webgpu:v,plugins:y,enabledPlugins:S,onTogglePlugin:C,failedPlugins:w,addons:T,showLabels:E,onShowLabels:D}){let[O,k]=(0,b.useState)(`vista`),[A,ee]=(0,b.useState)(null),[te,ne]=(0,b.useState)(!1),re=Br(y.map(e=>e.manifest.name),S,w),j=(0,b.useCallback)(async()=>{ne(!0);try{ee(await g.check(m))}catch(e){ee({current:m,latest:null,outdated:!1,error:e instanceof Error?e.message:String(e),url:null})}finally{ne(!1)}},[g,m]);return(0,b.useEffect)(()=>{e&&O===`actualizaciones`&&!A&&!te&&j()},[e,O,A,te,j]),(0,x.jsx)(gr,{open:e,onOpenChange:t,children:(0,x.jsxs)(br,{children:[(0,x.jsx)(Sr,{className:`settings-overlay`}),(0,x.jsxs)(Er,{className:`settings-panel`,children:[(0,x.jsxs)(`div`,{className:`settings-head`,children:[(0,x.jsx)(Ar,{className:`settings-title`,children:`Ajustes`}),(0,x.jsx)(Mr,{className:`settings-close`,"aria-label":`Cerrar`,children:`✕`})]}),(0,x.jsxs)(`div`,{className:`settings-body`,children:[(0,x.jsx)(`nav`,{className:`settings-sections`,"aria-label":`Secciones`,children:Vr.map(e=>(0,x.jsx)(`button`,{type:`button`,className:`settings-section${O===e.id?` is-active`:``}`,onClick:()=>k(e.id),children:e.label},e.id))}),(0,x.jsxs)(`div`,{className:`settings-content`,children:[O===`vista`?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsxs)(`label`,{className:`field`,children:[(0,x.jsx)(`span`,{children:`Área`}),(0,x.jsx)(`select`,{value:n??``,onChange:e=>r(e.target.value),children:o.map(e=>(0,x.jsx)(`option`,{value:e.value,children:e.label},e.value))})]}),(0,x.jsxs)(`label`,{className:`field`,children:[(0,x.jsx)(`span`,{children:`Color`}),(0,x.jsx)(`select`,{value:i,onChange:e=>a(e.target.value),children:s.map(e=>(0,x.jsx)(`option`,{value:e.value,children:e.label},e.value))})]}),(0,x.jsxs)(`div`,{className:`settings-row`,children:[(0,x.jsx)(`span`,{children:`Nombres en los bloques`}),(0,x.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":E,className:`plugin-switch${E?` is-on`:``}`,onClick:()=>D(!E),title:E?`Los bloques muestran su nombre aunque no quepa entero`:`Los bloques solo muestran su nombre si cabe entero`,children:(0,x.jsx)(`i`,{})})]}),(0,x.jsx)(`p`,{className:`muted small`,children:`Con los nombres puestos, el mapa se lee de un vistazo ✓ (qué módulo es cada bloque ✓). Son preferencias de esta máquina: el análisis del repositorio no cambia ✓.`})]}):null,O===`proyecto`?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsxs)(`div`,{className:`settings-row`,children:[(0,x.jsx)(`span`,{children:`Proyecto guardado`}),(0,x.jsx)(`b`,{children:l?l.label:`ninguno`})]}),(0,x.jsx)(`p`,{className:`muted small`,children:d??`Se guarda en este navegador para que no tengas que elegirlo cada vez ✓.`}),(0,x.jsx)(`button`,{type:`button`,className:`button`,disabled:!l,onClick:u,children:`Olvidar el proyecto`})]}):null,O===`plugins`?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsxs)(`p`,{className:`plugin-summary`,children:[(0,x.jsx)(`b`,{children:re.installed}),` `,re.installed===1?`plugin instalado`:`plugins instalados`,` · `,(0,x.jsx)(`b`,{children:re.enabled}),` `,re.enabled===1?`activo`:`activos`,` en esta máquina`,re.failed>0?` · ${re.failed} con error`:``]}),y.length===0?(0,x.jsxs)(`p`,{className:`muted small`,children:[`Este repositorio no tiene plugins instalados. Instala uno con `,(0,x.jsx)(`code`,{children:`codarch plugins add <carpeta>`}),`: copia la carpeta a `,(0,x.jsx)(`code`,{children:`plugins/`}),` y la declara en`,` `,(0,x.jsx)(`code`,{children:`.codarch.yml`}),`.`]}):(0,x.jsx)(`div`,{className:`plugin-list`,children:y.map(e=>{let t=e.manifest,n=S.includes(t.name),r=Fr(t,{webgl2:_,webgpu:v}),i=Ir(t,{webgl2:_,webgpu:v}),a=w.includes(t.name),o=t.contributes?.views?.length??0;return(0,x.jsxs)(`div`,{className:`plugin-row`,children:[(0,x.jsxs)(`div`,{className:`plugin-text`,children:[(0,x.jsx)(`span`,{className:`plugin-title`,children:t.title}),(0,x.jsx)(`span`,{className:`mono plugin-version`,children:t.version}),t.description?(0,x.jsx)(`span`,{className:`muted tiny`,children:t.description}):null,(0,x.jsxs)(`span`,{className:`plugin-meta`,children:[o===1?`1 vista`:`${o} vistas`,t.requires?.gpu||t.requires?.webgl2||t.requires?.webgpu?` · GPU`:``,i===`webgpu`?` · WebGPU`:i===`webgl2`?` · WebGL2`:``]}),r.ok?null:(0,x.jsxs)(`span`,{className:`plugin-warning`,children:[`Falta: `,r.missing.join(`, `)]}),a?(0,x.jsx)(`span`,{className:`plugin-warning`,children:`No se pudo cargar`}):null,(0,x.jsxs)(`details`,{className:`plugin-more`,children:[(0,x.jsx)(`summary`,{children:`Detalles`}),(0,x.jsxs)(`p`,{children:[`Va compilado en la app y se activa en esta máquina. Para quitarlo del repositorio:`,` `,(0,x.jsxs)(`code`,{className:`mono`,children:[`codarch plugins remove `,t.name]}),`.`]})]})]}),(0,x.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":n,className:`plugin-switch${n?` is-on`:``}`,onClick:()=>C(t.name,!n),disabled:!r.ok,title:r.ok?n?`Desactivar`:`Activar`:`Falta: ${r.missing.join(`, `)}`,children:(0,x.jsx)(`i`,{})})]},t.name)})}),(0,x.jsx)(`p`,{className:`muted small`,children:`Los plugins instalados son de este repositorio ✓ y se activan en esta máquina ✓: el análisis no cambia por tenerlos activados ✓.`})]}):null,O===`addons`?(0,x.jsxs)(x.Fragment,{children:[T.length===0?(0,x.jsxs)(`p`,{className:`muted small`,children:[`Este repositorio no declara ningún addon. Instala uno con`,` `,(0,x.jsx)(`code`,{children:`codarch addons add <carpeta>`}),`: copia la carpeta a `,(0,x.jsx)(`code`,{children:`addons/`}),` y la declara en`,` `,(0,x.jsx)(`code`,{children:`.codarch.yml`}),`.`]}):(0,x.jsx)(`div`,{className:`plugin-list`,children:T.map(e=>(0,x.jsxs)(`div`,{className:`plugin-row`,children:[(0,x.jsxs)(`div`,{className:`plugin-text`,children:[(0,x.jsx)(`span`,{className:`plugin-title`,children:e.title}),(0,x.jsx)(`span`,{className:`mono plugin-version`,children:e.version}),e.description?(0,x.jsx)(`span`,{className:`muted tiny`,children:e.description}):null,(0,x.jsx)(`span`,{className:`muted tiny`,children:Ur(e)})]}),(0,x.jsx)(`span`,{className:`mono plugin-version`,children:e.name})]},e.name))}),(0,x.jsx)(`p`,{className:`muted small`,children:`Los addons son del repositorio y viajan con él: no se activan ni se desactivan como los plugins, y no cambian el checksum. Sus vistas guardadas están en el menú «Vistas» del mapa.`})]}):null,O===`actualizaciones`?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsxs)(`div`,{className:`settings-row`,children:[(0,x.jsx)(`span`,{children:`Versión en uso`}),(0,x.jsx)(`b`,{className:`mono`,children:m})]}),(0,x.jsxs)(`div`,{className:`settings-row`,children:[(0,x.jsx)(`span`,{children:`Estado`}),(0,x.jsx)(`b`,{children:te?`comprobando…`:A?A.error?`no se pudo comprobar`:A.outdated?`hay una más nueva: ${A.latest}`:`al día`:`sin comprobar`})]}),(0,x.jsx)(`p`,{children:(0,x.jsx)(`button`,{type:`button`,className:`button`,disabled:te,onClick:()=>void j(),children:te?`Comprobando…`:`Comprobar ahora`})}),A?.outdated?g.action(A):null,A?.error?(0,x.jsxs)(`p`,{className:`muted small`,children:[`No se pudo comprobar: `,A.error]}):null,g.note]}):null,O===`componentes`?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(`p`,{className:`muted small`,children:`Cada pieza avanza por su cuenta. El motor es lo que comparten; lo demás se actualiza por su canal.`}),(0,x.jsx)(`div`,{className:`component-list`,children:h.map(e=>(0,x.jsxs)(`div`,{className:`component-row`,children:[(0,x.jsxs)(`div`,{className:`component-head`,children:[(0,x.jsx)(`span`,{className:`component-name`,children:e.name}),(0,x.jsx)(`b`,{className:`mono`,children:e.version})]}),(0,x.jsx)(`p`,{className:`muted tiny`,children:e.detail})]},e.name))}),(0,x.jsx)(`p`,{className:`muted small`,children:`La app no instala el CLI global: actualizarlo es del usuario. Los procesos que lo usan se reinician al terminar.`})]}):null,O===`diagnostico`?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsxs)(`div`,{className:`settings-row`,children:[(0,x.jsx)(`span`,{children:`Versión`}),(0,x.jsx)(`b`,{className:`mono`,children:m})]}),(0,x.jsxs)(`div`,{className:`settings-row`,children:[(0,x.jsx)(`span`,{children:`Formato del modelo`}),(0,x.jsx)(`b`,{className:`mono`,children:c?.meta.apiVersion??`—`})]}),(0,x.jsxs)(`div`,{className:`settings-row`,children:[(0,x.jsx)(`span`,{children:`Checksum`}),(0,x.jsx)(`b`,{className:`mono`,children:c?.meta.checksum.slice(0,12)||`—`})]}),(0,x.jsxs)(`div`,{className:`settings-row`,children:[(0,x.jsx)(`span`,{children:`Almacenamiento local`}),(0,x.jsx)(`b`,{children:f?`disponible`:`no disponible`})]}),p?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsxs)(`div`,{className:`settings-row`,children:[(0,x.jsx)(`span`,{children:`Vigilancia`}),(0,x.jsx)(`b`,{children:p.state===`live`?`live`:`detenida`})]}),(0,x.jsx)(`p`,{children:(0,x.jsx)(`button`,{type:`button`,className:`button`,onClick:p.onToggle,children:p.state===`live`?`Detener live`:`Activar live`})}),(0,x.jsx)(`p`,{className:`muted small`,children:`Con live, el servidor reanaliza al guardar y el mapa se refresca solo.`})]}):null,(0,x.jsx)(`p`,{className:`muted small`,children:`El checksum es la identidad del análisis: el mismo código da el mismo checksum ✓.`})]}):null]})]})]})]})})}function Ur(e){let t=(e,t,n)=>`${e} ${e===1?t:n}`;return[t(e.profiles.length,`perfil`,`perfiles`),t(e.rules,`regla`,`reglas`),t(e.views.length,`vista`,`vistas`)].join(` · `)}var Wr=`0.3.22`,Gr=`0.3.22`,Kr=`0.3.22`,qr=`0.3.22`,Jr=`0.3.22`,Yr=`0.3.22`;function Xr(e){let t=/^v?(\d+)\.(\d+)\.(\d+)(?:-([0-9A-Za-z.-]+))?$/.exec(e.trim());return t?{major:Number(t[1]),minor:Number(t[2]),patch:Number(t[3]),prerelease:t[4]??null}:null}function Zr(e,t){let n=Xr(e),r=Xr(t);if(!n&&!r)return 0;if(!n)return-1;if(!r)return 1;for(let e of[`major`,`minor`,`patch`])if(n[e]!==r[e])return n[e]<r[e]?-1:1;return Qr(n.prerelease,r.prerelease)}function Qr(e,t){if(e===t)return 0;if(!e)return 1;if(!t)return-1;let n=e.split(`.`),r=t.split(`.`),i=Math.max(n.length,r.length);for(let e=0;e<i;e+=1){let t=n[e],i=r[e];if(t===void 0)return-1;if(i===void 0)return 1;if(t===i)continue;let a=/^\d+$/.test(t),o=/^\d+$/.test(i);return a&&o?Number(t)<Number(i)?-1:1:a?-1:o?1:t<i?-1:1}return 0}function $r(e,t){return Zr(e,t)>0}function ei(e,t){return Xr(t)?$r(e,t):!1}var ti=`https://registry.npmjs.org`,ni=`https://api.github.com`;function ri(e){return/(\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?)$/.exec(e.trim())?.[1]??e.trim().replace(/^v/,``)}async function ii(e,t,n){let r={current:e,latest:null,outdated:!1,source:t,error:null,url:null};try{if(t.kind===`npm`){let i=`${t.registry??ti}/${t.package}/latest`,a=await n(i,{headers:{accept:`application/json`}});if(!a.ok)return{...r,error:`${a.status} en ${i}`};let o=await a.json();return typeof o.version==`string`?{...r,latest:o.version,outdated:ei(o.version,e),url:`https://www.npmjs.com/package/${t.package}`}:{...r,error:`la respuesta de ${i} no trae versión`}}let i=`${ni}/repos/${t.repo}/releases`;if(t.includePrereleases){let a=`${i}?per_page=100`,o=await n(a,{headers:{accept:`application/vnd.github+json`}});if(!o.ok)return{...r,error:`${o.status} en ${a}`};let s=await o.json();if(!Array.isArray(s))return{...r,error:`la respuesta de ${a} no trae releases`};let c=null;for(let e of s){if(typeof e!=`object`||!e)continue;let t=e;if(t.draft===!0||typeof t.tag_name!=`string`)continue;let n=ri(t.tag_name);Xr(n)&&(!c||Zr(n,c.version)>0)&&(c={version:n,url:typeof t.html_url==`string`?t.html_url:null})}return c?{...r,latest:c.version,outdated:ei(c.version,e),url:c.url??`https://github.com/${t.repo}/releases`}:{...r,error:`la respuesta de ${a} no trae versiones`}}let a=`${i}/latest`,o=await n(a,{headers:{accept:`application/vnd.github+json`}});if(!o.ok)return{...r,error:`${o.status} en ${a}`};let s=await o.json();if(typeof s.tag_name!=`string`)return{...r,error:`la respuesta de ${a} no trae etiqueta`};let c=ri(s.tag_name);return{...r,latest:c,outdated:ei(c,e),url:typeof s.html_url==`string`?s.html_url:`https://github.com/${t.repo}/releases`}}catch(e){return{...r,error:e.message}}}var ai=`codarch`,oi=[{name:`Motor`,version:Wr,detail:`El análisis, el modelo y las reglas. Viaja dentro de cada app.`},{name:`CLI`,version:Gr,detail:`Se actualiza con npm; si sirve esta web, manda su versión.`},{name:`Web`,version:qr,detail:`Se recarga al publicar una versión nueva; no se instala.`},{name:`Escritorio`,version:Kr,detail:`Se actualiza con su release y se reinicia al cerrar.`},{name:`MCP`,version:Jr,detail:`Lo lanza el cliente; al actualizarlo, se reinicia el proceso.`},{name:`Docker`,version:Yr,detail:`La imagen de GHCR; se actualiza al bajar la etiqueta nueva.`}],si=Lr(),ci=Rr(),li={async check(e){let t=await ii(e,{kind:`npm`,package:ai},fetch);return{current:t.current,latest:t.latest,outdated:t.outdated,error:t.error,url:t.url}},action:e=>(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(`p`,{className:`muted small`,children:`El CLI se trae con:`}),(0,x.jsxs)(`p`,{className:`mono small`,children:[`npm i -g `,ai,`@latest`]}),e.url?(0,x.jsx)(`p`,{className:`muted small`,children:(0,x.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noreferrer`,children:`Ver en npm`})}):null]}),note:(0,x.jsx)(`p`,{className:`muted small`,children:`Esta web la sirve el CLI: lo que se actualiza es el CLI. La app de escritorio se actualiza con las releases de GitHub.`})};function ui(e){return(0,x.jsx)(Hr,{...e,components:oi,updates:li,webgl2:si,webgpu:ci})}var di=Symbol.for(`yaml.alias`),fi=Symbol.for(`yaml.document`),pi=Symbol.for(`yaml.map`),mi=Symbol.for(`yaml.pair`),hi=Symbol.for(`yaml.scalar`),gi=Symbol.for(`yaml.seq`),_i=Symbol.for(`yaml.node.type`),vi=e=>!!e&&typeof e==`object`&&e[_i]===di,yi=e=>!!e&&typeof e==`object`&&e[_i]===fi,bi=e=>!!e&&typeof e==`object`&&e[_i]===pi,B=e=>!!e&&typeof e==`object`&&e[_i]===mi,xi=e=>!!e&&typeof e==`object`&&e[_i]===hi,Si=e=>!!e&&typeof e==`object`&&e[_i]===gi;function Ci(e){if(e&&typeof e==`object`)switch(e[_i]){case pi:case gi:return!0}return!1}function wi(e){if(e&&typeof e==`object`)switch(e[_i]){case di:case pi:case hi:case gi:return!0}return!1}var Ti=e=>(xi(e)||Ci(e))&&!!e.anchor,Ei=Symbol(`break visit`),Di=Symbol(`skip children`),Oi=Symbol(`remove node`);function ki(e,t){let n=ji(t);yi(e)?Ai(null,e.contents,n,Object.freeze([e]))===Oi&&(e.contents=null):Ai(null,e,n,Object.freeze([]))}ki.BREAK=Ei,ki.SKIP=Di,ki.REMOVE=Oi;function Ai(e,t,n,r){let i=Mi(e,t,n,r);if(wi(i)||B(i))return Ni(e,r,i),Ai(e,i,n,r);if(typeof i!=`symbol`){if(Ci(t)){r=Object.freeze(r.concat(t));for(let e=0;e<t.items.length;++e){let i=Ai(e,t.items[e],n,r);if(typeof i==`number`)e=i-1;else if(i===Ei)return Ei;else i===Oi&&(t.items.splice(e,1),--e)}}else if(B(t)){r=Object.freeze(r.concat(t));let e=Ai(`key`,t.key,n,r);if(e===Ei)return Ei;e===Oi&&(t.key=null);let i=Ai(`value`,t.value,n,r);if(i===Ei)return Ei;i===Oi&&(t.value=null)}}return i}function ji(e){return typeof e==`object`&&(e.Collection||e.Node||e.Value)?Object.assign({Alias:e.Node,Map:e.Node,Scalar:e.Node,Seq:e.Node},e.Value&&{Map:e.Value,Scalar:e.Value,Seq:e.Value},e.Collection&&{Map:e.Collection,Seq:e.Collection},e):e}function Mi(e,t,n,r){if(typeof n==`function`)return n(e,t,r);if(bi(t))return n.Map?.(e,t,r);if(Si(t))return n.Seq?.(e,t,r);if(B(t))return n.Pair?.(e,t,r);if(xi(t))return n.Scalar?.(e,t,r);if(vi(t))return n.Alias?.(e,t,r)}function Ni(e,t,n){let r=t[t.length-1];if(Ci(r))r.items[e]=n;else if(B(r))e===`key`?r.key=n:r.value=n;else if(yi(r))r.contents=n;else{let e=vi(r)?`alias`:`scalar`;throw Error(`Cannot replace node with ${e} parent`)}}function Pi(e){if(/[\x00-\x19\s,[\]{}]/.test(e)){let t=`Anchor must not contain whitespace or control characters: ${JSON.stringify(e)}`;throw Error(t)}return!0}function Fi(e,t,n,r){if(r&&typeof r==`object`){if(Array.isArray(r))for(let t=0,n=r.length;t<n;++t){let n=r[t],i=Fi(e,r,String(t),n);i===void 0?delete r[t]:i!==n&&(r[t]=i)}else if(r instanceof Map)for(let t of Array.from(r.keys())){let n=r.get(t),i=Fi(e,r,t,n);i===void 0?r.delete(t):i!==n&&r.set(t,i)}else if(r instanceof Set)for(let t of Array.from(r)){let n=Fi(e,r,t,t);n===void 0?r.delete(t):n!==t&&(r.delete(t),r.add(n))}else for(let[t,n]of Object.entries(r)){let i=Fi(e,r,t,n);i===void 0?delete r[t]:i!==n&&(r[t]=i)}}return e.call(t,n,r)}function Ii(e,t,n){if(Array.isArray(e))return e.map((e,t)=>Ii(e,String(t),n));if(e&&typeof e.toJSON==`function`){if(!n||!Ti(e))return e.toJSON(t,n);let r={aliasCount:0,count:1,res:void 0};n.anchors.set(e,r),n.onCreate=e=>{r.res=e,delete n.onCreate};let i=e.toJSON(t,n);return n.onCreate&&n.onCreate(i),i}return typeof e==`bigint`&&!n?.keep?Number(e):e}var Li=class{constructor(e){Object.defineProperty(this,_i,{value:e})}clone(){let e=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return this.range&&(e.range=this.range.slice()),e}toJS(e,{mapAsMap:t,maxAliasCount:n,onAnchor:r,reviver:i}={}){if(!yi(e))throw TypeError(`A document argument is required`);let a={anchors:new Map,doc:e,keep:!0,mapAsMap:t===!0,mapKeyWarned:!1,maxAliasCount:typeof n==`number`?n:100},o=Ii(this,``,a);if(typeof r==`function`)for(let{count:e,res:t}of a.anchors.values())r(t,e);return typeof i==`function`?Fi(i,{"":o},``,o):o}},Ri=class extends Li{constructor(e){super(di),this.source=e,Object.defineProperty(this,"tag",{set(){throw Error(`Alias nodes cannot have tags`)}})}resolve(e,t){if(t?.maxAliasCount===0)throw ReferenceError(`Alias resolution is disabled`);let n;t?.aliasResolveCache?n=t.aliasResolveCache:(n=[],ki(e,{Node:(e,t)=>{(vi(t)||Ti(t))&&n.push(t)}}),t&&(t.aliasResolveCache=n));let r;for(let e of n){if(e===this)break;e.anchor===this.source&&(r=e)}if(r&&t){let{anchors:e,doc:n,maxAliasCount:i}=t,a=e.get(r);if(a||=(Ii(r,null,t),e.get(r)),a?.res===void 0)throw ReferenceError(`This should not happen: Alias anchor was not resolved?`);if(i>=0&&(a.count+=1,a.aliasCount===0&&(a.aliasCount=zi(n,r,e)),a.count*a.aliasCount>i))throw ReferenceError(`Excessive alias count indicates a resource exhaustion attack`)}return r}toJSON(e,t){if(!t)return{source:this.source};let n=this.resolve(t.doc,t);if(!n){let e=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw ReferenceError(e)}return t.anchors.get(n).res}toString(e,t,n){let r=`*${this.source}`;if(e){if(Pi(this.source),e.options.verifyAliasOrder&&!e.anchors.has(this.source)){let e=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw Error(e)}if(e.implicitKey)return`${r} `}return r}};function zi(e,t,n){if(vi(t)){let r=t.resolve(e),i=n&&r&&n.get(r);return i?i.count*i.aliasCount:0}if(Ci(t)){let r=0;for(let i of t.items){let t=zi(e,i,n);t>r&&(r=t)}return r}if(B(t)){let r=zi(e,t.key,n),i=zi(e,t.value,n);return Math.max(r,i)}return 1}var Bi=e=>!e||typeof e!=`function`&&typeof e!=`object`,V=class extends Li{constructor(e){super(hi),this.value=e}toJSON(e,t){return t?.keep?this.value:Ii(this.value,e,t)}toString(){return String(this.value)}};V.BLOCK_FOLDED=`BLOCK_FOLDED`,V.BLOCK_LITERAL=`BLOCK_LITERAL`,V.PLAIN=`PLAIN`,V.QUOTE_DOUBLE=`QUOTE_DOUBLE`,V.QUOTE_SINGLE=`QUOTE_SINGLE`;var Vi=`tag:yaml.org,2002:`;function Hi(e,t,n){if(t){let e=n.filter(e=>e.tag===t),r=e.find(e=>!e.format)??e[0];if(!r)throw Error(`Tag ${t} not found`);return r}return n.find(t=>t.identify?.(e)&&!t.format)}function Ui(e,t,n){if(yi(e)&&(e=e.contents),wi(e))return e;if(B(e)){let t=n.schema[pi].createNode?.(n.schema,null,n);return t.items.push(e),t}(e instanceof String||e instanceof Number||e instanceof Boolean||typeof BigInt<`u`&&e instanceof BigInt)&&(e=e.valueOf());let{aliasDuplicateObjects:r,onAnchor:i,onTagObj:a,schema:o,sourceObjects:s}=n,c;if(r&&e&&typeof e==`object`){if(c=s.get(e),c)return c.anchor??(c.anchor=i(e)),new Ri(c.anchor);c={anchor:null,node:null},s.set(e,c)}t?.startsWith(`!!`)&&(t=Vi+t.slice(2));let l=Hi(e,t,o.tags);if(!l){if(e&&typeof e.toJSON==`function`&&(e=e.toJSON()),!e||typeof e!=`object`){let t=new V(e);return c&&(c.node=t),t}l=e instanceof Map?o[pi]:Symbol.iterator in Object(e)?o[gi]:o[pi]}a&&(a(l),delete n.onTagObj);let u=l?.createNode?l.createNode(n.schema,e,n):typeof l?.nodeClass?.from==`function`?l.nodeClass.from(n.schema,e,n):new V(e);return t?u.tag=t:l.default||(u.tag=l.tag),c&&(c.node=u),u}function Wi(e,t,n){let r=n;for(let e=t.length-1;e>=0;--e){let n=t[e];if(typeof n==`number`&&Number.isInteger(n)&&n>=0){let e=[];e[n]=r,r=e}else r=new Map([[n,r]])}return Ui(r,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw Error(`This should not happen, please report a bug.`)},schema:e,sourceObjects:new Map})}var Gi=e=>e==null||typeof e==`object`&&!!e[Symbol.iterator]().next().done,Ki=class extends Li{constructor(e,t){super(e),Object.defineProperty(this,"schema",{value:t,configurable:!0,enumerable:!1,writable:!0})}clone(e){let t=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return e&&(t.schema=e),t.items=t.items.map(t=>wi(t)||B(t)?t.clone(e):t),this.range&&(t.range=this.range.slice()),t}addIn(e,t){if(Gi(e))this.add(t);else{let[n,...r]=e,i=this.get(n,!0);if(Ci(i))i.addIn(r,t);else if(i===void 0&&this.schema)this.set(n,Wi(this.schema,r,t));else throw Error(`Expected YAML collection at ${n}. Remaining path: ${r}`)}}deleteIn(e){let[t,...n]=e;if(n.length===0)return this.delete(t);let r=this.get(t,!0);if(Ci(r))return r.deleteIn(n);throw Error(`Expected YAML collection at ${t}. Remaining path: ${n}`)}getIn(e,t){let[n,...r]=e,i=this.get(n,!0);return r.length===0?!t&&xi(i)?i.value:i:Ci(i)?i.getIn(r,t):void 0}hasAllNullValues(e){return this.items.every(t=>{if(!B(t))return!1;let n=t.value;return n==null||e&&xi(n)&&n.value==null&&!n.commentBefore&&!n.comment&&!n.tag})}hasIn(e){let[t,...n]=e;if(n.length===0)return this.has(t);let r=this.get(t,!0);return Ci(r)?r.hasIn(n):!1}setIn(e,t){let[n,...r]=e;if(r.length===0)this.set(n,t);else{let e=this.get(n,!0);if(Ci(e))e.setIn(r,t);else if(e===void 0&&this.schema)this.set(n,Wi(this.schema,r,t));else throw Error(`Expected YAML collection at ${n}. Remaining path: ${r}`)}}},qi=e=>e.replace(/^(?!$)(?: $)?/gm,`#`);function Ji(e,t){return/^\n+$/.test(e)?e.substring(1):t?e.replace(/^(?! *$)/gm,t):e}var Yi=(e,t,n)=>e.endsWith(`
51
51
  `)?Ji(n,t):n.includes(`
52
52
  `)?`
53
53
  `+Ji(n,t):(e.endsWith(` `)?``:` `)+n,Xi=`flow`,Zi=`block`,Qi=`quoted`;function $i(e,t,n=`flow`,{indentAtStart:r,lineWidth:i=80,minContentWidth:a=20,onFold:o,onOverflow:s}={}){if(!i||i<0)return e;i<a&&(a=0);let c=Math.max(1+a,1+i-t.length);if(e.length<=c)return e;let l=[],u={},d=i-t.length;typeof r==`number`&&(r>i-Math.max(2,a)?l.push(0):d=i-r);let f,p,m=!1,h=-1,g=-1,_=-1;n===`block`&&(h=ea(e,h,t.length),h!==-1&&(d=h+c));for(let r;r=e[h+=1];){if(n===`quoted`&&r===`\\`){switch(g=h,e[h+1]){case`x`:h+=3;break;case`u`:h+=5;break;case`U`:h+=9;break;default:h+=1}_=h}if(r===`
@@ -82,4 +82,4 @@ $&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,`$1$2`).replace(/\
82
82
  `}}return e?(p+=`
83
83
  `+Ji(l(e),c),s&&s()):d&&o&&o(),p}function Da({items:e},t,{flowChars:n,itemIndent:r}){let{indent:i,indentStep:a,flowCollectionPadding:o,options:{commentString:s}}=t;r+=a;let c=Object.assign({},t,{indent:r,inFlow:!0,type:null}),l=!1,u=0,d=[];for(let n=0;n<e.length;++n){let i=e[n],a=null;if(wi(i))i.spaceBefore&&d.push(``),Oa(t,d,i.commentBefore,!1),i.comment&&(a=i.comment);else if(B(i)){let e=wi(i.key)?i.key:null;e&&(e.spaceBefore&&d.push(``),Oa(t,d,e.commentBefore,!1),e.comment&&(l=!0));let n=wi(i.value)?i.value:null;n?(n.comment&&(a=n.comment),n.commentBefore&&(l=!0)):i.value==null&&e?.comment&&(a=e.comment)}a&&(l=!0);let o=fa(i,c,()=>a=null);l||=d.length>u||o.includes(`
84
84
  `),n<e.length-1?o+=`,`:t.options.trailingComma&&(t.options.lineWidth>0&&(l||=d.reduce((e,t)=>e+t.length+2,2)+(o.length+2)>t.options.lineWidth),l&&(o+=`,`)),a&&(o+=Yi(o,r,s(a))),d.push(o),u=d.length}let{start:f,end:p}=n;if(d.length===0)return f+p;if(!l){let e=d.reduce((e,t)=>e+t.length+2,2);l=t.options.lineWidth>0&&e>t.options.lineWidth}if(l){let e=f;for(let t of d)e+=t?`\n${a}${i}${t}`:`
85
- `;return`${e}\n${i}${p}`}return`${f}${o}${d.join(` `)}${o}${p}`}function Oa({indent:e,options:{commentString:t}},n,r,i){if(r&&i&&(r=r.replace(/^\n+/,``)),r){let i=Ji(t(r),e);n.push(i.trimStart())}}function ka(e,t){let n=xi(t)?t.value:t;for(let r of e)if(B(r)&&(r.key===t||r.key===n||xi(r.key)&&r.key.value===n))return r}var Aa=class extends Ki{static get tagName(){return`tag:yaml.org,2002:map`}constructor(e){super(pi,e),this.items=[]}static from(e,t,n){let{keepUndefined:r,replacer:i}=n,a=new this(e),o=(e,o)=>{if(typeof i==`function`)o=i.call(t,e,o);else if(Array.isArray(i)&&!i.includes(e))return;(o!==void 0||r)&&a.items.push(Ca(e,o,n))};if(t instanceof Map)for(let[e,n]of t)o(e,n);else if(t&&typeof t==`object`)for(let e of Object.keys(t))o(e,t[e]);return typeof e.sortMapEntries==`function`&&a.items.sort(e.sortMapEntries),a}add(e,t){let n;n=B(e)?e:!e||typeof e!=`object`||!(`key`in e)?new wa(e,e?.value):new wa(e.key,e.value);let r=ka(this.items,n.key),i=this.schema?.sortMapEntries;if(r){if(!t)throw Error(`Key ${n.key} already set`);xi(r.value)&&Bi(n.value)?r.value.value=n.value:r.value=n.value}else if(i){let e=this.items.findIndex(e=>i(n,e)<0);e===-1?this.items.push(n):this.items.splice(e,0,n)}else this.items.push(n)}delete(e){let t=ka(this.items,e);return t?this.items.splice(this.items.indexOf(t),1).length>0:!1}get(e,t){let n=ka(this.items,e)?.value;return(!t&&xi(n)?n.value:n)??void 0}has(e){return!!ka(this.items,e)}set(e,t){this.add(new wa(e,t),!0)}toJSON(e,t,n){let r=n?new n:t?.mapAsMap?new Map:{};t?.onCreate&&t.onCreate(r);for(let e of this.items)xa(t,r,e);return r}toString(e,t,n){if(!e)return JSON.stringify(this);for(let e of this.items)if(!B(e))throw Error(`Map items must all be pairs; found ${JSON.stringify(e)} instead`);return!e.allNullValues&&this.hasAllNullValues(!1)&&(e=Object.assign({},e,{allNullValues:!0})),Ta(this,e,{blockItemPrefix:``,flowChars:{start:`{`,end:`}`},itemIndent:e.indent||``,onChompKeep:n,onComment:t})}},ja={collection:`map`,default:!0,nodeClass:Aa,tag:`tag:yaml.org,2002:map`,resolve(e,t){return bi(e)||t(`Expected a mapping for this tag`),e},createNode:(e,t,n)=>Aa.from(e,t,n)},Ma=class extends Ki{static get tagName(){return`tag:yaml.org,2002:seq`}constructor(e){super(gi,e),this.items=[]}add(e){this.items.push(e)}delete(e){let t=Na(e);return typeof t==`number`&&this.items.splice(t,1).length>0}get(e,t){let n=Na(e);if(typeof n!=`number`)return;let r=this.items[n];return!t&&xi(r)?r.value:r}has(e){let t=Na(e);return typeof t==`number`&&t<this.items.length}set(e,t){let n=Na(e);if(typeof n!=`number`)throw Error(`Expected a valid index, not ${e}.`);let r=this.items[n];xi(r)&&Bi(t)?r.value=t:this.items[n]=t}toJSON(e,t){let n=[];t?.onCreate&&t.onCreate(n);let r=0;for(let e of this.items)n.push(Ii(e,String(r++),t));return n}toString(e,t,n){return e?Ta(this,e,{blockItemPrefix:`- `,flowChars:{start:`[`,end:`]`},itemIndent:(e.indent||``)+` `,onChompKeep:n,onComment:t}):JSON.stringify(this)}static from(e,t,n){let{replacer:r}=n,i=new this(e);if(t&&Symbol.iterator in Object(t)){let e=0;for(let a of t){if(typeof r==`function`){let n=t instanceof Set?a:String(e++);a=r.call(t,n,a)}i.items.push(Ui(a,void 0,n))}}return i}};function Na(e){let t=xi(e)?e.value:e;return t&&typeof t==`string`&&(t=Number(t)),typeof t==`number`&&Number.isInteger(t)&&t>=0?t:null}var Pa={collection:`seq`,default:!0,nodeClass:Ma,tag:`tag:yaml.org,2002:seq`,resolve(e,t){return Si(e)||t(`Expected a sequence for this tag`),e},createNode:(e,t,n)=>Ma.from(e,t,n)};function Fa(e){return typeof e==`bigint`||Number.isInteger(e)}var Ia=({value:e})=>JSON.stringify(e),La=[{identify:e=>typeof e==`string`,default:!0,tag:`tag:yaml.org,2002:str`,resolve:e=>e,stringify:Ia},{identify:e=>e==null,createNode:()=>new V(null),default:!0,tag:`tag:yaml.org,2002:null`,test:/^null$/,resolve:()=>null,stringify:Ia},{identify:e=>typeof e==`boolean`,default:!0,tag:`tag:yaml.org,2002:bool`,test:/^true$|^false$/,resolve:e=>e===`true`,stringify:Ia},{identify:Fa,default:!0,tag:`tag:yaml.org,2002:int`,test:/^-?(?:0|[1-9][0-9]*)$/,resolve:(e,t,{intAsBigInt:n})=>n?BigInt(e):parseInt(e,10),stringify:({value:e})=>Fa(e)?e.toString():JSON.stringify(e)},{identify:e=>typeof e==`number`,default:!0,tag:`tag:yaml.org,2002:float`,test:/^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,resolve:e=>parseFloat(e),stringify:Ia}];[ja,Pa].concat(La,{default:!0,tag:``,test:/^/,resolve(e,t){return t(`Unresolved plain scalar ${JSON.stringify(e)}`),e}});function Ra(e,t,n){let{replacer:r}=n,i=new Ma(e);i.tag=`tag:yaml.org,2002:pairs`;let a=0;if(t&&Symbol.iterator in Object(t))for(let e of t){typeof r==`function`&&(e=r.call(t,String(a++),e));let o,s;if(Array.isArray(e)){if(e.length===2)o=e[0],s=e[1];else throw TypeError(`Expected [key, value] tuple: ${e}`)}else if(e&&e instanceof Object){let t=Object.keys(e);if(t.length===1)o=t[0],s=e[o];else throw TypeError(`Expected tuple with one key, not ${t.length} keys`)}else o=e;i.items.push(Ca(o,s,n))}return i}var za=class e extends Ma{constructor(){super(),this.add=Aa.prototype.add.bind(this),this.delete=Aa.prototype.delete.bind(this),this.get=Aa.prototype.get.bind(this),this.has=Aa.prototype.has.bind(this),this.set=Aa.prototype.set.bind(this),this.tag=e.tag}toJSON(e,t){if(!t)return super.toJSON(e);let n=new Map;t?.onCreate&&t.onCreate(n);for(let e of this.items){let r,i;if(B(e)?(r=Ii(e.key,``,t),i=Ii(e.value,r,t)):r=Ii(e,``,t),n.has(r))throw Error(`Ordered maps must not include duplicate keys`);n.set(r,i)}return n}static from(e,t,n){let r=Ra(e,t,n),i=new this;return i.items=r.items,i}};za.tag=`tag:yaml.org,2002:omap`;var Ba=class e extends Aa{constructor(t){super(t),this.tag=e.tag}add(e){let t;t=B(e)?e:e&&typeof e==`object`&&`key`in e&&`value`in e&&e.value===null?new wa(e.key,null):new wa(e,null),ka(this.items,t.key)||this.items.push(t)}get(e,t){let n=ka(this.items,e);return!t&&B(n)?xi(n.key)?n.key.value:n.key:n}set(e,t){if(typeof t!=`boolean`)throw Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof t}`);let n=ka(this.items,e);n&&!t?this.items.splice(this.items.indexOf(n),1):!n&&t&&this.items.push(new wa(e))}toJSON(e,t){return super.toJSON(e,t,Set)}toString(e,t,n){if(!e)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},e,{allNullValues:!0}),t,n);throw Error(`Set items must all have null values`)}static from(e,t,n){let{replacer:r}=n,i=new this(e);if(t&&Symbol.iterator in Object(t))for(let e of t)typeof r==`function`&&(e=r.call(t,e,e)),i.items.push(Ca(e,null,n));return i}};Ba.tag=`tag:yaml.org,2002:set`;var Va=Symbol(`break visit`),Ha=Symbol(`skip children`),Ua=Symbol(`remove item`);function Wa(e,t){`type`in e&&e.type===`document`&&(e={start:e.start,value:e.value}),Ga(Object.freeze([]),e,t)}Wa.BREAK=Va,Wa.SKIP=Ha,Wa.REMOVE=Ua,Wa.itemAtPath=(e,t)=>{let n=e;for(let[e,r]of t){let t=n?.[e];if(t&&`items`in t)n=t.items[r];else return}return n},Wa.parentCollection=(e,t)=>{let n=Wa.itemAtPath(e,t.slice(0,-1)),r=t[t.length-1][0],i=n?.[r];if(i&&`items`in i)return i;throw Error(`Parent collection not found`)};function Ga(e,t,n){let r=n(t,e);if(typeof r==`symbol`)return r;for(let i of[`key`,`value`]){let a=t[i];if(a&&`items`in a){for(let t=0;t<a.items.length;++t){let r=Ga(Object.freeze(e.concat([[i,t]])),a.items[t],n);if(typeof r==`number`)t=r-1;else if(r===Va)return Va;else r===Ua&&(a.items.splice(t,1),--t)}typeof r==`function`&&i===`key`&&(r=r(t,e))}}return typeof r==`function`?r(t,e):r}var Ka=[`maxComplexity`,`max_complexity_per_function`,`complexity`,`logic_complexity`,`sonar_cognitive_complexity`],qa=[`number_of_commits`,`number_of_authors`,`number_of_renames`],Ja={complexity:.5,churn:.32,size:.18},Ya=1.7;function Xa(e){let t=eo(e.map(e=>e.complexity).filter(e=>e>0),.95),n=eo(e.map(e=>e.churn).filter(e=>e>0),.95),r=eo(e.map(e=>e.size).filter(e=>e>0),.95),i=t>0?Ja.complexity:0,a=n>0?Ja.churn:0,o=r>0?Ja.size:0,s=i+a+o,c=s>0?{complexity:i/s,churn:a/s,size:o/s}:{complexity:0,churn:0,size:0};return e.map(e=>{let i=Za(e.complexity,t,c.complexity),a=Za(e.churn,n,c.churn),o=Za(e.size,r,c.size);return{risk:to(i.share+a.share+o.share)**+Ya,parts:{complexity:i,churn:a,size:o}}})}function Za(e,t,n){let r=$a(e,t);return{value:e,p95:t,norm:r,weight:n,share:r*n}}function Qa(e,t){let n=e instanceof Set?e:new Set(e);for(let e of t)if(n.has(e))return e;return null}function $a(e,t){return t>0?to(e/t):0}function eo(e,t){if(e.length===0)return 0;let n=[...e].sort((e,t)=>e-t);return n[Math.min(n.length-1,Math.max(0,Math.floor((n.length-1)*t)))]??0}function to(e){return Number.isFinite(e)?Math.max(0,Math.min(1,e)):0}var no=new Set([`1.0`,`1.1`,`1.2`,`1.3`,`1.3`]);function ro(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function io(e){if(!ro(e))return null;let t=e.schemaVersion;if(typeof t!=`string`||!no.has(t))return null;let n=e.files,r=e.rules,i=e.cycles;if(!ro(e.summary)||!ro(e.base)||!ro(e.head)||!ro(n)||!Array.isArray(n.added)||!Array.isArray(n.removed)||!Array.isArray(n.changed)||!ro(r)||typeof r.configured!=`boolean`||!ro(r.summary)||!ro(r.violations)||!Array.isArray(r.violations.introduced)||!Array.isArray(r.violations.existing)||!Array.isArray(r.violations.resolved)||!ro(i)||!Array.isArray(i.introduced)||!Array.isArray(i.fixed)||!Array.isArray(e.hotspots))return null;let a=e;return t===`1.3`?a:{...a,schemaVersion:`1.3`,migration:a.migration??null,symbols:a.symbols??null,rules:{...a.rules,profile:a.rules?.profile??null,violations:{introduced:(a.rules?.violations?.introduced??[]).map(ao),existing:(a.rules?.violations?.existing??[]).map(ao),resolved:(a.rules?.violations?.resolved??[]).map(ao)}}}}function ao(e){return{...e,source:e.source??`config`}}function oo(e){return io(e)}function so(e){let t=e?.lenses?.migration;if(!t||typeof t!=`object`)return null;let n=t;return!n.nodes||!n.summary?null:n}var co=class extends Error{path;constructor(e,t){super(`${e} (en ${t})`),this.name=`CcJsonError`,this.path=t}};function lo(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function uo(e,t){if(!lo(e))throw new co(`se esperaba un objeto`,t);return e}function fo(e,t,n){if(typeof e!=`string`||e.length===0)throw new co(`"${n}" debe ser una cadena no vacía`,t);return e}var po=512;function mo(e){if(!lo(e))throw new co(`se esperaba un objeto`,`$`);let t=uo(e.meta,`$.meta`),n=fo(t.apiVersion,`$.meta.apiVersion`,`apiVersion`);if(!n.startsWith(`2.`))throw new co(`apiVersion "${n}" no soportada (se espera 2.x)`,`$.meta.apiVersion`);let r=e.files;if(r===void 0)throw new co(`falta "files"`,`$`);let i=Array.isArray(r)?r:[r];if(i.length===0)throw new co(`el árbol está vacío`,`$.files`);let a=new Set,o=(e,t,n)=>{if(n>po)throw new co(`profundidad máxima ${po} superada`,t);let r=uo(e,t),i=fo(r.id,`${t}.id`,`id`);if(a.has(i))throw new co(`id duplicado "${i}"`,`${t}.id`);a.add(i);let s=fo(r.name,`${t}.name`,`name`),c=r.type;if(c!==`File`&&c!==`Folder`)throw new co(`"type" debe ser "File" o "Folder"`,`${t}.type`);let l={id:i,name:s,type:c};if(typeof r.contentHash==`string`&&(l.contentHash=r.contentHash),typeof r.link==`string`&&(l.link=r.link),r.children!==void 0){if(!Array.isArray(r.children))throw new co(`"children" debe ser un array`,`${t}.children`);l.children=r.children.map((e,r)=>o(e,`${t}.children[${r}]`,n+1))}return l},s=i.map((e,t)=>o(e,`$.files[${t}]`,0)),c=e.lenses;if(c!==void 0){let e=uo(c,`$.lenses`);if(e.metrics!==void 0){let t=uo(uo(e.metrics,`$.lenses.metrics`).attributes,`$.lenses.metrics.attributes`);for(let[e,n]of Object.entries(t)){let t=uo(n,`$.lenses.metrics.attributes["${e}"]`);for(let[n,r]of Object.entries(t))if(typeof r!=`number`||!Number.isFinite(r))throw new co(`la métrica "${n}" debe ser un número finito`,`$.lenses.metrics.attributes["${e}"].${n}`)}}if(e.dependency!==void 0){let t=uo(e.dependency,`$.lenses.dependency`);if(t.edges!==void 0){if(!Array.isArray(t.edges))throw new co(`"edges" debe ser un array`,`$.lenses.dependency.edges`);t.edges.forEach((e,t)=>{let n=`$.lenses.dependency.edges[${t}]`,r=uo(e,n);fo(r.fromId,`${n}.fromId`,`fromId`),fo(r.toId,`${n}.toId`,`toId`)})}}}return{meta:{...t,apiVersion:n},files:s,...c===void 0?{}:{lenses:c}}}function ho(e,t){let n=e.map(e=>({node:e,path:e.name,depth:0})).reverse();for(;n.length>0;){let e=n.pop();t(e);let r=e.node.children;if(r&&r.length!==0)for(let t=r.length-1;t>=0;t--){let i=r[t];n.push({node:i,path:`${e.path}/${i.name}`,depth:e.depth+1})}}}function go(e,t){ho(e,e=>{e.node.type===`File`&&t(e)})}function _o(e){let t=new Map;return ho(e,e=>t.set(e.node.id,e.path)),t}function vo(e){let t=0,n=0,r=0;ho(e.files,e=>{r=Math.max(r,e.depth),e.node.type===`File`?t++:n++});let i=new Map,a=e.lenses?.metrics?.attributes??{};for(let e of Object.values(a))for(let t of Object.keys(e))i.set(t,(i.get(t)??0)+1);let o=new Set(_o(e.files).keys()),s=0;for(let e of Object.keys(a))o.has(e)||s++;let c=e.lenses?.dependency;return{files:t,folders:n,maxDepth:r,lenses:Object.keys(e.lenses??{}),metricNames:i.size,metricCoverage:[...i.entries()].map(([e,t])=>({name:e,files:t})).sort((e,t)=>t.files-e.files||e.name.localeCompare(t.name)),edges:c?.edges?.length??0,leafEdges:c?.leafEdges?.length??0,orphanMetricNodes:s}}function yo(e){return e.metricCoverage.some(e=>e.name===`rloc`)?`rloc`:e.metricCoverage[0]?.name}function bo(e){return e.lenses?.symbols??null}function xo(e,t){let n=bo(e)?.nodes[t];return!n||n.length===0?[]:[...n].sort((e,t)=>(t.complexity??-1)-(e.complexity??-1)||e.line-t.line)}new TextEncoder;var So={value:0,p95:0,norm:0,weight:0,share:0},Co={complexity:So,churn:So,size:So},wo=class extends Error{constructor(e){super(e),this.name=`RenderError`}},To=[`#b9c4d0`,`#c9b8a8`,`#a9bfae`,`#c4b6c9`,`#c9c2a6`,`#d5d2ca`,`#c2c8d0`,`#d6c6bd`,`#b7c6c2`,`#cbbfb0`,`#bcc3b9`,`#cfc6c9`],Eo=[`rloc`,`maxComplexity`,`max_complexity_per_function`,`complexity`,`functions`,`number_of_functions`,`maxFunctionLength`,`loc`,`imports`,`externalImports`,`builtinImports`,`typeOnlyImports`,`unresolvedImports`,`fanIn`,`fanOut`,`inCycle`,`cycleSize`,`dependencyLevel`,`migrationDebt`,`ffiCrossings`,`number_of_commits`,`number_of_authors`,`incoming_dependencies`,`outgoing_dependencies`];function Do(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Oo(e,t){if(!t||!e)return;let n=e[t];return typeof n==`number`&&Number.isFinite(n)?n:void 0}function ko(e,t){if(e.length===0)return 0;let n=[...e].sort((e,t)=>e-t);return n[Math.min(n.length-1,Math.max(0,Math.floor((n.length-1)*t)))]??0}function Ao(e){let t=2166136261;for(let n=0;n<e.length;n++)t^=e.charCodeAt(n),t=Math.imul(t,16777619);return t>>>0}function jo(e){let t=e.split(`/`).filter(Boolean).slice(0,-1);return t.length===0?`(raíz)`:t.length===1?t[0]:t.slice(0,3).join(`/`)}function Mo(e){if(!Array.isArray(e))return[];let t=[];for(let n of e)Do(n)&&typeof n.fromId==`string`&&typeof n.toId==`string`&&t.push({fromId:n.fromId,toId:n.toId,...n.isCyclic===!0?{isCyclic:!0}:{}});return t}function No(e,t){let n=e?.[t];return Do(n)&&typeof n.title==`string`&&n.title?n.title:t}function Po(e,t){let n=e?.[t];return Do(n)&&typeof n.direction==`number`?n.direction:0}function Fo(e,t={}){let n=vo(e),r=new Set(n.metricCoverage.map(e=>e.name)),i=e.lenses?.metrics?.attributes??{},a=e.lenses?.metrics?.attributeDescriptors,o;if(t.areaMetric){if(!r.has(t.areaMetric))throw new wo(`la métrica de área "${t.areaMetric}" no existe en este cc.json`);o=t.areaMetric}else o=yo(n)??null;let s=Qa(r,Ka),c=Qa(r,qa),l=[],u=e=>{e&&r.has(e)&&!l.includes(e)&&l.push(e)};for(let e of Eo)u(e);u(o),u(s),u(c),t.color&&t.color!==`risk`&&t.color!==`structure`&&u(t.color);let d=e.files.length===1&&e.files[0]?.type===`Folder`?e.files[0]:null,f=d?`${d.name}/`:``,p=d?.name??``,m=[],h=[],g=new Map;if(go(e.files,e=>{let t=e.path,n=f&&t.startsWith(f)?t.slice(f.length):t,r=i[e.node.id],a=Oo(r,o),l=h.length;g.set(e.node.id,l),h.push({index:l,nodeId:e.node.id,path:n,name:e.node.name,section:-1,area:Math.max(1,a??0),actualArea:a??0,risk:0,riskParts:Co,complexity:Oo(r,s)??0,churn:Oo(r,c)??0,values:[]})}),o&&h.length>0){let e=h.filter(e=>e.actualArea===0).length;e>0&&m.push(`${e} ficheros sin "${o}"; se dibujan con área mínima para no desaparecer`),!t.areaMetric&&o!==`rloc`&&m.push(`"rloc" no está presente; se usa "${o}" como área`)}let _=Xa(h.map(e=>({complexity:e.complexity,churn:e.churn,size:e.actualArea})));for(let[e,t]of h.entries()){let n=_[e];n&&(t.risk=n.risk,t.riskParts=n.parts)}let v=new Map;for(let e of h){let t=jo(e.path),n=v.get(t)??{files:0,area:0};n.files++,n.area+=e.actualArea,v.set(t,n)}let y=[...v.entries()].map(([e,t])=>({key:e,label:e,files:t.files,area:t.area,color:To[Ao(e)%To.length]})).sort((e,t)=>t.area-e.area||e.key.localeCompare(t.key)),b=new Map(y.map((e,t)=>[e.key,t]));for(let e of h)e.section=b.get(jo(e.path))??0;let x=l.map(e=>{let t=h.map(t=>Oo(i[t.nodeId],e)).filter(e=>e!==void 0),n=t.length>0?Math.min(...t):0,r=t.length>0?Math.max(...t):0,o=ko(t,.95),s=n>=0&&o>0&&r>o*4,c=s?r:o>0?o:r;return{key:e,title:No(a,e),direction:Po(a,e),min:n,max:c,actualMax:r,p95:o,mode:s?`log`:`linear`,coverage:t.length}});for(let e of h){let t=i[e.nodeId];e.values=x.map(e=>Oo(t,e.key)??null)}let S=Io(e,d,g,h),C=Lo(S),w=e.lenses?.dependency,T=Mo(w?.leafEdges),E=T.length>0?T:Mo(w?.edges),D=new Set,O=[],k=h.length;for(let e of E){let t=g.get(e.fromId),n=g.get(e.toId);if(t===void 0||n===void 0||t===n)continue;let r=t*k+n;if(!D.has(r)&&(D.add(r),O.push({from:t,to:n}),O.length>=2e4)){m.push(`se han limitado las dependencias a 20.000 aristas`);break}}O.sort((e,t)=>e.from-t.from||e.to-t.to);let A=new Set;for(let e of E){if(e.isCyclic!==!0)continue;let t=g.get(e.fromId),n=g.get(e.toId);t!==void 0&&n!==void 0&&A.add(t*k+n)}let ee=new Set,te=[];for(let e of O){let t=e.from*k+e.to;A.has(t)&&!ee.has(t)&&(ee.add(t),te.push(e))}te.sort((e,t)=>e.from-t.from||e.to-t.to),E.length===0&&m.push(`este cc.json no trae una lente de dependencias utilizable`);let ne=h.reduce((e,t)=>e+t.actualArea,0),re=h.filter(e=>e.risk>=.66).length,j=`risk`,M=null;if(t.color===`structure`)j=`structure`;else if(t.color&&t.color!==`risk`){if(!r.has(t.color))throw new wo(`la métrica de color "${t.color}" no existe en este cc.json`);j=`metric`,M=t.color}let N=Ro(h,j,M,x),ie=e.meta.projectName||t.title||`Proyecto sin nombre`;return{meta:{project:ie,title:t.title||ie,commit:e.meta.commitHash||``,checksum:e.meta.checksum||``,apiVersion:e.meta.apiVersion,rootName:p},files:h,sections:y,metrics:x,edges:O,cycles:te,roots:S,areaMetric:o,areaTitle:o?No(a,o):`Área`,totalArea:ne,fileCount:h.length,folderCount:C,hotspotCount:re,defaultSelection:N,initialLens:j,initialMetric:M,warnings:m}}function Io(e,t,n,r){let i=(e,t)=>{if(e.type===`File`){let i=n.get(e.id),a=i===void 0?void 0:r[i];return{kind:`file`,key:`f:${i??-1}`,name:e.name,path:t,value:a?.area??1,fileCount:1,section:a?.section??0,fileIndex:i}}let a=(e.children??[]).map(e=>i(e,t?`${t}/${e.name}`:e.name)),o={kind:`folder`,key:`d:${t}`,name:e.name,path:t,value:a.reduce((e,t)=>e+t.value,0)||1,fileCount:a.reduce((e,t)=>e+t.fileCount,0),section:-1,children:a};for(;o.children?.length===1&&o.children[0]?.kind===`folder`;){let e=o.children[0];o.name=`${o.name}/${e.name}`,o.path=e.path,o.key=`d:${e.path}`,o.value=e.value,o.fileCount=e.fileCount,o.children=e.children}return o};return t?(t.children??[]).map(e=>i(e,e.name)):e.files.map(e=>i(e,e.name))}function Lo(e){let t=0,n=[...e];for(;n.length>0;){let e=n.pop();e.kind===`folder`&&t++,e.children&&n.push(...e.children)}return t}function Ro(e,t,n,r){if(e.length===0)return null;if(t===`metric`&&n){let t=r.findIndex(e=>e.key===n);if(t>=0){let n=null;for(let r of e){let e=r.values[t];e!=null&&(!n||e>(n.values[t]??-1/0))&&(n=r)}if(n)return n.index}}return t===`structure`?e.reduce((e,t)=>t.actualArea>e.actualArea?t:e).index:e.reduce((e,t)=>t.risk>e.risk?t:e).index}function zo(e,t){if(t.w<=0||t.h<=0)return[];let n=e.filter(e=>Number.isFinite(e.value)&&e.value>0),r=n.reduce((e,t)=>e+t.value,0);if(n.length===0||r<=0)return[];let i=n.map((e,t)=>({item:e,index:t})).sort((e,t)=>t.item.value-e.item.value||e.index-t.index).map(({item:e})=>e),a=t.w*t.h/r,o=[],s=t.x,c=t.y,l=t.w,u=t.h,d=[],f=e=>e.value*a;function p(e,t){let n=0,r=-1/0,i=1/0;for(let t of e){let e=f(t);n+=e,e>r&&(r=e),e<i&&(i=e)}return n<=0||t<=0?1/0:Math.max(t*t*r/(n*n),n*n/(t*t*i))}function m(e,t){if(e.length===0)return;let n=e.reduce((e,t)=>e+f(t),0);if(!(n<=0)){if(t){if(l<=0)return;let t=n/l;if(!Number.isFinite(t)||t<=0)return;let r=s;for(let n of e){let e=f(n)/t;o.push({item:n,x:r,y:c,w:e,h:t}),r+=e}c+=t,u-=t}else{if(u<=0)return;let t=n/u;if(!Number.isFinite(t)||t<=0)return;let r=c;for(let n of e){let e=f(n)/t;o.push({item:n,x:s,y:r,w:t,h:e}),r+=e}s+=t,l-=t}}}let h=0;for(;h<i.length;){let e=l>=u,t=e?l:u,n=i[h];d.length===0||p([...d,n],t)<=p(d,t)?(d.push(n),h++):(m(d,e),d=[])}return d.length>0&&m(d,l>=u),o}var W=1400,G=12;function Bo(e,t=W,n=900){return Vo(e,{x:8,y:8,w:Math.max(1,t-16),h:Math.max(1,n-16)},0)}function Vo(e,t,n){return e.length===0||t.w<2||t.h<2?[]:zo(e.map(e=>({key:e.key,value:Math.max(1,e.value),node:e})),t).map(e=>Ho(e.item.node,{x:e.x,y:e.y,w:e.w,h:e.h},n))}function Ho(e,t,n){if(e.kind===`file`||!e.children||e.children.length===0)return{node:e,rect:t,headerHeight:0,children:[]};let r=0;t.w>=30&&t.h>=32&&(r=t.h>=62?17:13);let i={x:t.x+1,y:t.y+r+1,w:Math.max(0,t.w-2),h:Math.max(0,t.h-r-2)},a=n<G&&i.w>=1&&i.h>=1?Vo(e.children,i,n+1):[];return{node:e,rect:t,headerHeight:r,children:a}}var Uo=[[0,`#ebe7df`],[.35,`#e9cd98`],[.65,`#d68a54`],[1,`#a42e2c`]],Wo=[[0,`#ebe7df`],[.5,`#b9c9cf`],[1,`#355b6b`]];function Go(e){return Number.isFinite(e)?Math.max(0,Math.min(1,e)):0}function Ko(e){let t=e.replace(`#`,``);return[Number.parseInt(t.slice(0,2),16),Number.parseInt(t.slice(2,4),16),Number.parseInt(t.slice(4,6),16)]}function qo(e){return`#${e.map(e=>e.toString(16).padStart(2,`0`)).join(``)}`}function Jo(e,t,n){let r=Ko(e),i=Ko(t);return qo([Math.round(r[0]+(i[0]-r[0])*n),Math.round(r[1]+(i[1]-r[1])*n),Math.round(r[2]+(i[2]-r[2])*n)])}function Yo(e,t){let n=Go(t);for(let t=0;t<e.length-1;t++){let r=e[t],i=e[t+1];if(n<=i[0]){let e=i[0]-r[0]||1;return Jo(r[1],i[1],(n-r[0])/e)}}return e[e.length-1][1]}function Xo(e){return Yo(Uo,e)}function Zo(e,t){if(e===null)return Wo[0][1];let n;if(t.mode===`log`){let r=Math.max(1e-9,t.max-t.min);n=Math.log1p(Math.max(0,e-t.min))/Math.log1p(r)}else{let r=t.max-t.min;n=r>0?(e-t.min)/r:0}return Yo(Wo,n)}function Qo(e){return e.color}function $o(e){let[t,n,r]=Ko(e);return(.2126*t+.7152*n+.0722*r)/255>.52?`#1a1a1a`:`#f7f5f1`}function es(e){return Number.isFinite(e)?Math.round(e).toString().replace(/\B(?=(\d{3})+(?!\d))/g,`.`):`—`}function K(e){if(!Number.isFinite(e))return`—`;let t=Math.abs(e);return t>=1e6?`${(e/1e6).toFixed(1).replace(`.0`,``).replace(`.`,`,`)}M`:t>=1e3?`${(e/1e3).toFixed(1).replace(`.0`,``).replace(`.`,`,`)}k`:es(e)}var ts=11,ns={js:`JS / TS`,rust:`Rust`,bridge:`Puente`,native:`Nativo`},rs={js:`#2f6fed`,rust:`#d95d39`,bridge:`#7b61ff`,native:`#3f8f7a`},is={ts:`#2f6fed`,js:`#d9a21b`,rust:`#d95d39`,wasm:`#7b61ff`,node:`#3f8f7a`},as={created:`nació`,changed:`cambió`,unchanged:`igual`,renamed:`renombrada`,moved:`mudada`,removed:`eliminada`},os={function:`fn`,class:`cls`,interface:`int`,type:`typ`,enum:`enum`,variable:`var`},ss=`number_of_commits`;function cs(e,t){let n=Math.min(e,t);if(n<2)return null;let r=Math.min(ts,Math.max(4,n*.42)),i=t>e*1.4;return{size:Math.round(r*10)/10,vertical:i}}function ls(e){return new Map(e.metrics.map((e,t)=>[e.key,t]))}function us(e,t,n,r,i){if(t===`status`)return rs[r?.nodes[e.nodeId]?.status??`js`];if(t===`structure`){let t=n.sections[e.section];return t?Qo(t):`#d5d2ca`}if(t===`churn`){let t=i.get(ss);if(t===void 0)return Xo(e.risk);let r=n.metrics[t];return r?Zo(e.values[t]??null,r):Xo(e.risk)}if(t===`risk`)return Xo(e.risk);let a=i.get(t);if(a===void 0)return Xo(e.risk);let o=n.metrics[a];return o?Zo(e.values[a]??null,o):Xo(e.risk)}function ds(e,t){return t===`x`?{min:e.x,max:e.x+e.w}:{min:e.y,max:e.y+e.h}}function fs(e,t){let n=Math.min(e.max,t.max)-Math.max(e.min,t.min);return e.max-e.min-Math.max(0,n)}function ps(e,t,n){if(e.length===0)return null;if(t===null)return e[0]?.key??null;let r=e.find(e=>e.key===t);if(!r)return e[0]?.key??null;let i=n===`left`||n===`right`,a=i?`x`:`y`,o=i?`y`:`x`,s=n===`right`||n===`down`,c=ds(r,a),l=ds(r,o),u=null,d=1/0;for(let n of e){if(n.key===t)continue;let e=ds(n,a),r=ds(n,o),i=s?e.min-c.max:c.min-e.max;if(i<0)continue;let f=i+fs(l,r)*2+n.w*n.h/1e9;f<d&&(d=f,u=n)}return u?u.key:t}var ms={ArrowLeft:`left`,ArrowRight:`right`,ArrowUp:`up`,ArrowDown:`down`},hs=(0,b.memo)(function({placed:e,model:t,colorMode:n,migration:r,query:i,selectedIndex:a,activeKey:o,showLabels:s,onSelect:c,onFocusFolder:l,onCursor:u}){let d=(0,b.useMemo)(()=>new Map(t.metrics.map((e,t)=>[e.key,t])),[t.metrics]),f=e=>us(e,n,t,r,d),p=e=>{let{node:n,rect:d}=e;if(n.kind===`file`){let e=n.fileIndex===void 0?null:t.files[n.fileIndex];if(!e)return null;let l=f(e),p=a===e.index,m=i===``||e.path.toLowerCase().includes(i),h=s?cs(d.w,d.h):null,g=r?.nodes[e.nodeId],_=d.w>24&&d.h>10;return(0,x.jsxs)(`g`,{children:[(0,x.jsx)(`rect`,{className:`cell${o===`f:${e.index}`?` is-cursor`:``}`,x:d.x,y:d.y,width:Math.max(1,d.w),height:Math.max(1,d.h),fill:l,stroke:p?`#121a20`:`rgba(18,26,32,.26)`,strokeWidth:p?2:.55,opacity:m?1:.13,role:`button`,"data-cell-key":`f:${e.index}`,"data-file-index":e.index,tabIndex:o===`f:${e.index}`?0:-1,"aria-label":e.path,onFocus:()=>u(`f:${e.index}`),onClick:t=>{t.stopPropagation(),c(e.index)},children:_?(0,x.jsx)(`title`,{children:`${e.path}\n${t.areaTitle}: ${K(e.actualArea)}`+(g?`\n${ns[g.status]} · deuda ${g.debt??0} · FFI ${g.crossings}`:``)}):null}),h?(0,x.jsx)(`foreignObject`,{x:d.x,y:d.y,width:Math.max(1,d.w),height:Math.max(1,d.h),pointerEvents:`none`,children:(0,x.jsx)(`div`,{className:`map-label${h.vertical?` is-vertical`:``}`,style:{fontSize:h.size,color:$o(l)},children:e.name})}):null]},n.key)}let m=e.headerHeight>0||s?cs(d.w,d.h):null;return(0,x.jsxs)(`g`,{children:[(0,x.jsx)(`rect`,{className:`folder-block${o===n.key?` is-cursor`:``}`,x:d.x,y:d.y,width:Math.max(1,d.w),height:Math.max(1,d.h),fill:`rgba(18,26,32,.022)`,stroke:`rgba(18,26,32,.25)`,strokeWidth:.7,role:`button`,"data-cell-key":n.key,tabIndex:o===n.key?0:-1,"aria-label":`Enfocar ${n.path}`,onFocus:()=>u(n.key),onClick:e=>{e.stopPropagation(),l(n.path)}}),m?(0,x.jsx)(`foreignObject`,{x:d.x,y:d.y,width:Math.max(1,d.w),height:Math.max(1,d.h),pointerEvents:`none`,children:(0,x.jsx)(`div`,{className:`map-label is-folder${m.vertical?` is-vertical`:``}`,style:{fontSize:m.size},children:n.name.toUpperCase()})}):null,e.headerHeight>0&&d.w>34?(0,x.jsx)(`rect`,{x:d.x,y:d.y,width:Math.max(1,d.w),height:e.headerHeight,fill:`transparent`,className:`folder-hit`,"aria-label":`Enfocar ${n.path}`,onClick:e=>{e.stopPropagation(),l(n.path)}}):null,e.children.map(p)]},n.key)};return(0,x.jsx)(x.Fragment,{children:e.map(p)})});function gs({model:e,roots:t,colorMode:n,migration:r,query:i,selectedIndex:a,onSelect:o,onFocusFolder:s,zoom:c,center:l,onZoomAt:u,showLabels:d,onPan:f}){let p=(0,b.useRef)(null),[m,h]=(0,b.useState)({width:W,height:900}),g=(0,b.useRef)(null),_=(0,b.useRef)(0),v=(0,b.useRef)({x:0,y:0});(0,b.useEffect)(()=>()=>{_.current&&cancelAnimationFrame(_.current)},[]);let y=(0,b.useMemo)(()=>{let e=m.width/c,t=m.height/c;return{x:(m.width-e)*l.x,y:(m.height-t)*l.y,width:e,height:t}},[m,c,l]),S=(0,b.useMemo)(()=>Bo(t,m.width,m.height),[t,m.width,m.height]),{targets:C,targetMeta:w}=(0,b.useMemo)(()=>{let e=[],t=new Map,n=r=>{for(let i of r){let{node:r,rect:a}=i;if(r.kind===`file`){if(r.fileIndex===void 0)continue;let n=`f:${r.fileIndex}`;e.push({key:n,x:a.x,y:a.y,w:a.w,h:a.h}),t.set(n,{kind:`file`,fileIndex:r.fileIndex});continue}let o=i.children??[];o.length===0?(e.push({key:r.key,x:a.x,y:a.y,w:a.w,h:a.h}),t.set(r.key,{kind:`folder`,path:r.path})):n(o)}};return n(S),{targets:e,targetMeta:t}},[S]),[T,E]=(0,b.useState)(null),D=a===null?null:`f:${a}`,O=T??(D&&w.has(D)?D:C[0]?.key??null),k=(0,b.useRef)(!1);(0,b.useEffect)(()=>{if(!k.current||!T)return;k.current=!1;let e=p.current?.querySelector(`[data-cell-key="${T}"]`);e instanceof SVGElement&&e.focus()},[T,C]);let A=(0,b.useCallback)(e=>{let t=ms[e.key];if(t){let n=T??e.target?.getAttribute?.(`data-cell-key`)??null,r=ps(C,n,t);if(r===null||r===n)return;e.preventDefault(),k.current=!0,E(r);return}if(e.key!==`Enter`&&e.key!==` `)return;let n=T?w.get(T):void 0;n&&(e.preventDefault(),n.kind===`file`&&n.fileIndex!==void 0?o(n.fileIndex):n.path&&s(n.path))},[T,s,o,w,C]);return(0,b.useLayoutEffect)(()=>{let e=p.current;if(!e)return;let t=()=>{let t=e.getBoundingClientRect(),n=Math.round(t.width),r=Math.round(t.height);n>0&&r>0&&h({width:n,height:r})};t();let n=new ResizeObserver(t);return n.observe(e),window.addEventListener(`resize`,t),()=>{n.disconnect(),window.removeEventListener(`resize`,t)}},[]),(0,x.jsx)(`div`,{className:`map-inner`,ref:p,onBlur:e=>{e.currentTarget.contains(e.relatedTarget)||(k.current=!1)},children:(0,x.jsxs)(`svg`,{className:`map`,viewBox:`${y.x} ${y.y} ${y.width} ${y.height}`,role:`group`,"aria-label":`Mapa de arquitectura de ${e.meta.project}`,onKeyDown:A,onContextMenu:e=>e.preventDefault(),onPointerDown:e=>{e.button===2&&(e.preventDefault(),g.current={x:e.clientX,y:e.clientY},e.currentTarget.setPointerCapture(e.pointerId))},onPointerMove:e=>{let t=g.current;if(!t)return;let n=(e.clientX-t.x)/(e.currentTarget.clientWidth||1),r=(e.clientY-t.y)/(e.currentTarget.clientHeight||1);t.x=e.clientX,t.y=e.clientY,v.current.x+=n,v.current.y+=r,!_.current&&(_.current=requestAnimationFrame(()=>{_.current=0;let{x:e,y:t}=v.current;v.current={x:0,y:0},f(e,t)}))},onPointerUp:e=>{g.current=null,e.currentTarget.hasPointerCapture(e.pointerId)&&e.currentTarget.releasePointerCapture(e.pointerId)},onWheel:e=>{e.preventDefault();let t=e.currentTarget.getBoundingClientRect();u(e.deltaY<0?1.12:1/1.12,{x:(e.clientX-t.left)/t.width,y:(e.clientY-t.top)/t.height})},children:[(0,x.jsx)(`defs`,{children:(0,x.jsx)(`pattern`,{id:`map-grid`,width:`48`,height:`48`,patternUnits:`userSpaceOnUse`,children:(0,x.jsx)(`path`,{d:`M 48 0 L 0 0 0 48`,fill:`none`,stroke:`rgba(18,26,32,.045)`,strokeWidth:`1`})})}),(0,x.jsx)(`rect`,{width:m.width,height:m.height,fill:`url(#map-grid)`}),(0,x.jsx)(hs,{placed:S,model:e,colorMode:n,migration:r,query:i,selectedIndex:a,activeKey:O,showLabels:d,onSelect:o,onFocusFolder:s,onCursor:E})]})})}function _s(e){return e===`file`||e===`rules`||e===`changes`?e:e===`lenses`?`rules`:e===`pr`?`changes`:null}var vs=[`area`,`color`,`focus`,`file`,`tab`,`symbol`,`labels`],ys=[`src`,`report`];function bs(e,t){let n=e.get(t);if(typeof n!=`string`)return null;let r=n.trim();return r===``?null:r}function xs(e){let t=new URLSearchParams(e),n=bs(t,`tab`);return{areaMetric:bs(t,`area`),colorMode:bs(t,`color`),focusPath:bs(t,`focus`),filePath:bs(t,`file`),tab:_s(n),symbolName:bs(t,`symbol`),showLabels:t.has(`labels`)?t.get(`labels`)!==`0`:null}}function Ss(e){let t=new URLSearchParams(e);return{snapshotUrl:bs(t,`src`),reportUrl:bs(t,`report`)}}function Cs(e){return{areaMetric:e.area??null,colorMode:e.color??null,focusPath:e.focus??null,filePath:e.file??null,tab:e.tab??null,symbolName:e.symbol??null,showLabels:e.labels??null}}function ws(e,t,n){return e===`risk`||e===`structure`?!0:e===`status`?!!n:t.has(e)}function Ts(e,t,n=``){let r=new URLSearchParams(n);for(let e of vs)r.delete(e);for(let e of ys)r.delete(e);let i=[];e.areaMetric&&i.push([`area`,e.areaMetric]),e.colorMode&&i.push([`color`,e.colorMode]),e.focusPath&&i.push([`focus`,e.focusPath]),e.filePath&&i.push([`file`,e.filePath]),e.tab&&i.push([`tab`,e.tab]),e.symbolName&&i.push([`symbol`,e.symbolName]),e.showLabels!==null&&i.push([`labels`,e.showLabels?`1`:`0`]),t.snapshotUrl&&i.push([`src`,t.snapshotUrl]),t.reportUrl&&i.push([`report`,t.reportUrl]);let a=i.map(([e,t])=>`${e}=${Es(t)}`),o=r.toString();return o&&a.unshift(o),a.length===0?``:`?${a.join(`&`)}`}function Es(e){return encodeURIComponent(e).replace(/%(2F|3A|40|24|2C|3B|21|2A|27|28|29|7E)/g,e=>decodeURIComponent(e))}function Ds(e){if(typeof e!=`object`||!e)return null;let t=e;return typeof t.colorMode==`string`?{areaMetric:typeof t.areaMetric==`string`?t.areaMetric:null,colorMode:t.colorMode,showLabels:t.showLabels!==!1}:null}function Os(){try{return typeof window>`u`?null:window.localStorage}catch{return null}}var ks=`codarch:section:`;function As(e){return`${ks}${e}`}function js(e,t,n=!1){if(!e)return n;try{let r=e.getItem(As(t));return r===`closed`||r!==`open`&&n}catch{return n}}function Ms(e,t,n){if(e)try{e.setItem(As(t),n?`closed`:`open`)}catch{}}function Ns({id:e,title:t,count:n,summary:r,defaultOpen:i=!0,className:a,children:o}){let s=(0,b.useId)(),[c,l]=(0,b.useState)(()=>js(Os(),e,!i));return(0,x.jsxs)(`section`,{className:`collapsible${c?` is-closed`:``}${a?` ${a}`:``}`,children:[(0,x.jsxs)(`button`,{type:`button`,className:`collapsible-head`,"aria-expanded":!c,"aria-controls":s,onClick:()=>{l(t=>{let n=!t;return Ms(Os(),e,n),n})},children:[(0,x.jsx)(`span`,{className:`collapsible-chevron`,"aria-hidden":`true`,children:(0,x.jsx)(`svg`,{viewBox:`0 0 10 10`,width:`8`,height:`8`,children:(0,x.jsx)(`path`,{fill:`none`,stroke:`currentColor`,strokeWidth:`1.6`,strokeLinecap:`round`,strokeLinejoin:`round`,d:`M2 3.5 5 6.5 8 3.5`})})}),(0,x.jsx)(`span`,{className:`collapsible-title`,children:t}),n===void 0?null:(0,x.jsx)(`span`,{className:`collapsible-count`,children:n}),c&&r?(0,x.jsx)(`span`,{className:`collapsible-summary`,children:r}):null]}),(0,x.jsx)(`div`,{id:s,className:`collapsible-body`,hidden:c,children:o})]})}var Ps=[`rloc`,`loc`,`migrationDebt`,`ffiCrossings`,`maxComplexity`,`maxFunctionLength`,`functions`,`fanIn`,`fanOut`,`number_of_commits`,`number_of_authors`];function Fs(e){let t=new Set(e),n=Ps.filter(e=>t.has(e)),r=[...t].filter(e=>!n.includes(e)).sort((e,t)=>e.localeCompare(t));return[...n,...r]}var Is=[`rloc`,`loc`,`maxComplexity`,`max_complexity_per_function`,`complexity`,`maxFunctionLength`,`functions`,`number_of_functions`,`number_of_commits`,`number_of_authors`,`fanIn`,`fanOut`,`inCycle`,`cycleSize`,`dependencyLevel`,`migrationDebt`,`ffiCrossings`,`imports`,`externalImports`,`builtinImports`,`typeOnlyImports`,`unresolvedImports`],Ls=.75;function Rs(e,t){if(e===null||!Number.isFinite(e)||t.direction>=0)return`none`;if(t.p95<=0)return e>0?`debt`:`ok`;let n=e/t.p95;return n>=1?`debt`:n>=Ls?`watch`:`ok`}function zs(e,t){if(e===null||!Number.isFinite(e))return 0;let n=t.p95>0?t.p95:t.actualMax;if(n<=0)return 0;let r=Math.max(0,e),i=t.mode===`log`?Math.log1p(r)/Math.max(1e-9,Math.log1p(n)):r/n;return Math.max(0,Math.min(1,i))}function Bs(e){return e>=.7?`debt`:e>=.4?`watch`:`ok`}function Vs(e,t,n,r){let i=t.riskParts,a={key:`risk`,title:`Riesgo`,value:Math.round(t.risk*100),share:Math.max(0,Math.min(1,t.risk)),state:Bs(t.risk),area:!1,risk:!0,hint:`${Math.round(t.risk*100)} de 100 · complejidad ${K(i.complexity.value)} (p95 ${K(i.complexity.p95)}) · churn ${K(i.churn.value)} (p95 ${K(i.churn.p95)}) · tamaño ${K(i.size.value)} (p95 ${K(i.size.p95)})`};if(!e)return[a];let o=e.metrics.map((i,a)=>{let o=t.values[a]??null;return{key:i.key,title:r(i.key),value:o,share:zs(o,i),state:Rs(o,i),area:i.key===n,risk:!1,hint:`mín. ${K(i.min)} · p95 ${K(i.p95)} · máx. ${K(i.actualMax)} · ${K(i.coverage)} de ${K(e.files.length)} ficheros`}}),s=e=>{let t=Is.indexOf(e);return t<0?Is.length:t};return o.sort((e,t)=>s(e.key)-s(t.key)),[a,...o]}var Hs=[`function`,`class`,`interface`,`type`,`enum`,`variable`],Us={function:`Funciones`,class:`Clases`,interface:`Interfaces`,type:`Tipos`,enum:`Enums`,variable:`Variables`};function Ws(e){return Hs.map(t=>({kind:t,title:Us[t],symbols:e.filter(e=>e.kind===t)})).filter(e=>e.symbols.length>0)}function Gs(e){if(e.length===0)return;let t=new Map,n=0;for(let r of e)t.set(r.kind,(t.get(r.kind)??0)+1),n=Math.max(n,r.complexity??0);let r=Hs.filter(e=>t.has(e)).map(e=>`${t.get(e)} ${os[e]}`).join(` · `);return n>0?`${r} · máx. ${n}`:r}function Ks(e){let t=new Map;for(let n of e){let e=t.get(n.owner)??[];e.push(n),t.set(n.owner,e)}return[...t.entries()].map(([e,t])=>({owner:e,members:t.sort((e,t)=>e.line-t.line)}))}function qs(e){return e.imports.length+e.exports.length}function Js(e){let t=[];return e.imports.length>0&&t.push(`${e.imports.length} import${e.imports.length===1?``:`s`}`),e.exports.length>0&&t.push(`${e.exports.length} export${e.exports.length===1?``:`s`}`),t.length>0?t.join(` · `):void 0}function Ys(e){if(e.length===0)return;let t=Ks(e),n=t.slice(0,3).map(e=>`${e.owner} ${e.members.length}`),r=t.length-n.length;return r>0&&n.push(`+${r}`),n.join(` · `)}function Xs({label:e,value:t,accent:n}){return(0,x.jsxs)(`div`,{className:`kpi${n?` kpi-${n}`:``}`,children:[(0,x.jsx)(`span`,{children:e}),(0,x.jsx)(`b`,{children:K(t)})]})}function Zs({model:e,migration:t}){if(!t)return(0,x.jsxs)(`section`,{className:`panel-block`,children:[(0,x.jsx)(`div`,{className:`eyebrow`,children:`Estratos`}),(0,x.jsx)(`p`,{className:`muted small`,children:`Este snapshot no trae lente de migración.`})]});let n=Object.entries(t.summary.languages).filter(e=>e[1]!==void 0),r=n.reduce((e,[,t])=>e+t.rloc,0);return(0,x.jsxs)(`section`,{className:`panel-block`,children:[(0,x.jsx)(`div`,{className:`eyebrow`,children:`Estratos`}),(0,x.jsx)(`div`,{className:`strata`,"aria-label":`Reparto por lenguaje`,children:n.map(([e,t])=>t.rloc===0?null:(0,x.jsx)(`i`,{title:`${e}: ${K(t.rloc)} rloc`,style:{width:`${t.rloc/r*100}%`,background:is[e]??`#7b8790`}},e))}),(0,x.jsx)(`div`,{className:`strata-legend`,children:n.map(([e,t])=>(0,x.jsxs)(`div`,{className:`strata-row`,children:[(0,x.jsx)(`i`,{style:{background:is[e]??`#7b8790`}}),(0,x.jsx)(`span`,{children:e}),(0,x.jsx)(`span`,{className:`mono`,children:K(t.rloc)})]},e))}),(0,x.jsx)(`div`,{className:`status-row`,children:[`js`,`rust`,`bridge`,`native`].map(e=>(0,x.jsxs)(`span`,{className:`status-chip`,children:[(0,x.jsx)(`i`,{style:{background:rs[e]}}),ns[e],` `,(0,x.jsx)(`b`,{children:t.summary.status[e]})]},e))}),(0,x.jsxs)(`div`,{className:`muted tiny`,children:[t.summary.ffiEdges,` aristas FFI · `,t.summary.bridgeFiles,` puentes ·`,` `,e?`${K(e.fileCount)} ficheros`:``]})]})}function Qs({colorMode:e,migration:t,model:n}){if(e===`status`&&t)return(0,x.jsxs)(`section`,{className:`panel-block`,children:[(0,x.jsx)(`div`,{className:`eyebrow`,children:`Leyenda`}),(0,x.jsx)(`div`,{className:`legend`,children:[`js`,`rust`,`bridge`,`native`].map(e=>(0,x.jsxs)(`div`,{children:[(0,x.jsx)(`i`,{style:{background:rs[e]}}),(0,x.jsx)(`span`,{children:ns[e]}),(0,x.jsx)(`span`,{className:`mono`,children:t.summary.status[e]})]},e))})]});if(e===`structure`&&n)return(0,x.jsxs)(`section`,{className:`panel-block`,children:[(0,x.jsx)(`div`,{className:`eyebrow`,children:`Leyenda`}),(0,x.jsx)(`div`,{className:`legend`,children:n.sections.slice(0,8).map(e=>(0,x.jsxs)(`div`,{children:[(0,x.jsx)(`i`,{style:{background:e.color}}),(0,x.jsx)(`span`,{className:`ellipsis`,title:e.label,children:e.label}),(0,x.jsx)(`span`,{className:`mono`,children:e.files})]},e.key))})]});if(e===`risk`)return(0,x.jsxs)(`section`,{className:`panel-block`,children:[(0,x.jsx)(`div`,{className:`eyebrow`,children:`Leyenda · riesgo`}),(0,x.jsx)(`div`,{className:`gradient risk`}),(0,x.jsxs)(`div`,{className:`gradient-labels`,children:[(0,x.jsx)(`span`,{children:`bajo`}),(0,x.jsx)(`span`,{children:`alto`})]})]});let r=n?.metrics.find(t=>t.key===e);return r?(0,x.jsxs)(`section`,{className:`panel-block`,children:[(0,x.jsxs)(`div`,{className:`eyebrow`,children:[`Leyenda · `,r.title]}),(0,x.jsx)(`div`,{className:`gradient metric`}),(0,x.jsxs)(`div`,{className:`gradient-labels`,children:[(0,x.jsx)(`span`,{children:K(r.min)}),(0,x.jsx)(`span`,{children:K(r.max)})]}),(0,x.jsxs)(`div`,{className:`muted tiny`,children:[r.coverage,` ficheros · `,r.mode===`log`?`escala log`:`escala lineal`,r.actualMax>r.max?` · máx real ${K(r.actualMax)}`:``]})]}):null}function $s({load:e,onOpenSnapshot:t}){let[n,r]=(0,b.useState)(null);return(0,b.useEffect)(()=>{let t=!1;return(async()=>{let n=await e();t||r(n)})(),()=>{t=!0}},[e]),!n||n.length===0?null:(0,x.jsxs)(`section`,{className:`panel-block`,children:[(0,x.jsx)(`div`,{className:`eyebrow`,children:`Historia`}),(0,x.jsx)(`div`,{className:`history-list`,children:n.slice().reverse().map(e=>(0,x.jsxs)(`button`,{type:`button`,className:`history-row`,onClick:()=>t(e),title:`${e.files} ficheros · ${e.rloc} rloc`,children:[(0,x.jsx)(`span`,{className:`mono history-date`,children:e.date.slice(0,16).replace(`T`,` `)}),(0,x.jsxs)(`span`,{className:`mono history-count`,children:[e.files,` f.`]})]},e.checksum))})]})}function ec(e){return`${e.date.replace(/[:.]/g,`-`).replace(`Z`,``)}-${e.checksum.slice(0,8)}.cc.json`}function tc({model:e,selectedIndex:t,onSelect:n}){let r=e?e.metrics.findIndex(e=>e.key===ss):-1;if(!e||r<0)return null;let i=e.files.map(e=>({file:e,commits:e.values[r]??0})).filter(e=>e.commits>0).sort((e,t)=>t.commits-e.commits).slice(0,8);if(i.length===0)return null;let a=i[0]?.commits??1;return(0,x.jsxs)(`section`,{className:`panel-block`,children:[(0,x.jsx)(`div`,{className:`eyebrow`,children:`Más tocados`}),(0,x.jsx)(`div`,{className:`debt-list`,children:i.map(({file:e,commits:r})=>(0,x.jsxs)(`button`,{type:`button`,className:`debt-row${t===e.index?` is-selected`:``}`,onClick:()=>n(e.index),title:e.path,children:[(0,x.jsx)(`span`,{className:`debt-name`,children:e.path}),(0,x.jsx)(`span`,{className:`debt-track`,children:(0,x.jsx)(`i`,{style:{width:`${Math.max(4,r/a*100)}%`,background:`var(--rust)`}})}),(0,x.jsx)(`span`,{className:`mono`,children:r})]},e.nodeId))})]})}function nc({load:e,onSelectSymbol:t}){let[n,r]=(0,b.useState)(null);if((0,b.useEffect)(()=>{let t=!1;return(async()=>{let n=await e();t||r(n)})(),()=>{t=!0}},[e]),!n||n.length===0)return null;let i=Math.max(1,n[0]?.churn??1);return(0,x.jsxs)(`section`,{className:`panel-block`,children:[(0,x.jsx)(`div`,{className:`eyebrow`,children:`Más reescritos`}),(0,x.jsx)(`div`,{className:`debt-list`,children:n.map(e=>(0,x.jsxs)(`button`,{type:`button`,className:`debt-row`,onClick:()=>t(e.name,e.path),title:`${e.path} · ${e.changes} cambios · ${e.moves} mudanzas`,children:[(0,x.jsx)(`span`,{className:`debt-name`,children:e.name}),(0,x.jsx)(`span`,{className:`debt-track`,children:(0,x.jsx)(`i`,{style:{width:`${Math.max(4,e.churn/i*100)}%`,background:`var(--rust)`}})}),(0,x.jsx)(`span`,{className:`mono`,children:e.churn})]},e.id))})]})}function rc({model:e,migration:t,selectedIndex:n,onSelect:r}){if(!e||!t)return null;let i=e.files.map(e=>({file:e,node:t.nodes[e.nodeId]})).filter(e=>!!e.node?.debt).sort((e,t)=>(t.node.debt??0)-(e.node.debt??0)).slice(0,8),a=i[0]?.node.debt??1;return i.length===0?null:(0,x.jsxs)(`section`,{className:`panel-block`,children:[(0,x.jsx)(`div`,{className:`eyebrow`,children:`Deuda de migración`}),(0,x.jsx)(`div`,{className:`debt-list`,children:i.map(({file:e,node:t})=>(0,x.jsxs)(`button`,{type:`button`,className:`debt-row${n===e.index?` is-selected`:``}`,onClick:()=>r(e.index),title:e.path,children:[(0,x.jsx)(`span`,{className:`debt-name`,children:e.path}),(0,x.jsx)(`span`,{className:`debt-track`,children:(0,x.jsx)(`i`,{style:{width:`${Math.max(4,(t.debt??0)/a*100)}%`,background:rs[t.status]}})}),(0,x.jsx)(`span`,{className:`mono`,children:K(t.debt??0)})]},e.nodeId))})]})}function ic({model:e,file:t,migrationNode:n,areaMetric:r,colorMode:i,metricTitle:a,symbols:o,structure:s,chain:c,onSelectSymbol:l,onColorMode:u}){if(!t)return(0,x.jsxs)(`section`,{className:`inspector-empty`,children:[(0,x.jsx)(`h2`,{children:`Selecciona una celda`}),(0,x.jsx)(`p`,{className:`muted small`,children:`El mapa conserva la jerarquía de carpetas. Pasa el cursor para ver la ruta y haz clic para abrir las métricas del fichero.`}),e?(0,x.jsxs)(`div`,{className:`inspector-note`,children:[(0,x.jsx)(`span`,{className:`mono`,children:e.meta.apiVersion}),(0,x.jsx)(`span`,{children:e.meta.checksum.slice(0,8)||`sin checksum`})]}):null]});let d=Vs(e,t,r,a),f=c?.versions[c.versions.length-1];return(0,x.jsxs)(`section`,{className:`inspector-file`,children:[(0,x.jsx)(`div`,{className:`inspector-path`,title:t.path,children:t.path}),(0,x.jsx)(`h2`,{children:t.name}),n?(0,x.jsxs)(`div`,{className:`inspector-status`,children:[(0,x.jsx)(`span`,{className:`status-dot`,style:{background:rs[n.status]}}),(0,x.jsx)(`span`,{children:ns[n.status]}),(0,x.jsx)(`span`,{className:`mono`,children:n.language})]}):null,(0,x.jsx)(Ns,{id:`file-metrics`,title:`Métricas`,count:d.length,summary:d[0]?.value===null||d[0]?.value===void 0?void 0:`Riesgo ${d[0].value}/100`,children:(0,x.jsxs)(`div`,{className:`metrics-table`,children:[(0,x.jsxs)(`div`,{className:`metrics-head`,"aria-hidden":`true`,children:[(0,x.jsx)(`span`,{children:`Métrica`}),(0,x.jsx)(`span`,{children:`Escala`}),(0,x.jsx)(`span`,{children:`Valor`})]}),(0,x.jsx)(`div`,{className:`metrics-rows`,role:`group`,"aria-label":`Métricas del fichero`,children:d.map(e=>{let t=e.risk?i===`risk`:i===e.key;return(0,x.jsxs)(`button`,{type:`button`,className:`metrics-row metrics-${e.state}${t?` is-active`:``}${e.value===null?` is-empty`:``}`,"aria-pressed":t,title:`${e.hint}. Pulsa para pintar el mapa.`,onClick:()=>u(e.risk?`risk`:e.key),children:[(0,x.jsxs)(`span`,{className:`metrics-label`,children:[e.title,e.area?(0,x.jsx)(`em`,{className:`metrics-area`,title:`Esta métrica decide el área del mapa`,children:`área`}):null]}),(0,x.jsx)(`span`,{className:`metrics-bar`,"aria-hidden":`true`,children:(0,x.jsx)(`i`,{style:{width:`${Math.round(e.share*100)}%`}})}),(0,x.jsxs)(`span`,{className:`metrics-value`,children:[e.value===null?`—`:K(e.value),e.risk&&e.value!==null?(0,x.jsx)(`em`,{children:`/100`}):null]})]},e.key)})}),(0,x.jsx)(`p`,{className:`muted tiny metrics-note`,children:`La barra llega al p95 del proyecto; el riesgo, a 100. Pulsa una fila para pintar el mapa.`})]})}),o.length>0?(0,x.jsx)(Ns,{id:`file-symbols`,title:`Símbolos`,count:o.length,summary:Gs(o),children:(0,x.jsxs)(`div`,{className:`symbol-list`,children:[Ws(o).map(e=>(0,x.jsxs)(`div`,{className:`symbol-group`,children:[(0,x.jsxs)(`div`,{className:`symbol-group-head`,children:[(0,x.jsx)(`span`,{children:e.title}),(0,x.jsx)(`span`,{className:`symbol-group-line`,"aria-hidden":`true`}),(0,x.jsx)(`span`,{className:`mono symbol-group-count`,children:e.symbols.length})]}),e.symbols.map(e=>(0,x.jsxs)(`button`,{type:`button`,className:`symbol-row${c?.name===e.name?` is-selected`:``}`,onClick:()=>l(e.name),title:`${os[e.kind]} ${e.name} · línea ${e.line}${e.complexity===void 0?``:` · complejidad ${e.complexity}`}. Ver la vida de este símbolo.`,children:[(0,x.jsx)(`span`,{className:`symbol-kind symbol-${e.kind}`,children:os[e.kind]}),(0,x.jsx)(`span`,{className:`symbol-name`,title:e.name,children:e.name}),e.complexity===void 0?null:(0,x.jsx)(`span`,{className:`mono symbol-complexity`,title:`Complejidad ciclomática`,children:e.complexity})]},`${e.name}-${e.line}`))]},e.kind)),(0,x.jsx)(`p`,{className:`muted tiny symbol-note`,children:`Agrupados por tipo y ordenados por complejidad. Pulsa uno para seguir su vida.`})]})}):null,s&&qs(s)>0?(0,x.jsx)(Ns,{id:`file-surface`,title:`Superficie`,count:qs(s),summary:Js(s),children:(0,x.jsxs)(`div`,{className:`surface-list`,children:[s.imports.length>0?(0,x.jsxs)(`div`,{className:`surface-group`,children:[(0,x.jsxs)(`div`,{className:`symbol-group-head`,children:[(0,x.jsx)(`span`,{children:`Importa`}),(0,x.jsx)(`span`,{className:`symbol-group-line`,"aria-hidden":`true`}),(0,x.jsx)(`span`,{className:`mono symbol-group-count`,children:s.imports.length})]}),s.imports.map(e=>(0,x.jsxs)(`div`,{className:`surface-row`,children:[(0,x.jsx)(`span`,{className:`mono surface-source`,title:e.source,children:e.source}),(0,x.jsxs)(`span`,{className:`surface-names`,children:[e.names.length>0?e.names.map(e=>(0,x.jsx)(`span`,{className:`surface-name`,children:e},e)):(0,x.jsx)(`span`,{className:`muted tiny`,children:`efecto secundario`}),e.typeOnly?(0,x.jsx)(`span`,{className:`surface-badge`,children:`type`}):null,e.kind===`static`?null:(0,x.jsx)(`span`,{className:`surface-badge`,children:e.kind})]})]},`${e.line}-${e.source}`))]}):null,s.exports.length>0?(0,x.jsxs)(`div`,{className:`surface-group`,children:[(0,x.jsxs)(`div`,{className:`symbol-group-head`,children:[(0,x.jsx)(`span`,{children:`Exporta`}),(0,x.jsx)(`span`,{className:`symbol-group-line`,"aria-hidden":`true`}),(0,x.jsx)(`span`,{className:`mono symbol-group-count`,children:s.exports.length})]}),s.exports.map(e=>(0,x.jsxs)(`div`,{className:`surface-row`,children:[(0,x.jsx)(`span`,{className:`surface-name`,children:e.name}),e.local?(0,x.jsxs)(`span`,{className:`muted tiny`,children:[`desde `,e.local]}):null,e.source?(0,x.jsxs)(`span`,{className:`mono surface-source`,children:[`← `,e.source]}):null,e.typeOnly?(0,x.jsx)(`span`,{className:`surface-badge`,children:`type`}):null]},`${e.line}-${e.name}-${e.source??``}`))]}):null,(0,x.jsx)(`p`,{className:`muted tiny symbol-note`,children:`Lo que el fichero importa y exporta. No son símbolos: no tienen cadena.`})]})}):null,s&&s.members.length>0?(0,x.jsx)(Ns,{id:`file-members`,title:`Miembros`,count:s.members.length,summary:Ys(s.members),children:(0,x.jsxs)(`div`,{className:`member-list`,children:[Ks(s.members).map(e=>(0,x.jsxs)(`div`,{className:`member-group`,children:[(0,x.jsxs)(`div`,{className:`symbol-group-head`,children:[(0,x.jsx)(`span`,{children:e.owner}),(0,x.jsx)(`span`,{className:`symbol-group-line`,"aria-hidden":`true`}),(0,x.jsx)(`span`,{className:`mono symbol-group-count`,children:e.members.length})]}),e.members.map(e=>(0,x.jsxs)(`div`,{className:`member-row`,title:`${e.name} · línea ${e.line}`,children:[(0,x.jsx)(`span`,{className:`symbol-kind member-kind`,children:e.from===`parameter`?`par`:`campo`}),(0,x.jsx)(`span`,{className:`symbol-name`,title:e.name,children:e.name})]},`${e.name}-${e.line}`))]},e.owner)),(0,x.jsx)(`p`,{className:`muted tiny symbol-note`,children:`Campos y propiedades del constructor. No son símbolos: viven dentro de su clase.`})]})}):null,c?(0,x.jsx)(Ns,{id:`file-chain`,title:`La vida de ${c.name}`,count:c.versions.length,summary:f?`última ${f.date.slice(0,10)}`:void 0,children:(0,x.jsx)(`div`,{className:`chain-list`,children:c.versions.map(e=>(0,x.jsxs)(`div`,{className:`chain-row`,children:[(0,x.jsx)(`span`,{className:`mono chain-date`,children:e.date.slice(0,10)}),(0,x.jsx)(`span`,{className:`chain-events`,children:e.events.map(e=>(0,x.jsx)(`span`,{className:`chain-event chain-${e.type}`,children:as[e.type]},e.type))}),(0,x.jsx)(`span`,{className:`chain-path`,title:e.path,children:e.path})]},e.entry))})}):null]})}function ac({label:e,value:t}){return(0,x.jsxs)(`div`,{className:`metric`,children:[(0,x.jsx)(`span`,{children:e}),(0,x.jsx)(`b`,{children:t})]})}function oc({report:e,source:t,error:n,onLoad:r,onSelectPath:i}){if(!e)return(0,x.jsxs)(`section`,{className:`change-panel`,children:[(0,x.jsx)(`div`,{className:`eyebrow`,children:`Cambios`}),(0,x.jsx)(`h2`,{children:`Sin reporte`}),(0,x.jsxs)(`p`,{className:`muted small`,children:[`Carga el `,(0,x.jsx)(`code`,{children:`report.json`}),` que genera `,(0,x.jsx)(`code`,{children:`codarch diff`}),` `,`o la GitHub Action para ver los cambios del snapshot.`]}),(0,x.jsx)(`button`,{className:`button dark`,type:`button`,onClick:r,children:`Abrir reporte`}),n?(0,x.jsx)(`p`,{className:`panel-error`,children:n}):null]});let a=e.summary,o=e.files.changed.slice(0,6),s=e.files.added.slice(0,5),c=e.cycles.introduced.slice(0,4),l=e.migration,u=l?.files.increased.slice(0,6)??[],d=l?.files.decreased.slice(0,6)??[],f=e.symbols,p=f?.files.slice(0,6)??[];return(0,x.jsxs)(`section`,{className:`change-panel`,children:[(0,x.jsxs)(`div`,{className:`eyebrow`,children:[`Cambios · `,t??`report.json`]}),(0,x.jsx)(`h2`,{children:`Cambios de arquitectura`}),(0,x.jsxs)(`div`,{className:`change-checksums mono`,children:[e.base.checksum.slice(0,8)||`base`,` →`,` `,e.head.checksum.slice(0,8)||`head`]}),(0,x.jsxs)(`div`,{className:`change-grid`,children:[(0,x.jsx)(sc,{label:`Ficheros`,value:`+${a.addedFiles} −${a.removedFiles} ~${a.changedFiles}`}),(0,x.jsx)(sc,{label:`Aristas`,value:`+${a.addedEdges} −${a.removedEdges}`}),(0,x.jsx)(sc,{label:`Ciclos`,value:`+${a.introducedCycles} −${a.fixedCycles}`,accent:a.introducedCycles>0?`bad`:void 0}),(0,x.jsx)(sc,{label:`Hotspots`,value:K(a.hotspots)}),l?(0,x.jsx)(sc,{label:`Deuda migración`,value:K(l.debt.head),accent:l.debt.delta>0?`bad`:`good`}):null,f?(0,x.jsx)(sc,{label:`Símbolos`,value:`+${f.summary.added} −${f.summary.removed} ~${f.summary.changed}`}):null]}),l?(0,x.jsxs)(`div`,{className:`change-section`,children:[(0,x.jsx)(`div`,{className:`eyebrow`,children:`Migración`}),(0,x.jsxs)(`div`,{className:`change-summary`,children:[(0,x.jsxs)(`span`,{children:[`deuda `,(0,x.jsx)(`b`,{children:l.debt.base}),` → `,(0,x.jsx)(`b`,{children:l.debt.head})]}),(0,x.jsxs)(`span`,{children:[`cruces FFI `,(0,x.jsx)(`b`,{children:l.crossings.head})]}),(0,x.jsxs)(`span`,{children:[`nativos `,(0,x.jsx)(`b`,{children:l.status.head.native??0})]})]}),u.length===0&&d.length===0?(0,x.jsx)(`p`,{className:`muted small`,children:`La deuda de migración no ha cambiado.`}):(0,x.jsxs)(`div`,{className:`violation-list`,children:[u.map(e=>(0,x.jsx)(cc,{path:e.path,before:e.base,after:e.head,onSelectPath:i},e.id)),d.map(e=>(0,x.jsx)(cc,{path:e.path,before:e.base,after:e.head,onSelectPath:i},e.id))]})]}):null,f&&p.length>0?(0,x.jsxs)(`div`,{className:`change-section`,children:[(0,x.jsx)(`div`,{className:`eyebrow`,children:`Símbolos`}),(0,x.jsx)(`div`,{className:`violation-list`,children:p.map(e=>(0,x.jsxs)(`div`,{className:`symbol-file`,children:[(0,x.jsx)(`button`,{type:`button`,className:`symbol-file-path`,onClick:()=>i(e.path),title:`Ver el fichero en el mapa`,children:e.path}),e.symbols.slice(0,4).map(e=>(0,x.jsxs)(`div`,{className:`symbol-change`,children:[(0,x.jsx)(`span`,{className:`symbol-kind symbol-${e.kind}`,children:e.kind===`function`?`fn`:e.kind.slice(0,3)}),(0,x.jsx)(`span`,{className:`symbol-name`,children:e.name}),(0,x.jsx)(`span`,{className:`mono`,children:e.status===`added`?`nuevo`:e.status===`removed`?`eliminado`:e.complexityDelta===null?`cambió`:`${e.complexityDelta>0?`+`:``}${e.complexityDelta}`})]},`${e.name}-${e.status}`))]},e.id))})]}):null,c.length>0?(0,x.jsxs)(`div`,{className:`change-section`,children:[(0,x.jsx)(`div`,{className:`eyebrow`,children:`Ciclos nuevos`}),(0,x.jsx)(`div`,{className:`change-rows`,children:c.map((e,t)=>(0,x.jsxs)(`div`,{className:`change-cycle`,children:[(0,x.jsxs)(`span`,{className:`mono`,children:[`×`,e.size]}),(0,x.jsx)(`span`,{className:`change-path`,title:e.nodes.map(e=>e.path).join(` → `),children:e.nodes.map(e=>e.path).join(` → `)})]},t))})]}):null,(0,x.jsxs)(`div`,{className:`change-section`,children:[(0,x.jsx)(`div`,{className:`eyebrow`,children:`Ficheros modificados`}),o.length===0?(0,x.jsx)(`p`,{className:`muted small`,children:`Sin ficheros modificados.`}):(0,x.jsx)(`div`,{className:`change-rows`,children:o.map(e=>(0,x.jsxs)(`button`,{type:`button`,className:`change-row`,title:e.path,onClick:()=>i(e.path),children:[(0,x.jsx)(`span`,{className:`change-path`,children:e.path}),(0,x.jsx)(`span`,{className:`mono change-delta`,children:e.changes.slice(0,2).map(e=>`${e.metric} ${e.delta===null?`±`:e.delta>0?`+${K(e.delta)}`:K(e.delta)}`).join(` · `)})]},e.id))}),e.files.changed.length>o.length?(0,x.jsxs)(`p`,{className:`muted tiny`,children:[`+`,e.files.changed.length-o.length,` más`]}):null]}),s.length>0?(0,x.jsxs)(`div`,{className:`change-section`,children:[(0,x.jsx)(`div`,{className:`eyebrow`,children:`Ficheros nuevos`}),(0,x.jsx)(`div`,{className:`change-rows`,children:s.map(e=>(0,x.jsxs)(`button`,{type:`button`,className:`change-row`,title:e.path,onClick:()=>i(e.path),children:[(0,x.jsx)(`span`,{className:`change-path`,children:e.path}),(0,x.jsxs)(`span`,{className:`mono change-delta`,children:[`+`,K(e.metrics.rloc??e.metrics.loc??0)]})]},e.id))})]}):null]})}function sc({label:e,value:t,accent:n}){return(0,x.jsxs)(`div`,{className:`change-stat${n?` change-stat-${n}`:``}`,children:[(0,x.jsx)(`span`,{children:e}),(0,x.jsx)(`b`,{children:t})]})}function cc({path:e,before:t,after:n,onSelectPath:r}){let i=(n??0)-(t??0);return(0,x.jsxs)(`button`,{className:`change-row`,type:`button`,onClick:()=>r(e),children:[(0,x.jsx)(`span`,{className:`change-path`,children:e}),(0,x.jsxs)(`span`,{className:`mono change-delta${i>0?` is-worse`:` is-better`}`,children:[t??0,` → `,n??0,` (`,i>0?`+${i}`:i,`)`]})]})}var lc={introduced:0,existing:1},uc={error:0,warn:1,info:2};function dc(e){return e.replaceAll(`\\`,`/`).replace(/^\.\//,``)}function fc(e,t){if(!e)return[];let n=dc(t),r=[];for(let t of[`introduced`,`existing`])for(let i of e.rules.violations[t])i.files.some(e=>dc(e)===n)&&r.push({status:t,violation:i});return r.sort((e,t)=>lc[e.status]-lc[t.status]||uc[e.violation.severity]-uc[t.violation.severity]||e.violation.rule.localeCompare(t.violation.rule))}function pc(e){let t=0,n=0;for(let r of e)r.status===`introduced`?t+=1:n+=1;return{introduced:t,existing:n}}function mc(e,t,n){if(!e||!t)return[];let r=new Map(n.map(e=>[e.nodeId,e.path])),i=[];for(let n of e.edges)if(n.fromId===t){let e=r.get(n.toId);e&&i.push({kind:n.kind,direction:`out`,path:e})}else if(n.toId===t){let e=r.get(n.fromId);e&&i.push({kind:n.kind,direction:`in`,path:e})}return i.sort((e,t)=>e.path.localeCompare(t.path)||e.direction.localeCompare(t.direction))}function hc(e){let t=0,n=0,r=null;for(let i of e){i.kind===`function`&&(t+=1),i.kind===`variable`&&(n+=1);let e=i.complexity??0;(r===null||e>(r.complexity??0))&&(r=i)}return{count:e.length,functions:t,variables:n,mostComplex:r}}function gc(e){return e===`config`?`equipo`:e===`profile`?`perfil`:e.slice(6)}function _c(e){return e.files[0]??e.edge?.from??e.cycle?.nodes[0]?.path??null}function vc(e){let t=new Map;for(let n of e)t.set(n.source,(t.get(n.source)??0)+1);return[...t.entries()].map(([e,t])=>({source:e,label:gc(e),count:t})).sort((e,t)=>t.count-e.count||e.label.localeCompare(t.label)||e.source.localeCompare(t.source))}function yc({violation:e,status:t,onSelectPath:n,otherThan:r,showStatus:i=!1}){let a=r?e.files.find(e=>e!==r)??_c(e):_c(e),o=e.files.join(`, `)||(e.cycle?e.cycle.nodes.map(e=>e.path).join(` → `):`Sin ruta`),s=e.edge&&!(e.message.includes(e.edge.from)&&e.message.includes(e.edge.to))?e.edge:null,c=e.metric&&!e.message.includes(e.metric.name)?e.metric:null,l=e.cycle&&!e.message.includes(e.cycle.nodes[0]?.path??``)?e.cycle:null;return(0,x.jsxs)(`button`,{type:`button`,className:`violation violation-${e.severity} rules-rule rules-rule-${t}`,onClick:()=>a&&n(a),title:o,children:[(0,x.jsx)(`i`,{}),(0,x.jsxs)(`span`,{children:[(0,x.jsxs)(`b`,{children:[e.rule,(0,x.jsx)(`em`,{className:`violation-source`,title:`De dónde sale la regla`,children:gc(e.source)}),i&&t===`introduced`?(0,x.jsx)(`em`,{className:`violation-source lens-new`,title:`No estaba en base`,children:`nueva`}):null]}),(0,x.jsx)(`small`,{children:e.message}),s?(0,x.jsxs)(`small`,{className:`rules-detail`,children:[s.from,` → `,s.to]}):null,c?(0,x.jsxs)(`small`,{className:`rules-detail`,children:[c.name,` = `,K(c.value),c.max===void 0?``:` · máx. ${K(c.max)}`,c.min===void 0?``:` · mín. ${K(c.min)}`]}):null,l?(0,x.jsxs)(`small`,{className:`rules-detail`,children:[`ciclo de `,l.size,`:`,` `,l.nodes.map(e=>e.path).join(` → `)]}):null,t===`resolved`?(0,x.jsx)(`small`,{className:`rules-detail`,children:`ya no está en el head`}):null]})]})}var bc={complexity:`Complejidad`,churn:`Churn`,size:`Tamaño`},xc=8,Sc=6;function Cc({model:e,file:t,migration:n,report:r,symbols:i,onSelectPath:a}){let o=t.riskParts,s=Object.keys(bc).filter(e=>o[e].weight===0),c=fc(r,t.path),l=pc(c),u=n?.nodes[t.nodeId]??null,d=mc(n,t.nodeId,e?.files??[]),f=hc(i);return(0,x.jsxs)(`div`,{className:`rules-file`,children:[(0,x.jsxs)(`div`,{className:`lens-section`,children:[(0,x.jsx)(`div`,{className:`eyebrow`,children:`Riesgo`}),(0,x.jsxs)(`div`,{className:`lens-risk-head`,children:[(0,x.jsx)(`b`,{className:`lens-risk-value`,children:K(Math.round(t.risk*100))}),(0,x.jsx)(`span`,{className:`lens-risk-unit`,children:`/ 100`})]}),(0,x.jsx)(`div`,{className:`lens-bars`,children:Object.keys(bc).map(e=>{let t=o[e];return(0,x.jsxs)(`div`,{className:`lens-bar-row`,title:`${K(t.value)} de p95 ${K(t.p95)} · peso ${Math.round(t.weight*100)} %`,children:[(0,x.jsx)(`span`,{children:bc[e]}),(0,x.jsx)(`span`,{className:`lens-bar`,children:(0,x.jsx)(`i`,{style:{width:`${Math.round(t.norm*100)}%`}})}),(0,x.jsx)(`span`,{className:`mono`,children:K(t.value)}),(0,x.jsxs)(`span`,{className:`lens-weight`,children:[Math.round(t.weight*100),` %`]})]},e)})}),(0,x.jsx)(`p`,{className:`muted tiny`,children:s.length===0?`Peso del riesgo: complejidad 50 % · churn 32 % · tamaño 18 %, normalizado por el p95 de cada señal.`:s.length===3?`Este snapshot no trae las señales del riesgo.`:`Sin ${s.map(e=>bc[e].toLowerCase()).join(` ni `)} en este snapshot: su peso se reparte entre las demás señales.`}),(0,x.jsxs)(`p`,{className:`muted tiny mono`,children:[`p95 del proyecto · complejidad `,K(o.complexity.p95),` `,`· churn `,K(o.churn.p95),` · tamaño`,` `,K(o.size.p95)]})]}),(0,x.jsxs)(`div`,{className:`lens-section`,children:[(0,x.jsx)(`div`,{className:`eyebrow`,children:`Dominio`}),r?r.rules.configured?c.length===0?(0,x.jsx)(`p`,{className:`muted small`,children:`Ninguna regla violada en este fichero.`}):(0,x.jsxs)(x.Fragment,{children:[(0,x.jsxs)(`div`,{className:`lens-counts`,children:[l.introduced>0?(0,x.jsxs)(`span`,{className:`lens-chip lens-chip-new`,children:[l.introduced,` nueva`,l.introduced===1?``:`s`]}):null,l.existing>0?(0,x.jsxs)(`span`,{className:`lens-chip`,children:[l.existing,` existente`,l.existing===1?``:`s`]}):null]}),(0,x.jsx)(`div`,{className:`violation-list`,children:c.slice(0,xc).map(({status:e,violation:n})=>(0,x.jsx)(yc,{violation:n,status:e,onSelectPath:a,otherThan:t.path,showStatus:!0},`${e}-${n.key}`))}),c.length>xc?(0,x.jsxs)(`p`,{className:`muted tiny`,children:[`y `,c.length-xc,` reglas más en este fichero.`]}):null]}):(0,x.jsx)(`p`,{className:`muted small`,children:`Este reporte no trae reglas de arquitectura configuradas.`}):(0,x.jsxs)(`p`,{className:`muted small`,children:[`La lente de dominio vive en el reporte del diff. Carga un`,` `,(0,x.jsx)(`code`,{children:`report.json`}),` para ver las reglas que toca este fichero.`]})]}),(0,x.jsxs)(`div`,{className:`lens-section`,children:[(0,x.jsx)(`div`,{className:`eyebrow`,children:`Migración`}),n?u?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsxs)(`div`,{className:`inspector-status`,children:[(0,x.jsx)(`span`,{className:`status-dot`,style:{background:rs[u.status]}}),(0,x.jsx)(`span`,{children:ns[u.status]}),(0,x.jsx)(`span`,{className:`mono`,children:u.language})]}),(0,x.jsxs)(`div`,{className:`metric-grid`,children:[(0,x.jsx)(ac,{label:`Deuda`,value:K(u.debt??0)}),(0,x.jsx)(ac,{label:`Cruces FFI`,value:K(u.crossings)})]}),(0,x.jsx)(`p`,{className:`muted tiny`,children:`La deuda de un fichero TS/JS es (complejidad máx. + 1) × (1 + fan-in): lo que costaría migrarlo.`}),d.length===0?(0,x.jsx)(`p`,{className:`muted small`,children:`Sin cruces FFI en este fichero.`}):(0,x.jsxs)(`div`,{className:`lens-edges`,children:[d.slice(0,Sc).map(e=>(0,x.jsxs)(`button`,{type:`button`,className:`lens-edge`,title:e.path,onClick:()=>a(e.path),children:[(0,x.jsx)(`span`,{className:`lens-flag lens-${e.kind}`,children:e.kind}),(0,x.jsxs)(`span`,{className:`lens-edge-path`,children:[e.direction===`out`?`→`:`←`,` `,e.path]})]},`${e.direction}-${e.path}-${e.kind}`)),d.length>Sc?(0,x.jsxs)(`span`,{className:`muted tiny`,children:[`y `,d.length-Sc,` cruces más.`]}):null]})]}):(0,x.jsx)(`p`,{className:`muted small`,children:`La lente no tiene datos de este fichero.`}):(0,x.jsx)(`p`,{className:`muted small`,children:`Este snapshot no trae lente de migración.`})]}),(0,x.jsxs)(`div`,{className:`lens-section`,children:[(0,x.jsx)(`div`,{className:`eyebrow`,children:`Símbolos`}),f.count===0?(0,x.jsx)(`p`,{className:`muted small`,children:`Sin símbolos en este fichero.`}):(0,x.jsxs)(x.Fragment,{children:[(0,x.jsxs)(`p`,{className:`muted small`,children:[f.count,` símbolo`,f.count===1?``:`s`,` ·`,` `,f.functions,` `,f.functions===1?`función`:`funciones`,f.variables>0?` · ${f.variables} ${f.variables===1?`variable`:`variables`}`:``]}),f.mostComplex?.complexity?(0,x.jsxs)(`p`,{className:`muted small`,children:[`El más complejo:`,` `,(0,x.jsx)(`b`,{className:`lens-symbol`,children:f.mostComplex.name}),` `,(0,x.jsx)(`span`,{className:`mono`,children:f.mostComplex.complexity})]}):null]})]})]})}var wc=[{status:`introduced`,title:`Nuevas`,empty:`Ninguna regla nueva: el cambio no rompe la arquitectura.`},{status:`existing`,title:`Existentes`,empty:`Sin deuda de arquitectura previa en este reporte.`},{status:`resolved`,title:`Resueltas`,empty:`No se ha resuelto ninguna violación.`}],Tc=25,Ec=[{title:`Riesgo`,detail:`complejidad, churn y tamaño`},{title:`Dominio`,detail:`reglas del reporte cargado`},{title:`Migración`,detail:`deuda y cruces FFI`},{title:`Símbolos`,detail:`funciones y complejidad`}];function Dc({report:e,source:t,error:n,onLoad:r,onSelectPath:i,file:a,model:o,migration:s,symbols:c}){let l=e?.rules??null,u=l?.summary??null,d=vc(l?[...l.violations.introduced,...l.violations.existing,...l.violations.resolved]:[]),f=e?.hotspots??[];return(0,x.jsxs)(`section`,{className:`rules-panel`,children:[(0,x.jsxs)(`div`,{className:`eyebrow`,children:[`Reglas`,e&&t?` · ${t}`:``]}),(0,x.jsx)(`h2`,{children:a?a.name:`Arquitectura del cambio`}),a?(0,x.jsx)(`div`,{className:`inspector-path`,title:a.path,children:a.path}):null,a?(0,x.jsx)(Cc,{model:o,file:a,migration:s,report:e,symbols:c,onSelectPath:i}):(0,x.jsxs)(`div`,{className:`rules-hint`,children:[(0,x.jsxs)(`p`,{className:`muted small`,children:[`Selecciona una celda para ver el fichero: `,(0,x.jsx)(`b`,{children:`por qué`}),` tiene ese riesgo, qué reglas de dominio toca y qué deuda de migración arrastra.`]}),(0,x.jsx)(`div`,{className:`lens-index`,children:Ec.map(e=>(0,x.jsxs)(`div`,{children:[(0,x.jsx)(`b`,{children:e.title}),(0,x.jsx)(`span`,{children:e.detail})]},e.title))})]}),(0,x.jsxs)(`div`,{className:`rules-change`,children:[(0,x.jsx)(`div`,{className:`eyebrow`,children:`El cambio`}),e?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsxs)(`div`,{className:`change-checksums mono`,children:[e.base.checksum.slice(0,8)||`base`,` →`,` `,e.head.checksum.slice(0,8)||`head`]}),l?.configured&&u?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsxs)(`div`,{className:`change-grid`,children:[(0,x.jsx)(Oc,{label:`Nuevas`,value:u.introduced,accent:u.introduced>0?`bad`:void 0}),(0,x.jsx)(Oc,{label:`Existentes`,value:u.existing}),(0,x.jsx)(Oc,{label:`Resueltas`,value:u.resolved,accent:u.resolved>0?`good`:void 0}),(0,x.jsx)(Oc,{label:`Errores nuevos`,value:u.introducedErrors,accent:u.introducedErrors>0?`bad`:void 0})]}),(0,x.jsxs)(`p`,{className:`rules-meta`,children:[u.introducedWarnings,` aviso`,u.introducedWarnings===1?``:`s`,` nuevo`,u.introducedWarnings===1?``:`s`,` ·`,` `,u.rules,` regla`,u.rules===1?``:`s`,` en`,` `,u.layers,` capa`,u.layers===1?``:`s`,l.profile?(0,x.jsxs)(x.Fragment,{children:[` `,`· perfil `,(0,x.jsx)(`b`,{children:l.profile})]}):null]}),d.length>0?(0,x.jsx)(`div`,{className:`rules-sources`,children:d.map(e=>(0,x.jsxs)(`span`,{className:`rules-chip`,children:[e.label,` `,(0,x.jsx)(`b`,{children:e.count})]},e.source))}):null,wc.map(e=>{let t=l.violations[e.status];return(0,x.jsxs)(`div`,{className:`rules-group`,children:[(0,x.jsxs)(`div`,{className:`rules-group-head`,children:[(0,x.jsx)(`div`,{className:`eyebrow`,children:e.title}),(0,x.jsx)(`span`,{className:`rules-count rules-count-${e.status}`,children:t.length})]}),t.length===0?(0,x.jsx)(`p`,{className:`muted small`,children:e.empty}):(0,x.jsx)(`div`,{className:`violation-list`,children:t.slice(0,Tc).map(t=>(0,x.jsx)(yc,{violation:t,status:e.status,onSelectPath:i},t.key))}),t.length>Tc?(0,x.jsxs)(`p`,{className:`muted tiny`,children:[`y `,t.length-Tc,` más en el reporte.`]}):null]},e.status)})]}):(0,x.jsxs)(`div`,{className:`change-section`,children:[(0,x.jsx)(`div`,{className:`eyebrow`,children:`Sin configuración`}),(0,x.jsxs)(`p`,{className:`muted small`,children:[`Este reporte no trae reglas de arquitectura. Añádelas a`,` `,(0,x.jsx)(`code`,{children:`.codarch.yml`}),` para que el diff las evalúe.`]})]}),(0,x.jsxs)(`div`,{className:`change-section`,children:[(0,x.jsxs)(`div`,{className:`eyebrow`,children:[`Hotspots · `,e.hotspotMetric??`métrica`]}),f.length===0?(0,x.jsx)(`p`,{className:`muted small`,children:`Ningún fichero destaca en la métrica del cambio.`}):(0,x.jsx)(`div`,{className:`change-rows`,children:f.map(e=>(0,x.jsxs)(`button`,{type:`button`,className:`change-row`,title:e.path,onClick:()=>i(e.path),children:[(0,x.jsx)(`span`,{className:`change-path`,children:e.path}),(0,x.jsxs)(`span`,{className:`mono change-delta${e.delta>0?` is-worse`:``}`,children:[K(e.base),` →`,` `,K(e.head)]})]},`${e.id}-${e.metric}`))})]})]}):(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(`p`,{className:`rules-empty-title`,children:`Sin reporte`}),(0,x.jsxs)(`p`,{className:`muted small`,children:[`Las reglas se evalúan en el diff. Carga el`,` `,(0,x.jsx)(`code`,{children:`report.json`}),` que genera `,(0,x.jsx)(`code`,{children:`codarch diff`}),` o la GitHub Action para ver qué rompe el cambio, qué deuda ya estaba y qué se ha resuelto.`]}),(0,x.jsx)(`button`,{className:`button dark`,type:`button`,onClick:r,children:`Abrir reporte`}),n?(0,x.jsx)(`p`,{className:`panel-error`,children:n}):null]})]})]})}function Oc({label:e,value:t,accent:n}){return(0,x.jsxs)(`div`,{className:`change-stat${n?` change-stat-${n}`:``}`,children:[(0,x.jsx)(`span`,{children:e}),(0,x.jsx)(`b`,{children:K(t)})]})}function kc({app:e,topbarActions:t,topbarTrailing:n,banner:r,overlay:i,onCancelAnalysis:a,onOpenHistory:o,onLoadReport:s,settings:c,className:l,onDragOver:u,onDragLeave:d,onDrop:f}){let{cc:p,source:m,areaMetric:h,colorMode:g,query:_,selectedIndex:v,error:y,loading:S,report:C,reportSource:w,reportError:T,tab:E,focusPath:D,progress:O,chain:k,zoom:A,center:ee,showLabels:te,pluginView:ne,watch:re,refreshedAt:j}=e.state,{selectIndex:M,openSymbolChain:N,zoomAt:ie,panMap:ae,fitMap:oe,setAreaMetric:se,setColorMode:ce,setQuery:le,setFocusPath:ue,setTab:de,setSettingsOpen:fe,setPluginView:pe}=e.actions,{view:P,detail:me,migration:he,hasChurn:F,metricOptions:I,metricTitle:ge,selectedFile:_e,selectedMigration:ve,selectedSymbols:ye,selectedStructure:be,pluginViews:L,activePluginView:xe,pluginContext:Se,matches:Ce,searchRef:we,addonsWithViews:Te,selectPath:Ee,loadHistory:De,loadHeat:Oe}=e,ke=(0,b.useRef)(null),Ae=P.model?.meta.title??p?.meta.projectName??`Sin snapshot`,R=(0,b.useMemo)(()=>me?.roots??[],[me]),je=t=>{ke.current?.removeAttribute(`open`),e.applyView(Cs(t.state))};return(0,x.jsxs)(`div`,{className:`app${l?` ${l}`:``}`,onDragOver:u,onDragLeave:d,onDrop:f,children:[(0,x.jsxs)(`header`,{className:`topbar`,children:[(0,x.jsxs)(`div`,{className:`brand`,children:[(0,x.jsx)(`span`,{className:`brand-mark`,children:`CODARCH`}),(0,x.jsx)(`span`,{className:`brand-sub`,children:`atlas de arquitectura`})]}),(0,x.jsxs)(`div`,{className:`snapshot-meta`,children:[(0,x.jsxs)(`span`,{className:`mono`,children:[m,P.model?.meta.checksum?` · ${P.model.meta.checksum.slice(0,8)}`:``,P.model?.meta.commit?` · ${P.model.meta.commit.slice(0,8)}`:``]}),(0,x.jsx)(Nc,{watch:re}),(0,x.jsx)(Mc,{at:j})]}),(0,x.jsxs)(`div`,{className:`topbar-actions`,children:[t,Te.length>0?(0,x.jsxs)(`details`,{className:`open-menu`,ref:ke,children:[(0,x.jsx)(`summary`,{className:`button ghost`,children:`Vistas`}),(0,x.jsx)(`div`,{className:`open-menu-panel`,children:Te.map(e=>(0,x.jsxs)(`div`,{className:`open-menu-group`,children:[(0,x.jsx)(`span`,{className:`open-menu-label`,title:e.description??e.title,children:e.title}),e.views.map(t=>(0,x.jsx)(`button`,{type:`button`,title:t.description??t.title,onClick:()=>je(t),children:t.title},`${e.name}:${t.id}`))]},e.name))})]}):null,n,(0,x.jsx)(`button`,{className:`button ghost icon-button`,type:`button`,onClick:()=>fe(!0),title:`Ajustes`,"aria-label":`Ajustes`,children:(0,x.jsxs)(`svg`,{viewBox:`0 0 16 16`,width:`14`,height:`14`,"aria-hidden":`true`,children:[(0,x.jsx)(`path`,{fill:`currentColor`,d:`M8 5.2a2.8 2.8 0 1 0 0 5.6 2.8 2.8 0 0 0 0-5.6Zm0 1.6a1.2 1.2 0 1 1 0 2.4 1.2 1.2 0 0 1 0-2.4Z`}),(0,x.jsx)(`path`,{fill:`currentColor`,d:`M6.6.9h2.8l.3 1.6c.4.1.8.3 1.1.5l1.4-.9 2 2-.9 1.4c.2.4.4.7.5 1.1l1.6.3v2.8l-1.6.3c-.1.4-.3.8-.5 1.1l.9 1.4-2 2-1.4-.9c-.4.2-.7.4-1.1.5l-.3 1.6H6.6l-.3-1.6c-.4-.1-.8-.3-1.1-.5l-1.4.9-2-2 .9-1.4c-.2-.4-.4-.7-.5-1.1l-1.6-.3V6.9l1.6-.3c.1-.4.3-.8.5-1.1l-.9-1.4 2-2 1.4.9c.3-.2.7-.4 1.1-.5L6.6.9Z`})]})})]})]}),(0,x.jsxs)(`div`,{className:`project-band`,children:[(0,x.jsxs)(`div`,{className:`project-ident`,children:[(0,x.jsx)(`span`,{className:`project-label`,children:`Proyecto`}),(0,x.jsx)(`h1`,{title:Ae,children:Ae})]}),D?(0,x.jsxs)(`div`,{className:`breadcrumb`,children:[(0,x.jsx)(`button`,{type:`button`,onClick:()=>ue(null),children:`Todo`}),(0,x.jsx)(`span`,{children:`/`}),(0,x.jsx)(`span`,{children:D})]}):null,(0,x.jsxs)(`div`,{className:`project-kpis`,children:[(0,x.jsx)(Xs,{label:`ficheros`,value:P.model?.fileCount??0}),(0,x.jsx)(Xs,{label:`carpetas`,value:P.model?.folderCount??0}),(0,x.jsx)(Xs,{label:P.model?.areaTitle??`área`,value:P.model?.totalArea??0}),(0,x.jsx)(Xs,{label:`deuda`,value:he?.summary.migrationDebt??0,accent:he?`debt`:void 0})]})]}),(0,x.jsxs)(`div`,{className:`shell`,children:[(0,x.jsxs)(`aside`,{className:`rail`,children:[(0,x.jsxs)(`section`,{className:`panel-block`,children:[(0,x.jsx)(`div`,{className:`eyebrow`,children:`Vista`}),(0,x.jsxs)(`label`,{className:`field`,children:[(0,x.jsx)(`span`,{children:`Área`}),(0,x.jsx)(`select`,{value:h??``,onChange:e=>se(e.target.value),children:I.map(e=>(0,x.jsx)(`option`,{value:e,children:ge(e)},e))})]}),(0,x.jsxs)(`label`,{className:`field`,children:[(0,x.jsx)(`span`,{children:`Color`}),(0,x.jsxs)(`select`,{value:g,onChange:e=>ce(e.target.value),children:[(0,x.jsx)(`option`,{value:`risk`,children:`Riesgo`}),(0,x.jsx)(`option`,{value:`structure`,children:`Estructura`}),F?(0,x.jsx)(`option`,{value:`churn`,children:`Calor (commits)`}):null,he?(0,x.jsx)(`option`,{value:`status`,children:`Estado de migración`}):null,I.map(e=>(0,x.jsx)(`option`,{value:e,children:ge(e)},e))]})]}),(0,x.jsxs)(`label`,{className:`field search-field`,children:[(0,x.jsx)(`span`,{children:`Buscar`}),(0,x.jsx)(`input`,{ref:we,type:`search`,placeholder:`ruta o fichero…`,title:`Pulsa / para buscar; Enter abre el primer resultado`,value:_,onChange:e=>le(e.target.value),onKeyDown:e=>{if(e.key!==`Enter`||!P.model)return;let t=_.trim().toLowerCase();if(!t)return;let n=P.model.files.find(e=>e.path.toLowerCase().includes(t));n&&(M(n.index),de(`file`))}})]}),_?(0,x.jsxs)(`div`,{className:`muted tiny`,children:[Ce,` de `,P.model?.fileCount??0,` ficheros`]}):null]}),(0,x.jsx)(Zs,{model:P.model,migration:he}),(0,x.jsx)(Qs,{colorMode:g,migration:he,model:P.model}),(0,x.jsx)($s,{load:De,onOpenSnapshot:o}),(0,x.jsx)(tc,{model:P.model,selectedIndex:v,onSelect:M}),(0,x.jsx)(nc,{load:Oe,onSelectSymbol:(e,t)=>{N(e,t)}}),(0,x.jsx)(rc,{model:P.model,migration:he,selectedIndex:v,onSelect:M})]}),(0,x.jsxs)(`main`,{className:`stage`,children:[r,L.length>0?(0,x.jsxs)(`div`,{className:`stage-tabs`,children:[(0,x.jsx)(`button`,{type:`button`,className:`stage-tab${ne===null?` is-active`:``}`,onClick:()=>pe(null),children:`Mapa`}),L.map(e=>(0,x.jsx)(`button`,{type:`button`,className:`stage-tab${ne===e.id?` is-active`:``}`,onClick:()=>pe(e.id),children:e.label},e.id))]}):null,(0,x.jsxs)(`div`,{className:`map-frame`,children:[S?(0,x.jsx)(`div`,{className:`empty`,children:`Cargando snapshot…`}):P.error||y?(0,x.jsxs)(`div`,{className:`empty error`,children:[(0,x.jsx)(`strong`,{children:`No se pudo dibujar el mapa.`}),(0,x.jsx)(`span`,{children:P.error??y})]}):P.model?ne&&xe?(0,x.jsx)(`div`,{className:`plugin-stage`,children:xe.render(Se)}):(0,x.jsx)(gs,{model:P.model,roots:R,colorMode:g,migration:he,query:_.trim().toLowerCase(),selectedIndex:v,onSelect:M,onFocusFolder:ue,zoom:A,center:ee,onZoomAt:ie,showLabels:te,onPan:ae}):(0,x.jsx)(`div`,{className:`empty`,children:`Abre un cc.json para empezar.`}),i]}),(0,x.jsxs)(`div`,{className:`stage-foot`,children:[(0,x.jsxs)(`div`,{className:`map-controls`,children:[(0,x.jsx)(`button`,{type:`button`,onClick:()=>ie(1.25),disabled:A>=8,title:`Acercar`,"aria-label":`Acercar`,children:`+`}),(0,x.jsxs)(`span`,{className:`map-zoom-level`,children:[Math.round(A*100),`%`]}),(0,x.jsx)(`button`,{type:`button`,onClick:()=>ie(1/1.25),disabled:A<=1,title:`Alejar`,"aria-label":`Alejar`,children:`−`}),(0,x.jsx)(`button`,{type:`button`,onClick:oe,disabled:A===1,title:`Ver el mapa entero`,children:`Ajustar`}),(0,x.jsx)(`span`,{className:`map-controls-hint`,title:`Con el botón derecho apretado, arrastra para mover el mapa`,children:`botón derecho: mover`})]}),(0,x.jsx)(`span`,{children:P.model?`${P.model.fileCount} ficheros · ${P.model.folderCount} carpetas · ${P.model.meta.apiVersion}`:`—`}),O?(0,x.jsxs)(`span`,{className:`progress-cell`,children:[(0,x.jsx)(`span`,{className:`mono detail-note`,children:O}),a?(0,x.jsx)(`button`,{className:`button ghost small`,type:`button`,onClick:a,title:`Cortar el análisis`,children:`Cancelar`}):null]}):me&&me.hiddenFiles>0?(0,x.jsx)(`span`,{className:`mono detail-note`,children:`nivel carpeta · ${me.cells} bloques · ${me.hiddenFiles} ficheros dentro`}):(0,x.jsx)(`span`,{className:`mono`,children:P.model?.warnings[0]??`clic en una celda para inspeccionar`})]})]}),(0,x.jsxs)(`aside`,{className:`inspector`,children:[(0,x.jsxs)(`div`,{className:`tabs`,role:`tablist`,"aria-label":`Panel derecho`,children:[(0,x.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":E===`file`,className:`tab${E===`file`?` is-active`:``}`,onClick:()=>de(`file`),children:`Fichero`}),(0,x.jsxs)(`button`,{type:`button`,role:`tab`,"aria-selected":E===`rules`,className:`tab${E===`rules`?` is-active`:``}`,onClick:()=>de(`rules`),children:[`Reglas`,` `,C?.rules.summary.introduced?(0,x.jsx)(`i`,{className:`tab-dot tab-dot-alert`,title:`${C.rules.summary.introduced} violaciones nuevas`}):null]}),(0,x.jsxs)(`button`,{type:`button`,role:`tab`,"aria-selected":E===`changes`,className:`tab${E===`changes`?` is-active`:``}`,onClick:()=>de(`changes`),children:[`Cambios`,` `,C?(0,x.jsx)(`i`,{className:`tab-dot`,title:`Reporte cargado`}):null]})]}),E===`file`?(0,x.jsx)(ic,{model:P.model,file:_e,migrationNode:ve,areaMetric:h,colorMode:g,metricTitle:ge,symbols:ye,structure:be,chain:k,onSelectSymbol:e=>{N(e,_e?.path??``)},onColorMode:ce}):E===`rules`?(0,x.jsx)(Dc,{report:C,source:w,error:T,onLoad:s,onSelectPath:e=>{let t=P.model?.files.findIndex(t=>t.path===e)??-1;t>=0&&M(t)},file:_e,model:P.model,migration:he,symbols:ye}):(0,x.jsx)(oc,{report:C,source:w,error:T,onLoad:s,onSelectPath:Ee})]})]}),c]})}var Ac={live:`live`,paused:`live en pausa`,none:`sin vigilancia`},jc={live:`El repositorio se reanaliza al guardar y el mapa se refresca solo.`,paused:`La vigilancia está en pausa: el mapa no cambia hasta reanalizar.`,none:`Sin vigilancia: el mapa se actualiza al analizar el repositorio.`};function Mc({at:e}){return(0,x.jsx)(`span`,{className:`refresh-notice${e===null?``:` is-new`}`,title:`El mapa se ha puesto al día con lo que hay en el repositorio.`,"aria-live":`polite`,children:`actualizado`},e??0)}function Nc({watch:e}){return(0,x.jsxs)(`span`,{className:`watch-indicator watch-${e}`,title:jc[e],children:[(0,x.jsx)(`i`,{}),Ac[e]]})}var Pc=`modulepreload`,Fc=function(e){return`/`+e},Ic={},Lc=function(e){return e.pathname.endsWith(`.css`)},Rc=function(e,t,n){if(t in e)return e[t];let r=n();if(!r){e[t]=void 0;return}let i=r.then(()=>{e[t]=void 0},n=>{throw e[t]=void 0,n});return e[t]=i,i},zc=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e,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?new URL(import.meta.resolve(e)):new URL(e,import.meta.url)}r=o(t.map(t=>{t=Fc(t,n);let r=s(t),i=Lc(r);return Rc(Ic,r.href,()=>{if(e===void 0){e={all:new Set,styles:new Set};let t=document.getElementsByTagName(`link`);for(let n=t.length-1;n>=0;n--){let r=t[n];e.all.add(r.href),r.rel===`stylesheet`&&e.styles.add(r.href)}}if((i?e.styles:e.all).has(r.href))return;let t=document.createElement(`link`);if(t.rel=i?`stylesheet`:Pc,i||(t.as=`script`),t.crossOrigin=``,t.href=r.href,a&&t.setAttribute(`nonce`,a),document.head.appendChild(t),i)return new Promise((e,n)=>{t.addEventListener(`load`,e),t.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${r}`)))})})}).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)})},Bc=[{manifest:{name:`vista-3d`,version:`0.2.0`,title:`Vista 3D`,description:`El mapa en tres dimensiones: cada fichero es una caja, la altura dice cuánto pesa y las carpetas son contenedores.`,icon:`cube`,contributes:{views:[`vista-3d`]},requires:{webgl2:!0}},load:async()=>{let e=await zc(()=>import(`./vista-3d-C9oZ2pdB.js`),__vite__mapDeps([0,1]));return e.default??e}}];function Vc(e){let[t,n]=(0,b.useState)(()=>e.read()),[r,i]=(0,b.useState)({}),[a,o]=(0,b.useState)([]);(0,b.useEffect)(()=>{let e=!1;return(async()=>{for(let n of Bc){let a=n.manifest.name;if(t.includes(a)&&!r[a])try{let t=await n.load();if(e)return;i(e=>({...e,[a]:t}))}catch{if(e)return;o(e=>e.includes(a)?e:[...e,a])}}})(),()=>{e=!0}},[t,r]);let s=(0,b.useCallback)((t,r)=>{n(n=>{let i=zr(n,t,r);return e.write(i),i})},[e]),c=(0,b.useCallback)(e=>r[e]??null,[r]);return(0,b.useMemo)(()=>({descriptors:Bc,enabled:t,toggle:s,moduleOf:c,failed:a}),[t,s,c,a])}function Hc(e,t){for(let n of e){if(n.kind===`folder`&&n.path===t)return n;if(n.children){let e=Hc(n.children,t);if(e)return e}}return null}var Uc={maxFiles:800,maxCells:1500};function Wc(e){return e.kind===`file`?e:{kind:`folder`,key:e.key,name:e.name,path:e.path,value:e.value,fileCount:e.fileCount,section:e.section,children:[]}}function Gc(e,t){if(e.kind===`file`)return{node:e,cells:1,visibleFiles:1,collapsedFolders:0};let n=e.children??[];if(e.fileCount<=t.maxFiles){let r=0,i=0,a=0,o=[];for(let e of n){let n=Gc(e,t);o.push(n.node),r+=n.cells,i+=n.visibleFiles,a+=n.collapsedFolders}return{node:{...e,children:o},cells:r+1,visibleFiles:i,collapsedFolders:a}}let r=n.map(Wc),i=r.length>t.maxCells?[...r].sort((e,t)=>t.value-e.value||e.path.localeCompare(t.path)).slice(0,t.maxCells):r,a=i.filter(e=>e.kind===`file`).length;return{node:{...e,children:i},cells:i.length+1,visibleFiles:a,collapsedFolders:1}}function Kc(e,t=Uc,n=0){let r=0,i=0,a=0,o=[];for(let n of e){let e=Gc(n,t);o.push(e.node),r+=e.cells,i+=e.visibleFiles,a+=e.collapsedFolders}return{roots:o,cells:r,visibleFiles:i,hiddenFiles:Math.max(0,n-i),collapsedFolders:a}}function qc(e,t={}){let[n,r]=(0,b.useState)(null),[i,a]=(0,b.useState)(t.sourceInicial??`sin proyecto`),[o,s]=(0,b.useState)(null),[c,l]=(0,b.useState)(`risk`),[u,d]=(0,b.useState)(``),[f,p]=(0,b.useState)(null),[m,h]=(0,b.useState)(null),[g,_]=(0,b.useState)(!0),[v,y]=(0,b.useState)(null),[x,S]=(0,b.useState)(null),[C,w]=(0,b.useState)(null),[T,E]=(0,b.useState)(`file`),D=(0,b.useRef)(T);(0,b.useEffect)(()=>{D.current=T},[T]);let[O,k]=(0,b.useState)(null),[A,ee]=(0,b.useState)(null),[te,ne]=(0,b.useState)(null),[re,j]=(0,b.useState)(!1),[M,N]=(0,b.useState)(1),[ie,ae]=(0,b.useState)({x:.5,y:.5}),[oe,se]=(0,b.useState)(!0),ce=Vc(e.plugins),[le,ue]=(0,b.useState)([]),[de,fe]=(0,b.useState)(null),[pe,P]=(0,b.useState)(`none`),[me,he]=(0,b.useState)(null),F=(0,b.useRef)(void 0),I=(0,b.useRef)(null),ge=(0,b.useRef)(null);F.current===void 0&&(F.current=e.leerPreferencias());let _e=(0,b.useRef)(null),ve=(0,b.useCallback)((e,t)=>{let n=Math.min(8,Math.max(1,M*e));if(n!==M){if(t){let e=t.x-ie.x,r=t.y-ie.y,i=1-n/M;ae({x:Math.min(1,Math.max(0,ie.x+e*i)),y:Math.min(1,Math.max(0,ie.y+r*i))})}N(n)}},[M,ie]),ye=(0,b.useCallback)((e,t)=>{ae(n=>{let r=1-1/M;return r<=.001?n:{x:Math.min(1,Math.max(0,n.x-e/r)),y:Math.min(1,Math.max(0,n.y-t/r))}})},[M]),be=(0,b.useCallback)(()=>{N(1),ae({x:.5,y:.5})},[]),L=(0,b.useMemo)(()=>n?vo(n):null,[n]),xe=(0,b.useMemo)(()=>so(n),[n]),Se=(0,b.useMemo)(()=>L?L.metricCoverage.some(e=>e.name===ss):!1,[L]),Ce=(0,b.useCallback)((e,t,n=!1,i)=>{try{let o=mo(e),c=vo(o),u=new Set(c.metricCoverage.map(e=>e.name)),f=u.has(`rloc`)?`rloc`:yo(c)??c.metricCoverage[0]?.name??null,m=i??F.current,g=m?.areaMetric&&u.has(m.areaMetric)?m.areaMetric:f,_=m?.colorMode,v=_&&(_===`risk`||_===`structure`||_===`status`&&o.lenses?.migration||u.has(_))?_:null,y=o.lenses?.migration&&u.has(`migrationDebt`)?`migrationDebt`:`risk`,b=o.meta.checksum??null,x=I.current;return I.current=b,n&&x&&b!==x&&he(Date.now()),r(o),a(t),s(e=>n&&e&&u.has(e)?e:g),l(e=>n?e===`risk`||e===`structure`||e===`status`||u.has(e)?e:`risk`:v??y),n||(d(``),_e.current=null,p(null),k(null),i&&se(i.showLabels)),h(null),!0}catch(e){return h(e.message),!1}finally{_(!1)}},[]),we=(0,b.useCallback)((e,t,n=!0)=>{let r=oo(e);return r?(y(r),S(t),w(null),n&&D.current!==`rules`&&E(`changes`),!0):(w(`El fichero ${t} no parece un report.json de CodArch.`),!1)},[]),Te=(0,b.useCallback)(()=>{y(null),S(null),w(null),E(`file`)},[]),Ee=(0,b.useCallback)((t,n)=>Ce(t,n)?(ue([]),e.escribirProyecto({snapshot:t,report:null,label:n,reportLabel:null,addons:[]}),Te(),!0):!1,[Ce,Te,e]),De=(0,b.useCallback)((t,r)=>{if(!we(t,r))return!1;let a=e.leerProyecto();if(a){let o=n&&i===a.label?n:a.snapshot;e.escribirProyecto({...a,snapshot:o,report:t,reportLabel:r})}return!0},[n,we,e,i]),Oe=(0,b.useCallback)(async()=>{let{elegirCarpeta:t,analizar:n}=e;if(!t||!n)return;let r=await t();if(r){_(!0),h(null),ee(`Analizando ${r}...`);try{let t=await n(r);Ce(t.snapshot,r,!1,t.preferences)&&(ue(t.addons.addons),e.escribirProyecto({snapshot:t.snapshot,report:null,label:r,reportLabel:null,addons:t.addons.addons}),Te())}catch(e){h(e.message)}finally{ee(null),_(!1)}}},[Ce,Te,e]),ke=(0,b.useCallback)(async()=>{let{elegirFichero:t,leerJson:n}=e;if(!t||!n)return;let r=await t();if(r){_(!0),h(null);try{Ee(await n(r),r)}catch(e){h(e.message)}finally{_(!1)}}},[e,Ee]),Ae=(0,b.useCallback)(async()=>{let{elegirFichero:t,leerJson:n}=e;if(!t||!n)return;let r=await t();if(r)try{De(await n(r),r)}catch(e){h(e.message)}},[e,De]),R=(0,b.useMemo)(()=>{if(!n||!o)return{model:null,error:null};try{return{model:Fo(n,{areaMetric:o,color:c===`status`?`risk`:c,title:n.meta.projectName}),error:null}}catch(e){return{model:null,error:e.message}}},[n,o,c]),je=(0,b.useMemo)(()=>{if(!R.model)return null;let e=O?Hc(R.model.roots,O):null;return Kc(e?[e]:R.model.roots,Uc,e?e.fileCount:R.model.fileCount)},[R.model,O]),Me=(0,b.useCallback)(e=>{p(e);let t=e===null?void 0:R.model?.files[e];_e.current=t?.path??null},[R.model]),Ne=(0,b.useCallback)(async(t,n)=>{let r=R.model?.files.find(e=>e.path===n);if(r&&Me(r.index),!e.cadenas)return;let i=await e.cadenas(t),a=i&&typeof i==`object`?i.chains:null;!Array.isArray(a)||a.length===0?ne(null):ne(a[0]??null)},[R.model,Me,e]),Pe=(0,b.useRef)(null),Fe=(0,b.useMemo)(()=>L?Fs(L.metricCoverage.map(e=>e.name)):[],[L]),Ie=n?.lenses?.metrics?.attributeDescriptors,Le=(0,b.useCallback)(e=>Ie?.[e]?.title??e,[Ie]),Re=(0,b.useMemo)(()=>Fe.map(e=>({value:e,label:Le(e)})),[Fe,Le]),ze=(0,b.useMemo)(()=>{let e=[{value:`risk`,label:`Riesgo`},{value:`structure`,label:`Estructura`}];Se&&e.push({value:`churn`,label:`Calor (commits)`}),xe&&e.push({value:`status`,label:`Estado de migración`});for(let t of Re)e.push(t);return e},[Se,xe,Re]),Be=R.model&&f!==null?R.model.files[f]??null:null,Ve=Be?xe?.nodes[Be.nodeId]??null:null,He=(0,b.useMemo)(()=>Be&&n?xo(n,Be.nodeId):[],[n,Be]),Ue=(0,b.useMemo)(()=>Be&&n?n.lenses?.structure?.nodes[Be.nodeId]??null:null,[n,Be]),We=(0,b.useMemo)(()=>{let e=[];for(let t of ce.descriptors){if(!ce.enabled.includes(t.manifest.name))continue;let n=ce.moduleOf(t.manifest.name);for(let t of n?.views??[])e.push(t)}return e},[ce]),Ge=We.find(e=>e.id===de)??null,Ke=(0,b.useMemo)(()=>({model:R.model,selection:Be?.path??null,actions:{select:e=>{let t=R.model?.files.findIndex(t=>t.path===e);t!==void 0&&t>=0&&Me(t)},focus:e=>k(e),setTab:e=>E(e)},preferences:{areaMetric:o,colorMode:c},colorFor:e=>{let t=R.model?.files[e];return!t||!R.model?`#d5d2ca`:us(t,c,R.model,xe,ls(R.model))},url:{read:()=>({areaMetric:o,colorMode:c,focusPath:O,filePath:Be?.path??null,tab:T}),write:e=>{e.areaMetric!==void 0&&s(e.areaMetric),e.colorMode!==void 0&&l(e.colorMode),e.focusPath!==void 0&&k(e.focusPath)}},storage:Os()}),[R.model,Be,o,c,O,T,Me,xe]),qe=(0,b.useMemo)(()=>{if(!R.model||u.trim()===``)return R.model?.fileCount??0;let e=u.trim().toLowerCase();return R.model.files.filter(t=>t.path.toLowerCase().includes(e)).length},[R.model,u]),Je=(0,b.useMemo)(()=>le.filter(e=>e.views.length>0),[le]),Ye=(0,b.useCallback)(e=>{let t=R.model?.files.findIndex(t=>t.path===e)??-1;t>=0&&(Me(t),E(`file`))},[Me,R.model]),Xe=(0,b.useCallback)(e=>{if(!R.model||!L)return;let t=new Set(L.metricCoverage.map(e=>e.name));if(e.areaMetric&&t.has(e.areaMetric)&&s(e.areaMetric),e.colorMode&&ws(e.colorMode,t,xe)&&l(e.colorMode),e.focusPath&&Hc(R.model.roots,e.focusPath)&&k(e.focusPath),e.filePath){let t=R.model.files.findIndex(t=>t.path===e.filePath);t>=0&&Me(t)}e.tab&&E(e.tab),e.showLabels!==null&&se(e.showLabels),e.symbolName&&Ne(e.symbolName,e.filePath??``)},[R.model,L,xe,Me,Ne]),Ze=(0,b.useCallback)(async()=>e.historial?e.historial():null,[e]),Qe=(0,b.useCallback)(async()=>e.calor?e.calor():null,[e]);return(0,b.useEffect)(()=>{let e=R.model?.files;if(!e){Me(null);return}let t=_e.current;if(t){let n=e.findIndex(e=>e.path===t);if(n>=0){Me(n);return}}Me(R.model?.defaultSelection??null)},[R.model,Me]),(0,b.useEffect)(()=>{if(typeof window>`u`)return;let e=e=>{let t=e.target,n=t instanceof HTMLInputElement||t instanceof HTMLTextAreaElement||t instanceof HTMLSelectElement;e.key===`/`&&!n?(e.preventDefault(),Pe.current?.focus()):e.key===`Escape`&&(k(null),_e.current=null,p(null),d(``),n&&t.blur())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[]),(0,b.useEffect)(()=>{if(!n||!o)return;let t={areaMetric:o,colorMode:c,showLabels:oe};F.current=t;let r=JSON.stringify(t);r!==ge.current&&(ge.current=r,e.escribirPreferencias(t))},[n,o,c,oe,e]),(0,b.useEffect)(()=>{if(!e.restaurarProyecto)return;let t=!1;return(async()=>{let n=await e.restaurarProyecto?.();t||(n&&Ce(n.snapshot,n.label,!1,n.preferences)?(ue(n.addons??[]),n.report&&we(n.report,n.reportLabel??`report.json`,!1)):(n&&e.borrarProyecto(),_(!1)))})(),()=>{t=!0}},[Ce,we,e]),{state:{cc:n,source:i,areaMetric:o,colorMode:c,query:u,selectedIndex:f,error:m,loading:g,report:v,reportSource:x,reportError:C,tab:T,focusPath:O,progress:A,chain:te,settingsOpen:re,zoom:M,center:ie,showLabels:oe,addons:le,pluginView:de,watch:pe,refreshedAt:me},actions:{loadSnapshot:Ce,loadReport:we,resetReport:Te,analyzeFolder:Oe,openSnapshotFile:ke,openReportFile:Ae,abrirSnapshot:Ee,abrirReporte:De,selectIndex:Me,openSymbolChain:Ne,zoomAt:ve,panMap:ye,fitMap:be,setAreaMetric:s,setColorMode:l,setQuery:d,setFocusPath:k,setTab:E,setSettingsOpen:j,setZoom:N,setCenter:ae,setShowLabels:se,setPluginView:fe,setChain:ne,setError:h,setReportError:w,setAddons:ue,setSelectedIndex:p,setLoading:_,setProgress:ee,setWatch:P},view:R,detail:je,stats:L,migration:xe,hasChurn:Se,plugins:ce,preferencesRef:F,selectedPathRef:_e,zoomAt:ve,panMap:ye,fitMap:be,searchRef:Pe,metricOptions:Fe,metricTitle:Le,areaOptions:Re,colorOptions:ze,selectedFile:Be,selectedMigration:Ve,selectedSymbols:He,selectedStructure:Ue,pluginViews:We,activePluginView:Ge,pluginContext:Ke,matches:qe,selectPath:Ye,addonsWithViews:Je,applyView:Xe,loadHistory:Ze,loadHeat:Qe}}function Jc({items:e,children:t,ref:n}){return(0,x.jsxs)(`details`,{className:`open-menu`,ref:n,children:[(0,x.jsxs)(`summary`,{className:`button`,children:[(0,x.jsx)(`span`,{className:`button-label-long`,children:`Abrir repositorio o archivo`}),(0,x.jsx)(`span`,{className:`button-label-short`,children:`Abrir`})]}),(0,x.jsxs)(`div`,{className:`open-menu-panel`,children:[e.map(e=>(0,x.jsx)(`button`,{type:`button`,disabled:e.disabled,title:e.title,onClick:t=>{e.keepOpen||t.currentTarget.closest(`details`)?.removeAttribute(`open`),e.onClick()},children:e.label},e.label)),t]})]})}async function Yc(){let e=window.showDirectoryPicker;if(!e)throw Error(`Este navegador no permite seleccionar carpetas. Abre el snapshot.cc.json o usa Chrome/Edge.`);let t=await e({mode:`read`}),n;try{n=await t.getDirectoryHandle(`.codarch`)}catch{throw Error(`No se encontró .codarch en "${t.name}". Para artefactos ejecuta "codarch analyze ."; para datos en vivo, "codarch serve ." en la raíz del repo.`)}let r=await Zc(n,`snapshot.cc.json`,!0),i=await Zc(n,`report.json`,!1);return{snapshot:r,report:i,label:`${t.name}/.codarch/snapshot.cc.json`,reportLabel:i===null?null:`${t.name}/.codarch/report.json`}}async function Xc(e){let t=e.map(e=>({file:e,path:(e.webkitRelativePath||e.name).replace(/\\/g,`/`)})),n=t.find(e=>e.path.endsWith(`/.codarch/snapshot.cc.json`)||e.path===`.codarch/snapshot.cc.json`);if(!n)throw Error(`No se encontró ".codarch/snapshot.cc.json" en la carpeta. Para artefactos ejecuta "codarch analyze ."; para datos en vivo, "codarch serve ." en la raíz del repo.`);let r=t.find(e=>e.path.endsWith(`/.codarch/report.json`)||e.path===`.codarch/report.json`);return{snapshot:await Qc(n.file),report:r?await Qc(r.file):null,label:n.path,reportLabel:r?.path??null}}async function Zc(e,t,n){try{return await Qc(await(await e.getFileHandle(t)).getFile())}catch(e){if(!n)return null;throw Error(`No se pudo leer ${t}: ${e.message}`)}}async function Qc(e){return JSON.parse(await e.text())}var $c=`codarch.preferences.v1`,el=`codarch.plugins.v1`,tl=`codarch.project.v1`,nl=25e5;function rl(e=ul()){if(!e)return null;try{let t=e.getItem($c);return t?Ds(JSON.parse(t)):null}catch{return null}}function il(e,t=ul()){if(t)try{t.setItem($c,JSON.stringify(e))}catch{}}function al(e=ul()){if(!e)return[];try{let t=e.getItem(el);if(!t)return[];let n=JSON.parse(t);return Array.isArray(n)?n.filter(e=>typeof e==`string`):[]}catch{return[]}}function ol(e,t=ul()){if(t)try{t.setItem(el,JSON.stringify([...e]))}catch{}}function sl(e=ul()){if(!e)return null;try{let t=e.getItem(tl);if(!t)return null;let n=JSON.parse(t);return typeof n!=`object`||!n||typeof n.label!=`string`||typeof n.snapshot!=`object`||n.snapshot===null?(e.removeItem(tl),null):{snapshot:n.snapshot,report:n.report===null||n.report===void 0?null:n.report,label:n.label,reportLabel:typeof n.reportLabel==`string`?n.reportLabel:null}}catch{return e.removeItem(tl),null}}function cl(e,t=ul()){if(!t)return!1;try{let n=JSON.stringify(e);return n.length>nl?!1:(t.setItem(tl,n),!0)}catch{return!1}}function ll(e=ul()){if(e)try{e.removeItem(tl)}catch{}}function ul(){try{return typeof window>`u`?null:window.localStorage}catch{return null}}var dl=class extends Error{constructor(){super(`Análisis cancelado`),this.name=`AnalysisCancelled`}};function fl(e){let t=new Worker(new URL(`/assets/worker-BkCQ9RP6.js`,``+import.meta.url),{type:`module`}),n=!1,r=()=>void 0;return{result:new Promise((n,i)=>{r=i;let a=()=>{t.terminate()};t.addEventListener(`message`,t=>{let r=t.data;r.type===`progress`?e.onProgress?.(r.message):r.type===`progress-file`?e.onFileProgress?.({done:r.done,total:r.total,current:r.current}):r.type===`error`?(a(),i(Error(r.message))):r.type===`done`&&(a(),n({snapshot:r.snapshot,files:r.files,edges:r.edges,warnings:r.warnings,durationMs:r.durationMs}))}),t.addEventListener(`error`,e=>{a(),i(Error(e.message||`el worker de análisis falló`))});let o={type:`analyze`,files:e.files,projectName:e.projectName};t.postMessage(o)}),cancel:()=>{n||(n=!0,t.terminate(),r(new dl))}}}var pl=class{caseSensitive;files;constructor(e=[],t=!0){this.files=new Map,this.caseSensitive=t;for(let[t,n]of e)this.files.set(t,n)}readFile(e){let t=this.tryReadFile(e);if(t===null)throw Error(`no existe el fichero: ${e}`);return t}tryReadFile(e){return this.files.get(e)??null}readDirectory(e){let t=e===`/`?`/`:`${e}/`,n=new Map;for(let e of this.files.keys()){if(!e.startsWith(t))continue;let r=e.slice(t.length);if(r===``)continue;let i=r.indexOf(`/`);if(i===-1){n.set(r,{name:r,isDirectory:!1,isFile:!0});continue}let a=r.slice(0,i);n.set(a,{name:a,isDirectory:!0,isFile:!1})}return[...n.values()].sort((e,t)=>e.name<t.name?-1:+(e.name>t.name))}exists(e){if(this.files.has(e))return!0;let t=e===`/`?`/`:`${e}/`;for(let e of this.files.keys())if(e.startsWith(t))return!0;return!1}set(e,t){this.files.set(e,t)}paths(){return[...this.files.keys()].sort()}entries(){return[...this.files.entries()].sort((e,t)=>e[0]<t[0]?-1:+(e[0]>t[0]))}},ml=[`.ts`,`.tsx`,`.mts`,`.cts`,`.js`,`.jsx`,`.mjs`,`.cjs`],hl=new Set([`package.json`,`tsconfig.json`,`jsconfig.json`,`.codarch.yml`,`.codarch.yaml`]),gl=new Set([`.git`,`node_modules`,`.codarch`,`dist`,`build`,`coverage`,`.next`,`out`,`target`,`.turbo`,`.cache`,`.venv`,`__pycache__`]),_l=2e4;async function vl(e,t={}){let n=t.limit??_l,r=new Map,i=0,a=async(e,o)=>{if(!t.signal?.aborted&&!(i>=n))for await(let[s,c]of e.entries()){if(t.signal?.aborted||i>=n)return;let e=o===``?`/${s}`:`${o}/${s}`;if(c.kind===`directory`){if(gl.has(s))continue;await a(c,e);continue}if(!yl(s))continue;let l=await c.getFile();r.set(e,await l.text()),i+=1,t.onProgress?.({read:i,current:e})}};if(await a(e,``),i>=n)throw Error(`Se han leído ${i} ficheros, el tope de la análise en el navegador. Analiza el repositorio con "codarch analyze" para verlos todos.`);return{fileSystem:new pl(r),count:i}}function yl(e){if(hl.has(e))return!0;let t=e.toLowerCase();return ml.some(e=>t.endsWith(e))}function bl(){return window.showDirectoryPicker??null}async function xl(e){try{let t=await fetch(e);return!t.ok||t.status===204?null:await t.json()}catch{return null}}async function Sl(e){let t;try{t=await fetch(e)}catch(t){throw Error(`no se pudo contactar con ${e} (${t.message}). Si el origen no permite CORS, sirve el fichero desde el mismo servidor.`)}if(!t.ok)throw Error(`respondió ${t.status}`);try{return await t.json()}catch(e){throw Error(`el JSON no es válido (${e.message})`)}}function Cl(){return{leerPreferencias:()=>rl(),escribirPreferencias:e=>il(e),leerProyecto:()=>sl(),escribirProyecto:e=>cl(e),borrarProyecto:()=>ll(),cadenas:async e=>xl(`data/chains.json?symbol=${encodeURIComponent(e)}`),historial:async()=>{let e=await xl(`data/history.json`);if(!e||typeof e!=`object`)return null;let t=e.entries;return Array.isArray(t)?t:null},calor:async()=>{let e=await xl(`data/chains.json`);if(!e||typeof e!=`object`)return null;let t=e.heat;return Array.isArray(t)?t:null},plugins:{read:()=>al(),write:e=>ol(e)}}}function wl(){let e=qc((0,b.useMemo)(()=>Cl(),[]),{sourceInicial:`sin proyecto`}),{areaMetric:t,colorMode:n,selectedIndex:r,focusPath:i,tab:a,chain:o,settingsOpen:s,showLabels:c,addons:l}=e.state,{loadSnapshot:u,loadReport:d,resetReport:f,abrirSnapshot:p,abrirReporte:m,setAreaMetric:h,setColorMode:g,setSettingsOpen:_,setShowLabels:v,setError:y,setReportError:C,setAddons:w,setLoading:T,setProgress:E,setWatch:D}=e.actions,{view:O,stats:k,plugins:A,areaOptions:ee,colorOptions:te,applyView:ne}=e,[re,j]=(0,b.useState)(!1),[M,N]=(0,b.useState)(`static`),[ie,ae]=(0,b.useState)(``),[oe,se]=(0,b.useState)(null),[ce,le]=(0,b.useState)(!1),[ue,de]=(0,b.useState)(null),[fe,pe]=(0,b.useState)(null),[P,me]=(0,b.useState)(``),[he,F]=(0,b.useState)(``),I=(0,b.useRef)(null),ge=(0,b.useRef)(null),[_e,ve]=(0,b.useState)(!1);(0,b.useEffect)(()=>{D(M===`live`?`live`:M===`served`?`paused`:`none`)},[M,D]);let ye=(0,b.useRef)(null),be=(0,b.useRef)(null),L=(0,b.useRef)(null),xe=(0,b.useRef)(null),Se=(0,b.useRef)(!1),Ce=(0,b.useRef)(null);if(Ce.current===null){let e=typeof window>`u`?``:window.location.search;Ce.current={view:xs(e),source:Ss(e)}}let we=(0,b.useCallback)(async(e,t)=>{let n=await xl(e);n?u(n,t):y(`No se pudo abrir ${t}`)},[u]),Te=(0,b.useCallback)(async()=>{let e=await xl(`data/addons.json`);w(Array.isArray(e?.addons)?e.addons:[])},[]);(0,b.useEffect)(()=>{let e=!1;return(async()=>{let t=Ce.current?.source;if(t?.snapshotUrl)try{let n=await Sl(t.snapshotUrl);if(e)return;if(Se.current=!0,u(n,t.snapshotUrl)){if(N(`local`),de(t.snapshotUrl),t.reportUrl)try{let n=await Sl(t.reportUrl);!e&&n&&(d(n,t.reportUrl),pe(t.reportUrl))}catch(t){e||C(`No se pudo cargar el reporte: ${t.message}`)}return}T(!1);return}catch(n){e||(N(`local`),y(`No se pudo cargar ${t.snapshotUrl}: ${n.message}`),T(!1));return}let n=await xl(`data/meta.json`),r=await xl(`data/snapshot.cc.json`);if(Se.current)return;if(r){if(e)return;u(r,`servidor local`);let t=typeof n==`object`&&!!n&&n.watch===!0;N(t?`live`:`served`),typeof n==`object`&&n&&typeof n.rootPath==`string`&&ae(n.rootPath),typeof n==`object`&&n&&typeof n.version==`string`&&se(n.version);let i=await xl(`data/report.json`);i&&!e&&d(i,`servidor local`),await Te();return}let i=sl();if(i&&!e&&!Se.current){if(u(i.snapshot,i.label)){N(`local`),i.report?d(i.report,i.reportLabel??`report.json`,!1):f();return}ll()}e||T(!1)})().catch(t=>{e||(y(t.message),T(!1))}),()=>{e=!0}},[d,u,Te]),(0,b.useEffect)(()=>{if(M!==`live`||typeof EventSource>`u`)return;let e=new EventSource(`/events`);return e.addEventListener(`update`,async()=>{let e=await xl(`data/snapshot.cc.json`);e&&u(e,`servidor local`,!0);let t=await xl(`data/report.json`);t&&d(t,`servidor local`,!1)}),()=>e.close()},[M,d,u]);let[Ee,De]=(0,b.useState)(!1);(0,b.useEffect)(()=>{if(Ee||!O.model||!k)return;let e=Ce.current?.view;e&&ne(e),De(!0)},[Ee,O.model,k,ne]),(0,b.useEffect)(()=>{if(!Ee||!O.model||typeof window>`u`)return;let e=r===null?void 0:O.model.files[r],s=Ts({areaMetric:t,colorMode:n,focusPath:i,filePath:e?.path??null,tab:a,symbolName:o?.name??null,showLabels:c},{snapshotUrl:ue,reportUrl:fe});s!==window.location.search&&window.history.replaceState(null,``,`${window.location.pathname}${s}${window.location.hash}`)},[Ee,O.model,t,n,i,r,a,o,c,ue,fe]);let Oe=(0,b.useMemo)(()=>s?sl()?.label??null:null,[s]),ke=(0,b.useMemo)(()=>Os()!==null,[]),Ae=(0,b.useMemo)(()=>oe??`0.3.21`,[oe]),R=(0,b.useCallback)(async e=>{Se.current=!0;try{let t=JSON.parse(await e.text());p(t,e.name)&&(N(`local`),de(null),pe(null))}catch(t){y(`JSON inválido en ${e.name}: ${t.message}`)}},[p]),je=(0,b.useCallback)(async e=>{let t=e.target.files?.[0];e.target.value=``,t&&await R(t)},[R]),Me=(0,b.useCallback)(async e=>{e.preventDefault(),j(!1);let t=e.dataTransfer.files?.[0];t&&await R(t)},[R]),Ne=(0,b.useCallback)(async e=>{let t=e.target.files?.[0];if(e.target.value=``,t)try{m(JSON.parse(await t.text()),t.name)}catch(e){C(`JSON inválido en ${t.name}: ${e.message}`)}},[m]),Pe=(0,b.useCallback)(e=>{p(e.snapshot,e.label)&&(N(`local`),de(null),pe(null),e.report!==null&&m(e.report,e.reportLabel??`report.json`))},[p,m]),Fe=(0,b.useCallback)(()=>{xe.current?.removeAttribute(`open`)},[]),Ie=(0,b.useCallback)(async()=>{let e=P.trim();if(!e)return;let t=he.trim();Fe(),Se.current=!0,T(!0),y(null);try{let n=await Sl(e);if(!p(n,e)){T(!1);return}if(N(`local`),de(e),pe(t||null),t)try{let e=await Sl(t);e&&m(e,t)}catch(e){C(`No se pudo cargar el reporte: ${e.message}`)}}catch(t){y(`No se pudo cargar ${e}: ${t.message}`)}finally{T(!1)}},[Fe,p,m,he,P]),Le=(0,b.useCallback)(async()=>{Fe();let e=bl();if(!e)y(`Este navegador no permite seleccionar carpetas. Usa Chrome o Edge, o abre un cc.json.`);else{Se.current=!0,T(!0),y(null),ge.current={aborted:!1},E(`Seleccionando la carpeta…`);try{let t=await e({mode:`read`});E(`Leyendo los ficheros…`);let n=await vl(t,{signal:ge.current,onProgress:e=>E(`Leyendo ${e.read} ficheros… ${e.current}`)});if(ge.current?.aborted)throw new dl;E(`Analizando en el navegador…`);let r=fl({files:n.fileSystem.entries(),projectName:t.name,onProgress:e=>E(e),onFileProgress:e=>E(`Analizando ${e.done}/${e.total}… ${e.current}`)});I.current=r;let i=await r.result;I.current=null,u(i.snapshot,`${t.name} · navegador`)&&(N(`local`),de(null),pe(null),f())}catch(e){e instanceof dl?E(`Análisis cancelado`):e.name!==`AbortError`&&y(e.message)}finally{I.current=null,E(null),T(!1)}}},[Fe,u,f]),Re=(0,b.useCallback)(()=>{ge.current={aborted:!0},I.current?.cancel()},[]),ze=(0,b.useCallback)(async()=>{if(typeof window>`u`)return;let e=window.location.href;try{await navigator.clipboard.writeText(e)}catch{return}ve(!0),window.setTimeout(()=>ve(!1),1800)},[]),Be=(0,b.useCallback)(async()=>{let e=await xl(`data/meta.json`),t=await xl(`data/snapshot.cc.json`);if(!t)throw Error(`el servidor no devolvió el snapshot`);u(t,`servidor local`),N(e?.watch?`live`:`served`),de(null),pe(null),e?.rootPath&&ae(e.rootPath);let n=await xl(`data/report.json`);n?d(n,`servidor local`,!1):f(),await Te()},[d,u,f,Te]),Ve=(0,b.useCallback)(async e=>{T(!0);try{let t=await fetch(`/api/root`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({path:e})}),n=await t.json();if(!t.ok)throw Error(n.error??`no se pudo analizar la carpeta`);le(!1),await Be()}finally{T(!1)}},[Be]),He=(0,b.useCallback)(async()=>{if(M!==`live`&&M!==`served`)return;let e=M!==`live`;try{let t=await fetch(`/api/watch`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({enabled:e})}),n=await t.json();if(!t.ok)throw Error(n.error??`no se pudo cambiar el modo live`);if(e){let e=await xl(`data/snapshot.cc.json`);e&&u(e,`servidor local`,!0)}N(n.watch?`live`:`served`)}catch(e){y(e.message)}},[M,u]),Ue=(0,b.useCallback)(()=>{Fe(),M===`static`?y("Para monitorizar carpetas hace falta el servidor local. Ejecuta `codarch serve` una vez y abre su URL."):le(!0)},[Fe,M]),We=(0,b.useCallback)(async()=>{if(Fe(),Se.current=!0,y(null),!(`showDirectoryPicker`in window))L.current?.click();else{T(!0);try{Pe(await Yc())}catch(e){e.name!==`AbortError`&&y(e.message),T(!1)}}},[Fe,Pe]),Ge=(0,b.useCallback)(async e=>{let t=Array.from(e.target.files??[]);if(e.target.value=``,Fe(),t.length!==0){Se.current=!0,T(!0),y(null);try{Pe(await Xc(t))}catch(e){y(e.message),T(!1)}}},[Fe,Pe]);return(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(kc,{app:e,className:re?`is-dragging`:``,onDragOver:e=>{e.preventDefault(),j(!0)},onDragLeave:()=>j(!1),onDrop:Me,topbarTrailing:(0,x.jsxs)(x.Fragment,{children:[(0,x.jsxs)(Jc,{ref:xe,items:[{label:`Monitorizar carpeta (live)…`,onClick:Ue,disabled:M===`static`,title:M===`static`?"Arranca `codarch serve` para elegir carpetas locales":`Analiza y vigila una carpeta local`},{label:`Carpeta con .codarch…`,onClick:()=>void We()},{label:`Analizar carpeta aquí…`,onClick:()=>void Le(),title:`Analiza la carpeta en el navegador, sin ejecutar el CLI`},{label:`Archivo cc.json…`,onClick:()=>{Fe(),ye.current?.click()}},{label:_e?`Enlace copiado`:`Copiar enlace de la vista`,onClick:()=>void ze(),keepOpen:!0,title:`Copia el enlace de la vista actual (área, color, carpeta y fichero)`}],children:[(0,x.jsxs)(`div`,{className:`url-load`,children:[(0,x.jsxs)(`label`,{className:`field`,children:[(0,x.jsx)(`span`,{children:`Snapshot por URL`}),(0,x.jsx)(`input`,{type:`text`,value:P,placeholder:`https://…/snapshot.cc.json`,onChange:e=>me(e.target.value),onKeyDown:e=>{e.key===`Enter`&&Ie()}})]}),(0,x.jsxs)(`label`,{className:`field`,children:[(0,x.jsx)(`span`,{children:`Reporte por URL (opcional)`}),(0,x.jsx)(`input`,{type:`text`,value:he,placeholder:`https://…/report.json`,onChange:e=>F(e.target.value),onKeyDown:e=>{e.key===`Enter`&&Ie()}})]}),(0,x.jsx)(`button`,{type:`button`,onClick:()=>void Ie(),disabled:!P.trim(),children:`Cargar por URL`})]}),(0,x.jsxs)(`p`,{children:[`Monitorizar analiza una carpeta en el servidor local. .codarch carga artefactos ya generados. Para activarlo:`,` `,(0,x.jsx)(`code`,{children:`codarch serve`}),`.`]})]}),(0,x.jsx)(`input`,{ref:ye,className:`sr-only`,type:`file`,accept:`.json,application/json`,onChange:je}),(0,x.jsx)(`input`,{ref:L,className:`sr-only`,type:`file`,multiple:!0,onChange:Ge,webkitdirectory:`true`,directory:`true`})]}),overlay:re?(0,x.jsx)(`div`,{className:`drop-hint`,children:`Suelta un cc.json`}):null,onCancelAnalysis:Re,onOpenHistory:e=>{we(`data/history/${ec(e)}`,e.date)},onLoadReport:()=>be.current?.click(),settings:(0,x.jsx)(ui,{open:s,onOpenChange:_,areaMetric:t,onAreaMetric:e=>h(e),colorMode:n,onColorMode:e=>g(e),areaOptions:ee,colorOptions:te,model:O.model,savedProject:Oe?{label:Oe}:null,onClearProject:()=>{ll(),_(!1)},storageAvailable:ke,watch:M===`live`||M===`served`?{state:M===`live`?`live`:`paused`,onToggle:()=>void He()}:void 0,version:Ae,plugins:A.descriptors,enabledPlugins:A.enabled,onTogglePlugin:A.toggle,failedPlugins:A.failed,addons:l,showLabels:c,onShowLabels:v})}),(0,x.jsx)(S,{open:ce,initialPath:ie,onClose:()=>le(!1),onSelect:Ve}),(0,x.jsx)(`input`,{ref:be,className:`sr-only`,type:`file`,accept:`.json,application/json`,onChange:Ne})]})}var Tl=document.getElementById(`root`);if(!Tl)throw Error(`falta #root`);(0,y.createRoot)(Tl).render((0,x.jsx)(b.StrictMode,{children:(0,x.jsx)(wl,{})}));export{c as a,u as i,Bo as n,v as r,W as t};
85
+ `;return`${e}\n${i}${p}`}return`${f}${o}${d.join(` `)}${o}${p}`}function Oa({indent:e,options:{commentString:t}},n,r,i){if(r&&i&&(r=r.replace(/^\n+/,``)),r){let i=Ji(t(r),e);n.push(i.trimStart())}}function ka(e,t){let n=xi(t)?t.value:t;for(let r of e)if(B(r)&&(r.key===t||r.key===n||xi(r.key)&&r.key.value===n))return r}var Aa=class extends Ki{static get tagName(){return`tag:yaml.org,2002:map`}constructor(e){super(pi,e),this.items=[]}static from(e,t,n){let{keepUndefined:r,replacer:i}=n,a=new this(e),o=(e,o)=>{if(typeof i==`function`)o=i.call(t,e,o);else if(Array.isArray(i)&&!i.includes(e))return;(o!==void 0||r)&&a.items.push(Ca(e,o,n))};if(t instanceof Map)for(let[e,n]of t)o(e,n);else if(t&&typeof t==`object`)for(let e of Object.keys(t))o(e,t[e]);return typeof e.sortMapEntries==`function`&&a.items.sort(e.sortMapEntries),a}add(e,t){let n;n=B(e)?e:!e||typeof e!=`object`||!(`key`in e)?new wa(e,e?.value):new wa(e.key,e.value);let r=ka(this.items,n.key),i=this.schema?.sortMapEntries;if(r){if(!t)throw Error(`Key ${n.key} already set`);xi(r.value)&&Bi(n.value)?r.value.value=n.value:r.value=n.value}else if(i){let e=this.items.findIndex(e=>i(n,e)<0);e===-1?this.items.push(n):this.items.splice(e,0,n)}else this.items.push(n)}delete(e){let t=ka(this.items,e);return t?this.items.splice(this.items.indexOf(t),1).length>0:!1}get(e,t){let n=ka(this.items,e)?.value;return(!t&&xi(n)?n.value:n)??void 0}has(e){return!!ka(this.items,e)}set(e,t){this.add(new wa(e,t),!0)}toJSON(e,t,n){let r=n?new n:t?.mapAsMap?new Map:{};t?.onCreate&&t.onCreate(r);for(let e of this.items)xa(t,r,e);return r}toString(e,t,n){if(!e)return JSON.stringify(this);for(let e of this.items)if(!B(e))throw Error(`Map items must all be pairs; found ${JSON.stringify(e)} instead`);return!e.allNullValues&&this.hasAllNullValues(!1)&&(e=Object.assign({},e,{allNullValues:!0})),Ta(this,e,{blockItemPrefix:``,flowChars:{start:`{`,end:`}`},itemIndent:e.indent||``,onChompKeep:n,onComment:t})}},ja={collection:`map`,default:!0,nodeClass:Aa,tag:`tag:yaml.org,2002:map`,resolve(e,t){return bi(e)||t(`Expected a mapping for this tag`),e},createNode:(e,t,n)=>Aa.from(e,t,n)},Ma=class extends Ki{static get tagName(){return`tag:yaml.org,2002:seq`}constructor(e){super(gi,e),this.items=[]}add(e){this.items.push(e)}delete(e){let t=Na(e);return typeof t==`number`&&this.items.splice(t,1).length>0}get(e,t){let n=Na(e);if(typeof n!=`number`)return;let r=this.items[n];return!t&&xi(r)?r.value:r}has(e){let t=Na(e);return typeof t==`number`&&t<this.items.length}set(e,t){let n=Na(e);if(typeof n!=`number`)throw Error(`Expected a valid index, not ${e}.`);let r=this.items[n];xi(r)&&Bi(t)?r.value=t:this.items[n]=t}toJSON(e,t){let n=[];t?.onCreate&&t.onCreate(n);let r=0;for(let e of this.items)n.push(Ii(e,String(r++),t));return n}toString(e,t,n){return e?Ta(this,e,{blockItemPrefix:`- `,flowChars:{start:`[`,end:`]`},itemIndent:(e.indent||``)+` `,onChompKeep:n,onComment:t}):JSON.stringify(this)}static from(e,t,n){let{replacer:r}=n,i=new this(e);if(t&&Symbol.iterator in Object(t)){let e=0;for(let a of t){if(typeof r==`function`){let n=t instanceof Set?a:String(e++);a=r.call(t,n,a)}i.items.push(Ui(a,void 0,n))}}return i}};function Na(e){let t=xi(e)?e.value:e;return t&&typeof t==`string`&&(t=Number(t)),typeof t==`number`&&Number.isInteger(t)&&t>=0?t:null}var Pa={collection:`seq`,default:!0,nodeClass:Ma,tag:`tag:yaml.org,2002:seq`,resolve(e,t){return Si(e)||t(`Expected a sequence for this tag`),e},createNode:(e,t,n)=>Ma.from(e,t,n)};function Fa(e){return typeof e==`bigint`||Number.isInteger(e)}var Ia=({value:e})=>JSON.stringify(e),La=[{identify:e=>typeof e==`string`,default:!0,tag:`tag:yaml.org,2002:str`,resolve:e=>e,stringify:Ia},{identify:e=>e==null,createNode:()=>new V(null),default:!0,tag:`tag:yaml.org,2002:null`,test:/^null$/,resolve:()=>null,stringify:Ia},{identify:e=>typeof e==`boolean`,default:!0,tag:`tag:yaml.org,2002:bool`,test:/^true$|^false$/,resolve:e=>e===`true`,stringify:Ia},{identify:Fa,default:!0,tag:`tag:yaml.org,2002:int`,test:/^-?(?:0|[1-9][0-9]*)$/,resolve:(e,t,{intAsBigInt:n})=>n?BigInt(e):parseInt(e,10),stringify:({value:e})=>Fa(e)?e.toString():JSON.stringify(e)},{identify:e=>typeof e==`number`,default:!0,tag:`tag:yaml.org,2002:float`,test:/^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,resolve:e=>parseFloat(e),stringify:Ia}];[ja,Pa].concat(La,{default:!0,tag:``,test:/^/,resolve(e,t){return t(`Unresolved plain scalar ${JSON.stringify(e)}`),e}});function Ra(e,t,n){let{replacer:r}=n,i=new Ma(e);i.tag=`tag:yaml.org,2002:pairs`;let a=0;if(t&&Symbol.iterator in Object(t))for(let e of t){typeof r==`function`&&(e=r.call(t,String(a++),e));let o,s;if(Array.isArray(e)){if(e.length===2)o=e[0],s=e[1];else throw TypeError(`Expected [key, value] tuple: ${e}`)}else if(e&&e instanceof Object){let t=Object.keys(e);if(t.length===1)o=t[0],s=e[o];else throw TypeError(`Expected tuple with one key, not ${t.length} keys`)}else o=e;i.items.push(Ca(o,s,n))}return i}var za=class e extends Ma{constructor(){super(),this.add=Aa.prototype.add.bind(this),this.delete=Aa.prototype.delete.bind(this),this.get=Aa.prototype.get.bind(this),this.has=Aa.prototype.has.bind(this),this.set=Aa.prototype.set.bind(this),this.tag=e.tag}toJSON(e,t){if(!t)return super.toJSON(e);let n=new Map;t?.onCreate&&t.onCreate(n);for(let e of this.items){let r,i;if(B(e)?(r=Ii(e.key,``,t),i=Ii(e.value,r,t)):r=Ii(e,``,t),n.has(r))throw Error(`Ordered maps must not include duplicate keys`);n.set(r,i)}return n}static from(e,t,n){let r=Ra(e,t,n),i=new this;return i.items=r.items,i}};za.tag=`tag:yaml.org,2002:omap`;var Ba=class e extends Aa{constructor(t){super(t),this.tag=e.tag}add(e){let t;t=B(e)?e:e&&typeof e==`object`&&`key`in e&&`value`in e&&e.value===null?new wa(e.key,null):new wa(e,null),ka(this.items,t.key)||this.items.push(t)}get(e,t){let n=ka(this.items,e);return!t&&B(n)?xi(n.key)?n.key.value:n.key:n}set(e,t){if(typeof t!=`boolean`)throw Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof t}`);let n=ka(this.items,e);n&&!t?this.items.splice(this.items.indexOf(n),1):!n&&t&&this.items.push(new wa(e))}toJSON(e,t){return super.toJSON(e,t,Set)}toString(e,t,n){if(!e)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},e,{allNullValues:!0}),t,n);throw Error(`Set items must all have null values`)}static from(e,t,n){let{replacer:r}=n,i=new this(e);if(t&&Symbol.iterator in Object(t))for(let e of t)typeof r==`function`&&(e=r.call(t,e,e)),i.items.push(Ca(e,null,n));return i}};Ba.tag=`tag:yaml.org,2002:set`;var Va=Symbol(`break visit`),Ha=Symbol(`skip children`),Ua=Symbol(`remove item`);function Wa(e,t){`type`in e&&e.type===`document`&&(e={start:e.start,value:e.value}),Ga(Object.freeze([]),e,t)}Wa.BREAK=Va,Wa.SKIP=Ha,Wa.REMOVE=Ua,Wa.itemAtPath=(e,t)=>{let n=e;for(let[e,r]of t){let t=n?.[e];if(t&&`items`in t)n=t.items[r];else return}return n},Wa.parentCollection=(e,t)=>{let n=Wa.itemAtPath(e,t.slice(0,-1)),r=t[t.length-1][0],i=n?.[r];if(i&&`items`in i)return i;throw Error(`Parent collection not found`)};function Ga(e,t,n){let r=n(t,e);if(typeof r==`symbol`)return r;for(let i of[`key`,`value`]){let a=t[i];if(a&&`items`in a){for(let t=0;t<a.items.length;++t){let r=Ga(Object.freeze(e.concat([[i,t]])),a.items[t],n);if(typeof r==`number`)t=r-1;else if(r===Va)return Va;else r===Ua&&(a.items.splice(t,1),--t)}typeof r==`function`&&i===`key`&&(r=r(t,e))}}return typeof r==`function`?r(t,e):r}var Ka=[`maxComplexity`,`max_complexity_per_function`,`complexity`,`logic_complexity`,`sonar_cognitive_complexity`],qa=[`number_of_commits`,`number_of_authors`,`number_of_renames`],Ja={complexity:.5,churn:.32,size:.18},Ya=1.7;function Xa(e){let t=eo(e.map(e=>e.complexity).filter(e=>e>0),.95),n=eo(e.map(e=>e.churn).filter(e=>e>0),.95),r=eo(e.map(e=>e.size).filter(e=>e>0),.95),i=t>0?Ja.complexity:0,a=n>0?Ja.churn:0,o=r>0?Ja.size:0,s=i+a+o,c=s>0?{complexity:i/s,churn:a/s,size:o/s}:{complexity:0,churn:0,size:0};return e.map(e=>{let i=Za(e.complexity,t,c.complexity),a=Za(e.churn,n,c.churn),o=Za(e.size,r,c.size);return{risk:to(i.share+a.share+o.share)**+Ya,parts:{complexity:i,churn:a,size:o}}})}function Za(e,t,n){let r=$a(e,t);return{value:e,p95:t,norm:r,weight:n,share:r*n}}function Qa(e,t){let n=e instanceof Set?e:new Set(e);for(let e of t)if(n.has(e))return e;return null}function $a(e,t){return t>0?to(e/t):0}function eo(e,t){if(e.length===0)return 0;let n=[...e].sort((e,t)=>e-t);return n[Math.min(n.length-1,Math.max(0,Math.floor((n.length-1)*t)))]??0}function to(e){return Number.isFinite(e)?Math.max(0,Math.min(1,e)):0}var no=new Set([`1.0`,`1.1`,`1.2`,`1.3`,`1.3`]);function ro(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function io(e){if(!ro(e))return null;let t=e.schemaVersion;if(typeof t!=`string`||!no.has(t))return null;let n=e.files,r=e.rules,i=e.cycles;if(!ro(e.summary)||!ro(e.base)||!ro(e.head)||!ro(n)||!Array.isArray(n.added)||!Array.isArray(n.removed)||!Array.isArray(n.changed)||!ro(r)||typeof r.configured!=`boolean`||!ro(r.summary)||!ro(r.violations)||!Array.isArray(r.violations.introduced)||!Array.isArray(r.violations.existing)||!Array.isArray(r.violations.resolved)||!ro(i)||!Array.isArray(i.introduced)||!Array.isArray(i.fixed)||!Array.isArray(e.hotspots))return null;let a=e;return t===`1.3`?a:{...a,schemaVersion:`1.3`,migration:a.migration??null,symbols:a.symbols??null,rules:{...a.rules,profile:a.rules?.profile??null,violations:{introduced:(a.rules?.violations?.introduced??[]).map(ao),existing:(a.rules?.violations?.existing??[]).map(ao),resolved:(a.rules?.violations?.resolved??[]).map(ao)}}}}function ao(e){return{...e,source:e.source??`config`}}function oo(e){return io(e)}function so(e){let t=e?.lenses?.migration;if(!t||typeof t!=`object`)return null;let n=t;return!n.nodes||!n.summary?null:n}var co=class extends Error{path;constructor(e,t){super(`${e} (en ${t})`),this.name=`CcJsonError`,this.path=t}};function lo(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function uo(e,t){if(!lo(e))throw new co(`se esperaba un objeto`,t);return e}function fo(e,t,n){if(typeof e!=`string`||e.length===0)throw new co(`"${n}" debe ser una cadena no vacía`,t);return e}var po=512;function mo(e){if(!lo(e))throw new co(`se esperaba un objeto`,`$`);let t=uo(e.meta,`$.meta`),n=fo(t.apiVersion,`$.meta.apiVersion`,`apiVersion`);if(!n.startsWith(`2.`))throw new co(`apiVersion "${n}" no soportada (se espera 2.x)`,`$.meta.apiVersion`);let r=e.files;if(r===void 0)throw new co(`falta "files"`,`$`);let i=Array.isArray(r)?r:[r];if(i.length===0)throw new co(`el árbol está vacío`,`$.files`);let a=new Set,o=(e,t,n)=>{if(n>po)throw new co(`profundidad máxima ${po} superada`,t);let r=uo(e,t),i=fo(r.id,`${t}.id`,`id`);if(a.has(i))throw new co(`id duplicado "${i}"`,`${t}.id`);a.add(i);let s=fo(r.name,`${t}.name`,`name`),c=r.type;if(c!==`File`&&c!==`Folder`)throw new co(`"type" debe ser "File" o "Folder"`,`${t}.type`);let l={id:i,name:s,type:c};if(typeof r.contentHash==`string`&&(l.contentHash=r.contentHash),typeof r.link==`string`&&(l.link=r.link),r.children!==void 0){if(!Array.isArray(r.children))throw new co(`"children" debe ser un array`,`${t}.children`);l.children=r.children.map((e,r)=>o(e,`${t}.children[${r}]`,n+1))}return l},s=i.map((e,t)=>o(e,`$.files[${t}]`,0)),c=e.lenses;if(c!==void 0){let e=uo(c,`$.lenses`);if(e.metrics!==void 0){let t=uo(uo(e.metrics,`$.lenses.metrics`).attributes,`$.lenses.metrics.attributes`);for(let[e,n]of Object.entries(t)){let t=uo(n,`$.lenses.metrics.attributes["${e}"]`);for(let[n,r]of Object.entries(t))if(typeof r!=`number`||!Number.isFinite(r))throw new co(`la métrica "${n}" debe ser un número finito`,`$.lenses.metrics.attributes["${e}"].${n}`)}}if(e.dependency!==void 0){let t=uo(e.dependency,`$.lenses.dependency`);if(t.edges!==void 0){if(!Array.isArray(t.edges))throw new co(`"edges" debe ser un array`,`$.lenses.dependency.edges`);t.edges.forEach((e,t)=>{let n=`$.lenses.dependency.edges[${t}]`,r=uo(e,n);fo(r.fromId,`${n}.fromId`,`fromId`),fo(r.toId,`${n}.toId`,`toId`)})}}}return{meta:{...t,apiVersion:n},files:s,...c===void 0?{}:{lenses:c}}}function ho(e,t){let n=e.map(e=>({node:e,path:e.name,depth:0})).reverse();for(;n.length>0;){let e=n.pop();t(e);let r=e.node.children;if(r&&r.length!==0)for(let t=r.length-1;t>=0;t--){let i=r[t];n.push({node:i,path:`${e.path}/${i.name}`,depth:e.depth+1})}}}function go(e,t){ho(e,e=>{e.node.type===`File`&&t(e)})}function _o(e){let t=new Map;return ho(e,e=>t.set(e.node.id,e.path)),t}function vo(e){let t=0,n=0,r=0;ho(e.files,e=>{r=Math.max(r,e.depth),e.node.type===`File`?t++:n++});let i=new Map,a=e.lenses?.metrics?.attributes??{};for(let e of Object.values(a))for(let t of Object.keys(e))i.set(t,(i.get(t)??0)+1);let o=new Set(_o(e.files).keys()),s=0;for(let e of Object.keys(a))o.has(e)||s++;let c=e.lenses?.dependency;return{files:t,folders:n,maxDepth:r,lenses:Object.keys(e.lenses??{}),metricNames:i.size,metricCoverage:[...i.entries()].map(([e,t])=>({name:e,files:t})).sort((e,t)=>t.files-e.files||e.name.localeCompare(t.name)),edges:c?.edges?.length??0,leafEdges:c?.leafEdges?.length??0,orphanMetricNodes:s}}function yo(e){return e.metricCoverage.some(e=>e.name===`rloc`)?`rloc`:e.metricCoverage[0]?.name}function bo(e){return e.lenses?.symbols??null}function xo(e,t){let n=bo(e)?.nodes[t];return!n||n.length===0?[]:[...n].sort((e,t)=>(t.complexity??-1)-(e.complexity??-1)||e.line-t.line)}new TextEncoder;var So={value:0,p95:0,norm:0,weight:0,share:0},Co={complexity:So,churn:So,size:So},wo=class extends Error{constructor(e){super(e),this.name=`RenderError`}},To=[`#b9c4d0`,`#c9b8a8`,`#a9bfae`,`#c4b6c9`,`#c9c2a6`,`#d5d2ca`,`#c2c8d0`,`#d6c6bd`,`#b7c6c2`,`#cbbfb0`,`#bcc3b9`,`#cfc6c9`],Eo=[`rloc`,`maxComplexity`,`max_complexity_per_function`,`complexity`,`functions`,`number_of_functions`,`maxFunctionLength`,`loc`,`imports`,`externalImports`,`builtinImports`,`typeOnlyImports`,`unresolvedImports`,`fanIn`,`fanOut`,`inCycle`,`cycleSize`,`dependencyLevel`,`migrationDebt`,`ffiCrossings`,`number_of_commits`,`number_of_authors`,`incoming_dependencies`,`outgoing_dependencies`];function Do(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Oo(e,t){if(!t||!e)return;let n=e[t];return typeof n==`number`&&Number.isFinite(n)?n:void 0}function ko(e,t){if(e.length===0)return 0;let n=[...e].sort((e,t)=>e-t);return n[Math.min(n.length-1,Math.max(0,Math.floor((n.length-1)*t)))]??0}function Ao(e){let t=2166136261;for(let n=0;n<e.length;n++)t^=e.charCodeAt(n),t=Math.imul(t,16777619);return t>>>0}function jo(e){let t=e.split(`/`).filter(Boolean).slice(0,-1);return t.length===0?`(raíz)`:t.length===1?t[0]:t.slice(0,3).join(`/`)}function Mo(e){if(!Array.isArray(e))return[];let t=[];for(let n of e)Do(n)&&typeof n.fromId==`string`&&typeof n.toId==`string`&&t.push({fromId:n.fromId,toId:n.toId,...n.isCyclic===!0?{isCyclic:!0}:{}});return t}function No(e,t){let n=e?.[t];return Do(n)&&typeof n.title==`string`&&n.title?n.title:t}function Po(e,t){let n=e?.[t];return Do(n)&&typeof n.direction==`number`?n.direction:0}function Fo(e,t={}){let n=vo(e),r=new Set(n.metricCoverage.map(e=>e.name)),i=e.lenses?.metrics?.attributes??{},a=e.lenses?.metrics?.attributeDescriptors,o;if(t.areaMetric){if(!r.has(t.areaMetric))throw new wo(`la métrica de área "${t.areaMetric}" no existe en este cc.json`);o=t.areaMetric}else o=yo(n)??null;let s=Qa(r,Ka),c=Qa(r,qa),l=[],u=e=>{e&&r.has(e)&&!l.includes(e)&&l.push(e)};for(let e of Eo)u(e);u(o),u(s),u(c),t.color&&t.color!==`risk`&&t.color!==`structure`&&u(t.color);let d=e.files.length===1&&e.files[0]?.type===`Folder`?e.files[0]:null,f=d?`${d.name}/`:``,p=d?.name??``,m=[],h=[],g=new Map;if(go(e.files,e=>{let t=e.path,n=f&&t.startsWith(f)?t.slice(f.length):t,r=i[e.node.id],a=Oo(r,o),l=h.length;g.set(e.node.id,l),h.push({index:l,nodeId:e.node.id,path:n,name:e.node.name,section:-1,area:Math.max(1,a??0),actualArea:a??0,risk:0,riskParts:Co,complexity:Oo(r,s)??0,churn:Oo(r,c)??0,values:[]})}),o&&h.length>0){let e=h.filter(e=>e.actualArea===0).length;e>0&&m.push(`${e} ficheros sin "${o}"; se dibujan con área mínima para no desaparecer`),!t.areaMetric&&o!==`rloc`&&m.push(`"rloc" no está presente; se usa "${o}" como área`)}let _=Xa(h.map(e=>({complexity:e.complexity,churn:e.churn,size:e.actualArea})));for(let[e,t]of h.entries()){let n=_[e];n&&(t.risk=n.risk,t.riskParts=n.parts)}let v=new Map;for(let e of h){let t=jo(e.path),n=v.get(t)??{files:0,area:0};n.files++,n.area+=e.actualArea,v.set(t,n)}let y=[...v.entries()].map(([e,t])=>({key:e,label:e,files:t.files,area:t.area,color:To[Ao(e)%To.length]})).sort((e,t)=>t.area-e.area||e.key.localeCompare(t.key)),b=new Map(y.map((e,t)=>[e.key,t]));for(let e of h)e.section=b.get(jo(e.path))??0;let x=l.map(e=>{let t=h.map(t=>Oo(i[t.nodeId],e)).filter(e=>e!==void 0),n=t.length>0?Math.min(...t):0,r=t.length>0?Math.max(...t):0,o=ko(t,.95),s=n>=0&&o>0&&r>o*4,c=s?r:o>0?o:r;return{key:e,title:No(a,e),direction:Po(a,e),min:n,max:c,actualMax:r,p95:o,mode:s?`log`:`linear`,coverage:t.length}});for(let e of h){let t=i[e.nodeId];e.values=x.map(e=>Oo(t,e.key)??null)}let S=Io(e,d,g,h),C=Lo(S),w=e.lenses?.dependency,T=Mo(w?.leafEdges),E=T.length>0?T:Mo(w?.edges),D=new Set,O=[],k=h.length;for(let e of E){let t=g.get(e.fromId),n=g.get(e.toId);if(t===void 0||n===void 0||t===n)continue;let r=t*k+n;if(!D.has(r)&&(D.add(r),O.push({from:t,to:n}),O.length>=2e4)){m.push(`se han limitado las dependencias a 20.000 aristas`);break}}O.sort((e,t)=>e.from-t.from||e.to-t.to);let A=new Set;for(let e of E){if(e.isCyclic!==!0)continue;let t=g.get(e.fromId),n=g.get(e.toId);t!==void 0&&n!==void 0&&A.add(t*k+n)}let ee=new Set,te=[];for(let e of O){let t=e.from*k+e.to;A.has(t)&&!ee.has(t)&&(ee.add(t),te.push(e))}te.sort((e,t)=>e.from-t.from||e.to-t.to),E.length===0&&m.push(`este cc.json no trae una lente de dependencias utilizable`);let ne=h.reduce((e,t)=>e+t.actualArea,0),re=h.filter(e=>e.risk>=.66).length,j=`risk`,M=null;if(t.color===`structure`)j=`structure`;else if(t.color&&t.color!==`risk`){if(!r.has(t.color))throw new wo(`la métrica de color "${t.color}" no existe en este cc.json`);j=`metric`,M=t.color}let N=Ro(h,j,M,x),ie=e.meta.projectName||t.title||`Proyecto sin nombre`;return{meta:{project:ie,title:t.title||ie,commit:e.meta.commitHash||``,checksum:e.meta.checksum||``,apiVersion:e.meta.apiVersion,rootName:p},files:h,sections:y,metrics:x,edges:O,cycles:te,roots:S,areaMetric:o,areaTitle:o?No(a,o):`Área`,totalArea:ne,fileCount:h.length,folderCount:C,hotspotCount:re,defaultSelection:N,initialLens:j,initialMetric:M,warnings:m}}function Io(e,t,n,r){let i=(e,t)=>{if(e.type===`File`){let i=n.get(e.id),a=i===void 0?void 0:r[i];return{kind:`file`,key:`f:${i??-1}`,name:e.name,path:t,value:a?.area??1,fileCount:1,section:a?.section??0,fileIndex:i}}let a=(e.children??[]).map(e=>i(e,t?`${t}/${e.name}`:e.name)),o={kind:`folder`,key:`d:${t}`,name:e.name,path:t,value:a.reduce((e,t)=>e+t.value,0)||1,fileCount:a.reduce((e,t)=>e+t.fileCount,0),section:-1,children:a};for(;o.children?.length===1&&o.children[0]?.kind===`folder`;){let e=o.children[0];o.name=`${o.name}/${e.name}`,o.path=e.path,o.key=`d:${e.path}`,o.value=e.value,o.fileCount=e.fileCount,o.children=e.children}return o};return t?(t.children??[]).map(e=>i(e,e.name)):e.files.map(e=>i(e,e.name))}function Lo(e){let t=0,n=[...e];for(;n.length>0;){let e=n.pop();e.kind===`folder`&&t++,e.children&&n.push(...e.children)}return t}function Ro(e,t,n,r){if(e.length===0)return null;if(t===`metric`&&n){let t=r.findIndex(e=>e.key===n);if(t>=0){let n=null;for(let r of e){let e=r.values[t];e!=null&&(!n||e>(n.values[t]??-1/0))&&(n=r)}if(n)return n.index}}return t===`structure`?e.reduce((e,t)=>t.actualArea>e.actualArea?t:e).index:e.reduce((e,t)=>t.risk>e.risk?t:e).index}function zo(e,t){if(t.w<=0||t.h<=0)return[];let n=e.filter(e=>Number.isFinite(e.value)&&e.value>0),r=n.reduce((e,t)=>e+t.value,0);if(n.length===0||r<=0)return[];let i=n.map((e,t)=>({item:e,index:t})).sort((e,t)=>t.item.value-e.item.value||e.index-t.index).map(({item:e})=>e),a=t.w*t.h/r,o=[],s=t.x,c=t.y,l=t.w,u=t.h,d=[],f=e=>e.value*a;function p(e,t){let n=0,r=-1/0,i=1/0;for(let t of e){let e=f(t);n+=e,e>r&&(r=e),e<i&&(i=e)}return n<=0||t<=0?1/0:Math.max(t*t*r/(n*n),n*n/(t*t*i))}function m(e,t){if(e.length===0)return;let n=e.reduce((e,t)=>e+f(t),0);if(!(n<=0)){if(t){if(l<=0)return;let t=n/l;if(!Number.isFinite(t)||t<=0)return;let r=s;for(let n of e){let e=f(n)/t;o.push({item:n,x:r,y:c,w:e,h:t}),r+=e}c+=t,u-=t}else{if(u<=0)return;let t=n/u;if(!Number.isFinite(t)||t<=0)return;let r=c;for(let n of e){let e=f(n)/t;o.push({item:n,x:s,y:r,w:t,h:e}),r+=e}s+=t,l-=t}}}let h=0;for(;h<i.length;){let e=l>=u,t=e?l:u,n=i[h];d.length===0||p([...d,n],t)<=p(d,t)?(d.push(n),h++):(m(d,e),d=[])}return d.length>0&&m(d,l>=u),o}var W=1400,G=12;function Bo(e,t=W,n=900){return Vo(e,{x:8,y:8,w:Math.max(1,t-16),h:Math.max(1,n-16)},0)}function Vo(e,t,n){return e.length===0||t.w<2||t.h<2?[]:zo(e.map(e=>({key:e.key,value:Math.max(1,e.value),node:e})),t).map(e=>Ho(e.item.node,{x:e.x,y:e.y,w:e.w,h:e.h},n))}function Ho(e,t,n){if(e.kind===`file`||!e.children||e.children.length===0)return{node:e,rect:t,headerHeight:0,children:[]};let r=0;t.w>=30&&t.h>=32&&(r=t.h>=62?17:13);let i={x:t.x+1,y:t.y+r+1,w:Math.max(0,t.w-2),h:Math.max(0,t.h-r-2)},a=n<G&&i.w>=1&&i.h>=1?Vo(e.children,i,n+1):[];return{node:e,rect:t,headerHeight:r,children:a}}var Uo=[[0,`#ebe7df`],[.35,`#e9cd98`],[.65,`#d68a54`],[1,`#a42e2c`]],Wo=[[0,`#ebe7df`],[.5,`#b9c9cf`],[1,`#355b6b`]];function Go(e){return Number.isFinite(e)?Math.max(0,Math.min(1,e)):0}function Ko(e){let t=e.replace(`#`,``);return[Number.parseInt(t.slice(0,2),16),Number.parseInt(t.slice(2,4),16),Number.parseInt(t.slice(4,6),16)]}function qo(e){return`#${e.map(e=>e.toString(16).padStart(2,`0`)).join(``)}`}function Jo(e,t,n){let r=Ko(e),i=Ko(t);return qo([Math.round(r[0]+(i[0]-r[0])*n),Math.round(r[1]+(i[1]-r[1])*n),Math.round(r[2]+(i[2]-r[2])*n)])}function Yo(e,t){let n=Go(t);for(let t=0;t<e.length-1;t++){let r=e[t],i=e[t+1];if(n<=i[0]){let e=i[0]-r[0]||1;return Jo(r[1],i[1],(n-r[0])/e)}}return e[e.length-1][1]}function Xo(e){return Yo(Uo,e)}function Zo(e,t){if(e===null)return Wo[0][1];let n;if(t.mode===`log`){let r=Math.max(1e-9,t.max-t.min);n=Math.log1p(Math.max(0,e-t.min))/Math.log1p(r)}else{let r=t.max-t.min;n=r>0?(e-t.min)/r:0}return Yo(Wo,n)}function Qo(e){return e.color}function $o(e){let[t,n,r]=Ko(e);return(.2126*t+.7152*n+.0722*r)/255>.52?`#1a1a1a`:`#f7f5f1`}function es(e){return Number.isFinite(e)?Math.round(e).toString().replace(/\B(?=(\d{3})+(?!\d))/g,`.`):`—`}function K(e){if(!Number.isFinite(e))return`—`;let t=Math.abs(e);return t>=1e6?`${(e/1e6).toFixed(1).replace(`.0`,``).replace(`.`,`,`)}M`:t>=1e3?`${(e/1e3).toFixed(1).replace(`.0`,``).replace(`.`,`,`)}k`:es(e)}var ts=11,ns={js:`JS / TS`,rust:`Rust`,bridge:`Puente`,native:`Nativo`},rs={js:`#2f6fed`,rust:`#d95d39`,bridge:`#7b61ff`,native:`#3f8f7a`},is={ts:`#2f6fed`,js:`#d9a21b`,rust:`#d95d39`,wasm:`#7b61ff`,node:`#3f8f7a`},as={created:`nació`,changed:`cambió`,unchanged:`igual`,renamed:`renombrada`,moved:`mudada`,removed:`eliminada`},os={function:`fn`,class:`cls`,interface:`int`,type:`typ`,enum:`enum`,variable:`var`},ss=`number_of_commits`;function cs(e,t){let n=Math.min(e,t);if(n<2)return null;let r=Math.min(ts,Math.max(4,n*.42)),i=t>e*1.4;return{size:Math.round(r*10)/10,vertical:i}}function ls(e){return new Map(e.metrics.map((e,t)=>[e.key,t]))}function us(e,t,n,r,i){if(t===`status`)return rs[r?.nodes[e.nodeId]?.status??`js`];if(t===`structure`){let t=n.sections[e.section];return t?Qo(t):`#d5d2ca`}if(t===`churn`){let t=i.get(ss);if(t===void 0)return Xo(e.risk);let r=n.metrics[t];return r?Zo(e.values[t]??null,r):Xo(e.risk)}if(t===`risk`)return Xo(e.risk);let a=i.get(t);if(a===void 0)return Xo(e.risk);let o=n.metrics[a];return o?Zo(e.values[a]??null,o):Xo(e.risk)}function ds(e,t){return t===`x`?{min:e.x,max:e.x+e.w}:{min:e.y,max:e.y+e.h}}function fs(e,t){let n=Math.min(e.max,t.max)-Math.max(e.min,t.min);return e.max-e.min-Math.max(0,n)}function ps(e,t,n){if(e.length===0)return null;if(t===null)return e[0]?.key??null;let r=e.find(e=>e.key===t);if(!r)return e[0]?.key??null;let i=n===`left`||n===`right`,a=i?`x`:`y`,o=i?`y`:`x`,s=n===`right`||n===`down`,c=ds(r,a),l=ds(r,o),u=null,d=1/0;for(let n of e){if(n.key===t)continue;let e=ds(n,a),r=ds(n,o),i=s?e.min-c.max:c.min-e.max;if(i<0)continue;let f=i+fs(l,r)*2+n.w*n.h/1e9;f<d&&(d=f,u=n)}return u?u.key:t}var ms={ArrowLeft:`left`,ArrowRight:`right`,ArrowUp:`up`,ArrowDown:`down`},hs=(0,b.memo)(function({placed:e,model:t,colorMode:n,migration:r,query:i,selectedIndex:a,activeKey:o,showLabels:s,onSelect:c,onFocusFolder:l,onCursor:u}){let d=(0,b.useMemo)(()=>new Map(t.metrics.map((e,t)=>[e.key,t])),[t.metrics]),f=e=>us(e,n,t,r,d),p=e=>{let{node:n,rect:d}=e;if(n.kind===`file`){let e=n.fileIndex===void 0?null:t.files[n.fileIndex];if(!e)return null;let l=f(e),p=a===e.index,m=i===``||e.path.toLowerCase().includes(i),h=s?cs(d.w,d.h):null,g=r?.nodes[e.nodeId],_=d.w>24&&d.h>10;return(0,x.jsxs)(`g`,{children:[(0,x.jsx)(`rect`,{className:`cell${o===`f:${e.index}`?` is-cursor`:``}`,x:d.x,y:d.y,width:Math.max(1,d.w),height:Math.max(1,d.h),fill:l,stroke:p?`#121a20`:`rgba(18,26,32,.26)`,strokeWidth:p?2:.55,opacity:m?1:.13,role:`button`,"data-cell-key":`f:${e.index}`,"data-file-index":e.index,tabIndex:o===`f:${e.index}`?0:-1,"aria-label":e.path,onFocus:()=>u(`f:${e.index}`),onClick:t=>{t.stopPropagation(),c(e.index)},children:_?(0,x.jsx)(`title`,{children:`${e.path}\n${t.areaTitle}: ${K(e.actualArea)}`+(g?`\n${ns[g.status]} · deuda ${g.debt??0} · FFI ${g.crossings}`:``)}):null}),h?(0,x.jsx)(`foreignObject`,{x:d.x,y:d.y,width:Math.max(1,d.w),height:Math.max(1,d.h),pointerEvents:`none`,children:(0,x.jsx)(`div`,{className:`map-label${h.vertical?` is-vertical`:``}`,style:{fontSize:h.size,color:$o(l)},children:e.name})}):null]},n.key)}let m=e.headerHeight>0||s?cs(d.w,d.h):null;return(0,x.jsxs)(`g`,{children:[(0,x.jsx)(`rect`,{className:`folder-block${o===n.key?` is-cursor`:``}`,x:d.x,y:d.y,width:Math.max(1,d.w),height:Math.max(1,d.h),fill:`rgba(18,26,32,.022)`,stroke:`rgba(18,26,32,.25)`,strokeWidth:.7,role:`button`,"data-cell-key":n.key,tabIndex:o===n.key?0:-1,"aria-label":`Enfocar ${n.path}`,onFocus:()=>u(n.key),onClick:e=>{e.stopPropagation(),l(n.path)}}),m?(0,x.jsx)(`foreignObject`,{x:d.x,y:d.y,width:Math.max(1,d.w),height:Math.max(1,d.h),pointerEvents:`none`,children:(0,x.jsx)(`div`,{className:`map-label is-folder${m.vertical?` is-vertical`:``}`,style:{fontSize:m.size},children:n.name.toUpperCase()})}):null,e.headerHeight>0&&d.w>34?(0,x.jsx)(`rect`,{x:d.x,y:d.y,width:Math.max(1,d.w),height:e.headerHeight,fill:`transparent`,className:`folder-hit`,"aria-label":`Enfocar ${n.path}`,onClick:e=>{e.stopPropagation(),l(n.path)}}):null,e.children.map(p)]},n.key)};return(0,x.jsx)(x.Fragment,{children:e.map(p)})});function gs({model:e,roots:t,colorMode:n,migration:r,query:i,selectedIndex:a,onSelect:o,onFocusFolder:s,zoom:c,center:l,onZoomAt:u,showLabels:d,onPan:f}){let p=(0,b.useRef)(null),[m,h]=(0,b.useState)({width:W,height:900}),g=(0,b.useRef)(null),_=(0,b.useRef)(0),v=(0,b.useRef)({x:0,y:0});(0,b.useEffect)(()=>()=>{_.current&&cancelAnimationFrame(_.current)},[]);let y=(0,b.useMemo)(()=>{let e=m.width/c,t=m.height/c;return{x:(m.width-e)*l.x,y:(m.height-t)*l.y,width:e,height:t}},[m,c,l]),S=(0,b.useMemo)(()=>Bo(t,m.width,m.height),[t,m.width,m.height]),{targets:C,targetMeta:w}=(0,b.useMemo)(()=>{let e=[],t=new Map,n=r=>{for(let i of r){let{node:r,rect:a}=i;if(r.kind===`file`){if(r.fileIndex===void 0)continue;let n=`f:${r.fileIndex}`;e.push({key:n,x:a.x,y:a.y,w:a.w,h:a.h}),t.set(n,{kind:`file`,fileIndex:r.fileIndex});continue}let o=i.children??[];o.length===0?(e.push({key:r.key,x:a.x,y:a.y,w:a.w,h:a.h}),t.set(r.key,{kind:`folder`,path:r.path})):n(o)}};return n(S),{targets:e,targetMeta:t}},[S]),[T,E]=(0,b.useState)(null),D=a===null?null:`f:${a}`,O=T??(D&&w.has(D)?D:C[0]?.key??null),k=(0,b.useRef)(!1);(0,b.useEffect)(()=>{if(!k.current||!T)return;k.current=!1;let e=p.current?.querySelector(`[data-cell-key="${T}"]`);e instanceof SVGElement&&e.focus()},[T,C]);let A=(0,b.useCallback)(e=>{let t=ms[e.key];if(t){let n=T??e.target?.getAttribute?.(`data-cell-key`)??null,r=ps(C,n,t);if(r===null||r===n)return;e.preventDefault(),k.current=!0,E(r);return}if(e.key!==`Enter`&&e.key!==` `)return;let n=T?w.get(T):void 0;n&&(e.preventDefault(),n.kind===`file`&&n.fileIndex!==void 0?o(n.fileIndex):n.path&&s(n.path))},[T,s,o,w,C]);return(0,b.useLayoutEffect)(()=>{let e=p.current;if(!e)return;let t=()=>{let t=e.getBoundingClientRect(),n=Math.round(t.width),r=Math.round(t.height);n>0&&r>0&&h({width:n,height:r})};t();let n=new ResizeObserver(t);return n.observe(e),window.addEventListener(`resize`,t),()=>{n.disconnect(),window.removeEventListener(`resize`,t)}},[]),(0,x.jsx)(`div`,{className:`map-inner`,ref:p,onBlur:e=>{e.currentTarget.contains(e.relatedTarget)||(k.current=!1)},children:(0,x.jsxs)(`svg`,{className:`map`,viewBox:`${y.x} ${y.y} ${y.width} ${y.height}`,role:`group`,"aria-label":`Mapa de arquitectura de ${e.meta.project}`,onKeyDown:A,onContextMenu:e=>e.preventDefault(),onPointerDown:e=>{e.button===2&&(e.preventDefault(),g.current={x:e.clientX,y:e.clientY},e.currentTarget.setPointerCapture(e.pointerId))},onPointerMove:e=>{let t=g.current;if(!t)return;let n=(e.clientX-t.x)/(e.currentTarget.clientWidth||1),r=(e.clientY-t.y)/(e.currentTarget.clientHeight||1);t.x=e.clientX,t.y=e.clientY,v.current.x+=n,v.current.y+=r,!_.current&&(_.current=requestAnimationFrame(()=>{_.current=0;let{x:e,y:t}=v.current;v.current={x:0,y:0},f(e,t)}))},onPointerUp:e=>{g.current=null,e.currentTarget.hasPointerCapture(e.pointerId)&&e.currentTarget.releasePointerCapture(e.pointerId)},onWheel:e=>{e.preventDefault();let t=e.currentTarget.getBoundingClientRect();u(e.deltaY<0?1.12:1/1.12,{x:(e.clientX-t.left)/t.width,y:(e.clientY-t.top)/t.height})},children:[(0,x.jsx)(`defs`,{children:(0,x.jsx)(`pattern`,{id:`map-grid`,width:`48`,height:`48`,patternUnits:`userSpaceOnUse`,children:(0,x.jsx)(`path`,{d:`M 48 0 L 0 0 0 48`,fill:`none`,stroke:`rgba(18,26,32,.045)`,strokeWidth:`1`})})}),(0,x.jsx)(`rect`,{width:m.width,height:m.height,fill:`url(#map-grid)`}),(0,x.jsx)(hs,{placed:S,model:e,colorMode:n,migration:r,query:i,selectedIndex:a,activeKey:O,showLabels:d,onSelect:o,onFocusFolder:s,onCursor:E})]})})}function _s(e){return e===`file`||e===`rules`||e===`changes`?e:e===`lenses`?`rules`:e===`pr`?`changes`:null}var vs=[`area`,`color`,`focus`,`file`,`tab`,`symbol`,`labels`],ys=[`src`,`report`];function bs(e,t){let n=e.get(t);if(typeof n!=`string`)return null;let r=n.trim();return r===``?null:r}function xs(e){let t=new URLSearchParams(e),n=bs(t,`tab`);return{areaMetric:bs(t,`area`),colorMode:bs(t,`color`),focusPath:bs(t,`focus`),filePath:bs(t,`file`),tab:_s(n),symbolName:bs(t,`symbol`),showLabels:t.has(`labels`)?t.get(`labels`)!==`0`:null}}function Ss(e){let t=new URLSearchParams(e);return{snapshotUrl:bs(t,`src`),reportUrl:bs(t,`report`)}}function Cs(e){return{areaMetric:e.area??null,colorMode:e.color??null,focusPath:e.focus??null,filePath:e.file??null,tab:e.tab??null,symbolName:e.symbol??null,showLabels:e.labels??null}}function ws(e,t,n){return e===`risk`||e===`structure`?!0:e===`status`?!!n:t.has(e)}function Ts(e,t,n=``){let r=new URLSearchParams(n);for(let e of vs)r.delete(e);for(let e of ys)r.delete(e);let i=[];e.areaMetric&&i.push([`area`,e.areaMetric]),e.colorMode&&i.push([`color`,e.colorMode]),e.focusPath&&i.push([`focus`,e.focusPath]),e.filePath&&i.push([`file`,e.filePath]),e.tab&&i.push([`tab`,e.tab]),e.symbolName&&i.push([`symbol`,e.symbolName]),e.showLabels!==null&&i.push([`labels`,e.showLabels?`1`:`0`]),t.snapshotUrl&&i.push([`src`,t.snapshotUrl]),t.reportUrl&&i.push([`report`,t.reportUrl]);let a=i.map(([e,t])=>`${e}=${Es(t)}`),o=r.toString();return o&&a.unshift(o),a.length===0?``:`?${a.join(`&`)}`}function Es(e){return encodeURIComponent(e).replace(/%(2F|3A|40|24|2C|3B|21|2A|27|28|29|7E)/g,e=>decodeURIComponent(e))}function Ds(e){if(typeof e!=`object`||!e)return null;let t=e;return typeof t.colorMode==`string`?{areaMetric:typeof t.areaMetric==`string`?t.areaMetric:null,colorMode:t.colorMode,showLabels:t.showLabels!==!1}:null}function Os(){try{return typeof window>`u`?null:window.localStorage}catch{return null}}var ks=`codarch:section:`;function As(e){return`${ks}${e}`}function js(e,t,n=!1){if(!e)return n;try{let r=e.getItem(As(t));return r===`closed`||r!==`open`&&n}catch{return n}}function Ms(e,t,n){if(e)try{e.setItem(As(t),n?`closed`:`open`)}catch{}}function Ns({id:e,title:t,count:n,summary:r,defaultOpen:i=!0,className:a,children:o}){let s=(0,b.useId)(),[c,l]=(0,b.useState)(()=>js(Os(),e,!i));return(0,x.jsxs)(`section`,{className:`collapsible${c?` is-closed`:``}${a?` ${a}`:``}`,children:[(0,x.jsxs)(`button`,{type:`button`,className:`collapsible-head`,"aria-expanded":!c,"aria-controls":s,onClick:()=>{l(t=>{let n=!t;return Ms(Os(),e,n),n})},children:[(0,x.jsx)(`span`,{className:`collapsible-chevron`,"aria-hidden":`true`,children:(0,x.jsx)(`svg`,{viewBox:`0 0 10 10`,width:`8`,height:`8`,children:(0,x.jsx)(`path`,{fill:`none`,stroke:`currentColor`,strokeWidth:`1.6`,strokeLinecap:`round`,strokeLinejoin:`round`,d:`M2 3.5 5 6.5 8 3.5`})})}),(0,x.jsx)(`span`,{className:`collapsible-title`,children:t}),n===void 0?null:(0,x.jsx)(`span`,{className:`collapsible-count`,children:n}),c&&r?(0,x.jsx)(`span`,{className:`collapsible-summary`,children:r}):null]}),(0,x.jsx)(`div`,{id:s,className:`collapsible-body`,hidden:c,children:o})]})}var Ps=[`rloc`,`loc`,`migrationDebt`,`ffiCrossings`,`maxComplexity`,`maxFunctionLength`,`functions`,`fanIn`,`fanOut`,`number_of_commits`,`number_of_authors`];function Fs(e){let t=new Set(e),n=Ps.filter(e=>t.has(e)),r=[...t].filter(e=>!n.includes(e)).sort((e,t)=>e.localeCompare(t));return[...n,...r]}var Is=[`rloc`,`loc`,`maxComplexity`,`max_complexity_per_function`,`complexity`,`maxFunctionLength`,`functions`,`number_of_functions`,`number_of_commits`,`number_of_authors`,`fanIn`,`fanOut`,`inCycle`,`cycleSize`,`dependencyLevel`,`migrationDebt`,`ffiCrossings`,`imports`,`externalImports`,`builtinImports`,`typeOnlyImports`,`unresolvedImports`],Ls=.75;function Rs(e,t){if(e===null||!Number.isFinite(e)||t.direction>=0)return`none`;if(t.p95<=0)return e>0?`debt`:`ok`;let n=e/t.p95;return n>=1?`debt`:n>=Ls?`watch`:`ok`}function zs(e,t){if(e===null||!Number.isFinite(e))return 0;let n=t.p95>0?t.p95:t.actualMax;if(n<=0)return 0;let r=Math.max(0,e),i=t.mode===`log`?Math.log1p(r)/Math.max(1e-9,Math.log1p(n)):r/n;return Math.max(0,Math.min(1,i))}function Bs(e){return e>=.7?`debt`:e>=.4?`watch`:`ok`}function Vs(e,t,n,r){let i=t.riskParts,a={key:`risk`,title:`Riesgo`,value:Math.round(t.risk*100),share:Math.max(0,Math.min(1,t.risk)),state:Bs(t.risk),area:!1,risk:!0,hint:`${Math.round(t.risk*100)} de 100 · complejidad ${K(i.complexity.value)} (p95 ${K(i.complexity.p95)}) · churn ${K(i.churn.value)} (p95 ${K(i.churn.p95)}) · tamaño ${K(i.size.value)} (p95 ${K(i.size.p95)})`};if(!e)return[a];let o=e.metrics.map((i,a)=>{let o=t.values[a]??null;return{key:i.key,title:r(i.key),value:o,share:zs(o,i),state:Rs(o,i),area:i.key===n,risk:!1,hint:`mín. ${K(i.min)} · p95 ${K(i.p95)} · máx. ${K(i.actualMax)} · ${K(i.coverage)} de ${K(e.files.length)} ficheros`}}),s=e=>{let t=Is.indexOf(e);return t<0?Is.length:t};return o.sort((e,t)=>s(e.key)-s(t.key)),[a,...o]}var Hs=[`function`,`class`,`interface`,`type`,`enum`,`variable`],Us={function:`Funciones`,class:`Clases`,interface:`Interfaces`,type:`Tipos`,enum:`Enums`,variable:`Variables`};function Ws(e){return Hs.map(t=>({kind:t,title:Us[t],symbols:e.filter(e=>e.kind===t)})).filter(e=>e.symbols.length>0)}function Gs(e){if(e.length===0)return;let t=new Map,n=0;for(let r of e)t.set(r.kind,(t.get(r.kind)??0)+1),n=Math.max(n,r.complexity??0);let r=Hs.filter(e=>t.has(e)).map(e=>`${t.get(e)} ${os[e]}`).join(` · `);return n>0?`${r} · máx. ${n}`:r}function Ks(e){let t=new Map;for(let n of e){let e=t.get(n.owner)??[];e.push(n),t.set(n.owner,e)}return[...t.entries()].map(([e,t])=>({owner:e,members:t.sort((e,t)=>e.line-t.line)}))}function qs(e){return e.imports.length+e.exports.length}function Js(e){let t=[];return e.imports.length>0&&t.push(`${e.imports.length} import${e.imports.length===1?``:`s`}`),e.exports.length>0&&t.push(`${e.exports.length} export${e.exports.length===1?``:`s`}`),t.length>0?t.join(` · `):void 0}function Ys(e){if(e.length===0)return;let t=Ks(e),n=t.slice(0,3).map(e=>`${e.owner} ${e.members.length}`),r=t.length-n.length;return r>0&&n.push(`+${r}`),n.join(` · `)}function Xs({label:e,value:t,accent:n}){return(0,x.jsxs)(`div`,{className:`kpi${n?` kpi-${n}`:``}`,children:[(0,x.jsx)(`span`,{children:e}),(0,x.jsx)(`b`,{children:K(t)})]})}function Zs({model:e,migration:t}){if(!t)return(0,x.jsxs)(`section`,{className:`panel-block`,children:[(0,x.jsx)(`div`,{className:`eyebrow`,children:`Estratos`}),(0,x.jsx)(`p`,{className:`muted small`,children:`Este snapshot no trae lente de migración.`})]});let n=Object.entries(t.summary.languages).filter(e=>e[1]!==void 0),r=n.reduce((e,[,t])=>e+t.rloc,0);return(0,x.jsxs)(`section`,{className:`panel-block`,children:[(0,x.jsx)(`div`,{className:`eyebrow`,children:`Estratos`}),(0,x.jsx)(`div`,{className:`strata`,"aria-label":`Reparto por lenguaje`,children:n.map(([e,t])=>t.rloc===0?null:(0,x.jsx)(`i`,{title:`${e}: ${K(t.rloc)} rloc`,style:{width:`${t.rloc/r*100}%`,background:is[e]??`#7b8790`}},e))}),(0,x.jsx)(`div`,{className:`strata-legend`,children:n.map(([e,t])=>(0,x.jsxs)(`div`,{className:`strata-row`,children:[(0,x.jsx)(`i`,{style:{background:is[e]??`#7b8790`}}),(0,x.jsx)(`span`,{children:e}),(0,x.jsx)(`span`,{className:`mono`,children:K(t.rloc)})]},e))}),(0,x.jsx)(`div`,{className:`status-row`,children:[`js`,`rust`,`bridge`,`native`].map(e=>(0,x.jsxs)(`span`,{className:`status-chip`,children:[(0,x.jsx)(`i`,{style:{background:rs[e]}}),ns[e],` `,(0,x.jsx)(`b`,{children:t.summary.status[e]})]},e))}),(0,x.jsxs)(`div`,{className:`muted tiny`,children:[t.summary.ffiEdges,` aristas FFI · `,t.summary.bridgeFiles,` puentes ·`,` `,e?`${K(e.fileCount)} ficheros`:``]})]})}function Qs({colorMode:e,migration:t,model:n}){if(e===`status`&&t)return(0,x.jsxs)(`section`,{className:`panel-block`,children:[(0,x.jsx)(`div`,{className:`eyebrow`,children:`Leyenda`}),(0,x.jsx)(`div`,{className:`legend`,children:[`js`,`rust`,`bridge`,`native`].map(e=>(0,x.jsxs)(`div`,{children:[(0,x.jsx)(`i`,{style:{background:rs[e]}}),(0,x.jsx)(`span`,{children:ns[e]}),(0,x.jsx)(`span`,{className:`mono`,children:t.summary.status[e]})]},e))})]});if(e===`structure`&&n)return(0,x.jsxs)(`section`,{className:`panel-block`,children:[(0,x.jsx)(`div`,{className:`eyebrow`,children:`Leyenda`}),(0,x.jsx)(`div`,{className:`legend`,children:n.sections.slice(0,8).map(e=>(0,x.jsxs)(`div`,{children:[(0,x.jsx)(`i`,{style:{background:e.color}}),(0,x.jsx)(`span`,{className:`ellipsis`,title:e.label,children:e.label}),(0,x.jsx)(`span`,{className:`mono`,children:e.files})]},e.key))})]});if(e===`risk`)return(0,x.jsxs)(`section`,{className:`panel-block`,children:[(0,x.jsx)(`div`,{className:`eyebrow`,children:`Leyenda · riesgo`}),(0,x.jsx)(`div`,{className:`gradient risk`}),(0,x.jsxs)(`div`,{className:`gradient-labels`,children:[(0,x.jsx)(`span`,{children:`bajo`}),(0,x.jsx)(`span`,{children:`alto`})]})]});let r=n?.metrics.find(t=>t.key===e);return r?(0,x.jsxs)(`section`,{className:`panel-block`,children:[(0,x.jsxs)(`div`,{className:`eyebrow`,children:[`Leyenda · `,r.title]}),(0,x.jsx)(`div`,{className:`gradient metric`}),(0,x.jsxs)(`div`,{className:`gradient-labels`,children:[(0,x.jsx)(`span`,{children:K(r.min)}),(0,x.jsx)(`span`,{children:K(r.max)})]}),(0,x.jsxs)(`div`,{className:`muted tiny`,children:[r.coverage,` ficheros · `,r.mode===`log`?`escala log`:`escala lineal`,r.actualMax>r.max?` · máx real ${K(r.actualMax)}`:``]})]}):null}function $s({load:e,onOpenSnapshot:t}){let[n,r]=(0,b.useState)(null);return(0,b.useEffect)(()=>{let t=!1;return(async()=>{let n=await e();t||r(n)})(),()=>{t=!0}},[e]),!n||n.length===0?null:(0,x.jsxs)(`section`,{className:`panel-block`,children:[(0,x.jsx)(`div`,{className:`eyebrow`,children:`Historia`}),(0,x.jsx)(`div`,{className:`history-list`,children:n.slice().reverse().map(e=>(0,x.jsxs)(`button`,{type:`button`,className:`history-row`,onClick:()=>t(e),title:`${e.files} ficheros · ${e.rloc} rloc`,children:[(0,x.jsx)(`span`,{className:`mono history-date`,children:e.date.slice(0,16).replace(`T`,` `)}),(0,x.jsxs)(`span`,{className:`mono history-count`,children:[e.files,` f.`]})]},e.checksum))})]})}function ec(e){return`${e.date.replace(/[:.]/g,`-`).replace(`Z`,``)}-${e.checksum.slice(0,8)}.cc.json`}function tc({model:e,selectedIndex:t,onSelect:n}){let r=e?e.metrics.findIndex(e=>e.key===ss):-1;if(!e||r<0)return null;let i=e.files.map(e=>({file:e,commits:e.values[r]??0})).filter(e=>e.commits>0).sort((e,t)=>t.commits-e.commits).slice(0,8);if(i.length===0)return null;let a=i[0]?.commits??1;return(0,x.jsxs)(`section`,{className:`panel-block`,children:[(0,x.jsx)(`div`,{className:`eyebrow`,children:`Más tocados`}),(0,x.jsx)(`div`,{className:`debt-list`,children:i.map(({file:e,commits:r})=>(0,x.jsxs)(`button`,{type:`button`,className:`debt-row${t===e.index?` is-selected`:``}`,onClick:()=>n(e.index),title:e.path,children:[(0,x.jsx)(`span`,{className:`debt-name`,children:e.path}),(0,x.jsx)(`span`,{className:`debt-track`,children:(0,x.jsx)(`i`,{style:{width:`${Math.max(4,r/a*100)}%`,background:`var(--rust)`}})}),(0,x.jsx)(`span`,{className:`mono`,children:r})]},e.nodeId))})]})}function nc({load:e,onSelectSymbol:t}){let[n,r]=(0,b.useState)(null);if((0,b.useEffect)(()=>{let t=!1;return(async()=>{let n=await e();t||r(n)})(),()=>{t=!0}},[e]),!n||n.length===0)return null;let i=Math.max(1,n[0]?.churn??1);return(0,x.jsxs)(`section`,{className:`panel-block`,children:[(0,x.jsx)(`div`,{className:`eyebrow`,children:`Más reescritos`}),(0,x.jsx)(`div`,{className:`debt-list`,children:n.map(e=>(0,x.jsxs)(`button`,{type:`button`,className:`debt-row`,onClick:()=>t(e.name,e.path),title:`${e.path} · ${e.changes} cambios · ${e.moves} mudanzas`,children:[(0,x.jsx)(`span`,{className:`debt-name`,children:e.name}),(0,x.jsx)(`span`,{className:`debt-track`,children:(0,x.jsx)(`i`,{style:{width:`${Math.max(4,e.churn/i*100)}%`,background:`var(--rust)`}})}),(0,x.jsx)(`span`,{className:`mono`,children:e.churn})]},e.id))})]})}function rc({model:e,migration:t,selectedIndex:n,onSelect:r}){if(!e||!t)return null;let i=e.files.map(e=>({file:e,node:t.nodes[e.nodeId]})).filter(e=>!!e.node?.debt).sort((e,t)=>(t.node.debt??0)-(e.node.debt??0)).slice(0,8),a=i[0]?.node.debt??1;return i.length===0?null:(0,x.jsxs)(`section`,{className:`panel-block`,children:[(0,x.jsx)(`div`,{className:`eyebrow`,children:`Deuda de migración`}),(0,x.jsx)(`div`,{className:`debt-list`,children:i.map(({file:e,node:t})=>(0,x.jsxs)(`button`,{type:`button`,className:`debt-row${n===e.index?` is-selected`:``}`,onClick:()=>r(e.index),title:e.path,children:[(0,x.jsx)(`span`,{className:`debt-name`,children:e.path}),(0,x.jsx)(`span`,{className:`debt-track`,children:(0,x.jsx)(`i`,{style:{width:`${Math.max(4,(t.debt??0)/a*100)}%`,background:rs[t.status]}})}),(0,x.jsx)(`span`,{className:`mono`,children:K(t.debt??0)})]},e.nodeId))})]})}function ic({model:e,file:t,migrationNode:n,areaMetric:r,colorMode:i,metricTitle:a,symbols:o,structure:s,chain:c,onSelectSymbol:l,onColorMode:u}){if(!t)return(0,x.jsxs)(`section`,{className:`inspector-empty`,children:[(0,x.jsx)(`h2`,{children:`Selecciona una celda`}),(0,x.jsx)(`p`,{className:`muted small`,children:`El mapa conserva la jerarquía de carpetas. Pasa el cursor para ver la ruta y haz clic para abrir las métricas del fichero.`}),e?(0,x.jsxs)(`div`,{className:`inspector-note`,children:[(0,x.jsx)(`span`,{className:`mono`,children:e.meta.apiVersion}),(0,x.jsx)(`span`,{children:e.meta.checksum.slice(0,8)||`sin checksum`})]}):null]});let d=Vs(e,t,r,a),f=c?.versions[c.versions.length-1];return(0,x.jsxs)(`section`,{className:`inspector-file`,children:[(0,x.jsx)(`div`,{className:`inspector-path`,title:t.path,children:t.path}),(0,x.jsx)(`h2`,{children:t.name}),n?(0,x.jsxs)(`div`,{className:`inspector-status`,children:[(0,x.jsx)(`span`,{className:`status-dot`,style:{background:rs[n.status]}}),(0,x.jsx)(`span`,{children:ns[n.status]}),(0,x.jsx)(`span`,{className:`mono`,children:n.language})]}):null,(0,x.jsx)(Ns,{id:`file-metrics`,title:`Métricas`,count:d.length,summary:d[0]?.value===null||d[0]?.value===void 0?void 0:`Riesgo ${d[0].value}/100`,children:(0,x.jsxs)(`div`,{className:`metrics-table`,children:[(0,x.jsxs)(`div`,{className:`metrics-head`,"aria-hidden":`true`,children:[(0,x.jsx)(`span`,{children:`Métrica`}),(0,x.jsx)(`span`,{children:`Escala`}),(0,x.jsx)(`span`,{children:`Valor`})]}),(0,x.jsx)(`div`,{className:`metrics-rows`,role:`group`,"aria-label":`Métricas del fichero`,children:d.map(e=>{let t=e.risk?i===`risk`:i===e.key;return(0,x.jsxs)(`button`,{type:`button`,className:`metrics-row metrics-${e.state}${t?` is-active`:``}${e.value===null?` is-empty`:``}`,"aria-pressed":t,title:`${e.hint}. Pulsa para pintar el mapa.`,onClick:()=>u(e.risk?`risk`:e.key),children:[(0,x.jsxs)(`span`,{className:`metrics-label`,children:[e.title,e.area?(0,x.jsx)(`em`,{className:`metrics-area`,title:`Esta métrica decide el área del mapa`,children:`área`}):null]}),(0,x.jsx)(`span`,{className:`metrics-bar`,"aria-hidden":`true`,children:(0,x.jsx)(`i`,{style:{width:`${Math.round(e.share*100)}%`}})}),(0,x.jsxs)(`span`,{className:`metrics-value`,children:[e.value===null?`—`:K(e.value),e.risk&&e.value!==null?(0,x.jsx)(`em`,{children:`/100`}):null]})]},e.key)})}),(0,x.jsx)(`p`,{className:`muted tiny metrics-note`,children:`La barra llega al p95 del proyecto; el riesgo, a 100. Pulsa una fila para pintar el mapa.`})]})}),o.length>0?(0,x.jsx)(Ns,{id:`file-symbols`,title:`Símbolos`,count:o.length,summary:Gs(o),children:(0,x.jsxs)(`div`,{className:`symbol-list`,children:[Ws(o).map(e=>(0,x.jsxs)(`div`,{className:`symbol-group`,children:[(0,x.jsxs)(`div`,{className:`symbol-group-head`,children:[(0,x.jsx)(`span`,{children:e.title}),(0,x.jsx)(`span`,{className:`symbol-group-line`,"aria-hidden":`true`}),(0,x.jsx)(`span`,{className:`mono symbol-group-count`,children:e.symbols.length})]}),e.symbols.map(e=>(0,x.jsxs)(`button`,{type:`button`,className:`symbol-row${c?.name===e.name?` is-selected`:``}`,onClick:()=>l(e.name),title:`${os[e.kind]} ${e.name} · línea ${e.line}${e.complexity===void 0?``:` · complejidad ${e.complexity}`}. Ver la vida de este símbolo.`,children:[(0,x.jsx)(`span`,{className:`symbol-kind symbol-${e.kind}`,children:os[e.kind]}),(0,x.jsx)(`span`,{className:`symbol-name`,title:e.name,children:e.name}),e.complexity===void 0?null:(0,x.jsx)(`span`,{className:`mono symbol-complexity`,title:`Complejidad ciclomática`,children:e.complexity})]},`${e.name}-${e.line}`))]},e.kind)),(0,x.jsx)(`p`,{className:`muted tiny symbol-note`,children:`Agrupados por tipo y ordenados por complejidad. Pulsa uno para seguir su vida.`})]})}):null,s&&qs(s)>0?(0,x.jsx)(Ns,{id:`file-surface`,title:`Superficie`,count:qs(s),summary:Js(s),children:(0,x.jsxs)(`div`,{className:`surface-list`,children:[s.imports.length>0?(0,x.jsxs)(`div`,{className:`surface-group`,children:[(0,x.jsxs)(`div`,{className:`symbol-group-head`,children:[(0,x.jsx)(`span`,{children:`Importa`}),(0,x.jsx)(`span`,{className:`symbol-group-line`,"aria-hidden":`true`}),(0,x.jsx)(`span`,{className:`mono symbol-group-count`,children:s.imports.length})]}),s.imports.map(e=>(0,x.jsxs)(`div`,{className:`surface-row`,children:[(0,x.jsx)(`span`,{className:`mono surface-source`,title:e.source,children:e.source}),(0,x.jsxs)(`span`,{className:`surface-names`,children:[e.names.length>0?e.names.map(e=>(0,x.jsx)(`span`,{className:`surface-name`,children:e},e)):(0,x.jsx)(`span`,{className:`muted tiny`,children:`efecto secundario`}),e.typeOnly?(0,x.jsx)(`span`,{className:`surface-badge`,children:`type`}):null,e.kind===`static`?null:(0,x.jsx)(`span`,{className:`surface-badge`,children:e.kind})]})]},`${e.line}-${e.source}`))]}):null,s.exports.length>0?(0,x.jsxs)(`div`,{className:`surface-group`,children:[(0,x.jsxs)(`div`,{className:`symbol-group-head`,children:[(0,x.jsx)(`span`,{children:`Exporta`}),(0,x.jsx)(`span`,{className:`symbol-group-line`,"aria-hidden":`true`}),(0,x.jsx)(`span`,{className:`mono symbol-group-count`,children:s.exports.length})]}),s.exports.map(e=>(0,x.jsxs)(`div`,{className:`surface-row`,children:[(0,x.jsx)(`span`,{className:`surface-name`,children:e.name}),e.local?(0,x.jsxs)(`span`,{className:`muted tiny`,children:[`desde `,e.local]}):null,e.source?(0,x.jsxs)(`span`,{className:`mono surface-source`,children:[`← `,e.source]}):null,e.typeOnly?(0,x.jsx)(`span`,{className:`surface-badge`,children:`type`}):null]},`${e.line}-${e.name}-${e.source??``}`))]}):null,(0,x.jsx)(`p`,{className:`muted tiny symbol-note`,children:`Lo que el fichero importa y exporta. No son símbolos: no tienen cadena.`})]})}):null,s&&s.members.length>0?(0,x.jsx)(Ns,{id:`file-members`,title:`Miembros`,count:s.members.length,summary:Ys(s.members),children:(0,x.jsxs)(`div`,{className:`member-list`,children:[Ks(s.members).map(e=>(0,x.jsxs)(`div`,{className:`member-group`,children:[(0,x.jsxs)(`div`,{className:`symbol-group-head`,children:[(0,x.jsx)(`span`,{children:e.owner}),(0,x.jsx)(`span`,{className:`symbol-group-line`,"aria-hidden":`true`}),(0,x.jsx)(`span`,{className:`mono symbol-group-count`,children:e.members.length})]}),e.members.map(e=>(0,x.jsxs)(`div`,{className:`member-row`,title:`${e.name} · línea ${e.line}`,children:[(0,x.jsx)(`span`,{className:`symbol-kind member-kind`,children:e.from===`parameter`?`par`:`campo`}),(0,x.jsx)(`span`,{className:`symbol-name`,title:e.name,children:e.name})]},`${e.name}-${e.line}`))]},e.owner)),(0,x.jsx)(`p`,{className:`muted tiny symbol-note`,children:`Campos y propiedades del constructor. No son símbolos: viven dentro de su clase.`})]})}):null,c?(0,x.jsx)(Ns,{id:`file-chain`,title:`La vida de ${c.name}`,count:c.versions.length,summary:f?`última ${f.date.slice(0,10)}`:void 0,children:(0,x.jsx)(`div`,{className:`chain-list`,children:c.versions.map(e=>(0,x.jsxs)(`div`,{className:`chain-row`,children:[(0,x.jsx)(`span`,{className:`mono chain-date`,children:e.date.slice(0,10)}),(0,x.jsx)(`span`,{className:`chain-events`,children:e.events.map(e=>(0,x.jsx)(`span`,{className:`chain-event chain-${e.type}`,children:as[e.type]},e.type))}),(0,x.jsx)(`span`,{className:`chain-path`,title:e.path,children:e.path})]},e.entry))})}):null]})}function ac({label:e,value:t}){return(0,x.jsxs)(`div`,{className:`metric`,children:[(0,x.jsx)(`span`,{children:e}),(0,x.jsx)(`b`,{children:t})]})}function oc({report:e,source:t,error:n,onLoad:r,onSelectPath:i}){if(!e)return(0,x.jsxs)(`section`,{className:`change-panel`,children:[(0,x.jsx)(`div`,{className:`eyebrow`,children:`Cambios`}),(0,x.jsx)(`h2`,{children:`Sin reporte`}),(0,x.jsxs)(`p`,{className:`muted small`,children:[`Carga el `,(0,x.jsx)(`code`,{children:`report.json`}),` que genera `,(0,x.jsx)(`code`,{children:`codarch diff`}),` `,`o la GitHub Action para ver los cambios del snapshot.`]}),(0,x.jsx)(`button`,{className:`button dark`,type:`button`,onClick:r,children:`Abrir reporte`}),n?(0,x.jsx)(`p`,{className:`panel-error`,children:n}):null]});let a=e.summary,o=e.files.changed.slice(0,6),s=e.files.added.slice(0,5),c=e.cycles.introduced.slice(0,4),l=e.migration,u=l?.files.increased.slice(0,6)??[],d=l?.files.decreased.slice(0,6)??[],f=e.symbols,p=f?.files.slice(0,6)??[];return(0,x.jsxs)(`section`,{className:`change-panel`,children:[(0,x.jsxs)(`div`,{className:`eyebrow`,children:[`Cambios · `,t??`report.json`]}),(0,x.jsx)(`h2`,{children:`Cambios de arquitectura`}),(0,x.jsxs)(`div`,{className:`change-checksums mono`,children:[e.base.checksum.slice(0,8)||`base`,` →`,` `,e.head.checksum.slice(0,8)||`head`]}),(0,x.jsxs)(`div`,{className:`change-grid`,children:[(0,x.jsx)(sc,{label:`Ficheros`,value:`+${a.addedFiles} −${a.removedFiles} ~${a.changedFiles}`}),(0,x.jsx)(sc,{label:`Aristas`,value:`+${a.addedEdges} −${a.removedEdges}`}),(0,x.jsx)(sc,{label:`Ciclos`,value:`+${a.introducedCycles} −${a.fixedCycles}`,accent:a.introducedCycles>0?`bad`:void 0}),(0,x.jsx)(sc,{label:`Hotspots`,value:K(a.hotspots)}),l?(0,x.jsx)(sc,{label:`Deuda migración`,value:K(l.debt.head),accent:l.debt.delta>0?`bad`:`good`}):null,f?(0,x.jsx)(sc,{label:`Símbolos`,value:`+${f.summary.added} −${f.summary.removed} ~${f.summary.changed}`}):null]}),l?(0,x.jsxs)(`div`,{className:`change-section`,children:[(0,x.jsx)(`div`,{className:`eyebrow`,children:`Migración`}),(0,x.jsxs)(`div`,{className:`change-summary`,children:[(0,x.jsxs)(`span`,{children:[`deuda `,(0,x.jsx)(`b`,{children:l.debt.base}),` → `,(0,x.jsx)(`b`,{children:l.debt.head})]}),(0,x.jsxs)(`span`,{children:[`cruces FFI `,(0,x.jsx)(`b`,{children:l.crossings.head})]}),(0,x.jsxs)(`span`,{children:[`nativos `,(0,x.jsx)(`b`,{children:l.status.head.native??0})]})]}),u.length===0&&d.length===0?(0,x.jsx)(`p`,{className:`muted small`,children:`La deuda de migración no ha cambiado.`}):(0,x.jsxs)(`div`,{className:`violation-list`,children:[u.map(e=>(0,x.jsx)(cc,{path:e.path,before:e.base,after:e.head,onSelectPath:i},e.id)),d.map(e=>(0,x.jsx)(cc,{path:e.path,before:e.base,after:e.head,onSelectPath:i},e.id))]})]}):null,f&&p.length>0?(0,x.jsxs)(`div`,{className:`change-section`,children:[(0,x.jsx)(`div`,{className:`eyebrow`,children:`Símbolos`}),(0,x.jsx)(`div`,{className:`violation-list`,children:p.map(e=>(0,x.jsxs)(`div`,{className:`symbol-file`,children:[(0,x.jsx)(`button`,{type:`button`,className:`symbol-file-path`,onClick:()=>i(e.path),title:`Ver el fichero en el mapa`,children:e.path}),e.symbols.slice(0,4).map(e=>(0,x.jsxs)(`div`,{className:`symbol-change`,children:[(0,x.jsx)(`span`,{className:`symbol-kind symbol-${e.kind}`,children:e.kind===`function`?`fn`:e.kind.slice(0,3)}),(0,x.jsx)(`span`,{className:`symbol-name`,children:e.name}),(0,x.jsx)(`span`,{className:`mono`,children:e.status===`added`?`nuevo`:e.status===`removed`?`eliminado`:e.complexityDelta===null?`cambió`:`${e.complexityDelta>0?`+`:``}${e.complexityDelta}`})]},`${e.name}-${e.status}`))]},e.id))})]}):null,c.length>0?(0,x.jsxs)(`div`,{className:`change-section`,children:[(0,x.jsx)(`div`,{className:`eyebrow`,children:`Ciclos nuevos`}),(0,x.jsx)(`div`,{className:`change-rows`,children:c.map((e,t)=>(0,x.jsxs)(`div`,{className:`change-cycle`,children:[(0,x.jsxs)(`span`,{className:`mono`,children:[`×`,e.size]}),(0,x.jsx)(`span`,{className:`change-path`,title:e.nodes.map(e=>e.path).join(` → `),children:e.nodes.map(e=>e.path).join(` → `)})]},t))})]}):null,(0,x.jsxs)(`div`,{className:`change-section`,children:[(0,x.jsx)(`div`,{className:`eyebrow`,children:`Ficheros modificados`}),o.length===0?(0,x.jsx)(`p`,{className:`muted small`,children:`Sin ficheros modificados.`}):(0,x.jsx)(`div`,{className:`change-rows`,children:o.map(e=>(0,x.jsxs)(`button`,{type:`button`,className:`change-row`,title:e.path,onClick:()=>i(e.path),children:[(0,x.jsx)(`span`,{className:`change-path`,children:e.path}),(0,x.jsx)(`span`,{className:`mono change-delta`,children:e.changes.slice(0,2).map(e=>`${e.metric} ${e.delta===null?`±`:e.delta>0?`+${K(e.delta)}`:K(e.delta)}`).join(` · `)})]},e.id))}),e.files.changed.length>o.length?(0,x.jsxs)(`p`,{className:`muted tiny`,children:[`+`,e.files.changed.length-o.length,` más`]}):null]}),s.length>0?(0,x.jsxs)(`div`,{className:`change-section`,children:[(0,x.jsx)(`div`,{className:`eyebrow`,children:`Ficheros nuevos`}),(0,x.jsx)(`div`,{className:`change-rows`,children:s.map(e=>(0,x.jsxs)(`button`,{type:`button`,className:`change-row`,title:e.path,onClick:()=>i(e.path),children:[(0,x.jsx)(`span`,{className:`change-path`,children:e.path}),(0,x.jsxs)(`span`,{className:`mono change-delta`,children:[`+`,K(e.metrics.rloc??e.metrics.loc??0)]})]},e.id))})]}):null]})}function sc({label:e,value:t,accent:n}){return(0,x.jsxs)(`div`,{className:`change-stat${n?` change-stat-${n}`:``}`,children:[(0,x.jsx)(`span`,{children:e}),(0,x.jsx)(`b`,{children:t})]})}function cc({path:e,before:t,after:n,onSelectPath:r}){let i=(n??0)-(t??0);return(0,x.jsxs)(`button`,{className:`change-row`,type:`button`,onClick:()=>r(e),children:[(0,x.jsx)(`span`,{className:`change-path`,children:e}),(0,x.jsxs)(`span`,{className:`mono change-delta${i>0?` is-worse`:` is-better`}`,children:[t??0,` → `,n??0,` (`,i>0?`+${i}`:i,`)`]})]})}var lc={introduced:0,existing:1},uc={error:0,warn:1,info:2};function dc(e){return e.replaceAll(`\\`,`/`).replace(/^\.\//,``)}function fc(e,t){if(!e)return[];let n=dc(t),r=[];for(let t of[`introduced`,`existing`])for(let i of e.rules.violations[t])i.files.some(e=>dc(e)===n)&&r.push({status:t,violation:i});return r.sort((e,t)=>lc[e.status]-lc[t.status]||uc[e.violation.severity]-uc[t.violation.severity]||e.violation.rule.localeCompare(t.violation.rule))}function pc(e){let t=0,n=0;for(let r of e)r.status===`introduced`?t+=1:n+=1;return{introduced:t,existing:n}}function mc(e,t,n){if(!e||!t)return[];let r=new Map(n.map(e=>[e.nodeId,e.path])),i=[];for(let n of e.edges)if(n.fromId===t){let e=r.get(n.toId);e&&i.push({kind:n.kind,direction:`out`,path:e})}else if(n.toId===t){let e=r.get(n.fromId);e&&i.push({kind:n.kind,direction:`in`,path:e})}return i.sort((e,t)=>e.path.localeCompare(t.path)||e.direction.localeCompare(t.direction))}function hc(e){let t=0,n=0,r=null;for(let i of e){i.kind===`function`&&(t+=1),i.kind===`variable`&&(n+=1);let e=i.complexity??0;(r===null||e>(r.complexity??0))&&(r=i)}return{count:e.length,functions:t,variables:n,mostComplex:r}}function gc(e){return e===`config`?`equipo`:e===`profile`?`perfil`:e.slice(6)}function _c(e){return e.files[0]??e.edge?.from??e.cycle?.nodes[0]?.path??null}function vc(e){let t=new Map;for(let n of e)t.set(n.source,(t.get(n.source)??0)+1);return[...t.entries()].map(([e,t])=>({source:e,label:gc(e),count:t})).sort((e,t)=>t.count-e.count||e.label.localeCompare(t.label)||e.source.localeCompare(t.source))}function yc({violation:e,status:t,onSelectPath:n,otherThan:r,showStatus:i=!1}){let a=r?e.files.find(e=>e!==r)??_c(e):_c(e),o=e.files.join(`, `)||(e.cycle?e.cycle.nodes.map(e=>e.path).join(` → `):`Sin ruta`),s=e.edge&&!(e.message.includes(e.edge.from)&&e.message.includes(e.edge.to))?e.edge:null,c=e.metric&&!e.message.includes(e.metric.name)?e.metric:null,l=e.cycle&&!e.message.includes(e.cycle.nodes[0]?.path??``)?e.cycle:null;return(0,x.jsxs)(`button`,{type:`button`,className:`violation violation-${e.severity} rules-rule rules-rule-${t}`,onClick:()=>a&&n(a),title:o,children:[(0,x.jsx)(`i`,{}),(0,x.jsxs)(`span`,{children:[(0,x.jsxs)(`b`,{children:[e.rule,(0,x.jsx)(`em`,{className:`violation-source`,title:`De dónde sale la regla`,children:gc(e.source)}),i&&t===`introduced`?(0,x.jsx)(`em`,{className:`violation-source lens-new`,title:`No estaba en base`,children:`nueva`}):null]}),(0,x.jsx)(`small`,{children:e.message}),s?(0,x.jsxs)(`small`,{className:`rules-detail`,children:[s.from,` → `,s.to]}):null,c?(0,x.jsxs)(`small`,{className:`rules-detail`,children:[c.name,` = `,K(c.value),c.max===void 0?``:` · máx. ${K(c.max)}`,c.min===void 0?``:` · mín. ${K(c.min)}`]}):null,l?(0,x.jsxs)(`small`,{className:`rules-detail`,children:[`ciclo de `,l.size,`:`,` `,l.nodes.map(e=>e.path).join(` → `)]}):null,t===`resolved`?(0,x.jsx)(`small`,{className:`rules-detail`,children:`ya no está en el head`}):null]})]})}var bc={complexity:`Complejidad`,churn:`Churn`,size:`Tamaño`},xc=8,Sc=6;function Cc({model:e,file:t,migration:n,report:r,symbols:i,onSelectPath:a}){let o=t.riskParts,s=Object.keys(bc).filter(e=>o[e].weight===0),c=fc(r,t.path),l=pc(c),u=n?.nodes[t.nodeId]??null,d=mc(n,t.nodeId,e?.files??[]),f=hc(i);return(0,x.jsxs)(`div`,{className:`rules-file`,children:[(0,x.jsxs)(`div`,{className:`lens-section`,children:[(0,x.jsx)(`div`,{className:`eyebrow`,children:`Riesgo`}),(0,x.jsxs)(`div`,{className:`lens-risk-head`,children:[(0,x.jsx)(`b`,{className:`lens-risk-value`,children:K(Math.round(t.risk*100))}),(0,x.jsx)(`span`,{className:`lens-risk-unit`,children:`/ 100`})]}),(0,x.jsx)(`div`,{className:`lens-bars`,children:Object.keys(bc).map(e=>{let t=o[e];return(0,x.jsxs)(`div`,{className:`lens-bar-row`,title:`${K(t.value)} de p95 ${K(t.p95)} · peso ${Math.round(t.weight*100)} %`,children:[(0,x.jsx)(`span`,{children:bc[e]}),(0,x.jsx)(`span`,{className:`lens-bar`,children:(0,x.jsx)(`i`,{style:{width:`${Math.round(t.norm*100)}%`}})}),(0,x.jsx)(`span`,{className:`mono`,children:K(t.value)}),(0,x.jsxs)(`span`,{className:`lens-weight`,children:[Math.round(t.weight*100),` %`]})]},e)})}),(0,x.jsx)(`p`,{className:`muted tiny`,children:s.length===0?`Peso del riesgo: complejidad 50 % · churn 32 % · tamaño 18 %, normalizado por el p95 de cada señal.`:s.length===3?`Este snapshot no trae las señales del riesgo.`:`Sin ${s.map(e=>bc[e].toLowerCase()).join(` ni `)} en este snapshot: su peso se reparte entre las demás señales.`}),(0,x.jsxs)(`p`,{className:`muted tiny mono`,children:[`p95 del proyecto · complejidad `,K(o.complexity.p95),` `,`· churn `,K(o.churn.p95),` · tamaño`,` `,K(o.size.p95)]})]}),(0,x.jsxs)(`div`,{className:`lens-section`,children:[(0,x.jsx)(`div`,{className:`eyebrow`,children:`Dominio`}),r?r.rules.configured?c.length===0?(0,x.jsx)(`p`,{className:`muted small`,children:`Ninguna regla violada en este fichero.`}):(0,x.jsxs)(x.Fragment,{children:[(0,x.jsxs)(`div`,{className:`lens-counts`,children:[l.introduced>0?(0,x.jsxs)(`span`,{className:`lens-chip lens-chip-new`,children:[l.introduced,` nueva`,l.introduced===1?``:`s`]}):null,l.existing>0?(0,x.jsxs)(`span`,{className:`lens-chip`,children:[l.existing,` existente`,l.existing===1?``:`s`]}):null]}),(0,x.jsx)(`div`,{className:`violation-list`,children:c.slice(0,xc).map(({status:e,violation:n})=>(0,x.jsx)(yc,{violation:n,status:e,onSelectPath:a,otherThan:t.path,showStatus:!0},`${e}-${n.key}`))}),c.length>xc?(0,x.jsxs)(`p`,{className:`muted tiny`,children:[`y `,c.length-xc,` reglas más en este fichero.`]}):null]}):(0,x.jsx)(`p`,{className:`muted small`,children:`Este reporte no trae reglas de arquitectura configuradas.`}):(0,x.jsxs)(`p`,{className:`muted small`,children:[`La lente de dominio vive en el reporte del diff. Carga un`,` `,(0,x.jsx)(`code`,{children:`report.json`}),` para ver las reglas que toca este fichero.`]})]}),(0,x.jsxs)(`div`,{className:`lens-section`,children:[(0,x.jsx)(`div`,{className:`eyebrow`,children:`Migración`}),n?u?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsxs)(`div`,{className:`inspector-status`,children:[(0,x.jsx)(`span`,{className:`status-dot`,style:{background:rs[u.status]}}),(0,x.jsx)(`span`,{children:ns[u.status]}),(0,x.jsx)(`span`,{className:`mono`,children:u.language})]}),(0,x.jsxs)(`div`,{className:`metric-grid`,children:[(0,x.jsx)(ac,{label:`Deuda`,value:K(u.debt??0)}),(0,x.jsx)(ac,{label:`Cruces FFI`,value:K(u.crossings)})]}),(0,x.jsx)(`p`,{className:`muted tiny`,children:`La deuda de un fichero TS/JS es (complejidad máx. + 1) × (1 + fan-in): lo que costaría migrarlo.`}),d.length===0?(0,x.jsx)(`p`,{className:`muted small`,children:`Sin cruces FFI en este fichero.`}):(0,x.jsxs)(`div`,{className:`lens-edges`,children:[d.slice(0,Sc).map(e=>(0,x.jsxs)(`button`,{type:`button`,className:`lens-edge`,title:e.path,onClick:()=>a(e.path),children:[(0,x.jsx)(`span`,{className:`lens-flag lens-${e.kind}`,children:e.kind}),(0,x.jsxs)(`span`,{className:`lens-edge-path`,children:[e.direction===`out`?`→`:`←`,` `,e.path]})]},`${e.direction}-${e.path}-${e.kind}`)),d.length>Sc?(0,x.jsxs)(`span`,{className:`muted tiny`,children:[`y `,d.length-Sc,` cruces más.`]}):null]})]}):(0,x.jsx)(`p`,{className:`muted small`,children:`La lente no tiene datos de este fichero.`}):(0,x.jsx)(`p`,{className:`muted small`,children:`Este snapshot no trae lente de migración.`})]}),(0,x.jsxs)(`div`,{className:`lens-section`,children:[(0,x.jsx)(`div`,{className:`eyebrow`,children:`Símbolos`}),f.count===0?(0,x.jsx)(`p`,{className:`muted small`,children:`Sin símbolos en este fichero.`}):(0,x.jsxs)(x.Fragment,{children:[(0,x.jsxs)(`p`,{className:`muted small`,children:[f.count,` símbolo`,f.count===1?``:`s`,` ·`,` `,f.functions,` `,f.functions===1?`función`:`funciones`,f.variables>0?` · ${f.variables} ${f.variables===1?`variable`:`variables`}`:``]}),f.mostComplex?.complexity?(0,x.jsxs)(`p`,{className:`muted small`,children:[`El más complejo:`,` `,(0,x.jsx)(`b`,{className:`lens-symbol`,children:f.mostComplex.name}),` `,(0,x.jsx)(`span`,{className:`mono`,children:f.mostComplex.complexity})]}):null]})]})]})}var wc=[{status:`introduced`,title:`Nuevas`,empty:`Ninguna regla nueva: el cambio no rompe la arquitectura.`},{status:`existing`,title:`Existentes`,empty:`Sin deuda de arquitectura previa en este reporte.`},{status:`resolved`,title:`Resueltas`,empty:`No se ha resuelto ninguna violación.`}],Tc=25,Ec=[{title:`Riesgo`,detail:`complejidad, churn y tamaño`},{title:`Dominio`,detail:`reglas del reporte cargado`},{title:`Migración`,detail:`deuda y cruces FFI`},{title:`Símbolos`,detail:`funciones y complejidad`}];function Dc({report:e,source:t,error:n,onLoad:r,onSelectPath:i,file:a,model:o,migration:s,symbols:c}){let l=e?.rules??null,u=l?.summary??null,d=vc(l?[...l.violations.introduced,...l.violations.existing,...l.violations.resolved]:[]),f=e?.hotspots??[];return(0,x.jsxs)(`section`,{className:`rules-panel`,children:[(0,x.jsxs)(`div`,{className:`eyebrow`,children:[`Reglas`,e&&t?` · ${t}`:``]}),(0,x.jsx)(`h2`,{children:a?a.name:`Arquitectura del cambio`}),a?(0,x.jsx)(`div`,{className:`inspector-path`,title:a.path,children:a.path}):null,a?(0,x.jsx)(Cc,{model:o,file:a,migration:s,report:e,symbols:c,onSelectPath:i}):(0,x.jsxs)(`div`,{className:`rules-hint`,children:[(0,x.jsxs)(`p`,{className:`muted small`,children:[`Selecciona una celda para ver el fichero: `,(0,x.jsx)(`b`,{children:`por qué`}),` tiene ese riesgo, qué reglas de dominio toca y qué deuda de migración arrastra.`]}),(0,x.jsx)(`div`,{className:`lens-index`,children:Ec.map(e=>(0,x.jsxs)(`div`,{children:[(0,x.jsx)(`b`,{children:e.title}),(0,x.jsx)(`span`,{children:e.detail})]},e.title))})]}),(0,x.jsxs)(`div`,{className:`rules-change`,children:[(0,x.jsx)(`div`,{className:`eyebrow`,children:`El cambio`}),e?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsxs)(`div`,{className:`change-checksums mono`,children:[e.base.checksum.slice(0,8)||`base`,` →`,` `,e.head.checksum.slice(0,8)||`head`]}),l?.configured&&u?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsxs)(`div`,{className:`change-grid`,children:[(0,x.jsx)(Oc,{label:`Nuevas`,value:u.introduced,accent:u.introduced>0?`bad`:void 0}),(0,x.jsx)(Oc,{label:`Existentes`,value:u.existing}),(0,x.jsx)(Oc,{label:`Resueltas`,value:u.resolved,accent:u.resolved>0?`good`:void 0}),(0,x.jsx)(Oc,{label:`Errores nuevos`,value:u.introducedErrors,accent:u.introducedErrors>0?`bad`:void 0})]}),(0,x.jsxs)(`p`,{className:`rules-meta`,children:[u.introducedWarnings,` aviso`,u.introducedWarnings===1?``:`s`,` nuevo`,u.introducedWarnings===1?``:`s`,` ·`,` `,u.rules,` regla`,u.rules===1?``:`s`,` en`,` `,u.layers,` capa`,u.layers===1?``:`s`,l.profile?(0,x.jsxs)(x.Fragment,{children:[` `,`· perfil `,(0,x.jsx)(`b`,{children:l.profile})]}):null]}),d.length>0?(0,x.jsx)(`div`,{className:`rules-sources`,children:d.map(e=>(0,x.jsxs)(`span`,{className:`rules-chip`,children:[e.label,` `,(0,x.jsx)(`b`,{children:e.count})]},e.source))}):null,wc.map(e=>{let t=l.violations[e.status];return(0,x.jsxs)(`div`,{className:`rules-group`,children:[(0,x.jsxs)(`div`,{className:`rules-group-head`,children:[(0,x.jsx)(`div`,{className:`eyebrow`,children:e.title}),(0,x.jsx)(`span`,{className:`rules-count rules-count-${e.status}`,children:t.length})]}),t.length===0?(0,x.jsx)(`p`,{className:`muted small`,children:e.empty}):(0,x.jsx)(`div`,{className:`violation-list`,children:t.slice(0,Tc).map(t=>(0,x.jsx)(yc,{violation:t,status:e.status,onSelectPath:i},t.key))}),t.length>Tc?(0,x.jsxs)(`p`,{className:`muted tiny`,children:[`y `,t.length-Tc,` más en el reporte.`]}):null]},e.status)})]}):(0,x.jsxs)(`div`,{className:`change-section`,children:[(0,x.jsx)(`div`,{className:`eyebrow`,children:`Sin configuración`}),(0,x.jsxs)(`p`,{className:`muted small`,children:[`Este reporte no trae reglas de arquitectura. Añádelas a`,` `,(0,x.jsx)(`code`,{children:`.codarch.yml`}),` para que el diff las evalúe.`]})]}),(0,x.jsxs)(`div`,{className:`change-section`,children:[(0,x.jsxs)(`div`,{className:`eyebrow`,children:[`Hotspots · `,e.hotspotMetric??`métrica`]}),f.length===0?(0,x.jsx)(`p`,{className:`muted small`,children:`Ningún fichero destaca en la métrica del cambio.`}):(0,x.jsx)(`div`,{className:`change-rows`,children:f.map(e=>(0,x.jsxs)(`button`,{type:`button`,className:`change-row`,title:e.path,onClick:()=>i(e.path),children:[(0,x.jsx)(`span`,{className:`change-path`,children:e.path}),(0,x.jsxs)(`span`,{className:`mono change-delta${e.delta>0?` is-worse`:``}`,children:[K(e.base),` →`,` `,K(e.head)]})]},`${e.id}-${e.metric}`))})]})]}):(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(`p`,{className:`rules-empty-title`,children:`Sin reporte`}),(0,x.jsxs)(`p`,{className:`muted small`,children:[`Las reglas se evalúan en el diff. Carga el`,` `,(0,x.jsx)(`code`,{children:`report.json`}),` que genera `,(0,x.jsx)(`code`,{children:`codarch diff`}),` o la GitHub Action para ver qué rompe el cambio, qué deuda ya estaba y qué se ha resuelto.`]}),(0,x.jsx)(`button`,{className:`button dark`,type:`button`,onClick:r,children:`Abrir reporte`}),n?(0,x.jsx)(`p`,{className:`panel-error`,children:n}):null]})]})]})}function Oc({label:e,value:t,accent:n}){return(0,x.jsxs)(`div`,{className:`change-stat${n?` change-stat-${n}`:``}`,children:[(0,x.jsx)(`span`,{children:e}),(0,x.jsx)(`b`,{children:K(t)})]})}function kc({app:e,topbarActions:t,topbarTrailing:n,banner:r,overlay:i,onCancelAnalysis:a,onOpenHistory:o,onLoadReport:s,settings:c,className:l,onDragOver:u,onDragLeave:d,onDrop:f}){let{cc:p,source:m,areaMetric:h,colorMode:g,query:_,selectedIndex:v,error:y,loading:S,report:C,reportSource:w,reportError:T,tab:E,focusPath:D,progress:O,chain:k,zoom:A,center:ee,showLabels:te,pluginView:ne,watch:re,refreshedAt:j}=e.state,{selectIndex:M,openSymbolChain:N,zoomAt:ie,panMap:ae,fitMap:oe,setAreaMetric:se,setColorMode:ce,setQuery:le,setFocusPath:ue,setTab:de,setSettingsOpen:fe,setPluginView:pe}=e.actions,{view:P,detail:me,migration:he,hasChurn:F,metricOptions:I,metricTitle:ge,selectedFile:_e,selectedMigration:ve,selectedSymbols:ye,selectedStructure:be,pluginViews:L,activePluginView:xe,pluginContext:Se,matches:Ce,searchRef:we,addonsWithViews:Te,selectPath:Ee,loadHistory:De,loadHeat:Oe}=e,ke=(0,b.useRef)(null),Ae=P.model?.meta.title??p?.meta.projectName??`Sin snapshot`,R=(0,b.useMemo)(()=>me?.roots??[],[me]),je=t=>{ke.current?.removeAttribute(`open`),e.applyView(Cs(t.state))};return(0,x.jsxs)(`div`,{className:`app${l?` ${l}`:``}`,onDragOver:u,onDragLeave:d,onDrop:f,children:[(0,x.jsxs)(`header`,{className:`topbar`,children:[(0,x.jsxs)(`div`,{className:`brand`,children:[(0,x.jsx)(`span`,{className:`brand-mark`,children:`CODARCH`}),(0,x.jsx)(`span`,{className:`brand-sub`,children:`atlas de arquitectura`})]}),(0,x.jsxs)(`div`,{className:`snapshot-meta`,children:[(0,x.jsxs)(`span`,{className:`mono`,children:[m,P.model?.meta.checksum?` · ${P.model.meta.checksum.slice(0,8)}`:``,P.model?.meta.commit?` · ${P.model.meta.commit.slice(0,8)}`:``]}),(0,x.jsx)(Nc,{watch:re}),(0,x.jsx)(Mc,{at:j})]}),(0,x.jsxs)(`div`,{className:`topbar-actions`,children:[t,Te.length>0?(0,x.jsxs)(`details`,{className:`open-menu`,ref:ke,children:[(0,x.jsx)(`summary`,{className:`button ghost`,children:`Vistas`}),(0,x.jsx)(`div`,{className:`open-menu-panel`,children:Te.map(e=>(0,x.jsxs)(`div`,{className:`open-menu-group`,children:[(0,x.jsx)(`span`,{className:`open-menu-label`,title:e.description??e.title,children:e.title}),e.views.map(t=>(0,x.jsx)(`button`,{type:`button`,title:t.description??t.title,onClick:()=>je(t),children:t.title},`${e.name}:${t.id}`))]},e.name))})]}):null,n,(0,x.jsx)(`button`,{className:`button ghost icon-button`,type:`button`,onClick:()=>fe(!0),title:`Ajustes`,"aria-label":`Ajustes`,children:(0,x.jsxs)(`svg`,{viewBox:`0 0 16 16`,width:`14`,height:`14`,"aria-hidden":`true`,children:[(0,x.jsx)(`path`,{fill:`currentColor`,d:`M8 5.2a2.8 2.8 0 1 0 0 5.6 2.8 2.8 0 0 0 0-5.6Zm0 1.6a1.2 1.2 0 1 1 0 2.4 1.2 1.2 0 0 1 0-2.4Z`}),(0,x.jsx)(`path`,{fill:`currentColor`,d:`M6.6.9h2.8l.3 1.6c.4.1.8.3 1.1.5l1.4-.9 2 2-.9 1.4c.2.4.4.7.5 1.1l1.6.3v2.8l-1.6.3c-.1.4-.3.8-.5 1.1l.9 1.4-2 2-1.4-.9c-.4.2-.7.4-1.1.5l-.3 1.6H6.6l-.3-1.6c-.4-.1-.8-.3-1.1-.5l-1.4.9-2-2 .9-1.4c-.2-.4-.4-.7-.5-1.1l-1.6-.3V6.9l1.6-.3c.1-.4.3-.8.5-1.1l-.9-1.4 2-2 1.4.9c.3-.2.7-.4 1.1-.5L6.6.9Z`})]})})]})]}),(0,x.jsxs)(`div`,{className:`project-band`,children:[(0,x.jsxs)(`div`,{className:`project-ident`,children:[(0,x.jsx)(`span`,{className:`project-label`,children:`Proyecto`}),(0,x.jsx)(`h1`,{title:Ae,children:Ae})]}),D?(0,x.jsxs)(`div`,{className:`breadcrumb`,children:[(0,x.jsx)(`button`,{type:`button`,onClick:()=>ue(null),children:`Todo`}),(0,x.jsx)(`span`,{children:`/`}),(0,x.jsx)(`span`,{children:D})]}):null,(0,x.jsxs)(`div`,{className:`project-kpis`,children:[(0,x.jsx)(Xs,{label:`ficheros`,value:P.model?.fileCount??0}),(0,x.jsx)(Xs,{label:`carpetas`,value:P.model?.folderCount??0}),(0,x.jsx)(Xs,{label:P.model?.areaTitle??`área`,value:P.model?.totalArea??0}),(0,x.jsx)(Xs,{label:`deuda`,value:he?.summary.migrationDebt??0,accent:he?`debt`:void 0})]})]}),(0,x.jsxs)(`div`,{className:`shell`,children:[(0,x.jsxs)(`aside`,{className:`rail`,children:[(0,x.jsxs)(`section`,{className:`panel-block`,children:[(0,x.jsx)(`div`,{className:`eyebrow`,children:`Vista`}),(0,x.jsxs)(`label`,{className:`field`,children:[(0,x.jsx)(`span`,{children:`Área`}),(0,x.jsx)(`select`,{value:h??``,onChange:e=>se(e.target.value),children:I.map(e=>(0,x.jsx)(`option`,{value:e,children:ge(e)},e))})]}),(0,x.jsxs)(`label`,{className:`field`,children:[(0,x.jsx)(`span`,{children:`Color`}),(0,x.jsxs)(`select`,{value:g,onChange:e=>ce(e.target.value),children:[(0,x.jsx)(`option`,{value:`risk`,children:`Riesgo`}),(0,x.jsx)(`option`,{value:`structure`,children:`Estructura`}),F?(0,x.jsx)(`option`,{value:`churn`,children:`Calor (commits)`}):null,he?(0,x.jsx)(`option`,{value:`status`,children:`Estado de migración`}):null,I.map(e=>(0,x.jsx)(`option`,{value:e,children:ge(e)},e))]})]}),(0,x.jsxs)(`label`,{className:`field search-field`,children:[(0,x.jsx)(`span`,{children:`Buscar`}),(0,x.jsx)(`input`,{ref:we,type:`search`,placeholder:`ruta o fichero…`,title:`Pulsa / para buscar; Enter abre el primer resultado`,value:_,onChange:e=>le(e.target.value),onKeyDown:e=>{if(e.key!==`Enter`||!P.model)return;let t=_.trim().toLowerCase();if(!t)return;let n=P.model.files.find(e=>e.path.toLowerCase().includes(t));n&&(M(n.index),de(`file`))}})]}),_?(0,x.jsxs)(`div`,{className:`muted tiny`,children:[Ce,` de `,P.model?.fileCount??0,` ficheros`]}):null]}),(0,x.jsx)(Zs,{model:P.model,migration:he}),(0,x.jsx)(Qs,{colorMode:g,migration:he,model:P.model}),(0,x.jsx)($s,{load:De,onOpenSnapshot:o}),(0,x.jsx)(tc,{model:P.model,selectedIndex:v,onSelect:M}),(0,x.jsx)(nc,{load:Oe,onSelectSymbol:(e,t)=>{N(e,t)}}),(0,x.jsx)(rc,{model:P.model,migration:he,selectedIndex:v,onSelect:M})]}),(0,x.jsxs)(`main`,{className:`stage`,children:[r,L.length>0?(0,x.jsxs)(`div`,{className:`stage-tabs`,children:[(0,x.jsx)(`button`,{type:`button`,className:`stage-tab${ne===null?` is-active`:``}`,onClick:()=>pe(null),children:`Mapa`}),L.map(e=>(0,x.jsx)(`button`,{type:`button`,className:`stage-tab${ne===e.id?` is-active`:``}`,onClick:()=>pe(e.id),children:e.label},e.id))]}):null,(0,x.jsxs)(`div`,{className:`map-frame`,children:[S?(0,x.jsx)(`div`,{className:`empty`,children:`Cargando snapshot…`}):P.error||y?(0,x.jsxs)(`div`,{className:`empty error`,children:[(0,x.jsx)(`strong`,{children:`No se pudo dibujar el mapa.`}),(0,x.jsx)(`span`,{children:P.error??y})]}):P.model?ne&&xe?(0,x.jsx)(`div`,{className:`plugin-stage`,children:xe.render(Se)}):(0,x.jsx)(gs,{model:P.model,roots:R,colorMode:g,migration:he,query:_.trim().toLowerCase(),selectedIndex:v,onSelect:M,onFocusFolder:ue,zoom:A,center:ee,onZoomAt:ie,showLabels:te,onPan:ae}):(0,x.jsx)(`div`,{className:`empty`,children:`Abre un cc.json para empezar.`}),i]}),(0,x.jsxs)(`div`,{className:`stage-foot`,children:[(0,x.jsxs)(`div`,{className:`map-controls`,children:[(0,x.jsx)(`button`,{type:`button`,onClick:()=>ie(1.25),disabled:A>=8,title:`Acercar`,"aria-label":`Acercar`,children:`+`}),(0,x.jsxs)(`span`,{className:`map-zoom-level`,children:[Math.round(A*100),`%`]}),(0,x.jsx)(`button`,{type:`button`,onClick:()=>ie(1/1.25),disabled:A<=1,title:`Alejar`,"aria-label":`Alejar`,children:`−`}),(0,x.jsx)(`button`,{type:`button`,onClick:oe,disabled:A===1,title:`Ver el mapa entero`,children:`Ajustar`}),(0,x.jsx)(`span`,{className:`map-controls-hint`,title:`Con el botón derecho apretado, arrastra para mover el mapa`,children:`botón derecho: mover`})]}),(0,x.jsx)(`span`,{children:P.model?`${P.model.fileCount} ficheros · ${P.model.folderCount} carpetas · ${P.model.meta.apiVersion}`:`—`}),O?(0,x.jsxs)(`span`,{className:`progress-cell`,children:[(0,x.jsx)(`span`,{className:`mono detail-note`,children:O}),a?(0,x.jsx)(`button`,{className:`button ghost small`,type:`button`,onClick:a,title:`Cortar el análisis`,children:`Cancelar`}):null]}):me&&me.hiddenFiles>0?(0,x.jsx)(`span`,{className:`mono detail-note`,children:`nivel carpeta · ${me.cells} bloques · ${me.hiddenFiles} ficheros dentro`}):(0,x.jsx)(`span`,{className:`mono`,children:P.model?.warnings[0]??`clic en una celda para inspeccionar`})]})]}),(0,x.jsxs)(`aside`,{className:`inspector`,children:[(0,x.jsxs)(`div`,{className:`tabs`,role:`tablist`,"aria-label":`Panel derecho`,children:[(0,x.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":E===`file`,className:`tab${E===`file`?` is-active`:``}`,onClick:()=>de(`file`),children:`Fichero`}),(0,x.jsxs)(`button`,{type:`button`,role:`tab`,"aria-selected":E===`rules`,className:`tab${E===`rules`?` is-active`:``}`,onClick:()=>de(`rules`),children:[`Reglas`,` `,C?.rules.summary.introduced?(0,x.jsx)(`i`,{className:`tab-dot tab-dot-alert`,title:`${C.rules.summary.introduced} violaciones nuevas`}):null]}),(0,x.jsxs)(`button`,{type:`button`,role:`tab`,"aria-selected":E===`changes`,className:`tab${E===`changes`?` is-active`:``}`,onClick:()=>de(`changes`),children:[`Cambios`,` `,C?(0,x.jsx)(`i`,{className:`tab-dot`,title:`Reporte cargado`}):null]})]}),E===`file`?(0,x.jsx)(ic,{model:P.model,file:_e,migrationNode:ve,areaMetric:h,colorMode:g,metricTitle:ge,symbols:ye,structure:be,chain:k,onSelectSymbol:e=>{N(e,_e?.path??``)},onColorMode:ce}):E===`rules`?(0,x.jsx)(Dc,{report:C,source:w,error:T,onLoad:s,onSelectPath:e=>{let t=P.model?.files.findIndex(t=>t.path===e)??-1;t>=0&&M(t)},file:_e,model:P.model,migration:he,symbols:ye}):(0,x.jsx)(oc,{report:C,source:w,error:T,onLoad:s,onSelectPath:Ee})]})]}),c]})}var Ac={live:`live`,paused:`live en pausa`,none:`sin vigilancia`},jc={live:`El repositorio se reanaliza al guardar y el mapa se refresca solo.`,paused:`La vigilancia está en pausa: el mapa no cambia hasta reanalizar.`,none:`Sin vigilancia: el mapa se actualiza al analizar el repositorio.`};function Mc({at:e}){return(0,x.jsx)(`span`,{className:`refresh-notice${e===null?``:` is-new`}`,title:`El mapa se ha puesto al día con lo que hay en el repositorio.`,"aria-live":`polite`,children:`actualizado`},e??0)}function Nc({watch:e}){return(0,x.jsxs)(`span`,{className:`watch-indicator watch-${e}`,title:jc[e],children:[(0,x.jsx)(`i`,{}),Ac[e]]})}var Pc=`modulepreload`,Fc=function(e){return`/`+e},Ic={},Lc=function(e){return e.pathname.endsWith(`.css`)},Rc=function(e,t,n){if(t in e)return e[t];let r=n();if(!r){e[t]=void 0;return}let i=r.then(()=>{e[t]=void 0},n=>{throw e[t]=void 0,n});return e[t]=i,i},zc=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e,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?new URL(import.meta.resolve(e)):new URL(e,import.meta.url)}r=o(t.map(t=>{t=Fc(t,n);let r=s(t),i=Lc(r);return Rc(Ic,r.href,()=>{if(e===void 0){e={all:new Set,styles:new Set};let t=document.getElementsByTagName(`link`);for(let n=t.length-1;n>=0;n--){let r=t[n];e.all.add(r.href),r.rel===`stylesheet`&&e.styles.add(r.href)}}if((i?e.styles:e.all).has(r.href))return;let t=document.createElement(`link`);if(t.rel=i?`stylesheet`:Pc,i||(t.as=`script`),t.crossOrigin=``,t.href=r.href,a&&t.setAttribute(`nonce`,a),document.head.appendChild(t),i)return new Promise((e,n)=>{t.addEventListener(`load`,e),t.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${r}`)))})})}).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)})},Bc=[{manifest:{name:`vista-3d`,version:`0.2.0`,title:`Vista 3D`,description:`El mapa en tres dimensiones: cada fichero es una caja, la altura dice cuánto pesa y las carpetas son contenedores.`,icon:`cube`,contributes:{views:[`vista-3d`]},requires:{webgl2:!0}},load:async()=>{let e=await zc(()=>import(`./vista-3d-C9NSPmeg.js`),__vite__mapDeps([0,1]));return e.default??e}}];function Vc(e){let[t,n]=(0,b.useState)(()=>e.read()),[r,i]=(0,b.useState)({}),[a,o]=(0,b.useState)([]);(0,b.useEffect)(()=>{let e=!1;return(async()=>{for(let n of Bc){let a=n.manifest.name;if(t.includes(a)&&!r[a])try{let t=await n.load();if(e)return;i(e=>({...e,[a]:t}))}catch{if(e)return;o(e=>e.includes(a)?e:[...e,a])}}})(),()=>{e=!0}},[t,r]);let s=(0,b.useCallback)((t,r)=>{n(n=>{let i=zr(n,t,r);return e.write(i),i})},[e]),c=(0,b.useCallback)(e=>r[e]??null,[r]);return(0,b.useMemo)(()=>({descriptors:Bc,enabled:t,toggle:s,moduleOf:c,failed:a}),[t,s,c,a])}function Hc(e,t){for(let n of e){if(n.kind===`folder`&&n.path===t)return n;if(n.children){let e=Hc(n.children,t);if(e)return e}}return null}var Uc={maxFiles:800,maxCells:1500};function Wc(e){return e.kind===`file`?e:{kind:`folder`,key:e.key,name:e.name,path:e.path,value:e.value,fileCount:e.fileCount,section:e.section,children:[]}}function Gc(e,t){if(e.kind===`file`)return{node:e,cells:1,visibleFiles:1,collapsedFolders:0};let n=e.children??[];if(e.fileCount<=t.maxFiles){let r=0,i=0,a=0,o=[];for(let e of n){let n=Gc(e,t);o.push(n.node),r+=n.cells,i+=n.visibleFiles,a+=n.collapsedFolders}return{node:{...e,children:o},cells:r+1,visibleFiles:i,collapsedFolders:a}}let r=n.map(Wc),i=r.length>t.maxCells?[...r].sort((e,t)=>t.value-e.value||e.path.localeCompare(t.path)).slice(0,t.maxCells):r,a=i.filter(e=>e.kind===`file`).length;return{node:{...e,children:i},cells:i.length+1,visibleFiles:a,collapsedFolders:1}}function Kc(e,t=Uc,n=0){let r=0,i=0,a=0,o=[];for(let n of e){let e=Gc(n,t);o.push(e.node),r+=e.cells,i+=e.visibleFiles,a+=e.collapsedFolders}return{roots:o,cells:r,visibleFiles:i,hiddenFiles:Math.max(0,n-i),collapsedFolders:a}}function qc(e,t={}){let[n,r]=(0,b.useState)(null),[i,a]=(0,b.useState)(t.sourceInicial??`sin proyecto`),[o,s]=(0,b.useState)(null),[c,l]=(0,b.useState)(`risk`),[u,d]=(0,b.useState)(``),[f,p]=(0,b.useState)(null),[m,h]=(0,b.useState)(null),[g,_]=(0,b.useState)(!0),[v,y]=(0,b.useState)(null),[x,S]=(0,b.useState)(null),[C,w]=(0,b.useState)(null),[T,E]=(0,b.useState)(`file`),D=(0,b.useRef)(T);(0,b.useEffect)(()=>{D.current=T},[T]);let[O,k]=(0,b.useState)(null),[A,ee]=(0,b.useState)(null),[te,ne]=(0,b.useState)(null),[re,j]=(0,b.useState)(!1),[M,N]=(0,b.useState)(1),[ie,ae]=(0,b.useState)({x:.5,y:.5}),[oe,se]=(0,b.useState)(!0),ce=Vc(e.plugins),[le,ue]=(0,b.useState)([]),[de,fe]=(0,b.useState)(null),[pe,P]=(0,b.useState)(`none`),[me,he]=(0,b.useState)(null),F=(0,b.useRef)(void 0),I=(0,b.useRef)(null),ge=(0,b.useRef)(null);F.current===void 0&&(F.current=e.leerPreferencias());let _e=(0,b.useRef)(null),ve=(0,b.useCallback)((e,t)=>{let n=Math.min(8,Math.max(1,M*e));if(n!==M){if(t){let e=t.x-ie.x,r=t.y-ie.y,i=1-n/M;ae({x:Math.min(1,Math.max(0,ie.x+e*i)),y:Math.min(1,Math.max(0,ie.y+r*i))})}N(n)}},[M,ie]),ye=(0,b.useCallback)((e,t)=>{ae(n=>{let r=1-1/M;return r<=.001?n:{x:Math.min(1,Math.max(0,n.x-e/r)),y:Math.min(1,Math.max(0,n.y-t/r))}})},[M]),be=(0,b.useCallback)(()=>{N(1),ae({x:.5,y:.5})},[]),L=(0,b.useMemo)(()=>n?vo(n):null,[n]),xe=(0,b.useMemo)(()=>so(n),[n]),Se=(0,b.useMemo)(()=>L?L.metricCoverage.some(e=>e.name===ss):!1,[L]),Ce=(0,b.useCallback)((e,t,n=!1,i)=>{try{let o=mo(e),c=vo(o),u=new Set(c.metricCoverage.map(e=>e.name)),f=u.has(`rloc`)?`rloc`:yo(c)??c.metricCoverage[0]?.name??null,m=i??F.current,g=m?.areaMetric&&u.has(m.areaMetric)?m.areaMetric:f,_=m?.colorMode,v=_&&(_===`risk`||_===`structure`||_===`status`&&o.lenses?.migration||u.has(_))?_:null,y=o.lenses?.migration&&u.has(`migrationDebt`)?`migrationDebt`:`risk`,b=o.meta.checksum??null,x=I.current;return I.current=b,n&&x&&b!==x&&he(Date.now()),r(o),a(t),s(e=>n&&e&&u.has(e)?e:g),l(e=>n?e===`risk`||e===`structure`||e===`status`||u.has(e)?e:`risk`:v??y),n||(d(``),_e.current=null,p(null),k(null),i&&se(i.showLabels)),h(null),!0}catch(e){return h(e.message),!1}finally{_(!1)}},[]),we=(0,b.useCallback)((e,t,n=!0)=>{let r=oo(e);return r?(y(r),S(t),w(null),n&&D.current!==`rules`&&E(`changes`),!0):(w(`El fichero ${t} no parece un report.json de CodArch.`),!1)},[]),Te=(0,b.useCallback)(()=>{y(null),S(null),w(null),E(`file`)},[]),Ee=(0,b.useCallback)((t,n)=>Ce(t,n)?(ue([]),e.escribirProyecto({snapshot:t,report:null,label:n,reportLabel:null,addons:[]}),Te(),!0):!1,[Ce,Te,e]),De=(0,b.useCallback)((t,r)=>{if(!we(t,r))return!1;let a=e.leerProyecto();if(a){let o=n&&i===a.label?n:a.snapshot;e.escribirProyecto({...a,snapshot:o,report:t,reportLabel:r})}return!0},[n,we,e,i]),Oe=(0,b.useCallback)(async()=>{let{elegirCarpeta:t,analizar:n}=e;if(!t||!n)return;let r=await t();if(r){_(!0),h(null),ee(`Analizando ${r}...`);try{let t=await n(r);Ce(t.snapshot,r,!1,t.preferences)&&(ue(t.addons.addons),e.escribirProyecto({snapshot:t.snapshot,report:null,label:r,reportLabel:null,addons:t.addons.addons}),Te())}catch(e){h(e.message)}finally{ee(null),_(!1)}}},[Ce,Te,e]),ke=(0,b.useCallback)(async()=>{let{elegirFichero:t,leerJson:n}=e;if(!t||!n)return;let r=await t();if(r){_(!0),h(null);try{Ee(await n(r),r)}catch(e){h(e.message)}finally{_(!1)}}},[e,Ee]),Ae=(0,b.useCallback)(async()=>{let{elegirFichero:t,leerJson:n}=e;if(!t||!n)return;let r=await t();if(r)try{De(await n(r),r)}catch(e){h(e.message)}},[e,De]),R=(0,b.useMemo)(()=>{if(!n||!o)return{model:null,error:null};try{return{model:Fo(n,{areaMetric:o,color:c===`status`?`risk`:c,title:n.meta.projectName}),error:null}}catch(e){return{model:null,error:e.message}}},[n,o,c]),je=(0,b.useMemo)(()=>{if(!R.model)return null;let e=O?Hc(R.model.roots,O):null;return Kc(e?[e]:R.model.roots,Uc,e?e.fileCount:R.model.fileCount)},[R.model,O]),Me=(0,b.useCallback)(e=>{p(e);let t=e===null?void 0:R.model?.files[e];_e.current=t?.path??null},[R.model]),Ne=(0,b.useCallback)(async(t,n)=>{let r=R.model?.files.find(e=>e.path===n);if(r&&Me(r.index),!e.cadenas)return;let i=await e.cadenas(t),a=i&&typeof i==`object`?i.chains:null;!Array.isArray(a)||a.length===0?ne(null):ne(a[0]??null)},[R.model,Me,e]),Pe=(0,b.useRef)(null),Fe=(0,b.useMemo)(()=>L?Fs(L.metricCoverage.map(e=>e.name)):[],[L]),Ie=n?.lenses?.metrics?.attributeDescriptors,Le=(0,b.useCallback)(e=>Ie?.[e]?.title??e,[Ie]),Re=(0,b.useMemo)(()=>Fe.map(e=>({value:e,label:Le(e)})),[Fe,Le]),ze=(0,b.useMemo)(()=>{let e=[{value:`risk`,label:`Riesgo`},{value:`structure`,label:`Estructura`}];Se&&e.push({value:`churn`,label:`Calor (commits)`}),xe&&e.push({value:`status`,label:`Estado de migración`});for(let t of Re)e.push(t);return e},[Se,xe,Re]),Be=R.model&&f!==null?R.model.files[f]??null:null,Ve=Be?xe?.nodes[Be.nodeId]??null:null,He=(0,b.useMemo)(()=>Be&&n?xo(n,Be.nodeId):[],[n,Be]),Ue=(0,b.useMemo)(()=>Be&&n?n.lenses?.structure?.nodes[Be.nodeId]??null:null,[n,Be]),We=(0,b.useMemo)(()=>{let e=[];for(let t of ce.descriptors){if(!ce.enabled.includes(t.manifest.name))continue;let n=ce.moduleOf(t.manifest.name);for(let t of n?.views??[])e.push(t)}return e},[ce]),Ge=We.find(e=>e.id===de)??null,Ke=(0,b.useMemo)(()=>({model:R.model,selection:Be?.path??null,actions:{select:e=>{let t=R.model?.files.findIndex(t=>t.path===e);t!==void 0&&t>=0&&Me(t)},focus:e=>k(e),setTab:e=>E(e)},preferences:{areaMetric:o,colorMode:c},colorFor:e=>{let t=R.model?.files[e];return!t||!R.model?`#d5d2ca`:us(t,c,R.model,xe,ls(R.model))},url:{read:()=>({areaMetric:o,colorMode:c,focusPath:O,filePath:Be?.path??null,tab:T}),write:e=>{e.areaMetric!==void 0&&s(e.areaMetric),e.colorMode!==void 0&&l(e.colorMode),e.focusPath!==void 0&&k(e.focusPath)}},storage:Os()}),[R.model,Be,o,c,O,T,Me,xe]),qe=(0,b.useMemo)(()=>{if(!R.model||u.trim()===``)return R.model?.fileCount??0;let e=u.trim().toLowerCase();return R.model.files.filter(t=>t.path.toLowerCase().includes(e)).length},[R.model,u]),Je=(0,b.useMemo)(()=>le.filter(e=>e.views.length>0),[le]),Ye=(0,b.useCallback)(e=>{let t=R.model?.files.findIndex(t=>t.path===e)??-1;t>=0&&(Me(t),E(`file`))},[Me,R.model]),Xe=(0,b.useCallback)(e=>{if(!R.model||!L)return;let t=new Set(L.metricCoverage.map(e=>e.name));if(e.areaMetric&&t.has(e.areaMetric)&&s(e.areaMetric),e.colorMode&&ws(e.colorMode,t,xe)&&l(e.colorMode),e.focusPath&&Hc(R.model.roots,e.focusPath)&&k(e.focusPath),e.filePath){let t=R.model.files.findIndex(t=>t.path===e.filePath);t>=0&&Me(t)}e.tab&&E(e.tab),e.showLabels!==null&&se(e.showLabels),e.symbolName&&Ne(e.symbolName,e.filePath??``)},[R.model,L,xe,Me,Ne]),Ze=(0,b.useCallback)(async()=>e.historial?e.historial():null,[e]),Qe=(0,b.useCallback)(async()=>e.calor?e.calor():null,[e]);return(0,b.useEffect)(()=>{let e=R.model?.files;if(!e){Me(null);return}let t=_e.current;if(t){let n=e.findIndex(e=>e.path===t);if(n>=0){Me(n);return}}Me(R.model?.defaultSelection??null)},[R.model,Me]),(0,b.useEffect)(()=>{if(typeof window>`u`)return;let e=e=>{let t=e.target,n=t instanceof HTMLInputElement||t instanceof HTMLTextAreaElement||t instanceof HTMLSelectElement;e.key===`/`&&!n?(e.preventDefault(),Pe.current?.focus()):e.key===`Escape`&&(k(null),_e.current=null,p(null),d(``),n&&t.blur())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[]),(0,b.useEffect)(()=>{if(!n||!o)return;let t={areaMetric:o,colorMode:c,showLabels:oe};F.current=t;let r=JSON.stringify(t);r!==ge.current&&(ge.current=r,e.escribirPreferencias(t))},[n,o,c,oe,e]),(0,b.useEffect)(()=>{if(!e.restaurarProyecto)return;let t=!1;return(async()=>{let n=await e.restaurarProyecto?.();t||(n&&Ce(n.snapshot,n.label,!1,n.preferences)?(ue(n.addons??[]),n.report&&we(n.report,n.reportLabel??`report.json`,!1)):(n&&e.borrarProyecto(),_(!1)))})(),()=>{t=!0}},[Ce,we,e]),{state:{cc:n,source:i,areaMetric:o,colorMode:c,query:u,selectedIndex:f,error:m,loading:g,report:v,reportSource:x,reportError:C,tab:T,focusPath:O,progress:A,chain:te,settingsOpen:re,zoom:M,center:ie,showLabels:oe,addons:le,pluginView:de,watch:pe,refreshedAt:me},actions:{loadSnapshot:Ce,loadReport:we,resetReport:Te,analyzeFolder:Oe,openSnapshotFile:ke,openReportFile:Ae,abrirSnapshot:Ee,abrirReporte:De,selectIndex:Me,openSymbolChain:Ne,zoomAt:ve,panMap:ye,fitMap:be,setAreaMetric:s,setColorMode:l,setQuery:d,setFocusPath:k,setTab:E,setSettingsOpen:j,setZoom:N,setCenter:ae,setShowLabels:se,setPluginView:fe,setChain:ne,setError:h,setReportError:w,setAddons:ue,setSelectedIndex:p,setLoading:_,setProgress:ee,setWatch:P},view:R,detail:je,stats:L,migration:xe,hasChurn:Se,plugins:ce,preferencesRef:F,selectedPathRef:_e,zoomAt:ve,panMap:ye,fitMap:be,searchRef:Pe,metricOptions:Fe,metricTitle:Le,areaOptions:Re,colorOptions:ze,selectedFile:Be,selectedMigration:Ve,selectedSymbols:He,selectedStructure:Ue,pluginViews:We,activePluginView:Ge,pluginContext:Ke,matches:qe,selectPath:Ye,addonsWithViews:Je,applyView:Xe,loadHistory:Ze,loadHeat:Qe}}function Jc({items:e,children:t,ref:n}){return(0,x.jsxs)(`details`,{className:`open-menu`,ref:n,children:[(0,x.jsxs)(`summary`,{className:`button`,children:[(0,x.jsx)(`span`,{className:`button-label-long`,children:`Abrir repositorio o archivo`}),(0,x.jsx)(`span`,{className:`button-label-short`,children:`Abrir`})]}),(0,x.jsxs)(`div`,{className:`open-menu-panel`,children:[e.map(e=>(0,x.jsx)(`button`,{type:`button`,disabled:e.disabled,title:e.title,onClick:t=>{e.keepOpen||t.currentTarget.closest(`details`)?.removeAttribute(`open`),e.onClick()},children:e.label},e.label)),t]})]})}async function Yc(){let e=window.showDirectoryPicker;if(!e)throw Error(`Este navegador no permite seleccionar carpetas. Abre el snapshot.cc.json o usa Chrome/Edge.`);let t=await e({mode:`read`}),n;try{n=await t.getDirectoryHandle(`.codarch`)}catch{throw Error(`No se encontró .codarch en "${t.name}". Para artefactos ejecuta "codarch analyze ."; para datos en vivo, "codarch serve ." en la raíz del repo.`)}let r=await Zc(n,`snapshot.cc.json`,!0),i=await Zc(n,`report.json`,!1);return{snapshot:r,report:i,label:`${t.name}/.codarch/snapshot.cc.json`,reportLabel:i===null?null:`${t.name}/.codarch/report.json`}}async function Xc(e){let t=e.map(e=>({file:e,path:(e.webkitRelativePath||e.name).replace(/\\/g,`/`)})),n=t.find(e=>e.path.endsWith(`/.codarch/snapshot.cc.json`)||e.path===`.codarch/snapshot.cc.json`);if(!n)throw Error(`No se encontró ".codarch/snapshot.cc.json" en la carpeta. Para artefactos ejecuta "codarch analyze ."; para datos en vivo, "codarch serve ." en la raíz del repo.`);let r=t.find(e=>e.path.endsWith(`/.codarch/report.json`)||e.path===`.codarch/report.json`);return{snapshot:await Qc(n.file),report:r?await Qc(r.file):null,label:n.path,reportLabel:r?.path??null}}async function Zc(e,t,n){try{return await Qc(await(await e.getFileHandle(t)).getFile())}catch(e){if(!n)return null;throw Error(`No se pudo leer ${t}: ${e.message}`)}}async function Qc(e){return JSON.parse(await e.text())}var $c=`codarch.preferences.v1`,el=`codarch.plugins.v1`,tl=`codarch.project.v1`,nl=25e5;function rl(e=ul()){if(!e)return null;try{let t=e.getItem($c);return t?Ds(JSON.parse(t)):null}catch{return null}}function il(e,t=ul()){if(t)try{t.setItem($c,JSON.stringify(e))}catch{}}function al(e=ul()){if(!e)return[];try{let t=e.getItem(el);if(!t)return[];let n=JSON.parse(t);return Array.isArray(n)?n.filter(e=>typeof e==`string`):[]}catch{return[]}}function ol(e,t=ul()){if(t)try{t.setItem(el,JSON.stringify([...e]))}catch{}}function sl(e=ul()){if(!e)return null;try{let t=e.getItem(tl);if(!t)return null;let n=JSON.parse(t);return typeof n!=`object`||!n||typeof n.label!=`string`||typeof n.snapshot!=`object`||n.snapshot===null?(e.removeItem(tl),null):{snapshot:n.snapshot,report:n.report===null||n.report===void 0?null:n.report,label:n.label,reportLabel:typeof n.reportLabel==`string`?n.reportLabel:null}}catch{return e.removeItem(tl),null}}function cl(e,t=ul()){if(!t)return!1;try{let n=JSON.stringify(e);return n.length>nl?!1:(t.setItem(tl,n),!0)}catch{return!1}}function ll(e=ul()){if(e)try{e.removeItem(tl)}catch{}}function ul(){try{return typeof window>`u`?null:window.localStorage}catch{return null}}var dl=class extends Error{constructor(){super(`Análisis cancelado`),this.name=`AnalysisCancelled`}};function fl(e){let t=new Worker(new URL(`/assets/worker-BkCQ9RP6.js`,``+import.meta.url),{type:`module`}),n=!1,r=()=>void 0;return{result:new Promise((n,i)=>{r=i;let a=()=>{t.terminate()};t.addEventListener(`message`,t=>{let r=t.data;r.type===`progress`?e.onProgress?.(r.message):r.type===`progress-file`?e.onFileProgress?.({done:r.done,total:r.total,current:r.current}):r.type===`error`?(a(),i(Error(r.message))):r.type===`done`&&(a(),n({snapshot:r.snapshot,files:r.files,edges:r.edges,warnings:r.warnings,durationMs:r.durationMs}))}),t.addEventListener(`error`,e=>{a(),i(Error(e.message||`el worker de análisis falló`))});let o={type:`analyze`,files:e.files,projectName:e.projectName};t.postMessage(o)}),cancel:()=>{n||(n=!0,t.terminate(),r(new dl))}}}var pl=class{caseSensitive;files;constructor(e=[],t=!0){this.files=new Map,this.caseSensitive=t;for(let[t,n]of e)this.files.set(t,n)}readFile(e){let t=this.tryReadFile(e);if(t===null)throw Error(`no existe el fichero: ${e}`);return t}tryReadFile(e){return this.files.get(e)??null}readDirectory(e){let t=e===`/`?`/`:`${e}/`,n=new Map;for(let e of this.files.keys()){if(!e.startsWith(t))continue;let r=e.slice(t.length);if(r===``)continue;let i=r.indexOf(`/`);if(i===-1){n.set(r,{name:r,isDirectory:!1,isFile:!0});continue}let a=r.slice(0,i);n.set(a,{name:a,isDirectory:!0,isFile:!1})}return[...n.values()].sort((e,t)=>e.name<t.name?-1:+(e.name>t.name))}exists(e){if(this.files.has(e))return!0;let t=e===`/`?`/`:`${e}/`;for(let e of this.files.keys())if(e.startsWith(t))return!0;return!1}set(e,t){this.files.set(e,t)}paths(){return[...this.files.keys()].sort()}entries(){return[...this.files.entries()].sort((e,t)=>e[0]<t[0]?-1:+(e[0]>t[0]))}},ml=[`.ts`,`.tsx`,`.mts`,`.cts`,`.js`,`.jsx`,`.mjs`,`.cjs`],hl=new Set([`package.json`,`tsconfig.json`,`jsconfig.json`,`.codarch.yml`,`.codarch.yaml`]),gl=new Set([`.git`,`node_modules`,`.codarch`,`dist`,`build`,`coverage`,`.next`,`out`,`target`,`.turbo`,`.cache`,`.venv`,`__pycache__`]),_l=2e4;async function vl(e,t={}){let n=t.limit??_l,r=new Map,i=0,a=async(e,o)=>{if(!t.signal?.aborted&&!(i>=n))for await(let[s,c]of e.entries()){if(t.signal?.aborted||i>=n)return;let e=o===``?`/${s}`:`${o}/${s}`;if(c.kind===`directory`){if(gl.has(s))continue;await a(c,e);continue}if(!yl(s))continue;let l=await c.getFile();r.set(e,await l.text()),i+=1,t.onProgress?.({read:i,current:e})}};if(await a(e,``),i>=n)throw Error(`Se han leído ${i} ficheros, el tope de la análise en el navegador. Analiza el repositorio con "codarch analyze" para verlos todos.`);return{fileSystem:new pl(r),count:i}}function yl(e){if(hl.has(e))return!0;let t=e.toLowerCase();return ml.some(e=>t.endsWith(e))}function bl(){return window.showDirectoryPicker??null}async function xl(e){try{let t=await fetch(e);return!t.ok||t.status===204?null:await t.json()}catch{return null}}async function Sl(e){let t;try{t=await fetch(e)}catch(t){throw Error(`no se pudo contactar con ${e} (${t.message}). Si el origen no permite CORS, sirve el fichero desde el mismo servidor.`)}if(!t.ok)throw Error(`respondió ${t.status}`);try{return await t.json()}catch(e){throw Error(`el JSON no es válido (${e.message})`)}}function Cl(){return{leerPreferencias:()=>rl(),escribirPreferencias:e=>il(e),leerProyecto:()=>sl(),escribirProyecto:e=>cl(e),borrarProyecto:()=>ll(),cadenas:async e=>xl(`data/chains.json?symbol=${encodeURIComponent(e)}`),historial:async()=>{let e=await xl(`data/history.json`);if(!e||typeof e!=`object`)return null;let t=e.entries;return Array.isArray(t)?t:null},calor:async()=>{let e=await xl(`data/chains.json`);if(!e||typeof e!=`object`)return null;let t=e.heat;return Array.isArray(t)?t:null},plugins:{read:()=>al(),write:e=>ol(e)}}}function wl(){let e=qc((0,b.useMemo)(()=>Cl(),[]),{sourceInicial:`sin proyecto`}),{areaMetric:t,colorMode:n,selectedIndex:r,focusPath:i,tab:a,chain:o,settingsOpen:s,showLabels:c,addons:l}=e.state,{loadSnapshot:u,loadReport:d,resetReport:f,abrirSnapshot:p,abrirReporte:m,setAreaMetric:h,setColorMode:g,setSettingsOpen:_,setShowLabels:v,setError:y,setReportError:C,setAddons:w,setLoading:T,setProgress:E,setWatch:D}=e.actions,{view:O,stats:k,plugins:A,areaOptions:ee,colorOptions:te,applyView:ne}=e,[re,j]=(0,b.useState)(!1),[M,N]=(0,b.useState)(`static`),[ie,ae]=(0,b.useState)(``),[oe,se]=(0,b.useState)(null),[ce,le]=(0,b.useState)(!1),[ue,de]=(0,b.useState)(null),[fe,pe]=(0,b.useState)(null),[P,me]=(0,b.useState)(``),[he,F]=(0,b.useState)(``),I=(0,b.useRef)(null),ge=(0,b.useRef)(null),[_e,ve]=(0,b.useState)(!1);(0,b.useEffect)(()=>{D(M===`live`?`live`:M===`served`?`paused`:`none`)},[M,D]);let ye=(0,b.useRef)(null),be=(0,b.useRef)(null),L=(0,b.useRef)(null),xe=(0,b.useRef)(null),Se=(0,b.useRef)(!1),Ce=(0,b.useRef)(null);if(Ce.current===null){let e=typeof window>`u`?``:window.location.search;Ce.current={view:xs(e),source:Ss(e)}}let we=(0,b.useCallback)(async(e,t)=>{let n=await xl(e);n?u(n,t):y(`No se pudo abrir ${t}`)},[u]),Te=(0,b.useCallback)(async()=>{let e=await xl(`data/addons.json`);w(Array.isArray(e?.addons)?e.addons:[])},[]);(0,b.useEffect)(()=>{let e=!1;return(async()=>{let t=Ce.current?.source;if(t?.snapshotUrl)try{let n=await Sl(t.snapshotUrl);if(e)return;if(Se.current=!0,u(n,t.snapshotUrl)){if(N(`local`),de(t.snapshotUrl),t.reportUrl)try{let n=await Sl(t.reportUrl);!e&&n&&(d(n,t.reportUrl),pe(t.reportUrl))}catch(t){e||C(`No se pudo cargar el reporte: ${t.message}`)}return}T(!1);return}catch(n){e||(N(`local`),y(`No se pudo cargar ${t.snapshotUrl}: ${n.message}`),T(!1));return}let n=await xl(`data/meta.json`),r=await xl(`data/snapshot.cc.json`);if(Se.current)return;if(r){if(e)return;u(r,`servidor local`);let t=typeof n==`object`&&!!n&&n.watch===!0;N(t?`live`:`served`),typeof n==`object`&&n&&typeof n.rootPath==`string`&&ae(n.rootPath),typeof n==`object`&&n&&typeof n.version==`string`&&se(n.version);let i=await xl(`data/report.json`);i&&!e&&d(i,`servidor local`),await Te();return}let i=sl();if(i&&!e&&!Se.current){if(u(i.snapshot,i.label)){N(`local`),i.report?d(i.report,i.reportLabel??`report.json`,!1):f();return}ll()}e||T(!1)})().catch(t=>{e||(y(t.message),T(!1))}),()=>{e=!0}},[d,u,Te]),(0,b.useEffect)(()=>{if(M!==`live`||typeof EventSource>`u`)return;let e=new EventSource(`/events`);return e.addEventListener(`update`,async()=>{let e=await xl(`data/snapshot.cc.json`);e&&u(e,`servidor local`,!0);let t=await xl(`data/report.json`);t&&d(t,`servidor local`,!1)}),()=>e.close()},[M,d,u]);let[Ee,De]=(0,b.useState)(!1);(0,b.useEffect)(()=>{if(Ee||!O.model||!k)return;let e=Ce.current?.view;e&&ne(e),De(!0)},[Ee,O.model,k,ne]),(0,b.useEffect)(()=>{if(!Ee||!O.model||typeof window>`u`)return;let e=r===null?void 0:O.model.files[r],s=Ts({areaMetric:t,colorMode:n,focusPath:i,filePath:e?.path??null,tab:a,symbolName:o?.name??null,showLabels:c},{snapshotUrl:ue,reportUrl:fe});s!==window.location.search&&window.history.replaceState(null,``,`${window.location.pathname}${s}${window.location.hash}`)},[Ee,O.model,t,n,i,r,a,o,c,ue,fe]);let Oe=(0,b.useMemo)(()=>s?sl()?.label??null:null,[s]),ke=(0,b.useMemo)(()=>Os()!==null,[]),Ae=(0,b.useMemo)(()=>oe??`0.3.22`,[oe]),R=(0,b.useCallback)(async e=>{Se.current=!0;try{let t=JSON.parse(await e.text());p(t,e.name)&&(N(`local`),de(null),pe(null))}catch(t){y(`JSON inválido en ${e.name}: ${t.message}`)}},[p]),je=(0,b.useCallback)(async e=>{let t=e.target.files?.[0];e.target.value=``,t&&await R(t)},[R]),Me=(0,b.useCallback)(async e=>{e.preventDefault(),j(!1);let t=e.dataTransfer.files?.[0];t&&await R(t)},[R]),Ne=(0,b.useCallback)(async e=>{let t=e.target.files?.[0];if(e.target.value=``,t)try{m(JSON.parse(await t.text()),t.name)}catch(e){C(`JSON inválido en ${t.name}: ${e.message}`)}},[m]),Pe=(0,b.useCallback)(e=>{p(e.snapshot,e.label)&&(N(`local`),de(null),pe(null),e.report!==null&&m(e.report,e.reportLabel??`report.json`))},[p,m]),Fe=(0,b.useCallback)(()=>{xe.current?.removeAttribute(`open`)},[]),Ie=(0,b.useCallback)(async()=>{let e=P.trim();if(!e)return;let t=he.trim();Fe(),Se.current=!0,T(!0),y(null);try{let n=await Sl(e);if(!p(n,e)){T(!1);return}if(N(`local`),de(e),pe(t||null),t)try{let e=await Sl(t);e&&m(e,t)}catch(e){C(`No se pudo cargar el reporte: ${e.message}`)}}catch(t){y(`No se pudo cargar ${e}: ${t.message}`)}finally{T(!1)}},[Fe,p,m,he,P]),Le=(0,b.useCallback)(async()=>{Fe();let e=bl();if(!e)y(`Este navegador no permite seleccionar carpetas. Usa Chrome o Edge, o abre un cc.json.`);else{Se.current=!0,T(!0),y(null),ge.current={aborted:!1},E(`Seleccionando la carpeta…`);try{let t=await e({mode:`read`});E(`Leyendo los ficheros…`);let n=await vl(t,{signal:ge.current,onProgress:e=>E(`Leyendo ${e.read} ficheros… ${e.current}`)});if(ge.current?.aborted)throw new dl;E(`Analizando en el navegador…`);let r=fl({files:n.fileSystem.entries(),projectName:t.name,onProgress:e=>E(e),onFileProgress:e=>E(`Analizando ${e.done}/${e.total}… ${e.current}`)});I.current=r;let i=await r.result;I.current=null,u(i.snapshot,`${t.name} · navegador`)&&(N(`local`),de(null),pe(null),f())}catch(e){e instanceof dl?E(`Análisis cancelado`):e.name!==`AbortError`&&y(e.message)}finally{I.current=null,E(null),T(!1)}}},[Fe,u,f]),Re=(0,b.useCallback)(()=>{ge.current={aborted:!0},I.current?.cancel()},[]),ze=(0,b.useCallback)(async()=>{if(typeof window>`u`)return;let e=window.location.href;try{await navigator.clipboard.writeText(e)}catch{return}ve(!0),window.setTimeout(()=>ve(!1),1800)},[]),Be=(0,b.useCallback)(async()=>{let e=await xl(`data/meta.json`),t=await xl(`data/snapshot.cc.json`);if(!t)throw Error(`el servidor no devolvió el snapshot`);u(t,`servidor local`),N(e?.watch?`live`:`served`),de(null),pe(null),e?.rootPath&&ae(e.rootPath);let n=await xl(`data/report.json`);n?d(n,`servidor local`,!1):f(),await Te()},[d,u,f,Te]),Ve=(0,b.useCallback)(async e=>{T(!0);try{let t=await fetch(`/api/root`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({path:e})}),n=await t.json();if(!t.ok)throw Error(n.error??`no se pudo analizar la carpeta`);le(!1),await Be()}finally{T(!1)}},[Be]),He=(0,b.useCallback)(async()=>{if(M!==`live`&&M!==`served`)return;let e=M!==`live`;try{let t=await fetch(`/api/watch`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({enabled:e})}),n=await t.json();if(!t.ok)throw Error(n.error??`no se pudo cambiar el modo live`);if(e){let e=await xl(`data/snapshot.cc.json`);e&&u(e,`servidor local`,!0)}N(n.watch?`live`:`served`)}catch(e){y(e.message)}},[M,u]),Ue=(0,b.useCallback)(()=>{Fe(),M===`static`?y("Para monitorizar carpetas hace falta el servidor local. Ejecuta `codarch serve` una vez y abre su URL."):le(!0)},[Fe,M]),We=(0,b.useCallback)(async()=>{if(Fe(),Se.current=!0,y(null),!(`showDirectoryPicker`in window))L.current?.click();else{T(!0);try{Pe(await Yc())}catch(e){e.name!==`AbortError`&&y(e.message),T(!1)}}},[Fe,Pe]),Ge=(0,b.useCallback)(async e=>{let t=Array.from(e.target.files??[]);if(e.target.value=``,Fe(),t.length!==0){Se.current=!0,T(!0),y(null);try{Pe(await Xc(t))}catch(e){y(e.message),T(!1)}}},[Fe,Pe]);return(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(kc,{app:e,className:re?`is-dragging`:``,onDragOver:e=>{e.preventDefault(),j(!0)},onDragLeave:()=>j(!1),onDrop:Me,topbarTrailing:(0,x.jsxs)(x.Fragment,{children:[(0,x.jsxs)(Jc,{ref:xe,items:[{label:`Monitorizar carpeta (live)…`,onClick:Ue,disabled:M===`static`,title:M===`static`?"Arranca `codarch serve` para elegir carpetas locales":`Analiza y vigila una carpeta local`},{label:`Carpeta con .codarch…`,onClick:()=>void We()},{label:`Analizar carpeta aquí…`,onClick:()=>void Le(),title:`Analiza la carpeta en el navegador, sin ejecutar el CLI`},{label:`Archivo cc.json…`,onClick:()=>{Fe(),ye.current?.click()}},{label:_e?`Enlace copiado`:`Copiar enlace de la vista`,onClick:()=>void ze(),keepOpen:!0,title:`Copia el enlace de la vista actual (área, color, carpeta y fichero)`}],children:[(0,x.jsxs)(`div`,{className:`url-load`,children:[(0,x.jsxs)(`label`,{className:`field`,children:[(0,x.jsx)(`span`,{children:`Snapshot por URL`}),(0,x.jsx)(`input`,{type:`text`,value:P,placeholder:`https://…/snapshot.cc.json`,onChange:e=>me(e.target.value),onKeyDown:e=>{e.key===`Enter`&&Ie()}})]}),(0,x.jsxs)(`label`,{className:`field`,children:[(0,x.jsx)(`span`,{children:`Reporte por URL (opcional)`}),(0,x.jsx)(`input`,{type:`text`,value:he,placeholder:`https://…/report.json`,onChange:e=>F(e.target.value),onKeyDown:e=>{e.key===`Enter`&&Ie()}})]}),(0,x.jsx)(`button`,{type:`button`,onClick:()=>void Ie(),disabled:!P.trim(),children:`Cargar por URL`})]}),(0,x.jsxs)(`p`,{children:[`Monitorizar analiza una carpeta en el servidor local. .codarch carga artefactos ya generados. Para activarlo:`,` `,(0,x.jsx)(`code`,{children:`codarch serve`}),`.`]})]}),(0,x.jsx)(`input`,{ref:ye,className:`sr-only`,type:`file`,accept:`.json,application/json`,onChange:je}),(0,x.jsx)(`input`,{ref:L,className:`sr-only`,type:`file`,multiple:!0,onChange:Ge,webkitdirectory:`true`,directory:`true`})]}),overlay:re?(0,x.jsx)(`div`,{className:`drop-hint`,children:`Suelta un cc.json`}):null,onCancelAnalysis:Re,onOpenHistory:e=>{we(`data/history/${ec(e)}`,e.date)},onLoadReport:()=>be.current?.click(),settings:(0,x.jsx)(ui,{open:s,onOpenChange:_,areaMetric:t,onAreaMetric:e=>h(e),colorMode:n,onColorMode:e=>g(e),areaOptions:ee,colorOptions:te,model:O.model,savedProject:Oe?{label:Oe}:null,onClearProject:()=>{ll(),_(!1)},storageAvailable:ke,watch:M===`live`||M===`served`?{state:M===`live`?`live`:`paused`,onToggle:()=>void He()}:void 0,version:Ae,plugins:A.descriptors,enabledPlugins:A.enabled,onTogglePlugin:A.toggle,failedPlugins:A.failed,addons:l,showLabels:c,onShowLabels:v})}),(0,x.jsx)(S,{open:ce,initialPath:ie,onClose:()=>le(!1),onSelect:Ve}),(0,x.jsx)(`input`,{ref:be,className:`sr-only`,type:`file`,accept:`.json,application/json`,onChange:Ne})]})}var Tl=document.getElementById(`root`);if(!Tl)throw Error(`falta #root`);(0,y.createRoot)(Tl).render((0,x.jsx)(b.StrictMode,{children:(0,x.jsx)(wl,{})}));export{c as a,u as i,Bo as n,v as r,W as t};
@@ -1,4 +1,4 @@
1
- import{a as e,i as t,n,r,t as i}from"./index-DoNheLr8.js";var a=e(t(),1),o={minDistance:60,maxDistance:1600,minPolar:.12,maxPolar:Math.PI/2.05},s={azimuth:-.6018,polar:.9813,distance:467.3};function c(e,t,n,r=1.08){let i=Math.max(1,e),a=Math.min(Math.max(t,.2),Math.PI-.2),o=Math.max(.2,n),s=i/Math.sin(a/2),c=2*Math.atan(Math.tan(a/2)*o),l=i/Math.sin(Math.min(c,Math.PI-.2)/2);return Math.max(s,l)*r}function l(e,t){let n=Math.sin(e.polar)*e.distance;return{x:t.x+n*Math.sin(e.azimuth),y:t.y+Math.cos(e.polar)*e.distance,z:t.z+n*Math.cos(e.azimuth)}}function u(e,t=o){return{azimuth:e.azimuth,polar:Math.min(Math.max(e.polar,t.minPolar),t.maxPolar),distance:Math.min(Math.max(e.distance,t.minDistance),t.maxDistance)}}function d(e,t,n){let r=Math.min(Math.max(n,0),1);return{azimuth:e.azimuth+(t.azimuth-e.azimuth)*r,polar:e.polar+(t.polar-e.polar)*r,distance:e.distance+(t.distance-e.distance)*r}}var f=.005,p=5,m=.0015;function h(e,t={}){let n=t.target??{x:0,y:0,z:0},r=t.limits??o,i={...t.start??s},a={...i},c=t.damping??.18,h=new Map,g=0,_=null,v=0,y=()=>{let[e,t]=[...h.values()];return!e||!t?0:Math.hypot(e.x-t.x,e.y-t.y)},b=t=>{if(t.pointerType!==`mouse`||t.button===0){h.set(t.pointerId,{x:t.clientX,y:t.clientY});try{e.setPointerCapture(t.pointerId)}catch{}h.size===1?(_={x:t.clientX,y:t.clientY},v=0):(_=null,g=y())}},x=e=>{let n=h.get(e.pointerId);if(!n)return;let a=e.clientX-n.x,o=e.clientY-n.y;if(h.set(e.pointerId,{x:e.clientX,y:e.clientY}),h.size===1)i.azimuth-=a*f,i.polar=u({...i,polar:i.polar-o*f},r).polar,v+=Math.abs(a)+Math.abs(o),t.onChange?.();else if(h.size===2){let e=y();g>0&&e>0&&(i.distance=u({...i,distance:i.distance*(g/e)},r).distance),g=e,t.onChange?.()}},S=e=>{h.delete(e.pointerId),h.size===0?(_&&v<=p&&t.onTap?.(e.clientX,e.clientY),_=null,g=0):g=h.size===2?y():0},C=e=>{e.preventDefault();let n=e.deltaMode===1?e.deltaY*16:e.deltaMode===2?e.deltaY*400:e.deltaY;i.distance=u({...i,distance:i.distance*Math.exp(n*m)},r).distance,t.onChange?.()};return e.addEventListener(`pointerdown`,b),e.addEventListener(`pointermove`,x),e.addEventListener(`pointerup`,S),e.addEventListener(`pointercancel`,S),e.addEventListener(`wheel`,C,{passive:!1}),{update(){let e=a;return a=d(a,i,c),Math.abs(a.azimuth-e.azimuth)>1e-5||Math.abs(a.polar-e.polar)>1e-5||Math.abs(a.distance-e.distance)>1e-4},pose(){return{position:l(a,n),target:{...n}}},dispose(){e.removeEventListener(`pointerdown`,b),e.removeEventListener(`pointermove`,x),e.removeEventListener(`pointerup`,S),e.removeEventListener(`pointercancel`,S),e.removeEventListener(`wheel`,C)}}}var g=(e,t)=>({x:e.x-t.x,y:e.y-t.y,z:e.z-t.z}),_=(e,t)=>e.x*t.x+e.y*t.y+e.z*t.z,v=(e,t)=>({x:e.y*t.z-e.z*t.y,y:e.z*t.x-e.x*t.z,z:e.x*t.y-e.y*t.x});function y(e){let t=Math.hypot(e.x,e.y,e.z);return t===0||!Number.isFinite(t)?{...e}:{x:e.x/t,y:e.y/t,z:e.z/t}}function b(e,t,n,r){let i=1/Math.tan(Math.max(.01,e)/2),a=Math.max(.01,t),o=n-r,s=new Float32Array(16);return s[0]=i/a,s[5]=i,s[10]=(r+n)/o,s[11]=-1,s[14]=2*r*n/o,s}function x(e,t,n={x:0,y:1,z:0}){let r=y(g(e,t)),i=y(v(n,r));i.x===0&&i.y===0&&i.z===0&&(i=y(v({x:0,y:0,z:1},r)));let a=v(r,i),o=new Float32Array(16);return o[0]=i.x,o[1]=a.x,o[2]=r.x,o[3]=0,o[4]=i.y,o[5]=a.y,o[6]=r.y,o[7]=0,o[8]=i.z,o[9]=a.z,o[10]=r.z,o[11]=0,o[12]=-_(i,e),o[13]=-_(a,e),o[14]=-_(r,e),o[15]=1,o}function S(e,t,n,r,i,a){let o=y(g(t,e)),s=y(v(o,{x:0,y:1,z:0})),c=v(s,o),l=Math.tan(Math.max(.01,i)/2),u=y({x:o.x+s.x*n*l*a+c.x*r*l,y:o.y+s.y*n*l*a+c.y*r*l,z:o.z+s.z*n*l*a+c.z*r*l});return{origin:{...e},direction:u}}function C(e){return{min:{x:e.x,y:e.y,z:e.z},max:{x:e.x+Math.max(e.width,.001),y:e.y+Math.max(e.height,.001),z:e.z+Math.max(e.depth,.001)}}}function w(e,t){let{min:n,max:r}=C(t),i=-1/0,a=1/0;for(let t of[`x`,`y`,`z`]){let o=e.origin[t],s=e.direction[t];if(Math.abs(s)<1e-9){if(o<n[t]||o>r[t])return null;continue}let c=(n[t]-o)/s,l=(r[t]-o)/s;if(c>l&&([c,l]=[l,c]),i=Math.max(i,c),a=Math.min(a,l),i>a)return null}return a<0?null:i>=0?i:a}function ee(e,t){let n=null,r=1/0;for(let i=0;i<t.length;i++){let a=w(e,t[i]);a!==null&&a<r&&(r=a,n=i)}return n}var T=2,E=90,D=1.4;function O(e){return n(e.roots,e.width,e.height).map(t=>k(t,e))}function k(e,t){let{node:n,rect:r}=e,i=Math.max(1,r.w*r.h),a=(e.children??[]).map(e=>k(e,t)).sort((e,t)=>t.area-e.area||e.path.localeCompare(t.path));if(n.kind===`file`&&n.fileIndex!==void 0){let e=t.files[n.fileIndex];return{path:n.path,kind:`file`,x:r.x,z:r.y,width:r.w,depth:r.h,height:T+(e?.risk??0)*E,color:t.colorFor(n.fileIndex),area:i,children:[]}}let o=a.reduce((e,t)=>Math.max(e,t.height),0);return{path:n.path,kind:`folder`,x:r.x,z:r.y,width:r.w,depth:r.h,height:o>0?Math.max(D*2,o):Math.max(6,Math.log2(n.fileCount+1)*4),color:a[0]?.color??t.fallbackColor,area:i,children:a}}function te(e){let t=1/0,n=1/0,r=-1/0,i=-1/0,a=0,o=e=>{t=Math.min(t,e.x),n=Math.min(n,e.z),r=Math.max(r,e.x+e.width),i=Math.max(i,e.z+e.depth),a=Math.max(a,e.height);for(let t of e.children)o(t)};for(let t of e)o(t);if(!Number.isFinite(t))return{cx:0,cz:0,radius:1,maxHeight:0};let s=Math.max(1,r-t),c=Math.max(1,i-n);return{cx:(t+r)/2,cz:(n+i)/2,radius:Math.hypot(s,c,a)/2,maxHeight:a}}var A=1200,j=22;function ne(e,t){let n=[],r=Math.max(1,t.budget??A),i=Math.max(0,t.minPixels??j),a=Math.tan(Math.max(.01,t.fov)/2),o=Math.max(1,t.viewportHeight),s=e=>{if(!(e.kind===`folder`&&e.children.length>0)){n.push(M(e,!1,e.height));return}let c=Math.max(1,Math.hypot(e.x+e.width/2-t.camera.x,e.height/2-t.camera.y,e.z+e.depth/2-t.camera.z)),l=Math.sqrt(e.area)*o/(2*c*a),u=r-n.length;if(l<i||u<e.children.length+1)n.push(M(e,!0,0));else{n.push(M(e,!1,D));for(let t of e.children)s(t)}};for(let t of e)s(t);return n}function M(e,t,n){return{path:e.path,kind:e.kind,x:e.x,y:0,z:e.z,width:e.width,depth:e.depth,height:t?e.height:n,color:e.color,collapsed:t}}var N=50,P=4e3,F=22,re=120,I=`#2f6fed`,L=.6,R=8e6,ie=36,z=9,B=`#version 300 es
1
+ import{a as e,i as t,n,r,t as i}from"./index-BueBQe8U.js";var a=e(t(),1),o={minDistance:60,maxDistance:1600,minPolar:.12,maxPolar:Math.PI/2.05},s={azimuth:-.6018,polar:.9813,distance:467.3};function c(e,t,n,r=1.08){let i=Math.max(1,e),a=Math.min(Math.max(t,.2),Math.PI-.2),o=Math.max(.2,n),s=i/Math.sin(a/2),c=2*Math.atan(Math.tan(a/2)*o),l=i/Math.sin(Math.min(c,Math.PI-.2)/2);return Math.max(s,l)*r}function l(e,t){let n=Math.sin(e.polar)*e.distance;return{x:t.x+n*Math.sin(e.azimuth),y:t.y+Math.cos(e.polar)*e.distance,z:t.z+n*Math.cos(e.azimuth)}}function u(e,t=o){return{azimuth:e.azimuth,polar:Math.min(Math.max(e.polar,t.minPolar),t.maxPolar),distance:Math.min(Math.max(e.distance,t.minDistance),t.maxDistance)}}function d(e,t,n){let r=Math.min(Math.max(n,0),1);return{azimuth:e.azimuth+(t.azimuth-e.azimuth)*r,polar:e.polar+(t.polar-e.polar)*r,distance:e.distance+(t.distance-e.distance)*r}}var f=.005,p=5,m=.0015;function h(e,t={}){let n=t.target??{x:0,y:0,z:0},r=t.limits??o,i={...t.start??s},a={...i},c=t.damping??.18,h=new Map,g=0,_=null,v=0,y=()=>{let[e,t]=[...h.values()];return!e||!t?0:Math.hypot(e.x-t.x,e.y-t.y)},b=t=>{if(t.pointerType!==`mouse`||t.button===0){h.set(t.pointerId,{x:t.clientX,y:t.clientY});try{e.setPointerCapture(t.pointerId)}catch{}h.size===1?(_={x:t.clientX,y:t.clientY},v=0):(_=null,g=y())}},x=e=>{let n=h.get(e.pointerId);if(!n)return;let a=e.clientX-n.x,o=e.clientY-n.y;if(h.set(e.pointerId,{x:e.clientX,y:e.clientY}),h.size===1)i.azimuth-=a*f,i.polar=u({...i,polar:i.polar-o*f},r).polar,v+=Math.abs(a)+Math.abs(o),t.onChange?.();else if(h.size===2){let e=y();g>0&&e>0&&(i.distance=u({...i,distance:i.distance*(g/e)},r).distance),g=e,t.onChange?.()}},S=e=>{h.delete(e.pointerId),h.size===0?(_&&v<=p&&t.onTap?.(e.clientX,e.clientY),_=null,g=0):g=h.size===2?y():0},C=e=>{e.preventDefault();let n=e.deltaMode===1?e.deltaY*16:e.deltaMode===2?e.deltaY*400:e.deltaY;i.distance=u({...i,distance:i.distance*Math.exp(n*m)},r).distance,t.onChange?.()};return e.addEventListener(`pointerdown`,b),e.addEventListener(`pointermove`,x),e.addEventListener(`pointerup`,S),e.addEventListener(`pointercancel`,S),e.addEventListener(`wheel`,C,{passive:!1}),{update(){let e=a;return a=d(a,i,c),Math.abs(a.azimuth-e.azimuth)>1e-5||Math.abs(a.polar-e.polar)>1e-5||Math.abs(a.distance-e.distance)>1e-4},pose(){return{position:l(a,n),target:{...n}}},dispose(){e.removeEventListener(`pointerdown`,b),e.removeEventListener(`pointermove`,x),e.removeEventListener(`pointerup`,S),e.removeEventListener(`pointercancel`,S),e.removeEventListener(`wheel`,C)}}}var g=(e,t)=>({x:e.x-t.x,y:e.y-t.y,z:e.z-t.z}),_=(e,t)=>e.x*t.x+e.y*t.y+e.z*t.z,v=(e,t)=>({x:e.y*t.z-e.z*t.y,y:e.z*t.x-e.x*t.z,z:e.x*t.y-e.y*t.x});function y(e){let t=Math.hypot(e.x,e.y,e.z);return t===0||!Number.isFinite(t)?{...e}:{x:e.x/t,y:e.y/t,z:e.z/t}}function b(e,t,n,r){let i=1/Math.tan(Math.max(.01,e)/2),a=Math.max(.01,t),o=n-r,s=new Float32Array(16);return s[0]=i/a,s[5]=i,s[10]=(r+n)/o,s[11]=-1,s[14]=2*r*n/o,s}function x(e,t,n={x:0,y:1,z:0}){let r=y(g(e,t)),i=y(v(n,r));i.x===0&&i.y===0&&i.z===0&&(i=y(v({x:0,y:0,z:1},r)));let a=v(r,i),o=new Float32Array(16);return o[0]=i.x,o[1]=a.x,o[2]=r.x,o[3]=0,o[4]=i.y,o[5]=a.y,o[6]=r.y,o[7]=0,o[8]=i.z,o[9]=a.z,o[10]=r.z,o[11]=0,o[12]=-_(i,e),o[13]=-_(a,e),o[14]=-_(r,e),o[15]=1,o}function S(e,t,n,r,i,a){let o=y(g(t,e)),s=y(v(o,{x:0,y:1,z:0})),c=v(s,o),l=Math.tan(Math.max(.01,i)/2),u=y({x:o.x+s.x*n*l*a+c.x*r*l,y:o.y+s.y*n*l*a+c.y*r*l,z:o.z+s.z*n*l*a+c.z*r*l});return{origin:{...e},direction:u}}function C(e){return{min:{x:e.x,y:e.y,z:e.z},max:{x:e.x+Math.max(e.width,.001),y:e.y+Math.max(e.height,.001),z:e.z+Math.max(e.depth,.001)}}}function w(e,t){let{min:n,max:r}=C(t),i=-1/0,a=1/0;for(let t of[`x`,`y`,`z`]){let o=e.origin[t],s=e.direction[t];if(Math.abs(s)<1e-9){if(o<n[t]||o>r[t])return null;continue}let c=(n[t]-o)/s,l=(r[t]-o)/s;if(c>l&&([c,l]=[l,c]),i=Math.max(i,c),a=Math.min(a,l),i>a)return null}return a<0?null:i>=0?i:a}function ee(e,t){let n=null,r=1/0;for(let i=0;i<t.length;i++){let a=w(e,t[i]);a!==null&&a<r&&(r=a,n=i)}return n}var T=2,E=90,D=1.4;function O(e){return n(e.roots,e.width,e.height).map(t=>k(t,e))}function k(e,t){let{node:n,rect:r}=e,i=Math.max(1,r.w*r.h),a=(e.children??[]).map(e=>k(e,t)).sort((e,t)=>t.area-e.area||e.path.localeCompare(t.path));if(n.kind===`file`&&n.fileIndex!==void 0){let e=t.files[n.fileIndex];return{path:n.path,kind:`file`,x:r.x,z:r.y,width:r.w,depth:r.h,height:T+(e?.risk??0)*E,color:t.colorFor(n.fileIndex),area:i,children:[]}}let o=a.reduce((e,t)=>Math.max(e,t.height),0);return{path:n.path,kind:`folder`,x:r.x,z:r.y,width:r.w,depth:r.h,height:o>0?Math.max(D*2,o):Math.max(6,Math.log2(n.fileCount+1)*4),color:a[0]?.color??t.fallbackColor,area:i,children:a}}function te(e){let t=1/0,n=1/0,r=-1/0,i=-1/0,a=0,o=e=>{t=Math.min(t,e.x),n=Math.min(n,e.z),r=Math.max(r,e.x+e.width),i=Math.max(i,e.z+e.depth),a=Math.max(a,e.height);for(let t of e.children)o(t)};for(let t of e)o(t);if(!Number.isFinite(t))return{cx:0,cz:0,radius:1,maxHeight:0};let s=Math.max(1,r-t),c=Math.max(1,i-n);return{cx:(t+r)/2,cz:(n+i)/2,radius:Math.hypot(s,c,a)/2,maxHeight:a}}var A=1200,j=22;function ne(e,t){let n=[],r=Math.max(1,t.budget??A),i=Math.max(0,t.minPixels??j),a=Math.tan(Math.max(.01,t.fov)/2),o=Math.max(1,t.viewportHeight),s=e=>{if(!(e.kind===`folder`&&e.children.length>0)){n.push(M(e,!1,e.height));return}let c=Math.max(1,Math.hypot(e.x+e.width/2-t.camera.x,e.height/2-t.camera.y,e.z+e.depth/2-t.camera.z)),l=Math.sqrt(e.area)*o/(2*c*a),u=r-n.length;if(l<i||u<e.children.length+1)n.push(M(e,!0,0));else{n.push(M(e,!1,D));for(let t of e.children)s(t)}};for(let t of e)s(t);return n}function M(e,t,n){return{path:e.path,kind:e.kind,x:e.x,y:0,z:e.z,width:e.width,depth:e.depth,height:t?e.height:n,color:e.color,collapsed:t}}var N=50,P=4e3,F=22,re=120,I=`#2f6fed`,L=.6,R=8e6,ie=36,z=9,B=`#version 300 es
2
2
  precision highp float;
3
3
 
4
4
  layout(location = 0) in vec3 aOffset;
package/web/index.html CHANGED
@@ -13,7 +13,7 @@
13
13
  href="https://fonts.googleapis.com/css2?family=Bricolage+Grotesque:opsz,wght@12..96,500;12..96,650;12..96,750&family=IBM+Plex+Mono:wght@400;500&family=IBM+Plex+Sans:wght@400;500;600&display=swap"
14
14
  rel="stylesheet"
15
15
  />
16
- <script type="module" crossorigin src="/assets/index-DoNheLr8.js"></script>
16
+ <script type="module" crossorigin src="/assets/index-BueBQe8U.js"></script>
17
17
  <link rel="stylesheet" crossorigin href="/assets/index-ee4c0zCv.css">
18
18
  </head>
19
19
  <body>