@desktalk/ui 0.1.0-alpha.3 → 0.1.1

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
- "use strict";var DeskTalkUI=(()=>{var $=Object.defineProperty;var ft=Object.getOwnPropertyDescriptor;var _t=Object.getOwnPropertyNames;var xt=Object.prototype.hasOwnProperty;var wt=(r,t)=>{for(var e in t)$(r,e,{get:t[e],enumerable:!0})},yt=(r,t,e,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of _t(t))!xt.call(r,i)&&i!==e&&$(r,i,{get:()=>t[i],enumerable:!(n=ft(t,i))||n.enumerable});return r};var kt=r=>yt($({},"__esModule",{value:!0}),r);var Qt={};wt(Qt,{DtBadge:()=>k,DtButton:()=>C,DtCard:()=>f,DtChart:()=>M,DtColumn:()=>g,DtDivider:()=>E,DtGrid:()=>x,DtListView:()=>D,DtMarkdown:()=>T,DtMarkdownEditor:()=>z,DtSelect:()=>_,DtStack:()=>w,DtStat:()=>y,DtTableView:()=>S,DtTooltip:()=>v});var W=`.dt-tooltip-popup {
1
+ "use strict";var DeskTalkUI=(()=>{var $=Object.defineProperty;var ft=Object.getOwnPropertyDescriptor;var _t=Object.getOwnPropertyNames;var wt=Object.prototype.hasOwnProperty;var xt=(r,t)=>{for(var e in t)$(r,e,{get:t[e],enumerable:!0})},yt=(r,t,e,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of _t(t))!wt.call(r,i)&&i!==e&&$(r,i,{get:()=>t[i],enumerable:!(n=ft(t,i))||n.enumerable});return r};var kt=r=>yt($({},"__esModule",{value:!0}),r);var Qt={};xt(Qt,{DtBadge:()=>C,DtButton:()=>E,DtCard:()=>_,DtChart:()=>z,DtColumn:()=>b,DtDivider:()=>S,DtGrid:()=>x,DtListView:()=>A,DtMarkdown:()=>T,DtMarkdownEditor:()=>L,DtSelect:()=>w,DtStack:()=>y,DtStat:()=>k,DtTableView:()=>D,DtTooltip:()=>f});var J=`.dt-tooltip-popup {
2
2
  position: fixed;
3
3
  z-index: 2147483647;
4
4
  padding: 6px 10px;
@@ -41,13 +41,13 @@
41
41
 
42
42
  /* Arrow styling - tech/minimal */
43
43
  .dt-tooltip-popup[data-actual-placement='top'] {
44
- transform: translateX(-50%);
44
+ transform: none;
45
45
  }
46
46
 
47
47
  .dt-tooltip-popup[data-actual-placement='top']::before {
48
48
  top: auto;
49
49
  bottom: -4px;
50
- left: 50%;
50
+ left: var(--dt-tooltip-arrow-left, 50%);
51
51
  transform: translateX(-50%);
52
52
  width: 0;
53
53
  height: 0;
@@ -58,13 +58,13 @@
58
58
  }
59
59
 
60
60
  .dt-tooltip-popup[data-actual-placement='bottom'] {
61
- transform: translateX(-50%);
61
+ transform: none;
62
62
  }
63
63
 
64
64
  .dt-tooltip-popup[data-actual-placement='bottom']::before {
65
65
  bottom: auto;
66
66
  top: -4px;
67
- left: 50%;
67
+ left: var(--dt-tooltip-arrow-left, 50%);
68
68
  transform: translateX(-50%);
69
69
  width: 0;
70
70
  height: 0;
@@ -75,12 +75,12 @@
75
75
  }
76
76
 
77
77
  .dt-tooltip-popup[data-actual-placement='left'] {
78
- transform: translateY(-50%);
78
+ transform: none;
79
79
  }
80
80
 
81
81
  .dt-tooltip-popup[data-actual-placement='left']::before {
82
82
  left: auto;
83
- top: 50%;
83
+ top: var(--dt-tooltip-arrow-top, 50%);
84
84
  right: -4px;
85
85
  transform: translateY(-50%);
86
86
  width: 0;
@@ -92,12 +92,12 @@
92
92
  }
93
93
 
94
94
  .dt-tooltip-popup[data-actual-placement='right'] {
95
- transform: translateY(-50%);
95
+ transform: none;
96
96
  }
97
97
 
98
98
  .dt-tooltip-popup[data-actual-placement='right']::before {
99
99
  right: auto;
100
- top: 50%;
100
+ top: var(--dt-tooltip-arrow-top, 50%);
101
101
  left: -4px;
102
102
  transform: translateY(-50%);
103
103
  width: 0;
@@ -107,7 +107,7 @@
107
107
  border-top: none;
108
108
  border-bottom: none;
109
109
  }
110
- `;var Ct="dt-tooltip-popup",u=8,G=!1;function Et(){if(G)return;let r=document.createElement("style");r.setAttribute("data-dt-tooltip",""),r.textContent=W,document.head.appendChild(r),G=!0}var v=class extends HTMLElement{_popup=null;_showTimeout=null;_tooltipId="";_visible=!1;static get observedAttributes(){return["content","placement","delay","disabled"]}get content(){return this.getAttribute("content")??""}set content(t){this.setAttribute("content",t)}get placement(){let t=this.getAttribute("placement");return t==="bottom"||t==="left"||t==="right"?t:"top"}set placement(t){this.setAttribute("placement",t)}get delay(){let t=Number(this.getAttribute("delay"));return Number.isFinite(t)&&t>0?t:0}set delay(t){this.setAttribute("delay",String(t))}get disabled(){return this.hasAttribute("disabled")}set disabled(t){t?this.setAttribute("disabled",""):this.removeAttribute("disabled")}constructor(){super();let t=this.attachShadow({mode:"open"});t.innerHTML="<slot></slot>",this._tooltipId=`dt-tip-${Math.random().toString(36).slice(2,9)}`}connectedCallback(){Et(),this.addEventListener("mouseenter",this._onEnter),this.addEventListener("mouseleave",this._onLeave),this.addEventListener("focusin",this._onEnter),this.addEventListener("focusout",this._onLeave)}disconnectedCallback(){this.removeEventListener("mouseenter",this._onEnter),this.removeEventListener("mouseleave",this._onLeave),this.removeEventListener("focusin",this._onEnter),this.removeEventListener("focusout",this._onLeave),this._hide()}attributeChangedCallback(t,e,n){t==="disabled"&&this.disabled&&this._hide(),t==="content"&&this._popup&&(this._popup.textContent=this.content)}_onEnter=()=>{if(this.disabled||!this.content)return;this._showTimeout!==null&&clearTimeout(this._showTimeout);let t=()=>{this._createPopup(),this._position(),this._visible=!0};this.delay>0?this._showTimeout=setTimeout(t,this.delay):t()};_onLeave=()=>{this._hide()};_createPopup(){if(this._popup)return;let t=document.createElement("div");t.className=Ct,t.id=this._tooltipId,t.setAttribute("role","tooltip"),t.textContent=this.content,document.body.appendChild(t),this._popup=t;let e=this._getTrigger();e&&e.setAttribute("aria-describedby",this._tooltipId)}_hide(){if(this._showTimeout!==null&&(clearTimeout(this._showTimeout),this._showTimeout=null),this._popup){let t=this._getTrigger();t&&t.removeAttribute("aria-describedby"),this._popup.remove(),this._popup=null,this._visible=!1}}_getTrigger(){let e=this.shadowRoot?.querySelector("slot")?.assignedElements();return e&&e.length>0?e[0]:null}_position(){let t=this._popup;if(!t)return;let e=this.getBoundingClientRect(),n=t.getBoundingClientRect(),i=window.innerWidth,s=window.innerHeight,o=this.placement;o==="top"&&e.top-n.height-u<0?o="bottom":o==="bottom"&&e.bottom+n.height+u>s?o="top":o==="left"&&e.left-n.width-u<0?o="right":o==="right"&&e.right+n.width+u>i&&(o="left"),t.setAttribute("data-actual-placement",o);let a,d;switch(o){case"top":d=e.left+e.width/2,a=e.top-n.height-u;break;case"bottom":d=e.left+e.width/2,a=e.bottom+u;break;case"left":d=e.left-n.width-u,a=e.top+e.height/2;break;case"right":d=e.right+u,a=e.top+e.height/2;break}t.style.left=`${d}px`,t.style.top=`${a}px`}};var j=`:host {
110
+ `;var Ct="dt-tooltip-popup",p=8,G=!1;function Et(){if(G)return;let r=document.createElement("style");r.setAttribute("data-dt-tooltip",""),r.textContent=J,document.head.appendChild(r),G=!0}var f=class extends HTMLElement{_popup=null;_showTimeout=null;_tooltipId="";_visible=!1;static get observedAttributes(){return["content","placement","align","delay","disabled"]}get content(){return this.getAttribute("content")??""}set content(t){this.setAttribute("content",t)}get placement(){let t=this.getAttribute("placement");return t==="bottom"||t==="left"||t==="right"?t:"top"}set placement(t){this.setAttribute("placement",t)}get align(){let t=this.getAttribute("align");return t==="left"||t==="right"?t:"center"}set align(t){this.setAttribute("align",t)}get delay(){let t=Number(this.getAttribute("delay"));return Number.isFinite(t)&&t>0?t:0}set delay(t){this.setAttribute("delay",String(t))}get disabled(){return this.hasAttribute("disabled")}set disabled(t){t?this.setAttribute("disabled",""):this.removeAttribute("disabled")}constructor(){super();let t=this.attachShadow({mode:"open"});t.innerHTML="<slot></slot>",this._tooltipId=`dt-tip-${Math.random().toString(36).slice(2,9)}`}connectedCallback(){Et(),this.addEventListener("mouseenter",this._onEnter),this.addEventListener("mouseleave",this._onLeave),this.addEventListener("focusin",this._onEnter),this.addEventListener("focusout",this._onLeave)}disconnectedCallback(){this.removeEventListener("mouseenter",this._onEnter),this.removeEventListener("mouseleave",this._onLeave),this.removeEventListener("focusin",this._onEnter),this.removeEventListener("focusout",this._onLeave),this._hide()}attributeChangedCallback(t,e,n){t==="disabled"&&this.disabled&&this._hide(),t==="content"&&this._popup&&(this._popup.textContent=this.content)}_onEnter=()=>{if(this.disabled||!this.content)return;this._showTimeout!==null&&clearTimeout(this._showTimeout);let t=()=>{this._createPopup(),this._position(),this._visible=!0};this.delay>0?this._showTimeout=setTimeout(t,this.delay):t()};_onLeave=()=>{this._hide()};_createPopup(){if(this._popup)return;let t=document.createElement("div");t.className=Ct,t.id=this._tooltipId,t.setAttribute("role","tooltip"),t.textContent=this.content,document.body.appendChild(t),this._popup=t;let e=this._getTrigger();e&&e.setAttribute("aria-describedby",this._tooltipId)}_hide(){if(this._showTimeout!==null&&(clearTimeout(this._showTimeout),this._showTimeout=null),this._popup){let t=this._getTrigger();t&&t.removeAttribute("aria-describedby"),this._popup.remove(),this._popup=null,this._visible=!1}}_getTrigger(){let e=this.shadowRoot?.querySelector("slot")?.assignedElements();return e&&e.length>0?e[0]:null}_position(){let t=this._popup;if(!t)return;let e=this.getBoundingClientRect(),n=t.getBoundingClientRect(),i=window.innerWidth,o=window.innerHeight,s=8,a=this.placement;a==="top"&&e.top-n.height-p<0?a="bottom":a==="bottom"&&e.bottom+n.height+p>o?a="top":a==="left"&&e.left-n.width-p<0?a="right":a==="right"&&e.right+n.width+p>i&&(a="left"),t.setAttribute("data-actual-placement",a);let d,l,c=e.left+e.width/2,u=e.top+e.height/2;switch(a){case"top":c=this.align==="left"?e.left:this.align==="right"?e.right:e.left+e.width/2,l=this.align==="left"?e.left:this.align==="right"?e.right-n.width:e.left+e.width/2-n.width/2,d=e.top-n.height-p;break;case"bottom":c=this.align==="left"?e.left:this.align==="right"?e.right:e.left+e.width/2,l=this.align==="left"?e.left:this.align==="right"?e.right-n.width:e.left+e.width/2-n.width/2,d=e.bottom+p;break;case"left":l=e.left-n.width-p,d=e.top+e.height/2-n.height/2,u=e.top+e.height/2;break;case"right":l=e.right+p,d=e.top+e.height/2-n.height/2,u=e.top+e.height/2;break}a==="top"||a==="bottom"?(l=Math.max(s,Math.min(l,i-n.width-s)),t.style.setProperty("--dt-tooltip-arrow-left",`${Math.max(8,Math.min(c-l,n.width-8))}px`),t.style.removeProperty("--dt-tooltip-arrow-top")):(d=Math.max(s,Math.min(d,o-n.height-s)),t.style.setProperty("--dt-tooltip-arrow-top",`${Math.max(8,Math.min(u-d,n.height-8))}px`),t.style.removeProperty("--dt-tooltip-arrow-left")),t.style.left=`${l}px`,t.style.top=`${d}px`}};var j=`:host {
111
111
  display: block;
112
112
  margin-bottom: 12px;
113
113
  }
@@ -183,7 +183,7 @@
183
183
  ::slotted(p:last-child) {
184
184
  margin-bottom: 0;
185
185
  }
186
- `;var St="dt-card-inner",f=class extends HTMLElement{static get observedAttributes(){return["variant"]}get variant(){let t=this.getAttribute("variant");return t==="outlined"||t==="filled"?t:"default"}set variant(t){this.setAttribute("variant",t)}constructor(){super();let t=this.attachShadow({mode:"open"}),e=document.createElement("style");e.textContent=j,t.appendChild(e);let n=document.createElement("div");n.className=St,n.innerHTML="<slot></slot>",t.appendChild(n)}};var q=`.dt-select-menu {
186
+ `;var St="dt-card-inner",_=class extends HTMLElement{static get observedAttributes(){return["variant"]}get variant(){let t=this.getAttribute("variant");return t==="outlined"||t==="filled"?t:"default"}set variant(t){this.setAttribute("variant",t)}constructor(){super();let t=this.attachShadow({mode:"open"}),e=document.createElement("style");e.textContent=j,t.appendChild(e);let n=document.createElement("div");n.className=St,n.innerHTML="<slot></slot>",t.appendChild(n)}};var q=`.dt-select-menu {
187
187
  position: fixed;
188
188
  z-index: 2147483646;
189
189
  display: flex;
@@ -356,7 +356,7 @@
356
356
  .dt-select-trigger[aria-expanded='true'] .dt-select-chevron {
357
357
  transform: rotate(180deg);
358
358
  }
359
- `;var Dt="dt-select-trigger",U="dt-select-label",At="dt-select-chevron",Mt="dt-select-menu",Tt="dt-select-option",zt="dt-select-option--active",Y=!1;function Lt(){if(Y)return;let r=document.createElement("style");r.setAttribute("data-dt-select",""),r.textContent=q,document.head.appendChild(r),Y=!0}var _=class extends HTMLElement{_menu=null;_trigger=null;_options=[];_open=!1;_menuId="";static get observedAttributes(){return["value","placeholder","disabled","align"]}get value(){return this.getAttribute("value")??""}set value(t){this.setAttribute("value",t)}get placeholder(){return this.getAttribute("placeholder")??"Select\u2026"}set placeholder(t){this.setAttribute("placeholder",t)}get disabled(){return this.hasAttribute("disabled")}set disabled(t){t?this.setAttribute("disabled",""):this.removeAttribute("disabled")}get align(){return this.getAttribute("align")==="right"?"right":"left"}set align(t){this.setAttribute("align",t)}get options(){return this._options}set options(t){this._options=t,this._updateLabel(),this._open&&this._renderMenuItems()}constructor(){super();let t=this.attachShadow({mode:"open"}),e=document.createElement("style");e.textContent=K,t.appendChild(e);let n=document.createElement("button");n.type="button",n.className=Dt,n.setAttribute("aria-haspopup","listbox"),n.setAttribute("aria-expanded","false");let i=document.createElement("span");i.className=U,n.appendChild(i);let s=document.createElement("span");s.className=At,s.setAttribute("aria-hidden","true"),s.textContent="\u25BE",n.appendChild(s),t.appendChild(n),this._trigger=n,this._menuId=`dt-sel-${Math.random().toString(36).slice(2,9)}`}connectedCallback(){Lt(),this._trigger.addEventListener("click",this._onTriggerClick),this._updateLabel()}disconnectedCallback(){this._trigger.removeEventListener("click",this._onTriggerClick),this._close()}attributeChangedCallback(t){t==="value"&&(this._updateLabel(),this._open&&this._renderMenuItems()),t==="placeholder"&&!this.value&&this._updateLabel(),t==="disabled"&&this.disabled&&this._close()}_updateLabel(){let t=this._trigger.querySelector(`.${U}`),e=this._options.find(n=>n.value===this.value);t.textContent=e?.label??this.placeholder}_onTriggerClick=()=>{this.disabled||(this._open?this._close():this._openMenu())};_openMenu(){if(this._open)return;let t=document.createElement("div");t.className=Mt,t.id=this._menuId,t.setAttribute("role","listbox"),document.body.appendChild(t),this._menu=t,this._renderMenuItems(),this._position(),requestAnimationFrame(()=>{t.setAttribute("data-open","")}),this._open=!0,this._trigger.setAttribute("aria-expanded","true"),requestAnimationFrame(()=>{document.addEventListener("mousedown",this._onOutsideClick),document.addEventListener("keydown",this._onKeyDown)})}_close(){if(this._open){if(document.removeEventListener("mousedown",this._onOutsideClick),document.removeEventListener("keydown",this._onKeyDown),this._menu){this._menu.removeAttribute("data-open");let t=this._menu;setTimeout(()=>t.remove(),140),this._menu=null}this._open=!1,this._trigger.setAttribute("aria-expanded","false")}}_onOutsideClick=t=>{let e=t.target;this._menu?.contains(e)||this.contains(e)||this._close()};_onKeyDown=t=>{t.key==="Escape"&&(this._close(),this._trigger.focus())};_renderMenuItems(){let t=this._menu;if(t){t.innerHTML="";for(let e of this._options){let n=document.createElement("button");n.type="button",n.className=Tt,n.setAttribute("role","option"),n.setAttribute("aria-selected",String(e.value===this.value)),e.value===this.value&&n.classList.add(zt);let i=document.createElement("span");i.textContent=e.label,n.appendChild(i),n.addEventListener("click",()=>{this._selectValue(e.value)}),t.appendChild(n)}}}_selectValue(t){let e=this.value;this.value=t,this._updateLabel(),this._close(),t!==e&&this.dispatchEvent(new CustomEvent("dt-change",{detail:{value:t},bubbles:!0,composed:!0}))}_position(){let t=this._menu;if(!t)return;let e=this.getBoundingClientRect(),n=10,i=Math.max(e.width,240),s=e.bottom+n,o=t.scrollHeight||260,a=window.innerHeight;if(s+o>a&&e.top-o-n>0&&(s=e.top-o-n),t.style.minWidth=`${i}px`,this.align==="right"){let d=window.innerWidth;t.style.right=`${d-e.right}px`,t.style.left="auto"}else t.style.left=`${e.left}px`,t.style.right="auto";t.style.top=`${s}px`}};var Z=`:host {
359
+ `;var Dt="dt-select-trigger",U="dt-select-label",At="dt-select-chevron",Mt="dt-select-menu",zt="dt-select-option",Tt="dt-select-option--active",Y=!1;function Lt(){if(Y)return;let r=document.createElement("style");r.setAttribute("data-dt-select",""),r.textContent=q,document.head.appendChild(r),Y=!0}var w=class extends HTMLElement{_menu=null;_trigger=null;_options=[];_open=!1;_menuId="";static get observedAttributes(){return["value","placeholder","disabled","align"]}get value(){return this.getAttribute("value")??""}set value(t){this.setAttribute("value",t)}get placeholder(){return this.getAttribute("placeholder")??"Select\u2026"}set placeholder(t){this.setAttribute("placeholder",t)}get disabled(){return this.hasAttribute("disabled")}set disabled(t){t?this.setAttribute("disabled",""):this.removeAttribute("disabled")}get align(){return this.getAttribute("align")==="right"?"right":"left"}set align(t){this.setAttribute("align",t)}get options(){return this._options}set options(t){this._options=t,this._updateLabel(),this._open&&this._renderMenuItems()}constructor(){super();let t=this.attachShadow({mode:"open"}),e=document.createElement("style");e.textContent=K,t.appendChild(e);let n=document.createElement("button");n.type="button",n.className=Dt,n.setAttribute("aria-haspopup","listbox"),n.setAttribute("aria-expanded","false");let i=document.createElement("span");i.className=U,n.appendChild(i);let o=document.createElement("span");o.className=At,o.setAttribute("aria-hidden","true"),o.textContent="\u25BE",n.appendChild(o),t.appendChild(n),this._trigger=n,this._menuId=`dt-sel-${Math.random().toString(36).slice(2,9)}`}connectedCallback(){Lt(),this._trigger.addEventListener("click",this._onTriggerClick),this._updateLabel()}disconnectedCallback(){this._trigger.removeEventListener("click",this._onTriggerClick),this._close()}attributeChangedCallback(t){t==="value"&&(this._updateLabel(),this._open&&this._renderMenuItems()),t==="placeholder"&&!this.value&&this._updateLabel(),t==="disabled"&&this.disabled&&this._close()}_updateLabel(){let t=this._trigger.querySelector(`.${U}`),e=this._options.find(n=>n.value===this.value);t.textContent=e?.label??this.placeholder}_onTriggerClick=()=>{this.disabled||(this._open?this._close():this._openMenu())};_openMenu(){if(this._open)return;let t=document.createElement("div");t.className=Mt,t.id=this._menuId,t.setAttribute("role","listbox"),document.body.appendChild(t),this._menu=t,this._renderMenuItems(),this._position(),requestAnimationFrame(()=>{t.setAttribute("data-open","")}),this._open=!0,this._trigger.setAttribute("aria-expanded","true"),requestAnimationFrame(()=>{document.addEventListener("mousedown",this._onOutsideClick),document.addEventListener("keydown",this._onKeyDown),window.addEventListener("blur",this._onWindowBlur)})}_close(){if(this._open){if(document.removeEventListener("mousedown",this._onOutsideClick),document.removeEventListener("keydown",this._onKeyDown),window.removeEventListener("blur",this._onWindowBlur),this._menu){this._menu.removeAttribute("data-open");let t=this._menu;setTimeout(()=>t.remove(),140),this._menu=null}this._open=!1,this._trigger.setAttribute("aria-expanded","false")}}_onOutsideClick=t=>{let e=t.target;this._menu?.contains(e)||this.contains(e)||this._close()};_onWindowBlur=()=>{requestAnimationFrame(()=>{document.activeElement?.tagName==="IFRAME"&&this._close()})};_onKeyDown=t=>{t.key==="Escape"&&(this._close(),this._trigger.focus())};_renderMenuItems(){let t=this._menu;if(t){t.innerHTML="";for(let e of this._options){let n=document.createElement("button");n.type="button",n.className=zt,n.setAttribute("role","option"),n.setAttribute("aria-selected",String(e.value===this.value)),e.value===this.value&&n.classList.add(Tt);let i=document.createElement("span");i.textContent=e.label,n.appendChild(i),n.addEventListener("click",()=>{this._selectValue(e.value)}),t.appendChild(n)}}}_selectValue(t){let e=this.value;this.value=t,this._updateLabel(),this._close(),t!==e&&this.dispatchEvent(new CustomEvent("dt-change",{detail:{value:t},bubbles:!0,composed:!0}))}_position(){let t=this._menu;if(!t)return;let e=this.getBoundingClientRect(),n=10,i=Math.max(e.width,240),o=e.bottom+n,s=t.scrollHeight||260,a=window.innerHeight;if(o+s>a&&e.top-s-n>0&&(o=e.top-s-n),t.style.minWidth=`${i}px`,this.align==="right"){let d=window.innerWidth;t.style.right=`${d-e.right}px`,t.style.left="auto"}else t.style.left=`${e.left}px`,t.style.right="auto";t.style.top=`${o}px`}};var Z=`:host {
360
360
  display: block;
361
361
  margin-bottom: 12px;
362
362
  }
@@ -514,7 +514,7 @@
514
514
  ::slotted(*) {
515
515
  min-width: 0;
516
516
  }
517
- `;var Rt="dt-stack-inner";function X(r){return r==="row"||r==="horizontal"?"row":"column"}var w=class extends HTMLElement{static get observedAttributes(){return["direction","gap","align"]}get direction(){return X(this.getAttribute("direction"))}set direction(t){this.setAttribute("direction",X(t))}get gap(){let t=this.getAttribute("gap");return t==="0"||t==="4"||t==="8"||t==="12"||t==="20"||t==="24"||t==="32"?t:"16"}set gap(t){this.setAttribute("gap",t)}get align(){let t=this.getAttribute("align");return t==="start"||t==="center"||t==="end"?t:"stretch"}set align(t){this.setAttribute("align",t)}connectedCallback(){this.#t()}attributeChangedCallback(t){t==="direction"&&this.#t()}constructor(){super();let t=this.attachShadow({mode:"open"}),e=document.createElement("style");e.textContent=Q,t.appendChild(e);let n=document.createElement("div");n.className=Rt,n.innerHTML="<slot></slot>",t.appendChild(n)}#t(){let t=this.getAttribute("direction"),e=X(t);t!==null&&t!==e&&this.setAttribute("direction",e)}};var tt=`:host {
517
+ `;var Rt="dt-stack-inner";function W(r){return r==="row"||r==="horizontal"?"row":"column"}var y=class extends HTMLElement{static get observedAttributes(){return["direction","gap","align"]}get direction(){return W(this.getAttribute("direction"))}set direction(t){this.setAttribute("direction",W(t))}get gap(){let t=this.getAttribute("gap");return t==="0"||t==="4"||t==="8"||t==="12"||t==="20"||t==="24"||t==="32"?t:"16"}set gap(t){this.setAttribute("gap",t)}get align(){let t=this.getAttribute("align");return t==="start"||t==="center"||t==="end"?t:"stretch"}set align(t){this.setAttribute("align",t)}connectedCallback(){this.#t()}attributeChangedCallback(t){t==="direction"&&this.#t()}constructor(){super();let t=this.attachShadow({mode:"open"}),e=document.createElement("style");e.textContent=Q,t.appendChild(e);let n=document.createElement("div");n.className=Rt,n.innerHTML="<slot></slot>",t.appendChild(n)}#t(){let t=this.getAttribute("direction"),e=W(t);t!==null&&t!==e&&this.setAttribute("direction",e)}};var tt=`:host {
518
518
  display: block;
519
519
  }
520
520
 
@@ -619,7 +619,7 @@
619
619
  .dt-stat-inner .trend.neutral {
620
620
  color: var(--dt-text-muted);
621
621
  }
622
- `;var Vt="dt-stat-inner",y=class extends HTMLElement{static get observedAttributes(){return["label","value","description","size","variant","trend","trend-value"]}_container;_labelEl;_valueEl;_descEl;_trendEl;get label(){return this.getAttribute("label")}set label(t){t===null?this.removeAttribute("label"):this.setAttribute("label",t)}get value(){return this.getAttribute("value")}set value(t){t===null?this.removeAttribute("value"):this.setAttribute("value",t)}get description(){return this.getAttribute("description")}set description(t){t===null?this.removeAttribute("description"):this.setAttribute("description",t)}get size(){let t=this.getAttribute("size");return t==="sm"||t==="lg"?t:"md"}set size(t){this.setAttribute("size",t)}get variant(){let t=this.getAttribute("variant");return t==="outlined"||t==="filled"?t:"default"}set variant(t){this.setAttribute("variant",t)}get trend(){let t=this.getAttribute("trend");return t==="up"||t==="down"||t==="neutral"?t:null}set trend(t){t===null?this.removeAttribute("trend"):this.setAttribute("trend",t)}get trendValue(){return this.getAttribute("trend-value")}set trendValue(t){t===null?this.removeAttribute("trend-value"):this.setAttribute("trend-value",t)}constructor(){super();let t=this.attachShadow({mode:"open"}),e=document.createElement("style");e.textContent=tt,t.appendChild(e),this._container=document.createElement("div"),this._container.className=Vt,this._labelEl=document.createElement("div"),this._labelEl.className="label",this._container.appendChild(this._labelEl),this._valueEl=document.createElement("div"),this._valueEl.className="value",this._container.appendChild(this._valueEl),this._descEl=document.createElement("div"),this._descEl.className="description",this._container.appendChild(this._descEl),this._trendEl=document.createElement("div"),this._trendEl.className="trend",this._container.appendChild(this._trendEl),t.appendChild(this._container),this._render()}attributeChangedCallback(t,e,n){(t==="label"||t==="value"||t==="description"||t==="size"||t==="variant"||t==="trend"||t==="trend-value")&&this._render()}_render(){this._labelEl.textContent=this.label??"",this._labelEl.style.display=this.label?"block":"none",this._valueEl.textContent=this.value??"",this._valueEl.style.display=this.value?"block":"none",this._descEl.textContent=this.description??"",this._descEl.style.display=this.description?"block":"none";let t=this.trend,e=this.trendValue;if(t&&e){this._trendEl.style.display="inline-flex",this._trendEl.className=`trend ${t==="up"?"positive":t==="down"?"negative":"neutral"}`;let n="";t==="up"?n="\u2191":t==="down"?n="\u2193":n="\u2192",this._trendEl.textContent=`${n} ${e}`}else this._trendEl.style.display="none"}};var et=`:host {
622
+ `;var Pt="dt-stat-inner",k=class extends HTMLElement{static get observedAttributes(){return["label","value","description","size","variant","trend","trend-value"]}_container;_labelEl;_valueEl;_descEl;_trendEl;get label(){return this.getAttribute("label")}set label(t){t===null?this.removeAttribute("label"):this.setAttribute("label",t)}get value(){return this.getAttribute("value")}set value(t){t===null?this.removeAttribute("value"):this.setAttribute("value",t)}get description(){return this.getAttribute("description")}set description(t){t===null?this.removeAttribute("description"):this.setAttribute("description",t)}get size(){let t=this.getAttribute("size");return t==="sm"||t==="lg"?t:"md"}set size(t){this.setAttribute("size",t)}get variant(){let t=this.getAttribute("variant");return t==="outlined"||t==="filled"?t:"default"}set variant(t){this.setAttribute("variant",t)}get trend(){let t=this.getAttribute("trend");return t==="up"||t==="down"||t==="neutral"?t:null}set trend(t){t===null?this.removeAttribute("trend"):this.setAttribute("trend",t)}get trendValue(){return this.getAttribute("trend-value")}set trendValue(t){t===null?this.removeAttribute("trend-value"):this.setAttribute("trend-value",t)}constructor(){super();let t=this.attachShadow({mode:"open"}),e=document.createElement("style");e.textContent=tt,t.appendChild(e),this._container=document.createElement("div"),this._container.className=Pt,this._labelEl=document.createElement("div"),this._labelEl.className="label",this._container.appendChild(this._labelEl),this._valueEl=document.createElement("div"),this._valueEl.className="value",this._container.appendChild(this._valueEl),this._descEl=document.createElement("div"),this._descEl.className="description",this._container.appendChild(this._descEl),this._trendEl=document.createElement("div"),this._trendEl.className="trend",this._container.appendChild(this._trendEl),t.appendChild(this._container),this._render()}attributeChangedCallback(t,e,n){(t==="label"||t==="value"||t==="description"||t==="size"||t==="variant"||t==="trend"||t==="trend-value")&&this._render()}_render(){this._labelEl.textContent=this.label??"",this._labelEl.style.display=this.label?"block":"none",this._valueEl.textContent=this.value??"",this._valueEl.style.display=this.value?"block":"none",this._descEl.textContent=this.description??"",this._descEl.style.display=this.description?"block":"none";let t=this.trend,e=this.trendValue;if(t&&e){this._trendEl.style.display="inline-flex",this._trendEl.className=`trend ${t==="up"?"positive":t==="down"?"negative":"neutral"}`;let n="";t==="up"?n="\u2191":t==="down"?n="\u2193":n="\u2192",this._trendEl.textContent=`${n} ${e}`}else this._trendEl.style.display="none"}};var et=`:host {
623
623
  display: inline-flex;
624
624
  vertical-align: middle;
625
625
  }
@@ -701,7 +701,7 @@
701
701
  padding: 3px 8px;
702
702
  font-size: 0.75rem;
703
703
  }
704
- `;var Pt="dt-badge-inner",k=class extends HTMLElement{static get observedAttributes(){return["variant","size","text"]}_container;_slot;get variant(){let t=this.getAttribute("variant");return t==="success"||t==="danger"||t==="warning"||t==="info"||t==="default"||t==="neutral"?t:"accent"}set variant(t){this.setAttribute("variant",t)}get size(){let t=this.getAttribute("size");return t==="sm"||t==="lg"?t:"md"}set size(t){this.setAttribute("size",t)}get text(){return this.getAttribute("text")}set text(t){t===null?this.removeAttribute("text"):this.setAttribute("text",t)}constructor(){super();let t=this.attachShadow({mode:"open"}),e=document.createElement("style");e.textContent=et,t.appendChild(e),this._container=document.createElement("span"),this._container.className=Pt;let n=this.text;n!==null?this._container.textContent=n:(this._slot=document.createElement("slot"),this._container.appendChild(this._slot)),t.appendChild(this._container)}attributeChangedCallback(t,e,n){t==="text"&&this._render()}_render(){let t=this.text;t!==null&&(this._container.textContent=t)}};var nt=`:host {
704
+ `;var Vt="dt-badge-inner",C=class extends HTMLElement{static get observedAttributes(){return["variant","size","text"]}_container;_slot;get variant(){let t=this.getAttribute("variant");return t==="success"||t==="danger"||t==="warning"||t==="info"||t==="default"||t==="neutral"?t:"accent"}set variant(t){this.setAttribute("variant",t)}get size(){let t=this.getAttribute("size");return t==="sm"||t==="lg"?t:"md"}set size(t){this.setAttribute("size",t)}get text(){return this.getAttribute("text")}set text(t){t===null?this.removeAttribute("text"):this.setAttribute("text",t)}constructor(){super();let t=this.attachShadow({mode:"open"}),e=document.createElement("style");e.textContent=et,t.appendChild(e),this._container=document.createElement("span"),this._container.className=Vt;let n=this.text;n!==null?this._container.textContent=n:(this._slot=document.createElement("slot"),this._container.appendChild(this._slot)),t.appendChild(this._container)}attributeChangedCallback(t,e,n){t==="text"&&this._render()}_render(){let t=this.text;t!==null&&(this._container.textContent=t)}};var nt=`:host {
705
705
  display: inline-flex;
706
706
  vertical-align: middle;
707
707
  }
@@ -718,6 +718,9 @@
718
718
  font-weight: 600;
719
719
  font-family: var(--font-ui, 'Work Sans', system-ui, sans-serif);
720
720
  line-height: 1.2;
721
+ white-space: nowrap;
722
+ overflow: hidden;
723
+ text-overflow: ellipsis;
721
724
  cursor: pointer;
722
725
  transition: all 0.1s ease;
723
726
  background: var(--dt-surface);
@@ -860,7 +863,7 @@
860
863
  width: 1em;
861
864
  height: 1em;
862
865
  }
863
- `;var It="dt-button-inner",C=class extends HTMLElement{static get observedAttributes(){return["variant","size","disabled","fullwidth","type"]}_button;_slot;get variant(){let t=this.getAttribute("variant");return t==="secondary"||t==="ghost"||t==="danger"?t:"primary"}set variant(t){this.setAttribute("variant",t)}get size(){let t=this.getAttribute("size");return t==="sm"||t==="lg"?t:"md"}set size(t){this.setAttribute("size",t)}get disabled(){return this.hasAttribute("disabled")}set disabled(t){t?this.setAttribute("disabled",""):this.removeAttribute("disabled")}get fullwidth(){return this.hasAttribute("fullwidth")}set fullwidth(t){t?this.setAttribute("fullwidth",""):this.removeAttribute("fullwidth")}get type(){let t=this.getAttribute("type");return t==="submit"||t==="reset"?t:"button"}set type(t){this.setAttribute("type",t)}constructor(){super();let t=this.attachShadow({mode:"open"}),e=document.createElement("style");e.textContent=nt,t.appendChild(e),this._button=document.createElement("button"),this._button.className=It,this._button.type=this.type,this._button.disabled=this.disabled,this._slot=document.createElement("slot"),this._button.appendChild(this._slot),this._button.addEventListener("click",()=>{if(this.type==="submit"&&!this.disabled){let n=this.closest("form");n&&n.requestSubmit()}}),t.appendChild(this._button)}attributeChangedCallback(t,e,n){switch(t){case"disabled":this._button.disabled=this.disabled;break;case"type":this._button.type=this.type;break}}};var rt=`:host {
866
+ `;var It="dt-button-inner",E=class extends HTMLElement{static get observedAttributes(){return["variant","size","disabled","fullwidth","type"]}_button;_slot;get variant(){let t=this.getAttribute("variant");return t==="secondary"||t==="ghost"||t==="danger"?t:"primary"}set variant(t){this.setAttribute("variant",t)}get size(){let t=this.getAttribute("size");return t==="sm"||t==="lg"?t:"md"}set size(t){this.setAttribute("size",t)}get disabled(){return this.hasAttribute("disabled")}set disabled(t){t?this.setAttribute("disabled",""):this.removeAttribute("disabled")}get fullwidth(){return this.hasAttribute("fullwidth")}set fullwidth(t){t?this.setAttribute("fullwidth",""):this.removeAttribute("fullwidth")}get type(){let t=this.getAttribute("type");return t==="submit"||t==="reset"?t:"button"}set type(t){this.setAttribute("type",t)}constructor(){super();let t=this.attachShadow({mode:"open"}),e=document.createElement("style");e.textContent=nt,t.appendChild(e),this._button=document.createElement("button"),this._button.className=It,this._button.type=this.type,this._button.disabled=this.disabled,this._slot=document.createElement("slot"),this._button.appendChild(this._slot),this._button.addEventListener("click",()=>{if(this.type==="submit"&&!this.disabled){let n=this.closest("form");n&&n.requestSubmit()}}),t.appendChild(this._button)}attributeChangedCallback(t,e,n){switch(t){case"disabled":this._button.disabled=this.disabled;break;case"type":this._button.type=this.type;break}}};var rt=`:host {
864
867
  display: block;
865
868
  }
866
869
 
@@ -925,7 +928,7 @@
925
928
  :host([direction='vertical'][spacing='lg']) .dt-divider-inner {
926
929
  margin: 0 18px;
927
930
  }
928
- `;var Nt="dt-divider-inner",E=class extends HTMLElement{static get observedAttributes(){return["direction","style-variant","spacing"]}get direction(){return this.getAttribute("direction")==="vertical"?"vertical":"horizontal"}set direction(t){this.setAttribute("direction",t)}get styleVariant(){let t=this.getAttribute("style-variant");return t==="subtle"||t==="strong"?t:"default"}set styleVariant(t){this.setAttribute("style-variant",t)}get spacing(){let t=this.getAttribute("spacing");return t==="sm"||t==="md"||t==="lg"?t:null}set spacing(t){t===null?this.removeAttribute("spacing"):this.setAttribute("spacing",t)}constructor(){super();let t=this.attachShadow({mode:"open"}),e=document.createElement("style");e.textContent=rt,t.appendChild(e);let n=document.createElement("hr");n.className=Nt,t.appendChild(n)}};var it=`:host {
931
+ `;var Nt="dt-divider-inner",S=class extends HTMLElement{static get observedAttributes(){return["direction","style-variant","spacing"]}get direction(){return this.getAttribute("direction")==="vertical"?"vertical":"horizontal"}set direction(t){this.setAttribute("direction",t)}get styleVariant(){let t=this.getAttribute("style-variant");return t==="subtle"||t==="strong"?t:"default"}set styleVariant(t){this.setAttribute("style-variant",t)}get spacing(){let t=this.getAttribute("spacing");return t==="sm"||t==="md"||t==="lg"?t:null}set spacing(t){t===null?this.removeAttribute("spacing"):this.setAttribute("spacing",t)}constructor(){super();let t=this.attachShadow({mode:"open"}),e=document.createElement("style");e.textContent=rt,t.appendChild(e);let n=document.createElement("hr");n.className=Nt,t.appendChild(n)}};var it=`:host {
929
932
  display: block;
930
933
  min-height: 180px;
931
934
  color: var(--dt-text);
@@ -1093,7 +1096,7 @@
1093
1096
  letter-spacing: 0.08em;
1094
1097
  font-size: 0.75rem;
1095
1098
  }
1096
- `;function Ft(r){return r==null||r===!1?null:r===!0?"":String(r)}function Ot(r,t){let e=r.querySelectorAll("*");for(let n of e){let i=n.getAttribute("data-field");if(i){let s=t[i];n.textContent=s==null?"":String(s)}for(let s of n.getAttributeNames()){if(s==="data-field"||!s.startsWith("data-field-"))continue;let o=s.slice(11);if(!o)continue;let a=n.getAttribute(s);if(!a)continue;let d=Ft(t[a]);d===null?n.removeAttribute(o):n.setAttribute(o,d)}}}function R(r,t){let e=r.content.cloneNode(!0);return Ot(e,t),e}var m=class{_count=0;_estimateSize=56;_overscan=5;_fixedSize=null;_viewportHeight=0;_scrollTop=0;_sizes=new Map;constructor(t={}){this._count=t.count??0,this._estimateSize=t.estimateSize??56,this._overscan=t.overscan??5,this._fixedSize=t.fixedSize??null}setCount(t){this._count=Math.max(0,t);for(let e of this._sizes.keys())e>=this._count&&this._sizes.delete(e)}setViewportHeight(t){this._viewportHeight=Math.max(0,t)}setScrollTop(t){this._scrollTop=Math.max(0,t)}setEstimateSize(t){this._estimateSize=Math.max(1,t)}setFixedSize(t){this._fixedSize=t&&t>0?t:null}resetMeasurements(){this._sizes.clear()}measure(t,e){if(this._fixedSize!==null||t<0||t>=this._count)return 0;let n=Math.max(1,Math.round(e)),i=this._sizes.get(t);return i===n?0:(this._sizes.set(t,n),this.getOffset(t+1)<=this._scrollTop?n-(i??this._estimateSize):0)}getOffset(t){if(t<=0)return 0;let e=Math.min(t,this._count);if(this._fixedSize!==null)return e*this._fixedSize;let n=0;for(let i=0;i<e;i+=1)n+=this._sizes.get(i)??this._estimateSize;return n}getTotalHeight(){return this.getOffset(this._count)}getRange(){if(this._count===0)return{start:0,end:0,paddingTop:0,paddingBottom:0,totalHeight:0};if(this._fixedSize!==null){let d=Math.max(1,Math.ceil(this._viewportHeight/this._fixedSize)),c=Math.max(0,Math.floor(this._scrollTop/this._fixedSize)-this._overscan),l=Math.min(this._count,c+d+this._overscan*2),L=c*this._fixedSize,H=this._count*this._fixedSize,h=Math.max(0,H-L-(l-c)*this._fixedSize);return{start:c,end:l,paddingTop:L,paddingBottom:h,totalHeight:H}}let t=0,e=0;for(;t<this._count;){let d=this._sizes.get(t)??this._estimateSize;if(e+d>this._scrollTop)break;e+=d,t+=1}t=Math.max(0,t-this._overscan);let n=this.getOffset(t),i=t,s=0;for(;i<this._count&&s<this._viewportHeight;)s+=this._sizes.get(i)??this._estimateSize,i+=1;i=Math.min(this._count,i+this._overscan);let o=this.getTotalHeight(),a=Math.max(0,o-this.getOffset(i));return{start:t,end:i,paddingTop:n,paddingBottom:a,totalHeight:o}}};function Bt(r){return r&&typeof r=="object"?r:{value:r}}function $t(r){return r==="center"||r==="right"?r:"left"}var g=class extends HTMLElement{static get observedAttributes(){return["field","header","width","min-width","align"]}get field(){return this.getAttribute("field")??""}get header(){return this.getAttribute("header")??this.field}get width(){return this.getAttribute("width")??"auto"}get minWidth(){return this.getAttribute("min-width")??"0"}get align(){return $t(this.getAttribute("align"))}connectedCallback(){this.hidden=!0}attributeChangedCallback(){this.dispatchEvent(new CustomEvent("dt-column-change",{bubbles:!0,composed:!0}))}},S=class extends HTMLElement{_rows=[];_columns=[];_virtualizer=new m({estimateSize:40,overscan:5,fixedSize:40});_root;_scroll;_header;_body;_canvas;_emptyState;_resizeObserver=null;_mutationObserver=null;_sortField=null;_sortDirection="asc";static get observedAttributes(){return["row-height","sortable","striped","bordered","empty-text"]}get rows(){return this._rows}set rows(t){this._rows=Array.isArray(t)?t:[],this._virtualizer.setCount(this._rows.length),this._render()}get rowHeight(){let t=Number(this.getAttribute("row-height")??"40");return Number.isFinite(t)&&t>0?t:40}set rowHeight(t){this.setAttribute("row-height",String(t))}get sortable(){return this.hasAttribute("sortable")}get emptyText(){return this.getAttribute("empty-text")??"No data"}constructor(){super();let t=this.attachShadow({mode:"open"}),e=document.createElement("style");e.textContent=it,t.appendChild(e),this._root=document.createElement("div"),this._root.className="dt-table-view",this._scroll=document.createElement("div"),this._scroll.className="dt-table-scroll",this._scroll.addEventListener("scroll",this._onScroll,{passive:!0}),this._header=document.createElement("div"),this._header.className="dt-table-header",this._body=document.createElement("div"),this._body.className="dt-table-body",this._canvas=document.createElement("div"),this._canvas.className="dt-table-canvas",this._emptyState=document.createElement("div"),this._emptyState.className="dt-table-empty",this._body.append(this._canvas,this._emptyState),this._scroll.append(this._header,this._body),this._root.appendChild(this._scroll),t.appendChild(this._root)}connectedCallback(){this._virtualizer.setFixedSize(this.rowHeight),this._virtualizer.setEstimateSize(this.rowHeight),this._syncColumns(),this._resizeObserver=new ResizeObserver(t=>{for(let e of t)if(e.target===this._scroll){let n=this._header.offsetHeight;this._virtualizer.setViewportHeight(Math.max(0,e.contentRect.height-n)),this._render()}}),this._resizeObserver.observe(this._scroll),this._mutationObserver=new MutationObserver(()=>{this._syncColumns(),this._render()}),this._mutationObserver.observe(this,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["field","header","width","min-width","align"]}),this._virtualizer.setCount(this._rows.length),this._virtualizer.setViewportHeight(Math.max(0,this._scroll.clientHeight-this._header.offsetHeight)),this._render()}disconnectedCallback(){this._scroll.removeEventListener("scroll",this._onScroll),this._resizeObserver?.disconnect(),this._mutationObserver?.disconnect(),this._resizeObserver=null,this._mutationObserver=null}attributeChangedCallback(t){t==="row-height"&&(this._virtualizer.setFixedSize(this.rowHeight),this._virtualizer.setEstimateSize(this.rowHeight)),this._render()}_onScroll=()=>{this._virtualizer.setScrollTop(Math.max(0,this._scroll.scrollTop-this._header.offsetHeight)),this._renderBody()};_syncColumns(){this._columns=Array.from(this.children).filter(t=>t instanceof g).map(t=>({field:t.field,header:t.header,width:t.width,minWidth:t.minWidth,align:t.align,template:Array.from(t.children).find(e=>e instanceof HTMLTemplateElement)??null})).filter(t=>t.field)}_render(){if(!this.isConnected)return;this._emptyState.textContent=this.emptyText;let t=this._columns.length>0?this._columns.map(e=>this._toGridColumn(e)).join(" "):"minmax(0, 1fr)";this._header.style.setProperty("--dt-table-columns",t),this._canvas.style.setProperty("--dt-table-columns",t),this._renderHeader(),this._renderBody()}_renderHeader(){let t=document.createDocumentFragment();for(let e of this._columns){let n=document.createElement("div");n.className="dt-table-header-cell",n.dataset.align=e.align,this.sortable&&(n.classList.add("dt-table-header-cell--sortable"),n.tabIndex=0,n.setAttribute("role","button"),n.setAttribute("aria-label",`Sort by ${e.header}`),n.addEventListener("click",()=>this._requestSort(e.field)),n.addEventListener("keydown",s=>{(s.key==="Enter"||s.key===" ")&&(s.preventDefault(),this._requestSort(e.field))}));let i=document.createElement("span");if(i.className="dt-table-header-label",i.textContent=e.header,this.sortable){let s=document.createElement("span");s.className="dt-table-sort-indicator",this._sortField===e.field?s.textContent=this._sortDirection==="asc"?"\u25B2":"\u25BC":s.textContent="\u2195",i.appendChild(s)}n.appendChild(i),t.appendChild(n)}this._header.replaceChildren(t)}_renderBody(){if(this._rows.length===0||this._columns.length===0){this._emptyState.hidden=!1,this._canvas.replaceChildren(),this._body.style.height="140px",this._canvas.style.height="0px";return}this._emptyState.hidden=!0,this._virtualizer.setCount(this._rows.length),this._virtualizer.setScrollTop(Math.max(0,this._scroll.scrollTop-this._header.offsetHeight)),this._virtualizer.setViewportHeight(Math.max(0,this._scroll.clientHeight-this._header.offsetHeight));let t=this._virtualizer.getRange();this._body.style.height=`${Math.max(t.totalHeight,this._scroll.clientHeight-this._header.offsetHeight)}px`,this._canvas.style.height=`${t.totalHeight}px`;let e=document.createDocumentFragment();for(let n=t.start;n<t.end;n+=1)e.appendChild(this._renderRow(n));this._canvas.replaceChildren(e)}_renderRow(t){let e=this._rows[t],n=document.createElement("div");n.className="dt-table-row dt-table-row--clickable",n.style.top=`${this._virtualizer.getOffset(t)}px`,n.style.height=`${this.rowHeight}px`,n.style.setProperty("--dt-table-columns",this._header.style.getPropertyValue("--dt-table-columns")),n.addEventListener("click",()=>{this.dispatchEvent(new CustomEvent("dt-row-click",{detail:{row:e,index:t},bubbles:!0,composed:!0}))});let i=Bt(e);for(let s of this._columns){let o=document.createElement("div");if(o.className="dt-table-cell",o.dataset.align=s.align,s.template)o.appendChild(R(s.template,i));else{let a=i[s.field];o.textContent=a==null?"":String(a)}n.appendChild(o)}return n}_requestSort(t){this._sortField===t?this._sortDirection=this._sortDirection==="asc"?"desc":"asc":(this._sortField=t,this._sortDirection="asc"),this._renderHeader(),this.dispatchEvent(new CustomEvent("dt-sort",{detail:{field:t,direction:this._sortDirection},bubbles:!0,composed:!0}))}_toGridColumn(t){let e=/^\d+$/.test(t.minWidth)?`${t.minWidth}px`:t.minWidth;if(t.width==="auto")return`minmax(${e}, 1fr)`;let n=/^\d+$/.test(t.width)?`${t.width}px`:t.width;return`minmax(${e}, ${n})`}};var st=`:host {
1099
+ `;function Ft(r){return r==null||r===!1?null:r===!0?"":String(r)}function Ot(r,t){let e=r.querySelectorAll("*");for(let n of e){let i=n.getAttribute("data-field");if(i){let o=t[i];n.textContent=o==null?"":String(o)}for(let o of n.getAttributeNames()){if(o==="data-field"||!o.startsWith("data-field-"))continue;let s=o.slice(11);if(!s)continue;let a=n.getAttribute(o);if(!a)continue;let d=Ft(t[a]);d===null?n.removeAttribute(s):n.setAttribute(s,d)}}}function R(r,t){let e=r.content.cloneNode(!0);return Ot(e,t),e}var g=class{_count=0;_estimateSize=56;_overscan=5;_fixedSize=null;_viewportHeight=0;_scrollTop=0;_sizes=new Map;constructor(t={}){this._count=t.count??0,this._estimateSize=t.estimateSize??56,this._overscan=t.overscan??5,this._fixedSize=t.fixedSize??null}setCount(t){this._count=Math.max(0,t);for(let e of this._sizes.keys())e>=this._count&&this._sizes.delete(e)}setViewportHeight(t){this._viewportHeight=Math.max(0,t)}setScrollTop(t){this._scrollTop=Math.max(0,t)}setEstimateSize(t){this._estimateSize=Math.max(1,t)}setFixedSize(t){this._fixedSize=t&&t>0?t:null}resetMeasurements(){this._sizes.clear()}measure(t,e){if(this._fixedSize!==null||t<0||t>=this._count)return 0;let n=Math.max(1,Math.round(e)),i=this._sizes.get(t);return i===n?0:(this._sizes.set(t,n),this.getOffset(t+1)<=this._scrollTop?n-(i??this._estimateSize):0)}getOffset(t){if(t<=0)return 0;let e=Math.min(t,this._count);if(this._fixedSize!==null)return e*this._fixedSize;let n=0;for(let i=0;i<e;i+=1)n+=this._sizes.get(i)??this._estimateSize;return n}getTotalHeight(){return this.getOffset(this._count)}getRange(){if(this._count===0)return{start:0,end:0,paddingTop:0,paddingBottom:0,totalHeight:0};if(this._fixedSize!==null){let d=Math.max(1,Math.ceil(this._viewportHeight/this._fixedSize)),l=Math.max(0,Math.floor(this._scrollTop/this._fixedSize)-this._overscan),c=Math.min(this._count,l+d+this._overscan*2),u=l*this._fixedSize,H=this._count*this._fixedSize,h=Math.max(0,H-u-(c-l)*this._fixedSize);return{start:l,end:c,paddingTop:u,paddingBottom:h,totalHeight:H}}let t=0,e=0;for(;t<this._count;){let d=this._sizes.get(t)??this._estimateSize;if(e+d>this._scrollTop)break;e+=d,t+=1}t=Math.max(0,t-this._overscan);let n=this.getOffset(t),i=t,o=0;for(;i<this._count&&o<this._viewportHeight;)o+=this._sizes.get(i)??this._estimateSize,i+=1;i=Math.min(this._count,i+this._overscan);let s=this.getTotalHeight(),a=Math.max(0,s-this.getOffset(i));return{start:t,end:i,paddingTop:n,paddingBottom:a,totalHeight:s}}};function Bt(r){return r&&typeof r=="object"?r:{value:r}}function $t(r){return r==="center"||r==="right"?r:"left"}var b=class extends HTMLElement{static get observedAttributes(){return["field","header","width","min-width","align"]}get field(){return this.getAttribute("field")??""}get header(){return this.getAttribute("header")??this.field}get width(){return this.getAttribute("width")??"auto"}get minWidth(){return this.getAttribute("min-width")??"0"}get align(){return $t(this.getAttribute("align"))}connectedCallback(){this.hidden=!0}attributeChangedCallback(){this.dispatchEvent(new CustomEvent("dt-column-change",{bubbles:!0,composed:!0}))}},D=class extends HTMLElement{_rows=[];_columns=[];_virtualizer=new g({estimateSize:40,overscan:5,fixedSize:40});_root;_scroll;_header;_body;_canvas;_emptyState;_resizeObserver=null;_mutationObserver=null;_sortField=null;_sortDirection="asc";static get observedAttributes(){return["row-height","sortable","striped","bordered","empty-text"]}get rows(){return this._rows}set rows(t){this._rows=Array.isArray(t)?t:[],this._virtualizer.setCount(this._rows.length),this._render()}get rowHeight(){let t=Number(this.getAttribute("row-height")??"40");return Number.isFinite(t)&&t>0?t:40}set rowHeight(t){this.setAttribute("row-height",String(t))}get sortable(){return this.hasAttribute("sortable")}get emptyText(){return this.getAttribute("empty-text")??"No data"}constructor(){super();let t=this.attachShadow({mode:"open"}),e=document.createElement("style");e.textContent=it,t.appendChild(e),this._root=document.createElement("div"),this._root.className="dt-table-view",this._scroll=document.createElement("div"),this._scroll.className="dt-table-scroll",this._scroll.addEventListener("scroll",this._onScroll,{passive:!0}),this._header=document.createElement("div"),this._header.className="dt-table-header",this._body=document.createElement("div"),this._body.className="dt-table-body",this._canvas=document.createElement("div"),this._canvas.className="dt-table-canvas",this._emptyState=document.createElement("div"),this._emptyState.className="dt-table-empty",this._body.append(this._canvas,this._emptyState),this._scroll.append(this._header,this._body),this._root.appendChild(this._scroll),t.appendChild(this._root)}connectedCallback(){this._virtualizer.setFixedSize(this.rowHeight),this._virtualizer.setEstimateSize(this.rowHeight),this._syncColumns(),this._resizeObserver=new ResizeObserver(t=>{for(let e of t)if(e.target===this._scroll){let n=this._header.offsetHeight;this._virtualizer.setViewportHeight(Math.max(0,e.contentRect.height-n)),this._render()}}),this._resizeObserver.observe(this._scroll),this._mutationObserver=new MutationObserver(()=>{this._syncColumns(),this._render()}),this._mutationObserver.observe(this,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["field","header","width","min-width","align"]}),this._virtualizer.setCount(this._rows.length),this._virtualizer.setViewportHeight(Math.max(0,this._scroll.clientHeight-this._header.offsetHeight)),this._render()}disconnectedCallback(){this._scroll.removeEventListener("scroll",this._onScroll),this._resizeObserver?.disconnect(),this._mutationObserver?.disconnect(),this._resizeObserver=null,this._mutationObserver=null}attributeChangedCallback(t){t==="row-height"&&(this._virtualizer.setFixedSize(this.rowHeight),this._virtualizer.setEstimateSize(this.rowHeight)),this._render()}_onScroll=()=>{this._virtualizer.setScrollTop(Math.max(0,this._scroll.scrollTop-this._header.offsetHeight)),this._renderBody()};_syncColumns(){this._columns=Array.from(this.children).filter(t=>t instanceof b).map(t=>({field:t.field,header:t.header,width:t.width,minWidth:t.minWidth,align:t.align,template:Array.from(t.children).find(e=>e instanceof HTMLTemplateElement)??null})).filter(t=>t.field)}_render(){if(!this.isConnected)return;this._emptyState.textContent=this.emptyText;let t=this._columns.length>0?this._columns.map(e=>this._toGridColumn(e)).join(" "):"minmax(0, 1fr)";this._header.style.setProperty("--dt-table-columns",t),this._canvas.style.setProperty("--dt-table-columns",t),this._renderHeader(),this._renderBody()}_renderHeader(){let t=document.createDocumentFragment();for(let e of this._columns){let n=document.createElement("div");n.className="dt-table-header-cell",n.dataset.align=e.align,this.sortable&&(n.classList.add("dt-table-header-cell--sortable"),n.tabIndex=0,n.setAttribute("role","button"),n.setAttribute("aria-label",`Sort by ${e.header}`),n.addEventListener("click",()=>this._requestSort(e.field)),n.addEventListener("keydown",o=>{(o.key==="Enter"||o.key===" ")&&(o.preventDefault(),this._requestSort(e.field))}));let i=document.createElement("span");if(i.className="dt-table-header-label",i.textContent=e.header,this.sortable){let o=document.createElement("span");o.className="dt-table-sort-indicator",this._sortField===e.field?o.textContent=this._sortDirection==="asc"?"\u25B2":"\u25BC":o.textContent="\u2195",i.appendChild(o)}n.appendChild(i),t.appendChild(n)}this._header.replaceChildren(t)}_renderBody(){if(this._rows.length===0||this._columns.length===0){this._emptyState.hidden=!1,this._canvas.replaceChildren(),this._body.style.height="140px",this._canvas.style.height="0px";return}this._emptyState.hidden=!0,this._virtualizer.setCount(this._rows.length),this._virtualizer.setScrollTop(Math.max(0,this._scroll.scrollTop-this._header.offsetHeight)),this._virtualizer.setViewportHeight(Math.max(0,this._scroll.clientHeight-this._header.offsetHeight));let t=this._virtualizer.getRange();this._body.style.height=`${Math.max(t.totalHeight,this._scroll.clientHeight-this._header.offsetHeight)}px`,this._canvas.style.height=`${t.totalHeight}px`;let e=document.createDocumentFragment();for(let n=t.start;n<t.end;n+=1)e.appendChild(this._renderRow(n));this._canvas.replaceChildren(e)}_renderRow(t){let e=this._rows[t],n=document.createElement("div");n.className="dt-table-row dt-table-row--clickable",n.style.top=`${this._virtualizer.getOffset(t)}px`,n.style.height=`${this.rowHeight}px`,n.style.setProperty("--dt-table-columns",this._header.style.getPropertyValue("--dt-table-columns")),n.addEventListener("click",()=>{this.dispatchEvent(new CustomEvent("dt-row-click",{detail:{row:e,index:t},bubbles:!0,composed:!0}))});let i=Bt(e);for(let o of this._columns){let s=document.createElement("div");if(s.className="dt-table-cell",s.dataset.align=o.align,o.template)s.appendChild(R(o.template,i));else{let a=i[o.field];s.textContent=a==null?"":String(a)}n.appendChild(s)}return n}_requestSort(t){this._sortField===t?this._sortDirection=this._sortDirection==="asc"?"desc":"asc":(this._sortField=t,this._sortDirection="asc"),this._renderHeader(),this.dispatchEvent(new CustomEvent("dt-sort",{detail:{field:t,direction:this._sortDirection},bubbles:!0,composed:!0}))}_toGridColumn(t){let e=/^\d+$/.test(t.minWidth)?`${t.minWidth}px`:t.minWidth;if(t.width==="auto")return`minmax(${e}, 1fr)`;let n=/^\d+$/.test(t.width)?`${t.width}px`:t.width;return`minmax(${e}, ${n})`}};var ot=`:host {
1097
1100
  display: block;
1098
1101
  min-height: 120px;
1099
1102
  color: var(--dt-text);
@@ -1192,7 +1195,7 @@
1192
1195
  letter-spacing: 0.08em;
1193
1196
  font-size: 0.75rem;
1194
1197
  }
1195
- `;var ot=56;function Xt(r){return r&&typeof r=="object"?r:{value:r}}var D=class extends HTMLElement{_items=[];_selectedIndices=new Set;_renderItem=null;_virtualizer=new m({estimateSize:ot,overscan:5});_viewport;_spacer;_itemsLayer;_emptyState;_resizeObserver=null;_itemResizeObserver=null;static get observedAttributes(){return["item-height","dividers","selectable","empty-text"]}get items(){return this._items}set items(t){this._items=Array.isArray(t)?t:[],this._selectedIndices=new Set([...this._selectedIndices].filter(e=>e<this._items.length)),this._virtualizer.setCount(this._items.length),this._syncSizingMode(!0),this._render()}get selectedItems(){return[...this._selectedIndices].sort((t,e)=>t-e).map(t=>this._items[t])}get renderItem(){return this._renderItem}set renderItem(t){this._renderItem=typeof t=="function"?t:null,this._render()}get itemHeight(){let t=this.getAttribute("item-height");if(!t)return null;let e=Number(t);return Number.isFinite(e)&&e>0?e:null}set itemHeight(t){if(t===null||t<=0){this.removeAttribute("item-height");return}this.setAttribute("item-height",String(t))}get selectable(){let t=this.getAttribute("selectable");return t==="single"||t==="multi"?t:"none"}set selectable(t){this.setAttribute("selectable",t)}get emptyText(){return this.getAttribute("empty-text")??"No items"}set emptyText(t){this.setAttribute("empty-text",t)}constructor(){super();let t=this.attachShadow({mode:"open"}),e=document.createElement("style");e.textContent=st,t.appendChild(e),this._viewport=document.createElement("div"),this._viewport.className="dt-list-view",this._viewport.addEventListener("scroll",this._onScroll,{passive:!0}),this._spacer=document.createElement("div"),this._spacer.className="dt-list-spacer",this._itemsLayer=document.createElement("div"),this._itemsLayer.className="dt-list-items",this._emptyState=document.createElement("div"),this._emptyState.className="dt-list-empty",this._spacer.append(this._itemsLayer,this._emptyState),this._viewport.appendChild(this._spacer),t.appendChild(this._viewport)}connectedCallback(){this._resizeObserver=new ResizeObserver(t=>{for(let e of t)e.target===this._viewport&&(this._virtualizer.setViewportHeight(e.contentRect.height),this._render())}),this._resizeObserver.observe(this._viewport),this._itemResizeObserver=new ResizeObserver(t=>{let e=0;for(let n of t){let i=n.target,s=Number(i.dataset.index);Number.isFinite(s)&&(e+=this._virtualizer.measure(s,n.contentRect.height))}e!==0&&(this._viewport.scrollTop+=e),t.length>0&&this._render()}),this._virtualizer.setCount(this._items.length),this._virtualizer.setViewportHeight(this._viewport.clientHeight),this._syncSizingMode(!1),this._render()}disconnectedCallback(){this._viewport.removeEventListener("scroll",this._onScroll),this._resizeObserver?.disconnect(),this._itemResizeObserver?.disconnect(),this._resizeObserver=null,this._itemResizeObserver=null}attributeChangedCallback(t){t==="item-height"&&this._syncSizingMode(!0),t==="selectable"&&this.selectable==="none"&&this._selectedIndices.size>0&&(this._selectedIndices.clear(),this._emitSelectionChange()),this._render()}_onScroll=()=>{this._virtualizer.setScrollTop(this._viewport.scrollTop),this._render()};_syncSizingMode(t){let e=this.itemHeight;this._virtualizer.setFixedSize(e),this._virtualizer.setEstimateSize(e??ot),t&&this._virtualizer.resetMeasurements()}_render(){if(!this.isConnected)return;if(this._emptyState.textContent=this.emptyText,this._emptyState.hidden=this._items.length>0,this._items.length===0){this._itemsLayer.replaceChildren(),this._spacer.style.height="100%";return}this._virtualizer.setScrollTop(this._viewport.scrollTop),this._virtualizer.setViewportHeight(this._viewport.clientHeight),this._virtualizer.setCount(this._items.length);let t=this._virtualizer.getRange();this._spacer.style.height=`${Math.max(t.totalHeight,this._viewport.clientHeight)}px`,this._itemsLayer.style.transform=`translateY(${t.paddingTop}px)`;let e=document.createDocumentFragment();for(let n=t.start;n<t.end;n+=1)e.appendChild(this._renderVisibleItem(n));this._itemsLayer.replaceChildren(e)}_renderVisibleItem(t){let e=this._items[t],n=document.createElement("div");if(n.className="dt-list-item",n.dataset.index=String(t),this.selectable!=="none"&&(n.classList.add("dt-list-item--interactive"),n.setAttribute("role","option"),n.setAttribute("aria-selected",String(this._selectedIndices.has(t))),n.tabIndex=0),this._selectedIndices.has(t)&&n.classList.add("dt-list-item--selected"),this.itemHeight!==null&&(n.style.minHeight=`${this.itemHeight}px`),this._renderItem)this._renderItem(e,n,t);else{let i=this._getTemplate();i?n.appendChild(R(i,Xt(e))):n.textContent=String(e??"")}return n.addEventListener("click",()=>this._handleItemClick(t)),n.addEventListener("keydown",i=>{(i.key==="Enter"||i.key===" ")&&(i.preventDefault(),this._handleItemClick(t))}),this.itemHeight===null&&this._itemResizeObserver?.observe(n),n}_handleItemClick(t){let e=this._items[t],n=this.selectable;n==="single"?(this._selectedIndices=new Set([t]),this._emitSelectionChange(),this._render()):n==="multi"&&(this._selectedIndices.has(t)?this._selectedIndices.delete(t):this._selectedIndices.add(t),this._emitSelectionChange(),this._render()),this.dispatchEvent(new CustomEvent("dt-item-click",{detail:{item:e,index:t},bubbles:!0,composed:!0}))}_emitSelectionChange(){this.dispatchEvent(new CustomEvent("dt-selection-change",{detail:{selected:this.selectedItems},bubbles:!0,composed:!0}))}_getTemplate(){for(let t of Array.from(this.children))if(t instanceof HTMLTemplateElement)return t;return null}};var at=`:host {
1198
+ `;var st=56;function Wt(r){return r&&typeof r=="object"?r:{value:r}}var A=class extends HTMLElement{_items=[];_selectedIndices=new Set;_renderItem=null;_virtualizer=new g({estimateSize:st,overscan:5});_viewport;_spacer;_itemsLayer;_emptyState;_resizeObserver=null;_itemResizeObserver=null;static get observedAttributes(){return["item-height","dividers","selectable","empty-text"]}get items(){return this._items}set items(t){this._items=Array.isArray(t)?t:[],this._selectedIndices=new Set([...this._selectedIndices].filter(e=>e<this._items.length)),this._virtualizer.setCount(this._items.length),this._syncSizingMode(!0),this._render()}get selectedItems(){return[...this._selectedIndices].sort((t,e)=>t-e).map(t=>this._items[t])}get renderItem(){return this._renderItem}set renderItem(t){this._renderItem=typeof t=="function"?t:null,this._render()}get itemHeight(){let t=this.getAttribute("item-height");if(!t)return null;let e=Number(t);return Number.isFinite(e)&&e>0?e:null}set itemHeight(t){if(t===null||t<=0){this.removeAttribute("item-height");return}this.setAttribute("item-height",String(t))}get selectable(){let t=this.getAttribute("selectable");return t==="single"||t==="multi"?t:"none"}set selectable(t){this.setAttribute("selectable",t)}get emptyText(){return this.getAttribute("empty-text")??"No items"}set emptyText(t){this.setAttribute("empty-text",t)}constructor(){super();let t=this.attachShadow({mode:"open"}),e=document.createElement("style");e.textContent=ot,t.appendChild(e),this._viewport=document.createElement("div"),this._viewport.className="dt-list-view",this._viewport.addEventListener("scroll",this._onScroll,{passive:!0}),this._spacer=document.createElement("div"),this._spacer.className="dt-list-spacer",this._itemsLayer=document.createElement("div"),this._itemsLayer.className="dt-list-items",this._emptyState=document.createElement("div"),this._emptyState.className="dt-list-empty",this._spacer.append(this._itemsLayer,this._emptyState),this._viewport.appendChild(this._spacer),t.appendChild(this._viewport)}connectedCallback(){this._resizeObserver=new ResizeObserver(t=>{for(let e of t)e.target===this._viewport&&(this._virtualizer.setViewportHeight(e.contentRect.height),this._render())}),this._resizeObserver.observe(this._viewport),this._itemResizeObserver=new ResizeObserver(t=>{let e=0;for(let n of t){let i=n.target,o=Number(i.dataset.index);Number.isFinite(o)&&(e+=this._virtualizer.measure(o,n.contentRect.height))}e!==0&&(this._viewport.scrollTop+=e),t.length>0&&this._render()}),this._virtualizer.setCount(this._items.length),this._virtualizer.setViewportHeight(this._viewport.clientHeight),this._syncSizingMode(!1),this._render()}disconnectedCallback(){this._viewport.removeEventListener("scroll",this._onScroll),this._resizeObserver?.disconnect(),this._itemResizeObserver?.disconnect(),this._resizeObserver=null,this._itemResizeObserver=null}attributeChangedCallback(t){t==="item-height"&&this._syncSizingMode(!0),t==="selectable"&&this.selectable==="none"&&this._selectedIndices.size>0&&(this._selectedIndices.clear(),this._emitSelectionChange()),this._render()}_onScroll=()=>{this._virtualizer.setScrollTop(this._viewport.scrollTop),this._render()};_syncSizingMode(t){let e=this.itemHeight;this._virtualizer.setFixedSize(e),this._virtualizer.setEstimateSize(e??st),t&&this._virtualizer.resetMeasurements()}_render(){if(!this.isConnected)return;if(this._emptyState.textContent=this.emptyText,this._emptyState.hidden=this._items.length>0,this._items.length===0){this._itemsLayer.replaceChildren(),this._spacer.style.height="100%";return}this._virtualizer.setScrollTop(this._viewport.scrollTop),this._virtualizer.setViewportHeight(this._viewport.clientHeight),this._virtualizer.setCount(this._items.length);let t=this._virtualizer.getRange();this._spacer.style.height=`${Math.max(t.totalHeight,this._viewport.clientHeight)}px`,this._itemsLayer.style.transform=`translateY(${t.paddingTop}px)`;let e=document.createDocumentFragment();for(let n=t.start;n<t.end;n+=1)e.appendChild(this._renderVisibleItem(n));this._itemsLayer.replaceChildren(e)}_renderVisibleItem(t){let e=this._items[t],n=document.createElement("div");if(n.className="dt-list-item",n.dataset.index=String(t),this.selectable!=="none"&&(n.classList.add("dt-list-item--interactive"),n.setAttribute("role","option"),n.setAttribute("aria-selected",String(this._selectedIndices.has(t))),n.tabIndex=0),this._selectedIndices.has(t)&&n.classList.add("dt-list-item--selected"),this.itemHeight!==null&&(n.style.minHeight=`${this.itemHeight}px`),this._renderItem)this._renderItem(e,n,t);else{let i=this._getTemplate();i?n.appendChild(R(i,Wt(e))):n.textContent=String(e??"")}return n.addEventListener("click",()=>this._handleItemClick(t)),n.addEventListener("keydown",i=>{(i.key==="Enter"||i.key===" ")&&(i.preventDefault(),this._handleItemClick(t))}),this.itemHeight===null&&this._itemResizeObserver?.observe(n),n}_handleItemClick(t){let e=this._items[t],n=this.selectable;n==="single"?(this._selectedIndices=new Set([t]),this._emitSelectionChange(),this._render()):n==="multi"&&(this._selectedIndices.has(t)?this._selectedIndices.delete(t):this._selectedIndices.add(t),this._emitSelectionChange(),this._render()),this.dispatchEvent(new CustomEvent("dt-item-click",{detail:{item:e,index:t},bubbles:!0,composed:!0}))}_emitSelectionChange(){this.dispatchEvent(new CustomEvent("dt-selection-change",{detail:{selected:this.selectedItems},bubbles:!0,composed:!0}))}_getTemplate(){for(let t of Array.from(this.children))if(t instanceof HTMLTemplateElement)return t;return null}};var at=`:host {
1196
1199
  display: block;
1197
1200
  min-height: 220px;
1198
1201
  color: var(--dt-text);
@@ -1279,7 +1282,7 @@
1279
1282
  .dt-chart__status[hidden] {
1280
1283
  display: none;
1281
1284
  }
1282
- `;var V=null;function dt(){return window.__DtChart?Promise.resolve(window.__DtChart):V||(V=new Promise((r,t)=>{let e=document.createElement("script");e.src="/api/ui/chart.umd.js",e.async=!0,e.dataset.dtChart="true",e.onload=()=>{if(window.__DtChart){r(window.__DtChart);return}t(new Error("Chart runtime loaded without a __DtChart export."))},e.onerror=()=>t(new Error("Failed to load the Chart.js runtime bundle.")),document.head.appendChild(e)}),V)}function A(r,t,e){return Math.min(e,Math.max(t,r))}function Jt(r){return r?r.split(",").map(t=>t.trim()).filter(Boolean):[]}function J(r){let t=r.trim().match(/^#([0-9a-f]{3}|[0-9a-f]{6})$/i);if(t){let i=t[1],s=i.length===3?i.split("").map(c=>`${c}${c}`).join(""):i,o=parseInt(s.slice(0,2),16)/255,a=parseInt(s.slice(2,4),16)/255,d=parseInt(s.slice(4,6),16)/255;return lt(o,a,d)}let e=r.trim().match(/^rgba?\((\d+(?:\.\d+)?)[,\s]+(\d+(?:\.\d+)?)[,\s]+(\d+(?:\.\d+)?)(?:[,/\s]+[\d.]+)?\)$/i);if(e)return lt(Number(e[1])/255,Number(e[2])/255,Number(e[3])/255);let n=r.trim().match(/^hsla?\(([-\d.]+)(?:deg)?[,\s]+([\d.]+)%[,\s]+([\d.]+)%(?:[,/\s]+[\d.]+)?\)$/i);return n?{h:(Number(n[1])%360+360)%360,s:A(Number(n[2]),0,100),l:A(Number(n[3]),0,100)}:null}function lt(r,t,e){let n=Math.max(r,t,e),i=Math.min(r,t,e),s=n-i,o=0,a=(n+i)/2,d=s===0?0:s/(1-Math.abs(2*a-1));if(s!==0)switch(n){case r:o=60*((t-e)/s%6);break;case t:o=60*((e-r)/s+2);break;default:o=60*((r-t)/s+4);break}return{h:(o+360)%360,s:Math.round(d*100),l:Math.round(a*100)}}function b(r,t=1){return`hsla(${Math.round(r.h)} ${Math.round(r.s)}% ${Math.round(r.l)}% / ${t})`}function Wt(r){let t=J(r)??{h:185,s:88,l:56};return[0,32,68,118,164,212,258,304].map((n,i)=>({h:(t.h+n)%360,s:A(t.s-i*2,55,90),l:A(t.l+(i%2===0?0:6)-i,38,66)}))}function P(r){return!!r&&typeof r=="object"&&!Array.isArray(r)}function ct(r,t){if(!P(r)||!P(t))return t??r;let e={...r};for(let[n,i]of Object.entries(t)){let s=e[n];e[n]=P(s)&&P(i)?ct(s,i):i}return e}function Gt(r){return r==="top"||r==="bottom"||r==="left"||r==="right"?r:"none"}function jt(r){return r==="bar"||r==="line"||r==="area"||r==="pie"||r==="doughnut"||r==="radar"||r==="scatter"||r==="bubble"?r:"bar"}function qt(r){return r==="bar"||r==="line"||r==="area"||r==="scatter"||r==="bubble"}function Kt(r){return r.map(t=>t.trim()).filter(Boolean)}var M=class extends HTMLElement{_canvas;_status;_runtime=null;_loadPromise=null;_chart=null;_renderedType=null;_dataInput=null;_optionsOverride=null;_syncFrame=0;static get observedAttributes(){return["type","legend","stacked","labels"]}get type(){return jt(this.getAttribute("type"))}set type(t){this.setAttribute("type",t)}get legend(){return Gt(this.getAttribute("legend"))}set legend(t){this.setAttribute("legend",t)}get stacked(){return this.hasAttribute("stacked")}set stacked(t){this.toggleAttribute("stacked",t)}get labels(){return Kt(Jt(this.getAttribute("labels")))}set labels(t){this.setAttribute("labels",t.join(","))}get data(){return this._dataInput}set data(t){this._dataInput=t?structuredClone(t):null,this._scheduleSync()}get options(){return this._optionsOverride}set options(t){this._optionsOverride=t?structuredClone(t):null,this._renderChart()}constructor(){super();let t=this.attachShadow({mode:"open"}),e=document.createElement("style");e.textContent=at,t.appendChild(e);let n=document.createElement("div");n.className="dt-chart",this._canvas=document.createElement("canvas"),this._canvas.className="dt-chart__canvas",this._status=document.createElement("div"),this._status.className="dt-chart__status",this._status.textContent="Loading chart",n.append(this._canvas,this._status),t.appendChild(n)}connectedCallback(){this._canvas.addEventListener("click",this._handleCanvasClick),this._ensureRuntime().then(()=>this._renderChart()),this._scheduleSync()}disconnectedCallback(){this._canvas.removeEventListener("click",this._handleCanvasClick),this._syncFrame!==0&&(cancelAnimationFrame(this._syncFrame),this._syncFrame=0),this._chart?.destroy(),this._chart=null,this._renderedType=null}attributeChangedCallback(){this._scheduleSync()}_handleCanvasClick=t=>{if(!this._chart)return;let n=this._chart.getElementsAtEventForMode(t,"nearest",{intersect:!0},!0)[0];if(!n)return;let i=Array.isArray(this._chart.data.labels)?this._chart.data.labels[n.index]??null:null,s=this._chart.data.datasets[n.datasetIndex],o=Array.isArray(s?.data)?s.data[n.index]:void 0;this.dispatchEvent(new CustomEvent("dt-chart-click",{bubbles:!0,composed:!0,detail:{label:i,datasetIndex:n.datasetIndex,index:n.index,value:o}}))};_scheduleSync(){this._syncFrame===0&&(this._syncFrame=requestAnimationFrame(()=>{this._syncFrame=0,this._syncFromCurrentSource()}))}_syncFromCurrentSource(){this._renderChart()}async _ensureRuntime(){return this._runtime?this._runtime:(this._loadPromise||(this._loadPromise=dt().then(t=>(this._runtime=t,t))),this._loadPromise)}async _renderChart(){let t=this._dataInput;if(!t){this._setStatus("Waiting for data");return}let e=await this._ensureRuntime(),n=this._buildConfig(e,t),i=n.type;!this._chart||this._renderedType!==i?(this._chart?.destroy(),this._chart=new e.Chart(this._canvas,n),this._renderedType=i):(this._chart.data=n.data,this._chart.options=n.options,this._chart.update()),this._setStatus(t.datasets.length>0?null:"Waiting for data")}_buildConfig(t,e){let n=getComputedStyle(this),i=n.getPropertyValue("--dt-accent").trim()||"#42d4ff",s=n.getPropertyValue("--dt-text").trim()||"#d6ebff",o=n.getPropertyValue("--dt-text-muted").trim()||"#7b93a6",a=n.getPropertyValue("--dt-border").trim()||"rgba(123, 147, 166, 0.3)",d=n.getPropertyValue("--font-mono").trim()||"'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, monospace",c=Wt(i),l=this.type==="area"?"line":this.type,L={labels:e.labels??this.labels,datasets:e.datasets.map((h,bt)=>{let F=c[bt%c.length],p=h.color??b(F,1),O={label:h.label??"",data:h.data,backgroundColor:l==="line"||l==="radar"||l==="scatter"?b(F,l==="scatter"?.95:.24):p,borderColor:p,pointBackgroundColor:p,pointBorderColor:p,pointHoverBackgroundColor:p,pointRadius:this.type==="line"||this.type==="area"?3:4,pointHoverRadius:this.type==="line"||this.type==="area"?5:6,borderWidth:2,tension:l==="line"||this.type==="area"?.32:void 0,fill:this.type==="area"};return l==="pie"||l==="doughnut"?{...O,backgroundColor:Array.isArray(h.data)?h.data.map((vt,B)=>b(c[B%c.length],.86)):p,borderColor:Array.isArray(h.data)?h.data.map((vt,B)=>b(c[B%c.length],1)):p,borderWidth:1}:l==="scatter"||l==="bubble"?{...O,showLine:!1,backgroundColor:b(F,.78)}:O})},H={responsive:!0,maintainAspectRatio:!1,animation:{duration:320},interaction:{mode:"nearest",intersect:!0},plugins:{legend:{display:this.legend!=="none",position:this.legend==="none"?"top":this.legend,labels:{color:s,boxWidth:12,boxHeight:12,padding:14,font:{family:d,size:11}}},tooltip:{backgroundColor:"rgba(10, 18, 24, 0.92)",borderColor:Ut(a,i,.35),borderWidth:1,titleColor:s,bodyColor:s,footerColor:o,titleFont:{family:d,size:11},bodyFont:{family:d,size:11},padding:10}},scales:qt(this.type)?{x:{stacked:this.stacked,grid:{display:!1,color:a},border:{color:a},ticks:{color:o,font:{family:d,size:11}}},y:{stacked:this.stacked,beginAtZero:!0,grid:{display:!1,color:a},border:{color:a},ticks:{color:o,font:{family:d,size:11}}}}:l==="radar"?{r:{angleLines:{color:a},grid:{color:a},pointLabels:{color:o,font:{family:d,size:11}},ticks:{color:o,backdropColor:"transparent",font:{family:d,size:10}}}}:void 0};return{type:l,data:L,options:ct(H,this._optionsOverride??{})}}_setStatus(t){if(!t){this._status.hidden=!0;return}this._status.hidden=!1,this._status.textContent=t}};function Ut(r,t,e){let n=J(r),i=J(t);if(!n||!i)return r;let s=A(e,0,1),o=((i.h-n.h)%360+540)%360-180;return b({h:(n.h+o*s+360)%360,s:n.s+(i.s-n.s)*s,l:n.l+(i.l-n.l)*s})}var ht=`:host {
1285
+ `;var P=null;function dt(){return window.__DtChart?Promise.resolve(window.__DtChart):P||(P=new Promise((r,t)=>{let e=document.createElement("script");e.src="/api/ui/chart.umd.js",e.async=!0,e.dataset.dtChart="true",e.onload=()=>{if(window.__DtChart){r(window.__DtChart);return}t(new Error("Chart runtime loaded without a __DtChart export."))},e.onerror=()=>t(new Error("Failed to load the Chart.js runtime bundle.")),document.head.appendChild(e)}),P)}function M(r,t,e){return Math.min(e,Math.max(t,r))}function Xt(r){return r?r.split(",").map(t=>t.trim()).filter(Boolean):[]}function X(r){let t=r.trim().match(/^#([0-9a-f]{3}|[0-9a-f]{6})$/i);if(t){let i=t[1],o=i.length===3?i.split("").map(l=>`${l}${l}`).join(""):i,s=parseInt(o.slice(0,2),16)/255,a=parseInt(o.slice(2,4),16)/255,d=parseInt(o.slice(4,6),16)/255;return lt(s,a,d)}let e=r.trim().match(/^rgba?\((\d+(?:\.\d+)?)[,\s]+(\d+(?:\.\d+)?)[,\s]+(\d+(?:\.\d+)?)(?:[,/\s]+[\d.]+)?\)$/i);if(e)return lt(Number(e[1])/255,Number(e[2])/255,Number(e[3])/255);let n=r.trim().match(/^hsla?\(([-\d.]+)(?:deg)?[,\s]+([\d.]+)%[,\s]+([\d.]+)%(?:[,/\s]+[\d.]+)?\)$/i);return n?{h:(Number(n[1])%360+360)%360,s:M(Number(n[2]),0,100),l:M(Number(n[3]),0,100)}:null}function lt(r,t,e){let n=Math.max(r,t,e),i=Math.min(r,t,e),o=n-i,s=0,a=(n+i)/2,d=o===0?0:o/(1-Math.abs(2*a-1));if(o!==0)switch(n){case r:s=60*((t-e)/o%6);break;case t:s=60*((e-r)/o+2);break;default:s=60*((r-t)/o+4);break}return{h:(s+360)%360,s:Math.round(d*100),l:Math.round(a*100)}}function v(r,t=1){return`hsla(${Math.round(r.h)} ${Math.round(r.s)}% ${Math.round(r.l)}% / ${t})`}function Jt(r){let t=X(r)??{h:185,s:88,l:56};return[0,32,68,118,164,212,258,304].map((n,i)=>({h:(t.h+n)%360,s:M(t.s-i*2,55,90),l:M(t.l+(i%2===0?0:6)-i,38,66)}))}function V(r){return!!r&&typeof r=="object"&&!Array.isArray(r)}function ct(r,t){if(!V(r)||!V(t))return t??r;let e={...r};for(let[n,i]of Object.entries(t)){let o=e[n];e[n]=V(o)&&V(i)?ct(o,i):i}return e}function Gt(r){return r==="top"||r==="bottom"||r==="left"||r==="right"?r:"none"}function jt(r){return r==="bar"||r==="line"||r==="area"||r==="pie"||r==="doughnut"||r==="radar"||r==="scatter"||r==="bubble"?r:"bar"}function qt(r){return r==="bar"||r==="line"||r==="area"||r==="scatter"||r==="bubble"}function Kt(r){return r.map(t=>t.trim()).filter(Boolean)}var z=class extends HTMLElement{_canvas;_status;_runtime=null;_loadPromise=null;_chart=null;_renderedType=null;_dataInput=null;_optionsOverride=null;_syncFrame=0;static get observedAttributes(){return["type","legend","stacked","labels"]}get type(){return jt(this.getAttribute("type"))}set type(t){this.setAttribute("type",t)}get legend(){return Gt(this.getAttribute("legend"))}set legend(t){this.setAttribute("legend",t)}get stacked(){return this.hasAttribute("stacked")}set stacked(t){this.toggleAttribute("stacked",t)}get labels(){return Kt(Xt(this.getAttribute("labels")))}set labels(t){this.setAttribute("labels",t.join(","))}get data(){return this._dataInput}set data(t){this._dataInput=t?structuredClone(t):null,this._scheduleSync()}get options(){return this._optionsOverride}set options(t){this._optionsOverride=t?structuredClone(t):null,this._renderChart()}constructor(){super();let t=this.attachShadow({mode:"open"}),e=document.createElement("style");e.textContent=at,t.appendChild(e);let n=document.createElement("div");n.className="dt-chart",this._canvas=document.createElement("canvas"),this._canvas.className="dt-chart__canvas",this._status=document.createElement("div"),this._status.className="dt-chart__status",this._status.textContent="Loading chart",n.append(this._canvas,this._status),t.appendChild(n)}connectedCallback(){this._canvas.addEventListener("click",this._handleCanvasClick),this._ensureRuntime().then(()=>this._renderChart()),this._scheduleSync()}disconnectedCallback(){this._canvas.removeEventListener("click",this._handleCanvasClick),this._syncFrame!==0&&(cancelAnimationFrame(this._syncFrame),this._syncFrame=0),this._chart?.destroy(),this._chart=null,this._renderedType=null}attributeChangedCallback(){this._scheduleSync()}_handleCanvasClick=t=>{if(!this._chart)return;let n=this._chart.getElementsAtEventForMode(t,"nearest",{intersect:!0},!0)[0];if(!n)return;let i=Array.isArray(this._chart.data.labels)?this._chart.data.labels[n.index]??null:null,o=this._chart.data.datasets[n.datasetIndex],s=Array.isArray(o?.data)?o.data[n.index]:void 0;this.dispatchEvent(new CustomEvent("dt-chart-click",{bubbles:!0,composed:!0,detail:{label:i,datasetIndex:n.datasetIndex,index:n.index,value:s}}))};_scheduleSync(){this._syncFrame===0&&(this._syncFrame=requestAnimationFrame(()=>{this._syncFrame=0,this._syncFromCurrentSource()}))}_syncFromCurrentSource(){this._renderChart()}async _ensureRuntime(){return this._runtime?this._runtime:(this._loadPromise||(this._loadPromise=dt().then(t=>(this._runtime=t,t))),this._loadPromise)}async _renderChart(){let t=this._dataInput;if(!t){this._setStatus("Waiting for data");return}let e=await this._ensureRuntime(),n=this._buildConfig(e,t),i=n.type;!this._chart||this._renderedType!==i?(this._chart?.destroy(),this._chart=new e.Chart(this._canvas,n),this._renderedType=i):(this._chart.data=n.data,this._chart.options=n.options,this._chart.update()),this._setStatus(t.datasets.length>0?null:"Waiting for data")}_buildConfig(t,e){let n=getComputedStyle(this),i=n.getPropertyValue("--dt-accent").trim()||"#42d4ff",o=n.getPropertyValue("--dt-text").trim()||"#d6ebff",s=n.getPropertyValue("--dt-text-muted").trim()||"#7b93a6",a=n.getPropertyValue("--dt-border").trim()||"rgba(123, 147, 166, 0.3)",d=n.getPropertyValue("--font-mono").trim()||"'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, monospace",l=Jt(i),c=this.type==="area"?"line":this.type,u={labels:e.labels??this.labels,datasets:e.datasets.map((h,bt)=>{let F=l[bt%l.length],m=h.color??v(F,1),O={label:h.label??"",data:h.data,backgroundColor:c==="line"||c==="radar"||c==="scatter"?v(F,c==="scatter"?.95:.24):m,borderColor:m,pointBackgroundColor:m,pointBorderColor:m,pointHoverBackgroundColor:m,pointRadius:this.type==="line"||this.type==="area"?3:4,pointHoverRadius:this.type==="line"||this.type==="area"?5:6,borderWidth:2,tension:c==="line"||this.type==="area"?.32:void 0,fill:this.type==="area"};return c==="pie"||c==="doughnut"?{...O,backgroundColor:Array.isArray(h.data)?h.data.map((vt,B)=>v(l[B%l.length],.86)):m,borderColor:Array.isArray(h.data)?h.data.map((vt,B)=>v(l[B%l.length],1)):m,borderWidth:1}:c==="scatter"||c==="bubble"?{...O,showLine:!1,backgroundColor:v(F,.78)}:O})},H={responsive:!0,maintainAspectRatio:!1,animation:{duration:320},interaction:{mode:"nearest",intersect:!0},plugins:{legend:{display:this.legend!=="none",position:this.legend==="none"?"top":this.legend,labels:{color:o,boxWidth:12,boxHeight:12,padding:14,font:{family:d,size:11}}},tooltip:{backgroundColor:"rgba(10, 18, 24, 0.92)",borderColor:Ut(a,i,.35),borderWidth:1,titleColor:o,bodyColor:o,footerColor:s,titleFont:{family:d,size:11},bodyFont:{family:d,size:11},padding:10}},scales:qt(this.type)?{x:{stacked:this.stacked,grid:{display:!1,color:a},border:{color:a},ticks:{color:s,font:{family:d,size:11}}},y:{stacked:this.stacked,beginAtZero:!0,grid:{display:!1,color:a},border:{color:a},ticks:{color:s,font:{family:d,size:11}}}}:c==="radar"?{r:{angleLines:{color:a},grid:{color:a},pointLabels:{color:s,font:{family:d,size:11}},ticks:{color:s,backdropColor:"transparent",font:{family:d,size:10}}}}:void 0};return{type:c,data:u,options:ct(H,this._optionsOverride??{})}}_setStatus(t){if(!t){this._status.hidden=!0;return}this._status.hidden=!1,this._status.textContent=t}};function Ut(r,t,e){let n=X(r),i=X(t);if(!n||!i)return r;let o=M(e,0,1),s=((i.h-n.h)%360+540)%360-180;return v({h:(n.h+s*o+360)%360,s:n.s+(i.s-n.s)*o,l:n.l+(i.l-n.l)*o})}var ht=`:host {
1283
1286
  display: block;
1284
1287
  color: var(--dt-text);
1285
1288
  font-family: var(--font-sans, 'Inter', sans-serif);
@@ -1564,6 +1567,34 @@ ${n}`}var T=class extends HTMLElement{_body;_caret;_contentOverride=null;_runtim
1564
1567
  color: var(--dt-text);
1565
1568
  }
1566
1569
 
1570
+ .milkdown .ProseMirror.editor {
1571
+ padding: 0px 54px;
1572
+ }
1573
+
1574
+ .milkdown .ProseMirror.editor h1 {
1575
+ font-size: 36px;
1576
+ }
1577
+
1578
+ .milkdown .ProseMirror.editor h2 {
1579
+ font-size: 30px;
1580
+ }
1581
+
1582
+ .milkdown .ProseMirror.editor h3 {
1583
+ font-size: 24px;
1584
+ }
1585
+
1586
+ .milkdown .ProseMirror.editor h4 {
1587
+ font-size: 20px;
1588
+ }
1589
+
1590
+ .milkdown .ProseMirror.editor h5 {
1591
+ font-size: 16px;
1592
+ }
1593
+
1594
+ .milkdown .ProseMirror.editor h6 {
1595
+ font-size: 16px;
1596
+ }
1597
+
1567
1598
  .milkdown .editor {
1568
1599
  min-height: 100%;
1569
1600
  padding: 16px 18px 20px;
@@ -1574,10 +1605,6 @@ ${n}`}var T=class extends HTMLElement{_body;_caret;_contentOverride=null;_runtim
1574
1605
  line-height: 1.7;
1575
1606
  }
1576
1607
 
1577
- .milkdown .editor > :first-child {
1578
- margin-top: 0;
1579
- }
1580
-
1581
1608
  .milkdown .editor h1,
1582
1609
  .milkdown .editor h2,
1583
1610
  .milkdown .editor h3,
@@ -1603,10 +1630,6 @@ ${n}`}var T=class extends HTMLElement{_body;_caret;_contentOverride=null;_runtim
1603
1630
  font-size: 1.08rem;
1604
1631
  }
1605
1632
 
1606
- .milkdown .editor p {
1607
- margin: 0.65em 0;
1608
- }
1609
-
1610
1633
  .milkdown .editor code {
1611
1634
  padding: 2px 5px;
1612
1635
  border-radius: 2px;
@@ -1663,6 +1686,38 @@ ${n}`}var T=class extends HTMLElement{_body;_caret;_contentOverride=null;_runtim
1663
1686
  padding-left: 1.5rem;
1664
1687
  }
1665
1688
 
1689
+ /* Runtime Milkdown styles are injected after this file, so use scoped CSS
1690
+ variables instead of direct property overrides. */
1691
+ .milkdown .milkdown-list-item-block {
1692
+ --crepe-color-outline: var(--dt-text-secondary);
1693
+ }
1694
+
1695
+ .milkdown .milkdown-block-handle {
1696
+ --crepe-color-outline: var(--dt-text-muted);
1697
+ }
1698
+
1699
+ .milkdown .milkdown-block-handle .operation-item:hover {
1700
+ --crepe-color-outline: var(--dt-text-secondary);
1701
+ }
1702
+
1703
+ .milkdown .milkdown-toolbar {
1704
+ --crepe-color-outline: var(--dt-text-muted);
1705
+ --crepe-color-hover: color-mix(
1706
+ in srgb,
1707
+ var(--dt-surface-hover) 88%,
1708
+ var(--dt-text-secondary) 12%
1709
+ );
1710
+ --crepe-color-selected: color-mix(in srgb, var(--dt-surface-active) 74%, var(--dt-accent) 26%);
1711
+ }
1712
+
1713
+ .milkdown .milkdown-toolbar .toolbar-item:hover {
1714
+ --crepe-color-outline: var(--dt-text-secondary);
1715
+ }
1716
+
1717
+ .milkdown .milkdown-toolbar .toolbar-item.active {
1718
+ --crepe-color-primary: var(--dt-accent);
1719
+ }
1720
+
1666
1721
  .milkdown .editor img {
1667
1722
  max-width: 100%;
1668
1723
  border-radius: 2px;
@@ -1677,5 +1732,5 @@ ${n}`}var T=class extends HTMLElement{_body;_caret;_contentOverride=null;_runtim
1677
1732
  .milkdown .editor td {
1678
1733
  border: 1px solid var(--dt-border);
1679
1734
  }
1680
- `;var N=null;function gt(){return window.__DtMilkdown?Promise.resolve(window.__DtMilkdown):N||(N=new Promise((r,t)=>{let e=document.createElement("script");e.src="/api/ui/milkdown.umd.js",e.async=!0,e.dataset.dtMilkdown="true",e.onload=()=>{if(window.__DtMilkdown){r(window.__DtMilkdown);return}t(new Error("Milkdown runtime loaded without a __DtMilkdown export."))},e.onerror=()=>t(new Error("Failed to load the Milkdown runtime bundle.")),document.head.appendChild(e)}),N)}var z=class extends HTMLElement{_runtimeStyle;_surface;_content;_status;_runtime=null;_loadPromise=null;_editor=null;_pendingValue="";_changeTimer=null;_setupToken=0;_suppressNextChange=!1;static get observedAttributes(){return["placeholder","readonly"]}get placeholder(){return this.getAttribute("placeholder")??""}set placeholder(t){this.setAttribute("placeholder",t)}get readonly(){return this.hasAttribute("readonly")}set readonly(t){this.toggleAttribute("readonly",t)}get value(){return this._editor&&(this._pendingValue=this._editor.getMarkdown()),this._pendingValue}set value(t){let e=String(t??"");this._pendingValue=e,this._editor&&this._runtime&&this._editor.getMarkdown()!==e&&(this._suppressNextChange=!0,this._editor.editor.action(this._runtime.replaceAll(e)))}constructor(){super();let t=this.attachShadow({mode:"open"}),e=document.createElement("style");e.textContent=mt,t.appendChild(e),this._runtimeStyle=document.createElement("style"),t.appendChild(this._runtimeStyle),this._surface=document.createElement("div"),this._surface.className="dt-markdown-editor",this._content=document.createElement("div"),this._content.className="dt-markdown-editor__surface";let n=document.createElement("div");n.className="dt-markdown-editor__content",this._content.appendChild(n),this._status=document.createElement("div"),this._status.className="dt-markdown-editor__status",this._status.textContent="Loading editor",this._surface.append(this._content,this._status),t.appendChild(this._surface)}connectedCallback(){this._initializeEditor()}disconnectedCallback(){this._setupToken+=1,this._clearChangeTimer(),this._destroyEditor()}attributeChangedCallback(t){if(t==="readonly"){this._editor?.setReadonly(this.readonly);return}t==="placeholder"&&this.isConnected&&this._initializeEditor(!0)}async _ensureRuntime(){return this._runtime?this._runtime:(this._loadPromise||(this._loadPromise=gt().then(t=>(this._runtime=t,this._runtimeStyle.textContent=t.cssText,t))),this._loadPromise)}async _initializeEditor(t=!1){let e=++this._setupToken;if(this._setStatus("Loading editor"),t)await this._destroyEditor();else if(this._editor){this._setStatus(null);return}try{let n=await this._ensureRuntime();if(!this.isConnected||e!==this._setupToken)return;this._content.replaceChildren();let i=document.createElement("div");i.className="dt-markdown-editor__content",this._content.appendChild(i);let s=new n.Crepe({root:i,defaultValue:this._pendingValue,features:{[n.Crepe.Feature.CodeMirror]:!1,[n.Crepe.Feature.ImageBlock]:!1,[n.Crepe.Feature.Latex]:!1},featureConfigs:{[n.Crepe.Feature.Placeholder]:{text:this.placeholder,mode:"doc"}}});if(s.on(o=>{o.markdownUpdated((a,d)=>{if(this._pendingValue=d,this._suppressNextChange){this._suppressNextChange=!1;return}this._queueChange(d)}),o.focus(()=>{this.dispatchEvent(new CustomEvent("dt-focus",{bubbles:!0,composed:!0}))}),o.blur(()=>{this.dispatchEvent(new CustomEvent("dt-blur",{bubbles:!0,composed:!0}))})}),await s.create(),!this.isConnected||e!==this._setupToken){await s.destroy();return}this._editor=s,this._editor.setReadonly(this.readonly),this._pendingValue=this._editor.getMarkdown(),this._setStatus(null)}catch{e===this._setupToken&&this._setStatus("Failed to load editor")}}async _destroyEditor(){let t=this._editor;if(this._editor=null,!!t)try{await t.destroy()}catch{}}_queueChange(t){this._clearChangeTimer(),this._changeTimer=setTimeout(()=>{this._changeTimer=null,this.dispatchEvent(new CustomEvent("dt-change",{bubbles:!0,composed:!0,detail:{value:t}}))},300)}_clearChangeTimer(){this._changeTimer&&(clearTimeout(this._changeTimer),this._changeTimer=null)}_setStatus(t){if(t){this._status.hidden=!1,this._status.textContent=t;return}this._status.hidden=!0}};customElements.get("dt-tooltip")||customElements.define("dt-tooltip",v);customElements.get("dt-card")||customElements.define("dt-card",f);customElements.get("dt-select")||customElements.define("dt-select",_);customElements.get("dt-grid")||customElements.define("dt-grid",x);customElements.get("dt-stack")||customElements.define("dt-stack",w);customElements.get("dt-stat")||customElements.define("dt-stat",y);customElements.get("dt-badge")||customElements.define("dt-badge",k);customElements.get("dt-button")||customElements.define("dt-button",C);customElements.get("dt-divider")||customElements.define("dt-divider",E);customElements.get("dt-list-view")||customElements.define("dt-list-view",D);customElements.get("dt-table-view")||customElements.define("dt-table-view",S);customElements.get("dt-column")||customElements.define("dt-column",g);customElements.get("dt-chart")||customElements.define("dt-chart",M);customElements.get("dt-markdown")||customElements.define("dt-markdown",T);customElements.get("dt-markdown-editor")||customElements.define("dt-markdown-editor",z);return kt(Qt);})();
1735
+ `;var N=null;function gt(){return window.__DtMilkdown?Promise.resolve(window.__DtMilkdown):N||(N=new Promise((r,t)=>{let e=document.createElement("script");e.src="/api/ui/milkdown.umd.js",e.async=!0,e.dataset.dtMilkdown="true",e.onload=()=>{if(window.__DtMilkdown){r(window.__DtMilkdown);return}t(new Error("Milkdown runtime loaded without a __DtMilkdown export."))},e.onerror=()=>t(new Error("Failed to load the Milkdown runtime bundle.")),document.head.appendChild(e)}),N)}var L=class extends HTMLElement{_shadow;_runtimeStyleAnchor;_surface;_content;_status;_runtime=null;_loadPromise=null;_editor=null;_pendingValue="";_changeTimer=null;_setupToken=0;_suppressNextChange=!1;static get observedAttributes(){return["placeholder","readonly"]}get placeholder(){return this.getAttribute("placeholder")??""}set placeholder(t){this.setAttribute("placeholder",t)}get readonly(){return this.hasAttribute("readonly")}set readonly(t){this.toggleAttribute("readonly",t)}get value(){return this._editor&&(this._pendingValue=this._editor.getMarkdown()),this._pendingValue}set value(t){let e=String(t??"");this._pendingValue=e,this._editor&&this._runtime&&this._editor.getMarkdown()!==e&&(this._suppressNextChange=!0,this._editor.editor.action(this._runtime.replaceAll(e)))}constructor(){super();let t=this.attachShadow({mode:"open"});this._shadow=t;let e=document.createElement("style");e.textContent=mt,t.appendChild(e),this._runtimeStyleAnchor=document.createComment("runtime-styles"),t.appendChild(this._runtimeStyleAnchor),this._surface=document.createElement("div"),this._surface.className="dt-markdown-editor",this._content=document.createElement("div"),this._content.className="dt-markdown-editor__surface";let n=document.createElement("div");n.className="dt-markdown-editor__content",this._content.appendChild(n),this._status=document.createElement("div"),this._status.className="dt-markdown-editor__status",this._status.textContent="Loading editor",this._surface.append(this._content,this._status),t.appendChild(this._surface)}connectedCallback(){this._initializeEditor()}disconnectedCallback(){this._setupToken+=1,this._clearChangeTimer(),this._destroyEditor()}attributeChangedCallback(t){if(t==="readonly"){this._editor?.setReadonly(this.readonly);return}t==="placeholder"&&this.isConnected&&this._initializeEditor(!0)}async _ensureRuntime(){return this._runtime?this._runtime:(this._loadPromise||(this._loadPromise=gt().then(t=>{this._runtime=t;let e=this._runtimeStyleAnchor;for(let n of t.cssEntries){let i=document.createElement("style");i.dataset.css=n.name,i.textContent=n.css,e.parentNode.insertBefore(i,e.nextSibling)}return t})),this._loadPromise)}async _initializeEditor(t=!1){let e=++this._setupToken;if(this._setStatus("Loading editor"),t)await this._destroyEditor();else if(this._editor){this._setStatus(null);return}try{let n=await this._ensureRuntime();if(!this.isConnected||e!==this._setupToken)return;this._content.replaceChildren();let i=document.createElement("div");i.className="dt-markdown-editor__content",this._content.appendChild(i);let o=new n.Crepe({root:i,defaultValue:this._pendingValue,features:{[n.Crepe.Feature.CodeMirror]:!1,[n.Crepe.Feature.ImageBlock]:!1,[n.Crepe.Feature.Latex]:!1},featureConfigs:{[n.Crepe.Feature.Placeholder]:{text:this.placeholder,mode:"doc"}}});if(o.on(s=>{s.markdownUpdated((a,d)=>{if(this._pendingValue=d,this._suppressNextChange){this._suppressNextChange=!1;return}this._queueChange(d)}),s.focus(()=>{this.dispatchEvent(new CustomEvent("dt-focus",{bubbles:!0,composed:!0}))}),s.blur(()=>{this.dispatchEvent(new CustomEvent("dt-blur",{bubbles:!0,composed:!0}))})}),await o.create(),!this.isConnected||e!==this._setupToken){await o.destroy();return}this._editor=o,this._editor.setReadonly(this.readonly),this._pendingValue=this._editor.getMarkdown(),this._setStatus(null)}catch{e===this._setupToken&&this._setStatus("Failed to load editor")}}async _destroyEditor(){let t=this._editor;if(this._editor=null,!!t)try{await t.destroy()}catch{}}_queueChange(t){this._clearChangeTimer(),this._changeTimer=setTimeout(()=>{this._changeTimer=null,this.dispatchEvent(new CustomEvent("dt-change",{bubbles:!0,composed:!0,detail:{value:t}}))},300)}_clearChangeTimer(){this._changeTimer&&(clearTimeout(this._changeTimer),this._changeTimer=null)}_setStatus(t){if(t){this._status.hidden=!1,this._status.textContent=t;return}this._status.hidden=!0}};customElements.get("dt-tooltip")||customElements.define("dt-tooltip",f);customElements.get("dt-card")||customElements.define("dt-card",_);customElements.get("dt-select")||customElements.define("dt-select",w);customElements.get("dt-grid")||customElements.define("dt-grid",x);customElements.get("dt-stack")||customElements.define("dt-stack",y);customElements.get("dt-stat")||customElements.define("dt-stat",k);customElements.get("dt-badge")||customElements.define("dt-badge",C);customElements.get("dt-button")||customElements.define("dt-button",E);customElements.get("dt-divider")||customElements.define("dt-divider",S);customElements.get("dt-list-view")||customElements.define("dt-list-view",A);customElements.get("dt-table-view")||customElements.define("dt-table-view",D);customElements.get("dt-column")||customElements.define("dt-column",b);customElements.get("dt-chart")||customElements.define("dt-chart",z);customElements.get("dt-markdown")||customElements.define("dt-markdown",T);customElements.get("dt-markdown-editor")||customElements.define("dt-markdown-editor",L);return kt(Qt);})();
1681
1736
  //# sourceMappingURL=desktalk-ui.js.map