var w=Object.defineProperty,g=Object.defineProperties;var x=Object.getOwnPropertyDescriptors;var f=Object.getOwnPropertySymbols;var h=Object.prototype.hasOwnProperty,v=Object.prototype.propertyIsEnumerable;var m=(n,e,o)=>e in n?w(n,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):n[e]=o,y=(n,e)=>{for(var o in e||(e={}))h.call(e,o)&&m(n,o,e[o]);if(f)for(var o of f(e))v.call(e,o)&&m(n,o,e[o]);return n},p=(n,e)=>g(n,x(e));import{al as I,f as r,am as k,a0 as a}from"./app-JmgyQoR0.js";import{m as C}from"./vue-y3KLWBaS.js";const t=C(new I("deck",{profile:{where:"deviceAccount",default:"default"},columns:{where:"deviceAccount",default:[]},layout:{where:"deviceAccount",default:[]},columnAlign:{where:"deviceAccount",default:"left"},alwaysShowMainColumn:{where:"deviceAccount",default:!0},navWindow:{where:"deviceAccount",default:"window"}})),D=async()=>{let n;try{n=await r("i/registry/get",{scope:["client","deck","profiles"],key:t.state.profile})}catch(e){if(e.code==="NO_SUCH_KEY"){if(t.state.profile==="default"){i();return}t.set("columns",[]),t.set("layout",[]);return}throw e}t.set("columns",n.columns),t.set("layout",n.layout)},i=k(1e3,()=>{r("i/registry/set",{scope:["client","deck","profiles"],key:t.state.profile,value:{columns:t.reactiveState.columns.value,layout:t.reactiveState.layout.value}})});async function P(){return await r("i/registry/keys",{scope:["client","deck","profiles"]})}async function A(n){return await r("i/registry/remove",{scope:["client","deck","profiles"],key:n})}async function R(n,e){n!==e&&(await r("i/registry/set",{scope:["client","deck","profiles"],key:e,value:{columns:t.state.columns,layout:t.state.layout}}),t.set("profile",e),i(),A(n))}function Y(n){n.name===void 0&&(n.name=null),t.push("columns",n),t.push("layout",[n.id]),i()}function b(n){t.set("columns",t.state.columns.filter(e=>e.id!==n)),t.set("layout",t.state.layout.map(e=>e.filter(o=>o!==n)).filter(e=>e.length>0)),i()}function j(n,e){const o=t.state.layout.findIndex(d=>d.indexOf(n)!==-1),s=t.state.layout[o].findIndex(d=>d===n),u=t.state.layout.findIndex(d=>d.indexOf(e)!==-1),l=t.state.layout[u].findIndex(d=>d===e),c=a(t.state.layout);c[o][s]=e,c[u][l]=n,t.set("layout",c),i()}function L(n){const e=a(t.state.layout);t.state.layout.some((o,s)=>{if(o.includes(n)){const u=t.state.layout[s-1];return u&&(e[s-1]=t.state.layout[s],e[s]=u,t.set("layout",e)),!0}}),i()}function U(n){const e=a(t.state.layout);t.state.layout.some((o,s)=>{if(o.includes(n)){const u=t.state.layout[s+1];return u&&(e[s+1]=t.state.layout[s],e[s]=u,t.set("layout",e)),!0}}),i()}function X(n){const e=a(t.state.layout),o=t.state.layout.findIndex(u=>u.includes(n)),s=a(t.state.layout[o]);s.some((u,l)=>{if(u===n){const c=s[l-1];return c&&(s[l-1]=n,s[l]=c,e[o]=s,t.set("layout",e)),!0}}),i()}function _(n){const e=a(t.state.layout),o=t.state.layout.findIndex(u=>u.includes(n)),s=a(t.state.layout[o]);s.some((u,l)=>{if(u===n){const c=s[l+1];return c&&(s[l+1]=n,s[l]=c,e[o]=s,t.set("layout",e)),!0}}),i()}function E(n){let e=a(t.state.layout);const o=t.state.layout.findIndex(s=>s.includes(n));e=e.map(s=>s.filter(u=>u!==n)),e[o-1].push(n),e=e.filter(s=>s.length>0),t.set("layout",e),i()}function H(n){let e=a(t.state.layout);const o=t.state.layout.findIndex(l=>l.includes(n)),s=e[o];e=e.map(l=>l.filter(c=>c!==n)),e.splice(o+1,0,[n]),e=e.filter(l=>l.length>0),t.set("layout",e);const u=a(t.state.columns);for(const l of u)s.includes(l.id)&&(l.active=!0);t.set("columns",u),i()}function M(n,e){const o=a(t.state.columns),s=t.state.columns.findIndex(l=>l.id===n),u=a(t.state.columns[s]);u!=null&&(u.widgets==null&&(u.widgets=[]),u.widgets.unshift(e),o[s]=u,t.set("columns",o),i())}function N(n,e){const o=a(t.state.columns),s=t.state.columns.findIndex(l=>l.id===n),u=a(t.state.columns[s]);u!=null&&(u.widgets=u.widgets.filter(l=>l.id!==e.id),o[s]=u,t.set("columns",o),i())}function q(n,e){const o=a(t.state.columns),s=t.state.columns.findIndex(l=>l.id===n),u=a(t.state.columns[s]);u!=null&&(u.widgets=e,o[s]=u,t.set("columns",o),i())}function z(n,e,o){const s=a(t.state.columns),u=t.state.columns.findIndex(c=>c.id===n),l=a(t.state.columns[u]);l!=null&&(l.widgets=l.widgets.map(c=>c.id===e?p(y({},c),{data:o}):c),s[u]=l,t.set("columns",s),i())}function B(n,e){const o=a(t.state.columns),s=t.state.columns.findIndex(l=>l.id===n),u=a(t.state.columns[s]);if(u!=null){for(const[l,c]of Object.entries(e))u[l]=c;o[s]=u,t.set("columns",o),i()}}export{L as a,U as b,X as c,_ as d,E as e,t as f,M as g,N as h,z as i,q as j,Y as k,D as l,P as m,R as n,A as o,H as p,b as r,j as s,B as u};
