"use strict";function s(i){return JSON.stringify(i,(t,r)=>!r||typeof r!="object"||Array.isArray(r)?r:Object.keys(r).sort().reduce((e,n)=>(e[n]=r[n],e),{}))}const y=["i","x","y","w","h","minW","minH","maxW","maxH","static","isResizable","isDraggable"];function a(i,t,r){i[t]=r}function f(i){const t={};for(const r of y){const e=i[r];e!==void 0&&((r==="isResizable"||r==="isDraggable")&&e===!0||a(t,r,e))}return t}function o(i){return i?i.map(f).sort((t,r)=>{const e=String(t.i??""),n=String(r.i??"");return e!==n?e.localeCompare(n):Number(t.y??0)-Number(r.y??0)||Number(t.x??0)-Number(r.x??0)||Number(t.h??0)-Number(r.h??0)||Number(t.w??0)-Number(r.w??0)}):[]}function u(i){if(!i)return;const t={};for(const r of Object.keys(i).sort()){const e=i[r];e&&(t[r]=o(e))}return t}function c(i){var t;return i?{...i,sheets:(t=i.sheets)==null?void 0:t.map(r=>{if(!r)return r;const e={...r};return r.layout&&(e.layout=o(r.layout)),r.layouts&&(e.layouts=u(r.layouts)),e})}:null}function m(i){return JSON.stringify(i??null,function(t,r){return t==="layout"&&Array.isArray(r)?o(r):t==="layouts"&&r&&typeof r=="object"&&!Array.isArray(r)?u(r):!r||typeof r!="object"||Array.isArray(r)?r:Object.keys(r).sort().reduce((e,n)=>(e[n]=r[n],e),{})})}function b(i){return s(u(i)??null)}exports.normalizeDashboardForDirtyCheck=c;exports.serializeDashboardForDirtyCheck=m;exports.serializeLayoutsForDirtyCheck=b;exports.stableSerialize=s;
