@mhmo91/schmancy 0.2.176 → 0.2.177

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.
@@ -1,4 +1,4 @@
1
- import { $ as c, j as e, l as n, m, n as s, k as i, o, i as t } from "./avatar-CrxW01Pl.js";
1
+ import { $ as c, j as e, l as n, m, n as s, k as i, o, i as t } from "./avatar-CbR-jibC.js";
2
2
  export {
3
3
  c as $drawer,
4
4
  e as SchmancyDrawerAppbar,
@@ -1,31 +1,31 @@
1
- "use strict";const p=require("./tslib.es6-DgOcxv4s.cjs"),n=require("lit"),y=require("lit/decorators/property.js"),k=require("lit/directive.js"),F=require("lit/async-directive.js"),P=require("lit/directives/repeat.js"),D=require("./litElement.mixin-DcVBwo9t.cjs"),a=require("lit/decorators.js");var N=Object.defineProperty,j=Object.getOwnPropertyDescriptor,g=(l,t,e,i)=>{for(var s,r=i>1?void 0:i?j(t,e):t,o=l.length-1;o>=0;o--)(s=l[o])&&(r=(i?s(t,e,r):s(r))||r);return i&&r&&N(t,e,r),r};exports.SchmancyTableRow=class extends D.$LitElement(){constructor(){super(...arguments),this.columns=[],this.cols=this.columns.map(()=>"1fr").join(" ")}renderCell(l){if(l.render)return n.html`
1
+ "use strict";const y=require("./tslib.es6-DgOcxv4s.cjs"),h=require("lit"),g=require("lit/decorators/property.js"),k=require("lit/directive.js"),N=require("lit/async-directive.js"),B=require("lit/directives/repeat.js"),D=require("./litElement.mixin-DcVBwo9t.cjs"),u=require("lit/decorators.js");var j=Object.defineProperty,P=Object.getOwnPropertyDescriptor,f=(l,t,e,i)=>{for(var s,r=i>1?void 0:i?P(t,e):t,o=l.length-1;o>=0;o--)(s=l[o])&&(r=(i?s(t,e,r):s(r))||r);return i&&r&&j(t,e,r),r};exports.SchmancyTableRow=class extends D.$LitElement(){constructor(){super(...arguments),this.columns=[],this.cols=this.columns.map(()=>"1fr").join(" ")}renderCell(l){if(l.render)return h.html`
2
2
  <div class="overflow-hidden text-ellipsis">
3
3
  <schmancy-typography align="${l.align||"left"}" maxLines="2" weight="${l.weight||"normal"}">
4
4
  ${l.render(this.item)}
5
5
  </schmancy-typography>
6
6
  </div>
7
- `;const t=l.key?this.item[l.key]:"";return n.html`
7
+ `;const t=l.key?this.item[l.key]:"";return h.html`
8
8
  <div class="overflow-hidden text-ellipsis">
9
9
  <schmancy-typography align="${l.align||"left"}" maxLines="2" weight="${l.weight||"normal"}">
10
10
  ${t}
11
11
  </schmancy-typography>
12
12
  </div>
13
- `}render(){return n.html`
13
+ `}render(){return h.html`
14
14
  <schmancy-list-item class="w-full">
15
15
  <schmancy-grid .cols=${this.cols} align="center" gap="md">
16
16
  ${this.columns.map(l=>this.renderCell(l))}
17
17
  </schmancy-grid>
18
18
  </schmancy-list-item>
19
- `}},g([a.property({type:Array,attribute:!1})],exports.SchmancyTableRow.prototype,"columns",2),g([a.property({type:Object,attribute:!1})],exports.SchmancyTableRow.prototype,"item",2),g([a.property({type:String})],exports.SchmancyTableRow.prototype,"cols",2),exports.SchmancyTableRow=g([a.customElement("schmancy-table-row")],exports.SchmancyTableRow);class b extends Event{constructor(t){super(b.eventName,{bubbles:!1}),this.first=t.first,this.last=t.last}}b.eventName="rangeChanged";class w extends Event{constructor(t){super(w.eventName,{bubbles:!1}),this.first=t.first,this.last=t.last}}w.eventName="visibilityChanged";class C extends Event{constructor(){super(C.eventName,{bubbles:!1})}}C.eventName="unpinned";class H{constructor(t){this._element=null;const e=t??window;this._node=e,t&&(this._element=t)}get element(){return this._element||document.scrollingElement||document.documentElement}get scrollTop(){return this.element.scrollTop||window.scrollY}get scrollLeft(){return this.element.scrollLeft||window.scrollX}get scrollHeight(){return this.element.scrollHeight}get scrollWidth(){return this.element.scrollWidth}get viewportHeight(){return this._element?this._element.getBoundingClientRect().height:window.innerHeight}get viewportWidth(){return this._element?this._element.getBoundingClientRect().width:window.innerWidth}get maxScrollTop(){return this.scrollHeight-this.viewportHeight}get maxScrollLeft(){return this.scrollWidth-this.viewportWidth}}class q extends H{constructor(t,e){super(e),this._clients=new Set,this._retarget=null,this._end=null,this.t=null,this.correctingScrollError=!1,this._checkForArrival=this._checkForArrival.bind(this),this._updateManagedScrollTo=this._updateManagedScrollTo.bind(this),this.scrollTo=this.scrollTo.bind(this),this.scrollBy=this.scrollBy.bind(this);const i=this._node;this._originalScrollTo=i.scrollTo,this._originalScrollBy=i.scrollBy,this._originalScroll=i.scroll,this._attach(t)}get _destination(){return this.t}get scrolling(){return this._destination!==null}scrollTo(t,e){const i=typeof t=="number"&&typeof e=="number"?{left:t,top:e}:t;this._scrollTo(i)}scrollBy(t,e){const i=typeof t=="number"&&typeof e=="number"?{left:t,top:e}:t;i.top!==void 0&&(i.top+=this.scrollTop),i.left!==void 0&&(i.left+=this.scrollLeft),this._scrollTo(i)}_nativeScrollTo(t){this._originalScrollTo.bind(this._element||window)(t)}_scrollTo(t,e=null,i=null){this._end!==null&&this._end(),t.behavior==="smooth"?(this._setDestination(t),this._retarget=e,this._end=i):this._resetScrollState(),this._nativeScrollTo(t)}_setDestination(t){let{top:e,left:i}=t;return e=e===void 0?void 0:Math.max(0,Math.min(e,this.maxScrollTop)),i=i===void 0?void 0:Math.max(0,Math.min(i,this.maxScrollLeft)),(this._destination===null||i!==this._destination.left||e!==this._destination.top)&&(this.t={top:e,left:i,behavior:"smooth"},!0)}_resetScrollState(){this.t=null,this._retarget=null,this._end=null}_updateManagedScrollTo(t){this._destination&&this._setDestination(t)&&this._nativeScrollTo(this._destination)}managedScrollTo(t,e,i){return this._scrollTo(t,e,i),this._updateManagedScrollTo}correctScrollError(t){this.correctingScrollError=!0,requestAnimationFrame(()=>requestAnimationFrame(()=>this.correctingScrollError=!1)),this._nativeScrollTo(t),this._retarget&&this._setDestination(this._retarget()),this._destination&&this._nativeScrollTo(this._destination)}_checkForArrival(){if(this._destination!==null){const{scrollTop:t,scrollLeft:e}=this;let{top:i,left:s}=this._destination;i=Math.min(i||0,this.maxScrollTop),s=Math.min(s||0,this.maxScrollLeft);const r=Math.abs(i-t),o=Math.abs(s-e);r<1&&o<1&&(this._end&&this._end(),this._resetScrollState())}}detach(t){return this._clients.delete(t),this._clients.size===0&&(this._node.scrollTo=this._originalScrollTo,this._node.scrollBy=this._originalScrollBy,this._node.scroll=this._originalScroll,this._node.removeEventListener("scroll",this._checkForArrival)),null}_attach(t){this._clients.add(t),this._clients.size===1&&(this._node.scrollTo=this.scrollTo,this._node.scrollBy=this.scrollBy,this._node.scroll=this.scrollTo,this._node.addEventListener("scroll",this._checkForArrival))}}let L=typeof window<"u"?window.ResizeObserver:void 0;const S=Symbol("virtualizerRef"),f="virtualizer-sizer";let z;class W{constructor(t){if(this._benchmarkStart=null,this._layout=null,this._clippingAncestors=[],this._scrollSize=null,this._scrollError=null,this._childrenPos=null,this._childMeasurements=null,this._toBeMeasured=new Map,this._rangeChanged=!0,this._itemsChanged=!0,this._visibilityChanged=!0,this._scrollerController=null,this._isScroller=!1,this._sizer=null,this._hostElementRO=null,this._childrenRO=null,this._mutationObserver=null,this._scrollEventListeners=[],this._scrollEventListenerOptions={passive:!0},this._loadListener=this._childLoaded.bind(this),this._scrollIntoViewTarget=null,this._updateScrollIntoViewCoordinates=null,this._items=[],this._first=-1,this._last=-1,this._firstVisible=-1,this._lastVisible=-1,this._scheduled=new WeakSet,this._measureCallback=null,this._measureChildOverride=null,this._layoutCompletePromise=null,this._layoutCompleteResolver=null,this._layoutCompleteRejecter=null,this._pendingLayoutComplete=null,this._layoutInitialized=null,this._connected=!1,!t)throw new Error("Virtualizer constructor requires a configuration object");if(!t.hostElement)throw new Error('Virtualizer configuration requires the "hostElement" property');this._init(t)}set items(t){Array.isArray(t)&&t!==this._items&&(this._itemsChanged=!0,this._items=t,this._schedule(this._updateLayout))}_init(t){this._isScroller=!!t.scroller,this._initHostElement(t);const e=t.layout||{};this._layoutInitialized=this._initLayout(e)}_initObservers(){this._mutationObserver=new MutationObserver(this._finishDOMUpdate.bind(this)),this._hostElementRO=new L(()=>this._hostElementSizeChanged()),this._childrenRO=new L(this._childrenSizeChanged.bind(this))}_initHostElement(t){const e=this._hostElement=t.hostElement;this._applyVirtualizerStyles(),e[S]=this}connected(){this._initObservers();const t=this._isScroller;this._clippingAncestors=function(e,i=!1){let s=!1;return function(r,o=!1){const u=[];let c=o?r:x(r);for(;c!==null;)u.push(c),c=x(c);return u}(e,i).filter(r=>{if(s)return!1;const o=getComputedStyle(r);return s=o.position==="fixed",o.overflow!=="visible"})}(this._hostElement,t),this._scrollerController=new q(this,this._clippingAncestors[0]),this._schedule(this._updateLayout),this._observeAndListen(),this._connected=!0}_observeAndListen(){this._mutationObserver.observe(this._hostElement,{childList:!0}),this._hostElementRO.observe(this._hostElement),this._scrollEventListeners.push(window),window.addEventListener("scroll",this,this._scrollEventListenerOptions),this._clippingAncestors.forEach(t=>{t.addEventListener("scroll",this,this._scrollEventListenerOptions),this._scrollEventListeners.push(t),this._hostElementRO.observe(t)}),this._hostElementRO.observe(this._scrollerController.element),this._children.forEach(t=>this._childrenRO.observe(t)),this._scrollEventListeners.forEach(t=>t.addEventListener("scroll",this,this._scrollEventListenerOptions))}disconnected(){var t,e,i,s;this._scrollEventListeners.forEach(r=>r.removeEventListener("scroll",this,this._scrollEventListenerOptions)),this._scrollEventListeners=[],this._clippingAncestors=[],(t=this._scrollerController)==null||t.detach(this),this._scrollerController=null,(e=this._mutationObserver)==null||e.disconnect(),this._mutationObserver=null,(i=this._hostElementRO)==null||i.disconnect(),this._hostElementRO=null,(s=this._childrenRO)==null||s.disconnect(),this._childrenRO=null,this._rejectLayoutCompletePromise("disconnected"),this._connected=!1}_applyVirtualizerStyles(){const t=this._hostElement.style;t.display=t.display||"block",t.position=t.position||"relative",t.contain=t.contain||"size layout",this._isScroller&&(t.overflow=t.overflow||"auto",t.minHeight=t.minHeight||"150px")}_getSizer(){const t=this._hostElement;if(!this._sizer){let e=t.querySelector(`[${f}]`);e||(e=document.createElement("div"),e.setAttribute(f,""),t.appendChild(e)),Object.assign(e.style,{position:"absolute",margin:"-2px 0 0 0",padding:0,visibility:"hidden",fontSize:"2px"}),e.textContent="&nbsp;",e.setAttribute(f,""),this._sizer=e}return this._sizer}async updateLayoutConfig(t){await this._layoutInitialized;const e=t.type||z;if(typeof e=="function"&&this._layout instanceof e){const i={...t};return delete i.type,this._layout.config=i,!0}return!1}async _initLayout(t){let e,i;if(typeof t.type=="function"){i=t.type;const s={...t};delete s.type,e=s}else e=t;i===void 0&&(z=i=(await Promise.resolve().then(()=>require("./flow-CnJl1T1A.cjs"))).FlowLayout),this._layout=new i(s=>this._handleLayoutMessage(s),e),this._layout.measureChildren&&typeof this._layout.updateItemSizes=="function"&&(typeof this._layout.measureChildren=="function"&&(this._measureChildOverride=this._layout.measureChildren),this._measureCallback=this._layout.updateItemSizes.bind(this._layout)),this._layout.listenForChildLoadEvents&&this._hostElement.addEventListener("load",this._loadListener,!0),this._schedule(this._updateLayout)}startBenchmarking(){this._benchmarkStart===null&&(this._benchmarkStart=window.performance.now())}stopBenchmarking(){if(this._benchmarkStart!==null){const t=window.performance.now(),e=t-this._benchmarkStart,i=performance.getEntriesByName("uv-virtualizing","measure").filter(s=>s.startTime>=this._benchmarkStart&&s.startTime<t).reduce((s,r)=>s+r.duration,0);return this._benchmarkStart=null,{timeElapsed:e,virtualizationTime:i}}return null}_measureChildren(){const t={},e=this._children,i=this._measureChildOverride||this._measureChild;for(let s=0;s<e.length;s++){const r=e[s],o=this._first+s;(this._itemsChanged||this._toBeMeasured.has(r))&&(t[o]=i.call(this,r,this._items[o]))}this._childMeasurements=t,this._schedule(this._updateLayout),this._toBeMeasured.clear()}_measureChild(t){const{width:e,height:i}=t.getBoundingClientRect();return Object.assign({width:e,height:i},function(s){const r=window.getComputedStyle(s);return{marginTop:v(r.marginTop),marginRight:v(r.marginRight),marginBottom:v(r.marginBottom),marginLeft:v(r.marginLeft)}}(t))}async _schedule(t){this._scheduled.has(t)||(this._scheduled.add(t),await Promise.resolve(),this._scheduled.delete(t),t.call(this))}async _updateDOM(t){this._scrollSize=t.scrollSize,this._adjustRange(t.range),this._childrenPos=t.childPositions,this._scrollError=t.scrollError||null;const{_rangeChanged:e,_itemsChanged:i}=this;this._visibilityChanged&&(this._notifyVisibility(),this._visibilityChanged=!1),(e||i)&&(this._notifyRange(),this._rangeChanged=!1),this._finishDOMUpdate()}_finishDOMUpdate(){this._connected&&(this._children.forEach(t=>this._childrenRO.observe(t)),this._checkScrollIntoViewTarget(this._childrenPos),this._positionChildren(this._childrenPos),this._sizeHostElement(this._scrollSize),this._correctScrollError(),this._benchmarkStart&&"mark"in window.performance&&window.performance.mark("uv-end"))}_updateLayout(){this._layout&&this._connected&&(this._layout.items=this._items,this._updateView(),this._childMeasurements!==null&&(this._measureCallback&&this._measureCallback(this._childMeasurements),this._childMeasurements=null),this._layout.reflowIfNeeded(),this._benchmarkStart&&"mark"in window.performance&&window.performance.mark("uv-end"))}_handleScrollEvent(){var t;if(this._benchmarkStart&&"mark"in window.performance){try{window.performance.measure("uv-virtualizing","uv-start","uv-end")}catch{}window.performance.mark("uv-start")}this._scrollerController.correctingScrollError===!1&&((t=this._layout)==null||t.unpin()),this._schedule(this._updateLayout)}handleEvent(t){t.type==="scroll"&&(t.currentTarget===window||this._clippingAncestors.includes(t.currentTarget))&&this._handleScrollEvent()}_handleLayoutMessage(t){t.type==="stateChanged"?this._updateDOM(t):t.type==="visibilityChanged"?(this._firstVisible=t.firstVisible,this._lastVisible=t.lastVisible,this._notifyVisibility()):t.type==="unpinned"&&this._hostElement.dispatchEvent(new C)}get _children(){const t=[];let e=this._hostElement.firstElementChild;for(;e;)e.hasAttribute(f)||t.push(e),e=e.nextElementSibling;return t}_updateView(){var s;const t=this._hostElement,e=(s=this._scrollerController)==null?void 0:s.element,i=this._layout;if(t&&e&&i){let r,o,u,c;const h=t.getBoundingClientRect();r=0,o=0,u=window.innerHeight,c=window.innerWidth;const E=this._clippingAncestors.map(_=>_.getBoundingClientRect());E.unshift(h);for(const _ of E)r=Math.max(r,_.top),o=Math.max(o,_.left),u=Math.min(u,_.bottom),c=Math.min(c,_.right);const T=e.getBoundingClientRect(),R={left:h.left-T.left,top:h.top-T.top},M={width:e.scrollWidth,height:e.scrollHeight},I=r-h.top+t.scrollTop,$=o-h.left+t.scrollLeft,A=Math.max(0,u-r),B=Math.max(0,c-o);i.viewportSize={width:B,height:A},i.viewportScroll={top:I,left:$},i.totalScrollSize=M,i.offsetWithinScroller=R}}_sizeHostElement(t){const i=t&&t.width!==null?Math.min(82e5,t.width):0,s=t&&t.height!==null?Math.min(82e5,t.height):0;if(this._isScroller)this._getSizer().style.transform=`translate(${i}px, ${s}px)`;else{const r=this._hostElement.style;r.minWidth=i?`${i}px`:"100%",r.minHeight=s?`${s}px`:"100%"}}_positionChildren(t){t&&t.forEach(({top:e,left:i,width:s,height:r,xOffset:o,yOffset:u},c)=>{const h=this._children[c-this._first];h&&(h.style.position="absolute",h.style.boxSizing="border-box",h.style.transform=`translate(${i}px, ${e}px)`,s!==void 0&&(h.style.width=s+"px"),r!==void 0&&(h.style.height=r+"px"),h.style.left=o===void 0?null:o+"px",h.style.top=u===void 0?null:u+"px")})}async _adjustRange(t){const{_first:e,_last:i,_firstVisible:s,_lastVisible:r}=this;this._first=t.first,this._last=t.last,this._firstVisible=t.firstVisible,this._lastVisible=t.lastVisible,this._rangeChanged=this._rangeChanged||this._first!==e||this._last!==i,this._visibilityChanged=this._visibilityChanged||this._firstVisible!==s||this._lastVisible!==r}_correctScrollError(){if(this._scrollError){const{scrollTop:t,scrollLeft:e}=this._scrollerController,{top:i,left:s}=this._scrollError;this._scrollError=null,this._scrollerController.correctScrollError({top:t-i,left:e-s})}}element(t){var e;return t===1/0&&(t=this._items.length-1),((e=this._items)==null?void 0:e[t])===void 0?void 0:{scrollIntoView:(i={})=>this._scrollElementIntoView({...i,index:t})}}_scrollElementIntoView(t){if(t.index>=this._first&&t.index<=this._last)this._children[t.index-this._first].scrollIntoView(t);else if(t.index=Math.min(t.index,this._items.length-1),t.behavior==="smooth"){const e=this._layout.getScrollIntoViewCoordinates(t),{behavior:i}=t;this._updateScrollIntoViewCoordinates=this._scrollerController.managedScrollTo(Object.assign(e,{behavior:i}),()=>this._layout.getScrollIntoViewCoordinates(t),()=>this._scrollIntoViewTarget=null),this._scrollIntoViewTarget=t}else this._layout.pin=t}_checkScrollIntoViewTarget(t){const{index:e}=this._scrollIntoViewTarget||{};e&&(t!=null&&t.has(e))&&this._updateScrollIntoViewCoordinates(this._layout.getScrollIntoViewCoordinates(this._scrollIntoViewTarget))}_notifyRange(){this._hostElement.dispatchEvent(new b({first:this._first,last:this._last}))}_notifyVisibility(){this._hostElement.dispatchEvent(new w({first:this._firstVisible,last:this._lastVisible}))}get layoutComplete(){return this._layoutCompletePromise||(this._layoutCompletePromise=new Promise((t,e)=>{this._layoutCompleteResolver=t,this._layoutCompleteRejecter=e})),this._layoutCompletePromise}_rejectLayoutCompletePromise(t){this._layoutCompleteRejecter!==null&&this._layoutCompleteRejecter(t),this._resetLayoutCompleteState()}_scheduleLayoutComplete(){this._layoutCompletePromise&&this._pendingLayoutComplete===null&&(this._pendingLayoutComplete=requestAnimationFrame(()=>requestAnimationFrame(()=>this._resolveLayoutCompletePromise())))}_resolveLayoutCompletePromise(){this._layoutCompleteResolver!==null&&this._layoutCompleteResolver(),this._resetLayoutCompleteState()}_resetLayoutCompleteState(){this._layoutCompletePromise=null,this._layoutCompleteResolver=null,this._layoutCompleteRejecter=null,this._pendingLayoutComplete=null}_hostElementSizeChanged(){this._schedule(this._updateLayout)}_childLoaded(){}_childrenSizeChanged(t){var e;if((e=this._layout)!=null&&e.measureChildren){for(const i of t)this._toBeMeasured.set(i.target,i.contentRect);this._measureChildren()}this._scheduleLayoutComplete(),this._itemsChanged=!1,this._rangeChanged=!1}}function v(l){const t=l?parseFloat(l):NaN;return Number.isNaN(t)?0:t}function x(l){if(l.assignedSlot!==null)return l.assignedSlot;if(l.parentElement!==null)return l.parentElement;const t=l.parentNode;return t&&t.nodeType===Node.DOCUMENT_FRAGMENT_NODE&&t.host||null}const O=l=>l,V=(l,t)=>n.html`${t}: ${JSON.stringify(l,null,2)}`;class U extends F.AsyncDirective{constructor(t){if(super(t),this._virtualizer=null,this._first=0,this._last=-1,this._renderItem=(e,i)=>V(e,i+this._first),this._keyFunction=(e,i)=>O(e,this._first),this._items=[],t.type!==k.PartType.CHILD)throw new Error("The virtualize directive can only be used in child expressions")}render(t){t&&this._setFunctions(t);const e=[];if(this._first>=0&&this._last>=this._first)for(let i=this._first;i<=this._last;i++)e.push(this._items[i]);return P.repeat(e,this._keyFunction,this._renderItem)}update(t,[e]){this._setFunctions(e);const i=this._items!==e.items;return this._items=e.items||[],this._virtualizer?this._updateVirtualizerConfig(t,e):this._initialize(t,e),i?n.noChange:this.render()}async _updateVirtualizerConfig(t,e){if(!await this._virtualizer.updateLayoutConfig(e.layout||{})){const i=t.parentNode;this._makeVirtualizer(i,e)}this._virtualizer.items=this._items}_setFunctions(t){const{renderItem:e,keyFunction:i}=t;e&&(this._renderItem=(s,r)=>e(s,r+this._first)),i&&(this._keyFunction=(s,r)=>i(s,r+this._first))}_makeVirtualizer(t,e){this._virtualizer&&this._virtualizer.disconnected();const{layout:i,scroller:s,items:r}=e;this._virtualizer=new W({hostElement:t,layout:i,scroller:s}),this._virtualizer.items=r,this._virtualizer.connected()}_initialize(t,e){const i=t.parentNode;i&&i.nodeType===1&&(i.addEventListener("rangeChanged",s=>{this._first=s.first,this._last=s.last,this.setValue(this.render())}),this._makeVirtualizer(i,e))}disconnected(){var t;(t=this._virtualizer)==null||t.disconnected()}reconnected(){var t;(t=this._virtualizer)==null||t.connected()}}const G=k.directive(U);class m extends n.LitElement{constructor(){super(...arguments),this.items=[],this.renderItem=V,this.keyFunction=O,this.layout={},this.scroller=!1}createRenderRoot(){return this}render(){const{items:t,renderItem:e,keyFunction:i,layout:s,scroller:r}=this;return n.html`${G({items:t,renderItem:e,keyFunction:i,layout:s,scroller:r})}`}element(t){var e;return(e=this[S])==null?void 0:e.element(t)}get layoutComplete(){var t;return(t=this[S])==null?void 0:t.layoutComplete}scrollToIndex(t,e="start"){var i;(i=this.element(t))==null||i.scrollIntoView({block:e})}}p.i([y.property({attribute:!1})],m.prototype,"items",void 0),p.i([y.property()],m.prototype,"renderItem",void 0),p.i([y.property()],m.prototype,"keyFunction",void 0),p.i([y.property({attribute:!1})],m.prototype,"layout",void 0),p.i([y.property({reflect:!0,type:Boolean})],m.prototype,"scroller",void 0),customElements.define("lit-virtualizer",m);var J=Object.defineProperty,X=Object.getOwnPropertyDescriptor,d=(l,t,e,i)=>{for(var s,r=i>1?void 0:i?X(t,e):t,o=l.length-1;o>=0;o--)(s=l[o])&&(r=(i?s(t,e,r):s(r))||r);return i&&r&&J(t,e,r),r};exports.SchmancyDataTable=class extends D.$LitElement(){constructor(){super(),this.columns=[],this.data=[],this.keyField="id",this.cols="1fr",this.sortable=!1,this.sortColumn=null,this.sortDirection=null,this.filteredData=[],this.filteredData=this.data}willUpdate(l){(l.has("data")||l.has("sortColumn")||l.has("sortDirection"))&&this.processData()}processData(){let l=[...this.data];this.sortable&&this.sortColumn&&this.sortDirection&&l.sort((t,e)=>{const i=t[this.sortColumn],s=e[this.sortColumn];if(typeof i=="string"&&typeof s=="string")return this.sortDirection==="asc"?i.localeCompare(s):s.localeCompare(i);if(typeof i=="number"&&typeof s=="number")return this.sortDirection==="asc"?i-s:s-i;if(i&&s&&i instanceof Date&&s instanceof Date)return this.sortDirection==="asc"?i.getTime()-s.getTime():s.getTime()-i.getTime();{const r=String(i||""),o=String(s||"");return this.sortDirection==="asc"?r.localeCompare(o):o.localeCompare(r)}}),this.filteredData=l}toggleSort(l){if(!l.key||l.sortable===!1)return;const t=l.key;t===this.sortColumn?this.sortDirection==="asc"?this.sortDirection="desc":this.sortDirection==="desc"?this.sortDirection=null:this.sortDirection="asc":(this.sortColumn=t,this.sortDirection="asc"),this.dispatchEvent(new CustomEvent("sort-change",{detail:{column:this.sortColumn,direction:this.sortDirection},bubbles:!0,composed:!0}))}renderSortIndicator(l){return this.sortable&&l.sortable!==!1&&l.key&&l.key===this.sortColumn?n.html`
19
+ `}},f([u.property({type:Array,attribute:!1})],exports.SchmancyTableRow.prototype,"columns",2),f([u.property({type:Object,attribute:!1})],exports.SchmancyTableRow.prototype,"item",2),f([u.property({type:String})],exports.SchmancyTableRow.prototype,"cols",2),exports.SchmancyTableRow=f([u.customElement("schmancy-table-row")],exports.SchmancyTableRow);class w extends Event{constructor(t){super(w.eventName,{bubbles:!1}),this.first=t.first,this.last=t.last}}w.eventName="rangeChanged";class C extends Event{constructor(t){super(C.eventName,{bubbles:!1}),this.first=t.first,this.last=t.last}}C.eventName="visibilityChanged";class S extends Event{constructor(){super(S.eventName,{bubbles:!1})}}S.eventName="unpinned";class H{constructor(t){this._element=null;const e=t??window;this._node=e,t&&(this._element=t)}get element(){return this._element||document.scrollingElement||document.documentElement}get scrollTop(){return this.element.scrollTop||window.scrollY}get scrollLeft(){return this.element.scrollLeft||window.scrollX}get scrollHeight(){return this.element.scrollHeight}get scrollWidth(){return this.element.scrollWidth}get viewportHeight(){return this._element?this._element.getBoundingClientRect().height:window.innerHeight}get viewportWidth(){return this._element?this._element.getBoundingClientRect().width:window.innerWidth}get maxScrollTop(){return this.scrollHeight-this.viewportHeight}get maxScrollLeft(){return this.scrollWidth-this.viewportWidth}}class q extends H{constructor(t,e){super(e),this._clients=new Set,this._retarget=null,this._end=null,this.t=null,this.correctingScrollError=!1,this._checkForArrival=this._checkForArrival.bind(this),this._updateManagedScrollTo=this._updateManagedScrollTo.bind(this),this.scrollTo=this.scrollTo.bind(this),this.scrollBy=this.scrollBy.bind(this);const i=this._node;this._originalScrollTo=i.scrollTo,this._originalScrollBy=i.scrollBy,this._originalScroll=i.scroll,this._attach(t)}get _destination(){return this.t}get scrolling(){return this._destination!==null}scrollTo(t,e){const i=typeof t=="number"&&typeof e=="number"?{left:t,top:e}:t;this._scrollTo(i)}scrollBy(t,e){const i=typeof t=="number"&&typeof e=="number"?{left:t,top:e}:t;i.top!==void 0&&(i.top+=this.scrollTop),i.left!==void 0&&(i.left+=this.scrollLeft),this._scrollTo(i)}_nativeScrollTo(t){this._originalScrollTo.bind(this._element||window)(t)}_scrollTo(t,e=null,i=null){this._end!==null&&this._end(),t.behavior==="smooth"?(this._setDestination(t),this._retarget=e,this._end=i):this._resetScrollState(),this._nativeScrollTo(t)}_setDestination(t){let{top:e,left:i}=t;return e=e===void 0?void 0:Math.max(0,Math.min(e,this.maxScrollTop)),i=i===void 0?void 0:Math.max(0,Math.min(i,this.maxScrollLeft)),(this._destination===null||i!==this._destination.left||e!==this._destination.top)&&(this.t={top:e,left:i,behavior:"smooth"},!0)}_resetScrollState(){this.t=null,this._retarget=null,this._end=null}_updateManagedScrollTo(t){this._destination&&this._setDestination(t)&&this._nativeScrollTo(this._destination)}managedScrollTo(t,e,i){return this._scrollTo(t,e,i),this._updateManagedScrollTo}correctScrollError(t){this.correctingScrollError=!0,requestAnimationFrame(()=>requestAnimationFrame(()=>this.correctingScrollError=!1)),this._nativeScrollTo(t),this._retarget&&this._setDestination(this._retarget()),this._destination&&this._nativeScrollTo(this._destination)}_checkForArrival(){if(this._destination!==null){const{scrollTop:t,scrollLeft:e}=this;let{top:i,left:s}=this._destination;i=Math.min(i||0,this.maxScrollTop),s=Math.min(s||0,this.maxScrollLeft);const r=Math.abs(i-t),o=Math.abs(s-e);r<1&&o<1&&(this._end&&this._end(),this._resetScrollState())}}detach(t){return this._clients.delete(t),this._clients.size===0&&(this._node.scrollTo=this._originalScrollTo,this._node.scrollBy=this._originalScrollBy,this._node.scroll=this._originalScroll,this._node.removeEventListener("scroll",this._checkForArrival)),null}_attach(t){this._clients.add(t),this._clients.size===1&&(this._node.scrollTo=this.scrollTo,this._node.scrollBy=this.scrollBy,this._node.scroll=this.scrollTo,this._node.addEventListener("scroll",this._checkForArrival))}}let L=typeof window<"u"?window.ResizeObserver:void 0;const E=Symbol("virtualizerRef"),v="virtualizer-sizer";let z;class W{constructor(t){if(this._benchmarkStart=null,this._layout=null,this._clippingAncestors=[],this._scrollSize=null,this._scrollError=null,this._childrenPos=null,this._childMeasurements=null,this._toBeMeasured=new Map,this._rangeChanged=!0,this._itemsChanged=!0,this._visibilityChanged=!0,this._scrollerController=null,this._isScroller=!1,this._sizer=null,this._hostElementRO=null,this._childrenRO=null,this._mutationObserver=null,this._scrollEventListeners=[],this._scrollEventListenerOptions={passive:!0},this._loadListener=this._childLoaded.bind(this),this._scrollIntoViewTarget=null,this._updateScrollIntoViewCoordinates=null,this._items=[],this._first=-1,this._last=-1,this._firstVisible=-1,this._lastVisible=-1,this._scheduled=new WeakSet,this._measureCallback=null,this._measureChildOverride=null,this._layoutCompletePromise=null,this._layoutCompleteResolver=null,this._layoutCompleteRejecter=null,this._pendingLayoutComplete=null,this._layoutInitialized=null,this._connected=!1,!t)throw new Error("Virtualizer constructor requires a configuration object");if(!t.hostElement)throw new Error('Virtualizer configuration requires the "hostElement" property');this._init(t)}set items(t){Array.isArray(t)&&t!==this._items&&(this._itemsChanged=!0,this._items=t,this._schedule(this._updateLayout))}_init(t){this._isScroller=!!t.scroller,this._initHostElement(t);const e=t.layout||{};this._layoutInitialized=this._initLayout(e)}_initObservers(){this._mutationObserver=new MutationObserver(this._finishDOMUpdate.bind(this)),this._hostElementRO=new L(()=>this._hostElementSizeChanged()),this._childrenRO=new L(this._childrenSizeChanged.bind(this))}_initHostElement(t){const e=this._hostElement=t.hostElement;this._applyVirtualizerStyles(),e[E]=this}connected(){this._initObservers();const t=this._isScroller;this._clippingAncestors=function(e,i=!1){let s=!1;return function(r,o=!1){const c=[];let a=o?r:x(r);for(;a!==null;)c.push(a),a=x(a);return c}(e,i).filter(r=>{if(s)return!1;const o=getComputedStyle(r);return s=o.position==="fixed",o.overflow!=="visible"})}(this._hostElement,t),this._scrollerController=new q(this,this._clippingAncestors[0]),this._schedule(this._updateLayout),this._observeAndListen(),this._connected=!0}_observeAndListen(){this._mutationObserver.observe(this._hostElement,{childList:!0}),this._hostElementRO.observe(this._hostElement),this._scrollEventListeners.push(window),window.addEventListener("scroll",this,this._scrollEventListenerOptions),this._clippingAncestors.forEach(t=>{t.addEventListener("scroll",this,this._scrollEventListenerOptions),this._scrollEventListeners.push(t),this._hostElementRO.observe(t)}),this._hostElementRO.observe(this._scrollerController.element),this._children.forEach(t=>this._childrenRO.observe(t)),this._scrollEventListeners.forEach(t=>t.addEventListener("scroll",this,this._scrollEventListenerOptions))}disconnected(){var t,e,i,s;this._scrollEventListeners.forEach(r=>r.removeEventListener("scroll",this,this._scrollEventListenerOptions)),this._scrollEventListeners=[],this._clippingAncestors=[],(t=this._scrollerController)==null||t.detach(this),this._scrollerController=null,(e=this._mutationObserver)==null||e.disconnect(),this._mutationObserver=null,(i=this._hostElementRO)==null||i.disconnect(),this._hostElementRO=null,(s=this._childrenRO)==null||s.disconnect(),this._childrenRO=null,this._rejectLayoutCompletePromise("disconnected"),this._connected=!1}_applyVirtualizerStyles(){const t=this._hostElement.style;t.display=t.display||"block",t.position=t.position||"relative",t.contain=t.contain||"size layout",this._isScroller&&(t.overflow=t.overflow||"auto",t.minHeight=t.minHeight||"150px")}_getSizer(){const t=this._hostElement;if(!this._sizer){let e=t.querySelector(`[${v}]`);e||(e=document.createElement("div"),e.setAttribute(v,""),t.appendChild(e)),Object.assign(e.style,{position:"absolute",margin:"-2px 0 0 0",padding:0,visibility:"hidden",fontSize:"2px"}),e.textContent="&nbsp;",e.setAttribute(v,""),this._sizer=e}return this._sizer}async updateLayoutConfig(t){await this._layoutInitialized;const e=t.type||z;if(typeof e=="function"&&this._layout instanceof e){const i={...t};return delete i.type,this._layout.config=i,!0}return!1}async _initLayout(t){let e,i;if(typeof t.type=="function"){i=t.type;const s={...t};delete s.type,e=s}else e=t;i===void 0&&(z=i=(await Promise.resolve().then(()=>require("./flow-CnJl1T1A.cjs"))).FlowLayout),this._layout=new i(s=>this._handleLayoutMessage(s),e),this._layout.measureChildren&&typeof this._layout.updateItemSizes=="function"&&(typeof this._layout.measureChildren=="function"&&(this._measureChildOverride=this._layout.measureChildren),this._measureCallback=this._layout.updateItemSizes.bind(this._layout)),this._layout.listenForChildLoadEvents&&this._hostElement.addEventListener("load",this._loadListener,!0),this._schedule(this._updateLayout)}startBenchmarking(){this._benchmarkStart===null&&(this._benchmarkStart=window.performance.now())}stopBenchmarking(){if(this._benchmarkStart!==null){const t=window.performance.now(),e=t-this._benchmarkStart,i=performance.getEntriesByName("uv-virtualizing","measure").filter(s=>s.startTime>=this._benchmarkStart&&s.startTime<t).reduce((s,r)=>s+r.duration,0);return this._benchmarkStart=null,{timeElapsed:e,virtualizationTime:i}}return null}_measureChildren(){const t={},e=this._children,i=this._measureChildOverride||this._measureChild;for(let s=0;s<e.length;s++){const r=e[s],o=this._first+s;(this._itemsChanged||this._toBeMeasured.has(r))&&(t[o]=i.call(this,r,this._items[o]))}this._childMeasurements=t,this._schedule(this._updateLayout),this._toBeMeasured.clear()}_measureChild(t){const{width:e,height:i}=t.getBoundingClientRect();return Object.assign({width:e,height:i},function(s){const r=window.getComputedStyle(s);return{marginTop:b(r.marginTop),marginRight:b(r.marginRight),marginBottom:b(r.marginBottom),marginLeft:b(r.marginLeft)}}(t))}async _schedule(t){this._scheduled.has(t)||(this._scheduled.add(t),await Promise.resolve(),this._scheduled.delete(t),t.call(this))}async _updateDOM(t){this._scrollSize=t.scrollSize,this._adjustRange(t.range),this._childrenPos=t.childPositions,this._scrollError=t.scrollError||null;const{_rangeChanged:e,_itemsChanged:i}=this;this._visibilityChanged&&(this._notifyVisibility(),this._visibilityChanged=!1),(e||i)&&(this._notifyRange(),this._rangeChanged=!1),this._finishDOMUpdate()}_finishDOMUpdate(){this._connected&&(this._children.forEach(t=>this._childrenRO.observe(t)),this._checkScrollIntoViewTarget(this._childrenPos),this._positionChildren(this._childrenPos),this._sizeHostElement(this._scrollSize),this._correctScrollError(),this._benchmarkStart&&"mark"in window.performance&&window.performance.mark("uv-end"))}_updateLayout(){this._layout&&this._connected&&(this._layout.items=this._items,this._updateView(),this._childMeasurements!==null&&(this._measureCallback&&this._measureCallback(this._childMeasurements),this._childMeasurements=null),this._layout.reflowIfNeeded(),this._benchmarkStart&&"mark"in window.performance&&window.performance.mark("uv-end"))}_handleScrollEvent(){var t;if(this._benchmarkStart&&"mark"in window.performance){try{window.performance.measure("uv-virtualizing","uv-start","uv-end")}catch{}window.performance.mark("uv-start")}this._scrollerController.correctingScrollError===!1&&((t=this._layout)==null||t.unpin()),this._schedule(this._updateLayout)}handleEvent(t){t.type==="scroll"&&(t.currentTarget===window||this._clippingAncestors.includes(t.currentTarget))&&this._handleScrollEvent()}_handleLayoutMessage(t){t.type==="stateChanged"?this._updateDOM(t):t.type==="visibilityChanged"?(this._firstVisible=t.firstVisible,this._lastVisible=t.lastVisible,this._notifyVisibility()):t.type==="unpinned"&&this._hostElement.dispatchEvent(new S)}get _children(){const t=[];let e=this._hostElement.firstElementChild;for(;e;)e.hasAttribute(v)||t.push(e),e=e.nextElementSibling;return t}_updateView(){var s;const t=this._hostElement,e=(s=this._scrollerController)==null?void 0:s.element,i=this._layout;if(t&&e&&i){let r,o,c,a;const n=t.getBoundingClientRect();r=0,o=0,c=window.innerHeight,a=window.innerWidth;const p=this._clippingAncestors.map(_=>_.getBoundingClientRect());p.unshift(n);for(const _ of p)r=Math.max(r,_.top),o=Math.max(o,_.left),c=Math.min(c,_.bottom),a=Math.min(a,_.right);const T=e.getBoundingClientRect(),R={left:n.left-T.left,top:n.top-T.top},M={width:e.scrollWidth,height:e.scrollHeight},I=r-n.top+t.scrollTop,$=o-n.left+t.scrollLeft,A=Math.max(0,c-r),F=Math.max(0,a-o);i.viewportSize={width:F,height:A},i.viewportScroll={top:I,left:$},i.totalScrollSize=M,i.offsetWithinScroller=R}}_sizeHostElement(t){const i=t&&t.width!==null?Math.min(82e5,t.width):0,s=t&&t.height!==null?Math.min(82e5,t.height):0;if(this._isScroller)this._getSizer().style.transform=`translate(${i}px, ${s}px)`;else{const r=this._hostElement.style;r.minWidth=i?`${i}px`:"100%",r.minHeight=s?`${s}px`:"100%"}}_positionChildren(t){t&&t.forEach(({top:e,left:i,width:s,height:r,xOffset:o,yOffset:c},a)=>{const n=this._children[a-this._first];n&&(n.style.position="absolute",n.style.boxSizing="border-box",n.style.transform=`translate(${i}px, ${e}px)`,s!==void 0&&(n.style.width=s+"px"),r!==void 0&&(n.style.height=r+"px"),n.style.left=o===void 0?null:o+"px",n.style.top=c===void 0?null:c+"px")})}async _adjustRange(t){const{_first:e,_last:i,_firstVisible:s,_lastVisible:r}=this;this._first=t.first,this._last=t.last,this._firstVisible=t.firstVisible,this._lastVisible=t.lastVisible,this._rangeChanged=this._rangeChanged||this._first!==e||this._last!==i,this._visibilityChanged=this._visibilityChanged||this._firstVisible!==s||this._lastVisible!==r}_correctScrollError(){if(this._scrollError){const{scrollTop:t,scrollLeft:e}=this._scrollerController,{top:i,left:s}=this._scrollError;this._scrollError=null,this._scrollerController.correctScrollError({top:t-i,left:e-s})}}element(t){var e;return t===1/0&&(t=this._items.length-1),((e=this._items)==null?void 0:e[t])===void 0?void 0:{scrollIntoView:(i={})=>this._scrollElementIntoView({...i,index:t})}}_scrollElementIntoView(t){if(t.index>=this._first&&t.index<=this._last)this._children[t.index-this._first].scrollIntoView(t);else if(t.index=Math.min(t.index,this._items.length-1),t.behavior==="smooth"){const e=this._layout.getScrollIntoViewCoordinates(t),{behavior:i}=t;this._updateScrollIntoViewCoordinates=this._scrollerController.managedScrollTo(Object.assign(e,{behavior:i}),()=>this._layout.getScrollIntoViewCoordinates(t),()=>this._scrollIntoViewTarget=null),this._scrollIntoViewTarget=t}else this._layout.pin=t}_checkScrollIntoViewTarget(t){const{index:e}=this._scrollIntoViewTarget||{};e&&(t!=null&&t.has(e))&&this._updateScrollIntoViewCoordinates(this._layout.getScrollIntoViewCoordinates(this._scrollIntoViewTarget))}_notifyRange(){this._hostElement.dispatchEvent(new w({first:this._first,last:this._last}))}_notifyVisibility(){this._hostElement.dispatchEvent(new C({first:this._firstVisible,last:this._lastVisible}))}get layoutComplete(){return this._layoutCompletePromise||(this._layoutCompletePromise=new Promise((t,e)=>{this._layoutCompleteResolver=t,this._layoutCompleteRejecter=e})),this._layoutCompletePromise}_rejectLayoutCompletePromise(t){this._layoutCompleteRejecter!==null&&this._layoutCompleteRejecter(t),this._resetLayoutCompleteState()}_scheduleLayoutComplete(){this._layoutCompletePromise&&this._pendingLayoutComplete===null&&(this._pendingLayoutComplete=requestAnimationFrame(()=>requestAnimationFrame(()=>this._resolveLayoutCompletePromise())))}_resolveLayoutCompletePromise(){this._layoutCompleteResolver!==null&&this._layoutCompleteResolver(),this._resetLayoutCompleteState()}_resetLayoutCompleteState(){this._layoutCompletePromise=null,this._layoutCompleteResolver=null,this._layoutCompleteRejecter=null,this._pendingLayoutComplete=null}_hostElementSizeChanged(){this._schedule(this._updateLayout)}_childLoaded(){}_childrenSizeChanged(t){var e;if((e=this._layout)!=null&&e.measureChildren){for(const i of t)this._toBeMeasured.set(i.target,i.contentRect);this._measureChildren()}this._scheduleLayoutComplete(),this._itemsChanged=!1,this._rangeChanged=!1}}function b(l){const t=l?parseFloat(l):NaN;return Number.isNaN(t)?0:t}function x(l){if(l.assignedSlot!==null)return l.assignedSlot;if(l.parentElement!==null)return l.parentElement;const t=l.parentNode;return t&&t.nodeType===Node.DOCUMENT_FRAGMENT_NODE&&t.host||null}const O=l=>l,V=(l,t)=>h.html`${t}: ${JSON.stringify(l,null,2)}`;class U extends N.AsyncDirective{constructor(t){if(super(t),this._virtualizer=null,this._first=0,this._last=-1,this._renderItem=(e,i)=>V(e,i+this._first),this._keyFunction=(e,i)=>O(e,this._first),this._items=[],t.type!==k.PartType.CHILD)throw new Error("The virtualize directive can only be used in child expressions")}render(t){t&&this._setFunctions(t);const e=[];if(this._first>=0&&this._last>=this._first)for(let i=this._first;i<=this._last;i++)e.push(this._items[i]);return B.repeat(e,this._keyFunction,this._renderItem)}update(t,[e]){this._setFunctions(e);const i=this._items!==e.items;return this._items=e.items||[],this._virtualizer?this._updateVirtualizerConfig(t,e):this._initialize(t,e),i?h.noChange:this.render()}async _updateVirtualizerConfig(t,e){if(!await this._virtualizer.updateLayoutConfig(e.layout||{})){const i=t.parentNode;this._makeVirtualizer(i,e)}this._virtualizer.items=this._items}_setFunctions(t){const{renderItem:e,keyFunction:i}=t;e&&(this._renderItem=(s,r)=>e(s,r+this._first)),i&&(this._keyFunction=(s,r)=>i(s,r+this._first))}_makeVirtualizer(t,e){this._virtualizer&&this._virtualizer.disconnected();const{layout:i,scroller:s,items:r}=e;this._virtualizer=new W({hostElement:t,layout:i,scroller:s}),this._virtualizer.items=r,this._virtualizer.connected()}_initialize(t,e){const i=t.parentNode;i&&i.nodeType===1&&(i.addEventListener("rangeChanged",s=>{this._first=s.first,this._last=s.last,this.setValue(this.render())}),this._makeVirtualizer(i,e))}disconnected(){var t;(t=this._virtualizer)==null||t.disconnected()}reconnected(){var t;(t=this._virtualizer)==null||t.connected()}}const G=k.directive(U);class m extends h.LitElement{constructor(){super(...arguments),this.items=[],this.renderItem=V,this.keyFunction=O,this.layout={},this.scroller=!1}createRenderRoot(){return this}render(){const{items:t,renderItem:e,keyFunction:i,layout:s,scroller:r}=this;return h.html`${G({items:t,renderItem:e,keyFunction:i,layout:s,scroller:r})}`}element(t){var e;return(e=this[E])==null?void 0:e.element(t)}get layoutComplete(){var t;return(t=this[E])==null?void 0:t.layoutComplete}scrollToIndex(t,e="start"){var i;(i=this.element(t))==null||i.scrollIntoView({block:e})}}y.i([g.property({attribute:!1})],m.prototype,"items",void 0),y.i([g.property()],m.prototype,"renderItem",void 0),y.i([g.property()],m.prototype,"keyFunction",void 0),y.i([g.property({attribute:!1})],m.prototype,"layout",void 0),y.i([g.property({reflect:!0,type:Boolean})],m.prototype,"scroller",void 0),customElements.define("lit-virtualizer",m);var J=Object.defineProperty,X=Object.getOwnPropertyDescriptor,d=(l,t,e,i)=>{for(var s,r=i>1?void 0:i?X(t,e):t,o=l.length-1;o>=0;o--)(s=l[o])&&(r=(i?s(t,e,r):s(r))||r);return i&&r&&J(t,e,r),r};exports.SchmancyDataTable=class extends D.$LitElement(){constructor(){super(),this.columns=[],this.data=[],this.keyField="id",this.cols="1fr",this.sortable=!1,this.sortColumn=null,this.sortDirection=null,this.filteredData=[],this.filteredData=this.data}willUpdate(l){(l.has("data")||l.has("sortColumn")||l.has("sortDirection"))&&this.processData()}isDate(l){return l&&typeof l=="object"&&Object.prototype.toString.call(l)==="[object Date]"}processData(){let l=[...this.data];this.sortable&&this.sortColumn&&this.sortDirection&&l.sort((t,e)=>{const i=t[this.sortColumn],s=e[this.sortColumn];if(i==null)return this.sortDirection==="asc"?1:-1;if(s==null)return this.sortDirection==="asc"?-1:1;if(typeof i=="number"&&typeof s=="number")return this.sortDirection==="asc"?i-s:s-i;const r=typeof i=="string"&&!isNaN(Number(i)),o=typeof s=="string"&&!isNaN(Number(s));if(r&&o){const n=parseFloat(i),p=parseFloat(s);return this.sortDirection==="asc"?n-p:p-n}if(this.isDate(i)&&this.isDate(s))return this.sortDirection==="asc"?i.getTime()-s.getTime():s.getTime()-i.getTime();const c=String(i),a=String(s);return this.sortDirection==="asc"?c.localeCompare(a):a.localeCompare(c)}),this.filteredData=l}toggleSort(l){if(!l.key||l.sortable===!1)return;const t=l.key;t===this.sortColumn?this.sortDirection==="asc"?this.sortDirection="desc":this.sortDirection==="desc"?this.sortDirection=null:this.sortDirection="asc":(this.sortColumn=t,this.sortDirection="asc"),this.dispatchEvent(new CustomEvent("sort-change",{detail:{column:this.sortColumn,direction:this.sortDirection},bubbles:!0,composed:!0}))}renderSortIndicator(l){return this.sortable&&l.sortable!==!1&&l.key&&l.key===this.sortColumn?h.html`
20
20
  <span class="ml-1">
21
- ${this.sortDirection==="asc"?n.html`<schmancy-icon size="16px">arrow_upward</schmancy-icon>`:this.sortDirection==="desc"?n.html`<schmancy-icon size="16px">arrow_downward</schmancy-icon>`:null}
21
+ ${this.sortDirection==="asc"?h.html`<schmancy-icon size="16px">arrow_upward</schmancy-icon>`:this.sortDirection==="desc"?h.html`<schmancy-icon size="16px">arrow_downward</schmancy-icon>`:null}
22
22
  </span>
23
- `:null}render(){const l=t=>({"flex items-center":!0,"cursor-pointer gap-1":this.sortable&&t.sortable!==!1&&t.key});return n.html`
23
+ `:null}render(){const l=t=>({"flex items-center":!0,"cursor-pointer gap-1":this.sortable&&t.sortable!==!1&&t.key});return h.html`
24
24
  <schmancy-surface fill="all" type="container" rounded="all" elevation="2">
25
25
  <schmancy-grid class="h-full w-full" cols="1fr" rows="auto 1fr">
26
26
  <schmancy-surface rounded="top" elevation="1" type="containerHighest" class="sticky top-0 z-10">
27
27
  <schmancy-grid align="center" class="px-4 py-3" .cols=${this.cols} gap="md" rows="1fr">
28
- ${this.columns.map(t=>n.html`
28
+ ${this.columns.map(t=>h.html`
29
29
  <div
30
30
  class=${this.classMap(l(t))}
31
31
  @click=${()=>this.sortable&&t.sortable!==!1?this.toggleSort(t):null}
@@ -39,12 +39,12 @@
39
39
  </schmancy-grid>
40
40
  </schmancy-surface>
41
41
 
42
- ${this.filteredData.length>0?n.html`
42
+ ${this.filteredData.length>0?h.html`
43
43
  <lit-virtualizer
44
44
  scroller
45
45
  class="w-full h-full relative overflow-auto"
46
46
  .items=${this.filteredData}
47
- .renderItem=${(t,e)=>n.html`
47
+ .renderItem=${(t,e)=>h.html`
48
48
  <schmancy-table-row
49
49
  class="w-full border-b border-solid border-outlineVariant"
50
50
  .columns=${this.columns}
@@ -54,12 +54,12 @@
54
54
  ></schmancy-table-row>
55
55
  `}
56
56
  ></lit-virtualizer>
57
- `:n.html`
57
+ `:h.html`
58
58
  <div class="flex items-center justify-center w-full h-full p-8 text-center">
59
59
  <schmancy-typography type="body" token="lg"> No data available </schmancy-typography>
60
60
  </div>
61
61
  `}
62
62
  </schmancy-grid>
63
63
  </schmancy-surface>
64
- `}},d([a.property({type:Array,attribute:!1})],exports.SchmancyDataTable.prototype,"columns",2),d([a.property({type:Array,attribute:!1})],exports.SchmancyDataTable.prototype,"data",2),d([a.property({type:String})],exports.SchmancyDataTable.prototype,"keyField",2),d([a.property({type:String})],exports.SchmancyDataTable.prototype,"cols",2),d([a.property({type:Boolean})],exports.SchmancyDataTable.prototype,"sortable",2),d([a.state()],exports.SchmancyDataTable.prototype,"sortColumn",2),d([a.state()],exports.SchmancyDataTable.prototype,"sortDirection",2),d([a.state()],exports.SchmancyDataTable.prototype,"filteredData",2),exports.SchmancyDataTable=d([a.customElement("schmancy-table")],exports.SchmancyDataTable);
65
- //# sourceMappingURL=table-Cfe1Zloe.cjs.map
64
+ `}},d([u.property({type:Array,attribute:!1})],exports.SchmancyDataTable.prototype,"columns",2),d([u.property({type:Array,attribute:!1})],exports.SchmancyDataTable.prototype,"data",2),d([u.property({type:String})],exports.SchmancyDataTable.prototype,"keyField",2),d([u.property({type:String})],exports.SchmancyDataTable.prototype,"cols",2),d([u.property({type:Boolean})],exports.SchmancyDataTable.prototype,"sortable",2),d([u.state()],exports.SchmancyDataTable.prototype,"sortColumn",2),d([u.state()],exports.SchmancyDataTable.prototype,"sortDirection",2),d([u.state()],exports.SchmancyDataTable.prototype,"filteredData",2),exports.SchmancyDataTable=d([u.customElement("schmancy-table")],exports.SchmancyDataTable);
65
+ //# sourceMappingURL=table-BA5yn5_q.cjs.map