@luzmo/analytics-components-kit 1.0.1-alpha.87 → 1.0.1-alpha.89
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/angular/components/display-settings-binning.component.ts +2 -2
- package/angular/components/display-settings-datetime.component.ts +2 -2
- package/angular/components/display-settings-grand-totals.component.ts +2 -2
- package/angular/components/display-settings-numeric.component.ts +2 -2
- package/angular/components/display-settings.component.ts +3 -3
- package/angular/components/draggable-data-item/index.ts +1 -0
- package/angular/components/draggable-data-item/types.ts +40 -0
- package/angular/components/draggable-data-item-level/index.ts +1 -0
- package/angular/components/draggable-data-item-level/types.ts +15 -0
- package/angular/components/draggable-data-item-level.component.ts +4 -10
- package/angular/components/draggable-data-item.component.ts +4 -10
- package/angular/components/droppable-slot/index.ts +1 -0
- package/angular/components/droppable-slot/types.ts +16 -0
- package/angular/components/droppable-slot.component.ts +5 -3
- package/angular/components/slot-menu/index.ts +1 -0
- package/angular/components/slot-menu/types.ts +31 -0
- package/angular/components/slot-menu-list.component.ts +2 -2
- package/angular/components/slot-menu.component.ts +3 -3
- package/angular/esm/components/display-settings-binning.component.d.ts +2 -1
- package/angular/esm/components/display-settings-datetime.component.d.ts +2 -2
- package/angular/esm/components/display-settings-grand-totals.component.d.ts +2 -1
- package/angular/esm/components/display-settings-numeric.component.d.ts +2 -1
- package/angular/esm/components/display-settings.component.d.ts +3 -3
- package/angular/esm/components/draggable-data-item/index.d.ts +1 -0
- package/angular/esm/components/draggable-data-item/index.js +1 -0
- package/angular/esm/components/draggable-data-item/types.d.ts +22 -0
- package/angular/esm/components/draggable-data-item/types.js +1 -0
- package/angular/esm/components/draggable-data-item-level/index.d.ts +1 -0
- package/angular/esm/components/draggable-data-item-level/index.js +1 -0
- package/angular/esm/components/draggable-data-item-level/types.d.ts +12 -0
- package/angular/esm/components/draggable-data-item-level/types.js +1 -0
- package/angular/esm/components/draggable-data-item-level.component.d.ts +9 -7
- package/angular/esm/components/draggable-data-item-level.component.js +2 -17
- package/angular/esm/components/draggable-data-item.component.d.ts +9 -7
- package/angular/esm/components/draggable-data-item.component.js +2 -17
- package/angular/esm/components/droppable-slot/index.d.ts +1 -0
- package/angular/esm/components/droppable-slot/index.js +1 -0
- package/angular/esm/components/droppable-slot/types.d.ts +9 -0
- package/angular/esm/components/droppable-slot/types.js +1 -0
- package/angular/esm/components/droppable-slot.component.d.ts +5 -4
- package/angular/esm/components/droppable-slot.component.js +7 -2
- package/angular/esm/components/slot-menu/index.d.ts +1 -0
- package/angular/esm/components/slot-menu/index.js +1 -0
- package/angular/esm/components/slot-menu/types.d.ts +25 -0
- package/angular/esm/components/slot-menu/types.js +1 -0
- package/angular/esm/components/slot-menu-list.component.d.ts +2 -1
- package/angular/esm/components/slot-menu.component.d.ts +3 -3
- package/angular/esm/types.d.ts +9 -3
- package/angular/tsconfig.json +3 -0
- package/angular/types.ts +24 -3
- package/angular/utils/base/base.d.ts +16 -0
- package/angular/utils/base/focus-visible.d.ts +29 -0
- package/angular/utils/base/focusable.d.ts +58 -0
- package/angular/utils/base/index.d.ts +4 -0
- package/angular/utils/base/sized-mixin.d.ts +17 -0
- package/angular/utils/color/color-palettes.d.ts +17 -0
- package/angular/utils/color/extrapolate-color.d.ts +1 -0
- package/angular/utils/data/load-draggable-items-for-datasets.d.ts +24 -0
- package/angular/utils/data-broker/index.d.ts +191 -0
- package/angular/utils/data-item-types/calculate-data-item-icon.d.ts +10 -0
- package/angular/utils/data-item-types/tests/calculate-data-item-icon.test.d.ts +1 -0
- package/angular/utils/drag/draggable.d.ts +13 -0
- package/angular/utils/filters/expressions.d.ts +15 -0
- package/angular/utils/filters/index.d.ts +1 -0
- package/angular/utils/formatter/calculate-duration.d.ts +2 -0
- package/angular/utils/formatter/decompose-numeric-format.d.ts +11 -0
- package/angular/utils/formatter/default-local-formats.d.ts +20 -0
- package/angular/utils/formatter/formats/cs.d.ts +20 -0
- package/angular/utils/formatter/formats/da.d.ts +20 -0
- package/angular/utils/formatter/formats/de.d.ts +21 -0
- package/angular/utils/formatter/formats/en-GB.d.ts +21 -0
- package/angular/utils/formatter/formats/en-US.d.ts +1 -0
- package/angular/utils/formatter/formats/en.d.ts +1 -0
- package/angular/utils/formatter/formats/es.d.ts +54 -0
- package/angular/utils/formatter/formats/fi.d.ts +20 -0
- package/angular/utils/formatter/formats/fr.d.ts +54 -0
- package/angular/utils/formatter/formats/he.d.ts +20 -0
- package/angular/utils/formatter/formats/hu.d.ts +20 -0
- package/angular/utils/formatter/formats/it.d.ts +54 -0
- package/angular/utils/formatter/formats/ja.d.ts +20 -0
- package/angular/utils/formatter/formats/ko.d.ts +20 -0
- package/angular/utils/formatter/formats/mk.d.ts +20 -0
- package/angular/utils/formatter/formats/nl.d.ts +21 -0
- package/angular/utils/formatter/formats/no.d.ts +21 -0
- package/angular/utils/formatter/formats/pl.d.ts +20 -0
- package/angular/utils/formatter/formats/pt.d.ts +20 -0
- package/angular/utils/formatter/formats/ru.d.ts +20 -0
- package/angular/utils/formatter/formats/sv.d.ts +20 -0
- package/angular/utils/formatter/formats/tr.d.ts +21 -0
- package/angular/utils/formatter/formats/zh-CN.d.ts +20 -0
- package/angular/utils/formatter/formats/zh-TW.d.ts +20 -0
- package/angular/utils/formatter/formatter.d.ts +9 -0
- package/angular/utils/formatter/localize.d.ts +3 -0
- package/angular/utils/formatter/smart-datetime-formats.const.d.ts +36 -0
- package/angular/utils/get-css-variable.d.ts +1 -0
- package/angular/utils/index.d.ts +7 -0
- package/angular/utils/localize/set-locale.d.ts +7 -0
- package/angular/utils/map-tile-providers/index.d.ts +93 -0
- package/angular/utils/store/slot-context.d.ts +4 -0
- package/angular/utils/store/slot-store.d.ts +39 -0
- package/angular/utils/switch-item/index.d.ts +14 -0
- package/angular/utils/themes/bliss.d.ts +43 -0
- package/angular/utils/themes/classic-dark.d.ts +34 -0
- package/angular/utils/themes/classic.d.ts +43 -0
- package/angular/utils/themes/default-dark.d.ts +46 -0
- package/angular/utils/themes/default.d.ts +46 -0
- package/angular/utils/themes/index.d.ts +3 -0
- package/angular/utils/themes/orion.d.ts +44 -0
- package/angular/utils/themes/pinky.d.ts +42 -0
- package/angular/utils/themes/radiant.d.ts +42 -0
- package/angular/utils/themes/royale.d.ts +36 -0
- package/angular/utils/themes/seasonal.d.ts +43 -0
- package/angular/utils/themes/urban.d.ts +44 -0
- package/angular/utils/themes/vivid.d.ts +42 -0
- package/angular/utils/time/formats.const.d.ts +4 -0
- package/angular/utils/time/periods.const.d.ts +15 -0
- package/angular/utils/transformations/convert-data-item-to-slot-content.d.ts +9 -0
- package/angular/utils/transformations/convert-datasets-to-draggable-items.d.ts +17 -0
- package/angular/utils/transformations/tests/convert-data-item-to-slot-content.test.d.ts +1 -0
- package/angular/utils/transformations/tests/convert-datasets-to-draggable-items.test.d.ts +1 -0
- package/angular/utils/types/type-check.d.ts +7 -0
- package/components/ai-chat-message-assistant/index.cjs +1 -1
- package/components/ai-chat-message-assistant/index.js +0 -1
- package/components/calculate-data-item-icon-DMDhKq_m.js +147 -0
- package/components/{calculate-data-item-icon-CX4VW9Km.cjs → calculate-data-item-icon-DtVGbet3.cjs} +1 -1
- package/components/dataset-selector-list/index.cjs +1 -1
- package/components/dataset-selector-list/index.js +1 -1
- package/components/display-settings/display-settings.d.ts +4 -2
- package/components/display-settings/index.cjs +1 -1
- package/components/display-settings/index.js +1 -1
- package/components/display-settings-binning/display-settings-binning.d.ts +2 -1
- package/components/display-settings-datetime/display-settings-datetime.d.ts +2 -1
- package/components/display-settings-datetime/index.cjs +1 -1
- package/components/display-settings-datetime/index.js +4 -4
- package/components/display-settings-grand-totals/display-settings-grand-totals.d.ts +2 -1
- package/components/display-settings-numeric/display-settings-numeric.d.ts +2 -1
- package/components/display-settings-numeric/index.cjs +10 -10
- package/components/display-settings-numeric/index.js +5 -5
- package/components/draggable-data-item/draggable-data-item.d.ts +5 -7
- package/components/draggable-data-item/index.cjs +16 -22
- package/components/draggable-data-item/index.d.ts +1 -0
- package/components/draggable-data-item/index.js +78 -85
- package/components/draggable-data-item/types.d.ts +22 -0
- package/components/draggable-data-item-level/draggable-data-item-level.d.ts +4 -6
- package/components/draggable-data-item-level/helpers/generate-preview.d.ts +9 -1
- package/components/draggable-data-item-level/index.cjs +13 -13
- package/components/draggable-data-item-level/index.js +84 -102
- package/components/draggable-data-item-level/types.d.ts +12 -0
- package/components/droppable-slot/droppable-slot.d.ts +4 -2
- package/components/droppable-slot/index.cjs +13 -13
- package/components/droppable-slot/index.d.ts +1 -0
- package/components/droppable-slot/index.js +198 -199
- package/components/droppable-slot/types.d.ts +9 -0
- package/components/{en-CtCctD2c.js → en-D3ihEGXg.js} +67 -67
- package/components/{en--a5SfjnM.cjs → en-DZcn_iz_.cjs} +1 -1
- package/components/{en-GB-CXVKFWyH.cjs → en-GB-TqvgIw9B.cjs} +1 -1
- package/components/{en-GB-CbNfyZMo.js → en-GB-ialeqj_z.js} +1 -1
- package/components/filter-data-item-picker/index.cjs +1 -1
- package/components/filter-data-item-picker/index.js +1 -1
- package/components/filter-item/index.cjs +1 -1
- package/components/filter-item/index.js +8 -8
- package/components/filter-value-picker-hierarchy/index.cjs +1 -1
- package/components/filter-value-picker-hierarchy/index.js +1 -1
- package/components/filter-value-picker-numeric/index.cjs +1 -1
- package/components/filter-value-picker-numeric/index.js +1 -1
- package/components/{get-css-variable-CuDaWSjr.cjs → get-css-variable-COd1d84B.cjs} +3 -3
- package/components/{get-css-variable-DEf4GhTH.js → get-css-variable-CdwF98oh.js} +31 -31
- package/components/grid/index.cjs +1 -7
- package/components/grid/index.js +0 -7
- package/components/{index-BUal0r_D.cjs → index-BekTY3Em.cjs} +1 -1
- package/components/index-CFL6gmIu.cjs +20 -0
- package/components/{index-3WsfvkZF.js → index-CqKpf0B8.js} +1 -1
- package/components/{index-BGb_wRRW.js → index-DNPULp4A.js} +177 -188
- package/components/index.cjs +1 -1
- package/components/index.js +26 -24
- package/components/slot-contents-picker/index.cjs +1 -1
- package/components/slot-contents-picker/index.js +2 -2
- package/components/slot-menu/index.cjs +1 -1
- package/components/slot-menu/index.d.ts +1 -0
- package/components/slot-menu/index.js +64 -69
- package/components/slot-menu/slot-menu.d.ts +7 -6
- package/components/slot-menu/types.d.ts +25 -0
- package/components/slot-menu-list/index.cjs +1 -1
- package/components/slot-menu-list/index.js +2 -2
- package/components/slot-menu-list/slot-menu-list.d.ts +2 -1
- package/components/utils.cjs +1 -1
- package/components/utils.js +129 -62
- package/custom-elements.json +123 -126
- package/item-definitions/slicer-filter/slicer-filter-options.config.d.ts +1 -1
- package/package.json +1 -1
- package/types.d.ts +9 -3
- package/utils/data/load-draggable-items-for-datasets.d.ts +24 -0
- package/utils/data-broker/index.d.ts +69 -66
- package/utils/data-item-types/calculate-data-item-icon.d.ts +8 -2
- package/utils/data-item-types/tests/calculate-data-item-icon.test.d.ts +1 -0
- package/utils/index.d.ts +2 -0
- package/utils/transformations/convert-data-item-to-slot-content.d.ts +9 -0
- package/utils/transformations/convert-datasets-to-draggable-items.d.ts +17 -0
- package/utils/transformations/tests/convert-data-item-to-slot-content.test.d.ts +1 -0
- package/utils/transformations/tests/convert-datasets-to-draggable-items.test.d.ts +1 -0
- package/components/calculate-data-item-icon-C8CbsMQf.js +0 -139
- package/components/index-D1Y5TRsH.cjs +0 -20
- package/utils/types/column.types.d.ts +0 -57
|
@@ -223,13 +223,7 @@ ${s}`,console.warn(t))},hs=s=>{let e=!1,t="";const r=(document.body||document.do
|
|
|
223
223
|
width: 100%;
|
|
224
224
|
height: 100%;
|
|
225
225
|
}
|
|
226
|
-
`,ge);g([m.property()],U.prototype,"appServer");g([m.property()],U.prototype,"apiHost");g([m.property({type:Object})],U.prototype,"options");g([m.property()],U.prototype,"aiEndPoint");g([m.property()],U.prototype,"authKey");g([m.property()],U.prototype,"authToken");g([m.property()],U.prototype,"messages");g([m.property()],U.prototype,"version");g([m.property()],U.prototype,"libVersion");g([m.property()],U.prototype,"remoteEntryServer");customElements.get(Vt)||customElements.define(Vt,U);_.LitElement.disableWarning?.("change-in-update");function $s(s,e,t,i,r){const o=(...n)=>(console.warn("gridstack.js: Function `"+t+"` is deprecated in "+r+" and has been replaced with `"+i+"`. It will be **removed** in a future release"),e.apply(s,n));return o.prototype=e.prototype,o}class c{static getElements(e,t=document){if(typeof e=="string"){const i="getElementById"in t?t:void 0;if(i&&!isNaN(+e[0])){const o=i.getElementById(e);return o?[o]:[]}let r=t.querySelectorAll(e);return!r.length&&e[0]!=="."&&e[0]!=="#"&&(r=t.querySelectorAll("."+e),r.length||(r=t.querySelectorAll("#"+e))),Array.from(r)}return[e]}static getElement(e,t=document){if(typeof e=="string"){const i="getElementById"in t?t:void 0;if(!e.length)return null;if(i&&e[0]==="#")return i.getElementById(e.substring(1));if(e[0]==="#"||e[0]==="."||e[0]==="[")return t.querySelector(e);if(i&&!isNaN(+e[0]))return i.getElementById(e);let r=t.querySelector(e);return i&&!r&&(r=i.getElementById(e)),r||(r=t.querySelector("."+e)),r}return e}static lazyLoad(e){return e.lazyLoad||e.grid?.opts?.lazyLoad&&e.lazyLoad!==!1}static createDiv(e,t){const i=document.createElement("div");return e.forEach(r=>{r&&i.classList.add(r)}),t?.appendChild(i),i}static shouldSizeToContent(e,t=!1){return e?.grid&&(t?e.sizeToContent===!0||e.grid.opts.sizeToContent===!0&&e.sizeToContent===void 0:!!e.sizeToContent||e.grid.opts.sizeToContent&&e.sizeToContent!==!1)}static isIntercepted(e,t){return!(e.y>=t.y+t.h||e.y+e.h<=t.y||e.x+e.w<=t.x||e.x>=t.x+t.w)}static isTouching(e,t){return c.isIntercepted(e,{x:t.x-.5,y:t.y-.5,w:t.w+1,h:t.h+1})}static areaIntercept(e,t){const i=e.x>t.x?e.x:t.x,r=e.x+e.w<t.x+t.w?e.x+e.w:t.x+t.w;if(r<=i)return 0;const o=e.y>t.y?e.y:t.y,n=e.y+e.h<t.y+t.h?e.y+e.h:t.y+t.h;return n<=o?0:(r-i)*(n-o)}static area(e){return e.w*e.h}static sort(e,t=1){return e.sort((r,o)=>{const n=t*((r.y??1e4)-(o.y??1e4));return n===0?t*((r.x??1e4)-(o.x??1e4)):n})}static find(e,t){return t?e.find(i=>i.id===t):void 0}static toBool(e){return typeof e=="boolean"?e:typeof e=="string"?(e=e.toLowerCase(),!(e===""||e==="no"||e==="false"||e==="0")):!!e}static toNumber(e){return e===null||e.length===0?void 0:Number(e)}static parseHeight(e){let t,i="px";if(typeof e=="string")if(e==="auto"||e==="")t=0;else{const r=e.match(/^(-[0-9]+\.[0-9]+|[0-9]*\.[0-9]+|-[0-9]+|[0-9]+)(px|em|rem|vh|vw|%|cm|mm)?$/);if(!r)throw new Error(`Invalid height val = ${e}`);i=r[2]||"px",t=parseFloat(r[1])}else t=e;return{h:t,unit:i}}static defaults(e,...t){return t.forEach(i=>{for(const r in i){if(!i.hasOwnProperty(r))return;e[r]===null||e[r]===void 0?e[r]=i[r]:typeof i[r]=="object"&&typeof e[r]=="object"&&c.defaults(e[r],i[r])}}),e}static same(e,t){if(typeof e!="object")return e==t;if(typeof e!=typeof t||Object.keys(e).length!==Object.keys(t).length)return!1;for(const i in e)if(e[i]!==t[i])return!1;return!0}static copyPos(e,t,i=!1){return t.x!==void 0&&(e.x=t.x),t.y!==void 0&&(e.y=t.y),t.w!==void 0&&(e.w=t.w),t.h!==void 0&&(e.h=t.h),i&&(t.minW&&(e.minW=t.minW),t.minH&&(e.minH=t.minH),t.maxW&&(e.maxW=t.maxW),t.maxH&&(e.maxH=t.maxH)),e}static samePos(e,t){return e&&t&&e.x===t.x&&e.y===t.y&&(e.w||1)===(t.w||1)&&(e.h||1)===(t.h||1)}static sanitizeMinMax(e){e.minW||delete e.minW,e.minH||delete e.minH,e.maxW||delete e.maxW,e.maxH||delete e.maxH}static removeInternalAndSame(e,t){if(!(typeof e!="object"||typeof t!="object"))for(let i in e){const r=e[i],o=t[i];i[0]==="_"||r===o?delete e[i]:r&&typeof r=="object"&&o!==void 0&&(c.removeInternalAndSame(r,o),Object.keys(r).length||delete e[i])}}static removeInternalForSave(e,t=!0){for(let i in e)(i[0]==="_"||e[i]===null||e[i]===void 0)&&delete e[i];delete e.grid,t&&delete e.el,e.autoPosition||delete e.autoPosition,e.noResize||delete e.noResize,e.noMove||delete e.noMove,e.locked||delete e.locked,(e.w===1||e.w===e.minW)&&delete e.w,(e.h===1||e.h===e.minH)&&delete e.h}static throttle(e,t){let i=!1;return(...r)=>{i||(i=!0,setTimeout(()=>{e(...r),i=!1},t))}}static removePositioningStyles(e){const t=e.style;t.position&&t.removeProperty("position"),t.left&&t.removeProperty("left"),t.top&&t.removeProperty("top"),t.width&&t.removeProperty("width"),t.height&&t.removeProperty("height")}static getScrollElement(e){if(!e)return document.scrollingElement||document.documentElement;const t=getComputedStyle(e);return/(auto|scroll)/.test(t.overflow+t.overflowY)?e:c.getScrollElement(e.parentElement)}static updateScrollPosition(e,t,i){const r=c.getScrollElement(e);if(!r)return;const o=e.getBoundingClientRect(),n=r.getBoundingClientRect(),a=window.innerHeight||document.documentElement.clientHeight,h=o.bottom-Math.min(n.bottom,a),l=o.top-Math.max(n.top,0),d=r.scrollTop;l<0&&i<0?e.offsetHeight>n.height?r.scrollTop+=i:r.scrollTop+=Math.abs(l)>Math.abs(i)?i:l:h>0&&i>0&&(e.offsetHeight>n.height?r.scrollTop+=i:r.scrollTop+=h>i?i:h),t.top+=r.scrollTop-d}static updateScrollResize(e,t,i){const r=c.getScrollElement(t),o=r.clientHeight,n=r===c.getScrollElement()?0:r.getBoundingClientRect().top,a=e.clientY-n,h=a<i,l=a>o-i;h?r.scrollBy({behavior:"smooth",top:a-i}):l&&r.scrollBy({behavior:"smooth",top:i-(o-a)})}static clone(e){return e==null||typeof e!="object"?e:e instanceof Array?[...e]:{...e}}static cloneDeep(e){const t=["parentGrid","el","grid","subGrid","engine"],i=c.clone(e);for(const r in i)i.hasOwnProperty(r)&&typeof i[r]=="object"&&r.substring(0,2)!=="__"&&!t.find(o=>o===r)&&(i[r]=c.cloneDeep(e[r]));return i}static cloneNode(e){const t=e.cloneNode(!0);return t.removeAttribute("id"),t}static appendTo(e,t){let i;typeof t=="string"?i=c.getElement(t):i=t,i&&i.appendChild(e)}static addElStyles(e,t){if(t instanceof Object)for(const i in t)t.hasOwnProperty(i)&&(Array.isArray(t[i])?t[i].forEach(r=>{e.style[i]=r}):e.style[i]=t[i])}static initEvent(e,t){const i={type:t.type},r={button:0,which:0,buttons:1,bubbles:!0,cancelable:!0,target:t.target?t.target:e.target};return["altKey","ctrlKey","metaKey","shiftKey"].forEach(o=>i[o]=e[o]),["pageX","pageY","clientX","clientY","screenX","screenY"].forEach(o=>i[o]=e[o]),{...i,...r}}static simulateMouseEvent(e,t,i){const r=e,o=new MouseEvent(t,{bubbles:!0,composed:!0,cancelable:!0,view:window,detail:1,screenX:e.screenX,screenY:e.screenY,clientX:e.clientX,clientY:e.clientY,ctrlKey:r.ctrlKey??!1,altKey:r.altKey??!1,shiftKey:r.shiftKey??!1,metaKey:r.metaKey??!1,button:0,relatedTarget:e.target});(i||e.target).dispatchEvent(o)}static getValuesFromTransformedElement(e){const t=document.createElement("div");c.addElStyles(t,{opacity:"0",position:"fixed",top:"0px",left:"0px",width:"1px",height:"1px",zIndex:"-999999"}),e.appendChild(t);const i=t.getBoundingClientRect();return e.removeChild(t),t.remove(),{xScale:1/i.width,yScale:1/i.height,xOffset:i.left,yOffset:i.top}}static swap(e,t,i){if(!e)return;const r=e[t];e[t]=e[i],e[i]=r}static canBeRotated(e){return!(!e||e.w===e.h||e.locked||e.noResize||e.grid?.opts.disableResize||e.minW&&e.minW===e.maxW||e.minH&&e.minH===e.maxH)}}class K{constructor(e={}){this.addedNodes=[],this.removedNodes=[],this.defaultColumn=12,this.column=e.column||this.defaultColumn,this.column>this.defaultColumn&&(this.defaultColumn=this.column),this.maxRow=e.maxRow,this._float=e.float,this.nodes=e.nodes||[],this.onChange=e.onChange}batchUpdate(e=!0,t=!0){return!!this.batchMode===e?this:(this.batchMode=e,e?(this._prevFloat=this._float,this._float=!0,this.cleanNodes(),this.saveInitial()):(this._float=this._prevFloat,delete this._prevFloat,t&&this._packNodes(),this._notify()),this)}_useEntireRowArea(e,t){return(!this.float||this.batchMode&&!this._prevFloat)&&!this._hasLocked&&(!e._moving||e._skipDown||t.y<=e.y)}_fixCollisions(e,t=e,i,r={}){if(this.sortNodes(-1),i=i||this.collide(e,t),!i)return!1;if(e._moving&&!r.nested&&!this.float&&this.swap(e,i))return!0;let o=t;!this._loading&&this._useEntireRowArea(e,t)&&(o={x:0,w:this.column,y:t.y,h:t.h},i=this.collide(e,o,r.skip));let n=!1;const a={nested:!0,pack:!1};let h=0;for(;i=i||this.collide(e,o,r.skip);){if(h++>this.nodes.length*2)throw new Error("Infinite collide check");let l;if(i.locked||this._loading||e._moving&&!e._skipDown&&t.y>e.y&&!this.float&&(!this.collide(i,{...i,y:e.y},e)||!this.collide(i,{...i,y:t.y-i.h},e))){e._skipDown=e._skipDown||t.y>e.y;const d={...t,y:i.y+i.h,...a};l=this._loading&&c.samePos(e,d)?!0:this.moveNode(e,d),(i.locked||this._loading)&&l?c.copyPos(t,e):!i.locked&&l&&r.pack&&(this._packNodes(),t.y=i.y+i.h,c.copyPos(e,t)),n=n||l}else l=this.moveNode(i,{...i,y:t.y+t.h,skip:e,...a});if(!l)return n;i=void 0}return n}collide(e,t=e,i){const r=e._id,o=i?._id;return this.nodes.find(n=>n._id!==r&&n._id!==o&&c.isIntercepted(n,t))}collideAll(e,t=e,i){const r=e._id,o=i?._id;return this.nodes.filter(n=>n._id!==r&&n._id!==o&&c.isIntercepted(n,t))}directionCollideCoverage(e,t,i){if(!t.rect||!e._rect)return;const r=e._rect,o={...t.rect};o.y>r.y?(o.h+=o.y-r.y,o.y=r.y):o.h+=r.y-o.y,o.x>r.x?(o.w+=o.x-r.x,o.x=r.x):o.w+=r.x-o.x;let n,a=.5;for(let h of i){if(h.locked||!h._rect)break;const l=h._rect;let d=Number.MAX_VALUE,u=Number.MAX_VALUE;r.y<l.y?d=(o.y+o.h-l.y)/l.h:r.y+r.h>l.y+l.h&&(d=(l.y+l.h-o.y)/l.h),r.x<l.x?u=(o.x+o.w-l.x)/l.w:r.x+r.w>l.x+l.w&&(u=(l.x+l.w-o.x)/l.w);const p=Math.min(u,d);p>a&&(a=p,n=h)}return t.collide=n,n}cacheRects(e,t,i,r,o,n){return this.nodes.forEach(a=>a._rect={y:a.y*t+i,x:a.x*e+n,w:a.w*e-n-r,h:a.h*t-i-o}),this}swap(e,t){if(!t||t.locked||!e||e.locked)return!1;function i(){const o=t.x,n=t.y;return t.x=e.x,t.y=e.y,e.h!=t.h?(e.x=o,e.y=t.y+t.h):e.w!=t.w?(e.x=t.x+t.w,e.y=n):(e.x=o,e.y=n),e._dirty=t._dirty=!0,!0}let r;if(e.w===t.w&&e.h===t.h&&(e.x===t.x||e.y===t.y)&&(r=c.isTouching(e,t)))return i();if(r!==!1){if(e.w===t.w&&e.x===t.x&&(r||(r=c.isTouching(e,t)))){if(t.y<e.y){const o=e;e=t,t=o}return i()}if(r!==!1){if(e.h===t.h&&e.y===t.y&&(r||(r=c.isTouching(e,t)))){if(t.x<e.x){const o=e;e=t,t=o}return i()}return!1}}}isAreaEmpty(e,t,i,r){const o={x:e||0,y:t||0,w:i||1,h:r||1};return!this.collide(o)}compact(e="compact",t=!0){if(this.nodes.length===0)return this;t&&this.sortNodes();const i=this.batchMode;i||this.batchUpdate();const r=this._inColumnResize;r||(this._inColumnResize=!0);const o=this.nodes;return this.nodes=[],o.forEach((n,a,h)=>{let l;n.locked||(n.autoPosition=!0,e==="list"&&a&&(l=h[a-1])),this.addNode(n,!1,l)}),r||delete this._inColumnResize,i||this.batchUpdate(!1),this}set float(e){this._float!==e&&(this._float=e||!1,e||this._packNodes()._notify())}get float(){return this._float||!1}sortNodes(e=1){return this.nodes=c.sort(this.nodes,e),this}_packNodes(){return this.batchMode?this:(this.sortNodes(),this.float?this.nodes.forEach(e=>{if(e._updating||e._orig===void 0||e.y===e._orig.y)return;let t=e.y;for(;t>e._orig.y;)--t,this.collide(e,{x:e.x,y:t,w:e.w,h:e.h})||(e._dirty=!0,e.y=t)}):this.nodes.forEach((e,t)=>{if(!e.locked)for(;e.y>0;){const i=t===0?0:e.y-1;if(!(t===0||!this.collide(e,{x:e.x,y:i,w:e.w,h:e.h})))break;e._dirty=e.y!==i,e.y=i}}),this)}prepareNode(e,t){e._id=e._id??K._idSeq++;const i=e.id;if(i){let o=1;for(;this.nodes.find(n=>n.id===e.id&&n!==e);)e.id=i+"_"+o++}(e.x===void 0||e.y===void 0||e.x===null||e.y===null)&&(e.autoPosition=!0);const r={x:0,y:0,w:1,h:1};return c.defaults(e,r),e.autoPosition||delete e.autoPosition,e.noResize||delete e.noResize,e.noMove||delete e.noMove,c.sanitizeMinMax(e),typeof e.x=="string"&&(e.x=Number(e.x)),typeof e.y=="string"&&(e.y=Number(e.y)),typeof e.w=="string"&&(e.w=Number(e.w)),typeof e.h=="string"&&(e.h=Number(e.h)),isNaN(e.x)&&(e.x=r.x,e.autoPosition=!0),isNaN(e.y)&&(e.y=r.y,e.autoPosition=!0),isNaN(e.w)&&(e.w=r.w),isNaN(e.h)&&(e.h=r.h),this.nodeBoundFix(e,t),e}nodeBoundFix(e,t){const i=e._orig||c.copyPos({},e);if(e.maxW&&(e.w=Math.min(e.w||1,e.maxW)),e.maxH&&(e.h=Math.min(e.h||1,e.maxH)),e.minW&&(e.w=Math.max(e.w||1,e.minW)),e.minH&&(e.h=Math.max(e.h||1,e.minH)),(e.x||0)+(e.w||1)>this.column&&this.column<this.defaultColumn&&!this._inColumnResize&&!this.skipCacheUpdate&&e._id!=null&&this.findCacheLayout(e,this.defaultColumn)===-1){const o={...e};o.autoPosition||o.x===void 0?(delete o.x,delete o.y):o.x=Math.min(this.defaultColumn-1,o.x),o.w=Math.min(this.defaultColumn,o.w||1),this.cacheOneLayout(o,this.defaultColumn)}return e.w>this.column?e.w=this.column:e.w<1&&(e.w=1),this.maxRow&&e.h>this.maxRow?e.h=this.maxRow:e.h<1&&(e.h=1),e.x<0&&(e.x=0),e.y<0&&(e.y=0),e.x+e.w>this.column&&(t?e.w=this.column-e.x:e.x=this.column-e.w),this.maxRow&&e.y+e.h>this.maxRow&&(t?e.h=this.maxRow-e.y:e.y=this.maxRow-e.h),c.samePos(e,i)||(e._dirty=!0),this}getDirtyNodes(e){return e?this.nodes.filter(t=>t._dirty&&!c.samePos(t,t._orig)):this.nodes.filter(t=>t._dirty)}_notify(e){if(this.batchMode||!this.onChange)return this;const t=(e||[]).concat(this.getDirtyNodes());return this.onChange(t),this}cleanNodes(){return this.batchMode?this:(this.nodes.forEach(e=>{delete e._dirty,delete e._lastTried}),this)}saveInitial(){return this.nodes.forEach(e=>{e._orig=c.copyPos({},e),delete e._dirty}),this._hasLocked=this.nodes.some(e=>e.locked),this}restoreInitial(){return this.nodes.forEach(e=>{!e._orig||c.samePos(e,e._orig)||(c.copyPos(e,e._orig),e._dirty=!0)}),this._notify(),this}findEmptyPosition(e,t=this.nodes,i=this.column,r){const o=r?r.y*i+(r.x+r.w):0;let n=!1;for(let a=o;!n;++a){const h=a%i,l=Math.floor(a/i);if(h+e.w>i)continue;const d={x:h,y:l,w:e.w,h:e.h};t.find(u=>c.isIntercepted(d,u))||((e.x!==h||e.y!==l)&&(e._dirty=!0),e.x=h,e.y=l,delete e.autoPosition,n=!0)}return n}addNode(e,t=!1,i){const r=this.nodes.find(n=>n._id===e._id);if(r)return r;this._inColumnResize?this.nodeBoundFix(e):this.prepareNode(e),delete e._temporaryRemoved,delete e._removeDOM;let o;return e.autoPosition&&this.findEmptyPosition(e,this.nodes,this.column,i)&&(delete e.autoPosition,o=!0),this.nodes.push(e),t&&this.addedNodes.push(e),o||this._fixCollisions(e),this.batchMode||this._packNodes()._notify(),e}removeNode(e,t=!0,i=!1){return this.nodes.find(r=>r._id===e._id)?(i&&this.removedNodes.push(e),t&&(e._removeDOM=!0),this.nodes=this.nodes.filter(r=>r._id!==e._id),e._isAboutToRemove||this._packNodes(),this._notify([e]),this):this}removeAll(e=!0,t=!0){if(delete this._layouts,!this.nodes.length)return this;e&&this.nodes.forEach(r=>r._removeDOM=!0);const i=this.nodes;return this.removedNodes=t?i:[],this.nodes=[],this._notify(i)}moveNodeCheck(e,t){if(!this.changedPosConstrain(e,t))return!1;if(t.pack=!0,!this.maxRow)return this.moveNode(e,t);let i;const r=new K({column:this.column,float:this.float,nodes:this.nodes.map(n=>n._id===e._id?(i={...n},i):{...n})});if(!i)return!1;const o=r.moveNode(i,t)&&r.getRow()<=Math.max(this.getRow(),this.maxRow);if(!o&&!t.resizing&&t.collide){const n=t.collide.el.gridstackNode;if(this.swap(e,n))return this._notify(),!0}return o?(r.nodes.filter(n=>n._dirty).forEach(n=>{const a=this.nodes.find(h=>h._id===n._id);a&&(c.copyPos(a,n),a._dirty=!0)}),this._notify(),!0):!1}willItFit(e){if(delete e._willFitPos,!this.maxRow)return!0;const t=new K({column:this.column,float:this.float,nodes:this.nodes.map(r=>({...r}))}),i={...e};return this.cleanupNode(i),delete i.el,delete i._id,delete i.content,delete i.grid,t.addNode(i),t.getRow()<=this.maxRow?(e._willFitPos=c.copyPos({},i),!0):!1}changedPosConstrain(e,t){return t.w=t.w||e.w,t.h=t.h||e.h,e.x!==t.x||e.y!==t.y?!0:(e.maxW&&(t.w=Math.min(t.w,e.maxW)),e.maxH&&(t.h=Math.min(t.h,e.maxH)),e.minW&&(t.w=Math.max(t.w,e.minW)),e.minH&&(t.h=Math.max(t.h,e.minH)),e.w!==t.w||e.h!==t.h)}moveNode(e,t){if(!e||!t)return!1;let i;t.pack===void 0&&!this.batchMode&&(i=t.pack=!0),typeof t.x!="number"&&(t.x=e.x),typeof t.y!="number"&&(t.y=e.y),typeof t.w!="number"&&(t.w=e.w),typeof t.h!="number"&&(t.h=e.h);const r=e.w!==t.w||e.h!==t.h,o=c.copyPos({},e,!0);if(c.copyPos(o,t),this.nodeBoundFix(o,r),c.copyPos(t,o),!t.forceCollide&&c.samePos(e,t))return!1;const n=c.copyPos({},e),a=this.collideAll(e,o,t.skip);let h=!0;if(a.length){const l=e._moving&&!t.nested;let d=l?this.directionCollideCoverage(e,t,a):a[0];if(l&&d&&e.grid?.opts?.subGridDynamic&&!e.grid._isTemp){const u=c.areaIntercept(t.rect,d._rect),p=c.area(t.rect),f=c.area(d._rect);u/(p<f?p:f)>.8&&(d.grid.makeSubGrid(d.el,void 0,e),d=void 0)}d?h=!this._fixCollisions(e,o,d,t):(h=!1,i&&delete t.pack)}return h&&!c.samePos(e,o)&&(e._dirty=!0,c.copyPos(e,o)),t.pack&&this._packNodes()._notify(),!c.samePos(e,n)}getRow(){return this.nodes.reduce((e,t)=>Math.max(e,t.y+t.h),0)}beginUpdate(e){return e._updating||(e._updating=!0,delete e._skipDown,this.batchMode||this.saveInitial()),this}endUpdate(){const e=this.nodes.find(t=>t._updating);return e&&(delete e._updating,delete e._skipDown),this}save(e=!0,t,i){const r=this._layouts?.length||0;let o;r&&(i?i!==this.column&&(o=this._layouts[i]):this.column!==r-1&&(o=this._layouts[r-1]));const n=[];return this.sortNodes(),this.nodes.forEach(a=>{const h=o?.find(d=>d._id===a._id),l={...a,...h||{}};c.removeInternalForSave(l,!e),t&&t(a,l),n.push(l)}),n}layoutsNodesChange(e){return!this._layouts||this._inColumnResize?this:(this._layouts.forEach((t,i)=>{if(!t||i===this.column)return this;if(i<this.column)this._layouts[i]=void 0;else{const r=i/this.column;e.forEach(o=>{if(!o._orig)return;const n=t.find(a=>a._id===o._id);n&&(n.y>=0&&o.y!==o._orig.y&&(n.y+=o.y-o._orig.y),o.x!==o._orig.x&&(n.x=Math.round(o.x*r)),o.w!==o._orig.w&&(n.w=Math.round(o.w*r)))})}}),this)}columnChanged(e,t,i="moveScale"){if(!this.nodes.length||!t||e===t)return this;const r=i==="compact"||i==="list";r&&this.sortNodes(1),t<e&&this.cacheLayout(this.nodes,e),this.batchUpdate();let o=[],n=r?this.nodes:c.sort(this.nodes,-1);if(t>e&&this._layouts){const a=this._layouts[t]||[],h=this._layouts.length-1;!a.length&&e!==h&&this._layouts[h]?.length&&(e=h,this._layouts[h].forEach(l=>{const d=n.find(u=>u._id===l._id);d&&(!r&&!l.autoPosition&&(d.x=l.x??d.x,d.y=l.y??d.y),d.w=l.w??d.w,(l.x==null||l.y===void 0)&&(d.autoPosition=!0))})),a.forEach(l=>{const d=n.findIndex(u=>u._id===l._id);if(d!==-1){const u=n[d];if(r){u.w=l.w;return}(l.autoPosition||isNaN(l.x)||isNaN(l.y))&&this.findEmptyPosition(l,o),l.autoPosition||(u.x=l.x??u.x,u.y=l.y??u.y,u.w=l.w??u.w,o.push(u)),n.splice(d,1)}})}if(r)this.compact(i,!1);else{if(n.length)if(typeof i=="function")i(t,e,o,n);else{const a=r||i==="none"?1:t/e,h=i==="move"||i==="moveScale",l=i==="scale"||i==="moveScale";n.forEach(d=>{d.x=t===1?0:h?Math.round(d.x*a):Math.min(d.x,t-1),d.w=t===1||e===1?1:l?Math.round(d.w*a)||1:Math.min(d.w,t),o.push(d)}),n=[]}o=c.sort(o,-1),this._inColumnResize=!0,this.nodes=[],o.forEach(a=>{this.addNode(a,!1),delete a._orig})}return this.nodes.forEach(a=>delete a._orig),this.batchUpdate(!1,!r),delete this._inColumnResize,this}cacheLayout(e,t,i=!1){const r=[];return e.forEach((o,n)=>{if(o._id===void 0){const a=o.id?this.nodes.find(h=>h.id===o.id):void 0;o._id=a?._id??K._idSeq++}r[n]={x:o.x,y:o.y,w:o.w,_id:o._id}}),this._layouts=i?[]:this._layouts||[],this._layouts[t]=r,this}cacheOneLayout(e,t){e._id=e._id??K._idSeq++;const i={x:e.x,y:e.y,w:e.w,_id:e._id};(e.autoPosition||e.x===void 0)&&(delete i.x,delete i.y,e.autoPosition&&(i.autoPosition=!0)),this._layouts=this._layouts||[],this._layouts[t]=this._layouts[t]||[];const r=this.findCacheLayout(e,t);return r===-1?this._layouts[t].push(i):this._layouts[t][r]=i,this}findCacheLayout(e,t){return this._layouts?.[t]?.findIndex(i=>i._id===e._id)??-1}removeNodeFromLayoutCache(e){if(this._layouts)for(let t=0;t<this._layouts.length;t++){const i=this.findCacheLayout(e,t);i!==-1&&this._layouts[t].splice(i,1)}}cleanupNode(e){for(const t in e)t[0]==="_"&&t!=="_id"&&delete e[t];return this}}K._idSeq=0;const L={alwaysShowResizeHandle:"mobile",animate:!0,auto:!0,cellHeight:"auto",cellHeightThrottle:100,cellHeightUnit:"px",column:12,draggable:{handle:".grid-stack-item-content",appendTo:"body",scroll:!0},handle:".grid-stack-item-content",itemClass:"grid-stack-item",margin:10,marginUnit:"px",maxRow:0,minRow:0,placeholderClass:"grid-stack-placeholder",placeholderText:"",removableOptions:{accept:"grid-stack-item",decline:"grid-stack-non-removable"},resizable:{handles:"se"},rtl:"auto"};class w{}const W=typeof window<"u"&&typeof document<"u"&&("ontouchstart"in document||"ontouchstart"in window||window.DocumentTouch&&document instanceof window.DocumentTouch||navigator.maxTouchPoints>0||navigator.msMaxTouchPoints>0);class F{}function He(s,e){s.touches.length>1||(s.cancelable&&s.preventDefault(),c.simulateMouseEvent(s.changedTouches[0],e))}function li(s,e){s.cancelable&&s.preventDefault(),c.simulateMouseEvent(s,e)}function Ne(s){F.touchHandled||(F.touchHandled=!0,He(s,"mousedown"))}function Oe(s){F.touchHandled&&He(s,"mousemove")}function Pe(s){if(!F.touchHandled)return;F.pointerLeaveTimeout&&(window.clearTimeout(F.pointerLeaveTimeout),delete F.pointerLeaveTimeout);const e=!!w.dragElement;He(s,"mouseup"),e||He(s,"click"),F.touchHandled=!1}function We(s){s.pointerType!=="mouse"&&s.target.releasePointerCapture(s.pointerId)}function Gt(s){w.dragElement&&s.pointerType!=="mouse"&&li(s,"mouseenter")}function qt(s){w.dragElement&&s.pointerType!=="mouse"&&(F.pointerLeaveTimeout=window.setTimeout(()=>{delete F.pointerLeaveTimeout,li(s,"mouseleave")},10))}class Ge{constructor(e,t,i){this.host=e,this.dir=t,this.option=i,this.moving=!1,this._mouseDown=this._mouseDown.bind(this),this._mouseMove=this._mouseMove.bind(this),this._mouseUp=this._mouseUp.bind(this),this._keyEvent=this._keyEvent.bind(this),this._init()}_init(){const e=this.el=document.createElement("div");return e.classList.add("ui-resizable-handle"),e.classList.add(`${Ge.prefix}${this.dir}`),e.style.zIndex="100",e.style.userSelect="none",this.host.appendChild(this.el),this.el.addEventListener("mousedown",this._mouseDown),W&&(this.el.addEventListener("touchstart",Ne),this.el.addEventListener("pointerdown",We)),this}destroy(){return this.moving&&this._mouseUp(this.mouseDownEvent),this.el.removeEventListener("mousedown",this._mouseDown),W&&(this.el.removeEventListener("touchstart",Ne),this.el.removeEventListener("pointerdown",We)),this.host.removeChild(this.el),delete this.el,delete this.host,this}_mouseDown(e){this.mouseDownEvent=e,document.addEventListener("mousemove",this._mouseMove,{capture:!0,passive:!0}),document.addEventListener("mouseup",this._mouseUp,!0),W&&(this.el.addEventListener("touchmove",Oe),this.el.addEventListener("touchend",Pe)),e.stopPropagation(),e.preventDefault()}_mouseMove(e){const t=this.mouseDownEvent;this.moving?this._triggerEvent("move",e):Math.abs(e.x-t.x)+Math.abs(e.y-t.y)>2&&(this.moving=!0,this._triggerEvent("start",this.mouseDownEvent),this._triggerEvent("move",e),document.addEventListener("keydown",this._keyEvent)),e.stopPropagation()}_mouseUp(e){this.moving&&(this._triggerEvent("stop",e),document.removeEventListener("keydown",this._keyEvent)),document.removeEventListener("mousemove",this._mouseMove,!0),document.removeEventListener("mouseup",this._mouseUp,!0),W&&(this.el.removeEventListener("touchmove",Oe),this.el.removeEventListener("touchend",Pe)),delete this.moving,delete this.mouseDownEvent,e.stopPropagation(),e.preventDefault()}_keyEvent(e){e.key==="Escape"&&(this.host.gridstackNode?.grid?.engine.restoreInitial(),this._mouseUp(this.mouseDownEvent))}_triggerEvent(e,t){return this.option[e]&&this.option[e](t),this}}Ge.prefix="ui-resizable-";class mt{constructor(){this._eventRegister={}}get disabled(){return this._disabled}on(e,t){this._eventRegister[e]=t}off(e){delete this._eventRegister[e]}enable(){this._disabled=!1}disable(){this._disabled=!0}destroy(){delete this._eventRegister}triggerEvent(e,t){if(!this.disabled&&this._eventRegister&&this._eventRegister[e])return this._eventRegister[e](t)}}class Se extends mt{constructor(e,t={}){super(),this.el=e,this.option=t,this.rectScale={x:1,y:1},this._ui=()=>{const r=this.el.parentElement.getBoundingClientRect(),o={width:this.originalRect.width,height:this.originalRect.height+this.scrolled,left:this.originalRect.left,top:this.originalRect.top-this.scrolled},n=this.temporalRect||o;return{position:{left:(n.left-r.left)*this.rectScale.x,top:(n.top-r.top)*this.rectScale.y},size:{width:n.width*this.rectScale.x,height:n.height*this.rectScale.y}}},this._mouseOver=this._mouseOver.bind(this),this._mouseOut=this._mouseOut.bind(this),this.enable(),this._setupAutoHide(this.option.autoHide),this._setupHandlers()}on(e,t){super.on(e,t)}off(e){super.off(e)}enable(){super.enable(),this.el.classList.remove("ui-resizable-disabled"),this._setupAutoHide(this.option.autoHide)}disable(){super.disable(),this.el.classList.add("ui-resizable-disabled"),this._setupAutoHide(!1)}destroy(){this._removeHandlers(),this._setupAutoHide(!1),delete this.el,super.destroy()}updateOption(e){const t=e.handles&&e.handles!==this.option.handles,i=e.autoHide&&e.autoHide!==this.option.autoHide;return Object.keys(e).forEach(r=>this.option[r]=e[r]),t&&(this._removeHandlers(),this._setupHandlers()),i&&this._setupAutoHide(this.option.autoHide),this}_setupAutoHide(e){return e?(this.el.classList.add("ui-resizable-autohide"),this.el.addEventListener("mouseover",this._mouseOver),this.el.addEventListener("mouseout",this._mouseOut)):(this.el.classList.remove("ui-resizable-autohide"),this.el.removeEventListener("mouseover",this._mouseOver),this.el.removeEventListener("mouseout",this._mouseOut),w.overResizeElement===this&&delete w.overResizeElement),this}_mouseOver(e){w.overResizeElement||w.dragElement||(w.overResizeElement=this,this.el.classList.remove("ui-resizable-autohide"))}_mouseOut(e){w.overResizeElement===this&&(delete w.overResizeElement,this.el.classList.add("ui-resizable-autohide"))}_setupHandlers(){return this.handlers=this.option.handles.split(",").map(e=>e.trim()).map(e=>new Ge(this.el,e,{start:t=>{this._resizeStart(t)},stop:t=>{this._resizeStop(t)},move:t=>{this._resizing(t,e)}})),this}_resizeStart(e){this.sizeToContent=c.shouldSizeToContent(this.el.gridstackNode,!0),this.originalRect=this.el.getBoundingClientRect(),this.scrollEl=c.getScrollElement(this.el),this.scrollY=this.scrollEl.scrollTop,this.scrolled=0,this.startEvent=e,this._setupHelper(),this._applyChange();const t=c.initEvent(e,{type:"resizestart",target:this.el});return this.option.start&&this.option.start(t,this._ui()),this.el.classList.add("ui-resizable-resizing"),this.triggerEvent("resizestart",t),this}_resizing(e,t){this.scrolled=this.scrollEl.scrollTop-this.scrollY,this.temporalRect=this._getChange(e,t),this._applyChange();const i=c.initEvent(e,{type:"resize",target:this.el});return this.option.resize&&this.option.resize(i,this._ui()),this.triggerEvent("resize",i),this}_resizeStop(e){const t=c.initEvent(e,{type:"resizestop",target:this.el});return this._cleanHelper(),this.option.stop&&this.option.stop(t),this.el.classList.remove("ui-resizable-resizing"),this.triggerEvent("resizestop",t),delete this.startEvent,delete this.originalRect,delete this.temporalRect,delete this.scrollY,delete this.scrolled,this}_setupHelper(){this.elOriginStyleVal=Se._originStyleProp.map(i=>this.el.style[i]),this.parentOriginStylePosition=this.el.parentElement.style.position;const e=this.el.parentElement,t=c.getValuesFromTransformedElement(e);return this.rectScale={x:t.xScale,y:t.yScale},getComputedStyle(this.el.parentElement).position.match(/static/)&&(this.el.parentElement.style.position="relative"),this.el.style.position="absolute",this.el.style.opacity="0.8",this}_cleanHelper(){return Se._originStyleProp.forEach((e,t)=>{this.el.style[e]=this.elOriginStyleVal[t]||null}),this.el.parentElement.style.position=this.parentOriginStylePosition||null,this}_getChange(e,t){const i=this.startEvent,r={width:this.originalRect.width,height:this.originalRect.height+this.scrolled,left:this.originalRect.left,top:this.originalRect.top-this.scrolled},o=e.clientX-i.clientX,n=this.sizeToContent?0:e.clientY-i.clientY;let a,h;t.indexOf("e")>-1?r.width+=o:t.indexOf("w")>-1&&(r.width-=o,r.left+=o,a=!0),t.indexOf("s")>-1?r.height+=n:t.indexOf("n")>-1&&(r.height-=n,r.top+=n,h=!0);const l=this._constrainSize(r.width,r.height,a,h);return Math.round(r.width)!==Math.round(l.width)&&(t.indexOf("w")>-1&&(r.left+=r.width-l.width),r.width=l.width),Math.round(r.height)!==Math.round(l.height)&&(t.indexOf("n")>-1&&(r.top+=r.height-l.height),r.height=l.height),r}_constrainSize(e,t,i,r){const o=this.option,n=(i?o.maxWidthMoveLeft:o.maxWidth)||Number.MAX_SAFE_INTEGER,a=o.minWidth/this.rectScale.x||e,h=(r?o.maxHeightMoveUp:o.maxHeight)||Number.MAX_SAFE_INTEGER,l=o.minHeight/this.rectScale.y||t,d=Math.min(n,Math.max(a,e)),u=Math.min(h,Math.max(l,t));return{width:d,height:u}}_applyChange(){let e={left:0,top:0,width:0,height:0};if(this.el.style.position==="absolute"){const t=this.el.parentElement,{left:i,top:r}=t.getBoundingClientRect();e={left:i,top:r,width:0,height:0}}return this.temporalRect?(Object.keys(this.temporalRect).forEach(t=>{const i=this.temporalRect[t],r=t==="width"||t==="left"?this.rectScale.x:t==="height"||t==="top"?this.rectScale.y:1;this.el.style[t]=(i-e[t])*r+"px"}),this):this}_removeHandlers(){return this.handlers.forEach(e=>e.destroy()),delete this.handlers,this}}Se._originStyleProp=["width","height","position","left","top","opacity","zIndex"];const Bs='input,textarea,button,select,option,[contenteditable="true"],.ui-resizable-handle';class Re extends mt{constructor(e,t={}){super(),this.el=e,this.option=t,this.dragTransform={xScale:1,yScale:1,xOffset:0,yOffset:0};const i=t?.handle?.substring(1),r=e.gridstackNode;this.dragEls=!i||e.classList.contains(i)?[e]:r?.subGrid?[e.querySelector(t.handle)||e]:Array.from(e.querySelectorAll(t.handle)),this.dragEls.length===0&&(this.dragEls=[e]),this._mouseDown=this._mouseDown.bind(this),this._mouseMove=this._mouseMove.bind(this),this._mouseUp=this._mouseUp.bind(this),this._keyEvent=this._keyEvent.bind(this),this.enable()}on(e,t){super.on(e,t)}off(e){super.off(e)}enable(){this.disabled!==!1&&(super.enable(),this.dragEls.forEach(e=>{e.addEventListener("mousedown",this._mouseDown),W&&(e.addEventListener("touchstart",Ne),e.addEventListener("pointerdown",We))}),this.el.classList.remove("ui-draggable-disabled"))}disable(e=!1){this.disabled!==!0&&(super.disable(),this.dragEls.forEach(t=>{t.removeEventListener("mousedown",this._mouseDown),W&&(t.removeEventListener("touchstart",Ne),t.removeEventListener("pointerdown",We))}),e||this.el.classList.add("ui-draggable-disabled"))}destroy(){this.dragTimeout&&window.clearTimeout(this.dragTimeout),delete this.dragTimeout,this.mouseDownEvent&&this._mouseUp(this.mouseDownEvent),this.disable(!0),delete this.el,delete this.helper,delete this.option,super.destroy()}updateOption(e){return Object.keys(e).forEach(t=>this.option[t]=e[t]),this}_mouseDown(e){if(!w.mouseHandled)return e.button!==0||!this.dragEls.find(t=>t===e.target)&&e.target.closest(Bs)||this.option.cancel&&e.target.closest(this.option.cancel)||(this.mouseDownEvent=e,delete this.dragging,delete w.dragElement,delete w.dropElement,document.addEventListener("mousemove",this._mouseMove,{capture:!0,passive:!0}),document.addEventListener("mouseup",this._mouseUp,!0),W&&(e.currentTarget.addEventListener("touchmove",Oe),e.currentTarget.addEventListener("touchend",Pe)),e.preventDefault(),document.activeElement&&document.activeElement.blur(),w.mouseHandled=!0),!0}_callDrag(e){if(!this.dragging)return;const t=c.initEvent(e,{target:this.el,type:"drag"});this.option.drag&&this.option.drag(t,this.ui()),this.triggerEvent("drag",t)}_mouseMove(e){const t=this.mouseDownEvent;if(this.lastDrag=e,this.dragging)if(this._dragFollow(e),w.pauseDrag){const i=Number.isInteger(w.pauseDrag)?w.pauseDrag:100;this.dragTimeout&&window.clearTimeout(this.dragTimeout),this.dragTimeout=window.setTimeout(()=>this._callDrag(e),i)}else this._callDrag(e);else if(Math.abs(e.x-t.x)+Math.abs(e.y-t.y)>3){this.dragging=!0,w.dragElement=this;const i=this.el.gridstackNode?.grid;i?w.dropElement=i.el.ddElement.ddDroppable:delete w.dropElement,this.helper=this._createHelper(),this._setupHelperContainmentStyle(),this.dragTransform=c.getValuesFromTransformedElement(this.helperContainment),this.dragOffset=this._getDragOffset(e,this.el,this.helperContainment),this._setupHelperStyle(e);const r=c.initEvent(e,{target:this.el,type:"dragstart"});this.option.start&&this.option.start(r,this.ui()),this.triggerEvent("dragstart",r),document.addEventListener("keydown",this._keyEvent)}return!0}_mouseUp(e){if(document.removeEventListener("mousemove",this._mouseMove,!0),document.removeEventListener("mouseup",this._mouseUp,!0),W&&e.currentTarget&&(e.currentTarget.removeEventListener("touchmove",Oe,!0),e.currentTarget.removeEventListener("touchend",Pe,!0)),this.dragging){delete this.dragging,delete this.el.gridstackNode?._origRotate,document.removeEventListener("keydown",this._keyEvent),w.dropElement?.el===this.el.parentElement&&delete w.dropElement,this.helperContainment.style.position=this.parentOriginStylePosition||null,this.helper!==this.el&&this.helper.remove(),this._removeHelperStyle();const t=c.initEvent(e,{target:this.el,type:"dragstop"});this.option.stop&&this.option.stop(t),this.triggerEvent("dragstop",t),w.dropElement&&w.dropElement.drop(e)}delete this.helper,delete this.mouseDownEvent,delete w.dragElement,delete w.dropElement,delete w.mouseHandled,e.preventDefault()}_keyEvent(e){const t=this.el.gridstackNode,i=t?.grid||w.dropElement?.el?.gridstack;if(e.key==="Escape")t&&t._origRotate&&(t._orig=t._origRotate,delete t._origRotate),i?.cancelDrag(),this._mouseUp(this.mouseDownEvent);else if(t&&i&&(e.key==="r"||e.key==="R")){if(!c.canBeRotated(t))return;t._origRotate=t._origRotate||{...t._orig},delete t._moving,i.setAnimation(!1).rotate(t.el,{top:-this.dragOffset.offsetTop,left:-this.dragOffset.offsetLeft}).setAnimation(),t._moving=!0,this.dragOffset=this._getDragOffset(this.lastDrag,t.el,this.helperContainment),this.helper.style.width=this.dragOffset.width+"px",this.helper.style.height=this.dragOffset.height+"px",c.swap(t._orig,"w","h"),delete t._rect,this._mouseMove(this.lastDrag)}}_createHelper(){let e=this.el;return typeof this.option.helper=="function"?e=this.option.helper(this.el):this.option.helper==="clone"&&(e=c.cloneNode(this.el)),e.parentElement||c.appendTo(e,this.option.appendTo==="parent"?this.el.parentElement:this.option.appendTo),this.dragElementOriginStyle=Re.originStyleProp.map(t=>this.el.style[t]),e}_setupHelperStyle(e){this.helper.classList.add("ui-draggable-dragging"),this.el.gridstackNode?.grid?.el.classList.add("grid-stack-dragging");const t=this.helper.style;return t.pointerEvents="none",t.width=this.dragOffset.width+"px",t.height=this.dragOffset.height+"px",t.willChange="left, top",t.position="fixed",this._dragFollow(e),t.transition="none",setTimeout(()=>{this.helper&&(t.transition=null)},0),this}_removeHelperStyle(){if(this.helper.classList.remove("ui-draggable-dragging"),this.el.gridstackNode?.grid?.el.classList.remove("grid-stack-dragging"),!this.helper?.gridstackNode?._isAboutToRemove&&this.dragElementOriginStyle){const t=this.helper,i=this.dragElementOriginStyle.transition||null;t.style.transition=this.dragElementOriginStyle.transition="none",Re.originStyleProp.forEach(r=>t.style[r]=this.dragElementOriginStyle[r]||null),setTimeout(()=>t.style.transition=i,50)}return delete this.dragElementOriginStyle,this}_dragFollow(e){const t={left:0,top:0},i=this.helper.style,r=this.dragOffset;i.left=(e.clientX+r.offsetLeft-t.left)*this.dragTransform.xScale+"px",i.top=(e.clientY+r.offsetTop-t.top)*this.dragTransform.yScale+"px"}_setupHelperContainmentStyle(){return this.helperContainment=this.helper.parentElement,this.helper.style.position!=="fixed"&&(this.parentOriginStylePosition=this.helperContainment.style.position,getComputedStyle(this.helperContainment).position.match(/static/)&&(this.helperContainment.style.position="relative")),this}_getDragOffset(e,t,i){let r=0,o=0;i&&(r=this.dragTransform.xOffset,o=this.dragTransform.yOffset);const n=t.getBoundingClientRect();return{left:n.left,top:n.top,offsetLeft:-e.clientX+n.left-r,offsetTop:-e.clientY+n.top-o,width:n.width*this.dragTransform.xScale,height:n.height*this.dragTransform.yScale}}ui(){const t=this.el.parentElement.getBoundingClientRect(),i=this.helper.getBoundingClientRect();return{position:{top:(i.top-t.top)*this.dragTransform.yScale,left:(i.left-t.left)*this.dragTransform.xScale}}}}Re.originStyleProp=["width","height","transform","transform-origin","transition","pointerEvents","position","left","top","minWidth","willChange"];class Us extends mt{constructor(e,t={}){super(),this.el=e,this.option=t,this._mouseEnter=this._mouseEnter.bind(this),this._mouseLeave=this._mouseLeave.bind(this),this.enable(),this._setupAccept()}on(e,t){super.on(e,t)}off(e){super.off(e)}enable(){this.disabled!==!1&&(super.enable(),this.el.classList.add("ui-droppable"),this.el.classList.remove("ui-droppable-disabled"),this.el.addEventListener("mouseenter",this._mouseEnter),this.el.addEventListener("mouseleave",this._mouseLeave),W&&(this.el.addEventListener("pointerenter",Gt),this.el.addEventListener("pointerleave",qt)))}disable(e=!1){this.disabled!==!0&&(super.disable(),this.el.classList.remove("ui-droppable"),e||this.el.classList.add("ui-droppable-disabled"),this.el.removeEventListener("mouseenter",this._mouseEnter),this.el.removeEventListener("mouseleave",this._mouseLeave),W&&(this.el.removeEventListener("pointerenter",Gt),this.el.removeEventListener("pointerleave",qt)))}destroy(){this.disable(!0),this.el.classList.remove("ui-droppable"),this.el.classList.remove("ui-droppable-disabled"),super.destroy()}updateOption(e){return Object.keys(e).forEach(t=>this.option[t]=e[t]),this._setupAccept(),this}_mouseEnter(e){if(!w.dragElement||!this._canDrop(w.dragElement.el))return;e.preventDefault(),e.stopPropagation(),w.dropElement&&w.dropElement!==this&&w.dropElement._mouseLeave(e,!0),w.dropElement=this;const t=c.initEvent(e,{target:this.el,type:"dropover"});this.option.over&&this.option.over(t,this._ui(w.dragElement)),this.triggerEvent("dropover",t),this.el.classList.add("ui-droppable-over")}_mouseLeave(e,t=!1){if(!w.dragElement||w.dropElement!==this)return;e.preventDefault(),e.stopPropagation();const i=c.initEvent(e,{target:this.el,type:"dropout"});if(this.option.out&&this.option.out(i,this._ui(w.dragElement)),this.triggerEvent("dropout",i),w.dropElement===this&&(delete w.dropElement,!t)){let r,o=this.el.parentElement;for(;!r&&o;)r=o.ddElement?.ddDroppable,o=o.parentElement;r&&r._mouseEnter(e)}}drop(e){e.preventDefault();const t=c.initEvent(e,{target:this.el,type:"drop"});this.option.drop&&this.option.drop(t,this._ui(w.dragElement)),this.triggerEvent("drop",t)}_canDrop(e){return e&&(!this.accept||this.accept(e))}_setupAccept(){return this.option.accept?(typeof this.option.accept=="string"?this.accept=e=>e.classList.contains(this.option.accept)||e.matches(this.option.accept):this.accept=this.option.accept,this):this}_ui(e){return{draggable:e.el,...e.ui()}}}class pt{static init(e){return e.ddElement||(e.ddElement=new pt(e)),e.ddElement}constructor(e){this.el=e}on(e,t){return this.ddDraggable&&["drag","dragstart","dragstop"].indexOf(e)>-1?this.ddDraggable.on(e,t):this.ddDroppable&&["drop","dropover","dropout"].indexOf(e)>-1?this.ddDroppable.on(e,t):this.ddResizable&&["resizestart","resize","resizestop"].indexOf(e)>-1&&this.ddResizable.on(e,t),this}off(e){return this.ddDraggable&&["drag","dragstart","dragstop"].indexOf(e)>-1?this.ddDraggable.off(e):this.ddDroppable&&["drop","dropover","dropout"].indexOf(e)>-1?this.ddDroppable.off(e):this.ddResizable&&["resizestart","resize","resizestop"].indexOf(e)>-1&&this.ddResizable.off(e),this}setupDraggable(e){return this.ddDraggable?this.ddDraggable.updateOption(e):this.ddDraggable=new Re(this.el,e),this}cleanDraggable(){return this.ddDraggable&&(this.ddDraggable.destroy(),delete this.ddDraggable),this}setupResizable(e){return this.ddResizable?this.ddResizable.updateOption(e):this.ddResizable=new Se(this.el,e),this}cleanResizable(){return this.ddResizable&&(this.ddResizable.destroy(),delete this.ddResizable),this}setupDroppable(e){return this.ddDroppable?this.ddDroppable.updateOption(e):this.ddDroppable=new Us(this.el,e),this}cleanDroppable(){return this.ddDroppable&&(this.ddDroppable.destroy(),delete this.ddDroppable),this}}class Fs{resizable(e,t,i,r){return this._getDDElements(e,t).forEach(o=>{if(t==="disable"||t==="enable")o.ddResizable&&o.ddResizable[t]();else if(t==="destroy")o.ddResizable&&o.cleanResizable();else if(t==="option")o.setupResizable({[i]:r});else{const a=o.el.gridstackNode.grid;let h=o.el.getAttribute("gs-resize-handles")||a.opts.resizable.handles||"e,s,se";h==="all"&&(h="n,e,s,w,se,sw,ne,nw");const l=!a.opts.alwaysShowResizeHandle;o.setupResizable({...a.opts.resizable,handles:h,autoHide:l,start:t.start,stop:t.stop,resize:t.resize})}}),this}draggable(e,t,i,r){return this._getDDElements(e,t).forEach(o=>{if(t==="disable"||t==="enable")o.ddDraggable&&o.ddDraggable[t]();else if(t==="destroy")o.ddDraggable&&o.cleanDraggable();else if(t==="option")o.setupDraggable({[i]:r});else{const n=o.el.gridstackNode.grid;o.setupDraggable({...n.opts.draggable,start:t.start,stop:t.stop,drag:t.drag})}}),this}dragIn(e,t){return this._getDDElements(e).forEach(i=>i.setupDraggable(t)),this}droppable(e,t,i,r){return typeof t.accept=="function"&&!t._accept&&(t._accept=t.accept,t.accept=o=>t._accept(o)),this._getDDElements(e,t).forEach(o=>{t==="disable"||t==="enable"?o.ddDroppable&&o.ddDroppable[t]():t==="destroy"?o.ddDroppable&&o.cleanDroppable():t==="option"?o.setupDroppable({[i]:r}):o.setupDroppable(t)}),this}isDroppable(e){return!!(e?.ddElement?.ddDroppable&&!e.ddElement.ddDroppable.disabled)}isDraggable(e){return!!(e?.ddElement?.ddDraggable&&!e.ddElement.ddDraggable.disabled)}isResizable(e){return!!(e?.ddElement?.ddResizable&&!e.ddElement.ddResizable.disabled)}on(e,t,i){return this._getDDElements(e).forEach(r=>r.on(t,o=>{i(o,w.dragElement?w.dragElement.el:o.target,w.dragElement?w.dragElement.helper:null)})),this}off(e,t){return this._getDDElements(e).forEach(i=>i.off(t)),this}_getDDElements(e,t){const i=e.gridstack||t!=="destroy"&&t!=="disable",r=c.getElements(e);return r.length?r.map(n=>n.ddElement||(i?pt.init(n):null)).filter(n=>n):[]}}/*!
|
|
227
|
-
* GridStack 12.3.2
|
|
228
|
-
* https://gridstackjs.com/
|
|
229
|
-
*
|
|
230
|
-
* Copyright (c) 2021-2025 Alain Dumesny
|
|
231
|
-
* see root license https://github.com/gridstack/gridstack.js/tree/master/LICENSE
|
|
232
|
-
*/const T=new Fs;class b{static init(e={},t=".grid-stack"){if(typeof document>"u")return null;const i=b.getGridElement(t);return i?(i.gridstack||(i.gridstack=new b(i,c.cloneDeep(e))),i.gridstack):(console.error(typeof t=="string"?'GridStack.initAll() no grid was found with selector "'+t+`" - element missing or wrong selector ?
|
|
226
|
+
`,ge);g([m.property()],U.prototype,"appServer");g([m.property()],U.prototype,"apiHost");g([m.property({type:Object})],U.prototype,"options");g([m.property()],U.prototype,"aiEndPoint");g([m.property()],U.prototype,"authKey");g([m.property()],U.prototype,"authToken");g([m.property()],U.prototype,"messages");g([m.property()],U.prototype,"version");g([m.property()],U.prototype,"libVersion");g([m.property()],U.prototype,"remoteEntryServer");customElements.get(Vt)||customElements.define(Vt,U);_.LitElement.disableWarning?.("change-in-update");function $s(s,e,t,i,r){const o=(...n)=>(console.warn("gridstack.js: Function `"+t+"` is deprecated in "+r+" and has been replaced with `"+i+"`. It will be **removed** in a future release"),e.apply(s,n));return o.prototype=e.prototype,o}class c{static getElements(e,t=document){if(typeof e=="string"){const i="getElementById"in t?t:void 0;if(i&&!isNaN(+e[0])){const o=i.getElementById(e);return o?[o]:[]}let r=t.querySelectorAll(e);return!r.length&&e[0]!=="."&&e[0]!=="#"&&(r=t.querySelectorAll("."+e),r.length||(r=t.querySelectorAll("#"+e))),Array.from(r)}return[e]}static getElement(e,t=document){if(typeof e=="string"){const i="getElementById"in t?t:void 0;if(!e.length)return null;if(i&&e[0]==="#")return i.getElementById(e.substring(1));if(e[0]==="#"||e[0]==="."||e[0]==="[")return t.querySelector(e);if(i&&!isNaN(+e[0]))return i.getElementById(e);let r=t.querySelector(e);return i&&!r&&(r=i.getElementById(e)),r||(r=t.querySelector("."+e)),r}return e}static lazyLoad(e){return e.lazyLoad||e.grid?.opts?.lazyLoad&&e.lazyLoad!==!1}static createDiv(e,t){const i=document.createElement("div");return e.forEach(r=>{r&&i.classList.add(r)}),t?.appendChild(i),i}static shouldSizeToContent(e,t=!1){return e?.grid&&(t?e.sizeToContent===!0||e.grid.opts.sizeToContent===!0&&e.sizeToContent===void 0:!!e.sizeToContent||e.grid.opts.sizeToContent&&e.sizeToContent!==!1)}static isIntercepted(e,t){return!(e.y>=t.y+t.h||e.y+e.h<=t.y||e.x+e.w<=t.x||e.x>=t.x+t.w)}static isTouching(e,t){return c.isIntercepted(e,{x:t.x-.5,y:t.y-.5,w:t.w+1,h:t.h+1})}static areaIntercept(e,t){const i=e.x>t.x?e.x:t.x,r=e.x+e.w<t.x+t.w?e.x+e.w:t.x+t.w;if(r<=i)return 0;const o=e.y>t.y?e.y:t.y,n=e.y+e.h<t.y+t.h?e.y+e.h:t.y+t.h;return n<=o?0:(r-i)*(n-o)}static area(e){return e.w*e.h}static sort(e,t=1){return e.sort((r,o)=>{const n=t*((r.y??1e4)-(o.y??1e4));return n===0?t*((r.x??1e4)-(o.x??1e4)):n})}static find(e,t){return t?e.find(i=>i.id===t):void 0}static toBool(e){return typeof e=="boolean"?e:typeof e=="string"?(e=e.toLowerCase(),!(e===""||e==="no"||e==="false"||e==="0")):!!e}static toNumber(e){return e===null||e.length===0?void 0:Number(e)}static parseHeight(e){let t,i="px";if(typeof e=="string")if(e==="auto"||e==="")t=0;else{const r=e.match(/^(-[0-9]+\.[0-9]+|[0-9]*\.[0-9]+|-[0-9]+|[0-9]+)(px|em|rem|vh|vw|%|cm|mm)?$/);if(!r)throw new Error(`Invalid height val = ${e}`);i=r[2]||"px",t=parseFloat(r[1])}else t=e;return{h:t,unit:i}}static defaults(e,...t){return t.forEach(i=>{for(const r in i){if(!i.hasOwnProperty(r))return;e[r]===null||e[r]===void 0?e[r]=i[r]:typeof i[r]=="object"&&typeof e[r]=="object"&&c.defaults(e[r],i[r])}}),e}static same(e,t){if(typeof e!="object")return e==t;if(typeof e!=typeof t||Object.keys(e).length!==Object.keys(t).length)return!1;for(const i in e)if(e[i]!==t[i])return!1;return!0}static copyPos(e,t,i=!1){return t.x!==void 0&&(e.x=t.x),t.y!==void 0&&(e.y=t.y),t.w!==void 0&&(e.w=t.w),t.h!==void 0&&(e.h=t.h),i&&(t.minW&&(e.minW=t.minW),t.minH&&(e.minH=t.minH),t.maxW&&(e.maxW=t.maxW),t.maxH&&(e.maxH=t.maxH)),e}static samePos(e,t){return e&&t&&e.x===t.x&&e.y===t.y&&(e.w||1)===(t.w||1)&&(e.h||1)===(t.h||1)}static sanitizeMinMax(e){e.minW||delete e.minW,e.minH||delete e.minH,e.maxW||delete e.maxW,e.maxH||delete e.maxH}static removeInternalAndSame(e,t){if(!(typeof e!="object"||typeof t!="object"))for(let i in e){const r=e[i],o=t[i];i[0]==="_"||r===o?delete e[i]:r&&typeof r=="object"&&o!==void 0&&(c.removeInternalAndSame(r,o),Object.keys(r).length||delete e[i])}}static removeInternalForSave(e,t=!0){for(let i in e)(i[0]==="_"||e[i]===null||e[i]===void 0)&&delete e[i];delete e.grid,t&&delete e.el,e.autoPosition||delete e.autoPosition,e.noResize||delete e.noResize,e.noMove||delete e.noMove,e.locked||delete e.locked,(e.w===1||e.w===e.minW)&&delete e.w,(e.h===1||e.h===e.minH)&&delete e.h}static throttle(e,t){let i=!1;return(...r)=>{i||(i=!0,setTimeout(()=>{e(...r),i=!1},t))}}static removePositioningStyles(e){const t=e.style;t.position&&t.removeProperty("position"),t.left&&t.removeProperty("left"),t.top&&t.removeProperty("top"),t.width&&t.removeProperty("width"),t.height&&t.removeProperty("height")}static getScrollElement(e){if(!e)return document.scrollingElement||document.documentElement;const t=getComputedStyle(e);return/(auto|scroll)/.test(t.overflow+t.overflowY)?e:c.getScrollElement(e.parentElement)}static updateScrollPosition(e,t,i){const r=c.getScrollElement(e);if(!r)return;const o=e.getBoundingClientRect(),n=r.getBoundingClientRect(),a=window.innerHeight||document.documentElement.clientHeight,h=o.bottom-Math.min(n.bottom,a),l=o.top-Math.max(n.top,0),d=r.scrollTop;l<0&&i<0?e.offsetHeight>n.height?r.scrollTop+=i:r.scrollTop+=Math.abs(l)>Math.abs(i)?i:l:h>0&&i>0&&(e.offsetHeight>n.height?r.scrollTop+=i:r.scrollTop+=h>i?i:h),t.top+=r.scrollTop-d}static updateScrollResize(e,t,i){const r=c.getScrollElement(t),o=r.clientHeight,n=r===c.getScrollElement()?0:r.getBoundingClientRect().top,a=e.clientY-n,h=a<i,l=a>o-i;h?r.scrollBy({behavior:"smooth",top:a-i}):l&&r.scrollBy({behavior:"smooth",top:i-(o-a)})}static clone(e){return e==null||typeof e!="object"?e:e instanceof Array?[...e]:{...e}}static cloneDeep(e){const t=["parentGrid","el","grid","subGrid","engine"],i=c.clone(e);for(const r in i)i.hasOwnProperty(r)&&typeof i[r]=="object"&&r.substring(0,2)!=="__"&&!t.find(o=>o===r)&&(i[r]=c.cloneDeep(e[r]));return i}static cloneNode(e){const t=e.cloneNode(!0);return t.removeAttribute("id"),t}static appendTo(e,t){let i;typeof t=="string"?i=c.getElement(t):i=t,i&&i.appendChild(e)}static addElStyles(e,t){if(t instanceof Object)for(const i in t)t.hasOwnProperty(i)&&(Array.isArray(t[i])?t[i].forEach(r=>{e.style[i]=r}):e.style[i]=t[i])}static initEvent(e,t){const i={type:t.type},r={button:0,which:0,buttons:1,bubbles:!0,cancelable:!0,target:t.target?t.target:e.target};return["altKey","ctrlKey","metaKey","shiftKey"].forEach(o=>i[o]=e[o]),["pageX","pageY","clientX","clientY","screenX","screenY"].forEach(o=>i[o]=e[o]),{...i,...r}}static simulateMouseEvent(e,t,i){const r=e,o=new MouseEvent(t,{bubbles:!0,composed:!0,cancelable:!0,view:window,detail:1,screenX:e.screenX,screenY:e.screenY,clientX:e.clientX,clientY:e.clientY,ctrlKey:r.ctrlKey??!1,altKey:r.altKey??!1,shiftKey:r.shiftKey??!1,metaKey:r.metaKey??!1,button:0,relatedTarget:e.target});(i||e.target).dispatchEvent(o)}static getValuesFromTransformedElement(e){const t=document.createElement("div");c.addElStyles(t,{opacity:"0",position:"fixed",top:"0px",left:"0px",width:"1px",height:"1px",zIndex:"-999999"}),e.appendChild(t);const i=t.getBoundingClientRect();return e.removeChild(t),t.remove(),{xScale:1/i.width,yScale:1/i.height,xOffset:i.left,yOffset:i.top}}static swap(e,t,i){if(!e)return;const r=e[t];e[t]=e[i],e[i]=r}static canBeRotated(e){return!(!e||e.w===e.h||e.locked||e.noResize||e.grid?.opts.disableResize||e.minW&&e.minW===e.maxW||e.minH&&e.minH===e.maxH)}}class K{constructor(e={}){this.addedNodes=[],this.removedNodes=[],this.defaultColumn=12,this.column=e.column||this.defaultColumn,this.column>this.defaultColumn&&(this.defaultColumn=this.column),this.maxRow=e.maxRow,this._float=e.float,this.nodes=e.nodes||[],this.onChange=e.onChange}batchUpdate(e=!0,t=!0){return!!this.batchMode===e?this:(this.batchMode=e,e?(this._prevFloat=this._float,this._float=!0,this.cleanNodes(),this.saveInitial()):(this._float=this._prevFloat,delete this._prevFloat,t&&this._packNodes(),this._notify()),this)}_useEntireRowArea(e,t){return(!this.float||this.batchMode&&!this._prevFloat)&&!this._hasLocked&&(!e._moving||e._skipDown||t.y<=e.y)}_fixCollisions(e,t=e,i,r={}){if(this.sortNodes(-1),i=i||this.collide(e,t),!i)return!1;if(e._moving&&!r.nested&&!this.float&&this.swap(e,i))return!0;let o=t;!this._loading&&this._useEntireRowArea(e,t)&&(o={x:0,w:this.column,y:t.y,h:t.h},i=this.collide(e,o,r.skip));let n=!1;const a={nested:!0,pack:!1};let h=0;for(;i=i||this.collide(e,o,r.skip);){if(h++>this.nodes.length*2)throw new Error("Infinite collide check");let l;if(i.locked||this._loading||e._moving&&!e._skipDown&&t.y>e.y&&!this.float&&(!this.collide(i,{...i,y:e.y},e)||!this.collide(i,{...i,y:t.y-i.h},e))){e._skipDown=e._skipDown||t.y>e.y;const d={...t,y:i.y+i.h,...a};l=this._loading&&c.samePos(e,d)?!0:this.moveNode(e,d),(i.locked||this._loading)&&l?c.copyPos(t,e):!i.locked&&l&&r.pack&&(this._packNodes(),t.y=i.y+i.h,c.copyPos(e,t)),n=n||l}else l=this.moveNode(i,{...i,y:t.y+t.h,skip:e,...a});if(!l)return n;i=void 0}return n}collide(e,t=e,i){const r=e._id,o=i?._id;return this.nodes.find(n=>n._id!==r&&n._id!==o&&c.isIntercepted(n,t))}collideAll(e,t=e,i){const r=e._id,o=i?._id;return this.nodes.filter(n=>n._id!==r&&n._id!==o&&c.isIntercepted(n,t))}directionCollideCoverage(e,t,i){if(!t.rect||!e._rect)return;const r=e._rect,o={...t.rect};o.y>r.y?(o.h+=o.y-r.y,o.y=r.y):o.h+=r.y-o.y,o.x>r.x?(o.w+=o.x-r.x,o.x=r.x):o.w+=r.x-o.x;let n,a=.5;for(let h of i){if(h.locked||!h._rect)break;const l=h._rect;let d=Number.MAX_VALUE,u=Number.MAX_VALUE;r.y<l.y?d=(o.y+o.h-l.y)/l.h:r.y+r.h>l.y+l.h&&(d=(l.y+l.h-o.y)/l.h),r.x<l.x?u=(o.x+o.w-l.x)/l.w:r.x+r.w>l.x+l.w&&(u=(l.x+l.w-o.x)/l.w);const p=Math.min(u,d);p>a&&(a=p,n=h)}return t.collide=n,n}cacheRects(e,t,i,r,o,n){return this.nodes.forEach(a=>a._rect={y:a.y*t+i,x:a.x*e+n,w:a.w*e-n-r,h:a.h*t-i-o}),this}swap(e,t){if(!t||t.locked||!e||e.locked)return!1;function i(){const o=t.x,n=t.y;return t.x=e.x,t.y=e.y,e.h!=t.h?(e.x=o,e.y=t.y+t.h):e.w!=t.w?(e.x=t.x+t.w,e.y=n):(e.x=o,e.y=n),e._dirty=t._dirty=!0,!0}let r;if(e.w===t.w&&e.h===t.h&&(e.x===t.x||e.y===t.y)&&(r=c.isTouching(e,t)))return i();if(r!==!1){if(e.w===t.w&&e.x===t.x&&(r||(r=c.isTouching(e,t)))){if(t.y<e.y){const o=e;e=t,t=o}return i()}if(r!==!1){if(e.h===t.h&&e.y===t.y&&(r||(r=c.isTouching(e,t)))){if(t.x<e.x){const o=e;e=t,t=o}return i()}return!1}}}isAreaEmpty(e,t,i,r){const o={x:e||0,y:t||0,w:i||1,h:r||1};return!this.collide(o)}compact(e="compact",t=!0){if(this.nodes.length===0)return this;t&&this.sortNodes();const i=this.batchMode;i||this.batchUpdate();const r=this._inColumnResize;r||(this._inColumnResize=!0);const o=this.nodes;return this.nodes=[],o.forEach((n,a,h)=>{let l;n.locked||(n.autoPosition=!0,e==="list"&&a&&(l=h[a-1])),this.addNode(n,!1,l)}),r||delete this._inColumnResize,i||this.batchUpdate(!1),this}set float(e){this._float!==e&&(this._float=e||!1,e||this._packNodes()._notify())}get float(){return this._float||!1}sortNodes(e=1){return this.nodes=c.sort(this.nodes,e),this}_packNodes(){return this.batchMode?this:(this.sortNodes(),this.float?this.nodes.forEach(e=>{if(e._updating||e._orig===void 0||e.y===e._orig.y)return;let t=e.y;for(;t>e._orig.y;)--t,this.collide(e,{x:e.x,y:t,w:e.w,h:e.h})||(e._dirty=!0,e.y=t)}):this.nodes.forEach((e,t)=>{if(!e.locked)for(;e.y>0;){const i=t===0?0:e.y-1;if(!(t===0||!this.collide(e,{x:e.x,y:i,w:e.w,h:e.h})))break;e._dirty=e.y!==i,e.y=i}}),this)}prepareNode(e,t){e._id=e._id??K._idSeq++;const i=e.id;if(i){let o=1;for(;this.nodes.find(n=>n.id===e.id&&n!==e);)e.id=i+"_"+o++}(e.x===void 0||e.y===void 0||e.x===null||e.y===null)&&(e.autoPosition=!0);const r={x:0,y:0,w:1,h:1};return c.defaults(e,r),e.autoPosition||delete e.autoPosition,e.noResize||delete e.noResize,e.noMove||delete e.noMove,c.sanitizeMinMax(e),typeof e.x=="string"&&(e.x=Number(e.x)),typeof e.y=="string"&&(e.y=Number(e.y)),typeof e.w=="string"&&(e.w=Number(e.w)),typeof e.h=="string"&&(e.h=Number(e.h)),isNaN(e.x)&&(e.x=r.x,e.autoPosition=!0),isNaN(e.y)&&(e.y=r.y,e.autoPosition=!0),isNaN(e.w)&&(e.w=r.w),isNaN(e.h)&&(e.h=r.h),this.nodeBoundFix(e,t),e}nodeBoundFix(e,t){const i=e._orig||c.copyPos({},e);if(e.maxW&&(e.w=Math.min(e.w||1,e.maxW)),e.maxH&&(e.h=Math.min(e.h||1,e.maxH)),e.minW&&(e.w=Math.max(e.w||1,e.minW)),e.minH&&(e.h=Math.max(e.h||1,e.minH)),(e.x||0)+(e.w||1)>this.column&&this.column<this.defaultColumn&&!this._inColumnResize&&!this.skipCacheUpdate&&e._id!=null&&this.findCacheLayout(e,this.defaultColumn)===-1){const o={...e};o.autoPosition||o.x===void 0?(delete o.x,delete o.y):o.x=Math.min(this.defaultColumn-1,o.x),o.w=Math.min(this.defaultColumn,o.w||1),this.cacheOneLayout(o,this.defaultColumn)}return e.w>this.column?e.w=this.column:e.w<1&&(e.w=1),this.maxRow&&e.h>this.maxRow?e.h=this.maxRow:e.h<1&&(e.h=1),e.x<0&&(e.x=0),e.y<0&&(e.y=0),e.x+e.w>this.column&&(t?e.w=this.column-e.x:e.x=this.column-e.w),this.maxRow&&e.y+e.h>this.maxRow&&(t?e.h=this.maxRow-e.y:e.y=this.maxRow-e.h),c.samePos(e,i)||(e._dirty=!0),this}getDirtyNodes(e){return e?this.nodes.filter(t=>t._dirty&&!c.samePos(t,t._orig)):this.nodes.filter(t=>t._dirty)}_notify(e){if(this.batchMode||!this.onChange)return this;const t=(e||[]).concat(this.getDirtyNodes());return this.onChange(t),this}cleanNodes(){return this.batchMode?this:(this.nodes.forEach(e=>{delete e._dirty,delete e._lastTried}),this)}saveInitial(){return this.nodes.forEach(e=>{e._orig=c.copyPos({},e),delete e._dirty}),this._hasLocked=this.nodes.some(e=>e.locked),this}restoreInitial(){return this.nodes.forEach(e=>{!e._orig||c.samePos(e,e._orig)||(c.copyPos(e,e._orig),e._dirty=!0)}),this._notify(),this}findEmptyPosition(e,t=this.nodes,i=this.column,r){const o=r?r.y*i+(r.x+r.w):0;let n=!1;for(let a=o;!n;++a){const h=a%i,l=Math.floor(a/i);if(h+e.w>i)continue;const d={x:h,y:l,w:e.w,h:e.h};t.find(u=>c.isIntercepted(d,u))||((e.x!==h||e.y!==l)&&(e._dirty=!0),e.x=h,e.y=l,delete e.autoPosition,n=!0)}return n}addNode(e,t=!1,i){const r=this.nodes.find(n=>n._id===e._id);if(r)return r;this._inColumnResize?this.nodeBoundFix(e):this.prepareNode(e),delete e._temporaryRemoved,delete e._removeDOM;let o;return e.autoPosition&&this.findEmptyPosition(e,this.nodes,this.column,i)&&(delete e.autoPosition,o=!0),this.nodes.push(e),t&&this.addedNodes.push(e),o||this._fixCollisions(e),this.batchMode||this._packNodes()._notify(),e}removeNode(e,t=!0,i=!1){return this.nodes.find(r=>r._id===e._id)?(i&&this.removedNodes.push(e),t&&(e._removeDOM=!0),this.nodes=this.nodes.filter(r=>r._id!==e._id),e._isAboutToRemove||this._packNodes(),this._notify([e]),this):this}removeAll(e=!0,t=!0){if(delete this._layouts,!this.nodes.length)return this;e&&this.nodes.forEach(r=>r._removeDOM=!0);const i=this.nodes;return this.removedNodes=t?i:[],this.nodes=[],this._notify(i)}moveNodeCheck(e,t){if(!this.changedPosConstrain(e,t))return!1;if(t.pack=!0,!this.maxRow)return this.moveNode(e,t);let i;const r=new K({column:this.column,float:this.float,nodes:this.nodes.map(n=>n._id===e._id?(i={...n},i):{...n})});if(!i)return!1;const o=r.moveNode(i,t)&&r.getRow()<=Math.max(this.getRow(),this.maxRow);if(!o&&!t.resizing&&t.collide){const n=t.collide.el.gridstackNode;if(this.swap(e,n))return this._notify(),!0}return o?(r.nodes.filter(n=>n._dirty).forEach(n=>{const a=this.nodes.find(h=>h._id===n._id);a&&(c.copyPos(a,n),a._dirty=!0)}),this._notify(),!0):!1}willItFit(e){if(delete e._willFitPos,!this.maxRow)return!0;const t=new K({column:this.column,float:this.float,nodes:this.nodes.map(r=>({...r}))}),i={...e};return this.cleanupNode(i),delete i.el,delete i._id,delete i.content,delete i.grid,t.addNode(i),t.getRow()<=this.maxRow?(e._willFitPos=c.copyPos({},i),!0):!1}changedPosConstrain(e,t){return t.w=t.w||e.w,t.h=t.h||e.h,e.x!==t.x||e.y!==t.y?!0:(e.maxW&&(t.w=Math.min(t.w,e.maxW)),e.maxH&&(t.h=Math.min(t.h,e.maxH)),e.minW&&(t.w=Math.max(t.w,e.minW)),e.minH&&(t.h=Math.max(t.h,e.minH)),e.w!==t.w||e.h!==t.h)}moveNode(e,t){if(!e||!t)return!1;let i;t.pack===void 0&&!this.batchMode&&(i=t.pack=!0),typeof t.x!="number"&&(t.x=e.x),typeof t.y!="number"&&(t.y=e.y),typeof t.w!="number"&&(t.w=e.w),typeof t.h!="number"&&(t.h=e.h);const r=e.w!==t.w||e.h!==t.h,o=c.copyPos({},e,!0);if(c.copyPos(o,t),this.nodeBoundFix(o,r),c.copyPos(t,o),!t.forceCollide&&c.samePos(e,t))return!1;const n=c.copyPos({},e),a=this.collideAll(e,o,t.skip);let h=!0;if(a.length){const l=e._moving&&!t.nested;let d=l?this.directionCollideCoverage(e,t,a):a[0];if(l&&d&&e.grid?.opts?.subGridDynamic&&!e.grid._isTemp){const u=c.areaIntercept(t.rect,d._rect),p=c.area(t.rect),f=c.area(d._rect);u/(p<f?p:f)>.8&&(d.grid.makeSubGrid(d.el,void 0,e),d=void 0)}d?h=!this._fixCollisions(e,o,d,t):(h=!1,i&&delete t.pack)}return h&&!c.samePos(e,o)&&(e._dirty=!0,c.copyPos(e,o)),t.pack&&this._packNodes()._notify(),!c.samePos(e,n)}getRow(){return this.nodes.reduce((e,t)=>Math.max(e,t.y+t.h),0)}beginUpdate(e){return e._updating||(e._updating=!0,delete e._skipDown,this.batchMode||this.saveInitial()),this}endUpdate(){const e=this.nodes.find(t=>t._updating);return e&&(delete e._updating,delete e._skipDown),this}save(e=!0,t,i){const r=this._layouts?.length||0;let o;r&&(i?i!==this.column&&(o=this._layouts[i]):this.column!==r-1&&(o=this._layouts[r-1]));const n=[];return this.sortNodes(),this.nodes.forEach(a=>{const h=o?.find(d=>d._id===a._id),l={...a,...h||{}};c.removeInternalForSave(l,!e),t&&t(a,l),n.push(l)}),n}layoutsNodesChange(e){return!this._layouts||this._inColumnResize?this:(this._layouts.forEach((t,i)=>{if(!t||i===this.column)return this;if(i<this.column)this._layouts[i]=void 0;else{const r=i/this.column;e.forEach(o=>{if(!o._orig)return;const n=t.find(a=>a._id===o._id);n&&(n.y>=0&&o.y!==o._orig.y&&(n.y+=o.y-o._orig.y),o.x!==o._orig.x&&(n.x=Math.round(o.x*r)),o.w!==o._orig.w&&(n.w=Math.round(o.w*r)))})}}),this)}columnChanged(e,t,i="moveScale"){if(!this.nodes.length||!t||e===t)return this;const r=i==="compact"||i==="list";r&&this.sortNodes(1),t<e&&this.cacheLayout(this.nodes,e),this.batchUpdate();let o=[],n=r?this.nodes:c.sort(this.nodes,-1);if(t>e&&this._layouts){const a=this._layouts[t]||[],h=this._layouts.length-1;!a.length&&e!==h&&this._layouts[h]?.length&&(e=h,this._layouts[h].forEach(l=>{const d=n.find(u=>u._id===l._id);d&&(!r&&!l.autoPosition&&(d.x=l.x??d.x,d.y=l.y??d.y),d.w=l.w??d.w,(l.x==null||l.y===void 0)&&(d.autoPosition=!0))})),a.forEach(l=>{const d=n.findIndex(u=>u._id===l._id);if(d!==-1){const u=n[d];if(r){u.w=l.w;return}(l.autoPosition||isNaN(l.x)||isNaN(l.y))&&this.findEmptyPosition(l,o),l.autoPosition||(u.x=l.x??u.x,u.y=l.y??u.y,u.w=l.w??u.w,o.push(u)),n.splice(d,1)}})}if(r)this.compact(i,!1);else{if(n.length)if(typeof i=="function")i(t,e,o,n);else{const a=r||i==="none"?1:t/e,h=i==="move"||i==="moveScale",l=i==="scale"||i==="moveScale";n.forEach(d=>{d.x=t===1?0:h?Math.round(d.x*a):Math.min(d.x,t-1),d.w=t===1||e===1?1:l?Math.round(d.w*a)||1:Math.min(d.w,t),o.push(d)}),n=[]}o=c.sort(o,-1),this._inColumnResize=!0,this.nodes=[],o.forEach(a=>{this.addNode(a,!1),delete a._orig})}return this.nodes.forEach(a=>delete a._orig),this.batchUpdate(!1,!r),delete this._inColumnResize,this}cacheLayout(e,t,i=!1){const r=[];return e.forEach((o,n)=>{if(o._id===void 0){const a=o.id?this.nodes.find(h=>h.id===o.id):void 0;o._id=a?._id??K._idSeq++}r[n]={x:o.x,y:o.y,w:o.w,_id:o._id}}),this._layouts=i?[]:this._layouts||[],this._layouts[t]=r,this}cacheOneLayout(e,t){e._id=e._id??K._idSeq++;const i={x:e.x,y:e.y,w:e.w,_id:e._id};(e.autoPosition||e.x===void 0)&&(delete i.x,delete i.y,e.autoPosition&&(i.autoPosition=!0)),this._layouts=this._layouts||[],this._layouts[t]=this._layouts[t]||[];const r=this.findCacheLayout(e,t);return r===-1?this._layouts[t].push(i):this._layouts[t][r]=i,this}findCacheLayout(e,t){return this._layouts?.[t]?.findIndex(i=>i._id===e._id)??-1}removeNodeFromLayoutCache(e){if(this._layouts)for(let t=0;t<this._layouts.length;t++){const i=this.findCacheLayout(e,t);i!==-1&&this._layouts[t].splice(i,1)}}cleanupNode(e){for(const t in e)t[0]==="_"&&t!=="_id"&&delete e[t];return this}}K._idSeq=0;const L={alwaysShowResizeHandle:"mobile",animate:!0,auto:!0,cellHeight:"auto",cellHeightThrottle:100,cellHeightUnit:"px",column:12,draggable:{handle:".grid-stack-item-content",appendTo:"body",scroll:!0},handle:".grid-stack-item-content",itemClass:"grid-stack-item",margin:10,marginUnit:"px",maxRow:0,minRow:0,placeholderClass:"grid-stack-placeholder",placeholderText:"",removableOptions:{accept:"grid-stack-item",decline:"grid-stack-non-removable"},resizable:{handles:"se"},rtl:"auto"};class w{}const W=typeof window<"u"&&typeof document<"u"&&("ontouchstart"in document||"ontouchstart"in window||window.DocumentTouch&&document instanceof window.DocumentTouch||navigator.maxTouchPoints>0||navigator.msMaxTouchPoints>0);class F{}function He(s,e){s.touches.length>1||(s.cancelable&&s.preventDefault(),c.simulateMouseEvent(s.changedTouches[0],e))}function li(s,e){s.cancelable&&s.preventDefault(),c.simulateMouseEvent(s,e)}function Ne(s){F.touchHandled||(F.touchHandled=!0,He(s,"mousedown"))}function Oe(s){F.touchHandled&&He(s,"mousemove")}function Pe(s){if(!F.touchHandled)return;F.pointerLeaveTimeout&&(window.clearTimeout(F.pointerLeaveTimeout),delete F.pointerLeaveTimeout);const e=!!w.dragElement;He(s,"mouseup"),e||He(s,"click"),F.touchHandled=!1}function We(s){s.pointerType!=="mouse"&&s.target.releasePointerCapture(s.pointerId)}function Gt(s){w.dragElement&&s.pointerType!=="mouse"&&li(s,"mouseenter")}function qt(s){w.dragElement&&s.pointerType!=="mouse"&&(F.pointerLeaveTimeout=window.setTimeout(()=>{delete F.pointerLeaveTimeout,li(s,"mouseleave")},10))}class Ge{constructor(e,t,i){this.host=e,this.dir=t,this.option=i,this.moving=!1,this._mouseDown=this._mouseDown.bind(this),this._mouseMove=this._mouseMove.bind(this),this._mouseUp=this._mouseUp.bind(this),this._keyEvent=this._keyEvent.bind(this),this._init()}_init(){const e=this.el=document.createElement("div");return e.classList.add("ui-resizable-handle"),e.classList.add(`${Ge.prefix}${this.dir}`),e.style.zIndex="100",e.style.userSelect="none",this.host.appendChild(this.el),this.el.addEventListener("mousedown",this._mouseDown),W&&(this.el.addEventListener("touchstart",Ne),this.el.addEventListener("pointerdown",We)),this}destroy(){return this.moving&&this._mouseUp(this.mouseDownEvent),this.el.removeEventListener("mousedown",this._mouseDown),W&&(this.el.removeEventListener("touchstart",Ne),this.el.removeEventListener("pointerdown",We)),this.host.removeChild(this.el),delete this.el,delete this.host,this}_mouseDown(e){this.mouseDownEvent=e,document.addEventListener("mousemove",this._mouseMove,{capture:!0,passive:!0}),document.addEventListener("mouseup",this._mouseUp,!0),W&&(this.el.addEventListener("touchmove",Oe),this.el.addEventListener("touchend",Pe)),e.stopPropagation(),e.preventDefault()}_mouseMove(e){const t=this.mouseDownEvent;this.moving?this._triggerEvent("move",e):Math.abs(e.x-t.x)+Math.abs(e.y-t.y)>2&&(this.moving=!0,this._triggerEvent("start",this.mouseDownEvent),this._triggerEvent("move",e),document.addEventListener("keydown",this._keyEvent)),e.stopPropagation()}_mouseUp(e){this.moving&&(this._triggerEvent("stop",e),document.removeEventListener("keydown",this._keyEvent)),document.removeEventListener("mousemove",this._mouseMove,!0),document.removeEventListener("mouseup",this._mouseUp,!0),W&&(this.el.removeEventListener("touchmove",Oe),this.el.removeEventListener("touchend",Pe)),delete this.moving,delete this.mouseDownEvent,e.stopPropagation(),e.preventDefault()}_keyEvent(e){e.key==="Escape"&&(this.host.gridstackNode?.grid?.engine.restoreInitial(),this._mouseUp(this.mouseDownEvent))}_triggerEvent(e,t){return this.option[e]&&this.option[e](t),this}}Ge.prefix="ui-resizable-";class mt{constructor(){this._eventRegister={}}get disabled(){return this._disabled}on(e,t){this._eventRegister[e]=t}off(e){delete this._eventRegister[e]}enable(){this._disabled=!1}disable(){this._disabled=!0}destroy(){delete this._eventRegister}triggerEvent(e,t){if(!this.disabled&&this._eventRegister&&this._eventRegister[e])return this._eventRegister[e](t)}}class Se extends mt{constructor(e,t={}){super(),this.el=e,this.option=t,this.rectScale={x:1,y:1},this._ui=()=>{const r=this.el.parentElement.getBoundingClientRect(),o={width:this.originalRect.width,height:this.originalRect.height+this.scrolled,left:this.originalRect.left,top:this.originalRect.top-this.scrolled},n=this.temporalRect||o;return{position:{left:(n.left-r.left)*this.rectScale.x,top:(n.top-r.top)*this.rectScale.y},size:{width:n.width*this.rectScale.x,height:n.height*this.rectScale.y}}},this._mouseOver=this._mouseOver.bind(this),this._mouseOut=this._mouseOut.bind(this),this.enable(),this._setupAutoHide(this.option.autoHide),this._setupHandlers()}on(e,t){super.on(e,t)}off(e){super.off(e)}enable(){super.enable(),this.el.classList.remove("ui-resizable-disabled"),this._setupAutoHide(this.option.autoHide)}disable(){super.disable(),this.el.classList.add("ui-resizable-disabled"),this._setupAutoHide(!1)}destroy(){this._removeHandlers(),this._setupAutoHide(!1),delete this.el,super.destroy()}updateOption(e){const t=e.handles&&e.handles!==this.option.handles,i=e.autoHide&&e.autoHide!==this.option.autoHide;return Object.keys(e).forEach(r=>this.option[r]=e[r]),t&&(this._removeHandlers(),this._setupHandlers()),i&&this._setupAutoHide(this.option.autoHide),this}_setupAutoHide(e){return e?(this.el.classList.add("ui-resizable-autohide"),this.el.addEventListener("mouseover",this._mouseOver),this.el.addEventListener("mouseout",this._mouseOut)):(this.el.classList.remove("ui-resizable-autohide"),this.el.removeEventListener("mouseover",this._mouseOver),this.el.removeEventListener("mouseout",this._mouseOut),w.overResizeElement===this&&delete w.overResizeElement),this}_mouseOver(e){w.overResizeElement||w.dragElement||(w.overResizeElement=this,this.el.classList.remove("ui-resizable-autohide"))}_mouseOut(e){w.overResizeElement===this&&(delete w.overResizeElement,this.el.classList.add("ui-resizable-autohide"))}_setupHandlers(){return this.handlers=this.option.handles.split(",").map(e=>e.trim()).map(e=>new Ge(this.el,e,{start:t=>{this._resizeStart(t)},stop:t=>{this._resizeStop(t)},move:t=>{this._resizing(t,e)}})),this}_resizeStart(e){this.sizeToContent=c.shouldSizeToContent(this.el.gridstackNode,!0),this.originalRect=this.el.getBoundingClientRect(),this.scrollEl=c.getScrollElement(this.el),this.scrollY=this.scrollEl.scrollTop,this.scrolled=0,this.startEvent=e,this._setupHelper(),this._applyChange();const t=c.initEvent(e,{type:"resizestart",target:this.el});return this.option.start&&this.option.start(t,this._ui()),this.el.classList.add("ui-resizable-resizing"),this.triggerEvent("resizestart",t),this}_resizing(e,t){this.scrolled=this.scrollEl.scrollTop-this.scrollY,this.temporalRect=this._getChange(e,t),this._applyChange();const i=c.initEvent(e,{type:"resize",target:this.el});return this.option.resize&&this.option.resize(i,this._ui()),this.triggerEvent("resize",i),this}_resizeStop(e){const t=c.initEvent(e,{type:"resizestop",target:this.el});return this._cleanHelper(),this.option.stop&&this.option.stop(t),this.el.classList.remove("ui-resizable-resizing"),this.triggerEvent("resizestop",t),delete this.startEvent,delete this.originalRect,delete this.temporalRect,delete this.scrollY,delete this.scrolled,this}_setupHelper(){this.elOriginStyleVal=Se._originStyleProp.map(i=>this.el.style[i]),this.parentOriginStylePosition=this.el.parentElement.style.position;const e=this.el.parentElement,t=c.getValuesFromTransformedElement(e);return this.rectScale={x:t.xScale,y:t.yScale},getComputedStyle(this.el.parentElement).position.match(/static/)&&(this.el.parentElement.style.position="relative"),this.el.style.position="absolute",this.el.style.opacity="0.8",this}_cleanHelper(){return Se._originStyleProp.forEach((e,t)=>{this.el.style[e]=this.elOriginStyleVal[t]||null}),this.el.parentElement.style.position=this.parentOriginStylePosition||null,this}_getChange(e,t){const i=this.startEvent,r={width:this.originalRect.width,height:this.originalRect.height+this.scrolled,left:this.originalRect.left,top:this.originalRect.top-this.scrolled},o=e.clientX-i.clientX,n=this.sizeToContent?0:e.clientY-i.clientY;let a,h;t.indexOf("e")>-1?r.width+=o:t.indexOf("w")>-1&&(r.width-=o,r.left+=o,a=!0),t.indexOf("s")>-1?r.height+=n:t.indexOf("n")>-1&&(r.height-=n,r.top+=n,h=!0);const l=this._constrainSize(r.width,r.height,a,h);return Math.round(r.width)!==Math.round(l.width)&&(t.indexOf("w")>-1&&(r.left+=r.width-l.width),r.width=l.width),Math.round(r.height)!==Math.round(l.height)&&(t.indexOf("n")>-1&&(r.top+=r.height-l.height),r.height=l.height),r}_constrainSize(e,t,i,r){const o=this.option,n=(i?o.maxWidthMoveLeft:o.maxWidth)||Number.MAX_SAFE_INTEGER,a=o.minWidth/this.rectScale.x||e,h=(r?o.maxHeightMoveUp:o.maxHeight)||Number.MAX_SAFE_INTEGER,l=o.minHeight/this.rectScale.y||t,d=Math.min(n,Math.max(a,e)),u=Math.min(h,Math.max(l,t));return{width:d,height:u}}_applyChange(){let e={left:0,top:0,width:0,height:0};if(this.el.style.position==="absolute"){const t=this.el.parentElement,{left:i,top:r}=t.getBoundingClientRect();e={left:i,top:r,width:0,height:0}}return this.temporalRect?(Object.keys(this.temporalRect).forEach(t=>{const i=this.temporalRect[t],r=t==="width"||t==="left"?this.rectScale.x:t==="height"||t==="top"?this.rectScale.y:1;this.el.style[t]=(i-e[t])*r+"px"}),this):this}_removeHandlers(){return this.handlers.forEach(e=>e.destroy()),delete this.handlers,this}}Se._originStyleProp=["width","height","position","left","top","opacity","zIndex"];const Bs='input,textarea,button,select,option,[contenteditable="true"],.ui-resizable-handle';class Re extends mt{constructor(e,t={}){super(),this.el=e,this.option=t,this.dragTransform={xScale:1,yScale:1,xOffset:0,yOffset:0};const i=t?.handle?.substring(1),r=e.gridstackNode;this.dragEls=!i||e.classList.contains(i)?[e]:r?.subGrid?[e.querySelector(t.handle)||e]:Array.from(e.querySelectorAll(t.handle)),this.dragEls.length===0&&(this.dragEls=[e]),this._mouseDown=this._mouseDown.bind(this),this._mouseMove=this._mouseMove.bind(this),this._mouseUp=this._mouseUp.bind(this),this._keyEvent=this._keyEvent.bind(this),this.enable()}on(e,t){super.on(e,t)}off(e){super.off(e)}enable(){this.disabled!==!1&&(super.enable(),this.dragEls.forEach(e=>{e.addEventListener("mousedown",this._mouseDown),W&&(e.addEventListener("touchstart",Ne),e.addEventListener("pointerdown",We))}),this.el.classList.remove("ui-draggable-disabled"))}disable(e=!1){this.disabled!==!0&&(super.disable(),this.dragEls.forEach(t=>{t.removeEventListener("mousedown",this._mouseDown),W&&(t.removeEventListener("touchstart",Ne),t.removeEventListener("pointerdown",We))}),e||this.el.classList.add("ui-draggable-disabled"))}destroy(){this.dragTimeout&&window.clearTimeout(this.dragTimeout),delete this.dragTimeout,this.mouseDownEvent&&this._mouseUp(this.mouseDownEvent),this.disable(!0),delete this.el,delete this.helper,delete this.option,super.destroy()}updateOption(e){return Object.keys(e).forEach(t=>this.option[t]=e[t]),this}_mouseDown(e){if(!w.mouseHandled)return e.button!==0||!this.dragEls.find(t=>t===e.target)&&e.target.closest(Bs)||this.option.cancel&&e.target.closest(this.option.cancel)||(this.mouseDownEvent=e,delete this.dragging,delete w.dragElement,delete w.dropElement,document.addEventListener("mousemove",this._mouseMove,{capture:!0,passive:!0}),document.addEventListener("mouseup",this._mouseUp,!0),W&&(e.currentTarget.addEventListener("touchmove",Oe),e.currentTarget.addEventListener("touchend",Pe)),e.preventDefault(),document.activeElement&&document.activeElement.blur(),w.mouseHandled=!0),!0}_callDrag(e){if(!this.dragging)return;const t=c.initEvent(e,{target:this.el,type:"drag"});this.option.drag&&this.option.drag(t,this.ui()),this.triggerEvent("drag",t)}_mouseMove(e){const t=this.mouseDownEvent;if(this.lastDrag=e,this.dragging)if(this._dragFollow(e),w.pauseDrag){const i=Number.isInteger(w.pauseDrag)?w.pauseDrag:100;this.dragTimeout&&window.clearTimeout(this.dragTimeout),this.dragTimeout=window.setTimeout(()=>this._callDrag(e),i)}else this._callDrag(e);else if(Math.abs(e.x-t.x)+Math.abs(e.y-t.y)>3){this.dragging=!0,w.dragElement=this;const i=this.el.gridstackNode?.grid;i?w.dropElement=i.el.ddElement.ddDroppable:delete w.dropElement,this.helper=this._createHelper(),this._setupHelperContainmentStyle(),this.dragTransform=c.getValuesFromTransformedElement(this.helperContainment),this.dragOffset=this._getDragOffset(e,this.el,this.helperContainment),this._setupHelperStyle(e);const r=c.initEvent(e,{target:this.el,type:"dragstart"});this.option.start&&this.option.start(r,this.ui()),this.triggerEvent("dragstart",r),document.addEventListener("keydown",this._keyEvent)}return!0}_mouseUp(e){if(document.removeEventListener("mousemove",this._mouseMove,!0),document.removeEventListener("mouseup",this._mouseUp,!0),W&&e.currentTarget&&(e.currentTarget.removeEventListener("touchmove",Oe,!0),e.currentTarget.removeEventListener("touchend",Pe,!0)),this.dragging){delete this.dragging,delete this.el.gridstackNode?._origRotate,document.removeEventListener("keydown",this._keyEvent),w.dropElement?.el===this.el.parentElement&&delete w.dropElement,this.helperContainment.style.position=this.parentOriginStylePosition||null,this.helper!==this.el&&this.helper.remove(),this._removeHelperStyle();const t=c.initEvent(e,{target:this.el,type:"dragstop"});this.option.stop&&this.option.stop(t),this.triggerEvent("dragstop",t),w.dropElement&&w.dropElement.drop(e)}delete this.helper,delete this.mouseDownEvent,delete w.dragElement,delete w.dropElement,delete w.mouseHandled,e.preventDefault()}_keyEvent(e){const t=this.el.gridstackNode,i=t?.grid||w.dropElement?.el?.gridstack;if(e.key==="Escape")t&&t._origRotate&&(t._orig=t._origRotate,delete t._origRotate),i?.cancelDrag(),this._mouseUp(this.mouseDownEvent);else if(t&&i&&(e.key==="r"||e.key==="R")){if(!c.canBeRotated(t))return;t._origRotate=t._origRotate||{...t._orig},delete t._moving,i.setAnimation(!1).rotate(t.el,{top:-this.dragOffset.offsetTop,left:-this.dragOffset.offsetLeft}).setAnimation(),t._moving=!0,this.dragOffset=this._getDragOffset(this.lastDrag,t.el,this.helperContainment),this.helper.style.width=this.dragOffset.width+"px",this.helper.style.height=this.dragOffset.height+"px",c.swap(t._orig,"w","h"),delete t._rect,this._mouseMove(this.lastDrag)}}_createHelper(){let e=this.el;return typeof this.option.helper=="function"?e=this.option.helper(this.el):this.option.helper==="clone"&&(e=c.cloneNode(this.el)),e.parentElement||c.appendTo(e,this.option.appendTo==="parent"?this.el.parentElement:this.option.appendTo),this.dragElementOriginStyle=Re.originStyleProp.map(t=>this.el.style[t]),e}_setupHelperStyle(e){this.helper.classList.add("ui-draggable-dragging"),this.el.gridstackNode?.grid?.el.classList.add("grid-stack-dragging");const t=this.helper.style;return t.pointerEvents="none",t.width=this.dragOffset.width+"px",t.height=this.dragOffset.height+"px",t.willChange="left, top",t.position="fixed",this._dragFollow(e),t.transition="none",setTimeout(()=>{this.helper&&(t.transition=null)},0),this}_removeHelperStyle(){if(this.helper.classList.remove("ui-draggable-dragging"),this.el.gridstackNode?.grid?.el.classList.remove("grid-stack-dragging"),!this.helper?.gridstackNode?._isAboutToRemove&&this.dragElementOriginStyle){const t=this.helper,i=this.dragElementOriginStyle.transition||null;t.style.transition=this.dragElementOriginStyle.transition="none",Re.originStyleProp.forEach(r=>t.style[r]=this.dragElementOriginStyle[r]||null),setTimeout(()=>t.style.transition=i,50)}return delete this.dragElementOriginStyle,this}_dragFollow(e){const t={left:0,top:0},i=this.helper.style,r=this.dragOffset;i.left=(e.clientX+r.offsetLeft-t.left)*this.dragTransform.xScale+"px",i.top=(e.clientY+r.offsetTop-t.top)*this.dragTransform.yScale+"px"}_setupHelperContainmentStyle(){return this.helperContainment=this.helper.parentElement,this.helper.style.position!=="fixed"&&(this.parentOriginStylePosition=this.helperContainment.style.position,getComputedStyle(this.helperContainment).position.match(/static/)&&(this.helperContainment.style.position="relative")),this}_getDragOffset(e,t,i){let r=0,o=0;i&&(r=this.dragTransform.xOffset,o=this.dragTransform.yOffset);const n=t.getBoundingClientRect();return{left:n.left,top:n.top,offsetLeft:-e.clientX+n.left-r,offsetTop:-e.clientY+n.top-o,width:n.width*this.dragTransform.xScale,height:n.height*this.dragTransform.yScale}}ui(){const t=this.el.parentElement.getBoundingClientRect(),i=this.helper.getBoundingClientRect();return{position:{top:(i.top-t.top)*this.dragTransform.yScale,left:(i.left-t.left)*this.dragTransform.xScale}}}}Re.originStyleProp=["width","height","transform","transform-origin","transition","pointerEvents","position","left","top","minWidth","willChange"];class Us extends mt{constructor(e,t={}){super(),this.el=e,this.option=t,this._mouseEnter=this._mouseEnter.bind(this),this._mouseLeave=this._mouseLeave.bind(this),this.enable(),this._setupAccept()}on(e,t){super.on(e,t)}off(e){super.off(e)}enable(){this.disabled!==!1&&(super.enable(),this.el.classList.add("ui-droppable"),this.el.classList.remove("ui-droppable-disabled"),this.el.addEventListener("mouseenter",this._mouseEnter),this.el.addEventListener("mouseleave",this._mouseLeave),W&&(this.el.addEventListener("pointerenter",Gt),this.el.addEventListener("pointerleave",qt)))}disable(e=!1){this.disabled!==!0&&(super.disable(),this.el.classList.remove("ui-droppable"),e||this.el.classList.add("ui-droppable-disabled"),this.el.removeEventListener("mouseenter",this._mouseEnter),this.el.removeEventListener("mouseleave",this._mouseLeave),W&&(this.el.removeEventListener("pointerenter",Gt),this.el.removeEventListener("pointerleave",qt)))}destroy(){this.disable(!0),this.el.classList.remove("ui-droppable"),this.el.classList.remove("ui-droppable-disabled"),super.destroy()}updateOption(e){return Object.keys(e).forEach(t=>this.option[t]=e[t]),this._setupAccept(),this}_mouseEnter(e){if(!w.dragElement||!this._canDrop(w.dragElement.el))return;e.preventDefault(),e.stopPropagation(),w.dropElement&&w.dropElement!==this&&w.dropElement._mouseLeave(e,!0),w.dropElement=this;const t=c.initEvent(e,{target:this.el,type:"dropover"});this.option.over&&this.option.over(t,this._ui(w.dragElement)),this.triggerEvent("dropover",t),this.el.classList.add("ui-droppable-over")}_mouseLeave(e,t=!1){if(!w.dragElement||w.dropElement!==this)return;e.preventDefault(),e.stopPropagation();const i=c.initEvent(e,{target:this.el,type:"dropout"});if(this.option.out&&this.option.out(i,this._ui(w.dragElement)),this.triggerEvent("dropout",i),w.dropElement===this&&(delete w.dropElement,!t)){let r,o=this.el.parentElement;for(;!r&&o;)r=o.ddElement?.ddDroppable,o=o.parentElement;r&&r._mouseEnter(e)}}drop(e){e.preventDefault();const t=c.initEvent(e,{target:this.el,type:"drop"});this.option.drop&&this.option.drop(t,this._ui(w.dragElement)),this.triggerEvent("drop",t)}_canDrop(e){return e&&(!this.accept||this.accept(e))}_setupAccept(){return this.option.accept?(typeof this.option.accept=="string"?this.accept=e=>e.classList.contains(this.option.accept)||e.matches(this.option.accept):this.accept=this.option.accept,this):this}_ui(e){return{draggable:e.el,...e.ui()}}}class pt{static init(e){return e.ddElement||(e.ddElement=new pt(e)),e.ddElement}constructor(e){this.el=e}on(e,t){return this.ddDraggable&&["drag","dragstart","dragstop"].indexOf(e)>-1?this.ddDraggable.on(e,t):this.ddDroppable&&["drop","dropover","dropout"].indexOf(e)>-1?this.ddDroppable.on(e,t):this.ddResizable&&["resizestart","resize","resizestop"].indexOf(e)>-1&&this.ddResizable.on(e,t),this}off(e){return this.ddDraggable&&["drag","dragstart","dragstop"].indexOf(e)>-1?this.ddDraggable.off(e):this.ddDroppable&&["drop","dropover","dropout"].indexOf(e)>-1?this.ddDroppable.off(e):this.ddResizable&&["resizestart","resize","resizestop"].indexOf(e)>-1&&this.ddResizable.off(e),this}setupDraggable(e){return this.ddDraggable?this.ddDraggable.updateOption(e):this.ddDraggable=new Re(this.el,e),this}cleanDraggable(){return this.ddDraggable&&(this.ddDraggable.destroy(),delete this.ddDraggable),this}setupResizable(e){return this.ddResizable?this.ddResizable.updateOption(e):this.ddResizable=new Se(this.el,e),this}cleanResizable(){return this.ddResizable&&(this.ddResizable.destroy(),delete this.ddResizable),this}setupDroppable(e){return this.ddDroppable?this.ddDroppable.updateOption(e):this.ddDroppable=new Us(this.el,e),this}cleanDroppable(){return this.ddDroppable&&(this.ddDroppable.destroy(),delete this.ddDroppable),this}}class Fs{resizable(e,t,i,r){return this._getDDElements(e,t).forEach(o=>{if(t==="disable"||t==="enable")o.ddResizable&&o.ddResizable[t]();else if(t==="destroy")o.ddResizable&&o.cleanResizable();else if(t==="option")o.setupResizable({[i]:r});else{const a=o.el.gridstackNode.grid;let h=o.el.getAttribute("gs-resize-handles")||a.opts.resizable.handles||"e,s,se";h==="all"&&(h="n,e,s,w,se,sw,ne,nw");const l=!a.opts.alwaysShowResizeHandle;o.setupResizable({...a.opts.resizable,handles:h,autoHide:l,start:t.start,stop:t.stop,resize:t.resize})}}),this}draggable(e,t,i,r){return this._getDDElements(e,t).forEach(o=>{if(t==="disable"||t==="enable")o.ddDraggable&&o.ddDraggable[t]();else if(t==="destroy")o.ddDraggable&&o.cleanDraggable();else if(t==="option")o.setupDraggable({[i]:r});else{const n=o.el.gridstackNode.grid;o.setupDraggable({...n.opts.draggable,start:t.start,stop:t.stop,drag:t.drag})}}),this}dragIn(e,t){return this._getDDElements(e).forEach(i=>i.setupDraggable(t)),this}droppable(e,t,i,r){return typeof t.accept=="function"&&!t._accept&&(t._accept=t.accept,t.accept=o=>t._accept(o)),this._getDDElements(e,t).forEach(o=>{t==="disable"||t==="enable"?o.ddDroppable&&o.ddDroppable[t]():t==="destroy"?o.ddDroppable&&o.cleanDroppable():t==="option"?o.setupDroppable({[i]:r}):o.setupDroppable(t)}),this}isDroppable(e){return!!(e?.ddElement?.ddDroppable&&!e.ddElement.ddDroppable.disabled)}isDraggable(e){return!!(e?.ddElement?.ddDraggable&&!e.ddElement.ddDraggable.disabled)}isResizable(e){return!!(e?.ddElement?.ddResizable&&!e.ddElement.ddResizable.disabled)}on(e,t,i){return this._getDDElements(e).forEach(r=>r.on(t,o=>{i(o,w.dragElement?w.dragElement.el:o.target,w.dragElement?w.dragElement.helper:null)})),this}off(e,t){return this._getDDElements(e).forEach(i=>i.off(t)),this}_getDDElements(e,t){const i=e.gridstack||t!=="destroy"&&t!=="disable",r=c.getElements(e);return r.length?r.map(n=>n.ddElement||(i?pt.init(n):null)).filter(n=>n):[]}}const T=new Fs;class b{static init(e={},t=".grid-stack"){if(typeof document>"u")return null;const i=b.getGridElement(t);return i?(i.gridstack||(i.gridstack=new b(i,c.cloneDeep(e))),i.gridstack):(console.error(typeof t=="string"?'GridStack.initAll() no grid was found with selector "'+t+`" - element missing or wrong selector ?
|
|
233
227
|
Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the default selector.`:"GridStack.init() no grid element was passed."),null)}static initAll(e={},t=".grid-stack"){const i=[];return typeof document>"u"||(b.getGridElements(t).forEach(r=>{r.gridstack||(r.gridstack=new b(r,c.cloneDeep(e))),i.push(r.gridstack)}),i.length===0&&console.error('GridStack.initAll() no grid was found with selector "'+t+`" - element missing or wrong selector ?
|
|
234
228
|
Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the default selector.`)),i}static addGrid(e,t={}){if(!e)return null;let i=e;if(i.gridstack){const n=i.gridstack;return t&&(n.opts={...n.opts,...t}),t.children!==void 0&&n.load(t.children),n}return(!e.classList.contains("grid-stack")||b.addRemoveCB)&&(b.addRemoveCB?i=b.addRemoveCB(e,t,!0,!0):i=c.createDiv(["grid-stack",t.class],e)),b.init(t,i)}static registerEngine(e){b.engineClass=e}get placeholder(){if(!this._placeholder){this._placeholder=c.createDiv([this.opts.placeholderClass,L.itemClass,this.opts.itemClass]);const e=c.createDiv(["placeholder-content"],this._placeholder);this.opts.placeholderText&&(e.textContent=this.opts.placeholderText)}return this._placeholder}constructor(e,t={}){this.el=e,this.opts=t,this.animationDelay=310,this._gsEventHandler={},this._extraDragRow=0,this.dragTransform={xScale:1,yScale:1,xOffset:0,yOffset:0},e.gridstack=this,this.opts=t=t||{},e.classList.contains("grid-stack")||this.el.classList.add("grid-stack"),t.row&&(t.minRow=t.maxRow=t.row,delete t.row);const i=c.toNumber(e.getAttribute("gs-row"));t.column==="auto"&&delete t.column,t.alwaysShowResizeHandle!==void 0&&(t._alwaysShowResizeHandle=t.alwaysShowResizeHandle);const r=t.columnOpts;if(r){const l=r.breakpoints;!r.columnWidth&&!l?.length?delete t.columnOpts:(r.columnMax=r.columnMax||12,l?.length>1&&l.sort((d,u)=>(u.w||0)-(d.w||0)))}const o={...c.cloneDeep(L),column:c.toNumber(e.getAttribute("gs-column"))||L.column,minRow:i||c.toNumber(e.getAttribute("gs-min-row"))||L.minRow,maxRow:i||c.toNumber(e.getAttribute("gs-max-row"))||L.maxRow,staticGrid:c.toBool(e.getAttribute("gs-static"))||L.staticGrid,sizeToContent:c.toBool(e.getAttribute("gs-size-to-content"))||void 0,draggable:{handle:(t.handleClass?"."+t.handleClass:t.handle?t.handle:"")||L.draggable.handle},removableOptions:{accept:t.itemClass||L.removableOptions.accept,decline:L.removableOptions.decline}};e.getAttribute("gs-animate")&&(o.animate=c.toBool(e.getAttribute("gs-animate"))),t=c.defaults(t,o),this._initMargin(),this.checkDynamicColumn(),this._updateColumnVar(t),t.rtl==="auto"&&(t.rtl=e.style.direction==="rtl"),t.rtl&&this.el.classList.add("grid-stack-rtl");const a=this.el.closest("."+L.itemClass)?.gridstackNode;if(a&&(a.subGrid=this,this.parentGridNode=a,this.el.classList.add("grid-stack-nested"),a.el.classList.add("grid-stack-sub-grid")),this._isAutoCellHeight=t.cellHeight==="auto",this._isAutoCellHeight||t.cellHeight==="initial")this.cellHeight(void 0);else{typeof t.cellHeight=="number"&&t.cellHeightUnit&&t.cellHeightUnit!==L.cellHeightUnit&&(t.cellHeight=t.cellHeight+t.cellHeightUnit,delete t.cellHeightUnit);const l=t.cellHeight;delete t.cellHeight,this.cellHeight(l)}t.alwaysShowResizeHandle==="mobile"&&(t.alwaysShowResizeHandle=W),this._setStaticClass();const h=t.engineClass||b.engineClass||K;if(this.engine=new h({column:this.getColumn(),float:t.float,maxRow:t.maxRow,onChange:l=>{l.forEach(d=>{const u=d.el;u&&(d._removeDOM?(u&&u.remove(),delete d._removeDOM):this._writePosAttr(u,d))}),this._updateContainerHeight()}}),t.auto&&(this.batchUpdate(),this.engine._loading=!0,this.getGridItems().forEach(l=>this._prepareElement(l)),delete this.engine._loading,this.batchUpdate(!1)),t.children){const l=t.children;delete t.children,l.length&&this.load(l)}this.setAnimation(),t.subGridDynamic&&!w.pauseDrag&&(w.pauseDrag=!0),t.draggable?.pause!==void 0&&(w.pauseDrag=t.draggable.pause),this._setupRemoveDrop(),this._setupAcceptWidget(),this._updateResizeEvent()}_updateColumnVar(e=this.opts){this.el.classList.add("gs-"+e.column),typeof e.column=="number"&&this.el.style.setProperty("--gs-column-width",`${100/e.column}%`)}addWidget(e){if(!e)return;if(typeof e=="string"){console.error("V11: GridStack.addWidget() does not support string anymore. see #2736");return}if(e.ELEMENT_NODE)return console.error("V11: GridStack.addWidget() does not support HTMLElement anymore. use makeWidget()"),this.makeWidget(e);let t,i=e;if(i.grid=this,i.el?t=i.el:b.addRemoveCB?t=b.addRemoveCB(this.el,e,!0,!1):t=this.createWidgetDivs(i),!t)return;if(i=t.gridstackNode,i&&t.parentElement===this.el&&this.engine.nodes.find(o=>o._id===i._id))return t;const r=this._readAttr(t);return c.defaults(e,r),this.engine.prepareNode(e),this.el.appendChild(t),this.makeWidget(t,e),t}createWidgetDivs(e){const t=c.createDiv(["grid-stack-item",this.opts.itemClass]),i=c.createDiv(["grid-stack-item-content"],t);return c.lazyLoad(e)?e.visibleObservable||(e.visibleObservable=new IntersectionObserver(([r])=>{r.isIntersecting&&(e.visibleObservable?.disconnect(),delete e.visibleObservable,b.renderCB(i,e),e.grid?.prepareDragDrop(e.el))}),window.setTimeout(()=>e.visibleObservable?.observe(t))):b.renderCB(i,e),t}makeSubGrid(e,t,i,r=!0){let o=e.gridstackNode;if(o||(o=this.makeWidget(e).gridstackNode),o.subGrid?.el)return o.subGrid;let n,a=this;for(;a&&!n;)n=a.opts?.subGridOpts,a=a.parentGridNode?.grid;t=c.cloneDeep({...this.opts,id:void 0,children:void 0,column:"auto",columnOpts:void 0,layout:"list",subGridOpts:void 0,...n||{},...t||o.subGridOpts||{}}),o.subGridOpts=t;let h;t.column==="auto"&&(h=!0,t.column=Math.max(o.w||1,i?.w||1),delete t.columnOpts);let l=o.el.querySelector(".grid-stack-item-content"),d,u;if(r&&(this._removeDD(o.el),u={...o,x:0,y:0},c.removeInternalForSave(u),delete u.subGridOpts,o.content&&(u.content=o.content,delete o.content),b.addRemoveCB?d=b.addRemoveCB(this.el,u,!0,!1):(d=c.createDiv(["grid-stack-item"]),d.appendChild(l),l=c.createDiv(["grid-stack-item-content"],o.el)),this.prepareDragDrop(o.el)),i){const f=h?t.column:o.w,y=o.h+i.h,E=o.el.style;E.transition="none",this.update(o.el,{w:f,h:y}),setTimeout(()=>E.transition=null)}const p=o.subGrid=b.addGrid(l,t);return i?._moving&&(p._isTemp=!0),h&&(p._autoColumn=!0),r&&p.makeWidget(d,u),i&&(i._moving?window.setTimeout(()=>c.simulateMouseEvent(i._event,"mouseenter",p.el),0):p.makeWidget(o.el,o)),this.resizeToContentCheck(!1,o),p}removeAsSubGrid(e){const t=this.parentGridNode?.grid;t&&(t.batchUpdate(),t.removeWidget(this.parentGridNode.el,!0,!0),this.engine.nodes.forEach(i=>{i.x+=this.parentGridNode.x,i.y+=this.parentGridNode.y,t.makeWidget(i.el,i)}),t.batchUpdate(!1),this.parentGridNode&&delete this.parentGridNode.subGrid,delete this.parentGridNode,e&&window.setTimeout(()=>c.simulateMouseEvent(e._event,"mouseenter",t.el),0))}save(e=!0,t=!1,i=b.saveCB,r){const o=this.engine.save(e,i,r);if(o.forEach(n=>{if(e&&n.el&&!n.subGrid&&!i){const a=n.el.querySelector(".grid-stack-item-content");n.content=a?.innerHTML,n.content||delete n.content}else if(!e&&!i&&delete n.content,n.subGrid?.el){const a=n.w||n.subGrid.getColumn(),h=n.subGrid.save(e,t,i,a);n.subGridOpts=t?h:{children:h},delete n.subGrid}delete n.el}),t){const n=c.cloneDeep(this.opts);n.marginBottom===n.marginTop&&n.marginRight===n.marginLeft&&n.marginTop===n.marginRight&&(n.margin=n.marginTop,delete n.marginTop,delete n.marginRight,delete n.marginBottom,delete n.marginLeft),n.rtl===(this.el.style.direction==="rtl")&&(n.rtl="auto"),this._isAutoCellHeight&&(n.cellHeight="auto"),this._autoColumn&&(n.column="auto");const a=n._alwaysShowResizeHandle;return delete n._alwaysShowResizeHandle,a!==void 0?n.alwaysShowResizeHandle=a:delete n.alwaysShowResizeHandle,c.removeInternalAndSame(n,L),n.children=o,n}return o}load(e,t=b.addRemoveCB||!0){e=c.cloneDeep(e);const i=this.getColumn();e.forEach(d=>{d.w=d.w||d.minW||1,d.h=d.h||d.minH||1}),e=c.sort(e),this.engine.skipCacheUpdate=this._ignoreLayoutsNodeChange=!0;let r=0;e.forEach(d=>{r=Math.max(r,(d.x||0)+d.w)}),r>this.engine.defaultColumn&&(this.engine.defaultColumn=r),r>i&&(this.engine.nodes.length===0&&this.responseLayout?(this.engine.nodes=e,this.engine.columnChanged(r,i,this.responseLayout),e=this.engine.nodes,this.engine.nodes=[],delete this.responseLayout):this.engine.cacheLayout(e,r,!0));const o=b.addRemoveCB;typeof t=="function"&&(b.addRemoveCB=t);const n=[];this.batchUpdate();const a=!this.engine.nodes.length,h=a&&this.opts.animate;h&&this.setAnimation(!1),!a&&t&&[...this.engine.nodes].forEach(u=>{if(!u.id)return;c.find(e,u.id)||(b.addRemoveCB&&b.addRemoveCB(this.el,u,!1,!1),n.push(u),this.removeWidget(u.el,!0,!1))}),this.engine._loading=!0;const l=[];return this.engine.nodes=this.engine.nodes.filter(d=>c.find(e,d.id)?(l.push(d),!1):!0),e.forEach(d=>{const u=c.find(l,d.id);if(u){if(c.shouldSizeToContent(u)&&(d.h=u.h),this.engine.nodeBoundFix(d),(d.autoPosition||d.x===void 0||d.y===void 0)&&(d.w=d.w||u.w,d.h=d.h||u.h,this.engine.findEmptyPosition(d)),this.engine.nodes.push(u),c.samePos(u,d)&&this.engine.nodes.length>1&&(this.moveNode(u,{...d,forceCollide:!0}),c.copyPos(d,u)),this.update(u.el,d),d.subGridOpts?.children){const p=u.el.querySelector(".grid-stack");p&&p.gridstack&&p.gridstack.load(d.subGridOpts.children)}}else t&&this.addWidget(d)}),delete this.engine._loading,this.engine.removedNodes=n,this.batchUpdate(!1),delete this._ignoreLayoutsNodeChange,delete this.engine.skipCacheUpdate,o?b.addRemoveCB=o:delete b.addRemoveCB,h&&this.setAnimation(!0,!0),this}batchUpdate(e=!0){return this.engine.batchUpdate(e),e||(this._updateContainerHeight(),this._triggerRemoveEvent(),this._triggerAddEvent(),this._triggerChangeEvent()),this}getCellHeight(e=!1){if(this.opts.cellHeight&&this.opts.cellHeight!=="auto"&&(!e||!this.opts.cellHeightUnit||this.opts.cellHeightUnit==="px"))return this.opts.cellHeight;if(this.opts.cellHeightUnit==="rem")return this.opts.cellHeight*parseFloat(getComputedStyle(document.documentElement).fontSize);if(this.opts.cellHeightUnit==="em")return this.opts.cellHeight*parseFloat(getComputedStyle(this.el).fontSize);if(this.opts.cellHeightUnit==="cm")return this.opts.cellHeight*(96/2.54);if(this.opts.cellHeightUnit==="mm")return this.opts.cellHeight*(96/2.54)/10;const t=this.el.querySelector("."+this.opts.itemClass);if(t){const r=c.toNumber(t.getAttribute("gs-h"))||1;return Math.round(t.offsetHeight/r)}const i=parseInt(this.el.getAttribute("gs-current-row"));return i?Math.round(this.el.getBoundingClientRect().height/i):this.opts.cellHeight}cellHeight(e){if(e!==void 0&&this._isAutoCellHeight!==(e==="auto")&&(this._isAutoCellHeight=e==="auto",this._updateResizeEvent()),(e==="initial"||e==="auto")&&(e=void 0),e===void 0){const i=-this.opts.marginRight-this.opts.marginLeft+this.opts.marginTop+this.opts.marginBottom;e=this.cellWidth()+i}const t=c.parseHeight(e);return this.opts.cellHeightUnit===t.unit&&this.opts.cellHeight===t.h?this:(this.opts.cellHeightUnit=t.unit,this.opts.cellHeight=t.h,this.el.style.setProperty("--gs-cell-height",`${this.opts.cellHeight}${this.opts.cellHeightUnit}`),this._updateContainerHeight(),this.resizeToContentCheck(),this)}cellWidth(){return this._widthOrContainer()/this.getColumn()}_widthOrContainer(e=!1){return e&&this.opts.columnOpts?.breakpointForWindow?window.innerWidth:this.el.clientWidth||this.el.parentElement.clientWidth||window.innerWidth}checkDynamicColumn(){const e=this.opts.columnOpts;if(!e||!e.columnWidth&&!e.breakpoints?.length)return!1;const t=this.getColumn();let i=t;const r=this._widthOrContainer(!0);if(e.columnWidth)i=Math.min(Math.round(r/e.columnWidth)||1,e.columnMax);else{i=e.columnMax;let o=0;for(;o<e.breakpoints.length&&r<=e.breakpoints[o].w;)i=e.breakpoints[o++].c||t}if(i!==t){const o=e.breakpoints?.find(n=>n.c===i);return this.column(i,o?.layout||e.layout),!0}return!1}compact(e="compact",t=!0){return this.engine.compact(e,t),this._triggerChangeEvent(),this}column(e,t="moveScale"){if(!e||e<1||this.opts.column===e)return this;const i=this.getColumn();return this.opts.column=e,this.engine?(this.engine.column=e,this.el.classList.remove("gs-"+i),this._updateColumnVar(),this.engine.columnChanged(i,e,t),this._isAutoCellHeight&&this.cellHeight(),this.resizeToContentCheck(!0),this._ignoreLayoutsNodeChange=!0,this._triggerChangeEvent(),delete this._ignoreLayoutsNodeChange,this):(this.responseLayout=t,this)}getColumn(){return this.opts.column}getGridItems(){return Array.from(this.el.children).filter(e=>e.matches("."+this.opts.itemClass)&&!e.matches("."+this.opts.placeholderClass))}isIgnoreChangeCB(){return this._ignoreLayoutsNodeChange}destroy(e=!0){if(this.el)return this.offAll(),this._updateResizeEvent(!0),this.setStatic(!0,!1),this.setAnimation(!1),e?this.el.parentNode.removeChild(this.el):(this.removeAll(e),this.el.removeAttribute("gs-current-row")),this.parentGridNode&&delete this.parentGridNode.subGrid,delete this.parentGridNode,delete this.opts,delete this._placeholder?.gridstackNode,delete this._placeholder,delete this.engine,delete this.el.gridstack,delete this.el,this}float(e){return this.opts.float!==e&&(this.opts.float=this.engine.float=e,this._triggerChangeEvent()),this}getFloat(){return this.engine.float}getCellFromPixel(e,t=!1){const i=this.el.getBoundingClientRect();let r;t?r={top:i.top+document.documentElement.scrollTop,left:i.left}:r={top:this.el.offsetTop,left:this.el.offsetLeft};const o=e.left-r.left,n=e.top-r.top,a=i.width/this.getColumn(),h=i.height/parseInt(this.el.getAttribute("gs-current-row"));return{x:Math.floor(o/a),y:Math.floor(n/h)}}getRow(){return Math.max(this.engine.getRow(),this.opts.minRow||0)}isAreaEmpty(e,t,i,r){return this.engine.isAreaEmpty(e,t,i,r)}makeWidget(e,t){const i=b.getElement(e);if(!i||i.gridstackNode)return i;i.parentElement||this.el.appendChild(i),this._prepareElement(i,!0,t);const r=i.gridstackNode;this._updateContainerHeight(),r.subGridOpts&&this.makeSubGrid(i,r.subGridOpts,void 0,!1);let o;return this.opts.column===1&&!this._ignoreLayoutsNodeChange&&(o=this._ignoreLayoutsNodeChange=!0),this._triggerAddEvent(),this._triggerChangeEvent(),o&&delete this._ignoreLayoutsNodeChange,i}on(e,t){return e.indexOf(" ")!==-1?(e.split(" ").forEach(r=>this.on(r,t)),this):(e==="change"||e==="added"||e==="removed"||e==="enable"||e==="disable"?(e==="enable"||e==="disable"?this._gsEventHandler[e]=r=>t(r):this._gsEventHandler[e]=r=>{r.detail&&t(r,r.detail)},this.el.addEventListener(e,this._gsEventHandler[e])):e==="drag"||e==="dragstart"||e==="dragstop"||e==="resizestart"||e==="resize"||e==="resizestop"||e==="dropped"||e==="resizecontent"?this._gsEventHandler[e]=t:console.error("GridStack.on("+e+") event not supported"),this)}off(e){return e.indexOf(" ")!==-1?(e.split(" ").forEach(i=>this.off(i)),this):((e==="change"||e==="added"||e==="removed"||e==="enable"||e==="disable")&&this._gsEventHandler[e]&&this.el.removeEventListener(e,this._gsEventHandler[e]),delete this._gsEventHandler[e],this)}offAll(){return Object.keys(this._gsEventHandler).forEach(e=>this.off(e)),this}removeWidget(e,t=!0,i=!0){return e?(b.getElements(e).forEach(r=>{if(r.parentElement&&r.parentElement!==this.el)return;let o=r.gridstackNode;o||(o=this.engine.nodes.find(n=>r===n.el)),o&&(t&&b.addRemoveCB&&b.addRemoveCB(this.el,o,!1,!1),delete r.gridstackNode,this._removeDD(r),this.engine.removeNode(o,t,i),t&&r.parentElement&&r.remove())}),i&&(this._triggerRemoveEvent(),this._triggerChangeEvent()),this):(console.error("Error: GridStack.removeWidget(undefined) called"),this)}removeAll(e=!0,t=!0){return this.engine.nodes.forEach(i=>{e&&b.addRemoveCB&&b.addRemoveCB(this.el,i,!1,!1),delete i.el.gridstackNode,this.opts.staticGrid||this._removeDD(i.el)}),this.engine.removeAll(e,t),t&&this._triggerRemoveEvent(),this}setAnimation(e=this.opts.animate,t){return t?setTimeout(()=>{this.opts&&this.setAnimation(e)}):e?this.el.classList.add("grid-stack-animate"):this.el.classList.remove("grid-stack-animate"),this.opts.animate=e,this}hasAnimationCSS(){return this.el.classList.contains("grid-stack-animate")}setStatic(e,t=!0,i=!0){return!!this.opts.staticGrid===e?this:(e?this.opts.staticGrid=!0:delete this.opts.staticGrid,this._setupRemoveDrop(),this._setupAcceptWidget(),this.engine.nodes.forEach(r=>{this.prepareDragDrop(r.el),r.subGrid&&i&&r.subGrid.setStatic(e,t,i)}),t&&this._setStaticClass(),this)}updateOptions(e){const t=this.opts;return e===t?this:(e.acceptWidgets!==void 0&&(t.acceptWidgets=e.acceptWidgets,this._setupAcceptWidget()),e.animate!==void 0&&this.setAnimation(e.animate),e.cellHeight&&this.cellHeight(e.cellHeight),e.class!==void 0&&e.class!==t.class&&(t.class&&this.el.classList.remove(t.class),e.class&&this.el.classList.add(e.class)),e.columnOpts?(this.opts.columnOpts=e.columnOpts,this.checkDynamicColumn()):e.columnOpts===null&&this.opts.columnOpts?(delete this.opts.columnOpts,this._updateResizeEvent()):typeof e.column=="number"&&this.column(e.column),e.margin!==void 0&&this.margin(e.margin),e.staticGrid!==void 0&&this.setStatic(e.staticGrid),e.disableDrag!==void 0&&!e.staticGrid&&this.enableMove(!e.disableDrag),e.disableResize!==void 0&&!e.staticGrid&&this.enableResize(!e.disableResize),e.float!==void 0&&this.float(e.float),e.row!==void 0?(t.minRow=t.maxRow=t.row=e.row,this._updateContainerHeight()):(e.minRow!==void 0&&(t.minRow=e.minRow,this._updateContainerHeight()),e.maxRow!==void 0&&(t.maxRow=e.maxRow)),e.children?.length&&this.load(e.children),this)}update(e,t){return b.getElements(e).forEach(i=>{const r=i?.gridstackNode;if(!r)return;const o={...c.copyPos({},r),...c.cloneDeep(t)};this.engine.nodeBoundFix(o),delete o.autoPosition;const n=["x","y","w","h"];let a;if(n.some(d=>o[d]!==void 0&&o[d]!==r[d])&&(a={},n.forEach(d=>{a[d]=o[d]!==void 0?o[d]:r[d],delete o[d]})),!a&&(o.minW||o.minH||o.maxW||o.maxH)&&(a={}),o.content!==void 0){const d=i.querySelector(".grid-stack-item-content");d&&d.textContent!==o.content&&(r.content=o.content,b.renderCB(d,o),r.subGrid?.el&&(d.appendChild(r.subGrid.el),r.subGrid._updateContainerHeight())),delete o.content}let h=!1,l=!1;for(const d in o)d[0]!=="_"&&r[d]!==o[d]&&(r[d]=o[d],h=!0,l=l||!this.opts.staticGrid&&(d==="noResize"||d==="noMove"||d==="locked"));if(c.sanitizeMinMax(r),a){const d=a.w!==void 0&&a.w!==r.w;this.moveNode(r,a),d&&r.subGrid?r.subGrid.onResize(this.hasAnimationCSS()?r.w:void 0):this.resizeToContentCheck(d,r),delete r._orig}(a||h)&&this._writeAttr(i,r),l&&this.prepareDragDrop(r.el),b.updateCB&&b.updateCB(r)}),this}moveNode(e,t){const i=e._updating;i||this.engine.cleanNodes().beginUpdate(e),this.engine.moveNode(e,t),this._updateContainerHeight(),i||(this._triggerChangeEvent(),this.engine.endUpdate())}resizeToContent(e){if(!e||(e.classList.remove("size-to-content-max"),!e.clientHeight))return;const t=e.gridstackNode;if(!t)return;const i=t.grid;if(!i||e.parentElement!==i.el)return;const r=i.getCellHeight(!0);if(!r)return;let o=t.h?t.h*r:e.clientHeight,n;if(t.resizeToContentParent&&(n=e.querySelector(t.resizeToContentParent)),n||(n=e.querySelector(b.resizeToContentParent)),!n)return;const a=e.clientHeight-n.clientHeight,h=t.h?t.h*r-a:n.clientHeight;let l;if(t.subGrid){l=t.subGrid.getRow()*t.subGrid.getCellHeight(!0);const p=t.subGrid.el.getBoundingClientRect(),f=e.getBoundingClientRect();l+=p.top-f.top}else{if(t.subGridOpts?.children?.length)return;{const p=n.firstElementChild;if(!p){console.error(`Error: GridStack.resizeToContent() widget id:${t.id} '${b.resizeToContentParent}'.firstElementChild is null, make sure to have a div like container. Skipping sizing.`);return}l=p.getBoundingClientRect().height||h}}if(h===l)return;o+=l-h;let d=Math.ceil(o/r);const u=Number.isInteger(t.sizeToContent)?t.sizeToContent:0;u&&d>u&&(d=u,e.classList.add("size-to-content-max")),t.minH&&d<t.minH?d=t.minH:t.maxH&&d>t.maxH&&(d=t.maxH),d!==t.h&&(i._ignoreLayoutsNodeChange=!0,i.moveNode(t,{h:d}),delete i._ignoreLayoutsNodeChange)}resizeToContentCBCheck(e){b.resizeToContentCB?b.resizeToContentCB(e):this.resizeToContent(e)}rotate(e,t){return b.getElements(e).forEach(i=>{const r=i.gridstackNode;if(!c.canBeRotated(r))return;const o={w:r.h,h:r.w,minH:r.minW,minW:r.minH,maxH:r.maxW,maxW:r.maxH};if(t){const a=t.left>0?Math.floor(t.left/this.cellWidth()):0,h=t.top>0?Math.floor(t.top/this.opts.cellHeight):0;o.x=r.x+a-(r.h-(h+1)),o.y=r.y+h-a}Object.keys(o).forEach(a=>{o[a]===void 0&&delete o[a]});const n=r._orig;this.update(i,o),r._orig=n}),this}margin(e){if(!(typeof e=="string"&&e.split(" ").length>1)){const i=c.parseHeight(e);if(this.opts.marginUnit===i.unit&&this.opts.margin===i.h)return}return this.opts.margin=e,this.opts.marginTop=this.opts.marginBottom=this.opts.marginLeft=this.opts.marginRight=void 0,this._initMargin(),this}getMargin(){return this.opts.margin}willItFit(e){if(arguments.length>1){console.warn("gridstack.ts: `willItFit(x,y,w,h,autoPosition)` is deprecated. Use `willItFit({x, y,...})`. It will be removed soon");const t=arguments;let i=0,r={x:t[i++],y:t[i++],w:t[i++],h:t[i++],autoPosition:t[i++]};return this.willItFit(r)}return this.engine.willItFit(e)}_triggerChangeEvent(){if(this.engine.batchMode)return this;const e=this.engine.getDirtyNodes(!0);return e&&e.length&&(this._ignoreLayoutsNodeChange||this.engine.layoutsNodesChange(e),this._triggerEvent("change",e)),this.engine.saveInitial(),this}_triggerAddEvent(){if(this.engine.batchMode)return this;if(this.engine.addedNodes?.length){this._ignoreLayoutsNodeChange||this.engine.layoutsNodesChange(this.engine.addedNodes),this.engine.addedNodes.forEach(t=>{delete t._dirty});const e=[...this.engine.addedNodes];this.engine.addedNodes=[],this._triggerEvent("added",e)}return this}_triggerRemoveEvent(){if(this.engine.batchMode)return this;if(this.engine.removedNodes?.length){const e=[...this.engine.removedNodes];this.engine.removedNodes=[],this._triggerEvent("removed",e)}return this}_triggerEvent(e,t){const i=t?new CustomEvent(e,{bubbles:!1,detail:t}):new Event(e);let r=this;for(;r.parentGridNode;)r=r.parentGridNode.grid;return r.el.dispatchEvent(i),this}_updateContainerHeight(){if(!this.engine||this.engine.batchMode)return this;const e=this.parentGridNode;let t=this.getRow()+this._extraDragRow;const i=this.opts.cellHeight,r=this.opts.cellHeightUnit;if(!i)return this;if(!e&&!this.opts.minRow){const o=c.parseHeight(getComputedStyle(this.el).minHeight);if(o.h>0&&o.unit===r){const n=Math.floor(o.h/i);t<n&&(t=n)}}return this.el.setAttribute("gs-current-row",String(t)),this.el.style.removeProperty("min-height"),this.el.style.removeProperty("height"),t&&(this.el.style[e?"minHeight":"height"]=t*i+r),e&&c.shouldSizeToContent(e)&&e.grid.resizeToContentCBCheck(e.el),this}_prepareElement(e,t=!1,i){i=i||this._readAttr(e),e.gridstackNode=i,i.el=e,i.grid=this,i=this.engine.addNode(i,t),this._writeAttr(e,i),e.classList.add(L.itemClass,this.opts.itemClass);const r=c.shouldSizeToContent(i);return r?e.classList.add("size-to-content"):e.classList.remove("size-to-content"),r&&this.resizeToContentCheck(!1,i),c.lazyLoad(i)||this.prepareDragDrop(i.el),this}_writePosAttr(e,t){return(!t._moving&&!t._resizing||this._placeholder===e)&&(e.style.top=t.y?t.y===1?"var(--gs-cell-height)":`calc(${t.y} * var(--gs-cell-height))`:null,e.style.left=t.x?t.x===1?"var(--gs-column-width)":`calc(${t.x} * var(--gs-column-width))`:null,e.style.width=t.w>1?`calc(${t.w} * var(--gs-column-width))`:null,e.style.height=t.h>1?`calc(${t.h} * var(--gs-cell-height))`:null),t.x>0?e.setAttribute("gs-x",String(t.x)):e.removeAttribute("gs-x"),t.y>0?e.setAttribute("gs-y",String(t.y)):e.removeAttribute("gs-y"),t.w>1?e.setAttribute("gs-w",String(t.w)):e.removeAttribute("gs-w"),t.h>1?e.setAttribute("gs-h",String(t.h)):e.removeAttribute("gs-h"),this}_writeAttr(e,t){if(!t)return this;this._writePosAttr(e,t);const i={noResize:"gs-no-resize",noMove:"gs-no-move",locked:"gs-locked",id:"gs-id",sizeToContent:"gs-size-to-content"};for(const r in i)t[r]?e.setAttribute(i[r],String(t[r])):e.removeAttribute(i[r]);return this}_readAttr(e,t=!0){const i={};i.x=c.toNumber(e.getAttribute("gs-x")),i.y=c.toNumber(e.getAttribute("gs-y")),i.w=c.toNumber(e.getAttribute("gs-w")),i.h=c.toNumber(e.getAttribute("gs-h")),i.autoPosition=c.toBool(e.getAttribute("gs-auto-position")),i.noResize=c.toBool(e.getAttribute("gs-no-resize")),i.noMove=c.toBool(e.getAttribute("gs-no-move")),i.locked=c.toBool(e.getAttribute("gs-locked"));const r=e.getAttribute("gs-size-to-content");r&&(r==="true"||r==="false"?i.sizeToContent=c.toBool(r):i.sizeToContent=parseInt(r,10)),i.id=e.getAttribute("gs-id"),i.maxW=c.toNumber(e.getAttribute("gs-max-w")),i.minW=c.toNumber(e.getAttribute("gs-min-w")),i.maxH=c.toNumber(e.getAttribute("gs-max-h")),i.minH=c.toNumber(e.getAttribute("gs-min-h")),t&&(i.w===1&&e.removeAttribute("gs-w"),i.h===1&&e.removeAttribute("gs-h"),i.maxW&&e.removeAttribute("gs-max-w"),i.minW&&e.removeAttribute("gs-min-w"),i.maxH&&e.removeAttribute("gs-max-h"),i.minH&&e.removeAttribute("gs-min-h"));for(const o in i){if(!i.hasOwnProperty(o))return;!i[o]&&i[o]!==0&&o!=="sizeToContent"&&delete i[o]}return i}_setStaticClass(){const e=["grid-stack-static"];return this.opts.staticGrid?(this.el.classList.add(...e),this.el.setAttribute("gs-static","true")):(this.el.classList.remove(...e),this.el.removeAttribute("gs-static")),this}onResize(e=this.el?.clientWidth){if(!e||this.prevWidth===e)return;this.prevWidth=e,this.batchUpdate();let t=!1;return this._autoColumn&&this.parentGridNode?this.opts.column!==this.parentGridNode.w&&(this.column(this.parentGridNode.w,this.opts.layout||"list"),t=!0):t=this.checkDynamicColumn(),this._isAutoCellHeight&&this.cellHeight(),this.engine.nodes.forEach(i=>{i.subGrid&&i.subGrid.onResize()}),this._skipInitialResize||this.resizeToContentCheck(t),delete this._skipInitialResize,this.batchUpdate(!1),this}resizeToContentCheck(e=!1,t=void 0){if(this.engine){if(e&&this.hasAnimationCSS())return setTimeout(()=>this.resizeToContentCheck(!1,t),this.animationDelay);if(t)c.shouldSizeToContent(t)&&this.resizeToContentCBCheck(t.el);else if(this.engine.nodes.some(i=>c.shouldSizeToContent(i))){const i=[...this.engine.nodes];this.batchUpdate(),i.forEach(r=>{c.shouldSizeToContent(r)&&this.resizeToContentCBCheck(r.el)}),this._ignoreLayoutsNodeChange=!0,this.batchUpdate(!1),this._ignoreLayoutsNodeChange=!1}this._gsEventHandler.resizecontent&&this._gsEventHandler.resizecontent(null,t?[t]:this.engine.nodes)}}_updateResizeEvent(e=!1){const t=!this.parentGridNode&&(this._isAutoCellHeight||this.opts.sizeToContent||this.opts.columnOpts||this.engine.nodes.find(i=>i.sizeToContent));return!e&&t&&!this.resizeObserver?(this._sizeThrottle=c.throttle(()=>this.onResize(),this.opts.cellHeightThrottle),this.resizeObserver=new ResizeObserver(()=>this._sizeThrottle()),this.resizeObserver.observe(this.el),this._skipInitialResize=!0):(e||!t)&&this.resizeObserver&&(this.resizeObserver.disconnect(),delete this.resizeObserver,delete this._sizeThrottle),this}static getElement(e=".grid-stack-item"){return c.getElement(e)}static getElements(e=".grid-stack-item"){return c.getElements(e)}static getGridElement(e){return b.getElement(e)}static getGridElements(e){return c.getElements(e)}_initMargin(){let e,t=0,i=[];typeof this.opts.margin=="string"&&(i=this.opts.margin.split(" ")),i.length===2?(this.opts.marginTop=this.opts.marginBottom=i[0],this.opts.marginLeft=this.opts.marginRight=i[1]):i.length===4?(this.opts.marginTop=i[0],this.opts.marginRight=i[1],this.opts.marginBottom=i[2],this.opts.marginLeft=i[3]):(e=c.parseHeight(this.opts.margin),this.opts.marginUnit=e.unit,t=this.opts.margin=e.h),["marginTop","marginRight","marginBottom","marginLeft"].forEach(n=>{this.opts[n]===void 0?this.opts[n]=t:(e=c.parseHeight(this.opts[n]),this.opts[n]=e.h,delete this.opts.margin)}),this.opts.marginUnit=e.unit,this.opts.marginTop===this.opts.marginBottom&&this.opts.marginLeft===this.opts.marginRight&&this.opts.marginTop===this.opts.marginRight&&(this.opts.margin=this.opts.marginTop);const o=this.el.style;return o.setProperty("--gs-item-margin-top",`${this.opts.marginTop}${this.opts.marginUnit}`),o.setProperty("--gs-item-margin-bottom",`${this.opts.marginBottom}${this.opts.marginUnit}`),o.setProperty("--gs-item-margin-right",`${this.opts.marginRight}${this.opts.marginUnit}`),o.setProperty("--gs-item-margin-left",`${this.opts.marginLeft}${this.opts.marginUnit}`),this}static getDD(){return T}static setupDragIn(e,t,i,r=document){t?.pause!==void 0&&(w.pauseDrag=t.pause),t={appendTo:"body",helper:"clone",...t||{}},(typeof e=="string"?c.getElements(e,r):e).forEach((n,a)=>{T.isDraggable(n)||T.dragIn(n,t),i?.[a]&&(n.gridstackNode=i[a])})}movable(e,t){return this.opts.staticGrid?this:(b.getElements(e).forEach(i=>{const r=i.gridstackNode;r&&(t?delete r.noMove:r.noMove=!0,this.prepareDragDrop(r.el))}),this)}resizable(e,t){return this.opts.staticGrid?this:(b.getElements(e).forEach(i=>{const r=i.gridstackNode;r&&(t?delete r.noResize:r.noResize=!0,this.prepareDragDrop(r.el))}),this)}disable(e=!0){if(!this.opts.staticGrid)return this.enableMove(!1,e),this.enableResize(!1,e),this._triggerEvent("disable"),this}enable(e=!0){if(!this.opts.staticGrid)return this.enableMove(!0,e),this.enableResize(!0,e),this._triggerEvent("enable"),this}enableMove(e,t=!0){return this.opts.staticGrid?this:(e?delete this.opts.disableDrag:this.opts.disableDrag=!0,this.engine.nodes.forEach(i=>{this.prepareDragDrop(i.el),i.subGrid&&t&&i.subGrid.enableMove(e,t)}),this)}enableResize(e,t=!0){return this.opts.staticGrid?this:(e?delete this.opts.disableResize:this.opts.disableResize=!0,this.engine.nodes.forEach(i=>{this.prepareDragDrop(i.el),i.subGrid&&t&&i.subGrid.enableResize(e,t)}),this)}cancelDrag(){const e=this._placeholder?.gridstackNode;e&&(e._isExternal?(e._isAboutToRemove=!0,this.engine.removeNode(e)):e._isAboutToRemove&&b._itemRemoving(e.el,!1),this.engine.restoreInitial())}_removeDD(e){return T.draggable(e,"destroy").resizable(e,"destroy"),e.gridstackNode&&delete e.gridstackNode._initDD,delete e.ddElement,this}_setupAcceptWidget(){if(this.opts.staticGrid||!this.opts.acceptWidgets&&!this.opts.removable)return T.droppable(this.el,"destroy"),this;let e,t;const i=(r,o,n)=>{n=n||o;const a=n.gridstackNode;if(!a)return;if(!a.grid?.el){n.style.transform=`scale(${1/this.dragTransform.xScale},${1/this.dragTransform.yScale})`;const p=n.getBoundingClientRect();n.style.left=p.x+(this.dragTransform.xScale-1)*(r.clientX-p.x)/this.dragTransform.xScale+"px",n.style.top=p.y+(this.dragTransform.yScale-1)*(r.clientY-p.y)/this.dragTransform.yScale+"px",n.style.transformOrigin="0px 0px"}let{top:h,left:l}=n.getBoundingClientRect();const d=this.el.getBoundingClientRect();l-=d.left,h-=d.top;const u={position:{top:h*this.dragTransform.xScale,left:l*this.dragTransform.yScale}};if(a._temporaryRemoved){if(a.x=Math.max(0,Math.round(l/t)),a.y=Math.max(0,Math.round(h/e)),delete a.autoPosition,this.engine.nodeBoundFix(a),!this.engine.willItFit(a)){if(a.autoPosition=!0,!this.engine.willItFit(a)){T.off(o,"drag");return}a._willFitPos&&(c.copyPos(a,a._willFitPos),delete a._willFitPos)}this._onStartMoving(n,r,u,a,t,e)}else this._dragOrResize(n,r,u,a,t,e)};return T.droppable(this.el,{accept:r=>{const o=r.gridstackNode||this._readAttr(r,!1);if(o?.grid===this)return!0;if(!this.opts.acceptWidgets)return!1;let n=!0;if(typeof this.opts.acceptWidgets=="function")n=this.opts.acceptWidgets(r);else{const a=this.opts.acceptWidgets===!0?".grid-stack-item":this.opts.acceptWidgets;n=r.matches(a)}if(n&&o&&this.opts.maxRow){const a={w:o.w,h:o.h,minW:o.minW,minH:o.minH};n=this.engine.willItFit(a)}return n}}).on(this.el,"dropover",(r,o,n)=>{let a=n?.gridstackNode||o.gridstackNode;if(a?.grid===this&&!a._temporaryRemoved)return!1;if(a?._sidebarOrig&&(a.w=a._sidebarOrig.w,a.h=a._sidebarOrig.h),a?.grid&&a.grid!==this&&!a._temporaryRemoved&&a.grid._leave(o,n),n=n||o,t=this.cellWidth(),e=this.getCellHeight(!0),!a){const d=n.getAttribute("data-gs-widget")||n.getAttribute("gridstacknode");if(d){try{a=JSON.parse(d)}catch{console.error("Gridstack dropover: Bad JSON format: ",d)}n.removeAttribute("data-gs-widget"),n.removeAttribute("gridstacknode")}a||(a=this._readAttr(n)),a._sidebarOrig={w:a.w,h:a.h}}a.grid||(a.el||(a={...a}),a._isExternal=!0,n.gridstackNode=a);const h=a.w||Math.round(n.offsetWidth/t)||1,l=a.h||Math.round(n.offsetHeight/e)||1;return a.grid&&a.grid!==this?(o._gridstackNodeOrig||(o._gridstackNodeOrig=a),o.gridstackNode=a={...a,w:h,h:l,grid:this},delete a.x,delete a.y,this.engine.cleanupNode(a).nodeBoundFix(a),a._initDD=a._isExternal=a._temporaryRemoved=!0):(a.w=h,a.h=l,a._temporaryRemoved=!0),b._itemRemoving(a.el,!1),T.on(o,"drag",i),i(r,o,n),!1}).on(this.el,"dropout",(r,o,n)=>{const a=n?.gridstackNode||o.gridstackNode;return a&&(!a.grid||a.grid===this)&&(this._leave(o,n),this._isTemp&&this.removeAsSubGrid(a)),!1}).on(this.el,"drop",(r,o,n)=>{const a=n?.gridstackNode||o.gridstackNode;if(a?.grid===this&&!a._isExternal)return!1;const h=!!this.placeholder.parentElement,l=o!==n;this.placeholder.remove(),delete this.placeholder.gridstackNode,h&&this.opts.animate&&(this.setAnimation(!1),this.setAnimation(!0,!0));const d=o._gridstackNodeOrig;if(delete o._gridstackNodeOrig,h&&d?.grid&&d.grid!==this){const p=d.grid;p.engine.removeNodeFromLayoutCache(d),p.engine.removedNodes.push(d),p._triggerRemoveEvent()._triggerChangeEvent(),p.parentGridNode&&!p.engine.nodes.length&&p.opts.subGridDynamic&&p.removeAsSubGrid()}if(!a||(h&&(this.engine.cleanupNode(a),a.grid=this),delete a.grid?._isTemp,T.off(o,"drag"),n!==o?(n.remove(),o=n):o.remove(),this._removeDD(o),!h))return!1;const u=a.subGrid?.el?.gridstack;return c.copyPos(a,this._readAttr(this.placeholder)),c.removePositioningStyles(o),l&&(a.content||a.subGridOpts||b.addRemoveCB)?(delete a.el,o=this.addWidget(a)):(this._prepareElement(o,!0,a),this.el.appendChild(o),this.resizeToContentCheck(!1,a),u&&(u.parentGridNode=a),this._updateContainerHeight()),this.engine.addedNodes.push(a),this._triggerAddEvent(),this._triggerChangeEvent(),this.engine.endUpdate(),this._gsEventHandler.dropped&&this._gsEventHandler.dropped({...r,type:"dropped"},d&&d.grid?d:void 0,a),!1}),this}static _itemRemoving(e,t){if(!e)return;const i=e?e.gridstackNode:void 0;!i?.grid||e.classList.contains(i.grid.opts.removableOptions.decline)||(t?i._isAboutToRemove=!0:delete i._isAboutToRemove,t?e.classList.add("grid-stack-item-removing"):e.classList.remove("grid-stack-item-removing"))}_setupRemoveDrop(){if(typeof this.opts.removable!="string")return this;const e=document.querySelector(this.opts.removable);return e?(!this.opts.staticGrid&&!T.isDroppable(e)&&T.droppable(e,this.opts.removableOptions).on(e,"dropover",(t,i)=>b._itemRemoving(i,!0)).on(e,"dropout",(t,i)=>b._itemRemoving(i,!1)),this):this}prepareDragDrop(e,t=!1){const i=e?.gridstackNode;if(!i)return;const r=i.noMove||this.opts.disableDrag,o=i.noResize||this.opts.disableResize,n=this.opts.staticGrid||r&&o;if((t||n)&&(i._initDD&&(this._removeDD(e),delete i._initDD),n&&e.classList.add("ui-draggable-disabled","ui-resizable-disabled"),!t))return this;if(!i._initDD){let a,h;const l=(p,f)=>{this.triggerEvent(p,p.target),a=this.cellWidth(),h=this.getCellHeight(!0),this._onStartMoving(e,p,f,i,a,h)},d=(p,f)=>{this._dragOrResize(e,p,f,i,a,h)},u=p=>{this.placeholder.remove(),delete this.placeholder.gridstackNode,delete i._moving,delete i._resizing,delete i._event,delete i._lastTried;const f=i.w!==i._orig.w,y=p.target;if(!(!y.gridstackNode||y.gridstackNode.grid!==this)){if(i.el=y,i._isAboutToRemove){const E=e.gridstackNode.grid;E._gsEventHandler[p.type]&&E._gsEventHandler[p.type](p,y),E.engine.nodes.push(i),E.removeWidget(e,!0,!0)}else c.removePositioningStyles(y),i._temporaryRemoved?(this._writePosAttr(y,i),this.engine.addNode(i)):this._writePosAttr(y,i),this.triggerEvent(p,y);this._extraDragRow=0,this._updateContainerHeight(),this._triggerChangeEvent(),this.engine.endUpdate(),p.type==="resizestop"&&(Number.isInteger(i.sizeToContent)&&(i.sizeToContent=i.h),this.resizeToContentCheck(f,i))}};T.draggable(e,{start:l,stop:u,drag:d}).resizable(e,{start:l,stop:u,resize:d}),i._initDD=!0}return T.draggable(e,r?"disable":"enable").resizable(e,o?"disable":"enable"),this}_onStartMoving(e,t,i,r,o,n){if(this.engine.cleanNodes().beginUpdate(r),this._writePosAttr(this.placeholder,r),this.el.appendChild(this.placeholder),this.placeholder.gridstackNode=r,r.grid?.el)this.dragTransform=c.getValuesFromTransformedElement(e);else if(this.placeholder&&this.placeholder.closest(".grid-stack")){const a=this.placeholder.closest(".grid-stack");this.dragTransform=c.getValuesFromTransformedElement(a)}else this.dragTransform={xScale:1,xOffset:0,yScale:1,yOffset:0};if(r.el=this.placeholder,r._lastUiPosition=i.position,r._prevYPix=i.position.top,r._moving=t.type==="dragstart",r._resizing=t.type==="resizestart",delete r._lastTried,t.type==="dropover"&&r._temporaryRemoved&&(this.engine.addNode(r),r._moving=!0),this.engine.cacheRects(o,n,this.opts.marginTop,this.opts.marginRight,this.opts.marginBottom,this.opts.marginLeft),t.type==="resizestart"){const a=this.getColumn()-r.x,h=(this.opts.maxRow||Number.MAX_SAFE_INTEGER)-r.y;T.resizable(e,"option","minWidth",o*Math.min(r.minW||1,a)).resizable(e,"option","minHeight",n*Math.min(r.minH||1,h)).resizable(e,"option","maxWidth",o*Math.min(r.maxW||Number.MAX_SAFE_INTEGER,a)).resizable(e,"option","maxWidthMoveLeft",o*Math.min(r.maxW||Number.MAX_SAFE_INTEGER,r.x+r.w)).resizable(e,"option","maxHeight",n*Math.min(r.maxH||Number.MAX_SAFE_INTEGER,h)).resizable(e,"option","maxHeightMoveUp",n*Math.min(r.maxH||Number.MAX_SAFE_INTEGER,r.y+r.h))}}_dragOrResize(e,t,i,r,o,n){const a={...r._orig};let h,l=this.opts.marginLeft,d=this.opts.marginRight,u=this.opts.marginTop,p=this.opts.marginBottom;const f=Math.round(n*.1),y=Math.round(o*.1);if(l=Math.min(l,y),d=Math.min(d,y),u=Math.min(u,f),p=Math.min(p,f),t.type==="drag"){if(r._temporaryRemoved)return;const x=i.position.top-r._prevYPix;r._prevYPix=i.position.top,this.opts.draggable.scroll!==!1&&c.updateScrollPosition(e,i.position,x);const z=i.position.left+(i.position.left>r._lastUiPosition.left?-d:l),S=i.position.top+(i.position.top>r._lastUiPosition.top?-p:u);a.x=Math.round(z/o),a.y=Math.round(S/n);const R=this._extraDragRow;if(this.engine.collide(r,a)){const A=this.getRow();let k=Math.max(0,a.y+r.h-A);this.opts.maxRow&&A+k>this.opts.maxRow&&(k=Math.max(0,this.opts.maxRow-A)),this._extraDragRow=k}else this._extraDragRow=0;if(this._extraDragRow!==R&&this._updateContainerHeight(),r.x===a.x&&r.y===a.y)return}else if(t.type==="resize"){if(a.x<0||(c.updateScrollResize(t,e,n),a.w=Math.round((i.size.width-l)/o),a.h=Math.round((i.size.height-u)/n),r.w===a.w&&r.h===a.h)||r._lastTried&&r._lastTried.w===a.w&&r._lastTried.h===a.h)return;const x=i.position.left+l,z=i.position.top+u;a.x=Math.round(x/o),a.y=Math.round(z/n),h=!0}r._event=t,r._lastTried=a;const E={x:i.position.left+l,y:i.position.top+u,w:(i.size?i.size.width:r.w*o)-l-d,h:(i.size?i.size.height:r.h*n)-u-p};if(this.engine.moveNodeCheck(r,{...a,cellWidth:o,cellHeight:n,rect:E,resizing:h})){r._lastUiPosition=i.position,this.engine.cacheRects(o,n,u,d,p,l),delete r._skipDown,h&&r.subGrid&&r.subGrid.onResize(),this._extraDragRow=0,this._updateContainerHeight();const x=t.target;r._sidebarOrig||this._writePosAttr(x,r),this.triggerEvent(t,x)}}triggerEvent(e,t){let i=this;for(;i.parentGridNode;)i=i.parentGridNode.grid;i._gsEventHandler[e.type]&&i._gsEventHandler[e.type](e,t)}_leave(e,t){t=t||e;const i=t.gridstackNode;if(!i||(t.style.transform=t.style.transformOrigin=null,T.off(e,"drag"),i._temporaryRemoved))return;i._temporaryRemoved=!0,this.engine.removeNode(i),i.el=i._isExternal&&t?t:e;const r=i._sidebarOrig;i._isExternal&&this.engine.cleanupNode(i),i._sidebarOrig=r,this.opts.removable===!0&&b._itemRemoving(e,!0),e._gridstackNodeOrig?(e.gridstackNode=e._gridstackNodeOrig,delete e._gridstackNodeOrig):i._isExternal&&this.engine.restoreInitial()}commit(){return $s(this,this.batchUpdate(!1),"commit","batchUpdate","5.2"),this}}b.renderCB=(s,e)=>{s&&e?.content&&(s.textContent=e.content)};b.resizeToContentParent=".grid-stack-item-content";b.Utils=c;b.Engine=K;b.GDRev="12.3.2";const Vs=`.grid-stack{position:relative}.grid-stack-rtl{direction:ltr}.grid-stack-rtl>.grid-stack-item{direction:rtl}.grid-stack-placeholder>.placeholder-content{background-color:#0000001a;margin:0;position:absolute;width:auto;z-index:0!important}.grid-stack>.grid-stack-item{position:absolute;padding:0;top:0;left:0;width:var(--gs-column-width);height:var(--gs-cell-height)}.grid-stack>.grid-stack-item>.grid-stack-item-content{margin:0;position:absolute;width:auto;overflow-x:hidden;overflow-y:auto}.grid-stack>.grid-stack-item.size-to-content:not(.size-to-content-max)>.grid-stack-item-content{overflow-y:hidden}.grid-stack>.grid-stack-item>.grid-stack-item-content,.grid-stack>.grid-stack-placeholder>.placeholder-content{top:var(--gs-item-margin-top);right:var(--gs-item-margin-right);bottom:var(--gs-item-margin-bottom);left:var(--gs-item-margin-left)}.grid-stack-item>.ui-resizable-handle{position:absolute;font-size:.1px;display:block;-ms-touch-action:none;touch-action:none}.grid-stack-item.ui-resizable-autohide>.ui-resizable-handle,.grid-stack-item.ui-resizable-disabled>.ui-resizable-handle{display:none}.grid-stack-item>.ui-resizable-ne,.grid-stack-item>.ui-resizable-nw,.grid-stack-item>.ui-resizable-se,.grid-stack-item>.ui-resizable-sw{background-image:url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" fill="none" stroke="%23666" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" viewBox="0 0 20 20"><path d="m10 3 2 2H8l2-2v14l-2-2h4l-2 2"/></svg>');background-repeat:no-repeat;background-position:center}.grid-stack-item>.ui-resizable-ne{transform:rotate(45deg)}.grid-stack-item>.ui-resizable-sw{transform:rotate(45deg)}.grid-stack-item>.ui-resizable-nw{transform:rotate(-45deg)}.grid-stack-item>.ui-resizable-se{transform:rotate(-45deg)}.grid-stack-item>.ui-resizable-nw{cursor:nw-resize;width:20px;height:20px;top:var(--gs-item-margin-top);left:var(--gs-item-margin-left)}.grid-stack-item>.ui-resizable-n{cursor:n-resize;height:10px;top:var(--gs-item-margin-top);left:25px;right:25px}.grid-stack-item>.ui-resizable-ne{cursor:ne-resize;width:20px;height:20px;top:var(--gs-item-margin-top);right:var(--gs-item-margin-right)}.grid-stack-item>.ui-resizable-e{cursor:e-resize;width:10px;top:15px;bottom:15px;right:var(--gs-item-margin-right)}.grid-stack-item>.ui-resizable-se{cursor:se-resize;width:20px;height:20px;bottom:var(--gs-item-margin-bottom);right:var(--gs-item-margin-right)}.grid-stack-item>.ui-resizable-s{cursor:s-resize;height:10px;left:25px;bottom:var(--gs-item-margin-bottom);right:25px}.grid-stack-item>.ui-resizable-sw{cursor:sw-resize;width:20px;height:20px;bottom:var(--gs-item-margin-bottom);left:var(--gs-item-margin-left)}.grid-stack-item>.ui-resizable-w{cursor:w-resize;width:10px;top:15px;bottom:15px;left:var(--gs-item-margin-left)}.grid-stack-item.ui-draggable-dragging>.ui-resizable-handle{display:none!important}.grid-stack-item.ui-draggable-dragging{will-change:left,top}.grid-stack-item.ui-resizable-resizing{will-change:width,height}.ui-draggable-dragging,.ui-resizable-resizing{z-index:10000}.ui-draggable-dragging>.grid-stack-item-content,.ui-resizable-resizing>.grid-stack-item-content{box-shadow:1px 4px 6px #0003;opacity:.8}.grid-stack-animate,.grid-stack-animate .grid-stack-item{transition:left .3s,top .3s,height .3s,width .3s}.grid-stack-animate .grid-stack-item.grid-stack-placeholder,.grid-stack-animate .grid-stack-item.ui-draggable-dragging,.grid-stack-animate .grid-stack-item.ui-resizable-resizing{transition:left 0s,top 0s,height 0s,width 0s}.grid-stack>.grid-stack-item[gs-y="0"]{top:0}.grid-stack>.grid-stack-item[gs-x="0"]{left:0}`,Gs={icon:Y.luzmoLockOutline,label:"Lock",tooltip:"Lock",action:"lock",type:"toggle"},qs={icon:Y.luzmoPencil,label:"Edit",tooltip:"Edit",action:"edit",type:"toggle"},di={icon:Y.luzmoTable,label:"Edit data",tooltip:"Data",action:"edit-data",type:"toggle"},hi={icon:Y.luzmoCog,label:"Edit options",tooltip:"Options",action:"edit-options",type:"toggle"},jt={icon:Y.luzmoFilterOutline,label:"Edit filters",tooltip:"Filters",action:"edit-filters",type:"toggle"},ci={icon:Y.luzmoClone,label:"Clone",tooltip:"Clone",action:"clone",type:"button"},ui={icon:Y.luzmoTrashOutline,label:"Delete",tooltip:"Delete",action:"delete",type:"button"},Kt=s=>{if(!s)return;let e=[];return e=structuredClone(s).map(t=>{if(t.type==="group")return t.actions=t.actions??[],t.actions=t.actions.map(i=>{if(typeof i=="string"&&["lock","filters","edit","edit-data","edit-options","edit-filters","delete","clone"].includes(i))return{delete:{...ui},filters:{...jt},clone:{...ci},edit:{...qs},"edit-data":{...di},"edit-options":{...hi},"edit-filters":{...jt},lock:{...Gs}}[i];if(typeof i=="object")return i.icon=i.icon??Y.luzmoCircle,i.label=i.label??i.action,i.tooltip=i.tooltip??i.label??i.action,i.type=["toggle","button"].includes(i.type??"")?i.type:"button",i}).filter(Boolean),t}).filter(Boolean),e},mi=()=>[{type:"group",actions:[{...di},{...hi},{...ci}]},{type:"group",actions:[{...ui}]}],js=":host{display:block;--luzmo-action-button-content-color-default: var( --luzmo-grid-item-action-button-content-color-default, #fff );--luzmo-action-button-content-color-hover: var( --luzmo-grid-item-action-button-content-color-hover, #fff );--luzmo-action-button-content-color-down: var( --luzmo-grid-item-action-button-content-color-down, #fff );--luzmo-action-button-content-color-focus: var( --luzmo-grid-item-action-button-content-color-focus, #fff );--luzmo-action-button-background-color-default: var( --luzmo-grid-item-action-button-background-color-default, #333 );--luzmo-action-button-background-color-hover: var( --luzmo-grid-item-action-button-background-color-hover, #444 );--luzmo-action-button-background-color-down: var( --luzmo-grid-item-action-button-background-color-down, #555 );--luzmo-action-button-background-color-focus: var( --luzmo-grid-item-action-button-background-color-focus, #666 );--grid-item-actions-flex-direction: column}.action-buttons{display:flex;gap:var(--luzmo-grid-item-action-group-gap, .5rem);flex-direction:var(--luzmo-grid-item-actions-flex-direction, var(--grid-item-actions-flex-direction));outline:none}.action-button[selected]{--luzmo-action-button-background-color-default: var(--luzmo-primary);--luzmo-action-button-background-color-hover: var(--luzmo-primary-hover);--luzmo-action-button-background-color-down: var(--luzmo-primary-down);--luzmo-action-button-background-color-focus: var(--luzmo-primary-focus);--luzmo-action-button-content-color-default: var( --luzmo-primary-inverse-color );--luzmo-action-button-content-color-hover: var(--luzmo-primary-inverse-color);--luzmo-action-button-content-color-down: var(--luzmo-primary-inverse-color);--luzmo-action-button-content-color-focus: var(--luzmo-primary-inverse-color)}:host .action-buttons{--luzmo-action-button-content-color-default: var( --luzmo-grid-item-action-button-content-color-default, #fff );--luzmo-action-button-content-color-hover: var( --luzmo-grid-item-action-button-content-color-hover, #fff );--luzmo-action-button-content-color-down: var( --luzmo-grid-item-action-button-content-color-down, #fff );--luzmo-action-button-content-color-focus: var( --luzmo-grid-item-action-button-content-color-focus, #fff );--luzmo-action-button-background-color-default: var( --luzmo-grid-item-action-button-background-color-default, #333 );--luzmo-action-button-background-color-hover: var( --luzmo-grid-item-action-button-background-color-hover, #444 );--luzmo-action-button-background-color-down: var( --luzmo-grid-item-action-button-background-color-down, #555 );--luzmo-action-button-background-color-focus: var( --luzmo-grid-item-action-button-background-color-focus, #666 )}.delete-button{--luzmo-action-button-background-color-hover: var( --luzmo-grid-item-delete-button-background-color-hover, var(--luzmo-negative-color) );--luzmo-action-button-content-color-hover: var( --luzmo-grid-item-delete-button-content-color-hover, #fff );--luzmo-action-button-background-color-focus: var( --luzmo-grid-item-delete-button-background-color-focus, var(--luzmo-negative-color-focus) );--luzmo-action-button-content-color-focus: var( --luzmo-grid-item-delete-button-content-color-focus, #fff );--luzmo-action-button-background-color-down: var( --luzmo-grid-item-delete-button-background-color-down, var(--luzmo-negative-color-down) );--luzmo-action-button-content-color-down: var( --luzmo-grid-item-delete-button-content-color-down, #fff )}:host([placement=top-start]),:host([placement=top]),:host([placement=top-end]),:host([placement=bottom-start]),:host([placement=bottom]),:host([placement=bottom-end]){--grid-item-actions-flex-direction: row}";var Ks=Object.defineProperty,Xs=Object.getOwnPropertyDescriptor,qe=(s,e,t,i)=>{for(var r=i>1?void 0:i?Xs(e,t):e,o=s.length-1,n;o>=0;o--)(n=s[o])&&(r=(i?n(e,t,r):n(r))||r);return i&&r&&Ks(e,t,r),r};exports.LuzmoGridItemActionsMenu=class extends Xt.LuzmoElement{constructor(){super(...arguments),this.placement="right-start",this.actions=mi(),this.language="en"}static get styles(){return[_.unsafeCSS(js)]}get isVertical(){return this.placement.includes("left")||this.placement.includes("right")}_dispatchAction(e){this.dispatchEvent(new CustomEvent("action",{bubbles:!0,composed:!0,detail:{action:e.action,type:e.type,active:e.active}}))}_handleActionClick(e){e.type==="toggle"&&(e.active=!e.active,this.actions.forEach(t=>{t.actions?.forEach(i=>{e!==i&&i.active&&(i.active=!1)})})),this._dispatchAction(e),this.requestUpdate()}clearActiveToggles(){this.actions=this.actions.map(e=>({...e,actions:e.actions?.map(t=>(t.type==="toggle"&&(t.active=!1),t))??[]}))}focus(){const e=this.shadowRoot?.querySelectorAll("luzmo-action-button[toggles]");e&&e[0]?.focus()}_generateActionButton(e){const t={Data:Z.msg("Data",{desc:"Grid item action tooltip"}),Options:Z.msg("Options",{desc:"Grid item action tooltip"}),Clone:Z.msg("Clone",{desc:"Grid item action tooltip"}),Delete:Z.msg("Delete",{desc:"Grid item action tooltip"}),Edit:Z.msg("Edit",{desc:"Grid item action tooltip"}),Lock:Z.msg("Lock",{desc:"Grid item action tooltip"}),Filters:Z.msg("Filters",{desc:"Grid item action tooltip"})};return _.html`
|
|
235
229
|
<luzmo-action-button
|
package/components/grid/index.js
CHANGED
|
@@ -4452,13 +4452,6 @@ class dr {
|
|
|
4452
4452
|
return r.length ? r.map((n) => n.ddElement || (i ? bt.init(n) : null)).filter((n) => n) : [];
|
|
4453
4453
|
}
|
|
4454
4454
|
}
|
|
4455
|
-
/*!
|
|
4456
|
-
* GridStack 12.3.2
|
|
4457
|
-
* https://gridstackjs.com/
|
|
4458
|
-
*
|
|
4459
|
-
* Copyright (c) 2021-2025 Alain Dumesny
|
|
4460
|
-
* see root license https://github.com/gridstack/gridstack.js/tree/master/LICENSE
|
|
4461
|
-
*/
|
|
4462
4455
|
const T = new dr();
|
|
4463
4456
|
class y {
|
|
4464
4457
|
/**
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
18
18
|
* SOFTWARE.
|
|
19
19
|
* */
|
|
20
|
-
"use strict";const v=require("@lit-labs/signals"),h=require("@lit/context"),z=require("@lit/task");require("@luzmo/lucero/divider");require("@luzmo/lucero/field-label");require("@luzmo/lucero/icon");require("@luzmo/lucero/multi-language-field");require("@luzmo/lucero/progress-circle");require("@luzmo/lucero/text-field");require("@luzmo/lucero/tooltip");const n=require("lit"),i=require("lit/decorators.js"),g=require("@lit/localize"),d=require("@luzmo/icons"),f=require("./focusable-QLh-LlNt.cjs"),c=require("./sized-mixin-DcvJLFeo.cjs"),b=require("./en--a5SfjnM.cjs"),y=h.createContext(Symbol("slot-store-context")),_=":host{font-family:var(--luzmo-display-settings-font-family, var(--luzmo-font-family));font-size:var(--luzmo-display-settings-font-size, var(--display-settings-font-size));color:var(--luzmo-display-settings-font-color, var(--luzmo-font-color))}.settings-container{display:flex;flex-direction:column;gap:var(--luzmo-display-settings-vertical-gap, var(--luzmo-spacing-2))}.settings-row{display:flex;justify-content:flex-start;align-items:center;gap:var(--luzmo-display-settings-gap, var(--display-settings-gap))}luzmo-divider{margin:var(--luzmo-display-settings-ids-container-vertical-margin, var(--display-settings-ids-container-vertical-margin)) 0}luzmo-tooltip{--tooltip-font-size: var( --luzmo-display-settings-tooltip-font-size, var(--tooltip-font-size) )}.setting{display:flex;align-items:center}.label-action-container{display:flex;align-items:center;justify-content:space-between;gap:var(--luzmo-display-settings-info-to-remove-icon-gap, var(--display-settings-info-to-remove-icon-gap))}.id-button,.remove-button{outline:none;cursor:pointer;border:none;background:none;font-size:var(--luzmo-display-settings-id-button-font-size, var(--luzmo-display-settings-font-size, var(--display-settings-font-size)));color:var(--luzmo-display-settings-font-color, var(--luzmo-font-color))}.remove-button{display:block;width:var(--luzmo-display-settings-remove-button-size, var(--display-settings-remove-button-size));height:var(--luzmo-display-settings-remove-button-size, var(--display-settings-remove-button-size));border-radius:var(--luzmo-display-settings-remove-button-border-radius, 50%)}.remove-button:hover{background-color:var(--luzmo-display-settings-remove-button-background-color-hover, var(--luzmo-background-color-hover))}.remove-button:active,.remove-button:focus{background-color:var(--luzmo-display-settings-remove-button-background-color-down, var(--luzmo-background-color-down))}.remove-button:focus-visible{box-shadow:0 0 0 var(--luzmo-display-settings-remove-button-indicator-thickness, var(--display-settings-remove-button-indicator-thickness)) var(--highcontrast-remove-button-indicator-color, var(--luzmo-display-settings-remove-button-indicator-color, var(--display-settings-remove-button-indicator-color)))}.ids-container{display:flex;flex-direction:column;gap:var(--luzmo-display-settings-ids-container-gap, var(--luzmo-spacing-2));border-radius:50%}.id-label{text-transform:var(--luzmo-display-settings-id-label-text-transform, var(--display-settings-id-label-text-transform));font-size:var(--luzmo-display-settings-id-label-font-size, var(--display-settings-id-label-font-size));color:var(--luzmo-display-settings-id-label-color, var(--display-settings-id-label-color))}.id-value{-webkit-user-select:text;user-select:text;cursor:text}.example-container{line-height:var(--luzmo-display-settings-example-height, var(--display-settings-example-height));font-size:var(--luzmo-display-settings-example-font-size, var(--display-settings-example-font-size));color:var(--luzmo-display-settings-example-color, var(--display-settings-example-color))}.example-container .example-label{font-weight:var(--luzmo-display-settings-example-label-font-weight, var(--display-settings-example-label-font-weight));color:var(--luzmo-display-settings-example-label-color, var(--display-settings-example-label-color))}.example-container .example-language{text-transform:uppercase;color:var(--luzmo-display-settings-example-language-color, var(--display-settings-example-language-color))}.example-container{gap:var(--luzmo-display-settings-example-container-gap, var(--luzmo-spacing-2))}:host{--display-settings-font-family: var(--luzmo-font-family);--display-settings-id-label-text-transform: uppercase;--display-settings-id-label-color: var(--luzmo-secondary);--display-settings-remove-button-indicator-color: var(--luzmo-primary);--display-settings-remove-button-indicator-thickness: var( --luzmo-border-width )}:host{--display-settings-font-size: var(--luzmo-font-size);--display-settings-id-label-font-size: var(--luzmo-font-size-s);--display-settings-gap: var(--luzmo-spacing-3);--display-settings-ids-container-vertical-margin: var(--luzmo-spacing-4);--display-settings-info-to-remove-icon-gap: var(--luzmo-spacing-5);--display-settings-remove-button-size: var(--luzmo-component-height)}:host([size=s]){--display-settings-id-label-font-size: var(--luzmo-font-size-s);--display-settings-font-size: var(--luzmo-font-size-s);--display-settings-gap: var(--luzmo-spacing-3);--display-settings-ids-container-vertical-margin: var(--luzmo-spacing-3);--display-settings-info-to-remove-icon-gap: var(--luzmo-spacing-4);--display-settings-remove-button-size: var(--luzmo-component-height-s)}:host([size=l]){--display-settings-id-label-font-size: var(--luzmo-font-size);--display-settings-font-size: var(--luzmo-font-size-l);--display-settings-gap: var(--luzmo-spacing-4);--display-settings-ids-container-vertical-margin: var(--luzmo-spacing-5);--display-settings-info-to-remove-icon-gap: calc( var(--luzmo-spacing-5) + var(--luzmo-spacing-1) );--display-settings-remove-button-size: var(--luzmo-component-height-l)}:host([size=xl]){--display-settings-id-label-font-size: var(--luzmo-font-size-l);--display-settings-font-size: var(--luzmo-font-size-xl);--display-settings-gap: var(--luzmo-spacing-5);--display-settings-ids-container-vertical-margin: calc( var(--luzmo-spacing-5) + var(--luzmo-spacing-1) );--display-settings-info-to-remove-icon-gap: calc( var(--luzmo-spacing-5) + var(--luzmo-spacing-2) );--display-settings-remove-button-size: var(--luzmo-component-height-xl)}:host{--display-settings-example-font-size: var(--luzmo-font-size);--display-settings-example-color: var(--luzmo-font-color);--display-settings-example-label-font-weight: bold;--display-settings-example-label-color: var(--luzmo-primary);--display-settings-example-language-color: var(--luzmo-primary)}:host{--display-settings-example-height: var(--luzmo-component-height)}:host([size=s]){--display-settings-example-height: var(--luzmo-component-height-s);--display-settings-example-font-size: var(--luzmo-font-size-s)}:host([size=l]){--display-settings-example-height: var(--luzmo-component-height-l);--display-settings-example-font-size: var(--luzmo-font-size)}:host([size=xl]){--display-settings-example-height: var(--luzmo-component-height-xl);--display-settings-example-font-size: var(--luzmo-font-size-l)}";var C=Object.defineProperty,s=(m,t,o,p)=>{for(var a=void 0,r=m.length-1,u;r>=0;r--)(u=m[r])&&(a=u(t,o,a)||a);return a&&C(t,o,a),a};class e extends v.SignalWatcher(c.SizedMixin(f.LuzmoElement,{validSizes:Object.values(c.ElementSizes)})){constructor(){super(...arguments),this._loadDisplaySettings=new z.Task(this,{task:async([t,o,p,a,r,u])=>{const l=[];u&&l.push("grandTotals"),p&&l.push("periodOverPeriod"),(t==="numeric"||t==="mixed"&&this._currentSlotContent?.type==="numeric")&&l.push("numeric"),t!=="numeric"&&this._currentSlotContent?.type==="datetime"&&l.push("datetime"),!["numeric","mixed"].includes(t??"")&&this._currentSlotContent?.type==="numeric"&&!a&&l.push("binning"),p&&!this._settingsTypeLoaded.periodOverPeriod&&(await Promise.resolve().then(()=>require("./display-settings-period-over-period/index.cjs")),this._settingsTypeLoaded.periodOverPeriod=!0),l.length>0&&!o&&(l.includes("numeric")&&!this._settingsTypeLoaded.numeric?(await Promise.resolve().then(()=>require("./display-settings-numeric/index.cjs")),this._settingsTypeLoaded.numeric=!0):l.includes("datetime")&&!this._settingsTypeLoaded.datetime&&r?(await Promise.resolve().then(()=>require("./display-settings-datetime/index.cjs")),this._settingsTypeLoaded.datetime=!0):l.includes("binning")&&!this._settingsTypeLoaded.binning?(await Promise.resolve().then(()=>require("./display-settings-binning/index.cjs")),this._settingsTypeLoaded.binning=!0):l.includes("grandTotals")&&!this._settingsTypeLoaded.grandTotals&&(await Promise.resolve().then(()=>require("./display-settings-grand-totals/index.cjs")),this._settingsTypeLoaded.grandTotals=!0))},args:()=>[this.slotType,this.hideDisplaySettings,this._store?.periodOverPeriodUiType.get(),this.isBinningDisabled,this.areDatetimeOptionsEnabled,this.areGrandTotalsEnabled,this.slotContent]}),this.language="en",this.contentLanguage="en",this.slotType="numeric",this.slotContent={},this._showIds=!1,this.measureColumns=[],this._settingsTypeLoaded={binning:!1,datetime:!1,numeric:!1,grandTotals:!1,periodOverPeriod:!1,hierarchy:!0},this._currentSlotContent={}}static get styles(){return[n.unsafeCSS(_)]}_datasetDatetimeColumns(){return this._store?.linkedDataset.get().flatMap(t=>t.columns?.filter(o=>o.type==="datetime").map(o=>({...o,datasetId:t.id})))}willUpdate(){const t=this._store?.activeSlotContents.get(),o=this._store?.periodOverPeriodUiType.get();this.periodOverPeriodUiType!==o&&(this.periodOverPeriodUiType=o),t&&t!==this._currentSlotContent&&(this._currentSlotContent=structuredClone(t))}_onSlotContentChange(t){t.stopPropagation(),t.preventDefault(),this._currentSlotContent=structuredClone(t.detail.slotContent),this._sendEvent(),this.requestUpdate()}_onLabelChange(){this._currentSlotContent=structuredClone(this._currentSlotContent),this._currentSlotContent.label=this._multiLanguageFieldElement.value||{},this._sendEvent(),this.requestUpdate()}_sendEvent(){this.dispatchEvent(new CustomEvent("slot-content-changed",{bubbles:!0,composed:!0,cancelable:!0,detail:{slotContent:{...this._currentSlotContent}}})),this._store&&this._store.updateContent({...this._currentSlotContent})}_removeEvent(){this.dispatchEvent(new CustomEvent("remove-slot-content",{bubbles:!0,composed:!0,cancelable:!0,detail:{slotContent:this._currentSlotContent}}))}_toggleIds(){this._showIds=!this._showIds}_renderExampleRow(){const t=this.slotType==="numeric"||this.slotType==="mixed"&&this._currentSlotContent.type==="numeric",o=this.slotType!=="datetime"&&this._currentSlotContent.type==="datetime"&&this.areDatetimeOptionsEnabled;if(!(t||o))return n.nothing;const p=!this._currentSlotContent.datetimeDisplayMode||this._currentSlotContent.datetimeDisplayMode==="default",a=t?1234.56:p?new Date:1,r=b.formatter({...this._currentSlotContent,type:t?"numeric":"datetime"},{locale:this.contentLanguage,level:this._currentSlotContent?.level})(a);return n.html`<div class="settings-row example-container">
|
|
20
|
+
"use strict";const v=require("@lit-labs/signals"),h=require("@lit/context"),z=require("@lit/task");require("@luzmo/lucero/divider");require("@luzmo/lucero/field-label");require("@luzmo/lucero/icon");require("@luzmo/lucero/multi-language-field");require("@luzmo/lucero/progress-circle");require("@luzmo/lucero/text-field");require("@luzmo/lucero/tooltip");const n=require("lit"),i=require("lit/decorators.js"),g=require("@lit/localize"),d=require("@luzmo/icons"),f=require("./focusable-QLh-LlNt.cjs"),c=require("./sized-mixin-DcvJLFeo.cjs"),b=require("./en-DZcn_iz_.cjs"),y=h.createContext(Symbol("slot-store-context")),_=":host{font-family:var(--luzmo-display-settings-font-family, var(--luzmo-font-family));font-size:var(--luzmo-display-settings-font-size, var(--display-settings-font-size));color:var(--luzmo-display-settings-font-color, var(--luzmo-font-color))}.settings-container{display:flex;flex-direction:column;gap:var(--luzmo-display-settings-vertical-gap, var(--luzmo-spacing-2))}.settings-row{display:flex;justify-content:flex-start;align-items:center;gap:var(--luzmo-display-settings-gap, var(--display-settings-gap))}luzmo-divider{margin:var(--luzmo-display-settings-ids-container-vertical-margin, var(--display-settings-ids-container-vertical-margin)) 0}luzmo-tooltip{--tooltip-font-size: var( --luzmo-display-settings-tooltip-font-size, var(--tooltip-font-size) )}.setting{display:flex;align-items:center}.label-action-container{display:flex;align-items:center;justify-content:space-between;gap:var(--luzmo-display-settings-info-to-remove-icon-gap, var(--display-settings-info-to-remove-icon-gap))}.id-button,.remove-button{outline:none;cursor:pointer;border:none;background:none;font-size:var(--luzmo-display-settings-id-button-font-size, var(--luzmo-display-settings-font-size, var(--display-settings-font-size)));color:var(--luzmo-display-settings-font-color, var(--luzmo-font-color))}.remove-button{display:block;width:var(--luzmo-display-settings-remove-button-size, var(--display-settings-remove-button-size));height:var(--luzmo-display-settings-remove-button-size, var(--display-settings-remove-button-size));border-radius:var(--luzmo-display-settings-remove-button-border-radius, 50%)}.remove-button:hover{background-color:var(--luzmo-display-settings-remove-button-background-color-hover, var(--luzmo-background-color-hover))}.remove-button:active,.remove-button:focus{background-color:var(--luzmo-display-settings-remove-button-background-color-down, var(--luzmo-background-color-down))}.remove-button:focus-visible{box-shadow:0 0 0 var(--luzmo-display-settings-remove-button-indicator-thickness, var(--display-settings-remove-button-indicator-thickness)) var(--highcontrast-remove-button-indicator-color, var(--luzmo-display-settings-remove-button-indicator-color, var(--display-settings-remove-button-indicator-color)))}.ids-container{display:flex;flex-direction:column;gap:var(--luzmo-display-settings-ids-container-gap, var(--luzmo-spacing-2));border-radius:50%}.id-label{text-transform:var(--luzmo-display-settings-id-label-text-transform, var(--display-settings-id-label-text-transform));font-size:var(--luzmo-display-settings-id-label-font-size, var(--display-settings-id-label-font-size));color:var(--luzmo-display-settings-id-label-color, var(--display-settings-id-label-color))}.id-value{-webkit-user-select:text;user-select:text;cursor:text}.example-container{line-height:var(--luzmo-display-settings-example-height, var(--display-settings-example-height));font-size:var(--luzmo-display-settings-example-font-size, var(--display-settings-example-font-size));color:var(--luzmo-display-settings-example-color, var(--display-settings-example-color))}.example-container .example-label{font-weight:var(--luzmo-display-settings-example-label-font-weight, var(--display-settings-example-label-font-weight));color:var(--luzmo-display-settings-example-label-color, var(--display-settings-example-label-color))}.example-container .example-language{text-transform:uppercase;color:var(--luzmo-display-settings-example-language-color, var(--display-settings-example-language-color))}.example-container{gap:var(--luzmo-display-settings-example-container-gap, var(--luzmo-spacing-2))}:host{--display-settings-font-family: var(--luzmo-font-family);--display-settings-id-label-text-transform: uppercase;--display-settings-id-label-color: var(--luzmo-secondary);--display-settings-remove-button-indicator-color: var(--luzmo-primary);--display-settings-remove-button-indicator-thickness: var( --luzmo-border-width )}:host{--display-settings-font-size: var(--luzmo-font-size);--display-settings-id-label-font-size: var(--luzmo-font-size-s);--display-settings-gap: var(--luzmo-spacing-3);--display-settings-ids-container-vertical-margin: var(--luzmo-spacing-4);--display-settings-info-to-remove-icon-gap: var(--luzmo-spacing-5);--display-settings-remove-button-size: var(--luzmo-component-height)}:host([size=s]){--display-settings-id-label-font-size: var(--luzmo-font-size-s);--display-settings-font-size: var(--luzmo-font-size-s);--display-settings-gap: var(--luzmo-spacing-3);--display-settings-ids-container-vertical-margin: var(--luzmo-spacing-3);--display-settings-info-to-remove-icon-gap: var(--luzmo-spacing-4);--display-settings-remove-button-size: var(--luzmo-component-height-s)}:host([size=l]){--display-settings-id-label-font-size: var(--luzmo-font-size);--display-settings-font-size: var(--luzmo-font-size-l);--display-settings-gap: var(--luzmo-spacing-4);--display-settings-ids-container-vertical-margin: var(--luzmo-spacing-5);--display-settings-info-to-remove-icon-gap: calc( var(--luzmo-spacing-5) + var(--luzmo-spacing-1) );--display-settings-remove-button-size: var(--luzmo-component-height-l)}:host([size=xl]){--display-settings-id-label-font-size: var(--luzmo-font-size-l);--display-settings-font-size: var(--luzmo-font-size-xl);--display-settings-gap: var(--luzmo-spacing-5);--display-settings-ids-container-vertical-margin: calc( var(--luzmo-spacing-5) + var(--luzmo-spacing-1) );--display-settings-info-to-remove-icon-gap: calc( var(--luzmo-spacing-5) + var(--luzmo-spacing-2) );--display-settings-remove-button-size: var(--luzmo-component-height-xl)}:host{--display-settings-example-font-size: var(--luzmo-font-size);--display-settings-example-color: var(--luzmo-font-color);--display-settings-example-label-font-weight: bold;--display-settings-example-label-color: var(--luzmo-primary);--display-settings-example-language-color: var(--luzmo-primary)}:host{--display-settings-example-height: var(--luzmo-component-height)}:host([size=s]){--display-settings-example-height: var(--luzmo-component-height-s);--display-settings-example-font-size: var(--luzmo-font-size-s)}:host([size=l]){--display-settings-example-height: var(--luzmo-component-height-l);--display-settings-example-font-size: var(--luzmo-font-size)}:host([size=xl]){--display-settings-example-height: var(--luzmo-component-height-xl);--display-settings-example-font-size: var(--luzmo-font-size-l)}";var C=Object.defineProperty,s=(m,t,o,p)=>{for(var a=void 0,r=m.length-1,u;r>=0;r--)(u=m[r])&&(a=u(t,o,a)||a);return a&&C(t,o,a),a};class e extends v.SignalWatcher(c.SizedMixin(f.LuzmoElement,{validSizes:Object.values(c.ElementSizes)})){constructor(){super(...arguments),this._loadDisplaySettings=new z.Task(this,{task:async([t,o,p,a,r,u])=>{const l=[];u&&l.push("grandTotals"),p&&l.push("periodOverPeriod"),(t==="numeric"||t==="mixed"&&this._currentSlotContent?.type==="numeric")&&l.push("numeric"),t!=="numeric"&&this._currentSlotContent?.type==="datetime"&&l.push("datetime"),!["numeric","mixed"].includes(t??"")&&this._currentSlotContent?.type==="numeric"&&!a&&l.push("binning"),p&&!this._settingsTypeLoaded.periodOverPeriod&&(await Promise.resolve().then(()=>require("./display-settings-period-over-period/index.cjs")),this._settingsTypeLoaded.periodOverPeriod=!0),l.length>0&&!o&&(l.includes("numeric")&&!this._settingsTypeLoaded.numeric?(await Promise.resolve().then(()=>require("./display-settings-numeric/index.cjs")),this._settingsTypeLoaded.numeric=!0):l.includes("datetime")&&!this._settingsTypeLoaded.datetime&&r?(await Promise.resolve().then(()=>require("./display-settings-datetime/index.cjs")),this._settingsTypeLoaded.datetime=!0):l.includes("binning")&&!this._settingsTypeLoaded.binning?(await Promise.resolve().then(()=>require("./display-settings-binning/index.cjs")),this._settingsTypeLoaded.binning=!0):l.includes("grandTotals")&&!this._settingsTypeLoaded.grandTotals&&(await Promise.resolve().then(()=>require("./display-settings-grand-totals/index.cjs")),this._settingsTypeLoaded.grandTotals=!0))},args:()=>[this.slotType,this.hideDisplaySettings,this._store?.periodOverPeriodUiType.get(),this.isBinningDisabled,this.areDatetimeOptionsEnabled,this.areGrandTotalsEnabled,this.slotContent]}),this.language="en",this.contentLanguage="en",this.slotType="numeric",this.slotContent={},this._showIds=!1,this.measureColumns=[],this._settingsTypeLoaded={binning:!1,datetime:!1,numeric:!1,grandTotals:!1,periodOverPeriod:!1,hierarchy:!0},this._currentSlotContent={}}static get styles(){return[n.unsafeCSS(_)]}_datasetDatetimeColumns(){return this._store?.linkedDataset.get().flatMap(t=>t.columns?.filter(o=>o.type==="datetime").map(o=>({...o,datasetId:t.id})))}willUpdate(){const t=this._store?.activeSlotContents.get(),o=this._store?.periodOverPeriodUiType.get();this.periodOverPeriodUiType!==o&&(this.periodOverPeriodUiType=o),t&&t!==this._currentSlotContent&&(this._currentSlotContent=structuredClone(t))}_onSlotContentChange(t){t.stopPropagation(),t.preventDefault(),this._currentSlotContent=structuredClone(t.detail.slotContent),this._sendEvent(),this.requestUpdate()}_onLabelChange(){this._currentSlotContent=structuredClone(this._currentSlotContent),this._currentSlotContent.label=this._multiLanguageFieldElement.value||{},this._sendEvent(),this.requestUpdate()}_sendEvent(){this.dispatchEvent(new CustomEvent("slot-content-changed",{bubbles:!0,composed:!0,cancelable:!0,detail:{slotContent:{...this._currentSlotContent}}})),this._store&&this._store.updateContent({...this._currentSlotContent})}_removeEvent(){this.dispatchEvent(new CustomEvent("remove-slot-content",{bubbles:!0,composed:!0,cancelable:!0,detail:{slotContent:this._currentSlotContent}}))}_toggleIds(){this._showIds=!this._showIds}_renderExampleRow(){const t=this.slotType==="numeric"||this.slotType==="mixed"&&this._currentSlotContent.type==="numeric",o=this.slotType!=="datetime"&&this._currentSlotContent.type==="datetime"&&this.areDatetimeOptionsEnabled;if(!(t||o))return n.nothing;const p=!this._currentSlotContent.datetimeDisplayMode||this._currentSlotContent.datetimeDisplayMode==="default",a=t?1234.56:p?new Date:1,r=b.formatter({...this._currentSlotContent,type:t?"numeric":"datetime"},{locale:this.contentLanguage,level:this._currentSlotContent?.level})(a);return n.html`<div class="settings-row example-container">
|
|
21
21
|
<span class="example-label"
|
|
22
22
|
>${g.msg("Example",{desc:"Label for example"})}:</span
|
|
23
23
|
>
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/*! * A kit of modern Luzmo Web Components for analytics in your web application.
|
|
2
|
+
*
|
|
3
|
+
* Copyright © 2025 Luzmo
|
|
4
|
+
* All rights reserved.
|
|
5
|
+
* Luzmo web components (“Luzmo Web Components”)
|
|
6
|
+
* must be used according to the Luzmo Terms of Service.
|
|
7
|
+
* This license allows users with a current active Luzmo account
|
|
8
|
+
* to use the Luzmo Web Components. This license terminates
|
|
9
|
+
* automatically if a user no longer has an active Luzmo account.
|
|
10
|
+
* Please view the Luzmo Terms of Service at: https://www.luzmo.com/information-pages/terms-of-use.
|
|
11
|
+
*
|
|
12
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
13
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
14
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
15
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
16
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
17
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
18
|
+
* SOFTWARE.
|
|
19
|
+
* */
|
|
20
|
+
"use strict";var T=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(t){return this.listeners.add(t),this.onSubscribe(),()=>{this.listeners.delete(t),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},X={setTimeout:(t,e)=>setTimeout(t,e),clearTimeout:t=>clearTimeout(t),setInterval:(t,e)=>setInterval(t,e),clearInterval:t=>clearInterval(t)},Y=class{#t=X;#e=!1;setTimeoutProvider(t){this.#t=t}setTimeout(t,e){return this.#t.setTimeout(t,e)}clearTimeout(t){this.#t.clearTimeout(t)}setInterval(t,e){return this.#t.setInterval(t,e)}clearInterval(t){this.#t.clearInterval(t)}},Q=new Y;function tt(t){setTimeout(t,0)}var M=typeof window>"u"||"Deno"in globalThis;function v(){}function et(t,e){return typeof t=="function"?t(e):t}function st(t){return typeof t=="number"&&t>=0&&t!==1/0}function it(t,e){return Math.max(t+(e||0)-Date.now(),0)}function E(t,e){return typeof t=="function"?t(e):t}function rt(t,e){return typeof t=="function"?t(e):t}function U(t,e){const{type:s="all",exact:i,fetchStatus:n,predicate:a,queryKey:o,stale:r}=t;if(o){if(i){if(e.queryHash!==j(o,e.options))return!1}else if(!F(e.queryKey,o))return!1}if(s!=="all"){const u=e.isActive();if(s==="active"&&!u||s==="inactive"&&u)return!1}return!(typeof r=="boolean"&&e.isStale()!==r||n&&n!==e.state.fetchStatus||a&&!a(e))}function x(t,e){const{exact:s,status:i,predicate:n,mutationKey:a}=t;if(a){if(!e.options.mutationKey)return!1;if(s){if(P(e.options.mutationKey)!==P(a))return!1}else if(!F(e.options.mutationKey,a))return!1}return!(i&&e.state.status!==i||n&&!n(e))}function j(t,e){return(e?.queryKeyHashFn||P)(t)}function P(t){return JSON.stringify(t,(e,s)=>R(s)?Object.keys(s).sort().reduce((i,n)=>(i[n]=s[n],i),{}):s)}function F(t,e){return t===e?!0:typeof t!=typeof e?!1:t&&e&&typeof t=="object"&&typeof e=="object"?Object.keys(e).every(s=>F(t[s],e[s])):!1}var nt=Object.prototype.hasOwnProperty;function $(t,e){if(t===e)return t;const s=L(t)&&L(e);if(!s&&!(R(t)&&R(e)))return e;const n=(s?t:Object.keys(t)).length,a=s?e:Object.keys(e),o=a.length,r=s?new Array(o):{};let u=0;for(let h=0;h<o;h++){const d=s?h:a[h],l=t[d],m=e[d];if(l===m){r[d]=l,(s?h<n:nt.call(t,d))&&u++;continue}if(l===null||m===null||typeof l!="object"||typeof m!="object"){r[d]=m;continue}const b=$(l,m);r[d]=b,b===l&&u++}return n===o&&u===n?t:r}function L(t){return Array.isArray(t)&&t.length===Object.keys(t).length}function R(t){if(!H(t))return!1;const e=t.constructor;if(e===void 0)return!0;const s=e.prototype;return!(!H(s)||!s.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(t)!==Object.prototype)}function H(t){return Object.prototype.toString.call(t)==="[object Object]"}function at(t){return new Promise(e=>{Q.setTimeout(e,t)})}function ot(t,e,s){return typeof s.structuralSharing=="function"?s.structuralSharing(t,e):s.structuralSharing!==!1?$(t,e):e}function ut(t,e,s=0){const i=[...t,e];return s&&i.length>s?i.slice(1):i}function ht(t,e,s=0){const i=[e,...t];return s&&i.length>s?i.slice(0,-1):i}var I=Symbol();function B(t,e){return!t.queryFn&&e?.initialPromise?()=>e.initialPromise:!t.queryFn||t.queryFn===I?()=>Promise.reject(new Error(`Missing queryFn: '${t.queryHash}'`)):t.queryFn}var ct=class extends T{#t;#e;#s;constructor(){super(),this.#s=t=>{if(!M&&window.addEventListener){const e=()=>t();return window.addEventListener("visibilitychange",e,!1),()=>{window.removeEventListener("visibilitychange",e)}}}}onSubscribe(){this.#e||this.setEventListener(this.#s)}onUnsubscribe(){this.hasListeners()||(this.#e?.(),this.#e=void 0)}setEventListener(t){this.#s=t,this.#e?.(),this.#e=t(e=>{typeof e=="boolean"?this.setFocused(e):this.onFocus()})}setFocused(t){this.#t!==t&&(this.#t=t,this.onFocus())}onFocus(){const t=this.isFocused();this.listeners.forEach(e=>{e(t)})}isFocused(){return typeof this.#t=="boolean"?this.#t:globalThis.document?.visibilityState!=="hidden"}},J=new ct;function lt(){let t,e;const s=new Promise((n,a)=>{t=n,e=a});s.status="pending",s.catch(()=>{});function i(n){Object.assign(s,n),delete s.resolve,delete s.reject}return s.resolve=n=>{i({status:"fulfilled",value:n}),t(n)},s.reject=n=>{i({status:"rejected",reason:n}),e(n)},s}var dt=tt;function ft(){let t=[],e=0,s=r=>{r()},i=r=>{r()},n=dt;const a=r=>{e?t.push(r):n(()=>{s(r)})},o=()=>{const r=t;t=[],r.length&&n(()=>{i(()=>{r.forEach(u=>{s(u)})})})};return{batch:r=>{let u;e++;try{u=r()}finally{e--,e||o()}return u},batchCalls:r=>(...u)=>{a(()=>{r(...u)})},schedule:a,setNotifyFunction:r=>{s=r},setBatchNotifyFunction:r=>{i=r},setScheduler:r=>{n=r}}}var y=ft(),yt=class extends T{#t=!0;#e;#s;constructor(){super(),this.#s=t=>{if(!M&&window.addEventListener){const e=()=>t(!0),s=()=>t(!1);return window.addEventListener("online",e,!1),window.addEventListener("offline",s,!1),()=>{window.removeEventListener("online",e),window.removeEventListener("offline",s)}}}}onSubscribe(){this.#e||this.setEventListener(this.#s)}onUnsubscribe(){this.hasListeners()||(this.#e?.(),this.#e=void 0)}setEventListener(t){this.#s=t,this.#e?.(),this.#e=t(this.setOnline.bind(this))}setOnline(t){this.#t!==t&&(this.#t=t,this.listeners.forEach(s=>{s(t)}))}isOnline(){return this.#t}},D=new yt;function pt(t){return Math.min(1e3*2**t,3e4)}function z(t){return(t??"online")==="online"?D.isOnline():!0}var K=class extends Error{constructor(t){super("CancelledError"),this.revert=t?.revert,this.silent=t?.silent}};function W(t){let e=!1,s=0,i;const n=lt(),a=()=>n.status!=="pending",o=c=>{if(!a()){const p=new K(c);m(p),t.onCancel?.(p)}},r=()=>{e=!0},u=()=>{e=!1},h=()=>J.isFocused()&&(t.networkMode==="always"||D.isOnline())&&t.canRun(),d=()=>z(t.networkMode)&&t.canRun(),l=c=>{a()||(i?.(),n.resolve(c))},m=c=>{a()||(i?.(),n.reject(c))},b=()=>new Promise(c=>{i=p=>{(a()||h())&&c(p)},t.onPause?.()}).then(()=>{i=void 0,a()||t.onContinue?.()}),f=()=>{if(a())return;let c;const p=s===0?t.initialPromise:void 0;try{c=p??t.fn()}catch(g){c=Promise.reject(g)}Promise.resolve(c).then(l).catch(g=>{if(a())return;const w=t.retry??(M?0:3),O=t.retryDelay??pt,q=typeof O=="function"?O(s,g):O,S=w===!0||typeof w=="number"&&s<w||typeof w=="function"&&w(s,g);if(e||!S){m(g);return}s++,t.onFail?.(s,g),at(q).then(()=>h()?void 0:b()).then(()=>{e?m(g):f()})})};return{promise:n,status:()=>n.status,cancel:o,continue:()=>(i?.(),n),cancelRetry:r,continueRetry:u,canStart:d,start:()=>(d()?f():b().then(f),n)}}var Z=class{#t;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),st(this.gcTime)&&(this.#t=Q.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(t){this.gcTime=Math.max(this.gcTime||0,t??(M?1/0:300*1e3))}clearGcTimeout(){this.#t&&(Q.clearTimeout(this.#t),this.#t=void 0)}},mt=class extends Z{#t;#e;#s;#r;#i;#a;#o;constructor(t){super(),this.#o=!1,this.#a=t.defaultOptions,this.setOptions(t.options),this.observers=[],this.#r=t.client,this.#s=this.#r.getQueryCache(),this.queryKey=t.queryKey,this.queryHash=t.queryHash,this.#t=N(this.options),this.state=t.state??this.#t,this.scheduleGc()}get meta(){return this.options.meta}get promise(){return this.#i?.promise}setOptions(t){if(this.options={...this.#a,...t},this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const e=N(this.options);e.data!==void 0&&(this.setState(G(e.data,e.dataUpdatedAt)),this.#t=e)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&this.#s.remove(this)}setData(t,e){const s=ot(this.state.data,t,this.options);return this.#n({data:s,type:"success",dataUpdatedAt:e?.updatedAt,manual:e?.manual}),s}setState(t,e){this.#n({type:"setState",state:t,setStateOptions:e})}cancel(t){const e=this.#i?.promise;return this.#i?.cancel(t),e?e.then(v).catch(v):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(this.#t)}isActive(){return this.observers.some(t=>rt(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===I||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStatic(){return this.getObserversCount()>0?this.observers.some(t=>E(t.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(t=>t.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(t=0){return this.state.data===void 0?!0:t==="static"?!1:this.state.isInvalidated?!0:!it(this.state.dataUpdatedAt,t)}onFocus(){this.observers.find(e=>e.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#i?.continue()}onOnline(){this.observers.find(e=>e.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#i?.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),this.#s.notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(e=>e!==t),this.observers.length||(this.#i&&(this.#o?this.#i.cancel({revert:!0}):this.#i.cancelRetry()),this.scheduleGc()),this.#s.notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||this.#n({type:"invalidate"})}async fetch(t,e){if(this.state.fetchStatus!=="idle"&&this.#i?.status()!=="rejected"){if(this.state.data!==void 0&&e?.cancelRefetch)this.cancel({silent:!0});else if(this.#i)return this.#i.continueRetry(),this.#i.promise}if(t&&this.setOptions(t),!this.options.queryFn){const r=this.observers.find(u=>u.options.queryFn);r&&this.setOptions(r.options)}const s=new AbortController,i=r=>{Object.defineProperty(r,"signal",{enumerable:!0,get:()=>(this.#o=!0,s.signal)})},n=()=>{const r=B(this.options,e),h=(()=>{const d={client:this.#r,queryKey:this.queryKey,meta:this.meta};return i(d),d})();return this.#o=!1,this.options.persister?this.options.persister(r,h,this):r(h)},o=(()=>{const r={fetchOptions:e,options:this.options,queryKey:this.queryKey,client:this.#r,state:this.state,fetchFn:n};return i(r),r})();this.options.behavior?.onFetch(o,this),this.#e=this.state,(this.state.fetchStatus==="idle"||this.state.fetchMeta!==o.fetchOptions?.meta)&&this.#n({type:"fetch",meta:o.fetchOptions?.meta}),this.#i=W({initialPromise:e?.initialPromise,fn:o.fetchFn,onCancel:r=>{r instanceof K&&r.revert&&this.setState({...this.#e,fetchStatus:"idle"}),s.abort()},onFail:(r,u)=>{this.#n({type:"failed",failureCount:r,error:u})},onPause:()=>{this.#n({type:"pause"})},onContinue:()=>{this.#n({type:"continue"})},retry:o.options.retry,retryDelay:o.options.retryDelay,networkMode:o.options.networkMode,canRun:()=>!0});try{const r=await this.#i.start();if(r===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(r),this.#s.config.onSuccess?.(r,this),this.#s.config.onSettled?.(r,this.state.error,this),r}catch(r){if(r instanceof K){if(r.silent)return this.#i.promise;if(r.revert){if(this.state.data===void 0)throw r;return this.state.data}}throw this.#n({type:"error",error:r}),this.#s.config.onError?.(r,this),this.#s.config.onSettled?.(this.state.data,r,this),r}finally{this.scheduleGc()}}#n(t){const e=s=>{switch(t.type){case"failed":return{...s,fetchFailureCount:t.failureCount,fetchFailureReason:t.error};case"pause":return{...s,fetchStatus:"paused"};case"continue":return{...s,fetchStatus:"fetching"};case"fetch":return{...s,...vt(s.data,this.options),fetchMeta:t.meta??null};case"success":const i={...s,...G(t.data,t.dataUpdatedAt),dataUpdateCount:s.dataUpdateCount+1,...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return this.#e=t.manual?i:void 0,i;case"error":const n=t.error;return{...s,error:n,errorUpdateCount:s.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:s.fetchFailureCount+1,fetchFailureReason:n,fetchStatus:"idle",status:"error"};case"invalidate":return{...s,isInvalidated:!0};case"setState":return{...s,...t.state}}};this.state=e(this.state),y.batch(()=>{this.observers.forEach(s=>{s.onQueryUpdate()}),this.#s.notify({query:this,type:"updated",action:t})})}};function vt(t,e){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:z(e.networkMode)?"fetching":"paused",...t===void 0&&{error:null,status:"pending"}}}function G(t,e){return{data:t,dataUpdatedAt:e??Date.now(),error:null,isInvalidated:!1,status:"success"}}function N(t){const e=typeof t.initialData=="function"?t.initialData():t.initialData,s=e!==void 0,i=s?typeof t.initialDataUpdatedAt=="function"?t.initialDataUpdatedAt():t.initialDataUpdatedAt:0;return{data:e,dataUpdateCount:0,dataUpdatedAt:s?i??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:s?"success":"pending",fetchStatus:"idle"}}function V(t){return{onFetch:(e,s)=>{const i=e.options,n=e.fetchOptions?.meta?.fetchMore?.direction,a=e.state.data?.pages||[],o=e.state.data?.pageParams||[];let r={pages:[],pageParams:[]},u=0;const h=async()=>{let d=!1;const l=f=>{Object.defineProperty(f,"signal",{enumerable:!0,get:()=>(e.signal.aborted?d=!0:e.signal.addEventListener("abort",()=>{d=!0}),e.signal)})},m=B(e.options,e.fetchOptions),b=async(f,c,p)=>{if(d)return Promise.reject();if(c==null&&f.pages.length)return Promise.resolve(f);const w=(()=>{const k={client:e.client,queryKey:e.queryKey,pageParam:c,direction:p?"backward":"forward",meta:e.options.meta};return l(k),k})(),O=await m(w),{maxPages:q}=e.options,S=p?ht:ut;return{pages:S(f.pages,O,q),pageParams:S(f.pageParams,c,q)}};if(n&&a.length){const f=n==="backward",c=f?gt:_,p={pages:a,pageParams:o},g=c(i,p);r=await b(p,g,f)}else{const f=t??a.length;do{const c=u===0?o[0]??i.initialPageParam:_(i,r);if(u>0&&c==null)break;r=await b(r,c),u++}while(u<f)}return r};e.options.persister?e.fetchFn=()=>e.options.persister?.(h,{client:e.client,queryKey:e.queryKey,meta:e.options.meta,signal:e.signal},s):e.fetchFn=h}}}function _(t,{pages:e,pageParams:s}){const i=e.length-1;return e.length>0?t.getNextPageParam(e[i],e,s[i],s):void 0}function gt(t,{pages:e,pageParams:s}){return e.length>0?t.getPreviousPageParam?.(e[0],e,s[0],s):void 0}var bt=class extends Z{#t;#e;#s;#r;constructor(t){super(),this.#t=t.client,this.mutationId=t.mutationId,this.#s=t.mutationCache,this.#e=[],this.state=t.state||wt(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){this.#e.includes(t)||(this.#e.push(t),this.clearGcTimeout(),this.#s.notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){this.#e=this.#e.filter(e=>e!==t),this.scheduleGc(),this.#s.notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){this.#e.length||(this.state.status==="pending"?this.scheduleGc():this.#s.remove(this))}continue(){return this.#r?.continue()??this.execute(this.state.variables)}async execute(t){const e=()=>{this.#i({type:"continue"})},s={client:this.#t,meta:this.options.meta,mutationKey:this.options.mutationKey};this.#r=W({fn:()=>this.options.mutationFn?this.options.mutationFn(t,s):Promise.reject(new Error("No mutationFn found")),onFail:(a,o)=>{this.#i({type:"failed",failureCount:a,error:o})},onPause:()=>{this.#i({type:"pause"})},onContinue:e,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#s.canRun(this)});const i=this.state.status==="pending",n=!this.#r.canStart();try{if(i)e();else{this.#i({type:"pending",variables:t,isPaused:n}),await this.#s.config.onMutate?.(t,this,s);const o=await this.options.onMutate?.(t,s);o!==this.state.context&&this.#i({type:"pending",context:o,variables:t,isPaused:n})}const a=await this.#r.start();return await this.#s.config.onSuccess?.(a,t,this.state.context,this,s),await this.options.onSuccess?.(a,t,this.state.context,s),await this.#s.config.onSettled?.(a,null,this.state.variables,this.state.context,this,s),await this.options.onSettled?.(a,null,t,this.state.context,s),this.#i({type:"success",data:a}),a}catch(a){try{throw await this.#s.config.onError?.(a,t,this.state.context,this,s),await this.options.onError?.(a,t,this.state.context,s),await this.#s.config.onSettled?.(void 0,a,this.state.variables,this.state.context,this,s),await this.options.onSettled?.(void 0,a,t,this.state.context,s),a}finally{this.#i({type:"error",error:a})}}finally{this.#s.runNext(this)}}#i(t){const e=s=>{switch(t.type){case"failed":return{...s,failureCount:t.failureCount,failureReason:t.error};case"pause":return{...s,isPaused:!0};case"continue":return{...s,isPaused:!1};case"pending":return{...s,context:t.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:t.isPaused,status:"pending",variables:t.variables,submittedAt:Date.now()};case"success":return{...s,data:t.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...s,data:void 0,error:t.error,failureCount:s.failureCount+1,failureReason:t.error,isPaused:!1,status:"error"}}};this.state=e(this.state),y.batch(()=>{this.#e.forEach(s=>{s.onMutationUpdate(t)}),this.#s.notify({mutation:this,type:"updated",action:t})})}};function wt(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var Ct=class extends T{constructor(t={}){super(),this.config=t,this.#t=new Set,this.#e=new Map,this.#s=0}#t;#e;#s;build(t,e,s){const i=new bt({client:t,mutationCache:this,mutationId:++this.#s,options:t.defaultMutationOptions(e),state:s});return this.add(i),i}add(t){this.#t.add(t);const e=A(t);if(typeof e=="string"){const s=this.#e.get(e);s?s.push(t):this.#e.set(e,[t])}this.notify({type:"added",mutation:t})}remove(t){if(this.#t.delete(t)){const e=A(t);if(typeof e=="string"){const s=this.#e.get(e);if(s)if(s.length>1){const i=s.indexOf(t);i!==-1&&s.splice(i,1)}else s[0]===t&&this.#e.delete(e)}}this.notify({type:"removed",mutation:t})}canRun(t){const e=A(t);if(typeof e=="string"){const i=this.#e.get(e)?.find(n=>n.state.status==="pending");return!i||i===t}else return!0}runNext(t){const e=A(t);return typeof e=="string"?this.#e.get(e)?.find(i=>i!==t&&i.state.isPaused)?.continue()??Promise.resolve():Promise.resolve()}clear(){y.batch(()=>{this.#t.forEach(t=>{this.notify({type:"removed",mutation:t})}),this.#t.clear(),this.#e.clear()})}getAll(){return Array.from(this.#t)}find(t){const e={exact:!0,...t};return this.getAll().find(s=>x(e,s))}findAll(t={}){return this.getAll().filter(e=>x(t,e))}notify(t){y.batch(()=>{this.listeners.forEach(e=>{e(t)})})}resumePausedMutations(){const t=this.getAll().filter(e=>e.state.isPaused);return y.batch(()=>Promise.all(t.map(e=>e.continue().catch(v))))}};function A(t){return t.options.scope?.id}var Ot=class extends T{constructor(t={}){super(),this.config=t,this.#t=new Map}#t;build(t,e,s){const i=e.queryKey,n=e.queryHash??j(i,e);let a=this.get(n);return a||(a=new mt({client:t,queryKey:i,queryHash:n,options:t.defaultQueryOptions(e),state:s,defaultOptions:t.getQueryDefaults(i)}),this.add(a)),a}add(t){this.#t.has(t.queryHash)||(this.#t.set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const e=this.#t.get(t.queryHash);e&&(t.destroy(),e===t&&this.#t.delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){y.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return this.#t.get(t)}getAll(){return[...this.#t.values()]}find(t){const e={exact:!0,...t};return this.getAll().find(s=>U(e,s))}findAll(t={}){const e=this.getAll();return Object.keys(t).length>0?e.filter(s=>U(t,s)):e}notify(t){y.batch(()=>{this.listeners.forEach(e=>{e(t)})})}onFocus(){y.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){y.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},Pt=class{#t;#e;#s;#r;#i;#a;#o;#n;constructor(t={}){this.#t=t.queryCache||new Ot,this.#e=t.mutationCache||new Ct,this.#s=t.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=J.subscribe(async t=>{t&&(await this.resumePausedMutations(),this.#t.onFocus())}),this.#n=D.subscribe(async t=>{t&&(await this.resumePausedMutations(),this.#t.onOnline())}))}unmount(){this.#a--,this.#a===0&&(this.#o?.(),this.#o=void 0,this.#n?.(),this.#n=void 0)}isFetching(t){return this.#t.findAll({...t,fetchStatus:"fetching"}).length}isMutating(t){return this.#e.findAll({...t,status:"pending"}).length}getQueryData(t){const e=this.defaultQueryOptions({queryKey:t});return this.#t.get(e.queryHash)?.state.data}ensureQueryData(t){const e=this.defaultQueryOptions(t),s=this.#t.build(this,e),i=s.state.data;return i===void 0?this.fetchQuery(t):(t.revalidateIfStale&&s.isStaleByTime(E(e.staleTime,s))&&this.prefetchQuery(e),Promise.resolve(i))}getQueriesData(t){return this.#t.findAll(t).map(({queryKey:e,state:s})=>{const i=s.data;return[e,i]})}setQueryData(t,e,s){const i=this.defaultQueryOptions({queryKey:t}),a=this.#t.get(i.queryHash)?.state.data,o=et(e,a);if(o!==void 0)return this.#t.build(this,i).setData(o,{...s,manual:!0})}setQueriesData(t,e,s){return y.batch(()=>this.#t.findAll(t).map(({queryKey:i})=>[i,this.setQueryData(i,e,s)]))}getQueryState(t){const e=this.defaultQueryOptions({queryKey:t});return this.#t.get(e.queryHash)?.state}removeQueries(t){const e=this.#t;y.batch(()=>{e.findAll(t).forEach(s=>{e.remove(s)})})}resetQueries(t,e){const s=this.#t;return y.batch(()=>(s.findAll(t).forEach(i=>{i.reset()}),this.refetchQueries({type:"active",...t},e)))}cancelQueries(t,e={}){const s={revert:!0,...e},i=y.batch(()=>this.#t.findAll(t).map(n=>n.cancel(s)));return Promise.all(i).then(v).catch(v)}invalidateQueries(t,e={}){return y.batch(()=>(this.#t.findAll(t).forEach(s=>{s.invalidate()}),t?.refetchType==="none"?Promise.resolve():this.refetchQueries({...t,type:t?.refetchType??t?.type??"active"},e)))}refetchQueries(t,e={}){const s={...e,cancelRefetch:e.cancelRefetch??!0},i=y.batch(()=>this.#t.findAll(t).filter(n=>!n.isDisabled()&&!n.isStatic()).map(n=>{let a=n.fetch(void 0,s);return s.throwOnError||(a=a.catch(v)),n.state.fetchStatus==="paused"?Promise.resolve():a}));return Promise.all(i).then(v)}fetchQuery(t){const e=this.defaultQueryOptions(t);e.retry===void 0&&(e.retry=!1);const s=this.#t.build(this,e);return s.isStaleByTime(E(e.staleTime,s))?s.fetch(e):Promise.resolve(s.state.data)}prefetchQuery(t){return this.fetchQuery(t).then(v).catch(v)}fetchInfiniteQuery(t){return t.behavior=V(t.pages),this.fetchQuery(t)}prefetchInfiniteQuery(t){return this.fetchInfiniteQuery(t).then(v).catch(v)}ensureInfiniteQueryData(t){return t.behavior=V(t.pages),this.ensureQueryData(t)}resumePausedMutations(){return D.isOnline()?this.#e.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#t}getMutationCache(){return this.#e}getDefaultOptions(){return this.#s}setDefaultOptions(t){this.#s=t}setQueryDefaults(t,e){this.#r.set(P(t),{queryKey:t,defaultOptions:e})}getQueryDefaults(t){const e=[...this.#r.values()],s={};return e.forEach(i=>{F(t,i.queryKey)&&Object.assign(s,i.defaultOptions)}),s}setMutationDefaults(t,e){this.#i.set(P(t),{mutationKey:t,defaultOptions:e})}getMutationDefaults(t){const e=[...this.#i.values()],s={};return e.forEach(i=>{F(t,i.mutationKey)&&Object.assign(s,i.defaultOptions)}),s}defaultQueryOptions(t){if(t._defaulted)return t;const e={...this.#s.queries,...this.getQueryDefaults(t.queryKey),...t,_defaulted:!0};return e.queryHash||(e.queryHash=j(e.queryKey,e)),e.refetchOnReconnect===void 0&&(e.refetchOnReconnect=e.networkMode!=="always"),e.throwOnError===void 0&&(e.throwOnError=!!e.suspense),!e.networkMode&&e.persister&&(e.networkMode="offlineFirst"),e.queryFn===I&&(e.enabled=!1),e}defaultMutationOptions(t){return t?._defaulted?t:{...this.#s.mutations,...t?.mutationKey&&this.getMutationDefaults(t.mutationKey),...t,_defaulted:!0}}clear(){this.#t.clear(),this.#e.clear()}};class C{constructor(e={}){this.availableDatasets=[],this.apiUrl=e.apiUrl||"https://api.luzmo.com",this.apiVersion=e.apiVersion||"0.1.0",this.authKey=e.authKey||"",this.authToken=e.authToken||"",this.queryClient=new Pt({defaultOptions:{queries:{staleTime:e.staleTime||300*1e3,gcTime:e.gcTime||600*1e3,retry:e.retry||3,retryDelay:e.retryDelay||(s=>Math.min(1e3*2**s,3e4))}}}),this.initNetworkListeners()}configure(e={}){if(e.apiVersion&&(this.apiVersion=e.apiVersion),e.apiUrl&&(this.apiUrl=e.apiUrl),e.authKey&&(this.authKey=e.authKey),e.authToken&&(this.authToken=e.authToken),e.staleTime||e.gcTime||e.retry){const s={};e.staleTime&&(s.staleTime=e.staleTime),e.gcTime&&(s.gcTime=e.gcTime),e.retry&&(s.retry=e.retry),this.queryClient.setDefaultOptions({queries:{...this.queryClient.getDefaultOptions().queries,...s}})}}initNetworkListeners(){typeof window<"u"&&window.addEventListener("online",()=>{console.warn("Network connection restored, refreshing data..."),this.refreshAll()})}getHeaders(e={}){return{"Content-Type":"application/json",...e}}async fetchApi(e,s,i={}){const n=`${this.apiUrl}/${this.apiVersion}${e}`,o={method:i.method||"POST",headers:this.getHeaders(i.headers),mode:"cors",...i};s!==void 0&&(s.key=this.authKey,s.token=this.authToken,o.body=JSON.stringify(s));try{const r=await fetch(n,o);if(!r.ok){const u=await r.json().catch(()=>null);throw r.status===401||r.status===403?new Error("Authentication failed. Please check your API token."):r.status===404?new Error(`Resource not found: ${e}`):r.status===429?new Error("Rate limit exceeded. Please try again later."):new Error(u?.message||`API request failed with status ${r.status}`)}return await r.json()}catch(r){throw console.error(`API request to ${e} failed:`,r),r instanceof Error&&(r.endpoint=e,r.timestamp=new Date().toISOString()),r}}async fetchAllDatasets(e={}){const s=e.offset||0,i=e.limit||50,n=["datasets",s,i];return await this.queryClient.fetchQuery({queryKey:n,queryFn:async()=>{const a={action:"get",version:this.apiVersion,find:{where:{type:"dataset"},limit:i,offset:s}},o=await this.fetchApi("/securable",a);return{data:o?.rows??[],pagination:{offset:s,limit:i,total:o?.count??0,pages:Math.ceil((o?.count??0)/i)}}}})}async searchDatasets(e,s){if(!e)return{data:[]};const i=["datasets","search",e,s];return await this.queryClient.fetchQuery({queryKey:i,queryFn:async()=>{const n={action:"get",version:this.apiVersion,find:{where:{type:"dataset"}}};e?.length>0&&(n.find.search={match_types:["name"],keyphrase:e}),s?.offset&&(n.find.offset=s?.offset),s?.limit&&(n.find.limit=s?.limit);const a=await this.fetchApi("/securable",n),o={data:a?.rows??[]};return s?.limit&&(o.pagination={offset:s?.offset??0,limit:s?.limit,total:a?.count??0,pages:Math.ceil((a?.count??0)/s?.limit)}),o}})}async fetchDatasetsWithColumnsAndFormulas(e){if(!e||e.length===0)throw new Error("At least one dataset ID is required");const s=["datasets",e,this.authKey,this.authToken];return await this.queryClient.fetchQuery({queryKey:s,queryFn:async()=>{const i={action:"get",version:this.apiVersion,find:{where:{type:"dataset",id:{in:e}},attributes:["name","id","description"],include:[{model:"Column",attributes:["id","name","description","type","subtype","format","hidden","lowestLevel","expression","duration_levels","duration_format"],separate:!0,order:[["order","asc"]],include:[{model:"Column",attributes:["id","securable_id","hierarchy_enabled","currency_id"],as:"Joins"},{model:"HierarchyLevel",attributes:["id","level","name"],as:"HierarchyLevels"},{model:"Currency",attributes:["id","name","symbol"],as:"Currency"}]},{model:"Formula",attributes:["id","name","description","type","subtype","format","hidden","lowestLevel","expression","duration_levels","duration_format"],include:[{model:"Currency",attributes:["id","name","symbol"],as:"Currency"}]}]}};return(await this.fetchApi("/securable",i))?.rows??[]}})}async fetchData(e){if(!e)throw new Error("Query is required");const s=["data",e];return await this.queryClient.fetchQuery({queryKey:s,queryFn:async()=>{const i={action:"get",version:this.apiVersion,find:{queries:[e]}},n=await this.fetchApi("/data",i);return{data:n?.data||[],performance:n?.performance||{}}}})}refreshAll(){this.queryClient.refetchQueries()}invalidateDatasetData(e){e?(this.queryClient.invalidateQueries({queryKey:["dataset",e]}),this.queryClient.invalidateQueries({queryKey:["columns",e]})):this.queryClient.invalidateQueries({queryKey:["datasets"]})}invalidateAll(){this.queryClient.clear()}static getInstance(e={}){return C.instance?Object.keys(e).length>0&&C.instance.configure(e):C.instance=new C(e),C.instance}async fetchDatasetsRecursive(e){if(!e||e.length===0)throw new Error("At least one dataset ID is required");const s=[...new Set(e)],i=new Set,n=new Map,a=o=>{o&&!i.has(o)&&!s.includes(o)&&s.push(o)};for(;s.length>0;){const o=[];for(;s.length>0&&o.length<50;){const r=s.shift();i.has(r)||o.push(r)}if(o.length!==0)try{(await this.fetchDatasetsWithColumnsAndFormulas(o)).forEach(u=>{const h=this.postProcessDatasetMetadata(u);i.add(h.id),this.queryClient.setQueryData(["dataset",h.id],h),(h.outgoingJoins??[]).map(l=>l.securable_id).filter(l=>!!l&&l!==h.id).forEach(l=>{a(l)}),n.set(h.id,h),this.availableDatasets.some(l=>l.id===h.id)||this.availableDatasets.push({id:h.id,name:h.name,columns:h.columns})})}catch(r){console.error("Error fetching datasets recursively:",r)}}return[...n.values()]}postProcessDatasetMetadata(e){const s=[],i=(e.columns??[]).map(n=>{const a=n.joins??(Array.isArray(n.joins)?n.joins:[]);Array.isArray(a)&&a.length>0&&s.push(...a);const{joins:o,...r}=n;return{...r,joins:a}});return{...e,columns:i,formulas:e.formulas??[],outgoingJoins:s,dateLoaded:new Date}}getAvailableDatasets(){return this.availableDatasets}getLinkedDatasetsIds(e){const s=this.queryClient.getQueryData(["dataset",e]);return s?(s.outgoingJoins??[]).map(i=>i.securable_id).filter(i=>!!i&&i!==e):[]}}const Ft=C.getInstance();exports.dataBroker=Ft;
|
|
@@ -33,7 +33,7 @@ import { msg as m } from "@lit/localize";
|
|
|
33
33
|
import { luzmoIcon as g, luzmoInfoCircleOutline as C, luzmoTrashOutline as x } from "@luzmo/icons";
|
|
34
34
|
import { L as S } from "./focusable-BS2pbY7w.js";
|
|
35
35
|
import { S as $, E as T } from "./sized-mixin-cJbo3PKR.js";
|
|
36
|
-
import { f as w } from "./en-
|
|
36
|
+
import { f as w } from "./en-D3ihEGXg.js";
|
|
37
37
|
const D = h(
|
|
38
38
|
Symbol("slot-store-context")
|
|
39
39
|
), E = ":host{font-family:var(--luzmo-display-settings-font-family, var(--luzmo-font-family));font-size:var(--luzmo-display-settings-font-size, var(--display-settings-font-size));color:var(--luzmo-display-settings-font-color, var(--luzmo-font-color))}.settings-container{display:flex;flex-direction:column;gap:var(--luzmo-display-settings-vertical-gap, var(--luzmo-spacing-2))}.settings-row{display:flex;justify-content:flex-start;align-items:center;gap:var(--luzmo-display-settings-gap, var(--display-settings-gap))}luzmo-divider{margin:var(--luzmo-display-settings-ids-container-vertical-margin, var(--display-settings-ids-container-vertical-margin)) 0}luzmo-tooltip{--tooltip-font-size: var( --luzmo-display-settings-tooltip-font-size, var(--tooltip-font-size) )}.setting{display:flex;align-items:center}.label-action-container{display:flex;align-items:center;justify-content:space-between;gap:var(--luzmo-display-settings-info-to-remove-icon-gap, var(--display-settings-info-to-remove-icon-gap))}.id-button,.remove-button{outline:none;cursor:pointer;border:none;background:none;font-size:var(--luzmo-display-settings-id-button-font-size, var(--luzmo-display-settings-font-size, var(--display-settings-font-size)));color:var(--luzmo-display-settings-font-color, var(--luzmo-font-color))}.remove-button{display:block;width:var(--luzmo-display-settings-remove-button-size, var(--display-settings-remove-button-size));height:var(--luzmo-display-settings-remove-button-size, var(--display-settings-remove-button-size));border-radius:var(--luzmo-display-settings-remove-button-border-radius, 50%)}.remove-button:hover{background-color:var(--luzmo-display-settings-remove-button-background-color-hover, var(--luzmo-background-color-hover))}.remove-button:active,.remove-button:focus{background-color:var(--luzmo-display-settings-remove-button-background-color-down, var(--luzmo-background-color-down))}.remove-button:focus-visible{box-shadow:0 0 0 var(--luzmo-display-settings-remove-button-indicator-thickness, var(--display-settings-remove-button-indicator-thickness)) var(--highcontrast-remove-button-indicator-color, var(--luzmo-display-settings-remove-button-indicator-color, var(--display-settings-remove-button-indicator-color)))}.ids-container{display:flex;flex-direction:column;gap:var(--luzmo-display-settings-ids-container-gap, var(--luzmo-spacing-2));border-radius:50%}.id-label{text-transform:var(--luzmo-display-settings-id-label-text-transform, var(--display-settings-id-label-text-transform));font-size:var(--luzmo-display-settings-id-label-font-size, var(--display-settings-id-label-font-size));color:var(--luzmo-display-settings-id-label-color, var(--display-settings-id-label-color))}.id-value{-webkit-user-select:text;user-select:text;cursor:text}.example-container{line-height:var(--luzmo-display-settings-example-height, var(--display-settings-example-height));font-size:var(--luzmo-display-settings-example-font-size, var(--display-settings-example-font-size));color:var(--luzmo-display-settings-example-color, var(--display-settings-example-color))}.example-container .example-label{font-weight:var(--luzmo-display-settings-example-label-font-weight, var(--display-settings-example-label-font-weight));color:var(--luzmo-display-settings-example-label-color, var(--display-settings-example-label-color))}.example-container .example-language{text-transform:uppercase;color:var(--luzmo-display-settings-example-language-color, var(--display-settings-example-language-color))}.example-container{gap:var(--luzmo-display-settings-example-container-gap, var(--luzmo-spacing-2))}:host{--display-settings-font-family: var(--luzmo-font-family);--display-settings-id-label-text-transform: uppercase;--display-settings-id-label-color: var(--luzmo-secondary);--display-settings-remove-button-indicator-color: var(--luzmo-primary);--display-settings-remove-button-indicator-thickness: var( --luzmo-border-width )}:host{--display-settings-font-size: var(--luzmo-font-size);--display-settings-id-label-font-size: var(--luzmo-font-size-s);--display-settings-gap: var(--luzmo-spacing-3);--display-settings-ids-container-vertical-margin: var(--luzmo-spacing-4);--display-settings-info-to-remove-icon-gap: var(--luzmo-spacing-5);--display-settings-remove-button-size: var(--luzmo-component-height)}:host([size=s]){--display-settings-id-label-font-size: var(--luzmo-font-size-s);--display-settings-font-size: var(--luzmo-font-size-s);--display-settings-gap: var(--luzmo-spacing-3);--display-settings-ids-container-vertical-margin: var(--luzmo-spacing-3);--display-settings-info-to-remove-icon-gap: var(--luzmo-spacing-4);--display-settings-remove-button-size: var(--luzmo-component-height-s)}:host([size=l]){--display-settings-id-label-font-size: var(--luzmo-font-size);--display-settings-font-size: var(--luzmo-font-size-l);--display-settings-gap: var(--luzmo-spacing-4);--display-settings-ids-container-vertical-margin: var(--luzmo-spacing-5);--display-settings-info-to-remove-icon-gap: calc( var(--luzmo-spacing-5) + var(--luzmo-spacing-1) );--display-settings-remove-button-size: var(--luzmo-component-height-l)}:host([size=xl]){--display-settings-id-label-font-size: var(--luzmo-font-size-l);--display-settings-font-size: var(--luzmo-font-size-xl);--display-settings-gap: var(--luzmo-spacing-5);--display-settings-ids-container-vertical-margin: calc( var(--luzmo-spacing-5) + var(--luzmo-spacing-1) );--display-settings-info-to-remove-icon-gap: calc( var(--luzmo-spacing-5) + var(--luzmo-spacing-2) );--display-settings-remove-button-size: var(--luzmo-component-height-xl)}:host{--display-settings-example-font-size: var(--luzmo-font-size);--display-settings-example-color: var(--luzmo-font-color);--display-settings-example-label-font-weight: bold;--display-settings-example-label-color: var(--luzmo-primary);--display-settings-example-language-color: var(--luzmo-primary)}:host{--display-settings-example-height: var(--luzmo-component-height)}:host([size=s]){--display-settings-example-height: var(--luzmo-component-height-s);--display-settings-example-font-size: var(--luzmo-font-size-s)}:host([size=l]){--display-settings-example-height: var(--luzmo-component-height-l);--display-settings-example-font-size: var(--luzmo-font-size)}:host([size=xl]){--display-settings-example-height: var(--luzmo-component-height-xl);--display-settings-example-font-size: var(--luzmo-font-size-l)}";
|