1import{s as Re}from"./rolldown-runtime-aoxQmdZa.js";import{or as Oe,rr as Be}from"./vendor-C44JUHxF.js";import{c as I,r}from"./theme-Cmxze0rk.js";var E=Re(Oe(),1),n=Be(),fe="xyron_launchpad_layouts",G=[{id:"preset-trader",name:"Trader Desk",preset:!0,created_at:"2024-01-01T00:00:00Z",description:"Order blotter · positions · live chart · watchlist",active_instTab:"trade",active_leftTab:"watchlist",mobileTab:"terminal",chatOpen:!0,chatH:260,chatLayouts:{},dashboard_layout:[{i:"p-trader-1",x:0,y:0,w:8,h:10,minW:6,minH:7},{i:"p-trader-2",x:8,y:0,w:4,h:10,minW:3,minH:5},{i:"p-trader-3",x:0,y:10,w:6,h:6,minW:4,minH:4},{i:"p-trader-4",x:6,y:10,w:6,h:6,minW:4,minH:4}],dashboard_cards:[{id:"p-trader-1",type:"chart",config:{}},{id:"p-trader-2",type:"watchlist",config:{}},{id:"p-trader-3",type:"order_blotter",config:{}},{id:"p-trader-4",type:"trade_execution",config:{}}]},{id:"preset-research",name:"Research Mode",preset:!0,created_at:"2024-01-01T00:00:00Z",description:"Intel feed · news · screener · regime",active_instTab:"bloomberg",active_leftTab:"news",mobileTab:"terminal",chatOpen:!0,chatH:320,chatLayouts:{},dashboard_layout:[{i:"p-res-1",x:0,y:0,w:12,h:9,minW:6,minH:6},{i:"p-res-2",x:0,y:9,w:6,h:6,minW:4,minH:4},{i:"p-res-3",x:6,y:9,w:6,h:6,minW:4,minH:4},{i:"p-res-4",x:0,y:15,w:12,h:5,minW:6,minH:4}],dashboard_cards:[{id:"p-res-1",type:"xyron_screener",config:{}},{id:"p-res-2",type:"intel_feed",config:{}},{id:"p-res-3",type:"news",config:{}},{id:"p-res-4",type:"intelligence_command",config:{asset_class:"equities"}}]},{id:"preset-risk",name:"Risk Review",preset:!0,created_at:"2024-01-01T00:00:00Z",description:"VaR · correlation · risk dashboard · portfolio snapshot",active_instTab:"risk",active_leftTab:"correlation",mobileTab:"terminal",chatOpen:!1,chatH:240,chatLayouts:{risk:"split"},dashboard_layout:[{i:"p-risk-1",x:0,y:0,w:6,h:8,minW:4,minH:5},{i:"p-risk-2",x:6,y:0,w:6,h:8,minW:4,minH:5},{i:"p-risk-3",x:0,y:8,w:6,h:7,minW:4,minH:5},{i:"p-risk-4",x:6,y:8,w:6,h:7,minW:4,minH:5}],dashboard_cards:[{id:"p-risk-1",type:"risk_dashboard",config:{}},{id:"p-risk-2",type:"correlation_matrix",config:{}},{id:"p-risk-3",type:"var_dashboard",config:{}},{id:"p-risk-4",type:"portfolio_snapshot",config:{}}]},{id:"preset-floor",name:"Trading Floor",preset:!0,created_at:"2024-01-01T00:00:00Z",description:"Grid: intel + news · Floating stack: chart · order flow · watchlist",active_instTab:"trade",active_leftTab:"watchlist",mobileTab:"terminal",chatOpen:!0,chatH:220,chatLayouts:{},dashboard_layout:[{i:"p-floor-1",x:0,y:0,w:12,h:10,minW:6,minH:6},{i:"p-floor-2",x:0,y:10,w:12,h:6,minW:6,minH:4}],dashboard_cards:[{id:"p-floor-1",type:"intel_feed",config:{}},{id:"p-floor-2",type:"news",config:{}},{id:"p-floor-3",type:"chart",config:{float:{enabled:!0,x:120,y:100,w:640,h:420,z:1010,tabGroup:"g-floor",tabGroupOwner:!0,tabGroupActive:"p-floor-3"}}},{id:"p-floor-4",type:"order_flow",config:{float:{enabled:!0,x:120,y:100,w:640,h:420,z:1010,tabGroup:"g-floor"}}},{id:"p-floor-5",type:"watchlist",config:{float:{enabled:!0,x:120,y:100,w:640,h:420,z:1010,tabGroup:"g-floor"}}}]}];function Ie(){try{var e=localStorage.getItem(fe);if(!e)return[];var t=JSON.parse(e);return Array.isArray(t)?t:[]}catch{return[]}}function ie(e){try{localStorage.setItem(fe,JSON.stringify(e))}catch{}}function Fe(){return new Promise(function(e){var t={},o=!1;function a(s){var u=s&&s.detail&&s.detail.state||null;u&&typeof u=="object"&&Object.assign(t,u)}function d(){o||(o=!0,window.removeEventListener("xyron:layout-state",a),e(t))}window.addEventListener("xyron:layout-state",a);try{window.dispatchEvent(new CustomEvent("xyron:get-layout"))}catch{}setTimeout(d,250)})}function Ne(e){try{window.dispatchEvent(new CustomEvent("xyron:apply-layout",{detail:e}))}catch{}}function H(e){try{if(typeof structuredClone=="function")return structuredClone(e)}catch{}return JSON.parse(JSON.stringify(e))}function ee(e,t){for(var o={},a=0;a<t.length;a++)o[t[a].name]=!0;if(!o[e])return e;for(var d=2;o[e+" ("+d+")"];)d++;return e+" ("+d+")"}function De(e,t){var o=H(e);return delete o.id,delete o.preset,delete o.description,delete o.created_at,Object.assign(o,{id:"lp-"+Date.now().toString(36)+"-"+Math.random().toString(36).slice(2,6),name:ee(e.name+" (copy)",t),created_at:new Date().toISOString(),cloned_from:e.id})}function Le(e,t){var o=H(e);return delete o.id,delete o.created_at,Object.assign(o,{id:"lp-"+Date.now().toString(36)+"-"+Math.random().toString(36).slice(2,6),name:ee(e.name+" (copy)",t),created_at:new Date().toISOString(),cloned_from:e.cloned_from||e.id})}function $(e,t,o){if(!e||!e.cloned_from)return null;var a=e.cloned_from;if(Array.isArray(t)){for(var d=0;d<t.length;d++)if(t[d]&&t[d].id===a)return t[d]}if(Array.isArray(o))for(var s=0;s<o.length;s++){var u=o[s];
1if(u&&u.id===a&&u.id!==e.id)return u}return null}function Pe(e,t){if(!e||!t)return e;var o=H(t);return delete o.id,delete o.preset,delete o.description,delete o.created_at,Object.assign({},o,{id:e.id,name:e.name,created_at:e.created_at,cloned_from:e.cloned_from})}var We=["tabs","layout","cards"],re=["active_instTab","active_leftTab","mobileTab","chatOpen","chatH"];function ze(e,t,o){if(!e||!t)return e;var a={};if(Array.isArray(o))for(var d=0;d<o.length;d++)a[o[d]]=!0;if(!a.tabs&&!a.layout&&!a.cards)return e;var s=Object.assign({},e);if(a.tabs){for(var u=0;u<re.length;u++)s[re[u]]=t[re[u]];s.chatLayouts=H(t.chatLayouts||{})}if(a.layout){for(var p=Array.isArray(t.dashboard_layout)?t.dashboard_layout:[],f=Array.isArray(t.dashboard_cards)?t.dashboard_cards:[],b=Array.isArray(e.dashboard_cards)?e.dashboard_cards:[],g={},v=0;v<b.length;v++)g[b[v].id]=b[v];for(var M={},m=0;m<p.length;m++)M[p[m].i]=!0;for(var T=[],_=0;_<f.length;_++){var O=f[_];if(M[O.id]){var R=g[O.id];R&&R.type===O.type?T.push(H(R)):T.push(H(O))}}s.dashboard_layout=H(p),s.dashboard_cards=T}if(a.cards){for(var F=Array.isArray(t.dashboard_cards)?t.dashboard_cards:[],j={},P=0;P<F.length;P++)j[F[P].id]=F[P];for(var S=Array.isArray(s.dashboard_cards)?s.dashboard_cards:[],w=[],y=0;y<S.length;y++){var A=S[y],L=j[A.id];L&&L.type===A.type?w.push(Object.assign({},A,{config:H(L.config||{})})):w.push(A)}s.dashboard_cards=w}return s}var Ue="xyron-launchpad-export",ut=1;function He(e,t){for(var o=t instanceof Date?t.toISOString():typeof t=="string"?t:new Date().toISOString(),a=Array.isArray(e)?e:[],d=[],s=0;s<a.length;s++)d.push(H(a[s]));return{type:Ue,version:1,exported_at:o,layouts:d}}function Je(e){return!(!e||typeof e!="object"||typeof e.name!="string"||!e.name.trim()||e.dashboard_layout!=null&&!Array.isArray(e.dashboard_layout)||e.dashboard_cards!=null&&!Array.isArray(e.dashboard_cards))}function Ve(e){if(!e||typeof e!="object"||Array.isArray(e))return{ok:!1,reason:"Not a JSON object"};if(e.type!=="xyron-launchpad-export")return{ok:!1,reason:"Wrong export type"};if(e.version!==1)return{ok:!1,reason:"Unsupported version"};if(!Array.isArray(e.layouts))return{ok:!1,reason:"Layouts not an array"};for(var t=[],o=0,a=0;a<e.layouts.length;a++)Je(e.layouts[a])?t.push(e.layouts[a]):o++;return{ok:!0,layouts:t,skipped:o}}function Ye(){return"lp-"+Date.now().toString(36)+"-"+Math.random().toString(36).slice(2,6)}function Ge(e,t,o,a,d){var s=H(e);delete s.id,delete s.created_at,delete s.preset,delete s.description;var u=a instanceof Date?a.toISOString():typeof a=="string"?a:new Date().toISOString(),p=typeof d=="function"?d():Ye(),f=Object.assign(s,{id:p,name:ee(s.name,Array.isArray(t)?t:[]),created_at:u});return f.cloned_from&&($(f,o||[],t||[])||delete f.cloned_from),f}function qe(e,t,o,a,d){if(!Array.isArray(t)||t.length===0)return{layouts:Array.isArray(e)?e.slice():[],imported:0};for(var s=Array.isArray(e)?e.slice():[],u=[],p=0;p<t.length;p++){var f=Ge(t[p],s,o,a,d);u.push(f),s=[f].concat(s)}return{layouts:u.concat(Array.isArray(e)?e.slice():[]),imported:u.length}}function X(e,t,o){if(!Array.isArray(t))return[];for(var a=(Array.isArray(e)?e.slice():[]).slice(),d=[],s=0;s<t.length;s++){var u=t[s]||{},p=typeof u.name=="string"&&u.name.trim()?u.name:"Untitled",f=Array.isArray(o)?o[s]:null,b=!(f&&f.checked===!1),g=ee(p,a);d.push(g===p?{name:p}:{name:p,willRenameTo:g}),b&&a.push({name:g})}return d}function Xe(e,t){if(!Array.isArray(t))return[];if(!Array.isArray(e))return[];for(var o=[],a=0;a<t.length;a++){var d=e[a];if(!(!d||!d.checked)){var s=t[a];s&&typeof d.importName=="string"&&typeof s.name=="string"&&d.importName!==s.name?o.push(Object.assign({},s,{name:d.importName})):o.push(s)}}return o}function Y(e,t){if(!Array.isArray(e))return[];var o=Array.isArray(t),a={};if(o)for(var d=0;d<t.length;d++){var s=t[d];!s||s.id==null||typeof s.checked=="boolean"&&(a[s.id]=s.checked)}for(var u=[],p=0;p<e.length;p++){var f=e[p],b=f&&f.id!=null,g=b?a[f.id]:void 0,v=o?t[p]:null,M=b?typeof g=="boolean"?g:!0:v&&typeof v.checked=="boolean"?v.checked:!0;u.push(Object.assign({},f,{checked:M}))}return u}function Z(e,t){if(!Array.isArray(e))return[];for(var o=Array.isArray(t),a=[],d=0;d<e.length;d++){var s=e[d]||{},u=typeof s.name=="string"?s.name:"Untitled",p=void 0;if(o){var f=t[d];f&&typeof f.importName=="string"&&typeof f.name=="string"&&f.importName!==f.name&&(p=f.importName)}var b=typeof p=="string"?p:typeof s.importName=="string"?s.importName:u;a.push(Object.assign({},s,{importName:b}))}return a}function Ze(e,t){if(!Array.isArray(e)||!t||typeof t.name!="string"||!t.name)return null;for(var o=0;o<e.length;o++){var a=e[o];if(a&&typeof a.name=="string"&&a.name===t.name)return a}return null}function ne(e){if(!Array.isArray(e))return[];for(var t=[],o=0;o<e.length;o++){var a=e[o]||{},d=typeof a.name=="string"&&a.name.trim()?a.name:"Untitled";t.push({id:a.id!=null?a.id:"export-row-"+o,name:d,exportName:d,checked:!0})}return t}function Qe(e,t){if(!Array.isArray(t))return[];if(!Array.isArray(e))return[];for(var o=[],a=0;a<t.length;a++){var d=e[a];if(!(!d||!d.checked)){var s=t[a];s&&typeof d.exportName=="string"&&d.exportName!==s.name?o.push(Object.assign({},s,{name:d.exportName})):o.push(s)}}return o}function le(e,t){if(!Array.isArray(e))return[];var o=Array.isArray(t),a={};if(o)for(var d=0;d<t.length;d++){var s=t[d];!s||s.id==null||typeof s.exportName=="string"&&typeof s.name=="string"&&s.exportName!==s.name&&(a[s.id]=s.exportName)}for(var u=[],p=0;p<e.length;p++){var f=e[p],b=f&&f.id!=null?a[f.id]:void 0,g=f&&typeof f.name=="string"?f.name:"Untitled",v=typeof b=="string"?b:typeof f.exp
1ortName=="string"?f.exportName:g;u.push(Object.assign({},f,{exportName:v}))}return u}function $e(e,t){return!e||!t?!1:(e.x|0)===(t.x|0)&&(e.y|0)===(t.y|0)&&(e.w|0)===(t.w|0)&&(e.h|0)===(t.h|0)}function K(e){if(e===null||typeof e!="object")return JSON.stringify(e);if(Array.isArray(e)){for(var t=[],o=0;o<e.length;o++)t.push(K(e[o]));return"["+t.join(",")+"]"}for(var a=Object.keys(e).sort(),d=[],s=0;s<a.length;s++)d.push(JSON.stringify(a[s])+":"+K(e[a[s]]));return"{"+d.join(",")+"}"}function Ke(e,t){return K(e||{})===K(t||{})}function pe(e,t){var o={hasChanges:!1,tabs:[],layout:{added:[],removed:[],moved:[]},cards:{configChanged:[]}};if(!e||!t)return o;for(var a=[],d=["active_instTab","active_leftTab","mobileTab","chatOpen","chatH"],s=0;s<d.length;s++){var u=d[s];e[u]!==t[u]&&a.push({field:u,from:t[u],to:e[u]})}for(var p=Array.isArray(e.dashboard_layout)?e.dashboard_layout:[],f=Array.isArray(t.dashboard_layout)?t.dashboard_layout:[],b=Array.isArray(e.dashboard_cards)?e.dashboard_cards:[],g=Array.isArray(t.dashboard_cards)?t.dashboard_cards:[],v={},M=0;M<b.length;M++)v[b[M].id]=b[M].type;for(var m={},T=0;T<g.length;T++)m[g[T].id]=g[T].type;for(var _={},O=0;O<p.length;O++)_[p[O].i]=p[O];for(var R={},F=0;F<f.length;F++)R[f[F].i]=f[F];var j=[],P=[],S=[];for(var w in R)Object.prototype.hasOwnProperty.call(R,w)&&(_[w]?$e(_[w],R[w])||S.push({id:w,type:m[w]||v[w]||null,from:{x:R[w].x|0,y:R[w].y|0,w:R[w].w|0,h:R[w].h|0},to:{x:_[w].x|0,y:_[w].y|0,w:_[w].w|0,h:_[w].h|0}}):P.push({id:w,type:m[w]||null}));for(var y in _)Object.prototype.hasOwnProperty.call(_,y)&&(R[y]||j.push({id:y,type:v[y]||null}));for(var A={},L=0;L<b.length;L++)A[b[L].id]=b[L];for(var N={},B=0;B<g.length;B++)N[g[B].id]=g[B];var C=[];for(var W in N)if(Object.prototype.hasOwnProperty.call(N,W)){var z=A[W],U=N[W];z&&z.type===U.type&&(Ke(z.config,U.config)||C.push({id:W,type:U.type}))}return{hasChanges:a.length>0||j.length>0||P.length>0||S.length>0||C.length>0,tabs:a,layout:{added:j,removed:P,moved:S},cards:{configChanged:C}}}function et(e){if(!e)return"â";try{var t=new Date(e);return isNaN(t.getTime())?"â":t.toLocaleString([],{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"})}catch{return"â"}}function tt(e){var t=[];return e.active_instTab&&t.push("TAB: "+e.active_instTab.toUpperCase()),e.active_leftTab&&t.push("LEFT: "+e.active_leftTab.toUpperCase()),e.mobileTab&&t.push("M: "+e.mobileTab.toUpperCase()),e.chatOpen&&t.push("CHAT·ON"),t.join(" · ")}function ft(){var e=(0,E.useState)(function(){return Ie()}),t=e[0],o=e[1],a=(0,E.useState)(!1),d=a[0],s=a[1],u=(0,E.useState)(""),p=u[0],f=u[1],b=(0,E.useState)(null),g=b[0],v=b[1],M=(0,E.useState)(""),m=M[0],T=M[1],_=(0,E.useState)(!1),O=_[0],R=_[1],F=(0,E.useState)(null),j=F[0],P=F[1],S=(0,E.useRef)(null),w=(0,E.useState)(null),y=w[0],A=w[1],L=(0,E.useState)(null),N=L[0],B=L[1];function C(l,i){P({msg:l,kind:i||"info",ts:Date.now()}),setTimeout(function(){P(function(c){return c&&Date.now()-c.ts>1900?null:c})},2e3)}function W(l){o(l),ie(l),A(function(i){if(!i)return i;var c=Y(X(l,i.layouts,i.rows),i.rows);return Object.assign({},i,{rows:Z(c,i.rows)})}),B(function(i){if(!i)return i;var c=Y(ne(l),i.rows);return Object.assign({},i,{rows:le(c,i.rows)})})}async function z(){var l=(p||"").trim();if(!l){C("Layout name required","error");return}R(!0);try{var i=await Fe();W([Object.assign({id:"lp-"+Date.now().toString(36),name:l,created_at:new Date().toISOString()},i)].concat(t)),f(""),s(!1),C("Saved: "+l,"success")}catch{C("Capture failed","error")}finally{R(!1)}}function U(l){Ne(l),C("Loaded: "+l.name,"success")}function q(l){var i=De(l,t);W([i].concat(t)),v(i.id),T(i.name),C("Cloned: "+i.name,"success")}function te(l){var i=Le(l,t);W([i].concat(t)),v(i.id),T(i.name),C("Duplicated: "+i.name,"success")}function he(l){var i=$(l,G,t);if(!i)return C("Source no longer available","error"),!1;if(!window.confirm("Revert '"+l.name+"' to '"+i.name+`'? 2 3This replaces the current layout with the source. The name and slot stay the same.`))return!1;var c=Pe(l,i);return W(t.map(function(x){return x.id===l.id?c:x}
3)),C("Reverted: "+l.name+" â "+i.name,"success"),!0}function ge(l,i){if(!Array.isArray(i)||i.length===0)return!1;var c=$(l,G,t);if(!c)return C("Source no longer available","error"),!1;var x=i.map(function(k){return k.toUpperCase()}).join(", ");if(!window.confirm("Revert "+x+" in '"+l.name+"' from '"+c.name+`'? 4 5Only the selected buckets reset. Your other edits are preserved.`))return!1;var h=ze(l,c,i);return W(t.map(function(k){return k.id===l.id?h:k})),C("Reverted "+x+": "+l.name+" â "+c.name,"success"),!0}function ye(l){W(t.filter(function(i){return i.id!==l}))}function ve(l){var i=(m||"").trim();if(!i){v(null);return}W(t.map(function(c){return c.id===l?Object.assign({},c,{name:i}):c})),v(null),T("")}function xe(){if(!t.length){C("Nothing to export","error");return}B({rows:Y(ne(t),null)})}function be(){if(N){var l=Qe(N.rows,t);if(l.length===0){B(null);return}try{var i=He(l),c=JSON.stringify(i,null,2),x=new Blob([c],{type:"application/json"}),h=URL.createObjectURL(x),k=new Date().toISOString().slice(0,10),D=document.createElement("a");D.href=h,D.download="xyron-launchpad-"+k+".json",document.body.appendChild(D),D.click(),document.body.removeChild(D),setTimeout(function(){try{URL.revokeObjectURL(h)}catch{}},1e3);var J=t.length;C(l.length===J?"Exported "+l.length+" layout(s)":"Exported "+l.length+" of "+J+" layout(s)","success"),B(null)}catch{C("Export failed","error")}}}function Se(){B(null)}function ke(l){B(function(i){if(!i||!Array.isArray(i.rows))return i;var c=i.rows.map(function(x,h){return h===l?Object.assign({},x,{checked:!x.checked}):x});return Object.assign({},i,{rows:c})})}function we(l,i){B(function(c){if(!c||!Array.isArray(c.rows))return c;var x=c.rows.map(function(h,k){if(k!==l)return h;var D=typeof i=="string"?i.trim():"",J=typeof h.name=="string"&&h.name?h.name:"Untitled";return Object.assign({},h,{exportName:D||J})});return Object.assign({},c,{rows:x})})}function je(l){B(function(i){if(!i||!Array.isArray(i.rows))return i;var c=i.rows.map(function(x){return Object.assign({},x,{checked:!!l})});return Object.assign({},i,{rows:c})})}function Me(l){if(l){var i=new FileReader;i.onload=function(c){var x;try{x=JSON.parse(String(c&&c.target&&c.target.result||""))}catch{C("Import failed: invalid JSON","error");return}var h=Ve(x);if(!h.ok){C("Import failed: "+h.reason,"error");return}if(!h.layouts.length){C("Import: no layouts found","error");return}var k=Z(Y(X(t,h.layouts),null),null);A({layouts:h.layouts,skipped:h.skipped||0,fileName:l&&l.name||"",rows:k})},i.onerror=function(){C("Import failed: read error","error")},i.readAsText(l)}}function Ae(){if(y){var l=Xe(y.rows,y.layouts);if(l.length===0){A(null);return}var i=qe(t,l,G);o(i.layouts),ie(i.layouts),B(function(h){if(!h)return h;var k=Y(ne(i.layouts),h.rows);return Object.assign({},h,{rows:le(k,h.rows)})});var c=y.layouts.length,x=i.imported===c?"Imported "+i.imported+" layout(s)":"Imported "+i.imported+" of "+c+" layout(s)";y.skipped&&(x+=" ("+y.skipped+" skipped)"),C(x,"success"),A(null)}}function Ce(){A(null)}function _e(l){A(function(i){if(!i||!Array.isArray(i.rows))return i;var c=i.rows.map(function(h,k){return k===l?Object.assign({},h,{checked:!h.checked}):h}),x=Y(X(t,i.layouts,c),c);return Object.assign({},i,{rows:Z(x,c)})})}function Ee(l){A(function(i){if(!i||!Array.isArray(i.rows))return i;var c=i.rows.map(function(h){return Object.assign({},h,{checked:!!l})}),x=Y(X(t,i.layouts,c),c);return Object.assign({},i,{rows:Z(x,c)})})}function Te(l,i){A(function(c){if(!c||!Array.isArray(c.rows))return c;var x=c.rows.map(function(h,k){if(k!==l)return h;var D=typeof i=="string"?i.trim():"",J=typeof h.name=="string"&&h.name?h.name:"Untitled";return Object.assign({},h,{importName:D||J})});return Object.assign({},c,{rows:x})})}return(0,E.useEffect)(function(){if(!y)return;function l(i){i.key==="Escape"&&(i.preventDefault(),i.stopPropagation(),A(null))}return window.addEventListener("keydown",l),function(){window.removeEventListener("keydown",l)}},[y]),(0,E.useEffect)(function(){if(!N)return;function l(i){i.key==="Escape"&&(i.preventDefault(),i.stopPropagation(),B(null))}return window.addEventListener("keydown",l),function(){window.removeEventListener("keydown",l)}},[N]),(0,E.useEffect)(function(){function l(i){if(i.metaKey||i.ctrlKey){var c=i.key;if(!(c<"1"||c>"9")){var x=parseInt(c,10)-1;x>=t.length||(i.preventDefault(),U(t[x]))}}}return window.addEventListener("keydown",l),function(){window.removeEventListener("keydown",l)}},[t]),(0,n.jsxs)("div",{style:{display:"flex",flexDirection:"column",flex:1,overflow:"hidden",background:r.bg0},children:[(0,n.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:10,padding:"10px 14px",background:"#04040c",borderBottom:"1px solid "+r.b2,flexShrink:0}
5,children:[(0,n.jsx)("span",{style:{fontSize:10,color:r.amber,fontFamily:I,fontWeight:800,letterSpacing:".12em"},children:"⣠LAUNCHPAD"}),(0,n.jsxs)("span",{style:{fontSize:8,color:r.t5,fontFamily:I,letterSpacing:".08em"},children:[t.length," SAVED · ",G.length," PRESETS"]}),(0,n.jsx)("div",{style:{flex:1}}),(0,n.jsx)("span",{style:{fontSize:7,color:r.t5,fontFamily:I,letterSpacing:".08em"},children:"â+1â¦9 QUICK-LOAD"}),(0,n.jsx)("button",{onClick:xe,disabled:t.length===0,"data-testid":"launchpad-export-button",title:t.length===0?"No saved layouts to export":"Pick which saved layouts to download as JSON",style:{padding:"5px 10px",fontSize:9,fontFamily:I,fontWeight:800,background:"transparent",border:"1px solid "+(t.length===0?r.b3:r.teal+"AA"),color:t.length===0?r.t5:r.teal,borderRadius:3,cursor:t.length===0?"default":"pointer",letterSpacing:".1em"},children:"⤠EXPORT"}),(0,n.jsx)("button",{onClick:function(){S.current&&S.current.click()},"data-testid":"launchpad-import-button",title:"Import layouts from a JSON file",style:{padding:"5px 10px",fontSize:9,fontFamily:I,fontWeight:800,background:"transparent",border:"1px solid "+r.teal+"AA",color:r.teal,borderRadius:3,cursor:"pointer",letterSpacing:".1em"},children:"⤠IMPORT"}),(0,n.jsx)("input",{ref:S,type:"file",accept:"application/json,.json","data-testid":"launchpad-import-input",onChange:function(l){Me(l.target.files&&l.target.files[0]);try{l.target.value=""}catch{}},style:{display:"none"}}),(0,n.jsx)("button",{onClick:function(){s(function(l){return!l}),f("")},style:{padding:"5px 12px",fontSize:9,fontFamily:I,fontWeight:800,background:d?r.b3:r.amberBg,border:"1px solid "+(d?r.t5:r.amber),color:d?r.t3:r.amber,borderRadius:3,cursor:"pointer",letterSpacing:".1em"},children:d?"â CANCEL":"+ CREATE LAYOUT"})]}),N&&(function(){var l=N.rows.reduce(function(k,D){return k+(D&&D.checked?1:0)},0),i=N.rows.length,c=i>0&&l===i,x=l===0,h=!c;return(0,n.jsxs)("div",{"data-testid":"launchpad-export-preview",style:{display:"flex",flexDirection:"column",gap:6,padding:"10px 14px",background:r.bg1,borderBottom:"1px solid "+r.b2,flexShrink:0,fontFamily:"'Berkeley Mono', 'JetBrains Mono', 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, monospace"},children:[(0,n.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8},children:[(0,n.jsxs)("span",{style:{fontSize:10,color:r.teal,fontWeight:800,letterSpacing:".12em"},children:["⣠EXPORT PREVIEW â ",i," LAYOUT",i===1?"":"(S)"]}),(0,n.jsx)("span",{style:{flex:1}}),(0,n.jsx)("button",{type:"button","data-testid":"launchpad-export-preview-select-all",onClick:function(){je(h)},style:{padding:"3px 8px",fontSize:8,fontFamily:"'Berkeley Mono', 'JetBrains Mono', 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, monospace",fontWeight:700,background:"transparent",border:"1px solid "+r.b3,color:r.t3,borderRadius:3,cursor:"pointer",letterSpacing:".1em"},children:c?"â SELECT NONE":"â SELECT ALL"}),(0,n.jsx)("span",{style:{fontSize:7,color:r.t5,letterSpacing:".08em"},children:"ESC TO CANCEL"})]}),(0,n.jsx)("div",{style:{display:"flex",flexDirection:"column",gap:2,maxHeight:180,overflowY:"auto",paddingRight:4},children:N.rows.map(function(k,D){var J=typeof k.exportName=="string"?k.exportName:k.name,oe=J!==k.name;return(0,n.jsxs)("div",{"data-testid":"launchpad-export-preview-row","data-checked":k.checked?"true":"false","data-renamed":oe?"true":"false",style:{display:"flex",alignItems:"center",gap:8,padding:"3px 6px",fontSize:9,color:r.t3,letterSpacing:".04em"},children:[(0,n.jsx)("input",{type:"checkbox","data-testid":"launchpad-export-preview-row-checkbox",checked:!!k.checked,onChange:function(){ke(D)},style:{margin:0,cursor:"pointer"}}),(0,n.jsx)("span",{style:{color:r.teal},children:"â¸"}),(0,n.jsx)(rt,{idx:D,exportName:J,sourceName:k.name,onCommit:we}),oe&&(0,n.jsxs)("span",{"data-testid":"launchpad-export-preview-row-source",style:{fontSize:7,color:r.t5,letterSpacing:".06em"},children:['· was "',k.name,'"']})]},k.id!=null?k.id:D)})}),(0,n.jsxs)("div",{style:{display:"flex",gap:6,marginTop:4},children:[(0,n.jsxs)("button",{type:"button","data-testid":"launchpad-export-preview-confirm",onClick:be,disabled:x,title:x?"Check at least one layout to export":"",style:{padding:"5px 12px",fontSize:9,fontFamily:"'Berkeley Mono', 'JetBrains Mono', 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, monospace",fontWeight:800,background:r.teal+"22",border:"1px solid "+r.teal,color:r.teal,borderRadius:3,cursor:x?"not-allowed":"pointer",letterSpacing:".1em",opacity:x?.5:1},children:["â¶ CONFIRM EXPORT (",l,")"]}),(0,n.jsx)("button",{type:"button","data-testid":"launchpad-export-preview-cancel",onClick:Se,style:{padding:"5px 12px",fontSize:9,fontFamily:"'Berkeley Mono', 'JetBrains Mono', 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, monospace",fontWeight:800,background:"transparent",border:"1px solid "+r.b3,color:r.t3,borderRadius:3,cursor:"pointer",letterSpacing:".1em"},children:"â CANCEL"})]})]})})(),y&&(function(){var l=y.rows.reduce(function(h,k){return h+(k&&k.checked?1:0)},0),i=y.rows.length>0&&l===y.rows.length,c=l===0,x=!i;return(0,n.jsxs)("div",{"data-testid":"launchpad-import-preview",style:{display:"flex",flexDirection:"column",gap:6,padding:"10px 14px",background:r.bg1,borderBottom:"1px solid "+r.b2,flexShrink:0,fontFamily:"'Berkeley Mono', 'JetBrains Mono', 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, monospace"},children:[(0,n.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8}
5,children:[(0,n.jsxs)("span",{style:{fontSize:10,color:r.teal,fontWeight:800,letterSpacing:".12em"},children:["⣠IMPORT PREVIEW â ",y.rows.length," LAYOUT",y.rows.length===1?"":"(S)"]}),y.fileName&&(0,n.jsxs)("span",{style:{fontSize:8,color:r.t5,letterSpacing:".06em"},children:["· ",y.fileName]}),y.skipped>0&&(0,n.jsxs)("span",{"data-testid":"launchpad-import-preview-skipped",style:{fontSize:8,color:r.amber,letterSpacing:".08em"},children:["· ",y.skipped," SKIPPED"]}),(0,n.jsx)("span",{style:{flex:1}}),(0,n.jsx)("button",{type:"button","data-testid":"launchpad-import-preview-select-all",onClick:function(){Ee(x)},style:{padding:"3px 8px",fontSize:8,fontFamily:"'Berkeley Mono', 'JetBrains Mono', 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, monospace",fontWeight:700,background:"transparent",border:"1px solid "+r.b3,color:r.t3,borderRadius:3,cursor:"pointer",letterSpacing:".1em"},children:i?"â SELECT NONE":"â SELECT ALL"}),(0,n.jsx)("span",{style:{fontSize:7,color:r.t5,letterSpacing:".08em"},children:"ESC TO CANCEL"})]}),(0,n.jsx)("div",{style:{display:"flex",flexDirection:"column",gap:2,maxHeight:180,overflowY:"auto",paddingRight:4},children:y.rows.map(function(h,k){return(0,n.jsx)(nt,{idx:k,row:h,candidate:y.layouts[k],collidingSaved:Ze(t,y.layouts[k]),onToggleChecked:_e,onCommitName:Te},k)})}),(0,n.jsxs)("div",{style:{display:"flex",gap:6,marginTop:4},children:[(0,n.jsxs)("button",{type:"button","data-testid":"launchpad-import-preview-confirm",onClick:Ae,disabled:c,title:c?"Check at least one layout to import":"",style:{padding:"5px 12px",fontSize:9,fontFamily:"'Berkeley Mono', 'JetBrains Mono', 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, monospace",fontWeight:800,background:r.teal+"22",border:"1px solid "+r.teal,color:r.teal,borderRadius:3,cursor:c?"not-allowed":"pointer",letterSpacing:".1em",opacity:c?.5:1},children:["â¶ CONFIRM IMPORT (",l,")"]}),(0,n.jsx)("button",{type:"button","data-testid":"launchpad-import-preview-cancel",onClick:Ce,style:{padding:"5px 12px",fontSize:9,fontFamily:"'Berkeley Mono', 'JetBrains Mono', 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, monospace",fontWeight:800,background:"transparent",border:"1px solid "+r.b3,color:r.t3,borderRadius:3,cursor:"pointer",letterSpacing:".1em"},children:"â CANCEL"})]})]})})(),d&&(0,n.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"10px 14px",background:r.bg1,borderBottom:"1px solid "+r.b2,flexShrink:0},children:[(0,n.jsx)("span",{style:{fontSize:8,color:r.amber,fontFamily:"'Berkeley Mono', 'JetBrains Mono', 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, monospace",fontWeight:700,letterSpacing:".1em"},children:"NAME"}),(0,n.jsx)("input",{autoFocus:!0,value:p,onChange:function(l){f(l.target.value)},onKeyDown:function(l){l.key==="Enter"&&z()},placeholder:"Morning desk, Options flow, EOD close-outâ¦",style:{flex:1,background:"#04040c",border:"1px solid "+r.b3,color:r.t2,fontFamily:"'Berkeley Mono', 'JetBrains Mono', 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, monospace",fontSize:10,padding:"6px 9px",borderRadius:3,outline:"none"}}),(0,n.jsx)("button",{onClick:z,disabled:O,style:{padding:"6px 14px",fontSize:9,fontFamily:"'Berkeley Mono', 'JetBrains Mono', 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, monospace",fontWeight:800,background:O?r.b3:r.green+"22",border:"1px solid "+r.green,color:O?r.t5:r.green,borderRadius:3,cursor:O?"default":"pointer",letterSpacing:".1em"},children:O?"CAPTURINGâ¦":"⤠SAVE CURRENT"})]}),j&&(0,n.jsx)("div",{style:{padding:"6px 14px",background:j.kind==="error"?r.red+"18":r.green+"18",borderBottom:"1px solid "+(j.kind==="error"?r.red:r.green)+"55",fontSize:9,color:j.kind==="error"?r.red:r.green,fontFamily:"'Berkeley Mono', 'JetBrains Mono', 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, monospace",fontWeight:700,letterSpacing:".08em"},children:j.msg}),(0,n.jsxs)("div",{style:{flex:1,overflow:"auto",padding:14},children:[(0,n.jsx)(ce,{label:"BUILT-IN PRESETS",color:r.purple}),(0,n.jsx)(ue,{children:G.map(function(l){return(0,n.jsx)(se,{layout:l,preset:!0,onLoad:function(){U(l)},onClone:function(){q(l)}},l.id)})}),(0,n.jsxs)("div",{style:{marginTop:18},children:[(0,n.jsx)(ce,{label:"SAVED LAYOUTS",color:r.amber,right:t.length===0?(0,n.jsx)("span",{style:{fontSize:8,color:r.t5,fontFamily:I,letterSpacing:".1em"},children:"None yet â click CREATE LAYOUT"}):null}),t.length>0&&(0,n.jsx)(ue,{children:t.map(function(l,i){var c=$(l,G,t),x=c?pe(l,c):null;return(0,n.jsx)(se,{layout:l,idx:i<9?i+1:null,editing:g===l.id,editVal:m,lineageSource:c,lineageDiff:x,onStartEdit:function(){v(l.id),T(l.name)}
5,onEditChange:function(h){T(h)},onCommitEdit:function(){ve(l.id)},onCancelEdit:function(){v(null),T("")},onLoad:function(){U(l)},onDuplicate:function(){te(l)},onRevert:c?function(){he(l)}:null,onRevertFields:c?function(h){ge(l,h)}:null,onDelete:function(){ye(l.id)}},l.id)})})]})]})]})}function rt(e){var t=e.exportName,o=e.sourceName,a=e.idx,d=e.onCommit,s=(0,E.useRef)(!1),u=(0,E.useState)(t!=null?String(t):""),p=u[0],f=u[1],b=(0,E.useState)(!1),g=b[0],v=b[1];(0,E.useEffect)(function(){g||f(t!=null?String(t):"")},[t,g]);var M=p.trim()!==(t||"").trim();return(0,n.jsx)("input",{type:"text","data-testid":"launchpad-export-preview-rename-input","data-row-idx":a,"data-row-dirty":M?"true":"false",value:p,onChange:function(m){f(m.target.value)},onFocus:function(){v(!0)},onBlur:function(){if(v(!1),s.current){s.current=!1;return}d(a,p)},onKeyDown:function(m){m.key==="Enter"?(m.preventDefault(),m.currentTarget&&typeof m.currentTarget.blur=="function"&&m.currentTarget.blur()):m.key==="Escape"&&(m.preventDefault(),m.stopPropagation(),s.current=!0,f(t!=null?String(t):""),m.currentTarget&&typeof m.currentTarget.blur=="function"&&m.currentTarget.blur())},onClick:function(m){m.stopPropagation()},title:"Export as: "+(t||o)+(M?" (unsaved edit)":""),style:{flex:1,minWidth:60,background:"#04040c",border:"1px solid "+(M?r.teal:r.b3),color:r.t2,fontFamily:I,fontSize:9,fontWeight:600,padding:"2px 6px",borderRadius:2,outline:"none",letterSpacing:".04em"}})}function nt(e){var t=e.idx,o=e.row,a=e.candidate,d=e.collidingSaved,s=e.onToggleChecked,u=e.onCommitName,p=typeof o.importName=="string"?o.importName:o.name,f=p!==o.name,b=(0,E.useState)(!1),g=b[0],v=b[1],M=d&&a?pe(a,d):null,m=!!d;return(0,n.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:0},children:[(0,n.jsxs)("div",{"data-testid":"launchpad-import-preview-row","data-checked":o.checked?"true":"false","data-renamed":f?"true":"false","data-collision":m?"true":"false",style:{display:"flex",alignItems:"center",gap:8,padding:"3px 6px",fontSize:9,color:r.t3,letterSpacing:".04em"},children:[(0,n.jsx)("input",{type:"checkbox","data-testid":"launchpad-import-preview-row-checkbox",checked:!!o.checked,onChange:function(){s(t)},style:{margin:0,cursor:"pointer"}}),(0,n.jsx)("span",{style:{color:r.teal},children:"â¸"}),(0,n.jsx)(at,{idx:t,importName:p,sourceName:o.name,onCommit:u}),f&&(0,n.jsxs)("span",{"data-testid":"launchpad-import-preview-row-source",style:{fontSize:7,color:r.t5,letterSpacing:".06em"},children:['· was "',o.name,'"']}),o.willRenameTo&&(0,n.jsxs)("span",{"data-testid":"launchpad-import-preview-rename",style:{color:r.amber,fontSize:8},children:['· will save as "',o.willRenameTo,'"']}),m&&(0,n.jsx)("button",{type:"button","data-testid":"launchpad-import-preview-row-diff-toggle","aria-label":"Show diff against existing "+d.name,"aria-expanded":g?"true":"false",title:"Click to see what "+a.name+' would change vs your existing "'+d.name+'"',onClick:function(){v(function(T){return!T})},style:{fontSize:7,color:r.amber,fontFamily:"'Berkeley Mono', 'JetBrains Mono', 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, monospace",fontWeight:800,padding:"1px 5px",background:g?r.amber+"22":"transparent",border:"1px dashed "+r.amber+"AA",borderRadius:2,letterSpacing:".1em",cursor:"pointer"},children:g?"â¾ DIFF":"⸠DIFF"})]}),g&&m&&M&&(0,n.jsx)("div",{"data-testid":"launchpad-import-preview-row-diff",style:{paddingLeft:22,paddingRight:6},children:(0,n.jsx)(me,{diff:M,sourceName:'existing "'+d.name+'"'})})]})}function at(e){var t=e.importName,o=e.sourceName,a=e.idx,d=e.onCommit,s=(0,E.useRef)(!1),u=(0,E.useState)(t!=null?String(t):""),p=u[0],f=u[1],b=(0,E.useState)(!1),g=b[0],v=b[1];(0,E.useEffect)(function(){g||f(t!=null?String(t):"")},[t,g]);var M=p.trim()!==(t||"").trim();return(0,n.jsx)("input",{type:"text","data-testid":"launchpad-import-preview-rename-input","data-row-idx":a,"data-row-dirty":M?"true":"false",value:p,onChange:function(m){f(m.target.value)},onFocus:function(){v(!0)},onBlur:function(){if(v(!1),s.current){s.current=!1;return}d(a,p)},onKeyDown:function(m){m.key==="Enter"?(m.preventDefault(),m.currentTarget&&typeof m.currentTarget.blur=="function"&&m.currentTarget.blur()):m.key==="Escape"&&(m.preventDefault(),m.stopPropagation(),s.current=!0,f(t!=null?String(t):""),m.currentTarget&&typeof m.currentTarget.blur=="function"&&m.currentTarget.blur())},onClick:function(m){m.stopPropagation()},title:"Import as: "+(t||o)+(M?" (unsaved edit)":""),style:{flex:1,minWidth:60,background:"#04040c",border:"1px solid "+(M?r.teal:r.b3),color:r.t2,fontFamily:I,fontSize:9,fontWeight:600,padding:"2px 6px",borderRadius:2,outline:"none",letterSpacing:".04em"}})}function se(e){var t=e.layout,o=!!e.preset,a=(0,E.useState)(!1),d=a[0],s=a[1],u=e.lineageDiff,p=!o&&!!e.lineageSource&&u&&u.hasChanges,f=(0,E.useState)(!1),b=f[0],g=f[1],v=(0,E.useState)({tabs:!0,layout:!0,cards:!0}),M=v[0],m=v[1],T=u?u.tabs.length:0,_=u?u.layout.added.length+u.layout.removed.length+u.layout.moved.length:0,O=u?u.cards.configChanged.length:0;function R(j){return j==="tabs"?T:j==="layout"?_:O}var F=We.filter(function(j){return M[j]&&R(j)>0});return(0,n.jsxs)("div",{style:{position:"relative",border:"1px solid "+(o?r.purple+"55":r.b2),borderLeft:"3px solid "+(o?r.purple:r.amber),borderRadius:4,background:r.bg1,padding:10,display:"flex",flexDirection:"column",gap:6,minHeight:130},children:[(0,n.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:6},children:[e.idx&&(0,n.jsxs)("span",{style:{fontSize:7,color:r.teal,fontFamily:"'Berkeley Mono', 'JetBrains Mono', 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, monospace",fontWeight:800,padding:"1px 5px",border:"1px solid "+r.teal+"55",borderRadius:2,letterSpacing:".08em"}
5,children:["â",e.idx]}),o&&(0,n.jsx)("span",{style:{fontSize:7,color:r.purple,fontFamily:"'Berkeley Mono', 'JetBrains Mono', 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, monospace",fontWeight:800,padding:"1px 5px",border:"1px solid "+r.purple+"55",borderRadius:2,letterSpacing:".1em"},children:"PRESET"}),!o&&e.lineageSource&&(0,n.jsxs)("span",{"data-testid":"lineage-badge",title:"Cloned from "+e.lineageSource.name,style:{fontSize:7,color:r.purple,fontFamily:"'Berkeley Mono', 'JetBrains Mono', 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, monospace",fontWeight:700,padding:"1px 5px",border:"1px dashed "+r.purple+"55",borderRadius:2,letterSpacing:".08em"},children:["FROM: ",(e.lineageSource.name||"").toUpperCase().slice(0,18)]}),p&&(0,n.jsx)("button",{type:"button","data-testid":"edited-badge","aria-label":"Show diff against "+e.lineageSource.name,"aria-expanded":d?"true":"false",title:"Click to see what's changed since "+e.lineageSource.name,onClick:function(){s(function(j){return!j})},style:{fontSize:7,color:r.amber,fontFamily:"'Berkeley Mono', 'JetBrains Mono', 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, monospace",fontWeight:800,padding:"1px 5px",background:d?r.amber+"22":"transparent",border:"1px dashed "+r.amber+"AA",borderRadius:2,letterSpacing:".1em",cursor:"pointer"},children:d?"â¾ EDITED":"⸠EDITED"}),(0,n.jsx)("div",{style:{flex:1}}),(0,n.jsx)("span",{style:{fontSize:7,color:r.t5,fontFamily:I,letterSpacing:".08em"},children:et(t.created_at)})]}),e.editing?(0,n.jsx)("input",{autoFocus:!0,value:e.editVal,onChange:function(j){e.onEditChange(j.target.value)},onBlur:e.onCommitEdit,onKeyDown:function(j){j.key==="Enter"?e.onCommitEdit():j.key==="Escape"&&e.onCancelEdit()},style:{background:"#04040c",border:"1px solid "+r.amber,color:r.amber,fontFamily:I,fontSize:12,fontWeight:800,padding:"4px 7px",borderRadius:3,outline:"none",letterSpacing:".04em"}}):(0,n.jsx)("div",{onDoubleClick:function(){!o&&e.onStartEdit&&e.onStartEdit()},title:o?"Preset layout":"Double-click to rename",style:{fontSize:13,color:o?r.purple:r.amber,fontFamily:I,fontWeight:800,letterSpacing:".04em",cursor:o?"default":"text"},children:t.name}),(0,n.jsx)("div",{style:{fontSize:8,color:r.t4,fontFamily:I,letterSpacing:".04em",lineHeight:1.5},children:t.description||tt(t)||(0,n.jsx)("span",{style:{color:r.t5},children:"â"})}),(0,n.jsx)(lt,{layout:t}),d&&p&&(0,n.jsx)(me,{diff:u,sourceName:e.lineageSource.name}),b&&p&&e.onRevertFields&&(0,n.jsx)(ot,{sourceName:e.lineageSource.name,tabsCount:T,layoutCount:_,cardsCount:O,layoutAdded:u.layout.added.length,layoutRemoved:u.layout.removed.length,layoutMoved:u.layout.moved.length,selected:M,onToggle:function(j){m(function(P){var S=Object.assign({},P);return S[j]=!P[j],S})},onConfirmSelected:function(){F.length!==0&&e.onRevertFields(F)&&g(!1)},onConfirmAll:function(){e.onRevert&&e.onRevert()&&g(!1)},onCancel:function(){g(!1)},selectedCount:F.length}),(0,n.jsxs)("div",{style:{display:"flex",gap:6,marginTop:"auto"},children:[(0,n.jsx)("button",{onClick:e.onLoad,style:{flex:1,padding:"6px 10px",fontSize:9,fontFamily:I,fontWeight:800,background:r.green+"18",border:"1px solid "+r.green,color:r.green,borderRadius:3,cursor:"pointer",letterSpacing:".1em"},children:"â¶ LOAD"}),o&&e.onClone&&(0,n.jsx)("button",{onClick:e.onClone,title:"Copy this preset into Saved Layouts so you can edit it",style:{padding:"6px 10px",fontSize:9,fontFamily:"'Berkeley Mono', 'JetBrains Mono', 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, monospace",fontWeight:800,background:r.purple+"18",border:"1px solid "+r.purple,color:r.purple,borderRadius:3,cursor:"pointer",letterSpacing:".1em"},children:"â USE AS BASE"}),!o&&e.onDuplicate&&(0,n.jsx)("button",{onClick:e.onDuplicate,title:"Duplicate this saved layout",style:{padding:"6px 10px",fontSize:9,fontFamily:"'Berkeley Mono', 'JetBrains Mono', 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, monospace",fontWeight:800,background:r.purple+"18",border:"1px solid "+r.purple,color:r.purple,borderRadius:3,cursor:"pointer",letterSpacing:".1em"},children:"â DUPLICATE"}),!o&&e.onRevert&&(0,n.jsx)("button",{"data-testid":"revert-button","aria-expanded":b?"true":"false",onClick:function(){p&&e.onRevertFields?g(function(j){return!j}):e.onRevert()},title:"Revert to "+(e.lineageSource&&e.lineageSource.name||"source"),style:{padding:"6px 10px",fontSize:9,fontFamily:"'Berkeley Mono', 'JetBrains Mono', 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, monospace",fontWeight:800,background:b?r.amber+"22":"transparent",border:"1px solid "+r.amber+"88",color:r.amber,borderRadius:3,cursor:"pointer",letterSpacing:".1em"},children:"⺠REVERT"}),!o&&e.onDelete&&(0,n.jsx)("button",{onClick:function(){window.confirm("Delete layout '"+t.name+"'?")&&e.onDelete()},title:"Delete layout",style:{padding:"6px 10px",fontSize:9,fontFamily:"'Berkeley Mono', 'JetBrains Mono', 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, monospace",fontWeight:800,background:"transparent",border:"1px solid "+r.b3,color:r.red,borderRadius:3,cursor:"pointer",letterSpacing:".1em"},children:"â"})]})]})}function de(e){return e.x+","+e.y+" · "+e.w+"x"+e.h}function me({diff:e,sourceName:t}){var o=e.layout.added.length+e.layout.removed.length+e.layout.moved.length;
5return(0,n.jsxs)("div",{"data-testid":"diff-drawer",style:{marginTop:6,background:"#04040c",border:"1px solid "+r.amber+"55",borderRadius:3,padding:"6px 8px",maxHeight:160,overflow:"auto",fontFamily:I,fontSize:9,color:r.t3,letterSpacing:".04em",lineHeight:1.5},children:[(0,n.jsxs)("div",{style:{color:r.amber,fontWeight:800,letterSpacing:".12em",marginBottom:4},children:["â¾ DIFF vs ",(t||"SOURCE").toUpperCase().slice(0,22)]}),e.tabs.length>0&&(0,n.jsxs)("div",{"data-testid":"diff-tabs",style:{marginBottom:4},children:[(0,n.jsx)("span",{style:{color:r.t5,fontWeight:700},children:"TABS"}),e.tabs.map(function(a){return(0,n.jsxs)("div",{style:{paddingLeft:8},children:[(0,n.jsx)("span",{style:{color:r.t4},children:a.field}),(0,n.jsx)("span",{style:{color:r.t5},children:": "}),(0,n.jsx)("span",{style:{color:r.t5},children:String(a.from)}),(0,n.jsx)("span",{style:{color:r.t5},children:" â "}),(0,n.jsx)("span",{style:{color:r.amber},children:String(a.to)})]},a.field)})]}),o>0&&(0,n.jsxs)("div",{"data-testid":"diff-layout",style:{marginBottom:4},children:[(0,n.jsx)("span",{style:{color:r.t5,fontWeight:700},children:"LAYOUT"}),(0,n.jsx)("span",{style:{color:r.t5},children:" +"+e.layout.added.length+" · -"+e.layout.removed.length+" · "+e.layout.moved.length+" moved"}),e.layout.added.map(function(a){return(0,n.jsxs)("div",{style:{paddingLeft:8},children:[(0,n.jsx)("span",{style:{color:r.green},children:"+ "}),(0,n.jsx)("span",{style:{color:r.t3},children:a.id}),a.type&&(0,n.jsx)("span",{style:{color:r.t5},children:" ("+a.type+")"})]},"a-"+a.id)}),e.layout.removed.map(function(a){return(0,n.jsxs)("div",{style:{paddingLeft:8},children:[(0,n.jsx)("span",{style:{color:r.red},children:"- "}),(0,n.jsx)("span",{style:{color:r.t3},children:a.id}),a.type&&(0,n.jsx)("span",{style:{color:r.t5},children:" ("+a.type+")"})]},"r-"+a.id)}),e.layout.moved.map(function(a){return(0,n.jsxs)("div",{style:{paddingLeft:8},children:[(0,n.jsx)("span",{style:{color:r.amber},children:"â "}),(0,n.jsx)("span",{style:{color:r.t3},children:a.id}),a.type&&(0,n.jsx)("span",{style:{color:r.t5},children:" ("+a.type+")"}),(0,n.jsx)("span",{style:{color:r.t5},children:" "+de(a.from)+" â "+de(a.to)})]},"m-"+a.id)})]}),e.cards.configChanged.length>0&&(0,n.jsxs)("div",{"data-testid":"diff-cards",children:[(0,n.jsx)("span",{style:{color:r.t5,fontWeight:700},children:"CARDS"}),(0,n.jsx)("span",{style:{color:r.t5},children:" "+e.cards.configChanged.length+" config changed"}),e.cards.configChanged.map(function(a){return(0,n.jsxs)("div",{style:{paddingLeft:8},children:[(0,n.jsx)("span",{style:{color:r.purple},children:"â "}),(0,n.jsx)("span",{style:{color:r.t3},children:a.id}),a.type&&(0,n.jsx)("span",{style:{color:r.t5},children:" ("+a.type+")"})]},"c-"+a.id)})]})]})}function ot(e){var t=(e.sourceName||"SOURCE").toUpperCase().slice(0,22),o=[{key:"tabs",count:e.tabsCount},{key:"layout",count:e.layoutCount},{key:"cards",count:e.cardsCount}];return(0,n.jsxs)("div",{"data-testid":"revert-menu",style:{marginTop:6,background:"#04040c",border:"1px solid "+r.amber+"55",borderRadius:3,padding:"6px 8px",fontFamily:I,fontSize:9,color:r.t3,letterSpacing:".04em",lineHeight:1.6},children:[(0,n.jsxs)("div",{style:{color:r.amber,fontWeight:800,letterSpacing:".12em",marginBottom:4},children:["⺠REVERT WHICH FIELDS? â vs ",t]}),o.map(function(a){var d=a.count===0,s=!!e.selected[a.key]&&!d;return(0,n.jsxs)("label",{"data-testid":"revert-bucket-"+a.key,"data-disabled":d?"true":"false",style:{display:"flex",alignItems:"center",gap:8,paddingLeft:4,opacity:d?.4:1,cursor:d?"default":"pointer"},children:[(0,n.jsx)("input",{type:"checkbox",checked:s,disabled:d,onChange:function(){d||e.onToggle(a.key)},style:{accentColor:r.amber}}),(0,n.jsxs)("span",{style:{color:d?r.t5:r.t3},children:[a.key==="tabs"&&"TABS",a.key==="layout"&&"LAYOUT",a.key==="cards"&&"CARDS"]}),(0,n.jsxs)("span",{style:{color:r.t5,marginLeft:"auto"},children:[a.key==="tabs"&&(a.count===0?"â":a.count+" changed"),a.key==="layout"&&(a.count===0?"â":"+"+e.layoutAdded+" · -"+e.layoutRemoved+" · "+e.layoutMoved+" moved"),a.key==="cards"&&(a.count===0?"â":a.count+" config")]})]},a.key)}),(0,n.jsxs)("div",{style:{display:"flex",gap:6,marginTop:6},children:[(0,n.jsxs)("button",{type:"button","data-testid":"revert-confirm-selected",disabled:e.selectedCount===0,onClick:e.onConfirmSelected,style:{flex:1,padding:"5px 8px",fontSize:9,fontFamily:I,fontWeight:800,background:e.selectedCount===0?"transparent":r.amber+"22",border:"1px solid "+(e.selectedCount===0?r.b3:r.amber),color:e.selectedCount===0?r.t5:r.amber,borderRadius:3,cursor:e.selectedCount===0?"default":"pointer",letterSpacing:".08em"},children:["â¶ REVERT SELECTED (",e.selectedCount," OF 3)"]}),(0,n.jsx)("button",{type:"button","data-testid":"revert-confirm-all",onClick:e.onConfirmAll,style:{padding:"5px 8px",fontSize:9,fontFamily:I,fontWeight:800,background:"transparent",border:"1px solid "+r.amber+"88",color:r.amber,borderRadius:3,cursor:"pointer",letterSpacing:".08em"},children:"⺠ALL"}),(0,n.jsx)("button",{type:"button","data-testid":"revert-cancel",onClick:e.onCancel,style:{padding:"5px 8px",fontSize:9,fontFamily:I,fontWeight:800,background:"transparent",border:"1px solid "+r.b3,color:r.t3,borderRadius:3,cursor:"pointer",letterSpacing:".08em"},children:"â"})]})]})}var ae=240,Q=110,V=4,it=12;function lt({layout:e}){for(var t=Array.isArray(e&&e.dashboard_layout)?e.dashboard_layout:[],o=Array.isArray(e&&e.dashboard_cards)?e.dashboard_cards:[],a={},d=0;d<o.length;d++)a[o[d].id]=o[d];for(var s=0,u=0;u<t.length;u++){var p=t[u],f=(p.y||0)+(p.h||0);f>s&&(s=f)}for(var b=Math.max(s,1),g=ae-2*V,v=Q-2*V,M=g/it,m=v/b,T=o.filter(function(S){return S&&S.config&&S.config.float&&S.c
5onfig.float.enabled}),_={},O=[],R=0;R<T.length;R++){var F=T[R],j=F.config.float.tabGroup;j?(_[j]||(_[j]=[]),_[j].push(F)):O.push(F)}function P(S){if(!S)return r.t5+"55";for(var w=[r.purple+"44",r.teal+"44",r.blue+"44",r.green+"33",r.amber+"33",r.orange+"33",r.pink+"44"],y=0,A=0;A<S.length;A++)y=y*31+S.charCodeAt(A)>>>0;return w[y%w.length]}return(0,n.jsx)("div",{"data-testid":"preset-thumbnail",style:{marginTop:4},"aria-label":"Layout thumbnail for "+(e&&e.name?e.name:"preset"),children:(0,n.jsxs)("svg",{viewBox:"0 0 "+ae+" "+Q,width:"100%",height:Q,preserveAspectRatio:"none",style:{display:"block",background:"#04040c",border:"1px solid "+r.b3,borderRadius:3},children:[t.length===0&&T.length===0&&(0,n.jsx)("text",{x:ae/2,y:Q/2+3,textAnchor:"middle",fontSize:"8",fontFamily:"'Berkeley Mono', 'JetBrains Mono', 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, monospace",fill:r.t5,letterSpacing:"0.1em",children:"NO LAYOUT"}),t.map(function(S,w){var y=a[S.i],A=y&&y.type,L=V+(S.x||0)*M,N=V+(S.y||0)*m,B=(S.w||1)*M,C=(S.h||1)*m;return(0,n.jsxs)("g",{children:[(0,n.jsx)("rect",{x:L+.5,y:N+.5,width:Math.max(B-1,1),height:Math.max(C-1,1),fill:P(A),stroke:r.b3,strokeWidth:"0.5",rx:"1"}),C>12&&B>30&&A&&(0,n.jsx)("text",{x:L+3,y:N+9,fontSize:"6",fontFamily:"'Berkeley Mono', 'JetBrains Mono', 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, monospace",fill:r.t3,letterSpacing:"0.06em",children:A.toUpperCase().slice(0,Math.max(3,Math.floor(B/5)))})]},"g-"+w)}),Object.keys(_).map(function(S){var w=_[S],y=w.find(function(z){return z.config.float.tabGroupOwner})||w[0],A=V+Math.min(Math.max((y.config.float.x||0)/800,0),.7)*g,L=V+Math.min(Math.max((y.config.float.y||0)/600,0),.6)*v,N=Math.min((y.config.float.w||200)/800*g,g*.55),B=Math.min((y.config.float.h||200)/600*v,v*.7),C=y.config.float.tabGroupActive,W=6;return(0,n.jsxs)("g",{"data-testid":"thumb-floatgroup-"+S,children:[(0,n.jsx)("rect",{x:A,y:L+W,width:N,height:Math.max(B-W,4),fill:r.amber+"1A",stroke:r.amber+"AA",strokeWidth:"0.75",rx:"1.5"}),w.map(function(z,U){var q=N/w.length,te=z.id===C;return(0,n.jsx)("rect",{x:A+U*q,y:L,width:Math.max(q-.6,1),height:W,fill:te?r.amber+"AA":r.amber+"44",stroke:r.amber+"55",strokeWidth:"0.5"},"t-"+U)})]},"fg-"+S)}),O.map(function(S,w){return(0,n.jsx)("rect",{x:V+Math.min(Math.max((S.config.float.x||0)/800,0),.7)*g,y:V+Math.min(Math.max((S.config.float.y||0)/600,0),.6)*v,width:Math.min((S.config.float.w||200)/800*g,g*.5),height:Math.min((S.config.float.h||200)/600*v,v*.6),fill:r.amber+"1A",stroke:r.amber+"AA",strokeWidth:"0.75",rx:"1.5"},"fs-"+w)})]})})}function ce({label:e,color:t,right:o}){return(0,n.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:8},children:[(0,n.jsx)("div",{style:{width:3,height:10,background:t||r.amber,borderRadius:1}}),(0,n.jsx)("span",{style:{fontSize:9,color:t||r.amber,fontFamily:I,fontWeight:800,letterSpacing:".12em"},children:e}),(0,n.jsx)("div",{style:{flex:1,height:1,background:r.b2}}),o]})}function ue({children:e}){return(0,n.jsx)("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(260px, 1fr))",gap:10},children:e})}export{Z as C,le as S,Qe as _,qe as a,Ve as b,De as c,Ze as d,$ as f,ze as g,Pe as h,We as i,Le as l,X as m,ut as n,He as o,Ge as p,ft as r,ne as s,Ue as t,pe as u,Xe as v,Y as x,ee as y};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.